From 2c24aedef8bea181815bb9045c28bdd6fa46fc2a Mon Sep 17 00:00:00 2001 From: Tim Kelty Date: Tue, 19 Apr 2022 12:25:16 -0400 Subject: [PATCH] Prettier writes --- .codecov.yml | 36 +- .github/ISSUE_TEMPLATE/BUG-REPORT-V3.yml | 3 +- .github/ISSUE_TEMPLATE/BUG-REPORT-V4.yml | 3 +- .github/workflows/ci.yml | 2 +- .prettierignore | 3 +- composer.json | 2 +- crowdin.yml | 2 +- packages/craftcms-sass/_mixins.scss | 163 +- packages/craftcms-webpack/Craft.d.ts | 28 +- packages/craftcms-webpack/index.js | 201 +- packages/craftcms-webpack/postcss.config.js | 6 +- packages/craftcms-webpack/tsconfig.json | 22 +- .../tests/functional.suite.yml | 1 - src/web/assets/admintable/src/App.vue | 1471 +++--- .../js/components/AdminTableActionButton.vue | 405 +- .../src/js/components/AdminTableButton.vue | 94 +- .../src/js/components/AdminTableCheckbox.vue | 94 +- .../components/AdminTableCopyTextButton.vue | 38 +- .../js/components/AdminTableDeleteButton.vue | 159 +- .../src/js/components/AdminTableDetailRow.vue | 120 +- .../js/components/AdminTablePagination.vue | 83 +- src/web/assets/admintable/src/main.js | 93 +- src/web/assets/admintable/webpack.config.js | 18 +- .../assetindexes/src/AssetIndexesUtility.js | 446 +- src/web/assets/assetindexes/webpack.config.js | 12 +- src/web/assets/axios/webpack.config.js | 24 +- .../clearcaches/src/ClearCachesUtility.js | 172 +- src/web/assets/clearcaches/webpack.config.js | 12 +- .../assets/cp/src/craft-font/selection.json | 2399 ++++++++- src/web/assets/cp/src/css/_cp.scss | 41 +- src/web/assets/cp/src/css/_fld.scss | 14 +- src/web/assets/cp/src/css/_image_editor.scss | 35 +- src/web/assets/cp/src/css/_main.scss | 158 +- src/web/assets/cp/src/css/_preview.scss | 28 +- src/web/assets/cp/src/css/_reset.scss | 108 +- src/web/assets/cp/src/css/charts.scss | 8 +- src/web/assets/cp/src/css/craft.scss | 14 +- src/web/assets/cp/src/js/AdminTable.js | 345 +- src/web/assets/cp/src/js/AssetEditor.js | 242 +- src/web/assets/cp/src/js/AssetImageEditor.js | 4686 ++++++++++------- src/web/assets/cp/src/js/AssetIndex.js | 2867 +++++----- src/web/assets/cp/src/js/AssetSelectInput.js | 550 +- .../assets/cp/src/js/AssetSelectorModal.js | 322 +- src/web/assets/cp/src/js/AuthManager.js | 630 ++- src/web/assets/cp/src/js/BaseElementEditor.js | 1066 ++-- src/web/assets/cp/src/js/BaseElementIndex.js | 3341 ++++++------ .../assets/cp/src/js/BaseElementIndexView.js | 571 +- .../cp/src/js/BaseElementSelectInput.js | 801 +-- .../cp/src/js/BaseElementSelectorModal.js | 388 +- .../assets/cp/src/js/BaseInputGenerator.js | 172 +- src/web/assets/cp/src/js/CP.js | 2218 ++++---- src/web/assets/cp/src/js/CategoryIndex.js | 383 +- .../assets/cp/src/js/CategorySelectInput.js | 210 +- src/web/assets/cp/src/js/Chart.js | 1028 ++-- src/web/assets/cp/src/js/ColorInput.js | 157 +- src/web/assets/cp/src/js/Craft.js | 4503 ++++++++-------- .../assets/cp/src/js/CustomizeSourcesModal.js | 866 +-- src/web/assets/cp/src/js/DataTableSorter.js | 73 +- src/web/assets/cp/src/js/DeleteUserModal.js | 337 +- src/web/assets/cp/src/js/DraftEditor.js | 2274 ++++---- src/web/assets/cp/src/js/DynamicGenerator.js | 16 +- src/web/assets/cp/src/js/EditableTable.js | 1293 ++--- .../assets/cp/src/js/ElementActionTrigger.js | 131 +- .../assets/cp/src/js/ElementThumbLoader.js | 205 +- .../assets/cp/src/js/ElevatedSessionForm.js | 120 +- .../cp/src/js/ElevatedSessionManager.js | 256 +- src/web/assets/cp/src/js/EntryIndex.js | 411 +- .../assets/cp/src/js/FieldLayoutDesigner.js | 1615 +++--- src/web/assets/cp/src/js/FieldToggle.js | 424 +- src/web/assets/cp/src/js/Grid.js | 1182 +++-- src/web/assets/cp/src/js/HandleGenerator.js | 72 +- src/web/assets/cp/src/js/ImageUpload.js | 204 +- src/web/assets/cp/src/js/InfoIcon.js | 143 +- src/web/assets/cp/src/js/LightSwitch.js | 413 +- src/web/assets/cp/src/js/Listbox.js | 180 +- src/web/assets/cp/src/js/LivePreview.js | 711 +-- src/web/assets/cp/src/js/PasswordInput.js | 233 +- src/web/assets/cp/src/js/Preview.js | 1330 ++--- src/web/assets/cp/src/js/PreviewFileModal.js | 288 +- src/web/assets/cp/src/js/ProgressBar.js | 207 +- src/web/assets/cp/src/js/PromptHandler.js | 387 +- src/web/assets/cp/src/js/SlidePicker.js | 316 +- src/web/assets/cp/src/js/SlideRuleInput.js | 303 +- src/web/assets/cp/src/js/Slideout.js | 402 +- src/web/assets/cp/src/js/SlugGenerator.js | 44 +- src/web/assets/cp/src/js/Structure.js | 287 +- src/web/assets/cp/src/js/StructureDrag.js | 719 +-- .../assets/cp/src/js/StructureTableSorter.js | 873 +-- .../assets/cp/src/js/TableElementIndexView.js | 623 +-- src/web/assets/cp/src/js/Tabs.js | 377 +- src/web/assets/cp/src/js/TagSelectInput.js | 507 +- .../cp/src/js/ThumbsElementIndexView.js | 6 +- src/web/assets/cp/src/js/UI.js | 2102 ++++---- src/web/assets/cp/src/js/Uploader.js | 347 +- .../assets/cp/src/js/UriFormatGenerator.js | 36 +- src/web/assets/cp/src/js/UserIndex.js | 11 +- src/web/assets/cp/webpack.config.js | 34 +- .../craftsupport/src/CraftSupportWidget.js | 1114 ++-- .../craftsupport/src/CraftSupportWidget.scss | 8 +- src/web/assets/craftsupport/webpack.config.js | 30 +- src/web/assets/d3/webpack.config.js | 44 +- src/web/assets/dashboard/src/Dashboard.js | 1184 +++-- src/web/assets/dashboard/src/dashboard.scss | 4 +- src/web/assets/dashboard/webpack.config.js | 12 +- .../assets/datepickeri18n/webpack.config.js | 32 +- .../assets/dbbackup/src/DbBackupUtility.js | 170 +- src/web/assets/dbbackup/webpack.config.js | 8 +- .../deprecationerrors/src/deprecator.js | 148 +- .../deprecationerrors/src/deprecator.scss | 2 +- .../deprecationerrors/webpack.config.js | 8 +- .../assets/editentry/src/EntryTypeSwitcher.js | 124 +- src/web/assets/editentry/webpack.config.js | 8 +- src/web/assets/editsection/src/editsection.js | 80 +- src/web/assets/editsection/webpack.config.js | 8 +- .../assets/edittransform/src/transforms.scss | 10 +- .../assets/edittransform/webpack.config.js | 8 +- .../edituser/src/AccountSettingsForm.js | 215 +- src/web/assets/edituser/src/account.scss | 2 +- src/web/assets/edituser/src/profile.js | 68 +- src/web/assets/edituser/src/profile.scss | 2 +- src/web/assets/edituser/webpack.config.js | 14 +- .../elementresizedetector/webpack.config.js | 28 +- src/web/assets/fabric/webpack.config.js | 24 +- src/web/assets/feed/src/FeedWidget.js | 98 +- src/web/assets/feed/webpack.config.js | 8 +- src/web/assets/fields/src/fields.js | 260 +- src/web/assets/fields/webpack.config.js | 8 +- .../assets/fieldsettings/src/fieldsettings.js | 156 +- .../assets/fieldsettings/webpack.config.js | 8 +- src/web/assets/fileupload/webpack.config.js | 26 +- .../findreplace/src/FindAndReplaceUtility.js | 159 +- src/web/assets/findreplace/webpack.config.js | 8 +- src/web/assets/focusvisible/webpack.config.js | 24 +- src/web/assets/garnish/src/Base.js | 245 +- src/web/assets/garnish/src/BaseDrag.js | 809 +-- src/web/assets/garnish/src/CheckboxSelect.js | 80 +- src/web/assets/garnish/src/ContextMenu.js | 305 +- src/web/assets/garnish/src/CustomSelect.js | 8 +- src/web/assets/garnish/src/DisclosureMenu.js | 83 +- src/web/assets/garnish/src/Drag.js | 775 +-- src/web/assets/garnish/src/DragDrop.js | 212 +- src/web/assets/garnish/src/DragMove.js | 18 +- src/web/assets/garnish/src/DragSort.js | 982 ++-- src/web/assets/garnish/src/EscManager.js | 97 +- src/web/assets/garnish/src/Garnish.js | 1710 +++--- src/web/assets/garnish/src/HUD.js | 1099 ++-- src/web/assets/garnish/src/MenuBtn.js | 448 +- src/web/assets/garnish/src/MixedInput.js | 729 +-- src/web/assets/garnish/src/Modal.js | 676 +-- src/web/assets/garnish/src/NiceText.js | 643 +-- src/web/assets/garnish/src/Select.js | 1598 +++--- src/web/assets/garnish/src/SelectMenu.js | 121 +- src/web/assets/garnish/src/UiLayerManager.js | 199 +- src/web/assets/garnish/src/index.js | 2 +- src/web/assets/garnish/src/lib/Base.js | 265 +- src/web/assets/garnish/webpack.config.js | 17 +- src/web/assets/generalsettings/src/rebrand.js | 54 +- .../assets/generalsettings/src/rebrand.scss | 2 +- .../assets/generalsettings/webpack.config.js | 8 +- src/web/assets/graphiql/src/CraftGraphiQL.js | 424 +- src/web/assets/graphiql/src/graphiql-init.js | 58 +- src/web/assets/graphiql/src/graphiql.scss | 13 +- src/web/assets/graphiql/webpack.config.js | 8 +- .../assets/iframeresizer/webpack.config.js | 32 +- src/web/assets/inputmask/webpack.config.js | 29 +- src/web/assets/installer/src/install.js | 451 +- src/web/assets/installer/src/install.scss | 13 +- src/web/assets/installer/webpack.config.js | 8 +- src/web/assets/jquery/webpack.config.js | 24 +- .../assets/jquerypayment/webpack.config.js | 26 +- .../jquerytouchevents/webpack.config.js | 28 +- src/web/assets/jqueryui/webpack.config.js | 38 +- src/web/assets/login/src/login.js | 407 +- src/web/assets/login/src/login.scss | 8 +- src/web/assets/login/webpack.config.js | 8 +- src/web/assets/matrix/src/MatrixInput.js | 1619 +++--- src/web/assets/matrix/webpack.config.js | 8 +- .../matrixsettings/src/MatrixConfigurator.js | 1753 +++--- .../assets/matrixsettings/webpack.config.js | 8 +- src/web/assets/newusers/src/NewUsersWidget.js | 266 +- src/web/assets/newusers/webpack.config.js | 8 +- src/web/assets/picturefill/webpack.config.js | 24 +- src/web/assets/plugins/src/PluginManager.js | 876 +-- src/web/assets/plugins/src/plugins.scss | 16 +- src/web/assets/plugins/webpack.config.js | 8 +- src/web/assets/pluginstore/.eslintrc.js | 29 +- src/web/assets/pluginstore/postcss.config.js | 10 +- src/web/assets/pluginstore/public/index.html | 13 +- src/web/assets/pluginstore/src/App.vue | 111 +- src/web/assets/pluginstore/src/js/api/cart.js | 148 +- .../assets/pluginstore/src/js/api/craft.js | 309 +- .../pluginstore/src/js/api/pluginstore.js | 758 +-- .../src/js/components/CategorySelector.vue | 247 +- .../src/js/components/ChangelogRelease.vue | 161 +- .../src/js/components/CopyPackage.vue | 76 +- .../src/js/components/EditionBadge.vue | 74 +- .../pluginstore/src/js/components/InfoHud.vue | 63 +- .../src/js/components/LicenseStatus.vue | 49 +- .../src/js/components/PluginActions.vue | 610 ++- .../src/js/components/PluginCard.vue | 230 +- .../src/js/components/PluginChangelog.vue | 178 +- .../src/js/components/PluginEdition.vue | 225 +- .../src/js/components/PluginEditions.vue | 57 +- .../src/js/components/PluginGrid.vue | 112 +- .../src/js/components/PluginIndex.vue | 466 +- .../src/js/components/PluginIndexSort.vue | 91 +- .../src/js/components/PluginScreenshots.vue | 82 +- .../src/js/components/PluginSearch.vue | 80 +- .../src/js/components/ScreenshotModal.vue | 443 +- .../pluginstore/src/js/components/Sidebar.vue | 96 +- .../src/js/components/SortMenuBtn.vue | 133 +- .../src/js/components/StatusMessage.vue | 56 +- .../src/js/components/modal/Modal.vue | 162 +- .../src/js/components/modal/Step.vue | 30 +- .../src/js/components/modal/steps/Cart.vue | 778 +-- .../modal/steps/cart/ActiveTrials.vue | 67 +- .../modal/steps/cart/ActiveTrialsTableRow.vue | 161 +- .../src/js/components/upgradecraft/BuyBtn.vue | 161 +- .../js/components/upgradecraft/CmsEdition.vue | 241 +- .../components/upgradecraft/CmsEditions.vue | 90 +- .../components/upgradecraft/StatusBadge.vue | 63 +- .../pluginstore/src/js/filters/craft.js | 8 +- .../pluginstore/src/js/filters/currency.js | 22 +- .../pluginstore/src/js/mixins/licenses.js | 37 +- .../src/js/pages/_handle/index.vue | 668 ++- .../pluginstore/src/js/pages/_not-found.vue | 24 +- .../src/js/pages/buy-all-trials.vue | 124 +- .../pluginstore/src/js/pages/buy/_plugin.vue | 241 +- .../src/js/pages/categories/_id.vue | 104 +- .../src/js/pages/developer/_id.vue | 148 +- .../src/js/pages/featured/_handle.vue | 114 +- .../assets/pluginstore/src/js/pages/index.vue | 185 +- .../pluginstore/src/js/pages/search.vue | 90 +- .../assets/pluginstore/src/js/pages/tests.vue | 99 +- .../src/js/pages/upgrade-craft.vue | 82 +- .../pluginstore/src/js/plugins/craftui.js | 6 +- .../src/js/plugins/vue-awesome-swiper.js | 8 +- .../assets/pluginstore/src/js/router/index.js | 164 +- .../assets/pluginstore/src/js/store/index.js | 30 +- .../pluginstore/src/js/store/modules/app.js | 52 +- .../pluginstore/src/js/store/modules/cart.js | 1371 ++--- .../pluginstore/src/js/store/modules/craft.js | 461 +- .../src/js/store/modules/plugin-store.js | 481 +- src/web/assets/pluginstore/src/main.js | 757 +-- .../src/sass/_craftui-overrides.scss | 4 +- .../assets/pluginstore/src/sass/_general.scss | 74 +- .../assets/pluginstore/src/sass/_layout.scss | 3 +- .../pluginstore/src/sass/_tailwind.scss | 2 +- .../assets/pluginstore/src/sass/_tooltip.scss | 14 +- .../pluginstore/src/sass/_variables.scss | 2 +- src/web/assets/pluginstore/src/sass/main.scss | 20 +- src/web/assets/pluginstore/tailwind.config.js | 800 +-- src/web/assets/pluginstore/webpack.config.js | 10 +- .../src/PluginStoreOauthCallback.js | 193 +- .../src/parseFragmentString.js | 35 +- .../src/pluginstore-oauth-callback.scss | 10 +- .../assets/pluginstoreoauth/webpack.config.js | 6 +- .../positionselect/src/PositionSelectInput.js | 50 +- .../assets/positionselect/webpack.config.js | 8 +- src/web/assets/punycode/webpack.config.js | 24 +- .../assets/queuemanager/src/queue-manager.js | 760 +-- src/web/assets/queuemanager/webpack.config.js | 10 +- .../assets/quickpost/src/QuickPostWidget.js | 249 +- src/web/assets/quickpost/webpack.config.js | 8 +- .../recententries/src/RecentEntriesWidget.js | 138 +- .../assets/recententries/webpack.config.js | 8 +- src/web/assets/routes/src/routes.js | 959 ++-- src/web/assets/routes/src/routes.scss | 10 +- src/web/assets/routes/webpack.config.js | 8 +- src/web/assets/selectize/webpack.config.js | 12 +- src/web/assets/sites/src/sites.js | 637 ++- src/web/assets/sites/webpack.config.js | 8 +- .../systemmessages/src/system_messages.js | 368 +- .../systemmessages/src/system_messages.scss | 2 +- .../assets/systemmessages/webpack.config.js | 8 +- .../tablesettings/src/TableFieldSettings.js | 637 ++- .../assets/tablesettings/webpack.config.js | 8 +- src/web/assets/timepicker/webpack.config.js | 26 +- src/web/assets/updater/src/Updater.js | 343 +- src/web/assets/updater/src/update.scss | 10 +- src/web/assets/updater/webpack.config.js | 8 +- src/web/assets/updates/src/UpdatesUtility.js | 552 +- src/web/assets/updates/src/updates.scss | 10 +- src/web/assets/updates/webpack.config.js | 8 +- .../assets/updateswidget/src/UpdatesWidget.js | 142 +- .../assets/updateswidget/webpack.config.js | 8 +- .../userpermissions/src/UserPermissions.js | 113 +- .../userpermissions/src/user-permissions.scss | 4 +- .../assets/userpermissions/webpack.config.js | 8 +- src/web/assets/utilities/src/utilities.scss | 2 +- src/web/assets/utilities/webpack.config.js | 8 +- src/web/assets/velocity/webpack.config.js | 26 +- src/web/assets/vue/webpack.config.js | 30 +- src/web/assets/xregexp/webpack.config.js | 24 +- src/web/assets/yii2pjax/webpack.config.js | 24 +- tests/_craft/templates/index.html | 2 +- tests/_data/assets/files/test.html | 2 +- tests/_data/project.yaml | 3 +- tests/acceptance.suite.yml | 8 +- tests/docker-compose.yaml | 2 +- tests/functional.suite.yml | 10 +- tests/gql.suite.yml | 18 +- tests/unit.suite.yml | 14 +- 303 files changed, 49977 insertions(+), 41261 deletions(-) diff --git a/.codecov.yml b/.codecov.yml index 6c77a2205bc..8f6bdb07e4f 100644 --- a/.codecov.yml +++ b/.codecov.yml @@ -1,7 +1,7 @@ codecov: require_ci_to_pass: yes coverage: - range: "20...100" + range: '20...100' round: down precision: 2 status: @@ -9,9 +9,9 @@ coverage: default: threshold: .1 notify: - slack: - default: - url: "secret:M/dQaxt1nCzNG8JinXO5SmKdYoqErol7pzCV4Xv194cltAc0qu9WEezFP8Gnwkdg4eXfdxw2M0SbjcE8R8QB2B9n/YUHdXPdWsnhxa/HuIwc4kbvcaHyM7fU/lh7eWgYs4O5K3z/YnrirkmqNlzcgUuRmBOajf6MocPp4zd3sz8=" + slack: + default: + url: 'secret:M/dQaxt1nCzNG8JinXO5SmKdYoqErol7pzCV4Xv194cltAc0qu9WEezFP8Gnwkdg4eXfdxw2M0SbjcE8R8QB2B9n/YUHdXPdWsnhxa/HuIwc4kbvcaHyM7fU/lh7eWgYs4O5K3z/YnrirkmqNlzcgUuRmBOajf6MocPp4zd3sz8=' parsers: gcov: branch_detection: @@ -23,17 +23,17 @@ comment: off github_checks: annotations: false ignore: - - "src/web/assets" - - "src/test/internal" - - "src/config" - - "src/icons" - - "src/test/internal" - - "src/migrations" - - "src/templates" - - "src/translations" - - "src/views" - - "src/web/assets" - - "bootstrap" - - "lib" - - "tests" - - "vendor" + - 'src/web/assets' + - 'src/test/internal' + - 'src/config' + - 'src/icons' + - 'src/test/internal' + - 'src/migrations' + - 'src/templates' + - 'src/translations' + - 'src/views' + - 'src/web/assets' + - 'bootstrap' + - 'lib' + - 'tests' + - 'vendor' diff --git a/.github/ISSUE_TEMPLATE/BUG-REPORT-V3.yml b/.github/ISSUE_TEMPLATE/BUG-REPORT-V3.yml index 60bf631394e..56c0f66b57b 100644 --- a/.github/ISSUE_TEMPLATE/BUG-REPORT-V3.yml +++ b/.github/ISSUE_TEMPLATE/BUG-REPORT-V3.yml @@ -1,6 +1,6 @@ name: Bug Report – Craft 3 description: Report an issue or unexpected behavior pertaining to Craft 3 -title: "[3.x]: " +title: '[3.x]: ' labels: - bug - craft3 @@ -28,7 +28,6 @@ body: ### Actual behavior - validations: required: true - type: input diff --git a/.github/ISSUE_TEMPLATE/BUG-REPORT-V4.yml b/.github/ISSUE_TEMPLATE/BUG-REPORT-V4.yml index 0c53552a79d..c5c49baf8e2 100644 --- a/.github/ISSUE_TEMPLATE/BUG-REPORT-V4.yml +++ b/.github/ISSUE_TEMPLATE/BUG-REPORT-V4.yml @@ -1,6 +1,6 @@ name: Bug Report – Craft 4 Beta description: Report an issue or unexpected behavior pertaining to Craft 4 Beta -title: "[4.x]: " +title: '[4.x]: ' labels: - bug - craft4 @@ -28,7 +28,6 @@ body: ### Actual behavior - validations: required: true - type: input diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5c45413a915..60224a8582d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,7 +21,7 @@ jobs: php_versions: '["7.2", "7.3", "7.4", "8.0", "8.1"]' notify-slack: name: Notify Slack - needs: [ ecs, codecept ] + needs: [ecs, codecept] if: ${{ always() }} uses: craftcms/.github/.github/workflows/notify-slack.yml@v1 with: diff --git a/.prettierignore b/.prettierignore index ed7253e86e1..2edd5ffe207 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,7 +1,8 @@ *.php *.md +composer.lock src/web/assets/**/dist/* vendor/* lib/* cpresources/* -composer.lock +src/templates/* diff --git a/composer.json b/composer.json index 83a20468275..d7ec7393472 100644 --- a/composer.json +++ b/composer.json @@ -102,7 +102,7 @@ "config": { "sort-packages": true, "platform": { - "php": "7.2.5" + "php": "7.2.5" }, "allow-plugins": { "yiisoft/yii2-composer": true, diff --git a/crowdin.yml b/crowdin.yml index b7cf4574aac..5a696b24bfa 100644 --- a/crowdin.yml +++ b/crowdin.yml @@ -11,4 +11,4 @@ files: - el - id - ky -commit_message: "[ci skip]" +commit_message: '[ci skip]' diff --git a/packages/craftcms-sass/_mixins.scss b/packages/craftcms-sass/_mixins.scss index 642177adc71..bfc21c61503 100644 --- a/packages/craftcms-sass/_mixins.scss +++ b/packages/craftcms-sass/_mixins.scss @@ -15,71 +15,71 @@ $grey800: hsl(209, 20%, 25%); $grey900: hsl(210, 24%, 16%); $grey1000: hsl(210, 24%, 10%); -$blue050: #E3F8FF; -$blue100: #B3ECFF; -$blue200: #81DEFD; -$blue300: #5ED0FA; -$blue400: #40C3F7; -$blue500: #2BB0ED; -$blue600: #1992D4; -$blue700: #127FBF; -$blue800: #0B69A3; +$blue050: #e3f8ff; +$blue100: #b3ecff; +$blue200: #81defd; +$blue300: #5ed0fa; +$blue400: #40c3f7; +$blue500: #2bb0ed; +$blue600: #1992d4; +$blue700: #127fbf; +$blue800: #0b69a3; $blue900: #035388; -$cyan050: #E0FCFF; -$cyan100: #BEF8FD; -$cyan200: #87EAF2; -$cyan300: #54D1DB; -$cyan400: #38BEC9; -$cyan500: #2CB1BC; -$cyan600: #14919B; -$cyan700: #0E7C86; -$cyan800: #0A6C74; -$cyan900: #044E54; - -$pink050: #FFE3EC; -$pink100: #FFB8D2; -$pink200: #FF8CBA; -$pink300: #F364A2; -$pink400: #E8368F; -$pink500: #DA127D; -$pink600: #BC0A6F; -$pink700: #A30664; +$cyan050: #e0fcff; +$cyan100: #bef8fd; +$cyan200: #87eaf2; +$cyan300: #54d1db; +$cyan400: #38bec9; +$cyan500: #2cb1bc; +$cyan600: #14919b; +$cyan700: #0e7c86; +$cyan800: #0a6c74; +$cyan900: #044e54; + +$pink050: #ffe3ec; +$pink100: #ffb8d2; +$pink200: #ff8cba; +$pink300: #f364a2; +$pink400: #e8368f; +$pink500: #da127d; +$pink600: #bc0a6f; +$pink700: #a30664; $pink800: #870557; $pink900: #620042; -$red050: #FFE3E3; -$red100: #FFBDBD; -$red200: #FF9B9B; -$red300: #F86A6A; -$red400: #EF4E4E; -$red500: #E12D39; -$red600: #CF1124; -$red700: #AB091E; -$red800: #8A041A; +$red050: #ffe3e3; +$red100: #ffbdbd; +$red200: #ff9b9b; +$red300: #f86a6a; +$red400: #ef4e4e; +$red500: #e12d39; +$red600: #cf1124; +$red700: #ab091e; +$red800: #8a041a; $red900: #610316; -$yellow050: #FFFBEA; -$yellow100: #FFF3C4; -$yellow200: #FCE588; -$yellow300: #FADB5F; -$yellow400: #F7C948; -$yellow500: #F0B429; -$yellow600: #DE911D; -$yellow700: #CB6E17; -$yellow800: #B44D12; -$yellow900: #8D2B0B; - -$teal050: #EFFCF6; -$teal100: #C6F7E2; -$teal200: #8EEDC7; -$teal300: #65D6AD; -$teal400: #3EBD93; -$teal500: #27AB83; +$yellow050: #fffbea; +$yellow100: #fff3c4; +$yellow200: #fce588; +$yellow300: #fadb5f; +$yellow400: #f7c948; +$yellow500: #f0b429; +$yellow600: #de911d; +$yellow700: #cb6e17; +$yellow800: #b44d12; +$yellow900: #8d2b0b; + +$teal050: #effcf6; +$teal100: #c6f7e2; +$teal200: #8eedc7; +$teal300: #65d6ad; +$teal400: #3ebd93; +$teal500: #27ab83; $teal600: #199473; -$teal700: #147D64; -$teal800: #0C6B58; -$teal900: #014D40; +$teal700: #147d64; +$teal800: #0c6b58; +$teal900: #014d40; // submit button colors $primaryColor: $red500; @@ -107,12 +107,15 @@ $darkHairlineColor: transparentize($grey400, 0.5); // focus colors $lightFocusColor: $blue300; $mediumFocusColor: $blue500; -$darkFocusColor: #0F74B1; +$darkFocusColor: #0f74b1; // focus rings -$lightFocusRing: 0 0 0 1px $lightFocusColor, 0 0 0 3px transparentize($lightFocusColor, 0.3); -$mediumFocusRing: 0 0 0 1px $mediumFocusColor, 0 0 0 3px transparentize($mediumFocusColor, 0.3); -$darkFocusRing: 0 0 0 1px $darkFocusColor, 0 0 0 3px transparentize($darkFocusColor, 0.3); +$lightFocusRing: 0 0 0 1px $lightFocusColor, + 0 0 0 3px transparentize($lightFocusColor, 0.3); +$mediumFocusRing: 0 0 0 1px $mediumFocusColor, + 0 0 0 3px transparentize($mediumFocusColor, 0.3); +$darkFocusRing: 0 0 0 1px $darkFocusColor, + 0 0 0 3px transparentize($darkFocusColor, 0.3); // selection colors $lightSelColor: $grey200; @@ -134,18 +137,28 @@ $checkboxSize: 16px; $radioSize: 16px; @mixin sans-serif-font { - font-family: system-ui, BlinkMacSystemFont, -apple-system, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif; + font-family: system-ui, BlinkMacSystemFont, -apple-system, 'Segoe UI', + 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', + 'Helvetica Neue', sans-serif; } @mixin fixed-width-font { - font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace; + font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, + monospace; font-size: 0.9em !important; } // Other @mixin svg-mask($color) { - rect, circle, ellipse, line, polyline, polygon, path, text { + rect, + circle, + ellipse, + line, + polyline, + polygon, + path, + text { fill: $color; stroke-width: 0; transition: fill linear 100ms; @@ -155,12 +168,12 @@ $radioSize: 16px; @mixin icon { font-family: 'Craft'; speak: none; - -webkit-font-feature-settings: "liga", "dlig"; - -moz-font-feature-settings: "liga=1, dlig=1"; - -moz-font-feature-settings: "liga", "dlig"; - -ms-font-feature-settings: "liga", "dlig"; - -o-font-feature-settings: "liga", "dlig"; - font-feature-settings: "liga", "dlig"; + -webkit-font-feature-settings: 'liga', 'dlig'; + -moz-font-feature-settings: 'liga=1, dlig=1'; + -moz-font-feature-settings: 'liga', 'dlig'; + -ms-font-feature-settings: 'liga', 'dlig'; + -o-font-feature-settings: 'liga', 'dlig'; + font-feature-settings: 'liga', 'dlig'; text-rendering: optimizeLegibility; font-weight: normal; font-variant: normal; @@ -506,7 +519,8 @@ $radioSize: 16px; overflow: auto; background: $white; user-select: none; - box-shadow: 0 0 0 1px transparentize($grey900, 0.9), 0 5px 20px transparentize($grey900, 0.75); + box-shadow: 0 0 0 1px transparentize($grey900, 0.9), + 0 5px 20px transparentize($grey900, 0.75); } @mixin menu-option-styles { @@ -620,7 +634,12 @@ $radioSize: 16px; font-size: 16px; line-height: 22px; - h1, h2, h3, h4, h5, h6 { + h1, + h2, + h3, + h4, + h5, + h6 { margin: 24px 0 16px; font-weight: 600; } diff --git a/packages/craftcms-webpack/Craft.d.ts b/packages/craftcms-webpack/Craft.d.ts index 31115ca6edf..792a9679a68 100644 --- a/packages/craftcms-webpack/Craft.d.ts +++ b/packages/craftcms-webpack/Craft.d.ts @@ -1,27 +1,31 @@ // Set up interfaces and types interface ProgressBarInterface { - new($element: JQuery, displaySteps?: boolean): ProgressBarInterface + new ($element: JQuery, displaySteps?: boolean): ProgressBarInterface; - $progressBar: JQuery + $progressBar: JQuery; - setItemCount(count: number): void + setItemCount(count: number): void; - setProcessedItemCount(count: number): void + setProcessedItemCount(count: number): void; - updateProgressBar(): void + updateProgressBar(): void; - showProgressBar(): void + showProgressBar(): void; } // Declare existing variables, mock the things we'll use. declare var Craft: { - ProgressBar: ProgressBarInterface, - t(category: string, message: string, params?: object): string, - postActionRequest(action: string, data?: object, callback?: (response: object, textStatus: string) => void): void, - initUiElements($container: JQuery): void, - expandPostArray(arr: object): any + ProgressBar: ProgressBarInterface; + t(category: string, message: string, params?: object): string; + postActionRequest( + action: string, + data?: object, + callback?: (response: object, textStatus: string) => void + ): void; + initUiElements($container: JQuery): void; + expandPostArray(arr: object): any; }; declare var Garnish: any; declare type JQuery = any; -declare var $: any; \ No newline at end of file +declare var $: any; diff --git a/packages/craftcms-webpack/index.js b/packages/craftcms-webpack/index.js index ef1203a16e8..14df9fdeb05 100644 --- a/packages/craftcms-webpack/index.js +++ b/packages/craftcms-webpack/index.js @@ -1,20 +1,21 @@ // Fix issue with monorepo and some plugins // https://github.com/jantimon/html-webpack-plugin/issues/1451#issuecomment-712581727 -const _require = (id) => require(require.resolve(id, { paths: [require.main.path] })); - -const path = require("path"); -const glob = require("glob"); -const { merge } = require("webpack-merge"); -const dotenv = require("dotenv"); -const fs = require("fs"); -const yargs = require("yargs/yargs"); -const { hideBin } = require("yargs/helpers"); +const _require = (id) => + require(require.resolve(id, {paths: [require.main.path]})); + +const path = require('path'); +const glob = require('glob'); +const {merge} = require('webpack-merge'); +const dotenv = require('dotenv'); +const fs = require('fs'); +const yargs = require('yargs/yargs'); +const {hideBin} = require('yargs/helpers'); const argv = yargs(hideBin(process.argv)).argv; -const Dotenv = require("dotenv-webpack"); -const MiniCssExtractPlugin = require("mini-css-extract-plugin"); -const { CleanWebpackPlugin } = require("clean-webpack-plugin"); +const Dotenv = require('dotenv-webpack'); +const MiniCssExtractPlugin = require('mini-css-extract-plugin'); +const {CleanWebpackPlugin} = require('clean-webpack-plugin'); const VueLoaderPlugin = require('vue-loader/lib/plugin'); -const { WebpackManifestPlugin } = _require('webpack-manifest-plugin'); +const {WebpackManifestPlugin} = _require('webpack-manifest-plugin'); const JsonMinimizerPlugin = require('json-minimizer-webpack-plugin'); const requestedConfig = argv['config-name'] ?? null; @@ -38,16 +39,23 @@ const getFirstExistingPath = (paths = []) => { * @param {string} options.cwd Path where the glob should be executed from. */ const getConfigs = ( - globPattern = "src/web/assets/*/webpack.config.js", + globPattern = 'src/web/assets/*/webpack.config.js', options = { cwd: module.parent.path, } -) => glob.sync(globPattern, options).filter((match) => { - // filter out unnecessary configs if we are only trying to build or serve one asset - return !requestedConfig || requestedConfig == path.basename(path.dirname(match)) -}).map((match) => { - return require(path.resolve(options.cwd, match)); -}); +) => + glob + .sync(globPattern, options) + .filter((match) => { + // filter out unnecessary configs if we are only trying to build or serve one asset + return ( + !requestedConfig || + requestedConfig == path.basename(path.dirname(match)) + ); + }) + .map((match) => { + return require(path.resolve(options.cwd, match)); + }); /** * Return a webpack config object. @@ -59,23 +67,14 @@ const getConfigs = ( * @param {string} postcssConfig * @returns {Object} */ -const getConfig = ({ - context, - type, - watchPaths, - postcssConfig, - config = {}, -}) => { - +const getConfig = ({context, type, watchPaths, postcssConfig, config = {}}) => { // Where webpack-cli was run from - const rootPath = path.resolve("./"); - const currentConfigName = argv["config-name"] || null; - const isDevServerRunning = path.basename(argv["$0"]) === "webpack-dev-server"; + const rootPath = path.resolve('./'); + const currentConfigName = argv['config-name'] || null; + const isDevServerRunning = path.basename(argv['$0']) === 'webpack-dev-server'; if (!context) { - throw new Error( - `The [context] argument is required.` - ); + throw new Error(`The [context] argument is required.`); } if (isDevServerRunning && !currentConfigName) { @@ -88,27 +87,30 @@ const getConfig = ({ if (!watchPaths) { watchPaths = [ - path.join(rootPath, "src/templates"), - path.join(context, "dist") + path.join(rootPath, 'src/templates'), + path.join(context, 'dist'), ]; } if (!postcssConfig) { postcssConfig = getFirstExistingPath([ - path.resolve(context, "postcss.config.js"), - path.resolve(__dirname, "postcss.config.js"), + path.resolve(context, 'postcss.config.js'), + path.resolve(__dirname, 'postcss.config.js'), ]); } const applyDotEnv = ({context, configName, currentConfigName, rootPath}) => { - const isCurrentConfig = currentConfigName && configName === currentConfigName; - const envFilePath = getFirstExistingPath([ - isCurrentConfig && path.join(context, ".env"), - path.join(rootPath, ".env"), - ].filter(Boolean)); + const isCurrentConfig = + currentConfigName && configName === currentConfigName; + const envFilePath = getFirstExistingPath( + [ + isCurrentConfig && path.join(context, '.env'), + path.join(rootPath, '.env'), + ].filter(Boolean) + ); if (envFilePath) { - dotenv.config({path: envFilePath}) + dotenv.config({path: envFilePath}); return envFilePath; } @@ -123,7 +125,7 @@ const getConfig = ({ for (let i = 0; i < files.length; i++) { let filename = path.join(context, files[i]); let stat = fs.lstatSync(filename); - if (!stat.isDirectory() && filename.indexOf(".php") > 0) { + if (!stat.isDirectory() && filename.indexOf('.php') > 0) { let data = fs.readFileSync(filename); if (data) { @@ -163,30 +165,34 @@ const getConfig = ({ } if (namespace && className) { - assetBundleClasses.push(namespace + "\\" + className); + assetBundleClasses.push(namespace + '\\' + className); } } } } - const https = process.env.DEV_SERVER_SSL_KEY && process.env.DEV_SERVER_SSL_CERT ? { - key: fs.readFileSync(process.env.DEV_SERVER_SSL_KEY), - cert: fs.readFileSync(process.env.DEV_SERVER_SSL_CERT), - } : false; - const host = process.env.DEV_SERVER_HOST || "localhost"; - const port = process.env.DEV_SERVER_PORT || "8085"; - const scheme = https ? "https" : "http"; - const publicPath = process.env.DEV_SERVER_PUBLIC || `${scheme}://${host}:${port}/`; + const https = + process.env.DEV_SERVER_SSL_KEY && process.env.DEV_SERVER_SSL_CERT + ? { + key: fs.readFileSync(process.env.DEV_SERVER_SSL_KEY), + cert: fs.readFileSync(process.env.DEV_SERVER_SSL_CERT), + } + : false; + const host = process.env.DEV_SERVER_HOST || 'localhost'; + const port = process.env.DEV_SERVER_PORT || '8085'; + const scheme = https ? 'https' : 'http'; + const publicPath = + process.env.DEV_SERVER_PUBLIC || `${scheme}://${host}:${port}/`; return { host, https, port, - allowedHosts: "all", + allowedHosts: 'all', devMiddleware: { publicPath, }, - headers: {"Access-Control-Allow-Origin": "*"}, + headers: {'Access-Control-Allow-Origin': '*'}, hot: true, client: { overlay: { @@ -194,12 +200,12 @@ const getConfig = ({ warnings: false, }, }, - static: watchPaths.map(directory => ({ + static: watchPaths.map((directory) => ({ directory, watch: true, })), - onBeforeSetupMiddleware: function(devServer) { - devServer.app.get("/which-asset", function(req, res) { + onBeforeSetupMiddleware: function (devServer) { + devServer.app.get('/which-asset', function (req, res) { res.json({ classes: assetBundleClasses, context, @@ -215,29 +221,29 @@ const getConfig = ({ currentConfigName, isDevServerRunning, watchPaths, - postcssConfig + postcssConfig, }) => { // Apply .env file first if applicable const dotenvResult = applyDotEnv({ context, configName, currentConfigName, - rootPath + rootPath, }); const config = { name: configName, - context: path.join(context, "src"), + context: path.join(context, 'src'), entry: {}, output: { - filename: "[name].js", - path: path.join(context, "dist"), + filename: '[name].js', + path: path.join(context, 'dist'), }, optimization: {}, devServer: getDevServer({context, watchPaths}), - devtool: "source-map", + devtool: 'source-map', resolve: { - extensions: [".wasm", ".ts", ".tsx", ".mjs", ".js", ".json", ".vue"], + extensions: ['.wasm', '.ts', '.tsx', '.mjs', '.js', '.json', '.vue'], }, module: { rules: [ @@ -245,9 +251,9 @@ const getConfig = ({ test: /.ts$/, exclude: /(node_modules|bower_components)/, use: { - loader: "ts-loader", + loader: 'ts-loader', options: { - configFile: path.resolve(__dirname, "./tsconfig.json"), + configFile: path.resolve(__dirname, './tsconfig.json'), }, }, }, @@ -255,10 +261,10 @@ const getConfig = ({ test: /.m?js?$/, exclude: /(node_modules|bower_components)/, use: { - loader: "babel-loader", + loader: 'babel-loader', options: { - plugins: ["@babel/plugin-syntax-dynamic-import"], - presets: ["@babel/preset-env", "@babel/preset-typescript"], + plugins: ['@babel/plugin-syntax-dynamic-import'], + presets: ['@babel/preset-env', '@babel/preset-typescript'], }, }, }, @@ -274,20 +280,20 @@ const getConfig = ({ { test: /\.s?[ac]ss$/i, use: [ - "vue-style-loader", + 'vue-style-loader', { loader: MiniCssExtractPlugin.loader, options: { // backing up from dist - publicPath: "../", + publicPath: '../', // Workaround for css imports/vue esModule: false, }, }, - "css-loader", + 'css-loader', { - loader: "postcss-loader", + loader: 'postcss-loader', options: { postcssOptions: { config: postcssConfig, @@ -295,35 +301,35 @@ const getConfig = ({ }, }, { - loader: "sass-loader", + loader: 'sass-loader', options: { // Prefer `dart-sass` - implementation: require("sass"), + implementation: require('sass'), }, }, ], }, { test: /fonts\/[a-zA-Z0-9\-\_]*\.(ttf|woff|woff2|svg)$/, - type: "asset/resource", + type: 'asset/resource', generator: { - filename: "fonts/[name][ext][query]", + filename: 'fonts/[name][ext][query]', }, }, { test: /\.(jpg|gif|png|svg|ico)$/, - type: "asset/resource", - exclude: [path.resolve(context, "./fonts")], + type: 'asset/resource', + exclude: [path.resolve(context, './fonts')], generator: { - filename: "[path][name][ext][query]", + filename: '[path][name][ext][query]', }, }, ], }, plugins: [ new MiniCssExtractPlugin({ - filename: "css/[name].css", - chunkFilename: "css/[name].css", + filename: 'css/[name].css', + chunkFilename: 'css/[name].css', }), ], externals: { @@ -335,21 +341,18 @@ const getConfig = ({ garnishjs: 'Garnish', 'iframe-resizer': 'iFrameResize', picturefill: 'picturefill', - xregexp: 'XRegExp' + xregexp: 'XRegExp', }, }; if (dotenvResult) { - config.plugins.push(new Dotenv({ path: dotenvResult })); + config.plugins.push(new Dotenv({path: dotenvResult})); } - if (!process.env.NODE_ENV === "production") { + if (!process.env.NODE_ENV === 'production') { config.plugins.push(new CleanWebpackPlugin()); config.optimization.minimize = true; - config.optimization.minimizer = [ - `...`, - new JsonMinimizerPlugin(), - ] + config.optimization.minimizer = [`...`, new JsonMinimizerPlugin()]; } return config; @@ -362,20 +365,20 @@ const getConfig = ({ rules: [ { test: /\.vue$/i, - use: ["vue-loader"], + use: ['vue-loader'], }, ], }, externals: { - vue: "Vue", - "vue-router": "VueRouter", - vuex: "Vuex", - axios: "axios", + vue: 'Vue', + 'vue-router': 'VueRouter', + vuex: 'Vuex', + axios: 'axios', }, plugins: [ new VueLoaderPlugin(), new WebpackManifestPlugin({ - publicPath: '/' + publicPath: '/', }), ], }, @@ -384,7 +387,9 @@ const getConfig = ({ const config = types[type]; if (type && !config) { - throw `Type [${type}] is not a valid config type. Must be one of [${Object.keys(types).join(', ')}].`; + throw `Type [${type}] is not a valid config type. Must be one of [${Object.keys( + types + ).join(', ')}].`; } return config || {}; diff --git a/packages/craftcms-webpack/postcss.config.js b/packages/craftcms-webpack/postcss.config.js index fe1ae297e15..568546f219f 100644 --- a/packages/craftcms-webpack/postcss.config.js +++ b/packages/craftcms-webpack/postcss.config.js @@ -1,7 +1,5 @@ const path = require('path'); module.exports = { - plugins: [ - require('autoprefixer') - ], -} \ No newline at end of file + plugins: [require('autoprefixer')], +}; diff --git a/packages/craftcms-webpack/tsconfig.json b/packages/craftcms-webpack/tsconfig.json index cac7c6f63ff..635ff1ad111 100644 --- a/packages/craftcms-webpack/tsconfig.json +++ b/packages/craftcms-webpack/tsconfig.json @@ -4,11 +4,11 @@ /* Basic Options */ // "incremental": true, /* Enable incremental compilation */ - "target": "es2017", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */ - "module": "esnext", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */ + "target": "es2017" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */, + "module": "esnext" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */, // "lib": [], /* Specify library files to be included in the compilation. */ - "allowJs": false, /* Allow javascript files to be compiled. */ - "checkJs": false, /* Report errors in .js files. */ + "allowJs": false /* Allow javascript files to be compiled. */, + "checkJs": false /* Report errors in .js files. */, // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */ // "declaration": true, /* Generates corresponding '.d.ts' file. */ // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ @@ -18,15 +18,15 @@ // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ // "composite": true, /* Enable project compilation */ // "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */ - "removeComments": false, /* Do not emit comments to output. */ + "removeComments": false /* Do not emit comments to output. */, // "noEmit": true, /* Do not emit outputs. */ // "importHelpers": true, /* Import emit helpers from 'tslib'. */ // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ /* Strict Type-Checking Options */ - "strict": true, /* Enable all strict type-checking options. */ - "noImplicitAny": false, /* Raise error on expressions and declarations with an implied 'any' type. */ + "strict": true /* Enable all strict type-checking options. */, + "noImplicitAny": false /* Raise error on expressions and declarations with an implied 'any' type. */, // "strictNullChecks": true, /* Enable strict null checks. */ // "strictFunctionTypes": true, /* Enable strict checking of function types. */ // "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */ @@ -48,7 +48,7 @@ // "typeRoots": [], /* List of folders to include type definitions from. */ // "types": [], /* Type declaration files to be included in compilation. */ // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ - "esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ + "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */, // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */ // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ @@ -63,8 +63,8 @@ // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ /* Advanced Options */ - "skipLibCheck": true, /* Skip type checking of declaration files. */ - "forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */ + "skipLibCheck": true /* Skip type checking of declaration files. */, + "forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */ }, "files": ["./Craft.d.ts"] -} \ No newline at end of file +} diff --git a/src/test/internal/example-test-suite/tests/functional.suite.yml b/src/test/internal/example-test-suite/tests/functional.suite.yml index afc176c4d4a..0b21602f44b 100644 --- a/src/test/internal/example-test-suite/tests/functional.suite.yml +++ b/src/test/internal/example-test-suite/tests/functional.suite.yml @@ -3,4 +3,3 @@ modules: enabled: - \craft\test\Craft - \Helper\Functional - diff --git a/src/web/assets/admintable/src/App.vue b/src/web/assets/admintable/src/App.vue index 20d6f28e688..9c88785996d 100644 --- a/src/web/assets/admintable/src/App.vue +++ b/src/web/assets/admintable/src/App.vue @@ -1,718 +1,827 @@ - diff --git a/src/web/assets/admintable/src/js/components/AdminTableActionButton.vue b/src/web/assets/admintable/src/js/components/AdminTableActionButton.vue index fe9a3547db7..b12697f0839 100644 --- a/src/web/assets/admintable/src/js/components/AdminTableActionButton.vue +++ b/src/web/assets/admintable/src/js/components/AdminTableActionButton.vue @@ -1,198 +1,235 @@ + }, + + enableButton() { + if (this.isMenuButtonInitialised) { + this.button.data('menubtn').enable(); + } else { + this.buttonDisabled = false; + } + }, + + disableButton() { + if (this.isMenuButtonInitialised) { + this.button.data('menubtn').disable(); + } else { + this.buttonDisabled = true; + } + }, + }, + + computed: { + actionsList() { + if (!this.actions.length) { + return []; + } + + let actionsList = []; + let _tmpActionsList = []; + + this.actions.forEach((item) => { + if (Object.keys(item).indexOf('separator') >= 0 && item.separator) { + actionsList.push(_tmpActionsList); + _tmpActionsList = []; + } - \ No newline at end of file + diff --git a/src/web/assets/admintable/src/js/components/AdminTableButton.vue b/src/web/assets/admintable/src/js/components/AdminTableButton.vue index 93a85b09358..1dd758cbc73 100644 --- a/src/web/assets/admintable/src/js/components/AdminTableButton.vue +++ b/src/web/assets/admintable/src/js/components/AdminTableButton.vue @@ -1,53 +1,67 @@ - \ No newline at end of file + diff --git a/src/web/assets/admintable/src/js/components/AdminTableCheckbox.vue b/src/web/assets/admintable/src/js/components/AdminTableCheckbox.vue index e783e000fc8..fc7c9f0b21f 100644 --- a/src/web/assets/admintable/src/js/components/AdminTableCheckbox.vue +++ b/src/web/assets/admintable/src/js/components/AdminTableCheckbox.vue @@ -1,60 +1,60 @@ \ No newline at end of file + diff --git a/src/web/assets/admintable/src/js/components/AdminTableCopyTextButton.vue b/src/web/assets/admintable/src/js/components/AdminTableCopyTextButton.vue index 2a8e4865ecb..c17233a9313 100644 --- a/src/web/assets/admintable/src/js/components/AdminTableCopyTextButton.vue +++ b/src/web/assets/admintable/src/js/components/AdminTableCopyTextButton.vue @@ -3,27 +3,27 @@ - + diff --git a/src/web/assets/admintable/src/js/components/AdminTableDeleteButton.vue b/src/web/assets/admintable/src/js/components/AdminTableDeleteButton.vue index c2b1541b4bf..6853b755ed7 100644 --- a/src/web/assets/admintable/src/js/components/AdminTableDeleteButton.vue +++ b/src/web/assets/admintable/src/js/components/AdminTableDeleteButton.vue @@ -1,88 +1,107 @@ - \ No newline at end of file + diff --git a/src/web/assets/admintable/src/js/components/AdminTableDetailRow.vue b/src/web/assets/admintable/src/js/components/AdminTableDetailRow.vue index 40fb1aec2c3..e9219697d1a 100644 --- a/src/web/assets/admintable/src/js/components/AdminTableDetailRow.vue +++ b/src/web/assets/admintable/src/js/components/AdminTableDetailRow.vue @@ -1,74 +1,86 @@ \ No newline at end of file + diff --git a/src/web/assets/admintable/src/js/components/AdminTablePagination.vue b/src/web/assets/admintable/src/js/components/AdminTablePagination.vue index 4fefdb6ca27..cb15187adcf 100644 --- a/src/web/assets/admintable/src/js/components/AdminTablePagination.vue +++ b/src/web/assets/admintable/src/js/components/AdminTablePagination.vue @@ -1,49 +1,58 @@ diff --git a/src/web/assets/pluginstore/src/js/api/cart.js b/src/web/assets/pluginstore/src/js/api/cart.js index 6d0d2c2d65f..59e22264284 100644 --- a/src/web/assets/pluginstore/src/js/api/cart.js +++ b/src/web/assets/pluginstore/src/js/api/cart.js @@ -1,86 +1,90 @@ /* global Craft */ -import axios from 'axios' +import axios from 'axios'; export default { - /** - * Create cart. - */ - createCart(data) { - return new Promise((resolve, reject) => { - Craft.sendApiRequest('POST', 'carts', { - data, - }) - .then((responseData) => { - resolve(responseData) - }) - .catch((error) => { - reject(error) - }) + /** + * Create cart. + */ + createCart(data) { + return new Promise((resolve, reject) => { + Craft.sendApiRequest('POST', 'carts', { + data, + }) + .then((responseData) => { + resolve(responseData); }) - }, + .catch((error) => { + reject(error); + }); + }); + }, - /** - * Get cart. - */ - getCart(orderNumber) { - return new Promise((resolve, reject) => { - Craft.sendApiRequest('GET', 'carts/' + orderNumber) - .then((responseData) => { - resolve(responseData) - }) - .catch((error) => { - reject(error) - }) + /** + * Get cart. + */ + getCart(orderNumber) { + return new Promise((resolve, reject) => { + Craft.sendApiRequest('GET', 'carts/' + orderNumber) + .then((responseData) => { + resolve(responseData); }) - }, + .catch((error) => { + reject(error); + }); + }); + }, - /** - * Get order number. - */ - getOrderNumber(cb) { - const orderNumber = localStorage.getItem('orderNumber') + /** + * Get order number. + */ + getOrderNumber(cb) { + const orderNumber = localStorage.getItem('orderNumber'); - return cb(orderNumber) - }, + return cb(orderNumber); + }, - /** - * Reset order number. - */ - resetOrderNumber() { - localStorage.removeItem('orderNumber') - }, + /** + * Reset order number. + */ + resetOrderNumber() { + localStorage.removeItem('orderNumber'); + }, - /** - * Save order number. - */ - saveOrderNumber(orderNumber) { - localStorage.setItem('orderNumber', orderNumber) - }, + /** + * Save order number. + */ + saveOrderNumber(orderNumber) { + localStorage.setItem('orderNumber', orderNumber); + }, - /** - * Save plugin license keys - */ - savePluginLicenseKeys(data) { - return axios.post(Craft.getActionUrl('plugin-store/save-plugin-license-keys'), data, { - headers: { - 'X-CSRF-Token': Craft.csrfTokenValue, - } - }) - }, + /** + * Save plugin license keys + */ + savePluginLicenseKeys(data) { + return axios.post( + Craft.getActionUrl('plugin-store/save-plugin-license-keys'), + data, + { + headers: { + 'X-CSRF-Token': Craft.csrfTokenValue, + }, + } + ); + }, - /** - * Update cart. - */ - updateCart(orderNumber, data) { - return new Promise((resolve, reject) => { - Craft.sendApiRequest('POST', 'carts/' + orderNumber, {data}) - .then((responseData) => { - resolve(responseData) - }) - .catch((error) => { - reject(error) - }) + /** + * Update cart. + */ + updateCart(orderNumber, data) { + return new Promise((resolve, reject) => { + Craft.sendApiRequest('POST', 'carts/' + orderNumber, {data}) + .then((responseData) => { + resolve(responseData); }) - }, -} + .catch((error) => { + reject(error); + }); + }); + }, +}; diff --git a/src/web/assets/pluginstore/src/js/api/craft.js b/src/web/assets/pluginstore/src/js/api/craft.js index 03e39a2a2a7..4f3111a9b1e 100644 --- a/src/web/assets/pluginstore/src/js/api/craft.js +++ b/src/web/assets/pluginstore/src/js/api/craft.js @@ -1,174 +1,181 @@ /* global Craft */ -import axios from 'axios' +import axios from 'axios'; // create a cancel token for axios -let CancelToken = axios.CancelToken -let cancelTokenSource = CancelToken.source() +let CancelToken = axios.CancelToken; +let cancelTokenSource = CancelToken.source(); // create an axios instance const _axios = axios.create({ - cancelToken: cancelTokenSource.token, -}) + cancelToken: cancelTokenSource.token, +}); export default { - /** - * Cancel requests. - */ - cancelRequests() { - // cancel requests - cancelTokenSource.cancel() + /** + * Cancel requests. + */ + cancelRequests() { + // cancel requests + cancelTokenSource.cancel(); - // create a new cancel token - cancelTokenSource = CancelToken.source() + // create a new cancel token + cancelTokenSource = CancelToken.source(); - // update axios with the new cancel token - _axios.defaults.cancelToken = cancelTokenSource.token - }, + // update axios with the new cancel token + _axios.defaults.cancelToken = cancelTokenSource.token; + }, - /** - * Get Craft data. - */ - getCraftData() { - return new Promise((resolve, reject) => { - _axios.get(Craft.getActionUrl('plugin-store/craft-data')) - .then((response) => { - resolve(response) - }) - .catch((error) => { - if (axios.isCancel(error)) { - // request cancelled - } else { - reject(error) - } - }) + /** + * Get Craft data. + */ + getCraftData() { + return new Promise((resolve, reject) => { + _axios + .get(Craft.getActionUrl('plugin-store/craft-data')) + .then((response) => { + resolve(response); }) - }, + .catch((error) => { + if (axios.isCancel(error)) { + // request cancelled + } else { + reject(error); + } + }); + }); + }, - /** - * Get Craft ID data. - */ - getCraftIdData({accessToken}) { - return new Promise((resolve, reject) => { - Craft.sendApiRequest('GET', 'account', { - cancelToken: cancelTokenSource.token, - headers: { - 'Authorization': 'Bearer ' + accessToken, - } - }) - .then((responseData) => { - resolve(responseData) - }) - .catch((error) => { - if (axios.isCancel(error)) { - // request cancelled - } else { - reject(error) - } - }) + /** + * Get Craft ID data. + */ + getCraftIdData({accessToken}) { + return new Promise((resolve, reject) => { + Craft.sendApiRequest('GET', 'account', { + cancelToken: cancelTokenSource.token, + headers: { + Authorization: 'Bearer ' + accessToken, + }, + }) + .then((responseData) => { + resolve(responseData); }) - }, + .catch((error) => { + if (axios.isCancel(error)) { + // request cancelled + } else { + reject(error); + } + }); + }); + }, - /** - * Get countries. - */ - getCountries() { - return new Promise((resolve, reject) => { - Craft.sendApiRequest('GET', 'countries', { - cancelToken: cancelTokenSource.token, - }) - .then((responseData) => { - resolve(responseData) - }) - .catch((error) => { - if (axios.isCancel(error)) { - // request cancelled - } else { - reject(error) - } - }) + /** + * Get countries. + */ + getCountries() { + return new Promise((resolve, reject) => { + Craft.sendApiRequest('GET', 'countries', { + cancelToken: cancelTokenSource.token, + }) + .then((responseData) => { + resolve(responseData); }) - }, + .catch((error) => { + if (axios.isCancel(error)) { + // request cancelled + } else { + reject(error); + } + }); + }); + }, - /** - * Get Plugin License Info. - */ - getPluginLicenseInfo() { - return new Promise((resolve, reject) => { - Craft.sendApiRequest('GET', 'cms-licenses', { - params: { - include: 'plugins', - }, - }) - .then(function(response) { - _axios.post(Craft.getActionUrl('app/get-plugin-license-info'), { - pluginLicenses: response.license.pluginLicenses || [], - }, { - headers: { - 'X-CSRF-Token': Craft.csrfTokenValue, - } - }) - .then((response) => { - resolve(response) - }) - .catch((error) => { - if (axios.isCancel(error)) { - // request cancelled - } else { - reject(error) - } - }) - }) - }) - }, + /** + * Get Plugin License Info. + */ + getPluginLicenseInfo() { + return new Promise((resolve, reject) => { + Craft.sendApiRequest('GET', 'cms-licenses', { + params: { + include: 'plugins', + }, + }).then(function (response) { + _axios + .post( + Craft.getActionUrl('app/get-plugin-license-info'), + { + pluginLicenses: response.license.pluginLicenses || [], + }, + { + headers: { + 'X-CSRF-Token': Craft.csrfTokenValue, + }, + } + ) + .then((response) => { + resolve(response); + }) + .catch((error) => { + if (axios.isCancel(error)) { + // request cancelled + } else { + reject(error); + } + }); + }); + }); + }, - /** - * Switch plugin edition. - */ - switchPluginEdition(pluginHandle, edition) { - return new Promise((resolve, reject) => { - const data = 'pluginHandle=' + pluginHandle + '&edition=' + edition + /** + * Switch plugin edition. + */ + switchPluginEdition(pluginHandle, edition) { + return new Promise((resolve, reject) => { + const data = 'pluginHandle=' + pluginHandle + '&edition=' + edition; - _axios.post(Craft.getActionUrl('plugins/switch-edition'), data, { - headers: { - 'X-CSRF-Token': Craft.csrfTokenValue, - }, - }) - .then((response) => { - Craft.clearCachedApiHeaders() - resolve(response) - }) - .catch((error) => { - if (axios.isCancel(error)) { - // request cancelled - } else { - reject(error) - } - }) + _axios + .post(Craft.getActionUrl('plugins/switch-edition'), data, { + headers: { + 'X-CSRF-Token': Craft.csrfTokenValue, + }, + }) + .then((response) => { + Craft.clearCachedApiHeaders(); + resolve(response); }) - }, + .catch((error) => { + if (axios.isCancel(error)) { + // request cancelled + } else { + reject(error); + } + }); + }); + }, - /** - * Try edition. - */ - tryEdition(edition) { - return new Promise((resolve, reject) => { - _axios.post(Craft.getActionUrl('app/try-edition'), 'edition=' + edition, { - headers: { - 'X-CSRF-Token': Craft.csrfTokenValue, - } - }) - .then((response) => { - Craft.clearCachedApiHeaders() - resolve(response) - }) - .catch((error) => { - if (axios.isCancel(error)) { - // request cancelled - } else { - reject(error) - } - }) + /** + * Try edition. + */ + tryEdition(edition) { + return new Promise((resolve, reject) => { + _axios + .post(Craft.getActionUrl('app/try-edition'), 'edition=' + edition, { + headers: { + 'X-CSRF-Token': Craft.csrfTokenValue, + }, + }) + .then((response) => { + Craft.clearCachedApiHeaders(); + resolve(response); }) - }, -} + .catch((error) => { + if (axios.isCancel(error)) { + // request cancelled + } else { + reject(error); + } + }); + }); + }, +}; diff --git a/src/web/assets/pluginstore/src/js/api/pluginstore.js b/src/web/assets/pluginstore/src/js/api/pluginstore.js index a9bb4d74282..1438cd1ff54 100644 --- a/src/web/assets/pluginstore/src/js/api/pluginstore.js +++ b/src/web/assets/pluginstore/src/js/api/pluginstore.js @@ -1,421 +1,429 @@ /* global Craft */ -import axios from 'axios' +import axios from 'axios'; // create a cancel token for axios -let CancelToken = axios.CancelToken -let cancelTokenSource = CancelToken.source() +let CancelToken = axios.CancelToken; +let cancelTokenSource = CancelToken.source(); export default { - /** - * Cancel requests. - */ - cancelRequests() { - // cancel requests - cancelTokenSource.cancel() + /** + * Cancel requests. + */ + cancelRequests() { + // cancel requests + cancelTokenSource.cancel(); - // create a new cancel token - cancelTokenSource = CancelToken.source() - }, + // create a new cancel token + cancelTokenSource = CancelToken.source(); + }, - /** - * Get plugin store data. - * - * @returns {AxiosPromise} - */ - getCoreData() { - return new Promise((resolve, reject) => { - Craft.sendApiRequest('GET', 'plugin-store/core-data', { - cancelToken: cancelTokenSource.token, - }) - .then((responseData) => { - resolve(responseData) - }) - .catch((error) => { - if (axios.isCancel(error)) { - // request cancelled - } else { - reject(error) - } - }) + /** + * Get plugin store data. + * + * @returns {AxiosPromise} + */ + getCoreData() { + return new Promise((resolve, reject) => { + Craft.sendApiRequest('GET', 'plugin-store/core-data', { + cancelToken: cancelTokenSource.token, + }) + .then((responseData) => { + resolve(responseData); }) - }, + .catch((error) => { + if (axios.isCancel(error)) { + // request cancelled + } else { + reject(error); + } + }); + }); + }, - /** - * Get CMS editions. - * - * @returns {AxiosPromise} - */ - getCmsEditions() { - return new Promise((resolve, reject) => { - Craft.sendApiRequest('GET', 'cms-editions', { - cancelToken: cancelTokenSource.token, - }) - .then((responseData) => { - resolve(responseData) - }) - .catch((error) => { - if (axios.isCancel(error)) { - // request cancelled - } else { - reject(error) - } - }) + /** + * Get CMS editions. + * + * @returns {AxiosPromise} + */ + getCmsEditions() { + return new Promise((resolve, reject) => { + Craft.sendApiRequest('GET', 'cms-editions', { + cancelToken: cancelTokenSource.token, + }) + .then((responseData) => { + resolve(responseData); }) - }, + .catch((error) => { + if (axios.isCancel(error)) { + // request cancelled + } else { + reject(error); + } + }); + }); + }, - /** - * Get developer. - * - * @param developerId - * @returns {AxiosPromise} - */ - getDeveloper(developerId) { - return new Promise((resolve, reject) => { - Craft.sendApiRequest('GET', 'developer/' + developerId, { - cancelToken: cancelTokenSource.token, - }) - .then((responseData) => { - resolve(responseData) - }) - .catch((error) => { - if (axios.isCancel(error)) { - // request cancelled - } else { - reject(error) - } - }) + /** + * Get developer. + * + * @param developerId + * @returns {AxiosPromise} + */ + getDeveloper(developerId) { + return new Promise((resolve, reject) => { + Craft.sendApiRequest('GET', 'developer/' + developerId, { + cancelToken: cancelTokenSource.token, + }) + .then((responseData) => { + resolve(responseData); }) - }, + .catch((error) => { + if (axios.isCancel(error)) { + // request cancelled + } else { + reject(error); + } + }); + }); + }, - /** - * Get featured section by handle. - * - * @param featuredSectionHandle - * @returns {AxiosPromise} - */ - getFeaturedSectionByHandle(featuredSectionHandle) { - return new Promise((resolve, reject) => { - Craft.sendApiRequest('GET', 'plugin-store/featured-section/' + featuredSectionHandle, { - cancelToken: cancelTokenSource.token, - }) - .then((responseData) => { - resolve(responseData) - }) - .catch((error) => { - if (axios.isCancel(error)) { - // request cancelled - } else { - reject(error) - } - }) + /** + * Get featured section by handle. + * + * @param featuredSectionHandle + * @returns {AxiosPromise} + */ + getFeaturedSectionByHandle(featuredSectionHandle) { + return new Promise((resolve, reject) => { + Craft.sendApiRequest( + 'GET', + 'plugin-store/featured-section/' + featuredSectionHandle, + { + cancelToken: cancelTokenSource.token, + } + ) + .then((responseData) => { + resolve(responseData); }) - }, + .catch((error) => { + if (axios.isCancel(error)) { + // request cancelled + } else { + reject(error); + } + }); + }); + }, - /** - * Get featured sections. - * - * @returns {AxiosPromise} - */ - getFeaturedSections() { - return new Promise((resolve, reject) => { - Craft.sendApiRequest('GET', 'plugin-store/featured-sections', { - cancelToken: cancelTokenSource.token, - }) - .then((responseData) => { - resolve(responseData) - }) - .catch((error) => { - if (axios.isCancel(error)) { - // request cancelled - } else { - reject(error) - } - }) + /** + * Get featured sections. + * + * @returns {AxiosPromise} + */ + getFeaturedSections() { + return new Promise((resolve, reject) => { + Craft.sendApiRequest('GET', 'plugin-store/featured-sections', { + cancelToken: cancelTokenSource.token, + }) + .then((responseData) => { + resolve(responseData); }) - }, + .catch((error) => { + if (axios.isCancel(error)) { + // request cancelled + } else { + reject(error); + } + }); + }); + }, - /** - * Get plugin changelog. - * - * @param pluginId - * @returns {AxiosPromise} - */ - getPluginChangelog(pluginId) { - return new Promise((resolve, reject) => { - Craft.sendApiRequest('GET', 'plugin/' + pluginId + '/changelog', { - cancelToken: cancelTokenSource.token, - }) - .then((responseData) => { - resolve(responseData) - }) - .catch((error) => { - if (axios.isCancel(error)) { - // request cancelled - } else { - reject(error) - } - }) + /** + * Get plugin changelog. + * + * @param pluginId + * @returns {AxiosPromise} + */ + getPluginChangelog(pluginId) { + return new Promise((resolve, reject) => { + Craft.sendApiRequest('GET', 'plugin/' + pluginId + '/changelog', { + cancelToken: cancelTokenSource.token, + }) + .then((responseData) => { + resolve(responseData); }) - }, + .catch((error) => { + if (axios.isCancel(error)) { + // request cancelled + } else { + reject(error); + } + }); + }); + }, - /** - * Get plugin details. - * - * @param pluginId - * @returns {AxiosPromise} - */ - getPluginDetails(pluginId) { - return new Promise((resolve, reject) => { - Craft.sendApiRequest('GET', 'plugin/' + pluginId, { - cancelToken: cancelTokenSource.token, - }) - .then((responseData) => { - resolve(responseData) - }) - .catch((error) => { - if (axios.isCancel(error)) { - // request cancelled - } else { - reject(error) - } - }) + /** + * Get plugin details. + * + * @param pluginId + * @returns {AxiosPromise} + */ + getPluginDetails(pluginId) { + return new Promise((resolve, reject) => { + Craft.sendApiRequest('GET', 'plugin/' + pluginId, { + cancelToken: cancelTokenSource.token, + }) + .then((responseData) => { + resolve(responseData); }) - }, + .catch((error) => { + if (axios.isCancel(error)) { + // request cancelled + } else { + reject(error); + } + }); + }); + }, - /** - * Get plugin details by handle. - * - * @param pluginHandle - * @returns {AxiosPromise} - */ - getPluginDetailsByHandle(pluginHandle) { - return new Promise((resolve, reject) => { - Craft.sendApiRequest('GET', 'plugin-store/plugin/' + pluginHandle, { - cancelToken: cancelTokenSource.token, - }) - .then((responseData) => { - resolve(responseData) - }) - .catch((error) => { - if (axios.isCancel(error)) { - // request cancelled - } else { - reject(error) - } - }) + /** + * Get plugin details by handle. + * + * @param pluginHandle + * @returns {AxiosPromise} + */ + getPluginDetailsByHandle(pluginHandle) { + return new Promise((resolve, reject) => { + Craft.sendApiRequest('GET', 'plugin-store/plugin/' + pluginHandle, { + cancelToken: cancelTokenSource.token, + }) + .then((responseData) => { + resolve(responseData); }) - }, + .catch((error) => { + if (axios.isCancel(error)) { + // request cancelled + } else { + reject(error); + } + }); + }); + }, - /** - * Get plugins by category. - * - * @param categoryId - * @param pluginIndexParams - * @returns {AxiosPromise} - */ - getPluginsByCategory(categoryId, pluginIndexParams) { - return new Promise((resolve, reject) => { - const params = this._getPluginIndexParams(pluginIndexParams) - params.categoryId = categoryId + /** + * Get plugins by category. + * + * @param categoryId + * @param pluginIndexParams + * @returns {AxiosPromise} + */ + getPluginsByCategory(categoryId, pluginIndexParams) { + return new Promise((resolve, reject) => { + const params = this._getPluginIndexParams(pluginIndexParams); + params.categoryId = categoryId; - Craft.sendApiRequest('GET', 'plugin-store/plugins', { - cancelToken: cancelTokenSource.token, - params, - }) - .then((responseData) => { - resolve(responseData) - }) - .catch((error) => { - if (axios.isCancel(error)) { - // request cancelled - } else { - reject(error) - } - }) + Craft.sendApiRequest('GET', 'plugin-store/plugins', { + cancelToken: cancelTokenSource.token, + params, + }) + .then((responseData) => { + resolve(responseData); }) - }, + .catch((error) => { + if (axios.isCancel(error)) { + // request cancelled + } else { + reject(error); + } + }); + }); + }, - /** - * Get plugins by developer ID. - * - * @param developerId - * @param pluginIndexParams - * @returns {AxiosPromise} - */ - getPluginsByDeveloperId(developerId, pluginIndexParams) { - return new Promise((resolve, reject) => { - const params = this._getPluginIndexParams(pluginIndexParams) - params.developerId = developerId + /** + * Get plugins by developer ID. + * + * @param developerId + * @param pluginIndexParams + * @returns {AxiosPromise} + */ + getPluginsByDeveloperId(developerId, pluginIndexParams) { + return new Promise((resolve, reject) => { + const params = this._getPluginIndexParams(pluginIndexParams); + params.developerId = developerId; - Craft.sendApiRequest('GET', 'plugin-store/plugins', { - cancelToken: cancelTokenSource.token, - params, - }) - .then((responseData) => { - resolve(responseData) - }) - .catch((error) => { - if (axios.isCancel(error)) { - // request cancelled - } else { - reject(error) - } - }) + Craft.sendApiRequest('GET', 'plugin-store/plugins', { + cancelToken: cancelTokenSource.token, + params, + }) + .then((responseData) => { + resolve(responseData); }) - }, + .catch((error) => { + if (axios.isCancel(error)) { + // request cancelled + } else { + reject(error); + } + }); + }); + }, - /** - * Get plugins by featured section handle. - * - * @param featuredSectionHandle - * @param pluginIndexParams - * @returns {AxiosPromise} - */ - getPluginsByFeaturedSectionHandle(featuredSectionHandle, pluginIndexParams) { - return new Promise((resolve, reject) => { - const params = this._getPluginIndexParams(pluginIndexParams) + /** + * Get plugins by featured section handle. + * + * @param featuredSectionHandle + * @param pluginIndexParams + * @returns {AxiosPromise} + */ + getPluginsByFeaturedSectionHandle(featuredSectionHandle, pluginIndexParams) { + return new Promise((resolve, reject) => { + const params = this._getPluginIndexParams(pluginIndexParams); - Craft.sendApiRequest('GET', 'plugin-store/plugins-by-featured-section/' + featuredSectionHandle, { - cancelToken: cancelTokenSource.token, - params, - }) - .then((responseData) => { - resolve(responseData) - }) - .catch((error) => { - if (axios.isCancel(error)) { - // request cancelled - } else { - reject(error) - } - }) + Craft.sendApiRequest( + 'GET', + 'plugin-store/plugins-by-featured-section/' + featuredSectionHandle, + { + cancelToken: cancelTokenSource.token, + params, + } + ) + .then((responseData) => { + resolve(responseData); }) - }, + .catch((error) => { + if (axios.isCancel(error)) { + // request cancelled + } else { + reject(error); + } + }); + }); + }, - /** - * Get plugins by handles. - * - * @param pluginHandles - * @returns {AxiosPromise} - */ - getPluginsByHandles(pluginHandles) { - return new Promise((resolve, reject) => { - let pluginHandlesString + /** + * Get plugins by handles. + * + * @param pluginHandles + * @returns {AxiosPromise} + */ + getPluginsByHandles(pluginHandles) { + return new Promise((resolve, reject) => { + let pluginHandlesString; - if (Array.isArray(pluginHandles)) { - pluginHandlesString = pluginHandles.join(',') - } else { - pluginHandlesString = pluginHandles - } + if (Array.isArray(pluginHandles)) { + pluginHandlesString = pluginHandles.join(','); + } else { + pluginHandlesString = pluginHandles; + } - Craft.sendApiRequest('GET', 'plugin-store/plugins-by-handles', { - cancelToken: cancelTokenSource.token, - params: { - pluginHandles: pluginHandlesString - }, - }) - .then((responseData) => { - resolve(responseData) - }) - .catch((error) => { - if (axios.isCancel(error)) { - // request cancelled - } else { - reject(error) - } - }) + Craft.sendApiRequest('GET', 'plugin-store/plugins-by-handles', { + cancelToken: cancelTokenSource.token, + params: { + pluginHandles: pluginHandlesString, + }, + }) + .then((responseData) => { + resolve(responseData); }) - }, + .catch((error) => { + if (axios.isCancel(error)) { + // request cancelled + } else { + reject(error); + } + }); + }); + }, - /** - * Get plugins by IDs. - * - * @param pluginIds - * @returns {AxiosPromise} - */ - getPluginsByIds(pluginIds) { - return new Promise((resolve, reject) => { - let pluginIdsString + /** + * Get plugins by IDs. + * + * @param pluginIds + * @returns {AxiosPromise} + */ + getPluginsByIds(pluginIds) { + return new Promise((resolve, reject) => { + let pluginIdsString; - if (Array.isArray(pluginIds)) { - pluginIdsString = pluginIds.join(',') - } else { - pluginIdsString = pluginIds - } + if (Array.isArray(pluginIds)) { + pluginIdsString = pluginIds.join(','); + } else { + pluginIdsString = pluginIds; + } - Craft.sendApiRequest('GET', 'plugins', { - cancelToken: cancelTokenSource.token, - params: { - ids: pluginIdsString - }, - }) - .then((responseData) => { - resolve(responseData) - }) - .catch((error) => { - if (axios.isCancel(error)) { - // request cancelled - } else { - reject(error) - } - }) + Craft.sendApiRequest('GET', 'plugins', { + cancelToken: cancelTokenSource.token, + params: { + ids: pluginIdsString, + }, + }) + .then((responseData) => { + resolve(responseData); }) - }, + .catch((error) => { + if (axios.isCancel(error)) { + // request cancelled + } else { + reject(error); + } + }); + }); + }, - /** - * Search plugins. - * - * @param searchQuery - * @param pluginIndexParams - * @returns {AxiosPromise} - */ - searchPlugins(searchQuery, pluginIndexParams) { - return new Promise((resolve, reject) => { - const params = this._getPluginIndexParams(pluginIndexParams) - params.searchQuery = searchQuery + /** + * Search plugins. + * + * @param searchQuery + * @param pluginIndexParams + * @returns {AxiosPromise} + */ + searchPlugins(searchQuery, pluginIndexParams) { + return new Promise((resolve, reject) => { + const params = this._getPluginIndexParams(pluginIndexParams); + params.searchQuery = searchQuery; - Craft.sendApiRequest('GET', 'plugin-store/plugins', { - cancelToken: cancelTokenSource.token, - params, - }) - .then((responseData) => { - resolve(responseData) - }) - .catch((error) => { - if (axios.isCancel(error)) { - // request cancelled - } else { - reject(error) - } - }) + Craft.sendApiRequest('GET', 'plugin-store/plugins', { + cancelToken: cancelTokenSource.token, + params, + }) + .then((responseData) => { + resolve(responseData); }) - }, + .catch((error) => { + if (axios.isCancel(error)) { + // request cancelled + } else { + reject(error); + } + }); + }); + }, - /** - * Get plugin index params. - * - * @param limit - * @param offset - * @param orderBy - * @param direction - * @returns {{offset: *, limit: *, orderBy: *, direction: *}} - * @private - */ - _getPluginIndexParams({perPage, page, orderBy, direction}) { - if (!perPage) { - perPage = 96 - } + /** + * Get plugin index params. + * + * @param limit + * @param offset + * @param orderBy + * @param direction + * @returns {{offset: *, limit: *, orderBy: *, direction: *}} + * @private + */ + _getPluginIndexParams({perPage, page, orderBy, direction}) { + if (!perPage) { + perPage = 96; + } - if (!page) { - page = 1 - } + if (!page) { + page = 1; + } - return { - perPage, - page, - orderBy, - direction - } - }, -} + return { + perPage, + page, + orderBy, + direction, + }; + }, +}; diff --git a/src/web/assets/pluginstore/src/js/components/CategorySelector.vue b/src/web/assets/pluginstore/src/js/components/CategorySelector.vue index 0919538a039..4b24c29023f 100644 --- a/src/web/assets/pluginstore/src/js/components/CategorySelector.vue +++ b/src/web/assets/pluginstore/src/js/components/CategorySelector.vue @@ -1,145 +1,154 @@ diff --git a/src/web/assets/pluginstore/src/js/components/ChangelogRelease.vue b/src/web/assets/pluginstore/src/js/components/ChangelogRelease.vue index 0a14538a17a..22b42383056 100644 --- a/src/web/assets/pluginstore/src/js/components/ChangelogRelease.vue +++ b/src/web/assets/pluginstore/src/js/components/ChangelogRelease.vue @@ -1,104 +1,107 @@ diff --git a/src/web/assets/pluginstore/src/js/components/CopyPackage.vue b/src/web/assets/pluginstore/src/js/components/CopyPackage.vue index 4f7e7f74a31..bf84cdf94ff 100644 --- a/src/web/assets/pluginstore/src/js/components/CopyPackage.vue +++ b/src/web/assets/pluginstore/src/js/components/CopyPackage.vue @@ -1,53 +1,59 @@ \ No newline at end of file + } + diff --git a/src/web/assets/pluginstore/src/js/components/EditionBadge.vue b/src/web/assets/pluginstore/src/js/components/EditionBadge.vue index 9a4bc75e3c0..5b943817d70 100644 --- a/src/web/assets/pluginstore/src/js/components/EditionBadge.vue +++ b/src/web/assets/pluginstore/src/js/components/EditionBadge.vue @@ -1,55 +1,55 @@ diff --git a/src/web/assets/pluginstore/src/js/components/InfoHud.vue b/src/web/assets/pluginstore/src/js/components/InfoHud.vue index 9d34b40b9e4..003d35bae7c 100644 --- a/src/web/assets/pluginstore/src/js/components/InfoHud.vue +++ b/src/web/assets/pluginstore/src/js/components/InfoHud.vue @@ -1,47 +1,48 @@ diff --git a/src/web/assets/pluginstore/src/js/components/LicenseStatus.vue b/src/web/assets/pluginstore/src/js/components/LicenseStatus.vue index 7016a62f6dd..d9ac4c94e41 100644 --- a/src/web/assets/pluginstore/src/js/components/LicenseStatus.vue +++ b/src/web/assets/pluginstore/src/js/components/LicenseStatus.vue @@ -1,33 +1,40 @@ diff --git a/src/web/assets/pluginstore/src/js/components/PluginActions.vue b/src/web/assets/pluginstore/src/js/components/PluginActions.vue index dec4114c9f3..349ce0606db 100644 --- a/src/web/assets/pluginstore/src/js/components/PluginActions.vue +++ b/src/web/assets/pluginstore/src/js/components/PluginActions.vue @@ -1,254 +1,390 @@