@mathscan/math-exercise-engine 1.1.13 → 1.1.14

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
@@ -717,6 +717,7 @@ export declare function compileWithAST(dsl: string): {
717
717
  snap?: number | undefined;
718
718
  })[];
719
719
  colspan?: number | undefined;
720
+ rowspan?: number | undefined;
720
721
  }[];
721
722
  }[];
722
723
  } | {
@@ -1501,6 +1502,7 @@ export declare const ContentBlockSchema: z.ZodUnion<[z.ZodObject<{
1501
1502
  cells: z.ZodArray<z.ZodObject<{
1502
1503
  type: z.ZodLiteral<"TableCell">;
1503
1504
  colspan: z.ZodOptional<z.ZodNumber>;
1505
+ rowspan: z.ZodOptional<z.ZodNumber>;
1504
1506
  inlines: z.ZodArray<z.ZodUnion<[z.ZodObject<{
1505
1507
  type: z.ZodLiteral<"FreeText">;
1506
1508
  value: z.ZodString;
@@ -1830,6 +1832,7 @@ export declare const ContentBlockSchema: z.ZodUnion<[z.ZodObject<{
1830
1832
  snap?: number | undefined;
1831
1833
  })[];
1832
1834
  colspan?: number | undefined;
1835
+ rowspan?: number | undefined;
1833
1836
  }, {
1834
1837
  type: "TableCell";
1835
1838
  inlines: ({
@@ -1910,6 +1913,7 @@ export declare const ContentBlockSchema: z.ZodUnion<[z.ZodObject<{
1910
1913
  snap?: number | undefined;
1911
1914
  })[];
1912
1915
  colspan?: number | undefined;
1916
+ rowspan?: number | undefined;
1913
1917
  }>, "many">;
1914
1918
  }, "strip", z.ZodTypeAny, {
1915
1919
  type: "TableRow";
@@ -1993,6 +1997,7 @@ export declare const ContentBlockSchema: z.ZodUnion<[z.ZodObject<{
1993
1997
  snap?: number | undefined;
1994
1998
  })[];
1995
1999
  colspan?: number | undefined;
2000
+ rowspan?: number | undefined;
1996
2001
  }[];
1997
2002
  }, {
1998
2003
  type: "TableRow";
@@ -2076,6 +2081,7 @@ export declare const ContentBlockSchema: z.ZodUnion<[z.ZodObject<{
2076
2081
  snap?: number | undefined;
2077
2082
  })[];
2078
2083
  colspan?: number | undefined;
2084
+ rowspan?: number | undefined;
2079
2085
  }[];
2080
2086
  }>, "many">;
2081
2087
  }, "strip", z.ZodTypeAny, {
@@ -2163,6 +2169,7 @@ export declare const ContentBlockSchema: z.ZodUnion<[z.ZodObject<{
2163
2169
  snap?: number | undefined;
2164
2170
  })[];
2165
2171
  colspan?: number | undefined;
2172
+ rowspan?: number | undefined;
2166
2173
  }[];
2167
2174
  }[];
2168
2175
  }, {
@@ -2250,6 +2257,7 @@ export declare const ContentBlockSchema: z.ZodUnion<[z.ZodObject<{
2250
2257
  snap?: number | undefined;
2251
2258
  })[];
2252
2259
  colspan?: number | undefined;
2260
+ rowspan?: number | undefined;
2253
2261
  }[];
2254
2262
  }[];
2255
2263
  }>, z.ZodObject<{
@@ -7484,6 +7492,7 @@ export declare const ExerciseDocumentSchema: z.ZodEffects<z.ZodObject<{
7484
7492
  cells: z.ZodArray<z.ZodObject<{
7485
7493
  type: z.ZodLiteral<"TableCell">;
7486
7494
  colspan: z.ZodOptional<z.ZodNumber>;
7495
+ rowspan: z.ZodOptional<z.ZodNumber>;
7487
7496
  inlines: z.ZodArray<z.ZodUnion<[z.ZodObject<{
7488
7497
  type: z.ZodLiteral<"FreeText">;
7489
7498
  value: z.ZodString;
@@ -7813,6 +7822,7 @@ export declare const ExerciseDocumentSchema: z.ZodEffects<z.ZodObject<{
7813
7822
  snap?: number | undefined;
7814
7823
  })[];
7815
7824
  colspan?: number | undefined;
7825
+ rowspan?: number | undefined;
7816
7826
  }, {
7817
7827
  type: "TableCell";
7818
7828
  inlines: ({
@@ -7893,6 +7903,7 @@ export declare const ExerciseDocumentSchema: z.ZodEffects<z.ZodObject<{
7893
7903
  snap?: number | undefined;
7894
7904
  })[];
7895
7905
  colspan?: number | undefined;
7906
+ rowspan?: number | undefined;
7896
7907
  }>, "many">;
7897
7908
  }, "strip", z.ZodTypeAny, {
7898
7909
  type: "TableRow";
@@ -7976,6 +7987,7 @@ export declare const ExerciseDocumentSchema: z.ZodEffects<z.ZodObject<{
7976
7987
  snap?: number | undefined;
7977
7988
  })[];
7978
7989
  colspan?: number | undefined;
7990
+ rowspan?: number | undefined;
7979
7991
  }[];
7980
7992
  }, {
7981
7993
  type: "TableRow";
@@ -8059,6 +8071,7 @@ export declare const ExerciseDocumentSchema: z.ZodEffects<z.ZodObject<{
8059
8071
  snap?: number | undefined;
8060
8072
  })[];
8061
8073
  colspan?: number | undefined;
8074
+ rowspan?: number | undefined;
8062
8075
  }[];
