Socket
Book a DemoInstallSign in
Socket

@ant-design/cssinjs

Package Overview
Dependencies
Maintainers
14
Versions
128
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ant-design/cssinjs - npm Package Compare versions

Comparing version

to
0.0.0-alpha.34

9

es/Keyframes.js
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
import _createClass from "@babel/runtime/helpers/esm/createClass";
import { animationStatistics } from './useStyleRegister';

@@ -20,9 +19,3 @@ var Keyframe = /*#__PURE__*/function () {

var hashId = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
var animationName = hashId ? "".concat(hashId, "-").concat(this.name) : this.name;
if (animationStatistics[animationName] === undefined) {
animationStatistics[animationName] = true;
}
return animationName;
return hashId ? "".concat(hashId, "-").concat(this.name) : this.name;
}

@@ -29,0 +22,0 @@ }]);

35

es/useStyleRegister.js

@@ -15,3 +15,3 @@ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";

import StyleContext, { ATTR_MARK, ATTR_TOKEN, ATTR_DEV_CACHE_PATH } from './StyleContext';
import { styleValidate, warning } from './util';
import { styleValidate } from './util';
var isClientSide = canUseDom();

@@ -38,2 +38,11 @@ var SKIP_CHECK = '_skip_check_'; // ============================================================================

function parseKeyframes(keyframes) {
if (animationStatistics[keyframes.getName(hashId)]) {
return '';
}
animationStatistics[keyframes.getName(hashId)] = true;
return "@keyframes ".concat(keyframes.getName(hashId)).concat(parseStyle(keyframes.style, hashId, path, false));
}
function flattenList(list) {

@@ -55,5 +64,3 @@ var fullList = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];

// Keyframe
var keyframe = style;
animationStatistics[keyframe.getName(hashId)] = false;
styleStr += "@keyframes ".concat(keyframe.getName(hashId)).concat(parseStyle(keyframe.style, hashId, path, false));
styleStr += parseKeyframes(style);
} else {

@@ -108,2 +115,3 @@ // Normal CSSObject

if (key === 'animationName' && (value === null || value === void 0 ? void 0 : value._keyframe)) {
styleStr += parseKeyframes(value);
formatValue = value.getName(hashId);

@@ -162,14 +170,5 @@ }

var styleStr = normalizeStyle(parseStyle(styleObj, hashId, path.join('-')));
var styleId = uniqueHash(fullPath, styleStr); // Animation check
var styleId = uniqueHash(fullPath, styleStr); // Clear animation statistics
// Animation check
Object.entries(animationStatistics).forEach(function (_ref) {
var _ref2 = _slicedToArray(_ref, 2),
key = _ref2[0],
value = _ref2[1];
if (value) {
warning("CSS animation '".concat(key, "' is used without declaring keyframes, which may cause animation loss."), path.join('-'));
}
});
// Clear animation statistics
animationStatistics = {};

@@ -193,5 +192,5 @@

}, // Remove cache if no need
function (_ref3) {
var _ref4 = _slicedToArray(_ref3, 3),
styleId = _ref4[2];
function (_ref) {
var _ref2 = _slicedToArray(_ref, 3),
styleId = _ref2[2];

@@ -198,0 +197,0 @@ if (autoClear && isClientSide) {

@@ -14,4 +14,2 @@ "use strict";

var _useStyleRegister = require("./useStyleRegister");
var Keyframe = /*#__PURE__*/function () {

@@ -31,9 +29,3 @@ function Keyframe(name, style) {

var hashId = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
var animationName = hashId ? "".concat(hashId, "-").concat(this.name) : this.name;
if (_useStyleRegister.animationStatistics[animationName] === undefined) {
_useStyleRegister.animationStatistics[animationName] = true;
}
return animationName;
return hashId ? "".concat(hashId, "-").concat(this.name) : this.name;
}

@@ -40,0 +32,0 @@ }]);

@@ -67,2 +67,11 @@ "use strict";

function parseKeyframes(keyframes) {
if (animationStatistics[keyframes.getName(hashId)]) {
return '';
}
animationStatistics[keyframes.getName(hashId)] = true;
return "@keyframes ".concat(keyframes.getName(hashId)).concat(parseStyle(keyframes.style, hashId, path, false));
}
function flattenList(list) {

@@ -84,5 +93,3 @@ var fullList = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];

// Keyframe
var keyframe = style;
animationStatistics[keyframe.getName(hashId)] = false;
styleStr += "@keyframes ".concat(keyframe.getName(hashId)).concat(parseStyle(keyframe.style, hashId, path, false));
styleStr += parseKeyframes(style);
} else {

@@ -137,2 +144,3 @@ // Normal CSSObject

if (key === 'animationName' && (value === null || value === void 0 ? void 0 : value._keyframe)) {
styleStr += parseKeyframes(value);
formatValue = value.getName(hashId);

@@ -194,14 +202,5 @@ }

var styleStr = normalizeStyle(parseStyle(styleObj, hashId, path.join('-')));
var styleId = uniqueHash(fullPath, styleStr); // Animation check
var styleId = uniqueHash(fullPath, styleStr); // Clear animation statistics
// Animation check
Object.entries(animationStatistics).forEach(function (_ref) {
var _ref2 = (0, _slicedToArray2.default)(_ref, 2),
key = _ref2[0],
value = _ref2[1];
if (value) {
(0, _util.warning)("CSS animation '".concat(key, "' is used without declaring keyframes, which may cause animation loss."), path.join('-'));
}
});
// Clear animation statistics
exports.animationStatistics = animationStatistics = {};

@@ -225,5 +224,5 @@

}, // Remove cache if no need
function (_ref3) {
var _ref4 = (0, _slicedToArray2.default)(_ref3, 3),
styleId = _ref4[2];
function (_ref) {
var _ref2 = (0, _slicedToArray2.default)(_ref, 3),
styleId = _ref2[2];

@@ -230,0 +229,0 @@ if (autoClear && isClientSide) {

{
"name": "@ant-design/cssinjs",
"version": "0.0.0-alpha.33",
"version": "0.0.0-alpha.34",
"description": "Component level cssinjs resolution for antd",

@@ -5,0 +5,0 @@ "keywords": [

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.