docx 9.8.0 → 9.8.1
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.cjs +108 -57
- package/dist/index.d.cts +83 -16
- package/dist/index.d.ts +83 -16
- package/dist/index.iife.js +108 -57
- package/dist/index.mjs +109 -55
- package/dist/index.umd.cjs +108 -57
- package/dist/math.cjs +2235 -5
- package/dist/math.d.cts +316 -0
- package/dist/math.d.ts +316 -0
- package/dist/math.iife.js +2235 -5
- package/dist/math.mjs +2230 -7
- package/dist/math.umd.cjs +2235 -5
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -8223,12 +8223,6 @@ var ImportedRootElementAttributes = class extends XmlComponent {
|
|
|
8223
8223
|
}
|
|
8224
8224
|
};
|
|
8225
8225
|
//#endregion
|
|
8226
|
-
//#region src/file/xml-components/xmlable-object.ts
|
|
8227
|
-
/**
|
|
8228
|
-
* @ignore
|
|
8229
|
-
*/
|
|
8230
|
-
var WORKAROUND3 = "";
|
|
8231
|
-
//#endregion
|
|
8232
8226
|
//#region src/file/xml-components/initializable-xml-component.ts
|
|
8233
8227
|
/**
|
|
8234
8228
|
* Initializable XML Component module.
|
|
@@ -19217,6 +19211,28 @@ var MathText = class extends XmlComponent {
|
|
|
19217
19211
|
}
|
|
19218
19212
|
};
|
|
19219
19213
|
//#endregion
|
|
19214
|
+
//#region \0@oxc-project+runtime@0.150.0/helpers/esm/objectWithoutPropertiesLoose.js
|
|
19215
|
+
function _objectWithoutPropertiesLoose(r, e) {
|
|
19216
|
+
if (null == r) return {};
|
|
19217
|
+
var t = {};
|
|
19218
|
+
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
19219
|
+
if (e.includes(n)) continue;
|
|
19220
|
+
t[n] = r[n];
|
|
19221
|
+
}
|
|
19222
|
+
return t;
|
|
19223
|
+
}
|
|
19224
|
+
//#endregion
|
|
19225
|
+
//#region \0@oxc-project+runtime@0.150.0/helpers/esm/objectWithoutProperties.js
|
|
19226
|
+
function _objectWithoutProperties(e, t) {
|
|
19227
|
+
if (null == e) return {};
|
|
19228
|
+
var o, r, i = _objectWithoutPropertiesLoose(e, t);
|
|
19229
|
+
if (Object.getOwnPropertySymbols) {
|
|
19230
|
+
var s = Object.getOwnPropertySymbols(e);
|
|
19231
|
+
for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
|
|
19232
|
+
}
|
|
19233
|
+
return i;
|
|
19234
|
+
}
|
|
19235
|
+
//#endregion
|
|
19220
19236
|
//#region src/file/paragraph/math/math-run.ts
|
|
19221
19237
|
/**
|
|
19222
19238
|
* Math Run module for Office MathML.
|
|
@@ -19227,6 +19243,33 @@ var MathText = class extends XmlComponent {
|
|
|
19227
19243
|
*
|
|
19228
19244
|
* @module
|
|
19229
19245
|
*/
|
|
19246
|
+
var _excluded$3 = [
|
|
19247
|
+
"text",
|
|
19248
|
+
"normalText",
|
|
19249
|
+
"script",
|
|
19250
|
+
"literal"
|
|
19251
|
+
];
|
|
19252
|
+
var STYLES = {
|
|
19253
|
+
plain: "p",
|
|
19254
|
+
bold: "b",
|
|
19255
|
+
italic: "i",
|
|
19256
|
+
boldItalic: "bi"
|
|
19257
|
+
};
|
|
19258
|
+
var SCRIPTS = {
|
|
19259
|
+
roman: "roman",
|
|
19260
|
+
script: "script",
|
|
19261
|
+
fraktur: "fraktur",
|
|
19262
|
+
doubleStruck: "double-struck",
|
|
19263
|
+
sansSerif: "sans-serif",
|
|
19264
|
+
monospace: "monospace"
|
|
19265
|
+
};
|
|
19266
|
+
var createValueElement = (name, value) => new BuilderElement({
|
|
19267
|
+
name,
|
|
19268
|
+
attributes: { value: {
|
|
19269
|
+
key: "m:val",
|
|
19270
|
+
value
|
|
19271
|
+
} }
|
|
19272
|
+
});
|
|
19230
19273
|
/**
|
|
19231
19274
|
* Represents a run of text within a math equation.
|
|
19232
19275
|
*
|
|
@@ -19255,24 +19298,28 @@ var MathText = class extends XmlComponent {
|
|
|
19255
19298
|
* ```typescript
|
|
19256
19299
|
* new MathRun("x + y");
|
|
19257
19300
|
* new MathRun({ text: "if ", normalText: true });
|
|
19301
|
+
* new MathRun({ text: "R", script: "doubleStruck" });
|
|
19302
|
+
* new MathRun({ text: "d", style: "plain" });
|
|
19258
19303
|
* ```
|
|
19259
19304
|
*/
|
|
19260
19305
|
var MathRun = class extends XmlComponent {
|
|
19261
19306
|
constructor(options) {
|
|
19307
|
+
var _rest$style;
|
|
19262
19308
|
super("m:r");
|
|
19263
|
-
const
|
|
19264
|
-
|
|
19265
|
-
|
|
19266
|
-
|
|
19267
|
-
if (
|
|
19309
|
+
const _ref = typeof options === "string" ? { text: options } : options, { text, normalText, script, literal } = _ref;
|
|
19310
|
+
const style = (_rest$style = _objectWithoutProperties(_ref, _excluded$3).style) !== null && _rest$style !== void 0 ? _rest$style : script === void 0 || script === "roman" ? void 0 : "plain";
|
|
19311
|
+
if (normalText && (style !== void 0 || script !== void 0)) throw new Error("MathRun: normalText can't be given with style or script, which are for math. Give one or the other");
|
|
19312
|
+
if (style !== void 0 && !Object.keys(STYLES).includes(style)) throw new Error(`MathRun: style is "${style}", which isn't one of ${Object.keys(STYLES).join(", ")}`);
|
|
19313
|
+
if (script !== void 0 && !Object.keys(SCRIPTS).includes(script)) throw new Error(`MathRun: script is "${script}", which isn't one of ${Object.keys(SCRIPTS).join(", ")}`);
|
|
19314
|
+
const properties = [
|
|
19315
|
+
...literal ? [createValueElement("m:lit", 1)] : [],
|
|
19316
|
+
...normalText ? [createValueElement("m:nor", 1)] : [],
|
|
19317
|
+
...script === void 0 ? [] : [createValueElement("m:scr", SCRIPTS[script])],
|
|
19318
|
+
...style === void 0 ? [] : [createValueElement("m:sty", STYLES[style])]
|
|
19319
|
+
];
|
|
19320
|
+
if (properties.length > 0) this.root.push(new BuilderElement({
|
|
19268
19321
|
name: "m:rPr",
|
|
19269
|
-
children:
|
|
19270
|
-
name: "m:nor",
|
|
19271
|
-
attributes: { on: {
|
|
19272
|
-
key: "m:val",
|
|
19273
|
-
value: 1
|
|
19274
|
-
} }
|
|
19275
|
-
})]
|
|
19322
|
+
children: properties
|
|
19276
19323
|
}));
|
|
19277
19324
|
this.root.push(new MathText(text));
|
|
19278
19325
|
}
|
|
@@ -19328,6 +19375,12 @@ var MathNumerator = class extends XmlComponent {
|
|
|
19328
19375
|
*
|
|
19329
19376
|
* @module
|
|
19330
19377
|
*/
|
|
19378
|
+
var TYPES = {
|
|
19379
|
+
stacked: "bar",
|
|
19380
|
+
skewed: "skw",
|
|
19381
|
+
linear: "lin",
|
|
19382
|
+
noBar: "noBar"
|
|
19383
|
+
};
|
|
19331
19384
|
/**
|
|
19332
19385
|
* Represents a fraction in a math equation.
|
|
19333
19386
|
*
|
|
@@ -19354,11 +19407,29 @@ var MathNumerator = class extends XmlComponent {
|
|
|
19354
19407
|
* numerator: [new MathRun("a + b")],
|
|
19355
19408
|
* denominator: [new MathRun("c")],
|
|
19356
19409
|
* });
|
|
19410
|
+
*
|
|
19411
|
+
* // n over k, as a binomial coefficient, in brackets
|
|
19412
|
+
* new MathRoundBrackets({
|
|
19413
|
+
* children: [new MathFraction({ numerator: [new MathRun("n")], denominator: [new MathRun("k")], type: "noBar" })],
|
|
19414
|
+
* });
|
|
19357
19415
|
* ```
|
|
19358
19416
|
*/
|
|
19359
19417
|
var MathFraction = class extends XmlComponent {
|
|
19360
19418
|
constructor(options) {
|
|
19361
19419
|
super("m:f");
|
|
19420
|
+
if (options.type !== void 0) {
|
|
19421
|
+
if (!Object.keys(TYPES).includes(options.type)) throw new Error(`MathFraction: type is "${options.type}", which isn't one of ${Object.keys(TYPES).join(", ")}`);
|
|
19422
|
+
this.root.push(new BuilderElement({
|
|
19423
|
+
name: "m:fPr",
|
|
19424
|
+
children: [new BuilderElement({
|
|
19425
|
+
name: "m:type",
|
|
19426
|
+
attributes: { value: {
|
|
19427
|
+
key: "m:val",
|
|
19428
|
+
value: TYPES[options.type]
|
|
19429
|
+
} }
|
|
19430
|
+
})]
|
|
19431
|
+
}));
|
|
19432
|
+
}
|
|
19362
19433
|
this.root.push(new MathNumerator(options.numerator));
|
|
19363
19434
|
this.root.push(new MathDenominator(options.denominator));
|
|
19364
19435
|
}
|
|
@@ -19608,6 +19679,22 @@ var createMathSubScriptElement = ({ children }) => new BuilderElement({
|
|
|
19608
19679
|
children
|
|
19609
19680
|
});
|
|
19610
19681
|
//#endregion
|
|
19682
|
+
//#region src/file/paragraph/math/n-ary/limit-location-value.ts
|
|
19683
|
+
var LOCATIONS = {
|
|
19684
|
+
aboveBelow: "undOvr",
|
|
19685
|
+
side: "subSup"
|
|
19686
|
+
};
|
|
19687
|
+
/**
|
|
19688
|
+
* The value of `m:limLoc` for where limits go, or the default when none is given.
|
|
19689
|
+
*
|
|
19690
|
+
* @throws If the position isn't one of those allowed, for code that isn't type checked
|
|
19691
|
+
*/
|
|
19692
|
+
var limitLocationValue = (owner, limits, defaultValue) => {
|
|
19693
|
+
if (limits === void 0) return defaultValue;
|
|
19694
|
+
if (!Object.keys(LOCATIONS).includes(limits)) throw new Error(`${owner}: limits is "${limits}", which isn't one of ${Object.keys(LOCATIONS).join(", ")}`);
|
|
19695
|
+
return LOCATIONS[limits];
|
|
19696
|
+
};
|
|
19697
|
+
//#endregion
|
|
19611
19698
|
//#region src/file/paragraph/math/n-ary/math-super-script.ts
|
|
19612
19699
|
/**
|
|
19613
19700
|
* Math SuperScript Element module for Office MathML.
|
|
@@ -19690,7 +19777,8 @@ var MathSum = class extends XmlComponent {
|
|
|
19690
19777
|
this.root.push(createMathNAryProperties({
|
|
19691
19778
|
accent: "∑",
|
|
19692
19779
|
hasSuperScript: !!options.superScript,
|
|
19693
|
-
hasSubScript: !!options.subScript
|
|
19780
|
+
hasSubScript: !!options.subScript,
|
|
19781
|
+
limitLocationVal: limitLocationValue("MathSum", options.limits, "undOvr")
|
|
19694
19782
|
}));
|
|
19695
19783
|
this.root.push(createMathSubScriptElement({ children: (_options$subScript = options.subScript) !== null && _options$subScript !== void 0 ? _options$subScript : [] }));
|
|
19696
19784
|
this.root.push(createMathSuperScriptElement({ children: (_options$superScript = options.superScript) !== null && _options$superScript !== void 0 ? _options$superScript : [] }));
|
|
@@ -19747,7 +19835,7 @@ var MathIntegral = class extends XmlComponent {
|
|
|
19747
19835
|
accent: "",
|
|
19748
19836
|
hasSuperScript: !!options.superScript,
|
|
19749
19837
|
hasSubScript: !!options.subScript,
|
|
19750
|
-
limitLocationVal: "subSup"
|
|
19838
|
+
limitLocationVal: limitLocationValue("MathIntegral", options.limits, "subSup")
|
|
19751
19839
|
}));
|
|
19752
19840
|
this.root.push(createMathSubScriptElement({ children: (_options$subScript = options.subScript) !== null && _options$subScript !== void 0 ? _options$subScript : [] }));
|
|
19753
19841
|
this.root.push(createMathSuperScriptElement({ children: (_options$superScript = options.superScript) !== null && _options$superScript !== void 0 ? _options$superScript : [] }));
|
|
@@ -20207,12 +20295,6 @@ var MathPreSubSuperScript = class extends BuilderElement {
|
|
|
20207
20295
|
}
|
|
20208
20296
|
};
|
|
20209
20297
|
//#endregion
|
|
20210
|
-
//#region src/file/paragraph/math/math-component.ts
|
|
20211
|
-
/**
|
|
20212
|
-
* @ignore
|
|
20213
|
-
*/
|
|
20214
|
-
var WORKAROUND4 = "";
|
|
20215
|
-
//#endregion
|
|
20216
20298
|
//#region src/file/paragraph/math/radical/math-degree.ts
|
|
20217
20299
|
/**
|
|
20218
20300
|
* Math Degree module for Office MathML.
|
|
@@ -25967,12 +26049,6 @@ var Media = class {
|
|
|
25967
26049
|
}
|
|
25968
26050
|
};
|
|
25969
26051
|
//#endregion
|
|
25970
|
-
//#region src/file/media/data.ts
|
|
25971
|
-
/**
|
|
25972
|
-
* @ignore
|
|
25973
|
-
*/
|
|
25974
|
-
var WORKAROUND2 = "";
|
|
25975
|
-
//#endregion
|
|
25976
26052
|
//#region src/file/numbering/level.ts
|
|
25977
26053
|
/**
|
|
25978
26054
|
* Numbering level definitions module for WordprocessingML documents.
|
|
@@ -29306,28 +29382,6 @@ var StructuredDocumentTagProperties = class extends XmlComponent {
|
|
|
29306
29382
|
}
|
|
29307
29383
|
};
|
|
29308
29384
|
//#endregion
|
|
29309
|
-
//#region \0@oxc-project+runtime@0.150.0/helpers/esm/objectWithoutPropertiesLoose.js
|
|
29310
|
-
function _objectWithoutPropertiesLoose(r, e) {
|
|
29311
|
-
if (null == r) return {};
|
|
29312
|
-
var t = {};
|
|
29313
|
-
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
29314
|
-
if (e.includes(n)) continue;
|
|
29315
|
-
t[n] = r[n];
|
|
29316
|
-
}
|
|
29317
|
-
return t;
|
|
29318
|
-
}
|
|
29319
|
-
//#endregion
|
|
29320
|
-
//#region \0@oxc-project+runtime@0.150.0/helpers/esm/objectWithoutProperties.js
|
|
29321
|
-
function _objectWithoutProperties(e, t) {
|
|
29322
|
-
if (null == e) return {};
|
|
29323
|
-
var o, r, i = _objectWithoutPropertiesLoose(e, t);
|
|
29324
|
-
if (Object.getOwnPropertySymbols) {
|
|
29325
|
-
var s = Object.getOwnPropertySymbols(e);
|
|
29326
|
-
for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
|
|
29327
|
-
}
|
|
29328
|
-
return i;
|
|
29329
|
-
}
|
|
29330
|
-
//#endregion
|
|
29331
29385
|
//#region src/file/table-of-contents/table-of-contents.ts
|
|
29332
29386
|
/**
|
|
29333
29387
|
* Table of Contents module for WordprocessingML documents.
|
|
@@ -36077,9 +36131,6 @@ exports.VerticalMergeRevisionType = VerticalMergeRevisionType;
|
|
|
36077
36131
|
exports.VerticalMergeType = VerticalMergeType;
|
|
36078
36132
|
exports.VerticalPositionAlign = VerticalPositionAlign;
|
|
36079
36133
|
exports.VerticalPositionRelativeFrom = VerticalPositionRelativeFrom;
|
|
36080
|
-
exports.WORKAROUND2 = WORKAROUND2;
|
|
36081
|
-
exports.WORKAROUND3 = WORKAROUND3;
|
|
36082
|
-
exports.WORKAROUND4 = WORKAROUND4;
|
|
36083
36134
|
exports.WidthType = WidthType;
|
|
36084
36135
|
exports.WpgGroupRun = WpgGroupRun;
|
|
36085
36136
|
exports.WpsShapeRun = WpsShapeRun;
|
package/dist/index.d.cts
CHANGED
|
@@ -5743,6 +5743,11 @@ export declare type IMathFractionOptions = {
|
|
|
5743
5743
|
readonly numerator: readonly MathComponent[];
|
|
5744
5744
|
/** Math components for the denominator (bottom) of the fraction */
|
|
5745
5745
|
readonly denominator: readonly MathComponent[];
|
|
5746
|
+
/**
|
|
5747
|
+
* How the fraction is drawn: stacked, skewed, linear, or stacked with no bar.
|
|
5748
|
+
* @default "stacked"
|
|
5749
|
+
*/
|
|
5750
|
+
readonly type?: MathFractionType;
|
|
5746
5751
|
};
|
|
5747
5752
|
|
|
5748
5753
|
/**
|
|
@@ -5769,6 +5774,11 @@ export declare type IMathIntegralOptions = {
|
|
|
5769
5774
|
readonly subScript?: readonly MathComponent[];
|
|
5770
5775
|
/** Optional upper bound of integration */
|
|
5771
5776
|
readonly superScript?: readonly MathComponent[];
|
|
5777
|
+
/**
|
|
5778
|
+
* Where the limits go: above and below the ∫, or to its right.
|
|
5779
|
+
* @default "side"
|
|
5780
|
+
*/
|
|
5781
|
+
readonly limits?: MathLimitsPosition;
|
|
5772
5782
|
};
|
|
5773
5783
|
|
|
5774
5784
|
/**
|
|
@@ -5869,6 +5879,11 @@ export declare type IMathSumOptions = {
|
|
|
5869
5879
|
readonly subScript?: readonly MathComponent[];
|
|
5870
5880
|
/** Optional upper bound (superscript) of the sum */
|
|
5871
5881
|
readonly superScript?: readonly MathComponent[];
|
|
5882
|
+
/**
|
|
5883
|
+
* Where the limits go: above and below the ∑, or to its right.
|
|
5884
|
+
* @default "aboveBelow"
|
|
5885
|
+
*/
|
|
5886
|
+
readonly limits?: MathLimitsPosition;
|
|
5872
5887
|
};
|
|
5873
5888
|
|
|
5874
5889
|
/**
|
|
@@ -8289,12 +8304,27 @@ export declare class MathDenominator extends XmlComponent {
|
|
|
8289
8304
|
* numerator: [new MathRun("a + b")],
|
|
8290
8305
|
* denominator: [new MathRun("c")],
|
|
8291
8306
|
* });
|
|
8307
|
+
*
|
|
8308
|
+
* // n over k, as a binomial coefficient, in brackets
|
|
8309
|
+
* new MathRoundBrackets({
|
|
8310
|
+
* children: [new MathFraction({ numerator: [new MathRun("n")], denominator: [new MathRun("k")], type: "noBar" })],
|
|
8311
|
+
* });
|
|
8292
8312
|
* ```
|
|
8293
8313
|
*/
|
|
8294
8314
|
export declare class MathFraction extends XmlComponent {
|
|
8295
8315
|
constructor(options: IMathFractionOptions);
|
|
8296
8316
|
}
|
|
8297
8317
|
|
|
8318
|
+
/**
|
|
8319
|
+
* How a fraction is drawn (`m:type`):
|
|
8320
|
+
*
|
|
8321
|
+
* - `"stacked"`: the numerator over the denominator, with a bar between them;
|
|
8322
|
+
* - `"skewed"`: the numerator up and to the left of a slash, and the denominator down and to the right, as ½;
|
|
8323
|
+
* - `"linear"`: on one line, with a slash between them, as a/b;
|
|
8324
|
+
* - `"noBar"`: stacked, with no bar between them, as in a binomial coefficient.
|
|
8325
|
+
*/
|
|
8326
|
+
export declare type MathFractionType = "stacked" | "skewed" | "linear" | "noBar";
|
|
8327
|
+
|
|
8298
8328
|
/**
|
|
8299
8329
|
* Represents a mathematical function in a math equation.
|
|
8300
8330
|
*
|
|
@@ -8479,6 +8509,14 @@ export declare class MathLimitLower extends XmlComponent {
|
|
|
8479
8509
|
constructor(options: IMathLimitLowerOptions);
|
|
8480
8510
|
}
|
|
8481
8511
|
|
|
8512
|
+
/**
|
|
8513
|
+
* Where a large operator's limits go (`m:limLoc`):
|
|
8514
|
+
*
|
|
8515
|
+
* - `"aboveBelow"`: above and below it, as a sum's usually are;
|
|
8516
|
+
* - `"side"`: to its right, as a superscript and subscript, as an integral's usually are.
|
|
8517
|
+
*/
|
|
8518
|
+
export declare type MathLimitsPosition = "aboveBelow" | "side";
|
|
8519
|
+
|
|
8482
8520
|
/**
|
|
8483
8521
|
* Represents an upper limit structure in a math equation.
|
|
8484
8522
|
*
|
|
@@ -8691,6 +8729,8 @@ export declare class MathRoundBrackets extends XmlComponent {
|
|
|
8691
8729
|
* ```typescript
|
|
8692
8730
|
* new MathRun("x + y");
|
|
8693
8731
|
* new MathRun({ text: "if ", normalText: true });
|
|
8732
|
+
* new MathRun({ text: "R", script: "doubleStruck" });
|
|
8733
|
+
* new MathRun({ text: "d", style: "plain" });
|
|
8694
8734
|
* ```
|
|
8695
8735
|
*/
|
|
8696
8736
|
export declare class MathRun extends XmlComponent {
|
|
@@ -8705,12 +8745,54 @@ export declare type MathRunOptions = {
|
|
|
8705
8745
|
readonly text: string;
|
|
8706
8746
|
/**
|
|
8707
8747
|
* Writes the text as ordinary text rather than math, as Word's "Normal Text" button does (`m:nor`): upright and in
|
|
8708
|
-
* the document's font, with its spaces kept. For words in an equation, such as "if" and "otherwise" in cases.
|
|
8748
|
+
* the document's font, with its spaces kept. For words in an equation, such as "if" and "otherwise" in cases. It
|
|
8749
|
+
* can't be given with `style` or `script`, which are for math.
|
|
8709
8750
|
* @default false
|
|
8710
8751
|
*/
|
|
8711
8752
|
readonly normalText?: boolean;
|
|
8753
|
+
/**
|
|
8754
|
+
* How the letters are drawn: plain (upright), bold, italic or both (`m:sty`).
|
|
8755
|
+
* @default "plain" with a `script` other than roman, as LaTeX draws its alphabets upright; otherwise none, and Word
|
|
8756
|
+
* draws letters in italic
|
|
8757
|
+
*/
|
|
8758
|
+
readonly style?: MathRunStyle;
|
|
8759
|
+
/**
|
|
8760
|
+
* The alphabet the letters are drawn in, such as double-struck for ℝ (`m:scr`).
|
|
8761
|
+
*/
|
|
8762
|
+
readonly script?: MathRunScript;
|
|
8763
|
+
/**
|
|
8764
|
+
* Takes the text as it is (`m:lit`), rather than as something Word builds up or lines up, such as an `&` in a
|
|
8765
|
+
* `MathEquationArray`, which would otherwise be a point the rows line up at.
|
|
8766
|
+
* @default false
|
|
8767
|
+
*/
|
|
8768
|
+
readonly literal?: boolean;
|
|
8712
8769
|
};
|
|
8713
8770
|
|
|
8771
|
+
/**
|
|
8772
|
+
* The alphabet a {@link MathRun}'s letters are drawn in (`m:scr`):
|
|
8773
|
+
*
|
|
8774
|
+
* - `"roman"`: the math font's own letters, as Word draws them unless a run has an alphabet;
|
|
8775
|
+
* - `"script"`: 𝒜, as LaTeX's `\mathcal` and `\mathscr`;
|
|
8776
|
+
* - `"fraktur"`: 𝔄, as `\mathfrak`;
|
|
8777
|
+
* - `"doubleStruck"`: 𝔸, as `\mathbb`, for sets such as ℝ;
|
|
8778
|
+
* - `"sansSerif"`: 𝖠, as `\mathsf`;
|
|
8779
|
+
* - `"monospace"`: 𝙰, as `\mathtt`.
|
|
8780
|
+
*/
|
|
8781
|
+
export declare type MathRunScript = "roman" | "script" | "fraktur" | "doubleStruck" | "sansSerif" | "monospace";
|
|
8782
|
+
|
|
8783
|
+
/**
|
|
8784
|
+
* How a {@link MathRun}'s letters are drawn (`m:sty`):
|
|
8785
|
+
*
|
|
8786
|
+
* - `"plain"`: upright, as LaTeX's `\mathrm`;
|
|
8787
|
+
* - `"bold"`: bold and upright, as `\mathbf`;
|
|
8788
|
+
* - `"italic"`: italic, as `\mathit`;
|
|
8789
|
+
* - `"boldItalic"`: bold and italic, as `\boldsymbol`.
|
|
8790
|
+
*
|
|
8791
|
+
* Word draws letters in italic, and digits and capital Greek letters upright, unless a run has a style. A run in an
|
|
8792
|
+
* alphabet other than roman is plain unless given a style, as LaTeX draws its alphabets upright.
|
|
8793
|
+
*/
|
|
8794
|
+
export declare type MathRunStyle = "plain" | "bold" | "italic" | "boldItalic";
|
|
8795
|
+
|
|
8714
8796
|
/**
|
|
8715
8797
|
* Represents square brackets in a math equation.
|
|
8716
8798
|
*
|
|
@@ -13128,21 +13210,6 @@ declare type WithHexColors<T> = Omit<T, "borders" | "shading"> & {
|
|
|
13128
13210
|
};
|
|
13129
13211
|
};
|
|
13130
13212
|
|
|
13131
|
-
/**
|
|
13132
|
-
* @ignore
|
|
13133
|
-
*/
|
|
13134
|
-
export declare const WORKAROUND2 = "";
|
|
13135
|
-
|
|
13136
|
-
/**
|
|
13137
|
-
* @ignore
|
|
13138
|
-
*/
|
|
13139
|
-
export declare const WORKAROUND3 = "";
|
|
13140
|
-
|
|
13141
|
-
/**
|
|
13142
|
-
* @ignore
|
|
13143
|
-
*/
|
|
13144
|
-
export declare const WORKAROUND4 = "";
|
|
13145
|
-
|
|
13146
13213
|
export declare type WpgCommonMediaData = {
|
|
13147
13214
|
readonly outline?: OutlineOptions;
|
|
13148
13215
|
readonly solidFill?: SolidFillOptions;
|
package/dist/index.d.ts
CHANGED
|
@@ -5743,6 +5743,11 @@ export declare type IMathFractionOptions = {
|
|
|
5743
5743
|
readonly numerator: readonly MathComponent[];
|
|
5744
5744
|
/** Math components for the denominator (bottom) of the fraction */
|
|
5745
5745
|
readonly denominator: readonly MathComponent[];
|
|
5746
|
+
/**
|
|
5747
|
+
* How the fraction is drawn: stacked, skewed, linear, or stacked with no bar.
|
|
5748
|
+
* @default "stacked"
|
|
5749
|
+
*/
|
|
5750
|
+
readonly type?: MathFractionType;
|
|
5746
5751
|
};
|
|
5747
5752
|
|
|
5748
5753
|
/**
|
|
@@ -5769,6 +5774,11 @@ export declare type IMathIntegralOptions = {
|
|
|
5769
5774
|
readonly subScript?: readonly MathComponent[];
|
|
5770
5775
|
/** Optional upper bound of integration */
|
|
5771
5776
|
readonly superScript?: readonly MathComponent[];
|
|
5777
|
+
/**
|
|
5778
|
+
* Where the limits go: above and below the ∫, or to its right.
|
|
5779
|
+
* @default "side"
|
|
5780
|
+
*/
|
|
5781
|
+
readonly limits?: MathLimitsPosition;
|
|
5772
5782
|
};
|
|
5773
5783
|
|
|
5774
5784
|
/**
|
|
@@ -5869,6 +5879,11 @@ export declare type IMathSumOptions = {
|
|
|
5869
5879
|
readonly subScript?: readonly MathComponent[];
|
|
5870
5880
|
/** Optional upper bound (superscript) of the sum */
|
|
5871
5881
|
readonly superScript?: readonly MathComponent[];
|
|
5882
|
+
/**
|
|
5883
|
+
* Where the limits go: above and below the ∑, or to its right.
|
|
5884
|
+
* @default "aboveBelow"
|
|
5885
|
+
*/
|
|
5886
|
+
readonly limits?: MathLimitsPosition;
|
|
5872
5887
|
};
|
|
5873
5888
|
|
|
5874
5889
|
/**
|
|
@@ -8289,12 +8304,27 @@ export declare class MathDenominator extends XmlComponent {
|
|
|
8289
8304
|
* numerator: [new MathRun("a + b")],
|
|
8290
8305
|
* denominator: [new MathRun("c")],
|
|
8291
8306
|
* });
|
|
8307
|
+
*
|
|
8308
|
+
* // n over k, as a binomial coefficient, in brackets
|
|
8309
|
+
* new MathRoundBrackets({
|
|
8310
|
+
* children: [new MathFraction({ numerator: [new MathRun("n")], denominator: [new MathRun("k")], type: "noBar" })],
|
|
8311
|
+
* });
|
|
8292
8312
|
* ```
|
|
8293
8313
|
*/
|
|
8294
8314
|
export declare class MathFraction extends XmlComponent {
|
|
8295
8315
|
constructor(options: IMathFractionOptions);
|
|
8296
8316
|
}
|
|
8297
8317
|
|
|
8318
|
+
/**
|
|
8319
|
+
* How a fraction is drawn (`m:type`):
|
|
8320
|
+
*
|
|
8321
|
+
* - `"stacked"`: the numerator over the denominator, with a bar between them;
|
|
8322
|
+
* - `"skewed"`: the numerator up and to the left of a slash, and the denominator down and to the right, as ½;
|
|
8323
|
+
* - `"linear"`: on one line, with a slash between them, as a/b;
|
|
8324
|
+
* - `"noBar"`: stacked, with no bar between them, as in a binomial coefficient.
|
|
8325
|
+
*/
|
|
8326
|
+
export declare type MathFractionType = "stacked" | "skewed" | "linear" | "noBar";
|
|
8327
|
+
|
|
8298
8328
|
/**
|
|
8299
8329
|
* Represents a mathematical function in a math equation.
|
|
8300
8330
|
*
|
|
@@ -8479,6 +8509,14 @@ export declare class MathLimitLower extends XmlComponent {
|
|
|
8479
8509
|
constructor(options: IMathLimitLowerOptions);
|
|
8480
8510
|
}
|
|
8481
8511
|
|
|
8512
|
+
/**
|
|
8513
|
+
* Where a large operator's limits go (`m:limLoc`):
|
|
8514
|
+
*
|
|
8515
|
+
* - `"aboveBelow"`: above and below it, as a sum's usually are;
|
|
8516
|
+
* - `"side"`: to its right, as a superscript and subscript, as an integral's usually are.
|
|
8517
|
+
*/
|
|
8518
|
+
export declare type MathLimitsPosition = "aboveBelow" | "side";
|
|
8519
|
+
|
|
8482
8520
|
/**
|
|
8483
8521
|
* Represents an upper limit structure in a math equation.
|
|
8484
8522
|
*
|
|
@@ -8691,6 +8729,8 @@ export declare class MathRoundBrackets extends XmlComponent {
|
|
|
8691
8729
|
* ```typescript
|
|
8692
8730
|
* new MathRun("x + y");
|
|
8693
8731
|
* new MathRun({ text: "if ", normalText: true });
|
|
8732
|
+
* new MathRun({ text: "R", script: "doubleStruck" });
|
|
8733
|
+
* new MathRun({ text: "d", style: "plain" });
|
|
8694
8734
|
* ```
|
|
8695
8735
|
*/
|
|
8696
8736
|
export declare class MathRun extends XmlComponent {
|
|
@@ -8705,12 +8745,54 @@ export declare type MathRunOptions = {
|
|
|
8705
8745
|
readonly text: string;
|
|
8706
8746
|
/**
|
|
8707
8747
|
* Writes the text as ordinary text rather than math, as Word's "Normal Text" button does (`m:nor`): upright and in
|
|
8708
|
-
* the document's font, with its spaces kept. For words in an equation, such as "if" and "otherwise" in cases.
|
|
8748
|
+
* the document's font, with its spaces kept. For words in an equation, such as "if" and "otherwise" in cases. It
|
|
8749
|
+
* can't be given with `style` or `script`, which are for math.
|
|
8709
8750
|
* @default false
|
|
8710
8751
|
*/
|
|
8711
8752
|
readonly normalText?: boolean;
|
|
8753
|
+
/**
|
|
8754
|
+
* How the letters are drawn: plain (upright), bold, italic or both (`m:sty`).
|
|
8755
|
+
* @default "plain" with a `script` other than roman, as LaTeX draws its alphabets upright; otherwise none, and Word
|
|
8756
|
+
* draws letters in italic
|
|
8757
|
+
*/
|
|
8758
|
+
readonly style?: MathRunStyle;
|
|
8759
|
+
/**
|
|
8760
|
+
* The alphabet the letters are drawn in, such as double-struck for ℝ (`m:scr`).
|
|
8761
|
+
*/
|
|
8762
|
+
readonly script?: MathRunScript;
|
|
8763
|
+
/**
|
|
8764
|
+
* Takes the text as it is (`m:lit`), rather than as something Word builds up or lines up, such as an `&` in a
|
|
8765
|
+
* `MathEquationArray`, which would otherwise be a point the rows line up at.
|
|
8766
|
+
* @default false
|
|
8767
|
+
*/
|
|
8768
|
+
readonly literal?: boolean;
|
|
8712
8769
|
};
|
|
8713
8770
|
|
|
8771
|
+
/**
|
|
8772
|
+
* The alphabet a {@link MathRun}'s letters are drawn in (`m:scr`):
|
|
8773
|
+
*
|
|
8774
|
+
* - `"roman"`: the math font's own letters, as Word draws them unless a run has an alphabet;
|
|
8775
|
+
* - `"script"`: 𝒜, as LaTeX's `\mathcal` and `\mathscr`;
|
|
8776
|
+
* - `"fraktur"`: 𝔄, as `\mathfrak`;
|
|
8777
|
+
* - `"doubleStruck"`: 𝔸, as `\mathbb`, for sets such as ℝ;
|
|
8778
|
+
* - `"sansSerif"`: 𝖠, as `\mathsf`;
|
|
8779
|
+
* - `"monospace"`: 𝙰, as `\mathtt`.
|
|
8780
|
+
*/
|
|
8781
|
+
export declare type MathRunScript = "roman" | "script" | "fraktur" | "doubleStruck" | "sansSerif" | "monospace";
|
|
8782
|
+
|
|
8783
|
+
/**
|
|
8784
|
+
* How a {@link MathRun}'s letters are drawn (`m:sty`):
|
|
8785
|
+
*
|
|
8786
|
+
* - `"plain"`: upright, as LaTeX's `\mathrm`;
|
|
8787
|
+
* - `"bold"`: bold and upright, as `\mathbf`;
|
|
8788
|
+
* - `"italic"`: italic, as `\mathit`;
|
|
8789
|
+
* - `"boldItalic"`: bold and italic, as `\boldsymbol`.
|
|
8790
|
+
*
|
|
8791
|
+
* Word draws letters in italic, and digits and capital Greek letters upright, unless a run has a style. A run in an
|
|
8792
|
+
* alphabet other than roman is plain unless given a style, as LaTeX draws its alphabets upright.
|
|
8793
|
+
*/
|
|
8794
|
+
export declare type MathRunStyle = "plain" | "bold" | "italic" | "boldItalic";
|
|
8795
|
+
|
|
8714
8796
|
/**
|
|
8715
8797
|
* Represents square brackets in a math equation.
|
|
8716
8798
|
*
|
|
@@ -13128,21 +13210,6 @@ declare type WithHexColors<T> = Omit<T, "borders" | "shading"> & {
|
|
|
13128
13210
|
};
|
|
13129
13211
|
};
|
|
13130
13212
|
|
|
13131
|
-
/**
|
|
13132
|
-
* @ignore
|
|
13133
|
-
*/
|
|
13134
|
-
export declare const WORKAROUND2 = "";
|
|
13135
|
-
|
|
13136
|
-
/**
|
|
13137
|
-
* @ignore
|
|
13138
|
-
*/
|
|
13139
|
-
export declare const WORKAROUND3 = "";
|
|
13140
|
-
|
|
13141
|
-
/**
|
|
13142
|
-
* @ignore
|
|
13143
|
-
*/
|
|
13144
|
-
export declare const WORKAROUND4 = "";
|
|
13145
|
-
|
|
13146
13213
|
export declare type WpgCommonMediaData = {
|
|
13147
13214
|
readonly outline?: OutlineOptions;
|
|
13148
13215
|
readonly solidFill?: SolidFillOptions;
|