@nakafa/aksara-contracts 8.2.0 → 8.4.1
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 +1 -1
- package/dist/assessment/document.js +1 -1
- package/dist/assessment/figure.d.ts +1 -1
- package/dist/assessment/figure.js +1 -1
- package/dist/assessment/fit.d.ts +3 -3
- package/dist/assessment/fit.js +3 -3
- package/dist/assessment/locales.d.ts +1 -1
- package/dist/assessment/scoring.d.ts +1 -1
- package/dist/assessment/scoring.js +1 -1
- package/dist/cache/content.d.ts +1 -1
- package/dist/cache/content.js +1 -1
- package/dist/content.d.ts +3 -2
- package/dist/graph/identity.d.ts +1 -1
- package/dist/graph/identity.js +1 -1
- package/dist/math/boundary.d.ts +9 -0
- package/dist/math/boundary.js +81 -0
- package/dist/math/bounds.d.ts +1 -1
- package/dist/math/collision.d.ts +1 -1
- package/dist/math/coordinate.d.ts +6 -5
- package/dist/math/coordinate.js +2 -2
- package/dist/math/curve.d.ts +1 -0
- package/dist/math/curve.js +4 -2
- package/dist/math/formula/affine.d.ts +22 -0
- package/dist/math/formula/affine.js +79 -0
- package/dist/math/formula/compile.d.ts +1 -1
- package/dist/math/formula/compile.js +1 -1
- package/dist/math/formula/contour.d.ts +1 -1
- package/dist/math/formula/contour.js +28 -13
- package/dist/math/formula/field.js +1 -1
- package/dist/math/formula/mesh.d.ts +1 -1
- package/dist/math/formula/mesh.js +1 -1
- package/dist/math/formula/names.d.ts +1 -1
- package/dist/math/formula/names.js +1 -1
- package/dist/math/formula/parse.d.ts +1 -1
- package/dist/math/formula/parse.js +1 -1
- package/dist/math/formula/plane.d.ts +2 -2
- package/dist/math/formula/plane.js +3 -3
- package/dist/math/formula/reader.d.ts +2 -1
- package/dist/math/formula/reader.js +1 -1
- package/dist/math/formula/region.d.ts +2 -2
- package/dist/math/formula/region.js +3 -3
- package/dist/math/formula/sample.d.ts +1 -1
- package/dist/math/formula/scan.d.ts +1 -1
- package/dist/math/formula/scan.js +1 -1
- package/dist/math/formula/slider.d.ts +2 -2
- package/dist/math/formula/slider.js +1 -1
- package/dist/math/formula/space.d.ts +1 -1
- package/dist/math/formula/space.js +1 -1
- package/dist/math/object.d.ts +12 -0
- package/dist/math/object.js +11 -0
- package/dist/math/plane.d.ts +10 -0
- package/dist/math/plane.js +7 -1
- package/dist/math/precision.d.ts +1 -1
- package/dist/math/precision.js +1 -1
- package/dist/math/resolution.js +1 -1
- package/dist/math/scene.d.ts +2 -2
- package/dist/math/space.d.ts +8 -0
- package/dist/math/space.js +5 -1
- package/dist/math/vector.d.ts +1 -1
- package/dist/math/visual.d.ts +239 -212
- package/dist/preview/spec.js +1 -1
- package/dist/program/curriculum.d.ts +1 -1
- package/dist/program/curriculum.js +1 -1
- package/dist/program/snapshot/digest.d.ts +1 -1
- package/dist/program/snapshot/digest.js +2 -2
- package/dist/program/snapshot/hash.d.ts +2 -2
- package/dist/projection/digest.d.ts +1 -1
- package/dist/projection/digest.js +1 -1
- package/dist/projection/hash.js +1 -1
- package/dist/projection/material.d.ts +1 -1
- package/dist/projection/material.js +1 -1
- package/dist/projection/verify.js +1 -1
- package/dist/quran/identity.d.ts +2 -1
- package/dist/quran/provenance.d.ts +2 -2
- package/dist/quran/provenance.js +1 -1
- package/dist/quran/snapshot/hash.d.ts +1 -1
- package/dist/quran/snapshot/row/hash.d.ts +1 -1
- package/dist/quran/snapshot/row/hash.js +1 -1
- package/dist/quran/snapshot/spec.js +1 -1
- package/dist/quran/source.d.ts +2 -2
- package/dist/release/current/evidence.d.ts +1 -1
- package/dist/release/current/evidence.js +1 -1
- package/dist/release/current/state.d.ts +1 -1
- package/dist/release/current/state.js +1 -1
- package/dist/release/head.js +1 -1
- package/dist/release/items.d.ts +1 -1
- package/dist/release/items.js +1 -1
- package/dist/release/policy.d.ts +1 -1
- package/dist/release/policy.js +1 -1
- package/dist/release/result/digest.d.ts +3 -3
- package/dist/release/result/digest.js +2 -2
- package/dist/release/rollback/digest.d.ts +1 -1
- package/dist/release/rollback/digest.js +1 -1
- package/dist/release/route/digest.d.ts +1 -1
- package/dist/release/route/digest.js +1 -1
- package/dist/release/snapshot/evidence/assessment.d.ts +1 -1
- package/dist/release/snapshot/evidence/assessment.js +1 -1
- package/dist/release/snapshot/evidence/program.d.ts +1 -1
- package/dist/release/snapshot/evidence/program.js +1 -1
- package/dist/release/snapshot/evidence/quran.d.ts +1 -1
- package/dist/release/snapshot/evidence/quran.js +1 -1
- package/dist/release/snapshot/evidence/requirement.d.ts +3 -2
- package/dist/release/snapshot/evidence/requirement.js +1 -1
- package/dist/release/snapshot/spec.d.ts +2 -2
- package/dist/release/snapshot/spec.js +1 -1
- package/dist/release/snapshot/verify.d.ts +1 -1
- package/dist/release/snapshot/verify.js +1 -1
- package/dist/release/spec.d.ts +1 -1
- package/dist/release/verify.d.ts +1 -1
- package/dist/release/verify.js +1 -1
- package/dist/renderer/compatibility.d.ts +1 -1
- package/dist/renderer/compatibility.js +2 -2
- package/dist/renderer/contract.d.ts +1 -1
- package/dist/renderer/contract.js +1 -1
- package/dist/runtime/spec.js +2 -2
- package/dist/signature/spec.d.ts +3 -2
- package/dist/signature/verify.d.ts +2 -1
- package/dist/transport/request.d.ts +1 -1
- package/dist/visual/base/math.d.ts +79 -1
- package/dist/visual/base/math.js +31 -3
- package/dist/visual/base/media.d.ts +68 -1
- package/dist/visual/biology/bacteria.d.ts +269 -1
- package/dist/visual/biology/bacteria.js +1 -1
- package/dist/visual/biology/cell.d.ts +202 -1
- package/dist/visual/biology/climate.d.ts +202 -1
- package/dist/visual/biology/climate.js +1 -1
- package/dist/visual/biology/ecology.d.ts +269 -1
- package/dist/visual/biology/physiology.d.ts +202 -1
- package/dist/visual/biology/physiology.js +1 -1
- package/dist/visual/biology/plant.d.ts +336 -1
- package/dist/visual/biology/plant.js +1 -1
- package/dist/visual/biology.d.ts +1 -1
- package/dist/visual/card.d.ts +79 -1
- package/dist/visual/card.js +18 -2
- package/dist/visual/catalog.d.ts +14164 -2
- package/dist/visual/catalog.js +4 -0
- package/dist/visual/chemistry/atom.d.ts +202 -1
- package/dist/visual/chemistry/atom.js +1 -1
- package/dist/visual/chemistry/balance.d.ts +336 -1
- package/dist/visual/chemistry/balance.js +1 -1
- package/dist/visual/chemistry/bonding.d.ts +336 -1
- package/dist/visual/chemistry/discovery.d.ts +470 -1
- package/dist/visual/chemistry/electrochemistry.d.ts +135 -1
- package/dist/visual/chemistry/electrochemistry.js +1 -1
- package/dist/visual/chemistry/electron.d.ts +135 -1
- package/dist/visual/chemistry/electron.js +1 -1
- package/dist/visual/chemistry/laws.d.ts +269 -1
- package/dist/visual/chemistry/laws.js +1 -1
- package/dist/visual/chemistry/particles.d.ts +336 -1
- package/dist/visual/chemistry/periodic.d.ts +135 -1
- package/dist/visual/chemistry/periodic.js +1 -1
- package/dist/visual/chemistry/rate.d.ts +68 -1
- package/dist/visual/chemistry/rate.js +1 -1
- package/dist/visual/chemistry/reaction.d.ts +202 -1
- package/dist/visual/chemistry/reaction.js +1 -1
- package/dist/visual/chemistry/titration.d.ts +68 -1
- package/dist/visual/chemistry/titration.js +1 -1
- package/dist/visual/length.d.ts +79 -0
- package/dist/visual/length.js +37 -0
- package/dist/visual/mathematics/chance.d.ts +258 -0
- package/dist/visual/mathematics/chance.js +117 -0
- package/dist/visual/mathematics/chart.d.ts +68 -1
- package/dist/visual/mathematics/charts.d.ts +336 -1
- package/dist/visual/mathematics/function.d.ts +202 -1
- package/dist/visual/mathematics/numeral.d.ts +170 -0
- package/dist/visual/mathematics/numeral.js +85 -0
- package/dist/visual/physics/braking.d.ts +269 -1
- package/dist/visual/physics/braking.js +1 -1
- package/dist/visual/physics/circuit.d.ts +269 -1
- package/dist/visual/physics/circular.d.ts +135 -1
- package/dist/visual/physics/circular.js +1 -1
- package/dist/visual/physics/dynamics.d.ts +470 -1
- package/dist/visual/physics/dynamics.js +1 -1
- package/dist/visual/physics/efficiency.d.ts +403 -1
- package/dist/visual/physics/efficiency.js +1 -1
- package/dist/visual/physics/electronics.d.ts +202 -1
- package/dist/visual/physics/falling.d.ts +269 -1
- package/dist/visual/physics/falling.js +1 -1
- package/dist/visual/physics/field.d.ts +202 -1
- package/dist/visual/physics/fluid.d.ts +269 -1
- package/dist/visual/physics/fluid.js +1 -1
- package/dist/visual/physics/force.d.ts +336 -1
- package/dist/visual/physics/gravity.d.ts +135 -1
- package/dist/visual/physics/heat.d.ts +202 -1
- package/dist/visual/physics/heat.js +1 -1
- package/dist/visual/physics/instrument.d.ts +470 -1
- package/dist/visual/physics/light.d.ts +269 -1
- package/dist/visual/physics/light.js +1 -1
- package/dist/visual/physics/measurement.d.ts +269 -1
- package/dist/visual/physics/measurement.js +1 -1
- package/dist/visual/physics/motion.d.ts +403 -1
- package/dist/visual/physics/nuclear.d.ts +202 -1
- package/dist/visual/physics/parabolic.d.ts +68 -1
- package/dist/visual/physics/position.d.ts +403 -1
- package/dist/visual/physics/position.js +1 -1
- package/dist/visual/physics/power.d.ts +537 -1
- package/dist/visual/physics/power.js +1 -1
- package/dist/visual/physics/precision.d.ts +470 -1
- package/dist/visual/physics/precision.js +1 -1
- package/dist/visual/physics/product.d.ts +269 -1
- package/dist/visual/physics/reading.d.ts +202 -1
- package/dist/visual/physics/reading.js +1 -1
- package/dist/visual/physics/record.d.ts +135 -1
- package/dist/visual/physics/record.js +1 -1
- package/dist/visual/physics/relative.d.ts +202 -1
- package/dist/visual/physics/relative.js +1 -1
- package/dist/visual/physics/solar.d.ts +403 -1
- package/dist/visual/physics/solar.js +1 -1
- package/dist/visual/physics/vector.d.ts +336 -1
- package/dist/visual/physics/vector.js +1 -1
- package/dist/visual/physics/velocity.d.ts +470 -1
- package/dist/visual/physics/wave.d.ts +269 -1
- package/dist/visual/politics.d.ts +403 -1
- package/package.json +2 -2
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
import type { RichSlot } from "#contracts/visual/card";
|
|
3
|
+
/** The probability labs, where a random experiment runs many times. */
|
|
4
|
+
export declare function chanceVisuals<E>(rich: RichSlot<E>): {
|
|
5
|
+
DiceRollLab: import("#contracts/visual/entry").VisualEntry<Schema.Struct<{
|
|
6
|
+
readonly description: RichSlot<E>;
|
|
7
|
+
readonly footer: Schema.optionalKey<Schema.Codec<readonly [{
|
|
8
|
+
readonly attrs: {
|
|
9
|
+
readonly latex: string;
|
|
10
|
+
};
|
|
11
|
+
readonly type: "mathInline";
|
|
12
|
+
} | {
|
|
13
|
+
readonly marks?: readonly [{
|
|
14
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
15
|
+
} | {
|
|
16
|
+
readonly attrs: {
|
|
17
|
+
readonly href: string;
|
|
18
|
+
};
|
|
19
|
+
readonly type: "link";
|
|
20
|
+
} | {
|
|
21
|
+
readonly attrs: {
|
|
22
|
+
readonly variant: "success" | "warning" | null;
|
|
23
|
+
};
|
|
24
|
+
readonly type: "highlight";
|
|
25
|
+
}, ...({
|
|
26
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
27
|
+
} | {
|
|
28
|
+
readonly attrs: {
|
|
29
|
+
readonly href: string;
|
|
30
|
+
};
|
|
31
|
+
readonly type: "link";
|
|
32
|
+
} | {
|
|
33
|
+
readonly attrs: {
|
|
34
|
+
readonly variant: "success" | "warning" | null;
|
|
35
|
+
};
|
|
36
|
+
readonly type: "highlight";
|
|
37
|
+
})[]];
|
|
38
|
+
readonly text: string;
|
|
39
|
+
readonly type: "text";
|
|
40
|
+
}, ...({
|
|
41
|
+
readonly attrs: {
|
|
42
|
+
readonly latex: string;
|
|
43
|
+
};
|
|
44
|
+
readonly type: "mathInline";
|
|
45
|
+
} | {
|
|
46
|
+
readonly marks?: readonly [{
|
|
47
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
48
|
+
} | {
|
|
49
|
+
readonly attrs: {
|
|
50
|
+
readonly href: string;
|
|
51
|
+
};
|
|
52
|
+
readonly type: "link";
|
|
53
|
+
} | {
|
|
54
|
+
readonly attrs: {
|
|
55
|
+
readonly variant: "success" | "warning" | null;
|
|
56
|
+
};
|
|
57
|
+
readonly type: "highlight";
|
|
58
|
+
}, ...({
|
|
59
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
60
|
+
} | {
|
|
61
|
+
readonly attrs: {
|
|
62
|
+
readonly href: string;
|
|
63
|
+
};
|
|
64
|
+
readonly type: "link";
|
|
65
|
+
} | {
|
|
66
|
+
readonly attrs: {
|
|
67
|
+
readonly variant: "success" | "warning" | null;
|
|
68
|
+
};
|
|
69
|
+
readonly type: "highlight";
|
|
70
|
+
})[]];
|
|
71
|
+
readonly text: string;
|
|
72
|
+
readonly type: "text";
|
|
73
|
+
})[]], E, never, never>>;
|
|
74
|
+
readonly title: RichSlot<E>;
|
|
75
|
+
readonly dice: Schema.Literals<readonly [1, 2]>;
|
|
76
|
+
readonly target: Schema.optionalKey<Schema.Int>;
|
|
77
|
+
readonly labels: Schema.Struct<{
|
|
78
|
+
readonly frequency: RichSlot<E>;
|
|
79
|
+
readonly hits: RichSlot<E>;
|
|
80
|
+
readonly probability: RichSlot<E>;
|
|
81
|
+
readonly trials: RichSlot<E>;
|
|
82
|
+
readonly viewLabel: Schema.Trimmed;
|
|
83
|
+
}>;
|
|
84
|
+
}>, "figure">;
|
|
85
|
+
GaltonBoardLab: import("#contracts/visual/entry").VisualEntry<Schema.Struct<{
|
|
86
|
+
readonly description: RichSlot<E>;
|
|
87
|
+
readonly footer: Schema.optionalKey<Schema.Codec<readonly [{
|
|
88
|
+
readonly attrs: {
|
|
89
|
+
readonly latex: string;
|
|
90
|
+
};
|
|
91
|
+
readonly type: "mathInline";
|
|
92
|
+
} | {
|
|
93
|
+
readonly marks?: readonly [{
|
|
94
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
95
|
+
} | {
|
|
96
|
+
readonly attrs: {
|
|
97
|
+
readonly href: string;
|
|
98
|
+
};
|
|
99
|
+
readonly type: "link";
|
|
100
|
+
} | {
|
|
101
|
+
readonly attrs: {
|
|
102
|
+
readonly variant: "success" | "warning" | null;
|
|
103
|
+
};
|
|
104
|
+
readonly type: "highlight";
|
|
105
|
+
}, ...({
|
|
106
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
107
|
+
} | {
|
|
108
|
+
readonly attrs: {
|
|
109
|
+
readonly href: string;
|
|
110
|
+
};
|
|
111
|
+
readonly type: "link";
|
|
112
|
+
} | {
|
|
113
|
+
readonly attrs: {
|
|
114
|
+
readonly variant: "success" | "warning" | null;
|
|
115
|
+
};
|
|
116
|
+
readonly type: "highlight";
|
|
117
|
+
})[]];
|
|
118
|
+
readonly text: string;
|
|
119
|
+
readonly type: "text";
|
|
120
|
+
}, ...({
|
|
121
|
+
readonly attrs: {
|
|
122
|
+
readonly latex: string;
|
|
123
|
+
};
|
|
124
|
+
readonly type: "mathInline";
|
|
125
|
+
} | {
|
|
126
|
+
readonly marks?: readonly [{
|
|
127
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
128
|
+
} | {
|
|
129
|
+
readonly attrs: {
|
|
130
|
+
readonly href: string;
|
|
131
|
+
};
|
|
132
|
+
readonly type: "link";
|
|
133
|
+
} | {
|
|
134
|
+
readonly attrs: {
|
|
135
|
+
readonly variant: "success" | "warning" | null;
|
|
136
|
+
};
|
|
137
|
+
readonly type: "highlight";
|
|
138
|
+
}, ...({
|
|
139
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
140
|
+
} | {
|
|
141
|
+
readonly attrs: {
|
|
142
|
+
readonly href: string;
|
|
143
|
+
};
|
|
144
|
+
readonly type: "link";
|
|
145
|
+
} | {
|
|
146
|
+
readonly attrs: {
|
|
147
|
+
readonly variant: "success" | "warning" | null;
|
|
148
|
+
};
|
|
149
|
+
readonly type: "highlight";
|
|
150
|
+
})[]];
|
|
151
|
+
readonly text: string;
|
|
152
|
+
readonly type: "text";
|
|
153
|
+
})[]], E, never, never>>;
|
|
154
|
+
readonly title: RichSlot<E>;
|
|
155
|
+
readonly labels: Schema.Struct<{
|
|
156
|
+
readonly balls: RichSlot<E>;
|
|
157
|
+
readonly expected: RichSlot<E>;
|
|
158
|
+
readonly mean: RichSlot<E>;
|
|
159
|
+
readonly rows: Schema.Trimmed;
|
|
160
|
+
readonly spread: RichSlot<E>;
|
|
161
|
+
readonly tilt: Schema.Trimmed;
|
|
162
|
+
readonly viewLabel: Schema.Trimmed;
|
|
163
|
+
}>;
|
|
164
|
+
readonly probability: Schema.Literals<readonly [0.3, 0.5, 0.7]>;
|
|
165
|
+
readonly rows: Schema.Int;
|
|
166
|
+
readonly showExpected: Schema.optionalKey<Schema.Boolean>;
|
|
167
|
+
}>, "figure">;
|
|
168
|
+
MarbleDrawLab: import("#contracts/visual/entry").VisualEntry<Schema.Struct<{
|
|
169
|
+
readonly description: RichSlot<E>;
|
|
170
|
+
readonly footer: Schema.optionalKey<Schema.Codec<readonly [{
|
|
171
|
+
readonly attrs: {
|
|
172
|
+
readonly latex: string;
|
|
173
|
+
};
|
|
174
|
+
readonly type: "mathInline";
|
|
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 text: string;
|
|
202
|
+
readonly type: "text";
|
|
203
|
+
}, ...({
|
|
204
|
+
readonly attrs: {
|
|
205
|
+
readonly latex: string;
|
|
206
|
+
};
|
|
207
|
+
readonly type: "mathInline";
|
|
208
|
+
} | {
|
|
209
|
+
readonly marks?: readonly [{
|
|
210
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
211
|
+
} | {
|
|
212
|
+
readonly attrs: {
|
|
213
|
+
readonly href: string;
|
|
214
|
+
};
|
|
215
|
+
readonly type: "link";
|
|
216
|
+
} | {
|
|
217
|
+
readonly attrs: {
|
|
218
|
+
readonly variant: "success" | "warning" | null;
|
|
219
|
+
};
|
|
220
|
+
readonly type: "highlight";
|
|
221
|
+
}, ...({
|
|
222
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
223
|
+
} | {
|
|
224
|
+
readonly attrs: {
|
|
225
|
+
readonly href: string;
|
|
226
|
+
};
|
|
227
|
+
readonly type: "link";
|
|
228
|
+
} | {
|
|
229
|
+
readonly attrs: {
|
|
230
|
+
readonly variant: "success" | "warning" | null;
|
|
231
|
+
};
|
|
232
|
+
readonly type: "highlight";
|
|
233
|
+
})[]];
|
|
234
|
+
readonly text: string;
|
|
235
|
+
readonly type: "text";
|
|
236
|
+
})[]], E, never, never>>;
|
|
237
|
+
readonly title: RichSlot<E>;
|
|
238
|
+
readonly event: Schema.optionalKey<Schema.Struct<{
|
|
239
|
+
readonly first: Schema.Literals<readonly ["red", "blue", "green", "yellow", "white"]>;
|
|
240
|
+
readonly second: Schema.Literals<readonly ["red", "blue", "green", "yellow", "white"]>;
|
|
241
|
+
}>>;
|
|
242
|
+
readonly labels: Schema.Struct<{
|
|
243
|
+
readonly both: RichSlot<E>;
|
|
244
|
+
readonly first: RichSlot<E>;
|
|
245
|
+
readonly frequency: RichSlot<E>;
|
|
246
|
+
readonly rule: Schema.Trimmed;
|
|
247
|
+
readonly rules: Schema.$Record<Schema.Literals<readonly ["replace", "keep"]>, Schema.Trimmed>;
|
|
248
|
+
readonly second: RichSlot<E>;
|
|
249
|
+
readonly trials: RichSlot<E>;
|
|
250
|
+
readonly viewLabel: Schema.Trimmed;
|
|
251
|
+
}>;
|
|
252
|
+
readonly marbles: Schema.NonEmptyArray<Schema.Struct<{
|
|
253
|
+
readonly color: Schema.Literals<readonly ["red", "blue", "green", "yellow", "white"]>;
|
|
254
|
+
readonly count: Schema.Int;
|
|
255
|
+
}>>;
|
|
256
|
+
readonly rule: Schema.optionalKey<Schema.Literals<readonly ["replace", "keep"]>>;
|
|
257
|
+
}>, "figure">;
|
|
258
|
+
};
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { Array as Arr, Schema } from "effect";
|
|
2
|
+
import { byIds, cardFields, TextSchema } from "#contracts/visual/card";
|
|
3
|
+
import { answerAt, figure } from "#contracts/visual/entry";
|
|
4
|
+
/** The marble glazes the jar can hold. */
|
|
5
|
+
const MARBLE_COLORS = ["red", "blue", "green", "yellow", "white"];
|
|
6
|
+
/** How a marble drawn first is handled before the second draw. */
|
|
7
|
+
const DRAW_RULES = ["replace", "keep"];
|
|
8
|
+
/** The most marbles the jar holds below its shoulder. */
|
|
9
|
+
const JAR_CAPACITY = 24;
|
|
10
|
+
/** One colour of marble in the jar and how many of it. */
|
|
11
|
+
const MarbleGroupSchema = Schema.Struct({
|
|
12
|
+
color: Schema.Literals(MARBLE_COLORS),
|
|
13
|
+
count: Schema.Int.check(Schema.isGreaterThan(0)),
|
|
14
|
+
});
|
|
15
|
+
/** Whether each colour appears once and the jar holds them all. */
|
|
16
|
+
function fitsJar(groups) {
|
|
17
|
+
const colors = Arr.map(groups, (group) => group.color);
|
|
18
|
+
const total = Arr.reduce(groups, 0, (sum, group) => sum + group.count);
|
|
19
|
+
return Arr.dedupe(colors).length === colors.length && total <= JAR_CAPACITY;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Props of `MarbleDrawLab`: a jar of mixed marbles from which two are drawn
|
|
23
|
+
* one after the other, a thousand times over, with or without putting the
|
|
24
|
+
* first back. A tally board keeps the colours of the last trials. With
|
|
25
|
+
* `event`, the footer reads the probability of each draw, their product, and
|
|
26
|
+
* the share of trials that matched, so it is answer state.
|
|
27
|
+
*/
|
|
28
|
+
function marbleDrawLab(rich) {
|
|
29
|
+
return figure(Schema.Struct({
|
|
30
|
+
...cardFields(rich),
|
|
31
|
+
event: Schema.optionalKey(Schema.Struct({
|
|
32
|
+
first: Schema.Literals(MARBLE_COLORS),
|
|
33
|
+
second: Schema.Literals(MARBLE_COLORS),
|
|
34
|
+
})),
|
|
35
|
+
labels: Schema.Struct({
|
|
36
|
+
both: rich,
|
|
37
|
+
first: rich,
|
|
38
|
+
frequency: rich,
|
|
39
|
+
rule: TextSchema,
|
|
40
|
+
rules: byIds(DRAW_RULES, TextSchema),
|
|
41
|
+
second: rich,
|
|
42
|
+
trials: rich,
|
|
43
|
+
viewLabel: TextSchema,
|
|
44
|
+
}),
|
|
45
|
+
marbles: Schema.NonEmptyArray(MarbleGroupSchema).check(Schema.makeFilter(fitsJar, {
|
|
46
|
+
message: `Expected each colour once and ${JAR_CAPACITY} marbles at most.`,
|
|
47
|
+
})),
|
|
48
|
+
rule: Schema.optionalKey(Schema.Literals(DRAW_RULES)),
|
|
49
|
+
}), answerAt(["event"]));
|
|
50
|
+
}
|
|
51
|
+
/** How many dice the tray rolls at once. */
|
|
52
|
+
const DICE_COUNTS = [1, 2];
|
|
53
|
+
/** The dice a dice lab rolls and the outcome it counts. */
|
|
54
|
+
const DiceTargetSchema = Schema.Struct({
|
|
55
|
+
dice: Schema.Literals(DICE_COUNTS),
|
|
56
|
+
target: Schema.optionalKey(Schema.Int),
|
|
57
|
+
});
|
|
58
|
+
/** Whether the target can show: a face 1 to 6 of one die, or a sum 2 to 12 of two. */
|
|
59
|
+
function canShow({ dice, target }) {
|
|
60
|
+
return target === undefined || (target >= dice && target <= 6 * dice);
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Props of `DiceRollLab`: one or two dice rolled three hundred times in a
|
|
64
|
+
* felt tray, each roll adding a chip to its outcome's stack behind it. With
|
|
65
|
+
* `target`, that outcome's stack is highlighted and the footer reads how
|
|
66
|
+
* many rolls showed it, their share, and its probability, so it is answer
|
|
67
|
+
* state.
|
|
68
|
+
*/
|
|
69
|
+
function diceRollLab(rich) {
|
|
70
|
+
return figure(Schema.Struct({
|
|
71
|
+
...cardFields(rich),
|
|
72
|
+
...DiceTargetSchema.fields,
|
|
73
|
+
labels: Schema.Struct({
|
|
74
|
+
frequency: rich,
|
|
75
|
+
hits: rich,
|
|
76
|
+
probability: rich,
|
|
77
|
+
trials: rich,
|
|
78
|
+
viewLabel: TextSchema,
|
|
79
|
+
}),
|
|
80
|
+
}).check(Schema.makeFilter(canShow, {
|
|
81
|
+
message: "Expected a target the dice can show: 1 to 6 for one die, 2 to 12 for two.",
|
|
82
|
+
})), answerAt(["target"]));
|
|
83
|
+
}
|
|
84
|
+
/** The chances a Galton board's pins send a ball right: leaning left, upright, leaning right. */
|
|
85
|
+
const GALTON_BIASES = [0.3, 0.5, 0.7];
|
|
86
|
+
/**
|
|
87
|
+
* Props of `GaltonBoardLab`: a walnut Galton board through whose `rows` rows
|
|
88
|
+
* of pins three hundred balls drop, each pin sending a ball right with
|
|
89
|
+
* `probability`. With `showExpected`, marks on the glass show the counts the
|
|
90
|
+
* binomial formula expects, and the footer reads the mean, the standard
|
|
91
|
+
* deviation and the chance of the most likely bin, so it is answer state.
|
|
92
|
+
*/
|
|
93
|
+
function galtonBoardLab(rich) {
|
|
94
|
+
return figure(Schema.Struct({
|
|
95
|
+
...cardFields(rich),
|
|
96
|
+
labels: Schema.Struct({
|
|
97
|
+
balls: rich,
|
|
98
|
+
expected: rich,
|
|
99
|
+
mean: rich,
|
|
100
|
+
rows: TextSchema,
|
|
101
|
+
spread: rich,
|
|
102
|
+
tilt: TextSchema,
|
|
103
|
+
viewLabel: TextSchema,
|
|
104
|
+
}),
|
|
105
|
+
probability: Schema.Literals(GALTON_BIASES),
|
|
106
|
+
rows: Schema.Int.check(Schema.isBetween({ maximum: 12, minimum: 4 })),
|
|
107
|
+
showExpected: Schema.optionalKey(Schema.Boolean),
|
|
108
|
+
}), answerAt(["showExpected"]));
|
|
109
|
+
}
|
|
110
|
+
/** The probability labs, where a random experiment runs many times. */
|
|
111
|
+
export function chanceVisuals(rich) {
|
|
112
|
+
return {
|
|
113
|
+
DiceRollLab: diceRollLab(rich),
|
|
114
|
+
GaltonBoardLab: galtonBoardLab(rich),
|
|
115
|
+
MarbleDrawLab: marbleDrawLab(rich),
|
|
116
|
+
};
|
|
117
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
|
-
import {
|
|
2
|
+
import type { RichSlot } from "#contracts/visual/card";
|
|
3
3
|
/**
|
|
4
4
|
* Props of `Chart`: categories along one axis and one or more series of
|
|
5
5
|
* values drawn as bars or lines over them, the data of a bar chart, a line
|
|
@@ -9,6 +9,73 @@ import { type RichSlot } from "#contracts/visual/card";
|
|
|
9
9
|
*/
|
|
10
10
|
export declare function chartProps<E>(rich: RichSlot<E>): import("#contracts/visual/entry").VisualEntry<Schema.Struct<{
|
|
11
11
|
readonly description: RichSlot<E>;
|
|
12
|
+
readonly footer: Schema.optionalKey<Schema.Codec<readonly [{
|
|
13
|
+
readonly attrs: {
|
|
14
|
+
readonly latex: string;
|
|
15
|
+
};
|
|
16
|
+
readonly type: "mathInline";
|
|
17
|
+
} | {
|
|
18
|
+
readonly marks?: readonly [{
|
|
19
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
20
|
+
} | {
|
|
21
|
+
readonly attrs: {
|
|
22
|
+
readonly href: string;
|
|
23
|
+
};
|
|
24
|
+
readonly type: "link";
|
|
25
|
+
} | {
|
|
26
|
+
readonly attrs: {
|
|
27
|
+
readonly variant: "success" | "warning" | null;
|
|
28
|
+
};
|
|
29
|
+
readonly type: "highlight";
|
|
30
|
+
}, ...({
|
|
31
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
32
|
+
} | {
|
|
33
|
+
readonly attrs: {
|
|
34
|
+
readonly href: string;
|
|
35
|
+
};
|
|
36
|
+
readonly type: "link";
|
|
37
|
+
} | {
|
|
38
|
+
readonly attrs: {
|
|
39
|
+
readonly variant: "success" | "warning" | null;
|
|
40
|
+
};
|
|
41
|
+
readonly type: "highlight";
|
|
42
|
+
})[]];
|
|
43
|
+
readonly text: string;
|
|
44
|
+
readonly type: "text";
|
|
45
|
+
}, ...({
|
|
46
|
+
readonly attrs: {
|
|
47
|
+
readonly latex: string;
|
|
48
|
+
};
|
|
49
|
+
readonly type: "mathInline";
|
|
50
|
+
} | {
|
|
51
|
+
readonly marks?: readonly [{
|
|
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: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
65
|
+
} | {
|
|
66
|
+
readonly attrs: {
|
|
67
|
+
readonly href: string;
|
|
68
|
+
};
|
|
69
|
+
readonly type: "link";
|
|
70
|
+
} | {
|
|
71
|
+
readonly attrs: {
|
|
72
|
+
readonly variant: "success" | "warning" | null;
|
|
73
|
+
};
|
|
74
|
+
readonly type: "highlight";
|
|
75
|
+
})[]];
|
|
76
|
+
readonly text: string;
|
|
77
|
+
readonly type: "text";
|
|
78
|
+
})[]], E, never, never>>;
|
|
12
79
|
readonly title: RichSlot<E>;
|
|
13
80
|
/**
|
|
14
81
|
* How the bars of a chart that has bars stand: `apart` leaves a gap between
|