@team-griffin/react-dye
Advanced tools
Comparing version 3.0.0 to 3.0.1
@@ -61,3 +61,17 @@ 'use strict'; | ||
var useTheme = function useTheme() { | ||
var theme = React.useContext(ThemeContext); | ||
return theme; | ||
}; | ||
var withThemeHook = function withThemeHook(props) { | ||
return Object.assign({ | ||
theme: useTheme() | ||
}, props); | ||
}; | ||
exports.ThemeProvider = ThemeProvider; | ||
exports.withTheme = withTheme; | ||
exports.withThemeHook = withThemeHook; | ||
exports.useTheme = useTheme; |
@@ -1,1 +0,1 @@ | ||
"use strict";function _interopDefault(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),React__default=_interopDefault(React),ThemeContext=React.createContext(null),Provider=ThemeContext.Provider,Consumer=ThemeContext.Consumer,ThemeProvider=function(e){var t=e.theme,r=e.children;return React__default.createElement(Provider,{value:t},r)};ThemeProvider.displayName="ThemeProvider";var _extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},withTheme=function(e){var t=function(t){return React__default.createElement(Consumer,null,function(r){return React__default.createElement(e,_extends({theme:r},t))})};return t.displayName="WithTheme",t};exports.ThemeProvider=ThemeProvider,exports.withTheme=withTheme; | ||
"use strict";function _interopDefault(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),React__default=_interopDefault(React),ThemeContext=React.createContext(null),Provider=ThemeContext.Provider,Consumer=ThemeContext.Consumer,ThemeProvider=function(e){var t=e.theme,r=e.children;return React__default.createElement(Provider,{value:t},r)};ThemeProvider.displayName="ThemeProvider";var _extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},withTheme=function(e){var t=function(t){return React__default.createElement(Consumer,null,function(r){return React__default.createElement(e,_extends({theme:r},t))})};return t.displayName="WithTheme",t},useTheme=function(){return React.useContext(ThemeContext)},withThemeHook=function(e){return Object.assign({theme:useTheme()},e)};exports.ThemeProvider=ThemeProvider,exports.withTheme=withTheme,exports.withThemeHook=withThemeHook,exports.useTheme=useTheme; |
@@ -1,2 +0,2 @@ | ||
import React, { createContext } from 'react'; | ||
import React, { createContext, useContext } from 'react'; | ||
@@ -54,2 +54,14 @@ var ThemeContext = createContext(null); | ||
export { ThemeProvider, withTheme }; | ||
var useTheme = function useTheme() { | ||
var theme = useContext(ThemeContext); | ||
return theme; | ||
}; | ||
var withThemeHook = function withThemeHook(props) { | ||
return Object.assign({ | ||
theme: useTheme() | ||
}, props); | ||
}; | ||
export { ThemeProvider, withTheme, withThemeHook, useTheme }; |
@@ -1,1 +0,1 @@ | ||
import React,{createContext}from"react";var ThemeContext=createContext(null),Provider=ThemeContext.Provider,Consumer=ThemeContext.Consumer,ThemeProvider=function(e){var t=e.theme,r=e.children;return React.createElement(Provider,{value:t},r)};ThemeProvider.displayName="ThemeProvider";var _extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},withTheme=function(e){var t=function(t){return React.createElement(Consumer,null,function(r){return React.createElement(e,_extends({theme:r},t))})};return t.displayName="WithTheme",t};export{ThemeProvider,withTheme}; | ||
import React,{createContext,useContext}from"react";var ThemeContext=createContext(null),Provider=ThemeContext.Provider,Consumer=ThemeContext.Consumer,ThemeProvider=function(e){var t=e.theme,r=e.children;return React.createElement(Provider,{value:t},r)};ThemeProvider.displayName="ThemeProvider";var _extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},withTheme=function(e){var t=function(t){return React.createElement(Consumer,null,function(r){return React.createElement(e,_extends({theme:r},t))})};return t.displayName="WithTheme",t},useTheme=function(){return useContext(ThemeContext)},withThemeHook=function(e){return Object.assign({theme:useTheme()},e)};export{ThemeProvider,withTheme,withThemeHook,useTheme}; |
{ | ||
"name": "@team-griffin/react-dye", | ||
"version": "3.0.0", | ||
"version": "3.0.1", | ||
"main": "dist/cjs/react-dye.js", | ||
@@ -5,0 +5,0 @@ "module": "dist/es/react-dye.js", |
import ThemeProvider from './ThemeProvider'; | ||
import withTheme from './withTheme'; | ||
import useTheme from './useTheme'; | ||
import withThemeHook from './withThemeHook'; | ||
@@ -7,2 +9,4 @@ export { | ||
withTheme, | ||
withThemeHook, | ||
useTheme, | ||
}; |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
16200
346
0