@mui/x-internals 8.0.0-beta.2 → 8.0.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 +423 -96
- package/esm/rafThrottle/index.d.ts +1 -0
- package/esm/rafThrottle/index.js +1 -0
- package/esm/rafThrottle/rafThrottle.d.ts +16 -0
- package/esm/rafThrottle/rafThrottle.js +33 -0
- package/esm/types/MuiEvent.d.ts +5 -0
- package/esm/types/index.d.ts +1 -0
- package/esm/types/index.js +1 -0
- package/package.json +3 -11
- package/rafThrottle/index.d.ts +1 -0
- package/rafThrottle/index.js +16 -0
- package/rafThrottle/rafThrottle.d.ts +16 -0
- package/rafThrottle/rafThrottle.js +39 -0
- package/types/MuiEvent.d.ts +5 -0
- package/types/MuiEvent.js +5 -0
- package/types/index.d.ts +1 -0
- package/types/index.js +11 -0
- package/modern/EventManager/EventManager.d.ts +0 -29
- package/modern/EventManager/EventManager.js +0 -69
- package/modern/EventManager/index.d.ts +0 -2
- package/modern/EventManager/index.js +0 -1
- package/modern/fastArrayCompare/fastArrayCompare.d.ts +0 -12
- package/modern/fastArrayCompare/fastArrayCompare.js +0 -31
- package/modern/fastArrayCompare/index.d.ts +0 -1
- package/modern/fastArrayCompare/index.js +0 -1
- package/modern/fastMemo/fastMemo.d.ts +0 -1
- package/modern/fastMemo/fastMemo.js +0 -5
- package/modern/fastMemo/index.d.ts +0 -1
- package/modern/fastMemo/index.js +0 -1
- package/modern/fastObjectShallowCompare/fastObjectShallowCompare.d.ts +0 -5
- package/modern/fastObjectShallowCompare/fastObjectShallowCompare.js +0 -33
- package/modern/fastObjectShallowCompare/index.d.ts +0 -1
- package/modern/fastObjectShallowCompare/index.js +0 -1
- package/modern/forwardRef/forwardRef.d.ts +0 -4
- package/modern/forwardRef/forwardRef.js +0 -15
- package/modern/forwardRef/index.d.ts +0 -1
- package/modern/forwardRef/index.js +0 -1
- package/modern/hash/hash.d.ts +0 -6
- package/modern/hash/hash.js +0 -61
- package/modern/hash/index.d.ts +0 -1
- package/modern/hash/index.js +0 -1
- package/modern/isDeepEqual/index.d.ts +0 -1
- package/modern/isDeepEqual/index.js +0 -1
- package/modern/isDeepEqual/isDeepEqual.d.ts +0 -29
- package/modern/isDeepEqual/isDeepEqual.js +0 -124
- package/modern/isObjectEmpty/index.d.ts +0 -1
- package/modern/isObjectEmpty/index.js +0 -1
- package/modern/isObjectEmpty/isObjectEmpty.d.ts +0 -1
- package/modern/isObjectEmpty/isObjectEmpty.js +0 -7
- package/modern/package.json +0 -1
- package/modern/reactMajor/index.d.ts +0 -2
- package/modern/reactMajor/index.js +0 -2
- package/modern/slots/index.d.ts +0 -2
- package/modern/throttle/index.d.ts +0 -1
- package/modern/throttle/index.js +0 -1
- package/modern/throttle/throttle.d.ts +0 -4
- package/modern/throttle/throttle.js +0 -19
- package/modern/types/AppendKeys.d.ts +0 -11
- package/modern/types/AppendKeys.js +0 -1
- package/modern/types/DefaultizedProps.d.ts +0 -8
- package/modern/types/DefaultizedProps.js +0 -1
- package/modern/types/MakeOptional.d.ts +0 -7
- package/modern/types/MakeOptional.js +0 -1
- package/modern/types/MakeRequired.d.ts +0 -7
- package/modern/types/MakeRequired.js +0 -1
- package/modern/types/PrependKeys.d.ts +0 -11
- package/modern/types/PrependKeys.js +0 -1
- package/modern/types/RefObject.d.ts +0 -8
- package/modern/types/RefObject.js +0 -1
- package/modern/types/SlotComponentPropsFromProps.d.ts +0 -8
- package/modern/types/SlotComponentPropsFromProps.js +0 -1
- package/modern/types/index.d.ts +0 -7
- package/modern/types/index.js +0 -7
- package/modern/useResizeObserver/index.d.ts +0 -1
- package/modern/useResizeObserver/index.js +0 -1
- package/modern/useResizeObserver/useResizeObserver.d.ts +0 -2
- package/modern/useResizeObserver/useResizeObserver.js +0 -36
- package/modern/warning/index.d.ts +0 -1
- package/modern/warning/index.js +0 -1
- package/modern/warning/warning.d.ts +0 -13
- package/modern/warning/warning.js +0 -30
- package/tsconfig.build.tsbuildinfo +0 -1
- /package/{modern/slots/index.js → esm/types/MuiEvent.js} +0 -0
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Based on `fast-deep-equal`
|
|
3
|
-
*
|
|
4
|
-
* MIT License
|
|
5
|
-
*
|
|
6
|
-
* Copyright (c) 2017 Evgeny Poberezkin
|
|
7
|
-
*
|
|
8
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
9
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
10
|
-
* in the Software without restriction, including without limitation the rights
|
|
11
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
12
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
13
|
-
* furnished to do so, subject to the following conditions:
|
|
14
|
-
*
|
|
15
|
-
* The above copyright notice and this permission notice shall be included in all
|
|
16
|
-
* copies or substantial portions of the Software.
|
|
17
|
-
*
|
|
18
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
19
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
20
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
21
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
22
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
23
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
24
|
-
* SOFTWARE.
|
|
25
|
-
*/
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Check if two values are deeply equal.
|
|
29
|
-
*/
|
|
30
|
-
|
|
31
|
-
export function isDeepEqual(a, b) {
|
|
32
|
-
if (a === b) {
|
|
33
|
-
return true;
|
|
34
|
-
}
|
|
35
|
-
if (a && b && typeof a === 'object' && typeof b === 'object') {
|
|
36
|
-
if (a.constructor !== b.constructor) {
|
|
37
|
-
return false;
|
|
38
|
-
}
|
|
39
|
-
if (Array.isArray(a)) {
|
|
40
|
-
const length = a.length;
|
|
41
|
-
if (length !== b.length) {
|
|
42
|
-
return false;
|
|
43
|
-
}
|
|
44
|
-
for (let i = 0; i < length; i += 1) {
|
|
45
|
-
if (!isDeepEqual(a[i], b[i])) {
|
|
46
|
-
return false;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
return true;
|
|
50
|
-
}
|
|
51
|
-
if (a instanceof Map && b instanceof Map) {
|
|
52
|
-
if (a.size !== b.size) {
|
|
53
|
-
return false;
|
|
54
|
-
}
|
|
55
|
-
const entriesA = Array.from(a.entries());
|
|
56
|
-
for (let i = 0; i < entriesA.length; i += 1) {
|
|
57
|
-
if (!b.has(entriesA[i][0])) {
|
|
58
|
-
return false;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
for (let i = 0; i < entriesA.length; i += 1) {
|
|
62
|
-
const entryA = entriesA[i];
|
|
63
|
-
if (!isDeepEqual(entryA[1], b.get(entryA[0]))) {
|
|
64
|
-
return false;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
return true;
|
|
68
|
-
}
|
|
69
|
-
if (a instanceof Set && b instanceof Set) {
|
|
70
|
-
if (a.size !== b.size) {
|
|
71
|
-
return false;
|
|
72
|
-
}
|
|
73
|
-
const entries = Array.from(a.entries());
|
|
74
|
-
for (let i = 0; i < entries.length; i += 1) {
|
|
75
|
-
if (!b.has(entries[i][0])) {
|
|
76
|
-
return false;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
return true;
|
|
80
|
-
}
|
|
81
|
-
if (ArrayBuffer.isView(a) && ArrayBuffer.isView(b)) {
|
|
82
|
-
const length = a.length;
|
|
83
|
-
if (length !== b.length) {
|
|
84
|
-
return false;
|
|
85
|
-
}
|
|
86
|
-
for (let i = 0; i < length; i += 1) {
|
|
87
|
-
if (a[i] !== b[i]) {
|
|
88
|
-
return false;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
return true;
|
|
92
|
-
}
|
|
93
|
-
if (a.constructor === RegExp) {
|
|
94
|
-
return a.source === b.source && a.flags === b.flags;
|
|
95
|
-
}
|
|
96
|
-
if (a.valueOf !== Object.prototype.valueOf) {
|
|
97
|
-
return a.valueOf() === b.valueOf();
|
|
98
|
-
}
|
|
99
|
-
if (a.toString !== Object.prototype.toString) {
|
|
100
|
-
return a.toString() === b.toString();
|
|
101
|
-
}
|
|
102
|
-
const keys = Object.keys(a);
|
|
103
|
-
const length = keys.length;
|
|
104
|
-
if (length !== Object.keys(b).length) {
|
|
105
|
-
return false;
|
|
106
|
-
}
|
|
107
|
-
for (let i = 0; i < length; i += 1) {
|
|
108
|
-
if (!Object.prototype.hasOwnProperty.call(b, keys[i])) {
|
|
109
|
-
return false;
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
for (let i = 0; i < length; i += 1) {
|
|
113
|
-
const key = keys[i];
|
|
114
|
-
if (!isDeepEqual(a[key], b[key])) {
|
|
115
|
-
return false;
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
return true;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
// true if both NaN, false otherwise
|
|
122
|
-
// eslint-disable-next-line no-self-compare
|
|
123
|
-
return a !== a && b !== b;
|
|
124
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { isObjectEmpty } from "./isObjectEmpty.js";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { isObjectEmpty } from "./isObjectEmpty.js";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function isObjectEmpty(object: any): boolean;
|
package/modern/package.json
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"type":"module","sideEffects":false}
|
package/modern/slots/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { throttle } from "./throttle.js";
|
package/modern/throttle/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { throttle } from "./throttle.js";
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
export function throttle(func, wait = 166) {
|
|
2
|
-
let timeout;
|
|
3
|
-
let lastArgs;
|
|
4
|
-
const later = () => {
|
|
5
|
-
timeout = undefined;
|
|
6
|
-
func(...lastArgs);
|
|
7
|
-
};
|
|
8
|
-
function throttled(...args) {
|
|
9
|
-
lastArgs = args;
|
|
10
|
-
if (timeout === undefined) {
|
|
11
|
-
timeout = setTimeout(later, wait);
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
throttled.clear = () => {
|
|
15
|
-
clearTimeout(timeout);
|
|
16
|
-
timeout = undefined;
|
|
17
|
-
};
|
|
18
|
-
return throttled;
|
|
19
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
type CapitalizeFirstLetter<S extends string> = S extends `${infer First}${infer Rest}` ? `${Uppercase<First>}${Rest}` : S;
|
|
2
|
-
/**
|
|
3
|
-
* Append string P to all keys in T.
|
|
4
|
-
* If K is provided, only append P to keys in K.
|
|
5
|
-
*
|
|
6
|
-
* @template T - The type to append keys to.
|
|
7
|
-
* @template P - The string to append.
|
|
8
|
-
* @template K - The keys to append P to.
|
|
9
|
-
*/
|
|
10
|
-
export type AppendKeys<T, P extends string, K extends string = string> = { [key in keyof T as key extends K ? `${key}${CapitalizeFirstLetter<P>}` : key]: T[key] };
|
|
11
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Combines a type with required and additional properties.
|
|
3
|
-
*
|
|
4
|
-
* @template P - The original type.
|
|
5
|
-
* @template RequiredProps - The keys to make required.
|
|
6
|
-
* @template AdditionalProps - Additional properties to include.
|
|
7
|
-
*/
|
|
8
|
-
export type DefaultizedProps<P extends {}, RequiredProps extends keyof P, AdditionalProps extends {} = {}> = Omit<P, RequiredProps | keyof AdditionalProps> & Required<Pick<P, RequiredProps>> & AdditionalProps;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
type CapitalizeFirstLetter<S extends string> = S extends `${infer First}${infer Rest}` ? `${Uppercase<First>}${Rest}` : S;
|
|
2
|
-
/**
|
|
3
|
-
* Prepend string P to all keys in T.
|
|
4
|
-
* If K is provided, only prepend P to keys in K.
|
|
5
|
-
*
|
|
6
|
-
* @template T - The type to prepend keys to.
|
|
7
|
-
* @template P - The string to prepend.
|
|
8
|
-
* @template K - The keys to prepend P to.
|
|
9
|
-
*/
|
|
10
|
-
export type PrependKeys<T, P extends string, K extends string = string> = { [key in keyof T as key extends K ? `${P}${CapitalizeFirstLetter<key>}` : key]: T[key] };
|
|
11
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
/**
|
|
3
|
-
* Defines the reference as `React.RefObject` for React 19 and up and `React.MutableRefObject` for React 18 and below.
|
|
4
|
-
* Can be used to maintain the types between the React versions while migrating away from `React.MutableRefObject` in the codebase.
|
|
5
|
-
*
|
|
6
|
-
* @template T - The type to make the reference object from.
|
|
7
|
-
*/
|
|
8
|
-
export type RefObject<T> = typeof React.useRef extends (() => any) ? React.MutableRefObject<T> : React.RefObject<T>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Defines the props for a slot component, which can be either partial props with overrides or a function returning such props.
|
|
3
|
-
*
|
|
4
|
-
* @template TProps - The original props type.
|
|
5
|
-
* @template TOverrides - The overrides type.
|
|
6
|
-
* @template TOwnerState - The owner state type.
|
|
7
|
-
*/
|
|
8
|
-
export type SlotComponentPropsFromProps<TProps extends {}, TOverrides extends {}, TOwnerState extends {}> = (Partial<TProps> & TOverrides) | ((ownerState: TOwnerState) => Partial<TProps> & TOverrides);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/modern/types/index.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export * from "./AppendKeys.js";
|
|
2
|
-
export * from "./DefaultizedProps.js";
|
|
3
|
-
export * from "./MakeOptional.js";
|
|
4
|
-
export * from "./MakeRequired.js";
|
|
5
|
-
export * from "./PrependKeys.js";
|
|
6
|
-
export * from "./RefObject.js";
|
|
7
|
-
export * from "./SlotComponentPropsFromProps.js";
|
package/modern/types/index.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export * from "./AppendKeys.js";
|
|
2
|
-
export * from "./DefaultizedProps.js";
|
|
3
|
-
export * from "./MakeOptional.js";
|
|
4
|
-
export * from "./MakeRequired.js";
|
|
5
|
-
export * from "./PrependKeys.js";
|
|
6
|
-
export * from "./RefObject.js";
|
|
7
|
-
export * from "./SlotComponentPropsFromProps.js";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { useResizeObserver } from "./useResizeObserver.js";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { useResizeObserver } from "./useResizeObserver.js";
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { unstable_useEnhancedEffect as useEnhancedEffect } from '@mui/utils';
|
|
3
|
-
const isDevEnvironment = process.env.NODE_ENV === 'development' || process.env.NODE_ENV === 'test';
|
|
4
|
-
const noop = () => {};
|
|
5
|
-
export function useResizeObserver(ref, fn, enabled) {
|
|
6
|
-
const fnRef = React.useRef(null);
|
|
7
|
-
fnRef.current = fn;
|
|
8
|
-
useEnhancedEffect(() => {
|
|
9
|
-
if (enabled === false || typeof ResizeObserver === 'undefined') {
|
|
10
|
-
return noop;
|
|
11
|
-
}
|
|
12
|
-
let frameID = 0;
|
|
13
|
-
const target = ref.current;
|
|
14
|
-
const observer = new ResizeObserver(entries => {
|
|
15
|
-
// See https://github.com/mui/mui-x/issues/8733
|
|
16
|
-
// In dev, we avoid the React warning by moving the task to the next frame.
|
|
17
|
-
// In prod, we want the task to run in the same frame as to avoid tear.
|
|
18
|
-
if (isDevEnvironment) {
|
|
19
|
-
frameID = requestAnimationFrame(() => {
|
|
20
|
-
fnRef.current(entries);
|
|
21
|
-
});
|
|
22
|
-
} else {
|
|
23
|
-
fnRef.current(entries);
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
if (target) {
|
|
27
|
-
observer.observe(target);
|
|
28
|
-
}
|
|
29
|
-
return () => {
|
|
30
|
-
if (frameID) {
|
|
31
|
-
cancelAnimationFrame(frameID);
|
|
32
|
-
}
|
|
33
|
-
observer.disconnect();
|
|
34
|
-
};
|
|
35
|
-
}, [ref, enabled]);
|
|
36
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { warnOnce, clearWarningsCache } from "./warning.js";
|
package/modern/warning/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { warnOnce, clearWarningsCache } from "./warning.js";
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Logs a message to the console on development mode. The warning will only be logged once.
|
|
3
|
-
*
|
|
4
|
-
* The message is the log's cache key. Two identical messages will only be logged once.
|
|
5
|
-
*
|
|
6
|
-
* This function is a no-op in production.
|
|
7
|
-
*
|
|
8
|
-
* @param message the message to log
|
|
9
|
-
* @param gravity the gravity of the warning. Defaults to `'warning'`.
|
|
10
|
-
* @returns
|
|
11
|
-
*/
|
|
12
|
-
export declare function warnOnce(message: string | string[], gravity?: 'warning' | 'error'): void;
|
|
13
|
-
export declare function clearWarningsCache(): void;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
const warnedOnceCache = new Set();
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Logs a message to the console on development mode. The warning will only be logged once.
|
|
5
|
-
*
|
|
6
|
-
* The message is the log's cache key. Two identical messages will only be logged once.
|
|
7
|
-
*
|
|
8
|
-
* This function is a no-op in production.
|
|
9
|
-
*
|
|
10
|
-
* @param message the message to log
|
|
11
|
-
* @param gravity the gravity of the warning. Defaults to `'warning'`.
|
|
12
|
-
* @returns
|
|
13
|
-
*/
|
|
14
|
-
export function warnOnce(message, gravity = 'warning') {
|
|
15
|
-
if (process.env.NODE_ENV === 'production') {
|
|
16
|
-
return;
|
|
17
|
-
}
|
|
18
|
-
const cleanMessage = Array.isArray(message) ? message.join('\n') : message;
|
|
19
|
-
if (!warnedOnceCache.has(cleanMessage)) {
|
|
20
|
-
warnedOnceCache.add(cleanMessage);
|
|
21
|
-
if (gravity === 'error') {
|
|
22
|
-
console.error(cleanMessage);
|
|
23
|
-
} else {
|
|
24
|
-
console.warn(cleanMessage);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
export function clearWarningsCache() {
|
|
29
|
-
warnedOnceCache.clear();
|
|
30
|
-
}
|