Open Bug 2049737 (acorn-web) Opened 5 months ago Updated 23 hours ago

[meta] Package Acorn reusable components for use on the web

Categories

(Toolkit :: UI Widgets, task)

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

Depends on: 1803683

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?.insertFTLIfNeeded or event.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-components internal slack channel
Depends on: 2077247
Depends on: 2078801
Depends on: 1997653
Alias: recomp-web
Alias: recomp-web → acorn-web
Depends on: 2080248
Depends on: 2080251
Depends on: 2080254
Depends on: 2080255
Depends on: 2080258
Depends on: 2080270
Depends on: 2080276
Depends on: 2080292
Depends on: 2080295
Depends on: 2080300
Depends on: 2080303
Depends on: 2083001
Depends on: 1818301
Depends on: 2087523
Depends on: 2087526
Depends on: 2090249
Depends on: 2094752
Depends on: 2095261
You need to log in before you can comment on or make changes to this bug.