Repository URL to install this package:
|
Version:
1.2.11 ▾
|
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = (css) => {
const constructWithOptions = (componentConstructor, tag, options = {}) => {
// @todo
// if (!isValidElementType(tag)) {
// throw new Error(
// process.env.NODE_ENV !== 'production'
// ? `Cannot create styled-component for component: ${String(tag)}`
// : ''
// )
// }
/* This is callable directly as a template function */
// $FlowFixMe: Not typed to avoid destructuring arguments
const templateFunction = (...args) => componentConstructor(tag, options, css(...args));
/* If config methods are called, wrap up a new template function and merge options */
templateFunction.withConfig = config => constructWithOptions(componentConstructor, tag, Object.assign({}, options, config));
templateFunction.attrs = attrs => constructWithOptions(componentConstructor, tag, Object.assign({}, options, { attrs: Object.assign({}, (options.attrs || {}), attrs) }));
return templateFunction;
};
return constructWithOptions;
};
//# sourceMappingURL=constructWithOptions.js.map