@silexlabs/silex 3.0.0-alpha.100

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.
Files changed (282) hide show
  1. package/.env.default +19 -0
  2. package/.silex.js +37 -0
  3. package/LICENSE +661 -0
  4. package/README.md +96 -0
  5. package/dist/client/client/api.d.ts +85 -0
  6. package/dist/client/client/assetUrl.d.ts +51 -0
  7. package/dist/client/client/config.d.ts +58 -0
  8. package/dist/client/client/events.d.ts +14 -0
  9. package/dist/client/client/expose.d.ts +8 -0
  10. package/dist/client/client/grapesjs/LoginDialog.d.ts +15 -0
  11. package/dist/client/client/grapesjs/PublicationManager.d.ts +72 -0
  12. package/dist/client/client/grapesjs/PublicationUi.d.ts +62 -0
  13. package/dist/client/client/grapesjs/blocks.d.ts +1 -0
  14. package/dist/client/client/grapesjs/breadcrumbs.d.ts +1 -0
  15. package/dist/client/client/grapesjs/footer.d.ts +2 -0
  16. package/dist/client/client/grapesjs/index.d.ts +5 -0
  17. package/dist/client/client/grapesjs/internal-links.d.ts +1 -0
  18. package/dist/client/client/grapesjs/new-page-dialog.d.ts +2 -0
  19. package/dist/client/client/grapesjs/openImport.d.ts +9 -0
  20. package/dist/client/client/grapesjs/page-panel.d.ts +3 -0
  21. package/dist/client/client/grapesjs/project-bar.d.ts +1 -0
  22. package/dist/client/client/grapesjs/rich-text.d.ts +1 -0
  23. package/dist/client/client/grapesjs/semantic.d.ts +1 -0
  24. package/dist/client/client/grapesjs/settings.d.ts +2 -0
  25. package/dist/client/client/grapesjs/storage.d.ts +1 -0
  26. package/dist/client/client/grapesjs/symbolDialogs.d.ts +3 -0
  27. package/dist/client/client/index.d.ts +5 -0
  28. package/dist/client/client/publication-transformers.d.ts +41 -0
  29. package/dist/client/client/utils.d.ts +2 -0
  30. package/dist/client/constants.d.ts +29 -0
  31. package/dist/client/css/admin.css +4491 -0
  32. package/dist/client/index.html +9 -0
  33. package/dist/client/js/main.js +321 -0
  34. package/dist/client/js/main.js.LICENSE.txt +24 -0
  35. package/dist/client/page.d.ts +2 -0
  36. package/dist/client/types.d.ts +334 -0
  37. package/dist/plugins/client/client/api.d.ts +85 -0
  38. package/dist/plugins/client/client/api.js +114 -0
  39. package/dist/plugins/client/client/api.js.map +1 -0
  40. package/dist/plugins/client/client/assetUrl.d.ts +51 -0
  41. package/dist/plugins/client/client/assetUrl.js +224 -0
  42. package/dist/plugins/client/client/assetUrl.js.map +1 -0
  43. package/dist/plugins/client/client/config.d.ts +58 -0
  44. package/dist/plugins/client/client/config.js +90 -0
  45. package/dist/plugins/client/client/config.js.map +1 -0
  46. package/dist/plugins/client/client/events.d.ts +14 -0
  47. package/dist/plugins/client/client/events.js +34 -0
  48. package/dist/plugins/client/client/events.js.map +1 -0
  49. package/dist/plugins/client/client/grapesjs/LoginDialog.d.ts +15 -0
  50. package/dist/plugins/client/client/grapesjs/LoginDialog.js +195 -0
  51. package/dist/plugins/client/client/grapesjs/LoginDialog.js.map +1 -0
  52. package/dist/plugins/client/client/grapesjs/PublicationManager.d.ts +72 -0
  53. package/dist/plugins/client/client/grapesjs/PublicationManager.js +356 -0
  54. package/dist/plugins/client/client/grapesjs/PublicationManager.js.map +1 -0
  55. package/dist/plugins/client/client/grapesjs/PublicationUi.d.ts +62 -0
  56. package/dist/plugins/client/client/grapesjs/PublicationUi.js +336 -0
  57. package/dist/plugins/client/client/grapesjs/PublicationUi.js.map +1 -0
  58. package/dist/plugins/client/client/grapesjs/blocks.d.ts +1 -0
  59. package/dist/plugins/client/client/grapesjs/blocks.js +37 -0
  60. package/dist/plugins/client/client/grapesjs/blocks.js.map +1 -0
  61. package/dist/plugins/client/client/grapesjs/breadcrumbs.d.ts +1 -0
  62. package/dist/plugins/client/client/grapesjs/breadcrumbs.js +75 -0
  63. package/dist/plugins/client/client/grapesjs/breadcrumbs.js.map +1 -0
  64. package/dist/plugins/client/client/grapesjs/footer.d.ts +2 -0
  65. package/dist/plugins/client/client/grapesjs/footer.js +28 -0
  66. package/dist/plugins/client/client/grapesjs/footer.js.map +1 -0
  67. package/dist/plugins/client/client/grapesjs/index.d.ts +5 -0
  68. package/dist/plugins/client/client/grapesjs/index.js +313 -0
  69. package/dist/plugins/client/client/grapesjs/index.js.map +1 -0
  70. package/dist/plugins/client/client/grapesjs/internal-links.d.ts +1 -0
  71. package/dist/plugins/client/client/grapesjs/internal-links.js +219 -0
  72. package/dist/plugins/client/client/grapesjs/internal-links.js.map +1 -0
  73. package/dist/plugins/client/client/grapesjs/new-page-dialog.d.ts +2 -0
  74. package/dist/plugins/client/client/grapesjs/new-page-dialog.js +83 -0
  75. package/dist/plugins/client/client/grapesjs/new-page-dialog.js.map +1 -0
  76. package/dist/plugins/client/client/grapesjs/openImport.d.ts +9 -0
  77. package/dist/plugins/client/client/grapesjs/openImport.js +74 -0
  78. package/dist/plugins/client/client/grapesjs/openImport.js.map +1 -0
  79. package/dist/plugins/client/client/grapesjs/page-panel.d.ts +3 -0
  80. package/dist/plugins/client/client/grapesjs/page-panel.js +113 -0
  81. package/dist/plugins/client/client/grapesjs/page-panel.js.map +1 -0
  82. package/dist/plugins/client/client/grapesjs/project-bar.d.ts +1 -0
  83. package/dist/plugins/client/client/grapesjs/project-bar.js +104 -0
  84. package/dist/plugins/client/client/grapesjs/project-bar.js.map +1 -0
  85. package/dist/plugins/client/client/grapesjs/rich-text.d.ts +1 -0
  86. package/dist/plugins/client/client/grapesjs/rich-text.js +31 -0
  87. package/dist/plugins/client/client/grapesjs/rich-text.js.map +1 -0
  88. package/dist/plugins/client/client/grapesjs/semantic.d.ts +1 -0
  89. package/dist/plugins/client/client/grapesjs/semantic.js +110 -0
  90. package/dist/plugins/client/client/grapesjs/semantic.js.map +1 -0
  91. package/dist/plugins/client/client/grapesjs/settings.d.ts +2 -0
  92. package/dist/plugins/client/client/grapesjs/settings.js +198 -0
  93. package/dist/plugins/client/client/grapesjs/settings.js.map +1 -0
  94. package/dist/plugins/client/client/grapesjs/storage.d.ts +1 -0
  95. package/dist/plugins/client/client/grapesjs/storage.js +126 -0
  96. package/dist/plugins/client/client/grapesjs/storage.js.map +1 -0
  97. package/dist/plugins/client/client/grapesjs/symbolDialogs.d.ts +3 -0
  98. package/dist/plugins/client/client/grapesjs/symbolDialogs.js +36 -0
  99. package/dist/plugins/client/client/grapesjs/symbolDialogs.js.map +1 -0
  100. package/dist/plugins/client/client/publication-transformers.d.ts +41 -0
  101. package/dist/plugins/client/client/publication-transformers.js +238 -0
  102. package/dist/plugins/client/client/publication-transformers.js.map +1 -0
  103. package/dist/plugins/client/client/utils.d.ts +2 -0
  104. package/dist/plugins/client/client/utils.js +25 -0
  105. package/dist/plugins/client/client/utils.js.map +1 -0
  106. package/dist/plugins/client/constants.d.ts +29 -0
  107. package/dist/plugins/client/constants.js +46 -0
  108. package/dist/plugins/client/constants.js.map +1 -0
  109. package/dist/plugins/client/page.d.ts +2 -0
  110. package/dist/plugins/client/page.js +31 -0
  111. package/dist/plugins/client/page.js.map +1 -0
  112. package/dist/plugins/client/plugins/client/11ty.d.ts +17 -0
  113. package/dist/plugins/client/plugins/client/11ty.js +86 -0
  114. package/dist/plugins/client/plugins/client/11ty.js.map +1 -0
  115. package/dist/plugins/client/plugins/client/publicationRenderer.d.ts +2 -0
  116. package/dist/plugins/client/plugins/client/publicationRenderer.js +170 -0
  117. package/dist/plugins/client/plugins/client/publicationRenderer.js.map +1 -0
  118. package/dist/plugins/client/plugins/client/template.d.ts +2 -0
  119. package/dist/plugins/client/plugins/client/template.js +183 -0
  120. package/dist/plugins/client/plugins/client/template.js.map +1 -0
  121. package/dist/plugins/client/plugins/client/website-info.d.ts +1 -0
  122. package/dist/plugins/client/plugins/client/website-info.js +72 -0
  123. package/dist/plugins/client/plugins/client/website-info.js.map +1 -0
  124. package/dist/plugins/client/types.d.ts +334 -0
  125. package/dist/plugins/client/types.js +74 -0
  126. package/dist/plugins/client/types.js.map +1 -0
  127. package/dist/plugins/server/constants.d.ts +29 -0
  128. package/dist/plugins/server/constants.js +49 -0
  129. package/dist/plugins/server/constants.js.map +1 -0
  130. package/dist/plugins/server/plugins/server/AuthPlugin.d.ts +1 -0
  131. package/dist/plugins/server/plugins/server/AuthPlugin.js +40 -0
  132. package/dist/plugins/server/plugins/server/AuthPlugin.js.map +1 -0
  133. package/dist/plugins/server/plugins/server/Cache.d.ts +2 -0
  134. package/dist/plugins/server/plugins/server/Cache.js +32 -0
  135. package/dist/plugins/server/plugins/server/Cache.js.map +1 -0
  136. package/dist/plugins/server/plugins/server/DownloadConnector.d.ts +29 -0
  137. package/dist/plugins/server/plugins/server/DownloadConnector.js +129 -0
  138. package/dist/plugins/server/plugins/server/DownloadConnector.js.map +1 -0
  139. package/dist/plugins/server/plugins/server/FtpConnector.d.ts +86 -0
  140. package/dist/plugins/server/plugins/server/FtpConnector.js +526 -0
  141. package/dist/plugins/server/plugins/server/FtpConnector.js.map +1 -0
  142. package/dist/plugins/server/plugins/server/GitlabConnector.d.ts +87 -0
  143. package/dist/plugins/server/plugins/server/GitlabConnector.js +564 -0
  144. package/dist/plugins/server/plugins/server/GitlabConnector.js.map +1 -0
  145. package/dist/plugins/server/plugins/server/PublicationOptimizer.d.ts +0 -0
  146. package/dist/plugins/server/plugins/server/PublicationOptimizer.js +14 -0
  147. package/dist/plugins/server/plugins/server/PublicationOptimizer.js.map +1 -0
  148. package/dist/plugins/server/plugins/server/SslPlugin.d.ts +1 -0
  149. package/dist/plugins/server/plugins/server/SslPlugin.js +86 -0
  150. package/dist/plugins/server/plugins/server/SslPlugin.js.map +1 -0
  151. package/dist/plugins/server/plugins/server/StaticPlugin.d.ts +1 -0
  152. package/dist/plugins/server/plugins/server/StaticPlugin.js +78 -0
  153. package/dist/plugins/server/plugins/server/StaticPlugin.js.map +1 -0
  154. package/dist/plugins/server/server/config.d.ts +59 -0
  155. package/dist/plugins/server/server/config.js +181 -0
  156. package/dist/plugins/server/server/config.js.map +1 -0
  157. package/dist/plugins/server/server/connectors/FsHosting.d.ts +13 -0
  158. package/dist/plugins/server/server/connectors/FsHosting.js +54 -0
  159. package/dist/plugins/server/server/connectors/FsHosting.js.map +1 -0
  160. package/dist/plugins/server/server/connectors/FsStorage.d.ts +43 -0
  161. package/dist/plugins/server/server/connectors/FsStorage.js +257 -0
  162. package/dist/plugins/server/server/connectors/FsStorage.js.map +1 -0
  163. package/dist/plugins/server/server/connectors/connectors.d.ts +87 -0
  164. package/dist/plugins/server/server/connectors/connectors.js +127 -0
  165. package/dist/plugins/server/server/connectors/connectors.js.map +1 -0
  166. package/dist/plugins/server/server/events.d.ts +26 -0
  167. package/dist/plugins/server/server/events.js +31 -0
  168. package/dist/plugins/server/server/events.js.map +1 -0
  169. package/dist/plugins/server/server/jobs.d.ts +12 -0
  170. package/dist/plugins/server/server/jobs.js +77 -0
  171. package/dist/plugins/server/server/jobs.js.map +1 -0
  172. package/dist/plugins/server/server/utils/validation.d.ts +7 -0
  173. package/dist/plugins/server/server/utils/validation.js +38 -0
  174. package/dist/plugins/server/server/utils/validation.js.map +1 -0
  175. package/dist/plugins/server/types.d.ts +334 -0
  176. package/dist/plugins/server/types.js +78 -0
  177. package/dist/plugins/server/types.js.map +1 -0
  178. package/dist/server/constants.js +29 -0
  179. package/dist/server/plugins/server/Cache.js +15 -0
  180. package/dist/server/server/api/api.js +20 -0
  181. package/dist/server/server/api/connectorApi.js +216 -0
  182. package/dist/server/server/api/publicationApi.js +108 -0
  183. package/dist/server/server/api/websiteApi.js +296 -0
  184. package/dist/server/server/cli.js +68 -0
  185. package/dist/server/server/config.js +120 -0
  186. package/dist/server/server/connectors/FsHosting.js +35 -0
  187. package/dist/server/server/connectors/FsStorage.js +225 -0
  188. package/dist/server/server/connectors/connectors.js +89 -0
  189. package/dist/server/server/events.js +14 -0
  190. package/dist/server/server/expose.js +27 -0
  191. package/dist/server/server/express.js +47 -0
  192. package/dist/server/server/index.js +90 -0
  193. package/dist/server/server/jobs.js +48 -0
  194. package/dist/server/server/utils/validation.js +15 -0
  195. package/dist/server/types.js +34 -0
  196. package/package.json +209 -0
  197. package/public/assets/container.png +0 -0
  198. package/public/assets/favicon.png +0 -0
  199. package/public/assets/logo-silex-small.png +0 -0
  200. package/public/robots.txt +2 -0
  201. package/public/silex.js +24 -0
  202. package/src/css/_mixins.scss +8 -0
  203. package/src/css/_variables.scss +33 -0
  204. package/src/css/dialog.scss +41 -0
  205. package/src/css/footer.scss +12 -0
  206. package/src/css/grapesjs-light.scss +180 -0
  207. package/src/css/grapesjs.scss +152 -0
  208. package/src/css/index.scss +32 -0
  209. package/src/css/light.scss +7 -0
  210. package/src/css/loader.scss +12 -0
  211. package/src/css/page-panel.scss +65 -0
  212. package/src/css/project-bar.scss +102 -0
  213. package/src/css/silex.scss +189 -0
  214. package/src/css/website-info.scss +14 -0
  215. package/src/html/debug.pug +8 -0
  216. package/src/html/index.pug +39 -0
  217. package/src/html/templates/includes.pug +1 -0
  218. package/src/html/templates/workspace.pug +2 -0
  219. package/src/ts/client/api.ts +144 -0
  220. package/src/ts/client/assetUrl.test.ts +125 -0
  221. package/src/ts/client/assetUrl.ts +235 -0
  222. package/src/ts/client/config.ts +105 -0
  223. package/src/ts/client/events.ts +34 -0
  224. package/src/ts/client/expose.ts +30 -0
  225. package/src/ts/client/grapesjs/LoginDialog.ts +204 -0
  226. package/src/ts/client/grapesjs/PublicationManager.ts +370 -0
  227. package/src/ts/client/grapesjs/PublicationUi.ts +342 -0
  228. package/src/ts/client/grapesjs/blocks.ts +37 -0
  229. package/src/ts/client/grapesjs/breadcrumbs.ts +79 -0
  230. package/src/ts/client/grapesjs/eleventy.ts +47 -0
  231. package/src/ts/client/grapesjs/footer.ts +27 -0
  232. package/src/ts/client/grapesjs/index.ts +335 -0
  233. package/src/ts/client/grapesjs/internal-links.test.ts +105 -0
  234. package/src/ts/client/grapesjs/internal-links.ts +225 -0
  235. package/src/ts/client/grapesjs/new-page-dialog.ts +90 -0
  236. package/src/ts/client/grapesjs/openImport.ts +81 -0
  237. package/src/ts/client/grapesjs/page-panel.ts +118 -0
  238. package/src/ts/client/grapesjs/project-bar.ts +107 -0
  239. package/src/ts/client/grapesjs/rich-text.ts +33 -0
  240. package/src/ts/client/grapesjs/semantic.ts +114 -0
  241. package/src/ts/client/grapesjs/settings.ts +208 -0
  242. package/src/ts/client/grapesjs/storage.ts +121 -0
  243. package/src/ts/client/grapesjs/symbolDialogs.ts +38 -0
  244. package/src/ts/client/index.ts +98 -0
  245. package/src/ts/client/publication-transformers.test.ts +199 -0
  246. package/src/ts/client/publication-transformers.ts +263 -0
  247. package/src/ts/client/utils.ts +28 -0
  248. package/src/ts/constants.ts +52 -0
  249. package/src/ts/externs.ts +18 -0
  250. package/src/ts/page.ts +31 -0
  251. package/src/ts/plugins/client/11ty.ts +104 -0
  252. package/src/ts/plugins/client/publicationRenderer.ts +174 -0
  253. package/src/ts/plugins/client/template.ts +192 -0
  254. package/src/ts/plugins/client/website-info.ts +84 -0
  255. package/src/ts/plugins/server/AuthPlugin.ts +38 -0
  256. package/src/ts/plugins/server/Cache.ts +28 -0
  257. package/src/ts/plugins/server/DownloadConnector.ts +148 -0
  258. package/src/ts/plugins/server/FtpConnector.test.ts +82 -0
  259. package/src/ts/plugins/server/FtpConnector.ts +609 -0
  260. package/src/ts/plugins/server/GitlabConnector.ts +644 -0
  261. package/src/ts/plugins/server/PublicationOptimizer.ts +14 -0
  262. package/src/ts/plugins/server/SslPlugin.ts +84 -0
  263. package/src/ts/plugins/server/StaticPlugin.ts +79 -0
  264. package/src/ts/server/api/api.ts +19 -0
  265. package/src/ts/server/api/connectorApi.ts +345 -0
  266. package/src/ts/server/api/publicationApi.ts +159 -0
  267. package/src/ts/server/api/websiteApi.ts +432 -0
  268. package/src/ts/server/cli.ts +65 -0
  269. package/src/ts/server/config.ts +189 -0
  270. package/src/ts/server/connectors/FsHosting.ts +60 -0
  271. package/src/ts/server/connectors/FsStorage.test.ts +51 -0
  272. package/src/ts/server/connectors/FsStorage.ts +261 -0
  273. package/src/ts/server/connectors/connectors.ts +203 -0
  274. package/src/ts/server/events.ts +37 -0
  275. package/src/ts/server/expose.ts +19 -0
  276. package/src/ts/server/express.ts +70 -0
  277. package/src/ts/server/index.ts +100 -0
  278. package/src/ts/server/jobs.test.ts +75 -0
  279. package/src/ts/server/jobs.ts +87 -0
  280. package/src/ts/server/utils/BackwardCompat.ts +552 -0
  281. package/src/ts/server/utils/validation.ts +34 -0
  282. package/src/ts/types.ts +339 -0
