styletron-engine-atomic
Advanced tools
Comparing version 1.0.8 to 1.0.9
@@ -273,2 +273,28 @@ import prefixAll from 'inline-style-prefixer/static'; | ||
// strict | ||
/* eslint-disable no-console */ | ||
const validAnimationState = /^(from|to|\+?(\d*\.)?\d+%)(\s*,\s*(from|to|\+?(\d*\.)?\d+%))*$/; | ||
function validateKeyframesObject(keyframes) { | ||
let valid = true; | ||
for (const animationState in keyframes) { | ||
const value = keyframes[animationState]; | ||
if (!validAnimationState.test(animationState)) { | ||
valid = false; | ||
console.warn(`Warning: property "${animationState}" in keyframes object ${JSON.stringify(keyframes)} is not a valid. Must be "from", "to", or a percentage.`); | ||
} | ||
if (typeof value !== "object") { | ||
valid = false; | ||
console.warn(`Warning: value for "${animationState}" property in keyframes object ${JSON.stringify(keyframes)} must be an object. Instead it was a ${typeof value}.`); | ||
} | ||
if (!valid) { | ||
console.warn(`Warning: object used as value for "animationName" style is invalid:`, keyframes); | ||
} | ||
} | ||
} | ||
// strict | ||
function atomicSelector(id, pseudo) { | ||
@@ -284,6 +310,10 @@ let selector = `.${id}`; | ||
function keyframesToBlock(keyframes) { | ||
if (process.env.NODE_ENV !== "production") { | ||
validateKeyframesObject(keyframes); | ||
} | ||
let result = ""; | ||
for (const thing in keyframes) { | ||
result += `${thing}{${declarationsToBlock(keyframes[thing])}}`; | ||
for (const animationState in keyframes) { | ||
result += `${animationState}{${declarationsToBlock(keyframes[animationState])}}`; | ||
} | ||
@@ -290,0 +320,0 @@ |
@@ -273,2 +273,28 @@ import prefixAll from 'inline-style-prefixer/static'; | ||
// strict | ||
/* eslint-disable no-console */ | ||
const validAnimationState = /^(from|to|\+?(\d*\.)?\d+%)(\s*,\s*(from|to|\+?(\d*\.)?\d+%))*$/; | ||
function validateKeyframesObject(keyframes) { | ||
let valid = true; | ||
for (const animationState in keyframes) { | ||
const value = keyframes[animationState]; | ||
if (!validAnimationState.test(animationState)) { | ||
valid = false; | ||
console.warn(`Warning: property "${animationState}" in keyframes object ${JSON.stringify(keyframes)} is not a valid. Must be "from", "to", or a percentage.`); | ||
} | ||
if (typeof value !== "object") { | ||
valid = false; | ||
console.warn(`Warning: value for "${animationState}" property in keyframes object ${JSON.stringify(keyframes)} must be an object. Instead it was a ${typeof value}.`); | ||
} | ||
if (!valid) { | ||
console.warn(`Warning: object used as value for "animationName" style is invalid:`, keyframes); | ||
} | ||
} | ||
} | ||
// strict | ||
function atomicSelector(id, pseudo) { | ||
@@ -284,6 +310,10 @@ let selector = `.${id}`; | ||
function keyframesToBlock(keyframes) { | ||
if (process.env.NODE_ENV !== "production") { | ||
validateKeyframesObject(keyframes); | ||
} | ||
let result = ""; | ||
for (const thing in keyframes) { | ||
result += `${thing}{${declarationsToBlock(keyframes[thing])}}`; | ||
for (const animationState in keyframes) { | ||
result += `${animationState}{${declarationsToBlock(keyframes[animationState])}}`; | ||
} | ||
@@ -290,0 +320,0 @@ |
@@ -305,3 +305,31 @@ import prefixAll from 'inline-style-prefixer/static'; | ||
function _typeof$1(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof$1 = function _typeof(obj) { return typeof obj; }; } else { _typeof$1 = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof$1(obj); } | ||
// strict | ||
/* eslint-disable no-console */ | ||
var validAnimationState = /^(from|to|\+?(\d*\.)?\d+%)(\s*,\s*(from|to|\+?(\d*\.)?\d+%))*$/; | ||
function validateKeyframesObject(keyframes) { | ||
var valid = true; | ||
for (var animationState in keyframes) { | ||
var value = keyframes[animationState]; | ||
if (!validAnimationState.test(animationState)) { | ||
valid = false; | ||
console.warn("Warning: property \"" + animationState + "\" in keyframes object " + JSON.stringify(keyframes) + " is not a valid. Must be \"from\", \"to\", or a percentage."); | ||
} | ||
if (_typeof$1(value) !== "object") { | ||
valid = false; | ||
console.warn("Warning: value for \"" + animationState + "\" property in keyframes object " + JSON.stringify(keyframes) + " must be an object. Instead it was a " + _typeof$1(value) + "."); | ||
} | ||
if (!valid) { | ||
console.warn("Warning: object used as value for \"animationName\" style is invalid:", keyframes); | ||
} | ||
} | ||
} | ||
// strict | ||
function atomicSelector(id, pseudo) { | ||
@@ -317,6 +345,10 @@ var selector = "." + id; | ||
function keyframesToBlock(keyframes) { | ||
if (process.env.NODE_ENV !== "production") { | ||
validateKeyframesObject(keyframes); | ||
} | ||
var result = ""; | ||
for (var thing in keyframes) { | ||
result += thing + "{" + declarationsToBlock(keyframes[thing]) + "}"; | ||
for (var animationState in keyframes) { | ||
result += animationState + "{" + declarationsToBlock(keyframes[animationState]) + "}"; | ||
} | ||
@@ -323,0 +355,0 @@ |
@@ -311,3 +311,31 @@ 'use strict'; | ||
function _typeof$1(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof$1 = function _typeof(obj) { return typeof obj; }; } else { _typeof$1 = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof$1(obj); } | ||
// strict | ||
/* eslint-disable no-console */ | ||
var validAnimationState = /^(from|to|\+?(\d*\.)?\d+%)(\s*,\s*(from|to|\+?(\d*\.)?\d+%))*$/; | ||
function validateKeyframesObject(keyframes) { | ||
var valid = true; | ||
for (var animationState in keyframes) { | ||
var value = keyframes[animationState]; | ||
if (!validAnimationState.test(animationState)) { | ||
valid = false; | ||
console.warn("Warning: property \"" + animationState + "\" in keyframes object " + JSON.stringify(keyframes) + " is not a valid. Must be \"from\", \"to\", or a percentage."); | ||
} | ||
if (_typeof$1(value) !== "object") { | ||
valid = false; | ||
console.warn("Warning: value for \"" + animationState + "\" property in keyframes object " + JSON.stringify(keyframes) + " must be an object. Instead it was a " + _typeof$1(value) + "."); | ||
} | ||
if (!valid) { | ||
console.warn("Warning: object used as value for \"animationName\" style is invalid:", keyframes); | ||
} | ||
} | ||
} | ||
// strict | ||
function atomicSelector(id, pseudo) { | ||
@@ -323,6 +351,10 @@ var selector = "." + id; | ||
function keyframesToBlock(keyframes) { | ||
if (process.env.NODE_ENV !== "production") { | ||
validateKeyframesObject(keyframes); | ||
} | ||
var result = ""; | ||
for (var thing in keyframes) { | ||
result += thing + "{" + declarationsToBlock(keyframes[thing]) + "}"; | ||
for (var animationState in keyframes) { | ||
result += animationState + "{" + declarationsToBlock(keyframes[animationState]) + "}"; | ||
} | ||
@@ -329,0 +361,0 @@ |
@@ -273,2 +273,28 @@ import prefixAll from 'inline-style-prefixer/static'; | ||
// strict | ||
/* eslint-disable no-console */ | ||
const validAnimationState = /^(from|to|\+?(\d*\.)?\d+%)(\s*,\s*(from|to|\+?(\d*\.)?\d+%))*$/; | ||
function validateKeyframesObject(keyframes) { | ||
let valid = true; | ||
for (const animationState in keyframes) { | ||
const value = keyframes[animationState]; | ||
if (!validAnimationState.test(animationState)) { | ||
valid = false; | ||
console.warn(`Warning: property "${animationState}" in keyframes object ${JSON.stringify(keyframes)} is not a valid. Must be "from", "to", or a percentage.`); | ||
} | ||
if (typeof value !== "object") { | ||
valid = false; | ||
console.warn(`Warning: value for "${animationState}" property in keyframes object ${JSON.stringify(keyframes)} must be an object. Instead it was a ${typeof value}.`); | ||
} | ||
if (!valid) { | ||
console.warn(`Warning: object used as value for "animationName" style is invalid:`, keyframes); | ||
} | ||
} | ||
} | ||
// strict | ||
function atomicSelector(id, pseudo) { | ||
@@ -284,6 +310,10 @@ let selector = `.${id}`; | ||
function keyframesToBlock(keyframes) { | ||
if (process.env.NODE_ENV !== "production") { | ||
validateKeyframesObject(keyframes); | ||
} | ||
let result = ""; | ||
for (const thing in keyframes) { | ||
result += `${thing}{${declarationsToBlock(keyframes[thing])}}`; | ||
for (const animationState in keyframes) { | ||
result += `${animationState}{${declarationsToBlock(keyframes[animationState])}}`; | ||
} | ||
@@ -290,0 +320,0 @@ |
@@ -279,2 +279,28 @@ 'use strict'; | ||
// strict | ||
/* eslint-disable no-console */ | ||
const validAnimationState = /^(from|to|\+?(\d*\.)?\d+%)(\s*,\s*(from|to|\+?(\d*\.)?\d+%))*$/; | ||
function validateKeyframesObject(keyframes) { | ||
let valid = true; | ||
for (const animationState in keyframes) { | ||
const value = keyframes[animationState]; | ||
if (!validAnimationState.test(animationState)) { | ||
valid = false; | ||
console.warn(`Warning: property "${animationState}" in keyframes object ${JSON.stringify(keyframes)} is not a valid. Must be "from", "to", or a percentage.`); | ||
} | ||
if (typeof value !== "object") { | ||
valid = false; | ||
console.warn(`Warning: value for "${animationState}" property in keyframes object ${JSON.stringify(keyframes)} must be an object. Instead it was a ${typeof value}.`); | ||
} | ||
if (!valid) { | ||
console.warn(`Warning: object used as value for "animationName" style is invalid:`, keyframes); | ||
} | ||
} | ||
} | ||
// strict | ||
function atomicSelector(id, pseudo) { | ||
@@ -290,6 +316,10 @@ let selector = `.${id}`; | ||
function keyframesToBlock(keyframes) { | ||
if (process.env.NODE_ENV !== "production") { | ||
validateKeyframesObject(keyframes); | ||
} | ||
let result = ""; | ||
for (const thing in keyframes) { | ||
result += `${thing}{${declarationsToBlock(keyframes[thing])}}`; | ||
for (const animationState in keyframes) { | ||
result += `${animationState}{${declarationsToBlock(keyframes[animationState])}}`; | ||
} | ||
@@ -296,0 +326,0 @@ |
{ | ||
"name": "styletron-engine-atomic", | ||
"version": "1.0.8", | ||
"version": "1.0.9", | ||
"description": "Universal, high-performance JavaScript styles", | ||
@@ -34,7 +34,7 @@ "author": "Ryan Tsao <ryan.j.tsao@gmail.com>", | ||
"inline-style-prefixer": "^4.0.0", | ||
"styletron-standard": "^1.0.6" | ||
"styletron-standard": "^1.0.7" | ||
}, | ||
"devDependencies": { | ||
"create-universal-package": "3.2.4", | ||
"tape": "4.8.0", | ||
"tape": "4.9.1", | ||
"unitest": "^2.1.1" | ||
@@ -41,0 +41,0 @@ }, |
// @flow strict | ||
declare var __DEV__: boolean; | ||
import hyphenate from "./hyphenate-style-name.js"; | ||
import validateKeyframesObject from "./validate-keyframes-object.js"; | ||
@@ -13,6 +16,11 @@ export function atomicSelector(id: string, pseudo: string): string { | ||
export function keyframesToBlock(keyframes: Object): string { | ||
export function keyframesToBlock(keyframes: {[string]: Object}): string { | ||
if (__DEV__) { | ||
validateKeyframesObject(keyframes); | ||
} | ||
let result = ""; | ||
for (const thing in keyframes) { | ||
result += `${thing}{${declarationsToBlock(keyframes[thing])}}`; | ||
for (const animationState in keyframes) { | ||
result += `${animationState}{${declarationsToBlock( | ||
keyframes[animationState], | ||
)}}`; | ||
} | ||
@@ -19,0 +27,0 @@ return result; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
993860
32
24243
22
9
Updatedstyletron-standard@^1.0.7