Initial commit: Crypto trader application

This commit is contained in:
2025-12-25 20:20:40 -05:00
commit 07a04c1bb8
47895 changed files with 2042266 additions and 0 deletions

View File

@@ -0,0 +1,55 @@
'use client';
// do not remove the following import (https://github.com/microsoft/TypeScript/issues/29808#issuecomment-1320713018)
/* eslint-disable @typescript-eslint/no-unused-vars */
// @ts-ignore
import _extends from "@babel/runtime/helpers/esm/extends";
import { unstable_createCssVarsProvider as createCssVarsProvider } from '@mui/system';
import styleFunctionSx from '@mui/system/styleFunctionSx';
import experimental_extendTheme from './experimental_extendTheme';
import createTypography from './createTypography';
import excludeVariablesFromRoot from './excludeVariablesFromRoot';
import THEME_ID from './identifier';
import { defaultConfig } from '../InitColorSchemeScript/InitColorSchemeScript';
const defaultTheme = experimental_extendTheme();
const {
CssVarsProvider,
useColorScheme,
getInitColorSchemeScript: getInitColorSchemeScriptSystem
} = createCssVarsProvider({
themeId: THEME_ID,
theme: defaultTheme,
attribute: defaultConfig.attribute,
colorSchemeStorageKey: defaultConfig.colorSchemeStorageKey,
modeStorageKey: defaultConfig.modeStorageKey,
defaultColorScheme: {
light: defaultConfig.defaultLightColorScheme,
dark: defaultConfig.defaultDarkColorScheme
},
resolveTheme: theme => {
const newTheme = _extends({}, theme, {
typography: createTypography(theme.palette, theme.typography)
});
newTheme.unstable_sx = function sx(props) {
return styleFunctionSx({
sx: props,
theme: this
});
};
return newTheme;
},
excludeVariablesFromRoot
});
/**
* @deprecated Use `InitColorSchemeScript` instead
* ```diff
* - import { getInitColorSchemeScript } from '@mui/material/styles';
* + import InitColorSchemeScript from '@mui/material/InitColorSchemeScript';
*
* - getInitColorSchemeScript();
* + <InitColorSchemeScript />;
* ```
*/
export const getInitColorSchemeScript = getInitColorSchemeScriptSystem;
export { useColorScheme, CssVarsProvider as Experimental_CssVarsProvider };

View File

@@ -0,0 +1,43 @@
'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];
let finalTheme = scopedTheme || themeInput;
if (typeof themeInput !== 'function') {
if (scopedTheme && !scopedTheme.vars) {
finalTheme = _extends({}, scopedTheme, {
vars: null
});
} else if (themeInput && !themeInput.vars) {
finalTheme = _extends({}, themeInput, {
vars: null
});
}
}
return /*#__PURE__*/_jsx(SystemThemeProvider, _extends({}, props, {
themeId: scopedTheme ? THEME_ID : undefined,
theme: finalTheme
}));
}
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;

View File

@@ -0,0 +1,81 @@
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;
}

View File

@@ -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);
}

View File

@@ -0,0 +1,7 @@
import deepmerge from '@mui/utils/deepmerge';
import createTheme from './createTheme';
export default function createMuiStrictModeTheme(options, ...args) {
return createTheme(deepmerge({
unstable_strictMode: true
}, options), ...args);
}

View File

@@ -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;
}

View File

@@ -0,0 +1,10 @@
let warnedOnce = false;
// To remove in v6
export default function createStyles(styles) {
if (!warnedOnce) {
console.warn(['MUI: createStyles from @mui/material/styles is deprecated.', 'Please use @mui/styles/createStyles'].join('\n'));
warnedOnce = true;
}
return styles;
}

View File

@@ -0,0 +1,92 @@
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 &&
// The error should throw only for the root theme creation because user is not allowed to use a custom node `vars`.
// `generateCssVars` is the closest identifier for checking that the `options` is a result of `extendTheme` with CSS variables so that user can create new theme for nested ThemeProvider.
options.generateCssVars === undefined) {
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?.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;

View File

@@ -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
});
}

View File

@@ -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
});
}

View File

