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

aesthetic

Package Overview
Dependencies
Maintainers
1
Versions
81
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

aesthetic - npm Package Compare versions

Comparing version 3.0.1 to 3.1.0

esm/Aesthetic.js

13

CHANGELOG.md

@@ -0,3 +1,16 @@

# 3.1.0 - 2019-02-09
#### 🚀 New
- Added ECMAScript module support via `esm/` built files.
- Removed copyright docblocks from source files to reduce bundle size.
#### 🛠 Internal
- Tested with React v16.8 (experimenting with a hooks API).
# 3.0.1 - 2019-01-31
#### 🐞 Fixed
- Fixed an issue in which global styles weren't flushing for some adapters.

@@ -4,0 +17,0 @@

4

lib/Aesthetic.d.ts

@@ -1,5 +0,1 @@

/**
* @copyright 2017-2019, Miles Johnson
* @license https://opensource.org/licenses/MIT
*/
import React from 'react';

@@ -6,0 +2,0 @@ import UnifiedSyntax from './UnifiedSyntax';

"use strict";
/**
* @copyright 2017-2019, Miles Johnson
* @license https://opensource.org/licenses/MIT
*/
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
var _getPrototypeOf3 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread"));
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
var _react = _interopRequireDefault(require("react"));
var _v = _interopRequireDefault(require("uuid/v4"));
var _hoistNonReactStatics = _interopRequireDefault(require("hoist-non-react-statics"));
var _extend = _interopRequireDefault(require("extend"));
var _isObject = _interopRequireDefault(require("./helpers/isObject"));
var _stripClassPrefix = _interopRequireDefault(require("./helpers/stripClassPrefix"));
var _UnifiedSyntax = _interopRequireDefault(require("./UnifiedSyntax"));
var Aesthetic = function () {
function Aesthetic() {
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
(0, _classCallCheck2.default)(this, Aesthetic);
(0, _defineProperty2.default)(this, "cache", {});
(0, _defineProperty2.default)(this, "globals", {});
(0, _defineProperty2.default)(this, "options", void 0);
(0, _defineProperty2.default)(this, "parents", {});
(0, _defineProperty2.default)(this, "styles", {});
(0, _defineProperty2.default)(this, "syntax", void 0);
(0, _defineProperty2.default)(this, "themes", {});
(0, _defineProperty2.default)(this, "appliedGlobals", false);
this.options = (0, _objectSpread2.default)({
extendable: false,
passThemeProp: false,
pure: true,
stylesPropName: 'styles',
theme: 'default',
themePropName: 'theme'
}, options);
this.syntax = new _UnifiedSyntax.default();
}
(0, _createClass2.default)(Aesthetic, [{
key: "applyGlobalStyles",
value: function applyGlobalStyles() {
if (this.appliedGlobals) {
return this;
}
var globalDef = this.globals[this.options.theme];
var globalSheet = globalDef ? globalDef(this.getTheme()) : null;
if (globalSheet) {
var sheet = this.processStyleSheet(this.syntax.convertGlobalSheet(globalSheet).toObject(), ':root');
var _styles = [];
Object.keys(sheet).forEach(function (key) {
_styles.push(sheet[key]);
});
this.transformToClassName(_styles);
}
this.appliedGlobals = true;
this.flushStyles(':root');
return this;
}
}, {
key: "createStyleSheet",
value: function createStyleSheet(styleName) {
if (this.cache[styleName]) {
return this.cache[styleName];
}
this.applyGlobalStyles();
var styleSheet = this.processStyleSheet(this.syntax.convertStyleSheet(this.getStyles(styleName)).toObject(), styleName);
this.cache[styleName] = styleSheet;
return styleSheet;
}
}, {
key: "extendTheme",
value: function extendTheme(themeName, parentThemeName, theme) {
var globalSheet = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
return this.registerTheme(themeName, (0, _extend.default)(true, {}, this.getTheme(parentThemeName), theme), globalSheet || this.globals[parentThemeName]);
}
}, {
key: "flushStyles",
value: function flushStyles(styleName) {}
}, {
key: "getStyles",
value: function getStyles(styleName) {
var parentStyleName = this.parents[styleName];
var styleDef = this.styles[styleName];
var styleSheet = styleDef(this.getTheme());
if (parentStyleName) {
return (0, _extend.default)(true, {}, this.getStyles(parentStyleName), styleSheet);
}
return styleSheet;
}
}, {
key: "getTheme",
value: function getTheme() {
var customTheme = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
var themeName = customTheme || this.options.theme;
var theme = this.themes[themeName];
if ("production" !== process.env.NODE_ENV) {
if (!theme || !(0, _isObject.default)(theme)) {
throw new Error("Theme \"".concat(themeName, "\" does not exist."));
}
return t;
};
return __assign.apply(this, arguments);
};
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)
t[p[i]] = s[p[i]];
return t;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
/* eslint-disable max-classes-per-file, react/no-multi-comp */
var react_1 = __importDefault(require("react"));
var v4_1 = __importDefault(require("uuid/v4"));
var hoist_non_react_statics_1 = __importDefault(require("hoist-non-react-statics"));
var extend_1 = __importDefault(require("extend"));
var isObject_1 = __importDefault(require("./helpers/isObject"));
var stripClassPrefix_1 = __importDefault(require("./helpers/stripClassPrefix"));
var UnifiedSyntax_1 = __importDefault(require("./UnifiedSyntax"));
var Aesthetic = /** @class */ (function () {
function Aesthetic(options) {
if (options === void 0) { options = {}; }
this.cache = {};
this.globals = {};
this.parents = {};
this.styles = {};
this.themes = {};
this.appliedGlobals = false;
this.options = __assign({ extendable: false, passThemeProp: false, pure: true, stylesPropName: 'styles', theme: 'default', themePropName: 'theme' }, options);
this.syntax = new UnifiedSyntax_1.default();
}
return theme;
}
/**
* Apply and inject global styles for the current theme.
* This should only happen once!
*/
Aesthetic.prototype.applyGlobalStyles = function () {
if (this.appliedGlobals) {
return this;
}, {
key: "processStyleSheet",
value: function processStyleSheet(styleSheet, styleName) {
return (0, _objectSpread2.default)({}, styleSheet);
}
}, {
key: "registerTheme",
value: function registerTheme(themeName, theme) {
var globalSheet = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
if ("production" !== process.env.NODE_ENV) {
if (this.themes[themeName]) {
throw new Error("Theme \"".concat(themeName, "\" already exists."));
} else if (!(0, _isObject.default)(theme)) {
throw new TypeError("Theme \"".concat(themeName, "\" must be a style object."));
}
var globalDef = this.globals[this.options.theme];
var globalSheet = globalDef ? globalDef(this.getTheme()) : null;
if (globalSheet) {
var sheet = this.processStyleSheet(this.syntax.convertGlobalSheet(globalSheet).toObject(), ':root');
// Some adapters require the styles to be transformed to be flushed
this.transformToClassName(Object.values(sheet));
}
this.themes[themeName] = theme;
this.globals[themeName] = this.validateDefinition(themeName, globalSheet, this.globals);
return this;
}
}, {
key: "setStyles",
value: function setStyles(styleName, styleSheet) {
var extendFrom = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
if (extendFrom) {
if ("production" !== process.env.NODE_ENV) {
if (!this.styles[extendFrom]) {
throw new Error("Cannot extend from \"".concat(extendFrom, "\" as those styles do not exist."));
} else if (extendFrom === styleName) {
throw new Error('Cannot extend styles from itself.');
}
}
this.appliedGlobals = true;
this.flushStyles(':root');
return this;
};
/**
* Create and return a stylesheet unique to an adapter.
*/
Aesthetic.prototype.createStyleSheet = function (styleName) {
if (this.cache[styleName]) {
return this.cache[styleName];
this.parents[styleName] = extendFrom;
}
this.styles[styleName] = this.validateDefinition(styleName, styleSheet, this.styles);
return this;
}
}, {
key: "transformStyles",
value: function transformStyles() {
var classNames = [];
var toTransform = [];
for (var _len = arguments.length, styles = new Array(_len), _key = 0; _key < _len; _key++) {
styles[_key] = arguments[_key];
}
styles.forEach(function (style) {
if (!style) {
return;
}
this.applyGlobalStyles();
var styleSheet = this.processStyleSheet(this.syntax.convertStyleSheet(this.getStyles(styleName)).toObject(), styleName);
this.cache[styleName] = styleSheet;
return styleSheet;
};
/**
* Register a theme by extending and merging with a previously defined theme.
*/
Aesthetic.prototype.extendTheme = function (themeName, parentThemeName, theme, globalSheet) {
if (globalSheet === void 0) { globalSheet = null; }
return this.registerTheme(themeName, extend_1.default(true, {}, this.getTheme(parentThemeName), theme), globalSheet || this.globals[parentThemeName]);
};
/**
* Flush parsed styles and inject them into the DOM.
*/
Aesthetic.prototype.flushStyles = function (styleName) { };
/**
* Retrieve the defined component styles. If the definition is a function,
* execute it while passing the current theme and React props.
*/
Aesthetic.prototype.getStyles = function (styleName) {
var parentStyleName = this.parents[styleName];
var styleDef = this.styles[styleName];
var styleSheet = styleDef(this.getTheme());
// Merge from parent
if (parentStyleName) {
return extend_1.default(true, {}, this.getStyles(parentStyleName), styleSheet);
if (typeof style === 'string') {
classNames.push.apply(classNames, (0, _toConsumableArray2.default)(String(style).split(' ').map(function (s) {
return (0, _stripClassPrefix.default)(s).trim();
})));
} else if ((0, _isObject.default)(style)) {
toTransform.push(style);
} else if ("production" !== process.env.NODE_ENV) {
throw new Error('Unsupported style type to transform.');
}
return styleSheet;
};
/**
* Return a theme object or throw an error.
*/
Aesthetic.prototype.getTheme = function (customTheme) {
if (customTheme === void 0) { customTheme = ''; }
var themeName = customTheme || this.options.theme;
var theme = this.themes[themeName];
if (process.env.NODE_ENV !== 'production') {
if (!theme || !isObject_1.default(theme)) {
throw new Error("Theme \"" + themeName + "\" does not exist.");
});
if (toTransform.length > 0) {
classNames.push(this.transformToClassName(toTransform));
}
return classNames.join(' ').trim();
}
}, {
key: "withStyles",
value: function withStyles(styleSheet) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var aesthetic = this;
var _options$extendable = options.extendable,
extendable = _options$extendable === void 0 ? this.options.extendable : _options$extendable,
_options$extendFrom = options.extendFrom,
extendFrom = _options$extendFrom === void 0 ? '' : _options$extendFrom,
_options$passThemePro = options.passThemeProp,
passThemeProp = _options$passThemePro === void 0 ? this.options.passThemeProp : _options$passThemePro,
_options$pure = options.pure,
pure = _options$pure === void 0 ? this.options.pure : _options$pure,
_options$stylesPropNa = options.stylesPropName,
stylesPropName = _options$stylesPropNa === void 0 ? this.options.stylesPropName : _options$stylesPropNa,
_options$themePropNam = options.themePropName,
themePropName = _options$themePropNam === void 0 ? this.options.themePropName : _options$themePropNam;
return function withStylesFactory(WrappedComponent) {
var baseName = WrappedComponent.displayName || WrappedComponent.name;
var styleName = "".concat(baseName, "-").concat((0, _v.default)());
var Component = pure ? _react.default.PureComponent : _react.default.Component;
aesthetic.setStyles(styleName, styleSheet, extendFrom);
var WithStyles = function (_Component) {
(0, _inherits2.default)(WithStyles, _Component);
function WithStyles() {
var _getPrototypeOf2;
var _this;
(0, _classCallCheck2.default)(this, WithStyles);
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
args[_key2] = arguments[_key2];
}
}
return theme;
};
/**
* Process from an Aesthetic style sheet to an adapter native style sheet.
*/
Aesthetic.prototype.processStyleSheet = function (styleSheet, styleName) {
// @ts-ignore Allow spread
return __assign({}, styleSheet);
};
/**
* Register a theme with a pre-defined set of theme settings.
*/
Aesthetic.prototype.registerTheme = function (themeName, theme, globalSheet) {
if (globalSheet === void 0) { globalSheet = null; }
if (process.env.NODE_ENV !== 'production') {
if (this.themes[themeName]) {
throw new Error("Theme \"" + themeName + "\" already exists.");
_this = (0, _possibleConstructorReturn2.default)(this, (_getPrototypeOf2 = (0, _getPrototypeOf3.default)(WithStyles)).call.apply(_getPrototypeOf2, [this].concat(args)));
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)), "state", {
styles: aesthetic.createStyleSheet(styleName)
});
return _this;
}
(0, _createClass2.default)(WithStyles, [{
key: "componentDidMount",
value: function componentDidMount() {
aesthetic.flushStyles(styleName);
}
else if (!isObject_1.default(theme)) {
throw new TypeError("Theme \"" + themeName + "\" must be a style object.");
}, {
key: "render",
value: function render() {
var _extraProps;
var _this$props = this.props,
wrappedRef = _this$props.wrappedRef,
props = (0, _objectWithoutProperties2.default)(_this$props, ["wrappedRef"]);
var extraProps = (_extraProps = {}, (0, _defineProperty2.default)(_extraProps, stylesPropName, this.state.styles), (0, _defineProperty2.default)(_extraProps, "ref", wrappedRef), _extraProps);
if (passThemeProp) {
extraProps[themePropName] = aesthetic.getTheme();
}
return _react.default.createElement(WrappedComponent, (0, _extends2.default)({}, props, extraProps));
}
}
this.themes[themeName] = theme;
this.globals[themeName] = this.validateDefinition(themeName, globalSheet, this.globals);
return this;
};
/**
* Set multiple style declarations for a component.
*/
Aesthetic.prototype.setStyles = function (styleName, styleSheet, extendFrom) {
if (extendFrom === void 0) { extendFrom = ''; }
if (extendFrom) {
if (process.env.NODE_ENV !== 'production') {
if (!this.styles[extendFrom]) {
throw new Error("Cannot extend from \"" + extendFrom + "\" as those styles do not exist.");
}], [{
key: "extendStyles",
value: function extendStyles(customStyleSheet) {
var extendOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
if ("production" !== process.env.NODE_ENV) {
if (!extendable) {
throw new Error("".concat(baseName, " is not extendable."));
}
else if (extendFrom === styleName) {
throw new Error('Cannot extend styles from itself.');
}
}
return aesthetic.withStyles(customStyleSheet, (0, _objectSpread2.default)({}, options, extendOptions, {
extendFrom: styleName
}))(WrappedComponent);
}
this.parents[styleName] = extendFrom;
}
this.styles[styleName] = this.validateDefinition(styleName, styleSheet, this.styles);
return this;
};
/**
* Transform the list of style declarations to a list of class name.
*/
Aesthetic.prototype.transformStyles = function () {
var styles = [];
for (var _i = 0; _i < arguments.length; _i++) {
styles[_i] = arguments[_i];
}
var classNames = [];
var toTransform = [];
styles.forEach(function (style) {
if (!style) {
return;
}]);
return WithStyles;
}(Component);
(0, _defineProperty2.default)(WithStyles, "displayName", "withStyles(".concat(baseName, ")"));
(0, _defineProperty2.default)(WithStyles, "styleName", styleName);
(0, _defineProperty2.default)(WithStyles, "WrappedComponent", WrappedComponent);
(0, _hoistNonReactStatics.default)(WithStyles, WrappedComponent);
return WithStyles;
};
}
}, {
key: "withTheme",
value: function withTheme() {
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var aesthetic = this;
var _options$pure2 = options.pure,
pure = _options$pure2 === void 0 ? this.options.pure : _options$pure2,
_options$themePropNam2 = options.themePropName,
themePropName = _options$themePropNam2 === void 0 ? this.options.themePropName : _options$themePropNam2;
return function withThemeFactory(WrappedComponent) {
var baseName = WrappedComponent.displayName || WrappedComponent.name;
var Component = pure ? _react.default.PureComponent : _react.default.Component;
var WithTheme = function (_Component2) {
(0, _inherits2.default)(WithTheme, _Component2);
function WithTheme() {
(0, _classCallCheck2.default)(this, WithTheme);
return (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf3.default)(WithTheme).apply(this, arguments));
}
(0, _createClass2.default)(WithTheme, [{
key: "render",
value: function render() {
var _extraProps2;
var _this$props2 = this.props,
wrappedRef = _this$props2.wrappedRef,
props = (0, _objectWithoutProperties2.default)(_this$props2, ["wrappedRef"]);
var extraProps = (_extraProps2 = {}, (0, _defineProperty2.default)(_extraProps2, themePropName, aesthetic.getTheme()), (0, _defineProperty2.default)(_extraProps2, "ref", wrappedRef), _extraProps2);
return _react.default.createElement(WrappedComponent, (0, _extends2.default)({}, props, extraProps));
}
if (typeof style === 'string') {
classNames.push.apply(classNames, String(style)
.split(' ')
.map(function (s) { return stripClassPrefix_1.default(s).trim(); }));
}
else if (isObject_1.default(style)) {
toTransform.push(style);
}
else if (process.env.NODE_ENV !== 'production') {
throw new Error('Unsupported style type to transform.');
}
});
if (toTransform.length > 0) {
classNames.push(this.transformToClassName(toTransform));
}]);
return WithTheme;
}(Component);
(0, _defineProperty2.default)(WithTheme, "displayName", "withTheme(".concat(baseName, ")"));
(0, _defineProperty2.default)(WithTheme, "WrappedComponent", WrappedComponent);
(0, _hoistNonReactStatics.default)(WithTheme, WrappedComponent);
return WithTheme;
};
}
}, {
key: "validateDefinition",
value: function validateDefinition(key, value, cache) {
if ("production" !== process.env.NODE_ENV) {
if (cache[key]) {
throw new Error("Styles have already been defined for \"".concat(key, "\"."));
} else if (value !== null && typeof value !== 'function') {
throw new TypeError("Definition for \"".concat(key, "\" must be null or a function."));
}
return classNames.join(' ').trim();
};
/**
* Wrap a React component with an HOC that injects the defined stylesheet as a prop.
*/
Aesthetic.prototype.withStyles = function (styleSheet, options) {
if (options === void 0) { options = {}; }
var aesthetic = this;
var _a = options.extendable, extendable = _a === void 0 ? this.options.extendable : _a, _b = options.extendFrom, extendFrom = _b === void 0 ? '' : _b, _c = options.passThemeProp, passThemeProp = _c === void 0 ? this.options.passThemeProp : _c, _d = options.pure, pure = _d === void 0 ? this.options.pure : _d, _e = options.stylesPropName, stylesPropName = _e === void 0 ? this.options.stylesPropName : _e, _f = options.themePropName, themePropName = _f === void 0 ? this.options.themePropName : _f;
return function withStylesFactory(WrappedComponent) {
var baseName = WrappedComponent.displayName || WrappedComponent.name;
var styleName = baseName + "-" + v4_1.default();
var Component = pure ? react_1.default.PureComponent : react_1.default.Component;
aesthetic.setStyles(styleName, styleSheet, extendFrom);
var WithStyles = /** @class */ (function (_super) {
__extends(WithStyles, _super);
function WithStyles() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.state = {
styles: aesthetic.createStyleSheet(styleName),
};
return _this;
}
WithStyles.extendStyles = function (customStyleSheet, extendOptions) {
if (extendOptions === void 0) { extendOptions = {}; }
if (process.env.NODE_ENV !== 'production') {
if (!extendable) {
throw new Error(baseName + " is not extendable.");
}
}
return aesthetic.withStyles(customStyleSheet, __assign({}, options, extendOptions, { extendFrom: styleName }))(WrappedComponent);
};
WithStyles.prototype.componentDidMount = function () {
aesthetic.flushStyles(styleName);
};
WithStyles.prototype.render = function () {
var _a;
var _b = this.props, wrappedRef = _b.wrappedRef, props = __rest(_b, ["wrappedRef"]);
var extraProps = (_a = {},
_a[stylesPropName] = this.state.styles,
_a.ref = wrappedRef,
_a);
if (passThemeProp) {
extraProps[themePropName] = aesthetic.getTheme();
}
return react_1.default.createElement(WrappedComponent, __assign({}, props, extraProps));
};
WithStyles.displayName = "withStyles(" + baseName + ")";
WithStyles.styleName = styleName;
WithStyles.WrappedComponent = WrappedComponent;
return WithStyles;
}(Component));
hoist_non_react_statics_1.default(WithStyles, WrappedComponent);
return WithStyles;
};
};
/**
* Wrap a React component with an HOC that injects the current theme object as a prop.
*/
Aesthetic.prototype.withTheme = function (options) {
if (options === void 0) { options = {}; }
var aesthetic = this;
var _a = options.pure, pure = _a === void 0 ? this.options.pure : _a, _b = options.themePropName, themePropName = _b === void 0 ? this.options.themePropName : _b;
return function withThemeFactory(WrappedComponent) {
var baseName = WrappedComponent.displayName || WrappedComponent.name;
var Component = pure ? react_1.default.PureComponent : react_1.default.Component;
var WithTheme = /** @class */ (function (_super) {
__extends(WithTheme, _super);
function WithTheme() {
return _super !== null && _super.apply(this, arguments) || this;
}
WithTheme.prototype.render = function () {
var _a;
var _b = this.props, wrappedRef = _b.wrappedRef, props = __rest(_b, ["wrappedRef"]);
var extraProps = (_a = {},
_a[themePropName] = aesthetic.getTheme(),
_a.ref = wrappedRef,
_a);
return react_1.default.createElement(WrappedComponent, __assign({}, props, extraProps));
};
WithTheme.displayName = "withTheme(" + baseName + ")";
WithTheme.WrappedComponent = WrappedComponent;
return WithTheme;
}(Component));
hoist_non_react_statics_1.default(WithTheme, WrappedComponent);
return WithTheme;
};
};
Aesthetic.prototype.validateDefinition = function (key, value, cache) {
if (process.env.NODE_ENV !== 'production') {
if (cache[key]) {
throw new Error("Styles have already been defined for \"" + key + "\".");
}
else if (value !== null && typeof value !== 'function') {
throw new TypeError("Definition for \"" + key + "\" must be null or a function.");
}
}
return value;
};
return Aesthetic;
}());
exports.default = Aesthetic;
}
return value;
}
}]);
return Aesthetic;
}();
exports.default = Aesthetic;

@@ -1,6 +0,1 @@

/**
* @copyright 2017-2019, Miles Johnson
* @license https://opensource.org/licenses/MIT
* @flow
*/
import Aesthetic from './Aesthetic';

@@ -7,0 +2,0 @@ import { ClassName } from './types';

"use strict";
/**
* @copyright 2017-2019, Miles Johnson
* @license https://opensource.org/licenses/MIT
* @flow
*/
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var Aesthetic_1 = __importDefault(require("./Aesthetic"));
var ClassNameAesthetic = /** @class */ (function (_super) {
__extends(ClassNameAesthetic, _super);
function ClassNameAesthetic() {
return _super !== null && _super.apply(this, arguments) || this;
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
var _Aesthetic2 = _interopRequireDefault(require("./Aesthetic"));
var ClassNameAesthetic = function (_Aesthetic) {
(0, _inherits2.default)(ClassNameAesthetic, _Aesthetic);
function ClassNameAesthetic() {
(0, _classCallCheck2.default)(this, ClassNameAesthetic);
return (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(ClassNameAesthetic).apply(this, arguments));
}
(0, _createClass2.default)(ClassNameAesthetic, [{
key: "transformToClassName",
value: function transformToClassName(styles) {
return styles.filter(function (style) {
return style && typeof style === 'string';
}).join(' ');
}
ClassNameAesthetic.prototype.transformToClassName = function (styles) {
return styles.filter(function (style) { return style && typeof style === 'string'; }).join(' ');
};
return ClassNameAesthetic;
}(Aesthetic_1.default));
exports.default = ClassNameAesthetic;
}]);
return ClassNameAesthetic;
}(_Aesthetic2.default);
exports.default = ClassNameAesthetic;

@@ -1,7 +0,3 @@

/**
* @copyright 2017-2019, Miles Johnson
* @license https://opensource.org/licenses/MIT
*/
import { Omit } from 'utility-types';
import { FontFace } from '../types';
export default function formatFontFace(properties: Partial<FontFace>): Omit<FontFace, 'local' | 'srcPaths'>;
"use strict";
/**
* @copyright 2017-2019, Miles Johnson
* @license https://opensource.org/licenses/MIT
*/
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var toArray_1 = __importDefault(require("./toArray"));
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = formatFontFace;
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread"));
var _toArray = _interopRequireDefault(require("./toArray"));
var FORMATS = {
'.eot': 'embedded-opentype',
'.otf': 'opentype',
'.svg': 'svg',
'.svgz': 'svg',
'.ttf': 'truetype',
'.woff': 'woff',
'.woff2': 'woff2',
'.eot': 'embedded-opentype',
'.otf': 'opentype',
'.svg': 'svg',
'.svgz': 'svg',
'.ttf': 'truetype',
'.woff': 'woff',
'.woff2': 'woff2'
};
function formatFontFace(properties) {
var fontFace = __assign({}, properties);
var src = [];
if (fontFace.local) {
toArray_1.default(fontFace.local).forEach(function (alias) {
src.push("local('" + String(alias) + "')");
});
delete fontFace.local;
}
if (Array.isArray(fontFace.srcPaths)) {
toArray_1.default(fontFace.srcPaths).forEach(function (srcPath) {
var ext = srcPath.slice(srcPath.lastIndexOf('.'));
if (ext.indexOf('?') >= 0) {
ext = ext.split('?')[0];
}
if (FORMATS[ext]) {
src.push("url('" + srcPath + "') format('" + FORMATS[ext] + "')");
}
else if (process.env.NODE_ENV !== 'production') {
throw new Error("Unsupported font format \"" + ext + "\".");
}
});
delete fontFace.srcPaths;
}
else {
return fontFace;
}
fontFace.src = src.join(', ');
var fontFace = (0, _objectSpread2.default)({}, properties);
var src = [];
if (fontFace.local) {
(0, _toArray.default)(fontFace.local).forEach(function (alias) {
src.push("local('".concat(String(alias), "')"));
});
delete fontFace.local;
}
if (Array.isArray(fontFace.srcPaths)) {
(0, _toArray.default)(fontFace.srcPaths).forEach(function (srcPath) {
var ext = srcPath.slice(srcPath.lastIndexOf('.'));
if (ext.indexOf('?') >= 0) {
var _ext$split = ext.split('?');
var _ext$split2 = (0, _slicedToArray2.default)(_ext$split, 1);
ext = _ext$split2[0];
}
if (FORMATS[ext]) {
src.push("url('".concat(srcPath, "') format('").concat(FORMATS[ext], "')"));
} else if ("production" !== process.env.NODE_ENV) {
throw new Error("Unsupported font format \"".concat(ext, "\"."));
}
});
delete fontFace.srcPaths;
} else {
return fontFace;
}
exports.default = formatFontFace;
}
fontFace.src = src.join(', ');
return fontFace;
}

@@ -1,5 +0,1 @@

/**
* @copyright 2017-2019, Miles Johnson
* @license https://opensource.org/licenses/MIT
*/
export default function isObject(value: any): value is object;
"use strict";
/**
* @copyright 2017-2019, Miles Johnson
* @license https://opensource.org/licenses/MIT
*/
Object.defineProperty(exports, "__esModule", { value: true });
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = isObject;
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
function isObject(value) {
return value !== null && !Array.isArray(value) && typeof value === 'object';
}
exports.default = isObject;
return value !== null && !Array.isArray(value) && (0, _typeof2.default)(value) === 'object';
}

@@ -1,5 +0,1 @@

/**
* @copyright 2017-2019, Miles Johnson
* @license https://opensource.org/licenses/MIT
*/
export default function stripClassPrefix(name: string): string;
"use strict";
/**
* @copyright 2017-2019, Miles Johnson
* @license https://opensource.org/licenses/MIT
*/
Object.defineProperty(exports, "__esModule", { value: true });
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = stripClassPrefix;
function stripClassPrefix(name) {
return name.charAt(0) === '.' ? name.substring(1) : name;
}
exports.default = stripClassPrefix;
return name.charAt(0) === '.' ? name.substring(1) : name;
}

