@meonode/mui 1.0.23 → 1.0.25

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/dist/core.d.ts CHANGED
@@ -8,19 +8,19 @@ import { OverridableComponent, OverridableTypeMap, OverrideProps } from '@mui/ma
8
8
  * @returns `true` if the object appears to be a MUI theme, `false` otherwise
9
9
  * @remarks
10
10
  * The function uses a heuristic approach by:
11
- * 1. Creating a reference theme using MUI's extendTheme()
11
+ * 1. Creating a reference theme using MUI's extendTheme() (done once and memoized)
12
12
  * 2. Comparing the keys of the input object with the reference theme
13
13
  * 3. Calculating a similarity score based on matching keys
14
14
  * 4. Considering it a theme if at least 25% of reference keys are present
15
15
  * @example
16
16
  * ```ts
17
17
  * const customTheme = {
18
- * palette: { primary: { main: '#000' } },
19
- * typography: { fontSize: 14 }
18
+ * palette: { primary: { main: '#000' } },
19
+ * typography: { fontSize: 14 }
20
20
  * };
21
21
  *
22
22
  * if (isProbablyMuiTheme(customTheme)) {
23
- * // Handle theme object
23
+ * // Handle theme object
24
24
  * }
25
25
  * ```
26
26
  * @throws Will not throw, but returns false for null, non-objects, or invalid inputs
