- From: Justin Fagnani <notifications@github.com>
- Date: Tue, 01 Jul 2025 13:44:41 -0700
- To: WICG/webcomponents <webcomponents@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <WICG/webcomponents/issues/1069/3025445330@github.com>
justinfagnani left a comment (WICG/webcomponents#1069) @svieira > There are a number of concerns that have been voiced here that I agree with (the lack of an extra layer of render indirection making it impossible to have a context API, the need to have sensible behavior for a surprising number of built-in objects or else a large amount of boilerplate for each of them, etc.) I haven't address those here yet, but I don't think these are actual limitations. The idea presented here is very high-level and non-specific at the moment, and can and should adapt to use cases. lit-html, which implements many of the ideas here, has an internal RenderContext which is fed down the template/part tree while rendering. It also shows that supporting a useful set of datatypes is not unreasonable. > A very common composition pattern is the decorator: > > // In JSX but the same thing can be done in anything > function Foo(props) { > const [myProps, theirProps] = extract(props); > return <my-stuff my={myProps.explicit}><their-stuff {...theirProps} /></my-stuff> > } > How does this pattern work with this proposal? I'm not seeing how to translate from the Perl-esque / K-like sigils of `?`, `@`, `.` (maybe we should add `!` for signal peeking and `~` for implicated `await`?) for an explicit prop passing to the implicit splat of a bunch of props that I don't own and I don't want to own. In my proposal, elements will have "element bindings" which don't have a name, and are where spreads can be implemented. What we've done in Lit before is to support spread with a directive, like: ```ts function Foo(props) { const [myProps, theirProps] = extract(props); return <my-stuff my={myProps.explicit}><their-stuff {spread(theirProps)} /></my-stuff> } ``` This proposal could have more of this built in. -- Reply to this email directly or view it on GitHub: https://github.com/WICG/webcomponents/issues/1069#issuecomment-3025445330 You are receiving this because you are subscribed to this thread. Message ID: <WICG/webcomponents/issues/1069/3025445330@github.com>
Received on Tuesday, 1 July 2025 20:44:44 UTC