@@ -0,0 +1,263 @@
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
+ import { Component, CssRule, Editor, ObjectStrings, Page } from 'grapesjs'
19
+ import { ClientSideFile, ClientSideFileType, ClientSideFileWithPermalink, PublicationData } from '../types'
20
+ import { onAll } from './utils'
21
+
22
+ /**
23
+ * @fileoverview Silex publication transformers are used to control how the site is rendered and published
24
+ * Here we call path the path on the connector (either storage or hosting)
25
+ * We call permalink the path at which the resource is served
26
+ * This is where pages and assets paths and permalinks are set
27
+ * Here we also update background images urls, assets url and links to match the new permalinks
28
+ */
29
+
30
+ // Properties names used to store the original methods on the components and styles
31
+ const ATTRIBUTE_METHOD_STORE_HTML = 'tmp-pre-publication-transformer-tohtml'
32
+ const ATTRIBUTE_METHOD_STORE_SRC = 'tmp-pre-publication-transformer-src'
33
+ const ATTRIBUTE_METHOD_STORE_ATTRIBUTES_SRC = 'tmp-pre-publication-transformer-attributes-src'
34
+ const ATTRIBUTE_METHOD_STORE_INLINE_CSS = 'tmp-pre-publication-transformer-inline-css'
35
+ const ATTRIBUTE_METHOD_STORE_HREF = 'tmp-pre-publication-transformer-href'
36
+ const ATTRIBUTE_METHOD_STORE_CSS = 'tmp-pre-publication-transformer-tocss'
37
+
38
+ /**
39
+ * Interface for publication transformers
40
+ * They are added to the config object with config.addPublicationTransformer()
41
+ */
42
+ export interface PublicationTransformer {
43
+ // Temporarily override how components render at publication by grapesjs
44
+ renderComponent?(component: Component, toHtml: () => string): string | undefined
45
+ // Temporarily override how styles render at publication by grapesjs
46
+ renderCssRule?(rule: CssRule, initialRule: () => ObjectStrings): ObjectStrings | undefined
47
+ // Transform files after they are rendered and before they are published
48
+ transformFile?(file: ClientSideFile): ClientSideFile
49
+ // Define files URLs
50
+ transformPermalink?(link: string, type: ClientSideFileType): string
51
+ // Define where files are published
52
+ transformPath?(path: string, type: ClientSideFileType): string
53
+ }
54
+
55
+ export function validatePublicationTransformer(transformer: PublicationTransformer): void {
56
+ // List all the properties
57
+ const allowedProperties = [
58
+ 'renderComponent',
59
+ 'renderCssRule',
60
+ 'transformFile',
61
+ 'transformPermalink',
62
+ 'transformPath',
63
+ ]
64
+
65
+ // Check that there are no unknown properties
66
+ Object.keys(transformer).forEach(key => {
67
+ if(!allowedProperties.includes(key)) {
68
+ throw new Error(`Publication transformer: unknown property ${key}`)
69
+ }
70
+ })
71
+
72
+ // Check that the methods are functions
73
+ allowedProperties.forEach(key => {
74
+ if(typeof transformer[key] !== 'function' && transformer[key] !== undefined) {
75
+ throw new Error(`Publication transformer: ${key} must be a function`)
76
+ }
77
+ })
78
+ }
79
+
80
+
81
+ /**
82
+ * Alter the components rendering
83
+ * Exported for unit tests
84
+ */
85
+ export function renderComponents(editor: Editor) {
86
+ const config = editor.getModel().get('config')
87
+ onAll(editor, (c: Component) => {
88
+ if (c.get(ATTRIBUTE_METHOD_STORE_HTML)) {
89
+ console.warn('Publication transformer: HTML transform already altered', c)
90
+ } else {
91
+ const initialToHTML = c.toHTML.bind(c)
92
+ c[ATTRIBUTE_METHOD_STORE_HTML] = c.toHTML
93
+ const initialGetStyle = c.getStyle.bind(c)
94
+ c[ATTRIBUTE_METHOD_STORE_INLINE_CSS] = c.getStyle
95
+ const href = c.get('attributes').href as string | undefined
96
+ if(href?.startsWith('./')) {
97
+ c[ATTRIBUTE_METHOD_STORE_HREF] = href
98
+ c.set('attributes', {
99
+ ...c.get('attributes'),
100
+ href: transformPermalink(editor, href, ClientSideFileType.HTML),
101
+ })
102
+ }
103
+ // Handle both c.attributes.src and c.attributes.attributes.src
104
+ // For some reason we need both
105
+ // Especially when the component is not on the current page, we need c.attributes.attributes.src
106
+ if(c.get('attributes').src) {
107
+ c[ATTRIBUTE_METHOD_STORE_SRC] = c.get('attributes').src
108
+ const src = transformPermalink(editor, c.get('attributes').src, ClientSideFileType.ASSET)
109
+ c.set('attributes', {
110
+ ...c.get('attributes'),
111
+ src,
112
+ })
113
+ }
114
+ if(c.get('src')) {
115
+ c[ATTRIBUTE_METHOD_STORE_ATTRIBUTES_SRC] = c.get('src')
116
+ const src = transformPermalink(editor, c.get('src'), ClientSideFileType.ASSET)
117
+ c.set('src', src)
118
+ }
119
+ c.toHTML = () => {
120
+ return config.publicationTransformers.reduce((html: string, transformer: PublicationTransformer) => {
121
+ try {
122
+ return transformer.renderComponent ? transformer.renderComponent(c, () => html) ?? html : html
123
+ } catch (e) {
124
+ console.error('Publication transformer: error rendering component', c, e)
125
+ return html
126
+ }
127
+ }, initialToHTML())
128
+ }
129
+ c.getStyle = () => transformBgImage(editor, initialGetStyle())
130
+ }
131
+ })
132
+ }
133
+
134
+ /**
135
+ * Alter the styles rendering
136
+ * Exported for unit tests
137
+ */
138
+ export function renderCssRules(editor: Editor) {
139
+ const config = editor.getModel().get('config')
140
+ editor.Css.getAll().forEach((style: CssRule) => {
141
+ if (style[ATTRIBUTE_METHOD_STORE_CSS]) {
142
+ console.warn('Publication transformer: CSS transform already altered', style)
143
+ } else {
144
+ const initialGetStyle = style.getStyle.bind(style)
145
+ style[ATTRIBUTE_METHOD_STORE_CSS] = style.getStyle
146
+ style.getStyle = () => {
147
+ try {
148
+ const result = config.publicationTransformers.reduce((s: CssRule, transformer: PublicationTransformer) => {
149
+ return {
150
+ ...transformer.renderCssRule ? transformer.renderCssRule(s, initialGetStyle) ?? s : s,
151
+ }
152
+ }, transformBgImage(editor, initialGetStyle()))
153
+ return result
154
+ } catch (e) {
155
+ console.error('Publication transformer: error rendering style', style, e)
156
+ return initialGetStyle()
157
+ }
158
+ }
159
+ }
160
+ })
161
+ }
162
+
163
+ /**
164
+ * Transform background image url according to the transformed path of assets
165
+ */
166
+ export function transformBgImage(editor: Editor, style: ObjectStrings): ObjectStrings {
167
+ const url = style['background-image']
168
+ const bgUrl = url?.match(/url\(["']?(.*?)["']?\)/)?.pop()
169
+ if (bgUrl) {
170
+ return {
171
+ ...style,
172
+ 'background-image': `url(${transformPermalink(editor, bgUrl, ClientSideFileType.ASSET)})`,
173
+ }
174
+ }
175
+ return style
176
+ }
177
+
178
+ /**
179
+ * Transform files
180
+ * Exported for unit tests
181
+ */
182
+ export function transformFiles(editor: Editor, data: PublicationData) {
183
+ const config = editor.getModel().get('config')
184
+ data.files = config.publicationTransformers.reduce((files: ClientSideFile[], transformer: PublicationTransformer) => {
185
+ return files.map((file, idx) => {
186
+ try {
187
+ const page = data.pages[idx] ?? null
188
+ return transformer.transformFile ? transformer.transformFile(file) as ClientSideFile ?? file : file
189
+ } catch (e) {
190
+ console.error('Publication transformer: error transforming file', file, e)
191
+ return file
192
+ }
193
+ })
194
+ }, data.files)
195
+ }
196
+
197
+ /**
198
+ * Transform files paths
199
+ * Exported for unit tests
200
+ */
201
+ export function transformPermalink(editor: Editor, path: string, type: ClientSideFileType): string {
202
+ const config = editor.getModel().get('config')
203
+ return config.publicationTransformers.reduce((result: string, transformer: PublicationTransformer) => {
204
+ try {
205
+ return transformer.transformPermalink ? transformer.transformPermalink(result, type) ?? result : result
206
+ } catch (e) {
207
+ console.error('Publication transformer: error transforming path', result, e)
208
+ return result
209
+ }
210
+ }, path)
211
+ }
212
+
213
+ export function transformPath(editor: Editor, path: string, type: ClientSideFileType): string {
214
+ const config = editor.getModel().get('config')
215
+ return config.publicationTransformers.reduce((result: string, transformer: PublicationTransformer) => {
216
+ try {
217
+ return transformer.transformPath ? transformer.transformPath(result, type) ?? result : result
218
+ } catch (e) {
219
+ console.error('Publication transformer: error transforming path', result, e)
220
+ return result
221
+ }
222
+ }, path)
223
+ }
224
+
225
+ export function resetRenderComponents(editor: Editor) {
226
+ onAll(editor, (c: Component) => {
227
+ if (c[ATTRIBUTE_METHOD_STORE_HTML]) {
228
+ c.toHTML = c[ATTRIBUTE_METHOD_STORE_HTML]
229
+ delete c[ATTRIBUTE_METHOD_STORE_HTML]
230
+ }
231
+ if (c[ATTRIBUTE_METHOD_STORE_INLINE_CSS]) {
232
+ c.getStyle = c[ATTRIBUTE_METHOD_STORE_INLINE_CSS]
233
+ delete c[ATTRIBUTE_METHOD_STORE_INLINE_CSS]
234
+ }
235
+ if(c[ATTRIBUTE_METHOD_STORE_SRC]) {
236
+ c.set('attributes', {
237
+ ...c.get('attributes'),
238
+ src: c[ATTRIBUTE_METHOD_STORE_SRC],
239
+ })
240
+ delete c[ATTRIBUTE_METHOD_STORE_SRC]
241
+ }
242
+ if(c[ATTRIBUTE_METHOD_STORE_ATTRIBUTES_SRC]) {
243
+ c.set('src', c[ATTRIBUTE_METHOD_STORE_ATTRIBUTES_SRC])
244
+ delete c[ATTRIBUTE_METHOD_STORE_ATTRIBUTES_SRC]
245
+ }
246
+ if(c[ATTRIBUTE_METHOD_STORE_HREF]) {
247
+ c.set('attributes', {
248
+ ...c.get('attributes'),
249
+ href: c[ATTRIBUTE_METHOD_STORE_HREF],
250
+ })
251
+ delete c[ATTRIBUTE_METHOD_STORE_HREF]
252
+ }
253
+ })
254
+ }
255
+
256
+ export function resetRenderCssRules(editor: Editor) {
257
+ editor.Css.getAll().forEach(c => {
258
+ if (c[ATTRIBUTE_METHOD_STORE_CSS]) {
259
+ c.getStyle = c[ATTRIBUTE_METHOD_STORE_CSS]
260
+ delete c[ATTRIBUTE_METHOD_STORE_CSS]
261
+ }
262
+ })
263
+ }
@@ -0,0 +1,28 @@
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
+ import { Component, Editor } from 'grapesjs'
19
+
20
+
21
+ // Browse all elements of all pages
22
+ export function onAll(editor: Editor, cbk: (c: Component) => void) {
23
+ editor.Pages.getAll()
24
+ .forEach(page => {
25
+ page.getMainComponent()
26
+ .onAll(c => cbk(c))
27
+ })
28
+ }
@@ -0,0 +1,52 @@
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
+ /**
19
+ * @fileoverview define constants for Silex client and server
20
+ */
21
+
22
+ export const WEBSITE_DATA_FILE = 'website.json'
23
+ export const WEBSITE_META_DATA_FILE = 'meta.json'
24
+
25
+ export const DEFAULT_WEBSITE_ID = 'default'
26
+ export const DEFAULT_LANGUAGE = 'en'
27
+ export const CLIENT_CONFIG_FILE_NAME = 'silex.js'
28
+
29
+ export const API_PATH = '/api'
30
+
31
+ export const API_CONNECTOR_PATH = '/connector'
32
+ export const API_CONNECTOR_USER = '/user'
33
+ export const API_CONNECTOR_LIST = '/'
34
+ export const API_CONNECTOR_LOGOUT = '/logout'
35
+ export const API_CONNECTOR_LOGIN = '/login'
36
+ export const API_CONNECTOR_SETTINGS = '/settings'
37
+ export const API_CONNECTOR_LOGIN_CALLBACK = '/login/callback'
38
+
39
+ export const API_PUBLICATION_PATH = '/publication'
40
+ export const API_PUBLICATION_PUBLISH = '/'
41
+ export const API_PUBLICATION_STATUS = '/publication/status'
42
+
43
+ export const API_WEBSITE_PATH = '/website'
44
+ export const API_WEBSITE_READ = '/'
45
+ export const API_WEBSITE_WRITE = '/'
46
+ export const API_WEBSITE_CREATE = '/'
47
+ export const API_WEBSITE_DELETE = '/'
48
+ export const API_WEBSITE_LIST = '/'
49
+ export const API_WEBSITE_ASSET_READ = '/assets'
50
+ export const API_WEBSITE_ASSETS_WRITE = '/assets'
51
+ export const API_WEBSITE_META_READ = '/meta'
52
+ export const API_WEBSITE_META_WRITE = '/meta'
@@ -0,0 +1,18 @@
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
+
package/src/ts/page.ts ADDED
@@ -0,0 +1,31 @@
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
+ // Page related functions
19
+ // This is used on the client and the server
20
+ export function getPageSlug(pageName) {
21
+ return (pageName || 'index')
22
+ .toLowerCase()
23
+ .replace(/[^a-z0-9 -]/g, '')
24
+ // Collapse whitespace and replace by -
25
+ .replace(/\s+/g, '-')
26
+ // Collapse dashes
27
+ .replace(/-+/g, '-')
28
+ }
29
+ export function getPageLink(pageName) {
30
+ return `./${getPageSlug(pageName)}.html`
31
+ }
@@ -0,0 +1,104 @@
1
+ import { ClientConfig } from '../../client/config'
2
+ import { ClientSideFile, ClientSideFileWithContent } from '../../types'
3
+
4
+ interface PluginOptions {
5
+ html: {
6
+ url: string,
7
+ path: string,
8
+ },
9
+ css: {
10
+ url: string,
11
+ path: string,
12
+ },
13
+ assets: {
14
+ url: string,
15
+ path: string,
16
+ },
17
+ }
18
+
19
+ export default (config: ClientConfig, opts: Partial<PluginOptions>) => {
20
+ const options = {
21
+ ...opts,
22
+ html: {
23
+ url: '/',
24
+ path: './',
25
+ ...opts.html,
26
+ },
27
+ css: {
28
+ url: '/css', // For the HTML links
29
+ path: './css', // For the file system
30
+ permalink: '/css', // For the frontmatter
31
+ ...opts.css,
32
+ },
33
+ assets: {
34
+ url: '/',
35
+ path: './', // assets is already in the assets urls
36
+ ...opts.assets,
37
+ },
38
+ }
39
+
40
+ config.addPublicationTransformers({
41
+ transformPermalink: (path, type) => {
42
+ switch (type) {
43
+ case 'html':
44
+ console.log('Silex: transform path for 11ty', path, options.html.url + path)
45
+ return options.html.url + path
46
+ case 'css':
47
+ console.log('Silex: transform path for 11ty', path, options.css.url + path.replace(/\.css$/, '.css.liquid'))
48
+ return options.css.url + path
49
+ .replace(/^\/css/, '')
50
+ .replace(/\.css.liquid$/, '.css')
51
+ case 'asset':
52
+ console.log('Silex: transform path for 11ty', path, options.assets.url + path)
53
+ return options.assets.url + path
54
+ }
55
+ throw new Error(`Unknown file type ${type}`)
56
+ },
57
+ transformPath: (path, type) => {
58
+ switch (type) {
59
+ case 'html':
60
+ return options.html.path + path
61
+ case 'css':
62
+ const res = options.css.path + path
63
+ // Remove default path
64
+ .replace(/^\/css/, '')
65
+ // Change extension
66
+ .replace(/\.css$/, '.css.liquid')
67
+ return res
68
+ case 'asset':
69
+ return options.assets.path + path
70
+ // Remove default path
71
+ .replace(/^\/assets/, '')
72
+ }
73
+ throw new Error(`Unknown file type ${type}`)
74
+ },
75
+ transformFile: (file: ClientSideFile) => {
76
+ const fileWithContent = file as ClientSideFileWithContent
77
+ switch (file.type) {
78
+ case 'html':
79
+ return {
80
+ ...file,
81
+ //path: options.html.path + fileWithContent.path,
82
+ //content: `---\npermalink: ${options.html.url}${fileWithContent.path}\n---\n${fileWithContent.content}`
83
+ }
84
+ case 'css':
85
+ const path = fileWithContent.path
86
+ // Remove extension added in transformPath (options.css.path)
87
+ .replace(new RegExp(`^${options.css.path}`), '')
88
+ // Remove path added in transformPath (options.css.path)
89
+ .replace(/\.css\.liquid$/, '.css')
90
+ return {
91
+ ...file,
92
+ //path: options.css.path + fileWithContent.path.replace(/\.css$/, '.css.liquid'),
93
+ content: `---\npermalink: ${options.css.permalink}${path}\n---\n${fileWithContent.content}`
94
+ }
95
+ case 'asset':
96
+ return {
97
+ ...file,
98
+ //path: options.assets.path + fileWithContent.path,
99
+ }
100
+ }
101
+ throw new Error(`Unknown file type ${file.type}`)
102
+ },
103
+ })
104
+ }
@@ -0,0 +1,174 @@
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
+ /**
19
+ * @deprecated
20
+ * This plugin is deprecated. Use the publication renderer plugin instead.
21
+ */
22
+ console.warn('This plugin is deprecated. Use the publication renderer plugin instead.')
23
+ throw 'This plugin is deprecated. Use the publication renderer plugin instead.'
24
+
25
+ /* Usage:
26
+ import publicationRenderer from 'https://unpkg.com/@silexlabs/silex@latest/dist/plugins/client/plugins/client/publicationRenderer'
27
+ await config.addPlugin(publicationRenderer, {
28
+ css: {
29
+ frontMatter: true,
30
+ ext: '.css.liquid',
31
+ path: '../../../pages'
32
+ },
33
+ html: {
34
+ frontMatter: false,
35
+ path: '../../../_includes'
36
+ },
37
+ assets: {
38
+ path: '../../../',
39
+ url: '/',
40
+ },
41
+ })
42
+ */
43
+
44
+ import { getPageSlug } from '../../page.js'
45
+ import { ClientSideFile } from '../../types.js'
46
+ import { onAll } from '../../client/utils.js'
47
+ import { ClientEvent } from '../../client/events.js'
48
+ import { Page } from 'grapesjs'
49
+
50
+ export default (config, opts: any = {}) => {
51
+ const options = {
52
+ autoHomePage: false,
53
+ ...opts,
54
+ html: {
55
+ frontMatter: false,
56
+ ext: '.html',
57
+ url: '/',
58
+ path: './',
59
+ ...opts.html,
60
+ },
61
+ css: {
62
+ frontMatter: false,
63
+ ext: '.css',
64
+ url: '/css',
65
+ path: './css',
66
+ ...opts.css,
67
+ },
68
+ assets: {
69
+ url: '/',
70
+ path: './',
71
+ ...opts.assets,
72
+ },
73
+ }
74
+ config.on(ClientEvent.STARTUP_END, ({ editor }) => {
75
+ editor.on(ClientEvent.PUBLISH_START, () => {
76
+ // Update assets URL to display outside the editor
77
+ const assetsFolderUrl = options.assets.url
78
+ if (assetsFolderUrl) {
79
+ // Concat the paths, handles the trailing and leading slashes
80
+ const publishedUrl = path => `${assetsFolderUrl.replace(/\/+$/, '')}/${path.replace(/^\/+/, '')}`
81
+ // New URLs for assets, according to site config
82
+ onAll(editor, c => {
83
+ // Attributes
84
+ if (c.get('type') === 'image') {
85
+ const src = c.get('src')
86
+ c.set('tmp-src', src)
87
+ c.set('src', publishedUrl(src))
88
+ }
89
+ //// Inline styles
90
+ //// This is handled by the editor.Css.getAll loop
91
+ //const bgUrl = c.getStyle()['background-image']?.match(/url\('(.*)'\)/)?.pop()
92
+ //if(bgUrl) {
93
+ // c.set('tmp-bg-url', bgUrl)
94
+ // c.setStyle({
95
+ // ...c.getStyle(),
96
+ // 'background-image': `url('${publishedUrl(bgUrl)}')`,
97
+ // })
98
+ //}
99
+ })
100
+ editor.Css.getAll()
101
+ .forEach(c => {
102
+ const bgUrl = c.getStyle()['background-image']?.match(/url\('(.*)'\)/)?.pop()
103
+ if (bgUrl) {
104
+ c.setStyle({
105
+ ...c.getStyle(),
106
+ 'background-image': `url('${publishedUrl(bgUrl)}')`,
107
+ })
108
+ c.set('tmp-bg-url-css' as any, bgUrl)
109
+ }
110
+ })
111
+ }
112
+ editor.Pages.getAll().forEach(page => {
113
+ if (page.get('type') === 'main' && options?.autoHomePage) {
114
+ page.set('slug', 'index')
115
+ } else {
116
+ page.set('slug', getPageSlug(page.get('name') || page.get('type')))
117
+ }
118
+ })
119
+ })
120
+ editor.on(ClientEvent.PUBLISH_END, () => {
121
+ const assetsFolderUrl = options.assets.url
122
+ // Reset asset URLs
123
+ if (assetsFolderUrl) {
124
+ onAll(editor, c => {
125
+ if (c.get('type') === 'image' && c.has('tmp-src')) {
126
+ c.set('src', c.get('tmp-src'))
127
+ c.set('tmp-src')
128
+ }
129
+ //// This is handled by the editor.Css.getAll loop
130
+ //if(c.getStyle()['background-image'] && c.has('tmp-bg-url')) {
131
+ // c.setStyle({
132
+ // ...c.getStyle(),
133
+ // 'background-image': `url('${c.get('tmp-bg-url')}')`,
134
+ // })
135
+ // c.set('tmp-bg-url')
136
+ //}
137
+ })
138
+ editor.Css.getAll()
139
+ .forEach(c => {
140
+ if (c.has('tmp-bg-url-css' as any)) {
141
+ c.setStyle({
142
+ ...c.getStyle(),
143
+ 'background-image': `url('${c.get('tmp-bg-url-css' as any)}')`,
144
+ })
145
+ c.set('tmp-bg-url-css' as any)
146
+ }
147
+ })
148
+ }
149
+ })
150
+ //editor.on(ClientEvent.PUBLISH_DATA, data => {
151
+ // data.pages.forEach((page: Page, idx) => {
152
+ // const file = data.files[idx] as ClientSideFile
153
+ // console.log('Silex: publication renderer: page', page, file)
154
+ // // CSS
155
+ // if(file.type === 'css') {
156
+ // file.cssPath = file.cssPath.replace(/\.css$/, options.css.ext)
157
+ // file.cssPath = options.css.path + file.cssPath
158
+ // if (options.css.frontMatter) {
159
+ // file.css = `---\npermalink: ${options.css.url}/${page.slug}.css\n---\n${file.css}`
160
+ // }
161
+ // // HTML
162
+ // file.htmlPath = file.htmlPath.replace(/\.html$/, options.html.ext)
163
+ // file.htmlPath = options.html.path + file.htmlPath
164
+ // if (options.html.frontMatter) {
165
+ // file.html = `---\npermalink: ${options.html.url}/${page.slug}.html\n---\n${file.html}`
166
+ // }
167
+ // })
168
+ // data.assets.forEach((asset, idx) => {
169
+ // asset.path = options.assets.path + asset.src
170
+ // // The rest is handled by the editor.Css.getAll loop
171
+ // })
172
+ //})
173
+ })
174
+ }