8063
8076
  }>, "many">;
8064
8077
  }, "strip", z.ZodTypeAny, {
@@ -8146,6 +8159,7 @@ export declare const ExerciseDocumentSchema: z.ZodEffects<z.ZodObject<{
8146
8159
  snap?: number | undefined;
8147
8160
  })[];
8148
8161
  colspan?: number | undefined;
8162
+ rowspan?: number | undefined;
8149
8163
  }[];
8150
8164
  }[];
8151
8165
  }, {
@@ -8233,6 +8247,7 @@ export declare const ExerciseDocumentSchema: z.ZodEffects<z.ZodObject<{
8233
8247
  snap?: number | undefined;
8234
8248
  })[];
8235
8249
  colspan?: number | undefined;
8250
+ rowspan?: number | undefined;
8236
8251
  }[];
8237
8252
  }[];
8238
8253
  }>, z.ZodObject<{
@@ -13025,6 +13040,7 @@ export declare const ExerciseDocumentSchema: z.ZodEffects<z.ZodObject<{
13025
13040
  snap?: number | undefined;
13026
13041
  })[];
13027
13042
  colspan?: number | undefined;
13043
+ rowspan?: number | undefined;
13028
13044
  }[];
13029
13045
  }[];
13030
13046
  } | {
@@ -13655,6 +13671,7 @@ export declare const ExerciseDocumentSchema: z.ZodEffects<z.ZodObject<{
13655
13671
  snap?: number | undefined;
13656
13672
  })[];
13657
13673
  colspan?: number | undefined;
13674
+ rowspan?: number | undefined;
13658
13675
  }[];
13659
13676
  }[];
13660
13677
  } | {
@@ -14285,6 +14302,7 @@ export declare const ExerciseDocumentSchema: z.ZodEffects<z.ZodObject<{
14285
14302
  snap?: number | undefined;
14286
14303
  })[];
14287
14304
  colspan?: number | undefined;
14305
+ rowspan?: number | undefined;
14288
14306
  }[];
14289
14307
  }[];
14290
14308
  } | {
@@ -14915,6 +14933,7 @@ export declare const ExerciseDocumentSchema: z.ZodEffects<z.ZodObject<{
14915
14933
  snap?: number | undefined;
14916
14934
  })[];
14917
14935
  colspan?: number | undefined;
14936
+ rowspan?: number | undefined;
14918
14937
  }[];
14919
14938
  }[];
