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
120
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 0.0.0-alpha.35 to 0.0.0-alpha.36

2

es/StyleContext.d.ts

@@ -6,2 +6,4 @@ import * as React from 'react';

export declare const ATTR_DEV_CACHE_PATH = "data-dev-cache-path";
export declare const CSS_IN_JS_INSTANCE = "__cssinjs_instance__";
export declare const CSS_IN_JS_INSTANCE_ID: string;
export declare function createCache(): CacheEntity;

@@ -8,0 +10,0 @@ export interface StyleContextProps {

5

es/StyleContext.js

@@ -5,3 +5,6 @@ import * as React from 'react';

export var ATTR_MARK = 'data-css-hash';
export var ATTR_DEV_CACHE_PATH = 'data-dev-cache-path';
export var ATTR_DEV_CACHE_PATH = 'data-dev-cache-path'; // Mark css-in-js instance in style element
export var CSS_IN_JS_INSTANCE = '__cssinjs_instance__';
export var CSS_IN_JS_INSTANCE_ID = Math.random().toString(12).slice(2);
export function createCache() {

@@ -8,0 +11,0 @@ if (typeof document !== 'undefined') {

@@ -5,3 +5,3 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";

import hash from '@emotion/hash';
import { ATTR_TOKEN } from './StyleContext';
import { ATTR_TOKEN, CSS_IN_JS_INSTANCE, CSS_IN_JS_INSTANCE_ID } from './StyleContext';
import useGlobalCache from './useGlobalCache';

@@ -23,5 +23,7 @@ import { flattenToken, token2key } from './util';

styles.forEach(function (style) {
var _style$parentNode;
if (style[CSS_IN_JS_INSTANCE] === CSS_IN_JS_INSTANCE_ID) {
var _style$parentNode;
(_style$parentNode = style.parentNode) === null || _style$parentNode === void 0 ? void 0 : _style$parentNode.removeChild(style);
(_style$parentNode = style.parentNode) === null || _style$parentNode === void 0 ? void 0 : _style$parentNode.removeChild(style);
}
});

@@ -28,0 +30,0 @@ }

@@ -26,3 +26,3 @@ import * as React from 'react';

export declare let animationStatistics: Record<string, boolean>;
export declare const parseStyle: (interpolation: CSSInterpolation, hashId?: string | undefined, path?: string | undefined, root?: boolean, injectHash?: boolean) => string;
export declare const parseStyle: (interpolation: CSSInterpolation, hashId?: string, path?: string, root?: boolean, injectHash?: boolean) => string;
/**

@@ -29,0 +29,0 @@ * Register a style to the global style sheet.

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

import useGlobalCache from './useGlobalCache';
import StyleContext, { ATTR_MARK, ATTR_TOKEN, ATTR_DEV_CACHE_PATH } from './StyleContext';
import StyleContext, { ATTR_MARK, ATTR_TOKEN, ATTR_DEV_CACHE_PATH, CSS_IN_JS_INSTANCE, CSS_IN_JS_INSTANCE_ID } from './StyleContext';
import { styleValidate } from './util';

@@ -169,3 +169,2 @@ var isClientSide = canUseDom();

// Clear animation statistics
animationStatistics = {};

@@ -176,8 +175,7 @@

mark: ATTR_MARK
}); // Used for `useCacheToken` to remove on batch when token removed
});
style[CSS_IN_JS_INSTANCE] = CSS_IN_JS_INSTANCE_ID; // Used for `useCacheToken` to remove on batch when token removed
// Used for `useCacheToken` to remove on batch when token removed
style.setAttribute(ATTR_TOKEN, tokenKey); // Dev usage to find which cache path made this easily
// Dev usage to find which cache path made this easily
if (process.env.NODE_ENV !== 'production') {

@@ -184,0 +182,0 @@ style.setAttribute(ATTR_DEV_CACHE_PATH, fullPath.join('|'));

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

var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
var _typeof = require("@babel/runtime/helpers/typeof");

@@ -68,2 +68,6 @@ Object.defineProperty(exports, "__esModule", {

var _Keyframes = _interopRequireDefault(require("./Keyframes"));
var _Keyframes = _interopRequireDefault(require("./Keyframes"));
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

@@ -6,2 +6,4 @@ import * as React from 'react';

export declare const ATTR_DEV_CACHE_PATH = "data-dev-cache-path";
export declare const CSS_IN_JS_INSTANCE = "__cssinjs_instance__";
export declare const CSS_IN_JS_INSTANCE_ID: string;
export declare function createCache(): CacheEntity;

@@ -8,0 +10,0 @@ export interface StyleContextProps {

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

var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
var _typeof = require("@babel/runtime/helpers/typeof");

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

});
exports.StyleProvider = exports.ATTR_TOKEN = exports.ATTR_MARK = exports.ATTR_DEV_CACHE_PATH = void 0;
exports.StyleProvider = exports.CSS_IN_JS_INSTANCE_ID = exports.CSS_IN_JS_INSTANCE = exports.ATTR_TOKEN = exports.ATTR_MARK = exports.ATTR_DEV_CACHE_PATH = void 0;
exports.createCache = createCache;

@@ -20,2 +20,6 @@ exports.default = void 0;

function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
var ATTR_TOKEN = 'data-token-hash';

@@ -25,4 +29,9 @@ exports.ATTR_TOKEN = ATTR_TOKEN;

exports.ATTR_MARK = ATTR_MARK;
var ATTR_DEV_CACHE_PATH = 'data-dev-cache-path';
var ATTR_DEV_CACHE_PATH = 'data-dev-cache-path'; // Mark css-in-js instance in style element
exports.ATTR_DEV_CACHE_PATH = ATTR_DEV_CACHE_PATH;
var CSS_IN_JS_INSTANCE = '__cssinjs_instance__';
exports.CSS_IN_JS_INSTANCE = CSS_IN_JS_INSTANCE;
var CSS_IN_JS_INSTANCE_ID = Math.random().toString(12).slice(2);
exports.CSS_IN_JS_INSTANCE_ID = CSS_IN_JS_INSTANCE_ID;

@@ -29,0 +38,0 @@ function createCache() {

"use strict";
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
var _typeof = require("@babel/runtime/helpers/typeof");
Object.defineProperty(exports, "__esModule", {

@@ -26,2 +26,6 @@ value: true

function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
var EMPTY_OVERRIDE = {}; // Generate different prefix to make user selector break in production env.

@@ -41,5 +45,7 @@ // This helps developer not to do style override directly on the hash id.

styles.forEach(function (style) {
var _style$parentNode;
if (style[_StyleContext.CSS_IN_JS_INSTANCE] === _StyleContext.CSS_IN_JS_INSTANCE_ID) {
var _style$parentNode;
(_style$parentNode = style.parentNode) === null || _style$parentNode === void 0 ? void 0 : _style$parentNode.removeChild(style);
(_style$parentNode = style.parentNode) === null || _style$parentNode === void 0 ? void 0 : _style$parentNode.removeChild(style);
}
});

@@ -46,0 +52,0 @@ }

"use strict";
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
var _typeof = require("@babel/runtime/helpers/typeof");
Object.defineProperty(exports, "__esModule", {

@@ -20,2 +20,6 @@ value: true

function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function useClientCache(prefix, keyPath, cacheFn, onCacheRemove) {

@@ -22,0 +26,0 @@ var _React$useContext = React.useContext(_StyleContext.default),

@@ -26,3 +26,3 @@ import * as React from 'react';

export declare let animationStatistics: Record<string, boolean>;
export declare const parseStyle: (interpolation: CSSInterpolation, hashId?: string | undefined, path?: string | undefined, root?: boolean, injectHash?: boolean) => string;
export declare const parseStyle: (interpolation: CSSInterpolation, hashId?: string, path?: string, root?: boolean, injectHash?: boolean) => string;
/**

@@ -29,0 +29,0 @@ * Register a style to the global style sheet.

"use strict";
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
var _typeof3 = require("@babel/runtime/helpers/typeof");
Object.defineProperty(exports, "__esModule", {

@@ -43,2 +43,6 @@ value: true

function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof3(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
// @ts-ignore

@@ -202,3 +206,2 @@ var isClientSide = (0, _canUseDom.default)();

// Clear animation statistics
exports.animationStatistics = animationStatistics = {};

@@ -209,8 +212,7 @@

mark: _StyleContext.ATTR_MARK
}); // Used for `useCacheToken` to remove on batch when token removed
});
style[_StyleContext.CSS_IN_JS_INSTANCE] = _StyleContext.CSS_IN_JS_INSTANCE_ID; // Used for `useCacheToken` to remove on batch when token removed
// Used for `useCacheToken` to remove on batch when token removed
style.setAttribute(_StyleContext.ATTR_TOKEN, tokenKey); // Dev usage to find which cache path made this easily
// Dev usage to find which cache path made this easily
if (process.env.NODE_ENV !== 'production') {

@@ -217,0 +219,0 @@ style.setAttribute(_StyleContext.ATTR_DEV_CACHE_PATH, fullPath.join('|'));

{
"name": "@ant-design/cssinjs",
"version": "0.0.0-alpha.35",
"version": "0.0.0-alpha.36",
"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