@nakafa/aksara-contracts 8.8.0 → 8.10.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/answer.d.ts +2 -0
- package/dist/assessment/answer.js +5 -3
- package/dist/assessment/choice.d.ts +26 -0
- package/dist/assessment/closure.js +2 -1
- package/dist/assessment/document.d.ts +39 -0
- package/dist/assessment/figure.d.ts +13 -0
- 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 +777 -109
- package/dist/assessment/inline.d.ts +53 -0
- package/dist/assessment/inline.js +1 -0
- package/dist/assessment/interaction.d.ts +44 -1
- package/dist/assessment/interaction.js +2 -1
- package/dist/assessment/item.d.ts +500 -37
- 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 +1006 -90
- package/dist/assessment/part.d.ts +13 -0
- package/dist/assessment/profile.d.ts +3 -3
- package/dist/assessment/profile.js +4 -4
- package/dist/assessment/rows.d.ts +621 -39
- 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 +1479 -91
- package/dist/assessment/structure.js +4 -4
- package/dist/release/snapshot/data.d.ts +114 -2
- package/dist/release/snapshot/verify.d.ts +621 -39
- package/dist/transport/group.d.ts +342 -6
- package/dist/transport/request.d.ts +4032 -316
- package/dist/transport/snapshot.d.ts +228 -4
- package/dist/visual/base/math.d.ts +56 -6
- package/dist/visual/base/media.d.ts +56 -6
- package/dist/visual/biology/bacteria.d.ts +224 -24
- package/dist/visual/biology/blood.d.ts +56 -6
- package/dist/visual/biology/cell.d.ts +168 -18
- package/dist/visual/biology/climate.d.ts +168 -18
- package/dist/visual/biology/ecology.d.ts +224 -24
- package/dist/visual/biology/heart.d.ts +56 -6
- package/dist/visual/biology/mitochondrion.d.ts +56 -6
- package/dist/visual/biology/muscle.d.ts +56 -6
- package/dist/visual/biology/neuron.d.ts +56 -6
- package/dist/visual/biology/paddy.d.ts +56 -6
- package/dist/visual/biology/physiology.d.ts +168 -18
- package/dist/visual/biology/plant.d.ts +280 -30
- package/dist/visual/biology/synapse.d.ts +56 -6
- package/dist/visual/biology/vessel.d.ts +56 -6
- package/dist/visual/biology/yeast.d.ts +56 -6
- package/dist/visual/card.d.ts +56 -6
- package/dist/visual/catalog.d.ts +16734 -5484
- package/dist/visual/chemistry/atom.d.ts +168 -18
- package/dist/visual/chemistry/balance.d.ts +280 -30
- package/dist/visual/chemistry/bonding.d.ts +280 -30
- package/dist/visual/chemistry/discovery.d.ts +392 -42
- package/dist/visual/chemistry/electrochemistry.d.ts +112 -12
- package/dist/visual/chemistry/electron.d.ts +112 -12
- package/dist/visual/chemistry/laws.d.ts +224 -24
- package/dist/visual/chemistry/particles.d.ts +280 -30
- package/dist/visual/chemistry/periodic.d.ts +112 -12
- package/dist/visual/chemistry/rate.d.ts +56 -6
- package/dist/visual/chemistry/reaction.d.ts +168 -18
- package/dist/visual/chemistry/titration.d.ts +56 -6
- package/dist/visual/length.d.ts +56 -6
- package/dist/visual/mathematics/chance.d.ts +168 -18
- package/dist/visual/mathematics/chart.d.ts +56 -6
- package/dist/visual/mathematics/charts.d.ts +280 -30
- package/dist/visual/mathematics/function.d.ts +168 -18
- package/dist/visual/mathematics/journey.d.ts +56 -6
- package/dist/visual/mathematics/logic.d.ts +56 -6
- package/dist/visual/mathematics/network.d.ts +56 -6
- package/dist/visual/mathematics/numeral.d.ts +168 -18
- package/dist/visual/mathematics/sets.d.ts +56 -6
- package/dist/visual/physics/braking.d.ts +224 -24
- package/dist/visual/physics/circuit.d.ts +224 -24
- package/dist/visual/physics/circular.d.ts +112 -12
- package/dist/visual/physics/dynamics.d.ts +392 -42
- package/dist/visual/physics/efficiency.d.ts +336 -36
- package/dist/visual/physics/electronics.d.ts +168 -18
- package/dist/visual/physics/falling.d.ts +224 -24
- package/dist/visual/physics/field.d.ts +168 -18
- package/dist/visual/physics/fluid.d.ts +224 -24
- package/dist/visual/physics/force.d.ts +280 -30
- package/dist/visual/physics/gravity.d.ts +112 -12
- package/dist/visual/physics/heat.d.ts +168 -18
- package/dist/visual/physics/instrument.d.ts +392 -42
- package/dist/visual/physics/light.d.ts +224 -24
- package/dist/visual/physics/measurement.d.ts +224 -24
- package/dist/visual/physics/motion.d.ts +336 -36
- package/dist/visual/physics/nuclear.d.ts +168 -18
- package/dist/visual/physics/parabolic.d.ts +56 -6
- package/dist/visual/physics/position.d.ts +336 -36
- package/dist/visual/physics/power.d.ts +448 -48
- package/dist/visual/physics/precision.d.ts +392 -42
- package/dist/visual/physics/product.d.ts +224 -24
- package/dist/visual/physics/reading.d.ts +168 -18
- package/dist/visual/physics/record.d.ts +112 -12
- package/dist/visual/physics/relative.d.ts +168 -18
- package/dist/visual/physics/solar.d.ts +336 -36
- package/dist/visual/physics/thermodynamics.d.ts +56 -6
- package/dist/visual/physics/vector.d.ts +280 -30
- package/dist/visual/physics/velocity.d.ts +392 -42
- package/dist/visual/physics/wave.d.ts +224 -24
- package/dist/visual/politics.d.ts +336 -36
- package/package.json +2 -2
|
@@ -8,6 +8,8 @@ import { BigDecimal, Option, Schema } from "effect";
|
|
|
8
8
|
*/
|
|
9
9
|
export declare const DecimalSchema: Schema.String;
|
|
10
10
|
export type Decimal = typeof DecimalSchema.Type;
|
|
11
|
+
/** One canonical decimal strictly greater than zero, such as a tolerance. */
|
|
12
|
+
export declare const PositiveDecimalSchema: Schema.String;
|
|
11
13
|
/**
|
|
12
14
|
* Largest accepted distance from the exact value, inclusive. An absolute
|
|
13
15
|
* tolerance `t` accepts `|answer - value| <= t`. A relative tolerance `r`
|
|
@@ -27,6 +27,10 @@ export const DecimalSchema = Schema.String.check(Schema.isPattern(DECIMAL_PATTER
|
|
|
27
27
|
function isPositiveDecimal(value) {
|
|
28
28
|
return value !== "0" && !value.startsWith("-");
|
|
29
29
|
}
|
|
30
|
+
/** One canonical decimal strictly greater than zero, such as a tolerance. */
|
|
31
|
+
export const PositiveDecimalSchema = DecimalSchema.check(Schema.makeFilter(isPositiveDecimal, {
|
|
32
|
+
message: "Expected a positive tolerance.",
|
|
33
|
+
}));
|
|
30
34
|
/**
|
|
31
35
|
* Largest accepted distance from the exact value, inclusive. An absolute
|
|
32
36
|
* tolerance `t` accepts `|answer - value| <= t`. A relative tolerance `r`
|
|
@@ -35,9 +39,7 @@ function isPositiveDecimal(value) {
|
|
|
35
39
|
*/
|
|
36
40
|
export const ToleranceSchema = Schema.Struct({
|
|
37
41
|
kind: Schema.Literals(["absolute", "relative"]),
|
|
38
|
-
value:
|
|
39
|
-
message: "Expected a positive tolerance.",
|
|
40
|
-
})),
|
|
42
|
+
value: PositiveDecimalSchema,
|
|
41
43
|
}).check(Schema.makeFilter(({ kind, value }) => kind === "absolute" || value.startsWith("0."), { message: "Expected a relative tolerance below one." }));
|
|
42
44
|
/**
|
|
43
45
|
* Deterministic numeric answer key. A learner number, read by
|
|
@@ -116,6 +116,19 @@ export declare const InlineChoiceInteractionSchema: Schema.Struct<{
|
|
|
116
116
|
readonly attrs: Schema.Struct<{
|
|
117
117
|
readonly latex: Schema.Trimmed;
|
|
118
118
|
}>;
|
|
119
|
+
readonly marks: Schema.optionalKey<Schema.NonEmptyArray<Schema.Union<readonly [Schema.Struct<{
|
|
120
|
+
readonly type: Schema.Literals<readonly ["bold", "italic", "underline", "code", "subscript", "superscript"]>;
|
|
121
|
+
}>, Schema.Struct<{
|
|
122
|
+
readonly attrs: Schema.Struct<{
|
|
123
|
+
readonly variant: Schema.NullOr<Schema.Literals<readonly ["success", "warning"]>>;
|
|
124
|
+
}>;
|
|
125
|
+
readonly type: Schema.Literal<"highlight">;
|
|
126
|
+
}>, Schema.Struct<{
|
|
127
|
+
readonly attrs: Schema.Struct<{
|
|
128
|
+
readonly href: Schema.String;
|
|
129
|
+
}>;
|
|
130
|
+
readonly type: Schema.Literal<"link">;
|
|
131
|
+
}>]>>>;
|
|
119
132
|
readonly type: Schema.Literal<"mathInline">;
|
|
120
133
|
}>]>>;
|
|
121
134
|
}>>;
|
|
@@ -152,6 +165,19 @@ export declare const GapMatchInteractionSchema: Schema.Struct<{
|
|
|
152
165
|
readonly attrs: Schema.Struct<{
|
|
153
166
|
readonly latex: Schema.Trimmed;
|
|
154
167
|
}>;
|
|
168
|
+
readonly marks: Schema.optionalKey<Schema.NonEmptyArray<Schema.Union<readonly [Schema.Struct<{
|
|
169
|
+
readonly type: Schema.Literals<readonly ["bold", "italic", "underline", "code", "subscript", "superscript"]>;
|
|
170
|
+
}>, Schema.Struct<{
|
|
171
|
+
readonly attrs: Schema.Struct<{
|
|
172
|
+
readonly variant: Schema.NullOr<Schema.Literals<readonly ["success", "warning"]>>;
|
|
173
|
+
}>;
|
|
174
|
+
readonly type: Schema.Literal<"highlight">;
|
|
175
|
+
}>, Schema.Struct<{
|
|
176
|
+
readonly attrs: Schema.Struct<{
|
|
177
|
+
readonly href: Schema.String;
|
|
178
|
+
}>;
|
|
179
|
+
readonly type: Schema.Literal<"link">;
|
|
180
|
+
}>]>>>;
|
|
155
181
|
readonly type: Schema.Literal<"mathInline">;
|
|
156
182
|
}>]>>;
|
|
157
183
|
readonly maxMatches: Schema.Int;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Array as Arr, Effect, HashMap, HashSet, Option, Result, Schema, Stream, } from "effect";
|
|
2
|
+
import { hasKeyedRubrics } from "#contracts/assessment/fit";
|
|
2
3
|
import { catalogLocaleBreach } from "#contracts/assessment/locales";
|
|
3
4
|
import { verifyPaperPlaces, verifyPaperStimuli, } from "#contracts/assessment/paper";
|
|
4
5
|
import { explanationIdentity, indexRows, placedHashes, stimulusIdentity, } from "#contracts/assessment/rows";
|
|
@@ -81,7 +82,7 @@ const verifyItems = Effect.fn("AksaraContracts.verifyAssessmentItems")(function*
|
|
|
81
82
|
yield* require(Option.exists(family, ({ stimulus }) => stimulus === version.stimulus?.id), "family", version.family);
|
|
82
83
|
yield* require(version.stimulus === undefined ||
|
|
83
84
|
HashSet.has(rows.stimuli, stimulusIdentity(version.stimulus)), "stimulus", version.family);
|
|
84
|
-
yield* require(HashMap.
|
|
85
|
+
yield* require(Option.exists(HashMap.get(rows.keys, version.hash), (key) => hasKeyedRubrics(version, key)), "key", version.hash);
|
|
85
86
|
yield* require(HashSet.has(placed, version.hash), "unplaced", version.hash);
|
|
86
87
|
}
|
|
87
88
|
for (const identity of requiredExplanations(rows)) {
|
|
@@ -32,6 +32,19 @@ declare const ParagraphSchema: Schema.Struct<{
|
|
|
32
32
|
readonly attrs: Schema.Struct<{
|
|
33
33
|
readonly latex: Schema.Trimmed;
|
|
34
34
|
}>;
|
|
35
|
+
readonly marks: Schema.optionalKey<Schema.NonEmptyArray<Schema.Union<readonly [Schema.Struct<{
|
|
36
|
+
readonly type: Schema.Literals<readonly ["bold", "italic", "underline", "code", "subscript", "superscript"]>;
|
|
37
|
+
}>, Schema.Struct<{
|
|
38
|
+
readonly attrs: Schema.Struct<{
|
|
39
|
+
readonly variant: Schema.NullOr<Schema.Literals<readonly ["success", "warning"]>>;
|
|
40
|
+
}>;
|
|
41
|
+
readonly type: Schema.Literal<"highlight">;
|
|
42
|
+
}>, Schema.Struct<{
|
|
43
|
+
readonly attrs: Schema.Struct<{
|
|
44
|
+
readonly href: Schema.String;
|
|
45
|
+
}>;
|
|
46
|
+
readonly type: Schema.Literal<"link">;
|
|
47
|
+
}>]>>>;
|
|
35
48
|
readonly type: Schema.Literal<"mathInline">;
|
|
36
49
|
}>, Schema.Struct<{
|
|
37
50
|
readonly type: Schema.Literal<"hardBreak">;
|
|
@@ -69,6 +82,19 @@ declare const HeadingSchema: Schema.Struct<{
|
|
|
69
82
|
readonly attrs: Schema.Struct<{
|
|
70
83
|
readonly latex: Schema.Trimmed;
|
|
71
84
|
}>;
|
|
85
|
+
readonly marks: Schema.optionalKey<Schema.NonEmptyArray<Schema.Union<readonly [Schema.Struct<{
|
|
86
|
+
readonly type: Schema.Literals<readonly ["bold", "italic", "underline", "code", "subscript", "superscript"]>;
|
|
87
|
+
}>, Schema.Struct<{
|
|
88
|
+
readonly attrs: Schema.Struct<{
|
|
89
|
+
readonly variant: Schema.NullOr<Schema.Literals<readonly ["success", "warning"]>>;
|
|
90
|
+
}>;
|
|
91
|
+
readonly type: Schema.Literal<"highlight">;
|
|
92
|
+
}>, Schema.Struct<{
|
|
93
|
+
readonly attrs: Schema.Struct<{
|
|
94
|
+
readonly href: Schema.String;
|
|
95
|
+
}>;
|
|
96
|
+
readonly type: Schema.Literal<"link">;
|
|
97
|
+
}>]>>>;
|
|
72
98
|
readonly type: Schema.Literal<"mathInline">;
|
|
73
99
|
}>, Schema.Struct<{
|
|
74
100
|
readonly type: Schema.Literal<"hardBreak">;
|
|
@@ -168,6 +194,19 @@ declare const ListItemSchema: Schema.Struct<{
|
|
|
168
194
|
readonly attrs: Schema.Struct<{
|
|
169
195
|
readonly latex: Schema.Trimmed;
|
|
170
196
|
}>;
|
|
197
|
+
readonly marks: Schema.optionalKey<Schema.NonEmptyArray<Schema.Union<readonly [Schema.Struct<{
|
|
198
|
+
readonly type: Schema.Literals<readonly ["bold", "italic", "underline", "code", "subscript", "superscript"]>;
|
|
199
|
+
}>, Schema.Struct<{
|
|
200
|
+
readonly attrs: Schema.Struct<{
|
|
201
|
+
readonly variant: Schema.NullOr<Schema.Literals<readonly ["success", "warning"]>>;
|
|
202
|
+
}>;
|
|
203
|
+
readonly type: Schema.Literal<"highlight">;
|
|
204
|
+
}>, Schema.Struct<{
|
|
205
|
+
readonly attrs: Schema.Struct<{
|
|
206
|
+
readonly href: Schema.String;
|
|
207
|
+
}>;
|
|
208
|
+
readonly type: Schema.Literal<"link">;
|
|
209
|
+
}>]>>>;
|
|
171
210
|
readonly type: Schema.Literal<"mathInline">;
|
|
172
211
|
}>, Schema.Struct<{
|
|
173
212
|
readonly type: Schema.Literal<"hardBreak">;
|
|
@@ -38,6 +38,19 @@ declare const FigureFields: {
|
|
|
38
38
|
readonly attrs: Schema.Struct<{
|
|
39
39
|
readonly latex: Schema.Trimmed;
|
|
40
40
|
}>;
|
|
41
|
+
readonly marks: Schema.optionalKey<Schema.NonEmptyArray<Schema.Union<readonly [Schema.Struct<{
|
|
42
|
+
readonly type: Schema.Literals<readonly ["bold", "italic", "underline", "code", "subscript", "superscript"]>;
|
|
43
|
+
}>, Schema.Struct<{
|
|
44
|
+
readonly attrs: Schema.Struct<{
|
|
45
|
+
readonly variant: Schema.NullOr<Schema.Literals<readonly ["success", "warning"]>>;
|
|
46
|
+
}>;
|
|
47
|
+
readonly type: Schema.Literal<"highlight">;
|
|
48
|
+
}>, Schema.Struct<{
|
|
49
|
+
readonly attrs: Schema.Struct<{
|
|
50
|
+
readonly href: Schema.String;
|
|
51
|
+
}>;
|
|
52
|
+
readonly type: Schema.Literal<"link">;
|
|
53
|
+
}>]>>>;
|
|
41
54
|
readonly type: Schema.Literal<"mathInline">;
|
|
42
55
|
}>]>>>;
|
|
43
56
|
};
|
package/dist/assessment/fit.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { AssessmentDocument } from "#contracts/assessment/document";
|
|
2
2
|
import type { Interaction } from "#contracts/assessment/interaction";
|
|
3
|
+
import type { InteractionKey } from "#contracts/assessment/key";
|
|
3
4
|
import type { ScoringOverride } from "#contracts/assessment/scoring";
|
|
4
5
|
/**
|
|
5
6
|
* Checks that the interactions of a version and its prompt agree: each
|
|
@@ -12,10 +13,23 @@ export declare function hasPlacedInteractions(version: {
|
|
|
12
13
|
}): boolean;
|
|
13
14
|
/**
|
|
14
15
|
* Checks the scoring rules that a version sets itself: each names one of its
|
|
15
|
-
* interactions once, and fits its kind. An extended text
|
|
16
|
-
* must carry its rubric.
|
|
16
|
+
* interactions once, and fits its kind. An extended text and a sketch have no
|
|
17
|
+
* default, so each must carry its rubric.
|
|
17
18
|
*/
|
|
18
19
|
export declare function hasFittingRules(version: {
|
|
19
20
|
readonly interactions: readonly Interaction[];
|
|
20
21
|
readonly scoring: readonly ScoringOverride[];
|
|
21
22
|
}): boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Checks that a version's key and its rubrics meet: the key answers every
|
|
25
|
+
* sketch of the version, and each sketch it answers is scored by a rubric of
|
|
26
|
+
* the version with exactly the key's criteria, so no feature is worth no points
|
|
27
|
+
* and no points go unchecked. It is the check where a key and its version's
|
|
28
|
+
* scoring meet, so it needs both records.
|
|
29
|
+
*/
|
|
30
|
+
export declare function hasKeyedRubrics(version: {
|
|
31
|
+
readonly interactions: readonly Interaction[];
|
|
32
|
+
readonly scoring: readonly ScoringOverride[];
|
|
33
|
+
}, key: {
|
|
34
|
+
readonly answers: readonly InteractionKey[];
|
|
35
|
+
}): boolean;
|
package/dist/assessment/fit.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Array as Arr, HashSet } from "effect";
|
|
1
|
+
import { Array as Arr, Equal, HashSet } from "effect";
|
|
2
2
|
import { documentPlacements } from "#contracts/assessment/document";
|
|
3
3
|
import { hasDistinctIds, hasUniqueIds } from "#contracts/assessment/identity";
|
|
4
4
|
import { canSitInText } from "#contracts/assessment/interaction";
|
|
5
|
-
import { supportsRule } from "#contracts/assessment/scoring";
|
|
5
|
+
import { supportsRule, takesRubric } from "#contracts/assessment/scoring";
|
|
6
6
|
/**
|
|
7
7
|
* Checks that the prompt places one interaction where its kind belongs: a
|
|
8
8
|
* field exactly once, in text or as a block; a gap match once for each gap, in
|
|
@@ -32,11 +32,29 @@ export function hasPlacedInteractions(version) {
|
|
|
32
32
|
}
|
|
33
33
|
/**
|
|
34
34
|
* Checks the scoring rules that a version sets itself: each names one of its
|
|
35
|
-
* interactions once, and fits its kind. An extended text
|
|
36
|
-
* must carry its rubric.
|
|
35
|
+
* interactions once, and fits its kind. An extended text and a sketch have no
|
|
36
|
+
* default, so each must carry its rubric.
|
|
37
37
|
*/
|
|
38
38
|
export function hasFittingRules(version) {
|
|
39
39
|
return (hasDistinctIds(Arr.map(version.scoring, ({ interaction }) => interaction)) &&
|
|
40
40
|
Arr.every(version.scoring, ({ interaction, rule }) => Arr.some(version.interactions, (candidate) => candidate.id === interaction && supportsRule(candidate.kind, rule))) &&
|
|
41
|
-
Arr.every(Arr.filter(version.interactions, ({ kind }) => kind
|
|
41
|
+
Arr.every(Arr.filter(version.interactions, ({ kind }) => takesRubric(kind)), ({ id }) => Arr.some(version.scoring, ({ interaction, rule }) => interaction === id && rule.kind === "rubric")));
|
|
42
|
+
}
|
|
43
|
+
/** Checks that two lists name the same identifiers, in any order. */
|
|
44
|
+
function sameIds(left, right) {
|
|
45
|
+
return Equal.equals(HashSet.fromIterable(left), HashSet.fromIterable(right));
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Checks that a version's key and its rubrics meet: the key answers every
|
|
49
|
+
* sketch of the version, and each sketch it answers is scored by a rubric of
|
|
50
|
+
* the version with exactly the key's criteria, so no feature is worth no points
|
|
51
|
+
* and no points go unchecked. It is the check where a key and its version's
|
|
52
|
+
* scoring meet, so it needs both records.
|
|
53
|
+
*/
|
|
54
|
+
export function hasKeyedRubrics(version, key) {
|
|
55
|
+
return (Arr.every(Arr.filter(version.interactions, ({ kind }) => kind === "sketch"), ({ id }) => Arr.some(key.answers, (answer) => answer.kind === "sketch" && answer.interaction === id)) &&
|
|
56
|
+
Arr.every(key.answers, (answer) => answer.kind !== "sketch" ||
|
|
57
|
+
Arr.some(version.scoring, ({ interaction, rule }) => interaction === answer.interaction &&
|
|
58
|
+
rule.kind === "rubric" &&
|
|
59
|
+
sameIds(Arr.map(rule.criteria, ({ id }) => id), Arr.map(answer.criteria, ({ criterion }) => criterion)))));
|
|
42
60
|
}
|
|
@@ -93,3 +93,30 @@ export declare const GraphPointInteractionSchema: Schema.Struct<{
|
|
|
93
93
|
readonly placing: Schema.Literals<readonly ["points", "lines"]>;
|
|
94
94
|
readonly snap: Schema.optionalKey<Schema.Finite>;
|
|
95
95
|
}>;
|
|
96
|
+
/**
|
|
97
|
+
* Sketch the graph of a function on a plane of Cartesian axes, in one stroke or
|
|
98
|
+
* more, and place what the item asks for besides: points, such as zeros,
|
|
99
|
+
* intercepts and turning points, and asymptotes as lines. `frame` is the view
|
|
100
|
+
* the plane opens on, and the learner may pan and zoom past it; `grid`, when
|
|
101
|
+
* present, is the step of its grid lines. The features the graph must show are
|
|
102
|
+
* in the key. QTI has no interaction for a drawn graph, so it maps to
|
|
103
|
+
* `qti-portable-custom-interaction`.
|
|
104
|
+
*/
|
|
105
|
+
export declare const SketchInteractionSchema: Schema.Struct<{
|
|
106
|
+
readonly id: Schema.String;
|
|
107
|
+
readonly label: Schema.Trimmed;
|
|
108
|
+
readonly frame: Schema.Struct<{
|
|
109
|
+
readonly kind: Schema.Literal<"cartesian">;
|
|
110
|
+
readonly x: Schema.Struct<{
|
|
111
|
+
readonly max: Schema.Finite;
|
|
112
|
+
readonly min: Schema.Finite;
|
|
113
|
+
}>;
|
|
114
|
+
readonly y: Schema.Struct<{
|
|
115
|
+
readonly max: Schema.Finite;
|
|
116
|
+
readonly min: Schema.Finite;
|
|
117
|
+
}>;
|
|
118
|
+
}>;
|
|
119
|
+
readonly grid: Schema.optionalKey<Schema.Finite>;
|
|
120
|
+
readonly kind: Schema.Literal<"sketch">;
|
|
121
|
+
readonly marks: Schema.$Array<Schema.Literals<readonly ["asymptote", "point"]>>;
|
|
122
|
+
}>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Schema } from "effect";
|
|
1
|
+
import { HashSet, Schema } from "effect";
|
|
2
2
|
import { ImageSchema } from "#contracts/assessment/figure";
|
|
3
3
|
import { hasUniqueIds, LocalIdSchema } from "#contracts/assessment/identity";
|
|
4
4
|
import { hasSelectionBounds, InteractionFields, } from "#contracts/assessment/part";
|
|
@@ -104,3 +104,19 @@ export const GraphPointInteractionSchema = Schema.Struct({
|
|
|
104
104
|
placing: Schema.Literals(["points", "lines"]),
|
|
105
105
|
snap: Schema.optionalKey(PositiveMeasureSchema),
|
|
106
106
|
});
|
|
107
|
+
/**
|
|
108
|
+
* Sketch the graph of a function on a plane of Cartesian axes, in one stroke or
|
|
109
|
+
* more, and place what the item asks for besides: points, such as zeros,
|
|
110
|
+
* intercepts and turning points, and asymptotes as lines. `frame` is the view
|
|
111
|
+
* the plane opens on, and the learner may pan and zoom past it; `grid`, when
|
|
112
|
+
* present, is the step of its grid lines. The features the graph must show are
|
|
113
|
+
* in the key. QTI has no interaction for a drawn graph, so it maps to
|
|
114
|
+
* `qti-portable-custom-interaction`.
|
|
115
|
+
*/
|
|
116
|
+
export const SketchInteractionSchema = Schema.Struct({
|
|
117
|
+
...InteractionFields,
|
|
118
|
+
frame: PlaneMathFrameSchema,
|
|
119
|
+
grid: Schema.optionalKey(PositiveMeasureSchema),
|
|
120
|
+
kind: Schema.Literal("sketch"),
|
|
121
|
+
marks: Schema.Array(Schema.Literals(["asymptote", "point"])).check(Schema.makeFilter((marks) => HashSet.size(HashSet.fromIterable(marks)) === marks.length, { message: "Expected each kind of mark once." })),
|
|
122
|
+
});
|