Commit graph

312 commits

Author SHA1 Message Date
Antoine du Hamel
773c8cb9a1
meta: add support for TypeScript plugins (#4640) 2023-10-17 15:38:15 +02:00
Artur Paikin
8b252086f5
@uppy/dashboard: auto discover and install plugins without target (#4343)
* Dashboard: auto discover plugins no matter when they were installed

* Remove target from RemoteSoruces, making it compatible with @uppy/react

* Update packages/@uppy/dashboard/src/Dashboard.jsx

Co-authored-by: Mikael Finstad <finstaden@gmail.com>

* Removed comments, added comments

* better comment

* Change type — otherwise gets listed on Dashboard sources

* Add RemoteSources to React test

* Add RemoteSources to React example

* Add tests

* Refactor for less iteration for each plugin, rename functions

* Prevent error when opts are undefined

* remove console.logs

* prettier

---------

Co-authored-by: Mikael Finstad <finstaden@gmail.com>
2023-10-12 23:19:40 +01:00
Antoine du Hamel
34c78e9093
meta: run Prettier on existing files (#4713) 2023-09-29 11:11:28 +02:00
Antoine du Hamel
2c432b12cd
test: migrate to Vitest for Uppy core and Uppy plugins (#4700) 2023-09-26 17:23:17 +02:00
Merlijn Vos
ef613e6a9f
Move remote file upload logic into companion-client (#4573) 2023-08-24 14:27:28 +02:00
Merlijn Vos
aa3f03f033
@uppy/core: allow duplicate files with onBeforeFileAdded (#4594) 2023-08-07 11:23:11 +02:00
Merlijn Vos
9efd865a1f
Load Google Drive / OneDrive lists 5-10x faster & always load all files (#4513)
Co-authored-by: Mikael Finstad <finstaden@gmail.com>
Co-authored-by: Artur Paikin <artur@arturpaikin.com>
2023-07-10 10:15:35 +02:00
Mikael Finstad
2c75ddacfe
@uppy/companion: implement refresh for authentication tokens (#4448)
* allow storing multiple tokens

inside uppy auth token

* de-duplicate uploadRemote

by creating a new superclass UploaderPlugin

* pull out requestSocketToken

from MiniXHRUpload

* add class UploaderPlugin

* refactor

* refactor

* refactor/reuse

* refactor/make getAuthToken private

* fix bug

* implement refresh token

for dropbox and google drive

closes #2721

* fix test

* also update auth token cookie
when refreshing token

* fix build error on node 14

* increase auth token expiry

to workaround expiry

* Update packages/@uppy/companion-client/src/RequestClient.js

Co-authored-by: Antoine du Hamel <antoine@transloadit.com>

* make queueRequestSocketToken private

* rename arg

* fix lint

* log error message

* fix s3

* Update packages/@uppy/companion-client/src/Provider.js

Co-authored-by: Antoine du Hamel <antoine@transloadit.com>

---------

Co-authored-by: Antoine du Hamel <antoine@transloadit.com>
2023-06-22 11:18:48 +02:00
LinusMain
38de438864
Migrate all lodash' per-method-packages usage to lodash. (#4274)
Fixes: https://github.com/transloadit/uppy/issues/4272
Co-authored-by: R <r@r.com>
Co-authored-by: Mikael Finstad <finstaden@gmail.com>
Co-authored-by: Antoine du Hamel <antoine@transloadit.com>
2023-06-19 15:45:28 +02:00
Artur Paikin
ad96bdb8ce
@uppy/core: Don't set late (throttled) progress event on a file that is 100% complete (#4507)
Don't set late (throttled) progress event on a file that is 100% complete

Co-authored-by: Antoine du Hamel <antoine@transloadit.com>
2023-06-19 15:11:30 +02:00
Mikael Finstad
90f7fb9197
@uppy/core: improve performance of validating & uploading files (#4402)
* show how many files are added when loading

remake of https://github.com/transloadit/uppy/pull/4388

* add french (cherry pick)

* implement concurrent file listing

* refactor / fix lint

* refactor/reduce duplication

* pull out totals validation

don't do it for every file added, as it's very slow
instead do the check at the end when all files are added.
this allows us to easily work with 10k+ files
fixes #4389

* Update packages/@uppy/core/src/Uppy.js

Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>

* make restricter.validate validate everything

instead make more specific methods for sub-validation
also rename validateTotals to validateAggregateRestrictions

* improve errors and user feedback

- handle errors centrally so that we can limit the amount of toasts (informers) sent to the users (prevent flooding hundreds/thousands of them)
- introduce FileRestrictionError which is a restriction error for a specific file
- introduce isUserFacing field for RestrictionError

* fix performance issue reintroduced

* improvements

- show "%{count} additional restrictions were not fulfilled" for any restriction errors more than 4
- refactor/rename methods
- improve ghost logic/comments

* improve performance when uploading

- introduce new event "upload-start"  that can contain multiple files
- make a new patchFilesState method to allow updating more files
- unify "upload-start" logic in all plugins (send it before files start uploading)
- defer slicing buffer until we need the data
- refactor to reuse code

* fix e2e build issue

* try to upgrade cypress

maybe it fixes the error

* Revert "fix e2e build issue"

This reverts commit ff3e580c0f.

* upgrade parcel

* move mutation logic to end

* remove FileRestrictionError

merge it with RestrictionError

* fix silly bug

looks like the e2e tests are doing its job 👏

---------

Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
2023-04-15 23:50:19 +08:00
Mikael Finstad
465dec797d
User feedback adding recursive folders take 2 (#4399)
* show how many files are added when loading

remake of https://github.com/transloadit/uppy/pull/4388

* add french (cherry pick)

* add todo
2023-04-15 23:21:45 +08:00
Artur Paikin
cc5b0154c5
Single File Mode: fix layout and make optional (#4374)
* Only enable singleFile mode when Dashboard tall enough + add centerSingleFile option

* Shorten file name when Dashboard is short 📏

* Center and flex single file, prevent overflows, contain img instead of cover

* White image background looks better

* Fix broken file type icons (shown when no image preview)

* Don't stretch images smaller than container / background

* uppy-c-textInput font-family inherit

* No shadow, retain cover when non-single-file, add paddings

* if preview is available, set white background, otherwise keep violet

* add transparency to the white background

* centerSingleFile --> singleFileFullScreen
2023-04-13 22:06:53 +01:00
Mikael Finstad
3dd1e5e68c
@uppy/provider-views: fix race condition when adding folders (#4384)
* fix race condtion when adding files

don't call addFolder from listAllFiles
because that would call addFile before all folders were loaded

also remove unused selectedFolders state

* fix also the case of adding multiple folders

* fix todo: remove SharedHandler

* remove loaderWrapper

* fix logic

* fix the last race condition

* fix broken duplicate file check

* fix logic

* prettiyfy loop

* add user feedback

so they know that something is happening

* run corepack yarn run build:locale-pack

* Revert "run corepack yarn run build:locale-pack"

This reverts commit 85548ce2fc.

* Revert "add user feedback"

This reverts commit 4060019c35.

* use async generator instead of p-map

* re-fix race-condition

* remove providerFileToId

as suggested by @arturi

* use addFiles instead of addFile

* rename function

* use provider-supplied file ID

instead of generating an ID, for providers that we whitelsit
this allows adding the same time many times (with a different path)

* call core directly

* improve dev dashboard

* disable experimental getAsFileSystemHandle

it seems to be causing problems when dropping folders with subfolders in newest chrome
e.g a folder with 50 files and a subfolder which in turn has another 50 files

also refactor and document the code more

* Update packages/@uppy/provider-views/src/ProviderView/ProviderView.jsx

Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>

* mov eto utils

---------

Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
2023-04-04 12:13:39 +09:00
Artur Paikin
f9e9702166
UI: Use form attribite with a form in doc root to prevent outer form submit (#4283)
* Use form attribite with a form in doc root to prevent outer form submit

* Fix Unsplash a11y bug — don't focus on hidden links

* Combine search and filter into one SearchFilterInput component for Unsplash

* Refactor Browser and ProviderView

* Refactor FileCard to hooks

* Finish SearchFilterInput, add reset labels and no results copy, better styles

* don't use debounce for now

* combine useEffects, named export, extract RenderMetaFields component

* inputCSSClassName --> inputClassName

* Remove typo

* 🤦

* Patch Preact to work with Jest

* tabs vs spaces

---------

Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
2023-03-30 14:04:55 +01:00
Nguyễn bảo Trung
376375c975
@uppy/core: fix bug with setOptions (#4350) 2023-03-28 09:16:30 +02:00
Alexander Zaytsev
df32c1c5b0
@uppy/dashboard: Fix low-contrast hover styles (#4347)
Fix low-contrast hover styles on Dashboard icons
2023-03-07 19:27:42 +08:00
Alexander Zaytsev
2e596ca9a1
@uppy/dashboard: update provider icon style (#4345) 2023-03-07 16:24:48 +08:00
Artur Paikin
222e511a98
@uppy/core: fix uppy.resetProgress() (#4337)
* Fix uppy.resetProgress()

* Update tests
2023-03-02 20:16:42 +00:00
Artur Paikin
7c9e166401
Warn more instead of erroring (#4302) 2023-02-09 19:31:21 +00:00
Antoine du Hamel
be85449385
@uppy/xhr-upload: add 'upload-stalled' event (#4247)
* @uppy/xhr-upload: add`'upload-stalled'` event

* Apply suggestions from code review

Co-authored-by: Merlijn Vos <merlijn@soverin.net>

* Add example

* Update website/src/docs/core.md

Co-authored-by: Merlijn Vos <merlijn@soverin.net>

* Update website/src/docs/core.md

* add bundle error and update locales

* add info message and update docs

* add French translation

* Update website/src/docs/core.md

* fixup! Update website/src/docs/core.md

---------

Co-authored-by: Merlijn Vos <merlijn@soverin.net>
2023-02-01 15:36:54 +00:00
Ikko Ashimine
717eab3b85
@uppy/core: fix typo in Uppy.test.js (#4235) 2022-11-28 10:41:29 -03:00
Artur Paikin
3fbe1c55d8
Fix button and input inconsistent font and style (#4162) 2022-10-21 15:32:00 +01:00
Antoine du Hamel
a11f92181f
@uppy/webcam: fix bug when Dashboard is using a custom id (#4099) 2022-10-19 16:08:49 -03:00
Andrew McIntee
7599f3abcb
@uppy/core: Fix Restrictor counts ghost files against maxNumberOfFiles (#4078)
Prevent core Restrictor class from including isGhost in maxNumberOfFiles count
2022-09-08 15:59:15 +02:00
Antoine du Hamel
a0eeb22458
meta: upgrade to Jest 29 (#4049) 2022-08-30 17:25:19 +02:00
Antoine du Hamel
e0f17e3753
meta: fix linter warnings (#4039) 2022-08-23 16:08:08 +02:00
Artur Paikin
7c460f3a66
core: uppy.addFile should accept browser File objects (#4020)
* If non-remote file has no .data, it’s a File object from the browser, convert it to Uppy format

* Add test

* Update packages/@uppy/core/src/Uppy.js

Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>

* Check for instanceof File

Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
2022-08-22 13:42:18 +01:00
Artur Paikin
4ed75ca61c
Style tweaks: use all: initial + other resets (#3983)
* Refactor uppy-u-reset: all: initial is now well-supported

* Utilize system-ui font-family, it should be provided by browsers now for multi-platform consistency

* Make Dashboard UI a little smaller by default

* Add uppy-c-btn to uppy-Dashboard-browse

* hide uploadNewlyAdded button when preprecessing

* Make “drop files here” tagline more even
2022-08-18 16:01:12 +01:00
Artur Paikin
c042f0220b
core: Remove deprecated get state and allowMultipleUploads option in Core (#3982)
* Remove deprecated get state and allowMultipleUploads option in Core

* Fix tests?

* core.getState()
2022-08-16 11:26:41 +01:00
Artur Paikin
346c2fcd43
core validateRestrictions: return error directly vs the result/reason obj (#3951)
* core validateRestrictions: return error directly vs the result/reason obj

* Refacrtor to actually use restrictionError instead of {reason, message}

* Return error instead of throwing
2022-08-08 10:58:43 +01:00
Merlijn Vos
9a213b59da
Fix all breaking todo comments for 3.0 (#3907)
- `@uppy/aws/s3-multipart`: remove `client` getter and setter.
  - reason: internal usage only
  - migrate: use exposed options only
- `@uppy/core`: remove `AggregateError` polyfill
  - reason: [should be polyfilled by the user](https://github.com/transloadit/uppy/pull/3532#discussion_r818602636)
  - migrate: install `AggregateError` polyfill or use `core-js`
- `@uppy/core`: remove `reset()` method
  - reason: it's a duplicate of `cancelAll`, but with a less intention revealing name
  - migrate: use `cancelAll`
- `@uppy/core`: remove backwards compatible exports (static properties on `Uppy`)
  - reason: transition to ESM
  - migrate: import the `Uppy` class by default and/or use named exports for everything else.
- `@uppy/react`: don't expose `validProps`
  - reason: internal only
  - migrate: do not depend on this
- `@uppy/store-redux`: remove backwards compatible exports (static properties on `ReduxStore`)
  - reason: transition to ESM
  - migrate: use named imports
- `@uppy/thumbnail-generator`: remove `rotateImage`, `protect`, and `canvasToBlob` from prototype.
  - reason: internal only
  - migrate: don't depend on this
2022-08-03 20:07:24 +02:00
Antoine du Hamel
6f3380b056
@uppy/store-default: export the class, don't expose .callbacks (#3928) 2022-08-03 11:19:09 +02:00
Antoine du Hamel
2e8f79787b
Merge stable branch 2022-07-27 19:47:25 +02:00
Antoine du Hamel
f808e9d741
@uppy/transloadit: cancel assemblies when all its files have been removed (#3893)
When starting an upload and removing it right away, it creates a race
condition when the assembly is created with no files and is never
closed. This commit ensures that the assembly is closed if all files
have been removed, or updated with the new expected number of
files otherwise.

Co-authored-by: Aaron Heimlich <aaron.heimlich@gmail.com>
2022-07-27 18:17:48 +02:00
Antoine du Hamel
a6029d0304 Merge stable branch 2022-06-09 21:15:10 +02:00
Antoine du Hamel
76751f6f4f
@uppy/core: fix TypeError when file was deleted (#3811) 2022-06-07 07:48:35 +02:00
Antoine du Hamel
6085477ed0
meta: disable ESM to CJS transform in dist files (#3773)
* meta: disable ESM to CJS transorm in dist files

This commit removes all the hacks that needed to happen in order to ship
working CJS code. Onwards, we plan to distribute Uppy packages as ESM.

* No mocking with Jest and ESM
2022-05-30 18:33:01 +02:00
Antoine du Hamel
456c2b7422
@uppy/core: refactor to ESM (#3744) 2022-05-20 11:04:09 +02:00
Artur Paikin
934ba79f00
core: wrap plugins in div.uppy-Root and set dir attrubute in UIPlugin (#3692)
* Add @uppy/remote-sources preset/plugin

* yarn.lock

* Update packages/@uppy/remote-sources/README.md

Co-authored-by: Merlijn Vos <merlijn@soverin.net>

* Use div.uppy-Root for all plugins mounted in DOM; set dir in UIPlugin

* remote uppy-Root from all UI plugins, as it will be set in UIPlugin automatically

* Remove uppy-Root from file-input

* Revert "Update packages/@uppy/remote-sources/README.md"

This reverts commit 3fd00028f7.

* Revert "yarn.lock"

This reverts commit 04dd8c73de.

* Revert "Add @uppy/remote-sources preset/plugin"

This reverts commit ac1f5df6b3.

* Update packages/@uppy/core/src/UIPlugin.js

Co-authored-by: Merlijn Vos <merlijn@soverin.net>

* Update packages/@uppy/drag-drop/src/DragDrop.jsx

Co-authored-by: Merlijn Vos <merlijn@soverin.net>

* Update packages/@uppy/core/src/UIPlugin.js

Co-authored-by: Renée Kooi <renee@kooi.me>

* Revert "Update packages/@uppy/core/src/UIPlugin.js"

This reverts commit f91af00d6b.

* @uppy/react: add .uppy-Contrainer class name to wrapper div

* @uppy/svelte: add .uppy-Contrainer class name to wrapper div

Co-authored-by: Merlijn Vos <merlijn@soverin.net>
Co-authored-by: Renée Kooi <renee@kooi.me>
2022-05-13 11:04:29 +01:00
Mikael Finstad
8ed210545c
proposal: Cancel assemblies optional (#3575)
* change cancel logic

to make canceling assemblies optional
possibly fixes #3547

* add forgotten file

* rewrite to reason='user'

* try to fix crash

* change reason to unmount

* Apply suggestions from code review

* add close+unmount in more code examples

also fix rule of hooks issue

* improve reason docs

* add tests

* add options also to reset

* update doc

* also prevent canceling uploads on unmount

* Update website/src/docs/transloadit.md

Co-authored-by: Merlijn Vos <merlijn@soverin.net>

* remove conflicting file

Co-authored-by: Merlijn Vos <merlijn@soverin.net>
2022-05-06 01:53:46 +07:00
Antoine du Hamel
a618715f04
@uppy/core: fix TypeError when file was removed (#3670) 2022-04-27 18:00:28 +02:00
Murderlon
79fed01a93
Add todo comments 2022-04-26 10:59:18 +02:00
Antoine du Hamel
066008ef41
@uppy/core: fix TypeError when file was removed (#3650) 2022-04-20 15:11:16 +02:00
Antoine du Hamel
cf749be6e5
@uppy/core: fix TypeError in event handler when file was removed (#3629) 2022-04-07 19:24:49 +02:00
CommanderRoot
e960357dcf
refactor: replace deprecated String.prototype.substr() (#3600)
.substr() is deprecated so we replace it with .slice() which works similarily but isn't deprecated

Signed-off-by: Tobias Speicher <rootcommander@gmail.com>
2022-03-28 13:29:50 +08:00
Merlijn Vos
6573b38cc7
Abstract restriction logic in a new Restricter class (#3532)
Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
2022-03-14 17:47:57 +08:00
Merlijn Vos
6da874ed3a
meta: Make E2E Great Again (#3444)
Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
2022-02-08 17:37:27 +01:00
Artur Paikin
80e5cedf11
Unsplash: UI improvements (#3438)
* add extra dot before file size

* show search term at the top when displaying results

* add inline search to result screen

* update locale

* update locale

* remove comments

* improve semantics, remove duplicate event handlers
2022-01-26 22:34:47 +00:00
Antoine du Hamel
479f3a68a5
deps: use nanoid/non-secure to workaround react-native limitation (#3350)
Fixes: https://github.com/transloadit/uppy/issues/3340
2021-12-09 15:33:25 +01:00