- From: Nicolas Gilbert <notifications@github.com>
- Date: Tue, 18 Apr 2023 18:36:54 -0700
- To: WICG/webcomponents <webcomponents@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <WICG/webcomponents/issues/987/1514012498@github.com>
Thanks for your answer and the time you've given to this concern.
As a parting note on this issue, here's some work I'm doing that uses JSX syntax to build WC from constructors.
```tsx
export default class AppLayout extends HTMLElement {
// Implements a rendering protocol that allows any compatible renderer to be used, e.g. jsx or lit.html
@render()
render({ children }) {
const navs = [
{ url: '/url1', text: 'Link A' },
{ url: '/url2', text: 'Link B' },
];
return (
<>
<AppHeader>header</AppHeader>
{/* custom attributes, experimental jsx syntax */}
<nav {CompositeWidget}={{ foo: 'bar '}} {AttachElement}="foo; bar">
{navs.map((nav) => (
<div>
<a href={nav.url}>{nav.text}</a>
</div>
))}
</nav>
{children}
<AppFooter>footer</AppFooter>
</>
)
}
}
```
Instead of limiting constructors to a single registry, I've moved to using a special `undetermined` element that get's upgraded once the node is connected. It means it also becomes possible to reuse templates statically between registries:
```tsx
export default class AppEntry extends HTMLElement {
@render()
static template = (
<AppLayout>
<HomePage />
</AppLayout>
)
}
```
I've got a prototype that seems to work correctly, although it's still very early. Let me know if you are interested in getting updated on my progress.
--
Reply to this email directly or view it on GitHub:
https://github.com/WICG/webcomponents/issues/987#issuecomment-1514012498
You are receiving this because you are subscribed to this thread.
Message ID: <WICG/webcomponents/issues/987/1514012498@github.com>
Received on Wednesday, 19 April 2023 01:36:59 UTC