@diy-website-builder/sdk 0.1.0 → 0.1.4
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/README.md +98 -13
- package/dist/diy-website-builder-editor.js +53 -50
- package/dist/index.d.ts +40 -1
- package/package.json +4 -2
package/dist/index.d.ts
CHANGED
|
@@ -32,22 +32,61 @@ export type PaidFeatureEventTypes =
|
|
|
32
32
|
| "premiumComponentRestricted"
|
|
33
33
|
| "vibeRestricted";
|
|
34
34
|
|
|
35
|
+
export type PublishMode = "hosted" | "export";
|
|
36
|
+
|
|
37
|
+
/** UI locales supported by the editor. */
|
|
38
|
+
export type SupportedLanguages = "en" | "fr" | "de" | "es";
|
|
39
|
+
|
|
40
|
+
export type ExportedPage = {
|
|
41
|
+
fileName: string;
|
|
42
|
+
title?: string;
|
|
43
|
+
pageId?: string;
|
|
44
|
+
html: string;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export type SiteExportManifest = {
|
|
48
|
+
pageCount: number;
|
|
49
|
+
entryFileName: string;
|
|
50
|
+
cdnHosts: string[];
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export type SiteExport = {
|
|
54
|
+
shortId: string;
|
|
55
|
+
exportedAt: string;
|
|
56
|
+
pages: ExportedPage[];
|
|
57
|
+
/** Always true: images/fonts/media load from DIY CDN. */
|
|
58
|
+
cdnMedia: true;
|
|
59
|
+
manifest: SiteExportManifest;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export type ExportProgress = {
|
|
63
|
+
phase: "save" | "compile";
|
|
64
|
+
current: number;
|
|
65
|
+
total: number;
|
|
66
|
+
};
|
|
67
|
+
|
|
35
68
|
export type EditorInit = {
|
|
36
69
|
apiKey: string;
|
|
37
70
|
shortId: string;
|
|
38
71
|
container: HTMLElement;
|
|
39
72
|
environment?: DeploymentEnvironments | `${DeploymentEnvironments}`;
|
|
40
|
-
language?:
|
|
73
|
+
language?: SupportedLanguages;
|
|
41
74
|
font?: string;
|
|
42
75
|
exitURL?: string;
|
|
43
76
|
enableAI?: boolean;
|
|
77
|
+
/** Default `"hosted"`. `"export"` compiles HTML and calls `onExport` (no DIY publish). */
|
|
78
|
+
publishMode?: PublishMode;
|
|
44
79
|
onPublish?: (url?: string) => void;
|
|
80
|
+
onExport?: (site: SiteExport) => void | Promise<void>;
|
|
81
|
+
onExportProgress?: (progress: ExportProgress) => void;
|
|
45
82
|
onPaidFeatureClick?: (event: PaidFeatureEventTypes) => void;
|
|
46
83
|
showMessage?: (message: string, type: EditorToastType, options?: { id?: string }) => void;
|
|
47
84
|
};
|
|
48
85
|
|
|
49
86
|
export declare class Builder {
|
|
50
87
|
constructor(options: EditorInit);
|
|
88
|
+
exportSite(): Promise<SiteExport>;
|
|
89
|
+
exportPage(pageId?: string): Promise<ExportedPage>;
|
|
51
90
|
destroy(): void;
|
|
52
91
|
}
|
|
53
92
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@diy-website-builder/sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "Framework-agnostic v3 website builder editor. Mount into any HTMLElement via DIYWebsiteBuilderEditor.Builder.",
|
|
5
5
|
"main": "dist/diy-website-builder-editor.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -16,7 +16,9 @@
|
|
|
16
16
|
"dist",
|
|
17
17
|
"README.md"
|
|
18
18
|
],
|
|
19
|
-
"sideEffects":
|
|
19
|
+
"sideEffects": [
|
|
20
|
+
"./dist/diy-website-builder-editor.js"
|
|
21
|
+
],
|
|
20
22
|
"keywords": [
|
|
21
23
|
"website-builder",
|
|
22
24
|
"visual-editor",
|