mirror of
https://github.com/antd-tiny-vue/antd-tiny-vue.git
synced 2024-11-15 08:19:12 +08:00
28 lines
884 B
TypeScript
28 lines
884 B
TypeScript
|
import type { DerivativeFunc } from '@antd-tiny-vue/cssinjs'
|
||
|
import genControlHeight from '../shared/genControlHeight'
|
||
|
import type { MapToken, SeedToken } from '../../interface'
|
||
|
import defaultAlgorithm from '../default'
|
||
|
import genFontMapToken from '../shared/genFontMapToken'
|
||
|
import genCompactSizeMapToken from './genCompactSizeMapToken'
|
||
|
|
||
|
const derivative: DerivativeFunc<SeedToken, MapToken> = (token, mapToken) => {
|
||
|
const mergedMapToken = mapToken ?? defaultAlgorithm(token)
|
||
|
|
||
|
const fontSize = mergedMapToken.fontSizeSM // Smaller size font-size as base
|
||
|
const controlHeight = mergedMapToken.controlHeight - 4
|
||
|
|
||
|
return {
|
||
|
...mergedMapToken,
|
||
|
...genCompactSizeMapToken(mapToken ?? token),
|
||
|
|
||
|
// font
|
||
|
...genFontMapToken(fontSize),
|
||
|
|
||
|
// controlHeight
|
||
|
controlHeight,
|
||
|
...genControlHeight({ ...mergedMapToken, controlHeight })
|
||
|
}
|
||
|
}
|
||
|
|
||
|
export default derivative
|