@templatical/import-beefree 0.0.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.cjs +568 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +215 -0
- package/dist/index.d.ts +215 -0
- package/dist/index.js +556 -0
- package/dist/index.js.map +1 -0
- package/package.json +34 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
import * as _templatical_types from '@templatical/types';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* BeeFree JSON type definitions.
|
|
5
|
+
* Based on the BeeFree export format used by the BEE Plugin / BEE Pro editor.
|
|
6
|
+
*/
|
|
7
|
+
interface BeeFreeTemplate {
|
|
8
|
+
page: BeeFreeePage;
|
|
9
|
+
comments?: Record<string, unknown>;
|
|
10
|
+
}
|
|
11
|
+
interface BeeFreeePage {
|
|
12
|
+
title?: string;
|
|
13
|
+
description?: string;
|
|
14
|
+
rows: BeeFreeeRow[];
|
|
15
|
+
body?: BeeFreeeBody;
|
|
16
|
+
}
|
|
17
|
+
interface BeeFreeeBody {
|
|
18
|
+
type?: string;
|
|
19
|
+
webFonts?: BeeFreeeWebFont[];
|
|
20
|
+
content?: {
|
|
21
|
+
style?: Record<string, string>;
|
|
22
|
+
computedStyle?: Record<string, string>;
|
|
23
|
+
};
|
|
24
|
+
container?: {
|
|
25
|
+
style?: Record<string, string>;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
interface BeeFreeeWebFont {
|
|
29
|
+
name: string;
|
|
30
|
+
fontFamily?: string;
|
|
31
|
+
url?: string;
|
|
32
|
+
}
|
|
33
|
+
interface BeeFreeeRow {
|
|
34
|
+
uuid?: string;
|
|
35
|
+
type?: string;
|
|
36
|
+
locked?: boolean;
|
|
37
|
+
synced?: boolean;
|
|
38
|
+
empty?: boolean;
|
|
39
|
+
columns: BeeFreeeColumn[];
|
|
40
|
+
container?: {
|
|
41
|
+
style?: Record<string, string>;
|
|
42
|
+
};
|
|
43
|
+
content?: {
|
|
44
|
+
style?: Record<string, string>;
|
|
45
|
+
computedStyle?: Record<string, string | boolean>;
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
interface BeeFreeeColumn {
|
|
49
|
+
uuid?: string;
|
|
50
|
+
"grid-columns"?: number;
|
|
51
|
+
style?: Record<string, string>;
|
|
52
|
+
modules: BeeFreeeModule[];
|
|
53
|
+
}
|
|
54
|
+
interface BeeFreeeModule {
|
|
55
|
+
type: string;
|
|
56
|
+
locked?: boolean;
|
|
57
|
+
uuid?: string;
|
|
58
|
+
descriptor: BeeFreeeModuleDescriptor;
|
|
59
|
+
}
|
|
60
|
+
interface BeeFreeeModuleDescriptor {
|
|
61
|
+
style?: Record<string, string>;
|
|
62
|
+
computedStyle?: Record<string, string | boolean>;
|
|
63
|
+
text?: BeeFreeeTextContent;
|
|
64
|
+
paragraph?: BeeFreeeTextContent;
|
|
65
|
+
heading?: BeeFreeeHeadingContent;
|
|
66
|
+
list?: BeeFreeeTextContent;
|
|
67
|
+
image?: BeeFreeeImageContent;
|
|
68
|
+
button?: BeeFreeeButtonContent;
|
|
69
|
+
divider?: BeeFreeeeDividerContent;
|
|
70
|
+
spacer?: BeeFreeeSpacerContent;
|
|
71
|
+
html?: BeeFreeeHtmlContent;
|
|
72
|
+
iconsList?: BeeFreeeSocialContent;
|
|
73
|
+
video?: BeeFreeeVideoContent;
|
|
74
|
+
menu?: BeeFreeeMenuContent;
|
|
75
|
+
table?: BeeFreeeTableContent;
|
|
76
|
+
}
|
|
77
|
+
interface BeeFreeeTextContent {
|
|
78
|
+
style?: Record<string, string>;
|
|
79
|
+
computedStyle?: Record<string, string>;
|
|
80
|
+
html: string;
|
|
81
|
+
}
|
|
82
|
+
interface BeeFreeeHeadingContent {
|
|
83
|
+
title?: string;
|
|
84
|
+
text?: string;
|
|
85
|
+
style?: Record<string, string>;
|
|
86
|
+
}
|
|
87
|
+
interface BeeFreeeImageContent {
|
|
88
|
+
src: string;
|
|
89
|
+
href?: string;
|
|
90
|
+
alt?: string;
|
|
91
|
+
width?: string;
|
|
92
|
+
height?: string;
|
|
93
|
+
prefix?: string;
|
|
94
|
+
style?: Record<string, string>;
|
|
95
|
+
}
|
|
96
|
+
interface BeeFreeeButtonContent {
|
|
97
|
+
label: string;
|
|
98
|
+
href?: string;
|
|
99
|
+
style?: Record<string, string>;
|
|
100
|
+
}
|
|
101
|
+
interface BeeFreeeeDividerContent {
|
|
102
|
+
style?: Record<string, string>;
|
|
103
|
+
}
|
|
104
|
+
interface BeeFreeeSpacerContent {
|
|
105
|
+
style?: Record<string, string>;
|
|
106
|
+
}
|
|
107
|
+
interface BeeFreeeHtmlContent {
|
|
108
|
+
html: string;
|
|
109
|
+
}
|
|
110
|
+
interface BeeFreeeSocialContent {
|
|
111
|
+
icons: BeeFreeeSocialIcon[];
|
|
112
|
+
}
|
|
113
|
+
interface BeeFreeeSocialIcon {
|
|
114
|
+
image?: {
|
|
115
|
+
title?: string;
|
|
116
|
+
src?: string;
|
|
117
|
+
href?: string;
|
|
118
|
+
alt?: string;
|
|
119
|
+
};
|
|
120
|
+
name?: string;
|
|
121
|
+
text?: string;
|
|
122
|
+
type?: string;
|
|
123
|
+
id?: string;
|
|
124
|
+
}
|
|
125
|
+
interface BeeFreeeVideoContent {
|
|
126
|
+
src: string;
|
|
127
|
+
thumbnail?: string;
|
|
128
|
+
alt?: string;
|
|
129
|
+
style?: Record<string, string>;
|
|
130
|
+
}
|
|
131
|
+
interface BeeFreeeMenuContent {
|
|
132
|
+
items: BeeFreeeMenuItem[];
|
|
133
|
+
separator?: string;
|
|
134
|
+
separatorColor?: string;
|
|
135
|
+
style?: Record<string, string>;
|
|
136
|
+
}
|
|
137
|
+
interface BeeFreeeMenuItem {
|
|
138
|
+
text: string;
|
|
139
|
+
link?: string;
|
|
140
|
+
href?: string;
|
|
141
|
+
target?: string;
|
|
142
|
+
}
|
|
143
|
+
interface BeeFreeeTableContent {
|
|
144
|
+
rows: BeeFreeeTableRow[];
|
|
145
|
+
hasHeaderRow?: boolean;
|
|
146
|
+
headerBackgroundColor?: string;
|
|
147
|
+
cellPadding?: number | string;
|
|
148
|
+
style?: Record<string, string>;
|
|
149
|
+
}
|
|
150
|
+
interface BeeFreeeTableRow {
|
|
151
|
+
cells: BeeFreeeTableCell[];
|
|
152
|
+
}
|
|
153
|
+
interface BeeFreeeTableCell {
|
|
154
|
+
content?: string;
|
|
155
|
+
html?: string;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Conversion status for each module in the import report.
|
|
159
|
+
*/
|
|
160
|
+
type ConversionStatus = "converted" | "approximated" | "html-fallback" | "skipped";
|
|
161
|
+
/**
|
|
162
|
+
* A single entry in the import report.
|
|
163
|
+
*/
|
|
164
|
+
interface ImportReportEntry {
|
|
165
|
+
beeFreeModuleType: string;
|
|
166
|
+
templaticalBlockType: string | null;
|
|
167
|
+
status: ConversionStatus;
|
|
168
|
+
note?: string;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* The full import report returned alongside the converted template.
|
|
172
|
+
*/
|
|
173
|
+
interface ImportReport {
|
|
174
|
+
entries: ImportReportEntry[];
|
|
175
|
+
warnings: string[];
|
|
176
|
+
summary: {
|
|
177
|
+
total: number;
|
|
178
|
+
converted: number;
|
|
179
|
+
approximated: number;
|
|
180
|
+
htmlFallback: number;
|
|
181
|
+
skipped: number;
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* The result of a BeeFree import operation.
|
|
186
|
+
*/
|
|
187
|
+
interface ImportResult {
|
|
188
|
+
content: _templatical_types.TemplateContent;
|
|
189
|
+
report: ImportReport;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Converts a BeeFree template JSON to Templatical TemplateContent.
|
|
194
|
+
*
|
|
195
|
+
* @param template - The parsed BeeFree JSON object
|
|
196
|
+
* @returns An ImportResult with the converted content and a detailed report
|
|
197
|
+
*
|
|
198
|
+
* @example
|
|
199
|
+
* ```ts
|
|
200
|
+
* import { convertBeeFreeTemplate } from '@templatical/import-beefree';
|
|
201
|
+
*
|
|
202
|
+
* const beeFreeJson = JSON.parse(fileContent);
|
|
203
|
+
* const { content, report } = convertBeeFreeTemplate(beeFreeJson);
|
|
204
|
+
*
|
|
205
|
+
* // Use the content with the editor
|
|
206
|
+
* const editor = init({ container: '#editor', content });
|
|
207
|
+
*
|
|
208
|
+
* // Check the report for any issues
|
|
209
|
+
* console.log(report.summary);
|
|
210
|
+
* console.log(report.warnings);
|
|
211
|
+
* ```
|
|
212
|
+
*/
|
|
213
|
+
declare function convertBeeFreeTemplate(template: BeeFreeTemplate): ImportResult;
|
|
214
|
+
|
|
215
|
+
export { type BeeFreeTemplate, type ConversionStatus, type ImportReport, type ImportReportEntry, type ImportResult, convertBeeFreeTemplate };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
import * as _templatical_types from '@templatical/types';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* BeeFree JSON type definitions.
|
|
5
|
+
* Based on the BeeFree export format used by the BEE Plugin / BEE Pro editor.
|
|
6
|
+
*/
|
|
7
|
+
interface BeeFreeTemplate {
|
|
8
|
+
page: BeeFreeePage;
|
|
9
|
+
comments?: Record<string, unknown>;
|
|
10
|
+
}
|
|
11
|
+
interface BeeFreeePage {
|
|
12
|
+
title?: string;
|
|
13
|
+
description?: string;
|
|
14
|
+
rows: BeeFreeeRow[];
|
|
15
|
+
body?: BeeFreeeBody;
|
|
16
|
+
}
|
|
17
|
+
interface BeeFreeeBody {
|
|
18
|
+
type?: string;
|
|
19
|
+
webFonts?: BeeFreeeWebFont[];
|
|
20
|
+
content?: {
|
|
21
|
+
style?: Record<string, string>;
|
|
22
|
+
computedStyle?: Record<string, string>;
|
|
23
|
+
};
|
|
24
|
+
container?: {
|
|
25
|
+
style?: Record<string, string>;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
interface BeeFreeeWebFont {
|
|
29
|
+
name: string;
|
|
30
|
+
fontFamily?: string;
|
|
31
|
+
url?: string;
|
|
32
|
+
}
|
|
33
|
+
interface BeeFreeeRow {
|
|
34
|
+
uuid?: string;
|
|
35
|
+
type?: string;
|
|
36
|
+
locked?: boolean;
|
|
37
|
+
synced?: boolean;
|
|
38
|
+
empty?: boolean;
|
|
39
|
+
columns: BeeFreeeColumn[];
|
|
40
|
+
container?: {
|
|
41
|
+
style?: Record<string, string>;
|
|
42
|
+
};
|
|
43
|
+
content?: {
|
|
44
|
+
style?: Record<string, string>;
|
|
45
|
+
computedStyle?: Record<string, string | boolean>;
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
interface BeeFreeeColumn {
|
|
49
|
+
uuid?: string;
|
|
50
|
+
"grid-columns"?: number;
|
|
51
|
+
style?: Record<string, string>;
|
|
52
|
+
modules: BeeFreeeModule[];
|
|
53
|
+
}
|
|
54
|
+
interface BeeFreeeModule {
|
|
55
|
+
type: string;
|
|
56
|
+
locked?: boolean;
|
|
57
|
+
uuid?: string;
|
|
58
|
+
descriptor: BeeFreeeModuleDescriptor;
|
|
59
|
+
}
|
|
60
|
+
interface BeeFreeeModuleDescriptor {
|
|
61
|
+
style?: Record<string, string>;
|
|
62
|
+
computedStyle?: Record<string, string | boolean>;
|
|
63
|
+
text?: BeeFreeeTextContent;
|
|
64
|
+
paragraph?: BeeFreeeTextContent;
|
|
65
|
+
heading?: BeeFreeeHeadingContent;
|
|
66
|
+
list?: BeeFreeeTextContent;
|
|
67
|
+
image?: BeeFreeeImageContent;
|
|
68
|
+
button?: BeeFreeeButtonContent;
|
|
69
|
+
divider?: BeeFreeeeDividerContent;
|
|
70
|
+
spacer?: BeeFreeeSpacerContent;
|
|
71
|
+
html?: BeeFreeeHtmlContent;
|
|
72
|
+
iconsList?: BeeFreeeSocialContent;
|
|
73
|
+
video?: BeeFreeeVideoContent;
|
|
74
|
+
menu?: BeeFreeeMenuContent;
|
|
75
|
+
table?: BeeFreeeTableContent;
|
|
76
|
+
}
|
|
77
|
+
interface BeeFreeeTextContent {
|
|
78
|
+
style?: Record<string, string>;
|
|
79
|
+
computedStyle?: Record<string, string>;
|
|
80
|
+
html: string;
|
|
81
|
+
}
|
|
82
|
+
interface BeeFreeeHeadingContent {
|
|
83
|
+
title?: string;
|
|
84
|
+
text?: string;
|
|
85
|
+
style?: Record<string, string>;
|
|
86
|
+
}
|
|
87
|
+
interface BeeFreeeImageContent {
|
|
88
|
+
src: string;
|
|
89
|
+
href?: string;
|
|
90
|
+
alt?: string;
|
|
91
|
+
width?: string;
|
|
92
|
+
height?: string;
|
|
93
|
+
prefix?: string;
|
|
94
|
+
style?: Record<string, string>;
|
|
95
|
+
}
|
|
96
|
+
interface BeeFreeeButtonContent {
|
|
97
|
+
label: string;
|
|
98
|
+
href?: string;
|
|
99
|
+
style?: Record<string, string>;
|
|
100
|
+
}
|
|
101
|
+
interface BeeFreeeeDividerContent {
|
|
102
|
+
style?: Record<string, string>;
|
|
103
|
+
}
|
|
104
|
+
interface BeeFreeeSpacerContent {
|
|
105
|
+
style?: Record<string, string>;
|
|
106
|
+
}
|
|
107
|
+
interface BeeFreeeHtmlContent {
|
|
108
|
+
html: string;
|
|
109
|
+
}
|
|
110
|
+
interface BeeFreeeSocialContent {
|
|
111
|
+
icons: BeeFreeeSocialIcon[];
|
|
112
|
+
}
|
|
113
|
+
interface BeeFreeeSocialIcon {
|
|
114
|
+
image?: {
|
|
115
|
+
title?: string;
|
|
116
|
+
src?: string;
|
|
117
|
+
href?: string;
|
|
118
|
+
alt?: string;
|
|
119
|
+
};
|
|
120
|
+
name?: string;
|
|
121
|
+
text?: string;
|
|
122
|
+
type?: string;
|
|
123
|
+
id?: string;
|
|
124
|
+
}
|
|
125
|
+
interface BeeFreeeVideoContent {
|
|
126
|
+
src: string;
|
|
127
|
+
thumbnail?: string;
|
|
128
|
+
alt?: string;
|
|
129
|
+
style?: Record<string, string>;
|
|
130
|
+
}
|
|
131
|
+
interface BeeFreeeMenuContent {
|
|
132
|
+
items: BeeFreeeMenuItem[];
|
|
133
|
+
separator?: string;
|
|
134
|
+
separatorColor?: string;
|
|
135
|
+
style?: Record<string, string>;
|
|
136
|
+
}
|
|
137
|
+
interface BeeFreeeMenuItem {
|
|
138
|
+
text: string;
|
|
139
|
+
link?: string;
|
|
140
|
+
href?: string;
|
|
141
|
+
target?: string;
|
|
142
|
+
}
|
|
143
|
+
interface BeeFreeeTableContent {
|
|
144
|
+
rows: BeeFreeeTableRow[];
|
|
145
|
+
hasHeaderRow?: boolean;
|
|
146
|
+
headerBackgroundColor?: string;
|
|
147
|
+
cellPadding?: number | string;
|
|
148
|
+
style?: Record<string, string>;
|
|
149
|
+
}
|
|
150
|
+
interface BeeFreeeTableRow {
|
|
151
|
+
cells: BeeFreeeTableCell[];
|
|
152
|
+
}
|
|
153
|
+
interface BeeFreeeTableCell {
|
|
154
|
+
content?: string;
|
|
155
|
+
html?: string;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Conversion status for each module in the import report.
|
|
159
|
+
*/
|
|
160
|
+
type ConversionStatus = "converted" | "approximated" | "html-fallback" | "skipped";
|
|
161
|
+
/**
|
|
162
|
+
* A single entry in the import report.
|
|
163
|
+
*/
|
|
164
|
+
interface ImportReportEntry {
|
|
165
|
+
beeFreeModuleType: string;
|
|
166
|
+
templaticalBlockType: string | null;
|
|
167
|
+
status: ConversionStatus;
|
|
168
|
+
note?: string;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* The full import report returned alongside the converted template.
|
|
172
|
+
*/
|
|
173
|
+
interface ImportReport {
|
|
174
|
+
entries: ImportReportEntry[];
|
|
175
|
+
warnings: string[];
|
|
176
|
+
summary: {
|
|
177
|
+
total: number;
|
|
178
|
+
converted: number;
|
|
179
|
+
approximated: number;
|
|
180
|
+
htmlFallback: number;
|
|
181
|
+
skipped: number;
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* The result of a BeeFree import operation.
|
|
186
|
+
*/
|
|
187
|
+
interface ImportResult {
|
|
188
|
+
content: _templatical_types.TemplateContent;
|
|
189
|
+
report: ImportReport;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Converts a BeeFree template JSON to Templatical TemplateContent.
|
|
194
|
+
*
|
|
195
|
+
* @param template - The parsed BeeFree JSON object
|
|
196
|
+
* @returns An ImportResult with the converted content and a detailed report
|
|
197
|
+
*
|
|
198
|
+
* @example
|
|
199
|
+
* ```ts
|
|
200
|
+
* import { convertBeeFreeTemplate } from '@templatical/import-beefree';
|
|
201
|
+
*
|
|
202
|
+
* const beeFreeJson = JSON.parse(fileContent);
|
|
203
|
+
* const { content, report } = convertBeeFreeTemplate(beeFreeJson);
|
|
204
|
+
*
|
|
205
|
+
* // Use the content with the editor
|
|
206
|
+
* const editor = init({ container: '#editor', content });
|
|
207
|
+
*
|
|
208
|
+
* // Check the report for any issues
|
|
209
|
+
* console.log(report.summary);
|
|
210
|
+
* console.log(report.warnings);
|
|
211
|
+
* ```
|
|
212
|
+
*/
|
|
213
|
+
declare function convertBeeFreeTemplate(template: BeeFreeTemplate): ImportResult;
|
|
214
|
+
|
|
215
|
+
export { type BeeFreeTemplate, type ConversionStatus, type ImportReport, type ImportReportEntry, type ImportResult, convertBeeFreeTemplate };
|