Open Murderlon opened 3 months ago
Agreed with all points, thank you for summing it up so thoroughly!
One other library that we might glean inspiration from is https://mui.com/material-ui/react-pagination/#custom-icons, overriding their ui has always been a good experience for me.
Is this a thing yet? Are there any libraries that have tried this?
No this is a massive undertaking that hasn't been started yet. We're also lower than ever on core maintainers so don't expect it soon.
Initial checklist
Problem
One size fits no one
Developers starting with Uppy are forced to choose between the full-featured, bundle size heavy, and non-customizable
dashboard
or the overly barebonesdrag-drop
.After years of speaking to developers on GitHub, the community forum, and with Transloadit customers – the reality seems to be that majority of people have their needs fall somewhere in between
dashboard
anddrag-drop
. Countless issues have been posted about them wanting mostly X but doing Y different for their use case.@uppy/dashboard
has tried to accommodate for some of these requests over the years which introduced overly specific "toggles", such asshowLinkToFileUploadResult
,showProgressDetails
,hideUploadButton
,hideRetryButton
,hidePauseResumeButton
,hideCancelButton
,hideProgressAfterFinish
,showRemoveButtonAfterComplete
,disableStatusBar
,disableInformer
, anddisableThumbnailGenerator
.Continuing down this path is not maintainable nor will we ever reach a set of "toggles" at this granularity level to support a wide range of use cases and unique requirements.
Fake promise of modular UI components
We built
status-bar
,progress-bar
,image-editor
,thumbnail-generator
,informer
, andprovider-views
as separate plugins, communicating on a first glance these are standalone components, but they are tightly coupled todashboard
. It's not impossible to use them separately, but this is discouraged, undocumented, and unclear which features won't work outside ofdashboard
.Modern expectations
Since Uppy's conception 9 years ago the front-end landscape has significantly changed. Uppy is even built with a "vanilla" first approach because that was still popular at the time over front-end frameworks.
These days developers have high expectations for choosing a library. In a world where everything is component driven, OSS UI libraries are expected to offer truly composable building blocks, which are light on bundle size, and ideally with accessibility kept in mind.
For Uppy to stay relevant in the coming years a major chance is needed in how we let users built their uploading UI.
Solution
At a glance
Composable, headless Uppy UI components. These would be highly granular and without loosing support for our existing frameworks (Angular, Svelte, React, Vue).
Good examples of headless UI libraries:
It basically boils down to three things, which all work with declarative APIs:
For example:
Continuing with React as an example, it would mean instead of doing the all-or-nothing approach as we currently have:
...you would compose only UI elements you need. In the case of this pseudo-code example, the OS file picker, Google Drive, and an added file list with thumbnails.
What would this mean?
The long-term vision would be that this could replace
dashboard
,drag-drop
,status-bar
,progress-bar
,informer
,provider-views
, andfile-input
in favor of highly granular components and one or two preconfigured compositions by us. The first phase could mean keeping all plugins around and slowly building these components. But it's better to try to build a dashboard-like experience with these components to 1) dogfood yourself and see what's needed and 2) eventually replace the monolith dashboard with a preconfigured composition.Challenges
useUppyState
because it's hard to integrate/sync external state into the state of a framework. We don't have this for other frameworks. Uppy's state also tends to be clumsy. For instance, there is no way to know in which state (idle, uploading, error, post-processing, etc) Uppy is in because it's not a finite state machine. This limits UI building.Potential technical approaches
Mitosis
Pros
Cons
Uncertainties
useSyncExternalStore
(used inuseUppyState
) to subscribe to third-party state inside the React lifecycle but we don't have that for other frameworks. How would other frameworks sync state with Uppy's internal state when using mitosis?HTML-first
Franken UI proves that you can turn shadcn/ui (React only) into a framework agnostic component library while maintaining the same flexibility. It's mostly just a styling wrapper (to match shadcn styles) around UIKit.
How that would like inside React for tabs component:
Pros
Cons
How to move forward from here
The only way to find out is creating some proof of concepts and see the limitations first hand.