How to use the @reshadow/runtime.createCSS function in @reshadow/runtime

To help you get started, we’ve selected a few @reshadow/runtime examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github lttb / reshadow / packages / styled / global.js View on Github external
import React from 'react';
import {
    createStyled as createReshadowStyled,
    createCSS,
} from '@reshadow/runtime';
import coreStyled, {KEYS} from '@reshadow/core';
import stylis from 'stylis';
import styled from '.';

const globalCSS = createCSS({
    parse: code => {
        stylis.use(null);
        return {css: stylis('', code), tokens: {}};
    },
});

class GlobalStyle extends React.Component {
    render() {
        // eslint-disable-next-line
        const {style} = this.props;
        if (style) {
            for (const name in style) {
                document.documentElement.style.setProperty(name, style[name]);
            }
        }
github lttb / reshadow / packages / styled / index.js View on Github external
const styledProps = ['as', 'theme'];
const blacklist = new Set([...styledProps, 'color']);

const filterProps = props => {
    const nextProps = {};
    const filtered = Object.create(styledProps);
    Object.keys(props).forEach(prop => {
        nextProps[prop] = props[prop];
        if (blacklist.has(prop) || !isReactProp(prop)) {
            filtered.push(prop);
        }
    });
    return {props: nextProps, filtered};
};

const __css__ = createCSS({
    elements: false,
    classes: false,
    attributes: true,
    onlyNamespaced: true,
});

const mixin = value => {
    if (value[0] === "'" || value[0] === '"' || value.indexOf(':') === -1) {
        return value;
    }

    return __css__([value]);
};

function css() {
    const str = [...arguments[0]];

@reshadow/runtime

reshadow runtime

MIT
Latest version published 2 years ago

Package Health Score

49 / 100
Full package analysis

Similar packages