mirror of
https://github.com/idanoo/GoScrobble
synced 2025-07-23 16:09:15 +00:00
0.2.0 - Mid migration
This commit is contained in:
parent
139e6a915e
commit
7e38fdbd7d
42393 changed files with 5358157 additions and 62 deletions
39
web/node_modules/@material-ui/styles/es/ServerStyleSheets/ServerStyleSheets.js
generated
vendored
Normal file
39
web/node_modules/@material-ui/styles/es/ServerStyleSheets/ServerStyleSheets.js
generated
vendored
Normal file
|
@ -0,0 +1,39 @@
|
|||
import _extends from "@babel/runtime/helpers/esm/extends";
|
||||
import React from 'react';
|
||||
import { SheetsRegistry } from 'jss';
|
||||
import StylesProvider from '../StylesProvider';
|
||||
import createGenerateClassName from '../createGenerateClassName';
|
||||
export default class ServerStyleSheets {
|
||||
constructor(options = {}) {
|
||||
this.options = options;
|
||||
}
|
||||
|
||||
collect(children) {
|
||||
// This is needed in order to deduplicate the injection of CSS in the page.
|
||||
const sheetsManager = new Map(); // This is needed in order to inject the critical CSS.
|
||||
|
||||
this.sheetsRegistry = new SheetsRegistry(); // A new class name generator
|
||||
|
||||
const generateClassName = createGenerateClassName();
|
||||
return /*#__PURE__*/React.createElement(StylesProvider, _extends({
|
||||
sheetsManager: sheetsManager,
|
||||
serverGenerateClassName: generateClassName,
|
||||
sheetsRegistry: this.sheetsRegistry
|
||||
}, this.options), children);
|
||||
}
|
||||
|
||||
toString() {
|
||||
return this.sheetsRegistry ? this.sheetsRegistry.toString() : '';
|
||||
}
|
||||
|
||||
getStyleElement(props) {
|
||||
return /*#__PURE__*/React.createElement('style', _extends({
|
||||
id: 'jss-server-side',
|
||||
key: 'jss-server-side',
|
||||
dangerouslySetInnerHTML: {
|
||||
__html: this.toString()
|
||||
}
|
||||
}, props));
|
||||
}
|
||||
|
||||
}
|
1
web/node_modules/@material-ui/styles/es/ServerStyleSheets/index.js
generated
vendored
Normal file
1
web/node_modules/@material-ui/styles/es/ServerStyleSheets/index.js
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
export { default } from './ServerStyleSheets';
|
147
web/node_modules/@material-ui/styles/es/StylesProvider/StylesProvider.js
generated
vendored
Normal file
147
web/node_modules/@material-ui/styles/es/StylesProvider/StylesProvider.js
generated
vendored
Normal file
|
@ -0,0 +1,147 @@
|
|||
import _extends from "@babel/runtime/helpers/esm/extends";
|
||||
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { exactProp } from '@material-ui/utils';
|
||||
import createGenerateClassName from '../createGenerateClassName';
|
||||
import { create } from 'jss';
|
||||
import jssPreset from '../jssPreset'; // Default JSS instance.
|
||||
|
||||
const jss = create(jssPreset()); // Use a singleton or the provided one by the context.
|
||||
//
|
||||
// The counter-based approach doesn't tolerate any mistake.
|
||||
// It's much safer to use the same counter everywhere.
|
||||
|
||||
const generateClassName = createGenerateClassName(); // Exported for test purposes
|
||||
|
||||
export const sheetsManager = new Map();
|
||||
const defaultOptions = {
|
||||
disableGeneration: false,
|
||||
generateClassName,
|
||||
jss,
|
||||
sheetsCache: null,
|
||||
sheetsManager,
|
||||
sheetsRegistry: null
|
||||
};
|
||||
export const StylesContext = React.createContext(defaultOptions);
|
||||
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
StylesContext.displayName = 'StylesContext';
|
||||
}
|
||||
|
||||
let injectFirstNode;
|
||||
export default function StylesProvider(props) {
|
||||
const {
|
||||
children,
|
||||
injectFirst = false,
|
||||
disableGeneration = false
|
||||
} = props,
|
||||
localOptions = _objectWithoutPropertiesLoose(props, ["children", "injectFirst", "disableGeneration"]);
|
||||
|
||||
const outerOptions = React.useContext(StylesContext);
|
||||
|
||||
const context = _extends({}, outerOptions, {
|
||||
disableGeneration
|
||||
}, localOptions);
|
||||
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
if (typeof window === 'undefined' && !context.sheetsManager) {
|
||||
console.error('Material-UI: You need to use the ServerStyleSheets API when rendering on the server.');
|
||||
}
|
||||
}
|
||||
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
if (context.jss.options.insertionPoint && injectFirst) {
|
||||
console.error('Material-UI: You cannot use a custom insertionPoint and <StylesContext injectFirst> at the same time.');
|
||||
}
|
||||
}
|
||||
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
if (injectFirst && localOptions.jss) {
|
||||
console.error('Material-UI: You cannot use the jss and injectFirst props at the same time.');
|
||||
}
|
||||
}
|
||||
|
||||
if (!context.jss.options.insertionPoint && injectFirst && typeof window !== 'undefined') {
|
||||
if (!injectFirstNode) {
|
||||
const head = document.head;
|
||||
injectFirstNode = document.createComment('mui-inject-first');
|
||||
head.insertBefore(injectFirstNode, head.firstChild);
|
||||
}
|
||||
|
||||
context.jss = create({
|
||||
plugins: jssPreset().plugins,
|
||||
insertionPoint: injectFirstNode
|
||||
});
|
||||
}
|
||||
|
||||
return /*#__PURE__*/React.createElement(StylesContext.Provider, {
|
||||
value: context
|
||||
}, children);
|
||||
}
|
||||
process.env.NODE_ENV !== "production" ? StylesProvider.propTypes = {
|
||||
/**
|
||||
* Your component tree.
|
||||
*/
|
||||
children: PropTypes.node.isRequired,
|
||||
|
||||
/**
|
||||
* You can disable the generation of the styles with this option.
|
||||
* It can be useful when traversing the React tree outside of the HTML
|
||||
* rendering step on the server.
|
||||
* Let's say you are using react-apollo to extract all
|
||||
* the queries made by the interface server-side - you can significantly speed up the traversal with this prop.
|
||||
*/
|
||||
disableGeneration: PropTypes.bool,
|
||||
|
||||
/**
|
||||
* JSS's class name generator.
|
||||
*/
|
||||
generateClassName: PropTypes.func,
|
||||
|
||||
/**
|
||||
* By default, the styles are injected last in the <head> element of the page.
|
||||
* As a result, they gain more specificity than any other style sheet.
|
||||
* If you want to override Material-UI's styles, set this prop.
|
||||
*/
|
||||
injectFirst: PropTypes.bool,
|
||||
|
||||
/**
|
||||
* JSS's instance.
|
||||
*/
|
||||
jss: PropTypes.object,
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
serverGenerateClassName: PropTypes.func,
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*
|
||||
* Beta feature.
|
||||
*
|
||||
* Cache for the sheets.
|
||||
*/
|
||||
sheetsCache: PropTypes.object,
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*
|
||||
* The sheetsManager is used to deduplicate style sheet injection in the page.
|
||||
* It's deduplicating using the (theme, styles) couple.
|
||||
* On the server, you should provide a new instance for each request.
|
||||
*/
|
||||
sheetsManager: PropTypes.object,
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*
|
||||
* Collect the sheets.
|
||||
*/
|
||||
sheetsRegistry: PropTypes.object
|
||||
} : void 0;
|
||||
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
process.env.NODE_ENV !== "production" ? StylesProvider.propTypes = exactProp(StylesProvider.propTypes) : void 0;
|
||||
}
|
2
web/node_modules/@material-ui/styles/es/StylesProvider/index.js
generated
vendored
Normal file
2
web/node_modules/@material-ui/styles/es/StylesProvider/index.js
generated
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
export { default } from './StylesProvider';
|
||||
export * from './StylesProvider';
|
74
web/node_modules/@material-ui/styles/es/ThemeProvider/ThemeProvider.js
generated
vendored
Normal file
74
web/node_modules/@material-ui/styles/es/ThemeProvider/ThemeProvider.js
generated
vendored
Normal file
|
@ -0,0 +1,74 @@
|
|||
import _extends from "@babel/runtime/helpers/esm/extends";
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { exactProp } from '@material-ui/utils';
|
||||
import ThemeContext from '../useTheme/ThemeContext';
|
||||
import useTheme from '../useTheme';
|
||||
import nested from './nested'; // To support composition of theme.
|
||||
|
||||
function mergeOuterLocalTheme(outerTheme, localTheme) {
|
||||
if (typeof localTheme === 'function') {
|
||||
const mergedTheme = localTheme(outerTheme);
|
||||
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
if (!mergedTheme) {
|
||||
console.error(['Material-UI: You should return an object from your theme function, i.e.', '<ThemeProvider theme={() => ({})} />'].join('\n'));
|
||||
}
|
||||
}
|
||||
|
||||
return mergedTheme;
|
||||
}
|
||||
|
||||
return _extends({}, outerTheme, localTheme);
|
||||
}
|
||||
/**
|
||||
* This component takes a `theme` prop.
|
||||
* It makes the `theme` available down the React tree thanks to React context.
|
||||
* This component should preferably be used at **the root of your component tree**.
|
||||
*/
|
||||
|
||||
|
||||
function ThemeProvider(props) {
|
||||
const {
|
||||
children,
|
||||
theme: localTheme
|
||||
} = props;
|
||||
const outerTheme = useTheme();
|
||||
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
if (outerTheme === null && typeof localTheme === 'function') {
|
||||
console.error(['Material-UI: You are providing a theme function prop to the ThemeProvider component:', '<ThemeProvider theme={outerTheme => outerTheme} />', '', 'However, no outer theme is present.', 'Make sure a theme is already injected higher in the React tree ' + 'or provide a theme object.'].join('\n'));
|
||||
}
|
||||
}
|
||||
|
||||
const theme = React.useMemo(() => {
|
||||
const output = outerTheme === null ? localTheme : mergeOuterLocalTheme(outerTheme, localTheme);
|
||||
|
||||
if (output != null) {
|
||||
output[nested] = outerTheme !== null;
|
||||
}
|
||||
|
||||
return output;
|
||||
}, [localTheme, outerTheme]);
|
||||
return /*#__PURE__*/React.createElement(ThemeContext.Provider, {
|
||||
value: theme
|
||||
}, children);
|
||||
}
|
||||
|
||||
process.env.NODE_ENV !== "production" ? ThemeProvider.propTypes = {
|
||||
/**
|
||||
* Your component tree.
|
||||
*/
|
||||
children: PropTypes.node.isRequired,
|
||||
|
||||
/**
|
||||
* A theme object. You can provide a function to extend the outer theme.
|
||||
*/
|
||||
theme: PropTypes.oneOfType([PropTypes.object, PropTypes.func]).isRequired
|
||||
} : void 0;
|
||||
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
process.env.NODE_ENV !== "production" ? ThemeProvider.propTypes = exactProp(ThemeProvider.propTypes) : void 0;
|
||||
}
|
||||
|
||||
export default ThemeProvider;
|
1
web/node_modules/@material-ui/styles/es/ThemeProvider/index.js
generated
vendored
Normal file
1
web/node_modules/@material-ui/styles/es/ThemeProvider/index.js
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
export { default } from './ThemeProvider';
|
2
web/node_modules/@material-ui/styles/es/ThemeProvider/nested.js
generated
vendored
Normal file
2
web/node_modules/@material-ui/styles/es/ThemeProvider/nested.js
generated
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
const hasSymbol = typeof Symbol === 'function' && Symbol.for;
|
||||
export default hasSymbol ? Symbol.for('mui.nested') : '__THEME_NESTED__';
|
70
web/node_modules/@material-ui/styles/es/createGenerateClassName/createGenerateClassName.js
generated
vendored
Normal file
70
web/node_modules/@material-ui/styles/es/createGenerateClassName/createGenerateClassName.js
generated
vendored
Normal file
|
@ -0,0 +1,70 @@
|
|||
import nested from '../ThemeProvider/nested';
|
||||
/**
|
||||
* This is the list of the style rule name we use as drop in replacement for the built-in
|
||||
* pseudo classes (:checked, :disabled, :focused, etc.).
|
||||
*
|
||||
* Why do they exist in the first place?
|
||||
* These classes are used at a specificity of 2.
|
||||
* It allows them to override previously definied styles as well as
|
||||
* being untouched by simple user overrides.
|
||||
*/
|
||||
|
||||
const pseudoClasses = ['checked', 'disabled', 'error', 'focused', 'focusVisible', 'required', 'expanded', 'selected']; // Returns a function which generates unique class names based on counters.
|
||||
// When new generator function is created, rule counter is reset.
|
||||
// We need to reset the rule counter for SSR for each request.
|
||||
//
|
||||
// It's inspired by
|
||||
// https://github.com/cssinjs/jss/blob/4e6a05dd3f7b6572fdd3ab216861d9e446c20331/src/utils/createGenerateClassName.js
|
||||
|
||||
export default function createGenerateClassName(options = {}) {
|
||||
const {
|
||||
disableGlobal = false,
|
||||
productionPrefix = 'jss',
|
||||
seed = ''
|
||||
} = options;
|
||||
const seedPrefix = seed === '' ? '' : `${seed}-`;
|
||||
let ruleCounter = 0;
|
||||
|
||||
const getNextCounterId = () => {
|
||||
ruleCounter += 1;
|
||||
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
if (ruleCounter >= 1e10) {
|
||||
console.warn(['Material-UI: You might have a memory leak.', 'The ruleCounter is not supposed to grow that much.'].join(''));
|
||||
}
|
||||
}
|
||||
|
||||
return ruleCounter;
|
||||
};
|
||||
|
||||
return (rule, styleSheet) => {
|
||||
const name = styleSheet.options.name; // Is a global static MUI style?
|
||||
|
||||
if (name && name.indexOf('Mui') === 0 && !styleSheet.options.link && !disableGlobal) {
|
||||
// We can use a shorthand class name, we never use the keys to style the components.
|
||||
if (pseudoClasses.indexOf(rule.key) !== -1) {
|
||||
return `Mui-${rule.key}`;
|
||||
}
|
||||
|
||||
const prefix = `${seedPrefix}${name}-${rule.key}`;
|
||||
|
||||
if (!styleSheet.options.theme[nested] || seed !== '') {
|
||||
return prefix;
|
||||
}
|
||||
|
||||
return `${prefix}-${getNextCounterId()}`;
|
||||
}
|
||||
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
return `${seedPrefix}${productionPrefix}${getNextCounterId()}`;
|
||||
}
|
||||
|
||||
const suffix = `${rule.key}-${getNextCounterId()}`; // Help with debuggability.
|
||||
|
||||
if (styleSheet.options.classNamePrefix) {
|
||||
return `${seedPrefix}${styleSheet.options.classNamePrefix}-${suffix}`;
|
||||
}
|
||||
|
||||
return `${seedPrefix}${suffix}`;
|
||||
};
|
||||
}
|
75
web/node_modules/@material-ui/styles/es/createGenerateClassName/createGenerateClassNameHash.js
generated
vendored
Normal file
75
web/node_modules/@material-ui/styles/es/createGenerateClassName/createGenerateClassNameHash.js
generated
vendored
Normal file
|
@ -0,0 +1,75 @@
|
|||
import hash from '@emotion/hash';
|
||||
|
||||
function safePrefix(classNamePrefix) {
|
||||
const prefix = String(classNamePrefix);
|
||||
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
if (prefix.length >= 256) {
|
||||
console.error(`Material-UI: The class name prefix is too long: ${prefix}.`);
|
||||
}
|
||||
}
|
||||
|
||||
return prefix;
|
||||
}
|
||||
|
||||
const themeHashCache = {};
|
||||
/**
|
||||
* Beta feature.
|
||||
*
|
||||
* This is an alternative to createGenerateClassName.js.
|
||||
* Instead of using a index counter, it hash the style sheets to generate the class name.
|
||||
* The class name call order invariant. With this property, we can cache the style sheets on the server.
|
||||
*/
|
||||
|
||||
export default function createGenerateClassNameHash(options = {}) {
|
||||
const {
|
||||
dangerouslyUseGlobalCSS = false,
|
||||
productionPrefix = 'jss',
|
||||
seed = ''
|
||||
} = options;
|
||||
let ruleCounter = 0;
|
||||
return (rule, styleSheet) => {
|
||||
const isStatic = !styleSheet.options.link;
|
||||
|
||||
if (dangerouslyUseGlobalCSS && styleSheet && styleSheet.options.name && isStatic) {
|
||||
return `${safePrefix(styleSheet.options.name)}-${rule.key}`;
|
||||
}
|
||||
|
||||
let suffix; // It's a static rule.
|
||||
|
||||
if (isStatic) {
|
||||
let themeHash = themeHashCache[styleSheet.options.theme];
|
||||
|
||||
if (!themeHash) {
|
||||
themeHash = hash(JSON.stringify(styleSheet.options.theme));
|
||||
themeHashCache[styleSheet.theme] = themeHash;
|
||||
}
|
||||
|
||||
const raw = styleSheet.rules.raw[rule.key];
|
||||
suffix = hash(`${themeHash}${rule.key}${JSON.stringify(raw)}`);
|
||||
}
|
||||
|
||||
if (!suffix) {
|
||||
ruleCounter += 1;
|
||||
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
if (ruleCounter >= 1e10) {
|
||||
console.warn(['Material-UI: You might have a memory leak.', 'The ruleCounter is not supposed to grow that much.'].join(''));
|
||||
}
|
||||
}
|
||||
|
||||
suffix = ruleCounter;
|
||||
}
|
||||
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
return `${productionPrefix}${seed}${suffix}`;
|
||||
} // Help with debuggability.
|
||||
|
||||
|
||||
if (styleSheet.options.classNamePrefix) {
|
||||
return `${safePrefix(styleSheet.options.classNamePrefix)}-${rule.key}-${seed}${suffix}`;
|
||||
}
|
||||
|
||||
return `${rule.key}-${seed}${suffix}`;
|
||||
};
|
||||
}
|
1
web/node_modules/@material-ui/styles/es/createGenerateClassName/index.js
generated
vendored
Normal file
1
web/node_modules/@material-ui/styles/es/createGenerateClassName/index.js
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
export { default } from './createGenerateClassName';
|
3
web/node_modules/@material-ui/styles/es/createStyles/createStyles.js
generated
vendored
Normal file
3
web/node_modules/@material-ui/styles/es/createStyles/createStyles.js
generated
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
export default function createStyles(styles) {
|
||||
return styles;
|
||||
}
|
1
web/node_modules/@material-ui/styles/es/createStyles/index.js
generated
vendored
Normal file
1
web/node_modules/@material-ui/styles/es/createStyles/index.js
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
export { default } from './createStyles';
|
51
web/node_modules/@material-ui/styles/es/getStylesCreator/getStylesCreator.js
generated
vendored
Normal file
51
web/node_modules/@material-ui/styles/es/getStylesCreator/getStylesCreator.js
generated
vendored
Normal file
|
@ -0,0 +1,51 @@
|
|||
import _extends from "@babel/runtime/helpers/esm/extends";
|
||||
import { deepmerge } from '@material-ui/utils';
|
||||
import noopTheme from './noopTheme';
|
||||
export default function getStylesCreator(stylesOrCreator) {
|
||||
const themingEnabled = typeof stylesOrCreator === 'function';
|
||||
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
if (typeof stylesOrCreator !== 'object' && !themingEnabled) {
|
||||
console.error(['Material-UI: The `styles` argument provided is invalid.', 'You need to provide a function generating the styles or a styles object.'].join('\n'));
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
create: (theme, name) => {
|
||||
let styles;
|
||||
|
||||
try {
|
||||
styles = themingEnabled ? stylesOrCreator(theme) : stylesOrCreator;
|
||||
} catch (err) {
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
if (themingEnabled === true && theme === noopTheme) {
|
||||
// TODO: prepend error message/name instead
|
||||
console.error(['Material-UI: The `styles` argument provided is invalid.', 'You are providing a function without a theme in the context.', 'One of the parent elements needs to use a ThemeProvider.'].join('\n'));
|
||||
}
|
||||
}
|
||||
|
||||
throw err;
|
||||
}
|
||||
|
||||
if (!name || !theme.overrides || !theme.overrides[name]) {
|
||||
return styles;
|
||||
}
|
||||
|
||||
const overrides = theme.overrides[name];
|
||||
|
||||
const stylesWithOverrides = _extends({}, styles);
|
||||
|
||||
Object.keys(overrides).forEach(key => {
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
if (!stylesWithOverrides[key]) {
|
||||
console.warn(['Material-UI: You are trying to override a style that does not exist.', `Fix the \`${key}\` key of \`theme.overrides.${name}\`.`].join('\n'));
|
||||
}
|
||||
}
|
||||
|
||||
stylesWithOverrides[key] = deepmerge(stylesWithOverrides[key], overrides[key]);
|
||||
});
|
||||
return stylesWithOverrides;
|
||||
},
|
||||
options: {}
|
||||
};
|
||||
}
|
1
web/node_modules/@material-ui/styles/es/getStylesCreator/index.js
generated
vendored
Normal file
1
web/node_modules/@material-ui/styles/es/getStylesCreator/index.js
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
export { default } from './getStylesCreator';
|
3
web/node_modules/@material-ui/styles/es/getStylesCreator/noopTheme.js
generated
vendored
Normal file
3
web/node_modules/@material-ui/styles/es/getStylesCreator/noopTheme.js
generated
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
// We use the same empty object to ref count the styles that don't need a theme object.
|
||||
const noopTheme = {};
|
||||
export default noopTheme;
|
25
web/node_modules/@material-ui/styles/es/getThemeProps/getThemeProps.js
generated
vendored
Normal file
25
web/node_modules/@material-ui/styles/es/getThemeProps/getThemeProps.js
generated
vendored
Normal file
|
@ -0,0 +1,25 @@
|
|||
/* eslint-disable no-restricted-syntax */
|
||||
export default function getThemeProps(params) {
|
||||
const {
|
||||
theme,
|
||||
name,
|
||||
props
|
||||
} = params;
|
||||
|
||||
if (!theme || !theme.props || !theme.props[name]) {
|
||||
return props;
|
||||
} // Resolve default props, code borrow from React source.
|
||||
// https://github.com/facebook/react/blob/15a8f031838a553e41c0b66eb1bcf1da8448104d/packages/react/src/ReactElement.js#L221
|
||||
|
||||
|
||||
const defaultProps = theme.props[name];
|
||||
let propName;
|
||||
|
||||
for (propName in defaultProps) {
|
||||
if (props[propName] === undefined) {
|
||||
props[propName] = defaultProps[propName];
|
||||
}
|
||||
}
|
||||
|
||||
return props;
|
||||
}
|
1
web/node_modules/@material-ui/styles/es/getThemeProps/index.js
generated
vendored
Normal file
1
web/node_modules/@material-ui/styles/es/getThemeProps/index.js
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
export { default } from './getThemeProps';
|
40
web/node_modules/@material-ui/styles/es/index.js
generated
vendored
Normal file
40
web/node_modules/@material-ui/styles/es/index.js
generated
vendored
Normal file
|
@ -0,0 +1,40 @@
|
|||
/* eslint-disable import/export */
|
||||
import { ponyfillGlobal } from '@material-ui/utils';
|
||||
/* Warning if there are several instances of @material-ui/styles */
|
||||
|
||||
if (process.env.NODE_ENV !== 'production' && process.env.NODE_ENV !== 'test' && typeof window !== 'undefined') {
|
||||
ponyfillGlobal['__@material-ui/styles-init__'] = ponyfillGlobal['__@material-ui/styles-init__'] || 0;
|
||||
|
||||
if (ponyfillGlobal['__@material-ui/styles-init__'] === 1) {
|
||||
console.warn(['It looks like there are several instances of `@material-ui/styles` initialized in this application.', 'This may cause theme propagation issues, broken class names, ' + 'specificity issues, and makes your application bigger without a good reason.', '', 'See https://material-ui.com/r/styles-instance-warning for more info.'].join('\n'));
|
||||
}
|
||||
|
||||
ponyfillGlobal['__@material-ui/styles-init__'] += 1;
|
||||
}
|
||||
|
||||
export { default as createGenerateClassName } from './createGenerateClassName';
|
||||
export * from './createGenerateClassName';
|
||||
export { default as createStyles } from './createStyles';
|
||||
export * from './createStyles';
|
||||
export { default as getThemeProps } from './getThemeProps';
|
||||
export * from './getThemeProps';
|
||||
export { default as jssPreset } from './jssPreset';
|
||||
export * from './jssPreset';
|
||||
export { default as makeStyles } from './makeStyles';
|
||||
export * from './makeStyles';
|
||||
export { default as mergeClasses } from './mergeClasses';
|
||||
export * from './mergeClasses';
|
||||
export { default as ServerStyleSheets } from './ServerStyleSheets';
|
||||
export * from './ServerStyleSheets';
|
||||
export { default as styled } from './styled';
|
||||
export * from './styled';
|
||||
export { default as StylesProvider } from './StylesProvider';
|
||||
export * from './StylesProvider';
|
||||
export { default as ThemeProvider } from './ThemeProvider';
|
||||
export * from './ThemeProvider';
|
||||
export { default as useTheme } from './useTheme';
|
||||
export * from './useTheme';
|
||||
export { default as withStyles } from './withStyles';
|
||||
export * from './withStyles';
|
||||
export { default as withTheme } from './withTheme';
|
||||
export * from './withTheme';
|
1
web/node_modules/@material-ui/styles/es/jssPreset/index.js
generated
vendored
Normal file
1
web/node_modules/@material-ui/styles/es/jssPreset/index.js
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
export { default } from './jssPreset';
|
16
web/node_modules/@material-ui/styles/es/jssPreset/jssPreset.js
generated
vendored
Normal file
16
web/node_modules/@material-ui/styles/es/jssPreset/jssPreset.js
generated
vendored
Normal file
|
@ -0,0 +1,16 @@
|
|||
import functions from 'jss-plugin-rule-value-function';
|
||||
import global from 'jss-plugin-global';
|
||||
import nested from 'jss-plugin-nested';
|
||||
import camelCase from 'jss-plugin-camel-case';
|
||||
import defaultUnit from 'jss-plugin-default-unit';
|
||||
import vendorPrefixer from 'jss-plugin-vendor-prefixer';
|
||||
import propsSort from 'jss-plugin-props-sort'; // Subset of jss-preset-default with only the plugins the Material-UI components are using.
|
||||
|
||||
export default function jssPreset() {
|
||||
return {
|
||||
plugins: [functions(), global(), nested(), camelCase(), defaultUnit(), // Disable the vendor prefixer server-side, it does nothing.
|
||||
// This way, we can get a performance boost.
|
||||
// In the documentation, we are using `autoprefixer` to solve this problem.
|
||||
typeof window === 'undefined' ? null : vendorPrefixer(), propsSort()]
|
||||
};
|
||||
}
|
1
web/node_modules/@material-ui/styles/es/makeStyles/index.js
generated
vendored
Normal file
1
web/node_modules/@material-ui/styles/es/makeStyles/index.js
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
export { default } from './makeStyles';
|
21
web/node_modules/@material-ui/styles/es/makeStyles/indexCounter.js
generated
vendored
Normal file
21
web/node_modules/@material-ui/styles/es/makeStyles/indexCounter.js
generated
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
/* eslint-disable import/prefer-default-export */
|
||||
// Global index counter to preserve source order.
|
||||
// We create the style sheet during the creation of the component,
|
||||
// children are handled after the parents, so the order of style elements would be parent->child.
|
||||
// It is a problem though when a parent passes a className
|
||||
// which needs to override any child's styles.
|
||||
// StyleSheet of the child has a higher specificity, because of the source order.
|
||||
// So our solution is to render sheets them in the reverse order child->sheet, so
|
||||
// that parent has a higher specificity.
|
||||
let indexCounter = -1e9;
|
||||
export function increment() {
|
||||
indexCounter += 1;
|
||||
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
if (indexCounter >= 0) {
|
||||
console.warn(['Material-UI: You might have a memory leak.', 'The indexCounter is not supposed to grow that much.'].join('\n'));
|
||||
}
|
||||
}
|
||||
|
||||
return indexCounter;
|
||||
}
|
257
web/node_modules/@material-ui/styles/es/makeStyles/makeStyles.js
generated
vendored
Normal file
257
web/node_modules/@material-ui/styles/es/makeStyles/makeStyles.js
generated
vendored
Normal file
|
@ -0,0 +1,257 @@
|
|||
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
||||
import _extends from "@babel/runtime/helpers/esm/extends";
|
||||
import React from 'react';
|
||||
import { getDynamicStyles } from 'jss';
|
||||
import mergeClasses from '../mergeClasses';
|
||||
import multiKeyStore from './multiKeyStore';
|
||||
import useTheme from '../useTheme';
|
||||
import { StylesContext } from '../StylesProvider';
|
||||
import { increment } from './indexCounter';
|
||||
import getStylesCreator from '../getStylesCreator';
|
||||
import noopTheme from '../getStylesCreator/noopTheme';
|
||||
|
||||
function getClasses({
|
||||
state,
|
||||
stylesOptions
|
||||
}, classes, Component) {
|
||||
if (stylesOptions.disableGeneration) {
|
||||
return classes || {};
|
||||
}
|
||||
|
||||
if (!state.cacheClasses) {
|
||||
state.cacheClasses = {
|
||||
// Cache for the finalized classes value.
|
||||
value: null,
|
||||
// Cache for the last used classes prop pointer.
|
||||
lastProp: null,
|
||||
// Cache for the last used rendered classes pointer.
|
||||
lastJSS: {}
|
||||
};
|
||||
} // Tracks if either the rendered classes or classes prop has changed,
|
||||
// requiring the generation of a new finalized classes object.
|
||||
|
||||
|
||||
let generate = false;
|
||||
|
||||
if (state.classes !== state.cacheClasses.lastJSS) {
|
||||
state.cacheClasses.lastJSS = state.classes;
|
||||
generate = true;
|
||||
}
|
||||
|
||||
if (classes !== state.cacheClasses.lastProp) {
|
||||
state.cacheClasses.lastProp = classes;
|
||||
generate = true;
|
||||
}
|
||||
|
||||
if (generate) {
|
||||
state.cacheClasses.value = mergeClasses({
|
||||
baseClasses: state.cacheClasses.lastJSS,
|
||||
newClasses: classes,
|
||||
Component
|
||||
});
|
||||
}
|
||||
|
||||
return state.cacheClasses.value;
|
||||
}
|
||||
|
||||
function attach({
|
||||
state,
|
||||
theme,
|
||||
stylesOptions,
|
||||
stylesCreator,
|
||||
name
|
||||
}, props) {
|
||||
if (stylesOptions.disableGeneration) {
|
||||
return;
|
||||
}
|
||||
|
||||
let sheetManager = multiKeyStore.get(stylesOptions.sheetsManager, stylesCreator, theme);
|
||||
|
||||
if (!sheetManager) {
|
||||
sheetManager = {
|
||||
refs: 0,
|
||||
staticSheet: null,
|
||||
dynamicStyles: null
|
||||
};
|
||||
multiKeyStore.set(stylesOptions.sheetsManager, stylesCreator, theme, sheetManager);
|
||||
}
|
||||
|
||||
const options = _extends({}, stylesCreator.options, stylesOptions, {
|
||||
theme,
|
||||
flip: typeof stylesOptions.flip === 'boolean' ? stylesOptions.flip : theme.direction === 'rtl'
|
||||
});
|
||||
|
||||
options.generateId = options.serverGenerateClassName || options.generateClassName;
|
||||
const sheetsRegistry = stylesOptions.sheetsRegistry;
|
||||
|
||||
if (sheetManager.refs === 0) {
|
||||
let staticSheet;
|
||||
|
||||
if (stylesOptions.sheetsCache) {
|
||||
staticSheet = multiKeyStore.get(stylesOptions.sheetsCache, stylesCreator, theme);
|
||||
}
|
||||
|
||||
const styles = stylesCreator.create(theme, name);
|
||||
|
||||
if (!staticSheet) {
|
||||
staticSheet = stylesOptions.jss.createStyleSheet(styles, _extends({
|
||||
link: false
|
||||
}, options));
|
||||
staticSheet.attach();
|
||||
|
||||
if (stylesOptions.sheetsCache) {
|
||||
multiKeyStore.set(stylesOptions.sheetsCache, stylesCreator, theme, staticSheet);
|
||||
}
|
||||
}
|
||||
|
||||
if (sheetsRegistry) {
|
||||
sheetsRegistry.add(staticSheet);
|
||||
}
|
||||
|
||||
sheetManager.staticSheet = staticSheet;
|
||||
sheetManager.dynamicStyles = getDynamicStyles(styles);
|
||||
}
|
||||
|
||||
if (sheetManager.dynamicStyles) {
|
||||
const dynamicSheet = stylesOptions.jss.createStyleSheet(sheetManager.dynamicStyles, _extends({
|
||||
link: true
|
||||
}, options));
|
||||
dynamicSheet.update(props);
|
||||
dynamicSheet.attach();
|
||||
state.dynamicSheet = dynamicSheet;
|
||||
state.classes = mergeClasses({
|
||||
baseClasses: sheetManager.staticSheet.classes,
|
||||
newClasses: dynamicSheet.classes
|
||||
});
|
||||
|
||||
if (sheetsRegistry) {
|
||||
sheetsRegistry.add(dynamicSheet);
|
||||
}
|
||||
} else {
|
||||
state.classes = sheetManager.staticSheet.classes;
|
||||
}
|
||||
|
||||
sheetManager.refs += 1;
|
||||
}
|
||||
|
||||
function update({
|
||||
state
|
||||
}, props) {
|
||||
if (state.dynamicSheet) {
|
||||
state.dynamicSheet.update(props);
|
||||
}
|
||||
}
|
||||
|
||||
function detach({
|
||||
state,
|
||||
theme,
|
||||
stylesOptions,
|
||||
stylesCreator
|
||||
}) {
|
||||
if (stylesOptions.disableGeneration) {
|
||||
return;
|
||||
}
|
||||
|
||||
const sheetManager = multiKeyStore.get(stylesOptions.sheetsManager, stylesCreator, theme);
|
||||
sheetManager.refs -= 1;
|
||||
const sheetsRegistry = stylesOptions.sheetsRegistry;
|
||||
|
||||
if (sheetManager.refs === 0) {
|
||||
multiKeyStore.delete(stylesOptions.sheetsManager, stylesCreator, theme);
|
||||
stylesOptions.jss.removeStyleSheet(sheetManager.staticSheet);
|
||||
|
||||
if (sheetsRegistry) {
|
||||
sheetsRegistry.remove(sheetManager.staticSheet);
|
||||
}
|
||||
}
|
||||
|
||||
if (state.dynamicSheet) {
|
||||
stylesOptions.jss.removeStyleSheet(state.dynamicSheet);
|
||||
|
||||
if (sheetsRegistry) {
|
||||
sheetsRegistry.remove(state.dynamicSheet);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function useSynchronousEffect(func, values) {
|
||||
const key = React.useRef([]);
|
||||
let output; // Store "generation" key. Just returns a new object every time
|
||||
|
||||
const currentKey = React.useMemo(() => ({}), values); // eslint-disable-line react-hooks/exhaustive-deps
|
||||
// "the first render", or "memo dropped the value"
|
||||
|
||||
if (key.current !== currentKey) {
|
||||
key.current = currentKey;
|
||||
output = func();
|
||||
}
|
||||
|
||||
React.useEffect(() => () => {
|
||||
if (output) {
|
||||
output();
|
||||
}
|
||||
}, [currentKey] // eslint-disable-line react-hooks/exhaustive-deps
|
||||
);
|
||||
}
|
||||
|
||||
export default function makeStyles(stylesOrCreator, options = {}) {
|
||||
const {
|
||||
// alias for classNamePrefix, if provided will listen to theme (required for theme.overrides)
|
||||
name,
|
||||
// Help with debuggability.
|
||||
classNamePrefix: classNamePrefixOption,
|
||||
Component,
|
||||
defaultTheme = noopTheme
|
||||
} = options,
|
||||
stylesOptions2 = _objectWithoutPropertiesLoose(options, ["name", "classNamePrefix", "Component", "defaultTheme"]);
|
||||
|
||||
const stylesCreator = getStylesCreator(stylesOrCreator);
|
||||
const classNamePrefix = name || classNamePrefixOption || 'makeStyles';
|
||||
stylesCreator.options = {
|
||||
index: increment(),
|
||||
name,
|
||||
meta: classNamePrefix,
|
||||
classNamePrefix
|
||||
};
|
||||
|
||||
const useStyles = (props = {}) => {
|
||||
const theme = useTheme() || defaultTheme;
|
||||
|
||||
const stylesOptions = _extends({}, React.useContext(StylesContext), stylesOptions2);
|
||||
|
||||
const instance = React.useRef();
|
||||
const shouldUpdate = React.useRef();
|
||||
useSynchronousEffect(() => {
|
||||
const current = {
|
||||
name,
|
||||
state: {},
|
||||
stylesCreator,
|
||||
stylesOptions,
|
||||
theme
|
||||
};
|
||||
attach(current, props);
|
||||
shouldUpdate.current = false;
|
||||
instance.current = current;
|
||||
return () => {
|
||||
detach(current);
|
||||
};
|
||||
}, [theme, stylesCreator]);
|
||||
React.useEffect(() => {
|
||||
if (shouldUpdate.current) {
|
||||
update(instance.current, props);
|
||||
}
|
||||
|
||||
shouldUpdate.current = true;
|
||||
});
|
||||
const classes = getClasses(instance.current, props.classes, Component);
|
||||
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
// eslint-disable-next-line react-hooks/rules-of-hooks
|
||||
React.useDebugValue(classes);
|
||||
}
|
||||
|
||||
return classes;
|
||||
};
|
||||
|
||||
return useStyles;
|
||||
}
|
22
web/node_modules/@material-ui/styles/es/makeStyles/multiKeyStore.js
generated
vendored
Normal file
22
web/node_modules/@material-ui/styles/es/makeStyles/multiKeyStore.js
generated
vendored
Normal file
|
@ -0,0 +1,22 @@
|
|||
// Used https://github.com/thinkloop/multi-key-cache as inspiration
|
||||
const multiKeyStore = {
|
||||
set: (cache, key1, key2, value) => {
|
||||
let subCache = cache.get(key1);
|
||||
|
||||
if (!subCache) {
|
||||
subCache = new Map();
|
||||
cache.set(key1, subCache);
|
||||
}
|
||||
|
||||
subCache.set(key2, value);
|
||||
},
|
||||
get: (cache, key1, key2) => {
|
||||
const subCache = cache.get(key1);
|
||||
return subCache ? subCache.get(key2) : undefined;
|
||||
},
|
||||
delete: (cache, key1, key2) => {
|
||||
const subCache = cache.get(key1);
|
||||
subCache.delete(key2);
|
||||
}
|
||||
};
|
||||
export default multiKeyStore;
|
1
web/node_modules/@material-ui/styles/es/mergeClasses/index.js
generated
vendored
Normal file
1
web/node_modules/@material-ui/styles/es/mergeClasses/index.js
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
export { default } from './mergeClasses';
|
39
web/node_modules/@material-ui/styles/es/mergeClasses/mergeClasses.js
generated
vendored
Normal file
39
web/node_modules/@material-ui/styles/es/mergeClasses/mergeClasses.js
generated
vendored
Normal file
|
@ -0,0 +1,39 @@
|
|||
import _extends from "@babel/runtime/helpers/esm/extends";
|
||||
import { getDisplayName } from '@material-ui/utils';
|
||||
export default function mergeClasses(options = {}) {
|
||||
const {
|
||||
baseClasses,
|
||||
newClasses,
|
||||
Component
|
||||
} = options;
|
||||
|
||||
if (!newClasses) {
|
||||
return baseClasses;
|
||||
}
|
||||
|
||||
const nextClasses = _extends({}, baseClasses);
|
||||
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
if (typeof newClasses === 'string') {
|
||||
console.error([`Material-UI: The value \`${newClasses}\` ` + `provided to the classes prop of ${getDisplayName(Component)} is incorrect.`, 'You might want to use the className prop instead.'].join('\n'));
|
||||
return baseClasses;
|
||||
}
|
||||
}
|
||||
|
||||
Object.keys(newClasses).forEach(key => {
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
if (!baseClasses[key] && newClasses[key]) {
|
||||
console.error([`Material-UI: The key \`${key}\` ` + `provided to the classes prop is not implemented in ${getDisplayName(Component)}.`, `You can only override one of the following: ${Object.keys(baseClasses).join(',')}.`].join('\n'));
|
||||
}
|
||||
|
||||
if (newClasses[key] && typeof newClasses[key] !== 'string') {
|
||||
console.error([`Material-UI: The key \`${key}\` ` + `provided to the classes prop is not valid for ${getDisplayName(Component)}.`, `You need to provide a non empty string instead of: ${newClasses[key]}.`].join('\n'));
|
||||
}
|
||||
}
|
||||
|
||||
if (newClasses[key]) {
|
||||
nextClasses[key] = `${baseClasses[key]} ${newClasses[key]}`;
|
||||
}
|
||||
});
|
||||
return nextClasses;
|
||||
}
|
1
web/node_modules/@material-ui/styles/es/styled/index.js
generated
vendored
Normal file
1
web/node_modules/@material-ui/styles/es/styled/index.js
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
export { default } from './styled';
|
153
web/node_modules/@material-ui/styles/es/styled/styled.js
generated
vendored
Normal file
153
web/node_modules/@material-ui/styles/es/styled/styled.js
generated
vendored
Normal file
|
@ -0,0 +1,153 @@
|
|||
import _extends from "@babel/runtime/helpers/esm/extends";
|
||||
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
||||
import React from 'react';
|
||||
import clsx from 'clsx';
|
||||
import PropTypes from 'prop-types';
|
||||
import { chainPropTypes, getDisplayName } from '@material-ui/utils';
|
||||
import hoistNonReactStatics from 'hoist-non-react-statics';
|
||||
import makeStyles from '../makeStyles';
|
||||
|
||||
function omit(input, fields) {
|
||||
const output = {};
|
||||
Object.keys(input).forEach(prop => {
|
||||
if (fields.indexOf(prop) === -1) {
|
||||
output[prop] = input[prop];
|
||||
}
|
||||
});
|
||||
return output;
|
||||
} // styled-components's API removes the mapping between components and styles.
|
||||
// Using components as a low-level styling construct can be simpler.
|
||||
|
||||
|
||||
export default function styled(Component) {
|
||||
const componentCreator = (style, options = {}) => {
|
||||
const {
|
||||
name
|
||||
} = options,
|
||||
stylesOptions = _objectWithoutPropertiesLoose(options, ["name"]);
|
||||
|
||||
if (process.env.NODE_ENV !== 'production' && Component === undefined) {
|
||||
throw new Error(['You are calling styled(Component)(style) with an undefined component.', 'You may have forgotten to import it.'].join('\n'));
|
||||
}
|
||||
|
||||
let classNamePrefix = name;
|
||||
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
if (!name) {
|
||||
// Provide a better DX outside production.
|
||||
const displayName = getDisplayName(Component);
|
||||
|
||||
if (displayName !== undefined) {
|
||||
classNamePrefix = displayName;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const stylesOrCreator = typeof style === 'function' ? theme => ({
|
||||
root: props => style(_extends({
|
||||
theme
|
||||
}, props))
|
||||
}) : {
|
||||
root: style
|
||||
};
|
||||
const useStyles = makeStyles(stylesOrCreator, _extends({
|
||||
Component,
|
||||
name: name || Component.displayName,
|
||||
classNamePrefix
|
||||
}, stylesOptions));
|
||||
let filterProps;
|
||||
let propTypes = {};
|
||||
|
||||
if (style.filterProps) {
|
||||
filterProps = style.filterProps;
|
||||
delete style.filterProps;
|
||||
}
|
||||
/* eslint-disable react/forbid-foreign-prop-types */
|
||||
|
||||
|
||||
if (style.propTypes) {
|
||||
propTypes = style.propTypes;
|
||||
delete style.propTypes;
|
||||
}
|
||||
/* eslint-enable react/forbid-foreign-prop-types */
|
||||
|
||||
|
||||
const StyledComponent = /*#__PURE__*/React.forwardRef(function StyledComponent(props, ref) {
|
||||
const {
|
||||
children,
|
||||
className: classNameProp,
|
||||
clone,
|
||||
component: ComponentProp
|
||||
} = props,
|
||||
other = _objectWithoutPropertiesLoose(props, ["children", "className", "clone", "component"]);
|
||||
|
||||
const classes = useStyles(props);
|
||||
const className = clsx(classes.root, classNameProp);
|
||||
let spread = other;
|
||||
|
||||
if (filterProps) {
|
||||
spread = omit(spread, filterProps);
|
||||
}
|
||||
|
||||
if (clone) {
|
||||
return /*#__PURE__*/React.cloneElement(children, _extends({
|
||||
className: clsx(children.props.className, className)
|
||||
}, spread));
|
||||
}
|
||||
|
||||
if (typeof children === 'function') {
|
||||
return children(_extends({
|
||||
className
|
||||
}, spread));
|
||||
}
|
||||
|
||||
const FinalComponent = ComponentProp || Component;
|
||||
return /*#__PURE__*/React.createElement(FinalComponent, _extends({
|
||||
ref: ref,
|
||||
className: className
|
||||
}, spread), children);
|
||||
});
|
||||
process.env.NODE_ENV !== "production" ? StyledComponent.propTypes = _extends({
|
||||
/**
|
||||
* A render function or node.
|
||||
*/
|
||||
children: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
className: PropTypes.string,
|
||||
|
||||
/**
|
||||
* If `true`, the component will recycle it's children HTML element.
|
||||
* It's using `React.cloneElement` internally.
|
||||
*
|
||||
* This prop will be deprecated and removed in v5
|
||||
*/
|
||||
clone: chainPropTypes(PropTypes.bool, props => {
|
||||
if (props.clone && props.component) {
|
||||
return new Error('You can not use the clone and component prop at the same time.');
|
||||
}
|
||||
|
||||
return null;
|
||||
}),
|
||||
|
||||
/**
|
||||
* The component used for the root node.
|
||||
* Either a string to use a HTML element or a component.
|
||||
*/
|
||||
component: PropTypes
|
||||
/* @typescript-to-proptypes-ignore */
|
||||
.elementType
|
||||
}, propTypes) : void 0;
|
||||
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
StyledComponent.displayName = `Styled(${classNamePrefix})`;
|
||||
}
|
||||
|
||||
hoistNonReactStatics(StyledComponent, Component);
|
||||
return StyledComponent;
|
||||
};
|
||||
|
||||
return componentCreator;
|
||||
}
|
8
web/node_modules/@material-ui/styles/es/useTheme/ThemeContext.js
generated
vendored
Normal file
8
web/node_modules/@material-ui/styles/es/useTheme/ThemeContext.js
generated
vendored
Normal file
|
@ -0,0 +1,8 @@
|
|||
import React from 'react';
|
||||
const ThemeContext = React.createContext(null);
|
||||
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
ThemeContext.displayName = 'ThemeContext';
|
||||
}
|
||||
|
||||
export default ThemeContext;
|
1
web/node_modules/@material-ui/styles/es/useTheme/index.js
generated
vendored
Normal file
1
web/node_modules/@material-ui/styles/es/useTheme/index.js
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
export { default } from './useTheme';
|
12
web/node_modules/@material-ui/styles/es/useTheme/useTheme.js
generated
vendored
Normal file
12
web/node_modules/@material-ui/styles/es/useTheme/useTheme.js
generated
vendored
Normal file
|
@ -0,0 +1,12 @@
|
|||
import React from 'react';
|
||||
import ThemeContext from './ThemeContext';
|
||||
export default function useTheme() {
|
||||
const theme = React.useContext(ThemeContext);
|
||||
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
// eslint-disable-next-line react-hooks/rules-of-hooks
|
||||
React.useDebugValue(theme);
|
||||
}
|
||||
|
||||
return theme;
|
||||
}
|
1
web/node_modules/@material-ui/styles/es/withStyles/index.js
generated
vendored
Normal file
1
web/node_modules/@material-ui/styles/es/withStyles/index.js
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
export { default } from './withStyles';
|
122
web/node_modules/@material-ui/styles/es/withStyles/withStyles.js
generated
vendored
Normal file
122
web/node_modules/@material-ui/styles/es/withStyles/withStyles.js
generated
vendored
Normal file
|
@ -0,0 +1,122 @@
|
|||
import _extends from "@babel/runtime/helpers/esm/extends";
|
||||
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import hoistNonReactStatics from 'hoist-non-react-statics';
|
||||
import { chainPropTypes, getDisplayName } from '@material-ui/utils';
|
||||
import makeStyles from '../makeStyles';
|
||||
import getThemeProps from '../getThemeProps';
|
||||
import useTheme from '../useTheme'; // Link a style sheet with a component.
|
||||
// It does not modify the component passed to it;
|
||||
// instead, it returns a new component, with a `classes` property.
|
||||
|
||||
const withStyles = (stylesOrCreator, options = {}) => Component => {
|
||||
const {
|
||||
defaultTheme,
|
||||
withTheme = false,
|
||||
name
|
||||
} = options,
|
||||
stylesOptions = _objectWithoutPropertiesLoose(options, ["defaultTheme", "withTheme", "name"]);
|
||||
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
if (Component === undefined) {
|
||||
throw new Error(['You are calling withStyles(styles)(Component) with an undefined component.', 'You may have forgotten to import it.'].join('\n'));
|
||||
}
|
||||
}
|
||||
|
||||
let classNamePrefix = name;
|
||||
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
if (!name) {
|
||||
// Provide a better DX outside production.
|
||||
const displayName = getDisplayName(Component);
|
||||
|
||||
if (displayName !== undefined) {
|
||||
classNamePrefix = displayName;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const useStyles = makeStyles(stylesOrCreator, _extends({
|
||||
defaultTheme,
|
||||
Component,
|
||||
name: name || Component.displayName,
|
||||
classNamePrefix
|
||||
}, stylesOptions));
|
||||
const WithStyles = /*#__PURE__*/React.forwardRef(function WithStyles(props, ref) {
|
||||
const {
|
||||
innerRef
|
||||
} = props,
|
||||
other = _objectWithoutPropertiesLoose(props, ["classes", "innerRef"]); // The wrapper receives only user supplied props, which could be a subset of
|
||||
// the actual props Component might receive due to merging with defaultProps.
|
||||
// So copying it here would give us the same result in the wrapper as well.
|
||||
|
||||
|
||||
const classes = useStyles(_extends({}, Component.defaultProps, props));
|
||||
let theme;
|
||||
let more = other;
|
||||
|
||||
if (typeof name === 'string' || withTheme) {
|
||||
// name and withTheme are invariant in the outer scope
|
||||
// eslint-disable-next-line react-hooks/rules-of-hooks
|
||||
theme = useTheme() || defaultTheme;
|
||||
|
||||
if (name) {
|
||||
more = getThemeProps({
|
||||
theme,
|
||||
name,
|
||||
props: other
|
||||
});
|
||||
} // Provide the theme to the wrapped component.
|
||||
// So we don't have to use the `withTheme()` Higher-order Component.
|
||||
|
||||
|
||||
if (withTheme && !more.theme) {
|
||||
more.theme = theme;
|
||||
}
|
||||
}
|
||||
|
||||
return /*#__PURE__*/React.createElement(Component, _extends({
|
||||
ref: innerRef || ref,
|
||||
classes: classes
|
||||
}, more));
|
||||
});
|
||||
process.env.NODE_ENV !== "production" ? WithStyles.propTypes = {
|
||||
/**
|
||||
* Override or extend the styles applied to the component.
|
||||
*/
|
||||
classes: PropTypes.object,
|
||||
|
||||
/**
|
||||
* Use that prop to pass a ref to the decorated component.
|
||||
* @deprecated
|
||||
*/
|
||||
innerRef: chainPropTypes(PropTypes.oneOfType([PropTypes.func, PropTypes.object]), props => {
|
||||
if (props.innerRef == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return null; // return new Error(
|
||||
// 'Material-UI: The `innerRef` prop is deprecated and will be removed in v5. ' +
|
||||
// 'Refs are now automatically forwarded to the inner component.',
|
||||
// );
|
||||
})
|
||||
} : void 0;
|
||||
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
WithStyles.displayName = `WithStyles(${getDisplayName(Component)})`;
|
||||
}
|
||||
|
||||
hoistNonReactStatics(WithStyles, Component);
|
||||
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
// Exposed for test purposes.
|
||||
WithStyles.Naked = Component;
|
||||
WithStyles.options = options;
|
||||
WithStyles.useStyles = useStyles;
|
||||
}
|
||||
|
||||
return WithStyles;
|
||||
};
|
||||
|
||||
export default withStyles;
|
2
web/node_modules/@material-ui/styles/es/withTheme/index.js
generated
vendored
Normal file
2
web/node_modules/@material-ui/styles/es/withTheme/index.js
generated
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
export { default } from './withTheme';
|
||||
export * from './withTheme';
|
66
web/node_modules/@material-ui/styles/es/withTheme/withTheme.js
generated
vendored
Normal file
66
web/node_modules/@material-ui/styles/es/withTheme/withTheme.js
generated
vendored
Normal file
|
@ -0,0 +1,66 @@
|
|||
import _extends from "@babel/runtime/helpers/esm/extends";
|
||||
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import hoistNonReactStatics from 'hoist-non-react-statics';
|
||||
import { chainPropTypes, getDisplayName } from '@material-ui/utils';
|
||||
import useTheme from '../useTheme';
|
||||
export function withThemeCreator(options = {}) {
|
||||
const {
|
||||
defaultTheme
|
||||
} = options;
|
||||
|
||||
const withTheme = Component => {
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
if (Component === undefined) {
|
||||
throw new Error(['You are calling withTheme(Component) with an undefined component.', 'You may have forgotten to import it.'].join('\n'));
|
||||
}
|
||||
}
|
||||
|
||||
const WithTheme = /*#__PURE__*/React.forwardRef(function WithTheme(props, ref) {
|
||||
const {
|
||||
innerRef
|
||||
} = props,
|
||||
other = _objectWithoutPropertiesLoose(props, ["innerRef"]);
|
||||
|
||||
const theme = useTheme() || defaultTheme;
|
||||
return /*#__PURE__*/React.createElement(Component, _extends({
|
||||
theme: theme,
|
||||
ref: innerRef || ref
|
||||
}, other));
|
||||
});
|
||||
process.env.NODE_ENV !== "production" ? WithTheme.propTypes = {
|
||||
/**
|
||||
* Use that prop to pass a ref to the decorated component.
|
||||
* @deprecated
|
||||
*/
|
||||
innerRef: chainPropTypes(PropTypes.oneOfType([PropTypes.func, PropTypes.object]), props => {
|
||||
if (props.innerRef == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return new Error('Material-UI: The `innerRef` prop is deprecated and will be removed in v5. ' + 'Refs are now automatically forwarded to the inner component.');
|
||||
})
|
||||
} : void 0;
|
||||
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
WithTheme.displayName = `WithTheme(${getDisplayName(Component)})`;
|
||||
}
|
||||
|
||||
hoistNonReactStatics(WithTheme, Component);
|
||||
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
// Exposed for test purposes.
|
||||
WithTheme.Naked = Component;
|
||||
}
|
||||
|
||||
return WithTheme;
|
||||
};
|
||||
|
||||
return withTheme;
|
||||
} // Provide the theme object as a prop to the input component.
|
||||
// It's an alternative API to useTheme().
|
||||
// We encourage the usage of useTheme() where possible.
|
||||
|
||||
const withTheme = withThemeCreator();
|
||||
export default withTheme;
|
Loading…
Add table
Add a link
Reference in a new issue