@templatical/import-unlayer 0.9.1 → 0.10.1

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.d.ts CHANGED
@@ -1,154 +1,153 @@
1
- import * as _templatical_types from '@templatical/types';
2
-
1
+ //#region src/types.d.ts
3
2
  /**
4
3
  * Unlayer JSON type definitions.
5
4
  * Based on the design JSON shape produced by `editor.saveDesign()` in
6
5
  * react-email-editor / Unlayer's hosted editor.
7
6
  */
8
7
  interface UnlayerTemplate {
9
- counters?: Record<string, number>;
10
- body: UnlayerBody;
11
- schemaVersion?: number;
8
+ counters?: Record<string, number>;
9
+ body: UnlayerBody;
10
+ schemaVersion?: number;
12
11
  }
13
12
  interface UnlayerBody {
14
- id?: string;
15
- rows: UnlayerRow[];
16
- headers?: UnlayerRow[];
17
- footers?: UnlayerRow[];
18
- values: UnlayerBodyValues;
13
+ id?: string;
14
+ rows: UnlayerRow[];
15
+ headers?: UnlayerRow[];
16
+ footers?: UnlayerRow[];
17
+ values: UnlayerBodyValues;
19
18
  }
20
19
  interface UnlayerBackgroundImage {
21
- url?: string;
22
- fullWidth?: boolean;
23
- repeat?: string;
24
- size?: string;
25
- position?: string;
20
+ url?: string;
21
+ fullWidth?: boolean;
22
+ repeat?: string;
23
+ size?: string;
24
+ position?: string;
26
25
  }
27
26
  interface UnlayerFontFamily {
28
- label?: string;
29
- value?: string;
27
+ label?: string;
28
+ value?: string;
30
29
  }
31
30
  interface UnlayerBodyValues {
32
- backgroundColor?: string;
33
- backgroundImage?: UnlayerBackgroundImage;
34
- contentWidth?: string;
35
- contentAlignment?: string;
36
- fontFamily?: UnlayerFontFamily;
37
- textColor?: string;
38
- linkStyle?: Record<string, string>;
39
- preheaderText?: string;
40
- [key: string]: unknown;
31
+ backgroundColor?: string;
32
+ backgroundImage?: UnlayerBackgroundImage;
33
+ contentWidth?: string;
34
+ contentAlignment?: string;
35
+ fontFamily?: UnlayerFontFamily;
36
+ textColor?: string;
37
+ linkStyle?: Record<string, string>;
38
+ preheaderText?: string;
39
+ [key: string]: unknown;
41
40
  }
42
41
  interface UnlayerRow {
43
- id?: string;
44
- cells: number[];
45
- columns: UnlayerColumn[];
46
- values: UnlayerRowValues;
42
+ id?: string;
43
+ cells: number[];
44
+ columns: UnlayerColumn[];
45
+ values: UnlayerRowValues;
47
46
  }
48
47
  interface UnlayerRowValues {
49
- backgroundColor?: string;
50
- backgroundImage?: UnlayerBackgroundImage;
51
- padding?: string;
52
- columnsBackgroundColor?: string;
53
- hideMobile?: boolean;
54
- hideDesktop?: boolean;
55
- noStackMobile?: boolean;
56
- _meta?: Record<string, unknown>;
57
- [key: string]: unknown;
48
+ backgroundColor?: string;
49
+ backgroundImage?: UnlayerBackgroundImage;
50
+ padding?: string;
51
+ columnsBackgroundColor?: string;
52
+ hideMobile?: boolean;
53
+ hideDesktop?: boolean;
54
+ noStackMobile?: boolean;
55
+ _meta?: Record<string, unknown>;
56
+ [key: string]: unknown;
58
57
  }
59
58
  interface UnlayerColumn {
60
- id?: string;
61
- contents: UnlayerContent[];
62
- values: UnlayerColumnValues;
59
+ id?: string;
60
+ contents: UnlayerContent[];
61
+ values: UnlayerColumnValues;
63
62
  }
64
63
  interface UnlayerColumnValues {
65
- backgroundColor?: string;
66
- padding?: string;
67
- border?: Record<string, string>;
68
- _meta?: Record<string, unknown>;
69
- [key: string]: unknown;
64
+ backgroundColor?: string;
65
+ padding?: string;
66
+ border?: Record<string, string>;
67
+ _meta?: Record<string, unknown>;
68
+ [key: string]: unknown;
70
69
  }
71
70
  interface UnlayerContent {
72
- type: string;
73
- values: UnlayerContentValues;
71
+ type: string;
72
+ values: UnlayerContentValues;
74
73
  }
75
74
  interface UnlayerLinkAction {
76
- name?: string;
77
- values?: {
78
- href?: string;
79
- target?: string;
80
- };
75
+ name?: string;
76
+ values?: {
77
+ href?: string;
78
+ target?: string;
79
+ };
81
80
  }
82
81
  interface UnlayerImageSrc {
83
- url?: string;
84
- width?: number;
85
- height?: number;
82
+ url?: string;
83
+ width?: number;
84
+ height?: number;
86
85
  }
87
86
  interface UnlayerButtonColors {
88
- color?: string;
89
- backgroundColor?: string;
90
- hoverColor?: string;
91
- hoverBackgroundColor?: string;
87
+ color?: string;
88
+ backgroundColor?: string;
89
+ hoverColor?: string;
90
+ hoverBackgroundColor?: string;
92
91
  }
93
92
  interface UnlayerBorder {
94
- borderTopWidth?: string;
95
- borderTopStyle?: string;
96
- borderTopColor?: string;
93
+ borderTopWidth?: string;
94
+ borderTopStyle?: string;
95
+ borderTopColor?: string;
97
96
  }
