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

fela

Package Overview
Dependencies
Maintainers
2
Versions
123
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fela - npm Package Compare versions

Comparing version 10.2.3 to 10.2.4

es/css.js

16

es/combineRules.js

@@ -0,4 +1,18 @@

function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
import assignStyle from 'css-in-js-utils/lib/assignStyle';
import arrayReduce from 'fast-loops/lib/arrayReduce';
function resolveRule(rule, props, renderer) {
if (Array.isArray(rule)) {
return resolveRule(combineRules.apply(undefined, _toConsumableArray(rule)), props, renderer);
}
if (typeof rule === 'function') {
return rule(props, renderer);
}
return rule;
}
export default function combineRules() {

@@ -11,5 +25,5 @@ for (var _len = arguments.length, rules = Array(_len), _key = 0; _key < _len; _key++) {

return arrayReduce(rules, function (style, rule) {
return assignStyle(style, rule(props, renderer));
return assignStyle(style, resolveRule(rule, props, renderer));
}, {});
};
}

14

es/createRenderer.js

@@ -9,3 +9,3 @@ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

import { generateCombinedMediaQuery, generateCSSRule, generateCSSSelector, isMediaQuery, isNestedSelector, isUndefinedValue, isSupport, normalizeNestedProperty, processStyleWithPlugins, STATIC_TYPE, RULE_TYPE, KEYFRAME_TYPE, FONT_TYPE, CLEAR_TYPE } from 'fela-utils';
import { generateCombinedMediaQuery, generateCSSSelector, isMediaQuery, isNestedSelector, isUndefinedValue, isSupport, normalizeNestedProperty, processStyleWithPlugins, STATIC_TYPE, RULE_TYPE, KEYFRAME_TYPE, FONT_TYPE, CLEAR_TYPE } from 'fela-utils';

@@ -19,9 +19,6 @@ import cssifyFontFace from './cssifyFontFace';

import generateStaticReference from './generateStaticReference';
import getFontFormat from './getFontFormat';
import getFontLocals from './getFontLocals';
import getFontUrl from './getFontUrl';
import isSafeClassName from './isSafeClassName';
import toCSSString from './toCSSString';
import validateSelectorPrefix from './validateSelectorPrefix';
import sortObjectKeys from './sortObjectKeys';

