@silexlabs/silex 3.7.0 → 3.9.0-canary.2

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 (596) hide show
  1. package/README.md +115 -78
  2. package/common/examples/plugin.js +6 -0
  3. package/common/silex-plugins/config.test.ts +71 -0
  4. package/common/silex-plugins/config.ts +25 -0
  5. package/common/silex-plugins/index.ts +2 -0
  6. package/common/silex-plugins/plugin.test.ts +57 -0
  7. package/common/silex-plugins/plugin.ts +65 -0
  8. package/dist/client/css/admin.css +25 -12
  9. package/dist/client/css/all.min.css +5 -5
  10. package/dist/client/index.html +2 -2
  11. package/dist/client/js/main.js +3108 -2940
  12. package/dist/client/js/main.js.LICENSE.txt +6 -4
  13. package/dist/client/webfonts/fa-brands-400.woff2 +0 -0
  14. package/dist/client/webfonts/fa-regular-400.woff2 +0 -0
  15. package/dist/client/webfonts/fa-solid-900.woff2 +0 -0
  16. package/dist/client/webfonts/fa-v4compatibility.woff2 +0 -0
  17. package/dist/server/common/externs.js +2 -0
  18. package/dist/server/common/silex-plugins/config.js +25 -0
  19. package/dist/server/common/silex-plugins/index.js +18 -0
  20. package/dist/server/common/silex-plugins/plugin.js +41 -0
  21. package/dist/server/server/api/api.js +9 -9
  22. package/dist/server/server/api/connectorApi.js +35 -35
  23. package/dist/server/server/api/publicationApi.js +19 -19
  24. package/dist/server/server/api/websiteApi.js +46 -46
  25. package/dist/server/server/config.js +19 -19
  26. package/dist/server/server/connectors/FsHosting.js +6 -6
  27. package/dist/server/server/connectors/FsStorage.js +35 -35
  28. package/dist/server/server/connectors/connectors.js +3 -3
  29. package/dist/server/server/expose.js +18 -8
  30. package/dist/server/server/express.js +3 -3
  31. package/dist/server/server/index.js +29 -19
  32. package/dist/server/server/jobs.js +4 -4
  33. package/dist/{plugins/server/plugins/server → server/server/plugins}/DownloadConnector.js +23 -28
  34. package/dist/{plugins/server/plugins/server → server/server/plugins}/FtpConnector.js +42 -117
  35. package/dist/{plugins/server/plugins/server → server/server/plugins}/GitlabConnector.js +80 -271
  36. package/dist/{plugins/server/plugins/server → server/server/plugins}/GitlabHostingConnector.js +11 -134
  37. package/dist/server/server/plugins/PublicationOptimizer.js +2 -0
  38. package/dist/{plugins/server/plugins/server → server/server/plugins}/SslPlugin.js +3 -32
  39. package/dist/{plugins/server/plugins/server → server/server/plugins}/StaticPlugin.js +4 -21
  40. package/dist/server/server/utils/BackwardCompat.js +2 -0
  41. package/dist/server/server/utils/websiteDataSerialization.js +10 -10
  42. package/{src/ts/client → editor}/api.ts +2 -2
  43. package/{src/ts/client → editor}/assetUrl.test.ts +6 -33
  44. package/{src/ts/client → editor}/assetUrl.ts +2 -2
  45. package/{src/ts/client → editor}/config.ts +3 -3
  46. package/{src/css/theme-modern.scss → editor/css/design-system.scss} +29 -14
  47. package/{src → editor}/css/index.scss +1 -3
  48. package/{src → editor}/css/project-bar.scss +5 -0
  49. package/{src/ts/client → editor}/expose.ts +3 -3
  50. package/{src/ts/client → editor}/grapesjs/LoginDialog.ts +3 -3
  51. package/{src/ts/client → editor}/grapesjs/PublicationManager.ts +3 -3
  52. package/{src/ts/client → editor}/grapesjs/PublicationUi.ts +1 -1
  53. package/{src/ts/client → editor}/grapesjs/cms/index.ts +1 -1
  54. package/{src/ts/client → editor}/grapesjs/cms/page-settings.ts +1 -1
  55. package/{src/ts/client → editor}/grapesjs/cms/publication.ts +1 -1
  56. package/{src/ts/client → editor}/grapesjs/eleventy.ts +1 -1
  57. package/{src/ts/client → editor}/grapesjs/index.ts +5 -3
  58. package/{src/ts/client → editor}/grapesjs/internal-links.ts +2 -2
  59. package/{src/ts/client → editor}/grapesjs/resize-panel.ts +2 -1
  60. package/{src/ts/client → editor}/grapesjs/settings-sections.ts +1 -1
  61. package/{src/ts/client → editor}/grapesjs/settings.ts +2 -2
  62. package/{src/ts/client → editor}/grapesjs/storage.ts +1 -1
  63. package/editor/grapesjs/website-info.ts +52 -0
  64. package/{src/ts/client → editor}/index.ts +1 -1
  65. package/{src/ts/client → editor}/publication-transformers.test.ts +10 -10
  66. package/{src/ts/client → editor}/publication-transformers.ts +1 -1
  67. package/{src/ts/client → editor}/publish-fonts.ts +2 -2
  68. package/grapesjs-plugins/expression-input/.husky/pre-commit +2 -0
  69. package/grapesjs-plugins/expression-input/.prettierrc.json +7 -0
  70. package/grapesjs-plugins/expression-input/.vscode/extensions.json +9 -0
  71. package/grapesjs-plugins/expression-input/CHANGELOG.md +47 -0
  72. package/grapesjs-plugins/expression-input/LICENSE +661 -0
  73. package/grapesjs-plugins/expression-input/README.md +59 -0
  74. package/grapesjs-plugins/expression-input/babel.config.js +3 -0
  75. package/grapesjs-plugins/expression-input/commitlint.config.js +1 -0
  76. package/grapesjs-plugins/expression-input/dev/README.md +1 -0
  77. package/grapesjs-plugins/expression-input/dev/expression-input.html +148 -0
  78. package/grapesjs-plugins/expression-input/dev/input-chain.html +88 -0
  79. package/grapesjs-plugins/expression-input/dev/popin-form.html +83 -0
  80. package/grapesjs-plugins/expression-input/docs/expression-input.md +173 -0
  81. package/grapesjs-plugins/expression-input/docs/popin-form.md +228 -0
  82. package/grapesjs-plugins/expression-input/eslint.config.mjs +71 -0
  83. package/grapesjs-plugins/expression-input/package.json +84 -0
  84. package/grapesjs-plugins/expression-input/playwright.config.ts +6 -0
  85. package/grapesjs-plugins/expression-input/rollup.config.js +39 -0
  86. package/grapesjs-plugins/expression-input/src/expression-input.ts +339 -0
  87. package/grapesjs-plugins/expression-input/src/index.ts +3 -0
  88. package/grapesjs-plugins/expression-input/src/input-chain.ts +216 -0
  89. package/grapesjs-plugins/expression-input/src/popin-form.ts +189 -0
  90. package/grapesjs-plugins/expression-input/src/popin-overlay.ts +188 -0
  91. package/grapesjs-plugins/expression-input/src/styles.ts +374 -0
  92. package/grapesjs-plugins/expression-input/src/test/popin-form_test.ts +47 -0
  93. package/grapesjs-plugins/expression-input/tsconfig.json +34 -0
  94. package/grapesjs-plugins/expression-input/web-dev-server.config.js +25 -0
  95. package/grapesjs-plugins/expression-input/web-test-runner.config.js +124 -0
  96. package/grapesjs-plugins/grapesjs-advanced-selector/.editorconfig +5 -0
  97. package/grapesjs-plugins/grapesjs-advanced-selector/.husky/pre-commit +4 -0
  98. package/grapesjs-plugins/grapesjs-advanced-selector/LICENSE +661 -0
  99. package/grapesjs-plugins/grapesjs-advanced-selector/README.md +158 -0
  100. package/grapesjs-plugins/grapesjs-advanced-selector/babel.config.js +3 -0
  101. package/grapesjs-plugins/grapesjs-advanced-selector/eslint.config.mjs +20 -0
  102. package/grapesjs-plugins/grapesjs-advanced-selector/index.html +353 -0
  103. package/grapesjs-plugins/grapesjs-advanced-selector/jest.config.cjs +11 -0
  104. package/grapesjs-plugins/grapesjs-advanced-selector/package-lock.json +12500 -0
  105. package/grapesjs-plugins/grapesjs-advanced-selector/package.json +75 -0
  106. package/grapesjs-plugins/grapesjs-advanced-selector/public/simple-selector.html +12 -0
  107. package/grapesjs-plugins/grapesjs-advanced-selector/src/StylableElement.ts +15 -0
  108. package/grapesjs-plugins/grapesjs-advanced-selector/src/capabilities.ts +49 -0
  109. package/grapesjs-plugins/grapesjs-advanced-selector/src/commands.ts +89 -0
  110. package/grapesjs-plugins/grapesjs-advanced-selector/src/components/complex-selector.ts +187 -0
  111. package/grapesjs-plugins/grapesjs-advanced-selector/src/components/compound-selector.ts +241 -0
  112. package/grapesjs-plugins/grapesjs-advanced-selector/src/components/current-selector-display.ts +289 -0
  113. package/grapesjs-plugins/grapesjs-advanced-selector/src/components/inline-select.ts +199 -0
  114. package/grapesjs-plugins/grapesjs-advanced-selector/src/components/resize-input.ts +19 -0
  115. package/grapesjs-plugins/grapesjs-advanced-selector/src/components/simple-selector.ts +537 -0
  116. package/grapesjs-plugins/grapesjs-advanced-selector/src/i18n/en.ts +75 -0
  117. package/grapesjs-plugins/grapesjs-advanced-selector/src/i18n/fr.ts +75 -0
  118. package/grapesjs-plugins/grapesjs-advanced-selector/src/index.ts +47 -0
  119. package/grapesjs-plugins/grapesjs-advanced-selector/src/model/ComplexSelector.test.ts +380 -0
  120. package/grapesjs-plugins/grapesjs-advanced-selector/src/model/ComplexSelector.ts +231 -0
  121. package/grapesjs-plugins/grapesjs-advanced-selector/src/model/CompoundSelector.test.ts +232 -0
  122. package/grapesjs-plugins/grapesjs-advanced-selector/src/model/CompoundSelector.ts +128 -0
  123. package/grapesjs-plugins/grapesjs-advanced-selector/src/model/GrapesJsSelectors.test.ts +1077 -0
  124. package/grapesjs-plugins/grapesjs-advanced-selector/src/model/GrapesJsSelectors.ts +653 -0
  125. package/grapesjs-plugins/grapesjs-advanced-selector/src/model/Operator.test.ts +45 -0
  126. package/grapesjs-plugins/grapesjs-advanced-selector/src/model/Operator.ts +129 -0
  127. package/grapesjs-plugins/grapesjs-advanced-selector/src/model/PseudoClass.test.ts +31 -0
  128. package/grapesjs-plugins/grapesjs-advanced-selector/src/model/PseudoClass.ts +159 -0
  129. package/grapesjs-plugins/grapesjs-advanced-selector/src/model/SimpleSelector.test.ts +181 -0
  130. package/grapesjs-plugins/grapesjs-advanced-selector/src/model/SimpleSelector.ts +379 -0
  131. package/grapesjs-plugins/grapesjs-advanced-selector/src/plugin.ts +225 -0
  132. package/grapesjs-plugins/grapesjs-advanced-selector/src/styles.ts +40 -0
  133. package/grapesjs-plugins/grapesjs-advanced-selector/src/test-data.json +3546 -0
  134. package/grapesjs-plugins/grapesjs-advanced-selector/tsconfig.json +37 -0
  135. package/grapesjs-plugins/grapesjs-ai-capabilities/.eslintrc.json +31 -0
  136. package/grapesjs-plugins/grapesjs-ai-capabilities/LICENSE +17 -0
  137. package/grapesjs-plugins/grapesjs-ai-capabilities/README.md +129 -0
  138. package/grapesjs-plugins/grapesjs-ai-capabilities/_index.html +37 -0
  139. package/grapesjs-plugins/grapesjs-ai-capabilities/package-lock.json +9023 -0
  140. package/grapesjs-plugins/grapesjs-ai-capabilities/package.json +46 -0
  141. package/grapesjs-plugins/grapesjs-ai-capabilities/src/index.js +97 -0
  142. package/grapesjs-plugins/grapesjs-ai-capabilities/test/index.test.js +198 -0
  143. package/grapesjs-plugins/grapesjs-ai-capabilities/tsconfig.json +29 -0
  144. package/grapesjs-plugins/grapesjs-css-variables/.eslintrc.json +31 -0
  145. package/grapesjs-plugins/grapesjs-css-variables/LICENSE +661 -0
  146. package/grapesjs-plugins/grapesjs-css-variables/README.md +172 -0
  147. package/grapesjs-plugins/grapesjs-css-variables/TEST_SCENARIOS.md +181 -0
  148. package/grapesjs-plugins/grapesjs-css-variables/_index.html +93 -0
  149. package/grapesjs-plugins/grapesjs-css-variables/package-lock.json +9020 -0
  150. package/grapesjs-plugins/grapesjs-css-variables/package.json +46 -0
  151. package/grapesjs-plugins/grapesjs-css-variables/src/capabilities.js +133 -0
  152. package/grapesjs-plugins/grapesjs-css-variables/src/index.js +37 -0
  153. package/grapesjs-plugins/grapesjs-css-variables/src/locale/en.js +22 -0
  154. package/grapesjs-plugins/grapesjs-css-variables/src/locale/fr.js +22 -0
  155. package/grapesjs-plugins/grapesjs-css-variables/src/modal.js +692 -0
  156. package/grapesjs-plugins/grapesjs-css-variables/src/style-manager.js +461 -0
  157. package/grapesjs-plugins/grapesjs-css-variables/src/types.js +8 -0
  158. package/grapesjs-plugins/grapesjs-css-variables/src/variables.js +439 -0
  159. package/grapesjs-plugins/grapesjs-data-source/.husky/pre-commit +4 -0
  160. package/grapesjs-plugins/grapesjs-data-source/.nvmrc +1 -0
  161. package/grapesjs-plugins/grapesjs-data-source/LICENSE +661 -0
  162. package/grapesjs-plugins/grapesjs-data-source/README.md +674 -0
  163. package/grapesjs-plugins/grapesjs-data-source/__mocks__/directus-schema.json +67137 -0
  164. package/grapesjs-plugins/grapesjs-data-source/__mocks__/directus-test-schema.json +8393 -0
  165. package/grapesjs-plugins/grapesjs-data-source/__mocks__/graphql-mocks.js +7 -0
  166. package/grapesjs-plugins/grapesjs-data-source/__mocks__/simple-schema.json +493 -0
  167. package/grapesjs-plugins/grapesjs-data-source/__mocks__/squidex-schema.json +6656 -0
  168. package/grapesjs-plugins/grapesjs-data-source/__mocks__/strapi-schema.json +7986 -0
  169. package/grapesjs-plugins/grapesjs-data-source/_index.html +110 -0
  170. package/grapesjs-plugins/grapesjs-data-source/babel.config.js +7 -0
  171. package/grapesjs-plugins/grapesjs-data-source/eslint.config.mjs +47 -0
  172. package/grapesjs-plugins/grapesjs-data-source/example.graphql +355 -0
  173. package/grapesjs-plugins/grapesjs-data-source/example.graphql.json +5666 -0
  174. package/grapesjs-plugins/grapesjs-data-source/example.page.json +1 -0
  175. package/grapesjs-plugins/grapesjs-data-source/integration-tests/base/graphql-response.json +6 -0
  176. package/grapesjs-plugins/grapesjs-data-source/integration-tests/base/graphql-types.json +2095 -0
  177. package/grapesjs-plugins/grapesjs-data-source/integration-tests/base/preview.html +5 -0
  178. package/grapesjs-plugins/grapesjs-data-source/integration-tests/base/website.json +79 -0
  179. package/grapesjs-plugins/grapesjs-data-source/integration-tests/countries-lists/graphql-response.json +1056 -0
  180. package/grapesjs-plugins/grapesjs-data-source/integration-tests/countries-lists/graphql-types.json +2095 -0
  181. package/grapesjs-plugins/grapesjs-data-source/integration-tests/countries-lists/preview.html +36 -0
  182. package/grapesjs-plugins/grapesjs-data-source/integration-tests/countries-lists/website.json +422 -0
  183. package/grapesjs-plugins/grapesjs-data-source/integration-tests/example.graphql-result.json +18718 -0
  184. package/grapesjs-plugins/grapesjs-data-source/integration-tests/example.graphql-types.json +1955 -0
  185. package/grapesjs-plugins/grapesjs-data-source/integration-tests/graphql-modules.json +191 -0
  186. package/grapesjs-plugins/grapesjs-data-source/integration-tests/modules.html +45 -0
  187. package/grapesjs-plugins/grapesjs-data-source/integration-tests/visibility-truthy/graphql-response.json +1056 -0
  188. package/grapesjs-plugins/grapesjs-data-source/integration-tests/visibility-truthy/graphql-types.json +2095 -0
  189. package/grapesjs-plugins/grapesjs-data-source/integration-tests/visibility-truthy/preview.html +31 -0
  190. package/grapesjs-plugins/grapesjs-data-source/integration-tests/visibility-truthy/website.json +261 -0
  191. package/grapesjs-plugins/grapesjs-data-source/integration-tests/website-modules.json +650 -0
  192. package/grapesjs-plugins/grapesjs-data-source/jest.config.js +21 -0
  193. package/grapesjs-plugins/grapesjs-data-source/package-lock.json +13182 -0
  194. package/grapesjs-plugins/grapesjs-data-source/package.json +77 -0
  195. package/grapesjs-plugins/grapesjs-data-source/src/api.ts +386 -0
  196. package/grapesjs-plugins/grapesjs-data-source/src/capabilities.ts +80 -0
  197. package/grapesjs-plugins/grapesjs-data-source/src/commands.ts +269 -0
  198. package/grapesjs-plugins/grapesjs-data-source/src/datasources/GraphQL.ts +1039 -0
  199. package/grapesjs-plugins/grapesjs-data-source/src/datasources/graphql-introspection-query.ts +112 -0
  200. package/grapesjs-plugins/grapesjs-data-source/src/datasources/graphql.test.ts +657 -0
  201. package/grapesjs-plugins/grapesjs-data-source/src/filters/index.ts +102 -0
  202. package/grapesjs-plugins/grapesjs-data-source/src/filters/liquid.test.ts +27 -0
  203. package/grapesjs-plugins/grapesjs-data-source/src/filters/liquid.ts +985 -0
  204. package/grapesjs-plugins/grapesjs-data-source/src/index.ts +103 -0
  205. package/grapesjs-plugins/grapesjs-data-source/src/integration.test.ts +504 -0
  206. package/grapesjs-plugins/grapesjs-data-source/src/model/ExpressionTree.ts +251 -0
  207. package/grapesjs-plugins/grapesjs-data-source/src/model/completion.ts +213 -0
  208. package/grapesjs-plugins/grapesjs-data-source/src/model/dataSourceManager.ts +315 -0
  209. package/grapesjs-plugins/grapesjs-data-source/src/model/dataSourceRegistry.test.ts +170 -0
  210. package/grapesjs-plugins/grapesjs-data-source/src/model/dataSourceRegistry.ts +117 -0
  211. package/grapesjs-plugins/grapesjs-data-source/src/model/expressionEvaluator.ts +241 -0
  212. package/grapesjs-plugins/grapesjs-data-source/src/model/previewDataLoader.ts +196 -0
  213. package/grapesjs-plugins/grapesjs-data-source/src/model/queryBuilder.ts +118 -0
  214. package/grapesjs-plugins/grapesjs-data-source/src/model/state.test.ts +76 -0
  215. package/grapesjs-plugins/grapesjs-data-source/src/model/state.ts +243 -0
  216. package/grapesjs-plugins/grapesjs-data-source/src/model/token.ts +336 -0
  217. package/grapesjs-plugins/grapesjs-data-source/src/storage.test.ts +81 -0
  218. package/grapesjs-plugins/grapesjs-data-source/src/storage.ts +55 -0
  219. package/grapesjs-plugins/grapesjs-data-source/src/test-data.ts +154 -0
  220. package/grapesjs-plugins/grapesjs-data-source/src/types.ts +299 -0
  221. package/grapesjs-plugins/grapesjs-data-source/src/utils.test.ts +46 -0
  222. package/grapesjs-plugins/grapesjs-data-source/src/utils.ts +367 -0
  223. package/grapesjs-plugins/grapesjs-data-source/src/view/canvas.ts +718 -0
  224. package/grapesjs-plugins/grapesjs-data-source/src/view/custom-states-editor.ts +371 -0
  225. package/grapesjs-plugins/grapesjs-data-source/src/view/defaultStyles.ts +432 -0
  226. package/grapesjs-plugins/grapesjs-data-source/src/view/index.ts +168 -0
  227. package/grapesjs-plugins/grapesjs-data-source/src/view/properties-editor.ts +249 -0
  228. package/grapesjs-plugins/grapesjs-data-source/src/view/settings.ts +1551 -0
  229. package/grapesjs-plugins/grapesjs-data-source/src/view/state-editor.ts +528 -0
  230. package/grapesjs-plugins/grapesjs-data-source/strapi/.editorconfig +16 -0
  231. package/grapesjs-plugins/grapesjs-data-source/strapi/.env.example +7 -0
  232. package/grapesjs-plugins/grapesjs-data-source/strapi/.eslintignore +3 -0
  233. package/grapesjs-plugins/grapesjs-data-source/strapi/.eslintrc +27 -0
  234. package/grapesjs-plugins/grapesjs-data-source/strapi/README.md +57 -0
  235. package/grapesjs-plugins/grapesjs-data-source/strapi/config/admin.js +13 -0
  236. package/grapesjs-plugins/grapesjs-data-source/strapi/config/api.js +7 -0
  237. package/grapesjs-plugins/grapesjs-data-source/strapi/config/database.js +92 -0
  238. package/grapesjs-plugins/grapesjs-data-source/strapi/config/middlewares.js +12 -0
  239. package/grapesjs-plugins/grapesjs-data-source/strapi/config/server.js +10 -0
  240. package/grapesjs-plugins/grapesjs-data-source/strapi/database/migrations/.gitkeep +0 -0
  241. package/grapesjs-plugins/grapesjs-data-source/strapi/favicon.png +0 -0
  242. package/grapesjs-plugins/grapesjs-data-source/strapi/jsconfig.json +8 -0
  243. package/grapesjs-plugins/grapesjs-data-source/strapi/package.json +31 -0
  244. package/grapesjs-plugins/grapesjs-data-source/strapi/public/robots.txt +3 -0
  245. package/grapesjs-plugins/grapesjs-data-source/strapi/public/uploads/.gitkeep +0 -0
  246. package/grapesjs-plugins/grapesjs-data-source/strapi/src/admin/app.example.js +39 -0
  247. package/grapesjs-plugins/grapesjs-data-source/strapi/src/admin/webpack.config.example.js +9 -0
  248. package/grapesjs-plugins/grapesjs-data-source/strapi/src/api/.gitkeep +0 -0
  249. package/grapesjs-plugins/grapesjs-data-source/strapi/src/api/post/content-types/post/schema.json +26 -0
  250. package/grapesjs-plugins/grapesjs-data-source/strapi/src/api/post/controllers/post.js +9 -0
  251. package/grapesjs-plugins/grapesjs-data-source/strapi/src/api/post/routes/post.js +9 -0
  252. package/grapesjs-plugins/grapesjs-data-source/strapi/src/api/post/services/post.js +9 -0
  253. package/grapesjs-plugins/grapesjs-data-source/strapi/src/extensions/.gitkeep +0 -0
  254. package/grapesjs-plugins/grapesjs-data-source/strapi/src/index.js +20 -0
  255. package/grapesjs-plugins/grapesjs-data-source/strapi/types/generated/components.d.ts +5 -0
  256. package/grapesjs-plugins/grapesjs-data-source/strapi/types/generated/contentTypes.d.ts +723 -0
  257. package/grapesjs-plugins/grapesjs-data-source/tmp/countries-lists.html +1 -0
  258. package/grapesjs-plugins/grapesjs-data-source/tsconfig.cjs.json +8 -0
  259. package/grapesjs-plugins/grapesjs-data-source/tsconfig.json +49 -0
  260. package/grapesjs-plugins/grapesjs-filter-styles/README.md +137 -0
  261. package/grapesjs-plugins/grapesjs-filter-styles/eslint.config.mjs +35 -0
  262. package/grapesjs-plugins/grapesjs-filter-styles/package-lock.json +8927 -0
  263. package/grapesjs-plugins/grapesjs-filter-styles/package.json +40 -0
  264. package/grapesjs-plugins/grapesjs-filter-styles/src/index.js +283 -0
  265. package/grapesjs-plugins/grapesjs-filter-styles/tsconfig.json +26 -0
  266. package/grapesjs-plugins/grapesjs-fonts/.eslintrc.json +31 -0
  267. package/grapesjs-plugins/grapesjs-fonts/LICENSE +9 -0
  268. package/grapesjs-plugins/grapesjs-fonts/README.md +231 -0
  269. package/grapesjs-plugins/grapesjs-fonts/_index.html +95 -0
  270. package/grapesjs-plugins/grapesjs-fonts/package-lock.json +9024 -0
  271. package/grapesjs-plugins/grapesjs-fonts/package.json +46 -0
  272. package/grapesjs-plugins/grapesjs-fonts/src/capabilities.js +61 -0
  273. package/grapesjs-plugins/grapesjs-fonts/src/commands.js +100 -0
  274. package/grapesjs-plugins/grapesjs-fonts/src/fonts.js +396 -0
  275. package/grapesjs-plugins/grapesjs-fonts/src/index.js +34 -0
  276. package/grapesjs-plugins/grapesjs-fonts/src/locale/en.js +19 -0
  277. package/grapesjs-plugins/grapesjs-fonts/src/locale/fr.js +21 -0
  278. package/grapesjs-plugins/grapesjs-fonts/src/locale/ptbr.js +18 -0
  279. package/grapesjs-plugins/grapesjs-fonts/tsconfig.json +29 -0
  280. package/grapesjs-plugins/grapesjs-keymaps-dialog/README.md +116 -0
  281. package/grapesjs-plugins/grapesjs-keymaps-dialog/package.json +46 -0
  282. package/grapesjs-plugins/grapesjs-keymaps-dialog/src/KeymapsDialog.ts +208 -0
  283. package/grapesjs-plugins/grapesjs-keymaps-dialog/src/KeymapsDialogManager.ts +78 -0
  284. package/grapesjs-plugins/grapesjs-keymaps-dialog/src/index.ts +70 -0
  285. package/grapesjs-plugins/grapesjs-keymaps-dialog/tsconfig.json +29 -0
  286. package/grapesjs-plugins/grapesjs-loading/.eslintrc.json +22 -0
  287. package/grapesjs-plugins/grapesjs-loading/README.md +140 -0
  288. package/grapesjs-plugins/grapesjs-loading/_index.html +90 -0
  289. package/grapesjs-plugins/grapesjs-loading/eslint.config.mjs +20 -0
  290. package/grapesjs-plugins/grapesjs-loading/grapesjs-loading.gif +0 -0
  291. package/grapesjs-plugins/grapesjs-loading/package.json +50 -0
  292. package/grapesjs-plugins/grapesjs-loading/src/index.ts +54 -0
  293. package/grapesjs-plugins/grapesjs-loading/tsconfig.json +20 -0
  294. package/grapesjs-plugins/grapesjs-notifications/LICENSE +661 -0
  295. package/grapesjs-plugins/grapesjs-notifications/README.md +295 -0
  296. package/grapesjs-plugins/grapesjs-notifications/_index.html +95 -0
  297. package/grapesjs-plugins/grapesjs-notifications/package-lock.json +8187 -0
  298. package/grapesjs-plugins/grapesjs-notifications/package.json +58 -0
  299. package/grapesjs-plugins/grapesjs-notifications/src/Notification.ts +117 -0
  300. package/grapesjs-plugins/grapesjs-notifications/src/NotificationManager.ts +93 -0
  301. package/grapesjs-plugins/grapesjs-notifications/src/Storage.ts +26 -0
  302. package/grapesjs-plugins/grapesjs-notifications/src/capabilities.ts +33 -0
  303. package/grapesjs-plugins/grapesjs-notifications/src/commands.ts +5 -0
  304. package/grapesjs-plugins/grapesjs-notifications/src/index.ts +126 -0
  305. package/grapesjs-plugins/grapesjs-notifications/src/locale/en.js +8 -0
  306. package/grapesjs-plugins/grapesjs-notifications/src/view.ts +127 -0
  307. package/grapesjs-plugins/grapesjs-notifications/tsconfig.json +30 -0
  308. package/grapesjs-plugins/grapesjs-storage-rate-limit/LICENSE +213 -0
  309. package/grapesjs-plugins/grapesjs-storage-rate-limit/README.md +119 -0
  310. package/grapesjs-plugins/grapesjs-storage-rate-limit/jest.config.js +197 -0
  311. package/grapesjs-plugins/grapesjs-storage-rate-limit/package-lock.json +10752 -0
  312. package/grapesjs-plugins/grapesjs-storage-rate-limit/package.json +44 -0
  313. package/grapesjs-plugins/grapesjs-storage-rate-limit/src/index.js +90 -0
  314. package/grapesjs-plugins/grapesjs-storage-rate-limit/src/index.test.js +122 -0
  315. package/grapesjs-plugins/grapesjs-symbols/.eslintrc.cjs +20 -0
  316. package/grapesjs-plugins/grapesjs-symbols/.husky/pre-commit +5 -0
  317. package/grapesjs-plugins/grapesjs-symbols/.nvmrc +1 -0
  318. package/grapesjs-plugins/grapesjs-symbols/LICENSE +661 -0
  319. package/grapesjs-plugins/grapesjs-symbols/README.md +228 -0
  320. package/grapesjs-plugins/grapesjs-symbols/_index.html +104 -0
  321. package/grapesjs-plugins/grapesjs-symbols/es5.html +119 -0
  322. package/grapesjs-plugins/grapesjs-symbols/es6.html +107 -0
  323. package/grapesjs-plugins/grapesjs-symbols/eslint.config.mjs +72 -0
  324. package/grapesjs-plugins/grapesjs-symbols/jest.config.js +12 -0
  325. package/grapesjs-plugins/grapesjs-symbols/package-lock.json +6867 -0
  326. package/grapesjs-plugins/grapesjs-symbols/package.json +73 -0
  327. package/grapesjs-plugins/grapesjs-symbols/rollup.config.mjs +26 -0
  328. package/grapesjs-plugins/grapesjs-symbols/src/SymbolsCommands.test.ts +147 -0
  329. package/grapesjs-plugins/grapesjs-symbols/src/SymbolsCommands.ts +144 -0
  330. package/grapesjs-plugins/grapesjs-symbols/src/capabilities.ts +50 -0
  331. package/grapesjs-plugins/grapesjs-symbols/src/events.ts +8 -0
  332. package/grapesjs-plugins/grapesjs-symbols/src/id-utils.ts +158 -0
  333. package/grapesjs-plugins/grapesjs-symbols/src/index.ts +46 -0
  334. package/grapesjs-plugins/grapesjs-symbols/src/test-utils.ts +51 -0
  335. package/grapesjs-plugins/grapesjs-symbols/src/utils.test.ts +118 -0
  336. package/grapesjs-plugins/grapesjs-symbols/src/utils.ts +90 -0
  337. package/grapesjs-plugins/grapesjs-symbols/src/view/SymbolsView.ts +251 -0
  338. package/grapesjs-plugins/grapesjs-symbols/src/view/traits.ts +101 -0
  339. package/grapesjs-plugins/grapesjs-symbols/tsconfig.json +35 -0
  340. package/grapesjs-plugins/grapesjs-symbols/tsconfig.test.json +12 -0
  341. package/grapesjs-plugins/grapesjs-version-flow/LICENSE +661 -0
  342. package/grapesjs-plugins/grapesjs-version-flow/README.md +422 -0
  343. package/grapesjs-plugins/grapesjs-version-flow/_index.html +494 -0
  344. package/grapesjs-plugins/grapesjs-version-flow/babel.config.js +9 -0
  345. package/grapesjs-plugins/grapesjs-version-flow/package-lock.json +11832 -0
  346. package/grapesjs-plugins/grapesjs-version-flow/package.json +77 -0
  347. package/grapesjs-plugins/grapesjs-version-flow/prompts/initial.txt +116 -0
  348. package/grapesjs-plugins/grapesjs-version-flow/src/event-system.js +48 -0
  349. package/grapesjs-plugins/grapesjs-version-flow/src/index.js +87 -0
  350. package/grapesjs-plugins/grapesjs-version-flow/src/locale/en.js +26 -0
  351. package/grapesjs-plugins/grapesjs-version-flow/src/locale/fr.js +26 -0
  352. package/grapesjs-plugins/grapesjs-version-flow/src/modal-ui.js +562 -0
  353. package/grapesjs-plugins/grapesjs-version-flow/src/style-manager.js +240 -0
  354. package/grapesjs-plugins/grapesjs-version-flow/src/upgrade-engine.js +237 -0
  355. package/grapesjs-plugins/grapesjs-version-flow/src/version-manager.js +117 -0
  356. package/grapesjs-plugins/grapesjs-version-flow/tests/index.test.js +241 -0
  357. package/grapesjs-plugins/grapesjs-version-flow/tests/integration.test.js +227 -0
  358. package/grapesjs-plugins/grapesjs-version-flow/tests/setup.js +67 -0
  359. package/grapesjs-plugins/grapesjs-version-flow/tests/upgrade-engine.test.js +360 -0
  360. package/grapesjs-plugins/grapesjs-version-flow/tests/version-manager.test.js +168 -0
  361. package/grapesjs-plugins/grapesjs-version-flow/tests/version-storage.test.js +203 -0
  362. package/grapesjs-plugins/grapesjs-version-flow/tsconfig.json +26 -0
  363. package/package.json +127 -159
  364. package/{src/ts/server → server}/api/api.ts +6 -6
  365. package/{src/ts/server → server}/api/connectorApi.ts +5 -5
  366. package/{src/ts/server → server}/api/publicationApi.ts +7 -7
  367. package/{src/ts/server → server}/api/websiteApi.ts +7 -8
  368. package/{src/ts/server → server}/config.ts +14 -12
  369. package/{src/ts/server → server}/connectors/FsHosting.ts +4 -4
  370. package/{src/ts/server → server}/connectors/FsStorage.test.ts +2 -2
  371. package/{src/ts/server → server}/connectors/FsStorage.ts +8 -8
  372. package/{src/ts/server → server}/connectors/connectors.ts +3 -3
  373. package/server/deploy/.nvmrc +1 -0
  374. package/server/deploy/.silex.js +220 -0
  375. package/server/deploy/client-config.js +17 -0
  376. package/server/deploy/client-plugins/.gitkeep +0 -0
  377. package/server/deploy/client-plugins/onboarding.js +67 -0
  378. package/server/deploy/example.env +25 -0
  379. package/server/deploy/onboarding.json +22 -0
  380. package/server/deploy/picto-silex@3x.png +0 -0
  381. package/server/deploy/server-plugins/dashboard.js +74 -0
  382. package/server/deploy/server-plugins/onboarding.js +212 -0
  383. package/server/deploy/silex-platform.yml +75 -0
  384. package/{src/ts/server → server}/events.ts +2 -2
  385. package/{src/ts/server → server}/expose.ts +1 -1
  386. package/{src/ts/server → server}/express.ts +2 -2
  387. package/{src/ts/server → server}/index.ts +7 -7
  388. package/{src/ts/server → server}/jobs.test.ts +1 -1
  389. package/{src/ts/server → server}/jobs.ts +1 -1
  390. package/server/plugins/DownloadConnector.publish.test.ts +32 -0
  391. package/server/plugins/DownloadConnector.test.ts +70 -0
  392. package/{src/ts/plugins/server → server/plugins}/DownloadConnector.ts +22 -10
  393. package/{src/ts/plugins/server → server/plugins}/FtpConnector.test.ts +3 -3
  394. package/{src/ts/plugins/server → server/plugins}/FtpConnector.ts +7 -7
  395. package/{src/ts/plugins/server → server/plugins}/GitlabConnector.ts +9 -26
  396. package/{src/ts/plugins/server → server/plugins}/GitlabHostingConnector.ts +5 -5
  397. package/{src/ts/plugins/server → server/plugins}/SslPlugin.ts +2 -2
  398. package/{src/ts/plugins/server → server/plugins}/StaticPlugin.ts +2 -2
  399. package/{src/ts/server → server}/utils/BackwardCompat.ts +1 -1
  400. package/{src/ts/server → server}/utils/websiteDataSerialization.test.ts +2 -2
  401. package/{src/ts/server → server}/utils/websiteDataSerialization.ts +3 -3
  402. package/.silex.js +0 -76
  403. package/dist/client/client/api.d.ts +0 -101
  404. package/dist/client/client/assetUrl.d.ts +0 -60
  405. package/dist/client/client/config.d.ts +0 -110
  406. package/dist/client/client/events.d.ts +0 -23
  407. package/dist/client/client/expose.d.ts +0 -10
  408. package/dist/client/client/grapesjs/LoginDialog.d.ts +0 -15
  409. package/dist/client/client/grapesjs/PublicationManager.d.ts +0 -117
  410. package/dist/client/client/grapesjs/PublicationUi.d.ts +0 -59
  411. package/dist/client/client/grapesjs/blocks.d.ts +0 -1
  412. package/dist/client/client/grapesjs/body-remap.d.ts +0 -15
  413. package/dist/client/client/grapesjs/breadcrumbs.d.ts +0 -1
  414. package/dist/client/client/grapesjs/cms/DataSource.d.ts +0 -43
  415. package/dist/client/client/grapesjs/cms/blocks.d.ts +0 -2
  416. package/dist/client/client/grapesjs/cms/buttons.d.ts +0 -2
  417. package/dist/client/client/grapesjs/cms/collection-pages.d.ts +0 -4
  418. package/dist/client/client/grapesjs/cms/config.d.ts +0 -9
  419. package/dist/client/client/grapesjs/cms/filters.d.ts +0 -3
  420. package/dist/client/client/grapesjs/cms/index.d.ts +0 -43
  421. package/dist/client/client/grapesjs/cms/liquid.d.ts +0 -73
  422. package/dist/client/client/grapesjs/cms/page-settings.d.ts +0 -6
  423. package/dist/client/client/grapesjs/cms/publication.d.ts +0 -60
  424. package/dist/client/client/grapesjs/cms/site-settings.d.ts +0 -3
  425. package/dist/client/client/grapesjs/cms/states.d.ts +0 -8
  426. package/dist/client/client/grapesjs/cms/traits.d.ts +0 -8
  427. package/dist/client/client/grapesjs/core-commands.d.ts +0 -3
  428. package/dist/client/client/grapesjs/css-props.d.ts +0 -6
  429. package/dist/client/client/grapesjs/flex.d.ts +0 -3
  430. package/dist/client/client/grapesjs/footer.d.ts +0 -2
  431. package/dist/client/client/grapesjs/img.d.ts +0 -6
  432. package/dist/client/client/grapesjs/index.d.ts +0 -9
  433. package/dist/client/client/grapesjs/internal-links.d.ts +0 -1
  434. package/dist/client/client/grapesjs/keymaps.d.ts +0 -123
  435. package/dist/client/client/grapesjs/li.d.ts +0 -7
  436. package/dist/client/client/grapesjs/new-page-dialog.d.ts +0 -2
  437. package/dist/client/client/grapesjs/openImport.d.ts +0 -9
  438. package/dist/client/client/grapesjs/page-panel.d.ts +0 -13
  439. package/dist/client/client/grapesjs/project-bar.d.ts +0 -21
  440. package/dist/client/client/grapesjs/resize-panel.d.ts +0 -1
  441. package/dist/client/client/grapesjs/rich-text.d.ts +0 -4
  442. package/dist/client/client/grapesjs/sectors.d.ts +0 -12
  443. package/dist/client/client/grapesjs/semantic.d.ts +0 -1
  444. package/dist/client/client/grapesjs/settings-sections.d.ts +0 -19
  445. package/dist/client/client/grapesjs/settings.d.ts +0 -16
  446. package/dist/client/client/grapesjs/storage.d.ts +0 -3
  447. package/dist/client/client/grapesjs/symbolDialogs.d.ts +0 -4
  448. package/dist/client/client/grapesjs/upload-progress.d.ts +0 -2
  449. package/dist/client/client/grapesjs/view-buttons.d.ts +0 -2
  450. package/dist/client/client/index.d.ts +0 -10
  451. package/dist/client/client/publication-transformers.d.ts +0 -42
  452. package/dist/client/client/publish-custom-code-block.d.ts +0 -4
  453. package/dist/client/client/publish-fonts.d.ts +0 -4
  454. package/dist/client/client/utils.d.ts +0 -23
  455. package/dist/client/constants.d.ts +0 -35
  456. package/dist/client/page.d.ts +0 -2
  457. package/dist/client/types.d.ts +0 -365
  458. package/dist/client/webfonts/fa-brands-400.ttf +0 -0
  459. package/dist/client/webfonts/fa-regular-400.ttf +0 -0
  460. package/dist/client/webfonts/fa-solid-900.ttf +0 -0
  461. package/dist/client/webfonts/fa-v4compatibility.ttf +0 -0
  462. package/dist/plugins/client/client/events.d.ts +0 -23
  463. package/dist/plugins/client/client/events.js +0 -43
  464. package/dist/plugins/client/client/events.js.map +0 -1
  465. package/dist/plugins/client/plugins/client/template.d.ts +0 -2
  466. package/dist/plugins/client/plugins/client/template.js +0 -234
  467. package/dist/plugins/client/plugins/client/template.js.map +0 -1
  468. package/dist/plugins/client/plugins/client/website-info.d.ts +0 -1
  469. package/dist/plugins/client/plugins/client/website-info.js +0 -72
  470. package/dist/plugins/client/plugins/client/website-info.js.map +0 -1
  471. package/dist/plugins/client/types.d.ts +0 -365
  472. package/dist/plugins/client/types.js +0 -83
  473. package/dist/plugins/client/types.js.map +0 -1
  474. package/dist/plugins/server/constants.d.ts +0 -35
  475. package/dist/plugins/server/constants.js +0 -79
  476. package/dist/plugins/server/constants.js.map +0 -1
  477. package/dist/plugins/server/page.d.ts +0 -2
  478. package/dist/plugins/server/page.js +0 -35
  479. package/dist/plugins/server/page.js.map +0 -1
  480. package/dist/plugins/server/plugins/server/Cache.d.ts +0 -2
  481. package/dist/plugins/server/plugins/server/Cache.js +0 -36
  482. package/dist/plugins/server/plugins/server/Cache.js.map +0 -1
  483. package/dist/plugins/server/plugins/server/DownloadConnector.d.ts +0 -29
  484. package/dist/plugins/server/plugins/server/DownloadConnector.js.map +0 -1
  485. package/dist/plugins/server/plugins/server/FtpConnector.d.ts +0 -86
  486. package/dist/plugins/server/plugins/server/FtpConnector.js.map +0 -1
  487. package/dist/plugins/server/plugins/server/GitlabConnector.d.ts +0 -172
  488. package/dist/plugins/server/plugins/server/GitlabConnector.js.map +0 -1
  489. package/dist/plugins/server/plugins/server/GitlabHostingConnector.d.ts +0 -23
  490. package/dist/plugins/server/plugins/server/GitlabHostingConnector.js.map +0 -1
  491. package/dist/plugins/server/plugins/server/PublicationOptimizer.js +0 -14
  492. package/dist/plugins/server/plugins/server/PublicationOptimizer.js.map +0 -1
  493. package/dist/plugins/server/plugins/server/SslPlugin.d.ts +0 -1
  494. package/dist/plugins/server/plugins/server/SslPlugin.js.map +0 -1
  495. package/dist/plugins/server/plugins/server/StaticPlugin.d.ts +0 -8
  496. package/dist/plugins/server/plugins/server/StaticPlugin.js.map +0 -1
  497. package/dist/plugins/server/server/config.d.ts +0 -59
  498. package/dist/plugins/server/server/config.js +0 -181
  499. package/dist/plugins/server/server/config.js.map +0 -1
  500. package/dist/plugins/server/server/connectors/FsHosting.d.ts +0 -14
  501. package/dist/plugins/server/server/connectors/FsHosting.js +0 -66
  502. package/dist/plugins/server/server/connectors/FsHosting.js.map +0 -1
  503. package/dist/plugins/server/server/connectors/FsStorage.d.ts +0 -44
  504. package/dist/plugins/server/server/connectors/FsStorage.js +0 -303
  505. package/dist/plugins/server/server/connectors/FsStorage.js.map +0 -1
  506. package/dist/plugins/server/server/connectors/connectors.d.ts +0 -86
  507. package/dist/plugins/server/server/connectors/connectors.js +0 -126
  508. package/dist/plugins/server/server/connectors/connectors.js.map +0 -1
  509. package/dist/plugins/server/server/events.d.ts +0 -26
  510. package/dist/plugins/server/server/events.js +0 -31
  511. package/dist/plugins/server/server/events.js.map +0 -1
  512. package/dist/plugins/server/server/jobs.d.ts +0 -12
  513. package/dist/plugins/server/server/jobs.js +0 -79
  514. package/dist/plugins/server/server/jobs.js.map +0 -1
  515. package/dist/plugins/server/server/utils/validation.d.ts +0 -7
  516. package/dist/plugins/server/server/utils/validation.js +0 -37
  517. package/dist/plugins/server/server/utils/validation.js.map +0 -1
  518. package/dist/plugins/server/server/utils/websiteDataSerialization.d.ts +0 -24
  519. package/dist/plugins/server/server/utils/websiteDataSerialization.js +0 -136
  520. package/dist/plugins/server/server/utils/websiteDataSerialization.js.map +0 -1
  521. package/dist/plugins/server/types.d.ts +0 -365
  522. package/dist/plugins/server/types.js +0 -87
  523. package/dist/plugins/server/types.js.map +0 -1
  524. package/dist/server/server/cli.js +0 -71
  525. package/src/css/grapesjs-light.scss +0 -180
  526. package/src/ts/plugins/client/template.ts +0 -246
  527. package/src/ts/plugins/client/website-info.ts +0 -84
  528. package/src/ts/server/cli.ts +0 -67
  529. /package/{src/ts → common}/constants.ts +0 -0
  530. /package/{src/ts → common}/externs.ts +0 -0
  531. /package/{src/ts → common}/page.ts +0 -0
  532. /package/{src/ts → common}/types.ts +0 -0
  533. /package/dist/server/{constants.js → common/constants.js} +0 -0
  534. /package/dist/server/{page.js → common/page.js} +0 -0
  535. /package/dist/server/{types.js → common/types.js} +0 -0
  536. /package/dist/server/{plugins/server → server/plugins}/Cache.js +0 -0
  537. /package/{src → editor}/css/_mixins.scss +0 -0
  538. /package/{src → editor}/css/_variables.scss +0 -0
  539. /package/{src → editor}/css/dialog.scss +0 -0
  540. /package/{src → editor}/css/dialogs.scss +0 -0
  541. /package/{src → editor}/css/fonts.scss +0 -0
  542. /package/{src → editor}/css/footer.scss +0 -0
  543. /package/{src → editor}/css/grapesjs-plugins.scss +0 -0
  544. /package/{src → editor}/css/grapesjs.scss +0 -0
  545. /package/{src → editor}/css/loader.scss +0 -0
  546. /package/{src → editor}/css/page-panel.scss +0 -0
  547. /package/{src → editor}/css/panels.scss +0 -0
  548. /package/{src → editor}/css/silex.scss +0 -0
  549. /package/{src → editor}/css/theme-base.scss +0 -0
  550. /package/{src → editor}/css/website-info.scss +0 -0
  551. /package/{src/ts/client → editor}/events.ts +0 -0
  552. /package/{src/ts/client → editor}/grapesjs/blocks.ts +0 -0
  553. /package/{src/ts/client → editor}/grapesjs/body-remap.ts +0 -0
  554. /package/{src/ts/client → editor}/grapesjs/breadcrumbs.ts +0 -0
  555. /package/{src/ts/client → editor}/grapesjs/cms/DataSource.ts +0 -0
  556. /package/{src/ts/client → editor}/grapesjs/cms/blocks.ts +0 -0
  557. /package/{src/ts/client → editor}/grapesjs/cms/buttons.ts +0 -0
  558. /package/{src/ts/client → editor}/grapesjs/cms/collection-pages.ts +0 -0
  559. /package/{src/ts/client → editor}/grapesjs/cms/config.ts +0 -0
  560. /package/{src/ts/client → editor}/grapesjs/cms/filters.ts +0 -0
  561. /package/{src/ts/client → editor}/grapesjs/cms/liquid.mock.ts +0 -0
  562. /package/{src/ts/client → editor}/grapesjs/cms/liquid.test.ts +0 -0
  563. /package/{src/ts/client → editor}/grapesjs/cms/liquid.ts +0 -0
  564. /package/{src/ts/client → editor}/grapesjs/cms/publication.test.ts +0 -0
  565. /package/{src/ts/client → editor}/grapesjs/cms/site-settings.ts +0 -0
  566. /package/{src/ts/client → editor}/grapesjs/cms/states.ts +0 -0
  567. /package/{src/ts/client → editor}/grapesjs/cms/traits.ts +0 -0
  568. /package/{src/ts/client → editor}/grapesjs/core-commands.ts +0 -0
  569. /package/{src/ts/client → editor}/grapesjs/css-props.ts +0 -0
  570. /package/{src/ts/client → editor}/grapesjs/flex.ts +0 -0
  571. /package/{src/ts/client → editor}/grapesjs/footer.ts +0 -0
  572. /package/{src/ts/client → editor}/grapesjs/img.ts +0 -0
  573. /package/{src/ts/client → editor}/grapesjs/internal-links.test.ts +0 -0
  574. /package/{src/ts/client → editor}/grapesjs/keymaps.ts +0 -0
  575. /package/{src/ts/client → editor}/grapesjs/li.ts +0 -0
  576. /package/{src/ts/client → editor}/grapesjs/new-page-dialog.ts +0 -0
  577. /package/{src/ts/client → editor}/grapesjs/openImport.ts +0 -0
  578. /package/{src/ts/client → editor}/grapesjs/page-panel.ts +0 -0
  579. /package/{src/ts/client → editor}/grapesjs/project-bar.ts +0 -0
  580. /package/{src/ts/client → editor}/grapesjs/rich-text.ts +0 -0
  581. /package/{src/ts/client → editor}/grapesjs/sectors.ts +0 -0
  582. /package/{src/ts/client → editor}/grapesjs/semantic.ts +0 -0
  583. /package/{src/ts/client → editor}/grapesjs/static-plugins.ts +0 -0
  584. /package/{src/ts/client → editor}/grapesjs/symbolDialogs.ts +0 -0
  585. /package/{src/ts/client → editor}/grapesjs/upload-progress.ts +0 -0
  586. /package/{src/ts/client → editor}/grapesjs/view-buttons.ts +0 -0
  587. /package/{src → editor}/html/debug.pug +0 -0
  588. /package/{src → editor}/html/index.pug +0 -0
  589. /package/{src → editor}/html/templates/includes.pug +0 -0
  590. /package/{src → editor}/html/templates/workspace.pug +0 -0
  591. /package/{src/ts/client → editor}/publish-custom-code-block.ts +0 -0
  592. /package/{src/ts/client → editor}/utils.ts +0 -0
  593. /package/{dist/plugins/server/plugins/server/PublicationOptimizer.d.ts → grapesjs-plugins/expression-input/docs/.nojekyll} +0 -0
  594. /package/{src/ts/plugins/server → server/plugins}/Cache.ts +0 -0
  595. /package/{src/ts/plugins/server → server/plugins}/PublicationOptimizer.ts +0 -0
  596. /package/{src/ts/server → server}/utils/validation.ts +0 -0
