document-content-model 4.3.3 → 7.6.0

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.
Files changed (96) hide show
  1. package/README.md +274 -95
  2. package/dist/border-weight.cjs +26 -0
  3. package/dist/border-weight.d.cts +12 -0
  4. package/dist/border-weight.d.ts +12 -0
  5. package/dist/border-weight.js +23 -0
  6. package/dist/codec.d.cts +1 -1
  7. package/dist/codec.d.ts +1 -1
  8. package/dist/{construct-CdQuI9f5.d.cts → construct-GVdTKrE7.d.cts} +245 -5
  9. package/dist/{construct-CdQuI9f5.d.ts → construct-GVdTKrE7.d.ts} +245 -5
  10. package/dist/construct.cjs +13 -6
  11. package/dist/construct.d.cts +1 -1
  12. package/dist/construct.d.ts +1 -1
  13. package/dist/construct.js +13 -6
  14. package/dist/content-BCOxY0Eb.d.ts +10273 -0
  15. package/dist/content-BzkhrS6P.d.cts +10273 -0
  16. package/dist/content-json-schema-defs.cjs +1056 -189
  17. package/dist/content-json-schema-defs.js +1056 -189
  18. package/dist/content.cjs +514 -36
  19. package/dist/content.d.cts +2 -2
  20. package/dist/content.d.ts +2 -2
  21. package/dist/content.js +488 -37
  22. package/dist/decompose.cjs +7 -17
  23. package/dist/decompose.d.cts +5 -5
  24. package/dist/decompose.d.ts +5 -5
  25. package/dist/decompose.js +7 -17
  26. package/dist/definitions.cjs +5 -1
  27. package/dist/definitions.d.cts +37 -1
  28. package/dist/definitions.d.ts +37 -1
  29. package/dist/definitions.js +5 -1
  30. package/dist/factor-styles.cjs +14 -8
  31. package/dist/factor-styles.d.cts +6 -6
  32. package/dist/factor-styles.d.ts +6 -6
  33. package/dist/factor-styles.js +15 -9
  34. package/dist/flatten.cjs +5 -5
  35. package/dist/flatten.d.cts +4 -4
  36. package/dist/flatten.d.ts +4 -4
  37. package/dist/flatten.js +5 -5
  38. package/dist/font-port.d.cts +2 -2
  39. package/dist/font-port.d.ts +2 -2
  40. package/dist/index.cjs +54 -14
  41. package/dist/index.d.cts +14 -12
  42. package/dist/index.d.ts +14 -12
  43. package/dist/index.js +12 -10
  44. package/dist/{math-BlG8Tjk-.d.cts → math-BScHxedi.d.cts} +97 -14
  45. package/dist/{math-BlG8Tjk-.d.ts → math-BScHxedi.d.ts} +97 -14
  46. package/dist/math-layout.d.cts +6 -6
  47. package/dist/math-layout.d.ts +6 -6
  48. package/dist/math.cjs +32 -6
  49. package/dist/math.d.cts +2 -2
  50. package/dist/math.d.ts +2 -2
  51. package/dist/math.js +29 -7
  52. package/dist/{mathml-B1oTCtzc.d.cts → mathml-Czqc1mdZ.d.cts} +3 -3
  53. package/dist/{mathml-B1oTCtzc.d.ts → mathml-Czqc1mdZ.d.ts} +3 -3
  54. package/dist/mathml.cjs +9 -2
  55. package/dist/mathml.d.cts +1 -1
  56. package/dist/mathml.d.ts +1 -1
  57. package/dist/mathml.js +9 -2
  58. package/dist/metadata.cjs +12 -1
  59. package/dist/metadata.d.cts +13 -0
  60. package/dist/metadata.d.ts +13 -0
  61. package/dist/metadata.js +12 -1
  62. package/dist/package-node-C4mh1hLY.d.ts +1989 -0
  63. package/dist/package-node-RQMDBzwd.d.cts +1989 -0
  64. package/dist/package-node.cjs +21 -21
  65. package/dist/package-node.d.cts +2 -2
  66. package/dist/package-node.d.ts +2 -2
  67. package/dist/package-node.js +14 -14
  68. package/dist/package.cjs +5 -3
  69. package/dist/package.d.cts +253 -8
  70. package/dist/package.d.ts +253 -8
  71. package/dist/package.js +5 -3
  72. package/dist/schema-io.cjs +21 -11
  73. package/dist/schema-io.d.cts +13 -9
  74. package/dist/schema-io.d.ts +13 -9
  75. package/dist/schema-io.js +21 -12
  76. package/dist/source-Bas5ol6f.d.cts +43 -0
  77. package/dist/source-Bas5ol6f.d.ts +43 -0
  78. package/dist/source.cjs +27 -0
  79. package/dist/source.d.cts +2 -0
  80. package/dist/source.d.ts +2 -0
  81. package/dist/source.js +25 -0
  82. package/dist/style-D06NwxAJ.d.cts +29 -0
  83. package/dist/style-D06NwxAJ.d.ts +29 -0
  84. package/dist/style.cjs +2 -0
  85. package/dist/style.d.cts +2 -24
  86. package/dist/style.d.ts +2 -24
  87. package/dist/style.js +2 -1
  88. package/dist/text-layout.d.cts +1 -1
  89. package/dist/text-layout.d.ts +1 -1
  90. package/package.json +28 -29
  91. package/schemas/content-document.schema.json +6623 -1694
  92. package/schemas/{document-package.schema.json → document-tree.schema.json} +1826 -143
  93. package/dist/content-B7b_P3FC.d.cts +0 -2481
  94. package/dist/content-Dn7uoJFG.d.ts +0 -2481
  95. package/dist/package-node-CC-FE2zS.d.cts +0 -459
  96. package/dist/package-node-DxdparRh.d.ts +0 -459
@@ -158,53 +158,136 @@ declare const MathUnparsedSchema: z.ZodObject<{
158
158
  }, z.core.$strip>;
159
159
  type MathUnparsed = z.infer<typeof MathUnparsedSchema>;
160
160
  interface MathApp {
161
- kind: 'app';
161
+ kind: "app";
162
162
  operator: string;
163
163
  args: MathExpression[];
164
164
  }
165
165
  interface MathSum {
166
- kind: 'sum';
166
+ kind: "sum";
167
167
  binder: string;
168
168
  lower: MathExpression;
169
169
  upper: MathExpression;
170
170
  body: MathExpression;
171
171
  }
172
172
  interface MathProd {
173
- kind: 'prod';
173
+ kind: "prod";
174
174
  binder: string;
175
175
  lower: MathExpression;
176
176
  upper: MathExpression;
177
177
  body: MathExpression;
178
178
  }
179
179
  interface MathMatrix {
180
- kind: 'matrix';
180
+ kind: "matrix";
181
181
  rows: MathExpression[][];
182
182
  }
183
183
  type MathExpression = MathNum | MathQty | MathSym | MathApp | MathSum | MathProd | MathMatrix | MathUnparsed;
