Skip to content

Releases: divriots/style-dictionary-to-figma

v0.4.0

15 Sep 09:04
dc178bd
Compare
Choose a tag to compare

Minor Changes

  • ab01a1e: BREAKING: if an upper token group does not have a tokenset property, it will get placed in a "global" tokenset by default. This means that no action is required by the user of the transformer to get a working JSON for Figma Tokens Plugin, but this change is potentially breaking because of how it changes the JSON output.

    Before

    {
      "core": {
        "color": {
          "primary": {
            "base": {
              "type": "color",
              "value": "#14b8a6"
            },
            "secondary": {
              "type": "color",
              "value": "#ff0000"
            }
          }
        }
      }
    }

    Nothing is changed in the output. However, if you have references, they might be broken because the plugin will interpret this as "color" being the upper property in a tokenset called "core".

    After

    {
      "core": {
        "color": {
          "primary": {
            "base": {
              "type": "color",
              "value": "#14b8a6"
            },
            "secondary": {
              "type": "color",
              "value": "#ff0000"
            }
          }
        }
      }
    }

    turns into

    {
      "global": {
        "core": {
          "color": {
            "primary": {
              "base": {
                "type": "color",
                "value": "#14b8a6"
              },
              "secondary": {
                "type": "color",
                "value": "#ff0000"
              }
            }
          }
        }
      }
    }

    Your reference, for example {core.color.primary.base} will now work properly because "core" is not interpreted as the tokenset, "global" is.

Patch Changes

  • ab01a1e: Fix clean-meta utility by using a proper isObject check which excludes arrays (values can be arrays).

v0.3.3

14 Sep 20:41
fd1e6c9
Compare
Choose a tag to compare

Patch Changes

  • 2c9be59: Allow tokensets to be the same name as the upper most keys in the tokens object, e.g.:

    {
      "core": {
        "tokenset": "core",
        "color": {
          "value": "#ff0000",
          "type": "color"
        }
      }
    }

    will become

    {
      "core": {
        "core": {
          "color": {
            "value": "#ff0000",
            "type": "color"
          }
        }
      }
    }

    so that Figma Tokens plugin picks it up properly.

v0.3.2

12 Sep 15:09
e27bff0
Compare
Choose a tag to compare

Patch Changes

  • f9cf466: Allow passing an options object, for example cleanMeta, to clean unwanted meta props from the style-dictionary object.

v0.3.1

09 Sep 14:07
d3c61a9
Compare
Choose a tag to compare

Patch Changes

  • 1c0ee01: Do proper isObject check (typeof null and Array are also 'object') where needed. Fixes bug with metadata props with type Array getting altered by trimValue to become Objects.

v0.3.0

20 Jul 06:46
6cddc11
Compare
Choose a tag to compare

Minor Changes

  • b6cb742: BREAKING: do not restore original value if it was not a reference value. Before, it used to always restore, which unintentionally also restored style-dictionary transforms. For nested values, restore fully if any reference is found inside the nested value (object or array). If undesired, you can always use ignoreUseRefValue (see README) to fall back to keeping the fully resolved value. Currently, a hybrid solution that restores only the subparts of a value that is partially using references, is not available. Feel free to raise an issue if needed to explain your use case.

v0.2.1

14 Jul 12:52
d7cc196
Compare
Choose a tag to compare

Patch Changes

  • c30d4c1: Allow passing ignoreUseRefValue boolean metadata as a sibling to the token value property. It will use the resolved value rather than using the original reference value after conversion when this is set to true.

v0.2.0

06 May 06:45
c15ec16
Compare
Choose a tag to compare

Minor Changes

  • 00c39e3: BREAKING: no longer using default export, this is considered an anti-pattern for JS libraries. Re-export wildstars with default exports in ESM is one example quirk, another example is CommonJS not supporting default exports next to named exports in a single file. Now, the main export is a named export called "transform" and you have to import it as such.

    Before:

    // ESM
    import styleDictionaryToFigma from '@divriots/style-dictionary-to-figma';
    // CommonJS
    const styleDictionaryToFigma = require('@divriots/style-dictionary-to-figma');
    
    styleDictionaryToFigma({...}) // figma object

    After:

    // ESM
    import { transform } from '@divriots/style-dictionary-to-figma';
    // CommonJS
    const { transform } = require('@divriots/style-dictionary-to-figma');
    
    transform({...}) // figma object

v0.1.3

03 May 07:37
9a99611
Compare
Choose a tag to compare

Patch Changes

  • ff5d591: Keeps an array-type value as an array. This is useful with boxShadows that can have multiple stacked shadows in a single token.

v0.1.2

02 May 14:41
b63eae6
Compare
Choose a tag to compare

Patch Changes

  • 31493c5: Fixes trimValue when used on values that are objects.

v0.1.1

03 Mar 11:43
0c94edd
Compare
Choose a tag to compare

Patch Changes

  • 52117f8: Add CommonJS entrypoint, allowing importing with const sdToFigma = require('@divriots/style-dictionary-to-figma').default.