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>
* enforce some eslint rules
* enforce accessibility linter rules
* harden lint rules with only 1 or 2 warnings
* fix remaining rules with less than 3 warnings
* fix e2e tests
* fix remaining rules with less than 4 warnings
* fix remaining rules with less than 6 warnings
* fix `shuffleTaglines`
* fix companion build
* refactor FileProgress component; pass hideCancelButton, hidePauseResumeButton and hideRetryButton
* move icons to where they are rendered, rename UppyIcon to uppy-u-icon
* cleanup: rename DashboardItem, remove xmlns
* update docs to specify the option also hides action button on each individual file
* core: add an addFiles() method that only updates state once
Previously, adding 1300-ish files took around 260ms, and looked like
this in Firefox's performance tab:

All of the downward peaks are `setState()` calls and GC.
Now it takes around 60ms, and looks like this:

Here, most of the time is spent generating file IDs and guessing file
types. Those would be areas to look at next.
* dashboard: prevent frequent state update if nothing changed
After the last commit, `addFiles()` still spends a lot of time in
`emit()` and `hideAllPanels()`. The reason is that `addFiles()` still
emits all the hundreds of file-added events, and the Dashboard responds
to each with `hideAllPanels()`, which does a state update. But this all
happens synchronously, and the state almost certainly did not change
since the last `file-added` event that fired a millisecond ago.
This adds a check to avoid the state update if it is not necessary.

Adding 1300 files takes about 40ms now.
With this change, the `addFiles()` call is no longer the slowest
part—now preact rendering all the items is!
* utils: optimize generateFileID and getFileNameAndExtension
Replaces some clever things with more mundane and faster things!
Now, generateFileID is a bunch of string concatenations.
Now, getFileNameAndExtension uses `lastIndexOf()` instead of a regex.

Adding 1300 files takes about 25ms.
* dashboard: use preact-virtual-list
* thumbnail-generator: add `lazy` option
* dashboard: request thumbnails once file item renders the first time
* dashboard: fork preact-virtual-list
* core: add removeFiles() to remove files in bulk
* Implement removeFile() in terms of removeFiles()
* thumbnail-generator: only queue files that can be previewed
* rename size constants to accommodate WIDTH/HEIGHT
* Use new uppy.addFiles in DragDrop and FileInput
* utils: fix getFileNameAndExtension() type
* Rip out the lazy thumbnail generation
* Rip out virtualization.
* Remove virtualization leftovers
* tell future people that this is intentionally verbose
* Update package-lock.json
* henlo i am spell
* Make `addFiles()` respect maxNumberOfFiles
* core: show an informer error if some files fail in bulk add
* locales: fix quotes to make build:locale-pack happy
Co-authored-by: Artur Paikin <artur@arturpaikin.com>
* dashboard: reduce rerendering of FileItems
* dashboard: move pure HOC to util file
* dashboard: memoize arrays passed to child elements too
* dashboard: fix memoize-one import when bundler used `module` key
* @uppy/provider-views - added accessibility
* @uppy/provider-views - simplified checkbox css
* @uppy/dashboard - on tab set focus to the current verlay
* @uppy/dashboard - factored out code related to focus into a separate file
* @uppy/dashboard, and connected plugins - made focus travel well, and be managed in a single place in Dashboard
* @uppy/dashboard - made modal opener button focus keep focus on modal close
* @uppy/dashboard - focus management for uploaded-files
* @uppy/dashboard - made informer read messages without interruption
* @uppy/provider-views - removed the bug of focus jumping on safari
* @uppy/dashboard - made focus travel well in instagram in firefox
* @uppy - moved lodash.debounce dependency from / to @uppy/dashboard
* everywhere - made <ul>s not focusable for firefox
* @uppy/provider-views - unnested scss, copypasted alex's :focus changes
* Added JSDoc eslint package and rules, and fixed some JSDoc comments
* .eslintrc - made jsdoc errors warnings instead
* package-lock.json for new package.json
* eslint fix
* @uppy/dashboard - avoid forcing focus when we are inline
* @uppy/dashboard - in firefox, made sure superfocus is not switching back to uppy
* @uppy/dashboard - no focus jump for .info() inline, fix for firefox
Made focus not interrupt .info() when we are in the inline mode;
Made firefox start superfocusing when we either tab into, or click on some element in Uppy
* @uppy/dashboard - only listen to click/focus on uppy
* @uppy/dashboard - started trapping focus in inline mode too
* @uppy/dashboard - restricted trapFocus() event listener to this.el
* @uppy/core - started throttling progress emits.
1. To fix heat up in firefox
2. To fix focus in firefox
* @uppy/core - fixed tests by adding .flush()-s for progress emits
* @uppy/dashboard - stopped trapping focus in inline mode, made background inert
* @uppy/dashboard - added MutationObserver polyfill
* tests - made locale-packs.js pass
* REVERTED last 3 commits that introduced inert
Inert requires too many polyfills, atm tests fail in IE 10.0, wicg-inert library reportedly has performance issues. We decided to at least wait until _some_ browser introduce inert html property natively.
* @uppy/dashboard - IE11 fix for focusing
* @uppy/dashboard - fix for a bug in Safari for long uploads with checkbox clicking
* RERUN TESTS - tiny commit to rerun tests
* @uppy/dashboard - removed useless touchstart event listener
* Cancel superFocus in recordIfFocusedOnUppyRecently, when focus moves away from Uppy
* @uppy/provider-views - made Filter not swallow letters
* @uppy/dashboard - stopped superfocus from refocusing if we're already in the overlay
ignore drop/paste events if they are not in input or textarea —
otherwise when Url plugin adds drop/paste listeners to this.el,
draging UI elements or pasting anything into any field triggers those events — Url treats them as URLs that need to be imported
// @goto-bus-stop could you check this when you are back, what do you think