From ddb4303c7b76288d29eac097f68dfe7076d5f360 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20G=C3=BCnther?= Date: Wed, 22 Jul 2020 12:37:28 +0200 Subject: [PATCH 1/5] Fix: Name the default export for themr typings fix #74 --- src/components/themr.js | 3 ++- types/components/ThemeProvider.d.ts | 9 ++++++--- types/components/themr.d.ts | 11 +++++++++-- types/utils/themr-shape.d.ts | 5 ++++- 4 files changed, 21 insertions(+), 7 deletions(-) diff --git a/src/components/themr.js b/src/components/themr.js index 6cf57a7..3d3c5e6 100644 --- a/src/components/themr.js +++ b/src/components/themr.js @@ -33,7 +33,7 @@ const THEMR_CONFIG = * @param {{}} [options] - Themr options * @returns {function(ThemedComponent:Function):Function} - ThemedComponent */ -export default (componentName, localTheme, options = {}) => ThemedComponent => { +const themr = (componentName, localTheme, options = {}) => ThemedComponent => { const { composeTheme: optionComposeTheme, mapThemrProps: optionMapThemrProps @@ -177,6 +177,7 @@ export default (componentName, localTheme, options = {}) => ThemedComponent => { return hoistNonReactStatics(Themed, ThemedComponent) } +export default themr; /** * Merges passed themes by concatenating string keys and processing nested themes diff --git a/types/components/ThemeProvider.d.ts b/types/components/ThemeProvider.d.ts index ac73065..fb33779 100644 --- a/types/components/ThemeProvider.d.ts +++ b/types/components/ThemeProvider.d.ts @@ -1,13 +1,15 @@ export default class ThemeProvider extends Component { static propTypes: { - children: any; - theme: any; + children: PropTypes.Validator; + theme: PropTypes.Validator; }; static defaultProps: { theme: {}; }; static childContextTypes: { - themr: any; + themr: PropTypes.Validator; + }>>; }; constructor(props: Readonly); constructor(props: any, context?: any); @@ -18,3 +20,4 @@ export default class ThemeProvider extends Component { }; } import { Component } from "react"; +import PropTypes from "prop-types"; diff --git a/types/components/themr.d.ts b/types/components/themr.d.ts index 22f5b5d..47d27f0 100644 --- a/types/components/themr.d.ts +++ b/types/components/themr.d.ts @@ -5,7 +5,14 @@ * @returns {TReactCSSThemrTheme} - Resulting theme */ export function themeable(...themes: TReactCSSThemrTheme[]): any; -declare function _default(componentName: string | number | Symbol, localTheme?: any, options?: {}): (arg0: any, arg1: Function) => Function; -export default _default; +export default themr; export type TReactCSSThemrTheme = any; export type TReactCSSThemrOptions = {}; +/** + * Themr decorator + * @param {String|Number|Symbol} componentName - Component name + * @param {TReactCSSThemrTheme} [localTheme] - Base theme + * @param {{}} [options] - Themr options + * @returns {function(ThemedComponent:Function):Function} - ThemedComponent + */ +declare function themr(componentName: string | number | Symbol, localTheme?: any, options?: {}): (arg0: any, arg1: Function) => Function; diff --git a/types/utils/themr-shape.d.ts b/types/utils/themr-shape.d.ts index e384567..57dea3d 100644 --- a/types/utils/themr-shape.d.ts +++ b/types/utils/themr-shape.d.ts @@ -1,2 +1,5 @@ -declare var _default: any; +declare var _default: PropTypes.Requireable; +}>>; export default _default; +import PropTypes from "prop-types"; From 49ac3cd0e724381b840419e39dffdf32e417e6f1 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Wed, 22 Jul 2020 10:40:24 +0000 Subject: [PATCH 2/5] Build: Release 4.3.1 [skip ci] --- CHANGELOG.md | 7 +++++++ package.json | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 02bde6c..e9e52f4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [4.3.1](https://github.com/FriendsOfReactJS/react-css-themr/compare/4.3.0...4.3.1) (2020-07-22) + + +### Fix + +* Name the default export for themr typings ([ddb4303](https://github.com/FriendsOfReactJS/react-css-themr/commit/ddb4303c7b76288d29eac097f68dfe7076d5f360)), closes [#74](https://github.com/FriendsOfReactJS/react-css-themr/issues/74) + # [4.3.0](https://github.com/FriendsOfReactJS/react-css-themr/compare/4.2.1...4.3.0) (2020-07-22) diff --git a/package.json b/package.json index e057436..b2d8064 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "@friendsofreactjs/react-css-themr", "description": "Friends of ReactJS: React CSS Themr", "homepage": "https://github.com/FriendsOfReactJS/react-css-themr#readme", - "version": "4.3.0", + "version": "4.3.1", "main": "./lib", "author": "Javi Velasco (http://javivelasco.com/)", "repository": { From 4dbc02cb746138e58fbf3ed35f39aa25b9b6eb60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20G=C3=BCnther?= Date: Wed, 22 Jul 2020 13:36:54 +0200 Subject: [PATCH 3/5] Fix: Resolve linting issues --- src/components/themr.js | 2 +- test/components/themr.spec.js | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/components/themr.js b/src/components/themr.js index 3d3c5e6..ed20d52 100644 --- a/src/components/themr.js +++ b/src/components/themr.js @@ -177,7 +177,7 @@ const themr = (componentName, localTheme, options = {}) => ThemedComponent => { return hoistNonReactStatics(Themed, ThemedComponent) } -export default themr; +export default themr /** * Merges passed themes by concatenating string keys and processing nested themes diff --git a/test/components/themr.spec.js b/test/components/themr.spec.js index d8be201..20d4555 100644 --- a/test/components/themr.spec.js +++ b/test/components/themr.spec.js @@ -337,9 +337,10 @@ describe('Themr decorator function', () => { } const theme = {} const DecoratedContainer = hoc(Container) - const ThemedDecoratedContainer = themr('Container', theme)( - DecoratedContainer - ) + const ThemedDecoratedContainer = themr( + 'Container', + theme + )(DecoratedContainer) const tree = TestUtils.renderIntoDocument( ) From 1e2057483c3ddd550f055872b7499686766bc959 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20G=C3=BCnther?= Date: Wed, 22 Jul 2020 13:39:16 +0200 Subject: [PATCH 4/5] Fix: Resolve typings for themr decorator re #74 --- types/components/themr.d.ts | 10 +--------- types/index.d.ts | 2 +- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/types/components/themr.d.ts b/types/components/themr.d.ts index 47d27f0..ece8368 100644 --- a/types/components/themr.d.ts +++ b/types/components/themr.d.ts @@ -5,14 +5,6 @@ * @returns {TReactCSSThemrTheme} - Resulting theme */ export function themeable(...themes: TReactCSSThemrTheme[]): any; -export default themr; export type TReactCSSThemrTheme = any; export type TReactCSSThemrOptions = {}; -/** - * Themr decorator - * @param {String|Number|Symbol} componentName - Component name - * @param {TReactCSSThemrTheme} [localTheme] - Base theme - * @param {{}} [options] - Themr options - * @returns {function(ThemedComponent:Function):Function} - ThemedComponent - */ -declare function themr(componentName: string | number | Symbol, localTheme?: any, options?: {}): (arg0: any, arg1: Function) => Function; +export default function themr(componentName: string | number | Symbol, localTheme?: any, options?: {}): (arg0: any, arg1: Function) => Function; diff --git a/types/index.d.ts b/types/index.d.ts index 901367d..184a943 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -1,2 +1,2 @@ export { default as ThemeProvider } from "./components/ThemeProvider"; -export { default as themr, themeable } from "./components/themr"; +export { themr, themeable } from "./components/themr"; From fb5a9c0014bb2d513efcb779d30ff7e2360c7e33 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Wed, 22 Jul 2020 11:48:24 +0000 Subject: [PATCH 5/5] Build: Release 4.3.1 [skip ci] --- CHANGELOG.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e9e52f4..5a28c09 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,19 @@ ## [4.3.1](https://github.com/FriendsOfReactJS/react-css-themr/compare/4.3.0...4.3.1) (2020-07-22) +### Build + +* Release 4.3.1 [skip ci] ([49ac3cd](https://github.com/FriendsOfReactJS/react-css-themr/commit/49ac3cd0e724381b840419e39dffdf32e417e6f1)) + +### Fix + +* Name the default export for themr typings ([ddb4303](https://github.com/FriendsOfReactJS/react-css-themr/commit/ddb4303c7b76288d29eac097f68dfe7076d5f360)), closes [#74](https://github.com/FriendsOfReactJS/react-css-themr/issues/74) +* Resolve linting issues ([4dbc02c](https://github.com/FriendsOfReactJS/react-css-themr/commit/4dbc02cb746138e58fbf3ed35f39aa25b9b6eb60)) +* Resolve typings for themr decorator ([1e20574](https://github.com/FriendsOfReactJS/react-css-themr/commit/1e2057483c3ddd550f055872b7499686766bc959)), closes [#74](https://github.com/FriendsOfReactJS/react-css-themr/issues/74) + +## [4.3.1](https://github.com/FriendsOfReactJS/react-css-themr/compare/4.3.0...4.3.1) (2020-07-22) + + ### Fix * Name the default export for themr typings ([ddb4303](https://github.com/FriendsOfReactJS/react-css-themr/commit/ddb4303c7b76288d29eac097f68dfe7076d5f360)), closes [#74](https://github.com/FriendsOfReactJS/react-css-themr/issues/74)