@@ -1,5 +0,1 @@

/**
* @copyright 2017-2019, Miles Johnson
* @license https://opensource.org/licenses/MIT
*/
export default function toArray<T>(value: T | T[]): T[];
"use strict";
/**
* @copyright 2017-2019, Miles Johnson
* @license https://opensource.org/licenses/MIT
*/
Object.defineProperty(exports, "__esModule", { value: true });
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = toArray;
function toArray(value) {
return Array.isArray(value) ? value : [value];
}
exports.default = toArray;
return Array.isArray(value) ? value : [value];
}

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

/**
* @copyright 2017-2019, Miles Johnson
* @license https://opensource.org/licenses/MIT
*/
interface ToObjectable {
export interface ToObjectable {
toObject(): any;

@@ -11,2 +7,1 @@ }

}): T;
export {};
"use strict";
/**
* @copyright 2017-2019, Miles Johnson
* @license https://opensource.org/licenses/MIT
*/
Object.defineProperty(exports, "__esModule", { value: true });
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = toObjectRecursive;
function toObjectRecursive(map) {
var object = {};
Object.keys(map).forEach(function (key) {
object[key] = map[key].toObject();
});
return object;
}
exports.default = toObjectRecursive;
var object = {};
Object.keys(map).forEach(function (key) {
object[key] = map[key].toObject();
});
return object;
}
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
Object.defineProperty(exports, "__esModule", {
value: true
});
var _exportNames = {
AestheticOptions: true,
ClassNameAesthetic: true,
UnifiedSyntax: true,
Ruleset: true,
Sheet: true
};
Object.defineProperty(exports, "AestheticOptions", {
enumerable: true,
get: function get() {
return _Aesthetic.AestheticOptions;
}
});
Object.defineProperty(exports, "ClassNameAesthetic", {
enumerable: true,
get: function get() {
return _ClassNameAesthetic.default;
}
});
Object.defineProperty(exports, "UnifiedSyntax", {
enumerable: true,
get: function get() {
return _UnifiedSyntax.default;
}
});
Object.defineProperty(exports, "Ruleset", {
enumerable: true,
get: function get() {
return _Ruleset.default;
}
});
Object.defineProperty(exports, "Sheet", {
enumerable: true,
get: function get() {
return _Sheet.default;
}
});
exports.default = void 0;
var _Aesthetic = _interopRequireWildcard(require("./Aesthetic"));
var _ClassNameAesthetic = _interopRequireDefault(require("./ClassNameAesthetic"));
var _UnifiedSyntax = _interopRequireDefault(require("./UnifiedSyntax"));
var _Ruleset = _interopRequireDefault(require("./Ruleset"));
var _Sheet = _interopRequireDefault(require("./Sheet"));
var _types = require("./types");
Object.keys(_types).forEach(function (key) {
if (key === "default" || key === "__esModule") return;
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function get() {
return _types[key];
}
});
});
/**

@@ -6,15 +76,3 @@ * @copyright 2017-2019, Miles Johnson

*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var Aesthetic_1 = __importDefault(require("./Aesthetic"));
var ClassNameAesthetic_1 = __importDefault(require("./ClassNameAesthetic"));
exports.ClassNameAesthetic = ClassNameAesthetic_1.default;
var UnifiedSyntax_1 = __importDefault(require("./UnifiedSyntax"));
exports.UnifiedSyntax = UnifiedSyntax_1.default;
var Ruleset_1 = __importDefault(require("./Ruleset"));
exports.Ruleset = Ruleset_1.default;
var Sheet_1 = __importDefault(require("./Sheet"));
exports.Sheet = Sheet_1.default;
exports.default = Aesthetic_1.default;
var _default = _Aesthetic.default;
exports.default = _default;

@@ -1,5 +0,1 @@

/**
* @copyright 2017-2019, Miles Johnson
* @license https://opensource.org/licenses/MIT
*/
import Sheet from './Sheet';

