SDTF Engine

Leverage the Specify core APIs to manipulate the SDTF token tree and produce any output you need.

Introduction

The SDTF Engine brings together the core APIs that enable most of Specify features to seamlessly integrate, whether you're working in Figma or Token Studio, managing GitHub pull-requests, or directly within your codebase with the SDK or the CLI.

You can access the SDTF Engine APIs over the Specify SDK.

all parsers written by Specify uses the SDTF Engine under the hood.

Token Tree CRUD API

At the core of the SDTF Engine, the query and mutation methods.

Query

The SDTF Engine provides a set of built-in getter functions to access tokens, groups, collections and aliases over the loaded token tree.

getAllTokenStates, getChildrenOf, getParentsOf, getAliasReferenceand many more - give you the opportunity to traverse and iterate over the different instances of TokenState, GroupState, and CollectionState.

Mutation

The SDTF Engine provides a set of built-in mutation functions to locally manipulate the underlaying token tree in order to meet your project and/or company standards.

updateTokenModeValue, updateTokenValue, moveToken, addToken, deleteToken, renameTokenand many more - assemble into a CRUD API giving you the control to bend your data just right for your use cases, without ever making changes to the original design data from the repository.

SDTF Query Language

Elevating your control over the data, the SDTF Query Language offers sophisticated techniques to navigate and cherry-pick the token tree with precision. You will find functions that allow complex querying patterns, matching specific criteria and conditions, vital for advanced manipulation and data extraction tasks.

const query: SDTFQuery = {
  where: {
    collection: '^MyCollection$',
    andWhere: {
      group: '^MyGroup$',
      andWhere: {
        token: '.*',
        select: true,
      },
    },
  },
};

With this powerful language at your disposal, it becomes easy to implement custom scenarios and data transformations.

Looking for the SDTF Query Language details? 👉 review the SDTF Query Language reference

The SDTF Query Language is accessible in the Specify SDK and in some parsers via a dedicated option.

Stateful Value API

The Stateful Value API grants direct access to examine the values assigned to tokens.

Through an exhaustive map interface, the API simplifies the process of keeping your design tokens and their implementations in sync despite the creation of aliases along the way.

Last updated