@nakafa/aksara-contracts 8.4.1 → 8.9.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/answer.d.ts +2 -0
- package/dist/assessment/answer.js +5 -3
- package/dist/assessment/closure.js +2 -1
- package/dist/assessment/fit.d.ts +16 -2
- package/dist/assessment/fit.js +23 -5
- package/dist/assessment/graphic.d.ts +27 -0
- package/dist/assessment/graphic.js +17 -1
- package/dist/assessment/hash.d.ts +71 -3
- package/dist/assessment/interaction.d.ts +18 -1
- package/dist/assessment/interaction.js +2 -1
- package/dist/assessment/item.d.ts +85 -0
- package/dist/assessment/item.js +1 -1
- package/dist/assessment/joint.d.ts +4 -3
- package/dist/assessment/joint.js +4 -3
- package/dist/assessment/key.d.ts +138 -0
- package/dist/assessment/key.js +6 -0
- package/dist/assessment/paper.d.ts +316 -0
- package/dist/assessment/profile.d.ts +3 -3
- package/dist/assessment/profile.js +4 -4
- package/dist/assessment/rows.d.ts +285 -3
- package/dist/assessment/scoring.d.ts +12 -6
- package/dist/assessment/scoring.js +25 -8
- package/dist/assessment/sketch.d.ts +125 -0
- package/dist/assessment/sketch.js +175 -0
- package/dist/assessment/snapshot.d.ts +746 -10
- package/dist/assessment/structure.js +4 -4
- package/dist/hash/sha256.d.ts +16 -0
- package/dist/hash/sha256.js +164 -0
- package/dist/hash/stream.d.ts +7 -5
- package/dist/hash/stream.js +13 -18
- package/dist/math/boundary.js +3 -22
- package/dist/math/edge.d.ts +11 -0
- package/dist/math/edge.js +74 -0
- package/dist/math/graph.d.ts +9 -0
- package/dist/math/graph.js +66 -0
- package/dist/math/plane.js +6 -0
- package/dist/math/shape.d.ts +392 -0
- package/dist/math/shape.js +59 -0
- package/dist/math/straight.d.ts +13 -0
- package/dist/math/straight.js +26 -0
- package/dist/release/snapshot/data.d.ts +88 -2
- package/dist/release/snapshot/verify.d.ts +285 -3
- package/dist/transport/group.d.ts +264 -6
- package/dist/transport/request.d.ts +1886 -22
- package/dist/transport/snapshot.d.ts +176 -4
- package/dist/visual/biology/blood.d.ts +91 -0
- package/dist/visual/biology/blood.js +55 -0
- package/dist/visual/biology/heart.d.ts +92 -0
- package/dist/visual/biology/heart.js +54 -0
- package/dist/visual/biology/mitochondrion.d.ts +91 -0
- package/dist/visual/biology/mitochondrion.js +45 -0
- package/dist/visual/biology/muscle.d.ts +103 -0
- package/dist/visual/biology/muscle.js +62 -0
- package/dist/visual/biology/neuron.d.ts +97 -0
- package/dist/visual/biology/neuron.js +48 -0
- package/dist/visual/biology/paddy.d.ts +100 -0
- package/dist/visual/biology/paddy.js +54 -0
- package/dist/visual/biology/synapse.d.ts +101 -0
- package/dist/visual/biology/synapse.js +46 -0
- package/dist/visual/biology/vessel.d.ts +104 -0
- package/dist/visual/biology/vessel.js +60 -0
- package/dist/visual/biology/yeast.d.ts +108 -0
- package/dist/visual/biology/yeast.js +61 -0
- package/dist/visual/catalog.d.ts +2177 -778
- package/dist/visual/catalog.js +28 -0
- package/dist/visual/mathematics/journey.d.ts +118 -0
- package/dist/visual/mathematics/journey.js +125 -0
- package/dist/visual/mathematics/logic.d.ts +90 -0
- package/dist/visual/mathematics/logic.js +49 -0
- package/dist/visual/mathematics/network.d.ts +101 -0
- package/dist/visual/mathematics/network.js +97 -0
- package/dist/visual/mathematics/numeral.d.ts +81 -0
- package/dist/visual/mathematics/numeral.js +48 -0
- package/dist/visual/mathematics/sets.d.ts +92 -0
- package/dist/visual/mathematics/sets.js +95 -0
- package/dist/visual/physics/thermodynamics.d.ts +117 -0
- package/dist/visual/physics/thermodynamics.js +95 -0
- package/package.json +2 -2
|
@@ -0,0 +1,392 @@
|
|
|
1
|
+
import type { Schema } from "effect";
|
|
2
|
+
import type { PlaneMathFrame, PlaneMathObject, PlaneMathView } from "#contracts/math/plane";
|
|
3
|
+
/**
|
|
4
|
+
* The plane objects whose meaning is their shape: a circle is round, an arc's
|
|
5
|
+
* angle is true, a polygon's sides keep their proportion, and a vector or a
|
|
6
|
+
* ray points the way it is drawn. A parametric curve counts, because circles
|
|
7
|
+
* and angle marks are drawn with it. A scene that draws one keeps one scale on
|
|
8
|
+
* both axes; any other plane scene is a graph, which may scale each axis on
|
|
9
|
+
* its own.
|
|
10
|
+
*/
|
|
11
|
+
export declare const PLANE_FIGURE_KINDS: readonly ["arc", "circle", "implicit", "parametric", "polar", "polygon", "ray", "vector"];
|
|
12
|
+
/** Whether a plane scene keeps one scale on both axes, because it draws a figure. */
|
|
13
|
+
export declare function keepsShape(objects: readonly PlaneMathObject[]): objects is readonly [{
|
|
14
|
+
readonly appearance: "answer" | "construction" | "highlight" | "primary" | "reference" | "secondary" | "warning";
|
|
15
|
+
readonly id: string;
|
|
16
|
+
readonly kind: "parametric";
|
|
17
|
+
readonly parameter: {
|
|
18
|
+
readonly max: number;
|
|
19
|
+
readonly min: number;
|
|
20
|
+
};
|
|
21
|
+
readonly x: string;
|
|
22
|
+
readonly y: string;
|
|
23
|
+
} | {
|
|
24
|
+
readonly appearance: "answer" | "construction" | "highlight" | "primary" | "reference" | "secondary" | "warning";
|
|
25
|
+
readonly id: string;
|
|
26
|
+
readonly angle: {
|
|
27
|
+
readonly max: number;
|
|
28
|
+
readonly min: number;
|
|
29
|
+
};
|
|
30
|
+
readonly kind: "polar";
|
|
31
|
+
readonly radius: string;
|
|
32
|
+
} | {
|
|
33
|
+
readonly appearance: "answer" | "construction" | "highlight" | "primary" | "reference" | "secondary" | "warning";
|
|
34
|
+
readonly id: string;
|
|
35
|
+
readonly equation: string;
|
|
36
|
+
readonly kind: "implicit";
|
|
37
|
+
} | {
|
|
38
|
+
readonly appearance: "answer" | "construction" | "highlight" | "primary" | "reference" | "secondary" | "warning";
|
|
39
|
+
readonly id: string;
|
|
40
|
+
readonly inequalities: readonly [string, ...string[]];
|
|
41
|
+
readonly kind: "region";
|
|
42
|
+
} | {
|
|
43
|
+
readonly appearance: "answer" | "construction" | "highlight" | "primary" | "reference" | "secondary" | "warning";
|
|
44
|
+
readonly id: string;
|
|
45
|
+
readonly kind: "marker";
|
|
46
|
+
readonly x: string;
|
|
47
|
+
readonly y: string;
|
|
48
|
+
} | {
|
|
49
|
+
readonly appearance: "answer" | "construction" | "highlight" | "primary" | "reference" | "secondary" | "warning";
|
|
50
|
+
readonly id: string;
|
|
51
|
+
readonly kind: "path";
|
|
52
|
+
readonly points: readonly {
|
|
53
|
+
readonly x: string;
|
|
54
|
+
readonly y: string;
|
|
55
|
+
}[];
|
|
56
|
+
} | {
|
|
57
|
+
readonly appearance: "answer" | "construction" | "highlight" | "primary" | "reference" | "secondary" | "warning";
|
|
58
|
+
readonly id: string;
|
|
59
|
+
readonly kind: "loop";
|
|
60
|
+
readonly points: readonly {
|
|
61
|
+
readonly x: string;
|
|
62
|
+
readonly y: string;
|
|
63
|
+
}[];
|
|
64
|
+
} | {
|
|
65
|
+
readonly appearance: "answer" | "construction" | "highlight" | "primary" | "reference" | "secondary" | "warning";
|
|
66
|
+
readonly id: string;
|
|
67
|
+
readonly at: {
|
|
68
|
+
readonly x: number;
|
|
69
|
+
readonly y: number;
|
|
70
|
+
};
|
|
71
|
+
readonly kind: "point";
|
|
72
|
+
} | {
|
|
73
|
+
readonly appearance: "answer" | "construction" | "highlight" | "primary" | "reference" | "secondary" | "warning";
|
|
74
|
+
readonly id: string;
|
|
75
|
+
readonly from: {
|
|
76
|
+
readonly x: number;
|
|
77
|
+
readonly y: number;
|
|
78
|
+
};
|
|
79
|
+
readonly kind: "vector";
|
|
80
|
+
readonly to: {
|
|
81
|
+
readonly x: number;
|
|
82
|
+
readonly y: number;
|
|
83
|
+
};
|
|
84
|
+
} | {
|
|
85
|
+
readonly appearance: "answer" | "construction" | "highlight" | "primary" | "reference" | "secondary" | "warning";
|
|
86
|
+
readonly id: string;
|
|
87
|
+
readonly kind: "polygon";
|
|
88
|
+
readonly vertices: readonly [{
|
|
89
|
+
readonly x: number;
|
|
90
|
+
readonly y: number;
|
|
91
|
+
}, {
|
|
92
|
+
readonly x: number;
|
|
93
|
+
readonly y: number;
|
|
94
|
+
}, {
|
|
95
|
+
readonly x: number;
|
|
96
|
+
readonly y: number;
|
|
97
|
+
}, ...{
|
|
98
|
+
readonly x: number;
|
|
99
|
+
readonly y: number;
|
|
100
|
+
}[]];
|
|
101
|
+
} | {
|
|
102
|
+
readonly appearance: "answer" | "construction" | "highlight" | "primary" | "reference" | "secondary" | "warning";
|
|
103
|
+
readonly id: string;
|
|
104
|
+
readonly center: {
|
|
105
|
+
readonly x: number;
|
|
106
|
+
readonly y: number;
|
|
107
|
+
};
|
|
108
|
+
readonly kind: "circle";
|
|
109
|
+
readonly radius: number;
|
|
110
|
+
} | {
|
|
111
|
+
readonly appearance: "answer" | "construction" | "highlight" | "primary" | "reference" | "secondary" | "warning";
|
|
112
|
+
readonly id: string;
|
|
113
|
+
readonly center: {
|
|
114
|
+
readonly x: number;
|
|
115
|
+
readonly y: number;
|
|
116
|
+
};
|
|
117
|
+
readonly kind: "arc";
|
|
118
|
+
readonly radius: number;
|
|
119
|
+
readonly startDegrees: number;
|
|
120
|
+
readonly sweepDegrees: number;
|
|
121
|
+
} | {
|
|
122
|
+
readonly appearance: "answer" | "construction" | "highlight" | "primary" | "reference" | "secondary" | "warning";
|
|
123
|
+
readonly id: string;
|
|
124
|
+
readonly coefficients: {
|
|
125
|
+
readonly a: number;
|
|
126
|
+
readonly b: number;
|
|
127
|
+
readonly c: number;
|
|
128
|
+
};
|
|
129
|
+
readonly domain: {
|
|
130
|
+
readonly max: number;
|
|
131
|
+
readonly min: number;
|
|
132
|
+
};
|
|
133
|
+
readonly inputAxis: "x" | "y";
|
|
134
|
+
readonly kind: "quadratic";
|
|
135
|
+
} | {
|
|
136
|
+
readonly appearance: "answer" | "construction" | "highlight" | "primary" | "reference" | "secondary" | "warning";
|
|
137
|
+
readonly id: string;
|
|
138
|
+
readonly stroke?: "dashed";
|
|
139
|
+
readonly domain?: {
|
|
140
|
+
readonly max: number;
|
|
141
|
+
readonly min: number;
|
|
142
|
+
};
|
|
143
|
+
readonly formula: string;
|
|
144
|
+
readonly inputAxis?: "x" | "y";
|
|
145
|
+
readonly kind: "function";
|
|
146
|
+
} | {
|
|
147
|
+
readonly appearance: "answer" | "construction" | "highlight" | "primary" | "reference" | "secondary" | "warning";
|
|
148
|
+
readonly id: string;
|
|
149
|
+
readonly stroke?: "dashed";
|
|
150
|
+
readonly kind: "line";
|
|
151
|
+
readonly through: readonly [{
|
|
152
|
+
readonly x: number;
|
|
153
|
+
readonly y: number;
|
|
154
|
+
}, {
|
|
155
|
+
readonly x: number;
|
|
156
|
+
readonly y: number;
|
|
157
|
+
}];
|
|
158
|
+
} | {
|
|
159
|
+
readonly appearance: "answer" | "construction" | "highlight" | "primary" | "reference" | "secondary" | "warning";
|
|
160
|
+
readonly id: string;
|
|
161
|
+
readonly stroke?: "dashed";
|
|
162
|
+
readonly from: {
|
|
163
|
+
readonly x: number;
|
|
164
|
+
readonly y: number;
|
|
165
|
+
};
|
|
166
|
+
readonly kind: "ray";
|
|
167
|
+
readonly through: {
|
|
168
|
+
readonly x: number;
|
|
169
|
+
readonly y: number;
|
|
170
|
+
};
|
|
171
|
+
} | {
|
|
172
|
+
readonly appearance: "answer" | "construction" | "highlight" | "primary" | "reference" | "secondary" | "warning";
|
|
173
|
+
readonly id: string;
|
|
174
|
+
readonly stroke?: "dashed";
|
|
175
|
+
readonly from: {
|
|
176
|
+
readonly x: number;
|
|
177
|
+
readonly y: number;
|
|
178
|
+
};
|
|
179
|
+
readonly kind: "segment";
|
|
180
|
+
readonly to: {
|
|
181
|
+
readonly x: number;
|
|
182
|
+
readonly y: number;
|
|
183
|
+
};
|
|
184
|
+
} | {
|
|
185
|
+
readonly appearance: "answer" | "construction" | "highlight" | "primary" | "reference" | "secondary" | "warning";
|
|
186
|
+
readonly id: string;
|
|
187
|
+
readonly stroke?: "dashed";
|
|
188
|
+
readonly kind: "polyline";
|
|
189
|
+
readonly vertices: readonly [{
|
|
190
|
+
readonly x: number;
|
|
191
|
+
readonly y: number;
|
|
192
|
+
}, {
|
|
193
|
+
readonly x: number;
|
|
194
|
+
readonly y: number;
|
|
195
|
+
}, ...{
|
|
196
|
+
readonly x: number;
|
|
197
|
+
readonly y: number;
|
|
198
|
+
}[]];
|
|
199
|
+
}, ...({
|
|
200
|
+
readonly appearance: "answer" | "construction" | "highlight" | "primary" | "reference" | "secondary" | "warning";
|
|
201
|
+
readonly id: string;
|
|
202
|
+
readonly kind: "parametric";
|
|
203
|
+
readonly parameter: {
|
|
204
|
+
readonly max: number;
|
|
205
|
+
readonly min: number;
|
|
206
|
+
};
|
|
207
|
+
readonly x: string;
|
|
208
|
+
readonly y: string;
|
|
209
|
+
} | {
|
|
210
|
+
readonly appearance: "answer" | "construction" | "highlight" | "primary" | "reference" | "secondary" | "warning";
|
|
211
|
+
readonly id: string;
|
|
212
|
+
readonly angle: {
|
|
213
|
+
readonly max: number;
|
|
214
|
+
readonly min: number;
|
|
215
|
+
};
|
|
216
|
+
readonly kind: "polar";
|
|
217
|
+
readonly radius: string;
|
|
218
|
+
} | {
|
|
219
|
+
readonly appearance: "answer" | "construction" | "highlight" | "primary" | "reference" | "secondary" | "warning";
|
|
220
|
+
readonly id: string;
|
|
221
|
+
readonly equation: string;
|
|
222
|
+
readonly kind: "implicit";
|
|
223
|
+
} | {
|
|
224
|
+
readonly appearance: "answer" | "construction" | "highlight" | "primary" | "reference" | "secondary" | "warning";
|
|
225
|
+
readonly id: string;
|
|
226
|
+
readonly inequalities: readonly [string, ...string[]];
|
|
227
|
+
readonly kind: "region";
|
|
228
|
+
} | {
|
|
229
|
+
readonly appearance: "answer" | "construction" | "highlight" | "primary" | "reference" | "secondary" | "warning";
|
|
230
|
+
readonly id: string;
|
|
231
|
+
readonly kind: "marker";
|
|
232
|
+
readonly x: string;
|
|
233
|
+
readonly y: string;
|
|
234
|
+
} | {
|
|
235
|
+
readonly appearance: "answer" | "construction" | "highlight" | "primary" | "reference" | "secondary" | "warning";
|
|
236
|
+
readonly id: string;
|
|
237
|
+
readonly kind: "path";
|
|
238
|
+
readonly points: readonly {
|
|
239
|
+
readonly x: string;
|
|
240
|
+
readonly y: string;
|
|
241
|
+
}[];
|
|
242
|
+
} | {
|
|
243
|
+
readonly appearance: "answer" | "construction" | "highlight" | "primary" | "reference" | "secondary" | "warning";
|
|
244
|
+
readonly id: string;
|
|
245
|
+
readonly kind: "loop";
|
|
246
|
+
readonly points: readonly {
|
|
247
|
+
readonly x: string;
|
|
248
|
+
readonly y: string;
|
|
249
|
+
}[];
|
|
250
|
+
} | {
|
|
251
|
+
readonly appearance: "answer" | "construction" | "highlight" | "primary" | "reference" | "secondary" | "warning";
|
|
252
|
+
readonly id: string;
|
|
253
|
+
readonly at: {
|
|
254
|
+
readonly x: number;
|
|
255
|
+
readonly y: number;
|
|
256
|
+
};
|
|
257
|
+
readonly kind: "point";
|
|
258
|
+
} | {
|
|
259
|
+
readonly appearance: "answer" | "construction" | "highlight" | "primary" | "reference" | "secondary" | "warning";
|
|
260
|
+
readonly id: string;
|
|
261
|
+
readonly from: {
|
|
262
|
+
readonly x: number;
|
|
263
|
+
readonly y: number;
|
|
264
|
+
};
|
|
265
|
+
readonly kind: "vector";
|
|
266
|
+
readonly to: {
|
|
267
|
+
readonly x: number;
|
|
268
|
+
readonly y: number;
|
|
269
|
+
};
|
|
270
|
+
} | {
|
|
271
|
+
readonly appearance: "answer" | "construction" | "highlight" | "primary" | "reference" | "secondary" | "warning";
|
|
272
|
+
readonly id: string;
|
|
273
|
+
readonly kind: "polygon";
|
|
274
|
+
readonly vertices: readonly [{
|
|
275
|
+
readonly x: number;
|
|
276
|
+
readonly y: number;
|
|
277
|
+
}, {
|
|
278
|
+
readonly x: number;
|
|
279
|
+
readonly y: number;
|
|
280
|
+
}, {
|
|
281
|
+
readonly x: number;
|
|
282
|
+
readonly y: number;
|
|
283
|
+
}, ...{
|
|
284
|
+
readonly x: number;
|
|
285
|
+
readonly y: number;
|
|
286
|
+
}[]];
|
|
287
|
+
} | {
|
|
288
|
+
readonly appearance: "answer" | "construction" | "highlight" | "primary" | "reference" | "secondary" | "warning";
|
|
289
|
+
readonly id: string;
|
|
290
|
+
readonly center: {
|
|
291
|
+
readonly x: number;
|
|
292
|
+
readonly y: number;
|
|
293
|
+
};
|
|
294
|
+
readonly kind: "circle";
|
|
295
|
+
readonly radius: number;
|
|
296
|
+
} | {
|
|
297
|
+
readonly appearance: "answer" | "construction" | "highlight" | "primary" | "reference" | "secondary" | "warning";
|
|
298
|
+
readonly id: string;
|
|
299
|
+
readonly center: {
|
|
300
|
+
readonly x: number;
|
|
301
|
+
readonly y: number;
|
|
302
|
+
};
|
|
303
|
+
readonly kind: "arc";
|
|
304
|
+
readonly radius: number;
|
|
305
|
+
readonly startDegrees: number;
|
|
306
|
+
readonly sweepDegrees: number;
|
|
307
|
+
} | {
|
|
308
|
+
readonly appearance: "answer" | "construction" | "highlight" | "primary" | "reference" | "secondary" | "warning";
|
|
309
|
+
readonly id: string;
|
|
310
|
+
readonly coefficients: {
|
|
311
|
+
readonly a: number;
|
|
312
|
+
readonly b: number;
|
|
313
|
+
readonly c: number;
|
|
314
|
+
};
|
|
315
|
+
readonly domain: {
|
|
316
|
+
readonly max: number;
|
|
317
|
+
readonly min: number;
|
|
318
|
+
};
|
|
319
|
+
readonly inputAxis: "x" | "y";
|
|
320
|
+
readonly kind: "quadratic";
|
|
321
|
+
} | {
|
|
322
|
+
readonly appearance: "answer" | "construction" | "highlight" | "primary" | "reference" | "secondary" | "warning";
|
|
323
|
+
readonly id: string;
|
|
324
|
+
readonly stroke?: "dashed";
|
|
325
|
+
readonly domain?: {
|
|
326
|
+
readonly max: number;
|
|
327
|
+
readonly min: number;
|
|
328
|
+
};
|
|
329
|
+
readonly formula: string;
|
|
330
|
+
readonly inputAxis?: "x" | "y";
|
|
331
|
+
readonly kind: "function";
|
|
332
|
+
} | {
|
|
333
|
+
readonly appearance: "answer" | "construction" | "highlight" | "primary" | "reference" | "secondary" | "warning";
|
|
334
|
+
readonly id: string;
|
|
335
|
+
readonly stroke?: "dashed";
|
|
336
|
+
readonly kind: "line";
|
|
337
|
+
readonly through: readonly [{
|
|
338
|
+
readonly x: number;
|
|
339
|
+
readonly y: number;
|
|
340
|
+
}, {
|
|
341
|
+
readonly x: number;
|
|
342
|
+
readonly y: number;
|
|
343
|
+
}];
|
|
344
|
+
} | {
|
|
345
|
+
readonly appearance: "answer" | "construction" | "highlight" | "primary" | "reference" | "secondary" | "warning";
|
|
346
|
+
readonly id: string;
|
|
347
|
+
readonly stroke?: "dashed";
|
|
348
|
+
readonly from: {
|
|
349
|
+
readonly x: number;
|
|
350
|
+
readonly y: number;
|
|
351
|
+
};
|
|
352
|
+
readonly kind: "ray";
|
|
353
|
+
readonly through: {
|
|
354
|
+
readonly x: number;
|
|
355
|
+
readonly y: number;
|
|
356
|
+
};
|
|
357
|
+
} | {
|
|
358
|
+
readonly appearance: "answer" | "construction" | "highlight" | "primary" | "reference" | "secondary" | "warning";
|
|
359
|
+
readonly id: string;
|
|
360
|
+
readonly stroke?: "dashed";
|
|
361
|
+
readonly from: {
|
|
362
|
+
readonly x: number;
|
|
363
|
+
readonly y: number;
|
|
364
|
+
};
|
|
365
|
+
readonly kind: "segment";
|
|
366
|
+
readonly to: {
|
|
367
|
+
readonly x: number;
|
|
368
|
+
readonly y: number;
|
|
369
|
+
};
|
|
370
|
+
} | {
|
|
371
|
+
readonly appearance: "answer" | "construction" | "highlight" | "primary" | "reference" | "secondary" | "warning";
|
|
372
|
+
readonly id: string;
|
|
373
|
+
readonly stroke?: "dashed";
|
|
374
|
+
readonly kind: "polyline";
|
|
375
|
+
readonly vertices: readonly [{
|
|
376
|
+
readonly x: number;
|
|
377
|
+
readonly y: number;
|
|
378
|
+
}, {
|
|
379
|
+
readonly x: number;
|
|
380
|
+
readonly y: number;
|
|
381
|
+
}, ...{
|
|
382
|
+
readonly x: number;
|
|
383
|
+
readonly y: number;
|
|
384
|
+
}[]];
|
|
385
|
+
})[]];
|
|
386
|
+
/**
|
|
387
|
+
* Guardrail G1: the frame of a plane scene that keeps one scale is between
|
|
388
|
+
* 0.7 and 2 times as wide as it is tall, padding included. The frame is only
|
|
389
|
+
* the region the figure teaches, and the world continues past it, so a frame
|
|
390
|
+
* stretched to reach a far point only shrinks the figure.
|
|
391
|
+
*/
|
|
392
|
+
export declare function figureAspectIssues(frame: PlaneMathFrame, objects: readonly PlaneMathObject[], view: PlaneMathView): readonly Schema.FilterIssue[];
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { Array as Arr } from "effect";
|
|
2
|
+
/**
|
|
3
|
+
* The plane objects whose meaning is their shape: a circle is round, an arc's
|
|
4
|
+
* angle is true, a polygon's sides keep their proportion, and a vector or a
|
|
5
|
+
* ray points the way it is drawn. A parametric curve counts, because circles
|
|
6
|
+
* and angle marks are drawn with it. A scene that draws one keeps one scale on
|
|
7
|
+
* both axes; any other plane scene is a graph, which may scale each axis on
|
|
8
|
+
* its own.
|
|
9
|
+
*/
|
|
10
|
+
export const PLANE_FIGURE_KINDS = [
|
|
11
|
+
"arc",
|
|
12
|
+
"circle",
|
|
13
|
+
"implicit",
|
|
14
|
+
"parametric",
|
|
15
|
+
"polar",
|
|
16
|
+
"polygon",
|
|
17
|
+
"ray",
|
|
18
|
+
"vector",
|
|
19
|
+
];
|
|
20
|
+
/** Whether a plane scene keeps one scale on both axes, because it draws a figure. */
|
|
21
|
+
export function keepsShape(objects) {
|
|
22
|
+
return Arr.some(objects, ({ kind }) => Arr.contains(PLANE_FIGURE_KINDS, kind));
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* The aspects, wide over tall and padding included, between which a frame
|
|
26
|
+
* kept at one scale fills a card on a phone and on a desk: a wider frame
|
|
27
|
+
* shrinks the figure to a strip, a taller one to a column.
|
|
28
|
+
*/
|
|
29
|
+
const FIGURE_ASPECT = { max: 2, min: 0.7 };
|
|
30
|
+
/** A number of a frame's message, to two decimals at most. */
|
|
31
|
+
function short(value) {
|
|
32
|
+
return String(Math.round(value * 100) / 100);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Guardrail G1: the frame of a plane scene that keeps one scale is between
|
|
36
|
+
* 0.7 and 2 times as wide as it is tall, padding included. The frame is only
|
|
37
|
+
* the region the figure teaches, and the world continues past it, so a frame
|
|
38
|
+
* stretched to reach a far point only shrinks the figure.
|
|
39
|
+
*/
|
|
40
|
+
export function figureAspectIssues(frame, objects, view) {
|
|
41
|
+
if (!keepsShape(objects)) {
|
|
42
|
+
return [];
|
|
43
|
+
}
|
|
44
|
+
const padding = view.padding ?? 0;
|
|
45
|
+
// Halves keep a frame as wide as the largest finite numbers from overflowing.
|
|
46
|
+
const halfWidth = frame.x.max / 2 - frame.x.min / 2 + padding;
|
|
47
|
+
const halfHeight = frame.y.max / 2 - frame.y.min / 2 + padding;
|
|
48
|
+
const aspect = halfWidth / halfHeight;
|
|
49
|
+
const width = 2 * halfWidth;
|
|
50
|
+
const height = 2 * halfHeight;
|
|
51
|
+
return aspect >= FIGURE_ASPECT.min && aspect <= FIGURE_ASPECT.max
|
|
52
|
+
? []
|
|
53
|
+
: [
|
|
54
|
+
{
|
|
55
|
+
issue: `Expected the frame of a scene that keeps one scale (it draws one of: ${Arr.join(PLANE_FIGURE_KINDS, ", ")}) to be between ${FIGURE_ASPECT.min} and ${FIGURE_ASPECT.max} times as wide as it is tall, padding included; this frame is ${short(width)} by ${short(height)} (${short(aspect)}). Frame the region the figure teaches: the grid, the axes and every unbounded object continue past it.`,
|
|
56
|
+
path: ["frame"],
|
|
57
|
+
},
|
|
58
|
+
];
|
|
59
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Option } from "effect";
|
|
2
|
+
import type { PlaneMathObject } from "#contracts/math/plane";
|
|
3
|
+
/**
|
|
4
|
+
* Two points of a straight object of a plane scene, which name the line it
|
|
5
|
+
* runs along: a line, ray, segment, or the graph of an affine formula.
|
|
6
|
+
*/
|
|
7
|
+
export declare function straightPoints(object: PlaneMathObject): Option.Option<readonly [{
|
|
8
|
+
readonly x: number;
|
|
9
|
+
readonly y: number;
|
|
10
|
+
}, {
|
|
11
|
+
readonly x: number;
|
|
12
|
+
readonly y: number;
|
|
13
|
+
}]>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Match, Option, Result } from "effect";
|
|
2
|
+
import { readAffine } from "#contracts/math/formula/affine";
|
|
3
|
+
import { readFormula } from "#contracts/math/formula/parse";
|
|
4
|
+
/** Two points of a graph that is a straight line: an affine formula in its input axis. */
|
|
5
|
+
function straightGraph(formula, input) {
|
|
6
|
+
return Result.getSuccess(readFormula(formula)).pipe(Option.flatMap((node) => readAffine(node, [input])), Option.map(({ constant, terms }) => {
|
|
7
|
+
const slope = terms[input] ?? 0;
|
|
8
|
+
/** The graph's point at one value of its input. */
|
|
9
|
+
const at = (value) => input === "x"
|
|
10
|
+
? { x: value, y: slope * value + constant }
|
|
11
|
+
: { x: slope * value + constant, y: value };
|
|
12
|
+
return [at(0), at(1)];
|
|
13
|
+
}));
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Two points of a straight object of a plane scene, which name the line it
|
|
17
|
+
* runs along: a line, ray, segment, or the graph of an affine formula.
|
|
18
|
+
*/
|
|
19
|
+
export function straightPoints(object) {
|
|
20
|
+
return Match.value(object).pipe(Match.discriminators("kind")({
|
|
21
|
+
function: ({ formula, inputAxis = "x" }) => straightGraph(formula, inputAxis),
|
|
22
|
+
line: ({ through }) => Option.some(through),
|
|
23
|
+
ray: ({ from, through }) => Option.some([from, through]),
|
|
24
|
+
segment: ({ from, to }) => Option.some([from, to]),
|
|
25
|
+
}), Match.orElse(() => Option.none()));
|
|
26
|
+
}
|
|
@@ -210,7 +210,7 @@ export declare const ContentSnapshotRowSchema: Schema.Union<readonly [Schema.Str
|
|
|
210
210
|
readonly seconds: Schema.Int;
|
|
211
211
|
}>>;
|
|
212
212
|
readonly defaults: Schema.$Array<Schema.Struct<{
|
|
213
|
-
readonly interaction: Schema.Union<[Schema.Literal<"choice"> | Schema.Literal<"extendedText"> | Schema.Literal<"gapMatch"> | Schema.Literal<"graphPoint"> | Schema.Literal<"hotspot"> | Schema.Literal<"inlineChoice"> | Schema.Literal<"match"> | Schema.Literal<"mathEntry"> | Schema.Literal<"matrix"> | Schema.Literal<"numericEntry"> | Schema.Literal<"order"> | Schema.Literal<"textEntry">, ...(Schema.Literal<"choice"> | Schema.Literal<"extendedText"> | Schema.Literal<"gapMatch"> | Schema.Literal<"graphPoint"> | Schema.Literal<"hotspot"> | Schema.Literal<"inlineChoice"> | Schema.Literal<"match"> | Schema.Literal<"mathEntry"> | Schema.Literal<"matrix"> | Schema.Literal<"numericEntry"> | Schema.Literal<"order"> | Schema.Literal<"textEntry">)[]]>;
|
|
213
|
+
readonly interaction: Schema.Union<[Schema.Literal<"choice"> | Schema.Literal<"extendedText"> | Schema.Literal<"gapMatch"> | Schema.Literal<"graphPoint"> | Schema.Literal<"hotspot"> | Schema.Literal<"inlineChoice"> | Schema.Literal<"match"> | Schema.Literal<"mathEntry"> | Schema.Literal<"matrix"> | Schema.Literal<"numericEntry"> | Schema.Literal<"order"> | Schema.Literal<"sketch"> | Schema.Literal<"textEntry">, ...(Schema.Literal<"choice"> | Schema.Literal<"extendedText"> | Schema.Literal<"gapMatch"> | Schema.Literal<"graphPoint"> | Schema.Literal<"hotspot"> | Schema.Literal<"inlineChoice"> | Schema.Literal<"match"> | Schema.Literal<"mathEntry"> | Schema.Literal<"matrix"> | Schema.Literal<"numericEntry"> | Schema.Literal<"order"> | Schema.Literal<"sketch"> | Schema.Literal<"textEntry">)[]]>;
|
|
214
214
|
readonly rule: Schema.Union<readonly [Schema.Struct<{
|
|
215
215
|
readonly kind: Schema.Literal<"allOrNothing">;
|
|
216
216
|
}>, Schema.Struct<{
|
|
@@ -256,7 +256,7 @@ export declare const ContentSnapshotRowSchema: Schema.Union<readonly [Schema.Str
|
|
|
256
256
|
}>]>;
|
|
257
257
|
readonly sections: Schema.NonEmptyArray<Schema.Struct<{
|
|
258
258
|
readonly id: Schema.String;
|
|
259
|
-
readonly interactions: Schema.NonEmptyArray<Schema.Union<[Schema.Literal<"choice"> | Schema.Literal<"extendedText"> | Schema.Literal<"gapMatch"> | Schema.Literal<"graphPoint"> | Schema.Literal<"hotspot"> | Schema.Literal<"inlineChoice"> | Schema.Literal<"match"> | Schema.Literal<"mathEntry"> | Schema.Literal<"matrix"> | Schema.Literal<"numericEntry"> | Schema.Literal<"order"> | Schema.Literal<"textEntry">, ...(Schema.Literal<"choice"> | Schema.Literal<"extendedText"> | Schema.Literal<"gapMatch"> | Schema.Literal<"graphPoint"> | Schema.Literal<"hotspot"> | Schema.Literal<"inlineChoice"> | Schema.Literal<"match"> | Schema.Literal<"mathEntry"> | Schema.Literal<"matrix"> | Schema.Literal<"numericEntry"> | Schema.Literal<"order"> | Schema.Literal<"textEntry">)[]]>>;
|
|
259
|
+
readonly interactions: Schema.NonEmptyArray<Schema.Union<[Schema.Literal<"choice"> | Schema.Literal<"extendedText"> | Schema.Literal<"gapMatch"> | Schema.Literal<"graphPoint"> | Schema.Literal<"hotspot"> | Schema.Literal<"inlineChoice"> | Schema.Literal<"match"> | Schema.Literal<"mathEntry"> | Schema.Literal<"matrix"> | Schema.Literal<"numericEntry"> | Schema.Literal<"order"> | Schema.Literal<"sketch"> | Schema.Literal<"textEntry">, ...(Schema.Literal<"choice"> | Schema.Literal<"extendedText"> | Schema.Literal<"gapMatch"> | Schema.Literal<"graphPoint"> | Schema.Literal<"hotspot"> | Schema.Literal<"inlineChoice"> | Schema.Literal<"match"> | Schema.Literal<"mathEntry"> | Schema.Literal<"matrix"> | Schema.Literal<"numericEntry"> | Schema.Literal<"order"> | Schema.Literal<"sketch"> | Schema.Literal<"textEntry">)[]]>>;
|
|
260
260
|
readonly items: Schema.Int;
|
|
261
261
|
readonly names: Schema.$Record<Schema.Literals<readonly ["en", "id", "de", "ms"]>, Schema.Trimmed>;
|
|
262
262
|
readonly navigation: Schema.Literals<readonly ["free", "linear"]>;
|
|
@@ -514,6 +514,23 @@ export declare const ContentSnapshotRowSchema: Schema.Union<readonly [Schema.Str
|
|
|
514
514
|
readonly label: Schema.Trimmed;
|
|
515
515
|
readonly expectedLines: Schema.optionalKey<Schema.Int>;
|
|
516
516
|
readonly kind: Schema.Literal<"extendedText">;
|
|
517
|
+
}>, Schema.Struct<{
|
|
518
|
+
readonly id: Schema.String;
|
|
519
|
+
readonly label: Schema.Trimmed;
|
|
520
|
+
readonly frame: Schema.Struct<{
|
|
521
|
+
readonly kind: Schema.Literal<"cartesian">;
|
|
522
|
+
readonly x: Schema.Struct<{
|
|
523
|
+
readonly max: Schema.Finite;
|
|
524
|
+
readonly min: Schema.Finite;
|
|
525
|
+
}>;
|
|
526
|
+
readonly y: Schema.Struct<{
|
|
527
|
+
readonly max: Schema.Finite;
|
|
528
|
+
readonly min: Schema.Finite;
|
|
529
|
+
}>;
|
|
530
|
+
}>;
|
|
531
|
+
readonly grid: Schema.optionalKey<Schema.Finite>;
|
|
532
|
+
readonly kind: Schema.Literal<"sketch">;
|
|
533
|
+
readonly marks: Schema.$Array<Schema.Literals<readonly ["asymptote", "point"]>>;
|
|
517
534
|
}>]>>;
|
|
518
535
|
readonly joint: Schema.optionalKey<Schema.Struct<{
|
|
519
536
|
readonly levels: Schema.NonEmptyArray<Schema.Struct<{
|
|
@@ -656,12 +673,81 @@ export declare const ContentSnapshotRowSchema: Schema.Union<readonly [Schema.Str
|
|
|
656
673
|
readonly interaction: Schema.String;
|
|
657
674
|
readonly criteria: Schema.NonEmptyArray<Schema.Struct<{
|
|
658
675
|
readonly criterion: Schema.String;
|
|
676
|
+
readonly feedback: Schema.optionalKey<Schema.Struct<{
|
|
677
|
+
readonly earned: Schema.Trimmed;
|
|
678
|
+
readonly missed: Schema.Trimmed;
|
|
679
|
+
}>>;
|
|
659
680
|
readonly levels: Schema.NonEmptyArray<Schema.Struct<{
|
|
660
681
|
readonly descriptor: Schema.Trimmed;
|
|
661
682
|
readonly level: Schema.String;
|
|
662
683
|
}>>;
|
|
663
684
|
}>>;
|
|
664
685
|
readonly kind: Schema.Literal<"extendedText">;
|
|
686
|
+
}>, Schema.Struct<{
|
|
687
|
+
readonly criteria: Schema.NonEmptyArray<Schema.Struct<{
|
|
688
|
+
readonly check: Schema.Struct<{
|
|
689
|
+
readonly feature: Schema.Union<readonly [Schema.Struct<{
|
|
690
|
+
readonly contact: Schema.Literals<readonly ["cross", "touch"]>;
|
|
691
|
+
readonly kind: Schema.Literal<"zero">;
|
|
692
|
+
readonly x: Schema.String;
|
|
693
|
+
}>, Schema.Struct<{
|
|
694
|
+
readonly kind: Schema.Literal<"yIntercept">;
|
|
695
|
+
readonly y: Schema.String;
|
|
696
|
+
}>, Schema.Struct<{
|
|
697
|
+
readonly kind: Schema.Literal<"extremum">;
|
|
698
|
+
readonly turn: Schema.Literals<readonly ["maximum", "minimum"]>;
|
|
699
|
+
readonly x: Schema.String;
|
|
700
|
+
readonly y: Schema.String;
|
|
701
|
+
}>, Schema.Struct<{
|
|
702
|
+
readonly kind: Schema.Literal<"asymptote">;
|
|
703
|
+
readonly line: Schema.Union<readonly [Schema.Struct<{
|
|
704
|
+
readonly kind: Schema.Literal<"vertical">;
|
|
705
|
+
readonly x: Schema.String;
|
|
706
|
+
}>, Schema.Struct<{
|
|
707
|
+
readonly intercept: Schema.String;
|
|
708
|
+
readonly kind: Schema.Literal<"sloped">;
|
|
709
|
+
readonly slope: Schema.String;
|
|
710
|
+
}>]>;
|
|
711
|
+
}>, Schema.Struct<{
|
|
712
|
+
readonly direction: Schema.Literals<readonly ["falling", "rising"]>;
|
|
713
|
+
readonly from: Schema.NullOr<Schema.String>;
|
|
714
|
+
readonly kind: Schema.Literal<"interval">;
|
|
715
|
+
readonly to: Schema.NullOr<Schema.String>;
|
|
716
|
+
}>, Schema.Struct<{
|
|
717
|
+
readonly kind: Schema.Literal<"end">;
|
|
718
|
+
readonly limit: Schema.Union<readonly [Schema.Literals<readonly ["negativeInfinity", "positiveInfinity"]>, Schema.String]>;
|
|
719
|
+
readonly side: Schema.Literals<readonly ["left", "right"]>;
|
|
720
|
+
}>, Schema.Struct<{
|
|
721
|
+
readonly kind: Schema.Literal<"inflection">;
|
|
722
|
+
readonly x: Schema.String;
|
|
723
|
+
readonly y: Schema.String;
|
|
724
|
+
}>, Schema.Struct<{
|
|
725
|
+
readonly end: Schema.optionalKey<Schema.Literals<readonly ["closed", "open"]>>;
|
|
726
|
+
readonly kind: Schema.Literal<"point">;
|
|
727
|
+
readonly x: Schema.String;
|
|
728
|
+
readonly y: Schema.String;
|
|
729
|
+
}>]>;
|
|
730
|
+
readonly kind: Schema.Literal<"feature">;
|
|
731
|
+
}>;
|
|
732
|
+
readonly criterion: Schema.String;
|
|
733
|
+
readonly feedback: Schema.Struct<{
|
|
734
|
+
readonly earned: Schema.Trimmed;
|
|
735
|
+
readonly missed: Schema.Trimmed;
|
|
736
|
+
}>;
|
|
737
|
+
readonly requires: Schema.optionalKey<Schema.NonEmptyArray<Schema.String>>;
|
|
738
|
+
}>>;
|
|
739
|
+
readonly interaction: Schema.String;
|
|
740
|
+
readonly kind: Schema.Literal<"sketch">;
|
|
741
|
+
readonly tolerances: Schema.Struct<{
|
|
742
|
+
readonly asymptote: Schema.optionalKey<Schema.String>;
|
|
743
|
+
readonly end: Schema.optionalKey<Schema.String>;
|
|
744
|
+
readonly extremum: Schema.optionalKey<Schema.String>;
|
|
745
|
+
readonly inflection: Schema.optionalKey<Schema.String>;
|
|
746
|
+
readonly interval: Schema.optionalKey<Schema.String>;
|
|
747
|
+
readonly point: Schema.optionalKey<Schema.String>;
|
|
748
|
+
readonly yIntercept: Schema.optionalKey<Schema.String>;
|
|
749
|
+
readonly zero: Schema.optionalKey<Schema.String>;
|
|
750
|
+
}>;
|
|
665
751
|
}>]>>;
|
|
666
752
|
readonly version: Schema.brand<Schema.String, "@NakafaAI/AksaraSha256Hash">;
|
|
667
753
|
}>;
|