modern-idoc 0.6.4 → 0.6.6
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 +58 -26
- package/dist/index.d.cts +45 -34
- package/dist/index.d.mts +45 -34
- package/dist/index.d.ts +45 -34
- package/dist/index.js +1 -1
- package/dist/index.mjs +51 -27
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -725,7 +725,13 @@ function normalizeGradientFill(fill) {
|
|
|
725
725
|
}
|
|
726
726
|
|
|
727
727
|
function normalizeImageFill(fill) {
|
|
728
|
-
|
|
728
|
+
let obj;
|
|
729
|
+
if (typeof fill === "string") {
|
|
730
|
+
obj = { image: fill };
|
|
731
|
+
} else {
|
|
732
|
+
obj = fill;
|
|
733
|
+
}
|
|
734
|
+
return obj;
|
|
729
735
|
}
|
|
730
736
|
|
|
731
737
|
function normalizePresetFill(fill) {
|
|
@@ -742,27 +748,39 @@ function normalizePresetFill(fill) {
|
|
|
742
748
|
};
|
|
743
749
|
}
|
|
744
750
|
|
|
751
|
+
function isColorFillObject(fill) {
|
|
752
|
+
return !isNone(fill.color);
|
|
753
|
+
}
|
|
754
|
+
function isColorFill(fill) {
|
|
755
|
+
return typeof fill === "string" ? isColor(fill) : isColorFillObject(fill);
|
|
756
|
+
}
|
|
757
|
+
function isGradientFillObject(fill) {
|
|
758
|
+
return !isNone(fill.image) && isGradient(fill.image);
|
|
759
|
+
}
|
|
760
|
+
function isGradientFill(fill) {
|
|
761
|
+
return typeof fill === "string" ? isGradient(fill) : isGradientFillObject(fill);
|
|
762
|
+
}
|
|
763
|
+
function isImageFillObject(fill) {
|
|
764
|
+
return !isNone(fill.image) && !isGradient(fill.image);
|
|
765
|
+
}
|
|
766
|
+
function isImageFill(fill) {
|
|
767
|
+
return typeof fill === "string" ? !isGradient(fill) : isImageFillObject(fill);
|
|
768
|
+
}
|
|
769
|
+
function isPresetFillObject(fill) {
|
|
770
|
+
return !isNone(fill.preset);
|
|
771
|
+
}
|
|
772
|
+
function isPresetFill(fill) {
|
|
773
|
+
return typeof fill === "string" ? false : isPresetFillObject(fill);
|
|
774
|
+
}
|
|
745
775
|
function normalizeFill(fill) {
|
|
746
|
-
if (
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
} else {
|
|
755
|
-
if (!isNone(fill.color)) {
|
|
756
|
-
return normalizeColorFill(fill);
|
|
757
|
-
} else if (!isNone(fill.image)) {
|
|
758
|
-
if (isGradient(fill.image)) {
|
|
759
|
-
return normalizeGradientFill(fill);
|
|
760
|
-
} else {
|
|
761
|
-
return normalizeImageFill(fill);
|
|
762
|
-
}
|
|
763
|
-
} else if (isNone(fill.preset)) {
|
|
764
|
-
return normalizePresetFill(fill);
|
|
765
|
-
}
|
|
776
|
+
if (isColorFill(fill)) {
|
|
777
|
+
return normalizeColorFill(fill);
|
|
778
|
+
} else if (isGradientFill(fill)) {
|
|
779
|
+
return normalizeGradientFill(fill);
|
|
780
|
+
} else if (isImageFill(fill)) {
|
|
781
|
+
return normalizeImageFill(fill);
|
|
782
|
+
} else if (isPresetFill(fill)) {
|
|
783
|
+
return normalizePresetFill(fill);
|
|
766
784
|
}
|
|
767
785
|
throw new Error("Unknown fill property object");
|
|
768
786
|
}
|
|
@@ -873,11 +891,17 @@ function getDefaultShadowStyle() {
|
|
|
873
891
|
|
|
874
892
|
function normalizeShape(shape) {
|
|
875
893
|
if (typeof shape === "string") {
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
}
|
|
894
|
+
if (shape.startsWith("<svg")) {
|
|
895
|
+
return {
|
|
896
|
+
svg: shape
|
|
897
|
+
};
|
|
898
|
+
} else {
|
|
899
|
+
return {
|
|
900
|
+
paths: [
|
|
901
|
+
{ data: shape }
|
|
902
|
+
]
|
|
903
|
+
};
|
|
904
|
+
}
|
|
881
905
|
} else if (Array.isArray(shape)) {
|
|
882
906
|
return {
|
|
883
907
|
paths: shape.map((data) => {
|
|
@@ -1177,8 +1201,16 @@ exports.getDefaultTextLineStyle = getDefaultTextLineStyle;
|
|
|
1177
1201
|
exports.getDefaultTextStyle = getDefaultTextStyle;
|
|
1178
1202
|
exports.getDefaultTransformStyle = getDefaultTransformStyle;
|
|
1179
1203
|
exports.isColor = isColor;
|
|
1204
|
+
exports.isColorFill = isColorFill;
|
|
1205
|
+
exports.isColorFillObject = isColorFillObject;
|
|
1180
1206
|
exports.isGradient = isGradient;
|
|
1207
|
+
exports.isGradientFill = isGradientFill;
|
|
1208
|
+
exports.isGradientFillObject = isGradientFillObject;
|
|
1209
|
+
exports.isImageFill = isImageFill;
|
|
1210
|
+
exports.isImageFillObject = isImageFillObject;
|
|
1181
1211
|
exports.isNone = isNone;
|
|
1212
|
+
exports.isPresetFill = isPresetFill;
|
|
1213
|
+
exports.isPresetFillObject = isPresetFillObject;
|
|
1182
1214
|
exports.normalizeAudio = normalizeAudio;
|
|
1183
1215
|
exports.normalizeBackground = normalizeBackground;
|
|
1184
1216
|
exports.normalizeColor = normalizeColor;
|
package/dist/index.d.cts
CHANGED
|
@@ -273,12 +273,14 @@ interface ImageFillObject {
|
|
|
273
273
|
opacity?: number;
|
|
274
274
|
rotateWithShape?: boolean;
|
|
275
275
|
}
|
|
276
|
+
type ImageFill = string | ImageFillObject;
|
|
276
277
|
interface NormalizedImageFill extends ImageFillObject {
|
|
277
278
|
}
|
|
278
|
-
declare function normalizeImageFill(fill:
|
|
279
|
+
declare function normalizeImageFill(fill: ImageFill): NormalizedImageFill;
|
|
279
280
|
|
|
280
281
|
type None = undefined | null | 'none';
|
|
281
282
|
type WithNone<T> = T | None;
|
|
283
|
+
type WithStyleNone<T> = T | 'none';
|
|
282
284
|
|
|
283
285
|
interface PresetFillObject {
|
|
284
286
|
preset: string;
|
|
@@ -295,6 +297,14 @@ declare function normalizePresetFill(fill: PresetFill): NormalizedPresetFill;
|
|
|
295
297
|
type FillObject = Partial<ColorFillObject> & Partial<GradientFillObject> & Partial<ImageFillObject> & Partial<PresetFillObject>;
|
|
296
298
|
type Fill = string | FillObject;
|
|
297
299
|
type NormalizedFill = Partial<NormalizedColorFill> & Partial<NormalizedGradientFill> & Partial<NormalizedImageFill> & Partial<NormalizedPresetFill>;
|
|
300
|
+
declare function isColorFillObject(fill: FillObject): fill is ColorFillObject;
|
|
301
|
+
declare function isColorFill(fill: Fill): fill is ColorFill;
|
|
302
|
+
declare function isGradientFillObject(fill: FillObject): fill is GradientFillObject;
|
|
303
|
+
declare function isGradientFill(fill: Fill): fill is GradientFill;
|
|
304
|
+
declare function isImageFillObject(fill: FillObject): fill is ImageFillObject;
|
|
305
|
+
declare function isImageFill(fill: Fill): fill is ImageFill;
|
|
306
|
+
declare function isPresetFillObject(fill: FillObject): fill is PresetFillObject;
|
|
307
|
+
declare function isPresetFill(fill: Fill): fill is PresetFill;
|
|
298
308
|
declare function normalizeFill(fill: Fill): NormalizedFill;
|
|
299
309
|
|
|
300
310
|
interface NormalizedBaseBackground {
|
|
@@ -312,7 +322,7 @@ interface NormalizedInnerShadow {
|
|
|
312
322
|
blurRadius: number;
|
|
313
323
|
}
|
|
314
324
|
type InnerShadowObject = Partial<NormalizedInnerShadow> & {
|
|
315
|
-
color
|
|
325
|
+
color?: WithNone<Color>;
|
|
316
326
|
};
|
|
317
327
|
type InnerShadow = InnerShadowObject;
|
|
318
328
|
declare function getDefaultInnerShadow(): NormalizedInnerShadow;
|
|
@@ -390,7 +400,7 @@ interface NormalizedOutline extends NormalizedOutlineFill {
|
|
|
390
400
|
tailEnd?: TailEnd;
|
|
391
401
|
}
|
|
392
402
|
type OutlineObject = Partial<NormalizedOutline> & {
|
|
393
|
-
color
|
|
403
|
+
color?: WithNone<Color>;
|
|
394
404
|
};
|
|
395
405
|
type Outline = string | OutlineObject;
|
|
396
406
|
declare function normalizeOutline(outline: Outline): NormalizedOutline;
|
|
@@ -403,7 +413,7 @@ interface NormalizedShadow {
|
|
|
403
413
|
blur?: number;
|
|
404
414
|
}
|
|
405
415
|
type ShadowObject = Partial<NormalizedShadow> & {
|
|
406
|
-
color
|
|
416
|
+
color?: WithNone<Color>;
|
|
407
417
|
};
|
|
408
418
|
type Shadow = BoxShadow | ShadowObject;
|
|
409
419
|
declare function normalizeShadow(shadow: Shadow): NormalizedShadow;
|
|
@@ -446,6 +456,7 @@ interface ShapePath extends Partial<ShapePathStyle> {
|
|
|
446
456
|
interface NormalizedShape {
|
|
447
457
|
preset?: string;
|
|
448
458
|
viewBox?: number[];
|
|
459
|
+
svg?: string;
|
|
449
460
|
paths?: ShapePath[];
|
|
450
461
|
}
|
|
451
462
|
type Shape = SVGPathData | SVGPathData[] | ShapePath[] | NormalizedShape;
|
|
@@ -458,12 +469,12 @@ type Overflow = 'hidden' | 'visible';
|
|
|
458
469
|
type Visibility = 'hidden' | 'visible';
|
|
459
470
|
type FontWeight = 'normal' | 'bold' | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900;
|
|
460
471
|
type FontStyle = 'normal' | 'italic' | 'oblique' | `oblique ${string}`;
|
|
461
|
-
type FontKerning =
|
|
472
|
+
type FontKerning = WithStyleNone<'auto' | 'normal'>;
|
|
462
473
|
type TextWrap = 'wrap' | 'nowrap';
|
|
463
|
-
type TextAlign =
|
|
464
|
-
type TextTransform =
|
|
474
|
+
type TextAlign = WithStyleNone<'center' | 'end' | 'left' | 'right' | 'start' | 'justify'>;
|
|
475
|
+
type TextTransform = WithStyleNone<'uppercase' | 'lowercase'>;
|
|
465
476
|
type TextOrientation = 'mixed' | 'upright' | 'sideways-right' | 'sideways';
|
|
466
|
-
type TextDecoration =
|
|
477
|
+
type TextDecoration = WithStyleNone<'underline' | 'line-through' | 'overline'>;
|
|
467
478
|
type VerticalAlign = 'baseline' | 'top' | 'middle' | 'bottom' | 'sub' | 'super' | 'text-top' | 'text-bottom';
|
|
468
479
|
type WritingMode = 'horizontal-tb' | 'vertical-lr' | 'vertical-rl';
|
|
469
480
|
type Align = 'auto' | 'flex-start' | 'center' | 'flex-end' | 'stretch' | 'baseline' | 'space-between' | 'space-around' | 'space-evenly';
|
|
@@ -471,18 +482,18 @@ type FlexDirection = 'column' | 'column-reverse' | 'row' | 'row-reverse';
|
|
|
471
482
|
type FlexWrap = 'nowrap' | 'wrap' | 'Wrap-reverse';
|
|
472
483
|
type Justify = 'flex-start' | 'center' | 'flex-end' | 'space-between' | 'space-around' | 'space-evenly';
|
|
473
484
|
type Position = 'static' | 'relative' | 'absolute';
|
|
474
|
-
type BorderStyle =
|
|
485
|
+
type BorderStyle = WithStyleNone<'dashed' | 'solid'>;
|
|
475
486
|
type BoxSizing = 'border-box' | 'content-box';
|
|
476
487
|
type PointerEvents = 'auto' | 'none';
|
|
477
|
-
type ListStyleType =
|
|
478
|
-
type ListStyleImage =
|
|
479
|
-
type ListStyleColormap =
|
|
488
|
+
type ListStyleType = WithStyleNone<'disc'>;
|
|
489
|
+
type ListStyleImage = WithStyleNone<string>;
|
|
490
|
+
type ListStyleColormap = WithStyleNone<Record<string, string>>;
|
|
480
491
|
type ListStyleSize = StyleUnit | `${number}rem` | 'cover';
|
|
481
492
|
type ListStylePosition = 'inside' | 'outside';
|
|
482
493
|
type HighlightLine = TextDecoration | 'outline';
|
|
483
|
-
type HighlightImage =
|
|
484
|
-
type HighlightReferImage =
|
|
485
|
-
type HighlightColormap =
|
|
494
|
+
type HighlightImage = WithStyleNone<string>;
|
|
495
|
+
type HighlightReferImage = WithStyleNone<string>;
|
|
496
|
+
type HighlightColormap = WithStyleNone<Record<string, string>>;
|
|
486
497
|
type HighlightSize = StyleUnit | `${number}rem` | 'cover';
|
|
487
498
|
type HighlightThickness = StyleUnit;
|
|
488
499
|
|
|
@@ -519,11 +530,11 @@ interface NormalizedLayoutStyle {
|
|
|
519
530
|
alignSelf: Align;
|
|
520
531
|
justifyContent: Justify;
|
|
521
532
|
gap: StyleUnit;
|
|
522
|
-
marginTop:
|
|
523
|
-
marginLeft:
|
|
524
|
-
marginRight:
|
|
525
|
-
marginBottom:
|
|
526
|
-
margin:
|
|
533
|
+
marginTop: WithStyleNone<StyleUnit | 'auto'>;
|
|
534
|
+
marginLeft: WithStyleNone<StyleUnit | 'auto'>;
|
|
535
|
+
marginRight: WithStyleNone<StyleUnit | 'auto'>;
|
|
536
|
+
marginBottom: WithStyleNone<StyleUnit | 'auto'>;
|
|
537
|
+
margin: WithStyleNone<StyleUnit | 'auto'>;
|
|
527
538
|
paddingTop: StyleUnit;
|
|
528
539
|
paddingLeft: StyleUnit;
|
|
529
540
|
paddingRight: StyleUnit;
|
|
@@ -540,29 +551,29 @@ interface NormalizedTransformStyle {
|
|
|
540
551
|
skewY: number;
|
|
541
552
|
translateX: number;
|
|
542
553
|
translateY: number;
|
|
543
|
-
transform:
|
|
554
|
+
transform: WithStyleNone<string>;
|
|
544
555
|
transformOrigin: string;
|
|
545
556
|
}
|
|
546
557
|
declare function getDefaultTransformStyle(): NormalizedTransformStyle;
|
|
547
558
|
|
|
548
559
|
type BackgroundSize = 'contain' | 'cover' | string | 'stretch' | 'rigid';
|
|
549
560
|
type NormalizedElementStyle = Partial<NormalizedLayoutStyle> & NormalizedTransformStyle & NormalizedShadowStyle & {
|
|
550
|
-
backgroundImage:
|
|
561
|
+
backgroundImage: WithStyleNone<string>;
|
|
551
562
|
backgroundSize: BackgroundSize;
|
|
552
|
-
backgroundColor:
|
|
553
|
-
backgroundColormap:
|
|
563
|
+
backgroundColor: WithStyleNone<NormalizedColor>;
|
|
564
|
+
backgroundColormap: WithStyleNone<Record<string, string>>;
|
|
554
565
|
borderRadius: number;
|
|
555
|
-
borderColor:
|
|
566
|
+
borderColor: WithStyleNone<NormalizedColor>;
|
|
556
567
|
borderStyle: BorderStyle;
|
|
557
568
|
outlineWidth: number;
|
|
558
569
|
outlineOffset: number;
|
|
559
|
-
outlineColor:
|
|
570
|
+
outlineColor: WithStyleNone<NormalizedColor>;
|
|
560
571
|
outlineStyle: string;
|
|
561
572
|
visibility: Visibility;
|
|
562
573
|
filter: string;
|
|
563
574
|
opacity: number;
|
|
564
575
|
pointerEvents: PointerEvents;
|
|
565
|
-
maskImage:
|
|
576
|
+
maskImage: WithStyleNone<string>;
|
|
566
577
|
};
|
|
567
578
|
declare function getDefaultElementStyle(): NormalizedElementStyle;
|
|
568
579
|
|
|
@@ -639,11 +650,11 @@ type NormalizedStyle = NormalizedTextStyle & NormalizedElementStyle & {
|
|
|
639
650
|
outline?: NormalizedOutline;
|
|
640
651
|
};
|
|
641
652
|
type StyleObject = Partial<NormalizedStyle> & {
|
|
642
|
-
color?:
|
|
643
|
-
backgroundColor?:
|
|
644
|
-
borderColor?:
|
|
645
|
-
outlineColor?:
|
|
646
|
-
shadowColor?:
|
|
653
|
+
color?: WithStyleNone<Color>;
|
|
654
|
+
backgroundColor?: WithStyleNone<Color>;
|
|
655
|
+
borderColor?: WithStyleNone<Color>;
|
|
656
|
+
outlineColor?: WithStyleNone<Color>;
|
|
657
|
+
shadowColor?: WithStyleNone<Color>;
|
|
647
658
|
fill?: Fill;
|
|
648
659
|
outline?: Outline;
|
|
649
660
|
};
|
|
@@ -720,5 +731,5 @@ declare function isNone<T>(value: T): value is Extract<T, null | undefined | 'no
|
|
|
720
731
|
declare function round(number: number, digits?: number, base?: number): number;
|
|
721
732
|
declare function clearUndef<T>(obj: T, deep?: boolean): T;
|
|
722
733
|
|
|
723
|
-
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 };
|
|
724
|
-
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, LinearGradientWithType, 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, RadialGradientWithType, 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 };
|
|
734
|
+
export { clearUndef, defaultColor, getDefaultElementStyle, getDefaultHighlightStyle, getDefaultInnerShadow, getDefaultLayoutStyle, getDefaultListStyleStyle, getDefaultOuterShadow, getDefaultShadowStyle, getDefaultStyle, getDefaultTextInlineStyle, getDefaultTextLineStyle, getDefaultTextStyle, getDefaultTransformStyle, isColor, isColorFill, isColorFillObject, isGradient, isGradientFill, isGradientFillObject, isImageFill, isImageFillObject, isNone, isPresetFill, isPresetFillObject, 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 };
|
|
735
|
+
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, ImageFill, ImageFillCropRect, ImageFillObject, ImageFillStretchRect, ImageFillTile, InnerShadow, InnerShadowObject, Justify, LabColor, LabaColor, LchColor, LchaColor, LineEndSize, LineEndType, LinearGradient, LinearGradientNode, LinearGradientWithType, 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, RadialGradientWithType, 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, WithStyleNone, WritingMode, XyzColor, XyzaColor };
|
package/dist/index.d.mts
CHANGED
|
@@ -273,12 +273,14 @@ interface ImageFillObject {
|
|
|
273
273
|
opacity?: number;
|
|
274
274
|
rotateWithShape?: boolean;
|
|
275
275
|
}
|
|
276
|
+
type ImageFill = string | ImageFillObject;
|
|
276
277
|
interface NormalizedImageFill extends ImageFillObject {
|
|
277
278
|
}
|
|
278
|
-
declare function normalizeImageFill(fill:
|
|
279
|
+
declare function normalizeImageFill(fill: ImageFill): NormalizedImageFill;
|
|
279
280
|
|
|
280
281
|
type None = undefined | null | 'none';
|
|
281
282
|
type WithNone<T> = T | None;
|
|
283
|
+
type WithStyleNone<T> = T | 'none';
|
|
282
284
|
|
|
283
285
|
interface PresetFillObject {
|
|
284
286
|
preset: string;
|
|
@@ -295,6 +297,14 @@ declare function normalizePresetFill(fill: PresetFill): NormalizedPresetFill;
|
|
|
295
297
|
type FillObject = Partial<ColorFillObject> & Partial<GradientFillObject> & Partial<ImageFillObject> & Partial<PresetFillObject>;
|
|
296
298
|
type Fill = string | FillObject;
|
|
297
299
|
type NormalizedFill = Partial<NormalizedColorFill> & Partial<NormalizedGradientFill> & Partial<NormalizedImageFill> & Partial<NormalizedPresetFill>;
|
|
300
|
+
declare function isColorFillObject(fill: FillObject): fill is ColorFillObject;
|
|
301
|
+
declare function isColorFill(fill: Fill): fill is ColorFill;
|
|
302
|
+
declare function isGradientFillObject(fill: FillObject): fill is GradientFillObject;
|
|
303
|
+
declare function isGradientFill(fill: Fill): fill is GradientFill;
|
|
304
|
+
declare function isImageFillObject(fill: FillObject): fill is ImageFillObject;
|
|
305
|
+
declare function isImageFill(fill: Fill): fill is ImageFill;
|
|
306
|
+
declare function isPresetFillObject(fill: FillObject): fill is PresetFillObject;
|
|
307
|
+
declare function isPresetFill(fill: Fill): fill is PresetFill;
|
|
298
308
|
declare function normalizeFill(fill: Fill): NormalizedFill;
|
|
299
309
|
|
|
300
310
|
interface NormalizedBaseBackground {
|
|
@@ -312,7 +322,7 @@ interface NormalizedInnerShadow {
|
|
|
312
322
|
blurRadius: number;
|
|
313
323
|
}
|
|
314
324
|
type InnerShadowObject = Partial<NormalizedInnerShadow> & {
|
|
315
|
-
color
|
|
325
|
+
color?: WithNone<Color>;
|
|
316
326
|
};
|
|
317
327
|
type InnerShadow = InnerShadowObject;
|
|
318
328
|
declare function getDefaultInnerShadow(): NormalizedInnerShadow;
|
|
@@ -390,7 +400,7 @@ interface NormalizedOutline extends NormalizedOutlineFill {
|
|
|
390
400
|
tailEnd?: TailEnd;
|
|
391
401
|
}
|
|
392
402
|
type OutlineObject = Partial<NormalizedOutline> & {
|
|
393
|
-
color
|
|
403
|
+
color?: WithNone<Color>;
|
|
394
404
|
};
|
|
395
405
|
type Outline = string | OutlineObject;
|
|
396
406
|
declare function normalizeOutline(outline: Outline): NormalizedOutline;
|
|
@@ -403,7 +413,7 @@ interface NormalizedShadow {
|
|
|
403
413
|
blur?: number;
|
|
404
414
|
}
|
|
405
415
|
type ShadowObject = Partial<NormalizedShadow> & {
|
|
406
|
-
color
|
|
416
|
+
color?: WithNone<Color>;
|
|
407
417
|
};
|
|
408
418
|
type Shadow = BoxShadow | ShadowObject;
|
|
409
419
|
declare function normalizeShadow(shadow: Shadow): NormalizedShadow;
|
|
@@ -446,6 +456,7 @@ interface ShapePath extends Partial<ShapePathStyle> {
|
|
|
446
456
|
interface NormalizedShape {
|
|
447
457
|
preset?: string;
|
|
448
458
|
viewBox?: number[];
|
|
459
|
+
svg?: string;
|
|
449
460
|
paths?: ShapePath[];
|
|
450
461
|
}
|
|
451
462
|
type Shape = SVGPathData | SVGPathData[] | ShapePath[] | NormalizedShape;
|
|
@@ -458,12 +469,12 @@ type Overflow = 'hidden' | 'visible';
|
|
|
458
469
|
type Visibility = 'hidden' | 'visible';
|
|
459
470
|
type FontWeight = 'normal' | 'bold' | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900;
|
|
460
471
|
type FontStyle = 'normal' | 'italic' | 'oblique' | `oblique ${string}`;
|
|
461
|
-
type FontKerning =
|
|
472
|
+
type FontKerning = WithStyleNone<'auto' | 'normal'>;
|
|
462
473
|
type TextWrap = 'wrap' | 'nowrap';
|
|
463
|
-
type TextAlign =
|
|
464
|
-
type TextTransform =
|
|
474
|
+
type TextAlign = WithStyleNone<'center' | 'end' | 'left' | 'right' | 'start' | 'justify'>;
|
|
475
|
+
type TextTransform = WithStyleNone<'uppercase' | 'lowercase'>;
|
|
465
476
|
type TextOrientation = 'mixed' | 'upright' | 'sideways-right' | 'sideways';
|
|
466
|
-
type TextDecoration =
|
|
477
|
+
type TextDecoration = WithStyleNone<'underline' | 'line-through' | 'overline'>;
|
|
467
478
|
type VerticalAlign = 'baseline' | 'top' | 'middle' | 'bottom' | 'sub' | 'super' | 'text-top' | 'text-bottom';
|
|
468
479
|
type WritingMode = 'horizontal-tb' | 'vertical-lr' | 'vertical-rl';
|
|
469
480
|
type Align = 'auto' | 'flex-start' | 'center' | 'flex-end' | 'stretch' | 'baseline' | 'space-between' | 'space-around' | 'space-evenly';
|
|
@@ -471,18 +482,18 @@ type FlexDirection = 'column' | 'column-reverse' | 'row' | 'row-reverse';
|
|
|
471
482
|
type FlexWrap = 'nowrap' | 'wrap' | 'Wrap-reverse';
|
|
472
483
|
type Justify = 'flex-start' | 'center' | 'flex-end' | 'space-between' | 'space-around' | 'space-evenly';
|
|
473
484
|
type Position = 'static' | 'relative' | 'absolute';
|
|
474
|
-
type BorderStyle =
|
|
485
|
+
type BorderStyle = WithStyleNone<'dashed' | 'solid'>;
|
|
475
486
|
type BoxSizing = 'border-box' | 'content-box';
|
|
476
487
|
type PointerEvents = 'auto' | 'none';
|
|
477
|
-
type ListStyleType =
|
|
478
|
-
type ListStyleImage =
|
|
479
|
-
type ListStyleColormap =
|
|
488
|
+
type ListStyleType = WithStyleNone<'disc'>;
|
|
489
|
+
type ListStyleImage = WithStyleNone<string>;
|
|
490
|
+
type ListStyleColormap = WithStyleNone<Record<string, string>>;
|
|
480
491
|
type ListStyleSize = StyleUnit | `${number}rem` | 'cover';
|
|
481
492
|
type ListStylePosition = 'inside' | 'outside';
|
|
482
493
|
type HighlightLine = TextDecoration | 'outline';
|
|
483
|
-
type HighlightImage =
|
|
484
|
-
type HighlightReferImage =
|
|
485
|
-
type HighlightColormap =
|
|
494
|
+
type HighlightImage = WithStyleNone<string>;
|
|
495
|
+
type HighlightReferImage = WithStyleNone<string>;
|
|
496
|
+
type HighlightColormap = WithStyleNone<Record<string, string>>;
|
|
486
497
|
type HighlightSize = StyleUnit | `${number}rem` | 'cover';
|
|
487
498
|
type HighlightThickness = StyleUnit;
|
|
488
499
|
|
|
@@ -519,11 +530,11 @@ interface NormalizedLayoutStyle {
|
|
|
519
530
|
alignSelf: Align;
|
|
520
531
|
justifyContent: Justify;
|
|
521
532
|
gap: StyleUnit;
|
|
522
|
-
marginTop:
|
|
523
|
-
marginLeft:
|
|
524
|
-
marginRight:
|
|
525
|
-
marginBottom:
|
|
526
|
-
margin:
|
|
533
|
+
marginTop: WithStyleNone<StyleUnit | 'auto'>;
|
|
534
|
+
marginLeft: WithStyleNone<StyleUnit | 'auto'>;
|
|
535
|
+
marginRight: WithStyleNone<StyleUnit | 'auto'>;
|
|
536
|
+
marginBottom: WithStyleNone<StyleUnit | 'auto'>;
|
|
537
|
+
margin: WithStyleNone<StyleUnit | 'auto'>;
|
|
527
538
|
paddingTop: StyleUnit;
|
|
528
539
|
paddingLeft: StyleUnit;
|
|
529
540
|
paddingRight: StyleUnit;
|
|
@@ -540,29 +551,29 @@ interface NormalizedTransformStyle {
|
|
|
540
551
|
skewY: number;
|
|
541
552
|
translateX: number;
|
|
542
553
|
translateY: number;
|
|
543
|
-
transform:
|
|
554
|
+
transform: WithStyleNone<string>;
|
|
544
555
|
transformOrigin: string;
|
|
545
556
|
}
|
|
546
557
|
declare function getDefaultTransformStyle(): NormalizedTransformStyle;
|
|
547
558
|
|
|
548
559
|
type BackgroundSize = 'contain' | 'cover' | string | 'stretch' | 'rigid';
|
|
549
560
|
type NormalizedElementStyle = Partial<NormalizedLayoutStyle> & NormalizedTransformStyle & NormalizedShadowStyle & {
|
|
550
|
-
backgroundImage:
|
|
561
|
+
backgroundImage: WithStyleNone<string>;
|
|
551
562
|
backgroundSize: BackgroundSize;
|
|
552
|
-
backgroundColor:
|
|
553
|
-
backgroundColormap:
|
|
563
|
+
backgroundColor: WithStyleNone<NormalizedColor>;
|
|
564
|
+
backgroundColormap: WithStyleNone<Record<string, string>>;
|
|
554
565
|
borderRadius: number;
|
|
555
|
-
borderColor:
|
|
566
|
+
borderColor: WithStyleNone<NormalizedColor>;
|
|
556
567
|
borderStyle: BorderStyle;
|
|
557
568
|
outlineWidth: number;
|
|
558
569
|
outlineOffset: number;
|
|
559
|
-
outlineColor:
|
|
570
|
+
outlineColor: WithStyleNone<NormalizedColor>;
|
|
560
571
|
outlineStyle: string;
|
|
561
572
|
visibility: Visibility;
|
|
562
573
|
filter: string;
|
|
563
574
|
opacity: number;
|
|
564
575
|
pointerEvents: PointerEvents;
|
|
565
|
-
maskImage:
|
|
576
|
+
maskImage: WithStyleNone<string>;
|
|
566
577
|
};
|
|
567
578
|
declare function getDefaultElementStyle(): NormalizedElementStyle;
|
|
568
579
|
|
|
@@ -639,11 +650,11 @@ type NormalizedStyle = NormalizedTextStyle & NormalizedElementStyle & {
|
|
|
639
650
|
outline?: NormalizedOutline;
|
|
640
651
|
};
|
|
641
652
|
type StyleObject = Partial<NormalizedStyle> & {
|
|
642
|
-
color?:
|
|
643
|
-
backgroundColor?:
|
|
644
|
-
borderColor?:
|
|
645
|
-
outlineColor?:
|
|
646
|
-
shadowColor?:
|
|
653
|
+
color?: WithStyleNone<Color>;
|
|
654
|
+
backgroundColor?: WithStyleNone<Color>;
|
|
655
|
+
borderColor?: WithStyleNone<Color>;
|
|
656
|
+
outlineColor?: WithStyleNone<Color>;
|
|
657
|
+
shadowColor?: WithStyleNone<Color>;
|
|
647
658
|
fill?: Fill;
|
|
648
659
|
outline?: Outline;
|
|
649
660
|
};
|
|
@@ -720,5 +731,5 @@ declare function isNone<T>(value: T): value is Extract<T, null | undefined | 'no
|
|
|
720
731
|
declare function round(number: number, digits?: number, base?: number): number;
|
|
721
732
|
declare function clearUndef<T>(obj: T, deep?: boolean): T;
|
|
722
733
|
|
|
723
|
-
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 };
|
|
724
|
-
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, LinearGradientWithType, 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, RadialGradientWithType, 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 };
|
|
734
|
+
export { clearUndef, defaultColor, getDefaultElementStyle, getDefaultHighlightStyle, getDefaultInnerShadow, getDefaultLayoutStyle, getDefaultListStyleStyle, getDefaultOuterShadow, getDefaultShadowStyle, getDefaultStyle, getDefaultTextInlineStyle, getDefaultTextLineStyle, getDefaultTextStyle, getDefaultTransformStyle, isColor, isColorFill, isColorFillObject, isGradient, isGradientFill, isGradientFillObject, isImageFill, isImageFillObject, isNone, isPresetFill, isPresetFillObject, 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 };
|
|
735
|
+
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, ImageFill, ImageFillCropRect, ImageFillObject, ImageFillStretchRect, ImageFillTile, InnerShadow, InnerShadowObject, Justify, LabColor, LabaColor, LchColor, LchaColor, LineEndSize, LineEndType, LinearGradient, LinearGradientNode, LinearGradientWithType, 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, RadialGradientWithType, 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, WithStyleNone, WritingMode, XyzColor, XyzaColor };
|
package/dist/index.d.ts
CHANGED
|
@@ -273,12 +273,14 @@ interface ImageFillObject {
|
|
|
273
273
|
opacity?: number;
|
|
274
274
|
rotateWithShape?: boolean;
|
|
275
275
|
}
|
|
276
|
+
type ImageFill = string | ImageFillObject;
|
|
276
277
|
interface NormalizedImageFill extends ImageFillObject {
|
|
277
278
|
}
|
|
278
|
-
declare function normalizeImageFill(fill:
|
|
279
|
+
declare function normalizeImageFill(fill: ImageFill): NormalizedImageFill;
|
|
279
280
|
|
|
280
281
|
type None = undefined | null | 'none';
|
|
281
282
|
type WithNone<T> = T | None;
|
|
283
|
+
type WithStyleNone<T> = T | 'none';
|
|
282
284
|
|
|
283
285
|
interface PresetFillObject {
|
|
284
286
|
preset: string;
|
|
@@ -295,6 +297,14 @@ declare function normalizePresetFill(fill: PresetFill): NormalizedPresetFill;
|
|
|
295
297
|
type FillObject = Partial<ColorFillObject> & Partial<GradientFillObject> & Partial<ImageFillObject> & Partial<PresetFillObject>;
|
|
296
298
|
type Fill = string | FillObject;
|
|
297
299
|
type NormalizedFill = Partial<NormalizedColorFill> & Partial<NormalizedGradientFill> & Partial<NormalizedImageFill> & Partial<NormalizedPresetFill>;
|
|
300
|
+
declare function isColorFillObject(fill: FillObject): fill is ColorFillObject;
|
|
301
|
+
declare function isColorFill(fill: Fill): fill is ColorFill;
|
|
302
|
+
declare function isGradientFillObject(fill: FillObject): fill is GradientFillObject;
|
|
303
|
+
declare function isGradientFill(fill: Fill): fill is GradientFill;
|
|
304
|
+
declare function isImageFillObject(fill: FillObject): fill is ImageFillObject;
|
|
305
|
+
declare function isImageFill(fill: Fill): fill is ImageFill;
|
|
306
|
+
declare function isPresetFillObject(fill: FillObject): fill is PresetFillObject;
|
|
307
|
+
declare function isPresetFill(fill: Fill): fill is PresetFill;
|
|
298
308
|
declare function normalizeFill(fill: Fill): NormalizedFill;
|
|
299
309
|
|
|
300
310
|
interface NormalizedBaseBackground {
|
|
@@ -312,7 +322,7 @@ interface NormalizedInnerShadow {
|
|
|
312
322
|
blurRadius: number;
|
|
313
323
|
}
|
|
314
324
|
type InnerShadowObject = Partial<NormalizedInnerShadow> & {
|
|
315
|
-
color
|
|
325
|
+
color?: WithNone<Color>;
|
|
316
326
|
};
|
|
317
327
|
type InnerShadow = InnerShadowObject;
|
|
318
328
|
declare function getDefaultInnerShadow(): NormalizedInnerShadow;
|
|
@@ -390,7 +400,7 @@ interface NormalizedOutline extends NormalizedOutlineFill {
|
|
|
390
400
|
tailEnd?: TailEnd;
|
|
391
401
|
}
|
|
392
402
|
type OutlineObject = Partial<NormalizedOutline> & {
|
|
393
|
-
color
|
|
403
|
+
color?: WithNone<Color>;
|
|
394
404
|
};
|
|
395
405
|
type Outline = string | OutlineObject;
|
|
396
406
|
declare function normalizeOutline(outline: Outline): NormalizedOutline;
|
|
@@ -403,7 +413,7 @@ interface NormalizedShadow {
|
|
|
403
413
|
blur?: number;
|
|
404
414
|
}
|
|
405
415
|
type ShadowObject = Partial<NormalizedShadow> & {
|
|
406
|
-
color
|
|
416
|
+
color?: WithNone<Color>;
|
|
407
417
|
};
|
|
408
418
|
type Shadow = BoxShadow | ShadowObject;
|
|
409
419
|
declare function normalizeShadow(shadow: Shadow): NormalizedShadow;
|
|
@@ -446,6 +456,7 @@ interface ShapePath extends Partial<ShapePathStyle> {
|
|
|
446
456
|
interface NormalizedShape {
|
|
447
457
|
preset?: string;
|
|
448
458
|
viewBox?: number[];
|
|
459
|
+
svg?: string;
|
|
449
460
|
paths?: ShapePath[];
|
|
450
461
|
}
|
|
451
462
|
type Shape = SVGPathData | SVGPathData[] | ShapePath[] | NormalizedShape;
|
|
@@ -458,12 +469,12 @@ type Overflow = 'hidden' | 'visible';
|
|
|
458
469
|
type Visibility = 'hidden' | 'visible';
|
|
459
470
|
type FontWeight = 'normal' | 'bold' | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900;
|
|
460
471
|
type FontStyle = 'normal' | 'italic' | 'oblique' | `oblique ${string}`;
|
|
461
|
-
type FontKerning =
|
|
472
|
+
type FontKerning = WithStyleNone<'auto' | 'normal'>;
|
|
462
473
|
type TextWrap = 'wrap' | 'nowrap';
|
|
463
|
-
type TextAlign =
|
|
464
|
-
type TextTransform =
|
|
474
|
+
type TextAlign = WithStyleNone<'center' | 'end' | 'left' | 'right' | 'start' | 'justify'>;
|
|
475
|
+
type TextTransform = WithStyleNone<'uppercase' | 'lowercase'>;
|
|
465
476
|
type TextOrientation = 'mixed' | 'upright' | 'sideways-right' | 'sideways';
|
|
466
|
-
type TextDecoration =
|
|
477
|
+
type TextDecoration = WithStyleNone<'underline' | 'line-through' | 'overline'>;
|
|
467
478
|
type VerticalAlign = 'baseline' | 'top' | 'middle' | 'bottom' | 'sub' | 'super' | 'text-top' | 'text-bottom';
|
|
468
479
|
type WritingMode = 'horizontal-tb' | 'vertical-lr' | 'vertical-rl';
|
|
469
480
|
type Align = 'auto' | 'flex-start' | 'center' | 'flex-end' | 'stretch' | 'baseline' | 'space-between' | 'space-around' | 'space-evenly';
|
|
@@ -471,18 +482,18 @@ type FlexDirection = 'column' | 'column-reverse' | 'row' | 'row-reverse';
|
|
|
471
482
|
type FlexWrap = 'nowrap' | 'wrap' | 'Wrap-reverse';
|
|
472
483
|
type Justify = 'flex-start' | 'center' | 'flex-end' | 'space-between' | 'space-around' | 'space-evenly';
|
|
473
484
|
type Position = 'static' | 'relative' | 'absolute';
|
|
474
|
-
type BorderStyle =
|
|
485
|
+
type BorderStyle = WithStyleNone<'dashed' | 'solid'>;
|
|
475
486
|
type BoxSizing = 'border-box' | 'content-box';
|
|
476
487
|
type PointerEvents = 'auto' | 'none';
|
|
477
|
-
type ListStyleType =
|
|
478
|
-
type ListStyleImage =
|
|
479
|
-
type ListStyleColormap =
|
|
488
|
+
type ListStyleType = WithStyleNone<'disc'>;
|
|
489
|
+
type ListStyleImage = WithStyleNone<string>;
|
|
490
|
+
type ListStyleColormap = WithStyleNone<Record<string, string>>;
|
|
480
491
|
type ListStyleSize = StyleUnit | `${number}rem` | 'cover';
|
|
481
492
|
type ListStylePosition = 'inside' | 'outside';
|
|
482
493
|
type HighlightLine = TextDecoration | 'outline';
|
|
483
|
-
type HighlightImage =
|
|
484
|
-
type HighlightReferImage =
|
|
485
|
-
type HighlightColormap =
|
|
494
|
+
type HighlightImage = WithStyleNone<string>;
|
|
495
|
+
type HighlightReferImage = WithStyleNone<string>;
|
|
496
|
+
type HighlightColormap = WithStyleNone<Record<string, string>>;
|
|
486
497
|
type HighlightSize = StyleUnit | `${number}rem` | 'cover';
|
|
487
498
|
type HighlightThickness = StyleUnit;
|
|
488
499
|
|
|
@@ -519,11 +530,11 @@ interface NormalizedLayoutStyle {
|
|
|
519
530
|
alignSelf: Align;
|
|
520
531
|
justifyContent: Justify;
|
|
521
532
|
gap: StyleUnit;
|
|
522
|
-
marginTop:
|
|
523
|
-
marginLeft:
|
|
524
|
-
marginRight:
|
|
525
|
-
marginBottom:
|
|
526
|
-
margin:
|
|
533
|
+
marginTop: WithStyleNone<StyleUnit | 'auto'>;
|
|
534
|
+
marginLeft: WithStyleNone<StyleUnit | 'auto'>;
|
|
535
|
+
marginRight: WithStyleNone<StyleUnit | 'auto'>;
|
|
536
|
+
marginBottom: WithStyleNone<StyleUnit | 'auto'>;
|
|
537
|
+
margin: WithStyleNone<StyleUnit | 'auto'>;
|
|
527
538
|
paddingTop: StyleUnit;
|
|
528
539
|
paddingLeft: StyleUnit;
|
|
529
540
|
paddingRight: StyleUnit;
|
|
@@ -540,29 +551,29 @@ interface NormalizedTransformStyle {
|
|
|
540
551
|
skewY: number;
|
|
541
552
|
translateX: number;
|
|
542
553
|
translateY: number;
|
|
543
|
-
transform:
|
|
554
|
+
transform: WithStyleNone<string>;
|
|
544
555
|
transformOrigin: string;
|
|
545
556
|
}
|
|
546
557
|
declare function getDefaultTransformStyle(): NormalizedTransformStyle;
|
|
547
558
|
|
|
548
559
|
type BackgroundSize = 'contain' | 'cover' | string | 'stretch' | 'rigid';
|
|
549
560
|
type NormalizedElementStyle = Partial<NormalizedLayoutStyle> & NormalizedTransformStyle & NormalizedShadowStyle & {
|
|
550
|
-
backgroundImage:
|
|
561
|
+
backgroundImage: WithStyleNone<string>;
|
|
551
562
|
backgroundSize: BackgroundSize;
|
|
552
|
-
backgroundColor:
|
|
553
|
-
backgroundColormap:
|
|
563
|
+
backgroundColor: WithStyleNone<NormalizedColor>;
|
|
564
|
+
backgroundColormap: WithStyleNone<Record<string, string>>;
|
|
554
565
|
borderRadius: number;
|
|
555
|
-
borderColor:
|
|
566
|
+
borderColor: WithStyleNone<NormalizedColor>;
|
|
556
567
|
borderStyle: BorderStyle;
|
|
557
568
|
outlineWidth: number;
|
|
558
569
|
outlineOffset: number;
|
|
559
|
-
outlineColor:
|
|
570
|
+
outlineColor: WithStyleNone<NormalizedColor>;
|
|
560
571
|
outlineStyle: string;
|
|
561
572
|
visibility: Visibility;
|
|
562
573
|
filter: string;
|
|
563
574
|
opacity: number;
|
|
564
575
|
pointerEvents: PointerEvents;
|
|
565
|
-
maskImage:
|
|
576
|
+
maskImage: WithStyleNone<string>;
|
|
566
577
|
};
|
|
567
578
|
declare function getDefaultElementStyle(): NormalizedElementStyle;
|
|
568
579
|
|
|
@@ -639,11 +650,11 @@ type NormalizedStyle = NormalizedTextStyle & NormalizedElementStyle & {
|
|
|
639
650
|
outline?: NormalizedOutline;
|
|
640
651
|
};
|
|
641
652
|
type StyleObject = Partial<NormalizedStyle> & {
|
|
642
|
-
color?:
|
|
643
|
-
backgroundColor?:
|
|
644
|
-
borderColor?:
|
|
645
|
-
outlineColor?:
|
|
646
|
-
shadowColor?:
|
|
653
|
+
color?: WithStyleNone<Color>;
|
|
654
|
+
backgroundColor?: WithStyleNone<Color>;
|
|
655
|
+
borderColor?: WithStyleNone<Color>;
|
|
656
|
+
outlineColor?: WithStyleNone<Color>;
|
|
657
|
+
shadowColor?: WithStyleNone<Color>;
|
|
647
658
|
fill?: Fill;
|
|
648
659
|
outline?: Outline;
|
|
649
660
|
};
|
|
@@ -720,5 +731,5 @@ declare function isNone<T>(value: T): value is Extract<T, null | undefined | 'no
|
|
|
720
731
|
declare function round(number: number, digits?: number, base?: number): number;
|
|
721
732
|
declare function clearUndef<T>(obj: T, deep?: boolean): T;
|
|
722
733
|
|
|
723
|
-
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 };
|
|
724
|
-
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, LinearGradientWithType, 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, RadialGradientWithType, 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 };
|
|
734
|
+
export { clearUndef, defaultColor, getDefaultElementStyle, getDefaultHighlightStyle, getDefaultInnerShadow, getDefaultLayoutStyle, getDefaultListStyleStyle, getDefaultOuterShadow, getDefaultShadowStyle, getDefaultStyle, getDefaultTextInlineStyle, getDefaultTextLineStyle, getDefaultTextStyle, getDefaultTransformStyle, isColor, isColorFill, isColorFillObject, isGradient, isGradientFill, isGradientFillObject, isImageFill, isImageFillObject, isNone, isPresetFill, isPresetFillObject, 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 };
|
|
735
|
+
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, ImageFill, ImageFillCropRect, ImageFillObject, ImageFillStretchRect, ImageFillTile, InnerShadow, InnerShadowObject, Justify, LabColor, LabaColor, LchColor, LchaColor, LineEndSize, LineEndType, LinearGradient, LinearGradientNode, LinearGradientWithType, 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, RadialGradientWithType, 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, WithStyleNone, WritingMode, XyzColor, XyzaColor };
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(a,k){typeof exports=="object"&&typeof module<"u"?k(exports):typeof define=="function"&&define.amd?define(["exports"],k):(a=typeof globalThis<"u"?globalThis:a||self,k(a.modernIdoc={}))})(this,function(a){"use strict";function k(t){return typeof t=="string"?{src:t}:t}var Wt={grad:.9,turn:360,rad:360/(2*Math.PI)},S=function(t){return typeof t=="string"?t.length>0:typeof t=="number"},h=function(t,e,r){return e===void 0&&(e=0),r===void 0&&(r=Math.pow(10,e)),Math.round(r*t)/r+0},b=function(t,e,r){return e===void 0&&(e=0),r===void 0&&(r=1),t>r?r:t>e?t:e},Z=function(t){return(t=isFinite(t)?t%360:0)>0?t:t+360},tt=function(t){return{r:b(t.r,0,255),g:b(t.g,0,255),b:b(t.b,0,255),a:b(t.a)}},H=function(t){return{r:h(t.r),g:h(t.g),b:h(t.b),a:h(t.a,3)}},Mt=/^#([0-9a-f]{3,8})$/i,E=function(t){var e=t.toString(16);return e.length<2?"0"+e:e},et=function(t){var e=t.r,r=t.g,n=t.b,o=t.a,l=Math.max(e,r,n),c=l-Math.min(e,r,n),d=c?l===e?(r-n)/c:l===r?2+(n-e)/c:4+(e-r)/c:0;return{h:60*(d<0?d+6:d),s:l?c/l*100:0,v:l/255*100,a:o}},rt=function(t){var e=t.h,r=t.s,n=t.v,o=t.a;e=e/360*6,r/=100,n/=100;var l=Math.floor(e),c=n*(1-r),d=n*(1-(e-l)*r),D=n*(1-(1-e+l)*r),x=l%6;return{r:255*[n,d,c,c,D,n][x],g:255*[D,n,n,d,c,c][x],b:255*[c,c,D,n,n,d][x],a:o}},nt=function(t){return{h:Z(t.h),s:b(t.s,0,100),l:b(t.l,0,100),a:b(t.a)}},it=function(t){return{h:h(t.h),s:h(t.s),l:h(t.l),a:h(t.a,3)}},ot=function(t){return rt((r=(e=t).s,{h:e.h,s:(r*=((n=e.l)<50?n:100-n)/100)>0?2*r/(n+r)*100:0,v:n+r,a:e.a}));var e,r,n},G=function(t){return{h:(e=et(t)).h,s:(o=(200-(r=e.s))*(n=e.v)/100)>0&&o<200?r*n/100/(o<=100?o:200-o)*100:0,l:o/2,a:e.a};var e,r,n,o},Rt=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,$t=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Pt=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Bt=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,at={string:[[function(t){var e=Mt.exec(t);return e?(t=e[1]).length<=4?{r:parseInt(t[0]+t[0],16),g:parseInt(t[1]+t[1],16),b:parseInt(t[2]+t[2],16),a:t.length===4?h(parseInt(t[3]+t[3],16)/255,2):1}:t.length===6||t.length===8?{r:parseInt(t.substr(0,2),16),g:parseInt(t.substr(2,2),16),b:parseInt(t.substr(4,2),16),a:t.length===8?h(parseInt(t.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(t){var e=Pt.exec(t)||Bt.exec(t);return e?e[2]!==e[4]||e[4]!==e[6]?null:tt({r:Number(e[1])/(e[2]?100/255:1),g:Number(e[3])/(e[4]?100/255:1),b:Number(e[5])/(e[6]?100/255:1),a:e[7]===void 0?1:Number(e[7])/(e[8]?100:1)}):null},"rgb"],[function(t){var e=Rt.exec(t)||$t.exec(t);if(!e)return null;var r,n,o=nt({h:(r=e[1],n=e[2],n===void 0&&(n="deg"),Number(r)*(Wt[n]||1)),s:Number(e[3]),l:Number(e[4]),a:e[5]===void 0?1:Number(e[5])/(e[6]?100:1)});return ot(o)},"hsl"]],object:[[function(t){var e=t.r,r=t.g,n=t.b,o=t.a,l=o===void 0?1:o;return S(e)&&S(r)&&S(n)?tt({r:Number(e),g:Number(r),b:Number(n),a:Number(l)}):null},"rgb"],[function(t){var e=t.h,r=t.s,n=t.l,o=t.a,l=o===void 0?1:o;if(!S(e)||!S(r)||!S(n))return null;var c=nt({h:Number(e),s:Number(r),l:Number(n),a:Number(l)});return ot(c)},"hsl"],[function(t){var e=t.h,r=t.s,n=t.v,o=t.a,l=o===void 0?1:o;if(!S(e)||!S(r)||!S(n))return null;var c=function(d){return{h:Z(d.h),s:b(d.s,0,100),v:b(d.v,0,100),a:b(d.a)}}({h:Number(e),s:Number(r),v:Number(n),a:Number(l)});return rt(c)},"hsv"]]},ut=function(t,e){for(var r=0;r<e.length;r++){var n=e[r][0](t);if(n)return[n,e[r][1]]}return[null,void 0]},jt=function(t){return typeof t=="string"?ut(t.trim(),at.string):typeof t=="object"&&t!==null?ut(t,at.object):[null,void 0]},W=function(t,e){var r=G(t);return{h:r.h,s:b(r.s+100*e,0,100),l:r.l,a:r.a}},M=function(t){return(299*t.r+587*t.g+114*t.b)/1e3/255},lt=function(t,e){var r=G(t);return{h:r.h,s:r.s,l:b(r.l+100*e,0,100),a:r.a}},st=function(){function t(e){this.parsed=jt(e)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return t.prototype.isValid=function(){return this.parsed!==null},t.prototype.brightness=function(){return h(M(this.rgba),2)},t.prototype.isDark=function(){return M(this.rgba)<.5},t.prototype.isLight=function(){return M(this.rgba)>=.5},t.prototype.toHex=function(){return e=H(this.rgba),r=e.r,n=e.g,o=e.b,c=(l=e.a)<1?E(h(255*l)):"","#"+E(r)+E(n)+E(o)+c;var e,r,n,o,l,c},t.prototype.toRgb=function(){return H(this.rgba)},t.prototype.toRgbString=function(){return e=H(this.rgba),r=e.r,n=e.g,o=e.b,(l=e.a)<1?"rgba("+r+", "+n+", "+o+", "+l+")":"rgb("+r+", "+n+", "+o+")";var e,r,n,o,l},t.prototype.toHsl=function(){return it(G(this.rgba))},t.prototype.toHslString=function(){return e=it(G(this.rgba)),r=e.h,n=e.s,o=e.l,(l=e.a)<1?"hsla("+r+", "+n+"%, "+o+"%, "+l+")":"hsl("+r+", "+n+"%, "+o+"%)";var e,r,n,o,l},t.prototype.toHsv=function(){return e=et(this.rgba),{h:h(e.h),s:h(e.s),v:h(e.v),a:h(e.a,3)};var e},t.prototype.invert=function(){return y({r:255-(e=this.rgba).r,g:255-e.g,b:255-e.b,a:e.a});var e},t.prototype.saturate=function(e){return e===void 0&&(e=.1),y(W(this.rgba,e))},t.prototype.desaturate=function(e){return e===void 0&&(e=.1),y(W(this.rgba,-e))},t.prototype.grayscale=function(){return y(W(this.rgba,-1))},t.prototype.lighten=function(e){return e===void 0&&(e=.1),y(lt(this.rgba,e))},t.prototype.darken=function(e){return e===void 0&&(e=.1),y(lt(this.rgba,-e))},t.prototype.rotate=function(e){return e===void 0&&(e=15),this.hue(this.hue()+e)},t.prototype.alpha=function(e){return typeof e=="number"?y({r:(r=this.rgba).r,g:r.g,b:r.b,a:e}):h(this.rgba.a,3);var r},t.prototype.hue=function(e){var r=G(this.rgba);return typeof e=="number"?y({h:e,s:r.s,l:r.l,a:r.a}):h(r.h)},t.prototype.isEqual=function(e){return this.toHex()===y(e).toHex()},t}(),y=function(t){return t instanceof st?t:new st(t)};function f(t){return t==null||t==="none"}function C(t,e=0,r=10**e){return Math.round(r*t)/r+0}function w(t,e=!1){if(typeof t!="object"||!t)return t;if(Array.isArray(t))return e?t.map(n=>w(n,e)):t;const r={};for(const n in t){const o=t[n];o!=null&&(e?r[n]=w(o,e):r[n]=o)}return r}function R(t){let e;return typeof t=="number"?e={r:t>>24&255,g:t>>16&255,b:t>>8&255,a:(t&255)/255}:e=t,y(e)}function Kt(t){return{r:C(t.r),g:C(t.g),b:C(t.b),a:C(t.a,3)}}function V(t){const e=t.toString(16);return e.length<2?`0${e}`:e}const I="#000000FF";function ct(t){return R(t).isValid()}function v(t,e=!1){const r=R(t);if(!r.isValid()){if(typeof t=="string")return t;const d=`Failed to normalizeColor ${t}`;if(e)throw new Error(d);return console.warn(d),I}const{r:n,g:o,b:l,a:c}=Kt(r.rgba);return`#${V(n)}${V(o)}${V(l)}${V(C(c*255))}`}var O=O||{};O.parse=function(){const t={linearGradient:/^(-(webkit|o|ms|moz)-)?(linear-gradient)/i,repeatingLinearGradient:/^(-(webkit|o|ms|moz)-)?(repeating-linear-gradient)/i,radialGradient:/^(-(webkit|o|ms|moz)-)?(radial-gradient)/i,repeatingRadialGradient:/^(-(webkit|o|ms|moz)-)?(repeating-radial-gradient)/i,sideOrCorner:/^to (left (top|bottom)|right (top|bottom)|top (left|right)|bottom (left|right)|left|right|top|bottom)/i,extentKeywords:/^(closest-side|closest-corner|farthest-side|farthest-corner|contain|cover)/,positionKeywords:/^(left|center|right|top|bottom)/i,pixelValue:/^(-?((\d*\.\d+)|(\d+\.?)))px/,percentageValue:/^(-?((\d*\.\d+)|(\d+\.?)))%/,emValue:/^(-?((\d*\.\d+)|(\d+\.?)))em/,angleValue:/^(-?((\d*\.\d+)|(\d+\.?)))deg/,radianValue:/^(-?((\d*\.\d+)|(\d+\.?)))rad/,startCall:/^\(/,endCall:/^\)/,comma:/^,/,hexColor:/^#([0-9a-f]+)/i,literalColor:/^([a-z]+)/i,rgbColor:/^rgb/i,rgbaColor:/^rgba/i,varColor:/^var/i,calcValue:/^calc/i,variableName:/^(--[a-z0-9-,\s#]+)/i,number:/^((\d*\.\d+)|(\d+\.?))/,hslColor:/^hsl/i,hslaColor:/^hsla/i};let e="";function r(i){const u=new Error(`${e}: ${i}`);throw u.source=e,u}function n(){const i=o();return e.length>0&&r("Invalid input not EOF"),i}function o(){return A(l)}function l(){return c("linear-gradient",t.linearGradient,D)||c("repeating-linear-gradient",t.repeatingLinearGradient,D)||c("radial-gradient",t.radialGradient,At)||c("repeating-radial-gradient",t.repeatingRadialGradient,At)}function c(i,u,s){return d(u,m=>{const z=s();return z&&(g(t.comma)||r("Missing comma before color stops")),{type:i,orientation:z,colorStops:A(re)}})}function d(i,u){const s=g(i);if(s){g(t.startCall)||r("Missing (");const m=u(s);return g(t.endCall)||r("Missing )"),m}}function D(){const i=x();if(i)return i;const u=p("position-keyword",t.positionKeywords,1);return u?{type:"directional",value:u.value}:Qt()}function x(){return p("directional",t.sideOrCorner,1)}function Qt(){return p("angular",t.angleValue,1)||p("angular",t.radianValue,1)}function At(){let i,u=Ft(),s;return u&&(i=[],i.push(u),s=e,g(t.comma)&&(u=Ft(),u?i.push(u):e=s)),i}function Ft(){let i=Zt()||te();if(i)i.at=q();else{const u=U();if(u){i=u;const s=q();s&&(i.at=s)}else{const s=q();if(s)i={type:"default-radial",at:s};else{const m=J();m&&(i={type:"default-radial",at:m})}}}return i}function Zt(){const i=p("shape",/^(circle)/i,0);return i&&(i.style=Ht()||U()),i}function te(){const i=p("shape",/^(ellipse)/i,0);return i&&(i.style=J()||F()||U()),i}function U(){return p("extent-keyword",t.extentKeywords,1)}function q(){if(p("position",/^at/,0)){const i=J();return i||r("Missing positioning value"),i}}function J(){const i=ee();if(i.x||i.y)return{type:"position",value:i}}function ee(){return{x:F(),y:F()}}function A(i){let u=i();const s=[];if(u)for(s.push(u);g(t.comma);)u=i(),u?s.push(u):r("One extra comma");return s}function re(){const i=ne();return i||r("Expected color definition"),i.length=F(),i}function ne(){return oe()||ce()||se()||ue()||ae()||le()||ie()}function ie(){return p("literal",t.literalColor,0)}function oe(){return p("hex",t.hexColor,1)}function ae(){return d(t.rgbColor,()=>({type:"rgb",value:A(L)}))}function ue(){return d(t.rgbaColor,()=>({type:"rgba",value:A(L)}))}function le(){return d(t.varColor,()=>({type:"var",value:fe()}))}function se(){return d(t.hslColor,()=>{g(t.percentageValue)&&r("HSL hue value must be a number in degrees (0-360) or normalized (-360 to 360), not a percentage");const u=L();g(t.comma);let s=g(t.percentageValue);const m=s?s[1]:null;g(t.comma),s=g(t.percentageValue);const z=s?s[1]:null;return(!m||!z)&&r("Expected percentage value for saturation and lightness in HSL"),{type:"hsl",value:[u,m,z]}})}function ce(){return d(t.hslaColor,()=>{const i=L();g(t.comma);let u=g(t.percentageValue);const s=u?u[1]:null;g(t.comma),u=g(t.percentageValue);const m=u?u[1]:null;g(t.comma);const z=L();return(!s||!m)&&r("Expected percentage value for saturation and lightness in HSLA"),{type:"hsla",value:[i,s,m,z]}})}function fe(){return g(t.variableName)[1]}function L(){return g(t.number)[1]}function F(){return p("%",t.percentageValue,1)||de()||ge()||Ht()}function de(){return p("position-keyword",t.positionKeywords,1)}function ge(){return d(t.calcValue,()=>{let i=1,u=0;for(;i>0&&u<e.length;){const m=e.charAt(u);m==="("?i++:m===")"&&i--,u++}i>0&&r("Missing closing parenthesis in calc() expression");const s=e.substring(0,u-1);return Q(u-1),{type:"calc",value:s}})}function Ht(){return p("px",t.pixelValue,1)||p("em",t.emValue,1)}function p(i,u,s){const m=g(u);if(m)return{type:i,value:m[s]}}function g(i){let u,s;return s=/^\s+/.exec(e),s&&Q(s[0].length),u=i.exec(e),u&&Q(u[0].length),u}function Q(i){e=e.substr(i)}return function(i){return e=i.toString().trim(),e.endsWith(";")&&(e=e.slice(0,-1)),n()}}();const ft=O.parse.bind(O);var T=T||{};T.stringify=function(){var t={"visit_linear-gradient":function(e){return t.visit_gradient(e)},"visit_repeating-linear-gradient":function(e){return t.visit_gradient(e)},"visit_radial-gradient":function(e){return t.visit_gradient(e)},"visit_repeating-radial-gradient":function(e){return t.visit_gradient(e)},visit_gradient:function(e){var r=t.visit(e.orientation);return r&&(r+=", "),e.type+"("+r+t.visit(e.colorStops)+")"},visit_shape:function(e){var r=e.value,n=t.visit(e.at),o=t.visit(e.style);return o&&(r+=" "+o),n&&(r+=" at "+n),r},"visit_default-radial":function(e){var r="",n=t.visit(e.at);return n&&(r+=n),r},"visit_extent-keyword":function(e){var r=e.value,n=t.visit(e.at);return n&&(r+=" at "+n),r},"visit_position-keyword":function(e){return e.value},visit_position:function(e){return t.visit(e.value.x)+" "+t.visit(e.value.y)},"visit_%":function(e){return e.value+"%"},visit_em:function(e){return e.value+"em"},visit_px:function(e){return e.value+"px"},visit_calc:function(e){return"calc("+e.value+")"},visit_literal:function(e){return t.visit_color(e.value,e)},visit_hex:function(e){return t.visit_color("#"+e.value,e)},visit_rgb:function(e){return t.visit_color("rgb("+e.value.join(", ")+")",e)},visit_rgba:function(e){return t.visit_color("rgba("+e.value.join(", ")+")",e)},visit_hsl:function(e){return t.visit_color("hsl("+e.value[0]+", "+e.value[1]+"%, "+e.value[2]+"%)",e)},visit_hsla:function(e){return t.visit_color("hsla("+e.value[0]+", "+e.value[1]+"%, "+e.value[2]+"%, "+e.value[3]+")",e)},visit_var:function(e){return t.visit_color("var("+e.value+")",e)},visit_color:function(e,r){var n=e,o=t.visit(r.length);return o&&(n+=" "+o),n},visit_angular:function(e){return e.value+"deg"},visit_directional:function(e){return"to "+e.value},visit_array:function(e){var r="",n=e.length;return e.forEach(function(o,l){r+=t.visit(o),l<n-1&&(r+=", ")}),r},visit_object:function(e){return e.width&&e.height?t.visit(e.width)+" "+t.visit(e.height):""},visit:function(e){if(!e)return"";if(e instanceof Array)return t.visit_array(e);if(typeof e=="object"&&!e.type)return t.visit_object(e);if(e.type){var r=t["visit_"+e.type];if(r)return r(e);throw Error("Missing visitor visit_"+e.type)}else throw Error("Invalid node.")}};return function(e){return t.visit(e)}}();const Xt=T.stringify.bind(T);function dt(t){const e=t.length-1;return t.map((r,n)=>{var d;const o=r.value;let l=C(n/e,3),c="#00000000";switch(r.type){case"rgb":c=v({r:Number(o[0]??0),g:Number(o[1]??0),b:Number(o[2]??0)});break;case"rgba":c=v({r:Number(o[0]??0),g:Number(o[1]??0),b:Number(o[2]??0),a:Number(o[3]??0)});break;case"literal":c=v(r.value);break;case"hex":c=v(`#${r.value}`);break}switch((d=r.length)==null?void 0:d.type){case"%":l=Number(r.length.value)/100;break}return{offset:l,color:c}})}function gt(t){var r;let e=0;switch((r=t.orientation)==null?void 0:r.type){case"angular":e=Number(t.orientation.value);break}return{type:"linear-gradient",angle:e,stops:dt(t.colorStops)}}function ht(t){var e;return(e=t.orientation)==null||e.map(r=>{switch(r==null?void 0:r.type){case"shape":case"default-radial":case"extent-keyword":default:return null}}),{type:"radial-gradient",stops:dt(t.colorStops)}}function $(t){return t.startsWith("linear-gradient")||t.startsWith("radial-gradient")}function vt(t){return ft(t).map(e=>{switch(e==null?void 0:e.type){case"linear-gradient":return gt(e);case"repeating-linear-gradient":return{...gt(e),repeat:!0};case"radial-gradient":return ht(e);case"repeating-radial-gradient":return{...ht(e),repeat:!0};default:return}}).filter(Boolean)}function P(t){let e;return typeof t=="string"?e={color:t}:e=t,{color:v(e.color)}}function B(t){let e;typeof t=="string"?e={image:t}:e=t;const{type:r,...n}=vt(e.image)[0]??{};switch(r){case"radial-gradient":return{radialGradient:n};case"linear-gradient":return{linearGradient:n}}return{}}function Yt(t){return t}function mt(t){let e;return typeof t=="string"?e={preset:t}:e=t,{preset:e.preset,foregroundColor:f(e.foregroundColor)?void 0:v(e.foregroundColor),backgroundColor:f(e.backgroundColor)?void 0:v(e.backgroundColor)}}function _(t){if(typeof t=="string")return ct(t)?P({color:t}):$(t)?B({image:t}):{image:t};if(f(t.color))if(f(t.image)){if(f(t.preset))return mt(t)}else return $(t.image)?B(t):t;else return P(t);throw new Error("Unknown fill property object")}function pt(t){return typeof t=="string"?{..._(t),fillWithShape:!1}:{..._(t),fillWithShape:!!t.fillWithShape}}function j(){return{color:I,offsetX:0,offsetY:0,blurRadius:1}}function K(t){return{...j(),...w({...t,color:f(t.color)?I:v(t.color)})}}function bt(){return{...j(),scaleX:1,scaleY:1}}function yt(t){return{...bt(),...K(t)}}function Ut(t){return t}function St(t){return w({...t,softEdge:f(t.softEdge)?void 0:t.softEdge,outerShadow:f(t.outerShadow)?void 0:yt(t.outerShadow),innerShadow:f(t.innerShadow)?void 0:K(t.innerShadow)})}function Ct(t){return typeof t=="string"?{..._(t),fillWithShape:!1}:{..._(t),fillWithShape:!!t.fillWithShape}}function wt(t){return typeof t=="string"?{color:v(t)}:{...t,color:f(t.color)?void 0:v(t.color)}}function zt(t){return typeof t=="string"?{color:v(t)}:{...t,color:f(t.color)?I:v(t.color)}}function kt(){return{boxShadow:"none"}}function _t(t){return typeof t=="string"?{paths:[{data:t}]}:Array.isArray(t)?{paths:t.map(e=>typeof e=="string"?{data:e}:e)}:t}function Nt(){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 Dt(){return{rotate:0,scaleX:1,scaleY:1,skewX:0,skewY:0,translateX:0,translateY:0,transform:"none",transformOrigin:"center"}}function Gt(){return{...Nt(),...Dt(),...kt(),backgroundImage:"none",backgroundSize:"auto, auto",backgroundColor:"none",backgroundColormap:"none",borderRadius:0,borderColor:"none",borderStyle:"solid",outlineWidth:0,outlineOffset:0,outlineColor:"rgb(0, 0, 0)",outlineStyle:"none",visibility:"visible",filter:"none",opacity:1,pointerEvents:"auto",maskImage:"none"}}function It(){return{highlight:{},highlightImage:"none",highlightReferImage:"none",highlightColormap:"none",highlightLine:"none",highlightSize:"cover",highlightThickness:"100%"}}function xt(){return{listStyle:{},listStyleType:"none",listStyleImage:"none",listStyleColormap:"none",listStyleSize:"cover",listStylePosition:"outside"}}function Lt(){return{...It(),color:"rgb(0, 0, 0)",verticalAlign:"baseline",letterSpacing:0,wordSpacing:0,fontSize:14,fontWeight:"normal",fontFamily:"",fontStyle:"normal",fontKerning:"normal",textTransform:"none",textOrientation:"mixed",textDecoration:"none"}}function Et(){return{...xt(),writingMode:"horizontal-tb",textWrap:"wrap",textAlign:"start",textIndent:0,lineHeight:1.2}}function Vt(){return{...Et(),...Lt(),textStrokeWidth:0,textStrokeColor:"rgb(0, 0, 0)"}}function N(t){return w({...t,color:f(t.color)?void 0:v(t.color),backgroundColor:f(t.backgroundColor)?void 0:v(t.backgroundColor),borderColor:f(t.borderColor)?void 0:v(t.borderColor),outlineColor:f(t.outlineColor)?void 0:v(t.outlineColor),shadowColor:f(t.shadowColor)?void 0:v(t.shadowColor)})}function qt(){return{...Gt(),...Vt()}}function X(t=""){return(Array.isArray(t)?t:[t]).map(r=>typeof r=="string"?{fragments:[{content:r}]}:"content"in r?{fragments:[N(r)]}:"fragments"in r?{...N(r),fragments:r.fragments.map(n=>N(n))}:Array.isArray(r)?{fragments:r.map(n=>typeof n=="string"?{content:n}:N(n))}:{fragments:[]})}function Ot(t){return typeof t=="string"?{content:[{fragments:[{content:t}]}]}:"content"in t?{...t,content:X(t.content)}:{content:X(t)}}function Tt(t){return typeof t=="string"?{src:t}:t}function Y(t){var e;return w({...t,style:f(t.style)?void 0:N(t.style),text:f(t.text)?void 0:Ot(t.text),background:f(t.background)?void 0:pt(t.background),shape:f(t.shape)?void 0:_t(t.shape),fill:f(t.fill)?void 0:_(t.fill),outline:f(t.outline)?void 0:wt(t.outline),foreground:f(t.foreground)?void 0:Ct(t.foreground),shadow:f(t.shadow)?void 0:zt(t.shadow),video:f(t.video)?void 0:Tt(t.video),audio:f(t.audio)?void 0:k(t.audio),effect:f(t.effect)?void 0:St(t.effect),children:(e=t.children)==null?void 0:e.map(r=>Y(r))})}function Jt(t){return Y(t)}a.clearUndef=w,a.defaultColor=I,a.getDefaultElementStyle=Gt,a.getDefaultHighlightStyle=It,a.getDefaultInnerShadow=j,a.getDefaultLayoutStyle=Nt,a.getDefaultListStyleStyle=xt,a.getDefaultOuterShadow=bt,a.getDefaultShadowStyle=kt,a.getDefaultStyle=qt,a.getDefaultTextInlineStyle=Lt,a.getDefaultTextLineStyle=Et,a.getDefaultTextStyle=Vt,a.getDefaultTransformStyle=Dt,a.isColor=ct,a.isGradient=$,a.isNone=f,a.normalizeAudio=k,a.normalizeBackground=pt,a.normalizeColor=v,a.normalizeColorFill=P,a.normalizeDocument=Jt,a.normalizeEffect=St,a.normalizeElement=Y,a.normalizeFill=_,a.normalizeForeground=Ct,a.normalizeGradient=vt,a.normalizeGradientFill=B,a.normalizeImageFill=Yt,a.normalizeInnerShadow=K,a.normalizeOuterShadow=yt,a.normalizeOutline=wt,a.normalizePresetFill=mt,a.normalizeShadow=zt,a.normalizeShape=_t,a.normalizeSoftEdge=Ut,a.normalizeStyle=N,a.normalizeText=Ot,a.normalizeTextContent=X,a.normalizeVideo=Tt,a.parseColor=R,a.parseGradient=ft,a.round=C,a.stringifyGradient=Xt,Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})});
|
|
1
|
+
(function(o,k){typeof exports=="object"&&typeof module<"u"?k(exports):typeof define=="function"&&define.amd?define(["exports"],k):(o=typeof globalThis<"u"?globalThis:o||self,k(o.modernIdoc={}))})(this,function(o){"use strict";function k(t){return typeof t=="string"?{src:t}:t}var Yt={grad:.9,turn:360,rad:360/(2*Math.PI)},S=function(t){return typeof t=="string"?t.length>0:typeof t=="number"},h=function(t,e,r){return e===void 0&&(e=0),r===void 0&&(r=Math.pow(10,e)),Math.round(r*t)/r+0},b=function(t,e,r){return e===void 0&&(e=0),r===void 0&&(r=1),t>r?r:t>e?t:e},J=function(t){return(t=isFinite(t)?t%360:0)>0?t:t+360},Q=function(t){return{r:b(t.r,0,255),g:b(t.g,0,255),b:b(t.b,0,255),a:b(t.a)}},W=function(t){return{r:h(t.r),g:h(t.g),b:h(t.b),a:h(t.a,3)}},Ut=/^#([0-9a-f]{3,8})$/i,E=function(t){var e=t.toString(16);return e.length<2?"0"+e:e},Z=function(t){var e=t.r,r=t.g,n=t.b,a=t.a,l=Math.max(e,r,n),c=l-Math.min(e,r,n),d=c?l===e?(r-n)/c:l===r?2+(n-e)/c:4+(e-r)/c:0;return{h:60*(d<0?d+6:d),s:l?c/l*100:0,v:l/255*100,a}},tt=function(t){var e=t.h,r=t.s,n=t.v,a=t.a;e=e/360*6,r/=100,n/=100;var l=Math.floor(e),c=n*(1-r),d=n*(1-(e-l)*r),F=n*(1-(1-e+l)*r),O=l%6;return{r:255*[n,d,c,c,F,n][O],g:255*[F,n,n,d,c,c][O],b:255*[c,c,F,n,n,d][O],a}},et=function(t){return{h:J(t.h),s:b(t.s,0,100),l:b(t.l,0,100),a:b(t.a)}},rt=function(t){return{h:h(t.h),s:h(t.s),l:h(t.l),a:h(t.a,3)}},nt=function(t){return tt((r=(e=t).s,{h:e.h,s:(r*=((n=e.l)<50?n:100-n)/100)>0?2*r/(n+r)*100:0,v:n+r,a:e.a}));var e,r,n},D=function(t){return{h:(e=Z(t)).h,s:(a=(200-(r=e.s))*(n=e.v)/100)>0&&a<200?r*n/100/(a<=100?a:200-a)*100:0,l:a/2,a:e.a};var e,r,n,a},qt=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Jt=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Qt=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Zt=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,it={string:[[function(t){var e=Ut.exec(t);return e?(t=e[1]).length<=4?{r:parseInt(t[0]+t[0],16),g:parseInt(t[1]+t[1],16),b:parseInt(t[2]+t[2],16),a:t.length===4?h(parseInt(t[3]+t[3],16)/255,2):1}:t.length===6||t.length===8?{r:parseInt(t.substr(0,2),16),g:parseInt(t.substr(2,2),16),b:parseInt(t.substr(4,2),16),a:t.length===8?h(parseInt(t.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(t){var e=Qt.exec(t)||Zt.exec(t);return e?e[2]!==e[4]||e[4]!==e[6]?null:Q({r:Number(e[1])/(e[2]?100/255:1),g:Number(e[3])/(e[4]?100/255:1),b:Number(e[5])/(e[6]?100/255:1),a:e[7]===void 0?1:Number(e[7])/(e[8]?100:1)}):null},"rgb"],[function(t){var e=qt.exec(t)||Jt.exec(t);if(!e)return null;var r,n,a=et({h:(r=e[1],n=e[2],n===void 0&&(n="deg"),Number(r)*(Yt[n]||1)),s:Number(e[3]),l:Number(e[4]),a:e[5]===void 0?1:Number(e[5])/(e[6]?100:1)});return nt(a)},"hsl"]],object:[[function(t){var e=t.r,r=t.g,n=t.b,a=t.a,l=a===void 0?1:a;return S(e)&&S(r)&&S(n)?Q({r:Number(e),g:Number(r),b:Number(n),a:Number(l)}):null},"rgb"],[function(t){var e=t.h,r=t.s,n=t.l,a=t.a,l=a===void 0?1:a;if(!S(e)||!S(r)||!S(n))return null;var c=et({h:Number(e),s:Number(r),l:Number(n),a:Number(l)});return nt(c)},"hsl"],[function(t){var e=t.h,r=t.s,n=t.v,a=t.a,l=a===void 0?1:a;if(!S(e)||!S(r)||!S(n))return null;var c=function(d){return{h:J(d.h),s:b(d.s,0,100),v:b(d.v,0,100),a:b(d.a)}}({h:Number(e),s:Number(r),v:Number(n),a:Number(l)});return tt(c)},"hsv"]]},ot=function(t,e){for(var r=0;r<e.length;r++){var n=e[r][0](t);if(n)return[n,e[r][1]]}return[null,void 0]},te=function(t){return typeof t=="string"?ot(t.trim(),it.string):typeof t=="object"&&t!==null?ot(t,it.object):[null,void 0]},j=function(t,e){var r=D(t);return{h:r.h,s:b(r.s+100*e,0,100),l:r.l,a:r.a}},P=function(t){return(299*t.r+587*t.g+114*t.b)/1e3/255},at=function(t,e){var r=D(t);return{h:r.h,s:r.s,l:b(r.l+100*e,0,100),a:r.a}},ut=function(){function t(e){this.parsed=te(e)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return t.prototype.isValid=function(){return this.parsed!==null},t.prototype.brightness=function(){return h(P(this.rgba),2)},t.prototype.isDark=function(){return P(this.rgba)<.5},t.prototype.isLight=function(){return P(this.rgba)>=.5},t.prototype.toHex=function(){return e=W(this.rgba),r=e.r,n=e.g,a=e.b,c=(l=e.a)<1?E(h(255*l)):"","#"+E(r)+E(n)+E(a)+c;var e,r,n,a,l,c},t.prototype.toRgb=function(){return W(this.rgba)},t.prototype.toRgbString=function(){return e=W(this.rgba),r=e.r,n=e.g,a=e.b,(l=e.a)<1?"rgba("+r+", "+n+", "+a+", "+l+")":"rgb("+r+", "+n+", "+a+")";var e,r,n,a,l},t.prototype.toHsl=function(){return rt(D(this.rgba))},t.prototype.toHslString=function(){return e=rt(D(this.rgba)),r=e.h,n=e.s,a=e.l,(l=e.a)<1?"hsla("+r+", "+n+"%, "+a+"%, "+l+")":"hsl("+r+", "+n+"%, "+a+"%)";var e,r,n,a,l},t.prototype.toHsv=function(){return e=Z(this.rgba),{h:h(e.h),s:h(e.s),v:h(e.v),a:h(e.a,3)};var e},t.prototype.invert=function(){return y({r:255-(e=this.rgba).r,g:255-e.g,b:255-e.b,a:e.a});var e},t.prototype.saturate=function(e){return e===void 0&&(e=.1),y(j(this.rgba,e))},t.prototype.desaturate=function(e){return e===void 0&&(e=.1),y(j(this.rgba,-e))},t.prototype.grayscale=function(){return y(j(this.rgba,-1))},t.prototype.lighten=function(e){return e===void 0&&(e=.1),y(at(this.rgba,e))},t.prototype.darken=function(e){return e===void 0&&(e=.1),y(at(this.rgba,-e))},t.prototype.rotate=function(e){return e===void 0&&(e=15),this.hue(this.hue()+e)},t.prototype.alpha=function(e){return typeof e=="number"?y({r:(r=this.rgba).r,g:r.g,b:r.b,a:e}):h(this.rgba.a,3);var r},t.prototype.hue=function(e){var r=D(this.rgba);return typeof e=="number"?y({h:e,s:r.s,l:r.l,a:r.a}):h(r.h)},t.prototype.isEqual=function(e){return this.toHex()===y(e).toHex()},t}(),y=function(t){return t instanceof ut?t:new ut(t)};function f(t){return t==null||t==="none"}function C(t,e=0,r=10**e){return Math.round(r*t)/r+0}function w(t,e=!1){if(typeof t!="object"||!t)return t;if(Array.isArray(t))return e?t.map(n=>w(n,e)):t;const r={};for(const n in t){const a=t[n];a!=null&&(e?r[n]=w(a,e):r[n]=a)}return r}function M(t){let e;return typeof t=="number"?e={r:t>>24&255,g:t>>16&255,b:t>>8&255,a:(t&255)/255}:e=t,y(e)}function ee(t){return{r:C(t.r),g:C(t.g),b:C(t.b),a:C(t.a,3)}}function V(t){const e=t.toString(16);return e.length<2?`0${e}`:e}const G="#000000FF";function lt(t){return M(t).isValid()}function v(t,e=!1){const r=M(t);if(!r.isValid()){if(typeof t=="string")return t;const d=`Failed to normalizeColor ${t}`;if(e)throw new Error(d);return console.warn(d),G}const{r:n,g:a,b:l,a:c}=ee(r.rgba);return`#${V(n)}${V(a)}${V(l)}${V(C(c*255))}`}var T=T||{};T.parse=function(){const t={linearGradient:/^(-(webkit|o|ms|moz)-)?(linear-gradient)/i,repeatingLinearGradient:/^(-(webkit|o|ms|moz)-)?(repeating-linear-gradient)/i,radialGradient:/^(-(webkit|o|ms|moz)-)?(radial-gradient)/i,repeatingRadialGradient:/^(-(webkit|o|ms|moz)-)?(repeating-radial-gradient)/i,sideOrCorner:/^to (left (top|bottom)|right (top|bottom)|top (left|right)|bottom (left|right)|left|right|top|bottom)/i,extentKeywords:/^(closest-side|closest-corner|farthest-side|farthest-corner|contain|cover)/,positionKeywords:/^(left|center|right|top|bottom)/i,pixelValue:/^(-?((\d*\.\d+)|(\d+\.?)))px/,percentageValue:/^(-?((\d*\.\d+)|(\d+\.?)))%/,emValue:/^(-?((\d*\.\d+)|(\d+\.?)))em/,angleValue:/^(-?((\d*\.\d+)|(\d+\.?)))deg/,radianValue:/^(-?((\d*\.\d+)|(\d+\.?)))rad/,startCall:/^\(/,endCall:/^\)/,comma:/^,/,hexColor:/^#([0-9a-f]+)/i,literalColor:/^([a-z]+)/i,rgbColor:/^rgb/i,rgbaColor:/^rgba/i,varColor:/^var/i,calcValue:/^calc/i,variableName:/^(--[a-z0-9-,\s#]+)/i,number:/^((\d*\.\d+)|(\d+\.?))/,hslColor:/^hsl/i,hslaColor:/^hsla/i};let e="";function r(i){const u=new Error(`${e}: ${i}`);throw u.source=e,u}function n(){const i=a();return e.length>0&&r("Invalid input not EOF"),i}function a(){return x(l)}function l(){return c("linear-gradient",t.linearGradient,F)||c("repeating-linear-gradient",t.repeatingLinearGradient,F)||c("radial-gradient",t.radialGradient,Bt)||c("repeating-radial-gradient",t.repeatingRadialGradient,Bt)}function c(i,u,s){return d(u,m=>{const z=s();return z&&(g(t.comma)||r("Missing comma before color stops")),{type:i,orientation:z,colorStops:x(ce)}})}function d(i,u){const s=g(i);if(s){g(t.startCall)||r("Missing (");const m=u(s);return g(t.endCall)||r("Missing )"),m}}function F(){const i=O();if(i)return i;const u=p("position-keyword",t.positionKeywords,1);return u?{type:"directional",value:u.value}:ae()}function O(){return p("directional",t.sideOrCorner,1)}function ae(){return p("angular",t.angleValue,1)||p("angular",t.radianValue,1)}function Bt(){let i,u=Kt(),s;return u&&(i=[],i.push(u),s=e,g(t.comma)&&(u=Kt(),u?i.push(u):e=s)),i}function Kt(){let i=ue()||le();if(i)i.at=Y();else{const u=X();if(u){i=u;const s=Y();s&&(i.at=s)}else{const s=Y();if(s)i={type:"default-radial",at:s};else{const m=U();m&&(i={type:"default-radial",at:m})}}}return i}function ue(){const i=p("shape",/^(circle)/i,0);return i&&(i.style=Xt()||X()),i}function le(){const i=p("shape",/^(ellipse)/i,0);return i&&(i.style=U()||H()||X()),i}function X(){return p("extent-keyword",t.extentKeywords,1)}function Y(){if(p("position",/^at/,0)){const i=U();return i||r("Missing positioning value"),i}}function U(){const i=se();if(i.x||i.y)return{type:"position",value:i}}function se(){return{x:H(),y:H()}}function x(i){let u=i();const s=[];if(u)for(s.push(u);g(t.comma);)u=i(),u?s.push(u):r("One extra comma");return s}function ce(){const i=fe();return i||r("Expected color definition"),i.length=H(),i}function fe(){return ge()||be()||pe()||ve()||he()||me()||de()}function de(){return p("literal",t.literalColor,0)}function ge(){return p("hex",t.hexColor,1)}function he(){return d(t.rgbColor,()=>({type:"rgb",value:x(L)}))}function ve(){return d(t.rgbaColor,()=>({type:"rgba",value:x(L)}))}function me(){return d(t.varColor,()=>({type:"var",value:ye()}))}function pe(){return d(t.hslColor,()=>{g(t.percentageValue)&&r("HSL hue value must be a number in degrees (0-360) or normalized (-360 to 360), not a percentage");const u=L();g(t.comma);let s=g(t.percentageValue);const m=s?s[1]:null;g(t.comma),s=g(t.percentageValue);const z=s?s[1]:null;return(!m||!z)&&r("Expected percentage value for saturation and lightness in HSL"),{type:"hsl",value:[u,m,z]}})}function be(){return d(t.hslaColor,()=>{const i=L();g(t.comma);let u=g(t.percentageValue);const s=u?u[1]:null;g(t.comma),u=g(t.percentageValue);const m=u?u[1]:null;g(t.comma);const z=L();return(!s||!m)&&r("Expected percentage value for saturation and lightness in HSLA"),{type:"hsla",value:[i,s,m,z]}})}function ye(){return g(t.variableName)[1]}function L(){return g(t.number)[1]}function H(){return p("%",t.percentageValue,1)||Se()||Ce()||Xt()}function Se(){return p("position-keyword",t.positionKeywords,1)}function Ce(){return d(t.calcValue,()=>{let i=1,u=0;for(;i>0&&u<e.length;){const m=e.charAt(u);m==="("?i++:m===")"&&i--,u++}i>0&&r("Missing closing parenthesis in calc() expression");const s=e.substring(0,u-1);return q(u-1),{type:"calc",value:s}})}function Xt(){return p("px",t.pixelValue,1)||p("em",t.emValue,1)}function p(i,u,s){const m=g(u);if(m)return{type:i,value:m[s]}}function g(i){let u,s;return s=/^\s+/.exec(e),s&&q(s[0].length),u=i.exec(e),u&&q(u[0].length),u}function q(i){e=e.substr(i)}return function(i){return e=i.toString().trim(),e.endsWith(";")&&(e=e.slice(0,-1)),n()}}();const st=T.parse.bind(T);var A=A||{};A.stringify=function(){var t={"visit_linear-gradient":function(e){return t.visit_gradient(e)},"visit_repeating-linear-gradient":function(e){return t.visit_gradient(e)},"visit_radial-gradient":function(e){return t.visit_gradient(e)},"visit_repeating-radial-gradient":function(e){return t.visit_gradient(e)},visit_gradient:function(e){var r=t.visit(e.orientation);return r&&(r+=", "),e.type+"("+r+t.visit(e.colorStops)+")"},visit_shape:function(e){var r=e.value,n=t.visit(e.at),a=t.visit(e.style);return a&&(r+=" "+a),n&&(r+=" at "+n),r},"visit_default-radial":function(e){var r="",n=t.visit(e.at);return n&&(r+=n),r},"visit_extent-keyword":function(e){var r=e.value,n=t.visit(e.at);return n&&(r+=" at "+n),r},"visit_position-keyword":function(e){return e.value},visit_position:function(e){return t.visit(e.value.x)+" "+t.visit(e.value.y)},"visit_%":function(e){return e.value+"%"},visit_em:function(e){return e.value+"em"},visit_px:function(e){return e.value+"px"},visit_calc:function(e){return"calc("+e.value+")"},visit_literal:function(e){return t.visit_color(e.value,e)},visit_hex:function(e){return t.visit_color("#"+e.value,e)},visit_rgb:function(e){return t.visit_color("rgb("+e.value.join(", ")+")",e)},visit_rgba:function(e){return t.visit_color("rgba("+e.value.join(", ")+")",e)},visit_hsl:function(e){return t.visit_color("hsl("+e.value[0]+", "+e.value[1]+"%, "+e.value[2]+"%)",e)},visit_hsla:function(e){return t.visit_color("hsla("+e.value[0]+", "+e.value[1]+"%, "+e.value[2]+"%, "+e.value[3]+")",e)},visit_var:function(e){return t.visit_color("var("+e.value+")",e)},visit_color:function(e,r){var n=e,a=t.visit(r.length);return a&&(n+=" "+a),n},visit_angular:function(e){return e.value+"deg"},visit_directional:function(e){return"to "+e.value},visit_array:function(e){var r="",n=e.length;return e.forEach(function(a,l){r+=t.visit(a),l<n-1&&(r+=", ")}),r},visit_object:function(e){return e.width&&e.height?t.visit(e.width)+" "+t.visit(e.height):""},visit:function(e){if(!e)return"";if(e instanceof Array)return t.visit_array(e);if(typeof e=="object"&&!e.type)return t.visit_object(e);if(e.type){var r=t["visit_"+e.type];if(r)return r(e);throw Error("Missing visitor visit_"+e.type)}else throw Error("Invalid node.")}};return function(e){return t.visit(e)}}();const re=A.stringify.bind(A);function ct(t){const e=t.length-1;return t.map((r,n)=>{var d;const a=r.value;let l=C(n/e,3),c="#00000000";switch(r.type){case"rgb":c=v({r:Number(a[0]??0),g:Number(a[1]??0),b:Number(a[2]??0)});break;case"rgba":c=v({r:Number(a[0]??0),g:Number(a[1]??0),b:Number(a[2]??0),a:Number(a[3]??0)});break;case"literal":c=v(r.value);break;case"hex":c=v(`#${r.value}`);break}switch((d=r.length)==null?void 0:d.type){case"%":l=Number(r.length.value)/100;break}return{offset:l,color:c}})}function ft(t){var r;let e=0;switch((r=t.orientation)==null?void 0:r.type){case"angular":e=Number(t.orientation.value);break}return{type:"linear-gradient",angle:e,stops:ct(t.colorStops)}}function dt(t){var e;return(e=t.orientation)==null||e.map(r=>{switch(r==null?void 0:r.type){case"shape":case"default-radial":case"extent-keyword":default:return null}}),{type:"radial-gradient",stops:ct(t.colorStops)}}function I(t){return t.startsWith("linear-gradient")||t.startsWith("radial-gradient")}function gt(t){return st(t).map(e=>{switch(e==null?void 0:e.type){case"linear-gradient":return ft(e);case"repeating-linear-gradient":return{...ft(e),repeat:!0};case"radial-gradient":return dt(e);case"repeating-radial-gradient":return{...dt(e),repeat:!0};default:return}}).filter(Boolean)}function ht(t){let e;return typeof t=="string"?e={color:t}:e=t,{color:v(e.color)}}function vt(t){let e;typeof t=="string"?e={image:t}:e=t;const{type:r,...n}=gt(e.image)[0]??{};switch(r){case"radial-gradient":return{radialGradient:n};case"linear-gradient":return{linearGradient:n}}return{}}function mt(t){let e;return typeof t=="string"?e={image:t}:e=t,e}function pt(t){let e;return typeof t=="string"?e={preset:t}:e=t,{preset:e.preset,foregroundColor:f(e.foregroundColor)?void 0:v(e.foregroundColor),backgroundColor:f(e.backgroundColor)?void 0:v(e.backgroundColor)}}function bt(t){return!f(t.color)}function yt(t){return typeof t=="string"?lt(t):bt(t)}function St(t){return!f(t.image)&&I(t.image)}function Ct(t){return typeof t=="string"?I(t):St(t)}function wt(t){return!f(t.image)&&!I(t.image)}function zt(t){return typeof t=="string"?!I(t):wt(t)}function kt(t){return!f(t.preset)}function _t(t){return typeof t=="string"?!1:kt(t)}function _(t){if(yt(t))return ht(t);if(Ct(t))return vt(t);if(zt(t))return mt(t);if(_t(t))return pt(t);throw new Error("Unknown fill property object")}function Nt(t){return typeof t=="string"?{..._(t),fillWithShape:!1}:{..._(t),fillWithShape:!!t.fillWithShape}}function R(){return{color:G,offsetX:0,offsetY:0,blurRadius:1}}function $(t){return{...R(),...w({...t,color:f(t.color)?G:v(t.color)})}}function Ft(){return{...R(),scaleX:1,scaleY:1}}function Dt(t){return{...Ft(),...$(t)}}function ne(t){return t}function Gt(t){return w({...t,softEdge:f(t.softEdge)?void 0:t.softEdge,outerShadow:f(t.outerShadow)?void 0:Dt(t.outerShadow),innerShadow:f(t.innerShadow)?void 0:$(t.innerShadow)})}function It(t){return typeof t=="string"?{..._(t),fillWithShape:!1}:{..._(t),fillWithShape:!!t.fillWithShape}}function Ot(t){return typeof t=="string"?{color:v(t)}:{...t,color:f(t.color)?void 0:v(t.color)}}function Lt(t){return typeof t=="string"?{color:v(t)}:{...t,color:f(t.color)?G:v(t.color)}}function Et(){return{boxShadow:"none"}}function Vt(t){return typeof t=="string"?t.startsWith("<svg")?{svg:t}:{paths:[{data:t}]}:Array.isArray(t)?{paths:t.map(e=>typeof e=="string"?{data:e}:e)}:t}function Tt(){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 At(){return{rotate:0,scaleX:1,scaleY:1,skewX:0,skewY:0,translateX:0,translateY:0,transform:"none",transformOrigin:"center"}}function xt(){return{...Tt(),...At(),...Et(),backgroundImage:"none",backgroundSize:"auto, auto",backgroundColor:"none",backgroundColormap:"none",borderRadius:0,borderColor:"none",borderStyle:"solid",outlineWidth:0,outlineOffset:0,outlineColor:"rgb(0, 0, 0)",outlineStyle:"none",visibility:"visible",filter:"none",opacity:1,pointerEvents:"auto",maskImage:"none"}}function Ht(){return{highlight:{},highlightImage:"none",highlightReferImage:"none",highlightColormap:"none",highlightLine:"none",highlightSize:"cover",highlightThickness:"100%"}}function Wt(){return{listStyle:{},listStyleType:"none",listStyleImage:"none",listStyleColormap:"none",listStyleSize:"cover",listStylePosition:"outside"}}function jt(){return{...Ht(),color:"rgb(0, 0, 0)",verticalAlign:"baseline",letterSpacing:0,wordSpacing:0,fontSize:14,fontWeight:"normal",fontFamily:"",fontStyle:"normal",fontKerning:"normal",textTransform:"none",textOrientation:"mixed",textDecoration:"none"}}function Pt(){return{...Wt(),writingMode:"horizontal-tb",textWrap:"wrap",textAlign:"start",textIndent:0,lineHeight:1.2}}function Mt(){return{...Pt(),...jt(),textStrokeWidth:0,textStrokeColor:"rgb(0, 0, 0)"}}function N(t){return w({...t,color:f(t.color)?void 0:v(t.color),backgroundColor:f(t.backgroundColor)?void 0:v(t.backgroundColor),borderColor:f(t.borderColor)?void 0:v(t.borderColor),outlineColor:f(t.outlineColor)?void 0:v(t.outlineColor),shadowColor:f(t.shadowColor)?void 0:v(t.shadowColor)})}function ie(){return{...xt(),...Mt()}}function B(t=""){return(Array.isArray(t)?t:[t]).map(r=>typeof r=="string"?{fragments:[{content:r}]}:"content"in r?{fragments:[N(r)]}:"fragments"in r?{...N(r),fragments:r.fragments.map(n=>N(n))}:Array.isArray(r)?{fragments:r.map(n=>typeof n=="string"?{content:n}:N(n))}:{fragments:[]})}function Rt(t){return typeof t=="string"?{content:[{fragments:[{content:t}]}]}:"content"in t?{...t,content:B(t.content)}:{content:B(t)}}function $t(t){return typeof t=="string"?{src:t}:t}function K(t){var e;return w({...t,style:f(t.style)?void 0:N(t.style),text:f(t.text)?void 0:Rt(t.text),background:f(t.background)?void 0:Nt(t.background),shape:f(t.shape)?void 0:Vt(t.shape),fill:f(t.fill)?void 0:_(t.fill),outline:f(t.outline)?void 0:Ot(t.outline),foreground:f(t.foreground)?void 0:It(t.foreground),shadow:f(t.shadow)?void 0:Lt(t.shadow),video:f(t.video)?void 0:$t(t.video),audio:f(t.audio)?void 0:k(t.audio),effect:f(t.effect)?void 0:Gt(t.effect),children:(e=t.children)==null?void 0:e.map(r=>K(r))})}function oe(t){return K(t)}o.clearUndef=w,o.defaultColor=G,o.getDefaultElementStyle=xt,o.getDefaultHighlightStyle=Ht,o.getDefaultInnerShadow=R,o.getDefaultLayoutStyle=Tt,o.getDefaultListStyleStyle=Wt,o.getDefaultOuterShadow=Ft,o.getDefaultShadowStyle=Et,o.getDefaultStyle=ie,o.getDefaultTextInlineStyle=jt,o.getDefaultTextLineStyle=Pt,o.getDefaultTextStyle=Mt,o.getDefaultTransformStyle=At,o.isColor=lt,o.isColorFill=yt,o.isColorFillObject=bt,o.isGradient=I,o.isGradientFill=Ct,o.isGradientFillObject=St,o.isImageFill=zt,o.isImageFillObject=wt,o.isNone=f,o.isPresetFill=_t,o.isPresetFillObject=kt,o.normalizeAudio=k,o.normalizeBackground=Nt,o.normalizeColor=v,o.normalizeColorFill=ht,o.normalizeDocument=oe,o.normalizeEffect=Gt,o.normalizeElement=K,o.normalizeFill=_,o.normalizeForeground=It,o.normalizeGradient=gt,o.normalizeGradientFill=vt,o.normalizeImageFill=mt,o.normalizeInnerShadow=$,o.normalizeOuterShadow=Dt,o.normalizeOutline=Ot,o.normalizePresetFill=pt,o.normalizeShadow=Lt,o.normalizeShape=Vt,o.normalizeSoftEdge=ne,o.normalizeStyle=N,o.normalizeText=Rt,o.normalizeTextContent=B,o.normalizeVideo=$t,o.parseColor=M,o.parseGradient=st,o.round=C,o.stringifyGradient=re,Object.defineProperty(o,Symbol.toStringTag,{value:"Module"})});
|
package/dist/index.mjs
CHANGED
|
@@ -723,7 +723,13 @@ function normalizeGradientFill(fill) {
|
|
|
723
723
|
}
|
|
724
724
|
|
|
725
725
|
function normalizeImageFill(fill) {
|
|
726
|
-
|
|
726
|
+
let obj;
|
|
727
|
+
if (typeof fill === "string") {
|
|
728
|
+
obj = { image: fill };
|
|
729
|
+
} else {
|
|
730
|
+
obj = fill;
|
|
731
|
+
}
|
|
732
|
+
return obj;
|
|
727
733
|
}
|
|
728
734
|
|
|
729
735
|
function normalizePresetFill(fill) {
|
|
@@ -740,27 +746,39 @@ function normalizePresetFill(fill) {
|
|
|
740
746
|
};
|
|
741
747
|
}
|
|
742
748
|
|
|
749
|
+
function isColorFillObject(fill) {
|
|
750
|
+
return !isNone(fill.color);
|
|
751
|
+
}
|
|
752
|
+
function isColorFill(fill) {
|
|
753
|
+
return typeof fill === "string" ? isColor(fill) : isColorFillObject(fill);
|
|
754
|
+
}
|
|
755
|
+
function isGradientFillObject(fill) {
|
|
756
|
+
return !isNone(fill.image) && isGradient(fill.image);
|
|
757
|
+
}
|
|
758
|
+
function isGradientFill(fill) {
|
|
759
|
+
return typeof fill === "string" ? isGradient(fill) : isGradientFillObject(fill);
|
|
760
|
+
}
|
|
761
|
+
function isImageFillObject(fill) {
|
|
762
|
+
return !isNone(fill.image) && !isGradient(fill.image);
|
|
763
|
+
}
|
|
764
|
+
function isImageFill(fill) {
|
|
765
|
+
return typeof fill === "string" ? !isGradient(fill) : isImageFillObject(fill);
|
|
766
|
+
}
|
|
767
|
+
function isPresetFillObject(fill) {
|
|
768
|
+
return !isNone(fill.preset);
|
|
769
|
+
}
|
|
770
|
+
function isPresetFill(fill) {
|
|
771
|
+
return typeof fill === "string" ? false : isPresetFillObject(fill);
|
|
772
|
+
}
|
|
743
773
|
function normalizeFill(fill) {
|
|
744
|
-
if (
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
} else {
|
|
753
|
-
if (!isNone(fill.color)) {
|
|
754
|
-
return normalizeColorFill(fill);
|
|
755
|
-
} else if (!isNone(fill.image)) {
|
|
756
|
-
if (isGradient(fill.image)) {
|
|
757
|
-
return normalizeGradientFill(fill);
|
|
758
|
-
} else {
|
|
759
|
-
return normalizeImageFill(fill);
|
|
760
|
-
}
|
|
761
|
-
} else if (isNone(fill.preset)) {
|
|
762
|
-
return normalizePresetFill(fill);
|
|
763
|
-
}
|
|
774
|
+
if (isColorFill(fill)) {
|
|
775
|
+
return normalizeColorFill(fill);
|
|
776
|
+
} else if (isGradientFill(fill)) {
|
|
777
|
+
return normalizeGradientFill(fill);
|
|
778
|
+
} else if (isImageFill(fill)) {
|
|
779
|
+
return normalizeImageFill(fill);
|
|
780
|
+
} else if (isPresetFill(fill)) {
|
|
781
|
+
return normalizePresetFill(fill);
|
|
764
782
|
}
|
|
765
783
|
throw new Error("Unknown fill property object");
|
|
766
784
|
}
|
|
@@ -871,11 +889,17 @@ function getDefaultShadowStyle() {
|
|
|
871
889
|
|
|
872
890
|
function normalizeShape(shape) {
|
|
873
891
|
if (typeof shape === "string") {
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
}
|
|
892
|
+
if (shape.startsWith("<svg")) {
|
|
893
|
+
return {
|
|
894
|
+
svg: shape
|
|
895
|
+
};
|
|
896
|
+
} else {
|
|
897
|
+
return {
|
|
898
|
+
paths: [
|
|
899
|
+
{ data: shape }
|
|
900
|
+
]
|
|
901
|
+
};
|
|
902
|
+
}
|
|
879
903
|
} else if (Array.isArray(shape)) {
|
|
880
904
|
return {
|
|
881
905
|
paths: shape.map((data) => {
|
|
@@ -1160,4 +1184,4 @@ function normalizeDocument(doc) {
|
|
|
1160
1184
|
return normalizeElement(doc);
|
|
1161
1185
|
}
|
|
1162
1186
|
|
|
1163
|
-
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 };
|
|
1187
|
+
export { clearUndef, defaultColor, getDefaultElementStyle, getDefaultHighlightStyle, getDefaultInnerShadow, getDefaultLayoutStyle, getDefaultListStyleStyle, getDefaultOuterShadow, getDefaultShadowStyle, getDefaultStyle, getDefaultTextInlineStyle, getDefaultTextLineStyle, getDefaultTextStyle, getDefaultTransformStyle, isColor, isColorFill, isColorFillObject, isGradient, isGradientFill, isGradientFillObject, isImageFill, isImageFillObject, isNone, isPresetFill, isPresetFillObject, 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 };
|