Skip to content

Commit

Permalink
* core: support receive function to parse css size value.
Browse files Browse the repository at this point in the history
  • Loading branch information
catouse committed Feb 18, 2024
1 parent 626d863 commit 427beb6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/core/src/helpers/size.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
export type SizeSetting = number | `${number}%` | `${number}px` | `${number}/${number}` | (string & {});
export type SizeSetting = number | `${number}%` | `${number}px` | `${number}/${number}` | (string & {}) | (() => SizeSetting);

export function parseSize(size: SizeSetting): [value: number, type?: 'px' | '%'] {
if (typeof size === 'function') {
return parseSize(size());
}
if (typeof size === 'number') {
return [size];
}
Expand Down

0 comments on commit 427beb6

Please sign in to comment.