@@ -0,0 +1,674 @@
1
+ # GrapesJs Data Source plugin
2
+
3
+ This GrapesJS plugin integrates various APIs into the editor, providing powerful data-driven website building capabilities.
4
+
5
+ It makes a new [expressions UI](#expressions-ui) available to the user so that she can manage custom states on components, linking them to data from a CMS or a data base or an API.
6
+
7
+ The plugin also has data management features needed to manage component states, expressions made of tokens, build queries from component states, and render dynamic content on the canvas.
8
+
9
+ Finally there is a [settings dialog](#settings-dialog) to manage the data sources and save them with the website.
10
+
11
+ > This code is part of a larger project: [about Silex v3](https://www.silexlabs.org/silex-v3-kickoff/)
12
+
13
+ [DEMO](https://codepen.io/lexoyo/full/xxMbxeB)
14
+
15
+ Discussions, bug reports in [Silex community forums](https://community.silex.me/) or [GitHub issues](https://github.com/silexlabs/grapesjs-data-source/issues)
16
+
17
+ ## Features
18
+
19
+ * ✅ **Import data from data source** (GraphQL APIs) in the editor
20
+ * ✅ **Configure data sources** from config and runtime
21
+ * ✅ **Data source management dialog** to add, edit, and test data sources
22
+ * ✅ **Dynamic component properties** - Edit attributes, innerHTML, visibility conditions, and loops
23
+ * ✅ **State management** - Create reusable states and expressions
24
+ * ✅ **Liquid filters** - Transform data with built-in and custom filters
25
+ * ✅ **GraphQL query generation** - Automatically generate optimized queries from component states
26
+ * ✅ **Data persistence** - Save data sources with website data
27
+ * ✅ **Real-time canvas preview** - See live data on the canvas with loop rendering and conditional visibility
28
+ * ✅ **Loop rendering** - Duplicate components for each item in arrays with proper indexing
29
+ * ✅ **Visibility conditions** - Show/hide components based on data conditions with binary and unary operators
30
+ * ✅ **Interactive canvas** - Click on loop instances to select and edit original template components
31
+ * ✅ **Preview controls** - Commands to activate/deactivate/refresh data preview on canvas
32
+ * ✅ **Nested loops** - Support for loops within loops with proper context management
33
+ * ✅ **Compatible** with [GrapesJS notifications plugin](https://github.com/silexlabs/grapesjs-notifications)
34
+ * ✅ **Comprehensive API** - Events and functions to manage data, expressions, and queries
35
+ * ✅ **Expression editor** - Web component for building and editing expressions
36
+ * 🔄 **Add more liquid filters** (ongoing)
37
+ * 🔄 **Add more data sources** (REST, Open API) (planned)
38
+
39
+ ## Supported CMS and APIs
40
+
41
+ This plugin suports only GraphQL for now, contribution are welcome for support of other REST specific APIs or more generic Open API
42
+
43
+ Here is [a list of GraphQL APIs you can use](https://github.com/graphql-kit/graphql-apis), it includes fake data and demo public APIs. Also consider these open source self hostable services:
44
+
45
+ * [Strapi headless CMS](https://strapi.io/)
46
+ * [Directus headless CMS](https://directus.io/)
47
+ * [Supabase database (a Firebase alternative)](https://supabase.com/)
48
+ * [Tina markdown files to GraphQL tool](https://tina.io/docs/graphql/overview/)
49
+ * [WordPress](https://wordpress.org/) with [WPGraphQL](https://www.wpgraphql.com/)
50
+ * Drupal, supabase... All have GraphQL support
51
+
52
+ Contributions welcome for documenting the use of these data sources
53
+
54
+ ## Definitions
55
+
56
+ **Expressions** are made of tokens, which are the building blocks of the expressions. Tokens are the properties of the data source, like `post.data.attributes.title` or `post.data.attributes.content`.
57
+
58
+ **States** belong to a component, they are expressions which are not output in the final website, they are made to be included in other expressions. Also they are used in the generated GraphQL query.
59
+
60
+ **Attributes** are the HTML attributes of a component, like `src` or `href` or any other attribute. Special attributes are `class` and `style` which if you put several of them will not override each other but will be merged.
61
+
62
+ **Properties** are the dynamic properties of a component which include the HTML content (innerHTML), the visibility (a condition to show or hide the component), a loop property (to repeat the component for each item in a list).
63
+
64
+ **Data source** is a service which provides the data to the editor. For now it has to be a GraphQL API, maybe I'll add open API later.
65
+
66
+ ## Included UI elements
67
+
68
+ ### Expressions UI
69
+
70
+ This UI is used to manage the states, attributes and dynamic properties of the components. It is a panel which shows the expressions of the selected component and allows the user to add, edit, and remove them.
71
+
72
+ ![Screenshot from 2024-04-26 11-18-05](https://github.com/silexlabs/Silex/assets/715377/ca61e3e6-e3ba-4000-9d15-cff9fafac0ac)
73
+
74
+ ### Settings dialog
75
+
76
+ This dialog is used to manage the data sources. It allows the user to add, edit, and remove data sources. It also allows the user to test the data sources and (comming in v2) see the data they provide.
77
+
78
+ ![Screenshot from 2024-04-26 11-16-29](https://github.com/silexlabs/Silex/assets/715377/f3fd9cd3-4732-44ef-b223-1214851da048)
79
+
80
+ ## Usage
81
+
82
+ The output of this plugin is component states which are stored on the components. This data then needs to be used by other plugins or your application. For example you can implement a "publish" feature to generate pages and data files for a static site generator or CMSs. Or you can make a vue app generator with it, by implementing a "renderer" which takes the states and adds the vue code to the generated website.
83
+
84
+ Here is how your application can use the data generated by the user with this plugin:
85
+
86
+ 1. Components states
87
+
88
+ Each component in the GrapesJS editor can have states that are classified into public and private states.
89
+
90
+ - **Public States**: These are states that are exposed to child components and can be used in expressions. The component's "states" displayed in components properties are public states: reusable in child component's expressions. The loop item and loop indexes are public states too.
91
+
92
+ - **Private States**: In contrast, private states are meant to be internal to the component. Private states are typically used for values which will be rendered with the component, i.e. innerHTML, HTML attributes, visibility condition.
93
+
94
+ ```js
95
+ import { getStateIds, getState } from '@silexlabs/grapesjs-data-source'
96
+ // ...
97
+ const component = editor.getSelected()
98
+
99
+ // Get one specific state
100
+ // innerHTML is a private state on the component, so we pass `false` for param "exported"
101
+ console.log('innerHTML state:', getState(component, 'innerHTML', false))
102
+
103
+ // Display all states of the component
104
+ const stateIdsPublic = getStateIds(component, true)
105
+ const stateIdsPrivate = getStateIds(component, false)
106
+ console.log('Public states:', stateIdsPublic.map(stateId => getState(component, stateId, true)));
107
+ console.log('Private States:', stateIdsPrivate.map(stateId => getState(component, stateId, false)));
108
+
109
+ // Detect state changes
110
+ editor.on('component:state:changed', ({state, component}) => {
111
+ console.log('State changed:', {state, component})
112
+ }
113
+ ```
114
+
115
+ Here is an example output:
116
+
117
+ ```
118
+ innerHTML state: {"expression":[{"type":"property","propType":"field","fieldId":"post","label":"post","typeIds":["PostEntityResponse"],"dataSourceId":"strapi","kind":"object","options":{"id":"1"}},{"type":"property","propType":"field","fieldId":"data","label":"data","typeIds":["PostEntity"],"dataSourceId":"strapi","kind":"object"},{"type":"property","propType":"field","fieldId":"attributes","label":"attributes","typeIds":["Post"],"dataSourceId":"strapi","kind":"object"},{"type":"property","propType":"field","fieldId":"title","label":"title","typeIds":["String"],"dataSourceId":"strapi","kind":"scalar"}]}
119
+ All states: [{"expression":[{"type":"property","propType":"field","fieldId":"post","label":"post","typeIds":["PostEntityResponse"],"dataSourceId":"strapi","kind":"object","options":{"id":"1"}},{"type":"property","propType":"field","fieldId":"data","label":"data","typeIds":["PostEntity"],"dataSourceId":"strapi","kind":"object"},{"type":"property","propType":"field","fieldId":"attributes","label":"attributes","typeIds":["Post"],"dataSourceId":"strapi","kind":"object"},{"type":"property","propType":"field","fieldId":"title","label":"title","typeIds":["String"],"dataSourceId":"strapi","kind":"scalar"}]}]
120
+ ```
121
+ 1. GraphQL query to get the data needed for the current page
122
+
123
+ This is what you need to get the resulting query for a page. It is also used to get the live preview of the data.
124
+
125
+ ```js
126
+ import { getPageQuery } from '@silexlabs/grapesjs-data-source'
127
+
128
+ // Get the current page
129
+ const page = editor.Pages.getSelected()
130
+
131
+ // Get the GraphQL query - used by both preview and 11ty site generation
132
+ const query = getPageQuery(page, editor)
133
+ console.log(query)
134
+ ```
135
+
136
+ Here is an example output:
137
+
138
+ ```json
139
+ {
140
+ "strapi": "posts {\n data {\n attributes {\n title\n content\n}\n}\n}"
141
+ }
142
+ ```
143
+
144
+ Use the API functions to handle data sources and expressions:
145
+
146
+ ```js
147
+ import { getAllDataSources, getValue } from '@silexlabs/grapesjs-data-source'
148
+
149
+ const dataSources = getAllDataSources()
150
+
151
+ // Evaluate expressions with preview data
152
+ const result = getValue(
153
+ [{
154
+ type: "property",
155
+ fieldId: "fixed",
156
+ options: { value: 'test' },
157
+ }, {
158
+ type: "filter",
159
+ id: "upcase",
160
+ apply: input => input.toUpperCase()
161
+ }],
162
+ editor.getSelected() // This is never used as the expression only refers to hard coded values, no state in the expression
163
+ )
164
+ console.log('will write "TEST":', result)
165
+ ```
166
+
167
+ ### Canvas Preview Functionality
168
+
169
+ The plugin provides powerful canvas preview capabilities that show live data directly on the design canvas:
170
+
171
+ #### Loop Rendering
172
+ Components with `__data` states automatically render multiple instances based on array data:
173
+
174
+ ```js
175
+ // Component with __data state pointing to an array will duplicate for each item
176
+ // Original component shows data for index 0
177
+ // Additional instances are created for indices 1, 2, 3...
178
+ ```
179
+
180
+ #### Visibility Conditions
181
+ Components with condition states are shown/hidden based on data evaluation:
182
+
183
+ ```js
184
+ // Binary operators: ==, !=, >, <, >=, <=
185
+ // Unary operators: truthy, falsy, empty array, not empty array
186
+ // Components that don't match conditions are removed from DOM (not just hidden)
187
+ ```
188
+
189
+ #### Interactive Canvas
190
+ Click on duplicated loop instances to select and edit the original template component. The plugin maintains the connection between preview instances and their source templates.
191
+
192
+ #### Preview Controls
193
+ Control canvas preview state programmatically:
194
+
195
+ ```js
196
+ // Start with preview disabled in plugin options
197
+ editor.plugins.add('@silexlabs/grapesjs-data-source', {
198
+ previewActive: false,
199
+ // ... other options
200
+ })
201
+
202
+ // Or control at runtime
203
+ editor.runCommand('data-source:preview:activate') // Show live data
204
+ editor.runCommand('data-source:preview:deactivate') // Show templates
205
+ editor.runCommand('data-source:preview:refresh') // Refresh data
206
+ ```
207
+
208
+ ## API Reference
209
+
210
+ ### Available Events
211
+
212
+ These event names are exposed in the API and can be used to listen for changes and rendering lifecycle:
213
+
214
+ export const DATA_SOURCE_READY = 'data-source:ready'
215
+ export const DATA_SOURCE_ERROR = 'data-source:error'
216
+ export const DATA_SOURCE_CHANGED = 'data-source:changed'
217
+ export const COMPONENT_STATE_CHANGED = 'component:state:changed'
218
+ export const DATA_SOURCE_DATA_LOAD_START = 'data-source:data-load:start'
219
+ export const DATA_SOURCE_DATA_LOAD_END = 'data-source:data-load:end'
220
+ export const DATA_SOURCE_DATA_LOAD_CANCEL= 'data-source:data-load:cancel'
221
+
222
+ export const PREVIEW_RENDER_START = 'data-source:start:preview'
223
+ export const PREVIEW_RENDER_END = 'data-source:start:end'
224
+ export const PREVIEW_RENDER_ERROR = 'data-source:start:error'
225
+
226
+ These constants are exported by the API of the plugin, e.g.
227
+ ```ts
228
+ import { PREVIEW_RENDER_END } from '@silexlabs/grapess-data-source'
229
+ editor.on(PREVIEW_RENDER_END, () => console.log('render success!'))
230
+ ```
231
+
232
+ ### Available Commands
233
+
234
+ These command names are exposed in the API and can be used to control data source and preview behavior:
235
+
236
+ export const COMMAND_REFRESH = 'data-source:refresh'
237
+ export const COMMAND_PREVIEW_ACTIVATE = 'data-source:preview:activate'
238
+ export const COMMAND_PREVIEW_DEACTIVATE = 'data-source:preview:deactivate'
239
+ export const COMMAND_PREVIEW_REFRESH = 'data-source:preview:refresh'
240
+ export const COMMAND_ADD_DATA_SOURCE = 'data-source:add'
241
+
242
+ These constants are exported by the API of the plugin, e.g.
243
+
244
+ ```ts
245
+ import { COMMAND_REFRESH } from '@silexlabs/grapess-data-source'
246
+ editor.runCommand(COMMAND_REFRESH) // or editor.runCommand('data-source:refresh')
247
+ ```
248
+
249
+ ### Data Source Management
250
+
251
+ ```js
252
+ import {
253
+ getAllDataSources,
254
+ getDataSource,
255
+ addDataSource,
256
+ removeDataSource,
257
+ refreshDataSources
258
+ } from '@silexlabs/grapesjs-data-source'
259
+
260
+ // Get all data sources
261
+ const dataSources = getAllDataSources()
262
+
263
+ // Get a specific data source
264
+ const dataSource = getDataSource('my-data-source-id')
265
+
266
+ // Add a new data source
267
+ await addDataSource(newDataSource)
268
+
269
+ // Remove a data source
270
+ removeDataSource(dataSource)
271
+
272
+ // Refresh preview data
273
+ refreshDataSources()
274
+ ```
275
+
276
+ ### Query Generation
277
+ ```js
278
+ import { getPageQuery, buildPageQueries } from '@silexlabs/grapesjs-data-source'
279
+
280
+ // Generate query for a single page (used by both preview and production)
281
+ const query = getPageQuery(page, editor)
282
+
283
+ // Generate queries for multiple pages (useful for site generation)
284
+ const queries = buildPageQueries(pages, editor)
285
+ ```
286
+
287
+ ### Preview Data Management
288
+ ```js
289
+ import {
290
+ loadPreviewData,
291
+ getPreviewData,
292
+ clearPreviewData
293
+ } from '@silexlabs/grapesjs-data-source'
294
+
295
+ // Load preview data for current page
296
+ await loadPreviewData()
297
+
298
+ // Get current preview data
299
+ const previewData = getPreviewData()
300
+
301
+ // Clear preview data
302
+ clearPreviewData()
303
+ ```
304
+
305
+ ### Expression Evaluation
306
+ ```js
307
+ import { getValue, getPageExpressions, getCompletion } from '@silexlabs/grapesjs-data-source'
308
+
309
+ // Evaluate an expression with current preview data
310
+ const result = getValue(expression, component)
311
+
312
+ // Get all expressions used by components on a page
313
+ const expressions = getPageExpressions(page)
314
+
315
+ // Get auto-completion for expressions
316
+ const completion = getCompletion({ component, expression })
317
+ ```
318
+
319
+ ## Available commands
320
+
321
+ The plugin adds several commands for managing data sources and preview functionality:
322
+
323
+ ### Data Source Management
324
+ ```js
325
+ // Refresh data sources (fetch fresh data)
326
+ editor.runCommand('data-source:refresh')
327
+ ```
328
+
329
+ ### Preview Controls
330
+ ```js
331
+ // Activate data preview on canvas (show live data)
332
+ editor.runCommand('data-source:preview:activate')
333
+
334
+ // Deactivate data preview (show original template)
335
+ editor.runCommand('data-source:preview:deactivate')
336
+
337
+ // Refresh preview data (re-fetch and update canvas)
338
+ editor.runCommand('data-source:preview:refresh')
339
+ ```
340
+
341
+ These commands allow you to control whether the canvas shows live data from your data sources or the original template content. When preview is active, components with loop data will duplicate for each item, and visibility conditions will be evaluated in real-time.
342
+
343
+ ## Available events
344
+
345
+ The plugin emits events to notify the application of changes in the data sources, states, and expressions. Here are some of the events you can listen to:
346
+ * `data-source:changed`: Emitted when a data source is changed.
347
+ * `data-source:ready`: Emitted when a data source is ready (connected).
348
+ * `data-source:error`: Emitted when there is an error with a data source.
349
+ * `data-source:data-load:start`: Emitted when preview data loading starts.
350
+ * `data-source:data-load:end`: Emitted when preview data loading completes.
351
+ * `data-source:data-load:cancel`: Emitted when preview data loading is cancelled.
352
+ * `component:state:changed`: Emitted when a component state is changed.
353
+
354
+ These events are emitted on the editor instance, so you can listen to them like this:
355
+
356
+ ```js
357
+ editor.on('data-source:changed', (dataSource) => {
358
+ console.log('Data source changed:', dataSource)
359
+ })
360
+ editor.on('data-source:ready', (dataSource) => {
361
+ console.log('Data source ready:', dataSource)
362
+ })
363
+ editor.on('data-source:error', (error) => {
364
+ console.error('Data source error:', error)
365
+ })
366
+ editor.on('data-source:data-load:start', () => {
367
+ console.log('Preview data loading started')
368
+ })
369
+ editor.on('data-source:data-load:end', (previewData) => {
370
+ console.log('Preview data loaded:', previewData)
371
+ })
372
+ editor.on('component:state:changed', ({state, component}) => {
373
+ console.log('State changed:', {state, component})
374
+ })
375
+ ```
376
+
377
+ ## Configuration
378
+
379
+ Here is a simple example of how to use the plugin in your application
380
+
381
+ ### HTML
382
+ ```html
383
+ <link href="https://unpkg.com/grapesjs/dist/css/grapes.min.css" rel="stylesheet">
384
+ <script src="https://unpkg.com/grapesjs"></script>
385
+ <script src="https://unpkg.com/@silexlabs/grapesjs-data-source"></script>
386
+
387
+ <div id="gjs"></div>
388
+ ```
389
+
390
+ ### JS
391
+ ```js
392
+ const editor = grapesjs.init({
393
+ container: '#gjs',
394
+ height: '100%',
395
+ fromElement: true,
396
+ storageManager: false,
397
+ plugins: ['@silexlabs/grapesjs-data-source'],
398
+ pluginsOpts: {
399
+ '@silexlabs/grapesjs-data-source': {
400
+ dataSources: [{
401
+ id: 'countries',
402
+ type: 'graphql',
403
+ label: 'Countries',
404
+ url: 'https://countries.trevorblades.com/graphql',
405
+ method: 'POST',
406
+ headers: {},
407
+ }],
408
+ properties: {
409
+ el: () => editor.Panels.getPanel('views-container').view.el,
410
+ button: () => editor.Panels.getPanel('views').get('buttons').get('open-tm'),
411
+ },
412
+ filters: 'liquid',
413
+ }
414
+ }
415
+ });
416
+ ```
417
+
418
+ ### CSS
419
+ ```css
420
+ body, html {
421
+ margin: 0;
422
+ height: 100%;
423
+ }
424
+ ```
425
+
426
+ ## Local tests and development
427
+
428
+ Use a local strapi to test GraphQL data source
429
+
430
+ ```sh
431
+ $ cd strapi
432
+ $ yarn develop
433
+ ```
434
+
435
+ Strapi admin
436
+
437
+ * `http://localhost:1337/admin/`
438
+ * Login: `alex@test.com`
439
+ * Password: `test_TEST1`
440
+
441
+ Strapi GraphQL:
442
+
443
+ * `http://localhost:1337/graphql`
444
+ * `Bearer 456fe45a764921a26a81abd857bf987cd1735fbdbe58951ff5fc45a1c0ed2c52ab920cc0498b17411cd03954da7bb3e62e6bae612024360fb89717bd2274493ce190f3be14cdf47fccd33182fd795a67e48624e37f7276d9f84e98b2ec6945926d7a150e8c5deafa272aa9d9d97ee89e227c1edb1d6740ffd37a16b2298b3cc8`
445
+
446
+ Use this as a data source in the plugin options:
447
+
448
+ ```js
449
+ grapesjs.init({
450
+ // ...
451
+ // Your config here
452
+ // ...
453
+
454
+ plugins: ['@silexlabs/grapesjs-data-source'],
455
+ pluginsOpts: {
456
+ '@silexlabs/grapesjs-data-source': {
457
+ dataSources: [
458
+ {
459
+ id: 'strapi',
460
+ type: 'graphql',
461
+ name: 'Strapi',
462
+ url: 'http://localhost:1337/graphql',
463
+ method: 'POST',
464
+ headers: {
465
+ 'Authorization': 'Bearer 79c9e74b3cf4a9f5ce2836b81fd8aaf8a986b5696769456d3646a3213f5d7228634a1a15a8bbad4e87c09ab864c501499c6f8955cf350e49b89311764009aee68589a4b78f22c06b7e09835b48cd6f21fb84311ce873cd5672bd4652fde3f5f0db6afb258dfe7b93371b7632b551ecdd969256ffc076ab8f735b5d8c7d228825',
466
+ 'Content-Type': 'application/json',
467
+ },
468
+ },
469
+ ],
470
+ properties: {
471
+ el: () => editor.Panels.getPanel('views-container').view.el,
472
+ button: () => editor.Panels.getPanel('views').get('buttons').get('open-tm'),
473
+ },
474
+ filters: 'liquid',
475
+ }
476
+ }
477
+ });
478
+ ```
479
+
480
+ ## Configuration examples
481
+
482
+ You can find examples in [Silex CMS documentation](https://docs.silex.me/en/user/cms)
483
+
484
+ Here are examples of APIs I tested:
485
+
486
+ Strapi
487
+
488
+ ```
489
+ {
490
+ id: 'strapi',
491
+ type: 'graphql',
492
+ name: 'Strapi',
493
+ url: 'http://localhost:1337/graphql',
494
+ method: 'POST',
495
+ headers: {
496
+ 'Authorization': 'Bearer 456fe45a764921a2...6b2298b3cc8',
497
+ 'Content-Type': 'application/json',
498
+ },
499
+ }
500
+ ```
501
+
502
+ Supabase (I had a CORS problem, let's discuss this in an issue if you want to give it a try)
503
+
504
+ ```
505
+ {
506
+ id: 'supabase',
507
+ type: 'graphql',
508
+ name: 'Supabase',
509
+ url: `https://api.supabase.io/platform/projects/jpslgeqihfj/api/graphql`,
510
+ method: 'POST',
511
+ headers: {
512
+ 'Authorization': 'Bearer eyjhbgcioijiuz...tww8imndplsfm',
513
+ 'Content-Type': 'application/json',
514
+ 'Access-Control-Allow-Origin': '*',
515
+ 'Access-Control-Allow-Headers': 'authorization, x-client-info, apikey, content-type',
516
+ },
517
+ }
518
+ ```
519
+
520
+ ## Options
521
+
522
+ | Option | Description | Default |
523
+ |-|-|-
524
+ | `dataSources` | List of data sources, see config examples and the plugin code for docs ([data source options](./src/index.ts) and [GraphQL data source options](./src/datasources/GraphQL.ts)) | `[]` |
525
+ | `filters` | The string 'liquidjs' for LiquidJs filters or a list of filters (JS objects like the ones in `src/filters/liquid.ts`) | `[]` |
526
+ | `previewActive` | Whether data preview should be active by default on canvas | `true` |
527
+ | `view` | Options for the UIs included with this plugin | N/A |
528
+ | `view.el` | UI element to attach [the expressions UI](#expressions-ui) | `.gjs-pn-panel.gjs-pn-views-container` |
529
+ | `view.button` | Optional GrapesJs button or a function which returns a button. This button will show/hide [the expressions UI](#expressions-ui), it's just a helper to save you from doing it yourself. | `undefined` which means no button |
530
+ | `view.settingsEl` | UI element to attach the [settings dialog](#settings-dialog). You can provide a string (css selector), a function which returns a DOM element, or a DOM element directly. | `.gjs-pn-views` |
531
+ | `view.styles` | CSS styles which are applied to the UI (inserted in a style tag) | See the file `src/view/defaultStyles.ts` |
532
+ | `view.optionsStyles` | CSS styles which are applied to each "expression selector" UI (inserted in a style tag) | See the file `src/view/defaultStyles.ts` |
533
+ | `view.defaultFixed` | If true, the UI shows fixed by default or if false it shows expression by default | `false` |
534
+
535
+ ### Canvas Preview Features
536
+
537
+ The plugin now includes comprehensive canvas preview functionality:
538
+
539
+ - **Loop Rendering**: Components with `__data` states automatically duplicate for each array item
540
+ - **Visibility Conditions**: Components with condition states show/hide based on data evaluation
541
+ - **Interactive Elements**: Click on duplicated loop instances to select and edit the original template
542
+ - **Preview Controls**: Use commands to toggle preview mode on/off
543
+ - **Nested Loops**: Full support for loops within loops with proper context isolation
544
+ - **Real-time Updates**: Canvas updates automatically when data sources change
545
+
546
+ ## Download
547
+
548
+ * CDN
549
+ * `https://unpkg.com/@silexlabs/grapesjs-data-source`
550
+ * NPM
551
+ * `npm i @silexlabs/grapesjs-data-source`
552
+ * GIT
553
+ * `git clone https://github.com/silexlabs/grapesjs-data-source.git`
554
+
555
+ ## Usage
556
+
557
+ Directly in the browser
558
+ ```html
559
+ <link href="https://unpkg.com/grapesjs/dist/css/grapes.min.css" rel="stylesheet"/>
560
+ <script src="https://unpkg.com/grapesjs"></script>
561
+ <script src="path/to/grapesjs-data-source.min.js"></script>
562
+
563
+ <div id="gjs"></div>
564
+
565
+ <script type="text/javascript">
566
+ var editor = grapesjs.init({
567
+ container: '#gjs',
568
+ // ...
569
+ plugins: ['@silexlabs/grapesjs-data-source'],
570
+ pluginsOpts: {
571
+ '@silexlabs/grapesjs-data-source': { /* options */ }
572
+ }
573
+ });
574
+ </script>
575
+ ```
576
+
577
+ Modern javascript
578
+ ```js
579
+ import grapesjs from 'grapesjs';
580
+ import plugin from '@silexlabs/grapesjs-data-source';
581
+ import 'grapesjs/dist/css/grapes.min.css';
582
+
583
+ const editor = grapesjs.init({
584
+ container : '#gjs',
585
+ // ...
586
+ plugins: [plugin],
587
+ pluginsOpts: {
588
+ [plugin]: { /* options */ }
589
+ }
590
+ // or
591
+ plugins: [
592
+ editor => plugin(editor, { /* options */ }),
593
+ ],
594
+ });
595
+ ```
596
+
597
+
598
+
599
+ ## Development
600
+
601
+ Clone the repository
602
+
603
+ ```sh
604
+ $ git clone https://github.com/silexlabs/grapesjs-data-source.git
605
+ $ cd grapesjs-data-source
606
+ ```
607
+
608
+ Install dependencies
609
+
610
+ ```sh
611
+ $ npm i
612
+ ```
613
+
614
+ Start the dev server
615
+
616
+ ```sh
617
+ $ npm start
618
+ ```
619
+
620
+ Build the source
621
+
622
+ ```sh
623
+ $ npm run build
624
+ ```
625
+
626
+ ### State Management API
627
+ ```js
628
+ import {
629
+ getState,
630
+ setState,
631
+ removeState,
632
+ getStateIds,
633
+ getPersistantId,
634
+ getOrCreatePersistantId
635
+ } from '@silexlabs/grapesjs-data-source'
636
+
637
+ // Get component states
638
+ const publicStates = getStateIds(component, true) // exported states
639
+ const privateStates = getStateIds(component, false) // internal states
640
+
641
+ // Get a specific state
642
+ const state = getState(component, 'innerHTML', false) // false = private state
643
+
644
+ // Set a state
645
+ setState(component, 'myState', { expression: [...] }, true) // true = exported
646
+
647
+ // Component persistent ID management
648
+ const id = getPersistantId(component) // may return null
649
+ const guaranteedId = getOrCreatePersistantId(component) // always returns an ID
650
+ ```
651
+
652
+ ### Token and Expression Utilities
653
+ ```js
654
+ import {
655
+ fromStored,
656
+ toExpression,
657
+ getExpressionResultType
658
+ } from '@silexlabs/grapesjs-data-source'
659
+
660
+ // Convert stored tokens to full tokens
661
+ const fullToken = fromStored(storedToken, component.getId())
662
+
663
+ // Convert string/JSON to expression
664
+ const expression = toExpression('[{"type":"property","fieldId":"title"}]')
665
+
666
+ // Get the result type of an expression
667
+ const resultType = getExpressionResultType(expression, component)
668
+ ```
669
+
670
+
671
+
672
+ ## License
673
+
674
+ MIT