Socket
Socket
Sign inDemoInstall

rc-util

Package Overview
Dependencies
8
Maintainers
9
Versions
211
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 5.38.1 to 5.38.2

2

es/composeProps.d.ts

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

declare function composeProps<T extends Record<string, any>>(originProps: T, patchProps: Partial<T>, isAll?: boolean): Record<string, any>;
declare function composeProps<T extends Record<string, any>>(originProps: T, patchProps: Partial<T>, isAll?: boolean): T;
export default composeProps;

@@ -16,2 +16,3 @@ export type ContainerType = Element | ShadowRoot;

mark?: string;
styles?: HTMLElement[];
}

@@ -24,3 +25,3 @@ export declare function injectCSS(css: string, option?: Options): HTMLStyleElement;

export declare function clearContainerCache(): void;
export declare function updateCSS(css: string, key: string, option?: Options): HTMLStyleElement;
export declare function updateCSS(css: string, key: string, originOption?: Options): HTMLElement;
export {};

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

import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
import canUseDom from "./canUseDom";

@@ -62,3 +63,3 @@ import contains from "./contains";

if (isPrependQueue) {
var existStyle = findStyles(container).filter(function (node) {
var existStyle = (option.styles || findStyles(container)).filter(function (node) {
// Ignore style which not injected by rc-util with prepend

@@ -89,3 +90,3 @@ if (!['prepend', 'prependQueue'].includes(node.getAttribute(APPEND_ORDER))) {

var container = getContainer(option);
return findStyles(container).find(function (node) {
return (option.styles || findStyles(container)).find(function (node) {
return node.getAttribute(getMark(option)) === key;

@@ -125,4 +126,8 @@ });

export function updateCSS(css, key) {
var option = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
var container = getContainer(option);
var originOption = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
var container = getContainer(originOption);
var styles = findStyles(container);
var option = _objectSpread(_objectSpread({}, originOption), {}, {
styles: styles
});

@@ -129,0 +134,0 @@ // Sync real parent

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

}
export function limitTabRange(node, e) {

@@ -74,0 +73,0 @@ if (e.keyCode === 9) {

@@ -5,3 +5,3 @@ import _typeof from "@babel/runtime/helpers/esm/typeof";

import { isValidElement } from 'react';
import { isFragment, isMemo } from 'react-is';
import { ForwardRef, isFragment, isMemo } from 'react-is';
import useMemo from "./hooks/useMemo";

@@ -52,3 +52,3 @@ export function fillRef(ref, node) {

// Function component node
if (typeof type === 'function' && !((_type$prototype = type.prototype) !== null && _type$prototype !== void 0 && _type$prototype.render)) {
if (typeof type === 'function' && !((_type$prototype = type.prototype) !== null && _type$prototype !== void 0 && _type$prototype.render) && type.$$typeof !== ForwardRef) {
return false;

@@ -58,3 +58,3 @@ }

// Class component
if (typeof nodeOrComponent === 'function' && !((_nodeOrComponent$prot = nodeOrComponent.prototype) !== null && _nodeOrComponent$prot !== void 0 && _nodeOrComponent$prot.render)) {
if (typeof nodeOrComponent === 'function' && !((_nodeOrComponent$prot = nodeOrComponent.prototype) !== null && _nodeOrComponent$prot !== void 0 && _nodeOrComponent$prot.render) && nodeOrComponent.$$typeof !== ForwardRef) {
return false;

@@ -61,0 +61,0 @@ }

@@ -7,6 +7,19 @@ export type preMessageFn = (message: string, type: 'warning' | 'note') => string | null | undefined | number;

export declare const preMessage: (fn: preMessageFn) => void;
/**
* Warning if condition not match.
* @param valid Condition
* @param message Warning message
* @example
* ```js
* warning(false, 'some error'); // print some error
* warning(true, 'some error'); // print nothing
* warning(1 === 2, 'some error'); // print some error
* ```
*/
export declare function warning(valid: boolean, message: string): void;
/** @see Similar to {@link warning} */
export declare function note(valid: boolean, message: string): void;
export declare function resetWarned(): void;
export declare function call(method: (valid: boolean, message: string) => void, valid: boolean, message: string): void;
/** @see Same as {@link warning}, but only warn once for the same message */
export declare function warningOnce(valid: boolean, message: string): void;

@@ -18,3 +31,4 @@ export declare namespace warningOnce {

}
/** @see Same as {@link warning}, but only warn once for the same message */
export declare function noteOnce(valid: boolean, message: string): void;
export default warningOnce;

@@ -12,4 +12,15 @@ /* eslint-disable no-console */

};
/**
* Warning if condition not match.
* @param valid Condition
* @param message Warning message
* @example
* ```js
* warning(false, 'some error'); // print some error
* warning(true, 'some error'); // print nothing
* warning(1 === 2, 'some error'); // print some error
* ```
*/
export function warning(valid, message) {
// Support uglify
if (process.env.NODE_ENV !== 'production' && !valid && console !== undefined) {

@@ -24,4 +35,5 @@ var finalMessage = preWarningFns.reduce(function (msg, preMessageFn) {

}
/** @see Similar to {@link warning} */
export function note(valid, message) {
// Support uglify
if (process.env.NODE_ENV !== 'production' && !valid && console !== undefined) {

@@ -45,5 +57,9 @@ var finalMessage = preWarningFns.reduce(function (msg, preMessageFn) {

}
/** @see Same as {@link warning}, but only warn once for the same message */
export function warningOnce(valid, message) {
call(warning, valid, message);
}
/** @see Same as {@link warning}, but only warn once for the same message */
export function noteOnce(valid, message) {

@@ -55,3 +71,2 @@ call(note, valid, message);

warningOnce.noteOnce = noteOnce;
export default warningOnce;
/* eslint-enable */
export default warningOnce;

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

declare function composeProps<T extends Record<string, any>>(originProps: T, patchProps: Partial<T>, isAll?: boolean): Record<string, any>;
declare function composeProps<T extends Record<string, any>>(originProps: T, patchProps: Partial<T>, isAll?: boolean): T;
export default composeProps;

@@ -16,2 +16,3 @@ export type ContainerType = Element | ShadowRoot;

mark?: string;
styles?: HTMLElement[];
}

@@ -24,3 +25,3 @@ export declare function injectCSS(css: string, option?: Options): HTMLStyleElement;

export declare function clearContainerCache(): void;
export declare function updateCSS(css: string, key: string, option?: Options): HTMLStyleElement;
export declare function updateCSS(css: string, key: string, originOption?: Options): HTMLElement;
export {};

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

exports.updateCSS = updateCSS;
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
var _canUseDom = _interopRequireDefault(require("./canUseDom"));

@@ -73,3 +74,3 @@ var _contains = _interopRequireDefault(require("./contains"));

if (isPrependQueue) {
var existStyle = findStyles(container).filter(function (node) {
var existStyle = (option.styles || findStyles(container)).filter(function (node) {
// Ignore style which not injected by rc-util with prepend

@@ -100,3 +101,3 @@ if (!['prepend', 'prependQueue'].includes(node.getAttribute(APPEND_ORDER))) {

var container = getContainer(option);
return findStyles(container).find(function (node) {
return (option.styles || findStyles(container)).find(function (node) {
return node.getAttribute(getMark(option)) === key;

@@ -136,4 +137,8 @@ });

function updateCSS(css, key) {
var option = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
var container = getContainer(option);
var originOption = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
var container = getContainer(originOption);
var styles = findStyles(container);
var option = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, originOption), {}, {
styles: styles
});

@@ -140,0 +145,0 @@ // Sync real parent

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

}
function limitTabRange(node, e) {

@@ -85,0 +84,0 @@ if (e.keyCode === 9) {

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

// Function component node
if (typeof type === 'function' && !((_type$prototype = type.prototype) !== null && _type$prototype !== void 0 && _type$prototype.render)) {
if (typeof type === 'function' && !((_type$prototype = type.prototype) !== null && _type$prototype !== void 0 && _type$prototype.render) && type.$$typeof !== _reactIs.ForwardRef) {
return false;

@@ -68,3 +68,3 @@ }

// Class component
if (typeof nodeOrComponent === 'function' && !((_nodeOrComponent$prot = nodeOrComponent.prototype) !== null && _nodeOrComponent$prot !== void 0 && _nodeOrComponent$prot.render)) {
if (typeof nodeOrComponent === 'function' && !((_nodeOrComponent$prot = nodeOrComponent.prototype) !== null && _nodeOrComponent$prot !== void 0 && _nodeOrComponent$prot.render) && nodeOrComponent.$$typeof !== _reactIs.ForwardRef) {
return false;

@@ -71,0 +71,0 @@ }

@@ -7,6 +7,19 @@ export type preMessageFn = (message: string, type: 'warning' | 'note') => string | null | undefined | number;

export declare const preMessage: (fn: preMessageFn) => void;
/**
* Warning if condition not match.
* @param valid Condition
* @param message Warning message
* @example
* ```js
* warning(false, 'some error'); // print some error
* warning(true, 'some error'); // print nothing
* warning(1 === 2, 'some error'); // print some error
* ```
*/
export declare function warning(valid: boolean, message: string): void;
/** @see Similar to {@link warning} */
export declare function note(valid: boolean, message: string): void;
export declare function resetWarned(): void;
export declare function call(method: (valid: boolean, message: string) => void, valid: boolean, message: string): void;
/** @see Same as {@link warning}, but only warn once for the same message */
export declare function warningOnce(valid: boolean, message: string): void;

@@ -18,3 +31,4 @@ export declare namespace warningOnce {

}
/** @see Same as {@link warning}, but only warn once for the same message */
export declare function noteOnce(valid: boolean, message: string): void;
export default warningOnce;

@@ -25,4 +25,15 @@ "use strict";

};
/**
* Warning if condition not match.
* @param valid Condition
* @param message Warning message
* @example
* ```js
* warning(false, 'some error'); // print some error
* warning(true, 'some error'); // print nothing
* warning(1 === 2, 'some error'); // print some error
* ```
*/
function warning(valid, message) {
// Support uglify
if (process.env.NODE_ENV !== 'production' && !valid && console !== undefined) {

@@ -37,4 +48,5 @@ var finalMessage = preWarningFns.reduce(function (msg, preMessageFn) {

}
/** @see Similar to {@link warning} */
function note(valid, message) {
// Support uglify
if (process.env.NODE_ENV !== 'production' && !valid && console !== undefined) {

@@ -58,5 +70,9 @@ var finalMessage = preWarningFns.reduce(function (msg, preMessageFn) {

}
/** @see Same as {@link warning}, but only warn once for the same message */
function warningOnce(valid, message) {
call(warning, valid, message);
}
/** @see Same as {@link warning}, but only warn once for the same message */
function noteOnce(valid, message) {

@@ -68,3 +84,2 @@ call(note, valid, message);

warningOnce.noteOnce = noteOnce;
var _default = exports.default = warningOnce;
/* eslint-enable */
var _default = exports.default = warningOnce;
{
"name": "rc-util",
"version": "5.38.1",
"version": "5.38.2",
"description": "Common Utils For React Component",

@@ -46,3 +46,3 @@ "keywords": [

"@rc-component/father-plugin": "1.0.0",
"@testing-library/react": "^13.0.0",
"@testing-library/react": "^14.1.2",
"@types/jest": "^29.4.0",

@@ -57,12 +57,14 @@ "@types/react": "^18.0.0",

"dumi": "^2.1.3",
"eslint": "~7.32.0",
"eslint": "^8.54.0",
"eslint-plugin-jest": "^27.6.0",
"eslint-plugin-unicorn": "^50.0.1",
"father": "^4.1.3",
"glob": "^9.2.1",
"husky": "^8.0.3",
"lint-staged": "^13.1.2",
"np": "^7.6.3",
"lint-staged": "^15.1.0",
"np": "^9.0.0",
"rc-test": "^7.0.14",
"react": "^18.0.0",
"react-dom": "^18.0.0",
"typescript": "^4.1.3"
"typescript": "^5.3.2"
},

@@ -69,0 +71,0 @@ "peerDependencies": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc