@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.
- package/README.md +115 -78
- package/common/examples/plugin.js +6 -0
- package/common/silex-plugins/config.test.ts +71 -0
- package/common/silex-plugins/config.ts +25 -0
- package/common/silex-plugins/index.ts +2 -0
- package/common/silex-plugins/plugin.test.ts +57 -0
- package/common/silex-plugins/plugin.ts +65 -0
- package/dist/client/css/admin.css +25 -12
- package/dist/client/css/all.min.css +5 -5
- package/dist/client/index.html +2 -2
- package/dist/client/js/main.js +3108 -2940
- package/dist/client/js/main.js.LICENSE.txt +6 -4
- package/dist/client/webfonts/fa-brands-400.woff2 +0 -0
- package/dist/client/webfonts/fa-regular-400.woff2 +0 -0
- package/dist/client/webfonts/fa-solid-900.woff2 +0 -0
- package/dist/client/webfonts/fa-v4compatibility.woff2 +0 -0
- package/dist/server/common/externs.js +2 -0
- package/dist/server/common/silex-plugins/config.js +25 -0
- package/dist/server/common/silex-plugins/index.js +18 -0
- package/dist/server/common/silex-plugins/plugin.js +41 -0
- package/dist/server/server/api/api.js +9 -9
- package/dist/server/server/api/connectorApi.js +35 -35
- package/dist/server/server/api/publicationApi.js +19 -19
- package/dist/server/server/api/websiteApi.js +46 -46
- package/dist/server/server/config.js +19 -19
- package/dist/server/server/connectors/FsHosting.js +6 -6
- package/dist/server/server/connectors/FsStorage.js +35 -35
- package/dist/server/server/connectors/connectors.js +3 -3
- package/dist/server/server/expose.js +18 -8
- package/dist/server/server/express.js +3 -3
- package/dist/server/server/index.js +29 -19
- package/dist/server/server/jobs.js +4 -4
- package/dist/{plugins/server/plugins/server → server/server/plugins}/DownloadConnector.js +23 -28
- package/dist/{plugins/server/plugins/server → server/server/plugins}/FtpConnector.js +42 -117
- package/dist/{plugins/server/plugins/server → server/server/plugins}/GitlabConnector.js +80 -271
- package/dist/{plugins/server/plugins/server → server/server/plugins}/GitlabHostingConnector.js +11 -134
- package/dist/server/server/plugins/PublicationOptimizer.js +2 -0
- package/dist/{plugins/server/plugins/server → server/server/plugins}/SslPlugin.js +3 -32
- package/dist/{plugins/server/plugins/server → server/server/plugins}/StaticPlugin.js +4 -21
- package/dist/server/server/utils/BackwardCompat.js +2 -0
- package/dist/server/server/utils/websiteDataSerialization.js +10 -10
- package/{src/ts/client → editor}/api.ts +2 -2
- package/{src/ts/client → editor}/assetUrl.test.ts +6 -33
- package/{src/ts/client → editor}/assetUrl.ts +2 -2
- package/{src/ts/client → editor}/config.ts +3 -3
- package/{src/css/theme-modern.scss → editor/css/design-system.scss} +29 -14
- package/{src → editor}/css/index.scss +1 -3
- package/{src → editor}/css/project-bar.scss +5 -0
- package/{src/ts/client → editor}/expose.ts +3 -3
- package/{src/ts/client → editor}/grapesjs/LoginDialog.ts +3 -3
- package/{src/ts/client → editor}/grapesjs/PublicationManager.ts +3 -3
- package/{src/ts/client → editor}/grapesjs/PublicationUi.ts +1 -1
- package/{src/ts/client → editor}/grapesjs/cms/index.ts +1 -1
- package/{src/ts/client → editor}/grapesjs/cms/page-settings.ts +1 -1
- package/{src/ts/client → editor}/grapesjs/cms/publication.ts +1 -1
- package/{src/ts/client → editor}/grapesjs/eleventy.ts +1 -1
- package/{src/ts/client → editor}/grapesjs/index.ts +5 -3
- package/{src/ts/client → editor}/grapesjs/internal-links.ts +2 -2
- package/{src/ts/client → editor}/grapesjs/resize-panel.ts +2 -1
- package/{src/ts/client → editor}/grapesjs/settings-sections.ts +1 -1
- package/{src/ts/client → editor}/grapesjs/settings.ts +2 -2
- package/{src/ts/client → editor}/grapesjs/storage.ts +1 -1
- package/editor/grapesjs/website-info.ts +52 -0
- package/{src/ts/client → editor}/index.ts +1 -1
- package/{src/ts/client → editor}/publication-transformers.test.ts +10 -10
- package/{src/ts/client → editor}/publication-transformers.ts +1 -1
- package/{src/ts/client → editor}/publish-fonts.ts +2 -2
- package/grapesjs-plugins/expression-input/.husky/pre-commit +2 -0
- package/grapesjs-plugins/expression-input/.prettierrc.json +7 -0
- package/grapesjs-plugins/expression-input/.vscode/extensions.json +9 -0
- package/grapesjs-plugins/expression-input/CHANGELOG.md +47 -0
- package/grapesjs-plugins/expression-input/LICENSE +661 -0
- package/grapesjs-plugins/expression-input/README.md +59 -0
- package/grapesjs-plugins/expression-input/babel.config.js +3 -0
- package/grapesjs-plugins/expression-input/commitlint.config.js +1 -0
- package/grapesjs-plugins/expression-input/dev/README.md +1 -0
- package/grapesjs-plugins/expression-input/dev/expression-input.html +148 -0
- package/grapesjs-plugins/expression-input/dev/input-chain.html +88 -0
- package/grapesjs-plugins/expression-input/dev/popin-form.html +83 -0
- package/grapesjs-plugins/expression-input/docs/expression-input.md +173 -0
- package/grapesjs-plugins/expression-input/docs/popin-form.md +228 -0
- package/grapesjs-plugins/expression-input/eslint.config.mjs +71 -0
- package/grapesjs-plugins/expression-input/package.json +84 -0
- package/grapesjs-plugins/expression-input/playwright.config.ts +6 -0
- package/grapesjs-plugins/expression-input/rollup.config.js +39 -0
- package/grapesjs-plugins/expression-input/src/expression-input.ts +339 -0
- package/grapesjs-plugins/expression-input/src/index.ts +3 -0
- package/grapesjs-plugins/expression-input/src/input-chain.ts +216 -0
- package/grapesjs-plugins/expression-input/src/popin-form.ts +189 -0
- package/grapesjs-plugins/expression-input/src/popin-overlay.ts +188 -0
- package/grapesjs-plugins/expression-input/src/styles.ts +374 -0
- package/grapesjs-plugins/expression-input/src/test/popin-form_test.ts +47 -0
- package/grapesjs-plugins/expression-input/tsconfig.json +34 -0
- package/grapesjs-plugins/expression-input/web-dev-server.config.js +25 -0
- package/grapesjs-plugins/expression-input/web-test-runner.config.js +124 -0
- package/grapesjs-plugins/grapesjs-advanced-selector/.editorconfig +5 -0
- package/grapesjs-plugins/grapesjs-advanced-selector/.husky/pre-commit +4 -0
- package/grapesjs-plugins/grapesjs-advanced-selector/LICENSE +661 -0
- package/grapesjs-plugins/grapesjs-advanced-selector/README.md +158 -0
- package/grapesjs-plugins/grapesjs-advanced-selector/babel.config.js +3 -0
- package/grapesjs-plugins/grapesjs-advanced-selector/eslint.config.mjs +20 -0
- package/grapesjs-plugins/grapesjs-advanced-selector/index.html +353 -0
- package/grapesjs-plugins/grapesjs-advanced-selector/jest.config.cjs +11 -0
- package/grapesjs-plugins/grapesjs-advanced-selector/package-lock.json +12500 -0
- package/grapesjs-plugins/grapesjs-advanced-selector/package.json +75 -0
- package/grapesjs-plugins/grapesjs-advanced-selector/public/simple-selector.html +12 -0
- package/grapesjs-plugins/grapesjs-advanced-selector/src/StylableElement.ts +15 -0
- package/grapesjs-plugins/grapesjs-advanced-selector/src/capabilities.ts +49 -0
- package/grapesjs-plugins/grapesjs-advanced-selector/src/commands.ts +89 -0
- package/grapesjs-plugins/grapesjs-advanced-selector/src/components/complex-selector.ts +187 -0
- package/grapesjs-plugins/grapesjs-advanced-selector/src/components/compound-selector.ts +241 -0
- package/grapesjs-plugins/grapesjs-advanced-selector/src/components/current-selector-display.ts +289 -0
- package/grapesjs-plugins/grapesjs-advanced-selector/src/components/inline-select.ts +199 -0
- package/grapesjs-plugins/grapesjs-advanced-selector/src/components/resize-input.ts +19 -0
- package/grapesjs-plugins/grapesjs-advanced-selector/src/components/simple-selector.ts +537 -0
- package/grapesjs-plugins/grapesjs-advanced-selector/src/i18n/en.ts +75 -0
- package/grapesjs-plugins/grapesjs-advanced-selector/src/i18n/fr.ts +75 -0
- package/grapesjs-plugins/grapesjs-advanced-selector/src/index.ts +47 -0
- package/grapesjs-plugins/grapesjs-advanced-selector/src/model/ComplexSelector.test.ts +380 -0
- package/grapesjs-plugins/grapesjs-advanced-selector/src/model/ComplexSelector.ts +231 -0
- package/grapesjs-plugins/grapesjs-advanced-selector/src/model/CompoundSelector.test.ts +232 -0
- package/grapesjs-plugins/grapesjs-advanced-selector/src/model/CompoundSelector.ts +128 -0
- package/grapesjs-plugins/grapesjs-advanced-selector/src/model/GrapesJsSelectors.test.ts +1077 -0
- package/grapesjs-plugins/grapesjs-advanced-selector/src/model/GrapesJsSelectors.ts +653 -0
- package/grapesjs-plugins/grapesjs-advanced-selector/src/model/Operator.test.ts +45 -0
- package/grapesjs-plugins/grapesjs-advanced-selector/src/model/Operator.ts +129 -0
- package/grapesjs-plugins/grapesjs-advanced-selector/src/model/PseudoClass.test.ts +31 -0
- package/grapesjs-plugins/grapesjs-advanced-selector/src/model/PseudoClass.ts +159 -0
- package/grapesjs-plugins/grapesjs-advanced-selector/src/model/SimpleSelector.test.ts +181 -0
- package/grapesjs-plugins/grapesjs-advanced-selector/src/model/SimpleSelector.ts +379 -0
- package/grapesjs-plugins/grapesjs-advanced-selector/src/plugin.ts +225 -0
- package/grapesjs-plugins/grapesjs-advanced-selector/src/styles.ts +40 -0
- package/grapesjs-plugins/grapesjs-advanced-selector/src/test-data.json +3546 -0
- package/grapesjs-plugins/grapesjs-advanced-selector/tsconfig.json +37 -0
- package/grapesjs-plugins/grapesjs-ai-capabilities/.eslintrc.json +31 -0
- package/grapesjs-plugins/grapesjs-ai-capabilities/LICENSE +17 -0
- package/grapesjs-plugins/grapesjs-ai-capabilities/README.md +129 -0
- package/grapesjs-plugins/grapesjs-ai-capabilities/_index.html +37 -0
- package/grapesjs-plugins/grapesjs-ai-capabilities/package-lock.json +9023 -0
- package/grapesjs-plugins/grapesjs-ai-capabilities/package.json +46 -0
- package/grapesjs-plugins/grapesjs-ai-capabilities/src/index.js +97 -0
- package/grapesjs-plugins/grapesjs-ai-capabilities/test/index.test.js +198 -0
- package/grapesjs-plugins/grapesjs-ai-capabilities/tsconfig.json +29 -0
- package/grapesjs-plugins/grapesjs-css-variables/.eslintrc.json +31 -0
- package/grapesjs-plugins/grapesjs-css-variables/LICENSE +661 -0
- package/grapesjs-plugins/grapesjs-css-variables/README.md +172 -0
- package/grapesjs-plugins/grapesjs-css-variables/TEST_SCENARIOS.md +181 -0
- package/grapesjs-plugins/grapesjs-css-variables/_index.html +93 -0
- package/grapesjs-plugins/grapesjs-css-variables/package-lock.json +9020 -0
- package/grapesjs-plugins/grapesjs-css-variables/package.json +46 -0
- package/grapesjs-plugins/grapesjs-css-variables/src/capabilities.js +133 -0
- package/grapesjs-plugins/grapesjs-css-variables/src/index.js +37 -0
- package/grapesjs-plugins/grapesjs-css-variables/src/locale/en.js +22 -0
- package/grapesjs-plugins/grapesjs-css-variables/src/locale/fr.js +22 -0
- package/grapesjs-plugins/grapesjs-css-variables/src/modal.js +692 -0
- package/grapesjs-plugins/grapesjs-css-variables/src/style-manager.js +461 -0
- package/grapesjs-plugins/grapesjs-css-variables/src/types.js +8 -0
- package/grapesjs-plugins/grapesjs-css-variables/src/variables.js +439 -0
- package/grapesjs-plugins/grapesjs-data-source/.husky/pre-commit +4 -0
- package/grapesjs-plugins/grapesjs-data-source/.nvmrc +1 -0
- package/grapesjs-plugins/grapesjs-data-source/LICENSE +661 -0
- package/grapesjs-plugins/grapesjs-data-source/README.md +674 -0
- package/grapesjs-plugins/grapesjs-data-source/__mocks__/directus-schema.json +67137 -0
- package/grapesjs-plugins/grapesjs-data-source/__mocks__/directus-test-schema.json +8393 -0
- package/grapesjs-plugins/grapesjs-data-source/__mocks__/graphql-mocks.js +7 -0
- package/grapesjs-plugins/grapesjs-data-source/__mocks__/simple-schema.json +493 -0
- package/grapesjs-plugins/grapesjs-data-source/__mocks__/squidex-schema.json +6656 -0
- package/grapesjs-plugins/grapesjs-data-source/__mocks__/strapi-schema.json +7986 -0
- package/grapesjs-plugins/grapesjs-data-source/_index.html +110 -0
- package/grapesjs-plugins/grapesjs-data-source/babel.config.js +7 -0
- package/grapesjs-plugins/grapesjs-data-source/eslint.config.mjs +47 -0
- package/grapesjs-plugins/grapesjs-data-source/example.graphql +355 -0
- package/grapesjs-plugins/grapesjs-data-source/example.graphql.json +5666 -0
- package/grapesjs-plugins/grapesjs-data-source/example.page.json +1 -0
- package/grapesjs-plugins/grapesjs-data-source/integration-tests/base/graphql-response.json +6 -0
- package/grapesjs-plugins/grapesjs-data-source/integration-tests/base/graphql-types.json +2095 -0
- package/grapesjs-plugins/grapesjs-data-source/integration-tests/base/preview.html +5 -0
- package/grapesjs-plugins/grapesjs-data-source/integration-tests/base/website.json +79 -0
- package/grapesjs-plugins/grapesjs-data-source/integration-tests/countries-lists/graphql-response.json +1056 -0
- package/grapesjs-plugins/grapesjs-data-source/integration-tests/countries-lists/graphql-types.json +2095 -0
- package/grapesjs-plugins/grapesjs-data-source/integration-tests/countries-lists/preview.html +36 -0
- package/grapesjs-plugins/grapesjs-data-source/integration-tests/countries-lists/website.json +422 -0
- package/grapesjs-plugins/grapesjs-data-source/integration-tests/example.graphql-result.json +18718 -0
- package/grapesjs-plugins/grapesjs-data-source/integration-tests/example.graphql-types.json +1955 -0
- package/grapesjs-plugins/grapesjs-data-source/integration-tests/graphql-modules.json +191 -0
- package/grapesjs-plugins/grapesjs-data-source/integration-tests/modules.html +45 -0
- package/grapesjs-plugins/grapesjs-data-source/integration-tests/visibility-truthy/graphql-response.json +1056 -0
- package/grapesjs-plugins/grapesjs-data-source/integration-tests/visibility-truthy/graphql-types.json +2095 -0
- package/grapesjs-plugins/grapesjs-data-source/integration-tests/visibility-truthy/preview.html +31 -0
- package/grapesjs-plugins/grapesjs-data-source/integration-tests/visibility-truthy/website.json +261 -0
- package/grapesjs-plugins/grapesjs-data-source/integration-tests/website-modules.json +650 -0
- package/grapesjs-plugins/grapesjs-data-source/jest.config.js +21 -0
- package/grapesjs-plugins/grapesjs-data-source/package-lock.json +13182 -0
- package/grapesjs-plugins/grapesjs-data-source/package.json +77 -0
- package/grapesjs-plugins/grapesjs-data-source/src/api.ts +386 -0
- package/grapesjs-plugins/grapesjs-data-source/src/capabilities.ts +80 -0
- package/grapesjs-plugins/grapesjs-data-source/src/commands.ts +269 -0
- package/grapesjs-plugins/grapesjs-data-source/src/datasources/GraphQL.ts +1039 -0
- package/grapesjs-plugins/grapesjs-data-source/src/datasources/graphql-introspection-query.ts +112 -0
- package/grapesjs-plugins/grapesjs-data-source/src/datasources/graphql.test.ts +657 -0
- package/grapesjs-plugins/grapesjs-data-source/src/filters/index.ts +102 -0
- package/grapesjs-plugins/grapesjs-data-source/src/filters/liquid.test.ts +27 -0
- package/grapesjs-plugins/grapesjs-data-source/src/filters/liquid.ts +985 -0
- package/grapesjs-plugins/grapesjs-data-source/src/index.ts +103 -0
- package/grapesjs-plugins/grapesjs-data-source/src/integration.test.ts +504 -0
- package/grapesjs-plugins/grapesjs-data-source/src/model/ExpressionTree.ts +251 -0
- package/grapesjs-plugins/grapesjs-data-source/src/model/completion.ts +213 -0
- package/grapesjs-plugins/grapesjs-data-source/src/model/dataSourceManager.ts +315 -0
- package/grapesjs-plugins/grapesjs-data-source/src/model/dataSourceRegistry.test.ts +170 -0
- package/grapesjs-plugins/grapesjs-data-source/src/model/dataSourceRegistry.ts +117 -0
- package/grapesjs-plugins/grapesjs-data-source/src/model/expressionEvaluator.ts +241 -0
- package/grapesjs-plugins/grapesjs-data-source/src/model/previewDataLoader.ts +196 -0
- package/grapesjs-plugins/grapesjs-data-source/src/model/queryBuilder.ts +118 -0
- package/grapesjs-plugins/grapesjs-data-source/src/model/state.test.ts +76 -0
- package/grapesjs-plugins/grapesjs-data-source/src/model/state.ts +243 -0
- package/grapesjs-plugins/grapesjs-data-source/src/model/token.ts +336 -0
- package/grapesjs-plugins/grapesjs-data-source/src/storage.test.ts +81 -0
- package/grapesjs-plugins/grapesjs-data-source/src/storage.ts +55 -0
- package/grapesjs-plugins/grapesjs-data-source/src/test-data.ts +154 -0
- package/grapesjs-plugins/grapesjs-data-source/src/types.ts +299 -0
- package/grapesjs-plugins/grapesjs-data-source/src/utils.test.ts +46 -0
- package/grapesjs-plugins/grapesjs-data-source/src/utils.ts +367 -0
- package/grapesjs-plugins/grapesjs-data-source/src/view/canvas.ts +718 -0
- package/grapesjs-plugins/grapesjs-data-source/src/view/custom-states-editor.ts +371 -0
- package/grapesjs-plugins/grapesjs-data-source/src/view/defaultStyles.ts +432 -0
- package/grapesjs-plugins/grapesjs-data-source/src/view/index.ts +168 -0
- package/grapesjs-plugins/grapesjs-data-source/src/view/properties-editor.ts +249 -0
- package/grapesjs-plugins/grapesjs-data-source/src/view/settings.ts +1551 -0
- package/grapesjs-plugins/grapesjs-data-source/src/view/state-editor.ts +528 -0
- package/grapesjs-plugins/grapesjs-data-source/strapi/.editorconfig +16 -0
- package/grapesjs-plugins/grapesjs-data-source/strapi/.env.example +7 -0
- package/grapesjs-plugins/grapesjs-data-source/strapi/.eslintignore +3 -0
- package/grapesjs-plugins/grapesjs-data-source/strapi/.eslintrc +27 -0
- package/grapesjs-plugins/grapesjs-data-source/strapi/README.md +57 -0
- package/grapesjs-plugins/grapesjs-data-source/strapi/config/admin.js +13 -0
- package/grapesjs-plugins/grapesjs-data-source/strapi/config/api.js +7 -0
- package/grapesjs-plugins/grapesjs-data-source/strapi/config/database.js +92 -0
- package/grapesjs-plugins/grapesjs-data-source/strapi/config/middlewares.js +12 -0
- package/grapesjs-plugins/grapesjs-data-source/strapi/config/server.js +10 -0
- package/grapesjs-plugins/grapesjs-data-source/strapi/database/migrations/.gitkeep +0 -0
- package/grapesjs-plugins/grapesjs-data-source/strapi/favicon.png +0 -0
- package/grapesjs-plugins/grapesjs-data-source/strapi/jsconfig.json +8 -0
- package/grapesjs-plugins/grapesjs-data-source/strapi/package.json +31 -0
- package/grapesjs-plugins/grapesjs-data-source/strapi/public/robots.txt +3 -0
- package/grapesjs-plugins/grapesjs-data-source/strapi/public/uploads/.gitkeep +0 -0
- package/grapesjs-plugins/grapesjs-data-source/strapi/src/admin/app.example.js +39 -0
- package/grapesjs-plugins/grapesjs-data-source/strapi/src/admin/webpack.config.example.js +9 -0
- package/grapesjs-plugins/grapesjs-data-source/strapi/src/api/.gitkeep +0 -0
- package/grapesjs-plugins/grapesjs-data-source/strapi/src/api/post/content-types/post/schema.json +26 -0
- package/grapesjs-plugins/grapesjs-data-source/strapi/src/api/post/controllers/post.js +9 -0
- package/grapesjs-plugins/grapesjs-data-source/strapi/src/api/post/routes/post.js +9 -0
- package/grapesjs-plugins/grapesjs-data-source/strapi/src/api/post/services/post.js +9 -0
- package/grapesjs-plugins/grapesjs-data-source/strapi/src/extensions/.gitkeep +0 -0
- package/grapesjs-plugins/grapesjs-data-source/strapi/src/index.js +20 -0
- package/grapesjs-plugins/grapesjs-data-source/strapi/types/generated/components.d.ts +5 -0
- package/grapesjs-plugins/grapesjs-data-source/strapi/types/generated/contentTypes.d.ts +723 -0
- package/grapesjs-plugins/grapesjs-data-source/tmp/countries-lists.html +1 -0
- package/grapesjs-plugins/grapesjs-data-source/tsconfig.cjs.json +8 -0
- package/grapesjs-plugins/grapesjs-data-source/tsconfig.json +49 -0
- package/grapesjs-plugins/grapesjs-filter-styles/README.md +137 -0
- package/grapesjs-plugins/grapesjs-filter-styles/eslint.config.mjs +35 -0
- package/grapesjs-plugins/grapesjs-filter-styles/package-lock.json +8927 -0
- package/grapesjs-plugins/grapesjs-filter-styles/package.json +40 -0
- package/grapesjs-plugins/grapesjs-filter-styles/src/index.js +283 -0
- package/grapesjs-plugins/grapesjs-filter-styles/tsconfig.json +26 -0
- package/grapesjs-plugins/grapesjs-fonts/.eslintrc.json +31 -0
- package/grapesjs-plugins/grapesjs-fonts/LICENSE +9 -0
- package/grapesjs-plugins/grapesjs-fonts/README.md +231 -0
- package/grapesjs-plugins/grapesjs-fonts/_index.html +95 -0
- package/grapesjs-plugins/grapesjs-fonts/package-lock.json +9024 -0
- package/grapesjs-plugins/grapesjs-fonts/package.json +46 -0
- package/grapesjs-plugins/grapesjs-fonts/src/capabilities.js +61 -0
- package/grapesjs-plugins/grapesjs-fonts/src/commands.js +100 -0
- package/grapesjs-plugins/grapesjs-fonts/src/fonts.js +396 -0
- package/grapesjs-plugins/grapesjs-fonts/src/index.js +34 -0
- package/grapesjs-plugins/grapesjs-fonts/src/locale/en.js +19 -0
- package/grapesjs-plugins/grapesjs-fonts/src/locale/fr.js +21 -0
- package/grapesjs-plugins/grapesjs-fonts/src/locale/ptbr.js +18 -0
- package/grapesjs-plugins/grapesjs-fonts/tsconfig.json +29 -0
- package/grapesjs-plugins/grapesjs-keymaps-dialog/README.md +116 -0
- package/grapesjs-plugins/grapesjs-keymaps-dialog/package.json +46 -0
- package/grapesjs-plugins/grapesjs-keymaps-dialog/src/KeymapsDialog.ts +208 -0
- package/grapesjs-plugins/grapesjs-keymaps-dialog/src/KeymapsDialogManager.ts +78 -0
- package/grapesjs-plugins/grapesjs-keymaps-dialog/src/index.ts +70 -0
- package/grapesjs-plugins/grapesjs-keymaps-dialog/tsconfig.json +29 -0
- package/grapesjs-plugins/grapesjs-loading/.eslintrc.json +22 -0
- package/grapesjs-plugins/grapesjs-loading/README.md +140 -0
- package/grapesjs-plugins/grapesjs-loading/_index.html +90 -0
- package/grapesjs-plugins/grapesjs-loading/eslint.config.mjs +20 -0
- package/grapesjs-plugins/grapesjs-loading/grapesjs-loading.gif +0 -0
- package/grapesjs-plugins/grapesjs-loading/package.json +50 -0
- package/grapesjs-plugins/grapesjs-loading/src/index.ts +54 -0
- package/grapesjs-plugins/grapesjs-loading/tsconfig.json +20 -0
- package/grapesjs-plugins/grapesjs-notifications/LICENSE +661 -0
- package/grapesjs-plugins/grapesjs-notifications/README.md +295 -0
- package/grapesjs-plugins/grapesjs-notifications/_index.html +95 -0
- package/grapesjs-plugins/grapesjs-notifications/package-lock.json +8187 -0
- package/grapesjs-plugins/grapesjs-notifications/package.json +58 -0
- package/grapesjs-plugins/grapesjs-notifications/src/Notification.ts +117 -0
- package/grapesjs-plugins/grapesjs-notifications/src/NotificationManager.ts +93 -0
- package/grapesjs-plugins/grapesjs-notifications/src/Storage.ts +26 -0
- package/grapesjs-plugins/grapesjs-notifications/src/capabilities.ts +33 -0
- package/grapesjs-plugins/grapesjs-notifications/src/commands.ts +5 -0
- package/grapesjs-plugins/grapesjs-notifications/src/index.ts +126 -0
- package/grapesjs-plugins/grapesjs-notifications/src/locale/en.js +8 -0
- package/grapesjs-plugins/grapesjs-notifications/src/view.ts +127 -0
- package/grapesjs-plugins/grapesjs-notifications/tsconfig.json +30 -0
- package/grapesjs-plugins/grapesjs-storage-rate-limit/LICENSE +213 -0
- package/grapesjs-plugins/grapesjs-storage-rate-limit/README.md +119 -0
- package/grapesjs-plugins/grapesjs-storage-rate-limit/jest.config.js +197 -0
- package/grapesjs-plugins/grapesjs-storage-rate-limit/package-lock.json +10752 -0
- package/grapesjs-plugins/grapesjs-storage-rate-limit/package.json +44 -0
- package/grapesjs-plugins/grapesjs-storage-rate-limit/src/index.js +90 -0
- package/grapesjs-plugins/grapesjs-storage-rate-limit/src/index.test.js +122 -0
- package/grapesjs-plugins/grapesjs-symbols/.eslintrc.cjs +20 -0
- package/grapesjs-plugins/grapesjs-symbols/.husky/pre-commit +5 -0
- package/grapesjs-plugins/grapesjs-symbols/.nvmrc +1 -0
- package/grapesjs-plugins/grapesjs-symbols/LICENSE +661 -0
- package/grapesjs-plugins/grapesjs-symbols/README.md +228 -0
- package/grapesjs-plugins/grapesjs-symbols/_index.html +104 -0
- package/grapesjs-plugins/grapesjs-symbols/es5.html +119 -0
- package/grapesjs-plugins/grapesjs-symbols/es6.html +107 -0
- package/grapesjs-plugins/grapesjs-symbols/eslint.config.mjs +72 -0
- package/grapesjs-plugins/grapesjs-symbols/jest.config.js +12 -0
- package/grapesjs-plugins/grapesjs-symbols/package-lock.json +6867 -0
- package/grapesjs-plugins/grapesjs-symbols/package.json +73 -0
- package/grapesjs-plugins/grapesjs-symbols/rollup.config.mjs +26 -0
- package/grapesjs-plugins/grapesjs-symbols/src/SymbolsCommands.test.ts +147 -0
- package/grapesjs-plugins/grapesjs-symbols/src/SymbolsCommands.ts +144 -0
- package/grapesjs-plugins/grapesjs-symbols/src/capabilities.ts +50 -0
- package/grapesjs-plugins/grapesjs-symbols/src/events.ts +8 -0
- package/grapesjs-plugins/grapesjs-symbols/src/id-utils.ts +158 -0
- package/grapesjs-plugins/grapesjs-symbols/src/index.ts +46 -0
- package/grapesjs-plugins/grapesjs-symbols/src/test-utils.ts +51 -0
- package/grapesjs-plugins/grapesjs-symbols/src/utils.test.ts +118 -0
- package/grapesjs-plugins/grapesjs-symbols/src/utils.ts +90 -0
- package/grapesjs-plugins/grapesjs-symbols/src/view/SymbolsView.ts +251 -0
- package/grapesjs-plugins/grapesjs-symbols/src/view/traits.ts +101 -0
- package/grapesjs-plugins/grapesjs-symbols/tsconfig.json +35 -0
- package/grapesjs-plugins/grapesjs-symbols/tsconfig.test.json +12 -0
- package/grapesjs-plugins/grapesjs-version-flow/LICENSE +661 -0
- package/grapesjs-plugins/grapesjs-version-flow/README.md +422 -0
- package/grapesjs-plugins/grapesjs-version-flow/_index.html +494 -0
- package/grapesjs-plugins/grapesjs-version-flow/babel.config.js +9 -0
- package/grapesjs-plugins/grapesjs-version-flow/package-lock.json +11832 -0
- package/grapesjs-plugins/grapesjs-version-flow/package.json +77 -0
- package/grapesjs-plugins/grapesjs-version-flow/prompts/initial.txt +116 -0
- package/grapesjs-plugins/grapesjs-version-flow/src/event-system.js +48 -0
- package/grapesjs-plugins/grapesjs-version-flow/src/index.js +87 -0
- package/grapesjs-plugins/grapesjs-version-flow/src/locale/en.js +26 -0
- package/grapesjs-plugins/grapesjs-version-flow/src/locale/fr.js +26 -0
- package/grapesjs-plugins/grapesjs-version-flow/src/modal-ui.js +562 -0
- package/grapesjs-plugins/grapesjs-version-flow/src/style-manager.js +240 -0
- package/grapesjs-plugins/grapesjs-version-flow/src/upgrade-engine.js +237 -0
- package/grapesjs-plugins/grapesjs-version-flow/src/version-manager.js +117 -0
- package/grapesjs-plugins/grapesjs-version-flow/tests/index.test.js +241 -0
- package/grapesjs-plugins/grapesjs-version-flow/tests/integration.test.js +227 -0
- package/grapesjs-plugins/grapesjs-version-flow/tests/setup.js +67 -0
- package/grapesjs-plugins/grapesjs-version-flow/tests/upgrade-engine.test.js +360 -0
- package/grapesjs-plugins/grapesjs-version-flow/tests/version-manager.test.js +168 -0
- package/grapesjs-plugins/grapesjs-version-flow/tests/version-storage.test.js +203 -0
- package/grapesjs-plugins/grapesjs-version-flow/tsconfig.json +26 -0
- package/package.json +127 -159
- package/{src/ts/server → server}/api/api.ts +6 -6
- package/{src/ts/server → server}/api/connectorApi.ts +5 -5
- package/{src/ts/server → server}/api/publicationApi.ts +7 -7
- package/{src/ts/server → server}/api/websiteApi.ts +7 -8
- package/{src/ts/server → server}/config.ts +14 -12
- package/{src/ts/server → server}/connectors/FsHosting.ts +4 -4
- package/{src/ts/server → server}/connectors/FsStorage.test.ts +2 -2
- package/{src/ts/server → server}/connectors/FsStorage.ts +8 -8
- package/{src/ts/server → server}/connectors/connectors.ts +3 -3
- package/server/deploy/.nvmrc +1 -0
- package/server/deploy/.silex.js +220 -0
- package/server/deploy/client-config.js +17 -0
- package/server/deploy/client-plugins/.gitkeep +0 -0
- package/server/deploy/client-plugins/onboarding.js +67 -0
- package/server/deploy/example.env +25 -0
- package/server/deploy/onboarding.json +22 -0
- package/server/deploy/picto-silex@3x.png +0 -0
- package/server/deploy/server-plugins/dashboard.js +74 -0
- package/server/deploy/server-plugins/onboarding.js +212 -0
- package/server/deploy/silex-platform.yml +75 -0
- package/{src/ts/server → server}/events.ts +2 -2
- package/{src/ts/server → server}/expose.ts +1 -1
- package/{src/ts/server → server}/express.ts +2 -2
- package/{src/ts/server → server}/index.ts +7 -7
- package/{src/ts/server → server}/jobs.test.ts +1 -1
- package/{src/ts/server → server}/jobs.ts +1 -1
- package/server/plugins/DownloadConnector.publish.test.ts +32 -0
- package/server/plugins/DownloadConnector.test.ts +70 -0
- package/{src/ts/plugins/server → server/plugins}/DownloadConnector.ts +22 -10
- package/{src/ts/plugins/server → server/plugins}/FtpConnector.test.ts +3 -3
- package/{src/ts/plugins/server → server/plugins}/FtpConnector.ts +7 -7
- package/{src/ts/plugins/server → server/plugins}/GitlabConnector.ts +9 -26
- package/{src/ts/plugins/server → server/plugins}/GitlabHostingConnector.ts +5 -5
- package/{src/ts/plugins/server → server/plugins}/SslPlugin.ts +2 -2
- package/{src/ts/plugins/server → server/plugins}/StaticPlugin.ts +2 -2
- package/{src/ts/server → server}/utils/BackwardCompat.ts +1 -1
- package/{src/ts/server → server}/utils/websiteDataSerialization.test.ts +2 -2
- package/{src/ts/server → server}/utils/websiteDataSerialization.ts +3 -3
- package/.silex.js +0 -76
- package/dist/client/client/api.d.ts +0 -101
- package/dist/client/client/assetUrl.d.ts +0 -60
- package/dist/client/client/config.d.ts +0 -110
- package/dist/client/client/events.d.ts +0 -23
- package/dist/client/client/expose.d.ts +0 -10
- package/dist/client/client/grapesjs/LoginDialog.d.ts +0 -15
- package/dist/client/client/grapesjs/PublicationManager.d.ts +0 -117
- package/dist/client/client/grapesjs/PublicationUi.d.ts +0 -59
- package/dist/client/client/grapesjs/blocks.d.ts +0 -1
- package/dist/client/client/grapesjs/body-remap.d.ts +0 -15
- package/dist/client/client/grapesjs/breadcrumbs.d.ts +0 -1
- package/dist/client/client/grapesjs/cms/DataSource.d.ts +0 -43
- package/dist/client/client/grapesjs/cms/blocks.d.ts +0 -2
- package/dist/client/client/grapesjs/cms/buttons.d.ts +0 -2
- package/dist/client/client/grapesjs/cms/collection-pages.d.ts +0 -4
- package/dist/client/client/grapesjs/cms/config.d.ts +0 -9
- package/dist/client/client/grapesjs/cms/filters.d.ts +0 -3
- package/dist/client/client/grapesjs/cms/index.d.ts +0 -43
- package/dist/client/client/grapesjs/cms/liquid.d.ts +0 -73
- package/dist/client/client/grapesjs/cms/page-settings.d.ts +0 -6
- package/dist/client/client/grapesjs/cms/publication.d.ts +0 -60
- package/dist/client/client/grapesjs/cms/site-settings.d.ts +0 -3
- package/dist/client/client/grapesjs/cms/states.d.ts +0 -8
- package/dist/client/client/grapesjs/cms/traits.d.ts +0 -8
- package/dist/client/client/grapesjs/core-commands.d.ts +0 -3
- package/dist/client/client/grapesjs/css-props.d.ts +0 -6
- package/dist/client/client/grapesjs/flex.d.ts +0 -3
- package/dist/client/client/grapesjs/footer.d.ts +0 -2
- package/dist/client/client/grapesjs/img.d.ts +0 -6
- package/dist/client/client/grapesjs/index.d.ts +0 -9
- package/dist/client/client/grapesjs/internal-links.d.ts +0 -1
- package/dist/client/client/grapesjs/keymaps.d.ts +0 -123
- package/dist/client/client/grapesjs/li.d.ts +0 -7
- package/dist/client/client/grapesjs/new-page-dialog.d.ts +0 -2
- package/dist/client/client/grapesjs/openImport.d.ts +0 -9
- package/dist/client/client/grapesjs/page-panel.d.ts +0 -13
- package/dist/client/client/grapesjs/project-bar.d.ts +0 -21
- package/dist/client/client/grapesjs/resize-panel.d.ts +0 -1
- package/dist/client/client/grapesjs/rich-text.d.ts +0 -4
- package/dist/client/client/grapesjs/sectors.d.ts +0 -12
- package/dist/client/client/grapesjs/semantic.d.ts +0 -1
- package/dist/client/client/grapesjs/settings-sections.d.ts +0 -19
- package/dist/client/client/grapesjs/settings.d.ts +0 -16
- package/dist/client/client/grapesjs/storage.d.ts +0 -3
- package/dist/client/client/grapesjs/symbolDialogs.d.ts +0 -4
- package/dist/client/client/grapesjs/upload-progress.d.ts +0 -2
- package/dist/client/client/grapesjs/view-buttons.d.ts +0 -2
- package/dist/client/client/index.d.ts +0 -10
- package/dist/client/client/publication-transformers.d.ts +0 -42
- package/dist/client/client/publish-custom-code-block.d.ts +0 -4
- package/dist/client/client/publish-fonts.d.ts +0 -4
- package/dist/client/client/utils.d.ts +0 -23
- package/dist/client/constants.d.ts +0 -35
- package/dist/client/page.d.ts +0 -2
- package/dist/client/types.d.ts +0 -365
- package/dist/client/webfonts/fa-brands-400.ttf +0 -0
- package/dist/client/webfonts/fa-regular-400.ttf +0 -0
- package/dist/client/webfonts/fa-solid-900.ttf +0 -0
- package/dist/client/webfonts/fa-v4compatibility.ttf +0 -0
- package/dist/plugins/client/client/events.d.ts +0 -23
- package/dist/plugins/client/client/events.js +0 -43
- package/dist/plugins/client/client/events.js.map +0 -1
- package/dist/plugins/client/plugins/client/template.d.ts +0 -2
- package/dist/plugins/client/plugins/client/template.js +0 -234
- package/dist/plugins/client/plugins/client/template.js.map +0 -1
- package/dist/plugins/client/plugins/client/website-info.d.ts +0 -1
- package/dist/plugins/client/plugins/client/website-info.js +0 -72
- package/dist/plugins/client/plugins/client/website-info.js.map +0 -1
- package/dist/plugins/client/types.d.ts +0 -365
- package/dist/plugins/client/types.js +0 -83
- package/dist/plugins/client/types.js.map +0 -1
- package/dist/plugins/server/constants.d.ts +0 -35
- package/dist/plugins/server/constants.js +0 -79
- package/dist/plugins/server/constants.js.map +0 -1
- package/dist/plugins/server/page.d.ts +0 -2
- package/dist/plugins/server/page.js +0 -35
- package/dist/plugins/server/page.js.map +0 -1
- package/dist/plugins/server/plugins/server/Cache.d.ts +0 -2
- package/dist/plugins/server/plugins/server/Cache.js +0 -36
- package/dist/plugins/server/plugins/server/Cache.js.map +0 -1
- package/dist/plugins/server/plugins/server/DownloadConnector.d.ts +0 -29
- package/dist/plugins/server/plugins/server/DownloadConnector.js.map +0 -1
- package/dist/plugins/server/plugins/server/FtpConnector.d.ts +0 -86
- package/dist/plugins/server/plugins/server/FtpConnector.js.map +0 -1
- package/dist/plugins/server/plugins/server/GitlabConnector.d.ts +0 -172
- package/dist/plugins/server/plugins/server/GitlabConnector.js.map +0 -1
- package/dist/plugins/server/plugins/server/GitlabHostingConnector.d.ts +0 -23
- package/dist/plugins/server/plugins/server/GitlabHostingConnector.js.map +0 -1
- package/dist/plugins/server/plugins/server/PublicationOptimizer.js +0 -14
- package/dist/plugins/server/plugins/server/PublicationOptimizer.js.map +0 -1
- package/dist/plugins/server/plugins/server/SslPlugin.d.ts +0 -1
- package/dist/plugins/server/plugins/server/SslPlugin.js.map +0 -1
- package/dist/plugins/server/plugins/server/StaticPlugin.d.ts +0 -8
- package/dist/plugins/server/plugins/server/StaticPlugin.js.map +0 -1
- package/dist/plugins/server/server/config.d.ts +0 -59
- package/dist/plugins/server/server/config.js +0 -181
- package/dist/plugins/server/server/config.js.map +0 -1
- package/dist/plugins/server/server/connectors/FsHosting.d.ts +0 -14
- package/dist/plugins/server/server/connectors/FsHosting.js +0 -66
- package/dist/plugins/server/server/connectors/FsHosting.js.map +0 -1
- package/dist/plugins/server/server/connectors/FsStorage.d.ts +0 -44
- package/dist/plugins/server/server/connectors/FsStorage.js +0 -303
- package/dist/plugins/server/server/connectors/FsStorage.js.map +0 -1
- package/dist/plugins/server/server/connectors/connectors.d.ts +0 -86
- package/dist/plugins/server/server/connectors/connectors.js +0 -126
- package/dist/plugins/server/server/connectors/connectors.js.map +0 -1
- package/dist/plugins/server/server/events.d.ts +0 -26
- package/dist/plugins/server/server/events.js +0 -31
- package/dist/plugins/server/server/events.js.map +0 -1
- package/dist/plugins/server/server/jobs.d.ts +0 -12
- package/dist/plugins/server/server/jobs.js +0 -79
- package/dist/plugins/server/server/jobs.js.map +0 -1
- package/dist/plugins/server/server/utils/validation.d.ts +0 -7
- package/dist/plugins/server/server/utils/validation.js +0 -37
- package/dist/plugins/server/server/utils/validation.js.map +0 -1
- package/dist/plugins/server/server/utils/websiteDataSerialization.d.ts +0 -24
- package/dist/plugins/server/server/utils/websiteDataSerialization.js +0 -136
- package/dist/plugins/server/server/utils/websiteDataSerialization.js.map +0 -1
- package/dist/plugins/server/types.d.ts +0 -365
- package/dist/plugins/server/types.js +0 -87
- package/dist/plugins/server/types.js.map +0 -1
- package/dist/server/server/cli.js +0 -71
- package/src/css/grapesjs-light.scss +0 -180
- package/src/ts/plugins/client/template.ts +0 -246
- package/src/ts/plugins/client/website-info.ts +0 -84
- package/src/ts/server/cli.ts +0 -67
- /package/{src/ts → common}/constants.ts +0 -0
- /package/{src/ts → common}/externs.ts +0 -0
- /package/{src/ts → common}/page.ts +0 -0
- /package/{src/ts → common}/types.ts +0 -0
- /package/dist/server/{constants.js → common/constants.js} +0 -0
- /package/dist/server/{page.js → common/page.js} +0 -0
- /package/dist/server/{types.js → common/types.js} +0 -0
- /package/dist/server/{plugins/server → server/plugins}/Cache.js +0 -0
- /package/{src → editor}/css/_mixins.scss +0 -0
- /package/{src → editor}/css/_variables.scss +0 -0
- /package/{src → editor}/css/dialog.scss +0 -0
- /package/{src → editor}/css/dialogs.scss +0 -0
- /package/{src → editor}/css/fonts.scss +0 -0
- /package/{src → editor}/css/footer.scss +0 -0
- /package/{src → editor}/css/grapesjs-plugins.scss +0 -0
- /package/{src → editor}/css/grapesjs.scss +0 -0
- /package/{src → editor}/css/loader.scss +0 -0
- /package/{src → editor}/css/page-panel.scss +0 -0
- /package/{src → editor}/css/panels.scss +0 -0
- /package/{src → editor}/css/silex.scss +0 -0
- /package/{src → editor}/css/theme-base.scss +0 -0
- /package/{src → editor}/css/website-info.scss +0 -0
- /package/{src/ts/client → editor}/events.ts +0 -0
- /package/{src/ts/client → editor}/grapesjs/blocks.ts +0 -0
- /package/{src/ts/client → editor}/grapesjs/body-remap.ts +0 -0
- /package/{src/ts/client → editor}/grapesjs/breadcrumbs.ts +0 -0
- /package/{src/ts/client → editor}/grapesjs/cms/DataSource.ts +0 -0
- /package/{src/ts/client → editor}/grapesjs/cms/blocks.ts +0 -0
- /package/{src/ts/client → editor}/grapesjs/cms/buttons.ts +0 -0
- /package/{src/ts/client → editor}/grapesjs/cms/collection-pages.ts +0 -0
- /package/{src/ts/client → editor}/grapesjs/cms/config.ts +0 -0
- /package/{src/ts/client → editor}/grapesjs/cms/filters.ts +0 -0
- /package/{src/ts/client → editor}/grapesjs/cms/liquid.mock.ts +0 -0
- /package/{src/ts/client → editor}/grapesjs/cms/liquid.test.ts +0 -0
- /package/{src/ts/client → editor}/grapesjs/cms/liquid.ts +0 -0
- /package/{src/ts/client → editor}/grapesjs/cms/publication.test.ts +0 -0
- /package/{src/ts/client → editor}/grapesjs/cms/site-settings.ts +0 -0
- /package/{src/ts/client → editor}/grapesjs/cms/states.ts +0 -0
- /package/{src/ts/client → editor}/grapesjs/cms/traits.ts +0 -0
- /package/{src/ts/client → editor}/grapesjs/core-commands.ts +0 -0
- /package/{src/ts/client → editor}/grapesjs/css-props.ts +0 -0
- /package/{src/ts/client → editor}/grapesjs/flex.ts +0 -0
- /package/{src/ts/client → editor}/grapesjs/footer.ts +0 -0
- /package/{src/ts/client → editor}/grapesjs/img.ts +0 -0
- /package/{src/ts/client → editor}/grapesjs/internal-links.test.ts +0 -0
- /package/{src/ts/client → editor}/grapesjs/keymaps.ts +0 -0
- /package/{src/ts/client → editor}/grapesjs/li.ts +0 -0
- /package/{src/ts/client → editor}/grapesjs/new-page-dialog.ts +0 -0
- /package/{src/ts/client → editor}/grapesjs/openImport.ts +0 -0
- /package/{src/ts/client → editor}/grapesjs/page-panel.ts +0 -0
- /package/{src/ts/client → editor}/grapesjs/project-bar.ts +0 -0
- /package/{src/ts/client → editor}/grapesjs/rich-text.ts +0 -0
- /package/{src/ts/client → editor}/grapesjs/sectors.ts +0 -0
- /package/{src/ts/client → editor}/grapesjs/semantic.ts +0 -0
- /package/{src/ts/client → editor}/grapesjs/static-plugins.ts +0 -0
- /package/{src/ts/client → editor}/grapesjs/symbolDialogs.ts +0 -0
- /package/{src/ts/client → editor}/grapesjs/upload-progress.ts +0 -0
- /package/{src/ts/client → editor}/grapesjs/view-buttons.ts +0 -0
- /package/{src → editor}/html/debug.pug +0 -0
- /package/{src → editor}/html/index.pug +0 -0
- /package/{src → editor}/html/templates/includes.pug +0 -0
- /package/{src → editor}/html/templates/workspace.pug +0 -0
- /package/{src/ts/client → editor}/publish-custom-code-block.ts +0 -0
- /package/{src/ts/client → editor}/utils.ts +0 -0
- /package/{dist/plugins/server/plugins/server/PublicationOptimizer.d.ts → grapesjs-plugins/expression-input/docs/.nojekyll} +0 -0
- /package/{src/ts/plugins/server → server/plugins}/Cache.ts +0 -0
- /package/{src/ts/plugins/server → server/plugins}/PublicationOptimizer.ts +0 -0
- /package/{src/ts/server → server}/utils/validation.ts +0 -0
|
@@ -0,0 +1,528 @@
|
|
|
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 {LitElement, TemplateResult, html} from 'lit'
|
|
19
|
+
import {property} from 'lit/decorators.js'
|
|
20
|
+
import { Ref, createRef, ref } from 'lit/directives/ref.js'
|
|
21
|
+
import { styleMap } from 'lit/directives/style-map.js'
|
|
22
|
+
import { PROPERTY_STYLES } from './defaultStyles'
|
|
23
|
+
import { DATA_SOURCE_CHANGED, DATA_SOURCE_DATA_LOAD_END, Filter, FIXED_TOKEN_ID, Property, Token } from '../types'
|
|
24
|
+
import { fromString, getFixedToken, getTokenDisplayName, groupByType, toExpression, toId, toValue } from '../utils'
|
|
25
|
+
import { ExpressionInput, PopinForm } from '@silexlabs/expression-input'
|
|
26
|
+
import { Component, Editor } from 'grapesjs'
|
|
27
|
+
|
|
28
|
+
import '@silexlabs/expression-input'
|
|
29
|
+
import { getCompletion } from '../model/completion'
|
|
30
|
+
import { evaluateExpressionTokens, EvaluationContext } from '../model/expressionEvaluator'
|
|
31
|
+
import { getAllDataSources } from '../model/dataSourceRegistry'
|
|
32
|
+
import { getFilters, getPreviewData, getManager } from '../model/dataSourceManager'
|
|
33
|
+
import { fromStored, getExpressionResultType } from '../model/token'
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Editor for a state of the selected element's properties
|
|
37
|
+
*
|
|
38
|
+
* Usage:
|
|
39
|
+
*
|
|
40
|
+
* ```
|
|
41
|
+
* <state-editor
|
|
42
|
+
* name="state"
|
|
43
|
+
* disabled
|
|
44
|
+
* hide-loop-data
|
|
45
|
+
* parent-name="parent"
|
|
46
|
+
* no-filters
|
|
47
|
+
* root-type="root"
|
|
48
|
+
* default-fixed
|
|
49
|
+
* dismiss-current-component-states
|
|
50
|
+
* ></state-editor>
|
|
51
|
+
* ```
|
|
52
|
+
*
|
|
53
|
+
*/
|
|
54
|
+
|
|
55
|
+
export class StateEditor extends LitElement {
|
|
56
|
+
@property({type: Boolean})
|
|
57
|
+
disabled = false
|
|
58
|
+
|
|
59
|
+
@property({type: String})
|
|
60
|
+
name = ''
|
|
61
|
+
|
|
62
|
+
@property({type: Boolean, attribute: 'hide-loop-data'})
|
|
63
|
+
hideLoopData = false
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* used in the expressions found in filters options
|
|
67
|
+
* This will be used to filter states which are not defined yet
|
|
68
|
+
*/
|
|
69
|
+
@property({type: String, attribute: 'parent-name'})
|
|
70
|
+
parentName = ''
|
|
71
|
+
|
|
72
|
+
@property({type: Boolean, attribute: 'no-filters'})
|
|
73
|
+
noFilters = false
|
|
74
|
+
|
|
75
|
+
@property({type: String, attribute: 'root-type'})
|
|
76
|
+
rootType = ''
|
|
77
|
+
|
|
78
|
+
@property({type: Boolean, attribute: 'default-fixed'})
|
|
79
|
+
defaultFixed = false
|
|
80
|
+
|
|
81
|
+
// Note: dismissCurrentComponentStates not used in this project anymore
|
|
82
|
+
@property({type: Boolean, attribute: 'dismiss-current-component-states'})
|
|
83
|
+
dismissCurrentComponentStates = false
|
|
84
|
+
|
|
85
|
+
private _selected: Component | null = null
|
|
86
|
+
@property({type: Object})
|
|
87
|
+
get selected(): Component | null {
|
|
88
|
+
return this._selected
|
|
89
|
+
}
|
|
90
|
+
set selected(value: Component | null) {
|
|
91
|
+
this._selected = value
|
|
92
|
+
this.requestUpdate()
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Value string for for submissions
|
|
97
|
+
*/
|
|
98
|
+
@property()
|
|
99
|
+
get value(): string {
|
|
100
|
+
return JSON.stringify(this.data)
|
|
101
|
+
}
|
|
102
|
+
set value(newValue: string) {
|
|
103
|
+
const expression = toExpression(newValue)
|
|
104
|
+
if (!expression) {
|
|
105
|
+
this.data = newValue
|
|
106
|
+
return
|
|
107
|
+
}
|
|
108
|
+
this.data = expression as Token[]
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Form id
|
|
113
|
+
* This is the same API as input elements
|
|
114
|
+
*/
|
|
115
|
+
@property({type: String, attribute: 'for'})
|
|
116
|
+
for = ''
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Binded listeners
|
|
120
|
+
*/
|
|
121
|
+
private onFormdata_ = this.onFormdata.bind(this)
|
|
122
|
+
private renderBinded = () => this.requestUpdate()
|
|
123
|
+
|
|
124
|
+
override connectedCallback() {
|
|
125
|
+
super.connectedCallback()
|
|
126
|
+
// Use the form to add formdata
|
|
127
|
+
if(this.for) {
|
|
128
|
+
const form = document.querySelector<HTMLFormElement>(`form#${this.for}`)
|
|
129
|
+
if(form) {
|
|
130
|
+
this.form = form
|
|
131
|
+
}
|
|
132
|
+
} else {
|
|
133
|
+
this.form = this.closest('form')
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
this.editor?.on(`${DATA_SOURCE_CHANGED} ${DATA_SOURCE_DATA_LOAD_END}`, this.renderBinded)
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
override disconnectedCallback() {
|
|
140
|
+
this.form = null
|
|
141
|
+
super.disconnectedCallback()
|
|
142
|
+
this.editor?.off(`${DATA_SOURCE_CHANGED} ${DATA_SOURCE_DATA_LOAD_END}`, this.renderBinded)
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Handle formdata event to add the current value to the form
|
|
147
|
+
*/
|
|
148
|
+
private onFormdata(event: FormDataEvent) {
|
|
149
|
+
event.preventDefault()
|
|
150
|
+
const formData = event.formData
|
|
151
|
+
formData.set(this.name, this.value)
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Form setter
|
|
156
|
+
* Handle formdata event to add the current value to the form
|
|
157
|
+
*/
|
|
158
|
+
protected _form: HTMLFormElement | null = null
|
|
159
|
+
set form(newForm: HTMLFormElement | null) {
|
|
160
|
+
if(this._form) {
|
|
161
|
+
this._form.removeEventListener('formdata', this.onFormdata_)
|
|
162
|
+
}
|
|
163
|
+
if(newForm) {
|
|
164
|
+
newForm.addEventListener('formdata', this.onFormdata_)
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
get form() {
|
|
168
|
+
return this._form
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Structured data
|
|
173
|
+
*/
|
|
174
|
+
private _data: Token[] = []
|
|
175
|
+
get data(): Token[] {
|
|
176
|
+
const input = this.expressionInputRef.value
|
|
177
|
+
if(!this._selected || !this.editor) {
|
|
178
|
+
console.error('selected and editor are required', this._selected, this.editor)
|
|
179
|
+
//throw new Error('selected and editor are required')
|
|
180
|
+
return []
|
|
181
|
+
}
|
|
182
|
+
if(!input || input.value.length === 0) return []
|
|
183
|
+
if(input.fixed) {
|
|
184
|
+
return [getFixedToken(input.value[0] || '')]
|
|
185
|
+
} else {
|
|
186
|
+
const ids = input.value
|
|
187
|
+
return ids
|
|
188
|
+
.filter((id: string) => !!id)
|
|
189
|
+
.map((id: string) => {
|
|
190
|
+
try {
|
|
191
|
+
return fromString(this.editor!, id, this.selected!.getId())
|
|
192
|
+
} catch(e) {
|
|
193
|
+
console.error(`Error while getting token from id ${id}`, e)
|
|
194
|
+
// Return unknown
|
|
195
|
+
return {
|
|
196
|
+
type: 'property',
|
|
197
|
+
propType: 'field',
|
|
198
|
+
fieldId: 'unknown',
|
|
199
|
+
label: 'Unknown',
|
|
200
|
+
kind: 'scalar',
|
|
201
|
+
typeIds: [],
|
|
202
|
+
options: {},
|
|
203
|
+
} as Property
|
|
204
|
+
}
|
|
205
|
+
})
|
|
206
|
+
// Here the data is missing options as data comes from completion
|
|
207
|
+
// Add the options
|
|
208
|
+
.map((token: Token, idx: number) => {
|
|
209
|
+
const popin = this.popinsRef[idx]?.value
|
|
210
|
+
switch(token.type) {
|
|
211
|
+
case 'property':
|
|
212
|
+
case 'filter':
|
|
213
|
+
token.options = popin?.value || token.options
|
|
214
|
+
break
|
|
215
|
+
default:
|
|
216
|
+
break
|
|
217
|
+
}
|
|
218
|
+
return token
|
|
219
|
+
})
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
set data(value: Token[] | string) {
|
|
223
|
+
if(typeof value === 'string') {
|
|
224
|
+
this._data = value === '' ? [] : [getFixedToken(value)]
|
|
225
|
+
} else {
|
|
226
|
+
this._data = value
|
|
227
|
+
}
|
|
228
|
+
if (this.editor) this.requestUpdate()
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
private _editor: Editor | null = null
|
|
232
|
+
@property({type: Object})
|
|
233
|
+
get editor(): Editor | null {
|
|
234
|
+
return this._editor
|
|
235
|
+
}
|
|
236
|
+
set editor(value: Editor | null) {
|
|
237
|
+
this._editor = value
|
|
238
|
+
this.requestUpdate()
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
private redrawing = false
|
|
242
|
+
private expressionInputRef = createRef<ExpressionInput>()
|
|
243
|
+
private popinsRef: Ref<PopinForm>[] = []
|
|
244
|
+
|
|
245
|
+
override render() {
|
|
246
|
+
this.noFilters = false
|
|
247
|
+
this.redrawing = true
|
|
248
|
+
super.render()
|
|
249
|
+
if(!this.name) throw new Error('name is required on state-editor')
|
|
250
|
+
if(!this.editor || !this.selected) {
|
|
251
|
+
console.error('editor and selected are required', this.editor, this.selected)
|
|
252
|
+
return html`<div class="ds-section
|
|
253
|
+
ds-section--error">Error rendering state-editor component: editor and selected are required</div>`
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
const selected = this.selected
|
|
257
|
+
// FIXME: fromStored every time we render is not efficient, it is supposed to have been done before
|
|
258
|
+
const _currentValue = this._data.map(token => fromStored(token, selected.getId()))
|
|
259
|
+
|
|
260
|
+
// Get the data to show in the "+" drop down
|
|
261
|
+
const manager = getManager()
|
|
262
|
+
const completion = getCompletion({
|
|
263
|
+
component: this.dismissCurrentComponentStates ? selected.parent()! : selected,
|
|
264
|
+
expression: _currentValue || [],
|
|
265
|
+
rootType: this.rootType,
|
|
266
|
+
currentStateId: this.parentName || this.name,
|
|
267
|
+
hideLoopData: this.hideLoopData,
|
|
268
|
+
manager,
|
|
269
|
+
})
|
|
270
|
+
.filter(token => token.type !== 'filter' || !this.noFilters)
|
|
271
|
+
|
|
272
|
+
const groupedCompletion = groupByType(this.editor, selected, completion, _currentValue)
|
|
273
|
+
|
|
274
|
+
// Check if the expression has a fixed value and nothing else
|
|
275
|
+
const fixed = (_currentValue?.length === 1 && _currentValue[0].type === 'property' && _currentValue[0].fieldId === FIXED_TOKEN_ID)
|
|
276
|
+
// If the value is empty and the default is fixed, then the input is fixed
|
|
277
|
+
|| (this.defaultFixed && _currentValue.length === 0)
|
|
278
|
+
// If there is no completion and the value is empty
|
|
279
|
+
|| (completion.length === 0 && _currentValue.length === 0)
|
|
280
|
+
|
|
281
|
+
// Fixed text
|
|
282
|
+
const text = fixed ? (_currentValue![0] as Property)?.options?.value || '' : ''
|
|
283
|
+
|
|
284
|
+
let currentData = '' as unknown
|
|
285
|
+
try {
|
|
286
|
+
const context: EvaluationContext = {
|
|
287
|
+
dataSources: getAllDataSources(),
|
|
288
|
+
filters: getFilters(),
|
|
289
|
+
previewData: getPreviewData(),
|
|
290
|
+
component: selected,
|
|
291
|
+
resolvePreviewIndex: true,
|
|
292
|
+
}
|
|
293
|
+
const realData = evaluateExpressionTokens(_currentValue || [], context)
|
|
294
|
+
currentData = realData
|
|
295
|
+
} catch(e) {
|
|
296
|
+
console.error('Current data could not be retrieved:', e)
|
|
297
|
+
}
|
|
298
|
+
if (typeof currentData === 'undefined' || currentData === null) currentData = ''
|
|
299
|
+
// Build the expression input
|
|
300
|
+
const result = html`
|
|
301
|
+
<expression-input
|
|
302
|
+
@change=${(event: Event) => this.onChangeValue(event)}
|
|
303
|
+
data-is-input
|
|
304
|
+
${ref(this.expressionInputRef)}
|
|
305
|
+
.fixed=${fixed}
|
|
306
|
+
class="ds-section"
|
|
307
|
+
name=${this.name}
|
|
308
|
+
reactive
|
|
309
|
+
>
|
|
310
|
+
<style>
|
|
311
|
+
${PROPERTY_STYLES}
|
|
312
|
+
</style>
|
|
313
|
+
<slot name="label" slot="label"></slot>
|
|
314
|
+
<div slot="fixed" class="ds-slot-fixed">
|
|
315
|
+
<input
|
|
316
|
+
type="text"
|
|
317
|
+
class="ds-expression-input__fixed"
|
|
318
|
+
placeholder="Enter a text or switch to expression mode"
|
|
319
|
+
.value=${text}
|
|
320
|
+
/>
|
|
321
|
+
</div>
|
|
322
|
+
${ _currentValue && _currentValue.length > 0 ? html`
|
|
323
|
+
${ _currentValue.map((token: Token, idx: number) => {
|
|
324
|
+
this.popinsRef[idx] = createRef<PopinForm>()
|
|
325
|
+
const optionsForm = this.getOptions(selected, _currentValue, idx)
|
|
326
|
+
const partialExpression = _currentValue.slice(0, idx)
|
|
327
|
+
|
|
328
|
+
const _partialCompletion = getCompletion({
|
|
329
|
+
component: this.dismissCurrentComponentStates ? selected.parent()! : selected,
|
|
330
|
+
expression: partialExpression,
|
|
331
|
+
rootType: this.rootType,
|
|
332
|
+
currentStateId: idx === 0 ? this.parentName || this.name : undefined,
|
|
333
|
+
hideLoopData: this.hideLoopData,
|
|
334
|
+
manager,
|
|
335
|
+
})
|
|
336
|
+
const partialCompletion = this.noFilters ? _partialCompletion
|
|
337
|
+
.filter(token => token.type !== 'filter')
|
|
338
|
+
: _partialCompletion
|
|
339
|
+
const partialGroupedCompletion = groupByType(this.editor!, selected, partialCompletion, _currentValue.slice(0, idx))
|
|
340
|
+
const id = toId(token)
|
|
341
|
+
return html`
|
|
342
|
+
<select>
|
|
343
|
+
<option value="">-</option>
|
|
344
|
+
${ Object.entries(partialGroupedCompletion)
|
|
345
|
+
.reverse()
|
|
346
|
+
.map(([type, completion]) => {
|
|
347
|
+
return html`
|
|
348
|
+
<optgroup label="${type}">
|
|
349
|
+
${ completion
|
|
350
|
+
.map(partialToken => ({
|
|
351
|
+
displayName: getTokenDisplayName(selected, partialToken),
|
|
352
|
+
partialToken,
|
|
353
|
+
}))
|
|
354
|
+
.sort((a, b) => a.displayName.localeCompare(b.displayName))
|
|
355
|
+
.map(({partialToken, displayName}) => {
|
|
356
|
+
const partialId = toId(partialToken)
|
|
357
|
+
return html`
|
|
358
|
+
<option value=${toValue(partialToken)} .selected=${partialId === id}>${displayName}</option>
|
|
359
|
+
`
|
|
360
|
+
})
|
|
361
|
+
}
|
|
362
|
+
</optgroup>
|
|
363
|
+
`
|
|
364
|
+
})
|
|
365
|
+
}
|
|
366
|
+
</select>
|
|
367
|
+
<button
|
|
368
|
+
class="ds-expression-input__options-button"
|
|
369
|
+
style=${styleMap({ display: optionsForm === '' ? 'none' : '' })}
|
|
370
|
+
@click=${(e: MouseEvent) => {
|
|
371
|
+
this.popinsRef[idx].value?.openAt(e.currentTarget as HTMLElement)
|
|
372
|
+
}}
|
|
373
|
+
>...</button>
|
|
374
|
+
<popin-form
|
|
375
|
+
${ref(this.popinsRef[idx])}
|
|
376
|
+
hidden
|
|
377
|
+
name=${`${this.name}_options_${idx}`}
|
|
378
|
+
@change=${(event: Event) => this.onChangeOptions(event, selected, this.popinsRef[idx].value!, idx)}
|
|
379
|
+
>
|
|
380
|
+
${optionsForm}
|
|
381
|
+
</popin-form>
|
|
382
|
+
`
|
|
383
|
+
})
|
|
384
|
+
}
|
|
385
|
+
` : '' }
|
|
386
|
+
${Object.entries(groupedCompletion).length ? html`
|
|
387
|
+
<select
|
|
388
|
+
class="ds-expression-input__add"
|
|
389
|
+
${ref(el => el && ((el as HTMLSelectElement).value = ''))}
|
|
390
|
+
>
|
|
391
|
+
<option value="" selected>+</option>
|
|
392
|
+
${ Object.entries(groupedCompletion)
|
|
393
|
+
.reverse()
|
|
394
|
+
.map(([type, completion]) => {
|
|
395
|
+
return html`
|
|
396
|
+
<optgroup label="${type}">
|
|
397
|
+
${ completion
|
|
398
|
+
.map(token => ({
|
|
399
|
+
displayName: getTokenDisplayName(selected, token),
|
|
400
|
+
token,
|
|
401
|
+
}))
|
|
402
|
+
.sort((a, b) => a.displayName.localeCompare(b.displayName))
|
|
403
|
+
.map(({displayName, token}) => {
|
|
404
|
+
return html`<option value="${toValue(token)}">${displayName}</option>`
|
|
405
|
+
})
|
|
406
|
+
}
|
|
407
|
+
</optgroup>
|
|
408
|
+
`
|
|
409
|
+
})
|
|
410
|
+
}
|
|
411
|
+
</select>
|
|
412
|
+
` : ''}
|
|
413
|
+
</expression-input>
|
|
414
|
+
<div class="ds-real-data">
|
|
415
|
+
<code class="ds-real-data__display">
|
|
416
|
+
${Array.isArray(currentData) ? html`${currentData.length} objects with ${Object.keys(currentData[0] || {}).filter(k => k !== '__typename').join(', ')}` : currentData}
|
|
417
|
+
</code>
|
|
418
|
+
</div>
|
|
419
|
+
`
|
|
420
|
+
this.redrawing = false
|
|
421
|
+
return result
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
private onChangeValue(event: Event) {
|
|
425
|
+
if(this.redrawing) return
|
|
426
|
+
const idx = (event as CustomEvent).detail?.idx
|
|
427
|
+
if(idx >= 0) {
|
|
428
|
+
// Custom event coming from the expression input
|
|
429
|
+
// Remove the tokens after the changed one
|
|
430
|
+
const data = this.data.slice(0, idx + 1)
|
|
431
|
+
if(data.length > idx) {
|
|
432
|
+
// Clear options
|
|
433
|
+
if(data[idx].type === 'property' || data[idx].type === 'filter') {
|
|
434
|
+
(data[idx] as Property | Filter).options = {}
|
|
435
|
+
}
|
|
436
|
+
} else {
|
|
437
|
+
// We selected the "-" option, do nothing, this step will be removed
|
|
438
|
+
}
|
|
439
|
+
this.data = data
|
|
440
|
+
} else if(idx === -1) {
|
|
441
|
+
// Clear expression (case when user clicks reset/clear button)
|
|
442
|
+
this.data = []
|
|
443
|
+
} else {
|
|
444
|
+
// Event coming from the options (no idx in detail)
|
|
445
|
+
}
|
|
446
|
+
// Stop default behavior of inputs
|
|
447
|
+
event.preventDefault()
|
|
448
|
+
event.stopImmediatePropagation()
|
|
449
|
+
event.stopPropagation()
|
|
450
|
+
// Let the redraw update this.data
|
|
451
|
+
setTimeout(() => this.dispatchEvent(new Event('change', { bubbles: true })))
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
private onChangeOptions(event: Event, component: Component, popin: PopinForm, idx: number) {
|
|
455
|
+
if(this.redrawing) return
|
|
456
|
+
if(!this.editor) throw new Error('editor is required')
|
|
457
|
+
const input = this.expressionInputRef.value!
|
|
458
|
+
const tokensStrings = input.value
|
|
459
|
+
// Get tokens as objects
|
|
460
|
+
const tokens = tokensStrings
|
|
461
|
+
.filter((id: string) => !!id)
|
|
462
|
+
.map((id: string) => {
|
|
463
|
+
try {
|
|
464
|
+
return fromString(this.editor!, id, component.getId())
|
|
465
|
+
} catch(e) {
|
|
466
|
+
// FIXME: notify user
|
|
467
|
+
console.error('Error while getting token from string', {id}, e)
|
|
468
|
+
// Return unknown
|
|
469
|
+
return {
|
|
470
|
+
type: 'property',
|
|
471
|
+
propType: 'field',
|
|
472
|
+
fieldId: 'unknown',
|
|
473
|
+
label: 'Unknown',
|
|
474
|
+
kind: 'scalar',
|
|
475
|
+
typeIds: [],
|
|
476
|
+
options: {},
|
|
477
|
+
} as Property
|
|
478
|
+
}
|
|
479
|
+
})
|
|
480
|
+
// Get the selected options
|
|
481
|
+
const options = input.options
|
|
482
|
+
.filter((o: HTMLOptionElement) => o.selected)
|
|
483
|
+
// Update the options of the token
|
|
484
|
+
;(tokens[idx] as Property | Filter).options = popin.value
|
|
485
|
+
// Update the dom
|
|
486
|
+
options[idx].value = toValue(tokens[idx])
|
|
487
|
+
// Update the state
|
|
488
|
+
this.requestUpdate()
|
|
489
|
+
// Stop the original event
|
|
490
|
+
event.preventDefault()
|
|
491
|
+
event.stopImmediatePropagation()
|
|
492
|
+
event.stopPropagation()
|
|
493
|
+
// Notify the owner
|
|
494
|
+
this.dispatchEvent(new Event('change', { bubbles: true }))
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
private getOptions(component: Component, tokens: Token[], idx: number): TemplateResult | '' {
|
|
498
|
+
if(!this.editor) throw new Error('editor is required')
|
|
499
|
+
const token = tokens[idx]
|
|
500
|
+
const beforeToken = tokens.slice(0, idx)
|
|
501
|
+
const fields = beforeToken
|
|
502
|
+
.map(token => {
|
|
503
|
+
try {
|
|
504
|
+
return getExpressionResultType(tokens.concat(token), component)
|
|
505
|
+
} catch(e) {
|
|
506
|
+
// FIXME: notify the user
|
|
507
|
+
console.error(`Error while getting expression result type for token ${token} on component ${component.getName()}#${component.get('id')}.${component.getClasses().join('.')} (${component.cid})`, e)
|
|
508
|
+
return null
|
|
509
|
+
}
|
|
510
|
+
})
|
|
511
|
+
|
|
512
|
+
switch(token.type) {
|
|
513
|
+
case 'property':
|
|
514
|
+
case 'filter':
|
|
515
|
+
if(token.optionsForm) {
|
|
516
|
+
const form = token.optionsForm(component, fields[fields.length - 1], token.options || {}, this.parentName || this.name)
|
|
517
|
+
return form || ''
|
|
518
|
+
}
|
|
519
|
+
return ''
|
|
520
|
+
default:
|
|
521
|
+
return ''
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
if(!window.customElements.get('state-editor')) {
|
|
527
|
+
window.customElements.define('state-editor', StateEditor)
|
|
528
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
root = true
|
|
2
|
+
|
|
3
|
+
[*]
|
|
4
|
+
indent_style = space
|
|
5
|
+
indent_size = 2
|
|
6
|
+
end_of_line = lf
|
|
7
|
+
charset = utf-8
|
|
8
|
+
trim_trailing_whitespace = true
|
|
9
|
+
insert_final_newline = true
|
|
10
|
+
|
|
11
|
+
[{package.json,*.yml}]
|
|
12
|
+
indent_style = space
|
|
13
|
+
indent_size = 2
|
|
14
|
+
|
|
15
|
+
[*.md]
|
|
16
|
+
trim_trailing_whitespace = false
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"parser": "babel-eslint",
|
|
3
|
+
"extends": "eslint:recommended",
|
|
4
|
+
"env": {
|
|
5
|
+
"commonjs": true,
|
|
6
|
+
"es6": true,
|
|
7
|
+
"node": true,
|
|
8
|
+
"browser": false
|
|
9
|
+
},
|
|
10
|
+
"parserOptions": {
|
|
11
|
+
"ecmaFeatures": {
|
|
12
|
+
"experimentalObjectRestSpread": true,
|
|
13
|
+
"jsx": false
|
|
14
|
+
},
|
|
15
|
+
"sourceType": "module"
|
|
16
|
+
},
|
|
17
|
+
"globals": {
|
|
18
|
+
"strapi": true
|
|
19
|
+
},
|
|
20
|
+
"rules": {
|
|
21
|
+
"indent": ["error", 2, { "SwitchCase": 1 }],
|
|
22
|
+
"linebreak-style": ["error", "unix"],
|
|
23
|
+
"no-console": 0,
|
|
24
|
+
"quotes": ["error", "single"],
|
|
25
|
+
"semi": ["error", "always"]
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# 🚀 Getting started with Strapi
|
|
2
|
+
|
|
3
|
+
Strapi comes with a full featured [Command Line Interface](https://docs.strapi.io/dev-docs/cli) (CLI) which lets you scaffold and manage your project in seconds.
|
|
4
|
+
|
|
5
|
+
### `develop`
|
|
6
|
+
|
|
7
|
+
Start your Strapi application with autoReload enabled. [Learn more](https://docs.strapi.io/dev-docs/cli#strapi-develop)
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
npm run develop
|
|
11
|
+
# or
|
|
12
|
+
yarn develop
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
### `start`
|
|
16
|
+
|
|
17
|
+
Start your Strapi application with autoReload disabled. [Learn more](https://docs.strapi.io/dev-docs/cli#strapi-start)
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
npm run start
|
|
21
|
+
# or
|
|
22
|
+
yarn start
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### `build`
|
|
26
|
+
|
|
27
|
+
Build your admin panel. [Learn more](https://docs.strapi.io/dev-docs/cli#strapi-build)
|
|
28
|
+
|
|
29
|
+
```
|
|
30
|
+
npm run build
|
|
31
|
+
# or
|
|
32
|
+
yarn build
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## ⚙️ Deployment
|
|
36
|
+
|
|
37
|
+
Strapi gives you many possible deployment options for your project including [Strapi Cloud](https://cloud.strapi.io). Browse the [deployment section of the documentation](https://docs.strapi.io/dev-docs/deployment) to find the best solution for your use case.
|
|
38
|
+
|
|
39
|
+
## 📚 Learn more
|
|
40
|
+
|
|
41
|
+
- [Resource center](https://strapi.io/resource-center) - Strapi resource center.
|
|
42
|
+
- [Strapi documentation](https://docs.strapi.io) - Official Strapi documentation.
|
|
43
|
+
- [Strapi tutorials](https://strapi.io/tutorials) - List of tutorials made by the core team and the community.
|
|
44
|
+
- [Strapi blog](https://strapi.io/blog) - Official Strapi blog containing articles made by the Strapi team and the community.
|
|
45
|
+
- [Changelog](https://strapi.io/changelog) - Find out about the Strapi product updates, new features and general improvements.
|
|
46
|
+
|
|
47
|
+
Feel free to check out the [Strapi GitHub repository](https://github.com/strapi/strapi). Your feedback and contributions are welcome!
|
|
48
|
+
|
|
49
|
+
## ✨ Community
|
|
50
|
+
|
|
51
|
+
- [Discord](https://discord.strapi.io) - Come chat with the Strapi community including the core team.
|
|
52
|
+
- [Forum](https://forum.strapi.io/) - Place to discuss, ask questions and find answers, show your Strapi project and get feedback or just talk with other Community members.
|
|
53
|
+
- [Awesome Strapi](https://github.com/strapi/awesome-strapi) - A curated list of awesome things related to Strapi.
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
<sub>🤫 Psst! [Strapi is hiring](https://strapi.io/careers).</sub>
|