@mui/x-internals 8.0.0-beta.3 → 8.2.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.
Files changed (101) hide show
  1. package/CHANGELOG.md +512 -101
  2. package/EventManager/index.d.ts +1 -1
  3. package/esm/EventManager/index.d.ts +1 -1
  4. package/esm/export/index.d.ts +1 -0
  5. package/esm/export/index.js +1 -0
  6. package/esm/export/loadStyleSheets.d.ts +7 -0
  7. package/esm/export/loadStyleSheets.js +42 -0
  8. package/esm/hash/index.d.ts +2 -1
  9. package/esm/hash/index.js +2 -1
  10. package/esm/hash/stringify.d.ts +6 -0
  11. package/esm/hash/stringify.js +17 -0
  12. package/esm/rafThrottle/index.d.ts +1 -0
  13. package/esm/rafThrottle/index.js +1 -0
  14. package/esm/rafThrottle/rafThrottle.d.ts +16 -0
  15. package/esm/rafThrottle/rafThrottle.js +33 -0
  16. package/esm/types/MuiEvent.d.ts +5 -0
  17. package/esm/types/index.d.ts +1 -0
  18. package/esm/types/index.js +1 -0
  19. package/export/index.d.ts +1 -0
  20. package/export/index.js +12 -0
  21. package/export/loadStyleSheets.d.ts +7 -0
  22. package/export/loadStyleSheets.js +48 -0
  23. package/hash/index.d.ts +2 -1
  24. package/hash/index.js +11 -0
  25. package/hash/stringify.d.ts +6 -0
  26. package/hash/stringify.js +23 -0
  27. package/package.json +2 -10
  28. package/rafThrottle/index.d.ts +1 -0
  29. package/rafThrottle/index.js +16 -0
  30. package/rafThrottle/rafThrottle.d.ts +16 -0
  31. package/rafThrottle/rafThrottle.js +39 -0
  32. package/types/MuiEvent.d.ts +5 -0
  33. package/types/MuiEvent.js +5 -0
  34. package/types/index.d.ts +1 -0
  35. package/types/index.js +11 -0
  36. package/modern/EventManager/EventManager.d.ts +0 -29
  37. package/modern/EventManager/EventManager.js +0 -69
  38. package/modern/EventManager/index.d.ts +0 -2
  39. package/modern/EventManager/index.js +0 -1
  40. package/modern/fastArrayCompare/fastArrayCompare.d.ts +0 -12
  41. package/modern/fastArrayCompare/fastArrayCompare.js +0 -31
  42. package/modern/fastArrayCompare/index.d.ts +0 -1
  43. package/modern/fastArrayCompare/index.js +0 -1
  44. package/modern/fastMemo/fastMemo.d.ts +0 -1
  45. package/modern/fastMemo/fastMemo.js +0 -5
  46. package/modern/fastMemo/index.d.ts +0 -1
  47. package/modern/fastMemo/index.js +0 -1
  48. package/modern/fastObjectShallowCompare/fastObjectShallowCompare.d.ts +0 -5
  49. package/modern/fastObjectShallowCompare/fastObjectShallowCompare.js +0 -33
  50. package/modern/fastObjectShallowCompare/index.d.ts +0 -1
  51. package/modern/fastObjectShallowCompare/index.js +0 -1
  52. package/modern/forwardRef/forwardRef.d.ts +0 -4
  53. package/modern/forwardRef/forwardRef.js +0 -15
  54. package/modern/forwardRef/index.d.ts +0 -1
  55. package/modern/forwardRef/index.js +0 -1
  56. package/modern/hash/hash.d.ts +0 -6
  57. package/modern/hash/hash.js +0 -61
  58. package/modern/hash/index.d.ts +0 -1
  59. package/modern/hash/index.js +0 -1
  60. package/modern/isDeepEqual/index.d.ts +0 -1
  61. package/modern/isDeepEqual/index.js +0 -1
  62. package/modern/isDeepEqual/isDeepEqual.d.ts +0 -29
  63. package/modern/isDeepEqual/isDeepEqual.js +0 -124
  64. package/modern/isObjectEmpty/index.d.ts +0 -1
  65. package/modern/isObjectEmpty/index.js +0 -1
  66. package/modern/isObjectEmpty/isObjectEmpty.d.ts +0 -1
  67. package/modern/isObjectEmpty/isObjectEmpty.js +0 -7
  68. package/modern/package.json +0 -1
  69. package/modern/reactMajor/index.d.ts +0 -2
  70. package/modern/reactMajor/index.js +0 -2
  71. package/modern/slots/index.d.ts +0 -2
  72. package/modern/throttle/index.d.ts +0 -1
  73. package/modern/throttle/index.js +0 -1
  74. package/modern/throttle/throttle.d.ts +0 -4
  75. package/modern/throttle/throttle.js +0 -19
  76. package/modern/types/AppendKeys.d.ts +0 -11
  77. package/modern/types/AppendKeys.js +0 -1
  78. package/modern/types/DefaultizedProps.d.ts +0 -8
  79. package/modern/types/DefaultizedProps.js +0 -1
  80. package/modern/types/MakeOptional.d.ts +0 -7
  81. package/modern/types/MakeOptional.js +0 -1
  82. package/modern/types/MakeRequired.d.ts +0 -7
  83. package/modern/types/MakeRequired.js +0 -1
  84. package/modern/types/PrependKeys.d.ts +0 -11
  85. package/modern/types/PrependKeys.js +0 -1
  86. package/modern/types/RefObject.d.ts +0 -8
  87. package/modern/types/RefObject.js +0 -1
  88. package/modern/types/SlotComponentPropsFromProps.d.ts +0 -8
  89. package/modern/types/SlotComponentPropsFromProps.js +0 -1
  90. package/modern/types/index.d.ts +0 -7
  91. package/modern/types/index.js +0 -7
  92. package/modern/useResizeObserver/index.d.ts +0 -1
  93. package/modern/useResizeObserver/index.js +0 -1
  94. package/modern/useResizeObserver/useResizeObserver.d.ts +0 -2
  95. package/modern/useResizeObserver/useResizeObserver.js +0 -36
  96. package/modern/warning/index.d.ts +0 -1
  97. package/modern/warning/index.js +0 -1
  98. package/modern/warning/warning.d.ts +0 -13
  99. package/modern/warning/warning.js +0 -30
  100. package/tsconfig.build.tsbuildinfo +0 -1
  101. /package/{modern/slots/index.js → esm/types/MuiEvent.js} +0 -0
