master-co / css

The CSS Language and Framework

Home Page:https://css.master.co

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

🐞 CSS variables with `themeDriver: 'media'` were not captured

1aron opened this issue · comments

commented

<style id="master"> with themeDriver: 'media'

:root {
    --primary: '#ff0000'
}

@media (prefers-color-scheme: 'dark') {
    :root { --primary: #000000 }
}

@media (prefers-color-scheme: 'light') {
    :root { --primary: #ffffff }
}

Expected

css.variables

{
    primary: {
        type: 'color',
        space: 'rgb',
        value: '255 0 0',
        themes: {
            dark: { type: 'color', space: 'rgb', value: '0 0 0' },
            light: { type: 'color', space: 'rgb', value: '255 255 255' },
        },
        natives: [...],
        ...
    }
}

@BenSeage Also, I think native should be attached to a theme or a single variable:

{
    primary: {
        type: 'color',
        space: 'rgb',
        value: '255 0 0',
        themes: {
            dark: { type: 'color', native: ..., space: 'rgb', value: '0 0 0' },
            light: { type: 'color', native: ..., space: 'rgb', value: '255 255 255' },
        },
        native: ...
        ...
    }
}

@BenSeage Don’t forget to review the processing of Progressive Rendering related logic and add tests.

Received

Not caught.