@@ -0,0 +1,125 @@
export function isUnitless(value) {
return String(parseFloat(value)).length === String(value).length;
}
// Ported from Compass
// https://github.com/Compass/compass/blob/master/core/stylesheets/compass/typography/_units.scss
// Emulate the sass function "unit"
export function getUnit(input) {
return String(input).match(/[\d.\-+]*\s*(.*)/)[1] || '';
}
// Emulate the sass function "unitless"
export function toUnitless(length) {
return parseFloat(length);
}
// Convert any CSS <length> or <percentage> value to any another.
// From https://github.com/KyleAMathews/convert-css-length
export function convertLength(baseFontSize) {
return (length, toUnit) => {
const fromUnit = getUnit(length);
// Optimize for cases where `from` and `to` units are accidentally the same.
if (fromUnit === toUnit) {
return length;
}
// Convert input length to pixels.
let pxLength = toUnitless(length);
if (fromUnit !== 'px') {
if (fromUnit === 'em') {
pxLength = toUnitless(length) * toUnitless(baseFontSize);
} else if (fromUnit === 'rem') {
pxLength = toUnitless(length) * toUnitless(baseFontSize);
}
}
// Convert length in pixels to the output unit
let outputLength = pxLength;
if (toUnit !== 'px') {
if (toUnit === 'em') {
outputLength = pxLength / toUnitless(baseFontSize);
} else if (toUnit === 'rem') {
outputLength = pxLength / toUnitless(baseFontSize);
} else {
return length;
}
}
return parseFloat(outputLength.toFixed(5)) + toUnit;
};
}
export function alignProperty({
size,
grid
}) {
const sizeBelow = size - size % grid;
const sizeAbove = sizeBelow + grid;
return size - sizeBelow < sizeAbove - size ? sizeBelow : sizeAbove;
}
// fontGrid finds a minimal grid (in rem) for the fontSize values so that the
// lineHeight falls under a x pixels grid, 4px in the case of Material Design,
// without changing the relative line height
export function fontGrid({
lineHeight,
pixels,
htmlFontSize
}) {
return pixels / (lineHeight * htmlFontSize);
}
/**
* generate a responsive version of a given CSS property
* @example
* responsiveProperty({
* cssProperty: 'fontSize',
* min: 15,
* max: 20,
* unit: 'px',
* breakpoints: [300, 600],
* })
*
* // this returns
*
* {
* fontSize: '15px',
* '@media (min-width:300px)': {
* fontSize: '17.5px',
* },
* '@media (min-width:600px)': {
* fontSize: '20px',
* },
* }
* @param {Object} params
* @param {string} params.cssProperty - The CSS property to be made responsive
* @param {number} params.min - The smallest value of the CSS property
* @param {number} params.max - The largest value of the CSS property
* @param {string} [params.unit] - The unit to be used for the CSS property
* @param {Array.number} [params.breakpoints] - An array of breakpoints
* @param {number} [params.alignStep] - Round scaled value to fall under this grid
* @returns {Object} responsive styles for {params.cssProperty}
*/
export function responsiveProperty({
cssProperty,
min,
max,
unit = 'rem',
breakpoints = [600, 900, 1200],
transform = null
}) {
const output = {
[cssProperty]: `${min}${unit}`
};
const factor = (max - min) / breakpoints[breakpoints.length - 1];
breakpoints.forEach(breakpoint => {
let value = min + factor * breakpoint;
if (transform !== null) {
value = transform(value);
}
output[`@media (min-width:${breakpoint}px)`] = {
[cssProperty]: `${Math.round(value * 10000) / 10000}${unit}`
};
});
return output;
}

View File

@@ -0,0 +1,5 @@
'use client';
import createTheme from './createTheme';
const defaultTheme = createTheme();
export default defaultTheme;

View File

@@ -0,0 +1,5 @@
/**
* @internal These variables should not appear in the :root stylesheet when the `defaultMode="dark"`
*/
const excludeVariablesFromRoot = cssVarPrefix => [...[...Array(24)].map((_, index) => `--${cssVarPrefix ? `${cssVarPrefix}-` : ''}overlays-${index + 1}`), `--${cssVarPrefix ? `${cssVarPrefix}-` : ''}palette-AppBar-darkBg`, `--${cssVarPrefix ? `${cssVarPrefix}-` : ''}palette-AppBar-darkColor`];
export default excludeVariablesFromRoot;

View File

