@mui/styled-engine 7.0.1 → 7.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,162 @@
1
1
  # [Versions](https://mui.com/versions/)
2
2
 
3
+ ## 7.1.0
4
+
5
+ <!-- generated comparing v7.0.2..master -->
6
+
7
+ _May 6, 2025_
8
+
9
+ A big thanks to the 21 contributors who made this release possible. Here are some highlights ✨:
10
+
11
+ - 🎉 Material UI now works with **Tailwind CSS v4**! Check out the [setup guide](https://mui.com/material-ui/integrations/tailwindcss/tailwindcss-v4/).
12
+
13
+ ### `@mui/material@7.1.0`
14
+
15
+ - [InputBase] Text cursor jumps several lines up when inserting text fragment with new line at the end (#45246) @yermartee
16
+ - [OutlinedInput] Add missing `notchedOutline` slot (#45917) @siriwatknp
17
+ - [Snackbar] Skip default `onClickAway` behavior when `defaultMuiPrevented` is provided (#45629) @sai6855
18
+ - [Avatar] Fix img slot types and add missing slots (#45483) @siriwatknp
19
+ - [Badge] Replace useSlotProps with useSlot hook (#45871) @sai6855
20
+ - [BottomNavigationAction] Add slots and slotProps (#45776) @sai6855
21
+ - [CardActionArea] Add slots and slotProps (#45866) @sai6855
22
+ - [useMediaQuery] Add warning and docs for using `useMediaQuery('print')` (#44790) @good-jinu
23
+ - Remove unnecessary clsx usages (#46084) @sai6855
24
+ - Corrected generic type definition in `SelectChangeEvent` (#45941) @SuyashShukla0007
25
+ - Fix theme object changes between renders (#45863) @siriwatknp
26
+
27
+ ### `@mui/material-nextjs@7.1.0`
28
+
29
+ - Add option to enable CSS layers for pages router (#45596) @siriwatknp
30
+ - Do not wrap `@layer` order rules in App Router (#45864) @Nayeem-XTREME
31
+
32
+ ### `@mui/system@7.1.0`
33
+
34
+ - Fix `@mui/system` types organization (#45860) @Janpot
35
+
36
+ ### `@mui/styled-engine@7.1.0`
37
+
38
+ - Infer `ownerState` from props in `styled` (#46083) @siriwatknp
39
+ - Fix style overrides variants type (#45478) @siriwatknp
40
+
41
+ ### Docs
42
+
43
+ - [Avatar] Add avatar upload demo (#45986) @Demianeen
44
+ - [Dialog] Remove deprecated props usage in demos (#45923) @sai6855
45
+ - [Menu] Update `paper` slot JSDoc default from `Paper` to `PopoverPaper` (#45722) @andreachiera
46
+ - [examples] Remove create-react-app usages (#45426) @CodeLeom
47
+ - Add `AccordionSummary` to the v5 breaking change migration (#45947) @siriwatknp
48
+ - Update CSS variable usage in migration guide for Pigment CSS (#46033) @sai6855
49
+ - Fix docs API dark mode color (#46086) @alexfauquette
50
+ - Add a guide for extending Material UI classes in Tailwind CSS (#46039) @siriwatknp
51
+ - Add `InitColorSchemeScript` docs and API (#45927) @siriwatknp
52
+ - Add Tailwind CSS v4 integration guide (#45906) @siriwatknp
53
+ - Fix 301 links to the system v6 (#45931) @oliviertassinari
54
+ - Add notification for MUI X v8 announcement (#45942) @joserodolfofreitas
55
+ - Fix som 301 redirections (ae84b35) @oliviertassinari
56
+ - Fix some 301 redirections (057384e) @oliviertassinari
57
+ - Fix logo is not centered on small screens (#45920) @crabsim
58
+ - Fix line break typo (a2a62d5) @oliviertassinari
59
+ - Fix markdown typo in templates.md (#45914) @scyzoryck
60
+ - Add Next.js App Router guide for custom classnames (#45852) @siriwatknp
61
+
62
+ ### Core
63
+
64
+ - [code-infra] Give a stable name to dev tool app (3889ded) @oliviertassinari
65
+ - [code-infra] Normalize author package in org (8135638) @oliviertassinari
66
+ - [code-infra] Correct some manually curated .d.ts files (#46054) @Janpot
67
+ - [code-infra] Align deps versions (#46048) @Janpot
68
+ - [code-infra] Fix dynamic import in imports resolver (#46046) @Janpot
69
+ - [code-infra] Eliminate `@mui/utils` deep imports (#46004) @Janpot
70
+ - [code-infra] Expand renovate.json for react types (#45935) @Janpot
71
+ - [code-infra] Make Argos upload script reusable (#45883) @Janpot
72
+ - [code-infra] Disallow redundant window prefixes for globals (#45880) @Janpot
73
+ - [code-infra] Remove type generation of modern build (#45912) @Janpot
74
+ - [code-infra] Clean up bundle size checker (#45622) @Janpot
75
+ - [code-infra] Fix `StrictMode` effects not being called twice in React 19 tests (#45812) @bernardobelchior
76
+ - [code-infra] Convert `@mui/utils` to typescript (#45671) @Janpot
77
+ - [docs-infra] Improve export into sandbox package.json (#46044) @oliviertassinari
78
+ - [docs-infra] Update feedback Node.js to v22 (#46064) @oliviertassinari
79
+ - [docs-infra] Normalize netlify.toml in org (b101d5c) @oliviertassinari
80
+ - [docs-infra] Uniformize Vale between repositories (0f79796) @oliviertassinari
81
+ - [docs-infra] Fix Vale no longer working (#46029) @oliviertassinari
82
+ - [docs-infra] Remove demo styling switch (#45926) @Janpot
83
+ - [docs-infra] StackBlitz WebContainer demos (#45924) @Janpot
84
+ - [docs-infra] Fix feedback management (#45872) @alexfauquette
85
+ - [test] Replace `playwright` with `@playwright/test` (#45998) @ZeeshanTamboli
86
+ - Fix internal version duplication (#46051) @oliviertassinari
87
+ - Avoid the need for `@mui/material/themeCssVarsAugmentation` (#46053) @Janpot
88
+ - Add security label to dependabot PRs (0a5c027) @oliviertassinari
89
+ - Remove unecessary versions (#46034) @oliviertassinari
90
+ - Remove redundant overrides resolver (#45970) @romgrk
91
+ - Fix duplicate branch reference (#45915) @oliviertassinari
92
+ - Fix outdated <link rel="shortcut icon" (#45916) @oliviertassinari
93
+ - Fix redirection chains (#45930) @oliviertassinari
94
+ - Run pnpm docs:sync-team (beee09f) @oliviertassinari
95
+ - Add `pkg.pr.new` publishing (#42984) @Aslemammad
96
+ - Remove @mui/base from the master branch (#45857) @mnajdova
97
+
98
+ All contributors of this release in alphabetical order: @alexfauquette, @andreachiera, @Aslemammad, @bernardobelchior, @CodeLeom, @crabsim, @Demianeen, @good-jinu, @Janpot, @joserodolfofreitas, @mnajdova, @Nayeem-XTREME, @oliviertassinari, @renovate[bot], @romgrk, @sai6855, @scyzoryck, @siriwatknp, @SuyashShukla0007, @yermartee, @ZeeshanTamboli
99
+
100
+ ## 7.0.2
101
+
102
+ _Apr 9, 2025_
103
+
104
+ A big thanks to the 12 contributors who made this release possible.
105
+
106
+ ### `@mui/material@7.0.2`
107
+
108
+ - [Autocomplete] Add ability to render custom single value (#45387) @ZeeshanTamboli
109
+ - [Autocomplete] Prevent shrink animation in controlled Autocomplete when initial `value` is provided (#45734) @imadx
110
+ - [AvatarGroup] Fix `spacing` prop ignoring value `0` (#45799) @Kartik-Murthy
111
+ - [Dialog] Deprecate composed classes (#45418) @sai6855
112
+
113
+ ### `@mui/material-nextjs@7.0.2`
114
+
115
+ - Fix nonce issues (#45794) @Janpot
116
+ - Add warnings to nextjs router integration (#45778) @Janpot
117
+
118
+ ### `@mui/styled-engine@7.0.2`
119
+
120
+ - Added caching to `StyledEngineProvider` to improve performance for running tests with Jest (#45846) @siriwatknp
121
+
122
+ ### Core
123
+
124
+ - [blog] Improve upvote video (0646444) @oliviertassinari
125
+ - [code-infra] Remove webpack aliases (#45841) @Janpot
126
+ - [code-infra] Remove .tsbuildinfo from build folder (#45727) @Janpot
127
+ - [code-infra] Stabilize theme viewer screenshot tests (#45768) @Janpot
128
+ - [code-infra] Remove modern bundles (#45808) @Janpot
129
+ - Update buildTypes script to optionally remove css imports (#45835) @brijeshb42
130
+ - Allow repo to be accepted as an argument for releaseTag (#45801) @brijeshb42
131
+ - Update scripts to support base-ui (#45784) @brijeshb42
132
+ - Sync scorecards.yml across codebase (4de5076) @oliviertassinari
133
+ - Remove baseUrl and skipLibCheck (#45806) @Janpot
134
+ - [docs-infra] Fix redirect styles pages (#45848) @siriwatknp
135
+ - [docs-infra] Remove false-positive Vale rules (#45843) @oliviertassinari
136
+ - [docs-infra] Make sure Next.js can find package.json through its aliases (#45840) @Janpot
137
+ - [docs-infra] Fix Next.js brand name coverage (6915f8d) @oliviertassinari
138
+ - [docs-infra] Fix layout shift between MIT and commercial pages (#45760) @oliviertassinari
139
+ - [docs-infra] Non breaking space for ESM (#45758) @oliviertassinari
140
+ - [support-infra] Remove dead 'workflow_call:' (#45736) @oliviertassinari
141
+ - [utils] Support cleanup callbacks in useForkRef (#45621) @DiegoAndai
142
+
143
+ ### Docs
144
+
145
+ - Fix pigment vite integration example (#44746) @brijeshb42
146
+ - Update migration instructions and codemod references for deprecated APIs (#45793) @sai6855
147
+ - Add TanStack Router routing example (#44930) @vetledv
148
+ - Fix layout shifting in icons page (#45779) @sai6855
149
+ - Fix migration instructions (#45762) @oliviertassinari
150
+ - Fix wrong TypeScript support version (#45761) @oliviertassinari
151
+ - Fix link to mui-joy/src/styles/components.d.ts (#45763) @oliviertassinari
152
+ - Fix 301 link (ae94c40) @oliviertassinari
153
+ - Fix 301 links (abd8f63) @oliviertassinari
154
+ - Fix 301 redirection (c7658de) @oliviertassinari
155
+ - [nextjs] Migrate from deprecated "legacyBehavior" prop (#44871) @oliviertassinari
156
+ - [nextjs] Document CSP for Next.js Pages Router (#45798) @Grohden
157
+
158
+ All contributors of this release in alphabetical order: @brijeshb42, @DiegoAndai, @Grohden, @imadx, @Janpot, @Kartik-Murthy, @oliviertassinari, @renovate[bot], @sai6855, @siriwatknp, @vetledv, @ZeeshanTamboli
159
+
3
160
  ## 7.0.1
4
161
 
5
162
  <!-- generated comparing v7.0.0..master -->
@@ -14,6 +14,9 @@ var _react2 = require("@emotion/react");
14
14
  var _cache = _interopRequireDefault(require("@emotion/cache"));
15
15
  var _sheet = require("@emotion/sheet");
16
16
  var _jsxRuntime = require("react/jsx-runtime");
17
+ // To fix [Jest performance](https://github.com/mui/material-ui/issues/45638).
18
+ const cacheMap = new Map();
19
+
17
20
  // Need to add a private variable to test the generated CSS from Emotion, this is the simplest way to do it.
18
21
  // We can't test the CSS from `style` tag easily because the `speedy: true` (produce empty text content) is enabled by Emotion.
19
22
  // Even if we disable it, JSDOM needs extra configuration to be able to parse `@layer` CSS.
@@ -104,7 +107,15 @@ function StyledEngineProvider(props) {
104
107
  enableCssLayer,
105
108
  children
106
109
  } = props;
107
- const cache = React.useMemo(() => getCache(injectFirst, enableCssLayer), [injectFirst, enableCssLayer]);
110
+ const cache = React.useMemo(() => {
111
+ const cacheKey = `${injectFirst}-${enableCssLayer}`;
112
+ if (cacheMap.has(cacheKey)) {
113
+ return cacheMap.get(cacheKey);
114
+ }
115
+ const fresh = getCache(injectFirst, enableCssLayer);
116
+ cacheMap.set(cacheKey, fresh);
117
+ return fresh;
118
+ }, [injectFirst, enableCssLayer]);
108
119
  return cache ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_react2.CacheProvider, {
109
120
  value: cache,
110
121
  children: children
@@ -6,10 +6,13 @@ import { CacheProvider } from '@emotion/react';
6
6
  import createCache from '@emotion/cache';
7
7
  import { StyleSheet } from '@emotion/sheet';
8
8
 
9
+ // To fix [Jest performance](https://github.com/mui/material-ui/issues/45638).
10
+ import { jsx as _jsx } from "react/jsx-runtime";
11
+ const cacheMap = new Map();
12
+
9
13
  // Need to add a private variable to test the generated CSS from Emotion, this is the simplest way to do it.
10
14
  // We can't test the CSS from `style` tag easily because the `speedy: true` (produce empty text content) is enabled by Emotion.
11
15
  // Even if we disable it, JSDOM needs extra configuration to be able to parse `@layer` CSS.
12
- import { jsx as _jsx } from "react/jsx-runtime";
13
16
  export const TEST_INTERNALS_DO_NOT_USE = {
14
17
  /**
15
18
  * to intercept the generated CSS before inserting to the style tag, so that we can check the generated CSS.
@@ -97,7 +100,15 @@ export default function StyledEngineProvider(props) {
97
100
  enableCssLayer,
98
101
  children
99
102
  } = props;
100
- const cache = React.useMemo(() => getCache(injectFirst, enableCssLayer), [injectFirst, enableCssLayer]);
103
+ const cache = React.useMemo(() => {
104
+ const cacheKey = `${injectFirst}-${enableCssLayer}`;
105
+ if (cacheMap.has(cacheKey)) {
106
+ return cacheMap.get(cacheKey);
107
+ }
108
+ const fresh = getCache(injectFirst, enableCssLayer);
109
+ cacheMap.set(cacheKey, fresh);
110
+ return fresh;
111
+ }, [injectFirst, enableCssLayer]);
101
112
  return cache ? /*#__PURE__*/_jsx(CacheProvider, {
102
113
  value: cache,
103
114
  children: children
package/esm/index.d.ts CHANGED
@@ -42,17 +42,7 @@ export interface CSSOthersObjectForCSSObject {
42
42
  }
43
43
 
44
44
  // Omit variants as a key, because we have a special handling for it
45
- export interface CSSObject extends CSSPropertiesWithMultiValues, CSSPseudos, Omit<CSSOthersObject, 'variants'> {}
46
- interface CSSObjectWithVariants<Props> extends Omit<CSSObject, 'variants'> {
47
- variants: Array<{
48
- props: Props | ((props: Props) => boolean);
49
- style: CSSObject | ((args: Props extends {
50
- theme: any;
51
- } ? {
52
- theme: Props['theme'];
53
- } : any) => CSSObject);
54
- }>;
55
- }
45
+ export interface CSSObject extends CSSPropertiesWithMultiValues, CSSPseudos, CSSOthersObject {}
56
46
  export interface ComponentSelector {
57
47
  __emotion_styles: any;
58
48
  }
@@ -69,7 +59,20 @@ export interface FunctionInterpolation<Props> {
69
59
  (props: Props): Interpolation<Props>;
70
60
  }
71
61
  export interface ArrayInterpolation<Props> extends ReadonlyArray<Interpolation<Props>> {}
72
- export type Interpolation<Props> = InterpolationPrimitive | CSSObjectWithVariants<Props> | ArrayInterpolation<Props> | FunctionInterpolation<Props>;
62
+ export type Interpolation<Props> = null | undefined | boolean | number | string | ComponentSelector | Keyframes | SerializedStyles | CSSPropertiesWithMultiValues | (CSSObject & {
63
+ variants?: Array<{
64
+ props: (Props extends {
65
+ ownerState: infer O;
66
+ } ? Partial<Omit<Props, 'ownerState'> & O> : Partial<Props>) | ((props: Partial<Props> & {
67
+ ownerState: Partial<Props>;
68
+ }) => boolean);
69
+ style: CSSObject | ((args: Props extends {
70
+ theme: any;
71
+ } ? {
72
+ theme: Props['theme'];
73
+ } : any) => CSSObject);
74
+ }>;
75
+ }) | ArrayInterpolation<Props> | FunctionInterpolation<Props>;
73
76
  export function shouldForwardProp(propName: PropertyKey): boolean;
74
77
 
75
78
  /** Same as StyledOptions but shouldForwardProp must be a type guard */
package/esm/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/styled-engine v7.0.1
2
+ * @mui/styled-engine v7.1.0
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
package/index.d.ts CHANGED
@@ -42,17 +42,7 @@ export interface CSSOthersObjectForCSSObject {
42
42
  }
43
43
 
44
44
  // Omit variants as a key, because we have a special handling for it
45
- export interface CSSObject extends CSSPropertiesWithMultiValues, CSSPseudos, Omit<CSSOthersObject, 'variants'> {}
46
- interface CSSObjectWithVariants<Props> extends Omit<CSSObject, 'variants'> {
47
- variants: Array<{
48
- props: Props | ((props: Props) => boolean);
49
- style: CSSObject | ((args: Props extends {
50
- theme: any;
51
- } ? {
52
- theme: Props['theme'];
53
- } : any) => CSSObject);
54
- }>;
55
- }
45
+ export interface CSSObject extends CSSPropertiesWithMultiValues, CSSPseudos, CSSOthersObject {}
56
46
  export interface ComponentSelector {
57
47
  __emotion_styles: any;
58
48
  }
@@ -69,7 +59,20 @@ export interface FunctionInterpolation<Props> {
69
59
  (props: Props): Interpolation<Props>;
70
60
  }
71
61
  export interface ArrayInterpolation<Props> extends ReadonlyArray<Interpolation<Props>> {}
72
- export type Interpolation<Props> = InterpolationPrimitive | CSSObjectWithVariants<Props> | ArrayInterpolation<Props> | FunctionInterpolation<Props>;
62
+ export type Interpolation<Props> = null | undefined | boolean | number | string | ComponentSelector | Keyframes | SerializedStyles | CSSPropertiesWithMultiValues | (CSSObject & {
63
+ variants?: Array<{
64
+ props: (Props extends {
65
+ ownerState: infer O;
66
+ } ? Partial<Omit<Props, 'ownerState'> & O> : Partial<Props>) | ((props: Partial<Props> & {
67
+ ownerState: Partial<Props>;
68
+ }) => boolean);
69
+ style: CSSObject | ((args: Props extends {
70
+ theme: any;
71
+ } ? {
72
+ theme: Props['theme'];
73
+ } : any) => CSSObject);
74
+ }>;
75
+ }) | ArrayInterpolation<Props> | FunctionInterpolation<Props>;
73
76
  export function shouldForwardProp(propName: PropertyKey): boolean;
74
77
 
75
78
  /** Same as StyledOptions but shouldForwardProp must be a type guard */
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/styled-engine v7.0.1
2
+ * @mui/styled-engine v7.1.0
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
package/package.json CHANGED
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "name": "@mui/styled-engine",
3
- "version": "7.0.1",
4
- "private": false,
3
+ "version": "7.1.0",
5
4
  "author": "MUI Team",
6
5
  "description": "styled() API wrapper package for emotion.",
7
6
  "main": "./index.js",
@@ -26,7 +25,7 @@
26
25
  "url": "https://opencollective.com/mui-org"
27
26
  },
28
27
  "dependencies": {
29
- "@babel/runtime": "^7.26.10",
28
+ "@babel/runtime": "^7.27.1",
30
29
  "@emotion/cache": "^11.13.5",
31
30
  "@emotion/serialize": "^1.3.3",
32
31
  "@emotion/sheet": "^1.4.0",
@@ -54,6 +53,7 @@
54
53
  "engines": {
55
54
  "node": ">=14.0.0"
56
55
  },
56
+ "private": false,
57
57
  "module": "./esm/index.js",
58
58
  "exports": {
59
59
  "./package.json": "./package.json",
@@ -65,10 +65,6 @@
65
65
  "import": {
66
66
  "types": "./esm/index.d.ts",
67
67
  "default": "./esm/index.js"
68
- },
69
- "mui-modern": {
70
- "types": "./modern/index.d.ts",
71
- "default": "./modern/index.js"
72
68
  }
73
69
  },
74
70
  "./*": {
@@ -79,10 +75,6 @@
79
75
  "import": {
80
76
  "types": "./esm/*/index.d.ts",
81
77
  "default": "./esm/*/index.js"
82
- },
83
- "mui-modern": {
84
- "types": "./modern/*/index.d.ts",
85
- "default": "./modern/*/index.js"
86
78
  }
87
79
  },
88
80
  "./esm": null,
@@ -1,7 +0,0 @@
1
- import * as React from 'react';
2
- import { Interpolation } from '@emotion/react';
3
- export interface GlobalStylesProps<Theme = {}> {
4
- defaultTheme?: object;
5
- styles: Interpolation<Theme>;
6
- }
7
- export default function GlobalStyles<Theme = {}>(props: GlobalStylesProps<Theme>): React.JSX.Element;
@@ -1,23 +0,0 @@
1
- 'use client';
2
-
3
- import * as React from 'react';
4
- import PropTypes from 'prop-types';
5
- import { Global } from '@emotion/react';
6
- import { jsx as _jsx } from "react/jsx-runtime";
7
- function isEmpty(obj) {
8
- return obj === undefined || obj === null || Object.keys(obj).length === 0;
9
- }
10
- export default function GlobalStyles(props) {
11
- const {
12
- styles,
13
- defaultTheme = {}
14
- } = props;
15
- const globalStyles = typeof styles === 'function' ? themeInput => styles(isEmpty(themeInput) ? defaultTheme : themeInput) : styles;
16
- return /*#__PURE__*/_jsx(Global, {
17
- styles: globalStyles
18
- });
19
- }
20
- process.env.NODE_ENV !== "production" ? GlobalStyles.propTypes = {
21
- defaultTheme: PropTypes.object,
22
- styles: PropTypes.oneOfType([PropTypes.array, PropTypes.string, PropTypes.object, PropTypes.func])
23
- } : void 0;
@@ -1,2 +0,0 @@
1
- export { default } from "./GlobalStyles.js";
2
- export * from "./GlobalStyles.js";
@@ -1 +0,0 @@
1
- export { default } from "./GlobalStyles.js";
@@ -1,7 +0,0 @@
1
- import * as React from 'react';
2
- export interface StyledEngineProviderProps {
3
- children?: React.ReactNode;
4
- enableCssLayer?: boolean;
5
- injectFirst?: boolean;
6
- }
7
- export default function StyledEngineProvider(props: StyledEngineProviderProps): React.JSX.Element;
@@ -1,122 +0,0 @@
1
- 'use client';
2
-
3
- import * as React from 'react';
4
- import PropTypes from 'prop-types';
5
- import { CacheProvider } from '@emotion/react';
6
- import createCache from '@emotion/cache';
7
- import { StyleSheet } from '@emotion/sheet';
8
-
9
- // Need to add a private variable to test the generated CSS from Emotion, this is the simplest way to do it.
10
- // We can't test the CSS from `style` tag easily because the `speedy: true` (produce empty text content) is enabled by Emotion.
11
- // Even if we disable it, JSDOM needs extra configuration to be able to parse `@layer` CSS.
12
- import { jsx as _jsx } from "react/jsx-runtime";
13
- export const TEST_INTERNALS_DO_NOT_USE = {
14
- /**
15
- * to intercept the generated CSS before inserting to the style tag, so that we can check the generated CSS.
16
- *
17
- * let rule;
18
- * TEST_INTERNALS_DO_NOT_USE.insert = (...args) => {
19
- * rule = args[0];
20
- * };
21
- *
22
- * expect(rule).to.equal(...);
23
- */
24
- insert: undefined
25
- };
26
-
27
- // We might be able to remove this when this issue is fixed:
28
- // https://github.com/emotion-js/emotion/issues/2790
29
- const createEmotionCache = (options, CustomSheet) => {
30
- const cache = createCache(options);
31
-
32
- // Do the same as https://github.com/emotion-js/emotion/blob/main/packages/cache/src/index.js#L238-L245
33
- cache.sheet = new CustomSheet({
34
- key: cache.key,
35
- nonce: cache.sheet.nonce,
36
- container: cache.sheet.container,
37
- speedy: cache.sheet.isSpeedy,
38
- prepend: cache.sheet.prepend,
39
- insertionPoint: cache.sheet.insertionPoint
40
- });
41
- return cache;
42
- };
43
- let insertionPoint;
44
- if (typeof document === 'object') {
45
- // Use `insertionPoint` over `prepend`(deprecated) because it can be controlled for GlobalStyles injection order
46
- // For more information, see https://github.com/mui/material-ui/issues/44597
47
- insertionPoint = document.querySelector('[name="emotion-insertion-point"]');
48
- if (!insertionPoint) {
49
- insertionPoint = document.createElement('meta');
50
- insertionPoint.setAttribute('name', 'emotion-insertion-point');
51
- insertionPoint.setAttribute('content', '');
52
- const head = document.querySelector('head');
53
- if (head) {
54
- head.prepend(insertionPoint);
55
- }
56
- }
57
- }
58
- function getCache(injectFirst, enableCssLayer) {
59
- if (injectFirst || enableCssLayer) {
60
- /**
61
- * This is for client-side apps only.
62
- * A custom sheet is required to make the GlobalStyles API injected above the insertion point.
63
- * This is because the [sheet](https://github.com/emotion-js/emotion/blob/main/packages/react/src/global.js#L94-L99) does not consume the options.
64
- */
65
- class MyStyleSheet extends StyleSheet {
66
- insert(rule, options) {
67
- if (TEST_INTERNALS_DO_NOT_USE.insert) {
68
- return TEST_INTERNALS_DO_NOT_USE.insert(rule, options);
69
- }
70
- if (this.key && this.key.endsWith('global')) {
71
- this.before = insertionPoint;
72
- }
73
- return super.insert(rule, options);
74
- }
75
- }
76
- const emotionCache = createEmotionCache({
77
- key: 'css',
78
- insertionPoint: injectFirst ? insertionPoint : undefined
79
- }, MyStyleSheet);
80
- if (enableCssLayer) {
81
- const prevInsert = emotionCache.insert;
82
- emotionCache.insert = (...args) => {
83
- if (!args[1].styles.startsWith('@layer')) {
84
- // avoid nested @layer
85
- args[1].styles = `@layer mui {${args[1].styles}}`;
86
- }
87
- return prevInsert(...args);
88
- };
89
- }
90
- return emotionCache;
91
- }
92
- return undefined;
93
- }
94
- export default function StyledEngineProvider(props) {
95
- const {
96
- injectFirst,
97
- enableCssLayer,
98
- children
99
- } = props;
100
- const cache = React.useMemo(() => getCache(injectFirst, enableCssLayer), [injectFirst, enableCssLayer]);
101
- return cache ? /*#__PURE__*/_jsx(CacheProvider, {
102
- value: cache,
103
- children: children
104
- }) : children;
105
- }
106
- process.env.NODE_ENV !== "production" ? StyledEngineProvider.propTypes = {
107
- /**
108
- * Your component tree.
109
- */
110
- children: PropTypes.node,
111
- /**
112
- * If `true`, the styles are wrapped in `@layer mui`.
113
- * Learn more about [Cascade layers](https://developer.mozilla.org/en-US/docs/Learn_web_development/Core/Styling_basics/Cascade_layers).
114
- */
115
- enableCssLayer: PropTypes.bool,
116
- /**
117
- * By default, the styles are injected last in the <head> element of the page.
118
- * As a result, they gain more specificity than any other style sheet.
119
- * If you want to override MUI's styles, set this prop.
120
- */
121
- injectFirst: PropTypes.bool
122
- } : void 0;
@@ -1,2 +0,0 @@
1
- export { default } from "./StyledEngineProvider.js";
2
- export * from "./StyledEngineProvider.js";
@@ -1 +0,0 @@
1
- export { default } from "./StyledEngineProvider.js";
package/modern/index.d.ts DELETED
@@ -1,119 +0,0 @@
1
- import * as CSS from 'csstype';
2
- import { StyledComponent, StyledOptions } from '@emotion/styled';
3
- import { PropsOf } from '@emotion/react';
4
- export * from '@emotion/styled';
5
- export { default } from '@emotion/styled';
6
- export { ThemeContext, keyframes, css } from '@emotion/react';
7
- export { default as StyledEngineProvider } from "./StyledEngineProvider/index.js";
8
- export { default as GlobalStyles } from "./GlobalStyles/index.js";
9
- export * from "./GlobalStyles/index.js";
10
- export type MUIStyledComponent<ComponentProps extends {}, SpecificComponentProps extends {} = {}, JSXProps extends {} = {}> = StyledComponent<ComponentProps, SpecificComponentProps, JSXProps>;
11
-
12
- /**
13
- * For internal usage in `@mui/system` package
14
- */
15
- // eslint-disable-next-line @typescript-eslint/naming-convention
16
- export function internal_mutateStyles(tag: React.ElementType, processor: (styles: any) => any): void;
17
-
18
- // eslint-disable-next-line @typescript-eslint/naming-convention
19
- export function internal_serializeStyles<P>(styles: Interpolation<P>): object;
20
- export interface SerializedStyles {
21
- name: string;
22
- styles: string;
23
- map?: string;
24
- next?: SerializedStyles;
25
- }
26
- export type CSSProperties = CSS.PropertiesFallback<number | string>;
27
- export type CSSPropertiesWithMultiValues = { [K in keyof CSSProperties]: CSSProperties[K] | ReadonlyArray<Extract<CSSProperties[K], string>> };
28
-
29
- // TODO v6 - check if we can drop the unknown, as it breaks the autocomplete
30
- // For more info on why it was added, see https://github.com/mui/material-ui/pull/26228
31
- export type CSSPseudos = { [K in CSS.Pseudos]?: unknown | CSSObject };
32
-
33
- // TODO v6 - check if we can drop the unknown, as it breaks the autocomplete
34
- // For more info on why it was added, see https://github.com/mui/material-ui/pull/26228
35
- export interface CSSOthersObject {
36
- [propertiesName: string]: unknown | CSSInterpolation;
37
- }
38
- export type CSSPseudosForCSSObject = { [K in CSS.Pseudos]?: CSSObject };
39
- export interface ArrayCSSInterpolation extends ReadonlyArray<CSSInterpolation> {}
40
- export interface CSSOthersObjectForCSSObject {
41
- [propertiesName: string]: CSSInterpolation;
42
- }
43
-
44
- // Omit variants as a key, because we have a special handling for it
45
- export interface CSSObject extends CSSPropertiesWithMultiValues, CSSPseudos, Omit<CSSOthersObject, 'variants'> {}
46
- interface CSSObjectWithVariants<Props> extends Omit<CSSObject, 'variants'> {
47
- variants: Array<{
48
- props: Props | ((props: Props) => boolean);
49
- style: CSSObject | ((args: Props extends {
50
- theme: any;
51
- } ? {
52
- theme: Props['theme'];
53
- } : any) => CSSObject);
54
- }>;
55
- }
56
- export interface ComponentSelector {
57
- __emotion_styles: any;
58
- }
59
- export type Keyframes = {
60
- name: string;
61
- styles: string;
62
- anim: number;
63
- toString: () => string;
64
- } & string;
65
- export type Equal<A, B, T, F> = A extends B ? (B extends A ? T : F) : F;
66
- export type InterpolationPrimitive = null | undefined | boolean | number | string | ComponentSelector | Keyframes | SerializedStyles | CSSObject;
67
- export type CSSInterpolation = InterpolationPrimitive | ArrayCSSInterpolation;
68
- export interface FunctionInterpolation<Props> {
69
- (props: Props): Interpolation<Props>;
70
- }
71
- export interface ArrayInterpolation<Props> extends ReadonlyArray<Interpolation<Props>> {}
72
- export type Interpolation<Props> = InterpolationPrimitive | CSSObjectWithVariants<Props> | ArrayInterpolation<Props> | FunctionInterpolation<Props>;
73
- export function shouldForwardProp(propName: PropertyKey): boolean;
74
-
75
- /** Same as StyledOptions but shouldForwardProp must be a type guard */
76
- export interface FilteringStyledOptions<Props, ForwardedProps extends keyof Props = keyof Props> {
77
- label?: string;
78
- shouldForwardProp?(propName: PropertyKey): propName is ForwardedProps;
79
- target?: string;
80
- }
81
-
82
- /**
83
- * @typeparam ComponentProps Props which will be included when withComponent is called
84
- * @typeparam SpecificComponentProps Props which will *not* be included when withComponent is called
85
- */
86
- export interface CreateStyledComponent<ComponentProps extends {}, SpecificComponentProps extends {} = {}, JSXProps extends {} = {}, T extends object = {}> {
87
- (...styles: Array<Interpolation<ComponentProps & SpecificComponentProps & {
88
- theme: T;
89
- }>>): StyledComponent<ComponentProps, SpecificComponentProps, JSXProps>;
90
-
91
- /**
92
- * @typeparam AdditionalProps Additional props to add to your styled component
93
- */
94
- <AdditionalProps extends {}>(...styles: Array<Interpolation<ComponentProps & SpecificComponentProps & AdditionalProps & {
95
- theme: T;
96
- }>>): StyledComponent<ComponentProps & AdditionalProps, SpecificComponentProps, JSXProps>;
97
- (template: TemplateStringsArray, ...styles: Array<Interpolation<ComponentProps & SpecificComponentProps & {
98
- theme: T;
99
- }>>): StyledComponent<ComponentProps, SpecificComponentProps, JSXProps>;
100
-
101
- /**
102
- * @typeparam AdditionalProps Additional props to add to your styled component
103
- */
104
- <AdditionalProps extends {}>(template: TemplateStringsArray, ...styles: Array<Interpolation<ComponentProps & SpecificComponentProps & AdditionalProps & {
105
- theme: T;
106
- }>>): StyledComponent<ComponentProps & AdditionalProps, SpecificComponentProps, JSXProps>;
107
- }
108
- export interface CreateMUIStyled<MUIStyledCommonProps extends {}, MuiStyledOptions, Theme extends object> {
109
- <C extends React.ComponentClass<React.ComponentProps<C>>, ForwardedProps extends keyof React.ComponentProps<C> = keyof React.ComponentProps<C>>(component: C, options: FilteringStyledOptions<React.ComponentProps<C>, ForwardedProps> & MuiStyledOptions): CreateStyledComponent<Pick<PropsOf<C>, ForwardedProps> & MUIStyledCommonProps, {}, {
110
- ref?: React.Ref<InstanceType<C>>;
111
- }, Theme>;
112
- <C extends React.ComponentClass<React.ComponentProps<C>>>(component: C, options?: StyledOptions<PropsOf<C> & MUIStyledCommonProps> & MuiStyledOptions): CreateStyledComponent<PropsOf<C> & MUIStyledCommonProps, {}, {
113
- ref?: React.Ref<InstanceType<C>>;
114
- }, Theme>;
115
- <C extends React.JSXElementConstructor<React.ComponentProps<C>>, ForwardedProps extends keyof React.ComponentProps<C> = keyof React.ComponentProps<C>>(component: C, options: FilteringStyledOptions<React.ComponentProps<C>, ForwardedProps> & MuiStyledOptions): CreateStyledComponent<Pick<PropsOf<C>, ForwardedProps> & MUIStyledCommonProps, {}, {}, Theme>;
116
- <C extends React.JSXElementConstructor<React.ComponentProps<C>>>(component: C, options?: StyledOptions<PropsOf<C> & MUIStyledCommonProps> & MuiStyledOptions): CreateStyledComponent<PropsOf<C> & MUIStyledCommonProps, {}, {}, Theme>;
117
- <Tag extends keyof React.JSX.IntrinsicElements, ForwardedProps extends keyof React.JSX.IntrinsicElements[Tag] = keyof React.JSX.IntrinsicElements[Tag]>(tag: Tag, options: FilteringStyledOptions<React.JSX.IntrinsicElements[Tag], ForwardedProps> & MuiStyledOptions): CreateStyledComponent<MUIStyledCommonProps, Pick<React.JSX.IntrinsicElements[Tag], ForwardedProps>, {}, Theme>;
118
- <Tag extends keyof React.JSX.IntrinsicElements>(tag: Tag, options?: StyledOptions<MUIStyledCommonProps> & MuiStyledOptions): CreateStyledComponent<MUIStyledCommonProps, React.JSX.IntrinsicElements[Tag], {}, Theme>;
119
- }
package/modern/index.js DELETED
@@ -1,47 +0,0 @@
1
- /**
2
- * @mui/styled-engine v7.0.1
3
- *
4
- * @license MIT
5
- * This source code is licensed under the MIT license found in the
6
- * LICENSE file in the root directory of this source tree.
7
- */
8
- 'use client';
9
-
10
- /* eslint-disable no-underscore-dangle */
11
- import emStyled from '@emotion/styled';
12
- import { serializeStyles as emSerializeStyles } from '@emotion/serialize';
13
- export default function styled(tag, options) {
14
- const stylesFactory = emStyled(tag, options);
15
- if (process.env.NODE_ENV !== 'production') {
16
- return (...styles) => {
17
- const component = typeof tag === 'string' ? `"${tag}"` : 'component';
18
- if (styles.length === 0) {
19
- console.error([`MUI: Seems like you called \`styled(${component})()\` without a \`style\` argument.`, 'You must provide a `styles` argument: `styled("div")(styleYouForgotToPass)`.'].join('\n'));
20
- } else if (styles.some(style => style === undefined)) {
21
- console.error(`MUI: the styled(${component})(...args) API requires all its args to be defined.`);
22
- }
23
- return stylesFactory(...styles);
24
- };
25
- }
26
- return stylesFactory;
27
- }
28
-
29
- // eslint-disable-next-line @typescript-eslint/naming-convention
30
- export function internal_mutateStyles(tag, processor) {
31
- // Emotion attaches all the styles as `__emotion_styles`.
32
- // Ref: https://github.com/emotion-js/emotion/blob/16d971d0da229596d6bcc39d282ba9753c9ee7cf/packages/styled/src/base.js#L186
33
- if (Array.isArray(tag.__emotion_styles)) {
34
- tag.__emotion_styles = processor(tag.__emotion_styles);
35
- }
36
- }
37
-
38
- // Emotion only accepts an array, but we want to avoid allocations
39
- const wrapper = [];
40
- // eslint-disable-next-line @typescript-eslint/naming-convention
41
- export function internal_serializeStyles(styles) {
42
- wrapper[0] = styles;
43
- return emSerializeStyles(wrapper);
44
- }
45
- export { ThemeContext, keyframes, css } from '@emotion/react';
46
- export { default as StyledEngineProvider } from "./StyledEngineProvider/index.js";
47
- export { default as GlobalStyles } from "./GlobalStyles/index.js";
@@ -1 +0,0 @@
1
- {"type":"module","sideEffects":false}