@emotion/core
Advanced tools
Comparing version 0.4.1 to 0.5.0
@@ -11,29 +11,12 @@ 'use strict'; | ||
var hydration = { | ||
shouldHydrate: false | ||
}; | ||
if (utils.isBrowser) { | ||
hydration.shouldHydrate = !!document.querySelector('[data-more]'); | ||
} | ||
function _set() {} | ||
function _get() { | ||
return true; | ||
} | ||
if (process.env.NODE_ENV === 'test' || !utils.isBrowser) { | ||
// $FlowFixMe | ||
Object.defineProperty(hydration, 'shouldHydrate', { | ||
set: _set, | ||
get: _get | ||
}); | ||
} // $FlowFixMe | ||
// $FlowFixMe | ||
var CSSContext = React.createContext(null); | ||
var defaultCache = createCache(); | ||
function consumer(instance, func) { | ||
return React.createElement(CSSContext.Consumer, null, function (context) { | ||
if (context === null) { | ||
if (utils.isBrowser && process.env.NODE_ENV !== 'test') { | ||
return func(defaultCache); | ||
} | ||
if (instance.emotionCache === undefined) { | ||
@@ -52,5 +35,4 @@ instance.emotionCache = createCache(); | ||
exports.hydration = hydration; | ||
exports.CSSContext = CSSContext; | ||
exports.consumer = consumer; | ||
//# sourceMappingURL=index.cjs.js.map |
@@ -5,29 +5,12 @@ import { isBrowser } from '@emotion/utils'; | ||
var hydration = { | ||
shouldHydrate: false | ||
}; | ||
if (isBrowser) { | ||
hydration.shouldHydrate = !!document.querySelector('[data-more]'); | ||
} | ||
function _set() {} | ||
function _get() { | ||
return true; | ||
} | ||
if (process.env.NODE_ENV === 'test' || !isBrowser) { | ||
// $FlowFixMe | ||
Object.defineProperty(hydration, 'shouldHydrate', { | ||
set: _set, | ||
get: _get | ||
}); | ||
} // $FlowFixMe | ||
// $FlowFixMe | ||
var CSSContext = createContext(null); | ||
var defaultCache = createCache(); | ||
function consumer(instance, func) { | ||
return createElement(CSSContext.Consumer, null, function (context) { | ||
if (context === null) { | ||
if (isBrowser && process.env.NODE_ENV !== 'test') { | ||
return func(defaultCache); | ||
} | ||
if (instance.emotionCache === undefined) { | ||
@@ -46,3 +29,3 @@ instance.emotionCache = createCache(); | ||
export { hydration, CSSContext, consumer }; | ||
export { CSSContext, consumer }; | ||
//# sourceMappingURL=index.es.js.map |
{ | ||
"name": "@emotion/core", | ||
"version": "0.4.1", | ||
"version": "0.5.0", | ||
"main": "dist/index.cjs.js", | ||
@@ -18,10 +18,10 @@ "module": "dist/index.es.js", | ||
"dependencies": { | ||
"@emotion/cache": "^0.4.1", | ||
"@emotion/cache": "^0.5.0", | ||
"@emotion/sheet": "^0.2.0", | ||
"@emotion/types": "^0.2.3", | ||
"@emotion/utils": "^0.4.1", | ||
"emotion-utils": "^9.0.1" | ||
"@emotion/types": "^0.5.0", | ||
"@emotion/utils": "^0.5.0", | ||
"emotion-utils": "^9.1.0" | ||
}, | ||
"peerDependencies": { | ||
"react": ">=16.3.0 || >=16.3.0-alpha.0" | ||
"react": ">=16.3.0" | ||
}, | ||
@@ -28,0 +28,0 @@ "devDependencies": { |
@@ -9,3 +9,3 @@ // @flow | ||
export type ProviderProps<T> = { | ||
type ProviderProps<T> = { | ||
value: T, | ||
@@ -15,14 +15,14 @@ children?: React.Node | ||
export type ConsumerProps<T> = { | ||
type ConsumerProps<T> = { | ||
children: RenderFn<T> | [RenderFn<T>] | ||
} | ||
export type ConsumerState<T> = { | ||
type ConsumerState<T> = { | ||
value: T | ||
} | ||
export type Provider<T> = React.Component<ProviderProps<T>> | ||
export type Consumer<T> = React.Component<ConsumerProps<T>, ConsumerState<T>> | ||
type Provider<T> = React.Component<ProviderProps<T>> | ||
type Consumer<T> = React.Component<ConsumerProps<T>, ConsumerState<T>> | ||
export type Context<T> = { | ||
type Context<T> = { | ||
Provider: Class<Provider<T>>, | ||
@@ -32,19 +32,7 @@ Consumer: Class<Consumer<T>> | ||
export let hydration = { shouldHydrate: false } | ||
if (isBrowser) { | ||
hydration.shouldHydrate = !!document.querySelector('[data-more]') | ||
} | ||
if (process.env.NODE_ENV === 'test' || !isBrowser) { | ||
// $FlowFixMe | ||
Object.defineProperty(hydration, 'shouldHydrate', { | ||
set: () => {}, | ||
get: () => true | ||
}) | ||
} | ||
// $FlowFixMe | ||
export const CSSContext: Context<CSSContextType> = React.createContext(null) | ||
let defaultCache = createCache() | ||
export function consumer( | ||
@@ -58,2 +46,5 @@ instance: { emotionCache?: CSSContextType }, | ||
if (context === null) { | ||
if (isBrowser && process.env.NODE_ENV !== 'test') { | ||
return func(defaultCache) | ||
} | ||
if (instance.emotionCache === undefined) { | ||
@@ -60,0 +51,0 @@ instance.emotionCache = createCache() |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3
8700
105
+ Added@emotion/cache@0.5.0(transitive)
+ Added@emotion/types@0.5.0(transitive)
+ Added@emotion/utils@0.5.0(transitive)
- Removed@emotion/cache@0.4.1(transitive)
- Removed@emotion/types@0.2.3(transitive)
- Removed@emotion/utils@0.4.1(transitive)
Updated@emotion/cache@^0.5.0
Updated@emotion/types@^0.5.0
Updated@emotion/utils@^0.5.0
Updatedemotion-utils@^9.1.0