@mathscan/math-exercise-engine 1.0.8 → 1.0.9

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 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 */
@@ -227,6 +231,48 @@ export declare function compileWithAST(dsl: string): {
227
231
  digits: number;
228
232
  answer?: string | number | undefined;
229
233
  })[];
234
+ } | {
235
+ type: "NumberLineBlock";
236
+ min: number;
237
+ max: number;
238
+ step: number;
239
+ positions: {
240
+ value: number;
241
+ type: "NumberLinePosition";
242
+ inlines: ({
243
+ value: string;
244
+ type: "FreeText";
245
+ } | {
246
+ type: "Space";
247
+ } | {
248
+ value: string;
249
+ type: "HighlightedText";
250
+ highlight?: [number, number] | undefined;
251
+ } | {
252
+ value: string;
253
+ type: "ColorText";
254
+ color: string;
255
+ highlight?: [number, number] | undefined;
256
+ } | {
257
+ value: string;
258
+ type: "BoldText";
259
+ highlight?: [number, number] | undefined;
260
+ } | {
261
+ length: number;
262
+ type: "InlineInput";
263
+ inputType: "string";
264
+ name: string;
265
+ answer?: string | number | undefined;
266
+ } | {
267
+ type: "InlineInput";
268
+ inputType: "numeric";
269
+ name: string;
270
+ digits: number;
271
+ answer?: string | number | undefined;
272
+ })[];
273
+ }[];
274
+ minorTicks?: number | undefined;
275
+ style?: "arrow-right" | "arrow-left" | "arrow-both" | "line" | undefined;
230
276
  } | {
231
277
  type: "TableBlock";
232
278
  cols: number;
@@ -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
- * Create a bold text inline element
833
- */
834
- export declare function createBoldText(value: string, highlight?: [number, number]): BoldTextInline;
835
-
836
- /**
837
- * Create a color text inline element
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
- type: "LineBlock";
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
- type: "LineBlock";
1011
+ value: number;
1012
+ type: "NumberLinePosition";
1134
1013
  inlines: ({
1135
1014
  value: string;
1136
1015
  type: "FreeText";
@@ -1162,48 +1041,637 @@ export declare const ExerciseDocumentSchema: z.ZodObject<{
1162
1041
  digits: number;
1163
1042
  answer?: string | number | undefined;
1164
1043
  })[];
1165
- }>, z.ZodObject<{
1166
- type: z.ZodLiteral<"TableBlock">;
1167
- cols: z.ZodNumber;
1168
- rows: z.ZodArray<z.ZodObject<{
1169
- type: z.ZodLiteral<"TableRow">;
1170
- cells: z.ZodArray<z.ZodObject<{
1171
- type: z.ZodLiteral<"TableCell">;
1172
- colspan: z.ZodOptional<z.ZodNumber>;
1173
- inlines: z.ZodArray<z.ZodUnion<[z.ZodObject<{
1174
- type: z.ZodLiteral<"FreeText">;
1175
- value: z.ZodString;
1176
- }, "strip", z.ZodTypeAny, {
1177
- value: string;
1178
- type: "FreeText";
1179
- }, {
1180
- value: string;
1181
- type: "FreeText";
1182
- }>, z.ZodObject<{
1183
- type: z.ZodLiteral<"Space">;
1184
- }, "strip", z.ZodTypeAny, {
1185
- type: "Space";
1186
- }, {
1187
- type: "Space";
1188
- }>, z.ZodObject<{
1189
- type: z.ZodLiteral<"HighlightedText">;
1190
- value: z.ZodString;
1191
- highlight: z.ZodOptional<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>;
1192
- }, "strip", z.ZodTypeAny, {
1193
- value: string;
1194
- type: "HighlightedText";
1195
- highlight?: [number, number] | undefined;
1196
- }, {
1197
- value: string;
1198
- type: "HighlightedText";
1199
- highlight?: [number, number] | undefined;
1200
- }>, z.ZodObject<{
1201
- type: z.ZodLiteral<"ColorText">;
1202
- value: z.ZodString;
1203
- color: z.ZodString;
1204
- highlight: z.ZodOptional<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>;
1205
- }, "strip", z.ZodTypeAny, {
1206
- value: string;
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">;
1658
+ value: z.ZodString;
1659
+ highlight: z.ZodOptional<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>;
1660
+ }, "strip", z.ZodTypeAny, {
1661
+ value: string;
1662
+ type: "HighlightedText";
1663
+ highlight?: [number, number] | undefined;
1664
+ }, {
1665
+ value: string;
1666
+ type: "HighlightedText";
1667
+ highlight?: [number, number] | undefined;
1668
+ }>, z.ZodObject<{
1669
+ type: z.ZodLiteral<"ColorText">;
1670
+ value: z.ZodString;
1671
+ color: z.ZodString;
1672
+ highlight: z.ZodOptional<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>;
1673
+ }, "strip", z.ZodTypeAny, {
1674
+ value: string;
1207
1675
  type: "ColorText";
1208
1676
  color: string;
1209
1677
  highlight?: [number, number] | undefined;
@@ -1252,16 +1720,50 @@ export declare const ExerciseDocumentSchema: z.ZodObject<{
1252
1720
  type: "InlineInput";
1253
1721
  inputType: "numeric";
1254
1722
  name: string;
1255
- digits: number;
1723
+ digits: number;
1724
+ answer?: string | number | undefined;
1725
+ }, {
1726
+ type: "InlineInput";
1727
+ inputType: "numeric";
1728
+ name: string;
1729
+ digits: number;
1730
+ answer?: string | number | undefined;
1731
+ }>]>]>, "many">;
1732
+ }, "strip", z.ZodTypeAny, {
1733
+ type: "TableCell";
1734
+ inlines: ({
1735
+ value: string;
1736
+ type: "FreeText";
1737
+ } | {
1738
+ type: "Space";
1739
+ } | {
1740
+ value: string;
1741
+ type: "HighlightedText";
1742
+ highlight?: [number, number] | undefined;
1743
+ } | {
1744
+ value: string;
1745
+ type: "ColorText";
1746
+ color: string;
1747
+ highlight?: [number, number] | undefined;
1748
+ } | {
1749
+ value: string;
1750
+ type: "BoldText";
1751
+ highlight?: [number, number] | undefined;
1752
+ } | {
1753
+ length: number;
1754
+ type: "InlineInput";
1755
+ inputType: "string";
1756
+ name: string;
1256
1757
  answer?: string | number | undefined;
1257
- }, {
1758
+ } | {
1258
1759
  type: "InlineInput";
1259
1760
  inputType: "numeric";
1260
1761
  name: string;
1261
1762
  digits: number;
1262
1763
  answer?: string | number | undefined;
1263
- }>]>]>, "many">;
1264
- }, "strip", z.ZodTypeAny, {
1764
+ })[];
1765
+ colspan?: number | undefined;
1766
+ }, {
1265
1767
  type: "TableCell";
1266
1768
  inlines: ({
1267
1769
  value: string;
@@ -1295,7 +1797,10 @@ export declare const ExerciseDocumentSchema: z.ZodObject<{
1295
1797
  answer?: string | number | undefined;
1296
1798
  })[];
1297
1799
  colspan?: number | undefined;
1298
- }, {
1800
+ }>, "many">;
1801
+ }, "strip", z.ZodTypeAny, {
1802
+ type: "TableRow";
1803
+ cells: {
1299
1804
  type: "TableCell";
1300
1805
  inlines: ({
1301
1806
  value: string;
@@ -1329,8 +1834,8 @@ export declare const ExerciseDocumentSchema: z.ZodObject<{
1329
1834
  answer?: string | number | undefined;
1330
1835
  })[];
1331
1836
  colspan?: number | undefined;
1332
- }>, "many">;
1333
- }, "strip", z.ZodTypeAny, {
1837
+ }[];
1838
+ }, {
1334
1839
  type: "TableRow";
1335
1840
  cells: {
1336
1841
  type: "TableCell";
@@ -1367,7 +1872,11 @@ export declare const ExerciseDocumentSchema: z.ZodObject<{
1367
1872
  })[];
1368
1873
  colspan?: number | undefined;
1369
1874
  }[];
1370
- }, {
1875
+ }>, "many">;
1876
+ }, "strip", z.ZodTypeAny, {
1877
+ type: "TableBlock";
1878
+ cols: number;
1879
+ rows: {
1371
1880
  type: "TableRow";
1372
1881
  cells: {
1373
1882
  type: "TableCell";
@@ -1404,8 +1913,8 @@ export declare const ExerciseDocumentSchema: z.ZodObject<{
1404
1913
  })[];
1405
1914
  colspan?: number | undefined;
1406
1915
  }[];
1407
- }>, "many">;
1408
- }, "strip", z.ZodTypeAny, {
1916
+ }[];
1917
+ }, {
1409
1918
  type: "TableBlock";
1410
1919
  cols: number;
1411
1920
  rows: {
@@ -1446,62 +1955,443 @@ export declare const ExerciseDocumentSchema: z.ZodObject<{
1446
1955
  colspan?: number | undefined;
1447
1956
  }[];
1448
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
+ })[];
2142
+ }>, "many">;
2143
+ }, "strip", z.ZodTypeAny, {
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;
1449
2269
  }, {
1450
- type: "TableBlock";
1451
- cols: number;
1452
- rows: {
1453
- type: "TableRow";
1454
- cells: {
1455
- type: "TableCell";
1456
- inlines: ({
1457
- value: string;
1458
- type: "FreeText";
1459
- } | {
1460
- type: "Space";
1461
- } | {
1462
- value: string;
1463
- type: "HighlightedText";
1464
- highlight?: [number, number] | undefined;
1465
- } | {
1466
- value: string;
1467
- type: "ColorText";
1468
- color: string;
1469
- highlight?: [number, number] | undefined;
1470
- } | {
1471
- value: string;
1472
- type: "BoldText";
1473
- highlight?: [number, number] | undefined;
1474
- } | {
1475
- length: number;
1476
- type: "InlineInput";
1477
- inputType: "string";
1478
- name: string;
1479
- answer?: string | number | undefined;
1480
- } | {
1481
- type: "InlineInput";
1482
- inputType: "numeric";
1483
- name: string;
1484
- digits: number;
1485
- answer?: string | number | undefined;
1486
- })[];
1487
- colspan?: number | undefined;
1488
- }[];
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
+ })[];
1489
2307
  }[];
1490
- }>, z.ZodObject<{
1491
- type: z.ZodLiteral<"RadioOptions">;
1492
- name: z.ZodString;
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;
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
+ })[];
2350
+ }[];
2351
+ minorTicks?: number | undefined;
2352
+ style?: "arrow-right" | "arrow-left" | "arrow-both" | "line" | undefined;
1500
2353
  }, {
1501
- type: "RadioOptions";
1502
- options: string[];
1503
- name: string;
1504
- answer: string;
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
+ })[];
2391
+ }[];
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">;
@@ -1582,6 +2472,48 @@ export declare const ExerciseDocumentSchema: z.ZodObject<{
1582
2472
  digits: number;
1583
2473
  answer?: string | number | undefined;
1584
2474
  })[];
2475
+ } | {
2476
+ type: "NumberLineBlock";
2477
+ min: number;
2478
+ max: number;
2479
+ step: number;
2480
+ positions: {
2481
+ value: number;
2482
+ type: "NumberLinePosition";
2483
+ inlines: ({
2484
+ value: string;
2485
+ type: "FreeText";
2486
+ } | {
2487
+ type: "Space";
2488
+ } | {
2489
+ value: string;
2490
+ type: "HighlightedText";
2491
+ highlight?: [number, number] | undefined;
2492
+ } | {
2493
+ value: string;
2494
+ type: "ColorText";
2495
+ color: string;
2496
+ highlight?: [number, number] | undefined;
2497
+ } | {
2498
+ value: string;
2499
+ type: "BoldText";
2500
+ highlight?: [number, number] | undefined;
2501
+ } | {
2502
+ length: number;
2503
+ type: "InlineInput";
2504
+ inputType: "string";
2505
+ name: string;
2506
+ answer?: string | number | undefined;
2507
+ } | {
2508
+ type: "InlineInput";
2509
+ inputType: "numeric";
2510
+ name: string;
2511
+ digits: number;
2512
+ answer?: string | number | undefined;
2513
+ })[];
2514
+ }[];
2515
+ minorTicks?: number | undefined;
2516
+ style?: "arrow-right" | "arrow-left" | "arrow-both" | "line" | undefined;
1585
2517
  } | {
1586
2518
  type: "TableBlock";
1587
2519
  cols: number;
@@ -1682,6 +2614,48 @@ export declare const ExerciseDocumentSchema: z.ZodObject<{
1682
2614
  digits: number;
1683
2615
  answer?: string | number | undefined;
1684
2616
  })[];
2617
+ } | {
2618
+ type: "NumberLineBlock";
2619
+ min: number;
2620
+ max: number;
2621
+ positions: {
2622
+ value: number;
2623
+ type: "NumberLinePosition";
2624
+ inlines: ({
2625
+ value: string;
2626
+ type: "FreeText";
2627
+ } | {
2628
+ type: "Space";
2629
+ } | {
2630
+ value: string;
2631
+ type: "HighlightedText";
2632
+ highlight?: [number, number] | undefined;
2633
+ } | {
2634
+ value: string;
2635
+ type: "ColorText";
2636
+ color: string;
2637
+ highlight?: [number, number] | undefined;
2638
+ } | {
2639
+ value: string;
2640
+ type: "BoldText";
2641
+ highlight?: [number, number] | undefined;
2642
+ } | {
2643
+ length: number;
2644
+ type: "InlineInput";
2645
+ inputType: "string";
2646
+ name: string;
2647
+ answer?: string | number | undefined;
2648
+ } | {
2649
+ type: "InlineInput";
2650
+ inputType: "numeric";
2651
+ name: string;
2652
+ digits: number;
2653
+ answer?: string | number | undefined;
2654
+ })[];
2655
+ }[];
2656
+ step?: number | undefined;
2657
+ minorTicks?: number | undefined;
2658
+ style?: "arrow-right" | "arrow-left" | "arrow-both" | "line" | undefined;
1685
2659
  } | {
1686
2660
  type: "TableBlock";
1687
2661
  cols: number;
@@ -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