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.2 to 10.2.3

es/sortObjectKeys.js

16

es/combineRules.js

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

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() {

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

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

@@ -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, generateCSSSelector, isMediaQuery, isNestedSelector, isUndefinedValue, isSupport, normalizeNestedProperty, processStyleWithPlugins, STATIC_TYPE, RULE_TYPE, KEYFRAME_TYPE, FONT_TYPE, CLEAR_TYPE } from 'fela-utils';
import { generateCombinedMediaQuery, generateCSSRule, generateCSSSelector, isMediaQuery, isNestedSelector, isUndefinedValue, isSupport, normalizeNestedProperty, processStyleWithPlugins, STATIC_TYPE, RULE_TYPE, KEYFRAME_TYPE, FONT_TYPE, CLEAR_TYPE } from 'fela-utils';

@@ -19,6 +19,9 @@ 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';

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

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

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

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

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

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

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

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

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

export default function generateAnimationName(id) {
var rendererId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
return rendererId + 'k' + id;
return "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) {

@@ -29,2 +17,14 @@ 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(PREFIX_SYNTAX) === null) {
if (selectorPrefix.length > 0 && selectorPrefix.match(selectorPrefix) === 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 @@ }

@@ -6,3 +6,3 @@ declare module "fela" {

export type TRuleProps = {};
export type TRule<T = TRuleProps> = (props: T) => IStyle
export type TRule<T = TRuleProps> = (props: T, renderer: IRenderer) => IStyle

@@ -83,9 +83,11 @@ type TKeyFrame = TRule;

export type TMultiRuleObject<Props = TRuleProps, Styles = {}> = {[key in keyof Styles]: TRule<Props> | IStyle}
type TMultiRuleFunction<Props = TRuleProps, Styles = {}> = (props: Props) => TMultiRuleObject<Props, Styles>
export type TMultiRuleFunction<Props = TRuleProps, Styles = {}> = (props: Props, renderer: IRenderer) => TMultiRuleObject<Props, Styles>
export type TMultiRule<Props = TRuleProps, Styles = {}> = TMultiRuleObject<Props, Styles> | TMultiRuleFunction<Props, Styles>
type TPartialMultiRuleObject<Props = TRuleProps, Styles = {}> = Partial<TMultiRuleObject<Props, Styles>>
type TPartialMultiRuleFunction<Props = TRuleProps, Styles = {}> = (props: Props) => TPartialMultiRuleObject<Props, Styles>
export type TPartialMultiRuleObject<Props = TRuleProps, Styles = {}> = Partial<TMultiRuleObject<Props, Styles>>
export type TPartialMultiRuleFunction<Props = TRuleProps, Styles = {}> = (props: Props, renderer: IRenderer) => TPartialMultiRuleObject<Props, Styles>
export type TPartialMultiRule<Props = TRuleProps, Styles = {}> = TPartialMultiRuleObject<Props, Styles> | TPartialMultiRuleFunction<Props, Styles>
export type TNormalizedMultiRule<Props = TRuleProps, Styles = {}> = (props: Props) => {[key in keyof Styles]: TRule<Props>}
export type TNormalizedMultiRule<Props = TRuleProps, Styles = {}> = (props: Props, renderer: IRenderer) => {[key in keyof Styles]: TRule<Props>}
function combineMultiRules<A, SA, B, SB>(

@@ -92,0 +94,0 @@ a: TMultiRule<A, SA>,

@@ -18,16 +18,2 @@ '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() {

@@ -40,5 +26,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, resolveRule(rule, props, renderer));
return (0, _assignStyle2.default)(style, rule(props, renderer));
}, {});
};
}

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

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

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

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

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

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

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

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

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

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

@@ -119,3 +129,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, renderer.rendererId);
var animationName = (0, _generateAnimationName2.default)(++renderer.uniqueKeyframeIdentifier);

@@ -220,5 +230,6 @@ 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 style) {
var value = style[property];
for (var property in sortedStyle) {
var value = sortedStyle[property];

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

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

'use strict';
"use strict";

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

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

@@ -10,14 +10,2 @@ '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) {

@@ -36,2 +24,14 @@ 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(PREFIX_SYNTAX) === null) {
if (selectorPrefix.length > 0 && selectorPrefix.match(selectorPrefix) === 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.2",
"version": "10.2.3",
"description": "State-Driven Styling in JavaScript",

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

"fast-loops": "^1.0.0",
"fela-utils": "^10.2.2",
"fela-utils": "^10.2.3",
"isobject": "^3.0.1"
},
"gitHead": "b3f7f53c5697e2c318d0490527e21852984242b9"
"gitHead": "4edeeffc5be2e05473a52c24523dbebcd9e0ef0d"
}
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