Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@material-ui/styles

Package Overview
Dependencies
Maintainers
5
Versions
87
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@material-ui/styles - npm Package Compare versions

Comparing version 3.0.0-alpha.2 to 3.0.0-alpha.3

1

createGenerateClassName.js

@@ -12,3 +12,2 @@ "use strict";

/* eslint-disable no-underscore-dangle */
var escapeRegex = /([[\].#*$><+~=|^:(),"'`\s])/g;

@@ -15,0 +14,0 @@

@@ -1,2 +0,1 @@

/* eslint-disable no-underscore-dangle */
import warning from 'warning';

@@ -3,0 +2,0 @@ const escapeRegex = /([[\].#*$><+~=|^:(),"'`\s])/g;

19

es/index.d.ts

@@ -114,6 +114,20 @@ // allow this here since we want the declarations to be equivalent to declarations

// https://stackoverflow.com/a/49928360/3406963 without generic branch types
type IsAny<T> = 0 extends (1 & T) ? true : false;
/**
* @internal
*
* `Props` are `any` either by explicit annotation or if there are no callbacks
* from which the typechecker could infer a type so it falls back to `any`.
* See the test cases for examples and implications of explicit `any` annotation
*/
export type StylesHook<S extends Styles<any, any>> = IsAny<PropsOfStyles<S>> extends true
? (props?: any) => ClassNameMap<ClassKeyOfStyles<S>>
: (props: PropsOfStyles<S>) => ClassNameMap<ClassKeyOfStyles<S>>;
export default function makeStyles<S extends Styles<any, any>>(
styles: S,
options?: WithStylesOptions<ClassKeyOfStyles<S>>,
): (props: PropsOfStyles<S>) => ClassNameMap<ClassKeyOfStyles<S>>;
): StylesHook<S>;
}

@@ -204,5 +218,6 @@

* where
*
* - the `keys` are the class (names) that will be created
* - the `values` are objects that represent CSS rules (`React.CSSProperties`).
*
* if only `CSSProperties` are matched `Props` are inferred to `any`
*/

@@ -209,0 +224,0 @@ export type StyleRules<Props extends object, ClassKey extends string = string> = Record<

import _extends from "@babel/runtime/helpers/extends";
/* eslint-disable no-underscore-dangle */
import React from 'react';
import PropTypes from 'prop-types';
import warning from 'warning';
import { exactProp, ponyfillGlobal } from '@material-ui/utils'; // In order to have self-supporting components, we rely on default theme when not provided.
import { exactProp } from '@material-ui/utils';
export const ThemeContext = React.createContext(null); // To support composition of theme.
ponyfillGlobal.__MUI_DEFAULT_THEME__ = ponyfillGlobal.__MUI_DEFAULT_THEME__ || {};
const defaultTheme = ponyfillGlobal.__MUI_DEFAULT_THEME__;
export const ThemeContext = React.createContext(defaultTheme); // To support composition of theme.
function mergeOuterLocalTheme(outerTheme, localTheme) {

@@ -36,3 +31,3 @@ if (typeof localTheme === 'function') {

return React.createElement(ThemeContext.Consumer, null, outerTheme => {
const theme = outerTheme === defaultTheme ? localTheme : mergeOuterLocalTheme(outerTheme, localTheme);
const theme = outerTheme === null ? localTheme : mergeOuterLocalTheme(outerTheme, localTheme);
return React.createElement(ThemeContext.Provider, {

@@ -39,0 +34,0 @@ value: theme

import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
import _extends from "@babel/runtime/helpers/extends";
/* eslint-disable no-underscore-dangle */
import React from 'react';

@@ -190,5 +188,6 @@ import PropTypes from 'prop-types';

withTheme = false,
name
name,
defaultTheme
} = options,
stylesOptions2 = _objectWithoutPropertiesLoose(options, ["withTheme", "name"]);
stylesOptions2 = _objectWithoutPropertiesLoose(options, ["withTheme", "name", "defaultTheme"]);

@@ -314,7 +313,7 @@ const stylesCreator = getStylesCreator(stylesOrCreator);

ref: ref,
theme: theme
theme: theme || defaultTheme || noopTheme
}, props))) : React.createElement(WithStylesInner, _extends({
stylesOptions: stylesOptions,
ref: ref,
theme: noopTheme
theme: defaultTheme || noopTheme
}, props));

@@ -321,0 +320,0 @@ }));

@@ -114,6 +114,20 @@ // allow this here since we want the declarations to be equivalent to declarations

