Skip to content

bahrus/be-rewritten

Repository files navigation

be-rewritten

NPM version Playwright Tests How big is this package in your project?

Backdrop

The platform is showing very little interest in my proposal to allow processing of streaming HTML in a service worker (sniff!). Consequently, we have little choice but to do something on the main thread when we stream in HTML, which is what this element decorator does, via mutation observing (sigh).

Mission

be-rewritten extends be-written, by adding the ability to apply be-decorated element behaviors on selected elements as they render onto the screen, including DTR and xslt transforms.

It also can optionally absorb some of the functionality of be-definitive -- be-written can be used to define a custom element, which will be reused/rewritten multiple times throughout the page [TODO]

Part I: Applying non verbal spells on the HTML as it streams in

<div be-rewritten='{
    "from": "https://my-cdn.com/my-content",
    "make":{
        "cssSelector1": {
            "be": "metamorphic",
            "having": {
                "whenDefined": ["ui5-li", "ui5-list"],
                "xslt": "./ui5-list.xslt"
            }
        }
    }

}'>

User must provide references to be-decorated based web components separately.

If web component is not yet registered, simply adds the attribute.

Can also be an array:

<div be-rewritten='{
    "from": "",
    "make":{
        "cssSelector1": [
            {
                "be": "metamorphic",
                "having": {
                    "whenDefined": ["ui5-li", "ui5-list"],
                    "xslt": "./ui5-list.xslt"
                }
            }, {
                "be": "melodramatic",
                "having": {
                    "writer": "Jin-joo"
                }
            }
        ]
    }

}'>

Supports JS-friendly keys.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published