style-dictionary 5.0.0-rc.2 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/README.md +2 -23
  2. package/examples/advanced/assets-base64-embed/package.json +1 -1
  3. package/examples/advanced/create-react-app/package.json +1 -1
  4. package/examples/advanced/create-react-native-app/package.json +1 -1
  5. package/examples/advanced/custom-parser/package.json +1 -1
  6. package/examples/advanced/custom-transforms/README.md +4 -4
  7. package/examples/advanced/custom-transforms/package.json +1 -1
  8. package/examples/advanced/font-face-rules/package.json +1 -1
  9. package/examples/advanced/format-helpers/package.json +1 -1
  10. package/examples/advanced/matching-build-files/package.json +1 -1
  11. package/examples/advanced/multi-brand-multi-platform/package.json +1 -1
  12. package/examples/advanced/node-modules-as-config-and-properties/README.md +1 -1
  13. package/examples/advanced/node-modules-as-config-and-properties/components/index.js +1 -1
  14. package/examples/advanced/node-modules-as-config-and-properties/config.js +3 -3
  15. package/examples/advanced/node-modules-as-config-and-properties/package-lock.json +2201 -0
  16. package/examples/advanced/node-modules-as-config-and-properties/package.json +1 -1
  17. package/examples/advanced/node-modules-as-config-and-properties/tokens/color/index.js +5 -5
  18. package/examples/advanced/node-modules-as-config-and-properties/tokens/index.js +2 -2
  19. package/examples/advanced/node-modules-as-config-and-properties/tokens/size/index.js +7 -3
  20. package/examples/advanced/npm-module/package.json +1 -1
  21. package/examples/advanced/referencing_aliasing/package.json +1 -1
  22. package/examples/advanced/s3/package.json +1 -1
  23. package/examples/advanced/tailwind-preset/package.json +1 -1
  24. package/examples/advanced/tokens-deprecation/package.json +1 -1
  25. package/examples/advanced/transitive-transforms/package.json +1 -1
  26. package/examples/advanced/variables-in-outputs/package.json +1 -1
  27. package/examples/advanced/yaml-tokens/package.json +1 -1
  28. package/lib/StyleDictionary.js +1 -1
  29. package/lib/common/formatHelpers/createPropertyFormatter.js +1 -1
  30. package/lib/common/formats.js +70 -22
  31. package/lib/utils/preprocess.js +3 -2
  32. package/package.json +1 -1
  33. package/types/DesignToken.d.ts +1 -1
package/README.md CHANGED
@@ -12,14 +12,14 @@
12
12
 
13
13
  # Style Dictionary
14
14
 
