@nakafa/aksara-contracts 6.4.0 → 7.0.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/catalog.d.ts +30 -6
- package/dist/assessment/catalog.js +33 -10
- package/dist/assessment/choice.d.ts +10 -0
- package/dist/assessment/closure.d.ts +2 -1
- package/dist/assessment/closure.js +43 -62
- package/dist/assessment/document.d.ts +18 -0
- package/dist/assessment/document.js +10 -0
- package/dist/assessment/figure.d.ts +47605 -1555
- package/dist/assessment/figure.js +14 -217
- package/dist/assessment/hash.d.ts +274 -4
- package/dist/assessment/inline.d.ts +25 -0
- package/dist/assessment/inline.js +22 -3
- package/dist/assessment/interaction.d.ts +10 -0
- package/dist/assessment/item.d.ts +864 -0
- package/dist/assessment/item.js +10 -2
- package/dist/assessment/locales.d.ts +10 -0
- package/dist/assessment/locales.js +58 -0
- package/dist/assessment/paper.d.ts +1349 -12
- package/dist/assessment/paper.js +93 -9
- package/dist/assessment/part.d.ts +5 -0
- package/dist/assessment/profile.d.ts +4 -4
- package/dist/assessment/rows.d.ts +1409 -0
- package/dist/assessment/rows.js +44 -0
- package/dist/assessment/scalar.d.ts +1 -1
- package/dist/assessment/scoring.d.ts +1 -1
- package/dist/assessment/snapshot.d.ts +376 -20
- package/dist/assessment/structure.d.ts +6 -0
- package/dist/assessment/structure.js +22 -2
- package/dist/locale.d.ts +9 -9
- package/dist/locale.js +4 -3
- package/dist/program/snapshot/hash.d.ts +2 -2
- package/dist/program/snapshot/spec.d.ts +2 -2
- package/dist/projection/material.d.ts +10 -0
- package/dist/projection/material.js +1 -1
- package/dist/quran/attribution.d.ts +2 -2
- package/dist/quran/identity.d.ts +31 -10
- package/dist/quran/identity.js +15 -3
- package/dist/quran/provenance.d.ts +16 -16
- package/dist/quran/provenance.js +4 -1
- package/dist/quran/snapshot/hash.d.ts +2 -2
- package/dist/quran/snapshot/row/hash.d.ts +48 -15
- package/dist/quran/snapshot/row.d.ts +18 -8
- package/dist/quran/snapshot/spec.d.ts +2 -2
- package/dist/quran/source.d.ts +17 -7
- package/dist/quran/source.js +13 -1
- package/dist/quran/spec.d.ts +4 -4
- package/dist/quran/spec.js +2 -1
- package/dist/release/current/evidence.d.ts +9 -9
- package/dist/release/current/state.d.ts +11 -11
- package/dist/release/hash.d.ts +2 -2
- package/dist/release/identity.d.ts +1 -1
- package/dist/release/lifecycle.d.ts +7 -7
- package/dist/release/policy.d.ts +1 -1
- package/dist/release/snapshot/data.d.ts +37 -11
- package/dist/release/snapshot/evidence/assessment.d.ts +1 -1
- package/dist/release/snapshot/evidence/program.d.ts +1 -1
- package/dist/release/snapshot/evidence/quran.d.ts +1 -1
- package/dist/release/snapshot/evidence.d.ts +3 -3
- package/dist/release/snapshot/verify.d.ts +180 -12
- package/dist/release/spec.d.ts +13 -13
- package/dist/release/verify.d.ts +2 -2
- package/dist/runtime/spec.d.ts +6 -6
- package/dist/runtime/verify.d.ts +4 -4
- package/dist/transport/group.d.ts +111 -33
- package/dist/transport/request.d.ts +1174 -114
- package/dist/transport/response.d.ts +64 -64
- package/dist/transport/snapshot.d.ts +74 -22
- package/dist/visual/base/layout.d.ts +27 -0
- package/dist/visual/base/layout.js +35 -0
- package/dist/visual/base/math.d.ts +523 -0
- package/dist/visual/base/math.js +72 -0
- package/dist/visual/base/media.d.ts +13 -0
- package/dist/visual/base/media.js +25 -0
- package/dist/visual/biology.d.ts +203 -0
- package/dist/visual/biology.js +108 -0
- package/dist/visual/card.d.ts +32 -0
- package/dist/visual/card.js +30 -0
- package/dist/visual/catalog.d.ts +28633 -0
- package/dist/visual/catalog.js +73 -0
- package/dist/visual/chemistry/atom.d.ts +79 -0
- package/dist/visual/chemistry/atom.js +109 -0
- package/dist/visual/chemistry/electron.d.ts +41 -0
- package/dist/visual/chemistry/electron.js +69 -0
- package/dist/visual/chemistry/laws.d.ts +86 -0
- package/dist/visual/chemistry/laws.js +117 -0
- package/dist/visual/chemistry/particles.d.ts +114 -0
- package/dist/visual/chemistry/particles.js +149 -0
- package/dist/visual/chemistry/periodic.d.ts +52 -0
- package/dist/visual/chemistry/periodic.js +85 -0
- package/dist/visual/chemistry/reaction.d.ts +60 -0
- package/dist/visual/chemistry/reaction.js +76 -0
- package/dist/visual/entry.d.ts +42 -0
- package/dist/visual/entry.js +48 -0
- package/dist/visual/mathematics/chart.d.ts +30 -0
- package/dist/{assessment → visual/mathematics}/chart.js +26 -18
- package/dist/visual/mathematics/charts.d.ts +118 -0
- package/dist/visual/mathematics/charts.js +100 -0
- package/dist/visual/mathematics/function.d.ts +82 -0
- package/dist/visual/mathematics/function.js +102 -0
- package/dist/visual/mathematics/geometry.d.ts +222 -0
- package/dist/visual/mathematics/geometry.js +81 -0
- package/dist/visual/mathematics/line.d.ts +179 -0
- package/dist/visual/mathematics/line.js +156 -0
- package/dist/visual/mathematics/number.d.ts +21 -0
- package/dist/visual/mathematics/number.js +53 -0
- package/dist/visual/physics/measurement.d.ts +66 -0
- package/dist/visual/physics/measurement.js +85 -0
- package/dist/visual/physics/motion.d.ts +85 -0
- package/dist/visual/physics/motion.js +110 -0
- package/dist/visual/physics/parabolic.d.ts +42 -0
- package/dist/visual/physics/parabolic.js +56 -0
- package/dist/visual/physics/velocity.d.ts +112 -0
- package/dist/visual/physics/velocity.js +144 -0
- package/dist/visual/politics.d.ts +92 -0
- package/dist/visual/politics.js +76 -0
- package/package.json +13 -5
- package/dist/assessment/chart.d.ts +0 -62
|
@@ -0,0 +1,523 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
import { type RichSlot } from "#contracts/visual/card";
|
|
3
|
+
/**
|
|
4
|
+
* The mathematical components. A scene marks its answer with the `answer`
|
|
5
|
+
* appearance and computes values in its readouts, so both are answer state.
|
|
6
|
+
* A formula and a container of formulas are markup.
|
|
7
|
+
*/
|
|
8
|
+
export declare function mathVisuals<E>(rich: RichSlot<E>): {
|
|
9
|
+
BlockMath: import("#contracts/visual/entry").VisualEntry<Schema.Struct<{
|
|
10
|
+
readonly math: Schema.String;
|
|
11
|
+
}>>;
|
|
12
|
+
InlineMath: import("#contracts/visual/entry").VisualEntry<Schema.Struct<{
|
|
13
|
+
readonly math: Schema.String;
|
|
14
|
+
}>>;
|
|
15
|
+
MathContainer: import("#contracts/visual/entry").VisualEntry<Schema.$Record<Schema.String, Schema.Never>>;
|
|
16
|
+
MathVisual: import("#contracts/visual/entry").VisualEntry<Schema.Struct<{
|
|
17
|
+
readonly description: RichSlot<E>;
|
|
18
|
+
readonly title: RichSlot<E>;
|
|
19
|
+
readonly labels: Schema.optionalKey<Schema.$Record<Schema.String, RichSlot<E>>>;
|
|
20
|
+
readonly scene: Schema.Union<readonly [Schema.Struct<{
|
|
21
|
+
readonly frame: Schema.Struct<{
|
|
22
|
+
readonly kind: Schema.Literal<"cartesian">;
|
|
23
|
+
readonly x: Schema.Struct<{
|
|
24
|
+
readonly max: Schema.Finite;
|
|
25
|
+
readonly min: Schema.Finite;
|
|
26
|
+
}>;
|
|
27
|
+
readonly y: Schema.Struct<{
|
|
28
|
+
readonly max: Schema.Finite;
|
|
29
|
+
readonly min: Schema.Finite;
|
|
30
|
+
}>;
|
|
31
|
+
}>;
|
|
32
|
+
readonly labels: Schema.optionalKey<Schema.$Array<Schema.Struct<{
|
|
33
|
+
readonly at: Schema.Union<readonly [Schema.Struct<{
|
|
34
|
+
readonly x: Schema.Finite;
|
|
35
|
+
readonly y: Schema.Finite;
|
|
36
|
+
}>, Schema.Struct<{
|
|
37
|
+
readonly x: Schema.String;
|
|
38
|
+
readonly y: Schema.String;
|
|
39
|
+
}>]>;
|
|
40
|
+
readonly key: Schema.String;
|
|
41
|
+
readonly objectId: Schema.String;
|
|
42
|
+
readonly placement: Schema.optionalKey<Schema.Literals<readonly ["above", "above-left", "above-right", "below", "below-left", "below-right", "center", "left", "right"]>>;
|
|
43
|
+
}>>>;
|
|
44
|
+
readonly objects: Schema.NonEmptyArray<Schema.Union<readonly [Schema.Struct<{
|
|
45
|
+
readonly appearance: Schema.Literals<readonly ["answer", "construction", "highlight", "primary", "reference", "secondary", "warning"]>;
|
|
46
|
+
readonly id: Schema.String;
|
|
47
|
+
readonly domain: Schema.optionalKey<Schema.Struct<{
|
|
48
|
+
readonly max: Schema.Finite;
|
|
49
|
+
readonly min: Schema.Finite;
|
|
50
|
+
}>>;
|
|
51
|
+
readonly formula: Schema.String;
|
|
52
|
+
readonly inputAxis: Schema.optionalKey<Schema.Literals<readonly ["x", "y"]>>;
|
|
53
|
+
readonly kind: Schema.Literal<"function">;
|
|
54
|
+
}>, Schema.Struct<{
|
|
55
|
+
readonly appearance: Schema.Literals<readonly ["answer", "construction", "highlight", "primary", "reference", "secondary", "warning"]>;
|
|
56
|
+
readonly id: Schema.String;
|
|
57
|
+
readonly equation: Schema.String;
|
|
58
|
+
readonly kind: Schema.Literal<"implicit">;
|
|
59
|
+
}>, Schema.Struct<{
|
|
60
|
+
readonly appearance: Schema.Literals<readonly ["answer", "construction", "highlight", "primary", "reference", "secondary", "warning"]>;
|
|
61
|
+
readonly id: Schema.String;
|
|
62
|
+
readonly kind: Schema.Literal<"loop">;
|
|
63
|
+
readonly points: Schema.$Array<Schema.Struct<{
|
|
64
|
+
readonly x: Schema.String;
|
|
65
|
+
readonly y: Schema.String;
|
|
66
|
+
}>>;
|
|
67
|
+
}>, Schema.Struct<{
|
|
68
|
+
readonly appearance: Schema.Literals<readonly ["answer", "construction", "highlight", "primary", "reference", "secondary", "warning"]>;
|
|
69
|
+
readonly id: Schema.String;
|
|
70
|
+
readonly kind: Schema.Literal<"marker">;
|
|
71
|
+
readonly x: Schema.String;
|
|
72
|
+
readonly y: Schema.String;
|
|
73
|
+
}>, Schema.Struct<{
|
|
74
|
+
readonly appearance: Schema.Literals<readonly ["answer", "construction", "highlight", "primary", "reference", "secondary", "warning"]>;
|
|
75
|
+
readonly id: Schema.String;
|
|
76
|
+
readonly kind: Schema.Literal<"parametric">;
|
|
77
|
+
readonly parameter: Schema.Struct<{
|
|
78
|
+
readonly max: Schema.Finite;
|
|
79
|
+
readonly min: Schema.Finite;
|
|
80
|
+
}>;
|
|
81
|
+
readonly x: Schema.String;
|
|
82
|
+
readonly y: Schema.String;
|
|
83
|
+
}>, Schema.Struct<{
|
|
84
|
+
readonly appearance: Schema.Literals<readonly ["answer", "construction", "highlight", "primary", "reference", "secondary", "warning"]>;
|
|
85
|
+
readonly id: Schema.String;
|
|
86
|
+
readonly kind: Schema.Literal<"path">;
|
|
87
|
+
readonly points: Schema.$Array<Schema.Struct<{
|
|
88
|
+
readonly x: Schema.String;
|
|
89
|
+
readonly y: Schema.String;
|
|
90
|
+
}>>;
|
|
91
|
+
}>, Schema.Struct<{
|
|
92
|
+
readonly appearance: Schema.Literals<readonly ["answer", "construction", "highlight", "primary", "reference", "secondary", "warning"]>;
|
|
93
|
+
readonly id: Schema.String;
|
|
94
|
+
readonly angle: Schema.Struct<{
|
|
95
|
+
readonly max: Schema.Finite;
|
|
96
|
+
readonly min: Schema.Finite;
|
|
97
|
+
}>;
|
|
98
|
+
readonly kind: Schema.Literal<"polar">;
|
|
99
|
+
readonly radius: Schema.String;
|
|
100
|
+
}>, Schema.Struct<{
|
|
101
|
+
readonly appearance: Schema.Literals<readonly ["answer", "construction", "highlight", "primary", "reference", "secondary", "warning"]>;
|
|
102
|
+
readonly id: Schema.String;
|
|
103
|
+
readonly inequalities: Schema.NonEmptyArray<Schema.String>;
|
|
104
|
+
readonly kind: Schema.Literal<"region">;
|
|
105
|
+
}>, Schema.Struct<{
|
|
106
|
+
readonly appearance: Schema.Literals<readonly ["answer", "construction", "highlight", "primary", "reference", "secondary", "warning"]>;
|
|
107
|
+
readonly id: Schema.String;
|
|
108
|
+
readonly center: Schema.Struct<{
|
|
109
|
+
readonly x: Schema.Finite;
|
|
110
|
+
readonly y: Schema.Finite;
|
|
111
|
+
}>;
|
|
112
|
+
readonly kind: Schema.Literal<"arc">;
|
|
113
|
+
readonly radius: Schema.Finite;
|
|
114
|
+
readonly startDegrees: Schema.Finite;
|
|
115
|
+
readonly sweepDegrees: Schema.Finite;
|
|
116
|
+
}>, Schema.Struct<{
|
|
117
|
+
readonly appearance: Schema.Literals<readonly ["answer", "construction", "highlight", "primary", "reference", "secondary", "warning"]>;
|
|
118
|
+
readonly id: Schema.String;
|
|
119
|
+
readonly center: Schema.Struct<{
|
|
120
|
+
readonly x: Schema.Finite;
|
|
121
|
+
readonly y: Schema.Finite;
|
|
122
|
+
}>;
|
|
123
|
+
readonly kind: Schema.Literal<"circle">;
|
|
124
|
+
readonly radius: Schema.Finite;
|
|
125
|
+
}>, Schema.Struct<{
|
|
126
|
+
readonly appearance: Schema.Literals<readonly ["answer", "construction", "highlight", "primary", "reference", "secondary", "warning"]>;
|
|
127
|
+
readonly id: Schema.String;
|
|
128
|
+
readonly kind: Schema.Literal<"line">;
|
|
129
|
+
readonly through: Schema.Tuple<readonly [Schema.Struct<{
|
|
130
|
+
readonly x: Schema.Finite;
|
|
131
|
+
readonly y: Schema.Finite;
|
|
132
|
+
}>, Schema.Struct<{
|
|
133
|
+
readonly x: Schema.Finite;
|
|
134
|
+
readonly y: Schema.Finite;
|
|
135
|
+
}>]>;
|
|
136
|
+
}>, Schema.Struct<{
|
|
137
|
+
readonly appearance: Schema.Literals<readonly ["answer", "construction", "highlight", "primary", "reference", "secondary", "warning"]>;
|
|
138
|
+
readonly id: Schema.String;
|
|
139
|
+
readonly at: Schema.Struct<{
|
|
140
|
+
readonly x: Schema.Finite;
|
|
141
|
+
readonly y: Schema.Finite;
|
|
142
|
+
}>;
|
|
143
|
+
readonly kind: Schema.Literal<"point">;
|
|
144
|
+
}>, Schema.Struct<{
|
|
145
|
+
readonly appearance: Schema.Literals<readonly ["answer", "construction", "highlight", "primary", "reference", "secondary", "warning"]>;
|
|
146
|
+
readonly id: Schema.String;
|
|
147
|
+
readonly kind: Schema.Literal<"polygon">;
|
|
148
|
+
readonly vertices: Schema.TupleWithRest<Schema.Tuple<readonly [Schema.Struct<{
|
|
149
|
+
readonly x: Schema.Finite;
|
|
150
|
+
readonly y: Schema.Finite;
|
|
151
|
+
}>, Schema.Struct<{
|
|
152
|
+
readonly x: Schema.Finite;
|
|
153
|
+
readonly y: Schema.Finite;
|
|
154
|
+
}>, Schema.Struct<{
|
|
155
|
+
readonly x: Schema.Finite;
|
|
156
|
+
readonly y: Schema.Finite;
|
|
157
|
+
}>]>, readonly [Schema.Struct<{
|
|
158
|
+
readonly x: Schema.Finite;
|
|
159
|
+
readonly y: Schema.Finite;
|
|
160
|
+
}>]>;
|
|
161
|
+
}>, Schema.Struct<{
|
|
162
|
+
readonly appearance: Schema.Literals<readonly ["answer", "construction", "highlight", "primary", "reference", "secondary", "warning"]>;
|
|
163
|
+
readonly id: Schema.String;
|
|
164
|
+
readonly kind: Schema.Literal<"polyline">;
|
|
165
|
+
readonly vertices: Schema.TupleWithRest<Schema.Tuple<readonly [Schema.Struct<{
|
|
166
|
+
readonly x: Schema.Finite;
|
|
167
|
+
readonly y: Schema.Finite;
|
|
168
|
+
}>, Schema.Struct<{
|
|
169
|
+
readonly x: Schema.Finite;
|
|
170
|
+
readonly y: Schema.Finite;
|
|
171
|
+
}>]>, readonly [Schema.Struct<{
|
|
172
|
+
readonly x: Schema.Finite;
|
|
173
|
+
readonly y: Schema.Finite;
|
|
174
|
+
}>]>;
|
|
175
|
+
}>, Schema.Struct<{
|
|
176
|
+
readonly appearance: Schema.Literals<readonly ["answer", "construction", "highlight", "primary", "reference", "secondary", "warning"]>;
|
|
177
|
+
readonly id: Schema.String;
|
|
178
|
+
readonly coefficients: Schema.Struct<{
|
|
179
|
+
readonly a: Schema.Finite;
|
|
180
|
+
readonly b: Schema.Finite;
|
|
181
|
+
readonly c: Schema.Finite;
|
|
182
|
+
}>;
|
|
183
|
+
readonly domain: Schema.Struct<{
|
|
184
|
+
readonly max: Schema.Finite;
|
|
185
|
+
readonly min: Schema.Finite;
|
|
186
|
+
}>;
|
|
187
|
+
readonly inputAxis: Schema.Literals<readonly ["x", "y"]>;
|
|
188
|
+
readonly kind: Schema.Literal<"quadratic">;
|
|
189
|
+
}>, Schema.Struct<{
|
|
190
|
+
readonly appearance: Schema.Literals<readonly ["answer", "construction", "highlight", "primary", "reference", "secondary", "warning"]>;
|
|
191
|
+
readonly id: Schema.String;
|
|
192
|
+
readonly from: Schema.Struct<{
|
|
193
|
+
readonly x: Schema.Finite;
|
|
194
|
+
readonly y: Schema.Finite;
|
|
195
|
+
}>;
|
|
196
|
+
readonly kind: Schema.Literal<"ray">;
|
|
197
|
+
readonly through: Schema.Struct<{
|
|
198
|
+
readonly x: Schema.Finite;
|
|
199
|
+
readonly y: Schema.Finite;
|
|
200
|
+
}>;
|
|
201
|
+
}>, Schema.Struct<{
|
|
202
|
+
readonly appearance: Schema.Literals<readonly ["answer", "construction", "highlight", "primary", "reference", "secondary", "warning"]>;
|
|
203
|
+
readonly id: Schema.String;
|
|
204
|
+
readonly from: Schema.Struct<{
|
|
205
|
+
readonly x: Schema.Finite;
|
|
206
|
+
readonly y: Schema.Finite;
|
|
207
|
+
}>;
|
|
208
|
+
readonly kind: Schema.Literal<"segment">;
|
|
209
|
+
readonly to: Schema.Struct<{
|
|
210
|
+
readonly x: Schema.Finite;
|
|
211
|
+
readonly y: Schema.Finite;
|
|
212
|
+
}>;
|
|
213
|
+
}>, Schema.Struct<{
|
|
214
|
+
readonly appearance: Schema.Literals<readonly ["answer", "construction", "highlight", "primary", "reference", "secondary", "warning"]>;
|
|
215
|
+
readonly id: Schema.String;
|
|
216
|
+
readonly from: Schema.Struct<{
|
|
217
|
+
readonly x: Schema.Finite;
|
|
218
|
+
readonly y: Schema.Finite;
|
|
219
|
+
}>;
|
|
220
|
+
readonly kind: Schema.Literal<"vector">;
|
|
221
|
+
readonly to: Schema.Struct<{
|
|
222
|
+
readonly x: Schema.Finite;
|
|
223
|
+
readonly y: Schema.Finite;
|
|
224
|
+
}>;
|
|
225
|
+
}>]>>;
|
|
226
|
+
readonly parameters: Schema.optionalKey<Schema.$Array<Schema.Struct<{
|
|
227
|
+
readonly label: Schema.optionalKey<Schema.String>;
|
|
228
|
+
readonly max: Schema.Finite;
|
|
229
|
+
readonly min: Schema.Finite;
|
|
230
|
+
readonly name: Schema.String;
|
|
231
|
+
readonly step: Schema.optionalKey<Schema.Finite>;
|
|
232
|
+
readonly value: Schema.Finite;
|
|
233
|
+
}>>>;
|
|
234
|
+
readonly readouts: Schema.optionalKey<Schema.$Array<Schema.Struct<{
|
|
235
|
+
readonly formula: Schema.String;
|
|
236
|
+
readonly key: Schema.String;
|
|
237
|
+
}>>>;
|
|
238
|
+
readonly space: Schema.Literal<"plane">;
|
|
239
|
+
readonly view: Schema.Struct<{
|
|
240
|
+
readonly kind: Schema.Literal<"fit">;
|
|
241
|
+
readonly padding: Schema.optionalKey<Schema.Finite>;
|
|
242
|
+
}>;
|
|
243
|
+
}>, Schema.Struct<{
|
|
244
|
+
readonly frame: Schema.Struct<{
|
|
245
|
+
readonly kind: Schema.Literal<"cartesian">;
|
|
246
|
+
readonly x: Schema.Struct<{
|
|
247
|
+
readonly max: Schema.Finite;
|
|
248
|
+
readonly min: Schema.Finite;
|
|
249
|
+
}>;
|
|
250
|
+
readonly y: Schema.Struct<{
|
|
251
|
+
readonly max: Schema.Finite;
|
|
252
|
+
readonly min: Schema.Finite;
|
|
253
|
+
}>;
|
|
254
|
+
readonly z: Schema.Struct<{
|
|
255
|
+
readonly max: Schema.Finite;
|
|
256
|
+
readonly min: Schema.Finite;
|
|
257
|
+
}>;
|
|
258
|
+
}>;
|
|
259
|
+
readonly labels: Schema.optionalKey<Schema.$Array<Schema.Struct<{
|
|
260
|
+
readonly at: Schema.Struct<{
|
|
261
|
+
readonly x: Schema.Finite;
|
|
262
|
+
readonly y: Schema.Finite;
|
|
263
|
+
readonly z: Schema.Finite;
|
|
264
|
+
}>;
|
|
265
|
+
readonly key: Schema.String;
|
|
266
|
+
readonly objectId: Schema.String;
|
|
267
|
+
readonly placement: Schema.optionalKey<Schema.Literals<readonly ["above", "above-left", "above-right", "below", "below-left", "below-right", "center", "left", "right"]>>;
|
|
268
|
+
}>>>;
|
|
269
|
+
readonly objects: Schema.NonEmptyArray<Schema.Union<readonly [Schema.Struct<{
|
|
270
|
+
readonly appearance: Schema.Literals<readonly ["answer", "construction", "highlight", "primary", "reference", "secondary", "warning"]>;
|
|
271
|
+
readonly id: Schema.String;
|
|
272
|
+
readonly domain: Schema.optionalKey<Schema.Struct<{
|
|
273
|
+
readonly x: Schema.Struct<{
|
|
274
|
+
readonly max: Schema.Finite;
|
|
275
|
+
readonly min: Schema.Finite;
|
|
276
|
+
}>;
|
|
277
|
+
readonly y: Schema.Struct<{
|
|
278
|
+
readonly max: Schema.Finite;
|
|
279
|
+
readonly min: Schema.Finite;
|
|
280
|
+
}>;
|
|
281
|
+
}>>;
|
|
282
|
+
readonly formula: Schema.String;
|
|
283
|
+
readonly kind: Schema.Literal<"function">;
|
|
284
|
+
}>, Schema.Struct<{
|
|
285
|
+
readonly appearance: Schema.Literals<readonly ["answer", "construction", "highlight", "primary", "reference", "secondary", "warning"]>;
|
|
286
|
+
readonly id: Schema.String;
|
|
287
|
+
readonly kind: Schema.Literal<"parametric">;
|
|
288
|
+
readonly parameter: Schema.Struct<{
|
|
289
|
+
readonly max: Schema.Finite;
|
|
290
|
+
readonly min: Schema.Finite;
|
|
291
|
+
}>;
|
|
292
|
+
readonly x: Schema.String;
|
|
293
|
+
readonly y: Schema.String;
|
|
294
|
+
readonly z: Schema.String;
|
|
295
|
+
}>, Schema.Struct<{
|
|
296
|
+
readonly appearance: Schema.Literals<readonly ["answer", "construction", "highlight", "primary", "reference", "secondary", "warning"]>;
|
|
297
|
+
readonly id: Schema.String;
|
|
298
|
+
readonly base: Schema.TupleWithRest<Schema.Tuple<readonly [Schema.Struct<{
|
|
299
|
+
readonly x: Schema.Finite;
|
|
300
|
+
readonly y: Schema.Finite;
|
|
301
|
+
readonly z: Schema.Finite;
|
|
302
|
+
}>, Schema.Struct<{
|
|
303
|
+
readonly x: Schema.Finite;
|
|
304
|
+
readonly y: Schema.Finite;
|
|
305
|
+
readonly z: Schema.Finite;
|
|
306
|
+
}>, Schema.Struct<{
|
|
307
|
+
readonly x: Schema.Finite;
|
|
308
|
+
readonly y: Schema.Finite;
|
|
309
|
+
readonly z: Schema.Finite;
|
|
310
|
+
}>]>, readonly [Schema.Struct<{
|
|
311
|
+
readonly x: Schema.Finite;
|
|
312
|
+
readonly y: Schema.Finite;
|
|
313
|
+
readonly z: Schema.Finite;
|
|
314
|
+
}>]>;
|
|
315
|
+
readonly kind: Schema.Literal<"prism">;
|
|
316
|
+
readonly offset: Schema.Struct<{
|
|
317
|
+
readonly x: Schema.Finite;
|
|
318
|
+
readonly y: Schema.Finite;
|
|
319
|
+
readonly z: Schema.Finite;
|
|
320
|
+
}>;
|
|
321
|
+
}>, Schema.Struct<{
|
|
322
|
+
readonly appearance: Schema.Literals<readonly ["answer", "construction", "highlight", "primary", "reference", "secondary", "warning"]>;
|
|
323
|
+
readonly id: Schema.String;
|
|
324
|
+
readonly apex: Schema.Struct<{
|
|
325
|
+
readonly x: Schema.Finite;
|
|
326
|
+
readonly y: Schema.Finite;
|
|
327
|
+
readonly z: Schema.Finite;
|
|
328
|
+
}>;
|
|
329
|
+
readonly base: Schema.TupleWithRest<Schema.Tuple<readonly [Schema.Struct<{
|
|
330
|
+
readonly x: Schema.Finite;
|
|
331
|
+
readonly y: Schema.Finite;
|
|
332
|
+
readonly z: Schema.Finite;
|
|
333
|
+
}>, Schema.Struct<{
|
|
334
|
+
readonly x: Schema.Finite;
|
|
335
|
+
readonly y: Schema.Finite;
|
|
336
|
+
readonly z: Schema.Finite;
|
|
337
|
+
}>, Schema.Struct<{
|
|
338
|
+
readonly x: Schema.Finite;
|
|
339
|
+
readonly y: Schema.Finite;
|
|
340
|
+
readonly z: Schema.Finite;
|
|
341
|
+
}>]>, readonly [Schema.Struct<{
|
|
342
|
+
readonly x: Schema.Finite;
|
|
343
|
+
readonly y: Schema.Finite;
|
|
344
|
+
readonly z: Schema.Finite;
|
|
345
|
+
}>]>;
|
|
346
|
+
readonly kind: Schema.Literal<"pyramid">;
|
|
347
|
+
}>, Schema.Struct<{
|
|
348
|
+
readonly appearance: Schema.Literals<readonly ["answer", "construction", "highlight", "primary", "reference", "secondary", "warning"]>;
|
|
349
|
+
readonly id: Schema.String;
|
|
350
|
+
readonly axis: Schema.Literals<readonly ["x", "y", "z"]>;
|
|
351
|
+
readonly domain: Schema.Struct<{
|
|
352
|
+
readonly max: Schema.Finite;
|
|
353
|
+
readonly min: Schema.Finite;
|
|
354
|
+
}>;
|
|
355
|
+
readonly formula: Schema.String;
|
|
356
|
+
readonly kind: Schema.Literal<"revolution">;
|
|
357
|
+
}>, Schema.Struct<{
|
|
358
|
+
readonly appearance: Schema.Literals<readonly ["answer", "construction", "highlight", "primary", "reference", "secondary", "warning"]>;
|
|
359
|
+
readonly id: Schema.String;
|
|
360
|
+
readonly kind: Schema.Literal<"surface">;
|
|
361
|
+
readonly u: Schema.Struct<{
|
|
362
|
+
readonly max: Schema.Finite;
|
|
363
|
+
readonly min: Schema.Finite;
|
|
364
|
+
}>;
|
|
365
|
+
readonly v: Schema.Struct<{
|
|
366
|
+
readonly max: Schema.Finite;
|
|
367
|
+
readonly min: Schema.Finite;
|
|
368
|
+
}>;
|
|
369
|
+
readonly x: Schema.String;
|
|
370
|
+
readonly y: Schema.String;
|
|
371
|
+
readonly z: Schema.String;
|
|
372
|
+
}>, Schema.Struct<{
|
|
373
|
+
readonly appearance: Schema.Literals<readonly ["answer", "construction", "highlight", "primary", "reference", "secondary", "warning"]>;
|
|
374
|
+
readonly id: Schema.String;
|
|
375
|
+
readonly center: Schema.Struct<{
|
|
376
|
+
readonly x: Schema.Finite;
|
|
377
|
+
readonly y: Schema.Finite;
|
|
378
|
+
readonly z: Schema.Finite;
|
|
379
|
+
}>;
|
|
380
|
+
readonly kind: Schema.Literal<"cuboid">;
|
|
381
|
+
readonly size: Schema.Struct<{
|
|
382
|
+
readonly height: Schema.Finite;
|
|
383
|
+
readonly length: Schema.Finite;
|
|
384
|
+
readonly width: Schema.Finite;
|
|
385
|
+
}>;
|
|
386
|
+
}>, Schema.Struct<{
|
|
387
|
+
readonly appearance: Schema.Literals<readonly ["answer", "construction", "highlight", "primary", "reference", "secondary", "warning"]>;
|
|
388
|
+
readonly id: Schema.String;
|
|
389
|
+
readonly kind: Schema.Literal<"line">;
|
|
390
|
+
readonly through: Schema.Tuple<readonly [Schema.Struct<{
|
|
391
|
+
readonly x: Schema.Finite;
|
|
392
|
+
readonly y: Schema.Finite;
|
|
393
|
+
readonly z: Schema.Finite;
|
|
394
|
+
}>, Schema.Struct<{
|
|
395
|
+
readonly x: Schema.Finite;
|
|
396
|
+
readonly y: Schema.Finite;
|
|
397
|
+
readonly z: Schema.Finite;
|
|
398
|
+
}>]>;
|
|
399
|
+
}>, Schema.Struct<{
|
|
400
|
+
readonly appearance: Schema.Literals<readonly ["answer", "construction", "highlight", "primary", "reference", "secondary", "warning"]>;
|
|
401
|
+
readonly id: Schema.String;
|
|
402
|
+
readonly at: Schema.Struct<{
|
|
403
|
+
readonly x: Schema.Finite;
|
|
404
|
+
readonly y: Schema.Finite;
|
|
405
|
+
readonly z: Schema.Finite;
|
|
406
|
+
}>;
|
|
407
|
+
readonly kind: Schema.Literal<"point">;
|
|
408
|
+
}>, Schema.Struct<{
|
|
409
|
+
readonly appearance: Schema.Literals<readonly ["answer", "construction", "highlight", "primary", "reference", "secondary", "warning"]>;
|
|
410
|
+
readonly id: Schema.String;
|
|
411
|
+
readonly kind: Schema.Literal<"polygon">;
|
|
412
|
+
readonly vertices: Schema.TupleWithRest<Schema.Tuple<readonly [Schema.Struct<{
|
|
413
|
+
readonly x: Schema.Finite;
|
|
414
|
+
readonly y: Schema.Finite;
|
|
415
|
+
readonly z: Schema.Finite;
|
|
416
|
+
}>, Schema.Struct<{
|
|
417
|
+
readonly x: Schema.Finite;
|
|
418
|
+
readonly y: Schema.Finite;
|
|
419
|
+
readonly z: Schema.Finite;
|
|
420
|
+
}>, Schema.Struct<{
|
|
421
|
+
readonly x: Schema.Finite;
|
|
422
|
+
readonly y: Schema.Finite;
|
|
423
|
+
readonly z: Schema.Finite;
|
|
424
|
+
}>]>, readonly [Schema.Struct<{
|
|
425
|
+
readonly x: Schema.Finite;
|
|
426
|
+
readonly y: Schema.Finite;
|
|
427
|
+
readonly z: Schema.Finite;
|
|
428
|
+
}>]>;
|
|
429
|
+
}>, Schema.Struct<{
|
|
430
|
+
readonly appearance: Schema.Literals<readonly ["answer", "construction", "highlight", "primary", "reference", "secondary", "warning"]>;
|
|
431
|
+
readonly id: Schema.String;
|
|
432
|
+
readonly kind: Schema.Literal<"polyline">;
|
|
433
|
+
readonly vertices: Schema.TupleWithRest<Schema.Tuple<readonly [Schema.Struct<{
|
|
434
|
+
readonly x: Schema.Finite;
|
|
435
|
+
readonly y: Schema.Finite;
|
|
436
|
+
readonly z: Schema.Finite;
|
|
437
|
+
}>, Schema.Struct<{
|
|
438
|
+
readonly x: Schema.Finite;
|
|
439
|
+
readonly y: Schema.Finite;
|
|
440
|
+
readonly z: Schema.Finite;
|
|
441
|
+
}>]>, readonly [Schema.Struct<{
|
|
442
|
+
readonly x: Schema.Finite;
|
|
443
|
+
readonly y: Schema.Finite;
|
|
444
|
+
readonly z: Schema.Finite;
|
|
445
|
+
}>]>;
|
|
446
|
+
}>, Schema.Struct<{
|
|
447
|
+
readonly appearance: Schema.Literals<readonly ["answer", "construction", "highlight", "primary", "reference", "secondary", "warning"]>;
|
|
448
|
+
readonly id: Schema.String;
|
|
449
|
+
readonly from: Schema.Struct<{
|
|
450
|
+
readonly x: Schema.Finite;
|
|
451
|
+
readonly y: Schema.Finite;
|
|
452
|
+
readonly z: Schema.Finite;
|
|
453
|
+
}>;
|
|
454
|
+
readonly kind: Schema.Literal<"ray">;
|
|
455
|
+
readonly through: Schema.Struct<{
|
|
456
|
+
readonly x: Schema.Finite;
|
|
457
|
+
readonly y: Schema.Finite;
|
|
458
|
+
readonly z: Schema.Finite;
|
|
459
|
+
}>;
|
|
460
|
+
}>, Schema.Struct<{
|
|
461
|
+
readonly appearance: Schema.Literals<readonly ["answer", "construction", "highlight", "primary", "reference", "secondary", "warning"]>;
|
|
462
|
+
readonly id: Schema.String;
|
|
463
|
+
readonly from: Schema.Struct<{
|
|
464
|
+
readonly x: Schema.Finite;
|
|
465
|
+
readonly y: Schema.Finite;
|
|
466
|
+
readonly z: Schema.Finite;
|
|
467
|
+
}>;
|
|
468
|
+
readonly kind: Schema.Literal<"segment">;
|
|
469
|
+
readonly to: Schema.Struct<{
|
|
470
|
+
readonly x: Schema.Finite;
|
|
471
|
+
readonly y: Schema.Finite;
|
|
472
|
+
readonly z: Schema.Finite;
|
|
473
|
+
}>;
|
|
474
|
+
}>, Schema.Struct<{
|
|
475
|
+
readonly appearance: Schema.Literals<readonly ["answer", "construction", "highlight", "primary", "reference", "secondary", "warning"]>;
|
|
476
|
+
readonly id: Schema.String;
|
|
477
|
+
readonly from: Schema.Struct<{
|
|
478
|
+
readonly x: Schema.Finite;
|
|
479
|
+
readonly y: Schema.Finite;
|
|
480
|
+
readonly z: Schema.Finite;
|
|
481
|
+
}>;
|
|
482
|
+
readonly kind: Schema.Literal<"vector">;
|
|
483
|
+
readonly to: Schema.Struct<{
|
|
484
|
+
readonly x: Schema.Finite;
|
|
485
|
+
readonly y: Schema.Finite;
|
|
486
|
+
readonly z: Schema.Finite;
|
|
487
|
+
}>;
|
|
488
|
+
}>]>>;
|
|
489
|
+
readonly parameters: Schema.optionalKey<Schema.$Array<Schema.Struct<{
|
|
490
|
+
readonly label: Schema.optionalKey<Schema.String>;
|
|
491
|
+
readonly max: Schema.Finite;
|
|
492
|
+
readonly min: Schema.Finite;
|
|
493
|
+
readonly name: Schema.String;
|
|
494
|
+
readonly step: Schema.optionalKey<Schema.Finite>;
|
|
495
|
+
readonly value: Schema.Finite;
|
|
496
|
+
}>>>;
|
|
497
|
+
readonly space: Schema.Literal<"space">;
|
|
498
|
+
readonly view: Schema.Union<readonly [Schema.Struct<{
|
|
499
|
+
readonly kind: Schema.Literal<"camera">;
|
|
500
|
+
readonly position: Schema.Struct<{
|
|
501
|
+
readonly x: Schema.Finite;
|
|
502
|
+
readonly y: Schema.Finite;
|
|
503
|
+
readonly z: Schema.Finite;
|
|
504
|
+
}>;
|
|
505
|
+
readonly target: Schema.Struct<{
|
|
506
|
+
readonly x: Schema.Finite;
|
|
507
|
+
readonly y: Schema.Finite;
|
|
508
|
+
readonly z: Schema.Finite;
|
|
509
|
+
}>;
|
|
510
|
+
}>, Schema.Struct<{
|
|
511
|
+
readonly kind: Schema.Literal<"fit">;
|
|
512
|
+
readonly padding: Schema.optionalKey<Schema.Finite>;
|
|
513
|
+
}>, Schema.Struct<{
|
|
514
|
+
readonly kind: Schema.Literal<"isometric">;
|
|
515
|
+
readonly target: Schema.optionalKey<Schema.Struct<{
|
|
516
|
+
readonly x: Schema.Finite;
|
|
517
|
+
readonly y: Schema.Finite;
|
|
518
|
+
readonly z: Schema.Finite;
|
|
519
|
+
}>>;
|
|
520
|
+
}>]>;
|
|
521
|
+
}>]>;
|
|
522
|
+
}>>;
|
|
523
|
+
};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { Array as Arr, Predicate, Record as Rec, Schema } from "effect";
|
|
2
|
+
import { MathAppearanceSchema, MathVisualKeySchema, } from "#contracts/math/base";
|
|
3
|
+
import { MathVisualSchema, mathVisualLabelKeys } from "#contracts/math/visual";
|
|
4
|
+
import { NoPropsSchema } from "#contracts/visual/base/layout";
|
|
5
|
+
import { cardFields } from "#contracts/visual/card";
|
|
6
|
+
import { figure, markup } from "#contracts/visual/entry";
|
|
7
|
+
/** A scene and the keys of the rich labels it anchors, as the check reads them. */
|
|
8
|
+
const LabeledSceneSchema = Schema.Struct({
|
|
9
|
+
labels: Schema.optionalKey(Schema.Record(Schema.String, Schema.Unknown)),
|
|
10
|
+
scene: MathVisualSchema,
|
|
11
|
+
});
|
|
12
|
+
/** The appearance of one scene object, which says whether it draws the answer. */
|
|
13
|
+
const AppearanceSchema = Schema.Struct({ appearance: MathAppearanceSchema });
|
|
14
|
+
/**
|
|
15
|
+
* Checks that the rich labels match the anchors of the scene, key for key. A
|
|
16
|
+
* scene without anchors may leave its labels out.
|
|
17
|
+
*/
|
|
18
|
+
function hasSceneLabels({ labels = {}, scene }) {
|
|
19
|
+
const anchors = mathVisualLabelKeys(scene);
|
|
20
|
+
const keys = Rec.keys(labels);
|
|
21
|
+
return (anchors.length === keys.length &&
|
|
22
|
+
Arr.every(anchors, (anchor) => Arr.contains(keys, anchor)));
|
|
23
|
+
}
|
|
24
|
+
/** Props of `MathVisual`: a plane or space scene and the rich labels it anchors. */
|
|
25
|
+
function mathVisual(rich) {
|
|
26
|
+
return Schema.Struct({
|
|
27
|
+
...cardFields(rich),
|
|
28
|
+
labels: Schema.optionalKey(Schema.Record(MathVisualKeySchema, rich)),
|
|
29
|
+
scene: MathVisualSchema,
|
|
30
|
+
}).check(Schema.makeFilter(hasSceneLabels, {
|
|
31
|
+
message: "Expected one rich label for each label anchor of the scene.",
|
|
32
|
+
}));
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Reads the answer state of a scene: every object drawn in the `answer`
|
|
36
|
+
* appearance, and the readouts, which compute values from the scene.
|
|
37
|
+
*/
|
|
38
|
+
const sceneAnswer = (props) => {
|
|
39
|
+
const scene = Predicate.hasProperty(props, "scene") ? props.scene : undefined;
|
|
40
|
+
if (!Schema.is(MathVisualSchema)(scene)) {
|
|
41
|
+
return [];
|
|
42
|
+
}
|
|
43
|
+
const objects = scene.objects;
|
|
44
|
+
const answers = Arr.flatMap(objects, (object, index) => object.appearance === "answer" ? [`scene.objects.${index}`] : []);
|
|
45
|
+
const readouts = scene.space === "plane" && scene.readouts !== undefined
|
|
46
|
+
? ["scene.readouts"]
|
|
47
|
+
: [];
|
|
48
|
+
return [...answers, ...readouts];
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Props of `BlockMath` and `InlineMath`: one formula in LaTeX. A lesson may
|
|
52
|
+
* write a long formula over several lines, so the source keeps its spacing;
|
|
53
|
+
* an assessment stores it trimmed.
|
|
54
|
+
*/
|
|
55
|
+
const FormulaSchema = Schema.Struct({
|
|
56
|
+
math: Schema.String.check(Schema.makeFilter((math) => math.trim().length > 0, {
|
|
57
|
+
message: "Expected a formula.",
|
|
58
|
+
})),
|
|
59
|
+
});
|
|
60
|
+
/**
|
|
61
|
+
* The mathematical components. A scene marks its answer with the `answer`
|
|
62
|
+
* appearance and computes values in its readouts, so both are answer state.
|
|
63
|
+
* A formula and a container of formulas are markup.
|
|
64
|
+
*/
|
|
65
|
+
export function mathVisuals(rich) {
|
|
66
|
+
return {
|
|
67
|
+
BlockMath: markup(FormulaSchema),
|
|
68
|
+
InlineMath: markup(FormulaSchema),
|
|
69
|
+
MathContainer: markup(NoPropsSchema),
|
|
70
|
+
MathVisual: figure(mathVisual(rich), sceneAnswer),
|
|
71
|
+
};
|
|
72
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
import { type RichSlot } from "#contracts/visual/card";
|
|
3
|
+
/** The media components: a diagram from its source and an embedded video. */
|
|
4
|
+
export declare function mediaVisuals<E>(rich: RichSlot<E>): {
|
|
5
|
+
Mermaid: import("#contracts/visual/entry").VisualEntry<Schema.Struct<{
|
|
6
|
+
readonly description: RichSlot<E>;
|
|
7
|
+
readonly title: RichSlot<E>;
|
|
8
|
+
readonly chart: Schema.String;
|
|
9
|
+
}>>;
|
|
10
|
+
Youtube: import("#contracts/visual/entry").VisualEntry<Schema.Struct<{
|
|
11
|
+
readonly videoId: Schema.String;
|
|
12
|
+
}>>;
|
|
13
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
import { cardFields } from "#contracts/visual/card";
|
|
3
|
+
import { figure } from "#contracts/visual/entry";
|
|
4
|
+
/** The identifier of one YouTube video: letters, digits, `-`, and `_`. */
|
|
5
|
+
const VideoIdSchema = Schema.String.check(Schema.isPattern(/^[\w-]+$/u));
|
|
6
|
+
/**
|
|
7
|
+
* Props of `Mermaid`: a diagram source with the title and description of its
|
|
8
|
+
* card. The renderer owns the Mermaid settings and names the drawing by its
|
|
9
|
+
* title.
|
|
10
|
+
*/
|
|
11
|
+
function mermaid(rich) {
|
|
12
|
+
return figure(Schema.Struct({
|
|
13
|
+
...cardFields(rich),
|
|
14
|
+
chart: Schema.String.check(Schema.isNonEmpty()),
|
|
15
|
+
}));
|
|
16
|
+
}
|
|
17
|
+
/** Props of `Youtube`: one embedded video. */
|
|
18
|
+
const YoutubeSchema = Schema.Struct({ videoId: VideoIdSchema });
|
|
19
|
+
/** The media components: a diagram from its source and an embedded video. */
|
|
20
|
+
export function mediaVisuals(rich) {
|
|
21
|
+
return {
|
|
22
|
+
Mermaid: mermaid(rich),
|
|
23
|
+
Youtube: figure(YoutubeSchema),
|
|
24
|
+
};
|
|
25
|
+
}
|