98
97
  interface UnlayerMenuItem {
99
- key?: string;
100
- text: string;
101
- link?: UnlayerLinkAction;
98
+ key?: string;
99
+ text: string;
100
+ link?: UnlayerLinkAction;
102
101
  }
103
102
  interface UnlayerMenu {
104
- items: UnlayerMenuItem[];
103
+ items: UnlayerMenuItem[];
105
104
  }
106
105
  interface UnlayerSocialIcon {
107
- name?: string;
108
- url?: string;
109
- type?: string;
106
+ name?: string;
107
+ url?: string;
108
+ type?: string;
110
109
  }
111
110
  interface UnlayerSocialIcons {
112
- iconType?: string;
113
- editor?: {
114
- data?: {
115
- showTitle?: boolean;
116
- };
111
+ iconType?: string;
112
+ editor?: {
113
+ data?: {
114
+ showTitle?: boolean;
117
115
  };
118
- icons?: UnlayerSocialIcon[];
116
+ };
117
+ icons?: UnlayerSocialIcon[];
119
118
  }
120
119
  interface UnlayerContentValues {
121
- containerPadding?: string;
122
- textAlign?: string;
123
- fontFamily?: UnlayerFontFamily;
124
- fontSize?: string;
125
- fontWeight?: string | number;
126
- color?: string;
127
- hideMobile?: boolean;
128
- hideDesktop?: boolean;
129
- text?: string;
130
- headingType?: string;
131
- src?: UnlayerImageSrc;
132
- altText?: string;
133
- action?: UnlayerLinkAction;
134
- buttonColors?: UnlayerButtonColors;
135
- borderRadius?: string;
136
- padding?: string;
137
- size?: {
138
- autoWidth?: boolean;
139
- width?: string;
140
- };
141
- href?: UnlayerLinkAction;
142
- border?: UnlayerBorder;
120
+ containerPadding?: string;
121
+ textAlign?: string;
122
+ fontFamily?: UnlayerFontFamily;
123
+ fontSize?: string;
124
+ fontWeight?: string | number;
125
+ color?: string;
126
+ hideMobile?: boolean;
127
+ hideDesktop?: boolean;
128
+ text?: string;
129
+ headingType?: string;
130
+ src?: UnlayerImageSrc;
131
+ altText?: string;
132
+ action?: UnlayerLinkAction;
133
+ buttonColors?: UnlayerButtonColors;
134
+ borderRadius?: string;
135
+ padding?: string;
136
+ size?: {
137
+ autoWidth?: boolean;
143
138
  width?: string;
144
- html?: string;
145
- menu?: UnlayerMenu;
146
- layout?: "horizontal" | "vertical";
147
- separator?: string;
148
- icons?: UnlayerSocialIcons;
149
- videoUrl?: string;
150
- thumbnailUrl?: string;
151
- [key: string]: unknown;
139
+ };
140
+ href?: UnlayerLinkAction;
141
+ border?: UnlayerBorder;
142
+ width?: string;
143
+ html?: string;
144
+ menu?: UnlayerMenu;
145
+ layout?: "horizontal" | "vertical";
146
+ separator?: string;
147
+ icons?: UnlayerSocialIcons;
148
+ videoUrl?: string;
149
+ thumbnailUrl?: string;
150
+ [key: string]: unknown;
152
151
  }
153
152
  /**
154
153
  * Conversion status for each content node in the import report.
@@ -158,33 +157,34 @@ type ConversionStatus = "converted" | "approximated" | "html-fallback" | "skippe
158
157
  * A single entry in the import report.
159
158
  */
160
159
  interface ImportReportEntry {
161
- unlayerContentType: string;
162
- templaticalBlockType: string | null;
163
- status: ConversionStatus;
164
- note?: string;
160
+ unlayerContentType: string;
161
+ templaticalBlockType: string | null;
162
+ status: ConversionStatus;
163
+ note?: string;
165
164
  }
166
165
  /**
167
166
  * The full import report returned alongside the converted template.
168
167
  */
169
168
  interface ImportReport {
170
- entries: ImportReportEntry[];
171
- warnings: string[];
172
- summary: {
173
- total: number;
174
- converted: number;
175
- approximated: number;
176
- htmlFallback: number;
177
- skipped: number;
178
- };
169
+ entries: ImportReportEntry[];
170
+ warnings: string[];
171
+ summary: {
172
+ total: number;
173
+ converted: number;
174
+ approximated: number;
175
+ htmlFallback: number;
176
+ skipped: number;
177
+ };
179
178
  }
180
179
  /**
181
180
  * The result of an Unlayer import operation.
182
181
  */
183
182
  interface ImportResult {
184
- content: _templatical_types.TemplateContent;
185
- report: ImportReport;
183
+ content: import("@templatical/types").TemplateContent;
184
+ report: ImportReport;
186
185
  }
187
-
186
+ //#endregion
187
+ //#region src/converter.d.ts
188
188
  /**
189
189
  * Converts an Unlayer design JSON to Templatical TemplateContent.
190
190
  *
@@ -205,5 +205,6 @@ interface ImportResult {
205
205
  * ```
206
206
  */
207
207
  declare function convertUnlayerTemplate(template: UnlayerTemplate): ImportResult;
208
-
208
+ //#endregion
209
209
  export { type ConversionStatus, type ImportReport, type ImportReportEntry, type ImportResult, type UnlayerBody, type UnlayerColumn, type UnlayerContent, type UnlayerContentValues, type UnlayerRow, type UnlayerTemplate, convertUnlayerTemplate };
210
+ //# sourceMappingURL=index.d.ts.map