@mui/styled-engine-sc 5.0.0 → 5.3.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/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2014 Call-Em-All
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2014 Call-Em-All
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/index.d.ts CHANGED
@@ -1,9 +1,140 @@
1
+ import * as React from 'react';
2
+ import * as CSS from 'csstype';
3
+ import {
4
+ AnyStyledComponent,
5
+ StyledConfig,
6
+ StyledComponent,
7
+ StyledComponentPropsWithRef,
8
+ StyledComponentInnerComponent,
9
+ StyledComponentInnerOtherProps,
10
+ StyledComponentInnerAttrs,
11
+ ThemedStyledProps,
12
+ StyledComponentBase,
13
+ Keyframes,
14
+ } from 'styled-components';
15
+
1
16
  export * from 'styled-components';
2
17
  export { default } from 'styled-components';
3
18
 
4
19
  export { default as StyledEngineProvider } from './StyledEngineProvider';
5
20
 
6
- export { ThemeContext, keyframes, css } from 'styled-components';
7
-
8
21
  export { default as GlobalStyles } from './GlobalStyles';
9
22
  export * from './GlobalStyles';
23
+
24
+ // These are the same as the ones in @mui/styled-engine
25
+ // CSS.PropertiesFallback are necessary so that we support spreading of the mixins. For example:
26
+ // '@font-face'?: Fontface | Fontface[]
27
+ export type CSSProperties = CSS.PropertiesFallback<number | string>;
28
+ export type CSSPropertiesWithMultiValues = {
29
+ [K in keyof CSSProperties]: CSSProperties[K] | Array<Extract<CSSProperties[K], string>>;
30
+ };
31
+ export type CSSPseudos = { [K in CSS.Pseudos]?: unknown | CSSObject };
32
+
33
+ export interface CSSOthersObject {
34
+ [propertiesName: string]: unknown | CSSInterpolation;
35
+ }
36
+ export type CSSPseudosForCSSObject = { [K in CSS.Pseudos]?: CSSObject };
37
+
38
+ export interface ArrayCSSInterpolation extends Array<CSSInterpolation> {}
39
+
40
+ export interface CSSOthersObjectForCSSObject {
41
+ [propertiesName: string]: CSSInterpolation;
42
+ }
43
+
44
+ export interface CSSObject extends CSSPropertiesWithMultiValues, CSSPseudos, CSSOthersObject {}
45
+
46
+ export type FalseyValue = undefined | null | false;
47
+ export type Interpolation<P> =
48
+ | InterpolationValue
49
+ | InterpolationFunction<P>
50
+ | FlattenInterpolation<P>;
51
+ // cannot be made a self-referential interface, breaks WithPropNested
52
+ // see https://github.com/microsoft/TypeScript/issues/34796
53
+ export type FlattenInterpolation<P> = ReadonlyArray<Interpolation<P>>;
54
+ export type InterpolationValue =
55
+ | string
56
+ | number
57
+ | FalseyValue
58
+ | Keyframes
59
+ | StyledComponentInterpolation
60
+ | CSSObject;
61
+ export type SimpleInterpolation = InterpolationValue | FlattenSimpleInterpolation;
62
+ // adapter for compatibility with @mui/styled-engine
63
+ export type CSSInterpolation = SimpleInterpolation;
64
+ export type FlattenSimpleInterpolation = ReadonlyArray<SimpleInterpolation>;
65
+
66
+ export type InterpolationFunction<P> = (props: P) => Interpolation<P>;
67
+
68
+ // remove the call signature from StyledComponent so Interpolation can still infer InterpolationFunction
69
+ type StyledComponentInterpolation =
70
+ | Pick<StyledComponentBase<any, any, any, any>, keyof StyledComponentBase<any, any>>
71
+ | Pick<StyledComponentBase<any, any, any>, keyof StyledComponentBase<any, any>>;
72
+
73
+ // These are typings coming from styled-components
74
+ // They are adjusted to accept the extended options coming from mui
75
+ type AnyIfEmpty<T extends object> = keyof T extends never ? any : T;
76
+
77
+ type ThemedStyledComponentFactories<T extends object> = {
78
+ [TTag in keyof JSX.IntrinsicElements]: ThemedStyledFunctionBase<TTag, T>;
79
+ };
80
+
81
+ // Same as in styled-components, but copied here so that it would use the Interpolation & CSS typings from above
82
+ export interface ThemedStyledFunctionBase<
83
+ C extends keyof JSX.IntrinsicElements | React.ComponentType<any>,
84
+ T extends object,
85
+ O extends object = {},
86
+ A extends keyof any = never,
87
+ > {
88
+ (first: TemplateStringsArray): StyledComponent<C, T, O, A>;
89
+ (
90
+ first:
91
+ | TemplateStringsArray
92
+ | CSSObject
93
+ | InterpolationFunction<ThemedStyledProps<StyledComponentPropsWithRef<C> & O, T>>,
94
+ ...rest: Array<Interpolation<ThemedStyledProps<StyledComponentPropsWithRef<C> & O, T>>>
95
+ ): StyledComponent<C, T, O, A>;
96
+ <U extends object>(
97
+ first:
98
+ | TemplateStringsArray
99
+ | CSSObject
100
+ | InterpolationFunction<ThemedStyledProps<StyledComponentPropsWithRef<C> & O & U, T>>,
101
+ ...rest: Array<Interpolation<ThemedStyledProps<StyledComponentPropsWithRef<C> & O & U, T>>>
102
+ ): StyledComponent<C, T, O & U, A>;
103
+ }
104
+
105
+ // same as ThemedStyledFunction in styled-components, but without attrs, and withConfig
106
+ export interface ThemedStyledFunction<
107
+ C extends keyof JSX.IntrinsicElements | React.ComponentType<any>,
108
+ T extends object,
109
+ O extends object = {},
110
+ A extends keyof any = never,
111
+ > extends ThemedStyledFunctionBase<C, T, O, A> {}
112
+
113
+ // same as ThemedBaseStyledInterface in styled-components, but with added options & common props for MUI components
114
+ export interface ThemedBaseStyledInterface<
115
+ MUIStyledCommonProps extends object,
116
+ MuiStyledOptions extends object,
117
+ T extends object,
118
+ > extends ThemedStyledComponentFactories<T> {
119
+ <C extends AnyStyledComponent>(
120
+ component: C,
121
+ options?: StyledConfig<any> & MuiStyledOptions,
122
+ ): ThemedStyledFunction<
123
+ StyledComponentInnerComponent<C>,
124
+ T,
125
+ StyledComponentInnerOtherProps<C> & MUIStyledCommonProps,
126
+ StyledComponentInnerAttrs<C>
127
+ >;
128
+ <C extends keyof JSX.IntrinsicElements | React.ComponentType<any>>(
129
+ // unfortunately using a conditional type to validate that it can receive a `theme?: Theme`
130
+ // causes tests to fail in TS 3.1
131
+ component: C,
132
+ options?: StyledConfig<any> & MuiStyledOptions,
133
+ ): ThemedStyledFunction<C, T, MUIStyledCommonProps>;
134
+ }
135
+
136
+ export type CreateMUIStyled<
137
+ MUIStyledCommonProps extends object = {},
138
+ MuiStyledOptions extends object = {},
139
+ T extends object = {},
140
+ > = ThemedBaseStyledInterface<MUIStyledCommonProps, MuiStyledOptions, AnyIfEmpty<T>>;
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license MUI v5.0.0
1
+ /** @license MUI v5.3.0
2
2
  *
3
3
  * This source code is licensed under the MIT license found in the
4
4
  * LICENSE file in the root directory of this source tree.
@@ -17,7 +17,7 @@ export default function styled(tag, options) {
17
17
  }
18
18
 
19
19
  if (process.env.NODE_ENV !== 'production') {
20
- return (...styles) => {
20
+ const fn = (...styles) => {
21
21
  const component = typeof tag === 'string' ? `"${tag}"` : 'component';
22
22
 
23
23
  if (styles.length === 0) {
@@ -28,6 +28,9 @@ export default function styled(tag, options) {
28
28
 
29
29
  return stylesFactory(...styles);
30
30
  };
31
+
32
+ fn.withConfig = stylesFactory.withConfig;
33
+ return fn;
31
34
  }
32
35
 
33
36
  return stylesFactory;
package/legacy/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license MUI v5.0.0
1
+ /** @license MUI v5.3.0
2
2
  *
3
3
  * This source code is licensed under the MIT license found in the
4
4
  * LICENSE file in the root directory of this source tree.
@@ -17,7 +17,7 @@ export default function styled(tag, options) {
17
17
  }
18
18
 
19
19
  if (process.env.NODE_ENV !== 'production') {
20
- return function () {
20
+ var fn = function fn() {
21
21
  var component = typeof tag === 'string' ? "\"".concat(tag, "\"") : 'component';
22
22
 
23
23
  for (var _len = arguments.length, styles = new Array(_len), _key = 0; _key < _len; _key++) {
@@ -34,6 +34,9 @@ export default function styled(tag, options) {
34
34
 
35
35
  return stylesFactory.apply(void 0, styles);
36
36
  };
37
+
38
+ fn.withConfig = stylesFactory.withConfig;
39
+ return fn;
37
40
  }
38
41
 
39
42
  return stylesFactory;
package/modern/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license MUI v5.0.0
1
+ /** @license MUI v5.3.0
2
2
  *
3
3
  * This source code is licensed under the MIT license found in the
4
4
  * LICENSE file in the root directory of this source tree.
@@ -17,7 +17,7 @@ export default function styled(tag, options) {
17
17
  }
18
18
 
19
19
  if (process.env.NODE_ENV !== 'production') {
20
- return (...styles) => {
20
+ const fn = (...styles) => {
21
21
  const component = typeof tag === 'string' ? `"${tag}"` : 'component';
22
22
 
23
23
  if (styles.length === 0) {
@@ -28,6 +28,9 @@ export default function styled(tag, options) {
28
28
 
29
29
  return stylesFactory(...styles);
30
30
  };
31
+
32
+ fn.withConfig = stylesFactory.withConfig;
33
+ return fn;
31
34
  }
32
35
 
33
36
  return stylesFactory;
package/node/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license MUI v5.0.0
1
+ /** @license MUI v5.3.0
2
2
  *
3
3
  * This source code is licensed under the MIT license found in the
4
4
  * LICENSE file in the root directory of this source tree.
@@ -10,35 +10,35 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
10
10
  Object.defineProperty(exports, "__esModule", {
11
11
  value: true
12
12
  });
13
- exports.default = styled;
14
- Object.defineProperty(exports, "ThemeContext", {
13
+ Object.defineProperty(exports, "GlobalStyles", {
15
14
  enumerable: true,
16
15
  get: function () {
17
- return _styledComponents.ThemeContext;
16
+ return _GlobalStyles.default;
18
17
  }
19
18
  });
20
- Object.defineProperty(exports, "keyframes", {
19
+ Object.defineProperty(exports, "StyledEngineProvider", {
21
20
  enumerable: true,
22
21
  get: function () {
23
- return _styledComponents.keyframes;
22
+ return _StyledEngineProvider.default;
24
23
  }
25
24
  });
26
- Object.defineProperty(exports, "css", {
25
+ Object.defineProperty(exports, "ThemeContext", {
27
26
  enumerable: true,
28
27
  get: function () {
29
- return _styledComponents.css;
28
+ return _styledComponents.ThemeContext;
30
29
  }
31
30
  });
32
- Object.defineProperty(exports, "StyledEngineProvider", {
31
+ Object.defineProperty(exports, "css", {
33
32
  enumerable: true,
34
33
  get: function () {
35
- return _StyledEngineProvider.default;
34
+ return _styledComponents.css;
36
35
  }
37
36
  });
38
- Object.defineProperty(exports, "GlobalStyles", {
37
+ exports.default = styled;
38
+ Object.defineProperty(exports, "keyframes", {
39
39
  enumerable: true,
40
40
  get: function () {
41
- return _GlobalStyles.default;
41
+ return _styledComponents.keyframes;
42
42
  }
43
43
  });
44
44
 
@@ -65,7 +65,7 @@ function styled(tag, options) {
65
65
  }
66
66
 
67
67
  if (process.env.NODE_ENV !== 'production') {
68
- return (...styles) => {
68
+ const fn = (...styles) => {
69
69
  const component = typeof tag === 'string' ? `"${tag}"` : 'component';
70
70
 
71
71
  if (styles.length === 0) {
@@ -76,6 +76,9 @@ function styled(tag, options) {
76
76
 
77
77
  return stylesFactory(...styles);
78
78
  };
79
+
80
+ fn.withConfig = stylesFactory.withConfig;
81
+ return fn;
79
82
  }
80
83
 
81
84
  return stylesFactory;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/styled-engine-sc",
3
- "version": "5.0.0",
3
+ "version": "5.3.0",
4
4
  "private": false,
5
5
  "author": "MUI Team",
6
6
  "description": "styled() API wrapper package for styled-components.",
@@ -8,7 +8,7 @@
8
8
  "keywords": [
9
9
  "react",
10
10
  "react-component",
11
- "material-ui",
11
+ "mui",
12
12
  "styled-components"
13
13
  ],
14
14
  "repository": {
@@ -23,7 +23,7 @@
23
23
  "homepage": "https://mui.com/guides/styled-engine/",
24
24
  "funding": {
25
25
  "type": "opencollective",
26
- "url": "https://opencollective.com/material-ui"
26
+ "url": "https://opencollective.com/mui"
27
27
  },
28
28
  "dependencies": {
29
29
  "prop-types": "^15.7.2"