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

@cloudflare/style-provider

Package Overview
Dependencies
Maintainers
26
Versions
520
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cloudflare/style-provider - npm Package Compare versions

Comparing version 1.1.28 to 1.1.29

14

CHANGELOG.md

@@ -6,3 +6,11 @@ # Change Log

<a name="1.1.28"></a>
<a name="1.1.29"></a>
## [1.1.29](http://stash.cfops.it:7999/fe/stratus/compare/@cloudflare/style-provider@1.1.28...@cloudflare/style-provider@1.1.29) (2018-09-21)
**Note:** Version bump only for package @cloudflare/style-provider
<a name="1.1.28"></a>
## [1.1.28](http://stash.cfops.it:7999/fe/stratus/compare/@cloudflare/style-provider@1.1.27...@cloudflare/style-provider@1.1.28) (2018-09-10)

@@ -15,3 +23,3 @@

<a name="1.1.27"></a>
<a name="1.1.27"></a>
## [1.1.27](http://stash.cfops.it:7999/fe/stratus/compare/@cloudflare/style-provider@1.1.26...@cloudflare/style-provider@1.1.27) (2018-08-22)

@@ -24,3 +32,3 @@

<a name="1.1.26"></a>
<a name="1.1.26"></a>
## [1.1.26](http://stash.cfops.it:7999/fe/stratus/compare/@cloudflare/style-provider@1.1.25...@cloudflare/style-provider@1.1.26) (2018-08-17)

@@ -27,0 +35,0 @@

@@ -10,30 +10,32 @@ import { createRenderer as createFelaRenderer } from 'fela'; // eslint-disable-line behance/no-deprecated