@@ -39,2 +36,3 @@ export default function createRenderer() {

rendererId: validateSelectorPrefix(config.rendererId),
selectorPrefix: validateSelectorPrefix(config.selectorPrefix),

@@ -48,2 +46,3 @@ filterClassName: config.filterClassName || isSafeClassName,

nodes: {},
scoreIndex: {},
// use a flat cache object with pure string references

@@ -69,3 +68,3 @@ // to achieve maximal lookup performance and memoization speed

// use another unique identifier to ensure minimal css markup
var animationName = generateAnimationName(++renderer.uniqueKeyframeIdentifier);
var animationName = generateAnimationName(++renderer.uniqueKeyframeIdentifier, renderer.rendererId);

@@ -170,6 +169,5 @@ var processedKeyframe = processStyleWithPlugins(renderer, resolvedKeyframe, KEYFRAME_TYPE, props);

var classNames = _className ? ' ' + _className : '';
var sortedStyle = sortObjectKeys(style);
for (var property in sortedStyle) {
var value = sortedStyle[property];
for (var property in style) {
var value = style[property];

@@ -176,0 +174,0 @@ if (isPlainObject(value)) {

export default function generateAnimationName(id) {
return "k" + id;
var rendererId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
return rendererId + 'k' + id;
}
var chars = 'abcdefghijklmnopqrstuvwxyz';
var charLength = chars.length;
function generateUniqueClassName(id) {
var className = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
if (id <= charLength) {
return chars[id - 1] + className;
}
// Bitwise floor as safari performs much faster
// https://jsperf.com/math-floor-vs-math-round-vs-parseint/55
return generateUniqueClassName(id / charLength | 0, chars[id % charLength] + className);
}
export default function generateClassName(getId) {

@@ -17,14 +29,2 @@ var filterClassName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function () {

return generatedClassName;
}
function generateUniqueClassName(id) {
var className = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
if (id <= charLength) {
return chars[id - 1] + className;
}
// Bitwise floor as safari performs much faster
// https://jsperf.com/math-floor-vs-math-round-vs-parseint/55
return generateUniqueClassName(id / charLength | 0, chars[id % charLength] + className);
}

@@ -6,3 +6,3 @@ var PREFIX_SYNTAX = /^[a-z_][a-z0-9-_]*$/gi;

if (selectorPrefix.length > 0 && selectorPrefix.match(selectorPrefix) === null) {
if (selectorPrefix.length > 0 && selectorPrefix.match(PREFIX_SYNTAX) === null) {
console.error('An invalid selectorPrefix (' + selectorPrefix + ') has been used to create a new Fela renderer.\nIt must only contain a-Z, 0-9, - and _ while it must start with either _ or a-Z.\nSee http://fela.js.org/docs/advanced/RendererConfiguration.html');

@@ -9,0 +9,0 @@ }

@@ -18,2 +18,16 @@ 'use strict';

function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
function resolveRule(rule, props, renderer) {
if (Array.isArray(rule)) {
return resolveRule(combineRules.apply(undefined, _toConsumableArray(rule)), props, renderer);
}
if (typeof rule === 'function') {
return rule(props, renderer);
}
return rule;
}
function combineRules() {

@@ -26,5 +40,5 @@ for (var _len = arguments.length, rules = Array(_len), _key = 0; _key < _len; _key++) {

return (0, _arrayReduce2.default)(rules, function (style, rule) {
return (0, _assignStyle2.default)(style, rule(props, renderer));
return (0, _assignStyle2.default)(style, resolveRule(rule, props, renderer));
}, {});
};
}

@@ -53,6 +53,2 @@ 'use strict';

var _getFontFormat = require('./getFontFormat');
var _getFontFormat2 = _interopRequireDefault(_getFontFormat);
var _getFontLocals = require('./getFontLocals');

@@ -62,6 +58,2 @@

var _getFontUrl = require('./getFontUrl');
var _getFontUrl2 = _interopRequireDefault(_getFontUrl);
var _isSafeClassName = require('./isSafeClassName');

@@ -79,6 +71,2 @@

var _sortObjectKeys = require('./sortObjectKeys');
var _sortObjectKeys2 = _interopRequireDefault(_sortObjectKeys);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -99,2 +87,3 @@

rendererId: (0, _validateSelectorPrefix2.default)(config.rendererId),
selectorPrefix: (0, _validateSelectorPrefix2.default)(config.selectorPrefix),

@@ -108,2 +97,3 @@ filterClassName: config.filterClassName || _isSafeClassName2.default,

nodes: {},
scoreIndex: {},
// use a flat cache object with pure string references

@@ -129,3 +119,3 @@ // to achieve maximal lookup performance and memoization speed

// use another unique identifier to ensure minimal css markup
var animationName = (0, _generateAnimationName2.default)(++renderer.uniqueKeyframeIdentifier);
var animationName = (0, _generateAnimationName2.default)(++renderer.uniqueKeyframeIdentifier, renderer.rendererId);

@@ -230,6 +220,5 @@ var processedKeyframe = (0, _felaUtils.processStyleWithPlugins)(renderer, resolvedKeyframe, _felaUtils.KEYFRAME_TYPE, props);

var classNames = _className ? ' ' + _className : '';
var sortedStyle = (0, _sortObjectKeys2.default)(style);
for (var property in sortedStyle) {
var value = sortedStyle[property];
for (var property in style) {
var value = style[property];

@@ -236,0 +225,0 @@ if ((0, _isobject2.default)(value)) {

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

"use strict";
'use strict';

@@ -8,3 +8,5 @@ Object.defineProperty(exports, "__esModule", {

function generateAnimationName(id) {
return "k" + id;
var rendererId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
return rendererId + 'k' + id;
}

@@ -10,2 +10,14 @@ 'use strict';

function generateUniqueClassName(id) {
var className = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
if (id <= charLength) {
return chars[id - 1] + className;
}
// Bitwise floor as safari performs much faster
// https://jsperf.com/math-floor-vs-math-round-vs-parseint/55
return generateUniqueClassName(id / charLength | 0, chars[id % charLength] + className);
}
function generateClassName(getId) {

@@ -24,14 +36,2 @@ var filterClassName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function () {

return generatedClassName;
}
function generateUniqueClassName(id) {
var className = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
if (id <= charLength) {
return chars[id - 1] + className;
}
// Bitwise floor as safari performs much faster
// https://jsperf.com/math-floor-vs-math-round-vs-parseint/55
return generateUniqueClassName(id / charLength | 0, chars[id % charLength] + className);
}

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

if (selectorPrefix.length > 0 && selectorPrefix.match(selectorPrefix) === null) {
if (selectorPrefix.length > 0 && selectorPrefix.match(PREFIX_SYNTAX) === null) {
console.error('An invalid selectorPrefix (' + selectorPrefix + ') has been used to create a new Fela renderer.\nIt must only contain a-Z, 0-9, - and _ while it must start with either _ or a-Z.\nSee http://fela.js.org/docs/advanced/RendererConfiguration.html');

@@ -15,0 +15,0 @@ }

{
"name": "fela",
"version": "10.2.3",
"version": "10.2.4",
"description": "State-Driven Styling in JavaScript",

@@ -38,3 +38,3 @@ "typings": "index.d.ts",

"fast-loops": "^1.0.0",
"fela-utils": "^10.2.3",
"fela-utils": "^10.2.4",
"isobject": "^3.0.1"

@@ -41,0 +41,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