@mui/styled-engine-sc 6.0.0-alpha.9 → 6.0.0-beta.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 +2332 -411
- package/GlobalStyles/GlobalStyles.d.ts +1 -1
- package/README.md +1 -1
- package/StyledEngineProvider/StyledEngineProvider.d.ts +1 -1
- package/index.d.ts +34 -38
- package/index.js +1 -1
- package/modern/index.js +1 -1
- package/node/index.js +2 -2
- package/package.json +6 -5
- package/legacy/GlobalStyles/GlobalStyles.js +0 -19
- package/legacy/GlobalStyles/index.js +0 -1
- package/legacy/StyledEngineProvider/StyledEngineProvider.js +0 -26
- package/legacy/StyledEngineProvider/index.js +0 -1
- package/legacy/index.js +0 -53
package/README.md
CHANGED
|
@@ -7,4 +7,4 @@ It's designed for developers who would like to use `styled-components` as the ma
|
|
|
7
7
|
|
|
8
8
|
<!-- #default-branch-switch -->
|
|
9
9
|
|
|
10
|
-
Visit [https://mui.com/material-ui/
|
|
10
|
+
Visit [https://next.mui.com/material-ui/integrations/styled-components/](https://next.mui.com/material-ui/integrations/styled-components/) to view the full documentation.
|
package/index.d.ts
CHANGED
|
@@ -23,7 +23,7 @@ type Defaultize<P, D> = P extends any
|
|
|
23
23
|
Partial<PickU<D, Exclude<keyof D, keyof P>>>
|
|
24
24
|
: never;
|
|
25
25
|
|
|
26
|
-
export type IntrinsicElementsKeys = keyof JSX.IntrinsicElements;
|
|
26
|
+
export type IntrinsicElementsKeys = keyof React.JSX.IntrinsicElements;
|
|
27
27
|
type ReactDefaultizedProps<C, P> = C extends { defaultProps: infer D } ? Defaultize<P, D> : P;
|
|
28
28
|
|
|
29
29
|
type MakeAttrsOptional<
|
|
@@ -108,7 +108,10 @@ export interface CSSObject
|
|
|
108
108
|
Omit<CSSOthersObject, 'variants'> {}
|
|
109
109
|
|
|
110
110
|
interface CSSObjectWithVariants<Props> extends Omit<CSSObject, 'variants'> {
|
|
111
|
-
variants: Array<{
|
|
111
|
+
variants: Array<{
|
|
112
|
+
props: Props | ((props: Props) => boolean);
|
|
113
|
+
style: CSSObject;
|
|
114
|
+
}>;
|
|
112
115
|
}
|
|
113
116
|
|
|
114
117
|
export type FalseyValue = undefined | null | false;
|
|
@@ -153,7 +156,7 @@ type StyledComponentPropsWithAs<
|
|
|
153
156
|
};
|
|
154
157
|
|
|
155
158
|
export type StyledComponent<
|
|
156
|
-
C extends keyof JSX.IntrinsicElements | React.ComponentType<any>,
|
|
159
|
+
C extends keyof React.JSX.IntrinsicElements | React.ComponentType<any>,
|
|
157
160
|
T extends object = {},
|
|
158
161
|
O extends object = {},
|
|
159
162
|
A extends keyof any = never,
|
|
@@ -170,31 +173,21 @@ export type AnyStyledComponent =
|
|
|
170
173
|
| React.FunctionComponent<any>
|
|
171
174
|
| React.ComponentType<any>;
|
|
172
175
|
|
|
173
|
-
export type StyledComponentInnerComponent<C extends AnyStyledComponent> =
|
|
174
|
-
infer I,
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
? I
|
|
180
|
-
: C extends StyledComponent<infer I, any, any>
|
|
181
|
-
? I
|
|
182
|
-
: C;
|
|
176
|
+
export type StyledComponentInnerComponent<C extends AnyStyledComponent> =
|
|
177
|
+
C extends StyledComponent<infer I, any, any, any>
|
|
178
|
+
? I
|
|
179
|
+
: C extends StyledComponent<infer I, any, any>
|
|
180
|
+
? I
|
|
181
|
+
: C;
|
|
183
182
|
|
|
184
183
|
export type StyledComponentInnerOtherProps<C extends AnyStyledComponent> =
|
|
185
184
|
C extends StyledComponent<any, any, infer O, any>
|
|
186
185
|
? O
|
|
187
186
|
: C extends StyledComponent<any, any, infer O>
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
export type StyledComponentInnerAttrs<C extends AnyStyledComponent> =
|
|
191
|
-
any,
|
|
192
|
-
any,
|
|
193
|
-
any,
|
|
194
|
-
infer A
|
|
195
|
-
>
|
|
196
|
-
? A
|
|
197
|
-
: never;
|
|
187
|
+
? O
|
|
188
|
+
: never;
|
|
189
|
+
export type StyledComponentInnerAttrs<C extends AnyStyledComponent> =
|
|
190
|
+
C extends StyledComponent<any, any, any, infer A> ? A : never;
|
|
198
191
|
|
|
199
192
|
export interface StyledComponentBase<
|
|
200
193
|
C extends string | React.ComponentType<any>,
|
|
@@ -224,7 +217,7 @@ export interface StyledComponentBase<
|
|
|
224
217
|
O & StyledComponentInnerOtherProps<WithC>,
|
|
225
218
|
A | StyledComponentInnerAttrs<WithC>
|
|
226
219
|
>;
|
|
227
|
-
withComponent<WithC extends keyof JSX.IntrinsicElements | React.ComponentType<any>>(
|
|
220
|
+
withComponent<WithC extends keyof React.JSX.IntrinsicElements | React.ComponentType<any>>(
|
|
228
221
|
component: WithC,
|
|
229
222
|
): StyledComponent<WithC, T, O, A>;
|
|
230
223
|
}
|
|
@@ -239,18 +232,18 @@ type StyledComponentInterpolation =
|
|
|
239
232
|
type AnyIfEmpty<T extends object> = keyof T extends never ? any : T;
|
|
240
233
|
|
|
241
234
|
type ThemedStyledComponentFactories<T extends object> = {
|
|
242
|
-
[TTag in keyof JSX.IntrinsicElements]: ThemedStyledFunctionBase<TTag, T>;
|
|
235
|
+
[TTag in keyof React.JSX.IntrinsicElements]: ThemedStyledFunctionBase<TTag, T>;
|
|
243
236
|
};
|
|
244
237
|
|
|
245
238
|
export type StyledComponentPropsWithRef<
|
|
246
|
-
C extends keyof JSX.IntrinsicElements | React.ComponentType<any>,
|
|
239
|
+
C extends keyof React.JSX.IntrinsicElements | React.ComponentType<any>,
|
|
247
240
|
> = C extends AnyStyledComponent
|
|
248
241
|
? React.ComponentPropsWithRef<StyledComponentInnerComponent<C>>
|
|
249
242
|
: React.ComponentPropsWithRef<C>;
|
|
250
243
|
|
|
251
244
|
// Same as in styled-components, but copied here so that it would use the Interpolation & CSS typings from above
|
|
252
245
|
export interface ThemedStyledFunctionBase<
|
|
253
|
-
C extends keyof JSX.IntrinsicElements | React.ComponentType<any>,
|
|
246
|
+
C extends keyof React.JSX.IntrinsicElements | React.ComponentType<any>,
|
|
254
247
|
T extends object,
|
|
255
248
|
O extends object = {},
|
|
256
249
|
A extends keyof any = never,
|
|
@@ -274,7 +267,7 @@ export interface ThemedStyledFunctionBase<
|
|
|
274
267
|
|
|
275
268
|
// same as ThemedStyledFunction in styled-components, but without attrs, and withConfig
|
|
276
269
|
export interface ThemedStyledFunction<
|
|
277
|
-
C extends keyof JSX.IntrinsicElements | React.ComponentType<any>,
|
|
270
|
+
C extends keyof React.JSX.IntrinsicElements | React.ComponentType<any>,
|
|
278
271
|
T extends object,
|
|
279
272
|
O extends object = {},
|
|
280
273
|
A extends keyof any = never,
|
|
@@ -355,22 +348,24 @@ export interface ThemedBaseStyledInterface<
|
|
|
355
348
|
): CreateStyledComponent<PropsOf<C> & MUIStyledCommonProps, {}, {}, Theme>;
|
|
356
349
|
|
|
357
350
|
<
|
|
358
|
-
Tag extends keyof JSX.IntrinsicElements,
|
|
359
|
-
ForwardedProps extends
|
|
351
|
+
Tag extends keyof React.JSX.IntrinsicElements,
|
|
352
|
+
ForwardedProps extends
|
|
353
|
+
keyof React.JSX.IntrinsicElements[Tag] = keyof React.JSX.IntrinsicElements[Tag],
|
|
360
354
|
>(
|
|
361
355
|
tag: Tag,
|
|
362
|
-
options: FilteringStyledOptions<JSX.IntrinsicElements[Tag], ForwardedProps> &
|
|
356
|
+
options: FilteringStyledOptions<React.JSX.IntrinsicElements[Tag], ForwardedProps> &
|
|
357
|
+
MuiStyledOptions,
|
|
363
358
|
): CreateStyledComponent<
|
|
364
359
|
MUIStyledCommonProps,
|
|
365
|
-
Pick<JSX.IntrinsicElements[Tag], ForwardedProps>,
|
|
360
|
+
Pick<React.JSX.IntrinsicElements[Tag], ForwardedProps>,
|
|
366
361
|
{},
|
|
367
362
|
Theme
|
|
368
363
|
>;
|
|
369
364
|
|
|
370
|
-
<Tag extends keyof JSX.IntrinsicElements>(
|
|
365
|
+
<Tag extends keyof React.JSX.IntrinsicElements>(
|
|
371
366
|
tag: Tag,
|
|
372
367
|
options?: StyledConfig<MUIStyledCommonProps> & MuiStyledOptions,
|
|
373
|
-
): CreateStyledComponent<MUIStyledCommonProps, JSX.IntrinsicElements[Tag], {}, Theme>;
|
|
368
|
+
): CreateStyledComponent<MUIStyledCommonProps, React.JSX.IntrinsicElements[Tag], {}, Theme>;
|
|
374
369
|
}
|
|
375
370
|
|
|
376
371
|
export type CreateMUIStyled<
|
|
@@ -379,8 +374,9 @@ export type CreateMUIStyled<
|
|
|
379
374
|
T extends object = {},
|
|
380
375
|
> = ThemedBaseStyledInterface<MUIStyledCommonProps, MuiStyledOptions, AnyIfEmpty<T>>;
|
|
381
376
|
|
|
382
|
-
export type PropsOf<
|
|
383
|
-
JSX.
|
|
377
|
+
export type PropsOf<
|
|
378
|
+
C extends keyof React.JSX.IntrinsicElements | React.JSXElementConstructor<any>,
|
|
379
|
+
> = React.JSX.LibraryManagedAttributes<C, React.ComponentProps<C>>;
|
|
384
380
|
|
|
385
381
|
export interface MUIStyledComponent<
|
|
386
382
|
ComponentProps extends {},
|
|
@@ -393,7 +389,7 @@ export interface MUIStyledComponent<
|
|
|
393
389
|
withComponent<C extends React.ComponentType<React.ComponentProps<C>>>(
|
|
394
390
|
component: C,
|
|
395
391
|
): MUIStyledComponent<ComponentProps & PropsOf<C>>;
|
|
396
|
-
withComponent<Tag extends keyof JSX.IntrinsicElements>(
|
|
392
|
+
withComponent<Tag extends keyof React.JSX.IntrinsicElements>(
|
|
397
393
|
tag: Tag,
|
|
398
|
-
): MUIStyledComponent<ComponentProps, JSX.IntrinsicElements[Tag]>;
|
|
394
|
+
): MUIStyledComponent<ComponentProps, React.JSX.IntrinsicElements[Tag]>;
|
|
399
395
|
}
|
package/index.js
CHANGED
package/modern/index.js
CHANGED
package/node/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @mui/styled-engine-sc v6.0.0-
|
|
2
|
+
* @mui/styled-engine-sc v6.0.0-beta.0
|
|
3
3
|
*
|
|
4
4
|
* @license MIT
|
|
5
5
|
* This source code is licensed under the MIT license found in the
|
|
@@ -47,7 +47,7 @@ var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
|
47
47
|
var _StyledEngineProvider = _interopRequireDefault(require("./StyledEngineProvider"));
|
|
48
48
|
var _GlobalStyles = _interopRequireDefault(require("./GlobalStyles"));
|
|
49
49
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
50
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u &&
|
|
50
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
51
51
|
function styled(tag, options) {
|
|
52
52
|
let stylesFactory;
|
|
53
53
|
if (options) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/styled-engine-sc",
|
|
3
|
-
"version": "6.0.0-
|
|
3
|
+
"version": "6.0.0-beta.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "MUI Team",
|
|
6
6
|
"description": "styled() API wrapper package for styled-components.",
|
|
@@ -20,14 +20,14 @@
|
|
|
20
20
|
"bugs": {
|
|
21
21
|
"url": "https://github.com/mui/material-ui/issues"
|
|
22
22
|
},
|
|
23
|
-
"homepage": "https://mui.com/material-ui/
|
|
23
|
+
"homepage": "https://mui.com/material-ui/integrations/styled-components/",
|
|
24
24
|
"funding": {
|
|
25
25
|
"type": "opencollective",
|
|
26
26
|
"url": "https://opencollective.com/mui-org"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@babel/runtime": "^7.
|
|
30
|
-
"csstype": "^3.1.
|
|
29
|
+
"@babel/runtime": "^7.24.7",
|
|
30
|
+
"csstype": "^3.1.3",
|
|
31
31
|
"hoist-non-react-statics": "^3.3.2",
|
|
32
32
|
"prop-types": "^15.8.1"
|
|
33
33
|
},
|
|
@@ -36,7 +36,8 @@
|
|
|
36
36
|
},
|
|
37
37
|
"sideEffects": false,
|
|
38
38
|
"publishConfig": {
|
|
39
|
-
"access": "public"
|
|
39
|
+
"access": "public",
|
|
40
|
+
"directory": "build"
|
|
40
41
|
},
|
|
41
42
|
"engines": {
|
|
42
43
|
"node": ">=12.0.0"
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import PropTypes from 'prop-types';
|
|
2
|
-
import { createGlobalStyle } from 'styled-components';
|
|
3
|
-
function isEmpty(obj) {
|
|
4
|
-
return obj === undefined || obj === null || Object.keys(obj).length === 0;
|
|
5
|
-
}
|
|
6
|
-
var GlobalStyles = createGlobalStyle(function (props) {
|
|
7
|
-
var styles = props.styles,
|
|
8
|
-
_props$defaultTheme = props.defaultTheme,
|
|
9
|
-
defaultTheme = _props$defaultTheme === void 0 ? {} : _props$defaultTheme;
|
|
10
|
-
if (typeof styles === 'function') {
|
|
11
|
-
return styles(isEmpty(props.theme) ? defaultTheme : props.theme);
|
|
12
|
-
}
|
|
13
|
-
return styles;
|
|
14
|
-
});
|
|
15
|
-
export default GlobalStyles;
|
|
16
|
-
GlobalStyles.propTypes = {
|
|
17
|
-
defaultTheme: PropTypes.object,
|
|
18
|
-
styles: PropTypes.oneOfType([PropTypes.array, PropTypes.string, PropTypes.object, PropTypes.func])
|
|
19
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './GlobalStyles';
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import PropTypes from 'prop-types';
|
|
2
|
-
export default function StyledEngineProvider(props) {
|
|
3
|
-
var injectFirst = props.injectFirst,
|
|
4
|
-
children = props.children;
|
|
5
|
-
if (injectFirst && typeof window !== 'undefined') {
|
|
6
|
-
var head = document.head;
|
|
7
|
-
if (!head.querySelector('[data-styled="active"]')) {
|
|
8
|
-
var injectFirstNode = document.createElement('style');
|
|
9
|
-
injectFirstNode.setAttribute('data-styled', 'active');
|
|
10
|
-
head.insertBefore(injectFirstNode, head.firstChild);
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
return children;
|
|
14
|
-
}
|
|
15
|
-
StyledEngineProvider.propTypes = {
|
|
16
|
-
/**
|
|
17
|
-
* Your component tree.
|
|
18
|
-
*/
|
|
19
|
-
children: PropTypes.node,
|
|
20
|
-
/**
|
|
21
|
-
* By default, the styles are injected last in the <head> element of the page.
|
|
22
|
-
* As a result, they gain more specificity than any other style sheet.
|
|
23
|
-
* If you want to override MUI's styles, set this prop.
|
|
24
|
-
*/
|
|
25
|
-
injectFirst: PropTypes.bool
|
|
26
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './StyledEngineProvider';
|
package/legacy/index.js
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @mui/styled-engine-sc v6.0.0-alpha.9
|
|
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
|
-
import scStyled from 'styled-components';
|
|
9
|
-
export default function styled(tag, options) {
|
|
10
|
-
var stylesFactory;
|
|
11
|
-
if (options) {
|
|
12
|
-
stylesFactory = scStyled(tag).withConfig({
|
|
13
|
-
displayName: options.label,
|
|
14
|
-
shouldForwardProp: options.shouldForwardProp
|
|
15
|
-
});
|
|
16
|
-
} else {
|
|
17
|
-
stylesFactory = scStyled(tag);
|
|
18
|
-
}
|
|
19
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
20
|
-
var fn = function fn() {
|
|
21
|
-
var component = typeof tag === 'string' ? "\"".concat(tag, "\"") : 'component';
|
|
22
|
-
for (var _len = arguments.length, styles = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
23
|
-
styles[_key] = arguments[_key];
|
|
24
|
-
}
|
|
25
|
-
if (styles.length === 0) {
|
|
26
|
-
console.error(["MUI: Seems like you called `styled(".concat(component, ")()` without a `style` argument."), 'You must provide a `styles` argument: `styled("div")(styleYouForgotToPass)`.'].join('\n'));
|
|
27
|
-
} else if (styles.some(function (style) {
|
|
28
|
-
return style === undefined;
|
|
29
|
-
})) {
|
|
30
|
-
console.error("MUI: the styled(".concat(component, ")(...args) API requires all its args to be defined."));
|
|
31
|
-
}
|
|
32
|
-
return stylesFactory.apply(void 0, styles);
|
|
33
|
-
};
|
|
34
|
-
fn.withConfig = stylesFactory.withConfig;
|
|
35
|
-
return fn;
|
|
36
|
-
}
|
|
37
|
-
return stylesFactory;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
41
|
-
export var internal_processStyles = function internal_processStyles(tag, processor) {
|
|
42
|
-
// Styled-components attaches an instance to `componentStyle`.
|
|
43
|
-
// https://github.com/styled-components/styled-components/blob/da8151762dcf72735ffba358173d4c097f6d5888/packages/styled-components/src/models/StyledComponent.ts#L257
|
|
44
|
-
//
|
|
45
|
-
// The instance contains `rules` (the styles)
|
|
46
|
-
// https://github.com/styled-components/styled-components/blob/da8151762dcf72735ffba358173d4c097f6d5888/packages/styled-components/src/models/ComponentStyle.ts#L23
|
|
47
|
-
if (tag.componentStyle) {
|
|
48
|
-
tag.componentStyle.rules = processor(tag.componentStyle.rules);
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
export { ThemeContext, keyframes, css } from 'styled-components';
|
|
52
|
-
export { default as StyledEngineProvider } from './StyledEngineProvider';
|
|
53
|
-
export { default as GlobalStyles } from './GlobalStyles';
|