Browse Source
chore: Use cssinjs `createTheme` which support auto cache (#36329)
* chore: bump
* chore: use cssinjs cache version
pull/36381/head
二货机器人
2 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with
6 additions and
6 deletions
-
components/config-provider/index.tsx
-
components/theme/index.tsx
-
package.json
|
|
@ -1,4 +1,4 @@ |
|
|
|
import { Theme as V5Theme } from '@ant-design/cssinjs'; |
|
|
|
import { createTheme } from '@ant-design/cssinjs'; |
|
|
|
import IconContext from '@ant-design/icons/lib/components/Context'; |
|
|
|
import { FormProvider as RcFormProvider } from 'rc-field-form'; |
|
|
|
import type { ValidateMessages } from 'rc-field-form/lib/interface'; |
|
|
@ -251,7 +251,7 @@ const ProviderChildren: React.FC<ProviderChildrenProps> = props => { |
|
|
|
// ================================ Dynamic theme ================================
|
|
|
|
const memoTheme = React.useMemo(() => { |
|
|
|
const { algorithm, token, ...rest } = mergedTheme || {}; |
|
|
|
const themeObj = algorithm ? new V5Theme(algorithm) : undefined; |
|
|
|
const themeObj = algorithm ? createTheme(algorithm) : undefined; |
|
|
|
|
|
|
|
return { |
|
|
|
...rest, |
|
|
|
|
|
@ -1,5 +1,5 @@ |
|
|
|
import type { CSSInterpolation } from '@ant-design/cssinjs'; |
|
|
|
import { Theme, useCacheToken, useStyleRegister } from '@ant-design/cssinjs'; |
|
|
|
import type { CSSInterpolation, Theme } from '@ant-design/cssinjs'; |
|
|
|
import { createTheme, useCacheToken, useStyleRegister } from '@ant-design/cssinjs'; |
|
|
|
import React from 'react'; |
|
|
|
import version from '../version'; |
|
|
|
import type { |
|
|
@ -20,7 +20,7 @@ import genComponentStyleHook from './util/genComponentStyleHook'; |
|
|
|
import getArrowStyle from './util/placementArrow'; |
|
|
|
import statisticToken, { merge as mergeToken, statistic } from './util/statistic'; |
|
|
|
|
|
|
|
const defaultTheme = new Theme(defaultDerivative); |
|
|
|
const defaultTheme = createTheme(defaultDerivative); |
|
|
|
|
|
|
|
export { |
|
|
|
resetComponent, |
|
|
|
|
|
@ -115,7 +115,7 @@ |
|
|
|
], |
|
|
|
"dependencies": { |
|
|
|
"@ant-design/colors": "^6.0.0", |
|
|
|
"@ant-design/cssinjs": "^0.0.0-alpha.34", |
|
|
|
"@ant-design/cssinjs": "^0.0.0-alpha.35", |
|
|
|
"@ant-design/icons": "^4.7.0", |
|
|
|
"@ant-design/react-slick": "~0.29.1", |
|
|
|
"@babel/runtime": "^7.18.3", |
|
|
|