- From: Joe Pea <notifications@github.com>
- Date: Tue, 01 Apr 2025 10:16:07 -0700
- To: WICG/webcomponents <webcomponents@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <WICG/webcomponents/issues/1069/2770079751@github.com>
trusktr left a comment (WICG/webcomponents#1069) This does simplify DOM templating in JS, but doesn't solve non-JS needs. The Template Instantiation proposal is too complex, and I wrote about an alternative simpler approach here, https://discord.com/channels/767813449048260658/1354736298182705212 namely that the requirements for templating features can be specified, with a zero-JS requirement, and implementation details left to browsers. On the topic of signals, the tagged templates could remain simple without caring about the existence of Signals, and instead a separate API can be used for that. ```js import {createEffect} from 'whatever-library' createEffect(() => { const result = html` <p>value ${anyValue()}</p> ` // ... }) ``` I don't think signal reactivity needs to be coupled to them. Also while we're at it, I would want it to return actual DOM, and let the update mechanism be an implementation detail of the browsers because as a user of Web APIs I do not want to install frameworks just to use web features, that's just not great: ```js const result = html` <p>value ${anyValue()}</p> ` console.log(result instanceof HTMLParagraphElement) // true ``` This, ```js document.body.render(renderPost('Hello World', 'This is a template')); ``` is far too complicated of an API for what web devs need (imagine a hundred interpolation sites), requiring them to write more JS than necessary or import frameworks, which I don't like as a direction for APIs that I want in browsers as an end user. I feel like we're designing all new APIs as libraries only for frameworks, which makes web APIs very non-ideal for non-framework authors. Ideally we eliminate frameworks with new web APIs rather than making frameworks required. As an end user of Web APIs, I want the best DX out of the box. It would be great to work on specs from that direction, then add things for framework authors only if needed. As a user, if I have to use a framework, then it literally makes no difference if I use any `html` tagged template literal vs one that ships with a browser, therefore eliminating a lot of the value that shipping one in a browser could add. -- Reply to this email directly or view it on GitHub: https://github.com/WICG/webcomponents/issues/1069#issuecomment-2770079751 You are receiving this because you are subscribed to this thread. Message ID: <WICG/webcomponents/issues/1069/2770079751@github.com>
Received on Tuesday, 1 April 2025 17:16:11 UTC