@@ -0,0 +1,309 @@
import _extends from "@babel/runtime/helpers/esm/extends";
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
const _excluded = ["colorSchemes", "cssVarPrefix", "shouldSkipGeneratingVar"],
_excluded2 = ["palette"];
import deepmerge from '@mui/utils/deepmerge';
import { unstable_createGetCssVar as systemCreateGetCssVar, unstable_prepareCssVars as prepareCssVars } from '@mui/system';
import styleFunctionSx, { unstable_defaultSxConfig as defaultSxConfig } from '@mui/system/styleFunctionSx';
import { private_safeColorChannel as safeColorChannel, private_safeAlpha as safeAlpha, private_safeDarken as safeDarken, private_safeLighten as safeLighten, private_safeEmphasize as safeEmphasize, hslToRgb } from '@mui/system/colorManipulator';
import defaultShouldSkipGeneratingVar from './shouldSkipGeneratingVar';
import createThemeWithoutVars from './createTheme';
import getOverlayAlpha from './getOverlayAlpha';
const defaultDarkOverlays = [...Array(25)].map((_, index) => {
if (index === 0) {
return undefined;
}
const overlay = getOverlayAlpha(index);
return `linear-gradient(rgba(255 255 255 / ${overlay}), rgba(255 255 255 / ${overlay}))`;
});
function assignNode(obj, keys) {
keys.forEach(k => {
if (!obj[k]) {
obj[k] = {};
}
});
}
function setColor(obj, key, defaultValue) {
if (!obj[key] && defaultValue) {
obj[key] = defaultValue;
}
}
function toRgb(color) {
if (!color || !color.startsWith('hsl')) {
return color;
}
return hslToRgb(color);
}
function setColorChannel(obj, key) {
if (!(`${key}Channel` in obj)) {
// custom channel token is not provided, generate one.
// if channel token can't be generated, show a warning.
obj[`${key}Channel`] = safeColorChannel(toRgb(obj[key]), `MUI: Can't create \`palette.${key}Channel\` because \`palette.${key}\` is not one of these formats: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color().` + '\n' + `To suppress this warning, you need to explicitly provide the \`palette.${key}Channel\` as a string (in rgb format, for example "12 12 12") or undefined if you want to remove the channel token.`);
}
}
const silent = fn => {
try {
return fn();
} catch (error) {
// ignore error
}
return undefined;
};
export const createGetCssVar = (cssVarPrefix = 'mui') => systemCreateGetCssVar(cssVarPrefix);
export default function extendTheme(options = {}, ...args) {
const {
colorSchemes: colorSchemesInput = {},
cssVarPrefix = 'mui',
shouldSkipGeneratingVar = defaultShouldSkipGeneratingVar
} = options,
input = _objectWithoutPropertiesLoose(options, _excluded);
const getCssVar = createGetCssVar(cssVarPrefix);
const _createThemeWithoutVa = createThemeWithoutVars(_extends({}, input, colorSchemesInput.light && {
palette: colorSchemesInput.light?.palette
})),
{
palette: lightPalette
} = _createThemeWithoutVa,
muiTheme = _objectWithoutPropertiesLoose(_createThemeWithoutVa, _excluded2);
const {
palette: darkPalette
} = createThemeWithoutVars({
palette: _extends({
mode: 'dark'
}, colorSchemesInput.dark?.palette)
});
let theme = _extends({}, muiTheme, {
cssVarPrefix,
getCssVar,
colorSchemes: _extends({}, colorSchemesInput, {
light: _extends({}, colorSchemesInput.light, {
palette: lightPalette,
opacity: _extends({
inputPlaceholder: 0.42,
inputUnderline: 0.42,
switchTrackDisabled: 0.12,
switchTrack: 0.38
}, colorSchemesInput.light?.opacity),
overlays: colorSchemesInput.light?.overlays || []
}),
dark: _extends({}, colorSchemesInput.dark, {
palette: darkPalette,
opacity: _extends({
inputPlaceholder: 0.5,
inputUnderline: 0.7,
switchTrackDisabled: 0.2,
switchTrack: 0.3
}, colorSchemesInput.dark?.opacity),
overlays: colorSchemesInput.dark?.overlays || defaultDarkOverlays
})
})
});
Object.keys(theme.colorSchemes).forEach(key => {
const palette = theme.colorSchemes[key].palette;
const setCssVarColor = cssVar => {
const tokens = cssVar.split('-');
const color = tokens[1];
const colorToken = tokens[2];
return getCssVar(cssVar, palette[color][colorToken]);
};
// attach black & white channels to common node
if (key === 'light') {
setColor(palette.common, 'background', '#fff');
setColor(palette.common, 'onBackground', '#000');
} else {
setColor(palette.common, 'background', '#000');
setColor(palette.common, 'onBackground', '#fff');
}
// assign component variables
assignNode(palette, ['Alert', 'AppBar', 'Avatar', 'Button', 'Chip', 'FilledInput', 'LinearProgress', 'Skeleton', 'Slider', 'SnackbarContent', 'SpeedDialAction', 'StepConnector', 'StepContent', 'Switch', 'TableCell', 'Tooltip']);
if (key === 'light') {
setColor(palette.Alert, 'errorColor', safeDarken(palette.error.light, 0.6));
setColor(palette.Alert, 'infoColor', safeDarken(palette.info.light, 0.6));
setColor(palette.Alert, 'successColor', safeDarken(palette.success.light, 0.6));
setColor(palette.Alert, 'warningColor', safeDarken(palette.warning.light, 0.6));
setColor(palette.Alert, 'errorFilledBg', setCssVarColor('palette-error-main'));
setColor(palette.Alert, 'infoFilledBg', setCssVarColor('palette-info-main'));
setColor(palette.Alert, 'successFilledBg', setCssVarColor('palette-success-main'));
setColor(palette.Alert, 'warningFilledBg', setCssVarColor('palette-warning-main'));
setColor(palette.Alert, 'errorFilledColor', silent(() => lightPalette.getContrastText(palette.error.main)));
setColor(palette.Alert, 'infoFilledColor', silent(() => lightPalette.getContrastText(palette.info.main)));
setColor(palette.Alert, 'successFilledColor', silent(() => lightPalette.getContrastText(palette.success.main)));
setColor(palette.Alert, 'warningFilledColor', silent(() => lightPalette.getContrastText(palette.warning.main)));
setColor(palette.Alert, 'errorStandardBg', safeLighten(palette.error.light, 0.9));
setColor(palette.Alert, 'infoStandardBg', safeLighten(palette.info.light, 0.9));
setColor(palette.Alert, 'successStandardBg', safeLighten(palette.success.light, 0.9));
setColor(palette.Alert, 'warningStandardBg', safeLighten(palette.warning.light, 0.9));
setColor(palette.Alert, 'errorIconColor', setCssVarColor('palette-error-main'));
setColor(palette.Alert, 'infoIconColor', setCssVarColor('palette-info-main'));
setColor(palette.Alert, 'successIconColor', setCssVarColor('palette-success-main'));
setColor(palette.Alert, 'warningIconColor', setCssVarColor('palette-warning-main'));
setColor(palette.AppBar, 'defaultBg', setCssVarColor('palette-grey-100'));
setColor(palette.Avatar, 'defaultBg', setCssVarColor('palette-grey-400'));
setColor(palette.Button, 'inheritContainedBg', setCssVarColor('palette-grey-300'));
setColor(palette.Button, 'inheritContainedHoverBg', setCssVarColor('palette-grey-A100'));
setColor(palette.Chip, 'defaultBorder', setCssVarColor('palette-grey-400'));
setColor(palette.Chip, 'defaultAvatarColor', setCssVarColor('palette-grey-700'));
setColor(palette.Chip, 'defaultIconColor', setCssVarColor('palette-grey-700'));
setColor(palette.FilledInput, 'bg', 'rgba(0, 0, 0, 0.06)');
setColor(palette.FilledInput, 'hoverBg', 'rgba(0, 0, 0, 0.09)');
setColor(palette.FilledInput, 'disabledBg', 'rgba(0, 0, 0, 0.12)');
setColor(palette.LinearProgress, 'primaryBg', safeLighten(palette.primary.main, 0.62));
setColor(palette.LinearProgress, 'secondaryBg', safeLighten(palette.secondary.main, 0.62));
setColor(palette.LinearProgress, 'errorBg', safeLighten(palette.error.main, 0.62));
setColor(palette.LinearProgress, 'infoBg', safeLighten(palette.info.main, 0.62));
setColor(palette.LinearProgress, 'successBg', safeLighten(palette.success.main, 0.62));
setColor(palette.LinearProgress, 'warningBg', safeLighten(palette.warning.main, 0.62));
setColor(palette.Skeleton, 'bg', `rgba(${setCssVarColor('palette-text-primaryChannel')} / 0.11)`);
setColor(palette.Slider, 'primaryTrack', safeLighten(palette.primary.main, 0.62));
setColor(palette.Slider, 'secondaryTrack', safeLighten(palette.secondary.main, 0.62));
setColor(palette.Slider, 'errorTrack', safeLighten(palette.error.main, 0.62));
setColor(palette.Slider, 'infoTrack', safeLighten(palette.info.main, 0.62));
setColor(palette.Slider, 'successTrack', safeLighten(palette.success.main, 0.62));
setColor(palette.Slider, 'warningTrack', safeLighten(palette.warning.main, 0.62));
const snackbarContentBackground = safeEmphasize(palette.background.default, 0.8);
setColor(palette.SnackbarContent, 'bg', snackbarContentBackground);
setColor(palette.SnackbarContent, 'color', silent(() => lightPalette.getContrastText(snackbarContentBackground)));
setColor(palette.SpeedDialAction, 'fabHoverBg', safeEmphasize(palette.background.paper, 0.15));
setColor(palette.StepConnector, 'border', setCssVarColor('palette-grey-400'));
setColor(palette.StepContent, 'border', setCssVarColor('palette-grey-400'));
setColor(palette.Switch, 'defaultColor', setCssVarColor('palette-common-white'));
setColor(palette.Switch, 'defaultDisabledColor', setCssVarColor('palette-grey-100'));
setColor(palette.Switch, 'primaryDisabledColor', safeLighten(palette.primary.main, 0.62));
setColor(palette.Switch, 'secondaryDisabledColor', safeLighten(palette.secondary.main, 0.62));
setColor(palette.Switch, 'errorDisabledColor', safeLighten(palette.error.main, 0.62));
setColor(palette.Switch, 'infoDisabledColor', safeLighten(palette.info.main, 0.62));
setColor(palette.Switch, 'successDisabledColor', safeLighten(palette.success.main, 0.62));
setColor(palette.Switch, 'warningDisabledColor', safeLighten(palette.warning.main, 0.62));
setColor(palette.TableCell, 'border', safeLighten(safeAlpha(palette.divider, 1), 0.88));
setColor(palette.Tooltip, 'bg', safeAlpha(palette.grey[700], 0.92));
} else {
setColor(palette.Alert, 'errorColor', safeLighten(palette.error.light, 0.6));
setColor(palette.Alert, 'infoColor', safeLighten(palette.info.light, 0.6));
setColor(palette.Alert, 'successColor', safeLighten(palette.success.light, 0.6));
setColor(palette.Alert, 'warningColor', safeLighten(palette.warning.light, 0.6));
setColor(palette.Alert, 'errorFilledBg', setCssVarColor('palette-error-dark'));
setColor(palette.Alert, 'infoFilledBg', setCssVarColor('palette-info-dark'));
setColor(palette.Alert, 'successFilledBg', setCssVarColor('palette-success-dark'));
setColor(palette.Alert, 'warningFilledBg', setCssVarColor('palette-warning-dark'));
setColor(palette.Alert, 'errorFilledColor', silent(() => darkPalette.getContrastText(palette.error.dark)));
setColor(palette.Alert, 'infoFilledColor', silent(() => darkPalette.getContrastText(palette.info.dark)));
setColor(palette.Alert, 'successFilledColor', silent(() => darkPalette.getContrastText(palette.success.dark)));
setColor(palette.Alert, 'warningFilledColor', silent(() => darkPalette.getContrastText(palette.warning.dark)));
setColor(palette.Alert, 'errorStandardBg', safeDarken(palette.error.light, 0.9));
setColor(palette.Alert, 'infoStandardBg', safeDarken(palette.info.light, 0.9));
setColor(palette.Alert, 'successStandardBg', safeDarken(palette.success.light, 0.9));
setColor(palette.Alert, 'warningStandardBg', safeDarken(palette.warning.light, 0.9));
setColor(palette.Alert, 'errorIconColor', setCssVarColor('palette-error-main'));
setColor(palette.Alert, 'infoIconColor', setCssVarColor('palette-info-main'));
setColor(palette.Alert, 'successIconColor', setCssVarColor('palette-success-main'));
setColor(palette.Alert, 'warningIconColor', setCssVarColor('palette-warning-main'));
setColor(palette.AppBar, 'defaultBg', setCssVarColor('palette-grey-900'));
setColor(palette.AppBar, 'darkBg', setCssVarColor('palette-background-paper')); // specific for dark mode
setColor(palette.AppBar, 'darkColor', setCssVarColor('palette-text-primary')); // specific for dark mode
setColor(palette.Avatar, 'defaultBg', setCssVarColor('palette-grey-600'));
setColor(palette.Button, 'inheritContainedBg', setCssVarColor('palette-grey-800'));
setColor(palette.Button, 'inheritContainedHoverBg', setCssVarColor('palette-grey-700'));
setColor(palette.Chip, 'defaultBorder', setCssVarColor('palette-grey-700'));
setColor(palette.Chip, 'defaultAvatarColor', setCssVarColor('palette-grey-300'));
setColor(palette.Chip, 'defaultIconColor', setCssVarColor('palette-grey-300'));
setColor(palette.FilledInput, 'bg', 'rgba(255, 255, 255, 0.09)');
setColor(palette.FilledInput, 'hoverBg', 'rgba(255, 255, 255, 0.13)');
setColor(palette.FilledInput, 'disabledBg', 'rgba(255, 255, 255, 0.12)');
setColor(palette.LinearProgress, 'primaryBg', safeDarken(palette.primary.main, 0.5));
setColor(palette.LinearProgress, 'secondaryBg', safeDarken(palette.secondary.main, 0.5));
setColor(palette.LinearProgress, 'errorBg', safeDarken(palette.error.main, 0.5));
setColor(palette.LinearProgress, 'infoBg', safeDarken(palette.info.main, 0.5));
setColor(palette.LinearProgress, 'successBg', safeDarken(palette.success.main, 0.5));
setColor(palette.LinearProgress, 'warningBg', safeDarken(palette.warning.main, 0.5));
setColor(palette.Skeleton, 'bg', `rgba(${setCssVarColor('palette-text-primaryChannel')} / 0.13)`);
setColor(palette.Slider, 'primaryTrack', safeDarken(palette.primary.main, 0.5));
setColor(palette.Slider, 'secondaryTrack', safeDarken(palette.secondary.main, 0.5));
setColor(palette.Slider, 'errorTrack', safeDarken(palette.error.main, 0.5));
setColor(palette.Slider, 'infoTrack', safeDarken(palette.info.main, 0.5));
setColor(palette.Slider, 'successTrack', safeDarken(palette.success.main, 0.5));
setColor(palette.Slider, 'warningTrack', safeDarken(palette.warning.main, 0.5));
const snackbarContentBackground = safeEmphasize(palette.background.default, 0.98);
setColor(palette.SnackbarContent, 'bg', snackbarContentBackground);
setColor(palette.SnackbarContent, 'color', silent(() => darkPalette.getContrastText(snackbarContentBackground)));
setColor(palette.SpeedDialAction, 'fabHoverBg', safeEmphasize(palette.background.paper, 0.15));
setColor(palette.StepConnector, 'border', setCssVarColor('palette-grey-600'));
setColor(palette.StepContent, 'border', setCssVarColor('palette-grey-600'));
setColor(palette.Switch, 'defaultColor', setCssVarColor('palette-grey-300'));
setColor(palette.Switch, 'defaultDisabledColor', setCssVarColor('palette-grey-600'));
setColor(palette.Switch, 'primaryDisabledColor', safeDarken(palette.primary.main, 0.55));
setColor(palette.Switch, 'secondaryDisabledColor', safeDarken(palette.secondary.main, 0.55));
setColor(palette.Switch, 'errorDisabledColor', safeDarken(palette.error.main, 0.55));
setColor(palette.Switch, 'infoDisabledColor', safeDarken(palette.info.main, 0.55));
setColor(palette.Switch, 'successDisabledColor', safeDarken(palette.success.main, 0.55));
setColor(palette.Switch, 'warningDisabledColor', safeDarken(palette.warning.main, 0.55));
setColor(palette.TableCell, 'border', safeDarken(safeAlpha(palette.divider, 1), 0.68));
setColor(palette.Tooltip, 'bg', safeAlpha(palette.grey[700], 0.92));
}
// MUI X - DataGrid needs this token.
setColorChannel(palette.background, 'default');
// added for consistency with the `background.default` token
setColorChannel(palette.background, 'paper');
setColorChannel(palette.common, 'background');
setColorChannel(palette.common, 'onBackground');
setColorChannel(palette, 'divider');
Object.keys(palette).forEach(color => {
const colors = palette[color];
// The default palettes (primary, secondary, error, info, success, and warning) errors are handled by the above `createTheme(...)`.
if (colors && typeof colors === 'object') {
// Silent the error for custom palettes.
if (colors.main) {
setColor(palette[color], 'mainChannel', safeColorChannel(toRgb(colors.main)));
}
if (colors.light) {
setColor(palette[color], 'lightChannel', safeColorChannel(toRgb(colors.light)));
}
if (colors.dark) {
setColor(palette[color], 'darkChannel', safeColorChannel(toRgb(colors.dark)));
}
if (colors.contrastText) {
setColor(palette[color], 'contrastTextChannel', safeColorChannel(toRgb(colors.contrastText)));
}
if (color === 'text') {
// Text colors: text.primary, text.secondary
setColorChannel(palette[color], 'primary');
setColorChannel(palette[color], 'secondary');
}
if (color === 'action') {
// Action colors: action.active, action.selected
if (colors.active) {
setColorChannel(palette[color], 'active');
}
if (colors.selected) {
setColorChannel(palette[color], 'selected');
}
}
}
});
});
theme = args.reduce((acc, argument) => deepmerge(acc, argument), theme);
const parserConfig = {
prefix: cssVarPrefix,
shouldSkipGeneratingVar
};
const {
vars: themeVars,
generateCssVars
} = prepareCssVars(theme, parserConfig);
theme.vars = themeVars;
theme.generateCssVars = generateCssVars;
theme.shouldSkipGeneratingVar = shouldSkipGeneratingVar;
theme.unstable_sxConfig = _extends({}, defaultSxConfig, input?.unstable_sxConfig);
theme.unstable_sx = function sx(props) {
return styleFunctionSx({
sx: props,
theme: this
});
};
return theme;
}

