Commit graph

289 commits

Author SHA1 Message Date
Eduardo Flores
285ac9a9d0 Changed aria-level attribute to correct syntax. (#2032)
* Changed aria-level attribute to correct syntax.

Changed the aria-level attribute to the correct syntax. Changes were also made to meet ADA compliance.

* update a few more aria-level attributes

Co-authored-by: Renée Kooi <renee@kooi.me>
2020-01-22 13:06:53 +01:00
Artur Paikin
41af1995c2
Dashboard: Add image and archive icons (#2027)
* Add image and archive icons

* Refactor archiveTypes
2020-01-17 17:14:20 +03:00
Renée Kooi
2b91a96c95
Release 2020-01-15 16:39:45 +01:00
Renée Kooi
1463ee79ce
Improve performance of adding and removing files (#1949)
* 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:

![Flamegraph](https://i.imgur.com/08veuoU.png)

All of the downward peaks are `setState()` calls and GC.

Now it takes around 60ms, and looks like this:

![Flamegraph](https://i.imgur.com/xFdwVBV.png)

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.

![Flamegraph](https://i.imgur.com/KhuD035.png)

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.

![Flamegraph](https://i.imgur.com/ZQ1IhxI.png)

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>
2020-01-13 12:29:08 +01:00
Renée Kooi
18180d5778
Release 2019-12-16 12:53:23 +01:00
Renée Kooi
4179f790e1
drag-drop/dashboard: move dropEffect assignment to dragover (#1982)
Updating `dropEffect` on `ondrop` doesn't matter, since the effect will
already have been executed at that point. It should be updated in
ondragenter/ondragover instead.

fixes #1978
2019-12-11 16:33:49 +01:00
Renée Kooi
f1c208777c
dashboard: hide top bar cancel button when `hideCancelButton: t… (#1955)
Previously, only the cancel button in the status bar was hidden.

fixes https://github.com/transloadit/uppy/issues/1950
2019-11-27 14:43:17 +01:00
Artur Paikin
cdc7c7ce44
Dashboard: hide note/poweredBy on short screens, improve provider list behavior (#1943)
* add uppy-size--height-md, hide note/poweredBy on short screens, refactor uppy-DashboardTabs-list

* fix unnessesary scroll bars

* naming: onFileInputChange
2019-11-21 14:03:51 +03:00
Renée Kooi
c370dba0b6
Release 2019-11-04 10:56:06 +01:00
Artur Paikin
4e54483e61 core: setOptions for Core and plugins (#1728)
* Add a method to update options in Core

* Add a method to update options in Plugin (for any plugins)

* Allow re-initializing i18n locales after they’ve been updated with .setOptions

* use rest spread instead of Object.assign

* override setOptions in plugins to include i18nInit

* merge restrictions object in setOptions

* check that newOpts exists

* add spread ...

* don’t double merge

* add i18nInit to all plugins that use translation strings

* add setOptions tests to Core and Dashboard

* add setOptions docs for Core and Plugins

* fix tests for thumbnail-generator by adding plugins: {} to mock core

cause ThumbnailGenerator now calls this.setPluginState, which expects `core.state.plugins`

* also update meta with setOptions if it’s passed, change the way this.opts is set in core

@goto-bus-stop does this look ok? merging restrictions opts in core

* if locale was passed to setOptions(), call plugin.setOptions() on all plugins, so that i18n updates

* add Dashboard test that checks if locale is updated from Core via setOptions()

* Reafactor website Dashboard example to use setOptions and allow selecting a locale

🎉
2019-11-04 10:33:30 +01:00
Renée Kooi
aea91d00db
Release 2019-10-14 16:49:30 +02:00
Renée Kooi
dc4420e019
dashboard: fix retry icons on individual files (#1888)
The `...props` object that we were spreading into `<FileProgress />`
contained another, different `error` prop, which was empty for
individual file upload failures. By putting the `...props` spread in
front, the file-specific error takes precedence over the global error.

Fixes #1881
2019-10-14 16:32:30 +02:00
Renée Kooi
4e32e61d7c
Release 2019-10-09 21:00:46 +02:00
Renée Kooi
733de659da
Upgrade standard to v14 (#1860)
* Update eslint dependencies.

* standard --fix

* build: disable handler name lint rule

* status-bar: manually fix lint errors

* webcam: manually fix lint errors

* url: manually fix lint errors

* react-native: manually fix lint errors

* dashboard: manually fix lint errors

* informer: manually fix linting errors

* progress-bar: manually fix lint errors

* provider-views: manually fix lint errors

* redux-dev-tools: manually fix lint errors

* build: disable buggy no-unused-vars rule

* examples: manually fix lint errors

* ` quotes for code things, ' for text things
2019-10-09 14:53:02 +02:00
Artur Paikin
73907ae3c8
thumbnail-generator: add waitForThumbnailsBeforeUpload option, false by default (#1803)
* add waitForThumbnailsBeforeUpload option, false by default: enter preprocess stage until all thumbnails are generated and all exif data is added

* check if the queue is empty already, then resolve immediately

* add EXIF data to file meta, use uppy.once instead of on

* add generatingThumbnails locale

* delete the thumbnail from exif metadata, because it contains a blob
2019-09-18 19:18:48 +03:00
Matthias Kunnen
b50949c0f8 Add missing fields to DashboardOptions (#1830) 2019-09-16 11:22:25 +02:00
Artur Paikin
056a7114a1 Release 2019-08-30 15:24:04 +03:00
Evgenia Karunus
cc8c6540af getDroppedFiles.js: handle exceptions better (#1797)
* @utils/getDroppedFiles.js - mild refactoring

* @utils/getDroppedFiles.js - added .info and .log on drop error

* @utils/getDroppedFiles.js - one more refactor

* @utils/getDroppedFiles.js - log error objects instead of strings
2019-08-30 14:45:21 +03:00
Artur Paikin
4acd8be938
Add data attribute with source (so debugging is easier, or some customization), but hide the icon in css (#1809) 2019-08-28 11:49:16 +03:00
Renée Kooi
c62ec3665d Update eslint to v6 (#1777)
* Update eslint

* Do eslint --fix

* Do not access Object.prototype method 'hasOwnProperty' from target object

* utils: add hasProperty

* eslint --fix

* Disable quote-props for locale files

* add back quotes in locale files

* revert locale files to state on master

* Update react-scripts
2019-08-13 21:45:30 +03:00
Artur Paikin
2ed93fcce4
dashboard: add dashboard:file-edit-start and dashboard:file-edit-complete events (#1776)
* add dashboard:file-edit-start and dashboard:file-edit-complete events

* Small docs change

1. Changed unusual quotes `“` to the ones we use in other places `"`
2. `then user` => `the user`

* prettify quotes
2019-08-13 21:12:56 +03:00
Evgenia Karunus
8ac57c1ad8 Fix log duplication and excessive ResizeObserver log (#1747)
* everywhere - decorative changes

* /examples - fix duplicate logs in examples

* @uppy/dashboard - only fire the safety resize if we're not in a closed modal

* website/examples - made sure console.debug works in IE10
2019-08-05 15:16:10 +03:00
Matteo Padovano
2f092da106 fix wrong definition for metaFields property (#1763)
* fix wrong definition for metaFields property

* dashboard: add type test for metaFields
2019-08-02 13:10:37 +02:00
Renée Kooi
10bc79574e
lerna link convert (#1730)
* lerna link convert

* ci: use npm ci

* update lockfile

* companion: set `bin` to source file

Since typescript doesn't actually transform anything, we can just use
this.

In a next major version we could set `noEmit: true` in the tsconfig and
stop publishing `lib`.

* companion: do chmod +x on start-server.js

* build: remove obsolete lerna config

* build: explicitly install latest versions when building e2e tests for ci

* Remove versions from private packages

* fix regex

* try fix

* ci: force npm to install to endtoend folder

* ci: fold up e2e build output

* Update netlify deploy preview command

* Remove mentions of npm run bootstrap

* Edit .github/CONTRIBUTING.md instead

* companion: add proxy executable

* companion: fix publish

* Downgrade jest to appease create-react-app
2019-07-19 12:16:36 +02:00
Artur Paikin
bd2beedcff Release 2019-07-18 17:21:42 +02:00
Artur Paikin
78c643ae61 we don’t need no padding-top, we don’t need no space control 2019-07-18 16:35:57 +02:00
Artur Paikin
dc4e982280 remove prettier-bytes from dependencies, follow up for #1732 2019-07-17 19:53:14 +02:00
Artur Paikin
7873f057ca
utils: prettyBytes 1000 --> 1024 (#1732)
* Replace prettier-bytes with its copy, only use 1024 instead of 1000 to justify KB vs kB

* Add tests

* added License

* pretty-bytes to @uppy/utils/lib/prettyBytes everywhere
2019-07-16 15:21:47 +02:00
Evgenia Karunus
0b8674a1ce @uppy/dashboard - made Add More always stick to the right (#1733) 2019-07-15 16:07:11 +02:00
Artur Paikin
6b173d8c78
core: Restrictions improvements (#1726)
* Set file.type before calling onBeforeFileAdded, throw in upload so .catch works, emit restriction-failed for minNumberOfFiles, too

We must throw in upload onError, otherwise .catch won’t catch

* It seems startUpload is not used in Dashboard, used in StatusBar instead

probably a leftover from before StautsBar became a standalone plugin

* only log non-restriction errors

* throw early if restrictions.allowedFileTypes is not an array

* flip condition: do emit the event if err.isRestriction
2019-07-15 14:10:04 +02:00
Evgenia Karunus
70acbf7861 Adjust i18n (#1712)
* @uppy/locales - updated Nl translation as per Kevin

* @uppy/provider-views - moved all translations to Core, removed dependency on Dashboard

* @uppy/locales - added missing translations for 'Add more'
2019-07-12 18:04:42 +02:00
Evgenia Karunus
d47ed39d6f Ie11 filecard preview fix (#1718)
* @uppy/dashboard - factored out and visually nested FileCard scss

(Without changing any actual styles)

* @uppy/dashboard - positioned image previews well in FileCard.js for IE11

And updated CSS to depend on predictable flexbox logic.

* @uppy/dashboard - FileCard.js, ensured Firefox respects flexbox, and fixed border-radius in Safari

* @uppy/dashboard - FileCard.js, fixed imports, moved local classes to local css file

* @uppy/dashboard - FileCard.js, changed classNames as per the new convention

* @uppy/dashboard - FileCard.js, removed unneeded binds

* eslint - added the eslint warning for no unused vars

* eslint - commented out unused-variables rule

It's handy to have nearby, but we don't want to discriminate against all unused variables, sometimes they are expressive.
2019-07-10 16:27:40 +02:00
Evgenia Karunus
c02f9ee0ec @uppy/dashboard - connected labels to inputs in FileCard.js 2019-07-08 15:57:01 +02:00
Evgenia Karunus
e72c305e0a
Merge pull request #1701 from transloadit/add-pretty-focus-styles-everywhere
Added focus styles for all elements
2019-07-07 19:51:51 +02:00
Evgenia Karunus
ff8eebdb9b Fix header bar css in ie11 (#1700)
* @uppy/dashboard - css fix for title not being visible in IE11

* @uppy/dashboard - added nesting visual effect for scss
2019-07-04 18:01:32 +03:00
Renée Kooi
fcfdf64d7e Dashboard performance improvements (#1671)
* 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
2019-07-02 18:25:53 +03:00
Artur Paikin
1d8ee14ead fix the issue with FileCard rendering 0 in place of edit button, because props.metaFields.length
fixed by checking props.metaFields.length > 0, which returns true/false instead of 0
thanks @goto-bus-stop! //cc @lakesare
2019-07-02 17:02:22 +02:00
Evgenia Karunus
bbf0b33bcb everywhere - added focus styles for every element 2019-06-29 09:02:08 +05:00
Artur Paikin
5e35987079
Log error in uppy.addFile try/catch (#1680)
* Log error in uppy.addFile try/catch

* Add `.isRestriction` to a custom RestrictionError, check for that before logging

* keep throwing for robodog.upload

//cc @goto-bus-stop
2019-06-28 20:25:17 +03:00
Alexander Zaytsev
3b4547fa2c More design improvements (#1574)
* Better focus styles

* Improve focus on the remove button

* "Add more" caption to the "+" button (todo: i18n)

* Add i18n (todo: check)

* Fix icon size

* Try removing file source (todo: remove icons)

* Simplify caption

* Revert "Try removing file source (todo: remove icons)"

This reverts commit 20c5ecb554.

* (WIP) Use icons for Edit / Copy link actions

* Class names optimizing

* Subtle shadows

* Optimize code, align action icons on smaller screens

* Reduce Tab-btn horizontal padding on mobile

* Fix padding

* i18n

* replace arabic with persian

* initial refactor

* primarily FileItem's css - reintegrated Alex's changes

* @uppy/dashboard - unnested subcomponents from ./components

* @uppy/dashboard scss - added some spacing as per conventions

* @uppy/dashboard - changed behaviour of truncateString() to always return a predictable number of symbols

* @uppy/dashboard - subdivided FileItem.js and its css into smaller files

Removed unused css classes, made filenames avoid overflow

* @uppy/dashboard - removed unused .currentWidth prop, FileItem.js - made fileName take up at most 2 lines

* test:endtoend:prepare-ci - fix test by reordering locale lines

* @uppy/dashboard - decorative FileItem.js changes

* @uppy/dashboard - made css of FileItem.js more flat

* @uppy/Dashboard - in FileItem.js made max filename length 30 symbols

* fix image getting width: 100% in DashboardFileCard

//cc @lakesare

* FileItem.scss - removed tagnames
2019-06-28 15:20:04 +03:00
Artur Paikin
81a45a01ed eslint jsdoc fixes 2019-06-25 18:27:48 +03:00
Evgenia Karunus
0755798b8c Make DragDrop entirely clickable (#1633)
* /examples/dev - added drag-drop plugin dev environment

* @uppy/drag-drop - moved isDragDropSupported() to @uppy/utils

* @uppy/drag-drop - got rid of drag-drop npm library

* examples/dev - made compiled files placed in /output instead of /lib

* ~/examples/dev - made watchify only watch files once

* @uppy/drag-drop - add onPaste

* /examples/dev - readded html css override-attempts

* @uppy/drag-drop - made whole area clickable, and made it accessible

* @uppy/drag-drop - removed excessive outline in firefox

* change dragText classname to browse, minor spacing and order changes
2019-06-19 20:14:44 +03:00
Evgenia Karunus
7ce63fcb7e Accessibility follow-up PR: make all svgs not focusable in IE11 (#1662)
* /examples/dev - added polyfills for easy development in IE11

* @uppy/dashboard - made all svgs not focusable in IE11

* /examples/dev - started sharing serviceWorker registration code

* /examples/dev - added polyfills for IE11 to dev bundle
2019-06-17 17:08:05 +03:00
Artur Paikin
07da7840dc
dashboard: add modal open and close events (#1664)
* add modal-open and modal-closed events, call hideAllPanels() when modal is closed

* Document dashboard:modal-open and dashboard:modal-closed events
2019-06-17 16:23:49 +03:00
Artur Paikin
4eb2e65101
dashboard: Refactor FileCard component to fix loosing metadata state on re-renders (#1656)
* Refactor to fix loosing metadata state on re-renders

* uppy-DashboardContent-bar shouldn’t shrink

* Populate formState in constructor, empty meta value if undefined, pass field.id from oninput

* Use local styles instead of unpkg CDN

* update locales and stargazers
2019-06-14 19:18:14 +03:00
Evgenia Karunus
6bcf2040e9 Feature/accessibility (#1507)
* @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
2019-06-11 19:10:32 +03:00
Artur Paikin
28d235fe2f Release 2019-06-05 19:07:20 +03:00
Renée Kooi
b64705fce2
New sync version (#1600)
New sync version
2019-06-05 16:19:48 +02:00
Evgenia Karunus
8be2004826 Feature/replace dnd in drag drop package (#1565)
* /examples/dev - added drag-drop plugin dev environment

* @uppy/drag-drop - moved isDragDropSupported() to @uppy/utils

* @uppy/drag-drop - got rid of drag-drop npm library

* examples/dev - made compiled files placed in /output instead of /lib

* ~/examples/dev - made watchify only watch files once

* @uppy/drag-drop - add onPaste

* /examples/dev - readded html css override-attempts

* @uppy/drag-drop - made whole area clickable, and made it accessible

* @uppy/drag-drop - removed excessive outline in firefox

* REVERTED last 2 commits
2019-06-05 17:04:34 +03:00
Evgenia Karunus
2db91e626c @uppy/dashboard - made paste work while we're focused on buttons (#1619) 2019-05-31 18:30:46 +03:00