@@ -1,2 +1,2 @@
1
1
  export { EventManager } from "./EventManager.js";
2
- export type { EventListenerOptions } from './EventManager';
2
+ export type { EventListenerOptions } from "./EventManager.js";
@@ -1,2 +1,2 @@
1
1
  export { EventManager } from "./EventManager.js";
2
- export type { EventListenerOptions } from './EventManager';
2
+ export type { EventListenerOptions } from "./EventManager.js";
@@ -0,0 +1 @@
1
+ export { loadStyleSheets } from "./loadStyleSheets.js";
@@ -0,0 +1 @@
1
+ export { loadStyleSheets } from "./loadStyleSheets.js";
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Loads all stylesheets from the given root element into the document.
3
+ * @returns an array of promises that resolve when each stylesheet is loaded
4
+ * @param document Document to load stylesheets into
5
+ * @param root Document or ShadowRoot to load stylesheets from
6
+ */
7
+ export declare function loadStyleSheets(document: Document, root: Document | ShadowRoot): Promise<void>[];
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Loads all stylesheets from the given root element into the document.
3
+ * @returns an array of promises that resolve when each stylesheet is loaded
4
+ * @param document Document to load stylesheets into
5
+ * @param root Document or ShadowRoot to load stylesheets from
6
+ */
7
+ export function loadStyleSheets(document, root) {
8
+ const stylesheetLoadPromises = [];
9
+ const headStyleElements = root.querySelectorAll("style, link[rel='stylesheet']");
10
+ for (let i = 0; i < headStyleElements.length; i += 1) {
11
+ const node = headStyleElements[i];
12
+ if (node.tagName === 'STYLE') {
13
+ const newHeadStyleElements = document.createElement(node.tagName);
14
+ const sheet = node.sheet;
15
+ if (sheet) {
16
+ let styleCSS = '';
17
+ for (let j = 0; j < sheet.cssRules.length; j += 1) {
18
+ if (typeof sheet.cssRules[j].cssText === 'string') {
19
+ styleCSS += `${sheet.cssRules[j].cssText}\r\n`;
20
+ }
21
+ }
22
+ newHeadStyleElements.appendChild(document.createTextNode(styleCSS));
23
+ document.head.appendChild(newHeadStyleElements);
24
+ }
25
+ } else if (node.getAttribute('href')) {
26
+ // If `href` tag is empty, avoid loading these links
27
+
28
+ const newHeadStyleElements = document.createElement(node.tagName);
29
+ for (let j = 0; j < node.attributes.length; j += 1) {
30
+ const attr = node.attributes[j];
31
+ if (attr) {
32
+ newHeadStyleElements.setAttribute(attr.nodeName, attr.nodeValue || '');
33
+ }
34
+ }
35
+ stylesheetLoadPromises.push(new Promise(resolve => {
36
+ newHeadStyleElements.addEventListener('load', () => resolve());
37
+ }));
38
+ document.head.appendChild(newHeadStyleElements);
39
+ }
40
+ }
41
+ return stylesheetLoadPromises;
42
+ }
@@ -1 +1,2 @@
1
- export * from "./hash.js";
1
+ export * from "./hash.js";
2
+ export * from "./stringify.js";
package/esm/hash/index.js CHANGED
@@ -1 +1,2 @@
1
- export * from "./hash.js";
1
+ export * from "./hash.js";
2
+ export * from "./stringify.js";
@@ -0,0 +1,6 @@
1
+ /**
2
+ * A JSON.stringify that handles circular references safely.
3
+ * Fixes: https://github.com/mui/mui-x/issues/17521
4
+ * Source: https://www.30secondsofcode.org/js/s/stringify-circular-json/
5
+ */
6
+ export declare function stringify(input: object | string | number | null): string;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * A JSON.stringify that handles circular references safely.
3
+ * Fixes: https://github.com/mui/mui-x/issues/17521
4
+ * Source: https://www.30secondsofcode.org/js/s/stringify-circular-json/
5
+ */
6
+ export function stringify(input) {
7
+ const seen = new WeakSet();
8
+ return JSON.stringify(input, (_, v) => {
9
+ if (v !== null && typeof v === 'object') {
10
+ if (seen.has(v)) {
11
+ return null;
12
+ }
13
+ seen.add(v);
14
+ }
15
+ return v;
16
+ });
17
+ }
@@ -0,0 +1 @@
1
+ export * from "./rafThrottle.js";
@@ -0,0 +1 @@
1
+ export * from "./rafThrottle.js";
@@ -0,0 +1,16 @@
1
+ export interface Cancelable {
2
+ clear(): void;
3
+ }
4
+ /**
5
+ * Creates a throttled function that only invokes `fn` at most once per animation frame.
6
+ *
7
+ * @example
8
+ * ```ts
9
+ * const throttled = rafThrottle((value: number) => console.log(value));
10
+ * window.addEventListener('scroll', (e) => throttled(e.target.scrollTop));
11
+ * ```
12
+ *
13
+ * @param fn Callback function
14
+ * @return The `requestAnimationFrame` throttled function
15
+ */
16
+ export declare function rafThrottle<T extends (...args: any[]) => any>(fn: T): T & Cancelable;
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Creates a throttled function that only invokes `fn` at most once per animation frame.
3
+ *
4
+ * @example
5
+ * ```ts
6
+ * const throttled = rafThrottle((value: number) => console.log(value));
7
+ * window.addEventListener('scroll', (e) => throttled(e.target.scrollTop));
8
+ * ```
9
+ *
10
+ * @param fn Callback function
11
+ * @return The `requestAnimationFrame` throttled function
12
+ */
13
+ export function rafThrottle(fn) {
14
+ let lastArgs;
15
+ let rafRef;
16
+ const later = () => {
17
+ rafRef = null;
18
+ fn(...lastArgs);
19
+ };
20
+ function throttled(...args) {
21
+ lastArgs = args;
22
+ if (!rafRef) {
23
+ rafRef = requestAnimationFrame(later);
24
+ }
25
+ }
26
+ throttled.clear = () => {
27
+ if (rafRef) {
28
+ cancelAnimationFrame(rafRef);
29
+ rafRef = null;
30
+ }
31
+ };
32
+ return throttled;
33
+ }
@@ -0,0 +1,5 @@
1
+ import * as React from 'react';
2
+ export type MuiBaseEvent = React.SyntheticEvent<HTMLElement> | DocumentEventMap[keyof DocumentEventMap] | {};
3
+ export type MuiEvent<E extends MuiBaseEvent = MuiBaseEvent> = E & {
4
+ defaultMuiPrevented?: boolean;
5
+ };
@@ -2,6 +2,7 @@ export * from "./AppendKeys.js";
2
2
  export * from "./DefaultizedProps.js";
