@mathscan/math-exercise-engine 1.1.13 → 1.1.15
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 +129 -0
- package/dist/index.js +64 -28
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +64 -28
- package/dist/index.mjs.map +1 -1
- package/dist/style.css +202 -57
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -717,7 +717,10 @@ export declare function compileWithAST(dsl: string): {
|
|
|
717
717
|
snap?: number | undefined;
|
|
718
718
|
})[];
|
|
719
719
|
colspan?: number | undefined;
|
|
720
|
+
rowspan?: number | undefined;
|
|
721
|
+
backgroundColor?: string | undefined;
|
|
720
722
|
}[];
|
|
723
|
+
backgroundColor?: string | undefined;
|
|
721
724
|
}[];
|
|
722
725
|
} | {
|
|
723
726
|
items: ({
|
|
@@ -1498,9 +1501,12 @@ export declare const ContentBlockSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
1498
1501
|
cols: z.ZodNumber;
|
|
1499
1502
|
rows: z.ZodArray<z.ZodObject<{
|
|
1500
1503
|
type: z.ZodLiteral<"TableRow">;
|
|
1504
|
+
backgroundColor: z.ZodOptional<z.ZodString>;
|
|
1501
1505
|
cells: z.ZodArray<z.ZodObject<{
|
|
1502
1506
|
type: z.ZodLiteral<"TableCell">;
|
|
1503
1507
|
colspan: z.ZodOptional<z.ZodNumber>;
|
|
1508
|
+
rowspan: z.ZodOptional<z.ZodNumber>;
|
|
1509
|
+
backgroundColor: z.ZodOptional<z.ZodString>;
|
|
1504
1510
|
inlines: z.ZodArray<z.ZodUnion<[z.ZodObject<{
|
|
1505
1511
|
type: z.ZodLiteral<"FreeText">;
|
|
1506
1512
|
value: z.ZodString;
|
|
@@ -1830,6 +1836,8 @@ export declare const ContentBlockSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
1830
1836
|
snap?: number | undefined;
|
|
1831
1837
|
})[];
|
|
1832
1838
|
colspan?: number | undefined;
|
|
1839
|
+
rowspan?: number | undefined;
|
|
1840
|
+
backgroundColor?: string | undefined;
|
|
1833
1841
|
}, {
|
|
1834
1842
|
type: "TableCell";
|
|
1835
1843
|
inlines: ({
|
|
@@ -1910,6 +1918,8 @@ export declare const ContentBlockSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
1910
1918
|
snap?: number | undefined;
|
|
1911
1919
|
})[];
|
|
1912
1920
|
colspan?: number | undefined;
|
|
1921
|
+
rowspan?: number | undefined;
|
|
1922
|
+
backgroundColor?: string | undefined;
|
|
1913
1923
|
}>, "many">;
|
|
1914
1924
|
}, "strip", z.ZodTypeAny, {
|
|
1915
1925
|
type: "TableRow";
|
|
@@ -1993,7 +2003,10 @@ export declare const ContentBlockSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
1993
2003
|
snap?: number | undefined;
|
|
1994
2004
|
})[];
|
|
1995
2005
|
colspan?: number | undefined;
|
|
2006
|
+
rowspan?: number | undefined;
|
|
2007
|
+
backgroundColor?: string | undefined;
|
|
1996
2008
|
}[];
|
|
2009
|
+
backgroundColor?: string | undefined;
|
|
1997
2010
|
}, {
|
|
1998
2011
|
type: "TableRow";
|
|
1999
2012
|
cells: {
|
|
@@ -2076,7 +2089,10 @@ export declare const ContentBlockSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
2076
2089
|
snap?: number | undefined;
|
|
2077
2090
|
})[];
|
|
2078
2091
|
colspan?: number | undefined;
|
|
2092
|
+
rowspan?: number | undefined;
|
|
2093
|
+
backgroundColor?: string | undefined;
|
|
2079
2094
|
}[];
|
|
2095
|
+
backgroundColor?: string | undefined;
|
|
2080
2096
|
}>, "many">;
|
|
2081
2097
|
}, "strip", z.ZodTypeAny, {
|
|
2082
2098
|
type: "TableBlock";
|
|
@@ -2163,7 +2179,10 @@ export declare const ContentBlockSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
2163
2179
|
snap?: number | undefined;
|
|
2164
2180
|
})[];
|
|
2165
2181
|
colspan?: number | undefined;
|
|
2182
|
+
rowspan?: number | undefined;
|
|
2183
|
+
backgroundColor?: string | undefined;
|
|
2166
2184
|
}[];
|
|
2185
|
+
backgroundColor?: string | undefined;
|
|
2167
2186
|
}[];
|
|
2168
2187
|
}, {
|
|
2169
2188
|
type: "TableBlock";
|
|
@@ -2250,7 +2269,10 @@ export declare const ContentBlockSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
2250
2269
|
snap?: number | undefined;
|
|
2251
2270
|
})[];
|
|
2252
2271
|
colspan?: number | undefined;
|
|
2272
|
+
rowspan?: number | undefined;
|
|
2273
|
+
backgroundColor?: string | undefined;
|
|
2253
2274
|
}[];
|
|
2275
|
+
backgroundColor?: string | undefined;
|
|
2254
2276
|
}[];
|
|
2255
2277
|
}>, z.ZodObject<{
|
|
2256
2278
|
type: z.ZodLiteral<"RadioOptions">;
|
|
@@ -7481,9 +7503,12 @@ export declare const ExerciseDocumentSchema: z.ZodEffects<z.ZodObject<{
|
|
|
7481
7503
|
cols: z.ZodNumber;
|
|
7482
7504
|
rows: z.ZodArray<z.ZodObject<{
|
|
7483
7505
|
type: z.ZodLiteral<"TableRow">;
|
|
7506
|
+
backgroundColor: z.ZodOptional<z.ZodString>;
|
|
7484
7507
|
cells: z.ZodArray<z.ZodObject<{
|
|
7485
7508
|
type: z.ZodLiteral<"TableCell">;
|
|
7486
7509
|
colspan: z.ZodOptional<z.ZodNumber>;
|
|
7510
|
+
rowspan: z.ZodOptional<z.ZodNumber>;
|
|
7511
|
+
backgroundColor: z.ZodOptional<z.ZodString>;
|
|
7487
7512
|
inlines: z.ZodArray<z.ZodUnion<[z.ZodObject<{
|
|
7488
7513
|
type: z.ZodLiteral<"FreeText">;
|
|
7489
7514
|
value: z.ZodString;
|
|
@@ -7813,6 +7838,8 @@ export declare const ExerciseDocumentSchema: z.ZodEffects<z.ZodObject<{
|
|
|
7813
7838
|
snap?: number | undefined;
|
|
7814
7839
|
})[];
|
|
7815
7840
|
colspan?: number | undefined;
|
|
7841
|
+
rowspan?: number | undefined;
|
|
7842
|
+
backgroundColor?: string | undefined;
|
|
7816
7843
|
}, {
|
|
7817
7844
|
type: "TableCell";
|
|
7818
7845
|
inlines: ({
|
|
@@ -7893,6 +7920,8 @@ export declare const ExerciseDocumentSchema: z.ZodEffects<z.ZodObject<{
|
|
|
7893
7920
|
snap?: number | undefined;
|
|
7894
7921
|
})[];
|
|
7895
7922
|
colspan?: number | undefined;
|
|
7923
|
+
rowspan?: number | undefined;
|
|
7924
|
+
backgroundColor?: string | undefined;
|
|
7896
7925
|
}>, "many">;
|
|
7897
7926
|
}, "strip", z.ZodTypeAny, {
|
|
7898
7927
|
type: "TableRow";
|
|
@@ -7976,7 +8005,10 @@ export declare const ExerciseDocumentSchema: z.ZodEffects<z.ZodObject<{
|
|
|
7976
8005
|
snap?: number | undefined;
|
|
7977
8006
|
})[];
|
|
7978
8007
|
colspan?: number | undefined;
|
|
8008
|
+
rowspan?: number | undefined;
|
|
8009
|
+
backgroundColor?: string | undefined;
|
|
7979
8010
|
}[];
|
|
8011
|
+
backgroundColor?: string | undefined;
|
|
7980
8012
|
}, {
|
|
7981
8013
|
type: "TableRow";
|
|
7982
8014
|
cells: {
|
|
@@ -8059,7 +8091,10 @@ export declare const ExerciseDocumentSchema: z.ZodEffects<z.ZodObject<{
|
|
|
8059
8091
|
snap?: number | undefined;
|
|
8060
8092
|
})[];
|
|
8061
8093
|
colspan?: number | undefined;
|
|
8094
|
+
rowspan?: number | undefined;
|
|
8095
|
+
backgroundColor?: string | undefined;
|
|
8062
8096
|
}[];
|
|
8097
|
+
backgroundColor?: string | undefined;
|
|
8063
8098
|
}>, "many">;
|
|
8064
8099
|
}, "strip", z.ZodTypeAny, {
|
|
8065
8100
|
type: "TableBlock";
|
|
@@ -8146,7 +8181,10 @@ export declare const ExerciseDocumentSchema: z.ZodEffects<z.ZodObject<{
|
|
|
8146
8181
|
snap?: number | undefined;
|
|
8147
8182
|
})[];
|
|
8148
8183
|
colspan?: number | undefined;
|
|
8184
|
+
rowspan?: number | undefined;
|
|
8185
|
+
backgroundColor?: string | undefined;
|
|
8149
8186
|
}[];
|
|
8187
|
+
backgroundColor?: string | undefined;
|
|
8150
8188
|
}[];
|
|
8151
8189
|
}, {
|
|
8152
8190
|
type: "TableBlock";
|
|
@@ -8233,7 +8271,10 @@ export declare const ExerciseDocumentSchema: z.ZodEffects<z.ZodObject<{
|
|
|
8233
8271
|
snap?: number | undefined;
|
|
8234
8272
|
})[];
|
|
8235
8273
|
colspan?: number | undefined;
|
|
8274
|
+
rowspan?: number | undefined;
|
|
8275
|
+
backgroundColor?: string | undefined;
|
|
8236
8276
|
}[];
|
|
8277
|
+
backgroundColor?: string | undefined;
|
|
8237
8278
|
}[];
|
|
8238
8279
|
}>, z.ZodObject<{
|
|
8239
8280
|
type: z.ZodLiteral<"RadioOptions">;
|
|
@@ -13025,7 +13066,10 @@ export declare const ExerciseDocumentSchema: z.ZodEffects<z.ZodObject<{
|
|
|
13025
13066
|
snap?: number | undefined;
|
|
13026
13067
|
})[];
|
|
13027
13068
|
colspan?: number | undefined;
|
|
13069
|
+
rowspan?: number | undefined;
|
|
13070
|
+
backgroundColor?: string | undefined;
|
|
13028
13071
|
}[];
|
|
13072
|
+
backgroundColor?: string | undefined;
|
|
13029
13073
|
}[];
|
|
13030
13074
|
} | {
|
|
13031
13075
|
items: ({
|
|
@@ -13655,7 +13699,10 @@ export declare const ExerciseDocumentSchema: z.ZodEffects<z.ZodObject<{
|
|
|
13655
13699
|
snap?: number | undefined;
|
|
13656
13700
|
})[];
|
|
13657
13701
|
colspan?: number | undefined;
|
|
13702
|
+
rowspan?: number | undefined;
|
|
13703
|
+
backgroundColor?: string | undefined;
|
|
13658
13704
|
}[];
|
|
13705
|
+
backgroundColor?: string | undefined;
|
|
13659
13706
|
}[];
|
|
13660
13707
|
} | {
|
|
13661
13708
|
items: ({
|
|
@@ -14285,7 +14332,10 @@ export declare const ExerciseDocumentSchema: z.ZodEffects<z.ZodObject<{
|
|
|
14285
14332
|
snap?: number | undefined;
|
|
14286
14333
|
})[];
|
|
14287
14334
|
colspan?: number | undefined;
|
|
14335
|
+
rowspan?: number | undefined;
|
|
14336
|
+
backgroundColor?: string | undefined;
|
|
14288
14337
|
}[];
|
|
14338
|
+
backgroundColor?: string | undefined;
|
|
14289
14339
|
}[];
|
|
14290
14340
|
} | {
|
|
14291
14341
|
items: ({
|
|
@@ -14915,7 +14965,10 @@ export declare const ExerciseDocumentSchema: z.ZodEffects<z.ZodObject<{
|
|
|
14915
14965
|
snap?: number | undefined;
|
|
14916
14966
|
})[];
|
|
14917
14967
|
colspan?: number | undefined;
|
|
14968
|
+
rowspan?: number | undefined;
|
|
14969
|
+
backgroundColor?: string | undefined;
|
|
14918
14970
|
}[];
|
|
14971
|
+
backgroundColor?: string | undefined;
|
|
14919
14972
|
}[];
|
|
14920
14973
|
} | {
|
|
14921
14974
|
items: ({
|
|
@@ -23952,9 +24005,12 @@ declare const TableBlockSchema: z.ZodObject<{
|
|
|
23952
24005
|
cols: z.ZodNumber;
|
|
23953
24006
|
rows: z.ZodArray<z.ZodObject<{
|
|
23954
24007
|
type: z.ZodLiteral<"TableRow">;
|
|
24008
|
+
backgroundColor: z.ZodOptional<z.ZodString>;
|
|
23955
24009
|
cells: z.ZodArray<z.ZodObject<{
|
|
23956
24010
|
type: z.ZodLiteral<"TableCell">;
|
|
23957
24011
|
colspan: z.ZodOptional<z.ZodNumber>;
|
|
24012
|
+
rowspan: z.ZodOptional<z.ZodNumber>;
|
|
24013
|
+
backgroundColor: z.ZodOptional<z.ZodString>;
|
|
23958
24014
|
inlines: z.ZodArray<z.ZodUnion<[z.ZodObject<{
|
|
23959
24015
|
type: z.ZodLiteral<"FreeText">;
|
|
23960
24016
|
value: z.ZodString;
|
|
@@ -24284,6 +24340,8 @@ declare const TableBlockSchema: z.ZodObject<{
|
|
|
24284
24340
|
snap?: number | undefined;
|
|
24285
24341
|
})[];
|
|
24286
24342
|
colspan?: number | undefined;
|
|
24343
|
+
rowspan?: number | undefined;
|
|
24344
|
+
backgroundColor?: string | undefined;
|
|
24287
24345
|
}, {
|
|
24288
24346
|
type: "TableCell";
|
|
24289
24347
|
inlines: ({
|
|
@@ -24364,6 +24422,8 @@ declare const TableBlockSchema: z.ZodObject<{
|
|
|
24364
24422
|
snap?: number | undefined;
|
|
24365
24423
|
})[];
|
|
24366
24424
|
colspan?: number | undefined;
|
|
24425
|
+
rowspan?: number | undefined;
|
|
24426
|
+
backgroundColor?: string | undefined;
|
|
24367
24427
|
}>, "many">;
|
|
24368
24428
|
}, "strip", z.ZodTypeAny, {
|
|
24369
24429
|
type: "TableRow";
|
|
@@ -24447,7 +24507,10 @@ declare const TableBlockSchema: z.ZodObject<{
|
|
|
24447
24507
|
snap?: number | undefined;
|
|
24448
24508
|
})[];
|
|
24449
24509
|
colspan?: number | undefined;
|
|
24510
|
+
rowspan?: number | undefined;
|
|
24511
|
+
backgroundColor?: string | undefined;
|
|
24450
24512
|
}[];
|
|
24513
|
+
backgroundColor?: string | undefined;
|
|
24451
24514
|
}, {
|
|
24452
24515
|
type: "TableRow";
|
|
24453
24516
|
cells: {
|
|
@@ -24530,7 +24593,10 @@ declare const TableBlockSchema: z.ZodObject<{
|
|
|
24530
24593
|
snap?: number | undefined;
|
|
24531
24594
|
})[];
|
|
24532
24595
|
colspan?: number | undefined;
|
|
24596
|
+
rowspan?: number | undefined;
|
|
24597
|
+
backgroundColor?: string | undefined;
|
|
24533
24598
|
}[];
|
|
24599
|
+
backgroundColor?: string | undefined;
|
|
24534
24600
|
}>, "many">;
|
|
24535
24601
|
}, "strip", z.ZodTypeAny, {
|
|
24536
24602
|
type: "TableBlock";
|
|
@@ -24617,7 +24683,10 @@ declare const TableBlockSchema: z.ZodObject<{
|
|
|
24617
24683
|
snap?: number | undefined;
|
|
24618
24684
|
})[];
|
|
24619
24685
|
colspan?: number | undefined;
|
|
24686
|
+
rowspan?: number | undefined;
|
|
24687
|
+
backgroundColor?: string | undefined;
|
|
24620
24688
|
}[];
|
|
24689
|
+
backgroundColor?: string | undefined;
|
|
24621
24690
|
}[];
|
|
24622
24691
|
}, {
|
|
24623
24692
|
type: "TableBlock";
|
|
@@ -24704,7 +24773,10 @@ declare const TableBlockSchema: z.ZodObject<{
|
|
|
24704
24773
|
snap?: number | undefined;
|
|
24705
24774
|
})[];
|
|
24706
24775
|
colspan?: number | undefined;
|
|
24776
|
+
rowspan?: number | undefined;
|
|
24777
|
+
backgroundColor?: string | undefined;
|
|
24707
24778
|
}[];
|
|
24779
|
+
backgroundColor?: string | undefined;
|
|
24708
24780
|
}[];
|
|
24709
24781
|
}>;
|
|
24710
24782
|
|
|
@@ -24716,22 +24788,30 @@ export declare const TableCellItemSchema: z.ZodObject<{
|
|
|
24716
24788
|
id: z.ZodString;
|
|
24717
24789
|
type: z.ZodLiteral<"table-cell">;
|
|
24718
24790
|
colspan: z.ZodOptional<z.ZodNumber>;
|
|
24791
|
+
rowspan: z.ZodOptional<z.ZodNumber>;
|
|
24792
|
+
backgroundColor: z.ZodOptional<z.ZodString>;
|
|
24719
24793
|
items: z.ZodArray<z.ZodType<any, z.ZodTypeDef, any>, "many">;
|
|
24720
24794
|
}, "strip", z.ZodTypeAny, {
|
|
24721
24795
|
items: any[];
|
|
24722
24796
|
type: "table-cell";
|
|
24723
24797
|
id: string;
|
|
24724
24798
|
colspan?: number | undefined;
|
|
24799
|
+
rowspan?: number | undefined;
|
|
24800
|
+
backgroundColor?: string | undefined;
|
|
24725
24801
|
}, {
|
|
24726
24802
|
items: any[];
|
|
24727
24803
|
type: "table-cell";
|
|
24728
24804
|
id: string;
|
|
24729
24805
|
colspan?: number | undefined;
|
|
24806
|
+
rowspan?: number | undefined;
|
|
24807
|
+
backgroundColor?: string | undefined;
|
|
24730
24808
|
}>;
|
|
24731
24809
|
|
|
24732
24810
|
declare const TableCellSchema: z.ZodObject<{
|
|
24733
24811
|
type: z.ZodLiteral<"TableCell">;
|
|
24734
24812
|
colspan: z.ZodOptional<z.ZodNumber>;
|
|
24813
|
+
rowspan: z.ZodOptional<z.ZodNumber>;
|
|
24814
|
+
backgroundColor: z.ZodOptional<z.ZodString>;
|
|
24735
24815
|
inlines: z.ZodArray<z.ZodUnion<[z.ZodObject<{
|
|
24736
24816
|
type: z.ZodLiteral<"FreeText">;
|
|
24737
24817
|
value: z.ZodString;
|
|
@@ -25061,6 +25141,8 @@ declare const TableCellSchema: z.ZodObject<{
|
|
|
25061
25141
|
snap?: number | undefined;
|
|
25062
25142
|
})[];
|
|
25063
25143
|
colspan?: number | undefined;
|
|
25144
|
+
rowspan?: number | undefined;
|
|
25145
|
+
backgroundColor?: string | undefined;
|
|
25064
25146
|
}, {
|
|
25065
25147
|
type: "TableCell";
|
|
25066
25148
|
inlines: ({
|
|
@@ -25141,6 +25223,8 @@ declare const TableCellSchema: z.ZodObject<{
|
|
|
25141
25223
|
snap?: number | undefined;
|
|
25142
25224
|
})[];
|
|
25143
25225
|
colspan?: number | undefined;
|
|
25226
|
+
rowspan?: number | undefined;
|
|
25227
|
+
backgroundColor?: string | undefined;
|
|
25144
25228
|
}>;
|
|
25145
25229
|
|
|
25146
25230
|
export declare type TableItem = z.infer<typeof TableItemSchema>;
|
|
@@ -25152,21 +25236,28 @@ export declare const TableItemSchema: z.ZodObject<{
|
|
|
25152
25236
|
rows: z.ZodArray<z.ZodObject<{
|
|
25153
25237
|
id: z.ZodString;
|
|
25154
25238
|
type: z.ZodLiteral<"table-row">;
|
|
25239
|
+
backgroundColor: z.ZodOptional<z.ZodString>;
|
|
25155
25240
|
cells: z.ZodArray<z.ZodObject<{
|
|
25156
25241
|
id: z.ZodString;
|
|
25157
25242
|
type: z.ZodLiteral<"table-cell">;
|
|
25158
25243
|
colspan: z.ZodOptional<z.ZodNumber>;
|
|
25244
|
+
rowspan: z.ZodOptional<z.ZodNumber>;
|
|
25245
|
+
backgroundColor: z.ZodOptional<z.ZodString>;
|
|
25159
25246
|
items: z.ZodArray<z.ZodType<any, z.ZodTypeDef, any>, "many">;
|
|
25160
25247
|
}, "strip", z.ZodTypeAny, {
|
|
25161
25248
|
items: any[];
|
|
25162
25249
|
type: "table-cell";
|
|
25163
25250
|
id: string;
|
|
25164
25251
|
colspan?: number | undefined;
|
|
25252
|
+
rowspan?: number | undefined;
|
|
25253
|
+
backgroundColor?: string | undefined;
|
|
25165
25254
|
}, {
|
|
25166
25255
|
items: any[];
|
|
25167
25256
|
type: "table-cell";
|
|
25168
25257
|
id: string;
|
|
25169
25258
|
colspan?: number | undefined;
|
|
25259
|
+
rowspan?: number | undefined;
|
|
25260
|
+
backgroundColor?: string | undefined;
|
|
25170
25261
|
}>, "many">;
|
|
25171
25262
|
}, "strip", z.ZodTypeAny, {
|
|
25172
25263
|
type: "table-row";
|
|
@@ -25175,8 +25266,11 @@ export declare const TableItemSchema: z.ZodObject<{
|
|
|
25175
25266
|
type: "table-cell";
|
|
25176
25267
|
id: string;
|
|
25177
25268
|
colspan?: number | undefined;
|
|
25269
|
+
rowspan?: number | undefined;
|
|
25270
|
+
backgroundColor?: string | undefined;
|
|
25178
25271
|
}[];
|
|
25179
25272
|
id: string;
|
|
25273
|
+
backgroundColor?: string | undefined;
|
|
25180
25274
|
}, {
|
|
25181
25275
|
type: "table-row";
|
|
25182
25276
|
cells: {
|
|
@@ -25184,8 +25278,11 @@ export declare const TableItemSchema: z.ZodObject<{
|
|
|
25184
25278
|
type: "table-cell";
|
|
25185
25279
|
id: string;
|
|
25186
25280
|
colspan?: number | undefined;
|
|
25281
|
+
rowspan?: number | undefined;
|
|
25282
|
+
backgroundColor?: string | undefined;
|
|
25187
25283
|
}[];
|
|
25188
25284
|
id: string;
|
|
25285
|
+
backgroundColor?: string | undefined;
|
|
25189
25286
|
}>, "many">;
|
|
25190
25287
|
}, "strip", z.ZodTypeAny, {
|
|
25191
25288
|
type: "table";
|
|
@@ -25197,8 +25294,11 @@ export declare const TableItemSchema: z.ZodObject<{
|
|
|
25197
25294
|
type: "table-cell";
|
|
25198
25295
|
id: string;
|
|
25199
25296
|
colspan?: number | undefined;
|
|
25297
|
+
rowspan?: number | undefined;
|
|
25298
|
+
backgroundColor?: string | undefined;
|
|
25200
25299
|
}[];
|
|
25201
25300
|
id: string;
|
|
25301
|
+
backgroundColor?: string | undefined;
|
|
25202
25302
|
}[];
|
|
25203
25303
|
id: string;
|
|
25204
25304
|
}, {
|
|
@@ -25211,8 +25311,11 @@ export declare const TableItemSchema: z.ZodObject<{
|
|
|
25211
25311
|
type: "table-cell";
|
|
25212
25312
|
id: string;
|
|
25213
25313
|
colspan?: number | undefined;
|
|
25314
|
+
rowspan?: number | undefined;
|
|
25315
|
+
backgroundColor?: string | undefined;
|
|
25214
25316
|
}[];
|
|
25215
25317
|
id: string;
|
|
25318
|
+
backgroundColor?: string | undefined;
|
|
25216
25319
|
}[];
|
|
25217
25320
|
id: string;
|
|
25218
25321
|
}>;
|
|
@@ -25224,21 +25327,28 @@ export declare type TableRowItem = z.infer<typeof TableRowItemSchema>;
|
|
|
25224
25327
|
export declare const TableRowItemSchema: z.ZodObject<{
|
|
25225
25328
|
id: z.ZodString;
|
|
25226
25329
|
type: z.ZodLiteral<"table-row">;
|
|
25330
|
+
backgroundColor: z.ZodOptional<z.ZodString>;
|
|
25227
25331
|
cells: z.ZodArray<z.ZodObject<{
|
|
25228
25332
|
id: z.ZodString;
|
|
25229
25333
|
type: z.ZodLiteral<"table-cell">;
|
|
25230
25334
|
colspan: z.ZodOptional<z.ZodNumber>;
|
|
25335
|
+
rowspan: z.ZodOptional<z.ZodNumber>;
|
|
25336
|
+
backgroundColor: z.ZodOptional<z.ZodString>;
|
|
25231
25337
|
items: z.ZodArray<z.ZodType<any, z.ZodTypeDef, any>, "many">;
|
|
25232
25338
|
}, "strip", z.ZodTypeAny, {
|
|
25233
25339
|
items: any[];
|
|
25234
25340
|
type: "table-cell";
|
|
25235
25341
|
id: string;
|
|
25236
25342
|
colspan?: number | undefined;
|
|
25343
|
+
rowspan?: number | undefined;
|
|
25344
|
+
backgroundColor?: string | undefined;
|
|
25237
25345
|
}, {
|
|
25238
25346
|
items: any[];
|
|
25239
25347
|
type: "table-cell";
|
|
25240
25348
|
id: string;
|
|
25241
25349
|
colspan?: number | undefined;
|
|
25350
|
+
rowspan?: number | undefined;
|
|
25351
|
+
backgroundColor?: string | undefined;
|
|
25242
25352
|
}>, "many">;
|
|
25243
25353
|
}, "strip", z.ZodTypeAny, {
|
|
25244
25354
|
type: "table-row";
|
|
@@ -25247,8 +25357,11 @@ export declare const TableRowItemSchema: z.ZodObject<{
|
|
|
25247
25357
|
type: "table-cell";
|
|
25248
25358
|
id: string;
|
|
25249
25359
|
colspan?: number | undefined;
|
|
25360
|
+
rowspan?: number | undefined;
|
|
25361
|
+
backgroundColor?: string | undefined;
|
|
25250
25362
|
}[];
|
|
25251
25363
|
id: string;
|
|
25364
|
+
backgroundColor?: string | undefined;
|
|
25252
25365
|
}, {
|
|
25253
25366
|
type: "table-row";
|
|
25254
25367
|
cells: {
|
|
@@ -25256,15 +25369,21 @@ export declare const TableRowItemSchema: z.ZodObject<{
|
|
|
25256
25369
|
type: "table-cell";
|
|
25257
25370
|
id: string;
|
|
25258
25371
|
colspan?: number | undefined;
|
|
25372
|
+
rowspan?: number | undefined;
|
|
25373
|
+
backgroundColor?: string | undefined;
|
|
25259
25374
|
}[];
|
|
25260
25375
|
id: string;
|
|
25376
|
+
backgroundColor?: string | undefined;
|
|
25261
25377
|
}>;
|
|
25262
25378
|
|
|
25263
25379
|
declare const TableRowSchema: z.ZodObject<{
|
|
25264
25380
|
type: z.ZodLiteral<"TableRow">;
|
|
25381
|
+
backgroundColor: z.ZodOptional<z.ZodString>;
|
|
25265
25382
|
cells: z.ZodArray<z.ZodObject<{
|
|
25266
25383
|
type: z.ZodLiteral<"TableCell">;
|
|
25267
25384
|
colspan: z.ZodOptional<z.ZodNumber>;
|
|
25385
|
+
rowspan: z.ZodOptional<z.ZodNumber>;
|
|
25386
|
+
backgroundColor: z.ZodOptional<z.ZodString>;
|
|
25268
25387
|
inlines: z.ZodArray<z.ZodUnion<[z.ZodObject<{
|
|
25269
25388
|
type: z.ZodLiteral<"FreeText">;
|
|
25270
25389
|
value: z.ZodString;
|
|
@@ -25594,6 +25713,8 @@ declare const TableRowSchema: z.ZodObject<{
|
|
|
25594
25713
|
snap?: number | undefined;
|
|
25595
25714
|
})[];
|
|
25596
25715
|
colspan?: number | undefined;
|
|
25716
|
+
rowspan?: number | undefined;
|
|
25717
|
+
backgroundColor?: string | undefined;
|
|
25597
25718
|
}, {
|
|
25598
25719
|
type: "TableCell";
|
|
25599
25720
|
inlines: ({
|
|
@@ -25674,6 +25795,8 @@ declare const TableRowSchema: z.ZodObject<{
|
|
|
25674
25795
|
snap?: number | undefined;
|
|
25675
25796
|
})[];
|
|
25676
25797
|
colspan?: number | undefined;
|
|
25798
|
+
rowspan?: number | undefined;
|
|
25799
|
+
backgroundColor?: string | undefined;
|
|
25677
25800
|
}>, "many">;
|
|
25678
25801
|
}, "strip", z.ZodTypeAny, {
|
|
25679
25802
|
type: "TableRow";
|
|
@@ -25757,7 +25880,10 @@ declare const TableRowSchema: z.ZodObject<{
|
|
|
25757
25880
|
snap?: number | undefined;
|
|
25758
25881
|
})[];
|
|
25759
25882
|
colspan?: number | undefined;
|
|
25883
|
+
rowspan?: number | undefined;
|
|
25884
|
+
backgroundColor?: string | undefined;
|
|
25760
25885
|
}[];
|
|
25886
|
+
backgroundColor?: string | undefined;
|
|
25761
25887
|
}, {
|
|
25762
25888
|
type: "TableRow";
|
|
25763
25889
|
cells: {
|
|
@@ -25840,7 +25966,10 @@ declare const TableRowSchema: z.ZodObject<{
|
|
|
25840
25966
|
snap?: number | undefined;
|
|
25841
25967
|
})[];
|
|
25842
25968
|
colspan?: number | undefined;
|
|
25969
|
+
rowspan?: number | undefined;
|
|
25970
|
+
backgroundColor?: string | undefined;
|
|
25843
25971
|
}[];
|
|
25972
|
+
backgroundColor?: string | undefined;
|
|
25844
25973
|
}>;
|
|
25845
25974
|
|
|
25846
25975
|
export declare type TextBlock = z.infer<typeof TextBlockSchema>;
|
package/dist/index.js
CHANGED
|
@@ -750,6 +750,11 @@ class MathExerciseParser extends chevrotain.CstParser {
|
|
|
750
750
|
this.OR([{ ALT: () => this.CONSUME(Space) }, { ALT: () => this.CONSUME(Newline) }]);
|
|
751
751
|
});
|
|
752
752
|
this.CONSUME(ROW);
|
|
753
|
+
this.OPTION(() => {
|
|
754
|
+
this.CONSUME(LBracket);
|
|
755
|
+
this.SUBRULE(this.parameterList);
|
|
756
|
+
this.CONSUME(RBracket);
|
|
757
|
+
});
|
|
753
758
|
this.MANY2(() => {
|
|
754
759
|
this.OR2([{ ALT: () => this.CONSUME2(Space) }, { ALT: () => this.CONSUME2(Newline) }]);
|
|
755
760
|
});
|
|
@@ -2061,22 +2066,28 @@ function createNumberLineBlock(min, max, positions, step, minorTicks, style, lab
|
|
|
2061
2066
|
const TableCellSchema = zod.z.object({
|
|
2062
2067
|
type: zod.z.literal(AST_TYPES.TABLE_CELL),
|
|
2063
2068
|
colspan: zod.z.number().int().positive().optional(),
|
|
2069
|
+
rowspan: zod.z.number().int().positive().optional(),
|
|
2070
|
+
backgroundColor: zod.z.string().optional(),
|
|
2064
2071
|
inlines: zod.z.array(InlineNodeSchema)
|
|
2065
2072
|
});
|
|
2066
|
-
function createTableCell(inlines, colspan) {
|
|
2073
|
+
function createTableCell(inlines, colspan, rowspan, backgroundColor) {
|
|
2067
2074
|
return TableCellSchema.parse({
|
|
2068
2075
|
type: AST_TYPES.TABLE_CELL,
|
|
2069
2076
|
colspan,
|
|
2077
|
+
rowspan,
|
|
2078
|
+
backgroundColor,
|
|
2070
2079
|
inlines
|
|
2071
2080
|
});
|
|
2072
2081
|
}
|
|
2073
2082
|
const TableRowSchema = zod.z.object({
|
|
2074
2083
|
type: zod.z.literal(AST_TYPES.TABLE_ROW),
|
|
2084
|
+
backgroundColor: zod.z.string().optional(),
|
|
2075
2085
|
cells: zod.z.array(TableCellSchema).min(1)
|
|
2076
2086
|
});
|
|
2077
|
-
function createTableRow(cells) {
|
|
2087
|
+
function createTableRow(cells, backgroundColor) {
|
|
2078
2088
|
return TableRowSchema.parse({
|
|
2079
2089
|
type: AST_TYPES.TABLE_ROW,
|
|
2090
|
+
backgroundColor,
|
|
2080
2091
|
cells
|
|
2081
2092
|
});
|
|
2082
2093
|
}
|
|
@@ -2676,14 +2687,18 @@ class NaturalDSLVisitor extends BaseCstVisitor {
|
|
|
2676
2687
|
return createTableBlock(cols, rows);
|
|
2677
2688
|
}
|
|
2678
2689
|
row(ctx) {
|
|
2690
|
+
const params = ctx.parameterList ? this.visit(ctx.parameterList) : {};
|
|
2691
|
+
const backgroundColor = params.bgcolor;
|
|
2679
2692
|
const cells = ctx.cell.map((c) => this.visit(c));
|
|
2680
|
-
return createTableRow(cells);
|
|
2693
|
+
return createTableRow(cells, backgroundColor);
|
|
2681
2694
|
}
|
|
2682
2695
|
cell(ctx) {
|
|
2683
2696
|
const params = ctx.parameterList ? this.visit(ctx.parameterList) : {};
|
|
2684
2697
|
const colspan = params.colspan;
|
|
2698
|
+
const rowspan = params.rowspan;
|
|
2699
|
+
const backgroundColor = params.bgcolor;
|
|
2685
2700
|
const inlines = ctx.inlineElement ? ctx.inlineElement.map((elem) => this.visit(elem)) : [];
|
|
2686
|
-
return createTableCell(inlines, colspan);
|
|
2701
|
+
return createTableCell(inlines, colspan, rowspan, backgroundColor);
|
|
2687
2702
|
}
|
|
2688
2703
|
// ═══════════════════════════════════════════════════════════════════════════
|
|
2689
2704
|
// Number Line Block
|
|
@@ -3384,11 +3399,14 @@ const TableCellItemSchema = zod.z.object({
|
|
|
3384
3399
|
id: zod.z.string(),
|
|
3385
3400
|
type: zod.z.literal(JSON_TYPES.TABLE_CELL),
|
|
3386
3401
|
colspan: zod.z.number().int().positive().optional(),
|
|
3402
|
+
rowspan: zod.z.number().int().positive().optional(),
|
|
3403
|
+
backgroundColor: zod.z.string().optional(),
|
|
3387
3404
|
items: zod.z.array(LayoutItemSchema)
|
|
3388
3405
|
});
|
|
3389
3406
|
const TableRowItemSchema = zod.z.object({
|
|
3390
3407
|
id: zod.z.string(),
|
|
3391
3408
|
type: zod.z.literal(JSON_TYPES.TABLE_ROW),
|
|
3409
|
+
backgroundColor: zod.z.string().optional(),
|
|
3392
3410
|
cells: zod.z.array(TableCellItemSchema)
|
|
3393
3411
|
});
|
|
3394
3412
|
const TableItemSchema = zod.z.object({
|
|
@@ -9670,13 +9688,23 @@ function transformTable(table, idGenerator, inlineDragIds) {
|
|
|
9670
9688
|
if (cell.colspan !== void 0) {
|
|
9671
9689
|
cellItem.colspan = cell.colspan;
|
|
9672
9690
|
}
|
|
9691
|
+
if (cell.rowspan !== void 0) {
|
|
9692
|
+
cellItem.rowspan = cell.rowspan;
|
|
9693
|
+
}
|
|
9694
|
+
if (cell.backgroundColor !== void 0) {
|
|
9695
|
+
cellItem.backgroundColor = cell.backgroundColor;
|
|
9696
|
+
}
|
|
9673
9697
|
return cellItem;
|
|
9674
9698
|
});
|
|
9675
|
-
|
|
9699
|
+
const rowItem = {
|
|
9676
9700
|
id: idGenerator.generate(JSON_TYPES.TABLE_ROW),
|
|
9677
9701
|
type: JSON_TYPES.TABLE_ROW,
|
|
9678
9702
|
cells
|
|
9679
9703
|
};
|
|
9704
|
+
if (row.backgroundColor !== void 0) {
|
|
9705
|
+
rowItem.backgroundColor = row.backgroundColor;
|
|
9706
|
+
}
|
|
9707
|
+
return rowItem;
|
|
9680
9708
|
});
|
|
9681
9709
|
return {
|
|
9682
9710
|
id: idGenerator.generate(JSON_TYPES.TABLE),
|
|
@@ -18275,29 +18303,37 @@ const LayoutRenderer = ({
|
|
|
18275
18303
|
},
|
|
18276
18304
|
subItem.id
|
|
18277
18305
|
)) });
|
|
18278
|
-
case JSON_TYPES.TABLE:
|
|
18279
|
-
|
|
18280
|
-
|
|
18281
|
-
|
|
18282
|
-
|
|
18283
|
-
|
|
18284
|
-
|
|
18285
|
-
|
|
18286
|
-
{
|
|
18287
|
-
|
|
18288
|
-
|
|
18289
|
-
|
|
18290
|
-
|
|
18291
|
-
|
|
18292
|
-
|
|
18293
|
-
|
|
18294
|
-
|
|
18295
|
-
|
|
18296
|
-
|
|
18297
|
-
|
|
18298
|
-
|
|
18299
|
-
|
|
18300
|
-
|
|
18306
|
+
case JSON_TYPES.TABLE: {
|
|
18307
|
+
const totalRows = item.rows.length;
|
|
18308
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "exercise-table-container", children: /* @__PURE__ */ jsxRuntime.jsx("table", { className: "exercise-table", children: /* @__PURE__ */ jsxRuntime.jsx("tbody", { children: item.rows.map((row, rowIndex) => /* @__PURE__ */ jsxRuntime.jsx("tr", { className: "exercise-table-row", style: { backgroundColor: row.backgroundColor }, children: row.cells.map((cell) => {
|
|
18309
|
+
const rowspan = cell.rowspan || 1;
|
|
18310
|
+
const isLastRow = rowIndex + rowspan - 1 >= totalRows - 1;
|
|
18311
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
18312
|
+
"td",
|
|
18313
|
+
{
|
|
18314
|
+
className: `exercise-table-cell${isLastRow ? " exercise-table-cell--last-row" : ""}`,
|
|
18315
|
+
colSpan: cell.colspan || 1,
|
|
18316
|
+
rowSpan: rowspan,
|
|
18317
|
+
style: { backgroundColor: cell.backgroundColor },
|
|
18318
|
+
children: cell.items.map((subItem) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
18319
|
+
LayoutRenderer,
|
|
18320
|
+
{
|
|
18321
|
+
item: subItem,
|
|
18322
|
+
widgets,
|
|
18323
|
+
values,
|
|
18324
|
+
droppedInputs,
|
|
18325
|
+
validationDetails,
|
|
18326
|
+
onChange,
|
|
18327
|
+
onInputFocus,
|
|
18328
|
+
resetKey
|
|
18329
|
+
},
|
|
18330
|
+
subItem.id
|
|
18331
|
+
))
|
|
18332
|
+
},
|
|
18333
|
+
cell.id
|
|
18334
|
+
);
|
|
18335
|
+
}) }, row.id)) }) }) });
|
|
18336
|
+
}
|
|
18301
18337
|
case JSON_TYPES.NUMBER_LINE:
|
|
18302
18338
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
18303
18339
|
NumberLineRenderer,
|