modern-idoc 0.1.3 → 0.1.4

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
@@ -132,15 +132,6 @@ function normalizeGeometry(geometry) {
132
132
  } else if (Array.isArray(geometry)) {
133
133
  return {
134
134
  data: geometry.map((data) => {
135
- return {
136
- data
137
- };
138
- })
139
- };
140
- } else {
141
- return {
142
- ...geometry,
143
- data: geometry.data.map((data) => {
144
135
  if (typeof data === "string") {
145
136
  return {
146
137
  data
@@ -149,6 +140,8 @@ function normalizeGeometry(geometry) {
149
140
  return data;
150
141
  })
151
142
  };
143
+ } else {
144
+ return geometry;
152
145
  }
153
146
  }
154
147
 
package/dist/index.d.cts CHANGED
@@ -37,10 +37,10 @@ interface IDOCPath2D extends Partial<IDOCPath2DStyle> {
37
37
  data: SVGPathData;
38
38
  }
39
39
  interface IDOCGeometryDeclaration {
40
- data: (IDOCPath2D | SVGPathData)[];
40
+ data: IDOCPath2D[];
41
41
  }
42
42
 
43
- type IDOCGeometryProp = Noneable | SVGPathData | SVGPathData[] | IDOCGeometryDeclaration;
43
+ type IDOCGeometryProp = Noneable | SVGPathData | SVGPathData[] | IDOCPath2D[] | IDOCGeometryDeclaration;
44
44
 
45
45
  interface IDOCImageDeclaration {
46
46
  url: string;
@@ -76,7 +76,7 @@ type TextWrap = 'wrap' | 'nowrap';
76
76
  type TextAlign = 'center' | 'end' | 'left' | 'right' | 'start';
77
77
  type TextTransform = Noneable | 'uppercase' | 'lowercase';
78
78
  type TextOrientation = 'mixed' | 'upright' | 'sideways-right' | 'sideways';
79
- type TextDecorationLine = Noneable | 'underline' | 'line-through' | 'overline';
79
+ type TextDecoration = Noneable | 'underline' | 'line-through' | 'overline';
80
80
  type VerticalAlign = 'baseline' | 'top' | 'middle' | 'bottom' | 'sub' | 'super' | 'text-top' | 'text-bottom';
81
81
  type WritingMode = 'horizontal-tb' | 'vertical-lr' | 'vertical-rl';
82
82
  type ListStyleType = Noneable | 'disc';
@@ -99,7 +99,7 @@ interface IDOCListStyleStyleDeclaration {
99
99
  listStyleSize: ListStyleSize;
100
100
  listStylePosition: ListStylePosition;
101
101
  }
102
- type HighlightLine = TextDecorationLine | 'outline';
102
+ type HighlightLine = TextDecoration | 'outline';
103
103
  type HighlightImage = Noneable | string;
104
104
  type HighlightReferImage = Noneable | string;
105
105
  type HighlightColormap = Noneable | Record<string, string>;
@@ -164,7 +164,7 @@ interface IDOCTextInlineStyleDeclaration extends IDOCHighlightStyleDeclaration {
164
164
  fontKerning: FontKerning;
165
165
  textTransform: TextTransform;
166
166
  textOrientation: TextOrientation;
167
- textDecoration: TextDecorationLine;
167
+ textDecoration: TextDecoration;
168
168
  }
169
169
  interface IDOCTextDrawStyleDeclaration extends IDOCShadowStyleDeclaration, IDOCTransformStyleDeclaration {
170
170
  textStrokeWidth: number;
@@ -275,4 +275,4 @@ declare function normalizeTextContent(content?: IDOCTextContent): IDOCTextConten
275
275
 
276
276
  declare function normalizeVideo(video?: IDOCVideoProp): IDOCVideoDeclaration | undefined;
277
277
 
278
- export { type FillRule, type FontKerning, type FontStyle, type FontWeight, type HighlightColormap, type HighlightImage, type HighlightLine, type HighlightReferImage, type HighlightSize, type HighlightThickness, type IDCOShadowDeclaration, type IDOCDocument, type IDOCElement, type IDOCElementDeclaration, type IDOCElementStyleDeclaration, type IDOCFillDeclaration, type IDOCFillProp, type IDOCFragmentContent, type IDOCGeometryDeclaration, type IDOCGeometryProp, type IDOCHighlightDeclaration, type IDOCHighlightStyleDeclaration, type IDOCImageDeclaration, type IDOCImageProp, type IDOCListStyleDeclaration, type IDOCListStyleStyleDeclaration, type IDOCMetaProp, type IDOCNode, type IDOCParagraphContent, type IDOCPath2D, type IDOCPath2DStyle, type IDOCShadowStyleDeclaration, type IDOCStrokeDeclaration, type IDOCStrokeProp, type IDOCStyleDeclaration, type IDOCStyleProp, type IDOCTextContent, type IDOCTextContentDeclaration, type IDOCTextContentFlat, type IDOCTextDeclaration, type IDOCTextDrawStyleDeclaration, type IDOCTextInlineStyleDeclaration, type IDOCTextLineStyleDeclaration, type IDOCTextProp, type IDOCTextStyleDeclaration, type IDOCTransformStyleDeclaration, type IDOCVideoDeclaration, type IDOCVideoProp, type ListStyleColormap, type ListStyleImage, type ListStylePosition, type ListStyleSize, type ListStyleType, type Overflow, type SVGPathData, type StrokeLinecap, type StrokeLinejoin, type TextAlign, type TextDecorationLine, type TextOrientation, type TextTransform, type TextWrap, type VerticalAlign, type Visibility, type WritingMode, getDefaultElementStyle, getDefaultStyle, getDefaultTextStyle, normalizeElement, normalizeFill, normalizeGeometry, normalizeImage, normalizeStroke, normalizeText, normalizeTextContent, normalizeVideo };
278
+ export { type FillRule, type FontKerning, type FontStyle, type FontWeight, type HighlightColormap, type HighlightImage, type HighlightLine, type HighlightReferImage, type HighlightSize, type HighlightThickness, type IDCOShadowDeclaration, type IDOCDocument, type IDOCElement, type IDOCElementDeclaration, type IDOCElementStyleDeclaration, type IDOCFillDeclaration, type IDOCFillProp, type IDOCFragmentContent, type IDOCGeometryDeclaration, type IDOCGeometryProp, type IDOCHighlightDeclaration, type IDOCHighlightStyleDeclaration, type IDOCImageDeclaration, type IDOCImageProp, type IDOCListStyleDeclaration, type IDOCListStyleStyleDeclaration, type IDOCMetaProp, type IDOCNode, type IDOCParagraphContent, type IDOCPath2D, type IDOCPath2DStyle, type IDOCShadowStyleDeclaration, type IDOCStrokeDeclaration, type IDOCStrokeProp, type IDOCStyleDeclaration, type IDOCStyleProp, type IDOCTextContent, type IDOCTextContentDeclaration, type IDOCTextContentFlat, type IDOCTextDeclaration, type IDOCTextDrawStyleDeclaration, type IDOCTextInlineStyleDeclaration, type IDOCTextLineStyleDeclaration, type IDOCTextProp, type IDOCTextStyleDeclaration, type IDOCTransformStyleDeclaration, type IDOCVideoDeclaration, type IDOCVideoProp, type ListStyleColormap, type ListStyleImage, type ListStylePosition, type ListStyleSize, type ListStyleType, type Overflow, type SVGPathData, type StrokeLinecap, type StrokeLinejoin, type TextAlign, type TextDecoration, type TextOrientation, type TextTransform, type TextWrap, type VerticalAlign, type Visibility, type WritingMode, getDefaultElementStyle, getDefaultStyle, getDefaultTextStyle, normalizeElement, normalizeFill, normalizeGeometry, normalizeImage, normalizeStroke, normalizeText, normalizeTextContent, normalizeVideo };
package/dist/index.d.mts CHANGED
@@ -37,10 +37,10 @@ interface IDOCPath2D extends Partial<IDOCPath2DStyle> {
37
37
  data: SVGPathData;
38
38
  }
39
39
  interface IDOCGeometryDeclaration {
40
- data: (IDOCPath2D | SVGPathData)[];
40
+ data: IDOCPath2D[];
41
41
  }
42
42
 
43
- type IDOCGeometryProp = Noneable | SVGPathData | SVGPathData[] | IDOCGeometryDeclaration;
43
+ type IDOCGeometryProp = Noneable | SVGPathData | SVGPathData[] | IDOCPath2D[] | IDOCGeometryDeclaration;
44
44
 
45
45
  interface IDOCImageDeclaration {
46
46
  url: string;
@@ -76,7 +76,7 @@ type TextWrap = 'wrap' | 'nowrap';
76
76
  type TextAlign = 'center' | 'end' | 'left' | 'right' | 'start';
77
77
  type TextTransform = Noneable | 'uppercase' | 'lowercase';
78
78
  type TextOrientation = 'mixed' | 'upright' | 'sideways-right' | 'sideways';
79
- type TextDecorationLine = Noneable | 'underline' | 'line-through' | 'overline';
79
+ type TextDecoration = Noneable | 'underline' | 'line-through' | 'overline';
80
80
  type VerticalAlign = 'baseline' | 'top' | 'middle' | 'bottom' | 'sub' | 'super' | 'text-top' | 'text-bottom';
81
81
  type WritingMode = 'horizontal-tb' | 'vertical-lr' | 'vertical-rl';
82
82
  type ListStyleType = Noneable | 'disc';
@@ -99,7 +99,7 @@ interface IDOCListStyleStyleDeclaration {
99
99
  listStyleSize: ListStyleSize;
100
100
  listStylePosition: ListStylePosition;
101
101
  }
102
- type HighlightLine = TextDecorationLine | 'outline';
102
+ type HighlightLine = TextDecoration | 'outline';
103
103
  type HighlightImage = Noneable | string;
104
104
  type HighlightReferImage = Noneable | string;
105
105
  type HighlightColormap = Noneable | Record<string, string>;
@@ -164,7 +164,7 @@ interface IDOCTextInlineStyleDeclaration extends IDOCHighlightStyleDeclaration {
164
164
  fontKerning: FontKerning;
165
165
  textTransform: TextTransform;
166
166
  textOrientation: TextOrientation;
167
- textDecoration: TextDecorationLine;
167
+ textDecoration: TextDecoration;
168
168
  }
169
169
  interface IDOCTextDrawStyleDeclaration extends IDOCShadowStyleDeclaration, IDOCTransformStyleDeclaration {
170
170
  textStrokeWidth: number;
@@ -275,4 +275,4 @@ declare function normalizeTextContent(content?: IDOCTextContent): IDOCTextConten
275
275
 
276
276
  declare function normalizeVideo(video?: IDOCVideoProp): IDOCVideoDeclaration | undefined;
277
277
 
278
- export { type FillRule, type FontKerning, type FontStyle, type FontWeight, type HighlightColormap, type HighlightImage, type HighlightLine, type HighlightReferImage, type HighlightSize, type HighlightThickness, type IDCOShadowDeclaration, type IDOCDocument, type IDOCElement, type IDOCElementDeclaration, type IDOCElementStyleDeclaration, type IDOCFillDeclaration, type IDOCFillProp, type IDOCFragmentContent, type IDOCGeometryDeclaration, type IDOCGeometryProp, type IDOCHighlightDeclaration, type IDOCHighlightStyleDeclaration, type IDOCImageDeclaration, type IDOCImageProp, type IDOCListStyleDeclaration, type IDOCListStyleStyleDeclaration, type IDOCMetaProp, type IDOCNode, type IDOCParagraphContent, type IDOCPath2D, type IDOCPath2DStyle, type IDOCShadowStyleDeclaration, type IDOCStrokeDeclaration, type IDOCStrokeProp, type IDOCStyleDeclaration, type IDOCStyleProp, type IDOCTextContent, type IDOCTextContentDeclaration, type IDOCTextContentFlat, type IDOCTextDeclaration, type IDOCTextDrawStyleDeclaration, type IDOCTextInlineStyleDeclaration, type IDOCTextLineStyleDeclaration, type IDOCTextProp, type IDOCTextStyleDeclaration, type IDOCTransformStyleDeclaration, type IDOCVideoDeclaration, type IDOCVideoProp, type ListStyleColormap, type ListStyleImage, type ListStylePosition, type ListStyleSize, type ListStyleType, type Overflow, type SVGPathData, type StrokeLinecap, type StrokeLinejoin, type TextAlign, type TextDecorationLine, type TextOrientation, type TextTransform, type TextWrap, type VerticalAlign, type Visibility, type WritingMode, getDefaultElementStyle, getDefaultStyle, getDefaultTextStyle, normalizeElement, normalizeFill, normalizeGeometry, normalizeImage, normalizeStroke, normalizeText, normalizeTextContent, normalizeVideo };
278
+ export { type FillRule, type FontKerning, type FontStyle, type FontWeight, type HighlightColormap, type HighlightImage, type HighlightLine, type HighlightReferImage, type HighlightSize, type HighlightThickness, type IDCOShadowDeclaration, type IDOCDocument, type IDOCElement, type IDOCElementDeclaration, type IDOCElementStyleDeclaration, type IDOCFillDeclaration, type IDOCFillProp, type IDOCFragmentContent, type IDOCGeometryDeclaration, type IDOCGeometryProp, type IDOCHighlightDeclaration, type IDOCHighlightStyleDeclaration, type IDOCImageDeclaration, type IDOCImageProp, type IDOCListStyleDeclaration, type IDOCListStyleStyleDeclaration, type IDOCMetaProp, type IDOCNode, type IDOCParagraphContent, type IDOCPath2D, type IDOCPath2DStyle, type IDOCShadowStyleDeclaration, type IDOCStrokeDeclaration, type IDOCStrokeProp, type IDOCStyleDeclaration, type IDOCStyleProp, type IDOCTextContent, type IDOCTextContentDeclaration, type IDOCTextContentFlat, type IDOCTextDeclaration, type IDOCTextDrawStyleDeclaration, type IDOCTextInlineStyleDeclaration, type IDOCTextLineStyleDeclaration, type IDOCTextProp, type IDOCTextStyleDeclaration, type IDOCTransformStyleDeclaration, type IDOCVideoDeclaration, type IDOCVideoProp, type ListStyleColormap, type ListStyleImage, type ListStylePosition, type ListStyleSize, type ListStyleType, type Overflow, type SVGPathData, type StrokeLinecap, type StrokeLinejoin, type TextAlign, type TextDecoration, type TextOrientation, type TextTransform, type TextWrap, type VerticalAlign, type Visibility, type WritingMode, getDefaultElementStyle, getDefaultStyle, getDefaultTextStyle, normalizeElement, normalizeFill, normalizeGeometry, normalizeImage, normalizeStroke, normalizeText, normalizeTextContent, normalizeVideo };
package/dist/index.d.ts CHANGED
@@ -37,10 +37,10 @@ interface IDOCPath2D extends Partial<IDOCPath2DStyle> {
37
37
  data: SVGPathData;
38
38
  }
39
39
  interface IDOCGeometryDeclaration {
40
- data: (IDOCPath2D | SVGPathData)[];
40
+ data: IDOCPath2D[];
41
41
  }
42
42
 
43
- type IDOCGeometryProp = Noneable | SVGPathData | SVGPathData[] | IDOCGeometryDeclaration;
43
+ type IDOCGeometryProp = Noneable | SVGPathData | SVGPathData[] | IDOCPath2D[] | IDOCGeometryDeclaration;
44
44
 
45
45
  interface IDOCImageDeclaration {
46
46
  url: string;
@@ -76,7 +76,7 @@ type TextWrap = 'wrap' | 'nowrap';
76
76
  type TextAlign = 'center' | 'end' | 'left' | 'right' | 'start';
77
77
  type TextTransform = Noneable | 'uppercase' | 'lowercase';
78
78
  type TextOrientation = 'mixed' | 'upright' | 'sideways-right' | 'sideways';
79
- type TextDecorationLine = Noneable | 'underline' | 'line-through' | 'overline';
79
+ type TextDecoration = Noneable | 'underline' | 'line-through' | 'overline';
80
80
  type VerticalAlign = 'baseline' | 'top' | 'middle' | 'bottom' | 'sub' | 'super' | 'text-top' | 'text-bottom';
81
81
  type WritingMode = 'horizontal-tb' | 'vertical-lr' | 'vertical-rl';
82
82
  type ListStyleType = Noneable | 'disc';
@@ -99,7 +99,7 @@ interface IDOCListStyleStyleDeclaration {
99
99
  listStyleSize: ListStyleSize;
100
100
  listStylePosition: ListStylePosition;
101
101
  }
102
- type HighlightLine = TextDecorationLine | 'outline';
102
+ type HighlightLine = TextDecoration | 'outline';
103
103
  type HighlightImage = Noneable | string;
104
104
  type HighlightReferImage = Noneable | string;
105
105
  type HighlightColormap = Noneable | Record<string, string>;
@@ -164,7 +164,7 @@ interface IDOCTextInlineStyleDeclaration extends IDOCHighlightStyleDeclaration {
164
164
  fontKerning: FontKerning;
165
165
  textTransform: TextTransform;
166
166
  textOrientation: TextOrientation;
167
- textDecoration: TextDecorationLine;
167
+ textDecoration: TextDecoration;
168
168
  }
169
169
  interface IDOCTextDrawStyleDeclaration extends IDOCShadowStyleDeclaration, IDOCTransformStyleDeclaration {
170
170
  textStrokeWidth: number;
@@ -275,4 +275,4 @@ declare function normalizeTextContent(content?: IDOCTextContent): IDOCTextConten
275
275
 
276
276
  declare function normalizeVideo(video?: IDOCVideoProp): IDOCVideoDeclaration | undefined;
277
277
 
278
- export { type FillRule, type FontKerning, type FontStyle, type FontWeight, type HighlightColormap, type HighlightImage, type HighlightLine, type HighlightReferImage, type HighlightSize, type HighlightThickness, type IDCOShadowDeclaration, type IDOCDocument, type IDOCElement, type IDOCElementDeclaration, type IDOCElementStyleDeclaration, type IDOCFillDeclaration, type IDOCFillProp, type IDOCFragmentContent, type IDOCGeometryDeclaration, type IDOCGeometryProp, type IDOCHighlightDeclaration, type IDOCHighlightStyleDeclaration, type IDOCImageDeclaration, type IDOCImageProp, type IDOCListStyleDeclaration, type IDOCListStyleStyleDeclaration, type IDOCMetaProp, type IDOCNode, type IDOCParagraphContent, type IDOCPath2D, type IDOCPath2DStyle, type IDOCShadowStyleDeclaration, type IDOCStrokeDeclaration, type IDOCStrokeProp, type IDOCStyleDeclaration, type IDOCStyleProp, type IDOCTextContent, type IDOCTextContentDeclaration, type IDOCTextContentFlat, type IDOCTextDeclaration, type IDOCTextDrawStyleDeclaration, type IDOCTextInlineStyleDeclaration, type IDOCTextLineStyleDeclaration, type IDOCTextProp, type IDOCTextStyleDeclaration, type IDOCTransformStyleDeclaration, type IDOCVideoDeclaration, type IDOCVideoProp, type ListStyleColormap, type ListStyleImage, type ListStylePosition, type ListStyleSize, type ListStyleType, type Overflow, type SVGPathData, type StrokeLinecap, type StrokeLinejoin, type TextAlign, type TextDecorationLine, type TextOrientation, type TextTransform, type TextWrap, type VerticalAlign, type Visibility, type WritingMode, getDefaultElementStyle, getDefaultStyle, getDefaultTextStyle, normalizeElement, normalizeFill, normalizeGeometry, normalizeImage, normalizeStroke, normalizeText, normalizeTextContent, normalizeVideo };
278
+ export { type FillRule, type FontKerning, type FontStyle, type FontWeight, type HighlightColormap, type HighlightImage, type HighlightLine, type HighlightReferImage, type HighlightSize, type HighlightThickness, type IDCOShadowDeclaration, type IDOCDocument, type IDOCElement, type IDOCElementDeclaration, type IDOCElementStyleDeclaration, type IDOCFillDeclaration, type IDOCFillProp, type IDOCFragmentContent, type IDOCGeometryDeclaration, type IDOCGeometryProp, type IDOCHighlightDeclaration, type IDOCHighlightStyleDeclaration, type IDOCImageDeclaration, type IDOCImageProp, type IDOCListStyleDeclaration, type IDOCListStyleStyleDeclaration, type IDOCMetaProp, type IDOCNode, type IDOCParagraphContent, type IDOCPath2D, type IDOCPath2DStyle, type IDOCShadowStyleDeclaration, type IDOCStrokeDeclaration, type IDOCStrokeProp, type IDOCStyleDeclaration, type IDOCStyleProp, type IDOCTextContent, type IDOCTextContentDeclaration, type IDOCTextContentFlat, type IDOCTextDeclaration, type IDOCTextDrawStyleDeclaration, type IDOCTextInlineStyleDeclaration, type IDOCTextLineStyleDeclaration, type IDOCTextProp, type IDOCTextStyleDeclaration, type IDOCTransformStyleDeclaration, type IDOCVideoDeclaration, type IDOCVideoProp, type ListStyleColormap, type ListStyleImage, type ListStylePosition, type ListStyleSize, type ListStyleType, type Overflow, type SVGPathData, type StrokeLinecap, type StrokeLinejoin, type TextAlign, type TextDecoration, type TextOrientation, type TextTransform, type TextWrap, type VerticalAlign, type Visibility, type WritingMode, getDefaultElementStyle, getDefaultStyle, getDefaultTextStyle, normalizeElement, normalizeFill, normalizeGeometry, normalizeImage, normalizeStroke, normalizeText, normalizeTextContent, normalizeVideo };
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- (function(n,i){typeof exports=="object"&&typeof module<"u"?i(exports):typeof define=="function"&&define.amd?define(["exports"],i):(n=typeof globalThis<"u"?globalThis:n||self,i(n.modernIdoc={}))})(this,function(n){"use strict";function i(){return{overflow:"visible",visibility:"visible",filter:"none",left:0,top:0,width:0,height:0,rotate:0,opacity:1,marginLeft:0,marginTop:0,marginRight:0,marginBottom:0,paddingLeft:0,paddingTop:0,paddingRight:0,paddingBottom:0,scaleX:1,scaleY:1,skewX:0,skewY:0,translateX:0,translateY:0,transform:"none",transformOrigin:"50% 50%",backgroundImage:"none",backgroundColor:"transparent",shadowColor:"transparent",shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0,borderRadius:0,borderColor:"transparent",borderWidth:1}}function l(){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%",scaleX:1,scaleY:1,skewX:0,skewY:0,translateX:0,translateY:0,transform:"none",transformOrigin:"50% 50%",shadowColor:"transparent",shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0}}function h(){return{...i(),...l()}}function f(e){if(!(!e||e==="none"))return typeof e=="string"?{color:e}:e}function s(e){if(!(!e||e==="none"))return typeof e=="string"?{data:[{data:e}]}:Array.isArray(e)?{data:e.map(r=>({data:r}))}:{...e,data:e.data.map(r=>typeof r=="string"?{data:r}:r)}}function u(e){if(!(!e||e==="none"))return typeof e=="string"?{url:e}:e}function g(e){if(!(!e||e==="none"))return typeof e=="string"?{color:e}:e}function a(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(o=>({...o}))}:Array.isArray(t)?{fragments:t.map(o=>typeof o=="string"?{content:o}:{...o})}:{fragments:[]})}function d(e){if(!(!e||e==="none"))return typeof e=="string"?{content:[{fragments:[{content:e}]}]}:"content"in e?{...e,content:a(e.content)}:{content:a(e)}}function m(e){if(!(!e||e==="none"))return typeof e=="string"?{url:e}:{...e}}function c(e){var r;return{...e,image:u(e.image),video:m(e.video),text:d(e.text),geometry:s(e.geometry),fill:f(e.fill),stroke:g(e.stroke),children:(r=e.children)==null?void 0:r.map(t=>c(t))}}n.getDefaultElementStyle=i,n.getDefaultStyle=h,n.getDefaultTextStyle=l,n.normalizeElement=c,n.normalizeFill=f,n.normalizeGeometry=s,n.normalizeImage=u,n.normalizeStroke=g,n.normalizeText=d,n.normalizeTextContent=a,n.normalizeVideo=m,Object.defineProperty(n,Symbol.toStringTag,{value:"Module"})});
1
+ (function(n,i){typeof exports=="object"&&typeof module<"u"?i(exports):typeof define=="function"&&define.amd?define(["exports"],i):(n=typeof globalThis<"u"?globalThis:n||self,i(n.modernIdoc={}))})(this,function(n){"use strict";function i(){return{overflow:"visible",visibility:"visible",filter:"none",left:0,top:0,width:0,height:0,rotate:0,opacity:1,marginLeft:0,marginTop:0,marginRight:0,marginBottom:0,paddingLeft:0,paddingTop:0,paddingRight:0,paddingBottom:0,scaleX:1,scaleY:1,skewX:0,skewY:0,translateX:0,translateY:0,transform:"none",transformOrigin:"50% 50%",backgroundImage:"none",backgroundColor:"transparent",shadowColor:"transparent",shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0,borderRadius:0,borderColor:"transparent",borderWidth:1}}function l(){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%",scaleX:1,scaleY:1,skewX:0,skewY:0,translateX:0,translateY:0,transform:"none",transformOrigin:"50% 50%",shadowColor:"transparent",shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0}}function h(){return{...i(),...l()}}function f(e){if(!(!e||e==="none"))return typeof e=="string"?{color:e}:e}function s(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 u(e){if(!(!e||e==="none"))return typeof e=="string"?{url:e}:e}function g(e){if(!(!e||e==="none"))return typeof e=="string"?{color:e}:e}function a(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(o=>({...o}))}:Array.isArray(t)?{fragments:t.map(o=>typeof o=="string"?{content:o}:{...o})}:{fragments:[]})}function d(e){if(!(!e||e==="none"))return typeof e=="string"?{content:[{fragments:[{content:e}]}]}:"content"in e?{...e,content:a(e.content)}:{content:a(e)}}function m(e){if(!(!e||e==="none"))return typeof e=="string"?{url:e}:{...e}}function c(e){var r;return{...e,image:u(e.image),video:m(e.video),text:d(e.text),geometry:s(e.geometry),fill:f(e.fill),stroke:g(e.stroke),children:(r=e.children)==null?void 0:r.map(t=>c(t))}}n.getDefaultElementStyle=i,n.getDefaultStyle=h,n.getDefaultTextStyle=l,n.normalizeElement=c,n.normalizeFill=f,n.normalizeGeometry=s,n.normalizeImage=u,n.normalizeStroke=g,n.normalizeText=d,n.normalizeTextContent=a,n.normalizeVideo=m,Object.defineProperty(n,Symbol.toStringTag,{value:"Module"})});
package/dist/index.mjs CHANGED
@@ -130,15 +130,6 @@ function normalizeGeometry(geometry) {
130
130
  } else if (Array.isArray(geometry)) {
131
131
  return {
132
132
  data: geometry.map((data) => {
133
- return {
134
- data
135
- };
136
- })
137
- };
138
- } else {
139
- return {
140
- ...geometry,
141
- data: geometry.data.map((data) => {
142
133
  if (typeof data === "string") {
143
134
  return {
144
135
  data
@@ -147,6 +138,8 @@ function normalizeGeometry(geometry) {
147
138
  return data;
148
139
  })
149
140
  };
141
+ } else {
142
+ return geometry;
150
143
  }
151
144
  }
152
145
 
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "modern-idoc",
3
3
  "type": "module",
4
- "version": "0.1.3",
5
- "packageManager": "pnpm@9.9.0",
4
+ "version": "0.1.4",
5
+ "packageManager": "pnpm@9.15.1",
6
6
  "description": "Intermediate document for modern codec libs",
7
7
  "author": "wxm",
8
8
  "license": "MIT",
@@ -55,15 +55,15 @@
55
55
  },
56
56
  "devDependencies": {
57
57
  "@antfu/eslint-config": "^3.12.1",
58
- "@types/node": "^22.10.2",
58
+ "@types/node": "^22.10.3",
59
59
  "bumpp": "^9.9.2",
60
60
  "conventional-changelog-cli": "^5.0.0",
61
61
  "eslint": "^9.17.0",
62
- "lint-staged": "^15.2.11",
62
+ "lint-staged": "^15.3.0",
63
63
  "simple-git-hooks": "^2.11.1",
64
64
  "typescript": "^5.7.2",
65
- "unbuild": "^3.0.1",
66
- "vite": "^6.0.5",
65
+ "unbuild": "^3.2.0",
66
+ "vite": "^6.0.6",
67
67
  "vitest": "^2.1.8"
68
68
  },
69
69
  "simple-git-hooks": {