View File

@@ -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;

View File

@@ -0,0 +1 @@
export default '$$material';

View File

@@ -0,0 +1,37 @@
'use client';
import _formatMuiErrorMessage from "@mui/utils/formatMuiErrorMessage";
export { default as THEME_ID } from './identifier';
export { default as adaptV4Theme } from './adaptV4Theme';
export { hexToRgb, rgbToHex, hslToRgb, decomposeColor, recomposeColor, getContrastRatio, getLuminance, emphasize, alpha, darken, lighten, css, keyframes } from '@mui/system';
// TODO: Remove this function in v6.
// eslint-disable-next-line @typescript-eslint/naming-convention
export function experimental_sx() {
throw new Error(process.env.NODE_ENV !== "production" ? `MUI: The \`experimental_sx\` has been moved to \`theme.unstable_sx\`.For more details, see https://github.com/mui/material-ui/pull/35150.` : _formatMuiErrorMessage(20));
}
export { default as createTheme, createMuiTheme } from './createTheme';
export { default as unstable_createMuiStrictModeTheme } from './createMuiStrictModeTheme';
export { default as createStyles } from './createStyles';
export { getUnit as unstable_getUnit, toUnitless as unstable_toUnitless } from './cssUtils';
export { default as responsiveFontSizes } from './responsiveFontSizes';
export { duration, easing } from './createTransitions';
export { default as useTheme } from './useTheme';
export { default as useThemeProps } from './useThemeProps';
export { default as styled } from './styled';
export { default as experimentalStyled } from './styled';
export { default as ThemeProvider } from './ThemeProvider';
export { StyledEngineProvider } from '@mui/system';
// The legacy utilities from @mui/styles
// These are just empty functions that throws when invoked
export { default as makeStyles } from './makeStyles';
export { default as withStyles } from './withStyles';
export { default as withTheme } from './withTheme';
export * from './CssVarsProvider';
export { default as experimental_extendTheme } from './experimental_extendTheme';
export { default as getOverlayAlpha } from './getOverlayAlpha';
export { default as shouldSkipGeneratingVar } from './shouldSkipGeneratingVar';
// Private methods for creating parts of the theme
export { default as private_createTypography } from './createTypography';
export { default as private_createMixins } from './createMixins';
export { default as private_excludeVariablesFromRoot } from './excludeVariablesFromRoot';

