[meta] Package Acorn reusable components for use on the web
Categories
(Toolkit :: UI Widgets, task)
Tracking
()
People
(Reporter: hjones, Unassigned)
References
(Depends on 16 open bugs, Blocks 1 open bug)
Details
(Keywords: meta, Whiteboard: [recomp])
Finding a way to package our reusable components for use on the web has been something we've discussed since the beginning of the Acorn project, but it never felt like the right time. Recently this idea has been gaining traction/momentum as we've encountered more potential use cases including - but not limited to - the enterprise admin panel, the possibility of using our elements on the Add-ons page and MDN, and some needs around UX prototyping via Netlify. I'm filing this meta bug to help track additional needs, and to start thinking through the steps we would need to take to support "regular" websites as a build target.
Some high level issues we'll have to think through:
- what do we do about cases where we're using Firefox specific and/or privileged APIs? We've encountered this a bit with Storybook already, but we've done some stubbing/mocking to get around it. To make things fully work in the wild we would have to find a way to decouple some logic, probably
- what do we do about Fluent dependencies? Do we package Fluent along with whatever library we create?
We have some prior art/explorations of this that can be viewed here: https://github.com/FirefoxUX/acorn-web
Updated•5 months ago
|
Comment 1•5 months ago
|
||
When working on the Enterprise project and using the widgets, here are some issues I found:
- custom elements stuff that's not implemented cross-browser (such as the
is=attribute for support links or labels) - things such as
window.MozXULElement?.insertFTLIfNeededorevent.inputSource == MouseEvent.MOZ_SOURCE_KEYBOARD. - typescript types (I converted everything to TS but in retrospect I should have added .d.ts files or used JS comments instead)
I had to update all widgets to use the more recent version of Lit.
moz-page-nav is very specific and I modified it a lot.
About other widgets, I had to change them a bit to adapt to the project, they're not always super generic or were lacking some web native functionalities (eg: form validation).
About Fluent, it was fine for me because we use it as well. This was actually one of the big driver for me to use the widgets in the first place.
You may need to detect whether it's present (it could be an optional peer dependency maybe?) so that MozLitElement can skip registering if it's missing.
That's all I can think of at the moment :-)
Just two notes for reference here;
- acorn-web-components repo; which is building out the components or widgets for the usecase of the AMO team for a DevHub rebuild
#acorn-web-componentsinternal slack channel
Updated•1 month ago
|
Updated•1 month ago
|
Description
•