184
184
  declare function isMathExpression(value: unknown): value is MathExpression;
185
- declare const MathExpressionSchema: z.ZodCustom<MathExpression, MathExpression>;
186
185
  declare const MathAppSchema: z.ZodObject<{
187
186
  kind: z.ZodLiteral<"app">;
188
187
  operator: z.ZodString;
189
- args: z.ZodArray<z.ZodCustom<MathExpression, MathExpression>>;
188
+ args: z.ZodLazy<z.ZodArray<z.ZodType<MathExpression, MathExpression, z.core.$ZodTypeInternals<MathExpression, MathExpression>>>>;
190
189
  }, z.core.$strip>;
191
190
  declare const MathSumSchema: z.ZodObject<{
192
191
  binder: z.ZodString;
193
- lower: z.ZodCustom<MathExpression, MathExpression>;
194
- upper: z.ZodCustom<MathExpression, MathExpression>;
195
- body: z.ZodCustom<MathExpression, MathExpression>;
192
+ lower: z.ZodLazy<z.ZodType<MathExpression, MathExpression, z.core.$ZodTypeInternals<MathExpression, MathExpression>>>;
193
+ upper: z.ZodLazy<z.ZodType<MathExpression, MathExpression, z.core.$ZodTypeInternals<MathExpression, MathExpression>>>;
194
+ body: z.ZodLazy<z.ZodType<MathExpression, MathExpression, z.core.$ZodTypeInternals<MathExpression, MathExpression>>>;
196
195
  kind: z.ZodLiteral<"sum">;
197
196
  }, z.core.$strip>;
198
197
  declare const MathProdSchema: z.ZodObject<{
199
198
  binder: z.ZodString;
200
- lower: z.ZodCustom<MathExpression, MathExpression>;
201
- upper: z.ZodCustom<MathExpression, MathExpression>;
202
- body: z.ZodCustom<MathExpression, MathExpression>;
199
+ lower: z.ZodLazy<z.ZodType<MathExpression, MathExpression, z.core.$ZodTypeInternals<MathExpression, MathExpression>>>;
200
+ upper: z.ZodLazy<z.ZodType<MathExpression, MathExpression, z.core.$ZodTypeInternals<MathExpression, MathExpression>>>;
201
+ body: z.ZodLazy<z.ZodType<MathExpression, MathExpression, z.core.$ZodTypeInternals<MathExpression, MathExpression>>>;
203
202
  kind: z.ZodLiteral<"prod">;
204
203
  }, z.core.$strip>;
205
204
  declare const MathMatrixSchema: z.ZodObject<{
206
205
  kind: z.ZodLiteral<"matrix">;
207
- rows: z.ZodArray<z.ZodArray<z.ZodCustom<MathExpression, MathExpression>>>;
206
+ rows: z.ZodLazy<z.ZodArray<z.ZodArray<z.ZodType<MathExpression, MathExpression, z.core.$ZodTypeInternals<MathExpression, MathExpression>>>>>;
208
207
  }, z.core.$strip>;
208
+ declare const MathExpressionSchema: z.ZodType<MathExpression, MathExpression>;
209
+ declare const QuantitySchema: z.ZodObject<{
210
+ kind: z.ZodLiteral<"quantity">;
211
+ magnitude: z.ZodNumber;
212
+ dimension: z.ZodRecord<z.ZodEnum<{
213
+ length: "length";
214
+ mass: "mass";
215
+ time: "time";
216
+ electricCurrent: "electricCurrent";
217
+ thermodynamicTemperature: "thermodynamicTemperature";
218
+ amountOfSubstance: "amountOfSubstance";
219
+ luminousIntensity: "luminousIntensity";
220
+ }> & z.core.$partial, z.ZodNumber>;
221
+ }, z.core.$strip>;
222
+ type Quantity = z.infer<typeof QuantitySchema>;
223
+ declare const IntervalSchema: z.ZodObject<{
224
+ kind: z.ZodLiteral<"interval">;
225
+ min: z.ZodNumber;
226
+ max: z.ZodNumber;
227
+ dimension: z.ZodRecord<z.ZodEnum<{
228
+ length: "length";
229
+ mass: "mass";
230
+ time: "time";
231
+ electricCurrent: "electricCurrent";
232
+ thermodynamicTemperature: "thermodynamicTemperature";
233
+ amountOfSubstance: "amountOfSubstance";
234
+ luminousIntensity: "luminousIntensity";
235
+ }> & z.core.$partial, z.ZodNumber>;
236
+ }, z.core.$strip>;
237
+ type Interval = z.infer<typeof IntervalSchema>;
238
+ declare const EvaluationValueSchema: z.ZodUnion<readonly [z.ZodObject<{
239
+ kind: z.ZodLiteral<"quantity">;
240
+ magnitude: z.ZodNumber;
241
+ dimension: z.ZodRecord<z.ZodEnum<{
242
+ length: "length";
243
+ mass: "mass";
244
+ time: "time";
245
+ electricCurrent: "electricCurrent";
246
+ thermodynamicTemperature: "thermodynamicTemperature";
247
+ amountOfSubstance: "amountOfSubstance";
248
+ luminousIntensity: "luminousIntensity";
249
+ }> & z.core.$partial, z.ZodNumber>;
250
+ }, z.core.$strip>, z.ZodObject<{
251
+ kind: z.ZodLiteral<"interval">;
252
+ min: z.ZodNumber;
253
+ max: z.ZodNumber;
254
+ dimension: z.ZodRecord<z.ZodEnum<{
255
+ length: "length";
256
+ mass: "mass";
257
+ time: "time";
258
+ electricCurrent: "electricCurrent";
259
+ thermodynamicTemperature: "thermodynamicTemperature";
260
+ amountOfSubstance: "amountOfSubstance";
261
+ luminousIntensity: "luminousIntensity";
262
+ }> & z.core.$partial, z.ZodNumber>;
263
+ }, z.core.$strip>]>;
264
+ type EvaluationValue = z.infer<typeof EvaluationValueSchema>;
265
+ declare const FormulaBindingsSchema: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
266
+ kind: z.ZodLiteral<"quantity">;
267
+ magnitude: z.ZodNumber;
268
+ dimension: z.ZodRecord<z.ZodEnum<{
269
+ length: "length";
270
+ mass: "mass";
271
+ time: "time";
272
+ electricCurrent: "electricCurrent";
273
+ thermodynamicTemperature: "thermodynamicTemperature";
274
+ amountOfSubstance: "amountOfSubstance";
275
+ luminousIntensity: "luminousIntensity";
276
+ }> & z.core.$partial, z.ZodNumber>;
277
+ }, z.core.$strip>, z.ZodObject<{
278
+ kind: z.ZodLiteral<"interval">;
279
+ min: z.ZodNumber;
280
+ max: z.ZodNumber;
281
+ dimension: z.ZodRecord<z.ZodEnum<{
282
+ length: "length";
283
+ mass: "mass";
284
+ time: "time";
285
+ electricCurrent: "electricCurrent";
286
+ thermodynamicTemperature: "thermodynamicTemperature";
287
+ amountOfSubstance: "amountOfSubstance";
288
+ luminousIntensity: "luminousIntensity";
289
+ }> & z.core.$partial, z.ZodNumber>;
290
+ }, z.core.$strip>]>>;
291
+ type FormulaBindings = z.infer<typeof FormulaBindingsSchema>;
209
292
  //#endregion
