Skip to content
This repository has been archived by the owner on Dec 11, 2023. It is now read-only.

Web Components support #121

Closed
asudoh opened this issue May 8, 2019 · 40 comments
Closed

Web Components support #121

asudoh opened this issue May 8, 2019 · 40 comments
Labels

Comments

@asudoh
Copy link

asudoh commented May 8, 2019

Motivations

  • Carbon has many framework variants, maintaining them (development/testing) is time-consuming effort
    • Need single reference implementation for the best markup and a11y considerations, that "just works" for multiple JavaScript frameworks - Need to avoid having to test against multiple frameworks
    • From that reason, Carbon Angular team is looking at Web Components (or making their Angular library on top of Web Components)
  • Win7, where the vast majority of IE11 users are, will be EOS in January 2020 (just a half year ahead)
    • Also, Chronium-based Edge seems to get IE11's rendering engine which means user can seamlessly use Chrome rendering engine for latest IBM apps while she can use IE11's rendering engine for her company's legacy app
  • Salesforce, Red Hat, SAP, Wired, Material, etc. have focused effort on Web Components: https://blog.bitsrc.io/9-web-component-ui-libraries-you-should-know-in-2019-9d4476c3f103

Suggestion of timeline and go-to-market strategy

  • First beta release by the date of Win7 EOS (January 2020)
    • Less-focused effort (prototype with <=20% efforts) in 2Q 2019
    • Focused effort (>50% of a few devs) in 2H 2019
    • Involve interested teams for contribution
  • If the feedback goes well
    • First production release in Q1 2020
    • React/Angular/Vue wrappers in Q2 2020
  • Keep non-WC-based React/Angular/Vue/vanilla versions for two years after first production release, given some product teams have harder requirements for older browsers
    • We can make it shorter or cancel such grace period, depending on the feedback

Architecture

  • Should be "bare metal" - Otherwise, it'll be just be yet another framework variant (template syntax bikeshedding)
  • Consider TypeScript
    • I personally am on the fence on this, but some potential contributors seems to be interested in this

Q&A

  • Will the Web Components and React/Angular/Vue interop?
    • Yes - Imagine <button> as a native button. React/Angular/Vue uses it with no problem. Web Components lets us create Carbon button as <bx-btn> which works the same manner as native <button>, which means React/Angular/Vue can use <bx-btn> with no problem. Here's a React example with data binding:
const Button = (kind, disabled, small, href) => (
  <bx-btn kind={kind} disabled={disabled} small={small} href={href} />
);
  • Can we still support IE11?
    • Though the ideal is dropping support for IE11 given the "future spec" nature, we can try polyfills to get "mininum" support
  • Will there be another "template syntax bikeshedding"?
    • Likely not; We are going with the template syntax used in the one of the most popular design system, which is aligned very well on upcoming specs

Iteration plans

Please refer to:
https://github.com/carbon-design-system/carbon-custom-elements#iteration-plans
https://github.com/carbon-design-system/carbon-custom-elements/tree/master/plans

@jeoffw
Copy link

jeoffw commented May 8, 2019

Looks promising. I do wonder if data binding interop could be made possible.

@asudoh
Copy link
Author

asudoh commented May 8, 2019

Thank you @jeoffw for raising a question! Updated Q&A for this with a code example.

@cal-smith
Copy link

This is great 🎉 definitely agree that we want to stick as close to the standards as reasonable. Things like lit-html and mwc style components are just natural extensions of the standard.

  • Consider TypeScript

In my experience the tooling benefits and refactoring guarantees are worth it, and since it's a superset of JavaScript the changeover is primarily just swapping out the compiler. It's been a great success in carbon-charts for a complex non-Angular example.

@stale
Copy link

stale bot commented May 24, 2019

We've marked this issue as stale because there hasn't been any activity for a couple of weeks. If there's no further activity on this issue in the next three days then we'll close it. Thanks for your contributions.

@stale stale bot added the wontfix label May 24, 2019
@asudoh asudoh removed the wontfix label May 25, 2019
@anthumchris
Copy link

anthumchris commented May 28, 2019

Generally speaking, how much "buy-in" does Web Components currently have from IBM and the Carbon team? Has this been discussed for a while or is it a relatively new proposal? What would it take for Web Components to gain traction?

I'm very interested in seeing Carbon provide first-class support for Web Components, as I expressed in carbon-design-system/carbon#2833. Very happy to see the Angular team already discussing this! In regards to "best practices", these resources could be helpful to align the development and avoid common mistakes:

