@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,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@silexlabs/grapesjs-fonts",
|
|
3
|
+
"version": "1.2.2",
|
|
4
|
+
"description": "GrapesJS Fonts",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist",
|
|
9
|
+
"src",
|
|
10
|
+
"README.md",
|
|
11
|
+
"LICENSE"
|
|
12
|
+
],
|
|
13
|
+
"repository": {
|
|
14
|
+
"type": "git",
|
|
15
|
+
"url": "https://github.com/silexlabs/grapesjs-fonts.git"
|
|
16
|
+
},
|
|
17
|
+
"engines": {
|
|
18
|
+
"node": ">=16.0.0"
|
|
19
|
+
},
|
|
20
|
+
"scripts": {
|
|
21
|
+
"start": "grapesjs-cli serve",
|
|
22
|
+
"build": "grapesjs-cli build --patch=false",
|
|
23
|
+
"lint": "eslint src"
|
|
24
|
+
},
|
|
25
|
+
"keywords": [
|
|
26
|
+
"silex",
|
|
27
|
+
"grapesjs",
|
|
28
|
+
"grapesjs-plugin",
|
|
29
|
+
"plugin",
|
|
30
|
+
"font",
|
|
31
|
+
"typography"
|
|
32
|
+
],
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"eslint": "^10.6.0",
|
|
35
|
+
"grapesjs-cli": "^4.1.3"
|
|
36
|
+
},
|
|
37
|
+
"peerDependencies": {
|
|
38
|
+
"grapesjs": ">=0.19.0 <0.23.0",
|
|
39
|
+
"lit-html": "*"
|
|
40
|
+
},
|
|
41
|
+
"author": {
|
|
42
|
+
"name": "Alex Hoyau",
|
|
43
|
+
"url": "https://lexoyo.me/"
|
|
44
|
+
},
|
|
45
|
+
"license": "GPL-3.0"
|
|
46
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { cmdGetHtml, cmdFontsInstalled, cmdFontsAvailable, cmdFontsInstall, cmdFontsRemove } from './commands.js'
|
|
2
|
+
|
|
3
|
+
export function registerCapabilities(addCapability) {
|
|
4
|
+
addCapability({
|
|
5
|
+
id: cmdGetHtml,
|
|
6
|
+
command: cmdGetHtml,
|
|
7
|
+
description: 'Get HTML imports for installed fonts',
|
|
8
|
+
readOnly: true,
|
|
9
|
+
tags: ['fonts'],
|
|
10
|
+
})
|
|
11
|
+
addCapability({
|
|
12
|
+
id: cmdFontsInstalled,
|
|
13
|
+
command: cmdFontsInstalled,
|
|
14
|
+
description: 'List installed fonts',
|
|
15
|
+
readOnly: true,
|
|
16
|
+
tags: ['fonts'],
|
|
17
|
+
})
|
|
18
|
+
addCapability({
|
|
19
|
+
id: cmdFontsAvailable,
|
|
20
|
+
command: cmdFontsAvailable,
|
|
21
|
+
description: 'List available Google Fonts',
|
|
22
|
+
readOnly: true,
|
|
23
|
+
openWorld: true,
|
|
24
|
+
inputSchema: {
|
|
25
|
+
type: 'object',
|
|
26
|
+
properties: {
|
|
27
|
+
search: { type: 'string' },
|
|
28
|
+
category: { type: 'string', enum: ['serif', 'sans-serif', 'display', 'handwriting', 'monospace'] },
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
tags: ['fonts'],
|
|
32
|
+
})
|
|
33
|
+
addCapability({
|
|
34
|
+
id: cmdFontsInstall,
|
|
35
|
+
command: cmdFontsInstall,
|
|
36
|
+
description: 'Install a Google Font by family name',
|
|
37
|
+
openWorld: true,
|
|
38
|
+
inputSchema: {
|
|
39
|
+
type: 'object',
|
|
40
|
+
required: ['family'],
|
|
41
|
+
properties: {
|
|
42
|
+
family: { type: 'string' },
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
tags: ['fonts'],
|
|
46
|
+
})
|
|
47
|
+
addCapability({
|
|
48
|
+
id: cmdFontsRemove,
|
|
49
|
+
command: cmdFontsRemove,
|
|
50
|
+
description: 'Remove an installed font',
|
|
51
|
+
destructive: true,
|
|
52
|
+
inputSchema: {
|
|
53
|
+
type: 'object',
|
|
54
|
+
required: ['family'],
|
|
55
|
+
properties: {
|
|
56
|
+
family: { type: 'string' },
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
tags: ['fonts'],
|
|
60
|
+
})
|
|
61
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { getHtml, refresh, getAvailableFonts, getApiUrl, loadFontList } from './fonts'
|
|
2
|
+
|
|
3
|
+
export const cmdGetCss = 'get-fonts-css'
|
|
4
|
+
export const cmdGetHtml = 'get-fonts-html'
|
|
5
|
+
export const cmdFontsInstalled = 'fonts:installed'
|
|
6
|
+
export const cmdFontsAvailable = 'fonts:available'
|
|
7
|
+
export const cmdFontsInstall = 'fonts:install'
|
|
8
|
+
export const cmdFontsRemove = 'fonts:remove'
|
|
9
|
+
|
|
10
|
+
export default function (editor, opts) {
|
|
11
|
+
editor.Commands.add(cmdGetCss, () => {
|
|
12
|
+
throw new Error('get-fonts-css is not implemented. Use get-fonts-html instead.')
|
|
13
|
+
})
|
|
14
|
+
editor.Commands.add(cmdGetHtml, (editor) => {
|
|
15
|
+
const fonts = editor.getModel().get('fonts') || []
|
|
16
|
+
return getHtml(fonts)
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
// List installed fonts
|
|
20
|
+
editor.Commands.add(cmdFontsInstalled, () => {
|
|
21
|
+
const fonts = editor.getModel().get('fonts') || []
|
|
22
|
+
return fonts.map(f => ({
|
|
23
|
+
family: f.family,
|
|
24
|
+
category: f.category,
|
|
25
|
+
variants: f.variants || [],
|
|
26
|
+
}))
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
// List available Google Fonts (with optional search/category filter).
|
|
30
|
+
// Loads the font list on demand from the Google Fonts API if not cached.
|
|
31
|
+
// Returns a Promise — callers must await the result.
|
|
32
|
+
editor.Commands.add(cmdFontsAvailable, async (editor, sender, options = {}) => {
|
|
33
|
+
let list = getAvailableFonts()
|
|
34
|
+
if (!list) {
|
|
35
|
+
if (!opts || !opts.api_key) {
|
|
36
|
+
throw new Error('Font list not loaded and no api_key configured. Provide api_key in plugin options to enable Google Fonts.')
|
|
37
|
+
}
|
|
38
|
+
list = await loadFontList(`${getApiUrl()}/webfonts/v1/webfonts?key=${encodeURIComponent(opts.api_key)}`)
|
|
39
|
+
}
|
|
40
|
+
if (!list) throw new Error('Could not load font list from Google Fonts API. Check api_key and network.')
|
|
41
|
+
|
|
42
|
+
const { search, category } = options
|
|
43
|
+
let filtered = list
|
|
44
|
+
if (search) {
|
|
45
|
+
const q = search.toLowerCase()
|
|
46
|
+
filtered = filtered.filter(f => f.family.toLowerCase().includes(q))
|
|
47
|
+
}
|
|
48
|
+
if (category) {
|
|
49
|
+
filtered = filtered.filter(f => f.category === category)
|
|
50
|
+
}
|
|
51
|
+
return filtered.map(f => ({
|
|
52
|
+
family: f.family,
|
|
53
|
+
category: f.category,
|
|
54
|
+
variants: f.variants,
|
|
55
|
+
}))
|
|
56
|
+
})
|
|
57
|
+
|
|
58
|
+
// Install a font by family name
|
|
59
|
+
editor.Commands.add(cmdFontsInstall, (editor, sender, options = {}) => {
|
|
60
|
+
const { family } = options
|
|
61
|
+
if (!family) throw new Error('Required: family (e.g. "Roboto", "Open Sans"). Use fonts:available to search.')
|
|
62
|
+
|
|
63
|
+
const fonts = editor.getModel().get('fonts') || []
|
|
64
|
+
if (fonts.find(f => f.family.toLowerCase() === family.toLowerCase())) {
|
|
65
|
+
throw new Error(`Font "${family}" already installed. Use fonts:installed to list installed fonts.`)
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const available = getAvailableFonts() || []
|
|
69
|
+
const fontData = available.find(f => f.family.toLowerCase() === family.toLowerCase())
|
|
70
|
+
if (!fontData) {
|
|
71
|
+
throw new Error(`Font "${family}" not found in available fonts. Run fonts:available to load the font list first, then retry.`)
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const newFont = {
|
|
75
|
+
family: fontData.family,
|
|
76
|
+
name: fontData.family,
|
|
77
|
+
category: fontData.category,
|
|
78
|
+
variants: fontData.variants,
|
|
79
|
+
value: `"${fontData.family}", ${fontData.category}`,
|
|
80
|
+
}
|
|
81
|
+
fonts.push(newFont)
|
|
82
|
+
editor.getModel().set('fonts', [...fonts])
|
|
83
|
+
refresh(editor, opts)
|
|
84
|
+
return { family: newFont.family, category: newFont.category, variants: newFont.variants }
|
|
85
|
+
})
|
|
86
|
+
|
|
87
|
+
// Remove an installed font
|
|
88
|
+
editor.Commands.add(cmdFontsRemove, (editor, sender, options = {}) => {
|
|
89
|
+
const { family } = options
|
|
90
|
+
if (!family) throw new Error('Required: family (e.g. "Roboto"). Use fonts:installed to list installed fonts.')
|
|
91
|
+
|
|
92
|
+
const fonts = editor.getModel().get('fonts') || []
|
|
93
|
+
const idx = fonts.findIndex(f => f.family === family)
|
|
94
|
+
if (idx === -1) throw new Error(`Font "${family}" not installed. Use fonts:installed to list installed fonts.`)
|
|
95
|
+
|
|
96
|
+
fonts.splice(idx, 1)
|
|
97
|
+
editor.getModel().set('fonts', [...fonts])
|
|
98
|
+
refresh(editor, opts)
|
|
99
|
+
})
|
|
100
|
+
}
|
|
@@ -0,0 +1,396 @@
|
|
|
1
|
+
import { html, render } from 'lit-html'
|
|
2
|
+
import { map } from 'lit-html/directives/map.js'
|
|
3
|
+
|
|
4
|
+
import {ref, createRef} from 'lit-html/directives/ref.js'
|
|
5
|
+
|
|
6
|
+
const el = document.createElement('div')
|
|
7
|
+
const styles = document.createElement('style')
|
|
8
|
+
styles.textContent = `
|
|
9
|
+
.gfonts-section { padding: 8px 0 }
|
|
10
|
+
.gfonts-list { list-style: none; padding: 0; margin: 0 }
|
|
11
|
+
.gfonts-item { padding: 10px 12px; border: 1px solid var(--gjs-light-border); border-radius: 8px; margin-bottom: 10px; background: transparent; color: var(--gjs-font-color) }
|
|
12
|
+
.gfonts-item strong { display: block; font-size: 14px; margin-bottom: 4px; color: var(--gjs-font-color-active) }
|
|
13
|
+
.gfonts-item p { margin: 0 0 8px 0; color: var(--gjs-font-color); font-size: 12px }
|
|
14
|
+
.variants-toolbar { display: flex; align-items: center; gap: 8px; margin: 6px 0 }
|
|
15
|
+
.variants-grid { display: flex; flex-wrap: wrap; gap: 6px }
|
|
16
|
+
.variants-grid label { background: var(--gjs-soft-light-color); border-radius: 4px; padding: 4px 6px; cursor: pointer; border: 1px solid transparent; color: var(--gjs-font-color) }
|
|
17
|
+
.variants-grid input { margin: 0 }
|
|
18
|
+
.gfonts-preview { padding: 6px; border: 1px solid var(--gjs-light-border); border-radius: 8px; background: var(--gjs-soft-light-color); margin: 6px 0 8px }
|
|
19
|
+
.preview-iframe { width: 100%; border: 0; height: 56px; background: transparent }
|
|
20
|
+
.silex-bar, .pagination-controls { display: flex; gap: 8px; align-items: center }
|
|
21
|
+
.silex-list { list-style: none; margin: 0; padding: 0 }
|
|
22
|
+
.silex-list > li { list-style: none }
|
|
23
|
+
fieldset.silex-group--simple { border: 0; padding: 0; margin: 0 }
|
|
24
|
+
fieldset.silex-group--simple legend { margin: 0; color: var(--gjs-font-color); font-size: 12px }
|
|
25
|
+
.gfonts-toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap }
|
|
26
|
+
.gfonts-toolbar select, .gfonts-toolbar input { background: var(--gjs-main-light-color); color: var(--gjs-font-color); border: 1px solid var(--gjs-light-border); border-radius: 4px; padding: 4px 6px }
|
|
27
|
+
.gfonts-toolbar .silex-button { background: var(--gjs-main-light-color); color: var(--gjs-font-color); border: 1px solid var(--gjs-light-border) }
|
|
28
|
+
.gfonts-pager { margin-left: auto; display: inline-flex; gap: 6px; align-items: center; color: var(--gjs-font-color) }
|
|
29
|
+
.gfonts-pager .page { opacity: .8 }
|
|
30
|
+
.gfonts-actions { display: flex; gap: 8px; margin-top: 6px }
|
|
31
|
+
.gfonts-btn--ghost { background: transparent; border: 1px solid var(--gjs-light-border); color: var(--gjs-font-color); padding: 2px 6px; font-size: 11px }
|
|
32
|
+
.gfonts-btn--danger { background: transparent; border: 1px solid var(--gjs-color-red); color: var(--gjs-color-red) }
|
|
33
|
+
`
|
|
34
|
+
document.head.appendChild(styles)
|
|
35
|
+
let modal
|
|
36
|
+
|
|
37
|
+
export const cmdOpenFonts = 'open-fonts'
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Constants
|
|
41
|
+
*/
|
|
42
|
+
const LS_FONTS = 'silex-loaded-fonts-list'
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Module variables
|
|
46
|
+
*/
|
|
47
|
+
let _fontsList
|
|
48
|
+
let fonts = []
|
|
49
|
+
let defaults = []
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Options
|
|
53
|
+
*/
|
|
54
|
+
let fontServer = 'https://fonts.googleapis.com'
|
|
55
|
+
let fontApi = 'https://www.googleapis.com'
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Load available fonts only once per session
|
|
59
|
+
* Use local storage
|
|
60
|
+
*/
|
|
61
|
+
try {
|
|
62
|
+
_fontsList = JSON.parse(localStorage.getItem(LS_FONTS))
|
|
63
|
+
} catch(e) {
|
|
64
|
+
console.error('Could not get fonts from local storage:', e)
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Promised wait function
|
|
69
|
+
*/
|
|
70
|
+
async function wait(ms = 0) {
|
|
71
|
+
return new Promise(resolve => setTimeout(() => resolve(), ms))
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* When the dialog is opened
|
|
76
|
+
*/
|
|
77
|
+
async function loadFonts(editor) {
|
|
78
|
+
fonts = structuredClone(editor.getModel().get('fonts') || []).map(f => ({
|
|
79
|
+
...f,
|
|
80
|
+
variants: f.variants || []
|
|
81
|
+
}))
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* When the dialog is closed
|
|
86
|
+
*/
|
|
87
|
+
function saveFonts(editor, opts) {
|
|
88
|
+
const model = editor.getModel()
|
|
89
|
+
model.set('fonts', fonts)
|
|
90
|
+
updateHead(editor, fonts)
|
|
91
|
+
updateUi(editor, fonts, opts)
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Get the cached list of available fonts from Google
|
|
96
|
+
*/
|
|
97
|
+
export function getAvailableFonts() {
|
|
98
|
+
return _fontsList
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Get the configured Google Fonts API base URL
|
|
103
|
+
*/
|
|
104
|
+
export function getApiUrl() {
|
|
105
|
+
return fontApi
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Load the available fonts from google
|
|
110
|
+
*/
|
|
111
|
+
export async function loadFontList(url) {
|
|
112
|
+
_fontsList = _fontsList ?? (await (await fetch(url)).json())?.items
|
|
113
|
+
|
|
114
|
+
localStorage.setItem(LS_FONTS, JSON.stringify(_fontsList))
|
|
115
|
+
await wait() // let the dialog open
|
|
116
|
+
return _fontsList
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export const fontsDialogPlugin = (editor, opts) => {
|
|
120
|
+
defaults = editor.StyleManager.getBuiltIn('font-family').options || []
|
|
121
|
+
if(opts.server_url) fontServer = opts.server_url
|
|
122
|
+
if(opts.api_url) fontApi = opts.api_url
|
|
123
|
+
if(!opts.api_key) throw new Error(editor.I18n.t('grapesjs-fonts.You must provide Google font api key'))
|
|
124
|
+
|
|
125
|
+
editor.Commands.add(cmdOpenFonts, {
|
|
126
|
+
run: () => {
|
|
127
|
+
modal = editor.Modal.open({
|
|
128
|
+
title: editor.I18n.t('grapesjs-fonts.Fonts'),
|
|
129
|
+
content: '',
|
|
130
|
+
attributes: { class: 'fonts-dialog' },
|
|
131
|
+
})
|
|
132
|
+
.onceClose(() => {
|
|
133
|
+
editor.stopCommand(cmdOpenFonts)
|
|
134
|
+
})
|
|
135
|
+
modal.setContent(el)
|
|
136
|
+
loadFonts(editor)
|
|
137
|
+
displayFontLists(editor, opts)
|
|
138
|
+
loadFontList(`${fontApi}/webfonts/v1/webfonts?key=${opts.api_key}`)
|
|
139
|
+
.then(fontsList => {
|
|
140
|
+
displayFontLists(editor, opts, fontsList)
|
|
141
|
+
})
|
|
142
|
+
return modal
|
|
143
|
+
},
|
|
144
|
+
stop: () => {
|
|
145
|
+
modal.close()
|
|
146
|
+
},
|
|
147
|
+
})
|
|
148
|
+
|
|
149
|
+
// Add fonts to the website on save
|
|
150
|
+
editor.on('storage:start:store', (data) => {
|
|
151
|
+
data.fonts = editor.getModel().get('fonts')
|
|
152
|
+
})
|
|
153
|
+
|
|
154
|
+
// Helper to register debounced font refreshes
|
|
155
|
+
let debouncedRefreshTimeout
|
|
156
|
+
const debouncedRefresh = () => {
|
|
157
|
+
clearTimeout(debouncedRefreshTimeout)
|
|
158
|
+
debouncedRefreshTimeout = setTimeout(() => refresh(editor, opts), 50)
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
// Add fonts to the website on load
|
|
162
|
+
editor.on('storage:end:load', (data) => {
|
|
163
|
+
const fonts = data.fonts || []
|
|
164
|
+
editor.getModel().set('fonts', fonts)
|
|
165
|
+
debouncedRefresh()
|
|
166
|
+
})
|
|
167
|
+
|
|
168
|
+
// Update the head and the ui when the frame is loaded
|
|
169
|
+
editor.on('canvas:frame:load', () => {
|
|
170
|
+
debouncedRefresh()
|
|
171
|
+
})
|
|
172
|
+
|
|
173
|
+
// When the page changes, update the dom
|
|
174
|
+
editor.on('page', () => {
|
|
175
|
+
debouncedRefresh()
|
|
176
|
+
})
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
const searchInputRef = createRef()
|
|
180
|
+
|
|
181
|
+
let currentPage = 0
|
|
182
|
+
let selectedCategory = ''
|
|
183
|
+
|
|
184
|
+
function displayFontLists(editor, opts, originalFontsList = []) {
|
|
185
|
+
const searchInput = searchInputRef.value
|
|
186
|
+
const fontsPerPage = 10
|
|
187
|
+
let fontsList = JSON.parse(JSON.stringify(originalFontsList)) // deep copy to maintain original list
|
|
188
|
+
const activeFonts = fontsList.filter(f => {
|
|
189
|
+
const nameOk = match(f.family, searchInput?.value || '')
|
|
190
|
+
const catOk = selectedCategory ? f.category === selectedCategory : true
|
|
191
|
+
return nameOk && catOk
|
|
192
|
+
})
|
|
193
|
+
|
|
194
|
+
let pageCount = Math.ceil(activeFonts.length / fontsPerPage)
|
|
195
|
+
const cats = Array.from(new Set((originalFontsList || []).map(f => f.category).filter(Boolean))).sort()
|
|
196
|
+
|
|
197
|
+
// Adjust currentPage if it exceeds the available pages
|
|
198
|
+
if (currentPage >= pageCount) {
|
|
199
|
+
currentPage = Math.max(0, pageCount - 1)
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
const currentFonts = activeFonts.slice(currentPage * fontsPerPage, (currentPage + 1) * fontsPerPage)
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
render(html`
|
|
206
|
+
<div>
|
|
207
|
+
<div class="silex-form__element">
|
|
208
|
+
<h2>${editor.I18n.t('grapesjs-fonts.Installed fonts')}</h2>
|
|
209
|
+
<ul class="silex-list">
|
|
210
|
+
${fonts && fonts.length ? map(fonts, font => html`
|
|
211
|
+
<li class="gfonts-item">
|
|
212
|
+
<strong>${font.family || 'Unknown Font'}</strong>
|
|
213
|
+
<p>${(font.category || ((_fontsList || []).find(f => f.family === font.family)?.category)) || 'No category'} - ${font.variants?.length || 0} variants</p>
|
|
214
|
+
|
|
215
|
+
<div class="gfonts-preview">
|
|
216
|
+
${generateFontPreview(font)}
|
|
217
|
+
</div>
|
|
218
|
+
<fieldset class="silex-group--simple full-width">
|
|
219
|
+
<div class="variants-toolbar">
|
|
220
|
+
<legend>${editor.I18n.t('grapesjs-fonts.Variants') || 'Variants'}</legend>
|
|
221
|
+
<button class="silex-button gfonts-btn--ghost" type="button" @click=${() => {
|
|
222
|
+
const all = (((_fontsList || []).find(f => f.family === font.family)?.variants) || [])
|
|
223
|
+
const isAll = Array.isArray(font.variants) && all.length && all.every(v => font.variants.includes(v))
|
|
224
|
+
font.variants = isAll ? [] : [...all]
|
|
225
|
+
saveFonts(editor, opts)
|
|
226
|
+
displayFontLists(editor, opts, originalFontsList)
|
|
227
|
+
}}>${editor.I18n.t('grapesjs-fonts.Toggle all') || 'Toggle all'}</button>
|
|
228
|
+
</div>
|
|
229
|
+
<div class="variants-grid">
|
|
230
|
+
${map(((_fontsList || []).find(f => f.family === font.family)?.variants) || [], v => html`
|
|
231
|
+
<label>
|
|
232
|
+
<input
|
|
233
|
+
type="checkbox"
|
|
234
|
+
.checked=${(font.variants || []).includes(v)}
|
|
235
|
+
@change=${e => {
|
|
236
|
+
const checked = e.target.checked
|
|
237
|
+
font.variants = Array.isArray(font.variants) ? font.variants : []
|
|
238
|
+
const has = font.variants.includes(v)
|
|
239
|
+
if (checked && !has) font.variants = [...font.variants, v]
|
|
240
|
+
if (!checked && has) font.variants = font.variants.filter(x => x !== v)
|
|
241
|
+
saveFonts(editor, opts)
|
|
242
|
+
displayFontLists(editor, opts, originalFontsList)
|
|
243
|
+
}}
|
|
244
|
+
/>
|
|
245
|
+
${v}
|
|
246
|
+
</label>
|
|
247
|
+
`)}
|
|
248
|
+
</div>
|
|
249
|
+
</fieldset>
|
|
250
|
+
<div class="gfonts-actions">
|
|
251
|
+
<button class="silex-button gfonts-btn--danger" type="button" @click=${() => { fonts = fonts.filter(x => x.family !== font.family); saveFonts(editor, opts); displayFontLists(editor, opts, originalFontsList) }}>${editor.I18n.t('grapesjs-fonts.Remove')}</button>
|
|
252
|
+
</div>
|
|
253
|
+
|
|
254
|
+
</li>
|
|
255
|
+
`) : html`<li class="gfonts-item" style="border-style:dashed; text-align:center; font-style:italic; color: var(--gjs-secondary-light-color)">${editor.I18n.t('grapesjs-fonts.No installed fonts') || 'No installed fonts yet'}</li>`}
|
|
256
|
+
</ul>
|
|
257
|
+
|
|
258
|
+
</div>
|
|
259
|
+
<div>
|
|
260
|
+
<h2>${editor.I18n.t('grapesjs-fonts.All fonts') || 'All fonts'}</h2>
|
|
261
|
+
<div class="silex-bar gfonts-toolbar">
|
|
262
|
+
<select @change=${e => { selectedCategory = e.target.value || ''; currentPage = 0; displayFontLists(editor, opts, originalFontsList) }}>
|
|
263
|
+
<option value="">All categories</option>
|
|
264
|
+
${cats.map(c => html`<option value=${c} ?selected=${selectedCategory === c}>${c}</option>`)}
|
|
265
|
+
</select>
|
|
266
|
+
<input
|
|
267
|
+
type="text"
|
|
268
|
+
${ref(searchInputRef)}
|
|
269
|
+
@input=${() => {
|
|
270
|
+
currentPage = 0
|
|
271
|
+
displayFontLists(editor, opts, originalFontsList)
|
|
272
|
+
}}
|
|
273
|
+
placeholder="${editor.I18n.t('grapesjs-fonts.Search')}"
|
|
274
|
+
/>
|
|
275
|
+
<div class="gfonts-pager">
|
|
276
|
+
<button class="silex-button" ?disabled=${currentPage === 0} @click=${() => {
|
|
277
|
+
if (currentPage > 0) {
|
|
278
|
+
currentPage--
|
|
279
|
+
displayFontLists(editor, opts, originalFontsList)
|
|
280
|
+
}
|
|
281
|
+
}}>${editor.I18n.t('grapesjs-fonts.Previous Page')}</button>
|
|
282
|
+
<span class="page">Page ${currentPage + 1} / ${pageCount}</span>
|
|
283
|
+
<button class="silex-button" ?disabled=${currentPage === pageCount - 1} @click=${() => {
|
|
284
|
+
if (currentPage < pageCount - 1) {
|
|
285
|
+
currentPage++
|
|
286
|
+
displayFontLists(editor, opts, originalFontsList)
|
|
287
|
+
}
|
|
288
|
+
}}>${editor.I18n.t('grapesjs-fonts.Next Page')}</button>
|
|
289
|
+
</div>
|
|
290
|
+
</div>
|
|
291
|
+
<ul class="silex-list">
|
|
292
|
+
${map(currentFonts, f => html`
|
|
293
|
+
<li class="gfonts-item">
|
|
294
|
+
<strong>${f.family}</strong>
|
|
295
|
+
<p>${f.category} - ${f.variants.length} variants</p>
|
|
296
|
+
|
|
297
|
+
<div class="gfonts-preview">
|
|
298
|
+
${generateFontPreview(f)}
|
|
299
|
+
</div>
|
|
300
|
+
<button class="silex-button" @click=${() => installFont(editor, opts, f, fontsList)}>${editor.I18n.t('grapesjs-fonts.Add font')}</button>
|
|
301
|
+
</li>
|
|
302
|
+
`)}
|
|
303
|
+
</ul>
|
|
304
|
+
</div>
|
|
305
|
+
</div>
|
|
306
|
+
`, el)
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
function generateFontPreview(font) {
|
|
310
|
+
const family = font.family || font.name || ''
|
|
311
|
+
const famQ = family.replace(/ /g, '+')
|
|
312
|
+
const color = (getComputedStyle(document.documentElement).getPropertyValue('--gjs-font-color') || '').trim() || getComputedStyle(el).color || '#ddd'
|
|
313
|
+
const inList = (_fontsList || []).find(f => f.family === family)
|
|
314
|
+
const rawVariants = Array.isArray(font.variants) && font.variants.length ? font.variants : (inList?.variants || ['regular'])
|
|
315
|
+
const pairs = []
|
|
316
|
+
rawVariants.forEach(v => {
|
|
317
|
+
const italic = /italic/i.test(v) ? 1 : 0
|
|
318
|
+
const m = String(v).match(/\d+/)
|
|
319
|
+
const w = m ? parseInt(m[0], 10) : 400
|
|
320
|
+
const key = `${italic},${w}`
|
|
321
|
+
if (!pairs.includes(key)) pairs.push(key)
|
|
322
|
+
})
|
|
323
|
+
const axis = pairs.length ? `:ital,wght@${pairs.join(';')}` : ''
|
|
324
|
+
const lines = pairs.map(k => {
|
|
325
|
+
const [ital, wght] = k.split(',')
|
|
326
|
+
const fs = ital === '1' ? 'italic' : 'normal'
|
|
327
|
+
return `<p style="margin:0; line-height:1.5; font-style:${fs}; font-weight:${wght}">${family} — Sphinx of black quartz, judge my vow. 0123456789</p>`
|
|
328
|
+
}).join('')
|
|
329
|
+
return html`
|
|
330
|
+
<iframe
|
|
331
|
+
class="preview-iframe"
|
|
332
|
+
srcdoc="<html><head><link href='https://fonts.googleapis.com/css2?family=${famQ}${axis}&display=swap' rel='stylesheet'><style>body { margin: 0; color: ${color}; font-family: '${family}', sans-serif }</style></head><body>${lines}</body></html>"></iframe>
|
|
333
|
+
`
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
function installFont(editor, opts, font, fontsList) {
|
|
337
|
+
const existingFont = fonts.find(f => f.family === font.family)
|
|
338
|
+
if (!existingFont) {
|
|
339
|
+
fonts.push({
|
|
340
|
+
family: font.family,
|
|
341
|
+
name: font.family, // Ensure the font family name is set for both 'family' and 'name'
|
|
342
|
+
category: font.category,
|
|
343
|
+
variants: font.variants,
|
|
344
|
+
value: `"${font.family}", ${font.category}`
|
|
345
|
+
})
|
|
346
|
+
}
|
|
347
|
+
saveFonts(editor, opts)
|
|
348
|
+
displayFontLists(editor, opts, fontsList)
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
|
|
352
|
+
|
|
353
|
+
function match(hay, s) {
|
|
354
|
+
return hay.toLowerCase().includes(s.toLowerCase())
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
function removeAll(doc, attr) {
|
|
358
|
+
const all = doc.head.querySelectorAll(`[${attr}]`)
|
|
359
|
+
Array.from(all).forEach((el) => el.remove())
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
function updateHead(editor, fonts) {
|
|
363
|
+
const doc = editor.Canvas.getDocument()
|
|
364
|
+
if (!doc) {
|
|
365
|
+
return
|
|
366
|
+
}
|
|
367
|
+
removeAll(doc, GOOGLE_FONTS_ATTR)
|
|
368
|
+
const html = getHtml(fonts, GOOGLE_FONTS_ATTR)
|
|
369
|
+
doc.head.insertAdjacentHTML('beforeend', html)
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
function updateUi(editor, fonts, opts) {
|
|
373
|
+
const styleManager = editor.StyleManager
|
|
374
|
+
const fontProperty = styleManager.getProperty('typography', 'font-family')
|
|
375
|
+
if (!fontProperty) return
|
|
376
|
+
let list = fonts
|
|
377
|
+
if (opts && opts.preserveDefaultFonts) {
|
|
378
|
+
list = defaults.concat(fonts || [])
|
|
379
|
+
} else if (!fonts || fonts.length === 0) {
|
|
380
|
+
list = defaults
|
|
381
|
+
}
|
|
382
|
+
fontProperty.setOptions(list)
|
|
383
|
+
}
|
|
384
|
+
const GOOGLE_FONTS_ATTR = 'data-silex-gstatic'
|
|
385
|
+
|
|
386
|
+
export function refresh(editor, opts) {
|
|
387
|
+
const fonts = editor.getModel().get('fonts') || []
|
|
388
|
+
updateHead(editor, fonts)
|
|
389
|
+
updateUi(editor, fonts, opts)
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
export function getHtml(fonts, attr = '') {
|
|
393
|
+
const preconnect = fonts.length ? `<link href="${fontServer}" rel="preconnect" ${attr}><link href="${fontServer}/css2" rel="preconnect" crossorigin ${attr}>` : ''
|
|
394
|
+
const links = fonts.map(f => `<link href="${fontServer}/css2?family=${f.name.replace(/ /g, '+')}&display=swap" rel="stylesheet" ${attr}>`).join('')
|
|
395
|
+
return preconnect + links
|
|
396
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { fontsDialogPlugin } from './fonts.js'
|
|
2
|
+
import commands from './commands.js'
|
|
3
|
+
import { registerCapabilities } from './capabilities.js'
|
|
4
|
+
import en from './locale/en.js'
|
|
5
|
+
import fr from './locale/fr.js'
|
|
6
|
+
|
|
7
|
+
export default (editor, opts = {}) => {
|
|
8
|
+
|
|
9
|
+
const options = { ...{
|
|
10
|
+
// default options
|
|
11
|
+
i18n: {},
|
|
12
|
+
preserveDefaultFonts: true,
|
|
13
|
+
}, ...opts }
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
// Load i18n files
|
|
17
|
+
editor.I18n && editor.I18n.addMessages({
|
|
18
|
+
en,
|
|
19
|
+
fr,
|
|
20
|
+
...options.i18n,
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
commands(editor, options)
|
|
24
|
+
fontsDialogPlugin(editor, options)
|
|
25
|
+
|
|
26
|
+
// Register AI capabilities if grapesjs-ai-capabilities is loaded
|
|
27
|
+
editor.on('ai-capabilities:ready', (addCapability) => {
|
|
28
|
+
registerCapabilities(addCapability)
|
|
29
|
+
})
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// Expose commands to the app
|
|
33
|
+
export * from './fonts.js'
|
|
34
|
+
export * from './commands.js'
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
'grapesjs-fonts': {
|
|
3
|
+
'Fonts': 'Fonts',
|
|
4
|
+
'You must provide Google font api key': 'You must provide Google font api key, see https://developers.google.com/fonts/docs/developer_api#APIKey',
|
|
5
|
+
'Search': 'Search fonts...',
|
|
6
|
+
'Add font': 'Install font',
|
|
7
|
+
'Remove': 'Remove',
|
|
8
|
+
'Save': 'Save',
|
|
9
|
+
'Cancel': 'Cancel',
|
|
10
|
+
'Installed fonts': 'Installed fonts',
|
|
11
|
+
'All fonts': 'All fonts',
|
|
12
|
+
'Variants': 'Variants',
|
|
13
|
+
'Toggle all': 'Toggle all',
|
|
14
|
+
'No installed fonts': 'No installed fonts yet',
|
|
15
|
+
'Previous Page': 'Previous',
|
|
16
|
+
'Next Page': 'Next',
|
|
17
|
+
},
|
|
18
|
+
}
|
|
19
|
+
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
'grapesjs-fonts': {
|
|
3
|
+
'Fonts': 'Polices',
|
|
4
|
+
'You must provide Google font api key': 'Vous devez fournir une clé API Google font, voir https://developers.google.com/fonts/docs/developer_api#APIKey',
|
|
5
|
+
'Family': 'Famille',
|
|
6
|
+
'Search': 'Rechercher une police',
|
|
7
|
+
'Add font': 'Installer la police',
|
|
8
|
+
'Remove': 'Supprimer',
|
|
9
|
+
'Save': 'Enregistrer',
|
|
10
|
+
'Cancel': 'Annuler',
|
|
11
|
+
'Installed fonts': 'Polices installées',
|
|
12
|
+
'All fonts': 'Toutes les polices',
|
|
13
|
+
'Variants': 'Variantes',
|
|
14
|
+
'Toggle all': 'Tout sélectionner',
|
|
15
|
+
'No installed fonts': 'Aucune police installée',
|
|
16
|
+
'Previous Page': 'Précédent',
|
|
17
|
+
'Next Page': 'Suivant',
|
|
18
|
+
},
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
|