Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] theme supports custom token #2255

Closed
zamhown opened this issue Feb 21, 2024 · 0 comments · Fixed by #2256
Closed

[Feature] theme supports custom token #2255

zamhown opened this issue Feb 21, 2024 · 0 comments · Fixed by #2256
Assignees

Comments

@zamhown
Copy link
Member

zamhown commented Feb 21, 2024

What problem does this feature solve?

主题支持自定义 token map,用于将字号(设计规范中的字阶)引入 token 系统

What does the proposed API look like?

export interface ITheme {
  ...
  /**
   * 用户自定义的语义化 token,可以在主题中以 ITokenKey 的形式引用并作为常量赋值
   * @since 1.10.0
   */
  tokenMap?: Record<string, any>;
}

/** 语义化 token 的索引 */
export interface ITokenKey<T = any> {
  /** type 声明 */
  type: 'token';
  /** token key */
  key: string;
  /** 默认值,在没有取到 key 对应的值时返回 */
  default?: T;
}
@zamhown zamhown self-assigned this Feb 21, 2024
@zamhown zamhown mentioned this issue Feb 21, 2024
20 tasks
@zamhown zamhown closed this as completed Feb 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant