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

Improve types on DesignTokens specifications #10

Open
4 tasks
d01000100 opened this issue Mar 3, 2023 · 0 comments
Open
4 tasks

Improve types on DesignTokens specifications #10

d01000100 opened this issue Mar 3, 2023 · 0 comments
Labels
code style Improve the legibility or structure of working code priority:low

Comments

@d01000100
Copy link
Owner

We extend the DesignToken type from StyleDictionary to specify with more detail the information in them (src/style-dictionary/types.ts):

  • Specify an explicit set of token types, instead of just a string
  • Specify the complex value of a shadow token

I have a couple of suggestions to make these types simpler:

  • Change enums of TokenType and ShadowType to string arrays and union types

  • Reuse more of the DesignToken type of StyleDictionary (aliased as SDDesignToken)

    • ¿Can description on our DesignToken be the comment value from SDDesignToken?
    • ¿Could we be using the attributes.type value from SDDesignToken instead of our type value on DesignToken?

    These suggestions need to be experimented on. I am not certain all of them work or are better solutions.


SDDesignToken spec:

interface DesignToken {
  value: any;
  name?: string;
  comment?: string;
  themeable?: boolean;
  attributes?: {
    category?: string;
    type?: string;
    item?: string;
    subitem?: string;
    state?: string;
    [key: string]: any;
  };
  [key: string]: any;
}
@d01000100 d01000100 added priority:low code style Improve the legibility or structure of working code labels Mar 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code style Improve the legibility or structure of working code priority:low
Projects
None yet
Development

No branches or pull requests

1 participant