modern-idoc 0.5.0 → 0.5.1
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 +5 -5
- package/dist/index.d.cts +28 -28
- package/dist/index.d.mts +28 -28
- package/dist/index.d.ts +28 -28
- package/dist/index.js +1 -1
- package/dist/index.mjs +5 -5
- package/package.json +4 -4
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 {
|
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
|
-
|
|
276
|
+
declare function normalizeShadow(shadow?: ShadowProperty): ShadowDeclaration | undefined;
|
|
277
|
+
interface ShadowStyleDeclaration {
|
|
277
278
|
boxShadow: BoxShadow;
|
|
278
|
-
shadowColor
|
|
279
|
-
shadowOffsetX
|
|
280
|
-
shadowOffsetY
|
|
281
|
-
shadowBlur
|
|
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
|
-
|
|
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
|
-
|
|
367
|
+
interface TransformStyleDeclaration {
|
|
368
368
|
rotate: number;
|
|
369
369
|
scaleX: number;
|
|
370
370
|
scaleY: number;
|
|
@@ -374,10 +374,10 @@ type TransformStyleDeclaration = Partial<{
|
|
|
374
374
|
translateY: number;
|
|
375
375
|
transform: None | string;
|
|
376
376
|
transformOrigin: string;
|
|
377
|
-
}
|
|
378
|
-
declare function getDefaultTransformStyle():
|
|
377
|
+
}
|
|
378
|
+
declare function getDefaultTransformStyle(): TransformStyleDeclaration;
|
|
379
379
|
|
|
380
|
-
type ElementStyleDeclaration = LayoutStyleDeclaration & TransformStyleDeclaration & ShadowStyleDeclaration &
|
|
380
|
+
type ElementStyleDeclaration = Partial<LayoutStyleDeclaration> & TransformStyleDeclaration & ShadowStyleDeclaration & {
|
|
381
381
|
backgroundImage: None | string;
|
|
382
382
|
backgroundColor: None | ColorDeclaration;
|
|
383
383
|
borderRadius: number;
|
|
@@ -392,7 +392,7 @@ type ElementStyleDeclaration = LayoutStyleDeclaration & TransformStyleDeclaratio
|
|
|
392
392
|
opacity: number;
|
|
393
393
|
pointerEvents: PointerEvents;
|
|
394
394
|
maskImage: None | string;
|
|
395
|
-
}
|
|
395
|
+
};
|
|
396
396
|
declare function getDefaultElementStyle(): ElementStyleDeclaration;
|
|
397
397
|
|
|
398
398
|
interface HighlightDeclaration {
|
|
@@ -403,7 +403,7 @@ interface HighlightDeclaration {
|
|
|
403
403
|
size: HighlightSize;
|
|
404
404
|
thickness: HighlightThickness;
|
|
405
405
|
}
|
|
406
|
-
|
|
406
|
+
interface HighlightStyleDeclaration {
|
|
407
407
|
highlight: Partial<HighlightDeclaration>;
|
|
408
408
|
highlightImage: HighlightImage;
|
|
409
409
|
highlightReferImage: HighlightReferImage;
|
|
@@ -411,7 +411,7 @@ type HighlightStyleDeclaration = Partial<{
|
|
|
411
411
|
highlightLine: HighlightLine;
|
|
412
412
|
highlightSize: HighlightSize;
|
|
413
413
|
highlightThickness: HighlightThickness;
|
|
414
|
-
}
|
|
414
|
+
}
|
|
415
415
|
declare function getDefaultHighlightStyle(): Required<HighlightStyleDeclaration>;
|
|
416
416
|
|
|
417
417
|
interface ListStyleDeclaration {
|
|
@@ -421,17 +421,17 @@ interface ListStyleDeclaration {
|
|
|
421
421
|
size: ListStyleSize;
|
|
422
422
|
position: ListStylePosition;
|
|
423
423
|
}
|
|
424
|
-
|
|
424
|
+
interface ListStyleStyleDeclaration {
|
|
425
425
|
listStyle: Partial<ListStyleDeclaration>;
|
|
426
426
|
listStyleType: ListStyleType;
|
|
427
427
|
listStyleImage: ListStyleImage;
|
|
428
428
|
listStyleColormap: ListStyleColormap;
|
|
429
429
|
listStyleSize: ListStyleSize;
|
|
430
430
|
listStylePosition: ListStylePosition;
|
|
431
|
-
}
|
|
432
|
-
declare function getDefaultListStyleStyle():
|
|
431
|
+
}
|
|
432
|
+
declare function getDefaultListStyleStyle(): ListStyleStyleDeclaration;
|
|
433
433
|
|
|
434
|
-
type TextInlineStyleDeclaration = HighlightStyleDeclaration &
|
|
434
|
+
type TextInlineStyleDeclaration = HighlightStyleDeclaration & {
|
|
435
435
|
color: ColorDeclaration;
|
|
436
436
|
verticalAlign: VerticalAlign;
|
|
437
437
|
letterSpacing: number;
|
|
@@ -444,22 +444,22 @@ type TextInlineStyleDeclaration = HighlightStyleDeclaration & Partial<{
|
|
|
444
444
|
textTransform: TextTransform;
|
|
445
445
|
textOrientation: TextOrientation;
|
|
446
446
|
textDecoration: TextDecoration;
|
|
447
|
-
}
|
|
447
|
+
};
|
|
448
448
|
declare function getDefaultTextInlineStyle(): Required<TextInlineStyleDeclaration>;
|
|
449
449
|
|
|
450
|
-
type TextLineStyleDeclaration = ListStyleStyleDeclaration &
|
|
450
|
+
type TextLineStyleDeclaration = ListStyleStyleDeclaration & {
|
|
451
451
|
writingMode: WritingMode;
|
|
452
452
|
textWrap: TextWrap;
|
|
453
453
|
textAlign: TextAlign;
|
|
454
454
|
textIndent: number;
|
|
455
455
|
lineHeight: number;
|
|
456
|
-
}
|
|
457
|
-
declare function getDefaultTextLineStyle():
|
|
456
|
+
};
|
|
457
|
+
declare function getDefaultTextLineStyle(): TextLineStyleDeclaration;
|
|
458
458
|
|
|
459
|
-
|
|
459
|
+
interface TextDrawStyleDeclaration {
|
|
460
460
|
textStrokeWidth: number;
|
|
461
461
|
textStrokeColor: ColorDeclaration;
|
|
462
|
-
}
|
|
462
|
+
}
|
|
463
463
|
type TextStyleDeclaration = TextLineStyleDeclaration & TextInlineStyleDeclaration & TextDrawStyleDeclaration;
|
|
464
464
|
declare function getDefaultTextStyle(): Required<TextStyleDeclaration>;
|
|
465
465
|
|
|
@@ -484,7 +484,7 @@ interface ParagraphContent extends StylePropertyObject {
|
|
|
484
484
|
}
|
|
485
485
|
type TextContentFlat = string | FragmentContent | ParagraphContent | (string | FragmentContent)[];
|
|
486
486
|
type TextContent = string | FragmentContent | ParagraphContent | TextContentFlat[];
|
|
487
|
-
type TextContentDeclaration = (ParagraphContent &
|
|
487
|
+
type TextContentDeclaration = (ParagraphContent & StylePropertyObject)[];
|
|
488
488
|
interface TextDeclaration {
|
|
489
489
|
content: TextContentDeclaration;
|
|
490
490
|
effects?: StylePropertyObject[];
|
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
|
-
|
|
276
|
+
declare function normalizeShadow(shadow?: ShadowProperty): ShadowDeclaration | undefined;
|
|
277
|
+
interface ShadowStyleDeclaration {
|
|
277
278
|
boxShadow: BoxShadow;
|
|
278
|
-
shadowColor
|
|
279
|
-
shadowOffsetX
|
|
280
|
-
shadowOffsetY
|
|
281
|
-
shadowBlur
|
|
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
|
-
|
|
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
|
-
|
|
367
|
+
interface TransformStyleDeclaration {
|
|
368
368
|
rotate: number;
|
|
369
369
|
scaleX: number;
|
|
370
370
|
scaleY: number;
|
|
@@ -374,10 +374,10 @@ type TransformStyleDeclaration = Partial<{
|
|
|
374
374
|
translateY: number;
|
|
375
375
|
transform: None | string;
|
|
376
376
|
transformOrigin: string;
|
|
377
|
-
}
|
|
378
|
-
declare function getDefaultTransformStyle():
|
|
377
|
+
}
|
|
378
|
+
declare function getDefaultTransformStyle(): TransformStyleDeclaration;
|
|
379
379
|
|
|
380
|
-
type ElementStyleDeclaration = LayoutStyleDeclaration & TransformStyleDeclaration & ShadowStyleDeclaration &
|
|
380
|
+
type ElementStyleDeclaration = Partial<LayoutStyleDeclaration> & TransformStyleDeclaration & ShadowStyleDeclaration & {
|
|
381
381
|
backgroundImage: None | string;
|
|
382
382
|
backgroundColor: None | ColorDeclaration;
|
|
383
383
|
borderRadius: number;
|
|
@@ -392,7 +392,7 @@ type ElementStyleDeclaration = LayoutStyleDeclaration & TransformStyleDeclaratio
|
|
|
392
392
|
opacity: number;
|
|
393
393
|
pointerEvents: PointerEvents;
|
|
394
394
|
maskImage: None | string;
|
|
395
|
-
}
|
|
395
|
+
};
|
|
396
396
|
declare function getDefaultElementStyle(): ElementStyleDeclaration;
|
|
397
397
|
|
|
398
398
|
interface HighlightDeclaration {
|
|
@@ -403,7 +403,7 @@ interface HighlightDeclaration {
|
|
|
403
403
|
size: HighlightSize;
|
|
404
404
|
thickness: HighlightThickness;
|
|
405
405
|
}
|
|
406
|
-
|
|
406
|
+
interface HighlightStyleDeclaration {
|
|
407
407
|
highlight: Partial<HighlightDeclaration>;
|
|
408
408
|
highlightImage: HighlightImage;
|
|
409
409
|
highlightReferImage: HighlightReferImage;
|
|
@@ -411,7 +411,7 @@ type HighlightStyleDeclaration = Partial<{
|
|
|
411
411
|
highlightLine: HighlightLine;
|
|
412
412
|
highlightSize: HighlightSize;
|
|
413
413
|
highlightThickness: HighlightThickness;
|
|
414
|
-
}
|
|
414
|
+
}
|
|
415
415
|
declare function getDefaultHighlightStyle(): Required<HighlightStyleDeclaration>;
|
|
416
416
|
|
|
417
417
|
interface ListStyleDeclaration {
|
|
@@ -421,17 +421,17 @@ interface ListStyleDeclaration {
|
|
|
421
421
|
size: ListStyleSize;
|
|
422
422
|
position: ListStylePosition;
|
|
423
423
|
}
|
|
424
|
-
|
|
424
|
+
interface ListStyleStyleDeclaration {
|
|
425
425
|
listStyle: Partial<ListStyleDeclaration>;
|
|
426
426
|
listStyleType: ListStyleType;
|
|
427
427
|
listStyleImage: ListStyleImage;
|
|
428
428
|
listStyleColormap: ListStyleColormap;
|
|
429
429
|
listStyleSize: ListStyleSize;
|
|
430
430
|
listStylePosition: ListStylePosition;
|
|
431
|
-
}
|
|
432
|
-
declare function getDefaultListStyleStyle():
|
|
431
|
+
}
|
|
432
|
+
declare function getDefaultListStyleStyle(): ListStyleStyleDeclaration;
|
|
433
433
|
|
|
434
|
-
type TextInlineStyleDeclaration = HighlightStyleDeclaration &
|
|
434
|
+
type TextInlineStyleDeclaration = HighlightStyleDeclaration & {
|
|
435
435
|
color: ColorDeclaration;
|
|
436
436
|
verticalAlign: VerticalAlign;
|
|
437
437
|
letterSpacing: number;
|
|
@@ -444,22 +444,22 @@ type TextInlineStyleDeclaration = HighlightStyleDeclaration & Partial<{
|
|
|
444
444
|
textTransform: TextTransform;
|
|
445
445
|
textOrientation: TextOrientation;
|
|
446
446
|
textDecoration: TextDecoration;
|
|
447
|
-
}
|
|
447
|
+
};
|
|
448
448
|
declare function getDefaultTextInlineStyle(): Required<TextInlineStyleDeclaration>;
|
|
449
449
|
|
|
450
|
-
type TextLineStyleDeclaration = ListStyleStyleDeclaration &
|
|
450
|
+
type TextLineStyleDeclaration = ListStyleStyleDeclaration & {
|
|
451
451
|
writingMode: WritingMode;
|
|
452
452
|
textWrap: TextWrap;
|
|
453
453
|
textAlign: TextAlign;
|
|
454
454
|
textIndent: number;
|
|
455
455
|
lineHeight: number;
|
|
456
|
-
}
|
|
457
|
-
declare function getDefaultTextLineStyle():
|
|
456
|
+
};
|
|
457
|
+
declare function getDefaultTextLineStyle(): TextLineStyleDeclaration;
|
|
458
458
|
|
|
459
|
-
|
|
459
|
+
interface TextDrawStyleDeclaration {
|
|
460
460
|
textStrokeWidth: number;
|
|
461
461
|
textStrokeColor: ColorDeclaration;
|
|
462
|
-
}
|
|
462
|
+
}
|
|
463
463
|
type TextStyleDeclaration = TextLineStyleDeclaration & TextInlineStyleDeclaration & TextDrawStyleDeclaration;
|
|
464
464
|
declare function getDefaultTextStyle(): Required<TextStyleDeclaration>;
|
|
465
465
|
|
|
@@ -484,7 +484,7 @@ interface ParagraphContent extends StylePropertyObject {
|
|
|
484
484
|
}
|
|
485
485
|
type TextContentFlat = string | FragmentContent | ParagraphContent | (string | FragmentContent)[];
|
|
486
486
|
type TextContent = string | FragmentContent | ParagraphContent | TextContentFlat[];
|
|
487
|
-
type TextContentDeclaration = (ParagraphContent &
|
|
487
|
+
type TextContentDeclaration = (ParagraphContent & StylePropertyObject)[];
|
|
488
488
|
interface TextDeclaration {
|
|
489
489
|
content: TextContentDeclaration;
|
|
490
490
|
effects?: StylePropertyObject[];
|
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
|
-
|
|
276
|
+
declare function normalizeShadow(shadow?: ShadowProperty): ShadowDeclaration | undefined;
|
|
277
|
+
interface ShadowStyleDeclaration {
|
|
277
278
|
boxShadow: BoxShadow;
|
|
278
|
-
shadowColor
|
|
279
|
-
shadowOffsetX
|
|
280
|
-
shadowOffsetY
|
|
281
|
-
shadowBlur
|
|
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
|
-
|
|
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
|
-
|
|
367
|
+
interface TransformStyleDeclaration {
|
|
368
368
|
rotate: number;
|
|
369
369
|
scaleX: number;
|
|
370
370
|
scaleY: number;
|
|
@@ -374,10 +374,10 @@ type TransformStyleDeclaration = Partial<{
|
|
|
374
374
|
translateY: number;
|
|
375
375
|
transform: None | string;
|
|
376
376
|
transformOrigin: string;
|
|
377
|
-
}
|
|
378
|
-
declare function getDefaultTransformStyle():
|
|
377
|
+
}
|
|
378
|
+
declare function getDefaultTransformStyle(): TransformStyleDeclaration;
|
|
379
379
|
|
|
380
|
-
type ElementStyleDeclaration = LayoutStyleDeclaration & TransformStyleDeclaration & ShadowStyleDeclaration &
|
|
380
|
+
type ElementStyleDeclaration = Partial<LayoutStyleDeclaration> & TransformStyleDeclaration & ShadowStyleDeclaration & {
|
|
381
381
|
backgroundImage: None | string;
|
|
382
382
|
backgroundColor: None | ColorDeclaration;
|
|
383
383
|
borderRadius: number;
|
|
@@ -392,7 +392,7 @@ type ElementStyleDeclaration = LayoutStyleDeclaration & TransformStyleDeclaratio
|
|
|
392
392
|
opacity: number;
|
|
393
393
|
pointerEvents: PointerEvents;
|
|
394
394
|
maskImage: None | string;
|
|
395
|
-
}
|
|
395
|
+
};
|
|
396
396
|
declare function getDefaultElementStyle(): ElementStyleDeclaration;
|
|
397
397
|
|
|
398
398
|
interface HighlightDeclaration {
|
|
@@ -403,7 +403,7 @@ interface HighlightDeclaration {
|
|
|
403
403
|
size: HighlightSize;
|
|
404
404
|
thickness: HighlightThickness;
|
|
405
405
|
}
|
|
406
|
-
|
|
406
|
+
interface HighlightStyleDeclaration {
|
|
407
407
|
highlight: Partial<HighlightDeclaration>;
|
|
408
408
|
highlightImage: HighlightImage;
|
|
409
409
|
highlightReferImage: HighlightReferImage;
|
|
@@ -411,7 +411,7 @@ type HighlightStyleDeclaration = Partial<{
|
|
|
411
411
|
highlightLine: HighlightLine;
|
|
412
412
|
highlightSize: HighlightSize;
|
|
413
413
|
highlightThickness: HighlightThickness;
|
|
414
|
-
}
|
|
414
|
+
}
|
|
415
415
|
declare function getDefaultHighlightStyle(): Required<HighlightStyleDeclaration>;
|
|
416
416
|
|
|
417
417
|
interface ListStyleDeclaration {
|
|
@@ -421,17 +421,17 @@ interface ListStyleDeclaration {
|
|
|
421
421
|
size: ListStyleSize;
|
|
422
422
|
position: ListStylePosition;
|
|
423
423
|
}
|
|
424
|
-
|
|
424
|
+
interface ListStyleStyleDeclaration {
|
|
425
425
|
listStyle: Partial<ListStyleDeclaration>;
|
|
426
426
|
listStyleType: ListStyleType;
|
|
427
427
|
listStyleImage: ListStyleImage;
|
|
428
428
|
listStyleColormap: ListStyleColormap;
|
|
429
429
|
listStyleSize: ListStyleSize;
|
|
430
430
|
listStylePosition: ListStylePosition;
|
|
431
|
-
}
|
|
432
|
-
declare function getDefaultListStyleStyle():
|
|
431
|
+
}
|
|
432
|
+
declare function getDefaultListStyleStyle(): ListStyleStyleDeclaration;
|
|
433
433
|
|
|
434
|
-
type TextInlineStyleDeclaration = HighlightStyleDeclaration &
|
|
434
|
+
type TextInlineStyleDeclaration = HighlightStyleDeclaration & {
|
|
435
435
|
color: ColorDeclaration;
|
|
436
436
|
verticalAlign: VerticalAlign;
|
|
437
437
|
letterSpacing: number;
|
|
@@ -444,22 +444,22 @@ type TextInlineStyleDeclaration = HighlightStyleDeclaration & Partial<{
|
|
|
444
444
|
textTransform: TextTransform;
|
|
445
445
|
textOrientation: TextOrientation;
|
|
446
446
|
textDecoration: TextDecoration;
|
|
447
|
-
}
|
|
447
|
+
};
|
|
448
448
|
declare function getDefaultTextInlineStyle(): Required<TextInlineStyleDeclaration>;
|
|
449
449
|
|
|
450
|
-
type TextLineStyleDeclaration = ListStyleStyleDeclaration &
|
|
450
|
+
type TextLineStyleDeclaration = ListStyleStyleDeclaration & {
|
|
451
451
|
writingMode: WritingMode;
|
|
452
452
|
textWrap: TextWrap;
|
|
453
453
|
textAlign: TextAlign;
|
|
454
454
|
textIndent: number;
|
|
455
455
|
lineHeight: number;
|
|
456
|
-
}
|
|
457
|
-
declare function getDefaultTextLineStyle():
|
|
456
|
+
};
|
|
457
|
+
declare function getDefaultTextLineStyle(): TextLineStyleDeclaration;
|
|
458
458
|
|
|
459
|
-
|
|
459
|
+
interface TextDrawStyleDeclaration {
|
|
460
460
|
textStrokeWidth: number;
|
|
461
461
|
textStrokeColor: ColorDeclaration;
|
|
462
|
-
}
|
|
462
|
+
}
|
|
463
463
|
type TextStyleDeclaration = TextLineStyleDeclaration & TextInlineStyleDeclaration & TextDrawStyleDeclaration;
|
|
464
464
|
declare function getDefaultTextStyle(): Required<TextStyleDeclaration>;
|
|
465
465
|
|
|
@@ -484,7 +484,7 @@ interface ParagraphContent extends StylePropertyObject {
|
|
|
484
484
|
}
|
|
485
485
|
type TextContentFlat = string | FragmentContent | ParagraphContent | (string | FragmentContent)[];
|
|
486
486
|
type TextContent = string | FragmentContent | ParagraphContent | TextContentFlat[];
|
|
487
|
-
type TextContentDeclaration = (ParagraphContent &
|
|
487
|
+
type TextContentDeclaration = (ParagraphContent & StylePropertyObject)[];
|
|
488
488
|
interface TextDeclaration {
|
|
489
489
|
content: TextContentDeclaration;
|
|
490
490
|
effects?: StylePropertyObject[];
|
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",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 {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "modern-idoc",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.5.
|
|
4
|
+
"version": "0.5.1",
|
|
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
|
}
|