@syncfusion/ej2-office-common 35.1.37 → 35.1.42

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 (226) hide show
  1. package/dist/ej2-office-common.umd.min.js +2 -2
  2. package/dist/ej2-office-common.umd.min.js.map +1 -1
  3. package/dist/es6/ej2-office-common.es2015.js +5421 -6017
  4. package/dist/es6/ej2-office-common.es2015.js.map +1 -1
  5. package/dist/es6/ej2-office-common.es5.js +6270 -7203
  6. package/dist/es6/ej2-office-common.es5.js.map +1 -1
  7. package/dist/global/ej2-office-common.min.js +2 -2
  8. package/dist/global/ej2-office-common.min.js.map +1 -1
  9. package/dist/global/index.d.ts +1 -1
  10. package/office-common.js +4 -0
  11. package/package.json +11 -7
  12. package/src/index.d.ts +3 -17
  13. package/src/index.js +3 -18
  14. package/src/office-common/features/index.d.ts +6 -0
  15. package/src/office-common/features/index.js +6 -0
  16. package/src/office-common/features/mathml/index.d.ts +25 -0
  17. package/src/office-common/features/mathml/index.js +22 -0
  18. package/src/office-common/features/mathml/latex/latex-generator.d.ts +8 -0
  19. package/src/office-common/features/mathml/latex/latex-generator.js +357 -0
  20. package/src/office-common/features/mathml/latex/latex-parser.d.ts +87 -0
  21. package/src/office-common/features/mathml/latex/latex-parser.js +1206 -0
  22. package/src/office-common/features/mathml/latex/latex-symbols.d.ts +13 -0
  23. package/src/office-common/features/mathml/latex/latex-symbols.js +681 -0
  24. package/src/office-common/features/mathml/math-settings.d.ts +54 -0
  25. package/src/office-common/features/mathml/math-settings.js +174 -0
  26. package/src/office-common/features/mathml/office-math/adapter.d.ts +59 -0
  27. package/src/office-common/features/mathml/office-math/adapter.js +6 -0
  28. package/src/office-common/features/mathml/office-math/basic.d.ts +91 -0
  29. package/src/office-common/features/mathml/office-math/basic.js +93 -0
  30. package/src/office-common/features/mathml/office-math/break.d.ts +30 -0
  31. package/src/office-common/features/mathml/office-math/break.js +75 -0
  32. package/src/office-common/features/mathml/office-math/collection.d.ts +104 -0
  33. package/src/office-common/features/mathml/office-math/collection.js +170 -0
  34. package/src/office-common/features/mathml/office-math/entity.d.ts +12 -0
  35. package/src/office-common/features/mathml/office-math/entity.js +3 -0
  36. package/src/office-common/features/mathml/office-math/enums.d.ts +97 -0
  37. package/src/office-common/features/mathml/office-math/enums.js +108 -0
  38. package/src/office-common/features/mathml/office-math/format.d.ts +28 -0
  39. package/src/office-common/features/mathml/office-math/format.js +90 -0
  40. package/src/office-common/features/mathml/office-math/function-base.d.ts +27 -0
  41. package/src/office-common/features/mathml/office-math/function-base.js +69 -0
  42. package/src/office-common/features/mathml/office-math/function-collection.d.ts +29 -0
  43. package/src/office-common/features/mathml/office-math/function-collection.js +76 -0
  44. package/src/office-common/features/mathml/office-math/functions-basic.d.ts +118 -0
  45. package/src/office-common/features/mathml/office-math/functions-basic.js +331 -0
  46. package/src/office-common/features/mathml/office-math/functions-multi.d.ts +156 -0
  47. package/src/office-common/features/mathml/office-math/functions-multi.js +407 -0
  48. package/src/office-common/features/mathml/office-math/index.d.ts +27 -0
  49. package/src/office-common/features/mathml/office-math/index.js +25 -0
  50. package/src/office-common/features/mathml/office-math/keys.d.ts +6 -0
  51. package/src/office-common/features/mathml/office-math/keys.js +20 -0
  52. package/src/office-common/features/mathml/office-math/math-clone.d.ts +20 -0
  53. package/src/office-common/features/mathml/office-math/math-clone.js +203 -0
  54. package/src/office-common/features/mathml/office-math/math-collection.d.ts +19 -0
  55. package/src/office-common/features/mathml/office-math/math-collection.js +41 -0
  56. package/src/office-common/features/mathml/office-math/math-equality.d.ts +21 -0
  57. package/src/office-common/features/mathml/office-math/math-equality.js +115 -0
  58. package/src/office-common/features/mathml/office-math/math-paragraph.d.ts +58 -0
  59. package/src/office-common/features/mathml/office-math/math-paragraph.js +126 -0
  60. package/src/office-common/features/mathml/office-math/math-traversal.d.ts +23 -0
  61. package/src/office-common/features/mathml/office-math/math-traversal.js +95 -0
  62. package/src/office-common/features/mathml/office-math/matrix-collections.d.ts +54 -0
  63. package/src/office-common/features/mathml/office-math/matrix-collections.js +113 -0
  64. package/src/office-common/features/mathml/office-math/matrix-column.d.ts +43 -0
  65. package/src/office-common/features/mathml/office-math/matrix-column.js +96 -0
  66. package/src/office-common/features/mathml/office-math/matrix-row.d.ts +38 -0
  67. package/src/office-common/features/mathml/office-math/matrix-row.js +71 -0
  68. package/src/office-common/features/mathml/office-math/matrix.d.ts +62 -0
  69. package/src/office-common/features/mathml/office-math/matrix.js +158 -0
  70. package/src/office-common/features/mathml/office-math/office-math.d.ts +55 -0
  71. package/src/office-common/features/mathml/office-math/office-math.js +116 -0
  72. package/src/office-common/features/mathml/office-math/owner-holder.d.ts +42 -0
  73. package/src/office-common/features/mathml/office-math/owner-holder.js +87 -0
  74. package/src/office-common/features/mathml/office-math/property-store.d.ts +66 -0
  75. package/src/office-common/features/mathml/office-math/property-store.js +99 -0
  76. package/src/office-common/features/mathml/office-math/run-element.d.ts +31 -0
  77. package/src/office-common/features/mathml/office-math/run-element.js +97 -0
  78. package/src/office-common/features/mathml/office-math/unknown-element.d.ts +37 -0
  79. package/src/office-common/features/mathml/office-math/unknown-element.js +62 -0
  80. package/src/office-common/features/mathml/office-math/xml-equal.d.ts +13 -0
  81. package/src/office-common/features/mathml/office-math/xml-equal.js +24 -0
  82. package/src/office-common/features/mathml/parse/office-math-parser.d.ts +24 -0
  83. package/src/office-common/features/mathml/parse/office-math-parser.js +396 -0
  84. package/src/office-common/features/mathml/parse/office-math-properties.d.ts +165 -0
  85. package/src/office-common/features/mathml/parse/office-math-properties.js +432 -0
  86. package/src/office-common/features/mathml/parse/parse-options.d.ts +22 -0
  87. package/src/office-common/features/mathml/parse/parse-options.js +3 -0
  88. package/src/office-common/features/mathml/serialize/office-math-properties-writer.d.ts +38 -0
  89. package/src/office-common/features/mathml/serialize/office-math-properties-writer.js +267 -0
  90. package/src/office-common/features/mathml/serialize/office-math-serializer.d.ts +23 -0
  91. package/src/office-common/features/mathml/serialize/office-math-serializer.js +306 -0
  92. package/src/office-common/features/mathml/serialize/omml-writer.d.ts +123 -0
  93. package/src/office-common/features/mathml/serialize/omml-writer.js +135 -0
  94. package/src/office-common/index.d.ts +10 -0
  95. package/src/office-common/index.js +10 -0
  96. package/.eslintrc.json +0 -263
  97. package/.prettierrc.json +0 -5
  98. package/api-extractor.json +0 -35
  99. package/core.js +0 -4
  100. package/encryption.js +0 -4
  101. package/features.js +0 -4
  102. package/global.json +0 -6
  103. package/nuget.config +0 -7
  104. package/src/all.d.ts +0 -41
  105. package/src/all.js +0 -38
  106. package/src/features/index.d.ts +0 -11
  107. package/src/features/index.js +0 -11
  108. package/src/features/mathml/index.d.ts +0 -30
  109. package/src/features/mathml/index.js +0 -22
  110. package/src/features/mathml/math-factory.d.ts +0 -26
  111. package/src/features/mathml/math-factory.js +0 -568
  112. package/src/features/mathml/model/controls.d.ts +0 -896
  113. package/src/features/mathml/model/controls.js +0 -1541
  114. package/src/features/mathml/model/math-element.d.ts +0 -173
  115. package/src/features/mathml/model/math-element.js +0 -315
  116. package/src/features/mathml/model/roots.d.ts +0 -82
  117. package/src/features/mathml/model/roots.js +0 -177
  118. package/src/features/mathml/parse/math-parser.d.ts +0 -43
  119. package/src/features/mathml/parse/math-parser.js +0 -636
  120. package/src/features/mathml/serialize/math-serializer.d.ts +0 -34
  121. package/src/features/mathml/serialize/math-serializer.js +0 -749
  122. package/tsconfig.build.json +0 -13
  123. package/tsconfig.harness.json +0 -32
  124. package/tslint.json +0 -111
  125. /package/src/{core → office-common/core}/index.d.ts +0 -0
  126. /package/src/{core → office-common/core}/index.js +0 -0
  127. /package/src/{core → office-common/core}/xml/index.d.ts +0 -0
  128. /package/src/{core → office-common/core}/xml/index.js +0 -0
  129. /package/src/{core → office-common/core}/xml/model.d.ts +0 -0
  130. /package/src/{core → office-common/core}/xml/model.js +0 -0
  131. /package/src/{encryption → office-common/encryption}/agile-constants.d.ts +0 -0
  132. /package/src/{encryption → office-common/encryption}/agile-constants.js +0 -0
  133. /package/src/{encryption → office-common/encryption}/agile-encryption-info.d.ts +0 -0
  134. /package/src/{encryption → office-common/encryption}/agile-encryption-info.js +0 -0
  135. /package/src/{encryption → office-common/encryption}/agile-password.d.ts +0 -0
  136. /package/src/{encryption → office-common/encryption}/agile-password.js +0 -0
  137. /package/src/{encryption → office-common/encryption}/cfb-reader.d.ts +0 -0
  138. /package/src/{encryption → office-common/encryption}/cfb-reader.js +0 -0
  139. /package/src/{encryption → office-common/encryption}/crypto-primitives.d.ts +0 -0
  140. /package/src/{encryption → office-common/encryption}/crypto-primitives.js +0 -0
  141. /package/src/{encryption → office-common/encryption}/decrypt-encrypted-package.d.ts +0 -0
  142. /package/src/{encryption → office-common/encryption}/decrypt-encrypted-package.js +0 -0
  143. /package/src/{encryption → office-common/encryption}/encryption-info-xml.d.ts +0 -0
  144. /package/src/{encryption → office-common/encryption}/encryption-info-xml.js +0 -0
  145. /package/src/{encryption → office-common/encryption}/errors.d.ts +0 -0
  146. /package/src/{encryption → office-common/encryption}/errors.js +0 -0
  147. /package/src/{encryption → office-common/encryption}/index.d.ts +0 -0
  148. /package/src/{encryption → office-common/encryption}/index.js +0 -0
  149. /package/src/{features → office-common/features}/diagrams/constants.d.ts +0 -0
  150. /package/src/{features → office-common/features}/diagrams/constants.js +0 -0
  151. /package/src/{features → office-common/features}/diagrams/diagram-data-model.d.ts +0 -0
  152. /package/src/{features → office-common/features}/diagrams/diagram-data-model.js +0 -0
  153. /package/src/{features → office-common/features}/diagrams/diagram-parsers.d.ts +0 -0
  154. /package/src/{features → office-common/features}/diagrams/diagram-parsers.js +0 -0
  155. /package/src/{features → office-common/features}/diagrams/diagram-serializers.d.ts +0 -0
  156. /package/src/{features → office-common/features}/diagrams/diagram-serializers.js +0 -0
  157. /package/src/{features → office-common/features}/diagrams/diagram-views.d.ts +0 -0
  158. /package/src/{features → office-common/features}/diagrams/diagram-views.js +0 -0
  159. /package/src/{features → office-common/features}/diagrams/element-tree.d.ts +0 -0
  160. /package/src/{features → office-common/features}/diagrams/element-tree.js +0 -0
  161. /package/src/{features → office-common/features}/diagrams/errors.d.ts +0 -0
  162. /package/src/{features → office-common/features}/diagrams/errors.js +0 -0
  163. /package/src/{features → office-common/features}/diagrams/index.d.ts +0 -0
  164. /package/src/{features → office-common/features}/diagrams/index.js +0 -0
  165. /package/src/{features → office-common/features}/diagrams/smart-art-catalog.d.ts +0 -0
  166. /package/src/{features → office-common/features}/diagrams/smart-art-catalog.js +0 -0
  167. /package/src/{features → office-common/features}/diagrams/smart-art-diagram.d.ts +0 -0
  168. /package/src/{features → office-common/features}/diagrams/smart-art-diagram.js +0 -0
  169. /package/src/{features → office-common/features}/ink/constants.d.ts +0 -0
  170. /package/src/{features → office-common/features}/ink/constants.js +0 -0
  171. /package/src/{features → office-common/features}/ink/index.d.ts +0 -0
  172. /package/src/{features → office-common/features}/ink/index.js +0 -0
  173. /package/src/{features → office-common/features}/ink/ink-effects.d.ts +0 -0
  174. /package/src/{features → office-common/features}/ink/ink-effects.js +0 -0
  175. /package/src/{features → office-common/features}/ink/ink-model.d.ts +0 -0
  176. /package/src/{features → office-common/features}/ink/ink-model.js +0 -0
  177. /package/src/{features → office-common/features}/ink/ink-parser.d.ts +0 -0
  178. /package/src/{features → office-common/features}/ink/ink-parser.js +0 -0
  179. /package/src/{features → office-common/features}/ink/ink-serializer.d.ts +0 -0
  180. /package/src/{features → office-common/features}/ink/ink-serializer.js +0 -0
  181. /package/src/{features → office-common/features}/ink/ink-units.d.ts +0 -0
  182. /package/src/{features → office-common/features}/ink/ink-units.js +0 -0
  183. /package/src/{features → office-common/features}/ink/ink-xml.d.ts +0 -0
  184. /package/src/{features → office-common/features}/ink/ink-xml.js +0 -0
  185. /package/src/{features → office-common/features}/ink/trace-codec.d.ts +0 -0
  186. /package/src/{features → office-common/features}/ink/trace-codec.js +0 -0
  187. /package/src/{features → office-common/features}/mathml/constants.d.ts +0 -0
  188. /package/src/{features → office-common/features}/mathml/constants.js +0 -0
  189. /package/src/{features → office-common/features}/mathml/errors.d.ts +0 -0
  190. /package/src/{features → office-common/features}/mathml/errors.js +0 -0
  191. /package/src/{features → office-common/features}/mathml/model/enums.d.ts +0 -0
  192. /package/src/{features → office-common/features}/mathml/model/enums.js +0 -0
  193. /package/src/{features → office-common/features}/mathml/openxml.d.ts +0 -0
  194. /package/src/{features → office-common/features}/mathml/openxml.js +0 -0
  195. /package/src/{features → office-common/features}/smart-art/diagram-xml.d.ts +0 -0
  196. /package/src/{features → office-common/features}/smart-art/diagram-xml.js +0 -0
  197. /package/src/{features → office-common/features}/smart-art/errors.d.ts +0 -0
  198. /package/src/{features → office-common/features}/smart-art/errors.js +0 -0
  199. /package/src/{features → office-common/features}/smart-art/index.d.ts +0 -0
  200. /package/src/{features → office-common/features}/smart-art/index.js +0 -0
  201. /package/src/{features → office-common/features}/smart-art/minimal-samples.d.ts +0 -0
  202. /package/src/{features → office-common/features}/smart-art/minimal-samples.js +0 -0
  203. /package/src/{features → office-common/features}/smart-art/mutators.d.ts +0 -0
  204. /package/src/{features → office-common/features}/smart-art/mutators.js +0 -0
  205. /package/src/{features → office-common/features}/smart-art/namespaces.d.ts +0 -0
  206. /package/src/{features → office-common/features}/smart-art/namespaces.js +0 -0
  207. /package/src/{features → office-common/features}/smart-art/package-graph.d.ts +0 -0
  208. /package/src/{features → office-common/features}/smart-art/package-graph.js +0 -0
  209. /package/src/{features → office-common/features}/smart-art/parse-colors.d.ts +0 -0
  210. /package/src/{features → office-common/features}/smart-art/parse-colors.js +0 -0
  211. /package/src/{features → office-common/features}/smart-art/parse-data.d.ts +0 -0
  212. /package/src/{features → office-common/features}/smart-art/parse-data.js +0 -0
  213. /package/src/{features → office-common/features}/smart-art/parse-layout.d.ts +0 -0
  214. /package/src/{features → office-common/features}/smart-art/parse-layout.js +0 -0
  215. /package/src/{features → office-common/features}/smart-art/parse-rel-ids.d.ts +0 -0
  216. /package/src/{features → office-common/features}/smart-art/parse-rel-ids.js +0 -0
  217. /package/src/{features → office-common/features}/smart-art/parse-style.d.ts +0 -0
  218. /package/src/{features → office-common/features}/smart-art/parse-style.js +0 -0
  219. /package/src/{features → office-common/features}/smart-art/point-text.d.ts +0 -0
  220. /package/src/{features → office-common/features}/smart-art/point-text.js +0 -0
  221. /package/src/{features → office-common/features}/smart-art/register.d.ts +0 -0
  222. /package/src/{features → office-common/features}/smart-art/register.js +0 -0
  223. /package/src/{features → office-common/features}/smart-art/serialize.d.ts +0 -0
  224. /package/src/{features → office-common/features}/smart-art/serialize.js +0 -0
  225. /package/src/{features → office-common/features}/smart-art/types.d.ts +0 -0
  226. /package/src/{features → office-common/features}/smart-art/types.js +0 -0