@asudoh
Copy link
Author

asudoh commented May 29, 2019

@anthumchris Great to see that you jumped in this thread! Wrt Web Components discussion, it's been around at least for a few years, but in early days I saw that focusing on Web Components wouldn't be a sensible decision given the key specs were v0. Now v1 specs are implemented by all key browsers but IE/Edge and a lightweight, well-aligned-to-standards engine to stamp out template with data got its 1.0 release in Q1 this year - So good timing to re-start the discussion.

I personally saw the video (2nd link) at the time it was uploaded, and it definitely was a good one! The first link looks good, too, and I'm trying to add some key ones to the coding standard documentation.

As I mentioned in another thread, great to have more discussions/contributions! I see this is the best way for this effort to get tranctions. Also, don't forget to talk to your buddies and let them add 👍 to the issue description above!

@pulakb
Copy link

pulakb commented Jun 7, 2019

Why not Stenciljs can be used?
As per the documentation, Stencil takes features such as

  • Virtual DOM
  • Async rendering (inspired by React Fiber)
  • Reactive data-binding
  • TypeScript
  • JSX

Further, since Stencil generates standards-compliant web components, they can work with many popular frameworks right out of the box.

@asudoh
Copy link
Author

asudoh commented Jun 8, 2019

@pulakb Great question! We have had some conversations with people wrt Stencil. Given we are seeking for a possibility of Web Components serving the basis of multiple framework variants, we set "bare metal", "web standard alignment even in library choice" and "no DSL" goals described above. Stencil unfortunately seems to go against those goals. It only affects carbon-custom-elements repo with the goals described above, though, which means it doesn't prevent people to come up with Stencil version in another repo - Carbon is an open source design system.

@anthumchris
Copy link

These are some goals and ideas that could immediately help our teams, which consist of roughly 30 front-end and QA engineers spread across 3 countries & time zones. We'd like to reduce bugs and increase overall quality, consistency, and velocity:

  • Performance is prioritized - best-in-class development guided by knowledgable developers and best practices. Immediately:
    • components are lightweight, fast and independent.
    • library/framework bloat is non-existent.
  • Consistency, predictability, and quality assurance when used amidst other JS/CSS libraries
  • Quality control - use automated testing and rendering of component states and edge cases (long text, line-wrapping, etc).
    • Rasterized images - automated, batch-processed; QA teams could scroll through images for fast visual inspection.
    • Rendered DOM - on-demand, instant refresh; Developers can instantly and automatically reproduce a component's state and inspect DOM in browser.
    • Automated code tests - linting, unit tests, etc. would facilitate required use of best practices, APIs, and programatic behaviors.
  • Implementor-friendly - devs need a fast path to learn how to use and add a specific component.
    • Accessible & Dyslexic-friendly - offer brief, direct, and intuitive documentation/instructions/examples. avoid complexity.
  • Future-forward - older browsers shouldn't hinder quality; encourage customers to upgrade browsers

@asudoh
Copy link
Author

asudoh commented Jun 20, 2019

Thanks @anthumchris for sharing your priorities! The notion of thin library stack (avoiding library/framework bloat) 💯 aligns one of the goals in carbon-custom-elements project. I'm seeing QA/a11y benefits, too, by having a single library for multiple frameworks as you said, and automated tests (including a11y) is in considerations.

@abdonrd
Copy link

abdonrd commented Jun 24, 2019

This is really great!

I would like to share a couple of references from @web-padawan (from @vaadin):

And open-wc project:

@asudoh
Copy link
Author

asudoh commented Jun 24, 2019

Thank you for sharing the links @abdonrd! Following the link finds more nice resources like https://github.com/web-padawan/awesome-lit-html, which is great!

@pulakb
Copy link

pulakb commented Jun 24, 2019

This is quite interesting too https://open-wc.org

@grommett
Copy link

This list of frameworks that support custom elements might be of use as you continue to explore: https://custom-elements-everywhere.com/.

Additionally, I would add that lighterhtml would be a good option as an alternative to lit-html.

@stale
Copy link

stale bot commented Jul 24, 2019

We've marked this issue as stale because there hasn't been any activity for a couple of weeks. If there's no further activity on this issue in the next three days then we'll close it. Thanks for your contributions.

@stale stale bot added the wontfix label Jul 24, 2019
@asudoh
Copy link
Author

