@mathscan/math-exercise-engine 1.0.8 → 1.0.10
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/index.d.ts +1384 -397
- package/dist/index.js +623 -16
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +623 -16
- package/dist/index.mjs.map +1 -1
- package/dist/style.css +238 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -35,6 +35,10 @@ export declare const AST_TYPES: {
|
|
|
35
35
|
readonly TABLE_ROW: "TableRow";
|
|
36
36
|
/** Cell within a table row */
|
|
37
37
|
readonly TABLE_CELL: "TableCell";
|
|
38
|
+
/** Number line layout block */
|
|
39
|
+
readonly NUMBER_LINE_BLOCK: "NumberLineBlock";
|
|
40
|
+
/** A position marker on the number line */
|
|
41
|
+
readonly NUMBER_LINE_POSITION: "NumberLinePosition";
|
|
38
42
|
/** Drag-and-drop options tool */
|
|
39
43
|
readonly DRAG_OPTIONS: "DragOptions";
|
|
40
44
|
/** Radio button options tool */
|
|
@@ -187,12 +191,6 @@ export declare function compile(dsl: string): ExerciseJSON;
|
|
|
187
191
|
*/
|
|
188
192
|
export declare function compileWithAST(dsl: string): {
|
|
189
193
|
ast: {
|
|
190
|
-
validation: {
|
|
191
|
-
type: "SimpleValidation";
|
|
192
|
-
} | {
|
|
193
|
-
expression: string;
|
|
194
|
-
type: "ExpressionValidation";
|
|
195
|
-
};
|
|
196
194
|
type: "ExerciseDocument";
|
|
197
195
|
lines: ({
|
|
198
196
|
type: "LineBlock";
|
|
@@ -227,6 +225,48 @@ export declare function compileWithAST(dsl: string): {
|
|
|
227
225
|
digits: number;
|
|
228
226
|
answer?: string | number | undefined;
|
|
229
227
|
})[];
|
|
228
|
+
} | {
|
|
229
|
+
type: "NumberLineBlock";
|
|
230
|
+
min: number;
|
|
231
|
+
max: number;
|
|
232
|
+
step: number;
|
|
233
|
+
positions: {
|
|
234
|
+
value: number;
|
|
235
|
+
type: "NumberLinePosition";
|
|
236
|
+
inlines: ({
|
|
237
|
+
value: string;
|
|
238
|
+
type: "FreeText";
|
|
239
|
+
} | {
|
|
240
|
+
type: "Space";
|
|
241
|
+
} | {
|
|
242
|
+
value: string;
|
|
243
|
+
type: "HighlightedText";
|
|
244
|
+
highlight?: [number, number] | undefined;
|
|
245
|
+
} | {
|
|
246
|
+
value: string;
|
|
247
|
+
type: "ColorText";
|
|
248
|
+
color: string;
|
|
249
|
+
highlight?: [number, number] | undefined;
|
|
250
|
+
} | {
|
|
251
|
+
value: string;
|
|
252
|
+
type: "BoldText";
|
|
253
|
+
highlight?: [number, number] | undefined;
|
|
254
|
+
} | {
|
|
255
|
+
length: number;
|
|
256
|
+
type: "InlineInput";
|
|
257
|
+
inputType: "string";
|
|
258
|
+
name: string;
|
|
259
|
+
answer?: string | number | undefined;
|
|
260
|
+
} | {
|
|
261
|
+
type: "InlineInput";
|
|
262
|
+
inputType: "numeric";
|
|
263
|
+
name: string;
|
|
264
|
+
digits: number;
|
|
265
|
+
answer?: string | number | undefined;
|
|
266
|
+
})[];
|
|
267
|
+
}[];
|
|
268
|
+
minorTicks?: number | undefined;
|
|
269
|
+
style?: "arrow-right" | "arrow-left" | "arrow-both" | "line" | undefined;
|
|
230
270
|
} | {
|
|
231
271
|
type: "TableBlock";
|
|
232
272
|
cols: number;
|
|
@@ -278,6 +318,12 @@ export declare function compileWithAST(dsl: string): {
|
|
|
278
318
|
value: string;
|
|
279
319
|
type: "TextBlock";
|
|
280
320
|
} | undefined;
|
|
321
|
+
validation?: {
|
|
322
|
+
type: "SimpleValidation";
|
|
323
|
+
} | {
|
|
324
|
+
expression: string;
|
|
325
|
+
type: "ExpressionValidation";
|
|
326
|
+
} | undefined;
|
|
281
327
|
tools?: ({
|
|
282
328
|
type: "DragOptions";
|
|
283
329
|
options: string[];
|
|
@@ -288,12 +334,6 @@ export declare function compileWithAST(dsl: string): {
|
|
|
288
334
|
})[] | undefined;
|
|
289
335
|
};
|
|
290
336
|
json: {
|
|
291
|
-
validation: {
|
|
292
|
-
mode: "simple" | "expression";
|
|
293
|
-
expression?: string | undefined;
|
|
294
|
-
answers?: Record<string, string | number> | undefined;
|
|
295
|
-
variables?: string[] | undefined;
|
|
296
|
-
};
|
|
297
337
|
version: "2.0";
|
|
298
338
|
layout: any[];
|
|
299
339
|
widgets: Record<string, {
|
|
@@ -315,6 +355,12 @@ export declare function compileWithAST(dsl: string): {
|
|
|
315
355
|
includeOperators?: boolean | undefined;
|
|
316
356
|
includeDecimal?: boolean | undefined;
|
|
317
357
|
}>;
|
|
358
|
+
validation?: {
|
|
359
|
+
mode: "simple" | "expression";
|
|
360
|
+
expression?: string | undefined;
|
|
361
|
+
answers?: Record<string, string | number> | undefined;
|
|
362
|
+
variables?: string[] | undefined;
|
|
363
|
+
} | undefined;
|
|
318
364
|
id?: string | undefined;
|
|
319
365
|
meta?: {
|
|
320
366
|
createdAt?: string | undefined;
|
|
@@ -826,185 +872,16 @@ export declare const ContentBlockSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
826
872
|
options: string[];
|
|
827
873
|
name: string;
|
|
828
874
|
answer: string;
|
|
829
|
-
}
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
export declare function createColorText(value: string, color: string, highlight?: [number, number]): ColorTextInline;
|
|
840
|
-
|
|
841
|
-
/**
|
|
842
|
-
* Create a drag options tool
|
|
843
|
-
*/
|
|
844
|
-
export declare function createDragOptions(options: string[]): DragOptionsTool;
|
|
845
|
-
|
|
846
|
-
/**
|
|
847
|
-
* Create an exercise document
|
|
848
|
-
*/
|
|
849
|
-
export declare function createExerciseDocument(question: z.infer<typeof TextBlockSchema> | undefined, lines: ContentBlock[], validation: z.infer<typeof ValidationNodeSchema>, tools?: z.infer<typeof ToolNodeSchema>[]): ExerciseDocument;
|
|
850
|
-
|
|
851
|
-
/**
|
|
852
|
-
* Create an expression validation node
|
|
853
|
-
*/
|
|
854
|
-
export declare function createExpressionValidation(expression: string): ExpressionValidation;
|
|
855
|
-
|
|
856
|
-
/**
|
|
857
|
-
* Create a free text inline element
|
|
858
|
-
*/
|
|
859
|
-
export declare function createFreeText(value: string): FreeTextInline;
|
|
860
|
-
|
|
861
|
-
/**
|
|
862
|
-
* Create a highlighted text inline element
|
|
863
|
-
*/
|
|
864
|
-
export declare function createHighlightedText(value: string, highlight?: [number, number]): HighlightedTextInline;
|
|
865
|
-
|
|
866
|
-
/**
|
|
867
|
-
* Create a line block
|
|
868
|
-
*/
|
|
869
|
-
export declare function createLineBlock(inlines: InlineNode[]): LineBlock;
|
|
870
|
-
|
|
871
|
-
/**
|
|
872
|
-
* Create a numeric inline input widget (W_N_I)
|
|
873
|
-
*/
|
|
874
|
-
export declare function createNumericInput(name: string, digits: number, answer?: string | number): InlineInputWidget;
|
|
875
|
-
|
|
876
|
-
/**
|
|
877
|
-
* Create a numeric keypad tool
|
|
878
|
-
*/
|
|
879
|
-
export declare function createNumericKeypad(includeOperators?: boolean, includeDecimal?: boolean): NumericKeypadTool;
|
|
880
|
-
|
|
881
|
-
/**
|
|
882
|
-
* Create a simple validation node
|
|
883
|
-
*/
|
|
884
|
-
export declare function createSimpleValidation(): SimpleValidation;
|
|
885
|
-
|
|
886
|
-
/**
|
|
887
|
-
* Create a space inline element
|
|
888
|
-
*/
|
|
889
|
-
export declare function createSpace(): SpaceInline;
|
|
890
|
-
|
|
891
|
-
/**
|
|
892
|
-
* Create a string inline input widget (W_S_I)
|
|
893
|
-
*/
|
|
894
|
-
export declare function createStringInput(name: string, length: number, answer?: string | number): InlineInputWidget;
|
|
895
|
-
|
|
896
|
-
/**
|
|
897
|
-
* Create a text block (question)
|
|
898
|
-
*/
|
|
899
|
-
export declare function createTextBlock(value: string): TextBlock;
|
|
900
|
-
|
|
901
|
-
export declare type DragOptionsJSON = z.infer<typeof DragOptionsJSONSchema>;
|
|
902
|
-
|
|
903
|
-
export declare const DragOptionsJSONSchema: z.ZodObject<{
|
|
904
|
-
type: z.ZodLiteral<"drag-options">;
|
|
905
|
-
options: z.ZodArray<z.ZodString, "many">;
|
|
906
|
-
}, "strip", z.ZodTypeAny, {
|
|
907
|
-
type: "drag-options";
|
|
908
|
-
options: string[];
|
|
909
|
-
}, {
|
|
910
|
-
type: "drag-options";
|
|
911
|
-
options: string[];
|
|
912
|
-
}>;
|
|
913
|
-
|
|
914
|
-
export declare type DragOptionsTool = z.infer<typeof DragOptionsToolSchema>;
|
|
915
|
-
|
|
916
|
-
/**
|
|
917
|
-
* Drag options tool schema - draggable buttons/options
|
|
918
|
-
*
|
|
919
|
-
* Common use cases:
|
|
920
|
-
* - Comparison symbols: ["<", ">", "="]
|
|
921
|
-
* - Yes/No: ["نعم", "لا"]
|
|
922
|
-
* - Multiple choice: ["A", "B", "C", "D"]
|
|
923
|
-
*
|
|
924
|
-
* @example
|
|
925
|
-
* {
|
|
926
|
-
* type: "DragOptions",
|
|
927
|
-
* options: ["<", ">", "="]
|
|
928
|
-
* }
|
|
929
|
-
*/
|
|
930
|
-
export declare const DragOptionsToolSchema: z.ZodObject<{
|
|
931
|
-
type: z.ZodLiteral<"DragOptions">;
|
|
932
|
-
options: z.ZodArray<z.ZodString, "many">;
|
|
933
|
-
}, "strip", z.ZodTypeAny, {
|
|
934
|
-
type: "DragOptions";
|
|
935
|
-
options: string[];
|
|
936
|
-
}, {
|
|
937
|
-
type: "DragOptions";
|
|
938
|
-
options: string[];
|
|
939
|
-
}>;
|
|
940
|
-
|
|
941
|
-
/**
|
|
942
|
-
* Base error class for all engine errors
|
|
943
|
-
*/
|
|
944
|
-
export declare class EngineError extends Error {
|
|
945
|
-
constructor(message: string);
|
|
946
|
-
}
|
|
947
|
-
|
|
948
|
-
/**
|
|
949
|
-
* Evaluate a mathematical expression with the given variable scope
|
|
950
|
-
*
|
|
951
|
-
* @param expression - The expression to evaluate (e.g., "(a * b) + (c * d) == 1200")
|
|
952
|
-
* @param scope - Variable bindings (e.g., { a: 10, b: 5, c: 20, d: 30 })
|
|
953
|
-
* @returns The boolean result of the expression
|
|
954
|
-
* @throws Error if evaluation fails
|
|
955
|
-
*/
|
|
956
|
-
export declare function evaluate(expression: string, scope: Record<string, number>): boolean;
|
|
957
|
-
|
|
958
|
-
export declare type ExerciseDocument = z.infer<typeof ExerciseDocumentSchema>;
|
|
959
|
-
|
|
960
|
-
/**
|
|
961
|
-
* Exercise document schema - the complete exercise structure
|
|
962
|
-
*
|
|
963
|
-
* Structure:
|
|
964
|
-
* 1. Question: What the student should do
|
|
965
|
-
* 2. Lines: Visual rows with inline elements
|
|
966
|
-
* 3. Tools: Standalone interactive elements (optional)
|
|
967
|
-
* 4. Validation: How to check answers
|
|
968
|
-
*
|
|
969
|
-
* @example
|
|
970
|
-
* {
|
|
971
|
-
* type: "ExerciseDocument",
|
|
972
|
-
* question: {
|
|
973
|
-
* type: "TextBlock",
|
|
974
|
-
* value: "أقارن كل عددين باستعمال الرمر المناسب"
|
|
975
|
-
* },
|
|
976
|
-
* lines: [
|
|
977
|
-
* {
|
|
978
|
-
* type: "LineBlock",
|
|
979
|
-
* inlines: [
|
|
980
|
-
* { type: "HighlightedText", value: "151 000", highlight: [0, 3] },
|
|
981
|
-
* { type: "InlineInput", name: "x", length: 1 },
|
|
982
|
-
* { type: "HighlightedText", value: "54 000", highlight: [0, 3] }
|
|
983
|
-
* ]
|
|
984
|
-
* }
|
|
985
|
-
* ],
|
|
986
|
-
* tools: [
|
|
987
|
-
* { type: "DragOptions", options: ["<", ">", "="] }
|
|
988
|
-
* ],
|
|
989
|
-
* validation: {
|
|
990
|
-
* type: "SimpleValidation"
|
|
991
|
-
* }
|
|
992
|
-
* }
|
|
993
|
-
*/
|
|
994
|
-
export declare const ExerciseDocumentSchema: z.ZodObject<{
|
|
995
|
-
type: z.ZodLiteral<"ExerciseDocument">;
|
|
996
|
-
question: z.ZodOptional<z.ZodObject<{
|
|
997
|
-
type: z.ZodLiteral<"TextBlock">;
|
|
998
|
-
value: z.ZodString;
|
|
999
|
-
}, "strip", z.ZodTypeAny, {
|
|
1000
|
-
value: string;
|
|
1001
|
-
type: "TextBlock";
|
|
1002
|
-
}, {
|
|
1003
|
-
value: string;
|
|
1004
|
-
type: "TextBlock";
|
|
1005
|
-
}>>;
|
|
1006
|
-
lines: z.ZodArray<z.ZodUnion<[z.ZodObject<{
|
|
1007
|
-
type: z.ZodLiteral<"LineBlock">;
|
|
875
|
+
}>, z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
876
|
+
type: z.ZodLiteral<"NumberLineBlock">;
|
|
877
|
+
min: z.ZodNumber;
|
|
878
|
+
max: z.ZodNumber;
|
|
879
|
+
step: z.ZodDefault<z.ZodNumber>;
|
|
880
|
+
minorTicks: z.ZodOptional<z.ZodNumber>;
|
|
881
|
+
style: z.ZodOptional<z.ZodEnum<["arrow-right", "arrow-left", "arrow-both", "line"]>>;
|
|
882
|
+
positions: z.ZodArray<z.ZodObject<{
|
|
883
|
+
type: z.ZodLiteral<"NumberLinePosition">;
|
|
884
|
+
value: z.ZodNumber;
|
|
1008
885
|
inlines: z.ZodArray<z.ZodUnion<[z.ZodObject<{
|
|
1009
886
|
type: z.ZodLiteral<"FreeText">;
|
|
1010
887
|
value: z.ZodString;
|
|
@@ -1097,7 +974,8 @@ export declare const ExerciseDocumentSchema: z.ZodObject<{
|
|
|
1097
974
|
answer?: string | number | undefined;
|
|
1098
975
|
}>]>]>, "many">;
|
|
1099
976
|
}, "strip", z.ZodTypeAny, {
|
|
1100
|
-
|
|
977
|
+
value: number;
|
|
978
|
+
type: "NumberLinePosition";
|
|
1101
979
|
inlines: ({
|
|
1102
980
|
value: string;
|
|
1103
981
|
type: "FreeText";
|
|
@@ -1130,7 +1008,8 @@ export declare const ExerciseDocumentSchema: z.ZodObject<{
|
|
|
1130
1008
|
answer?: string | number | undefined;
|
|
1131
1009
|
})[];
|
|
1132
1010
|
}, {
|
|
1133
|
-
|
|
1011
|
+
value: number;
|
|
1012
|
+
type: "NumberLinePosition";
|
|
1134
1013
|
inlines: ({
|
|
1135
1014
|
value: string;
|
|
1136
1015
|
type: "FreeText";
|
|
@@ -1162,31 +1041,620 @@ export declare const ExerciseDocumentSchema: z.ZodObject<{
|
|
|
1162
1041
|
digits: number;
|
|
1163
1042
|
answer?: string | number | undefined;
|
|
1164
1043
|
})[];
|
|
1165
|
-
}>,
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1044
|
+
}>, "many">;
|
|
1045
|
+
}, "strip", z.ZodTypeAny, {
|
|
1046
|
+
type: "NumberLineBlock";
|
|
1047
|
+
min: number;
|
|
1048
|
+
max: number;
|
|
1049
|
+
step: number;
|
|
1050
|
+
positions: {
|
|
1051
|
+
value: number;
|
|
1052
|
+
type: "NumberLinePosition";
|
|
1053
|
+
inlines: ({
|
|
1054
|
+
value: string;
|
|
1055
|
+
type: "FreeText";
|
|
1056
|
+
} | {
|
|
1057
|
+
type: "Space";
|
|
1058
|
+
} | {
|
|
1059
|
+
value: string;
|
|
1060
|
+
type: "HighlightedText";
|
|
1061
|
+
highlight?: [number, number] | undefined;
|
|
1062
|
+
} | {
|
|
1063
|
+
value: string;
|
|
1064
|
+
type: "ColorText";
|
|
1065
|
+
color: string;
|
|
1066
|
+
highlight?: [number, number] | undefined;
|
|
1067
|
+
} | {
|
|
1068
|
+
value: string;
|
|
1069
|
+
type: "BoldText";
|
|
1070
|
+
highlight?: [number, number] | undefined;
|
|
1071
|
+
} | {
|
|
1072
|
+
length: number;
|
|
1073
|
+
type: "InlineInput";
|
|
1074
|
+
inputType: "string";
|
|
1075
|
+
name: string;
|
|
1076
|
+
answer?: string | number | undefined;
|
|
1077
|
+
} | {
|
|
1078
|
+
type: "InlineInput";
|
|
1079
|
+
inputType: "numeric";
|
|
1080
|
+
name: string;
|
|
1081
|
+
digits: number;
|
|
1082
|
+
answer?: string | number | undefined;
|
|
1083
|
+
})[];
|
|
1084
|
+
}[];
|
|
1085
|
+
minorTicks?: number | undefined;
|
|
1086
|
+
style?: "arrow-right" | "arrow-left" | "arrow-both" | "line" | undefined;
|
|
1087
|
+
}, {
|
|
1088
|
+
type: "NumberLineBlock";
|
|
1089
|
+
min: number;
|
|
1090
|
+
max: number;
|
|
1091
|
+
positions: {
|
|
1092
|
+
value: number;
|
|
1093
|
+
type: "NumberLinePosition";
|
|
1094
|
+
inlines: ({
|
|
1095
|
+
value: string;
|
|
1096
|
+
type: "FreeText";
|
|
1097
|
+
} | {
|
|
1098
|
+
type: "Space";
|
|
1099
|
+
} | {
|
|
1100
|
+
value: string;
|
|
1101
|
+
type: "HighlightedText";
|
|
1102
|
+
highlight?: [number, number] | undefined;
|
|
1103
|
+
} | {
|
|
1104
|
+
value: string;
|
|
1105
|
+
type: "ColorText";
|
|
1106
|
+
color: string;
|
|
1107
|
+
highlight?: [number, number] | undefined;
|
|
1108
|
+
} | {
|
|
1109
|
+
value: string;
|
|
1110
|
+
type: "BoldText";
|
|
1111
|
+
highlight?: [number, number] | undefined;
|
|
1112
|
+
} | {
|
|
1113
|
+
length: number;
|
|
1114
|
+
type: "InlineInput";
|
|
1115
|
+
inputType: "string";
|
|
1116
|
+
name: string;
|
|
1117
|
+
answer?: string | number | undefined;
|
|
1118
|
+
} | {
|
|
1119
|
+
type: "InlineInput";
|
|
1120
|
+
inputType: "numeric";
|
|
1121
|
+
name: string;
|
|
1122
|
+
digits: number;
|
|
1123
|
+
answer?: string | number | undefined;
|
|
1124
|
+
})[];
|
|
1125
|
+
}[];
|
|
1126
|
+
step?: number | undefined;
|
|
1127
|
+
minorTicks?: number | undefined;
|
|
1128
|
+
style?: "arrow-right" | "arrow-left" | "arrow-both" | "line" | undefined;
|
|
1129
|
+
}>, {
|
|
1130
|
+
type: "NumberLineBlock";
|
|
1131
|
+
min: number;
|
|
1132
|
+
max: number;
|
|
1133
|
+
step: number;
|
|
1134
|
+
positions: {
|
|
1135
|
+
value: number;
|
|
1136
|
+
type: "NumberLinePosition";
|
|
1137
|
+
inlines: ({
|
|
1138
|
+
value: string;
|
|
1139
|
+
type: "FreeText";
|
|
1140
|
+
} | {
|
|
1141
|
+
type: "Space";
|
|
1142
|
+
} | {
|
|
1143
|
+
value: string;
|
|
1144
|
+
type: "HighlightedText";
|
|
1145
|
+
highlight?: [number, number] | undefined;
|
|
1146
|
+
} | {
|
|
1147
|
+
value: string;
|
|
1148
|
+
type: "ColorText";
|
|
1149
|
+
color: string;
|
|
1150
|
+
highlight?: [number, number] | undefined;
|
|
1151
|
+
} | {
|
|
1152
|
+
value: string;
|
|
1153
|
+
type: "BoldText";
|
|
1154
|
+
highlight?: [number, number] | undefined;
|
|
1155
|
+
} | {
|
|
1156
|
+
length: number;
|
|
1157
|
+
type: "InlineInput";
|
|
1158
|
+
inputType: "string";
|
|
1159
|
+
name: string;
|
|
1160
|
+
answer?: string | number | undefined;
|
|
1161
|
+
} | {
|
|
1162
|
+
type: "InlineInput";
|
|
1163
|
+
inputType: "numeric";
|
|
1164
|
+
name: string;
|
|
1165
|
+
digits: number;
|
|
1166
|
+
answer?: string | number | undefined;
|
|
1167
|
+
})[];
|
|
1168
|
+
}[];
|
|
1169
|
+
minorTicks?: number | undefined;
|
|
1170
|
+
style?: "arrow-right" | "arrow-left" | "arrow-both" | "line" | undefined;
|
|
1171
|
+
}, {
|
|
1172
|
+
type: "NumberLineBlock";
|
|
1173
|
+
min: number;
|
|
1174
|
+
max: number;
|
|
1175
|
+
positions: {
|
|
1176
|
+
value: number;
|
|
1177
|
+
type: "NumberLinePosition";
|
|
1178
|
+
inlines: ({
|
|
1179
|
+
value: string;
|
|
1180
|
+
type: "FreeText";
|
|
1181
|
+
} | {
|
|
1182
|
+
type: "Space";
|
|
1183
|
+
} | {
|
|
1184
|
+
value: string;
|
|
1185
|
+
type: "HighlightedText";
|
|
1186
|
+
highlight?: [number, number] | undefined;
|
|
1187
|
+
} | {
|
|
1188
|
+
value: string;
|
|
1189
|
+
type: "ColorText";
|
|
1190
|
+
color: string;
|
|
1191
|
+
highlight?: [number, number] | undefined;
|
|
1192
|
+
} | {
|
|
1193
|
+
value: string;
|
|
1194
|
+
type: "BoldText";
|
|
1195
|
+
highlight?: [number, number] | undefined;
|
|
1196
|
+
} | {
|
|
1197
|
+
length: number;
|
|
1198
|
+
type: "InlineInput";
|
|
1199
|
+
inputType: "string";
|
|
1200
|
+
name: string;
|
|
1201
|
+
answer?: string | number | undefined;
|
|
1202
|
+
} | {
|
|
1203
|
+
type: "InlineInput";
|
|
1204
|
+
inputType: "numeric";
|
|
1205
|
+
name: string;
|
|
1206
|
+
digits: number;
|
|
1207
|
+
answer?: string | number | undefined;
|
|
1208
|
+
})[];
|
|
1209
|
+
}[];
|
|
1210
|
+
step?: number | undefined;
|
|
1211
|
+
minorTicks?: number | undefined;
|
|
1212
|
+
style?: "arrow-right" | "arrow-left" | "arrow-both" | "line" | undefined;
|
|
1213
|
+
}>, {
|
|
1214
|
+
type: "NumberLineBlock";
|
|
1215
|
+
min: number;
|
|
1216
|
+
max: number;
|
|
1217
|
+
step: number;
|
|
1218
|
+
positions: {
|
|
1219
|
+
value: number;
|
|
1220
|
+
type: "NumberLinePosition";
|
|
1221
|
+
inlines: ({
|
|
1222
|
+
value: string;
|
|
1223
|
+
type: "FreeText";
|
|
1224
|
+
} | {
|
|
1225
|
+
type: "Space";
|
|
1226
|
+
} | {
|
|
1227
|
+
value: string;
|
|
1228
|
+
type: "HighlightedText";
|
|
1229
|
+
highlight?: [number, number] | undefined;
|
|
1230
|
+
} | {
|
|
1231
|
+
value: string;
|
|
1232
|
+
type: "ColorText";
|
|
1233
|
+
color: string;
|
|
1234
|
+
highlight?: [number, number] | undefined;
|
|
1235
|
+
} | {
|
|
1236
|
+
value: string;
|
|
1237
|
+
type: "BoldText";
|
|
1238
|
+
highlight?: [number, number] | undefined;
|
|
1239
|
+
} | {
|
|
1240
|
+
length: number;
|
|
1241
|
+
type: "InlineInput";
|
|
1242
|
+
inputType: "string";
|
|
1243
|
+
name: string;
|
|
1244
|
+
answer?: string | number | undefined;
|
|
1245
|
+
} | {
|
|
1246
|
+
type: "InlineInput";
|
|
1247
|
+
inputType: "numeric";
|
|
1248
|
+
name: string;
|
|
1249
|
+
digits: number;
|
|
1250
|
+
answer?: string | number | undefined;
|
|
1251
|
+
})[];
|
|
1252
|
+
}[];
|
|
1253
|
+
minorTicks?: number | undefined;
|
|
1254
|
+
style?: "arrow-right" | "arrow-left" | "arrow-both" | "line" | undefined;
|
|
1255
|
+
}, {
|
|
1256
|
+
type: "NumberLineBlock";
|
|
1257
|
+
min: number;
|
|
1258
|
+
max: number;
|
|
1259
|
+
positions: {
|
|
1260
|
+
value: number;
|
|
1261
|
+
type: "NumberLinePosition";
|
|
1262
|
+
inlines: ({
|
|
1263
|
+
value: string;
|
|
1264
|
+
type: "FreeText";
|
|
1265
|
+
} | {
|
|
1266
|
+
type: "Space";
|
|
1267
|
+
} | {
|
|
1268
|
+
value: string;
|
|
1269
|
+
type: "HighlightedText";
|
|
1270
|
+
highlight?: [number, number] | undefined;
|
|
1271
|
+
} | {
|
|
1272
|
+
value: string;
|
|
1273
|
+
type: "ColorText";
|
|
1274
|
+
color: string;
|
|
1275
|
+
highlight?: [number, number] | undefined;
|
|
1276
|
+
} | {
|
|
1277
|
+
value: string;
|
|
1278
|
+
type: "BoldText";
|
|
1279
|
+
highlight?: [number, number] | undefined;
|
|
1280
|
+
} | {
|
|
1281
|
+
length: number;
|
|
1282
|
+
type: "InlineInput";
|
|
1283
|
+
inputType: "string";
|
|
1284
|
+
name: string;
|
|
1285
|
+
answer?: string | number | undefined;
|
|
1286
|
+
} | {
|
|
1287
|
+
type: "InlineInput";
|
|
1288
|
+
inputType: "numeric";
|
|
1289
|
+
name: string;
|
|
1290
|
+
digits: number;
|
|
1291
|
+
answer?: string | number | undefined;
|
|
1292
|
+
})[];
|
|
1293
|
+
}[];
|
|
1294
|
+
step?: number | undefined;
|
|
1295
|
+
minorTicks?: number | undefined;
|
|
1296
|
+
style?: "arrow-right" | "arrow-left" | "arrow-both" | "line" | undefined;
|
|
1297
|
+
}>]>;
|
|
1298
|
+
|
|
1299
|
+
/**
|
|
1300
|
+
* Create a bold text inline element
|
|
1301
|
+
*/
|
|
1302
|
+
export declare function createBoldText(value: string, highlight?: [number, number]): BoldTextInline;
|
|
1303
|
+
|
|
1304
|
+
/**
|
|
1305
|
+
* Create a color text inline element
|
|
1306
|
+
*/
|
|
1307
|
+
export declare function createColorText(value: string, color: string, highlight?: [number, number]): ColorTextInline;
|
|
1308
|
+
|
|
1309
|
+
/**
|
|
1310
|
+
* Create a drag options tool
|
|
1311
|
+
*/
|
|
1312
|
+
export declare function createDragOptions(options: string[]): DragOptionsTool;
|
|
1313
|
+
|
|
1314
|
+
/**
|
|
1315
|
+
* Create an exercise document
|
|
1316
|
+
*/
|
|
1317
|
+
export declare function createExerciseDocument(question: z.infer<typeof TextBlockSchema> | undefined, lines: ContentBlock[], validation?: z.infer<typeof ValidationNodeSchema>, tools?: z.infer<typeof ToolNodeSchema>[]): ExerciseDocument;
|
|
1318
|
+
|
|
1319
|
+
/**
|
|
1320
|
+
* Create an expression validation node
|
|
1321
|
+
*/
|
|
1322
|
+
export declare function createExpressionValidation(expression: string): ExpressionValidation;
|
|
1323
|
+
|
|
1324
|
+
/**
|
|
1325
|
+
* Create a free text inline element
|
|
1326
|
+
*/
|
|
1327
|
+
export declare function createFreeText(value: string): FreeTextInline;
|
|
1328
|
+
|
|
1329
|
+
/**
|
|
1330
|
+
* Create a highlighted text inline element
|
|
1331
|
+
*/
|
|
1332
|
+
export declare function createHighlightedText(value: string, highlight?: [number, number]): HighlightedTextInline;
|
|
1333
|
+
|
|
1334
|
+
/**
|
|
1335
|
+
* Create a line block
|
|
1336
|
+
*/
|
|
1337
|
+
export declare function createLineBlock(inlines: InlineNode[]): LineBlock;
|
|
1338
|
+
|
|
1339
|
+
/**
|
|
1340
|
+
* Create a numeric inline input widget (W_N_I)
|
|
1341
|
+
*/
|
|
1342
|
+
export declare function createNumericInput(name: string, digits: number, answer?: string | number): InlineInputWidget;
|
|
1343
|
+
|
|
1344
|
+
/**
|
|
1345
|
+
* Create a numeric keypad tool
|
|
1346
|
+
*/
|
|
1347
|
+
export declare function createNumericKeypad(includeOperators?: boolean, includeDecimal?: boolean): NumericKeypadTool;
|
|
1348
|
+
|
|
1349
|
+
/**
|
|
1350
|
+
* Create a simple validation node
|
|
1351
|
+
*/
|
|
1352
|
+
export declare function createSimpleValidation(): SimpleValidation;
|
|
1353
|
+
|
|
1354
|
+
/**
|
|
1355
|
+
* Create a space inline element
|
|
1356
|
+
*/
|
|
1357
|
+
export declare function createSpace(): SpaceInline;
|
|
1358
|
+
|
|
1359
|
+
/**
|
|
1360
|
+
* Create a string inline input widget (W_S_I)
|
|
1361
|
+
*/
|
|
1362
|
+
export declare function createStringInput(name: string, length: number, answer?: string | number): InlineInputWidget;
|
|
1363
|
+
|
|
1364
|
+
/**
|
|
1365
|
+
* Create a text block (question)
|
|
1366
|
+
*/
|
|
1367
|
+
export declare function createTextBlock(value: string): TextBlock;
|
|
1368
|
+
|
|
1369
|
+
export declare type DragOptionsJSON = z.infer<typeof DragOptionsJSONSchema>;
|
|
1370
|
+
|
|
1371
|
+
export declare const DragOptionsJSONSchema: z.ZodObject<{
|
|
1372
|
+
type: z.ZodLiteral<"drag-options">;
|
|
1373
|
+
options: z.ZodArray<z.ZodString, "many">;
|
|
1374
|
+
}, "strip", z.ZodTypeAny, {
|
|
1375
|
+
type: "drag-options";
|
|
1376
|
+
options: string[];
|
|
1377
|
+
}, {
|
|
1378
|
+
type: "drag-options";
|
|
1379
|
+
options: string[];
|
|
1380
|
+
}>;
|
|
1381
|
+
|
|
1382
|
+
export declare type DragOptionsTool = z.infer<typeof DragOptionsToolSchema>;
|
|
1383
|
+
|
|
1384
|
+
/**
|
|
1385
|
+
* Drag options tool schema - draggable buttons/options
|
|
1386
|
+
*
|
|
1387
|
+
* Common use cases:
|
|
1388
|
+
* - Comparison symbols: ["<", ">", "="]
|
|
1389
|
+
* - Yes/No: ["نعم", "لا"]
|
|
1390
|
+
* - Multiple choice: ["A", "B", "C", "D"]
|
|
1391
|
+
*
|
|
1392
|
+
* @example
|
|
1393
|
+
* {
|
|
1394
|
+
* type: "DragOptions",
|
|
1395
|
+
* options: ["<", ">", "="]
|
|
1396
|
+
* }
|
|
1397
|
+
*/
|
|
1398
|
+
export declare const DragOptionsToolSchema: z.ZodObject<{
|
|
1399
|
+
type: z.ZodLiteral<"DragOptions">;
|
|
1400
|
+
options: z.ZodArray<z.ZodString, "many">;
|
|
1401
|
+
}, "strip", z.ZodTypeAny, {
|
|
1402
|
+
type: "DragOptions";
|
|
1403
|
+
options: string[];
|
|
1404
|
+
}, {
|
|
1405
|
+
type: "DragOptions";
|
|
1406
|
+
options: string[];
|
|
1407
|
+
}>;
|
|
1408
|
+
|
|
1409
|
+
/**
|
|
1410
|
+
* Base error class for all engine errors
|
|
1411
|
+
*/
|
|
1412
|
+
export declare class EngineError extends Error {
|
|
1413
|
+
constructor(message: string);
|
|
1414
|
+
}
|
|
1415
|
+
|
|
1416
|
+
/**
|
|
1417
|
+
* Evaluate a mathematical expression with the given variable scope
|
|
1418
|
+
*
|
|
1419
|
+
* @param expression - The expression to evaluate (e.g., "(a * b) + (c * d) == 1200")
|
|
1420
|
+
* @param scope - Variable bindings (e.g., { a: 10, b: 5, c: 20, d: 30 })
|
|
1421
|
+
* @returns The boolean result of the expression
|
|
1422
|
+
* @throws Error if evaluation fails
|
|
1423
|
+
*/
|
|
1424
|
+
export declare function evaluate(expression: string, scope: Record<string, number>): boolean;
|
|
1425
|
+
|
|
1426
|
+
export declare type ExerciseDocument = z.infer<typeof ExerciseDocumentSchema>;
|
|
1427
|
+
|
|
1428
|
+
/**
|
|
1429
|
+
* Exercise document schema - the complete exercise structure
|
|
1430
|
+
*
|
|
1431
|
+
* Structure:
|
|
1432
|
+
* 1. Question: What the student should do
|
|
1433
|
+
* 2. Lines: Visual rows with inline elements
|
|
1434
|
+
* 3. Tools: Standalone interactive elements (optional)
|
|
1435
|
+
* 4. Validation: How to check answers
|
|
1436
|
+
*
|
|
1437
|
+
* @example
|
|
1438
|
+
* {
|
|
1439
|
+
* type: "ExerciseDocument",
|
|
1440
|
+
* question: {
|
|
1441
|
+
* type: "TextBlock",
|
|
1442
|
+
* value: "أقارن كل عددين باستعمال الرمر المناسب"
|
|
1443
|
+
* },
|
|
1444
|
+
* lines: [
|
|
1445
|
+
* {
|
|
1446
|
+
* type: "LineBlock",
|
|
1447
|
+
* inlines: [
|
|
1448
|
+
* { type: "HighlightedText", value: "151 000", highlight: [0, 3] },
|
|
1449
|
+
* { type: "InlineInput", name: "x", length: 1 },
|
|
1450
|
+
* { type: "HighlightedText", value: "54 000", highlight: [0, 3] }
|
|
1451
|
+
* ]
|
|
1452
|
+
* }
|
|
1453
|
+
* ],
|
|
1454
|
+
* tools: [
|
|
1455
|
+
* { type: "DragOptions", options: ["<", ">", "="] }
|
|
1456
|
+
* ],
|
|
1457
|
+
* validation: {
|
|
1458
|
+
* type: "SimpleValidation"
|
|
1459
|
+
* }
|
|
1460
|
+
* }
|
|
1461
|
+
*/
|
|
1462
|
+
export declare const ExerciseDocumentSchema: z.ZodObject<{
|
|
1463
|
+
type: z.ZodLiteral<"ExerciseDocument">;
|
|
1464
|
+
question: z.ZodOptional<z.ZodObject<{
|
|
1465
|
+
type: z.ZodLiteral<"TextBlock">;
|
|
1466
|
+
value: z.ZodString;
|
|
1467
|
+
}, "strip", z.ZodTypeAny, {
|
|
1468
|
+
value: string;
|
|
1469
|
+
type: "TextBlock";
|
|
1470
|
+
}, {
|
|
1471
|
+
value: string;
|
|
1472
|
+
type: "TextBlock";
|
|
1473
|
+
}>>;
|
|
1474
|
+
lines: z.ZodArray<z.ZodUnion<[z.ZodObject<{
|
|
1475
|
+
type: z.ZodLiteral<"LineBlock">;
|
|
1476
|
+
inlines: z.ZodArray<z.ZodUnion<[z.ZodObject<{
|
|
1477
|
+
type: z.ZodLiteral<"FreeText">;
|
|
1478
|
+
value: z.ZodString;
|
|
1479
|
+
}, "strip", z.ZodTypeAny, {
|
|
1480
|
+
value: string;
|
|
1481
|
+
type: "FreeText";
|
|
1482
|
+
}, {
|
|
1483
|
+
value: string;
|
|
1484
|
+
type: "FreeText";
|
|
1485
|
+
}>, z.ZodObject<{
|
|
1486
|
+
type: z.ZodLiteral<"Space">;
|
|
1487
|
+
}, "strip", z.ZodTypeAny, {
|
|
1488
|
+
type: "Space";
|
|
1489
|
+
}, {
|
|
1490
|
+
type: "Space";
|
|
1491
|
+
}>, z.ZodObject<{
|
|
1492
|
+
type: z.ZodLiteral<"HighlightedText">;
|
|
1493
|
+
value: z.ZodString;
|
|
1494
|
+
highlight: z.ZodOptional<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>;
|
|
1495
|
+
}, "strip", z.ZodTypeAny, {
|
|
1496
|
+
value: string;
|
|
1497
|
+
type: "HighlightedText";
|
|
1498
|
+
highlight?: [number, number] | undefined;
|
|
1499
|
+
}, {
|
|
1500
|
+
value: string;
|
|
1501
|
+
type: "HighlightedText";
|
|
1502
|
+
highlight?: [number, number] | undefined;
|
|
1503
|
+
}>, z.ZodObject<{
|
|
1504
|
+
type: z.ZodLiteral<"ColorText">;
|
|
1505
|
+
value: z.ZodString;
|
|
1506
|
+
color: z.ZodString;
|
|
1507
|
+
highlight: z.ZodOptional<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>;
|
|
1508
|
+
}, "strip", z.ZodTypeAny, {
|
|
1509
|
+
value: string;
|
|
1510
|
+
type: "ColorText";
|
|
1511
|
+
color: string;
|
|
1512
|
+
highlight?: [number, number] | undefined;
|
|
1513
|
+
}, {
|
|
1514
|
+
value: string;
|
|
1515
|
+
type: "ColorText";
|
|
1516
|
+
color: string;
|
|
1517
|
+
highlight?: [number, number] | undefined;
|
|
1518
|
+
}>, z.ZodObject<{
|
|
1519
|
+
type: z.ZodLiteral<"BoldText">;
|
|
1520
|
+
value: z.ZodString;
|
|
1521
|
+
highlight: z.ZodOptional<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>;
|
|
1522
|
+
}, "strip", z.ZodTypeAny, {
|
|
1523
|
+
value: string;
|
|
1524
|
+
type: "BoldText";
|
|
1525
|
+
highlight?: [number, number] | undefined;
|
|
1526
|
+
}, {
|
|
1527
|
+
value: string;
|
|
1528
|
+
type: "BoldText";
|
|
1529
|
+
highlight?: [number, number] | undefined;
|
|
1530
|
+
}>, z.ZodDiscriminatedUnion<"inputType", [z.ZodObject<{
|
|
1531
|
+
type: z.ZodLiteral<"InlineInput">;
|
|
1532
|
+
name: z.ZodString;
|
|
1533
|
+
inputType: z.ZodLiteral<"string">;
|
|
1534
|
+
length: z.ZodNumber;
|
|
1535
|
+
answer: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
|
|
1536
|
+
}, "strip", z.ZodTypeAny, {
|
|
1537
|
+
length: number;
|
|
1538
|
+
type: "InlineInput";
|
|
1539
|
+
inputType: "string";
|
|
1540
|
+
name: string;
|
|
1541
|
+
answer?: string | number | undefined;
|
|
1542
|
+
}, {
|
|
1543
|
+
length: number;
|
|
1544
|
+
type: "InlineInput";
|
|
1545
|
+
inputType: "string";
|
|
1546
|
+
name: string;
|
|
1547
|
+
answer?: string | number | undefined;
|
|
1548
|
+
}>, z.ZodObject<{
|
|
1549
|
+
type: z.ZodLiteral<"InlineInput">;
|
|
1550
|
+
name: z.ZodString;
|
|
1551
|
+
inputType: z.ZodLiteral<"numeric">;
|
|
1552
|
+
digits: z.ZodNumber;
|
|
1553
|
+
answer: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
|
|
1554
|
+
}, "strip", z.ZodTypeAny, {
|
|
1555
|
+
type: "InlineInput";
|
|
1556
|
+
inputType: "numeric";
|
|
1557
|
+
name: string;
|
|
1558
|
+
digits: number;
|
|
1559
|
+
answer?: string | number | undefined;
|
|
1560
|
+
}, {
|
|
1561
|
+
type: "InlineInput";
|
|
1562
|
+
inputType: "numeric";
|
|
1563
|
+
name: string;
|
|
1564
|
+
digits: number;
|
|
1565
|
+
answer?: string | number | undefined;
|
|
1566
|
+
}>]>]>, "many">;
|
|
1567
|
+
}, "strip", z.ZodTypeAny, {
|
|
1568
|
+
type: "LineBlock";
|
|
1569
|
+
inlines: ({
|
|
1570
|
+
value: string;
|
|
1571
|
+
type: "FreeText";
|
|
1572
|
+
} | {
|
|
1573
|
+
type: "Space";
|
|
1574
|
+
} | {
|
|
1575
|
+
value: string;
|
|
1576
|
+
type: "HighlightedText";
|
|
1577
|
+
highlight?: [number, number] | undefined;
|
|
1578
|
+
} | {
|
|
1579
|
+
value: string;
|
|
1580
|
+
type: "ColorText";
|
|
1581
|
+
color: string;
|
|
1582
|
+
highlight?: [number, number] | undefined;
|
|
1583
|
+
} | {
|
|
1584
|
+
value: string;
|
|
1585
|
+
type: "BoldText";
|
|
1586
|
+
highlight?: [number, number] | undefined;
|
|
1587
|
+
} | {
|
|
1588
|
+
length: number;
|
|
1589
|
+
type: "InlineInput";
|
|
1590
|
+
inputType: "string";
|
|
1591
|
+
name: string;
|
|
1592
|
+
answer?: string | number | undefined;
|
|
1593
|
+
} | {
|
|
1594
|
+
type: "InlineInput";
|
|
1595
|
+
inputType: "numeric";
|
|
1596
|
+
name: string;
|
|
1597
|
+
digits: number;
|
|
1598
|
+
answer?: string | number | undefined;
|
|
1599
|
+
})[];
|
|
1600
|
+
}, {
|
|
1601
|
+
type: "LineBlock";
|
|
1602
|
+
inlines: ({
|
|
1603
|
+
value: string;
|
|
1604
|
+
type: "FreeText";
|
|
1605
|
+
} | {
|
|
1606
|
+
type: "Space";
|
|
1607
|
+
} | {
|
|
1608
|
+
value: string;
|
|
1609
|
+
type: "HighlightedText";
|
|
1610
|
+
highlight?: [number, number] | undefined;
|
|
1611
|
+
} | {
|
|
1612
|
+
value: string;
|
|
1613
|
+
type: "ColorText";
|
|
1614
|
+
color: string;
|
|
1615
|
+
highlight?: [number, number] | undefined;
|
|
1616
|
+
} | {
|
|
1617
|
+
value: string;
|
|
1618
|
+
type: "BoldText";
|
|
1619
|
+
highlight?: [number, number] | undefined;
|
|
1620
|
+
} | {
|
|
1621
|
+
length: number;
|
|
1622
|
+
type: "InlineInput";
|
|
1623
|
+
inputType: "string";
|
|
1624
|
+
name: string;
|
|
1625
|
+
answer?: string | number | undefined;
|
|
1626
|
+
} | {
|
|
1627
|
+
type: "InlineInput";
|
|
1628
|
+
inputType: "numeric";
|
|
1629
|
+
name: string;
|
|
1630
|
+
digits: number;
|
|
1631
|
+
answer?: string | number | undefined;
|
|
1632
|
+
})[];
|
|
1633
|
+
}>, z.ZodObject<{
|
|
1634
|
+
type: z.ZodLiteral<"TableBlock">;
|
|
1635
|
+
cols: z.ZodNumber;
|
|
1636
|
+
rows: z.ZodArray<z.ZodObject<{
|
|
1637
|
+
type: z.ZodLiteral<"TableRow">;
|
|
1638
|
+
cells: z.ZodArray<z.ZodObject<{
|
|
1639
|
+
type: z.ZodLiteral<"TableCell">;
|
|
1640
|
+
colspan: z.ZodOptional<z.ZodNumber>;
|
|
1641
|
+
inlines: z.ZodArray<z.ZodUnion<[z.ZodObject<{
|
|
1642
|
+
type: z.ZodLiteral<"FreeText">;
|
|
1643
|
+
value: z.ZodString;
|
|
1644
|
+
}, "strip", z.ZodTypeAny, {
|
|
1645
|
+
value: string;
|
|
1646
|
+
type: "FreeText";
|
|
1647
|
+
}, {
|
|
1648
|
+
value: string;
|
|
1649
|
+
type: "FreeText";
|
|
1650
|
+
}>, z.ZodObject<{
|
|
1651
|
+
type: z.ZodLiteral<"Space">;
|
|
1652
|
+
}, "strip", z.ZodTypeAny, {
|
|
1653
|
+
type: "Space";
|
|
1654
|
+
}, {
|
|
1655
|
+
type: "Space";
|
|
1656
|
+
}>, z.ZodObject<{
|
|
1657
|
+
type: z.ZodLiteral<"HighlightedText">;
|
|
1190
1658
|
value: z.ZodString;
|
|
1191
1659
|
highlight: z.ZodOptional<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>;
|
|
1192
1660
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -1368,140 +1836,562 @@ export declare const ExerciseDocumentSchema: z.ZodObject<{
|
|
|
1368
1836
|
colspan?: number | undefined;
|
|
1369
1837
|
}[];
|
|
1370
1838
|
}, {
|
|
1371
|
-
type: "TableRow";
|
|
1372
|
-
cells: {
|
|
1373
|
-
type: "TableCell";
|
|
1374
|
-
inlines: ({
|
|
1375
|
-
value: string;
|
|
1376
|
-
type: "FreeText";
|
|
1377
|
-
} | {
|
|
1378
|
-
type: "Space";
|
|
1379
|
-
} | {
|
|
1380
|
-
value: string;
|
|
1381
|
-
type: "HighlightedText";
|
|
1382
|
-
highlight?: [number, number] | undefined;
|
|
1383
|
-
} | {
|
|
1384
|
-
value: string;
|
|
1385
|
-
type: "ColorText";
|
|
1386
|
-
color: string;
|
|
1387
|
-
highlight?: [number, number] | undefined;
|
|
1388
|
-
} | {
|
|
1389
|
-
value: string;
|
|
1390
|
-
type: "BoldText";
|
|
1391
|
-
highlight?: [number, number] | undefined;
|
|
1392
|
-
} | {
|
|
1393
|
-
length: number;
|
|
1394
|
-
type: "InlineInput";
|
|
1395
|
-
inputType: "string";
|
|
1396
|
-
name: string;
|
|
1397
|
-
answer?: string | number | undefined;
|
|
1398
|
-
} | {
|
|
1399
|
-
type: "InlineInput";
|
|
1400
|
-
inputType: "numeric";
|
|
1401
|
-
name: string;
|
|
1402
|
-
digits: number;
|
|
1403
|
-
answer?: string | number | undefined;
|
|
1404
|
-
})[];
|
|
1405
|
-
colspan?: number | undefined;
|
|
1406
|
-
}[];
|
|
1839
|
+
type: "TableRow";
|
|
1840
|
+
cells: {
|
|
1841
|
+
type: "TableCell";
|
|
1842
|
+
inlines: ({
|
|
1843
|
+
value: string;
|
|
1844
|
+
type: "FreeText";
|
|
1845
|
+
} | {
|
|
1846
|
+
type: "Space";
|
|
1847
|
+
} | {
|
|
1848
|
+
value: string;
|
|
1849
|
+
type: "HighlightedText";
|
|
1850
|
+
highlight?: [number, number] | undefined;
|
|
1851
|
+
} | {
|
|
1852
|
+
value: string;
|
|
1853
|
+
type: "ColorText";
|
|
1854
|
+
color: string;
|
|
1855
|
+
highlight?: [number, number] | undefined;
|
|
1856
|
+
} | {
|
|
1857
|
+
value: string;
|
|
1858
|
+
type: "BoldText";
|
|
1859
|
+
highlight?: [number, number] | undefined;
|
|
1860
|
+
} | {
|
|
1861
|
+
length: number;
|
|
1862
|
+
type: "InlineInput";
|
|
1863
|
+
inputType: "string";
|
|
1864
|
+
name: string;
|
|
1865
|
+
answer?: string | number | undefined;
|
|
1866
|
+
} | {
|
|
1867
|
+
type: "InlineInput";
|
|
1868
|
+
inputType: "numeric";
|
|
1869
|
+
name: string;
|
|
1870
|
+
digits: number;
|
|
1871
|
+
answer?: string | number | undefined;
|
|
1872
|
+
})[];
|
|
1873
|
+
colspan?: number | undefined;
|
|
1874
|
+
}[];
|
|
1875
|
+
}>, "many">;
|
|
1876
|
+
}, "strip", z.ZodTypeAny, {
|
|
1877
|
+
type: "TableBlock";
|
|
1878
|
+
cols: number;
|
|
1879
|
+
rows: {
|
|
1880
|
+
type: "TableRow";
|
|
1881
|
+
cells: {
|
|
1882
|
+
type: "TableCell";
|
|
1883
|
+
inlines: ({
|
|
1884
|
+
value: string;
|
|
1885
|
+
type: "FreeText";
|
|
1886
|
+
} | {
|
|
1887
|
+
type: "Space";
|
|
1888
|
+
} | {
|
|
1889
|
+
value: string;
|
|
1890
|
+
type: "HighlightedText";
|
|
1891
|
+
highlight?: [number, number] | undefined;
|
|
1892
|
+
} | {
|
|
1893
|
+
value: string;
|
|
1894
|
+
type: "ColorText";
|
|
1895
|
+
color: string;
|
|
1896
|
+
highlight?: [number, number] | undefined;
|
|
1897
|
+
} | {
|
|
1898
|
+
value: string;
|
|
1899
|
+
type: "BoldText";
|
|
1900
|
+
highlight?: [number, number] | undefined;
|
|
1901
|
+
} | {
|
|
1902
|
+
length: number;
|
|
1903
|
+
type: "InlineInput";
|
|
1904
|
+
inputType: "string";
|
|
1905
|
+
name: string;
|
|
1906
|
+
answer?: string | number | undefined;
|
|
1907
|
+
} | {
|
|
1908
|
+
type: "InlineInput";
|
|
1909
|
+
inputType: "numeric";
|
|
1910
|
+
name: string;
|
|
1911
|
+
digits: number;
|
|
1912
|
+
answer?: string | number | undefined;
|
|
1913
|
+
})[];
|
|
1914
|
+
colspan?: number | undefined;
|
|
1915
|
+
}[];
|
|
1916
|
+
}[];
|
|
1917
|
+
}, {
|
|
1918
|
+
type: "TableBlock";
|
|
1919
|
+
cols: number;
|
|
1920
|
+
rows: {
|
|
1921
|
+
type: "TableRow";
|
|
1922
|
+
cells: {
|
|
1923
|
+
type: "TableCell";
|
|
1924
|
+
inlines: ({
|
|
1925
|
+
value: string;
|
|
1926
|
+
type: "FreeText";
|
|
1927
|
+
} | {
|
|
1928
|
+
type: "Space";
|
|
1929
|
+
} | {
|
|
1930
|
+
value: string;
|
|
1931
|
+
type: "HighlightedText";
|
|
1932
|
+
highlight?: [number, number] | undefined;
|
|
1933
|
+
} | {
|
|
1934
|
+
value: string;
|
|
1935
|
+
type: "ColorText";
|
|
1936
|
+
color: string;
|
|
1937
|
+
highlight?: [number, number] | undefined;
|
|
1938
|
+
} | {
|
|
1939
|
+
value: string;
|
|
1940
|
+
type: "BoldText";
|
|
1941
|
+
highlight?: [number, number] | undefined;
|
|
1942
|
+
} | {
|
|
1943
|
+
length: number;
|
|
1944
|
+
type: "InlineInput";
|
|
1945
|
+
inputType: "string";
|
|
1946
|
+
name: string;
|
|
1947
|
+
answer?: string | number | undefined;
|
|
1948
|
+
} | {
|
|
1949
|
+
type: "InlineInput";
|
|
1950
|
+
inputType: "numeric";
|
|
1951
|
+
name: string;
|
|
1952
|
+
digits: number;
|
|
1953
|
+
answer?: string | number | undefined;
|
|
1954
|
+
})[];
|
|
1955
|
+
colspan?: number | undefined;
|
|
1956
|
+
}[];
|
|
1957
|
+
}[];
|
|
1958
|
+
}>, z.ZodObject<{
|
|
1959
|
+
type: z.ZodLiteral<"RadioOptions">;
|
|
1960
|
+
name: z.ZodString;
|
|
1961
|
+
options: z.ZodArray<z.ZodString, "many">;
|
|
1962
|
+
answer: z.ZodString;
|
|
1963
|
+
}, "strip", z.ZodTypeAny, {
|
|
1964
|
+
type: "RadioOptions";
|
|
1965
|
+
options: string[];
|
|
1966
|
+
name: string;
|
|
1967
|
+
answer: string;
|
|
1968
|
+
}, {
|
|
1969
|
+
type: "RadioOptions";
|
|
1970
|
+
options: string[];
|
|
1971
|
+
name: string;
|
|
1972
|
+
answer: string;
|
|
1973
|
+
}>, z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
1974
|
+
type: z.ZodLiteral<"NumberLineBlock">;
|
|
1975
|
+
min: z.ZodNumber;
|
|
1976
|
+
max: z.ZodNumber;
|
|
1977
|
+
step: z.ZodDefault<z.ZodNumber>;
|
|
1978
|
+
minorTicks: z.ZodOptional<z.ZodNumber>;
|
|
1979
|
+
style: z.ZodOptional<z.ZodEnum<["arrow-right", "arrow-left", "arrow-both", "line"]>>;
|
|
1980
|
+
positions: z.ZodArray<z.ZodObject<{
|
|
1981
|
+
type: z.ZodLiteral<"NumberLinePosition">;
|
|
1982
|
+
value: z.ZodNumber;
|
|
1983
|
+
inlines: z.ZodArray<z.ZodUnion<[z.ZodObject<{
|
|
1984
|
+
type: z.ZodLiteral<"FreeText">;
|
|
1985
|
+
value: z.ZodString;
|
|
1986
|
+
}, "strip", z.ZodTypeAny, {
|
|
1987
|
+
value: string;
|
|
1988
|
+
type: "FreeText";
|
|
1989
|
+
}, {
|
|
1990
|
+
value: string;
|
|
1991
|
+
type: "FreeText";
|
|
1992
|
+
}>, z.ZodObject<{
|
|
1993
|
+
type: z.ZodLiteral<"Space">;
|
|
1994
|
+
}, "strip", z.ZodTypeAny, {
|
|
1995
|
+
type: "Space";
|
|
1996
|
+
}, {
|
|
1997
|
+
type: "Space";
|
|
1998
|
+
}>, z.ZodObject<{
|
|
1999
|
+
type: z.ZodLiteral<"HighlightedText">;
|
|
2000
|
+
value: z.ZodString;
|
|
2001
|
+
highlight: z.ZodOptional<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>;
|
|
2002
|
+
}, "strip", z.ZodTypeAny, {
|
|
2003
|
+
value: string;
|
|
2004
|
+
type: "HighlightedText";
|
|
2005
|
+
highlight?: [number, number] | undefined;
|
|
2006
|
+
}, {
|
|
2007
|
+
value: string;
|
|
2008
|
+
type: "HighlightedText";
|
|
2009
|
+
highlight?: [number, number] | undefined;
|
|
2010
|
+
}>, z.ZodObject<{
|
|
2011
|
+
type: z.ZodLiteral<"ColorText">;
|
|
2012
|
+
value: z.ZodString;
|
|
2013
|
+
color: z.ZodString;
|
|
2014
|
+
highlight: z.ZodOptional<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>;
|
|
2015
|
+
}, "strip", z.ZodTypeAny, {
|
|
2016
|
+
value: string;
|
|
2017
|
+
type: "ColorText";
|
|
2018
|
+
color: string;
|
|
2019
|
+
highlight?: [number, number] | undefined;
|
|
2020
|
+
}, {
|
|
2021
|
+
value: string;
|
|
2022
|
+
type: "ColorText";
|
|
2023
|
+
color: string;
|
|
2024
|
+
highlight?: [number, number] | undefined;
|
|
2025
|
+
}>, z.ZodObject<{
|
|
2026
|
+
type: z.ZodLiteral<"BoldText">;
|
|
2027
|
+
value: z.ZodString;
|
|
2028
|
+
highlight: z.ZodOptional<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>;
|
|
2029
|
+
}, "strip", z.ZodTypeAny, {
|
|
2030
|
+
value: string;
|
|
2031
|
+
type: "BoldText";
|
|
2032
|
+
highlight?: [number, number] | undefined;
|
|
2033
|
+
}, {
|
|
2034
|
+
value: string;
|
|
2035
|
+
type: "BoldText";
|
|
2036
|
+
highlight?: [number, number] | undefined;
|
|
2037
|
+
}>, z.ZodDiscriminatedUnion<"inputType", [z.ZodObject<{
|
|
2038
|
+
type: z.ZodLiteral<"InlineInput">;
|
|
2039
|
+
name: z.ZodString;
|
|
2040
|
+
inputType: z.ZodLiteral<"string">;
|
|
2041
|
+
length: z.ZodNumber;
|
|
2042
|
+
answer: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
|
|
2043
|
+
}, "strip", z.ZodTypeAny, {
|
|
2044
|
+
length: number;
|
|
2045
|
+
type: "InlineInput";
|
|
2046
|
+
inputType: "string";
|
|
2047
|
+
name: string;
|
|
2048
|
+
answer?: string | number | undefined;
|
|
2049
|
+
}, {
|
|
2050
|
+
length: number;
|
|
2051
|
+
type: "InlineInput";
|
|
2052
|
+
inputType: "string";
|
|
2053
|
+
name: string;
|
|
2054
|
+
answer?: string | number | undefined;
|
|
2055
|
+
}>, z.ZodObject<{
|
|
2056
|
+
type: z.ZodLiteral<"InlineInput">;
|
|
2057
|
+
name: z.ZodString;
|
|
2058
|
+
inputType: z.ZodLiteral<"numeric">;
|
|
2059
|
+
digits: z.ZodNumber;
|
|
2060
|
+
answer: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
|
|
2061
|
+
}, "strip", z.ZodTypeAny, {
|
|
2062
|
+
type: "InlineInput";
|
|
2063
|
+
inputType: "numeric";
|
|
2064
|
+
name: string;
|
|
2065
|
+
digits: number;
|
|
2066
|
+
answer?: string | number | undefined;
|
|
2067
|
+
}, {
|
|
2068
|
+
type: "InlineInput";
|
|
2069
|
+
inputType: "numeric";
|
|
2070
|
+
name: string;
|
|
2071
|
+
digits: number;
|
|
2072
|
+
answer?: string | number | undefined;
|
|
2073
|
+
}>]>]>, "many">;
|
|
2074
|
+
}, "strip", z.ZodTypeAny, {
|
|
2075
|
+
value: number;
|
|
2076
|
+
type: "NumberLinePosition";
|
|
2077
|
+
inlines: ({
|
|
2078
|
+
value: string;
|
|
2079
|
+
type: "FreeText";
|
|
2080
|
+
} | {
|
|
2081
|
+
type: "Space";
|
|
2082
|
+
} | {
|
|
2083
|
+
value: string;
|
|
2084
|
+
type: "HighlightedText";
|
|
2085
|
+
highlight?: [number, number] | undefined;
|
|
2086
|
+
} | {
|
|
2087
|
+
value: string;
|
|
2088
|
+
type: "ColorText";
|
|
2089
|
+
color: string;
|
|
2090
|
+
highlight?: [number, number] | undefined;
|
|
2091
|
+
} | {
|
|
2092
|
+
value: string;
|
|
2093
|
+
type: "BoldText";
|
|
2094
|
+
highlight?: [number, number] | undefined;
|
|
2095
|
+
} | {
|
|
2096
|
+
length: number;
|
|
2097
|
+
type: "InlineInput";
|
|
2098
|
+
inputType: "string";
|
|
2099
|
+
name: string;
|
|
2100
|
+
answer?: string | number | undefined;
|
|
2101
|
+
} | {
|
|
2102
|
+
type: "InlineInput";
|
|
2103
|
+
inputType: "numeric";
|
|
2104
|
+
name: string;
|
|
2105
|
+
digits: number;
|
|
2106
|
+
answer?: string | number | undefined;
|
|
2107
|
+
})[];
|
|
2108
|
+
}, {
|
|
2109
|
+
value: number;
|
|
2110
|
+
type: "NumberLinePosition";
|
|
2111
|
+
inlines: ({
|
|
2112
|
+
value: string;
|
|
2113
|
+
type: "FreeText";
|
|
2114
|
+
} | {
|
|
2115
|
+
type: "Space";
|
|
2116
|
+
} | {
|
|
2117
|
+
value: string;
|
|
2118
|
+
type: "HighlightedText";
|
|
2119
|
+
highlight?: [number, number] | undefined;
|
|
2120
|
+
} | {
|
|
2121
|
+
value: string;
|
|
2122
|
+
type: "ColorText";
|
|
2123
|
+
color: string;
|
|
2124
|
+
highlight?: [number, number] | undefined;
|
|
2125
|
+
} | {
|
|
2126
|
+
value: string;
|
|
2127
|
+
type: "BoldText";
|
|
2128
|
+
highlight?: [number, number] | undefined;
|
|
2129
|
+
} | {
|
|
2130
|
+
length: number;
|
|
2131
|
+
type: "InlineInput";
|
|
2132
|
+
inputType: "string";
|
|
2133
|
+
name: string;
|
|
2134
|
+
answer?: string | number | undefined;
|
|
2135
|
+
} | {
|
|
2136
|
+
type: "InlineInput";
|
|
2137
|
+
inputType: "numeric";
|
|
2138
|
+
name: string;
|
|
2139
|
+
digits: number;
|
|
2140
|
+
answer?: string | number | undefined;
|
|
2141
|
+
})[];
|
|
1407
2142
|
}>, "many">;
|
|
1408
2143
|
}, "strip", z.ZodTypeAny, {
|
|
1409
|
-
type: "
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
2144
|
+
type: "NumberLineBlock";
|
|
2145
|
+
min: number;
|
|
2146
|
+
max: number;
|
|
2147
|
+
step: number;
|
|
2148
|
+
positions: {
|
|
2149
|
+
value: number;
|
|
2150
|
+
type: "NumberLinePosition";
|
|
2151
|
+
inlines: ({
|
|
2152
|
+
value: string;
|
|
2153
|
+
type: "FreeText";
|
|
2154
|
+
} | {
|
|
2155
|
+
type: "Space";
|
|
2156
|
+
} | {
|
|
2157
|
+
value: string;
|
|
2158
|
+
type: "HighlightedText";
|
|
2159
|
+
highlight?: [number, number] | undefined;
|
|
2160
|
+
} | {
|
|
2161
|
+
value: string;
|
|
2162
|
+
type: "ColorText";
|
|
2163
|
+
color: string;
|
|
2164
|
+
highlight?: [number, number] | undefined;
|
|
2165
|
+
} | {
|
|
2166
|
+
value: string;
|
|
2167
|
+
type: "BoldText";
|
|
2168
|
+
highlight?: [number, number] | undefined;
|
|
2169
|
+
} | {
|
|
2170
|
+
length: number;
|
|
2171
|
+
type: "InlineInput";
|
|
2172
|
+
inputType: "string";
|
|
2173
|
+
name: string;
|
|
2174
|
+
answer?: string | number | undefined;
|
|
2175
|
+
} | {
|
|
2176
|
+
type: "InlineInput";
|
|
2177
|
+
inputType: "numeric";
|
|
2178
|
+
name: string;
|
|
2179
|
+
digits: number;
|
|
2180
|
+
answer?: string | number | undefined;
|
|
2181
|
+
})[];
|
|
2182
|
+
}[];
|
|
2183
|
+
minorTicks?: number | undefined;
|
|
2184
|
+
style?: "arrow-right" | "arrow-left" | "arrow-both" | "line" | undefined;
|
|
2185
|
+
}, {
|
|
2186
|
+
type: "NumberLineBlock";
|
|
2187
|
+
min: number;
|
|
2188
|
+
max: number;
|
|
2189
|
+
positions: {
|
|
2190
|
+
value: number;
|
|
2191
|
+
type: "NumberLinePosition";
|
|
2192
|
+
inlines: ({
|
|
2193
|
+
value: string;
|
|
2194
|
+
type: "FreeText";
|
|
2195
|
+
} | {
|
|
2196
|
+
type: "Space";
|
|
2197
|
+
} | {
|
|
2198
|
+
value: string;
|
|
2199
|
+
type: "HighlightedText";
|
|
2200
|
+
highlight?: [number, number] | undefined;
|
|
2201
|
+
} | {
|
|
2202
|
+
value: string;
|
|
2203
|
+
type: "ColorText";
|
|
2204
|
+
color: string;
|
|
2205
|
+
highlight?: [number, number] | undefined;
|
|
2206
|
+
} | {
|
|
2207
|
+
value: string;
|
|
2208
|
+
type: "BoldText";
|
|
2209
|
+
highlight?: [number, number] | undefined;
|
|
2210
|
+
} | {
|
|
2211
|
+
length: number;
|
|
2212
|
+
type: "InlineInput";
|
|
2213
|
+
inputType: "string";
|
|
2214
|
+
name: string;
|
|
2215
|
+
answer?: string | number | undefined;
|
|
2216
|
+
} | {
|
|
2217
|
+
type: "InlineInput";
|
|
2218
|
+
inputType: "numeric";
|
|
2219
|
+
name: string;
|
|
2220
|
+
digits: number;
|
|
2221
|
+
answer?: string | number | undefined;
|
|
2222
|
+
})[];
|
|
2223
|
+
}[];
|
|
2224
|
+
step?: number | undefined;
|
|
2225
|
+
minorTicks?: number | undefined;
|
|
2226
|
+
style?: "arrow-right" | "arrow-left" | "arrow-both" | "line" | undefined;
|
|
2227
|
+
}>, {
|
|
2228
|
+
type: "NumberLineBlock";
|
|
2229
|
+
min: number;
|
|
2230
|
+
max: number;
|
|
2231
|
+
step: number;
|
|
2232
|
+
positions: {
|
|
2233
|
+
value: number;
|
|
2234
|
+
type: "NumberLinePosition";
|
|
2235
|
+
inlines: ({
|
|
2236
|
+
value: string;
|
|
2237
|
+
type: "FreeText";
|
|
2238
|
+
} | {
|
|
2239
|
+
type: "Space";
|
|
2240
|
+
} | {
|
|
2241
|
+
value: string;
|
|
2242
|
+
type: "HighlightedText";
|
|
2243
|
+
highlight?: [number, number] | undefined;
|
|
2244
|
+
} | {
|
|
2245
|
+
value: string;
|
|
2246
|
+
type: "ColorText";
|
|
2247
|
+
color: string;
|
|
2248
|
+
highlight?: [number, number] | undefined;
|
|
2249
|
+
} | {
|
|
2250
|
+
value: string;
|
|
2251
|
+
type: "BoldText";
|
|
2252
|
+
highlight?: [number, number] | undefined;
|
|
2253
|
+
} | {
|
|
2254
|
+
length: number;
|
|
2255
|
+
type: "InlineInput";
|
|
2256
|
+
inputType: "string";
|
|
2257
|
+
name: string;
|
|
2258
|
+
answer?: string | number | undefined;
|
|
2259
|
+
} | {
|
|
2260
|
+
type: "InlineInput";
|
|
2261
|
+
inputType: "numeric";
|
|
2262
|
+
name: string;
|
|
2263
|
+
digits: number;
|
|
2264
|
+
answer?: string | number | undefined;
|
|
2265
|
+
})[];
|
|
2266
|
+
}[];
|
|
2267
|
+
minorTicks?: number | undefined;
|
|
2268
|
+
style?: "arrow-right" | "arrow-left" | "arrow-both" | "line" | undefined;
|
|
2269
|
+
}, {
|
|
2270
|
+
type: "NumberLineBlock";
|
|
2271
|
+
min: number;
|
|
2272
|
+
max: number;
|
|
2273
|
+
positions: {
|
|
2274
|
+
value: number;
|
|
2275
|
+
type: "NumberLinePosition";
|
|
2276
|
+
inlines: ({
|
|
2277
|
+
value: string;
|
|
2278
|
+
type: "FreeText";
|
|
2279
|
+
} | {
|
|
2280
|
+
type: "Space";
|
|
2281
|
+
} | {
|
|
2282
|
+
value: string;
|
|
2283
|
+
type: "HighlightedText";
|
|
2284
|
+
highlight?: [number, number] | undefined;
|
|
2285
|
+
} | {
|
|
2286
|
+
value: string;
|
|
2287
|
+
type: "ColorText";
|
|
2288
|
+
color: string;
|
|
2289
|
+
highlight?: [number, number] | undefined;
|
|
2290
|
+
} | {
|
|
2291
|
+
value: string;
|
|
2292
|
+
type: "BoldText";
|
|
2293
|
+
highlight?: [number, number] | undefined;
|
|
2294
|
+
} | {
|
|
2295
|
+
length: number;
|
|
2296
|
+
type: "InlineInput";
|
|
2297
|
+
inputType: "string";
|
|
2298
|
+
name: string;
|
|
2299
|
+
answer?: string | number | undefined;
|
|
2300
|
+
} | {
|
|
2301
|
+
type: "InlineInput";
|
|
2302
|
+
inputType: "numeric";
|
|
2303
|
+
name: string;
|
|
2304
|
+
digits: number;
|
|
2305
|
+
answer?: string | number | undefined;
|
|
2306
|
+
})[];
|
|
2307
|
+
}[];
|
|
2308
|
+
step?: number | undefined;
|
|
2309
|
+
minorTicks?: number | undefined;
|
|
2310
|
+
style?: "arrow-right" | "arrow-left" | "arrow-both" | "line" | undefined;
|
|
2311
|
+
}>, {
|
|
2312
|
+
type: "NumberLineBlock";
|
|
2313
|
+
min: number;
|
|
2314
|
+
max: number;
|
|
2315
|
+
step: number;
|
|
2316
|
+
positions: {
|
|
2317
|
+
value: number;
|
|
2318
|
+
type: "NumberLinePosition";
|
|
2319
|
+
inlines: ({
|
|
2320
|
+
value: string;
|
|
2321
|
+
type: "FreeText";
|
|
2322
|
+
} | {
|
|
2323
|
+
type: "Space";
|
|
2324
|
+
} | {
|
|
2325
|
+
value: string;
|
|
2326
|
+
type: "HighlightedText";
|
|
2327
|
+
highlight?: [number, number] | undefined;
|
|
2328
|
+
} | {
|
|
2329
|
+
value: string;
|
|
2330
|
+
type: "ColorText";
|
|
2331
|
+
color: string;
|
|
2332
|
+
highlight?: [number, number] | undefined;
|
|
2333
|
+
} | {
|
|
2334
|
+
value: string;
|
|
2335
|
+
type: "BoldText";
|
|
2336
|
+
highlight?: [number, number] | undefined;
|
|
2337
|
+
} | {
|
|
2338
|
+
length: number;
|
|
2339
|
+
type: "InlineInput";
|
|
2340
|
+
inputType: "string";
|
|
2341
|
+
name: string;
|
|
2342
|
+
answer?: string | number | undefined;
|
|
2343
|
+
} | {
|
|
2344
|
+
type: "InlineInput";
|
|
2345
|
+
inputType: "numeric";
|
|
2346
|
+
name: string;
|
|
2347
|
+
digits: number;
|
|
2348
|
+
answer?: string | number | undefined;
|
|
2349
|
+
})[];
|
|
1448
2350
|
}[];
|
|
2351
|
+
minorTicks?: number | undefined;
|
|
2352
|
+
style?: "arrow-right" | "arrow-left" | "arrow-both" | "line" | undefined;
|
|
1449
2353
|
}, {
|
|
1450
|
-
type: "
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
colspan?: number | undefined;
|
|
1488
|
-
}[];
|
|
2354
|
+
type: "NumberLineBlock";
|
|
2355
|
+
min: number;
|
|
2356
|
+
max: number;
|
|
2357
|
+
positions: {
|
|
2358
|
+
value: number;
|
|
2359
|
+
type: "NumberLinePosition";
|
|
2360
|
+
inlines: ({
|
|
2361
|
+
value: string;
|
|
2362
|
+
type: "FreeText";
|
|
2363
|
+
} | {
|
|
2364
|
+
type: "Space";
|
|
2365
|
+
} | {
|
|
2366
|
+
value: string;
|
|
2367
|
+
type: "HighlightedText";
|
|
2368
|
+
highlight?: [number, number] | undefined;
|
|
2369
|
+
} | {
|
|
2370
|
+
value: string;
|
|
2371
|
+
type: "ColorText";
|
|
2372
|
+
color: string;
|
|
2373
|
+
highlight?: [number, number] | undefined;
|
|
2374
|
+
} | {
|
|
2375
|
+
value: string;
|
|
2376
|
+
type: "BoldText";
|
|
2377
|
+
highlight?: [number, number] | undefined;
|
|
2378
|
+
} | {
|
|
2379
|
+
length: number;
|
|
2380
|
+
type: "InlineInput";
|
|
2381
|
+
inputType: "string";
|
|
2382
|
+
name: string;
|
|
2383
|
+
answer?: string | number | undefined;
|
|
2384
|
+
} | {
|
|
2385
|
+
type: "InlineInput";
|
|
2386
|
+
inputType: "numeric";
|
|
2387
|
+
name: string;
|
|
2388
|
+
digits: number;
|
|
2389
|
+
answer?: string | number | undefined;
|
|
2390
|
+
})[];
|
|
1489
2391
|
}[];
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
options: z.ZodArray<z.ZodString, "many">;
|
|
1494
|
-
answer: z.ZodString;
|
|
1495
|
-
}, "strip", z.ZodTypeAny, {
|
|
1496
|
-
type: "RadioOptions";
|
|
1497
|
-
options: string[];
|
|
1498
|
-
name: string;
|
|
1499
|
-
answer: string;
|
|
1500
|
-
}, {
|
|
1501
|
-
type: "RadioOptions";
|
|
1502
|
-
options: string[];
|
|
1503
|
-
name: string;
|
|
1504
|
-
answer: string;
|
|
2392
|
+
step?: number | undefined;
|
|
2393
|
+
minorTicks?: number | undefined;
|
|
2394
|
+
style?: "arrow-right" | "arrow-left" | "arrow-both" | "line" | undefined;
|
|
1505
2395
|
}>]>, "many">;
|
|
1506
2396
|
tools: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
1507
2397
|
type: z.ZodLiteral<"DragOptions">;
|
|
@@ -1525,7 +2415,7 @@ export declare const ExerciseDocumentSchema: z.ZodObject<{
|
|
|
1525
2415
|
includeOperators?: boolean | undefined;
|
|
1526
2416
|
includeDecimal?: boolean | undefined;
|
|
1527
2417
|
}>]>, "many">>;
|
|
1528
|
-
validation: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
2418
|
+
validation: z.ZodOptional<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
1529
2419
|
type: z.ZodLiteral<"SimpleValidation">;
|
|
1530
2420
|
}, "strip", z.ZodTypeAny, {
|
|
1531
2421
|
type: "SimpleValidation";
|
|
@@ -1540,14 +2430,8 @@ export declare const ExerciseDocumentSchema: z.ZodObject<{
|
|
|
1540
2430
|
}, {
|
|
1541
2431
|
expression: string;
|
|
1542
2432
|
type: "ExpressionValidation";
|
|
1543
|
-
}>]
|
|
2433
|
+
}>]>>;
|
|
1544
2434
|
}, "strip", z.ZodTypeAny, {
|
|
1545
|
-
validation: {
|
|
1546
|
-
type: "SimpleValidation";
|
|
1547
|
-
} | {
|
|
1548
|
-
expression: string;
|
|
1549
|
-
type: "ExpressionValidation";
|
|
1550
|
-
};
|
|
1551
2435
|
type: "ExerciseDocument";
|
|
1552
2436
|
lines: ({
|
|
1553
2437
|
type: "LineBlock";
|
|
@@ -1582,6 +2466,48 @@ export declare const ExerciseDocumentSchema: z.ZodObject<{
|
|
|
1582
2466
|
digits: number;
|
|
1583
2467
|
answer?: string | number | undefined;
|
|
1584
2468
|
})[];
|
|
2469
|
+
} | {
|
|
2470
|
+
type: "NumberLineBlock";
|
|
2471
|
+
min: number;
|
|
2472
|
+
max: number;
|
|
2473
|
+
step: number;
|
|
2474
|
+
positions: {
|
|
2475
|
+
value: number;
|
|
2476
|
+
type: "NumberLinePosition";
|
|
2477
|
+
inlines: ({
|
|
2478
|
+
value: string;
|
|
2479
|
+
type: "FreeText";
|
|
2480
|
+
} | {
|
|
2481
|
+
type: "Space";
|
|
2482
|
+
} | {
|
|
2483
|
+
value: string;
|
|
2484
|
+
type: "HighlightedText";
|
|
2485
|
+
highlight?: [number, number] | undefined;
|
|
2486
|
+
} | {
|
|
2487
|
+
value: string;
|
|
2488
|
+
type: "ColorText";
|
|
2489
|
+
color: string;
|
|
2490
|
+
highlight?: [number, number] | undefined;
|
|
2491
|
+
} | {
|
|
2492
|
+
value: string;
|
|
2493
|
+
type: "BoldText";
|
|
2494
|
+
highlight?: [number, number] | undefined;
|
|
2495
|
+
} | {
|
|
2496
|
+
length: number;
|
|
2497
|
+
type: "InlineInput";
|
|
2498
|
+
inputType: "string";
|
|
2499
|
+
name: string;
|
|
2500
|
+
answer?: string | number | undefined;
|
|
2501
|
+
} | {
|
|
2502
|
+
type: "InlineInput";
|
|
2503
|
+
inputType: "numeric";
|
|
2504
|
+
name: string;
|
|
2505
|
+
digits: number;
|
|
2506
|
+
answer?: string | number | undefined;
|
|
2507
|
+
})[];
|
|
2508
|
+
}[];
|
|
2509
|
+
minorTicks?: number | undefined;
|
|
2510
|
+
style?: "arrow-right" | "arrow-left" | "arrow-both" | "line" | undefined;
|
|
1585
2511
|
} | {
|
|
1586
2512
|
type: "TableBlock";
|
|
1587
2513
|
cols: number;
|
|
@@ -1633,6 +2559,12 @@ export declare const ExerciseDocumentSchema: z.ZodObject<{
|
|
|
1633
2559
|
value: string;
|
|
1634
2560
|
type: "TextBlock";
|
|
1635
2561
|
} | undefined;
|
|
2562
|
+
validation?: {
|
|
2563
|
+
type: "SimpleValidation";
|
|
2564
|
+
} | {
|
|
2565
|
+
expression: string;
|
|
2566
|
+
type: "ExpressionValidation";
|
|
2567
|
+
} | undefined;
|
|
1636
2568
|
tools?: ({
|
|
1637
2569
|
type: "DragOptions";
|
|
1638
2570
|
options: string[];
|
|
@@ -1642,12 +2574,6 @@ export declare const ExerciseDocumentSchema: z.ZodObject<{
|
|
|
1642
2574
|
includeDecimal?: boolean | undefined;
|
|
1643
2575
|
})[] | undefined;
|
|
1644
2576
|
}, {
|
|
1645
|
-
validation: {
|
|
1646
|
-
type: "SimpleValidation";
|
|
1647
|
-
} | {
|
|
1648
|
-
expression: string;
|
|
1649
|
-
type: "ExpressionValidation";
|
|
1650
|
-
};
|
|
1651
2577
|
type: "ExerciseDocument";
|
|
1652
2578
|
lines: ({
|
|
1653
2579
|
type: "LineBlock";
|
|
@@ -1682,6 +2608,48 @@ export declare const ExerciseDocumentSchema: z.ZodObject<{
|
|
|
1682
2608
|
digits: number;
|
|
1683
2609
|
answer?: string | number | undefined;
|
|
1684
2610
|
})[];
|
|
2611
|
+
} | {
|
|
2612
|
+
type: "NumberLineBlock";
|
|
2613
|
+
min: number;
|
|
2614
|
+
max: number;
|
|
2615
|
+
positions: {
|
|
2616
|
+
value: number;
|
|
2617
|
+
type: "NumberLinePosition";
|
|
2618
|
+
inlines: ({
|
|
2619
|
+
value: string;
|
|
2620
|
+
type: "FreeText";
|
|
2621
|
+
} | {
|
|
2622
|
+
type: "Space";
|
|
2623
|
+
} | {
|
|
2624
|
+
value: string;
|
|
2625
|
+
type: "HighlightedText";
|
|
2626
|
+
highlight?: [number, number] | undefined;
|
|
2627
|
+
} | {
|
|
2628
|
+
value: string;
|
|
2629
|
+
type: "ColorText";
|
|
2630
|
+
color: string;
|
|
2631
|
+
highlight?: [number, number] | undefined;
|
|
2632
|
+
} | {
|
|
2633
|
+
value: string;
|
|
2634
|
+
type: "BoldText";
|
|
2635
|
+
highlight?: [number, number] | undefined;
|
|
2636
|
+
} | {
|
|
2637
|
+
length: number;
|
|
2638
|
+
type: "InlineInput";
|
|
2639
|
+
inputType: "string";
|
|
2640
|
+
name: string;
|
|
2641
|
+
answer?: string | number | undefined;
|
|
2642
|
+
} | {
|
|
2643
|
+
type: "InlineInput";
|
|
2644
|
+
inputType: "numeric";
|
|
2645
|
+
name: string;
|
|
2646
|
+
digits: number;
|
|
2647
|
+
answer?: string | number | undefined;
|
|
2648
|
+
})[];
|
|
2649
|
+
}[];
|
|
2650
|
+
step?: number | undefined;
|
|
2651
|
+
minorTicks?: number | undefined;
|
|
2652
|
+
style?: "arrow-right" | "arrow-left" | "arrow-both" | "line" | undefined;
|
|
1685
2653
|
} | {
|
|
1686
2654
|
type: "TableBlock";
|
|
1687
2655
|
cols: number;
|
|
@@ -1733,6 +2701,12 @@ export declare const ExerciseDocumentSchema: z.ZodObject<{
|
|
|
1733
2701
|
value: string;
|
|
1734
2702
|
type: "TextBlock";
|
|
1735
2703
|
} | undefined;
|
|
2704
|
+
validation?: {
|
|
2705
|
+
type: "SimpleValidation";
|
|
2706
|
+
} | {
|
|
2707
|
+
expression: string;
|
|
2708
|
+
type: "ExpressionValidation";
|
|
2709
|
+
} | undefined;
|
|
1736
2710
|
tools?: ({
|
|
1737
2711
|
type: "DragOptions";
|
|
1738
2712
|
options: string[];
|
|
@@ -1804,7 +2778,7 @@ export declare const ExerciseJSONSchema: z.ZodObject<{
|
|
|
1804
2778
|
includeOperators?: boolean | undefined;
|
|
1805
2779
|
includeDecimal?: boolean | undefined;
|
|
1806
2780
|
}>]>>;
|
|
1807
|
-
validation: z.ZodObject<{
|
|
2781
|
+
validation: z.ZodOptional<z.ZodObject<{
|
|
1808
2782
|
mode: z.ZodEnum<["simple", "expression"]>;
|
|
1809
2783
|
answers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodNumber]>>>;
|
|
1810
2784
|
expression: z.ZodOptional<z.ZodString>;
|
|
@@ -1819,7 +2793,7 @@ export declare const ExerciseJSONSchema: z.ZodObject<{
|
|
|
1819
2793
|
expression?: string | undefined;
|
|
1820
2794
|
answers?: Record<string, string | number> | undefined;
|
|
1821
2795
|
variables?: string[] | undefined;
|
|
1822
|
-
}
|
|
2796
|
+
}>>;
|
|
1823
2797
|
meta: z.ZodOptional<z.ZodObject<{
|
|
1824
2798
|
createdAt: z.ZodOptional<z.ZodString>;
|
|
1825
2799
|
author: z.ZodOptional<z.ZodString>;
|
|
@@ -1837,12 +2811,6 @@ export declare const ExerciseJSONSchema: z.ZodObject<{
|
|
|
1837
2811
|
difficulty?: number | undefined;
|
|
1838
2812
|
}>>;
|
|
1839
2813
|
}, "strip", z.ZodTypeAny, {
|
|
1840
|
-
validation: {
|
|
1841
|
-
mode: "simple" | "expression";
|
|
1842
|
-
expression?: string | undefined;
|
|
1843
|
-
answers?: Record<string, string | number> | undefined;
|
|
1844
|
-
variables?: string[] | undefined;
|
|
1845
|
-
};
|
|
1846
2814
|
version: "2.0";
|
|
1847
2815
|
layout: any[];
|
|
1848
2816
|
widgets: Record<string, {
|
|
@@ -1864,6 +2832,12 @@ export declare const ExerciseJSONSchema: z.ZodObject<{
|
|
|
1864
2832
|
includeOperators?: boolean | undefined;
|
|
1865
2833
|
includeDecimal?: boolean | undefined;
|
|
1866
2834
|
}>;
|
|
2835
|
+
validation?: {
|
|
2836
|
+
mode: "simple" | "expression";
|
|
2837
|
+
expression?: string | undefined;
|
|
2838
|
+
answers?: Record<string, string | number> | undefined;
|
|
2839
|
+
variables?: string[] | undefined;
|
|
2840
|
+
} | undefined;
|
|
1867
2841
|
id?: string | undefined;
|
|
1868
2842
|
meta?: {
|
|
1869
2843
|
createdAt?: string | undefined;
|
|
@@ -1872,12 +2846,6 @@ export declare const ExerciseJSONSchema: z.ZodObject<{
|
|
|
1872
2846
|
difficulty?: number | undefined;
|
|
1873
2847
|
} | undefined;
|
|
1874
2848
|
}, {
|
|
1875
|
-
validation: {
|
|
1876
|
-
mode: "simple" | "expression";
|
|
1877
|
-
expression?: string | undefined;
|
|
1878
|
-
answers?: Record<string, string | number> | undefined;
|
|
1879
|
-
variables?: string[] | undefined;
|
|
1880
|
-
};
|
|
1881
2849
|
version: "2.0";
|
|
1882
2850
|
layout: any[];
|
|
1883
2851
|
widgets: Record<string, {
|
|
@@ -1899,6 +2867,12 @@ export declare const ExerciseJSONSchema: z.ZodObject<{
|
|
|
1899
2867
|
includeOperators?: boolean | undefined;
|
|
1900
2868
|
includeDecimal?: boolean | undefined;
|
|
1901
2869
|
}>;
|
|
2870
|
+
validation?: {
|
|
2871
|
+
mode: "simple" | "expression";
|
|
2872
|
+
expression?: string | undefined;
|
|
2873
|
+
answers?: Record<string, string | number> | undefined;
|
|
2874
|
+
variables?: string[] | undefined;
|
|
2875
|
+
} | undefined;
|
|
1902
2876
|
id?: string | undefined;
|
|
1903
2877
|
meta?: {
|
|
1904
2878
|
createdAt?: string | undefined;
|
|
@@ -2466,6 +3440,10 @@ export declare const JSON_TYPES: {
|
|
|
2466
3440
|
readonly TABLE_ROW: "table-row";
|
|
2467
3441
|
/** Cell within a table */
|
|
2468
3442
|
readonly TABLE_CELL: "table-cell";
|
|
3443
|
+
/** Number line layout block */
|
|
3444
|
+
readonly NUMBER_LINE: "number-line";
|
|
3445
|
+
/** Position marker within a number line */
|
|
3446
|
+
readonly NUMBER_LINE_POSITION: "number-line-position";
|
|
2469
3447
|
/** Inline input widget (string or numeric) */
|
|
2470
3448
|
readonly INLINE_INPUT: "inline-input";
|
|
2471
3449
|
/** Drag-and-drop options widget */
|
|
@@ -3875,6 +4853,9 @@ export declare function toJSON(ast: ExerciseDocument): ExerciseJSON;
|
|
|
3875
4853
|
/**
|
|
3876
4854
|
* Tokenize a DSL input string
|
|
3877
4855
|
*
|
|
4856
|
+
* Non-breaking spaces (U+00A0) copied from Slack/Teams are replaced with
|
|
4857
|
+
* regular spaces before tokenization to avoid silent parse failures.
|
|
4858
|
+
*
|
|
3878
4859
|
* @param input - The DSL text to tokenize
|
|
3879
4860
|
* @returns Array of tokens
|
|
3880
4861
|
* @throws LexerError if tokenization fails
|
|
@@ -3892,6 +4873,8 @@ declare interface TokenizeResult {
|
|
|
3892
4873
|
/**
|
|
3893
4874
|
* Tokenize without throwing - returns both tokens and errors
|
|
3894
4875
|
* Useful for error-tolerant parsing (e.g., in editors)
|
|
4876
|
+
*
|
|
4877
|
+
* Non-breaking spaces (U+00A0) are sanitized the same way as in tokenize().
|
|
3895
4878
|
*/
|
|
3896
4879
|
export declare function tokenizeSafe(input: string): TokenizeResult;
|
|
3897
4880
|
|
|
@@ -3961,6 +4944,10 @@ export declare function validate(exercise: ExerciseJSON, userInputs: Record<stri
|
|
|
3961
4944
|
*/
|
|
3962
4945
|
export declare function validateBooleanExpression(expression: string): string | null;
|
|
3963
4946
|
|
|
4947
|
+
declare type ValidatedExerciseJSON = ExerciseJSON & {
|
|
4948
|
+
validation: ValidationJSON;
|
|
4949
|
+
};
|
|
4950
|
+
|
|
3964
4951
|
/**
|
|
3965
4952
|
* Validate an exercise JSON object at runtime
|
|
3966
4953
|
*
|
|
@@ -3979,12 +4966,6 @@ export declare function validateBooleanExpression(expression: string): string |
|
|
|
3979
4966
|
* ```
|
|
3980
4967
|
*/
|
|
3981
4968
|
export declare function validateExerciseJSON(data: unknown): {
|
|
3982
|
-
validation: {
|
|
3983
|
-
mode: "simple" | "expression";
|
|
3984
|
-
expression?: string | undefined;
|
|
3985
|
-
answers?: Record<string, string | number> | undefined;
|
|
3986
|
-
variables?: string[] | undefined;
|
|
3987
|
-
};
|
|
3988
4969
|
version: "2.0";
|
|
3989
4970
|
layout: any[];
|
|
3990
4971
|
widgets: Record<string, {
|
|
@@ -4006,6 +4987,12 @@ export declare function validateExerciseJSON(data: unknown): {
|
|
|
4006
4987
|
includeOperators?: boolean | undefined;
|
|
4007
4988
|
includeDecimal?: boolean | undefined;
|
|
4008
4989
|
}>;
|
|
4990
|
+
validation?: {
|
|
4991
|
+
mode: "simple" | "expression";
|
|
4992
|
+
expression?: string | undefined;
|
|
4993
|
+
answers?: Record<string, string | number> | undefined;
|
|
4994
|
+
variables?: string[] | undefined;
|
|
4995
|
+
} | undefined;
|
|
4009
4996
|
id?: string | undefined;
|
|
4010
4997
|
meta?: {
|
|
4011
4998
|
createdAt?: string | undefined;
|
|
@@ -4032,12 +5019,6 @@ export declare function validateExerciseJSON(data: unknown): {
|
|
|
4032
5019
|
* ```
|
|
4033
5020
|
*/
|
|
4034
5021
|
export declare function validateExerciseJSONSafe(data: unknown): z.SafeParseReturnType<{
|
|
4035
|
-
validation: {
|
|
4036
|
-
mode: "simple" | "expression";
|
|
4037
|
-
expression?: string | undefined;
|
|
4038
|
-
answers?: Record<string, string | number> | undefined;
|
|
4039
|
-
variables?: string[] | undefined;
|
|
4040
|
-
};
|
|
4041
5022
|
version: "2.0";
|
|
4042
5023
|
layout: any[];
|
|
4043
5024
|
widgets: Record<string, {
|
|
@@ -4059,6 +5040,12 @@ export declare function validateExerciseJSONSafe(data: unknown): z.SafeParseRetu
|
|
|
4059
5040
|
includeOperators?: boolean | undefined;
|
|
4060
5041
|
includeDecimal?: boolean | undefined;
|
|
4061
5042
|
}>;
|
|
5043
|
+
validation?: {
|
|
5044
|
+
mode: "simple" | "expression";
|
|
5045
|
+
expression?: string | undefined;
|
|
5046
|
+
answers?: Record<string, string | number> | undefined;
|
|
5047
|
+
variables?: string[] | undefined;
|
|
5048
|
+
} | undefined;
|
|
4062
5049
|
id?: string | undefined;
|
|
4063
5050
|
meta?: {
|
|
4064
5051
|
createdAt?: string | undefined;
|
|
@@ -4067,12 +5054,6 @@ export declare function validateExerciseJSONSafe(data: unknown): z.SafeParseRetu
|
|
|
4067
5054
|
difficulty?: number | undefined;
|
|
4068
5055
|
} | undefined;
|
|
4069
5056
|
}, {
|
|
4070
|
-
validation: {
|
|
4071
|
-
mode: "simple" | "expression";
|
|
4072
|
-
expression?: string | undefined;
|
|
4073
|
-
answers?: Record<string, string | number> | undefined;
|
|
4074
|
-
variables?: string[] | undefined;
|
|
4075
|
-
};
|
|
4076
5057
|
version: "2.0";
|
|
4077
5058
|
layout: any[];
|
|
4078
5059
|
widgets: Record<string, {
|
|
@@ -4094,6 +5075,12 @@ export declare function validateExerciseJSONSafe(data: unknown): z.SafeParseRetu
|
|
|
4094
5075
|
includeOperators?: boolean | undefined;
|
|
4095
5076
|
includeDecimal?: boolean | undefined;
|
|
4096
5077
|
}>;
|
|
5078
|
+
validation?: {
|
|
5079
|
+
mode: "simple" | "expression";
|
|
5080
|
+
expression?: string | undefined;
|
|
5081
|
+
answers?: Record<string, string | number> | undefined;
|
|
5082
|
+
variables?: string[] | undefined;
|
|
5083
|
+
} | undefined;
|
|
4097
5084
|
id?: string | undefined;
|
|
4098
5085
|
meta?: {
|
|
4099
5086
|
createdAt?: string | undefined;
|
|
@@ -4106,11 +5093,11 @@ export declare function validateExerciseJSONSafe(data: unknown): z.SafeParseRetu
|
|
|
4106
5093
|
/**
|
|
4107
5094
|
* Validate using expression mode
|
|
4108
5095
|
*
|
|
4109
|
-
* @param exercise - The exercise JSON
|
|
5096
|
+
* @param exercise - The exercise JSON (with validation present)
|
|
4110
5097
|
* @param userInputs - User's answers keyed by widget ID (variable names)
|
|
4111
5098
|
* @returns Validation result
|
|
4112
5099
|
*/
|
|
4113
|
-
export declare function validateExpression(exercise:
|
|
5100
|
+
export declare function validateExpression(exercise: ValidatedExerciseJSON, userInputs: Record<string, string | number>): ValidationResult;
|
|
4114
5101
|
|
|
4115
5102
|
/**
|
|
4116
5103
|
* Check if user inputs are valid (proper format, etc.)
|
|
@@ -4125,11 +5112,11 @@ export declare function validateInputFormats(exercise: ExerciseJSON, userInputs:
|
|
|
4125
5112
|
/**
|
|
4126
5113
|
* Validate using simple mode (predetermined answers)
|
|
4127
5114
|
*
|
|
4128
|
-
* @param exercise - The exercise JSON
|
|
5115
|
+
* @param exercise - The exercise JSON (with validation present)
|
|
4129
5116
|
* @param userInputs - User's answers keyed by widget ID
|
|
4130
5117
|
* @returns Validation result
|
|
4131
5118
|
*/
|
|
4132
|
-
export declare function validateSimple(exercise:
|
|
5119
|
+
export declare function validateSimple(exercise: ValidatedExerciseJSON, userInputs: Record<string, string | number>): ValidationResult;
|
|
4133
5120
|
|
|
4134
5121
|
/**
|
|
4135
5122
|
* Validate a widget JSON object at runtime
|