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

@exah/prop-styles-system

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@exah/prop-styles-system - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

8

cjs/core/prop-styles.js

@@ -102,8 +102,10 @@ 'use strict';

var _matched = (0, _slicedToArray3.default)(matched, 3),
style = _matched[0],
propStyle = _matched[0],
mediaKey = _matched[1],
mediaQuery = _matched[2];
return acc.concat((0, _utils.toArr)(style).map(function (_style) {
return (0, _utils.wrapIfMedia)(mediaQuery, (0, _utils.getStyles)(_style, props[key], props, mediaKey)) || [];
var value = props[key];
return acc.concat((0, _utils.toArr)(propStyle).map(function (style) {
return (0, _utils.wrapIfMedia)(mediaQuery, (0, _utils.isFn)(style) ? style(value, props, mediaKey) : value === true ? style : null) || [];
}));

@@ -110,0 +112,0 @@ }

@@ -13,5 +13,5 @@ 'use strict';

var onMedia = (0, _ramda.curryN)(3, function (mediaKey, style, props) {
return (0, _utils.wrapIfMedia)((0, _utils.themeMedia)(props.theme)[mediaKey], (0, _utils.getStyles)(style, props, mediaKey));
return (0, _utils.wrapIfMedia)((0, _utils.themeMedia)(props.theme)[mediaKey], (0, _utils.isFn)(style) ? style(props, mediaKey) : style);
});
exports.onMedia = onMedia;

@@ -6,3 +6,3 @@ 'use strict';

});
exports.skipPropValue = exports.spaceValue = exports.sizeValue = exports.wrapIfMedia = exports.wrap = exports.getStyles = exports.toCssRule = exports.toObj = exports.toArr = undefined;
exports.skipPropValue = exports.spaceValue = exports.sizeValue = exports.wrapIfMedia = exports.wrap = exports.toCssRule = exports.toObj = exports.toArr = undefined;

@@ -42,10 +42,2 @@ var _defineProperty2 = require('babel-runtime/helpers/defineProperty');

var getStyles = function getStyles(style, val) {
for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
args[_key2 - 2] = arguments[_key2];
}
return (0, _is.isFn)(style) ? style.apply(undefined, [val].concat(args)) : val === true ? style : null;
};
var wrap = (0, _ramda.curryN)(2, function (name, style) {

@@ -79,9 +71,9 @@ var wrapper = function wrapper(obj) {

var skipPropValue = function skipPropValue() {
for (var _len3 = arguments.length, styles = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
styles[_key3] = arguments[_key3];
for (var _len2 = arguments.length, styles = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
styles[_key2] = arguments[_key2];
}
return function (value) {
for (var _len4 = arguments.length, rest = Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
rest[_key4 - 1] = arguments[_key4];
for (var _len3 = arguments.length, rest = Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
rest[_key3 - 1] = arguments[_key3];
}

@@ -98,3 +90,2 @@

exports.toCssRule = toCssRule;
exports.getStyles = getStyles;
exports.wrap = wrap;

@@ -101,0 +92,0 @@ exports.wrapIfMedia = wrapIfMedia;

@@ -6,3 +6,3 @@ import _toConsumableArray from 'babel-runtime/helpers/toConsumableArray';

import { DEFAULT_KEY } from '../constants';
import { wrapIfMedia, getStyles, themeMedia, toArr } from '../utils';
import { wrapIfMedia, isFn, themeMedia, toArr } from '../utils';

@@ -83,8 +83,10 @@ var buildStylesWithMedia = function buildStylesWithMedia(styles) {

var _matched = _slicedToArray(matched, 3),
style = _matched[0],
propStyle = _matched[0],
mediaKey = _matched[1],
mediaQuery = _matched[2];
return acc.concat(toArr(style).map(function (_style) {
return wrapIfMedia(mediaQuery, getStyles(_style, props[key], props, mediaKey)) || [];
var value = props[key];
return acc.concat(toArr(propStyle).map(function (style) {
return wrapIfMedia(mediaQuery, isFn(style) ? style(value, props, mediaKey) : value === true ? style : null) || [];
}));

@@ -91,0 +93,0 @@ }

import { curryN } from 'ramda';
import { wrapIfMedia, themeMedia, getStyles } from '../utils';
import { wrapIfMedia, themeMedia, isFn } from '../utils';
var onMedia = curryN(3, function (mediaKey, style, props) {
return wrapIfMedia(themeMedia(props.theme)[mediaKey], getStyles(style, props, mediaKey));
return wrapIfMedia(themeMedia(props.theme)[mediaKey], isFn(style) ? style(props, mediaKey) : style);
});
export { onMedia };

@@ -28,10 +28,2 @@ import _defineProperty from 'babel-runtime/helpers/defineProperty';

var getStyles = function getStyles(style, val) {
for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
args[_key2 - 2] = arguments[_key2];
}
return isFn(style) ? style.apply(undefined, [val].concat(args)) : val === true ? style : null;
};
var wrap = curryN(2, function (name, style) {

@@ -65,9 +57,9 @@ var wrapper = function wrapper(obj) {

var skipPropValue = function skipPropValue() {
for (var _len3 = arguments.length, styles = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
styles[_key3] = arguments[_key3];
for (var _len2 = arguments.length, styles = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
styles[_key2] = arguments[_key2];
}
return function (value) {
for (var _len4 = arguments.length, rest = Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
rest[_key4 - 1] = arguments[_key4];
for (var _len3 = arguments.length, rest = Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
rest[_key3 - 1] = arguments[_key3];
}

@@ -81,2 +73,2 @@

export { toArr, toObj, toCssRule, getStyles, wrap, wrapIfMedia, sizeValue, spaceValue, skipPropValue };
export { toArr, toObj, toCssRule, wrap, wrapIfMedia, sizeValue, spaceValue, skipPropValue };
{
"name": "@exah/prop-styles-system",
"version": "0.1.0",
"version": "0.1.1",
"description": "Prop styles system for styled components",

@@ -5,0 +5,0 @@ "author": "John Grishin <hi@johngrish.in>",

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