How to use the @reshadow/core.map function in @reshadow/core

To help you get started, we’ve selected a few @reshadow/core 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 / index.js View on Github external
const reshadowStyled = createReshadowStyled((element, as, props, filtered) => {
    const style = coreStyled[KEYS.__style__];

    if (style) {
        props.style = Object.assign({}, style, props.style);
    }

    props = map(element, props);

    if (filtered) {
        for (let i = 0; i < filtered.length; i++) {
            delete props[filtered[i]];
        }
    }

    const result = React.createElement(as, props);

    if (style && result.props.style === props.style) {
        return result;
    }

    return React.cloneElement(result, {
        style: Object.assign({}, style, result.props.style),
    });
github lttb / reshadow / packages / react / index.js View on Github external
export function jsx() {
    const args = Array.prototype.slice.call(arguments);
    let element = args[0];
    if (typeof element === 'string' && !tags.has(element)) {
        args[0] = 'div';
    } else if (typeof element === 'function') {
        element = getDisplayName(element);
    }
    args[1] = map(element, args[1]);
    return React.createElement.apply(null, args);
}
github lttb / reshadow / packages / vue / index.js View on Github external
const map = (element, data) => {
    if (!data.attrs) return data;
    data.attrs.class = data.class;
    data.attrs.style = data.style;
    data.attrs = _map(element, data.attrs);
    data.class = data.attrs.class;
    data.style = data.attrs.style;
    delete data.attrs.class;
    delete data.attrs.style;
    return data;
};