@mathscan/math-exercise-engine 1.1.14 → 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 +80 -0
- package/dist/index.js +57 -29
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +57 -29
- package/dist/index.mjs.map +1 -1
- package/dist/style.css +202 -57
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -718,7 +718,9 @@ export declare function compileWithAST(dsl: string): {
|
|
|
718
718
|
})[];
|
|
719
719
|
colspan?: number | undefined;
|
|
720
720
|
rowspan?: number | undefined;
|
|
721
|
+
backgroundColor?: string | undefined;
|
|
721
722
|
}[];
|
|
723
|
+
backgroundColor?: string | undefined;
|
|
722
724
|
}[];
|
|
723
725
|
} | {
|
|
724
726
|
items: ({
|
|
@@ -1499,10 +1501,12 @@ export declare const ContentBlockSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
1499
1501
|
cols: z.ZodNumber;
|
|
1500
1502
|
rows: z.ZodArray<z.ZodObject<{
|
|
1501
1503
|
type: z.ZodLiteral<"TableRow">;
|
|
1504
|
+
backgroundColor: z.ZodOptional<z.ZodString>;
|
|
1502
1505
|
cells: z.ZodArray<z.ZodObject<{
|
|
1503
1506
|
type: z.ZodLiteral<"TableCell">;
|
|
1504
1507
|
colspan: z.ZodOptional<z.ZodNumber>;
|
|
1505
1508
|
rowspan: z.ZodOptional<z.ZodNumber>;
|
|
1509
|
+
backgroundColor: z.ZodOptional<z.ZodString>;
|
|
1506
1510
|
inlines: z.ZodArray<z.ZodUnion<[z.ZodObject<{
|
|
1507
1511
|
type: z.ZodLiteral<"FreeText">;
|
|
1508
1512
|
value: z.ZodString;
|
|
@@ -1833,6 +1837,7 @@ export declare const ContentBlockSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
1833
1837
|
})[];
|
|
1834
1838
|
colspan?: number | undefined;
|
|
1835
1839
|
rowspan?: number | undefined;
|
|
1840
|
+
backgroundColor?: string | undefined;
|
|
1836
1841
|
}, {
|
|
1837
1842
|
type: "TableCell";
|
|
1838
1843
|
inlines: ({
|
|
@@ -1914,6 +1919,7 @@ export declare const ContentBlockSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
1914
1919
|
})[];
|
|
1915
1920
|
colspan?: number | undefined;
|
|
1916
1921
|
rowspan?: number | undefined;
|
|
1922
|
+
backgroundColor?: string | undefined;
|
|
1917
1923
|
}>, "many">;
|
|
1918
1924
|
}, "strip", z.ZodTypeAny, {
|
|
1919
1925
|
type: "TableRow";
|
|
@@ -1998,7 +2004,9 @@ export declare const ContentBlockSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
1998
2004
|
})[];
|
|
1999
2005
|
colspan?: number | undefined;
|
|
2000
2006
|
rowspan?: number | undefined;
|
|
2007
|
+
backgroundColor?: string | undefined;
|
|
2001
2008
|
}[];
|
|
2009
|
+
backgroundColor?: string | undefined;
|
|
2002
2010
|
}, {
|
|
2003
2011
|
type: "TableRow";
|
|
2004
2012
|
cells: {
|
|
@@ -2082,7 +2090,9 @@ export declare const ContentBlockSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
2082
2090
|
})[];
|
|
2083
2091
|
colspan?: number | undefined;
|
|
2084
2092
|
rowspan?: number | undefined;
|
|
2093
|
+
backgroundColor?: string | undefined;
|
|
2085
2094
|
}[];
|
|
2095
|
+
backgroundColor?: string | undefined;
|
|
2086
2096
|
}>, "many">;
|
|
2087
2097
|
}, "strip", z.ZodTypeAny, {
|
|
2088
2098
|
type: "TableBlock";
|
|
@@ -2170,7 +2180,9 @@ export declare const ContentBlockSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
2170
2180
|
})[];
|
|
2171
2181
|
colspan?: number | undefined;
|
|
2172
2182
|
rowspan?: number | undefined;
|
|
2183
|
+
backgroundColor?: string | undefined;
|
|
2173
2184
|
}[];
|
|
2185
|
+
backgroundColor?: string | undefined;
|
|
2174
2186
|
}[];
|
|
2175
2187
|
}, {
|
|
2176
2188
|
type: "TableBlock";
|
|
@@ -2258,7 +2270,9 @@ export declare const ContentBlockSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
2258
2270
|
})[];
|
|
2259
2271
|
colspan?: number | undefined;
|
|
2260
2272
|
rowspan?: number | undefined;
|
|
2273
|
+
backgroundColor?: string | undefined;
|
|
2261
2274
|
}[];
|
|
2275
|
+
backgroundColor?: string | undefined;
|
|
2262
2276
|
}[];
|
|
2263
2277
|
}>, z.ZodObject<{
|
|
2264
2278
|
type: z.ZodLiteral<"RadioOptions">;
|
|
@@ -7489,10 +7503,12 @@ export declare const ExerciseDocumentSchema: z.ZodEffects<z.ZodObject<{
|
|
|
7489
7503
|
cols: z.ZodNumber;
|
|
7490
7504
|
rows: z.ZodArray<z.ZodObject<{
|
|
7491
7505
|
type: z.ZodLiteral<"TableRow">;
|
|
7506
|
+
backgroundColor: z.ZodOptional<z.ZodString>;
|
|
7492
7507
|
cells: z.ZodArray<z.ZodObject<{
|
|
7493
7508
|
type: z.ZodLiteral<"TableCell">;
|
|
7494
7509
|
colspan: z.ZodOptional<z.ZodNumber>;
|
|
7495
7510
|
rowspan: z.ZodOptional<z.ZodNumber>;
|
|
7511
|
+
backgroundColor: z.ZodOptional<z.ZodString>;
|
|
7496
7512
|
inlines: z.ZodArray<z.ZodUnion<[z.ZodObject<{
|
|
7497
7513
|
type: z.ZodLiteral<"FreeText">;
|
|
7498
7514
|
value: z.ZodString;
|
|
@@ -7823,6 +7839,7 @@ export declare const ExerciseDocumentSchema: z.ZodEffects<z.ZodObject<{
|
|
|
7823
7839
|
})[];
|
|
7824
7840
|
colspan?: number | undefined;
|
|
7825
7841
|
rowspan?: number | undefined;
|
|
7842
|
+
backgroundColor?: string | undefined;
|
|
7826
7843
|
}, {
|
|
7827
7844
|
type: "TableCell";
|
|
7828
7845
|
inlines: ({
|
|
@@ -7904,6 +7921,7 @@ export declare const ExerciseDocumentSchema: z.ZodEffects<z.ZodObject<{
|
|
|
7904
7921
|
})[];
|
|
7905
7922
|
colspan?: number | undefined;
|
|
7906
7923
|
rowspan?: number | undefined;
|
|
7924
|
+
backgroundColor?: string | undefined;
|
|
7907
7925
|
}>, "many">;
|
|
7908
7926
|
}, "strip", z.ZodTypeAny, {
|
|
7909
7927
|
type: "TableRow";
|
|
@@ -7988,7 +8006,9 @@ export declare const ExerciseDocumentSchema: z.ZodEffects<z.ZodObject<{
|
|
|
7988
8006
|
})[];
|
|
7989
8007
|
colspan?: number | undefined;
|
|
7990
8008
|
rowspan?: number | undefined;
|
|
8009
|
+
backgroundColor?: string | undefined;
|
|
7991
8010
|
}[];
|
|
8011
|
+
backgroundColor?: string | undefined;
|
|
7992
8012
|
}, {
|
|
7993
8013
|
type: "TableRow";
|
|
7994
8014
|
cells: {
|
|
@@ -8072,7 +8092,9 @@ export declare const ExerciseDocumentSchema: z.ZodEffects<z.ZodObject<{
|
|
|
8072
8092
|
})[];
|
|
8073
8093
|
colspan?: number | undefined;
|
|
8074
8094
|
rowspan?: number | undefined;
|
|
8095
|
+
backgroundColor?: string | undefined;
|
|
8075
8096
|
}[];
|
|
8097
|
+
backgroundColor?: string | undefined;
|
|
8076
8098
|
}>, "many">;
|
|
8077
8099
|
}, "strip", z.ZodTypeAny, {
|
|
8078
8100
|
type: "TableBlock";
|
|
@@ -8160,7 +8182,9 @@ export declare const ExerciseDocumentSchema: z.ZodEffects<z.ZodObject<{
|
|
|
8160
8182
|
})[];
|
|
8161
8183
|
colspan?: number | undefined;
|
|
8162
8184
|
rowspan?: number | undefined;
|
|
8185
|
+
backgroundColor?: string | undefined;
|
|
8163
8186
|
}[];
|
|
8187
|
+
backgroundColor?: string | undefined;
|
|
8164
8188
|
}[];
|
|
8165
8189
|
}, {
|
|
8166
8190
|
type: "TableBlock";
|
|
@@ -8248,7 +8272,9 @@ export declare const ExerciseDocumentSchema: z.ZodEffects<z.ZodObject<{
|
|
|
8248
8272
|
})[];
|
|
8249
8273
|
colspan?: number | undefined;
|
|
8250
8274
|
rowspan?: number | undefined;
|
|
8275
|
+
backgroundColor?: string | undefined;
|
|
8251
8276
|
}[];
|
|
8277
|
+
backgroundColor?: string | undefined;
|
|
8252
8278
|
}[];
|
|
8253
8279
|
}>, z.ZodObject<{
|
|
8254
8280
|
type: z.ZodLiteral<"RadioOptions">;
|
|
@@ -13041,7 +13067,9 @@ export declare const ExerciseDocumentSchema: z.ZodEffects<z.ZodObject<{
|
|
|
13041
13067
|
})[];
|
|
13042
13068
|
colspan?: number | undefined;
|
|
13043
13069
|
rowspan?: number | undefined;
|
|
13070
|
+
backgroundColor?: string | undefined;
|
|
13044
13071
|
}[];
|
|
13072
|
+
backgroundColor?: string | undefined;
|
|
13045
13073
|
}[];
|
|
13046
13074
|
} | {
|
|
13047
13075
|
items: ({
|
|
@@ -13672,7 +13700,9 @@ export declare const ExerciseDocumentSchema: z.ZodEffects<z.ZodObject<{
|
|
|
13672
13700
|
})[];
|
|
13673
13701
|
colspan?: number | undefined;
|
|
13674
13702
|
rowspan?: number | undefined;
|
|
13703
|
+
backgroundColor?: string | undefined;
|
|
13675
13704
|
}[];
|
|
13705
|
+
backgroundColor?: string | undefined;
|
|
13676
13706
|
}[];
|
|
13677
13707
|
} | {
|
|
13678
13708
|
items: ({
|
|
@@ -14303,7 +14333,9 @@ export declare const ExerciseDocumentSchema: z.ZodEffects<z.ZodObject<{
|
|
|
14303
14333
|
})[];
|
|
14304
14334
|
colspan?: number | undefined;
|
|
14305
14335
|
rowspan?: number | undefined;
|
|
14336
|
+
backgroundColor?: string | undefined;
|
|
14306
14337
|
}[];
|
|
14338
|
+
backgroundColor?: string | undefined;
|
|
14307
14339
|
}[];
|
|
14308
14340
|
} | {
|
|
14309
14341
|
items: ({
|
|
@@ -14934,7 +14966,9 @@ export declare const ExerciseDocumentSchema: z.ZodEffects<z.ZodObject<{
|
|
|
14934
14966
|
})[];
|
|
14935
14967
|
colspan?: number | undefined;
|
|
14936
14968
|
rowspan?: number | undefined;
|
|
14969
|
+
backgroundColor?: string | undefined;
|
|
14937
14970
|
}[];
|
|
14971
|
+
backgroundColor?: string | undefined;
|
|
14938
14972
|
}[];
|
|
14939
14973
|
} | {
|
|
14940
14974
|
items: ({
|
|
@@ -23971,10 +24005,12 @@ declare const TableBlockSchema: z.ZodObject<{
|
|
|
23971
24005
|
cols: z.ZodNumber;
|
|
23972
24006
|
rows: z.ZodArray<z.ZodObject<{
|
|
23973
24007
|
type: z.ZodLiteral<"TableRow">;
|
|
24008
|
+
backgroundColor: z.ZodOptional<z.ZodString>;
|
|
23974
24009
|
cells: z.ZodArray<z.ZodObject<{
|
|
23975
24010
|
type: z.ZodLiteral<"TableCell">;
|
|
23976
24011
|
colspan: z.ZodOptional<z.ZodNumber>;
|
|
23977
24012
|
rowspan: z.ZodOptional<z.ZodNumber>;
|
|
24013
|
+
backgroundColor: z.ZodOptional<z.ZodString>;
|
|
23978
24014
|
inlines: z.ZodArray<z.ZodUnion<[z.ZodObject<{
|
|
23979
24015
|
type: z.ZodLiteral<"FreeText">;
|
|
23980
24016
|
value: z.ZodString;
|
|
@@ -24305,6 +24341,7 @@ declare const TableBlockSchema: z.ZodObject<{
|
|
|
24305
24341
|
})[];
|
|
24306
24342
|
colspan?: number | undefined;
|
|
24307
24343
|
rowspan?: number | undefined;
|
|
24344
|
+
backgroundColor?: string | undefined;
|
|
24308
24345
|
}, {
|
|
24309
24346
|
type: "TableCell";
|
|
24310
24347
|
inlines: ({
|
|
@@ -24386,6 +24423,7 @@ declare const TableBlockSchema: z.ZodObject<{
|
|
|
24386
24423
|
})[];
|
|
24387
24424
|
colspan?: number | undefined;
|
|
24388
24425
|
rowspan?: number | undefined;
|
|
24426
|
+
backgroundColor?: string | undefined;
|
|
24389
24427
|
}>, "many">;
|
|
24390
24428
|
}, "strip", z.ZodTypeAny, {
|
|
24391
24429
|
type: "TableRow";
|
|
@@ -24470,7 +24508,9 @@ declare const TableBlockSchema: z.ZodObject<{
|
|
|
24470
24508
|
})[];
|
|
24471
24509
|
colspan?: number | undefined;
|
|
24472
24510
|
rowspan?: number | undefined;
|
|
24511
|
+
backgroundColor?: string | undefined;
|
|
24473
24512
|
}[];
|
|
24513
|
+
backgroundColor?: string | undefined;
|
|
24474
24514
|
}, {
|
|
24475
24515
|
type: "TableRow";
|
|
24476
24516
|
cells: {
|
|
@@ -24554,7 +24594,9 @@ declare const TableBlockSchema: z.ZodObject<{
|
|
|
24554
24594
|
})[];
|
|
24555
24595
|
colspan?: number | undefined;
|
|
24556
24596
|
rowspan?: number | undefined;
|
|
24597
|
+
backgroundColor?: string | undefined;
|
|
24557
24598
|
}[];
|
|
24599
|
+
backgroundColor?: string | undefined;
|
|
24558
24600
|
}>, "many">;
|
|
24559
24601
|
}, "strip", z.ZodTypeAny, {
|
|
24560
24602
|
type: "TableBlock";
|
|
@@ -24642,7 +24684,9 @@ declare const TableBlockSchema: z.ZodObject<{
|
|
|
24642
24684
|
})[];
|
|
24643
24685
|
colspan?: number | undefined;
|
|
24644
24686
|
rowspan?: number | undefined;
|
|
24687
|
+
backgroundColor?: string | undefined;
|
|
24645
24688
|
}[];
|
|
24689
|
+
backgroundColor?: string | undefined;
|
|
24646
24690
|
}[];
|
|
24647
24691
|
}, {
|
|
24648
24692
|
type: "TableBlock";
|
|
@@ -24730,7 +24774,9 @@ declare const TableBlockSchema: z.ZodObject<{
|
|
|
24730
24774
|
})[];
|
|
24731
24775
|
colspan?: number | undefined;
|
|
24732
24776
|
rowspan?: number | undefined;
|
|
24777
|
+
backgroundColor?: string | undefined;
|
|
24733
24778
|
}[];
|
|
24779
|
+
backgroundColor?: string | undefined;
|
|
24734
24780
|
}[];
|
|
24735
24781
|
}>;
|
|
24736
24782
|
|
|
@@ -24743,6 +24789,7 @@ export declare const TableCellItemSchema: z.ZodObject<{
|
|
|
24743
24789
|
type: z.ZodLiteral<"table-cell">;
|
|
24744
24790
|
colspan: z.ZodOptional<z.ZodNumber>;
|
|
24745
24791
|
rowspan: z.ZodOptional<z.ZodNumber>;
|
|
24792
|
+
backgroundColor: z.ZodOptional<z.ZodString>;
|
|
24746
24793
|
items: z.ZodArray<z.ZodType<any, z.ZodTypeDef, any>, "many">;
|
|
24747
24794
|
}, "strip", z.ZodTypeAny, {
|
|
24748
24795
|
items: any[];
|
|
@@ -24750,18 +24797,21 @@ export declare const TableCellItemSchema: z.ZodObject<{
|
|
|
24750
24797
|
id: string;
|
|
24751
24798
|
colspan?: number | undefined;
|
|
24752
24799
|
rowspan?: number | undefined;
|
|
24800
|
+
backgroundColor?: string | undefined;
|
|
24753
24801
|
}, {
|
|
24754
24802
|
items: any[];
|
|
24755
24803
|
type: "table-cell";
|
|
24756
24804
|
id: string;
|
|
24757
24805
|
colspan?: number | undefined;
|
|
24758
24806
|
rowspan?: number | undefined;
|
|
24807
|
+
backgroundColor?: string | undefined;
|
|
24759
24808
|
}>;
|
|
24760
24809
|
|
|
24761
24810
|
declare const TableCellSchema: z.ZodObject<{
|
|
24762
24811
|
type: z.ZodLiteral<"TableCell">;
|
|
24763
24812
|
colspan: z.ZodOptional<z.ZodNumber>;
|
|
24764
24813
|
rowspan: z.ZodOptional<z.ZodNumber>;
|
|
24814
|
+
backgroundColor: z.ZodOptional<z.ZodString>;
|
|
24765
24815
|
inlines: z.ZodArray<z.ZodUnion<[z.ZodObject<{
|
|
24766
24816
|
type: z.ZodLiteral<"FreeText">;
|
|
24767
24817
|
value: z.ZodString;
|
|
@@ -25092,6 +25142,7 @@ declare const TableCellSchema: z.ZodObject<{
|
|
|
25092
25142
|
})[];
|
|
25093
25143
|
colspan?: number | undefined;
|
|
25094
25144
|
rowspan?: number | undefined;
|
|
25145
|
+
backgroundColor?: string | undefined;
|
|
25095
25146
|
}, {
|
|
25096
25147
|
type: "TableCell";
|
|
25097
25148
|
inlines: ({
|
|
@@ -25173,6 +25224,7 @@ declare const TableCellSchema: z.ZodObject<{
|
|
|
25173
25224
|
})[];
|
|
25174
25225
|
colspan?: number | undefined;
|
|
25175
25226
|
rowspan?: number | undefined;
|
|
25227
|
+
backgroundColor?: string | undefined;
|
|
25176
25228
|
}>;
|
|
25177
25229
|
|
|
25178
25230
|
export declare type TableItem = z.infer<typeof TableItemSchema>;
|
|
@@ -25184,11 +25236,13 @@ export declare const TableItemSchema: z.ZodObject<{
|
|
|
25184
25236
|
rows: z.ZodArray<z.ZodObject<{
|
|
25185
25237
|
id: z.ZodString;
|
|
25186
25238
|
type: z.ZodLiteral<"table-row">;
|
|
25239
|
+
backgroundColor: z.ZodOptional<z.ZodString>;
|
|
25187
25240
|
cells: z.ZodArray<z.ZodObject<{
|
|
25188
25241
|
id: z.ZodString;
|
|
25189
25242
|
type: z.ZodLiteral<"table-cell">;
|
|
25190
25243
|
colspan: z.ZodOptional<z.ZodNumber>;
|
|
25191
25244
|
rowspan: z.ZodOptional<z.ZodNumber>;
|
|
25245
|
+
backgroundColor: z.ZodOptional<z.ZodString>;
|
|
25192
25246
|
items: z.ZodArray<z.ZodType<any, z.ZodTypeDef, any>, "many">;
|
|
25193
25247
|
}, "strip", z.ZodTypeAny, {
|
|
25194
25248
|
items: any[];
|
|
@@ -25196,12 +25250,14 @@ export declare const TableItemSchema: z.ZodObject<{
|
|
|
25196
25250
|
id: string;
|
|
25197
25251
|
colspan?: number | undefined;
|
|
25198
25252
|
rowspan?: number | undefined;
|
|
25253
|
+
backgroundColor?: string | undefined;
|
|
25199
25254
|
}, {
|
|
25200
25255
|
items: any[];
|
|
25201
25256
|
type: "table-cell";
|
|
25202
25257
|
id: string;
|
|
25203
25258
|
colspan?: number | undefined;
|
|
25204
25259
|
rowspan?: number | undefined;
|
|
25260
|
+
backgroundColor?: string | undefined;
|
|
25205
25261
|
}>, "many">;
|
|
25206
25262
|
}, "strip", z.ZodTypeAny, {
|
|
25207
25263
|
type: "table-row";
|
|
@@ -25211,8 +25267,10 @@ export declare const TableItemSchema: z.ZodObject<{
|
|
|
25211
25267
|
id: string;
|
|
25212
25268
|
colspan?: number | undefined;
|
|
25213
25269
|
rowspan?: number | undefined;
|
|
25270
|
+
backgroundColor?: string | undefined;
|
|
25214
25271
|
}[];
|
|
25215
25272
|
id: string;
|
|
25273
|
+
backgroundColor?: string | undefined;
|
|
25216
25274
|
}, {
|
|
25217
25275
|
type: "table-row";
|
|
25218
25276
|
cells: {
|
|
@@ -25221,8 +25279,10 @@ export declare const TableItemSchema: z.ZodObject<{
|
|
|
25221
25279
|
id: string;
|
|
25222
25280
|
colspan?: number | undefined;
|
|
25223
25281
|
rowspan?: number | undefined;
|
|
25282
|
+
backgroundColor?: string | undefined;
|
|
25224
25283
|
}[];
|
|
25225
25284
|
id: string;
|
|
25285
|
+
backgroundColor?: string | undefined;
|
|
25226
25286
|
}>, "many">;
|
|
25227
25287
|
}, "strip", z.ZodTypeAny, {
|
|
25228
25288
|
type: "table";
|
|
@@ -25235,8 +25295,10 @@ export declare const TableItemSchema: z.ZodObject<{
|
|
|
25235
25295
|
id: string;
|
|
25236
25296
|
colspan?: number | undefined;
|
|
25237
25297
|
rowspan?: number | undefined;
|
|
25298
|
+
backgroundColor?: string | undefined;
|
|
25238
25299
|
}[];
|
|
25239
25300
|
id: string;
|
|
25301
|
+
backgroundColor?: string | undefined;
|
|
25240
25302
|
}[];
|
|
25241
25303
|
id: string;
|
|
25242
25304
|
}, {
|
|
@@ -25250,8 +25312,10 @@ export declare const TableItemSchema: z.ZodObject<{
|
|
|
25250
25312
|
id: string;
|
|
25251
25313
|
colspan?: number | undefined;
|
|
25252
25314
|
rowspan?: number | undefined;
|
|
25315
|
+
backgroundColor?: string | undefined;
|
|
25253
25316
|
}[];
|
|
25254
25317
|
id: string;
|
|
25318
|
+
backgroundColor?: string | undefined;
|
|
25255
25319
|
}[];
|
|
25256
25320
|
id: string;
|
|
25257
25321
|
}>;
|
|
@@ -25263,11 +25327,13 @@ export declare type TableRowItem = z.infer<typeof TableRowItemSchema>;
|
|
|
25263
25327
|
export declare const TableRowItemSchema: z.ZodObject<{
|
|
25264
25328
|
id: z.ZodString;
|
|
25265
25329
|
type: z.ZodLiteral<"table-row">;
|
|
25330
|
+
backgroundColor: z.ZodOptional<z.ZodString>;
|
|
25266
25331
|
cells: z.ZodArray<z.ZodObject<{
|
|
25267
25332
|
id: z.ZodString;
|
|
25268
25333
|
type: z.ZodLiteral<"table-cell">;
|
|
25269
25334
|
colspan: z.ZodOptional<z.ZodNumber>;
|
|
25270
25335
|
rowspan: z.ZodOptional<z.ZodNumber>;
|
|
25336
|
+
backgroundColor: z.ZodOptional<z.ZodString>;
|
|
25271
25337
|
items: z.ZodArray<z.ZodType<any, z.ZodTypeDef, any>, "many">;
|
|
25272
25338
|
}, "strip", z.ZodTypeAny, {
|
|
25273
25339
|
items: any[];
|
|
@@ -25275,12 +25341,14 @@ export declare const TableRowItemSchema: z.ZodObject<{
|
|
|
25275
25341
|
id: string;
|
|
25276
25342
|
colspan?: number | undefined;
|
|
25277
25343
|
rowspan?: number | undefined;
|
|
25344
|
+
backgroundColor?: string | undefined;
|
|
25278
25345
|
}, {
|
|
25279
25346
|
items: any[];
|
|
25280
25347
|
type: "table-cell";
|
|
25281
25348
|
id: string;
|
|
25282
25349
|
colspan?: number | undefined;
|
|
25283
25350
|
rowspan?: number | undefined;
|
|
25351
|
+
backgroundColor?: string | undefined;
|
|
25284
25352
|
}>, "many">;
|
|
25285
25353
|
}, "strip", z.ZodTypeAny, {
|
|
25286
25354
|
type: "table-row";
|
|
@@ -25290,8 +25358,10 @@ export declare const TableRowItemSchema: z.ZodObject<{
|
|
|
25290
25358
|
id: string;
|
|
25291
25359
|
colspan?: number | undefined;
|
|
25292
25360
|
rowspan?: number | undefined;
|
|
25361
|
+
backgroundColor?: string | undefined;
|
|
25293
25362
|
}[];
|
|
25294
25363
|
id: string;
|
|
25364
|
+
backgroundColor?: string | undefined;
|
|
25295
25365
|
}, {
|
|
25296
25366
|
type: "table-row";
|
|
25297
25367
|
cells: {
|
|
@@ -25300,16 +25370,20 @@ export declare const TableRowItemSchema: z.ZodObject<{
|
|
|
25300
25370
|
id: string;
|
|
25301
25371
|
colspan?: number | undefined;
|
|
25302
25372
|
rowspan?: number | undefined;
|
|
25373
|
+
backgroundColor?: string | undefined;
|
|
25303
25374
|
}[];
|
|
25304
25375
|
id: string;
|
|
25376
|
+
backgroundColor?: string | undefined;
|
|
25305
25377
|
}>;
|
|
25306
25378
|
|
|
25307
25379
|
declare const TableRowSchema: z.ZodObject<{
|
|
25308
25380
|
type: z.ZodLiteral<"TableRow">;
|
|
25381
|
+
backgroundColor: z.ZodOptional<z.ZodString>;
|
|
25309
25382
|
cells: z.ZodArray<z.ZodObject<{
|
|
25310
25383
|
type: z.ZodLiteral<"TableCell">;
|
|
25311
25384
|
colspan: z.ZodOptional<z.ZodNumber>;
|
|
25312
25385
|
rowspan: z.ZodOptional<z.ZodNumber>;
|
|
25386
|
+
backgroundColor: z.ZodOptional<z.ZodString>;
|
|
25313
25387
|
inlines: z.ZodArray<z.ZodUnion<[z.ZodObject<{
|
|
25314
25388
|
type: z.ZodLiteral<"FreeText">;
|
|
25315
25389
|
value: z.ZodString;
|
|
@@ -25640,6 +25714,7 @@ declare const TableRowSchema: z.ZodObject<{
|
|
|
25640
25714
|
})[];
|
|
25641
25715
|
colspan?: number | undefined;
|
|
25642
25716
|
rowspan?: number | undefined;
|
|
25717
|
+
backgroundColor?: string | undefined;
|
|
25643
25718
|
}, {
|
|
25644
25719
|
type: "TableCell";
|
|
25645
25720
|
inlines: ({
|
|
@@ -25721,6 +25796,7 @@ declare const TableRowSchema: z.ZodObject<{
|
|
|
25721
25796
|
})[];
|
|
25722
25797
|
colspan?: number | undefined;
|
|
25723
25798
|
rowspan?: number | undefined;
|
|
25799
|
+
backgroundColor?: string | undefined;
|
|
25724
25800
|
}>, "many">;
|
|
25725
25801
|
}, "strip", z.ZodTypeAny, {
|
|
25726
25802
|
type: "TableRow";
|
|
@@ -25805,7 +25881,9 @@ declare const TableRowSchema: z.ZodObject<{
|
|
|
25805
25881
|
})[];
|
|
25806
25882
|
colspan?: number | undefined;
|
|
25807
25883
|
rowspan?: number | undefined;
|
|
25884
|
+
backgroundColor?: string | undefined;
|
|
25808
25885
|
}[];
|
|
25886
|
+
backgroundColor?: string | undefined;
|
|
25809
25887
|
}, {
|
|
25810
25888
|
type: "TableRow";
|
|
25811
25889
|
cells: {
|
|
@@ -25889,7 +25967,9 @@ declare const TableRowSchema: z.ZodObject<{
|
|
|
25889
25967
|
})[];
|
|
25890
25968
|
colspan?: number | undefined;
|
|
25891
25969
|
rowspan?: number | undefined;
|
|
25970
|
+
backgroundColor?: string | undefined;
|
|
25892
25971
|
}[];
|
|
25972
|
+
backgroundColor?: string | undefined;
|
|
25893
25973
|
}>;
|
|
25894
25974
|
|
|
25895
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
|
});
|
|
@@ -2062,23 +2067,27 @@ const TableCellSchema = zod.z.object({
|
|
|
2062
2067
|
type: zod.z.literal(AST_TYPES.TABLE_CELL),
|
|
2063
2068
|
colspan: zod.z.number().int().positive().optional(),
|
|
2064
2069
|
rowspan: zod.z.number().int().positive().optional(),
|
|
2070
|
+
backgroundColor: zod.z.string().optional(),
|
|
2065
2071
|
inlines: zod.z.array(InlineNodeSchema)
|
|
2066
2072
|
});
|
|
2067
|
-
function createTableCell(inlines, colspan, rowspan) {
|
|
2073
|
+
function createTableCell(inlines, colspan, rowspan, backgroundColor) {
|
|
2068
2074
|
return TableCellSchema.parse({
|
|
2069
2075
|
type: AST_TYPES.TABLE_CELL,
|
|
2070
2076
|
colspan,
|
|
2071
2077
|
rowspan,
|
|
2078
|
+
backgroundColor,
|
|
2072
2079
|
inlines
|
|
2073
2080
|
});
|
|
2074
2081
|
}
|
|
2075
2082
|
const TableRowSchema = zod.z.object({
|
|
2076
2083
|
type: zod.z.literal(AST_TYPES.TABLE_ROW),
|
|
2084
|
+
backgroundColor: zod.z.string().optional(),
|
|
2077
2085
|
cells: zod.z.array(TableCellSchema).min(1)
|
|
2078
2086
|
});
|
|
2079
|
-
function createTableRow(cells) {
|
|
2087
|
+
function createTableRow(cells, backgroundColor) {
|
|
2080
2088
|
return TableRowSchema.parse({
|
|
2081
2089
|
type: AST_TYPES.TABLE_ROW,
|
|
2090
|
+
backgroundColor,
|
|
2082
2091
|
cells
|
|
2083
2092
|
});
|
|
2084
2093
|
}
|
|
@@ -2678,15 +2687,18 @@ class NaturalDSLVisitor extends BaseCstVisitor {
|
|
|
2678
2687
|
return createTableBlock(cols, rows);
|
|
2679
2688
|
}
|
|
2680
2689
|
row(ctx) {
|
|
2690
|
+
const params = ctx.parameterList ? this.visit(ctx.parameterList) : {};
|
|
2691
|
+
const backgroundColor = params.bgcolor;
|
|
2681
2692
|
const cells = ctx.cell.map((c) => this.visit(c));
|
|
2682
|
-
return createTableRow(cells);
|
|
2693
|
+
return createTableRow(cells, backgroundColor);
|
|
2683
2694
|
}
|
|
2684
2695
|
cell(ctx) {
|
|
2685
2696
|
const params = ctx.parameterList ? this.visit(ctx.parameterList) : {};
|
|
2686
2697
|
const colspan = params.colspan;
|
|
2687
2698
|
const rowspan = params.rowspan;
|
|
2699
|
+
const backgroundColor = params.bgcolor;
|
|
2688
2700
|
const inlines = ctx.inlineElement ? ctx.inlineElement.map((elem) => this.visit(elem)) : [];
|
|
2689
|
-
return createTableCell(inlines, colspan, rowspan);
|
|
2701
|
+
return createTableCell(inlines, colspan, rowspan, backgroundColor);
|
|
2690
2702
|
}
|
|
2691
2703
|
// ═══════════════════════════════════════════════════════════════════════════
|
|
2692
2704
|
// Number Line Block
|
|
@@ -3388,11 +3400,13 @@ const TableCellItemSchema = zod.z.object({
|
|
|
3388
3400
|
type: zod.z.literal(JSON_TYPES.TABLE_CELL),
|
|
3389
3401
|
colspan: zod.z.number().int().positive().optional(),
|
|
3390
3402
|
rowspan: zod.z.number().int().positive().optional(),
|
|
3403
|
+
backgroundColor: zod.z.string().optional(),
|
|
3391
3404
|
items: zod.z.array(LayoutItemSchema)
|
|
3392
3405
|
});
|
|
3393
3406
|
const TableRowItemSchema = zod.z.object({
|
|
3394
3407
|
id: zod.z.string(),
|
|
3395
3408
|
type: zod.z.literal(JSON_TYPES.TABLE_ROW),
|
|
3409
|
+
backgroundColor: zod.z.string().optional(),
|
|
3396
3410
|
cells: zod.z.array(TableCellItemSchema)
|
|
3397
3411
|
});
|
|
3398
3412
|
const TableItemSchema = zod.z.object({
|
|
@@ -9677,13 +9691,20 @@ function transformTable(table, idGenerator, inlineDragIds) {
|
|
|
9677
9691
|
if (cell.rowspan !== void 0) {
|
|
9678
9692
|
cellItem.rowspan = cell.rowspan;
|
|
9679
9693
|
}
|
|
9694
|
+
if (cell.backgroundColor !== void 0) {
|
|
9695
|
+
cellItem.backgroundColor = cell.backgroundColor;
|
|
9696
|
+
}
|
|
9680
9697
|
return cellItem;
|
|
9681
9698
|
});
|
|
9682
|
-
|
|
9699
|
+
const rowItem = {
|
|
9683
9700
|
id: idGenerator.generate(JSON_TYPES.TABLE_ROW),
|
|
9684
9701
|
type: JSON_TYPES.TABLE_ROW,
|
|
9685
9702
|
cells
|
|
9686
9703
|
};
|
|
9704
|
+
if (row.backgroundColor !== void 0) {
|
|
9705
|
+
rowItem.backgroundColor = row.backgroundColor;
|
|
9706
|
+
}
|
|
9707
|
+
return rowItem;
|
|
9687
9708
|
});
|
|
9688
9709
|
return {
|
|
9689
9710
|
id: idGenerator.generate(JSON_TYPES.TABLE),
|
|
@@ -18282,30 +18303,37 @@ const LayoutRenderer = ({
|
|
|
18282
18303
|
},
|
|
18283
18304
|
subItem.id
|
|
18284
18305
|
)) });
|
|
18285
|
-
case JSON_TYPES.TABLE:
|
|
18286
|
-
|
|
18287
|
-
|
|
18288
|
-
|
|
18289
|
-
|
|
18290
|
-
|
|
18291
|
-
|
|
18292
|
-
|
|
18293
|
-
|
|
18294
|
-
|
|
18295
|
-
|
|
18296
|
-
|
|
18297
|
-
|
|
18298
|
-
|
|
18299
|
-
|
|
18300
|
-
|
|
18301
|
-
|
|
18302
|
-
|
|
18303
|
-
|
|
18304
|
-
|
|
18305
|
-
|
|
18306
|
-
|
|
18307
|
-
|
|
18308
|
-
|
|
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
|
+
}
|
|
18309
18337
|
case JSON_TYPES.NUMBER_LINE:
|
|
18310
18338
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
18311
18339
|
NumberLineRenderer,
|