You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(docs): add style mode to docs-json output (#5718)
add a style mode to the output of the `docs-json` output target. when a
stencil component is declared using the `styleUrls` property, a user may
choose to apply styles depending on a "mode" that they set at runtime:
```tsx
// https://stenciljs.com/docs/component#styleurls
import { Component } from '@stencil/core';
@component({
tag: 'todo-list',
styleUrls: {
ios: 'todo-list.ios.scss',
md: 'todo-list.md.scss',
}
})
export class TodoList {}
```
where the `todo-list.ios.scss` stylesheet will be applied with the mode
is set to 'ios' at runtime, and `todo-list.md.scss` will be applied if
the mode 'md' is set at runtime.
with this change, documented css properties will be associated with
their respective modes in the output of the `docs-json` output target.
for `todo-list.md.scss`:
```sass
/**
* @prop --button-background: Background of the button
*/
:host {}
```
the mode will now be reported in `docs-json`:
```diff
{
"name": "--button-background",
"annotation": "prop",
"docs": "Background of the button",
+ "mode": "md"
},
```
if a property of the same name exists in more than one mode - e.g. if
`--button-background` _also_ existed in the ios mode stylesheet, two
separate entries will be generated. this is accomplished by using a
composite key for deduplicating/merging arrays consisting of the name
and mode of the property/stylesheet
STENCIL-1269 CSS Documentation Should Account for Modes
0 commit comments