@silexlabs/silex 3.0.0-alpha.40 → 3.0.0-alpha.42
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/.silex.js +29 -8
- package/dist/client/client/api.d.ts +83 -0
- package/dist/client/client/config.d.ts +12 -42
- package/dist/client/client/expose.d.ts +6 -0
- package/dist/client/client/grapesjs/LoginDialog.d.ts +14 -0
- package/dist/client/client/grapesjs/PublicationManager.d.ts +75 -0
- package/dist/client/client/grapesjs/PublicationUi.d.ts +61 -0
- package/dist/client/client/grapesjs/index.d.ts +18 -44
- package/dist/client/client/grapesjs/openImport.d.ts +5 -0
- package/dist/client/client/grapesjs/storage.d.ts +1 -0
- package/dist/client/constants.d.ts +26 -0
- package/dist/client/css/admin.css +86 -3
- package/dist/client/events.d.ts +8 -0
- package/dist/client/js/main.js +202 -112
- package/dist/client/js/main.js.LICENSE.txt +1 -1
- package/dist/client/page.d.ts +1 -1
- package/dist/client/types.d.ts +246 -36
- package/dist/plugins/client/client/utils.d.ts +1 -0
- package/dist/plugins/client/client/utils.js +25 -0
- package/dist/plugins/client/client/utils.js.map +1 -0
- package/dist/plugins/client/events.d.ts +10 -0
- package/dist/plugins/client/events.js +27 -0
- package/dist/plugins/client/events.js.map +1 -0
- package/dist/plugins/client/plugins/client/template.d.ts +2 -0
- package/dist/plugins/client/plugins/client/template.js +186 -0
- package/dist/plugins/client/plugins/client/template.js.map +1 -0
- package/dist/plugins/server/constants.d.ts +30 -0
- package/dist/plugins/server/constants.js +50 -0
- package/dist/plugins/server/constants.js.map +1 -0
- package/dist/plugins/server/events.d.ts +10 -0
- package/dist/plugins/server/events.js +30 -0
- package/dist/plugins/server/events.js.map +1 -0
- package/dist/plugins/server/plugins/server/AuthPlugin.d.ts +1 -0
- package/dist/plugins/server/plugins/server/AuthPlugin.js +38 -0
- package/dist/plugins/server/plugins/server/AuthPlugin.js.map +1 -0
- package/dist/plugins/server/plugins/server/Cache.d.ts +2 -0
- package/dist/plugins/server/plugins/server/Cache.js +32 -0
- package/dist/plugins/server/plugins/server/Cache.js.map +1 -0
- package/dist/plugins/server/plugins/server/FtpConnector.d.ts +94 -0
- package/dist/plugins/server/plugins/server/FtpConnector.js +521 -0
- package/dist/plugins/server/plugins/server/FtpConnector.js.map +1 -0
- package/dist/plugins/server/plugins/server/HooksPlugin.d.ts +7 -0
- package/dist/plugins/server/plugins/server/HooksPlugin.js +74 -0
- package/dist/plugins/server/plugins/server/HooksPlugin.js.map +1 -0
- package/dist/plugins/server/plugins/server/SslPlugin.d.ts +1 -0
- package/dist/plugins/server/plugins/server/SslPlugin.js +86 -0
- package/dist/plugins/server/plugins/server/SslPlugin.js.map +1 -0
- package/dist/plugins/server/plugins/server/StaticPlugin.d.ts +1 -0
- package/dist/plugins/server/plugins/server/StaticPlugin.js +71 -0
- package/dist/plugins/server/plugins/server/StaticPlugin.js.map +1 -0
- package/dist/plugins/server/server/config.d.ts +59 -0
- package/dist/plugins/server/server/config.js +184 -0
- package/dist/plugins/server/server/config.js.map +1 -0
- package/dist/plugins/server/server/connectors/FsHosting.d.ts +13 -0
- package/dist/plugins/server/server/connectors/FsHosting.js +55 -0
- package/dist/plugins/server/server/connectors/FsHosting.js.map +1 -0
- package/dist/plugins/server/server/connectors/FsStorage.d.ts +40 -0
- package/dist/plugins/server/server/connectors/FsStorage.js +237 -0
- package/dist/plugins/server/server/connectors/FsStorage.js.map +1 -0
- package/dist/plugins/server/server/connectors/connectors.d.ts +83 -0
- package/dist/plugins/server/server/connectors/connectors.js +98 -0
- package/dist/plugins/server/server/connectors/connectors.js.map +1 -0
- package/dist/plugins/server/server/jobs.d.ts +6 -0
- package/dist/plugins/server/server/jobs.js +75 -0
- package/dist/plugins/server/server/jobs.js.map +1 -0
- package/dist/plugins/server/server/utils/validation.d.ts +7 -0
- package/dist/plugins/server/server/utils/validation.js +38 -0
- package/dist/plugins/server/server/utils/validation.js.map +1 -0
- package/dist/plugins/server/types.d.ts +309 -0
- package/dist/plugins/server/types.js +52 -0
- package/dist/plugins/server/types.js.map +1 -0
- package/dist/server/constants.js +30 -0
- package/dist/server/events.js +13 -0
- package/dist/server/plugins/server/Cache.js +15 -0
- package/dist/server/server/api/api.js +20 -0
- package/dist/server/server/api/connectorApi.js +200 -0
- package/dist/server/server/api/publicationApi.js +116 -0
- package/dist/server/server/api/websiteApi.js +288 -0
- package/dist/server/{cli.js → server/cli.js} +1 -1
- package/dist/server/server/config.js +124 -0
- package/dist/server/server/connectors/FsHosting.js +37 -0
- package/dist/server/server/connectors/FsStorage.js +208 -0
- package/dist/server/server/connectors/connectors.js +65 -0
- package/dist/server/server/express.js +47 -0
- package/dist/server/{index.js → server/index.js} +10 -18
- package/dist/server/server/jobs.js +47 -0
- package/dist/server/server/utils/validation.js +15 -0
- package/dist/server/types.js +19 -0
- package/package.json +35 -14
- package/public/silex.js +17 -0
- package/src/css/dialog.scss +9 -2
- package/src/css/grapesjs.scss +79 -0
- package/src/css/project-bar.scss +2 -2
- package/src/example-client-config.js +17 -0
- package/src/html/templates/includes.pug +0 -1
- package/src/ts/client/api.ts +135 -0
- package/src/ts/client/config.ts +7 -6
- package/src/ts/client/expose.ts +11 -0
- package/src/ts/client/grapesjs/LoginDialog.ts +191 -0
- package/src/ts/client/grapesjs/PublicationManager.ts +307 -0
- package/src/ts/client/grapesjs/PublicationUi.ts +330 -0
- package/src/ts/client/grapesjs/eleventy.ts +4 -1
- package/src/ts/client/grapesjs/index.ts +79 -89
- package/src/ts/client/grapesjs/openImport.ts +5 -0
- package/src/ts/client/grapesjs/storage.ts +114 -0
- package/src/ts/client/index.ts +16 -13
- package/src/ts/constants.ts +31 -0
- package/src/ts/events.ts +8 -0
- package/src/ts/page.ts +1 -1
- package/src/ts/plugins/client/template.ts +196 -0
- package/src/ts/plugins/server/AuthPlugin.ts +38 -0
- package/src/ts/plugins/server/Cache.ts +28 -0
- package/src/ts/plugins/server/FtpConnector.ts +602 -0
- package/src/{plugins/HooksPlugin.js → ts/plugins/server/HooksPlugin.ts} +29 -10
- package/src/ts/plugins/server/SslPlugin.ts +84 -0
- package/src/ts/plugins/server/StaticPlugin.ts +72 -0
- package/src/ts/server/api/api.ts +19 -0
- package/src/ts/server/api/connectorApi.ts +322 -0
- package/src/ts/server/api/publicationApi.ts +179 -0
- package/src/ts/server/api/websiteApi.ts +397 -0
- package/src/ts/server/cli.ts +1 -1
- package/src/ts/server/config.ts +117 -36
- package/src/ts/server/connectors/FsHosting.ts +60 -0
- package/src/ts/server/connectors/FsStorage.ts +236 -0
- package/src/ts/server/connectors/connectors.ts +171 -0
- package/src/ts/server/express.ts +38 -3
- package/src/ts/server/index.ts +25 -15
- package/src/ts/server/jobs.test.ts +75 -0
- package/src/ts/server/jobs.ts +77 -0
- package/src/ts/server/utils/BackwardCompat.ts +1 -1
- package/src/ts/server/utils/validation.ts +34 -0
- package/src/ts/types.ts +203 -63
- package/dist/client/client/grapesjs/eleventy.d.ts +0 -1
- package/dist/client/client/grapesjs/publish.d.ts +0 -18
- package/dist/client/client/grapesjs/template.d.ts +0 -1
- package/dist/constants.js +0 -4
- package/dist/events.js +0 -5
- package/dist/page.js +0 -15
- package/dist/server/config.js +0 -70
- package/dist/server/express.js +0 -18
- package/dist/types.js +0 -34
- package/src/plugins/AuthPlugin.js +0 -21
- package/src/plugins/Cache.js +0 -11
- package/src/plugins/DefaultBackend.js +0 -149
- package/src/plugins/ExpressPlugin.js +0 -39
- package/src/plugins/PublishPlugin.js +0 -69
- package/src/plugins/SslPlugin.js +0 -66
- package/src/plugins/StaticPlugin.js +0 -48
- package/src/plugins/WebsitePlugin.js +0 -207
- package/src/ts/client/grapesjs/publish.ts +0 -403
- package/src/ts/client/grapesjs/template.ts +0 -183
- /package/.silex/default/{.silex.data.json → website.json} +0 -0
package/.silex.js
CHANGED
|
@@ -1,11 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
/*
|
|
2
|
+
* Silex website builder, free/libre no-code tool for makers.
|
|
3
|
+
* Copyright (c) 2023 lexoyo and Silex Labs foundation
|
|
4
|
+
*
|
|
5
|
+
* This program is free software: you can redistribute it and/or modify
|
|
6
|
+
* it under the terms of the GNU Affero General Public License as published by
|
|
7
|
+
* the Free Software Foundation, either version 3 of the License, or any later version.
|
|
8
|
+
*
|
|
9
|
+
* This program is distributed in the hope that it will be useful,
|
|
10
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12
|
+
* GNU Affero General Public License for more details.
|
|
13
|
+
*
|
|
14
|
+
* You should have received a copy of the GNU Affero General Public License
|
|
15
|
+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
const SslPlugin = require('./dist/plugins/server/plugins/server/SslPlugin').default
|
|
19
|
+
const StaticPlugin = require('./dist/plugins/server/plugins/server/StaticPlugin').default
|
|
20
|
+
|
|
21
|
+
module.exports = async function(config, options) {
|
|
22
|
+
try {
|
|
23
|
+
await config.addPlugin([
|
|
24
|
+
SslPlugin,
|
|
25
|
+
StaticPlugin,
|
|
26
|
+
])
|
|
27
|
+
} catch(e) {
|
|
28
|
+
console.error(e)
|
|
29
|
+
}
|
|
9
30
|
|
|
10
31
|
// Return an object to be merged with Silex config
|
|
11
32
|
return {}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { ConnectorId, JobId, PublicationJobData, WebsiteId, ConnectorData, ConnectorType, WebsiteData, ClientSideFile, PublicationData, ConnectorUser, WebsiteMeta, WebsiteMetaFileContent, ConnectorOptions } from '../types';
|
|
2
|
+
export declare enum ApiRoute {
|
|
3
|
+
PUBLICATION_PUBLISH = "/api/publication/",
|
|
4
|
+
PUBLICATION_STATUS = "/api/publication/publication/status",
|
|
5
|
+
CONNECTOR_USER = "/api/connector/user",
|
|
6
|
+
CONNECTOR_LOGOUT = "/api/connector/logout",
|
|
7
|
+
CONNECTOR_LIST = "/api/connector/",
|
|
8
|
+
WEBSITE_READ = "/api/website/",
|
|
9
|
+
WEBSITE_WRITE = "/api/website/",
|
|
10
|
+
WEBSITE_DELETE = "/api/website/",
|
|
11
|
+
WEBSITE_CREATE = "/api/website/",
|
|
12
|
+
WEBSITE_LIST = "/api/website/",
|
|
13
|
+
WEBSITE_ASSETS_READ = "/api/websiteassets/:path",
|
|
14
|
+
WEBSITE_ASSETS_WRITE = "/api/websiteassets",
|
|
15
|
+
WEBSITE_META_READ = "/api/website/meta",
|
|
16
|
+
WEBSITE_META_WRITE = "/api/website/meta"
|
|
17
|
+
}
|
|
18
|
+
export declare class ApiError extends Error {
|
|
19
|
+
readonly code: number;
|
|
20
|
+
constructor(message: string, code: number);
|
|
21
|
+
}
|
|
22
|
+
export declare function getUser({ type, connectorId }: {
|
|
23
|
+
type: ConnectorType;
|
|
24
|
+
connectorId?: ConnectorId;
|
|
25
|
+
}): Promise<ConnectorUser>;
|
|
26
|
+
export declare function logout({ type, connectorId }: {
|
|
27
|
+
type: ConnectorType;
|
|
28
|
+
connectorId?: ConnectorId;
|
|
29
|
+
}): Promise<void>;
|
|
30
|
+
export declare function publish({ websiteId, hostingId, storageId, data, options }: {
|
|
31
|
+
websiteId: WebsiteId;
|
|
32
|
+
hostingId: ConnectorId;
|
|
33
|
+
storageId: ConnectorId;
|
|
34
|
+
data: PublicationData;
|
|
35
|
+
options: ConnectorOptions;
|
|
36
|
+
}): Promise<[url: string, job: PublicationJobData]>;
|
|
37
|
+
export declare function publicationStatus({ jobId }: {
|
|
38
|
+
jobId: JobId;
|
|
39
|
+
}): Promise<PublicationJobData>;
|
|
40
|
+
export declare function connectorList({ type }: {
|
|
41
|
+
type: ConnectorType;
|
|
42
|
+
}): Promise<ConnectorData[]>;
|
|
43
|
+
export declare function websiteList({ connectorId }: {
|
|
44
|
+
connectorId?: ConnectorId;
|
|
45
|
+
}): Promise<WebsiteMeta[]>;
|
|
46
|
+
export declare function websiteLoad({ websiteId, connectorId }: {
|
|
47
|
+
websiteId: WebsiteId;
|
|
48
|
+
connectorId?: ConnectorId;
|
|
49
|
+
}): Promise<WebsiteData>;
|
|
50
|
+
export declare function websiteSave({ websiteId, data, connectorId }: {
|
|
51
|
+
websiteId: WebsiteId;
|
|
52
|
+
data: WebsiteData;
|
|
53
|
+
connectorId?: ConnectorId;
|
|
54
|
+
}): Promise<void>;
|
|
55
|
+
export declare function websiteDelete({ websiteId, connectorId }: {
|
|
56
|
+
websiteId: WebsiteId;
|
|
57
|
+
connectorId?: ConnectorId;
|
|
58
|
+
}): Promise<void>;
|
|
59
|
+
export declare function websiteCreate({ websiteId, data, connectorId }: {
|
|
60
|
+
websiteId: WebsiteId;
|
|
61
|
+
data: WebsiteMetaFileContent;
|
|
62
|
+
connectorId?: ConnectorId;
|
|
63
|
+
}): Promise<void>;
|
|
64
|
+
export declare function websiteMetaWrite({ websiteId, data, connectorId }: {
|
|
65
|
+
websiteId: WebsiteId;
|
|
66
|
+
data: WebsiteMetaFileContent;
|
|
67
|
+
connectorId?: ConnectorId;
|
|
68
|
+
}): Promise<void>;
|
|
69
|
+
export declare function websiteMetaRead({ websiteId, connectorId }: {
|
|
70
|
+
websiteId: WebsiteId;
|
|
71
|
+
connectorId?: ConnectorId;
|
|
72
|
+
}): Promise<void>;
|
|
73
|
+
export declare function websiteAssetsLoad({ path, websiteId, connectorId }: {
|
|
74
|
+
path: string;
|
|
75
|
+
websiteId: WebsiteId;
|
|
76
|
+
connectorId: ConnectorId;
|
|
77
|
+
}): Promise<string>;
|
|
78
|
+
export declare function websiteAssetsSave({ websiteId, connectorId, files }: {
|
|
79
|
+
websiteId: WebsiteId;
|
|
80
|
+
connectorId: ConnectorId;
|
|
81
|
+
files: ClientSideFile[];
|
|
82
|
+
}): Promise<string[]>;
|
|
83
|
+
export declare function api<ReqQuery, ReqBody, ResBody>(route: ApiRoute | string, method: string, query?: ReqQuery, payload?: ReqBody): Promise<ResBody>;
|
|
@@ -11,7 +11,7 @@ export declare class SilexConfig extends Config {
|
|
|
11
11
|
/**
|
|
12
12
|
* Grapesjs config
|
|
13
13
|
*/
|
|
14
|
-
|
|
14
|
+
grapesJsConfig: {
|
|
15
15
|
container: string;
|
|
16
16
|
height: string;
|
|
17
17
|
showOffsets: boolean;
|
|
@@ -29,23 +29,22 @@ export declare class SilexConfig extends Config {
|
|
|
29
29
|
autoload: boolean;
|
|
30
30
|
type: string;
|
|
31
31
|
options: {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
connector: {
|
|
33
|
+
id: string;
|
|
34
|
+
connectorId: string;
|
|
35
35
|
};
|
|
36
36
|
};
|
|
37
37
|
};
|
|
38
|
+
cssIcons: string;
|
|
38
39
|
plugins: any[];
|
|
39
40
|
pluginsOpts: {
|
|
40
|
-
[x: number]: {
|
|
41
|
+
[x: number]: import("./grapesjs/PublicationManager").PublicationManagerOptions | import("./grapesjs/LoginDialog").LoginDialogOptions | {
|
|
41
42
|
blocks: string[];
|
|
42
43
|
category: string;
|
|
43
44
|
panels?: undefined;
|
|
44
|
-
appendTo?: undefined;
|
|
45
|
-
rootUrl?: undefined;
|
|
46
|
-
id?: undefined;
|
|
47
45
|
cmdOpenNewPageDialog?: undefined;
|
|
48
46
|
cmdOpenSettings?: undefined;
|
|
47
|
+
appendTo?: undefined;
|
|
49
48
|
enableCount?: undefined;
|
|
50
49
|
enablePerformance?: undefined;
|
|
51
50
|
onError?: undefined;
|
|
@@ -125,26 +124,9 @@ export declare class SilexConfig extends Config {
|
|
|
125
124
|
})[];
|
|
126
125
|
blocks?: undefined;
|
|
127
126
|
category?: undefined;
|
|
128
|
-
appendTo?: undefined;
|
|
129
|
-
rootUrl?: undefined;
|
|
130
|
-
id?: undefined;
|
|
131
|
-
cmdOpenNewPageDialog?: undefined;
|
|
132
|
-
cmdOpenSettings?: undefined;
|
|
133
|
-
enableCount?: undefined;
|
|
134
|
-
enablePerformance?: undefined;
|
|
135
|
-
onError?: undefined;
|
|
136
|
-
blockLabel?: undefined;
|
|
137
|
-
blockCustomCode?: undefined;
|
|
138
|
-
api_key?: undefined;
|
|
139
|
-
} | {
|
|
140
|
-
appendTo: string;
|
|
141
|
-
rootUrl: string;
|
|
142
|
-
id: string;
|
|
143
|
-
blocks?: undefined;
|
|
144
|
-
category?: undefined;
|
|
145
|
-
panels?: undefined;
|
|
146
127
|
cmdOpenNewPageDialog?: undefined;
|
|
147
128
|
cmdOpenSettings?: undefined;
|
|
129
|
+
appendTo?: undefined;
|
|
148
130
|
enableCount?: undefined;
|
|
149
131
|
enablePerformance?: undefined;
|
|
150
132
|
onError?: undefined;
|
|
@@ -158,8 +140,6 @@ export declare class SilexConfig extends Config {
|
|
|
158
140
|
blocks?: undefined;
|
|
159
141
|
category?: undefined;
|
|
160
142
|
panels?: undefined;
|
|
161
|
-
rootUrl?: undefined;
|
|
162
|
-
id?: undefined;
|
|
163
143
|
enableCount?: undefined;
|
|
164
144
|
enablePerformance?: undefined;
|
|
165
145
|
onError?: undefined;
|
|
@@ -172,11 +152,9 @@ export declare class SilexConfig extends Config {
|
|
|
172
152
|
blocks?: undefined;
|
|
173
153
|
category?: undefined;
|
|
174
154
|
panels?: undefined;
|
|
175
|
-
appendTo?: undefined;
|
|
176
|
-
rootUrl?: undefined;
|
|
177
|
-
id?: undefined;
|
|
178
155
|
cmdOpenNewPageDialog?: undefined;
|
|
179
156
|
cmdOpenSettings?: undefined;
|
|
157
|
+
appendTo?: undefined;
|
|
180
158
|
onError?: undefined;
|
|
181
159
|
blockLabel?: undefined;
|
|
182
160
|
blockCustomCode?: undefined;
|
|
@@ -186,11 +164,9 @@ export declare class SilexConfig extends Config {
|
|
|
186
164
|
blocks?: undefined;
|
|
187
165
|
category?: undefined;
|
|
188
166
|
panels?: undefined;
|
|
189
|
-
appendTo?: undefined;
|
|
190
|
-
rootUrl?: undefined;
|
|
191
|
-
id?: undefined;
|
|
192
167
|
cmdOpenNewPageDialog?: undefined;
|
|
193
168
|
cmdOpenSettings?: undefined;
|
|
169
|
+
appendTo?: undefined;
|
|
194
170
|
enableCount?: undefined;
|
|
195
171
|
enablePerformance?: undefined;
|
|
196
172
|
blockLabel?: undefined;
|
|
@@ -204,11 +180,9 @@ export declare class SilexConfig extends Config {
|
|
|
204
180
|
blocks?: undefined;
|
|
205
181
|
category?: undefined;
|
|
206
182
|
panels?: undefined;
|
|
207
|
-
appendTo?: undefined;
|
|
208
|
-
rootUrl?: undefined;
|
|
209
|
-
id?: undefined;
|
|
210
183
|
cmdOpenNewPageDialog?: undefined;
|
|
211
184
|
cmdOpenSettings?: undefined;
|
|
185
|
+
appendTo?: undefined;
|
|
212
186
|
enableCount?: undefined;
|
|
213
187
|
enablePerformance?: undefined;
|
|
214
188
|
onError?: undefined;
|
|
@@ -218,8 +192,6 @@ export declare class SilexConfig extends Config {
|
|
|
218
192
|
blocks?: undefined;
|
|
219
193
|
category?: undefined;
|
|
220
194
|
panels?: undefined;
|
|
221
|
-
rootUrl?: undefined;
|
|
222
|
-
id?: undefined;
|
|
223
195
|
cmdOpenNewPageDialog?: undefined;
|
|
224
196
|
cmdOpenSettings?: undefined;
|
|
225
197
|
enableCount?: undefined;
|
|
@@ -233,11 +205,9 @@ export declare class SilexConfig extends Config {
|
|
|
233
205
|
blocks?: undefined;
|
|
234
206
|
category?: undefined;
|
|
235
207
|
panels?: undefined;
|
|
236
|
-
appendTo?: undefined;
|
|
237
|
-
rootUrl?: undefined;
|
|
238
|
-
id?: undefined;
|
|
239
208
|
cmdOpenNewPageDialog?: undefined;
|
|
240
209
|
cmdOpenSettings?: undefined;
|
|
210
|
+
appendTo?: undefined;
|
|
241
211
|
enableCount?: undefined;
|
|
242
212
|
enablePerformance?: undefined;
|
|
243
213
|
onError?: undefined;
|
|
@@ -1,3 +1,9 @@
|
|
|
1
1
|
export * from './index';
|
|
2
2
|
export * from './grapesjs/index';
|
|
3
3
|
export * from './config';
|
|
4
|
+
export * as constants from '../constants';
|
|
5
|
+
export * as utils from './utils';
|
|
6
|
+
export * as api from './api';
|
|
7
|
+
export * as events from '../events';
|
|
8
|
+
export * as page from '../page';
|
|
9
|
+
export * as types from '../types';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Editor } from 'grapesjs';
|
|
2
|
+
import { ConnectorId, ConnectorType, ConnectorUser } from '../../types';
|
|
3
|
+
import { WebsiteId } from '../../types';
|
|
4
|
+
export declare const cmdLogin = "silex:auth:login";
|
|
5
|
+
export declare const eventLoggingIn = "silex:auth:logging-in";
|
|
6
|
+
export declare const eventLoggedIn = "silex:auth:logged-in";
|
|
7
|
+
export declare const eventLoginFailed = "silex:auth:login-failed";
|
|
8
|
+
export declare const eventLoggedOut = "silex:auth:logged-out";
|
|
9
|
+
export interface LoginDialogOptions {
|
|
10
|
+
id: WebsiteId;
|
|
11
|
+
}
|
|
12
|
+
export declare function getCurrentUser(editor: Editor): Promise<ConnectorUser>;
|
|
13
|
+
export declare function updateUser(editor: Editor, type: ConnectorType, connectorId?: ConnectorId): Promise<ConnectorUser>;
|
|
14
|
+
export default function loginDialogPlugin(editor: any, opts: any): void;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { ConnectorData, PublicationJobData, PublicationSettings, WebsiteId, WebsiteSettings } from '../../types';
|
|
2
|
+
import { Editor } from 'grapesjs';
|
|
3
|
+
import { PublicationUi } from './PublicationUi';
|
|
4
|
+
/**
|
|
5
|
+
* @fileoverview Publication manager for Silex
|
|
6
|
+
* This plugin adds a publication feature to Silex
|
|
7
|
+
* It lets the user publish the website to a hosting service
|
|
8
|
+
* It can optionally display a button and a dialog
|
|
9
|
+
* Useful commands:
|
|
10
|
+
* - publish: starts the publication process and optionally open the dialog
|
|
11
|
+
* - publish-login: open the login dialog
|
|
12
|
+
* - publish-logout: logout from the hosting service and let the user choose a hosting service again
|
|
13
|
+
*/
|
|
14
|
+
export declare const cmdPublicationStart = "publish";
|
|
15
|
+
export declare const cmdPublicationLogin = "publish-login";
|
|
16
|
+
export declare const cmdPublicationLogout = "publish-logout";
|
|
17
|
+
export type PublishableEditor = Editor & {
|
|
18
|
+
PublicationManager: PublicationManager;
|
|
19
|
+
};
|
|
20
|
+
export declare enum PublicationStatus {
|
|
21
|
+
STATUS_NONE = "STATUS_NONE",
|
|
22
|
+
STATUS_PENDING = "STATUS_PENDING",
|
|
23
|
+
STATUS_ERROR = "STATUS_ERROR",
|
|
24
|
+
STATUS_SUCCESS = "STATUS_SUCCESS",
|
|
25
|
+
STATUS_LOGGED_OUT = "STATUS_AUTH_ERROR"
|
|
26
|
+
}
|
|
27
|
+
export type PublicationManagerOptions = {
|
|
28
|
+
appendTo?: string;
|
|
29
|
+
websiteId: WebsiteId;
|
|
30
|
+
};
|
|
31
|
+
export default function publishPlugin(editor: any, opts: any): void;
|
|
32
|
+
export declare class PublicationManager {
|
|
33
|
+
private editor;
|
|
34
|
+
/**
|
|
35
|
+
* Publication dialog
|
|
36
|
+
* This class is responsible for the UI
|
|
37
|
+
*/
|
|
38
|
+
dialog?: PublicationUi;
|
|
39
|
+
/**
|
|
40
|
+
* Publication settings
|
|
41
|
+
* This is the data which is stored in the website settings
|
|
42
|
+
*/
|
|
43
|
+
_settings: PublicationSettings;
|
|
44
|
+
get settings(): PublicationSettings;
|
|
45
|
+
set settings(newSettings: PublicationSettings);
|
|
46
|
+
/**
|
|
47
|
+
* Plugin options
|
|
48
|
+
* This is the data which is passed to the plugin by grapesjs
|
|
49
|
+
*/
|
|
50
|
+
options: PublicationManagerOptions;
|
|
51
|
+
/**
|
|
52
|
+
* Publication job during the publication process
|
|
53
|
+
*/
|
|
54
|
+
job: PublicationJobData | null;
|
|
55
|
+
/**
|
|
56
|
+
* Publication state
|
|
57
|
+
* This is the state of the publication process
|
|
58
|
+
*/
|
|
59
|
+
status: PublicationStatus;
|
|
60
|
+
constructor(editor: PublishableEditor, opts: PublicationManagerOptions);
|
|
61
|
+
goLogin(connector: ConnectorData): Promise<unknown>;
|
|
62
|
+
goLogout(): Promise<void>;
|
|
63
|
+
/**
|
|
64
|
+
* Start the publication process
|
|
65
|
+
* This is the command "publish"
|
|
66
|
+
*/
|
|
67
|
+
startPublication(): Promise<void>;
|
|
68
|
+
getFiles(siteSettings: WebsiteSettings): Promise<{
|
|
69
|
+
html: string;
|
|
70
|
+
css: string;
|
|
71
|
+
cssPath: string;
|
|
72
|
+
htmlPath: string;
|
|
73
|
+
}[]>;
|
|
74
|
+
trackProgress(): Promise<void>;
|
|
75
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { TemplateResult } from 'lit-html';
|
|
2
|
+
import { PublicationStatus, PublishableEditor } from './PublicationManager';
|
|
3
|
+
import { PublicationJobData, PublicationSettings } from '../../types';
|
|
4
|
+
/**
|
|
5
|
+
* @fileoverview define the publication dialog
|
|
6
|
+
* This is the UI of the publication feature
|
|
7
|
+
* It is a dialog which allows the user to login to a connector and publish the website
|
|
8
|
+
* It also displays the publication status and logs during the publication process
|
|
9
|
+
* This class is used by the PublicationManager
|
|
10
|
+
* This is optional, you can use the PublicationManager without this UI
|
|
11
|
+
* @TODO Use publication events instead of calls from the PublicationManager
|
|
12
|
+
*/
|
|
13
|
+
export declare const cmdPublish = "publish-open-dialog";
|
|
14
|
+
export type PublicationDialogOptions = {
|
|
15
|
+
appendTo: string;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Class to manage the publication dialog
|
|
19
|
+
*/
|
|
20
|
+
export declare class PublicationUi {
|
|
21
|
+
private editor;
|
|
22
|
+
private options;
|
|
23
|
+
/**
|
|
24
|
+
* Dialog state
|
|
25
|
+
*/
|
|
26
|
+
isOpen: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Dialog content
|
|
29
|
+
*/
|
|
30
|
+
private errorMessage;
|
|
31
|
+
/**
|
|
32
|
+
* Dialog element
|
|
33
|
+
* This is the DOM element of the dialog
|
|
34
|
+
*/
|
|
35
|
+
private el;
|
|
36
|
+
settings: PublicationSettings;
|
|
37
|
+
/**
|
|
38
|
+
* Initialize the dialog and the publish button
|
|
39
|
+
*/
|
|
40
|
+
constructor(editor: PublishableEditor, options: PublicationDialogOptions);
|
|
41
|
+
isSuccess(status: PublicationStatus): boolean;
|
|
42
|
+
isPending(status: PublicationStatus): boolean;
|
|
43
|
+
isError(status: PublicationStatus): boolean;
|
|
44
|
+
isLoggedOut(status: PublicationStatus): boolean;
|
|
45
|
+
isReady(status: PublicationStatus): boolean;
|
|
46
|
+
getDialogElements(): {
|
|
47
|
+
el: HTMLElement;
|
|
48
|
+
primary: HTMLElement;
|
|
49
|
+
secondary: HTMLElement;
|
|
50
|
+
};
|
|
51
|
+
createDialogElements(): HTMLElement;
|
|
52
|
+
move(rect: any): void;
|
|
53
|
+
private renderDialog;
|
|
54
|
+
renderOpenDialog(job: PublicationJobData, status: PublicationStatus): Promise<TemplateResult>;
|
|
55
|
+
renderLoginDialog(status: PublicationStatus): Promise<TemplateResult>;
|
|
56
|
+
displayPending(job: PublicationJobData, status: PublicationStatus): void;
|
|
57
|
+
displayError(message: string, job: PublicationJobData, status: PublicationStatus): void;
|
|
58
|
+
closeDialog(): Promise<void>;
|
|
59
|
+
toggleDialog(): Promise<void>;
|
|
60
|
+
openDialog(): Promise<void>;
|
|
61
|
+
}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
import { Editor } from 'grapesjs';
|
|
2
|
+
import { LoginDialogOptions } from './LoginDialog';
|
|
3
|
+
import { PublicationManagerOptions } from './PublicationManager';
|
|
4
|
+
import { ConnectorId, WebsiteId } from '../../types';
|
|
5
|
+
export declare function getEditorConfig(id: WebsiteId, connectorId: ConnectorId, rootUrl: string): {
|
|
2
6
|
container: string;
|
|
3
7
|
height: string;
|
|
4
8
|
showOffsets: boolean;
|
|
@@ -16,23 +20,22 @@ export declare function getEditorConfig(id: string, rootUrl: string): {
|
|
|
16
20
|
autoload: boolean;
|
|
17
21
|
type: string;
|
|
18
22
|
options: {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
23
|
+
connector: {
|
|
24
|
+
id: string;
|
|
25
|
+
connectorId: string;
|
|
22
26
|
};
|
|
23
27
|
};
|
|
24
28
|
};
|
|
29
|
+
cssIcons: string;
|
|
25
30
|
plugins: any[];
|
|
26
31
|
pluginsOpts: {
|
|
27
|
-
[x: number]: {
|
|
32
|
+
[x: number]: PublicationManagerOptions | LoginDialogOptions | {
|
|
28
33
|
blocks: string[];
|
|
29
34
|
category: string;
|
|
30
35
|
panels?: undefined;
|
|
31
|
-
appendTo?: undefined;
|
|
32
|
-
rootUrl?: undefined;
|
|
33
|
-
id?: undefined;
|
|
34
36
|
cmdOpenNewPageDialog?: undefined;
|
|
35
37
|
cmdOpenSettings?: undefined;
|
|
38
|
+
appendTo?: undefined;
|
|
36
39
|
enableCount?: undefined;
|
|
37
40
|
enablePerformance?: undefined;
|
|
38
41
|
onError?: undefined;
|
|
@@ -112,26 +115,9 @@ export declare function getEditorConfig(id: string, rootUrl: string): {
|
|
|
112
115
|
})[];
|
|
113
116
|
blocks?: undefined;
|
|
114
117
|
category?: undefined;
|
|
115
|
-
appendTo?: undefined;
|
|
116
|
-
rootUrl?: undefined;
|
|
117
|
-
id?: undefined;
|
|
118
|
-
cmdOpenNewPageDialog?: undefined;
|
|
119
|
-
cmdOpenSettings?: undefined;
|
|
120
|
-
enableCount?: undefined;
|
|
121
|
-
enablePerformance?: undefined;
|
|
122
|
-
onError?: undefined;
|
|
123
|
-
blockLabel?: undefined;
|
|
124
|
-
blockCustomCode?: undefined;
|
|
125
|
-
api_key?: undefined;
|
|
126
|
-
} | {
|
|
127
|
-
appendTo: string;
|
|
128
|
-
rootUrl: string;
|
|
129
|
-
id: string;
|
|
130
|
-
blocks?: undefined;
|
|
131
|
-
category?: undefined;
|
|
132
|
-
panels?: undefined;
|
|
133
118
|
cmdOpenNewPageDialog?: undefined;
|
|
134
119
|
cmdOpenSettings?: undefined;
|
|
120
|
+
appendTo?: undefined;
|
|
135
121
|
enableCount?: undefined;
|
|
136
122
|
enablePerformance?: undefined;
|
|
137
123
|
onError?: undefined;
|
|
@@ -145,8 +131,6 @@ export declare function getEditorConfig(id: string, rootUrl: string): {
|
|
|
145
131
|
blocks?: undefined;
|
|
146
132
|
category?: undefined;
|
|
147
133
|
panels?: undefined;
|
|
148
|
-
rootUrl?: undefined;
|
|
149
|
-
id?: undefined;
|
|
150
134
|
enableCount?: undefined;
|
|
151
135
|
enablePerformance?: undefined;
|
|
152
136
|
onError?: undefined;
|
|
@@ -159,11 +143,9 @@ export declare function getEditorConfig(id: string, rootUrl: string): {
|
|
|
159
143
|
blocks?: undefined;
|
|
160
144
|
category?: undefined;
|
|
161
145
|
panels?: undefined;
|
|
162
|
-
appendTo?: undefined;
|
|
163
|
-
rootUrl?: undefined;
|
|
164
|
-
id?: undefined;
|
|
165
146
|
cmdOpenNewPageDialog?: undefined;
|
|
166
147
|
cmdOpenSettings?: undefined;
|
|
148
|
+
appendTo?: undefined;
|
|
167
149
|
onError?: undefined;
|
|
168
150
|
blockLabel?: undefined;
|
|
169
151
|
blockCustomCode?: undefined;
|
|
@@ -173,11 +155,9 @@ export declare function getEditorConfig(id: string, rootUrl: string): {
|
|
|
173
155
|
blocks?: undefined;
|
|
174
156
|
category?: undefined;
|
|
175
157
|
panels?: undefined;
|
|
176
|
-
appendTo?: undefined;
|
|
177
|
-
rootUrl?: undefined;
|
|
178
|
-
id?: undefined;
|
|
179
158
|
cmdOpenNewPageDialog?: undefined;
|
|
180
159
|
cmdOpenSettings?: undefined;
|
|
160
|
+
appendTo?: undefined;
|
|
181
161
|
enableCount?: undefined;
|
|
182
162
|
enablePerformance?: undefined;
|
|
183
163
|
blockLabel?: undefined;
|
|
@@ -191,11 +171,9 @@ export declare function getEditorConfig(id: string, rootUrl: string): {
|
|
|
191
171
|
blocks?: undefined;
|
|
192
172
|
category?: undefined;
|
|
193
173
|
panels?: undefined;
|
|
194
|
-
appendTo?: undefined;
|
|
195
|
-
rootUrl?: undefined;
|
|
196
|
-
id?: undefined;
|
|
197
174
|
cmdOpenNewPageDialog?: undefined;
|
|
198
175
|
cmdOpenSettings?: undefined;
|
|
176
|
+
appendTo?: undefined;
|
|
199
177
|
enableCount?: undefined;
|
|
200
178
|
enablePerformance?: undefined;
|
|
201
179
|
onError?: undefined;
|
|
@@ -205,8 +183,6 @@ export declare function getEditorConfig(id: string, rootUrl: string): {
|
|
|
205
183
|
blocks?: undefined;
|
|
206
184
|
category?: undefined;
|
|
207
185
|
panels?: undefined;
|
|
208
|
-
rootUrl?: undefined;
|
|
209
|
-
id?: undefined;
|
|
210
186
|
cmdOpenNewPageDialog?: undefined;
|
|
211
187
|
cmdOpenSettings?: undefined;
|
|
212
188
|
enableCount?: undefined;
|
|
@@ -220,11 +196,9 @@ export declare function getEditorConfig(id: string, rootUrl: string): {
|
|
|
220
196
|
blocks?: undefined;
|
|
221
197
|
category?: undefined;
|
|
222
198
|
panels?: undefined;
|
|
223
|
-
appendTo?: undefined;
|
|
224
|
-
rootUrl?: undefined;
|
|
225
|
-
id?: undefined;
|
|
226
199
|
cmdOpenNewPageDialog?: undefined;
|
|
227
200
|
cmdOpenSettings?: undefined;
|
|
201
|
+
appendTo?: undefined;
|
|
228
202
|
enableCount?: undefined;
|
|
229
203
|
enablePerformance?: undefined;
|
|
230
204
|
onError?: undefined;
|
|
@@ -233,5 +207,5 @@ export declare function getEditorConfig(id: string, rootUrl: string): {
|
|
|
233
207
|
};
|
|
234
208
|
};
|
|
235
209
|
};
|
|
236
|
-
export declare function initEditor(config: any, grapesJsPlugins: any):
|
|
237
|
-
export declare function getEditor():
|
|
210
|
+
export declare function initEditor(config: any, grapesJsPlugins: any): Promise<Editor>;
|
|
211
|
+
export declare function getEditor(): Editor;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const storagePlugin: (editor: any) => void;
|
|
@@ -1,4 +1,30 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @fileoverview define constants for Silex client and server
|
|
3
3
|
*/
|
|
4
|
+
export declare const WEBSITE_DATA_FILE = "website.json";
|
|
5
|
+
export declare const WEBSITE_META_DATA_FILE = "meta.json";
|
|
6
|
+
export declare const DEFAULT_WEBSITE_ID = "default";
|
|
7
|
+
export declare const DEFAULT_CONNECTOR_ID = "";
|
|
8
|
+
export declare const DEFAULT_LANGUAGE = "en";
|
|
4
9
|
export declare const CLIENT_CONFIG_FILE_NAME = "silex.js";
|
|
10
|
+
export declare const API_PATH = "/api";
|
|
11
|
+
export declare const API_CONNECTOR_PATH = "/connector";
|
|
12
|
+
export declare const API_CONNECTOR_USER = "/user";
|
|
13
|
+
export declare const API_CONNECTOR_LIST = "/";
|
|
14
|
+
export declare const API_CONNECTOR_LOGOUT = "/logout";
|
|
15
|
+
export declare const API_CONNECTOR_LOGIN = "/login";
|
|
16
|
+
export declare const API_CONNECTOR_SETTINGS = "/settings";
|
|
17
|
+
export declare const API_CONNECTOR_LOGIN_CALLBACK = "/login/callback";
|
|
18
|
+
export declare const API_PUBLICATION_PATH = "/publication";
|
|
19
|
+
export declare const API_PUBLICATION_PUBLISH = "/";
|
|
20
|
+
export declare const API_PUBLICATION_STATUS = "/publication/status";
|
|
21
|
+
export declare const API_WEBSITE_PATH = "/website";
|
|
22
|
+
export declare const API_WEBSITE_READ = "/";
|
|
23
|
+
export declare const API_WEBSITE_WRITE = "/";
|
|
24
|
+
export declare const API_WEBSITE_CREATE = "/";
|
|
25
|
+
export declare const API_WEBSITE_DELETE = "/";
|
|
26
|
+
export declare const API_WEBSITE_LIST = "/";
|
|
27
|
+
export declare const API_WEBSITE_ASSETS_READ = "assets/:path";
|
|
28
|
+
export declare const API_WEBSITE_ASSETS_WRITE = "assets";
|
|
29
|
+
export declare const API_WEBSITE_META_READ = "/meta";
|
|
30
|
+
export declare const API_WEBSITE_META_WRITE = "/meta";
|