@silexlabs/silex 3.0.0-alpha.42 → 3.0.0-alpha.44
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/client/client/api.d.ts +6 -6
- package/dist/client/client/config.d.ts +26 -211
- package/dist/client/client/events.d.ts +14 -0
- package/dist/client/client/expose.d.ts +1 -2
- package/dist/client/client/grapesjs/LoginDialog.d.ts +1 -0
- package/dist/client/client/grapesjs/index.d.ts +3 -209
- package/dist/client/client/index.d.ts +1 -0
- package/dist/client/constants.d.ts +2 -3
- package/dist/client/css/admin.css +7 -0
- package/dist/client/js/main.js +51 -51
- package/dist/client/types.d.ts +7 -1
- package/dist/plugins/client/client/events.d.ts +14 -0
- package/dist/plugins/client/client/events.js +32 -0
- package/dist/plugins/client/client/events.js.map +1 -0
- package/dist/plugins/client/page.d.ts +2 -0
- package/dist/plugins/client/{events.js → page.js} +15 -11
- package/dist/plugins/client/page.js.map +1 -0
- package/dist/plugins/client/plugins/client/publicationRenderer.d.ts +2 -0
- package/dist/plugins/client/plugins/client/publicationRenderer.js +128 -0
- package/dist/plugins/client/plugins/client/publicationRenderer.js.map +1 -0
- package/dist/plugins/client/plugins/client/template.js +4 -4
- package/dist/plugins/client/plugins/client/template.js.map +1 -1
- package/dist/plugins/client/types.d.ts +315 -0
- package/dist/plugins/client/types.js +57 -0
- package/dist/plugins/client/types.js.map +1 -0
- package/dist/plugins/server/constants.d.ts +2 -3
- package/dist/plugins/server/constants.js +3 -4
- package/dist/plugins/server/constants.js.map +1 -1
- package/dist/plugins/server/plugins/server/FtpConnector.d.ts +17 -28
- package/dist/plugins/server/plugins/server/FtpConnector.js +17 -16
- package/dist/plugins/server/plugins/server/FtpConnector.js.map +1 -1
- package/dist/plugins/server/plugins/server/GitlabConnector.d.ts +81 -0
- package/dist/plugins/server/plugins/server/GitlabConnector.js +373 -0
- package/dist/plugins/server/plugins/server/GitlabConnector.js.map +1 -0
- package/dist/plugins/server/plugins/server/HooksPlugin.js +8 -8
- package/dist/plugins/server/plugins/server/HooksPlugin.js.map +1 -1
- package/dist/plugins/server/plugins/server/PublicationOptimizer.d.ts +0 -0
- package/dist/plugins/server/plugins/server/PublicationOptimizer.js +14 -0
- package/dist/plugins/server/plugins/server/PublicationOptimizer.js.map +1 -0
- package/dist/plugins/server/plugins/server/SslPlugin.js +2 -2
- package/dist/plugins/server/plugins/server/SslPlugin.js.map +1 -1
- package/dist/plugins/server/plugins/server/StaticPlugin.js +2 -2
- package/dist/plugins/server/plugins/server/StaticPlugin.js.map +1 -1
- package/dist/plugins/server/server/config.d.ts +18 -18
- package/dist/plugins/server/server/config.js +79 -81
- package/dist/plugins/server/server/config.js.map +1 -1
- package/dist/plugins/server/server/connectors/FsStorage.d.ts +13 -11
- package/dist/plugins/server/server/connectors/FsStorage.js +31 -14
- package/dist/plugins/server/server/connectors/FsStorage.js.map +1 -1
- package/dist/plugins/server/server/connectors/connectors.d.ts +5 -2
- package/dist/plugins/server/server/connectors/connectors.js +32 -3
- package/dist/plugins/server/server/connectors/connectors.js.map +1 -1
- package/dist/plugins/server/server/events.d.ts +26 -0
- package/dist/plugins/server/server/events.js +15 -0
- package/dist/plugins/server/server/events.js.map +1 -0
- package/dist/plugins/server/types.d.ts +7 -1
- package/dist/plugins/server/types.js +10 -1
- package/dist/plugins/server/types.js.map +1 -1
- package/dist/server/constants.js +3 -4
- package/dist/server/server/api/connectorApi.js +16 -11
- package/dist/server/server/api/publicationApi.js +26 -28
- package/dist/server/server/api/websiteApi.js +46 -41
- package/dist/server/server/cli.js +36 -18
- package/dist/server/server/config.js +63 -66
- package/dist/server/server/connectors/FsStorage.js +28 -14
- package/dist/server/server/connectors/connectors.js +27 -3
- package/dist/server/server/events.js +14 -0
- package/dist/server/server/expose.js +27 -0
- package/dist/server/server/express.js +3 -3
- package/dist/server/server/index.js +34 -4
- package/dist/server/types.js +10 -1
- package/package.json +6 -3
- package/src/css/_variables.scss +1 -0
- package/src/css/grapesjs.scss +5 -0
- package/src/css/loader.scss +2 -0
- package/src/ts/client/api.ts +8 -11
- package/src/ts/client/config.ts +30 -14
- package/src/ts/client/events.ts +31 -0
- package/src/ts/client/expose.ts +1 -2
- package/src/ts/client/grapesjs/LoginDialog.ts +12 -1
- package/src/ts/client/grapesjs/PublicationManager.ts +10 -10
- package/src/ts/client/grapesjs/eleventy.ts +2 -2
- package/src/ts/client/grapesjs/index.ts +8 -13
- package/src/ts/client/grapesjs/storage.ts +18 -10
- package/src/ts/client/index.ts +35 -16
- package/src/ts/constants.ts +2 -3
- package/src/ts/plugins/client/publicationRenderer.ts +128 -0
- package/src/ts/plugins/client/template.ts +4 -4
- package/src/ts/plugins/server/FtpConnector.test.ts +82 -0
- package/src/ts/plugins/server/FtpConnector.ts +31 -37
- package/src/ts/plugins/server/GitlabConnector.ts +434 -0
- package/src/ts/plugins/server/HooksPlugin.ts +8 -9
- package/src/ts/plugins/server/PublicationOptimizer.ts +14 -0
- package/src/ts/plugins/server/SslPlugin.ts +2 -2
- package/src/ts/plugins/server/StaticPlugin.ts +2 -2
- package/src/ts/server/api/connectorApi.ts +32 -27
- package/src/ts/server/api/publicationApi.ts +35 -48
- package/src/ts/server/api/websiteApi.ts +67 -45
- package/src/ts/server/cli.ts +25 -13
- package/src/ts/server/config.ts +80 -79
- package/src/ts/server/connectors/FsStorage.test.ts +51 -0
- package/src/ts/server/connectors/FsStorage.ts +45 -24
- package/src/ts/server/connectors/connectors.ts +35 -5
- package/src/ts/server/events.ts +20 -0
- package/src/ts/{events.ts → server/expose.ts} +2 -10
- package/src/ts/server/express.ts +3 -3
- package/src/ts/server/index.ts +36 -10
- package/src/ts/types.ts +10 -1
- package/.silex/default/website.json +0 -1
- package/dist/client/events.d.ts +0 -10
- package/dist/plugins/client/events.d.ts +0 -10
- package/dist/plugins/client/events.js.map +0 -1
- package/dist/plugins/server/events.d.ts +0 -10
- package/dist/plugins/server/events.js +0 -30
- package/dist/plugins/server/events.js.map +0 -1
- package/dist/server/events.js +0 -13
package/dist/client/types.d.ts
CHANGED
|
@@ -13,7 +13,11 @@ export interface WebsiteFile {
|
|
|
13
13
|
htmlPath: string;
|
|
14
14
|
cssPath: string;
|
|
15
15
|
}
|
|
16
|
-
export
|
|
16
|
+
export declare class ApiError extends Error {
|
|
17
|
+
readonly httpStatusCode: number;
|
|
18
|
+
constructor(message: string, httpStatusCode: number);
|
|
19
|
+
}
|
|
20
|
+
export type ApiResponseError = {
|
|
17
21
|
message: string;
|
|
18
22
|
};
|
|
19
23
|
export type ApiPublicationPublishBody = WebsiteData;
|
|
@@ -252,6 +256,8 @@ export interface ConnectorData {
|
|
|
252
256
|
disableLogout: boolean;
|
|
253
257
|
isLoggedIn: boolean;
|
|
254
258
|
oauthUrl: string | null;
|
|
259
|
+
color: string;
|
|
260
|
+
background: string;
|
|
255
261
|
}
|
|
256
262
|
/**
|
|
257
263
|
* User settings for a connector and for a given website
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare enum ClientEvent {
|
|
2
|
+
STARTUP_START = "silex:startup:start",
|
|
3
|
+
STARTUP_END = "silex:startup:end",
|
|
4
|
+
GRAPESJS_START = "silex:grapesjs:start",
|
|
5
|
+
GRAPESJS_END = "silex:grapesjs:end",
|
|
6
|
+
PUBLISH_START = "silex:publish:start",
|
|
7
|
+
PUBLISH_DATA = "silex:publish:data",
|
|
8
|
+
PUBLISH_END = "silex:publish:end",
|
|
9
|
+
PUBLISH_ERROR = "silex:publish:error",
|
|
10
|
+
PUBLISH_LOGIN_START = "silex:publish:login:start",
|
|
11
|
+
PUBLISH_LOGIN_END = "silex:publish:login:end",
|
|
12
|
+
ASSET_WRITE_END = "silex:asset:write:end",
|
|
13
|
+
WRITE_END = "silex:write:end"
|
|
14
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
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
|
+
export var ClientEvent;
|
|
18
|
+
(function (ClientEvent) {
|
|
19
|
+
ClientEvent["STARTUP_START"] = "silex:startup:start";
|
|
20
|
+
ClientEvent["STARTUP_END"] = "silex:startup:end";
|
|
21
|
+
ClientEvent["GRAPESJS_START"] = "silex:grapesjs:start";
|
|
22
|
+
ClientEvent["GRAPESJS_END"] = "silex:grapesjs:end";
|
|
23
|
+
ClientEvent["PUBLISH_START"] = "silex:publish:start";
|
|
24
|
+
ClientEvent["PUBLISH_DATA"] = "silex:publish:data";
|
|
25
|
+
ClientEvent["PUBLISH_END"] = "silex:publish:end";
|
|
26
|
+
ClientEvent["PUBLISH_ERROR"] = "silex:publish:error";
|
|
27
|
+
ClientEvent["PUBLISH_LOGIN_START"] = "silex:publish:login:start";
|
|
28
|
+
ClientEvent["PUBLISH_LOGIN_END"] = "silex:publish:login:end";
|
|
29
|
+
ClientEvent["ASSET_WRITE_END"] = "silex:asset:write:end";
|
|
30
|
+
ClientEvent["WRITE_END"] = "silex:write:end";
|
|
31
|
+
})(ClientEvent || (ClientEvent = {}));
|
|
32
|
+
//# sourceMappingURL=events.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events.js","sourceRoot":"","sources":["../../../../src/ts/client/events.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,MAAM,CAAN,IAAY,WAaX;AAbD,WAAY,WAAW;IACrB,oDAAqC,CAAA;IACrC,gDAAiC,CAAA;IACjC,sDAAuC,CAAA;IACvC,kDAAmC,CAAA;IACnC,oDAAqC,CAAA;IACrC,kDAAmC,CAAA;IACnC,gDAAiC,CAAA;IACjC,oDAAqC,CAAA;IACrC,gEAAiD,CAAA;IACjD,4DAA6C,CAAA;IAC7C,wDAAyC,CAAA;IACzC,4CAA6B,CAAA;AAC/B,CAAC,EAbW,WAAW,KAAX,WAAW,QAatB"}
|
|
@@ -14,14 +14,18 @@
|
|
|
14
14
|
* You should have received a copy of the GNU Affero General Public License
|
|
15
15
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
16
16
|
*/
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
export
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
17
|
+
// Page related functions
|
|
18
|
+
// This is used on the client and the server
|
|
19
|
+
export function getPageSlug(pageName) {
|
|
20
|
+
return pageName
|
|
21
|
+
.toLowerCase()
|
|
22
|
+
.replace(/[^a-z0-9 -]/g, '')
|
|
23
|
+
// Collapse whitespace and replace by -
|
|
24
|
+
.replace(/\s+/g, '-')
|
|
25
|
+
// Collapse dashes
|
|
26
|
+
.replace(/-+/g, '-');
|
|
27
|
+
}
|
|
28
|
+
export function getPageLink(pageName = 'index') {
|
|
29
|
+
return `./${getPageSlug(pageName)}.html`;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=page.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"page.js","sourceRoot":"","sources":["../../../src/ts/page.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,yBAAyB;AACzB,4CAA4C;AAC5C,MAAM,UAAU,WAAW,CAAC,QAAQ;IAClC,OAAO,QAAQ;SACZ,WAAW,EAAE;SACb,OAAO,CAAC,cAAc,EAAE,EAAE,CAAC;QAC5B,uCAAuC;SACtC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC;QACrB,kBAAkB;SACjB,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAA;AACxB,CAAC;AACD,MAAM,UAAU,WAAW,CAAC,QAAQ,GAAG,OAAO;IAC5C,OAAO,KAAK,WAAW,CAAC,QAAQ,CAAC,OAAO,CAAA;AAC1C,CAAC"}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { getPageSlug } from '../../page.js';
|
|
2
|
+
import { onAll } from '../../client/utils.js';
|
|
3
|
+
import { ClientEvent } from '../../client/events.js';
|
|
4
|
+
export default (config, opts = {}) => {
|
|
5
|
+
const options = {
|
|
6
|
+
autoHomePage: false,
|
|
7
|
+
...opts,
|
|
8
|
+
html: {
|
|
9
|
+
frontMatter: false,
|
|
10
|
+
ext: '.html',
|
|
11
|
+
url: '/',
|
|
12
|
+
path: './',
|
|
13
|
+
...opts.html,
|
|
14
|
+
},
|
|
15
|
+
css: {
|
|
16
|
+
frontMatter: false,
|
|
17
|
+
ext: '.css',
|
|
18
|
+
url: '/css',
|
|
19
|
+
path: './css',
|
|
20
|
+
...opts.css,
|
|
21
|
+
},
|
|
22
|
+
assets: {
|
|
23
|
+
url: '/',
|
|
24
|
+
path: './',
|
|
25
|
+
...opts.assets,
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
config.on(ClientEvent.STARTUP_END, ({ editor }) => {
|
|
29
|
+
editor.on(ClientEvent.PUBLISH_START, () => {
|
|
30
|
+
// Update assets URL to display outside the editor
|
|
31
|
+
const assetsFolderUrl = options.assets.url;
|
|
32
|
+
if (assetsFolderUrl) {
|
|
33
|
+
// Concat the paths, handles the trailing and leading slashes
|
|
34
|
+
const publishedUrl = path => `${assetsFolderUrl.replace(/\/+$/, '')}/${path.replace(/^\/+/, '')}`;
|
|
35
|
+
// New URLs for assets, according to site config
|
|
36
|
+
onAll(editor, c => {
|
|
37
|
+
// Attributes
|
|
38
|
+
if (c.get('type') === 'image') {
|
|
39
|
+
const src = c.get('src');
|
|
40
|
+
c.set('tmp-src', src);
|
|
41
|
+
c.set('src', publishedUrl(src));
|
|
42
|
+
}
|
|
43
|
+
//// Inline styles
|
|
44
|
+
//// This is handled by the editor.Css.getAll loop
|
|
45
|
+
//const bgUrl = c.getStyle()['background-image']?.match(/url\('(.*)'\)/)?.pop()
|
|
46
|
+
//if(bgUrl) {
|
|
47
|
+
// c.set('tmp-bg-url', bgUrl)
|
|
48
|
+
// c.setStyle({
|
|
49
|
+
// ...c.getStyle(),
|
|
50
|
+
// 'background-image': `url('${publishedUrl(bgUrl)}')`,
|
|
51
|
+
// })
|
|
52
|
+
//}
|
|
53
|
+
});
|
|
54
|
+
editor.Css.getAll()
|
|
55
|
+
.forEach(c => {
|
|
56
|
+
const bgUrl = c.getStyle()['background-image']?.match(/url\('(.*)'\)/)?.pop();
|
|
57
|
+
if (bgUrl) {
|
|
58
|
+
c.setStyle({
|
|
59
|
+
...c.getStyle(),
|
|
60
|
+
'background-image': `url('${publishedUrl(bgUrl)}')`,
|
|
61
|
+
});
|
|
62
|
+
c.set('tmp-bg-url-css', bgUrl);
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
editor.Pages.getAll().forEach(page => {
|
|
67
|
+
if (page.get('type') === 'main' && options?.autoHomePage) {
|
|
68
|
+
page.set('slug', 'index');
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
page.set('slug', getPageSlug(page.get('name') || page.get('type')));
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
editor.on(ClientEvent.PUBLISH_END, () => {
|
|
76
|
+
const assetsFolderUrl = options.assets.url;
|
|
77
|
+
// Reset asset URLs
|
|
78
|
+
if (assetsFolderUrl) {
|
|
79
|
+
onAll(editor, c => {
|
|
80
|
+
if (c.get('type') === 'image' && c.has('tmp-src')) {
|
|
81
|
+
c.set('src', c.get('tmp-src'));
|
|
82
|
+
c.set('tmp-src');
|
|
83
|
+
}
|
|
84
|
+
//// This is handled by the editor.Css.getAll loop
|
|
85
|
+
//if(c.getStyle()['background-image'] && c.has('tmp-bg-url')) {
|
|
86
|
+
// c.setStyle({
|
|
87
|
+
// ...c.getStyle(),
|
|
88
|
+
// 'background-image': `url('${c.get('tmp-bg-url')}')`,
|
|
89
|
+
// })
|
|
90
|
+
// c.set('tmp-bg-url')
|
|
91
|
+
//}
|
|
92
|
+
});
|
|
93
|
+
editor.Css.getAll()
|
|
94
|
+
.forEach(c => {
|
|
95
|
+
if (c.has('tmp-bg-url-css')) {
|
|
96
|
+
c.setStyle({
|
|
97
|
+
...c.getStyle(),
|
|
98
|
+
'background-image': `url('${c.get('tmp-bg-url-css')}')`,
|
|
99
|
+
});
|
|
100
|
+
c.set('tmp-bg-url-css');
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
editor.on(ClientEvent.PUBLISH_DATA, data => {
|
|
106
|
+
data.pages.forEach((page, idx) => {
|
|
107
|
+
const file = data.files[idx];
|
|
108
|
+
// CSS
|
|
109
|
+
file.cssPath = file.cssPath.replace(/\.css$/, options.css.ext);
|
|
110
|
+
file.cssPath = options.css.path + file.cssPath;
|
|
111
|
+
if (options.css.frontMatter) {
|
|
112
|
+
file.css = `---\npermalink: ${options.css.url}/${page.slug}.css\n---\n${file.css}`;
|
|
113
|
+
}
|
|
114
|
+
// HTML
|
|
115
|
+
file.htmlPath = file.htmlPath.replace(/\.html$/, options.html.ext);
|
|
116
|
+
file.htmlPath = options.html.path + file.htmlPath;
|
|
117
|
+
if (options.html.frontMatter) {
|
|
118
|
+
file.html = `---\npermalink: ${options.html.url}/${page.slug}.html\n---\n${file.html}`;
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
data.assets.forEach((asset, idx) => {
|
|
122
|
+
asset.path = options.assets.path + asset.src;
|
|
123
|
+
// The rest is handled by the editor.Css.getAll loop
|
|
124
|
+
});
|
|
125
|
+
});
|
|
126
|
+
});
|
|
127
|
+
};
|
|
128
|
+
//# sourceMappingURL=publicationRenderer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"publicationRenderer.js","sourceRoot":"","sources":["../../../../../src/ts/plugins/client/publicationRenderer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAE3C,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAA;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AAEpD,eAAe,CAAC,MAAM,EAAE,OAAY,EAAE,EAAE,EAAE;IACxC,MAAM,OAAO,GAAG;QACd,YAAY,EAAE,KAAK;QACnB,GAAG,IAAI;QACP,IAAI,EAAE;YACJ,WAAW,EAAE,KAAK;YAClB,GAAG,EAAE,OAAO;YACZ,GAAG,EAAE,GAAG;YACR,IAAI,EAAE,IAAI;YACV,GAAG,IAAI,CAAC,IAAI;SACb;QACD,GAAG,EAAE;YACH,WAAW,EAAE,KAAK;YAClB,GAAG,EAAE,MAAM;YACX,GAAG,EAAE,MAAM;YACX,IAAI,EAAE,OAAO;YACb,GAAG,IAAI,CAAC,GAAG;SACZ;QACD,MAAM,EAAE;YACN,GAAG,EAAE,GAAG;YACR,IAAI,EAAE,IAAI;YACV,GAAG,IAAI,CAAC,MAAM;SACf;KACF,CAAA;IACD,MAAM,CAAC,EAAE,CAAC,WAAW,CAAC,WAAW,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE;QAChD,MAAM,CAAC,EAAE,CAAC,WAAW,CAAC,aAAa,EAAE,GAAG,EAAE;YACxC,kDAAkD;YAClD,MAAM,eAAe,GAAG,OAAO,CAAC,MAAM,CAAC,GAAG,CAAA;YAC1C,IAAI,eAAe,EAAE;gBACnB,6DAA6D;gBAC7D,MAAM,YAAY,GAAG,I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AAA;YACF,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;gBACjC,KAAK,CAAC,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,IAAI,GAAG,KAAK,CAAC,GAAG,CAAA;gBAC5C,oDAAoD;YACtD,CAAC,CAAC,CAAA;QACJ,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAA"}
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
//import {styleMap} from 'lit-html/directives/style-map.js'
|
|
19
19
|
//import { onAll } from '@silexlabs/silex/dist/client/utils.js'
|
|
20
20
|
import { onAll } from '../../client/utils.js';
|
|
21
|
-
import {
|
|
21
|
+
import { ClientEvent } from '../../client/events.js';
|
|
22
22
|
//// @ts-ignore
|
|
23
23
|
//import {html, render} from '/node_modules/lit-html/lit-html.js'
|
|
24
24
|
//// @ts-ignore
|
|
@@ -32,7 +32,7 @@ export default async (config, opts = {}) => {
|
|
|
32
32
|
const { html, render } = await import('/node_modules/lit-html/lit-html.js');
|
|
33
33
|
// @ts-ignore
|
|
34
34
|
const { styleMap } = await import('/node_modules/lit-html/directives/style-map.js');
|
|
35
|
-
config.on(
|
|
35
|
+
config.on(ClientEvent.GRAPESJS_END, () => {
|
|
36
36
|
const editor = silex.getEditor();
|
|
37
37
|
// Add the new trait to all component types
|
|
38
38
|
editor.DomComponents.getTypes().map(type => {
|
|
@@ -149,7 +149,7 @@ export default async (config, opts = {}) => {
|
|
|
149
149
|
// put back together
|
|
150
150
|
.join('\n');
|
|
151
151
|
}
|
|
152
|
-
editor.on(
|
|
152
|
+
editor.on(ClientEvent.PUBLISH_START, () => {
|
|
153
153
|
// Insert templates
|
|
154
154
|
onAll(editor, c => {
|
|
155
155
|
const template = c.get(templateKey);
|
|
@@ -175,7 +175,7 @@ export default async (config, opts = {}) => {
|
|
|
175
175
|
};
|
|
176
176
|
});
|
|
177
177
|
});
|
|
178
|
-
editor.on(
|
|
178
|
+
editor.on(ClientEvent.PUBLISH_END, () => {
|
|
179
179
|
onAll(editor, c => {
|
|
180
180
|
// Restore the original method
|
|
181
181
|
c.toHTML = c.get('tmpHtml');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"template.js","sourceRoot":"","sources":["../../../../../src/ts/plugins/client/template.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,uCAAuC;AACvC,2DAA2D;AAC3D,+DAA+D;AAC/D,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAA;AAC7C,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"template.js","sourceRoot":"","sources":["../../../../../src/ts/plugins/client/template.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,uCAAuC;AACvC,2DAA2D;AAC3D,+DAA+D;AAC/D,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAA;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AAEpD,eAAe;AACf,iEAAiE;AACjE,eAAe;AACf,yEAAyE;AAEzE,MAAM,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,CAAA;AAE7B,MAAM,UAAU,GAAG,UAAU,CAAA;AAC7B,MAAM,YAAY,GAAG,cAAc,CAAA;AACnC,MAAM,WAAW,GAAG,UAAU,CAAA;AAE9B,eAAe,KAAK,EAAE,MAAM,EAAE,OAAY,EAAE,EAAE,EAAE;IAC9C,aAAa;IACb,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,MAAM,CAAC,oCAAoC,CAAC,CAAA;IAC3E,aAAa;IACb,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,MAAM,CAAC,gDAAgD,CAAC,CAAA;IAEnF,MAAM,CAAC,EAAE,CAAC,WAAW,CAAC,YAAY,EAAE,GAAG,EAAE;QACvC,MAAM,MAAM,GAAG,KAAK,CAAC,SAAS,EAAE,CAAA;QAChC,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OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,aAAa,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;cAC9F,OAAO,CAAC,MAAM,IAAI,SAAS,CAAC,CAAC,CAAC,UAAU,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,SAAS,GAAG,CAAC,CAAC,CAAC,EAAE;cAC9E,UAAU;cACV,KAAK,CAAC,CAAC,CAAC,UAAU,KAAK,GAAG,CAAC,CAAC,CAAC,EAAE;cAC/B,CAAC,CAAC,CAAC,EAAE,GAAG,OAAO,IAAI,CAAC,CAAC,YAAY,EACrC,GAAG,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,KACtD,EAAE,CAAA;gBACJ,CAAC,CAAA;YACH,CAAC,CAAC,CAAA;QACJ,CAAC,CAAC,CAAA;QACF,MAAM,CAAC,EAAE,CAAC,WAAW,CAAC,WAAW,EAAE,GAAG,EAAE;YACtC,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC,EAAE;gBAChB,8BAA8B;gBAC9B,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,CAAA;YAC7B,CAAC,CAAC,CAAA;QACJ,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAA"}
|
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview define types for Silex client and server
|
|
3
|
+
*/
|
|
4
|
+
export interface PublicationSettings {
|
|
5
|
+
connector?: ConnectorData;
|
|
6
|
+
options?: ConnectorOptions;
|
|
7
|
+
url?: string;
|
|
8
|
+
autoHomePage?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface WebsiteFile {
|
|
11
|
+
html: string;
|
|
12
|
+
css: string;
|
|
13
|
+
htmlPath: string;
|
|
14
|
+
cssPath: string;
|
|
15
|
+
}
|
|
16
|
+
export declare class ApiError extends Error {
|
|
17
|
+
readonly httpStatusCode: number;
|
|
18
|
+
constructor(message: string, httpStatusCode: number);
|
|
19
|
+
}
|
|
20
|
+
export type ApiResponseError = {
|
|
21
|
+
message: string;
|
|
22
|
+
};
|
|
23
|
+
export type ApiPublicationPublishBody = WebsiteData;
|
|
24
|
+
export type ApiPublicationPublishQuery = {
|
|
25
|
+
websiteId: WebsiteId;
|
|
26
|
+
hostingId: ConnectorId;
|
|
27
|
+
storageId: ConnectorId;
|
|
28
|
+
options: ConnectorOptions;
|
|
29
|
+
};
|
|
30
|
+
export type ApiPublicationPublishResponse = {
|
|
31
|
+
url: string;
|
|
32
|
+
job: PublicationJobData;
|
|
33
|
+
};
|
|
34
|
+
export type ApiPublicationStatusQuery = {
|
|
35
|
+
jobId: JobId;
|
|
36
|
+
};
|
|
37
|
+
export type ApiPublicationStatusResponse = PublicationJobData;
|
|
38
|
+
export type ApiWebsiteReadQuery = {
|
|
39
|
+
websiteId: WebsiteId;
|
|
40
|
+
connectorId?: ConnectorId;
|
|
41
|
+
};
|
|
42
|
+
export type ApiWebsiteReadResponse = WebsiteData;
|
|
43
|
+
export type ApiWebsiteListQuery = {
|
|
44
|
+
connectorId?: ConnectorId;
|
|
45
|
+
};
|
|
46
|
+
export type ApiWebsiteListResponse = WebsiteMeta[];
|
|
47
|
+
export type ApiWebsiteWriteQuery = {
|
|
48
|
+
websiteId: WebsiteId;
|
|
49
|
+
connectorId?: ConnectorId;
|
|
50
|
+
};
|
|
51
|
+
export type ApiWebsiteWriteBody = WebsiteData;
|
|
52
|
+
export type ApiWebsiteWriteResponse = {
|
|
53
|
+
message: string;
|
|
54
|
+
};
|
|
55
|
+
export type ApiWebsiteCreateQuery = {
|
|
56
|
+
connectorId?: ConnectorId;
|
|
57
|
+
};
|
|
58
|
+
export type ApiWebsiteCreateBody = WebsiteMetaFileContent;
|
|
59
|
+
export type ApiWebsiteCreateResponse = {
|
|
60
|
+
message: string;
|
|
61
|
+
};
|
|
62
|
+
export type ApiWebsiteDeleteQuery = {
|
|
63
|
+
websiteId: WebsiteId;
|
|
64
|
+
connectorId?: ConnectorId;
|
|
65
|
+
};
|
|
66
|
+
export type ApiWebsiteMetaReadQuery = {
|
|
67
|
+
websiteId: WebsiteId;
|
|
68
|
+
connectorId?: ConnectorId;
|
|
69
|
+
};
|
|
70
|
+
export type ApiWebsiteMetaReadResponse = WebsiteMetaFileContent;
|
|
71
|
+
export type ApiWebsiteMetaWriteQuery = {
|
|
72
|
+
websiteId: WebsiteId;
|
|
73
|
+
connectorId?: ConnectorId;
|
|
74
|
+
};
|
|
75
|
+
export type ApiWebsiteMetaWriteBody = WebsiteMetaFileContent;
|
|
76
|
+
export type ApiWebsiteMetaWriteResponse = {
|
|
77
|
+
message: string;
|
|
78
|
+
};
|
|
79
|
+
export type ApiWebsiteAssetsReadQuery = {
|
|
80
|
+
websiteId: WebsiteId;
|
|
81
|
+
connectorId?: ConnectorId;
|
|
82
|
+
};
|
|
83
|
+
export type ApiWebsiteAssetsReadParams = {
|
|
84
|
+
path: string;
|
|
85
|
+
};
|
|
86
|
+
export type ApiWebsiteAssetsReadResponse = string;
|
|
87
|
+
export type ApiWebsiteAssetsWriteQuery = {
|
|
88
|
+
websiteId: WebsiteId;
|
|
89
|
+
connectorId?: ConnectorId;
|
|
90
|
+
};
|
|
91
|
+
export type ApiWebsiteAssetsWriteBody = ClientSideFile[];
|
|
92
|
+
export type ApiWebsiteAssetsWriteResponse = {
|
|
93
|
+
data: string[];
|
|
94
|
+
};
|
|
95
|
+
export type ApiConnectorListQuery = {
|
|
96
|
+
type: ConnectorType;
|
|
97
|
+
};
|
|
98
|
+
export type ApiConnectorListResponse = ConnectorData[];
|
|
99
|
+
export type ApiConnectorLoginQuery = {
|
|
100
|
+
connectorId: ConnectorId;
|
|
101
|
+
type: ConnectorType;
|
|
102
|
+
};
|
|
103
|
+
export type ApiConnectorLoggedInPostMessage = {
|
|
104
|
+
type: string;
|
|
105
|
+
error: boolean;
|
|
106
|
+
message: string;
|
|
107
|
+
connectorId: ConnectorId;
|
|
108
|
+
options: ConnectorOptions;
|
|
109
|
+
};
|
|
110
|
+
export type ApiConnectorLoginCbkQuery = {
|
|
111
|
+
connectorId?: ConnectorId;
|
|
112
|
+
type: ConnectorType;
|
|
113
|
+
error?: string;
|
|
114
|
+
};
|
|
115
|
+
export type ApiConnectorLoginCbkBody = object;
|
|
116
|
+
export type ApiConnectorSettingsQuery = {
|
|
117
|
+
connectorId?: ConnectorId;
|
|
118
|
+
type: ConnectorType;
|
|
119
|
+
};
|
|
120
|
+
export type ApiConnectorSettingsResponse = string;
|
|
121
|
+
export type ApiConnectorSettingsPostQuery = {
|
|
122
|
+
connectorId?: ConnectorId;
|
|
123
|
+
type: ConnectorType;
|
|
124
|
+
};
|
|
125
|
+
export type ApiConnectorSettingsPostBody = ConnectorUserSettings;
|
|
126
|
+
export type ApiConnectorSettingsPostResponse = {
|
|
127
|
+
message: string;
|
|
128
|
+
};
|
|
129
|
+
export type ApiConnectorLogoutQuery = {
|
|
130
|
+
connectorId?: ConnectorId;
|
|
131
|
+
type: ConnectorType;
|
|
132
|
+
};
|
|
133
|
+
export type ApiConnectorUserQuery = {
|
|
134
|
+
connectorId?: ConnectorId;
|
|
135
|
+
type: ConnectorType;
|
|
136
|
+
};
|
|
137
|
+
export type ApiConnectorUserResponse = ConnectorUser;
|
|
138
|
+
export declare const defaultWebsiteData: WebsiteData;
|
|
139
|
+
export interface WebsiteData {
|
|
140
|
+
pages: Page[];
|
|
141
|
+
assets: Asset[];
|
|
142
|
+
styles: Style[];
|
|
143
|
+
settings: WebsiteSettings;
|
|
144
|
+
fonts: Font[];
|
|
145
|
+
symbols: symbol[];
|
|
146
|
+
publication: PublicationSettings;
|
|
147
|
+
}
|
|
148
|
+
export interface PublicationData extends WebsiteData {
|
|
149
|
+
files?: WebsiteFile[];
|
|
150
|
+
}
|
|
151
|
+
export interface WebsiteSettings {
|
|
152
|
+
description?: string;
|
|
153
|
+
title?: string;
|
|
154
|
+
lang?: string;
|
|
155
|
+
head?: string;
|
|
156
|
+
favicon?: string;
|
|
157
|
+
'og:title'?: string;
|
|
158
|
+
'og:description'?: string;
|
|
159
|
+
'og:image'?: string;
|
|
160
|
+
}
|
|
161
|
+
export interface Font {
|
|
162
|
+
name: string;
|
|
163
|
+
value: string;
|
|
164
|
+
variants: string[];
|
|
165
|
+
}
|
|
166
|
+
export interface Page {
|
|
167
|
+
name?: string;
|
|
168
|
+
id: string;
|
|
169
|
+
type?: string;
|
|
170
|
+
frames: Frame[];
|
|
171
|
+
settings?: WebsiteSettings;
|
|
172
|
+
cssExt?: string;
|
|
173
|
+
htmlExt?: string;
|
|
174
|
+
slug?: string;
|
|
175
|
+
}
|
|
176
|
+
export interface Frame {
|
|
177
|
+
component: {
|
|
178
|
+
type: string;
|
|
179
|
+
stylable: string[];
|
|
180
|
+
};
|
|
181
|
+
components: Component[];
|
|
182
|
+
}
|
|
183
|
+
export interface Component {
|
|
184
|
+
type: string;
|
|
185
|
+
content?: string;
|
|
186
|
+
attributes: {
|
|
187
|
+
[key: string]: string;
|
|
188
|
+
};
|
|
189
|
+
conponents: Component[];
|
|
190
|
+
}
|
|
191
|
+
export declare enum Unit {
|
|
192
|
+
PX = "px"
|
|
193
|
+
}
|
|
194
|
+
export interface Asset {
|
|
195
|
+
type: string;
|
|
196
|
+
src: string;
|
|
197
|
+
unitDim: Unit;
|
|
198
|
+
height: number;
|
|
199
|
+
width: number;
|
|
200
|
+
name: string;
|
|
201
|
+
path?: string;
|
|
202
|
+
}
|
|
203
|
+
export interface Style {
|
|
204
|
+
selectors: Selector[];
|
|
205
|
+
style: {
|
|
206
|
+
[key: string]: string;
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
export type Selector = string | {
|
|
210
|
+
name: string;
|
|
211
|
+
type: number;
|
|
212
|
+
};
|
|
213
|
+
/**
|
|
214
|
+
* Type for a connector id
|
|
215
|
+
*/
|
|
216
|
+
export type ConnectorId = string;
|
|
217
|
+
export type ConnectorOptions = object;
|
|
218
|
+
/**
|
|
219
|
+
* Type for a client side file
|
|
220
|
+
* @see connector/File
|
|
221
|
+
*/
|
|
222
|
+
export interface ClientSideFile {
|
|
223
|
+
path: string;
|
|
224
|
+
content: string;
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Type for file listing
|
|
228
|
+
*/
|
|
229
|
+
export interface FileMeta {
|
|
230
|
+
name: string;
|
|
231
|
+
isDir: boolean;
|
|
232
|
+
size: number;
|
|
233
|
+
createdAt: Date;
|
|
234
|
+
updatedAt: Date;
|
|
235
|
+
metadata?: object;
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Enum to express if the connector is a storage or a hosting
|
|
239
|
+
*/
|
|
240
|
+
export declare enum ConnectorType {
|
|
241
|
+
STORAGE = "STORAGE",
|
|
242
|
+
HOSTING = "HOSTING"
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* Type for a website id
|
|
246
|
+
*/
|
|
247
|
+
export type WebsiteId = string;
|
|
248
|
+
/**
|
|
249
|
+
* Back end data shared with the front end
|
|
250
|
+
*/
|
|
251
|
+
export interface ConnectorData {
|
|
252
|
+
connectorId: ConnectorId;
|
|
253
|
+
type: ConnectorType;
|
|
254
|
+
displayName: string;
|
|
255
|
+
icon: string;
|
|
256
|
+
disableLogout: boolean;
|
|
257
|
+
isLoggedIn: boolean;
|
|
258
|
+
oauthUrl: string | null;
|
|
259
|
+
color: string;
|
|
260
|
+
background: string;
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* User settings for a connector and for a given website
|
|
264
|
+
*/
|
|
265
|
+
export type ConnectorUserSettings = {
|
|
266
|
+
[websiteId: string]: object;
|
|
267
|
+
};
|
|
268
|
+
/**
|
|
269
|
+
* Back end data shared with the front end
|
|
270
|
+
*/
|
|
271
|
+
export interface ConnectorUser {
|
|
272
|
+
name: string;
|
|
273
|
+
email?: string;
|
|
274
|
+
picture?: string;
|
|
275
|
+
storage: ConnectorData;
|
|
276
|
+
}
|
|
277
|
+
export interface WebsiteMetaFileContent {
|
|
278
|
+
name: string;
|
|
279
|
+
imageUrl?: string;
|
|
280
|
+
connectorUserSettings: ConnectorUserSettings;
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* Back end data sent to the front end
|
|
284
|
+
* Meta data can be the root path of the websites, or the bucket name, etc.
|
|
285
|
+
*/
|
|
286
|
+
export interface WebsiteMeta extends WebsiteMetaFileContent {
|
|
287
|
+
websiteId: WebsiteId;
|
|
288
|
+
createdAt: Date;
|
|
289
|
+
updatedAt: Date;
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* Enum to express if the job is in progress or finished or errored
|
|
293
|
+
*/
|
|
294
|
+
export declare enum JobStatus {
|
|
295
|
+
IN_PROGRESS = "IN_PROGRESS",
|
|
296
|
+
SUCCESS = "SUCCESS",
|
|
297
|
+
ERROR = "ERROR"
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* Id used to track the progress of a publication
|
|
301
|
+
*/
|
|
302
|
+
export type JobId = string;
|
|
303
|
+
/**
|
|
304
|
+
* Data structure which is sent to the client to display the progress of a job
|
|
305
|
+
*/
|
|
306
|
+
export interface JobData {
|
|
307
|
+
jobId: JobId;
|
|
308
|
+
status: JobStatus;
|
|
309
|
+
message: string;
|
|
310
|
+
_timeout?: ReturnType<typeof setTimeout>;
|
|
311
|
+
}
|
|
312
|
+
export interface PublicationJobData extends JobData {
|
|
313
|
+
logs: string[][];
|
|
314
|
+
errors: string[][];
|
|
315
|
+
}
|