Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F102768428
adaptV4Theme.js
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Mon, Feb 24, 00:16
Size
2 KB
Mime Type
text/x-java
Expires
Wed, Feb 26, 00:16 (2 d)
Engine
blob
Format
Raw Data
Handle
24418272
Attached To
rOACCT Open Access Compliance Check Tool (OACCT)
adaptV4Theme.js
View Options
import
_extends
from
"@babel/runtime/helpers/esm/extends"
;
import
_objectWithoutPropertiesLoose
from
"@babel/runtime/helpers/esm/objectWithoutPropertiesLoose"
;
const
_excluded
=
[
"defaultProps"
,
"mixins"
,
"overrides"
,
"palette"
,
"props"
,
"styleOverrides"
],
_excluded2
=
[
"type"
,
"mode"
];
import
{
createBreakpoints
,
createSpacing
}
from
'@mui/system'
;
export
default
function
adaptV4Theme
(
inputTheme
)
{
if
(
process
.
env
.
NODE_ENV
!==
'production'
)
{
console
.
warn
([
'MUI: adaptV4Theme() is deprecated.'
,
'Follow the upgrade guide on https://mui.com/r/migration-v4#theme.'
].
join
(
'\n'
));
}
const
{
defaultProps
=
{},
mixins
=
{},
overrides
=
{},
palette
=
{},
props
=
{},
styleOverrides
=
{}
}
=
inputTheme
,
other
=
_objectWithoutPropertiesLoose
(
inputTheme
,
_excluded
);
const
theme
=
_extends
({},
other
,
{
components
:
{}
});
// default props
Object
.
keys
(
defaultProps
).
forEach
(
component
=>
{
const
componentValue
=
theme
.
components
[
component
]
||
{};
componentValue
.
defaultProps
=
defaultProps
[
component
];
theme
.
components
[
component
]
=
componentValue
;
});
Object
.
keys
(
props
).
forEach
(
component
=>
{
const
componentValue
=
theme
.
components
[
component
]
||
{};
componentValue
.
defaultProps
=
props
[
component
];
theme
.
components
[
component
]
=
componentValue
;
});
// CSS overrides
Object
.
keys
(
styleOverrides
).
forEach
(
component
=>
{
const
componentValue
=
theme
.
components
[
component
]
||
{};
componentValue
.
styleOverrides
=
styleOverrides
[
component
];
theme
.
components
[
component
]
=
componentValue
;
});
Object
.
keys
(
overrides
).
forEach
(
component
=>
{
const
componentValue
=
theme
.
components
[
component
]
||
{};
componentValue
.
styleOverrides
=
overrides
[
component
];
theme
.
components
[
component
]
=
componentValue
;
});
// theme.spacing
theme
.
spacing
=
createSpacing
(
inputTheme
.
spacing
);
// theme.mixins.gutters
const
breakpoints
=
createBreakpoints
(
inputTheme
.
breakpoints
||
{});
const
spacing
=
theme
.
spacing
;
theme
.
mixins
=
_extends
({
gutters
:
(
styles
=
{})
=>
{
return
_extends
({
paddingLeft
:
spacing
(
2
),
paddingRight
:
spacing
(
2
)
},
styles
,
{
[
breakpoints
.
up
(
'sm'
)]
:
_extends
({
paddingLeft
:
spacing
(
3
),
paddingRight
:
spacing
(
3
)
},
styles
[
breakpoints
.
up
(
'sm'
)])
});
}
},
mixins
);
const
{
type
:
typeInput
,
mode
:
modeInput
}
=
palette
,
paletteRest
=
_objectWithoutPropertiesLoose
(
palette
,
_excluded2
);
const
finalMode
=
modeInput
||
typeInput
||
'light'
;
theme
.
palette
=
_extends
({
// theme.palette.text.hint
text
:
{
hint
:
finalMode
===
'dark'
?
'rgba(255, 255, 255, 0.5)'
:
'rgba(0, 0, 0, 0.38)'
},
mode
:
finalMode
,
type
:
finalMode
},
paletteRest
);
return
theme
;
}
Event Timeline
Log In to Comment