Skip to content

Commit

Permalink
Enabling shorter import paths [automatic]
Browse files Browse the repository at this point in the history
  • Loading branch information
ts_ci committed Feb 24, 2021
1 parent 801e3bc commit c491e76
Show file tree
Hide file tree
Showing 19 changed files with 1,376 additions and 194 deletions.
76 changes: 0 additions & 76 deletions .github/workflows/ci.yaml

This file was deleted.

106 changes: 0 additions & 106 deletions .github/workflows/publish.yaml

This file was deleted.

35 changes: 35 additions & 0 deletions createUseClassNamesFactory.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import "minimal-polyfills/Object.fromEntries";
import type { CSSObject } from "@emotion/css";
/**
*
* Implementation of JSS createStyles() based on @emotion/react
*
* const { useClassNames } = createUseClassNames<Props & { color: "red" | "blue" }>()({
* (theme, { color })=> ({
* "root": { color }
* })
* });
*
*
* function MyComponent(props: Props){
*
* const [ color, setColor ]= useState<"red" | "blue">("red");
*
* const { classNames }=useClassNames({...props, color });
*
* return <span className={classNames.root}>hello world</span>;
*
* }
*
*/
export declare function createUseClassNamesFactory<Theme extends Object = {}>(params: {
useTheme(): Theme;
}): {
createUseClassNames: <Params extends Record<string, unknown>>() => <Key extends string>(getCssObjects: (themeWrap: {
theme: Theme;
}, params: Params) => Record<Key, CSSObject>) => {
useClassNames: (params: Params) => {
classNames: Record<Key, string>;
};
};
};
47 changes: 47 additions & 0 deletions createUseClassNamesFactory.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions createUseClassNamesFactory.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

37 changes: 37 additions & 0 deletions createUseClassNamesFactory_optimized.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import "minimal-polyfills/Object.fromEntries";
import type { CSSObject } from "@emotion/css";
/**
* !EXPERIMENTAL!
*
* Functionally equivalent from the exported but with optimization
* mechanism implemented.
*
* Implementation of JSS createStyles() based on @emotion/react
*
* const { useCssRecord } = createUseClassNames<Props & { color: "red" | "blue" }>()({
* (theme, { color })=> ({
* "root": { color }
* })
* });
*
*
* function MyComponent(props: Props){
*
* const [ color, setColor ]= useState<"red" | "blue">("red");
*
* const { classNames }=useClassName({...props, color });
*
* return <span className={classNames.root}>hello world</span>;
*
* }
*
*/
export declare function createUseClassNamesFactory<Theme extends Object = {}>(params: {
useTheme(): Theme;
}): {
createUseClassNames: <Params extends Record<string, unknown>>() => <Key extends string>(getCssObjects: (theme: Theme, params: Params) => Record<Key, CSSObject>) => {
useClassNames: (params: Params) => {
classNames: Record<Key, string>;
};
};
};
Loading

0 comments on commit c491e76

Please sign in to comment.