3
3
  export * from "./MakeOptional.js";
4
4
  export * from "./MakeRequired.js";
5
+ export * from "./MuiEvent.js";
5
6
  export * from "./PrependKeys.js";
6
7
  export * from "./RefObject.js";
7
8
  export * from "./SlotComponentPropsFromProps.js";
@@ -2,6 +2,7 @@ export * from "./AppendKeys.js";
2
2
  export * from "./DefaultizedProps.js";
3
3
  export * from "./MakeOptional.js";
4
4
  export * from "./MakeRequired.js";
5
+ export * from "./MuiEvent.js";
5
6
  export * from "./PrependKeys.js";
6
7
  export * from "./RefObject.js";
7
8
  export * from "./SlotComponentPropsFromProps.js";
@@ -0,0 +1 @@
1
+ export { loadStyleSheets } from "./loadStyleSheets.js";
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "loadStyleSheets", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _loadStyleSheets.loadStyleSheets;
10
+ }
11
+ });
12
+ var _loadStyleSheets = require("./loadStyleSheets");
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Loads all stylesheets from the given root element into the document.
3
+ * @returns an array of promises that resolve when each stylesheet is loaded
4
+ * @param document Document to load stylesheets into
5
+ * @param root Document or ShadowRoot to load stylesheets from
6
+ */
7
+ export declare function loadStyleSheets(document: Document, root: Document | ShadowRoot): Promise<void>[];
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.loadStyleSheets = loadStyleSheets;
7
+ /**
8
+ * Loads all stylesheets from the given root element into the document.
9
+ * @returns an array of promises that resolve when each stylesheet is loaded
10
+ * @param document Document to load stylesheets into
11
+ * @param root Document or ShadowRoot to load stylesheets from
12
+ */
13
+ function loadStyleSheets(document, root) {
14
+ const stylesheetLoadPromises = [];
15
+ const headStyleElements = root.querySelectorAll("style, link[rel='stylesheet']");
16
+ for (let i = 0; i < headStyleElements.length; i += 1) {
17
+ const node = headStyleElements[i];
18
+ if (node.tagName === 'STYLE') {
19
+ const newHeadStyleElements = document.createElement(node.tagName);
20
+ const sheet = node.sheet;
21
+ if (sheet) {
22
+ let styleCSS = '';
23
+ for (let j = 0; j < sheet.cssRules.length; j += 1) {
24
+ if (typeof sheet.cssRules[j].cssText === 'string') {
25
+ styleCSS += `${sheet.cssRules[j].cssText}\r\n`;
26
+ }
27
+ }
28
+ newHeadStyleElements.appendChild(document.createTextNode(styleCSS));
29
+ document.head.appendChild(newHeadStyleElements);
30
+ }
31
+ } else if (node.getAttribute('href')) {
32
+ // If `href` tag is empty, avoid loading these links
33
+
34
+ const newHeadStyleElements = document.createElement(node.tagName);
35
+ for (let j = 0; j < node.attributes.length; j += 1) {
36
+ const attr = node.attributes[j];
37
+ if (attr) {
38
+ newHeadStyleElements.setAttribute(attr.nodeName, attr.nodeValue || '');
39
+ }
40
+ }
41
+ stylesheetLoadPromises.push(new Promise(resolve => {
42
+ newHeadStyleElements.addEventListener('load', () => resolve());
43
+ }));
44
+ document.head.appendChild(newHeadStyleElements);
45
+ }
46
+ }
47
+ return stylesheetLoadPromises;
48
+ }
package/hash/index.d.ts CHANGED
@@ -1 +1,2 @@
1
- export * from "./hash.js";
1
+ export * from "./hash.js";
2
+ export * from "./stringify.js";
package/hash/index.js CHANGED
@@ -13,4 +13,15 @@ Object.keys(_hash).forEach(function (key) {
13
13
  return _hash[key];
14
14
  }
15
15
  });
