modern-idoc 0.5.0 → 0.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -209,11 +209,6 @@ function normalizeOutline(outline) {
209
209
  }
210
210
  }
211
211
 
212
- function getDefaultShadowStyle() {
213
- return {
214
- boxShadow: "none"
215
- };
216
- }
217
212
  function normalizeShadow(shadow) {
218
213
  if (!shadow || shadow === "none") {
219
214
  return void 0;
@@ -228,6 +223,11 @@ function normalizeShadow(shadow) {
228
223
  };
229
224
  }
230
225
  }
226
+ function getDefaultShadowStyle() {
227
+ return {
228
+ boxShadow: "none"
229
+ };
230
+ }
231
231
 
232
232
  function getDefaultLayoutStyle() {
233
233
  return {
@@ -303,6 +303,7 @@ function getDefaultElementStyle() {
303
303
  ...getDefaultShadowStyle(),
304
304
  // background
305
305
  backgroundImage: "none",
306
+ backgroundSize: "auto, auto",
306
307
  backgroundColor: "none",
307
308
  // border
308
309
  borderRadius: 0,
package/dist/index.d.cts CHANGED
@@ -273,15 +273,15 @@ type ShadowPropertyObject = Partial<ShadowDeclaration> & {
273
273
  color?: Color;
274
274
  };
275
275
  type ShadowProperty = None | BoxShadow | ShadowPropertyObject;
276
- type ShadowStyleDeclaration = Partial<{
276
+ declare function normalizeShadow(shadow?: ShadowProperty): ShadowDeclaration | undefined;
277
+ interface ShadowStyleDeclaration {
277
278
  boxShadow: BoxShadow;
278
- shadowColor: ColorDeclaration;
279
- shadowOffsetX: number;
280
- shadowOffsetY: number;
281
- shadowBlur: number;
282
- }>;
279
+ shadowColor?: ColorDeclaration;
280
+ shadowOffsetX?: number;
281
+ shadowOffsetY?: number;
282
+ shadowBlur?: number;
283
+ }
283
284
  declare function getDefaultShadowStyle(): ShadowStyleDeclaration;
284
- declare function normalizeShadow(shadow?: ShadowProperty): ShadowDeclaration | undefined;
285
285
 
286
286
  type StyleUnit = `${number}%` | number;
287
287
  type Display = 'flex' | 'contents';
@@ -318,7 +318,7 @@ type HighlightColormap = None | Record<string, string>;
318
318
  type HighlightSize = StyleUnit | `${number}rem` | 'cover';
319
319
  type HighlightThickness = StyleUnit;
320
320
 
321
- type LayoutStyleDeclaration = Partial<{
321
+ interface LayoutStyleDeclaration {
322
322
  overflow: Overflow;
323
323
  direction: Direction;
324
324
  display: Display;
@@ -361,10 +361,10 @@ type LayoutStyleDeclaration = Partial<{
361
361
  paddingRight: StyleUnit;
362
362
  paddingBottom: StyleUnit;
363
363
  padding: StyleUnit;
364
- }>;
365
- declare function getDefaultLayoutStyle(): LayoutStyleDeclaration;
364
+ }
365
+ declare function getDefaultLayoutStyle(): Partial<LayoutStyleDeclaration>;
366
366
 
367
- type TransformStyleDeclaration = Partial<{
367
+ interface TransformStyleDeclaration {
368
368
  rotate: number;
369
369
  scaleX: number;
370
370
  scaleY: number;
@@ -374,11 +374,13 @@ type TransformStyleDeclaration = Partial<{
374
374
  translateY: number;
375
375
  transform: None | string;
376
376
  transformOrigin: string;
377
- }>;
378
- declare function getDefaultTransformStyle(): Required<TransformStyleDeclaration>;
377
+ }
378
+ declare function getDefaultTransformStyle(): TransformStyleDeclaration;
379
379
 
380
- type ElementStyleDeclaration = LayoutStyleDeclaration & TransformStyleDeclaration & ShadowStyleDeclaration & Partial<{
380
+ type BackgroundSize = 'contain' | 'cover' | string | 'stretch' | 'rigid';
381
+ type ElementStyleDeclaration = Partial<LayoutStyleDeclaration> & TransformStyleDeclaration & ShadowStyleDeclaration & {
381
382
  backgroundImage: None | string;
383
+ backgroundSize: BackgroundSize;
382
384
  backgroundColor: None | ColorDeclaration;
383
385
  borderRadius: number;
384
386
  borderColor: None | ColorDeclaration;
@@ -392,7 +394,7 @@ type ElementStyleDeclaration = LayoutStyleDeclaration & TransformStyleDeclaratio
392
394
  opacity: number;
393
395
  pointerEvents: PointerEvents;
394
396
  maskImage: None | string;
395
- }>;
397
+ };
396
398
  declare function getDefaultElementStyle(): ElementStyleDeclaration;
397
399
 
398
400
  interface HighlightDeclaration {
@@ -403,7 +405,7 @@ interface HighlightDeclaration {
403
405
  size: HighlightSize;
404
406
  thickness: HighlightThickness;
405
407
  }
406
- type HighlightStyleDeclaration = Partial<{
408
+ interface HighlightStyleDeclaration {
407
409
  highlight: Partial<HighlightDeclaration>;
408
410
  highlightImage: HighlightImage;
409
411
  highlightReferImage: HighlightReferImage;
@@ -411,7 +413,7 @@ type HighlightStyleDeclaration = Partial<{
411
413
  highlightLine: HighlightLine;
412
414
  highlightSize: HighlightSize;
413
415
  highlightThickness: HighlightThickness;
414
- }>;
416
+ }
415
417
  declare function getDefaultHighlightStyle(): Required<HighlightStyleDeclaration>;
416
418
 
417
419
  interface ListStyleDeclaration {
@@ -421,17 +423,17 @@ interface ListStyleDeclaration {
421
423
  size: ListStyleSize;
422
424
  position: ListStylePosition;
423
425
  }
424
- type ListStyleStyleDeclaration = Partial<{
426
+ interface ListStyleStyleDeclaration {
425
427
  listStyle: Partial<ListStyleDeclaration>;
426
428
  listStyleType: ListStyleType;
427
429
  listStyleImage: ListStyleImage;
428
430
  listStyleColormap: ListStyleColormap;
429
431
  listStyleSize: ListStyleSize;
430
432
  listStylePosition: ListStylePosition;
431
- }>;
432
- declare function getDefaultListStyleStyle(): Required<ListStyleStyleDeclaration>;
433
+ }
434
+ declare function getDefaultListStyleStyle(): ListStyleStyleDeclaration;
433
435
 
434
- type TextInlineStyleDeclaration = HighlightStyleDeclaration & Partial<{
436
+ type TextInlineStyleDeclaration = HighlightStyleDeclaration & {
435
437
  color: ColorDeclaration;
436
438
  verticalAlign: VerticalAlign;
437
439
  letterSpacing: number;
@@ -444,22 +446,22 @@ type TextInlineStyleDeclaration = HighlightStyleDeclaration & Partial<{
444
446
  textTransform: TextTransform;
445
447
  textOrientation: TextOrientation;
446
448
  textDecoration: TextDecoration;
447
- }>;
449
+ };
448
450
  declare function getDefaultTextInlineStyle(): Required<TextInlineStyleDeclaration>;
449
451
 
450
- type TextLineStyleDeclaration = ListStyleStyleDeclaration & Partial<{
452
+ type TextLineStyleDeclaration = ListStyleStyleDeclaration & {
451
453
  writingMode: WritingMode;
452
454
  textWrap: TextWrap;
453
455
  textAlign: TextAlign;
454
456
  textIndent: number;
455
457
  lineHeight: number;
456
- }>;
457
- declare function getDefaultTextLineStyle(): Required<TextLineStyleDeclaration>;
458
+ };
459
+ declare function getDefaultTextLineStyle(): TextLineStyleDeclaration;
458
460
 
459
- type TextDrawStyleDeclaration = Partial<{
461
+ interface TextDrawStyleDeclaration {
460
462
  textStrokeWidth: number;
461
463
  textStrokeColor: ColorDeclaration;
462
- }>;
464
+ }
463
465
  type TextStyleDeclaration = TextLineStyleDeclaration & TextInlineStyleDeclaration & TextDrawStyleDeclaration;
464
466
  declare function getDefaultTextStyle(): Required<TextStyleDeclaration>;
465
467
 
@@ -484,7 +486,7 @@ interface ParagraphContent extends StylePropertyObject {
484
486
  }
485
487
  type TextContentFlat = string | FragmentContent | ParagraphContent | (string | FragmentContent)[];
486
488
  type TextContent = string | FragmentContent | ParagraphContent | TextContentFlat[];
487
- type TextContentDeclaration = (ParagraphContent & StyleDeclaration)[];
489
+ type TextContentDeclaration = (ParagraphContent & StylePropertyObject)[];
488
490
  interface TextDeclaration {
489
491
  content: TextContentDeclaration;
490
492
  effects?: StylePropertyObject[];
@@ -543,4 +545,4 @@ declare function normalizeDocument(doc: Document): DocumentDeclaration;
543
545
 
544
546
  declare function clearUndef<T>(obj: T, deep?: boolean): T;
545
547
 
546
- export { type Align, type AudioDeclaration, type AudioProperty, type BackgroundDeclaration, type BackgroundProperty, type BackgroundPropertyObject, type BaseBackgroundDeclaration, type BaseForegroundDeclaration, type BaseOuterShadowDeclaration, type BorderStyle, type BoxShadow, type BoxSizing, type CmykColor, type CmykaColor, type Color, type ColorDeclaration, type Direction, type Display, type Document, type DocumentDeclaration, type EffectDeclaration, type EffectProperty, type EffectPropertyObject, type Element, type ElementDeclaration, type ElementStyleDeclaration, type FillDeclaration, type FillProperty, type FillPropertyObject, type FillRule, type FlexDirection, type FlexWrap, type FontKerning, type FontStyle, type FontWeight, type ForegroundDeclaration, type ForegroundProperty, type ForegroundPropertyObject, type FragmentContent, type GeometryDeclaration, type GeometryPathDeclaration, type GeometryPathStyle, type GeometryProperty, type GradientFillDeclaration, type HeadEnd, type HighlightColormap, type HighlightDeclaration, type HighlightImage, type HighlightLine, type HighlightReferImage, type HighlightSize, type HighlightStyleDeclaration, type HighlightThickness, type HslColor, type HslaColor, type HsvColor, type HsvaColor, type HwbColor, type HwbaColor, type InnerShadowDeclaration, type InnerShadowProperty, type InnerShadowPropertyObject, type Justify, type LabColor, type LabaColor, type LayoutStyleDeclaration, type LchColor, type LchaColor, type LineEndSize, type LineEndType, type ListStyleColormap, type ListStyleDeclaration, type ListStyleImage, type ListStylePosition, type ListStyleSize, type ListStyleStyleDeclaration, type ListStyleType, type MetaProperty, type Node, type None, type ObjectColor, type OuterShadowDeclaration, type OuterShadowProperty, type OuterShadowPropertyObject, type OutlineDeclaration, type OutlineFillDeclaration, type OutlineProperty, type OutlinePropertyObject, type OutlineStyle, type Overflow, type ParagraphContent, type PointerEvents, type Position, type RgbColor, type RgbString, type RgbaColor, type SVGPathData, type ShadowDeclaration, type ShadowProperty, type ShadowPropertyObject, type ShadowStyleDeclaration, type SoftEdgeDeclaration, type SoftEdgeProperty, type SolidFillDeclaration, type StrokeLinecap, type StrokeLinejoin, type StyleDeclaration, type StyleProperty, type StylePropertyObject, type StyleUnit, type TailEnd, type TextAlign, type TextContent, type TextContentDeclaration, type TextContentFlat, type TextDeclaration, type TextDecoration, type TextDrawStyleDeclaration, type TextInlineStyleDeclaration, type TextLineStyleDeclaration, type TextOrientation, type TextProperty, type TextStyleDeclaration, type TextTransform, type TextWrap, type TextureFillDeclaration, type TextureFillSourceRect, type TextureFillSourceURL, type TextureFillStretch, type TextureFillStretchRect, type TextureFillTile, type TransformStyleDeclaration, type Uint32Color, type VerticalAlign, type VideoDeclaration, type VideoProperty, type Visibility, type WritingMode, type XyzColor, type XyzaColor, clearUndef, getDefaultElementStyle, getDefaultHighlightStyle, getDefaultInnerShadow, getDefaultLayoutStyle, getDefaultListStyleStyle, getDefaultOuterShadow, getDefaultShadowStyle, getDefaultStyle, getDefaultTextInlineStyle, getDefaultTextLineStyle, getDefaultTextStyle, getDefaultTransformStyle, normalizeAudio, normalizeBackground, normalizeColor, normalizeDocument, normalizeEffect, normalizeElement, normalizeFill, normalizeForeground, normalizeGeometry, normalizeInnerShadow, normalizeOuterShadow, normalizeOutline, normalizeShadow, normalizeSoftEdge, normalizeStyle, normalizeText, normalizeTextContent, normalizeVideo, parseColor };
548
+ export { type Align, type AudioDeclaration, type AudioProperty, type BackgroundDeclaration, type BackgroundProperty, type BackgroundPropertyObject, type BackgroundSize, type BaseBackgroundDeclaration, type BaseForegroundDeclaration, type BaseOuterShadowDeclaration, type BorderStyle, type BoxShadow, type BoxSizing, type CmykColor, type CmykaColor, type Color, type ColorDeclaration, type Direction, type Display, type Document, type DocumentDeclaration, type EffectDeclaration, type EffectProperty, type EffectPropertyObject, type Element, type ElementDeclaration, type ElementStyleDeclaration, type FillDeclaration, type FillProperty, type FillPropertyObject, type FillRule, type FlexDirection, type FlexWrap, type FontKerning, type FontStyle, type FontWeight, type ForegroundDeclaration, type ForegroundProperty, type ForegroundPropertyObject, type FragmentContent, type GeometryDeclaration, type GeometryPathDeclaration, type GeometryPathStyle, type GeometryProperty, type GradientFillDeclaration, type HeadEnd, type HighlightColormap, type HighlightDeclaration, type HighlightImage, type HighlightLine, type HighlightReferImage, type HighlightSize, type HighlightStyleDeclaration, type HighlightThickness, type HslColor, type HslaColor, type HsvColor, type HsvaColor, type HwbColor, type HwbaColor, type InnerShadowDeclaration, type InnerShadowProperty, type InnerShadowPropertyObject, type Justify, type LabColor, type LabaColor, type LayoutStyleDeclaration, type LchColor, type LchaColor, type LineEndSize, type LineEndType, type ListStyleColormap, type ListStyleDeclaration, type ListStyleImage, type ListStylePosition, type ListStyleSize, type ListStyleStyleDeclaration, type ListStyleType, type MetaProperty, type Node, type None, type ObjectColor, type OuterShadowDeclaration, type OuterShadowProperty, type OuterShadowPropertyObject, type OutlineDeclaration, type OutlineFillDeclaration, type OutlineProperty, type OutlinePropertyObject, type OutlineStyle, type Overflow, type ParagraphContent, type PointerEvents, type Position, type RgbColor, type RgbString, type RgbaColor, type SVGPathData, type ShadowDeclaration, type ShadowProperty, type ShadowPropertyObject, type ShadowStyleDeclaration, type SoftEdgeDeclaration, type SoftEdgeProperty, type SolidFillDeclaration, type StrokeLinecap, type StrokeLinejoin, type StyleDeclaration, type StyleProperty, type StylePropertyObject, type StyleUnit, type TailEnd, type TextAlign, type TextContent, type TextContentDeclaration, type TextContentFlat, type TextDeclaration, type TextDecoration, type TextDrawStyleDeclaration, type TextInlineStyleDeclaration, type TextLineStyleDeclaration, type TextOrientation, type TextProperty, type TextStyleDeclaration, type TextTransform, type TextWrap, type TextureFillDeclaration, type TextureFillSourceRect, type TextureFillSourceURL, type TextureFillStretch, type TextureFillStretchRect, type TextureFillTile, type TransformStyleDeclaration, type Uint32Color, type VerticalAlign, type VideoDeclaration, type VideoProperty, type Visibility, type WritingMode, type XyzColor, type XyzaColor, clearUndef, getDefaultElementStyle, getDefaultHighlightStyle, getDefaultInnerShadow, getDefaultLayoutStyle, getDefaultListStyleStyle, getDefaultOuterShadow, getDefaultShadowStyle, getDefaultStyle, getDefaultTextInlineStyle, getDefaultTextLineStyle, getDefaultTextStyle, getDefaultTransformStyle, normalizeAudio, normalizeBackground, normalizeColor, normalizeDocument, normalizeEffect, normalizeElement, normalizeFill, normalizeForeground, normalizeGeometry, normalizeInnerShadow, normalizeOuterShadow, normalizeOutline, normalizeShadow, normalizeSoftEdge, normalizeStyle, normalizeText, normalizeTextContent, normalizeVideo, parseColor };
package/dist/index.d.mts CHANGED
@@ -273,15 +273,15 @@ type ShadowPropertyObject = Partial<ShadowDeclaration> & {
273
273
  color?: Color;
274
274
  };
275
275
  type ShadowProperty = None | BoxShadow | ShadowPropertyObject;
276
- type ShadowStyleDeclaration = Partial<{
276
+ declare function normalizeShadow(shadow?: ShadowProperty): ShadowDeclaration | undefined;
277
+ interface ShadowStyleDeclaration {
277
278
  boxShadow: BoxShadow;
278
- shadowColor: ColorDeclaration;
279
- shadowOffsetX: number;
280
- shadowOffsetY: number;
281
- shadowBlur: number;
282
- }>;
279
+ shadowColor?: ColorDeclaration;
280
+ shadowOffsetX?: number;
281
+ shadowOffsetY?: number;
282
+ shadowBlur?: number;
283
+ }
283
284
  declare function getDefaultShadowStyle(): ShadowStyleDeclaration;
284
- declare function normalizeShadow(shadow?: ShadowProperty): ShadowDeclaration | undefined;
285
285
 
286
286
  type StyleUnit = `${number}%` | number;
287
287
  type Display = 'flex' | 'contents';
@@ -318,7 +318,7 @@ type HighlightColormap = None | Record<string, string>;
318
318
  type HighlightSize = StyleUnit | `${number}rem` | 'cover';
319
319
  type HighlightThickness = StyleUnit;
320
320
 
321
- type LayoutStyleDeclaration = Partial<{
321
+ interface LayoutStyleDeclaration {
322
322
  overflow: Overflow;
323
323
  direction: Direction;
324
324
  display: Display;
@@ -361,10 +361,10 @@ type LayoutStyleDeclaration = Partial<{
361
361
  paddingRight: StyleUnit;
362
362
  paddingBottom: StyleUnit;
363
363
  padding: StyleUnit;
364
- }>;
365
- declare function getDefaultLayoutStyle(): LayoutStyleDeclaration;
364
+ }
365
+ declare function getDefaultLayoutStyle(): Partial<LayoutStyleDeclaration>;
366
366
 
367
- type TransformStyleDeclaration = Partial<{
367
+ interface TransformStyleDeclaration {
368
368
  rotate: number;
369
369
  scaleX: number;
370
370
  scaleY: number;
@@ -374,11 +374,13 @@ type TransformStyleDeclaration = Partial<{
374
374
  translateY: number;
375
375
  transform: None | string;
376
376
  transformOrigin: string;
377
- }>;
378
- declare function getDefaultTransformStyle(): Required<TransformStyleDeclaration>;
377
+ }
378
+ declare function getDefaultTransformStyle(): TransformStyleDeclaration;
379
379
 
380
- type ElementStyleDeclaration = LayoutStyleDeclaration & TransformStyleDeclaration & ShadowStyleDeclaration & Partial<{
380
+ type BackgroundSize = 'contain' | 'cover' | string | 'stretch' | 'rigid';
381
+ type ElementStyleDeclaration = Partial<LayoutStyleDeclaration> & TransformStyleDeclaration & ShadowStyleDeclaration & {
381
382
  backgroundImage: None | string;
383
+ backgroundSize: BackgroundSize;
382
384
  backgroundColor: None | ColorDeclaration;
383
385
  borderRadius: number;
384
386
  borderColor: None | ColorDeclaration;
@@ -392,7 +394,7 @@ type ElementStyleDeclaration = LayoutStyleDeclaration & TransformStyleDeclaratio
392
394
  opacity: number;
393
395
  pointerEvents: PointerEvents;
394
396
  maskImage: None | string;
395
- }>;
397
+ };
396
398
  declare function getDefaultElementStyle(): ElementStyleDeclaration;
397
399
 
398
400
  interface HighlightDeclaration {
@@ -403,7 +405,7 @@ interface HighlightDeclaration {
403
405
  size: HighlightSize;
404
406
  thickness: HighlightThickness;
405
407
  }
406
- type HighlightStyleDeclaration = Partial<{
408
+ interface HighlightStyleDeclaration {
407
409
  highlight: Partial<HighlightDeclaration>;
408
410
  highlightImage: HighlightImage;
409
411
  highlightReferImage: HighlightReferImage;
@@ -411,7 +413,7 @@ type HighlightStyleDeclaration = Partial<{
411
413
  highlightLine: HighlightLine;
412
414
  highlightSize: HighlightSize;
413
415
  highlightThickness: HighlightThickness;
414
- }>;
416
+ }
415
417
  declare function getDefaultHighlightStyle(): Required<HighlightStyleDeclaration>;
416
418
 
417
419
  interface ListStyleDeclaration {
@@ -421,17 +423,17 @@ interface ListStyleDeclaration {
421
423
  size: ListStyleSize;
422
424
  position: ListStylePosition;
423
425
  }
424
- type ListStyleStyleDeclaration = Partial<{
426
+ interface ListStyleStyleDeclaration {
425
427
  listStyle: Partial<ListStyleDeclaration>;
426
428
  listStyleType: ListStyleType;
427
429
  listStyleImage: ListStyleImage;
428
430
  listStyleColormap: ListStyleColormap;
429
431
  listStyleSize: ListStyleSize;
430
432
  listStylePosition: ListStylePosition;
431
- }>;
432
- declare function getDefaultListStyleStyle(): Required<ListStyleStyleDeclaration>;
433
+ }
434
+ declare function getDefaultListStyleStyle(): ListStyleStyleDeclaration;
433
435
 
434
- type TextInlineStyleDeclaration = HighlightStyleDeclaration & Partial<{
436
+ type TextInlineStyleDeclaration = HighlightStyleDeclaration & {
435
437
  color: ColorDeclaration;
436
438
  verticalAlign: VerticalAlign;
437
439
  letterSpacing: number;
@@ -444,22 +446,22 @@ type TextInlineStyleDeclaration = HighlightStyleDeclaration & Partial<{
444
446
  textTransform: TextTransform;
445
447
  textOrientation: TextOrientation;
446
448
  textDecoration: TextDecoration;
447
- }>;
449
+ };
448
450
  declare function getDefaultTextInlineStyle(): Required<TextInlineStyleDeclaration>;
449
451
 
450
- type TextLineStyleDeclaration = ListStyleStyleDeclaration & Partial<{
452
+ type TextLineStyleDeclaration = ListStyleStyleDeclaration & {
451
453
  writingMode: WritingMode;
452
454
  textWrap: TextWrap;
453
455
  textAlign: TextAlign;
454
456
  textIndent: number;
455
457
  lineHeight: number;
456
- }>;
457
- declare function getDefaultTextLineStyle(): Required<TextLineStyleDeclaration>;
458
+ };
459
+ declare function getDefaultTextLineStyle(): TextLineStyleDeclaration;
458
460
 
459
- type TextDrawStyleDeclaration = Partial<{
461
+ interface TextDrawStyleDeclaration {
460
462
  textStrokeWidth: number;
461
463
  textStrokeColor: ColorDeclaration;
462
- }>;
464
+ }
463
465
  type TextStyleDeclaration = TextLineStyleDeclaration & TextInlineStyleDeclaration & TextDrawStyleDeclaration;
464
466
  declare function getDefaultTextStyle(): Required<TextStyleDeclaration>;
465
467
 
@@ -484,7 +486,7 @@ interface ParagraphContent extends StylePropertyObject {
484
486
  }
485
487
  type TextContentFlat = string | FragmentContent | ParagraphContent | (string | FragmentContent)[];
486
488
  type TextContent = string | FragmentContent | ParagraphContent | TextContentFlat[];
487
- type TextContentDeclaration = (ParagraphContent & StyleDeclaration)[];
489
+ type TextContentDeclaration = (ParagraphContent & StylePropertyObject)[];
488
490
  interface TextDeclaration {
489
491
  content: TextContentDeclaration;
490
492
  effects?: StylePropertyObject[];
@@ -543,4 +545,4 @@ declare function normalizeDocument(doc: Document): DocumentDeclaration;
543
545
 
544
546
  declare function clearUndef<T>(obj: T, deep?: boolean): T;
545
547
 
546
- export { type Align, type AudioDeclaration, type AudioProperty, type BackgroundDeclaration, type BackgroundProperty, type BackgroundPropertyObject, type BaseBackgroundDeclaration, type BaseForegroundDeclaration, type BaseOuterShadowDeclaration, type BorderStyle, type BoxShadow, type BoxSizing, type CmykColor, type CmykaColor, type Color, type ColorDeclaration, type Direction, type Display, type Document, type DocumentDeclaration, type EffectDeclaration, type EffectProperty, type EffectPropertyObject, type Element, type ElementDeclaration, type ElementStyleDeclaration, type FillDeclaration, type FillProperty, type FillPropertyObject, type FillRule, type FlexDirection, type FlexWrap, type FontKerning, type FontStyle, type FontWeight, type ForegroundDeclaration, type ForegroundProperty, type ForegroundPropertyObject, type FragmentContent, type GeometryDeclaration, type GeometryPathDeclaration, type GeometryPathStyle, type GeometryProperty, type GradientFillDeclaration, type HeadEnd, type HighlightColormap, type HighlightDeclaration, type HighlightImage, type HighlightLine, type HighlightReferImage, type HighlightSize, type HighlightStyleDeclaration, type HighlightThickness, type HslColor, type HslaColor, type HsvColor, type HsvaColor, type HwbColor, type HwbaColor, type InnerShadowDeclaration, type InnerShadowProperty, type InnerShadowPropertyObject, type Justify, type LabColor, type LabaColor, type LayoutStyleDeclaration, type LchColor, type LchaColor, type LineEndSize, type LineEndType, type ListStyleColormap, type ListStyleDeclaration, type ListStyleImage, type ListStylePosition, type ListStyleSize, type ListStyleStyleDeclaration, type ListStyleType, type MetaProperty, type Node, type None, type ObjectColor, type OuterShadowDeclaration, type OuterShadowProperty, type OuterShadowPropertyObject, type OutlineDeclaration, type OutlineFillDeclaration, type OutlineProperty, type OutlinePropertyObject, type OutlineStyle, type Overflow, type ParagraphContent, type PointerEvents, type Position, type RgbColor, type RgbString, type RgbaColor, type SVGPathData, type ShadowDeclaration, type ShadowProperty, type ShadowPropertyObject, type ShadowStyleDeclaration, type SoftEdgeDeclaration, type SoftEdgeProperty, type SolidFillDeclaration, type StrokeLinecap, type StrokeLinejoin, type StyleDeclaration, type StyleProperty, type StylePropertyObject, type StyleUnit, type TailEnd, type TextAlign, type TextContent, type TextContentDeclaration, type TextContentFlat, type TextDeclaration, type TextDecoration, type TextDrawStyleDeclaration, type TextInlineStyleDeclaration, type TextLineStyleDeclaration, type TextOrientation, type TextProperty, type TextStyleDeclaration, type TextTransform, type TextWrap, type TextureFillDeclaration, type TextureFillSourceRect, type TextureFillSourceURL, type TextureFillStretch, type TextureFillStretchRect, type TextureFillTile, type TransformStyleDeclaration, type Uint32Color, type VerticalAlign, type VideoDeclaration, type VideoProperty, type Visibility, type WritingMode, type XyzColor, type XyzaColor, clearUndef, getDefaultElementStyle, getDefaultHighlightStyle, getDefaultInnerShadow, getDefaultLayoutStyle, getDefaultListStyleStyle, getDefaultOuterShadow, getDefaultShadowStyle, getDefaultStyle, getDefaultTextInlineStyle, getDefaultTextLineStyle, getDefaultTextStyle, getDefaultTransformStyle, normalizeAudio, normalizeBackground, normalizeColor, normalizeDocument, normalizeEffect, normalizeElement, normalizeFill, normalizeForeground, normalizeGeometry, normalizeInnerShadow, normalizeOuterShadow, normalizeOutline, normalizeShadow, normalizeSoftEdge, normalizeStyle, normalizeText, normalizeTextContent, normalizeVideo, parseColor };
548
+ export { type Align, type AudioDeclaration, type AudioProperty, type BackgroundDeclaration, type BackgroundProperty, type BackgroundPropertyObject, type BackgroundSize, type BaseBackgroundDeclaration, type BaseForegroundDeclaration, type BaseOuterShadowDeclaration, type BorderStyle, type BoxShadow, type BoxSizing, type CmykColor, type CmykaColor, type Color, type ColorDeclaration, type Direction, type Display, type Document, type DocumentDeclaration, type EffectDeclaration, type EffectProperty, type EffectPropertyObject, type Element, type ElementDeclaration, type ElementStyleDeclaration, type FillDeclaration, type FillProperty, type FillPropertyObject, type FillRule, type FlexDirection, type FlexWrap, type FontKerning, type FontStyle, type FontWeight, type ForegroundDeclaration, type ForegroundProperty, type ForegroundPropertyObject, type FragmentContent, type GeometryDeclaration, type GeometryPathDeclaration, type GeometryPathStyle, type GeometryProperty, type GradientFillDeclaration, type HeadEnd, type HighlightColormap, type HighlightDeclaration, type HighlightImage, type HighlightLine, type HighlightReferImage, type HighlightSize, type HighlightStyleDeclaration, type HighlightThickness, type HslColor, type HslaColor, type HsvColor, type HsvaColor, type HwbColor, type HwbaColor, type InnerShadowDeclaration, type InnerShadowProperty, type InnerShadowPropertyObject, type Justify, type LabColor, type LabaColor, type LayoutStyleDeclaration, type LchColor, type LchaColor, type LineEndSize, type LineEndType, type ListStyleColormap, type ListStyleDeclaration, type ListStyleImage, type ListStylePosition, type ListStyleSize, type ListStyleStyleDeclaration, type ListStyleType, type MetaProperty, type Node, type None, type ObjectColor, type OuterShadowDeclaration, type OuterShadowProperty, type OuterShadowPropertyObject, type OutlineDeclaration, type OutlineFillDeclaration, type OutlineProperty, type OutlinePropertyObject, type OutlineStyle, type Overflow, type ParagraphContent, type PointerEvents, type Position, type RgbColor, type RgbString, type RgbaColor, type SVGPathData, type ShadowDeclaration, type ShadowProperty, type ShadowPropertyObject, type ShadowStyleDeclaration, type SoftEdgeDeclaration, type SoftEdgeProperty, type SolidFillDeclaration, type StrokeLinecap, type StrokeLinejoin, type StyleDeclaration, type StyleProperty, type StylePropertyObject, type StyleUnit, type TailEnd, type TextAlign, type TextContent, type TextContentDeclaration, type TextContentFlat, type TextDeclaration, type TextDecoration, type TextDrawStyleDeclaration, type TextInlineStyleDeclaration, type TextLineStyleDeclaration, type TextOrientation, type TextProperty, type TextStyleDeclaration, type TextTransform, type TextWrap, type TextureFillDeclaration, type TextureFillSourceRect, type TextureFillSourceURL, type TextureFillStretch, type TextureFillStretchRect, type TextureFillTile, type TransformStyleDeclaration, type Uint32Color, type VerticalAlign, type VideoDeclaration, type VideoProperty, type Visibility, type WritingMode, type XyzColor, type XyzaColor, clearUndef, getDefaultElementStyle, getDefaultHighlightStyle, getDefaultInnerShadow, getDefaultLayoutStyle, getDefaultListStyleStyle, getDefaultOuterShadow, getDefaultShadowStyle, getDefaultStyle, getDefaultTextInlineStyle, getDefaultTextLineStyle, getDefaultTextStyle, getDefaultTransformStyle, normalizeAudio, normalizeBackground, normalizeColor, normalizeDocument, normalizeEffect, normalizeElement, normalizeFill, normalizeForeground, normalizeGeometry, normalizeInnerShadow, normalizeOuterShadow, normalizeOutline, normalizeShadow, normalizeSoftEdge, normalizeStyle, normalizeText, normalizeTextContent, normalizeVideo, parseColor };
package/dist/index.d.ts CHANGED
@@ -273,15 +273,15 @@ type ShadowPropertyObject = Partial<ShadowDeclaration> & {
273
273
  color?: Color;
274
274
  };
275
275
  type ShadowProperty = None | BoxShadow | ShadowPropertyObject;
276
- type ShadowStyleDeclaration = Partial<{
276
+ declare function normalizeShadow(shadow?: ShadowProperty): ShadowDeclaration | undefined;
277
+ interface ShadowStyleDeclaration {
277
278
  boxShadow: BoxShadow;
278
- shadowColor: ColorDeclaration;
279
- shadowOffsetX: number;
280
- shadowOffsetY: number;
281
- shadowBlur: number;
282
- }>;
279
+ shadowColor?: ColorDeclaration;
280
+ shadowOffsetX?: number;
281
+ shadowOffsetY?: number;
282
+ shadowBlur?: number;
283
+ }
283
284
  declare function getDefaultShadowStyle(): ShadowStyleDeclaration;
284
- declare function normalizeShadow(shadow?: ShadowProperty): ShadowDeclaration | undefined;
285
285
 
286
286
  type StyleUnit = `${number}%` | number;
287
287
  type Display = 'flex' | 'contents';
@@ -318,7 +318,7 @@ type HighlightColormap = None | Record<string, string>;
318
318
  type HighlightSize = StyleUnit | `${number}rem` | 'cover';
319
319
  type HighlightThickness = StyleUnit;
320
320
 
321
- type LayoutStyleDeclaration = Partial<{
321
+ interface LayoutStyleDeclaration {
322
322
  overflow: Overflow;
323
323
  direction: Direction;
324
324
  display: Display;
@@ -361,10 +361,10 @@ type LayoutStyleDeclaration = Partial<{
361
361
  paddingRight: StyleUnit;
362
362
  paddingBottom: StyleUnit;
363
363
  padding: StyleUnit;
364
- }>;
365
- declare function getDefaultLayoutStyle(): LayoutStyleDeclaration;
364
+ }
365
+ declare function getDefaultLayoutStyle(): Partial<LayoutStyleDeclaration>;
366
366
 
367
- type TransformStyleDeclaration = Partial<{
367
+ interface TransformStyleDeclaration {
368
368
  rotate: number;
369
369
  scaleX: number;
370
370
  scaleY: number;
@@ -374,11 +374,13 @@ type TransformStyleDeclaration = Partial<{
374
374
  translateY: number;
375
375
  transform: None | string;
376
376
  transformOrigin: string;
377
- }>;
378
- declare function getDefaultTransformStyle(): Required<TransformStyleDeclaration>;
377
+ }
378
+ declare function getDefaultTransformStyle(): TransformStyleDeclaration;
379
379
 
380
- type ElementStyleDeclaration = LayoutStyleDeclaration & TransformStyleDeclaration & ShadowStyleDeclaration & Partial<{
380
+ type BackgroundSize = 'contain' | 'cover' | string | 'stretch' | 'rigid';
381
+ type ElementStyleDeclaration = Partial<LayoutStyleDeclaration> & TransformStyleDeclaration & ShadowStyleDeclaration & {
381
382
  backgroundImage: None | string;
383
+ backgroundSize: BackgroundSize;
382
384
  backgroundColor: None | ColorDeclaration;
383
385
  borderRadius: number;
384
386
  borderColor: None | ColorDeclaration;
@@ -392,7 +394,7 @@ type ElementStyleDeclaration = LayoutStyleDeclaration & TransformStyleDeclaratio
392
394
  opacity: number;
393
395
  pointerEvents: PointerEvents;
394
396
  maskImage: None | string;
395
- }>;
397
+ };
396
398
  declare function getDefaultElementStyle(): ElementStyleDeclaration;
397
399
 
398
400
  interface HighlightDeclaration {
@@ -403,7 +405,7 @@ interface HighlightDeclaration {
403
405
  size: HighlightSize;
404
406
  thickness: HighlightThickness;
405
407
  }
406
- type HighlightStyleDeclaration = Partial<{
408
+ interface HighlightStyleDeclaration {
407
409
  highlight: Partial<HighlightDeclaration>;
408
410
  highlightImage: HighlightImage;
409
411
  highlightReferImage: HighlightReferImage;
@@ -411,7 +413,7 @@ type HighlightStyleDeclaration = Partial<{
411
413
  highlightLine: HighlightLine;
412
414
  highlightSize: HighlightSize;
413
415
  highlightThickness: HighlightThickness;
414
- }>;
416
+ }
415
417
  declare function getDefaultHighlightStyle(): Required<HighlightStyleDeclaration>;
416
418
 
417
419
  interface ListStyleDeclaration {
@@ -421,17 +423,17 @@ interface ListStyleDeclaration {
421
423
  size: ListStyleSize;
422
424
  position: ListStylePosition;
423
425
  }
424
- type ListStyleStyleDeclaration = Partial<{
426
+ interface ListStyleStyleDeclaration {
425
427
  listStyle: Partial<ListStyleDeclaration>;
426
428
  listStyleType: ListStyleType;
427
429
  listStyleImage: ListStyleImage;
428
430
  listStyleColormap: ListStyleColormap;
429
431
  listStyleSize: ListStyleSize;
430
432
  listStylePosition: ListStylePosition;
431
- }>;
432
- declare function getDefaultListStyleStyle(): Required<ListStyleStyleDeclaration>;
433
+ }
434
+ declare function getDefaultListStyleStyle(): ListStyleStyleDeclaration;
433
435
 
434
- type TextInlineStyleDeclaration = HighlightStyleDeclaration & Partial<{
436
+ type TextInlineStyleDeclaration = HighlightStyleDeclaration & {
435
437
  color: ColorDeclaration;
436
438
  verticalAlign: VerticalAlign;
437
439
  letterSpacing: number;
@@ -444,22 +446,22 @@ type TextInlineStyleDeclaration = HighlightStyleDeclaration & Partial<{
444
446
  textTransform: TextTransform;
445
447
  textOrientation: TextOrientation;
446
448
  textDecoration: TextDecoration;
447
- }>;
449
+ };
448
450
  declare function getDefaultTextInlineStyle(): Required<TextInlineStyleDeclaration>;
449
451
 
450
- type TextLineStyleDeclaration = ListStyleStyleDeclaration & Partial<{
452
+ type TextLineStyleDeclaration = ListStyleStyleDeclaration & {
451
453
  writingMode: WritingMode;
452
454
  textWrap: TextWrap;
453
455
  textAlign: TextAlign;
454
456
  textIndent: number;
455
457
  lineHeight: number;
456
- }>;
457
- declare function getDefaultTextLineStyle(): Required<TextLineStyleDeclaration>;
458
+ };
459
+ declare function getDefaultTextLineStyle(): TextLineStyleDeclaration;
458
460
 
459
- type TextDrawStyleDeclaration = Partial<{
461
+ interface TextDrawStyleDeclaration {
460
462
  textStrokeWidth: number;
461
463
  textStrokeColor: ColorDeclaration;
462
- }>;
464
+ }
463
465
  type TextStyleDeclaration = TextLineStyleDeclaration & TextInlineStyleDeclaration & TextDrawStyleDeclaration;
464
466
  declare function getDefaultTextStyle(): Required<TextStyleDeclaration>;
465
467
 
@@ -484,7 +486,7 @@ interface ParagraphContent extends StylePropertyObject {
484
486
  }
485
487
  type TextContentFlat = string | FragmentContent | ParagraphContent | (string | FragmentContent)[];
486
488
  type TextContent = string | FragmentContent | ParagraphContent | TextContentFlat[];
487
- type TextContentDeclaration = (ParagraphContent & StyleDeclaration)[];
489
+ type TextContentDeclaration = (ParagraphContent & StylePropertyObject)[];
488
490
  interface TextDeclaration {
489
491
  content: TextContentDeclaration;
490
492
  effects?: StylePropertyObject[];
@@ -543,4 +545,4 @@ declare function normalizeDocument(doc: Document): DocumentDeclaration;
543
545
 
544
546
  declare function clearUndef<T>(obj: T, deep?: boolean): T;
545
547
 
546
- export { type Align, type AudioDeclaration, type AudioProperty, type BackgroundDeclaration, type BackgroundProperty, type BackgroundPropertyObject, type BaseBackgroundDeclaration, type BaseForegroundDeclaration, type BaseOuterShadowDeclaration, type BorderStyle, type BoxShadow, type BoxSizing, type CmykColor, type CmykaColor, type Color, type ColorDeclaration, type Direction, type Display, type Document, type DocumentDeclaration, type EffectDeclaration, type EffectProperty, type EffectPropertyObject, type Element, type ElementDeclaration, type ElementStyleDeclaration, type FillDeclaration, type FillProperty, type FillPropertyObject, type FillRule, type FlexDirection, type FlexWrap, type FontKerning, type FontStyle, type FontWeight, type ForegroundDeclaration, type ForegroundProperty, type ForegroundPropertyObject, type FragmentContent, type GeometryDeclaration, type GeometryPathDeclaration, type GeometryPathStyle, type GeometryProperty, type GradientFillDeclaration, type HeadEnd, type HighlightColormap, type HighlightDeclaration, type HighlightImage, type HighlightLine, type HighlightReferImage, type HighlightSize, type HighlightStyleDeclaration, type HighlightThickness, type HslColor, type HslaColor, type HsvColor, type HsvaColor, type HwbColor, type HwbaColor, type InnerShadowDeclaration, type InnerShadowProperty, type InnerShadowPropertyObject, type Justify, type LabColor, type LabaColor, type LayoutStyleDeclaration, type LchColor, type LchaColor, type LineEndSize, type LineEndType, type ListStyleColormap, type ListStyleDeclaration, type ListStyleImage, type ListStylePosition, type ListStyleSize, type ListStyleStyleDeclaration, type ListStyleType, type MetaProperty, type Node, type None, type ObjectColor, type OuterShadowDeclaration, type OuterShadowProperty, type OuterShadowPropertyObject, type OutlineDeclaration, type OutlineFillDeclaration, type OutlineProperty, type OutlinePropertyObject, type OutlineStyle, type Overflow, type ParagraphContent, type PointerEvents, type Position, type RgbColor, type RgbString, type RgbaColor, type SVGPathData, type ShadowDeclaration, type ShadowProperty, type ShadowPropertyObject, type ShadowStyleDeclaration, type SoftEdgeDeclaration, type SoftEdgeProperty, type SolidFillDeclaration, type StrokeLinecap, type StrokeLinejoin, type StyleDeclaration, type StyleProperty, type StylePropertyObject, type StyleUnit, type TailEnd, type TextAlign, type TextContent, type TextContentDeclaration, type TextContentFlat, type TextDeclaration, type TextDecoration, type TextDrawStyleDeclaration, type TextInlineStyleDeclaration, type TextLineStyleDeclaration, type TextOrientation, type TextProperty, type TextStyleDeclaration, type TextTransform, type TextWrap, type TextureFillDeclaration, type TextureFillSourceRect, type TextureFillSourceURL, type TextureFillStretch, type TextureFillStretchRect, type TextureFillTile, type TransformStyleDeclaration, type Uint32Color, type VerticalAlign, type VideoDeclaration, type VideoProperty, type Visibility, type WritingMode, type XyzColor, type XyzaColor, clearUndef, getDefaultElementStyle, getDefaultHighlightStyle, getDefaultInnerShadow, getDefaultLayoutStyle, getDefaultListStyleStyle, getDefaultOuterShadow, getDefaultShadowStyle, getDefaultStyle, getDefaultTextInlineStyle, getDefaultTextLineStyle, getDefaultTextStyle, getDefaultTransformStyle, normalizeAudio, normalizeBackground, normalizeColor, normalizeDocument, normalizeEffect, normalizeElement, normalizeFill, normalizeForeground, normalizeGeometry, normalizeInnerShadow, normalizeOuterShadow, normalizeOutline, normalizeShadow, normalizeSoftEdge, normalizeStyle, normalizeText, normalizeTextContent, normalizeVideo, parseColor };
548
+ export { type Align, type AudioDeclaration, type AudioProperty, type BackgroundDeclaration, type BackgroundProperty, type BackgroundPropertyObject, type BackgroundSize, type BaseBackgroundDeclaration, type BaseForegroundDeclaration, type BaseOuterShadowDeclaration, type BorderStyle, type BoxShadow, type BoxSizing, type CmykColor, type CmykaColor, type Color, type ColorDeclaration, type Direction, type Display, type Document, type DocumentDeclaration, type EffectDeclaration, type EffectProperty, type EffectPropertyObject, type Element, type ElementDeclaration, type ElementStyleDeclaration, type FillDeclaration, type FillProperty, type FillPropertyObject, type FillRule, type FlexDirection, type FlexWrap, type FontKerning, type FontStyle, type FontWeight, type ForegroundDeclaration, type ForegroundProperty, type ForegroundPropertyObject, type FragmentContent, type GeometryDeclaration, type GeometryPathDeclaration, type GeometryPathStyle, type GeometryProperty, type GradientFillDeclaration, type HeadEnd, type HighlightColormap, type HighlightDeclaration, type HighlightImage, type HighlightLine, type HighlightReferImage, type HighlightSize, type HighlightStyleDeclaration, type HighlightThickness, type HslColor, type HslaColor, type HsvColor, type HsvaColor, type HwbColor, type HwbaColor, type InnerShadowDeclaration, type InnerShadowProperty, type InnerShadowPropertyObject, type Justify, type LabColor, type LabaColor, type LayoutStyleDeclaration, type LchColor, type LchaColor, type LineEndSize, type LineEndType, type ListStyleColormap, type ListStyleDeclaration, type ListStyleImage, type ListStylePosition, type ListStyleSize, type ListStyleStyleDeclaration, type ListStyleType, type MetaProperty, type Node, type None, type ObjectColor, type OuterShadowDeclaration, type OuterShadowProperty, type OuterShadowPropertyObject, type OutlineDeclaration, type OutlineFillDeclaration, type OutlineProperty, type OutlinePropertyObject, type OutlineStyle, type Overflow, type ParagraphContent, type PointerEvents, type Position, type RgbColor, type RgbString, type RgbaColor, type SVGPathData, type ShadowDeclaration, type ShadowProperty, type ShadowPropertyObject, type ShadowStyleDeclaration, type SoftEdgeDeclaration, type SoftEdgeProperty, type SolidFillDeclaration, type StrokeLinecap, type StrokeLinejoin, type StyleDeclaration, type StyleProperty, type StylePropertyObject, type StyleUnit, type TailEnd, type TextAlign, type TextContent, type TextContentDeclaration, type TextContentFlat, type TextDeclaration, type TextDecoration, type TextDrawStyleDeclaration, type TextInlineStyleDeclaration, type TextLineStyleDeclaration, type TextOrientation, type TextProperty, type TextStyleDeclaration, type TextTransform, type TextWrap, type TextureFillDeclaration, type TextureFillSourceRect, type TextureFillSourceURL, type TextureFillStretch, type TextureFillStretchRect, type TextureFillTile, type TransformStyleDeclaration, type Uint32Color, type VerticalAlign, type VideoDeclaration, type VideoProperty, type Visibility, type WritingMode, type XyzColor, type XyzaColor, clearUndef, getDefaultElementStyle, getDefaultHighlightStyle, getDefaultInnerShadow, getDefaultLayoutStyle, getDefaultListStyleStyle, getDefaultOuterShadow, getDefaultShadowStyle, getDefaultStyle, getDefaultTextInlineStyle, getDefaultTextLineStyle, getDefaultTextStyle, getDefaultTransformStyle, normalizeAudio, normalizeBackground, normalizeColor, normalizeDocument, normalizeEffect, normalizeElement, normalizeFill, normalizeForeground, normalizeGeometry, normalizeInnerShadow, normalizeOuterShadow, normalizeOutline, normalizeShadow, normalizeSoftEdge, normalizeStyle, normalizeText, normalizeTextContent, normalizeVideo, parseColor };
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- (function(i,v){typeof exports=="object"&&typeof module<"u"?v(exports):typeof define=="function"&&define.amd?define(["exports"],v):(i=typeof globalThis<"u"?globalThis:i||self,v(i.modernIdoc={}))})(this,function(i){"use strict";function v(n){if(!(!n||n==="none"))return typeof n=="string"?{src:n}:n}var ln={grad:.9,turn:360,rad:360/(2*Math.PI)},c=function(n){return typeof n=="string"?n.length>0:typeof n=="number"},l=function(n,t,e){return t===void 0&&(t=0),e===void 0&&(e=Math.pow(10,t)),Math.round(e*n)/e+0},s=function(n,t,e){return t===void 0&&(t=0),e===void 0&&(e=1),n>e?e:n>t?n:t},A=function(n){return(n=isFinite(n)?n%360:0)>0?n:n+360},H=function(n){return{r:s(n.r,0,255),g:s(n.g,0,255),b:s(n.b,0,255),a:s(n.a)}},S=function(n){return{r:l(n.r),g:l(n.g),b:l(n.b),a:l(n.a,3)}},fn=/^#([0-9a-f]{3,8})$/i,y=function(n){var t=n.toString(16);return t.length<2?"0"+t:t},E=function(n){var t=n.r,e=n.g,r=n.b,o=n.a,u=Math.max(t,e,r),a=u-Math.min(t,e,r),d=a?u===t?(e-r)/a:u===e?2+(r-t)/a:4+(t-e)/a:0;return{h:60*(d<0?d+6:d),s:u?a/u*100:0,v:u/255*100,a:o}},L=function(n){var t=n.h,e=n.s,r=n.v,o=n.a;t=t/360*6,e/=100,r/=100;var u=Math.floor(t),a=r*(1-e),d=r*(1-(t-u)*e),T=r*(1-(1-t+u)*e),k=u%6;return{r:255*[r,d,a,a,T,r][k],g:255*[T,r,r,d,a,a][k],b:255*[a,a,T,r,r,d][k],a:o}},O=function(n){return{h:A(n.h),s:s(n.s,0,100),l:s(n.l,0,100),a:s(n.a)}},M=function(n){return{h:l(n.h),s:l(n.s),l:l(n.l),a:l(n.a,3)}},R=function(n){return L((e=(t=n).s,{h:t.h,s:(e*=((r=t.l)<50?r:100-r)/100)>0?2*e/(r+e)*100:0,v:r+e,a:t.a}));var t,e,r},b=function(n){return{h:(t=E(n)).h,s:(o=(200-(e=t.s))*(r=t.v)/100)>0&&o<200?e*r/100/(o<=100?o:200-o)*100:0,l:o/2,a:t.a};var t,e,r,o},sn=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,dn=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,gn=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,cn=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,W={string:[[function(n){var t=fn.exec(n);return t?(n=t[1]).length<=4?{r:parseInt(n[0]+n[0],16),g:parseInt(n[1]+n[1],16),b:parseInt(n[2]+n[2],16),a:n.length===4?l(parseInt(n[3]+n[3],16)/255,2):1}:n.length===6||n.length===8?{r:parseInt(n.substr(0,2),16),g:parseInt(n.substr(2,2),16),b:parseInt(n.substr(4,2),16),a:n.length===8?l(parseInt(n.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(n){var t=gn.exec(n)||cn.exec(n);return t?t[2]!==t[4]||t[4]!==t[6]?null:H({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:t[7]===void 0?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(n){var t=sn.exec(n)||dn.exec(n);if(!t)return null;var e,r,o=O({h:(e=t[1],r=t[2],r===void 0&&(r="deg"),Number(e)*(ln[r]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return R(o)},"hsl"]],object:[[function(n){var t=n.r,e=n.g,r=n.b,o=n.a,u=o===void 0?1:o;return c(t)&&c(e)&&c(r)?H({r:Number(t),g:Number(e),b:Number(r),a:Number(u)}):null},"rgb"],[function(n){var t=n.h,e=n.s,r=n.l,o=n.a,u=o===void 0?1:o;if(!c(t)||!c(e)||!c(r))return null;var a=O({h:Number(t),s:Number(e),l:Number(r),a:Number(u)});return R(a)},"hsl"],[function(n){var t=n.h,e=n.s,r=n.v,o=n.a,u=o===void 0?1:o;if(!c(t)||!c(e)||!c(r))return null;var a=function(d){return{h:A(d.h),s:s(d.s,0,100),v:s(d.v,0,100),a:s(d.a)}}({h:Number(t),s:Number(e),v:Number(r),a:Number(u)});return L(a)},"hsv"]]},F=function(n,t){for(var e=0;e<t.length;e++){var r=t[e][0](n);if(r)return[r,t[e][1]]}return[null,void 0]},hn=function(n){return typeof n=="string"?F(n.trim(),W.string):typeof n=="object"&&n!==null?F(n,W.object):[null,void 0]},z=function(n,t){var e=b(n);return{h:e.h,s:s(e.s+100*t,0,100),l:e.l,a:e.a}},D=function(n){return(299*n.r+587*n.g+114*n.b)/1e3/255},$=function(n,t){var e=b(n);return{h:e.h,s:e.s,l:s(e.l+100*t,0,100),a:e.a}},x=function(){function n(t){this.parsed=hn(t)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return n.prototype.isValid=function(){return this.parsed!==null},n.prototype.brightness=function(){return l(D(this.rgba),2)},n.prototype.isDark=function(){return D(this.rgba)<.5},n.prototype.isLight=function(){return D(this.rgba)>=.5},n.prototype.toHex=function(){return t=S(this.rgba),e=t.r,r=t.g,o=t.b,a=(u=t.a)<1?y(l(255*u)):"","#"+y(e)+y(r)+y(o)+a;var t,e,r,o,u,a},n.prototype.toRgb=function(){return S(this.rgba)},n.prototype.toRgbString=function(){return t=S(this.rgba),e=t.r,r=t.g,o=t.b,(u=t.a)<1?"rgba("+e+", "+r+", "+o+", "+u+")":"rgb("+e+", "+r+", "+o+")";var t,e,r,o,u},n.prototype.toHsl=function(){return M(b(this.rgba))},n.prototype.toHslString=function(){return t=M(b(this.rgba)),e=t.h,r=t.s,o=t.l,(u=t.a)<1?"hsla("+e+", "+r+"%, "+o+"%, "+u+")":"hsl("+e+", "+r+"%, "+o+"%)";var t,e,r,o,u},n.prototype.toHsv=function(){return t=E(this.rgba),{h:l(t.h),s:l(t.s),v:l(t.v),a:l(t.a,3)};var t},n.prototype.invert=function(){return g({r:255-(t=this.rgba).r,g:255-t.g,b:255-t.b,a:t.a});var t},n.prototype.saturate=function(t){return t===void 0&&(t=.1),g(z(this.rgba,t))},n.prototype.desaturate=function(t){return t===void 0&&(t=.1),g(z(this.rgba,-t))},n.prototype.grayscale=function(){return g(z(this.rgba,-1))},n.prototype.lighten=function(t){return t===void 0&&(t=.1),g($(this.rgba,t))},n.prototype.darken=function(t){return t===void 0&&(t=.1),g($(this.rgba,-t))},n.prototype.rotate=function(t){return t===void 0&&(t=15),this.hue(this.hue()+t)},n.prototype.alpha=function(t){return typeof t=="number"?g({r:(e=this.rgba).r,g:e.g,b:e.b,a:t}):l(this.rgba.a,3);var e},n.prototype.hue=function(t){var e=b(this.rgba);return typeof t=="number"?g({h:t,s:e.s,l:e.l,a:e.a}):l(e.h)},n.prototype.isEqual=function(t){return this.toHex()===g(t).toHex()},n}(),g=function(n){return n instanceof x?n:new x(n)};function B(n){let t;return typeof n=="number"?t={r:n>>24&255,g:n>>16&255,b:n>>8&255,a:(n&255)/255}:t=n,g(t)}function f(n,t=!1){if(n===void 0||n==="none")return;const e=B(n);if(!e.isValid()){const r=`Failed to normalizeColor ${n}`;if(t)throw new Error(r);return console.warn(r),"rgb(0, 0, 0)"}return e.toRgbString()}function p(n){if(!(!n||n==="none"))return typeof n=="string"?{color:f(n)}:{...n,color:f(n.color)}}function X(n){if(!(!n||n==="none"))return typeof n=="string"?{src:n}:{...n,...p(n)}}function h(n,t=!1){if(typeof n!="object"||!n)return n;if(Array.isArray(n))return t?n.map(r=>h(r,t)):n;const e={};for(const r in n){const o=n[r];o!=null&&(t?e[r]=h(o,t):e[r]=o)}return e}function w(){return{color:"rgb(0, 0, 0)",offsetX:0,offsetY:0,blurRadius:1}}function C(n){if(!(!n||n==="none"))return{...w(),...h({...n,color:f(n.color)})}}function Y(){return{...w(),scaleX:1,scaleY:1}}function V(n){if(!(!n||n==="none"))return{...Y(),...C(n)}}function G(n){if(!(!n||n==="none"))return n}function P(n){if(!(!n||n==="none"))return h({...n,softEdge:G(n.softEdge),outerShadow:V(n.outerShadow),innerShadow:C(n.innerShadow)})}function j(n){if(!(!n||n==="none"))return typeof n=="string"?{src:n}:{...n,...p(n)}}function U(n){if(!(!n||n==="none"))return typeof n=="string"?{paths:[{data:n}]}:Array.isArray(n)?{paths:n.map(t=>typeof t=="string"?{data:t}:t)}:n}function q(n){if(!(!n||n==="none"))return typeof n=="string"?{color:f(n)}:{...n,color:f(n.color)}}function K(){return{boxShadow:"none"}}function J(n){if(!(!n||n==="none"))return typeof n=="string"?{color:f(n)}:{...n,color:f(n.color)}}function Q(){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 Z(){return{rotate:0,scaleX:1,scaleY:1,skewX:0,skewY:0,translateX:0,translateY:0,transform:"none",transformOrigin:"center"}}function _(){return{...Q(),...Z(),...K(),backgroundImage:"none",backgroundColor:"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 nn(){return{highlight:{},highlightImage:"none",highlightReferImage:"none",highlightColormap:"none",highlightLine:"none",highlightSize:"cover",highlightThickness:"100%"}}function tn(){return{listStyle:{},listStyleType:"none",listStyleImage:"none",listStyleColormap:"none",listStyleSize:"cover",listStylePosition:"outside"}}function en(){return{...nn(),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 rn(){return{...tn(),writingMode:"horizontal-tb",textWrap:"wrap",textAlign:"start",textIndent:0,lineHeight:1.2}}function on(){return{...rn(),...en(),textStrokeWidth:0,textStrokeColor:"rgb(0, 0, 0)"}}function m(n){if(!(!n||n==="none"))return h({...n,color:f(n.color),backgroundColor:f(n.backgroundColor),borderColor:f(n.borderColor),outlineColor:f(n.outlineColor),shadowColor:f(n.shadowColor)})}function vn(){return{..._(),...on()}}function I(n=""){return(Array.isArray(n)?n:[n]).map(e=>typeof e=="string"?{fragments:[{content:e}]}:"content"in e?{fragments:[m(e)]}:"fragments"in e?{...m(e),fragments:e.fragments.map(r=>m(r))}:Array.isArray(e)?{fragments:e.map(r=>typeof r=="string"?{content:r}:m(r))}:{fragments:[]})}function un(n){if(!(!n||n==="none"))return typeof n=="string"?{content:[{fragments:[{content:n}]}]}:"content"in n?{...n,content:I(n.content)}:{content:I(n)}}function an(n){if(!(!n||n==="none"))return typeof n=="string"?{src:n}:n}function N(n){var t;return h({...n,style:m(n.style),text:un(n.text),background:X(n.background),geometry:U(n.geometry),fill:p(n.fill),outline:q(n.outline),foreground:j(n.foreground),shadow:J(n.shadow),video:an(n.video),audio:v(n.audio),effect:P(n.effect),children:(t=n.children)==null?void 0:t.map(e=>N(e))})}function mn(n){return N(n)}i.clearUndef=h,i.getDefaultElementStyle=_,i.getDefaultHighlightStyle=nn,i.getDefaultInnerShadow=w,i.getDefaultLayoutStyle=Q,i.getDefaultListStyleStyle=tn,i.getDefaultOuterShadow=Y,i.getDefaultShadowStyle=K,i.getDefaultStyle=vn,i.getDefaultTextInlineStyle=en,i.getDefaultTextLineStyle=rn,i.getDefaultTextStyle=on,i.getDefaultTransformStyle=Z,i.normalizeAudio=v,i.normalizeBackground=X,i.normalizeColor=f,i.normalizeDocument=mn,i.normalizeEffect=P,i.normalizeElement=N,i.normalizeFill=p,i.normalizeForeground=j,i.normalizeGeometry=U,i.normalizeInnerShadow=C,i.normalizeOuterShadow=V,i.normalizeOutline=q,i.normalizeShadow=J,i.normalizeSoftEdge=G,i.normalizeStyle=m,i.normalizeText=un,i.normalizeTextContent=I,i.normalizeVideo=an,i.parseColor=B,Object.defineProperty(i,Symbol.toStringTag,{value:"Module"})});
1
+ (function(i,v){typeof exports=="object"&&typeof module<"u"?v(exports):typeof define=="function"&&define.amd?define(["exports"],v):(i=typeof globalThis<"u"?globalThis:i||self,v(i.modernIdoc={}))})(this,function(i){"use strict";function v(n){if(!(!n||n==="none"))return typeof n=="string"?{src:n}:n}var ln={grad:.9,turn:360,rad:360/(2*Math.PI)},c=function(n){return typeof n=="string"?n.length>0:typeof n=="number"},l=function(n,t,e){return t===void 0&&(t=0),e===void 0&&(e=Math.pow(10,t)),Math.round(e*n)/e+0},s=function(n,t,e){return t===void 0&&(t=0),e===void 0&&(e=1),n>e?e:n>t?n:t},A=function(n){return(n=isFinite(n)?n%360:0)>0?n:n+360},H=function(n){return{r:s(n.r,0,255),g:s(n.g,0,255),b:s(n.b,0,255),a:s(n.a)}},S=function(n){return{r:l(n.r),g:l(n.g),b:l(n.b),a:l(n.a,3)}},fn=/^#([0-9a-f]{3,8})$/i,y=function(n){var t=n.toString(16);return t.length<2?"0"+t:t},E=function(n){var t=n.r,e=n.g,r=n.b,o=n.a,u=Math.max(t,e,r),a=u-Math.min(t,e,r),d=a?u===t?(e-r)/a:u===e?2+(r-t)/a:4+(t-e)/a:0;return{h:60*(d<0?d+6:d),s:u?a/u*100:0,v:u/255*100,a:o}},L=function(n){var t=n.h,e=n.s,r=n.v,o=n.a;t=t/360*6,e/=100,r/=100;var u=Math.floor(t),a=r*(1-e),d=r*(1-(t-u)*e),T=r*(1-(1-t+u)*e),k=u%6;return{r:255*[r,d,a,a,T,r][k],g:255*[T,r,r,d,a,a][k],b:255*[a,a,T,r,r,d][k],a:o}},O=function(n){return{h:A(n.h),s:s(n.s,0,100),l:s(n.l,0,100),a:s(n.a)}},M=function(n){return{h:l(n.h),s:l(n.s),l:l(n.l),a:l(n.a,3)}},R=function(n){return L((e=(t=n).s,{h:t.h,s:(e*=((r=t.l)<50?r:100-r)/100)>0?2*e/(r+e)*100:0,v:r+e,a:t.a}));var t,e,r},b=function(n){return{h:(t=E(n)).h,s:(o=(200-(e=t.s))*(r=t.v)/100)>0&&o<200?e*r/100/(o<=100?o:200-o)*100:0,l:o/2,a:t.a};var t,e,r,o},sn=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,dn=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,gn=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,cn=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,W={string:[[function(n){var t=fn.exec(n);return t?(n=t[1]).length<=4?{r:parseInt(n[0]+n[0],16),g:parseInt(n[1]+n[1],16),b:parseInt(n[2]+n[2],16),a:n.length===4?l(parseInt(n[3]+n[3],16)/255,2):1}:n.length===6||n.length===8?{r:parseInt(n.substr(0,2),16),g:parseInt(n.substr(2,2),16),b:parseInt(n.substr(4,2),16),a:n.length===8?l(parseInt(n.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(n){var t=gn.exec(n)||cn.exec(n);return t?t[2]!==t[4]||t[4]!==t[6]?null:H({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:t[7]===void 0?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(n){var t=sn.exec(n)||dn.exec(n);if(!t)return null;var e,r,o=O({h:(e=t[1],r=t[2],r===void 0&&(r="deg"),Number(e)*(ln[r]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return R(o)},"hsl"]],object:[[function(n){var t=n.r,e=n.g,r=n.b,o=n.a,u=o===void 0?1:o;return c(t)&&c(e)&&c(r)?H({r:Number(t),g:Number(e),b:Number(r),a:Number(u)}):null},"rgb"],[function(n){var t=n.h,e=n.s,r=n.l,o=n.a,u=o===void 0?1:o;if(!c(t)||!c(e)||!c(r))return null;var a=O({h:Number(t),s:Number(e),l:Number(r),a:Number(u)});return R(a)},"hsl"],[function(n){var t=n.h,e=n.s,r=n.v,o=n.a,u=o===void 0?1:o;if(!c(t)||!c(e)||!c(r))return null;var a=function(d){return{h:A(d.h),s:s(d.s,0,100),v:s(d.v,0,100),a:s(d.a)}}({h:Number(t),s:Number(e),v:Number(r),a:Number(u)});return L(a)},"hsv"]]},F=function(n,t){for(var e=0;e<t.length;e++){var r=t[e][0](n);if(r)return[r,t[e][1]]}return[null,void 0]},hn=function(n){return typeof n=="string"?F(n.trim(),W.string):typeof n=="object"&&n!==null?F(n,W.object):[null,void 0]},z=function(n,t){var e=b(n);return{h:e.h,s:s(e.s+100*t,0,100),l:e.l,a:e.a}},D=function(n){return(299*n.r+587*n.g+114*n.b)/1e3/255},$=function(n,t){var e=b(n);return{h:e.h,s:e.s,l:s(e.l+100*t,0,100),a:e.a}},x=function(){function n(t){this.parsed=hn(t)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return n.prototype.isValid=function(){return this.parsed!==null},n.prototype.brightness=function(){return l(D(this.rgba),2)},n.prototype.isDark=function(){return D(this.rgba)<.5},n.prototype.isLight=function(){return D(this.rgba)>=.5},n.prototype.toHex=function(){return t=S(this.rgba),e=t.r,r=t.g,o=t.b,a=(u=t.a)<1?y(l(255*u)):"","#"+y(e)+y(r)+y(o)+a;var t,e,r,o,u,a},n.prototype.toRgb=function(){return S(this.rgba)},n.prototype.toRgbString=function(){return t=S(this.rgba),e=t.r,r=t.g,o=t.b,(u=t.a)<1?"rgba("+e+", "+r+", "+o+", "+u+")":"rgb("+e+", "+r+", "+o+")";var t,e,r,o,u},n.prototype.toHsl=function(){return M(b(this.rgba))},n.prototype.toHslString=function(){return t=M(b(this.rgba)),e=t.h,r=t.s,o=t.l,(u=t.a)<1?"hsla("+e+", "+r+"%, "+o+"%, "+u+")":"hsl("+e+", "+r+"%, "+o+"%)";var t,e,r,o,u},n.prototype.toHsv=function(){return t=E(this.rgba),{h:l(t.h),s:l(t.s),v:l(t.v),a:l(t.a,3)};var t},n.prototype.invert=function(){return g({r:255-(t=this.rgba).r,g:255-t.g,b:255-t.b,a:t.a});var t},n.prototype.saturate=function(t){return t===void 0&&(t=.1),g(z(this.rgba,t))},n.prototype.desaturate=function(t){return t===void 0&&(t=.1),g(z(this.rgba,-t))},n.prototype.grayscale=function(){return g(z(this.rgba,-1))},n.prototype.lighten=function(t){return t===void 0&&(t=.1),g($(this.rgba,t))},n.prototype.darken=function(t){return t===void 0&&(t=.1),g($(this.rgba,-t))},n.prototype.rotate=function(t){return t===void 0&&(t=15),this.hue(this.hue()+t)},n.prototype.alpha=function(t){return typeof t=="number"?g({r:(e=this.rgba).r,g:e.g,b:e.b,a:t}):l(this.rgba.a,3);var e},n.prototype.hue=function(t){var e=b(this.rgba);return typeof t=="number"?g({h:t,s:e.s,l:e.l,a:e.a}):l(e.h)},n.prototype.isEqual=function(t){return this.toHex()===g(t).toHex()},n}(),g=function(n){return n instanceof x?n:new x(n)};function B(n){let t;return typeof n=="number"?t={r:n>>24&255,g:n>>16&255,b:n>>8&255,a:(n&255)/255}:t=n,g(t)}function f(n,t=!1){if(n===void 0||n==="none")return;const e=B(n);if(!e.isValid()){const r=`Failed to normalizeColor ${n}`;if(t)throw new Error(r);return console.warn(r),"rgb(0, 0, 0)"}return e.toRgbString()}function p(n){if(!(!n||n==="none"))return typeof n=="string"?{color:f(n)}:{...n,color:f(n.color)}}function X(n){if(!(!n||n==="none"))return typeof n=="string"?{src:n}:{...n,...p(n)}}function h(n,t=!1){if(typeof n!="object"||!n)return n;if(Array.isArray(n))return t?n.map(r=>h(r,t)):n;const e={};for(const r in n){const o=n[r];o!=null&&(t?e[r]=h(o,t):e[r]=o)}return e}function w(){return{color:"rgb(0, 0, 0)",offsetX:0,offsetY:0,blurRadius:1}}function C(n){if(!(!n||n==="none"))return{...w(),...h({...n,color:f(n.color)})}}function Y(){return{...w(),scaleX:1,scaleY:1}}function V(n){if(!(!n||n==="none"))return{...Y(),...C(n)}}function G(n){if(!(!n||n==="none"))return n}function P(n){if(!(!n||n==="none"))return h({...n,softEdge:G(n.softEdge),outerShadow:V(n.outerShadow),innerShadow:C(n.innerShadow)})}function j(n){if(!(!n||n==="none"))return typeof n=="string"?{src:n}:{...n,...p(n)}}function U(n){if(!(!n||n==="none"))return typeof n=="string"?{paths:[{data:n}]}:Array.isArray(n)?{paths:n.map(t=>typeof t=="string"?{data:t}:t)}:n}function q(n){if(!(!n||n==="none"))return typeof n=="string"?{color:f(n)}:{...n,color:f(n.color)}}function K(n){if(!(!n||n==="none"))return typeof n=="string"?{color:f(n)}:{...n,color:f(n.color)}}function J(){return{boxShadow:"none"}}function Q(){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 Z(){return{rotate:0,scaleX:1,scaleY:1,skewX:0,skewY:0,translateX:0,translateY:0,transform:"none",transformOrigin:"center"}}function _(){return{...Q(),...Z(),...J(),backgroundImage:"none",backgroundSize:"auto, auto",backgroundColor:"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 nn(){return{highlight:{},highlightImage:"none",highlightReferImage:"none",highlightColormap:"none",highlightLine:"none",highlightSize:"cover",highlightThickness:"100%"}}function tn(){return{listStyle:{},listStyleType:"none",listStyleImage:"none",listStyleColormap:"none",listStyleSize:"cover",listStylePosition:"outside"}}function en(){return{...nn(),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 rn(){return{...tn(),writingMode:"horizontal-tb",textWrap:"wrap",textAlign:"start",textIndent:0,lineHeight:1.2}}function on(){return{...rn(),...en(),textStrokeWidth:0,textStrokeColor:"rgb(0, 0, 0)"}}function m(n){if(!(!n||n==="none"))return h({...n,color:f(n.color),backgroundColor:f(n.backgroundColor),borderColor:f(n.borderColor),outlineColor:f(n.outlineColor),shadowColor:f(n.shadowColor)})}function vn(){return{..._(),...on()}}function I(n=""){return(Array.isArray(n)?n:[n]).map(e=>typeof e=="string"?{fragments:[{content:e}]}:"content"in e?{fragments:[m(e)]}:"fragments"in e?{...m(e),fragments:e.fragments.map(r=>m(r))}:Array.isArray(e)?{fragments:e.map(r=>typeof r=="string"?{content:r}:m(r))}:{fragments:[]})}function un(n){if(!(!n||n==="none"))return typeof n=="string"?{content:[{fragments:[{content:n}]}]}:"content"in n?{...n,content:I(n.content)}:{content:I(n)}}function an(n){if(!(!n||n==="none"))return typeof n=="string"?{src:n}:n}function N(n){var t;return h({...n,style:m(n.style),text:un(n.text),background:X(n.background),geometry:U(n.geometry),fill:p(n.fill),outline:q(n.outline),foreground:j(n.foreground),shadow:K(n.shadow),video:an(n.video),audio:v(n.audio),effect:P(n.effect),children:(t=n.children)==null?void 0:t.map(e=>N(e))})}function mn(n){return N(n)}i.clearUndef=h,i.getDefaultElementStyle=_,i.getDefaultHighlightStyle=nn,i.getDefaultInnerShadow=w,i.getDefaultLayoutStyle=Q,i.getDefaultListStyleStyle=tn,i.getDefaultOuterShadow=Y,i.getDefaultShadowStyle=J,i.getDefaultStyle=vn,i.getDefaultTextInlineStyle=en,i.getDefaultTextLineStyle=rn,i.getDefaultTextStyle=on,i.getDefaultTransformStyle=Z,i.normalizeAudio=v,i.normalizeBackground=X,i.normalizeColor=f,i.normalizeDocument=mn,i.normalizeEffect=P,i.normalizeElement=N,i.normalizeFill=p,i.normalizeForeground=j,i.normalizeGeometry=U,i.normalizeInnerShadow=C,i.normalizeOuterShadow=V,i.normalizeOutline=q,i.normalizeShadow=K,i.normalizeSoftEdge=G,i.normalizeStyle=m,i.normalizeText=un,i.normalizeTextContent=I,i.normalizeVideo=an,i.parseColor=B,Object.defineProperty(i,Symbol.toStringTag,{value:"Module"})});
package/dist/index.mjs CHANGED
@@ -207,11 +207,6 @@ function normalizeOutline(outline) {
207
207
  }
208
208
  }
209
209
 
210
- function getDefaultShadowStyle() {
211
- return {
212
- boxShadow: "none"
213
- };
214
- }
215
210
  function normalizeShadow(shadow) {
216
211
  if (!shadow || shadow === "none") {
217
212
  return void 0;
@@ -226,6 +221,11 @@ function normalizeShadow(shadow) {
226
221
  };
227
222
  }
228
223
  }
224
+ function getDefaultShadowStyle() {
225
+ return {
226
+ boxShadow: "none"
227
+ };
228
+ }
229
229
 
230
230
  function getDefaultLayoutStyle() {
231
231
  return {
@@ -301,6 +301,7 @@ function getDefaultElementStyle() {
301
301
  ...getDefaultShadowStyle(),
302
302
  // background
303
303
  backgroundImage: "none",
304
+ backgroundSize: "auto, auto",
304
305
  backgroundColor: "none",
305
306
  // border
306
307
  borderRadius: 0,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "modern-idoc",
3
3
  "type": "module",
4
- "version": "0.5.0",
4
+ "version": "0.5.2",
5
5
  "packageManager": "pnpm@9.15.1",
6
6
  "description": "Intermediate document for modern codec libs",
7
7
  "author": "wxm",
@@ -53,6 +53,9 @@
53
53
  "typecheck": "tsc --noEmit",
54
54
  "prepare": "simple-git-hooks"
55
55
  },
56
+ "dependencies": {
57
+ "colord": "^2.9.3"
58
+ },
56
59
  "devDependencies": {
57
60
  "@antfu/eslint-config": "^4.3.0",
58
61
  "@types/node": "^22.13.4",
@@ -71,8 +74,5 @@
71
74
  },
72
75
  "lint-staged": {
73
76
  "*": "eslint --fix"
74
- },
75
- "dependencies": {
76
- "colord": "^2.9.3"
77
77
  }
78
78
  }