@mui/private-theming
Advanced tools
Comparing version 5.10.9 to 5.10.14
@@ -1,2 +0,2 @@ | ||
/** @license MUI v5.10.9 | ||
/** @license MUI v5.10.14 | ||
* | ||
@@ -3,0 +3,0 @@ * This source code is licensed under the MIT license found in the |
@@ -1,2 +0,2 @@ | ||
/** @license MUI v5.10.9 | ||
/** @license MUI v5.10.14 | ||
* | ||
@@ -3,0 +3,0 @@ * This source code is licensed under the MIT license found in the |
@@ -7,10 +7,9 @@ import _extends from "@babel/runtime/helpers/esm/extends"; | ||
import useTheme from '../useTheme'; | ||
import nested from './nested'; // To support composition of theme. | ||
import nested from './nested'; | ||
// To support composition of theme. | ||
import { jsx as _jsx } from "react/jsx-runtime"; | ||
function mergeOuterLocalTheme(outerTheme, localTheme) { | ||
if (typeof localTheme === 'function') { | ||
var mergedTheme = localTheme(outerTheme); | ||
if (process.env.NODE_ENV !== 'production') { | ||
@@ -21,8 +20,7 @@ if (!mergedTheme) { | ||
} | ||
return mergedTheme; | ||
} | ||
return _extends({}, outerTheme, localTheme); | ||
} | ||
/** | ||
@@ -33,9 +31,6 @@ * This component takes a `theme` prop. | ||
*/ | ||
function ThemeProvider(props) { | ||
var children = props.children, | ||
localTheme = props.theme; | ||
localTheme = props.theme; | ||
var outerTheme = useTheme(); | ||
if (process.env.NODE_ENV !== 'production') { | ||
@@ -46,10 +41,7 @@ if (outerTheme === null && typeof localTheme === 'function') { | ||
} | ||
var theme = React.useMemo(function () { | ||
var output = outerTheme === null ? localTheme : mergeOuterLocalTheme(outerTheme, localTheme); | ||
if (output != null) { | ||
output[nested] = outerTheme !== null; | ||
} | ||
return output; | ||
@@ -62,3 +54,2 @@ }, [localTheme, outerTheme]); | ||
} | ||
process.env.NODE_ENV !== "production" ? ThemeProvider.propTypes = { | ||
@@ -69,3 +60,2 @@ /** | ||
children: PropTypes.node, | ||
/** | ||
@@ -76,7 +66,5 @@ * A theme object. You can provide a function to extend the outer theme. | ||
} : void 0; | ||
if (process.env.NODE_ENV !== 'production') { | ||
process.env.NODE_ENV !== "production" ? ThemeProvider.propTypes = exactProp(ThemeProvider.propTypes) : void 0; | ||
} | ||
export default ThemeProvider; |
import * as React from 'react'; | ||
var ThemeContext = /*#__PURE__*/React.createContext(null); | ||
if (process.env.NODE_ENV !== 'production') { | ||
ThemeContext.displayName = 'ThemeContext'; | ||
} | ||
export default ThemeContext; |
@@ -5,3 +5,2 @@ import * as React from 'react'; | ||
var theme = React.useContext(ThemeContext); | ||
if (process.env.NODE_ENV !== 'production') { | ||
@@ -11,4 +10,3 @@ // eslint-disable-next-line react-hooks/rules-of-hooks | ||
} | ||
return theme; | ||
} |
@@ -1,2 +0,2 @@ | ||
/** @license MUI v5.10.9 | ||
/** @license MUI v5.10.14 | ||
* | ||
@@ -3,0 +3,0 @@ * This source code is licensed under the MIT license found in the |
@@ -7,10 +7,9 @@ import _extends from "@babel/runtime/helpers/esm/extends"; | ||
import useTheme from '../useTheme'; | ||
import nested from './nested'; // To support composition of theme. | ||
import nested from './nested'; | ||
// To support composition of theme. | ||
import { jsx as _jsx } from "react/jsx-runtime"; | ||
function mergeOuterLocalTheme(outerTheme, localTheme) { | ||
if (typeof localTheme === 'function') { | ||
const mergedTheme = localTheme(outerTheme); | ||
if (process.env.NODE_ENV !== 'production') { | ||
@@ -21,8 +20,7 @@ if (!mergedTheme) { | ||
} | ||
return mergedTheme; | ||
} | ||
return _extends({}, outerTheme, localTheme); | ||
} | ||
/** | ||
@@ -33,4 +31,2 @@ * This component takes a `theme` prop. | ||
*/ | ||
function ThemeProvider(props) { | ||
@@ -42,3 +38,2 @@ const { | ||
const outerTheme = useTheme(); | ||
if (process.env.NODE_ENV !== 'production') { | ||
@@ -49,10 +44,7 @@ if (outerTheme === null && typeof localTheme === 'function') { | ||
} | ||
const theme = React.useMemo(() => { | ||
const output = outerTheme === null ? localTheme : mergeOuterLocalTheme(outerTheme, localTheme); | ||
if (output != null) { | ||
output[nested] = outerTheme !== null; | ||
} | ||
return output; | ||
@@ -65,3 +57,2 @@ }, [localTheme, outerTheme]); | ||
} | ||
process.env.NODE_ENV !== "production" ? ThemeProvider.propTypes = { | ||
@@ -72,3 +63,2 @@ /** | ||
children: PropTypes.node, | ||
/** | ||
@@ -79,7 +69,5 @@ * A theme object. You can provide a function to extend the outer theme. | ||
} : void 0; | ||
if (process.env.NODE_ENV !== 'production') { | ||
process.env.NODE_ENV !== "production" ? ThemeProvider.propTypes = exactProp(ThemeProvider.propTypes) : void 0; | ||
} | ||
export default ThemeProvider; |
import * as React from 'react'; | ||
const ThemeContext = /*#__PURE__*/React.createContext(null); | ||
if (process.env.NODE_ENV !== 'production') { | ||
ThemeContext.displayName = 'ThemeContext'; | ||
} | ||
export default ThemeContext; |
@@ -5,3 +5,2 @@ import * as React from 'react'; | ||
const theme = React.useContext(ThemeContext); | ||
if (process.env.NODE_ENV !== 'production') { | ||
@@ -11,4 +10,3 @@ // eslint-disable-next-line react-hooks/rules-of-hooks | ||
} | ||
return theme; | ||
} |
@@ -1,2 +0,2 @@ | ||
/** @license MUI v5.10.9 | ||
/** @license MUI v5.10.14 | ||
* | ||
@@ -9,3 +9,2 @@ * This source code is licensed under the MIT license found in the | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
Object.defineProperty(exports, "__esModule", { | ||
@@ -30,5 +29,3 @@ value: true | ||
}); | ||
var _ThemeProvider = _interopRequireWildcard(require("./ThemeProvider")); | ||
Object.keys(_ThemeProvider).forEach(function (key) { | ||
@@ -45,7 +42,4 @@ if (key === "default" || key === "__esModule") return; | ||
}); | ||
var _useTheme = _interopRequireDefault(require("./useTheme")); | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } |
"use strict"; | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
Object.defineProperty(exports, "__esModule", { | ||
@@ -20,5 +19,3 @@ value: true | ||
}); | ||
var _ThemeProvider = _interopRequireDefault(require("./ThemeProvider")); | ||
var _nested = _interopRequireDefault(require("./nested")); |
@@ -8,5 +8,3 @@ "use strict"; | ||
const hasSymbol = typeof Symbol === 'function' && Symbol.for; | ||
var _default = hasSymbol ? Symbol.for('mui.nested') : '__THEME_NESTED__'; | ||
exports.default = _default; |
"use strict"; | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
Object.defineProperty(exports, "__esModule", { | ||
@@ -9,23 +8,12 @@ value: true | ||
exports.default = void 0; | ||
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")); | ||
var React = _interopRequireWildcard(require("react")); | ||
var _propTypes = _interopRequireDefault(require("prop-types")); | ||
var _utils = require("@mui/utils"); | ||
var _ThemeContext = _interopRequireDefault(require("../useTheme/ThemeContext")); | ||
var _useTheme = _interopRequireDefault(require("../useTheme")); | ||
var _nested = _interopRequireDefault(require("./nested")); | ||
var _jsxRuntime = require("react/jsx-runtime"); | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
// To support composition of theme. | ||
@@ -35,3 +23,2 @@ function mergeOuterLocalTheme(outerTheme, localTheme) { | ||
const mergedTheme = localTheme(outerTheme); | ||
if (process.env.NODE_ENV !== 'production') { | ||
@@ -42,8 +29,7 @@ if (!mergedTheme) { | ||
} | ||
return mergedTheme; | ||
} | ||
return (0, _extends2.default)({}, outerTheme, localTheme); | ||
} | ||
/** | ||
@@ -54,4 +40,2 @@ * This component takes a `theme` prop. | ||
*/ | ||
function ThemeProvider(props) { | ||
@@ -63,3 +47,2 @@ const { | ||
const outerTheme = (0, _useTheme.default)(); | ||
if (process.env.NODE_ENV !== 'production') { | ||
@@ -70,10 +53,7 @@ if (outerTheme === null && typeof localTheme === 'function') { | ||
} | ||
const theme = React.useMemo(() => { | ||
const output = outerTheme === null ? localTheme : mergeOuterLocalTheme(outerTheme, localTheme); | ||
if (output != null) { | ||
output[_nested.default] = outerTheme !== null; | ||
} | ||
return output; | ||
@@ -86,3 +66,2 @@ }, [localTheme, outerTheme]); | ||
} | ||
process.env.NODE_ENV !== "production" ? ThemeProvider.propTypes = { | ||
@@ -93,3 +72,2 @@ /** | ||
children: _propTypes.default.node, | ||
/** | ||
@@ -100,8 +78,6 @@ * A theme object. You can provide a function to extend the outer theme. | ||
} : void 0; | ||
if (process.env.NODE_ENV !== 'production') { | ||
process.env.NODE_ENV !== "production" ? ThemeProvider.propTypes = (0, _utils.exactProp)(ThemeProvider.propTypes) : void 0; | ||
} | ||
var _default = ThemeProvider; | ||
exports.default = _default; |
"use strict"; | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
Object.defineProperty(exports, "__esModule", { | ||
@@ -14,3 +13,2 @@ value: true | ||
}); | ||
var _useTheme = _interopRequireDefault(require("./useTheme")); |
@@ -7,16 +7,10 @@ "use strict"; | ||
exports.default = void 0; | ||
var React = _interopRequireWildcard(require("react")); | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
const ThemeContext = /*#__PURE__*/React.createContext(null); | ||
if (process.env.NODE_ENV !== 'production') { | ||
ThemeContext.displayName = 'ThemeContext'; | ||
} | ||
var _default = ThemeContext; | ||
exports.default = _default; |
"use strict"; | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
Object.defineProperty(exports, "__esModule", { | ||
@@ -9,14 +8,8 @@ value: true | ||
exports.default = useTheme; | ||
var React = _interopRequireWildcard(require("react")); | ||
var _ThemeContext = _interopRequireDefault(require("./ThemeContext")); | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
function useTheme() { | ||
const theme = React.useContext(_ThemeContext.default); | ||
if (process.env.NODE_ENV !== 'production') { | ||
@@ -26,4 +19,3 @@ // eslint-disable-next-line react-hooks/rules-of-hooks | ||
} | ||
return theme; | ||
} |
{ | ||
"name": "@mui/private-theming", | ||
"version": "5.10.9", | ||
"version": "5.10.14", | ||
"private": false, | ||
@@ -38,4 +38,4 @@ "author": "MUI Team", | ||
"dependencies": { | ||
"@babel/runtime": "^7.19.0", | ||
"@mui/utils": "^5.10.9", | ||
"@babel/runtime": "^7.20.1", | ||
"@mui/utils": "^5.10.14", | ||
"prop-types": "^15.8.1" | ||
@@ -42,0 +42,0 @@ }, |
@@ -7,10 +7,9 @@ import _extends from "@babel/runtime/helpers/esm/extends"; | ||
import useTheme from '../useTheme'; | ||
import nested from './nested'; // To support composition of theme. | ||
import nested from './nested'; | ||
// To support composition of theme. | ||
import { jsx as _jsx } from "react/jsx-runtime"; | ||
function mergeOuterLocalTheme(outerTheme, localTheme) { | ||
if (typeof localTheme === 'function') { | ||
const mergedTheme = localTheme(outerTheme); | ||
if (process.env.NODE_ENV !== 'production') { | ||
@@ -21,8 +20,7 @@ if (!mergedTheme) { | ||
} | ||
return mergedTheme; | ||
} | ||
return _extends({}, outerTheme, localTheme); | ||
} | ||
/** | ||
@@ -33,4 +31,2 @@ * This component takes a `theme` prop. | ||
*/ | ||
function ThemeProvider(props) { | ||
@@ -42,3 +38,2 @@ const { | ||
const outerTheme = useTheme(); | ||
if (process.env.NODE_ENV !== 'production') { | ||
@@ -49,10 +44,7 @@ if (outerTheme === null && typeof localTheme === 'function') { | ||
} | ||
const theme = React.useMemo(() => { | ||
const output = outerTheme === null ? localTheme : mergeOuterLocalTheme(outerTheme, localTheme); | ||
if (output != null) { | ||
output[nested] = outerTheme !== null; | ||
} | ||
return output; | ||
@@ -65,3 +57,2 @@ }, [localTheme, outerTheme]); | ||
} | ||
process.env.NODE_ENV !== "production" ? ThemeProvider.propTypes = { | ||
@@ -72,3 +63,2 @@ /** | ||
children: PropTypes.node, | ||
/** | ||
@@ -79,7 +69,5 @@ * A theme object. You can provide a function to extend the outer theme. | ||
} : void 0; | ||
if (process.env.NODE_ENV !== 'production') { | ||
process.env.NODE_ENV !== "production" ? ThemeProvider.propTypes = exactProp(ThemeProvider.propTypes) : void 0; | ||
} | ||
export default ThemeProvider; |
import * as React from 'react'; | ||
const ThemeContext = /*#__PURE__*/React.createContext(null); | ||
if (process.env.NODE_ENV !== 'production') { | ||
ThemeContext.displayName = 'ThemeContext'; | ||
} | ||
export default ThemeContext; |
@@ -5,3 +5,2 @@ import * as React from 'react'; | ||
const theme = React.useContext(ThemeContext); | ||
if (process.env.NODE_ENV !== 'production') { | ||
@@ -11,4 +10,3 @@ // eslint-disable-next-line react-hooks/rules-of-hooks | ||
} | ||
return theme; | ||
} |
Sorry, the diff of this file is too big to display
536039
468
Updated@babel/runtime@^7.20.1
Updated@mui/utils@^5.10.14