View File

@@ -0,0 +1,6 @@
import _formatMuiErrorMessage from "@mui/utils/formatMuiErrorMessage";
export default function makeStyles() {
throw new Error(process.env.NODE_ENV !== "production" ? `MUI: makeStyles is no longer exported from @mui/material/styles.
You have to import it from @mui/styles.
See https://mui.com/r/migration-v4/#mui-material-styles for more details.` : _formatMuiErrorMessage(14));
}

View File

@@ -0,0 +1,62 @@
import _extends from "@babel/runtime/helpers/esm/extends";
import _formatMuiErrorMessage from "@mui/utils/formatMuiErrorMessage";
import { isUnitless, convertLength, responsiveProperty, alignProperty, fontGrid } from './cssUtils';
export default function responsiveFontSizes(themeInput, options = {}) {
const {
breakpoints = ['sm', 'md', 'lg'],
disableAlign = false,
factor = 2,
variants = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'subtitle1', 'subtitle2', 'body1', 'body2', 'caption', 'button', 'overline']
} = options;
const theme = _extends({}, themeInput);
theme.typography = _extends({}, theme.typography);
const typography = theme.typography;
// Convert between CSS lengths e.g. em->px or px->rem
// Set the baseFontSize for your project. Defaults to 16px (also the browser default).
const convert = convertLength(typography.htmlFontSize);
const breakpointValues = breakpoints.map(x => theme.breakpoints.values[x]);
variants.forEach(variant => {
const style = typography[variant];
if (!style) {
return;
}
const remFontSize = parseFloat(convert(style.fontSize, 'rem'));
if (remFontSize <= 1) {
return;
}
const maxFontSize = remFontSize;
const minFontSize = 1 + (maxFontSize - 1) / factor;
let {
lineHeight
} = style;
if (!isUnitless(lineHeight) && !disableAlign) {
throw new Error(process.env.NODE_ENV !== "production" ? `MUI: Unsupported non-unitless line height with grid alignment.
Use unitless line heights instead.` : _formatMuiErrorMessage(6));
}
if (!isUnitless(lineHeight)) {
// make it unitless
lineHeight = parseFloat(convert(lineHeight, 'rem')) / parseFloat(remFontSize);
}
let transform = null;
if (!disableAlign) {
transform = value => alignProperty({
size: value,
grid: fontGrid({
pixels: 4,
lineHeight,
htmlFontSize: typography.htmlFontSize
})
});
}
typography[variant] = _extends({}, style, responsiveProperty({
cssProperty: 'fontSize',
min: minFontSize,
max: maxFontSize,
unit: 'rem',
breakpoints: breakpointValues,
transform
}));
});
return theme;
}

