modern-idoc 0.2.10 → 0.2.12
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/index.cjs +59 -45
- package/dist/index.d.cts +91 -77
- package/dist/index.d.mts +91 -77
- package/dist/index.d.ts +91 -77
- package/dist/index.js +1 -1
- package/dist/index.mjs +59 -46
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2,48 +2,54 @@
|
|
|
2
2
|
|
|
3
3
|
function getDefaultLayoutStyle() {
|
|
4
4
|
return {
|
|
5
|
+
// box
|
|
5
6
|
overflow: "visible",
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
flex: 0,
|
|
18
|
-
flexBasis: "auto",
|
|
19
|
-
flexDirection: "row",
|
|
20
|
-
flexGrow: 0,
|
|
21
|
-
flexShrink: 1,
|
|
22
|
-
flexWrap: "nowrap",
|
|
23
|
-
height: "auto",
|
|
24
|
-
justifyContent: "flex-start",
|
|
25
|
-
gap: 0,
|
|
26
|
-
marginTop: 0,
|
|
27
|
-
marginLeft: 0,
|
|
28
|
-
marginRight: 0,
|
|
29
|
-
marginBottom: 0,
|
|
30
|
-
margin: 0,
|
|
31
|
-
maxHeight: 0,
|
|
32
|
-
maxWidth: 0,
|
|
33
|
-
minHeight: 0,
|
|
34
|
-
minWidth: 0,
|
|
35
|
-
paddingTop: 0,
|
|
36
|
-
paddingLeft: 0,
|
|
37
|
-
paddingRight: 0,
|
|
38
|
-
paddingBottom: 0,
|
|
39
|
-
padding: 0,
|
|
40
|
-
top: 0,
|
|
41
|
-
bottom: 0,
|
|
7
|
+
direction: void 0,
|
|
8
|
+
display: void 0,
|
|
9
|
+
boxSizing: void 0,
|
|
10
|
+
width: void 0,
|
|
11
|
+
height: void 0,
|
|
12
|
+
maxHeight: void 0,
|
|
13
|
+
maxWidth: void 0,
|
|
14
|
+
minHeight: void 0,
|
|
15
|
+
minWidth: void 0,
|
|
16
|
+
// position
|
|
17
|
+
position: void 0,
|
|
42
18
|
left: 0,
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
19
|
+
top: 0,
|
|
20
|
+
right: void 0,
|
|
21
|
+
bottom: void 0,
|
|
22
|
+
// border
|
|
23
|
+
borderTop: void 0,
|
|
24
|
+
borderLeft: void 0,
|
|
25
|
+
borderRight: void 0,
|
|
26
|
+
borderBottom: void 0,
|
|
27
|
+
borderWidth: 0,
|
|
28
|
+
border: void 0,
|
|
29
|
+
// flex
|
|
30
|
+
flex: void 0,
|
|
31
|
+
flexBasis: void 0,
|
|
32
|
+
flexDirection: void 0,
|
|
33
|
+
flexGrow: void 0,
|
|
34
|
+
flexShrink: void 0,
|
|
35
|
+
flexWrap: void 0,
|
|
36
|
+
justifyContent: void 0,
|
|
37
|
+
gap: void 0,
|
|
38
|
+
alignContent: void 0,
|
|
39
|
+
alignItems: void 0,
|
|
40
|
+
alignSelf: void 0,
|
|
41
|
+
// margin
|
|
42
|
+
marginTop: void 0,
|
|
43
|
+
marginLeft: void 0,
|
|
44
|
+
marginRight: void 0,
|
|
45
|
+
marginBottom: void 0,
|
|
46
|
+
margin: void 0,
|
|
47
|
+
// padding
|
|
48
|
+
paddingTop: void 0,
|
|
49
|
+
paddingLeft: void 0,
|
|
50
|
+
paddingRight: void 0,
|
|
51
|
+
paddingBottom: void 0,
|
|
52
|
+
padding: void 0
|
|
47
53
|
};
|
|
48
54
|
}
|
|
49
55
|
|
|
@@ -69,12 +75,9 @@ function getDefaultTransformStyle() {
|
|
|
69
75
|
|
|
70
76
|
function getDefaultElementStyle() {
|
|
71
77
|
return {
|
|
72
|
-
...getDefaultTransformStyle(),
|
|
73
78
|
...getDefaultLayoutStyle(),
|
|
79
|
+
...getDefaultTransformStyle(),
|
|
74
80
|
...getDefaultShadowStyle(),
|
|
75
|
-
visibility: "visible",
|
|
76
|
-
filter: "none",
|
|
77
|
-
opacity: 1,
|
|
78
81
|
// background
|
|
79
82
|
backgroundImage: "none",
|
|
80
83
|
backgroundColor: "none",
|
|
@@ -82,7 +85,17 @@ function getDefaultElementStyle() {
|
|
|
82
85
|
borderRadius: 0,
|
|
83
86
|
borderColor: "none",
|
|
84
87
|
borderStyle: "solid",
|
|
85
|
-
|
|
88
|
+
// outline
|
|
89
|
+
outlineWidth: 0,
|
|
90
|
+
outlineOffset: 0,
|
|
91
|
+
outlineColor: "#000000",
|
|
92
|
+
outlineStyle: "none",
|
|
93
|
+
// other
|
|
94
|
+
visibility: "visible",
|
|
95
|
+
filter: "none",
|
|
96
|
+
opacity: 1,
|
|
97
|
+
pointerEvents: "auto",
|
|
98
|
+
maskImage: "none"
|
|
86
99
|
};
|
|
87
100
|
}
|
|
88
101
|
|
|
@@ -348,6 +361,7 @@ function normalizeElement(element) {
|
|
|
348
361
|
exports.clearUndef = clearUndef;
|
|
349
362
|
exports.deepClearUndef = deepClearUndef;
|
|
350
363
|
exports.getDefaultElementStyle = getDefaultElementStyle;
|
|
364
|
+
exports.getDefaultLayoutStyle = getDefaultLayoutStyle;
|
|
351
365
|
exports.getDefaultShadowStyle = getDefaultShadowStyle;
|
|
352
366
|
exports.getDefaultStyle = getDefaultStyle;
|
|
353
367
|
exports.getDefaultTextStyle = getDefaultTextStyle;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
type
|
|
2
|
-
type Sizeable = `${number}%` | `${number}rem` | number;
|
|
1
|
+
type None = 'none';
|
|
3
2
|
|
|
3
|
+
type AudioSource = string;
|
|
4
4
|
interface AudioDeclaration {
|
|
5
|
-
src:
|
|
5
|
+
src: AudioSource;
|
|
6
6
|
}
|
|
7
|
-
type AudioProp =
|
|
7
|
+
type AudioProp = None | AudioSource | AudioDeclaration;
|
|
8
8
|
|
|
9
9
|
interface ImageFillTile {
|
|
10
10
|
alignment?: string;
|
|
@@ -17,9 +17,10 @@ interface ImageFillTile {
|
|
|
17
17
|
interface CommonFillDeclaration {
|
|
18
18
|
opacity?: number;
|
|
19
19
|
}
|
|
20
|
+
type ImageFillSource = string;
|
|
20
21
|
interface ImageFillDeclaration extends CommonFillDeclaration {
|
|
21
22
|
type: 'image';
|
|
22
|
-
image:
|
|
23
|
+
image: ImageFillSource;
|
|
23
24
|
dpi?: number;
|
|
24
25
|
rotateWithShape?: boolean;
|
|
25
26
|
tile?: ImageFillTile;
|
|
@@ -29,7 +30,7 @@ interface ColorFillDeclaration extends CommonFillDeclaration {
|
|
|
29
30
|
color: string;
|
|
30
31
|
}
|
|
31
32
|
type FillDeclaration = ImageFillDeclaration | ColorFillDeclaration;
|
|
32
|
-
type FillProp =
|
|
33
|
+
type FillProp = None | string | FillDeclaration;
|
|
33
34
|
|
|
34
35
|
type SVGPathData = string;
|
|
35
36
|
type FillRule = 'nonzero' | 'evenodd';
|
|
@@ -62,7 +63,7 @@ interface GeometryDeclaration {
|
|
|
62
63
|
name?: string;
|
|
63
64
|
data: Path2DDeclaration[];
|
|
64
65
|
}
|
|
65
|
-
type GeometryProp =
|
|
66
|
+
type GeometryProp = None | SVGPathData | SVGPathData[] | Path2DDeclaration[] | GeometryDeclaration;
|
|
66
67
|
|
|
67
68
|
interface MetaProp {
|
|
68
69
|
[key: string]: any;
|
|
@@ -74,18 +75,19 @@ interface IDOCNode {
|
|
|
74
75
|
meta?: MetaProp;
|
|
75
76
|
}
|
|
76
77
|
|
|
77
|
-
|
|
78
|
+
type ImageSource = string;
|
|
79
|
+
interface ImageSourceRect {
|
|
78
80
|
left?: number;
|
|
79
81
|
top?: number;
|
|
80
82
|
bottom?: number;
|
|
81
83
|
right?: number;
|
|
82
84
|
}
|
|
83
85
|
interface ImageDeclaration {
|
|
84
|
-
src:
|
|
85
|
-
srcRect?:
|
|
86
|
+
src: ImageSource;
|
|
87
|
+
srcRect?: ImageSourceRect;
|
|
86
88
|
opacity?: number;
|
|
87
89
|
}
|
|
88
|
-
type ImageProp =
|
|
90
|
+
type ImageProp = None | ImageSource | ImageDeclaration;
|
|
89
91
|
|
|
90
92
|
interface OutlineDeclaration {
|
|
91
93
|
width?: number;
|
|
@@ -94,33 +96,37 @@ interface OutlineDeclaration {
|
|
|
94
96
|
color?: string;
|
|
95
97
|
opacity?: number;
|
|
96
98
|
}
|
|
97
|
-
type OutlineProp =
|
|
99
|
+
type OutlineProp = None | string | Partial<OutlineDeclaration>;
|
|
98
100
|
|
|
101
|
+
type BoxShadow = None | string;
|
|
99
102
|
interface ShadowDeclaration {
|
|
100
103
|
color: string;
|
|
101
104
|
offsetX?: number;
|
|
102
105
|
offsetY?: number;
|
|
103
106
|
blur?: number;
|
|
104
107
|
}
|
|
105
|
-
type ShadowProp =
|
|
108
|
+
type ShadowProp = None | BoxShadow | ShadowDeclaration;
|
|
106
109
|
interface ShadowStyleDeclaration {
|
|
107
|
-
boxShadow:
|
|
110
|
+
boxShadow: BoxShadow;
|
|
108
111
|
shadowColor?: string;
|
|
109
112
|
shadowOffsetX?: number;
|
|
110
113
|
shadowOffsetY?: number;
|
|
111
114
|
shadowBlur?: number;
|
|
112
115
|
}
|
|
113
116
|
|
|
117
|
+
type StyleUnit = `${number}%` | number;
|
|
118
|
+
type Display = 'flex' | 'contents';
|
|
119
|
+
type Direction = 'inherit' | 'ltr' | 'rtl';
|
|
114
120
|
type Overflow = 'hidden' | 'visible';
|
|
115
121
|
type Visibility = 'hidden' | 'visible';
|
|
116
122
|
type FontWeight = 'normal' | 'bold' | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900;
|
|
117
123
|
type FontStyle = 'normal' | 'italic' | 'oblique' | `oblique ${string}`;
|
|
118
|
-
type FontKerning =
|
|
124
|
+
type FontKerning = None | 'auto' | 'normal';
|
|
119
125
|
type TextWrap = 'wrap' | 'nowrap';
|
|
120
126
|
type TextAlign = 'center' | 'end' | 'left' | 'right' | 'start';
|
|
121
|
-
type TextTransform =
|
|
127
|
+
type TextTransform = None | 'uppercase' | 'lowercase';
|
|
122
128
|
type TextOrientation = 'mixed' | 'upright' | 'sideways-right' | 'sideways';
|
|
123
|
-
type TextDecoration =
|
|
129
|
+
type TextDecoration = None | 'underline' | 'line-through' | 'overline';
|
|
124
130
|
type VerticalAlign = 'baseline' | 'top' | 'middle' | 'bottom' | 'sub' | 'super' | 'text-top' | 'text-bottom';
|
|
125
131
|
type WritingMode = 'horizontal-tb' | 'vertical-lr' | 'vertical-rl';
|
|
126
132
|
type Align = 'auto' | 'flex-start' | 'center' | 'flex-end' | 'stretch' | 'baseline' | 'space-between' | 'space-around' | 'space-evenly';
|
|
@@ -128,64 +134,64 @@ type FlexDirection = 'column' | 'column-reverse' | 'row' | 'row-reverse';
|
|
|
128
134
|
type FlexWrap = 'nowrap' | 'wrap' | 'Wrap-reverse';
|
|
129
135
|
type Justify = 'flex-start' | 'center' | 'flex-end' | 'space-between' | 'space-around' | 'space-evenly';
|
|
130
136
|
type Position = 'static' | 'relative' | 'absolute';
|
|
131
|
-
type BorderStyle =
|
|
137
|
+
type BorderStyle = None | 'dashed' | 'solid';
|
|
132
138
|
type BoxSizing = 'border-box' | 'content-box';
|
|
133
139
|
type PointerEvents = 'auto' | 'none';
|
|
134
|
-
type ListStyleType =
|
|
135
|
-
type ListStyleImage =
|
|
136
|
-
type ListStyleColormap =
|
|
137
|
-
type ListStyleSize =
|
|
140
|
+
type ListStyleType = None | 'disc';
|
|
141
|
+
type ListStyleImage = None | string;
|
|
142
|
+
type ListStyleColormap = None | Record<string, string>;
|
|
143
|
+
type ListStyleSize = StyleUnit | `${number}rem` | 'cover';
|
|
138
144
|
type ListStylePosition = 'inside' | 'outside';
|
|
139
145
|
type HighlightLine = TextDecoration | 'outline';
|
|
140
|
-
type HighlightImage =
|
|
141
|
-
type HighlightReferImage =
|
|
142
|
-
type HighlightColormap =
|
|
143
|
-
type HighlightSize =
|
|
144
|
-
type HighlightThickness =
|
|
146
|
+
type HighlightImage = None | string;
|
|
147
|
+
type HighlightReferImage = None | string;
|
|
148
|
+
type HighlightColormap = None | Record<string, string>;
|
|
149
|
+
type HighlightSize = StyleUnit | `${number}rem` | 'cover';
|
|
150
|
+
type HighlightThickness = StyleUnit;
|
|
145
151
|
|
|
146
152
|
interface LayoutStyleDeclaration {
|
|
147
153
|
overflow: Overflow;
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
154
|
+
direction?: Direction;
|
|
155
|
+
display?: Display;
|
|
156
|
+
boxSizing?: BoxSizing;
|
|
157
|
+
width?: StyleUnit | 'auto';
|
|
158
|
+
height?: StyleUnit | 'auto';
|
|
159
|
+
maxHeight?: StyleUnit;
|
|
160
|
+
maxWidth?: StyleUnit;
|
|
161
|
+
minHeight?: StyleUnit;
|
|
162
|
+
minWidth?: StyleUnit;
|
|
163
|
+
position?: Position;
|
|
164
|
+
left: StyleUnit;
|
|
165
|
+
top: StyleUnit;
|
|
166
|
+
right?: StyleUnit;
|
|
167
|
+
bottom?: StyleUnit;
|
|
168
|
+
borderTop?: string;
|
|
169
|
+
borderLeft?: string;
|
|
170
|
+
borderRight?: string;
|
|
171
|
+
borderBottom?: string;
|
|
172
|
+
borderWidth?: number;
|
|
173
|
+
border?: string;
|
|
174
|
+
flex?: number;
|
|
175
|
+
flexBasis?: StyleUnit | 'auto';
|
|
176
|
+
flexDirection?: FlexDirection;
|
|
177
|
+
flexGrow?: number;
|
|
178
|
+
flexShrink?: number;
|
|
179
|
+
flexWrap?: FlexWrap;
|
|
180
|
+
alignContent?: Align;
|
|
181
|
+
alignItems?: Align;
|
|
182
|
+
alignSelf?: Align;
|
|
183
|
+
justifyContent?: Justify;
|
|
184
|
+
gap?: StyleUnit;
|
|
185
|
+
marginTop?: None | StyleUnit | 'auto';
|
|
186
|
+
marginLeft?: None | StyleUnit | 'auto';
|
|
187
|
+
marginRight?: None | StyleUnit | 'auto';
|
|
188
|
+
marginBottom?: None | StyleUnit | 'auto';
|
|
189
|
+
margin?: None | StyleUnit | 'auto';
|
|
190
|
+
paddingTop?: StyleUnit;
|
|
191
|
+
paddingLeft?: StyleUnit;
|
|
192
|
+
paddingRight?: StyleUnit;
|
|
193
|
+
paddingBottom?: StyleUnit;
|
|
194
|
+
padding?: StyleUnit;
|
|
189
195
|
}
|
|
190
196
|
|
|
191
197
|
interface TransformStyleDeclaration {
|
|
@@ -196,20 +202,25 @@ interface TransformStyleDeclaration {
|
|
|
196
202
|
skewY: number;
|
|
197
203
|
translateX: number;
|
|
198
204
|
translateY: number;
|
|
199
|
-
transform: string;
|
|
205
|
+
transform: None | string;
|
|
200
206
|
transformOrigin: string;
|
|
201
207
|
}
|
|
202
208
|
|
|
203
209
|
interface ElementStyleDeclaration extends LayoutStyleDeclaration, TransformStyleDeclaration, ShadowStyleDeclaration {
|
|
210
|
+
backgroundImage?: None | string;
|
|
211
|
+
backgroundColor?: None | string;
|
|
212
|
+
borderRadius: number;
|
|
213
|
+
borderColor?: None | string;
|
|
214
|
+
borderStyle: BorderStyle;
|
|
215
|
+
outlineWidth: number;
|
|
216
|
+
outlineOffset: number;
|
|
217
|
+
outlineColor: None | string;
|
|
218
|
+
outlineStyle: string;
|
|
204
219
|
visibility: Visibility;
|
|
205
220
|
filter: string;
|
|
206
221
|
opacity: number;
|
|
207
|
-
backgroundImage: Noneable | string;
|
|
208
|
-
backgroundColor: Noneable | string;
|
|
209
|
-
borderRadius: number;
|
|
210
|
-
borderColor: Noneable | string;
|
|
211
|
-
borderStyle: BorderStyle;
|
|
212
222
|
pointerEvents: PointerEvents;
|
|
223
|
+
maskImage: None | string;
|
|
213
224
|
}
|
|
214
225
|
|
|
215
226
|
interface HighlightDeclaration {
|
|
@@ -299,11 +310,12 @@ type TextProp = string | TextContent | (TextDeclaration & {
|
|
|
299
310
|
content: TextContent;
|
|
300
311
|
}) | TextDeclaration;
|
|
301
312
|
|
|
313
|
+
type VideoSource = string;
|
|
302
314
|
interface VideoDeclaration {
|
|
303
|
-
src:
|
|
315
|
+
src: VideoSource;
|
|
304
316
|
opacity?: number;
|
|
305
317
|
}
|
|
306
|
-
type VideoProp =
|
|
318
|
+
type VideoProp = None | VideoSource | VideoDeclaration;
|
|
307
319
|
|
|
308
320
|
interface IDOCElement extends IDOCNode {
|
|
309
321
|
style?: StyleProp;
|
|
@@ -338,6 +350,8 @@ interface IDOCDocumentDeclaration extends IDOCElementDeclaration {
|
|
|
338
350
|
|
|
339
351
|
declare function getDefaultElementStyle(): ElementStyleDeclaration;
|
|
340
352
|
|
|
353
|
+
declare function getDefaultLayoutStyle(): LayoutStyleDeclaration;
|
|
354
|
+
|
|
341
355
|
declare function getDefaultShadowStyle(): ShadowStyleDeclaration;
|
|
342
356
|
|
|
343
357
|
declare function getDefaultStyle(): StyleDeclaration;
|
|
@@ -369,4 +383,4 @@ declare function normalizeTextContent(content?: TextContent): TextContentDeclara
|
|
|
369
383
|
|
|
370
384
|
declare function normalizeVideo(video?: VideoProp): VideoDeclaration | undefined;
|
|
371
385
|
|
|
372
|
-
export { type Align, type AudioDeclaration, type AudioProp, type BorderStyle, type BoxSizing, type ColorFillDeclaration, type CommonFillDeclaration, type ElementStyleDeclaration, type FillDeclaration, type FillProp, type FillRule, type FlexDirection, type FlexWrap, type FontKerning, type FontStyle, type FontWeight, type FragmentContent, type GeometryDeclaration, type GeometryProp, type HighlightColormap, type HighlightDeclaration, type HighlightImage, type HighlightLine, type HighlightReferImage, type HighlightSize, type HighlightStyleDeclaration, type HighlightThickness, type IDOCDocument, type IDOCDocumentDeclaration, type IDOCElement, type IDOCElementDeclaration, type IDOCNode, type ImageDeclaration, type ImageFillDeclaration, type ImageFillTile, type ImageProp, type
|
|
386
|
+
export { type Align, type AudioDeclaration, type AudioProp, type AudioSource, type BorderStyle, type BoxShadow, type BoxSizing, type ColorFillDeclaration, type CommonFillDeclaration, type Direction, type Display, type ElementStyleDeclaration, type FillDeclaration, type FillProp, type FillRule, type FlexDirection, type FlexWrap, type FontKerning, type FontStyle, type FontWeight, type FragmentContent, type GeometryDeclaration, type GeometryProp, type HighlightColormap, type HighlightDeclaration, type HighlightImage, type HighlightLine, type HighlightReferImage, type HighlightSize, type HighlightStyleDeclaration, type HighlightThickness, type IDOCDocument, type IDOCDocumentDeclaration, type IDOCElement, type IDOCElementDeclaration, type IDOCNode, type ImageDeclaration, type ImageFillDeclaration, type ImageFillSource, type ImageFillTile, type ImageProp, type ImageSource, type ImageSourceRect, type Justify, type LayoutStyleDeclaration, type ListStyleColormap, type ListStyleDeclaration, type ListStyleImage, type ListStylePosition, type ListStyleSize, type ListStyleStyleDeclaration, type ListStyleType, type MetaProp, type OutlineDeclaration, type OutlineProp, type Overflow, type ParagraphContent, type Path2DDeclaration, type Path2DStyle, type PointerEvents, type Position, type SVGPathData, type ShadowDeclaration, type ShadowProp, type ShadowStyleDeclaration, type StrokeLinecap, type StrokeLinejoin, type StyleDeclaration, type StyleProp, type StyleUnit, type TextAlign, type TextContent, type TextContentDeclaration, type TextContentFlat, type TextDeclaration, type TextDecoration, type TextDrawStyleDeclaration, type TextInlineStyleDeclaration, type TextLineStyleDeclaration, type TextOrientation, type TextProp, type TextStyleDeclaration, type TextTransform, type TextWrap, type TransformStyleDeclaration, type VerticalAlign, type VideoDeclaration, type VideoProp, type VideoSource, type Visibility, type WritingMode, clearUndef, deepClearUndef, getDefaultElementStyle, getDefaultLayoutStyle, getDefaultShadowStyle, getDefaultStyle, getDefaultTextStyle, getDefaultTransformStyle, normalizeAudio, normalizeElement, normalizeFill, normalizeGeometry, normalizeImage, normalizeOutline, normalizeShadow, normalizeText, normalizeTextContent, normalizeVideo };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
type
|
|
2
|
-
type Sizeable = `${number}%` | `${number}rem` | number;
|
|
1
|
+
type None = 'none';
|
|
3
2
|
|
|
3
|
+
type AudioSource = string;
|
|
4
4
|
interface AudioDeclaration {
|
|
5
|
-
src:
|
|
5
|
+
src: AudioSource;
|
|
6
6
|
}
|
|
7
|
-
type AudioProp =
|
|
7
|
+
type AudioProp = None | AudioSource | AudioDeclaration;
|
|
8
8
|
|
|
9
9
|
interface ImageFillTile {
|
|
10
10
|
alignment?: string;
|
|
@@ -17,9 +17,10 @@ interface ImageFillTile {
|
|
|
17
17
|
interface CommonFillDeclaration {
|
|
18
18
|
opacity?: number;
|
|
19
19
|
}
|
|
20
|
+
type ImageFillSource = string;
|
|
20
21
|
interface ImageFillDeclaration extends CommonFillDeclaration {
|
|
21
22
|
type: 'image';
|
|
22
|
-
image:
|
|
23
|
+
image: ImageFillSource;
|
|
23
24
|
dpi?: number;
|
|
24
25
|
rotateWithShape?: boolean;
|
|
25
26
|
tile?: ImageFillTile;
|
|
@@ -29,7 +30,7 @@ interface ColorFillDeclaration extends CommonFillDeclaration {
|
|
|
29
30
|
color: string;
|
|
30
31
|
}
|
|
31
32
|
type FillDeclaration = ImageFillDeclaration | ColorFillDeclaration;
|
|
32
|
-
type FillProp =
|
|
33
|
+
type FillProp = None | string | FillDeclaration;
|
|
33
34
|
|
|
34
35
|
type SVGPathData = string;
|
|
35
36
|
type FillRule = 'nonzero' | 'evenodd';
|
|
@@ -62,7 +63,7 @@ interface GeometryDeclaration {
|
|
|
62
63
|
name?: string;
|
|
63
64
|
data: Path2DDeclaration[];
|
|
64
65
|
}
|
|
65
|
-
type GeometryProp =
|
|
66
|
+
type GeometryProp = None | SVGPathData | SVGPathData[] | Path2DDeclaration[] | GeometryDeclaration;
|
|
66
67
|
|
|
67
68
|
interface MetaProp {
|
|
68
69
|
[key: string]: any;
|
|
@@ -74,18 +75,19 @@ interface IDOCNode {
|
|
|
74
75
|
meta?: MetaProp;
|
|
75
76
|
}
|
|
76
77
|
|
|
77
|
-
|
|
78
|
+
type ImageSource = string;
|
|
79
|
+
interface ImageSourceRect {
|
|
78
80
|
left?: number;
|
|
79
81
|
top?: number;
|
|
80
82
|
bottom?: number;
|
|
81
83
|
right?: number;
|
|
82
84
|
}
|
|
83
85
|
interface ImageDeclaration {
|
|
84
|
-
src:
|
|
85
|
-
srcRect?:
|
|
86
|
+
src: ImageSource;
|
|
87
|
+
srcRect?: ImageSourceRect;
|
|
86
88
|
opacity?: number;
|
|
87
89
|
}
|
|
88
|
-
type ImageProp =
|
|
90
|
+
type ImageProp = None | ImageSource | ImageDeclaration;
|
|
89
91
|
|
|
90
92
|
interface OutlineDeclaration {
|
|
91
93
|
width?: number;
|
|
@@ -94,33 +96,37 @@ interface OutlineDeclaration {
|
|
|
94
96
|
color?: string;
|
|
95
97
|
opacity?: number;
|
|
96
98
|
}
|
|
97
|
-
type OutlineProp =
|
|
99
|
+
type OutlineProp = None | string | Partial<OutlineDeclaration>;
|
|
98
100
|
|
|
101
|
+
type BoxShadow = None | string;
|
|
99
102
|
interface ShadowDeclaration {
|
|
100
103
|
color: string;
|
|
101
104
|
offsetX?: number;
|
|
102
105
|
offsetY?: number;
|
|
103
106
|
blur?: number;
|
|
104
107
|
}
|
|
105
|
-
type ShadowProp =
|
|
108
|
+
type ShadowProp = None | BoxShadow | ShadowDeclaration;
|
|
106
109
|
interface ShadowStyleDeclaration {
|
|
107
|
-
boxShadow:
|
|
110
|
+
boxShadow: BoxShadow;
|
|
108
111
|
shadowColor?: string;
|
|
109
112
|
shadowOffsetX?: number;
|
|
110
113
|
shadowOffsetY?: number;
|
|
111
114
|
shadowBlur?: number;
|
|
112
115
|
}
|
|
113
116
|
|
|
117
|
+
type StyleUnit = `${number}%` | number;
|
|
118
|
+
type Display = 'flex' | 'contents';
|
|
119
|
+
type Direction = 'inherit' | 'ltr' | 'rtl';
|
|
114
120
|
type Overflow = 'hidden' | 'visible';
|
|
115
121
|
type Visibility = 'hidden' | 'visible';
|
|
116
122
|
type FontWeight = 'normal' | 'bold' | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900;
|
|
117
123
|
type FontStyle = 'normal' | 'italic' | 'oblique' | `oblique ${string}`;
|
|
118
|
-
type FontKerning =
|
|
124
|
+
type FontKerning = None | 'auto' | 'normal';
|
|
119
125
|
type TextWrap = 'wrap' | 'nowrap';
|
|
120
126
|
type TextAlign = 'center' | 'end' | 'left' | 'right' | 'start';
|
|
121
|
-
type TextTransform =
|
|
127
|
+
type TextTransform = None | 'uppercase' | 'lowercase';
|
|
122
128
|
type TextOrientation = 'mixed' | 'upright' | 'sideways-right' | 'sideways';
|
|
123
|
-
type TextDecoration =
|
|
129
|
+
type TextDecoration = None | 'underline' | 'line-through' | 'overline';
|
|
124
130
|
type VerticalAlign = 'baseline' | 'top' | 'middle' | 'bottom' | 'sub' | 'super' | 'text-top' | 'text-bottom';
|
|
125
131
|
type WritingMode = 'horizontal-tb' | 'vertical-lr' | 'vertical-rl';
|
|
126
132
|
type Align = 'auto' | 'flex-start' | 'center' | 'flex-end' | 'stretch' | 'baseline' | 'space-between' | 'space-around' | 'space-evenly';
|
|
@@ -128,64 +134,64 @@ type FlexDirection = 'column' | 'column-reverse' | 'row' | 'row-reverse';
|
|
|
128
134
|
type FlexWrap = 'nowrap' | 'wrap' | 'Wrap-reverse';
|
|
129
135
|
type Justify = 'flex-start' | 'center' | 'flex-end' | 'space-between' | 'space-around' | 'space-evenly';
|
|
130
136
|
type Position = 'static' | 'relative' | 'absolute';
|
|
131
|
-
type BorderStyle =
|
|
137
|
+
type BorderStyle = None | 'dashed' | 'solid';
|
|
132
138
|
type BoxSizing = 'border-box' | 'content-box';
|
|
133
139
|
type PointerEvents = 'auto' | 'none';
|
|
134
|
-
type ListStyleType =
|
|
135
|
-
type ListStyleImage =
|
|
136
|
-
type ListStyleColormap =
|
|
137
|
-
type ListStyleSize =
|
|
140
|
+
type ListStyleType = None | 'disc';
|
|
141
|
+
type ListStyleImage = None | string;
|
|
142
|
+
type ListStyleColormap = None | Record<string, string>;
|
|
143
|
+
type ListStyleSize = StyleUnit | `${number}rem` | 'cover';
|
|
138
144
|
type ListStylePosition = 'inside' | 'outside';
|
|
139
145
|
type HighlightLine = TextDecoration | 'outline';
|
|
140
|
-
type HighlightImage =
|
|
141
|
-
type HighlightReferImage =
|
|
142
|
-
type HighlightColormap =
|
|
143
|
-
type HighlightSize =
|
|
144
|
-
type HighlightThickness =
|
|
146
|
+
type HighlightImage = None | string;
|
|
147
|
+
type HighlightReferImage = None | string;
|
|
148
|
+
type HighlightColormap = None | Record<string, string>;
|
|
149
|
+
type HighlightSize = StyleUnit | `${number}rem` | 'cover';
|
|
150
|
+
type HighlightThickness = StyleUnit;
|
|
145
151
|
|
|
146
152
|
interface LayoutStyleDeclaration {
|
|
147
153
|
overflow: Overflow;
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
154
|
+
direction?: Direction;
|
|
155
|
+
display?: Display;
|
|
156
|
+
boxSizing?: BoxSizing;
|
|
157
|
+
width?: StyleUnit | 'auto';
|
|
158
|
+
height?: StyleUnit | 'auto';
|
|
159
|
+
maxHeight?: StyleUnit;
|
|
160
|
+
maxWidth?: StyleUnit;
|
|
161
|
+
minHeight?: StyleUnit;
|
|
162
|
+
minWidth?: StyleUnit;
|
|
163
|
+
position?: Position;
|
|
164
|
+
left: StyleUnit;
|
|
165
|
+
top: StyleUnit;
|
|
166
|
+
right?: StyleUnit;
|
|
167
|
+
bottom?: StyleUnit;
|
|
168
|
+
borderTop?: string;
|
|
169
|
+
borderLeft?: string;
|
|
170
|
+
borderRight?: string;
|
|
171
|
+
borderBottom?: string;
|
|
172
|
+
borderWidth?: number;
|
|
173
|
+
border?: string;
|
|
174
|
+
flex?: number;
|
|
175
|
+
flexBasis?: StyleUnit | 'auto';
|
|
176
|
+
flexDirection?: FlexDirection;
|
|
177
|
+
flexGrow?: number;
|
|
178
|
+
flexShrink?: number;
|
|
179
|
+
flexWrap?: FlexWrap;
|
|
180
|
+
alignContent?: Align;
|
|
181
|
+
alignItems?: Align;
|
|
182
|
+
alignSelf?: Align;
|
|
183
|
+
justifyContent?: Justify;
|
|
184
|
+
gap?: StyleUnit;
|
|
185
|
+
marginTop?: None | StyleUnit | 'auto';
|
|
186
|
+
marginLeft?: None | StyleUnit | 'auto';
|
|
187
|
+
marginRight?: None | StyleUnit | 'auto';
|
|
188
|
+
marginBottom?: None | StyleUnit | 'auto';
|
|
189
|
+
margin?: None | StyleUnit | 'auto';
|
|
190
|
+
paddingTop?: StyleUnit;
|
|
191
|
+
paddingLeft?: StyleUnit;
|
|
192
|
+
paddingRight?: StyleUnit;
|
|
193
|
+
paddingBottom?: StyleUnit;
|
|
194
|
+
padding?: StyleUnit;
|
|
189
195
|
}
|
|
190
196
|
|
|
191
197
|
interface TransformStyleDeclaration {
|
|
@@ -196,20 +202,25 @@ interface TransformStyleDeclaration {
|
|
|
196
202
|
skewY: number;
|
|
197
203
|
translateX: number;
|
|
198
204
|
translateY: number;
|
|
199
|
-
transform: string;
|
|
205
|
+
transform: None | string;
|
|
200
206
|
transformOrigin: string;
|
|
201
207
|
}
|
|
202
208
|
|
|
203
209
|
interface ElementStyleDeclaration extends LayoutStyleDeclaration, TransformStyleDeclaration, ShadowStyleDeclaration {
|
|
210
|
+
backgroundImage?: None | string;
|
|
211
|
+
backgroundColor?: None | string;
|
|
212
|
+
borderRadius: number;
|
|
213
|
+
borderColor?: None | string;
|
|
214
|
+
borderStyle: BorderStyle;
|
|
215
|
+
outlineWidth: number;
|
|
216
|
+
outlineOffset: number;
|
|
217
|
+
outlineColor: None | string;
|
|
218
|
+
outlineStyle: string;
|
|
204
219
|
visibility: Visibility;
|
|
205
220
|
filter: string;
|
|
206
221
|
opacity: number;
|
|
207
|
-
backgroundImage: Noneable | string;
|
|
208
|
-
backgroundColor: Noneable | string;
|
|
209
|
-
borderRadius: number;
|
|
210
|
-
borderColor: Noneable | string;
|
|
211
|
-
borderStyle: BorderStyle;
|
|
212
222
|
pointerEvents: PointerEvents;
|
|
223
|
+
maskImage: None | string;
|
|
213
224
|
}
|
|
214
225
|
|
|
215
226
|
interface HighlightDeclaration {
|
|
@@ -299,11 +310,12 @@ type TextProp = string | TextContent | (TextDeclaration & {
|
|
|
299
310
|
content: TextContent;
|
|
300
311
|
}) | TextDeclaration;
|
|
301
312
|
|
|
313
|
+
type VideoSource = string;
|
|
302
314
|
interface VideoDeclaration {
|
|
303
|
-
src:
|
|
315
|
+
src: VideoSource;
|
|
304
316
|
opacity?: number;
|
|
305
317
|
}
|
|
306
|
-
type VideoProp =
|
|
318
|
+
type VideoProp = None | VideoSource | VideoDeclaration;
|
|
307
319
|
|
|
308
320
|
interface IDOCElement extends IDOCNode {
|
|
309
321
|
style?: StyleProp;
|
|
@@ -338,6 +350,8 @@ interface IDOCDocumentDeclaration extends IDOCElementDeclaration {
|
|
|
338
350
|
|
|
339
351
|
declare function getDefaultElementStyle(): ElementStyleDeclaration;
|
|
340
352
|
|
|
353
|
+
declare function getDefaultLayoutStyle(): LayoutStyleDeclaration;
|
|
354
|
+
|
|
341
355
|
declare function getDefaultShadowStyle(): ShadowStyleDeclaration;
|
|
342
356
|
|
|
343
357
|
declare function getDefaultStyle(): StyleDeclaration;
|
|
@@ -369,4 +383,4 @@ declare function normalizeTextContent(content?: TextContent): TextContentDeclara
|
|
|
369
383
|
|
|
370
384
|
declare function normalizeVideo(video?: VideoProp): VideoDeclaration | undefined;
|
|
371
385
|
|
|
372
|
-
export { type Align, type AudioDeclaration, type AudioProp, type BorderStyle, type BoxSizing, type ColorFillDeclaration, type CommonFillDeclaration, type ElementStyleDeclaration, type FillDeclaration, type FillProp, type FillRule, type FlexDirection, type FlexWrap, type FontKerning, type FontStyle, type FontWeight, type FragmentContent, type GeometryDeclaration, type GeometryProp, type HighlightColormap, type HighlightDeclaration, type HighlightImage, type HighlightLine, type HighlightReferImage, type HighlightSize, type HighlightStyleDeclaration, type HighlightThickness, type IDOCDocument, type IDOCDocumentDeclaration, type IDOCElement, type IDOCElementDeclaration, type IDOCNode, type ImageDeclaration, type ImageFillDeclaration, type ImageFillTile, type ImageProp, type
|
|
386
|
+
export { type Align, type AudioDeclaration, type AudioProp, type AudioSource, type BorderStyle, type BoxShadow, type BoxSizing, type ColorFillDeclaration, type CommonFillDeclaration, type Direction, type Display, type ElementStyleDeclaration, type FillDeclaration, type FillProp, type FillRule, type FlexDirection, type FlexWrap, type FontKerning, type FontStyle, type FontWeight, type FragmentContent, type GeometryDeclaration, type GeometryProp, type HighlightColormap, type HighlightDeclaration, type HighlightImage, type HighlightLine, type HighlightReferImage, type HighlightSize, type HighlightStyleDeclaration, type HighlightThickness, type IDOCDocument, type IDOCDocumentDeclaration, type IDOCElement, type IDOCElementDeclaration, type IDOCNode, type ImageDeclaration, type ImageFillDeclaration, type ImageFillSource, type ImageFillTile, type ImageProp, type ImageSource, type ImageSourceRect, type Justify, type LayoutStyleDeclaration, type ListStyleColormap, type ListStyleDeclaration, type ListStyleImage, type ListStylePosition, type ListStyleSize, type ListStyleStyleDeclaration, type ListStyleType, type MetaProp, type OutlineDeclaration, type OutlineProp, type Overflow, type ParagraphContent, type Path2DDeclaration, type Path2DStyle, type PointerEvents, type Position, type SVGPathData, type ShadowDeclaration, type ShadowProp, type ShadowStyleDeclaration, type StrokeLinecap, type StrokeLinejoin, type StyleDeclaration, type StyleProp, type StyleUnit, type TextAlign, type TextContent, type TextContentDeclaration, type TextContentFlat, type TextDeclaration, type TextDecoration, type TextDrawStyleDeclaration, type TextInlineStyleDeclaration, type TextLineStyleDeclaration, type TextOrientation, type TextProp, type TextStyleDeclaration, type TextTransform, type TextWrap, type TransformStyleDeclaration, type VerticalAlign, type VideoDeclaration, type VideoProp, type VideoSource, type Visibility, type WritingMode, clearUndef, deepClearUndef, getDefaultElementStyle, getDefaultLayoutStyle, getDefaultShadowStyle, getDefaultStyle, getDefaultTextStyle, getDefaultTransformStyle, normalizeAudio, normalizeElement, normalizeFill, normalizeGeometry, normalizeImage, normalizeOutline, normalizeShadow, normalizeText, normalizeTextContent, normalizeVideo };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
type
|
|
2
|
-
type Sizeable = `${number}%` | `${number}rem` | number;
|
|
1
|
+
type None = 'none';
|
|
3
2
|
|
|
3
|
+
type AudioSource = string;
|
|
4
4
|
interface AudioDeclaration {
|
|
5
|
-
src:
|
|
5
|
+
src: AudioSource;
|
|
6
6
|
}
|
|
7
|
-
type AudioProp =
|
|
7
|
+
type AudioProp = None | AudioSource | AudioDeclaration;
|
|
8
8
|
|
|
9
9
|
interface ImageFillTile {
|
|
10
10
|
alignment?: string;
|
|
@@ -17,9 +17,10 @@ interface ImageFillTile {
|
|
|
17
17
|
interface CommonFillDeclaration {
|
|
18
18
|
opacity?: number;
|
|
19
19
|
}
|
|
20
|
+
type ImageFillSource = string;
|
|
20
21
|
interface ImageFillDeclaration extends CommonFillDeclaration {
|
|
21
22
|
type: 'image';
|
|
22
|
-
image:
|
|
23
|
+
image: ImageFillSource;
|
|
23
24
|
dpi?: number;
|
|
24
25
|
rotateWithShape?: boolean;
|
|
25
26
|
tile?: ImageFillTile;
|
|
@@ -29,7 +30,7 @@ interface ColorFillDeclaration extends CommonFillDeclaration {
|
|
|
29
30
|
color: string;
|
|
30
31
|
}
|
|
31
32
|
type FillDeclaration = ImageFillDeclaration | ColorFillDeclaration;
|
|
32
|
-
type FillProp =
|
|
33
|
+
type FillProp = None | string | FillDeclaration;
|
|
33
34
|
|
|
34
35
|
type SVGPathData = string;
|
|
35
36
|
type FillRule = 'nonzero' | 'evenodd';
|
|
@@ -62,7 +63,7 @@ interface GeometryDeclaration {
|
|
|
62
63
|
name?: string;
|
|
63
64
|
data: Path2DDeclaration[];
|
|
64
65
|
}
|
|
65
|
-
type GeometryProp =
|
|
66
|
+
type GeometryProp = None | SVGPathData | SVGPathData[] | Path2DDeclaration[] | GeometryDeclaration;
|
|
66
67
|
|
|
67
68
|
interface MetaProp {
|
|
68
69
|
[key: string]: any;
|
|
@@ -74,18 +75,19 @@ interface IDOCNode {
|
|
|
74
75
|
meta?: MetaProp;
|
|
75
76
|
}
|
|
76
77
|
|
|
77
|
-
|
|
78
|
+
type ImageSource = string;
|
|
79
|
+
interface ImageSourceRect {
|
|
78
80
|
left?: number;
|
|
79
81
|
top?: number;
|
|
80
82
|
bottom?: number;
|
|
81
83
|
right?: number;
|
|
82
84
|
}
|
|
83
85
|
interface ImageDeclaration {
|
|
84
|
-
src:
|
|
85
|
-
srcRect?:
|
|
86
|
+
src: ImageSource;
|
|
87
|
+
srcRect?: ImageSourceRect;
|
|
86
88
|
opacity?: number;
|
|
87
89
|
}
|
|
88
|
-
type ImageProp =
|
|
90
|
+
type ImageProp = None | ImageSource | ImageDeclaration;
|
|
89
91
|
|
|
90
92
|
interface OutlineDeclaration {
|
|
91
93
|
width?: number;
|
|
@@ -94,33 +96,37 @@ interface OutlineDeclaration {
|
|
|
94
96
|
color?: string;
|
|
95
97
|
opacity?: number;
|
|
96
98
|
}
|
|
97
|
-
type OutlineProp =
|
|
99
|
+
type OutlineProp = None | string | Partial<OutlineDeclaration>;
|
|
98
100
|
|
|
101
|
+
type BoxShadow = None | string;
|
|
99
102
|
interface ShadowDeclaration {
|
|
100
103
|
color: string;
|
|
101
104
|
offsetX?: number;
|
|
102
105
|
offsetY?: number;
|
|
103
106
|
blur?: number;
|
|
104
107
|
}
|
|
105
|
-
type ShadowProp =
|
|
108
|
+
type ShadowProp = None | BoxShadow | ShadowDeclaration;
|
|
106
109
|
interface ShadowStyleDeclaration {
|
|
107
|
-
boxShadow:
|
|
110
|
+
boxShadow: BoxShadow;
|
|
108
111
|
shadowColor?: string;
|
|
109
112
|
shadowOffsetX?: number;
|
|
110
113
|
shadowOffsetY?: number;
|
|
111
114
|
shadowBlur?: number;
|
|
112
115
|
}
|
|
113
116
|
|
|
117
|
+
type StyleUnit = `${number}%` | number;
|
|
118
|
+
type Display = 'flex' | 'contents';
|
|
119
|
+
type Direction = 'inherit' | 'ltr' | 'rtl';
|
|
114
120
|
type Overflow = 'hidden' | 'visible';
|
|
115
121
|
type Visibility = 'hidden' | 'visible';
|
|
116
122
|
type FontWeight = 'normal' | 'bold' | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900;
|
|
117
123
|
type FontStyle = 'normal' | 'italic' | 'oblique' | `oblique ${string}`;
|
|
118
|
-
type FontKerning =
|
|
124
|
+
type FontKerning = None | 'auto' | 'normal';
|
|
119
125
|
type TextWrap = 'wrap' | 'nowrap';
|
|
120
126
|
type TextAlign = 'center' | 'end' | 'left' | 'right' | 'start';
|
|
121
|
-
type TextTransform =
|
|
127
|
+
type TextTransform = None | 'uppercase' | 'lowercase';
|
|
122
128
|
type TextOrientation = 'mixed' | 'upright' | 'sideways-right' | 'sideways';
|
|
123
|
-
type TextDecoration =
|
|
129
|
+
type TextDecoration = None | 'underline' | 'line-through' | 'overline';
|
|
124
130
|
type VerticalAlign = 'baseline' | 'top' | 'middle' | 'bottom' | 'sub' | 'super' | 'text-top' | 'text-bottom';
|
|
125
131
|
type WritingMode = 'horizontal-tb' | 'vertical-lr' | 'vertical-rl';
|
|
126
132
|
type Align = 'auto' | 'flex-start' | 'center' | 'flex-end' | 'stretch' | 'baseline' | 'space-between' | 'space-around' | 'space-evenly';
|
|
@@ -128,64 +134,64 @@ type FlexDirection = 'column' | 'column-reverse' | 'row' | 'row-reverse';
|
|
|
128
134
|
type FlexWrap = 'nowrap' | 'wrap' | 'Wrap-reverse';
|
|
129
135
|
type Justify = 'flex-start' | 'center' | 'flex-end' | 'space-between' | 'space-around' | 'space-evenly';
|
|
130
136
|
type Position = 'static' | 'relative' | 'absolute';
|
|
131
|
-
type BorderStyle =
|
|
137
|
+
type BorderStyle = None | 'dashed' | 'solid';
|
|
132
138
|
type BoxSizing = 'border-box' | 'content-box';
|
|
133
139
|
type PointerEvents = 'auto' | 'none';
|
|
134
|
-
type ListStyleType =
|
|
135
|
-
type ListStyleImage =
|
|
136
|
-
type ListStyleColormap =
|
|
137
|
-
type ListStyleSize =
|
|
140
|
+
type ListStyleType = None | 'disc';
|
|
141
|
+
type ListStyleImage = None | string;
|
|
142
|
+
type ListStyleColormap = None | Record<string, string>;
|
|
143
|
+
type ListStyleSize = StyleUnit | `${number}rem` | 'cover';
|
|
138
144
|
type ListStylePosition = 'inside' | 'outside';
|
|
139
145
|
type HighlightLine = TextDecoration | 'outline';
|
|
140
|
-
type HighlightImage =
|
|
141
|
-
type HighlightReferImage =
|
|
142
|
-
type HighlightColormap =
|
|
143
|
-
type HighlightSize =
|
|
144
|
-
type HighlightThickness =
|
|
146
|
+
type HighlightImage = None | string;
|
|
147
|
+
type HighlightReferImage = None | string;
|
|
148
|
+
type HighlightColormap = None | Record<string, string>;
|
|
149
|
+
type HighlightSize = StyleUnit | `${number}rem` | 'cover';
|
|
150
|
+
type HighlightThickness = StyleUnit;
|
|
145
151
|
|
|
146
152
|
interface LayoutStyleDeclaration {
|
|
147
153
|
overflow: Overflow;
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
154
|
+
direction?: Direction;
|
|
155
|
+
display?: Display;
|
|
156
|
+
boxSizing?: BoxSizing;
|
|
157
|
+
width?: StyleUnit | 'auto';
|
|
158
|
+
height?: StyleUnit | 'auto';
|
|
159
|
+
maxHeight?: StyleUnit;
|
|
160
|
+
maxWidth?: StyleUnit;
|
|
161
|
+
minHeight?: StyleUnit;
|
|
162
|
+
minWidth?: StyleUnit;
|
|
163
|
+
position?: Position;
|
|
164
|
+
left: StyleUnit;
|
|
165
|
+
top: StyleUnit;
|
|
166
|
+
right?: StyleUnit;
|
|
167
|
+
bottom?: StyleUnit;
|
|
168
|
+
borderTop?: string;
|
|
169
|
+
borderLeft?: string;
|
|
170
|
+
borderRight?: string;
|
|
171
|
+
borderBottom?: string;
|
|
172
|
+
borderWidth?: number;
|
|
173
|
+
border?: string;
|
|
174
|
+
flex?: number;
|
|
175
|
+
flexBasis?: StyleUnit | 'auto';
|
|
176
|
+
flexDirection?: FlexDirection;
|
|
177
|
+
flexGrow?: number;
|
|
178
|
+
flexShrink?: number;
|
|
179
|
+
flexWrap?: FlexWrap;
|
|
180
|
+
alignContent?: Align;
|
|
181
|
+
alignItems?: Align;
|
|
182
|
+
alignSelf?: Align;
|
|
183
|
+
justifyContent?: Justify;
|
|
184
|
+
gap?: StyleUnit;
|
|
185
|
+
marginTop?: None | StyleUnit | 'auto';
|
|
186
|
+
marginLeft?: None | StyleUnit | 'auto';
|
|
187
|
+
marginRight?: None | StyleUnit | 'auto';
|
|
188
|
+
marginBottom?: None | StyleUnit | 'auto';
|
|
189
|
+
margin?: None | StyleUnit | 'auto';
|
|
190
|
+
paddingTop?: StyleUnit;
|
|
191
|
+
paddingLeft?: StyleUnit;
|
|
192
|
+
paddingRight?: StyleUnit;
|
|
193
|
+
paddingBottom?: StyleUnit;
|
|
194
|
+
padding?: StyleUnit;
|
|
189
195
|
}
|
|
190
196
|
|
|
191
197
|
interface TransformStyleDeclaration {
|
|
@@ -196,20 +202,25 @@ interface TransformStyleDeclaration {
|
|
|
196
202
|
skewY: number;
|
|
197
203
|
translateX: number;
|
|
198
204
|
translateY: number;
|
|
199
|
-
transform: string;
|
|
205
|
+
transform: None | string;
|
|
200
206
|
transformOrigin: string;
|
|
201
207
|
}
|
|
202
208
|
|
|
203
209
|
interface ElementStyleDeclaration extends LayoutStyleDeclaration, TransformStyleDeclaration, ShadowStyleDeclaration {
|
|
210
|
+
backgroundImage?: None | string;
|
|
211
|
+
backgroundColor?: None | string;
|
|
212
|
+
borderRadius: number;
|
|
213
|
+
borderColor?: None | string;
|
|
214
|
+
borderStyle: BorderStyle;
|
|
215
|
+
outlineWidth: number;
|
|
216
|
+
outlineOffset: number;
|
|
217
|
+
outlineColor: None | string;
|
|
218
|
+
outlineStyle: string;
|
|
204
219
|
visibility: Visibility;
|
|
205
220
|
filter: string;
|
|
206
221
|
opacity: number;
|
|
207
|
-
backgroundImage: Noneable | string;
|
|
208
|
-
backgroundColor: Noneable | string;
|
|
209
|
-
borderRadius: number;
|
|
210
|
-
borderColor: Noneable | string;
|
|
211
|
-
borderStyle: BorderStyle;
|
|
212
222
|
pointerEvents: PointerEvents;
|
|
223
|
+
maskImage: None | string;
|
|
213
224
|
}
|
|
214
225
|
|
|
215
226
|
interface HighlightDeclaration {
|
|
@@ -299,11 +310,12 @@ type TextProp = string | TextContent | (TextDeclaration & {
|
|
|
299
310
|
content: TextContent;
|
|
300
311
|
}) | TextDeclaration;
|
|
301
312
|
|
|
313
|
+
type VideoSource = string;
|
|
302
314
|
interface VideoDeclaration {
|
|
303
|
-
src:
|
|
315
|
+
src: VideoSource;
|
|
304
316
|
opacity?: number;
|
|
305
317
|
}
|
|
306
|
-
type VideoProp =
|
|
318
|
+
type VideoProp = None | VideoSource | VideoDeclaration;
|
|
307
319
|
|
|
308
320
|
interface IDOCElement extends IDOCNode {
|
|
309
321
|
style?: StyleProp;
|
|
@@ -338,6 +350,8 @@ interface IDOCDocumentDeclaration extends IDOCElementDeclaration {
|
|
|
338
350
|
|
|
339
351
|
declare function getDefaultElementStyle(): ElementStyleDeclaration;
|
|
340
352
|
|
|
353
|
+
declare function getDefaultLayoutStyle(): LayoutStyleDeclaration;
|
|
354
|
+
|
|
341
355
|
declare function getDefaultShadowStyle(): ShadowStyleDeclaration;
|
|
342
356
|
|
|
343
357
|
declare function getDefaultStyle(): StyleDeclaration;
|
|
@@ -369,4 +383,4 @@ declare function normalizeTextContent(content?: TextContent): TextContentDeclara
|
|
|
369
383
|
|
|
370
384
|
declare function normalizeVideo(video?: VideoProp): VideoDeclaration | undefined;
|
|
371
385
|
|
|
372
|
-
export { type Align, type AudioDeclaration, type AudioProp, type BorderStyle, type BoxSizing, type ColorFillDeclaration, type CommonFillDeclaration, type ElementStyleDeclaration, type FillDeclaration, type FillProp, type FillRule, type FlexDirection, type FlexWrap, type FontKerning, type FontStyle, type FontWeight, type FragmentContent, type GeometryDeclaration, type GeometryProp, type HighlightColormap, type HighlightDeclaration, type HighlightImage, type HighlightLine, type HighlightReferImage, type HighlightSize, type HighlightStyleDeclaration, type HighlightThickness, type IDOCDocument, type IDOCDocumentDeclaration, type IDOCElement, type IDOCElementDeclaration, type IDOCNode, type ImageDeclaration, type ImageFillDeclaration, type ImageFillTile, type ImageProp, type
|
|
386
|
+
export { type Align, type AudioDeclaration, type AudioProp, type AudioSource, type BorderStyle, type BoxShadow, type BoxSizing, type ColorFillDeclaration, type CommonFillDeclaration, type Direction, type Display, type ElementStyleDeclaration, type FillDeclaration, type FillProp, type FillRule, type FlexDirection, type FlexWrap, type FontKerning, type FontStyle, type FontWeight, type FragmentContent, type GeometryDeclaration, type GeometryProp, type HighlightColormap, type HighlightDeclaration, type HighlightImage, type HighlightLine, type HighlightReferImage, type HighlightSize, type HighlightStyleDeclaration, type HighlightThickness, type IDOCDocument, type IDOCDocumentDeclaration, type IDOCElement, type IDOCElementDeclaration, type IDOCNode, type ImageDeclaration, type ImageFillDeclaration, type ImageFillSource, type ImageFillTile, type ImageProp, type ImageSource, type ImageSourceRect, type Justify, type LayoutStyleDeclaration, type ListStyleColormap, type ListStyleDeclaration, type ListStyleImage, type ListStylePosition, type ListStyleSize, type ListStyleStyleDeclaration, type ListStyleType, type MetaProp, type OutlineDeclaration, type OutlineProp, type Overflow, type ParagraphContent, type Path2DDeclaration, type Path2DStyle, type PointerEvents, type Position, type SVGPathData, type ShadowDeclaration, type ShadowProp, type ShadowStyleDeclaration, type StrokeLinecap, type StrokeLinejoin, type StyleDeclaration, type StyleProp, type StyleUnit, type TextAlign, type TextContent, type TextContentDeclaration, type TextContentFlat, type TextDeclaration, type TextDecoration, type TextDrawStyleDeclaration, type TextInlineStyleDeclaration, type TextLineStyleDeclaration, type TextOrientation, type TextProp, type TextStyleDeclaration, type TextTransform, type TextWrap, type TransformStyleDeclaration, type VerticalAlign, type VideoDeclaration, type VideoProp, type VideoSource, type Visibility, type WritingMode, clearUndef, deepClearUndef, getDefaultElementStyle, getDefaultLayoutStyle, getDefaultShadowStyle, getDefaultStyle, getDefaultTextStyle, getDefaultTransformStyle, normalizeAudio, normalizeElement, normalizeFill, normalizeGeometry, normalizeImage, normalizeOutline, normalizeShadow, normalizeText, normalizeTextContent, normalizeVideo };
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(n,o){typeof exports=="object"&&typeof module<"u"?o(exports):typeof define=="function"&&define.amd?define(["exports"],o):(n=typeof globalThis<"u"?globalThis:n||self,o(n.modernIdoc={}))})(this,function(n){"use strict";function o(){return{overflow:"visible",
|
|
1
|
+
(function(n,o){typeof exports=="object"&&typeof module<"u"?o(exports):typeof define=="function"&&define.amd?define(["exports"],o):(n=typeof globalThis<"u"?globalThis:n||self,o(n.modernIdoc={}))})(this,function(n){"use strict";function o(){return{overflow:"visible",direction:void 0,display:void 0,boxSizing:void 0,width:void 0,height:void 0,maxHeight:void 0,maxWidth:void 0,minHeight:void 0,minWidth:void 0,position:void 0,left:0,top:0,right:void 0,bottom:void 0,borderTop:void 0,borderLeft:void 0,borderRight:void 0,borderBottom:void 0,borderWidth:0,border:void 0,flex:void 0,flexBasis:void 0,flexDirection:void 0,flexGrow:void 0,flexShrink:void 0,flexWrap:void 0,justifyContent:void 0,gap:void 0,alignContent:void 0,alignItems:void 0,alignSelf:void 0,marginTop:void 0,marginLeft:void 0,marginRight:void 0,marginBottom:void 0,margin:void 0,paddingTop:void 0,paddingLeft:void 0,paddingRight:void 0,paddingBottom:void 0,padding:void 0}}function d(){return{boxShadow:"none"}}function u(){return{rotate:0,scaleX:1,scaleY:1,skewX:0,skewY:0,translateX:0,translateY:0,transform:"none",transformOrigin:"center"}}function s(){return{...o(),...u(),...d(),backgroundImage:"none",backgroundColor:"none",borderRadius:0,borderColor:"none",borderStyle:"solid",outlineWidth:0,outlineOffset:0,outlineColor:"#000000",outlineStyle:"none",visibility:"visible",filter:"none",opacity:1,pointerEvents:"auto",maskImage:"none"}}function g(){return{writingMode:"horizontal-tb",verticalAlign:"baseline",lineHeight:1.2,letterSpacing:0,wordSpacing:0,fontSize:14,fontWeight:"normal",fontFamily:"",fontStyle:"normal",fontKerning:"normal",textWrap:"wrap",textAlign:"start",textIndent:0,textTransform:"none",textOrientation:"mixed",textDecoration:"none",textStrokeWidth:0,textStrokeColor:"black",color:"black",listStyleType:"none",listStyleImage:"none",listStyleColormap:"none",listStyleSize:"cover",listStylePosition:"outside",highlightImage:"none",highlightReferImage:"none",highlightColormap:"none",highlightLine:"none",highlightSize:"cover",highlightThickness:"100%"}}function T(){return{...s(),...g()}}function l(e,i=!1){if(typeof e!="object"||!e)return e;if(Array.isArray(e))return i?e.map(r=>l(r,i)):e;const t={};for(const r in e){const a=e[r];a!=null&&(i?t[r]=l(a,i):t[r]=a)}return t}function D(e){return l(e,!0)}function c(e){if(!(!e||e==="none"))return typeof e=="string"?{src:e}:{...e}}function m(e){if(!(!e||e==="none"))return typeof e=="string"?{type:"color",color:e}:e}function v(e){if(!(!e||e==="none"))return typeof e=="string"?{data:[{data:e}]}:Array.isArray(e)?{data:e.map(i=>typeof i=="string"?{data:i}:i)}:e}function y(e){if(!(!e||e==="none"))return typeof e=="string"?{src:e}:e}function h(e){if(!(!e||e==="none"))return typeof e=="string"?{color:e}:e}function S(e){if(!(!e||e==="none"))return typeof e=="string"?{color:e}:e}function f(e=""){return(Array.isArray(e)?e:[e]).map(t=>typeof t=="string"?{fragments:[{content:t}]}:"content"in t?{fragments:[{...t}]}:"fragments"in t?{...t,fragments:t.fragments.map(r=>({...r}))}:Array.isArray(t)?{fragments:t.map(r=>typeof r=="string"?{content:r}:{...r})}:{fragments:[]})}function z(e){if(!(!e||e==="none"))return typeof e=="string"?{content:[{fragments:[{content:e}]}]}:"content"in e?{...e,content:f(e.content)}:{content:f(e)}}function p(e){if(!(!e||e==="none"))return typeof e=="string"?{src:e}:{...e}}function b(e){var i;return l({...e,image:y(e.image),video:p(e.video),audio:c(e.audio),text:z(e.text),geometry:v(e.geometry),fill:m(e.fill),outline:h(e.outline),shadow:S(e.shadow),children:(i=e.children)==null?void 0:i.map(t=>b(t))})}n.clearUndef=l,n.deepClearUndef=D,n.getDefaultElementStyle=s,n.getDefaultLayoutStyle=o,n.getDefaultShadowStyle=d,n.getDefaultStyle=T,n.getDefaultTextStyle=g,n.getDefaultTransformStyle=u,n.normalizeAudio=c,n.normalizeElement=b,n.normalizeFill=m,n.normalizeGeometry=v,n.normalizeImage=y,n.normalizeOutline=h,n.normalizeShadow=S,n.normalizeText=z,n.normalizeTextContent=f,n.normalizeVideo=p,Object.defineProperty(n,Symbol.toStringTag,{value:"Module"})});
|
package/dist/index.mjs
CHANGED
|
@@ -1,47 +1,53 @@
|
|
|
1
1
|
function getDefaultLayoutStyle() {
|
|
2
2
|
return {
|
|
3
|
+
// box
|
|
3
4
|
overflow: "visible",
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
flex: 0,
|
|
16
|
-
flexBasis: "auto",
|
|
17
|
-
flexDirection: "row",
|
|
18
|
-
flexGrow: 0,
|
|
19
|
-
flexShrink: 1,
|
|
20
|
-
flexWrap: "nowrap",
|
|
21
|
-
height: "auto",
|
|
22
|
-
justifyContent: "flex-start",
|
|
23
|
-
gap: 0,
|
|
24
|
-
marginTop: 0,
|
|
25
|
-
marginLeft: 0,
|
|
26
|
-
marginRight: 0,
|
|
27
|
-
marginBottom: 0,
|
|
28
|
-
margin: 0,
|
|
29
|
-
maxHeight: 0,
|
|
30
|
-
maxWidth: 0,
|
|
31
|
-
minHeight: 0,
|
|
32
|
-
minWidth: 0,
|
|
33
|
-
paddingTop: 0,
|
|
34
|
-
paddingLeft: 0,
|
|
35
|
-
paddingRight: 0,
|
|
36
|
-
paddingBottom: 0,
|
|
37
|
-
padding: 0,
|
|
38
|
-
top: 0,
|
|
39
|
-
bottom: 0,
|
|
5
|
+
direction: void 0,
|
|
6
|
+
display: void 0,
|
|
7
|
+
boxSizing: void 0,
|
|
8
|
+
width: void 0,
|
|
9
|
+
height: void 0,
|
|
10
|
+
maxHeight: void 0,
|
|
11
|
+
maxWidth: void 0,
|
|
12
|
+
minHeight: void 0,
|
|
13
|
+
minWidth: void 0,
|
|
14
|
+
// position
|
|
15
|
+
position: void 0,
|
|
40
16
|
left: 0,
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
17
|
+
top: 0,
|
|
18
|
+
right: void 0,
|
|
19
|
+
bottom: void 0,
|
|
20
|
+
// border
|
|
21
|
+
borderTop: void 0,
|
|
22
|
+
borderLeft: void 0,
|
|
23
|
+
borderRight: void 0,
|
|
24
|
+
borderBottom: void 0,
|
|
25
|
+
borderWidth: 0,
|
|
26
|
+
border: void 0,
|
|
27
|
+
// flex
|
|
28
|
+
flex: void 0,
|
|
29
|
+
flexBasis: void 0,
|
|
30
|
+
flexDirection: void 0,
|
|
31
|
+
flexGrow: void 0,
|
|
32
|
+
flexShrink: void 0,
|
|
33
|
+
flexWrap: void 0,
|
|
34
|
+
justifyContent: void 0,
|
|
35
|
+
gap: void 0,
|
|
36
|
+
alignContent: void 0,
|
|
37
|
+
alignItems: void 0,
|
|
38
|
+
alignSelf: void 0,
|
|
39
|
+
// margin
|
|
40
|
+
marginTop: void 0,
|
|
41
|
+
marginLeft: void 0,
|
|
42
|
+
marginRight: void 0,
|
|
43
|
+
marginBottom: void 0,
|
|
44
|
+
margin: void 0,
|
|
45
|
+
// padding
|
|
46
|
+
paddingTop: void 0,
|
|
47
|
+
paddingLeft: void 0,
|
|
48
|
+
paddingRight: void 0,
|
|
49
|
+
paddingBottom: void 0,
|
|
50
|
+
padding: void 0
|
|
45
51
|
};
|
|
46
52
|
}
|
|
47
53
|
|
|
@@ -67,12 +73,9 @@ function getDefaultTransformStyle() {
|
|
|
67
73
|
|
|
68
74
|
function getDefaultElementStyle() {
|
|
69
75
|
return {
|
|
70
|
-
...getDefaultTransformStyle(),
|
|
71
76
|
...getDefaultLayoutStyle(),
|
|
77
|
+
...getDefaultTransformStyle(),
|
|
72
78
|
...getDefaultShadowStyle(),
|
|
73
|
-
visibility: "visible",
|
|
74
|
-
filter: "none",
|
|
75
|
-
opacity: 1,
|
|
76
79
|
// background
|
|
77
80
|
backgroundImage: "none",
|
|
78
81
|
backgroundColor: "none",
|
|
@@ -80,7 +83,17 @@ function getDefaultElementStyle() {
|
|
|
80
83
|
borderRadius: 0,
|
|
81
84
|
borderColor: "none",
|
|
82
85
|
borderStyle: "solid",
|
|
83
|
-
|
|
86
|
+
// outline
|
|
87
|
+
outlineWidth: 0,
|
|
88
|
+
outlineOffset: 0,
|
|
89
|
+
outlineColor: "#000000",
|
|
90
|
+
outlineStyle: "none",
|
|
91
|
+
// other
|
|
92
|
+
visibility: "visible",
|
|
93
|
+
filter: "none",
|
|
94
|
+
opacity: 1,
|
|
95
|
+
pointerEvents: "auto",
|
|
96
|
+
maskImage: "none"
|
|
84
97
|
};
|
|
85
98
|
}
|
|
86
99
|
|
|
@@ -343,4 +356,4 @@ function normalizeElement(element) {
|
|
|
343
356
|
});
|
|
344
357
|
}
|
|
345
358
|
|
|
346
|
-
export { clearUndef, deepClearUndef, getDefaultElementStyle, getDefaultShadowStyle, getDefaultStyle, getDefaultTextStyle, getDefaultTransformStyle, normalizeAudio, normalizeElement, normalizeFill, normalizeGeometry, normalizeImage, normalizeOutline, normalizeShadow, normalizeText, normalizeTextContent, normalizeVideo };
|
|
359
|
+
export { clearUndef, deepClearUndef, getDefaultElementStyle, getDefaultLayoutStyle, getDefaultShadowStyle, getDefaultStyle, getDefaultTextStyle, getDefaultTransformStyle, normalizeAudio, normalizeElement, normalizeFill, normalizeGeometry, normalizeImage, normalizeOutline, normalizeShadow, normalizeText, normalizeTextContent, normalizeVideo };
|