Skip to content

Releases: tokens-studio/sd-transforms

v1.2.6

22 Oct 10:12
6ffaa55
Compare
Choose a tag to compare

Patch Changes

  • b4461f4: Ensure that shadow value is still of type object (either Object or Array) before attempting to resolve math for each property/item.

v1.2.5

16 Sep 07:21
64e38c7
Compare
Choose a tag to compare

Patch Changes

  • 61af02f: Check for color transforms that the value is of type string, since other color object types could occur from previously ran transforms.

v1.2.4

06 Sep 10:13
8b70914
Compare
Choose a tag to compare

Patch Changes

  • b9aee1e: Fix lineHeight transform to keep numbers as numbers, and not stringify them.

v1.2.3

13 Aug 10:12
1ad17e2
Compare
Choose a tag to compare

Patch Changes

  • 1085fe8: Improve math compute utility to better deal with mixed units computations. Expand on tests.

v1.2.2

02 Aug 09:15
ae75978
Compare
Choose a tag to compare

Patch Changes

  • 0dea2af: fix: evaluate math expressions with units
  • 4fe336f: Override lineHeight expandTypesMap from SD. Add letterSpacing override. This is needed for our lineHeight and letterSpacing transforms to apply.

v1.2.1

29 Jul 15:59
bc57cd0
Compare
Choose a tag to compare

Patch Changes

  • c6c9223: Add composition to expandTypesMap.
  • 19f4530: Fix alwaysAddFontStyle option to not apply to tokens of type fontWeight(s), only meant for typography tokens.
  • 32c2d13: textCase and textDecoration types should be kept, instead of changing to "other". This should help with transforms targeting those tokens, whereas "other" is not a useful type conversion whatsoever.
  • 3a044ed: Remove the boxShadow expandTypesMap, this is no longer needed since SD 4.0.1 as it runs user defined preprocessors before expanding tokens.

v1.2.0

19 Jul 08:35
0494270
Compare
Choose a tag to compare

Minor Changes

  • ff31df8: Add lineHeight and fontWeight types to the expandTypesMap. Even though DTCG spec does not yet recognize them, they really are special types and marking them as such enables transforms to target them specifically.
  • ff31df8: Properly split fontWeight tokens that contain fontStyle into the parent group. For typography tokens this was correct but for fontWeight tokens, collision could occur between the token and its sibling tokens.

v1.1.0

04 Jul 14:44
01b5df5
Compare
Choose a tag to compare

Minor Changes

  • c687817: Add the originalType property to $extensions.['studio.tokens'] to store the original Tokens Studio token type, when the type is aligned to DTCG types. LetterSpacing transform is the transform in this package that actually needs to use this, because it doesn't want to match all dimension tokens, but it does want to match letterSpacing tokens.
  • ed10715: Allow changing the resolve math transform amount of decimals to round for using platform options mathFractionDigits, change default value from 3 to 4.

Patch Changes

  • c687817: Fix alignTypes to also include borderWidth, letterSpacing, paragraphSpacing and paragraphIndent and align them to dimension.
  • 9c02741: Fix bug where usesDtcg flag was not passed to resolveReference utility.

v1.0.1

01 Jul 14:02
b454787
Compare
Choose a tag to compare

Patch Changes

  • 6c7b2ff: Fix tsconfig to exclude test files and ensure dist folder structure is correct.

v1.0.0

01 Jul 11:47
57431ec
Compare
Choose a tag to compare

Major Changes

  • 67edf4b: BREAKING: descriptionToComment transform no longer removes newlines, just turns carriage returns into newlines. Style Dictionary now handles comments with newlines properly in its createPropertyFormatter utility.

  • 67edf4b: BREAKING: Remove expand option, composite/object-value tokens must be expanded by using Style Dictionary Expand.

  • 67edf4b: BREAKING: remove CommonJS entrypoint and tools/scripts required to dual publish. Now that Style Dictionary v4 is ESM-only, this library will follow suit.

  • 67edf4b: BREAKING: transformFontWeights has been renamed to transformFontWeight for consistency.

    Apply transforms to object-value (composite) token types:

    • HEXRGBa transform applies to border and shadow colors
    • Px dimension transform applies to border, typography and shadow dimensions
    • Letterspacing, lineheights and fontweights transforms apply to these respective typography properties
    • Resolve math transform applies to all properties of border, typography and shadow tokens

    This also means that all transforms except for description to comment mapping are now transitive transforms, since the math resolve transform must be transitive and all other transforms must apply after the math one.

  • 67edf4b: BREAKING: remove CSS shorthand transforms for border, typography and shadow. Use the Style Dictionary transforms instead: https://styledictionary.com/reference/hooks/transforms/predefined/#bordercssshorthand.

    Note that if you're not disabling the withSDBuiltins option, the tokens-studio transformGroup will include the ones in the css built-in transformGroup, so you might not notice the fact that they are moved.

  • 67edf4b: - BREAKING: Compatible with Style Dictionary >= v4.0.0. Not compatible with anything below that SD version.

    • BREAKING: registerTransforms function has been renamed to register.
    • BREAKING: transforms array has been refactored to getTransforms(), which is a function you should call. Optionally pass in the new platform option as parameter { platform: 'css' /* or 'compose' */}
    • BREAKING: By default, registered tokens-studio transformGroup will include the platform's Style Dictionary built-in transforms. E.g. if you're registering for platform css it will include the css transformGroup transforms from Style Dictionary, appended to the Tokens Studio specific transforms. This behavior can be disabled by passing { withSDBuiltins: false }.
    • Allow passing platform to the register() call: register(SD, { platform: 'compose' }). Default value is 'css'. This means your tokens-studio group will be registered for that specific platform.
    • Allow passing name to the register() call to configure the transformGroup name: register(SD, { name: 'tokens-studio-css' }). Default value is tokens-studio.

Minor Changes

  • 67edf4b: Adjust add-font-styles parser to also run on tokens of type fontWeight, to create a sibling token for the fontStyle if it is included in the fontWeight token.
  • 67edf4b: Add an adjust-types preprocessor utility that aligns the Tokens Studio types / object-value props with the DTCG ones.