@@ -6,0 +2,0 @@ export default class Ruleset<Block extends object> {

"use strict";
/**
* @copyright 2017-2019, Miles Johnson
* @license https://opensource.org/licenses/MIT
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var toObjectRecursive_1 = __importDefault(require("./helpers/toObjectRecursive"));
var Ruleset = /** @class */ (function () {
function Ruleset(selector, root, parent) {
if (parent === void 0) { parent = null; }
this.nested = {};
this.parent = null;
this.properties = {};
this.selector = selector;
this.root = root;
this.parent = parent;
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
var _toObjectRecursive = _interopRequireDefault(require("./helpers/toObjectRecursive"));
var Ruleset = function () {
function Ruleset(selector, root) {
var parent = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
(0, _classCallCheck2.default)(this, Ruleset);
(0, _defineProperty2.default)(this, "nested", {});
(0, _defineProperty2.default)(this, "parent", null);
(0, _defineProperty2.default)(this, "properties", {});
(0, _defineProperty2.default)(this, "root", void 0);
(0, _defineProperty2.default)(this, "selector", void 0);
this.selector = selector;
this.root = root;
this.parent = parent;
}
(0, _createClass2.default)(Ruleset, [{
key: "addNested",
value: function addNested(selector, ruleset) {
var merge = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
if (merge && this.nested[selector]) {
this.nested[selector].merge(ruleset);
} else {
this.nested[selector] = ruleset;
}
return this;
}
Ruleset.prototype.addNested = function (selector, ruleset, merge) {
if (merge === void 0) { merge = true; }
if (merge && this.nested[selector]) {
this.nested[selector].merge(ruleset);
}
else {
this.nested[selector] = ruleset;
}
return this;
};
Ruleset.prototype.addProperty = function (key, value) {
this.properties[key] = value;
return this;
};
Ruleset.prototype.createRuleset = function (selector) {
return new Ruleset(selector, this.root, this);
};
Ruleset.prototype.merge = function (ruleset) {
var _this = this;
Object.assign(this.properties, ruleset.properties);
Object.keys(ruleset.nested).forEach(function (selector) {
_this.addNested(selector, ruleset.nested[selector]);
});
return this;
};
Ruleset.prototype.toObject = function () {
// eslint-disable-next-line prefer-object-spread
return Object.assign({}, this.properties, toObjectRecursive_1.default(this.nested));
};
return Ruleset;
}());
exports.default = Ruleset;
}, {
key: "addProperty",
value: function addProperty(key, value) {
this.properties[key] = value;
return this;
}
}, {
key: "createRuleset",
value: function createRuleset(selector) {
return new Ruleset(selector, this.root, this);
}
}, {
key: "merge",
value: function merge(ruleset) {
var _this = this;
Object.assign(this.properties, ruleset.properties);
Object.keys(ruleset.nested).forEach(function (selector) {
_this.addNested(selector, ruleset.nested[selector]);
});
return this;
}
}, {
key: "toObject",
value: function toObject() {
return Object.assign({}, this.properties, (0, _toObjectRecursive.default)(this.nested));
}
}]);
return Ruleset;
}();
exports.default = Ruleset;

@@ -1,5 +0,1 @@

/**
* @copyright 2017-2019, Miles Johnson
* @license https://opensource.org/licenses/MIT
*/
import Ruleset from './Ruleset';

@@ -6,0 +2,0 @@ import { ClassName, SheetMap } from './types';

"use strict";
/**
* @copyright 2017-2019, Miles Johnson
* @license https://opensource.org/licenses/MIT
*/
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread"));
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
var _toObjectRecursive = _interopRequireDefault(require("./helpers/toObjectRecursive"));
var _Ruleset = _interopRequireDefault(require("./Ruleset"));
var Sheet = function () {
function Sheet() {
(0, _classCallCheck2.default)(this, Sheet);
(0, _defineProperty2.default)(this, "atRules", {});
(0, _defineProperty2.default)(this, "classNames", {});
(0, _defineProperty2.default)(this, "ruleSets", {});
}
(0, _createClass2.default)(Sheet, [{
key: "addAtRule",
value: function addAtRule(rule, value) {
this.atRules[rule] = value;
return this;
}
}, {
key: "addClassName",
value: function addClassName(selector, value) {
this.classNames[selector] = value;
return this;
}
}, {
key: "addRuleset",
value: function addRuleset(set) {
this.ruleSets[set.selector] = set;
return this;
}
}, {
key: "createRuleset",
value: function createRuleset(selector) {
return new _Ruleset.default(selector, this);
}
}, {
key: "toObject",
value: function toObject() {
var _this = this;
var atRules = {};
var sets = {};
Object.keys(this.atRules).forEach(function (key) {
var value = _this.atRules[key];
if (value instanceof Sheet || value instanceof _Ruleset.default) {
sets[key] = value;
} else if (Array.isArray(value)) {
atRules[key] = value.map(function (item) {
return item instanceof _Ruleset.default ? item.toObject() : item;
});
} else {
atRules[key] = value;
}
return t;
};
return __assign.apply(this, arguments);
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var toObjectRecursive_1 = __importDefault(require("./helpers/toObjectRecursive"));
var Ruleset_1 = __importDefault(require("./Ruleset"));
var Sheet = /** @class */ (function () {
function Sheet() {
this.atRules = {};
this.classNames = {};
this.ruleSets = {};
});
return (0, _objectSpread2.default)({}, atRules, this.classNames, (0, _toObjectRecursive.default)(sets), (0, _toObjectRecursive.default)(this.ruleSets));
}
Sheet.prototype.addAtRule = function (rule, value) {
this.atRules[rule] = value;
return this;
};
Sheet.prototype.addClassName = function (selector, value) {
this.classNames[selector] = value;
return this;
};
Sheet.prototype.addRuleset = function (set) {
this.ruleSets[set.selector] = set;
return this;
};
Sheet.prototype.createRuleset = function (selector) {
return new Ruleset_1.default(selector, this);
};
Sheet.prototype.toObject = function () {
var _this = this;
var atRules = {};
var sets = {};
Object.keys(this.atRules).forEach(function (key) {
var value = _this.atRules[key];
if (value instanceof Sheet || value instanceof Ruleset_1.default) {
sets[key] = value;
}
else if (Array.isArray(value)) {
// @ts-ignore This type is resolving weird
atRules[key] = value.map(function (item) { return (item instanceof Ruleset_1.default ? item.toObject() : item); });
}
else {
atRules[key] = value;
}
});
return __assign({}, atRules, this.classNames, toObjectRecursive_1.default(sets), toObjectRecursive_1.default(this.ruleSets));
};
return Sheet;
}());
exports.default = Sheet;
}]);
return Sheet;
}();
exports.default = Sheet;

@@ -1,5 +0,1 @@

/**
* @copyright 2017-2019, Miles Johnson
* @license https://opensource.org/licenses/MIT
*/
/// <reference types="react" />

@@ -6,0 +2,0 @@ import CSS from 'csstype';

@@ -1,6 +0,1 @@

"use strict";
/**
* @copyright 2017-2019, Miles Johnson
* @license https://opensource.org/licenses/MIT
*/
Object.defineProperty(exports, "__esModule", { value: true });
"use strict";

@@ -1,5 +0,1 @@

/**
* @copyright 2017-2019, Miles Johnson
* @license https://opensource.org/licenses/MIT
*/
import Ruleset from './Ruleset';

@@ -6,0 +2,0 @@ import Sheet from './Sheet';

"use strict";
/**
* @copyright 2017-2019, Miles Johnson
* @license https://opensource.org/licenses/MIT
*/
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = exports.SELECTOR = void 0;
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread"));
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
var _formatFontFace = _interopRequireDefault(require("./helpers/formatFontFace"));
var _isObject = _interopRequireDefault(require("./helpers/isObject"));
var _toArray = _interopRequireDefault(require("./helpers/toArray"));
var _Sheet = _interopRequireDefault(require("./Sheet"));
var SELECTOR = /^((\[[\x2Da-z\u017F\u212A]+\])|(::?[\x2Da-z\u017F\u212A]+))$/i;
exports.SELECTOR = SELECTOR;
var UnifiedSyntax = function () {
function UnifiedSyntax() {
var _this = this;
(0, _classCallCheck2.default)(this, UnifiedSyntax);
(0, _defineProperty2.default)(this, "handlers", {});
(0, _defineProperty2.default)(this, "keyframesCount", 0);
(0, _defineProperty2.default)(this, "handleAnimationName", function (ruleset, value) {
if (!value) {
return undefined;
}
return (Array.isArray(value) ? value : [value]).map(function (item) {
if (typeof item === 'string') {
return item;
}
return t;
};
return __assign.apply(this, arguments);
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
/* eslint-disable lines-between-class-members, no-dupe-class-members, complexity */
var formatFontFace_1 = __importDefault(require("./helpers/formatFontFace"));
var isObject_1 = __importDefault(require("./helpers/isObject"));
var toArray_1 = __importDefault(require("./helpers/toArray"));
var Sheet_1 = __importDefault(require("./Sheet"));
exports.SELECTOR = /^((\[[a-z-]+\])|(::?[a-z-]+))$/iu;
var UnifiedSyntax = /** @class */ (function () {
function UnifiedSyntax() {
var _this = this;
this.handlers = {};
this.keyframesCount = 0;
/**
* Support keyframe objects within the `animationName` property.
*/
this.handleAnimationName = function (ruleset, value) {
if (!value) {
return undefined;
var name = item.name || "keyframe-".concat(_this.keyframesCount += 1);
_this.convertKeyframe(name, item, ruleset.root);
return name;
}).join(', ');
});
(0, _defineProperty2.default)(this, "handleFontFamily", function (ruleset, value) {
if (!value) {
return undefined;
}
var output = new Set();
var fontFaces = {};
(0, _toArray.default)(value).forEach(function (item) {
if (typeof item === 'string') {
output.add(item);
return;
}
var name = item.fontFamily;
if (!name) {
return;
}
output.add(name);
if (fontFaces[name]) {
fontFaces[name].push(item);
} else {
fontFaces[name] = [item];
}
});
Object.keys(fontFaces).forEach(function (fontFamily) {
_this.convertFontFaces(fontFamily, fontFaces[fontFamily], ruleset.root);
});
return Array.from(output).join(', ');
});
this.on('property:animationName', this.handleAnimationName);
this.on('property:fontFamily', this.handleFontFamily);
}
(0, _createClass2.default)(UnifiedSyntax, [{
key: "convertGlobalSheet",
value: function convertGlobalSheet(globalSheet) {
var _this2 = this;
var sheet = new _Sheet.default();
Object.keys(globalSheet).forEach(function (rule) {
switch (rule) {
case '@charset':
{
var path = globalSheet[rule];
if (typeof path === 'string') {
_this2.emit('charset', [sheet, path]);
} else if ("production" !== process.env.NODE_ENV) {
throw new Error('@charset must be a string.');
}
break;
}
return (Array.isArray(value) ? value : [value])
.map(function (item) {
if (typeof item === 'string') {
return item;
case '@font-face':
{
var faces = globalSheet[rule] || {};
if ("production" !== process.env.NODE_ENV) {
if (!(0, _isObject.default)(faces)) {
throw new Error('@font-face must be an object of font family names to font faces.');
}
var name = item.name || "keyframe-" + (_this.keyframesCount += 1);
_this.convertKeyframe(name, item, ruleset.root);
return name;
})
.join(', ');
};
/**
* Support font face objets within the `fontFamily` property.
*/
this.handleFontFamily = function (ruleset, value) {
if (!value) {
return undefined;
}
Object.keys(faces).forEach(function (fontFamily) {
_this2.convertFontFaces(fontFamily, (0, _toArray.default)(faces[fontFamily]), sheet);
});
break;
}
var output = new Set();
var fontFaces = {};
toArray_1.default(value).forEach(function (item) {
if (typeof item === 'string') {
output.add(item);
return;
case '@global':
{
var globals = globalSheet[rule] || {};
if ("production" !== process.env.NODE_ENV) {
if (!(0, _isObject.default)(globals)) {
throw new Error('@global must be an object of selectors to ruleset objects.');
}
var name = item.fontFamily;
if (!name) {
return;
}
Object.keys(globals).forEach(function (selector) {
if ((0, _isObject.default)(globals[selector])) {
_this2.emit('global', [sheet, selector, _this2.convertRuleset(globals[selector], sheet.createRuleset(selector))]);
} else if ("production" !== process.env.NODE_ENV) {
throw new Error("@global \"".concat(selector, "\" must be a ruleset object."));
}
output.add(name);
if (fontFaces[name]) {
fontFaces[name].push(item);
}
else {
fontFaces[name] = [item];
}
});
Object.keys(fontFaces).forEach(function (fontFamily) {
_this.convertFontFaces(fontFamily, fontFaces[fontFamily], ruleset.root);
});
return Array.from(output).join(', ');
};
this.on('property:animationName', this.handleAnimationName);
this.on('property:fontFamily', this.handleFontFamily);
}
/**
* Convert at-rules within a global stylesheet.
*/
UnifiedSyntax.prototype.convertGlobalSheet = function (globalSheet) {
var _this = this;
var sheet = new Sheet_1.default();
Object.keys(globalSheet).forEach(function (rule) {
switch (rule) {
case '@charset': {
var path = globalSheet[rule];
if (typeof path === 'string') {
_this.emit('charset', [sheet, path]);
}
else if (process.env.NODE_ENV !== 'production') {
throw new Error('@charset must be a string.');
}
break;
}
case '@font-face': {
var faces_1 = globalSheet[rule] || {};
if (process.env.NODE_ENV !== 'production') {
if (!isObject_1.default(faces_1)) {
throw new Error('@font-face must be an object of font family names to font faces.');
}
}
Object.keys(faces_1).forEach(function (fontFamily) {
_this.convertFontFaces(fontFamily, toArray_1.default(faces_1[fontFamily]), sheet);
});
break;
}
case '@global': {
var globals_1 = globalSheet[rule] || {};
if (process.env.NODE_ENV !== 'production') {
if (!isObject_1.default(globals_1)) {
throw new Error('@global must be an object of selectors to ruleset objects.');
}
}
Object.keys(globals_1).forEach(function (selector) {
if (isObject_1.default(globals_1[selector])) {
_this.emit('global', [
sheet,
selector,
_this.convertRuleset(globals_1[selector], sheet.createRuleset(selector)),
]);
}
else if (process.env.NODE_ENV !== 'production') {
throw new Error("@global \"" + selector + "\" must be a ruleset object.");
}
});
break;
}
case '@import': {
var paths = globalSheet[rule];
if (typeof paths === 'string' || Array.isArray(paths)) {
_this.emit('import', [sheet, toArray_1.default(paths).map(function (path) { return String(path); })]);
}
else if (process.env.NODE_ENV !== 'production') {
throw new Error('@import must be a string or an array of strings.');
}
break;
}
case '@keyframes': {
var frames_1 = globalSheet[rule] || {};
if (process.env.NODE_ENV !== 'production') {
if (!isObject_1.default(frames_1)) {
throw new Error('@keyframes must be an object of animation names to keyframes.');
}
}
Object.keys(frames_1).forEach(function (animationName) {
_this.convertKeyframe(animationName, frames_1[animationName], sheet);
});
break;
}
case '@page':
case '@viewport': {
var style = globalSheet[rule];
if (isObject_1.default(style)) {
_this.emit(rule.slice(1), [
sheet,
_this.convertRuleset(style, sheet.createRuleset(rule)),
]);
}
else if (process.env.NODE_ENV !== 'production') {
throw new Error(rule + " must be a ruleset object.");
}
break;
}
default: {
if (process.env.NODE_ENV !== 'production') {
throw new Error("Unknown property \"" + rule + "\". Only at-rules are allowed in the global stylesheet.");
}
}
});
break;
}
});
return sheet;
};
/**
* Convert a mapping of unified rulesets to their native syntax.
*/
UnifiedSyntax.prototype.convertStyleSheet = function (styleSheet) {
var _this = this;
var sheet = new Sheet_1.default();
Object.keys(styleSheet).forEach(function (selector) {
var ruleset = styleSheet[selector];
if (!ruleset) {
return;
case '@import':
{
var paths = globalSheet[rule];
if (typeof paths === 'string' || Array.isArray(paths)) {
_this2.emit('import', [sheet, (0, _toArray.default)(paths).map(function (path) {
return String(path);
})]);
} else if ("production" !== process.env.NODE_ENV) {
throw new Error('@import must be a string or an array of strings.');
}
break;
}
// At-rule
if (selector.charAt(0) === '@') {
if (process.env.NODE_ENV !== 'production') {
throw new SyntaxError("At-rules may not be defined in the root, found \"" + selector + "\".");
case '@keyframes':
{
var frames = globalSheet[rule] || {};
if ("production" !== process.env.NODE_ENV) {
if (!(0, _isObject.default)(frames)) {
throw new Error('@keyframes must be an object of animation names to keyframes.');
}
// Class name
}
Object.keys(frames).forEach(function (animationName) {
_this2.convertKeyframe(animationName, frames[animationName], sheet);
});
break;
}
else if (typeof ruleset === 'string') {
sheet.addClassName(selector, ruleset);
// Style object
case '@page':
case '@viewport':
{
var style = globalSheet[rule];
if ((0, _isObject.default)(style)) {
_this2.emit(rule.slice(1), [sheet, _this2.convertRuleset(style, sheet.createRuleset(rule))]);
} else if ("production" !== process.env.NODE_ENV) {
throw new Error("".concat(rule, " must be a ruleset object."));
}
break;
}
else if (isObject_1.default(ruleset)) {
sheet.addRuleset(_this.convertRuleset(ruleset, sheet.createRuleset(selector)));
// Unknown
default:
{
if ("production" !== process.env.NODE_ENV) {
throw new Error("Unknown property \"".concat(rule, "\". Only at-rules are allowed in the global stylesheet."));
}
}
else if (process.env.NODE_ENV !== 'production') {
throw new Error("Invalid ruleset for \"" + selector + "\". Must be an object or class name.");
}
});
return sheet;
};
/**
* Convert a ruleset including local at-rules, blocks, and properties.
*/
UnifiedSyntax.prototype.convertRuleset = function (unifiedRuleset, ruleset) {
var _this = this;
if (process.env.NODE_ENV !== 'production') {
if (!isObject_1.default(unifiedRuleset)) {
throw new TypeError('Ruleset must be an object of properties.');
}
}
var atRules = [];
Object.keys(unifiedRuleset).forEach(function (baseKey) {
var key = baseKey;
var value = unifiedRuleset[key];
if (typeof value === 'undefined') {
return;
});
return sheet;
}
}, {
key: "convertStyleSheet",
value: function convertStyleSheet(styleSheet) {
var _this3 = this;
var sheet = new _Sheet.default();
Object.keys(styleSheet).forEach(function (selector) {
var ruleset = styleSheet[selector];
if (!ruleset) {
return;
}
if (selector.charAt(0) === '@') {
if ("production" !== process.env.NODE_ENV) {
throw new SyntaxError("At-rules may not be defined in the root, found \"".concat(selector, "\"."));
}
} else if (typeof ruleset === 'string') {
sheet.addClassName(selector, ruleset);
} else if ((0, _isObject.default)(ruleset)) {
sheet.addRuleset(_this3.convertRuleset(ruleset, sheet.createRuleset(selector)));
} else if ("production" !== process.env.NODE_ENV) {
throw new Error("Invalid ruleset for \"".concat(selector, "\". Must be an object or class name."));
}
});
return sheet;
}
}, {
key: "convertRuleset",
value: function convertRuleset(unifiedRuleset, ruleset) {
var _this4 = this;
if ("production" !== process.env.NODE_ENV) {
if (!(0, _isObject.default)(unifiedRuleset)) {
throw new TypeError('Ruleset must be an object of properties.');
}
}
var atRules = [];
Object.keys(unifiedRuleset).forEach(function (baseKey) {
var key = baseKey;
var value = unifiedRuleset[key];
if (typeof value === 'undefined') {
return;
}
if (key.startsWith('@')) {
atRules.push(key);
} else if (key.startsWith(':') || key.startsWith('[')) {
_this4.convertSelector(key, value, ruleset);
} else {
var newValue = _this4.emit("property:".concat(key), [ruleset, value]);
_this4.emit('property', [ruleset, key, newValue || value]);
}
});
atRules.forEach(function (key) {
switch (key) {
case '@fallbacks':
{
var fallbacks = unifiedRuleset[key] || {};
if ("production" !== process.env.NODE_ENV) {
if (!(0, _isObject.default)(fallbacks)) {
throw new Error('@fallbacks must be an object of property names to fallback values.');
}
}
Object.keys(fallbacks).forEach(function (property) {
_this4.emit('fallback', [ruleset, property, (0, _toArray.default)(fallbacks[property])]);
});
break;
}
if (key.startsWith('@')) {
atRules.push(key);
}
else if (key.startsWith(':') || key.startsWith('[')) {
_this.convertSelector(key, value, ruleset);
}
else {
// @ts-ignore These events are internal only, so ignore the type issues
var newValue = _this.emit("property:" + key, [ruleset, value]);
_this.emit('property', [ruleset, key, newValue || value]);
}
});
// Process at-rule's after properties, as some at-rule's may require
// a property or nested value to exist before modifying it.
atRules.forEach(function (key) {
switch (key) {
case '@fallbacks': {
var fallbacks_1 = unifiedRuleset[key] || {};
if (process.env.NODE_ENV !== 'production') {
if (!isObject_1.default(fallbacks_1)) {
throw new Error('@fallbacks must be an object of property names to fallback values.');
}
}
Object.keys(fallbacks_1).forEach(function (property) {
_this.emit('fallback', [
ruleset,
property,
toArray_1.default(fallbacks_1[property]),
]);
});
break;
case '@media':
case '@supports':
{
var styles = unifiedRuleset[key] || {};
if ("production" !== process.env.NODE_ENV) {
if (!(0, _isObject.default)(styles)) {
throw new Error("".concat(key, " must be an object of queries to rulesets."));
}
case '@media':
case '@supports': {
var styles_1 = unifiedRuleset[key] || {};
if (process.env.NODE_ENV !== 'production') {
if (!isObject_1.default(styles_1)) {
throw new Error(key + " must be an object of queries to rulesets.");
}
}
Object.keys(styles_1).forEach(function (query) {
if (isObject_1.default(styles_1[query])) {
var event_1 = key === '@media' ? 'media' : 'support';
_this.emit(event_1, [
ruleset,
query,
_this.convertRuleset(styles_1[query], ruleset.createRuleset(key + " " + query)),
]);
}
else if (process.env.NODE_ENV !== 'production') {
throw new Error(key + " " + query + " must be a mapping of conditions to style objects.");
}
});
break;
}
Object.keys(styles).forEach(function (query) {
if ((0, _isObject.default)(styles[query])) {
var event = key === '@media' ? 'media' : 'support';
_this4.emit(event, [ruleset, query, _this4.convertRuleset(styles[query], ruleset.createRuleset("".concat(key, " ").concat(query)))]);
} else if ("production" !== process.env.NODE_ENV) {
throw new Error("".concat(key, " ").concat(query, " must be a mapping of conditions to style objects."));
}
case '@selectors': {
var selectors_1 = unifiedRuleset[key] || {};
if (process.env.NODE_ENV !== 'production') {
if (!isObject_1.default(selectors_1)) {
throw new Error('@selectors must be an object of selectors to rulesets.');
}
}
Object.keys(selectors_1).forEach(function (selector) {
_this.convertSelector(selector, selectors_1[selector], ruleset, true);
});
break;
});
break;
}
case '@selectors':
{
var selectors = unifiedRuleset[key] || {};
if ("production" !== process.env.NODE_ENV) {
if (!(0, _isObject.default)(selectors)) {
throw new Error('@selectors must be an object of selectors to rulesets.');
}
default: {
if (process.env.NODE_ENV !== 'production') {
throw new SyntaxError("Unsupported local at-rule \"" + key + "\".");
}
}
}
Object.keys(selectors).forEach(function (selector) {
_this4.convertSelector(selector, selectors[selector], ruleset, true);
});
break;
}
});
return ruleset;
};
/**
* Convert a nested selector ruleset by emitting the appropriate name.
*/
UnifiedSyntax.prototype.convertSelector = function (key, value, ruleset, inAtRule) {
var _this = this;
if (inAtRule === void 0) { inAtRule = false; }
if (process.env.NODE_ENV !== 'production') {
if (!isObject_1.default(value)) {
throw new Error("Selector \"" + key + "\" must be a ruleset object.");
default:
{
if ("production" !== process.env.NODE_ENV) {
throw new SyntaxError("Unsupported local at-rule \"".concat(key, "\"."));
}
}
else if ((key.includes(',') || !key.match(exports.SELECTOR)) && !inAtRule) {
throw new Error("Advanced selector \"" + key + "\" must be nested within an @selectors block.");
}
}
key.split(',').forEach(function (k) {
var selector = k.trim();
var type = 'selector';
if (selector.charAt(0) === ':') {
type = 'pseudo';
}
else if (selector.charAt(0) === '[') {
type = 'attribute';
}
_this.emit(type, [
ruleset,
selector,
_this.convertRuleset(value, ruleset.createRuleset(selector)),
]);
});
};
/**
* Convert a unified syntax list of font face objects to rulesets.
*/
UnifiedSyntax.prototype.convertFontFaces = function (fontFamily, faces, sheet) {
var _this = this;
var srcPaths = [];
var fontFaces = faces.map(function (font) {
srcPaths.push(font.srcPaths);
return _this.convertRuleset(formatFontFace_1.default(__assign({}, font, { fontFamily: fontFamily })), sheet.createRuleset(fontFamily));
});
this.emit('font-face', [sheet, fontFaces, fontFamily, srcPaths]);
};
/**
* Convert a unified syntax keyframes object to a ruleset.
*/
UnifiedSyntax.prototype.convertKeyframe = function (animationName, frames, sheet) {
var _this = this;
var keyframe = sheet.createRuleset(animationName);
// from, to, and percent keys aren't easily detectable
// when converting a ruleset. We also don't want adapters
// to have to worry about it, so do it manually here.
Object.keys(frames).forEach(function (key) {
var value = frames[key];
// Filter out "name" property
if (typeof value !== 'string' && typeof value !== 'undefined') {
keyframe.addNested(key, _this.convertRuleset(value, keyframe.createRuleset(key)));
}
});
this.emit('keyframe', [sheet, keyframe, animationName]);
};
/**
* Replace a `fontFamily` property with font face objects of the same name.
*/
UnifiedSyntax.prototype.injectFontFaces = function (value, cache) {
if (value === void 0) { value = ''; }
if (cache === void 0) { cache = {}; }
var fontFaces = [];
value.split(',').forEach(function (name) {
var familyName = name.trim();
var fonts = cache[familyName];
if (Array.isArray(fonts)) {
fontFaces.push.apply(fontFaces, fonts);
}
else {
fontFaces.push(familyName);
}
});
return fontFaces;
};
/**
* Replace a `animationName` property with keyframe objects of the same name.
*/
UnifiedSyntax.prototype.injectKeyframes = function (value, cache) {
if (value === void 0) { value = ''; }
if (cache === void 0) { cache = {}; }
return value.split(',').map(function (name) {
var animationName = name.trim();
return cache[animationName] || animationName;
});
};
UnifiedSyntax.prototype.emit = function (eventName, args) {
var _a;
if (this.handlers[eventName]) {
return (_a = this.handlers)[eventName].apply(_a, args);
});
return ruleset;
}
}, {
key: "convertSelector",
value: function convertSelector(key, value, ruleset) {
var _this5 = this;
var inAtRule = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
if ("production" !== process.env.NODE_ENV) {
if (!(0, _isObject.default)(value)) {
throw new Error("Selector \"".concat(key, "\" must be a ruleset object."));
} else if ((key.includes(',') || !key.match(SELECTOR)) && !inAtRule) {
throw new Error("Advanced selector \"".concat(key, "\" must be nested within an @selectors block."));
}
return undefined;
};
/**
* Delete an event listener.
*/
UnifiedSyntax.prototype.off = function (eventName) {
delete this.handlers[eventName];
return this;
};
UnifiedSyntax.prototype.on = function (eventName, callback) {
this.handlers[eventName] = callback;
return this;
};
return UnifiedSyntax;
}());
exports.default = UnifiedSyntax;
}
key.split(',').forEach(function (k) {
var selector = k.trim();
var type = 'selector';
if (selector.charAt(0) === ':') {
type = 'pseudo';
} else if (selector.charAt(0) === '[') {
type = 'attribute';
}
_this5.emit(type, [ruleset, selector, _this5.convertRuleset(value, ruleset.createRuleset(selector))]);
});
}
}, {
key: "convertFontFaces",
value: function convertFontFaces(fontFamily, faces, sheet) {
var _this6 = this;
var srcPaths = [];
var fontFaces = faces.map(function (font) {
srcPaths.push(font.srcPaths);
return _this6.convertRuleset((0, _formatFontFace.default)((0, _objectSpread2.default)({}, font, {
fontFamily: fontFamily
})), sheet.createRuleset(fontFamily));
});
this.emit('font-face', [sheet, fontFaces, fontFamily, srcPaths]);
}
}, {
key: "convertKeyframe",
value: function convertKeyframe(animationName, frames, sheet) {
var _this7 = this;
var keyframe = sheet.createRuleset(animationName);
Object.keys(frames).forEach(function (key) {
var value = frames[key];
if (typeof value !== 'string' && typeof value !== 'undefined') {
keyframe.addNested(key, _this7.convertRuleset(value, keyframe.createRuleset(key)));
}
});
this.emit('keyframe', [sheet, keyframe, animationName]);
}
}, {
key: "injectFontFaces",
value: function injectFontFaces() {
var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
var cache = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var fontFaces = [];
value.split(',').forEach(function (name) {
var familyName = name.trim();
var fonts = cache[familyName];
if (Array.isArray(fonts)) {
fontFaces.push.apply(fontFaces, (0, _toConsumableArray2.default)(fonts));
} else {
fontFaces.push(familyName);
}
});
return fontFaces;
}
}, {
key: "injectKeyframes",
value: function injectKeyframes() {
var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
var cache = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
return value.split(',').map(function (name) {
var animationName = name.trim();
return cache[animationName] || animationName;
});
}
}, {
key: "emit",
value: function emit(eventName, args) {
if (this.handlers[eventName]) {
var _this$handlers;
return (_this$handlers = this.handlers)[eventName].apply(_this$handlers, (0, _toConsumableArray2.default)(args));
}
return undefined;
}
}, {
key: "off",
value: function off(eventName) {
delete this.handlers[eventName];
return this;
}
}, {
key: "on",
value: function on(eventName, callback) {
this.handlers[eventName] = callback;
return this;
}
}]);
return UnifiedSyntax;
}();
exports.default = UnifiedSyntax;
{
"name": "aesthetic",
"version": "3.0.1",
"version": "3.1.0",
"description": "Aesthetic is a powerful type-safe React library for styling components through the use of adapters.",

@@ -23,3 +23,5 @@ "keywords": [

"main": "./lib/index.js",
"module": "./esm/index.js",
"types": "./lib/index.d.ts",
"sideEffects": false,
"publishConfig": {

@@ -31,5 +33,5 @@ "access": "public"

"@types/hoist-non-react-statics": "^3.0.1",
"@types/react": "^16.7.22",
"@types/react": "^16.8.2",
"@types/uuid": "^3.4.4",
"csstype": "^2.6.1",
"csstype": "^2.6.2",
"extend": "^3.0.2",

@@ -46,5 +48,5 @@ "hoist-non-react-statics": "^3.3.0",

"prop-types": "^15.6.2",
"react": "^16.7.0"
"react": "^16.8.1"
},
"gitHead": "55e0a46ade78aaa4dc283ef6635ecb73e1a57669"
"gitHead": "7f1f8f5b95bddc2f3a43c7aa87defa663682bf13"
}
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