16
+ });
17
+ var _stringify = require("./stringify");
18
+ Object.keys(_stringify).forEach(function (key) {
19
+ if (key === "default" || key === "__esModule") return;
20
+ if (key in exports && exports[key] === _stringify[key]) return;
21
+ Object.defineProperty(exports, key, {
22
+ enumerable: true,
23
+ get: function () {
24
+ return _stringify[key];
25
+ }
26
+ });
16
27
  });
@@ -0,0 +1,6 @@
1
+ /**
2
+ * A JSON.stringify that handles circular references safely.
3
+ * Fixes: https://github.com/mui/mui-x/issues/17521
4
+ * Source: https://www.30secondsofcode.org/js/s/stringify-circular-json/
5
+ */
6
+ export declare function stringify(input: object | string | number | null): string;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.stringify = stringify;
7
+ /**
8
+ * A JSON.stringify that handles circular references safely.
9
+ * Fixes: https://github.com/mui/mui-x/issues/17521
10
+ * Source: https://www.30secondsofcode.org/js/s/stringify-circular-json/
11
+ */
12
+ function stringify(input) {
13
+ const seen = new WeakSet();
14
+ return JSON.stringify(input, (_, v) => {
15
+ if (v !== null && typeof v === 'object') {
16
+ if (seen.has(v)) {
17
+ return null;
18
+ }
19
+ seen.add(v);
20
+ }
21
+ return v;
22
+ });
23
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/x-internals",
3
- "version": "8.0.0-beta.3",
3
+ "version": "8.2.0",
4
4
  "description": "Utility functions for the MUI X packages (internal use only).",
5
5
  "author": "MUI Team",
6
6
  "license": "MIT",
@@ -32,7 +32,7 @@
32
32
  },