15
+ [See documentation](http://styledictionary.com)
16
+
15
17
  > _Style once, use everywhere._
16
18
 
17
19
  A Style Dictionary uses design tokens to define styles once and use those styles on any platform or language. It provides a single place to create and edit your styles, and exports these tokens to all the places you need - iOS, Android, CSS, JS, HTML, sketch files, style documentation, etc. It is available as a CLI through npm, but can also be used like any normal node module if you want to extend its functionality.
18
20
 
19
21
  When you are managing user experiences, it can be quite challenging to keep styles consistent and synchronized across multiple development platforms and devices. At the same time, designers, developers, PMs and others must be able to have consistent and up-to-date style documentation to enable effective work and communication. Even then, mistakes inevitably happen and the design may not be implemented accurately. Style Dictionary solves this by automatically generating style definitions across all platforms from a single source - removing roadblocks, errors, and inefficiencies across your workflow.
20
22
 
21
- For detailed usage head to https://amzn.github.io/style-dictionary
22
-
23
23
  ## Watch the Demo on YouTube
24
24
 
25
25
  [![Watch the video](/docs/src/assets/fake_player.png)](http://youtu.be/1HREvonfqhY)
@@ -314,27 +314,6 @@ StyleDictionary.buildAllPlatforms();
314
314
 
315
315
  For more information on creating your own transforms and formats, take a look at our [docs](https://styledictionary.com).
316
316
 
317
- ## Version 4
318
-
319
- In May 2021, we started [an issue / RFC, "What would you like to see in Style-Dictionary 4.0?"](https://github.com/amzn/style-dictionary/issues/643) to gather feedback on what the community would like to see.
320
- Fortunately, in August 2023, the folks at [Tokens Studio](https://tokens.studio/) contacted us about co-maintaining this project, and leading the v4 release (and beyond)!
321
-
322
- We have started working on the biggest and most important changes, like migrating to ESM, making the library browser-compatible out of the box, and supporting asynchronicity in Style-Dictionary's various APIs. There will be multiple prereleases to battle-test these changes before a final v4.0 is released.
323
-
324
- You can follow [this roadmap board](https://github.com/orgs/amzn/projects/4/views/1?layout=board) to keep an eye on the developments for v4.0, we will also keep adding to this board when we encounter changes we'd like to see in v4.0 that would entail a breaking change. Absence of something in this roadmap does not mean we don't see value in it, but rather that it could also be added in a (non-breaking) minor release within v4.x.x.
325
-
326
- ### From the folks at Tokens Studio
327
-
328
- Hi everyone! I'm Joren from Tokens Studio, a big fan of this project (see [Style-Dictionary-Play](https://www.style-dictionary-play.dev/), [Token Configurator](https://configurator.tokens.studio/), [sd-transforms](https://github.com/tokens-studio/sd-transforms)) and the main pusher behind leading a 4.0 release of this project, I think it would be good to explain from our perspective why we've made the move to collaborate with Amazon on this.
329
-
330
- At Tokens Studio, we're a huge fan of Design Tokens and the workflows they enable. We believe exporting design tokens to various platforms is a key ingredient in ensuring that the journey from design to implementation code is smooth.
331
- In our minds, Style-Dictionary has been the most popular and most flexible library for reaching that goal, and so we want to build on top of that.
332
- Rather than starting our own spinoff tool, we much prefer bringing Style-Dictionary further, together with its vibrant community of contributors, which is why we reached out to Danny Banks.
333
-
334
- I think it's important to stress that it is our shared vision to keep Style-Dictionary as an agnostic (so not "Tokens Studio"-specific) and flexible tool. As Tokens Studio, while we are highly incentivized to see this project progress further to strengthen our product journey, we value the open source community highly and want to make sure this library remains the go-to tool for exporting Design Tokens, whether you use Tokens Studio or not.
335
-
336
- We are very open to feedback and collaboration, feel free to reach out to us in [our Slack](https://join.slack.com/t/tokens-studio/shared_invite/zt-1p8ea3m6t-C163oJcN9g3~YZTKRgo2hg) -> `style-dictionary-v4` channel!
337
-
338
317
  ## Mascot
339
318
 
340
319
  The mascot for Style Dictionary is ["Pascal"](https://github.com/amzn/style-dictionary/issues/97) the chameleon (seen below). You can also find them blending in as the logo throughout the documentation.
@@ -12,6 +12,6 @@
12
12
  "author": "",
13
13
  "license": "Apache-2.0",
14
14
  "devDependencies": {
15
- "style-dictionary": "^5.0.0-rc.2"
15
+ "style-dictionary": "^5.0.0"
16
16
  }
17
17
  }
@@ -12,7 +12,7 @@
12
12
  },
13
13
  "devDependencies": {
14
14
  "eslint-config-react-app": "^7.0.1",
15
- "style-dictionary": "^5.0.0-rc.2"
15
+ "style-dictionary": "^5.0.0"
16
16
  },
17
17
  "resolutions": {
18
18
  "immer": "8.0.1",
@@ -29,7 +29,7 @@
29
29
  "eslint-config-react-app": "^7.0.1",
30
30
  "jest": "~25.2.6",
31
31
  "react-test-renderer": "~16.13.1",
32
- "style-dictionary": "^5.0.0-rc.2"
32
+ "style-dictionary": "^5.0.0"
33
33
  },
34
34
  "jest": {
35
35
  "preset": "react-native"
@@ -10,6 +10,6 @@
10
10
  "author": "",
11
11
  "license": "Apache-2.0",
12
12
  "devDependencies": {
13
- "style-dictionary": "^5.0.0-rc.2"
13
+ "style-dictionary": "^5.0.0"
14
14
  }
15
15
  }
@@ -9,7 +9,7 @@ Transforms are functions that modify a design token (in a non-destructive way).
9
9
  The need for custom transforms is that Style Dictionary expects the tokens to be declared according to certain criteria, to use the pre-defined transforms and formats/templates. For example, the _web_ transformGroup consists of the _attribute/cti_, _name/kebab_, _size/px_ and _color/css_ transforms.
10
10
  The _size/px_ adds 'px' to the end of the number, and is applied only if `token.attributes.category === 'size'`. This means that your token needs to be expressed without units, and be under the _'size'_ "category. If you need a different logic or you want to organize your tokens differently, probably you can't use the out-of-the-box transformation groups, but you have to declare your custom ones.
11
11
 
12
- If [custom formats](https://v4.styledictionary.com/reference/hooks/formats/#custom-formats) are the way to allow users to customize the format of the _output_ of Style Dictionary, custom transforms are the way to allow them to customize both the _input_ (the token names/values/attributes) and the _output_ (the actual values expressed in the design tokens). For this reasons, custom transforms are probably one of the **most powerful features** of Style Dictionary: they make it extremely versatile, allowing limitless possibilities of extension and customization of the entire design token pipeline.
12
+ If [custom formats](https://styledictionary.com/reference/hooks/formats/#custom-formats) are the way to allow users to customize the format of the _output_ of Style Dictionary, custom transforms are the way to allow them to customize both the _input_ (the token names/values/attributes) and the _output_ (the actual values expressed in the design tokens). For this reasons, custom transforms are probably one of the **most powerful features** of Style Dictionary: they make it extremely versatile, allowing limitless possibilities of extension and customization of the entire design token pipeline.
13
13
 
14
14
  #### Running the example
15
15
 
@@ -34,7 +34,7 @@ StyleDictionary.registerTransform({
34
34
  });
35
35
  ```
36
36
 
37
- More information can be found on the [documentation](https://amzn.github.io/style-dictionary/#/api?id=registertransform).
37
+ More information can be found on the [documentation](https://styledictionary.com/reference/api/#registertransform).
38
38
 
39
39
  To use this new custom transform, we need to create a new custom transformGroup that references it.
40
40
 
@@ -47,7 +47,7 @@ StyleDictionary.registerTransformGroup({
47
47
  });
48
48
  ```
49
49
 
50
- More information can be found on the [documentation](https://amzn.github.io/style-dictionary/#/api?id=registertransformgroup).
50
+ More information can be found on the [documentation](https://styledictionary.com/reference/api/#registertransformgroup).
51
51
 
52
52
  Once registered, the custom group can be associated to one or more **platforms** in the `config.json` file:
53
53
 
@@ -68,7 +68,7 @@ Once registered, the custom group can be associated to one or more **platforms**
68
68
 
69
69
  When you register a new group, you can use a new array of transforms, or you can "extend" an existing group (see the code in the `build.js` file). Even though the second option seems simpler, we suggest to always declare explicitly your array: it's clearer to see what transformations will be applied, and you will always be in full control of the code.
70
70
 
71
- Tip: to know what transforms are included in a pre-defined group you can [refer to the documentation](https://amzn.github.io/style-dictionary/#/transform_groups) or you can add a `console.log(StyleDictionary.transformGroup['group_name'])`
71
+ Tip: to know what transforms are included in a pre-defined group you can [refer to the documentation](https://styledictionary.com/reference/hooks/transform-groups/predefined/) or you can add a `console.log(StyleDictionary.hooks.transformGroups['group_name'])`
72
72
  in your code and look the array of transforms associated with the it, directly in your console.
73
73
 
74
74
  #### What to look at
@@ -16,6 +16,6 @@
16
16
  "author": "",
17
17
  "license": "Apache-2.0",
18
18
  "devDependencies": {
19
- "style-dictionary": "^5.0.0-rc.2"
19
+ "style-dictionary": "^5.0.0"
20
20
  }
21
21
  }
@@ -9,6 +9,6 @@
9
9
  },
10
10
  "license": "Apache-2.0",
11
11
  "devDependencies": {
12
- "style-dictionary": "^5.0.0-rc.2"
12
+ "style-dictionary": "^5.0.0"
13
13
  }
14
14
  }
@@ -10,6 +10,6 @@
10
10
  "author": "",
11
11
  "license": "Apache-2.0",
12
12
  "devDependencies": {
13
- "style-dictionary": "^5.0.0-rc.2"
13
+ "style-dictionary": "^5.0.0"
14
14
  }
15
15
  }
@@ -17,6 +17,6 @@
17
17
  "author": "Kelly Harrop <kn.harrop@gmail.com>",
18
18
  "license": "Apache-2.0",
19
19
  "devDependencies": {
20
- "style-dictionary": "^5.0.0-rc.2"
20
+ "style-dictionary": "^5.0.0"
21
21
  }
22
22
  }
@@ -16,6 +16,6 @@
16
16
  "author": "",
17
17
  "license": "Apache-2.0",
18
18
  "devDependencies": {
19
- "style-dictionary": "^5.0.0-rc.2"
19
+ "style-dictionary": "^5.0.0"
20
20
  }
21
21
  }
@@ -1,6 +1,6 @@
1
1
  ## Node Modules as Config and Token files
2
2
 
3
- This example shows some advanced features using Style Dictionary with node modules. Make sure you are familiar with Style Dictionary concepts first by reading the [docs](https://amzn.github.io/style-dictionary) first.
3
+ This example shows some advanced features using Style Dictionary with node modules. Make sure you are familiar with Style Dictionary concepts first by reading the [docs](https://styledictionary.com) first.
4
4
 
5
5
  #### Running the example
6
6
 
@@ -1,4 +1,4 @@
1
- import button from './button.js';
1
+ import button from './button/index.js';
2
2
 
3
3
  export default {
4
4
  component: {
@@ -1,6 +1,6 @@
1
1
  import StyleDictionary from 'style-dictionary';
2
2
  import { formats, transforms, transformGroups, transformTypes } from 'style-dictionary/enums';
3
- import tokens from './tokens.js';
3
+ import tokens from './tokens/index.js';
4
4
  // Rather than have Style Dictionary handle the merging of token files,
5
5
  // you could use node module export/require to do it yourself. This will
6
6
  // allow you to not have to copy object namespaces like you normally would.
@@ -87,7 +87,7 @@ export default {
87
87
 
88
88
  scss: {
89
89
  // This works, we can create new transform arrays on the fly and edit built-ins
90
- transforms: StyleDictionary.hooks.scss.concat(colorRgb),
90
+ transforms: StyleDictionary.hooks.scss?.concat(colorRgb),
91
91
  buildPath: buildPath,
92
92
  files: [
93
93
  {
@@ -98,7 +98,7 @@ export default {
98
98
  },
99
99
 
100
100
  js: {
101
- transforms: StyleDictionary.hooks.js.concat('myRegisteredTransform'),
101
+ transforms: StyleDictionary.hooks.js?.concat('myRegisteredTransform'),
102
102
  buildPath: buildPath,
103
103
  // If you want to get super fancy, you can use node modules
104
104
  // to create a tokens object first, and then you can