210
- export { MathUncertaintySchema as A, MathSum as C, MathSymbolEntry as D, MathSymSchema as E, SI_BASE_DIMENSIONS as F, SiBaseDimension as I, SymbolTable as L, MathUnitSchema as M, MathUnparsed as N, MathSymbolEntrySchema as O, MathUnparsedSchema as P, SymbolTableSchema as R, MathQtySchema as S, MathSym as T, MathProd as _, MathApp as a, MathProvenanceSchema as b, MathExpressionSchema as c, MathNormalisationContext as d, MathNormalisationContextSchema as f, MathPresentationSchema as g, MathPresentation as h, ExactRationalSchema as i, MathUnit as j, MathUncertainty as k, MathMatrix as l, MathNumSchema as m, DimensionVectorSchema as n, MathAppSchema as o, MathNum as p, ExactRational as r, MathExpression as s, DimensionVector as t, MathMatrixSchema as u, MathProdSchema as v, MathSumSchema as w, MathQty as x, MathProvenance as y, isMathExpression as z };
293
+ export { MathSumSchema as A, MathUnparsedSchema as B, MathProd as C, MathQty as D, MathProvenanceSchema as E, MathUncertainty as F, SymbolTable as G, QuantitySchema as H, MathUncertaintySchema as I, SymbolTableSchema as K, MathUnit as L, MathSymSchema as M, MathSymbolEntry as N, MathQtySchema as O, MathSymbolEntrySchema as P, MathUnitSchema as R, MathPresentationSchema as S, MathProvenance as T, SI_BASE_DIMENSIONS as U, Quantity as V, SiBaseDimension as W, MathNormalisationContext as _, ExactRational as a, MathNumSchema as b, FormulaBindingsSchema as c, MathApp as d, MathAppSchema as f, MathMatrixSchema as g, MathMatrix as h, EvaluationValueSchema as i, MathSym as j, MathSum as k, Interval as l, MathExpressionSchema as m, DimensionVectorSchema as n, ExactRationalSchema as o, MathExpression as p, isMathExpression as q, EvaluationValue as r, FormulaBindings as s, DimensionVector as t, IntervalSchema as u, MathNormalisationContextSchema as v, MathProdSchema as w, MathPresentation as x, MathNum as y, MathUnparsed as z };
@@ -158,53 +158,136 @@ declare const MathUnparsedSchema: z.ZodObject<{
158
158
  }, z.core.$strip>;
159
159
  type MathUnparsed = z.infer<typeof MathUnparsedSchema>;
160
160
  interface MathApp {
161
- kind: 'app';
161
+ kind: "app";
162
162
  operator: string;
163
163
  args: MathExpression[];
164
164
  }
165
165
  interface MathSum {
166
- kind: 'sum';
166
+ kind: "sum";
167
167
  binder: string;
168
168
  lower: MathExpression;
169
169
  upper: MathExpression;
170
170
  body: MathExpression;
171
171
  }
172
172
  interface MathProd {
173
- kind: 'prod';
173
+ kind: "prod";
174
174
  binder: string;
175
175
  lower: MathExpression;
176
176
  upper: MathExpression;
177
177
  body: MathExpression;
178
178
  }
179
179
  interface MathMatrix {
180
- kind: 'matrix';
180
+ kind: "matrix";
181
181
  rows: MathExpression[][];
182
182
  }
183
183
  type MathExpression = MathNum | MathQty | MathSym | MathApp | MathSum | MathProd | MathMatrix | MathUnparsed;
184
184
  declare function isMathExpression(value: unknown): value is MathExpression;
185
- declare const MathExpressionSchema: z.ZodCustom<MathExpression, MathExpression>;
186
185
  declare const MathAppSchema: z.ZodObject<{
187
186
  kind: z.ZodLiteral<"app">;
188
187
  operator: z.ZodString;
189
- args: z.ZodArray<z.ZodCustom<MathExpression, MathExpression>>;
188
+ args: z.ZodLazy<z.ZodArray<z.ZodType<MathExpression, MathExpression, z.core.$ZodTypeInternals<MathExpression, MathExpression>>>>;
190
189
  }, z.core.$strip>;
191
190
  declare const MathSumSchema: z.ZodObject<{
192
191
  binder: z.ZodString;
193
- lower: z.ZodCustom<MathExpression, MathExpression>;
194
- upper: z.ZodCustom<MathExpression, MathExpression>;
195
- body: z.ZodCustom<MathExpression, MathExpression>;
192
+ lower: z.ZodLazy<z.ZodType<MathExpression, MathExpression, z.core.$ZodTypeInternals<MathExpression, MathExpression>>>;
193
+ upper: z.ZodLazy<z.ZodType<MathExpression, MathExpression, z.core.$ZodTypeInternals<MathExpression, MathExpression>>>;
194
+ body: z.ZodLazy<z.ZodType<MathExpression, MathExpression, z.core.$ZodTypeInternals<MathExpression, MathExpression>>>;
196
195
  kind: z.ZodLiteral<"sum">;
197
196
  }, z.core.$strip>;
198
197
  declare const MathProdSchema: z.ZodObject<{
199
198
  binder: z.ZodString;
200
- lower: z.ZodCustom<MathExpression, MathExpression>;
201
- upper: z.ZodCustom<MathExpression, MathExpression>;
202
- body: z.ZodCustom<MathExpression, MathExpression>;
199
+ lower: z.ZodLazy<z.ZodType<MathExpression, MathExpression, z.core.$ZodTypeInternals<MathExpression, MathExpression>>>;
200
+ upper: z.ZodLazy<z.ZodType<MathExpression, MathExpression, z.core.$ZodTypeInternals<MathExpression, MathExpression>>>;
201
+ body: z.ZodLazy<z.ZodType<MathExpression, MathExpression, z.core.$ZodTypeInternals<MathExpression, MathExpression>>>;
203
202
  kind: z.ZodLiteral<"prod">;
204
203
  }, z.core.$strip>;
205
204
  declare const MathMatrixSchema: z.ZodObject<{
206
205
  kind: z.ZodLiteral<"matrix">;
207
- rows: z.ZodArray<z.ZodArray<z.ZodCustom<MathExpression, MathExpression>>>;
206
+ rows: z.ZodLazy<z.ZodArray<z.ZodArray<z.ZodType<MathExpression, MathExpression, z.core.$ZodTypeInternals<MathExpression, MathExpression>>>>>;
208
207
  }, z.core.$strip>;
