modern-idoc 0.3.1 → 0.3.3
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 +11 -0
- package/dist/index.cjs +2 -10
- package/dist/index.d.cts +74 -25
- package/dist/index.d.mts +74 -25
- package/dist/index.d.ts +74 -25
- package/dist/index.js +1 -1
- package/dist/index.mjs +2 -10
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -75,3 +75,14 @@ const pdf: IDOCDocument = {
|
|
|
75
75
|
],
|
|
76
76
|
}
|
|
77
77
|
```
|
|
78
|
+
|
|
79
|
+
## Types
|
|
80
|
+
|
|
81
|
+
[view d.ts type file](https://unpkg.com/modern-idoc/dist/index.d.ts)
|
|
82
|
+
|
|
83
|
+
## Refer to these packages for usage
|
|
84
|
+
|
|
85
|
+
- [modern-text](https://github.com/qq15725/modern-text)
|
|
86
|
+
- [modern-pdf](https://github.com/qq15725/modern-pdf)
|
|
87
|
+
- [modern-openxml](https://github.com/qq15725/modern-openxml)
|
|
88
|
+
- [modern-canvas](https://github.com/qq15725/modern-canvas)
|
package/dist/index.cjs
CHANGED
|
@@ -4,11 +4,7 @@ function normalizeBackground(background) {
|
|
|
4
4
|
if (!background || background === "none") {
|
|
5
5
|
return void 0;
|
|
6
6
|
} else if (typeof background === "string") {
|
|
7
|
-
return
|
|
8
|
-
{ type: "texture", src: background }
|
|
9
|
-
];
|
|
10
|
-
} else if (!Array.isArray(background)) {
|
|
11
|
-
return [background];
|
|
7
|
+
return { src: background };
|
|
12
8
|
} else {
|
|
13
9
|
return background;
|
|
14
10
|
}
|
|
@@ -18,11 +14,7 @@ function normalizeFill(fill) {
|
|
|
18
14
|
if (!fill || fill === "none") {
|
|
19
15
|
return void 0;
|
|
20
16
|
} else if (typeof fill === "string") {
|
|
21
|
-
return
|
|
22
|
-
{ type: "solid", color: fill }
|
|
23
|
-
];
|
|
24
|
-
} else if (!Array.isArray(fill)) {
|
|
25
|
-
return [fill];
|
|
17
|
+
return { color: fill };
|
|
26
18
|
} else {
|
|
27
19
|
return fill;
|
|
28
20
|
}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,14 +1,67 @@
|
|
|
1
1
|
type None = 'none';
|
|
2
|
+
declare interface RgbColor {
|
|
3
|
+
r: number;
|
|
4
|
+
g: number;
|
|
5
|
+
b: number;
|
|
6
|
+
}
|
|
7
|
+
declare interface HslColor {
|
|
8
|
+
h: number;
|
|
9
|
+
s: number;
|
|
10
|
+
l: number;
|
|
11
|
+
}
|
|
12
|
+
declare interface HsvColor {
|
|
13
|
+
h: number;
|
|
14
|
+
s: number;
|
|
15
|
+
v: number;
|
|
16
|
+
}
|
|
17
|
+
declare interface HwbColor {
|
|
18
|
+
h: number;
|
|
19
|
+
w: number;
|
|
20
|
+
b: number;
|
|
21
|
+
}
|
|
22
|
+
interface XyzColor {
|
|
23
|
+
x: number;
|
|
24
|
+
y: number;
|
|
25
|
+
z: number;
|
|
26
|
+
}
|
|
27
|
+
interface LabColor {
|
|
28
|
+
l: number;
|
|
29
|
+
a: number;
|
|
30
|
+
b: number;
|
|
31
|
+
}
|
|
32
|
+
interface LchColor {
|
|
33
|
+
l: number;
|
|
34
|
+
c: number;
|
|
35
|
+
h: number;
|
|
36
|
+
}
|
|
37
|
+
interface CmykColor {
|
|
38
|
+
c: number;
|
|
39
|
+
m: number;
|
|
40
|
+
y: number;
|
|
41
|
+
k: number;
|
|
42
|
+
}
|
|
43
|
+
declare type WithAlpha<O> = O & {
|
|
44
|
+
a: number;
|
|
45
|
+
};
|
|
46
|
+
declare type RgbaColor = WithAlpha<RgbColor>;
|
|
47
|
+
declare type HslaColor = WithAlpha<HslColor>;
|
|
48
|
+
declare type HsvaColor = WithAlpha<HsvColor>;
|
|
49
|
+
declare type HwbaColor = WithAlpha<HwbColor>;
|
|
50
|
+
declare type XyzaColor = WithAlpha<XyzColor>;
|
|
51
|
+
declare type LabaColor = LabColor & {
|
|
52
|
+
alpha: number;
|
|
53
|
+
};
|
|
54
|
+
declare type LchaColor = WithAlpha<LchColor>;
|
|
55
|
+
declare type CmykaColor = WithAlpha<CmykColor>;
|
|
56
|
+
declare type ObjectColor = RgbColor | RgbaColor | HslColor | HslaColor | HsvColor | HsvaColor | HwbColor | HwbaColor | XyzColor | XyzaColor | LabColor | LabaColor | LchColor | LchaColor | CmykColor | CmykaColor;
|
|
57
|
+
declare type AnyColor = string | ObjectColor;
|
|
58
|
+
type ColorValue = number | AnyColor;
|
|
2
59
|
|
|
3
60
|
interface GradientFillDeclaration {
|
|
4
|
-
type: 'gradient';
|
|
5
|
-
opacity?: number;
|
|
6
61
|
}
|
|
7
62
|
|
|
8
63
|
interface SolidFillDeclaration {
|
|
9
|
-
|
|
10
|
-
color: string;
|
|
11
|
-
opacity?: number;
|
|
64
|
+
color: ColorValue;
|
|
12
65
|
}
|
|
13
66
|
|
|
14
67
|
/**
|
|
@@ -46,28 +99,24 @@ interface TextureFillTile {
|
|
|
46
99
|
}
|
|
47
100
|
type TextureFillSourceURL = string;
|
|
48
101
|
interface TextureFillDeclaration {
|
|
49
|
-
type: 'texture';
|
|
50
102
|
src: TextureFillSourceURL;
|
|
51
103
|
srcRect?: TextureFillSourceRect;
|
|
52
104
|
dpi?: number;
|
|
53
|
-
rotateWithShape?: boolean;
|
|
54
105
|
stretch?: TextureFillStretch;
|
|
55
106
|
tile?: TextureFillTile;
|
|
56
107
|
opacity?: number;
|
|
108
|
+
rotateWithShape?: boolean;
|
|
57
109
|
}
|
|
58
110
|
|
|
59
|
-
type
|
|
60
|
-
type
|
|
61
|
-
type FillProperty = None | string | SingleFillDeclaration | FillDeclaration;
|
|
111
|
+
type FillDeclaration = Partial<TextureFillDeclaration> & Partial<SolidFillDeclaration> & Partial<GradientFillDeclaration>;
|
|
112
|
+
type FillProperty = None | string | FillDeclaration;
|
|
62
113
|
declare function normalizeFill(fill?: FillProperty): FillDeclaration | undefined;
|
|
63
114
|
|
|
64
115
|
interface AudioBackgroundDeclaration {
|
|
65
|
-
type: 'audio';
|
|
66
116
|
src: string;
|
|
67
117
|
}
|
|
68
|
-
type
|
|
69
|
-
type
|
|
70
|
-
type BackgroundProperty = None | string | SingleBackgroundDeclaration | BackgroundDeclaration;
|
|
118
|
+
type BackgroundDeclaration = FillDeclaration & Partial<AudioBackgroundDeclaration>;
|
|
119
|
+
type BackgroundProperty = None | string | BackgroundDeclaration;
|
|
71
120
|
|
|
72
121
|
type SVGPathData = string;
|
|
73
122
|
type FillRule = 'nonzero' | 'evenodd';
|
|
@@ -77,7 +126,7 @@ interface GeometryPathStyle {
|
|
|
77
126
|
[key: string]: any;
|
|
78
127
|
opacity: number;
|
|
79
128
|
visibility: string;
|
|
80
|
-
shadowColor:
|
|
129
|
+
shadowColor: ColorValue;
|
|
81
130
|
shadowOffsetX: number;
|
|
82
131
|
shadowOffsetY: number;
|
|
83
132
|
shadowBlur: number;
|
|
@@ -118,8 +167,8 @@ interface IDOCNode {
|
|
|
118
167
|
interface OutlineDeclaration {
|
|
119
168
|
width?: number;
|
|
120
169
|
style?: 'dashed' | 'solid' | string;
|
|
121
|
-
|
|
122
|
-
color?:
|
|
170
|
+
src?: string;
|
|
171
|
+
color?: ColorValue;
|
|
123
172
|
opacity?: number;
|
|
124
173
|
}
|
|
125
174
|
type OutlineProperty = None | string | Partial<OutlineDeclaration>;
|
|
@@ -127,7 +176,7 @@ declare function normalizeOutline(outline?: OutlineProperty): OutlineDeclaration
|
|
|
127
176
|
|
|
128
177
|
type BoxShadow = None | string;
|
|
129
178
|
interface ShadowDeclaration {
|
|
130
|
-
color:
|
|
179
|
+
color: ColorValue;
|
|
131
180
|
offsetX?: number;
|
|
132
181
|
offsetY?: number;
|
|
133
182
|
blur?: number;
|
|
@@ -135,7 +184,7 @@ interface ShadowDeclaration {
|
|
|
135
184
|
type ShadowProperty = None | BoxShadow | ShadowDeclaration;
|
|
136
185
|
interface ShadowStyleDeclaration {
|
|
137
186
|
boxShadow: BoxShadow;
|
|
138
|
-
shadowColor?:
|
|
187
|
+
shadowColor?: ColorValue;
|
|
139
188
|
shadowOffsetX?: number;
|
|
140
189
|
shadowOffsetY?: number;
|
|
141
190
|
shadowBlur?: number;
|
|
@@ -239,13 +288,13 @@ declare function getDefaultTransformStyle(): TransformStyleDeclaration;
|
|
|
239
288
|
|
|
240
289
|
interface ElementStyleDeclaration extends LayoutStyleDeclaration, TransformStyleDeclaration, ShadowStyleDeclaration {
|
|
241
290
|
backgroundImage?: None | string;
|
|
242
|
-
backgroundColor?: None |
|
|
291
|
+
backgroundColor?: None | ColorValue;
|
|
243
292
|
borderRadius: number;
|
|
244
|
-
borderColor?: None |
|
|
293
|
+
borderColor?: None | ColorValue;
|
|
245
294
|
borderStyle: BorderStyle;
|
|
246
295
|
outlineWidth: number;
|
|
247
296
|
outlineOffset: number;
|
|
248
|
-
outlineColor: None |
|
|
297
|
+
outlineColor: None | ColorValue;
|
|
249
298
|
outlineStyle: string;
|
|
250
299
|
visibility: Visibility;
|
|
251
300
|
filter: string;
|
|
@@ -292,7 +341,7 @@ interface ListStyleStyleDeclaration {
|
|
|
292
341
|
declare function getDefaultListStyleStyle(): ListStyleStyleDeclaration;
|
|
293
342
|
|
|
294
343
|
interface TextInlineStyleDeclaration extends HighlightStyleDeclaration {
|
|
295
|
-
color:
|
|
344
|
+
color: ColorValue;
|
|
296
345
|
verticalAlign: VerticalAlign;
|
|
297
346
|
letterSpacing: number;
|
|
298
347
|
wordSpacing: number;
|
|
@@ -318,7 +367,7 @@ declare function getDefaultTextLineStyle(): TextLineStyleDeclaration;
|
|
|
318
367
|
|
|
319
368
|
interface TextDrawStyleDeclaration {
|
|
320
369
|
textStrokeWidth: number;
|
|
321
|
-
textStrokeColor:
|
|
370
|
+
textStrokeColor: ColorValue;
|
|
322
371
|
}
|
|
323
372
|
interface TextStyleDeclaration extends TextLineStyleDeclaration, TextInlineStyleDeclaration, TextDrawStyleDeclaration {
|
|
324
373
|
}
|
|
@@ -381,4 +430,4 @@ declare function normalizeDocument(doc: IDOCDocument): IDOCDocumentDeclaration;
|
|
|
381
430
|
|
|
382
431
|
declare function clearUndef<T>(obj: T, deep?: boolean): T;
|
|
383
432
|
|
|
384
|
-
export { type Align, type BorderStyle, type BoxShadow, type BoxSizing, type Direction, type Display, type ElementStyleDeclaration, type FillDeclaration, type FillProperty, type FillRule, type FlexDirection, type FlexWrap, type FontKerning, type FontStyle, type FontWeight, type FragmentContent, type GeometryDeclaration, type GeometryPathDeclaration, type GeometryPathStyle, type GeometryProperty, type GradientFillDeclaration, 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 Justify, type LayoutStyleDeclaration, type ListStyleColormap, type ListStyleDeclaration, type ListStyleImage, type ListStylePosition, type ListStyleSize, type ListStyleStyleDeclaration, type ListStyleType, type MetaProperty, type None, type OutlineDeclaration, type OutlineProperty, type Overflow, type ParagraphContent, type PointerEvents, type Position, type SVGPathData, type ShadowDeclaration, type ShadowProperty, type ShadowStyleDeclaration, type
|
|
433
|
+
export { type Align, type AnyColor, type BorderStyle, type BoxShadow, type BoxSizing, type CmykColor, type CmykaColor, type ColorValue, type Direction, type Display, type ElementStyleDeclaration, type FillDeclaration, type FillProperty, type FillRule, type FlexDirection, type FlexWrap, type FontKerning, type FontStyle, type FontWeight, type FragmentContent, type GeometryDeclaration, type GeometryPathDeclaration, type GeometryPathStyle, type GeometryProperty, type GradientFillDeclaration, type HighlightColormap, type HighlightDeclaration, type HighlightImage, type HighlightLine, type HighlightReferImage, type HighlightSize, type HighlightStyleDeclaration, type HighlightThickness, type HslColor, type HslaColor, type HsvColor, type HsvaColor, type HwbColor, type HwbaColor, type IDOCDocument, type IDOCDocumentDeclaration, type IDOCElement, type IDOCElementDeclaration, type IDOCNode, type Justify, type LabColor, type LabaColor, type LayoutStyleDeclaration, type LchColor, type LchaColor, type ListStyleColormap, type ListStyleDeclaration, type ListStyleImage, type ListStylePosition, type ListStyleSize, type ListStyleStyleDeclaration, type ListStyleType, type MetaProperty, type None, type ObjectColor, type OutlineDeclaration, type OutlineProperty, type Overflow, type ParagraphContent, type PointerEvents, type Position, type RgbColor, type RgbaColor, type SVGPathData, type ShadowDeclaration, type ShadowProperty, type ShadowStyleDeclaration, type SolidFillDeclaration, type StrokeLinecap, type StrokeLinejoin, type StyleDeclaration, type StyleProperty, type StyleUnit, type TextAlign, type TextContent, type TextContentDeclaration, type TextContentFlat, type TextDeclaration, type TextDecoration, type TextDrawStyleDeclaration, type TextInlineStyleDeclaration, type TextLineStyleDeclaration, type TextOrientation, type TextProperty, type TextStyleDeclaration, type TextTransform, type TextWrap, type TextureFillDeclaration, type TextureFillSourceRect, type TextureFillSourceURL, type TextureFillStretch, type TextureFillStretchRect, type TextureFillTile, type TransformStyleDeclaration, type VerticalAlign, type Visibility, type WritingMode, type XyzColor, type XyzaColor, clearUndef, getDefaultElementStyle, getDefaultHighlightStyle, getDefaultLayoutStyle, getDefaultListStyleStyle, getDefaultShadowStyle, getDefaultStyle, getDefaultTextInlineStyle, getDefaultTextLineStyle, getDefaultTextStyle, getDefaultTransformStyle, normalizeDocument, normalizeElement, normalizeFill, normalizeGeometry, normalizeOutline, normalizeShadow, normalizeText, normalizeTextContent };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,14 +1,67 @@
|
|
|
1
1
|
type None = 'none';
|
|
2
|
+
declare interface RgbColor {
|
|
3
|
+
r: number;
|
|
4
|
+
g: number;
|
|
5
|
+
b: number;
|
|
6
|
+
}
|
|
7
|
+
declare interface HslColor {
|
|
8
|
+
h: number;
|
|
9
|
+
s: number;
|
|
10
|
+
l: number;
|
|
11
|
+
}
|
|
12
|
+
declare interface HsvColor {
|
|
13
|
+
h: number;
|
|
14
|
+
s: number;
|
|
15
|
+
v: number;
|
|
16
|
+
}
|
|
17
|
+
declare interface HwbColor {
|
|
18
|
+
h: number;
|
|
19
|
+
w: number;
|
|
20
|
+
b: number;
|
|
21
|
+
}
|
|
22
|
+
interface XyzColor {
|
|
23
|
+
x: number;
|
|
24
|
+
y: number;
|
|
25
|
+
z: number;
|
|
26
|
+
}
|
|
27
|
+
interface LabColor {
|
|
28
|
+
l: number;
|
|
29
|
+
a: number;
|
|
30
|
+
b: number;
|
|
31
|
+
}
|
|
32
|
+
interface LchColor {
|
|
33
|
+
l: number;
|
|
34
|
+
c: number;
|
|
35
|
+
h: number;
|
|
36
|
+
}
|
|
37
|
+
interface CmykColor {
|
|
38
|
+
c: number;
|
|
39
|
+
m: number;
|
|
40
|
+
y: number;
|
|
41
|
+
k: number;
|
|
42
|
+
}
|
|
43
|
+
declare type WithAlpha<O> = O & {
|
|
44
|
+
a: number;
|
|
45
|
+
};
|
|
46
|
+
declare type RgbaColor = WithAlpha<RgbColor>;
|
|
47
|
+
declare type HslaColor = WithAlpha<HslColor>;
|
|
48
|
+
declare type HsvaColor = WithAlpha<HsvColor>;
|
|
49
|
+
declare type HwbaColor = WithAlpha<HwbColor>;
|
|
50
|
+
declare type XyzaColor = WithAlpha<XyzColor>;
|
|
51
|
+
declare type LabaColor = LabColor & {
|
|
52
|
+
alpha: number;
|
|
53
|
+
};
|
|
54
|
+
declare type LchaColor = WithAlpha<LchColor>;
|
|
55
|
+
declare type CmykaColor = WithAlpha<CmykColor>;
|
|
56
|
+
declare type ObjectColor = RgbColor | RgbaColor | HslColor | HslaColor | HsvColor | HsvaColor | HwbColor | HwbaColor | XyzColor | XyzaColor | LabColor | LabaColor | LchColor | LchaColor | CmykColor | CmykaColor;
|
|
57
|
+
declare type AnyColor = string | ObjectColor;
|
|
58
|
+
type ColorValue = number | AnyColor;
|
|
2
59
|
|
|
3
60
|
interface GradientFillDeclaration {
|
|
4
|
-
type: 'gradient';
|
|
5
|
-
opacity?: number;
|
|
6
61
|
}
|
|
7
62
|
|
|
8
63
|
interface SolidFillDeclaration {
|
|
9
|
-
|
|
10
|
-
color: string;
|
|
11
|
-
opacity?: number;
|
|
64
|
+
color: ColorValue;
|
|
12
65
|
}
|
|
13
66
|
|
|
14
67
|
/**
|
|
@@ -46,28 +99,24 @@ interface TextureFillTile {
|
|
|
46
99
|
}
|
|
47
100
|
type TextureFillSourceURL = string;
|
|
48
101
|
interface TextureFillDeclaration {
|
|
49
|
-
type: 'texture';
|
|
50
102
|
src: TextureFillSourceURL;
|
|
51
103
|
srcRect?: TextureFillSourceRect;
|
|
52
104
|
dpi?: number;
|
|
53
|
-
rotateWithShape?: boolean;
|
|
54
105
|
stretch?: TextureFillStretch;
|
|
55
106
|
tile?: TextureFillTile;
|
|
56
107
|
opacity?: number;
|
|
108
|
+
rotateWithShape?: boolean;
|
|
57
109
|
}
|
|
58
110
|
|
|
59
|
-
type
|
|
60
|
-
type
|
|
61
|
-
type FillProperty = None | string | SingleFillDeclaration | FillDeclaration;
|
|
111
|
+
type FillDeclaration = Partial<TextureFillDeclaration> & Partial<SolidFillDeclaration> & Partial<GradientFillDeclaration>;
|
|
112
|
+
type FillProperty = None | string | FillDeclaration;
|
|
62
113
|
declare function normalizeFill(fill?: FillProperty): FillDeclaration | undefined;
|
|
63
114
|
|
|
64
115
|
interface AudioBackgroundDeclaration {
|
|
65
|
-
type: 'audio';
|
|
66
116
|
src: string;
|
|
67
117
|
}
|
|
68
|
-
type
|
|
69
|
-
type
|
|
70
|
-
type BackgroundProperty = None | string | SingleBackgroundDeclaration | BackgroundDeclaration;
|
|
118
|
+
type BackgroundDeclaration = FillDeclaration & Partial<AudioBackgroundDeclaration>;
|
|
119
|
+
type BackgroundProperty = None | string | BackgroundDeclaration;
|
|
71
120
|
|
|
72
121
|
type SVGPathData = string;
|
|
73
122
|
type FillRule = 'nonzero' | 'evenodd';
|
|
@@ -77,7 +126,7 @@ interface GeometryPathStyle {
|
|
|
77
126
|
[key: string]: any;
|
|
78
127
|
opacity: number;
|
|
79
128
|
visibility: string;
|
|
80
|
-
shadowColor:
|
|
129
|
+
shadowColor: ColorValue;
|
|
81
130
|
shadowOffsetX: number;
|
|
82
131
|
shadowOffsetY: number;
|
|
83
132
|
shadowBlur: number;
|
|
@@ -118,8 +167,8 @@ interface IDOCNode {
|
|
|
118
167
|
interface OutlineDeclaration {
|
|
119
168
|
width?: number;
|
|
120
169
|
style?: 'dashed' | 'solid' | string;
|
|
121
|
-
|
|
122
|
-
color?:
|
|
170
|
+
src?: string;
|
|
171
|
+
color?: ColorValue;
|
|
123
172
|
opacity?: number;
|
|
124
173
|
}
|
|
125
174
|
type OutlineProperty = None | string | Partial<OutlineDeclaration>;
|
|
@@ -127,7 +176,7 @@ declare function normalizeOutline(outline?: OutlineProperty): OutlineDeclaration
|
|
|
127
176
|
|
|
128
177
|
type BoxShadow = None | string;
|
|
129
178
|
interface ShadowDeclaration {
|
|
130
|
-
color:
|
|
179
|
+
color: ColorValue;
|
|
131
180
|
offsetX?: number;
|
|
132
181
|
offsetY?: number;
|
|
133
182
|
blur?: number;
|
|
@@ -135,7 +184,7 @@ interface ShadowDeclaration {
|
|
|
135
184
|
type ShadowProperty = None | BoxShadow | ShadowDeclaration;
|
|
136
185
|
interface ShadowStyleDeclaration {
|
|
137
186
|
boxShadow: BoxShadow;
|
|
138
|
-
shadowColor?:
|
|
187
|
+
shadowColor?: ColorValue;
|
|
139
188
|
shadowOffsetX?: number;
|
|
140
189
|
shadowOffsetY?: number;
|
|
141
190
|
shadowBlur?: number;
|
|
@@ -239,13 +288,13 @@ declare function getDefaultTransformStyle(): TransformStyleDeclaration;
|
|
|
239
288
|
|
|
240
289
|
interface ElementStyleDeclaration extends LayoutStyleDeclaration, TransformStyleDeclaration, ShadowStyleDeclaration {
|
|
241
290
|
backgroundImage?: None | string;
|
|
242
|
-
backgroundColor?: None |
|
|
291
|
+
backgroundColor?: None | ColorValue;
|
|
243
292
|
borderRadius: number;
|
|
244
|
-
borderColor?: None |
|
|
293
|
+
borderColor?: None | ColorValue;
|
|
245
294
|
borderStyle: BorderStyle;
|
|
246
295
|
outlineWidth: number;
|
|
247
296
|
outlineOffset: number;
|
|
248
|
-
outlineColor: None |
|
|
297
|
+
outlineColor: None | ColorValue;
|
|
249
298
|
outlineStyle: string;
|
|
250
299
|
visibility: Visibility;
|
|
251
300
|
filter: string;
|
|
@@ -292,7 +341,7 @@ interface ListStyleStyleDeclaration {
|
|
|
292
341
|
declare function getDefaultListStyleStyle(): ListStyleStyleDeclaration;
|
|
293
342
|
|
|
294
343
|
interface TextInlineStyleDeclaration extends HighlightStyleDeclaration {
|
|
295
|
-
color:
|
|
344
|
+
color: ColorValue;
|
|
296
345
|
verticalAlign: VerticalAlign;
|
|
297
346
|
letterSpacing: number;
|
|
298
347
|
wordSpacing: number;
|
|
@@ -318,7 +367,7 @@ declare function getDefaultTextLineStyle(): TextLineStyleDeclaration;
|
|
|
318
367
|
|
|
319
368
|
interface TextDrawStyleDeclaration {
|
|
320
369
|
textStrokeWidth: number;
|
|
321
|
-
textStrokeColor:
|
|
370
|
+
textStrokeColor: ColorValue;
|
|
322
371
|
}
|
|
323
372
|
interface TextStyleDeclaration extends TextLineStyleDeclaration, TextInlineStyleDeclaration, TextDrawStyleDeclaration {
|
|
324
373
|
}
|
|
@@ -381,4 +430,4 @@ declare function normalizeDocument(doc: IDOCDocument): IDOCDocumentDeclaration;
|
|
|
381
430
|
|
|
382
431
|
declare function clearUndef<T>(obj: T, deep?: boolean): T;
|
|
383
432
|
|
|
384
|
-
export { type Align, type BorderStyle, type BoxShadow, type BoxSizing, type Direction, type Display, type ElementStyleDeclaration, type FillDeclaration, type FillProperty, type FillRule, type FlexDirection, type FlexWrap, type FontKerning, type FontStyle, type FontWeight, type FragmentContent, type GeometryDeclaration, type GeometryPathDeclaration, type GeometryPathStyle, type GeometryProperty, type GradientFillDeclaration, 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 Justify, type LayoutStyleDeclaration, type ListStyleColormap, type ListStyleDeclaration, type ListStyleImage, type ListStylePosition, type ListStyleSize, type ListStyleStyleDeclaration, type ListStyleType, type MetaProperty, type None, type OutlineDeclaration, type OutlineProperty, type Overflow, type ParagraphContent, type PointerEvents, type Position, type SVGPathData, type ShadowDeclaration, type ShadowProperty, type ShadowStyleDeclaration, type
|
|
433
|
+
export { type Align, type AnyColor, type BorderStyle, type BoxShadow, type BoxSizing, type CmykColor, type CmykaColor, type ColorValue, type Direction, type Display, type ElementStyleDeclaration, type FillDeclaration, type FillProperty, type FillRule, type FlexDirection, type FlexWrap, type FontKerning, type FontStyle, type FontWeight, type FragmentContent, type GeometryDeclaration, type GeometryPathDeclaration, type GeometryPathStyle, type GeometryProperty, type GradientFillDeclaration, type HighlightColormap, type HighlightDeclaration, type HighlightImage, type HighlightLine, type HighlightReferImage, type HighlightSize, type HighlightStyleDeclaration, type HighlightThickness, type HslColor, type HslaColor, type HsvColor, type HsvaColor, type HwbColor, type HwbaColor, type IDOCDocument, type IDOCDocumentDeclaration, type IDOCElement, type IDOCElementDeclaration, type IDOCNode, type Justify, type LabColor, type LabaColor, type LayoutStyleDeclaration, type LchColor, type LchaColor, type ListStyleColormap, type ListStyleDeclaration, type ListStyleImage, type ListStylePosition, type ListStyleSize, type ListStyleStyleDeclaration, type ListStyleType, type MetaProperty, type None, type ObjectColor, type OutlineDeclaration, type OutlineProperty, type Overflow, type ParagraphContent, type PointerEvents, type Position, type RgbColor, type RgbaColor, type SVGPathData, type ShadowDeclaration, type ShadowProperty, type ShadowStyleDeclaration, type SolidFillDeclaration, type StrokeLinecap, type StrokeLinejoin, type StyleDeclaration, type StyleProperty, type StyleUnit, type TextAlign, type TextContent, type TextContentDeclaration, type TextContentFlat, type TextDeclaration, type TextDecoration, type TextDrawStyleDeclaration, type TextInlineStyleDeclaration, type TextLineStyleDeclaration, type TextOrientation, type TextProperty, type TextStyleDeclaration, type TextTransform, type TextWrap, type TextureFillDeclaration, type TextureFillSourceRect, type TextureFillSourceURL, type TextureFillStretch, type TextureFillStretchRect, type TextureFillTile, type TransformStyleDeclaration, type VerticalAlign, type Visibility, type WritingMode, type XyzColor, type XyzaColor, clearUndef, getDefaultElementStyle, getDefaultHighlightStyle, getDefaultLayoutStyle, getDefaultListStyleStyle, getDefaultShadowStyle, getDefaultStyle, getDefaultTextInlineStyle, getDefaultTextLineStyle, getDefaultTextStyle, getDefaultTransformStyle, normalizeDocument, normalizeElement, normalizeFill, normalizeGeometry, normalizeOutline, normalizeShadow, normalizeText, normalizeTextContent };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,14 +1,67 @@
|
|
|
1
1
|
type None = 'none';
|
|
2
|
+
declare interface RgbColor {
|
|
3
|
+
r: number;
|
|
4
|
+
g: number;
|
|
5
|
+
b: number;
|
|
6
|
+
}
|
|
7
|
+
declare interface HslColor {
|
|
8
|
+
h: number;
|
|
9
|
+
s: number;
|
|
10
|
+
l: number;
|
|
11
|
+
}
|
|
12
|
+
declare interface HsvColor {
|
|
13
|
+
h: number;
|
|
14
|
+
s: number;
|
|
15
|
+
v: number;
|
|
16
|
+
}
|
|
17
|
+
declare interface HwbColor {
|
|
18
|
+
h: number;
|
|
19
|
+
w: number;
|
|
20
|
+
b: number;
|
|
21
|
+
}
|
|
22
|
+
interface XyzColor {
|
|
23
|
+
x: number;
|
|
24
|
+
y: number;
|
|
25
|
+
z: number;
|
|
26
|
+
}
|
|
27
|
+
interface LabColor {
|
|
28
|
+
l: number;
|
|
29
|
+
a: number;
|
|
30
|
+
b: number;
|
|
31
|
+
}
|
|
32
|
+
interface LchColor {
|
|
33
|
+
l: number;
|
|
34
|
+
c: number;
|
|
35
|
+
h: number;
|
|
36
|
+
}
|
|
37
|
+
interface CmykColor {
|
|
38
|
+
c: number;
|
|
39
|
+
m: number;
|
|
40
|
+
y: number;
|
|
41
|
+
k: number;
|
|
42
|
+
}
|
|
43
|
+
declare type WithAlpha<O> = O & {
|
|
44
|
+
a: number;
|
|
45
|
+
};
|
|
46
|
+
declare type RgbaColor = WithAlpha<RgbColor>;
|
|
47
|
+
declare type HslaColor = WithAlpha<HslColor>;
|
|
48
|
+
declare type HsvaColor = WithAlpha<HsvColor>;
|
|
49
|
+
declare type HwbaColor = WithAlpha<HwbColor>;
|
|
50
|
+
declare type XyzaColor = WithAlpha<XyzColor>;
|
|
51
|
+
declare type LabaColor = LabColor & {
|
|
52
|
+
alpha: number;
|
|
53
|
+
};
|
|
54
|
+
declare type LchaColor = WithAlpha<LchColor>;
|
|
55
|
+
declare type CmykaColor = WithAlpha<CmykColor>;
|
|
56
|
+
declare type ObjectColor = RgbColor | RgbaColor | HslColor | HslaColor | HsvColor | HsvaColor | HwbColor | HwbaColor | XyzColor | XyzaColor | LabColor | LabaColor | LchColor | LchaColor | CmykColor | CmykaColor;
|
|
57
|
+
declare type AnyColor = string | ObjectColor;
|
|
58
|
+
type ColorValue = number | AnyColor;
|
|
2
59
|
|
|
3
60
|
interface GradientFillDeclaration {
|
|
4
|
-
type: 'gradient';
|
|
5
|
-
opacity?: number;
|
|
6
61
|
}
|
|
7
62
|
|
|
8
63
|
interface SolidFillDeclaration {
|
|
9
|
-
|
|
10
|
-
color: string;
|
|
11
|
-
opacity?: number;
|
|
64
|
+
color: ColorValue;
|
|
12
65
|
}
|
|
13
66
|
|
|
14
67
|
/**
|
|
@@ -46,28 +99,24 @@ interface TextureFillTile {
|
|
|
46
99
|
}
|
|
47
100
|
type TextureFillSourceURL = string;
|
|
48
101
|
interface TextureFillDeclaration {
|
|
49
|
-
type: 'texture';
|
|
50
102
|
src: TextureFillSourceURL;
|
|
51
103
|
srcRect?: TextureFillSourceRect;
|
|
52
104
|
dpi?: number;
|
|
53
|
-
rotateWithShape?: boolean;
|
|
54
105
|
stretch?: TextureFillStretch;
|
|
55
106
|
tile?: TextureFillTile;
|
|
56
107
|
opacity?: number;
|
|
108
|
+
rotateWithShape?: boolean;
|
|
57
109
|
}
|
|
58
110
|
|
|
59
|
-
type
|
|
60
|
-
type
|
|
61
|
-
type FillProperty = None | string | SingleFillDeclaration | FillDeclaration;
|
|
111
|
+
type FillDeclaration = Partial<TextureFillDeclaration> & Partial<SolidFillDeclaration> & Partial<GradientFillDeclaration>;
|
|
112
|
+
type FillProperty = None | string | FillDeclaration;
|
|
62
113
|
declare function normalizeFill(fill?: FillProperty): FillDeclaration | undefined;
|
|
63
114
|
|
|
64
115
|
interface AudioBackgroundDeclaration {
|
|
65
|
-
type: 'audio';
|
|
66
116
|
src: string;
|
|
67
117
|
}
|
|
68
|
-
type
|
|
69
|
-
type
|
|
70
|
-
type BackgroundProperty = None | string | SingleBackgroundDeclaration | BackgroundDeclaration;
|
|
118
|
+
type BackgroundDeclaration = FillDeclaration & Partial<AudioBackgroundDeclaration>;
|
|
119
|
+
type BackgroundProperty = None | string | BackgroundDeclaration;
|
|
71
120
|
|
|
72
121
|
type SVGPathData = string;
|
|
73
122
|
type FillRule = 'nonzero' | 'evenodd';
|
|
@@ -77,7 +126,7 @@ interface GeometryPathStyle {
|
|
|
77
126
|
[key: string]: any;
|
|
78
127
|
opacity: number;
|
|
79
128
|
visibility: string;
|
|
80
|
-
shadowColor:
|
|
129
|
+
shadowColor: ColorValue;
|
|
81
130
|
shadowOffsetX: number;
|
|
82
131
|
shadowOffsetY: number;
|
|
83
132
|
shadowBlur: number;
|
|
@@ -118,8 +167,8 @@ interface IDOCNode {
|
|
|
118
167
|
interface OutlineDeclaration {
|
|
119
168
|
width?: number;
|
|
120
169
|
style?: 'dashed' | 'solid' | string;
|
|
121
|
-
|
|
122
|
-
color?:
|
|
170
|
+
src?: string;
|
|
171
|
+
color?: ColorValue;
|
|
123
172
|
opacity?: number;
|
|
124
173
|
}
|
|
125
174
|
type OutlineProperty = None | string | Partial<OutlineDeclaration>;
|
|
@@ -127,7 +176,7 @@ declare function normalizeOutline(outline?: OutlineProperty): OutlineDeclaration
|
|
|
127
176
|
|
|
128
177
|
type BoxShadow = None | string;
|
|
129
178
|
interface ShadowDeclaration {
|
|
130
|
-
color:
|
|
179
|
+
color: ColorValue;
|
|
131
180
|
offsetX?: number;
|
|
132
181
|
offsetY?: number;
|
|
133
182
|
blur?: number;
|
|
@@ -135,7 +184,7 @@ interface ShadowDeclaration {
|
|
|
135
184
|
type ShadowProperty = None | BoxShadow | ShadowDeclaration;
|
|
136
185
|
interface ShadowStyleDeclaration {
|
|
137
186
|
boxShadow: BoxShadow;
|
|
138
|
-
shadowColor?:
|
|
187
|
+
shadowColor?: ColorValue;
|
|
139
188
|
shadowOffsetX?: number;
|
|
140
189
|
shadowOffsetY?: number;
|
|
141
190
|
shadowBlur?: number;
|
|
@@ -239,13 +288,13 @@ declare function getDefaultTransformStyle(): TransformStyleDeclaration;
|
|
|
239
288
|
|
|
240
289
|
interface ElementStyleDeclaration extends LayoutStyleDeclaration, TransformStyleDeclaration, ShadowStyleDeclaration {
|
|
241
290
|
backgroundImage?: None | string;
|
|
242
|
-
backgroundColor?: None |
|
|
291
|
+
backgroundColor?: None | ColorValue;
|
|
243
292
|
borderRadius: number;
|
|
244
|
-
borderColor?: None |
|
|
293
|
+
borderColor?: None | ColorValue;
|
|
245
294
|
borderStyle: BorderStyle;
|
|
246
295
|
outlineWidth: number;
|
|
247
296
|
outlineOffset: number;
|
|
248
|
-
outlineColor: None |
|
|
297
|
+
outlineColor: None | ColorValue;
|
|
249
298
|
outlineStyle: string;
|
|
250
299
|
visibility: Visibility;
|
|
251
300
|
filter: string;
|
|
@@ -292,7 +341,7 @@ interface ListStyleStyleDeclaration {
|
|
|
292
341
|
declare function getDefaultListStyleStyle(): ListStyleStyleDeclaration;
|
|
293
342
|
|
|
294
343
|
interface TextInlineStyleDeclaration extends HighlightStyleDeclaration {
|
|
295
|
-
color:
|
|
344
|
+
color: ColorValue;
|
|
296
345
|
verticalAlign: VerticalAlign;
|
|
297
346
|
letterSpacing: number;
|
|
298
347
|
wordSpacing: number;
|
|
@@ -318,7 +367,7 @@ declare function getDefaultTextLineStyle(): TextLineStyleDeclaration;
|
|
|
318
367
|
|
|
319
368
|
interface TextDrawStyleDeclaration {
|
|
320
369
|
textStrokeWidth: number;
|
|
321
|
-
textStrokeColor:
|
|
370
|
+
textStrokeColor: ColorValue;
|
|
322
371
|
}
|
|
323
372
|
interface TextStyleDeclaration extends TextLineStyleDeclaration, TextInlineStyleDeclaration, TextDrawStyleDeclaration {
|
|
324
373
|
}
|
|
@@ -381,4 +430,4 @@ declare function normalizeDocument(doc: IDOCDocument): IDOCDocumentDeclaration;
|
|
|
381
430
|
|
|
382
431
|
declare function clearUndef<T>(obj: T, deep?: boolean): T;
|
|
383
432
|
|
|
384
|
-
export { type Align, type BorderStyle, type BoxShadow, type BoxSizing, type Direction, type Display, type ElementStyleDeclaration, type FillDeclaration, type FillProperty, type FillRule, type FlexDirection, type FlexWrap, type FontKerning, type FontStyle, type FontWeight, type FragmentContent, type GeometryDeclaration, type GeometryPathDeclaration, type GeometryPathStyle, type GeometryProperty, type GradientFillDeclaration, 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 Justify, type LayoutStyleDeclaration, type ListStyleColormap, type ListStyleDeclaration, type ListStyleImage, type ListStylePosition, type ListStyleSize, type ListStyleStyleDeclaration, type ListStyleType, type MetaProperty, type None, type OutlineDeclaration, type OutlineProperty, type Overflow, type ParagraphContent, type PointerEvents, type Position, type SVGPathData, type ShadowDeclaration, type ShadowProperty, type ShadowStyleDeclaration, type
|
|
433
|
+
export { type Align, type AnyColor, type BorderStyle, type BoxShadow, type BoxSizing, type CmykColor, type CmykaColor, type ColorValue, type Direction, type Display, type ElementStyleDeclaration, type FillDeclaration, type FillProperty, type FillRule, type FlexDirection, type FlexWrap, type FontKerning, type FontStyle, type FontWeight, type FragmentContent, type GeometryDeclaration, type GeometryPathDeclaration, type GeometryPathStyle, type GeometryProperty, type GradientFillDeclaration, type HighlightColormap, type HighlightDeclaration, type HighlightImage, type HighlightLine, type HighlightReferImage, type HighlightSize, type HighlightStyleDeclaration, type HighlightThickness, type HslColor, type HslaColor, type HsvColor, type HsvaColor, type HwbColor, type HwbaColor, type IDOCDocument, type IDOCDocumentDeclaration, type IDOCElement, type IDOCElementDeclaration, type IDOCNode, type Justify, type LabColor, type LabaColor, type LayoutStyleDeclaration, type LchColor, type LchaColor, type ListStyleColormap, type ListStyleDeclaration, type ListStyleImage, type ListStylePosition, type ListStyleSize, type ListStyleStyleDeclaration, type ListStyleType, type MetaProperty, type None, type ObjectColor, type OutlineDeclaration, type OutlineProperty, type Overflow, type ParagraphContent, type PointerEvents, type Position, type RgbColor, type RgbaColor, type SVGPathData, type ShadowDeclaration, type ShadowProperty, type ShadowStyleDeclaration, type SolidFillDeclaration, type StrokeLinecap, type StrokeLinejoin, type StyleDeclaration, type StyleProperty, type StyleUnit, type TextAlign, type TextContent, type TextContentDeclaration, type TextContentFlat, type TextDeclaration, type TextDecoration, type TextDrawStyleDeclaration, type TextInlineStyleDeclaration, type TextLineStyleDeclaration, type TextOrientation, type TextProperty, type TextStyleDeclaration, type TextTransform, type TextWrap, type TextureFillDeclaration, type TextureFillSourceRect, type TextureFillSourceURL, type TextureFillStretch, type TextureFillStretchRect, type TextureFillTile, type TransformStyleDeclaration, type VerticalAlign, type Visibility, type WritingMode, type XyzColor, type XyzaColor, clearUndef, getDefaultElementStyle, getDefaultHighlightStyle, getDefaultLayoutStyle, getDefaultListStyleStyle, getDefaultShadowStyle, getDefaultStyle, getDefaultTextInlineStyle, getDefaultTextLineStyle, getDefaultTextStyle, getDefaultTransformStyle, normalizeDocument, normalizeElement, normalizeFill, normalizeGeometry, normalizeOutline, normalizeShadow, normalizeText, normalizeTextContent };
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(t,
|
|
1
|
+
(function(t,r){typeof exports=="object"&&typeof module<"u"?r(exports):typeof define=="function"&&define.amd?define(["exports"],r):(t=typeof globalThis<"u"?globalThis:t||self,r(t.modernIdoc={}))})(this,function(t){"use strict";function r(e){if(!(!e||e==="none"))return typeof e=="string"?{src:e}:e}function d(e){if(!(!e||e==="none"))return typeof e=="string"?{color:e}:e}function g(e){if(!(!e||e==="none"))return typeof e=="string"?{paths:[{data:e}]}:Array.isArray(e)?{paths:e.map(i=>typeof i=="string"?{data:i}:i)}:e}function s(e){if(!(!e||e==="none"))return typeof e=="string"?{color:e}:e}function c(){return{boxShadow:"none"}}function m(e){if(!(!e||e==="none"))return typeof e=="string"?{color:e}:e}function f(e=""){return(Array.isArray(e)?e:[e]).map(n=>typeof n=="string"?{fragments:[{content:n}]}:"content"in n?{fragments:[{...n}]}:"fragments"in n?{...n,fragments:n.fragments.map(o=>({...o}))}:Array.isArray(n)?{fragments:n.map(o=>typeof o=="string"?{content:o}:{...o})}:{fragments:[]})}function y(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 l(e,i=!1){if(typeof e!="object"||!e)return e;if(Array.isArray(e))return i?e.map(o=>l(o,i)):e;const n={};for(const o in e){const a=e[o];a!=null&&(i?n[o]=l(a,i):n[o]=a)}return n}function u(e){var i;return l({...e,background:r(e.background),text:y(e.text),geometry:g(e.geometry),fill:d(e.fill),outline:s(e.outline),shadow:m(e.shadow),children:(i=e.children)==null?void 0:i.map(n=>u(n))})}function w(e){return u(e)}function v(){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 h(){return{rotate:0,scaleX:1,scaleY:1,skewX:0,skewY:0,translateX:0,translateY:0,transform:"none",transformOrigin:"center"}}function S(){return{...v(),...h(),...c(),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 D(){return{highlightImage:"none",highlightReferImage:"none",highlightColormap:"none",highlightLine:"none",highlightSize:"cover",highlightThickness:"100%"}}function z(){return{listStyleType:"none",listStyleImage:"none",listStyleColormap:"none",listStyleSize:"cover",listStylePosition:"outside"}}function T(){return{...D(),color:"black",verticalAlign:"baseline",letterSpacing:0,wordSpacing:0,fontSize:14,fontWeight:"normal",fontFamily:"",fontStyle:"normal",fontKerning:"normal",textTransform:"none",textOrientation:"mixed",textDecoration:"none"}}function p(){return{...z(),writingMode:"horizontal-tb",textWrap:"wrap",textAlign:"start",textIndent:0,lineHeight:1.2}}function b(){return{...p(),...T(),textStrokeWidth:0,textStrokeColor:"black"}}function k(){return{...S(),...b()}}t.clearUndef=l,t.getDefaultElementStyle=S,t.getDefaultHighlightStyle=D,t.getDefaultLayoutStyle=v,t.getDefaultListStyleStyle=z,t.getDefaultShadowStyle=c,t.getDefaultStyle=k,t.getDefaultTextInlineStyle=T,t.getDefaultTextLineStyle=p,t.getDefaultTextStyle=b,t.getDefaultTransformStyle=h,t.normalizeDocument=w,t.normalizeElement=u,t.normalizeFill=d,t.normalizeGeometry=g,t.normalizeOutline=s,t.normalizeShadow=m,t.normalizeText=y,t.normalizeTextContent=f,Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})});
|
package/dist/index.mjs
CHANGED
|
@@ -2,11 +2,7 @@ function normalizeBackground(background) {
|
|
|
2
2
|
if (!background || background === "none") {
|
|
3
3
|
return void 0;
|
|
4
4
|
} else if (typeof background === "string") {
|
|
5
|
-
return
|
|
6
|
-
{ type: "texture", src: background }
|
|
7
|
-
];
|
|
8
|
-
} else if (!Array.isArray(background)) {
|
|
9
|
-
return [background];
|
|
5
|
+
return { src: background };
|
|
10
6
|
} else {
|
|
11
7
|
return background;
|
|
12
8
|
}
|
|
@@ -16,11 +12,7 @@ function normalizeFill(fill) {
|
|
|
16
12
|
if (!fill || fill === "none") {
|
|
17
13
|
return void 0;
|
|
18
14
|
} else if (typeof fill === "string") {
|
|
19
|
-
return
|
|
20
|
-
{ type: "solid", color: fill }
|
|
21
|
-
];
|
|
22
|
-
} else if (!Array.isArray(fill)) {
|
|
23
|
-
return [fill];
|
|
15
|
+
return { color: fill };
|
|
24
16
|
} else {
|
|
25
17
|
return fill;
|
|
26
18
|
}
|