@templatical/import-unlayer 0.10.0 → 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 +125 -124
- package/dist/index.js +533 -554
- package/dist/index.js.map +1 -1
- package/package.json +3 -4
package/dist/index.d.ts
CHANGED
|
@@ -1,154 +1,153 @@
|
|
|
1
|
-
|
|
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
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
counters?: Record<string, number>;
|
|
9
|
+
body: UnlayerBody;
|
|
10
|
+
schemaVersion?: number;
|
|
12
11
|
}
|
|
13
12
|
interface UnlayerBody {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
id?: string;
|
|
14
|
+
rows: UnlayerRow[];
|
|
15
|
+
headers?: UnlayerRow[];
|
|
16
|
+
footers?: UnlayerRow[];
|
|
17
|
+
values: UnlayerBodyValues;
|
|
19
18
|
}
|
|
20
19
|
interface UnlayerBackgroundImage {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
url?: string;
|
|
21
|
+
fullWidth?: boolean;
|
|
22
|
+
repeat?: string;
|
|
23
|
+
size?: string;
|
|
24
|
+
position?: string;
|
|
26
25
|
}
|
|
27
26
|
interface UnlayerFontFamily {
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
label?: string;
|
|
28
|
+
value?: string;
|
|
30
29
|
}
|
|
31
30
|
interface UnlayerBodyValues {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
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
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
42
|
+
id?: string;
|
|
43
|
+
cells: number[];
|
|
44
|
+
columns: UnlayerColumn[];
|
|
45
|
+
values: UnlayerRowValues;
|
|
47
46
|
}
|
|
48
47
|
interface UnlayerRowValues {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
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
|
-
|
|
61
|
-
|
|
62
|
-
|
|
59
|
+
id?: string;
|
|
60
|
+
contents: UnlayerContent[];
|
|
61
|
+
values: UnlayerColumnValues;
|
|
63
62
|
}
|
|
64
63
|
interface UnlayerColumnValues {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
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
|
-
|
|
73
|
-
|
|
71
|
+
type: string;
|
|
72
|
+
values: UnlayerContentValues;
|
|
74
73
|
}
|
|
75
74
|
interface UnlayerLinkAction {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
75
|
+
name?: string;
|
|
76
|
+
values?: {
|
|
77
|
+
href?: string;
|
|
78
|
+
target?: string;
|
|
79
|
+
};
|
|
81
80
|
}
|
|
82
81
|
interface UnlayerImageSrc {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
82
|
+
url?: string;
|
|
83
|
+
width?: number;
|
|
84
|
+
height?: number;
|
|
86
85
|
}
|
|
87
86
|
interface UnlayerButtonColors {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
87
|
+
color?: string;
|
|
88
|
+
backgroundColor?: string;
|
|
89
|
+
hoverColor?: string;
|
|
90
|
+
hoverBackgroundColor?: string;
|
|
92
91
|
}
|
|
93
92
|
interface UnlayerBorder {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
93
|
+
borderTopWidth?: string;
|
|
94
|
+
borderTopStyle?: string;
|
|
95
|
+
borderTopColor?: string;
|
|
97
96
|
}
|
|
98
97
|
interface UnlayerMenuItem {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
98
|
+
key?: string;
|
|
99
|
+
text: string;
|
|
100
|
+
link?: UnlayerLinkAction;
|
|
102
101
|
}
|
|
103
102
|
interface UnlayerMenu {
|
|
104
|
-
|
|
103
|
+
items: UnlayerMenuItem[];
|
|
105
104
|
}
|
|
106
105
|
interface UnlayerSocialIcon {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
106
|
+
name?: string;
|
|
107
|
+
url?: string;
|
|
108
|
+
type?: string;
|
|
110
109
|
}
|
|
111
110
|
interface UnlayerSocialIcons {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
};
|
|
111
|
+
iconType?: string;
|
|
112
|
+
editor?: {
|
|
113
|
+
data?: {
|
|
114
|
+
showTitle?: boolean;
|
|
117
115
|
};
|
|
118
|
-
|
|
116
|
+
};
|
|
117
|
+
icons?: UnlayerSocialIcon[];
|
|
119
118
|
}
|
|
120
119
|
interface UnlayerContentValues {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
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
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
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
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
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
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
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
|
-
|
|
185
|
-
|
|
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
|