@mui/utils 6.0.0-alpha.6 → 6.0.0-alpha.9
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 +113 -2
- package/deepmerge/deepmerge.js +5 -6
- package/exactProp/exactProp.js +3 -3
- package/index.js +1 -1
- package/modern/deepmerge/deepmerge.js +5 -6
- package/modern/exactProp/exactProp.js +3 -3
- package/modern/index.js +1 -1
- package/modern/requirePropFactory/requirePropFactory.js +3 -2
- package/modern/resolveProps/resolveProps.js +10 -4
- package/modern/useTimeout/useTimeout.js +11 -12
- package/node/deepmerge/deepmerge.js +5 -7
- package/node/exactProp/exactProp.js +3 -4
- package/node/index.js +1 -1
- package/node/requirePropFactory/requirePropFactory.js +3 -3
- package/node/resolveProps/resolveProps.js +10 -5
- package/node/useTimeout/useTimeout.js +11 -12
- package/package.json +2 -2
- package/requirePropFactory/requirePropFactory.js +3 -2
- package/resolveProps/resolveProps.js +10 -4
- package/useTimeout/useTimeout.js +11 -12
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,116 @@
|
|
|
1
1
|
# [Versions](https://mui.com/versions/)
|
|
2
2
|
|
|
3
|
+
## v6.0.0-alpha.9
|
|
4
|
+
|
|
5
|
+
<!-- generated comparing v6.0.0-alpha.8..next -->
|
|
6
|
+
|
|
7
|
+
_May 29, 2024_
|
|
8
|
+
|
|
9
|
+
A big thanks to the 23 contributors who made this release possible. Here are some highlights ✨:
|
|
10
|
+
|
|
11
|
+
- 🚀 `CssVarsProvider` and `extendTheme` are now stable (#42246) @siriwatknp
|
|
12
|
+
|
|
13
|
+
### `@mui/material@6.0.0-alpha.9`
|
|
14
|
+
|
|
15
|
+
- ​<!-- 49 -->[AlertTitle] Enable extending Typography props (#42269) @lucasgmelo
|
|
16
|
+
- ​<!-- 48 -->[AvatarGroup] deprecate `componentsProps` for v6 (#42122) @lhilgert9
|
|
17
|
+
- ​<!-- 15 -->[Grid] Deprecate `wrap` prop (#42363) @fedirjh
|
|
18
|
+
- ​<!-- 14 -->[ListItem] Document `*Component` and `*Props` props deprecations (#42263) @aarongarciah
|
|
19
|
+
- ​<!-- 13 -->[ListItem] Deprecate ListItem's components and componentsProps (#42219) @aarongarciah
|
|
20
|
+
- ​<!-- 12 -->[ListItemSecondaryAction] Deprecate component (#42251) @aarongarciah
|
|
21
|
+
- ​<!-- 11 -->Stabilize `CssVarsProvider` and `extendTheme` (#42246) @siriwatknp
|
|
22
|
+
- ​<!-- 10 -->[Popper] Deprecate components and componentProps props for v6 (#42111) @ChronicusUA
|
|
23
|
+
- ​<!-- 09 -->[responsiveFontSizes] Handled undefined variants (#42412) @brijeshb42
|
|
24
|
+
- ​<!-- 08 -->[Slider] Fix wrong CSS value (#42370) @mnajdova
|
|
25
|
+
- ​<!-- 07 -->[Tooltip] Deprecate components and componentProps props for v6 (#42107) @ChronicusUA
|
|
26
|
+
|
|
27
|
+
### `@mui/system@6.0.0-alpha.9`
|
|
28
|
+
|
|
29
|
+
- ​<!-- 34 -->[createStyled] Intercept `ownerState` coming from `props` and `ownerState` (#42358) @DiegoAndai
|
|
30
|
+
|
|
31
|
+
### `@mui/codemod@6.0.0-alpha.9`
|
|
32
|
+
|
|
33
|
+
- ​<!-- 41 -->Add `sx` prop for v6 migration (#42153) @siriwatknp
|
|
34
|
+
- ​<!-- 40 -->Add codemod for removing system props (#42282) @siriwatknp
|
|
35
|
+
|
|
36
|
+
### Docs
|
|
37
|
+
|
|
38
|
+
- ​<!-- 33 -->Remove unused images (#42324) @danilo-leal
|
|
39
|
+
- ​<!-- 32 -->Add Pigment CSS and Base UI logos SVGs (#42322) @danilo-leal
|
|
40
|
+
- ​<!-- 22 -->[joy-ui] Fix template responsiveness (#42422) @j4marcos
|
|
41
|
+
- ​<!-- 21 -->[material-ui] Add the Pashto locale (#42244) @sayoubiaf
|
|
42
|
+
- ​<!-- 20 -->[material-ui] Remove duplicate Design Kits page (#42338) @danilo-leal
|
|
43
|
+
- ​<!-- 19 -->[material-ui] Document callback to access theme in GlobalStyles (#42257) @aarongarciah
|
|
44
|
+
- ​<!-- 18 -->[material-ui] Add minor modifications to the Vertical stepper demo (#42342) @mihilt
|
|
45
|
+
- ​<!-- 17 -->[material-ui][Tabs] Improve the Basic Tabs demo (#42374) @MatheusEli
|
|
46
|
+
- ​<!-- 16 -->[pigment-css] Polish redirection mention @oliviertassinari
|
|
47
|
+
|
|
48
|
+
### Core
|
|
49
|
+
|
|
50
|
+
- ​<!-- 47 -->[blog] Add fixes and clean ups to the Blog page (#42311) @danilo-leal
|
|
51
|
+
- ​<!-- 46 -->[blog] Add the "Product" tag to the Pigment CSS post (#42365) @danilo-leal
|
|
52
|
+
- ​<!-- 45 -->[code-infra] Simplify .stylelintrc.js @oliviertassinari
|
|
53
|
+
- ​<!-- 44 -->[code-infra] Fix stylelint locally (#42411) @oliviertassinari
|
|
54
|
+
- ​<!-- 43 -->[code-infra] Run corepack enable on all CI jobs (#42331) @Janpot
|
|
55
|
+
- ​<!-- 42 -->[code-infra] Create examples eslint rule (#42170) @oliviertassinari
|
|
56
|
+
- ​<!-- 39 -->[core] Apply React 19 type changes that don't require upcoming `@types/` packages (#42346) @DiegoAndai
|
|
57
|
+
- ​<!-- 38 -->[core] Remove `react-swipeable-views-utils` package from docs (#42378) @ZeeshanTamboli
|
|
58
|
+
- ​<!-- 37 -->[core] Update `@testing-library/react` and `@testing-library/dom` packages (#42349) @ZeeshanTamboli
|
|
59
|
+
- ​<!-- 36 -->[core] Remove `@types/prettier` package (#42339) @ZeeshanTamboli
|
|
60
|
+
- ​<!-- 35 -->[core] Remove `WyW-in-JS` from Renovate config (#42335) @ZeeshanTamboli
|
|
61
|
+
- ​<!-- 31 -->[docs-infra] Split feedback channels per product (#42413) @alexfauquette
|
|
62
|
+
- ​<!-- 30 -->[docs-infra] Avoid cryptic errors when tests don't exist (#42356) @Janpot
|
|
63
|
+
- ​<!-- 29 -->[docs-infra] Make menu styles consistent (#42387) @danilo-leal
|
|
64
|
+
- ​<!-- 28 -->[docs-infra] Display deprecation messages in API pages (#42352) @aarongarciah
|
|
65
|
+
- ​<!-- 27 -->[docs-infra] Standardize API pages Alert styles (#42386) @danilo-leal
|
|
66
|
+
- ​<!-- 26 -->[docs-infra] Fix Toolpad Core API links (#42362) @apedroferreira
|
|
67
|
+
- ​<!-- 25 -->[docs-infra] Tigthen up the header design (#42180) @danilo-leal
|
|
68
|
+
- ​<!-- 24 -->[docs-infra] Add Toolpad to muiNpmOrgs for codesandbox demos (#42316) @Janpot
|
|
69
|
+
- ​<!-- 23 -->[docs-infra] Allow JSDoc tags (#42337) @aarongarciah
|
|
70
|
+
- ​<!-- 06 -->[test] Remove `userAgent` override in `jsdom` env (#42344) @cherniavskii
|
|
71
|
+
- ​<!-- 05 -->[utils] Fix GitHub-reported prototype pollution vulnerability in `deepmerge` (#41652) @tjcouch-sil
|
|
72
|
+
- ​<!-- 04 -->[website] Add Nikita to the about page (#42418) @nikitaa24
|
|
73
|
+
- ​<!-- 03 -->[website] Fix hero spacing changes applying at the wrong breakpoint (#42341) @KenanYusuf
|
|
74
|
+
- ​<!-- 02 -->[website] Adds Kenan Yusuf to about page (#42317) @KenanYusuf
|
|
75
|
+
- ​<!-- 01 -->[website] Improve about page @oliviertassinari
|
|
76
|
+
|
|
77
|
+
All contributors of this release in alphabetical order: @aarongarciah, @alexfauquette, @apedroferreira, @brijeshb42, @cherniavskii, @ChronicusUA, @danilo-leal, @DiegoAndai, @fedirjh, @j4marcos, @Janpot, @KenanYusuf, @lhilgert9, @lucasgmelo, @MatheusEli, @mihilt, @mnajdova, @nikitaa24, @oliviertassinari, @sayoubiaf, @siriwatknp, @tjcouch-sil, @ZeeshanTamboli
|
|
78
|
+
|
|
79
|
+
## v6.0.0-alpha.8
|
|
80
|
+
|
|
81
|
+
<!-- generated comparing v6.0.0-alpha.7..next -->
|
|
82
|
+
|
|
83
|
+
_May 21, 2024_
|
|
84
|
+
|
|
85
|
+
A big thanks to the 7 contributors who made this release possible.
|
|
86
|
+
This release was mostly about 🐛 bug fixes and 📚 documentation improvements.
|
|
87
|
+
|
|
88
|
+
### `@mui/material@6.0.0-alpha.7`
|
|
89
|
+
|
|
90
|
+
- ​<!-- 04 -->[material-ui] Filter only valid theme palette for generating styles (#42147) @siriwatknp
|
|
91
|
+
- ​<!-- 03 -->[material-ui] Remove UMD bundle (#42172) @ZeeshanTamboli
|
|
92
|
+
- ​<!-- 02 -->[material-ui][TextField] Deprecate `*Props` props (#42062) @DiegoAndai
|
|
93
|
+
|
|
94
|
+
### Docs
|
|
95
|
+
|
|
96
|
+
- ​<!-- 08 -->[docs] Remove Base UI from the README (#42307) @danilo-leal
|
|
97
|
+
- ​<!-- 07 -->[docs][material-ui] Fix typo in style interoperability with Tailwind CSS docs (#42279) @ZeeshanTamboli
|
|
98
|
+
- ​<!-- 06 -->[docs][material-ui] Add supported browsers section to migration guide (#42194) @DiegoAndai
|
|
99
|
+
- ​<!-- 05 -->[docs][material-ui][Pagination] Clarify pagination `page` prop API (#42220) @Mandar-Pandya
|
|
100
|
+
|
|
101
|
+
### Core
|
|
102
|
+
|
|
103
|
+
- ​<!-- 12 -->[blog] Update blog post OG image (#42270) @danilo-leal
|
|
104
|
+
- ​<!-- 11 -->[blog] Update Pigment CSS post (#42266) @danilo-leal
|
|
105
|
+
- ​<!-- 10 -->[docs] Remove LocalMonero (#42224) @oliviertassinari
|
|
106
|
+
- ​<!-- 08 -->[docs-infra] Fix keyboard navigation on page tabs (#42152) @danilo-leal
|
|
107
|
+
- ​<!-- 10 -->[code-infra] Remove raw-loader (#42275) @Janpot
|
|
108
|
+
- ​<!-- 09 -->[core] Remove outdated Babel plugins (#42140) @ZeeshanTamboli
|
|
109
|
+
- ​<!-- 12 -->[core] Fix a few more key spread issues (#42168) @oliviertassinari
|
|
110
|
+
- ​<!-- 01 -->[website] Avoid duplicate simple vs. rich (#42100) @oliviertassinari
|
|
111
|
+
|
|
112
|
+
All contributors of this release in alphabetical order: @danilo-leal, @DiegoAndai, @Janpot, @Mandar-Pandya, @oliviertassinari, @siriwatknp, @ZeeshanTamboli
|
|
113
|
+
|
|
3
114
|
## v6.0.0-alpha.7
|
|
4
115
|
|
|
5
116
|
<!-- generated comparing v6.0.0-alpha.6..next -->
|
|
@@ -53,7 +164,7 @@ All contributors of this release in alphabetical order: @aarongarciah, @alexfauq
|
|
|
53
164
|
|
|
54
165
|
_May 8, 2024_
|
|
55
166
|
|
|
56
|
-
A big thanks to the 10 contributors who made this release possible.
|
|
167
|
+
A big thanks to the 10 contributors who made this release possible.
|
|
57
168
|
|
|
58
169
|
### `@mui/material@6.0.0-alpha.6`
|
|
59
170
|
|
|
@@ -101,7 +212,7 @@ All contributors of this release in alphabetical order: @aarongarciah, @danilo-l
|
|
|
101
212
|
|
|
102
213
|
_May 1, 2024_
|
|
103
214
|
|
|
104
|
-
A big thanks to the 9 contributors who made this release possible.
|
|
215
|
+
A big thanks to the 9 contributors who made this release possible.
|
|
105
216
|
|
|
106
217
|
### `@mui/material@6.0.0-alpha.5`
|
|
107
218
|
|
package/deepmerge/deepmerge.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
1
|
// https://github.com/sindresorhus/is-plain-obj/blob/main/index.js
|
|
3
2
|
export function isPlainObject(item) {
|
|
4
3
|
if (typeof item !== 'object' || item === null) {
|
|
@@ -20,14 +19,14 @@ function deepClone(source) {
|
|
|
20
19
|
export default function deepmerge(target, source, options = {
|
|
21
20
|
clone: true
|
|
22
21
|
}) {
|
|
23
|
-
const output = options.clone ?
|
|
22
|
+
const output = options.clone ? {
|
|
23
|
+
...target
|
|
24
|
+
} : target;
|
|
24
25
|
if (isPlainObject(target) && isPlainObject(source)) {
|
|
25
26
|
Object.keys(source).forEach(key => {
|
|
27
|
+
if (isPlainObject(source[key]) &&
|
|
26
28
|
// Avoid prototype pollution
|
|
27
|
-
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
if (isPlainObject(source[key]) && key in target && isPlainObject(target[key])) {
|
|
29
|
+
Object.prototype.hasOwnProperty.call(target, key) && isPlainObject(target[key])) {
|
|
31
30
|
// Since `output` is a clone of `target` and we have narrowed `target` in this block we can cast to the same type.
|
|
32
31
|
output[key] = deepmerge(target[key], source[key], options);
|
|
33
32
|
} else if (options.clone) {
|
package/exactProp/exactProp.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
1
|
// This module is based on https://github.com/airbnb/prop-types-exact repository.
|
|
3
2
|
// However, in order to reduce the number of dependencies and to remove some extra safe checks
|
|
4
3
|
// the module was forked.
|
|
@@ -8,7 +7,8 @@ export default function exactProp(propTypes) {
|
|
|
8
7
|
if (process.env.NODE_ENV === 'production') {
|
|
9
8
|
return propTypes;
|
|
10
9
|
}
|
|
11
|
-
return
|
|
10
|
+
return {
|
|
11
|
+
...propTypes,
|
|
12
12
|
[specialProperty]: props => {
|
|
13
13
|
const unsupportedProps = Object.keys(props).filter(prop => !propTypes.hasOwnProperty(prop));
|
|
14
14
|
if (unsupportedProps.length > 0) {
|
|
@@ -16,5 +16,5 @@ export default function exactProp(propTypes) {
|
|
|
16
16
|
}
|
|
17
17
|
return null;
|
|
18
18
|
}
|
|
19
|
-
}
|
|
19
|
+
};
|
|
20
20
|
}
|
package/index.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
1
|
// https://github.com/sindresorhus/is-plain-obj/blob/main/index.js
|
|
3
2
|
export function isPlainObject(item) {
|
|
4
3
|
if (typeof item !== 'object' || item === null) {
|
|
@@ -20,14 +19,14 @@ function deepClone(source) {
|
|
|
20
19
|
export default function deepmerge(target, source, options = {
|
|
21
20
|
clone: true
|
|
22
21
|
}) {
|
|
23
|
-
const output = options.clone ?
|
|
22
|
+
const output = options.clone ? {
|
|
23
|
+
...target
|
|
24
|
+
} : target;
|
|
24
25
|
if (isPlainObject(target) && isPlainObject(source)) {
|
|
25
26
|
Object.keys(source).forEach(key => {
|
|
27
|
+
if (isPlainObject(source[key]) &&
|
|
26
28
|
// Avoid prototype pollution
|
|
27
|
-
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
if (isPlainObject(source[key]) && key in target && isPlainObject(target[key])) {
|
|
29
|
+
Object.prototype.hasOwnProperty.call(target, key) && isPlainObject(target[key])) {
|
|
31
30
|
// Since `output` is a clone of `target` and we have narrowed `target` in this block we can cast to the same type.
|
|
32
31
|
output[key] = deepmerge(target[key], source[key], options);
|
|
33
32
|
} else if (options.clone) {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
1
|
// This module is based on https://github.com/airbnb/prop-types-exact repository.
|
|
3
2
|
// However, in order to reduce the number of dependencies and to remove some extra safe checks
|
|
4
3
|
// the module was forked.
|
|
@@ -8,7 +7,8 @@ export default function exactProp(propTypes) {
|
|
|
8
7
|
if (process.env.NODE_ENV === 'production') {
|
|
9
8
|
return propTypes;
|
|
10
9
|
}
|
|
11
|
-
return
|
|
10
|
+
return {
|
|
11
|
+
...propTypes,
|
|
12
12
|
[specialProperty]: props => {
|
|
13
13
|
const unsupportedProps = Object.keys(props).filter(prop => !propTypes.hasOwnProperty(prop));
|
|
14
14
|
if (unsupportedProps.length > 0) {
|
|
@@ -16,5 +16,5 @@ export default function exactProp(propTypes) {
|
|
|
16
16
|
}
|
|
17
17
|
return null;
|
|
18
18
|
}
|
|
19
|
-
}
|
|
19
|
+
};
|
|
20
20
|
}
|
package/modern/index.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
1
|
export default function requirePropFactory(componentNameInError, Component) {
|
|
3
2
|
if (process.env.NODE_ENV === 'production') {
|
|
4
3
|
return () => null;
|
|
5
4
|
}
|
|
6
5
|
|
|
7
6
|
// eslint-disable-next-line react/forbid-foreign-prop-types
|
|
8
|
-
const prevPropTypes = Component ?
|
|
7
|
+
const prevPropTypes = Component ? {
|
|
8
|
+
...Component.propTypes
|
|
9
|
+
} : null;
|
|
9
10
|
const requireProp = requiredProp => (props, propName, componentName, location, propFullName, ...args) => {
|
|
10
11
|
const propFullNameSafe = propFullName || propName;
|
|
11
12
|
const defaultTypeChecker = prevPropTypes?.[propFullNameSafe];
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
1
|
/**
|
|
3
2
|
* Add keys, values of `defaultProps` that does not exist in `props`
|
|
4
3
|
* @param {object} defaultProps
|
|
@@ -6,10 +5,15 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
6
5
|
* @returns {object} resolved props
|
|
7
6
|
*/
|
|
8
7
|
export default function resolveProps(defaultProps, props) {
|
|
9
|
-
const output =
|
|
8
|
+
const output = {
|
|
9
|
+
...props
|
|
10
|
+
};
|
|
10
11
|
Object.keys(defaultProps).forEach(propName => {
|
|
11
12
|
if (propName.toString().match(/^(components|slots)$/)) {
|
|
12
|
-
output[propName] =
|
|
13
|
+
output[propName] = {
|
|
14
|
+
...defaultProps[propName],
|
|
15
|
+
...output[propName]
|
|
16
|
+
};
|
|
13
17
|
} else if (propName.toString().match(/^(componentsProps|slotProps)$/)) {
|
|
14
18
|
const defaultSlotProps = defaultProps[propName] || {};
|
|
15
19
|
const slotProps = props[propName];
|
|
@@ -21,7 +25,9 @@ export default function resolveProps(defaultProps, props) {
|
|
|
21
25
|
// Reduce the iteration if the default slot props is empty
|
|
22
26
|
output[propName] = slotProps;
|
|
23
27
|
} else {
|
|
24
|
-
output[propName] =
|
|
28
|
+
output[propName] = {
|
|
29
|
+
...slotProps
|
|
30
|
+
};
|
|
25
31
|
Object.keys(defaultSlotProps).forEach(slotPropName => {
|
|
26
32
|
output[propName][slotPropName] = resolveProps(defaultSlotProps[slotPropName], slotProps[slotPropName]);
|
|
27
33
|
});
|
|
@@ -3,21 +3,11 @@
|
|
|
3
3
|
import useLazyRef from '../useLazyRef/useLazyRef';
|
|
4
4
|
import useOnMount from '../useOnMount/useOnMount';
|
|
5
5
|
export class Timeout {
|
|
6
|
-
constructor() {
|
|
7
|
-
this.currentId = null;
|
|
8
|
-
this.clear = () => {
|
|
9
|
-
if (this.currentId !== null) {
|
|
10
|
-
clearTimeout(this.currentId);
|
|
11
|
-
this.currentId = null;
|
|
12
|
-
}
|
|
13
|
-
};
|
|
14
|
-
this.disposeEffect = () => {
|
|
15
|
-
return this.clear;
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
6
|
static create() {
|
|
19
7
|
return new Timeout();
|
|
20
8
|
}
|
|
9
|
+
currentId = null;
|
|
10
|
+
|
|
21
11
|
/**
|
|
22
12
|
* Executes `fn` after `delay`, clearing any previously scheduled call.
|
|
23
13
|
*/
|
|
@@ -28,6 +18,15 @@ export class Timeout {
|
|
|
28
18
|
fn();
|
|
29
19
|
}, delay);
|
|
30
20
|
}
|
|
21
|
+
clear = () => {
|
|
22
|
+
if (this.currentId !== null) {
|
|
23
|
+
clearTimeout(this.currentId);
|
|
24
|
+
this.currentId = null;
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
disposeEffect = () => {
|
|
28
|
+
return this.clear;
|
|
29
|
+
};
|
|
31
30
|
}
|
|
32
31
|
export default function useTimeout() {
|
|
33
32
|
const timeout = useLazyRef(Timeout.create).current;
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
6
|
exports.default = deepmerge;
|
|
8
7
|
exports.isPlainObject = isPlainObject;
|
|
9
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
8
|
// https://github.com/sindresorhus/is-plain-obj/blob/main/index.js
|
|
11
9
|
function isPlainObject(item) {
|
|
12
10
|
if (typeof item !== 'object' || item === null) {
|
|
@@ -28,14 +26,14 @@ function deepClone(source) {
|
|
|
28
26
|
function deepmerge(target, source, options = {
|
|
29
27
|
clone: true
|
|
30
28
|
}) {
|
|
31
|
-
const output = options.clone ?
|
|
29
|
+
const output = options.clone ? {
|
|
30
|
+
...target
|
|
31
|
+
} : target;
|
|
32
32
|
if (isPlainObject(target) && isPlainObject(source)) {
|
|
33
33
|
Object.keys(source).forEach(key => {
|
|
34
|
+
if (isPlainObject(source[key]) &&
|
|
34
35
|
// Avoid prototype pollution
|
|
35
|
-
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
if (isPlainObject(source[key]) && key in target && isPlainObject(target[key])) {
|
|
36
|
+
Object.prototype.hasOwnProperty.call(target, key) && isPlainObject(target[key])) {
|
|
39
37
|
// Since `output` is a clone of `target` and we have narrowed `target` in this block we can cast to the same type.
|
|
40
38
|
output[key] = deepmerge(target[key], source[key], options);
|
|
41
39
|
} else if (options.clone) {
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
6
|
exports.default = exactProp;
|
|
8
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
7
|
// This module is based on https://github.com/airbnb/prop-types-exact repository.
|
|
10
8
|
// However, in order to reduce the number of dependencies and to remove some extra safe checks
|
|
11
9
|
// the module was forked.
|
|
@@ -15,7 +13,8 @@ function exactProp(propTypes) {
|
|
|
15
13
|
if (process.env.NODE_ENV === 'production') {
|
|
16
14
|
return propTypes;
|
|
17
15
|
}
|
|
18
|
-
return
|
|
16
|
+
return {
|
|
17
|
+
...propTypes,
|
|
19
18
|
[specialProperty]: props => {
|
|
20
19
|
const unsupportedProps = Object.keys(props).filter(prop => !propTypes.hasOwnProperty(prop));
|
|
21
20
|
if (unsupportedProps.length > 0) {
|
|
@@ -23,5 +22,5 @@ function exactProp(propTypes) {
|
|
|
23
22
|
}
|
|
24
23
|
return null;
|
|
25
24
|
}
|
|
26
|
-
}
|
|
25
|
+
};
|
|
27
26
|
}
|
package/node/index.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
6
|
exports.default = requirePropFactory;
|
|
8
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
7
|
function requirePropFactory(componentNameInError, Component) {
|
|
10
8
|
if (process.env.NODE_ENV === 'production') {
|
|
11
9
|
return () => null;
|
|
12
10
|
}
|
|
13
11
|
|
|
14
12
|
// eslint-disable-next-line react/forbid-foreign-prop-types
|
|
15
|
-
const prevPropTypes = Component ?
|
|
13
|
+
const prevPropTypes = Component ? {
|
|
14
|
+
...Component.propTypes
|
|
15
|
+
} : null;
|
|
16
16
|
const requireProp = requiredProp => (props, propName, componentName, location, propFullName, ...args) => {
|
|
17
17
|
const propFullNameSafe = propFullName || propName;
|
|
18
18
|
const defaultTypeChecker = prevPropTypes == null ? void 0 : prevPropTypes[propFullNameSafe];
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
6
|
exports.default = resolveProps;
|
|
8
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
7
|
/**
|
|
10
8
|
* Add keys, values of `defaultProps` that does not exist in `props`
|
|
11
9
|
* @param {object} defaultProps
|
|
@@ -13,10 +11,15 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
13
11
|
* @returns {object} resolved props
|
|
14
12
|
*/
|
|
15
13
|
function resolveProps(defaultProps, props) {
|
|
16
|
-
const output =
|
|
14
|
+
const output = {
|
|
15
|
+
...props
|
|
16
|
+
};
|
|
17
17
|
Object.keys(defaultProps).forEach(propName => {
|
|
18
18
|
if (propName.toString().match(/^(components|slots)$/)) {
|
|
19
|
-
output[propName] =
|
|
19
|
+
output[propName] = {
|
|
20
|
+
...defaultProps[propName],
|
|
21
|
+
...output[propName]
|
|
22
|
+
};
|
|
20
23
|
} else if (propName.toString().match(/^(componentsProps|slotProps)$/)) {
|
|
21
24
|
const defaultSlotProps = defaultProps[propName] || {};
|
|
22
25
|
const slotProps = props[propName];
|
|
@@ -28,7 +31,9 @@ function resolveProps(defaultProps, props) {
|
|
|
28
31
|
// Reduce the iteration if the default slot props is empty
|
|
29
32
|
output[propName] = slotProps;
|
|
30
33
|
} else {
|
|
31
|
-
output[propName] =
|
|
34
|
+
output[propName] = {
|
|
35
|
+
...slotProps
|
|
36
|
+
};
|
|
32
37
|
Object.keys(defaultSlotProps).forEach(slotPropName => {
|
|
33
38
|
output[propName][slotPropName] = resolveProps(defaultSlotProps[slotPropName], slotProps[slotPropName]);
|
|
34
39
|
});
|
|
@@ -10,21 +10,11 @@ exports.default = useTimeout;
|
|
|
10
10
|
var _useLazyRef = _interopRequireDefault(require("../useLazyRef/useLazyRef"));
|
|
11
11
|
var _useOnMount = _interopRequireDefault(require("../useOnMount/useOnMount"));
|
|
12
12
|
class Timeout {
|
|
13
|
-
constructor() {
|
|
14
|
-
this.currentId = null;
|
|
15
|
-
this.clear = () => {
|
|
16
|
-
if (this.currentId !== null) {
|
|
17
|
-
clearTimeout(this.currentId);
|
|
18
|
-
this.currentId = null;
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
this.disposeEffect = () => {
|
|
22
|
-
return this.clear;
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
13
|
static create() {
|
|
26
14
|
return new Timeout();
|
|
27
15
|
}
|
|
16
|
+
currentId = null;
|
|
17
|
+
|
|
28
18
|
/**
|
|
29
19
|
* Executes `fn` after `delay`, clearing any previously scheduled call.
|
|
30
20
|
*/
|
|
@@ -35,6 +25,15 @@ class Timeout {
|
|
|
35
25
|
fn();
|
|
36
26
|
}, delay);
|
|
37
27
|
}
|
|
28
|
+
clear = () => {
|
|
29
|
+
if (this.currentId !== null) {
|
|
30
|
+
clearTimeout(this.currentId);
|
|
31
|
+
this.currentId = null;
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
disposeEffect = () => {
|
|
35
|
+
return this.clear;
|
|
36
|
+
};
|
|
38
37
|
}
|
|
39
38
|
exports.Timeout = Timeout;
|
|
40
39
|
function useTimeout() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/utils",
|
|
3
|
-
"version": "6.0.0-alpha.
|
|
3
|
+
"version": "6.0.0-alpha.9",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "MUI Team",
|
|
6
6
|
"description": "Utility functions for React components.",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"url": "https://opencollective.com/mui-org"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@babel/runtime": "^7.24.
|
|
29
|
+
"@babel/runtime": "^7.24.6",
|
|
30
30
|
"@types/prop-types": "^15.7.12",
|
|
31
31
|
"prop-types": "^15.8.1",
|
|
32
32
|
"react-is": "^18.2.0"
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
1
|
export default function requirePropFactory(componentNameInError, Component) {
|
|
3
2
|
if (process.env.NODE_ENV === 'production') {
|
|
4
3
|
return () => null;
|
|
5
4
|
}
|
|
6
5
|
|
|
7
6
|
// eslint-disable-next-line react/forbid-foreign-prop-types
|
|
8
|
-
const prevPropTypes = Component ?
|
|
7
|
+
const prevPropTypes = Component ? {
|
|
8
|
+
...Component.propTypes
|
|
9
|
+
} : null;
|
|
9
10
|
const requireProp = requiredProp => (props, propName, componentName, location, propFullName, ...args) => {
|
|
10
11
|
const propFullNameSafe = propFullName || propName;
|
|
11
12
|
const defaultTypeChecker = prevPropTypes?.[propFullNameSafe];
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
1
|
/**
|
|
3
2
|
* Add keys, values of `defaultProps` that does not exist in `props`
|
|
4
3
|
* @param {object} defaultProps
|
|
@@ -6,10 +5,15 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
6
5
|
* @returns {object} resolved props
|
|
7
6
|
*/
|
|
8
7
|
export default function resolveProps(defaultProps, props) {
|
|
9
|
-
const output =
|
|
8
|
+
const output = {
|
|
9
|
+
...props
|
|
10
|
+
};
|
|
10
11
|
Object.keys(defaultProps).forEach(propName => {
|
|
11
12
|
if (propName.toString().match(/^(components|slots)$/)) {
|
|
12
|
-
output[propName] =
|
|
13
|
+
output[propName] = {
|
|
14
|
+
...defaultProps[propName],
|
|
15
|
+
...output[propName]
|
|
16
|
+
};
|
|
13
17
|
} else if (propName.toString().match(/^(componentsProps|slotProps)$/)) {
|
|
14
18
|
const defaultSlotProps = defaultProps[propName] || {};
|
|
15
19
|
const slotProps = props[propName];
|
|
@@ -21,7 +25,9 @@ export default function resolveProps(defaultProps, props) {
|
|
|
21
25
|
// Reduce the iteration if the default slot props is empty
|
|
22
26
|
output[propName] = slotProps;
|
|
23
27
|
} else {
|
|
24
|
-
output[propName] =
|
|
28
|
+
output[propName] = {
|
|
29
|
+
...slotProps
|
|
30
|
+
};
|
|
25
31
|
Object.keys(defaultSlotProps).forEach(slotPropName => {
|
|
26
32
|
output[propName][slotPropName] = resolveProps(defaultSlotProps[slotPropName], slotProps[slotPropName]);
|
|
27
33
|
});
|
package/useTimeout/useTimeout.js
CHANGED
|
@@ -3,21 +3,11 @@
|
|
|
3
3
|
import useLazyRef from '../useLazyRef/useLazyRef';
|
|
4
4
|
import useOnMount from '../useOnMount/useOnMount';
|
|
5
5
|
export class Timeout {
|
|
6
|
-
constructor() {
|
|
7
|
-
this.currentId = null;
|
|
8
|
-
this.clear = () => {
|
|
9
|
-
if (this.currentId !== null) {
|
|
10
|
-
clearTimeout(this.currentId);
|
|
11
|
-
this.currentId = null;
|
|
12
|
-
}
|
|
13
|
-
};
|
|
14
|
-
this.disposeEffect = () => {
|
|
15
|
-
return this.clear;
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
6
|
static create() {
|
|
19
7
|
return new Timeout();
|
|
20
8
|
}
|
|
9
|
+
currentId = null;
|
|
10
|
+
|
|
21
11
|
/**
|
|
22
12
|
* Executes `fn` after `delay`, clearing any previously scheduled call.
|
|
23
13
|
*/
|
|
@@ -28,6 +18,15 @@ export class Timeout {
|
|
|
28
18
|
fn();
|
|
29
19
|
}, delay);
|
|
30
20
|
}
|
|
21
|
+
clear = () => {
|
|
22
|
+
if (this.currentId !== null) {
|
|
23
|
+
clearTimeout(this.currentId);
|
|
24
|
+
this.currentId = null;
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
disposeEffect = () => {
|
|
28
|
+
return this.clear;
|
|
29
|
+
};
|
|
31
30
|
}
|
|
32
31
|
export default function useTimeout() {
|
|
33
32
|
const timeout = useLazyRef(Timeout.create).current;
|