208
+ declare const MathExpressionSchema: z.ZodType<MathExpression, MathExpression>;
209
+ declare const QuantitySchema: z.ZodObject<{
210
+ kind: z.ZodLiteral<"quantity">;
211
+ magnitude: z.ZodNumber;
212
+ dimension: z.ZodRecord<z.ZodEnum<{
213
+ length: "length";
214
+ mass: "mass";
215
+ time: "time";
216
+ electricCurrent: "electricCurrent";
217
+ thermodynamicTemperature: "thermodynamicTemperature";
218
+ amountOfSubstance: "amountOfSubstance";
219
+ luminousIntensity: "luminousIntensity";
220
+ }> & z.core.$partial, z.ZodNumber>;
221
+ }, z.core.$strip>;
222
+ type Quantity = z.infer<typeof QuantitySchema>;
223
+ declare const IntervalSchema: z.ZodObject<{
224
+ kind: z.ZodLiteral<"interval">;
225
+ min: z.ZodNumber;
226
+ max: z.ZodNumber;
227
+ dimension: z.ZodRecord<z.ZodEnum<{
228
+ length: "length";
229
+ mass: "mass";
230
+ time: "time";
231
+ electricCurrent: "electricCurrent";
232
+ thermodynamicTemperature: "thermodynamicTemperature";
233
+ amountOfSubstance: "amountOfSubstance";
234
+ luminousIntensity: "luminousIntensity";
235
+ }> & z.core.$partial, z.ZodNumber>;
236
+ }, z.core.$strip>;
237
+ type Interval = z.infer<typeof IntervalSchema>;
238
+ declare const EvaluationValueSchema: z.ZodUnion<readonly [z.ZodObject<{
239
+ kind: z.ZodLiteral<"quantity">;
240
+ magnitude: z.ZodNumber;
241
+ dimension: z.ZodRecord<z.ZodEnum<{
242
+ length: "length";
243
+ mass: "mass";
244
+ time: "time";
245
+ electricCurrent: "electricCurrent";
246
+ thermodynamicTemperature: "thermodynamicTemperature";
247
+ amountOfSubstance: "amountOfSubstance";
248
+ luminousIntensity: "luminousIntensity";
249
+ }> & z.core.$partial, z.ZodNumber>;
250
+ }, z.core.$strip>, z.ZodObject<{
251
+ kind: z.ZodLiteral<"interval">;
252
+ min: z.ZodNumber;
253
+ max: z.ZodNumber;
254
+ dimension: z.ZodRecord<z.ZodEnum<{
255
+ length: "length";
256
+ mass: "mass";
257
+ time: "time";
258
+ electricCurrent: "electricCurrent";
259
+ thermodynamicTemperature: "thermodynamicTemperature";
260
+ amountOfSubstance: "amountOfSubstance";
261
+ luminousIntensity: "luminousIntensity";
262
+ }> & z.core.$partial, z.ZodNumber>;
263
+ }, z.core.$strip>]>;
264
+ type EvaluationValue = z.infer<typeof EvaluationValueSchema>;
265
+ declare const FormulaBindingsSchema: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
266
+ kind: z.ZodLiteral<"quantity">;
267
+ magnitude: z.ZodNumber;
268
+ dimension: z.ZodRecord<z.ZodEnum<{
269
+ length: "length";
270
+ mass: "mass";
271
+ time: "time";
272
+ electricCurrent: "electricCurrent";
273
+ thermodynamicTemperature: "thermodynamicTemperature";
274
+ amountOfSubstance: "amountOfSubstance";
275
+ luminousIntensity: "luminousIntensity";
276
+ }> & z.core.$partial, z.ZodNumber>;
277
+ }, z.core.$strip>, z.ZodObject<{
278
+ kind: z.ZodLiteral<"interval">;
279
+ min: z.ZodNumber;
280
+ max: z.ZodNumber;
281
+ dimension: z.ZodRecord<z.ZodEnum<{
282
+ length: "length";
283
+ mass: "mass";
284
+ time: "time";
285
+ electricCurrent: "electricCurrent";
286
+ thermodynamicTemperature: "thermodynamicTemperature";
287
+ amountOfSubstance: "amountOfSubstance";
288
+ luminousIntensity: "luminousIntensity";
289
+ }> & z.core.$partial, z.ZodNumber>;
290
+ }, z.core.$strip>]>>;
291
+ type FormulaBindings = z.infer<typeof FormulaBindingsSchema>;
209
292
  //#endregion
210
- export { MathUncertaintySchema as A, MathSum as C, MathSymbolEntry as D, MathSymSchema as E, SI_BASE_DIMENSIONS as F, SiBaseDimension as I, SymbolTable as L, MathUnitSchema as M, MathUnparsed as N, MathSymbolEntrySchema as O, MathUnparsedSchema as P, SymbolTableSchema as R, MathQtySchema as S, MathSym as T, MathProd as _, MathApp as a, MathProvenanceSchema as b, MathExpressionSchema as c, MathNormalisationContext as d, MathNormalisationContextSchema as f, MathPresentationSchema as g, MathPresentation as h, ExactRationalSchema as i, MathUnit as j, MathUncertainty as k, MathMatrix as l, MathNumSchema as m, DimensionVectorSchema as n, MathAppSchema as o, MathNum as p, ExactRational as r, MathExpression as s, DimensionVector as t, MathMatrixSchema as u, MathProdSchema as v, MathSumSchema as w, MathQty as x, MathProvenance as y, isMathExpression as z };
293
+ export { MathSumSchema as A, MathUnparsedSchema as B, MathProd as C, MathQty as D, MathProvenanceSchema as E, MathUncertainty as F, SymbolTable as G, QuantitySchema as H, MathUncertaintySchema as I, SymbolTableSchema as K, MathUnit as L, MathSymSchema as M, MathSymbolEntry as N, MathQtySchema as O, MathSymbolEntrySchema as P, MathUnitSchema as R, MathPresentationSchema as S, MathProvenance as T, SI_BASE_DIMENSIONS as U, Quantity as V, SiBaseDimension as W, MathNormalisationContext as _, ExactRational as a, MathNumSchema as b, FormulaBindingsSchema as c, MathApp as d, MathAppSchema as f, MathMatrixSchema as g, MathMatrix as h, EvaluationValueSchema as i, MathSym as j, MathSum as k, Interval as l, MathExpressionSchema as m, DimensionVectorSchema as n, ExactRationalSchema as o, MathExpression as p, isMathExpression as q, EvaluationValue as r, FormulaBindings as s, DimensionVector as t, IntervalSchema as u, MathNormalisationContextSchema as v, MathProdSchema as w, MathPresentation as x, MathNum as y, MathUnparsed as z };
@@ -2,7 +2,7 @@ import { n as Color } from "./color-AELCDH_b.cjs";
2
2
  //#region src/math-layout.d.ts
3
3
  type MathColor = Color;
