Jesus sucks
This commit is contained in:
293
backend/frontend/node_modules/@mui/system/legacy/styleFunctionSx/defaultSxConfig.js
generated
vendored
Normal file
293
backend/frontend/node_modules/@mui/system/legacy/styleFunctionSx/defaultSxConfig.js
generated
vendored
Normal file
@@ -0,0 +1,293 @@
|
||||
import { padding, margin } from '../spacing';
|
||||
import { borderRadius, borderTransform } from '../borders';
|
||||
import { gap, rowGap, columnGap } from '../cssGrid';
|
||||
import { paletteTransform } from '../palette';
|
||||
import { maxWidth, sizingTransform } from '../sizing';
|
||||
var defaultSxConfig = {
|
||||
// borders
|
||||
border: {
|
||||
themeKey: 'borders',
|
||||
transform: borderTransform
|
||||
},
|
||||
borderTop: {
|
||||
themeKey: 'borders',
|
||||
transform: borderTransform
|
||||
},
|
||||
borderRight: {
|
||||
themeKey: 'borders',
|
||||
transform: borderTransform
|
||||
},
|
||||
borderBottom: {
|
||||
themeKey: 'borders',
|
||||
transform: borderTransform
|
||||
},
|
||||
borderLeft: {
|
||||
themeKey: 'borders',
|
||||
transform: borderTransform
|
||||
},
|
||||
borderColor: {
|
||||
themeKey: 'palette'
|
||||
},
|
||||
borderTopColor: {
|
||||
themeKey: 'palette'
|
||||
},
|
||||
borderRightColor: {
|
||||
themeKey: 'palette'
|
||||
},
|
||||
borderBottomColor: {
|
||||
themeKey: 'palette'
|
||||
},
|
||||
borderLeftColor: {
|
||||
themeKey: 'palette'
|
||||
},
|
||||
outline: {
|
||||
themeKey: 'borders',
|
||||
transform: borderTransform
|
||||
},
|
||||
outlineColor: {
|
||||
themeKey: 'palette'
|
||||
},
|
||||
borderRadius: {
|
||||
themeKey: 'shape.borderRadius',
|
||||
style: borderRadius
|
||||
},
|
||||
// palette
|
||||
color: {
|
||||
themeKey: 'palette',
|
||||
transform: paletteTransform
|
||||
},
|
||||
bgcolor: {
|
||||
themeKey: 'palette',
|
||||
cssProperty: 'backgroundColor',
|
||||
transform: paletteTransform
|
||||
},
|
||||
backgroundColor: {
|
||||
themeKey: 'palette',
|
||||
transform: paletteTransform
|
||||
},
|
||||
// spacing
|
||||
p: {
|
||||
style: padding
|
||||
},
|
||||
pt: {
|
||||
style: padding
|
||||
},
|
||||
pr: {
|
||||
style: padding
|
||||
},
|
||||
pb: {
|
||||
style: padding
|
||||
},
|
||||
pl: {
|
||||
style: padding
|
||||
},
|
||||
px: {
|
||||
style: padding
|
||||
},
|
||||
py: {
|
||||
style: padding
|
||||
},
|
||||
padding: {
|
||||
style: padding
|
||||
},
|
||||
paddingTop: {
|
||||
style: padding
|
||||
},
|
||||
paddingRight: {
|
||||
style: padding
|
||||
},
|
||||
paddingBottom: {
|
||||
style: padding
|
||||
},
|
||||
paddingLeft: {
|
||||
style: padding
|
||||
},
|
||||
paddingX: {
|
||||
style: padding
|
||||
},
|
||||
paddingY: {
|
||||
style: padding
|
||||
},
|
||||
paddingInline: {
|
||||
style: padding
|
||||
},
|
||||
paddingInlineStart: {
|
||||
style: padding
|
||||
},
|
||||
paddingInlineEnd: {
|
||||
style: padding
|
||||
},
|
||||
paddingBlock: {
|
||||
style: padding
|
||||
},
|
||||
paddingBlockStart: {
|
||||
style: padding
|
||||
},
|
||||
paddingBlockEnd: {
|
||||
style: padding
|
||||
},
|
||||
m: {
|
||||
style: margin
|
||||
},
|
||||
mt: {
|
||||
style: margin
|
||||
},
|
||||
mr: {
|
||||
style: margin
|
||||
},
|
||||
mb: {
|
||||
style: margin
|
||||
},
|
||||
ml: {
|
||||
style: margin
|
||||
},
|
||||
mx: {
|
||||
style: margin
|
||||
},
|
||||
my: {
|
||||
style: margin
|
||||
},
|
||||
margin: {
|
||||
style: margin
|
||||
},
|
||||
marginTop: {
|
||||
style: margin
|
||||
},
|
||||
marginRight: {
|
||||
style: margin
|
||||
},
|
||||
marginBottom: {
|
||||
style: margin
|
||||
},
|
||||
marginLeft: {
|
||||
style: margin
|
||||
},
|
||||
marginX: {
|
||||
style: margin
|
||||
},
|
||||
marginY: {
|
||||
style: margin
|
||||
},
|
||||
marginInline: {
|
||||
style: margin
|
||||
},
|
||||
marginInlineStart: {
|
||||
style: margin
|
||||
},
|
||||
marginInlineEnd: {
|
||||
style: margin
|
||||
},
|
||||
marginBlock: {
|
||||
style: margin
|
||||
},
|
||||
marginBlockStart: {
|
||||
style: margin
|
||||
},
|
||||
marginBlockEnd: {
|
||||
style: margin
|
||||
},
|
||||
// display
|
||||
displayPrint: {
|
||||
cssProperty: false,
|
||||
transform: function transform(value) {
|
||||
return {
|
||||
'@media print': {
|
||||
display: value
|
||||
}
|
||||
};
|
||||
}
|
||||
},
|
||||
display: {},
|
||||
overflow: {},
|
||||
textOverflow: {},
|
||||
visibility: {},
|
||||
whiteSpace: {},
|
||||
// flexbox
|
||||
flexBasis: {},
|
||||
flexDirection: {},
|
||||
flexWrap: {},
|
||||
justifyContent: {},
|
||||
alignItems: {},
|
||||
alignContent: {},
|
||||
order: {},
|
||||
flex: {},
|
||||
flexGrow: {},
|
||||
flexShrink: {},
|
||||
alignSelf: {},
|
||||
justifyItems: {},
|
||||
justifySelf: {},
|
||||
// grid
|
||||
gap: {
|
||||
style: gap
|
||||
},
|
||||
rowGap: {
|
||||
style: rowGap
|
||||
},
|
||||
columnGap: {
|
||||
style: columnGap
|
||||
},
|
||||
gridColumn: {},
|
||||
gridRow: {},
|
||||
gridAutoFlow: {},
|
||||
gridAutoColumns: {},
|
||||
gridAutoRows: {},
|
||||
gridTemplateColumns: {},
|
||||
gridTemplateRows: {},
|
||||
gridTemplateAreas: {},
|
||||
gridArea: {},
|
||||
// positions
|
||||
position: {},
|
||||
zIndex: {
|
||||
themeKey: 'zIndex'
|
||||
},
|
||||
top: {},
|
||||
right: {},
|
||||
bottom: {},
|
||||
left: {},
|
||||
// shadows
|
||||
boxShadow: {
|
||||
themeKey: 'shadows'
|
||||
},
|
||||
// sizing
|
||||
width: {
|
||||
transform: sizingTransform
|
||||
},
|
||||
maxWidth: {
|
||||
style: maxWidth
|
||||
},
|
||||
minWidth: {
|
||||
transform: sizingTransform
|
||||
},
|
||||
height: {
|
||||
transform: sizingTransform
|
||||
},
|
||||
maxHeight: {
|
||||
transform: sizingTransform
|
||||
},
|
||||
minHeight: {
|
||||
transform: sizingTransform
|
||||
},
|
||||
boxSizing: {},
|
||||
// typography
|
||||
fontFamily: {
|
||||
themeKey: 'typography'
|
||||
},
|
||||
fontSize: {
|
||||
themeKey: 'typography'
|
||||
},
|
||||
fontStyle: {
|
||||
themeKey: 'typography'
|
||||
},
|
||||
fontWeight: {
|
||||
themeKey: 'typography'
|
||||
},
|
||||
letterSpacing: {},
|
||||
textTransform: {},
|
||||
lineHeight: {},
|
||||
textAlign: {},
|
||||
typography: {
|
||||
cssProperty: false,
|
||||
themeKey: 'typography'
|
||||
}
|
||||
};
|
||||
export default defaultSxConfig;
|
||||
45
backend/frontend/node_modules/@mui/system/legacy/styleFunctionSx/extendSxProp.js
generated
vendored
Normal file
45
backend/frontend/node_modules/@mui/system/legacy/styleFunctionSx/extendSxProp.js
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
import _extends from "@babel/runtime/helpers/esm/extends";
|
||||
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
||||
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
||||
import { isPlainObject } from '@mui/utils/deepmerge';
|
||||
import defaultSxConfig from './defaultSxConfig';
|
||||
var splitProps = function splitProps(props) {
|
||||
var _props$theme$unstable, _props$theme;
|
||||
var result = {
|
||||
systemProps: {},
|
||||
otherProps: {}
|
||||
};
|
||||
var config = (_props$theme$unstable = props == null || (_props$theme = props.theme) == null ? void 0 : _props$theme.unstable_sxConfig) != null ? _props$theme$unstable : defaultSxConfig;
|
||||
Object.keys(props).forEach(function (prop) {
|
||||
if (config[prop]) {
|
||||
result.systemProps[prop] = props[prop];
|
||||
} else {
|
||||
result.otherProps[prop] = props[prop];
|
||||
}
|
||||
});
|
||||
return result;
|
||||
};
|
||||
export default function extendSxProp(props) {
|
||||
var inSx = props.sx,
|
||||
other = _objectWithoutProperties(props, ["sx"]);
|
||||
var _splitProps = splitProps(other),
|
||||
systemProps = _splitProps.systemProps,
|
||||
otherProps = _splitProps.otherProps;
|
||||
var finalSx;
|
||||
if (Array.isArray(inSx)) {
|
||||
finalSx = [systemProps].concat(_toConsumableArray(inSx));
|
||||
} else if (typeof inSx === 'function') {
|
||||
finalSx = function finalSx() {
|
||||
var result = inSx.apply(void 0, arguments);
|
||||
if (!isPlainObject(result)) {
|
||||
return systemProps;
|
||||
}
|
||||
return _extends({}, systemProps, result);
|
||||
};
|
||||
} else {
|
||||
finalSx = _extends({}, systemProps, inSx);
|
||||
}
|
||||
return _extends({}, otherProps, {
|
||||
sx: finalSx
|
||||
});
|
||||
}
|
||||
4
backend/frontend/node_modules/@mui/system/legacy/styleFunctionSx/index.js
generated
vendored
Normal file
4
backend/frontend/node_modules/@mui/system/legacy/styleFunctionSx/index.js
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
export { default } from './styleFunctionSx';
|
||||
export { unstable_createStyleFunctionSx } from './styleFunctionSx';
|
||||
export { default as extendSxProp } from './extendSxProp';
|
||||
export { default as unstable_defaultSxConfig } from './defaultSxConfig';
|
||||
126
backend/frontend/node_modules/@mui/system/legacy/styleFunctionSx/styleFunctionSx.js
generated
vendored
Normal file
126
backend/frontend/node_modules/@mui/system/legacy/styleFunctionSx/styleFunctionSx.js
generated
vendored
Normal file
@@ -0,0 +1,126 @@
|
||||
import _typeof from "@babel/runtime/helpers/esm/typeof";
|
||||
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
||||
import capitalize from '@mui/utils/capitalize';
|
||||
import merge from '../merge';
|
||||
import { getPath, getStyleValue as getValue } from '../style';
|
||||
import { handleBreakpoints, createEmptyBreakpointObject, removeUnusedBreakpoints } from '../breakpoints';
|
||||
import defaultSxConfig from './defaultSxConfig';
|
||||
function objectsHaveSameKeys() {
|
||||
for (var _len = arguments.length, objects = new Array(_len), _key = 0; _key < _len; _key++) {
|
||||
objects[_key] = arguments[_key];
|
||||
}
|
||||
var allKeys = objects.reduce(function (keys, object) {
|
||||
return keys.concat(Object.keys(object));
|
||||
}, []);
|
||||
var union = new Set(allKeys);
|
||||
return objects.every(function (object) {
|
||||
return union.size === Object.keys(object).length;
|
||||
});
|
||||
}
|
||||
function callIfFn(maybeFn, arg) {
|
||||
return typeof maybeFn === 'function' ? maybeFn(arg) : maybeFn;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
export function unstable_createStyleFunctionSx() {
|
||||
function getThemeValue(prop, val, theme, config) {
|
||||
var props = _defineProperty(_defineProperty({}, prop, val), "theme", theme);
|
||||
var options = config[prop];
|
||||
if (!options) {
|
||||
return _defineProperty({}, prop, val);
|
||||
}
|
||||
var _options$cssProperty = options.cssProperty,
|
||||
cssProperty = _options$cssProperty === void 0 ? prop : _options$cssProperty,
|
||||
themeKey = options.themeKey,
|
||||
transform = options.transform,
|
||||
style = options.style;
|
||||
if (val == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// TODO v6: remove, see https://github.com/mui/material-ui/pull/38123
|
||||
if (themeKey === 'typography' && val === 'inherit') {
|
||||
return _defineProperty({}, prop, val);
|
||||
}
|
||||
var themeMapping = getPath(theme, themeKey) || {};
|
||||
if (style) {
|
||||
return style(props);
|
||||
}
|
||||
var styleFromPropValue = function styleFromPropValue(propValueFinal) {
|
||||
var value = getValue(themeMapping, transform, propValueFinal);
|
||||
if (propValueFinal === value && typeof propValueFinal === 'string') {
|
||||
// Haven't found value
|
||||
value = getValue(themeMapping, transform, "".concat(prop).concat(propValueFinal === 'default' ? '' : capitalize(propValueFinal)), propValueFinal);
|
||||
}
|
||||
if (cssProperty === false) {
|
||||
return value;
|
||||
}
|
||||
return _defineProperty({}, cssProperty, value);
|
||||
};
|
||||
return handleBreakpoints(props, val, styleFromPropValue);
|
||||
}
|
||||
function styleFunctionSx(props) {
|
||||
var _theme$unstable_sxCon;
|
||||
var _ref4 = props || {},
|
||||
sx = _ref4.sx,
|
||||
_ref4$theme = _ref4.theme,
|
||||
theme = _ref4$theme === void 0 ? {} : _ref4$theme;
|
||||
if (!sx) {
|
||||
return null; // Emotion & styled-components will neglect null
|
||||
}
|
||||
var config = (_theme$unstable_sxCon = theme.unstable_sxConfig) != null ? _theme$unstable_sxCon : defaultSxConfig;
|
||||
|
||||
/*
|
||||
* Receive `sxInput` as object or callback
|
||||
* and then recursively check keys & values to create media query object styles.
|
||||
* (the result will be used in `styled`)
|
||||
*/
|
||||
function traverse(sxInput) {
|
||||
var sxObject = sxInput;
|
||||
if (typeof sxInput === 'function') {
|
||||
sxObject = sxInput(theme);
|
||||
} else if (_typeof(sxInput) !== 'object') {
|
||||
// value
|
||||
return sxInput;
|
||||
}
|
||||
if (!sxObject) {
|
||||
return null;
|
||||
}
|
||||
var emptyBreakpoints = createEmptyBreakpointObject(theme.breakpoints);
|
||||
var breakpointsKeys = Object.keys(emptyBreakpoints);
|
||||
var css = emptyBreakpoints;
|
||||
Object.keys(sxObject).forEach(function (styleKey) {
|
||||
var value = callIfFn(sxObject[styleKey], theme);
|
||||
if (value !== null && value !== undefined) {
|
||||
if (_typeof(value) === 'object') {
|
||||
if (config[styleKey]) {
|
||||
css = merge(css, getThemeValue(styleKey, value, theme, config));
|
||||
} else {
|
||||
var breakpointsValues = handleBreakpoints({
|
||||
theme: theme
|
||||
}, value, function (x) {
|
||||
return _defineProperty({}, styleKey, x);
|
||||
});
|
||||
if (objectsHaveSameKeys(breakpointsValues, value)) {
|
||||
css[styleKey] = styleFunctionSx({
|
||||
sx: value,
|
||||
theme: theme
|
||||
});
|
||||
} else {
|
||||
css = merge(css, breakpointsValues);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
css = merge(css, getThemeValue(styleKey, value, theme, config));
|
||||
}
|
||||
}
|
||||
});
|
||||
return removeUnusedBreakpoints(breakpointsKeys, css);
|
||||
}
|
||||
return Array.isArray(sx) ? sx.map(traverse) : traverse(sx);
|
||||
}
|
||||
return styleFunctionSx;
|
||||
}
|
||||
var styleFunctionSx = unstable_createStyleFunctionSx();
|
||||
styleFunctionSx.filterProps = ['sx'];
|
||||
export default styleFunctionSx;
|
||||
Reference in New Issue
Block a user