@@ -1 +1 @@
1
- {"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../src-gen/core.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAE1D,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAA;AAG5G;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAWxD;AAED;;;;;GAKG;AACH,KAAK,eAAe,CAAC,IAAI,SAAS,kBAAkB,EAAE,UAAU,SAAS,KAAK,CAAC,WAAW,IAAI,IAAI,GAAG;IACnG,KAAK,EAAE,IAAI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eAAe,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAA;AAEjE;;;GAGG;AACH,KAAK,kBAAkB,CAAC,QAAQ,SAAS,KAAK,CAAC,WAAW,IAAI,CAAC,KAAK,CAAC,EAAE,SAAS,CAAC,QAAQ,CAAC,KAAK,YAAY,CAAC,QAAQ,CAAC,CAAA;AAErH;;;;;;;GAOG;AACH,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,IAAI,SAAS,kBAAkB,EAAE,iBAAiB,SAAS,KAAK,CAAC,WAAW,GAAG,IAAI,CAAC,kBAAkB,CAAC,EAC3I,OAAO,EAAE,oBAAoB,CAAC,IAAI,CAAC,GAClC,cAAc,CAAC,IAAI,EAAE,iBAAiB,CAAC,CAAA;AAE1C;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,QAAQ,SAAS,KAAK,CAAC,WAAW,EAAE,OAAO,EAAE,QAAQ,GAAG,kBAAkB,CAAC,QAAQ,CAAC,CAAA;AAoB1H;;GAEG;AACH,OAAO,EAAE,aAAa,EAAE,CAAA"}
package/dist/core.js CHANGED
@@ -1,27 +1,28 @@
1
- "use strict";function _typeof(a){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},_typeof(a)}import{Node}from"@meonode/ui";import{extendTheme}from"@mui/material";/**
1
+ "use strict";function _typeof(a){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},_typeof(a)}import{Node}from"@meonode/ui";import{extendTheme}from"@mui/material";// Memoize the reference theme keys
2
+ var memoizedReferenceThemeKeys=null;function getReferenceThemeKeys(){if(null===memoizedReferenceThemeKeys){var a=extendTheme();memoizedReferenceThemeKeys=Object.keys(a)}return memoizedReferenceThemeKeys}/**
2
3
  * Determines if an object is likely to be a Material-UI theme object by comparing its structure
3
4
  * to a reference theme.
4
5
  * @param obj The object to evaluate as a potential MUI theme
5
6
  * @returns `true` if the object appears to be a MUI theme, `false` otherwise
6
7
  * @remarks
7
8
  * The function uses a heuristic approach by:
8
- * 1. Creating a reference theme using MUI's extendTheme()
9
+ * 1. Creating a reference theme using MUI's extendTheme() (done once and memoized)
9
10
  * 2. Comparing the keys of the input object with the reference theme
10
11
  * 3. Calculating a similarity score based on matching keys
11
12
  * 4. Considering it a theme if at least 25% of reference keys are present
12
13
  * @example
13
14
  * ```ts
14
15
  * const customTheme = {
15
- * palette: { primary: { main: '#000' } },
16
- * typography: { fontSize: 14 }
16
+ * palette: { primary: { main: '#000' } },
17
+ * typography: { fontSize: 14 }
17
18
  * };
18
19
  *
19
20
  * if (isProbablyMuiTheme(customTheme)) {
20
- * // Handle theme object
21
+ * // Handle theme object
21
22
  * }
22
23
  * ```
23
24
  * @throws Will not throw, but returns false for null, non-objects, or invalid inputs
24
- */export function isProbablyMuiTheme(a){if("object"!==_typeof(a)||null===a)return!1;var b=extendTheme(),c=Object.keys(b),d=Object.keys(a),e=d.filter(function(a){return c.includes(a)}),f=e.length/c.length;return .25<=f}/**
25
+ */export function isProbablyMuiTheme(a){if("object"!==_typeof(a)||null===a)return!1;var b=getReferenceThemeKeys(),c=Object.keys(a),d=c.filter(function(a){return b.includes(a)}),e=d.length/b.length;return .25<=e}/**
25
26
  * A utility type that extends an OverridableTypeMap to include a polymorphic `component` prop.
26
27
  * This allows the component to be overridden with a different React element type.
27
28
  * @template TMap - The base OverridableTypeMap to extend.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@meonode/mui",
3
3
  "description": "A lightweight wrapper around `@mui/material` components for use with `@meonode/ui` and the BaseNode runtime.",
4
- "version": "1.0.23",
4
+ "version": "1.0.25",
5
5
  "type": "module",
6
6
  "sideEffects": false,
7
7
  "exports": {
@@ -74,7 +74,7 @@
74
74
  "@emotion/react": "^11.14.0",
75
75
  "@emotion/styled": "^11.14.1",
76
76
  "@eslint/js": "^9.31.0",
77
- "@meonode/ui": "^0.1.95",
77
+ "@meonode/ui": "^0.1.98",
78
78
  "@mui/lab": "^7.0.0-beta.14",
79
79
  "@mui/material": "^7.2.0",
80
80
  "@mui/system": "^7.2.0",
@@ -89,8 +89,8 @@
89
89
  "@mui/x-tree-view-pro": "^8.8.0",
90
90
  "@types/babel__generator": "^7.27.0",
91
91
  "@types/react": "^19.1.8",
92
- "@typescript-eslint/eslint-plugin": "^8.36.0",
93
- "@typescript-eslint/parser": "^8.36.0",
92
+ "@typescript-eslint/eslint-plugin": "^8.37.0",
93
+ "@typescript-eslint/parser": "^8.37.0",
94
94
  "babel-preset-minify": "^0.5.2",
95
95
  "eslint": "^9.31.0",
96
96
  "eslint-plugin-jsdoc": "^51.3.4",
@@ -100,13 +100,13 @@
100
100
  "prettier": "^3.6.2",
101
101
  "tsc-alias": "^1.8.16",
102
102
  "typescript": "^5.8.3",
103
- "typescript-eslint": "^8.36.0"
103
+ "typescript-eslint": "^8.37.0"
104
104
  },
105
105
  "packageManager": "yarn@4.9.1",
106
106
  "peerDependencies": {
107
107
  "@emotion/react": "^11.14.0",
108
108
  "@emotion/styled": "^11.14.1",
109
- "@meonode/ui": "^0.1.95",
109
+ "@meonode/ui": "^0.1.98",
110
110
  "@mui/lab": "^7.0.0-beta.14",
111
111
  "@mui/material": "^7.2.0",
112
112
  "@mui/system": "^7.2.0",