modern-idoc 0.6.0 → 0.6.2
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 +162 -109
- package/dist/index.d.cts +219 -195
- package/dist/index.d.mts +219 -195
- package/dist/index.d.ts +219 -195
- package/dist/index.js +1 -1
- package/dist/index.mjs +155 -109
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Colord } from 'colord';
|
|
2
2
|
|
|
3
|
-
interface
|
|
3
|
+
interface NormalizedAudio {
|
|
4
4
|
src: string;
|
|
5
5
|
}
|
|
6
|
-
type
|
|
7
|
-
declare function normalizeAudio(audio:
|
|
6
|
+
type Audio = string | NormalizedAudio;
|
|
7
|
+
declare function normalizeAudio(audio: Audio): NormalizedAudio | undefined;
|
|
8
8
|
|
|
9
9
|
interface RgbColor {
|
|
10
10
|
r: number;
|
|
@@ -64,14 +64,15 @@ type ObjectColor = RgbColor | RgbaColor | HslColor | HslaColor | HsvColor | Hsva
|
|
|
64
64
|
type Uint32Color = number;
|
|
65
65
|
type Color = Uint32Color | ObjectColor | string;
|
|
66
66
|
type Hex8Color = string;
|
|
67
|
-
type
|
|
67
|
+
type NormalizedColor = Hex8Color;
|
|
68
68
|
declare function parseColor(color: Color): Colord;
|
|
69
|
-
declare const defaultColor:
|
|
70
|
-
declare function
|
|
69
|
+
declare const defaultColor: NormalizedColor;
|
|
70
|
+
declare function isColor(value: string): boolean;
|
|
71
|
+
declare function normalizeColor(color: Color, orFail?: boolean): NormalizedColor;
|
|
71
72
|
|
|
72
73
|
interface ColorStop {
|
|
73
74
|
offset: number;
|
|
74
|
-
color:
|
|
75
|
+
color: NormalizedColor;
|
|
75
76
|
}
|
|
76
77
|
interface LinearGradient {
|
|
77
78
|
type: 'linear-gradient';
|
|
@@ -84,6 +85,7 @@ interface RadialGradient {
|
|
|
84
85
|
stops: ColorStop[];
|
|
85
86
|
repeat?: boolean;
|
|
86
87
|
}
|
|
88
|
+
declare function isGradient(cssText: string): boolean;
|
|
87
89
|
declare function normalizeGradient(cssText: string): (LinearGradient | RadialGradient)[];
|
|
88
90
|
|
|
89
91
|
interface LinearGradientNode {
|
|
@@ -208,22 +210,32 @@ type GradientNode = LinearGradientNode | RepeatingLinearGradientNode | RadialGra
|
|
|
208
210
|
declare function parseGradient(cssText: string): GradientNode[]
|
|
209
211
|
declare function stringifyGradient(ast: GradientNode[]): string
|
|
210
212
|
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
interface GradientFillDeclaration {
|
|
213
|
+
interface ColorFillObject {
|
|
214
|
+
color: Color;
|
|
215
215
|
}
|
|
216
|
+
type ColorFill = string | ColorFillObject;
|
|
217
|
+
interface NormalizedColorFill {
|
|
218
|
+
color: NormalizedColor;
|
|
219
|
+
}
|
|
220
|
+
declare function normalizeColorFill(fill: ColorFill): NormalizedColorFill;
|
|
216
221
|
|
|
217
|
-
interface
|
|
218
|
-
|
|
222
|
+
interface GradientFillObject {
|
|
223
|
+
image: string;
|
|
219
224
|
}
|
|
225
|
+
type GradientFill = string | GradientFillObject;
|
|
226
|
+
interface NormalizedGradientFill {
|
|
227
|
+
linearGradient?: LinearGradient;
|
|
228
|
+
radialGradient?: RadialGradient;
|
|
229
|
+
rotateWithShape?: boolean;
|
|
230
|
+
}
|
|
231
|
+
declare function normalizeGradientFill(fill: GradientFill): NormalizedGradientFill;
|
|
220
232
|
|
|
221
233
|
/**
|
|
222
234
|
* 0 -0.5 0
|
|
223
235
|
* -0.5 -0.5
|
|
224
236
|
* 0 -0.5 0
|
|
225
237
|
*/
|
|
226
|
-
interface
|
|
238
|
+
interface ImageFillCropRect {
|
|
227
239
|
left?: number;
|
|
228
240
|
top?: number;
|
|
229
241
|
bottom?: number;
|
|
@@ -234,16 +246,13 @@ interface TextureFillSourceRect {
|
|
|
234
246
|
* 0.5 0.5
|
|
235
247
|
* 0 0.5 0
|
|
236
248
|
*/
|
|
237
|
-
interface
|
|
249
|
+
interface ImageFillStretchRect {
|
|
238
250
|
left?: number;
|
|
239
251
|
top?: number;
|
|
240
252
|
bottom?: number;
|
|
241
253
|
right?: number;
|
|
242
254
|
}
|
|
243
|
-
interface
|
|
244
|
-
rect?: TextureFillStretchRect;
|
|
245
|
-
}
|
|
246
|
-
interface TextureFillTile {
|
|
255
|
+
interface ImageFillTile {
|
|
247
256
|
alignment?: string;
|
|
248
257
|
scaleX?: number;
|
|
249
258
|
scaleY?: number;
|
|
@@ -251,123 +260,102 @@ interface TextureFillTile {
|
|
|
251
260
|
translateY?: number;
|
|
252
261
|
flip?: string;
|
|
253
262
|
}
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
263
|
+
interface ImageFillObject {
|
|
264
|
+
image: string;
|
|
265
|
+
cropRect?: ImageFillCropRect;
|
|
266
|
+
stretchRect?: ImageFillStretchRect;
|
|
267
|
+
tile?: ImageFillTile;
|
|
258
268
|
dpi?: number;
|
|
259
|
-
stretch?: TextureFillStretch;
|
|
260
|
-
tile?: TextureFillTile;
|
|
261
269
|
opacity?: number;
|
|
262
270
|
rotateWithShape?: boolean;
|
|
263
271
|
}
|
|
272
|
+
interface NormalizedImageFill extends ImageFillObject {
|
|
273
|
+
}
|
|
274
|
+
declare function normalizeImageFill(fill: ImageFillObject): NormalizedImageFill;
|
|
264
275
|
|
|
265
|
-
type
|
|
266
|
-
type
|
|
267
|
-
color: WithNone<Color>;
|
|
268
|
-
};
|
|
269
|
-
type FillProperty = string | FillPropertyObject;
|
|
270
|
-
declare function normalizeFill(fill: FillProperty): FillDeclaration | undefined;
|
|
276
|
+
type None = undefined | null | 'none';
|
|
277
|
+
type WithNone<T> = T | None;
|
|
271
278
|
|
|
272
|
-
interface
|
|
273
|
-
|
|
279
|
+
interface PresetFillObject {
|
|
280
|
+
preset: string;
|
|
281
|
+
foregroundColor?: WithNone<Color>;
|
|
282
|
+
backgroundColor?: WithNone<Color>;
|
|
283
|
+
}
|
|
284
|
+
type PresetFill = string | PresetFillObject;
|
|
285
|
+
interface NormalizedPresetFill extends PresetFillObject {
|
|
286
|
+
foregroundColor?: NormalizedColor;
|
|
287
|
+
backgroundColor?: NormalizedColor;
|
|
274
288
|
}
|
|
275
|
-
|
|
276
|
-
type BackgroundPropertyObject = BaseBackgroundDeclaration & FillPropertyObject;
|
|
277
|
-
type BackgroundProperty = string | BackgroundPropertyObject;
|
|
278
|
-
declare function normalizeBackground(background: BackgroundProperty): BackgroundDeclaration;
|
|
289
|
+
declare function normalizePresetFill(fill: PresetFill): NormalizedPresetFill;
|
|
279
290
|
|
|
280
|
-
|
|
281
|
-
|
|
291
|
+
type FillObject = Partial<ColorFillObject> & Partial<GradientFillObject> & Partial<ImageFillObject> & Partial<PresetFillObject>;
|
|
292
|
+
type Fill = string | FillObject;
|
|
293
|
+
type NormalizedFill = Partial<NormalizedColorFill> & Partial<NormalizedGradientFill> & Partial<NormalizedImageFill> & Partial<NormalizedPresetFill>;
|
|
294
|
+
declare function normalizeFill(fill: Fill): NormalizedFill;
|
|
295
|
+
|
|
296
|
+
interface NormalizedBaseBackground {
|
|
297
|
+
fillWithShape: boolean;
|
|
298
|
+
}
|
|
299
|
+
type NormalizedBackground = NormalizedBaseBackground & NormalizedFill;
|
|
300
|
+
type BackgroundObject = Partial<NormalizedBaseBackground> & FillObject;
|
|
301
|
+
type Background = string | BackgroundObject;
|
|
302
|
+
declare function normalizeBackground(background: Background): NormalizedBackground;
|
|
303
|
+
|
|
304
|
+
interface NormalizedInnerShadow {
|
|
305
|
+
color: NormalizedColor;
|
|
282
306
|
offsetX: number;
|
|
283
307
|
offsetY: number;
|
|
284
308
|
blurRadius: number;
|
|
285
309
|
}
|
|
286
|
-
type
|
|
310
|
+
type InnerShadowObject = Partial<NormalizedInnerShadow> & {
|
|
287
311
|
color: WithNone<Color>;
|
|
288
312
|
};
|
|
289
|
-
type
|
|
290
|
-
declare function getDefaultInnerShadow():
|
|
291
|
-
declare function normalizeInnerShadow(shadow:
|
|
313
|
+
type InnerShadow = InnerShadowObject;
|
|
314
|
+
declare function getDefaultInnerShadow(): NormalizedInnerShadow;
|
|
315
|
+
declare function normalizeInnerShadow(shadow: InnerShadow): NormalizedInnerShadow;
|
|
292
316
|
|
|
293
|
-
interface
|
|
317
|
+
interface NormalizedBaseOuterShadow {
|
|
294
318
|
scaleX: number;
|
|
295
319
|
scaleY: number;
|
|
296
320
|
}
|
|
297
|
-
type
|
|
298
|
-
type
|
|
299
|
-
type
|
|
300
|
-
declare function getDefaultOuterShadow():
|
|
301
|
-
declare function normalizeOuterShadow(shadow:
|
|
321
|
+
type NormalizedOuterShadow = NormalizedBaseOuterShadow & NormalizedInnerShadow;
|
|
322
|
+
type OuterShadowObject = Partial<NormalizedBaseOuterShadow> & InnerShadowObject;
|
|
323
|
+
type OuterShadow = OuterShadowObject;
|
|
324
|
+
declare function getDefaultOuterShadow(): NormalizedOuterShadow;
|
|
325
|
+
declare function normalizeOuterShadow(shadow: OuterShadow): NormalizedOuterShadow;
|
|
302
326
|
|
|
303
|
-
interface
|
|
327
|
+
interface NormalizedSoftEdge {
|
|
304
328
|
radius: number;
|
|
305
329
|
}
|
|
306
|
-
type
|
|
307
|
-
declare function normalizeSoftEdge(softEdge:
|
|
330
|
+
type SoftEdge = NormalizedSoftEdge;
|
|
331
|
+
declare function normalizeSoftEdge(softEdge: SoftEdge): NormalizedSoftEdge;
|
|
308
332
|
|
|
309
|
-
interface
|
|
310
|
-
innerShadow?:
|
|
311
|
-
outerShadow?:
|
|
312
|
-
softEdge?:
|
|
313
|
-
}
|
|
314
|
-
interface EffectPropertyObject {
|
|
315
|
-
innerShadow: WithNone<InnerShadowProperty>;
|
|
316
|
-
outerShadow: WithNone<OuterShadowProperty>;
|
|
317
|
-
softEdge: WithNone<SoftEdgeProperty>;
|
|
333
|
+
interface NormalizedEffect {
|
|
334
|
+
innerShadow?: NormalizedInnerShadow;
|
|
335
|
+
outerShadow?: NormalizedOuterShadow;
|
|
336
|
+
softEdge?: NormalizedSoftEdge;
|
|
318
337
|
}
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
withGeometry?: boolean;
|
|
338
|
+
interface EffectObject {
|
|
339
|
+
innerShadow: WithNone<InnerShadow>;
|
|
340
|
+
outerShadow: WithNone<OuterShadow>;
|
|
341
|
+
softEdge: WithNone<SoftEdge>;
|
|
324
342
|
}
|
|
325
|
-
type
|
|
326
|
-
|
|
327
|
-
type ForegroundProperty = string | ForegroundPropertyObject;
|
|
328
|
-
declare function normalizeForeground(foreground: ForegroundProperty): ForegroundDeclaration | undefined;
|
|
343
|
+
type Effect = EffectObject;
|
|
344
|
+
declare function normalizeEffect(effect: Effect): NormalizedEffect;
|
|
329
345
|
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
type StrokeLinecap = 'butt' | 'round' | 'square';
|
|
333
|
-
type StrokeLinejoin = 'arcs' | 'bevel' | 'miter' | 'miter-clip' | 'round';
|
|
334
|
-
interface GeometryPathStyle {
|
|
335
|
-
[key: string]: any;
|
|
336
|
-
opacity: number;
|
|
337
|
-
visibility: string;
|
|
338
|
-
shadowColor: ColorDeclaration;
|
|
339
|
-
shadowOffsetX: number;
|
|
340
|
-
shadowOffsetY: number;
|
|
341
|
-
shadowBlur: number;
|
|
342
|
-
fill: string;
|
|
343
|
-
fillOpacity: number;
|
|
344
|
-
fillRule: FillRule;
|
|
345
|
-
stroke: string;
|
|
346
|
-
strokeOpacity: number;
|
|
347
|
-
strokeWidth: number;
|
|
348
|
-
strokeLinecap: StrokeLinecap;
|
|
349
|
-
strokeLinejoin: StrokeLinejoin;
|
|
350
|
-
strokeMiterlimit: number;
|
|
351
|
-
strokeDasharray: number[];
|
|
352
|
-
strokeDashoffset: number;
|
|
353
|
-
}
|
|
354
|
-
interface GeometryPathDeclaration extends Partial<GeometryPathStyle> {
|
|
355
|
-
data: SVGPathData;
|
|
356
|
-
}
|
|
357
|
-
interface GeometryDeclaration {
|
|
358
|
-
name?: string;
|
|
359
|
-
svg?: string;
|
|
360
|
-
viewBox?: number[];
|
|
361
|
-
paths?: GeometryPathDeclaration[];
|
|
346
|
+
interface NormalizedBaseForeground {
|
|
347
|
+
fillWithShape: boolean;
|
|
362
348
|
}
|
|
363
|
-
type
|
|
364
|
-
|
|
349
|
+
type NormalizedForeground = NormalizedBaseForeground & NormalizedFill;
|
|
350
|
+
type ForegroundObject = Partial<NormalizedBaseForeground> & FillObject;
|
|
351
|
+
type Foreground = string | ForegroundObject;
|
|
352
|
+
declare function normalizeForeground(foreground: Foreground): NormalizedForeground | undefined;
|
|
365
353
|
|
|
366
|
-
interface
|
|
354
|
+
interface Meta {
|
|
367
355
|
[key: string]: any;
|
|
368
356
|
}
|
|
369
357
|
|
|
370
|
-
interface Node<T =
|
|
358
|
+
interface Node<T = Meta> {
|
|
371
359
|
name?: string;
|
|
372
360
|
children?: Node[];
|
|
373
361
|
meta?: T;
|
|
@@ -388,41 +376,76 @@ interface TailEnd {
|
|
|
388
376
|
height?: WithNone<LineEndSize>;
|
|
389
377
|
}
|
|
390
378
|
|
|
391
|
-
type
|
|
379
|
+
type NormalizedOutlineFill = Partial<NormalizedColorFill> & Partial<NormalizedGradientFill>;
|
|
392
380
|
type OutlineStyle = 'dashed' | 'solid' | string;
|
|
393
|
-
interface
|
|
381
|
+
interface NormalizedOutline extends NormalizedOutlineFill {
|
|
394
382
|
width?: number;
|
|
395
|
-
color?:
|
|
383
|
+
color?: NormalizedColor;
|
|
396
384
|
style?: OutlineStyle;
|
|
397
385
|
headEnd?: HeadEnd;
|
|
398
386
|
tailEnd?: TailEnd;
|
|
399
387
|
}
|
|
400
|
-
type
|
|
388
|
+
type OutlineObject = Partial<NormalizedOutline> & {
|
|
401
389
|
color: WithNone<Color>;
|
|
402
390
|
};
|
|
403
|
-
type
|
|
404
|
-
declare function normalizeOutline(outline:
|
|
391
|
+
type Outline = string | OutlineObject;
|
|
392
|
+
declare function normalizeOutline(outline: Outline): NormalizedOutline;
|
|
405
393
|
|
|
406
394
|
type BoxShadow = string;
|
|
407
|
-
interface
|
|
408
|
-
color:
|
|
395
|
+
interface NormalizedShadow {
|
|
396
|
+
color: NormalizedColor;
|
|
409
397
|
offsetX?: number;
|
|
410
398
|
offsetY?: number;
|
|
411
399
|
blur?: number;
|
|
412
400
|
}
|
|
413
|
-
type
|
|
401
|
+
type ShadowObject = Partial<NormalizedShadow> & {
|
|
414
402
|
color: WithNone<Color>;
|
|
415
403
|
};
|
|
416
|
-
type
|
|
417
|
-
declare function normalizeShadow(shadow:
|
|
418
|
-
interface
|
|
404
|
+
type Shadow = BoxShadow | ShadowObject;
|
|
405
|
+
declare function normalizeShadow(shadow: Shadow): NormalizedShadow;
|
|
406
|
+
interface NormalizedShadowStyle {
|
|
419
407
|
boxShadow: BoxShadow;
|
|
420
|
-
shadowColor?:
|
|
408
|
+
shadowColor?: NormalizedColor;
|
|
421
409
|
shadowOffsetX?: number;
|
|
422
410
|
shadowOffsetY?: number;
|
|
423
411
|
shadowBlur?: number;
|
|
424
412
|
}
|
|
425
|
-
declare function getDefaultShadowStyle():
|
|
413
|
+
declare function getDefaultShadowStyle(): NormalizedShadowStyle;
|
|
414
|
+
|
|
415
|
+
type SVGPathData = string;
|
|
416
|
+
type FillRule = 'nonzero' | 'evenodd';
|
|
417
|
+
type StrokeLinecap = 'butt' | 'round' | 'square';
|
|
418
|
+
type StrokeLinejoin = 'arcs' | 'bevel' | 'miter' | 'miter-clip' | 'round';
|
|
419
|
+
interface ShapePathStyle {
|
|
420
|
+
[key: string]: any;
|
|
421
|
+
opacity: number;
|
|
422
|
+
visibility: string;
|
|
423
|
+
shadowColor: NormalizedColor;
|
|
424
|
+
shadowOffsetX: number;
|
|
425
|
+
shadowOffsetY: number;
|
|
426
|
+
shadowBlur: number;
|
|
427
|
+
fill: string;
|
|
428
|
+
fillOpacity: number;
|
|
429
|
+
fillRule: FillRule;
|
|
430
|
+
stroke: string;
|
|
431
|
+
strokeOpacity: number;
|
|
432
|
+
strokeWidth: number;
|
|
433
|
+
strokeLinecap: StrokeLinecap;
|
|
434
|
+
strokeLinejoin: StrokeLinejoin;
|
|
435
|
+
strokeMiterlimit: number;
|
|
436
|
+
strokeDasharray: number[];
|
|
437
|
+
strokeDashoffset: number;
|
|
438
|
+
}
|
|
439
|
+
interface ShapePath extends Partial<ShapePathStyle> {
|
|
440
|
+
data: SVGPathData;
|
|
441
|
+
}
|
|
442
|
+
interface NormalizedShape {
|
|
443
|
+
preset?: string;
|
|
444
|
+
viewBox?: number[];
|
|
445
|
+
paths?: ShapePath[];
|
|
446
|
+
}
|
|
447
|
+
type Shape = SVGPathData | SVGPathData[] | ShapePath[] | NormalizedShape;
|
|
448
|
+
declare function normalizeShape(shape: Shape): NormalizedShape;
|
|
426
449
|
|
|
427
450
|
type StyleUnit = `${number}%` | number;
|
|
428
451
|
type Display = 'flex' | 'contents';
|
|
@@ -459,7 +482,7 @@ type HighlightColormap = WithNone<Record<string, string>>;
|
|
|
459
482
|
type HighlightSize = StyleUnit | `${number}rem` | 'cover';
|
|
460
483
|
type HighlightThickness = StyleUnit;
|
|
461
484
|
|
|
462
|
-
interface
|
|
485
|
+
interface NormalizedLayoutStyle {
|
|
463
486
|
overflow: Overflow;
|
|
464
487
|
direction: Direction;
|
|
465
488
|
display: Display;
|
|
@@ -503,9 +526,9 @@ interface LayoutStyleDeclaration {
|
|
|
503
526
|
paddingBottom: StyleUnit;
|
|
504
527
|
padding: StyleUnit;
|
|
505
528
|
}
|
|
506
|
-
declare function getDefaultLayoutStyle(): Partial<
|
|
529
|
+
declare function getDefaultLayoutStyle(): Partial<NormalizedLayoutStyle>;
|
|
507
530
|
|
|
508
|
-
interface
|
|
531
|
+
interface NormalizedTransformStyle {
|
|
509
532
|
rotate: number;
|
|
510
533
|
scaleX: number;
|
|
511
534
|
scaleY: number;
|
|
@@ -516,20 +539,20 @@ interface TransformStyleDeclaration {
|
|
|
516
539
|
transform: WithNone<string>;
|
|
517
540
|
transformOrigin: string;
|
|
518
541
|
}
|
|
519
|
-
declare function getDefaultTransformStyle():
|
|
542
|
+
declare function getDefaultTransformStyle(): NormalizedTransformStyle;
|
|
520
543
|
|
|
521
544
|
type BackgroundSize = 'contain' | 'cover' | string | 'stretch' | 'rigid';
|
|
522
|
-
type
|
|
545
|
+
type NormalizedElementStyle = Partial<NormalizedLayoutStyle> & NormalizedTransformStyle & NormalizedShadowStyle & {
|
|
523
546
|
backgroundImage: WithNone<string>;
|
|
524
547
|
backgroundSize: BackgroundSize;
|
|
525
|
-
backgroundColor: WithNone<
|
|
548
|
+
backgroundColor: WithNone<NormalizedColor>;
|
|
526
549
|
backgroundColormap: WithNone<Record<string, string>>;
|
|
527
550
|
borderRadius: number;
|
|
528
|
-
borderColor: WithNone<
|
|
551
|
+
borderColor: WithNone<NormalizedColor>;
|
|
529
552
|
borderStyle: BorderStyle;
|
|
530
553
|
outlineWidth: number;
|
|
531
554
|
outlineOffset: number;
|
|
532
|
-
outlineColor: WithNone<
|
|
555
|
+
outlineColor: WithNone<NormalizedColor>;
|
|
533
556
|
outlineStyle: string;
|
|
534
557
|
visibility: Visibility;
|
|
535
558
|
filter: string;
|
|
@@ -537,9 +560,9 @@ type ElementStyleDeclaration = Partial<LayoutStyleDeclaration> & TransformStyleD
|
|
|
537
560
|
pointerEvents: PointerEvents;
|
|
538
561
|
maskImage: WithNone<string>;
|
|
539
562
|
};
|
|
540
|
-
declare function getDefaultElementStyle():
|
|
563
|
+
declare function getDefaultElementStyle(): NormalizedElementStyle;
|
|
541
564
|
|
|
542
|
-
interface
|
|
565
|
+
interface NormalizedHighlight {
|
|
543
566
|
image: HighlightImage;
|
|
544
567
|
referImage: HighlightReferImage;
|
|
545
568
|
colormap: HighlightColormap;
|
|
@@ -547,8 +570,8 @@ interface HighlightDeclaration {
|
|
|
547
570
|
size: HighlightSize;
|
|
548
571
|
thickness: HighlightThickness;
|
|
549
572
|
}
|
|
550
|
-
interface
|
|
551
|
-
highlight: Partial<
|
|
573
|
+
interface NormalizedHighlightStyle {
|
|
574
|
+
highlight: Partial<NormalizedHighlight>;
|
|
552
575
|
highlightImage: HighlightImage;
|
|
553
576
|
highlightReferImage: HighlightReferImage;
|
|
554
577
|
highlightColormap: HighlightColormap;
|
|
@@ -556,27 +579,27 @@ interface HighlightStyleDeclaration {
|
|
|
556
579
|
highlightSize: HighlightSize;
|
|
557
580
|
highlightThickness: HighlightThickness;
|
|
558
581
|
}
|
|
559
|
-
declare function getDefaultHighlightStyle(): Required<
|
|
582
|
+
declare function getDefaultHighlightStyle(): Required<NormalizedHighlightStyle>;
|
|
560
583
|
|
|
561
|
-
interface
|
|
584
|
+
interface NormalizedListStyle {
|
|
562
585
|
type: ListStyleType;
|
|
563
586
|
image: ListStyleImage;
|
|
564
587
|
colormap: ListStyleColormap;
|
|
565
588
|
size: ListStyleSize;
|
|
566
589
|
position: ListStylePosition;
|
|
567
590
|
}
|
|
568
|
-
interface
|
|
569
|
-
listStyle: Partial<
|
|
591
|
+
interface NormalizedListStyleStyle {
|
|
592
|
+
listStyle: Partial<NormalizedListStyle>;
|
|
570
593
|
listStyleType: ListStyleType;
|
|
571
594
|
listStyleImage: ListStyleImage;
|
|
572
595
|
listStyleColormap: ListStyleColormap;
|
|
573
596
|
listStyleSize: ListStyleSize;
|
|
574
597
|
listStylePosition: ListStylePosition;
|
|
575
598
|
}
|
|
576
|
-
declare function getDefaultListStyleStyle():
|
|
599
|
+
declare function getDefaultListStyleStyle(): NormalizedListStyleStyle;
|
|
577
600
|
|
|
578
|
-
type
|
|
579
|
-
color:
|
|
601
|
+
type NormalizedTextInlineStyle = NormalizedHighlightStyle & {
|
|
602
|
+
color: NormalizedColor;
|
|
580
603
|
verticalAlign: VerticalAlign;
|
|
581
604
|
letterSpacing: number;
|
|
582
605
|
wordSpacing: number;
|
|
@@ -589,104 +612,105 @@ type TextInlineStyleDeclaration = HighlightStyleDeclaration & {
|
|
|
589
612
|
textOrientation: TextOrientation;
|
|
590
613
|
textDecoration: TextDecoration;
|
|
591
614
|
};
|
|
592
|
-
declare function getDefaultTextInlineStyle(): Required<
|
|
615
|
+
declare function getDefaultTextInlineStyle(): Required<NormalizedTextInlineStyle>;
|
|
593
616
|
|
|
594
|
-
type
|
|
617
|
+
type NormalizedTextLineStyle = NormalizedListStyleStyle & {
|
|
595
618
|
writingMode: WritingMode;
|
|
596
619
|
textWrap: TextWrap;
|
|
597
620
|
textAlign: TextAlign;
|
|
598
621
|
textIndent: number;
|
|
599
622
|
lineHeight: number;
|
|
600
623
|
};
|
|
601
|
-
declare function getDefaultTextLineStyle():
|
|
624
|
+
declare function getDefaultTextLineStyle(): NormalizedTextLineStyle;
|
|
602
625
|
|
|
603
|
-
interface
|
|
626
|
+
interface NormalizedTextDrawStyle {
|
|
604
627
|
textStrokeWidth: number;
|
|
605
|
-
textStrokeColor:
|
|
628
|
+
textStrokeColor: NormalizedColor;
|
|
606
629
|
}
|
|
607
|
-
type
|
|
608
|
-
declare function getDefaultTextStyle(): Required<
|
|
630
|
+
type NormalizedTextStyle = NormalizedTextLineStyle & NormalizedTextInlineStyle & NormalizedTextDrawStyle;
|
|
631
|
+
declare function getDefaultTextStyle(): Required<NormalizedTextStyle>;
|
|
609
632
|
|
|
610
|
-
interface
|
|
633
|
+
interface NormalizedStyle extends NormalizedTextStyle, NormalizedElementStyle {
|
|
611
634
|
}
|
|
612
|
-
type
|
|
635
|
+
type StyleObject = Partial<NormalizedStyle> & {
|
|
613
636
|
color?: WithNone<Color>;
|
|
614
637
|
backgroundColor?: WithNone<Color>;
|
|
615
638
|
borderColor?: WithNone<Color>;
|
|
616
639
|
outlineColor?: WithNone<Color>;
|
|
617
640
|
shadowColor?: WithNone<Color>;
|
|
618
641
|
};
|
|
619
|
-
type
|
|
620
|
-
declare function normalizeStyle(style:
|
|
621
|
-
declare function getDefaultStyle():
|
|
642
|
+
type Style = StyleObject;
|
|
643
|
+
declare function normalizeStyle(style: Style): Partial<NormalizedStyle>;
|
|
644
|
+
declare function getDefaultStyle(): NormalizedStyle;
|
|
622
645
|
|
|
623
|
-
interface FragmentContent extends
|
|
646
|
+
interface FragmentContent extends StyleObject {
|
|
624
647
|
content: string;
|
|
625
648
|
}
|
|
626
|
-
interface ParagraphContent extends
|
|
649
|
+
interface ParagraphContent extends StyleObject {
|
|
627
650
|
fragments: FragmentContent[];
|
|
628
651
|
}
|
|
629
652
|
type TextContentFlat = string | FragmentContent | ParagraphContent | (string | FragmentContent)[];
|
|
630
653
|
type TextContent = string | FragmentContent | ParagraphContent | TextContentFlat[];
|
|
631
|
-
type
|
|
632
|
-
interface
|
|
633
|
-
content:
|
|
634
|
-
effects?:
|
|
654
|
+
type NormalizedTextContent = (ParagraphContent & StyleObject)[];
|
|
655
|
+
interface NormalizedText {
|
|
656
|
+
content: NormalizedTextContent;
|
|
657
|
+
effects?: StyleObject[];
|
|
635
658
|
measureDom?: any;
|
|
636
659
|
fonts?: any;
|
|
637
660
|
}
|
|
638
|
-
type
|
|
661
|
+
type Text = string | TextContent | (NormalizedText & {
|
|
639
662
|
content: TextContent;
|
|
640
|
-
}) |
|
|
641
|
-
declare function normalizeTextContent(content?: TextContent):
|
|
642
|
-
declare function normalizeText(text:
|
|
663
|
+
}) | NormalizedText;
|
|
664
|
+
declare function normalizeTextContent(content?: TextContent): NormalizedTextContent;
|
|
665
|
+
declare function normalizeText(text: Text): NormalizedText;
|
|
643
666
|
|
|
644
|
-
interface
|
|
667
|
+
interface NormalizedVideo {
|
|
645
668
|
src: string;
|
|
646
669
|
}
|
|
647
|
-
type
|
|
648
|
-
declare function normalizeVideo(video:
|
|
649
|
-
|
|
650
|
-
interface Element<T =
|
|
651
|
-
style?: WithNone<
|
|
652
|
-
text?: WithNone<
|
|
653
|
-
background?: WithNone<
|
|
654
|
-
|
|
655
|
-
fill?: WithNone<
|
|
656
|
-
outline?: WithNone<
|
|
657
|
-
foreground?: WithNone<
|
|
658
|
-
shadow?: WithNone<
|
|
659
|
-
video?: WithNone<
|
|
660
|
-
audio?: WithNone<
|
|
661
|
-
effect?: WithNone<
|
|
670
|
+
type Video = string | NormalizedVideo;
|
|
671
|
+
declare function normalizeVideo(video: Video): NormalizedVideo | undefined;
|
|
672
|
+
|
|
673
|
+
interface Element<T = Meta> extends Node<T> {
|
|
674
|
+
style?: WithNone<Style>;
|
|
675
|
+
text?: WithNone<Text>;
|
|
676
|
+
background?: WithNone<Background>;
|
|
677
|
+
shape?: WithNone<Shape>;
|
|
678
|
+
fill?: WithNone<Fill>;
|
|
679
|
+
outline?: WithNone<Outline>;
|
|
680
|
+
foreground?: WithNone<Foreground>;
|
|
681
|
+
shadow?: WithNone<Shadow>;
|
|
682
|
+
video?: WithNone<Video>;
|
|
683
|
+
audio?: WithNone<Audio>;
|
|
684
|
+
effect?: WithNone<Effect>;
|
|
662
685
|
children?: Element[];
|
|
663
686
|
}
|
|
664
|
-
type
|
|
665
|
-
style?: Partial<
|
|
666
|
-
text?:
|
|
667
|
-
background?:
|
|
668
|
-
|
|
669
|
-
fill?:
|
|
670
|
-
outline?:
|
|
671
|
-
foreground?:
|
|
672
|
-
shadow?:
|
|
673
|
-
video?:
|
|
674
|
-
audio?:
|
|
675
|
-
effect?:
|
|
676
|
-
children?:
|
|
687
|
+
type NormalizedElement<T = Meta> = Node<T> & {
|
|
688
|
+
style?: Partial<NormalizedStyle>;
|
|
689
|
+
text?: NormalizedText;
|
|
690
|
+
background?: NormalizedBackground;
|
|
691
|
+
shape?: NormalizedShape;
|
|
692
|
+
fill?: NormalizedFill;
|
|
693
|
+
outline?: NormalizedOutline;
|
|
694
|
+
foreground?: NormalizedForeground;
|
|
695
|
+
shadow?: NormalizedShadow;
|
|
696
|
+
video?: NormalizedVideo;
|
|
697
|
+
audio?: NormalizedAudio;
|
|
698
|
+
effect?: NormalizedEffect;
|
|
699
|
+
children?: NormalizedElement[];
|
|
677
700
|
};
|
|
678
|
-
declare function normalizeElement<T =
|
|
701
|
+
declare function normalizeElement<T = Meta>(element: Element<T>): NormalizedElement<T>;
|
|
679
702
|
|
|
680
703
|
interface Document extends Element {
|
|
681
704
|
fonts?: any;
|
|
682
705
|
}
|
|
683
|
-
interface
|
|
706
|
+
interface NormalizedDocument extends NormalizedElement {
|
|
684
707
|
fonts?: any;
|
|
685
708
|
}
|
|
686
|
-
declare function normalizeDocument(doc: Document):
|
|
709
|
+
declare function normalizeDocument(doc: Document): NormalizedDocument;
|
|
687
710
|
|
|
688
711
|
declare function isNone<T>(value: T): value is Extract<T, null | undefined | 'none'>;
|
|
712
|
+
declare function round(number: number, digits?: number, base?: number): number;
|
|
689
713
|
declare function clearUndef<T>(obj: T, deep?: boolean): T;
|
|
690
714
|
|
|
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,
|
|
692
|
-
export type { Align, AngularNode,
|
|
715
|
+
export { clearUndef, defaultColor, getDefaultElementStyle, getDefaultHighlightStyle, getDefaultInnerShadow, getDefaultLayoutStyle, getDefaultListStyleStyle, getDefaultOuterShadow, getDefaultShadowStyle, getDefaultStyle, getDefaultTextInlineStyle, getDefaultTextLineStyle, getDefaultTextStyle, getDefaultTransformStyle, isColor, isGradient, isNone, normalizeAudio, normalizeBackground, normalizeColor, normalizeColorFill, normalizeDocument, normalizeEffect, normalizeElement, normalizeFill, normalizeForeground, normalizeGradient, normalizeGradientFill, normalizeImageFill, normalizeInnerShadow, normalizeOuterShadow, normalizeOutline, normalizePresetFill, normalizeShadow, normalizeShape, normalizeSoftEdge, normalizeStyle, normalizeText, normalizeTextContent, normalizeVideo, parseColor, parseGradient, round, stringifyGradient };
|
|
716
|
+
export type { Align, AngularNode, Audio, Background, BackgroundObject, BackgroundSize, BorderStyle, BoxShadow, BoxSizing, CmykColor, CmykaColor, Color, ColorFill, ColorFillObject, ColorStop, ColorStopNode, DefaultRadialNode, Direction, DirectionalNode, Display, Document, Effect, EffectObject, Element, EmNode, ExtentKeywordNode, Fill, FillObject, FillRule, FlexDirection, FlexWrap, FontKerning, FontStyle, FontWeight, Foreground, ForegroundObject, FragmentContent, GradientFill, GradientFillObject, GradientNode, HeadEnd, Hex8Color, HexNode, HighlightColormap, HighlightImage, HighlightLine, HighlightReferImage, HighlightSize, HighlightThickness, HslColor, HslaColor, HsvColor, HsvaColor, HwbColor, HwbaColor, ImageFillCropRect, ImageFillObject, ImageFillStretchRect, ImageFillTile, InnerShadow, InnerShadowObject, Justify, LabColor, LabaColor, LchColor, LchaColor, LineEndSize, LineEndType, LinearGradient, LinearGradientNode, ListStyleColormap, ListStyleImage, ListStylePosition, ListStyleSize, ListStyleType, LiteralNode, Meta, Node, None, NormalizedAudio, NormalizedBackground, NormalizedBaseBackground, NormalizedBaseForeground, NormalizedBaseOuterShadow, NormalizedColor, NormalizedColorFill, NormalizedDocument, NormalizedEffect, NormalizedElement, NormalizedElementStyle, NormalizedFill, NormalizedForeground, NormalizedGradientFill, NormalizedHighlight, NormalizedHighlightStyle, NormalizedImageFill, NormalizedInnerShadow, NormalizedLayoutStyle, NormalizedListStyle, NormalizedListStyleStyle, NormalizedOuterShadow, NormalizedOutline, NormalizedOutlineFill, NormalizedPresetFill, NormalizedShadow, NormalizedShadowStyle, NormalizedShape, NormalizedSoftEdge, NormalizedStyle, NormalizedText, NormalizedTextContent, NormalizedTextDrawStyle, NormalizedTextInlineStyle, NormalizedTextLineStyle, NormalizedTextStyle, NormalizedTransformStyle, NormalizedVideo, ObjectColor, OuterShadow, OuterShadowObject, Outline, OutlineObject, OutlineStyle, Overflow, ParagraphContent, PercentNode, PointerEvents, Position, PositionKeywordNode, PositionNode, PresetFill, PresetFillObject, PxNode, RadialGradient, RadialGradientNode, RepeatingLinearGradientNode, RepeatingRadialGradientNode, RgbColor, RgbNode, RgbaColor, RgbaNode, SVGPathData, Shadow, ShadowObject, Shape, ShapeNode, ShapePath, ShapePathStyle, SoftEdge, StrokeLinecap, StrokeLinejoin, Style, StyleObject, StyleUnit, TailEnd, Text, TextAlign, TextContent, TextContentFlat, TextDecoration, TextOrientation, TextTransform, TextWrap, Uint32Color, VerticalAlign, Video, Visibility, WithNone, WritingMode, XyzColor, XyzaColor };
|