14920
14939
  } | {
@@ -23955,6 +23974,7 @@ declare const TableBlockSchema: z.ZodObject<{
23955
23974
  cells: z.ZodArray<z.ZodObject<{
23956
23975
  type: z.ZodLiteral<"TableCell">;
23957
23976
  colspan: z.ZodOptional<z.ZodNumber>;
23977
+ rowspan: z.ZodOptional<z.ZodNumber>;
23958
23978
  inlines: z.ZodArray<z.ZodUnion<[z.ZodObject<{
23959
23979
  type: z.ZodLiteral<"FreeText">;
23960
23980
  value: z.ZodString;
@@ -24284,6 +24304,7 @@ declare const TableBlockSchema: z.ZodObject<{
24284
24304
  snap?: number | undefined;
24285
24305
  })[];
24286
24306
  colspan?: number | undefined;
24307
+ rowspan?: number | undefined;
24287
24308
  }, {
24288
24309
  type: "TableCell";
24289
24310
  inlines: ({
@@ -24364,6 +24385,7 @@ declare const TableBlockSchema: z.ZodObject<{
24364
24385
  snap?: number | undefined;
24365
24386
  })[];
24366
24387
  colspan?: number | undefined;
24388
+ rowspan?: number | undefined;
24367
24389
  }>, "many">;
24368
24390
  }, "strip", z.ZodTypeAny, {
24369
24391
  type: "TableRow";
@@ -24447,6 +24469,7 @@ declare const TableBlockSchema: z.ZodObject<{
24447
24469
  snap?: number | undefined;
24448
24470
  })[];
24449
24471
  colspan?: number | undefined;
24472
+ rowspan?: number | undefined;
24450
24473
  }[];
24451
24474
  }, {
24452
24475
  type: "TableRow";
@@ -24530,6 +24553,7 @@ declare const TableBlockSchema: z.ZodObject<{
24530
24553
  snap?: number | undefined;
24531
24554
  })[];
24532
24555
  colspan?: number | undefined;
24556
+ rowspan?: number | undefined;
24533
24557
  }[];
24534
24558
  }>, "many">;
24535
24559
  }, "strip", z.ZodTypeAny, {
@@ -24617,6 +24641,7 @@ declare const TableBlockSchema: z.ZodObject<{
24617
24641
  snap?: number | undefined;
24618
24642
  })[];
24619
24643
  colspan?: number | undefined;
24644
+ rowspan?: number | undefined;
24620
24645
  }[];
24621
24646
  }[];
24622
24647
  }, {
@@ -24704,6 +24729,7 @@ declare const TableBlockSchema: z.ZodObject<{
24704
24729
  snap?: number | undefined;
24705
24730
  })[];
24706
24731
  colspan?: number | undefined;
24732
+ rowspan?: number | undefined;
24707
24733
  }[];
24708
24734
  }[];
24709
24735
  }>;
@@ -24716,22 +24742,26 @@ export declare const TableCellItemSchema: z.ZodObject<{
24716
24742
  id: z.ZodString;
24717
24743
  type: z.ZodLiteral<"table-cell">;
24718
24744
  colspan: z.ZodOptional<z.ZodNumber>;
24745
+ rowspan: z.ZodOptional<z.ZodNumber>;
24719
24746
  items: z.ZodArray<z.ZodType<any, z.ZodTypeDef, any>, "many">;
24720
24747
  }, "strip", z.ZodTypeAny, {
24721
24748
  items: any[];
24722
24749
  type: "table-cell";
24723
24750
  id: string;
24724
24751
  colspan?: number | undefined;
24752
+ rowspan?: number | undefined;
24725
24753
  }, {
24726
24754
  items: any[];
24727
24755
  type: "table-cell";
24728
24756
  id: string;
24729
24757
  colspan?: number | undefined;
24758
+ rowspan?: number | undefined;
24730
24759
  }>;
24731
24760
 
