@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,985 @@
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 { Field, Filter, Options } from '../types'
19
+ import { html } from 'lit'
20
+ import { convertKind, getFieldType } from '../utils'
21
+ import { Component, Editor } from 'grapesjs'
22
+
23
+ /**
24
+ * Check if a field is a number
25
+ */
26
+ function isNumber(field: Field | null, scalarOnly = true): boolean {
27
+ if (!field || (scalarOnly && field.kind !== 'scalar')) return false
28
+ const typeIds = field.typeIds.map(typeId => typeId.toLowerCase())
29
+ return ['number','int','float','decimal','bigint','double','long','short','byte','integer','numeric'].some(t => typeIds.includes(t))
30
+ }
31
+
32
+ /**
33
+ * Check if a field is a string
34
+ * Exported for testing
35
+ */
36
+ export function isString(field: Field | null, scalarOnly = true): boolean {
37
+ if (!field || (scalarOnly && field.kind !== 'scalar')) return false
38
+ return field.typeIds
39
+ .map(typeId => typeId.toLowerCase())
40
+ .some(typeId =>
41
+ typeId.includes('string') ||
42
+ // In WP for example
43
+ typeId === 'id'
44
+ )
45
+ }
46
+
47
+ /**
48
+ * Check if a field is a date
49
+ * Exported for testing
50
+ */
51
+ export function isDate(field: Field | null, scalarOnly = true): boolean {
52
+ if (!field || (scalarOnly && field.kind !== 'scalar')) return false
53
+ return field.typeIds
54
+ .map(typeId => typeId.toLowerCase())
55
+ .some(typeId =>
56
+ typeId.includes('date') ||
57
+ typeId.includes('datetime') ||
58
+ typeId.includes('time') ||
59
+ typeId.includes('timestamp') ||
60
+ typeId.includes('instant') ||
61
+ typeId.includes('timestamptz') ||
62
+ typeId.includes('zoned') ||
63
+ // In WP for example
64
+ typeId.includes('string')
65
+ )
66
+ }
67
+
68
+ /**
69
+ * Liquid filters
70
+ */
71
+ export default function(editor: Editor): Filter[] {
72
+ return [
73
+ {
74
+ type: 'filter',
75
+ id: 'strip_html',
76
+ label: 'strip_html',
77
+ validate: (field: Field | null) => isString(field),
78
+ output: type => type,
79
+ apply: (str) => (str as string).replace(/<[^>]*>/g, ''),
80
+ options: {},
81
+ }, {
82
+ type: 'filter',
83
+ id: 'append',
84
+ label: 'append',
85
+ validate: (field: Field | null) => isString(field),
86
+ output: type => type,
87
+ apply: (str, options) => `${str}${options.value}`,
88
+ options: {
89
+ value: '',
90
+ },
91
+ optionsForm: (selected: Component, field: Field | null, options: Options, stateName: string) => html`
92
+ <state-editor
93
+ .selected=${selected}
94
+ .editor=${editor}
95
+ name="value"
96
+ parent-name=${stateName}
97
+ data-is-input
98
+ no-filters
99
+ class="ds-state-editor__options"
100
+ value=${options.value || '[]'}
101
+ >
102
+ <label slot="label">Suffix</label>
103
+ </state-editor>
104
+ `,
105
+ }, {
106
+ type: 'filter',
107
+ id: 'prepend',
108
+ label: 'prepend',
109
+ validate: (field: Field | null) => isString(field),
110
+ output: type => type,
111
+ apply: (str, options) => `${options.value}${str}`,
112
+ options: {
113
+ value: '',
114
+ },
115
+ optionsForm: (selected: Component, field: Field | null, options: Options, stateName: string) => html`
116
+ <state-editor
117
+ .selected=${selected}
118
+ .editor=${editor}
119
+ name="value"
120
+ parent-name=${stateName}
121
+ data-is-input
122
+ no-filters
123
+ class="ds-state-editor__options"
124
+ value=${options.value || '[]'}
125
+ >
126
+ <label slot="label">Prefix</label>
127
+ </state-editor>
128
+ `,
129
+ }, {
130
+ type: 'filter',
131
+ id: 'where',
132
+ label: 'where',
133
+ validate: (field: Field | null) => !!field && field.kind === 'list',
134
+ output: field => field,
135
+ apply: (arr, options) => {
136
+ const { key, value } = options as { key: string, value: string }
137
+ return (arr as Record<string, unknown>[]).filter(item => item[key] === value)
138
+ },
139
+ options: {
140
+ key: '',
141
+ value: '',
142
+ },
143
+ quotedOptions: ['key'],
144
+ optionsKeys: ['key', 'value'],
145
+ optionsForm: (selected: Component, field: Field | null, options: Options, stateName: string) => html`
146
+ <state-editor
147
+ .selected=${selected}
148
+ .editor=${editor}
149
+ no-filters
150
+ data-is-input
151
+ class="ds-state-editor__options"
152
+ value=${options.key || []}
153
+ name="key"
154
+ root-type=${field?.typeIds[0] ?? ''}
155
+ >
156
+ <label slot="label">Key to filter on</label>
157
+ </state-editor>
158
+ <p>==</p>
159
+ <state-editor
160
+ .selected=${selected}
161
+ .editor=${editor}
162
+ no-filters
163
+ parent-name=${stateName}
164
+ data-is-input
165
+ class="ds-state-editor__options"
166
+ value=${options.value || []}
167
+ name="value"
168
+ >
169
+ <label slot="label">Value to match</label>
170
+ </state-editor>
171
+ `,
172
+ }, {
173
+ // FIXME: the fields used in the expression are not available in the query
174
+ // // https://liquidjs.com/filters/where_exp.html
175
+ // type: 'filter',
176
+ // id: 'where_exp',
177
+ // label: 'where_exp',
178
+ // validate: (field: Field | null) => !!field && field.kind === 'list',
179
+ // output: field => field,
180
+ // apply: (arr, options) => {
181
+ // const { objectName, expression } = options as { objectName: string, expression: string }
182
+ // return (arr as Record<string, unknown>[]).filter(item => {
183
+ // // eslint-disable-next-line no-new-func
184
+ // const fn = new Function(objectName, `return ${expression}`)
185
+ // return fn(item)
186
+ // })
187
+ // },
188
+ // options: {
189
+ // objectName: 'item',
190
+ // expression: 'item.key === "value"',
191
+ // },
192
+ // quotedOptions: ['objectName', 'expression'],
193
+ // optionsKeys: ['objectName', 'expression'],
194
+ // optionsForm: (selected: Component, field: Field | null, options: Options) => html`
195
+ // <label>Object name
196
+ // <input type="text" name="objectName" placeholder="Object name" .value=${options.objectName || 'item'}/>
197
+ // </label>
198
+ // <label>Expression (JS)
199
+ // <input type="text" name="expression" placeholder="Expression" .value=${options.expression || 'item.key === "value"'}/>
200
+ // </label>
201
+ // `,
202
+ // }, {
203
+ // https://liquidjs.com/filters/find.html
204
+ type: 'filter',
205
+ id: 'find',
206
+ label: 'find',
207
+ validate: (field: Field | null) => !!field && field.kind === 'list',
208
+ output: field => convertKind(field, 'list', 'object'),
209
+ apply: (arr, options) => {
210
+ const { key, value } = options as { key: string, value: string }
211
+ return (arr as Record<string, unknown>[]).find(item => item[key] === value)
212
+ },
213
+ options: {
214
+ key: '',
215
+ value: '',
216
+ },
217
+ quotedOptions: ['key'],
218
+ optionsKeys: ['key', 'value'],
219
+ optionsForm: (selected: Component, field: Field | null, options: Options, stateName: string) => html`
220
+ <state-editor
221
+ .selected=${selected}
222
+ .editor=${editor}
223
+ no-filters
224
+ data-is-input
225
+ class="ds-state-editor__options"
226
+ value=${options.key || []}
227
+ name="key"
228
+ root-type=${field?.typeIds[0] ?? ''}
229
+ >
230
+ <label slot="label">Key to filter on</label>
231
+ </state-editor>
232
+ <p>==</p>
233
+ <state-editor
234
+ .selected=${selected}
235
+ .editor=${editor}
236
+ no-filters
237
+ parent-name=${stateName}
238
+ data-is-input
239
+ class="ds-state-editor__options"
240
+ value=${options.value || []}
241
+ name="value"
242
+ >
243
+ <label slot="label">Value to match</label>
244
+ </state-editor>
245
+ `,
246
+ }, {
247
+ // FIXME: the fields used in the expression are not available in the query
248
+ // // https://liquidjs.com/filters/find_exp.html
249
+ // type: 'filter',
250
+ // id: 'find_exp',
251
+ // label: 'find_exp',
252
+ // validate: (field: Field | null) => !!field && field.kind === 'list',
253
+ // output: field => convertKind(field, 'list', 'object'),
254
+ // apply: (arr, options) => {
255
+ // const { objectName, expression } = options as { objectName: string, expression: string }
256
+ // return (arr as Record<string, unknown>[]).find(item => {
257
+ // // eslint-disable-next-line no-new-func
258
+ // const fn = new Function(objectName, `return ${expression}`)
259
+ // return fn(item)
260
+ // })
261
+ // },
262
+ // options: {
263
+ // objectName: 'item',
264
+ // expression: 'item.key === "value"',
265
+ // },
266
+ // quotedOptions: ['objectName', 'expression'],
267
+ // optionsKeys: ['objectName', 'expression'],
268
+ // optionsForm: (selected: Component, field: Field | null, options: Options) => html`
269
+ // <label>Object name
270
+ // <input type="text" name="objectName" placeholder="Object name" .value=${options.objectName || 'item'}/>
271
+ // </label>
272
+ // <label>Expression (JS)
273
+ // <input type="text" name="expression" placeholder="Expression" .value=${options.expression || 'item.key === "value"'}/>
274
+ // </label>
275
+ // `,
276
+ // }, {
277
+ type: 'filter',
278
+ id: 'first',
279
+ label: 'first',
280
+ validate: (field: Field | null) => !!field && field.kind === 'list',
281
+ output: (field: Field | null) => convertKind(field, 'list', 'object'),
282
+ apply: (arr) => (arr as unknown[])[0],
283
+ options: {},
284
+ }, {
285
+ type: 'filter',
286
+ id: 'last',
287
+ label: 'last',
288
+ validate: (field: Field | null) => !!field && field.kind === 'list',
289
+ output: (field: Field | null) => convertKind(field, 'list', 'object'),
290
+ apply: (arr) => (arr as unknown[])[(arr as unknown[]).length - 1],
291
+ options: {},
292
+ }, {
293
+ type: 'filter',
294
+ id: 'join',
295
+ label: 'join',
296
+ validate: (field: Field | null) => isString(field, false) && field?.kind === 'list',
297
+ output: (field: Field | null) => convertKind(field, 'list', 'scalar'),
298
+ apply: (arr, options) => (arr as string[]).join(options.separator as string ?? ','),
299
+ options: {
300
+ separator: ',',
301
+ },
302
+ quotedOptions: ['separator'],
303
+ optionsForm: (selected: Component, field: Field | null, options: Options, stateName: string) => html`
304
+ <state-editor
305
+ .selected=${selected}
306
+ .editor=${editor}
307
+ no-filters
308
+ parent-name=${stateName}
309
+ data-is-input
310
+ class="ds-state-editor__options"
311
+ value=${options.separator || []}
312
+ name="separator"
313
+ >
314
+ <label slot="label">Separator</label>
315
+ </state-editor>
316
+ `,
317
+ }, {
318
+ type: 'filter',
319
+ id: 'split',
320
+ label: 'split',
321
+ validate: (field: Field | null) => isString(field),
322
+ output: (field: Field | null) => convertKind(field, 'scalar', 'list'),
323
+ apply: (str, options) => (str as string).split(options.separator as string ?? ','),
324
+ options: {
325
+ separator: ',',
326
+ },
327
+ quotedOptions: ['separator'],
328
+ optionsForm: (selected: Component, field: Field | null, options: Options, stateName: string) => html`
329
+ <state-editor
330
+ .selected=${selected}
331
+ .editor=${editor}
332
+ no-filters
333
+ parent-name=${stateName}
334
+ data-is-input
335
+ class="ds-state-editor__options"
336
+ value=${options.separator || []}
337
+ name="separator"
338
+ >
339
+ <label slot="label">Separator</label>
340
+ </state-editor>
341
+ `,
342
+ }, {
343
+ type: 'filter',
344
+ id: 'map',
345
+ label: 'map',
346
+ validate: (field: Field | null) => !!field && (field.kind === 'list' || field.kind === 'object'),
347
+ output: (field, options) => getFieldType(editor, field, options['key'] as string | undefined, null),
348
+ apply: (arr, options) => (arr as Record<string, unknown>[]).map(item => item[options.key as string]),
349
+ options: {
350
+ key: '',
351
+ },
352
+ quotedOptions: ['key'],
353
+ optionsForm: (selected: Component, field: Field | null, options: Options) => html`
354
+ <state-editor
355
+ .selected=${selected}
356
+ .editor=${editor}
357
+ no-filters
358
+ data-is-input
359
+ class="ds-state-editor__options"
360
+ value=${options.key || []}
361
+ name="key"
362
+ root-type=${field?.typeIds[0] ?? ''}
363
+ >
364
+ <label slot="label">Key to map</label>
365
+ </state-editor>
366
+ `,
367
+ // This is a dynamic key, but it's not working yet
368
+ // The problem is that output method can only return a single field, but we need to return a list of fields
369
+ // This was an attempt returning the first field only but this makes it impossible to select fields inside the result object and the query will not include the content of the fields we should return
370
+ // }, {
371
+ // type: 'filter',
372
+ // id: 'map-dynamic',
373
+ // filterName: 'map',
374
+ // label: 'map (dynamic key)',
375
+ // validate: (field: Field | null) => !!field && (field.kind === 'list' || field.kind === 'object'),
376
+ // // Any field can be chosen, so we return the first one
377
+ // // Is multiple fields necessary? We will probably always have the same data structure there
378
+ // output: (field) => field ? editor.DataSourceManager.getDataTree()
379
+ // .getType(field.typeIds[0], field.dataSourceId ?? null)?.fields[0] ?? null : null,
380
+ // apply: (arr, options) => (arr as Record<string, unknown>[]).map(item => item[options.key as string]),
381
+ // options: {
382
+ // key: '',
383
+ // },
384
+ // quotedOptions: [],
385
+ // optionsForm: (field: Field | null, options: Options) => html`
386
+ // <state-editor
387
+ // no-filters
388
+ // data-is-input
389
+ // class="ds-state-editor__options"
390
+ // value=${options.key || []}
391
+ // name="key"
392
+ // ${ref(el => el && (el as StateEditor).setEditor(editor))}
393
+ // >
394
+ // <label slot="label">Key to map (dyanamic)</label>
395
+ // </state-editor>
396
+ // `,
397
+ }, {
398
+ type: 'filter',
399
+ id: 'reverse',
400
+ label: 'reverse',
401
+ validate: (field: Field | null) => !!field && field.kind === 'list',
402
+ output: field => field,
403
+ apply: (arr) => [...(arr as unknown[])].reverse(),
404
+ options: {},
405
+ }, {
406
+ type: 'filter',
407
+ id: 'size',
408
+ label: 'size',
409
+ validate: (field: Field | null) => !!field && field.kind === 'list',
410
+ output: () => ({
411
+ id: 'Int',
412
+ label: 'Int',
413
+ typeIds: ['Int'],
414
+ kind: 'scalar',
415
+ }),
416
+ apply: (arr) => (arr as unknown[]).length,
417
+ options: {},
418
+ }, {
419
+ type: 'filter',
420
+ id: 'slice',
421
+ label: 'slice',
422
+ validate: (field: Field | null) => !!field && field.kind === 'list',
423
+ output: field => field,
424
+ apply: (arr, options) => (arr as unknown[]).slice(options.start as number, options.end as number),
425
+ options: {
426
+ start: 0,
427
+ end: 0,
428
+ },
429
+ optionsKeys: ['start', 'end'],
430
+ optionsForm: (selected: Component, field: Field | null, options: Options, stateName: string) => html`
431
+ <state-editor
432
+ .selected=${selected}
433
+ .editor=${editor}
434
+ no-filters
435
+ parent-name=${stateName}
436
+ data-is-input
437
+ class="ds-state-editor__options"
438
+ value=${options.start || []}
439
+ name="start"
440
+ >
441
+ <label slot="label">Start index</label>
442
+ </state-editor>
443
+ <state-editor
444
+ .selected=${selected}
445
+ .editor=${editor}
446
+ no-filters
447
+ parent-name=${stateName}
448
+ data-is-input
449
+ class="ds-state-editor__options"
450
+ value=${options.end || []}
451
+ name="end"
452
+ >
453
+ <label slot="label">End index</label>
454
+ </state-editor>
455
+ `,
456
+ }, {
457
+ type: 'filter',
458
+ id: 'sort',
459
+ label: 'sort',
460
+ validate: (field: Field | null) => !!field && field.kind === 'list',
461
+ output: field => field,
462
+ apply: (arr, options) => (arr as Record<string, string | number>[]).sort((a, b) => {
463
+ if (a[options.key as string] < b[options.key as string]) {
464
+ return -1
465
+ }
466
+ if (a[options.key as string] > b[options.key as string]) {
467
+ return 1
468
+ }
469
+ return 0
470
+ }),
471
+ quotedOptions: ['key'],
472
+ options: {
473
+ key: '',
474
+ },
475
+ optionsForm: (selected: Component, field: Field | null, options: Options) => html`
476
+ <state-editor
477
+ .selected=${selected}
478
+ .editor=${editor}
479
+ no-filters
480
+ data-is-input
481
+ class="ds-state-editor__options"
482
+ value=${options.key || []}
483
+ name="key"
484
+ root-type=${field?.typeIds[0] ?? ''}
485
+ >
486
+ <label slot="label">Key to sort on</label>
487
+ </state-editor>
488
+ `,
489
+ }, {
490
+ type: 'filter',
491
+ id: 'plus',
492
+ label: 'plus',
493
+ validate: (field: Field | null) => isNumber(field),
494
+ output: type => type,
495
+ apply: (num, options) => (num as number) + (options.value as number),
496
+ options: {
497
+ value: 0,
498
+ },
499
+ optionsForm: (selected: Component, field: Field | null, options: Options) => html`
500
+ <label>Value
501
+ <input type="number" name="value" placeholder="Value" .value=${options.value || 0}/>
502
+ </label>
503
+ `,
504
+ }, {
505
+ type: 'filter',
506
+ id: 'minus',
507
+ label: 'minus',
508
+ validate: (field: Field | null) => isNumber(field),
509
+ output: type => type,
510
+ apply: (num, options) => (num as number) - (options.value as number),
511
+ options: {
512
+ value: 0,
513
+ },
514
+ optionsForm: (selected: Component, field: Field | null, options: Options) => html`
515
+ <label>Value
516
+ <input type="number" name="value" placeholder="Value" .value=${options.value || 0}/>
517
+ </label>
518
+ `,
519
+ }, {
520
+ type: 'filter',
521
+ id: 'times',
522
+ label: 'times',
523
+ validate: (field: Field | null) => isNumber(field),
524
+ output: type => type,
525
+ apply: (num, options) => (num as number) * (options.value as number),
526
+ options: {
527
+ value: 0,
528
+ },
529
+ optionsForm: (selected: Component, field: Field | null, options: Options) => html`
530
+ <label>Value
531
+ <input type="number" name="value" placeholder="Value" .value=${options.value || 0}/>
532
+ </label>
533
+ `,
534
+ }, {
535
+ type: 'filter',
536
+ id: 'divided_by',
537
+ label: 'divided_by',
538
+ validate: (field: Field | null) => isNumber(field),
539
+ output: type => type,
540
+ apply: (num, options) => (num as number) / (options.value as number),
541
+ options: {
542
+ value: 0,
543
+ },
544
+ optionsForm: (selected: Component, field: Field | null, options: Options) => html`
545
+ <label>Value
546
+ <input type="number" name="value" placeholder="Value" .value=${options.value || 0}/>
547
+ </label>
548
+ `,
549
+ }, {
550
+ type: 'filter',
551
+ id: 'modulo',
552
+ label: 'modulo',
553
+ validate: (field: Field | null) => isNumber(field),
554
+ output: type => type,
555
+ apply: (num, options) => (
556
+ (num as number) % (options.value as number)
557
+ ),
558
+ options: {
559
+ value: 0,
560
+ },
561
+ optionsForm: (selected: Component, field: Field | null, options: Options) => html`
562
+ <label>Value
563
+ <input type="number" name="value" placeholder="Value" .value=${options.value || 0}/>
564
+ </label>
565
+ `,
566
+ }, {
567
+ type: 'filter',
568
+ id: 'abs',
569
+ label: 'abs',
570
+ validate: (field: Field | null) => isNumber(field),
571
+ output: type => type,
572
+ apply: (num) => Math.abs(num as number),
573
+ options: {},
574
+ }, {
575
+ type: 'filter',
576
+ id: 'ceil',
577
+ label: 'ceil',
578
+ validate: (field: Field | null) => isNumber(field),
579
+ output: type => type,
580
+ apply: (num) => Math.ceil(num as number),
581
+ options: {},
582
+ }, {
583
+ type: 'filter',
584
+ id: 'floor',
585
+ label: 'floor',
586
+ validate: (field: Field | null) => isNumber(field),
587
+ output: type => type,
588
+ apply: (num) => Math.floor(num as number),
589
+ options: {},
590
+ }, {
591
+ type: 'filter',
592
+ id: 'round',
593
+ label: 'round',
594
+ validate: (field: Field | null) => isNumber(field),
595
+ output: type => type,
596
+ apply: (num) => Math.round(num as number),
597
+ options: {},
598
+ }, {
599
+ type: 'filter',
600
+ id: 'at_least',
601
+ label: 'at_least',
602
+ validate: (field: Field | null) => isNumber(field),
603
+ output: type => type,
604
+ apply: (num, options) => Math.max(num as number, options.value as number),
605
+ options: {
606
+ value: 0,
607
+ },
608
+ optionsForm: (selected: Component, field: Field | null, options: Options) => html`
609
+ <label>Value
610
+ <input type="number" name="value" placeholder="Value" .value=${options.value || 0}/>
611
+ </label>
612
+ `,
613
+ }, {
614
+ type: 'filter',
615
+ id: 'at_most',
616
+ label: 'at_most',
617
+ validate: (field: Field | null) => isNumber(field),
618
+ output: type => type,
619
+ apply: (num, options) => Math.min(num as number, options.value as number),
620
+ options: {
621
+ value: 0,
622
+ },
623
+ optionsForm: (selected: Component, field: Field | null, options: Options) => html`
624
+ <label>Value
625
+ <input type="number" name="value" placeholder="Value" .value=${options.value || 0}/>
626
+ </label>
627
+ `,
628
+ }, {
629
+ type: 'filter',
630
+ id: 'compact',
631
+ label: 'compact',
632
+ validate: (field: Field | null) => !!field && field.kind === 'list',
633
+ output: field => field,
634
+ apply: (arr) => (arr as unknown[]).filter(item => !!item),
635
+ options: {},
636
+ }, {
637
+ type: 'filter',
638
+ id: 'default',
639
+ label: 'default',
640
+ validate: (field: Field | null) => !!field && field.kind === 'scalar',
641
+ output: field => field,
642
+ apply: (value, options) => value || options.value,
643
+ options: {
644
+ value: '',
645
+ },
646
+ optionsForm: (selected: Component, field: Field | null, options: Options, stateName: string) => html`
647
+ <state-editor
648
+ .selected=${selected}
649
+ .editor=${editor}
650
+ name="value"
651
+ parent-name=${stateName}
652
+ data-is-input
653
+ no-filters
654
+ class="ds-state-editor__options"
655
+ value=${options.value || '[]'}
656
+ >
657
+ <label slot="label">Default value</label>
658
+ </state-editor>
659
+ `,
660
+ }, {
661
+ type: 'filter',
662
+ id: 'escape',
663
+ label: 'escape',
664
+ validate: (field: Field | null) => isString(field),
665
+ output: type => type,
666
+ apply: (str) => (str as string).replace(/"/g, '\\"'),
667
+ options: {},
668
+ }, {
669
+ type: 'filter',
670
+ id: 'escape_once',
671
+ label: 'escape_once',
672
+ validate: (field: Field | null) => isString(field),
673
+ output: type => type,
674
+ apply: (str) => (str as string).replace(/"/g, '\\"'),
675
+ options: {},
676
+ }, {
677
+ type: 'filter',
678
+ id: 'newline_to_br',
679
+ label: 'newline_to_br',
680
+ validate: (field: Field | null) => isString(field),
681
+ output: type => type,
682
+ apply: (str) => (str as string).replace(/\n/g, '<br />'),
683
+ options: {},
684
+ }, {
685
+ type: 'filter',
686
+ id: 'strip_newlines',
687
+ label: 'strip_newlines',
688
+ validate: (field: Field | null) => isString(field),
689
+ output: type => type,
690
+ apply: (str) => (str as string).replace(/\n/g, ''),
691
+ options: {},
692
+ }, {
693
+ type: 'filter',
694
+ id: 'truncate',
695
+ label: 'truncate',
696
+ validate: (field: Field | null) => isString(field),
697
+ output: type => type,
698
+ apply: (str, options) => (str as string).slice(0, options.length as number),
699
+ options: {
700
+ length: 50,
701
+ },
702
+ optionsForm: (selected: Component, field: Field | null, options: Options) => html`
703
+ <label>Length
704
+ <input type="number" name="length" placeholder="Length" .value=${options.length || 50}/>
705
+ </label>
706
+ `,
707
+ }, {
708
+ type: 'filter',
709
+ id: 'truncatewords',
710
+ label: 'truncatewords',
711
+ validate: (field: Field | null) => isString(field),
712
+ output: type => type,
713
+ apply: (str, options) => (str as string).split(' ').slice(0, options.length as number).join(' '),
714
+ options: {
715
+ length: 15,
716
+ },
717
+ optionsForm: (selected: Component, field: Field | null, options: Options) => html`
718
+ <label>Length
719
+ <input type="number" name="length" placeholder="Length" .value=${options.length || 15}/>
720
+ </label>
721
+ `,
722
+ }, {
723
+ type: 'filter',
724
+ id: 'date',
725
+ label: 'date',
726
+ validate: (field: Field | null) => isDate(field),
727
+ output: () => ({
728
+ id: 'String',
729
+ label: 'String',
730
+ typeIds: ['String'],
731
+ kind: 'scalar',
732
+ }),
733
+ // Simple strftime implementation for preview
734
+ // See liquidjs's full implementation: https://github.com/harttle/liquidjs/blob/master/src/util/strftime.ts
735
+ apply: (date, options) => {
736
+ const d = new Date(date as string)
737
+ const tz = options.timeZone as string || 'UTC'
738
+
739
+ // Get date parts in the specified timezone
740
+ const parts = new Intl.DateTimeFormat('en-US', {
741
+ timeZone: tz,
742
+ weekday: 'short',
743
+ year: 'numeric',
744
+ month: 'short',
745
+ day: '2-digit',
746
+ hour: '2-digit',
747
+ minute: '2-digit',
748
+ second: '2-digit',
749
+ hour12: false,
750
+ }).formatToParts(d)
751
+
752
+ const get = (type: string) => parts.find(p => p.type === type)?.value || ''
753
+ const monthNum = String(new Date(d.toLocaleString('en-US', { timeZone: tz })).getMonth() + 1).padStart(2, '0')
754
+
755
+ const tokens: Record<string, string> = {
756
+ '%a': get('weekday'), // Sun
757
+ '%b': get('month'), // Jan
758
+ '%d': get('day'), // 01
759
+ '%y': get('year').slice(-2),// 25
760
+ '%Y': get('year'), // 2025
761
+ '%m': monthNum, // 01
762
+ '%H': get('hour'), // 14
763
+ '%M': get('minute'), // 30
764
+ '%S': get('second'), // 05
765
+ '%%': '%',
766
+ }
767
+
768
+ return (options.format as string).replace(/%[a-zA-Z%]/g, match => tokens[match] ?? match)
769
+ },
770
+ options: {
771
+ format: '%a, %b %d, %y', // Fri, Jul 17, 15
772
+ timeZone: 'UTC',
773
+ },
774
+ optionsKeys: ['format', 'timeZone'],
775
+ quotedOptions: ['format', 'timeZone'],
776
+ optionsForm: (selected: Component, field: Field | null, options: Options) => html`
777
+ <div>
778
+ <label>Format<br>
779
+ <input type="text" name="format" placeholder="Format" .value=${options.format || '%a, %b %d, %y'}/>
780
+ </label>
781
+ </div>
782
+ <br><br>
783
+ <div>
784
+ <label>Timezone<br>
785
+ <input type="text" name="timeZone" aria-describedby="tz-help" list="tz-list" placeholder="e.g. Europe/Paris, UTC, America/New_York" .value=${options.timeZone || 'UTC' }/>
786
+ </label>
787
+ </div>
788
+ <datalist id="tz-list">
789
+ <option value="UTC"></option>
790
+ <option value="Europe/Paris"></option>
791
+ <option value="Europe/London"></option>
792
+ <option value="America/New_York"></option>
793
+ <option value="America/Los_Angeles"></option>
794
+ <option value="America/Chicago"></option>
795
+ <option value="Asia/Tokyo"></option>
796
+ <option value="Asia/Shanghai"></option>
797
+ <option value="Asia/Kolkata"></option>
798
+ <option value="Australia/Sydney"></option>
799
+ <option value="Africa/Johannesburg"></option>
800
+ <option value="America/Sao_Paulo"></option>
801
+ </datalist>
802
+ <details id="tz-help">
803
+ <summary>Timezone help</summary>
804
+ <p>Use a valid IANA time zone.</p>
805
+ <ul>
806
+ <li>Expected format: IANA time zone (Area/City)</li>
807
+ <li>Examples: Europe/Paris, UTC, America/New_York</li>
808
+ <li>Required field — cannot be empty</li>
809
+ </ul>
810
+ <p>See the recommended list:
811
+ <a href="https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List" target="_blank" rel="noopener">IANA TZ database time zones</a>.
812
+ </p>
813
+ </details>
814
+ `,
815
+ }, {
816
+ type: 'filter',
817
+ id: 'replace',
818
+ label: 'replace',
819
+ validate: (field: Field | null) => isString(field),
820
+ output: type => type,
821
+ apply: (str, options) => (str as string).replace(options.search as string, options.replace as string),
822
+ options: {
823
+ search: '',
824
+ replace: '',
825
+ },
826
+ quotedOptions: ['search', 'replace'],
827
+ optionsKeys: ['search', 'replace'],
828
+ optionsForm: (selected: Component, field: Field | null, options: Options) => html`
829
+ <label>Search
830
+ <input type="text" name="search" placeholder="Search" .value=${options.search || ''}/>
831
+ </label>
832
+ <label>Replace
833
+ <input type="text" name="replace" placeholder="Replace" .value=${options.replace || ''}/>
834
+ </label>
835
+ `,
836
+ }, {
837
+ type: 'filter',
838
+ id: 'replace_first',
839
+ label: 'replace_first',
840
+ validate: (field: Field | null) => isString(field),
841
+ output: type => type,
842
+ apply: (str, options) => (str as string).replace(options.search as string, options.replace as string),
843
+ options: {
844
+ search: '',
845
+ replace: '',
846
+ },
847
+ quotedOptions: ['search', 'replace'],
848
+ optionsKeys: ['search', 'replace'],
849
+ optionsForm: (selected: Component, field: Field | null, options: Options) => html`
850
+ <label>Search
851
+ <input type="text" name="search" placeholder="Search" .value=${options.search || ''}/>
852
+ </label>
853
+ <label>Replace
854
+ <input type="text" name="replace" placeholder="Replace" .value=${options.replace || ''}/>
855
+ </label>
856
+ `,
857
+ }, {
858
+ type: 'filter',
859
+ id: 'replace_last',
860
+ label: 'replace_last',
861
+ validate: (field: Field | null) => isString(field),
862
+ output: type => type,
863
+ apply: (str, options) => {
864
+ const index = (str as string).lastIndexOf(options.search as string)
865
+ if (index === -1) return str
866
+ return (str as string).slice(0, index) + (options.replace as string) + (str as string).slice(index + (options.search as string).length)
867
+ },
868
+ options: {
869
+ search: '',
870
+ replace: '',
871
+ },
872
+ quotedOptions: ['search', 'replace'],
873
+ optionsKeys: ['search', 'replace'],
874
+ optionsForm: (selected: Component, field: Field | null, options: Options) => html`
875
+ <label>Search
876
+ <input type="text" name="search" placeholder="Search" .value=${options.search || ''}/>
877
+ </label>
878
+ <label>Replace
879
+ <input type="text" name="replace" placeholder="Replace" .value=${options.replace || ''}/>
880
+ </label>
881
+ `,
882
+ }, {
883
+ type: 'filter',
884
+ id: 'remove',
885
+ label: 'remove',
886
+ validate: (field: Field | null) => isString(field),
887
+ output: type => type,
888
+ apply: (str, options) => (str as string).replace(options.search as string, ''),
889
+ options: {
890
+ search: 'delete this text',
891
+ },
892
+ quotedOptions: ['search'],
893
+ optionsKeys: ['search'],
894
+ optionsForm: (selected: Component, field: Field | null, options: Options) => html`
895
+ <label>Text to remove
896
+ <input type="text" name="search" placeholder="Delete this text" .value=${options.search || 'delete this text'}/>
897
+ </label>
898
+ `,
899
+ }, {
900
+ type: 'filter',
901
+ id: 'remove_first',
902
+ label: 'remove_first',
903
+ validate: (field: Field | null) => isString(field),
904
+ output: type => type,
905
+ apply: (str, options) => (str as string).replace(options.search as string, ''),
906
+ options: {
907
+ search: 'delete this text',
908
+ },
909
+ quotedOptions: ['search'],
910
+ optionsKeys: ['search'],
911
+ optionsForm: (selected: Component, field: Field | null, options: Options) => html`
912
+ <label>Text to remove
913
+ <input type="text" name="search" placeholder="Delete this text" .value=${options.search || 'delete this text'}/>
914
+ </label>
915
+ `,
916
+ }, {
917
+ type: 'filter',
918
+ id: 'remove_last',
919
+ label: 'remove_last',
920
+ validate: (field: Field | null) => isString(field),
921
+ output: type => type,
922
+ apply: (str, options) => {
923
+ const index = (str as string).lastIndexOf(options.search as string)
924
+ if (index === -1) return str
925
+ return (str as string).slice(0, index) + (str as string).slice(index + (options.search as string).length)
926
+ },
927
+ options: {
928
+ search: 'delete this text',
929
+ },
930
+ quotedOptions: ['search'],
931
+ optionsKeys: ['search'],
932
+ optionsForm: (selected: Component, field: Field | null, options: Options) => html`
933
+ <label>Text to remove
934
+ <input type="text" name="search" placeholder="Delete this text" .value=${options.search || 'delete this text'}/>
935
+ </label>
936
+ `,
937
+ }, {
938
+ type: 'filter',
939
+ id: 'downcase',
940
+ label: 'downcase',
941
+ validate: (field: Field | null) => isString(field),
942
+ output: type => type,
943
+ apply: (str) => str ? (str as string).toLowerCase() : '',
944
+ options: {},
945
+ }, {
946
+ type: 'filter',
947
+ id: 'upcase',
948
+ label: 'upcase',
949
+ validate: (field: Field | null) => isString(field),
950
+ output: type => type,
951
+ apply: (str) => str ? (str as string).toUpperCase() : '',
952
+ options: {},
953
+ }, {
954
+ type: 'filter',
955
+ id: 'capitalize',
956
+ label: 'capitalize',
957
+ validate: (field: Field | null) => isString(field),
958
+ output: type => type,
959
+ apply: (str) => (str as string).charAt(0).toUpperCase() + (str as string).slice(1).toLowerCase(),
960
+ options: {},
961
+ }, {
962
+ // Pick a random value from an array. Optionally, pick multiple values, default is 1 value.
963
+ // https://jekyllrb.com/docs/liquid/filters/
964
+ type: 'filter',
965
+ id: 'sample',
966
+ label: 'sample',
967
+ validate: (field: Field | null) => !!field && field.kind === 'list',
968
+ output: field => field,
969
+ apply: (arr, options) => {
970
+ const count = parseInt(options.count as string || '1')
971
+ return ((arr || []) as unknown[])
972
+ .sort(() => 0.5 - Math.random())
973
+ .slice(0, count)
974
+ },
975
+ options: {
976
+ count: '1',
977
+ },
978
+ optionsForm: (selected: Component, field: Field | null, options: Options) => html`
979
+ <label>Count
980
+ <input type="number" name="count" placeholder="Count" .value=${options.count}/>
981
+ </label>
982
+ `,
983
+ },
984
+ ]
985
+ }