@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.
- package/dist/ej2-office-common.umd.min.js +2 -2
- package/dist/ej2-office-common.umd.min.js.map +1 -1
- package/dist/es6/ej2-office-common.es2015.js +5421 -6017
- package/dist/es6/ej2-office-common.es2015.js.map +1 -1
- package/dist/es6/ej2-office-common.es5.js +6270 -7203
- package/dist/es6/ej2-office-common.es5.js.map +1 -1
- package/dist/global/ej2-office-common.min.js +2 -2
- package/dist/global/ej2-office-common.min.js.map +1 -1
- package/dist/global/index.d.ts +1 -1
- package/office-common.js +4 -0
- package/package.json +11 -7
- package/src/index.d.ts +3 -17
- package/src/index.js +3 -18
- package/src/office-common/features/index.d.ts +6 -0
- package/src/office-common/features/index.js +6 -0
- package/src/office-common/features/mathml/index.d.ts +25 -0
- package/src/office-common/features/mathml/index.js +22 -0
- package/src/office-common/features/mathml/latex/latex-generator.d.ts +8 -0
- package/src/office-common/features/mathml/latex/latex-generator.js +357 -0
- package/src/office-common/features/mathml/latex/latex-parser.d.ts +87 -0
- package/src/office-common/features/mathml/latex/latex-parser.js +1206 -0
- package/src/office-common/features/mathml/latex/latex-symbols.d.ts +13 -0
- package/src/office-common/features/mathml/latex/latex-symbols.js +681 -0
- package/src/office-common/features/mathml/math-settings.d.ts +54 -0
- package/src/office-common/features/mathml/math-settings.js +174 -0
- package/src/office-common/features/mathml/office-math/adapter.d.ts +59 -0
- package/src/office-common/features/mathml/office-math/adapter.js +6 -0
- package/src/office-common/features/mathml/office-math/basic.d.ts +91 -0
- package/src/office-common/features/mathml/office-math/basic.js +93 -0
- package/src/office-common/features/mathml/office-math/break.d.ts +30 -0
- package/src/office-common/features/mathml/office-math/break.js +75 -0
- package/src/office-common/features/mathml/office-math/collection.d.ts +104 -0
- package/src/office-common/features/mathml/office-math/collection.js +170 -0
- package/src/office-common/features/mathml/office-math/entity.d.ts +12 -0
- package/src/office-common/features/mathml/office-math/entity.js +3 -0
- package/src/office-common/features/mathml/office-math/enums.d.ts +97 -0
- package/src/office-common/features/mathml/office-math/enums.js +108 -0
- package/src/office-common/features/mathml/office-math/format.d.ts +28 -0
- package/src/office-common/features/mathml/office-math/format.js +90 -0
- package/src/office-common/features/mathml/office-math/function-base.d.ts +27 -0
- package/src/office-common/features/mathml/office-math/function-base.js +69 -0
- package/src/office-common/features/mathml/office-math/function-collection.d.ts +29 -0
- package/src/office-common/features/mathml/office-math/function-collection.js +76 -0
- package/src/office-common/features/mathml/office-math/functions-basic.d.ts +118 -0
- package/src/office-common/features/mathml/office-math/functions-basic.js +331 -0
- package/src/office-common/features/mathml/office-math/functions-multi.d.ts +156 -0
- package/src/office-common/features/mathml/office-math/functions-multi.js +407 -0
- package/src/office-common/features/mathml/office-math/index.d.ts +27 -0
- package/src/office-common/features/mathml/office-math/index.js +25 -0
- package/src/office-common/features/mathml/office-math/keys.d.ts +6 -0
- package/src/office-common/features/mathml/office-math/keys.js +20 -0
- package/src/office-common/features/mathml/office-math/math-clone.d.ts +20 -0
- package/src/office-common/features/mathml/office-math/math-clone.js +203 -0
- package/src/office-common/features/mathml/office-math/math-collection.d.ts +19 -0
- package/src/office-common/features/mathml/office-math/math-collection.js +41 -0
- package/src/office-common/features/mathml/office-math/math-equality.d.ts +21 -0
- package/src/office-common/features/mathml/office-math/math-equality.js +115 -0
- package/src/office-common/features/mathml/office-math/math-paragraph.d.ts +58 -0
- package/src/office-common/features/mathml/office-math/math-paragraph.js +126 -0
- package/src/office-common/features/mathml/office-math/math-traversal.d.ts +23 -0
- package/src/office-common/features/mathml/office-math/math-traversal.js +95 -0
- package/src/office-common/features/mathml/office-math/matrix-collections.d.ts +54 -0
- package/src/office-common/features/mathml/office-math/matrix-collections.js +113 -0
- package/src/office-common/features/mathml/office-math/matrix-column.d.ts +43 -0
- package/src/office-common/features/mathml/office-math/matrix-column.js +96 -0
- package/src/office-common/features/mathml/office-math/matrix-row.d.ts +38 -0
- package/src/office-common/features/mathml/office-math/matrix-row.js +71 -0
- package/src/office-common/features/mathml/office-math/matrix.d.ts +62 -0
- package/src/office-common/features/mathml/office-math/matrix.js +158 -0
- package/src/office-common/features/mathml/office-math/office-math.d.ts +55 -0
- package/src/office-common/features/mathml/office-math/office-math.js +116 -0
- package/src/office-common/features/mathml/office-math/owner-holder.d.ts +42 -0
- package/src/office-common/features/mathml/office-math/owner-holder.js +87 -0
- package/src/office-common/features/mathml/office-math/property-store.d.ts +66 -0
- package/src/office-common/features/mathml/office-math/property-store.js +99 -0
- package/src/office-common/features/mathml/office-math/run-element.d.ts +31 -0
- package/src/office-common/features/mathml/office-math/run-element.js +97 -0
- package/src/office-common/features/mathml/office-math/unknown-element.d.ts +37 -0
- package/src/office-common/features/mathml/office-math/unknown-element.js +62 -0
- package/src/office-common/features/mathml/office-math/xml-equal.d.ts +13 -0
- package/src/office-common/features/mathml/office-math/xml-equal.js +24 -0
- package/src/office-common/features/mathml/parse/office-math-parser.d.ts +24 -0
- package/src/office-common/features/mathml/parse/office-math-parser.js +396 -0
- package/src/office-common/features/mathml/parse/office-math-properties.d.ts +165 -0
- package/src/office-common/features/mathml/parse/office-math-properties.js +432 -0
- package/src/office-common/features/mathml/parse/parse-options.d.ts +22 -0
- package/src/office-common/features/mathml/parse/parse-options.js +3 -0
- package/src/office-common/features/mathml/serialize/office-math-properties-writer.d.ts +38 -0
- package/src/office-common/features/mathml/serialize/office-math-properties-writer.js +267 -0
- package/src/office-common/features/mathml/serialize/office-math-serializer.d.ts +23 -0
- package/src/office-common/features/mathml/serialize/office-math-serializer.js +306 -0
- package/src/office-common/features/mathml/serialize/omml-writer.d.ts +123 -0
- package/src/office-common/features/mathml/serialize/omml-writer.js +135 -0
- package/src/office-common/index.d.ts +10 -0
- package/src/office-common/index.js +10 -0
- package/.eslintrc.json +0 -263
- package/.prettierrc.json +0 -5
- package/api-extractor.json +0 -35
- package/core.js +0 -4
- package/encryption.js +0 -4
- package/features.js +0 -4
- package/global.json +0 -6
- package/nuget.config +0 -7
- package/src/all.d.ts +0 -41
- package/src/all.js +0 -38
- package/src/features/index.d.ts +0 -11
- package/src/features/index.js +0 -11
- package/src/features/mathml/index.d.ts +0 -30
- package/src/features/mathml/index.js +0 -22
- package/src/features/mathml/math-factory.d.ts +0 -26
- package/src/features/mathml/math-factory.js +0 -568
- package/src/features/mathml/model/controls.d.ts +0 -896
- package/src/features/mathml/model/controls.js +0 -1541
- package/src/features/mathml/model/math-element.d.ts +0 -173
- package/src/features/mathml/model/math-element.js +0 -315
- package/src/features/mathml/model/roots.d.ts +0 -82
- package/src/features/mathml/model/roots.js +0 -177
- package/src/features/mathml/parse/math-parser.d.ts +0 -43
- package/src/features/mathml/parse/math-parser.js +0 -636
- package/src/features/mathml/serialize/math-serializer.d.ts +0 -34
- package/src/features/mathml/serialize/math-serializer.js +0 -749
- package/tsconfig.build.json +0 -13
- package/tsconfig.harness.json +0 -32
- package/tslint.json +0 -111
- /package/src/{core → office-common/core}/index.d.ts +0 -0
- /package/src/{core → office-common/core}/index.js +0 -0
- /package/src/{core → office-common/core}/xml/index.d.ts +0 -0
- /package/src/{core → office-common/core}/xml/index.js +0 -0
- /package/src/{core → office-common/core}/xml/model.d.ts +0 -0
- /package/src/{core → office-common/core}/xml/model.js +0 -0
- /package/src/{encryption → office-common/encryption}/agile-constants.d.ts +0 -0
- /package/src/{encryption → office-common/encryption}/agile-constants.js +0 -0
- /package/src/{encryption → office-common/encryption}/agile-encryption-info.d.ts +0 -0
- /package/src/{encryption → office-common/encryption}/agile-encryption-info.js +0 -0
- /package/src/{encryption → office-common/encryption}/agile-password.d.ts +0 -0
- /package/src/{encryption → office-common/encryption}/agile-password.js +0 -0
- /package/src/{encryption → office-common/encryption}/cfb-reader.d.ts +0 -0
- /package/src/{encryption → office-common/encryption}/cfb-reader.js +0 -0
- /package/src/{encryption → office-common/encryption}/crypto-primitives.d.ts +0 -0
- /package/src/{encryption → office-common/encryption}/crypto-primitives.js +0 -0
- /package/src/{encryption → office-common/encryption}/decrypt-encrypted-package.d.ts +0 -0
- /package/src/{encryption → office-common/encryption}/decrypt-encrypted-package.js +0 -0
- /package/src/{encryption → office-common/encryption}/encryption-info-xml.d.ts +0 -0
- /package/src/{encryption → office-common/encryption}/encryption-info-xml.js +0 -0
- /package/src/{encryption → office-common/encryption}/errors.d.ts +0 -0
- /package/src/{encryption → office-common/encryption}/errors.js +0 -0
- /package/src/{encryption → office-common/encryption}/index.d.ts +0 -0
- /package/src/{encryption → office-common/encryption}/index.js +0 -0
- /package/src/{features → office-common/features}/diagrams/constants.d.ts +0 -0
- /package/src/{features → office-common/features}/diagrams/constants.js +0 -0
- /package/src/{features → office-common/features}/diagrams/diagram-data-model.d.ts +0 -0
- /package/src/{features → office-common/features}/diagrams/diagram-data-model.js +0 -0
- /package/src/{features → office-common/features}/diagrams/diagram-parsers.d.ts +0 -0
- /package/src/{features → office-common/features}/diagrams/diagram-parsers.js +0 -0
- /package/src/{features → office-common/features}/diagrams/diagram-serializers.d.ts +0 -0
- /package/src/{features → office-common/features}/diagrams/diagram-serializers.js +0 -0
- /package/src/{features → office-common/features}/diagrams/diagram-views.d.ts +0 -0
- /package/src/{features → office-common/features}/diagrams/diagram-views.js +0 -0
- /package/src/{features → office-common/features}/diagrams/element-tree.d.ts +0 -0
- /package/src/{features → office-common/features}/diagrams/element-tree.js +0 -0
- /package/src/{features → office-common/features}/diagrams/errors.d.ts +0 -0
- /package/src/{features → office-common/features}/diagrams/errors.js +0 -0
- /package/src/{features → office-common/features}/diagrams/index.d.ts +0 -0
- /package/src/{features → office-common/features}/diagrams/index.js +0 -0
- /package/src/{features → office-common/features}/diagrams/smart-art-catalog.d.ts +0 -0
- /package/src/{features → office-common/features}/diagrams/smart-art-catalog.js +0 -0
- /package/src/{features → office-common/features}/diagrams/smart-art-diagram.d.ts +0 -0
- /package/src/{features → office-common/features}/diagrams/smart-art-diagram.js +0 -0
- /package/src/{features → office-common/features}/ink/constants.d.ts +0 -0
- /package/src/{features → office-common/features}/ink/constants.js +0 -0
- /package/src/{features → office-common/features}/ink/index.d.ts +0 -0
- /package/src/{features → office-common/features}/ink/index.js +0 -0
- /package/src/{features → office-common/features}/ink/ink-effects.d.ts +0 -0
- /package/src/{features → office-common/features}/ink/ink-effects.js +0 -0
- /package/src/{features → office-common/features}/ink/ink-model.d.ts +0 -0
- /package/src/{features → office-common/features}/ink/ink-model.js +0 -0
- /package/src/{features → office-common/features}/ink/ink-parser.d.ts +0 -0
- /package/src/{features → office-common/features}/ink/ink-parser.js +0 -0
- /package/src/{features → office-common/features}/ink/ink-serializer.d.ts +0 -0
- /package/src/{features → office-common/features}/ink/ink-serializer.js +0 -0
- /package/src/{features → office-common/features}/ink/ink-units.d.ts +0 -0
- /package/src/{features → office-common/features}/ink/ink-units.js +0 -0
- /package/src/{features → office-common/features}/ink/ink-xml.d.ts +0 -0
- /package/src/{features → office-common/features}/ink/ink-xml.js +0 -0
- /package/src/{features → office-common/features}/ink/trace-codec.d.ts +0 -0
- /package/src/{features → office-common/features}/ink/trace-codec.js +0 -0
- /package/src/{features → office-common/features}/mathml/constants.d.ts +0 -0
- /package/src/{features → office-common/features}/mathml/constants.js +0 -0
- /package/src/{features → office-common/features}/mathml/errors.d.ts +0 -0
- /package/src/{features → office-common/features}/mathml/errors.js +0 -0
- /package/src/{features → office-common/features}/mathml/model/enums.d.ts +0 -0
- /package/src/{features → office-common/features}/mathml/model/enums.js +0 -0
- /package/src/{features → office-common/features}/mathml/openxml.d.ts +0 -0
- /package/src/{features → office-common/features}/mathml/openxml.js +0 -0
- /package/src/{features → office-common/features}/smart-art/diagram-xml.d.ts +0 -0
- /package/src/{features → office-common/features}/smart-art/diagram-xml.js +0 -0
- /package/src/{features → office-common/features}/smart-art/errors.d.ts +0 -0
- /package/src/{features → office-common/features}/smart-art/errors.js +0 -0
- /package/src/{features → office-common/features}/smart-art/index.d.ts +0 -0
- /package/src/{features → office-common/features}/smart-art/index.js +0 -0
- /package/src/{features → office-common/features}/smart-art/minimal-samples.d.ts +0 -0
- /package/src/{features → office-common/features}/smart-art/minimal-samples.js +0 -0
- /package/src/{features → office-common/features}/smart-art/mutators.d.ts +0 -0
- /package/src/{features → office-common/features}/smart-art/mutators.js +0 -0
- /package/src/{features → office-common/features}/smart-art/namespaces.d.ts +0 -0
- /package/src/{features → office-common/features}/smart-art/namespaces.js +0 -0
- /package/src/{features → office-common/features}/smart-art/package-graph.d.ts +0 -0
- /package/src/{features → office-common/features}/smart-art/package-graph.js +0 -0
- /package/src/{features → office-common/features}/smart-art/parse-colors.d.ts +0 -0
- /package/src/{features → office-common/features}/smart-art/parse-colors.js +0 -0
- /package/src/{features → office-common/features}/smart-art/parse-data.d.ts +0 -0
- /package/src/{features → office-common/features}/smart-art/parse-data.js +0 -0
- /package/src/{features → office-common/features}/smart-art/parse-layout.d.ts +0 -0
- /package/src/{features → office-common/features}/smart-art/parse-layout.js +0 -0
- /package/src/{features → office-common/features}/smart-art/parse-rel-ids.d.ts +0 -0
- /package/src/{features → office-common/features}/smart-art/parse-rel-ids.js +0 -0
- /package/src/{features → office-common/features}/smart-art/parse-style.d.ts +0 -0
- /package/src/{features → office-common/features}/smart-art/parse-style.js +0 -0
- /package/src/{features → office-common/features}/smart-art/point-text.d.ts +0 -0
- /package/src/{features → office-common/features}/smart-art/point-text.js +0 -0
- /package/src/{features → office-common/features}/smart-art/register.d.ts +0 -0
- /package/src/{features → office-common/features}/smart-art/register.js +0 -0
- /package/src/{features → office-common/features}/smart-art/serialize.d.ts +0 -0
- /package/src/{features → office-common/features}/smart-art/serialize.js +0 -0
- /package/src/{features → office-common/features}/smart-art/types.d.ts +0 -0
- /package/src/{features → office-common/features}/smart-art/types.js +0 -0
package/dist/global/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* filename: index.d.ts
|
|
3
|
-
* version : 35.1.
|
|
3
|
+
* version : 35.1.42
|
|
4
4
|
* Copyright Syncfusion Inc. 2001 - 2025. All rights reserved.
|
|
5
5
|
* Use of this code is subject to the terms of our license.
|
|
6
6
|
* A copy of the current license can be obtained at any time by e-mailing
|
package/office-common.js
ADDED
package/package.json
CHANGED
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@syncfusion/ej2-office-common",
|
|
3
|
-
"version": "35.1.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "35.1.42",
|
|
4
|
+
"description": "The EJ2 Office Common library provides shared OOXML codecs and domain models used across EJ2 Office JavaScript libraries.",
|
|
5
5
|
"author": "Syncfusion Inc.",
|
|
6
6
|
"license": "SEE LICENSE IN license",
|
|
7
|
-
"
|
|
8
|
-
"main": "./dist/ej2-office-common.umd.min.js",
|
|
7
|
+
"main": "./src/index.js",
|
|
9
8
|
"module": "./index.js",
|
|
10
|
-
"es2015": "./
|
|
11
|
-
"typings": "index.d.ts",
|
|
9
|
+
"es2015": "./src/index.js",
|
|
10
|
+
"typings": "src/index.d.ts",
|
|
11
|
+
"devDependencies": {},
|
|
12
12
|
"keywords": [
|
|
13
13
|
"ej2",
|
|
14
14
|
"syncfusion",
|
|
15
|
-
"office-common"
|
|
15
|
+
"ej2-office-common",
|
|
16
|
+
"javascript",
|
|
17
|
+
"typescript",
|
|
18
|
+
"ooxml",
|
|
19
|
+
"document-processing"
|
|
16
20
|
],
|
|
17
21
|
"repository": {
|
|
18
22
|
"type": "git",
|
package/src/index.d.ts
CHANGED
|
@@ -1,21 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Shared OOXML codecs and domain models for EJ2 Office JavaScript libraries.
|
|
3
|
-
* Consume from git / local workspace; not published to npm.
|
|
4
|
-
*
|
|
5
|
-
* Feature modules are added incrementally (ink, mathml, encryption, …). Root
|
|
6
|
-
* entry re-exports the public surface as features land, including the OFFCRYPTO
|
|
7
|
-
* Agile decrypt surface from ./encryption.
|
|
8
|
-
*
|
|
9
2
|
* @packageDocumentation
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Package identity string for consumers proving resolution (TASK-9001).
|
|
3
|
+
* @syncfusion/ej2-office-common - shared OOXML codecs and domain models.
|
|
13
4
|
*
|
|
14
|
-
*
|
|
5
|
+
* Package root beside `src/office-common/`, mirroring `@syncfusion/ej2-docx`.
|
|
15
6
|
*/
|
|
16
|
-
export
|
|
17
|
-
export { INKML_NAMESPACE, INK_CONTENT_TYPE, INK_SOURCE_RELATIONSHIP_TYPE, WORDML_2010_NAMESPACE, WORDPROCESSING_INK_URI, INK_EFFECT_COLORS, inkEffectColor, computeInkBounds, decodeTrace, encodeTrace, scalePointsStretch, scalePointsUniform, addInkTrace, cloneInk, createInk, inkPathPoints, isOfficeInk, DIAG_INVALID_INK_TRACE, getLastInkParseDiagnostics, parseInkXml, serializeInkXml, EMUS_PER_POINT, formatUnitValue, pointsToUnit, unitValueToPoints, } from './features/ink/index';
|
|
18
|
-
export { InkBounds, InkExtent, InkPoint, TraceDecodeResult, TraceDecodeStats, InkBrush, InkChannel, InkContext, InkEffectType, InkTrace, OfficeInk, InkParseDiagnostic, InkParseDiagnostics, } from './features/ink/index';
|
|
19
|
-
export { MATH_NAMESPACE, MATH_PREFIX_FALLBACKS, WML_TRANSITIONAL_NAMESPACE, XML_NAMESPACE, MATH_BREAKBIN_VALUES, MATH_BREAKBINSUB_VALUES, MATH_FTYPE_VALUES, MATH_JC_VALUES, MATH_LIMLOC_VALUES, MATH_SCRIPT_VALUES, MATH_SHP_VALUES, MATH_SPACING_RULE_VALUES, MATH_STYLE_VALUES, MATH_TOPBOT_VALUES, emitOnOff, isInteger2, isInteger255, isSpacingRule, isUnSignedInteger, parseMathBreakBin, parseMathBreakBinSub, parseMathFractionType, parseMathJc, parseMathLimLoc, parseMathScript, parseMathShape, parseMathStyle, parseMathTopBot, parseOnOff, MathArgument, MathElement, MathText, UnknownMathElement, mathArg, MathOMath, MathParagraph, MathAccent, MathBar, MathBorderBox, MathBox, MathDelimiter, MathEquationArray, MathFraction, MathFunction, MathGroupCharacter, MathLimitLower, MathLimitUpper, MathMatrix, MathMatrixRow, MathNaryOperator, MathPhantom, MathPreSubSuperscript, MathRadical, MathRun, MathSubscript, MathSubSuperscript, MathSuperscript, parseMathElement, parseMathElements, mathElementToOpenXml, cloneMathElement, mathEqual, attrValue, attrValueNs, childElements, createElement, createText, textContent, } from './features/mathml/index';
|
|
20
|
-
export { MathBreakBin, MathBreakBinSub, MathFractionType, MathJc, MathLimLoc, MathScript, MathShape, MathSpacingRule, MathStyle, MathTopBot, MathArgProperties, MathElementType, MathParaProperties, MathAccentProperties, MathBarProperties, MathBorderBoxProperties, MathBoxProperties, MathCtrlPr, MathDelimiterProperties, MathEquationArrayProperties, MathFractionProperties, MathFunctionProperties, MathGroupCharacterProperties, MathLimitProperties, MathMatrixProperties, MathNaryProperties, MathPhantomProperties, MathRadicalProperties, MathRunProperties, MathScriptControlProperties, MathParseDiagnostic, ParseMathOptions, SerializeMathOptions, NamespaceDeclaration, OpenXmlAttribute, OpenXmlChild, OpenXmlElement, OpenXmlText, } from './features/mathml/index';
|
|
21
|
-
export { decryptOffCryptoPackage, isOffCryptoPackage, DEFAULT_DECRYPT_SECURITY_LIMITS, EncryptedPackageError, InvalidPasswordError, PackageLimitError, resolveDecryptLimits, UnsupportedEncryptionError, DecryptSecurityLimits, SecurityErrorOptions, AGILE_ENCRYPTION_NS, AGILE_RESERVED, AGILE_VERSION_MAJOR, AGILE_VERSION_MINOR, BLOCK_KEY_ENCRYPTOR_KEY, BLOCK_KEY_HMAC_KEY, BLOCK_KEY_HMAC_VALUE, BLOCK_KEY_VERIFIER_HASH, BLOCK_KEY_VERIFIER_INPUT, ENCRYPTED_PACKAGE_SEGMENT_SIZE, PASSWORD_KEY_ENCRYPTOR_NS, PASSWORD_KEY_ENCRYPTOR_URI, STREAM_ENCRYPTED_PACKAGE, STREAM_ENCRYPTION_INFO, aesCbcDecrypt, aesCbcEncrypt, concatBytes, deriveAgileIv, deriveAgileKey, encodePasswordUtf16Le, hashBytes, hashDigestLength, hmacBytes, timingSafeEqual, AgileHashName, } from './encryption/index';
|
|
7
|
+
export * from './office-common/index';
|
package/src/index.js
CHANGED
|
@@ -1,22 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Shared OOXML codecs and domain models for EJ2 Office JavaScript libraries.
|
|
3
|
-
* Consume from git / local workspace; not published to npm.
|
|
4
|
-
*
|
|
5
|
-
* Feature modules are added incrementally (ink, mathml, encryption, …). Root
|
|
6
|
-
* entry re-exports the public surface as features land, including the OFFCRYPTO
|
|
7
|
-
* Agile decrypt surface from ./encryption.
|
|
8
|
-
*
|
|
9
2
|
* @packageDocumentation
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Package identity string for consumers proving resolution (TASK-9001).
|
|
3
|
+
* @syncfusion/ej2-office-common - shared OOXML codecs and domain models.
|
|
13
4
|
*
|
|
14
|
-
*
|
|
5
|
+
* Package root beside `src/office-common/`, mirroring `@syncfusion/ej2-docx`.
|
|
15
6
|
*/
|
|
16
|
-
export
|
|
17
|
-
export { INKML_NAMESPACE, INK_CONTENT_TYPE, INK_SOURCE_RELATIONSHIP_TYPE, WORDML_2010_NAMESPACE, WORDPROCESSING_INK_URI, INK_EFFECT_COLORS, inkEffectColor, computeInkBounds, decodeTrace, encodeTrace, scalePointsStretch, scalePointsUniform, addInkTrace, cloneInk, createInk, inkPathPoints, isOfficeInk, DIAG_INVALID_INK_TRACE, getLastInkParseDiagnostics, parseInkXml, serializeInkXml, EMUS_PER_POINT, formatUnitValue, pointsToUnit, unitValueToPoints, } from './features/ink/index';
|
|
18
|
-
// ─── mathml (OMML) public surface — @syncfusion/ej2-office-common/mathml ──────────────────
|
|
19
|
-
export { MATH_NAMESPACE, MATH_PREFIX_FALLBACKS, WML_TRANSITIONAL_NAMESPACE, XML_NAMESPACE, MATH_BREAKBIN_VALUES, MATH_BREAKBINSUB_VALUES, MATH_FTYPE_VALUES, MATH_JC_VALUES, MATH_LIMLOC_VALUES, MATH_SCRIPT_VALUES, MATH_SHP_VALUES, MATH_SPACING_RULE_VALUES, MATH_STYLE_VALUES, MATH_TOPBOT_VALUES, emitOnOff, isInteger2, isInteger255, isSpacingRule, isUnSignedInteger, parseMathBreakBin, parseMathBreakBinSub, parseMathFractionType, parseMathJc, parseMathLimLoc, parseMathScript, parseMathShape, parseMathStyle, parseMathTopBot, parseOnOff, MathArgument, MathElement, MathText, UnknownMathElement, mathArg, MathOMath, MathParagraph, MathAccent, MathBar, MathBorderBox, MathBox, MathDelimiter, MathEquationArray, MathFraction, MathFunction, MathGroupCharacter, MathLimitLower, MathLimitUpper, MathMatrix, MathMatrixRow, MathNaryOperator, MathPhantom, MathPreSubSuperscript, MathRadical, MathRun, MathSubscript, MathSubSuperscript, MathSuperscript, parseMathElement, parseMathElements, mathElementToOpenXml, cloneMathElement, mathEqual, attrValue, attrValueNs, childElements, createElement, createText, textContent, } from './features/mathml/index';
|
|
20
|
-
export { decryptOffCryptoPackage, isOffCryptoPackage, DEFAULT_DECRYPT_SECURITY_LIMITS, EncryptedPackageError, InvalidPasswordError, PackageLimitError, resolveDecryptLimits, UnsupportedEncryptionError,
|
|
21
|
-
// fixture / advanced crypto surface
|
|
22
|
-
AGILE_ENCRYPTION_NS, AGILE_RESERVED, AGILE_VERSION_MAJOR, AGILE_VERSION_MINOR, BLOCK_KEY_ENCRYPTOR_KEY, BLOCK_KEY_HMAC_KEY, BLOCK_KEY_HMAC_VALUE, BLOCK_KEY_VERIFIER_HASH, BLOCK_KEY_VERIFIER_INPUT, ENCRYPTED_PACKAGE_SEGMENT_SIZE, PASSWORD_KEY_ENCRYPTOR_NS, PASSWORD_KEY_ENCRYPTOR_URI, STREAM_ENCRYPTED_PACKAGE, STREAM_ENCRYPTION_INFO, aesCbcDecrypt, aesCbcEncrypt, concatBytes, deriveAgileIv, deriveAgileKey, encodePasswordUtf16Le, hashBytes, hashDigestLength, hmacBytes, timingSafeEqual, } from './encryption/index';
|
|
7
|
+
export * from './office-common/index';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Optional Office Math Markup Language (OMML) feature module
|
|
3
|
+
* (`@syncfusion/ej2-office-common/mathml`).
|
|
4
|
+
*
|
|
5
|
+
* Provides the canonical Office Math authoring model (`OfficeMathParagraph`, `OfficeMath`,
|
|
6
|
+
* `OfficeMath*` functions), the tolerant OMML parser, clone/equality helpers, and cited constants. "MathML" here
|
|
7
|
+
* means OMML (`m:*` per ECMA-376-1 §22.1 / Part 4 Annex A.8.1) — not W3C MathML.
|
|
8
|
+
*
|
|
9
|
+
* Docx integration (`MathInline`, paragraph accessors, save hook) is TASK-9011.
|
|
10
|
+
*
|
|
11
|
+
* @packageDocumentation
|
|
12
|
+
*/
|
|
13
|
+
export { MATH_NAMESPACE, MATH_PREFIX_FALLBACKS, WML_TRANSITIONAL_NAMESPACE, XML_NAMESPACE } from './constants';
|
|
14
|
+
export * from './office-math/index';
|
|
15
|
+
export { MathParseDiagnostic, ParseMathOptions } from './parse/parse-options';
|
|
16
|
+
export { parseOfficeMathParagraph } from './parse/office-math-parser';
|
|
17
|
+
export { parseLatexToMath, parseLatexIntoMathParagraph } from './latex/latex-parser';
|
|
18
|
+
export { mathToLatex } from './latex/latex-generator';
|
|
19
|
+
export { getLatexSymbol, getSymbolLatex } from './latex/latex-symbols';
|
|
20
|
+
export { serializeOfficeMathParagraph, SerializeOfficeMathOptions } from './serialize/office-math-serializer';
|
|
21
|
+
export { MathmlConstraintKind } from './errors';
|
|
22
|
+
export { MathmlReadOnlyError, MathmlValidationError } from './errors';
|
|
23
|
+
export { NamespaceDeclaration, OpenXmlAttribute, OpenXmlChild, OpenXmlElement, OpenXmlText } from './openxml';
|
|
24
|
+
export { attrValue, attrValueNs, childElements, createElement, createText, textContent } from './openxml';
|
|
25
|
+
export { MathSettings, parseMathSettings, mathSettingsToOpenXml } from './math-settings';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Optional Office Math Markup Language (OMML) feature module
|
|
3
|
+
* (`@syncfusion/ej2-office-common/mathml`).
|
|
4
|
+
*
|
|
5
|
+
* Provides the canonical Office Math authoring model (`OfficeMathParagraph`, `OfficeMath`,
|
|
6
|
+
* `OfficeMath*` functions), the tolerant OMML parser, clone/equality helpers, and cited constants. "MathML" here
|
|
7
|
+
* means OMML (`m:*` per ECMA-376-1 §22.1 / Part 4 Annex A.8.1) — not W3C MathML.
|
|
8
|
+
*
|
|
9
|
+
* Docx integration (`MathInline`, paragraph accessors, save hook) is TASK-9011.
|
|
10
|
+
*
|
|
11
|
+
* @packageDocumentation
|
|
12
|
+
*/
|
|
13
|
+
export { MATH_NAMESPACE, MATH_PREFIX_FALLBACKS, WML_TRANSITIONAL_NAMESPACE, XML_NAMESPACE } from './constants';
|
|
14
|
+
export * from './office-math/index';
|
|
15
|
+
export { parseOfficeMathParagraph } from './parse/office-math-parser';
|
|
16
|
+
export { parseLatexToMath, parseLatexIntoMathParagraph } from './latex/latex-parser';
|
|
17
|
+
export { mathToLatex } from './latex/latex-generator';
|
|
18
|
+
export { getLatexSymbol, getSymbolLatex } from './latex/latex-symbols';
|
|
19
|
+
export { serializeOfficeMathParagraph } from './serialize/office-math-serializer';
|
|
20
|
+
export { MathmlReadOnlyError, MathmlValidationError } from './errors';
|
|
21
|
+
export { attrValue, attrValueNs, childElements, createElement, createText, textContent } from './openxml';
|
|
22
|
+
export { parseMathSettings, mathSettingsToOpenXml } from './math-settings';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { OfficeMath } from '../office-math/office-math';
|
|
2
|
+
import { OfficeMathParagraph } from '../office-math/math-paragraph';
|
|
3
|
+
/**
|
|
4
|
+
* Converts a math paragraph (or a single `m:oMath`) to a LaTeX string.
|
|
5
|
+
*
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
8
|
+
export declare function mathToLatex(math: OfficeMathParagraph | OfficeMath): string;
|
|
@@ -0,0 +1,357 @@
|
|
|
1
|
+
var __values = (this && this.__values) || function (o) {
|
|
2
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0;
|
|
3
|
+
if (m) return m.call(o);
|
|
4
|
+
return {
|
|
5
|
+
next: function () {
|
|
6
|
+
if (o && i >= o.length) o = void 0;
|
|
7
|
+
return { value: o && o[i++], done: !o };
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
var _a;
|
|
12
|
+
/**
|
|
13
|
+
* Office Math model → LaTeX generator.
|
|
14
|
+
*
|
|
15
|
+
* Port of compression `LaTeXConverter.GetLaTeX` (Math to LaTeX region). Output
|
|
16
|
+
* syntax matches what `parseLatexToMath` accepts. Unsupported element kinds are
|
|
17
|
+
* skipped, as in the .NET implementation.
|
|
18
|
+
*
|
|
19
|
+
* @packageDocumentation
|
|
20
|
+
*/
|
|
21
|
+
import { MathFontType, MathFractionType, MathFunctionType, MathScriptType, MathStyleType } from '../office-math/enums';
|
|
22
|
+
import { K } from '../office-math/keys';
|
|
23
|
+
import { OfficeMathParagraph } from '../office-math/math-paragraph';
|
|
24
|
+
import { getSymbolLatex } from './latex-symbols';
|
|
25
|
+
// Built at runtime: `u`-flag literals are rejected by ES5 compile targets.
|
|
26
|
+
var LETTER = new RegExp('^\\p{L}$', 'u');
|
|
27
|
+
function orDefault(value, fallback) {
|
|
28
|
+
return value !== undefined && value !== null ? value : fallback;
|
|
29
|
+
}
|
|
30
|
+
var ACCENT_COMMANDS = {
|
|
31
|
+
775: '\\dot', 776: '\\ddot', 8411: '\\dddot', 770: '\\widehat', 780: '\\check', 768: '\\grave', 774: '\\breve',
|
|
32
|
+
771: '\\widetilde', 769: '\\acute', 773: '\\bar', 831: '\\bar{\\bar', 8407: '\\vec', 8401: '\\hvec',
|
|
33
|
+
};
|
|
34
|
+
var NARY_COMMANDS = {
|
|
35
|
+
8721: '\\sum', 8747: '\\int', 8748: '\\iint', 8749: '\\iiint', 8750: '\\oint', 8751: '\\oiint', 8752: '\\oiiint',
|
|
36
|
+
8753: '\\cwint', 8754: '\\coint', 8755: '\\aoint', 8719: '\\prod', 8720: '\\amalg', 8898: '\\bigcap', 8899: '\\bigcup',
|
|
37
|
+
8896: '\\bigwedge', 8897: '\\bigvee', 10752: '\\bigodot', 10754: '\\bigotimes', 10753: '\\bigoplus', 10756: '\\biguplus',
|
|
38
|
+
10755: '\\bigudot',
|
|
39
|
+
};
|
|
40
|
+
var DELIMITER_COMMANDS = {
|
|
41
|
+
40: '(', 91: '[', 123: '{', 41: ')', 93: ']', 125: '}', 124: '|', 9001: '\\langle', 8968: '\\lceil', 8970: '\\lfloor',
|
|
42
|
+
9002: '\\rangle', 8969: '\\rceil', 8971: '\\rfloor',
|
|
43
|
+
};
|
|
44
|
+
var FONT_COMMANDS = (_a = {},
|
|
45
|
+
_a[MathFontType.DoubleStruck] = '\\mathbb',
|
|
46
|
+
_a[MathFontType.Fraktur] = '\\mathfrak',
|
|
47
|
+
_a[MathFontType.Monospace] = '\\mathtt',
|
|
48
|
+
_a[MathFontType.SansSerif] = '\\mathsf',
|
|
49
|
+
_a[MathFontType.Script] = '\\mathscr',
|
|
50
|
+
_a);
|
|
51
|
+
var LatexGenerator = /** @class */ (function () {
|
|
52
|
+
function LatexGenerator() {
|
|
53
|
+
this.out = '';
|
|
54
|
+
this.inFunctionName = false;
|
|
55
|
+
}
|
|
56
|
+
LatexGenerator.prototype.generate = function (equations) {
|
|
57
|
+
var e_1, _a;
|
|
58
|
+
try {
|
|
59
|
+
for (var equations_1 = __values(equations), equations_1_1 = equations_1.next(); !equations_1_1.done; equations_1_1 = equations_1.next()) {
|
|
60
|
+
var eq = equations_1_1.value;
|
|
61
|
+
this.arg(eq);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
65
|
+
finally {
|
|
66
|
+
try {
|
|
67
|
+
if (equations_1_1 && !equations_1_1.done && (_a = equations_1.return)) _a.call(equations_1);
|
|
68
|
+
}
|
|
69
|
+
finally { if (e_1) throw e_1.error; }
|
|
70
|
+
}
|
|
71
|
+
return this.out;
|
|
72
|
+
};
|
|
73
|
+
LatexGenerator.prototype.group = function (arg) {
|
|
74
|
+
this.out += '{';
|
|
75
|
+
this.arg(arg);
|
|
76
|
+
this.out += '}';
|
|
77
|
+
};
|
|
78
|
+
LatexGenerator.prototype.arg = function (arg) {
|
|
79
|
+
if (arg) {
|
|
80
|
+
for (var i = 0; i < arg.functions.count; i++) {
|
|
81
|
+
this.element(arg.functions.getItem(i));
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
LatexGenerator.prototype.element = function (el) {
|
|
86
|
+
switch (el.type) {
|
|
87
|
+
case MathFunctionType.RunElement:
|
|
88
|
+
this.run(el);
|
|
89
|
+
break;
|
|
90
|
+
case MathFunctionType.Accent:
|
|
91
|
+
this.accent(el);
|
|
92
|
+
break;
|
|
93
|
+
case MathFunctionType.Bar:
|
|
94
|
+
this.out += el.barTop ? '\\overline' : '\\underline';
|
|
95
|
+
this.group(el.equation);
|
|
96
|
+
break;
|
|
97
|
+
case MathFunctionType.Box:
|
|
98
|
+
this.out += '\\box';
|
|
99
|
+
this.group(el.equation);
|
|
100
|
+
break;
|
|
101
|
+
case MathFunctionType.BorderBox:
|
|
102
|
+
this.out += '\\fbox';
|
|
103
|
+
this.group(el.equation);
|
|
104
|
+
break;
|
|
105
|
+
case MathFunctionType.Fraction:
|
|
106
|
+
this.fraction(el);
|
|
107
|
+
break;
|
|
108
|
+
case MathFunctionType.Function:
|
|
109
|
+
this.func(el);
|
|
110
|
+
break;
|
|
111
|
+
case MathFunctionType.Delimiter:
|
|
112
|
+
this.delimiter(el);
|
|
113
|
+
break;
|
|
114
|
+
case MathFunctionType.GroupCharacter:
|
|
115
|
+
this.groupChar(el);
|
|
116
|
+
break;
|
|
117
|
+
case MathFunctionType.Limit:
|
|
118
|
+
this.limit(el);
|
|
119
|
+
break;
|
|
120
|
+
case MathFunctionType.Matrix:
|
|
121
|
+
this.matrix(el);
|
|
122
|
+
break;
|
|
123
|
+
case MathFunctionType.NArray:
|
|
124
|
+
this.nary(el);
|
|
125
|
+
break;
|
|
126
|
+
case MathFunctionType.Radical:
|
|
127
|
+
this.radical(el);
|
|
128
|
+
break;
|
|
129
|
+
case MathFunctionType.SubSuperscript: {
|
|
130
|
+
var s = el;
|
|
131
|
+
this.script(s.equation, s.scriptType === MathScriptType.Subscript ? '_' : '^', s.script);
|
|
132
|
+
break;
|
|
133
|
+
}
|
|
134
|
+
case MathFunctionType.LeftSubSuperscript: {
|
|
135
|
+
var s = el;
|
|
136
|
+
this.out += '{_';
|
|
137
|
+
this.group(s.subscript);
|
|
138
|
+
this.out += '^';
|
|
139
|
+
this.group(s.superscript);
|
|
140
|
+
this.out += '}';
|
|
141
|
+
this.group(s.equation);
|
|
142
|
+
break;
|
|
143
|
+
}
|
|
144
|
+
case MathFunctionType.RightSubSuperscript: {
|
|
145
|
+
var s = el;
|
|
146
|
+
this.group(s.equation);
|
|
147
|
+
this.out += '_';
|
|
148
|
+
this.group(s.subscript);
|
|
149
|
+
this.out += '^';
|
|
150
|
+
this.group(s.superscript);
|
|
151
|
+
break;
|
|
152
|
+
}
|
|
153
|
+
case MathFunctionType.EquationArray: {
|
|
154
|
+
var e = el;
|
|
155
|
+
this.out += '\\eqarray{';
|
|
156
|
+
for (var i = 0; i < e.equations.count; i++) {
|
|
157
|
+
if (i > 0) {
|
|
158
|
+
this.out += '@';
|
|
159
|
+
}
|
|
160
|
+
this.arg(e.equations.getItem(i));
|
|
161
|
+
}
|
|
162
|
+
this.out += '}';
|
|
163
|
+
break;
|
|
164
|
+
}
|
|
165
|
+
default: break;
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
LatexGenerator.prototype.accent = function (el) {
|
|
169
|
+
var code = el.accentCharacter.charCodeAt(0);
|
|
170
|
+
this.out += orDefault(ACCENT_COMMANDS[code], '');
|
|
171
|
+
this.group(el.equation);
|
|
172
|
+
if (code === 831) {
|
|
173
|
+
this.out += '}';
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
LatexGenerator.prototype.fraction = function (el) {
|
|
177
|
+
var type = el.fractionType;
|
|
178
|
+
if (type === MathFractionType.NormalFractionBar) {
|
|
179
|
+
this.out += '\\frac';
|
|
180
|
+
}
|
|
181
|
+
else if (type === MathFractionType.SkewedFractionBar || type === MathFractionType.FractionInline) {
|
|
182
|
+
this.out += '\\sfrac';
|
|
183
|
+
}
|
|
184
|
+
this.group(el.numerator);
|
|
185
|
+
if (type === MathFractionType.NoFractionBar) {
|
|
186
|
+
this.out += '\\atop';
|
|
187
|
+
}
|
|
188
|
+
this.group(el.denominator);
|
|
189
|
+
};
|
|
190
|
+
LatexGenerator.prototype.func = function (el) {
|
|
191
|
+
this.inFunctionName = true;
|
|
192
|
+
this.out += '\\';
|
|
193
|
+
this.arg(el.functionName);
|
|
194
|
+
this.inFunctionName = false;
|
|
195
|
+
this.group(el.equation);
|
|
196
|
+
};
|
|
197
|
+
LatexGenerator.prototype.delimiterChar = function (chr) {
|
|
198
|
+
this.out += chr.length > 0 ? orDefault(DELIMITER_COMMANDS[chr.charCodeAt(0)], '') : '.';
|
|
199
|
+
};
|
|
200
|
+
LatexGenerator.prototype.delimiter = function (el) {
|
|
201
|
+
this.out += '\\left';
|
|
202
|
+
this.delimiterChar(el.beginCharacter);
|
|
203
|
+
this.out += ' ';
|
|
204
|
+
for (var i = 0; i < el.equations.count; i++) {
|
|
205
|
+
this.arg(el.equations.getItem(i));
|
|
206
|
+
if (i < el.equations.count - 1) {
|
|
207
|
+
this.out += '\\middle';
|
|
208
|
+
this.delimiterChar(el.separator);
|
|
209
|
+
this.out += ' ';
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
this.out += '\\right';
|
|
213
|
+
this.delimiterChar(el.endCharacter);
|
|
214
|
+
};
|
|
215
|
+
LatexGenerator.prototype.groupChar = function (el) {
|
|
216
|
+
var code = el.groupCharacter.charCodeAt(0);
|
|
217
|
+
if (code === 9182) {
|
|
218
|
+
this.out += '\\overbrace';
|
|
219
|
+
}
|
|
220
|
+
else if (code === 9183) {
|
|
221
|
+
this.out += '\\underbrace';
|
|
222
|
+
}
|
|
223
|
+
this.group(el.equation);
|
|
224
|
+
};
|
|
225
|
+
LatexGenerator.prototype.limit = function (el) {
|
|
226
|
+
if (!this.inFunctionName) {
|
|
227
|
+
this.out += '{';
|
|
228
|
+
}
|
|
229
|
+
this.arg(el.equation);
|
|
230
|
+
if (!this.inFunctionName) {
|
|
231
|
+
this.out += '}';
|
|
232
|
+
}
|
|
233
|
+
this.out += '\\below';
|
|
234
|
+
this.group(el.limit);
|
|
235
|
+
};
|
|
236
|
+
LatexGenerator.prototype.matrix = function (el) {
|
|
237
|
+
var e_2, _a;
|
|
238
|
+
this.out += '\\begin{matrix}';
|
|
239
|
+
try {
|
|
240
|
+
for (var _b = __values(el.rowItems), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
241
|
+
var row = _c.value;
|
|
242
|
+
var count = row.arguments.count;
|
|
243
|
+
for (var i = 0; i < count; i++) {
|
|
244
|
+
this.arg(row.arguments.getItem(i));
|
|
245
|
+
if (i !== count - 1) {
|
|
246
|
+
this.out += '&';
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
this.out += '\\\\';
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
253
|
+
finally {
|
|
254
|
+
try {
|
|
255
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
256
|
+
}
|
|
257
|
+
finally { if (e_2) throw e_2.error; }
|
|
258
|
+
}
|
|
259
|
+
this.out += '\\end{matrix}';
|
|
260
|
+
};
|
|
261
|
+
LatexGenerator.prototype.nary = function (el) {
|
|
262
|
+
this.out += orDefault(NARY_COMMANDS[el.nArrayCharacter.charCodeAt(0)], '');
|
|
263
|
+
if (el.subscript.functions.count > 0) {
|
|
264
|
+
this.out += '_';
|
|
265
|
+
this.group(el.subscript);
|
|
266
|
+
}
|
|
267
|
+
if (el.superscript.functions.count > 0) {
|
|
268
|
+
this.out += '^';
|
|
269
|
+
this.group(el.superscript);
|
|
270
|
+
}
|
|
271
|
+
this.group(el.equation);
|
|
272
|
+
};
|
|
273
|
+
LatexGenerator.prototype.radical = function (el) {
|
|
274
|
+
this.out += '\\sqrt';
|
|
275
|
+
if (el.degree.functions.count > 0) {
|
|
276
|
+
this.out += '[';
|
|
277
|
+
this.arg(el.degree);
|
|
278
|
+
this.out += ']';
|
|
279
|
+
}
|
|
280
|
+
this.group(el.equation);
|
|
281
|
+
};
|
|
282
|
+
LatexGenerator.prototype.script = function (base, op, script) {
|
|
283
|
+
if (!this.inFunctionName) {
|
|
284
|
+
this.out += '{';
|
|
285
|
+
}
|
|
286
|
+
this.arg(base);
|
|
287
|
+
if (!this.inFunctionName) {
|
|
288
|
+
this.out += '}';
|
|
289
|
+
}
|
|
290
|
+
this.out += op;
|
|
291
|
+
this.group(script);
|
|
292
|
+
};
|
|
293
|
+
LatexGenerator.prototype.run = function (el) {
|
|
294
|
+
var e_3, _a;
|
|
295
|
+
var text = el.text;
|
|
296
|
+
var format = el.mathFormat;
|
|
297
|
+
var sty = format.isExplicit(K.Style) ? format.style : undefined;
|
|
298
|
+
var scr = format.isExplicit(K.Script) ? format.font : undefined;
|
|
299
|
+
var openers = [];
|
|
300
|
+
if (sty === MathStyleType.BoldItalic) {
|
|
301
|
+
openers.push('\\mathbit{');
|
|
302
|
+
}
|
|
303
|
+
else if (sty === MathStyleType.Bold) {
|
|
304
|
+
openers.push('\\mathbf{');
|
|
305
|
+
}
|
|
306
|
+
if (scr !== undefined && FONT_COMMANDS[scr] !== undefined) {
|
|
307
|
+
openers.push(FONT_COMMANDS[scr] + "{");
|
|
308
|
+
}
|
|
309
|
+
if (format.hasNormalText) {
|
|
310
|
+
openers.push('\\mathrm{');
|
|
311
|
+
}
|
|
312
|
+
var applied = 0;
|
|
313
|
+
var applyFormats = true;
|
|
314
|
+
var lastSymbol = false;
|
|
315
|
+
try {
|
|
316
|
+
for (var text_1 = __values(text), text_1_1 = text_1.next(); !text_1_1.done; text_1_1 = text_1.next()) {
|
|
317
|
+
var ch = text_1_1.value;
|
|
318
|
+
var symbol = getSymbolLatex(ch, scr === MathFontType.Script);
|
|
319
|
+
if (symbol !== undefined) {
|
|
320
|
+
this.out += '}'.repeat(applied);
|
|
321
|
+
applied = 0;
|
|
322
|
+
applyFormats = true;
|
|
323
|
+
this.out += symbol;
|
|
324
|
+
lastSymbol = true;
|
|
325
|
+
continue;
|
|
326
|
+
}
|
|
327
|
+
if (lastSymbol && LETTER.test(ch)) {
|
|
328
|
+
this.out += ' ';
|
|
329
|
+
}
|
|
330
|
+
lastSymbol = false;
|
|
331
|
+
if (applyFormats) {
|
|
332
|
+
this.out += openers.join('');
|
|
333
|
+
applied = openers.length;
|
|
334
|
+
applyFormats = false;
|
|
335
|
+
}
|
|
336
|
+
this.out += ch;
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
340
|
+
finally {
|
|
341
|
+
try {
|
|
342
|
+
if (text_1_1 && !text_1_1.done && (_a = text_1.return)) _a.call(text_1);
|
|
343
|
+
}
|
|
344
|
+
finally { if (e_3) throw e_3.error; }
|
|
345
|
+
}
|
|
346
|
+
this.out += '}'.repeat(applied);
|
|
347
|
+
};
|
|
348
|
+
return LatexGenerator;
|
|
349
|
+
}());
|
|
350
|
+
/**
|
|
351
|
+
* Converts a math paragraph (or a single `m:oMath`) to a LaTeX string.
|
|
352
|
+
*
|
|
353
|
+
* @public
|
|
354
|
+
*/
|
|
355
|
+
export function mathToLatex(math) {
|
|
356
|
+
return new LatexGenerator().generate(math instanceof OfficeMathParagraph ? math.maths.toArray() : [math]);
|
|
357
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { OfficeMathParagraph } from '../office-math/math-paragraph';
|
|
2
|
+
import { MathDocumentAdapter } from '../office-math/adapter';
|
|
3
|
+
/**
|
|
4
|
+
* Stateful LaTeX scanner/parser. One instance per conversion.
|
|
5
|
+
*
|
|
6
|
+
* @private
|
|
7
|
+
*/
|
|
8
|
+
export declare class LatexParser {
|
|
9
|
+
private latex;
|
|
10
|
+
private pos;
|
|
11
|
+
private cur;
|
|
12
|
+
private useExisting;
|
|
13
|
+
private current;
|
|
14
|
+
private readonly roots;
|
|
15
|
+
private sty;
|
|
16
|
+
private scr;
|
|
17
|
+
private nor;
|
|
18
|
+
/** Appends one `m:oMath` per top-level equation of `latex` to `target`, through its collections and adapter. */
|
|
19
|
+
populate(latex: string, target: OfficeMathParagraph): void;
|
|
20
|
+
private next;
|
|
21
|
+
private ensure;
|
|
22
|
+
private sub;
|
|
23
|
+
private fill;
|
|
24
|
+
private add;
|
|
25
|
+
private setRun;
|
|
26
|
+
private fallbackRun;
|
|
27
|
+
private equationString;
|
|
28
|
+
private group;
|
|
29
|
+
private squareGroup;
|
|
30
|
+
private parseEquation;
|
|
31
|
+
private dispatch;
|
|
32
|
+
private parseDefault;
|
|
33
|
+
private parseFormat;
|
|
34
|
+
/** `\cmd{...}` / `\cmd x` argument shared by accent, bar, box, border box, group char. */
|
|
35
|
+
private oneArg;
|
|
36
|
+
private parseAccent;
|
|
37
|
+
private parseBar;
|
|
38
|
+
private parseBox;
|
|
39
|
+
private parseBorderBox;
|
|
40
|
+
private delimiterChar;
|
|
41
|
+
private delimiter;
|
|
42
|
+
private parseDelimiter;
|
|
43
|
+
private splitEqArray;
|
|
44
|
+
private parseEqArray;
|
|
45
|
+
private parseFraction;
|
|
46
|
+
private fraction;
|
|
47
|
+
/** `\binom{n}{k}`: a parenthesis delimiter around a no-bar fraction (Word's binomial coefficient). */
|
|
48
|
+
private binomial;
|
|
49
|
+
private parseNoFractionBar;
|
|
50
|
+
private parseFunction;
|
|
51
|
+
private regular;
|
|
52
|
+
private parseGroupChar;
|
|
53
|
+
/** Compares the current element without TypeScript narrowing across mutating calls. */
|
|
54
|
+
private isCurrent;
|
|
55
|
+
private parseLimit;
|
|
56
|
+
private parseMatrix;
|
|
57
|
+
private matrixRows;
|
|
58
|
+
private parseNary;
|
|
59
|
+
/** Greedily absorbs trailing script groups into the N-ary operand (mirrors compression). */
|
|
60
|
+
private naryTail;
|
|
61
|
+
private parseRadical;
|
|
62
|
+
private parseGroupStart;
|
|
63
|
+
private parseScript;
|
|
64
|
+
private parseRightScript;
|
|
65
|
+
private parseLeftScript;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Convert a LaTeX equation string to an Office Math paragraph.
|
|
69
|
+
*
|
|
70
|
+
* Mirrors Microsoft Word's "linear LaTeX" behavior as implemented by Syncfusion
|
|
71
|
+
* `LaTeXConverter.ParseMathPara`: unsupported or malformed constructs degrade to
|
|
72
|
+
* plain text runs instead of throwing.
|
|
73
|
+
*
|
|
74
|
+
* @param latex - LaTeX source (for example `\frac{a}{b}` or `\sqrt[3]{x}`).
|
|
75
|
+
* @returns An {@link OfficeMathParagraph} holding one {@link OfficeMath} per top-level equation.
|
|
76
|
+
* @public
|
|
77
|
+
*/
|
|
78
|
+
export declare function parseLatexToMath(latex: string, adapter?: MathDocumentAdapter): OfficeMathParagraph;
|
|
79
|
+
/**
|
|
80
|
+
* Appends the equations parsed from a LaTeX string to an existing Math paragraph.
|
|
81
|
+
* Runs are created through the target's document adapter when it has one.
|
|
82
|
+
*
|
|
83
|
+
* @param latex - LaTeX source.
|
|
84
|
+
* @param target - The paragraph to populate; it keeps its identity, owner, adapter and listener.
|
|
85
|
+
* @public
|
|
86
|
+
*/
|
|
87
|
+
export declare function parseLatexIntoMathParagraph(latex: string, target: OfficeMathParagraph): void;
|