// https://stackoverflow.com/a/49928360/3406963 without generic branch types
type IsAny<T> = 0 extends (1 & T) ? true : false;
/**
* @internal
*
* `Props` are `any` either by explicit annotation or if there are no callbacks
* from which the typechecker could infer a type so it falls back to `any`.
* See the test cases for examples and implications of explicit `any` annotation
*/
export type StylesHook<S extends Styles<any, any>> = IsAny<PropsOfStyles<S>> extends true
? (props?: any) => ClassNameMap<ClassKeyOfStyles<S>>
: (props: PropsOfStyles<S>) => ClassNameMap<ClassKeyOfStyles<S>>;
export default function makeStyles<S extends Styles<any, any>>(
styles: S,
options?: WithStylesOptions<ClassKeyOfStyles<S>>,
): (props: PropsOfStyles<S>) => ClassNameMap<ClassKeyOfStyles<S>>;
): StylesHook<S>;
}

@@ -204,5 +218,6 @@

* where
*
* - the `keys` are the class (names) that will be created
* - the `values` are objects that represent CSS rules (`React.CSSProperties`).
*
* if only `CSSProperties` are matched `Props` are inferred to `any`
*/

@@ -209,0 +224,0 @@ export type StyleRules<Props extends object, ClassKey extends string = string> = Record<

@@ -1,2 +0,2 @@

/** @license Material-UI v3.0.0-alpha.2
/** @license Material-UI v3.0.0-alpha.3
*

@@ -3,0 +3,0 @@ * This source code is licensed under the MIT license found in the

@@ -1,2 +0,2 @@

/** @license Material-UI v3.0.0-alpha.2
/** @license Material-UI v3.0.0-alpha.3
*

@@ -3,0 +3,0 @@ * This source code is licensed under the MIT license found in the

@@ -5,3 +5,3 @@ {

"author": "Material-UI Team",
"version": "3.0.0-alpha.2",
"version": "3.0.0-alpha.3",
"description": "Material-UI Styles - The styling solution of Material-UI.",

@@ -33,4 +33,4 @@ "main": "./index.js",

"classnames": "^2.2.5",
"deepmerge": "^2.0.1",
"hoist-non-react-statics": "^3.0.0",
"deepmerge": "^3.0.0",
"hoist-non-react-statics": "^3.2.1",
"jss": "^9.3.3",

@@ -37,0 +37,0 @@ "jss-camel-case": "^6.0.0",

@@ -20,10 +20,5 @@ "use strict";

/* eslint-disable no-underscore-dangle */
// In order to have self-supporting components, we rely on default theme when not provided.
_utils.ponyfillGlobal.__MUI_DEFAULT_THEME__ = _utils.ponyfillGlobal.__MUI_DEFAULT_THEME__ || {};
var defaultTheme = _utils.ponyfillGlobal.__MUI_DEFAULT_THEME__;
var ThemeContext = _react.default.createContext(null); // To support composition of theme.
var ThemeContext = _react.default.createContext(defaultTheme); // To support composition of theme.
exports.ThemeContext = ThemeContext;

@@ -52,3 +47,3 @@

return _react.default.createElement(ThemeContext.Consumer, null, function (outerTheme) {
var theme = outerTheme === defaultTheme ? localTheme : mergeOuterLocalTheme(outerTheme, localTheme);
var theme = outerTheme === null ? localTheme : mergeOuterLocalTheme(outerTheme, localTheme);
return _react.default.createElement(ThemeContext.Provider, {

@@ -55,0 +50,0 @@ value: theme

@@ -54,3 +54,2 @@ "use strict";

/* eslint-disable no-underscore-dangle */
// We use the same empty object to ref count the styles that don't need a theme object.

@@ -238,3 +237,4 @@ var noopTheme = {};

name = options.name,
stylesOptions2 = (0, _objectWithoutProperties2.default)(options, ["withTheme", "name"]);
defaultTheme = options.defaultTheme,
stylesOptions2 = (0, _objectWithoutProperties2.default)(options, ["withTheme", "name", "defaultTheme"]);
var stylesCreator = (0, _getStylesCreator.default)(stylesOrCreator);

@@ -373,3 +373,3 @@ var listenToTheme = stylesCreator.themingEnabled || typeof name === 'string' || withTheme;

ref: ref,
theme: theme
theme: theme || defaultTheme || noopTheme
}, props));

@@ -379,3 +379,3 @@ }) : _react.default.createElement(WithStylesInner, (0, _extends2.default)({

ref: ref,
theme: noopTheme
theme: defaultTheme || noopTheme
}, props));

@@ -382,0 +382,0 @@ });

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc