Skip to content

Commit cfe68f1

Browse files
committed
chore: move rc-util to @rc-componet/util
1 parent 37b7a7b commit cfe68f1

File tree

12 files changed

+79
-45
lines changed

12 files changed

+79
-45
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@
4545
"@babel/runtime": "^7.11.1",
4646
"@emotion/hash": "^0.8.0",
4747
"@emotion/unitless": "^0.7.5",
48+
"@rc-component/util": "^1.4.0",
4849
"classnames": "^2.3.1",
4950
"csstype": "^3.1.3",
50-
"rc-util": "^5.35.0",
5151
"stylis": "^4.3.4"
5252
},
5353
"devDependencies": {

src/StyleContext.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import useMemo from 'rc-util/lib/hooks/useMemo';
2-
import isEqual from 'rc-util/lib/isEqual';
1+
import useMemo from '@rc-component/util/lib/hooks/useMemo';
2+
import isEqual from '@rc-component/util/lib/isEqual';
33
import * as React from 'react';
44
import CacheEntity from './Cache';
55
import type { Linter } from './linters/interface';

src/hooks/useCSSVarRegister.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { removeCSS, updateCSS } from 'rc-util/lib/Dom/dynamicCSS';
1+
import { removeCSS, updateCSS } from '@rc-component/util/lib/Dom/dynamicCSS';
22
import { useContext } from 'react';
33
import StyleContext, {
44
ATTR_MARK,
@@ -101,7 +101,7 @@ export const extract: ExtractStyle<CSSVarCacheValue<any>> = (
101101
const order = -999;
102102

103103
// ====================== Style ======================
104-
// Used for rc-util
104+
// Used for @rc-component/util
105105
const sharedAttrs = {
106106
'data-rc-order': 'prependQueue',
107107
'data-rc-priority': `${order}`,

src/hooks/useCacheToken.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import hash from '@emotion/hash';
2-
import { updateCSS } from 'rc-util/lib/Dom/dynamicCSS';
2+
import { updateCSS } from '@rc-component/util/lib/Dom/dynamicCSS';
33
import { useContext } from 'react';
44
import StyleContext, {
55
ATTR_MARK,
@@ -96,7 +96,7 @@ function cleanTokenStyle(tokenKey: string, instanceId: string) {
9696
const cleanableKeyList = new Set<string>();
9797
tokenKeys.forEach((value, key) => {
9898
if (value <= 0) cleanableKeyList.add(key);
99-
})
99+
});
100100

101101
// Should keep tokens under threshold for not to insert style too often
102102
if (tokenKeys.size - cleanableKeyList.size > TOKEN_THRESHOLD) {
@@ -252,7 +252,7 @@ export const extract: ExtractStyle<TokenCacheValue<any>> = (
252252
const order = -999;
253253

254254
// ====================== Style ======================
255-
// Used for rc-util
255+
// Used for @rc-component/util
256256
const sharedAttrs = {
257257
'data-rc-order': 'prependQueue',
258258
'data-rc-priority': `${order}`,

src/hooks/useEffectCleanupRegister.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { warning } from 'rc-util/lib/warning';
2-
import { useEffect } from 'react';
1+
import { warning } from '@rc-component/util/lib/warning';
32
import type { DependencyList } from 'react';
3+
import { useEffect } from 'react';
44

55
// DO NOT register functions in useEffect cleanup function, or functions that registered will never be called.
66
const useEffectCleanupRegister = (deps?: DependencyList) => {

src/hooks/useStyleRegister.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import hash from '@emotion/hash';
2+
import { removeCSS, updateCSS } from '@rc-component/util/lib/Dom/dynamicCSS';
23
import type * as CSS from 'csstype';
3-
import { removeCSS, updateCSS } from 'rc-util/lib/Dom/dynamicCSS';
44
import * as React from 'react';
55
// @ts-ignore
66
import unitless from '@emotion/unitless';
@@ -357,8 +357,6 @@ export function uniqueHash(path: (string | number)[], styleStr: string) {
357357
return hash(`${path.join('%')}${styleStr}`);
358358
}
359359

360-
361-
362360
export const STYLE_PREFIX = 'style';
363361

364362
type StyleCacheValue = [
@@ -536,7 +534,7 @@ export const extract: ExtractStyle<StyleCacheValue> = (
536534
let keyStyleText = styleStr;
537535

538536
// ====================== Share ======================
539-
// Used for rc-util
537+
// Used for @rc-component/util
540538
const sharedAttrs = {
541539
'data-rc-order': 'prependQueue',
542540
'data-rc-priority': `${order}`,

src/linters/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import devWarning from 'rc-util/lib/warning';
1+
import devWarning from '@rc-component/util/lib/warning';
22
import type { LinterInfo } from './interface';
33

44
export function lintWarning(message: string, info: LinterInfo) {

src/theme/Theme.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { warning } from 'rc-util/lib/warning';
1+
import { warning } from '@rc-component/util/lib/warning';
22
import type { DerivativeFunc, TokenType } from './interface';
33

44
let uuid = 0;

src/util/cacheMapUtil.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import canUseDom from 'rc-util/lib/Dom/canUseDom';
1+
import canUseDom from '@rc-component/util/lib/Dom/canUseDom';
22
import { ATTR_MARK } from '../StyleContext';
33

44
export const ATTR_CACHE_MAP = 'data-ant-cssinjs-cache-path';

src/util/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import hash from '@emotion/hash';
2-
import canUseDom from 'rc-util/lib/Dom/canUseDom';
3-
import { removeCSS, updateCSS } from 'rc-util/lib/Dom/dynamicCSS';
4-
import { ATTR_MARK, ATTR_TOKEN } from '../StyleContext';
2+
import canUseDom from '@rc-component/util/lib/Dom/canUseDom';
3+
import { removeCSS, updateCSS } from '@rc-component/util/lib/Dom/dynamicCSS';
54
import type { HashPriority } from '../StyleContext';
5+
import { ATTR_MARK, ATTR_TOKEN } from '../StyleContext';
66
import { Theme } from '../theme';
77

88
// Create a cache for memo concat

0 commit comments

Comments
 (0)