24732
24761
  declare const TableCellSchema: z.ZodObject<{
24733
24762
  type: z.ZodLiteral<"TableCell">;
24734
24763
  colspan: z.ZodOptional<z.ZodNumber>;
24764
+ rowspan: z.ZodOptional<z.ZodNumber>;
24735
24765
  inlines: z.ZodArray<z.ZodUnion<[z.ZodObject<{
24736
24766
  type: z.ZodLiteral<"FreeText">;
24737
24767
  value: z.ZodString;
@@ -25061,6 +25091,7 @@ declare const TableCellSchema: z.ZodObject<{
25061
25091
  snap?: number | undefined;
25062
25092
  })[];
25063
25093
  colspan?: number | undefined;
25094
+ rowspan?: number | undefined;
25064
25095
  }, {
25065
25096
  type: "TableCell";
25066
25097
  inlines: ({
@@ -25141,6 +25172,7 @@ declare const TableCellSchema: z.ZodObject<{
25141
25172
  snap?: number | undefined;
25142
25173
  })[];
25143
25174
  colspan?: number | undefined;
25175
+ rowspan?: number | undefined;
25144
25176
  }>;
25145
25177
 
25146
25178
  export declare type TableItem = z.infer<typeof TableItemSchema>;
@@ -25156,17 +25188,20 @@ export declare const TableItemSchema: z.ZodObject<{
25156
25188
  id: z.ZodString;
25157
25189
  type: z.ZodLiteral<"table-cell">;
25158
25190
  colspan: z.ZodOptional<z.ZodNumber>;
25191
+ rowspan: z.ZodOptional<z.ZodNumber>;
25159
25192
  items: z.ZodArray<z.ZodType<any, z.ZodTypeDef, any>, "many">;
25160
25193
  }, "strip", z.ZodTypeAny, {
25161
25194
  items: any[];
25162
25195
  type: "table-cell";
25163
25196
  id: string;
25164
25197
  colspan?: number | undefined;
25198
+ rowspan?: number | undefined;
25165
25199
  }, {
25166
25200
  items: any[];
25167
25201
  type: "table-cell";
25168
25202
  id: string;
25169
25203
  colspan?: number | undefined;
25204
+ rowspan?: number | undefined;
25170
25205
  }>, "many">;
25171
25206
  }, "strip", z.ZodTypeAny, {
25172
25207
  type: "table-row";
@@ -25175,6 +25210,7 @@ export declare const TableItemSchema: z.ZodObject<{
25175
25210
  type: "table-cell";
25176
25211
  id: string;
25177
25212
  colspan?: number | undefined;
25213
+ rowspan?: number | undefined;
25178
25214
  }[];
25179
25215
  id: string;
25180
25216
  }, {
@@ -25184,6 +25220,7 @@ export declare const TableItemSchema: z.ZodObject<{
25184
25220
  type: "table-cell";
25185
25221
  id: string;
25186
25222
  colspan?: number | undefined;
25223
+ rowspan?: number | undefined;
25187
25224
  }[];
25188
25225
  id: string;
25189
25226
  }>, "many">;
@@ -25197,6 +25234,7 @@ export declare const TableItemSchema: z.ZodObject<{
25197
25234
  type: "table-cell";
25198
25235
  id: string;
25199
25236
  colspan?: number | undefined;
25237
+ rowspan?: number | undefined;
25200
25238
  }[];
25201
25239
  id: string;
25202
25240
  }[];
@@ -25211,6 +25249,7 @@ export declare const TableItemSchema: z.ZodObject<{
25211
25249
  type: "table-cell";
25212
25250
  id: string;
25213
25251
  colspan?: number | undefined;
25252
+ rowspan?: number | undefined;
25214
25253
  }[];
25215
25254
  id: string;
25216
25255
  }[];
@@ -25228,17 +25267,20 @@ export declare const TableRowItemSchema: z.ZodObject<{
25228
25267
  id: z.ZodString;
25229
25268
  type: z.ZodLiteral<"table-cell">;
25230
25269
  colspan: z.ZodOptional<z.ZodNumber>;
25270
+ rowspan: z.ZodOptional<z.ZodNumber>;
25231
25271
  items: z.ZodArray<z.ZodType<any, z.ZodTypeDef, any>, "many">;
25232
25272
  }, "strip", z.ZodTypeAny, {
25233
25273
  items: any[];
25234
25274
  type: "table-cell";
25235
25275
  id: string;
25236
25276
  colspan?: number | undefined;
25277
+ rowspan?: number | undefined;
25237
25278
  }, {
25238
25279
  items: any[];
25239
25280
  type: "table-cell";
25240
25281
  id: string;
25241
25282
  colspan?: number | undefined;
25283
+ rowspan?: number | undefined;
25242
25284
  }>, "many">;
25243
25285
  }, "strip", z.ZodTypeAny, {
25244
25286
  type: "table-row";
@@ -25247,6 +25289,7 @@ export declare const TableRowItemSchema: z.ZodObject<{
25247
25289
  type: "table-cell";
25248
25290
  id: string;
25249
25291
  colspan?: number | undefined;
25292
+ rowspan?: number | undefined;
25250
25293
  }[];
25251
25294
  id: string;
25252
25295
  }, {
@@ -25256,6 +25299,7 @@ export declare const TableRowItemSchema: z.ZodObject<{
25256
25299
  type: "table-cell";
25257
25300
  id: string;
25258
25301
  colspan?: number | undefined;
25302
+ rowspan?: number | undefined;
25259
25303
  }[];
25260
25304
  id: string;
25261
25305
  }>;
