From 34c78e909399a6268e7218d21c2955d1d11cf8d1 Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Fri, 29 Sep 2023 10:11:28 +0100 Subject: [PATCH] meta: run Prettier on existing files (#4713) --- .github/ISSUE_TEMPLATE/1-bug.yml | 13 +- .github/ISSUE_TEMPLATE/2-feature.yml | 13 +- .github/stale.yml | 4 +- .github/workflows/bundlers.yml | 50 +- .github/workflows/ci.yml | 20 +- .github/workflows/companion-deploy.yml | 12 +- .github/workflows/companion.yml | 8 +- .github/workflows/e2e.yml | 36 +- .github/workflows/linters.yml | 14 +- .github/workflows/lockile_check.yml | 7 +- .github/workflows/manual-cdn.yml | 7 +- .github/workflows/release-candidate.yml | 20 +- .github/workflows/release.yml | 49 +- .stylelintrc.json | 2 +- .yarnrc.yml | 4 +- docker-compose-dev.yml | 6 +- docker-compose.yml | 4 +- .../dashboard-aws-multipart/index.html | 2 +- e2e/clients/dashboard-aws/index.html | 2 +- e2e/clients/dashboard-compressor/index.html | 2 +- e2e/clients/dashboard-transloadit/index.html | 2 +- e2e/clients/dashboard-tus/index.html | 2 +- e2e/clients/dashboard-ui/index.html | 2 +- e2e/clients/dashboard-vue/App.vue | 6 +- e2e/clients/dashboard-vue/index.html | 2 +- e2e/clients/dashboard-xhr/index.html | 2 +- e2e/clients/react/index.html | 2 +- .../dashboard-aws-multipart.spec.ts | 188 ++++-- e2e/cypress/integration/dashboard-aws.spec.ts | 4 +- .../integration/dashboard-compressor.spec.ts | 10 +- .../integration/dashboard-transloadit.spec.ts | 405 ++++++++----- e2e/cypress/integration/dashboard-tus.spec.ts | 8 +- e2e/cypress/integration/dashboard-ui.spec.ts | 38 +- e2e/cypress/integration/dashboard-vue.spec.ts | 8 +- e2e/cypress/integration/dashboard-xhr.spec.ts | 15 +- e2e/cypress/integration/react.spec.ts | 24 +- e2e/cypress/integration/reusable-tests.ts | 14 +- e2e/cypress/support/createFakeFile.ts | 17 +- e2e/cypress/support/e2e.ts | 2 +- examples/angular-example/.eslintrc.json | 12 +- examples/angular-example/angular.json | 36 +- .../src/app/app.component.html | 533 +++++++++++++++--- .../angular-example/src/app/app.component.ts | 69 ++- .../angular-example/src/app/app.module.ts | 2 +- examples/angular-example/src/index.html | 20 +- examples/angular-example/src/main.ts | 5 +- examples/angular-example/tsconfig.app.json | 8 +- examples/angular-example/tsconfig.json | 5 +- examples/angular-example/tsconfig.spec.json | 9 +- examples/aws-companion/index.html | 6 +- examples/aws-nodejs/public/drag.html | 93 +-- examples/aws-nodejs/public/index.html | 184 ++++-- examples/aws-php/composer.json | 10 +- examples/aws-php/index.html | 8 +- examples/bundled/index.html | 8 +- examples/cdn-example/index.html | 36 +- examples/custom-provider/index.html | 6 +- examples/digitalocean-spaces/index.html | 9 +- examples/multiple-instances/index.html | 10 +- examples/node-xhr/index.html | 6 +- examples/php-xhr/index.html | 6 +- examples/python-xhr/index.html | 6 +- examples/react-example/index.html | 8 +- examples/react-native-expo/app.json | 4 +- examples/redux/index.html | 6 +- examples/svelte-example/public/global.css | 5 +- examples/svelte-example/public/index.html | 23 +- examples/svelte-example/tsconfig.json | 5 +- examples/transloadit-markdown-bin/index.html | 61 +- examples/transloadit/index.html | 112 ++-- .../uppy-with-companion/client/index.html | 31 +- examples/vue/index.html | 2 +- examples/vue/src/App.vue | 68 ++- examples/vue3/index.html | 2 +- examples/vue3/src/App.vue | 68 ++- examples/xhr-bundle/index.html | 10 +- packages/@uppy/angular/.eslintrc.json | 13 +- packages/@uppy/angular/angular.json | 5 +- .../projects/uppy/angular/.eslintrc.json | 12 +- .../projects/uppy/angular/ng-package.json | 2 +- .../projects/uppy/angular/src/public-api.ts | 20 +- .../projects/uppy/angular/tsconfig.lib.json | 4 +- .../projects/uppy/angular/tsconfig.spec.json | 9 +- packages/@uppy/angular/tsconfig.json | 9 +- packages/@uppy/audio/src/style.scss | 20 +- .../@uppy/aws-s3-multipart/types/chunk.d.ts | 10 +- .../@uppy/aws-s3-multipart/types/index.d.ts | 184 +++--- .../aws-s3-multipart/types/index.test-d.ts | 22 +- packages/@uppy/aws-s3/types/index.d.ts | 52 +- packages/@uppy/aws-s3/types/index.test-d.ts | 48 +- packages/@uppy/box/types/index.d.ts | 11 +- .../@uppy/companion-client/types/index.d.ts | 68 ++- .../infra/kube/companion/companion-kube.yaml | 86 +-- packages/@uppy/companion/nodemon.json | 24 +- .../companion/src/server/provider/error.d.ts | 5 +- packages/@uppy/companion/tsconfig.json | 4 +- packages/@uppy/compressor/types/index.d.ts | 4 +- packages/@uppy/core/src/_common.scss | 20 +- packages/@uppy/core/src/_utils.scss | 2 +- packages/@uppy/core/src/_variables.scss | 7 +- packages/@uppy/core/types/index.d.ts | 197 ++++--- packages/@uppy/core/types/index.test-d.ts | 36 +- .../src/components/FileCard/index.scss | 8 +- .../components/FileItem/Buttons/index.scss | 12 +- .../components/FileItem/FileInfo/index.scss | 5 +- .../FileItem/FilePreviewAndLink/index.scss | 2 +- .../src/components/FileItem/index.scss | 2 +- packages/@uppy/dashboard/src/style.scss | 133 +++-- packages/@uppy/dashboard/types/index.d.ts | 44 +- .../@uppy/dashboard/types/index.test-d.ts | 30 +- packages/@uppy/drop-target/types/index.d.ts | 8 +- packages/@uppy/dropbox/types/index.d.ts | 11 +- packages/@uppy/facebook/types/index.d.ts | 17 +- packages/@uppy/file-input/types/index.d.ts | 8 +- packages/@uppy/form/types/index.d.ts | 12 +- .../@uppy/golden-retriever/types/index.d.ts | 6 +- packages/@uppy/google-drive/types/index.d.ts | 17 +- .../@uppy/google-drive/types/index.test-d.ts | 5 +- packages/@uppy/image-editor/src/cropper.scss | 6 +- .../@uppy/image-editor/src/inputrange.scss | 37 +- packages/@uppy/image-editor/types/index.d.ts | 22 +- packages/@uppy/informer/src/style.scss | 2 +- packages/@uppy/instagram/types/index.d.ts | 15 +- packages/@uppy/onedrive/types/index.d.ts | 15 +- packages/@uppy/progress-bar/src/style.scss | 2 +- packages/@uppy/provider-views/src/style.scss | 30 +- .../uppy-ProviderBrowser-viewType--grid.scss | 6 +- .../uppy-ProviderBrowser-viewType--list.scss | 6 +- .../uppy-ProviderBrowserItem-checkbox.scss | 4 +- .../src/style/uppy-SearchProvider-input.scss | 5 +- .../@uppy/provider-views/types/index.d.ts | 14 +- packages/@uppy/react/src/DashboardModal.d.ts | 3 +- packages/@uppy/react/src/DragDrop.d.ts | 3 +- packages/@uppy/react/src/ProgressBar.d.ts | 3 +- packages/@uppy/react/src/StatusBar.d.ts | 3 +- packages/@uppy/react/types/index.test-d.tsx | 16 +- packages/@uppy/screen-capture/src/style.scss | 19 +- .../@uppy/screen-capture/types/index.d.ts | 32 +- .../screen-capture/types/index.test-d.ts | 12 +- packages/@uppy/status-bar/src/style.scss | 68 ++- packages/@uppy/status-bar/types/index.d.ts | 8 +- packages/@uppy/store-default/types/index.d.ts | 14 +- packages/@uppy/store-redux/types/index.d.ts | 14 +- packages/@uppy/svelte/tsconfig.json | 8 +- .../thumbnail-generator/types/index.d.ts | 9 +- packages/@uppy/transloadit/types/index.d.ts | 15 +- .../@uppy/transloadit/types/index.test-d.ts | 14 +- packages/@uppy/tus/types/index.d.ts | 53 +- packages/@uppy/unsplash/types/index.d.ts | 4 +- packages/@uppy/url/src/style.scss | 2 +- packages/@uppy/url/types/index.d.ts | 18 +- packages/@uppy/url/types/index.test-d.ts | 30 +- packages/@uppy/utils/src/microtip.scss | 100 ++-- packages/@uppy/utils/types/index.d.ts | 139 ++--- packages/@uppy/vue/types/dashboard-modal.d.ts | 22 +- packages/@uppy/vue/types/dashboard.d.ts | 20 +- packages/@uppy/vue/types/drag-drop.d.ts | 18 +- packages/@uppy/vue/types/file-input.d.ts | 18 +- packages/@uppy/vue/types/progress-bar.d.ts | 18 +- packages/@uppy/vue/types/status-bar.d.ts | 18 +- packages/@uppy/webcam/src/style.scss | 15 +- packages/@uppy/webcam/types/index.d.ts | 40 +- packages/@uppy/webcam/types/index.test-d.ts | 14 +- packages/@uppy/xhr-upload/types/index.d.ts | 38 +- packages/@uppy/zoom/types/index.d.ts | 11 +- packages/uppy/types/index.test-d.ts | 26 +- private/dev/dragdrop.html | 10 +- private/dev/index.html | 15 +- private/release/package.json | 28 +- private/vue-template-compiler/package.json | 8 +- tsconfig.json | 9 +- vitest.config.ts | 4 +- 172 files changed, 3024 insertions(+), 1771 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/1-bug.yml b/.github/ISSUE_TEMPLATE/1-bug.yml index 5e21abb62b..f18c15617f 100644 --- a/.github/ISSUE_TEMPLATE/1-bug.yml +++ b/.github/ISSUE_TEMPLATE/1-bug.yml @@ -7,9 +7,14 @@ body: attributes: label: Initial checklist options: - - label: I understand this is a bug report and questions should be posted in the [Community Forum](https://community.transloadit.com/) + - label: + I understand this is a bug report and questions should be posted in + the [Community Forum](https://community.transloadit.com/) required: true - - label: I searched [issues](https://github.com/transloadit/uppy/issues?q=is%3Aissue) and couldn’t find anything (or linked relevant results below) + - label: + I searched + [issues](https://github.com/transloadit/uppy/issues?q=is%3Aissue) + and couldn’t find anything (or linked relevant results below) required: true - type: input id: runnable-example @@ -28,7 +33,9 @@ body: id: steps-to-reproduce attributes: label: Steps to reproduce - description: How did this happen? Please provide a [minimal, reproducible example](https://stackoverflow.com/help/minimal-reproducible-example). + description: + How did this happen? Please provide a [minimal, reproducible + example](https://stackoverflow.com/help/minimal-reproducible-example). validations: required: true - type: textarea diff --git a/.github/ISSUE_TEMPLATE/2-feature.yml b/.github/ISSUE_TEMPLATE/2-feature.yml index d1cb06a3f4..b8f3d1b512 100644 --- a/.github/ISSUE_TEMPLATE/2-feature.yml +++ b/.github/ISSUE_TEMPLATE/2-feature.yml @@ -7,9 +7,14 @@ body: attributes: label: Initial checklist options: - - label: I understand this is a feature request and questions should be posted in the [Community Forum](https://community.transloadit.com/) + - label: + I understand this is a feature request and questions should be + posted in the [Community Forum](https://community.transloadit.com/) required: true - - label: I searched [issues](https://github.com/transloadit/uppy/issues?q=is%3Aissue) and couldn’t find anything (or linked relevant results below) + - label: + I searched + [issues](https://github.com/transloadit/uppy/issues?q=is%3Aissue) + and couldn’t find anything (or linked relevant results below) required: true - type: textarea id: problem @@ -29,6 +34,8 @@ body: id: alternatives attributes: label: Alternatives - description: What are the alternative solutions? Can this be solved in a different way? + description: + What are the alternative solutions? Can this be solved in a different + way? validations: required: true diff --git a/.github/stale.yml b/.github/stale.yml index b99cf78c7c..2eac2d3952 100644 --- a/.github/stale.yml +++ b/.github/stale.yml @@ -11,7 +11,7 @@ staleLabel: Stale # Comment to post when marking an issue as stale. Set to `false` to disable markComment: > This issue has been automatically marked as stale because it has not had - recent activity. If the issue is still relevant, please upvote or leave a comment. - Thank you for your contribution! + recent activity. If the issue is still relevant, please upvote or leave a + comment. Thank you for your contribution! # Comment to post when closing a stale issue. Set to `false` to disable closeComment: false diff --git a/.github/workflows/bundlers.yml b/.github/workflows/bundlers.yml index dc23bc7b42..bb1500f46d 100644 --- a/.github/workflows/bundlers.yml +++ b/.github/workflows/bundlers.yml @@ -2,10 +2,10 @@ name: Test different bundlers with Uppy on: push: - branches: [ main ] + branches: [main] pull_request: # We want all branches so we configure types to be the GH default again - types: [ opened, synchronize, reopened ] + types: [opened, synchronize, reopened] paths-ignore: - '**.md' - '**.d.ts' @@ -27,7 +27,8 @@ jobs: uses: actions/checkout@v3 - name: Get yarn cache directory path id: yarn-cache-dir-path - run: echo "dir=$(corepack yarn config get cacheFolder)" >> $GITHUB_OUTPUT + run: + echo "dir=$(corepack yarn config get cacheFolder)" >> $GITHUB_OUTPUT - uses: actions/cache@v3 id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) with: @@ -40,7 +41,10 @@ jobs: with: node-version: lts/* - name: Install dependencies - run: corepack yarn workspaces focus $(corepack yarn workspaces list --json | jq -r .name | awk '/^@uppy-example/{ next } { if ($0!="uppy.io") print $0 }') + run: + corepack yarn workspaces focus $(corepack yarn workspaces list --json + | jq -r .name | awk '/^@uppy-example/{ next } { if ($0!="uppy.io") + print $0 }') env: # https://docs.cypress.io/guides/references/advanced-installation#Skipping-installation CYPRESS_INSTALL_BINARY: 0 @@ -64,7 +68,9 @@ jobs: })(); EOF - name: Eject public packages from repo - run: mkdir /tmp/artifacts && corepack yarn workspaces foreach --no-private pack --install-if-needed -o /tmp/artifacts/%s-${{ github.sha }}.tgz + run: + mkdir /tmp/artifacts && corepack yarn workspaces foreach --no-private + pack --install-if-needed -o /tmp/artifacts/%s-${{ github.sha }}.tgz - name: Upload artifact if: success() uses: actions/upload-artifact@v3 @@ -85,18 +91,17 @@ jobs: with: path: /tmp/ - name: Extract tarball - run: tar -xzf /tmp/packages/uppy-${{ github.sha }}.tgz --strip-components 1 + run: + tar -xzf /tmp/packages/uppy-${{ github.sha }}.tgz --strip-components 1 - name: Add Rollup as a dev dependency run: >- - npm i --save-dev - @rollup/plugin-commonjs @rollup/plugin-node-resolve + npm i --save-dev @rollup/plugin-commonjs @rollup/plugin-node-resolve rollup@${{matrix.bundler-version}} - run: npx rollup --version - name: Create Rollup config file run: >- - echo ' - import cjs from "@rollup/plugin-commonjs"; - import { nodeResolve } from "@rollup/plugin-node-resolve"; + echo ' import cjs from "@rollup/plugin-commonjs"; import { nodeResolve + } from "@rollup/plugin-node-resolve"; export default { input: "./index.mjs", @@ -124,12 +129,16 @@ jobs: with: path: /tmp/ - name: Extract tarball - run: tar -xzf /tmp/packages/uppy-${{ github.sha }}.tgz --strip-components 1 + run: + tar -xzf /tmp/packages/uppy-${{ github.sha }}.tgz --strip-components 1 - name: Add Webpack as a dev dependency run: npm i --save-dev webpack-cli webpack@${{matrix.bundler-version}} - run: npx webpack --version - name: Create Webpack config file - run: echo 'module.exports={mode:"production",target:"web",entry:"./index.mjs"}' > webpack.config.js + run: + echo + 'module.exports={mode:"production",target:"web",entry:"./index.mjs"}' + > webpack.config.js - name: Bundle run: npx webpack @@ -146,7 +155,8 @@ jobs: with: path: /tmp/ - name: Extract tarball - run: tar -xzf /tmp/packages/uppy-${{ github.sha }}.tgz --strip-components 1 + run: + tar -xzf /tmp/packages/uppy-${{ github.sha }}.tgz --strip-components 1 - name: Fix package.json to work with Parcel run: | node <<'EOF' @@ -175,12 +185,15 @@ jobs: with: path: /tmp/ - name: Extract tarball - run: tar -xzf /tmp/packages/uppy-${{ github.sha }}.tgz --strip-components 1 + run: + tar -xzf /tmp/packages/uppy-${{ github.sha }}.tgz --strip-components 1 - name: Add Vite as a dev dependency run: npm i --save-dev vite@${{matrix.bundler-version}} - run: npx vite --version - name: Create index.html - run: echo '' > index.html + run: + echo '' > index.html - name: Bundle run: npx vite build @@ -197,11 +210,12 @@ jobs: with: path: /tmp/ - name: Extract tarball - run: tar -xzf /tmp/packages/uppy-${{ github.sha }}.tgz --strip-components 1 + run: + tar -xzf /tmp/packages/uppy-${{ github.sha }}.tgz --strip-components 1 - name: Add ESBuild as a dev dependency run: npm i --save-dev esbuild@${{matrix.bundler-version}} - run: npx esbuild --version - name: Bundle run: npx esbuild index.mjs --bundle --outfile=/dev/null - + # Browserify: doesn't support ESM. diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9b25e74b53..fbb46ee309 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,7 +2,7 @@ name: CI on: push: - branches: [ main ] + branches: [main] paths-ignore: - '**.md' - 'assets/**' @@ -14,7 +14,7 @@ on: - '!.github/workflows/ci.yml' pull_request: # We want all branches so we configure types to be the GH default again - types: [ opened, synchronize, reopened ] + types: [opened, synchronize, reopened] paths-ignore: - '**.md' - 'assets/**' @@ -41,7 +41,8 @@ jobs: uses: actions/checkout@v3 - name: Get yarn cache directory path id: yarn-cache-dir-path - run: echo "dir=$(corepack yarn config get cacheFolder)" >> $GITHUB_OUTPUT + run: + echo "dir=$(corepack yarn config get cacheFolder)" >> $GITHUB_OUTPUT - uses: actions/cache@v3 id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) @@ -55,7 +56,10 @@ jobs: with: node-version: ${{matrix.node-version}} - name: Install dependencies - run: corepack yarn workspaces focus $(corepack yarn workspaces list --json | jq -r .name | awk '/^@uppy-example/{ next } { if ($0!="uppy.io") print $0 }') + run: + corepack yarn workspaces focus $(corepack yarn workspaces list --json + | jq -r .name | awk '/^@uppy-example/{ next } { if ($0!="uppy.io") + print $0 }') env: # https://docs.cypress.io/guides/references/advanced-installation#Skipping-installation CYPRESS_INSTALL_BINARY: 0 @@ -70,7 +74,8 @@ jobs: uses: actions/checkout@v3 - name: Get yarn cache directory path id: yarn-cache-dir-path - run: echo "dir=$(corepack yarn config get cacheFolder)" >> $GITHUB_OUTPUT + run: + echo "dir=$(corepack yarn config get cacheFolder)" >> $GITHUB_OUTPUT - uses: actions/cache@v3 id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) @@ -84,7 +89,10 @@ jobs: with: node-version: lts/* - name: Install dependencies - run: corepack yarn workspaces focus $(corepack yarn workspaces list --json | jq -r .name | awk '/^@uppy-example/{ next } { if ($0!="uppy.io") print $0 }') + run: + corepack yarn workspaces focus $(corepack yarn workspaces list --json + | jq -r .name | awk '/^@uppy-example/{ next } { if ($0!="uppy.io") + print $0 }') env: # https://docs.cypress.io/guides/references/advanced-installation#Skipping-installation CYPRESS_INSTALL_BINARY: 0 diff --git a/.github/workflows/companion-deploy.yml b/.github/workflows/companion-deploy.yml index a8c06b6d5b..49b0bb0327 100644 --- a/.github/workflows/companion-deploy.yml +++ b/.github/workflows/companion-deploy.yml @@ -5,7 +5,7 @@ name: Companion Edge Deploy on: push: - branches: [ 'main' ] + branches: ['main'] paths: - yarn.lock - 'packages/@uppy/companion/**' @@ -22,9 +22,15 @@ jobs: - name: Checkout sources uses: actions/checkout@v3 - name: Set SHA commit in version - run: (cd packages/@uppy/companion && node -e 'const pkg=require("./package.json");pkg.version+="+${{ github.sha }}";fs.writeFileSync("package.json",JSON.stringify(pkg, undefined, 2)+"\n")') + run: + (cd packages/@uppy/companion && node -e 'const + pkg=require("./package.json");pkg.version+="+${{ github.sha + }}";fs.writeFileSync("package.json",JSON.stringify(pkg, undefined, + 2)+"\n")') - name: Create Companion tarball - run: corepack yarn workspace @uppy/companion pack --install-if-needed -o /tmp/companion-${{ github.sha }}.tar.gz + run: + corepack yarn workspace @uppy/companion pack --install-if-needed -o + /tmp/companion-${{ github.sha }}.tar.gz - name: Upload artifact if: success() uses: actions/upload-artifact@v3 diff --git a/.github/workflows/companion.yml b/.github/workflows/companion.yml index 94e6841877..58834603a4 100644 --- a/.github/workflows/companion.yml +++ b/.github/workflows/companion.yml @@ -1,14 +1,14 @@ name: Companion on: push: - branches: [ main ] + branches: [main] paths: - yarn.lock - 'packages/@uppy/companion/**' - '.github/workflows/companion.yml' pull_request: # We want all branches so we configure types to be the GH default again - types: [ opened, synchronize, reopened ] + types: [opened, synchronize, reopened] paths: - yarn.lock - 'packages/@uppy/companion/**' @@ -29,7 +29,8 @@ jobs: uses: actions/checkout@v3 - name: Get yarn cache directory path id: yarn-cache-dir-path - run: echo "dir=$(corepack yarn config get cacheFolder)" >> $GITHUB_OUTPUT + run: + echo "dir=$(corepack yarn config get cacheFolder)" >> $GITHUB_OUTPUT - uses: actions/cache@v3 id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) @@ -48,4 +49,3 @@ jobs: run: corepack yarn run test:companion - name: Run type checks in focused workspace run: corepack yarn run build:companion - diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index d7103de1f8..4ead483a4e 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -1,7 +1,7 @@ name: End-to-end tests on: push: - branches: [ main ] + branches: [main] paths-ignore: - '**.md' - '**.d.ts' @@ -11,7 +11,7 @@ on: - '.github/**' - '!.github/workflows/e2e.yml' pull_request_target: - types: [ opened, synchronize, reopened, labeled ] + types: [opened, synchronize, reopened, labeled] paths-ignore: - '**.md' - '**.d.ts' @@ -20,7 +20,7 @@ on: - 'website/**' - '.github/**' pull_request: - types: [ opened, synchronize, reopened ] + types: [opened, synchronize, reopened] paths: - .github/workflows/e2e.yml @@ -31,7 +31,12 @@ env: jobs: e2e: - if: ${{ !github.event.pull_request || (contains(github.event.pull_request.labels.*.name, 'safe to test') && github.event.pull_request.state == 'open') || (github.event.pull_request.head.repo.full_name == github.repository && github.event.event_name != 'labeled') }} + if: + ${{ !github.event.pull_request || + (contains(github.event.pull_request.labels.*.name, 'safe to test') && + github.event.pull_request.state == 'open') || + (github.event.pull_request.head.repo.full_name == github.repository && + github.event.event_name != 'labeled') }} name: Browser tests runs-on: ubuntu-latest steps: @@ -41,7 +46,8 @@ jobs: ref: ${{ github.event.pull_request.head.sha || github.sha }} - name: Get yarn cache directory path id: yarn-cache-dir-path - run: echo "dir=$(corepack yarn config get cacheFolder)" >> $GITHUB_OUTPUT + run: + echo "dir=$(corepack yarn config get cacheFolder)" >> $GITHUB_OUTPUT - uses: actions/cache@v3 id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) @@ -105,14 +111,19 @@ jobs: e2e/cypress/screenshots/ - name: Remove 'pending end-to-end tests' label # Remove the 'pending end-to-end tests' label if tests ran successfully - if: github.event.pull_request && contains(github.event.pull_request.labels.*.name, 'pending end-to-end tests') + if: + github.event.pull_request && + contains(github.event.pull_request.labels.*.name, 'pending end-to-end + tests') run: gh pr edit "$NUMBER" --remove-label 'pending end-to-end tests' env: NUMBER: ${{ github.event.pull_request.number }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Remove 'safe to test' label # Remove the 'safe to test' label to ensure next commit needs approval before re-running this. - if: always() && github.event.pull_request && contains(github.event.pull_request.labels.*.name, 'safe to test') + if: + always() && github.event.pull_request && + contains(github.event.pull_request.labels.*.name, 'safe to test') run: gh pr edit "$NUMBER" --remove-label 'safe to test' env: NUMBER: ${{ github.event.pull_request.number }} @@ -121,11 +132,18 @@ jobs: # Add the 'pending end-to-end tests' label for PRs that come from forks. # For those PRs, we want to review the code before running e2e tests. # See https://securitylab.github.com/research/github-actions-preventing-pwn-requests/. - if: github.event.pull_request.state == 'open' && github.event.pull_request.head.repo.full_name != github.repository && !contains(github.event.pull_request.labels.*.name, 'safe to test') && !contains(github.event.pull_request.labels.*.name, 'pending end-to-end tests') + if: + github.event.pull_request.state == 'open' && + github.event.pull_request.head.repo.full_name != github.repository && + !contains(github.event.pull_request.labels.*.name, 'safe to test') && + !contains(github.event.pull_request.labels.*.name, 'pending end-to-end + tests') runs-on: ubuntu-latest steps: - name: Add label env: NUMBER: ${{ github.event.pull_request.number }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: gh pr edit "$NUMBER" --repo ${{ github.repository }} --add-label 'pending end-to-end tests' + run: + gh pr edit "$NUMBER" --repo ${{ github.repository }} --add-label + 'pending end-to-end tests' diff --git a/.github/workflows/linters.yml b/.github/workflows/linters.yml index 885cd17eb9..aa4cfad83c 100644 --- a/.github/workflows/linters.yml +++ b/.github/workflows/linters.yml @@ -2,14 +2,14 @@ name: Linters on: push: - branches: [ main ] + branches: [main] paths-ignore: - '.github/**' - '!.github/workflows/linters.yml' - '!.github/CONTRIBUTING.md' pull_request: # We want all branches so we configure types to be the GH default again - types: [ opened, synchronize, reopened ] + types: [opened, synchronize, reopened] paths-ignore: - '.github/**' - '!.github/workflows/linters.yml' @@ -27,7 +27,8 @@ jobs: uses: actions/checkout@v3 - name: Get yarn cache directory path id: yarn-cache-dir-path - run: echo "dir=$(corepack yarn config get cacheFolder)" >> $GITHUB_OUTPUT + run: + echo "dir=$(corepack yarn config get cacheFolder)" >> $GITHUB_OUTPUT - uses: actions/cache@v3 id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) @@ -42,7 +43,9 @@ jobs: node-version: lts/* - name: Install dependencies # List all projects that use a custom ESLint config: - run: corepack yarn workspaces focus @uppy/angular @uppy-example/angular @uppy-example/react-native-expo @uppy/react-native @uppy-dev/build + run: + corepack yarn workspaces focus @uppy/angular @uppy-example/angular + @uppy-example/react-native-expo @uppy/react-native @uppy-dev/build - name: Run linter run: corepack yarn run lint @@ -54,7 +57,8 @@ jobs: uses: actions/checkout@v3 - name: Get yarn cache directory path id: yarn-cache-dir-path - run: echo "dir=$(corepack yarn config get cacheFolder)" >> $GITHUB_OUTPUT + run: + echo "dir=$(corepack yarn config get cacheFolder)" >> $GITHUB_OUTPUT - uses: actions/cache@v3 id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) diff --git a/.github/workflows/lockile_check.yml b/.github/workflows/lockile_check.yml index af5c94d9f4..32ea46745f 100644 --- a/.github/workflows/lockile_check.yml +++ b/.github/workflows/lockile_check.yml @@ -2,12 +2,12 @@ name: Lockfile checks on: push: - branches: [ main ] + branches: [main] paths: - yarn.lock pull_request: # We want all branches so we configure types to be the GH default again - types: [ opened, synchronize, reopened ] + types: [opened, synchronize, reopened] paths: - yarn.lock @@ -23,7 +23,8 @@ jobs: uses: actions/checkout@v3 - name: Get yarn cache directory path id: yarn-cache-dir-path - run: echo "dir=$(corepack yarn config get cacheFolder)" >> $GITHUB_OUTPUT + run: + echo "dir=$(corepack yarn config get cacheFolder)" >> $GITHUB_OUTPUT - uses: actions/cache@v3 id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) diff --git a/.github/workflows/manual-cdn.yml b/.github/workflows/manual-cdn.yml index c95ab5718b..f0977f8508 100644 --- a/.github/workflows/manual-cdn.yml +++ b/.github/workflows/manual-cdn.yml @@ -3,9 +3,9 @@ on: workflow_dispatch: inputs: name: - description: "Package to upload" + description: 'Package to upload' required: true - default: "uppy" + default: 'uppy' env: YARN_ENABLE_GLOBAL_CACHE: false @@ -18,7 +18,8 @@ jobs: uses: actions/checkout@v3 - name: Get yarn cache directory path id: yarn-cache-dir-path - run: echo "dir=$(corepack yarn config get cacheFolder)" >> $GITHUB_OUTPUT + run: + echo "dir=$(corepack yarn config get cacheFolder)" >> $GITHUB_OUTPUT - uses: actions/cache@v3 id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) diff --git a/.github/workflows/release-candidate.yml b/.github/workflows/release-candidate.yml index d5f2bfa2b9..832765f8da 100644 --- a/.github/workflows/release-candidate.yml +++ b/.github/workflows/release-candidate.yml @@ -23,7 +23,8 @@ jobs: git rebase FETCH_HEAD - name: Get yarn cache directory path id: yarn-cache-dir-path - run: echo "dir=$(corepack yarn config get cacheFolder)" >> $GITHUB_OUTPUT + run: + echo "dir=$(corepack yarn config get cacheFolder)" >> $GITHUB_OUTPUT - uses: actions/cache@v3 id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) @@ -44,11 +45,17 @@ jobs: - name: Bump candidate packages version run: corepack yarn version apply --all --json | jq -s > releases.json - name: Prepare changelog - run: corepack yarn workspace @uppy-dev/release update-changelogs releases.json | xargs git add + run: + corepack yarn workspace @uppy-dev/release update-changelogs + releases.json | xargs git add - name: Update contributors table - run: corepack yarn contributors:save && corepack yarn remark -foq README.md && git add README.md + run: + corepack yarn contributors:save && corepack yarn remark -foq README.md + && git add README.md - name: Update CDN URLs - run: corepack yarn workspace @uppy-dev/release update-version-URLs | xargs git add + run: + corepack yarn workspace @uppy-dev/release update-version-URLs | xargs + git add - name: Stage changes and remove temp files run: | git rm -rf .yarn/versions @@ -75,7 +82,10 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Assign to the releaser - run: echo '{"assignees":[${{ toJSON(github.actor) }}]}' | gh api repos/${{ github.repository }}/issues/${{ steps.pr_opening.outputs.pr_number }}/assignees --input - + run: + echo '{"assignees":[${{ toJSON(github.actor) }}]}' | gh api repos/${{ + github.repository }}/issues/${{ steps.pr_opening.outputs.pr_number + }}/assignees --input - env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Enable Release workflow diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3f3d25d963..31e872b231 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,9 +9,13 @@ env: jobs: release: name: Publish releases - if: ${{ github.event.review.state == 'approved' && github.event.sender.login == github.event.pull_request.assignee.login && github.event.pull_request.head.ref == 'release-candidate' }} + if: + ${{ github.event.review.state == 'approved' && github.event.sender.login + == github.event.pull_request.assignee.login && + github.event.pull_request.head.ref == 'release-candidate' }} outputs: - companionWasReleased: ${{ steps.checkIfCompanionWasReleased.outputs.version }} + companionWasReleased: + ${{ steps.checkIfCompanionWasReleased.outputs.version }} runs-on: ubuntu-latest steps: - name: Checkout sources @@ -20,7 +24,8 @@ jobs: fetch-depth: 2 - name: Get yarn cache directory path id: yarn-cache-dir-path - run: echo "dir=$(corepack yarn config get cacheFolder)" >> $GITHUB_OUTPUT + run: + echo "dir=$(corepack yarn config get cacheFolder)" >> $GITHUB_OUTPUT - uses: actions/cache@v3 id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) @@ -39,7 +44,10 @@ jobs: # https://docs.cypress.io/guides/references/advanced-installation#Skipping-installation CYPRESS_INSTALL_BINARY: 0 - name: Get CHANGELOG diff - run: git --no-pager diff HEAD^ -- CHANGELOG.md | awk '{ if( substr($0,0,1) == "+" && $1 != "+##" && $1 != "+Released:" && $1 != "+++" ) { print substr($0,2) } }' > CHANGELOG.diff.md + run: + git --no-pager diff HEAD^ -- CHANGELOG.md | awk '{ if( substr($0,0,1) + == "+" && $1 != "+##" && $1 != "+Released:" && $1 != "+++" ) { print + substr($0,2) } }' > CHANGELOG.diff.md - name: Copy README for `uppy` package run: cp README.md packages/uppy/. - name: Build before publishing @@ -47,7 +55,9 @@ jobs: - name: Hack to allow the publish of the Angular package run: corepack yarn workspace @uppy/angular prepublishOnly - name: Publish to the npm registry - run: corepack yarn workspaces foreach --no-private npm publish --access public --tolerate-republish + run: + corepack yarn workspaces foreach --no-private npm publish --access + public --tolerate-republish env: YARN_NPM_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - name: Merge PR @@ -68,9 +78,13 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Get Uppy version number id: uppyVersion - run: jq -r '"version="+.version' < packages/uppy/package.json >> $GITHUB_OUTPUT + run: + jq -r '"version="+.version' < packages/uppy/package.json >> + $GITHUB_OUTPUT - name: Create GitHub release - run: gh release create uppy@${{ steps.uppyVersion.outputs.version }} -t "Uppy ${{ steps.uppyVersion.outputs.version }}" -F CHANGELOG.diff.md + run: + gh release create uppy@${{ steps.uppyVersion.outputs.version }} -t + "Uppy ${{ steps.uppyVersion.outputs.version }}" -F CHANGELOG.diff.md env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Upload `uppy` to CDN @@ -79,19 +93,28 @@ jobs: EDGLY_KEY: ${{secrets.EDGLY_KEY}} EDGLY_SECRET: ${{secrets.EDGLY_SECRET}} - name: Upload `@uppy/locales` to CDN if it was released - run: git diff --exit-code --quiet HEAD^ -- packages/@uppy/locales/package.json ||corepack yarn run uploadcdn @uppy/locales + run: + git diff --exit-code --quiet HEAD^ -- + packages/@uppy/locales/package.json ||corepack yarn run uploadcdn + @uppy/locales env: EDGLY_KEY: ${{secrets.EDGLY_KEY}} EDGLY_SECRET: ${{secrets.EDGLY_SECRET}} - name: Check if Companion was released id: checkIfCompanionWasReleased - run: git diff --exit-code --quiet HEAD^ -- packages/@uppy/companion/package.json || echo "version=$(jq -r .version < packages/@uppy/companion/package.json)" >> $GITHUB_OUTPUT + run: + git diff --exit-code --quiet HEAD^ -- + packages/@uppy/companion/package.json || echo "version=$(jq -r + .version < packages/@uppy/companion/package.json)" >> $GITHUB_OUTPUT - name: Remove release-candidate branch - run: gh api -X DELETE repos/${{ github.repository }}/git/refs/heads/release-candidate || echo "Already deleted" + run: + gh api -X DELETE repos/${{ github.repository + }}/git/refs/heads/release-candidate || echo "Already deleted" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Remove release branch - run: gh api -X DELETE repos/${{ github.repository }}/git/refs/heads/release + run: + gh api -X DELETE repos/${{ github.repository }}/git/refs/heads/release env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Disable Release workflow @@ -100,7 +123,9 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: In case of failure if: ${{ failure() }} - run: gh pr comment ${{ github.event.pull_request.number }} --body "Release job failed, please take action." + run: + gh pr comment ${{ github.event.pull_request.number }} --body "Release + job failed, please take action." env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.stylelintrc.json b/.stylelintrc.json index 264693460e..3d05d89b95 100644 --- a/.stylelintrc.json +++ b/.stylelintrc.json @@ -9,4 +9,4 @@ "scss/at-rule-no-unknown": true }, "defaultSeverity": "warning" -} \ No newline at end of file +} diff --git a/.yarnrc.yml b/.yarnrc.yml index 7745cf9592..1942f7cc94 100644 --- a/.yarnrc.yml +++ b/.yarnrc.yml @@ -10,6 +10,6 @@ nodeLinker: node-modules plugins: - path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs - spec: "@yarnpkg/plugin-workspace-tools" + spec: '@yarnpkg/plugin-workspace-tools' - path: .yarn/plugins/@yarnpkg/plugin-version.cjs - spec: "@yarnpkg/plugin-version" + spec: '@yarnpkg/plugin-version' diff --git a/docker-compose-dev.yml b/docker-compose-dev.yml index 2e6f20226e..0ee79ae764 100644 --- a/docker-compose-dev.yml +++ b/docker-compose-dev.yml @@ -13,7 +13,7 @@ services: - /app/node_modules - /mnt/uppy-server-data:/mnt/uppy-server-data ports: - - "3020:3020" - command: "/app/src/standalone/start-server.js --config nodemon.json" + - '3020:3020' + command: '/app/src/standalone/start-server.js --config nodemon.json' env_file: - - .env + - .env diff --git a/docker-compose.yml b/docker-compose.yml index 3dbf23a12a..fd6dbe4e03 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -10,6 +10,6 @@ services: - /app/node_modules - /mnt/uppy-server-data:/mnt/uppy-server-data ports: - - "3020:3020" + - '3020:3020' env_file: - - .env + - .env diff --git a/e2e/clients/dashboard-aws-multipart/index.html b/e2e/clients/dashboard-aws-multipart/index.html index ff8fd1dd5e..9ccaf9e3bd 100644 --- a/e2e/clients/dashboard-aws-multipart/index.html +++ b/e2e/clients/dashboard-aws-multipart/index.html @@ -1,7 +1,7 @@ - + dashboard-aws-multipart diff --git a/e2e/clients/dashboard-aws/index.html b/e2e/clients/dashboard-aws/index.html index 4b14700fda..27ecd5736c 100644 --- a/e2e/clients/dashboard-aws/index.html +++ b/e2e/clients/dashboard-aws/index.html @@ -1,7 +1,7 @@ - + dashboard-aws diff --git a/e2e/clients/dashboard-compressor/index.html b/e2e/clients/dashboard-compressor/index.html index 2896829cb1..849e8502c2 100644 --- a/e2e/clients/dashboard-compressor/index.html +++ b/e2e/clients/dashboard-compressor/index.html @@ -1,7 +1,7 @@ - + dashboard-compressor diff --git a/e2e/clients/dashboard-transloadit/index.html b/e2e/clients/dashboard-transloadit/index.html index f36fb8dbb9..e05e15c945 100644 --- a/e2e/clients/dashboard-transloadit/index.html +++ b/e2e/clients/dashboard-transloadit/index.html @@ -1,7 +1,7 @@ - + dashboard-transloadit diff --git a/e2e/clients/dashboard-tus/index.html b/e2e/clients/dashboard-tus/index.html index 9ee4db8d4d..235833541c 100644 --- a/e2e/clients/dashboard-tus/index.html +++ b/e2e/clients/dashboard-tus/index.html @@ -1,7 +1,7 @@ - + dashboard-tus diff --git a/e2e/clients/dashboard-ui/index.html b/e2e/clients/dashboard-ui/index.html index e76c6332be..9beff94caa 100644 --- a/e2e/clients/dashboard-ui/index.html +++ b/e2e/clients/dashboard-ui/index.html @@ -1,7 +1,7 @@ - + dashboard-ui diff --git a/e2e/clients/dashboard-vue/App.vue b/e2e/clients/dashboard-vue/App.vue index 3fa462b179..96fad8b781 100644 --- a/e2e/clients/dashboard-vue/App.vue +++ b/e2e/clients/dashboard-vue/App.vue @@ -13,10 +13,10 @@ export default { Dashboard, }, computed: { - uppy: () => new Uppy() + uppy: () => new Uppy(), }, } - - + + diff --git a/e2e/clients/dashboard-vue/index.html b/e2e/clients/dashboard-vue/index.html index 248d7a0407..d4254a3b90 100644 --- a/e2e/clients/dashboard-vue/index.html +++ b/e2e/clients/dashboard-vue/index.html @@ -1,7 +1,7 @@ - + dashboard-vue diff --git a/e2e/clients/dashboard-xhr/index.html b/e2e/clients/dashboard-xhr/index.html index 48832c7ffe..83a81c643d 100644 --- a/e2e/clients/dashboard-xhr/index.html +++ b/e2e/clients/dashboard-xhr/index.html @@ -1,7 +1,7 @@ - + dashboard-xhr diff --git a/e2e/clients/react/index.html b/e2e/clients/react/index.html index 710c490e16..315cd8ce91 100644 --- a/e2e/clients/react/index.html +++ b/e2e/clients/react/index.html @@ -1,7 +1,7 @@ - + dashboard-react diff --git a/e2e/cypress/integration/dashboard-aws-multipart.spec.ts b/e2e/cypress/integration/dashboard-aws-multipart.spec.ts index cc1e57f75f..70f384a999 100644 --- a/e2e/cypress/integration/dashboard-aws-multipart.spec.ts +++ b/e2e/cypress/integration/dashboard-aws-multipart.spec.ts @@ -8,7 +8,9 @@ describe('Dashboard with @uppy/aws-s3-multipart', () => { }) it('should upload cat image successfully', () => { - cy.get('@file-input').selectFile('cypress/fixtures/images/cat.jpg', { force:true }) + cy.get('@file-input').selectFile('cypress/fixtures/images/cat.jpg', { + force: true, + }) cy.get('.uppy-StatusBar-actionBtn--upload').click() cy.wait(['@post', '@get', '@put']) @@ -16,7 +18,9 @@ describe('Dashboard with @uppy/aws-s3-multipart', () => { }) it('should upload Russian poem image successfully', () => { const fileName = '١٠ كم мест для Нью-Йорке.pdf' - cy.get('@file-input').selectFile(`cypress/fixtures/images/${fileName}`, { force:true }) + cy.get('@file-input').selectFile(`cypress/fixtures/images/${fileName}`, { + force: true, + }) cy.get('.uppy-StatusBar-actionBtn--upload').click() cy.wait(['@post', '@get', '@put']) @@ -24,88 +28,174 @@ describe('Dashboard with @uppy/aws-s3-multipart', () => { cy.get('.uppy-StatusBar-statusPrimary').should('contain', 'Complete') }) - it('should handle retry request gracefully', () => { - cy.get('@file-input').selectFile('cypress/fixtures/images/cat.jpg', { force:true }) + it('should handle retry request gracefully', () => { + cy.get('@file-input').selectFile('cypress/fixtures/images/cat.jpg', { + force: true, + }) - cy.intercept('POST', '/s3/multipart', { forceNetworkError: true, times: 1 }).as('createMultipartUpload-fails') + cy.intercept('POST', '/s3/multipart', { + forceNetworkError: true, + times: 1, + }).as('createMultipartUpload-fails') cy.get('.uppy-StatusBar-actionBtn--upload').click() cy.wait(['@createMultipartUpload-fails']) cy.get('.uppy-StatusBar-statusPrimary').should('contain', 'Upload failed') - cy.intercept('POST', '/s3/multipart', { statusCode: 200, times: 1, body: JSON.stringify({ key:'mocked-key-attempt1', uploadId:'mocked-uploadId-attempt1' }) }).as('createMultipartUpload-attempt1') - cy.intercept('GET', '/s3/multipart/mocked-uploadId-attempt1/1?key=mocked-key-attempt1', { forceNetworkError: true }).as('signPart-fails') - cy.intercept('DELETE', '/s3/multipart/mocked-uploadId-attempt1?key=mocked-key-attempt1', { statusCode: 200, body: '{}' }).as('abortAttempt-1') + cy.intercept('POST', '/s3/multipart', { + statusCode: 200, + times: 1, + body: JSON.stringify({ + key: 'mocked-key-attempt1', + uploadId: 'mocked-uploadId-attempt1', + }), + }).as('createMultipartUpload-attempt1') + cy.intercept( + 'GET', + '/s3/multipart/mocked-uploadId-attempt1/1?key=mocked-key-attempt1', + { forceNetworkError: true }, + ).as('signPart-fails') + cy.intercept( + 'DELETE', + '/s3/multipart/mocked-uploadId-attempt1?key=mocked-key-attempt1', + { statusCode: 200, body: '{}' }, + ).as('abortAttempt-1') cy.get('.uppy-StatusBar-actions > .uppy-c-btn').click() - cy.wait(['@createMultipartUpload-attempt1', '@signPart-fails', '@abortAttempt-1']) + cy.wait([ + '@createMultipartUpload-attempt1', + '@signPart-fails', + '@abortAttempt-1', + ]) cy.get('.uppy-StatusBar-statusPrimary').should('contain', 'Upload failed') - cy.intercept('POST', '/s3/multipart', { statusCode: 200, times: 1, body: JSON.stringify({ key:'mocked-key-attempt2', uploadId:'mocked-uploadId-attempt2' }) }).as('createMultipartUpload-attempt2') - cy.intercept('GET', '/s3/multipart/mocked-uploadId-attempt2/1?key=mocked-key-attempt2', { + cy.intercept('POST', '/s3/multipart', { statusCode: 200, - headers: { - ETag: 'W/"222-GXE2wLoMKDihw3wxZFH1APdUjHM"', + times: 1, + body: JSON.stringify({ + key: 'mocked-key-attempt2', + uploadId: 'mocked-uploadId-attempt2', + }), + }).as('createMultipartUpload-attempt2') + cy.intercept( + 'GET', + '/s3/multipart/mocked-uploadId-attempt2/1?key=mocked-key-attempt2', + { + statusCode: 200, + headers: { + ETag: 'W/"222-GXE2wLoMKDihw3wxZFH1APdUjHM"', + }, + body: JSON.stringify({ url: '/put-fail', expires: 8 }), }, - body: JSON.stringify({ url:'/put-fail', expires:8 }), - }).as('signPart-toFail') - cy.intercept('DELETE', '/s3/multipart/mocked-uploadId-attempt2?key=mocked-key-attempt2', { statusCode: 200, body: '{}' }).as('abortAttempt-2') - cy.intercept('PUT', '/put-fail', { forceNetworkError: true }).as('put-fails') + ).as('signPart-toFail') + cy.intercept( + 'DELETE', + '/s3/multipart/mocked-uploadId-attempt2?key=mocked-key-attempt2', + { statusCode: 200, body: '{}' }, + ).as('abortAttempt-2') + cy.intercept('PUT', '/put-fail', { forceNetworkError: true }).as( + 'put-fails', + ) cy.get('.uppy-StatusBar-actions > .uppy-c-btn').click() - cy.wait(['@createMultipartUpload-attempt2', '@signPart-toFail', ...Array(5).fill('@put-fails'), '@abortAttempt-2']) + cy.wait([ + '@createMultipartUpload-attempt2', + '@signPart-toFail', + ...Array(5).fill('@put-fails'), + '@abortAttempt-2', + ]) cy.get('.uppy-StatusBar-statusPrimary').should('contain', 'Upload failed') - cy.intercept('GET', '/s3/multipart/mocked-uploadId-attempt2/1?key=mocked-key-attempt2', { - statusCode: 200, - headers: { - ETag: 'ETag-attempt2', + cy.intercept( + 'GET', + '/s3/multipart/mocked-uploadId-attempt2/1?key=mocked-key-attempt2', + { + statusCode: 200, + headers: { + ETag: 'ETag-attempt2', + }, + body: JSON.stringify({ url: '/put-success-attempt2', expires: 8 }), }, - body: JSON.stringify({ url:'/put-success-attempt2', expires:8 }), - }).as('signPart-attempt2') + ).as('signPart-attempt2') cy.intercept('PUT', '/put-success-attempt2', { statusCode: 200, headers: { ETag: 'ETag-attempt2', }, }).as('put-attempt2') - cy.intercept('POST', '/s3/multipart/mocked-uploadId-attempt2/complete?key=mocked-key-attempt2', { forceNetworkError: true }).as('completeMultipartUpload-fails') + cy.intercept( + 'POST', + '/s3/multipart/mocked-uploadId-attempt2/complete?key=mocked-key-attempt2', + { forceNetworkError: true }, + ).as('completeMultipartUpload-fails') cy.get('.uppy-StatusBar-actions > .uppy-c-btn').click() - cy.wait(['@createMultipartUpload-attempt2', '@signPart-attempt2', '@put-attempt2', '@completeMultipartUpload-fails', '@abortAttempt-2']) + cy.wait([ + '@createMultipartUpload-attempt2', + '@signPart-attempt2', + '@put-attempt2', + '@completeMultipartUpload-fails', + '@abortAttempt-2', + ]) cy.get('.uppy-StatusBar-statusPrimary').should('contain', 'Upload failed') - cy.intercept('POST', '/s3/multipart', { statusCode: 200, times: 1, body: JSON.stringify({ key:'mocked-key-attempt3', uploadId:'mocked-uploadId-attempt3' }) }).as('createMultipartUpload-attempt3') + cy.intercept('POST', '/s3/multipart', { + statusCode: 200, + times: 1, + body: JSON.stringify({ + key: 'mocked-key-attempt3', + uploadId: 'mocked-uploadId-attempt3', + }), + }).as('createMultipartUpload-attempt3') let intercepted = 0 - cy.intercept('GET', '/s3/multipart/mocked-uploadId-attempt3/1?key=mocked-key-attempt3', (req) => { - if (intercepted++ < 2) { - // Ensure that Uppy can recover from at least 2 network errors at this stage. - req.destroy() - return - } - req.reply({ - statusCode: 200, - headers: { - ETag: 'ETag-attempt3', - }, - body: JSON.stringify({ url:'/put-success-attempt3', expires:8 }), - }) - }).as('signPart-attempt3') + cy.intercept( + 'GET', + '/s3/multipart/mocked-uploadId-attempt3/1?key=mocked-key-attempt3', + (req) => { + if (intercepted++ < 2) { + // Ensure that Uppy can recover from at least 2 network errors at this stage. + req.destroy() + return + } + req.reply({ + statusCode: 200, + headers: { + ETag: 'ETag-attempt3', + }, + body: JSON.stringify({ url: '/put-success-attempt3', expires: 8 }), + }) + }, + ).as('signPart-attempt3') cy.intercept('PUT', '/put-success-attempt3', { statusCode: 200, headers: { ETag: 'ETag-attempt3', }, }).as('put-attempt3') - cy.intercept('POST', '/s3/multipart/mocked-uploadId-attempt3/complete?key=mocked-key-attempt3', { - statusCode: 200, - body: JSON.stringify({ - location: 'someLocation', - }), - }).as('completeMultipartUpload-attempt3') + cy.intercept( + 'POST', + '/s3/multipart/mocked-uploadId-attempt3/complete?key=mocked-key-attempt3', + { + statusCode: 200, + body: JSON.stringify({ + location: 'someLocation', + }), + }, + ).as('completeMultipartUpload-attempt3') cy.get('.uppy-StatusBar-actions > .uppy-c-btn').click() - cy.wait(['@createMultipartUpload-attempt3', ...Array(3).fill('@signPart-attempt3'), '@put-attempt3', '@completeMultipartUpload-attempt3']) + cy.wait([ + '@createMultipartUpload-attempt3', + ...Array(3).fill('@signPart-attempt3'), + '@put-attempt3', + '@completeMultipartUpload-attempt3', + ]) cy.get('.uppy-StatusBar-statusPrimary').should('contain', 'Complete') }) it('should complete when resuming after pause', () => { - cy.get('@file-input').selectFile(['cypress/fixtures/images/cat.jpg', 'cypress/fixtures/images/traffic.jpg'], { force: true }) + cy.get('@file-input').selectFile( + [ + 'cypress/fixtures/images/cat.jpg', + 'cypress/fixtures/images/traffic.jpg', + ], + { force: true }, + ) cy.get('.uppy-StatusBar-actionBtn--upload').click() cy.wait('@post') diff --git a/e2e/cypress/integration/dashboard-aws.spec.ts b/e2e/cypress/integration/dashboard-aws.spec.ts index 16a7a1ddbe..0b39f3fbaf 100644 --- a/e2e/cypress/integration/dashboard-aws.spec.ts +++ b/e2e/cypress/integration/dashboard-aws.spec.ts @@ -7,7 +7,9 @@ describe('Dashboard with @uppy/aws-s3', () => { }) it('should upload cat image successfully', () => { - cy.get('@file-input').selectFile('cypress/fixtures/images/cat.jpg', { force:true }) + cy.get('@file-input').selectFile('cypress/fixtures/images/cat.jpg', { + force: true, + }) cy.get('.uppy-StatusBar-actionBtn--upload').click() cy.wait(['@post', '@get']) diff --git a/e2e/cypress/integration/dashboard-compressor.spec.ts b/e2e/cypress/integration/dashboard-compressor.spec.ts index 93b22858ca..84e5ab8cfc 100644 --- a/e2e/cypress/integration/dashboard-compressor.spec.ts +++ b/e2e/cypress/integration/dashboard-compressor.spec.ts @@ -1,4 +1,4 @@ -function uglierBytes (text) { +function uglierBytes(text) { const KB = 2 ** 10 const MB = KB * KB @@ -28,7 +28,13 @@ describe('dashboard-compressor', () => { it('should compress images', () => { const sizeBeforeCompression = [] - cy.get('@file-input').selectFile(['cypress/fixtures/images/cat.jpg', 'cypress/fixtures/images/traffic.jpg'], { force:true }) + cy.get('@file-input').selectFile( + [ + 'cypress/fixtures/images/cat.jpg', + 'cypress/fixtures/images/traffic.jpg', + ], + { force: true }, + ) cy.get('.uppy-Dashboard-Item-statusSize').each((element) => { const text = element.text() diff --git a/e2e/cypress/integration/dashboard-transloadit.spec.ts b/e2e/cypress/integration/dashboard-transloadit.spec.ts index 94f03454f5..16b50bee45 100644 --- a/e2e/cypress/integration/dashboard-transloadit.spec.ts +++ b/e2e/cypress/integration/dashboard-transloadit.spec.ts @@ -8,7 +8,9 @@ describe('Dashboard with Transloadit', () => { }) it('should upload cat image successfully', () => { - cy.get('@file-input').selectFile('cypress/fixtures/images/cat.jpg', { force:true }) + cy.get('@file-input').selectFile('cypress/fixtures/images/cat.jpg', { + force: true, + }) cy.get('.uppy-StatusBar-actionBtn--upload').click() cy.wait(['@assemblies', '@resumable']).then(() => { @@ -28,18 +30,30 @@ describe('Dashboard with Transloadit', () => { cy.window().then(({ uppy }) => { cy.get('@file-input').selectFile( - ['cypress/fixtures/images/cat.jpg', 'cypress/fixtures/images/traffic.jpg', 'cypress/fixtures/images/car.jpg'], - { force:true }, + [ + 'cypress/fixtures/images/cat.jpg', + 'cypress/fixtures/images/traffic.jpg', + 'cypress/fixtures/images/car.jpg', + ], + { force: true }, ) cy.get('.uppy-StatusBar-actionBtn--upload').click() cy.wait(['@createAssemblies']).then(() => { - expect(Object.values(uppy.getPlugin('Transloadit').activeAssemblies).every((a: any) => a.pollInterval)).to.equal(true) + expect( + Object.values(uppy.getPlugin('Transloadit').activeAssemblies).every( + (a: any) => a.pollInterval, + ), + ).to.equal(true) uppy.cancelAll() cy.wait(['@delete']).then(() => { - expect(Object.values(uppy.getPlugin('Transloadit').activeAssemblies).some((a: any) => a.pollInterval)).to.equal(false) + expect( + Object.values(uppy.getPlugin('Transloadit').activeAssemblies).some( + (a: any) => a.pollInterval, + ), + ).to.equal(false) }) }) }) @@ -55,7 +69,13 @@ describe('Dashboard with Transloadit', () => { cy.window().then(({ uppy }) => { uppy.on('transloadit:assembly-cancelled', spy) - cy.get('@file-input').selectFile(['cypress/fixtures/images/cat.jpg', 'cypress/fixtures/images/traffic.jpg'], { force:true }) + cy.get('@file-input').selectFile( + [ + 'cypress/fixtures/images/cat.jpg', + 'cypress/fixtures/images/traffic.jpg', + ], + { force: true }, + ) cy.intercept({ method: 'GET', @@ -69,9 +89,11 @@ describe('Dashboard with Transloadit', () => { { method: 'DELETE', pathname: '/resumable/files/*', times: 2 }, { statusCode: 204, body: {} }, ).as('fileDeletion') - cy.intercept( - { method: 'DELETE', pathname: '/assemblies/*', times: 1 }, - ).as('assemblyDeletion') + cy.intercept({ + method: 'DELETE', + pathname: '/assemblies/*', + times: 1, + }).as('assemblyDeletion') cy.get('.uppy-StatusBar-actionBtn--upload').click() cy.wait('@assemblyPolling') @@ -91,7 +113,13 @@ describe('Dashboard with Transloadit', () => { cy.window().then(({ uppy }) => { uppy.on('transloadit:assembly-cancelled', spy) - cy.get('@file-input').selectFile(['cypress/fixtures/images/cat.jpg', 'cypress/fixtures/images/traffic.jpg'], { force:true }) + cy.get('@file-input').selectFile( + [ + 'cypress/fixtures/images/cat.jpg', + 'cypress/fixtures/images/traffic.jpg', + ], + { force: true }, + ) cy.intercept({ method: 'GET', @@ -105,47 +133,77 @@ describe('Dashboard with Transloadit', () => { { method: 'DELETE', pathname: '/resumable/files/*', times: 2 }, { statusCode: 204, body: {} }, ).as('fileDeletion') - cy.intercept( - { method: 'DELETE', pathname: '/assemblies/*', times: 1 }, - ).as('assemblyDeletion') + cy.intercept({ + method: 'DELETE', + pathname: '/assemblies/*', + times: 1, + }).as('assemblyDeletion') cy.get('.uppy-StatusBar-actionBtn--upload').click() cy.wait('@assemblyPolling') - expect(Object.values(uppy.getPlugin('Transloadit').activeAssemblies).every((a: any) => a.pollInterval)).to.equal(true) + expect( + Object.values(uppy.getPlugin('Transloadit').activeAssemblies).every( + (a: any) => a.pollInterval, + ), + ).to.equal(true) const { files } = uppy.getState() uppy.removeFiles(Object.keys(files)) cy.wait('@assemblyDeletion').then(() => { - expect(Object.values(uppy.getPlugin('Transloadit').activeAssemblies).some((a: any) => a.pollInterval)).to.equal(false) + expect( + Object.values(uppy.getPlugin('Transloadit').activeAssemblies).some( + (a: any) => a.pollInterval, + ), + ).to.equal(false) expect(spy).to.be.calledOnce }) }) }) it('should not create assembly when all individual files have been cancelled', () => { - cy.get('@file-input').selectFile(['cypress/fixtures/images/cat.jpg', 'cypress/fixtures/images/traffic.jpg'], { force:true }) + cy.get('@file-input').selectFile( + [ + 'cypress/fixtures/images/cat.jpg', + 'cypress/fixtures/images/traffic.jpg', + ], + { force: true }, + ) cy.get('.uppy-StatusBar-actionBtn--upload').click() cy.window().then(({ uppy }) => { - expect(Object.values(uppy.getPlugin('Transloadit').activeAssemblies).length).to.equal(0) + expect( + Object.values(uppy.getPlugin('Transloadit').activeAssemblies).length, + ).to.equal(0) const { files } = uppy.getState() uppy.removeFiles(Object.keys(files)) cy.wait('@createAssemblies').then(() => { - expect(Object.values(uppy.getPlugin('Transloadit').activeAssemblies).some((a: any) => a.pollInterval)).to.equal(false) + expect( + Object.values(uppy.getPlugin('Transloadit').activeAssemblies).some( + (a: any) => a.pollInterval, + ), + ).to.equal(false) }) }) }) // Not working, the upstream changes have not landed yet. it.skip('should create assembly if there is still one file to upload', () => { - cy.get('@file-input').selectFile(['cypress/fixtures/images/cat.jpg', 'cypress/fixtures/images/traffic.jpg'], { force:true }) + cy.get('@file-input').selectFile( + [ + 'cypress/fixtures/images/cat.jpg', + 'cypress/fixtures/images/traffic.jpg', + ], + { force: true }, + ) cy.get('.uppy-StatusBar-actionBtn--upload').click() cy.window().then(({ uppy }) => { - expect(Object.values(uppy.getPlugin('Transloadit').activeAssemblies).length).to.equal(0) + expect( + Object.values(uppy.getPlugin('Transloadit').activeAssemblies).length, + ).to.equal(0) const { files } = uppy.getState() const [fileID] = Object.keys(files) @@ -160,7 +218,13 @@ describe('Dashboard with Transloadit', () => { // Not working, the upstream changes have not landed yet. it.skip('should complete upload if one gets cancelled mid-flight', () => { - cy.get('@file-input').selectFile(['cypress/fixtures/images/cat.jpg', 'cypress/fixtures/images/traffic.jpg'], { force:true }) + cy.get('@file-input').selectFile( + [ + 'cypress/fixtures/images/cat.jpg', + 'cypress/fixtures/images/traffic.jpg', + ], + { force: true }, + ) cy.get('.uppy-StatusBar-actionBtn--upload').click() cy.wait('@createAssemblies') @@ -176,7 +240,9 @@ describe('Dashboard with Transloadit', () => { }) it('should not emit error if upload is cancelled right away', () => { - cy.get('@file-input').selectFile('cypress/fixtures/images/cat.jpg', { force:true }) + cy.get('@file-input').selectFile('cypress/fixtures/images/cat.jpg', { + force: true, + }) cy.get('.uppy-StatusBar-actionBtn--upload').click() const handler = cy.spy() @@ -193,81 +259,88 @@ describe('Dashboard with Transloadit', () => { }) it('should not re-use erroneous tus keys', () => { - function createAssemblyStatus ({ message, assembly_id, bytes_expected, ...other }) { + function createAssemblyStatus({ + message, + assembly_id, + bytes_expected, + ...other + }) { return { message, assembly_id, - parent_id:null, - account_id:'deadbeef', - account_name:'foo', - account_slug:'foo', - template_id:null, - template_name:null, - instance:'test.transloadit.com', - assembly_url:`http://api2.test.transloadit.com/assemblies/${assembly_id}`, - assembly_ssl_url:`https://api2-test.transloadit.com/assemblies/${assembly_id}`, - uppyserver_url:'https://api2-test.transloadit.com/companion/', - companion_url:'https://api2-test.transloadit.com/companion/', - websocket_url:'about:blank', - tus_url:'https://api2-test.transloadit.com/resumable/files/', - bytes_received:0, + parent_id: null, + account_id: 'deadbeef', + account_name: 'foo', + account_slug: 'foo', + template_id: null, + template_name: null, + instance: 'test.transloadit.com', + assembly_url: `http://api2.test.transloadit.com/assemblies/${assembly_id}`, + assembly_ssl_url: `https://api2-test.transloadit.com/assemblies/${assembly_id}`, + uppyserver_url: 'https://api2-test.transloadit.com/companion/', + companion_url: 'https://api2-test.transloadit.com/companion/', + websocket_url: 'about:blank', + tus_url: 'https://api2-test.transloadit.com/resumable/files/', + bytes_received: 0, bytes_expected, - upload_duration:0.162, - client_agent:null, - client_ip:null, - client_referer:null, - transloadit_client:'uppy-core:3.2.0,uppy-transloadit:3.1.3,uppy-tus:3.1.0,uppy-dropbox:3.1.1,uppy-box:2.1.1,uppy-facebook:3.1.1,uppy-google-drive:3.1.1,uppy-instagram:3.1.1,uppy-onedrive:3.1.1,uppy-zoom:2.1.1,uppy-url:3.3.1', + upload_duration: 0.162, + client_agent: null, + client_ip: null, + client_referer: null, + transloadit_client: + 'uppy-core:3.2.0,uppy-transloadit:3.1.3,uppy-tus:3.1.0,uppy-dropbox:3.1.1,uppy-box:2.1.1,uppy-facebook:3.1.1,uppy-google-drive:3.1.1,uppy-instagram:3.1.1,uppy-onedrive:3.1.1,uppy-zoom:2.1.1,uppy-url:3.3.1', start_date: new Date().toISOString(), - upload_meta_data_extracted:false, - warnings:[], - is_infinite:false, - has_dupe_jobs:false, - execution_start:null, - execution_duration:null, - queue_duration:0.009, - jobs_queue_duration:0, - notify_start:null, - notify_url:null, - notify_response_code:null, - notify_response_data:null, - notify_duration:null, - last_job_completed:null, - fields:{}, - running_jobs:[], - bytes_usage:0, - executing_jobs:[], - started_jobs:[], - parent_assembly_status:null, - params:'{}', - template:null, - merged_params:'{}', - expected_tus_uploads:1, - started_tus_uploads:0, - finished_tus_uploads:0, - tus_uploads:[], - uploads:[], - results:{}, - build_id:'4765326956', - status_endpoint:`https://api2-test.transloadit.com/assemblies/${assembly_id}`, + upload_meta_data_extracted: false, + warnings: [], + is_infinite: false, + has_dupe_jobs: false, + execution_start: null, + execution_duration: null, + queue_duration: 0.009, + jobs_queue_duration: 0, + notify_start: null, + notify_url: null, + notify_response_code: null, + notify_response_data: null, + notify_duration: null, + last_job_completed: null, + fields: {}, + running_jobs: [], + bytes_usage: 0, + executing_jobs: [], + started_jobs: [], + parent_assembly_status: null, + params: '{}', + template: null, + merged_params: '{}', + expected_tus_uploads: 1, + started_tus_uploads: 0, + finished_tus_uploads: 0, + tus_uploads: [], + uploads: [], + results: {}, + build_id: '4765326956', + status_endpoint: `https://api2-test.transloadit.com/assemblies/${assembly_id}`, ...other, } } - cy.get('@file-input').selectFile( - ['cypress/fixtures/images/cat.jpg'], - { force:true }, - ) + cy.get('@file-input').selectFile(['cypress/fixtures/images/cat.jpg'], { + force: true, + }) // SETUP for FIRST ATTEMPT (error response from Transloadit backend) const assemblyIDAttempt1 = '500e56004f4347a288194edd7c7a0ae1' const tusIDAttempt1 = 'a9daed4af4981880faf29b0e9596a14d' cy.intercept('POST', 'https://api2.transloadit.com/assemblies', { statusCode: 200, - body: JSON.stringify(createAssemblyStatus({ - ok:'ASSEMBLY_UPLOADING', - message:'The Assembly is still in the process of being uploaded.', - assembly_id:assemblyIDAttempt1, - bytes_expected:263871, - })), + body: JSON.stringify( + createAssemblyStatus({ + ok: 'ASSEMBLY_UPLOADING', + message: 'The Assembly is still in the process of being uploaded.', + assembly_id: assemblyIDAttempt1, + bytes_expected: 263871, + }), + ), }).as('createAssembly') cy.intercept('POST', 'https://api2-test.transloadit.com/resumable/files/', { @@ -277,28 +350,42 @@ describe('Dashboard with Transloadit', () => { }, times: 1, }).as('tusCall') - cy.intercept('PATCH', `https://api2-test.transloadit.com/resumable/files/${tusIDAttempt1}`, { - statusCode: 204, - headers: { - 'Upload-Length': '263871', - 'Upload-Offset': '263871', + cy.intercept( + 'PATCH', + `https://api2-test.transloadit.com/resumable/files/${tusIDAttempt1}`, + { + statusCode: 204, + headers: { + 'Upload-Length': '263871', + 'Upload-Offset': '263871', + }, + times: 1, }, - times: 1, - }) - cy.intercept('HEAD', `https://api2-test.transloadit.com/resumable/files/${tusIDAttempt1}`, { statusCode: 204 }) + ) + cy.intercept( + 'HEAD', + `https://api2-test.transloadit.com/resumable/files/${tusIDAttempt1}`, + { statusCode: 204 }, + ) - cy.intercept('GET', `https://api2-test.transloadit.com/assemblies/${assemblyIDAttempt1}`, { - statusCode: 200, - body: JSON.stringify(createAssemblyStatus({ - error:'INVALID_FILE_META_DATA', - http_code:400, - message:'Whatever error message from Transloadit backend', - reason:'Whatever reason', - msg:'Whatever error from Transloadit backend', - assembly_id:'500e56004f4347a288194edd7c7a0ae1', - bytes_expected:263871, - })), - }).as('failureReported') + cy.intercept( + 'GET', + `https://api2-test.transloadit.com/assemblies/${assemblyIDAttempt1}`, + { + statusCode: 200, + body: JSON.stringify( + createAssemblyStatus({ + error: 'INVALID_FILE_META_DATA', + http_code: 400, + message: 'Whatever error message from Transloadit backend', + reason: 'Whatever reason', + msg: 'Whatever error from Transloadit backend', + assembly_id: '500e56004f4347a288194edd7c7a0ae1', + bytes_expected: 263871, + }), + ), + }, + ).as('failureReported') cy.intercept('POST', 'https://transloaditstatus.com/client_error', { statusCode: 200, @@ -315,55 +402,85 @@ describe('Dashboard with Transloadit', () => { const tusIDAttempt2 = 'b8ebed4af4981880faf29b0e9596b25e' cy.intercept('POST', 'https://api2.transloadit.com/assemblies', { statusCode: 200, - body: JSON.stringify(createAssemblyStatus({ - ok:'ASSEMBLY_UPLOADING', - message:'The Assembly is still in the process of being uploaded.', - assembly_id:assemblyIDAttempt2, - tus_url:'https://api2-test.transloadit.com/resumable/files/attempt2', - bytes_expected:263871, - })), + body: JSON.stringify( + createAssemblyStatus({ + ok: 'ASSEMBLY_UPLOADING', + message: 'The Assembly is still in the process of being uploaded.', + assembly_id: assemblyIDAttempt2, + tus_url: 'https://api2-test.transloadit.com/resumable/files/attempt2', + bytes_expected: 263871, + }), + ), }).as('createAssembly-attempt2') - cy.intercept('POST', 'https://api2-test.transloadit.com/resumable/files/attempt2', { - statusCode: 201, - headers: { - 'Upload-Length': '263871', - 'Upload-Offset': '0', - Location: `https://api2-test.transloadit.com/resumable/files/${tusIDAttempt2}`, + cy.intercept( + 'POST', + 'https://api2-test.transloadit.com/resumable/files/attempt2', + { + statusCode: 201, + headers: { + 'Upload-Length': '263871', + 'Upload-Offset': '0', + Location: `https://api2-test.transloadit.com/resumable/files/${tusIDAttempt2}`, + }, + times: 1, }, - times: 1, - }).as('tusCall-attempt2') + ).as('tusCall-attempt2') - cy.intercept('PATCH', `https://api2-test.transloadit.com/resumable/files/${tusIDAttempt2}`, { - statusCode: 204, - headers: { - 'Upload-Length': '263871', - 'Upload-Offset': '263871', - 'Tus-Resumable': '1.0.0', + cy.intercept( + 'PATCH', + `https://api2-test.transloadit.com/resumable/files/${tusIDAttempt2}`, + { + statusCode: 204, + headers: { + 'Upload-Length': '263871', + 'Upload-Offset': '263871', + 'Tus-Resumable': '1.0.0', + }, + times: 1, }, - times: 1, - }) - cy.intercept('HEAD', `https://api2-test.transloadit.com/resumable/files/${tusIDAttempt2}`, { statusCode: 204 }) + ) + cy.intercept( + 'HEAD', + `https://api2-test.transloadit.com/resumable/files/${tusIDAttempt2}`, + { statusCode: 204 }, + ) - cy.intercept('GET', `https://api2-test.transloadit.com/assemblies/${assemblyIDAttempt2}`, { - statusCode: 200, - body: JSON.stringify(createAssemblyStatus({ - ok:'ASSEMBLY_COMPLETED', - http_code:200, - message:'The Assembly was successfully completed.', - assembly_id:assemblyIDAttempt2, - bytes_received:263871, - bytes_expected:263871, - })), - }).as('assemblyCompleted-attempt2') + cy.intercept( + 'GET', + `https://api2-test.transloadit.com/assemblies/${assemblyIDAttempt2}`, + { + statusCode: 200, + body: JSON.stringify( + createAssemblyStatus({ + ok: 'ASSEMBLY_COMPLETED', + http_code: 200, + message: 'The Assembly was successfully completed.', + assembly_id: assemblyIDAttempt2, + bytes_received: 263871, + bytes_expected: 263871, + }), + ), + }, + ).as('assemblyCompleted-attempt2') // SECOND ATTEMPT cy.get('.uppy-StatusBar-actions > .uppy-c-btn').click() - cy.wait(['@createAssembly-attempt2', '@tusCall-attempt2', '@assemblyCompleted-attempt2']) + cy.wait([ + '@createAssembly-attempt2', + '@tusCall-attempt2', + '@assemblyCompleted-attempt2', + ]) }) it('should complete on retry', () => { - cy.get('@file-input').selectFile(['cypress/fixtures/images/cat.jpg', 'cypress/fixtures/images/traffic.jpg'], { force: true }) + cy.get('@file-input').selectFile( + [ + 'cypress/fixtures/images/cat.jpg', + 'cypress/fixtures/images/traffic.jpg', + ], + { force: true }, + ) cy.intercept('POST', 'https://transloaditstatus.com/client_error', { statusCode: 200, @@ -386,7 +503,13 @@ describe('Dashboard with Transloadit', () => { }) it('should complete when resuming after pause', () => { - cy.get('@file-input').selectFile(['cypress/fixtures/images/cat.jpg', 'cypress/fixtures/images/traffic.jpg'], { force: true }) + cy.get('@file-input').selectFile( + [ + 'cypress/fixtures/images/cat.jpg', + 'cypress/fixtures/images/traffic.jpg', + ], + { force: true }, + ) cy.get('.uppy-StatusBar-actionBtn--upload').click() cy.wait('@createAssemblies') diff --git a/e2e/cypress/integration/dashboard-tus.spec.ts b/e2e/cypress/integration/dashboard-tus.spec.ts index b693330972..053089c7df 100644 --- a/e2e/cypress/integration/dashboard-tus.spec.ts +++ b/e2e/cypress/integration/dashboard-tus.spec.ts @@ -20,7 +20,9 @@ describe('Dashboard with Tus', () => { }) it('should upload cat image successfully', () => { - cy.get('@file-input').selectFile('cypress/fixtures/images/cat.jpg', { force:true }) + cy.get('@file-input').selectFile('cypress/fixtures/images/cat.jpg', { + force: true, + }) cy.get('.uppy-StatusBar-actionBtn--upload').click() cy.wait(['@post', '@patch']).then(() => { @@ -29,7 +31,9 @@ describe('Dashboard with Tus', () => { }) it('should start exponential backoff when receiving HTTP 429', () => { - cy.get('@file-input').selectFile('cypress/fixtures/images/baboon.png', { force: true }) + cy.get('@file-input').selectFile('cypress/fixtures/images/baboon.png', { + force: true, + }) cy.intercept( { method: 'PATCH', pathname: '/files/*', times: 2 }, diff --git a/e2e/cypress/integration/dashboard-ui.spec.ts b/e2e/cypress/integration/dashboard-ui.spec.ts index 6c9133d274..e38e9ec3e3 100644 --- a/e2e/cypress/integration/dashboard-ui.spec.ts +++ b/e2e/cypress/integration/dashboard-ui.spec.ts @@ -6,7 +6,13 @@ describe('dashboard-ui', () => { }) it('should not throw when calling uppy.close()', () => { - cy.get('@file-input').selectFile(['cypress/fixtures/images/cat.jpg', 'cypress/fixtures/images/traffic.jpg'], { force:true }) + cy.get('@file-input').selectFile( + [ + 'cypress/fixtures/images/cat.jpg', + 'cypress/fixtures/images/traffic.jpg', + ], + { force: true }, + ) cy.window().then(({ uppy }) => { expect(uppy.close()).to.not.throw @@ -14,27 +20,37 @@ describe('dashboard-ui', () => { }) it('should render thumbnails', () => { - cy.get('@file-input').selectFile(['cypress/fixtures/images/cat.jpg', 'cypress/fixtures/images/traffic.jpg'], { force:true }) + cy.get('@file-input').selectFile( + [ + 'cypress/fixtures/images/cat.jpg', + 'cypress/fixtures/images/traffic.jpg', + ], + { force: true }, + ) cy.get('.uppy-Dashboard-Item-previewImg') .should('have.length', 2) .each((element) => expect(element).attr('src').to.include('blob:')) }) it('should support drag&drop', () => { - cy.get('@drop-target').selectFile([ - 'cypress/fixtures/images/cat.jpg', - 'cypress/fixtures/images/cat-symbolic-link', - 'cypress/fixtures/images/cat-symbolic-link.jpg', - 'cypress/fixtures/images/traffic.jpg', - ], { action: 'drag-drop' }) + cy.get('@drop-target').selectFile( + [ + 'cypress/fixtures/images/cat.jpg', + 'cypress/fixtures/images/cat-symbolic-link', + 'cypress/fixtures/images/cat-symbolic-link.jpg', + 'cypress/fixtures/images/traffic.jpg', + ], + { action: 'drag-drop' }, + ) - cy.get('.uppy-Dashboard-Item') - .should('have.length', 4) + cy.get('.uppy-Dashboard-Item').should('have.length', 4) cy.get('.uppy-Dashboard-Item-previewImg') .should('have.length', 3) .each((element) => expect(element).attr('src').to.include('blob:')) cy.window().then(({ uppy }) => { - expect(JSON.stringify(uppy.getFiles().map(file => file.meta.relativePath))).to.be.equal('[null,null,null,null]') + expect( + JSON.stringify(uppy.getFiles().map((file) => file.meta.relativePath)), + ).to.be.equal('[null,null,null,null]') }) }) }) diff --git a/e2e/cypress/integration/dashboard-vue.spec.ts b/e2e/cypress/integration/dashboard-vue.spec.ts index d36860d3b3..57d51b01f1 100644 --- a/e2e/cypress/integration/dashboard-vue.spec.ts +++ b/e2e/cypress/integration/dashboard-vue.spec.ts @@ -6,7 +6,13 @@ describe('dashboard-vue', () => { // Only Vue 3 works in Parcel if you use SFC's but Vue 3 is broken in Uppy: // https://github.com/transloadit/uppy/issues/2877 xit('should render in Vue 3 and show thumbnails', () => { - cy.get('@file-input').selectFile(['cypress/fixtures/images/cat.jpg', 'cypress/fixtures/images/traffic.jpg'], { force:true }) + cy.get('@file-input').selectFile( + [ + 'cypress/fixtures/images/cat.jpg', + 'cypress/fixtures/images/traffic.jpg', + ], + { force: true }, + ) cy.get('.uppy-Dashboard-Item-previewImg') .should('have.length', 2) .each((element) => expect(element).attr('src').to.include('blob:')) diff --git a/e2e/cypress/integration/dashboard-xhr.spec.ts b/e2e/cypress/integration/dashboard-xhr.spec.ts index 2b7e057f7c..e21ee08caa 100644 --- a/e2e/cypress/integration/dashboard-xhr.spec.ts +++ b/e2e/cypress/integration/dashboard-xhr.spec.ts @@ -1,4 +1,9 @@ -import { interceptCompanionUrlRequest, interceptCompanionUnsplashRequest, runRemoteUrlImageUploadTest, runRemoteUnsplashUploadTest } from './reusable-tests' +import { + interceptCompanionUrlRequest, + interceptCompanionUnsplashRequest, + runRemoteUrlImageUploadTest, + runRemoteUnsplashUploadTest, +} from './reusable-tests' describe('Dashboard with XHR', () => { beforeEach(() => { @@ -14,7 +19,9 @@ describe('Dashboard with XHR', () => { it('should return correct file name with URL plugin from remote image with Content-Disposition', () => { const fileName = `DALL·E IMG_9078 - 学中文 🤑` cy.get('[data-cy="Url"]').click() - cy.get('.uppy-Url-input').type('http://localhost:4678/file-with-content-disposition') + cy.get('.uppy-Url-input').type( + 'http://localhost:4678/file-with-content-disposition', + ) cy.get('.uppy-Url-importButton').click() cy.wait('@url').then(() => { cy.get('.uppy-Dashboard-Item-name').should('contain', fileName) @@ -40,7 +47,9 @@ describe('Dashboard with XHR', () => { }).as('url') cy.get('[data-cy="Url"]').click() - cy.get('.uppy-Url-input').type('http://localhost:4678/file-with-content-disposition') + cy.get('.uppy-Url-input').type( + 'http://localhost:4678/file-with-content-disposition', + ) cy.get('.uppy-Url-importButton').click() cy.wait('@url').then(() => { cy.get('.uppy-Dashboard-Item-name').should('contain', 'file-with') diff --git a/e2e/cypress/integration/react.spec.ts b/e2e/cypress/integration/react.spec.ts index b3120e7b57..c937e35070 100644 --- a/e2e/cypress/integration/react.spec.ts +++ b/e2e/cypress/integration/react.spec.ts @@ -7,7 +7,13 @@ describe('@uppy/react', () => { }) it('should render Dashboard in React and show thumbnails', () => { - cy.get('@dashboard-input').selectFile(['cypress/fixtures/images/cat.jpg', 'cypress/fixtures/images/traffic.jpg'], { force:true }) + cy.get('@dashboard-input').selectFile( + [ + 'cypress/fixtures/images/cat.jpg', + 'cypress/fixtures/images/traffic.jpg', + ], + { force: true }, + ) cy.get('#dashboard .uppy-Dashboard-Item-previewImg') .should('have.length', 2) .each((element) => expect(element).attr('src').to.include('blob:')) @@ -15,7 +21,13 @@ describe('@uppy/react', () => { it('should render Modal in React and show thumbnails', () => { cy.get('#open').click() - cy.get('@modal-input').selectFile(['cypress/fixtures/images/cat.jpg', 'cypress/fixtures/images/traffic.jpg'], { force:true }) + cy.get('@modal-input').selectFile( + [ + 'cypress/fixtures/images/cat.jpg', + 'cypress/fixtures/images/traffic.jpg', + ], + { force: true }, + ) cy.get('#modal .uppy-Dashboard-Item-previewImg') .should('have.length', 2) .each((element) => expect(element).attr('src').to.include('blob:')) @@ -25,7 +37,13 @@ describe('@uppy/react', () => { const spy = cy.spy() cy.window().then(({ uppy }) => uppy.on('thumbnail:generated', spy)) - cy.get('@dragdrop-input').selectFile(['cypress/fixtures/images/cat.jpg', 'cypress/fixtures/images/traffic.jpg'], { force:true }) + cy.get('@dragdrop-input').selectFile( + [ + 'cypress/fixtures/images/cat.jpg', + 'cypress/fixtures/images/traffic.jpg', + ], + { force: true }, + ) // not sure how I can accurately wait for the thumbnail // eslint-disable-next-line cypress/no-unnecessary-waiting cy.wait(1000).then(() => expect(spy).to.be.called) diff --git a/e2e/cypress/integration/reusable-tests.ts b/e2e/cypress/integration/reusable-tests.ts index 1e5ada2c4d..f60d29de53 100644 --- a/e2e/cypress/integration/reusable-tests.ts +++ b/e2e/cypress/integration/reusable-tests.ts @@ -1,11 +1,15 @@ /* global cy */ -export const interceptCompanionUrlRequest = () => cy.intercept('http://localhost:3020/url/*').as('url') -export const interceptCompanionUnsplashRequest = () => cy.intercept('http://localhost:3020/search/unsplash/*').as('unsplash') +export const interceptCompanionUrlRequest = () => + cy.intercept('http://localhost:3020/url/*').as('url') +export const interceptCompanionUnsplashRequest = () => + cy.intercept('http://localhost:3020/search/unsplash/*').as('unsplash') -export function runRemoteUrlImageUploadTest () { +export function runRemoteUrlImageUploadTest() { cy.get('[data-cy="Url"]').click() - cy.get('.uppy-Url-input').type('https://raw.githubusercontent.com/transloadit/uppy/main/e2e/cypress/fixtures/images/cat.jpg') + cy.get('.uppy-Url-input').type( + 'https://raw.githubusercontent.com/transloadit/uppy/main/e2e/cypress/fixtures/images/cat.jpg', + ) cy.get('.uppy-Url-importButton').click() cy.get('.uppy-StatusBar-actionBtn--upload').click() cy.wait('@url').then(() => { @@ -13,7 +17,7 @@ export function runRemoteUrlImageUploadTest () { }) } -export function runRemoteUnsplashUploadTest () { +export function runRemoteUnsplashUploadTest() { cy.get('[data-cy="Unsplash"]').click() cy.get('.uppy-SearchProvider-input').type('book') cy.get('.uppy-SearchProvider-searchButton').click() diff --git a/e2e/cypress/support/createFakeFile.ts b/e2e/cypress/support/createFakeFile.ts index 4e55087126..825cae6ffc 100644 --- a/e2e/cypress/support/createFakeFile.ts +++ b/e2e/cypress/support/createFakeFile.ts @@ -2,7 +2,7 @@ declare global { namespace Cypress { interface Chainable { // eslint-disable-next-line no-use-before-define - createFakeFile: typeof createFakeFile; + createFakeFile: typeof createFakeFile } } } @@ -14,14 +14,21 @@ interface File { data: Blob } -export function createFakeFile (name?: string, type?: string, b64?: string): File { - // eslint-disable-next-line no-param-reassign - if (!b64) b64 = 'PHN2ZyB2aWV3Qm94PSIwIDAgMTIwIDEyMCI+CiAgPGNpcmNsZSBjeD0iNjAiIGN5PSI2MCIgcj0iNTAiLz4KPC9zdmc+Cg==' +export function createFakeFile( + name?: string, + type?: string, + b64?: string, +): File { + if (!b64) { + // eslint-disable-next-line no-param-reassign + b64 = + 'PHN2ZyB2aWV3Qm94PSIwIDAgMTIwIDEyMCI+CiAgPGNpcmNsZSBjeD0iNjAiIGN5PSI2MCIgcj0iNTAiLz4KPC9zdmc+Cg==' + } // eslint-disable-next-line no-param-reassign if (!type) type = 'image/svg+xml' // https://stackoverflow.com/questions/16245767/creating-a-blob-from-a-base64-string-in-javascript - function base64toBlob (base64Data: string, contentType = '') { + function base64toBlob(base64Data: string, contentType = '') { const sliceSize = 1024 const byteCharacters = atob(base64Data) const bytesLength = byteCharacters.length diff --git a/e2e/cypress/support/e2e.ts b/e2e/cypress/support/e2e.ts index 7583ae8e57..a848280213 100644 --- a/e2e/cypress/support/e2e.ts +++ b/e2e/cypress/support/e2e.ts @@ -21,6 +21,6 @@ import './commands' // eslint-disable-next-line // @ts-ignore -import installLogsCollector from 'cypress-terminal-report/src/installLogsCollector.js' +import installLogsCollector from 'cypress-terminal-report/src/installLogsCollector.js' installLogsCollector() diff --git a/examples/angular-example/.eslintrc.json b/examples/angular-example/.eslintrc.json index 0ed227af25..6eee1d5d5c 100644 --- a/examples/angular-example/.eslintrc.json +++ b/examples/angular-example/.eslintrc.json @@ -1,12 +1,8 @@ { - "ignorePatterns": [ - "projects/**/*" - ], + "ignorePatterns": ["projects/**/*"], "overrides": [ { - "files": [ - "*.ts" - ], + "files": ["*.ts"], "extends": [ "eslint:recommended", "plugin:@typescript-eslint/recommended", @@ -37,9 +33,7 @@ } }, { - "files": [ - "star.html" - ], + "files": ["star.html"], "extends": [ "plugin:@angular-eslint/template/recommended", "plugin:@angular-eslint/template/accessibility" diff --git a/examples/angular-example/angular.json b/examples/angular-example/angular.json index 51f5b5714f..f40ebd3c9f 100644 --- a/examples/angular-example/angular.json +++ b/examples/angular-example/angular.json @@ -16,17 +16,10 @@ "outputPath": "dist/angular-example", "index": "src/index.html", "main": "src/main.ts", - "polyfills": [ - "zone.js" - ], + "polyfills": ["zone.js"], "tsConfig": "tsconfig.app.json", - "assets": [ - "src/favicon.ico", - "src/assets" - ], - "styles": [ - "src/styles.css" - ], + "assets": ["src/favicon.ico", "src/assets"], + "styles": ["src/styles.css"], "scripts": [] }, "configurations": { @@ -77,36 +70,23 @@ "test": { "builder": "@angular-devkit/build-angular:karma", "options": { - "polyfills": [ - "zone.js", - "zone.js/testing" - ], + "polyfills": ["zone.js", "zone.js/testing"], "tsConfig": "tsconfig.spec.json", - "assets": [ - "src/favicon.ico", - "src/assets" - ], - "styles": [ - "src/styles.css" - ], + "assets": ["src/favicon.ico", "src/assets"], + "styles": ["src/styles.css"], "scripts": [] } }, "lint": { "builder": "@angular-eslint/builder:lint", "options": { - "lintFilePatterns": [ - "src/**/*.ts", - "src/**/*.html" - ] + "lintFilePatterns": ["src/**/*.ts", "src/**/*.html"] } } } } }, "cli": { - "schematicCollections": [ - "@angular-eslint/schematics" - ] + "schematicCollections": ["@angular-eslint/schematics"] } } diff --git a/examples/angular-example/src/app/app.component.html b/examples/angular-example/src/app/app.component.html index e4e763e743..36092f8cbe 100644 --- a/examples/angular-example/src/app/app.component.html +++ b/examples/angular-example/src/app/app.component.html @@ -9,7 +9,9 @@ diff --git a/examples/node-xhr/index.html b/examples/node-xhr/index.html index b768a79a1a..54b683f268 100644 --- a/examples/node-xhr/index.html +++ b/examples/node-xhr/index.html @@ -1,8 +1,8 @@ - + - - + + Node.js + Uppy Example diff --git a/examples/php-xhr/index.html b/examples/php-xhr/index.html index 8a98441ecf..e1e3db298f 100644 --- a/examples/php-xhr/index.html +++ b/examples/php-xhr/index.html @@ -1,8 +1,8 @@ - + - - + + PHP + Uppy Example diff --git a/examples/python-xhr/index.html b/examples/python-xhr/index.html index 0e89baa514..65bdb392a7 100644 --- a/examples/python-xhr/index.html +++ b/examples/python-xhr/index.html @@ -1,8 +1,8 @@ - + - - + + Python + Uppy Example diff --git a/examples/react-example/index.html b/examples/react-example/index.html index be17dd91ff..7a885b5b25 100644 --- a/examples/react-example/index.html +++ b/examples/react-example/index.html @@ -1,10 +1,10 @@ - + - - + + Uppy React Example - +
diff --git a/examples/react-native-expo/app.json b/examples/react-native-expo/app.json index d5b376e76e..f9755f55e3 100644 --- a/examples/react-native-expo/app.json +++ b/examples/react-native-expo/app.json @@ -13,9 +13,7 @@ "updates": { "fallbackToCacheTimeout": 0 }, - "assetBundlePatterns": [ - "**/*" - ], + "assetBundlePatterns": ["**/*"], "ios": { "supportsTablet": true }, diff --git a/examples/redux/index.html b/examples/redux/index.html index 94009877f7..54e51d3712 100644 --- a/examples/redux/index.html +++ b/examples/redux/index.html @@ -1,8 +1,8 @@ - + - - + + Uppy example: Redux diff --git a/examples/svelte-example/public/global.css b/examples/svelte-example/public/global.css index 5d532f6b91..619a92f331 100644 --- a/examples/svelte-example/public/global.css +++ b/examples/svelte-example/public/global.css @@ -10,7 +10,8 @@ body { margin: 0; padding: 8px; box-sizing: border-box; - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; + font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, + Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif; } a { @@ -64,4 +65,4 @@ button:not(:disabled):active { button:focus { border-color: #666; -} \ No newline at end of file +} diff --git a/examples/svelte-example/public/index.html b/examples/svelte-example/public/index.html index 943e7a25f8..2b86c92861 100644 --- a/examples/svelte-example/public/index.html +++ b/examples/svelte-example/public/index.html @@ -1,17 +1,16 @@ - + - - - + + + - Svelte app + Svelte app - - - - - + + + + + - - + diff --git a/examples/svelte-example/tsconfig.json b/examples/svelte-example/tsconfig.json index 3575716026..47bdb60e94 100644 --- a/examples/svelte-example/tsconfig.json +++ b/examples/svelte-example/tsconfig.json @@ -1,8 +1,7 @@ { "extends": "@tsconfig/svelte/tsconfig.json", - "compilerOptions": { - }, + "compilerOptions": {}, "esModuleInterop": true, "include": ["src/**/*"], "exclude": ["node_modules/*", "__sapper__/*", "public/*"] -} \ No newline at end of file +} diff --git a/examples/transloadit-markdown-bin/index.html b/examples/transloadit-markdown-bin/index.html index 6c9bee1bfe..3868967f29 100644 --- a/examples/transloadit-markdown-bin/index.html +++ b/examples/transloadit-markdown-bin/index.html @@ -1,21 +1,31 @@ - + - +
-

Uppy Transloadit playground

+

+ Uppy Transloadit + + playground +

- This page contains small examples for different ways you can use Uppy with Transloadit. Please see the Github repository for the source code. + This page contains small examples for different ways you can use Uppy + with Transloadit. Please see the + Github repository + for the source code.

-
+

Form

- The form API allows you to easily send files through Transloadit’s encoding backend. When the user submits the form, any files are uploaded to Transloadit. The form data is then sent to your own backend, with additional data about the Transloadit Assemblies that were started. + The form API allows you to easily send files through Transloadit’s + encoding backend. When the user submits the form, any files are uploaded + to Transloadit. The form data is then sent to your own backend, with + additional data about the Transloadit Assemblies that were started.

leave a message

-

-

@@ -59,28 +85,30 @@

Form

- +

- +
-
+

Form with inline Dashboard

-

- You can also use the Dashboard UI inside a plain old HTML form. -

-
+

You can also use the Dashboard UI inside a plain old HTML form.

+

leave a message

-

-

@@ -91,39 +119,47 @@

Form with inline Dashboard

- +

- +
-
+

Inline Dashboard

- The robodog.dashboard API allows you to embed a Dashboard at any location. Users can continuously upload files through this UI, so please make sure this fits your use case! + The robodog.dashboard API allows you to embed a Dashboard + at any location. Users can continuously upload files through this UI, so + please make sure this fits your use case!

-
+

Dashboard Modal

- This API is a one-shot upload UI using a modal overlay. Call the function and receive a listen to an event with upload results ✌️ + This API is a one-shot upload UI using a modal overlay. Call the + function and receive a listen to an event with upload results ✌️

uppy.upload()

+

An <input type=file> backed by uppy.upload():

- An <input type=file> backed by uppy.upload(): -

-

- +

-

+        

         

       
diff --git a/examples/uppy-with-companion/client/index.html b/examples/uppy-with-companion/client/index.html index 5206c7c291..f21eeeaeec 100644 --- a/examples/uppy-with-companion/client/index.html +++ b/examples/uppy-with-companion/client/index.html @@ -1,21 +1,36 @@ - + - - - + + + - - - - - + + + + - - - + + + + diff --git a/packages/@uppy/angular/.eslintrc.json b/packages/@uppy/angular/.eslintrc.json index 2304954633..54e1cd9a19 100644 --- a/packages/@uppy/angular/.eslintrc.json +++ b/packages/@uppy/angular/.eslintrc.json @@ -1,12 +1,8 @@ { - "ignorePatterns": [ - "projects/**/*" - ], + "ignorePatterns": ["projects/**/*"], "overrides": [ { - "files": [ - "*.ts" - ], + "files": ["*.ts"], "extends": [ "eslint:recommended", "plugin:@typescript-eslint/recommended", @@ -14,6 +10,7 @@ "plugin:@angular-eslint/template/process-inline-templates" ], "rules": { + // eslint-disable-line import/newline-after-import "@angular-eslint/directive-selector": [ "error", { @@ -37,9 +34,7 @@ } }, { - "files": [ - "*.html" - ], + "files": ["*.html"], "extends": [ "plugin:@angular-eslint/template/recommended", "plugin:@angular-eslint/template/accessibility" diff --git a/packages/@uppy/angular/angular.json b/packages/@uppy/angular/angular.json index b0febadbde..3aa602c2de 100644 --- a/packages/@uppy/angular/angular.json +++ b/packages/@uppy/angular/angular.json @@ -28,10 +28,7 @@ "builder": "@angular-devkit/build-angular:karma", "options": { "tsConfig": "projects/uppy/angular/tsconfig.spec.json", - "polyfills": [ - "zone.js", - "zone.js/testing" - ] + "polyfills": ["zone.js", "zone.js/testing"] } } } diff --git a/packages/@uppy/angular/projects/uppy/angular/.eslintrc.json b/packages/@uppy/angular/projects/uppy/angular/.eslintrc.json index 2ab1305077..67ef3094ec 100644 --- a/packages/@uppy/angular/projects/uppy/angular/.eslintrc.json +++ b/packages/@uppy/angular/projects/uppy/angular/.eslintrc.json @@ -1,13 +1,9 @@ { "extends": "../../../.eslintrc.json", - "ignorePatterns": [ - "!**/*" - ], + "ignorePatterns": ["!**/*"], "overrides": [ { - "files": [ - "*.ts" - ], + "files": ["*.ts"], "parserOptions": { "project": [ "packages/@uppy/angular/projects/angular/tsconfig.lib.json", @@ -43,9 +39,7 @@ } }, { - "files": [ - "*.html" - ], + "files": ["*.html"], "rules": {} } ] diff --git a/packages/@uppy/angular/projects/uppy/angular/ng-package.json b/packages/@uppy/angular/projects/uppy/angular/ng-package.json index 5d14d4e69f..fab7346366 100644 --- a/packages/@uppy/angular/projects/uppy/angular/ng-package.json +++ b/packages/@uppy/angular/projects/uppy/angular/ng-package.json @@ -4,4 +4,4 @@ "lib": { "entryFile": "src/public-api.ts" } -} \ No newline at end of file +} diff --git a/packages/@uppy/angular/projects/uppy/angular/src/public-api.ts b/packages/@uppy/angular/projects/uppy/angular/src/public-api.ts index 4351587147..8a4b78bf92 100644 --- a/packages/@uppy/angular/projects/uppy/angular/src/public-api.ts +++ b/packages/@uppy/angular/projects/uppy/angular/src/public-api.ts @@ -2,13 +2,13 @@ * Public API Surface of @uppy/angular */ -export { UppyAngularDashboardModule } from './lib/components/dashboard/dashboard.module' -export { UppyAngularDashboardModalModule } from './lib/components/dashboard-modal/dashboard-modal.module' -export { UppyAngularProgressBarModule } from './lib/components/progress-bar/progress-bar.module' -export { UppyAngularStatusBarModule } from './lib/components/status-bar/status-bar.module' -export { UppyAngularDragDropModule } from './lib/components/drag-drop/drag-drop.module' -export { StatusBarComponent } from './lib/components/status-bar/status-bar.component' -export { ProgressBarComponent } from './lib/components/progress-bar/progress-bar.component' -export { DragDropComponent } from './lib/components/drag-drop/drag-drop.component' -export { DashboardComponent } from './lib/components/dashboard/dashboard.component' -export { DashboardModalComponent } from './lib/components/dashboard-modal/dashboard-modal.component' +export { UppyAngularDashboardModule } from './lib/components/dashboard/dashboard.module'; +export { UppyAngularDashboardModalModule } from './lib/components/dashboard-modal/dashboard-modal.module'; +export { UppyAngularProgressBarModule } from './lib/components/progress-bar/progress-bar.module'; +export { UppyAngularStatusBarModule } from './lib/components/status-bar/status-bar.module'; +export { UppyAngularDragDropModule } from './lib/components/drag-drop/drag-drop.module'; +export { StatusBarComponent } from './lib/components/status-bar/status-bar.component'; +export { ProgressBarComponent } from './lib/components/progress-bar/progress-bar.component'; +export { DragDropComponent } from './lib/components/drag-drop/drag-drop.component'; +export { DashboardComponent } from './lib/components/dashboard/dashboard.component'; +export { DashboardModalComponent } from './lib/components/dashboard-modal/dashboard-modal.component'; diff --git a/packages/@uppy/angular/projects/uppy/angular/tsconfig.lib.json b/packages/@uppy/angular/projects/uppy/angular/tsconfig.lib.json index 879250df42..f73c766cf7 100644 --- a/packages/@uppy/angular/projects/uppy/angular/tsconfig.lib.json +++ b/packages/@uppy/angular/projects/uppy/angular/tsconfig.lib.json @@ -8,7 +8,5 @@ "inlineSources": true, "types": [] }, - "exclude": [ - "**/*.spec.ts" - ] + "exclude": ["**/*.spec.ts"] } diff --git a/packages/@uppy/angular/projects/uppy/angular/tsconfig.spec.json b/packages/@uppy/angular/projects/uppy/angular/tsconfig.spec.json index 80f875ef27..3a8a02edf6 100644 --- a/packages/@uppy/angular/projects/uppy/angular/tsconfig.spec.json +++ b/packages/@uppy/angular/projects/uppy/angular/tsconfig.spec.json @@ -3,12 +3,7 @@ "extends": "../../../tsconfig.json", "compilerOptions": { "outDir": "../../../out-tsc/spec", - "types": [ - "jasmine" - ] + "types": ["jasmine"] }, - "include": [ - "**/*.spec.ts", - "**/*.d.ts" - ] + "include": ["**/*.spec.ts", "**/*.d.ts"] } diff --git a/packages/@uppy/angular/tsconfig.json b/packages/@uppy/angular/tsconfig.json index 8ee11a4611..ccfa195bcb 100644 --- a/packages/@uppy/angular/tsconfig.json +++ b/packages/@uppy/angular/tsconfig.json @@ -3,9 +3,7 @@ "compileOnSave": false, "compilerOptions": { "paths": { - "@uppy/angular": [ - "dist/uppy/angular" - ] + "@uppy/angular": ["dist/uppy/angular"] }, "baseUrl": "./", "outDir": "./dist/out-tsc", @@ -24,10 +22,7 @@ "target": "ES2022", "module": "ES2022", "useDefineForClassFields": false, - "lib": [ - "ES2022", - "dom" - ] + "lib": ["ES2022", "dom"] }, "angularCompilerOptions": { "enableI18nLegacyMessageIdFormat": false, diff --git a/packages/@uppy/audio/src/style.scss b/packages/@uppy/audio/src/style.scss index e5f9ed6a64..692a31088f 100644 --- a/packages/@uppy/audio/src/style.scss +++ b/packages/@uppy/audio/src/style.scss @@ -59,14 +59,18 @@ display: block; font-size: 16px; line-height: 1.2; - padding: .4em 1em .3em .4em; + padding: 0.4em 1em 0.3em 0.4em; width: 100%; max-width: 90%; border: 1px solid $gray-600; background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23757575%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E'); background-repeat: no-repeat; - background-position: right .4em top 50%, 0 0; - background-size: .65em auto, 100%; + background-position: + right 0.4em top 50%, + 0 0; + background-size: + 0.65em auto, + 100%; margin: auto; margin-bottom: 10px; white-space: nowrap; @@ -78,9 +82,9 @@ } } - .uppy-Audio-audioSource-select::-ms-expand { - display: none; - } +.uppy-Audio-audioSource-select::-ms-expand { + display: none; +} .uppy-Audio-buttonContainer { width: 50%; @@ -120,7 +124,7 @@ background-color: darken($red, 5%); } - [data-uppy-theme="dark"] & { + [data-uppy-theme='dark'] & { @include blue-border-focus--dark; } } @@ -187,7 +191,7 @@ text-align: center; color: $gray-800; - [data-uppy-theme="dark"] & { + [data-uppy-theme='dark'] & { color: $gray-200; } } diff --git a/packages/@uppy/aws-s3-multipart/types/chunk.d.ts b/packages/@uppy/aws-s3-multipart/types/chunk.d.ts index 2a9980d33b..a01c6b5289 100644 --- a/packages/@uppy/aws-s3-multipart/types/chunk.d.ts +++ b/packages/@uppy/aws-s3-multipart/types/chunk.d.ts @@ -1,7 +1,7 @@ export interface Chunk { - getData: () => Blob - onProgress: (ev: ProgressEvent) => void - onComplete: (etag: string) => void - shouldUseMultipart: boolean - setAsUploaded?: () => void + getData: () => Blob + onProgress: (ev: ProgressEvent) => void + onComplete: (etag: string) => void + shouldUseMultipart: boolean + setAsUploaded?: () => void } diff --git a/packages/@uppy/aws-s3-multipart/types/index.d.ts b/packages/@uppy/aws-s3-multipart/types/index.d.ts index ef53079b9f..40adc5b8ea 100644 --- a/packages/@uppy/aws-s3-multipart/types/index.d.ts +++ b/packages/@uppy/aws-s3-multipart/types/index.d.ts @@ -2,19 +2,21 @@ import type { BasePlugin, PluginOptions, UppyFile } from '@uppy/core' type MaybePromise = T | Promise -export type AwsS3UploadParameters = { - method: 'POST' - url: string - fields: Record - expires?: number - headers?: Record -} | { - method?: 'PUT' - url: string - fields?: Record - expires?: number - headers?: Record -} +export type AwsS3UploadParameters = + | { + method: 'POST' + url: string + fields: Record + expires?: number + headers?: Record + } + | { + method?: 'PUT' + url: string + fields?: Record + expires?: number + headers?: Record + } export interface AwsS3Part { PartNumber?: number @@ -44,88 +46,101 @@ type AWSS3NonMultipartWithCompanionMandatory = { } type AWSS3NonMultipartWithoutCompanionMandatory = { - getUploadParameters: ( - file: UppyFile - ) => MaybePromise + getUploadParameters: (file: UppyFile) => MaybePromise } type AWSS3NonMultipartWithCompanion = AWSS3WithCompanion & - AWSS3NonMultipartWithCompanionMandatory & - { - shouldUseMultipart: false - createMultipartUpload?: never - listParts?: never - signPart?: never - abortMultipartUpload?: never - completeMultipartUpload?: never - } + AWSS3NonMultipartWithCompanionMandatory & { + shouldUseMultipart: false + createMultipartUpload?: never + listParts?: never + signPart?: never + abortMultipartUpload?: never + completeMultipartUpload?: never + } type AWSS3NonMultipartWithoutCompanion = AWSS3WithoutCompanion & - AWSS3NonMultipartWithoutCompanionMandatory & - { - shouldUseMultipart: false - createMultipartUpload?: never - listParts?: never - signPart?: never - abortMultipartUpload?: never - completeMultipartUpload?: never - } + AWSS3NonMultipartWithoutCompanionMandatory & { + shouldUseMultipart: false + createMultipartUpload?: never + listParts?: never + signPart?: never + abortMultipartUpload?: never + completeMultipartUpload?: never + } type AWSS3MultipartWithoutCompanionMandatory = { getChunkSize?: (file: UppyFile) => number createMultipartUpload: ( - file: UppyFile + file: UppyFile, ) => MaybePromise<{ uploadId: string; key: string }> listParts: ( file: UppyFile, - opts: { uploadId: string; key: string; signal: AbortSignal } + opts: { uploadId: string; key: string; signal: AbortSignal }, ) => MaybePromise abortMultipartUpload: ( file: UppyFile, - opts: { uploadId: string; key: string; signal: AbortSignal } + opts: { uploadId: string; key: string; signal: AbortSignal }, ) => MaybePromise completeMultipartUpload: ( file: UppyFile, - opts: { uploadId: string; key: string; parts: AwsS3Part[]; signal: AbortSignal } + opts: { + uploadId: string + key: string + parts: AwsS3Part[] + signal: AbortSignal + }, ) => MaybePromise<{ location?: string }> -} & ({ - signPart: ( - file: UppyFile, - opts: { uploadId: string; key: string; partNumber: number; body: Blob; signal: AbortSignal } - ) => MaybePromise -} | { - /** @deprecated Use signPart instead */ - prepareUploadParts: ( - file: UppyFile, - partData: { uploadId: string; key: string; parts: [{ number: number, chunk: Blob }] } - ) => MaybePromise<{ presignedUrls: Record, headers?: Record> }> -}) +} & ( + | { + signPart: ( + file: UppyFile, + opts: { + uploadId: string + key: string + partNumber: number + body: Blob + signal: AbortSignal + }, + ) => MaybePromise + } + | { + /** @deprecated Use signPart instead */ + prepareUploadParts: ( + file: UppyFile, + partData: { + uploadId: string + key: string + parts: [{ number: number; chunk: Blob }] + }, + ) => MaybePromise<{ + presignedUrls: Record + headers?: Record> + }> + } +) type AWSS3MultipartWithoutCompanion = AWSS3WithoutCompanion & - AWSS3MultipartWithoutCompanionMandatory & - { - shouldUseMultipart?: true - getUploadParameters?: never - } + AWSS3MultipartWithoutCompanionMandatory & { + shouldUseMultipart?: true + getUploadParameters?: never + } type AWSS3MultipartWithCompanion = AWSS3WithCompanion & - Partial & - { - shouldUseMultipart?: true - getUploadParameters?: never - } + Partial & { + shouldUseMultipart?: true + getUploadParameters?: never + } type AWSS3MaybeMultipartWithCompanion = AWSS3WithCompanion & - Partial & - AWSS3NonMultipartWithCompanionMandatory & - { - shouldUseMultipart: ((file: UppyFile) => boolean) - } + Partial & + AWSS3NonMultipartWithCompanionMandatory & { + shouldUseMultipart: (file: UppyFile) => boolean + } type AWSS3MaybeMultipartWithoutCompanion = AWSS3WithoutCompanion & - AWSS3MultipartWithoutCompanionMandatory & - AWSS3NonMultipartWithoutCompanionMandatory & - { - shouldUseMultipart: ((file: UppyFile) => boolean) - } + AWSS3MultipartWithoutCompanionMandatory & + AWSS3NonMultipartWithoutCompanionMandatory & { + shouldUseMultipart: (file: UppyFile) => boolean + } type AWSS3WithCompanion = { companionUrl: string @@ -137,24 +152,27 @@ type AWSS3WithoutCompanion = { companionUrl?: never companionHeaders?: never companionCookiesRule?: never - getTemporarySecurityCredentials?: (options?: {signal?: AbortSignal}) => MaybePromise + getTemporarySecurityCredentials?: (options?: { + signal?: AbortSignal + }) => MaybePromise } interface _AwsS3MultipartOptions extends PluginOptions { - allowedMetaFields?: string[] | null - limit?: number - retryDelays?: number[] | null + allowedMetaFields?: string[] | null + limit?: number + retryDelays?: number[] | null } -export type AwsS3MultipartOptions = _AwsS3MultipartOptions & (AWSS3NonMultipartWithCompanion | - AWSS3NonMultipartWithoutCompanion | - AWSS3MultipartWithCompanion | - AWSS3MultipartWithoutCompanion | - AWSS3MaybeMultipartWithCompanion | - AWSS3MaybeMultipartWithoutCompanion) +export type AwsS3MultipartOptions = _AwsS3MultipartOptions & + ( + | AWSS3NonMultipartWithCompanion + | AWSS3NonMultipartWithoutCompanion + | AWSS3MultipartWithCompanion + | AWSS3MultipartWithoutCompanion + | AWSS3MaybeMultipartWithCompanion + | AWSS3MaybeMultipartWithoutCompanion + ) -declare class AwsS3Multipart extends BasePlugin< - AwsS3MultipartOptions -> {} +declare class AwsS3Multipart extends BasePlugin {} export default AwsS3Multipart diff --git a/packages/@uppy/aws-s3-multipart/types/index.test-d.ts b/packages/@uppy/aws-s3-multipart/types/index.test-d.ts index 4ccadd71a8..1287eca958 100644 --- a/packages/@uppy/aws-s3-multipart/types/index.test-d.ts +++ b/packages/@uppy/aws-s3-multipart/types/index.test-d.ts @@ -8,17 +8,17 @@ import type { AwsS3Part } from '..' const uppy = new Uppy() uppy.use(AwsS3Multipart, { shouldUseMultipart: true, - createMultipartUpload (file) { + createMultipartUpload(file) { expectType(file) return { uploadId: '', key: '' } }, - listParts (file, opts) { + listParts(file, opts) { expectType(file) expectType(opts.uploadId) expectType(opts.key) return [] }, - signPart (file, opts) { + signPart(file, opts) { expectType(file) expectType(opts.uploadId) expectType(opts.key) @@ -26,12 +26,12 @@ import type { AwsS3Part } from '..' expectType(opts.signal) return { url: '' } }, - abortMultipartUpload (file, opts) { + abortMultipartUpload(file, opts) { expectType(file) expectType(opts.uploadId) expectType(opts.key) }, - completeMultipartUpload (file, opts) { + completeMultipartUpload(file, opts) { expectType(file) expectType(opts.uploadId) expectType(opts.key) @@ -44,7 +44,15 @@ import type { AwsS3Part } from '..' { const uppy = new Uppy() expectError(uppy.use(AwsS3Multipart, { companionUrl: '', getChunkSize: 100 })) - expectError(uppy.use(AwsS3Multipart, { companionUrl: '', getChunkSize: () => 'not a number' })) + expectError( + uppy.use(AwsS3Multipart, { + companionUrl: '', + getChunkSize: () => 'not a number', + }), + ) uppy.use(AwsS3Multipart, { companionUrl: '', getChunkSize: () => 100 }) - uppy.use(AwsS3Multipart, { companionUrl: '', getChunkSize: (file) => file.size }) + uppy.use(AwsS3Multipart, { + companionUrl: '', + getChunkSize: (file) => file.size, + }) } diff --git a/packages/@uppy/aws-s3/types/index.d.ts b/packages/@uppy/aws-s3/types/index.d.ts index 04b1104140..7a146aec15 100644 --- a/packages/@uppy/aws-s3/types/index.d.ts +++ b/packages/@uppy/aws-s3/types/index.d.ts @@ -3,34 +3,36 @@ import type { BasePlugin, Locale, PluginOptions, UppyFile } from '@uppy/core' type MaybePromise = T | Promise -export type AwsS3UploadParameters = { - method?: 'POST' - url: string - fields?: Record - expires?: number - headers?: Record -} | { - method: 'PUT' - url: string - fields?: Record - expires?: number - headers?: Record -} +export type AwsS3UploadParameters = + | { + method?: 'POST' + url: string + fields?: Record + expires?: number + headers?: Record + } + | { + method: 'PUT' + url: string + fields?: Record + expires?: number + headers?: Record + } interface LegacyAwsS3Options extends PluginOptions { - shouldUseMultipart?: never - companionUrl?: string | null - companionHeaders?: Record - allowedMetaFields?: Array | null - getUploadParameters?: (file: UppyFile) => MaybePromise - limit?: number - /** @deprecated this option will not be supported in future versions of this plugin */ - getResponseData?: (responseText: string, response: XMLHttpRequest) => void - locale?: Locale, - timeout?: number - } + shouldUseMultipart?: never + companionUrl?: string | null + companionHeaders?: Record + allowedMetaFields?: Array | null + getUploadParameters?: (file: UppyFile) => MaybePromise + limit?: number + /** @deprecated this option will not be supported in future versions of this plugin */ + getResponseData?: (responseText: string, response: XMLHttpRequest) => void + locale?: Locale + timeout?: number +} -export type AwsS3Options = LegacyAwsS3Options | AwsS3MultipartOptions; +export type AwsS3Options = LegacyAwsS3Options | AwsS3MultipartOptions declare class AwsS3 extends BasePlugin {} diff --git a/packages/@uppy/aws-s3/types/index.test-d.ts b/packages/@uppy/aws-s3/types/index.test-d.ts index 0e922b81bc..02f244f0e3 100644 --- a/packages/@uppy/aws-s3/types/index.test-d.ts +++ b/packages/@uppy/aws-s3/types/index.test-d.ts @@ -6,49 +6,53 @@ import AwsS3 from '..' { const uppy = new Uppy() uppy.use(AwsS3, { - getUploadParameters (file) { + getUploadParameters(file) { expectType(file) return { method: 'POST', url: '' } }, }) - expectError(uppy.use(AwsS3, { - shouldUseMultipart: false, - getUploadParameters (file) { - expectType(file) - return { method: 'POST', url: '' } - }, - })) + expectError( + uppy.use(AwsS3, { + shouldUseMultipart: false, + getUploadParameters(file) { + expectType(file) + return { method: 'POST', url: '' } + }, + }), + ) uppy.use(AwsS3, { shouldUseMultipart: false, - getUploadParameters (file) { + getUploadParameters(file) { expectType(file) return { method: 'POST', url: '', fields: {} } }, }) - expectError(uppy.use(AwsS3, { - shouldUseMultipart: true, - getUploadParameters (file) { - expectType(file) - return { method: 'PUT', url: '' } - }, - })) + expectError( + uppy.use(AwsS3, { + shouldUseMultipart: true, + getUploadParameters(file) { + expectType(file) + return { method: 'PUT', url: '' } + }, + }), + ) uppy.use(AwsS3, { shouldUseMultipart: () => Math.random() > 0.5, - getUploadParameters (file) { + getUploadParameters(file) { expectType(file) return { method: 'PUT', url: '' } }, - createMultipartUpload (file) { + createMultipartUpload(file) { expectType(file) return { uploadId: '', key: '' } }, - listParts (file, opts) { + listParts(file, opts) { expectType(file) expectType(opts.uploadId) expectType(opts.key) return [] }, - signPart (file, opts) { + signPart(file, opts) { expectType(file) expectType(opts.uploadId) expectType(opts.key) @@ -56,12 +60,12 @@ import AwsS3 from '..' expectType(opts.signal) return { url: '' } }, - abortMultipartUpload (file, opts) { + abortMultipartUpload(file, opts) { expectType(file) expectType(opts.uploadId) expectType(opts.key) }, - completeMultipartUpload (file, opts) { + completeMultipartUpload(file, opts) { expectType(file) expectType(opts.uploadId) expectType(opts.key) diff --git a/packages/@uppy/box/types/index.d.ts b/packages/@uppy/box/types/index.d.ts index e081c786f9..4700dcf8cc 100644 --- a/packages/@uppy/box/types/index.d.ts +++ b/packages/@uppy/box/types/index.d.ts @@ -1,10 +1,13 @@ import type { PluginTarget, UIPlugin, UIPluginOptions } from '@uppy/core' -import type { PublicProviderOptions, TokenStorage } from '@uppy/companion-client' +import type { + PublicProviderOptions, + TokenStorage, +} from '@uppy/companion-client' interface BoxOptions extends UIPluginOptions, PublicProviderOptions { - target?: PluginTarget - title?: string - storage?: TokenStorage + target?: PluginTarget + title?: string + storage?: TokenStorage } declare class Box extends UIPlugin {} diff --git a/packages/@uppy/companion-client/types/index.d.ts b/packages/@uppy/companion-client/types/index.d.ts index 8cea2392d7..6f7c78c39a 100644 --- a/packages/@uppy/companion-client/types/index.d.ts +++ b/packages/@uppy/companion-client/types/index.d.ts @@ -19,31 +19,47 @@ export interface RequestClientOptions { } type RequestOptions = { - skipPostResponse?: boolean, - signal?: AbortSignal, + skipPostResponse?: boolean + signal?: AbortSignal } export class RequestClient { - constructor (uppy: Uppy, opts: RequestClientOptions) + constructor(uppy: Uppy, opts: RequestClientOptions) readonly hostname: string setCompanionHeaders(headers: CompanionHeaders): void - get (path: string, options?: RequestOptions): Promise + get(path: string, options?: RequestOptions): Promise /** @deprecated use option bag instead */ - get (path: string, skipPostResponse: boolean): Promise + get(path: string, skipPostResponse: boolean): Promise - post (path: string, data: Record, options?: RequestOptions): Promise + post( + path: string, + data: Record, + options?: RequestOptions, + ): Promise /** @deprecated use option bag instead */ - post (path: string, data: Record, skipPostResponse: boolean): Promise - - delete (path: string, data?: Record, options?: RequestOptions): Promise + post( + path: string, + data: Record, + skipPostResponse: boolean, + ): Promise + + delete( + path: string, + data?: Record, + options?: RequestOptions, + ): Promise /** @deprecated use option bag instead */ - delete (path: string, data: Record, skipPostResponse: boolean): Promise + delete( + path: string, + data: Record, + skipPostResponse: boolean, + ): Promise } /** @@ -64,19 +80,23 @@ export interface ProviderOptions extends PublicProviderOptions { } export class Provider extends RequestClient { - constructor (uppy: Uppy, opts: ProviderOptions) + constructor(uppy: Uppy, opts: ProviderOptions) - checkAuth (): Promise + checkAuth(): Promise - authUrl (): string + authUrl(): string - fileUrl (id: string): string + fileUrl(id: string): string - list (directory: string): Promise + list(directory: string): Promise - logout (redirect?: string): Promise + logout(redirect?: string): Promise - static initPlugin (plugin: unknown, opts: Record, defaultOpts?: Record): void + static initPlugin( + plugin: unknown, + opts: Record, + defaultOpts?: Record, + ): void } export interface SocketOptions { @@ -87,17 +107,17 @@ export interface SocketOptions { export class Socket { readonly isOpen: boolean - constructor (opts: SocketOptions) + constructor(opts: SocketOptions) - open (): void + open(): void - close (): void + close(): void - send (action: string, payload: unknown): void + send(action: string, payload: unknown): void - on (action: string, handler: (param: any) => void): void + on(action: string, handler: (param: any) => void): void - once (action: string, handler: (param: any) => void): void + once(action: string, handler: (param: any) => void): void - emit (action: string, payload: (param: any) => void): void + emit(action: string, payload: (param: any) => void): void } diff --git a/packages/@uppy/companion/infra/kube/companion/companion-kube.yaml b/packages/@uppy/companion/infra/kube/companion/companion-kube.yaml index d465ccd8da..05e13b8f67 100644 --- a/packages/@uppy/companion/infra/kube/companion/companion-kube.yaml +++ b/packages/@uppy/companion/infra/kube/companion/companion-kube.yaml @@ -3,13 +3,13 @@ kind: Service metadata: name: companion namespace: companion - labels: + labels: app: companion spec: ports: - - port: 80 - targetPort: 3020 - protocol: TCP + - port: 80 + targetPort: 3020 + protocol: TCP selector: app: companion --- @@ -25,32 +25,32 @@ spec: replicas: 2 updateStrategy: type: RollingUpdate - serviceName: "companion" + serviceName: 'companion' template: metadata: labels: app: companion spec: containers: - - image: docker.io/transloadit/companion:latest - imagePullPolicy: Always - name: companion - envFrom: - - secretRef: - name: companion-env - ports: - - containerPort: 3020 - volumeMounts: - - name: companion-data - mountPath: /mnt/companion-data + - image: docker.io/transloadit/companion:latest + imagePullPolicy: Always + name: companion + envFrom: + - secretRef: + name: companion-env + ports: + - containerPort: 3020 + volumeMounts: + - name: companion-data + mountPath: /mnt/companion-data volumeClaimTemplates: - - metadata: - name: companion-data - spec: - accessModes: [ "ReadWriteOnce" ] - resources: - requests: - storage: 10Gi + - metadata: + name: companion-data + spec: + accessModes: ['ReadWriteOnce'] + resources: + requests: + storage: 10Gi --- apiVersion: extensions/v1beta1 kind: Ingress @@ -58,10 +58,10 @@ metadata: name: companion namespace: companion annotations: - kubernetes.io/tls-acme: "true" - kubernetes.io/ingress.class: "nginx" - certmanager.k8s.io/cluster-issuer: "letsencrypt-prod" - certmanager.k8s.io/acme-http01-edit-in-place: "true" + kubernetes.io/tls-acme: 'true' + kubernetes.io/ingress.class: 'nginx' + certmanager.k8s.io/cluster-issuer: 'letsencrypt-prod' + certmanager.k8s.io/acme-http01-edit-in-place: 'true' spec: tls: - secretName: server-tls @@ -69,22 +69,22 @@ spec: - companion.uppy.io - secretName: uppy-tls hosts: - - server.uppy.io + - server.uppy.io rules: - - host: companion.uppy.io - http: - paths: - - path: / - backend: - serviceName: companion - servicePort: 80 - - host: server.uppy.io - http: - paths: - - path: / - backend: - serviceName: companion - servicePort: 80 + - host: companion.uppy.io + http: + paths: + - path: / + backend: + serviceName: companion + servicePort: 80 + - host: server.uppy.io + http: + paths: + - path: / + backend: + serviceName: companion + servicePort: 80 --- apiVersion: autoscaling/v1 kind: HorizontalPodAutoscaler @@ -98,4 +98,4 @@ spec: name: companion minReplicas: 1 maxReplicas: 5 - targetCPUUtilizationPercentage: 80 \ No newline at end of file + targetCPUUtilizationPercentage: 80 diff --git a/packages/@uppy/companion/nodemon.json b/packages/@uppy/companion/nodemon.json index 856a794505..42012c5513 100644 --- a/packages/@uppy/companion/nodemon.json +++ b/packages/@uppy/companion/nodemon.json @@ -1,13 +1,13 @@ { - "restartable": "rs", - "verbose": true, - "env": { - "NODE_ENV": "development", - "DEBUG": "app:*", - "DEBUG_COLORS": true - }, - "debug": true, - "watch": ["/app/", "/src/"], - "ext": "js dust html ejs css scss rb json htpasswd", - "exec": "node /app/lib/standalone/start-server.js" -} \ No newline at end of file + "restartable": "rs", + "verbose": true, + "env": { + "NODE_ENV": "development", + "DEBUG": "app:*", + "DEBUG_COLORS": true + }, + "debug": true, + "watch": ["/app/", "/src/"], + "ext": "js dust html ejs css scss rb json htpasswd", + "exec": "node /app/lib/standalone/start-server.js" +} diff --git a/packages/@uppy/companion/src/server/provider/error.d.ts b/packages/@uppy/companion/src/server/provider/error.d.ts index 29ce604bcf..e6aaed6288 100644 --- a/packages/@uppy/companion/src/server/provider/error.d.ts +++ b/packages/@uppy/companion/src/server/provider/error.d.ts @@ -11,6 +11,9 @@ export class ProviderAuthError extends ProviderApiError { constructor() } -export function errorToResponse(anyError: Error): { code: number, message: string } +export function errorToResponse(anyError: Error): { + code: number + message: string +} export function respondWithError(anyError: Error, res: any): boolean diff --git a/packages/@uppy/companion/tsconfig.json b/packages/@uppy/companion/tsconfig.json index cb42df19a1..ac532cc3d4 100644 --- a/packages/@uppy/companion/tsconfig.json +++ b/packages/@uppy/companion/tsconfig.json @@ -11,7 +11,5 @@ "checkJs": true, "noEmitOnError": true }, - "include": [ - "src/**/*" - ] + "include": ["src/**/*"] } diff --git a/packages/@uppy/compressor/types/index.d.ts b/packages/@uppy/compressor/types/index.d.ts index 8137a08010..5562d4badc 100644 --- a/packages/@uppy/compressor/types/index.d.ts +++ b/packages/@uppy/compressor/types/index.d.ts @@ -8,7 +8,9 @@ export interface CompressorOptions extends PluginOptions { locale?: CompressorLocale } -export type CompressorCompleteCallback = (files: UppyFile[]) => void; +export type CompressorCompleteCallback = ( + files: UppyFile[], +) => void declare module '@uppy/core' { export interface UppyEventMap { diff --git a/packages/@uppy/core/src/_common.scss b/packages/@uppy/core/src/_common.scss index 563e1eca66..1dcea0cc3f 100644 --- a/packages/@uppy/core/src/_common.scss +++ b/packages/@uppy/core/src/_common.scss @@ -15,8 +15,8 @@ // One selector uses the dir attribute declared by the page. If that does not exist, Uppy adds a // fallback dir attribute on the root element itself, and we need a second selector to match that. -[dir="rtl"] .uppy-Root, -.uppy-Root[dir="rtl"] { +[dir='rtl'] .uppy-Root, +.uppy-Root[dir='rtl'] { text-align: right; } @@ -40,7 +40,7 @@ line-height: 1; } -[dir="rtl"] .uppy-u-reset { +[dir='rtl'] .uppy-u-reset { text-align: right; } @@ -65,13 +65,13 @@ box-shadow: 0 0 0 3px rgba($blue, 0.15); } - [data-uppy-theme="dark"] & { + [data-uppy-theme='dark'] & { color: $gray-200; background-color: $gray-800; border-color: $gray-800; } - [data-uppy-theme="dark"] &:focus { + [data-uppy-theme='dark'] &:focus { border-color: $gray-700; box-shadow: none; } @@ -107,7 +107,9 @@ user-select: none; // Override right-to-left variant of the uppy-u-reset class - [dir="rtl"] & { text-align: center; } + [dir='rtl'] & { + text-align: center; + } } .uppy-c-btn:not(:disabled):not(.disabled) { @@ -138,7 +140,7 @@ padding: 13px 22px; } - [data-uppy-theme="dark"] & { + [data-uppy-theme='dark'] & { color: $gray-200; @include blue-border-focus--dark; @@ -166,13 +168,13 @@ padding: 13px 18px; } - [data-uppy-theme="dark"] & { + [data-uppy-theme='dark'] & { color: $gray-200; @include blue-border-focus--dark; } - [data-uppy-theme="dark"] &:hover { + [data-uppy-theme='dark'] &:hover { color: $gray-500; } } diff --git a/packages/@uppy/core/src/_utils.scss b/packages/@uppy/core/src/_utils.scss index 1e4264214b..77fc4a26d6 100644 --- a/packages/@uppy/core/src/_utils.scss +++ b/packages/@uppy/core/src/_utils.scss @@ -37,7 +37,7 @@ $focus-shadow: 0 0 0 3px rgba($blue, 0.5); background-color: $highlight; } - [data-uppy-theme="dark"] &:focus { + [data-uppy-theme='dark'] &:focus { background-color: $gray-800; } } diff --git a/packages/@uppy/core/src/_variables.scss b/packages/@uppy/core/src/_variables.scss index 1450a25733..500440719d 100644 --- a/packages/@uppy/core/src/_variables.scss +++ b/packages/@uppy/core/src/_variables.scss @@ -1,7 +1,10 @@ // Fonts -$font-family-base: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", "Segoe UI Symbol", "Segoe UI Emoji", "Apple Color Emoji", Roboto, Helvetica, Arial, sans-serif !default; -$font-family-mono: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace !default; +$font-family-base: -apple-system, system-ui, BlinkMacSystemFont, 'Segoe UI', + 'Segoe UI Symbol', 'Segoe UI Emoji', 'Apple Color Emoji', Roboto, Helvetica, + Arial, sans-serif !default; +$font-family-mono: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', + 'Courier New', monospace !default; // Colors diff --git a/packages/@uppy/core/types/index.d.ts b/packages/@uppy/core/types/index.d.ts index 1ba322e30f..8ee4a343b5 100644 --- a/packages/@uppy/core/types/index.d.ts +++ b/packages/@uppy/core/types/index.d.ts @@ -13,18 +13,18 @@ export interface IndexedObject { // These are defined in @uppy/utils instead of core so it can be used there without creating import cycles export type UppyFile< TMeta extends IndexedObject = Record, - TBody extends IndexedObject = Record - > = UppyUtils.UppyFile + TBody extends IndexedObject = Record, +> = UppyUtils.UppyFile -export type FileProgress = UppyUtils.FileProgress; +export type FileProgress = UppyUtils.FileProgress -export type FileRemoveReason = 'removed-by-user' | 'cancel-all'; +export type FileRemoveReason = 'removed-by-user' | 'cancel-all' // Replace the `meta` property type with one that allows omitting internal metadata addFile() will add that -type UppyFileWithoutMeta, TBody extends IndexedObject> = OmitKey< - UppyFile, - 'meta' -> +type UppyFileWithoutMeta< + TMeta extends IndexedObject, + TBody extends IndexedObject, +> = OmitKey, 'meta'> type LocaleStrings = { [K in TNames]?: string | { [n: number]: string } @@ -39,23 +39,23 @@ export type Store = UppyUtils.Store export type InternalMetadata = UppyUtils.InternalMetadata export interface UploadedUppyFile< - TMeta extends IndexedObject, - TBody extends IndexedObject - > extends UppyFile { + TMeta extends IndexedObject, + TBody extends IndexedObject, +> extends UppyFile { uploadURL: string } export interface FailedUppyFile< - TMeta extends IndexedObject, - TBody extends IndexedObject - > extends UppyFile { + TMeta extends IndexedObject, + TBody extends IndexedObject, +> extends UppyFile { error: string } export interface AddFileOptions< - TMeta extends IndexedObject = IndexedObject, - TBody extends IndexedObject = IndexedObject - > extends Partial> { + TMeta extends IndexedObject = IndexedObject, + TBody extends IndexedObject = IndexedObject, +> extends Partial> { // `.data` is the only required property here. data: Blob | File meta?: Partial & TMeta @@ -95,7 +95,9 @@ export class BasePlugin { uninstall(): void } -export class UIPlugin extends BasePlugin { +export class UIPlugin< + TOptions extends UIPluginOptions = DefaultPluginOptions, +> extends BasePlugin { id: string // eslint-disable-next-line no-use-before-define @@ -137,9 +139,9 @@ export interface Locale { } export interface Logger { - debug: (...args: any[]) => void; - warn: (...args: any[]) => void; - error: (...args: any[]) => void; + debug: (...args: any[]) => void + warn: (...args: any[]) => void + error: (...args: any[]) => void } export interface Restrictions { @@ -151,7 +153,9 @@ export interface Restrictions { allowedFileTypes?: string[] | null } -export interface UppyOptions = Record> { +export interface UppyOptions< + TMeta extends IndexedObject = Record, +> { id?: string autoProceed?: boolean /** @@ -165,7 +169,7 @@ export interface UppyOptions = Record, - files: { [key: string]: UppyFile } + files: { [key: string]: UppyFile }, ) => UppyFile | boolean | undefined onBeforeUpload?: (files: { [key: string]: UppyFile @@ -177,23 +181,21 @@ export interface UppyOptions = Record = Record, - TBody extends IndexedObject = Record - > { + TBody extends IndexedObject = Record, +> { successful: UploadedUppyFile[] failed: FailedUppyFile[] } export interface State< TMeta extends IndexedObject = Record, - TBody extends IndexedObject = Record - > extends IndexedObject { + TBody extends IndexedObject = Record, +> extends IndexedObject { capabilities?: { resumableUploads?: boolean } currentUploads: Record error?: string files: { - [key: string]: - | UploadedUppyFile - | FailedUppyFile + [key: string]: UploadedUppyFile | FailedUppyFile } info?: Array<{ isHidden: boolean @@ -213,42 +215,63 @@ export interface ErrorResponse { export interface SuccessResponse { uploadURL?: string status?: number - body?: any, + body?: any bytesUploaded?: number } -export type GenericEventCallback = () => void; -export type FileAddedCallback> = (file: UppyFile) => void; -export type FilesAddedCallback> = (files: UppyFile[]) => void; -export type FileRemovedCallback> = - (file: UppyFile, reason: FileRemoveReason) => void; -export type UploadCallback = (data: { id: string, fileIDs: string[] }) => void; -export type ProgressCallback = (progress: number) => void; -export type PreProcessCompleteCallback> = (file: UppyFile | undefined) => void; -export type UploadProgressCallback> = - (file: UppyFile | undefined, progress: FileProgress) => void; -export type UploadSuccessCallback> = - (file: UppyFile | undefined, response: SuccessResponse) => void -export type UploadCompleteCallback> = (result: UploadResult) => void -export type ErrorCallback = (error: Error) => void; -export type UploadErrorCallback> = - (file: UppyFile | undefined, error: Error, response?: ErrorResponse) => void; -export type UploadRetryCallback = (fileID: string) => void; -export type RetryAllCallback = (fileIDs: string[]) => void; -export type RestrictionFailedCallback> = - (file: UppyFile | undefined, error: Error) => void; - -export interface UppyEventMap = Record> { +export type GenericEventCallback = () => void +export type FileAddedCallback> = ( + file: UppyFile, +) => void +export type FilesAddedCallback> = ( + files: UppyFile[], +) => void +export type FileRemovedCallback> = ( + file: UppyFile, + reason: FileRemoveReason, +) => void +export type UploadCallback = (data: { id: string; fileIDs: string[] }) => void +export type ProgressCallback = (progress: number) => void +export type PreProcessCompleteCallback> = ( + file: UppyFile | undefined, +) => void +export type UploadProgressCallback> = ( + file: UppyFile | undefined, + progress: FileProgress, +) => void +export type UploadSuccessCallback> = ( + file: UppyFile | undefined, + response: SuccessResponse, +) => void +export type UploadCompleteCallback> = ( + result: UploadResult, +) => void +export type ErrorCallback = (error: Error) => void +export type UploadErrorCallback> = ( + file: UppyFile | undefined, + error: Error, + response?: ErrorResponse, +) => void +export type UploadRetryCallback = (fileID: string) => void +export type RetryAllCallback = (fileIDs: string[]) => void +export type RestrictionFailedCallback> = ( + file: UppyFile | undefined, + error: Error, +) => void + +export interface UppyEventMap< + TMeta extends IndexedObject = Record, +> { 'file-added': FileAddedCallback 'files-added': FilesAddedCallback 'file-removed': FileRemovedCallback - 'upload': UploadCallback - 'progress': ProgressCallback + upload: UploadCallback + progress: ProgressCallback 'preprocess-complete': PreProcessCompleteCallback 'upload-progress': UploadProgressCallback 'upload-success': UploadSuccessCallback - 'complete': UploadCompleteCallback - 'error': ErrorCallback + complete: UploadCompleteCallback + error: ErrorCallback 'upload-error': UploadErrorCallback 'upload-retry': UploadRetryCallback 'retry-all': RetryAllCallback @@ -264,15 +287,24 @@ export class Uppy { on(event: K, callback: UppyEventMap[K]): this - on>(event: K, callback: UppyEventMap[K]): this + on>( + event: K, + callback: UppyEventMap[K], + ): this once(event: K, callback: UppyEventMap[K]): this - once>(event: K, callback: UppyEventMap[K]): this + once>( + event: K, + callback: UppyEventMap[K], + ): this off(event: K, callback: UppyEventMap[K]): this - off>(event: K, callback: UppyEventMap[K]): this + off>( + event: K, + callback: UppyEventMap[K], + ): this /** * For use by plugins only. @@ -285,7 +317,9 @@ export class Uppy { setState(patch: Record): void - getState = Record>(): State + getState< + TMeta extends IndexedObject = Record, + >(): State setFileState(fileID: string, state: Record): void @@ -303,21 +337,23 @@ export class Uppy { removeUploader(fn: UploadHandler): void - setMeta = Record>(data: TMeta): void + setMeta = Record>( + data: TMeta, + ): void setFileMeta = Record>( fileID: string, - data: TMeta + data: TMeta, ): void getFile< TMeta extends IndexedObject = Record, - TBody extends IndexedObject = Record + TBody extends IndexedObject = Record, >(fileID: string): UppyFile getFiles< TMeta extends IndexedObject = Record, - TBody extends IndexedObject = Record + TBody extends IndexedObject = Record, >(): Array> getObjectOfFilesPerState(): { @@ -339,11 +375,11 @@ export class Uppy { } addFile = Record>( - file: AddFileOptions + file: AddFileOptions, ): string addFiles = Record>( - files: AddFileOptions[] + files: AddFileOptions[], ): void removeFile(fileID: string, reason?: FileRemoveReason): void @@ -354,24 +390,29 @@ export class Uppy { resumeAll(): void - retryAll = Record>(): Promise< - UploadResult - > + retryAll< + TMeta extends IndexedObject = Record, + >(): Promise> cancelAll(options?: CancelOptions): void retryUpload = Record>( - fileID: string + fileID: string, ): Promise> getID(): string - use>( + use< + TOptions extends PluginOptions, + TInstance extends UIPlugin | BasePlugin, + >( pluginClass: new (uppy: this, opts?: TOptions) => TInstance, - opts?: TOptions + opts?: TOptions, ): this - getPlugin(name: string): TPlugin | undefined + getPlugin( + name: string, + ): TPlugin | undefined iteratePlugins(callback: (plugin: UIPlugin | BasePlugin) => void): void @@ -384,7 +425,7 @@ export class Uppy { info( message: string | { message: string; details: string }, type?: LogLevel, - duration?: number + duration?: number, ): void hideInfo(): void @@ -392,12 +433,14 @@ export class Uppy { log(msg: string, type?: LogLevel): void restore = Record>( - uploadID: string + uploadID: string, ): Promise> addResultData(uploadID: string, data: Record): void - upload = Record>(): Promise> + upload = Record>(): Promise< + UploadResult + > } export default Uppy diff --git a/packages/@uppy/core/types/index.test-d.ts b/packages/@uppy/core/types/index.test-d.ts index b04184d2a9..d993cae7a1 100644 --- a/packages/@uppy/core/types/index.test-d.ts +++ b/packages/@uppy/core/types/index.test-d.ts @@ -3,7 +3,13 @@ import { expectError, expectType } from 'tsd' import DefaultStore from '@uppy/store-default' // eslint-disable-next-line import/no-named-as-default import Uppy, { UIPlugin } from '..' -import type { UploadedUppyFile, FailedUppyFile, PluginOptions, UppyFile, SuccessResponse } from '..' +import type { + UploadedUppyFile, + FailedUppyFile, + PluginOptions, + UppyFile, + SuccessResponse, +} from '..' type anyObject = Record @@ -98,7 +104,7 @@ type anyObject = Record }) // Meta signature - type Meta = {myCustomMetadata: string} + type Meta = { myCustomMetadata: string } uppy.on<'complete', Meta>('complete', (result) => { // eslint-disable-next-line @typescript-eslint/no-unused-vars const meta = result.successful[0].meta.myCustomMetadata @@ -115,7 +121,10 @@ type anyObject = Record body?: { someValue: string } } - const onUploadSuccess = async (file: UppyFile | undefined, response: CustomResponse) => { + const onUploadSuccess = async ( + file: UppyFile | undefined, + response: CustomResponse, + ) => { const res = response.body?.someValue } uppy.on<'upload-success', Meta>('upload-success', onUploadSuccess) @@ -136,16 +145,23 @@ type anyObject = Record interface TestOptions extends PluginOptions { testOption: string } - class TestPlugin extends UIPlugin { - } + class TestPlugin extends UIPlugin {} const strict = new Uppy().use(TestPlugin, { testOption: 'hello' }) /* eslint-disable @typescript-eslint/no-non-null-assertion */ - strict.getPlugin('TestPlugin')!.setOptions({ testOption: 'world' }) - - expectError(strict.getPlugin('TestPlugin')!.setOptions({ testOption: 0 })) - - expectError(strict.getPlugin('TestPlugin')!.setOptions({ unknownKey: false })) + strict + .getPlugin('TestPlugin')! + .setOptions({ testOption: 'world' }) + + expectError( + strict.getPlugin('TestPlugin')!.setOptions({ testOption: 0 }), + ) + + expectError( + strict + .getPlugin('TestPlugin')! + .setOptions({ unknownKey: false }), + ) /* eslint-enable @typescript-eslint/no-non-null-assertion */ } diff --git a/packages/@uppy/dashboard/src/components/FileCard/index.scss b/packages/@uppy/dashboard/src/components/FileCard/index.scss index a1a7950736..b8f5b23c51 100644 --- a/packages/@uppy/dashboard/src/components/FileCard/index.scss +++ b/packages/@uppy/dashboard/src/components/FileCard/index.scss @@ -49,7 +49,7 @@ min-height: 0; border-bottom: 1px solid $gray-200; - [data-uppy-theme="dark"] & { + [data-uppy-theme='dark'] & { background-color: $gray-800; border-bottom: 0; } @@ -91,7 +91,7 @@ overflow-y: auto; -webkit-overflow-scrolling: touch; - [data-uppy-theme="dark"] & { + [data-uppy-theme='dark'] & { background-color: $gray-900; } } @@ -116,7 +116,7 @@ font-size: 14px; } - [data-uppy-theme="dark"] & { + [data-uppy-theme='dark'] & { color: $gray-200; } } @@ -143,7 +143,7 @@ height: 65px; } - [data-uppy-theme="dark"] & { + [data-uppy-theme='dark'] & { background-color: $gray-900; border-top: 1px solid $gray-800; } diff --git a/packages/@uppy/dashboard/src/components/FileItem/Buttons/index.scss b/packages/@uppy/dashboard/src/components/FileItem/Buttons/index.scss index f794600fba..08f3c5b835 100644 --- a/packages/@uppy/dashboard/src/components/FileItem/Buttons/index.scss +++ b/packages/@uppy/dashboard/src/components/FileItem/Buttons/index.scss @@ -10,13 +10,13 @@ opacity: 1; } - [data-uppy-theme="dark"] & { + [data-uppy-theme='dark'] & { @include blue-border-focus--dark; color: $gray-300; } - [data-uppy-theme="dark"] &:hover { + [data-uppy-theme='dark'] &:hover { color: $gray-200; } } @@ -50,17 +50,19 @@ top: 8px; } - [data-uppy-theme="dark"] & { + [data-uppy-theme='dark'] & { color: $gray-700; } - [data-uppy-theme="dark"] &:hover { + [data-uppy-theme='dark'] &:hover { color: $gray-800; } } // Only for mobile screens -.uppy-Dashboard:not(.uppy-size--md):not(.uppy-Dashboard--singleFile.uppy-size--height-md) { +.uppy-Dashboard:not(.uppy-size--md):not( + .uppy-Dashboard--singleFile.uppy-size--height-md + ) { // Vertically center Edit&Remove buttons on mobile .uppy-Dashboard-Item-actionWrapper { display: flex; diff --git a/packages/@uppy/dashboard/src/components/FileItem/FileInfo/index.scss b/packages/@uppy/dashboard/src/components/FileItem/FileInfo/index.scss index ff62792f36..9d5f8b775b 100644 --- a/packages/@uppy/dashboard/src/components/FileItem/FileInfo/index.scss +++ b/packages/@uppy/dashboard/src/components/FileItem/FileInfo/index.scss @@ -20,7 +20,7 @@ word-wrap: anywhere; word-break: break-all; - [data-uppy-theme="dark"] & { + [data-uppy-theme='dark'] & { color: $gray-200; } @@ -59,7 +59,7 @@ font-size: 11px; line-height: 1; - [data-uppy-theme="dark"] & { + [data-uppy-theme='dark'] & { color: $gray-400; } } @@ -124,4 +124,3 @@ display: none; } } - diff --git a/packages/@uppy/dashboard/src/components/FileItem/FilePreviewAndLink/index.scss b/packages/@uppy/dashboard/src/components/FileItem/FilePreviewAndLink/index.scss index 16e4fc4848..485625700d 100644 --- a/packages/@uppy/dashboard/src/components/FileItem/FilePreviewAndLink/index.scss +++ b/packages/@uppy/dashboard/src/components/FileItem/FilePreviewAndLink/index.scss @@ -44,7 +44,7 @@ box-shadow: inset 0 0 0 3px lighten($blue, 20%); } - [data-uppy-theme="dark"] &:focus { + [data-uppy-theme='dark'] &:focus { box-shadow: inset 0 0 0 3px darken($highlight--dark, 20%); } } diff --git a/packages/@uppy/dashboard/src/components/FileItem/index.scss b/packages/@uppy/dashboard/src/components/FileItem/index.scss index 25d4071365..b564fe9326 100644 --- a/packages/@uppy/dashboard/src/components/FileItem/index.scss +++ b/packages/@uppy/dashboard/src/components/FileItem/index.scss @@ -13,7 +13,7 @@ padding-inline-end: 0; } - [data-uppy-theme="dark"] & { + [data-uppy-theme='dark'] & { border-bottom: 1px solid $gray-800; } diff --git a/packages/@uppy/dashboard/src/style.scss b/packages/@uppy/dashboard/src/style.scss index 476abb211d..bc3490c84d 100644 --- a/packages/@uppy/dashboard/src/style.scss +++ b/packages/@uppy/dashboard/src/style.scss @@ -13,7 +13,9 @@ .uppy-transition-slideDownUp-enter { transform: translate3d(0, -105%, 0); opacity: 0.01; - transition: transform 0.25s ease-in-out, opacity 0.25s ease-in-out; + transition: + transform 0.25s ease-in-out, + opacity 0.25s ease-in-out; } .uppy-transition-slideDownUp-enter.uppy-transition-slideDownUp-enter-active { @@ -24,7 +26,9 @@ .uppy-transition-slideDownUp-leave { transform: translate3d(0, 0, 0); opacity: 1; - transition: transform 0.25s ease-in-out, opacity 0.25s ease-in-out; + transition: + transform 0.25s ease-in-out, + opacity 0.25s ease-in-out; } .uppy-transition-slideDownUp-leave.uppy-transition-slideDownUp-leave-active { @@ -35,13 +39,21 @@ // Modal open/close animations @keyframes uppy-Dashboard-fadeIn { - from { opacity: 0; } - to { opacity: 1; } + from { + opacity: 0; + } + to { + opacity: 1; + } } @keyframes uppy-Dashboard-fadeOut { - from { opacity: 1; } - to { opacity: 0; } + from { + opacity: 1; + } + to { + opacity: 0; + } } @keyframes uppy-Dashboard-slideDownAndFadeIn { @@ -98,31 +110,37 @@ z-index: $zIndex-2; } -.uppy-Dashboard--modal[aria-hidden=true] { +.uppy-Dashboard--modal[aria-hidden='true'] { display: none; } -.uppy-Dashboard--modal.uppy-Dashboard--animateOpenClose > .uppy-Dashboard-inner { - animation: uppy-Dashboard-slideDownAndFadeIn--small 0.3s cubic-bezier(0, 0, 0.2, 1); +.uppy-Dashboard--modal.uppy-Dashboard--animateOpenClose + > .uppy-Dashboard-inner { + animation: uppy-Dashboard-slideDownAndFadeIn--small 0.3s + cubic-bezier(0, 0, 0.2, 1); @media #{$screen-medium} { animation: uppy-Dashboard-slideDownAndFadeIn 0.3s cubic-bezier(0, 0, 0.2, 1); } } -.uppy-Dashboard--modal.uppy-Dashboard--animateOpenClose > .uppy-Dashboard-overlay { +.uppy-Dashboard--modal.uppy-Dashboard--animateOpenClose + > .uppy-Dashboard-overlay { animation: uppy-Dashboard-fadeIn 0.3s cubic-bezier(0, 0, 0.2, 1); } -.uppy-Dashboard--modal.uppy-Dashboard--animateOpenClose.uppy-Dashboard--isClosing > .uppy-Dashboard-inner { - animation: uppy-Dashboard-slideUpFadeOut--small 0.3s cubic-bezier(0, 0, 0.2, 1); +.uppy-Dashboard--modal.uppy-Dashboard--animateOpenClose.uppy-Dashboard--isClosing + > .uppy-Dashboard-inner { + animation: uppy-Dashboard-slideUpFadeOut--small 0.3s + cubic-bezier(0, 0, 0.2, 1); @media #{$screen-medium} { animation: uppy-Dashboard-slideUpFadeOut 0.3s cubic-bezier(0, 0, 0.2, 1); } } -.uppy-Dashboard--modal.uppy-Dashboard--animateOpenClose.uppy-Dashboard--isClosing > .uppy-Dashboard-overlay { +.uppy-Dashboard--modal.uppy-Dashboard--animateOpenClose.uppy-Dashboard--isClosing + > .uppy-Dashboard-overlay { animation: uppy-Dashboard-fadeOut 0.3s cubic-bezier(0, 0, 0.2, 1); } @@ -164,7 +182,7 @@ z-index: $zIndex-3; } - [data-uppy-theme="dark"] & { + [data-uppy-theme='dark'] & { background-color: $gray-900; } @@ -200,7 +218,8 @@ // Disallow clicking on all interactive elements .uppy-Dashboard--isDisabled { - [disabled], [aria-disabled] { + [disabled], + [aria-disabled] { pointer-events: none; cursor: not-allowed; } @@ -265,7 +284,7 @@ line-height: 1.4; } - [data-uppy-theme="dark"] & { + [data-uppy-theme='dark'] & { color: $gray-200; background-color: $gray-900; border-top: 1px solid $gray-800; @@ -290,7 +309,7 @@ font-size: inherit; vertical-align: initial; - [data-uppy-theme="dark"] & { + [data-uppy-theme='dark'] & { color: rgba($highlight--dark, 0.9); } } @@ -310,7 +329,7 @@ height: 100%; text-align: center; - [data-uppy-drag-drop-supported="true"] & { + [data-uppy-drag-drop-supported='true'] & { height: calc(100% - 14px); // to accomodate for the 7px margin margin: 7px; border: 1px dashed $gray-250; @@ -318,7 +337,9 @@ } .uppy-Dashboard-AddFilesPanel & { - height: calc(100% - 14px - 40px); // to accomodate for the 7px margin and 40px topbar height + height: calc( + 100% - 14px - 40px + ); // to accomodate for the 7px margin and 40px topbar height border: none; } @@ -326,13 +347,12 @@ border-color: $gray-300; } - [data-uppy-theme="dark"] & { + [data-uppy-theme='dark'] & { border-color: $gray-600; } } .uppy-Dashboard-AddFiles-info { - // hide on short note and “powered by” on short screens // such as CodePen, or inline dashboard with height < 400px display: none; @@ -353,7 +373,7 @@ padding-bottom: 0; } - [data-uppy-num-acquirers="0"] & { + [data-uppy-num-acquirers='0'] & { margin-top: 0; } } @@ -369,12 +389,12 @@ border-bottom: 1px solid $blue; } - [data-uppy-theme="dark"] & { + [data-uppy-theme='dark'] & { color: rgba($highlight--dark, 0.9); } - [data-uppy-theme="dark"] &:hover, - [data-uppy-theme="dark"] &:focus { + [data-uppy-theme='dark'] &:hover, + [data-uppy-theme='dark'] &:focus { border-bottom: 1px solid $highlight--dark; } } @@ -424,7 +444,7 @@ text-align: center; border-bottom: 1px solid $gray-200; - [data-uppy-theme="dark"] & { + [data-uppy-theme='dark'] & { border-bottom: 1px solid $gray-800; } @@ -460,7 +480,7 @@ margin-inline-end: 1px; } - [data-uppy-theme="dark"] & { + [data-uppy-theme='dark'] & { color: $gray-200; } } @@ -472,7 +492,7 @@ .uppy-DashboardTab-btn:hover { background-color: $gray-200--highlighted; - [data-uppy-theme="dark"] & { + [data-uppy-theme='dark'] & { background-color: $gray-800; } } @@ -481,7 +501,7 @@ .uppy-DashboardTab-btn:focus { background-color: $highlight; - [data-uppy-theme="dark"] & { + [data-uppy-theme='dark'] & { background-color: $gray-700; } } @@ -503,20 +523,22 @@ height: 32px; border-radius: 8px; background-color: #fff; - box-shadow: 0 1px 1px 0 rgba(0, 0, 0, 0.1), - 0 1px 2px 0 rgba(0, 0, 0, 0.1), - 0 2px 3px 0 rgba(0, 0, 0, 0.02); + box-shadow: + 0 1px 1px 0 rgba(0, 0, 0, 0.1), + 0 1px 2px 0 rgba(0, 0, 0, 0.1), + 0 2px 3px 0 rgba(0, 0, 0, 0.02); margin-inline-end: 10px; .uppy-size--md & { margin-inline-end: 0; } - [data-uppy-theme="dark"] & { + [data-uppy-theme='dark'] & { background-color: #323232; - box-shadow: 0 1px 1px 0 rgba(0, 0, 0, 0.2), - 0 1px 2px 0 rgba(0, 0, 0, 0.2), - 0 2px 3px 0 rgba(0, 0, 0, 0.08); + box-shadow: + 0 1px 1px 0 rgba(0, 0, 0, 0.2), + 0 1px 2px 0 rgba(0, 0, 0, 0.2), + 0 2px 3px 0 rgba(0, 0, 0, 0.08); } } @@ -535,7 +557,7 @@ .uppy-DashboardTab-iconMyDevice { color: $blue; - [data-uppy-theme="dark"] & { + [data-uppy-theme='dark'] & { color: $highlight--dark; } } @@ -543,7 +565,7 @@ .uppy-DashboardTab-iconBox { color: #0061d5; - [data-uppy-theme="dark"] & { + [data-uppy-theme='dark'] & { color: $gray-200; } } @@ -551,7 +573,7 @@ .uppy-DashboardTab-iconDropbox { color: #0061fe; - [data-uppy-theme="dark"] & { + [data-uppy-theme='dark'] & { color: $gray-200; } } @@ -559,7 +581,7 @@ .uppy-DashboardTab-iconUnsplash { color: #111; - [data-uppy-theme="dark"] & { + [data-uppy-theme='dark'] & { color: $gray-200; } } @@ -567,7 +589,7 @@ .uppy-DashboardTab-iconScreenRec { color: #2c3e50; - [data-uppy-theme="dark"] & { + [data-uppy-theme='dark'] & { color: $gray-200; } } @@ -575,7 +597,7 @@ .uppy-DashboardTab-iconAudio { color: #8030a3; - [data-uppy-theme="dark"] & { + [data-uppy-theme='dark'] & { color: #bf6ee3; } } @@ -590,7 +612,6 @@ } .uppy-DashboardContent-bar { - // For .uppy-DashboardContent-title's position: absolute position: relative; z-index: $zIndex-4; @@ -610,7 +631,7 @@ padding: 0 15px; } - [data-uppy-theme="dark"] & { + [data-uppy-theme='dark'] & { background-color: $gray-900; border-bottom: 1px solid $gray-800; } @@ -639,7 +660,7 @@ line-height: 50px; } - [data-uppy-theme="dark"] & { + [data-uppy-theme='dark'] & { color: $gray-200; } } @@ -661,7 +682,7 @@ font-size: 14px; } - [data-uppy-theme="dark"] & { + [data-uppy-theme='dark'] & { color: $highlight--dark; } } @@ -686,7 +707,7 @@ margin-inline-end: -8px; } - [data-uppy-theme="dark"] & { + [data-uppy-theme='dark'] & { color: $highlight--dark; } } @@ -741,9 +762,13 @@ border-radius: 5px; box-shadow: 0 0 10px 5px rgba($black, 0.15); - [data-uppy-theme="dark"] & { + [data-uppy-theme='dark'] & { background-color: $gray-800; - background-image: linear-gradient(0deg, $gray-900 35%, rgba($gray-900, 0.85) 100%); + background-image: linear-gradient( + 0deg, + $gray-900 35%, + rgba($gray-900, 0.85) 100% + ); } } @@ -791,7 +816,7 @@ } } -.uppy-Dashboard--singleFile .uppy-Dashboard-filesInner { +.uppy-Dashboard--singleFile .uppy-Dashboard-filesInner { display: flex; justify-content: center; align-items: center; @@ -819,7 +844,7 @@ border-radius: 3px; visibility: hidden; - [data-uppy-theme="dark"] & { + [data-uppy-theme='dark'] & { color: $gray-400; background-image: url("data:image/svg+xml,%3Csvg width='48' height='48' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M24 1v1C11.85 2 2 11.85 2 24s9.85 22 22 22 22-9.85 22-22S36.15 2 24 2V1zm0 0V0c13.254 0 24 10.746 24 24S37.254 48 24 48 0 37.254 0 24 10.746 0 24 0v1zm7.707 19.293a.999.999 0 1 1-1.414 1.414L25 16.414V34a1 1 0 1 1-2 0V16.414l-5.293 5.293a.999.999 0 1 1-1.414-1.414l7-7a.999.999 0 0 1 1.414 0l7 7z' fill='%2302BAF2' fill-rule='nonzero'/%3E%3C/svg%3E"); border-color: $highlight--dark; @@ -863,11 +888,11 @@ text-align: center; } - [data-uppy-num-acquirers="0"] & { + [data-uppy-num-acquirers='0'] & { text-align: center; } - [data-uppy-theme="dark"] & { + [data-uppy-theme='dark'] & { color: $gray-200; } @@ -894,7 +919,7 @@ line-height: 1.35; } - [data-uppy-theme="dark"] & { + [data-uppy-theme='dark'] & { color: $gray-300; } } diff --git a/packages/@uppy/dashboard/types/index.d.ts b/packages/@uppy/dashboard/types/index.d.ts index 3e16dbfe7c..ee83649d14 100644 --- a/packages/@uppy/dashboard/types/index.d.ts +++ b/packages/@uppy/dashboard/types/index.d.ts @@ -1,17 +1,27 @@ -import type { IndexedObject, PluginTarget, UIPlugin, UIPluginOptions, UppyFile } from '@uppy/core' +import type { + IndexedObject, + PluginTarget, + UIPlugin, + UIPluginOptions, + UppyFile, +} from '@uppy/core' import type { StatusBarLocale } from '@uppy/status-bar' import type { ThumbnailOptions } from '@uppy/thumbnail-generator' import DashboardLocale from './generatedLocale' type FieldRenderOptions = { - value: string, + value: string onChange: (newVal: string) => void fieldCSSClasses: { text: string } required: boolean form: string } -type PreactRender = (node: any, params: Record | null, ...children: any[]) => any +type PreactRender = ( + node: any, + params: Record | null, + ...children: any[] +) => any interface MetaField { id: string @@ -43,7 +53,7 @@ export interface DashboardOptions extends Options { metaFields?: MetaField[] | ((file: UppyFile) => MetaField[]) note?: string | null plugins?: string[] - fileManagerSelectionType?: 'files' | 'folders' | 'both'; + fileManagerSelectionType?: 'files' | 'folders' | 'both' proudlyDisplayPoweredByUppy?: boolean showLinkToFileUploadResult?: boolean showProgressDetails?: boolean @@ -66,30 +76,34 @@ export interface DashboardOptions extends Options { } declare class Dashboard extends UIPlugin { - addTarget (plugin: UIPlugin): HTMLElement + addTarget(plugin: UIPlugin): HTMLElement - hideAllPanels (): void + hideAllPanels(): void - openModal (): void + openModal(): void - closeModal (): void + closeModal(): void - isModalOpen (): boolean + isModalOpen(): boolean - render (state: Record): void + render(state: Record): void - install (): void + install(): void - uninstall (): void + uninstall(): void } export default Dashboard // Events -export type DashboardFileEditStartCallback> = (file?: UppyFile) => void; -export type DashboardFileEditCompleteCallback> = (file?: UppyFile) => void; -export type DashboardShowPlanelCallback = (id: string) => void; +export type DashboardFileEditStartCallback> = ( + file?: UppyFile, +) => void +export type DashboardFileEditCompleteCallback< + TMeta extends IndexedObject, +> = (file?: UppyFile) => void +export type DashboardShowPlanelCallback = (id: string) => void declare module '@uppy/core' { export interface UppyEventMap { 'dashboard:modal-open': GenericEventCallback diff --git a/packages/@uppy/dashboard/types/index.test-d.ts b/packages/@uppy/dashboard/types/index.test-d.ts index 21194a9ac6..dffa10cdc8 100644 --- a/packages/@uppy/dashboard/types/index.test-d.ts +++ b/packages/@uppy/dashboard/types/index.test-d.ts @@ -29,7 +29,7 @@ import Dashboard from '..' { id: 'public', name: 'Public', - render ({ value, onChange }, h) { + render({ value, onChange }, h) { expectType(value) expectType<(val: string) => void>(onChange) // `h` should be the Preact `h` @@ -74,21 +74,25 @@ import Dashboard from '..' }, }, }) - expectError(uppy.use(Dashboard, { - locale: { - strings: { - somethingThatDoesNotExist: 'wrong', + expectError( + uppy.use(Dashboard, { + locale: { + strings: { + somethingThatDoesNotExist: 'wrong', + }, }, - }, - })) + }), + ) const wrongType = 1234 - expectError(uppy.use(Dashboard, { - locale: { - strings: { - addMoreFiles: wrongType, + expectError( + uppy.use(Dashboard, { + locale: { + strings: { + addMoreFiles: wrongType, + }, }, - }, - })) + }), + ) } { const uppy = new Uppy() diff --git a/packages/@uppy/drop-target/types/index.d.ts b/packages/@uppy/drop-target/types/index.d.ts index 1688a7cae3..419a1bf898 100644 --- a/packages/@uppy/drop-target/types/index.d.ts +++ b/packages/@uppy/drop-target/types/index.d.ts @@ -1,10 +1,10 @@ import type { PluginOptions, BasePlugin } from '@uppy/core' interface DropTargetOptions extends PluginOptions { - target: string | Element; - onDragOver?: (event: MouseEvent) => void; - onDrop?: (event: MouseEvent) => void; - onDragLeave?: (event: MouseEvent) => void; + target: string | Element + onDragOver?: (event: MouseEvent) => void + onDrop?: (event: MouseEvent) => void + onDragLeave?: (event: MouseEvent) => void } declare class DropTarget extends BasePlugin {} diff --git a/packages/@uppy/dropbox/types/index.d.ts b/packages/@uppy/dropbox/types/index.d.ts index ec0d4608de..b9b6d5093e 100644 --- a/packages/@uppy/dropbox/types/index.d.ts +++ b/packages/@uppy/dropbox/types/index.d.ts @@ -1,10 +1,13 @@ import type { PluginTarget, UIPlugin, UIPluginOptions } from '@uppy/core' -import type { PublicProviderOptions, TokenStorage } from '@uppy/companion-client' +import type { + PublicProviderOptions, + TokenStorage, +} from '@uppy/companion-client' export interface DropboxOptions extends UIPluginOptions, PublicProviderOptions { - target?: PluginTarget - title?: string - storage?: TokenStorage + target?: PluginTarget + title?: string + storage?: TokenStorage } declare class Dropbox extends UIPlugin {} diff --git a/packages/@uppy/facebook/types/index.d.ts b/packages/@uppy/facebook/types/index.d.ts index b29ddd4af8..922e6f5f85 100644 --- a/packages/@uppy/facebook/types/index.d.ts +++ b/packages/@uppy/facebook/types/index.d.ts @@ -1,12 +1,17 @@ import type { PluginTarget, UIPlugin, UIPluginOptions } from '@uppy/core' -import type { PublicProviderOptions, TokenStorage } from '@uppy/companion-client' +import type { + PublicProviderOptions, + TokenStorage, +} from '@uppy/companion-client' -export interface FacebookOptions extends UIPluginOptions, PublicProviderOptions { - target?: PluginTarget - title?: string - storage?: TokenStorage +export interface FacebookOptions + extends UIPluginOptions, + PublicProviderOptions { + target?: PluginTarget + title?: string + storage?: TokenStorage } -declare class Facebook extends UIPlugin { } +declare class Facebook extends UIPlugin {} export default Facebook diff --git a/packages/@uppy/file-input/types/index.d.ts b/packages/@uppy/file-input/types/index.d.ts index 8de800f2ec..d5f4019fe5 100644 --- a/packages/@uppy/file-input/types/index.d.ts +++ b/packages/@uppy/file-input/types/index.d.ts @@ -2,10 +2,10 @@ import type { PluginTarget, UIPlugin, UIPluginOptions } from '@uppy/core' import FileInputLocale from './generatedLocale' export interface FileInputOptions extends UIPluginOptions { - target?: PluginTarget - pretty?: boolean - inputName?: string - locale?: FileInputLocale + target?: PluginTarget + pretty?: boolean + inputName?: string + locale?: FileInputLocale } declare class FileInput extends UIPlugin {} diff --git a/packages/@uppy/form/types/index.d.ts b/packages/@uppy/form/types/index.d.ts index 9d5fc69c4a..1ce5199d61 100644 --- a/packages/@uppy/form/types/index.d.ts +++ b/packages/@uppy/form/types/index.d.ts @@ -1,12 +1,12 @@ import type { PluginOptions, PluginTarget, BasePlugin } from '@uppy/core' export interface FormOptions extends PluginOptions { - target?: PluginTarget - resultName?: string - getMetaFromForm?: boolean - addResultToForm?: boolean - submitOnSuccess?: boolean - triggerUploadOnSubmit?: boolean + target?: PluginTarget + resultName?: string + getMetaFromForm?: boolean + addResultToForm?: boolean + submitOnSuccess?: boolean + triggerUploadOnSubmit?: boolean } declare class Form extends BasePlugin {} diff --git a/packages/@uppy/golden-retriever/types/index.d.ts b/packages/@uppy/golden-retriever/types/index.d.ts index dfb3e18a15..38eff203e3 100644 --- a/packages/@uppy/golden-retriever/types/index.d.ts +++ b/packages/@uppy/golden-retriever/types/index.d.ts @@ -1,9 +1,9 @@ import type { PluginOptions, BasePlugin } from '@uppy/core' interface GoldenRetrieverOptions extends PluginOptions { - expires?: number - serviceWorker?: boolean - indexedDB?: any + expires?: number + serviceWorker?: boolean + indexedDB?: any } declare class GoldenRetriever extends BasePlugin {} diff --git a/packages/@uppy/google-drive/types/index.d.ts b/packages/@uppy/google-drive/types/index.d.ts index 4cdb85644b..223b546175 100644 --- a/packages/@uppy/google-drive/types/index.d.ts +++ b/packages/@uppy/google-drive/types/index.d.ts @@ -1,12 +1,17 @@ import type { PluginTarget, UIPlugin, UIPluginOptions } from '@uppy/core' -import type { PublicProviderOptions, TokenStorage } from '@uppy/companion-client' +import type { + PublicProviderOptions, + TokenStorage, +} from '@uppy/companion-client' -export interface GoogleDriveOptions extends UIPluginOptions, PublicProviderOptions { - target?: PluginTarget - title?: string - storage?: TokenStorage +export interface GoogleDriveOptions + extends UIPluginOptions, + PublicProviderOptions { + target?: PluginTarget + title?: string + storage?: TokenStorage } -declare class GoogleDrive extends UIPlugin { } +declare class GoogleDrive extends UIPlugin {} export default GoogleDrive diff --git a/packages/@uppy/google-drive/types/index.test-d.ts b/packages/@uppy/google-drive/types/index.test-d.ts index 425eb1cdda..ffd9efa87f 100644 --- a/packages/@uppy/google-drive/types/index.test-d.ts +++ b/packages/@uppy/google-drive/types/index.test-d.ts @@ -6,4 +6,7 @@ class SomePlugin extends UIPlugin {} const uppy = new Uppy() uppy.use(GoogleDrive, { companionUrl: '' }) uppy.use(GoogleDrive, { target: SomePlugin, companionUrl: '' }) -uppy.use(GoogleDrive, { target: document.querySelector('#gdrive') || (undefined as never), companionUrl: '' }) +uppy.use(GoogleDrive, { + target: document.querySelector('#gdrive') || (undefined as never), + companionUrl: '', +}) diff --git a/packages/@uppy/image-editor/src/cropper.scss b/packages/@uppy/image-editor/src/cropper.scss index 7949fda736..2b28b3f4f8 100644 --- a/packages/@uppy/image-editor/src/cropper.scss +++ b/packages/@uppy/image-editor/src/cropper.scss @@ -66,7 +66,11 @@ overflow: hidden; outline: 1px solid #39f; outline-color: rgba(51, 153, 255, 0.75); - background: repeating-conic-gradient(rgba(0, 0, 0, 0.5) 0% 25%, rgba(255, 255, 255, 0.5) 0% 50%) 50% / 16px 16px; + background: repeating-conic-gradient( + rgba(0, 0, 0, 0.5) 0% 25%, + rgba(255, 255, 255, 0.5) 0% 50% + ) + 50% / 16px 16px; } .cropper-dashed { diff --git a/packages/@uppy/image-editor/src/inputrange.scss b/packages/@uppy/image-editor/src/inputrange.scss index 4c74472b3d..c758acfbe5 100644 --- a/packages/@uppy/image-editor/src/inputrange.scss +++ b/packages/@uppy/image-editor/src/inputrange.scss @@ -4,7 +4,7 @@ // Version 1.5.2 // MIT License -@use "sass:math"; +@use 'sass:math'; $track-color: rgba(#fff, 0.2); $thumb-color: #fff; @@ -32,7 +32,9 @@ $contrast: 5%; $ie-bottom-track-color: darken($track-color, $contrast); @mixin shadow($shadow-size, $shadow-blur, $shadow-color) { - box-shadow: $shadow-size $shadow-size $shadow-blur $shadow-color, 0 0 $shadow-size lighten($shadow-color, 5%); + box-shadow: + $shadow-size $shadow-size $shadow-blur $shadow-color, + 0 0 $shadow-size lighten($shadow-color, 5%); } @mixin track { @@ -82,7 +84,11 @@ $ie-bottom-track-color: darken($track-color, $contrast); &::-webkit-slider-runnable-track { @include track; - @include shadow($track-shadow-size, $track-shadow-blur, $track-shadow-color); + @include shadow( + $track-shadow-size, + $track-shadow-blur, + $track-shadow-color + ); background: $track-color; border: $track-border-width solid $track-border-color; @@ -92,12 +98,21 @@ $ie-bottom-track-color: darken($track-color, $contrast); &::-webkit-slider-thumb { @include thumb; - margin-top: (math.div((-$track-border-width * 2 + $track-height), 2) - math.div($thumb-height, 2)); + margin-top: ( + math.div((-$track-border-width * 2 + $track-height), 2) - math.div( + $thumb-height, + 2 + ) + ); -webkit-appearance: none; } &::-moz-range-track { - @include shadow($track-shadow-size, $track-shadow-blur, $track-shadow-color); + @include shadow( + $track-shadow-size, + $track-shadow-blur, + $track-shadow-color + ); @include track; height: $track-height; @@ -120,7 +135,11 @@ $ie-bottom-track-color: darken($track-color, $contrast); } &::-ms-fill-lower { - @include shadow($track-shadow-size, $track-shadow-blur, $track-shadow-color); + @include shadow( + $track-shadow-size, + $track-shadow-blur, + $track-shadow-color + ); background: $ie-bottom-track-color; border: $track-border-width solid $track-border-color; @@ -128,7 +147,11 @@ $ie-bottom-track-color: darken($track-color, $contrast); } &::-ms-fill-upper { - @include shadow($track-shadow-size, $track-shadow-blur, $track-shadow-color); + @include shadow( + $track-shadow-size, + $track-shadow-blur, + $track-shadow-color + ); background: $track-color; border: $track-border-width solid $track-border-color; diff --git a/packages/@uppy/image-editor/types/index.d.ts b/packages/@uppy/image-editor/types/index.d.ts index c1832a9d0d..1597b1bc8f 100644 --- a/packages/@uppy/image-editor/types/index.d.ts +++ b/packages/@uppy/image-editor/types/index.d.ts @@ -1,4 +1,10 @@ -import type { IndexedObject, PluginTarget, UIPlugin, UIPluginOptions, UppyFile } from '@uppy/core' +import type { + IndexedObject, + PluginTarget, + UIPlugin, + UIPluginOptions, + UppyFile, +} from '@uppy/core' import type Cropper from 'cropperjs' import ImageEditorLocale from './generatedLocale' @@ -32,13 +38,19 @@ export default ImageEditor // Events -export type FileEditorStartCallback> = (file: UppyFile) => void; -export type FileEditorCompleteCallback> = (updatedFile: UppyFile) => void; -export type FileEditorCancelCallback> = (file: UppyFile) => void; +export type FileEditorStartCallback> = ( + file: UppyFile, +) => void +export type FileEditorCompleteCallback> = ( + updatedFile: UppyFile, +) => void +export type FileEditorCancelCallback> = ( + file: UppyFile, +) => void declare module '@uppy/core' { export interface UppyEventMap> { - 'file-editor:start' : FileEditorStartCallback + 'file-editor:start': FileEditorStartCallback 'file-editor:complete': FileEditorCompleteCallback 'file-editor:cancel': FileEditorCancelCallback } diff --git a/packages/@uppy/informer/src/style.scss b/packages/@uppy/informer/src/style.scss index 0ca3c81b60..dd6fa30d8e 100644 --- a/packages/@uppy/informer/src/style.scss +++ b/packages/@uppy/informer/src/style.scss @@ -41,7 +41,7 @@ line-height: 1.3; } - [data-uppy-theme="dark"] & { + [data-uppy-theme='dark'] & { background-color: $gray-800; } } diff --git a/packages/@uppy/instagram/types/index.d.ts b/packages/@uppy/instagram/types/index.d.ts index beec2e677c..84981fcb11 100644 --- a/packages/@uppy/instagram/types/index.d.ts +++ b/packages/@uppy/instagram/types/index.d.ts @@ -1,10 +1,15 @@ import type { PluginTarget, UIPlugin, UIPluginOptions } from '@uppy/core' -import type { PublicProviderOptions, TokenStorage } from '@uppy/companion-client' +import type { + PublicProviderOptions, + TokenStorage, +} from '@uppy/companion-client' -export interface InstagramOptions extends UIPluginOptions, PublicProviderOptions { - target?: PluginTarget - title?: string - storage?: TokenStorage +export interface InstagramOptions + extends UIPluginOptions, + PublicProviderOptions { + target?: PluginTarget + title?: string + storage?: TokenStorage } declare class Instagram extends UIPlugin {} diff --git a/packages/@uppy/onedrive/types/index.d.ts b/packages/@uppy/onedrive/types/index.d.ts index 787a79c06e..6473fcce9e 100644 --- a/packages/@uppy/onedrive/types/index.d.ts +++ b/packages/@uppy/onedrive/types/index.d.ts @@ -1,10 +1,15 @@ import type { PluginTarget, UIPlugin, UIPluginOptions } from '@uppy/core' -import type { PublicProviderOptions, TokenStorage } from '@uppy/companion-client' +import type { + PublicProviderOptions, + TokenStorage, +} from '@uppy/companion-client' -export interface OneDriveOptions extends UIPluginOptions, PublicProviderOptions { - target?: PluginTarget - title?: string - storage?: TokenStorage +export interface OneDriveOptions + extends UIPluginOptions, + PublicProviderOptions { + target?: PluginTarget + title?: string + storage?: TokenStorage } declare class OneDrive extends UIPlugin {} diff --git a/packages/@uppy/progress-bar/src/style.scss b/packages/@uppy/progress-bar/src/style.scss index 4ac6965994..f0843e3a03 100644 --- a/packages/@uppy/progress-bar/src/style.scss +++ b/packages/@uppy/progress-bar/src/style.scss @@ -12,7 +12,7 @@ transition: height 0.2s; } -.uppy-ProgressBar[aria-hidden=true] { +.uppy-ProgressBar[aria-hidden='true'] { /* no important */ height: 0; } diff --git a/packages/@uppy/provider-views/src/style.scss b/packages/@uppy/provider-views/src/style.scss index 4ec4a06cd3..1a7ce23176 100644 --- a/packages/@uppy/provider-views/src/style.scss +++ b/packages/@uppy/provider-views/src/style.scss @@ -11,7 +11,7 @@ align-items: center; justify-content: center; - [data-uppy-theme="dark"] & { + [data-uppy-theme='dark'] & { background-color: $gray-900; } } @@ -51,7 +51,7 @@ font-size: 20px; } - [data-uppy-theme="dark"] & { + [data-uppy-theme='dark'] & { color: $gray-300; } } @@ -60,15 +60,15 @@ display: flex; align-items: center; padding: 8px 12px !important; - background: #4285F4; + background: #4285f4; &:hover { - background-color: darken(#4285F4, 10%); + background-color: darken(#4285f4, 10%); } &:focus { outline: none; - box-shadow: 0 0 0 3px rgba(#4285F4, 0.4); + box-shadow: 0 0 0 3px rgba(#4285f4, 0.4); } svg { @@ -87,7 +87,7 @@ margin-bottom: 0; } - [data-uppy-theme="dark"] & { + [data-uppy-theme='dark'] & { color: $gray-200; } } @@ -130,7 +130,7 @@ cursor: pointer; } - [data-uppy-theme="dark"] & { + [data-uppy-theme='dark'] & { color: $gray-200; } } @@ -150,7 +150,7 @@ color: $gray-800; font-weight: 500; - [data-uppy-theme="dark"] & { + [data-uppy-theme='dark'] & { color: $gray-200; } } @@ -168,7 +168,7 @@ z-index: $zIndex-2; border-bottom: 1px solid $gray-200; - [data-uppy-theme="dark"] & { + [data-uppy-theme='dark'] & { border-bottom: 1px solid $gray-800; } } @@ -186,7 +186,7 @@ align-items: center; } - [data-uppy-theme="dark"] & { + [data-uppy-theme='dark'] & { background-color: $gray-900; } } @@ -236,7 +236,7 @@ display: none; } - [data-uppy-theme="dark"] & { + [data-uppy-theme='dark'] & { color: $gray-200; background-color: $gray-900; } @@ -246,7 +246,7 @@ background-color: $gray-300; border: 0; - [data-uppy-theme="dark"] & { + [data-uppy-theme='dark'] & { background-color: $gray-800; } } @@ -299,7 +299,7 @@ text-decoration: underline; } - [data-uppy-theme="dark"] & { + [data-uppy-theme='dark'] & { color: $gray-200; } } @@ -328,7 +328,7 @@ border-spacing: 0; -webkit-overflow-scrolling: touch; - [data-uppy-theme="dark"] & { + [data-uppy-theme='dark'] & { background-color: $gray-900; } @@ -355,7 +355,7 @@ margin-inline-end: 8px; } - [data-uppy-theme="dark"] & { + [data-uppy-theme='dark'] & { background-color: $gray-900; border-top: 1px solid $gray-800; } diff --git a/packages/@uppy/provider-views/src/style/uppy-ProviderBrowser-viewType--grid.scss b/packages/@uppy/provider-views/src/style/uppy-ProviderBrowser-viewType--grid.scss index 45ca751903..761ab3d018 100644 --- a/packages/@uppy/provider-views/src/style/uppy-ProviderBrowser-viewType--grid.scss +++ b/packages/@uppy/provider-views/src/style/uppy-ProviderBrowser-viewType--grid.scss @@ -52,7 +52,7 @@ .uppy-ProviderBrowserItem-inner { background-color: rgba($gray-500, 0.2); - [data-uppy-theme="dark"] & { + [data-uppy-theme='dark'] & { background-color: rgba($gray-200, 0.2); } } @@ -62,7 +62,7 @@ height: 30%; fill: rgba($black, 0.7); - [data-uppy-theme="dark"] & { + [data-uppy-theme='dark'] & { fill: rgba($white, 0.8); } } @@ -89,7 +89,7 @@ } } - [data-uppy-theme="dark"] & { + [data-uppy-theme='dark'] & { box-shadow: 0 0 0 3px rgba($lightblue, 0.7); } diff --git a/packages/@uppy/provider-views/src/style/uppy-ProviderBrowser-viewType--list.scss b/packages/@uppy/provider-views/src/style/uppy-ProviderBrowser-viewType--list.scss index 42b0e208e5..95a4eb2c23 100644 --- a/packages/@uppy/provider-views/src/style/uppy-ProviderBrowser-viewType--list.scss +++ b/packages/@uppy/provider-views/src/style/uppy-ProviderBrowser-viewType--list.scss @@ -5,7 +5,7 @@ .uppy-ProviderBrowser-viewType--list { background-color: $white; - [data-uppy-theme="dark"] & { + [data-uppy-theme='dark'] & { background-color: $gray-900; } @@ -15,7 +15,7 @@ margin: 0; padding: 7px 15px; - [data-uppy-theme="dark"] & { + [data-uppy-theme='dark'] & { color: $gray-200; } } @@ -49,7 +49,7 @@ inset-inline-start: 3px; } - [data-uppy-theme="dark"] &:focus { + [data-uppy-theme='dark'] &:focus { border-color: rgba($highlight--dark, 0.7); box-shadow: 0 0 0 3px rgba($highlight--dark, 0.2); } diff --git a/packages/@uppy/provider-views/src/style/uppy-ProviderBrowserItem-checkbox.scss b/packages/@uppy/provider-views/src/style/uppy-ProviderBrowserItem-checkbox.scss index 6516aeb57c..39e9840ef0 100644 --- a/packages/@uppy/provider-views/src/style/uppy-ProviderBrowserItem-checkbox.scss +++ b/packages/@uppy/provider-views/src/style/uppy-ProviderBrowserItem-checkbox.scss @@ -23,14 +23,14 @@ cursor: default; } - [data-uppy-theme="dark"] & { + [data-uppy-theme='dark'] & { background-color: $gray-900; border-color: $gray-500; } } .uppy-ProviderBrowserItem-checkbox--is-checked { - [data-uppy-theme="dark"] & { + [data-uppy-theme='dark'] & { background-color: $gray-800; } } diff --git a/packages/@uppy/provider-views/src/style/uppy-SearchProvider-input.scss b/packages/@uppy/provider-views/src/style/uppy-SearchProvider-input.scss index 10c588b879..2548ae33e2 100644 --- a/packages/@uppy/provider-views/src/style/uppy-SearchProvider-input.scss +++ b/packages/@uppy/provider-views/src/style/uppy-SearchProvider-input.scss @@ -1,4 +1,3 @@ - .uppy-SearchProvider { display: flex; flex: 1; @@ -8,7 +7,7 @@ width: 100%; height: 100%; - [data-uppy-theme="dark"] & { + [data-uppy-theme='dark'] & { background-color: $gray-900; } } @@ -23,7 +22,7 @@ } &::-webkit-search-cancel-button { - display: none; + display: none; } } diff --git a/packages/@uppy/provider-views/types/index.d.ts b/packages/@uppy/provider-views/types/index.d.ts index f633a1a789..3930476062 100644 --- a/packages/@uppy/provider-views/types/index.d.ts +++ b/packages/@uppy/provider-views/types/index.d.ts @@ -2,19 +2,19 @@ import type { UIPlugin } from '@uppy/core' import type { Provider } from '@uppy/companion-client' interface ProviderViewOptions { - provider: Provider - viewType?: 'list' | 'grid' - showTitles?: boolean - showFilter?: boolean - showBreadcrumbs?: boolean + provider: Provider + viewType?: 'list' | 'grid' + showTitles?: boolean + showFilter?: boolean + showBreadcrumbs?: boolean } interface OnFirstRenderer { - onFirstRender: () => any + onFirstRender: () => any } declare class ProviderView { - constructor (plugin: UIPlugin & OnFirstRenderer, opts: ProviderViewOptions) + constructor(plugin: UIPlugin & OnFirstRenderer, opts: ProviderViewOptions) // @todo add other provider view methods } diff --git a/packages/@uppy/react/src/DashboardModal.d.ts b/packages/@uppy/react/src/DashboardModal.d.ts index 25c34edbd9..3e7b36bb65 100644 --- a/packages/@uppy/react/src/DashboardModal.d.ts +++ b/packages/@uppy/react/src/DashboardModal.d.ts @@ -9,7 +9,8 @@ type DashboardModalPropsInner = { ToUppyProps, // Remove the inline-only and force-overridden props 'inline' | 'onRequestCloseModal' -> & React.BaseHTMLAttributes +> & + React.BaseHTMLAttributes export type DashboardModalProps = { [K in keyof DashboardModalPropsInner]: DashboardModalPropsInner[K] diff --git a/packages/@uppy/react/src/DragDrop.d.ts b/packages/@uppy/react/src/DragDrop.d.ts index ea4bb3b4a2..55862e509c 100644 --- a/packages/@uppy/react/src/DragDrop.d.ts +++ b/packages/@uppy/react/src/DragDrop.d.ts @@ -1,7 +1,8 @@ import type { DragDropOptions } from '@uppy/drag-drop' import type { ToUppyProps } from './CommonTypes' -export type DragDropProps = ToUppyProps & React.BaseHTMLAttributes +export type DragDropProps = ToUppyProps & + React.BaseHTMLAttributes /** * React component that renders an area in which files can be dropped to be diff --git a/packages/@uppy/react/src/ProgressBar.d.ts b/packages/@uppy/react/src/ProgressBar.d.ts index 7c93657b9d..425c78b05f 100644 --- a/packages/@uppy/react/src/ProgressBar.d.ts +++ b/packages/@uppy/react/src/ProgressBar.d.ts @@ -1,7 +1,8 @@ import type { ProgressBarOptions } from '@uppy/progress-bar' import type { ToUppyProps } from './CommonTypes' -export type ProgressBarProps = ToUppyProps & React.BaseHTMLAttributes +export type ProgressBarProps = ToUppyProps & + React.BaseHTMLAttributes /** * React component that renders a progress bar at the top of the page. diff --git a/packages/@uppy/react/src/StatusBar.d.ts b/packages/@uppy/react/src/StatusBar.d.ts index 156da23219..22be1dedf7 100644 --- a/packages/@uppy/react/src/StatusBar.d.ts +++ b/packages/@uppy/react/src/StatusBar.d.ts @@ -1,7 +1,8 @@ import type { StatusBarOptions } from '@uppy/status-bar' import type { ToUppyProps } from './CommonTypes' -export type StatusBarProps = ToUppyProps & React.BaseHTMLAttributes +export type StatusBarProps = ToUppyProps & + React.BaseHTMLAttributes /** * React component that renders a status bar containing upload progress and speed, diff --git a/packages/@uppy/react/types/index.test-d.tsx b/packages/@uppy/react/types/index.test-d.tsx index 72010b2520..d408d306a9 100644 --- a/packages/@uppy/react/types/index.test-d.tsx +++ b/packages/@uppy/react/types/index.test-d.tsx @@ -1,7 +1,7 @@ -import * as React from "react" -import Uppy from "@uppy/core" -import { expectType, expectError } from "tsd" -import * as components from "../" +import * as React from 'react' +import Uppy from '@uppy/core' +import { expectType, expectError } from 'tsd' +import * as components from '../' const { useUppy } = components @@ -16,7 +16,7 @@ const uppy = new Uppy() } { - expectError() + expectError() } // inline option should be removed from proptypes because it is always overridden @@ -37,9 +37,9 @@ const uppy = new Uppy() strings: { // Text to show on the droppable area. // `%{browse}` is replaced with a link that opens the system file selection dialog. - dropHereOr: "Drop here or %{browse}", + dropHereOr: 'Drop here or %{browse}', // Used as the label for the link that opens the system file selection dialog. - browse: "browse", + browse: 'browse', }, }} /> @@ -54,7 +54,7 @@ const uppy = new Uppy() open animateOpenClose onRequestClose={() => { - alert("no") + alert('no') }} /> ) diff --git a/packages/@uppy/screen-capture/src/style.scss b/packages/@uppy/screen-capture/src/style.scss index 9a9ec6ef7b..869e770f2f 100644 --- a/packages/@uppy/screen-capture/src/style.scss +++ b/packages/@uppy/screen-capture/src/style.scss @@ -46,7 +46,7 @@ background-color: $white; border-top: 1px solid $gray-200; - [data-uppy-theme="dark"] & { + [data-uppy-theme='dark'] & { background-color: $gray-900; border-top: 1px solid $gray-800; } @@ -62,7 +62,7 @@ cursor: pointer; transition: all 0.3s; - [data-uppy-theme="dark"] & { + [data-uppy-theme='dark'] & { @include blue-border-focus--dark; } @@ -130,13 +130,20 @@ } .uppy-ScreenCapture-icon--streamActive svg { - animation: uppy-ScreenCapture-icon--blink 1s cubic-bezier(0.47, 0, 0.75, 0.72) infinite; + animation: uppy-ScreenCapture-icon--blink 1s cubic-bezier(0.47, 0, 0.75, 0.72) + infinite; } @keyframes uppy-ScreenCapture-icon--blink { - 0% { fill: $blue; } - 50% { fill: $gray-500; } - 100% { fill: $blue; } + 0% { + fill: $blue; + } + 50% { + fill: $gray-500; + } + 100% { + fill: $blue; + } } .uppy-ScreenCapture-button--video { diff --git a/packages/@uppy/screen-capture/types/index.d.ts b/packages/@uppy/screen-capture/types/index.d.ts index 5d3c6d493d..d9e56f3a04 100644 --- a/packages/@uppy/screen-capture/types/index.d.ts +++ b/packages/@uppy/screen-capture/types/index.d.ts @@ -1,22 +1,24 @@ import type { PluginTarget, UIPlugin, UIPluginOptions } from '@uppy/core' - // https://developer.mozilla.org/en-US/docs/Web/API/MediaTrackConstraints#Properties_of_shared_screen_tracks - // TODO: use the global DisplayMediaStreamConstraints once typescript includes it by default - interface DisplayMediaStreamConstraints { - audio?: boolean | MediaTrackConstraints; - video?: boolean | (MediaTrackConstraints & { - cursor?: 'always' | 'motion' | 'never', - displaySurface?: 'application' | 'browser' | 'monitor' | 'window', - logicalSurface?: boolean - }); - } +// https://developer.mozilla.org/en-US/docs/Web/API/MediaTrackConstraints#Properties_of_shared_screen_tracks +// TODO: use the global DisplayMediaStreamConstraints once typescript includes it by default +interface DisplayMediaStreamConstraints { + audio?: boolean | MediaTrackConstraints + video?: + | boolean + | (MediaTrackConstraints & { + cursor?: 'always' | 'motion' | 'never' + displaySurface?: 'application' | 'browser' | 'monitor' | 'window' + logicalSurface?: boolean + }) +} export interface ScreenCaptureOptions extends UIPluginOptions { - target?: PluginTarget - displayMediaConstraints?: DisplayMediaStreamConstraints, - userMediaConstraints?: MediaStreamConstraints, - preferredVideoMimeType?: string - } + target?: PluginTarget + displayMediaConstraints?: DisplayMediaStreamConstraints + userMediaConstraints?: MediaStreamConstraints + preferredVideoMimeType?: string +} declare class ScreenCapture extends UIPlugin {} diff --git a/packages/@uppy/screen-capture/types/index.test-d.ts b/packages/@uppy/screen-capture/types/index.test-d.ts index a03a525b5c..6662c04c7f 100644 --- a/packages/@uppy/screen-capture/types/index.test-d.ts +++ b/packages/@uppy/screen-capture/types/index.test-d.ts @@ -12,8 +12,10 @@ new Uppy().use(ScreenCapture, { video: { displaySurface: 'window' }, }, }) -expectError(new Uppy().use(ScreenCapture, { - displayMediaConstraints: { - video: { displaySurface: 'some nonsense' }, - }, -})) +expectError( + new Uppy().use(ScreenCapture, { + displayMediaConstraints: { + video: { displaySurface: 'some nonsense' }, + }, + }), +) diff --git a/packages/@uppy/status-bar/src/style.scss b/packages/@uppy/status-bar/src/style.scss index 95c20a184f..0ea5526446 100644 --- a/packages/@uppy/status-bar/src/style.scss +++ b/packages/@uppy/status-bar/src/style.scss @@ -14,7 +14,7 @@ background-color: $white; transition: height 0.2s; - [data-uppy-theme="dark"] & { + [data-uppy-theme='dark'] & { background-color: $gray-900; } } @@ -30,12 +30,12 @@ background-color: $gray-200; content: ''; - [data-uppy-theme="dark"] & { + [data-uppy-theme='dark'] & { background-color: $gray-600; } } -.uppy-StatusBar[aria-hidden=true] { +.uppy-StatusBar[aria-hidden='true'] { height: 0; overflow-y: hidden; } @@ -56,12 +56,12 @@ color: $red; } -.uppy-StatusBar:not([aria-hidden=true]).is-waiting { +.uppy-StatusBar:not([aria-hidden='true']).is-waiting { height: 65px; background-color: $white; border-top: 1px solid $gray-200; - [data-uppy-theme="dark"] & { + [data-uppy-theme='dark'] & { background-color: $gray-900; border-top: 1px solid $gray-800; } @@ -72,20 +72,35 @@ z-index: $zIndex-2; height: 2px; background-color: $blue; - transition: background-color, width 0.3s ease-out; + transition: + background-color, + width 0.3s ease-out; &.is-indeterminate { $stripe-color: rgba(0, 0, 0, 0.3); - background-image: linear-gradient(45deg, $stripe-color 25%, transparent 25%, transparent 50%, $stripe-color 50%, $stripe-color 75%, transparent 75%, transparent); + background-image: linear-gradient( + 45deg, + $stripe-color 25%, + transparent 25%, + transparent 50%, + $stripe-color 50%, + $stripe-color 75%, + transparent 75%, + transparent + ); background-size: 64px 64px; animation: uppy-StatusBar-ProgressStripes 1s linear infinite; } } @keyframes uppy-StatusBar-ProgressStripes { - from { background-position: 0 0; } - to { background-position: 64px 0; } + from { + background-position: 0 0; + } + to { + background-position: 64px 0; + } } .uppy-StatusBar.is-preprocessing .uppy-StatusBar-progress, @@ -112,7 +127,7 @@ padding-inline-start: 15px; } - [data-uppy-theme="dark"] & { + [data-uppy-theme='dark'] & { color: $gray-200; } } @@ -135,7 +150,7 @@ margin-left: 5px; } - [data-uppy-theme="dark"] & { + [data-uppy-theme='dark'] & { color: $gray-200; } } @@ -148,7 +163,7 @@ line-height: 1.2; white-space: nowrap; - [data-uppy-theme="dark"] & { + [data-uppy-theme='dark'] & { color: $gray-400; } } @@ -192,12 +207,12 @@ padding: 0 15px; background-color: $gray-50; - [data-uppy-theme="dark"] & { + [data-uppy-theme='dark'] & { background-color: $gray-900; } } -.uppy-StatusBar:not([aria-hidden="true"]).is-waiting.has-ghosts { +.uppy-StatusBar:not([aria-hidden='true']).is-waiting.has-ghosts { flex-direction: column; height: 90px; @@ -225,7 +240,7 @@ cursor: pointer; opacity: 0.9; - [data-uppy-theme="dark"] & { + [data-uppy-theme='dark'] & { @include blue-border-focus--dark; } @@ -257,7 +272,7 @@ .uppy-StatusBar-actionBtn--disabled { opacity: 0.4; - [data-uppy-theme="dark"] & { + [data-uppy-theme='dark'] & { opacity: 0.7; } } @@ -274,7 +289,7 @@ border-radius: 8px; margin-inline-end: 6px; - [data-uppy-theme="dark"] & { + [data-uppy-theme='dark'] & { @include blue-border-focus--dark; } @@ -301,11 +316,11 @@ background-color: darken($green, 5%); } - [data-uppy-theme="dark"] & { + [data-uppy-theme='dark'] & { background-color: $darkgreen; } - [data-uppy-theme="dark"] &:hover { + [data-uppy-theme='dark'] &:hover { background-color: darken($darkgreen, 5%); } } @@ -315,12 +330,15 @@ padding: 13px 22px; } -.uppy-StatusBar.is-waiting .uppy-StatusBar-actionBtn--upload.uppy-StatusBar-actionBtn--disabled:hover { +.uppy-StatusBar.is-waiting + .uppy-StatusBar-actionBtn--upload.uppy-StatusBar-actionBtn--disabled:hover { background-color: $green; cursor: not-allowed; } -[data-uppy-theme="dark"] .uppy-StatusBar.is-waiting .uppy-StatusBar-actionBtn--upload.uppy-StatusBar-actionBtn--disabled:hover { +[data-uppy-theme='dark'] + .uppy-StatusBar.is-waiting + .uppy-StatusBar-actionBtn--upload.uppy-StatusBar-actionBtn--disabled:hover { background-color: $darkgreen; } @@ -338,11 +356,11 @@ padding-bottom: 1px; border-radius: 3px; - [data-uppy-theme="dark"] & { + [data-uppy-theme='dark'] & { @include blue-border-focus--dark; } - .uppy-StatusBar.is-preprocessing &, + .uppy-StatusBar.is-preprocessing &, .uppy-StatusBar.is-postprocessing & { display: none; } @@ -355,7 +373,7 @@ line-height: 1; border-radius: 3px; - [data-uppy-theme="dark"] & { + [data-uppy-theme='dark'] & { color: $highlight--dark; } } @@ -375,7 +393,7 @@ font-size: 14px; } - [data-uppy-theme="dark"] & { + [data-uppy-theme='dark'] & { color: $gray-200; } } diff --git a/packages/@uppy/status-bar/types/index.d.ts b/packages/@uppy/status-bar/types/index.d.ts index 845d4037d9..558344dfee 100644 --- a/packages/@uppy/status-bar/types/index.d.ts +++ b/packages/@uppy/status-bar/types/index.d.ts @@ -8,10 +8,10 @@ export interface StatusBarOptions extends UIPluginOptions { showProgressDetails?: boolean hideUploadButton?: boolean hideAfterFinish?: boolean - hideRetryButton?: boolean, - hidePauseResumeButton?: boolean, - hideCancelButton?: boolean, - doneButtonHandler?: () => void, + hideRetryButton?: boolean + hidePauseResumeButton?: boolean + hideCancelButton?: boolean + doneButtonHandler?: () => void locale?: StatusBarLocale } diff --git a/packages/@uppy/store-default/types/index.d.ts b/packages/@uppy/store-default/types/index.d.ts index 3d96f0846f..4a7ce1ee49 100644 --- a/packages/@uppy/store-default/types/index.d.ts +++ b/packages/@uppy/store-default/types/index.d.ts @@ -1,14 +1,18 @@ import type { Store } from '@uppy/utils' type State = Record -type StateChangeListener = (prevState: State, nextState: State, patch: State) => void +type StateChangeListener = ( + prevState: State, + nextState: State, + patch: State, +) => void export default class DefaultStore implements Store { - constructor () + constructor() - getState (): State + getState(): State - setState (patch: State): void + setState(patch: State): void - subscribe (listener: StateChangeListener): () => void + subscribe(listener: StateChangeListener): () => void } diff --git a/packages/@uppy/store-redux/types/index.d.ts b/packages/@uppy/store-redux/types/index.d.ts index c2906343c0..78488001ca 100644 --- a/packages/@uppy/store-redux/types/index.d.ts +++ b/packages/@uppy/store-redux/types/index.d.ts @@ -2,7 +2,11 @@ import type { Store } from '@uppy/utils' import type { Reducer, Middleware, Store as Redux } from 'redux' type State = Record -type StateChangeListener = (prevState: State, nextState: State, patch: State) => void +type StateChangeListener = ( + prevState: State, + nextState: State, + patch: State, +) => void interface ReduxStoreOptions { store: Redux @@ -11,13 +15,13 @@ interface ReduxStoreOptions { } export class ReduxStore implements Store { - constructor (opts: ReduxStoreOptions) + constructor(opts: ReduxStoreOptions) - getState (): State + getState(): State - setState (patch: State): void + setState(patch: State): void - subscribe (listener: StateChangeListener): () => void + subscribe(listener: StateChangeListener): () => void } export const reducer: Reducer diff --git a/packages/@uppy/svelte/tsconfig.json b/packages/@uppy/svelte/tsconfig.json index ae3d9b2759..4360a542dd 100644 --- a/packages/@uppy/svelte/tsconfig.json +++ b/packages/@uppy/svelte/tsconfig.json @@ -4,10 +4,6 @@ "esModuleInterop": true, "sourceMap": true }, - "include": [ - "src/**/*" - ], - "exclude": [ - "node_modules/*" - ] + "include": ["src/**/*"], + "exclude": ["node_modules/*"] } diff --git a/packages/@uppy/thumbnail-generator/types/index.d.ts b/packages/@uppy/thumbnail-generator/types/index.d.ts index 2a3046e195..6e82cdb1f1 100644 --- a/packages/@uppy/thumbnail-generator/types/index.d.ts +++ b/packages/@uppy/thumbnail-generator/types/index.d.ts @@ -1,4 +1,9 @@ -import type { IndexedObject, UIPlugin, UIPluginOptions, UppyFile } from '@uppy/core' +import type { + IndexedObject, + UIPlugin, + UIPluginOptions, + UppyFile, +} from '@uppy/core' import ThumbnailGeneratorLocale from './generatedLocale' @@ -22,7 +27,7 @@ export default ThumbnailGenerator export type ThumbnailGeneratedCallback> = ( file: UppyFile, - preview: string + preview: string, ) => void declare module '@uppy/core' { diff --git a/packages/@uppy/transloadit/types/index.d.ts b/packages/@uppy/transloadit/types/index.d.ts index 8fb52ca676..7f4841e79a 100644 --- a/packages/@uppy/transloadit/types/index.d.ts +++ b/packages/@uppy/transloadit/types/index.d.ts @@ -116,7 +116,9 @@ interface Options extends PluginOptions { export type TransloaditOptions = Options & ( | { - assemblyOptions?: AssemblyOptions | ((file?: UppyFile) => Promise | AssemblyOptions) + assemblyOptions?: + | AssemblyOptions + | ((file?: UppyFile) => Promise | AssemblyOptions) /** @deprecated use `assemblyOptions` instead */ getAssemblyOptions?: never /** @deprecated use `assemblyOptions` instead */ @@ -129,7 +131,7 @@ export type TransloaditOptions = Options & | { /** @deprecated use `assemblyOptions` instead */ getAssemblyOptions?: ( - file?: UppyFile + file?: UppyFile, ) => AssemblyOptions | Promise assemblyOptions?: never /** @deprecated use `assemblyOptions` instead */ @@ -167,14 +169,17 @@ export const COMPANION_ALLOWED_HOSTS: RegExp export type TransloaditAssemblyCreatedCallback = ( assembly: Assembly, - fileIDs: string[] + fileIDs: string[], +) => void +export type TransloaditUploadedCallback = ( + file: FileInfo, + assembly: Assembly, ) => void -export type TransloaditUploadedCallback = (file: FileInfo, assembly: Assembly) => void export type TransloaditAssemblyExecutingCallback = (assembly: Assembly) => void export type TransloaditResultCallback = ( stepName: string, result: Result, - assembly: Assembly + assembly: Assembly, ) => void export type TransloaditCompleteCallback = (assembly: Assembly) => void diff --git a/packages/@uppy/transloadit/types/index.test-d.ts b/packages/@uppy/transloadit/types/index.test-d.ts index 9e607092a3..5cd5d5b5d0 100644 --- a/packages/@uppy/transloadit/types/index.test-d.ts +++ b/packages/@uppy/transloadit/types/index.test-d.ts @@ -15,7 +15,7 @@ const validParams = { { const uppy = new Uppy() uppy.use(Transloadit, { - getAssemblyOptions (file) { + getAssemblyOptions(file) { expectType(file) return { params: validParams } }, @@ -38,7 +38,7 @@ const validParams = { { const uppy = new Uppy() uppy.use(Transloadit, { - async assemblyOptions (file) { + async assemblyOptions(file) { expectType(file) return { params: validParams } }, @@ -56,7 +56,7 @@ const validParams = { const uppy = new Uppy() expectError( uppy.use(Transloadit, { - getAssemblyOptions () { + getAssemblyOptions() { return { params: validParams } }, assemblyOptions: { params: validParams }, @@ -77,8 +77,12 @@ const validParams = { { const uppy = new Uppy() // must be bools - expectError(uppy.use(Transloadit, { waitForEncoding: null, params: validParams })) - expectError(uppy.use(Transloadit, { waitForMetadata: null, params: validParams })) + expectError( + uppy.use(Transloadit, { waitForEncoding: null, params: validParams }), + ) + expectError( + uppy.use(Transloadit, { waitForMetadata: null, params: validParams }), + ) } { diff --git a/packages/@uppy/tus/types/index.d.ts b/packages/@uppy/tus/types/index.d.ts index f741ada011..a3a431f3c5 100644 --- a/packages/@uppy/tus/types/index.d.ts +++ b/packages/@uppy/tus/types/index.d.ts @@ -1,29 +1,42 @@ import type { PluginOptions, BasePlugin, UppyFile } from '@uppy/core' import type { UploadOptions, HttpRequest } from 'tus-js-client' -type TusUploadOptions = Pick> +type TusUploadOptions = Pick< + UploadOptions, + Exclude< + keyof UploadOptions, + | 'fingerprint' + | 'metadata' + | 'onBeforeRequest' + | 'onProgress' + | 'onChunkComplete' + | 'onShouldRetry' + | 'onSuccess' + | 'onError' + | 'uploadUrl' + | 'uploadSize' + > +> -type Next = (err: Error | undefined, retryAttempt?: number, options?: TusOptions) => boolean +type Next = ( + err: Error | undefined, + retryAttempt?: number, + options?: TusOptions, +) => boolean export interface TusOptions extends PluginOptions, TusUploadOptions { - allowedMetaFields?: string[] | null - limit?: number - useFastRemoteRetry?: boolean - withCredentials?: boolean - onShouldRetry?: (err: Error | undefined, retryAttempt: number, options: TusOptions, next: Next) => boolean - onBeforeRequest?: (req: HttpRequest, file: UppyFile) => Promise - } + allowedMetaFields?: string[] | null + limit?: number + useFastRemoteRetry?: boolean + withCredentials?: boolean + onShouldRetry?: ( + err: Error | undefined, + retryAttempt: number, + options: TusOptions, + next: Next, + ) => boolean + onBeforeRequest?: (req: HttpRequest, file: UppyFile) => Promise +} declare class Tus extends BasePlugin {} diff --git a/packages/@uppy/unsplash/types/index.d.ts b/packages/@uppy/unsplash/types/index.d.ts index 00066d9f65..978ca1c5fd 100644 --- a/packages/@uppy/unsplash/types/index.d.ts +++ b/packages/@uppy/unsplash/types/index.d.ts @@ -2,8 +2,8 @@ import type { RequestClientOptions } from '@uppy/companion-client' import type { PluginTarget, UIPlugin, UIPluginOptions } from '@uppy/core' interface UnsplashOptions extends UIPluginOptions, RequestClientOptions { - target?: PluginTarget - title?: string + target?: PluginTarget + title?: string } declare class Unsplash extends UIPlugin {} diff --git a/packages/@uppy/url/src/style.scss b/packages/@uppy/url/src/style.scss index c1ccdddd2f..6f43811f24 100644 --- a/packages/@uppy/url/src/style.scss +++ b/packages/@uppy/url/src/style.scss @@ -10,7 +10,7 @@ width: 100%; height: 100%; - [data-uppy-theme="dark"] & { + [data-uppy-theme='dark'] & { background-color: $gray-900; } } diff --git a/packages/@uppy/url/types/index.d.ts b/packages/@uppy/url/types/index.d.ts index e8446e9a73..fa9734c88c 100644 --- a/packages/@uppy/url/types/index.d.ts +++ b/packages/@uppy/url/types/index.d.ts @@ -1,15 +1,23 @@ import type { RequestClientOptions } from '@uppy/companion-client' -import type { IndexedObject, PluginTarget, UIPlugin, UIPluginOptions } from '@uppy/core' +import type { + IndexedObject, + PluginTarget, + UIPlugin, + UIPluginOptions, +} from '@uppy/core' import UrlLocale from './generatedLocale' export interface UrlOptions extends UIPluginOptions, RequestClientOptions { - target?: PluginTarget - title?: string - locale?: UrlLocale + target?: PluginTarget + title?: string + locale?: UrlLocale } declare class Url extends UIPlugin { - public addFile(url: string, meta?: IndexedObject): undefined | string | never + public addFile( + url: string, + meta?: IndexedObject, + ): undefined | string | never } export default Url diff --git a/packages/@uppy/url/types/index.test-d.ts b/packages/@uppy/url/types/index.test-d.ts index e703d97f22..b21c2584bb 100644 --- a/packages/@uppy/url/types/index.test-d.ts +++ b/packages/@uppy/url/types/index.test-d.ts @@ -4,19 +4,21 @@ import Url from '..' { const uppy = new Uppy() // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - uppy.use(Url, { - companionUrl: '', - companionCookiesRule: 'same-origin', - target: 'body', - title: 'title', - locale: { - strings: { - import: '', - enterUrlToImport: '', - failedToFetch: '', - enterCorrectUrl: '', + uppy + .use(Url, { + companionUrl: '', + companionCookiesRule: 'same-origin', + target: 'body', + title: 'title', + locale: { + strings: { + import: '', + enterUrlToImport: '', + failedToFetch: '', + enterCorrectUrl: '', + }, }, - }, - }) - .getPlugin('Url')!.addFile('https://via.placeholder.com/150') + }) + .getPlugin('Url')! + .addFile('https://via.placeholder.com/150') } diff --git a/packages/@uppy/utils/src/microtip.scss b/packages/@uppy/utils/src/microtip.scss index 1d952cea85..1e0a291e15 100644 --- a/packages/@uppy/utils/src/microtip.scss +++ b/packages/@uppy/utils/src/microtip.scss @@ -17,12 +17,12 @@ [1] Base Styles ------------------------------------------------- */ -.uppy-Root [aria-label][role~="tooltip"] { +.uppy-Root [aria-label][role~='tooltip'] { position: relative; } -.uppy-Root [aria-label][role~="tooltip"]::before, -.uppy-Root [aria-label][role~="tooltip"]::after { +.uppy-Root [aria-label][role~='tooltip']::before, +.uppy-Root [aria-label][role~='tooltip']::after { position: absolute; z-index: 10; box-sizing: border-box; @@ -31,17 +31,19 @@ -webkit-backface-visibility: hidden; backface-visibility: hidden; opacity: 0; - transition: all var(--microtip-transition-duration, 0.18s) var(--microtip-transition-easing, ease-in-out) var(--microtip-transition-delay, 0s); + transition: all var(--microtip-transition-duration, 0.18s) + var(--microtip-transition-easing, ease-in-out) + var(--microtip-transition-delay, 0s); pointer-events: none; will-change: transform; } -.uppy-Root [aria-label][role~="tooltip"]::before { +.uppy-Root [aria-label][role~='tooltip']::before { background-size: 100% auto !important; - content: ""; + content: ''; } -.uppy-Root [aria-label][role~="tooltip"]::after { +.uppy-Root [aria-label][role~='tooltip']::after { box-sizing: content-box; padding: 0.5em 1em; color: #fff; @@ -54,10 +56,10 @@ content: attr(aria-label); } -.uppy-Root [aria-label][role~="tooltip"]:hover::before, -.uppy-Root [aria-label][role~="tooltip"]:hover::after, -.uppy-Root [aria-label][role~="tooltip"]:focus::before, -.uppy-Root [aria-label][role~="tooltip"]:focus::after { +.uppy-Root [aria-label][role~='tooltip']:hover::before, +.uppy-Root [aria-label][role~='tooltip']:hover::after, +.uppy-Root [aria-label][role~='tooltip']:focus::before, +.uppy-Root [aria-label][role~='tooltip']:focus::after { opacity: 1; pointer-events: auto; } @@ -66,59 +68,60 @@ [2] Position Modifiers ------------------------------------------------- */ -.uppy-Root [role~="tooltip"][data-microtip-position|="top"]::before { +.uppy-Root [role~='tooltip'][data-microtip-position|='top']::before { bottom: 100%; left: 50%; width: 18px; height: 6px; margin-bottom: 5px; - background: url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2236px%22%20height%3D%2212px%22%3E%3Cpath%20fill%3D%22rgba%2817,%2017,%2017,%200.9%29%22%20transform%3D%22rotate%280%29%22%20d%3D%22M2.658,0.000%20C-13.615,0.000%2050.938,0.000%2034.662,0.000%20C28.662,0.000%2023.035,12.002%2018.660,12.002%20C14.285,12.002%208.594,0.000%202.658,0.000%20Z%22/%3E%3C/svg%3E") no-repeat; + background: url('data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2236px%22%20height%3D%2212px%22%3E%3Cpath%20fill%3D%22rgba%2817,%2017,%2017,%200.9%29%22%20transform%3D%22rotate%280%29%22%20d%3D%22M2.658,0.000%20C-13.615,0.000%2050.938,0.000%2034.662,0.000%20C28.662,0.000%2023.035,12.002%2018.660,12.002%20C14.285,12.002%208.594,0.000%202.658,0.000%20Z%22/%3E%3C/svg%3E') + no-repeat; transform: translate3d(-50%, 0, 0); } -.uppy-Root [role~="tooltip"][data-microtip-position|="top"]::after { +.uppy-Root [role~='tooltip'][data-microtip-position|='top']::after { bottom: 100%; left: 50%; margin-bottom: 11px; transform: translate3d(-50%, 0, 0); } -.uppy-Root [role~="tooltip"][data-microtip-position|="top"]:hover::before { +.uppy-Root [role~='tooltip'][data-microtip-position|='top']:hover::before { transform: translate3d(-50%, -5px, 0); } -.uppy-Root [role~="tooltip"][data-microtip-position="top"]:hover::after { +.uppy-Root [role~='tooltip'][data-microtip-position='top']:hover::after { transform: translate3d(-50%, -5px, 0); } /* ------------------------------------------------ [2.1] Top Left ------------------------------------------------- */ -.uppy-Root [role~="tooltip"][data-microtip-position="top-left"]::after { +.uppy-Root [role~='tooltip'][data-microtip-position='top-left']::after { bottom: 100%; transform: translate3d(calc(-100% + 16px), 0, 0); } -.uppy-Root [role~="tooltip"][data-microtip-position="top-left"]:hover::after { +.uppy-Root [role~='tooltip'][data-microtip-position='top-left']:hover::after { transform: translate3d(calc(-100% + 16px), -5px, 0); } /* ------------------------------------------------ [2.2] Top Right ------------------------------------------------- */ -.uppy-Root [role~="tooltip"][data-microtip-position="top-right"]::after { +.uppy-Root [role~='tooltip'][data-microtip-position='top-right']::after { bottom: 100%; transform: translate3d(calc(0% + -16px), 0, 0); } -.uppy-Root [role~="tooltip"][data-microtip-position="top-right"]:hover::after { +.uppy-Root [role~='tooltip'][data-microtip-position='top-right']:hover::after { transform: translate3d(calc(0% + -16px), -5px, 0); } /* ------------------------------------------------ [2.3] Bottom ------------------------------------------------- */ -.uppy-Root [role~="tooltip"][data-microtip-position|="bottom"]::before { +.uppy-Root [role~='tooltip'][data-microtip-position|='bottom']::before { top: 100%; bottom: auto; left: 50%; @@ -126,54 +129,57 @@ height: 6px; margin-top: 5px; margin-bottom: 0; - background: url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2236px%22%20height%3D%2212px%22%3E%3Cpath%20fill%3D%22rgba%2817,%2017,%2017,%200.9%29%22%20transform%3D%22rotate%28180%2018%206%29%22%20d%3D%22M2.658,0.000%20C-13.615,0.000%2050.938,0.000%2034.662,0.000%20C28.662,0.000%2023.035,12.002%2018.660,12.002%20C14.285,12.002%208.594,0.000%202.658,0.000%20Z%22/%3E%3C/svg%3E") no-repeat; + background: url('data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2236px%22%20height%3D%2212px%22%3E%3Cpath%20fill%3D%22rgba%2817,%2017,%2017,%200.9%29%22%20transform%3D%22rotate%28180%2018%206%29%22%20d%3D%22M2.658,0.000%20C-13.615,0.000%2050.938,0.000%2034.662,0.000%20C28.662,0.000%2023.035,12.002%2018.660,12.002%20C14.285,12.002%208.594,0.000%202.658,0.000%20Z%22/%3E%3C/svg%3E') + no-repeat; transform: translate3d(-50%, -10px, 0); } -.uppy-Root [role~="tooltip"][data-microtip-position|="bottom"]::after { +.uppy-Root [role~='tooltip'][data-microtip-position|='bottom']::after { top: 100%; left: 50%; margin-top: 11px; transform: translate3d(-50%, -10px, 0); } -.uppy-Root [role~="tooltip"][data-microtip-position|="bottom"]:hover::before { +.uppy-Root [role~='tooltip'][data-microtip-position|='bottom']:hover::before { transform: translate3d(-50%, 0, 0); } -.uppy-Root [role~="tooltip"][data-microtip-position="bottom"]:hover::after { +.uppy-Root [role~='tooltip'][data-microtip-position='bottom']:hover::after { transform: translate3d(-50%, 0, 0); } /* ------------------------------------------------ [2.4] Bottom Left ------------------------------------------------- */ -.uppy-Root [role~="tooltip"][data-microtip-position="bottom-left"]::after { +.uppy-Root [role~='tooltip'][data-microtip-position='bottom-left']::after { top: 100%; transform: translate3d(calc(-100% + 16px), -10px, 0); } -.uppy-Root [role~="tooltip"][data-microtip-position="bottom-left"]:hover::after { +.uppy-Root + [role~='tooltip'][data-microtip-position='bottom-left']:hover::after { transform: translate3d(calc(-100% + 16px), 0, 0); } /* ------------------------------------------------ [2.5] Bottom Right ------------------------------------------------- */ -.uppy-Root [role~="tooltip"][data-microtip-position="bottom-right"]::after { +.uppy-Root [role~='tooltip'][data-microtip-position='bottom-right']::after { top: 100%; transform: translate3d(calc(0% + -16px), -10px, 0); } -.uppy-Root [role~="tooltip"][data-microtip-position="bottom-right"]:hover::after { +.uppy-Root + [role~='tooltip'][data-microtip-position='bottom-right']:hover::after { transform: translate3d(calc(0% + -16px), 0, 0); } /* ------------------------------------------------ [2.6] Left ------------------------------------------------- */ -.uppy-Root [role~="tooltip"][data-microtip-position="left"]::before, -.uppy-Root [role~="tooltip"][data-microtip-position="left"]::after { +.uppy-Root [role~='tooltip'][data-microtip-position='left']::before, +.uppy-Root [role~='tooltip'][data-microtip-position='left']::after { top: 50%; right: 100%; bottom: auto; @@ -181,65 +187,67 @@ transform: translate3d(10px, -50%, 0); } -.uppy-Root [role~="tooltip"][data-microtip-position="left"]::before { +.uppy-Root [role~='tooltip'][data-microtip-position='left']::before { width: 6px; height: 18px; margin-right: 5px; margin-bottom: 0; - background: url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2212px%22%20height%3D%2236px%22%3E%3Cpath%20fill%3D%22rgba%2817,%2017,%2017,%200.9%29%22%20transform%3D%22rotate%28-90%2018%2018%29%22%20d%3D%22M2.658,0.000%20C-13.615,0.000%2050.938,0.000%2034.662,0.000%20C28.662,0.000%2023.035,12.002%2018.660,12.002%20C14.285,12.002%208.594,0.000%202.658,0.000%20Z%22/%3E%3C/svg%3E") no-repeat; + background: url('data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2212px%22%20height%3D%2236px%22%3E%3Cpath%20fill%3D%22rgba%2817,%2017,%2017,%200.9%29%22%20transform%3D%22rotate%28-90%2018%2018%29%22%20d%3D%22M2.658,0.000%20C-13.615,0.000%2050.938,0.000%2034.662,0.000%20C28.662,0.000%2023.035,12.002%2018.660,12.002%20C14.285,12.002%208.594,0.000%202.658,0.000%20Z%22/%3E%3C/svg%3E') + no-repeat; } -.uppy-Root [role~="tooltip"][data-microtip-position="left"]::after { +.uppy-Root [role~='tooltip'][data-microtip-position='left']::after { margin-right: 11px; } -.uppy-Root [role~="tooltip"][data-microtip-position="left"]:hover::before, -.uppy-Root [role~="tooltip"][data-microtip-position="left"]:hover::after { +.uppy-Root [role~='tooltip'][data-microtip-position='left']:hover::before, +.uppy-Root [role~='tooltip'][data-microtip-position='left']:hover::after { transform: translate3d(0, -50%, 0); } /* ------------------------------------------------ [2.7] Right ------------------------------------------------- */ -.uppy-Root [role~="tooltip"][data-microtip-position="right"]::before, -.uppy-Root [role~="tooltip"][data-microtip-position="right"]::after { +.uppy-Root [role~='tooltip'][data-microtip-position='right']::before, +.uppy-Root [role~='tooltip'][data-microtip-position='right']::after { top: 50%; bottom: auto; left: 100%; transform: translate3d(-10px, -50%, 0); } -.uppy-Root [role~="tooltip"][data-microtip-position="right"]::before { +.uppy-Root [role~='tooltip'][data-microtip-position='right']::before { width: 6px; height: 18px; margin-bottom: 0; margin-left: 5px; - background: url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2212px%22%20height%3D%2236px%22%3E%3Cpath%20fill%3D%22rgba%2817,%2017,%2017,%200.9%29%22%20transform%3D%22rotate%2890%206%206%29%22%20d%3D%22M2.658,0.000%20C-13.615,0.000%2050.938,0.000%2034.662,0.000%20C28.662,0.000%2023.035,12.002%2018.660,12.002%20C14.285,12.002%208.594,0.000%202.658,0.000%20Z%22/%3E%3C/svg%3E") no-repeat; + background: url('data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2212px%22%20height%3D%2236px%22%3E%3Cpath%20fill%3D%22rgba%2817,%2017,%2017,%200.9%29%22%20transform%3D%22rotate%2890%206%206%29%22%20d%3D%22M2.658,0.000%20C-13.615,0.000%2050.938,0.000%2034.662,0.000%20C28.662,0.000%2023.035,12.002%2018.660,12.002%20C14.285,12.002%208.594,0.000%202.658,0.000%20Z%22/%3E%3C/svg%3E') + no-repeat; } -.uppy-Root [role~="tooltip"][data-microtip-position="right"]::after { +.uppy-Root [role~='tooltip'][data-microtip-position='right']::after { margin-left: 11px; } -.uppy-Root [role~="tooltip"][data-microtip-position="right"]:hover::before, -.uppy-Root [role~="tooltip"][data-microtip-position="right"]:hover::after { +.uppy-Root [role~='tooltip'][data-microtip-position='right']:hover::before, +.uppy-Root [role~='tooltip'][data-microtip-position='right']:hover::after { transform: translate3d(0, -50%, 0); } /* ------------------------------------------------ [3] Size ------------------------------------------------- */ -.uppy-Root [role~="tooltip"][data-microtip-size="small"]::after { +.uppy-Root [role~='tooltip'][data-microtip-size='small']::after { width: 80px; white-space: initial; } -.uppy-Root [role~="tooltip"][data-microtip-size="medium"]::after { +.uppy-Root [role~='tooltip'][data-microtip-size='medium']::after { width: 150px; white-space: initial; } -.uppy-Root [role~="tooltip"][data-microtip-size="large"]::after { +.uppy-Root [role~='tooltip'][data-microtip-size='large']::after { width: 260px; white-space: initial; } diff --git a/packages/@uppy/utils/types/index.d.ts b/packages/@uppy/utils/types/index.d.ts index e1ad9276a2..b216156497 100644 --- a/packages/@uppy/utils/types/index.d.ts +++ b/packages/@uppy/utils/types/index.d.ts @@ -9,11 +9,11 @@ declare module '@uppy/utils/lib/Translator' { } class Translator { - constructor (opts: Translator.Locale | Translator.Locale[]) + constructor(opts: Translator.Locale | Translator.Locale[]) - translate (key: string, options: Record): string + translate(key: string, options: Record): string - translateArray (key: string, options: Record): any[] + translateArray(key: string, options: Record): any[] } export default Translator @@ -29,11 +29,11 @@ declare module '@uppy/utils/lib/EventManager' { } class EventManager { - constructor (emitter: EventManager.Emitter) + constructor(emitter: EventManager.Emitter) - on (event: string, handler: EventManager.EventHandler): void + on(event: string, handler: EventManager.EventHandler): void - remove (): void + remove(): void } export default EventManager @@ -41,11 +41,11 @@ declare module '@uppy/utils/lib/EventManager' { declare module '@uppy/utils/lib/ProgressTimeout' { class ProgressTimeout { - constructor (timeout: number, timeoutHandler: () => void) + constructor(timeout: number, timeoutHandler: () => void) - progress (): void + progress(): void - done (): void + done(): void } export default ProgressTimeout } @@ -58,8 +58,8 @@ declare module '@uppy/utils/lib/RateLimitedQueue' { abortOn(signal: AbortSignal): this } export type QueueEntry = { - abort: () => void, - done: () => void, + abort: () => void + done: () => void } export type QueueOptions = { priority?: number @@ -73,7 +73,7 @@ declare module '@uppy/utils/lib/RateLimitedQueue' { run( fn: () => RateLimitedQueue.AbortFunction, - queueOptions?: RateLimitedQueue.QueueOptions + queueOptions?: RateLimitedQueue.QueueOptions, ): RateLimitedQueue.QueueEntry rateLimit(duration: number): void @@ -84,7 +84,7 @@ declare module '@uppy/utils/lib/RateLimitedQueue' { wrapPromiseFunction( fn: () => (...args: any[]) => Promise, - queueOptions?: RateLimitedQueue.QueueOptions + queueOptions?: RateLimitedQueue.QueueOptions, ): (...args: any[]) => RateLimitedQueue.AbortablePromise } @@ -92,26 +92,26 @@ declare module '@uppy/utils/lib/RateLimitedQueue' { } declare module '@uppy/utils/lib/canvasToBlob' { - function canvasToBlob ( + function canvasToBlob( canvas: HTMLCanvasElement, type: string, - quality?: number + quality?: number, ): Promise export default canvasToBlob } declare module '@uppy/utils/lib/dataURItoBlob' { - function dataURItoBlob ( + function dataURItoBlob( dataURI: string, - opts: { mimeType?: string; name?: string } + opts: { mimeType?: string; name?: string }, ): Blob export default dataURItoBlob } declare module '@uppy/utils/lib/dataURItoFile' { - function dataURItoFile ( + function dataURItoFile( dataURI: string, - opts: { mimeType?: string; name?: string } + opts: { mimeType?: string; name?: string }, ): File export default dataURItoFile } @@ -125,33 +125,33 @@ declare module '@uppy/utils/lib/emitSocketProgress' { bytesTotal: number } - function emitSocketProgress ( + function emitSocketProgress( uploader: unknown, progressData: ProgressData, - file: UppyFile + file: UppyFile, ): void export default emitSocketProgress } declare module '@uppy/utils/lib/findAllDOMElements' { - function findAllDOMElements (element: string | HTMLElement): HTMLElement[] + function findAllDOMElements(element: string | HTMLElement): HTMLElement[] export default findAllDOMElements } declare module '@uppy/utils/lib/findDOMElement' { - function findDOMElement (element: string | HTMLElement): HTMLElement | null + function findDOMElement(element: string | HTMLElement): HTMLElement | null export default findDOMElement } declare module '@uppy/utils/lib/generateFileID' { import type { UppyFile } from '@uppy/utils' - function generateFileID (file: UppyFile): string + function generateFileID(file: UppyFile): string export default generateFileID } declare module '@uppy/utils/lib/getBytesRemaining' { - function getBytesRemaining (progress: { + function getBytesRemaining(progress: { bytesTotal: number bytesUploaded: number }): number @@ -159,36 +159,37 @@ declare module '@uppy/utils/lib/getBytesRemaining' { } declare module '@uppy/utils/lib/getETA' { - function getETA (progress: unknown): number + function getETA(progress: unknown): number export default getETA } declare module '@uppy/utils/lib/getFileNameAndExtension' { - function getFileNameAndExtension( - filename: string - ): { name: string, extension: string | undefined } + function getFileNameAndExtension(filename: string): { + name: string + extension: string | undefined + } export default getFileNameAndExtension } declare module '@uppy/utils/lib/getFileType' { import type { UppyFile } from '@uppy/utils' - function getFileType (file: UppyFile): string + function getFileType(file: UppyFile): string export default getFileType } declare module '@uppy/utils/lib/getFileTypeExtension' { - function getFileTypeExtension (mime: string): string + function getFileTypeExtension(mime: string): string export default getFileTypeExtension } declare module '@uppy/utils/lib/getSocketHost' { - function getSocketHost (url: string): string + function getSocketHost(url: string): string export default getSocketHost } declare module '@uppy/utils/lib/getSpeed' { - function getSpeed (progress: { + function getSpeed(progress: { bytesUploaded: number uploadStarted: number }): number @@ -196,54 +197,54 @@ declare module '@uppy/utils/lib/getSpeed' { } declare module '@uppy/utils/lib/getTimeStamp' { - function getTimeStamp (): string + function getTimeStamp(): string export default getTimeStamp } declare module '@uppy/utils/lib/isDOMElement' { - function isDOMElement (element: any): boolean + function isDOMElement(element: any): boolean export default isDOMElement } declare module '@uppy/utils/lib/isObjectURL' { - function isObjectURL (url: string): boolean + function isObjectURL(url: string): boolean export default isObjectURL } declare module '@uppy/utils/lib/isDragDropSupported' { - function isDragDropSupported (): boolean + function isDragDropSupported(): boolean export default isDragDropSupported } declare module '@uppy/utils/lib/isPreviewSupported' { - function isPreviewSupported (mime: string): boolean + function isPreviewSupported(mime: string): boolean export default isPreviewSupported } declare module '@uppy/utils/lib/isTouchDevice' { - function isTouchDevice (): boolean + function isTouchDevice(): boolean export default isTouchDevice } declare module '@uppy/utils/lib/prettyETA' { - function prettyETA (seconds: number): string + function prettyETA(seconds: number): string export default prettyETA } declare module '@uppy/utils/lib/secondsToTime' { - function secondsToTime (seconds: number): string + function secondsToTime(seconds: number): string export default secondsToTime } declare module '@uppy/utils/lib/settle' { - function settle ( - promises: Promise[] + function settle( + promises: Promise[], ): Promise<{ successful: T[]; failed: any[] }> export default settle } declare module '@uppy/utils/lib/toArray' { - function toArray (list: any): any[] + function toArray(list: any): any[] export default toArray } @@ -252,25 +253,27 @@ declare module '@uppy/utils/lib/AbortController' { export const AbortController: typeof globalThis.AbortController export const AbortSignal: typeof globalThis.AbortSignal - export function createAbortError(message?: string, options?: ErrorOptions): DOMException + export function createAbortError( + message?: string, + options?: ErrorOptions, + ): DOMException } declare module '@uppy/utils/lib/getDroppedFiles' { - function getDroppedFiles ( + function getDroppedFiles( dataTransfer: DataTransfer, - options?: Record + options?: Record, ): Promise export default getDroppedFiles } declare module '@uppy/utils/lib/getTextDirection' { - function getTextDirection (element: Node): string|undefined + function getTextDirection(element: Node): string | undefined export default getTextDirection } declare module '@uppy/utils/lib/isNetworkError' { - export default function isNetworkError (xhr: any): boolean - + export default function isNetworkError(xhr: any): boolean } declare module '@uppy/utils/lib/NetworkError' { @@ -281,7 +284,7 @@ declare module '@uppy/utils/lib/NetworkError' { readonly request?: XMLHttpRequest - constructor (error: any, xhr?: XMLHttpRequest) + constructor(error: any, xhr?: XMLHttpRequest) } export default NetworkError @@ -293,20 +296,27 @@ declare module '@uppy/utils/lib/FOCUSABLE_ELEMENTS' { } declare module '@uppy/utils/lib/truncateString' { - export default function truncateString (string: string, maxLength: number): string + export default function truncateString( + string: string, + maxLength: number, + ): string } declare module '@uppy/utils/lib/remoteFileObjToLocal' { - export default function remoteFileObjToLocal (file: object): Record + export default function remoteFileObjToLocal( + file: object, + ): Record } declare module '@uppy/utils/lib/fetchWithNetworkError' { - export default function fetchWithNetworkError (...options: unknown[]): Promise + export default function fetchWithNetworkError( + ...options: unknown[] + ): Promise } declare module '@uppy/utils/lib/ErrorWithCause' { interface ErrorOptions { - cause?: unknown; + cause?: unknown } export default class ErrorWithCause extends Error { @@ -314,16 +324,19 @@ declare module '@uppy/utils/lib/ErrorWithCause' { isNetworkError?: true - constructor (message: string, options?: ErrorOptions) + constructor(message: string, options?: ErrorOptions) } } declare module '@uppy/utils/lib/delay' { - export default function delay (ms:number, opts?: {signal: AbortSignal}): Promise + export default function delay( + ms: number, + opts?: { signal: AbortSignal }, + ): Promise } declare module '@uppy/utils/lib/hasProperty' { - export default function has (object: any, key: string): boolean + export default function has(object: any, key: string): boolean } declare module '@uppy/utils/lib/mimeTypes' { @@ -337,7 +350,7 @@ declare module '@uppy/utils' { [key: number]: T } export type InternalMetadata = { name: string; type?: string } - export interface FileProgress { + export interface FileProgress { uploadStarted: number | null uploadComplete: boolean percentage: number @@ -346,7 +359,7 @@ declare module '@uppy/utils' { } export interface UppyFile< TMeta = IndexedObject, - TBody = IndexedObject + TBody = IndexedObject, > { data: Blob | File extension: string @@ -372,8 +385,8 @@ declare module '@uppy/utils' { } } export interface Store { - getState (): Record - setState (patch: Record): void - subscribe (listener: any): () => void + getState(): Record + setState(patch: Record): void + subscribe(listener: any): () => void } } diff --git a/packages/@uppy/vue/types/dashboard-modal.d.ts b/packages/@uppy/vue/types/dashboard-modal.d.ts index ff23025e48..553219ee60 100644 --- a/packages/@uppy/vue/types/dashboard-modal.d.ts +++ b/packages/@uppy/vue/types/dashboard-modal.d.ts @@ -3,17 +3,23 @@ import type { Uppy, UIPlugin, BasePlugin } from '@uppy/core' import type DashboardPlugin from '@uppy/dashboard' interface Data { - plugin: DashboardPlugin; + plugin: DashboardPlugin } interface Props { - uppy: Uppy; - props: Record; - plugins: Array - open: boolean; + uppy: Uppy + props: Record + plugins: Array + open: boolean } interface Methods { - installPlugin(): void; - uninstallPlugin(uppy: Uppy): void; + installPlugin(): void + uninstallPlugin(uppy: Uppy): void } -declare const exports: import('vue/types/vue').ExtendedVue +declare const exports: import('vue/types/vue').ExtendedVue< + Vue, + Data, + Methods, + unknown, + Props +> export default exports diff --git a/packages/@uppy/vue/types/dashboard.d.ts b/packages/@uppy/vue/types/dashboard.d.ts index e22aa10989..e108769ce5 100644 --- a/packages/@uppy/vue/types/dashboard.d.ts +++ b/packages/@uppy/vue/types/dashboard.d.ts @@ -3,16 +3,22 @@ import type { Uppy, UIPlugin, BasePlugin } from '@uppy/core' import type DashboardPlugin from '@uppy/dashboard' interface Data { - plugin: DashboardPlugin; + plugin: DashboardPlugin } interface Props { - uppy: Uppy; - props: Record; - plugins: Array + uppy: Uppy + props: Record + plugins: Array } interface Methods { - installPlugin(): void; - uninstallPlugin(uppy: Uppy): void; + installPlugin(): void + uninstallPlugin(uppy: Uppy): void } -declare const exports: import('vue/types/vue').ExtendedVue +declare const exports: import('vue/types/vue').ExtendedVue< + Vue, + Data, + Methods, + unknown, + Props +> export default exports diff --git a/packages/@uppy/vue/types/drag-drop.d.ts b/packages/@uppy/vue/types/drag-drop.d.ts index 76968feff2..929ba0989e 100644 --- a/packages/@uppy/vue/types/drag-drop.d.ts +++ b/packages/@uppy/vue/types/drag-drop.d.ts @@ -2,16 +2,22 @@ import Vue from 'vue' import type { Uppy, UIPlugin, BasePlugin } from '@uppy/core' interface Data { - plugin: UIPlugin | BasePlugin; + plugin: UIPlugin | BasePlugin } interface Props { - uppy: Uppy; - props: Record; + uppy: Uppy + props: Record } interface Methods { - installPlugin(): void; - uninstallPlugin(uppy: Uppy): void; + installPlugin(): void + uninstallPlugin(uppy: Uppy): void } -declare const exports: import('vue/types/vue').ExtendedVue +declare const exports: import('vue/types/vue').ExtendedVue< + Vue, + Data, + Methods, + unknown, + Props +> export default exports diff --git a/packages/@uppy/vue/types/file-input.d.ts b/packages/@uppy/vue/types/file-input.d.ts index e74e08a73a..956f6b7a77 100644 --- a/packages/@uppy/vue/types/file-input.d.ts +++ b/packages/@uppy/vue/types/file-input.d.ts @@ -2,15 +2,21 @@ import Vue from 'vue' import type { Uppy, UIPlugin, BasePlugin } from '@uppy/core' interface Data { - plugin: UIPlugin | BasePlugin; + plugin: UIPlugin | BasePlugin } interface Props { - uppy: Uppy; - props: Record; + uppy: Uppy + props: Record } interface Methods { - installPlugin(): void; - uninstallPlugin(uppy: Uppy): void; + installPlugin(): void + uninstallPlugin(uppy: Uppy): void } -declare const exports: import('vue/types/vue').ExtendedVue +declare const exports: import('vue/types/vue').ExtendedVue< + Vue, + Data, + Methods, + unknown, + Props +> export default exports diff --git a/packages/@uppy/vue/types/progress-bar.d.ts b/packages/@uppy/vue/types/progress-bar.d.ts index e74e08a73a..956f6b7a77 100644 --- a/packages/@uppy/vue/types/progress-bar.d.ts +++ b/packages/@uppy/vue/types/progress-bar.d.ts @@ -2,15 +2,21 @@ import Vue from 'vue' import type { Uppy, UIPlugin, BasePlugin } from '@uppy/core' interface Data { - plugin: UIPlugin | BasePlugin; + plugin: UIPlugin | BasePlugin } interface Props { - uppy: Uppy; - props: Record; + uppy: Uppy + props: Record } interface Methods { - installPlugin(): void; - uninstallPlugin(uppy: Uppy): void; + installPlugin(): void + uninstallPlugin(uppy: Uppy): void } -declare const exports: import('vue/types/vue').ExtendedVue +declare const exports: import('vue/types/vue').ExtendedVue< + Vue, + Data, + Methods, + unknown, + Props +> export default exports diff --git a/packages/@uppy/vue/types/status-bar.d.ts b/packages/@uppy/vue/types/status-bar.d.ts index e74e08a73a..956f6b7a77 100644 --- a/packages/@uppy/vue/types/status-bar.d.ts +++ b/packages/@uppy/vue/types/status-bar.d.ts @@ -2,15 +2,21 @@ import Vue from 'vue' import type { Uppy, UIPlugin, BasePlugin } from '@uppy/core' interface Data { - plugin: UIPlugin | BasePlugin; + plugin: UIPlugin | BasePlugin } interface Props { - uppy: Uppy; - props: Record; + uppy: Uppy + props: Record } interface Methods { - installPlugin(): void; - uninstallPlugin(uppy: Uppy): void; + installPlugin(): void + uninstallPlugin(uppy: Uppy): void } -declare const exports: import('vue/types/vue').ExtendedVue +declare const exports: import('vue/types/vue').ExtendedVue< + Vue, + Data, + Methods, + unknown, + Props +> export default exports diff --git a/packages/@uppy/webcam/src/style.scss b/packages/@uppy/webcam/src/style.scss index 86c70e481f..34dc60ea3c 100644 --- a/packages/@uppy/webcam/src/style.scss +++ b/packages/@uppy/webcam/src/style.scss @@ -68,8 +68,12 @@ text-overflow: ellipsis; background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23757575%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E'); background-repeat: no-repeat; - background-position: right 0.4em top 50%, 0 0; - background-size: 0.65em auto, 100%; + background-position: + right 0.4em top 50%, + 0 0; + background-size: + 0.65em auto, + 100%; border: 1px solid $gray-600; .uppy-size--lg & { @@ -97,7 +101,8 @@ flex-grow: 0; width: 25%; color: $gray-600; - font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; + font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', + 'Courier New', monospace; text-align: right; } @@ -120,7 +125,7 @@ background-color: darken($red, 5%); } - [data-uppy-theme="dark"] & { + [data-uppy-theme='dark'] & { @include blue-border-focus--dark; } } @@ -191,7 +196,7 @@ line-height: 1.35; text-align: center; - [data-uppy-theme="dark"] & { + [data-uppy-theme='dark'] & { color: $gray-200; } } diff --git a/packages/@uppy/webcam/types/index.d.ts b/packages/@uppy/webcam/types/index.d.ts index 88028dfde2..1fc6c987c0 100644 --- a/packages/@uppy/webcam/types/index.d.ts +++ b/packages/@uppy/webcam/types/index.d.ts @@ -1,30 +1,26 @@ import type { PluginTarget, UIPlugin, UIPluginOptions } from '@uppy/core' import WebcamLocale from './generatedLocale' -export type WebcamMode = - | 'video-audio' - | 'video-only' - | 'audio-only' - | 'picture' +export type WebcamMode = 'video-audio' | 'video-only' | 'audio-only' | 'picture' export interface WebcamOptions extends UIPluginOptions { - target?: PluginTarget - onBeforeSnapshot?: () => Promise - countdown?: number | boolean - mirror?: boolean - /** - * @deprecated Use `videoConstraints.facingMode` instead. - */ - facingMode?: string - showVideoSourceDropdown?: boolean - modes?: WebcamMode[] - locale?: WebcamLocale - title?: string - videoConstraints?: MediaTrackConstraints - showRecordingLength?: boolean - preferredImageMimeType?: string - preferredVideoMimeType?: string - mobileNativeCamera?: boolean + target?: PluginTarget + onBeforeSnapshot?: () => Promise + countdown?: number | boolean + mirror?: boolean + /** + * @deprecated Use `videoConstraints.facingMode` instead. + */ + facingMode?: string + showVideoSourceDropdown?: boolean + modes?: WebcamMode[] + locale?: WebcamLocale + title?: string + videoConstraints?: MediaTrackConstraints + showRecordingLength?: boolean + preferredImageMimeType?: string + preferredVideoMimeType?: string + mobileNativeCamera?: boolean } declare class Webcam extends UIPlugin {} diff --git a/packages/@uppy/webcam/types/index.test-d.ts b/packages/@uppy/webcam/types/index.test-d.ts index b51e58ea22..c9c89daa4b 100644 --- a/packages/@uppy/webcam/types/index.test-d.ts +++ b/packages/@uppy/webcam/types/index.test-d.ts @@ -14,9 +14,11 @@ new Uppy().use(Webcam, { }, }) -expectError(new Uppy().use(Webcam, { - modes: ['video-only'], - videoConstraints: { - width: 'not a number har har', - }, -})) +expectError( + new Uppy().use(Webcam, { + modes: ['video-only'], + videoConstraints: { + width: 'not a number har har', + }, + }), +) diff --git a/packages/@uppy/xhr-upload/types/index.d.ts b/packages/@uppy/xhr-upload/types/index.d.ts index 0f2564c231..27ecbfd9ce 100644 --- a/packages/@uppy/xhr-upload/types/index.d.ts +++ b/packages/@uppy/xhr-upload/types/index.d.ts @@ -2,26 +2,30 @@ import type { PluginOptions, BasePlugin, UppyFile } from '@uppy/core' import XHRUploadLocale from './generatedLocale' export type Headers = { - [name: string]: string | number + [name: string]: string | number } export interface XHRUploadOptions extends PluginOptions { - limit?: number - bundle?: boolean - formData?: boolean - headers?: Headers | ((file: UppyFile) => Headers) - allowedMetaFields?: string[] | null - fieldName?: string - timeout?: number - responseUrlFieldName?: string - endpoint: string - method?: 'GET' | 'POST' | 'PUT' | 'HEAD' | 'get' | 'post' | 'put' | 'head' - locale?: XHRUploadLocale - responseType?: string - withCredentials?: boolean - validateStatus?: (statusCode: number, responseText: string, response: unknown) => boolean - getResponseData?: (responseText: string, response: unknown) => any - getResponseError?: (responseText: string, xhr: unknown) => Error + limit?: number + bundle?: boolean + formData?: boolean + headers?: Headers | ((file: UppyFile) => Headers) + allowedMetaFields?: string[] | null + fieldName?: string + timeout?: number + responseUrlFieldName?: string + endpoint: string + method?: 'GET' | 'POST' | 'PUT' | 'HEAD' | 'get' | 'post' | 'put' | 'head' + locale?: XHRUploadLocale + responseType?: string + withCredentials?: boolean + validateStatus?: ( + statusCode: number, + responseText: string, + response: unknown, + ) => boolean + getResponseData?: (responseText: string, response: unknown) => any + getResponseError?: (responseText: string, xhr: unknown) => Error } declare class XHRUpload extends BasePlugin {} diff --git a/packages/@uppy/zoom/types/index.d.ts b/packages/@uppy/zoom/types/index.d.ts index 6c380b675e..6f649d33ae 100644 --- a/packages/@uppy/zoom/types/index.d.ts +++ b/packages/@uppy/zoom/types/index.d.ts @@ -1,10 +1,13 @@ import type { PluginTarget, UIPlugin, UIPluginOptions } from '@uppy/core' -import type { TokenStorage, PublicProviderOptions } from '@uppy/companion-client' +import type { + TokenStorage, + PublicProviderOptions, +} from '@uppy/companion-client' interface ZoomOptions extends UIPluginOptions, PublicProviderOptions { - target?: PluginTarget - title?: string - storage?: TokenStorage + target?: PluginTarget + title?: string + storage?: TokenStorage } declare class Zoom extends UIPlugin {} diff --git a/packages/uppy/types/index.test-d.ts b/packages/uppy/types/index.test-d.ts index bbbbf0b449..e2beab6fae 100644 --- a/packages/uppy/types/index.test-d.ts +++ b/packages/uppy/types/index.test-d.ts @@ -1,6 +1,6 @@ -import * as Uppy from '..'; - -(() => { +import * as Uppy from '..' +// eslint-disable-next-line import/newline-after-import +;(() => { const uppy = new Uppy.Uppy({ autoProceed: false }) uppy.use(Uppy.Dashboard, { trigger: '#up_load_file_01' }) uppy.use(Uppy.DragDrop, { target: '#ttt' }) @@ -12,13 +12,18 @@ import * as Uppy from '..'; uppy.on('upload-success', (fileCount, body, uploadurl) => { console.log(fileCount, body, uploadurl, ` files uploaded`) }) -})(); - -(() => { +})() +;(() => { new Uppy.Uppy({ autoProceed: false }) .use(Uppy.Dashboard, { trigger: '#select-files' }) - .use(Uppy.GoogleDrive, { target: Uppy.Dashboard, companionUrl: 'https://companion.uppy.io' }) - .use(Uppy.Instagram, { target: Uppy.Dashboard, companionUrl: 'https://companion.uppy.io' }) + .use(Uppy.GoogleDrive, { + target: Uppy.Dashboard, + companionUrl: 'https://companion.uppy.io', + }) + .use(Uppy.Instagram, { + target: Uppy.Dashboard, + companionUrl: 'https://companion.uppy.io', + }) .use(Uppy.Webcam, { target: Uppy.Dashboard }) .use(Uppy.ScreenCapture) .use(Uppy.Tus, { endpoint: 'https://tusd.tusdemo.net/files/' }) @@ -26,9 +31,8 @@ import * as Uppy from '..'; uppy.on('complete', (result) => { console.log('Upload result:', result) }) -})(); - -(() => { +})() +;(() => { const uppy = new Uppy.Uppy() uppy.use(Uppy.DragDrop, { target: '.UppyDragDrop' }) uppy.use(Uppy.Tus, { endpoint: '//tusd.tusdemo.net/files/' }) diff --git a/private/dev/dragdrop.html b/private/dev/dragdrop.html index 2cdfa09e96..7579101fa1 100644 --- a/private/dev/dragdrop.html +++ b/private/dev/dragdrop.html @@ -1,8 +1,8 @@ - + - - + + Drag-Drop @@ -16,10 +16,10 @@

Drag-drop is here

- +
- +
diff --git a/private/dev/index.html b/private/dev/index.html index c2f7b92e48..e5515afe32 100644 --- a/private/dev/index.html +++ b/private/dev/index.html @@ -1,8 +1,8 @@ - + - - + + Dashboard