UNPKG

1.15 kBJavaScriptView Raw
1import Enhancer from './enhancer';
2import Plugins from './plugins';
3import Style from './components/style';
4import StyleRoot from './components/style-root';
5import getState from './get-state';
6import keyframes from './keyframes';
7import resolveStyles from './resolve-styles';
8
9function Radium(ComposedComponent: constructor) {
10 return Enhancer(ComposedComponent);
11}
12
13// Legacy object support.
14//
15// Normally it would be disfavored to attach these to the `Radium` object
16// because it defeats tree-shaking, using instead the ESM exports. But,
17// the `Radium` `Enhancer` uses **all** of these, so there's no extra "cost"
18// to them being explicitly on the `Radium` object.
19Radium.Plugins = Plugins;
20Radium.Style = Style;
21Radium.StyleRoot = StyleRoot;
22Radium.getState = getState;
23Radium.keyframes = keyframes;
24
25if (process.env.NODE_ENV !== 'production') {
26 Radium.TestMode = {
27 clearState: resolveStyles.__clearStateForTests,
28 disable: resolveStyles.__setTestMode.bind(null, false),
29 enable: resolveStyles.__setTestMode.bind(null, true)
30 };
31}
32
33export default Radium;
34
35// ESM re-exports
36export {Plugins, Style, StyleRoot, getState, keyframes};