modern-idoc 0.6.5 → 0.6.7

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 CHANGED
@@ -861,12 +861,15 @@ function normalizeForeground(foreground) {
861
861
  function normalizeOutline(outline) {
862
862
  if (typeof outline === "string") {
863
863
  return {
864
- color: normalizeColor(outline)
864
+ ...normalizeFill(outline)
865
865
  };
866
866
  } else {
867
867
  return {
868
- ...outline,
869
- color: isNone(outline.color) ? void 0 : normalizeColor(outline.color)
868
+ ...normalizeFill(outline),
869
+ width: outline.width,
870
+ style: outline.style,
871
+ headEnd: outline.headEnd,
872
+ tailEnd: outline.tailEnd
870
873
  };
871
874
  }
872
875
  }
@@ -891,11 +894,17 @@ function getDefaultShadowStyle() {
891
894
 
892
895
  function normalizeShape(shape) {
893
896
  if (typeof shape === "string") {
894
- return {
895
- paths: [
896
- { data: shape }
897
- ]
898
- };
897
+ if (shape.startsWith("<svg")) {
898
+ return {
899
+ svg: shape
900
+ };
901
+ } else {
902
+ return {
903
+ paths: [
904
+ { data: shape }
905
+ ]
906
+ };
907
+ }
899
908
  } else if (Array.isArray(shape)) {
900
909
  return {
901
910
  paths: shape.map((data) => {
package/dist/index.d.cts CHANGED
@@ -310,8 +310,8 @@ declare function normalizeFill(fill: Fill): NormalizedFill;
310
310
  interface NormalizedBaseBackground {
311
311
  fillWithShape: boolean;
312
312
  }
313
- type NormalizedBackground = NormalizedBaseBackground & NormalizedFill;
314
- type BackgroundObject = Partial<NormalizedBaseBackground> & FillObject;
313
+ type NormalizedBackground = NormalizedFill & NormalizedBaseBackground;
314
+ type BackgroundObject = FillObject & Partial<NormalizedBaseBackground>;
315
315
  type Background = string | BackgroundObject;
316
316
  declare function normalizeBackground(background: Background): NormalizedBackground;
317
317
 
@@ -390,18 +390,15 @@ interface TailEnd {
390
390
  height?: WithNone<LineEndSize>;
391
391
  }
392
392
 
393
- type NormalizedOutlineFill = Partial<NormalizedColorFill> & Partial<NormalizedGradientFill>;
394
393
  type OutlineStyle = 'dashed' | 'solid' | string;
395
- interface NormalizedOutline extends NormalizedOutlineFill {
394
+ interface NormalizedBaseOutline {
396
395
  width?: number;
397
- color?: NormalizedColor;
398
396
  style?: OutlineStyle;
399
397
  headEnd?: HeadEnd;
400
398
  tailEnd?: TailEnd;
401
399
  }
402
- type OutlineObject = Partial<NormalizedOutline> & {
403
- color?: WithNone<Color>;
404
- };
400
+ type NormalizedOutline = NormalizedFill & NormalizedBaseOutline;
401
+ type OutlineObject = FillObject & Partial<NormalizedBaseOutline>;
405
402
  type Outline = string | OutlineObject;
406
403
  declare function normalizeOutline(outline: Outline): NormalizedOutline;
407
404
 
@@ -456,6 +453,7 @@ interface ShapePath extends Partial<ShapePathStyle> {
456
453
  interface NormalizedShape {
457
454
  preset?: string;
458
455
  viewBox?: number[];
456
+ svg?: string;
459
457
  paths?: ShapePath[];
460
458
  }
461
459
  type Shape = SVGPathData | SVGPathData[] | ShapePath[] | NormalizedShape;
@@ -731,4 +729,4 @@ declare function round(number: number, digits?: number, base?: number): number;
731
729
  declare function clearUndef<T>(obj: T, deep?: boolean): T;
732
730
 
733
731
  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 };
734
- 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 };
732
+ 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, NormalizedBaseOutline, NormalizedColor, NormalizedColorFill, NormalizedDocument, NormalizedEffect, NormalizedElement, NormalizedElementStyle, NormalizedFill, NormalizedForeground, NormalizedGradientFill, NormalizedHighlight, NormalizedHighlightStyle, NormalizedImageFill, NormalizedInnerShadow, NormalizedLayoutStyle, NormalizedListStyle, NormalizedListStyleStyle, NormalizedOuterShadow, NormalizedOutline, 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
@@ -310,8 +310,8 @@ declare function normalizeFill(fill: Fill): NormalizedFill;
310
310
  interface NormalizedBaseBackground {
311
311
  fillWithShape: boolean;
312
312
  }
313
- type NormalizedBackground = NormalizedBaseBackground & NormalizedFill;
314
- type BackgroundObject = Partial<NormalizedBaseBackground> & FillObject;
313
+ type NormalizedBackground = NormalizedFill & NormalizedBaseBackground;
314
+ type BackgroundObject = FillObject & Partial<NormalizedBaseBackground>;
315
315
  type Background = string | BackgroundObject;
316
316
  declare function normalizeBackground(background: Background): NormalizedBackground;
317
317
 
@@ -390,18 +390,15 @@ interface TailEnd {
390
390
  height?: WithNone<LineEndSize>;
391
391
  }
392
392
 
393
- type NormalizedOutlineFill = Partial<NormalizedColorFill> & Partial<NormalizedGradientFill>;
394
393
  type OutlineStyle = 'dashed' | 'solid' | string;
395
- interface NormalizedOutline extends NormalizedOutlineFill {
394
+ interface NormalizedBaseOutline {
396
395
  width?: number;
397
- color?: NormalizedColor;
398
396
  style?: OutlineStyle;
399
397
  headEnd?: HeadEnd;
400
398
  tailEnd?: TailEnd;
401
399
  }
402
- type OutlineObject = Partial<NormalizedOutline> & {
403
- color?: WithNone<Color>;
404
- };
400
+ type NormalizedOutline = NormalizedFill & NormalizedBaseOutline;
401
+ type OutlineObject = FillObject & Partial<NormalizedBaseOutline>;
405
402
  type Outline = string | OutlineObject;
406
403
  declare function normalizeOutline(outline: Outline): NormalizedOutline;
407
404
 
@@ -456,6 +453,7 @@ interface ShapePath extends Partial<ShapePathStyle> {
456
453
  interface NormalizedShape {
457
454
  preset?: string;
458
455
  viewBox?: number[];
456
+ svg?: string;
459
457
  paths?: ShapePath[];
460
458
  }
461
459
  type Shape = SVGPathData | SVGPathData[] | ShapePath[] | NormalizedShape;
@@ -731,4 +729,4 @@ declare function round(number: number, digits?: number, base?: number): number;
731
729
  declare function clearUndef<T>(obj: T, deep?: boolean): T;
732
730
 
733
731
  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 };
734
- 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 };
732
+ 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, NormalizedBaseOutline, NormalizedColor, NormalizedColorFill, NormalizedDocument, NormalizedEffect, NormalizedElement, NormalizedElementStyle, NormalizedFill, NormalizedForeground, NormalizedGradientFill, NormalizedHighlight, NormalizedHighlightStyle, NormalizedImageFill, NormalizedInnerShadow, NormalizedLayoutStyle, NormalizedListStyle, NormalizedListStyleStyle, NormalizedOuterShadow, NormalizedOutline, 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
@@ -310,8 +310,8 @@ declare function normalizeFill(fill: Fill): NormalizedFill;
310
310
  interface NormalizedBaseBackground {
311
311
  fillWithShape: boolean;
312
312
  }
313
- type NormalizedBackground = NormalizedBaseBackground & NormalizedFill;
314
- type BackgroundObject = Partial<NormalizedBaseBackground> & FillObject;
313
+ type NormalizedBackground = NormalizedFill & NormalizedBaseBackground;
314
+ type BackgroundObject = FillObject & Partial<NormalizedBaseBackground>;
315
315
  type Background = string | BackgroundObject;
316
316
  declare function normalizeBackground(background: Background): NormalizedBackground;
317
317
 
@@ -390,18 +390,15 @@ interface TailEnd {
390
390
  height?: WithNone<LineEndSize>;
391
391
  }
392
392
 
393
- type NormalizedOutlineFill = Partial<NormalizedColorFill> & Partial<NormalizedGradientFill>;
394
393
  type OutlineStyle = 'dashed' | 'solid' | string;
395
- interface NormalizedOutline extends NormalizedOutlineFill {
394
+ interface NormalizedBaseOutline {
396
395
  width?: number;
397
- color?: NormalizedColor;
398
396
  style?: OutlineStyle;
399
397
  headEnd?: HeadEnd;
400
398
  tailEnd?: TailEnd;
401
399
  }
402
- type OutlineObject = Partial<NormalizedOutline> & {
403
- color?: WithNone<Color>;
404
- };
400
+ type NormalizedOutline = NormalizedFill & NormalizedBaseOutline;
401
+ type OutlineObject = FillObject & Partial<NormalizedBaseOutline>;
405
402
  type Outline = string | OutlineObject;
406
403
  declare function normalizeOutline(outline: Outline): NormalizedOutline;
407
404
 
@@ -456,6 +453,7 @@ interface ShapePath extends Partial<ShapePathStyle> {
456
453
  interface NormalizedShape {
457
454
  preset?: string;
458
455
  viewBox?: number[];
456
+ svg?: string;
459
457
  paths?: ShapePath[];
460
458
  }
461
459
  type Shape = SVGPathData | SVGPathData[] | ShapePath[] | NormalizedShape;
@@ -731,4 +729,4 @@ declare function round(number: number, digits?: number, base?: number): number;
731
729
  declare function clearUndef<T>(obj: T, deep?: boolean): T;
732
730
 
733
731
  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 };
734
- 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 };
732
+ 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, NormalizedBaseOutline, NormalizedColor, NormalizedColorFill, NormalizedDocument, NormalizedEffect, NormalizedElement, NormalizedElementStyle, NormalizedFill, NormalizedForeground, NormalizedGradientFill, NormalizedHighlight, NormalizedHighlightStyle, NormalizedImageFill, NormalizedInnerShadow, NormalizedLayoutStyle, NormalizedListStyle, NormalizedListStyleStyle, NormalizedOuterShadow, NormalizedOutline, 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(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)}},j=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]},P=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}},W=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(W(this.rgba),2)},t.prototype.isDark=function(){return W(this.rgba)<.5},t.prototype.isLight=function(){return W(this.rgba)>=.5},t.prototype.toHex=function(){return e=j(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 j(this.rgba)},t.prototype.toRgbString=function(){return e=j(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(P(this.rgba,e))},t.prototype.desaturate=function(e){return e===void 0&&(e=.1),y(P(this.rgba,-e))},t.prototype.grayscale=function(){return y(P(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"?{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 jt(){return{listStyle:{},listStyleType:"none",listStyleImage:"none",listStyleColormap:"none",listStyleSize:"cover",listStylePosition:"outside"}}function Pt(){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 Wt(){return{...jt(),writingMode:"horizontal-tb",textWrap:"wrap",textAlign:"start",textIndent:0,lineHeight:1.2}}function Mt(){return{...Wt(),...Pt(),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=jt,o.getDefaultOuterShadow=Ft,o.getDefaultShadowStyle=Et,o.getDefaultStyle=ie,o.getDefaultTextInlineStyle=Pt,o.getDefaultTextLineStyle=Wt,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"})});
1
+ (function(o,_){typeof exports=="object"&&typeof module<"u"?_(exports):typeof define=="function"&&define.amd?define(["exports"],_):(o=typeof globalThis<"u"?globalThis:o||self,_(o.modernIdoc={}))})(this,function(o){"use strict";function _(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,n){return e===void 0&&(e=0),n===void 0&&(n=Math.pow(10,e)),Math.round(n*t)/n+0},b=function(t,e,n){return e===void 0&&(e=0),n===void 0&&(n=1),t>n?n: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,L=function(t){var e=t.toString(16);return e.length<2?"0"+e:e},Z=function(t){var e=t.r,n=t.g,r=t.b,a=t.a,l=Math.max(e,n,r),c=l-Math.min(e,n,r),d=c?l===e?(n-r)/c:l===n?2+(r-e)/c:4+(e-n)/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,n=t.s,r=t.v,a=t.a;e=e/360*6,n/=100,r/=100;var l=Math.floor(e),c=r*(1-n),d=r*(1-(e-l)*n),F=r*(1-(1-e+l)*n),O=l%6;return{r:255*[r,d,c,c,F,r][O],g:255*[F,r,r,d,c,c][O],b:255*[c,c,F,r,r,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)}},nt=function(t){return{h:h(t.h),s:h(t.s),l:h(t.l),a:h(t.a,3)}},rt=function(t){return tt((n=(e=t).s,{h:e.h,s:(n*=((r=e.l)<50?r:100-r)/100)>0?2*n/(r+n)*100:0,v:r+n,a:e.a}));var e,n,r},D=function(t){return{h:(e=Z(t)).h,s:(a=(200-(n=e.s))*(r=e.v)/100)>0&&a<200?n*r/100/(a<=100?a:200-a)*100:0,l:a/2,a:e.a};var e,n,r,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 n,r,a=et({h:(n=e[1],r=e[2],r===void 0&&(r="deg"),Number(n)*(Yt[r]||1)),s:Number(e[3]),l:Number(e[4]),a:e[5]===void 0?1:Number(e[5])/(e[6]?100:1)});return rt(a)},"hsl"]],object:[[function(t){var e=t.r,n=t.g,r=t.b,a=t.a,l=a===void 0?1:a;return S(e)&&S(n)&&S(r)?Q({r:Number(e),g:Number(n),b:Number(r),a:Number(l)}):null},"rgb"],[function(t){var e=t.h,n=t.s,r=t.l,a=t.a,l=a===void 0?1:a;if(!S(e)||!S(n)||!S(r))return null;var c=et({h:Number(e),s:Number(n),l:Number(r),a:Number(l)});return rt(c)},"hsl"],[function(t){var e=t.h,n=t.s,r=t.v,a=t.a,l=a===void 0?1:a;if(!S(e)||!S(n)||!S(r))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(n),v:Number(r),a:Number(l)});return tt(c)},"hsv"]]},ot=function(t,e){for(var n=0;n<e.length;n++){var r=e[n][0](t);if(r)return[r,e[n][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 n=D(t);return{h:n.h,s:b(n.s+100*e,0,100),l:n.l,a:n.a}},P=function(t){return(299*t.r+587*t.g+114*t.b)/1e3/255},at=function(t,e){var n=D(t);return{h:n.h,s:n.s,l:b(n.l+100*e,0,100),a:n.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),n=e.r,r=e.g,a=e.b,c=(l=e.a)<1?L(h(255*l)):"","#"+L(n)+L(r)+L(a)+c;var e,n,r,a,l,c},t.prototype.toRgb=function(){return W(this.rgba)},t.prototype.toRgbString=function(){return e=W(this.rgba),n=e.r,r=e.g,a=e.b,(l=e.a)<1?"rgba("+n+", "+r+", "+a+", "+l+")":"rgb("+n+", "+r+", "+a+")";var e,n,r,a,l},t.prototype.toHsl=function(){return nt(D(this.rgba))},t.prototype.toHslString=function(){return e=nt(D(this.rgba)),n=e.h,r=e.s,a=e.l,(l=e.a)<1?"hsla("+n+", "+r+"%, "+a+"%, "+l+")":"hsl("+n+", "+r+"%, "+a+"%)";var e,n,r,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:(n=this.rgba).r,g:n.g,b:n.b,a:e}):h(this.rgba.a,3);var n},t.prototype.hue=function(e){var n=D(this.rgba);return typeof e=="number"?y({h:e,s:n.s,l:n.l,a:n.a}):h(n.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 w(t,e=0,n=10**e){return Math.round(n*t)/n+0}function z(t,e=!1){if(typeof t!="object"||!t)return t;if(Array.isArray(t))return e?t.map(r=>z(r,e)):t;const n={};for(const r in t){const a=t[r];a!=null&&(e?n[r]=z(a,e):n[r]=a)}return n}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:w(t.r),g:w(t.g),b:w(t.b),a:w(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 m(t,e=!1){const n=M(t);if(!n.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,g:a,b:l,a:c}=ee(n.rgba);return`#${V(r)}${V(a)}${V(l)}${V(w(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 n(i){const u=new Error(`${e}: ${i}`);throw u.source=e,u}function r(){const i=a();return e.length>0&&n("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,v=>{const k=s();return k&&(g(t.comma)||n("Missing comma before color stops")),{type:i,orientation:k,colorStops:x(ce)}})}function d(i,u){const s=g(i);if(s){g(t.startCall)||n("Missing (");const v=u(s);return g(t.endCall)||n("Missing )"),v}}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 v=U();v&&(i={type:"default-radial",at:v})}}}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||n("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):n("One extra comma");return s}function ce(){const i=fe();return i||n("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(E)}))}function ve(){return d(t.rgbaColor,()=>({type:"rgba",value:x(E)}))}function me(){return d(t.varColor,()=>({type:"var",value:ye()}))}function pe(){return d(t.hslColor,()=>{g(t.percentageValue)&&n("HSL hue value must be a number in degrees (0-360) or normalized (-360 to 360), not a percentage");const u=E();g(t.comma);let s=g(t.percentageValue);const v=s?s[1]:null;g(t.comma),s=g(t.percentageValue);const k=s?s[1]:null;return(!v||!k)&&n("Expected percentage value for saturation and lightness in HSL"),{type:"hsl",value:[u,v,k]}})}function be(){return d(t.hslaColor,()=>{const i=E();g(t.comma);let u=g(t.percentageValue);const s=u?u[1]:null;g(t.comma),u=g(t.percentageValue);const v=u?u[1]:null;g(t.comma);const k=E();return(!s||!v)&&n("Expected percentage value for saturation and lightness in HSLA"),{type:"hsla",value:[i,s,v,k]}})}function ye(){return g(t.variableName)[1]}function E(){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 v=e.charAt(u);v==="("?i++:v===")"&&i--,u++}i>0&&n("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 v=g(u);if(v)return{type:i,value:v[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)),r()}}();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 n=t.visit(e.orientation);return n&&(n+=", "),e.type+"("+n+t.visit(e.colorStops)+")"},visit_shape:function(e){var n=e.value,r=t.visit(e.at),a=t.visit(e.style);return a&&(n+=" "+a),r&&(n+=" at "+r),n},"visit_default-radial":function(e){var n="",r=t.visit(e.at);return r&&(n+=r),n},"visit_extent-keyword":function(e){var n=e.value,r=t.visit(e.at);return r&&(n+=" at "+r),n},"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,n){var r=e,a=t.visit(n.length);return a&&(r+=" "+a),r},visit_angular:function(e){return e.value+"deg"},visit_directional:function(e){return"to "+e.value},visit_array:function(e){var n="",r=e.length;return e.forEach(function(a,l){n+=t.visit(a),l<r-1&&(n+=", ")}),n},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 n=t["visit_"+e.type];if(n)return n(e);throw Error("Missing visitor visit_"+e.type)}else throw Error("Invalid node.")}};return function(e){return t.visit(e)}}();const ne=A.stringify.bind(A);function ct(t){const e=t.length-1;return t.map((n,r)=>{var d;const a=n.value;let l=w(r/e,3),c="#00000000";switch(n.type){case"rgb":c=m({r:Number(a[0]??0),g:Number(a[1]??0),b:Number(a[2]??0)});break;case"rgba":c=m({r:Number(a[0]??0),g:Number(a[1]??0),b:Number(a[2]??0),a:Number(a[3]??0)});break;case"literal":c=m(n.value);break;case"hex":c=m(`#${n.value}`);break}switch((d=n.length)==null?void 0:d.type){case"%":l=Number(n.length.value)/100;break}return{offset:l,color:c}})}function ft(t){var n;let e=0;switch((n=t.orientation)==null?void 0:n.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(n=>{switch(n==null?void 0:n.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:m(e.color)}}function vt(t){let e;typeof t=="string"?e={image:t}:e=t;const{type:n,...r}=gt(e.image)[0]??{};switch(n){case"radial-gradient":return{radialGradient:r};case"linear-gradient":return{linearGradient:r}}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:m(e.foregroundColor),backgroundColor:f(e.backgroundColor)?void 0:m(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 C(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"?{...C(t),fillWithShape:!1}:{...C(t),fillWithShape:!!t.fillWithShape}}function R(){return{color:G,offsetX:0,offsetY:0,blurRadius:1}}function $(t){return{...R(),...z({...t,color:f(t.color)?G:m(t.color)})}}function Ft(){return{...R(),scaleX:1,scaleY:1}}function Dt(t){return{...Ft(),...$(t)}}function re(t){return t}function Gt(t){return z({...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"?{...C(t),fillWithShape:!1}:{...C(t),fillWithShape:!!t.fillWithShape}}function Ot(t){return typeof t=="string"?{...C(t)}:{...C(t),width:t.width,style:t.style,headEnd:t.headEnd,tailEnd:t.tailEnd}}function Et(t){return typeof t=="string"?{color:m(t)}:{...t,color:f(t.color)?G:m(t.color)}}function Lt(){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(),...Lt(),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 z({...t,color:f(t.color)?void 0:m(t.color),backgroundColor:f(t.backgroundColor)?void 0:m(t.backgroundColor),borderColor:f(t.borderColor)?void 0:m(t.borderColor),outlineColor:f(t.outlineColor)?void 0:m(t.outlineColor),shadowColor:f(t.shadowColor)?void 0:m(t.shadowColor)})}function ie(){return{...xt(),...Mt()}}function B(t=""){return(Array.isArray(t)?t:[t]).map(n=>typeof n=="string"?{fragments:[{content:n}]}:"content"in n?{fragments:[N(n)]}:"fragments"in n?{...N(n),fragments:n.fragments.map(r=>N(r))}:Array.isArray(n)?{fragments:n.map(r=>typeof r=="string"?{content:r}:N(r))}:{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 z({...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:C(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:Et(t.shadow),video:f(t.video)?void 0:$t(t.video),audio:f(t.audio)?void 0:_(t.audio),effect:f(t.effect)?void 0:Gt(t.effect),children:(e=t.children)==null?void 0:e.map(n=>K(n))})}function oe(t){return K(t)}o.clearUndef=z,o.defaultColor=G,o.getDefaultElementStyle=xt,o.getDefaultHighlightStyle=Ht,o.getDefaultInnerShadow=R,o.getDefaultLayoutStyle=Tt,o.getDefaultListStyleStyle=Wt,o.getDefaultOuterShadow=Ft,o.getDefaultShadowStyle=Lt,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=_,o.normalizeBackground=Nt,o.normalizeColor=m,o.normalizeColorFill=ht,o.normalizeDocument=oe,o.normalizeEffect=Gt,o.normalizeElement=K,o.normalizeFill=C,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=Et,o.normalizeShape=Vt,o.normalizeSoftEdge=re,o.normalizeStyle=N,o.normalizeText=Rt,o.normalizeTextContent=B,o.normalizeVideo=$t,o.parseColor=M,o.parseGradient=st,o.round=w,o.stringifyGradient=ne,Object.defineProperty(o,Symbol.toStringTag,{value:"Module"})});
package/dist/index.mjs CHANGED
@@ -859,12 +859,15 @@ function normalizeForeground(foreground) {
859
859
  function normalizeOutline(outline) {
860
860
  if (typeof outline === "string") {
861
861
  return {
862
- color: normalizeColor(outline)
862
+ ...normalizeFill(outline)
863
863
  };
864
864
  } else {
865
865
  return {
866
- ...outline,
867
- color: isNone(outline.color) ? void 0 : normalizeColor(outline.color)
866
+ ...normalizeFill(outline),
867
+ width: outline.width,
868
+ style: outline.style,
869
+ headEnd: outline.headEnd,
870
+ tailEnd: outline.tailEnd
868
871
  };
869
872
  }
870
873
  }
@@ -889,11 +892,17 @@ function getDefaultShadowStyle() {
889
892
 
890
893
  function normalizeShape(shape) {
891
894
  if (typeof shape === "string") {
892
- return {
893
- paths: [
894
- { data: shape }
895
- ]
896
- };
895
+ if (shape.startsWith("<svg")) {
896
+ return {
897
+ svg: shape
898
+ };
899
+ } else {
900
+ return {
901
+ paths: [
902
+ { data: shape }
903
+ ]
904
+ };
905
+ }
897
906
  } else if (Array.isArray(shape)) {
898
907
  return {
899
908
  paths: shape.map((data) => {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "modern-idoc",
3
3
  "type": "module",
4
- "version": "0.6.5",
4
+ "version": "0.6.7",
5
5
  "packageManager": "pnpm@9.15.1",
6
6
  "description": "Intermediate document for modern codec libs",
7
7
  "author": "wxm",