@syncfusion/ej2-office-common 35.1.37
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/.eslintrc.json +263 -0
- package/.prettierrc.json +5 -0
- package/README.md +167 -0
- package/api-extractor.json +35 -0
- package/core.js +4 -0
- package/dist/ej2-office-common.umd.min.js +11 -0
- package/dist/ej2-office-common.umd.min.js.map +1 -0
- package/dist/es6/ej2-office-common.es2015.js +6585 -0
- package/dist/es6/ej2-office-common.es2015.js.map +1 -0
- package/dist/es6/ej2-office-common.es5.js +7955 -0
- package/dist/es6/ej2-office-common.es5.js.map +1 -0
- package/dist/global/ej2-office-common.min.js +11 -0
- package/dist/global/ej2-office-common.min.js.map +1 -0
- package/dist/global/index.d.ts +14 -0
- package/encryption.js +4 -0
- package/features.js +4 -0
- package/global.json +6 -0
- package/index.js +4 -0
- package/license +10 -0
- package/nuget.config +7 -0
- package/package.json +23 -0
- package/src/all.d.ts +41 -0
- package/src/all.js +38 -0
- package/src/core/index.d.ts +6 -0
- package/src/core/index.js +6 -0
- package/src/core/xml/index.d.ts +7 -0
- package/src/core/xml/index.js +6 -0
- package/src/core/xml/model.d.ts +71 -0
- package/src/core/xml/model.js +20 -0
- package/src/encryption/agile-constants.d.ts +61 -0
- package/src/encryption/agile-constants.js +71 -0
- package/src/encryption/agile-encryption-info.d.ts +46 -0
- package/src/encryption/agile-encryption-info.js +333 -0
- package/src/encryption/agile-password.d.ts +8 -0
- package/src/encryption/agile-password.js +58 -0
- package/src/encryption/cfb-reader.d.ts +11 -0
- package/src/encryption/cfb-reader.js +345 -0
- package/src/encryption/crypto-primitives.d.ts +74 -0
- package/src/encryption/crypto-primitives.js +302 -0
- package/src/encryption/decrypt-encrypted-package.d.ts +16 -0
- package/src/encryption/decrypt-encrypted-package.js +138 -0
- package/src/encryption/encryption-info-xml.d.ts +21 -0
- package/src/encryption/encryption-info-xml.js +282 -0
- package/src/encryption/errors.d.ts +66 -0
- package/src/encryption/errors.js +124 -0
- package/src/encryption/index.d.ts +35 -0
- package/src/encryption/index.js +100 -0
- package/src/features/diagrams/constants.d.ts +83 -0
- package/src/features/diagrams/constants.js +101 -0
- package/src/features/diagrams/diagram-data-model.d.ts +148 -0
- package/src/features/diagrams/diagram-data-model.js +446 -0
- package/src/features/diagrams/diagram-parsers.d.ts +28 -0
- package/src/features/diagrams/diagram-parsers.js +182 -0
- package/src/features/diagrams/diagram-serializers.d.ts +20 -0
- package/src/features/diagrams/diagram-serializers.js +110 -0
- package/src/features/diagrams/diagram-views.d.ts +60 -0
- package/src/features/diagrams/diagram-views.js +213 -0
- package/src/features/diagrams/element-tree.d.ts +55 -0
- package/src/features/diagrams/element-tree.js +197 -0
- package/src/features/diagrams/errors.d.ts +17 -0
- package/src/features/diagrams/errors.js +59 -0
- package/src/features/diagrams/index.d.ts +17 -0
- package/src/features/diagrams/index.js +17 -0
- package/src/features/diagrams/smart-art-catalog.d.ts +107 -0
- package/src/features/diagrams/smart-art-catalog.js +422 -0
- package/src/features/diagrams/smart-art-diagram.d.ts +96 -0
- package/src/features/diagrams/smart-art-diagram.js +258 -0
- package/src/features/index.d.ts +11 -0
- package/src/features/index.js +11 -0
- package/src/features/ink/constants.d.ts +54 -0
- package/src/features/ink/constants.js +54 -0
- package/src/features/ink/index.d.ts +18 -0
- package/src/features/ink/index.js +15 -0
- package/src/features/ink/ink-effects.d.ts +35 -0
- package/src/features/ink/ink-effects.js +45 -0
- package/src/features/ink/ink-model.d.ts +237 -0
- package/src/features/ink/ink-model.js +406 -0
- package/src/features/ink/ink-parser.d.ts +59 -0
- package/src/features/ink/ink-parser.js +671 -0
- package/src/features/ink/ink-serializer.d.ts +16 -0
- package/src/features/ink/ink-serializer.js +281 -0
- package/src/features/ink/ink-units.d.ts +33 -0
- package/src/features/ink/ink-units.js +92 -0
- package/src/features/ink/ink-xml.d.ts +26 -0
- package/src/features/ink/ink-xml.js +165 -0
- package/src/features/ink/trace-codec.d.ts +127 -0
- package/src/features/ink/trace-codec.js +266 -0
- package/src/features/mathml/constants.d.ts +47 -0
- package/src/features/mathml/constants.js +47 -0
- package/src/features/mathml/errors.d.ts +50 -0
- package/src/features/mathml/errors.js +69 -0
- package/src/features/mathml/index.d.ts +30 -0
- package/src/features/mathml/index.js +22 -0
- package/src/features/mathml/math-factory.d.ts +26 -0
- package/src/features/mathml/math-factory.js +568 -0
- package/src/features/mathml/model/controls.d.ts +896 -0
- package/src/features/mathml/model/controls.js +1541 -0
- package/src/features/mathml/model/enums.d.ts +153 -0
- package/src/features/mathml/model/enums.js +133 -0
- package/src/features/mathml/model/math-element.d.ts +173 -0
- package/src/features/mathml/model/math-element.js +315 -0
- package/src/features/mathml/model/roots.d.ts +82 -0
- package/src/features/mathml/model/roots.js +177 -0
- package/src/features/mathml/openxml.d.ts +56 -0
- package/src/features/mathml/openxml.js +87 -0
- package/src/features/mathml/parse/math-parser.d.ts +43 -0
- package/src/features/mathml/parse/math-parser.js +636 -0
- package/src/features/mathml/serialize/math-serializer.d.ts +34 -0
- package/src/features/mathml/serialize/math-serializer.js +749 -0
- package/src/features/smart-art/diagram-xml.d.ts +63 -0
- package/src/features/smart-art/diagram-xml.js +459 -0
- package/src/features/smart-art/errors.d.ts +24 -0
- package/src/features/smart-art/errors.js +47 -0
- package/src/features/smart-art/index.d.ts +26 -0
- package/src/features/smart-art/index.js +26 -0
- package/src/features/smart-art/minimal-samples.d.ts +18 -0
- package/src/features/smart-art/minimal-samples.js +40 -0
- package/src/features/smart-art/mutators.d.ts +60 -0
- package/src/features/smart-art/mutators.js +566 -0
- package/src/features/smart-art/namespaces.d.ts +153 -0
- package/src/features/smart-art/namespaces.js +163 -0
- package/src/features/smart-art/package-graph.d.ts +61 -0
- package/src/features/smart-art/package-graph.js +413 -0
- package/src/features/smart-art/parse-colors.d.ts +19 -0
- package/src/features/smart-art/parse-colors.js +39 -0
- package/src/features/smart-art/parse-data.d.ts +21 -0
- package/src/features/smart-art/parse-data.js +121 -0
- package/src/features/smart-art/parse-layout.d.ts +20 -0
- package/src/features/smart-art/parse-layout.js +40 -0
- package/src/features/smart-art/parse-rel-ids.d.ts +71 -0
- package/src/features/smart-art/parse-rel-ids.js +233 -0
- package/src/features/smart-art/parse-style.d.ts +19 -0
- package/src/features/smart-art/parse-style.js +39 -0
- package/src/features/smart-art/point-text.d.ts +80 -0
- package/src/features/smart-art/point-text.js +424 -0
- package/src/features/smart-art/register.d.ts +33 -0
- package/src/features/smart-art/register.js +95 -0
- package/src/features/smart-art/serialize.d.ts +40 -0
- package/src/features/smart-art/serialize.js +48 -0
- package/src/features/smart-art/types.d.ts +403 -0
- package/src/features/smart-art/types.js +28 -0
- package/src/global.js +1 -0
- package/src/index.d.ts +21 -0
- package/src/index.js +22 -0
- package/tsconfig.build.json +13 -0
- package/tsconfig.harness.json +32 -0
- package/tslint.json +111 -0
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Schema-exact Office Math simple-type unions.
|
|
3
|
+
*
|
|
4
|
+
* Source: ECMA-376 Part 1 §22.1.3 / Part 4 Annex A.8.1 `shared-math.xsd`.
|
|
5
|
+
* Serializer emits only these tokens — never synthesize members.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Math paragraph justification.
|
|
9
|
+
*
|
|
10
|
+
* Source: ECMA-376-1 §22.1.3.7 `ST_Jc`.
|
|
11
|
+
*
|
|
12
|
+
* @public
|
|
13
|
+
*/
|
|
14
|
+
export declare type MathJc = 'left' | 'right' | 'center' | 'centerGroup';
|
|
15
|
+
/**
|
|
16
|
+
* Fraction type.
|
|
17
|
+
*
|
|
18
|
+
* Source: ECMA-376-1 §22.1.3.4 `ST_FType`.
|
|
19
|
+
*
|
|
20
|
+
* @public
|
|
21
|
+
*/
|
|
22
|
+
export declare type MathFractionType = 'bar' | 'skw' | 'lin' | 'noBar';
|
|
23
|
+
/**
|
|
24
|
+
* Delimiter shape.
|
|
25
|
+
*
|
|
26
|
+
* Source: ECMA-376-1 §22.1.3.10 `ST_Shp` — `'centered' | 'match'` only
|
|
27
|
+
* (NOT `'distributed'`).
|
|
28
|
+
*
|
|
29
|
+
* @public
|
|
30
|
+
*/
|
|
31
|
+
export declare type MathShape = 'centered' | 'match';
|
|
32
|
+
/**
|
|
33
|
+
* N-ary limit location.
|
|
34
|
+
*
|
|
35
|
+
* Source: ECMA-376-1 §22.1.3.8 `ST_LimLoc`.
|
|
36
|
+
*
|
|
37
|
+
* @public
|
|
38
|
+
*/
|
|
39
|
+
export declare type MathLimLoc = 'undOvr' | 'subSup';
|
|
40
|
+
/**
|
|
41
|
+
* Top/bottom placement (bar, groupChr).
|
|
42
|
+
*
|
|
43
|
+
* Source: ECMA-376-1 §22.1.3.13 `ST_TopBot`.
|
|
44
|
+
*
|
|
45
|
+
* @public
|
|
46
|
+
*/
|
|
47
|
+
export declare type MathTopBot = 'top' | 'bot';
|
|
48
|
+
/**
|
|
49
|
+
* Break on binary operator.
|
|
50
|
+
*
|
|
51
|
+
* Source: ECMA-376-1 §22.1.3.1 `ST_BreakBin`.
|
|
52
|
+
*
|
|
53
|
+
* @public
|
|
54
|
+
*/
|
|
55
|
+
export declare type MathBreakBin = 'before' | 'after' | 'repeat';
|
|
56
|
+
/**
|
|
57
|
+
* Break-bin subscript alignment.
|
|
58
|
+
*
|
|
59
|
+
* Source: ECMA-376-1 §22.1.3.2 `ST_BreakBinSub`.
|
|
60
|
+
*
|
|
61
|
+
* @public
|
|
62
|
+
*/
|
|
63
|
+
export declare type MathBreakBinSub = '--' | '-+' | '+-';
|
|
64
|
+
/**
|
|
65
|
+
* Math script (font family class).
|
|
66
|
+
*
|
|
67
|
+
* Source: ECMA-376-1 §22.1.3.9 `ST_Script`.
|
|
68
|
+
*
|
|
69
|
+
* @public
|
|
70
|
+
*/
|
|
71
|
+
export declare type MathScript = 'roman' | 'script' | 'fraktur' | 'double-struck' | 'sans-serif' | 'monospace';
|
|
72
|
+
/**
|
|
73
|
+
* Math style (plain/bold/italic).
|
|
74
|
+
*
|
|
75
|
+
* Source: ECMA-376-1 §22.1.3.12 `ST_Style`.
|
|
76
|
+
*
|
|
77
|
+
* @public
|
|
78
|
+
*/
|
|
79
|
+
export declare type MathStyle = 'p' | 'b' | 'i' | 'bi';
|
|
80
|
+
/**
|
|
81
|
+
* Spacing rule enumeration (0..4).
|
|
82
|
+
*
|
|
83
|
+
* Source: ECMA-376-1 §22.1.3.11 `ST_SpacingRule`.
|
|
84
|
+
*
|
|
85
|
+
* @public
|
|
86
|
+
*/
|
|
87
|
+
export declare type MathSpacingRule = 0 | 1 | 2 | 3 | 4;
|
|
88
|
+
/** Members of {@link MathJc}. */
|
|
89
|
+
export declare const MATH_JC_VALUES: string[];
|
|
90
|
+
/** Members of {@link MathFractionType}. */
|
|
91
|
+
export declare const MATH_FTYPE_VALUES: string[];
|
|
92
|
+
/** Members of {@link MathShape} — centered|match only. */
|
|
93
|
+
export declare const MATH_SHP_VALUES: string[];
|
|
94
|
+
/** Members of {@link MathLimLoc}. */
|
|
95
|
+
export declare const MATH_LIMLOC_VALUES: string[];
|
|
96
|
+
/** Members of {@link MathTopBot}. */
|
|
97
|
+
export declare const MATH_TOPBOT_VALUES: string[];
|
|
98
|
+
/** Members of {@link MathBreakBin}. */
|
|
99
|
+
export declare const MATH_BREAKBIN_VALUES: string[];
|
|
100
|
+
/** Members of {@link MathBreakBinSub}. */
|
|
101
|
+
export declare const MATH_BREAKBINSUB_VALUES: string[];
|
|
102
|
+
/** Members of {@link MathScript}. */
|
|
103
|
+
export declare const MATH_SCRIPT_VALUES: string[];
|
|
104
|
+
/** Members of {@link MathStyle}. */
|
|
105
|
+
export declare const MATH_STYLE_VALUES: string[];
|
|
106
|
+
/** Members of {@link MathSpacingRule}. */
|
|
107
|
+
export declare const MATH_SPACING_RULE_VALUES: number[];
|
|
108
|
+
/** Parse ST_Jc; undefined when not a known token. */
|
|
109
|
+
export declare function parseMathJc(value: string): MathJc | undefined;
|
|
110
|
+
/** Parse ST_FType. */
|
|
111
|
+
export declare function parseMathFractionType(value: string): MathFractionType | undefined;
|
|
112
|
+
/** Parse ST_Shp. */
|
|
113
|
+
export declare function parseMathShape(value: string): MathShape | undefined;
|
|
114
|
+
/** Parse ST_LimLoc. */
|
|
115
|
+
export declare function parseMathLimLoc(value: string): MathLimLoc | undefined;
|
|
116
|
+
/** Parse ST_TopBot. */
|
|
117
|
+
export declare function parseMathTopBot(value: string): MathTopBot | undefined;
|
|
118
|
+
/** Parse ST_BreakBin. */
|
|
119
|
+
export declare function parseMathBreakBin(value: string): MathBreakBin | undefined;
|
|
120
|
+
/** Parse ST_BreakBinSub. */
|
|
121
|
+
export declare function parseMathBreakBinSub(value: string): MathBreakBinSub | undefined;
|
|
122
|
+
/** Parse ST_Script. */
|
|
123
|
+
export declare function parseMathScript(value: string): MathScript | undefined;
|
|
124
|
+
/** Parse ST_Style. */
|
|
125
|
+
export declare function parseMathStyle(value: string): MathStyle | undefined;
|
|
126
|
+
/**
|
|
127
|
+
* ST_Integer2 range −2..2 (argSz).
|
|
128
|
+
*
|
|
129
|
+
* Source: ECMA-376-1 §22.1.3.5.
|
|
130
|
+
*/
|
|
131
|
+
export declare function isInteger2(value: number): boolean;
|
|
132
|
+
/**
|
|
133
|
+
* ST_Integer255 range 1..255.
|
|
134
|
+
*
|
|
135
|
+
* Source: ECMA-376-1 §22.1.3.6.
|
|
136
|
+
*/
|
|
137
|
+
export declare function isInteger255(value: number): boolean;
|
|
138
|
+
/**
|
|
139
|
+
* ST_UnSignedInteger ≥ 0.
|
|
140
|
+
*
|
|
141
|
+
* Source: ECMA-376-1 §22.1.3.14.
|
|
142
|
+
*/
|
|
143
|
+
export declare function isUnSignedInteger(value: number): boolean;
|
|
144
|
+
/**
|
|
145
|
+
* ST_SpacingRule 0..4.
|
|
146
|
+
*
|
|
147
|
+
* Source: ECMA-376-1 §22.1.3.11.
|
|
148
|
+
*/
|
|
149
|
+
export declare function isSpacingRule(value: number): value is MathSpacingRule;
|
|
150
|
+
/** Parse OnOff-style val attribute (`1`/`true`/`on` → true). */
|
|
151
|
+
export declare function parseOnOff(value: string | undefined): boolean | undefined;
|
|
152
|
+
/** Emit OnOff as `'1'` / `'0'`. */
|
|
153
|
+
export declare function emitOnOff(value: boolean): string;
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Schema-exact Office Math simple-type unions.
|
|
3
|
+
*
|
|
4
|
+
* Source: ECMA-376 Part 1 §22.1.3 / Part 4 Annex A.8.1 `shared-math.xsd`.
|
|
5
|
+
* Serializer emits only these tokens — never synthesize members.
|
|
6
|
+
*/
|
|
7
|
+
/** Members of {@link MathJc}. */
|
|
8
|
+
export var MATH_JC_VALUES = ['left', 'right', 'center', 'centerGroup'];
|
|
9
|
+
/** Members of {@link MathFractionType}. */
|
|
10
|
+
export var MATH_FTYPE_VALUES = ['bar', 'skw', 'lin', 'noBar'];
|
|
11
|
+
/** Members of {@link MathShape} — centered|match only. */
|
|
12
|
+
export var MATH_SHP_VALUES = ['centered', 'match'];
|
|
13
|
+
/** Members of {@link MathLimLoc}. */
|
|
14
|
+
export var MATH_LIMLOC_VALUES = ['undOvr', 'subSup'];
|
|
15
|
+
/** Members of {@link MathTopBot}. */
|
|
16
|
+
export var MATH_TOPBOT_VALUES = ['top', 'bot'];
|
|
17
|
+
/** Members of {@link MathBreakBin}. */
|
|
18
|
+
export var MATH_BREAKBIN_VALUES = ['before', 'after', 'repeat'];
|
|
19
|
+
/** Members of {@link MathBreakBinSub}. */
|
|
20
|
+
export var MATH_BREAKBINSUB_VALUES = ['--', '-+', '+-'];
|
|
21
|
+
/** Members of {@link MathScript}. */
|
|
22
|
+
export var MATH_SCRIPT_VALUES = [
|
|
23
|
+
'roman',
|
|
24
|
+
'script',
|
|
25
|
+
'fraktur',
|
|
26
|
+
'double-struck',
|
|
27
|
+
'sans-serif',
|
|
28
|
+
'monospace',
|
|
29
|
+
];
|
|
30
|
+
/** Members of {@link MathStyle}. */
|
|
31
|
+
export var MATH_STYLE_VALUES = ['p', 'b', 'i', 'bi'];
|
|
32
|
+
/** Members of {@link MathSpacingRule}. */
|
|
33
|
+
export var MATH_SPACING_RULE_VALUES = [0, 1, 2, 3, 4];
|
|
34
|
+
/** Parse ST_Jc; undefined when not a known token. */
|
|
35
|
+
export function parseMathJc(value) {
|
|
36
|
+
return (MATH_JC_VALUES.indexOf(value) !== -1) ? value : undefined;
|
|
37
|
+
}
|
|
38
|
+
/** Parse ST_FType. */
|
|
39
|
+
export function parseMathFractionType(value) {
|
|
40
|
+
return (MATH_FTYPE_VALUES.indexOf(value) !== -1)
|
|
41
|
+
? value
|
|
42
|
+
: undefined;
|
|
43
|
+
}
|
|
44
|
+
/** Parse ST_Shp. */
|
|
45
|
+
export function parseMathShape(value) {
|
|
46
|
+
return (MATH_SHP_VALUES.indexOf(value) !== -1) ? value : undefined;
|
|
47
|
+
}
|
|
48
|
+
/** Parse ST_LimLoc. */
|
|
49
|
+
export function parseMathLimLoc(value) {
|
|
50
|
+
return (MATH_LIMLOC_VALUES.indexOf(value) !== -1)
|
|
51
|
+
? value
|
|
52
|
+
: undefined;
|
|
53
|
+
}
|
|
54
|
+
/** Parse ST_TopBot. */
|
|
55
|
+
export function parseMathTopBot(value) {
|
|
56
|
+
return (MATH_TOPBOT_VALUES.indexOf(value) !== -1)
|
|
57
|
+
? value
|
|
58
|
+
: undefined;
|
|
59
|
+
}
|
|
60
|
+
/** Parse ST_BreakBin. */
|
|
61
|
+
export function parseMathBreakBin(value) {
|
|
62
|
+
return (MATH_BREAKBIN_VALUES.indexOf(value) !== -1)
|
|
63
|
+
? value
|
|
64
|
+
: undefined;
|
|
65
|
+
}
|
|
66
|
+
/** Parse ST_BreakBinSub. */
|
|
67
|
+
export function parseMathBreakBinSub(value) {
|
|
68
|
+
return (MATH_BREAKBINSUB_VALUES.indexOf(value) !== -1)
|
|
69
|
+
? value
|
|
70
|
+
: undefined;
|
|
71
|
+
}
|
|
72
|
+
/** Parse ST_Script. */
|
|
73
|
+
export function parseMathScript(value) {
|
|
74
|
+
return (MATH_SCRIPT_VALUES.indexOf(value) !== -1)
|
|
75
|
+
? value
|
|
76
|
+
: undefined;
|
|
77
|
+
}
|
|
78
|
+
/** Parse ST_Style. */
|
|
79
|
+
export function parseMathStyle(value) {
|
|
80
|
+
return (MATH_STYLE_VALUES.indexOf(value) !== -1)
|
|
81
|
+
? value
|
|
82
|
+
: undefined;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* ST_Integer2 range −2..2 (argSz).
|
|
86
|
+
*
|
|
87
|
+
* Source: ECMA-376-1 §22.1.3.5.
|
|
88
|
+
*/
|
|
89
|
+
export function isInteger2(value) {
|
|
90
|
+
return Number.isInteger(value) && value >= -2 && value <= 2;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* ST_Integer255 range 1..255.
|
|
94
|
+
*
|
|
95
|
+
* Source: ECMA-376-1 §22.1.3.6.
|
|
96
|
+
*/
|
|
97
|
+
export function isInteger255(value) {
|
|
98
|
+
return Number.isInteger(value) && value >= 1 && value <= 255;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* ST_UnSignedInteger ≥ 0.
|
|
102
|
+
*
|
|
103
|
+
* Source: ECMA-376-1 §22.1.3.14.
|
|
104
|
+
*/
|
|
105
|
+
export function isUnSignedInteger(value) {
|
|
106
|
+
return Number.isInteger(value) && value >= 0;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* ST_SpacingRule 0..4.
|
|
110
|
+
*
|
|
111
|
+
* Source: ECMA-376-1 §22.1.3.11.
|
|
112
|
+
*/
|
|
113
|
+
export function isSpacingRule(value) {
|
|
114
|
+
return Number.isInteger(value) && value >= 0 && value <= 4;
|
|
115
|
+
}
|
|
116
|
+
/** Parse OnOff-style val attribute (`1`/`true`/`on` → true). */
|
|
117
|
+
export function parseOnOff(value) {
|
|
118
|
+
if (value === undefined) {
|
|
119
|
+
return undefined;
|
|
120
|
+
}
|
|
121
|
+
var v = value.toLowerCase();
|
|
122
|
+
if (v === '1' || v === 'true' || v === 'on') {
|
|
123
|
+
return true;
|
|
124
|
+
}
|
|
125
|
+
if (v === '0' || v === 'false' || v === 'off') {
|
|
126
|
+
return false;
|
|
127
|
+
}
|
|
128
|
+
return undefined;
|
|
129
|
+
}
|
|
130
|
+
/** Emit OnOff as `'1'` / `'0'`. */
|
|
131
|
+
export function emitOnOff(value) {
|
|
132
|
+
return value ? '1' : '0';
|
|
133
|
+
}
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MathElement base hierarchy for OMML typed DOM.
|
|
3
|
+
*
|
|
4
|
+
* Source: mathml-spec §7; ECMA-376-4 Annex A.8.1.
|
|
5
|
+
*/
|
|
6
|
+
import { OpenXmlElement } from '../openxml';
|
|
7
|
+
/**
|
|
8
|
+
* Discriminator for every typed math node (OMML local name or synthetic type).
|
|
9
|
+
*
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
12
|
+
export declare type MathElementType = 'oMathPara' | 'oMath' | 'arg' | 't' | 'r' | 'acc' | 'bar' | 'box' | 'borderBox' | 'd' | 'eqArr' | 'f' | 'func' | 'groupChr' | 'limLow' | 'limUpp' | 'm' | 'mr' | 'nary' | 'phant' | 'rad' | 'sPre' | 'sSub' | 'sSubSup' | 'sSup' | 'unknown';
|
|
13
|
+
/**
|
|
14
|
+
|
|
15
|
+
* @public
|
|
16
|
+
*/
|
|
17
|
+
export declare type MathElementKind = MathElementType;
|
|
18
|
+
/**
|
|
19
|
+
* Abstract base for every OMML model node.
|
|
20
|
+
*
|
|
21
|
+
* @public
|
|
22
|
+
*/
|
|
23
|
+
export declare abstract class MathElement {
|
|
24
|
+
/**
|
|
25
|
+
* Math element type matching the OMML local name (or a synthetic type such as `unknown`).
|
|
26
|
+
*/
|
|
27
|
+
abstract readonly type: MathElementType;
|
|
28
|
+
/** When true, mutation is blocked (preserve-only degradation). */
|
|
29
|
+
private _preserveOnly;
|
|
30
|
+
/** Original element retained for preserve-only / unknown nodes. */
|
|
31
|
+
private _preservedXml;
|
|
32
|
+
/** Optional dirty listener injected by docx host (document-agnostic). */
|
|
33
|
+
private _onMutate;
|
|
34
|
+
/**
|
|
35
|
+
* Whether this node is locked in preserve-only mode (mutations blocked; original OpenXML is re-emitted).
|
|
36
|
+
*
|
|
37
|
+
* @private
|
|
38
|
+
* Framework/parser state used for round-trip fidelity and host dirty tracking.
|
|
39
|
+
*/
|
|
40
|
+
readonly preserveOnly: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Captured original OpenXML tree when the node is preserve-only or cannot be fully represented.
|
|
43
|
+
*
|
|
44
|
+
* @private
|
|
45
|
+
* Used by the serializer and hosts to round-trip unmodified structure.
|
|
46
|
+
*/
|
|
47
|
+
readonly preservedXml: OpenXmlElement | undefined;
|
|
48
|
+
/**
|
|
49
|
+
* Registers an internal mutation callback for change tracking and document synchronization.
|
|
50
|
+
*
|
|
51
|
+
* @private
|
|
52
|
+
* Hosts (for example docx `MathInline`) inject dirty tracking; not part of the authoring API.
|
|
53
|
+
*/
|
|
54
|
+
setMutationListener(listener: (() => void) | undefined): void;
|
|
55
|
+
/**
|
|
56
|
+
* Marks this node preserve-only and stores the original OpenXML for round-trip preservation.
|
|
57
|
+
*
|
|
58
|
+
* @private
|
|
59
|
+
* Used by the OMML parser for structural degradation and by document hosts to bubble a
|
|
60
|
+
* child-level preserve-only lock up to the equation root.
|
|
61
|
+
*/
|
|
62
|
+
markPreserveOnly(xml: OpenXmlElement): void;
|
|
63
|
+
/**
|
|
64
|
+
* Attach preserved XML without locking mutation (UnknownMathElement).
|
|
65
|
+
*
|
|
66
|
+
* @private
|
|
67
|
+
*/
|
|
68
|
+
attachPreservedXml(xml: OpenXmlElement): void;
|
|
69
|
+
/** Guard + notify after a successful mutation. */
|
|
70
|
+
protected notifyMutated(): void;
|
|
71
|
+
/** Throw if preserve-only before a mutation begins. */
|
|
72
|
+
protected assertMutable(): void;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Math text leaf (`m:t`) — literal character content inside a math run.
|
|
76
|
+
*
|
|
77
|
+
* Source: ECMA-376-1 §22.1.2.116 `CT_Text` — UTF-8 passthrough, no substitution.
|
|
78
|
+
*
|
|
79
|
+
* @public
|
|
80
|
+
*/
|
|
81
|
+
export declare class MathText extends MathElement {
|
|
82
|
+
/**
|
|
83
|
+
* Math element type for this text leaf (`t`).
|
|
84
|
+
*/
|
|
85
|
+
readonly type = "t";
|
|
86
|
+
private _value;
|
|
87
|
+
private _xmlSpace;
|
|
88
|
+
constructor(value?: string, xmlSpace?: 'default' | 'preserve');
|
|
89
|
+
/**
|
|
90
|
+
* Raw text content of this math text element (full UTF-8, no substitution).
|
|
91
|
+
*/
|
|
92
|
+
value: string;
|
|
93
|
+
/**
|
|
94
|
+
* Optional `xml:space` on `m:t` (`default` | `preserve`), same policy as Word `w:t`.
|
|
95
|
+
*
|
|
96
|
+
* @private
|
|
97
|
+
* Serialization attribute for whitespace fidelity; prefer setting text via {@link value}.
|
|
98
|
+
*/
|
|
99
|
+
xmlSpace: 'default' | 'preserve' | undefined;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Argument-size property bag (`m:argPr` → `m:argSz`).
|
|
103
|
+
*
|
|
104
|
+
* Source: ECMA-376-4 Annex A.8.1 `CT_OMathArgPr` / `ST_Integer2` (−2..2).
|
|
105
|
+
*
|
|
106
|
+
* @public
|
|
107
|
+
*/
|
|
108
|
+
export interface MathArgProperties {
|
|
109
|
+
readonly argSz?: number;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Argument container that holds ordered math elements inside a larger structure.
|
|
113
|
+
*
|
|
114
|
+
* @public
|
|
115
|
+
*/
|
|
116
|
+
export declare class MathArgument extends MathElement {
|
|
117
|
+
/**
|
|
118
|
+
* Discriminator for this math argument container.
|
|
119
|
+
*
|
|
120
|
+
* @public
|
|
121
|
+
*/
|
|
122
|
+
readonly type = "arg";
|
|
123
|
+
private _properties;
|
|
124
|
+
private _item;
|
|
125
|
+
private _ctrlPr;
|
|
126
|
+
constructor(properties?: MathArgProperties, item?: ReadonlyArray<MathElement>, ctrlPr?: OpenXmlElement);
|
|
127
|
+
/**
|
|
128
|
+
* Gets or sets argument properties such as script size.
|
|
129
|
+
*
|
|
130
|
+
* @throws MathmlValidationError when script size is outside the allowed integer range.
|
|
131
|
+
*
|
|
132
|
+
* @public
|
|
133
|
+
*/
|
|
134
|
+
properties: Readonly<MathArgProperties>;
|
|
135
|
+
/**
|
|
136
|
+
* Gets or sets the ordered math elements inside this argument.
|
|
137
|
+
*
|
|
138
|
+
* @public
|
|
139
|
+
*/
|
|
140
|
+
item: ReadonlyArray<MathElement>;
|
|
141
|
+
/**
|
|
142
|
+
* Opaque control properties (`m:ctrlPr`) carried on the argument, when present.
|
|
143
|
+
*
|
|
144
|
+
* @private
|
|
145
|
+
* Wire-fidelity carrier for WML run properties; not part of the public authoring API.
|
|
146
|
+
*/
|
|
147
|
+
/**
|
|
148
|
+
* @private
|
|
149
|
+
*/
|
|
150
|
+
ctrlPr: OpenXmlElement | undefined;
|
|
151
|
+
/**
|
|
152
|
+
* Appends one math element at the end of {@link MathArgument.item}.
|
|
153
|
+
*/
|
|
154
|
+
appendItem(child: MathElement): MathElement;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Escape hatch for unrecognized `m:*` elements.
|
|
158
|
+
*
|
|
159
|
+
* Source: mathml-spec §8.5 — re-serializes verbatim.
|
|
160
|
+
*
|
|
161
|
+
* @public
|
|
162
|
+
*/
|
|
163
|
+
export declare class UnknownMathElement extends MathElement {
|
|
164
|
+
readonly type = "unknown";
|
|
165
|
+
readonly localName: string;
|
|
166
|
+
constructor(localName: string, xml: OpenXmlElement);
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Convenience: build MathArgument from a list of elements.
|
|
170
|
+
*
|
|
171
|
+
* @private
|
|
172
|
+
*/
|
|
173
|
+
export declare function mathArg(...elements: MathElement[]): MathArgument;
|