Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[scoped-registries] Should WC be usable as "views"? #998

Closed
chalbert opened this issue Apr 15, 2023 · 3 comments
Closed

[scoped-registries] Should WC be usable as "views"? #998

chalbert opened this issue Apr 15, 2023 · 3 comments

Comments

@chalbert
Copy link

Web Components have been up to now mostly used as low-level, presentational components. Inside a modern app, there are other type of components that I usually categorise under "views". Common view type may include micro-apps, sections, tabs, modals, etc. (not talking about the actual tab and modal UI component, but reusable tabs and modals with large business flow inside)

App
   MicroApp1
       Section1 
          Tab1
          Tab2
       Section2
          Modal1
   MicroApp2
      Section2
          Modal1
      Section3
          Tab1
          Tab3

I would like to get the community's opinions on possible use of WC as views.

  1. Should we aim at making it possible for WC to be used as views?
  2. Should those views use lightDOM?

My own answers are:

  1. Yes
  2. Yes
@sashafirsov
Copy link

sashafirsov commented Apr 15, 2023

It is rather a question than proposal. The answer is simple: it is already possible and widely used.

Any Web Component can be as container as just a self-sufficient UI. The "view" you are talking is a container. Either shadow DOM or light DOM can be used for container.

Here are the samples of the SLOT based containers with light DOM:
@epa-wg/custom-element,
slotted-element,
light-dom-element.

Most of web components are working with SLOT as container via shadow DOM. That is just one of samples: shadow-dom-element

The discussions of using the template-based Web Components without shadow DOM are in progress. Here is just one of those:
Functionally complete declarative templating.

It is unclear why this topic is marked by scoped-registries. Please elaborate the relation.

@sashafirsov
Copy link

sashafirsov commented Apr 15, 2023

The ability to embed microapplications into another Declarative Web Application and Declarative Custom Element is covered by DWA manifest, there are row of proposals related to the concept are in baking and under review.

Of course the embedding is not limited to the Declarative ones, the usual Web Components can be injected as well but it would be unsecure as JS is not limited by scope insulation layer. That is addressed by embed-page microapplication container POC. There is no proposal ready on that level yet. LMN if wanted to chime in.

@chalbert
Copy link
Author

Thanks @sashafirsov , I'll have a read on the links you've referenced, it sounds very interesting.

As for the relation to scoped-registries, if the use case is valid as you've hinted, then I would suggest that view-type components would benefit greatly from scoped registries and it should be considered at part of its design.

I was starting by gauging opinion on the subject, as if view-type components are out of scope by consensus, there is not much point going forward with a proposal.

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

No branches or pull requests

2 participants