-
Notifications
You must be signed in to change notification settings - Fork 557
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
RFC: What would you like to see in Style Dictionary 4.0?π©π½βπ»π‘ #643
Comments
I'd love to see a few things to better support strongly typed languages such as Kotlin/Java:
|
I'd love to be able to create different formats and transforms based off different sources (if we can't do already) |
@lewishealey could you elaborate a bit on this? |
@didoo @nhoizey @EvanLovely @kharrop @Tenga @jbarreiros @tonyjwalt @7studio @lukasoppermann Would love your thoughts! |
I am not sure how easy it is now, but splitting output by theme would be interesting. E.g. you have Still very rough, but this is something we work on currently. (Not just for the web of course) |
Some initial thoughts. I think a possible focus could be on making SD do things better, not necessarily do more. For example, I think one inevitable thing (and I am not saying it lightly, I understand the complexity of it) would be to convert the entire codebase to TypeScript. I know it's a huge, massive work. But this would make the refactoring of code (for its evolution) so much better! For those who have to touch the codebase, the knowledge that there is something in place that allows code refactoring without worrying that you forgot to change one prop or variable name somewhere in a file, is a game changer. This will not impact the final user, I know, but I think is a very important "safety feature" to add to the project. Another thing I was thinking was the website and the documentation: I know also this one is huge and requires a massive effort, but I think is long past overdue :) (I suspect there is also a GH issue, somewhere, where this discussion already happened). There are so many things we could do in this area, and so many good websites of open-source projects where we could get inspiration from (in terms of exposing to the users the documentation/information in a smart way) One last thing, possibly controversial: what if instead of "adding something" we "remove something"? The risk I see for many open-source projects is feature bloat, and I would be extremely sad to see this happen to SD. |
Support for naming structures with nested/default values. Given end result token names of: It's not currently possible to achieve this with a token structure like:
The alpha token is treated as an attribute of the white token. We're currently solving this with a
Possible solutions
|
I would like the ability to create multi-file formats. For instance, being able to generate an iOS Asset Catalog containing named colors (*.colorset) |
Hi, there are multiple things I would like to have in SD, which are already listed in the issues. I agree with what @jacoblapworth asks for, and it is already in #366. For Sass modules with As Design Tokens are often part of a Design System, I would like to have a simple way to document tokens. I'm currently struggling with Storybook to do that, as I showed in #477 and storybookjs/storybook#7671 (comment) . Maybe there could be a Storybook plugin as part of the SD project. Maybe for other Design System / documentation tools too. I would also like to be able to "treat file path as prefix for property path", as asked in #104 |
I would appreciate the ability to transform design tokens into color palettes usable by designers such as .ase, .clr and .sketchpallete. You can refer to to the following project to estimate the required effort:
There is also mac centric projects (e.g., objective-c and swift): |
I want more built-in support for integrations/plugins/extensions to popular design tools like figma, sketch, framer-motion... |
Now that there is an official glossary published by the Design Tokens W3C Community Group: Just as "properties" were renamed to "tokens" for v3, v4 could see "category" (in CTI) renamed to "type", but then "type" would have to be renamed to something elseβ¦ maybe "property"? π We would move from CTI to TPIβ¦ |
I would love to see the possibility to derive different tokens from the same source! For example Right now we have to use formats, which makes referencing the derived rgb-tokens difficult. To us, the rgb-tokens are first-level tokens. We simply dont want to specify them additionally to the hex-tokens, since that is redundant. |
While I have different use cases, I also would love something like @andre-brdoch see: #695 |
feature request possibly:
https://amzn.github.io/style-dictionary/#/formats?id=scssmap-deep before: /**
* Do not edit directly
* Generated on Tue, 05 Oct 2021 21:06:03 GMT
*/
$list-components-date-font-weight: 900 !default;
$links-bar-font-size: 14px !default;
$blocks: (
'list': (
'components': (
'date': (
'font-weight': $list-components-date-font-weight
)
)
),
'links-bar': (
'font-size': $links-bar-font-size
)
);
ideally after: /**
* Do not edit directly
* Generated on Tue, 05 Oct 2021 21:06:03 GMT
*/
$blocks: (
'list': (
'components': (
'date': (
'font-weight': 900
)
)
),
'links-bar': (
'font-size': 14px
)
);
|
Dynamic outputs would be awesome as well #667 (comment) this library is still in development, right? @chazzmoney |
This is still in development, we are working a bit more slowly recently because other priorities and personal things. And we are still looking to build a plan for a 4.0 release in the future. |
I might already be able to do this, but I'm new to using style-dictionary; I haven't seen it in the docs though. It would be cool if I could do something like this: "size": {
"base": { "value": 4 },
"half": { "value": "{size.base.value}", "divide": 2 },
"2": { "value": "{size.base.value}", "multiply": 2},
"3": { "value": "{size.base.value}", "multiply": 3},
} Or perhaps accepting the MathJSON formatting: This way, if a designer changed their minds about what the base was, I could change a single value and then let math do the rest. (also if there is already a way to do this please let me know). Thanks for considering! |
There might already be a clever way to achieve a nicely formatted design token changelog, or be out of scope for a CLI tool, but I'd love it if StyleDictionary could help provide an output of what tokens changed - from one generation to another (one version to another). To give an example, StyleDictionary could accept two separate properties folders as input. Could be one version of properties folder from master branch, and another from current topic branch. The output would be a nicely formatted list of which tokens were added, removed and changed. Simply thinking out loud π¨βπ» |
Define files programaticallyI would like to be able to generate files based on current dictionary. When you have a dynamic number of components or you have more than 100 components tokenized it's hard to maintain the list of files. Export all components variables into a single file is not efficient when you can include in your app only a sub set of all available components. I would like to have something like this: files: [{
destination: `components/*.css`,
format: 'css/component',
filter: token => token.path[0] === 'component',
split: dictionary => {
const uniqueItems = [...new Set(
dictionary.allTokens
.filter(token => token.attributes?.item)
.map(token => token.attributes.item)
)]
return uniqueItems.map(item => ({
destination: `${component}.css`,
filter: token => token.item === item,
}));
}
}] Then easily you can get 1 file per item or any other split you would like to do attending to the token properties. |
Migrate to ESMDeprecate CommonJS in in favor of ESM. |
I had this same issue, and followed @MrDevinB's suggestion of using a special character like "@": #119 (comment) |
I'd love to see things restructured into external files / folders and I second @didoo 's Typescript sentiments. |
Ability to have transforms that allow one-to-many tokens. This would be useful for something like color steps in a palette to be dynamically generated. An idea for it "neutral": {
"light": {
"value": "{ color.lightest.value }",
"steps": {
"type": "darken",
"amount": {
"50": 0.5,
"100": 1,
"150": 1.5,
"200": 2,
"250": 2.5,
"300": 3,
"350": 3.5,
"400": 4,
"450": 4.5,
"500": 5
}
}
}
} For an output of tokens:
|
HTML formatter to visualize the tokens in a website |
Web application to modify/export style dictionaries |
Making it easy for non-developers to do edits would be a really big one. Right now the technical threshold can make design tokens feel alien to designers, while they are probably equally (if not more) relevant to design. |
@jorgecasar A JSON way of doing it might be: {
"files": [{
"format": "css/component",
"filter": "componentFilter", // assume this is registered, it's optional
"split": {
"by": "{attributes.item}", // any prop ref on token in dictionary
"destination": "components/*/tokens.css" // * replaced by resolved "by" value e.g. attributes.item = "button"
}
}]
} Or if you need more flexibility, I suppose you can always go a bit deeper with JS instead const cfg = {
files: [{
format: 'css/component',
filter: token => token.path[0] === 'component',
split: {
by: (token) => token.attributes.item, // some prop on the token's attributes
destination: (byValue) => `components/${byValue}/tokens.css`
}
}]
} |
Hey everyone, we just published a statement about v4 of Style-Dictionary, I know many of you are asking in here what is the status for v4, and I'm happy to say, it's being actively worked on :) see https://github.com/amzn/style-dictionary#version-4 or https://amzn.github.io/style-dictionary/#/version_4 |
Hi @jorenbroekema the board linked in the document shared above is not visible/accessible (the link returns a 404). Is it expected because it's not public? π€ |
I don't have access to the roadmap either, but that is a very great news! π I have fully ported Style Dictionary to ESM / browser and updated this whole repository to a more modern stack here: I would be interested in joining efforts to align this with V4. |
That's really cool, I didn't realize someone else was also trying to make it ESM / browser compatible. Here's my PR to do the same thing #1014 I think the main difference is that my PR makes sure there is no reliance on things that aren't standards in the browser, e.g. JSON imports, extensionless import specifiers, etc., things that Vite allows out of the box. I prefer to make sure everything really works out of the box in browser & Node, without a single bit of build-tooling or plugins required. I think using fast-glob is a good idea, I just checked and you can pass a custom FS implementation to it just as you can for glob, so it seems like a good candidate then if it's faster :). Using something like consola to improve logging is also great, I was thinking that it would be a good idea to rethink logging in style-dictionary a bit anyways to help users solve their issues faster, perhaps we can chat at some point and have you collaborate with us on that part? Dropping lodash and maybe the internal es6 util file as well would be great too as a separate contribution, if you're interested. You can most easily reach out to me in the Tokens Studio slack https://join.slack.com/t/tokens-studio/shared_invite/zt-1p8ea3m6t-C163oJcN9g3~YZTKRgo2hg -> |
Thanks for letting us know, we've made a request to the amzn github organisation owners to make the board public. |
Hi, great news regarding the v4 release being worked on! My requests would be:
|
Board is public now π . Just a disclaimer that the board is not set in stone, more stuff will surely get added, and even if something is not included, it might just mean that it's a good idea but not a priority to get it into the v4.0.0 release e.g. because it's a non-breaking enhancement to the library :) |
Will v4.0.0 have the support for format such as Kotlin? |
We're certainly open to contributions for adding predefined formats in the style-dictionary library for popular platforms e.g. Kotlin! Feel free to open a new issue, probably start with an example of Design Token JSON format and how that would look like in Kotlin format, so we can work our way backwards and see how the formatter for that should look like, and whether any transforms are needed. Preferably contribute to the v4 branch rather than the main branch (v3) |
Do we have a rough estimate when V4 will be ready? |
My estimate is Q2 2024, not sure if early or late into the quarter. |
feature request 1: Add options.outputNumberLiterals to TypeScript/ES6 declarations Style Dictionary currently supports outputStringLiteral, but does not yet support outputNumberLiteral. Related issue: Link feature request 2: Make object literal types recursively compatible with TypeScript/ES6 declarations export const LineHeightsNormal: "150%"; // This can be a string literal
export const TypographyTextSBold: { fontFamily: string, lineHeight: string }; // // This cannot be a string literal |
@t-keshi both of those features sound reasonable, would you be open to creating a pull request to the v4 branch for them? For number literal, do I understand correctly that you'd like: export const MyNumber : number; to be for example typed more strictly e.g. if the value is export const MyNumber : 5; |
|
First class TypeScript support |
#768 would be great :) |
It was added in v4 branch, so feel free to start using the prereleases if you want to make use of this π
I agree, I'll add it to the list, as I think my suggestion for this issue will be a breaking change. I'll reply in the issue as well to elaborate. |
+1 on the following
|
@pws-pm have a look at #1162 - I started working on this there, but will need some guidance on this from @jorenbroekema |
i gave a shot in making a plugin for cobalt ui with gpt4, you can check it out here: I don't know if it may help you |
Support for defining colors with the color notation as from CSS with floats in the range 0-1 for red, green, blue and alpha. |
In Sass, the possibility to generate multiple files for each JSON or on same output Sass files, have multiples tokens for better organisation and readability. Example: {
"ref": {
"palette": {
"primary": {
"value": "red"
},
"secondary": {
"value": "green"
}
},
"typeface": {
"brand": {
"value": "roboto"
},
"headline": {
"value": "helvetica"
}
}
}
} $ref-palette: (
'primary': red,
'secondary': green,
);
$ref-typeface: (
'headline': roboto,
'headline': helvetica,
); |
There are currently some very active discussions around color tokens in the DTCG space so I expect an update to the color spec there in the short term, will make sure Style Dictionary supports it by that time
This can be achieved with a custom format, since this is really user-specific I think it would be hard for Style Dictionary to provide a generic abstraction to make it easier, but I'm open to ideas. |
I'm closing this issue since we released v4.0.0 last Friday π I've worked really hard the last 8 months to bring an amazing v4 to everyone, here's the current location of the docs https://v4.styledictionary.com/ which we're still working on to improve and bring to the finish line. The plan is for it to live on https://styledictionary.com which currently redirects to the old site, eventually these will both point to the new site in the near future. The migration guidelines are important if you're looking to migrate. Since we don't really have a discord/slack dedicated for Style Dictionary, feel free to hop into the Tokens Studio slack https://tokens.studio/slack if you need help or want to talk about Style Dictionary v4, there's a dedicated #style-dictionary-v4 channel there.
I have read every single reply in this thread and tried to prioritize and include as much of the valuable suggestions you have raised. If yours isn't included it doesn't mean it wasn't a good suggestion, it might have been that I just didn't have the capacity to include it or because I knew it wouldn't lead to a breaking change, and could be done after the 4.0.0 release. Hopefully I've managed to funnel some fresh energy into this project and its community. |
Many thanks for your hard work @jorenbroekema ! |
Hey SD community... we need your help!
We would really love to hear what YOU would like to see in SD 4.0. Answers to this might include answers to these questions:
We would love to hear all your thoughts - we might* even send you some SD swag***...
*** Right now this ONLY consists of stickers of our mascot, Pascal. But I really want a Pascal stuffie/plushie... and maybe a tote bag, or a water bottle, or coffee cup, or phone case, hoodie, throw pillow, pajamas, or... really, anything Pascal. Danny made him way too cute to be relegated to an existence consisting only of stickers.
The text was updated successfully, but these errors were encountered: