Skip to content

Commit f43f0a4

Browse files
committed
Forget about having a copy of the non augmented MUI theme
1 parent aa210dd commit f43f0a4

File tree

6 files changed

+7
-156
lines changed

6 files changed

+7
-156
lines changed

src/lib/tools/@mui/material/styles/createMixins.ts

Lines changed: 0 additions & 7 deletions
This file was deleted.

src/lib/tools/@mui/material/styles/createPalette.ts

Lines changed: 0 additions & 23 deletions
This file was deleted.

src/lib/tools/@mui/material/styles/createTheme.ts

Lines changed: 0 additions & 24 deletions
This file was deleted.

src/lib/tools/@mui/material/styles/createTypography.ts

Lines changed: 0 additions & 64 deletions
This file was deleted.

src/lib/tools/@mui/material/styles/shadows.ts

Lines changed: 0 additions & 29 deletions
This file was deleted.

src/mui.tsx

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import { useIsDark } from "./lib/darkMode";
99
import { typography } from "./lib/generatedFromCss/typography";
1010
import { spacingTokenByValue } from "./lib/generatedFromCss/spacing";
1111
import type { ColorTheme } from "./lib/colors";
12-
import type { Theme as NonAugmentedMuiTheme } from "./lib/tools/@mui/material/styles/createTheme";
1312
import { assert } from "tsafe/assert";
1413
import { objectKeys } from "tsafe/objectKeys";
1514
import defaultMuiShadows from "@mui/material/styles/shadows";
@@ -220,12 +219,16 @@ function createMuiDsfrTheme(params: { isDark: boolean }): MuiTheme {
220219
}
221220

222221
export function createMuiDsfrThemeProvider(params: {
223-
augmentMuiTheme: (params: {
224-
nonAugmentedMuiTheme: NonAugmentedMuiTheme;
222+
augmentMuiTheme?: (params: {
223+
/** WARNING: The types is lying here.
224+
* It's a Theme as defined in import type { Theme } from "@mui/material/styles";
225+
* That is to say before augmentation.
226+
**/
227+
nonAugmentedMuiTheme: MuiTheme;
225228
frColorTheme: ColorTheme;
226229
}) => MuiTheme;
227230
}) {
228-
const { augmentMuiTheme } = params;
231+
const { augmentMuiTheme = ({ nonAugmentedMuiTheme }) => nonAugmentedMuiTheme } = params;
229232

230233
type Props = {
231234
children: ReactNode;
@@ -251,8 +254,3 @@ export function createMuiDsfrThemeProvider(params: {
251254

252255
return { MuiDsfrThemeProvider };
253256
}
254-
255-
export function noAugmentation(params: { nonAugmentedMuiTheme: MuiTheme }) {
256-
const { nonAugmentedMuiTheme } = params;
257-
return nonAugmentedMuiTheme;
258-
}

0 commit comments

Comments
 (0)