be-media-savvy
TypeScript icon, indicating that this package has built-in type declarations

0.0.3 • Public • Published

be-media-savvy

Set properties of a native or imported custom-element based on media queries.

Playwright Tests

Size of package, including custom element behavior framework (be-decorated):

How big is this package in your project?

Size of new code in this package:

<my-vlist be-media-savvy='{
    "setProps":{
        "(min-width: 30em) and (max-width: 50em)":{
          "heightPerRow": "1.5em"
        }
    },
    "transformLC": { //light children
        "(min-width: 10em) and (max-width: 60em)":{
            "spanElements": [{"title": ["some title"]}]
        }
    },
    "transformSD":{ //shadow DOM children
        "(min-width: 10em) and (max-width: 60em)":{
            "spanElements": [{},{}{"aria-label": "some label"}]
        }
    }
}'>
    <template slot=row>
        ...
    </template>
</my-vlist>

... results in setting property myVlist.heightPerRow = "1.5em" when the viewport is between 30em and 50em.

[TODO] add support for template stamping.

Only setProps is implemented so far [TODO].

Package Sidebar

Install

npm i be-media-savvy

Weekly Downloads

1

Version

0.0.3

License

MIT

Unpacked Size

10.4 kB

Total Files

11

Last publish

Collaborators

  • bahrus