@@ -1,636 +0,0 @@
1
- /**
2
- * Tolerant OMML element-tree → typed Math* DOM parser.
3
- *
4
- * Source: mathml-spec §8; ECMA-376-4 Annex A.8.1.
5
- * Never throws on load. Unknown m:* → UnknownMathElement.
6
- * Malformed required structure → markPreserveOnly + optional diagnostic.
7
- */
8
- var __assign = (this && this.__assign) || function () {
9
- __assign = Object.assign || function(t) {
10
- for (var s, i = 1, n = arguments.length; i < n; i++) {
11
- s = arguments[i];
12
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
13
- t[p] = s[p];
14
- }
15
- return t;
16
- };
17
- return __assign.apply(this, arguments);
18
- };
19
- var __values = (this && this.__values) || function (o) {
20
- var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0;
21
- if (m) return m.call(o);
22
- return {
23
- next: function () {
24
- if (o && i >= o.length) o = void 0;
25
- return { value: o && o[i++], done: !o };
26
- }
27
- };
28
- };
29
- var __read = (this && this.__read) || function (o, n) {
30
- var m = typeof Symbol === "function" && o[Symbol.iterator];
31
- if (!m) return o;
32
- var i = m.call(o), r, ar = [], e;
33
- try {
34
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
35
- }
36
- catch (error) { e = { error: error }; }
37
- finally {
38
- try {
39
- if (r && !r.done && (m = i["return"])) m.call(i);
40
- }
41
- finally { if (e) throw e.error; }
42
- }
43
- return ar;
44
- };
45
- import { MATH_NAMESPACE, WML_TRANSITIONAL_NAMESPACE, XML_NAMESPACE } from '../constants';
46
- import { attrValue, attrValueNs, childElements, textContent } from '../openxml';
47
- import { parseMathFractionType, parseMathJc, parseMathLimLoc, parseMathScript, parseMathShape, parseMathStyle, parseMathTopBot, parseOnOff, isInteger2 } from '../model/enums';
48
- import { MathArgument, MathText, UnknownMathElement } from '../model/math-element';
49
- import { MathOMath, MathParagraph } from '../model/roots';
50
- import { MathAccent, MathBar, MathBorderBox, MathBox, MathDelimiter, MathEquationArray, MathFraction, MathFunction, MathGroupCharacter, MathLimitLower, MathLimitUpper, MathMatrix, MathMatrixRow, MathNaryOperator, MathPhantom, MathPreSubSuperscript, MathRadical, MathRun, MathSubscript, MathSubSuperscript, MathSuperscript } from '../model/controls';
51
- function isMathNs(el) {
52
- return el.namespaceUri === MATH_NAMESPACE;
53
- }
54
- function findChild(parent, localName) {
55
- return childElements(parent).find(function (c) { return isMathNs(c) && c.localName === localName; });
56
- }
57
- function findChildren(parent, localName) {
58
- return childElements(parent).filter(function (c) { return isMathNs(c) && c.localName === localName; });
59
- }
60
- function readVal(el) {
61
- if (!el) {
62
- return undefined;
63
- }
64
- return attrValue(el, 'val');
65
- }
66
- function readOnOffChild(pr, localName) {
67
- if (!pr) {
68
- return undefined;
69
- }
70
- var child = findChild(pr, localName);
71
- if (!child) {
72
- return undefined;
73
- }
74
- // Presence with no val → true (OOXML OnOff default when empty element present).
75
- var v = attrValue(child, 'val');
76
- if (v === undefined) {
77
- return true;
78
- }
79
- return parseOnOff(v);
80
- }
81
- function readStringChild(pr, localName) {
82
- if (!pr) {
83
- return undefined;
84
- }
85
- return readVal(findChild(pr, localName));
86
- }
87
- function parseCtrlPr(pr) {
88
- if (!pr) {
89
- return undefined;
90
- }
91
- return findChild(pr, 'ctrlPr');
92
- }
93
- function degrade(xml, path, message, options, fallback) {
94
- (function () {
95
- var _oc = options == null ? void 0 : options.onDiagnostic;
96
- return _oc == null ? void 0 : _oc({
97
- path: path,
98
- message: message,
99
- localName: xml.localName
100
- });
101
- })();
102
- fallback.markPreserveOnly(xml);
103
- return fallback;
104
- }
105
- function parseArgPr(argPr) {
106
- if (!argPr) {
107
- return {};
108
- }
109
- var argSzEl = findChild(argPr, 'argSz');
110
- var raw = readVal(argSzEl);
111
- if (raw === undefined) {
112
- return {};
113
- }
114
- var n = Number(raw);
115
- if (!Number.isFinite(n) || !isInteger2(n)) {
116
- return {};
117
- }
118
- return {
119
- argSz: n
120
- };
121
- }
122
- /**
123
- * Parse `CT_OMathArg` (`m:e`, `m:num`, `m:den`, `m:sub`, …).
124
- */
125
- function parseArgument(el, options) {
126
- var e_1, _a;
127
- if (!el) {
128
- return new MathArgument();
129
- }
130
- var argPr = findChild(el, 'argPr');
131
- var props = parseArgPr(argPr);
132
- var ctrlPr = findChild(el, 'ctrlPr');
133
- var children = [];
134
- try {
135
- for (var _b = __values(childElements(el)), _c = _b.next(); !_c.done; _c = _b.next()) {
136
- var child = _c.value;
137
- if (!isMathNs(child)) {
138
- continue;
139
- }
140
- if (child.localName === 'argPr' || child.localName === 'ctrlPr') {
141
- continue;
142
- }
143
- children.push(parseOne(child, options));
144
- }
145
- }
146
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
147
- finally {
148
- try {
149
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
150
- }
151
- finally { if (e_1) throw e_1.error; }
152
- }
153
- return new MathArgument(props, children, ctrlPr);
154
- }
155
- function parseManyArgs(parent, localName, options) {
156
- return findChildren(parent, localName).map(function (c) { return parseArgument(c, options); });
157
- }
158
- // ─── Property bag parsers ────────────────────────────────────────────────────
159
- // Bind optionals to locals before spreads so exactOptionalPropertyTypes never
160
- // sees `T | undefined` under a present key.
161
- function parseAccentPr(pr) {
162
- var chr = readStringChild(pr, 'chr');
163
- var ctrlPr = parseCtrlPr(pr);
164
- return __assign({}, (chr !== undefined ? {
165
- chr: chr
166
- } : {}), (ctrlPr !== undefined ? {
167
- ctrlPr: ctrlPr
168
- } : {}));
169
- }
170
- function parseBarPr(pr) {
171
- var posRaw = readStringChild(pr, 'pos');
172
- var pos = posRaw !== undefined ? parseMathTopBot(posRaw) : undefined;
173
- var ctrlPr = parseCtrlPr(pr);
174
- return __assign({}, (pos !== undefined ? {
175
- pos: pos
176
- } : {}), (ctrlPr !== undefined ? {
177
- ctrlPr: ctrlPr
178
- } : {}));
179
- }
180
- function parseBoxPr(pr) {
181
- var isOperatorEmulated = readOnOffChild(pr, 'opEmu');
182
- var isNoBreak = readOnOffChild(pr, 'noBreak');
183
- var isDifferential = readOnOffChild(pr, 'diff');
184
- var isAligned = readOnOffChild(pr, 'aln');
185
- var ctrlPr = parseCtrlPr(pr);
186
- return __assign({}, (isOperatorEmulated !== undefined ? {
187
- isOperatorEmulated: isOperatorEmulated
188
- } : {}), (isNoBreak !== undefined ? {
189
- isNoBreak: isNoBreak
190
- } : {}), (isDifferential !== undefined ? {
191
- isDifferential: isDifferential
192
- } : {}), (isAligned !== undefined ? {
193
- isAligned: isAligned
194
- } : {}), (ctrlPr !== undefined ? {
195
- ctrlPr: ctrlPr
196
- } : {}));
197
- }
198
- /** OMML local name → public boolean property on `MathBorderBoxProperties`. */
199
- var BORDER_BOX_ONOFF = [['hideTop', 'isTopHidden'], ['hideBot', 'isBottomHidden'], ['hideLeft', 'isLeftHidden'], ['hideRight', 'isRightHidden'], ['strikeH', 'hasHorizontalStrike'], ['strikeV', 'hasVerticalStrike'], ['strikeBLTR', 'hasBottomLeftToTopRightStrike'], ['strikeTLBR', 'hasTopLeftToBottomRightStrike']];
200
- function parseBorderBoxPr(pr) {
201
- var e_2, _a;
202
- var out = {};
203
- try {
204
- for (var BORDER_BOX_ONOFF_1 = __values(BORDER_BOX_ONOFF), BORDER_BOX_ONOFF_1_1 = BORDER_BOX_ONOFF_1.next(); !BORDER_BOX_ONOFF_1_1.done; BORDER_BOX_ONOFF_1_1 = BORDER_BOX_ONOFF_1.next()) {
205
- var _b = __read(BORDER_BOX_ONOFF_1_1.value, 2), xmlName = _b[0], apiName = _b[1];
206
- var v = readOnOffChild(pr, xmlName);
207
- if (v !== undefined) {
208
- out[apiName] = v;
209
- }
210
- }
211
- }
212
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
213
- finally {
214
- try {
215
- if (BORDER_BOX_ONOFF_1_1 && !BORDER_BOX_ONOFF_1_1.done && (_a = BORDER_BOX_ONOFF_1.return)) _a.call(BORDER_BOX_ONOFF_1);
216
- }
217
- finally { if (e_2) throw e_2.error; }
218
- }
219
- var ctrl = parseCtrlPr(pr);
220
- if (ctrl !== undefined) {
221
- out.ctrlPr = ctrl;
222
- }
223
- return out;
224
- }
225
- function parseDelimiterPr(pr) {
226
- var begChr = readStringChild(pr, 'begChr');
227
- var sepChr = readStringChild(pr, 'sepChr');
228
- var endChr = readStringChild(pr, 'endChr');
229
- var canGrow = readOnOffChild(pr, 'grow');
230
- var shpRaw = readStringChild(pr, 'shp');
231
- var shp = shpRaw !== undefined ? parseMathShape(shpRaw) : undefined;
232
- var ctrlPr = parseCtrlPr(pr);
233
- return __assign({}, (begChr !== undefined ? {
234
- begChr: begChr
235
- } : {}), (sepChr !== undefined ? {
236
- sepChr: sepChr
237
- } : {}), (endChr !== undefined ? {
238
- endChr: endChr
239
- } : {}), (canGrow !== undefined ? {
240
- canGrow: canGrow
241
- } : {}), (shp !== undefined ? {
242
- shp: shp
243
- } : {}), (ctrlPr !== undefined ? {
244
- ctrlPr: ctrlPr
245
- } : {}));
246
- }
247
- function parseEqArrPr(pr) {
248
- var baseJc = readStringChild(pr, 'baseJc');
249
- var hasMaxDistance = readOnOffChild(pr, 'maxDist');
250
- var hasObjectDistance = readOnOffChild(pr, 'objDist');
251
- var ctrlPr = parseCtrlPr(pr);
252
- return __assign({}, (baseJc !== undefined ? {
253
- baseJc: baseJc
254
- } : {}), (hasMaxDistance !== undefined ? {
255
- hasMaxDistance: hasMaxDistance
256
- } : {}), (hasObjectDistance !== undefined ? {
257
- hasObjectDistance: hasObjectDistance
258
- } : {}), (ctrlPr !== undefined ? {
259
- ctrlPr: ctrlPr
260
- } : {}));
261
- }
262
- function parseFractionPr(pr) {
263
- var typeRaw = readStringChild(pr, 'type');
264
- var type = typeRaw !== undefined ? parseMathFractionType(typeRaw) : undefined;
265
- var ctrlPr = parseCtrlPr(pr);
266
- return __assign({}, (type !== undefined ? {
267
- type: type
268
- } : {}), (ctrlPr !== undefined ? {
269
- ctrlPr: ctrlPr
270
- } : {}));
271
- }
272
- function parseFunctionPr(pr) {
273
- var ctrlPr = parseCtrlPr(pr);
274
- return __assign({}, (ctrlPr !== undefined ? {
275
- ctrlPr: ctrlPr
276
- } : {}));
277
- }
278
- function parseGroupChrPr(pr) {
279
- var chr = readStringChild(pr, 'chr');
280
- var posRaw = readStringChild(pr, 'pos');
281
- var pos = posRaw !== undefined ? parseMathTopBot(posRaw) : undefined;
282
- var vertRaw = readStringChild(pr, 'vertJc');
283
- var vertJc = vertRaw !== undefined ? parseMathTopBot(vertRaw) : undefined;
284
- var ctrlPr = parseCtrlPr(pr);
285
- return __assign({}, (chr !== undefined ? {
286
- chr: chr
287
- } : {}), (pos !== undefined ? {
288
- pos: pos
289
- } : {}), (vertJc !== undefined ? {
290
- vertJc: vertJc
291
- } : {}), (ctrlPr !== undefined ? {
292
- ctrlPr: ctrlPr
293
- } : {}));
294
- }
295
- function parseLimitPr(pr) {
296
- var ctrlPr = parseCtrlPr(pr);
297
- return __assign({}, (ctrlPr !== undefined ? {
298
- ctrlPr: ctrlPr
299
- } : {}));
300
- }
301
- function parseMatrixPr(pr) {
302
- var baseJc = readStringChild(pr, 'baseJc');
303
- var isPlaceholderHidden = readOnOffChild(pr, 'plcHide');
304
- var ctrlPr = parseCtrlPr(pr);
305
- return __assign({}, (baseJc !== undefined ? {
306
- baseJc: baseJc
307
- } : {}), (isPlaceholderHidden !== undefined ? {
308
- isPlaceholderHidden: isPlaceholderHidden
309
- } : {}), (ctrlPr !== undefined ? {
310
- ctrlPr: ctrlPr
311
- } : {}));
312
- }
313
- function parseNaryPr(pr) {
314
- var chr = readStringChild(pr, 'chr');
315
- var limRaw = readStringChild(pr, 'limLoc');
316
- var limLoc = limRaw !== undefined ? parseMathLimLoc(limRaw) : undefined;
317
- var canGrow = readOnOffChild(pr, 'grow');
318
- var isSubscriptHidden = readOnOffChild(pr, 'subHide');
319
- var isSuperscriptHidden = readOnOffChild(pr, 'supHide');
320
- var ctrlPr = parseCtrlPr(pr);
321
- return __assign({}, (chr !== undefined ? {
322
- chr: chr
323
- } : {}), (limLoc !== undefined ? {
324
- limLoc: limLoc
325
- } : {}), (canGrow !== undefined ? {
326
- canGrow: canGrow
327
- } : {}), (isSubscriptHidden !== undefined ? {
328
- isSubscriptHidden: isSubscriptHidden
329
- } : {}), (isSuperscriptHidden !== undefined ? {
330
- isSuperscriptHidden: isSuperscriptHidden
331
- } : {}), (ctrlPr !== undefined ? {
332
- ctrlPr: ctrlPr
333
- } : {}));
334
- }
335
- function parsePhantPr(pr) {
336
- var isShown = readOnOffChild(pr, 'show');
337
- var isZeroWidth = readOnOffChild(pr, 'zeroWid');
338
- var isZeroAscender = readOnOffChild(pr, 'zeroAsc');
339
- var isZeroDescender = readOnOffChild(pr, 'zeroDesc');
340
- var isTransparent = readOnOffChild(pr, 'transp');
341
- var ctrlPr = parseCtrlPr(pr);
342
- return __assign({}, (isShown !== undefined ? {
343
- isShown: isShown
344
- } : {}), (isZeroWidth !== undefined ? {
345
- isZeroWidth: isZeroWidth
346
- } : {}), (isZeroAscender !== undefined ? {
347
- isZeroAscender: isZeroAscender
348
- } : {}), (isZeroDescender !== undefined ? {
349
- isZeroDescender: isZeroDescender
350
- } : {}), (isTransparent !== undefined ? {
351
- isTransparent: isTransparent
352
- } : {}), (ctrlPr !== undefined ? {
353
- ctrlPr: ctrlPr
354
- } : {}));
355
- }
356
- function parseRadPr(pr) {
357
- var isDegreeHidden = readOnOffChild(pr, 'degHide');
358
- var ctrlPr = parseCtrlPr(pr);
359
- return __assign({}, (isDegreeHidden !== undefined ? {
360
- isDegreeHidden: isDegreeHidden
361
- } : {}), (ctrlPr !== undefined ? {
362
- ctrlPr: ctrlPr
363
- } : {}));
364
- }
365
- function parseScriptPr(pr) {
366
- var isScriptAligned = readOnOffChild(pr, 'alnScr');
367
- var ctrlPr = parseCtrlPr(pr);
368
- return __assign({}, (isScriptAligned !== undefined ? {
369
- isScriptAligned: isScriptAligned
370
- } : {}), (ctrlPr !== undefined ? {
371
- ctrlPr: ctrlPr
372
- } : {}));
373
- }
374
- function parseRunPr(pr) {
375
- if (!pr) {
376
- return {};
377
- }
378
- var isLiteral = readOnOffChild(pr, 'lit');
379
- var isNormal = readOnOffChild(pr, 'nor');
380
- var scrRaw = readStringChild(pr, 'scr');
381
- var styRaw = readStringChild(pr, 'sty');
382
- var scr = scrRaw !== undefined ? parseMathScript(scrRaw) : undefined;
383
- var sty = styRaw !== undefined ? parseMathStyle(styRaw) : undefined;
384
- var isAligned = readOnOffChild(pr, 'aln');
385
- var brkRaw = readStringChild(pr, 'brk');
386
- var brkNum = brkRaw !== undefined ? Number(brkRaw) : undefined;
387
- var brk = brkNum !== undefined && Number.isFinite(brkNum) ? brkNum : undefined;
388
- return __assign({}, (isLiteral !== undefined ? {
389
- isLiteral: isLiteral
390
- } : {}), (isNormal !== undefined ? {
391
- isNormal: isNormal
392
- } : {}), (scr !== undefined ? {
393
- scr: scr
394
- } : {}), (sty !== undefined ? {
395
- sty: sty
396
- } : {}), (isAligned !== undefined ? {
397
- isAligned: isAligned
398
- } : {}), (brk !== undefined ? {
399
- brk: brk
400
- } : {}));
401
- }
402
- // ─── Element dispatch ────────────────────────────────────────────────────────
403
- function parseText(el) {
404
- var space = attrValueNs(el, XML_NAMESPACE, 'space');
405
- var xmlSpace = space === 'preserve' || space === 'default' ? space : undefined;
406
- return new MathText(textContent(el), xmlSpace);
407
- }
408
- function parseRun(el, options) {
409
- var e_3, _a;
410
- var rPr = findChild(el, 'rPr');
411
- var props = parseRunPr(rPr);
412
- var wRPr;
413
- var children = [];
414
- var opaque = [];
415
- try {
416
- for (var _b = __values(childElements(el)), _c = _b.next(); !_c.done; _c = _b.next()) {
417
- var child = _c.value;
418
- if (isMathNs(child) && child.localName === 'rPr') {
419
- continue;
420
- }
421
- if (child.namespaceUri === WML_TRANSITIONAL_NAMESPACE && child.localName === 'rPr') {
422
- wRPr = child;
423
- continue;
424
- }
425
- if (isMathNs(child) && child.localName === 't') {
426
- children.push(parseText(child));
427
- continue;
428
- }
429
- if (isMathNs(child)) {
430
- children.push(parseOne(child, options));
431
- continue;
432
- }
433
- // Non-math run content — preserve opaque.
434
- opaque.push(child);
435
- }
436
- }
437
- catch (e_3_1) { e_3 = { error: e_3_1 }; }
438
- finally {
439
- try {
440
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
441
- }
442
- finally { if (e_3) throw e_3.error; }
443
- }
444
- return new MathRun(children, props, wRPr, opaque);
445
- }
446
- function parseMatrixRow(el, options) {
447
- return new MathMatrixRow(parseManyArgs(el, 'e', options));
448
- }
449
- function parseOne(el, options) {
450
- if (!isMathNs(el)) {
451
- return new UnknownMathElement(el.localName, el);
452
- }
453
- switch (el.localName) {
454
- case 'oMathPara':
455
- return parseOMathPara(el, options);
456
- case 'oMath':
457
- return parseOMath(el, options);
458
- case 't':
459
- return parseText(el);
460
- case 'r':
461
- return parseRun(el, options);
462
- case 'acc':
463
- {
464
- var pr = findChild(el, 'accPr');
465
- return new MathAccent(parseAccentPr(pr), parseArgument(findChild(el, 'e'), options));
466
- }
467
- case 'bar':
468
- {
469
- var pr = findChild(el, 'barPr');
470
- return new MathBar(parseBarPr(pr), parseArgument(findChild(el, 'e'), options));
471
- }
472
- case 'box':
473
- {
474
- var pr = findChild(el, 'boxPr');
475
- return new MathBox(parseBoxPr(pr), parseArgument(findChild(el, 'e'), options));
476
- }
477
- case 'borderBox':
478
- {
479
- var pr = findChild(el, 'borderBoxPr');
480
- return new MathBorderBox(parseBorderBoxPr(pr), parseArgument(findChild(el, 'e'), options));
481
- }
482
- case 'd':
483
- {
484
- var pr = findChild(el, 'dPr');
485
- var elements = parseManyArgs(el, 'e', options);
486
- if (elements.length < 1) {
487
- return degrade(el, 'd', 'm:d missing required m:e', options, new MathDelimiter(parseDelimiterPr(pr), []));
488
- }
489
- return new MathDelimiter(parseDelimiterPr(pr), elements);
490
- }
491
- case 'eqArr':
492
- {
493
- var pr = findChild(el, 'eqArrPr');
494
- var elements = parseManyArgs(el, 'e', options);
495
- if (elements.length < 1) {
496
- return degrade(el, 'eqArr', 'm:eqArr missing required m:e', options, new MathEquationArray(parseEqArrPr(pr), []));
497
- }
498
- return new MathEquationArray(parseEqArrPr(pr), elements);
499
- }
500
- case 'f':
501
- {
502
- var pr = findChild(el, 'fPr');
503
- var num = findChild(el, 'num');
504
- var den = findChild(el, 'den');
505
- if (!num || !den) {
506
- return degrade(el, 'f', 'm:f missing required m:num and/or m:den', options, new MathFraction(parseFractionPr(pr), parseArgument(num, options), parseArgument(den, options)));
507
- }
508
- return new MathFraction(parseFractionPr(pr), parseArgument(num, options), parseArgument(den, options));
509
- }
510
- case 'func':
511
- {
512
- var pr = findChild(el, 'funcPr');
513
- return new MathFunction(parseFunctionPr(pr), parseArgument(findChild(el, 'fName'), options), parseArgument(findChild(el, 'e'), options));
514
- }
515
- case 'groupChr':
516
- {
517
- var pr = findChild(el, 'groupChrPr');
518
- return new MathGroupCharacter(parseGroupChrPr(pr), parseArgument(findChild(el, 'e'), options));
519
- }
520
- case 'limLow':
521
- {
522
- var pr = findChild(el, 'limLowPr');
523
- return new MathLimitLower(parseLimitPr(pr), parseArgument(findChild(el, 'e'), options), parseArgument(findChild(el, 'lim'), options));
524
- }
525
- case 'limUpp':
526
- {
527
- var pr = findChild(el, 'limUppPr');
528
- return new MathLimitUpper(parseLimitPr(pr), parseArgument(findChild(el, 'e'), options), parseArgument(findChild(el, 'lim'), options));
529
- }
530
- case 'm':
531
- {
532
- var pr = findChild(el, 'mPr');
533
- var rows = findChildren(el, 'mr').map(function (r) { return parseMatrixRow(r, options); });
534
- if (rows.length < 1) {
535
- return degrade(el, 'm', 'm:m missing required m:mr', options, new MathMatrix(parseMatrixPr(pr), []));
536
- }
537
- return new MathMatrix(parseMatrixPr(pr), rows);
538
- }
539
- case 'mr':
540
- return parseMatrixRow(el, options);
541
- case 'nary':
542
- {
543
- var pr = findChild(el, 'naryPr');
544
- // CT_Nary order: naryPr?, sub, sup, e
545
- return new MathNaryOperator(parseNaryPr(pr), parseArgument(findChild(el, 'sub'), options), parseArgument(findChild(el, 'sup'), options), parseArgument(findChild(el, 'e'), options));
546
- }
547
- case 'phant':
548
- {
549
- var pr = findChild(el, 'phantPr');
550
- return new MathPhantom(parsePhantPr(pr), parseArgument(findChild(el, 'e'), options));
551
- }
552
- case 'rad':
553
- {
554
- var pr = findChild(el, 'radPr');
555
- return new MathRadical(parseRadPr(pr), parseArgument(findChild(el, 'deg'), options), parseArgument(findChild(el, 'e'), options));
556
- }
557
- case 'sPre':
558
- {
559
- var pr = findChild(el, 'sPrePr');
560
- // CT_SPre: sPrePr?, sub, sup, e
561
- return new MathPreSubSuperscript(parseScriptPr(pr), parseArgument(findChild(el, 'sub'), options), parseArgument(findChild(el, 'sup'), options), parseArgument(findChild(el, 'e'), options));
562
- }
563
- case 'sSub':
564
- {
565
- var pr = findChild(el, 'sSubPr');
566
- return new MathSubscript(parseScriptPr(pr), parseArgument(findChild(el, 'e'), options), parseArgument(findChild(el, 'sub'), options));
567
- }
568
- case 'sSubSup':
569
- {
570
- var pr = findChild(el, 'sSubSupPr');
571
- return new MathSubSuperscript(parseScriptPr(pr), parseArgument(findChild(el, 'e'), options), parseArgument(findChild(el, 'sub'), options), parseArgument(findChild(el, 'sup'), options));
572
- }
573
- case 'sSup':
574
- {
575
- var pr = findChild(el, 'sSupPr');
576
- return new MathSuperscript(parseScriptPr(pr), parseArgument(findChild(el, 'e'), options), parseArgument(findChild(el, 'sup'), options));
577
- }
578
- default:
579
- return new UnknownMathElement(el.localName, el);
580
- }
581
- }
582
- function parseOMath(el, options) {
583
- var e_4, _a;
584
- var children = [];
585
- try {
586
- for (var _b = __values(childElements(el)), _c = _b.next(); !_c.done; _c = _b.next()) {
587
- var child = _c.value;
588
- if (!isMathNs(child)) {
589
- // Non-math under oMath — wrap unknown.
590
- children.push(new UnknownMathElement(child.localName, child));
591
- continue;
592
- }
593
- children.push(parseOne(child, options));
594
- }
595
- }
596
- catch (e_4_1) { e_4 = { error: e_4_1 }; }
597
- finally {
598
- try {
599
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
600
- }
601
- finally { if (e_4) throw e_4.error; }
602
- }
603
- return new MathOMath(children);
604
- }
605
- function parseOMathPara(el, options) {
606
- var pr = findChild(el, 'oMathParaPr');
607
- var jcRaw = pr ? readStringChild(pr, 'jc') : undefined;
608
- var jc = jcRaw !== undefined ? parseMathJc(jcRaw) : undefined;
609
- var props = __assign({}, (jc !== undefined ? {
610
- jc: jc
611
- } : {}));
612
- var equations = findChildren(el, 'oMath').map(function (o) { return parseOMath(o, options); });
613
- if (equations.length < 1) {
614
- return degrade(el, 'oMathPara', 'm:oMathPara missing required m:oMath', options, new MathParagraph(props, []));
615
- }
616
- return new MathParagraph(props, equations);
617
- }
618
- /**
619
- * Parse a single OMML root element (`m:oMathPara`, `m:oMath`, or any EG_OMathElements member)
620
- * into a typed {@link MathElement}.
621
- *
622
- * Tolerant: never throws. Unknown / malformed nodes degrade rather than abort.
623
- *
624
- * @public
625
- */
626
- export function parseMathElement(root, options) {
627
- return parseOne(root, options);
628
- }
629
- /**
630
- * Parse zero or more sibling math roots (e.g. multiple `m:oMath` under a paragraph host).
631
- *
632
- * @public
633
- */
634
- export function parseMathElements(roots, options) {
635
- return roots.map(function (r) { return parseMathElement(r, options); });
636
- }
@@ -1,34 +0,0 @@
1
- /**
2
- * Strict typed Math* DOM → OMML OpenXml element-tree serializer.
3
- *
4
- * Source: mathml-spec §9; ECMA-376-4 Annex A.8.1.
5
- * Throws {@link MathmlValidationError} on schema violations (typed path).
6
- * Preserve-only / unknown nodes re-emit `preservedXml` verbatim.
7
- */
8
- import { OpenXmlElement } from '../openxml';
9
- import { MathElement } from '../model/math-element';
10
- /**
11
- * Serializer options (mathml-spec §9.3 prefix registry).
12
- *
13
- * @public
14
- */
15
- export interface SerializeMathOptions {
16
- /**
17
- * Target math prefix. Defaults to first {@link MATH_PREFIX_FALLBACKS} entry (`m`).
18
- * Host may pass an alternate when `m` collides in the save-scoped registry.
19
- */
20
- readonly prefix?: string;
21
- /**
22
- * Prefixes already claimed in the outer document. When `prefix` is omitted
23
- * and `m` is claimed, falls back through `m1`, `m2`, …
24
- */
25
- readonly reservedPrefixes?: ReadonlyArray<string>;
26
- }
27
- /**
28
- * Serialize a typed math node to an OpenXml element tree.
29
- *
30
- * Source: mathml-spec §9 — strict schema order; preserve-only re-emits XML.
31
- *
32
- * @public
33
- */
34
- export declare function mathElementToOpenXml(node: MathElement, options?: SerializeMathOptions): OpenXmlElement;