@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
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
|
-
import {
|
|
2
|
+
import type { RichSlot } from "#contracts/visual/card";
|
|
3
|
+
/** The most visible characters a label anchored in the scene shows (`visibleLength`). */
|
|
4
|
+
export declare const LABEL_CHARACTERS = 32;
|
|
3
5
|
/**
|
|
4
6
|
* The mathematical components. A scene marks its answer with the `answer`
|
|
5
7
|
* appearance and computes values in its readouts, so both are answer state.
|
|
@@ -15,6 +17,73 @@ export declare function mathVisuals<E>(rich: RichSlot<E>): {
|
|
|
15
17
|
MathContainer: import("#contracts/visual/entry").VisualEntry<Schema.$Record<Schema.String, Schema.Never>, "markup">;
|
|
16
18
|
MathVisual: import("#contracts/visual/entry").VisualEntry<Schema.Struct<{
|
|
17
19
|
readonly description: RichSlot<E>;
|
|
20
|
+
readonly footer: Schema.optionalKey<Schema.Codec<readonly [{
|
|
21
|
+
readonly attrs: {
|
|
22
|
+
readonly latex: string;
|
|
23
|
+
};
|
|
24
|
+
readonly type: "mathInline";
|
|
25
|
+
} | {
|
|
26
|
+
readonly marks?: readonly [{
|
|
27
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
28
|
+
} | {
|
|
29
|
+
readonly attrs: {
|
|
30
|
+
readonly href: string;
|
|
31
|
+
};
|
|
32
|
+
readonly type: "link";
|
|
33
|
+
} | {
|
|
34
|
+
readonly attrs: {
|
|
35
|
+
readonly variant: "success" | "warning" | null;
|
|
36
|
+
};
|
|
37
|
+
readonly type: "highlight";
|
|
38
|
+
}, ...({
|
|
39
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
40
|
+
} | {
|
|
41
|
+
readonly attrs: {
|
|
42
|
+
readonly href: string;
|
|
43
|
+
};
|
|
44
|
+
readonly type: "link";
|
|
45
|
+
} | {
|
|
46
|
+
readonly attrs: {
|
|
47
|
+
readonly variant: "success" | "warning" | null;
|
|
48
|
+
};
|
|
49
|
+
readonly type: "highlight";
|
|
50
|
+
})[]];
|
|
51
|
+
readonly text: string;
|
|
52
|
+
readonly type: "text";
|
|
53
|
+
}, ...({
|
|
54
|
+
readonly attrs: {
|
|
55
|
+
readonly latex: string;
|
|
56
|
+
};
|
|
57
|
+
readonly type: "mathInline";
|
|
58
|
+
} | {
|
|
59
|
+
readonly marks?: readonly [{
|
|
60
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
61
|
+
} | {
|
|
62
|
+
readonly attrs: {
|
|
63
|
+
readonly href: string;
|
|
64
|
+
};
|
|
65
|
+
readonly type: "link";
|
|
66
|
+
} | {
|
|
67
|
+
readonly attrs: {
|
|
68
|
+
readonly variant: "success" | "warning" | null;
|
|
69
|
+
};
|
|
70
|
+
readonly type: "highlight";
|
|
71
|
+
}, ...({
|
|
72
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
73
|
+
} | {
|
|
74
|
+
readonly attrs: {
|
|
75
|
+
readonly href: string;
|
|
76
|
+
};
|
|
77
|
+
readonly type: "link";
|
|
78
|
+
} | {
|
|
79
|
+
readonly attrs: {
|
|
80
|
+
readonly variant: "success" | "warning" | null;
|
|
81
|
+
};
|
|
82
|
+
readonly type: "highlight";
|
|
83
|
+
})[]];
|
|
84
|
+
readonly text: string;
|
|
85
|
+
readonly type: "text";
|
|
86
|
+
})[]], E, never, never>>;
|
|
18
87
|
readonly title: RichSlot<E>;
|
|
19
88
|
readonly labels: Schema.optionalKey<Schema.$Record<Schema.String, RichSlot<E>>>;
|
|
20
89
|
readonly scene: Schema.Union<readonly [Schema.Struct<{
|
|
@@ -44,6 +113,7 @@ export declare function mathVisuals<E>(rich: RichSlot<E>): {
|
|
|
44
113
|
readonly objects: Schema.NonEmptyArray<Schema.Union<readonly [Schema.Struct<{
|
|
45
114
|
readonly appearance: Schema.Literals<readonly ["answer", "construction", "highlight", "primary", "reference", "secondary", "warning"]>;
|
|
46
115
|
readonly id: Schema.String;
|
|
116
|
+
readonly stroke: Schema.optionalKey<Schema.Literals<readonly ["dashed"]>>;
|
|
47
117
|
readonly domain: Schema.optionalKey<Schema.Struct<{
|
|
48
118
|
readonly max: Schema.Finite;
|
|
49
119
|
readonly min: Schema.Finite;
|
|
@@ -125,6 +195,7 @@ export declare function mathVisuals<E>(rich: RichSlot<E>): {
|
|
|
125
195
|
}>, Schema.Struct<{
|
|
126
196
|
readonly appearance: Schema.Literals<readonly ["answer", "construction", "highlight", "primary", "reference", "secondary", "warning"]>;
|
|
127
197
|
readonly id: Schema.String;
|
|
198
|
+
readonly stroke: Schema.optionalKey<Schema.Literals<readonly ["dashed"]>>;
|
|
128
199
|
readonly kind: Schema.Literal<"line">;
|
|
129
200
|
readonly through: Schema.Tuple<readonly [Schema.Struct<{
|
|
130
201
|
readonly x: Schema.Finite;
|
|
@@ -161,6 +232,7 @@ export declare function mathVisuals<E>(rich: RichSlot<E>): {
|
|
|
161
232
|
}>, Schema.Struct<{
|
|
162
233
|
readonly appearance: Schema.Literals<readonly ["answer", "construction", "highlight", "primary", "reference", "secondary", "warning"]>;
|
|
163
234
|
readonly id: Schema.String;
|
|
235
|
+
readonly stroke: Schema.optionalKey<Schema.Literals<readonly ["dashed"]>>;
|
|
164
236
|
readonly kind: Schema.Literal<"polyline">;
|
|
165
237
|
readonly vertices: Schema.TupleWithRest<Schema.Tuple<readonly [Schema.Struct<{
|
|
166
238
|
readonly x: Schema.Finite;
|
|
@@ -189,6 +261,7 @@ export declare function mathVisuals<E>(rich: RichSlot<E>): {
|
|
|
189
261
|
}>, Schema.Struct<{
|
|
190
262
|
readonly appearance: Schema.Literals<readonly ["answer", "construction", "highlight", "primary", "reference", "secondary", "warning"]>;
|
|
191
263
|
readonly id: Schema.String;
|
|
264
|
+
readonly stroke: Schema.optionalKey<Schema.Literals<readonly ["dashed"]>>;
|
|
192
265
|
readonly from: Schema.Struct<{
|
|
193
266
|
readonly x: Schema.Finite;
|
|
194
267
|
readonly y: Schema.Finite;
|
|
@@ -201,6 +274,7 @@ export declare function mathVisuals<E>(rich: RichSlot<E>): {
|
|
|
201
274
|
}>, Schema.Struct<{
|
|
202
275
|
readonly appearance: Schema.Literals<readonly ["answer", "construction", "highlight", "primary", "reference", "secondary", "warning"]>;
|
|
203
276
|
readonly id: Schema.String;
|
|
277
|
+
readonly stroke: Schema.optionalKey<Schema.Literals<readonly ["dashed"]>>;
|
|
204
278
|
readonly from: Schema.Struct<{
|
|
205
279
|
readonly x: Schema.Finite;
|
|
206
280
|
readonly y: Schema.Finite;
|
|
@@ -386,6 +460,7 @@ export declare function mathVisuals<E>(rich: RichSlot<E>): {
|
|
|
386
460
|
}>, Schema.Struct<{
|
|
387
461
|
readonly appearance: Schema.Literals<readonly ["answer", "construction", "highlight", "primary", "reference", "secondary", "warning"]>;
|
|
388
462
|
readonly id: Schema.String;
|
|
463
|
+
readonly stroke: Schema.optionalKey<Schema.Literals<readonly ["dashed"]>>;
|
|
389
464
|
readonly kind: Schema.Literal<"line">;
|
|
390
465
|
readonly through: Schema.Tuple<readonly [Schema.Struct<{
|
|
391
466
|
readonly x: Schema.Finite;
|
|
@@ -429,6 +504,7 @@ export declare function mathVisuals<E>(rich: RichSlot<E>): {
|
|
|
429
504
|
}>, Schema.Struct<{
|
|
430
505
|
readonly appearance: Schema.Literals<readonly ["answer", "construction", "highlight", "primary", "reference", "secondary", "warning"]>;
|
|
431
506
|
readonly id: Schema.String;
|
|
507
|
+
readonly stroke: Schema.optionalKey<Schema.Literals<readonly ["dashed"]>>;
|
|
432
508
|
readonly kind: Schema.Literal<"polyline">;
|
|
433
509
|
readonly vertices: Schema.TupleWithRest<Schema.Tuple<readonly [Schema.Struct<{
|
|
434
510
|
readonly x: Schema.Finite;
|
|
@@ -446,6 +522,7 @@ export declare function mathVisuals<E>(rich: RichSlot<E>): {
|
|
|
446
522
|
}>, Schema.Struct<{
|
|
447
523
|
readonly appearance: Schema.Literals<readonly ["answer", "construction", "highlight", "primary", "reference", "secondary", "warning"]>;
|
|
448
524
|
readonly id: Schema.String;
|
|
525
|
+
readonly stroke: Schema.optionalKey<Schema.Literals<readonly ["dashed"]>>;
|
|
449
526
|
readonly from: Schema.Struct<{
|
|
450
527
|
readonly x: Schema.Finite;
|
|
451
528
|
readonly y: Schema.Finite;
|
|
@@ -460,6 +537,7 @@ export declare function mathVisuals<E>(rich: RichSlot<E>): {
|
|
|
460
537
|
}>, Schema.Struct<{
|
|
461
538
|
readonly appearance: Schema.Literals<readonly ["answer", "construction", "highlight", "primary", "reference", "secondary", "warning"]>;
|
|
462
539
|
readonly id: Schema.String;
|
|
540
|
+
readonly stroke: Schema.optionalKey<Schema.Literals<readonly ["dashed"]>>;
|
|
463
541
|
readonly from: Schema.Struct<{
|
|
464
542
|
readonly x: Schema.Finite;
|
|
465
543
|
readonly y: Schema.Finite;
|
package/dist/visual/base/math.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { Array as Arr, Predicate, Record as Rec, Schema } from "effect";
|
|
1
|
+
import { Array as Arr, Option, Predicate, Record as Rec, Schema } from "effect";
|
|
2
|
+
import { RichTextSchema } from "#contracts/assessment/inline";
|
|
2
3
|
import { MathAppearanceSchema, MathVisualKeySchema, } from "#contracts/math/base";
|
|
3
4
|
import { MathVisualSchema, mathVisualLabelKeys } from "#contracts/math/visual";
|
|
4
5
|
import { NoPropsSchema } from "#contracts/visual/base/layout";
|
|
5
6
|
import { cardFields } from "#contracts/visual/card";
|
|
6
7
|
import { figure, markup } from "#contracts/visual/entry";
|
|
8
|
+
import { visibleLength } from "#contracts/visual/length";
|
|
7
9
|
/** A scene and the keys of the rich labels it anchors, as the check reads them. */
|
|
8
10
|
const LabeledSceneSchema = Schema.Struct({
|
|
9
11
|
labels: Schema.optionalKey(Schema.Record(Schema.String, Schema.Unknown)),
|
|
@@ -21,15 +23,41 @@ function hasSceneLabels({ labels = {}, scene }) {
|
|
|
21
23
|
return (anchors.length === keys.length &&
|
|
22
24
|
Arr.every(anchors, (anchor) => Arr.contains(keys, anchor)));
|
|
23
25
|
}
|
|
26
|
+
/** The most visible characters a label anchored in the scene shows (`visibleLength`). */
|
|
27
|
+
export const LABEL_CHARACTERS = 32;
|
|
28
|
+
/** The rich labels of a scene, decoded, with the scene that anchors them. */
|
|
29
|
+
const RichSceneSchema = Schema.Struct({
|
|
30
|
+
labels: Schema.optionalKey(Schema.Record(Schema.String, RichTextSchema)),
|
|
31
|
+
scene: MathVisualSchema,
|
|
32
|
+
});
|
|
33
|
+
/**
|
|
34
|
+
* Guardrail G7: a label anchored in the scene shows at most `LABEL_CHARACTERS`
|
|
35
|
+
* visible characters, so it names its object without covering the figure. The
|
|
36
|
+
* labels of readouts and sliders stand outside the scene and may say more.
|
|
37
|
+
*/
|
|
38
|
+
function longSceneLabels({ labels = {}, scene, }) {
|
|
39
|
+
const anchored = Arr.dedupe(Arr.map(scene.labels ?? [], ({ key }) => key));
|
|
40
|
+
return Arr.flatMap(anchored, (key) => Rec.get(labels, key).pipe(Option.map(visibleLength), Option.filter((length) => length > LABEL_CHARACTERS), Option.match({
|
|
41
|
+
onNone: () => [],
|
|
42
|
+
onSome: (length) => [
|
|
43
|
+
{
|
|
44
|
+
issue: `Expected a scene label of at most ${LABEL_CHARACTERS} visible characters, so it names its object without covering the figure; this one shows ${length}. Leave the rest to the card's words.`,
|
|
45
|
+
path: ["labels", key],
|
|
46
|
+
},
|
|
47
|
+
],
|
|
48
|
+
})));
|
|
49
|
+
}
|
|
24
50
|
/** Props of `MathVisual`: a plane or space scene and the rich labels it anchors. */
|
|
25
51
|
function mathVisual(rich) {
|
|
26
52
|
return Schema.Struct({
|
|
27
53
|
...cardFields(rich),
|
|
28
54
|
labels: Schema.optionalKey(Schema.Record(MathVisualKeySchema, rich)),
|
|
29
55
|
scene: MathVisualSchema,
|
|
30
|
-
})
|
|
56
|
+
})
|
|
57
|
+
.check(Schema.makeFilter(hasSceneLabels, {
|
|
31
58
|
message: "Expected one rich label for each label anchor of the scene.",
|
|
32
|
-
}))
|
|
59
|
+
}))
|
|
60
|
+
.check(Schema.makeFilter(longSceneLabels));
|
|
33
61
|
}
|
|
34
62
|
/**
|
|
35
63
|
* Reads the answer state of a scene: every object drawn in the `answer`
|
|
@@ -1,9 +1,76 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
|
-
import {
|
|
2
|
+
import type { RichSlot } from "#contracts/visual/card";
|
|
3
3
|
/** The media components: a diagram from its source and an embedded video. */
|
|
4
4
|
export declare function mediaVisuals<E>(rich: RichSlot<E>): {
|
|
5
5
|
Mermaid: import("#contracts/visual/entry").VisualEntry<Schema.Struct<{
|
|
6
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>>;
|
|
7
74
|
readonly title: RichSlot<E>;
|
|
8
75
|
readonly chart: Schema.String;
|
|
9
76
|
}>, "figure">;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
|
-
import {
|
|
2
|
+
import type { RichSlot } from "#contracts/visual/card";
|
|
3
3
|
/**
|
|
4
4
|
* The props of the bacteria labs. No prop states the conclusion a lab leads to,
|
|
5
5
|
* so none holds answer state.
|
|
@@ -7,6 +7,73 @@ import { type RichSlot } from "#contracts/visual/card";
|
|
|
7
7
|
export declare function bacteriaVisuals<E>(rich: RichSlot<E>): {
|
|
8
8
|
BinaryFissionLab: import("#contracts/visual/entry").VisualEntry<Schema.Struct<{
|
|
9
9
|
readonly description: RichSlot<E>;
|
|
10
|
+
readonly footer: Schema.optionalKey<Schema.Codec<readonly [{
|
|
11
|
+
readonly attrs: {
|
|
12
|
+
readonly latex: string;
|
|
13
|
+
};
|
|
14
|
+
readonly type: "mathInline";
|
|
15
|
+
} | {
|
|
16
|
+
readonly marks?: readonly [{
|
|
17
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
18
|
+
} | {
|
|
19
|
+
readonly attrs: {
|
|
20
|
+
readonly href: string;
|
|
21
|
+
};
|
|
22
|
+
readonly type: "link";
|
|
23
|
+
} | {
|
|
24
|
+
readonly attrs: {
|
|
25
|
+
readonly variant: "success" | "warning" | null;
|
|
26
|
+
};
|
|
27
|
+
readonly type: "highlight";
|
|
28
|
+
}, ...({
|
|
29
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
30
|
+
} | {
|
|
31
|
+
readonly attrs: {
|
|
32
|
+
readonly href: string;
|
|
33
|
+
};
|
|
34
|
+
readonly type: "link";
|
|
35
|
+
} | {
|
|
36
|
+
readonly attrs: {
|
|
37
|
+
readonly variant: "success" | "warning" | null;
|
|
38
|
+
};
|
|
39
|
+
readonly type: "highlight";
|
|
40
|
+
})[]];
|
|
41
|
+
readonly text: string;
|
|
42
|
+
readonly type: "text";
|
|
43
|
+
}, ...({
|
|
44
|
+
readonly attrs: {
|
|
45
|
+
readonly latex: string;
|
|
46
|
+
};
|
|
47
|
+
readonly type: "mathInline";
|
|
48
|
+
} | {
|
|
49
|
+
readonly marks?: readonly [{
|
|
50
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
51
|
+
} | {
|
|
52
|
+
readonly attrs: {
|
|
53
|
+
readonly href: string;
|
|
54
|
+
};
|
|
55
|
+
readonly type: "link";
|
|
56
|
+
} | {
|
|
57
|
+
readonly attrs: {
|
|
58
|
+
readonly variant: "success" | "warning" | null;
|
|
59
|
+
};
|
|
60
|
+
readonly type: "highlight";
|
|
61
|
+
}, ...({
|
|
62
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
63
|
+
} | {
|
|
64
|
+
readonly attrs: {
|
|
65
|
+
readonly href: string;
|
|
66
|
+
};
|
|
67
|
+
readonly type: "link";
|
|
68
|
+
} | {
|
|
69
|
+
readonly attrs: {
|
|
70
|
+
readonly variant: "success" | "warning" | null;
|
|
71
|
+
};
|
|
72
|
+
readonly type: "highlight";
|
|
73
|
+
})[]];
|
|
74
|
+
readonly text: string;
|
|
75
|
+
readonly type: "text";
|
|
76
|
+
})[]], E, never, never>>;
|
|
10
77
|
readonly title: RichSlot<E>;
|
|
11
78
|
readonly labels: Schema.Struct<{
|
|
12
79
|
readonly cells: RichSlot<E>;
|
|
@@ -17,6 +84,73 @@ export declare function bacteriaVisuals<E>(rich: RichSlot<E>): {
|
|
|
17
84
|
}>, "figure">;
|
|
18
85
|
ChemotaxisLab: import("#contracts/visual/entry").VisualEntry<Schema.Struct<{
|
|
19
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>>;
|
|
20
154
|
readonly title: RichSlot<E>;
|
|
21
155
|
readonly labels: Schema.Struct<{
|
|
22
156
|
readonly elapsed: RichSlot<E>;
|
|
@@ -27,6 +161,73 @@ export declare function bacteriaVisuals<E>(rich: RichSlot<E>): {
|
|
|
27
161
|
}>, "figure">;
|
|
28
162
|
GramStainLab: import("#contracts/visual/entry").VisualEntry<Schema.Struct<{
|
|
29
163
|
readonly description: RichSlot<E>;
|
|
164
|
+
readonly footer: Schema.optionalKey<Schema.Codec<readonly [{
|
|
165
|
+
readonly attrs: {
|
|
166
|
+
readonly latex: string;
|
|
167
|
+
};
|
|
168
|
+
readonly type: "mathInline";
|
|
169
|
+
} | {
|
|
170
|
+
readonly marks?: readonly [{
|
|
171
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
172
|
+
} | {
|
|
173
|
+
readonly attrs: {
|
|
174
|
+
readonly href: string;
|
|
175
|
+
};
|
|
176
|
+
readonly type: "link";
|
|
177
|
+
} | {
|
|
178
|
+
readonly attrs: {
|
|
179
|
+
readonly variant: "success" | "warning" | null;
|
|
180
|
+
};
|
|
181
|
+
readonly type: "highlight";
|
|
182
|
+
}, ...({
|
|
183
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
184
|
+
} | {
|
|
185
|
+
readonly attrs: {
|
|
186
|
+
readonly href: string;
|
|
187
|
+
};
|
|
188
|
+
readonly type: "link";
|
|
189
|
+
} | {
|
|
190
|
+
readonly attrs: {
|
|
191
|
+
readonly variant: "success" | "warning" | null;
|
|
192
|
+
};
|
|
193
|
+
readonly type: "highlight";
|
|
194
|
+
})[]];
|
|
195
|
+
readonly text: string;
|
|
196
|
+
readonly type: "text";
|
|
197
|
+
}, ...({
|
|
198
|
+
readonly attrs: {
|
|
199
|
+
readonly latex: string;
|
|
200
|
+
};
|
|
201
|
+
readonly type: "mathInline";
|
|
202
|
+
} | {
|
|
203
|
+
readonly marks?: readonly [{
|
|
204
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
205
|
+
} | {
|
|
206
|
+
readonly attrs: {
|
|
207
|
+
readonly href: string;
|
|
208
|
+
};
|
|
209
|
+
readonly type: "link";
|
|
210
|
+
} | {
|
|
211
|
+
readonly attrs: {
|
|
212
|
+
readonly variant: "success" | "warning" | null;
|
|
213
|
+
};
|
|
214
|
+
readonly type: "highlight";
|
|
215
|
+
}, ...({
|
|
216
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
217
|
+
} | {
|
|
218
|
+
readonly attrs: {
|
|
219
|
+
readonly href: string;
|
|
220
|
+
};
|
|
221
|
+
readonly type: "link";
|
|
222
|
+
} | {
|
|
223
|
+
readonly attrs: {
|
|
224
|
+
readonly variant: "success" | "warning" | null;
|
|
225
|
+
};
|
|
226
|
+
readonly type: "highlight";
|
|
227
|
+
})[]];
|
|
228
|
+
readonly text: string;
|
|
229
|
+
readonly type: "text";
|
|
230
|
+
})[]], E, never, never>>;
|
|
30
231
|
readonly title: RichSlot<E>;
|
|
31
232
|
readonly labels: Schema.Struct<{
|
|
32
233
|
readonly chooseStep: Schema.Trimmed;
|
|
@@ -39,6 +240,73 @@ export declare function bacteriaVisuals<E>(rich: RichSlot<E>): {
|
|
|
39
240
|
}>, "figure">;
|
|
40
241
|
YogurtLab: import("#contracts/visual/entry").VisualEntry<Schema.Struct<{
|
|
41
242
|
readonly description: RichSlot<E>;
|
|
243
|
+
readonly footer: Schema.optionalKey<Schema.Codec<readonly [{
|
|
244
|
+
readonly attrs: {
|
|
245
|
+
readonly latex: string;
|
|
246
|
+
};
|
|
247
|
+
readonly type: "mathInline";
|
|
248
|
+
} | {
|
|
249
|
+
readonly marks?: readonly [{
|
|
250
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
251
|
+
} | {
|
|
252
|
+
readonly attrs: {
|
|
253
|
+
readonly href: string;
|
|
254
|
+
};
|
|
255
|
+
readonly type: "link";
|
|
256
|
+
} | {
|
|
257
|
+
readonly attrs: {
|
|
258
|
+
readonly variant: "success" | "warning" | null;
|
|
259
|
+
};
|
|
260
|
+
readonly type: "highlight";
|
|
261
|
+
}, ...({
|
|
262
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
263
|
+
} | {
|
|
264
|
+
readonly attrs: {
|
|
265
|
+
readonly href: string;
|
|
266
|
+
};
|
|
267
|
+
readonly type: "link";
|
|
268
|
+
} | {
|
|
269
|
+
readonly attrs: {
|
|
270
|
+
readonly variant: "success" | "warning" | null;
|
|
271
|
+
};
|
|
272
|
+
readonly type: "highlight";
|
|
273
|
+
})[]];
|
|
274
|
+
readonly text: string;
|
|
275
|
+
readonly type: "text";
|
|
276
|
+
}, ...({
|
|
277
|
+
readonly attrs: {
|
|
278
|
+
readonly latex: string;
|
|
279
|
+
};
|
|
280
|
+
readonly type: "mathInline";
|
|
281
|
+
} | {
|
|
282
|
+
readonly marks?: readonly [{
|
|
283
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
284
|
+
} | {
|
|
285
|
+
readonly attrs: {
|
|
286
|
+
readonly href: string;
|
|
287
|
+
};
|
|
288
|
+
readonly type: "link";
|
|
289
|
+
} | {
|
|
290
|
+
readonly attrs: {
|
|
291
|
+
readonly variant: "success" | "warning" | null;
|
|
292
|
+
};
|
|
293
|
+
readonly type: "highlight";
|
|
294
|
+
}, ...({
|
|
295
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
296
|
+
} | {
|
|
297
|
+
readonly attrs: {
|
|
298
|
+
readonly href: string;
|
|
299
|
+
};
|
|
300
|
+
readonly type: "link";
|
|
301
|
+
} | {
|
|
302
|
+
readonly attrs: {
|
|
303
|
+
readonly variant: "success" | "warning" | null;
|
|
304
|
+
};
|
|
305
|
+
readonly type: "highlight";
|
|
306
|
+
})[]];
|
|
307
|
+
readonly text: string;
|
|
308
|
+
readonly type: "text";
|
|
309
|
+
})[]], E, never, never>>;
|
|
42
310
|
readonly title: RichSlot<E>;
|
|
43
311
|
readonly labels: Schema.Struct<{
|
|
44
312
|
readonly hours: Schema.Trimmed;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
|
-
import { byIds, cardFields, TextSchema
|
|
2
|
+
import { byIds, cardFields, TextSchema } from "#contracts/visual/card";
|
|
3
3
|
import { figure } from "#contracts/visual/entry";
|
|
4
4
|
/**
|
|
5
5
|
* Props of `BinaryFissionLab`: one cell of Escherichia coli on agar becomes a
|