@@ -25265,6 +25309,7 @@ declare const TableRowSchema: z.ZodObject<{
25265
25309
  cells: z.ZodArray<z.ZodObject<{
25266
25310
  type: z.ZodLiteral<"TableCell">;
25267
25311
  colspan: z.ZodOptional<z.ZodNumber>;
25312
+ rowspan: z.ZodOptional<z.ZodNumber>;
25268
25313
  inlines: z.ZodArray<z.ZodUnion<[z.ZodObject<{
25269
25314
  type: z.ZodLiteral<"FreeText">;
25270
25315
  value: z.ZodString;
@@ -25594,6 +25639,7 @@ declare const TableRowSchema: z.ZodObject<{
25594
25639
  snap?: number | undefined;
25595
25640
  })[];
25596
25641
  colspan?: number | undefined;
25642
+ rowspan?: number | undefined;
25597
25643
  }, {
25598
25644
  type: "TableCell";
25599
25645
  inlines: ({
@@ -25674,6 +25720,7 @@ declare const TableRowSchema: z.ZodObject<{
25674
25720
  snap?: number | undefined;
25675
25721
  })[];
25676
25722
  colspan?: number | undefined;
25723
+ rowspan?: number | undefined;
25677
25724
  }>, "many">;
25678
25725
  }, "strip", z.ZodTypeAny, {
25679
25726
  type: "TableRow";
@@ -25757,6 +25804,7 @@ declare const TableRowSchema: z.ZodObject<{
25757
25804
  snap?: number | undefined;
25758
25805
  })[];
25759
25806
  colspan?: number | undefined;
25807
+ rowspan?: number | undefined;
25760
25808
  }[];
25761
25809
  }, {
25762
25810
  type: "TableRow";
@@ -25840,6 +25888,7 @@ declare const TableRowSchema: z.ZodObject<{
25840
25888
  snap?: number | undefined;
25841
25889
  })[];
25842
25890
  colspan?: number | undefined;
25891
+ rowspan?: number | undefined;
25843
25892
  }[];
25844
25893
  }>;
25845
25894
 
package/dist/index.js CHANGED
@@ -2061,12 +2061,14 @@ function createNumberLineBlock(min, max, positions, step, minorTicks, style, lab
2061
2061
  const TableCellSchema = zod.z.object({
2062
2062
  type: zod.z.literal(AST_TYPES.TABLE_CELL),
2063
2063
  colspan: zod.z.number().int().positive().optional(),
2064
+ rowspan: zod.z.number().int().positive().optional(),
2064
2065
  inlines: zod.z.array(InlineNodeSchema)
2065
2066
  });
2066
- function createTableCell(inlines, colspan) {
2067
+ function createTableCell(inlines, colspan, rowspan) {
2067
2068
  return TableCellSchema.parse({
2068
2069
  type: AST_TYPES.TABLE_CELL,
2069
2070
  colspan,
2071
+ rowspan,
2070
2072
  inlines
2071
2073
  });
2072
2074
  }
@@ -2682,8 +2684,9 @@ class NaturalDSLVisitor extends BaseCstVisitor {
2682
2684
  cell(ctx) {
2683
2685
  const params = ctx.parameterList ? this.visit(ctx.parameterList) : {};
2684
2686
  const colspan = params.colspan;
2687
+ const rowspan = params.rowspan;
2685
2688
  const inlines = ctx.inlineElement ? ctx.inlineElement.map((elem) => this.visit(elem)) : [];
2686
- return createTableCell(inlines, colspan);
2689
+ return createTableCell(inlines, colspan, rowspan);
2687
2690
  }
2688
2691
  // ═══════════════════════════════════════════════════════════════════════════
2689
2692
  // Number Line Block
@@ -3384,6 +3387,7 @@ const TableCellItemSchema = zod.z.object({
3384
3387
  id: zod.z.string(),
3385
3388
  type: zod.z.literal(JSON_TYPES.TABLE_CELL),
3386
3389
  colspan: zod.z.number().int().positive().optional(),
3390
+ rowspan: zod.z.number().int().positive().optional(),
3387
3391
  items: zod.z.array(LayoutItemSchema)
3388
3392
  });
3389
3393
  const TableRowItemSchema = zod.z.object({
@@ -9670,6 +9674,9 @@ function transformTable(table, idGenerator, inlineDragIds) {
9670
9674
  if (cell.colspan !== void 0) {
9671
9675
  cellItem.colspan = cell.colspan;
9672
9676
  }
9677
+ if (cell.rowspan !== void 0) {
9678
+ cellItem.rowspan = cell.rowspan;
9679
+ }
9673
9680
  return cellItem;
9674
9681
  });
9675
9682
  return {
@@ -18281,6 +18288,7 @@ const LayoutRenderer = ({
18281
18288
  {
18282
18289
  className: "exercise-table-cell",
18283
18290
  colSpan: cell.colspan || 1,
18291
+ rowSpan: cell.rowspan || 1,
18284
18292
  children: cell.items.map((subItem) => /* @__PURE__ */ jsxRuntime.jsx(
18285
18293
  LayoutRenderer,
18286
18294
  {