Skip to content

Commit

Permalink
Reintroduce the compatibility modules for older TypeScript version su…
Browse files Browse the repository at this point in the history
…pport
  • Loading branch information
garronej committed Aug 14, 2023
1 parent 854cb9d commit dc7ca10
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
34 changes: 34 additions & 0 deletions src/compat.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
"use client";

import type { EmotionCache } from "@emotion/cache";
export type { CSSInterpolation, CSSObject, Css, Cx, CxArg } from "./types";
import { createMakeStyles, TssCacheProvider } from "./makeStyles";
export { createMakeStyles, TssCacheProvider };
import { createWithStyles } from "./withStyles_compat";
export { createWithStyles };
import { createTss } from "./tss";
export { createTss };
export type { Tss } from "./tss";

/** @see <https://docs.tss-react.dev/api/keyframes> */
export { keyframes } from "@emotion/react";

/** @see <https://docs.tss-react.dev/api/globalstyles> */
export { GlobalStyles } from "./GlobalStyles";

/** @see <https://docs.tss-react.dev/api/makestyles> */
export function createMakeAndWithStyles<Theme>(params: {
useTheme: () => Theme;
cache?: EmotionCache;
}) {
return {
...createMakeStyles(params),
...createWithStyles(params)
};
}

export const { tss } = createTss({
"useContext": () => ({})
});

export const useStyles = tss.createUseStyles({});
8 changes: 8 additions & 0 deletions src/mui-compat.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { useTheme } from "@mui/material/styles";
import { createMakeAndWithStyles } from "./compat";
export { useStyles, tss } from "./mui";

/** @see <https://docs.tss-react.dev/setup> */
export const { makeStyles, withStyles } = createMakeAndWithStyles({
useTheme
});

0 comments on commit dc7ca10

Please sign in to comment.