View File

@@ -0,0 +1,3 @@
import slotShouldForwardProp from './slotShouldForwardProp';
const rootShouldForwardProp = prop => slotShouldForwardProp(prop) && prop !== 'classes';
export default rootShouldForwardProp;

View File

@@ -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;

View File

@@ -0,0 +1,5 @@
export default function shouldSkipGeneratingVar(keys) {
return !!keys[0].match(/(cssVarPrefix|modularCssLayers|typography|mixins|breakpoints|direction|transitions)/) || !!keys[0].match(/sxConfig$/) ||
// ends with sxConfig
keys[0] === 'palette' && !!keys[1]?.match(/(mode|contrastThreshold|tonalOffset)/);
}

View File

@@ -0,0 +1,5 @@
// copied from @mui/system/createStyled
function slotShouldForwardProp(prop) {
return prop !== 'ownerState' && prop !== 'theme' && prop !== 'sx' && prop !== 'as';
}
export default slotShouldForwardProp;

View File

@@ -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;

View File

@@ -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;
}

View File

@@ -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
});
}

View File

@@ -0,0 +1,6 @@
import _formatMuiErrorMessage from "@mui/utils/formatMuiErrorMessage";
export default function withStyles() {
throw new Error(process.env.NODE_ENV !== "production" ? `MUI: withStyles is no longer exported from @mui/material/styles.
You have to import it from @mui/styles.
See https://mui.com/r/migration-v4/#mui-material-styles for more details.` : _formatMuiErrorMessage(15));
}

View File

@@ -0,0 +1,6 @@
import _formatMuiErrorMessage from "@mui/utils/formatMuiErrorMessage";
export default function withTheme() {
throw new Error(process.env.NODE_ENV !== "production" ? `MUI: withTheme is no longer exported from @mui/material/styles.
You have to import it from @mui/styles.
See https://mui.com/r/migration-v4/#mui-material-styles for more details.` : _formatMuiErrorMessage(16));
}

View File

@@ -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;