Open ilhan007 opened 1 year ago
@ilhan007 Any more details regarding this topic? Would be great to use the UI5 WCs in Frameworks like Sveltekit with all the advantages they provide.
The Declarative Shadow DOM proposal has now been merged into the HTML Spec and it looks like Firefox is going to implement it soon as well. Are there any plans to implement this feature in the next couple of months?
Background
Server-Side Rendering (SSR)
is a technique in which the server generates the full HTML for a page on the server in response to navigation. This avoids additional round-trips for data fetching and templating on the client, since it’s handled before the browser gets a response(https://web.dev/rendering-on-the-web/). When it comes to web components, it means generating and serving the HTML of the web components, including shadow DOM and styles, before their JavaScript implementations have loaded and executed.SSR
can be used for a variety of reasons but performance is the most obvious one - some sites can render faster if they render static HTML first without waiting for JavaScript to load, then (optionally) load the page's JavaScript and hydrate the components.Declarative Shadow DOM
Historically, it has been difficult to use
Shadow DOM
in combination withServer-Side Rendering
because there was no built-in way to express Shadow Roots in the server-generated HTML. There are also performance implications when attaching Shadow Roots to DOM elements that have already been rendered without them. This can cause layout shifting after the page has loaded, or temporarily show a flash of unstyled content while loading the Shadow Root's stylesheets.Declarative Shadow DOM
removes this limitation, bringing Shadow DOM to the server - it's a element with ashadowrootmode
attribute:A template element with the shadowrootmode attribute is detected by the HTML parser and immediately applied as the shadow root of its parent element. Loading the pure HTML markup from the above sample results in the following DOM tree:
Declarative Shadow DOM Support
Feature Request
As an application developer I would like to server-side my app, built UI5 Web Components could support some of the popular frameworks - like Next.js as described in FR https://github.com/SAP/ui5-webcomponents/issues/2240 by @MarcusNotheis
Tasks
Additional Context
Lit
already have done some progress on the topic and provides the @lit-labs/ssr package for server-side rendering Lit templates and components. As we internally reuse lit templates, we have to look into that implementation and available integrations with server side frameworks- KOA, AstroRelated Issues
https://github.com/SAP/ui5-webcomponents/issues/2240 https://github.com/SAP/ui5-webcomponents/issues/6192
Priority
A clear and concise description of the impact/urgency of the required feature.
Stakeholder Info (if applicable)