asudoh commented Jul 25, 2019

Cannot remove wontfix label, but the experimentation is ongoing at https://github.com/carbon-design-system/carbon-custom-elements. Let's continue the discussion there, but for anybody who are interested in the effort 👍 at this issue is still appreciated!

@asudoh asudoh closed this as completed Jul 25, 2019
@asudoh asudoh removed the wontfix label Oct 24, 2019
@asudoh asudoh reopened this Oct 24, 2019
@stale
Copy link

stale bot commented Nov 7, 2019

We've marked this issue as stale because there hasn't been any activity for a couple of weeks. If there's no further activity on this issue in the next three days then we'll close it. Thanks for your contributions.

@stale stale bot added the wontfix label Nov 7, 2019
@stale
Copy link

stale bot commented Nov 10, 2019

As there's been no activity since this issue was marked as stale, we are auto-closing it.

@stale stale bot closed this as completed Nov 10, 2019
@asudoh asudoh removed the wontfix label Nov 11, 2019
@asudoh asudoh reopened this Nov 11, 2019
@cal-smith
Copy link

👀

@stale
Copy link

stale bot commented Feb 27, 2020

We've marked this issue as stale because there hasn't been any activity for a couple of weeks. If there's no further activity on this issue in the next three days then we'll close it. Thanks for your contributions.

@stale stale bot added the wontfix label Feb 27, 2020
@asudoh asudoh removed the wontfix label Feb 27, 2020
@stale
Copy link

stale bot commented Mar 12, 2020

We've marked this issue as stale because there hasn't been any activity for a couple of weeks. If there's no further activity on this issue in the next three days then we'll close it. Thanks for your contributions.

@stale stale bot added the wontfix label Mar 12, 2020
@asudoh asudoh removed the wontfix label Mar 13, 2020
@stale
Copy link

stale bot commented Mar 27, 2020

We've marked this issue as stale because there hasn't been any activity for a couple of weeks. If there's no further activity on this issue in the next three days then we'll close it. Thanks for your contributions.

@stale stale bot added the wontfix label Mar 27, 2020
@asudoh asudoh removed the wontfix label Mar 27, 2020
@stale
Copy link

stale bot commented Apr 10, 2020

We've marked this issue as stale because there hasn't been any activity for a couple of weeks. If there's no further activity on this issue in the next three days then we'll close it. Thanks for your contributions.

@stale stale bot added the wontfix label Apr 10, 2020
@asudoh asudoh removed the wontfix label Apr 10, 2020
@abdonrd
Copy link

abdonrd commented Apr 10, 2020

BTW, interesting link:

How to Publish Web Components to NPM by @justinfagnani

@stale
Copy link

stale bot commented Apr 24, 2020

We've marked this issue as stale because there hasn't been any activity for a couple of weeks. If there's no further activity on this issue in the next three days then we'll close it. Thanks for your contributions.

@stale stale bot added the wontfix label Apr 24, 2020
@asudoh asudoh removed the wontfix label Apr 25, 2020
@stale
Copy link

stale bot commented May 9, 2020

We've marked this issue as stale because there hasn't been any activity for a couple of weeks. If there's no further activity on this issue in the next three days then we'll close it. Thanks for your contributions.

@stale stale bot added the wontfix label May 9, 2020
@asudoh asudoh removed the wontfix label May 9, 2020
@stale
Copy link

stale bot commented May 23, 2020

We've marked this issue as stale because there hasn't been any activity for a couple of weeks. If there's no further activity on this issue in the next three days then we'll close it. Thanks for your contributions.

@stale stale bot added the wontfix label May 23, 2020
@asudoh asudoh removed the wontfix label May 23, 2020
@stale
Copy link

stale bot commented Jun 6, 2020

We've marked this issue as stale because there hasn't been any activity for a couple of weeks. If there's no further activity on this issue in the next three days then we'll close it. Thanks for your contributions.

@stale stale bot added the wontfix label Jun 6, 2020
@asudoh
Copy link
Author

asudoh commented Jun 6, 2020

Closing as complete.

@asudoh asudoh closed this as completed Jun 6, 2020
@gearsandcode
Copy link

@asudoh - Need to update your link from carbon-custom-components to carbon-web-components.

@asudoh
Copy link
Author

asudoh commented May 4, 2021

@gearsandcode Updated the link - Thank you for pointing it out!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

8 participants