@mui/styled-engine 6.4.3 → 7.0.0-alpha.1
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 +70 -2227
- package/GlobalStyles/GlobalStyles.js +15 -8
- package/GlobalStyles/index.js +13 -1
- package/README.md +2 -2
- package/StyledEngineProvider/StyledEngineProvider.js +19 -13
- package/StyledEngineProvider/index.js +13 -1
- package/esm/GlobalStyles/GlobalStyles.js +23 -0
- package/esm/GlobalStyles/index.js +1 -0
- package/{node → esm}/StyledEngineProvider/StyledEngineProvider.js +13 -19
- package/esm/StyledEngineProvider/index.js +1 -0
- package/esm/index.js +47 -0
- package/esm/package.json +1 -0
- package/index.js +52 -12
- package/modern/index.js +3 -1
- package/modern/package.json +1 -0
- package/package.json +34 -5
- package/GlobalStyles/GlobalStyles.d.ts +0 -11
- package/GlobalStyles/index.d.ts +0 -2
- package/GlobalStyles/package.json +0 -6
- package/StyledEngineProvider/StyledEngineProvider.d.ts +0 -8
- package/StyledEngineProvider/index.d.ts +0 -2
- package/StyledEngineProvider/package.json +0 -6
- package/index.d.ts +0 -226
- package/node/GlobalStyles/GlobalStyles.js +0 -30
- package/node/GlobalStyles/index.js +0 -13
- package/node/StyledEngineProvider/index.js +0 -13
- package/node/index.js +0 -85
package/index.d.ts
DELETED
|
@@ -1,226 +0,0 @@
|
|
|
1
|
-
import * as CSS from 'csstype';
|
|
2
|
-
import { StyledComponent, StyledOptions } from '@emotion/styled';
|
|
3
|
-
import { PropsOf } from '@emotion/react';
|
|
4
|
-
|
|
5
|
-
export * from '@emotion/styled';
|
|
6
|
-
export { default } from '@emotion/styled';
|
|
7
|
-
export { ThemeContext, keyframes, css } from '@emotion/react';
|
|
8
|
-
|
|
9
|
-
export { default as StyledEngineProvider } from './StyledEngineProvider';
|
|
10
|
-
|
|
11
|
-
export { default as GlobalStyles } from './GlobalStyles';
|
|
12
|
-
export * from './GlobalStyles';
|
|
13
|
-
|
|
14
|
-
export type MUIStyledComponent<
|
|
15
|
-
ComponentProps extends {},
|
|
16
|
-
SpecificComponentProps extends {} = {},
|
|
17
|
-
JSXProps extends {} = {},
|
|
18
|
-
> = StyledComponent<ComponentProps, SpecificComponentProps, JSXProps>;
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* For internal usage in `@mui/system` package
|
|
22
|
-
*/
|
|
23
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
24
|
-
export function internal_mutateStyles(
|
|
25
|
-
tag: React.ElementType,
|
|
26
|
-
processor: (styles: any) => any,
|
|
27
|
-
): void;
|
|
28
|
-
|
|
29
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
30
|
-
export function internal_serializeStyles<P>(styles: Interpolation<P>): object;
|
|
31
|
-
|
|
32
|
-
export interface SerializedStyles {
|
|
33
|
-
name: string;
|
|
34
|
-
styles: string;
|
|
35
|
-
map?: string;
|
|
36
|
-
next?: SerializedStyles;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export type CSSProperties = CSS.PropertiesFallback<number | string>;
|
|
40
|
-
export type CSSPropertiesWithMultiValues = {
|
|
41
|
-
[K in keyof CSSProperties]: CSSProperties[K] | ReadonlyArray<Extract<CSSProperties[K], string>>;
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
// TODO v6 - check if we can drop the unknown, as it breaks the autocomplete
|
|
45
|
-
// For more info on why it was added, see https://github.com/mui/material-ui/pull/26228
|
|
46
|
-
export type CSSPseudos = { [K in CSS.Pseudos]?: unknown | CSSObject };
|
|
47
|
-
|
|
48
|
-
// TODO v6 - check if we can drop the unknown, as it breaks the autocomplete
|
|
49
|
-
// For more info on why it was added, see https://github.com/mui/material-ui/pull/26228
|
|
50
|
-
export interface CSSOthersObject {
|
|
51
|
-
[propertiesName: string]: unknown | CSSInterpolation;
|
|
52
|
-
}
|
|
53
|
-
export type CSSPseudosForCSSObject = { [K in CSS.Pseudos]?: CSSObject };
|
|
54
|
-
|
|
55
|
-
export interface ArrayCSSInterpolation extends ReadonlyArray<CSSInterpolation> {}
|
|
56
|
-
|
|
57
|
-
export interface CSSOthersObjectForCSSObject {
|
|
58
|
-
[propertiesName: string]: CSSInterpolation;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
// Omit variants as a key, because we have a special handling for it
|
|
62
|
-
export interface CSSObject
|
|
63
|
-
extends CSSPropertiesWithMultiValues,
|
|
64
|
-
CSSPseudos,
|
|
65
|
-
Omit<CSSOthersObject, 'variants'> {}
|
|
66
|
-
|
|
67
|
-
interface CSSObjectWithVariants<Props> extends Omit<CSSObject, 'variants'> {
|
|
68
|
-
variants: Array<{
|
|
69
|
-
props: Props | ((props: Props) => boolean);
|
|
70
|
-
style:
|
|
71
|
-
| CSSObject
|
|
72
|
-
| ((args: Props extends { theme: any } ? { theme: Props['theme'] } : any) => CSSObject);
|
|
73
|
-
}>;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
export interface ComponentSelector {
|
|
77
|
-
__emotion_styles: any;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
export type Keyframes = {
|
|
81
|
-
name: string;
|
|
82
|
-
styles: string;
|
|
83
|
-
anim: number;
|
|
84
|
-
toString: () => string;
|
|
85
|
-
} & string;
|
|
86
|
-
|
|
87
|
-
export type Equal<A, B, T, F> = A extends B ? (B extends A ? T : F) : F;
|
|
88
|
-
|
|
89
|
-
export type InterpolationPrimitive =
|
|
90
|
-
| null
|
|
91
|
-
| undefined
|
|
92
|
-
| boolean
|
|
93
|
-
| number
|
|
94
|
-
| string
|
|
95
|
-
| ComponentSelector
|
|
96
|
-
| Keyframes
|
|
97
|
-
| SerializedStyles
|
|
98
|
-
| CSSObject;
|
|
99
|
-
|
|
100
|
-
export type CSSInterpolation = InterpolationPrimitive | ArrayCSSInterpolation;
|
|
101
|
-
|
|
102
|
-
export interface FunctionInterpolation<Props> {
|
|
103
|
-
(props: Props): Interpolation<Props>;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
export interface ArrayInterpolation<Props> extends ReadonlyArray<Interpolation<Props>> {}
|
|
107
|
-
|
|
108
|
-
export type Interpolation<Props> =
|
|
109
|
-
| InterpolationPrimitive
|
|
110
|
-
| CSSObjectWithVariants<Props>
|
|
111
|
-
| ArrayInterpolation<Props>
|
|
112
|
-
| FunctionInterpolation<Props>;
|
|
113
|
-
|
|
114
|
-
export function shouldForwardProp(propName: PropertyKey): boolean;
|
|
115
|
-
|
|
116
|
-
/** Same as StyledOptions but shouldForwardProp must be a type guard */
|
|
117
|
-
export interface FilteringStyledOptions<Props, ForwardedProps extends keyof Props = keyof Props> {
|
|
118
|
-
label?: string;
|
|
119
|
-
shouldForwardProp?(propName: PropertyKey): propName is ForwardedProps;
|
|
120
|
-
target?: string;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
/**
|
|
124
|
-
* @typeparam ComponentProps Props which will be included when withComponent is called
|
|
125
|
-
* @typeparam SpecificComponentProps Props which will *not* be included when withComponent is called
|
|
126
|
-
*/
|
|
127
|
-
export interface CreateStyledComponent<
|
|
128
|
-
ComponentProps extends {},
|
|
129
|
-
SpecificComponentProps extends {} = {},
|
|
130
|
-
JSXProps extends {} = {},
|
|
131
|
-
T extends object = {},
|
|
132
|
-
> {
|
|
133
|
-
(
|
|
134
|
-
...styles: Array<Interpolation<ComponentProps & SpecificComponentProps & { theme: T }>>
|
|
135
|
-
): StyledComponent<ComponentProps, SpecificComponentProps, JSXProps>;
|
|
136
|
-
|
|
137
|
-
/**
|
|
138
|
-
* @typeparam AdditionalProps Additional props to add to your styled component
|
|
139
|
-
*/
|
|
140
|
-
<AdditionalProps extends {}>(
|
|
141
|
-
...styles: Array<
|
|
142
|
-
Interpolation<ComponentProps & SpecificComponentProps & AdditionalProps & { theme: T }>
|
|
143
|
-
>
|
|
144
|
-
): StyledComponent<ComponentProps & AdditionalProps, SpecificComponentProps, JSXProps>;
|
|
145
|
-
|
|
146
|
-
(
|
|
147
|
-
template: TemplateStringsArray,
|
|
148
|
-
...styles: Array<Interpolation<ComponentProps & SpecificComponentProps & { theme: T }>>
|
|
149
|
-
): StyledComponent<ComponentProps, SpecificComponentProps, JSXProps>;
|
|
150
|
-
|
|
151
|
-
/**
|
|
152
|
-
* @typeparam AdditionalProps Additional props to add to your styled component
|
|
153
|
-
*/
|
|
154
|
-
<AdditionalProps extends {}>(
|
|
155
|
-
template: TemplateStringsArray,
|
|
156
|
-
...styles: Array<
|
|
157
|
-
Interpolation<ComponentProps & SpecificComponentProps & AdditionalProps & { theme: T }>
|
|
158
|
-
>
|
|
159
|
-
): StyledComponent<ComponentProps & AdditionalProps, SpecificComponentProps, JSXProps>;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
export interface CreateMUIStyled<
|
|
163
|
-
MUIStyledCommonProps extends {},
|
|
164
|
-
MuiStyledOptions,
|
|
165
|
-
Theme extends object,
|
|
166
|
-
> {
|
|
167
|
-
<
|
|
168
|
-
C extends React.ComponentClass<React.ComponentProps<C>>,
|
|
169
|
-
ForwardedProps extends keyof React.ComponentProps<C> = keyof React.ComponentProps<C>,
|
|
170
|
-
>(
|
|
171
|
-
component: C,
|
|
172
|
-
options: FilteringStyledOptions<React.ComponentProps<C>, ForwardedProps> & MuiStyledOptions,
|
|
173
|
-
): CreateStyledComponent<
|
|
174
|
-
Pick<PropsOf<C>, ForwardedProps> & MUIStyledCommonProps,
|
|
175
|
-
{},
|
|
176
|
-
{
|
|
177
|
-
ref?: React.Ref<InstanceType<C>>;
|
|
178
|
-
},
|
|
179
|
-
Theme
|
|
180
|
-
>;
|
|
181
|
-
|
|
182
|
-
<C extends React.ComponentClass<React.ComponentProps<C>>>(
|
|
183
|
-
component: C,
|
|
184
|
-
options?: StyledOptions<PropsOf<C> & MUIStyledCommonProps> & MuiStyledOptions,
|
|
185
|
-
): CreateStyledComponent<
|
|
186
|
-
PropsOf<C> & MUIStyledCommonProps,
|
|
187
|
-
{},
|
|
188
|
-
{
|
|
189
|
-
ref?: React.Ref<InstanceType<C>>;
|
|
190
|
-
},
|
|
191
|
-
Theme
|
|
192
|
-
>;
|
|
193
|
-
|
|
194
|
-
<
|
|
195
|
-
C extends React.JSXElementConstructor<React.ComponentProps<C>>,
|
|
196
|
-
ForwardedProps extends keyof React.ComponentProps<C> = keyof React.ComponentProps<C>,
|
|
197
|
-
>(
|
|
198
|
-
component: C,
|
|
199
|
-
options: FilteringStyledOptions<React.ComponentProps<C>, ForwardedProps> & MuiStyledOptions,
|
|
200
|
-
): CreateStyledComponent<Pick<PropsOf<C>, ForwardedProps> & MUIStyledCommonProps, {}, {}, Theme>;
|
|
201
|
-
|
|
202
|
-
<C extends React.JSXElementConstructor<React.ComponentProps<C>>>(
|
|
203
|
-
component: C,
|
|
204
|
-
options?: StyledOptions<PropsOf<C> & MUIStyledCommonProps> & MuiStyledOptions,
|
|
205
|
-
): CreateStyledComponent<PropsOf<C> & MUIStyledCommonProps, {}, {}, Theme>;
|
|
206
|
-
|
|
207
|
-
<
|
|
208
|
-
Tag extends keyof React.JSX.IntrinsicElements,
|
|
209
|
-
ForwardedProps extends
|
|
210
|
-
keyof React.JSX.IntrinsicElements[Tag] = keyof React.JSX.IntrinsicElements[Tag],
|
|
211
|
-
>(
|
|
212
|
-
tag: Tag,
|
|
213
|
-
options: FilteringStyledOptions<React.JSX.IntrinsicElements[Tag], ForwardedProps> &
|
|
214
|
-
MuiStyledOptions,
|
|
215
|
-
): CreateStyledComponent<
|
|
216
|
-
MUIStyledCommonProps,
|
|
217
|
-
Pick<React.JSX.IntrinsicElements[Tag], ForwardedProps>,
|
|
218
|
-
{},
|
|
219
|
-
Theme
|
|
220
|
-
>;
|
|
221
|
-
|
|
222
|
-
<Tag extends keyof React.JSX.IntrinsicElements>(
|
|
223
|
-
tag: Tag,
|
|
224
|
-
options?: StyledOptions<MUIStyledCommonProps> & MuiStyledOptions,
|
|
225
|
-
): CreateStyledComponent<MUIStyledCommonProps, React.JSX.IntrinsicElements[Tag], {}, Theme>;
|
|
226
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
'use client';
|
|
3
|
-
|
|
4
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
5
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
6
|
-
Object.defineProperty(exports, "__esModule", {
|
|
7
|
-
value: true
|
|
8
|
-
});
|
|
9
|
-
exports.default = GlobalStyles;
|
|
10
|
-
var React = _interopRequireWildcard(require("react"));
|
|
11
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
12
|
-
var _react2 = require("@emotion/react");
|
|
13
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
|
-
function isEmpty(obj) {
|
|
15
|
-
return obj === undefined || obj === null || Object.keys(obj).length === 0;
|
|
16
|
-
}
|
|
17
|
-
function GlobalStyles(props) {
|
|
18
|
-
const {
|
|
19
|
-
styles,
|
|
20
|
-
defaultTheme = {}
|
|
21
|
-
} = props;
|
|
22
|
-
const globalStyles = typeof styles === 'function' ? themeInput => styles(isEmpty(themeInput) ? defaultTheme : themeInput) : styles;
|
|
23
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_react2.Global, {
|
|
24
|
-
styles: globalStyles
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
process.env.NODE_ENV !== "production" ? GlobalStyles.propTypes = {
|
|
28
|
-
defaultTheme: _propTypes.default.object,
|
|
29
|
-
styles: _propTypes.default.oneOfType([_propTypes.default.array, _propTypes.default.string, _propTypes.default.object, _propTypes.default.func])
|
|
30
|
-
} : void 0;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
Object.defineProperty(exports, "default", {
|
|
8
|
-
enumerable: true,
|
|
9
|
-
get: function () {
|
|
10
|
-
return _GlobalStyles.default;
|
|
11
|
-
}
|
|
12
|
-
});
|
|
13
|
-
var _GlobalStyles = _interopRequireDefault(require("./GlobalStyles"));
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
Object.defineProperty(exports, "default", {
|
|
8
|
-
enumerable: true,
|
|
9
|
-
get: function () {
|
|
10
|
-
return _StyledEngineProvider.default;
|
|
11
|
-
}
|
|
12
|
-
});
|
|
13
|
-
var _StyledEngineProvider = _interopRequireDefault(require("./StyledEngineProvider"));
|
package/node/index.js
DELETED
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @mui/styled-engine v6.4.3
|
|
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 strict";
|
|
9
|
-
|
|
10
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
11
|
-
Object.defineProperty(exports, "__esModule", {
|
|
12
|
-
value: true
|
|
13
|
-
});
|
|
14
|
-
Object.defineProperty(exports, "GlobalStyles", {
|
|
15
|
-
enumerable: true,
|
|
16
|
-
get: function () {
|
|
17
|
-
return _GlobalStyles.default;
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
Object.defineProperty(exports, "StyledEngineProvider", {
|
|
21
|
-
enumerable: true,
|
|
22
|
-
get: function () {
|
|
23
|
-
return _StyledEngineProvider.default;
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
Object.defineProperty(exports, "ThemeContext", {
|
|
27
|
-
enumerable: true,
|
|
28
|
-
get: function () {
|
|
29
|
-
return _react.ThemeContext;
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
Object.defineProperty(exports, "css", {
|
|
33
|
-
enumerable: true,
|
|
34
|
-
get: function () {
|
|
35
|
-
return _react.css;
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
exports.default = styled;
|
|
39
|
-
exports.internal_mutateStyles = internal_mutateStyles;
|
|
40
|
-
exports.internal_serializeStyles = internal_serializeStyles;
|
|
41
|
-
Object.defineProperty(exports, "keyframes", {
|
|
42
|
-
enumerable: true,
|
|
43
|
-
get: function () {
|
|
44
|
-
return _react.keyframes;
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
|
-
var _styled = _interopRequireDefault(require("@emotion/styled"));
|
|
48
|
-
var _serialize = require("@emotion/serialize");
|
|
49
|
-
var _react = require("@emotion/react");
|
|
50
|
-
var _StyledEngineProvider = _interopRequireDefault(require("./StyledEngineProvider"));
|
|
51
|
-
var _GlobalStyles = _interopRequireDefault(require("./GlobalStyles"));
|
|
52
|
-
/* eslint-disable no-underscore-dangle */
|
|
53
|
-
|
|
54
|
-
function styled(tag, options) {
|
|
55
|
-
const stylesFactory = (0, _styled.default)(tag, options);
|
|
56
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
57
|
-
return (...styles) => {
|
|
58
|
-
const component = typeof tag === 'string' ? `"${tag}"` : 'component';
|
|
59
|
-
if (styles.length === 0) {
|
|
60
|
-
console.error([`MUI: Seems like you called \`styled(${component})()\` without a \`style\` argument.`, 'You must provide a `styles` argument: `styled("div")(styleYouForgotToPass)`.'].join('\n'));
|
|
61
|
-
} else if (styles.some(style => style === undefined)) {
|
|
62
|
-
console.error(`MUI: the styled(${component})(...args) API requires all its args to be defined.`);
|
|
63
|
-
}
|
|
64
|
-
return stylesFactory(...styles);
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
return stylesFactory;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
71
|
-
function internal_mutateStyles(tag, processor) {
|
|
72
|
-
// Emotion attaches all the styles as `__emotion_styles`.
|
|
73
|
-
// Ref: https://github.com/emotion-js/emotion/blob/16d971d0da229596d6bcc39d282ba9753c9ee7cf/packages/styled/src/base.js#L186
|
|
74
|
-
if (Array.isArray(tag.__emotion_styles)) {
|
|
75
|
-
tag.__emotion_styles = processor(tag.__emotion_styles);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
// Emotion only accepts an array, but we want to avoid allocations
|
|
80
|
-
const wrapper = [];
|
|
81
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
82
|
-
function internal_serializeStyles(styles) {
|
|
83
|
-
wrapper[0] = styles;
|
|
84
|
-
return (0, _serialize.serializeStyles)(wrapper);
|
|
85
|
-
}
|