modern-idoc 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -157,7 +157,7 @@ function normalizeImage(image) {
157
157
  return void 0;
158
158
  } else if (typeof image === "string") {
159
159
  return {
160
- src: image
160
+ url: image
161
161
  };
162
162
  } else {
163
163
  return image;
@@ -246,7 +246,7 @@ function normalizeVideo(video) {
246
246
  return void 0;
247
247
  } else if (typeof video === "string") {
248
248
  return {
249
- src: video
249
+ url: video
250
250
  };
251
251
  } else {
252
252
  return {
package/dist/index.d.cts CHANGED
@@ -1,10 +1,10 @@
1
- interface IDOCNormalizedFillProp {
1
+ interface IDOCFillDeclaration {
2
+ url?: string;
2
3
  color?: string;
3
- image?: string;
4
4
  opacity?: number;
5
5
  }
6
6
 
7
- type IDOCFillProp = 'none' | string | IDOCNormalizedFillProp;
7
+ type IDOCFillProp = 'none' | string | IDOCFillDeclaration;
8
8
 
9
9
  type SVGPathData = string;
10
10
  type FillRule = 'nonzero' | 'evenodd';
@@ -33,17 +33,18 @@ interface IDOCPath2DStyle {
33
33
  interface IDOCPath2D extends Partial<IDOCPath2DStyle> {
34
34
  data: SVGPathData;
35
35
  }
36
- interface IDOCGeometryPropObject {
36
+ interface IDOCGeometryDeclaration {
37
37
  data: (IDOCPath2D | SVGPathData)[];
38
38
  }
39
- type IDOCGeometryProp = 'none' | SVGPathData | SVGPathData[] | IDOCGeometryPropObject;
40
39
 
41
- interface IDOCNormalizedImageProp {
42
- src: string;
40
+ type IDOCGeometryProp = 'none' | SVGPathData | SVGPathData[] | IDOCGeometryDeclaration;
41
+
42
+ interface IDOCImageDeclaration {
43
+ url: string;
43
44
  opacity?: number;
44
45
  }
45
46
 
46
- type IDOCImageProp = 'none' | string | IDOCNormalizedImageProp;
47
+ type IDOCImageProp = 'none' | string | IDOCImageDeclaration;
47
48
 
48
49
  interface IDOCMetaProp {
49
50
  [key: string]: any;
@@ -55,13 +56,13 @@ interface IDOCNode {
55
56
  meta?: IDOCMetaProp;
56
57
  }
57
58
 
58
- interface IDOCNormalizedStrokeProp {
59
+ interface IDOCStrokeDeclaration {
60
+ url?: string;
59
61
  color?: string;
60
- image?: string;
61
62
  opacity?: number;
62
63
  }
63
64
 
64
- type IDOCStrokeProp = 'none' | string | IDOCNormalizedStrokeProp;
65
+ type IDOCStrokeProp = 'none' | string | IDOCStrokeDeclaration;
65
66
 
66
67
  type Overflow = 'hidden' | 'visible';
67
68
  type Visibility = 'hidden' | 'visible';
@@ -81,15 +82,15 @@ type ListStyleImage = 'none' | string;
81
82
  type ListStyleColormap = 'none' | Record<string, string>;
82
83
  type ListStyleSize = 'cover' | Sizeable;
83
84
  type ListStylePosition = 'inside' | 'outside';
84
- interface IDOCListStyleObject {
85
+ interface IDOCListStyleDeclaration {
85
86
  type: ListStyleType;
86
87
  image: ListStyleImage;
87
88
  colormap: ListStyleColormap;
88
89
  size: ListStyleSize;
89
90
  position: ListStylePosition;
90
91
  }
91
- interface IDOCListStyleStyle {
92
- listStyle?: Partial<IDOCListStyleObject>;
92
+ interface IDOCListStyleStyleDeclaration {
93
+ listStyle?: Partial<IDOCListStyleDeclaration>;
93
94
  listStyleType: ListStyleType;
94
95
  listStyleImage: ListStyleImage;
95
96
  listStyleColormap: ListStyleColormap;
@@ -102,7 +103,7 @@ type HighlightReferImage = 'none' | string;
102
103
  type HighlightColormap = 'none' | Record<string, string>;
103
104
  type HighlightSize = 'cover' | Sizeable;
104
105
  type HighlightThickness = Sizeable;
105
- interface IDOCHighlightObject {
106
+ interface IDOCHighlightDeclaration {
106
107
  image: HighlightImage;
107
108
  referImage: HighlightReferImage;
108
109
  colormap: HighlightColormap;
@@ -110,8 +111,8 @@ interface IDOCHighlightObject {
110
111
  size: HighlightSize;
111
112
  thickness: HighlightThickness;
112
113
  }
113
- interface IDOCHighlightStyle {
114
- highlight?: Partial<IDOCHighlightObject>;
114
+ interface IDOCHighlightStyleDeclaration {
115
+ highlight?: Partial<IDOCHighlightDeclaration>;
115
116
  highlightImage: HighlightImage;
116
117
  highlightReferImage: HighlightReferImage;
117
118
  highlightColormap: HighlightColormap;
@@ -119,20 +120,20 @@ interface IDOCHighlightStyle {
119
120
  highlightSize: HighlightSize;
120
121
  highlightThickness: HighlightThickness;
121
122
  }
122
- interface IDCOShadowObject {
123
+ interface IDCOShadowDeclaration {
123
124
  color: string;
124
125
  offsetX: number;
125
126
  offsetY: number;
126
127
  blur: number;
127
128
  }
128
- interface IDOCShadowStyle {
129
- shadow?: Partial<IDCOShadowObject>;
129
+ interface IDOCShadowStyleDeclaration {
130
+ shadow?: Partial<IDCOShadowDeclaration>;
130
131
  shadowColor: string;
131
132
  shadowOffsetX: number;
132
133
  shadowOffsetY: number;
133
134
  shadowBlur: number;
134
135
  }
135
- interface IDOCTransformStyle {
136
+ interface IDOCTransformStyleDeclaration {
136
137
  scaleX: number;
137
138
  scaleY: number;
138
139
  skewX: number;
@@ -142,14 +143,14 @@ interface IDOCTransformStyle {
142
143
  transform: string;
143
144
  transformOrigin: string;
144
145
  }
145
- interface IDOCTextLineStyle extends IDOCListStyleStyle {
146
+ interface IDOCTextLineStyleDeclaration extends IDOCListStyleStyleDeclaration {
146
147
  writingMode: WritingMode;
147
148
  textWrap: TextWrap;
148
149
  textAlign: TextAlign;
149
150
  textIndent: number;
150
151
  lineHeight: number;
151
152
  }
152
- interface IDOCTextInlineStyle extends IDOCHighlightStyle {
153
+ interface IDOCTextInlineStyleDeclaration extends IDOCHighlightStyleDeclaration {
153
154
  color: string;
154
155
  verticalAlign: VerticalAlign;
155
156
  letterSpacing: number;
@@ -163,13 +164,13 @@ interface IDOCTextInlineStyle extends IDOCHighlightStyle {
163
164
  textOrientation: TextOrientation;
164
165
  textDecoration: TextDecorationLine;
165
166
  }
166
- interface IDOCTextDrawStyle extends IDOCShadowStyle, IDOCTransformStyle {
167
+ interface IDOCTextDrawStyleDeclaration extends IDOCShadowStyleDeclaration, IDOCTransformStyleDeclaration {
167
168
  textStrokeWidth: number;
168
169
  textStrokeColor: string;
169
170
  }
170
- interface IDOCTextStyle extends IDOCTextLineStyle, IDOCTextInlineStyle, IDOCTextDrawStyle {
171
+ interface IDOCTextStyleDeclaration extends IDOCTextLineStyleDeclaration, IDOCTextInlineStyleDeclaration, IDOCTextDrawStyleDeclaration {
171
172
  }
172
- interface IDOCElementStyle extends IDOCShadowStyle, IDOCTransformStyle {
173
+ interface IDOCElementStyleDeclaration extends IDOCShadowStyleDeclaration, IDOCTransformStyleDeclaration {
173
174
  overflow: Overflow;
174
175
  visibility: Visibility;
175
176
  filter: string;
@@ -193,35 +194,40 @@ interface IDOCElementStyle extends IDOCShadowStyle, IDOCTransformStyle {
193
194
  borderColor: string;
194
195
  borderWidth: number;
195
196
  }
196
- interface IDOCStyleProp extends IDOCTextStyle, IDOCElementStyle {
197
+ interface IDOCStyleDeclaration extends IDOCTextStyleDeclaration, IDOCElementStyleDeclaration {
197
198
  }
198
199
 
199
- interface IDOCFragmentContent extends Partial<IDOCStyleProp> {
200
+ type IDOCStyleProp = Partial<IDOCStyleDeclaration>;
201
+
202
+ interface IDOCFragmentContent extends Partial<IDOCStyleDeclaration> {
200
203
  content: string;
201
204
  }
202
- interface IDOCParagraphContent extends Partial<IDOCStyleProp> {
205
+ interface IDOCParagraphContent extends Partial<IDOCStyleDeclaration> {
203
206
  fragments: IDOCFragmentContent[];
204
207
  }
205
- type IDOCFlatTextContent = string | IDOCFragmentContent | IDOCParagraphContent | (string | IDOCFragmentContent)[];
206
- type IDOCTextContent = string | IDOCFragmentContent | IDOCParagraphContent | IDOCFlatTextContent[];
207
- type IDOCNormalizedTextContent = IDOCParagraphContent[];
208
- interface IDOCTextObject {
209
- content: IDOCTextContent;
210
- effects?: Partial<IDOCStyleProp>[];
208
+ type IDOCTextContentFlat = string | IDOCFragmentContent | IDOCParagraphContent | (string | IDOCFragmentContent)[];
209
+ type IDOCTextContent = string | IDOCFragmentContent | IDOCParagraphContent | IDOCTextContentFlat[];
210
+ type IDOCTextContentDeclaration = IDOCParagraphContent[];
211
+ interface IDOCTextDeclaration {
212
+ content: IDOCTextContentDeclaration;
213
+ effects?: Partial<IDOCStyleDeclaration>[];
211
214
  measureDom?: any;
212
215
  fonts?: any;
213
216
  }
214
- type IDOCTextProp = string | IDOCTextContent | IDOCTextObject;
215
217
 
216
- interface IDOCNormalizedVideoProp {
217
- src: string;
218
+ type IDOCTextProp = string | IDOCTextContent | (IDOCTextDeclaration & {
219
+ content: IDOCTextContent;
220
+ }) | IDOCTextDeclaration;
221
+
222
+ interface IDOCVideoDeclaration {
223
+ url: string;
218
224
  opacity?: number;
219
225
  }
220
226
 
221
- type IDOCVideoProp = 'none' | string | IDOCNormalizedVideoProp;
227
+ type IDOCVideoProp = 'none' | string | IDOCVideoDeclaration;
222
228
 
223
229
  interface IDOCElement extends IDOCNode {
224
- style?: Partial<IDOCStyleProp>;
230
+ style?: IDOCStyleProp;
225
231
  image?: IDOCImageProp;
226
232
  video?: IDOCVideoProp;
227
233
  text?: IDOCTextProp;
@@ -235,44 +241,36 @@ interface IDOCDocument extends IDOCElement {
235
241
  fonts?: any;
236
242
  }
237
243
 
238
- interface IDOCNormalizedGeometryProp extends IDOCGeometryPropObject {
239
- data: IDOCPath2D[];
240
- }
241
-
242
- interface IDOCNormalizedTextProp extends IDOCTextObject {
243
- content: IDOCNormalizedTextContent;
244
- }
245
-
246
- interface IDOCNormalizedElement extends IDOCElement {
247
- image?: IDOCNormalizedImageProp;
248
- video?: IDOCNormalizedVideoProp;
249
- text?: IDOCNormalizedTextProp;
250
- geometry?: IDOCNormalizedGeometryProp;
251
- fill?: IDOCNormalizedFillProp;
252
- stroke?: IDOCNormalizedStrokeProp;
253
- children?: IDOCNormalizedElement[];
244
+ interface IDOCElementDeclaration extends IDOCElement {
245
+ image?: IDOCImageDeclaration;
246
+ video?: IDOCVideoDeclaration;
247
+ text?: IDOCTextDeclaration;
248
+ geometry?: IDOCGeometryDeclaration;
249
+ fill?: IDOCFillDeclaration;
250
+ stroke?: IDOCStrokeDeclaration;
251
+ children?: IDOCElementDeclaration[];
254
252
  }
255
253
 
256
- declare function getDefaultElementStyle(): IDOCElementStyle;
254
+ declare function getDefaultElementStyle(): IDOCElementStyleDeclaration;
257
255
 
258
- declare function getDefaultStyle(): IDOCStyleProp;
256
+ declare function getDefaultStyle(): IDOCStyleDeclaration;
259
257
 
260
- declare function getDefaultTextStyle(): IDOCTextStyle;
258
+ declare function getDefaultTextStyle(): IDOCTextStyleDeclaration;
261
259
 
262
- declare function normalizeElement(element: IDOCElement): IDOCNormalizedElement;
260
+ declare function normalizeElement(element: IDOCElement): IDOCElementDeclaration;
263
261
 
264
- declare function normalizeFill(fill?: IDOCFillProp): IDOCNormalizedFillProp | undefined;
262
+ declare function normalizeFill(fill?: IDOCFillProp): IDOCFillDeclaration | undefined;
265
263
 
266
- declare function normalizeGeometry(geometry?: IDOCGeometryProp): IDOCNormalizedGeometryProp | undefined;
264
+ declare function normalizeGeometry(geometry?: IDOCGeometryProp): IDOCGeometryDeclaration | undefined;
267
265
 
268
- declare function normalizeImage(image?: IDOCImageProp): IDOCNormalizedImageProp | undefined;
266
+ declare function normalizeImage(image?: IDOCImageProp): IDOCImageDeclaration | undefined;
269
267
 
270
- declare function normalizeStroke(stroke?: IDOCStrokeProp): IDOCNormalizedStrokeProp | undefined;
268
+ declare function normalizeStroke(stroke?: IDOCStrokeProp): IDOCStrokeDeclaration | undefined;
271
269
 
272
- declare function normalizeText(text?: IDOCTextProp): IDOCNormalizedTextProp | undefined;
270
+ declare function normalizeText(text?: IDOCTextProp): IDOCTextDeclaration | undefined;
273
271
 
274
- declare function normalizeTextContent(content?: IDOCTextContent): IDOCNormalizedTextContent;
272
+ declare function normalizeTextContent(content?: IDOCTextContent): IDOCTextContentDeclaration;
275
273
 
276
- declare function normalizeVideo(video?: IDOCVideoProp): IDOCNormalizedVideoProp | undefined;
274
+ declare function normalizeVideo(video?: IDOCVideoProp): IDOCVideoDeclaration | undefined;
277
275
 
278
- export { type FillRule, type FontKerning, type FontStyle, type FontWeight, type HighlightColormap, type HighlightImage, type HighlightLine, type HighlightReferImage, type HighlightSize, type HighlightThickness, type IDCOShadowObject, type IDOCDocument, type IDOCElement, type IDOCElementStyle, type IDOCFillProp, type IDOCFlatTextContent, type IDOCFragmentContent, type IDOCGeometryProp, type IDOCGeometryPropObject, type IDOCHighlightObject, type IDOCHighlightStyle, type IDOCImageProp, type IDOCListStyleObject, type IDOCListStyleStyle, type IDOCMetaProp, type IDOCNode, type IDOCNormalizedElement, type IDOCNormalizedFillProp, type IDOCNormalizedGeometryProp, type IDOCNormalizedImageProp, type IDOCNormalizedStrokeProp, type IDOCNormalizedTextContent, type IDOCNormalizedTextProp, type IDOCNormalizedVideoProp, type IDOCParagraphContent, type IDOCPath2D, type IDOCPath2DStyle, type IDOCShadowStyle, type IDOCStrokeProp, type IDOCStyleProp, type IDOCTextContent, type IDOCTextDrawStyle, type IDOCTextInlineStyle, type IDOCTextLineStyle, type IDOCTextObject, type IDOCTextProp, type IDOCTextStyle, type IDOCTransformStyle, type IDOCVideoProp, type ListStyleColormap, type ListStyleImage, type ListStylePosition, type ListStyleSize, type ListStyleType, type Overflow, type SVGPathData, type Sizeable, 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 };
276
+ 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 Sizeable, 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 };
package/dist/index.d.mts CHANGED
@@ -1,10 +1,10 @@
1
- interface IDOCNormalizedFillProp {
1
+ interface IDOCFillDeclaration {
2
+ url?: string;
2
3
  color?: string;
3
- image?: string;
4
4
  opacity?: number;
5
5
  }
6
6
 
7
- type IDOCFillProp = 'none' | string | IDOCNormalizedFillProp;
7
+ type IDOCFillProp = 'none' | string | IDOCFillDeclaration;
8
8
 
9
9
  type SVGPathData = string;
10
10
  type FillRule = 'nonzero' | 'evenodd';
@@ -33,17 +33,18 @@ interface IDOCPath2DStyle {
33
33
  interface IDOCPath2D extends Partial<IDOCPath2DStyle> {
34
34
  data: SVGPathData;
35
35
  }
36
- interface IDOCGeometryPropObject {
36
+ interface IDOCGeometryDeclaration {
37
37
  data: (IDOCPath2D | SVGPathData)[];
38
38
  }
39
- type IDOCGeometryProp = 'none' | SVGPathData | SVGPathData[] | IDOCGeometryPropObject;
40
39
 
41
- interface IDOCNormalizedImageProp {
42
- src: string;
40
+ type IDOCGeometryProp = 'none' | SVGPathData | SVGPathData[] | IDOCGeometryDeclaration;
41
+
42
+ interface IDOCImageDeclaration {
43
+ url: string;
43
44
  opacity?: number;
44
45
  }
45
46
 
46
- type IDOCImageProp = 'none' | string | IDOCNormalizedImageProp;
47
+ type IDOCImageProp = 'none' | string | IDOCImageDeclaration;
47
48
 
48
49
  interface IDOCMetaProp {
49
50
  [key: string]: any;
@@ -55,13 +56,13 @@ interface IDOCNode {
55
56
  meta?: IDOCMetaProp;
56
57
  }
57
58
 
58
- interface IDOCNormalizedStrokeProp {
59
+ interface IDOCStrokeDeclaration {
60
+ url?: string;
59
61
  color?: string;
60
- image?: string;
61
62
  opacity?: number;
62
63
  }
63
64
 
64
- type IDOCStrokeProp = 'none' | string | IDOCNormalizedStrokeProp;
65
+ type IDOCStrokeProp = 'none' | string | IDOCStrokeDeclaration;
65
66
 
66
67
  type Overflow = 'hidden' | 'visible';
67
68
  type Visibility = 'hidden' | 'visible';
@@ -81,15 +82,15 @@ type ListStyleImage = 'none' | string;
81
82
  type ListStyleColormap = 'none' | Record<string, string>;
82
83
  type ListStyleSize = 'cover' | Sizeable;
83
84
  type ListStylePosition = 'inside' | 'outside';
84
- interface IDOCListStyleObject {
85
+ interface IDOCListStyleDeclaration {
85
86
  type: ListStyleType;
86
87
  image: ListStyleImage;
87
88
  colormap: ListStyleColormap;
88
89
  size: ListStyleSize;
89
90
  position: ListStylePosition;
90
91
  }
91
- interface IDOCListStyleStyle {
92
- listStyle?: Partial<IDOCListStyleObject>;
92
+ interface IDOCListStyleStyleDeclaration {
93
+ listStyle?: Partial<IDOCListStyleDeclaration>;
93
94
  listStyleType: ListStyleType;
94
95
  listStyleImage: ListStyleImage;
95
96
  listStyleColormap: ListStyleColormap;
@@ -102,7 +103,7 @@ type HighlightReferImage = 'none' | string;
102
103
  type HighlightColormap = 'none' | Record<string, string>;
103
104
  type HighlightSize = 'cover' | Sizeable;
104
105
  type HighlightThickness = Sizeable;
105
- interface IDOCHighlightObject {
106
+ interface IDOCHighlightDeclaration {
106
107
  image: HighlightImage;
107
108
  referImage: HighlightReferImage;
108
109
  colormap: HighlightColormap;
@@ -110,8 +111,8 @@ interface IDOCHighlightObject {
110
111
  size: HighlightSize;
111
112
  thickness: HighlightThickness;
112
113
  }
113
- interface IDOCHighlightStyle {
114
- highlight?: Partial<IDOCHighlightObject>;
114
+ interface IDOCHighlightStyleDeclaration {
115
+ highlight?: Partial<IDOCHighlightDeclaration>;
115
116
  highlightImage: HighlightImage;
116
117
  highlightReferImage: HighlightReferImage;
117
118
  highlightColormap: HighlightColormap;
@@ -119,20 +120,20 @@ interface IDOCHighlightStyle {
119
120
  highlightSize: HighlightSize;
120
121
  highlightThickness: HighlightThickness;
121
122
  }
122
- interface IDCOShadowObject {
123
+ interface IDCOShadowDeclaration {
123
124
  color: string;
124
125
  offsetX: number;
125
126
  offsetY: number;
126
127
  blur: number;
127
128
  }
128
- interface IDOCShadowStyle {
129
- shadow?: Partial<IDCOShadowObject>;
129
+ interface IDOCShadowStyleDeclaration {
130
+ shadow?: Partial<IDCOShadowDeclaration>;
130
131
  shadowColor: string;
131
132
  shadowOffsetX: number;
132
133
  shadowOffsetY: number;
133
134
  shadowBlur: number;
134
135
  }
135
- interface IDOCTransformStyle {
136
+ interface IDOCTransformStyleDeclaration {
136
137
  scaleX: number;
137
138
  scaleY: number;
138
139
  skewX: number;
@@ -142,14 +143,14 @@ interface IDOCTransformStyle {
142
143
  transform: string;
143
144
  transformOrigin: string;
144
145
  }
145
- interface IDOCTextLineStyle extends IDOCListStyleStyle {
146
+ interface IDOCTextLineStyleDeclaration extends IDOCListStyleStyleDeclaration {
146
147
  writingMode: WritingMode;
147
148
  textWrap: TextWrap;
148
149
  textAlign: TextAlign;
149
150
  textIndent: number;
150
151
  lineHeight: number;
151
152
  }
152
- interface IDOCTextInlineStyle extends IDOCHighlightStyle {
153
+ interface IDOCTextInlineStyleDeclaration extends IDOCHighlightStyleDeclaration {
153
154
  color: string;
154
155
  verticalAlign: VerticalAlign;
155
156
  letterSpacing: number;
@@ -163,13 +164,13 @@ interface IDOCTextInlineStyle extends IDOCHighlightStyle {
163
164
  textOrientation: TextOrientation;
164
165
  textDecoration: TextDecorationLine;
165
166
  }
166
- interface IDOCTextDrawStyle extends IDOCShadowStyle, IDOCTransformStyle {
167
+ interface IDOCTextDrawStyleDeclaration extends IDOCShadowStyleDeclaration, IDOCTransformStyleDeclaration {
167
168
  textStrokeWidth: number;
168
169
  textStrokeColor: string;
169
170
  }
170
- interface IDOCTextStyle extends IDOCTextLineStyle, IDOCTextInlineStyle, IDOCTextDrawStyle {
171
+ interface IDOCTextStyleDeclaration extends IDOCTextLineStyleDeclaration, IDOCTextInlineStyleDeclaration, IDOCTextDrawStyleDeclaration {
171
172
  }
172
- interface IDOCElementStyle extends IDOCShadowStyle, IDOCTransformStyle {
173
+ interface IDOCElementStyleDeclaration extends IDOCShadowStyleDeclaration, IDOCTransformStyleDeclaration {
173
174
  overflow: Overflow;
174
175
  visibility: Visibility;
175
176
  filter: string;
@@ -193,35 +194,40 @@ interface IDOCElementStyle extends IDOCShadowStyle, IDOCTransformStyle {
193
194
  borderColor: string;
194
195
  borderWidth: number;
195
196
  }
196
- interface IDOCStyleProp extends IDOCTextStyle, IDOCElementStyle {
197
+ interface IDOCStyleDeclaration extends IDOCTextStyleDeclaration, IDOCElementStyleDeclaration {
197
198
  }
198
199
 
199
- interface IDOCFragmentContent extends Partial<IDOCStyleProp> {
200
+ type IDOCStyleProp = Partial<IDOCStyleDeclaration>;
201
+
202
+ interface IDOCFragmentContent extends Partial<IDOCStyleDeclaration> {
200
203
  content: string;
201
204
  }
202
- interface IDOCParagraphContent extends Partial<IDOCStyleProp> {
205
+ interface IDOCParagraphContent extends Partial<IDOCStyleDeclaration> {
203
206
  fragments: IDOCFragmentContent[];
204
207
  }
205
- type IDOCFlatTextContent = string | IDOCFragmentContent | IDOCParagraphContent | (string | IDOCFragmentContent)[];
206
- type IDOCTextContent = string | IDOCFragmentContent | IDOCParagraphContent | IDOCFlatTextContent[];
207
- type IDOCNormalizedTextContent = IDOCParagraphContent[];
208
- interface IDOCTextObject {
209
- content: IDOCTextContent;
210
- effects?: Partial<IDOCStyleProp>[];
208
+ type IDOCTextContentFlat = string | IDOCFragmentContent | IDOCParagraphContent | (string | IDOCFragmentContent)[];
209
+ type IDOCTextContent = string | IDOCFragmentContent | IDOCParagraphContent | IDOCTextContentFlat[];
210
+ type IDOCTextContentDeclaration = IDOCParagraphContent[];
211
+ interface IDOCTextDeclaration {
212
+ content: IDOCTextContentDeclaration;
213
+ effects?: Partial<IDOCStyleDeclaration>[];
211
214
  measureDom?: any;
212
215
  fonts?: any;
213
216
  }
214
- type IDOCTextProp = string | IDOCTextContent | IDOCTextObject;
215
217
 
216
- interface IDOCNormalizedVideoProp {
217
- src: string;
218
+ type IDOCTextProp = string | IDOCTextContent | (IDOCTextDeclaration & {
219
+ content: IDOCTextContent;
220
+ }) | IDOCTextDeclaration;
221
+
222
+ interface IDOCVideoDeclaration {
223
+ url: string;
218
224
  opacity?: number;
219
225
  }
220
226
 
221
- type IDOCVideoProp = 'none' | string | IDOCNormalizedVideoProp;
227
+ type IDOCVideoProp = 'none' | string | IDOCVideoDeclaration;
222
228
 
223
229
  interface IDOCElement extends IDOCNode {
224
- style?: Partial<IDOCStyleProp>;
230
+ style?: IDOCStyleProp;
225
231
  image?: IDOCImageProp;
226
232
  video?: IDOCVideoProp;
227
233
  text?: IDOCTextProp;
@@ -235,44 +241,36 @@ interface IDOCDocument extends IDOCElement {
235
241
  fonts?: any;
236
242
  }
237
243
 
238
- interface IDOCNormalizedGeometryProp extends IDOCGeometryPropObject {
239
- data: IDOCPath2D[];
240
- }
241
-
242
- interface IDOCNormalizedTextProp extends IDOCTextObject {
243
- content: IDOCNormalizedTextContent;
244
- }
245
-
246
- interface IDOCNormalizedElement extends IDOCElement {
247
- image?: IDOCNormalizedImageProp;
248
- video?: IDOCNormalizedVideoProp;
249
- text?: IDOCNormalizedTextProp;
250
- geometry?: IDOCNormalizedGeometryProp;
251
- fill?: IDOCNormalizedFillProp;
252
- stroke?: IDOCNormalizedStrokeProp;
253
- children?: IDOCNormalizedElement[];
244
+ interface IDOCElementDeclaration extends IDOCElement {
245
+ image?: IDOCImageDeclaration;
246
+ video?: IDOCVideoDeclaration;
247
+ text?: IDOCTextDeclaration;
248
+ geometry?: IDOCGeometryDeclaration;
249
+ fill?: IDOCFillDeclaration;
250
+ stroke?: IDOCStrokeDeclaration;
251
+ children?: IDOCElementDeclaration[];
254
252
  }
255
253
 
256
- declare function getDefaultElementStyle(): IDOCElementStyle;
254
+ declare function getDefaultElementStyle(): IDOCElementStyleDeclaration;
257
255
 
258
- declare function getDefaultStyle(): IDOCStyleProp;
256
+ declare function getDefaultStyle(): IDOCStyleDeclaration;
259
257
 
260
- declare function getDefaultTextStyle(): IDOCTextStyle;
258
+ declare function getDefaultTextStyle(): IDOCTextStyleDeclaration;
261
259
 
262
- declare function normalizeElement(element: IDOCElement): IDOCNormalizedElement;
260
+ declare function normalizeElement(element: IDOCElement): IDOCElementDeclaration;
263
261
 
264
- declare function normalizeFill(fill?: IDOCFillProp): IDOCNormalizedFillProp | undefined;
262
+ declare function normalizeFill(fill?: IDOCFillProp): IDOCFillDeclaration | undefined;
265
263
 
266
- declare function normalizeGeometry(geometry?: IDOCGeometryProp): IDOCNormalizedGeometryProp | undefined;
264
+ declare function normalizeGeometry(geometry?: IDOCGeometryProp): IDOCGeometryDeclaration | undefined;
267
265
 
268
- declare function normalizeImage(image?: IDOCImageProp): IDOCNormalizedImageProp | undefined;
266
+ declare function normalizeImage(image?: IDOCImageProp): IDOCImageDeclaration | undefined;
269
267
 
270
- declare function normalizeStroke(stroke?: IDOCStrokeProp): IDOCNormalizedStrokeProp | undefined;
268
+ declare function normalizeStroke(stroke?: IDOCStrokeProp): IDOCStrokeDeclaration | undefined;
271
269
 
272
- declare function normalizeText(text?: IDOCTextProp): IDOCNormalizedTextProp | undefined;
270
+ declare function normalizeText(text?: IDOCTextProp): IDOCTextDeclaration | undefined;
273
271
 
274
- declare function normalizeTextContent(content?: IDOCTextContent): IDOCNormalizedTextContent;
272
+ declare function normalizeTextContent(content?: IDOCTextContent): IDOCTextContentDeclaration;
275
273
 
276
- declare function normalizeVideo(video?: IDOCVideoProp): IDOCNormalizedVideoProp | undefined;
274
+ declare function normalizeVideo(video?: IDOCVideoProp): IDOCVideoDeclaration | undefined;
277
275
 
278
- export { type FillRule, type FontKerning, type FontStyle, type FontWeight, type HighlightColormap, type HighlightImage, type HighlightLine, type HighlightReferImage, type HighlightSize, type HighlightThickness, type IDCOShadowObject, type IDOCDocument, type IDOCElement, type IDOCElementStyle, type IDOCFillProp, type IDOCFlatTextContent, type IDOCFragmentContent, type IDOCGeometryProp, type IDOCGeometryPropObject, type IDOCHighlightObject, type IDOCHighlightStyle, type IDOCImageProp, type IDOCListStyleObject, type IDOCListStyleStyle, type IDOCMetaProp, type IDOCNode, type IDOCNormalizedElement, type IDOCNormalizedFillProp, type IDOCNormalizedGeometryProp, type IDOCNormalizedImageProp, type IDOCNormalizedStrokeProp, type IDOCNormalizedTextContent, type IDOCNormalizedTextProp, type IDOCNormalizedVideoProp, type IDOCParagraphContent, type IDOCPath2D, type IDOCPath2DStyle, type IDOCShadowStyle, type IDOCStrokeProp, type IDOCStyleProp, type IDOCTextContent, type IDOCTextDrawStyle, type IDOCTextInlineStyle, type IDOCTextLineStyle, type IDOCTextObject, type IDOCTextProp, type IDOCTextStyle, type IDOCTransformStyle, type IDOCVideoProp, type ListStyleColormap, type ListStyleImage, type ListStylePosition, type ListStyleSize, type ListStyleType, type Overflow, type SVGPathData, type Sizeable, 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 };
276
+ 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 Sizeable, 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 };
package/dist/index.d.ts CHANGED
@@ -1,10 +1,10 @@
1
- interface IDOCNormalizedFillProp {
1
+ interface IDOCFillDeclaration {
2
+ url?: string;
2
3
  color?: string;
3
- image?: string;
4
4
  opacity?: number;
5
5
  }
6
6
 
7
- type IDOCFillProp = 'none' | string | IDOCNormalizedFillProp;
7
+ type IDOCFillProp = 'none' | string | IDOCFillDeclaration;
8
8
 
9
9
  type SVGPathData = string;
10
10
  type FillRule = 'nonzero' | 'evenodd';
@@ -33,17 +33,18 @@ interface IDOCPath2DStyle {
33
33
  interface IDOCPath2D extends Partial<IDOCPath2DStyle> {
34
34
  data: SVGPathData;
35
35
  }
36
- interface IDOCGeometryPropObject {
36
+ interface IDOCGeometryDeclaration {
37
37
  data: (IDOCPath2D | SVGPathData)[];
38
38
  }
39
- type IDOCGeometryProp = 'none' | SVGPathData | SVGPathData[] | IDOCGeometryPropObject;
40
39
 
41
- interface IDOCNormalizedImageProp {
42
- src: string;
40
+ type IDOCGeometryProp = 'none' | SVGPathData | SVGPathData[] | IDOCGeometryDeclaration;
41
+
42
+ interface IDOCImageDeclaration {
43
+ url: string;
43
44
  opacity?: number;
44
45
  }
45
46
 
46
- type IDOCImageProp = 'none' | string | IDOCNormalizedImageProp;
47
+ type IDOCImageProp = 'none' | string | IDOCImageDeclaration;
47
48
 
48
49
  interface IDOCMetaProp {
49
50
  [key: string]: any;
@@ -55,13 +56,13 @@ interface IDOCNode {
55
56
  meta?: IDOCMetaProp;
56
57
  }
57
58
 
58
- interface IDOCNormalizedStrokeProp {
59
+ interface IDOCStrokeDeclaration {
60
+ url?: string;
59
61
  color?: string;
60
- image?: string;
61
62
  opacity?: number;
62
63
  }
63
64
 
64
- type IDOCStrokeProp = 'none' | string | IDOCNormalizedStrokeProp;
65
+ type IDOCStrokeProp = 'none' | string | IDOCStrokeDeclaration;
65
66
 
66
67
  type Overflow = 'hidden' | 'visible';
67
68
  type Visibility = 'hidden' | 'visible';
@@ -81,15 +82,15 @@ type ListStyleImage = 'none' | string;
81
82
  type ListStyleColormap = 'none' | Record<string, string>;
82
83
  type ListStyleSize = 'cover' | Sizeable;
83
84
  type ListStylePosition = 'inside' | 'outside';
84
- interface IDOCListStyleObject {
85
+ interface IDOCListStyleDeclaration {
85
86
  type: ListStyleType;
86
87
  image: ListStyleImage;
87
88
  colormap: ListStyleColormap;
88
89
  size: ListStyleSize;
89
90
  position: ListStylePosition;
90
91
  }
91
- interface IDOCListStyleStyle {
92
- listStyle?: Partial<IDOCListStyleObject>;
92
+ interface IDOCListStyleStyleDeclaration {
93
+ listStyle?: Partial<IDOCListStyleDeclaration>;
93
94
  listStyleType: ListStyleType;
94
95
  listStyleImage: ListStyleImage;
95
96
  listStyleColormap: ListStyleColormap;
@@ -102,7 +103,7 @@ type HighlightReferImage = 'none' | string;
102
103
  type HighlightColormap = 'none' | Record<string, string>;
103
104
  type HighlightSize = 'cover' | Sizeable;
104
105
  type HighlightThickness = Sizeable;
105
- interface IDOCHighlightObject {
106
+ interface IDOCHighlightDeclaration {
106
107
  image: HighlightImage;
107
108
  referImage: HighlightReferImage;
108
109
  colormap: HighlightColormap;
@@ -110,8 +111,8 @@ interface IDOCHighlightObject {
110
111
  size: HighlightSize;
111
112
  thickness: HighlightThickness;
112
113
  }
113
- interface IDOCHighlightStyle {
114
- highlight?: Partial<IDOCHighlightObject>;
114
+ interface IDOCHighlightStyleDeclaration {
115
+ highlight?: Partial<IDOCHighlightDeclaration>;
115
116
  highlightImage: HighlightImage;
116
117
  highlightReferImage: HighlightReferImage;
117
118
  highlightColormap: HighlightColormap;
@@ -119,20 +120,20 @@ interface IDOCHighlightStyle {
119
120
  highlightSize: HighlightSize;
120
121
  highlightThickness: HighlightThickness;
121
122
  }
122
- interface IDCOShadowObject {
123
+ interface IDCOShadowDeclaration {
123
124
  color: string;
124
125
  offsetX: number;
125
126
  offsetY: number;
126
127
  blur: number;
127
128
  }
128
- interface IDOCShadowStyle {
129
- shadow?: Partial<IDCOShadowObject>;
129
+ interface IDOCShadowStyleDeclaration {
130
+ shadow?: Partial<IDCOShadowDeclaration>;
130
131
  shadowColor: string;
131
132
  shadowOffsetX: number;
132
133
  shadowOffsetY: number;
133
134
  shadowBlur: number;
134
135
  }
135
- interface IDOCTransformStyle {
136
+ interface IDOCTransformStyleDeclaration {
136
137
  scaleX: number;
137
138
  scaleY: number;
138
139
  skewX: number;
@@ -142,14 +143,14 @@ interface IDOCTransformStyle {
142
143
  transform: string;
143
144
  transformOrigin: string;
144
145
  }
145
- interface IDOCTextLineStyle extends IDOCListStyleStyle {
146
+ interface IDOCTextLineStyleDeclaration extends IDOCListStyleStyleDeclaration {
146
147
  writingMode: WritingMode;
147
148
  textWrap: TextWrap;
148
149
  textAlign: TextAlign;
149
150
  textIndent: number;
150
151
  lineHeight: number;
151
152
  }
152
- interface IDOCTextInlineStyle extends IDOCHighlightStyle {
153
+ interface IDOCTextInlineStyleDeclaration extends IDOCHighlightStyleDeclaration {
153
154
  color: string;
154
155
  verticalAlign: VerticalAlign;
155
156
  letterSpacing: number;
@@ -163,13 +164,13 @@ interface IDOCTextInlineStyle extends IDOCHighlightStyle {
163
164
  textOrientation: TextOrientation;
164
165
  textDecoration: TextDecorationLine;
165
166
  }
166
- interface IDOCTextDrawStyle extends IDOCShadowStyle, IDOCTransformStyle {
167
+ interface IDOCTextDrawStyleDeclaration extends IDOCShadowStyleDeclaration, IDOCTransformStyleDeclaration {
167
168
  textStrokeWidth: number;
168
169
  textStrokeColor: string;
169
170
  }
170
- interface IDOCTextStyle extends IDOCTextLineStyle, IDOCTextInlineStyle, IDOCTextDrawStyle {
171
+ interface IDOCTextStyleDeclaration extends IDOCTextLineStyleDeclaration, IDOCTextInlineStyleDeclaration, IDOCTextDrawStyleDeclaration {
171
172
  }
172
- interface IDOCElementStyle extends IDOCShadowStyle, IDOCTransformStyle {
173
+ interface IDOCElementStyleDeclaration extends IDOCShadowStyleDeclaration, IDOCTransformStyleDeclaration {
173
174
  overflow: Overflow;
174
175
  visibility: Visibility;
175
176
  filter: string;
@@ -193,35 +194,40 @@ interface IDOCElementStyle extends IDOCShadowStyle, IDOCTransformStyle {
193
194
  borderColor: string;
194
195
  borderWidth: number;
195
196
  }
196
- interface IDOCStyleProp extends IDOCTextStyle, IDOCElementStyle {
197
+ interface IDOCStyleDeclaration extends IDOCTextStyleDeclaration, IDOCElementStyleDeclaration {
197
198
  }
198
199
 
199
- interface IDOCFragmentContent extends Partial<IDOCStyleProp> {
200
+ type IDOCStyleProp = Partial<IDOCStyleDeclaration>;
201
+
202
+ interface IDOCFragmentContent extends Partial<IDOCStyleDeclaration> {
200
203
  content: string;
201
204
  }
202
- interface IDOCParagraphContent extends Partial<IDOCStyleProp> {
205
+ interface IDOCParagraphContent extends Partial<IDOCStyleDeclaration> {
203
206
  fragments: IDOCFragmentContent[];
204
207
  }
205
- type IDOCFlatTextContent = string | IDOCFragmentContent | IDOCParagraphContent | (string | IDOCFragmentContent)[];
206
- type IDOCTextContent = string | IDOCFragmentContent | IDOCParagraphContent | IDOCFlatTextContent[];
207
- type IDOCNormalizedTextContent = IDOCParagraphContent[];
208
- interface IDOCTextObject {
209
- content: IDOCTextContent;
210
- effects?: Partial<IDOCStyleProp>[];
208
+ type IDOCTextContentFlat = string | IDOCFragmentContent | IDOCParagraphContent | (string | IDOCFragmentContent)[];
209
+ type IDOCTextContent = string | IDOCFragmentContent | IDOCParagraphContent | IDOCTextContentFlat[];
210
+ type IDOCTextContentDeclaration = IDOCParagraphContent[];
211
+ interface IDOCTextDeclaration {
212
+ content: IDOCTextContentDeclaration;
213
+ effects?: Partial<IDOCStyleDeclaration>[];
211
214
  measureDom?: any;
212
215
  fonts?: any;
213
216
  }
214
- type IDOCTextProp = string | IDOCTextContent | IDOCTextObject;
215
217
 
216
- interface IDOCNormalizedVideoProp {
217
- src: string;
218
+ type IDOCTextProp = string | IDOCTextContent | (IDOCTextDeclaration & {
219
+ content: IDOCTextContent;
220
+ }) | IDOCTextDeclaration;
221
+
222
+ interface IDOCVideoDeclaration {
223
+ url: string;
218
224
  opacity?: number;
219
225
  }
220
226
 
221
- type IDOCVideoProp = 'none' | string | IDOCNormalizedVideoProp;
227
+ type IDOCVideoProp = 'none' | string | IDOCVideoDeclaration;
222
228
 
223
229
  interface IDOCElement extends IDOCNode {
224
- style?: Partial<IDOCStyleProp>;
230
+ style?: IDOCStyleProp;
225
231
  image?: IDOCImageProp;
226
232
  video?: IDOCVideoProp;
227
233
  text?: IDOCTextProp;
@@ -235,44 +241,36 @@ interface IDOCDocument extends IDOCElement {
235
241
  fonts?: any;
236
242
  }
237
243
 
238
- interface IDOCNormalizedGeometryProp extends IDOCGeometryPropObject {
239
- data: IDOCPath2D[];
240
- }
241
-
242
- interface IDOCNormalizedTextProp extends IDOCTextObject {
243
- content: IDOCNormalizedTextContent;
244
- }
245
-
246
- interface IDOCNormalizedElement extends IDOCElement {
247
- image?: IDOCNormalizedImageProp;
248
- video?: IDOCNormalizedVideoProp;
249
- text?: IDOCNormalizedTextProp;
250
- geometry?: IDOCNormalizedGeometryProp;
251
- fill?: IDOCNormalizedFillProp;
252
- stroke?: IDOCNormalizedStrokeProp;
253
- children?: IDOCNormalizedElement[];
244
+ interface IDOCElementDeclaration extends IDOCElement {
245
+ image?: IDOCImageDeclaration;
246
+ video?: IDOCVideoDeclaration;
247
+ text?: IDOCTextDeclaration;
248
+ geometry?: IDOCGeometryDeclaration;
249
+ fill?: IDOCFillDeclaration;
250
+ stroke?: IDOCStrokeDeclaration;
251
+ children?: IDOCElementDeclaration[];
254
252
  }
255
253
 
256
- declare function getDefaultElementStyle(): IDOCElementStyle;
254
+ declare function getDefaultElementStyle(): IDOCElementStyleDeclaration;
257
255
 
258
- declare function getDefaultStyle(): IDOCStyleProp;
256
+ declare function getDefaultStyle(): IDOCStyleDeclaration;
259
257
 
260
- declare function getDefaultTextStyle(): IDOCTextStyle;
258
+ declare function getDefaultTextStyle(): IDOCTextStyleDeclaration;
261
259
 
262
- declare function normalizeElement(element: IDOCElement): IDOCNormalizedElement;
260
+ declare function normalizeElement(element: IDOCElement): IDOCElementDeclaration;
263
261
 
264
- declare function normalizeFill(fill?: IDOCFillProp): IDOCNormalizedFillProp | undefined;
262
+ declare function normalizeFill(fill?: IDOCFillProp): IDOCFillDeclaration | undefined;
265
263
 
266
- declare function normalizeGeometry(geometry?: IDOCGeometryProp): IDOCNormalizedGeometryProp | undefined;
264
+ declare function normalizeGeometry(geometry?: IDOCGeometryProp): IDOCGeometryDeclaration | undefined;
267
265
 
268
- declare function normalizeImage(image?: IDOCImageProp): IDOCNormalizedImageProp | undefined;
266
+ declare function normalizeImage(image?: IDOCImageProp): IDOCImageDeclaration | undefined;
269
267
 
270
- declare function normalizeStroke(stroke?: IDOCStrokeProp): IDOCNormalizedStrokeProp | undefined;
268
+ declare function normalizeStroke(stroke?: IDOCStrokeProp): IDOCStrokeDeclaration | undefined;
271
269
 
272
- declare function normalizeText(text?: IDOCTextProp): IDOCNormalizedTextProp | undefined;
270
+ declare function normalizeText(text?: IDOCTextProp): IDOCTextDeclaration | undefined;
273
271
 
274
- declare function normalizeTextContent(content?: IDOCTextContent): IDOCNormalizedTextContent;
272
+ declare function normalizeTextContent(content?: IDOCTextContent): IDOCTextContentDeclaration;
275
273
 
276
- declare function normalizeVideo(video?: IDOCVideoProp): IDOCNormalizedVideoProp | undefined;
274
+ declare function normalizeVideo(video?: IDOCVideoProp): IDOCVideoDeclaration | undefined;
277
275
 
278
- export { type FillRule, type FontKerning, type FontStyle, type FontWeight, type HighlightColormap, type HighlightImage, type HighlightLine, type HighlightReferImage, type HighlightSize, type HighlightThickness, type IDCOShadowObject, type IDOCDocument, type IDOCElement, type IDOCElementStyle, type IDOCFillProp, type IDOCFlatTextContent, type IDOCFragmentContent, type IDOCGeometryProp, type IDOCGeometryPropObject, type IDOCHighlightObject, type IDOCHighlightStyle, type IDOCImageProp, type IDOCListStyleObject, type IDOCListStyleStyle, type IDOCMetaProp, type IDOCNode, type IDOCNormalizedElement, type IDOCNormalizedFillProp, type IDOCNormalizedGeometryProp, type IDOCNormalizedImageProp, type IDOCNormalizedStrokeProp, type IDOCNormalizedTextContent, type IDOCNormalizedTextProp, type IDOCNormalizedVideoProp, type IDOCParagraphContent, type IDOCPath2D, type IDOCPath2DStyle, type IDOCShadowStyle, type IDOCStrokeProp, type IDOCStyleProp, type IDOCTextContent, type IDOCTextDrawStyle, type IDOCTextInlineStyle, type IDOCTextLineStyle, type IDOCTextObject, type IDOCTextProp, type IDOCTextStyle, type IDOCTransformStyle, type IDOCVideoProp, type ListStyleColormap, type ListStyleImage, type ListStylePosition, type ListStyleSize, type ListStyleType, type Overflow, type SVGPathData, type Sizeable, 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 };
276
+ 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 Sizeable, 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 };
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 s(e){if(!(!e||e==="none"))return typeof e=="string"?{color:e}:e}function f(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"?{src: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"?{src:e}:{...e}}function c(e){var r;return{...e,image:u(e.image),video:m(e.video),text:d(e.text),geometry:f(e.geometry),fill:s(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=s,n.normalizeGeometry=f,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=>({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"})});
package/dist/index.mjs CHANGED
@@ -155,7 +155,7 @@ function normalizeImage(image) {
155
155
  return void 0;
156
156
  } else if (typeof image === "string") {
157
157
  return {
158
- src: image
158
+ url: image
159
159
  };
160
160
  } else {
161
161
  return image;
@@ -244,7 +244,7 @@ function normalizeVideo(video) {
244
244
  return void 0;
245
245
  } else if (typeof video === "string") {
246
246
  return {
247
- src: video
247
+ url: video
248
248
  };
249
249
  } else {
250
250
  return {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "modern-idoc",
3
3
  "type": "module",
4
- "version": "0.1.0",
4
+ "version": "0.1.2",
5
5
  "packageManager": "pnpm@9.9.0",
6
6
  "description": "Intermediate document for modern codec libs",
7
7
  "author": "wxm",