4
4
  interface MathGlyphRun {
5
- readonly kind: 'glyphs';
5
+ readonly kind: "glyphs";
6
6
  readonly xPt: number;
7
7
  readonly yPt: number;
8
8
  readonly text: string;
@@ -10,7 +10,7 @@ interface MathGlyphRun {
10
10
  readonly color: MathColor;
11
11
  }
12
12
  interface MathRule {
13
- readonly kind: 'rule';
13
+ readonly kind: "rule";
14
14
  readonly xPt: number;
15
15
  readonly yPt: number;
16
16
  readonly widthPt: number;
@@ -18,7 +18,7 @@ interface MathRule {
18
18
  readonly color: MathColor;
19
19
  }
20
20
  interface MathStroke {
21
- readonly kind: 'stroke';
21
+ readonly kind: "stroke";
22
22
  readonly points: readonly {
23
23
  readonly xPt: number;
24
24
  readonly yPt: number;
@@ -32,7 +32,7 @@ interface MathGlyphPlacement {
32
32
  readonly yPt: number;
33
33
  }
34
34
  interface MathAssembledGlyphs {
35
- readonly kind: 'assembled-glyphs';
35
+ readonly kind: "assembled-glyphs";
36
36
  readonly placements: readonly MathGlyphPlacement[];
37
37
  readonly text: string;
38
38
  readonly sizePt: number;
@@ -53,13 +53,13 @@ interface MathGlyphMetrics {
53
53
  readonly inkAscentPt?: number;
54
54
  readonly inkDescentPt?: number;
55
55
  }
56
- type MathStretchAxis = 'vertical' | 'horizontal';
56
+ type MathStretchAxis = "vertical" | "horizontal";
57
57
  interface MathStretchGlyph {
58
58
  readonly glyphId: number;
59
59
  readonly offsetPt: number;
60
60
  }
61
61
  interface MathStretchResult {
62
- readonly kind: 'base' | 'variant' | 'assembly';
62
+ readonly kind: "base" | "variant" | "assembly";
63
63
  readonly sizePt: number;
64
64
  readonly advanceWidthPt: number;
65
65
  readonly inkAscentPt: number;
@@ -2,7 +2,7 @@ import { n as Color } from "./color-AELCDH_b.js";
2
2
  //#region src/math-layout.d.ts
3
3
  type MathColor = Color;
4
4
  interface MathGlyphRun {
5
- readonly kind: 'glyphs';
5
+ readonly kind: "glyphs";
6
6
  readonly xPt: number;
7
7
  readonly yPt: number;
8
8
  readonly text: string;
@@ -10,7 +10,7 @@ interface MathGlyphRun {
10
10
  readonly color: MathColor;
11
11
  }
12
12
  interface MathRule {
13
- readonly kind: 'rule';
13
+ readonly kind: "rule";
14
14
  readonly xPt: number;
15
15
  readonly yPt: number;
16
16
  readonly widthPt: number;
@@ -18,7 +18,7 @@ interface MathRule {
18
18
  readonly color: MathColor;
19
19
  }
20
20
  interface MathStroke {
21
- readonly kind: 'stroke';
21
+ readonly kind: "stroke";
22
22
  readonly points: readonly {
23
23
  readonly xPt: number;
24
24
  readonly yPt: number;
@@ -32,7 +32,7 @@ interface MathGlyphPlacement {
32
32
  readonly yPt: number;
33
33
  }
34
34
  interface MathAssembledGlyphs {
35
- readonly kind: 'assembled-glyphs';
35
+ readonly kind: "assembled-glyphs";
36
36
  readonly placements: readonly MathGlyphPlacement[];
37
37
  readonly text: string;
38
38
  readonly sizePt: number;
@@ -53,13 +53,13 @@ interface MathGlyphMetrics {
53
53
  readonly inkAscentPt?: number;
54
54
  readonly inkDescentPt?: number;
55
55
  }
56
- type MathStretchAxis = 'vertical' | 'horizontal';
56
+ type MathStretchAxis = "vertical" | "horizontal";
57
57
  interface MathStretchGlyph {
58
58
  readonly glyphId: number;
59
59
  readonly offsetPt: number;
60
60
  }
61
61
  interface MathStretchResult {
62
- readonly kind: 'base' | 'variant' | 'assembly';
62
+ readonly kind: "base" | "variant" | "assembly";
63
63
  readonly sizePt: number;
64
64
  readonly advanceWidthPt: number;
65
65
  readonly inkAscentPt: number;
package/dist/math.cjs CHANGED
@@ -105,17 +105,16 @@ function isMathExpression(value) {
105
105
  if (kind === "unparsed") return typeof value.latex === "string";
106
106
  return false;
107
107
  }
108
- const MathExpressionSchema = zod.z.custom(isMathExpression);
109
108
  const MathAppSchema = zod.z.object({
110
109
  kind: zod.z.literal("app"),
111
110
  operator: zod.z.string(),
112
- args: zod.z.array(MathExpressionSchema)
111
+ args: zod.z.lazy(() => zod.z.array(MathExpressionSchema))
113
112
  });
114
113
  const BINDER_SCHEMA_FIELDS = {
115
114
  binder: zod.z.string(),
116
- lower: MathExpressionSchema,
117
- upper: MathExpressionSchema,
118
- body: MathExpressionSchema
115
+ lower: zod.z.lazy(() => MathExpressionSchema),
116
+ upper: zod.z.lazy(() => MathExpressionSchema),
117
+ body: zod.z.lazy(() => MathExpressionSchema)
119
118
  };
120
119
  const MathSumSchema = zod.z.object({
121
120
  kind: zod.z.literal("sum"),
@@ -127,11 +126,37 @@ const MathProdSchema = zod.z.object({
127
126
  });
128
127
  const MathMatrixSchema = zod.z.object({
129
128
  kind: zod.z.literal("matrix"),
130
- rows: zod.z.array(zod.z.array(MathExpressionSchema))
129
+ rows: zod.z.lazy(() => zod.z.array(zod.z.array(MathExpressionSchema)))
131
130
  }).refine((matrix) => new Set(matrix.rows.map((row) => row.length)).size <= 1, { message: "matrix rows must all have the same number of columns" });
131
+ const MathExpressionSchema = zod.z.discriminatedUnion("kind", [
132
+ MathNumSchema,
133
+ MathQtySchema,
134
+ MathSymSchema,
135
+ MathAppSchema,
136
+ MathSumSchema,
137
+ MathProdSchema,
138
+ MathMatrixSchema,
139
+ MathUnparsedSchema
140
+ ]);
141
+ const QuantitySchema = zod.z.object({
142
+ kind: zod.z.literal("quantity"),
143
+ magnitude: zod.z.number(),
144
+ dimension: DimensionVectorSchema
145
+ });
146
+ const IntervalSchema = zod.z.object({
147
+ kind: zod.z.literal("interval"),
148
+ min: zod.z.number(),
149
+ max: zod.z.number(),
150
+ dimension: DimensionVectorSchema
151
+ }).refine((value) => value.min <= value.max, { message: "interval min must not exceed max" });
152
+ const EvaluationValueSchema = zod.z.union([QuantitySchema, IntervalSchema]);
153
+ const FormulaBindingsSchema = zod.z.record(zod.z.string(), EvaluationValueSchema);
132
154
  //#endregion
133
155
  exports.DimensionVectorSchema = DimensionVectorSchema;
156
+ exports.EvaluationValueSchema = EvaluationValueSchema;
134
157
  exports.ExactRationalSchema = ExactRationalSchema;
158
+ exports.FormulaBindingsSchema = FormulaBindingsSchema;
159
+ exports.IntervalSchema = IntervalSchema;
135
160
  exports.MathAppSchema = MathAppSchema;
136
161
  exports.MathExpressionSchema = MathExpressionSchema;
137
162
  exports.MathMatrixSchema = MathMatrixSchema;
@@ -147,6 +172,7 @@ exports.MathSymbolEntrySchema = MathSymbolEntrySchema;
147
172
  exports.MathUncertaintySchema = MathUncertaintySchema;
148
173
  exports.MathUnitSchema = MathUnitSchema;
149
174
  exports.MathUnparsedSchema = MathUnparsedSchema;
175
+ exports.QuantitySchema = QuantitySchema;
150
176
  exports.SI_BASE_DIMENSIONS = SI_BASE_DIMENSIONS;
151
177
  exports.SymbolTableSchema = SymbolTableSchema;
152
178
  exports.isMathExpression = isMathExpression;
package/dist/math.d.cts CHANGED
@@ -1,2 +1,2 @@
1
- import { A as MathUncertaintySchema, C as MathSum, D as MathSymbolEntry, E as MathSymSchema, F as SI_BASE_DIMENSIONS, I as SiBaseDimension, L as SymbolTable, M as MathUnitSchema, N as MathUnparsed, O as MathSymbolEntrySchema, P as MathUnparsedSchema, R as SymbolTableSchema, S as MathQtySchema, T as MathSym, _ as MathProd, a as MathApp, b as MathProvenanceSchema, c as MathExpressionSchema, d as MathNormalisationContext, f as MathNormalisationContextSchema, g as MathPresentationSchema, h as MathPresentation, i as ExactRationalSchema, j as MathUnit, k as MathUncertainty, l as MathMatrix, m as MathNumSchema, n as DimensionVectorSchema, o as MathAppSchema, p as MathNum, r as ExactRational, s as MathExpression, t as DimensionVector, u as MathMatrixSchema, v as MathProdSchema, w as MathSumSchema, x as MathQty, y as MathProvenance, z as isMathExpression } from "./math-BlG8Tjk-.cjs";
2
- export { DimensionVector, DimensionVectorSchema, ExactRational, ExactRationalSchema, MathApp, MathAppSchema, MathExpression, MathExpressionSchema, MathMatrix, MathMatrixSchema, MathNormalisationContext, MathNormalisationContextSchema, MathNum, MathNumSchema, MathPresentation, MathPresentationSchema, MathProd, MathProdSchema, MathProvenance, MathProvenanceSchema, MathQty, MathQtySchema, MathSum, MathSumSchema, MathSym, MathSymSchema, MathSymbolEntry, MathSymbolEntrySchema, MathUncertainty, MathUncertaintySchema, MathUnit, MathUnitSchema, MathUnparsed, MathUnparsedSchema, SI_BASE_DIMENSIONS, SiBaseDimension, SymbolTable, SymbolTableSchema, isMathExpression };
1
+ import { A as MathSumSchema, B as MathUnparsedSchema, C as MathProd, D as MathQty, E as MathProvenanceSchema, F as MathUncertainty, G as SymbolTable, H as QuantitySchema, I as MathUncertaintySchema, K as SymbolTableSchema, L as MathUnit, M as MathSymSchema, N as MathSymbolEntry, O as MathQtySchema, P as MathSymbolEntrySchema, R as MathUnitSchema, S as MathPresentationSchema, T as MathProvenance, U as SI_BASE_DIMENSIONS, V as Quantity, W as SiBaseDimension, _ as MathNormalisationContext, a as ExactRational, b as MathNumSchema, c as FormulaBindingsSchema, d as MathApp, f as MathAppSchema, g as MathMatrixSchema, h as MathMatrix, i as EvaluationValueSchema, j as MathSym, k as MathSum, l as Interval, m as MathExpressionSchema, n as DimensionVectorSchema, o as ExactRationalSchema, p as MathExpression, q as isMathExpression, r as EvaluationValue, s as FormulaBindings, t as DimensionVector, u as IntervalSchema, v as MathNormalisationContextSchema, w as MathProdSchema, x as MathPresentation, y as MathNum, z as MathUnparsed } from "./math-BScHxedi.cjs";
2
+ export { DimensionVector, DimensionVectorSchema, EvaluationValue, EvaluationValueSchema, ExactRational, ExactRationalSchema, FormulaBindings, FormulaBindingsSchema, Interval, IntervalSchema, MathApp, MathAppSchema, MathExpression, MathExpressionSchema, MathMatrix, MathMatrixSchema, MathNormalisationContext, MathNormalisationContextSchema, MathNum, MathNumSchema, MathPresentation, MathPresentationSchema, MathProd, MathProdSchema, MathProvenance, MathProvenanceSchema, MathQty, MathQtySchema, MathSum, MathSumSchema, MathSym, MathSymSchema, MathSymbolEntry, MathSymbolEntrySchema, MathUncertainty, MathUncertaintySchema, MathUnit, MathUnitSchema, MathUnparsed, MathUnparsedSchema, Quantity, QuantitySchema, SI_BASE_DIMENSIONS, SiBaseDimension, SymbolTable, SymbolTableSchema, isMathExpression };
package/dist/math.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { A as MathUncertaintySchema, C as MathSum, D as MathSymbolEntry, E as MathSymSchema, F as SI_BASE_DIMENSIONS, I as SiBaseDimension, L as SymbolTable, M as MathUnitSchema, N as MathUnparsed, O as MathSymbolEntrySchema, P as MathUnparsedSchema, R as SymbolTableSchema, S as MathQtySchema, T as MathSym, _ as MathProd, a as MathApp, b as MathProvenanceSchema, c as MathExpressionSchema, d as MathNormalisationContext, f as MathNormalisationContextSchema, g as MathPresentationSchema, h as MathPresentation, i as ExactRationalSchema, j as MathUnit, k as MathUncertainty, l as MathMatrix, m as MathNumSchema, n as DimensionVectorSchema, o as MathAppSchema, p as MathNum, r as ExactRational, s as MathExpression, t as DimensionVector, u as MathMatrixSchema, v as MathProdSchema, w as MathSumSchema, x as MathQty, y as MathProvenance, z as isMathExpression } from "./math-BlG8Tjk-.js";
2
- export { DimensionVector, DimensionVectorSchema, ExactRational, ExactRationalSchema, MathApp, MathAppSchema, MathExpression, MathExpressionSchema, MathMatrix, MathMatrixSchema, MathNormalisationContext, MathNormalisationContextSchema, MathNum, MathNumSchema, MathPresentation, MathPresentationSchema, MathProd, MathProdSchema, MathProvenance, MathProvenanceSchema, MathQty, MathQtySchema, MathSum, MathSumSchema, MathSym, MathSymSchema, MathSymbolEntry, MathSymbolEntrySchema, MathUncertainty, MathUncertaintySchema, MathUnit, MathUnitSchema, MathUnparsed, MathUnparsedSchema, SI_BASE_DIMENSIONS, SiBaseDimension, SymbolTable, SymbolTableSchema, isMathExpression };
1
+ import { A as MathSumSchema, B as MathUnparsedSchema, C as MathProd, D as MathQty, E as MathProvenanceSchema, F as MathUncertainty, G as SymbolTable, H as QuantitySchema, I as MathUncertaintySchema, K as SymbolTableSchema, L as MathUnit, M as MathSymSchema, N as MathSymbolEntry, O as MathQtySchema, P as MathSymbolEntrySchema, R as MathUnitSchema, S as MathPresentationSchema, T as MathProvenance, U as SI_BASE_DIMENSIONS, V as Quantity, W as SiBaseDimension, _ as MathNormalisationContext, a as ExactRational, b as MathNumSchema, c as FormulaBindingsSchema, d as MathApp, f as MathAppSchema, g as MathMatrixSchema, h as MathMatrix, i as EvaluationValueSchema, j as MathSym, k as MathSum, l as Interval, m as MathExpressionSchema, n as DimensionVectorSchema, o as ExactRationalSchema, p as MathExpression, q as isMathExpression, r as EvaluationValue, s as FormulaBindings, t as DimensionVector, u as IntervalSchema, v as MathNormalisationContextSchema, w as MathProdSchema, x as MathPresentation, y as MathNum, z as MathUnparsed } from "./math-BScHxedi.js";
2
+ export { DimensionVector, DimensionVectorSchema, EvaluationValue, EvaluationValueSchema, ExactRational, ExactRationalSchema, FormulaBindings, FormulaBindingsSchema, Interval, IntervalSchema, MathApp, MathAppSchema, MathExpression, MathExpressionSchema, MathMatrix, MathMatrixSchema, MathNormalisationContext, MathNormalisationContextSchema, MathNum, MathNumSchema, MathPresentation, MathPresentationSchema, MathProd, MathProdSchema, MathProvenance, MathProvenanceSchema, MathQty, MathQtySchema, MathSum, MathSumSchema, MathSym, MathSymSchema, MathSymbolEntry, MathSymbolEntrySchema, MathUncertainty, MathUncertaintySchema, MathUnit, MathUnitSchema, MathUnparsed, MathUnparsedSchema, Quantity, QuantitySchema, SI_BASE_DIMENSIONS, SiBaseDimension, SymbolTable, SymbolTableSchema, isMathExpression };
package/dist/math.js CHANGED
@@ -104,17 +104,16 @@ function isMathExpression(value) {
104
104
  if (kind === "unparsed") return typeof value.latex === "string";
105
105
  return false;
106
106
  }
107
- const MathExpressionSchema = z.custom(isMathExpression);
108
107
  const MathAppSchema = z.object({
109
108
  kind: z.literal("app"),
110
109
  operator: z.string(),
111
- args: z.array(MathExpressionSchema)
110
+ args: z.lazy(() => z.array(MathExpressionSchema))
112
111
  });
113
112
  const BINDER_SCHEMA_FIELDS = {
114
113
  binder: z.string(),
115
- lower: MathExpressionSchema,
116
- upper: MathExpressionSchema,
117
- body: MathExpressionSchema
114
+ lower: z.lazy(() => MathExpressionSchema),
115
+ upper: z.lazy(() => MathExpressionSchema),
116
+ body: z.lazy(() => MathExpressionSchema)
118
117
  };
119
118
  const MathSumSchema = z.object({
120
119
  kind: z.literal("sum"),
@@ -126,7 +125,30 @@ const MathProdSchema = z.object({
126
125
  });
127
126
  const MathMatrixSchema = z.object({
128
127
  kind: z.literal("matrix"),
129
- rows: z.array(z.array(MathExpressionSchema))
128
+ rows: z.lazy(() => z.array(z.array(MathExpressionSchema)))
130
129
  }).refine((matrix) => new Set(matrix.rows.map((row) => row.length)).size <= 1, { message: "matrix rows must all have the same number of columns" });
130
+ const MathExpressionSchema = z.discriminatedUnion("kind", [
131
+ MathNumSchema,
132
+ MathQtySchema,
133
+ MathSymSchema,
134
+ MathAppSchema,
135
+ MathSumSchema,
136
+ MathProdSchema,
137
+ MathMatrixSchema,
138
+ MathUnparsedSchema
139
+ ]);
140
+ const QuantitySchema = z.object({
141
+ kind: z.literal("quantity"),
142
+ magnitude: z.number(),
143
+ dimension: DimensionVectorSchema
144
+ });
145
+ const IntervalSchema = z.object({
146
+ kind: z.literal("interval"),
147
+ min: z.number(),
148
+ max: z.number(),
149
+ dimension: DimensionVectorSchema
150
+ }).refine((value) => value.min <= value.max, { message: "interval min must not exceed max" });
151
+ const EvaluationValueSchema = z.union([QuantitySchema, IntervalSchema]);
152
+ const FormulaBindingsSchema = z.record(z.string(), EvaluationValueSchema);
131
153
  //#endregion
132
- export { DimensionVectorSchema, ExactRationalSchema, MathAppSchema, MathExpressionSchema, MathMatrixSchema, MathNormalisationContextSchema, MathNumSchema, MathPresentationSchema, MathProdSchema, MathProvenanceSchema, MathQtySchema, MathSumSchema, MathSymSchema, MathSymbolEntrySchema, MathUncertaintySchema, MathUnitSchema, MathUnparsedSchema, SI_BASE_DIMENSIONS, SymbolTableSchema, isMathExpression };
154
+ export { DimensionVectorSchema, EvaluationValueSchema, ExactRationalSchema, FormulaBindingsSchema, IntervalSchema, MathAppSchema, MathExpressionSchema, MathMatrixSchema, MathNormalisationContextSchema, MathNumSchema, MathPresentationSchema, MathProdSchema, MathProvenanceSchema, MathQtySchema, MathSumSchema, MathSymSchema, MathSymbolEntrySchema, MathUncertaintySchema, MathUnitSchema, MathUnparsedSchema, QuantitySchema, SI_BASE_DIMENSIONS, SymbolTableSchema, isMathExpression };
@@ -35,14 +35,13 @@ declare const MathMlPiSchema: z.ZodObject<{
35
35
  }, z.core.$strip>;
36
36
  type MathMlPi = z.infer<typeof MathMlPiSchema>;
37
37
  interface MathMlElement {
38
- type: 'element';
38
+ type: "element";
39
39
  tag: string;
40
40
  attributes: MathMlAttribute[];
41
41
  children: MathMlNode[];
42
42
  }
43
43
  type MathMlNode = MathMlText | MathMlCdata | MathMlComment | MathMlDeclaration | MathMlPi | MathMlElement;
44
44
  declare function isMathMlNode(value: unknown): value is MathMlNode;
45
- declare const MathMlNodeSchema: z.ZodCustom<MathMlNode, MathMlNode>;
46
45
  declare const MathMlElementSchema: z.ZodObject<{
47
46
  type: z.ZodLiteral<"element">;
48
47
  tag: z.ZodString;
@@ -50,7 +49,8 @@ declare const MathMlElementSchema: z.ZodObject<{
50
49
  name: z.ZodString;
51
50
  value: z.ZodString;
52
51
  }, z.core.$strip>>;
53
- children: z.ZodArray<z.ZodCustom<MathMlNode, MathMlNode>>;
52
+ children: z.ZodLazy<z.ZodArray<z.ZodType<MathMlNode, MathMlNode, z.core.$ZodTypeInternals<MathMlNode, MathMlNode>>>>;
54
53
  }, z.core.$strip>;
54
+ declare const MathMlNodeSchema: z.ZodType<MathMlNode, MathMlNode>;
55
55
  //#endregion
56
56
  export { isMathMlNode as _, MathMlComment as a, MathMlDeclarationSchema as c, MathMlNode as d, MathMlNodeSchema as f, MathMlTextSchema as g, MathMlText as h, MathMlCdataSchema as i, MathMlElement as l, MathMlPiSchema as m, MathMlAttributeSchema as n, MathMlCommentSchema as o, MathMlPi as p, MathMlCdata as r, MathMlDeclaration as s, MathMlAttribute as t, MathMlElementSchema as u };
@@ -35,14 +35,13 @@ declare const MathMlPiSchema: z.ZodObject<{
35
35
  }, z.core.$strip>;
36
36
  type MathMlPi = z.infer<typeof MathMlPiSchema>;
37
37
  interface MathMlElement {
38
- type: 'element';
38
+ type: "element";
39
39
  tag: string;
40
40
  attributes: MathMlAttribute[];
41
41
  children: MathMlNode[];
42
42
  }
43
43
  type MathMlNode = MathMlText | MathMlCdata | MathMlComment | MathMlDeclaration | MathMlPi | MathMlElement;
44
44
  declare function isMathMlNode(value: unknown): value is MathMlNode;
45
- declare const MathMlNodeSchema: z.ZodCustom<MathMlNode, MathMlNode>;
46
45
  declare const MathMlElementSchema: z.ZodObject<{
47
46
  type: z.ZodLiteral<"element">;
48
47
  tag: z.ZodString;
@@ -50,7 +49,8 @@ declare const MathMlElementSchema: z.ZodObject<{
50
49
  name: z.ZodString;
51
50
  value: z.ZodString;
52
51
  }, z.core.$strip>>;
53
- children: z.ZodArray<z.ZodCustom<MathMlNode, MathMlNode>>;
52
+ children: z.ZodLazy<z.ZodArray<z.ZodType<MathMlNode, MathMlNode, z.core.$ZodTypeInternals<MathMlNode, MathMlNode>>>>;
54
53
  }, z.core.$strip>;
54
+ declare const MathMlNodeSchema: z.ZodType<MathMlNode, MathMlNode>;
55
55
  //#endregion
56
56
  export { isMathMlNode as _, MathMlComment as a, MathMlDeclarationSchema as c, MathMlNode as d, MathMlNodeSchema as f, MathMlTextSchema as g, MathMlText as h, MathMlCdataSchema as i, MathMlElement as l, MathMlPiSchema as m, MathMlAttributeSchema as n, MathMlCommentSchema as o, MathMlPi as p, MathMlCdata as r, MathMlDeclaration as s, MathMlAttribute as t, MathMlElementSchema as u };
package/dist/mathml.cjs CHANGED
@@ -41,13 +41,20 @@ function isMathMlNode(value) {
41
41
  if (type === "element") return typeof value.tag === "string" && Array.isArray(value.attributes) && value.attributes.every(isMathMlAttribute) && Array.isArray(value.children) && value.children.every(isMathMlNode);
42
42
  return false;
43
43
  }
44
- const MathMlNodeSchema = zod.z.custom(isMathMlNode);
45
44
  const MathMlElementSchema = zod.z.object({
46
45
  type: zod.z.literal("element"),
47
46
  tag: zod.z.string(),
48
47
  attributes: zod.z.array(MathMlAttributeSchema),
49
- children: zod.z.array(MathMlNodeSchema)
48
+ children: zod.z.lazy(() => zod.z.array(MathMlNodeSchema))
50
49
  });
50
+ const MathMlNodeSchema = zod.z.discriminatedUnion("type", [
51
+ MathMlTextSchema,
52
+ MathMlCdataSchema,
53
+ MathMlCommentSchema,
54
+ MathMlDeclarationSchema,
55
+ MathMlPiSchema,
56
+ MathMlElementSchema
57
+ ]);
51
58
  //#endregion
52
59
  exports.MathMlAttributeSchema = MathMlAttributeSchema;
53
60
  exports.MathMlCdataSchema = MathMlCdataSchema;
package/dist/mathml.d.cts CHANGED
@@ -1,2 +1,2 @@
1
- import { _ as isMathMlNode, a as MathMlComment, c as MathMlDeclarationSchema, d as MathMlNode, f as MathMlNodeSchema, g as MathMlTextSchema, h as MathMlText, i as MathMlCdataSchema, l as MathMlElement, m as MathMlPiSchema, n as MathMlAttributeSchema, o as MathMlCommentSchema, p as MathMlPi, r as MathMlCdata, s as MathMlDeclaration, t as MathMlAttribute, u as MathMlElementSchema } from "./mathml-B1oTCtzc.cjs";
1
+ import { _ as isMathMlNode, a as MathMlComment, c as MathMlDeclarationSchema, d as MathMlNode, f as MathMlNodeSchema, g as MathMlTextSchema, h as MathMlText, i as MathMlCdataSchema, l as MathMlElement, m as MathMlPiSchema, n as MathMlAttributeSchema, o as MathMlCommentSchema, p as MathMlPi, r as MathMlCdata, s as MathMlDeclaration, t as MathMlAttribute, u as MathMlElementSchema } from "./mathml-Czqc1mdZ.cjs";
2
2
  export { MathMlAttribute, MathMlAttributeSchema, MathMlCdata, MathMlCdataSchema, MathMlComment, MathMlCommentSchema, MathMlDeclaration, MathMlDeclarationSchema, MathMlElement, MathMlElementSchema, MathMlNode, MathMlNodeSchema, MathMlPi, MathMlPiSchema, MathMlText, MathMlTextSchema, isMathMlNode };