UNPKG

@crossed/styled

Version:

A universal & performant styling library for React Native, Next.js & React

26 lines (25 loc) 770 B
import { Registry } from "./Registry"; import { createMethods } from "./createMethods"; import { isWeb } from "./isWeb"; const createStyles = (stylesParam) => { let results = stylesParam(Registry.getTheme(isWeb)); const foo = new Proxy( Object.entries(results).reduce((acc, [keyStyle, styleOfKey]) => { acc[keyStyle] = typeof styleOfKey === "function" ? styleOfKey : createMethods(styleOfKey); return acc; }, {}), { get(cible, prop) { return typeof results[prop] === "function" ? results[prop] : createMethods(results[prop]); } } ); !isWeb && Registry.subscribe(() => { results = stylesParam(Registry.getTheme(isWeb)); }); return foo; }; export { createStyles }; //# sourceMappingURL=createStyles.js.map