Grabbed dndbeyond's source code
``` ~/go/bin/sourcemapper -output ddb -jsurl https://media.dndbeyond.com/character-app/static/js/main.90aa78c5.js ```
This commit is contained in:
+31
@@ -0,0 +1,31 @@
|
||||
'use client';
|
||||
|
||||
import _extends from "@babel/runtime/helpers/esm/extends";
|
||||
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
||||
const _excluded = ["theme"];
|
||||
import * as React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { ThemeProvider as SystemThemeProvider } from '@mui/system';
|
||||
import THEME_ID from './identifier';
|
||||
import { jsx as _jsx } from "react/jsx-runtime";
|
||||
export default function ThemeProvider(_ref) {
|
||||
let {
|
||||
theme: themeInput
|
||||
} = _ref,
|
||||
props = _objectWithoutPropertiesLoose(_ref, _excluded);
|
||||
const scopedTheme = themeInput[THEME_ID];
|
||||
return /*#__PURE__*/_jsx(SystemThemeProvider, _extends({}, props, {
|
||||
themeId: scopedTheme ? THEME_ID : undefined,
|
||||
theme: scopedTheme || themeInput
|
||||
}));
|
||||
}
|
||||
process.env.NODE_ENV !== "production" ? ThemeProvider.propTypes = {
|
||||
/**
|
||||
* Your component tree.
|
||||
*/
|
||||
children: PropTypes.node,
|
||||
/**
|
||||
* A theme object. You can provide a function to extend the outer theme.
|
||||
*/
|
||||
theme: PropTypes.oneOfType([PropTypes.object, PropTypes.func]).isRequired
|
||||
} : void 0;
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
import _extends from "@babel/runtime/helpers/esm/extends";
|
||||
export default function createMixins(breakpoints, mixins) {
|
||||
return _extends({
|
||||
toolbar: {
|
||||
minHeight: 56,
|
||||
[breakpoints.up('xs')]: {
|
||||
'@media (orientation: landscape)': {
|
||||
minHeight: 48
|
||||
}
|
||||
},
|
||||
[breakpoints.up('sm')]: {
|
||||
minHeight: 64
|
||||
}
|
||||
}
|
||||
}, mixins);
|
||||
}
|
||||
+305
@@ -0,0 +1,305 @@
|
||||
import _extends from "@babel/runtime/helpers/esm/extends";
|
||||
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
||||
import _formatMuiErrorMessage from "@mui/utils/formatMuiErrorMessage";
|
||||
const _excluded = ["mode", "contrastThreshold", "tonalOffset"];
|
||||
import deepmerge from '@mui/utils/deepmerge';
|
||||
import { darken, getContrastRatio, lighten } from '@mui/system/colorManipulator';
|
||||
import common from '../colors/common';
|
||||
import grey from '../colors/grey';
|
||||
import purple from '../colors/purple';
|
||||
import red from '../colors/red';
|
||||
import orange from '../colors/orange';
|
||||
import blue from '../colors/blue';
|
||||
import lightBlue from '../colors/lightBlue';
|
||||
import green from '../colors/green';
|
||||
export const light = {
|
||||
// The colors used to style the text.
|
||||
text: {
|
||||
// The most important text.
|
||||
primary: 'rgba(0, 0, 0, 0.87)',
|
||||
// Secondary text.
|
||||
secondary: 'rgba(0, 0, 0, 0.6)',
|
||||
// Disabled text have even lower visual prominence.
|
||||
disabled: 'rgba(0, 0, 0, 0.38)'
|
||||
},
|
||||
// The color used to divide different elements.
|
||||
divider: 'rgba(0, 0, 0, 0.12)',
|
||||
// The background colors used to style the surfaces.
|
||||
// Consistency between these values is important.
|
||||
background: {
|
||||
paper: common.white,
|
||||
default: common.white
|
||||
},
|
||||
// The colors used to style the action elements.
|
||||
action: {
|
||||
// The color of an active action like an icon button.
|
||||
active: 'rgba(0, 0, 0, 0.54)',
|
||||
// The color of an hovered action.
|
||||
hover: 'rgba(0, 0, 0, 0.04)',
|
||||
hoverOpacity: 0.04,
|
||||
// The color of a selected action.
|
||||
selected: 'rgba(0, 0, 0, 0.08)',
|
||||
selectedOpacity: 0.08,
|
||||
// The color of a disabled action.
|
||||
disabled: 'rgba(0, 0, 0, 0.26)',
|
||||
// The background color of a disabled action.
|
||||
disabledBackground: 'rgba(0, 0, 0, 0.12)',
|
||||
disabledOpacity: 0.38,
|
||||
focus: 'rgba(0, 0, 0, 0.12)',
|
||||
focusOpacity: 0.12,
|
||||
activatedOpacity: 0.12
|
||||
}
|
||||
};
|
||||
export const dark = {
|
||||
text: {
|
||||
primary: common.white,
|
||||
secondary: 'rgba(255, 255, 255, 0.7)',
|
||||
disabled: 'rgba(255, 255, 255, 0.5)',
|
||||
icon: 'rgba(255, 255, 255, 0.5)'
|
||||
},
|
||||
divider: 'rgba(255, 255, 255, 0.12)',
|
||||
background: {
|
||||
paper: '#121212',
|
||||
default: '#121212'
|
||||
},
|
||||
action: {
|
||||
active: common.white,
|
||||
hover: 'rgba(255, 255, 255, 0.08)',
|
||||
hoverOpacity: 0.08,
|
||||
selected: 'rgba(255, 255, 255, 0.16)',
|
||||
selectedOpacity: 0.16,
|
||||
disabled: 'rgba(255, 255, 255, 0.3)',
|
||||
disabledBackground: 'rgba(255, 255, 255, 0.12)',
|
||||
disabledOpacity: 0.38,
|
||||
focus: 'rgba(255, 255, 255, 0.12)',
|
||||
focusOpacity: 0.12,
|
||||
activatedOpacity: 0.24
|
||||
}
|
||||
};
|
||||
function addLightOrDark(intent, direction, shade, tonalOffset) {
|
||||
const tonalOffsetLight = tonalOffset.light || tonalOffset;
|
||||
const tonalOffsetDark = tonalOffset.dark || tonalOffset * 1.5;
|
||||
if (!intent[direction]) {
|
||||
if (intent.hasOwnProperty(shade)) {
|
||||
intent[direction] = intent[shade];
|
||||
} else if (direction === 'light') {
|
||||
intent.light = lighten(intent.main, tonalOffsetLight);
|
||||
} else if (direction === 'dark') {
|
||||
intent.dark = darken(intent.main, tonalOffsetDark);
|
||||
}
|
||||
}
|
||||
}
|
||||
function getDefaultPrimary(mode = 'light') {
|
||||
if (mode === 'dark') {
|
||||
return {
|
||||
main: blue[200],
|
||||
light: blue[50],
|
||||
dark: blue[400]
|
||||
};
|
||||
}
|
||||
return {
|
||||
main: blue[700],
|
||||
light: blue[400],
|
||||
dark: blue[800]
|
||||
};
|
||||
}
|
||||
function getDefaultSecondary(mode = 'light') {
|
||||
if (mode === 'dark') {
|
||||
return {
|
||||
main: purple[200],
|
||||
light: purple[50],
|
||||
dark: purple[400]
|
||||
};
|
||||
}
|
||||
return {
|
||||
main: purple[500],
|
||||
light: purple[300],
|
||||
dark: purple[700]
|
||||
};
|
||||
}
|
||||
function getDefaultError(mode = 'light') {
|
||||
if (mode === 'dark') {
|
||||
return {
|
||||
main: red[500],
|
||||
light: red[300],
|
||||
dark: red[700]
|
||||
};
|
||||
}
|
||||
return {
|
||||
main: red[700],
|
||||
light: red[400],
|
||||
dark: red[800]
|
||||
};
|
||||
}
|
||||
function getDefaultInfo(mode = 'light') {
|
||||
if (mode === 'dark') {
|
||||
return {
|
||||
main: lightBlue[400],
|
||||
light: lightBlue[300],
|
||||
dark: lightBlue[700]
|
||||
};
|
||||
}
|
||||
return {
|
||||
main: lightBlue[700],
|
||||
light: lightBlue[500],
|
||||
dark: lightBlue[900]
|
||||
};
|
||||
}
|
||||
function getDefaultSuccess(mode = 'light') {
|
||||
if (mode === 'dark') {
|
||||
return {
|
||||
main: green[400],
|
||||
light: green[300],
|
||||
dark: green[700]
|
||||
};
|
||||
}
|
||||
return {
|
||||
main: green[800],
|
||||
light: green[500],
|
||||
dark: green[900]
|
||||
};
|
||||
}
|
||||
function getDefaultWarning(mode = 'light') {
|
||||
if (mode === 'dark') {
|
||||
return {
|
||||
main: orange[400],
|
||||
light: orange[300],
|
||||
dark: orange[700]
|
||||
};
|
||||
}
|
||||
return {
|
||||
main: '#ed6c02',
|
||||
// closest to orange[800] that pass 3:1.
|
||||
light: orange[500],
|
||||
dark: orange[900]
|
||||
};
|
||||
}
|
||||
export default function createPalette(palette) {
|
||||
const {
|
||||
mode = 'light',
|
||||
contrastThreshold = 3,
|
||||
tonalOffset = 0.2
|
||||
} = palette,
|
||||
other = _objectWithoutPropertiesLoose(palette, _excluded);
|
||||
const primary = palette.primary || getDefaultPrimary(mode);
|
||||
const secondary = palette.secondary || getDefaultSecondary(mode);
|
||||
const error = palette.error || getDefaultError(mode);
|
||||
const info = palette.info || getDefaultInfo(mode);
|
||||
const success = palette.success || getDefaultSuccess(mode);
|
||||
const warning = palette.warning || getDefaultWarning(mode);
|
||||
|
||||
// Use the same logic as
|
||||
// Bootstrap: https://github.com/twbs/bootstrap/blob/1d6e3710dd447de1a200f29e8fa521f8a0908f70/scss/_functions.scss#L59
|
||||
// and material-components-web https://github.com/material-components/material-components-web/blob/ac46b8863c4dab9fc22c4c662dc6bd1b65dd652f/packages/mdc-theme/_functions.scss#L54
|
||||
function getContrastText(background) {
|
||||
const contrastText = getContrastRatio(background, dark.text.primary) >= contrastThreshold ? dark.text.primary : light.text.primary;
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
const contrast = getContrastRatio(background, contrastText);
|
||||
if (contrast < 3) {
|
||||
console.error([`MUI: The contrast ratio of ${contrast}:1 for ${contrastText} on ${background}`, 'falls below the WCAG recommended absolute minimum contrast ratio of 3:1.', 'https://www.w3.org/TR/2008/REC-WCAG20-20081211/#visual-audio-contrast-contrast'].join('\n'));
|
||||
}
|
||||
}
|
||||
return contrastText;
|
||||
}
|
||||
const augmentColor = ({
|
||||
color,
|
||||
name,
|
||||
mainShade = 500,
|
||||
lightShade = 300,
|
||||
darkShade = 700
|
||||
}) => {
|
||||
color = _extends({}, color);
|
||||
if (!color.main && color[mainShade]) {
|
||||
color.main = color[mainShade];
|
||||
}
|
||||
if (!color.hasOwnProperty('main')) {
|
||||
throw new Error(process.env.NODE_ENV !== "production" ? `MUI: The color${name ? ` (${name})` : ''} provided to augmentColor(color) is invalid.
|
||||
The color object needs to have a \`main\` property or a \`${mainShade}\` property.` : _formatMuiErrorMessage(11, name ? ` (${name})` : '', mainShade));
|
||||
}
|
||||
if (typeof color.main !== 'string') {
|
||||
throw new Error(process.env.NODE_ENV !== "production" ? `MUI: The color${name ? ` (${name})` : ''} provided to augmentColor(color) is invalid.
|
||||
\`color.main\` should be a string, but \`${JSON.stringify(color.main)}\` was provided instead.
|
||||
|
||||
Did you intend to use one of the following approaches?
|
||||
|
||||
import { green } from "@mui/material/colors";
|
||||
|
||||
const theme1 = createTheme({ palette: {
|
||||
primary: green,
|
||||
} });
|
||||
|
||||
const theme2 = createTheme({ palette: {
|
||||
primary: { main: green[500] },
|
||||
} });` : _formatMuiErrorMessage(12, name ? ` (${name})` : '', JSON.stringify(color.main)));
|
||||
}
|
||||
addLightOrDark(color, 'light', lightShade, tonalOffset);
|
||||
addLightOrDark(color, 'dark', darkShade, tonalOffset);
|
||||
if (!color.contrastText) {
|
||||
color.contrastText = getContrastText(color.main);
|
||||
}
|
||||
return color;
|
||||
};
|
||||
const modes = {
|
||||
dark,
|
||||
light
|
||||
};
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
if (!modes[mode]) {
|
||||
console.error(`MUI: The palette mode \`${mode}\` is not supported.`);
|
||||
}
|
||||
}
|
||||
const paletteOutput = deepmerge(_extends({
|
||||
// A collection of common colors.
|
||||
common: _extends({}, common),
|
||||
// prevent mutable object.
|
||||
// The palette mode, can be light or dark.
|
||||
mode,
|
||||
// The colors used to represent primary interface elements for a user.
|
||||
primary: augmentColor({
|
||||
color: primary,
|
||||
name: 'primary'
|
||||
}),
|
||||
// The colors used to represent secondary interface elements for a user.
|
||||
secondary: augmentColor({
|
||||
color: secondary,
|
||||
name: 'secondary',
|
||||
mainShade: 'A400',
|
||||
lightShade: 'A200',
|
||||
darkShade: 'A700'
|
||||
}),
|
||||
// The colors used to represent interface elements that the user should be made aware of.
|
||||
error: augmentColor({
|
||||
color: error,
|
||||
name: 'error'
|
||||
}),
|
||||
// The colors used to represent potentially dangerous actions or important messages.
|
||||
warning: augmentColor({
|
||||
color: warning,
|
||||
name: 'warning'
|
||||
}),
|
||||
// The colors used to present information to the user that is neutral and not necessarily important.
|
||||
info: augmentColor({
|
||||
color: info,
|
||||
name: 'info'
|
||||
}),
|
||||
// The colors used to indicate the successful completion of an action that user triggered.
|
||||
success: augmentColor({
|
||||
color: success,
|
||||
name: 'success'
|
||||
}),
|
||||
// The grey colors.
|
||||
grey,
|
||||
// Used by `getContrastText()` to maximize the contrast between
|
||||
// the background and the text.
|
||||
contrastThreshold,
|
||||
// Takes a background color and returns the text color that maximizes the contrast.
|
||||
getContrastText,
|
||||
// Generate a rich color object.
|
||||
augmentColor,
|
||||
// Used by the functions below to shift a color's luminance by approximately
|
||||
// two indexes within its tonal palette.
|
||||
// E.g., shift from Red 500 to Red 300 or Red 700.
|
||||
tonalOffset
|
||||
}, modes[mode]), other);
|
||||
return paletteOutput;
|
||||
}
|
||||
+89
@@ -0,0 +1,89 @@
|
||||
import _extends from "@babel/runtime/helpers/esm/extends";
|
||||
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
||||
import _formatMuiErrorMessage from "@mui/utils/formatMuiErrorMessage";
|
||||
const _excluded = ["breakpoints", "mixins", "spacing", "palette", "transitions", "typography", "shape"];
|
||||
import deepmerge from '@mui/utils/deepmerge';
|
||||
import styleFunctionSx, { unstable_defaultSxConfig as defaultSxConfig } from '@mui/system/styleFunctionSx';
|
||||
import systemCreateTheme from '@mui/system/createTheme';
|
||||
import generateUtilityClass from '@mui/utils/generateUtilityClass';
|
||||
import createMixins from './createMixins';
|
||||
import createPalette from './createPalette';
|
||||
import createTypography from './createTypography';
|
||||
import shadows from './shadows';
|
||||
import createTransitions from './createTransitions';
|
||||
import zIndex from './zIndex';
|
||||
function createTheme(options = {}, ...args) {
|
||||
const {
|
||||
mixins: mixinsInput = {},
|
||||
palette: paletteInput = {},
|
||||
transitions: transitionsInput = {},
|
||||
typography: typographyInput = {}
|
||||
} = options,
|
||||
other = _objectWithoutPropertiesLoose(options, _excluded);
|
||||
if (options.vars) {
|
||||
throw new Error(process.env.NODE_ENV !== "production" ? `MUI: \`vars\` is a private field used for CSS variables support.
|
||||
Please use another name.` : _formatMuiErrorMessage(18));
|
||||
}
|
||||
const palette = createPalette(paletteInput);
|
||||
const systemTheme = systemCreateTheme(options);
|
||||
let muiTheme = deepmerge(systemTheme, {
|
||||
mixins: createMixins(systemTheme.breakpoints, mixinsInput),
|
||||
palette,
|
||||
// Don't use [...shadows] until you've verified its transpiled code is not invoking the iterator protocol.
|
||||
shadows: shadows.slice(),
|
||||
typography: createTypography(palette, typographyInput),
|
||||
transitions: createTransitions(transitionsInput),
|
||||
zIndex: _extends({}, zIndex)
|
||||
});
|
||||
muiTheme = deepmerge(muiTheme, other);
|
||||
muiTheme = args.reduce((acc, argument) => deepmerge(acc, argument), muiTheme);
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
// TODO v6: Refactor to use globalStateClassesMapping from @mui/utils once `readOnly` state class is used in Rating component.
|
||||
const stateClasses = ['active', 'checked', 'completed', 'disabled', 'error', 'expanded', 'focused', 'focusVisible', 'required', 'selected'];
|
||||
const traverse = (node, component) => {
|
||||
let key;
|
||||
|
||||
// eslint-disable-next-line guard-for-in, no-restricted-syntax
|
||||
for (key in node) {
|
||||
const child = node[key];
|
||||
if (stateClasses.indexOf(key) !== -1 && Object.keys(child).length > 0) {
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
const stateClass = generateUtilityClass('', key);
|
||||
console.error([`MUI: The \`${component}\` component increases ` + `the CSS specificity of the \`${key}\` internal state.`, 'You can not override it like this: ', JSON.stringify(node, null, 2), '', `Instead, you need to use the '&.${stateClass}' syntax:`, JSON.stringify({
|
||||
root: {
|
||||
[`&.${stateClass}`]: child
|
||||
}
|
||||
}, null, 2), '', 'https://mui.com/r/state-classes-guide'].join('\n'));
|
||||
}
|
||||
// Remove the style to prevent global conflicts.
|
||||
node[key] = {};
|
||||
}
|
||||
}
|
||||
};
|
||||
Object.keys(muiTheme.components).forEach(component => {
|
||||
const styleOverrides = muiTheme.components[component].styleOverrides;
|
||||
if (styleOverrides && component.indexOf('Mui') === 0) {
|
||||
traverse(styleOverrides, component);
|
||||
}
|
||||
});
|
||||
}
|
||||
muiTheme.unstable_sxConfig = _extends({}, defaultSxConfig, other == null ? void 0 : other.unstable_sxConfig);
|
||||
muiTheme.unstable_sx = function sx(props) {
|
||||
return styleFunctionSx({
|
||||
sx: props,
|
||||
theme: this
|
||||
});
|
||||
};
|
||||
return muiTheme;
|
||||
}
|
||||
let warnedOnce = false;
|
||||
export function createMuiTheme(...args) {
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
if (!warnedOnce) {
|
||||
warnedOnce = true;
|
||||
console.error(['MUI: the createMuiTheme function was renamed to createTheme.', '', "You should use `import { createTheme } from '@mui/material/styles'`"].join('\n'));
|
||||
}
|
||||
}
|
||||
return createTheme(...args);
|
||||
}
|
||||
export default createTheme;
|
||||
+88
@@ -0,0 +1,88 @@
|
||||
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
||||
import _extends from "@babel/runtime/helpers/esm/extends";
|
||||
const _excluded = ["duration", "easing", "delay"];
|
||||
// Follow https://material.google.com/motion/duration-easing.html#duration-easing-natural-easing-curves
|
||||
// to learn the context in which each easing should be used.
|
||||
export const easing = {
|
||||
// This is the most common easing curve.
|
||||
easeInOut: 'cubic-bezier(0.4, 0, 0.2, 1)',
|
||||
// Objects enter the screen at full velocity from off-screen and
|
||||
// slowly decelerate to a resting point.
|
||||
easeOut: 'cubic-bezier(0.0, 0, 0.2, 1)',
|
||||
// Objects leave the screen at full velocity. They do not decelerate when off-screen.
|
||||
easeIn: 'cubic-bezier(0.4, 0, 1, 1)',
|
||||
// The sharp curve is used by objects that may return to the screen at any time.
|
||||
sharp: 'cubic-bezier(0.4, 0, 0.6, 1)'
|
||||
};
|
||||
|
||||
// Follow https://m2.material.io/guidelines/motion/duration-easing.html#duration-easing-common-durations
|
||||
// to learn when use what timing
|
||||
export const duration = {
|
||||
shortest: 150,
|
||||
shorter: 200,
|
||||
short: 250,
|
||||
// most basic recommended timing
|
||||
standard: 300,
|
||||
// this is to be used in complex animations
|
||||
complex: 375,
|
||||
// recommended when something is entering screen
|
||||
enteringScreen: 225,
|
||||
// recommended when something is leaving screen
|
||||
leavingScreen: 195
|
||||
};
|
||||
function formatMs(milliseconds) {
|
||||
return `${Math.round(milliseconds)}ms`;
|
||||
}
|
||||
function getAutoHeightDuration(height) {
|
||||
if (!height) {
|
||||
return 0;
|
||||
}
|
||||
const constant = height / 36;
|
||||
|
||||
// https://www.wolframalpha.com/input/?i=(4+%2B+15+*+(x+%2F+36+)+**+0.25+%2B+(x+%2F+36)+%2F+5)+*+10
|
||||
return Math.round((4 + 15 * constant ** 0.25 + constant / 5) * 10);
|
||||
}
|
||||
export default function createTransitions(inputTransitions) {
|
||||
const mergedEasing = _extends({}, easing, inputTransitions.easing);
|
||||
const mergedDuration = _extends({}, duration, inputTransitions.duration);
|
||||
const create = (props = ['all'], options = {}) => {
|
||||
const {
|
||||
duration: durationOption = mergedDuration.standard,
|
||||
easing: easingOption = mergedEasing.easeInOut,
|
||||
delay = 0
|
||||
} = options,
|
||||
other = _objectWithoutPropertiesLoose(options, _excluded);
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
const isString = value => typeof value === 'string';
|
||||
// IE11 support, replace with Number.isNaN
|
||||
// eslint-disable-next-line no-restricted-globals
|
||||
const isNumber = value => !isNaN(parseFloat(value));
|
||||
if (!isString(props) && !Array.isArray(props)) {
|
||||
console.error('MUI: Argument "props" must be a string or Array.');
|
||||
}
|
||||
if (!isNumber(durationOption) && !isString(durationOption)) {
|
||||
console.error(`MUI: Argument "duration" must be a number or a string but found ${durationOption}.`);
|
||||
}
|
||||
if (!isString(easingOption)) {
|
||||
console.error('MUI: Argument "easing" must be a string.');
|
||||
}
|
||||
if (!isNumber(delay) && !isString(delay)) {
|
||||
console.error('MUI: Argument "delay" must be a number or a string.');
|
||||
}
|
||||
if (typeof options !== 'object') {
|
||||
console.error(['MUI: Secong argument of transition.create must be an object.', "Arguments should be either `create('prop1', options)` or `create(['prop1', 'prop2'], options)`"].join('\n'));
|
||||
}
|
||||
if (Object.keys(other).length !== 0) {
|
||||
console.error(`MUI: Unrecognized argument(s) [${Object.keys(other).join(',')}].`);
|
||||
}
|
||||
}
|
||||
return (Array.isArray(props) ? props : [props]).map(animatedProp => `${animatedProp} ${typeof durationOption === 'string' ? durationOption : formatMs(durationOption)} ${easingOption} ${typeof delay === 'string' ? delay : formatMs(delay)}`).join(',');
|
||||
};
|
||||
return _extends({
|
||||
getAutoHeightDuration,
|
||||
create
|
||||
}, inputTransitions, {
|
||||
easing: mergedEasing,
|
||||
duration: mergedDuration
|
||||
});
|
||||
}
|
||||
+90
@@ -0,0 +1,90 @@
|
||||
import _extends from "@babel/runtime/helpers/esm/extends";
|
||||
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
||||
const _excluded = ["fontFamily", "fontSize", "fontWeightLight", "fontWeightRegular", "fontWeightMedium", "fontWeightBold", "htmlFontSize", "allVariants", "pxToRem"];
|
||||
import deepmerge from '@mui/utils/deepmerge';
|
||||
function round(value) {
|
||||
return Math.round(value * 1e5) / 1e5;
|
||||
}
|
||||
const caseAllCaps = {
|
||||
textTransform: 'uppercase'
|
||||
};
|
||||
const defaultFontFamily = '"Roboto", "Helvetica", "Arial", sans-serif';
|
||||
|
||||
/**
|
||||
* @see @link{https://m2.material.io/design/typography/the-type-system.html}
|
||||
* @see @link{https://m2.material.io/design/typography/understanding-typography.html}
|
||||
*/
|
||||
export default function createTypography(palette, typography) {
|
||||
const _ref = typeof typography === 'function' ? typography(palette) : typography,
|
||||
{
|
||||
fontFamily = defaultFontFamily,
|
||||
// The default font size of the Material Specification.
|
||||
fontSize = 14,
|
||||
// px
|
||||
fontWeightLight = 300,
|
||||
fontWeightRegular = 400,
|
||||
fontWeightMedium = 500,
|
||||
fontWeightBold = 700,
|
||||
// Tell MUI what's the font-size on the html element.
|
||||
// 16px is the default font-size used by browsers.
|
||||
htmlFontSize = 16,
|
||||
// Apply the CSS properties to all the variants.
|
||||
allVariants,
|
||||
pxToRem: pxToRem2
|
||||
} = _ref,
|
||||
other = _objectWithoutPropertiesLoose(_ref, _excluded);
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
if (typeof fontSize !== 'number') {
|
||||
console.error('MUI: `fontSize` is required to be a number.');
|
||||
}
|
||||
if (typeof htmlFontSize !== 'number') {
|
||||
console.error('MUI: `htmlFontSize` is required to be a number.');
|
||||
}
|
||||
}
|
||||
const coef = fontSize / 14;
|
||||
const pxToRem = pxToRem2 || (size => `${size / htmlFontSize * coef}rem`);
|
||||
const buildVariant = (fontWeight, size, lineHeight, letterSpacing, casing) => _extends({
|
||||
fontFamily,
|
||||
fontWeight,
|
||||
fontSize: pxToRem(size),
|
||||
// Unitless following https://meyerweb.com/eric/thoughts/2006/02/08/unitless-line-heights/
|
||||
lineHeight
|
||||
}, fontFamily === defaultFontFamily ? {
|
||||
letterSpacing: `${round(letterSpacing / size)}em`
|
||||
} : {}, casing, allVariants);
|
||||
const variants = {
|
||||
h1: buildVariant(fontWeightLight, 96, 1.167, -1.5),
|
||||
h2: buildVariant(fontWeightLight, 60, 1.2, -0.5),
|
||||
h3: buildVariant(fontWeightRegular, 48, 1.167, 0),
|
||||
h4: buildVariant(fontWeightRegular, 34, 1.235, 0.25),
|
||||
h5: buildVariant(fontWeightRegular, 24, 1.334, 0),
|
||||
h6: buildVariant(fontWeightMedium, 20, 1.6, 0.15),
|
||||
subtitle1: buildVariant(fontWeightRegular, 16, 1.75, 0.15),
|
||||
subtitle2: buildVariant(fontWeightMedium, 14, 1.57, 0.1),
|
||||
body1: buildVariant(fontWeightRegular, 16, 1.5, 0.15),
|
||||
body2: buildVariant(fontWeightRegular, 14, 1.43, 0.15),
|
||||
button: buildVariant(fontWeightMedium, 14, 1.75, 0.4, caseAllCaps),
|
||||
caption: buildVariant(fontWeightRegular, 12, 1.66, 0.4),
|
||||
overline: buildVariant(fontWeightRegular, 12, 2.66, 1, caseAllCaps),
|
||||
// TODO v6: Remove handling of 'inherit' variant from the theme as it is already handled in Material UI's Typography component. Also, remember to remove the associated types.
|
||||
inherit: {
|
||||
fontFamily: 'inherit',
|
||||
fontWeight: 'inherit',
|
||||
fontSize: 'inherit',
|
||||
lineHeight: 'inherit',
|
||||
letterSpacing: 'inherit'
|
||||
}
|
||||
};
|
||||
return deepmerge(_extends({
|
||||
htmlFontSize,
|
||||
pxToRem,
|
||||
fontFamily,
|
||||
fontSize,
|
||||
fontWeightLight,
|
||||
fontWeightRegular,
|
||||
fontWeightMedium,
|
||||
fontWeightBold
|
||||
}, variants), other, {
|
||||
clone: false // No need to clone deep
|
||||
});
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
'use client';
|
||||
|
||||
import createTheme from './createTheme';
|
||||
const defaultTheme = createTheme();
|
||||
export default defaultTheme;
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
// Inspired by https://github.com/material-components/material-components-ios/blob/bca36107405594d5b7b16265a5b0ed698f85a5ee/components/Elevation/src/UIColor%2BMaterialElevation.m#L61
|
||||
const getOverlayAlpha = elevation => {
|
||||
let alphaValue;
|
||||
if (elevation < 1) {
|
||||
alphaValue = 5.11916 * elevation ** 2;
|
||||
} else {
|
||||
alphaValue = 4.5 * Math.log(elevation + 1) + 2;
|
||||
}
|
||||
return (alphaValue / 100).toFixed(2);
|
||||
};
|
||||
export default getOverlayAlpha;
|
||||
+1
@@ -0,0 +1 @@
|
||||
export default '$$material';
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
import slotShouldForwardProp from './slotShouldForwardProp';
|
||||
const rootShouldForwardProp = prop => slotShouldForwardProp(prop) && prop !== 'classes';
|
||||
export default rootShouldForwardProp;
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
const shadowKeyUmbraOpacity = 0.2;
|
||||
const shadowKeyPenumbraOpacity = 0.14;
|
||||
const shadowAmbientShadowOpacity = 0.12;
|
||||
function createShadow(...px) {
|
||||
return [`${px[0]}px ${px[1]}px ${px[2]}px ${px[3]}px rgba(0,0,0,${shadowKeyUmbraOpacity})`, `${px[4]}px ${px[5]}px ${px[6]}px ${px[7]}px rgba(0,0,0,${shadowKeyPenumbraOpacity})`, `${px[8]}px ${px[9]}px ${px[10]}px ${px[11]}px rgba(0,0,0,${shadowAmbientShadowOpacity})`].join(',');
|
||||
}
|
||||
|
||||
// Values from https://github.com/material-components/material-components-web/blob/be8747f94574669cb5e7add1a7c54fa41a89cec7/packages/mdc-elevation/_variables.scss
|
||||
const shadows = ['none', createShadow(0, 2, 1, -1, 0, 1, 1, 0, 0, 1, 3, 0), createShadow(0, 3, 1, -2, 0, 2, 2, 0, 0, 1, 5, 0), createShadow(0, 3, 3, -2, 0, 3, 4, 0, 0, 1, 8, 0), createShadow(0, 2, 4, -1, 0, 4, 5, 0, 0, 1, 10, 0), createShadow(0, 3, 5, -1, 0, 5, 8, 0, 0, 1, 14, 0), createShadow(0, 3, 5, -1, 0, 6, 10, 0, 0, 1, 18, 0), createShadow(0, 4, 5, -2, 0, 7, 10, 1, 0, 2, 16, 1), createShadow(0, 5, 5, -3, 0, 8, 10, 1, 0, 3, 14, 2), createShadow(0, 5, 6, -3, 0, 9, 12, 1, 0, 3, 16, 2), createShadow(0, 6, 6, -3, 0, 10, 14, 1, 0, 4, 18, 3), createShadow(0, 6, 7, -4, 0, 11, 15, 1, 0, 4, 20, 3), createShadow(0, 7, 8, -4, 0, 12, 17, 2, 0, 5, 22, 4), createShadow(0, 7, 8, -4, 0, 13, 19, 2, 0, 5, 24, 4), createShadow(0, 7, 9, -4, 0, 14, 21, 2, 0, 5, 26, 4), createShadow(0, 8, 9, -5, 0, 15, 22, 2, 0, 6, 28, 5), createShadow(0, 8, 10, -5, 0, 16, 24, 2, 0, 6, 30, 5), createShadow(0, 8, 11, -5, 0, 17, 26, 2, 0, 6, 32, 5), createShadow(0, 9, 11, -5, 0, 18, 28, 2, 0, 7, 34, 6), createShadow(0, 9, 12, -6, 0, 19, 29, 2, 0, 7, 36, 6), createShadow(0, 10, 13, -6, 0, 20, 31, 3, 0, 8, 38, 7), createShadow(0, 10, 13, -6, 0, 21, 33, 3, 0, 8, 40, 7), createShadow(0, 10, 14, -6, 0, 22, 35, 3, 0, 8, 42, 7), createShadow(0, 11, 14, -7, 0, 23, 36, 3, 0, 9, 44, 8), createShadow(0, 11, 15, -7, 0, 24, 38, 3, 0, 9, 46, 8)];
|
||||
export default shadows;
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
// copied from @mui/system/createStyled
|
||||
function slotShouldForwardProp(prop) {
|
||||
return prop !== 'ownerState' && prop !== 'theme' && prop !== 'sx' && prop !== 'as';
|
||||
}
|
||||
export default slotShouldForwardProp;
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
'use client';
|
||||
|
||||
import createStyled from '@mui/system/createStyled';
|
||||
import defaultTheme from './defaultTheme';
|
||||
import THEME_ID from './identifier';
|
||||
import rootShouldForwardProp from './rootShouldForwardProp';
|
||||
export { default as slotShouldForwardProp } from './slotShouldForwardProp';
|
||||
export { default as rootShouldForwardProp } from './rootShouldForwardProp';
|
||||
const styled = createStyled({
|
||||
themeId: THEME_ID,
|
||||
defaultTheme,
|
||||
rootShouldForwardProp
|
||||
});
|
||||
export default styled;
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
'use client';
|
||||
|
||||
import * as React from 'react';
|
||||
import { useTheme as useThemeSystem } from '@mui/system';
|
||||
import defaultTheme from './defaultTheme';
|
||||
import THEME_ID from './identifier';
|
||||
export default function useTheme() {
|
||||
const theme = useThemeSystem(defaultTheme);
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
// eslint-disable-next-line react-hooks/rules-of-hooks
|
||||
React.useDebugValue(theme);
|
||||
}
|
||||
return theme[THEME_ID] || theme;
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
'use client';
|
||||
|
||||
import systemUseThemeProps from '@mui/system/useThemeProps';
|
||||
import defaultTheme from './defaultTheme';
|
||||
import THEME_ID from './identifier';
|
||||
export default function useThemeProps({
|
||||
props,
|
||||
name
|
||||
}) {
|
||||
return systemUseThemeProps({
|
||||
props,
|
||||
name,
|
||||
defaultTheme,
|
||||
themeId: THEME_ID
|
||||
});
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// We need to centralize the zIndex definitions as they work
|
||||
// like global values in the browser.
|
||||
const zIndex = {
|
||||
mobileStepper: 1000,
|
||||
fab: 1050,
|
||||
speedDial: 1050,
|
||||
appBar: 1100,
|
||||
drawer: 1200,
|
||||
modal: 1300,
|
||||
snackbar: 1400,
|
||||
tooltip: 1500
|
||||
};
|
||||
export default zIndex;
|
||||
Reference in New Issue
Block a user