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

@ant-design/cssinjs

Package Overview
Dependencies
Maintainers
10
Versions
118
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 1.11.1 to 1.11.2

5

es/hooks/useCacheToken.js

@@ -29,2 +29,3 @@ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";

}
var TOKEN_THRESHOLD = 0;

@@ -39,3 +40,5 @@ // Remove will check current keys first

});
if (cleanableKeyList.length < tokenKeyList.length) {
// Should keep tokens under threshold for not to insert style too often
if (tokenKeyList.length - cleanableKeyList.length > TOKEN_THRESHOLD) {
cleanableKeyList.forEach(function (key) {

@@ -42,0 +45,0 @@ removeStyleTags(key, instanceId);

7

es/hooks/useCompatibleInsertionEffect.d.ts
import type { EffectCallback } from 'react';
import * as React from 'react';
declare type UseCompatibleInsertionEffect = (renderEffect: EffectCallback, effect: EffectCallback, deps?: React.DependencyList) => void;
declare type UseCompatibleInsertionEffect = (renderEffect: EffectCallback, effect: (polyfill?: boolean) => ReturnType<EffectCallback>, deps?: React.DependencyList) => void;
/**
* Compatible `useInsertionEffect`
* will use `useInsertionEffect` if React version >= 18,
* otherwise use `useInsertionEffectPolyfill`.
*/
declare const useCompatibleInsertionEffect: UseCompatibleInsertionEffect;
export default useCompatibleInsertionEffect;

@@ -10,6 +10,20 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";

var useInsertionEffect = fullClone.useInsertionEffect;
/**
* Polyfill `useInsertionEffect` for React < 18
* @param renderEffect will be executed in `useMemo`, and do not have callback
* @param effect will be executed in `useLayoutEffect`
* @param deps
*/
var useInsertionEffectPolyfill = function useInsertionEffectPolyfill(renderEffect, effect, deps) {
React.useMemo(renderEffect, deps);
useLayoutEffect(effect, deps);
useLayoutEffect(function () {
return effect(true);
}, deps);
};
/**
* Compatible `useInsertionEffect`
* will use `useInsertionEffect` if React version >= 18,
* otherwise use `useInsertionEffectPolyfill`.
*/
var useCompatibleInsertionEffect = useInsertionEffect ? function (renderEffect, effect, deps) {

@@ -16,0 +30,0 @@ return useInsertionEffect(function () {

@@ -49,3 +49,3 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";

onCacheEffect === null || onCacheEffect === void 0 ? void 0 : onCacheEffect(cacheContent);
}, function () {
}, function (polyfill) {
// It's bad to call build again in effect.

@@ -58,2 +58,5 @@ // But we have to do this since StrictMode will call effect twice

cache = _ref4[1];
if (polyfill && times === 0) {
onCacheEffect === null || onCacheEffect === void 0 ? void 0 : onCacheEffect(cacheContent);
}
return [times + 1, cache];

@@ -60,0 +63,0 @@ });

@@ -39,2 +39,3 @@ "use strict";

}
var TOKEN_THRESHOLD = 0;

@@ -49,3 +50,5 @@ // Remove will check current keys first

});
if (cleanableKeyList.length < tokenKeyList.length) {
// Should keep tokens under threshold for not to insert style too often
if (tokenKeyList.length - cleanableKeyList.length > TOKEN_THRESHOLD) {
cleanableKeyList.forEach(function (key) {

@@ -52,0 +55,0 @@ removeStyleTags(key, instanceId);

import type { EffectCallback } from 'react';
import * as React from 'react';
declare type UseCompatibleInsertionEffect = (renderEffect: EffectCallback, effect: EffectCallback, deps?: React.DependencyList) => void;
declare type UseCompatibleInsertionEffect = (renderEffect: EffectCallback, effect: (polyfill?: boolean) => ReturnType<EffectCallback>, deps?: React.DependencyList) => void;
/**
* Compatible `useInsertionEffect`
* will use `useInsertionEffect` if React version >= 18,
* otherwise use `useInsertionEffectPolyfill`.
*/
declare const useCompatibleInsertionEffect: UseCompatibleInsertionEffect;
export default useCompatibleInsertionEffect;

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

var useInsertionEffect = fullClone.useInsertionEffect;
/**
* Polyfill `useInsertionEffect` for React < 18
* @param renderEffect will be executed in `useMemo`, and do not have callback
* @param effect will be executed in `useLayoutEffect`
* @param deps
*/
var useInsertionEffectPolyfill = function useInsertionEffectPolyfill(renderEffect, effect, deps) {
React.useMemo(renderEffect, deps);
(0, _useLayoutEffect.default)(effect, deps);
(0, _useLayoutEffect.default)(function () {
return effect(true);
}, deps);
};
/**
* Compatible `useInsertionEffect`
* will use `useInsertionEffect` if React version >= 18,
* otherwise use `useInsertionEffectPolyfill`.
*/
var useCompatibleInsertionEffect = useInsertionEffect ? function (renderEffect, effect, deps) {

@@ -26,0 +40,0 @@ return useInsertionEffect(function () {

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

onCacheEffect === null || onCacheEffect === void 0 ? void 0 : onCacheEffect(cacheContent);
}, function () {
}, function (polyfill) {
// It's bad to call build again in effect.

@@ -68,2 +68,5 @@ // But we have to do this since StrictMode will call effect twice

cache = _ref4[1];
if (polyfill && times === 0) {
onCacheEffect === null || onCacheEffect === void 0 ? void 0 : onCacheEffect(cacheContent);
}
return [times + 1, cache];

@@ -70,0 +73,0 @@ });

{
"name": "@ant-design/cssinjs",
"version": "1.11.1",
"version": "1.11.2",
"description": "Component level cssinjs resolution for antd",

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

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