modern-idoc 0.0.3 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +43 -21
- package/dist/index.cjs +192 -3
- package/dist/index.d.cts +160 -101
- package/dist/index.d.mts +160 -101
- package/dist/index.d.ts +160 -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 IDOCFillDeclaration {
|
|
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 | IDOCFillDeclaration;
|
|
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,43 @@ 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 IDOCGeometryDeclaration {
|
|
37
|
+
data: (IDOCPath2D | SVGPathData)[];
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
type IDOCGeometryProp = 'none' | SVGPathData | SVGPathData[] | IDOCGeometryDeclaration;
|
|
42
41
|
|
|
43
|
-
interface
|
|
44
|
-
|
|
45
|
-
|
|
42
|
+
interface IDOCImageDeclaration {
|
|
43
|
+
src: string;
|
|
44
|
+
opacity?: number;
|
|
46
45
|
}
|
|
47
46
|
|
|
48
|
-
type
|
|
49
|
-
|
|
50
|
-
interface
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
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;
|
|
47
|
+
type IDOCImageProp = 'none' | string | IDOCImageDeclaration;
|
|
48
|
+
|
|
49
|
+
interface IDOCMetaProp {
|
|
50
|
+
[key: string]: any;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
interface IDOCNode {
|
|
54
|
+
name?: string;
|
|
55
|
+
children?: IDOCNode[];
|
|
56
|
+
meta?: IDOCMetaProp;
|
|
85
57
|
}
|
|
86
58
|
|
|
59
|
+
interface IDOCStrokeDeclaration {
|
|
60
|
+
color?: string;
|
|
61
|
+
image?: string;
|
|
62
|
+
opacity?: number;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
type IDOCStrokeProp = 'none' | string | IDOCStrokeDeclaration;
|
|
66
|
+
|
|
67
|
+
type Overflow = 'hidden' | 'visible';
|
|
68
|
+
type Visibility = 'hidden' | 'visible';
|
|
87
69
|
type FontWeight = 'normal' | 'bold' | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900;
|
|
88
70
|
type FontStyle = 'normal' | 'italic' | 'oblique' | `oblique ${string}`;
|
|
89
71
|
type FontKerning = 'none' | 'auto' | 'normal';
|
|
@@ -100,15 +82,15 @@ type ListStyleImage = 'none' | string;
|
|
|
100
82
|
type ListStyleColormap = 'none' | Record<string, string>;
|
|
101
83
|
type ListStyleSize = 'cover' | Sizeable;
|
|
102
84
|
type ListStylePosition = 'inside' | 'outside';
|
|
103
|
-
interface
|
|
85
|
+
interface IDOCListStyleDeclaration {
|
|
104
86
|
type: ListStyleType;
|
|
105
87
|
image: ListStyleImage;
|
|
106
88
|
colormap: ListStyleColormap;
|
|
107
89
|
size: ListStyleSize;
|
|
108
90
|
position: ListStylePosition;
|
|
109
91
|
}
|
|
110
|
-
interface
|
|
111
|
-
listStyle?: Partial<
|
|
92
|
+
interface IDOCListStyleStyleDeclaration {
|
|
93
|
+
listStyle?: Partial<IDOCListStyleDeclaration>;
|
|
112
94
|
listStyleType: ListStyleType;
|
|
113
95
|
listStyleImage: ListStyleImage;
|
|
114
96
|
listStyleColormap: ListStyleColormap;
|
|
@@ -121,7 +103,7 @@ type HighlightReferImage = 'none' | string;
|
|
|
121
103
|
type HighlightColormap = 'none' | Record<string, string>;
|
|
122
104
|
type HighlightSize = 'cover' | Sizeable;
|
|
123
105
|
type HighlightThickness = Sizeable;
|
|
124
|
-
interface
|
|
106
|
+
interface IDOCHighlightDeclaration {
|
|
125
107
|
image: HighlightImage;
|
|
126
108
|
referImage: HighlightReferImage;
|
|
127
109
|
colormap: HighlightColormap;
|
|
@@ -129,8 +111,8 @@ interface Highlight {
|
|
|
129
111
|
size: HighlightSize;
|
|
130
112
|
thickness: HighlightThickness;
|
|
131
113
|
}
|
|
132
|
-
interface
|
|
133
|
-
highlight?: Partial<
|
|
114
|
+
interface IDOCHighlightStyleDeclaration {
|
|
115
|
+
highlight?: Partial<IDOCHighlightDeclaration>;
|
|
134
116
|
highlightImage: HighlightImage;
|
|
135
117
|
highlightReferImage: HighlightReferImage;
|
|
136
118
|
highlightColormap: HighlightColormap;
|
|
@@ -138,14 +120,37 @@ interface TextHighlightStyle {
|
|
|
138
120
|
highlightSize: HighlightSize;
|
|
139
121
|
highlightThickness: HighlightThickness;
|
|
140
122
|
}
|
|
141
|
-
interface
|
|
123
|
+
interface IDCOShadowDeclaration {
|
|
124
|
+
color: string;
|
|
125
|
+
offsetX: number;
|
|
126
|
+
offsetY: number;
|
|
127
|
+
blur: number;
|
|
128
|
+
}
|
|
129
|
+
interface IDOCShadowStyleDeclaration {
|
|
130
|
+
shadow?: Partial<IDCOShadowDeclaration>;
|
|
131
|
+
shadowColor: string;
|
|
132
|
+
shadowOffsetX: number;
|
|
133
|
+
shadowOffsetY: number;
|
|
134
|
+
shadowBlur: number;
|
|
135
|
+
}
|
|
136
|
+
interface IDOCTransformStyleDeclaration {
|
|
137
|
+
scaleX: number;
|
|
138
|
+
scaleY: number;
|
|
139
|
+
skewX: number;
|
|
140
|
+
skewY: number;
|
|
141
|
+
translateX: number;
|
|
142
|
+
translateY: number;
|
|
143
|
+
transform: string;
|
|
144
|
+
transformOrigin: string;
|
|
145
|
+
}
|
|
146
|
+
interface IDOCTextLineStyleDeclaration extends IDOCListStyleStyleDeclaration {
|
|
142
147
|
writingMode: WritingMode;
|
|
143
148
|
textWrap: TextWrap;
|
|
144
149
|
textAlign: TextAlign;
|
|
145
150
|
textIndent: number;
|
|
146
151
|
lineHeight: number;
|
|
147
152
|
}
|
|
148
|
-
interface
|
|
153
|
+
interface IDOCTextInlineStyleDeclaration extends IDOCHighlightStyleDeclaration {
|
|
149
154
|
color: string;
|
|
150
155
|
verticalAlign: VerticalAlign;
|
|
151
156
|
letterSpacing: number;
|
|
@@ -159,59 +164,113 @@ interface ITextInlineStyle extends TextHighlightStyle {
|
|
|
159
164
|
textOrientation: TextOrientation;
|
|
160
165
|
textDecoration: TextDecorationLine;
|
|
161
166
|
}
|
|
162
|
-
interface
|
|
167
|
+
interface IDOCTextDrawStyleDeclaration extends IDOCShadowStyleDeclaration, IDOCTransformStyleDeclaration {
|
|
163
168
|
textStrokeWidth: number;
|
|
164
169
|
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
170
|
}
|
|
174
|
-
interface
|
|
171
|
+
interface IDOCTextStyleDeclaration extends IDOCTextLineStyleDeclaration, IDOCTextInlineStyleDeclaration, IDOCTextDrawStyleDeclaration {
|
|
172
|
+
}
|
|
173
|
+
interface IDOCElementStyleDeclaration extends IDOCShadowStyleDeclaration, IDOCTransformStyleDeclaration {
|
|
174
|
+
overflow: Overflow;
|
|
175
|
+
visibility: Visibility;
|
|
176
|
+
filter: string;
|
|
177
|
+
left: number;
|
|
178
|
+
top: number;
|
|
179
|
+
width: number;
|
|
180
|
+
height: number;
|
|
181
|
+
rotate: number;
|
|
182
|
+
opacity: number;
|
|
183
|
+
marginLeft: number;
|
|
184
|
+
marginTop: number;
|
|
185
|
+
marginRight: number;
|
|
186
|
+
marginBottom: number;
|
|
187
|
+
paddingLeft: number;
|
|
188
|
+
paddingTop: number;
|
|
189
|
+
paddingRight: number;
|
|
190
|
+
paddingBottom: number;
|
|
191
|
+
backgroundImage: string;
|
|
192
|
+
backgroundColor: string;
|
|
193
|
+
borderRadius: number;
|
|
194
|
+
borderColor: string;
|
|
195
|
+
borderWidth: number;
|
|
196
|
+
}
|
|
197
|
+
interface IDOCStyleDeclaration extends IDOCTextStyleDeclaration, IDOCElementStyleDeclaration {
|
|
175
198
|
}
|
|
176
199
|
|
|
177
|
-
|
|
200
|
+
type IDOCStyleProp = Partial<IDOCStyleDeclaration>;
|
|
201
|
+
|
|
202
|
+
interface IDOCFragmentContent extends Partial<IDOCStyleDeclaration> {
|
|
178
203
|
content: string;
|
|
179
204
|
}
|
|
180
|
-
interface
|
|
181
|
-
fragments:
|
|
205
|
+
interface IDOCParagraphContent extends Partial<IDOCStyleDeclaration> {
|
|
206
|
+
fragments: IDOCFragmentContent[];
|
|
182
207
|
}
|
|
183
|
-
type
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
208
|
+
type IDOCTextContentFlat = string | IDOCFragmentContent | IDOCParagraphContent | (string | IDOCFragmentContent)[];
|
|
209
|
+
type IDOCTextContent = string | IDOCFragmentContent | IDOCParagraphContent | IDOCTextContentFlat[];
|
|
210
|
+
type IDOCTextContentDeclaration = IDOCParagraphContent[];
|
|
211
|
+
interface IDOCTextDeclaration {
|
|
212
|
+
content: IDOCTextContentDeclaration;
|
|
213
|
+
effects?: Partial<IDOCStyleDeclaration>[];
|
|
188
214
|
measureDom?: any;
|
|
189
215
|
fonts?: any;
|
|
190
216
|
}
|
|
191
217
|
|
|
192
|
-
|
|
193
|
-
|
|
218
|
+
type IDOCTextProp = string | IDOCTextContent | (IDOCTextDeclaration & {
|
|
219
|
+
content: IDOCTextContent;
|
|
220
|
+
}) | IDOCTextDeclaration;
|
|
221
|
+
|
|
222
|
+
interface IDOCVideoDeclaration {
|
|
194
223
|
src: string;
|
|
224
|
+
opacity?: number;
|
|
195
225
|
}
|
|
196
226
|
|
|
197
|
-
type
|
|
198
|
-
|
|
199
|
-
type IElementMeta = Record<string, any>;
|
|
227
|
+
type IDOCVideoProp = 'none' | string | IDOCVideoDeclaration;
|
|
200
228
|
|
|
201
|
-
interface
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
229
|
+
interface IDOCElement extends IDOCNode {
|
|
230
|
+
style?: IDOCStyleProp;
|
|
231
|
+
image?: IDOCImageProp;
|
|
232
|
+
video?: IDOCVideoProp;
|
|
233
|
+
text?: IDOCTextProp;
|
|
234
|
+
geometry?: IDOCGeometryProp;
|
|
235
|
+
fill?: IDOCFillProp;
|
|
236
|
+
stroke?: IDOCStrokeProp;
|
|
237
|
+
children?: IDOCElement[];
|
|
207
238
|
}
|
|
208
239
|
|
|
209
|
-
interface
|
|
240
|
+
interface IDOCDocument extends IDOCElement {
|
|
210
241
|
fonts?: any;
|
|
211
242
|
}
|
|
212
243
|
|
|
213
|
-
|
|
244
|
+
interface IDOCElementDeclaration extends IDOCElement {
|
|
245
|
+
image?: IDOCImageDeclaration;
|
|
246
|
+
video?: IDOCVideoDeclaration;
|
|
247
|
+
text?: IDOCTextDeclaration;
|
|
248
|
+
geometry?: IDOCGeometryDeclaration;
|
|
249
|
+
fill?: IDOCFillDeclaration;
|
|
250
|
+
stroke?: IDOCStrokeDeclaration;
|
|
251
|
+
children?: IDOCElementDeclaration[];
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
declare function getDefaultElementStyle(): IDOCElementStyleDeclaration;
|
|
255
|
+
|
|
256
|
+
declare function getDefaultStyle(): IDOCStyleDeclaration;
|
|
257
|
+
|
|
258
|
+
declare function getDefaultTextStyle(): IDOCTextStyleDeclaration;
|
|
259
|
+
|
|
260
|
+
declare function normalizeElement(element: IDOCElement): IDOCElementDeclaration;
|
|
261
|
+
|
|
262
|
+
declare function normalizeFill(fill?: IDOCFillProp): IDOCFillDeclaration | undefined;
|
|
263
|
+
|
|
264
|
+
declare function normalizeGeometry(geometry?: IDOCGeometryProp): IDOCGeometryDeclaration | undefined;
|
|
265
|
+
|
|
266
|
+
declare function normalizeImage(image?: IDOCImageProp): IDOCImageDeclaration | undefined;
|
|
267
|
+
|
|
268
|
+
declare function normalizeStroke(stroke?: IDOCStrokeProp): IDOCStrokeDeclaration | undefined;
|
|
269
|
+
|
|
270
|
+
declare function normalizeText(text?: IDOCTextProp): IDOCTextDeclaration | undefined;
|
|
271
|
+
|
|
272
|
+
declare function normalizeTextContent(content?: IDOCTextContent): IDOCTextContentDeclaration;
|
|
214
273
|
|
|
215
|
-
declare function
|
|
274
|
+
declare function normalizeVideo(video?: IDOCVideoProp): IDOCVideoDeclaration | undefined;
|
|
216
275
|
|
|
217
|
-
export { type FillRule, type FontKerning, type FontStyle, type FontWeight, type
|
|
276
|
+
export { type FillRule, type FontKerning, type FontStyle, type FontWeight, type HighlightColormap, type HighlightImage, type HighlightLine, type HighlightReferImage, type HighlightSize, type HighlightThickness, type IDCOShadowDeclaration, type IDOCDocument, type IDOCElement, type IDOCElementDeclaration, type IDOCElementStyleDeclaration, type IDOCFillDeclaration, type IDOCFillProp, type IDOCFragmentContent, type IDOCGeometryDeclaration, type IDOCGeometryProp, type IDOCHighlightDeclaration, type IDOCHighlightStyleDeclaration, type IDOCImageDeclaration, type IDOCImageProp, type IDOCListStyleDeclaration, type IDOCListStyleStyleDeclaration, type IDOCMetaProp, type IDOCNode, type IDOCParagraphContent, type IDOCPath2D, type IDOCPath2DStyle, type IDOCShadowStyleDeclaration, type IDOCStrokeDeclaration, type IDOCStrokeProp, type IDOCStyleDeclaration, type IDOCStyleProp, type IDOCTextContent, type IDOCTextContentDeclaration, type IDOCTextContentFlat, type IDOCTextDeclaration, type IDOCTextDrawStyleDeclaration, type IDOCTextInlineStyleDeclaration, type IDOCTextLineStyleDeclaration, type IDOCTextProp, type IDOCTextStyleDeclaration, type IDOCTransformStyleDeclaration, type IDOCVideoDeclaration, 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 };
|