modern-idoc 0.0.3 → 0.1.0
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/README.md +43 -21
- package/dist/index.cjs +192 -3
- package/dist/index.d.cts +162 -101
- package/dist/index.d.mts +162 -101
- package/dist/index.d.ts +162 -101
- package/dist/index.js +1 -1
- package/dist/index.mjs +184 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -21,46 +21,68 @@
|
|
|
21
21
|
## Usage
|
|
22
22
|
|
|
23
23
|
```ts
|
|
24
|
-
import type {
|
|
24
|
+
import type { IDOCDocument } from 'modern-idoc'
|
|
25
25
|
|
|
26
|
-
const
|
|
27
|
-
name: 'example.pptx',
|
|
26
|
+
const pdf: IDOCDocument = {
|
|
28
27
|
children: [
|
|
29
28
|
{
|
|
30
|
-
name: 'ppt/slides/slide1.xml',
|
|
31
29
|
style: {
|
|
32
|
-
width:
|
|
33
|
-
height:
|
|
34
|
-
},
|
|
35
|
-
meta: {
|
|
36
|
-
layout: 'ppt/slideLayous/slideLayout1.xml',
|
|
30
|
+
width: 300,
|
|
31
|
+
height: 600,
|
|
37
32
|
},
|
|
38
33
|
children: [
|
|
39
34
|
{
|
|
40
|
-
type: 'image',
|
|
41
35
|
style: {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
height: 400,
|
|
36
|
+
rotate: 60,
|
|
37
|
+
width: 50,
|
|
38
|
+
height: 50,
|
|
46
39
|
},
|
|
47
|
-
|
|
40
|
+
image: '/example.png',
|
|
48
41
|
},
|
|
49
42
|
{
|
|
50
|
-
type: 'text',
|
|
51
43
|
style: {
|
|
44
|
+
rotate: 40,
|
|
52
45
|
left: 100,
|
|
53
46
|
top: 100,
|
|
47
|
+
fontSize: 20,
|
|
48
|
+
color: '#FF00FF',
|
|
54
49
|
},
|
|
55
|
-
|
|
50
|
+
text: 'test',
|
|
56
51
|
},
|
|
57
52
|
{
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
53
|
+
style: {
|
|
54
|
+
left: 200,
|
|
55
|
+
top: 100,
|
|
56
|
+
width: 100,
|
|
57
|
+
height: 200,
|
|
58
|
+
fontSize: 22,
|
|
59
|
+
},
|
|
60
|
+
text: [
|
|
61
|
+
{
|
|
62
|
+
letterSpacing: 3,
|
|
63
|
+
fragments: [
|
|
64
|
+
{
|
|
65
|
+
content: 'He',
|
|
66
|
+
color: '#00FF00',
|
|
67
|
+
fontSize: 12,
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
content: 'llo',
|
|
71
|
+
color: '#000000',
|
|
72
|
+
},
|
|
73
|
+
],
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
content: ', ',
|
|
77
|
+
color: '#FF0000',
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
content: 'World!',
|
|
81
|
+
color: '#0000FF',
|
|
82
|
+
},
|
|
61
83
|
],
|
|
62
84
|
},
|
|
63
|
-
]
|
|
85
|
+
],
|
|
64
86
|
},
|
|
65
87
|
],
|
|
66
88
|
}
|
package/dist/index.cjs
CHANGED
|
@@ -48,7 +48,6 @@ function getDefaultElementStyle() {
|
|
|
48
48
|
|
|
49
49
|
function getDefaultTextStyle() {
|
|
50
50
|
return {
|
|
51
|
-
...getDefaultElementStyle(),
|
|
52
51
|
writingMode: "horizontal-tb",
|
|
53
52
|
verticalAlign: "baseline",
|
|
54
53
|
lineHeight: 1.2,
|
|
@@ -78,15 +77,205 @@ function getDefaultTextStyle() {
|
|
|
78
77
|
listStyleColormap: "none",
|
|
79
78
|
listStyleSize: "cover",
|
|
80
79
|
listStylePosition: "outside",
|
|
81
|
-
//
|
|
80
|
+
// highlight
|
|
82
81
|
highlightImage: "none",
|
|
83
82
|
highlightReferImage: "none",
|
|
84
83
|
highlightColormap: "none",
|
|
85
84
|
highlightLine: "none",
|
|
86
85
|
highlightSize: "cover",
|
|
87
|
-
highlightThickness: "100%"
|
|
86
|
+
highlightThickness: "100%",
|
|
87
|
+
// transform
|
|
88
|
+
scaleX: 1,
|
|
89
|
+
scaleY: 1,
|
|
90
|
+
skewX: 0,
|
|
91
|
+
skewY: 0,
|
|
92
|
+
translateX: 0,
|
|
93
|
+
translateY: 0,
|
|
94
|
+
transform: "none",
|
|
95
|
+
transformOrigin: "50% 50%",
|
|
96
|
+
// shadow
|
|
97
|
+
shadowColor: "transparent",
|
|
98
|
+
shadowOffsetX: 0,
|
|
99
|
+
shadowOffsetY: 0,
|
|
100
|
+
shadowBlur: 0
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
function getDefaultStyle() {
|
|
105
|
+
return {
|
|
106
|
+
...getDefaultElementStyle(),
|
|
107
|
+
...getDefaultTextStyle()
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function normalizeFill(fill) {
|
|
112
|
+
if (!fill || fill === "none") {
|
|
113
|
+
return void 0;
|
|
114
|
+
} else if (typeof fill === "string") {
|
|
115
|
+
return {
|
|
116
|
+
color: fill
|
|
117
|
+
};
|
|
118
|
+
} else {
|
|
119
|
+
return fill;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
function normalizeGeometry(geometry) {
|
|
124
|
+
if (!geometry || geometry === "none") {
|
|
125
|
+
return void 0;
|
|
126
|
+
} else if (typeof geometry === "string") {
|
|
127
|
+
return {
|
|
128
|
+
data: [
|
|
129
|
+
{ data: geometry }
|
|
130
|
+
]
|
|
131
|
+
};
|
|
132
|
+
} else if (Array.isArray(geometry)) {
|
|
133
|
+
return {
|
|
134
|
+
data: geometry.map((data) => {
|
|
135
|
+
return {
|
|
136
|
+
data
|
|
137
|
+
};
|
|
138
|
+
})
|
|
139
|
+
};
|
|
140
|
+
} else {
|
|
141
|
+
return {
|
|
142
|
+
...geometry,
|
|
143
|
+
data: geometry.data.map((data) => {
|
|
144
|
+
if (typeof data === "string") {
|
|
145
|
+
return {
|
|
146
|
+
data
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
return data;
|
|
150
|
+
})
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
function normalizeImage(image) {
|
|
156
|
+
if (!image || image === "none") {
|
|
157
|
+
return void 0;
|
|
158
|
+
} else if (typeof image === "string") {
|
|
159
|
+
return {
|
|
160
|
+
src: image
|
|
161
|
+
};
|
|
162
|
+
} else {
|
|
163
|
+
return image;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
function normalizeStroke(stroke) {
|
|
168
|
+
if (!stroke || stroke === "none") {
|
|
169
|
+
return void 0;
|
|
170
|
+
} else if (typeof stroke === "string") {
|
|
171
|
+
return {
|
|
172
|
+
color: stroke
|
|
173
|
+
};
|
|
174
|
+
} else {
|
|
175
|
+
return stroke;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
function normalizeTextContent(content = "") {
|
|
180
|
+
const list = Array.isArray(content) ? content : [content];
|
|
181
|
+
return list.map((p) => {
|
|
182
|
+
if (typeof p === "string") {
|
|
183
|
+
return {
|
|
184
|
+
fragments: [
|
|
185
|
+
{ content: p }
|
|
186
|
+
]
|
|
187
|
+
};
|
|
188
|
+
} else if ("content" in p) {
|
|
189
|
+
return {
|
|
190
|
+
fragments: [
|
|
191
|
+
{ ...p }
|
|
192
|
+
]
|
|
193
|
+
};
|
|
194
|
+
} else if ("fragments" in p) {
|
|
195
|
+
return {
|
|
196
|
+
...p,
|
|
197
|
+
fragments: p.fragments.map((f) => ({ ...f }))
|
|
198
|
+
};
|
|
199
|
+
} else if (Array.isArray(p)) {
|
|
200
|
+
return {
|
|
201
|
+
fragments: p.map((f) => {
|
|
202
|
+
if (typeof f === "string") {
|
|
203
|
+
return {
|
|
204
|
+
content: f
|
|
205
|
+
};
|
|
206
|
+
} else {
|
|
207
|
+
return { ...f };
|
|
208
|
+
}
|
|
209
|
+
})
|
|
210
|
+
};
|
|
211
|
+
} else {
|
|
212
|
+
return {
|
|
213
|
+
fragments: []
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
function normalizeText(text) {
|
|
220
|
+
if (!text || text === "none") {
|
|
221
|
+
return void 0;
|
|
222
|
+
} else if (typeof text === "string") {
|
|
223
|
+
return {
|
|
224
|
+
content: [
|
|
225
|
+
{
|
|
226
|
+
fragments: [
|
|
227
|
+
{ content: text }
|
|
228
|
+
]
|
|
229
|
+
}
|
|
230
|
+
]
|
|
231
|
+
};
|
|
232
|
+
} else if ("content" in text) {
|
|
233
|
+
return {
|
|
234
|
+
...text,
|
|
235
|
+
content: normalizeTextContent(text.content)
|
|
236
|
+
};
|
|
237
|
+
} else {
|
|
238
|
+
return {
|
|
239
|
+
content: normalizeTextContent(text)
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
function normalizeVideo(video) {
|
|
245
|
+
if (!video || video === "none") {
|
|
246
|
+
return void 0;
|
|
247
|
+
} else if (typeof video === "string") {
|
|
248
|
+
return {
|
|
249
|
+
src: video
|
|
250
|
+
};
|
|
251
|
+
} else {
|
|
252
|
+
return {
|
|
253
|
+
...video
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
function normalizeElement(element) {
|
|
259
|
+
return {
|
|
260
|
+
...element,
|
|
261
|
+
image: normalizeImage(element.image),
|
|
262
|
+
video: normalizeVideo(element.video),
|
|
263
|
+
text: normalizeText(element.text),
|
|
264
|
+
geometry: normalizeGeometry(element.geometry),
|
|
265
|
+
fill: normalizeFill(element.fill),
|
|
266
|
+
stroke: normalizeStroke(element.stroke),
|
|
267
|
+
children: element.children?.map((child) => normalizeElement(child))
|
|
88
268
|
};
|
|
89
269
|
}
|
|
90
270
|
|
|
91
271
|
exports.getDefaultElementStyle = getDefaultElementStyle;
|
|
272
|
+
exports.getDefaultStyle = getDefaultStyle;
|
|
92
273
|
exports.getDefaultTextStyle = getDefaultTextStyle;
|
|
274
|
+
exports.normalizeElement = normalizeElement;
|
|
275
|
+
exports.normalizeFill = normalizeFill;
|
|
276
|
+
exports.normalizeGeometry = normalizeGeometry;
|
|
277
|
+
exports.normalizeImage = normalizeImage;
|
|
278
|
+
exports.normalizeStroke = normalizeStroke;
|
|
279
|
+
exports.normalizeText = normalizeText;
|
|
280
|
+
exports.normalizeTextContent = normalizeTextContent;
|
|
281
|
+
exports.normalizeVideo = normalizeVideo;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,32 +1,27 @@
|
|
|
1
|
-
interface
|
|
2
|
-
|
|
1
|
+
interface IDOCNormalizedFillProp {
|
|
2
|
+
color?: string;
|
|
3
|
+
image?: string;
|
|
4
|
+
opacity?: number;
|
|
3
5
|
}
|
|
4
6
|
|
|
5
|
-
|
|
6
|
-
src: string;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
interface IImage extends IElement {
|
|
10
|
-
type: 'image';
|
|
11
|
-
src: string;
|
|
12
|
-
}
|
|
7
|
+
type IDOCFillProp = 'none' | string | IDOCNormalizedFillProp;
|
|
13
8
|
|
|
9
|
+
type SVGPathData = string;
|
|
14
10
|
type FillRule = 'nonzero' | 'evenodd';
|
|
15
11
|
type StrokeLinecap = 'butt' | 'round' | 'square';
|
|
16
12
|
type StrokeLinejoin = 'arcs' | 'bevel' | 'miter' | 'miter-clip' | 'round';
|
|
17
|
-
interface
|
|
18
|
-
|
|
19
|
-
|
|
13
|
+
interface IDOCPath2DStyle {
|
|
14
|
+
[key: string]: any;
|
|
15
|
+
opacity: number;
|
|
16
|
+
visibility: string;
|
|
20
17
|
shadowColor: string;
|
|
21
18
|
shadowOffsetX: number;
|
|
22
19
|
shadowOffsetY: number;
|
|
23
20
|
shadowBlur: number;
|
|
24
|
-
|
|
25
|
-
interface IPathStyle extends IPathDrawStyle {
|
|
26
|
-
[key: string]: any;
|
|
21
|
+
fill: string;
|
|
27
22
|
fillOpacity: number;
|
|
28
23
|
fillRule: FillRule;
|
|
29
|
-
|
|
24
|
+
stroke: string;
|
|
30
25
|
strokeOpacity: number;
|
|
31
26
|
strokeWidth: number;
|
|
32
27
|
strokeLinecap: StrokeLinecap;
|
|
@@ -34,56 +29,42 @@ interface IPathStyle extends IPathDrawStyle {
|
|
|
34
29
|
strokeMiterlimit: number;
|
|
35
30
|
strokeDasharray: number[];
|
|
36
31
|
strokeDashoffset: number;
|
|
37
|
-
visibility: string;
|
|
38
32
|
}
|
|
39
|
-
interface
|
|
40
|
-
data:
|
|
33
|
+
interface IDOCPath2D extends Partial<IDOCPath2DStyle> {
|
|
34
|
+
data: SVGPathData;
|
|
41
35
|
}
|
|
36
|
+
interface IDOCGeometryPropObject {
|
|
37
|
+
data: (IDOCPath2D | SVGPathData)[];
|
|
38
|
+
}
|
|
39
|
+
type IDOCGeometryProp = 'none' | SVGPathData | SVGPathData[] | IDOCGeometryPropObject;
|
|
42
40
|
|
|
43
|
-
interface
|
|
44
|
-
|
|
45
|
-
|
|
41
|
+
interface IDOCNormalizedImageProp {
|
|
42
|
+
src: string;
|
|
43
|
+
opacity?: number;
|
|
46
44
|
}
|
|
47
45
|
|
|
48
|
-
type
|
|
49
|
-
|
|
50
|
-
interface
|
|
51
|
-
|
|
52
|
-
visibility: Visibility;
|
|
53
|
-
filter: string;
|
|
54
|
-
left: number;
|
|
55
|
-
top: number;
|
|
56
|
-
width: number;
|
|
57
|
-
height: number;
|
|
58
|
-
rotate: number;
|
|
59
|
-
opacity: number;
|
|
60
|
-
marginLeft: number;
|
|
61
|
-
marginTop: number;
|
|
62
|
-
marginRight: number;
|
|
63
|
-
marginBottom: number;
|
|
64
|
-
paddingLeft: number;
|
|
65
|
-
paddingTop: number;
|
|
66
|
-
paddingRight: number;
|
|
67
|
-
paddingBottom: number;
|
|
68
|
-
scaleX: number;
|
|
69
|
-
scaleY: number;
|
|
70
|
-
skewX: number;
|
|
71
|
-
skewY: number;
|
|
72
|
-
translateX: number;
|
|
73
|
-
translateY: number;
|
|
74
|
-
transform: string;
|
|
75
|
-
transformOrigin: string;
|
|
76
|
-
backgroundImage: string;
|
|
77
|
-
backgroundColor: string;
|
|
78
|
-
shadowColor: string;
|
|
79
|
-
shadowOffsetX: number;
|
|
80
|
-
shadowOffsetY: number;
|
|
81
|
-
shadowBlur: number;
|
|
82
|
-
borderRadius: number;
|
|
83
|
-
borderColor: string;
|
|
84
|
-
borderWidth: number;
|
|
46
|
+
type IDOCImageProp = 'none' | string | IDOCNormalizedImageProp;
|
|
47
|
+
|
|
48
|
+
interface IDOCMetaProp {
|
|
49
|
+
[key: string]: any;
|
|
85
50
|
}
|
|
86
51
|
|
|
52
|
+
interface IDOCNode {
|
|
53
|
+
name?: string;
|
|
54
|
+
children?: IDOCNode[];
|
|
55
|
+
meta?: IDOCMetaProp;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
interface IDOCNormalizedStrokeProp {
|
|
59
|
+
color?: string;
|
|
60
|
+
image?: string;
|
|
61
|
+
opacity?: number;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
type IDOCStrokeProp = 'none' | string | IDOCNormalizedStrokeProp;
|
|
65
|
+
|
|
66
|
+
type Overflow = 'hidden' | 'visible';
|
|
67
|
+
type Visibility = 'hidden' | 'visible';
|
|
87
68
|
type FontWeight = 'normal' | 'bold' | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900;
|
|
88
69
|
type FontStyle = 'normal' | 'italic' | 'oblique' | `oblique ${string}`;
|
|
89
70
|
type FontKerning = 'none' | 'auto' | 'normal';
|
|
@@ -100,15 +81,15 @@ type ListStyleImage = 'none' | string;
|
|
|
100
81
|
type ListStyleColormap = 'none' | Record<string, string>;
|
|
101
82
|
type ListStyleSize = 'cover' | Sizeable;
|
|
102
83
|
type ListStylePosition = 'inside' | 'outside';
|
|
103
|
-
interface
|
|
84
|
+
interface IDOCListStyleObject {
|
|
104
85
|
type: ListStyleType;
|
|
105
86
|
image: ListStyleImage;
|
|
106
87
|
colormap: ListStyleColormap;
|
|
107
88
|
size: ListStyleSize;
|
|
108
89
|
position: ListStylePosition;
|
|
109
90
|
}
|
|
110
|
-
interface
|
|
111
|
-
listStyle?: Partial<
|
|
91
|
+
interface IDOCListStyleStyle {
|
|
92
|
+
listStyle?: Partial<IDOCListStyleObject>;
|
|
112
93
|
listStyleType: ListStyleType;
|
|
113
94
|
listStyleImage: ListStyleImage;
|
|
114
95
|
listStyleColormap: ListStyleColormap;
|
|
@@ -121,7 +102,7 @@ type HighlightReferImage = 'none' | string;
|
|
|
121
102
|
type HighlightColormap = 'none' | Record<string, string>;
|
|
122
103
|
type HighlightSize = 'cover' | Sizeable;
|
|
123
104
|
type HighlightThickness = Sizeable;
|
|
124
|
-
interface
|
|
105
|
+
interface IDOCHighlightObject {
|
|
125
106
|
image: HighlightImage;
|
|
126
107
|
referImage: HighlightReferImage;
|
|
127
108
|
colormap: HighlightColormap;
|
|
@@ -129,8 +110,8 @@ interface Highlight {
|
|
|
129
110
|
size: HighlightSize;
|
|
130
111
|
thickness: HighlightThickness;
|
|
131
112
|
}
|
|
132
|
-
interface
|
|
133
|
-
highlight?: Partial<
|
|
113
|
+
interface IDOCHighlightStyle {
|
|
114
|
+
highlight?: Partial<IDOCHighlightObject>;
|
|
134
115
|
highlightImage: HighlightImage;
|
|
135
116
|
highlightReferImage: HighlightReferImage;
|
|
136
117
|
highlightColormap: HighlightColormap;
|
|
@@ -138,14 +119,37 @@ interface TextHighlightStyle {
|
|
|
138
119
|
highlightSize: HighlightSize;
|
|
139
120
|
highlightThickness: HighlightThickness;
|
|
140
121
|
}
|
|
141
|
-
interface
|
|
122
|
+
interface IDCOShadowObject {
|
|
123
|
+
color: string;
|
|
124
|
+
offsetX: number;
|
|
125
|
+
offsetY: number;
|
|
126
|
+
blur: number;
|
|
127
|
+
}
|
|
128
|
+
interface IDOCShadowStyle {
|
|
129
|
+
shadow?: Partial<IDCOShadowObject>;
|
|
130
|
+
shadowColor: string;
|
|
131
|
+
shadowOffsetX: number;
|
|
132
|
+
shadowOffsetY: number;
|
|
133
|
+
shadowBlur: number;
|
|
134
|
+
}
|
|
135
|
+
interface IDOCTransformStyle {
|
|
136
|
+
scaleX: number;
|
|
137
|
+
scaleY: number;
|
|
138
|
+
skewX: number;
|
|
139
|
+
skewY: number;
|
|
140
|
+
translateX: number;
|
|
141
|
+
translateY: number;
|
|
142
|
+
transform: string;
|
|
143
|
+
transformOrigin: string;
|
|
144
|
+
}
|
|
145
|
+
interface IDOCTextLineStyle extends IDOCListStyleStyle {
|
|
142
146
|
writingMode: WritingMode;
|
|
143
147
|
textWrap: TextWrap;
|
|
144
148
|
textAlign: TextAlign;
|
|
145
149
|
textIndent: number;
|
|
146
150
|
lineHeight: number;
|
|
147
151
|
}
|
|
148
|
-
interface
|
|
152
|
+
interface IDOCTextInlineStyle extends IDOCHighlightStyle {
|
|
149
153
|
color: string;
|
|
150
154
|
verticalAlign: VerticalAlign;
|
|
151
155
|
letterSpacing: number;
|
|
@@ -159,59 +163,116 @@ interface ITextInlineStyle extends TextHighlightStyle {
|
|
|
159
163
|
textOrientation: TextOrientation;
|
|
160
164
|
textDecoration: TextDecorationLine;
|
|
161
165
|
}
|
|
162
|
-
interface
|
|
166
|
+
interface IDOCTextDrawStyle extends IDOCShadowStyle, IDOCTransformStyle {
|
|
163
167
|
textStrokeWidth: number;
|
|
164
168
|
textStrokeColor: string;
|
|
165
|
-
shadowColor: string;
|
|
166
|
-
shadowOffsetX: number;
|
|
167
|
-
shadowOffsetY: number;
|
|
168
|
-
shadowBlur: number;
|
|
169
|
-
translateX: number;
|
|
170
|
-
translateY: number;
|
|
171
|
-
skewX: number;
|
|
172
|
-
skewY: number;
|
|
173
169
|
}
|
|
174
|
-
interface
|
|
170
|
+
interface IDOCTextStyle extends IDOCTextLineStyle, IDOCTextInlineStyle, IDOCTextDrawStyle {
|
|
171
|
+
}
|
|
172
|
+
interface IDOCElementStyle extends IDOCShadowStyle, IDOCTransformStyle {
|
|
173
|
+
overflow: Overflow;
|
|
174
|
+
visibility: Visibility;
|
|
175
|
+
filter: string;
|
|
176
|
+
left: number;
|
|
177
|
+
top: number;
|
|
178
|
+
width: number;
|
|
179
|
+
height: number;
|
|
180
|
+
rotate: number;
|
|
181
|
+
opacity: number;
|
|
182
|
+
marginLeft: number;
|
|
183
|
+
marginTop: number;
|
|
184
|
+
marginRight: number;
|
|
185
|
+
marginBottom: number;
|
|
186
|
+
paddingLeft: number;
|
|
187
|
+
paddingTop: number;
|
|
188
|
+
paddingRight: number;
|
|
189
|
+
paddingBottom: number;
|
|
190
|
+
backgroundImage: string;
|
|
191
|
+
backgroundColor: string;
|
|
192
|
+
borderRadius: number;
|
|
193
|
+
borderColor: string;
|
|
194
|
+
borderWidth: number;
|
|
195
|
+
}
|
|
196
|
+
interface IDOCStyleProp extends IDOCTextStyle, IDOCElementStyle {
|
|
175
197
|
}
|
|
176
198
|
|
|
177
|
-
interface
|
|
199
|
+
interface IDOCFragmentContent extends Partial<IDOCStyleProp> {
|
|
178
200
|
content: string;
|
|
179
201
|
}
|
|
180
|
-
interface
|
|
181
|
-
fragments:
|
|
202
|
+
interface IDOCParagraphContent extends Partial<IDOCStyleProp> {
|
|
203
|
+
fragments: IDOCFragmentContent[];
|
|
182
204
|
}
|
|
183
|
-
type
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
205
|
+
type IDOCFlatTextContent = string | IDOCFragmentContent | IDOCParagraphContent | (string | IDOCFragmentContent)[];
|
|
206
|
+
type IDOCTextContent = string | IDOCFragmentContent | IDOCParagraphContent | IDOCFlatTextContent[];
|
|
207
|
+
type IDOCNormalizedTextContent = IDOCParagraphContent[];
|
|
208
|
+
interface IDOCTextObject {
|
|
209
|
+
content: IDOCTextContent;
|
|
210
|
+
effects?: Partial<IDOCStyleProp>[];
|
|
188
211
|
measureDom?: any;
|
|
189
212
|
fonts?: any;
|
|
190
213
|
}
|
|
214
|
+
type IDOCTextProp = string | IDOCTextContent | IDOCTextObject;
|
|
191
215
|
|
|
192
|
-
interface
|
|
193
|
-
type: 'video';
|
|
216
|
+
interface IDOCNormalizedVideoProp {
|
|
194
217
|
src: string;
|
|
218
|
+
opacity?: number;
|
|
195
219
|
}
|
|
196
220
|
|
|
197
|
-
type
|
|
198
|
-
|
|
199
|
-
type IElementMeta = Record<string, any>;
|
|
221
|
+
type IDOCVideoProp = 'none' | string | IDOCNormalizedVideoProp;
|
|
200
222
|
|
|
201
|
-
interface
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
223
|
+
interface IDOCElement extends IDOCNode {
|
|
224
|
+
style?: Partial<IDOCStyleProp>;
|
|
225
|
+
image?: IDOCImageProp;
|
|
226
|
+
video?: IDOCVideoProp;
|
|
227
|
+
text?: IDOCTextProp;
|
|
228
|
+
geometry?: IDOCGeometryProp;
|
|
229
|
+
fill?: IDOCFillProp;
|
|
230
|
+
stroke?: IDOCStrokeProp;
|
|
231
|
+
children?: IDOCElement[];
|
|
207
232
|
}
|
|
208
233
|
|
|
209
|
-
interface
|
|
234
|
+
interface IDOCDocument extends IDOCElement {
|
|
210
235
|
fonts?: any;
|
|
211
236
|
}
|
|
212
237
|
|
|
213
|
-
|
|
238
|
+
interface IDOCNormalizedGeometryProp extends IDOCGeometryPropObject {
|
|
239
|
+
data: IDOCPath2D[];
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
interface IDOCNormalizedTextProp extends IDOCTextObject {
|
|
243
|
+
content: IDOCNormalizedTextContent;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
interface IDOCNormalizedElement extends IDOCElement {
|
|
247
|
+
image?: IDOCNormalizedImageProp;
|
|
248
|
+
video?: IDOCNormalizedVideoProp;
|
|
249
|
+
text?: IDOCNormalizedTextProp;
|
|
250
|
+
geometry?: IDOCNormalizedGeometryProp;
|
|
251
|
+
fill?: IDOCNormalizedFillProp;
|
|
252
|
+
stroke?: IDOCNormalizedStrokeProp;
|
|
253
|
+
children?: IDOCNormalizedElement[];
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
declare function getDefaultElementStyle(): IDOCElementStyle;
|
|
257
|
+
|
|
258
|
+
declare function getDefaultStyle(): IDOCStyleProp;
|
|
259
|
+
|
|
260
|
+
declare function getDefaultTextStyle(): IDOCTextStyle;
|
|
261
|
+
|
|
262
|
+
declare function normalizeElement(element: IDOCElement): IDOCNormalizedElement;
|
|
263
|
+
|
|
264
|
+
declare function normalizeFill(fill?: IDOCFillProp): IDOCNormalizedFillProp | undefined;
|
|
265
|
+
|
|
266
|
+
declare function normalizeGeometry(geometry?: IDOCGeometryProp): IDOCNormalizedGeometryProp | undefined;
|
|
267
|
+
|
|
268
|
+
declare function normalizeImage(image?: IDOCImageProp): IDOCNormalizedImageProp | undefined;
|
|
269
|
+
|
|
270
|
+
declare function normalizeStroke(stroke?: IDOCStrokeProp): IDOCNormalizedStrokeProp | undefined;
|
|
271
|
+
|
|
272
|
+
declare function normalizeText(text?: IDOCTextProp): IDOCNormalizedTextProp | undefined;
|
|
273
|
+
|
|
274
|
+
declare function normalizeTextContent(content?: IDOCTextContent): IDOCNormalizedTextContent;
|
|
214
275
|
|
|
215
|
-
declare function
|
|
276
|
+
declare function normalizeVideo(video?: IDOCVideoProp): IDOCNormalizedVideoProp | undefined;
|
|
216
277
|
|
|
217
|
-
export { type FillRule, type FontKerning, type FontStyle, type FontWeight, type
|
|
278
|
+
export { type FillRule, type FontKerning, type FontStyle, type FontWeight, type HighlightColormap, type HighlightImage, type HighlightLine, type HighlightReferImage, type HighlightSize, type HighlightThickness, type IDCOShadowObject, type IDOCDocument, type IDOCElement, type IDOCElementStyle, type IDOCFillProp, type IDOCFlatTextContent, type IDOCFragmentContent, type IDOCGeometryProp, type IDOCGeometryPropObject, type IDOCHighlightObject, type IDOCHighlightStyle, type IDOCImageProp, type IDOCListStyleObject, type IDOCListStyleStyle, type IDOCMetaProp, type IDOCNode, type IDOCNormalizedElement, type IDOCNormalizedFillProp, type IDOCNormalizedGeometryProp, type IDOCNormalizedImageProp, type IDOCNormalizedStrokeProp, type IDOCNormalizedTextContent, type IDOCNormalizedTextProp, type IDOCNormalizedVideoProp, type IDOCParagraphContent, type IDOCPath2D, type IDOCPath2DStyle, type IDOCShadowStyle, type IDOCStrokeProp, type IDOCStyleProp, type IDOCTextContent, type IDOCTextDrawStyle, type IDOCTextInlineStyle, type IDOCTextLineStyle, type IDOCTextObject, type IDOCTextProp, type IDOCTextStyle, type IDOCTransformStyle, type IDOCVideoProp, type ListStyleColormap, type ListStyleImage, type ListStylePosition, type ListStyleSize, type ListStyleType, type Overflow, type SVGPathData, type Sizeable, type StrokeLinecap, type StrokeLinejoin, type TextAlign, type TextDecorationLine, type TextOrientation, type TextTransform, type TextWrap, type VerticalAlign, type Visibility, type WritingMode, getDefaultElementStyle, getDefaultStyle, getDefaultTextStyle, normalizeElement, normalizeFill, normalizeGeometry, normalizeImage, normalizeStroke, normalizeText, normalizeTextContent, normalizeVideo };
|