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.umd.cjs
CHANGED
|
@@ -8226,12 +8226,6 @@
|
|
|
8226
8226
|
}
|
|
8227
8227
|
};
|
|
8228
8228
|
//#endregion
|
|
8229
|
-
//#region src/file/xml-components/xmlable-object.ts
|
|
8230
|
-
/**
|
|
8231
|
-
* @ignore
|
|
8232
|
-
*/
|
|
8233
|
-
var WORKAROUND3 = "";
|
|
8234
|
-
//#endregion
|
|
8235
8229
|
//#region src/file/xml-components/initializable-xml-component.ts
|
|
8236
8230
|
/**
|
|
8237
8231
|
* Initializable XML Component module.
|
|
@@ -19220,6 +19214,28 @@ MAX: 9026 };
|
|
|
19220
19214
|
}
|
|
19221
19215
|
};
|
|
19222
19216
|
//#endregion
|
|
19217
|
+
//#region \0@oxc-project+runtime@0.150.0/helpers/esm/objectWithoutPropertiesLoose.js
|
|
19218
|
+
function _objectWithoutPropertiesLoose(r, e) {
|
|
19219
|
+
if (null == r) return {};
|
|
19220
|
+
var t = {};
|
|
19221
|
+
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
19222
|
+
if (e.includes(n)) continue;
|
|
19223
|
+
t[n] = r[n];
|
|
19224
|
+
}
|
|
19225
|
+
return t;
|
|
19226
|
+
}
|
|
19227
|
+
//#endregion
|
|
19228
|
+
//#region \0@oxc-project+runtime@0.150.0/helpers/esm/objectWithoutProperties.js
|
|
19229
|
+
function _objectWithoutProperties(e, t) {
|
|
19230
|
+
if (null == e) return {};
|
|
19231
|
+
var o, r, i = _objectWithoutPropertiesLoose(e, t);
|
|
19232
|
+
if (Object.getOwnPropertySymbols) {
|
|
19233
|
+
var s = Object.getOwnPropertySymbols(e);
|
|
19234
|
+
for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
|
|
19235
|
+
}
|
|
19236
|
+
return i;
|
|
19237
|
+
}
|
|
19238
|
+
//#endregion
|
|
19223
19239
|
//#region src/file/paragraph/math/math-run.ts
|
|
19224
19240
|
/**
|
|
19225
19241
|
* Math Run module for Office MathML.
|
|
@@ -19230,6 +19246,33 @@ MAX: 9026 };
|
|
|
19230
19246
|
*
|
|
19231
19247
|
* @module
|
|
19232
19248
|
*/
|
|
19249
|
+
var _excluded$3 = [
|
|
19250
|
+
"text",
|
|
19251
|
+
"normalText",
|
|
19252
|
+
"script",
|
|
19253
|
+
"literal"
|
|
19254
|
+
];
|
|
19255
|
+
var STYLES = {
|
|
19256
|
+
plain: "p",
|
|
19257
|
+
bold: "b",
|
|
19258
|
+
italic: "i",
|
|
19259
|
+
boldItalic: "bi"
|
|
19260
|
+
};
|
|
19261
|
+
var SCRIPTS = {
|
|
19262
|
+
roman: "roman",
|
|
19263
|
+
script: "script",
|
|
19264
|
+
fraktur: "fraktur",
|
|
19265
|
+
doubleStruck: "double-struck",
|
|
19266
|
+
sansSerif: "sans-serif",
|
|
19267
|
+
monospace: "monospace"
|
|
19268
|
+
};
|
|
19269
|
+
var createValueElement = (name, value) => new BuilderElement({
|
|
19270
|
+
name,
|
|
19271
|
+
attributes: { value: {
|
|
19272
|
+
key: "m:val",
|
|
19273
|
+
value
|
|
19274
|
+
} }
|
|
19275
|
+
});
|
|
19233
19276
|
/**
|
|
19234
19277
|
* Represents a run of text within a math equation.
|
|
19235
19278
|
*
|
|
@@ -19258,24 +19301,28 @@ MAX: 9026 };
|
|
|
19258
19301
|
* ```typescript
|
|
19259
19302
|
* new MathRun("x + y");
|
|
19260
19303
|
* new MathRun({ text: "if ", normalText: true });
|
|
19304
|
+
* new MathRun({ text: "R", script: "doubleStruck" });
|
|
19305
|
+
* new MathRun({ text: "d", style: "plain" });
|
|
19261
19306
|
* ```
|
|
19262
19307
|
*/
|
|
19263
19308
|
var MathRun = class extends XmlComponent {
|
|
19264
19309
|
constructor(options) {
|
|
19310
|
+
var _rest$style;
|
|
19265
19311
|
super("m:r");
|
|
19266
|
-
const
|
|
19267
|
-
|
|
19268
|
-
|
|
19269
|
-
|
|
19270
|
-
if (
|
|
19312
|
+
const _ref = typeof options === "string" ? { text: options } : options, { text, normalText, script, literal } = _ref;
|
|
19313
|
+
const style = (_rest$style = _objectWithoutProperties(_ref, _excluded$3).style) !== null && _rest$style !== void 0 ? _rest$style : script === void 0 || script === "roman" ? void 0 : "plain";
|
|
19314
|
+
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");
|
|
19315
|
+
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(", ")}`);
|
|
19316
|
+
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(", ")}`);
|
|
19317
|
+
const properties = [
|
|
19318
|
+
...literal ? [createValueElement("m:lit", 1)] : [],
|
|
19319
|
+
...normalText ? [createValueElement("m:nor", 1)] : [],
|
|
19320
|
+
...script === void 0 ? [] : [createValueElement("m:scr", SCRIPTS[script])],
|
|
19321
|
+
...style === void 0 ? [] : [createValueElement("m:sty", STYLES[style])]
|
|
19322
|
+
];
|
|
19323
|
+
if (properties.length > 0) this.root.push(new BuilderElement({
|
|
19271
19324
|
name: "m:rPr",
|
|
19272
|
-
children:
|
|
19273
|
-
name: "m:nor",
|
|
19274
|
-
attributes: { on: {
|
|
19275
|
-
key: "m:val",
|
|
19276
|
-
value: 1
|
|
19277
|
-
} }
|
|
19278
|
-
})]
|
|
19325
|
+
children: properties
|
|
19279
19326
|
}));
|
|
19280
19327
|
this.root.push(new MathText(text));
|
|
19281
19328
|
}
|
|
@@ -19331,6 +19378,12 @@ MAX: 9026 };
|
|
|
19331
19378
|
*
|
|
19332
19379
|
* @module
|
|
19333
19380
|
*/
|
|
19381
|
+
var TYPES = {
|
|
19382
|
+
stacked: "bar",
|
|
19383
|
+
skewed: "skw",
|
|
19384
|
+
linear: "lin",
|
|
19385
|
+
noBar: "noBar"
|
|
19386
|
+
};
|
|
19334
19387
|
/**
|
|
19335
19388
|
* Represents a fraction in a math equation.
|
|
19336
19389
|
*
|
|
@@ -19357,11 +19410,29 @@ MAX: 9026 };
|
|
|
19357
19410
|
* numerator: [new MathRun("a + b")],
|
|
19358
19411
|
* denominator: [new MathRun("c")],
|
|
19359
19412
|
* });
|
|
19413
|
+
*
|
|
19414
|
+
* // n over k, as a binomial coefficient, in brackets
|
|
19415
|
+
* new MathRoundBrackets({
|
|
19416
|
+
* children: [new MathFraction({ numerator: [new MathRun("n")], denominator: [new MathRun("k")], type: "noBar" })],
|
|
19417
|
+
* });
|
|
19360
19418
|
* ```
|
|
19361
19419
|
*/
|
|
19362
19420
|
var MathFraction = class extends XmlComponent {
|
|
19363
19421
|
constructor(options) {
|
|
19364
19422
|
super("m:f");
|
|
19423
|
+
if (options.type !== void 0) {
|
|
19424
|
+
if (!Object.keys(TYPES).includes(options.type)) throw new Error(`MathFraction: type is "${options.type}", which isn't one of ${Object.keys(TYPES).join(", ")}`);
|
|
19425
|
+
this.root.push(new BuilderElement({
|
|
19426
|
+
name: "m:fPr",
|
|
19427
|
+
children: [new BuilderElement({
|
|
19428
|
+
name: "m:type",
|
|
19429
|
+
attributes: { value: {
|
|
19430
|
+
key: "m:val",
|
|
19431
|
+
value: TYPES[options.type]
|
|
19432
|
+
} }
|
|
19433
|
+
})]
|
|
19434
|
+
}));
|
|
19435
|
+
}
|
|
19365
19436
|
this.root.push(new MathNumerator(options.numerator));
|
|
19366
19437
|
this.root.push(new MathDenominator(options.denominator));
|
|
19367
19438
|
}
|
|
@@ -19611,6 +19682,22 @@ MAX: 9026 };
|
|
|
19611
19682
|
children
|
|
19612
19683
|
});
|
|
19613
19684
|
//#endregion
|
|
19685
|
+
//#region src/file/paragraph/math/n-ary/limit-location-value.ts
|
|
19686
|
+
var LOCATIONS = {
|
|
19687
|
+
aboveBelow: "undOvr",
|
|
19688
|
+
side: "subSup"
|
|
19689
|
+
};
|
|
19690
|
+
/**
|
|
19691
|
+
* The value of `m:limLoc` for where limits go, or the default when none is given.
|
|
19692
|
+
*
|
|
19693
|
+
* @throws If the position isn't one of those allowed, for code that isn't type checked
|
|
19694
|
+
*/
|
|
19695
|
+
var limitLocationValue = (owner, limits, defaultValue) => {
|
|
19696
|
+
if (limits === void 0) return defaultValue;
|
|
19697
|
+
if (!Object.keys(LOCATIONS).includes(limits)) throw new Error(`${owner}: limits is "${limits}", which isn't one of ${Object.keys(LOCATIONS).join(", ")}`);
|
|
19698
|
+
return LOCATIONS[limits];
|
|
19699
|
+
};
|
|
19700
|
+
//#endregion
|
|
19614
19701
|
//#region src/file/paragraph/math/n-ary/math-super-script.ts
|
|
19615
19702
|
/**
|
|
19616
19703
|
* Math SuperScript Element module for Office MathML.
|
|
@@ -19693,7 +19780,8 @@ MAX: 9026 };
|
|
|
19693
19780
|
this.root.push(createMathNAryProperties({
|
|
19694
19781
|
accent: "∑",
|
|
19695
19782
|
hasSuperScript: !!options.superScript,
|
|
19696
|
-
hasSubScript: !!options.subScript
|
|
19783
|
+
hasSubScript: !!options.subScript,
|
|
19784
|
+
limitLocationVal: limitLocationValue("MathSum", options.limits, "undOvr")
|
|
19697
19785
|
}));
|
|
19698
19786
|
this.root.push(createMathSubScriptElement({ children: (_options$subScript = options.subScript) !== null && _options$subScript !== void 0 ? _options$subScript : [] }));
|
|
19699
19787
|
this.root.push(createMathSuperScriptElement({ children: (_options$superScript = options.superScript) !== null && _options$superScript !== void 0 ? _options$superScript : [] }));
|
|
@@ -19750,7 +19838,7 @@ MAX: 9026 };
|
|
|
19750
19838
|
accent: "",
|
|
19751
19839
|
hasSuperScript: !!options.superScript,
|
|
19752
19840
|
hasSubScript: !!options.subScript,
|
|
19753
|
-
limitLocationVal: "subSup"
|
|
19841
|
+
limitLocationVal: limitLocationValue("MathIntegral", options.limits, "subSup")
|
|
19754
19842
|
}));
|
|
19755
19843
|
this.root.push(createMathSubScriptElement({ children: (_options$subScript = options.subScript) !== null && _options$subScript !== void 0 ? _options$subScript : [] }));
|
|
19756
19844
|
this.root.push(createMathSuperScriptElement({ children: (_options$superScript = options.superScript) !== null && _options$superScript !== void 0 ? _options$superScript : [] }));
|
|
@@ -20210,12 +20298,6 @@ MAX: 9026 };
|
|
|
20210
20298
|
}
|
|
20211
20299
|
};
|
|
20212
20300
|
//#endregion
|
|
20213
|
-
//#region src/file/paragraph/math/math-component.ts
|
|
20214
|
-
/**
|
|
20215
|
-
* @ignore
|
|
20216
|
-
*/
|
|
20217
|
-
var WORKAROUND4 = "";
|
|
20218
|
-
//#endregion
|
|
20219
20301
|
//#region src/file/paragraph/math/radical/math-degree.ts
|
|
20220
20302
|
/**
|
|
20221
20303
|
* Math Degree module for Office MathML.
|
|
@@ -25970,12 +26052,6 @@ MAX: 9026 };
|
|
|
25970
26052
|
}
|
|
25971
26053
|
};
|
|
25972
26054
|
//#endregion
|
|
25973
|
-
//#region src/file/media/data.ts
|
|
25974
|
-
/**
|
|
25975
|
-
* @ignore
|
|
25976
|
-
*/
|
|
25977
|
-
var WORKAROUND2 = "";
|
|
25978
|
-
//#endregion
|
|
25979
26055
|
//#region src/file/numbering/level.ts
|
|
25980
26056
|
/**
|
|
25981
26057
|
* Numbering level definitions module for WordprocessingML documents.
|
|
@@ -29309,28 +29385,6 @@ MAX: 9026 };
|
|
|
29309
29385
|
}
|
|
29310
29386
|
};
|
|
29311
29387
|
//#endregion
|
|
29312
|
-
//#region \0@oxc-project+runtime@0.150.0/helpers/esm/objectWithoutPropertiesLoose.js
|
|
29313
|
-
function _objectWithoutPropertiesLoose(r, e) {
|
|
29314
|
-
if (null == r) return {};
|
|
29315
|
-
var t = {};
|
|
29316
|
-
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
29317
|
-
if (e.includes(n)) continue;
|
|
29318
|
-
t[n] = r[n];
|
|
29319
|
-
}
|
|
29320
|
-
return t;
|
|
29321
|
-
}
|
|
29322
|
-
//#endregion
|
|
29323
|
-
//#region \0@oxc-project+runtime@0.150.0/helpers/esm/objectWithoutProperties.js
|
|
29324
|
-
function _objectWithoutProperties(e, t) {
|
|
29325
|
-
if (null == e) return {};
|
|
29326
|
-
var o, r, i = _objectWithoutPropertiesLoose(e, t);
|
|
29327
|
-
if (Object.getOwnPropertySymbols) {
|
|
29328
|
-
var s = Object.getOwnPropertySymbols(e);
|
|
29329
|
-
for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
|
|
29330
|
-
}
|
|
29331
|
-
return i;
|
|
29332
|
-
}
|
|
29333
|
-
//#endregion
|
|
29334
29388
|
//#region src/file/table-of-contents/table-of-contents.ts
|
|
29335
29389
|
/**
|
|
29336
29390
|
* Table of Contents module for WordprocessingML documents.
|
|
@@ -36080,9 +36134,6 @@ while (n === a[++i] && n === a[++i] && n === a[++i] && n === a[++i] && n === a[+
|
|
|
36080
36134
|
exports.VerticalMergeType = VerticalMergeType;
|
|
36081
36135
|
exports.VerticalPositionAlign = VerticalPositionAlign;
|
|
36082
36136
|
exports.VerticalPositionRelativeFrom = VerticalPositionRelativeFrom;
|
|
36083
|
-
exports.WORKAROUND2 = WORKAROUND2;
|
|
36084
|
-
exports.WORKAROUND3 = WORKAROUND3;
|
|
36085
|
-
exports.WORKAROUND4 = WORKAROUND4;
|
|
36086
36137
|
exports.WidthType = WidthType;
|
|
36087
36138
|
exports.WpgGroupRun = WpgGroupRun;
|
|
36088
36139
|
exports.WpsShapeRun = WpsShapeRun;
|