modern-idoc 0.1.4 → 0.1.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 CHANGED
@@ -1,16 +1,37 @@
1
1
  'use strict';
2
2
 
3
- function getDefaultElementStyle() {
3
+ function getDefaultShadowStyle() {
4
+ return {
5
+ shadowColor: "transparent",
6
+ shadowOffsetX: 0,
7
+ shadowOffsetY: 0,
8
+ shadowBlur: 0
9
+ };
10
+ }
11
+
12
+ function getDefaultTransformStyle() {
4
13
  return {
5
- overflow: "visible",
6
- visibility: "visible",
7
- filter: "none",
8
- // position
9
14
  left: 0,
10
15
  top: 0,
11
16
  width: 0,
12
17
  height: 0,
13
18
  rotate: 0,
19
+ scaleX: 1,
20
+ scaleY: 1,
21
+ skewX: 0,
22
+ skewY: 0,
23
+ translateX: 0,
24
+ translateY: 0,
25
+ transform: "none",
26
+ transformOrigin: "center"
27
+ };
28
+ }
29
+
30
+ function getDefaultElementStyle() {
31
+ return {
32
+ overflow: "visible",
33
+ visibility: "visible",
34
+ filter: "none",
14
35
  opacity: 1,
15
36
  // margin
16
37
  marginLeft: 0,
@@ -23,22 +44,12 @@ function getDefaultElementStyle() {
23
44
  paddingRight: 0,
24
45
  paddingBottom: 0,
25
46
  // transform
26
- scaleX: 1,
27
- scaleY: 1,
28
- skewX: 0,
29
- skewY: 0,
30
- translateX: 0,
31
- translateY: 0,
32
- transform: "none",
33
- transformOrigin: "50% 50%",
47
+ ...getDefaultTransformStyle(),
34
48
  // background
35
49
  backgroundImage: "none",
36
50
  backgroundColor: "transparent",
37
51
  // shadow
38
- shadowColor: "transparent",
39
- shadowOffsetX: 0,
40
- shadowOffsetY: 0,
41
- shadowBlur: 0,
52
+ ...getDefaultShadowStyle(),
42
53
  // border
43
54
  borderRadius: 0,
44
55
  borderColor: "transparent",
@@ -83,21 +94,7 @@ function getDefaultTextStyle() {
83
94
  highlightColormap: "none",
84
95
  highlightLine: "none",
85
96
  highlightSize: "cover",
86
- highlightThickness: "100%",
87
- // transform
88
- scaleX: 1,
89
- scaleY: 1,
90
- skewX: 0,
91
- skewY: 0,
92
- translateX: 0,
93
- translateY: 0,
94
- transform: "none",
95
- transformOrigin: "50% 50%",
96
- // shadow
97
- shadowColor: "transparent",
98
- shadowOffsetX: 0,
99
- shadowOffsetY: 0,
100
- shadowBlur: 0
97
+ highlightThickness: "100%"
101
98
  };
102
99
  }
103
100
 
@@ -262,8 +259,10 @@ function normalizeElement(element) {
262
259
  }
263
260
 
264
261
  exports.getDefaultElementStyle = getDefaultElementStyle;
262
+ exports.getDefaultShadowStyle = getDefaultShadowStyle;
265
263
  exports.getDefaultStyle = getDefaultStyle;
266
264
  exports.getDefaultTextStyle = getDefaultTextStyle;
265
+ exports.getDefaultTransformStyle = getDefaultTransformStyle;
267
266
  exports.normalizeElement = normalizeElement;
268
267
  exports.normalizeFill = normalizeFill;
269
268
  exports.normalizeGeometry = normalizeGeometry;
package/dist/index.d.cts CHANGED
@@ -136,6 +136,11 @@ interface IDOCShadowStyleDeclaration {
136
136
  shadowBlur: number;
137
137
  }
138
138
  interface IDOCTransformStyleDeclaration {
139
+ left: number;
140
+ top: number;
141
+ width: number;
142
+ height: number;
143
+ rotate: number;
139
144
  scaleX: number;
140
145
  scaleY: number;
141
146
  skewX: number;
@@ -166,7 +171,7 @@ interface IDOCTextInlineStyleDeclaration extends IDOCHighlightStyleDeclaration {
166
171
  textOrientation: TextOrientation;
167
172
  textDecoration: TextDecoration;
168
173
  }
169
- interface IDOCTextDrawStyleDeclaration extends IDOCShadowStyleDeclaration, IDOCTransformStyleDeclaration {
174
+ interface IDOCTextDrawStyleDeclaration {
170
175
  textStrokeWidth: number;
171
176
  textStrokeColor: string;
172
177
  }
@@ -176,11 +181,6 @@ interface IDOCElementStyleDeclaration extends IDOCShadowStyleDeclaration, IDOCTr
176
181
  overflow: Overflow;
177
182
  visibility: Visibility;
178
183
  filter: string;
179
- left: number;
180
- top: number;
181
- width: number;
182
- height: number;
183
- rotate: number;
184
184
  opacity: number;
185
185
  marginLeft: number;
186
186
  marginTop: number;
@@ -255,10 +255,14 @@ interface IDOCElementDeclaration extends IDOCElement {
255
255
 
256
256
  declare function getDefaultElementStyle(): IDOCElementStyleDeclaration;
257
257
 
258
+ declare function getDefaultShadowStyle(): IDOCShadowStyleDeclaration;
259
+
258
260
  declare function getDefaultStyle(): IDOCStyleDeclaration;
259
261
 
260
262
  declare function getDefaultTextStyle(): IDOCTextStyleDeclaration;
261
263
 
264
+ declare function getDefaultTransformStyle(): IDOCTransformStyleDeclaration;
265
+
262
266
  declare function normalizeElement(element: IDOCElement): IDOCElementDeclaration;
263
267
 
264
268
  declare function normalizeFill(fill?: IDOCFillProp): IDOCFillDeclaration | undefined;
@@ -275,4 +279,4 @@ declare function normalizeTextContent(content?: IDOCTextContent): IDOCTextConten
275
279
 
276
280
  declare function normalizeVideo(video?: IDOCVideoProp): IDOCVideoDeclaration | undefined;
277
281
 
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 };
282
+ 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, getDefaultShadowStyle, getDefaultStyle, getDefaultTextStyle, getDefaultTransformStyle, normalizeElement, normalizeFill, normalizeGeometry, normalizeImage, normalizeStroke, normalizeText, normalizeTextContent, normalizeVideo };
package/dist/index.d.mts CHANGED
@@ -136,6 +136,11 @@ interface IDOCShadowStyleDeclaration {
136
136
  shadowBlur: number;
137
137
  }
138
138
  interface IDOCTransformStyleDeclaration {
139
+ left: number;
140
+ top: number;
141
+ width: number;
142
+ height: number;
143
+ rotate: number;
139
144
  scaleX: number;
140
145
  scaleY: number;
141
146
  skewX: number;
@@ -166,7 +171,7 @@ interface IDOCTextInlineStyleDeclaration extends IDOCHighlightStyleDeclaration {
166
171
  textOrientation: TextOrientation;
167
172
  textDecoration: TextDecoration;
168
173
  }
169
- interface IDOCTextDrawStyleDeclaration extends IDOCShadowStyleDeclaration, IDOCTransformStyleDeclaration {
174
+ interface IDOCTextDrawStyleDeclaration {
170
175
  textStrokeWidth: number;
171
176
  textStrokeColor: string;
172
177
  }
@@ -176,11 +181,6 @@ interface IDOCElementStyleDeclaration extends IDOCShadowStyleDeclaration, IDOCTr
176
181
  overflow: Overflow;
177
182
  visibility: Visibility;
178
183
  filter: string;
179
- left: number;
180
- top: number;
181
- width: number;
182
- height: number;
183
- rotate: number;
184
184
  opacity: number;
185
185
  marginLeft: number;
186
186
  marginTop: number;
@@ -255,10 +255,14 @@ interface IDOCElementDeclaration extends IDOCElement {
255
255
 
256
256
  declare function getDefaultElementStyle(): IDOCElementStyleDeclaration;
257
257
 
258
+ declare function getDefaultShadowStyle(): IDOCShadowStyleDeclaration;
259
+
258
260
  declare function getDefaultStyle(): IDOCStyleDeclaration;
259
261
 
260
262
  declare function getDefaultTextStyle(): IDOCTextStyleDeclaration;
261
263
 
264
+ declare function getDefaultTransformStyle(): IDOCTransformStyleDeclaration;
265
+
262
266
  declare function normalizeElement(element: IDOCElement): IDOCElementDeclaration;
263
267
 
264
268
  declare function normalizeFill(fill?: IDOCFillProp): IDOCFillDeclaration | undefined;
@@ -275,4 +279,4 @@ declare function normalizeTextContent(content?: IDOCTextContent): IDOCTextConten
275
279
 
276
280
  declare function normalizeVideo(video?: IDOCVideoProp): IDOCVideoDeclaration | undefined;
277
281
 
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 };
282
+ 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, getDefaultShadowStyle, getDefaultStyle, getDefaultTextStyle, getDefaultTransformStyle, normalizeElement, normalizeFill, normalizeGeometry, normalizeImage, normalizeStroke, normalizeText, normalizeTextContent, normalizeVideo };
package/dist/index.d.ts CHANGED
@@ -136,6 +136,11 @@ interface IDOCShadowStyleDeclaration {
136
136
  shadowBlur: number;
137
137
  }
138
138
  interface IDOCTransformStyleDeclaration {
139
+ left: number;
140
+ top: number;
141
+ width: number;
142
+ height: number;
143
+ rotate: number;
139
144
  scaleX: number;
140
145
  scaleY: number;
141
146
  skewX: number;
@@ -166,7 +171,7 @@ interface IDOCTextInlineStyleDeclaration extends IDOCHighlightStyleDeclaration {
166
171
  textOrientation: TextOrientation;
167
172
  textDecoration: TextDecoration;
168
173
  }
169
- interface IDOCTextDrawStyleDeclaration extends IDOCShadowStyleDeclaration, IDOCTransformStyleDeclaration {
174
+ interface IDOCTextDrawStyleDeclaration {
170
175
  textStrokeWidth: number;
171
176
  textStrokeColor: string;
172
177
  }
@@ -176,11 +181,6 @@ interface IDOCElementStyleDeclaration extends IDOCShadowStyleDeclaration, IDOCTr
176
181
  overflow: Overflow;
177
182
  visibility: Visibility;
178
183
  filter: string;
179
- left: number;
180
- top: number;
181
- width: number;
182
- height: number;
183
- rotate: number;
184
184
  opacity: number;
185
185
  marginLeft: number;
186
186
  marginTop: number;
@@ -255,10 +255,14 @@ interface IDOCElementDeclaration extends IDOCElement {
255
255
 
256
256
  declare function getDefaultElementStyle(): IDOCElementStyleDeclaration;
257
257
 
258
+ declare function getDefaultShadowStyle(): IDOCShadowStyleDeclaration;
259
+
258
260
  declare function getDefaultStyle(): IDOCStyleDeclaration;
259
261
 
260
262
  declare function getDefaultTextStyle(): IDOCTextStyleDeclaration;
261
263
 
264
+ declare function getDefaultTransformStyle(): IDOCTransformStyleDeclaration;
265
+
262
266
  declare function normalizeElement(element: IDOCElement): IDOCElementDeclaration;
263
267
 
264
268
  declare function normalizeFill(fill?: IDOCFillProp): IDOCFillDeclaration | undefined;
@@ -275,4 +279,4 @@ declare function normalizeTextContent(content?: IDOCTextContent): IDOCTextConten
275
279
 
276
280
  declare function normalizeVideo(video?: IDOCVideoProp): IDOCVideoDeclaration | undefined;
277
281
 
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 };
282
+ 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, getDefaultShadowStyle, getDefaultStyle, getDefaultTextStyle, getDefaultTransformStyle, 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=>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"})});
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{shadowColor:"transparent",shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0}}function a(){return{left:0,top:0,width:0,height:0,rotate:0,scaleX:1,scaleY:1,skewX:0,skewY:0,translateX:0,translateY:0,transform:"none",transformOrigin:"center"}}function f(){return{overflow:"visible",visibility:"visible",filter:"none",opacity:1,marginLeft:0,marginTop:0,marginRight:0,marginBottom:0,paddingLeft:0,paddingTop:0,paddingRight:0,paddingBottom:0,...a(),backgroundImage:"none",backgroundColor:"transparent",...i(),borderRadius:0,borderColor:"transparent",borderWidth:1}}function u(){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 S(){return{...f(),...u()}}function s(e){if(!(!e||e==="none"))return typeof e=="string"?{color:e}:e}function g(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 d(e){if(!(!e||e==="none"))return typeof e=="string"?{url:e}:e}function m(e){if(!(!e||e==="none"))return typeof e=="string"?{color:e}:e}function l(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 c(e){if(!(!e||e==="none"))return typeof e=="string"?{content:[{fragments:[{content:e}]}]}:"content"in e?{...e,content:l(e.content)}:{content:l(e)}}function h(e){if(!(!e||e==="none"))return typeof e=="string"?{url:e}:{...e}}function y(e){var r;return{...e,image:d(e.image),video:h(e.video),text:c(e.text),geometry:g(e.geometry),fill:s(e.fill),stroke:m(e.stroke),children:(r=e.children)==null?void 0:r.map(t=>y(t))}}n.getDefaultElementStyle=f,n.getDefaultShadowStyle=i,n.getDefaultStyle=S,n.getDefaultTextStyle=u,n.getDefaultTransformStyle=a,n.normalizeElement=y,n.normalizeFill=s,n.normalizeGeometry=g,n.normalizeImage=d,n.normalizeStroke=m,n.normalizeText=c,n.normalizeTextContent=l,n.normalizeVideo=h,Object.defineProperty(n,Symbol.toStringTag,{value:"Module"})});
package/dist/index.mjs CHANGED
@@ -1,14 +1,35 @@
1
- function getDefaultElementStyle() {
1
+ function getDefaultShadowStyle() {
2
+ return {
3
+ shadowColor: "transparent",
4
+ shadowOffsetX: 0,
5
+ shadowOffsetY: 0,
6
+ shadowBlur: 0
7
+ };
8
+ }
9
+
10
+ function getDefaultTransformStyle() {
2
11
  return {
3
- overflow: "visible",
4
- visibility: "visible",
5
- filter: "none",
6
- // position
7
12
  left: 0,
8
13
  top: 0,
9
14
  width: 0,
10
15
  height: 0,
11
16
  rotate: 0,
17
+ scaleX: 1,
18
+ scaleY: 1,
19
+ skewX: 0,
20
+ skewY: 0,
21
+ translateX: 0,
22
+ translateY: 0,
23
+ transform: "none",
24
+ transformOrigin: "center"
25
+ };
26
+ }
27
+
28
+ function getDefaultElementStyle() {
29
+ return {
30
+ overflow: "visible",
31
+ visibility: "visible",
32
+ filter: "none",
12
33
  opacity: 1,
13
34
  // margin
14
35
  marginLeft: 0,
@@ -21,22 +42,12 @@ function getDefaultElementStyle() {
21
42
  paddingRight: 0,
22
43
  paddingBottom: 0,
23
44
  // transform
24
- scaleX: 1,
25
- scaleY: 1,
26
- skewX: 0,
27
- skewY: 0,
28
- translateX: 0,
29
- translateY: 0,
30
- transform: "none",
31
- transformOrigin: "50% 50%",
45
+ ...getDefaultTransformStyle(),
32
46
  // background
33
47
  backgroundImage: "none",
34
48
  backgroundColor: "transparent",
35
49
  // shadow
36
- shadowColor: "transparent",
37
- shadowOffsetX: 0,
38
- shadowOffsetY: 0,
39
- shadowBlur: 0,
50
+ ...getDefaultShadowStyle(),
40
51
  // border
41
52
  borderRadius: 0,
42
53
  borderColor: "transparent",
@@ -81,21 +92,7 @@ function getDefaultTextStyle() {
81
92
  highlightColormap: "none",
82
93
  highlightLine: "none",
83
94
  highlightSize: "cover",
84
- highlightThickness: "100%",
85
- // transform
86
- scaleX: 1,
87
- scaleY: 1,
88
- skewX: 0,
89
- skewY: 0,
90
- translateX: 0,
91
- translateY: 0,
92
- transform: "none",
93
- transformOrigin: "50% 50%",
94
- // shadow
95
- shadowColor: "transparent",
96
- shadowOffsetX: 0,
97
- shadowOffsetY: 0,
98
- shadowBlur: 0
95
+ highlightThickness: "100%"
99
96
  };
100
97
  }
101
98
 
@@ -259,4 +256,4 @@ function normalizeElement(element) {
259
256
  };
260
257
  }
261
258
 
262
- export { getDefaultElementStyle, getDefaultStyle, getDefaultTextStyle, normalizeElement, normalizeFill, normalizeGeometry, normalizeImage, normalizeStroke, normalizeText, normalizeTextContent, normalizeVideo };
259
+ export { getDefaultElementStyle, getDefaultShadowStyle, getDefaultStyle, getDefaultTextStyle, getDefaultTransformStyle, normalizeElement, normalizeFill, normalizeGeometry, normalizeImage, normalizeStroke, normalizeText, normalizeTextContent, normalizeVideo };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "modern-idoc",
3
3
  "type": "module",
4
- "version": "0.1.4",
4
+ "version": "0.1.5",
5
5
  "packageManager": "pnpm@9.15.1",
6
6
  "description": "Intermediate document for modern codec libs",
7
7
  "author": "wxm",