33
33
  "dependencies": {
34
34
  "@babel/runtime": "^7.27.0",
35
- "@mui/utils": "^7.0.0"
35
+ "@mui/utils": "^7.0.2"
36
36
  },
37
37
  "peerDependencies": {
38
38
  "react": "^17.0.0 || ^18.0.0 || ^19.0.0"
@@ -51,10 +51,6 @@
51
51
  "import": {
52
52
  "types": "./esm/index.d.ts",
53
53
  "default": "./esm/index.js"
54
- },
55
- "mui-modern": {
56
- "types": "./modern/index.d.ts",
57
- "default": "./modern/index.js"
58
54
  }
59
55
  },
60
56
  "./*": {
@@ -65,10 +61,6 @@
65
61
  "import": {
66
62
  "types": "./esm/*/index.d.ts",
67
63
  "default": "./esm/*/index.js"
68
- },
69
- "mui-modern": {
70
- "types": "./modern/*/index.d.ts",
71
- "default": "./modern/*/index.js"
72
64
  }
73
65
  },
74
66
  "./esm": null,
@@ -0,0 +1 @@
1
+ export * from "./rafThrottle.js";
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _rafThrottle = require("./rafThrottle");
7
+ Object.keys(_rafThrottle).forEach(function (key) {
8
+ if (key === "default" || key === "__esModule") return;
9
+ if (key in exports && exports[key] === _rafThrottle[key]) return;
10
+ Object.defineProperty(exports, key, {
11
+ enumerable: true,
12
+ get: function () {
13
+ return _rafThrottle[key];
14
+ }
15
+ });
16
+ });
@@ -0,0 +1,16 @@
1
+ export interface Cancelable {
2
+ clear(): void;
3
+ }
4
+ /**
5
+ * Creates a throttled function that only invokes `fn` at most once per animation frame.
6
+ *
7
+ * @example
8
+ * ```ts
9
+ * const throttled = rafThrottle((value: number) => console.log(value));
10
+ * window.addEventListener('scroll', (e) => throttled(e.target.scrollTop));
11
+ * ```
12
+ *
13
+ * @param fn Callback function
14
+ * @return The `requestAnimationFrame` throttled function
15
+ */
16
+ export declare function rafThrottle<T extends (...args: any[]) => any>(fn: T): T & Cancelable;
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.rafThrottle = rafThrottle;
7
+ /**
8
+ * Creates a throttled function that only invokes `fn` at most once per animation frame.
9
+ *
10
+ * @example
11
+ * ```ts
12
+ * const throttled = rafThrottle((value: number) => console.log(value));
13
+ * window.addEventListener('scroll', (e) => throttled(e.target.scrollTop));
14
+ * ```
15
+ *
16
+ * @param fn Callback function
17
+ * @return The `requestAnimationFrame` throttled function
18
+ */
19
+ function rafThrottle(fn) {
20
+ let lastArgs;
21
+ let rafRef;
22
+ const later = () => {
23
+ rafRef = null;
24
+ fn(...lastArgs);
25
+ };
26
+ function throttled(...args) {
27
+ lastArgs = args;
28
+ if (!rafRef) {
29
+ rafRef = requestAnimationFrame(later);
30
+ }
31
+ }
32
+ throttled.clear = () => {
33
+ if (rafRef) {
34
+ cancelAnimationFrame(rafRef);
35
+ rafRef = null;
36
+ }
37
+ };
38
+ return throttled;
39
+ }
@@ -0,0 +1,5 @@
1
+ import * as React from 'react';
2
+ export type MuiBaseEvent = React.SyntheticEvent<HTMLElement> | DocumentEventMap[keyof DocumentEventMap] | {};
3
+ export type MuiEvent<E extends MuiBaseEvent = MuiBaseEvent> = E & {
4
+ defaultMuiPrevented?: boolean;
5
+ };
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
package/types/index.d.ts CHANGED
@@ -2,6 +2,7 @@ export * from "./AppendKeys.js";
2
2
  export * from "./DefaultizedProps.js";
