modern-idoc 0.2.3 → 0.2.5
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 +16 -0
- package/dist/index.d.cts +14 -1
- package/dist/index.d.mts +14 -1
- package/dist/index.d.ts +14 -1
- package/dist/index.js +1 -1
- package/dist/index.mjs +16 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -161,6 +161,20 @@ function deepClearUndef(obj) {
|
|
|
161
161
|
return clearUndef(obj, true);
|
|
162
162
|
}
|
|
163
163
|
|
|
164
|
+
function normalizeAudio(audio) {
|
|
165
|
+
if (!audio || audio === "none") {
|
|
166
|
+
return void 0;
|
|
167
|
+
} else if (typeof audio === "string") {
|
|
168
|
+
return {
|
|
169
|
+
url: audio
|
|
170
|
+
};
|
|
171
|
+
} else {
|
|
172
|
+
return {
|
|
173
|
+
...audio
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
164
178
|
function normalizeFill(fill) {
|
|
165
179
|
if (!fill || fill === "none") {
|
|
166
180
|
return void 0;
|
|
@@ -319,6 +333,7 @@ function normalizeElement(element) {
|
|
|
319
333
|
...element,
|
|
320
334
|
image: normalizeImage(element.image),
|
|
321
335
|
video: normalizeVideo(element.video),
|
|
336
|
+
audio: normalizeAudio(element.audio),
|
|
322
337
|
text: normalizeText(element.text),
|
|
323
338
|
geometry: normalizeGeometry(element.geometry),
|
|
324
339
|
fill: normalizeFill(element.fill),
|
|
@@ -335,6 +350,7 @@ exports.getDefaultShadowStyle = getDefaultShadowStyle;
|
|
|
335
350
|
exports.getDefaultStyle = getDefaultStyle;
|
|
336
351
|
exports.getDefaultTextStyle = getDefaultTextStyle;
|
|
337
352
|
exports.getDefaultTransformStyle = getDefaultTransformStyle;
|
|
353
|
+
exports.normalizeAudio = normalizeAudio;
|
|
338
354
|
exports.normalizeElement = normalizeElement;
|
|
339
355
|
exports.normalizeFill = normalizeFill;
|
|
340
356
|
exports.normalizeGeometry = normalizeGeometry;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
type Noneable = 'none';
|
|
2
2
|
type Sizeable = `${number}%` | `${number}rem` | number;
|
|
3
3
|
|
|
4
|
+
interface AudioDeclaration {
|
|
5
|
+
url: string;
|
|
6
|
+
}
|
|
7
|
+
type AudioProp = Noneable | string | AudioDeclaration;
|
|
8
|
+
|
|
4
9
|
interface ImageFillRect {
|
|
5
10
|
left?: number;
|
|
6
11
|
top?: number;
|
|
@@ -62,6 +67,7 @@ interface Path2DDeclaration extends Partial<Path2DStyle> {
|
|
|
62
67
|
data: SVGPathData;
|
|
63
68
|
}
|
|
64
69
|
interface GeometryDeclaration {
|
|
70
|
+
name?: string;
|
|
65
71
|
data: Path2DDeclaration[];
|
|
66
72
|
}
|
|
67
73
|
type GeometryProp = Noneable | SVGPathData | SVGPathData[] | Path2DDeclaration[] | GeometryDeclaration;
|
|
@@ -296,6 +302,7 @@ interface IDOCElement extends IDOCNode {
|
|
|
296
302
|
style?: StyleProp;
|
|
297
303
|
image?: ImageProp;
|
|
298
304
|
video?: VideoProp;
|
|
305
|
+
audio?: AudioProp;
|
|
299
306
|
text?: TextProp;
|
|
300
307
|
geometry?: GeometryProp;
|
|
301
308
|
fill?: FillProp;
|
|
@@ -306,6 +313,7 @@ interface IDOCElement extends IDOCNode {
|
|
|
306
313
|
interface IDOCElementDeclaration extends IDOCElement {
|
|
307
314
|
image?: ImageDeclaration;
|
|
308
315
|
video?: VideoDeclaration;
|
|
316
|
+
audio?: AudioDeclaration;
|
|
309
317
|
text?: TextDeclaration;
|
|
310
318
|
geometry?: GeometryDeclaration;
|
|
311
319
|
fill?: FillDeclaration;
|
|
@@ -317,6 +325,9 @@ interface IDOCElementDeclaration extends IDOCElement {
|
|
|
317
325
|
interface IDOCDocument extends IDOCElement {
|
|
318
326
|
fonts?: any;
|
|
319
327
|
}
|
|
328
|
+
interface IDOCDocumentDeclaration extends IDOCElementDeclaration {
|
|
329
|
+
fonts?: any;
|
|
330
|
+
}
|
|
320
331
|
|
|
321
332
|
declare function getDefaultElementStyle(): ElementStyleDeclaration;
|
|
322
333
|
|
|
@@ -331,6 +342,8 @@ declare function getDefaultTransformStyle(): TransformStyleDeclaration;
|
|
|
331
342
|
declare function clearUndef<T>(obj: T, deep?: boolean): T;
|
|
332
343
|
declare function deepClearUndef<T>(obj: T): T;
|
|
333
344
|
|
|
345
|
+
declare function normalizeAudio(audio?: AudioProp): AudioDeclaration | undefined;
|
|
346
|
+
|
|
334
347
|
declare function normalizeElement(element: IDOCElement): IDOCElementDeclaration;
|
|
335
348
|
|
|
336
349
|
declare function normalizeFill(fill?: FillProp): FillDeclaration | undefined;
|
|
@@ -349,4 +362,4 @@ declare function normalizeTextContent(content?: TextContent): TextContentDeclara
|
|
|
349
362
|
|
|
350
363
|
declare function normalizeVideo(video?: VideoProp): VideoDeclaration | undefined;
|
|
351
364
|
|
|
352
|
-
export { type ColorFillDeclaration, type CommonFillDeclaration, type ElementStyleDeclaration, type FillDeclaration, type FillProp, type FillRule, type FragmentContent, type GeometryDeclaration, type GeometryProp, type HighlightDeclaration, type HighlightStyleDeclaration, type IDOCDocument, type IDOCElement, type IDOCElementDeclaration, type IDOCNode, type ImageDeclaration, type ImageFillDeclaration, type ImageFillRect, type ImageFillTile, type ImageProp, type LayoutStyleDeclaration, type ListStyleDeclaration, type ListStyleStyleDeclaration, type MetaProp, type OutlineDeclaration, type OutlineProp, type ParagraphContent, type Path2DDeclaration, type Path2DStyle, type SVGPathData, type ShadowDeclaration, type ShadowProp, type ShadowStyleDeclaration, type StrokeLinecap, type StrokeLinejoin, type StyleDeclaration, type StyleProp, type TextContent, type TextContentDeclaration, type TextContentFlat, type TextDeclaration, type TextDrawStyleDeclaration, type TextInlineStyleDeclaration, type TextLineStyleDeclaration, type TextProp, type TextStyleDeclaration, type TransformStyleDeclaration, type VideoDeclaration, type VideoProp, clearUndef, deepClearUndef, getDefaultElementStyle, getDefaultShadowStyle, getDefaultStyle, getDefaultTextStyle, getDefaultTransformStyle, normalizeElement, normalizeFill, normalizeGeometry, normalizeImage, normalizeOutline, normalizeShadow, normalizeText, normalizeTextContent, normalizeVideo };
|
|
365
|
+
export { type Align, type AudioDeclaration, type AudioProp, type BoxSizing, type ColorFillDeclaration, type CommonFillDeclaration, type ElementStyleDeclaration, type FillDeclaration, type FillProp, type FillRule, type FlexDirection, type FlexWrap, type FontKerning, type FontStyle, type FontWeight, type FragmentContent, type GeometryDeclaration, type GeometryProp, type HighlightColormap, type HighlightDeclaration, type HighlightImage, type HighlightLine, type HighlightReferImage, type HighlightSize, type HighlightStyleDeclaration, type HighlightThickness, type IDOCDocument, type IDOCDocumentDeclaration, type IDOCElement, type IDOCElementDeclaration, type IDOCNode, type ImageDeclaration, type ImageFillDeclaration, type ImageFillRect, type ImageFillTile, type ImageProp, type Justify, type LayoutStyleDeclaration, type ListStyleColormap, type ListStyleDeclaration, type ListStyleImage, type ListStylePosition, type ListStyleSize, type ListStyleStyleDeclaration, type ListStyleType, type MetaProp, type OutlineDeclaration, type OutlineProp, type Overflow, type ParagraphContent, type Path2DDeclaration, type Path2DStyle, type Position, type SVGPathData, type ShadowDeclaration, type ShadowProp, type ShadowStyleDeclaration, type StrokeLinecap, type StrokeLinejoin, type StyleDeclaration, type StyleProp, type TextAlign, type TextContent, type TextContentDeclaration, type TextContentFlat, type TextDeclaration, type TextDecoration, type TextDrawStyleDeclaration, type TextInlineStyleDeclaration, type TextLineStyleDeclaration, type TextOrientation, type TextProp, type TextStyleDeclaration, type TextTransform, type TextWrap, type TransformStyleDeclaration, type VerticalAlign, type VideoDeclaration, type VideoProp, type Visibility, type WritingMode, clearUndef, deepClearUndef, getDefaultElementStyle, getDefaultShadowStyle, getDefaultStyle, getDefaultTextStyle, getDefaultTransformStyle, normalizeAudio, normalizeElement, normalizeFill, normalizeGeometry, normalizeImage, normalizeOutline, normalizeShadow, normalizeText, normalizeTextContent, normalizeVideo };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
type Noneable = 'none';
|
|
2
2
|
type Sizeable = `${number}%` | `${number}rem` | number;
|
|
3
3
|
|
|
4
|
+
interface AudioDeclaration {
|
|
5
|
+
url: string;
|
|
6
|
+
}
|
|
7
|
+
type AudioProp = Noneable | string | AudioDeclaration;
|
|
8
|
+
|
|
4
9
|
interface ImageFillRect {
|
|
5
10
|
left?: number;
|
|
6
11
|
top?: number;
|
|
@@ -62,6 +67,7 @@ interface Path2DDeclaration extends Partial<Path2DStyle> {
|
|
|
62
67
|
data: SVGPathData;
|
|
63
68
|
}
|
|
64
69
|
interface GeometryDeclaration {
|
|
70
|
+
name?: string;
|
|
65
71
|
data: Path2DDeclaration[];
|
|
66
72
|
}
|
|
67
73
|
type GeometryProp = Noneable | SVGPathData | SVGPathData[] | Path2DDeclaration[] | GeometryDeclaration;
|
|
@@ -296,6 +302,7 @@ interface IDOCElement extends IDOCNode {
|
|
|
296
302
|
style?: StyleProp;
|
|
297
303
|
image?: ImageProp;
|
|
298
304
|
video?: VideoProp;
|
|
305
|
+
audio?: AudioProp;
|
|
299
306
|
text?: TextProp;
|
|
300
307
|
geometry?: GeometryProp;
|
|
301
308
|
fill?: FillProp;
|
|
@@ -306,6 +313,7 @@ interface IDOCElement extends IDOCNode {
|
|
|
306
313
|
interface IDOCElementDeclaration extends IDOCElement {
|
|
307
314
|
image?: ImageDeclaration;
|
|
308
315
|
video?: VideoDeclaration;
|
|
316
|
+
audio?: AudioDeclaration;
|
|
309
317
|
text?: TextDeclaration;
|
|
310
318
|
geometry?: GeometryDeclaration;
|
|
311
319
|
fill?: FillDeclaration;
|
|
@@ -317,6 +325,9 @@ interface IDOCElementDeclaration extends IDOCElement {
|
|
|
317
325
|
interface IDOCDocument extends IDOCElement {
|
|
318
326
|
fonts?: any;
|
|
319
327
|
}
|
|
328
|
+
interface IDOCDocumentDeclaration extends IDOCElementDeclaration {
|
|
329
|
+
fonts?: any;
|
|
330
|
+
}
|
|
320
331
|
|
|
321
332
|
declare function getDefaultElementStyle(): ElementStyleDeclaration;
|
|
322
333
|
|
|
@@ -331,6 +342,8 @@ declare function getDefaultTransformStyle(): TransformStyleDeclaration;
|
|
|
331
342
|
declare function clearUndef<T>(obj: T, deep?: boolean): T;
|
|
332
343
|
declare function deepClearUndef<T>(obj: T): T;
|
|
333
344
|
|
|
345
|
+
declare function normalizeAudio(audio?: AudioProp): AudioDeclaration | undefined;
|
|
346
|
+
|
|
334
347
|
declare function normalizeElement(element: IDOCElement): IDOCElementDeclaration;
|
|
335
348
|
|
|
336
349
|
declare function normalizeFill(fill?: FillProp): FillDeclaration | undefined;
|
|
@@ -349,4 +362,4 @@ declare function normalizeTextContent(content?: TextContent): TextContentDeclara
|
|
|
349
362
|
|
|
350
363
|
declare function normalizeVideo(video?: VideoProp): VideoDeclaration | undefined;
|
|
351
364
|
|
|
352
|
-
export { type ColorFillDeclaration, type CommonFillDeclaration, type ElementStyleDeclaration, type FillDeclaration, type FillProp, type FillRule, type FragmentContent, type GeometryDeclaration, type GeometryProp, type HighlightDeclaration, type HighlightStyleDeclaration, type IDOCDocument, type IDOCElement, type IDOCElementDeclaration, type IDOCNode, type ImageDeclaration, type ImageFillDeclaration, type ImageFillRect, type ImageFillTile, type ImageProp, type LayoutStyleDeclaration, type ListStyleDeclaration, type ListStyleStyleDeclaration, type MetaProp, type OutlineDeclaration, type OutlineProp, type ParagraphContent, type Path2DDeclaration, type Path2DStyle, type SVGPathData, type ShadowDeclaration, type ShadowProp, type ShadowStyleDeclaration, type StrokeLinecap, type StrokeLinejoin, type StyleDeclaration, type StyleProp, type TextContent, type TextContentDeclaration, type TextContentFlat, type TextDeclaration, type TextDrawStyleDeclaration, type TextInlineStyleDeclaration, type TextLineStyleDeclaration, type TextProp, type TextStyleDeclaration, type TransformStyleDeclaration, type VideoDeclaration, type VideoProp, clearUndef, deepClearUndef, getDefaultElementStyle, getDefaultShadowStyle, getDefaultStyle, getDefaultTextStyle, getDefaultTransformStyle, normalizeElement, normalizeFill, normalizeGeometry, normalizeImage, normalizeOutline, normalizeShadow, normalizeText, normalizeTextContent, normalizeVideo };
|
|
365
|
+
export { type Align, type AudioDeclaration, type AudioProp, type BoxSizing, type ColorFillDeclaration, type CommonFillDeclaration, type ElementStyleDeclaration, type FillDeclaration, type FillProp, type FillRule, type FlexDirection, type FlexWrap, type FontKerning, type FontStyle, type FontWeight, type FragmentContent, type GeometryDeclaration, type GeometryProp, type HighlightColormap, type HighlightDeclaration, type HighlightImage, type HighlightLine, type HighlightReferImage, type HighlightSize, type HighlightStyleDeclaration, type HighlightThickness, type IDOCDocument, type IDOCDocumentDeclaration, type IDOCElement, type IDOCElementDeclaration, type IDOCNode, type ImageDeclaration, type ImageFillDeclaration, type ImageFillRect, type ImageFillTile, type ImageProp, type Justify, type LayoutStyleDeclaration, type ListStyleColormap, type ListStyleDeclaration, type ListStyleImage, type ListStylePosition, type ListStyleSize, type ListStyleStyleDeclaration, type ListStyleType, type MetaProp, type OutlineDeclaration, type OutlineProp, type Overflow, type ParagraphContent, type Path2DDeclaration, type Path2DStyle, type Position, type SVGPathData, type ShadowDeclaration, type ShadowProp, type ShadowStyleDeclaration, type StrokeLinecap, type StrokeLinejoin, type StyleDeclaration, type StyleProp, type TextAlign, type TextContent, type TextContentDeclaration, type TextContentFlat, type TextDeclaration, type TextDecoration, type TextDrawStyleDeclaration, type TextInlineStyleDeclaration, type TextLineStyleDeclaration, type TextOrientation, type TextProp, type TextStyleDeclaration, type TextTransform, type TextWrap, type TransformStyleDeclaration, type VerticalAlign, type VideoDeclaration, type VideoProp, type Visibility, type WritingMode, clearUndef, deepClearUndef, getDefaultElementStyle, getDefaultShadowStyle, getDefaultStyle, getDefaultTextStyle, getDefaultTransformStyle, normalizeAudio, normalizeElement, normalizeFill, normalizeGeometry, normalizeImage, normalizeOutline, normalizeShadow, normalizeText, normalizeTextContent, normalizeVideo };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
type Noneable = 'none';
|
|
2
2
|
type Sizeable = `${number}%` | `${number}rem` | number;
|
|
3
3
|
|
|
4
|
+
interface AudioDeclaration {
|
|
5
|
+
url: string;
|
|
6
|
+
}
|
|
7
|
+
type AudioProp = Noneable | string | AudioDeclaration;
|
|
8
|
+
|
|
4
9
|
interface ImageFillRect {
|
|
5
10
|
left?: number;
|
|
6
11
|
top?: number;
|
|
@@ -62,6 +67,7 @@ interface Path2DDeclaration extends Partial<Path2DStyle> {
|
|
|
62
67
|
data: SVGPathData;
|
|
63
68
|
}
|
|
64
69
|
interface GeometryDeclaration {
|
|
70
|
+
name?: string;
|
|
65
71
|
data: Path2DDeclaration[];
|
|
66
72
|
}
|
|
67
73
|
type GeometryProp = Noneable | SVGPathData | SVGPathData[] | Path2DDeclaration[] | GeometryDeclaration;
|
|
@@ -296,6 +302,7 @@ interface IDOCElement extends IDOCNode {
|
|
|
296
302
|
style?: StyleProp;
|
|
297
303
|
image?: ImageProp;
|
|
298
304
|
video?: VideoProp;
|
|
305
|
+
audio?: AudioProp;
|
|
299
306
|
text?: TextProp;
|
|
300
307
|
geometry?: GeometryProp;
|
|
301
308
|
fill?: FillProp;
|
|
@@ -306,6 +313,7 @@ interface IDOCElement extends IDOCNode {
|
|
|
306
313
|
interface IDOCElementDeclaration extends IDOCElement {
|
|
307
314
|
image?: ImageDeclaration;
|
|
308
315
|
video?: VideoDeclaration;
|
|
316
|
+
audio?: AudioDeclaration;
|
|
309
317
|
text?: TextDeclaration;
|
|
310
318
|
geometry?: GeometryDeclaration;
|
|
311
319
|
fill?: FillDeclaration;
|
|
@@ -317,6 +325,9 @@ interface IDOCElementDeclaration extends IDOCElement {
|
|
|
317
325
|
interface IDOCDocument extends IDOCElement {
|
|
318
326
|
fonts?: any;
|
|
319
327
|
}
|
|
328
|
+
interface IDOCDocumentDeclaration extends IDOCElementDeclaration {
|
|
329
|
+
fonts?: any;
|
|
330
|
+
}
|
|
320
331
|
|
|
321
332
|
declare function getDefaultElementStyle(): ElementStyleDeclaration;
|
|
322
333
|
|
|
@@ -331,6 +342,8 @@ declare function getDefaultTransformStyle(): TransformStyleDeclaration;
|
|
|
331
342
|
declare function clearUndef<T>(obj: T, deep?: boolean): T;
|
|
332
343
|
declare function deepClearUndef<T>(obj: T): T;
|
|
333
344
|
|
|
345
|
+
declare function normalizeAudio(audio?: AudioProp): AudioDeclaration | undefined;
|
|
346
|
+
|
|
334
347
|
declare function normalizeElement(element: IDOCElement): IDOCElementDeclaration;
|
|
335
348
|
|
|
336
349
|
declare function normalizeFill(fill?: FillProp): FillDeclaration | undefined;
|
|
@@ -349,4 +362,4 @@ declare function normalizeTextContent(content?: TextContent): TextContentDeclara
|
|
|
349
362
|
|
|
350
363
|
declare function normalizeVideo(video?: VideoProp): VideoDeclaration | undefined;
|
|
351
364
|
|
|
352
|
-
export { type ColorFillDeclaration, type CommonFillDeclaration, type ElementStyleDeclaration, type FillDeclaration, type FillProp, type FillRule, type FragmentContent, type GeometryDeclaration, type GeometryProp, type HighlightDeclaration, type HighlightStyleDeclaration, type IDOCDocument, type IDOCElement, type IDOCElementDeclaration, type IDOCNode, type ImageDeclaration, type ImageFillDeclaration, type ImageFillRect, type ImageFillTile, type ImageProp, type LayoutStyleDeclaration, type ListStyleDeclaration, type ListStyleStyleDeclaration, type MetaProp, type OutlineDeclaration, type OutlineProp, type ParagraphContent, type Path2DDeclaration, type Path2DStyle, type SVGPathData, type ShadowDeclaration, type ShadowProp, type ShadowStyleDeclaration, type StrokeLinecap, type StrokeLinejoin, type StyleDeclaration, type StyleProp, type TextContent, type TextContentDeclaration, type TextContentFlat, type TextDeclaration, type TextDrawStyleDeclaration, type TextInlineStyleDeclaration, type TextLineStyleDeclaration, type TextProp, type TextStyleDeclaration, type TransformStyleDeclaration, type VideoDeclaration, type VideoProp, clearUndef, deepClearUndef, getDefaultElementStyle, getDefaultShadowStyle, getDefaultStyle, getDefaultTextStyle, getDefaultTransformStyle, normalizeElement, normalizeFill, normalizeGeometry, normalizeImage, normalizeOutline, normalizeShadow, normalizeText, normalizeTextContent, normalizeVideo };
|
|
365
|
+
export { type Align, type AudioDeclaration, type AudioProp, type BoxSizing, type ColorFillDeclaration, type CommonFillDeclaration, type ElementStyleDeclaration, type FillDeclaration, type FillProp, type FillRule, type FlexDirection, type FlexWrap, type FontKerning, type FontStyle, type FontWeight, type FragmentContent, type GeometryDeclaration, type GeometryProp, type HighlightColormap, type HighlightDeclaration, type HighlightImage, type HighlightLine, type HighlightReferImage, type HighlightSize, type HighlightStyleDeclaration, type HighlightThickness, type IDOCDocument, type IDOCDocumentDeclaration, type IDOCElement, type IDOCElementDeclaration, type IDOCNode, type ImageDeclaration, type ImageFillDeclaration, type ImageFillRect, type ImageFillTile, type ImageProp, type Justify, type LayoutStyleDeclaration, type ListStyleColormap, type ListStyleDeclaration, type ListStyleImage, type ListStylePosition, type ListStyleSize, type ListStyleStyleDeclaration, type ListStyleType, type MetaProp, type OutlineDeclaration, type OutlineProp, type Overflow, type ParagraphContent, type Path2DDeclaration, type Path2DStyle, type Position, type SVGPathData, type ShadowDeclaration, type ShadowProp, type ShadowStyleDeclaration, type StrokeLinecap, type StrokeLinejoin, type StyleDeclaration, type StyleProp, type TextAlign, type TextContent, type TextContentDeclaration, type TextContentFlat, type TextDeclaration, type TextDecoration, type TextDrawStyleDeclaration, type TextInlineStyleDeclaration, type TextLineStyleDeclaration, type TextOrientation, type TextProp, type TextStyleDeclaration, type TextTransform, type TextWrap, type TransformStyleDeclaration, type VerticalAlign, type VideoDeclaration, type VideoProp, type Visibility, type WritingMode, clearUndef, deepClearUndef, getDefaultElementStyle, getDefaultShadowStyle, getDefaultStyle, getDefaultTextStyle, getDefaultTransformStyle, normalizeAudio, normalizeElement, normalizeFill, normalizeGeometry, normalizeImage, normalizeOutline, normalizeShadow, normalizeText, normalizeTextContent, normalizeVideo };
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(n,o){typeof exports=="object"&&typeof module<"u"?o(exports):typeof define=="function"&&define.amd?define(["exports"],o):(n=typeof globalThis<"u"?globalThis:n||self,o(n.modernIdoc={}))})(this,function(n){"use strict";function o(){return{overflow:"visible",alignContent:"stretch",alignItems:"stretch",alignSelf:"auto",borderTop:"none",borderLeft:"none",borderRight:"none",borderBottom:"none",borderWidth:0,border:"none",direction:"inherit",display:"flex",flex:0,flexBasis:"auto",flexDirection:"row",flexGrow:0,flexShrink:1,flexWrap:"nowrap",height:"auto",justifyContent:"flex-start",gap:0,marginTop:0,marginLeft:0,marginRight:0,marginBottom:0,margin:0,maxHeight:0,maxWidth:0,minHeight:0,minWidth:0,paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,padding:0,top:0,bottom:0,left:0,right:0,position:"static",boxSizing:"content-box",width:"auto"}}function u(){return{boxShadow:"none"}}function s(){return{rotate:0,scaleX:1,scaleY:1,skewX:0,skewY:0,translateX:0,translateY:0,transform:"none",transformOrigin:"center"}}function g(){return{...s(),...o(),...u(),visibility:"visible",filter:"none",opacity:1,backgroundImage:"none",backgroundColor:"transparent",borderRadius:0,borderColor:"transparent"}}function c(){return{writingMode:"horizontal-tb",verticalAlign:"baseline",lineHeight:1.2,letterSpacing:0,wordSpacing:0,fontSize:14,fontWeight:"normal",fontFamily:"",fontStyle:"normal",fontKerning:"normal",textWrap:"wrap",textAlign:"start",textIndent:0,textTransform:"none",textOrientation:"mixed",textDecoration:"none",textStrokeWidth:0,textStrokeColor:"black",color:"black",listStyleType:"none",listStyleImage:"none",listStyleColormap:"none",listStyleSize:"cover",listStylePosition:"outside",highlightImage:"none",highlightReferImage:"none",highlightColormap:"none",highlightLine:"none",highlightSize:"cover",highlightThickness:"100%"}}function
|
|
1
|
+
(function(n,o){typeof exports=="object"&&typeof module<"u"?o(exports):typeof define=="function"&&define.amd?define(["exports"],o):(n=typeof globalThis<"u"?globalThis:n||self,o(n.modernIdoc={}))})(this,function(n){"use strict";function o(){return{overflow:"visible",alignContent:"stretch",alignItems:"stretch",alignSelf:"auto",borderTop:"none",borderLeft:"none",borderRight:"none",borderBottom:"none",borderWidth:0,border:"none",direction:"inherit",display:"flex",flex:0,flexBasis:"auto",flexDirection:"row",flexGrow:0,flexShrink:1,flexWrap:"nowrap",height:"auto",justifyContent:"flex-start",gap:0,marginTop:0,marginLeft:0,marginRight:0,marginBottom:0,margin:0,maxHeight:0,maxWidth:0,minHeight:0,minWidth:0,paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,padding:0,top:0,bottom:0,left:0,right:0,position:"static",boxSizing:"content-box",width:"auto"}}function u(){return{boxShadow:"none"}}function s(){return{rotate:0,scaleX:1,scaleY:1,skewX:0,skewY:0,translateX:0,translateY:0,transform:"none",transformOrigin:"center"}}function g(){return{...s(),...o(),...u(),visibility:"visible",filter:"none",opacity:1,backgroundImage:"none",backgroundColor:"transparent",borderRadius:0,borderColor:"transparent"}}function c(){return{writingMode:"horizontal-tb",verticalAlign:"baseline",lineHeight:1.2,letterSpacing:0,wordSpacing:0,fontSize:14,fontWeight:"normal",fontFamily:"",fontStyle:"normal",fontKerning:"normal",textWrap:"wrap",textAlign:"start",textIndent:0,textTransform:"none",textOrientation:"mixed",textDecoration:"none",textStrokeWidth:0,textStrokeColor:"black",color:"black",listStyleType:"none",listStyleImage:"none",listStyleColormap:"none",listStyleSize:"cover",listStylePosition:"outside",highlightImage:"none",highlightReferImage:"none",highlightColormap:"none",highlightLine:"none",highlightSize:"cover",highlightThickness:"100%"}}function v(){return{...g(),...c()}}function l(e,r=!1){if(typeof e!="object"||!e)return e;if(Array.isArray(e))return r?e.map(i=>l(i,r)):e;const t={};for(const i in e){const a=e[i];a!=null&&(r?t[i]=l(a,r):t[i]=a)}return t}function w(e){return l(e,!0)}function d(e){if(!(!e||e==="none"))return typeof e=="string"?{url:e}:{...e}}function m(e){if(!(!e||e==="none"))return typeof e=="string"?{type:"color",color:e}:e}function y(e){if(!(!e||e==="none"))return typeof e=="string"?{data:[{data:e}]}:Array.isArray(e)?{data:e.map(r=>typeof r=="string"?{data:r}:r)}:e}function h(e){if(!(!e||e==="none"))return typeof e=="string"?{url:e}:e}function S(e){if(!(!e||e==="none"))return typeof e=="string"?{color:e}:e}function p(e){if(!(!e||e==="none"))return typeof e=="string"?{color:e}:e}function f(e=""){return(Array.isArray(e)?e:[e]).map(t=>typeof t=="string"?{fragments:[{content:t}]}:"content"in t?{fragments:[{...t}]}:"fragments"in t?{...t,fragments:t.fragments.map(i=>({...i}))}:Array.isArray(t)?{fragments:t.map(i=>typeof i=="string"?{content:i}:{...i})}:{fragments:[]})}function z(e){if(!(!e||e==="none"))return typeof e=="string"?{content:[{fragments:[{content:e}]}]}:"content"in e?{...e,content:f(e.content)}:{content:f(e)}}function b(e){if(!(!e||e==="none"))return typeof e=="string"?{url:e}:{...e}}function T(e){var r;return l({...e,image:h(e.image),video:b(e.video),audio:d(e.audio),text:z(e.text),geometry:y(e.geometry),fill:m(e.fill),outline:S(e.outline),shadow:p(e.shadow),children:(r=e.children)==null?void 0:r.map(t=>T(t))})}n.clearUndef=l,n.deepClearUndef=w,n.getDefaultElementStyle=g,n.getDefaultShadowStyle=u,n.getDefaultStyle=v,n.getDefaultTextStyle=c,n.getDefaultTransformStyle=s,n.normalizeAudio=d,n.normalizeElement=T,n.normalizeFill=m,n.normalizeGeometry=y,n.normalizeImage=h,n.normalizeOutline=S,n.normalizeShadow=p,n.normalizeText=z,n.normalizeTextContent=f,n.normalizeVideo=b,Object.defineProperty(n,Symbol.toStringTag,{value:"Module"})});
|
package/dist/index.mjs
CHANGED
|
@@ -159,6 +159,20 @@ function deepClearUndef(obj) {
|
|
|
159
159
|
return clearUndef(obj, true);
|
|
160
160
|
}
|
|
161
161
|
|
|
162
|
+
function normalizeAudio(audio) {
|
|
163
|
+
if (!audio || audio === "none") {
|
|
164
|
+
return void 0;
|
|
165
|
+
} else if (typeof audio === "string") {
|
|
166
|
+
return {
|
|
167
|
+
url: audio
|
|
168
|
+
};
|
|
169
|
+
} else {
|
|
170
|
+
return {
|
|
171
|
+
...audio
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
162
176
|
function normalizeFill(fill) {
|
|
163
177
|
if (!fill || fill === "none") {
|
|
164
178
|
return void 0;
|
|
@@ -317,6 +331,7 @@ function normalizeElement(element) {
|
|
|
317
331
|
...element,
|
|
318
332
|
image: normalizeImage(element.image),
|
|
319
333
|
video: normalizeVideo(element.video),
|
|
334
|
+
audio: normalizeAudio(element.audio),
|
|
320
335
|
text: normalizeText(element.text),
|
|
321
336
|
geometry: normalizeGeometry(element.geometry),
|
|
322
337
|
fill: normalizeFill(element.fill),
|
|
@@ -326,4 +341,4 @@ function normalizeElement(element) {
|
|
|
326
341
|
});
|
|
327
342
|
}
|
|
328
343
|
|
|
329
|
-
export { clearUndef, deepClearUndef, getDefaultElementStyle, getDefaultShadowStyle, getDefaultStyle, getDefaultTextStyle, getDefaultTransformStyle, normalizeElement, normalizeFill, normalizeGeometry, normalizeImage, normalizeOutline, normalizeShadow, normalizeText, normalizeTextContent, normalizeVideo };
|
|
344
|
+
export { clearUndef, deepClearUndef, getDefaultElementStyle, getDefaultShadowStyle, getDefaultStyle, getDefaultTextStyle, getDefaultTransformStyle, normalizeAudio, normalizeElement, normalizeFill, normalizeGeometry, normalizeImage, normalizeOutline, normalizeShadow, normalizeText, normalizeTextContent, normalizeVideo };
|