modern-idoc 0.5.6 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +698 -100
- package/dist/index.d.cts +228 -86
- package/dist/index.d.mts +228 -86
- package/dist/index.d.ts +228 -86
- package/dist/index.js +1 -1
- package/dist/index.mjs +694 -101
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import { Colord } from 'colord';
|
|
2
2
|
|
|
3
|
-
type None = 'none';
|
|
4
|
-
|
|
5
3
|
interface AudioDeclaration {
|
|
6
4
|
src: string;
|
|
7
5
|
}
|
|
8
|
-
type AudioProperty =
|
|
9
|
-
declare function normalizeAudio(audio
|
|
6
|
+
type AudioProperty = string | AudioDeclaration;
|
|
7
|
+
declare function normalizeAudio(audio: AudioProperty): AudioDeclaration | undefined;
|
|
10
8
|
|
|
11
9
|
interface RgbColor {
|
|
12
10
|
r: number;
|
|
@@ -64,11 +62,154 @@ type LchaColor = WithAlpha<LchColor>;
|
|
|
64
62
|
type CmykaColor = WithAlpha<CmykColor>;
|
|
65
63
|
type ObjectColor = RgbColor | RgbaColor | HslColor | HslaColor | HsvColor | HsvaColor | HwbColor | HwbaColor | XyzColor | XyzaColor | LabColor | LabaColor | LchColor | LchaColor | CmykColor | CmykaColor;
|
|
66
64
|
type Uint32Color = number;
|
|
67
|
-
type Color =
|
|
65
|
+
type Color = Uint32Color | ObjectColor | string;
|
|
68
66
|
type Hex8Color = string;
|
|
69
67
|
type ColorDeclaration = Hex8Color;
|
|
70
68
|
declare function parseColor(color: Color): Colord;
|
|
71
|
-
declare
|
|
69
|
+
declare const defaultColor: ColorDeclaration;
|
|
70
|
+
declare function normalizeColor(color: Color, orFail?: boolean): ColorDeclaration;
|
|
71
|
+
|
|
72
|
+
interface ColorStop {
|
|
73
|
+
offset: number;
|
|
74
|
+
color: ColorDeclaration;
|
|
75
|
+
}
|
|
76
|
+
interface LinearGradient {
|
|
77
|
+
type: 'linear-gradient';
|
|
78
|
+
angle: number;
|
|
79
|
+
stops: ColorStop[];
|
|
80
|
+
repeat?: boolean;
|
|
81
|
+
}
|
|
82
|
+
interface RadialGradient {
|
|
83
|
+
type: 'radial-gradient';
|
|
84
|
+
stops: ColorStop[];
|
|
85
|
+
repeat?: boolean;
|
|
86
|
+
}
|
|
87
|
+
declare function normalizeGradient(cssText: string): (LinearGradient | RadialGradient)[];
|
|
88
|
+
|
|
89
|
+
interface LinearGradientNode {
|
|
90
|
+
type: 'linear-gradient'
|
|
91
|
+
orientation?: DirectionalNode | AngularNode | undefined
|
|
92
|
+
colorStops: ColorStopNode[]
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
interface RepeatingLinearGradientNode {
|
|
96
|
+
type: 'repeating-linear-gradient'
|
|
97
|
+
orientation?: DirectionalNode | AngularNode | undefined
|
|
98
|
+
colorStops: ColorStopNode[]
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
interface RadialGradientNode {
|
|
102
|
+
type: 'radial-gradient'
|
|
103
|
+
orientation?: (ShapeNode | DefaultRadialNode | ExtentKeywordNode)[] | undefined
|
|
104
|
+
colorStops: ColorStopNode[]
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
interface RepeatingRadialGradientNode {
|
|
108
|
+
type: 'repeating-radial-gradient'
|
|
109
|
+
orientation?: (ShapeNode | DefaultRadialNode | ExtentKeywordNode)[] | undefined
|
|
110
|
+
colorStops: ColorStopNode[]
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
interface DirectionalNode {
|
|
114
|
+
type: 'directional'
|
|
115
|
+
value:
|
|
116
|
+
| 'left'
|
|
117
|
+
| 'top'
|
|
118
|
+
| 'bottom'
|
|
119
|
+
| 'right'
|
|
120
|
+
| 'left top'
|
|
121
|
+
| 'top left'
|
|
122
|
+
| 'left bottom'
|
|
123
|
+
| 'bottom left'
|
|
124
|
+
| 'right top'
|
|
125
|
+
| 'top right'
|
|
126
|
+
| 'right bottom'
|
|
127
|
+
| 'bottom right'
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
interface AngularNode {
|
|
131
|
+
type: 'angular'
|
|
132
|
+
value: string
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
interface LiteralNode {
|
|
136
|
+
type: 'literal'
|
|
137
|
+
value: string
|
|
138
|
+
length?: PxNode | EmNode | PercentNode | undefined
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
interface HexNode {
|
|
142
|
+
type: 'hex'
|
|
143
|
+
value: string
|
|
144
|
+
length?: PxNode | EmNode | PercentNode | undefined
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
interface RgbNode {
|
|
148
|
+
type: 'rgb'
|
|
149
|
+
value: [string, string, string]
|
|
150
|
+
length?: PxNode | EmNode | PercentNode | undefined
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
interface RgbaNode {
|
|
154
|
+
type: 'rgba'
|
|
155
|
+
value: [string, string, string, string?]
|
|
156
|
+
length?: PxNode | EmNode | PercentNode | undefined
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
interface ShapeNode {
|
|
160
|
+
type: 'shape'
|
|
161
|
+
style?: ExtentKeywordNode | PxNode | EmNode | PercentNode | PositionKeywordNode | undefined
|
|
162
|
+
value: 'ellipse' | 'circle'
|
|
163
|
+
at?: PositionNode | undefined
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
interface DefaultRadialNode {
|
|
167
|
+
type: 'default-radial'
|
|
168
|
+
at: PositionNode
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
interface PositionKeywordNode {
|
|
172
|
+
type: 'position-keyword'
|
|
173
|
+
value: 'center' | 'left' | 'top' | 'bottom' | 'right'
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
interface PositionNode {
|
|
177
|
+
type: 'position'
|
|
178
|
+
value: {
|
|
179
|
+
x: ExtentKeywordNode | PxNode | EmNode | PercentNode | PositionKeywordNode
|
|
180
|
+
y: ExtentKeywordNode | PxNode | EmNode | PercentNode | PositionKeywordNode
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
interface ExtentKeywordNode {
|
|
185
|
+
type: 'extent-keyword'
|
|
186
|
+
value: 'closest-side' | 'closest-corner' | 'farthest-side' | 'farthest-corner' | 'contain' | 'cover'
|
|
187
|
+
at?: PositionNode | undefined
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
interface PxNode {
|
|
191
|
+
type: 'px'
|
|
192
|
+
value: string
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
interface EmNode {
|
|
196
|
+
type: 'em'
|
|
197
|
+
value: string
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
interface PercentNode {
|
|
201
|
+
type: '%'
|
|
202
|
+
value: string
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
type ColorStopNode = LiteralNode | HexNode | RgbNode | RgbaNode
|
|
206
|
+
type GradientNode = LinearGradientNode | RepeatingLinearGradientNode | RadialGradientNode | RepeatingRadialGradientNode
|
|
207
|
+
|
|
208
|
+
declare function parseGradient(cssText: string): GradientNode[]
|
|
209
|
+
declare function stringifyGradient(ast: GradientNode[]): string
|
|
210
|
+
|
|
211
|
+
type None = undefined | null | 'none';
|
|
212
|
+
type WithNone<T> = T | None;
|
|
72
213
|
|
|
73
214
|
interface GradientFillDeclaration {
|
|
74
215
|
}
|
|
@@ -123,18 +264,18 @@ interface TextureFillDeclaration {
|
|
|
123
264
|
|
|
124
265
|
type FillDeclaration = Partial<TextureFillDeclaration> & Partial<SolidFillDeclaration> & Partial<GradientFillDeclaration>;
|
|
125
266
|
type FillPropertyObject = FillDeclaration & {
|
|
126
|
-
color
|
|
267
|
+
color: WithNone<Color>;
|
|
127
268
|
};
|
|
128
|
-
type FillProperty =
|
|
129
|
-
declare function normalizeFill(fill
|
|
269
|
+
type FillProperty = string | FillPropertyObject;
|
|
270
|
+
declare function normalizeFill(fill: FillProperty): FillDeclaration | undefined;
|
|
130
271
|
|
|
131
272
|
interface BaseBackgroundDeclaration {
|
|
132
273
|
withGeometry?: boolean;
|
|
133
274
|
}
|
|
134
275
|
type BackgroundDeclaration = BaseBackgroundDeclaration & FillDeclaration;
|
|
135
276
|
type BackgroundPropertyObject = BaseBackgroundDeclaration & FillPropertyObject;
|
|
136
|
-
type BackgroundProperty =
|
|
137
|
-
declare function normalizeBackground(background
|
|
277
|
+
type BackgroundProperty = string | BackgroundPropertyObject;
|
|
278
|
+
declare function normalizeBackground(background: BackgroundProperty): BackgroundDeclaration;
|
|
138
279
|
|
|
139
280
|
interface InnerShadowDeclaration {
|
|
140
281
|
color: ColorDeclaration;
|
|
@@ -143,11 +284,11 @@ interface InnerShadowDeclaration {
|
|
|
143
284
|
blurRadius: number;
|
|
144
285
|
}
|
|
145
286
|
type InnerShadowPropertyObject = Partial<InnerShadowDeclaration> & {
|
|
146
|
-
color: Color
|
|
287
|
+
color: WithNone<Color>;
|
|
147
288
|
};
|
|
148
|
-
type InnerShadowProperty =
|
|
289
|
+
type InnerShadowProperty = InnerShadowPropertyObject;
|
|
149
290
|
declare function getDefaultInnerShadow(): InnerShadowDeclaration;
|
|
150
|
-
declare function normalizeInnerShadow(shadow
|
|
291
|
+
declare function normalizeInnerShadow(shadow: InnerShadowProperty): InnerShadowDeclaration;
|
|
151
292
|
|
|
152
293
|
interface BaseOuterShadowDeclaration {
|
|
153
294
|
scaleX: number;
|
|
@@ -155,15 +296,15 @@ interface BaseOuterShadowDeclaration {
|
|
|
155
296
|
}
|
|
156
297
|
type OuterShadowDeclaration = BaseOuterShadowDeclaration & InnerShadowDeclaration;
|
|
157
298
|
type OuterShadowPropertyObject = Partial<BaseOuterShadowDeclaration> & InnerShadowPropertyObject;
|
|
158
|
-
type OuterShadowProperty =
|
|
299
|
+
type OuterShadowProperty = OuterShadowPropertyObject;
|
|
159
300
|
declare function getDefaultOuterShadow(): OuterShadowDeclaration;
|
|
160
|
-
declare function normalizeOuterShadow(shadow
|
|
301
|
+
declare function normalizeOuterShadow(shadow: OuterShadowProperty): OuterShadowDeclaration;
|
|
161
302
|
|
|
162
303
|
interface SoftEdgeDeclaration {
|
|
163
304
|
radius: number;
|
|
164
305
|
}
|
|
165
|
-
type SoftEdgeProperty =
|
|
166
|
-
declare function normalizeSoftEdge(softEdge
|
|
306
|
+
type SoftEdgeProperty = SoftEdgeDeclaration;
|
|
307
|
+
declare function normalizeSoftEdge(softEdge: SoftEdgeProperty): SoftEdgeDeclaration;
|
|
167
308
|
|
|
168
309
|
interface EffectDeclaration {
|
|
169
310
|
innerShadow?: InnerShadowDeclaration;
|
|
@@ -171,20 +312,20 @@ interface EffectDeclaration {
|
|
|
171
312
|
softEdge?: SoftEdgeDeclaration;
|
|
172
313
|
}
|
|
173
314
|
interface EffectPropertyObject {
|
|
174
|
-
innerShadow
|
|
175
|
-
outerShadow
|
|
176
|
-
softEdge
|
|
315
|
+
innerShadow: WithNone<InnerShadowProperty>;
|
|
316
|
+
outerShadow: WithNone<OuterShadowProperty>;
|
|
317
|
+
softEdge: WithNone<SoftEdgeProperty>;
|
|
177
318
|
}
|
|
178
|
-
type EffectProperty =
|
|
179
|
-
declare function normalizeEffect(effect
|
|
319
|
+
type EffectProperty = EffectPropertyObject;
|
|
320
|
+
declare function normalizeEffect(effect: EffectProperty): EffectDeclaration;
|
|
180
321
|
|
|
181
322
|
interface BaseForegroundDeclaration {
|
|
182
323
|
withGeometry?: boolean;
|
|
183
324
|
}
|
|
184
325
|
type ForegroundDeclaration = BaseForegroundDeclaration & FillDeclaration;
|
|
185
326
|
type ForegroundPropertyObject = BaseForegroundDeclaration & FillPropertyObject;
|
|
186
|
-
type ForegroundProperty =
|
|
187
|
-
declare function normalizeForeground(foreground
|
|
327
|
+
type ForegroundProperty = string | ForegroundPropertyObject;
|
|
328
|
+
declare function normalizeForeground(foreground: ForegroundProperty): ForegroundDeclaration | undefined;
|
|
188
329
|
|
|
189
330
|
type SVGPathData = string;
|
|
190
331
|
type FillRule = 'nonzero' | 'evenodd';
|
|
@@ -219,8 +360,8 @@ interface GeometryDeclaration {
|
|
|
219
360
|
viewBox?: number[];
|
|
220
361
|
paths?: GeometryPathDeclaration[];
|
|
221
362
|
}
|
|
222
|
-
type GeometryProperty =
|
|
223
|
-
declare function normalizeGeometry(geometry
|
|
363
|
+
type GeometryProperty = SVGPathData | SVGPathData[] | GeometryPathDeclaration[] | GeometryDeclaration;
|
|
364
|
+
declare function normalizeGeometry(geometry: GeometryProperty): GeometryDeclaration;
|
|
224
365
|
|
|
225
366
|
interface MetaProperty {
|
|
226
367
|
[key: string]: any;
|
|
@@ -237,14 +378,14 @@ type LineEndSize = 'sm' | 'md' | 'lg';
|
|
|
237
378
|
|
|
238
379
|
interface HeadEnd {
|
|
239
380
|
type: LineEndType;
|
|
240
|
-
width?:
|
|
241
|
-
height?:
|
|
381
|
+
width?: WithNone<LineEndSize>;
|
|
382
|
+
height?: WithNone<LineEndSize>;
|
|
242
383
|
}
|
|
243
384
|
|
|
244
385
|
interface TailEnd {
|
|
245
386
|
type: LineEndType;
|
|
246
|
-
width?:
|
|
247
|
-
height?:
|
|
387
|
+
width?: WithNone<LineEndSize>;
|
|
388
|
+
height?: WithNone<LineEndSize>;
|
|
248
389
|
}
|
|
249
390
|
|
|
250
391
|
type OutlineFillDeclaration = Partial<SolidFillDeclaration> & Partial<GradientFillDeclaration>;
|
|
@@ -257,12 +398,12 @@ interface OutlineDeclaration extends OutlineFillDeclaration {
|
|
|
257
398
|
tailEnd?: TailEnd;
|
|
258
399
|
}
|
|
259
400
|
type OutlinePropertyObject = Partial<OutlineDeclaration> & {
|
|
260
|
-
color
|
|
401
|
+
color: WithNone<Color>;
|
|
261
402
|
};
|
|
262
|
-
type OutlineProperty =
|
|
263
|
-
declare function normalizeOutline(outline
|
|
403
|
+
type OutlineProperty = string | OutlinePropertyObject;
|
|
404
|
+
declare function normalizeOutline(outline: OutlineProperty): OutlineDeclaration;
|
|
264
405
|
|
|
265
|
-
type BoxShadow =
|
|
406
|
+
type BoxShadow = string;
|
|
266
407
|
interface ShadowDeclaration {
|
|
267
408
|
color: ColorDeclaration;
|
|
268
409
|
offsetX?: number;
|
|
@@ -270,10 +411,10 @@ interface ShadowDeclaration {
|
|
|
270
411
|
blur?: number;
|
|
271
412
|
}
|
|
272
413
|
type ShadowPropertyObject = Partial<ShadowDeclaration> & {
|
|
273
|
-
color
|
|
414
|
+
color: WithNone<Color>;
|
|
274
415
|
};
|
|
275
|
-
type ShadowProperty =
|
|
276
|
-
declare function normalizeShadow(shadow
|
|
416
|
+
type ShadowProperty = BoxShadow | ShadowPropertyObject;
|
|
417
|
+
declare function normalizeShadow(shadow: ShadowProperty): ShadowDeclaration;
|
|
277
418
|
interface ShadowStyleDeclaration {
|
|
278
419
|
boxShadow: BoxShadow;
|
|
279
420
|
shadowColor?: ColorDeclaration;
|
|
@@ -290,12 +431,12 @@ type Overflow = 'hidden' | 'visible';
|
|
|
290
431
|
type Visibility = 'hidden' | 'visible';
|
|
291
432
|
type FontWeight = 'normal' | 'bold' | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900;
|
|
292
433
|
type FontStyle = 'normal' | 'italic' | 'oblique' | `oblique ${string}`;
|
|
293
|
-
type FontKerning =
|
|
434
|
+
type FontKerning = WithNone<'auto' | 'normal'>;
|
|
294
435
|
type TextWrap = 'wrap' | 'nowrap';
|
|
295
|
-
type TextAlign =
|
|
296
|
-
type TextTransform =
|
|
436
|
+
type TextAlign = WithNone<'center' | 'end' | 'left' | 'right' | 'start' | 'justify'>;
|
|
437
|
+
type TextTransform = WithNone<'uppercase' | 'lowercase'>;
|
|
297
438
|
type TextOrientation = 'mixed' | 'upright' | 'sideways-right' | 'sideways';
|
|
298
|
-
type TextDecoration =
|
|
439
|
+
type TextDecoration = WithNone<'underline' | 'line-through' | 'overline'>;
|
|
299
440
|
type VerticalAlign = 'baseline' | 'top' | 'middle' | 'bottom' | 'sub' | 'super' | 'text-top' | 'text-bottom';
|
|
300
441
|
type WritingMode = 'horizontal-tb' | 'vertical-lr' | 'vertical-rl';
|
|
301
442
|
type Align = 'auto' | 'flex-start' | 'center' | 'flex-end' | 'stretch' | 'baseline' | 'space-between' | 'space-around' | 'space-evenly';
|
|
@@ -303,18 +444,18 @@ type FlexDirection = 'column' | 'column-reverse' | 'row' | 'row-reverse';
|
|
|
303
444
|
type FlexWrap = 'nowrap' | 'wrap' | 'Wrap-reverse';
|
|
304
445
|
type Justify = 'flex-start' | 'center' | 'flex-end' | 'space-between' | 'space-around' | 'space-evenly';
|
|
305
446
|
type Position = 'static' | 'relative' | 'absolute';
|
|
306
|
-
type BorderStyle =
|
|
447
|
+
type BorderStyle = WithNone<'dashed' | 'solid'>;
|
|
307
448
|
type BoxSizing = 'border-box' | 'content-box';
|
|
308
449
|
type PointerEvents = 'auto' | 'none';
|
|
309
|
-
type ListStyleType =
|
|
310
|
-
type ListStyleImage =
|
|
311
|
-
type ListStyleColormap =
|
|
450
|
+
type ListStyleType = WithNone<'disc'>;
|
|
451
|
+
type ListStyleImage = WithNone<string>;
|
|
452
|
+
type ListStyleColormap = WithNone<Record<string, string>>;
|
|
312
453
|
type ListStyleSize = StyleUnit | `${number}rem` | 'cover';
|
|
313
454
|
type ListStylePosition = 'inside' | 'outside';
|
|
314
455
|
type HighlightLine = TextDecoration | 'outline';
|
|
315
|
-
type HighlightImage =
|
|
316
|
-
type HighlightReferImage =
|
|
317
|
-
type HighlightColormap =
|
|
456
|
+
type HighlightImage = WithNone<string>;
|
|
457
|
+
type HighlightReferImage = WithNone<string>;
|
|
458
|
+
type HighlightColormap = WithNone<Record<string, string>>;
|
|
318
459
|
type HighlightSize = StyleUnit | `${number}rem` | 'cover';
|
|
319
460
|
type HighlightThickness = StyleUnit;
|
|
320
461
|
|
|
@@ -351,11 +492,11 @@ interface LayoutStyleDeclaration {
|
|
|
351
492
|
alignSelf: Align;
|
|
352
493
|
justifyContent: Justify;
|
|
353
494
|
gap: StyleUnit;
|
|
354
|
-
marginTop:
|
|
355
|
-
marginLeft:
|
|
356
|
-
marginRight:
|
|
357
|
-
marginBottom:
|
|
358
|
-
margin:
|
|
495
|
+
marginTop: WithNone<StyleUnit | 'auto'>;
|
|
496
|
+
marginLeft: WithNone<StyleUnit | 'auto'>;
|
|
497
|
+
marginRight: WithNone<StyleUnit | 'auto'>;
|
|
498
|
+
marginBottom: WithNone<StyleUnit | 'auto'>;
|
|
499
|
+
margin: WithNone<StyleUnit | 'auto'>;
|
|
359
500
|
paddingTop: StyleUnit;
|
|
360
501
|
paddingLeft: StyleUnit;
|
|
361
502
|
paddingRight: StyleUnit;
|
|
@@ -372,29 +513,29 @@ interface TransformStyleDeclaration {
|
|
|
372
513
|
skewY: number;
|
|
373
514
|
translateX: number;
|
|
374
515
|
translateY: number;
|
|
375
|
-
transform:
|
|
516
|
+
transform: WithNone<string>;
|
|
376
517
|
transformOrigin: string;
|
|
377
518
|
}
|
|
378
519
|
declare function getDefaultTransformStyle(): TransformStyleDeclaration;
|
|
379
520
|
|
|
380
521
|
type BackgroundSize = 'contain' | 'cover' | string | 'stretch' | 'rigid';
|
|
381
522
|
type ElementStyleDeclaration = Partial<LayoutStyleDeclaration> & TransformStyleDeclaration & ShadowStyleDeclaration & {
|
|
382
|
-
backgroundImage:
|
|
523
|
+
backgroundImage: WithNone<string>;
|
|
383
524
|
backgroundSize: BackgroundSize;
|
|
384
|
-
backgroundColor:
|
|
385
|
-
backgroundColormap:
|
|
525
|
+
backgroundColor: WithNone<ColorDeclaration>;
|
|
526
|
+
backgroundColormap: WithNone<Record<string, string>>;
|
|
386
527
|
borderRadius: number;
|
|
387
|
-
borderColor:
|
|
528
|
+
borderColor: WithNone<ColorDeclaration>;
|
|
388
529
|
borderStyle: BorderStyle;
|
|
389
530
|
outlineWidth: number;
|
|
390
531
|
outlineOffset: number;
|
|
391
|
-
outlineColor:
|
|
532
|
+
outlineColor: WithNone<ColorDeclaration>;
|
|
392
533
|
outlineStyle: string;
|
|
393
534
|
visibility: Visibility;
|
|
394
535
|
filter: string;
|
|
395
536
|
opacity: number;
|
|
396
537
|
pointerEvents: PointerEvents;
|
|
397
|
-
maskImage:
|
|
538
|
+
maskImage: WithNone<string>;
|
|
398
539
|
};
|
|
399
540
|
declare function getDefaultElementStyle(): ElementStyleDeclaration;
|
|
400
541
|
|
|
@@ -469,14 +610,14 @@ declare function getDefaultTextStyle(): Required<TextStyleDeclaration>;
|
|
|
469
610
|
interface StyleDeclaration extends TextStyleDeclaration, ElementStyleDeclaration {
|
|
470
611
|
}
|
|
471
612
|
type StylePropertyObject = Partial<StyleDeclaration> & {
|
|
472
|
-
color?: Color
|
|
473
|
-
backgroundColor?: Color
|
|
474
|
-
borderColor?: Color
|
|
475
|
-
outlineColor?: Color
|
|
476
|
-
shadowColor?: Color
|
|
613
|
+
color?: WithNone<Color>;
|
|
614
|
+
backgroundColor?: WithNone<Color>;
|
|
615
|
+
borderColor?: WithNone<Color>;
|
|
616
|
+
outlineColor?: WithNone<Color>;
|
|
617
|
+
shadowColor?: WithNone<Color>;
|
|
477
618
|
};
|
|
478
|
-
type StyleProperty =
|
|
479
|
-
declare function normalizeStyle(style
|
|
619
|
+
type StyleProperty = StylePropertyObject;
|
|
620
|
+
declare function normalizeStyle(style: StyleProperty): Partial<StyleDeclaration>;
|
|
480
621
|
declare function getDefaultStyle(): StyleDeclaration;
|
|
481
622
|
|
|
482
623
|
interface FragmentContent extends StylePropertyObject {
|
|
@@ -498,29 +639,29 @@ type TextProperty = string | TextContent | (TextDeclaration & {
|
|
|
498
639
|
content: TextContent;
|
|
499
640
|
}) | TextDeclaration;
|
|
500
641
|
declare function normalizeTextContent(content?: TextContent): TextContentDeclaration;
|
|
501
|
-
declare function normalizeText(text
|
|
642
|
+
declare function normalizeText(text: TextProperty): TextDeclaration;
|
|
502
643
|
|
|
503
644
|
interface VideoDeclaration {
|
|
504
645
|
src: string;
|
|
505
646
|
}
|
|
506
|
-
type VideoProperty =
|
|
507
|
-
declare function normalizeVideo(video
|
|
647
|
+
type VideoProperty = string | VideoDeclaration;
|
|
648
|
+
declare function normalizeVideo(video: VideoProperty): VideoDeclaration | undefined;
|
|
508
649
|
|
|
509
650
|
interface Element<T = MetaProperty> extends Node<T> {
|
|
510
|
-
style?: StyleProperty
|
|
511
|
-
text?: TextProperty
|
|
512
|
-
background?: BackgroundProperty
|
|
513
|
-
geometry?: GeometryProperty
|
|
514
|
-
fill?: FillProperty
|
|
515
|
-
outline?: OutlineProperty
|
|
516
|
-
foreground?: ForegroundProperty
|
|
517
|
-
shadow?: ShadowProperty
|
|
518
|
-
video?: VideoProperty
|
|
519
|
-
audio?: AudioProperty
|
|
520
|
-
effect?: EffectProperty
|
|
651
|
+
style?: WithNone<StyleProperty>;
|
|
652
|
+
text?: WithNone<TextProperty>;
|
|
653
|
+
background?: WithNone<BackgroundProperty>;
|
|
654
|
+
geometry?: WithNone<GeometryProperty>;
|
|
655
|
+
fill?: WithNone<FillProperty>;
|
|
656
|
+
outline?: WithNone<OutlineProperty>;
|
|
657
|
+
foreground?: WithNone<ForegroundProperty>;
|
|
658
|
+
shadow?: WithNone<ShadowProperty>;
|
|
659
|
+
video?: WithNone<VideoProperty>;
|
|
660
|
+
audio?: WithNone<AudioProperty>;
|
|
661
|
+
effect?: WithNone<EffectProperty>;
|
|
521
662
|
children?: Element[];
|
|
522
663
|
}
|
|
523
|
-
|
|
664
|
+
type ElementDeclaration<T = MetaProperty> = Node<T> & {
|
|
524
665
|
style?: Partial<StyleDeclaration>;
|
|
525
666
|
text?: TextDeclaration;
|
|
526
667
|
background?: BackgroundDeclaration;
|
|
@@ -533,7 +674,7 @@ interface ElementDeclaration<T = MetaProperty> extends Element<T> {
|
|
|
533
674
|
audio?: AudioDeclaration;
|
|
534
675
|
effect?: EffectDeclaration;
|
|
535
676
|
children?: ElementDeclaration[];
|
|
536
|
-
}
|
|
677
|
+
};
|
|
537
678
|
declare function normalizeElement<T = MetaProperty>(element: Element<T>): ElementDeclaration<T>;
|
|
538
679
|
|
|
539
680
|
interface Document extends Element {
|
|
@@ -544,7 +685,8 @@ interface DocumentDeclaration extends ElementDeclaration {
|
|
|
544
685
|
}
|
|
545
686
|
declare function normalizeDocument(doc: Document): DocumentDeclaration;
|
|
546
687
|
|
|
688
|
+
declare function isNone<T>(value: T): value is Extract<T, null | undefined | 'none'>;
|
|
547
689
|
declare function clearUndef<T>(obj: T, deep?: boolean): T;
|
|
548
690
|
|
|
549
|
-
export { clearUndef, getDefaultElementStyle, getDefaultHighlightStyle, getDefaultInnerShadow, getDefaultLayoutStyle, getDefaultListStyleStyle, getDefaultOuterShadow, getDefaultShadowStyle, getDefaultStyle, getDefaultTextInlineStyle, getDefaultTextLineStyle, getDefaultTextStyle, getDefaultTransformStyle, normalizeAudio, normalizeBackground, normalizeColor, normalizeDocument, normalizeEffect, normalizeElement, normalizeFill, normalizeForeground, normalizeGeometry, normalizeInnerShadow, normalizeOuterShadow, normalizeOutline, normalizeShadow, normalizeSoftEdge, normalizeStyle, normalizeText, normalizeTextContent, normalizeVideo, parseColor };
|
|
550
|
-
export type { Align, AudioDeclaration, AudioProperty, BackgroundDeclaration, BackgroundProperty, BackgroundPropertyObject, BackgroundSize, BaseBackgroundDeclaration, BaseForegroundDeclaration, BaseOuterShadowDeclaration, BorderStyle, BoxShadow, BoxSizing, CmykColor, CmykaColor, Color, ColorDeclaration, Direction, Display, Document, DocumentDeclaration, EffectDeclaration, EffectProperty, EffectPropertyObject, Element, ElementDeclaration, ElementStyleDeclaration, FillDeclaration, FillProperty, FillPropertyObject, FillRule, FlexDirection, FlexWrap, FontKerning, FontStyle, FontWeight, ForegroundDeclaration, ForegroundProperty, ForegroundPropertyObject, FragmentContent, GeometryDeclaration, GeometryPathDeclaration, GeometryPathStyle, GeometryProperty, GradientFillDeclaration, HeadEnd, Hex8Color, HighlightColormap, HighlightDeclaration, HighlightImage, HighlightLine, HighlightReferImage, HighlightSize, HighlightStyleDeclaration, HighlightThickness, HslColor, HslaColor, HsvColor, HsvaColor, HwbColor, HwbaColor, InnerShadowDeclaration, InnerShadowProperty, InnerShadowPropertyObject, Justify, LabColor, LabaColor, LayoutStyleDeclaration, LchColor, LchaColor, LineEndSize, LineEndType, ListStyleColormap, ListStyleDeclaration, ListStyleImage, ListStylePosition, ListStyleSize, ListStyleStyleDeclaration, ListStyleType, MetaProperty, Node, None, ObjectColor, OuterShadowDeclaration, OuterShadowProperty, OuterShadowPropertyObject, OutlineDeclaration, OutlineFillDeclaration, OutlineProperty, OutlinePropertyObject, OutlineStyle, Overflow, ParagraphContent, PointerEvents, Position, RgbColor, RgbaColor, SVGPathData, ShadowDeclaration, ShadowProperty, ShadowPropertyObject, ShadowStyleDeclaration, SoftEdgeDeclaration, SoftEdgeProperty, SolidFillDeclaration, StrokeLinecap, StrokeLinejoin, StyleDeclaration, StyleProperty, StylePropertyObject, StyleUnit, TailEnd, TextAlign, TextContent, TextContentDeclaration, TextContentFlat, TextDeclaration, TextDecoration, TextDrawStyleDeclaration, TextInlineStyleDeclaration, TextLineStyleDeclaration, TextOrientation, TextProperty, TextStyleDeclaration, TextTransform, TextWrap, TextureFillDeclaration, TextureFillSourceRect, TextureFillSourceURL, TextureFillStretch, TextureFillStretchRect, TextureFillTile, TransformStyleDeclaration, Uint32Color, VerticalAlign, VideoDeclaration, VideoProperty, Visibility, WritingMode, XyzColor, XyzaColor };
|
|
691
|
+
export { clearUndef, defaultColor, getDefaultElementStyle, getDefaultHighlightStyle, getDefaultInnerShadow, getDefaultLayoutStyle, getDefaultListStyleStyle, getDefaultOuterShadow, getDefaultShadowStyle, getDefaultStyle, getDefaultTextInlineStyle, getDefaultTextLineStyle, getDefaultTextStyle, getDefaultTransformStyle, isNone, normalizeAudio, normalizeBackground, normalizeColor, normalizeDocument, normalizeEffect, normalizeElement, normalizeFill, normalizeForeground, normalizeGeometry, normalizeGradient, normalizeInnerShadow, normalizeOuterShadow, normalizeOutline, normalizeShadow, normalizeSoftEdge, normalizeStyle, normalizeText, normalizeTextContent, normalizeVideo, parseColor, parseGradient, stringifyGradient };
|
|
692
|
+
export type { Align, AngularNode, AudioDeclaration, AudioProperty, BackgroundDeclaration, BackgroundProperty, BackgroundPropertyObject, BackgroundSize, BaseBackgroundDeclaration, BaseForegroundDeclaration, BaseOuterShadowDeclaration, BorderStyle, BoxShadow, BoxSizing, CmykColor, CmykaColor, Color, ColorDeclaration, ColorStop, ColorStopNode, DefaultRadialNode, Direction, DirectionalNode, Display, Document, DocumentDeclaration, EffectDeclaration, EffectProperty, EffectPropertyObject, Element, ElementDeclaration, ElementStyleDeclaration, EmNode, ExtentKeywordNode, FillDeclaration, FillProperty, FillPropertyObject, FillRule, FlexDirection, FlexWrap, FontKerning, FontStyle, FontWeight, ForegroundDeclaration, ForegroundProperty, ForegroundPropertyObject, FragmentContent, GeometryDeclaration, GeometryPathDeclaration, GeometryPathStyle, GeometryProperty, GradientFillDeclaration, GradientNode, HeadEnd, Hex8Color, HexNode, HighlightColormap, HighlightDeclaration, HighlightImage, HighlightLine, HighlightReferImage, HighlightSize, HighlightStyleDeclaration, HighlightThickness, HslColor, HslaColor, HsvColor, HsvaColor, HwbColor, HwbaColor, InnerShadowDeclaration, InnerShadowProperty, InnerShadowPropertyObject, Justify, LabColor, LabaColor, LayoutStyleDeclaration, LchColor, LchaColor, LineEndSize, LineEndType, LinearGradient, LinearGradientNode, ListStyleColormap, ListStyleDeclaration, ListStyleImage, ListStylePosition, ListStyleSize, ListStyleStyleDeclaration, ListStyleType, LiteralNode, MetaProperty, Node, None, ObjectColor, OuterShadowDeclaration, OuterShadowProperty, OuterShadowPropertyObject, OutlineDeclaration, OutlineFillDeclaration, OutlineProperty, OutlinePropertyObject, OutlineStyle, Overflow, ParagraphContent, PercentNode, PointerEvents, Position, PositionKeywordNode, PositionNode, PxNode, RadialGradient, RadialGradientNode, RepeatingLinearGradientNode, RepeatingRadialGradientNode, RgbColor, RgbNode, RgbaColor, RgbaNode, SVGPathData, ShadowDeclaration, ShadowProperty, ShadowPropertyObject, ShadowStyleDeclaration, ShapeNode, SoftEdgeDeclaration, SoftEdgeProperty, SolidFillDeclaration, StrokeLinecap, StrokeLinejoin, StyleDeclaration, StyleProperty, StylePropertyObject, StyleUnit, TailEnd, TextAlign, TextContent, TextContentDeclaration, TextContentFlat, TextDeclaration, TextDecoration, TextDrawStyleDeclaration, TextInlineStyleDeclaration, TextLineStyleDeclaration, TextOrientation, TextProperty, TextStyleDeclaration, TextTransform, TextWrap, TextureFillDeclaration, TextureFillSourceRect, TextureFillSourceURL, TextureFillStretch, TextureFillStretchRect, TextureFillTile, TransformStyleDeclaration, Uint32Color, VerticalAlign, VideoDeclaration, VideoProperty, Visibility, WithNone, WritingMode, XyzColor, XyzaColor };
|