3
3
  export * from "./MakeOptional.js";
4
4
  export * from "./MakeRequired.js";
5
+ export * from "./MuiEvent.js";
5
6
  export * from "./PrependKeys.js";
6
7
  export * from "./RefObject.js";
7
8
  export * from "./SlotComponentPropsFromProps.js";
package/types/index.js CHANGED
@@ -47,6 +47,17 @@ Object.keys(_MakeRequired).forEach(function (key) {
47
47
  }
48
48
  });
49
49
  });
50
+ var _MuiEvent = require("./MuiEvent");
51
+ Object.keys(_MuiEvent).forEach(function (key) {
52
+ if (key === "default" || key === "__esModule") return;
53
+ if (key in exports && exports[key] === _MuiEvent[key]) return;
54
+ Object.defineProperty(exports, key, {
55
+ enumerable: true,
56
+ get: function () {
57
+ return _MuiEvent[key];
58
+ }
59
+ });
60
+ });
50
61
  var _PrependKeys = require("./PrependKeys");
51
62
  Object.keys(_PrependKeys).forEach(function (key) {
52
63
  if (key === "default" || key === "__esModule") return;
@@ -1,29 +0,0 @@
1
- export type EventListener = (...args: any[]) => void;
2
- export interface EventListenerOptions {
3
- isFirst?: boolean;
4
- }
5
- interface EventListenerCollection {
6
- /**
7
- * List of listeners to run before the others
8
- * They are run in the opposite order of the registration order
9
- */
10
- highPriority: Map<EventListener, true>;
11
- /**
12
- * List of events to run after the high priority listeners
13
- * They are run in the registration order
14
- */
15
- regular: Map<EventListener, true>;
16
- }
17
- export declare class EventManager {
18
- maxListeners: number;
19
- warnOnce: boolean;
20
- events: {
21
- [eventName: string]: EventListenerCollection;
22
- };
23
- on(eventName: string, listener: EventListener, options?: EventListenerOptions): void;
24
- removeListener(eventName: string, listener: EventListener): void;
25
- removeAllListeners(): void;
26
- emit(eventName: string, ...args: any[]): void;
27
- once(eventName: string, listener: EventListener): void;
28
- }
29
- export {};
@@ -1,69 +0,0 @@
1
- // Used https://gist.github.com/mudge/5830382 as a starting point.
2
- // See https://github.com/browserify/events/blob/master/events.js for
3
- // the Node.js (https://nodejs.org/api/events.html) polyfill used by webpack.
4
- export class EventManager {
5
- constructor() {
6
- this.maxListeners = 20;
7
- this.warnOnce = false;
8
- this.events = {};
9
- }
10
- on(eventName, listener, options = {}) {
11
- let collection = this.events[eventName];
12
- if (!collection) {
13
- collection = {
14
- highPriority: new Map(),
15
- regular: new Map()
16
- };
17
- this.events[eventName] = collection;
18
- }
19
- if (options.isFirst) {
20
- collection.highPriority.set(listener, true);
21
- } else {
22
- collection.regular.set(listener, true);
23
- }
24
- if (process.env.NODE_ENV !== 'production') {
25
- const collectionSize = collection.highPriority.size + collection.regular.size;
26
- if (collectionSize > this.maxListeners && !this.warnOnce) {
27
- this.warnOnce = true;
28
- console.warn([`Possible EventEmitter memory leak detected. ${collectionSize} ${eventName} listeners added.`].join('\n'));
29
- }
30
- }
31
- }
32
- removeListener(eventName, listener) {
33
- if (this.events[eventName]) {
34
- this.events[eventName].regular.delete(listener);
35
- this.events[eventName].highPriority.delete(listener);
36
- }
37
- }
38
- removeAllListeners() {
39
- this.events = {};
40
- }
41
- emit(eventName, ...args) {
42
- const collection = this.events[eventName];
43
- if (!collection) {
44
- return;
45
- }
46
- const highPriorityListeners = Array.from(collection.highPriority.keys());
47
- const regularListeners = Array.from(collection.regular.keys());
48
- for (let i = highPriorityListeners.length - 1; i >= 0; i -= 1) {
49
- const listener = highPriorityListeners[i];
50
- if (collection.highPriority.has(listener)) {
51
- listener.apply(this, args);
52
- }
53
- }
54
- for (let i = 0; i < regularListeners.length; i += 1) {
55
- const listener = regularListeners[i];
56
- if (collection.regular.has(listener)) {
57
- listener.apply(this, args);
58
- }
59
- }
60
- }
61
- once(eventName, listener) {
62
- // eslint-disable-next-line consistent-this
63
- const that = this;
64
- this.on(eventName, function oneTimeListener(...args) {
65
- that.removeListener(eventName, oneTimeListener);
66
- listener.apply(that, args);
67
- });
68
- }
69
- }
@@ -1,2 +0,0 @@
1
- export { EventManager } from "./EventManager.js";
2
- export type { EventListenerOptions } from './EventManager';
@@ -1 +0,0 @@
1
- export { EventManager } from "./EventManager.js";
@@ -1,12 +0,0 @@
1
- /**
2
- * A fast array comparison function that compares two arrays for equality.
3
- *
4
- * Assumes that the arrays are ordered and contain only primitive values.
5
- *
6
- * It is faster than `fastObjectShallowCompare` for arrays.
7
- *
8
- * Returns true for instance equality, even if inputs are not arrays.
9
- *
10
- * @returns true if arrays contain the same elements in the same order, false otherwise.
11
- */
12
- export declare function fastArrayCompare<T extends any>(a: T, b: T): boolean;
@@ -1,31 +0,0 @@
1
- /**
2
- * A fast array comparison function that compares two arrays for equality.
3
- *
4
- * Assumes that the arrays are ordered and contain only primitive values.
5
- *
6
- * It is faster than `fastObjectShallowCompare` for arrays.
7
- *
8
- * Returns true for instance equality, even if inputs are not arrays.
9
- *
10
- * @returns true if arrays contain the same elements in the same order, false otherwise.
11
- */
12
- export function fastArrayCompare(a, b) {
13
- if (a === b) {
14
- return true;
15
- }
16
- if (!Array.isArray(a) || !Array.isArray(b)) {
17
- return false;
18
- }
19
- let i = a.length;
20
- if (i !== b.length) {
21
- return false;
22
- }
23
-
24
- // eslint-disable-next-line no-plusplus
25
- while (i--) {
26
- if (a[i] !== b[i]) {
27
- return false;
28
- }
29
- }
30
- return true;
31
- }
@@ -1 +0,0 @@
1
- export { fastArrayCompare } from "./fastArrayCompare.js";
@@ -1 +0,0 @@
1
- export { fastArrayCompare } from "./fastArrayCompare.js";
@@ -1 +0,0 @@
1
- export declare function fastMemo<T>(component: T): T;
@@ -1,5 +0,0 @@
1
- import * as React from 'react';
2
- import { fastObjectShallowCompare } from "../fastObjectShallowCompare/index.js";
3
- export function fastMemo(component) {
4
- return /*#__PURE__*/React.memo(component, fastObjectShallowCompare);
5
- }
@@ -1 +0,0 @@
1
- export { fastMemo } from "./fastMemo.js";
@@ -1 +0,0 @@
1
- export { fastMemo } from "./fastMemo.js";