const defaultOpts = {
var defaultOpts = {
dev: false
};
const mediaQueries = {
mobile: `@media (min-width: ${variables.breakpoints.mobile})`,
mobileWide: `@media (min-width: ${variables.breakpoints.mobileWide})`,
tablet: `@media (min-width: ${variables.breakpoints.tablet})`,
tabletLegacy: `@media (min-width: ${variables.breakpoints.tabletLegacy})`,
tabletWide: `@media (min-width: ${variables.breakpoints.tabletWide})`,
desktop: `@media (min-width: ${variables.breakpoints.desktop})`,
desktopLegacy: `@media (min-width: ${variables.breakpoints.desktopLegacy})`,
desktopLarge: `@media (min-width: ${variables.breakpoints.desktopLarge})`,
hover: `@media (hover)`
var mediaQueries = {
mobile: "@media (min-width: ".concat(variables.breakpoints.mobile, ")"),
mobileWide: "@media (min-width: ".concat(variables.breakpoints.mobileWide, ")"),
tablet: "@media (min-width: ".concat(variables.breakpoints.tablet, ")"),
tabletLegacy: "@media (min-width: ".concat(variables.breakpoints.tabletLegacy, ")"),
tabletWide: "@media (min-width: ".concat(variables.breakpoints.tabletWide, ")"),
desktop: "@media (min-width: ".concat(variables.breakpoints.desktop, ")"),
desktopLegacy: "@media (min-width: ".concat(variables.breakpoints.desktopLegacy, ")"),
desktopLarge: "@media (min-width: ".concat(variables.breakpoints.desktopLarge, ")"),
hover: "@media (hover)"
};
const removePrefix = query => query.replace('@media ', '');
var removePrefix = function removePrefix(query) {
return query.replace('@media ', '');
};
const createRenderer = opts => {
const usedOpts = Object.assign({}, defaultOpts, opts);
const plugins = [prefixer(), fallbackValue(), unit(), embedded(), namedMediaQuery(mediaQueries)];
const enhancers = [];
var createRenderer = function createRenderer(opts) {
var usedOpts = Object.assign({}, defaultOpts, opts);
var plugins = [prefixer(), fallbackValue(), unit(), embedded(), namedMediaQuery(mediaQueries)];
var enhancers = [];
if (usedOpts.dev === true) {
const validator = require('fela-plugin-validator').default;
var validator = require('fela-plugin-validator').default;
const whitelistMediaQuery = require('./whitelistMediaQuery').default;
var whitelistMediaQuery = require('./whitelistMediaQuery').default;
const beautifier = require('fela-beautifier').default;
var beautifier = require('fela-beautifier').default;

@@ -46,4 +48,4 @@ plugins.push(validator());

return createFelaRenderer({
plugins,
enhancers,
plugins: plugins,
enhancers: enhancers,
selectorPrefix: usedOpts.selectorPrefix,

@@ -50,0 +52,0 @@ devMode: usedOpts.dev,

@@ -6,3 +6,3 @@ import renderer from 'react-test-renderer';

import cssbeautify from 'cssbeautify';
const options = {
var options = {
indent: ' ',

@@ -12,4 +12,5 @@ openbrace: 'end-of-line',

};
export default ((component, renderOptions = {}) => {
const felaRenderer = createRenderer({
export default (function (component) {
var renderOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var felaRenderer = createRenderer({
dev: true

@@ -19,4 +20,4 @@ });

component: renderer.create(felaTestContext(component, felaRenderer), renderOptions).toJSON(),
styles: `\n${cssbeautify(renderToString(felaRenderer), options)}\n`
styles: "\n".concat(cssbeautify(renderToString(felaRenderer), options), "\n")
};
});

@@ -6,7 +6,9 @@ // this is a wrapper for testing, it passes fela based

const felaTestContext = (component, renderer) => React.createElement(StyleProvider, {
renderer: renderer,
dev: true
}, component);
var felaTestContext = function felaTestContext(component, renderer) {
return React.createElement(StyleProvider, {
renderer: renderer,
dev: true
}, component);
};
export default felaTestContext;
import createRenderer from './createRenderer';
import StyleProvider from './StyleProvider';
const isProd = process.env.NODE_ENV === 'production';
const felaSnapshot = isProd ? null : require('./felaSnapshot').default;
const felaTestContext = isProd ? null : require('./felaTestContext').default;
var isProd = process.env.NODE_ENV === 'production';
var felaSnapshot = isProd ? null : require('./felaSnapshot').default;
var felaTestContext = isProd ? null : require('./felaTestContext').default;
export { createRenderer, StyleProvider, felaTestContext, felaSnapshot };

@@ -18,15 +18,13 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }

const StyleProvider = (_ref) => {
let {
dev,
children,
renderer,
rehydrate
} = _ref,
var StyleProvider = function StyleProvider(_ref) {
var dev = _ref.dev,
children = _ref.children,
renderer = _ref.renderer,
rehydrate = _ref.rehydrate,
restProps = _objectWithoutProperties(_ref, ["dev", "children", "renderer", "rehydrate"]);
const providerRenderer = renderer || createRenderer({
dev
var providerRenderer = renderer || createRenderer({
dev: dev
});
const child = Children.only(children);
var child = Children.only(children);
return React.createElement(Provider, {

@@ -33,0 +31,0 @@ renderer: providerRenderer,

@@ -5,12 +5,18 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }

const isObject = value => typeof value === 'object' && !Array.isArray(value);
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
const flipKeysAndValues = input => Object.keys(input).reduce((obj, key) => _objectSpread({}, obj, {
[input[key]]: key
}), {});
var isObject = function isObject(value) {
return _typeof(value) === 'object' && !Array.isArray(value);
};
var flipKeysAndValues = function flipKeysAndValues(input) {
return Object.keys(input).reduce(function (obj, key) {
return _objectSpread({}, obj, _defineProperty({}, input[key], key));
}, {});
};
function checkMediaQuery(style, mediaQueryMap, aliases) {
for (const property in style) {
for (var property in style) {
if (style.hasOwnProperty(property)) {
const value = style[property];
var value = style[property];

@@ -21,4 +27,3 @@ if (isObject(value)) {

if (property.substring(0, 6) === '@media' && !mediaQueryMap.hasOwnProperty(property)) {
console.warn(`Please don't use "${property}". Use one of the aliases: ${aliases.join(', ')}.
More info: https://github.com/cloudflare/cf-ui/tree/master/packages/cf-style-provider#named-media-query`);
console.warn("Please don't use \"".concat(property, "\". Use one of the aliases: ").concat(aliases.join(', '), ".\nMore info: https://github.com/cloudflare/cf-ui/tree/master/packages/cf-style-provider#named-media-query"));
}

@@ -33,3 +38,5 @@ }

export default function whitelistMediaQuery(mediaQueryMap) {
return style => checkMediaQuery(style, flipKeysAndValues(mediaQueryMap), Object.keys(mediaQueryMap));
return function (style) {
return checkMediaQuery(style, flipKeysAndValues(mediaQueryMap), Object.keys(mediaQueryMap));
};
}

@@ -26,30 +26,32 @@ "use strict";

// eslint-disable-line behance/no-deprecated
const defaultOpts = {
var defaultOpts = {
dev: false
};
const mediaQueries = {
mobile: `@media (min-width: ${_styleConst.variables.breakpoints.mobile})`,
mobileWide: `@media (min-width: ${_styleConst.variables.breakpoints.mobileWide})`,
tablet: `@media (min-width: ${_styleConst.variables.breakpoints.tablet})`,
tabletLegacy: `@media (min-width: ${_styleConst.variables.breakpoints.tabletLegacy})`,
tabletWide: `@media (min-width: ${_styleConst.variables.breakpoints.tabletWide})`,
desktop: `@media (min-width: ${_styleConst.variables.breakpoints.desktop})`,
desktopLegacy: `@media (min-width: ${_styleConst.variables.breakpoints.desktopLegacy})`,
desktopLarge: `@media (min-width: ${_styleConst.variables.breakpoints.desktopLarge})`,
hover: `@media (hover)`
var mediaQueries = {
mobile: "@media (min-width: ".concat(_styleConst.variables.breakpoints.mobile, ")"),
mobileWide: "@media (min-width: ".concat(_styleConst.variables.breakpoints.mobileWide, ")"),
tablet: "@media (min-width: ".concat(_styleConst.variables.breakpoints.tablet, ")"),
tabletLegacy: "@media (min-width: ".concat(_styleConst.variables.breakpoints.tabletLegacy, ")"),
tabletWide: "@media (min-width: ".concat(_styleConst.variables.breakpoints.tabletWide, ")"),
desktop: "@media (min-width: ".concat(_styleConst.variables.breakpoints.desktop, ")"),
desktopLegacy: "@media (min-width: ".concat(_styleConst.variables.breakpoints.desktopLegacy, ")"),
desktopLarge: "@media (min-width: ".concat(_styleConst.variables.breakpoints.desktopLarge, ")"),
hover: "@media (hover)"
};
const removePrefix = query => query.replace('@media ', '');
var removePrefix = function removePrefix(query) {
return query.replace('@media ', '');
};
const createRenderer = opts => {
const usedOpts = Object.assign({}, defaultOpts, opts);
const plugins = [(0, _felaPluginPrefixer.default)(), (0, _felaPluginFallbackValue.default)(), (0, _felaPluginUnit.default)(), (0, _felaPluginEmbedded.default)(), (0, _felaPluginNamedMediaQuery.default)(mediaQueries)];
const enhancers = [];
var createRenderer = function createRenderer(opts) {
var usedOpts = Object.assign({}, defaultOpts, opts);
var plugins = [(0, _felaPluginPrefixer.default)(), (0, _felaPluginFallbackValue.default)(), (0, _felaPluginUnit.default)(), (0, _felaPluginEmbedded.default)(), (0, _felaPluginNamedMediaQuery.default)(mediaQueries)];
var enhancers = [];
if (usedOpts.dev === true) {
const validator = require('fela-plugin-validator').default;
var validator = require('fela-plugin-validator').default;
const whitelistMediaQuery = require('./whitelistMediaQuery').default;
var whitelistMediaQuery = require('./whitelistMediaQuery').default;
const beautifier = require('fela-beautifier').default;
var beautifier = require('fela-beautifier').default;

@@ -62,4 +64,4 @@ plugins.push(validator());

return (0, _fela.createRenderer)({
plugins,
enhancers,
plugins: plugins,
enhancers: enhancers,
selectorPrefix: usedOpts.selectorPrefix,

@@ -66,0 +68,0 @@ devMode: usedOpts.dev,

@@ -20,3 +20,3 @@ "use strict";

const options = {
var options = {
indent: ' ',

@@ -27,4 +27,5 @@ openbrace: 'end-of-line',

var _default = (component, renderOptions = {}) => {
const felaRenderer = (0, _createRenderer.default)({
var _default = function _default(component) {
var renderOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var felaRenderer = (0, _createRenderer.default)({
dev: true

@@ -34,3 +35,3 @@ });

component: _reactTestRenderer.default.create((0, _felaTestContext.default)(component, felaRenderer), renderOptions).toJSON(),
styles: `\n${(0, _cssbeautify.default)((0, _felaTools.renderToString)(felaRenderer), options)}\n`
styles: "\n".concat((0, _cssbeautify.default)((0, _felaTools.renderToString)(felaRenderer), options), "\n")
};

@@ -37,0 +38,0 @@ };

@@ -16,8 +16,10 @@ "use strict";

// components fela's renderer and global theme
const felaTestContext = (component, renderer) => _react.default.createElement(_StyleProvider.default, {
renderer: renderer,
dev: true
}, component);
var felaTestContext = function felaTestContext(component, renderer) {
return _react.default.createElement(_StyleProvider.default, {
renderer: renderer,
dev: true
}, component);
};
var _default = felaTestContext;
exports.default = _default;

@@ -8,3 +8,3 @@ "use strict";

enumerable: true,
get: function () {
get: function get() {
return _createRenderer.default;

@@ -15,3 +15,3 @@ }

enumerable: true,
get: function () {
get: function get() {
return _StyleProvider.default;

@@ -28,6 +28,6 @@ }

const isProd = process.env.NODE_ENV === 'production';
const felaSnapshot = isProd ? null : require('./felaSnapshot').default;
var isProd = process.env.NODE_ENV === 'production';
var felaSnapshot = isProd ? null : require('./felaSnapshot').default;
exports.felaSnapshot = felaSnapshot;
const felaTestContext = isProd ? null : require('./felaTestContext').default;
var felaTestContext = isProd ? null : require('./felaTestContext').default;
exports.felaTestContext = felaTestContext;

@@ -32,16 +32,14 @@ "use strict";

const StyleProvider = (_ref) => {
let {
dev,
children,
renderer,
rehydrate
} = _ref,
var StyleProvider = function StyleProvider(_ref) {
var dev = _ref.dev,
children = _ref.children,
renderer = _ref.renderer,
rehydrate = _ref.rehydrate,
restProps = _objectWithoutProperties(_ref, ["dev", "children", "renderer", "rehydrate"]);
const providerRenderer = renderer || (0, _createRenderer.default)({
dev
var providerRenderer = renderer || (0, _createRenderer.default)({
dev: dev
});
const child = _react.Children.only(children);
var child = _react.Children.only(children);

@@ -48,0 +46,0 @@ return _react.default.createElement(_reactFela.Provider, {

@@ -12,12 +12,18 @@ "use strict";

const isObject = value => typeof value === 'object' && !Array.isArray(value);
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
const flipKeysAndValues = input => Object.keys(input).reduce((obj, key) => _objectSpread({}, obj, {
[input[key]]: key
}), {});
var isObject = function isObject(value) {
return _typeof(value) === 'object' && !Array.isArray(value);
};
var flipKeysAndValues = function flipKeysAndValues(input) {
return Object.keys(input).reduce(function (obj, key) {
return _objectSpread({}, obj, _defineProperty({}, input[key], key));
}, {});
};
function checkMediaQuery(style, mediaQueryMap, aliases) {
for (const property in style) {
for (var property in style) {
if (style.hasOwnProperty(property)) {
const value = style[property];
var value = style[property];

@@ -28,4 +34,3 @@ if (isObject(value)) {

if (property.substring(0, 6) === '@media' && !mediaQueryMap.hasOwnProperty(property)) {
console.warn(`Please don't use "${property}". Use one of the aliases: ${aliases.join(', ')}.
More info: https://github.com/cloudflare/cf-ui/tree/master/packages/cf-style-provider#named-media-query`);
console.warn("Please don't use \"".concat(property, "\". Use one of the aliases: ").concat(aliases.join(', '), ".\nMore info: https://github.com/cloudflare/cf-ui/tree/master/packages/cf-style-provider#named-media-query"));
}

@@ -40,3 +45,5 @@ }

function whitelistMediaQuery(mediaQueryMap) {
return style => checkMediaQuery(style, flipKeysAndValues(mediaQueryMap), Object.keys(mediaQueryMap));
return function (style) {
return checkMediaQuery(style, flipKeysAndValues(mediaQueryMap), Object.keys(mediaQueryMap));
};
}
{
"name": "@cloudflare/style-provider",
"description": "Cloudflare Style Provider",
"version": "1.1.28",
"version": "1.1.29",
"main": "lib/index.js",

@@ -15,4 +15,4 @@ "module": "es/index.js",

"dependencies": {
"@cloudflare/style-const": "^2.0.6",
"@cloudflare/style-container": "^4.0.12",
"@cloudflare/style-const": "^2.0.7",
"@cloudflare/style-container": "^4.0.13",
"cssbeautify": "^0.3.1",

@@ -19,0 +19,0 @@ "fela": "^6.2.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