modern-idoc 0.2.2 → 0.2.3

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
@@ -49,10 +49,6 @@ function getDefaultLayoutStyle() {
49
49
 
50
50
  function getDefaultShadowStyle() {
51
51
  return {
52
- shadowColor: "transparent",
53
- shadowOffsetX: 0,
54
- shadowOffsetY: 0,
55
- shadowBlur: 0,
56
52
  boxShadow: "none"
57
53
  };
58
54
  }
@@ -136,11 +132,41 @@ function getDefaultStyle() {
136
132
  };
137
133
  }
138
134
 
135
+ function clearUndef(obj, deep = false) {
136
+ if (typeof obj !== "object" || !obj) {
137
+ return obj;
138
+ }
139
+ if (Array.isArray(obj)) {
140
+ if (deep) {
141
+ return obj.map((v) => clearUndef(v, deep));
142
+ } else {
143
+ return obj;
144
+ }
145
+ }
146
+ const newObj = {};
147
+ for (const key in obj) {
148
+ const value = obj[key];
149
+ if (value === void 0 || value === null) {
150
+ continue;
151
+ }
152
+ if (deep) {
153
+ newObj[key] = clearUndef(value, deep);
154
+ } else {
155
+ newObj[key] = value;
156
+ }
157
+ }
158
+ return newObj;
159
+ }
160
+ function deepClearUndef(obj) {
161
+ return clearUndef(obj, true);
162
+ }
163
+
139
164
  function normalizeFill(fill) {
140
165
  if (!fill || fill === "none") {
141
166
  return void 0;
142
167
  } else if (typeof fill === "string") {
143
168
  return {
169
+ type: "color",
144
170
  color: fill
145
171
  };
146
172
  } else {
@@ -185,15 +211,27 @@ function normalizeImage(image) {
185
211
  }
186
212
  }
187
213
 
188
- function normalizeStroke(stroke) {
189
- if (!stroke || stroke === "none") {
214
+ function normalizeOutline(outline) {
215
+ if (!outline || outline === "none") {
190
216
  return void 0;
191
- } else if (typeof stroke === "string") {
217
+ } else if (typeof outline === "string") {
192
218
  return {
193
- color: stroke
219
+ color: outline
194
220
  };
195
221
  } else {
196
- return stroke;
222
+ return outline;
223
+ }
224
+ }
225
+
226
+ function normalizeShadow(shadow) {
227
+ if (!shadow || shadow === "none") {
228
+ return void 0;
229
+ } else if (typeof shadow === "string") {
230
+ return {
231
+ color: shadow
232
+ };
233
+ } else {
234
+ return shadow;
197
235
  }
198
236
  }
199
237
 
@@ -277,18 +315,21 @@ function normalizeVideo(video) {
277
315
  }
278
316
 
279
317
  function normalizeElement(element) {
280
- return {
318
+ return clearUndef({
281
319
  ...element,
282
320
  image: normalizeImage(element.image),
283
321
  video: normalizeVideo(element.video),
284
322
  text: normalizeText(element.text),
285
323
  geometry: normalizeGeometry(element.geometry),
286
324
  fill: normalizeFill(element.fill),
287
- stroke: normalizeStroke(element.stroke),
325
+ outline: normalizeOutline(element.outline),
326
+ shadow: normalizeShadow(element.shadow),
288
327
  children: element.children?.map((child) => normalizeElement(child))
289
- };
328
+ });
290
329
  }
291
330
 
331
+ exports.clearUndef = clearUndef;
332
+ exports.deepClearUndef = deepClearUndef;
292
333
  exports.getDefaultElementStyle = getDefaultElementStyle;
293
334
  exports.getDefaultShadowStyle = getDefaultShadowStyle;
294
335
  exports.getDefaultStyle = getDefaultStyle;
@@ -298,7 +339,8 @@ exports.normalizeElement = normalizeElement;
298
339
  exports.normalizeFill = normalizeFill;
299
340
  exports.normalizeGeometry = normalizeGeometry;
300
341
  exports.normalizeImage = normalizeImage;
301
- exports.normalizeStroke = normalizeStroke;
342
+ exports.normalizeOutline = normalizeOutline;
343
+ exports.normalizeShadow = normalizeShadow;
302
344
  exports.normalizeText = normalizeText;
303
345
  exports.normalizeTextContent = normalizeTextContent;
304
346
  exports.normalizeVideo = normalizeVideo;
package/dist/index.d.cts CHANGED
@@ -1,3 +1,6 @@
1
+ type Noneable = 'none';
2
+ type Sizeable = `${number}%` | `${number}rem` | number;
3
+
1
4
  interface ImageFillRect {
2
5
  left?: number;
3
6
  top?: number;
@@ -16,7 +19,8 @@ interface CommonFillDeclaration {
16
19
  opacity?: number;
17
20
  }
18
21
  interface ImageFillDeclaration extends CommonFillDeclaration {
19
- image?: string;
22
+ type: 'image';
23
+ image: string;
20
24
  dpi?: number;
21
25
  rotateWithShape?: boolean;
22
26
  srcRect?: ImageFillRect;
@@ -24,10 +28,11 @@ interface ImageFillDeclaration extends CommonFillDeclaration {
24
28
  tile?: ImageFillTile;
25
29
  }
26
30
  interface ColorFillDeclaration extends CommonFillDeclaration {
27
- color?: string;
28
- }
29
- interface FillDeclaration extends ImageFillDeclaration, ColorFillDeclaration {
31
+ type: 'color';
32
+ color: string;
30
33
  }
34
+ type FillDeclaration = ImageFillDeclaration | ColorFillDeclaration;
35
+ type FillProp = Noneable | string | FillDeclaration;
31
36
 
32
37
  type SVGPathData = string;
33
38
  type FillRule = 'nonzero' | 'evenodd';
@@ -59,12 +64,6 @@ interface Path2DDeclaration extends Partial<Path2DStyle> {
59
64
  interface GeometryDeclaration {
60
65
  data: Path2DDeclaration[];
61
66
  }
62
-
63
- type Noneable = 'none';
64
- type Sizeable = `${number}%` | `${number}rem` | number;
65
-
66
- type FillProp = Noneable | string | FillDeclaration;
67
-
68
67
  type GeometryProp = Noneable | SVGPathData | SVGPathData[] | Path2DDeclaration[] | GeometryDeclaration;
69
68
 
70
69
  interface MetaProp {
@@ -81,18 +80,27 @@ interface ImageDeclaration {
81
80
  url: string;
82
81
  opacity?: number;
83
82
  }
84
-
85
83
  type ImageProp = Noneable | string | ImageDeclaration;
86
84
 
87
- interface StrokeDeclaration {
85
+ interface OutlineDeclaration {
88
86
  width?: number;
89
87
  style?: 'dashed' | 'solid' | string;
90
88
  image?: string;
91
89
  color?: string;
92
90
  opacity?: number;
93
91
  }
92
+ type OutlineProp = Noneable | string | Partial<OutlineDeclaration>;
94
93
 
95
- type StrokeProp = Noneable | string | StrokeDeclaration;
94
+ interface ShadowDeclaration {
95
+ color: string;
96
+ offsetX?: number;
97
+ offsetY?: number;
98
+ blur?: number;
99
+ }
100
+ type ShadowProp = Noneable | string | ShadowDeclaration;
101
+ interface ShadowStyleDeclaration {
102
+ boxShadow: Noneable | string;
103
+ }
96
104
 
97
105
  type Overflow = 'hidden' | 'visible';
98
106
  type Visibility = 'hidden' | 'visible';
@@ -169,22 +177,6 @@ interface LayoutStyleDeclaration {
169
177
  width: number | 'auto' | `${number}%`;
170
178
  }
171
179
 
172
- interface ShadowDeclaration {
173
- color: string;
174
- offsetX: number;
175
- offsetY: number;
176
- blur: number;
177
- }
178
-
179
- interface ShadowStyleDeclaration {
180
- shadow?: Partial<ShadowDeclaration>;
181
- shadowColor: string;
182
- shadowOffsetX: number;
183
- shadowOffsetY: number;
184
- shadowBlur: number;
185
- boxShadow: 'none' | string;
186
- }
187
-
188
180
  interface TransformStyleDeclaration {
189
181
  rotate: number;
190
182
  scaleX: number;
@@ -215,7 +207,6 @@ interface HighlightDeclaration {
215
207
  size: HighlightSize;
216
208
  thickness: HighlightThickness;
217
209
  }
218
-
219
210
  interface HighlightStyleDeclaration {
220
211
  highlight?: Partial<HighlightDeclaration>;
221
212
  highlightImage: HighlightImage;
@@ -233,7 +224,6 @@ interface ListStyleDeclaration {
233
224
  size: ListStyleSize;
234
225
  position: ListStylePosition;
235
226
  }
236
-
237
227
  interface ListStyleStyleDeclaration {
238
228
  listStyle?: Partial<ListStyleDeclaration>;
239
229
  listStyleType: ListStyleType;
@@ -275,7 +265,6 @@ interface TextStyleDeclaration extends TextLineStyleDeclaration, TextInlineStyle
275
265
 
276
266
  interface StyleDeclaration extends TextStyleDeclaration, ElementStyleDeclaration {
277
267
  }
278
-
279
268
  type StyleProp = Partial<StyleDeclaration>;
280
269
 
281
270
  interface FragmentContent extends Partial<StyleDeclaration> {
@@ -293,7 +282,6 @@ interface TextDeclaration {
293
282
  measureDom?: any;
294
283
  fonts?: any;
295
284
  }
296
-
297
285
  type TextProp = string | TextContent | (TextDeclaration & {
298
286
  content: TextContent;
299
287
  }) | TextDeclaration;
@@ -302,7 +290,6 @@ interface VideoDeclaration {
302
290
  url: string;
303
291
  opacity?: number;
304
292
  }
305
-
306
293
  type VideoProp = Noneable | string | VideoDeclaration;
307
294
 
308
295
  interface IDOCElement extends IDOCNode {
@@ -312,18 +299,19 @@ interface IDOCElement extends IDOCNode {
312
299
  text?: TextProp;
313
300
  geometry?: GeometryProp;
314
301
  fill?: FillProp;
315
- stroke?: StrokeProp;
302
+ outline?: OutlineProp;
303
+ shadow?: ShadowProp;
316
304
  children?: IDOCElement[];
317
305
  }
318
-
319
- interface ElementDeclaration extends IDOCElement {
306
+ interface IDOCElementDeclaration extends IDOCElement {
320
307
  image?: ImageDeclaration;
321
308
  video?: VideoDeclaration;
322
309
  text?: TextDeclaration;
323
310
  geometry?: GeometryDeclaration;
324
311
  fill?: FillDeclaration;
325
- stroke?: StrokeDeclaration;
326
- children?: ElementDeclaration[];
312
+ outline?: OutlineDeclaration;
313
+ shadow?: ShadowDeclaration;
314
+ children?: IDOCElementDeclaration[];
327
315
  }
328
316
 
329
317
  interface IDOCDocument extends IDOCElement {
@@ -340,7 +328,10 @@ declare function getDefaultTextStyle(): TextStyleDeclaration;
340
328
 
341
329
  declare function getDefaultTransformStyle(): TransformStyleDeclaration;
342
330
 
343
- declare function normalizeElement(element: IDOCElement): ElementDeclaration;
331
+ declare function clearUndef<T>(obj: T, deep?: boolean): T;
332
+ declare function deepClearUndef<T>(obj: T): T;
333
+
334
+ declare function normalizeElement(element: IDOCElement): IDOCElementDeclaration;
344
335
 
345
336
  declare function normalizeFill(fill?: FillProp): FillDeclaration | undefined;
346
337
 
@@ -348,7 +339,9 @@ declare function normalizeGeometry(geometry?: GeometryProp): GeometryDeclaration
348
339
 
349
340
  declare function normalizeImage(image?: ImageProp): ImageDeclaration | undefined;
350
341
 
351
- declare function normalizeStroke(stroke?: StrokeProp): StrokeDeclaration | undefined;
342
+ declare function normalizeOutline(outline?: OutlineProp): OutlineDeclaration | undefined;
343
+
344
+ declare function normalizeShadow(shadow?: ShadowProp): ShadowDeclaration | undefined;
352
345
 
353
346
  declare function normalizeText(text?: TextProp): TextDeclaration | undefined;
354
347
 
@@ -356,4 +349,4 @@ declare function normalizeTextContent(content?: TextContent): TextContentDeclara
356
349
 
357
350
  declare function normalizeVideo(video?: VideoProp): VideoDeclaration | undefined;
358
351
 
359
- export { type ColorFillDeclaration, type CommonFillDeclaration, type ElementDeclaration, type ElementStyleDeclaration, type FillDeclaration, type FillProp, type FillRule, type FragmentContent, type GeometryDeclaration, type GeometryProp, type HighlightDeclaration, type HighlightStyleDeclaration, type IDOCDocument, type IDOCElement, type IDOCNode, type ImageDeclaration, type ImageFillDeclaration, type ImageFillRect, type ImageFillTile, type ImageProp, type LayoutStyleDeclaration, type ListStyleDeclaration, type ListStyleStyleDeclaration, type MetaProp, type ParagraphContent, type Path2DDeclaration, type Path2DStyle, type SVGPathData, type ShadowDeclaration, type ShadowStyleDeclaration, type StrokeDeclaration, type StrokeLinecap, type StrokeLinejoin, type StrokeProp, type StyleDeclaration, type StyleProp, type TextContent, type TextContentDeclaration, type TextContentFlat, type TextDeclaration, type TextDrawStyleDeclaration, type TextInlineStyleDeclaration, type TextLineStyleDeclaration, type TextProp, type TextStyleDeclaration, type TransformStyleDeclaration, type VideoDeclaration, type VideoProp, getDefaultElementStyle, getDefaultShadowStyle, getDefaultStyle, getDefaultTextStyle, getDefaultTransformStyle, normalizeElement, normalizeFill, normalizeGeometry, normalizeImage, normalizeStroke, normalizeText, normalizeTextContent, normalizeVideo };
352
+ export { type ColorFillDeclaration, type CommonFillDeclaration, type ElementStyleDeclaration, type FillDeclaration, type FillProp, type FillRule, type FragmentContent, type GeometryDeclaration, type GeometryProp, type HighlightDeclaration, type HighlightStyleDeclaration, type IDOCDocument, type IDOCElement, type IDOCElementDeclaration, type IDOCNode, type ImageDeclaration, type ImageFillDeclaration, type ImageFillRect, type ImageFillTile, type ImageProp, type LayoutStyleDeclaration, type ListStyleDeclaration, type ListStyleStyleDeclaration, type MetaProp, type OutlineDeclaration, type OutlineProp, type ParagraphContent, type Path2DDeclaration, type Path2DStyle, type SVGPathData, type ShadowDeclaration, type ShadowProp, type ShadowStyleDeclaration, type StrokeLinecap, type StrokeLinejoin, type StyleDeclaration, type StyleProp, type TextContent, type TextContentDeclaration, type TextContentFlat, type TextDeclaration, type TextDrawStyleDeclaration, type TextInlineStyleDeclaration, type TextLineStyleDeclaration, type TextProp, type TextStyleDeclaration, type TransformStyleDeclaration, type VideoDeclaration, type VideoProp, clearUndef, deepClearUndef, getDefaultElementStyle, getDefaultShadowStyle, getDefaultStyle, getDefaultTextStyle, getDefaultTransformStyle, normalizeElement, normalizeFill, normalizeGeometry, normalizeImage, normalizeOutline, normalizeShadow, normalizeText, normalizeTextContent, normalizeVideo };
package/dist/index.d.mts CHANGED
@@ -1,3 +1,6 @@
1
+ type Noneable = 'none';
2
+ type Sizeable = `${number}%` | `${number}rem` | number;
3
+
1
4
  interface ImageFillRect {
2
5
  left?: number;
3
6
  top?: number;
@@ -16,7 +19,8 @@ interface CommonFillDeclaration {
16
19
  opacity?: number;
17
20
  }
18
21
  interface ImageFillDeclaration extends CommonFillDeclaration {
19
- image?: string;
22
+ type: 'image';
23
+ image: string;
20
24
  dpi?: number;
21
25
  rotateWithShape?: boolean;
22
26
  srcRect?: ImageFillRect;
@@ -24,10 +28,11 @@ interface ImageFillDeclaration extends CommonFillDeclaration {
24
28
  tile?: ImageFillTile;
25
29
  }
26
30
  interface ColorFillDeclaration extends CommonFillDeclaration {
27
- color?: string;
28
- }
29
- interface FillDeclaration extends ImageFillDeclaration, ColorFillDeclaration {
31
+ type: 'color';
32
+ color: string;
30
33
  }
34
+ type FillDeclaration = ImageFillDeclaration | ColorFillDeclaration;
35
+ type FillProp = Noneable | string | FillDeclaration;
31
36
 
32
37
  type SVGPathData = string;
33
38
  type FillRule = 'nonzero' | 'evenodd';
@@ -59,12 +64,6 @@ interface Path2DDeclaration extends Partial<Path2DStyle> {
59
64
  interface GeometryDeclaration {
60
65
  data: Path2DDeclaration[];
61
66
  }
62
-
63
- type Noneable = 'none';
64
- type Sizeable = `${number}%` | `${number}rem` | number;
65
-
66
- type FillProp = Noneable | string | FillDeclaration;
67
-
68
67
  type GeometryProp = Noneable | SVGPathData | SVGPathData[] | Path2DDeclaration[] | GeometryDeclaration;
69
68
 
70
69
  interface MetaProp {
@@ -81,18 +80,27 @@ interface ImageDeclaration {
81
80
  url: string;
82
81
  opacity?: number;
83
82
  }
84
-
85
83
  type ImageProp = Noneable | string | ImageDeclaration;
86
84
 
87
- interface StrokeDeclaration {
85
+ interface OutlineDeclaration {
88
86
  width?: number;
89
87
  style?: 'dashed' | 'solid' | string;
90
88
  image?: string;
91
89
  color?: string;
92
90
  opacity?: number;
93
91
  }
92
+ type OutlineProp = Noneable | string | Partial<OutlineDeclaration>;
94
93
 
95
- type StrokeProp = Noneable | string | StrokeDeclaration;
94
+ interface ShadowDeclaration {
95
+ color: string;
96
+ offsetX?: number;
97
+ offsetY?: number;
98
+ blur?: number;
99
+ }
100
+ type ShadowProp = Noneable | string | ShadowDeclaration;
101
+ interface ShadowStyleDeclaration {
102
+ boxShadow: Noneable | string;
103
+ }
96
104
 
97
105
  type Overflow = 'hidden' | 'visible';
98
106
  type Visibility = 'hidden' | 'visible';
@@ -169,22 +177,6 @@ interface LayoutStyleDeclaration {
169
177
  width: number | 'auto' | `${number}%`;
170
178
  }
171
179
 
172
- interface ShadowDeclaration {
173
- color: string;
174
- offsetX: number;
175
- offsetY: number;
176
- blur: number;
177
- }
178
-
179
- interface ShadowStyleDeclaration {
180
- shadow?: Partial<ShadowDeclaration>;
181
- shadowColor: string;
182
- shadowOffsetX: number;
183
- shadowOffsetY: number;
184
- shadowBlur: number;
185
- boxShadow: 'none' | string;
186
- }
187
-
188
180
  interface TransformStyleDeclaration {
189
181
  rotate: number;
190
182
  scaleX: number;
@@ -215,7 +207,6 @@ interface HighlightDeclaration {
215
207
  size: HighlightSize;
216
208
  thickness: HighlightThickness;
217
209
  }
218
-
219
210
  interface HighlightStyleDeclaration {
220
211
  highlight?: Partial<HighlightDeclaration>;
221
212
  highlightImage: HighlightImage;
@@ -233,7 +224,6 @@ interface ListStyleDeclaration {
233
224
  size: ListStyleSize;
234
225
  position: ListStylePosition;
235
226
  }
236
-
237
227
  interface ListStyleStyleDeclaration {
238
228
  listStyle?: Partial<ListStyleDeclaration>;
239
229
  listStyleType: ListStyleType;
@@ -275,7 +265,6 @@ interface TextStyleDeclaration extends TextLineStyleDeclaration, TextInlineStyle
275
265
 
276
266
  interface StyleDeclaration extends TextStyleDeclaration, ElementStyleDeclaration {
277
267
  }
278
-
279
268
  type StyleProp = Partial<StyleDeclaration>;
280
269
 
281
270
  interface FragmentContent extends Partial<StyleDeclaration> {
@@ -293,7 +282,6 @@ interface TextDeclaration {
293
282
  measureDom?: any;
294
283
  fonts?: any;
295
284
  }
296
-
297
285
  type TextProp = string | TextContent | (TextDeclaration & {
298
286
  content: TextContent;
299
287
  }) | TextDeclaration;
@@ -302,7 +290,6 @@ interface VideoDeclaration {
302
290
  url: string;
303
291
  opacity?: number;
304
292
  }
305
-
306
293
  type VideoProp = Noneable | string | VideoDeclaration;
307
294
 
308
295
  interface IDOCElement extends IDOCNode {
@@ -312,18 +299,19 @@ interface IDOCElement extends IDOCNode {
312
299
  text?: TextProp;
313
300
  geometry?: GeometryProp;
314
301
  fill?: FillProp;
315
- stroke?: StrokeProp;
302
+ outline?: OutlineProp;
303
+ shadow?: ShadowProp;
316
304
  children?: IDOCElement[];
317
305
  }
318
-
319
- interface ElementDeclaration extends IDOCElement {
306
+ interface IDOCElementDeclaration extends IDOCElement {
320
307
  image?: ImageDeclaration;
321
308
  video?: VideoDeclaration;
322
309
  text?: TextDeclaration;
323
310
  geometry?: GeometryDeclaration;
324
311
  fill?: FillDeclaration;
325
- stroke?: StrokeDeclaration;
326
- children?: ElementDeclaration[];
312
+ outline?: OutlineDeclaration;
313
+ shadow?: ShadowDeclaration;
314
+ children?: IDOCElementDeclaration[];
327
315
  }
328
316
 
329
317
  interface IDOCDocument extends IDOCElement {
@@ -340,7 +328,10 @@ declare function getDefaultTextStyle(): TextStyleDeclaration;
340
328
 
341
329
  declare function getDefaultTransformStyle(): TransformStyleDeclaration;
342
330
 
343
- declare function normalizeElement(element: IDOCElement): ElementDeclaration;
331
+ declare function clearUndef<T>(obj: T, deep?: boolean): T;
332
+ declare function deepClearUndef<T>(obj: T): T;
333
+
334
+ declare function normalizeElement(element: IDOCElement): IDOCElementDeclaration;
344
335
 
345
336
  declare function normalizeFill(fill?: FillProp): FillDeclaration | undefined;
346
337
 
@@ -348,7 +339,9 @@ declare function normalizeGeometry(geometry?: GeometryProp): GeometryDeclaration
348
339
 
349
340
  declare function normalizeImage(image?: ImageProp): ImageDeclaration | undefined;
350
341
 
351
- declare function normalizeStroke(stroke?: StrokeProp): StrokeDeclaration | undefined;
342
+ declare function normalizeOutline(outline?: OutlineProp): OutlineDeclaration | undefined;
343
+
344
+ declare function normalizeShadow(shadow?: ShadowProp): ShadowDeclaration | undefined;
352
345
 
353
346
  declare function normalizeText(text?: TextProp): TextDeclaration | undefined;
354
347
 
@@ -356,4 +349,4 @@ declare function normalizeTextContent(content?: TextContent): TextContentDeclara
356
349
 
357
350
  declare function normalizeVideo(video?: VideoProp): VideoDeclaration | undefined;
358
351
 
359
- export { type ColorFillDeclaration, type CommonFillDeclaration, type ElementDeclaration, type ElementStyleDeclaration, type FillDeclaration, type FillProp, type FillRule, type FragmentContent, type GeometryDeclaration, type GeometryProp, type HighlightDeclaration, type HighlightStyleDeclaration, type IDOCDocument, type IDOCElement, type IDOCNode, type ImageDeclaration, type ImageFillDeclaration, type ImageFillRect, type ImageFillTile, type ImageProp, type LayoutStyleDeclaration, type ListStyleDeclaration, type ListStyleStyleDeclaration, type MetaProp, type ParagraphContent, type Path2DDeclaration, type Path2DStyle, type SVGPathData, type ShadowDeclaration, type ShadowStyleDeclaration, type StrokeDeclaration, type StrokeLinecap, type StrokeLinejoin, type StrokeProp, type StyleDeclaration, type StyleProp, type TextContent, type TextContentDeclaration, type TextContentFlat, type TextDeclaration, type TextDrawStyleDeclaration, type TextInlineStyleDeclaration, type TextLineStyleDeclaration, type TextProp, type TextStyleDeclaration, type TransformStyleDeclaration, type VideoDeclaration, type VideoProp, getDefaultElementStyle, getDefaultShadowStyle, getDefaultStyle, getDefaultTextStyle, getDefaultTransformStyle, normalizeElement, normalizeFill, normalizeGeometry, normalizeImage, normalizeStroke, normalizeText, normalizeTextContent, normalizeVideo };
352
+ export { type ColorFillDeclaration, type CommonFillDeclaration, type ElementStyleDeclaration, type FillDeclaration, type FillProp, type FillRule, type FragmentContent, type GeometryDeclaration, type GeometryProp, type HighlightDeclaration, type HighlightStyleDeclaration, type IDOCDocument, type IDOCElement, type IDOCElementDeclaration, type IDOCNode, type ImageDeclaration, type ImageFillDeclaration, type ImageFillRect, type ImageFillTile, type ImageProp, type LayoutStyleDeclaration, type ListStyleDeclaration, type ListStyleStyleDeclaration, type MetaProp, type OutlineDeclaration, type OutlineProp, type ParagraphContent, type Path2DDeclaration, type Path2DStyle, type SVGPathData, type ShadowDeclaration, type ShadowProp, type ShadowStyleDeclaration, type StrokeLinecap, type StrokeLinejoin, type StyleDeclaration, type StyleProp, type TextContent, type TextContentDeclaration, type TextContentFlat, type TextDeclaration, type TextDrawStyleDeclaration, type TextInlineStyleDeclaration, type TextLineStyleDeclaration, type TextProp, type TextStyleDeclaration, type TransformStyleDeclaration, type VideoDeclaration, type VideoProp, clearUndef, deepClearUndef, getDefaultElementStyle, getDefaultShadowStyle, getDefaultStyle, getDefaultTextStyle, getDefaultTransformStyle, normalizeElement, normalizeFill, normalizeGeometry, normalizeImage, normalizeOutline, normalizeShadow, normalizeText, normalizeTextContent, normalizeVideo };
package/dist/index.d.ts CHANGED
@@ -1,3 +1,6 @@
1
+ type Noneable = 'none';
2
+ type Sizeable = `${number}%` | `${number}rem` | number;
3
+
1
4
  interface ImageFillRect {
2
5
  left?: number;
3
6
  top?: number;
@@ -16,7 +19,8 @@ interface CommonFillDeclaration {
16
19
  opacity?: number;
17
20
  }
18
21
  interface ImageFillDeclaration extends CommonFillDeclaration {
19
- image?: string;
22
+ type: 'image';
23
+ image: string;
20
24
  dpi?: number;
21
25
  rotateWithShape?: boolean;
22
26
  srcRect?: ImageFillRect;
@@ -24,10 +28,11 @@ interface ImageFillDeclaration extends CommonFillDeclaration {
24
28
  tile?: ImageFillTile;
25
29
  }
26
30
  interface ColorFillDeclaration extends CommonFillDeclaration {
27
- color?: string;
28
- }
29
- interface FillDeclaration extends ImageFillDeclaration, ColorFillDeclaration {
31
+ type: 'color';
32
+ color: string;
30
33
  }
34
+ type FillDeclaration = ImageFillDeclaration | ColorFillDeclaration;
35
+ type FillProp = Noneable | string | FillDeclaration;
31
36
 
32
37
  type SVGPathData = string;
33
38
  type FillRule = 'nonzero' | 'evenodd';
@@ -59,12 +64,6 @@ interface Path2DDeclaration extends Partial<Path2DStyle> {
59
64
  interface GeometryDeclaration {
60
65
  data: Path2DDeclaration[];
61
66
  }
62
-
63
- type Noneable = 'none';
64
- type Sizeable = `${number}%` | `${number}rem` | number;
65
-
66
- type FillProp = Noneable | string | FillDeclaration;
67
-
68
67
  type GeometryProp = Noneable | SVGPathData | SVGPathData[] | Path2DDeclaration[] | GeometryDeclaration;
69
68
 
70
69
  interface MetaProp {
@@ -81,18 +80,27 @@ interface ImageDeclaration {
81
80
  url: string;
82
81
  opacity?: number;
83
82
  }
84
-
85
83
  type ImageProp = Noneable | string | ImageDeclaration;
86
84
 
87
- interface StrokeDeclaration {
85
+ interface OutlineDeclaration {
88
86
  width?: number;
89
87
  style?: 'dashed' | 'solid' | string;
90
88
  image?: string;
91
89
  color?: string;
92
90
  opacity?: number;
93
91
  }
92
+ type OutlineProp = Noneable | string | Partial<OutlineDeclaration>;
94
93
 
95
- type StrokeProp = Noneable | string | StrokeDeclaration;
94
+ interface ShadowDeclaration {
95
+ color: string;
96
+ offsetX?: number;
97
+ offsetY?: number;
98
+ blur?: number;
99
+ }
100
+ type ShadowProp = Noneable | string | ShadowDeclaration;
101
+ interface ShadowStyleDeclaration {
102
+ boxShadow: Noneable | string;
103
+ }
96
104
 
97
105
  type Overflow = 'hidden' | 'visible';
98
106
  type Visibility = 'hidden' | 'visible';
@@ -169,22 +177,6 @@ interface LayoutStyleDeclaration {
169
177
  width: number | 'auto' | `${number}%`;
170
178
  }
171
179
 
172
- interface ShadowDeclaration {
173
- color: string;
174
- offsetX: number;
175
- offsetY: number;
176
- blur: number;
177
- }
178
-
179
- interface ShadowStyleDeclaration {
180
- shadow?: Partial<ShadowDeclaration>;
181
- shadowColor: string;
182
- shadowOffsetX: number;
183
- shadowOffsetY: number;
184
- shadowBlur: number;
185
- boxShadow: 'none' | string;
186
- }
187
-
188
180
  interface TransformStyleDeclaration {
189
181
  rotate: number;
190
182
  scaleX: number;
@@ -215,7 +207,6 @@ interface HighlightDeclaration {
215
207
  size: HighlightSize;
216
208
  thickness: HighlightThickness;
217
209
  }
218
-
219
210
  interface HighlightStyleDeclaration {
220
211
  highlight?: Partial<HighlightDeclaration>;
221
212
  highlightImage: HighlightImage;
@@ -233,7 +224,6 @@ interface ListStyleDeclaration {
233
224
  size: ListStyleSize;
234
225
  position: ListStylePosition;
235
226
  }
236
-
237
227
  interface ListStyleStyleDeclaration {
238
228
  listStyle?: Partial<ListStyleDeclaration>;
239
229
  listStyleType: ListStyleType;
@@ -275,7 +265,6 @@ interface TextStyleDeclaration extends TextLineStyleDeclaration, TextInlineStyle
275
265
 
276
266
  interface StyleDeclaration extends TextStyleDeclaration, ElementStyleDeclaration {
277
267
  }
278
-
279
268
  type StyleProp = Partial<StyleDeclaration>;
280
269
 
281
270
  interface FragmentContent extends Partial<StyleDeclaration> {
@@ -293,7 +282,6 @@ interface TextDeclaration {
293
282
  measureDom?: any;
294
283
  fonts?: any;
295
284
  }
296
-
297
285
  type TextProp = string | TextContent | (TextDeclaration & {
298
286
  content: TextContent;
299
287
  }) | TextDeclaration;
@@ -302,7 +290,6 @@ interface VideoDeclaration {
302
290
  url: string;
303
291
  opacity?: number;
304
292
  }
305
-
306
293
  type VideoProp = Noneable | string | VideoDeclaration;
307
294
 
308
295
  interface IDOCElement extends IDOCNode {
@@ -312,18 +299,19 @@ interface IDOCElement extends IDOCNode {
312
299
  text?: TextProp;
313
300
  geometry?: GeometryProp;
314
301
  fill?: FillProp;
315
- stroke?: StrokeProp;
302
+ outline?: OutlineProp;
303
+ shadow?: ShadowProp;
316
304
  children?: IDOCElement[];
317
305
  }
318
-
319
- interface ElementDeclaration extends IDOCElement {
306
+ interface IDOCElementDeclaration extends IDOCElement {
320
307
  image?: ImageDeclaration;
321
308
  video?: VideoDeclaration;
322
309
  text?: TextDeclaration;
323
310
  geometry?: GeometryDeclaration;
324
311
  fill?: FillDeclaration;
325
- stroke?: StrokeDeclaration;
326
- children?: ElementDeclaration[];
312
+ outline?: OutlineDeclaration;
313
+ shadow?: ShadowDeclaration;
314
+ children?: IDOCElementDeclaration[];
327
315
  }
328
316
 
329
317
  interface IDOCDocument extends IDOCElement {
@@ -340,7 +328,10 @@ declare function getDefaultTextStyle(): TextStyleDeclaration;
340
328
 
341
329
  declare function getDefaultTransformStyle(): TransformStyleDeclaration;
342
330
 
343
- declare function normalizeElement(element: IDOCElement): ElementDeclaration;
331
+ declare function clearUndef<T>(obj: T, deep?: boolean): T;
332
+ declare function deepClearUndef<T>(obj: T): T;
333
+
334
+ declare function normalizeElement(element: IDOCElement): IDOCElementDeclaration;
344
335
 
345
336
  declare function normalizeFill(fill?: FillProp): FillDeclaration | undefined;
346
337
 
@@ -348,7 +339,9 @@ declare function normalizeGeometry(geometry?: GeometryProp): GeometryDeclaration
348
339
 
349
340
  declare function normalizeImage(image?: ImageProp): ImageDeclaration | undefined;
350
341
 
351
- declare function normalizeStroke(stroke?: StrokeProp): StrokeDeclaration | undefined;
342
+ declare function normalizeOutline(outline?: OutlineProp): OutlineDeclaration | undefined;
343
+
344
+ declare function normalizeShadow(shadow?: ShadowProp): ShadowDeclaration | undefined;
352
345
 
353
346
  declare function normalizeText(text?: TextProp): TextDeclaration | undefined;
354
347
 
@@ -356,4 +349,4 @@ declare function normalizeTextContent(content?: TextContent): TextContentDeclara
356
349
 
357
350
  declare function normalizeVideo(video?: VideoProp): VideoDeclaration | undefined;
358
351
 
359
- export { type ColorFillDeclaration, type CommonFillDeclaration, type ElementDeclaration, type ElementStyleDeclaration, type FillDeclaration, type FillProp, type FillRule, type FragmentContent, type GeometryDeclaration, type GeometryProp, type HighlightDeclaration, type HighlightStyleDeclaration, type IDOCDocument, type IDOCElement, type IDOCNode, type ImageDeclaration, type ImageFillDeclaration, type ImageFillRect, type ImageFillTile, type ImageProp, type LayoutStyleDeclaration, type ListStyleDeclaration, type ListStyleStyleDeclaration, type MetaProp, type ParagraphContent, type Path2DDeclaration, type Path2DStyle, type SVGPathData, type ShadowDeclaration, type ShadowStyleDeclaration, type StrokeDeclaration, type StrokeLinecap, type StrokeLinejoin, type StrokeProp, type StyleDeclaration, type StyleProp, type TextContent, type TextContentDeclaration, type TextContentFlat, type TextDeclaration, type TextDrawStyleDeclaration, type TextInlineStyleDeclaration, type TextLineStyleDeclaration, type TextProp, type TextStyleDeclaration, type TransformStyleDeclaration, type VideoDeclaration, type VideoProp, getDefaultElementStyle, getDefaultShadowStyle, getDefaultStyle, getDefaultTextStyle, getDefaultTransformStyle, normalizeElement, normalizeFill, normalizeGeometry, normalizeImage, normalizeStroke, normalizeText, normalizeTextContent, normalizeVideo };
352
+ export { type ColorFillDeclaration, type CommonFillDeclaration, type ElementStyleDeclaration, type FillDeclaration, type FillProp, type FillRule, type FragmentContent, type GeometryDeclaration, type GeometryProp, type HighlightDeclaration, type HighlightStyleDeclaration, type IDOCDocument, type IDOCElement, type IDOCElementDeclaration, type IDOCNode, type ImageDeclaration, type ImageFillDeclaration, type ImageFillRect, type ImageFillTile, type ImageProp, type LayoutStyleDeclaration, type ListStyleDeclaration, type ListStyleStyleDeclaration, type MetaProp, type OutlineDeclaration, type OutlineProp, type ParagraphContent, type Path2DDeclaration, type Path2DStyle, type SVGPathData, type ShadowDeclaration, type ShadowProp, type ShadowStyleDeclaration, type StrokeLinecap, type StrokeLinejoin, type StyleDeclaration, type StyleProp, type TextContent, type TextContentDeclaration, type TextContentFlat, type TextDeclaration, type TextDrawStyleDeclaration, type TextInlineStyleDeclaration, type TextLineStyleDeclaration, type TextProp, type TextStyleDeclaration, type TransformStyleDeclaration, type VideoDeclaration, type VideoProp, clearUndef, deepClearUndef, getDefaultElementStyle, getDefaultShadowStyle, getDefaultStyle, getDefaultTextStyle, getDefaultTransformStyle, normalizeElement, normalizeFill, normalizeGeometry, normalizeImage, normalizeOutline, normalizeShadow, normalizeText, normalizeTextContent, normalizeVideo };
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",alignContent:"stretch",alignItems:"stretch",alignSelf:"auto",borderTop:"none",borderLeft:"none",borderRight:"none",borderBottom:"none",borderWidth:0,border:"none",direction:"inherit",display:"flex",flex:0,flexBasis:"auto",flexDirection:"row",flexGrow:0,flexShrink:1,flexWrap:"nowrap",height:"auto",justifyContent:"flex-start",gap:0,marginTop:0,marginLeft:0,marginRight:0,marginBottom:0,margin:0,maxHeight:0,maxWidth:0,minHeight:0,minWidth:0,paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,padding:0,top:0,bottom:0,left:0,right:0,position:"static",boxSizing:"content-box",width:"auto"}}function a(){return{shadowColor:"transparent",shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0,boxShadow:"none"}}function f(){return{rotate:0,scaleX:1,scaleY:1,skewX:0,skewY:0,translateX:0,translateY:0,transform:"none",transformOrigin:"center"}}function u(){return{...f(),...i(),...a(),visibility:"visible",filter:"none",opacity:1,backgroundImage:"none",backgroundColor:"transparent",borderRadius:0,borderColor:"transparent"}}function s(){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 p(){return{...u(),...s()}}function g(e){if(!(!e||e==="none"))return typeof e=="string"?{color:e}:e}function d(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 m(e){if(!(!e||e==="none"))return typeof e=="string"?{url:e}:e}function c(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 h(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 y(e){if(!(!e||e==="none"))return typeof e=="string"?{url:e}:{...e}}function S(e){var r;return{...e,image:m(e.image),video:y(e.video),text:h(e.text),geometry:d(e.geometry),fill:g(e.fill),stroke:c(e.stroke),children:(r=e.children)==null?void 0:r.map(t=>S(t))}}n.getDefaultElementStyle=u,n.getDefaultShadowStyle=a,n.getDefaultStyle=p,n.getDefaultTextStyle=s,n.getDefaultTransformStyle=f,n.normalizeElement=S,n.normalizeFill=g,n.normalizeGeometry=d,n.normalizeImage=m,n.normalizeStroke=c,n.normalizeText=h,n.normalizeTextContent=l,n.normalizeVideo=y,Object.defineProperty(n,Symbol.toStringTag,{value:"Module"})});
1
+ (function(n,o){typeof exports=="object"&&typeof module<"u"?o(exports):typeof define=="function"&&define.amd?define(["exports"],o):(n=typeof globalThis<"u"?globalThis:n||self,o(n.modernIdoc={}))})(this,function(n){"use strict";function o(){return{overflow:"visible",alignContent:"stretch",alignItems:"stretch",alignSelf:"auto",borderTop:"none",borderLeft:"none",borderRight:"none",borderBottom:"none",borderWidth:0,border:"none",direction:"inherit",display:"flex",flex:0,flexBasis:"auto",flexDirection:"row",flexGrow:0,flexShrink:1,flexWrap:"nowrap",height:"auto",justifyContent:"flex-start",gap:0,marginTop:0,marginLeft:0,marginRight:0,marginBottom:0,margin:0,maxHeight:0,maxWidth:0,minHeight:0,minWidth:0,paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,padding:0,top:0,bottom:0,left:0,right:0,position:"static",boxSizing:"content-box",width:"auto"}}function u(){return{boxShadow:"none"}}function s(){return{rotate:0,scaleX:1,scaleY:1,skewX:0,skewY:0,translateX:0,translateY:0,transform:"none",transformOrigin:"center"}}function g(){return{...s(),...o(),...u(),visibility:"visible",filter:"none",opacity:1,backgroundImage:"none",backgroundColor:"transparent",borderRadius:0,borderColor:"transparent"}}function c(){return{writingMode:"horizontal-tb",verticalAlign:"baseline",lineHeight:1.2,letterSpacing:0,wordSpacing:0,fontSize:14,fontWeight:"normal",fontFamily:"",fontStyle:"normal",fontKerning:"normal",textWrap:"wrap",textAlign:"start",textIndent:0,textTransform:"none",textOrientation:"mixed",textDecoration:"none",textStrokeWidth:0,textStrokeColor:"black",color:"black",listStyleType:"none",listStyleImage:"none",listStyleColormap:"none",listStyleSize:"cover",listStylePosition:"outside",highlightImage:"none",highlightReferImage:"none",highlightColormap:"none",highlightLine:"none",highlightSize:"cover",highlightThickness:"100%"}}function T(){return{...g(),...c()}}function l(e,r=!1){if(typeof e!="object"||!e)return e;if(Array.isArray(e))return r?e.map(i=>l(i,r)):e;const t={};for(const i in e){const a=e[i];a!=null&&(r?t[i]=l(a,r):t[i]=a)}return t}function v(e){return l(e,!0)}function d(e){if(!(!e||e==="none"))return typeof e=="string"?{type:"color",color:e}:e}function m(e){if(!(!e||e==="none"))return typeof e=="string"?{data:[{data:e}]}:Array.isArray(e)?{data:e.map(r=>typeof r=="string"?{data:r}:r)}:e}function h(e){if(!(!e||e==="none"))return typeof e=="string"?{url:e}:e}function y(e){if(!(!e||e==="none"))return typeof e=="string"?{color:e}:e}function S(e){if(!(!e||e==="none"))return typeof e=="string"?{color:e}:e}function f(e=""){return(Array.isArray(e)?e:[e]).map(t=>typeof t=="string"?{fragments:[{content:t}]}:"content"in t?{fragments:[{...t}]}:"fragments"in t?{...t,fragments:t.fragments.map(i=>({...i}))}:Array.isArray(t)?{fragments:t.map(i=>typeof i=="string"?{content:i}:{...i})}:{fragments:[]})}function p(e){if(!(!e||e==="none"))return typeof e=="string"?{content:[{fragments:[{content:e}]}]}:"content"in e?{...e,content:f(e.content)}:{content:f(e)}}function z(e){if(!(!e||e==="none"))return typeof e=="string"?{url:e}:{...e}}function b(e){var r;return l({...e,image:h(e.image),video:z(e.video),text:p(e.text),geometry:m(e.geometry),fill:d(e.fill),outline:y(e.outline),shadow:S(e.shadow),children:(r=e.children)==null?void 0:r.map(t=>b(t))})}n.clearUndef=l,n.deepClearUndef=v,n.getDefaultElementStyle=g,n.getDefaultShadowStyle=u,n.getDefaultStyle=T,n.getDefaultTextStyle=c,n.getDefaultTransformStyle=s,n.normalizeElement=b,n.normalizeFill=d,n.normalizeGeometry=m,n.normalizeImage=h,n.normalizeOutline=y,n.normalizeShadow=S,n.normalizeText=p,n.normalizeTextContent=f,n.normalizeVideo=z,Object.defineProperty(n,Symbol.toStringTag,{value:"Module"})});
package/dist/index.mjs CHANGED
@@ -47,10 +47,6 @@ function getDefaultLayoutStyle() {
47
47
 
48
48
  function getDefaultShadowStyle() {
49
49
  return {
50
- shadowColor: "transparent",
51
- shadowOffsetX: 0,
52
- shadowOffsetY: 0,
53
- shadowBlur: 0,
54
50
  boxShadow: "none"
55
51
  };
56
52
  }
@@ -134,11 +130,41 @@ function getDefaultStyle() {
134
130
  };
135
131
  }
136
132
 
133
+ function clearUndef(obj, deep = false) {
134
+ if (typeof obj !== "object" || !obj) {
135
+ return obj;
136
+ }
137
+ if (Array.isArray(obj)) {
138
+ if (deep) {
139
+ return obj.map((v) => clearUndef(v, deep));
140
+ } else {
141
+ return obj;
142
+ }
143
+ }
144
+ const newObj = {};
145
+ for (const key in obj) {
146
+ const value = obj[key];
147
+ if (value === void 0 || value === null) {
148
+ continue;
149
+ }
150
+ if (deep) {
151
+ newObj[key] = clearUndef(value, deep);
152
+ } else {
153
+ newObj[key] = value;
154
+ }
155
+ }
156
+ return newObj;
157
+ }
158
+ function deepClearUndef(obj) {
159
+ return clearUndef(obj, true);
160
+ }
161
+
137
162
  function normalizeFill(fill) {
138
163
  if (!fill || fill === "none") {
139
164
  return void 0;
140
165
  } else if (typeof fill === "string") {
141
166
  return {
167
+ type: "color",
142
168
  color: fill
143
169
  };
144
170
  } else {
@@ -183,15 +209,27 @@ function normalizeImage(image) {
183
209
  }
184
210
  }
185
211
 
186
- function normalizeStroke(stroke) {
187
- if (!stroke || stroke === "none") {
212
+ function normalizeOutline(outline) {
213
+ if (!outline || outline === "none") {
188
214
  return void 0;
189
- } else if (typeof stroke === "string") {
215
+ } else if (typeof outline === "string") {
190
216
  return {
191
- color: stroke
217
+ color: outline
192
218
  };
193
219
  } else {
194
- return stroke;
220
+ return outline;
221
+ }
222
+ }
223
+
224
+ function normalizeShadow(shadow) {
225
+ if (!shadow || shadow === "none") {
226
+ return void 0;
227
+ } else if (typeof shadow === "string") {
228
+ return {
229
+ color: shadow
230
+ };
231
+ } else {
232
+ return shadow;
195
233
  }
196
234
  }
197
235
 
@@ -275,16 +313,17 @@ function normalizeVideo(video) {
275
313
  }
276
314
 
277
315
  function normalizeElement(element) {
278
- return {
316
+ return clearUndef({
279
317
  ...element,
280
318
  image: normalizeImage(element.image),
281
319
  video: normalizeVideo(element.video),
282
320
  text: normalizeText(element.text),
283
321
  geometry: normalizeGeometry(element.geometry),
284
322
  fill: normalizeFill(element.fill),
285
- stroke: normalizeStroke(element.stroke),
323
+ outline: normalizeOutline(element.outline),
324
+ shadow: normalizeShadow(element.shadow),
286
325
  children: element.children?.map((child) => normalizeElement(child))
287
- };
326
+ });
288
327
  }
289
328
 
290
- export { getDefaultElementStyle, getDefaultShadowStyle, getDefaultStyle, getDefaultTextStyle, getDefaultTransformStyle, normalizeElement, normalizeFill, normalizeGeometry, normalizeImage, normalizeStroke, normalizeText, normalizeTextContent, normalizeVideo };
329
+ export { clearUndef, deepClearUndef, getDefaultElementStyle, getDefaultShadowStyle, getDefaultStyle, getDefaultTextStyle, getDefaultTransformStyle, normalizeElement, normalizeFill, normalizeGeometry, normalizeImage, normalizeOutline, normalizeShadow, 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.2.2",
4
+ "version": "0.2.3",
5
5
  "packageManager": "pnpm@9.15.1",
6
6
  "description": "Intermediate document for modern codec libs",
7
7
  "author": "wxm",