@hig/themes
Advanced tools
Comparing version 0.1.0-alpha.a8872f53 to 0.1.0-alpha.eea0e093
@@ -1,3 +0,2 @@ | ||
import { Component } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import createReactContext from 'create-react-context'; | ||
@@ -14,82 +13,7 @@ var HIGLightTheme = { | ||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
var _createReactContext = createReactContext(HIGLightTheme), | ||
Provider = _createReactContext.Provider, | ||
Consumer = _createReactContext.Consumer; | ||
var index = { Provider: Provider, Consumer: Consumer }; | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
var themeContextShape = { | ||
/** Uniquely identifies a theme */ | ||
themeId: PropTypes.string, | ||
/** A class added to each themed element */ | ||
themeClass: PropTypes.string | ||
}; | ||
var Provider = function (_Component) { | ||
_inherits(Provider, _Component); | ||
function Provider() { | ||
_classCallCheck(this, Provider); | ||
return _possibleConstructorReturn(this, (Provider.__proto__ || Object.getPrototypeOf(Provider)).apply(this, arguments)); | ||
} | ||
_createClass(Provider, [{ | ||
key: 'getChildContext', | ||
value: function getChildContext() { | ||
return _extends({}, this.props.value); | ||
} | ||
}, { | ||
key: 'render', | ||
value: function render() { | ||
return this.props.children; | ||
} | ||
}]); | ||
return Provider; | ||
}(Component); | ||
Provider.propTypes = { | ||
/** A theme provided to the consumer within */ | ||
value: PropTypes.shape(themeContextShape), | ||
/** Content within will be provided with the passed theme */ | ||
children: PropTypes.node.isRequired | ||
}; | ||
Provider.childContextTypes = themeContextShape; | ||
Provider.defaultProps = { | ||
value: HIGLightTheme | ||
}; | ||
var Consumer = function (_Component2) { | ||
_inherits(Consumer, _Component2); | ||
function Consumer() { | ||
_classCallCheck(this, Consumer); | ||
return _possibleConstructorReturn(this, (Consumer.__proto__ || Object.getPrototypeOf(Consumer)).apply(this, arguments)); | ||
} | ||
_createClass(Consumer, [{ | ||
key: 'render', | ||
value: function render() { | ||
return this.props.children(this.context.themeId ? this.context : HIGLightTheme); | ||
} | ||
}]); | ||
return Consumer; | ||
}(Component); | ||
Consumer.propTypes = { | ||
/** A theme provided to the consumer within */ | ||
children: PropTypes.func | ||
}; | ||
Consumer.contextTypes = themeContextShape; | ||
var ThemeContext = { Provider: Provider, Consumer: Consumer }; | ||
export { HIGLightTheme, MatrixTheme, ThemeContext }; | ||
export { HIGLightTheme, MatrixTheme, index as ThemeContext }; |
@@ -7,4 +7,3 @@ 'use strict'; | ||
var react = require('react'); | ||
var PropTypes = _interopDefault(require('prop-types')); | ||
var createReactContext = _interopDefault(require('create-react-context')); | ||
@@ -21,84 +20,9 @@ var HIGLightTheme = { | ||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
var _createReactContext = createReactContext(HIGLightTheme), | ||
Provider = _createReactContext.Provider, | ||
Consumer = _createReactContext.Consumer; | ||
var index = { Provider: Provider, Consumer: Consumer }; | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
var themeContextShape = { | ||
/** Uniquely identifies a theme */ | ||
themeId: PropTypes.string, | ||
/** A class added to each themed element */ | ||
themeClass: PropTypes.string | ||
}; | ||
var Provider = function (_Component) { | ||
_inherits(Provider, _Component); | ||
function Provider() { | ||
_classCallCheck(this, Provider); | ||
return _possibleConstructorReturn(this, (Provider.__proto__ || Object.getPrototypeOf(Provider)).apply(this, arguments)); | ||
} | ||
_createClass(Provider, [{ | ||
key: 'getChildContext', | ||
value: function getChildContext() { | ||
return _extends({}, this.props.value); | ||
} | ||
}, { | ||
key: 'render', | ||
value: function render() { | ||
return this.props.children; | ||
} | ||
}]); | ||
return Provider; | ||
}(react.Component); | ||
Provider.propTypes = { | ||
/** A theme provided to the consumer within */ | ||
value: PropTypes.shape(themeContextShape), | ||
/** Content within will be provided with the passed theme */ | ||
children: PropTypes.node.isRequired | ||
}; | ||
Provider.childContextTypes = themeContextShape; | ||
Provider.defaultProps = { | ||
value: HIGLightTheme | ||
}; | ||
var Consumer = function (_Component2) { | ||
_inherits(Consumer, _Component2); | ||
function Consumer() { | ||
_classCallCheck(this, Consumer); | ||
return _possibleConstructorReturn(this, (Consumer.__proto__ || Object.getPrototypeOf(Consumer)).apply(this, arguments)); | ||
} | ||
_createClass(Consumer, [{ | ||
key: 'render', | ||
value: function render() { | ||
return this.props.children(this.context.themeId ? this.context : HIGLightTheme); | ||
} | ||
}]); | ||
return Consumer; | ||
}(react.Component); | ||
Consumer.propTypes = { | ||
/** A theme provided to the consumer within */ | ||
children: PropTypes.func | ||
}; | ||
Consumer.contextTypes = themeContextShape; | ||
var ThemeContext = { Provider: Provider, Consumer: Consumer }; | ||
exports.HIGLightTheme = HIGLightTheme; | ||
exports.MatrixTheme = MatrixTheme; | ||
exports.ThemeContext = ThemeContext; | ||
exports.ThemeContext = index; |
{ | ||
"name": "@hig/themes", | ||
"version": "0.1.0-alpha.a8872f53", | ||
"version": "0.1.0-alpha.eea0e093", | ||
"description": "HIG theme definitions and supporting components", | ||
@@ -11,7 +11,8 @@ "author": "Autodesk Inc.", | ||
"dependencies": { | ||
"@hig/banner": "0.2.0-alpha.a8872f53", | ||
"@hig/styles": "0.1.0-alpha.a8872f53" | ||
"create-react-context": "^0.2.1" | ||
}, | ||
"devDependencies": { | ||
"@hig/scripts": "0.2.0-alpha.a8872f53" | ||
"@hig/banner": "0.2.0-alpha.eea0e093", | ||
"@hig/scripts": "0.2.0-alpha.eea0e093", | ||
"@hig/styles": "0.1.0-alpha.eea0e093" | ||
}, | ||
@@ -18,0 +19,0 @@ "peerDependencies": { |
@@ -11,5 +11,6 @@ import React from "react"; | ||
import readme from '../../README.md'; | ||
import { ThemeContext, HIGLightTheme, MatrixTheme } from '@hig/themes'; | ||
import ThemeContext from "../ThemeContext"; | ||
import HIGLightTheme from "../themes/HIGLightTheme"; | ||
import MatrixTheme from "../themes/MatrixTheme"; | ||
const typeOptions = makeSelectOptions(Banner.types); | ||
@@ -16,0 +17,0 @@ const themeOptions = { |
@@ -1,3 +0,3 @@ | ||
export { default as HIGLightTheme } from './HIGLightTheme'; | ||
export { default as MatrixTheme } from './MatrixTheme'; | ||
export { default as HIGLightTheme } from './themes/HIGLightTheme'; | ||
export { default as MatrixTheme } from './themes/MatrixTheme'; | ||
export { default as ThemeContext } from './ThemeContext'; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
3
16
7333
3
190
+ Addedcreate-react-context@^0.2.1
+ Addedcreate-react-context@0.2.3(transitive)
+ Addedgud@1.0.0(transitive)
- Removed@hig/banner@0.2.0-alpha.a8872f53
- Removed@hig/styles@0.1.0-alpha.a8872f53
- Removed@hig/banner@0.2.0-alpha.a8872f53(transitive)
- Removed@hig/icon@0.1.0-alpha.a8872f53(transitive)
- Removed@hig/icon-button@0.1.0-alpha.a8872f53(transitive)
- Removed@hig/icons@0.1.0-alpha.a8872f53(transitive)
- Removed@hig/typography@0.1.0-alpha.a8872f53(transitive)