[WICG/webcomponents] [declarative-custom-elements] Use cases: data transformation (Issue #1103)

sashafirsov created an issue (WICG/webcomponents#1103)

> Do template expressions need to be able to transform data? In what ways?

yes, the transform into data DOM, which later transformed into HTML DOM. XSLT at its primitive side.
The data can be transfered into variables, passed to HTML via attributes, tags, and text via selectors. The XPath selector is already there, no need to invent the wheel.

What data can be used?
* DCE attributes
* `data-` attributes
* DCE instace payload( HTML within custom tag )
* data slices - filled by `<slice>` tag/attribute and bound to value of child element by event
* template variables - temporary variables during the rendering i.e. `<xsl:variable>`

![Image](https://github.com/user-attachments/assets/bfa5180e-14f5-4be0-97f8-8f4342c21b53)

## system data/API
Is available via `value` of special custom elements, poyfills: [http-request](https://unpkg.com/@epa-wg/custom-element@0.0.33/demo/http-request.html) | [local-storage](https://unpkg.com/@epa-wg/custom-element@0.0.33/demo/local-storage.html) | [location-element](https://unpkg.com/@epa-wg/custom-element@0.0.33/demo/location-element.html)

The scope of system API should be aware of encapsulation and guarded to the scope of embeddable application, similar to the page but implemented as DCE. Such embeddable application would have all props and API of web app. Accessing those via special custom elements would account the scoping by app root.

Other working examples: [attributes ](https://unpkg.com/@epa-wg/custom-element@0.0.33/demo/attributes.html) | [data slices/events](https://unpkg.com/@epa-wg/custom-element@0.0.33/demo/data-slices.html) | [diary - slice, value, select relations](https://github.com/EPA-WG/custom-element/issues/45)

-- 
Reply to this email directly or view it on GitHub:
https://github.com/WICG/webcomponents/issues/1103
You are receiving this because you are subscribed to this thread.

Message ID: <WICG/webcomponents/issues/1103@github.com>

Received on Thursday, 17 April 2025 05:12:30 UTC