TokenState

The TokenState class API reference

The TokenState is accessible via the SDTFEngine API over methods like: getTokenState, getAllTokenStates…

The TokenState host all the methods to work with the token value, read, update, resolve aliases…

Properties

aliases

This getter returns the stateful alias references of the token.

get aliases: Array<StatefulAliasReference>;

type

This getter returns the type of the token.

get type: SpecifyDesignTokenTypeName;

value

This getter returns the SDTF JSON representation of the token value.

get value: SpecifyDesignToken['$value'];

modes

This getter returns the resolved modes of the token.

isTopLevelAlias

This getter indicates whether the token is a top level alias.

isFullyResolvable

This getter indicates whether the token holds unresolvable aliases.

modesResolvability

This getter returns a map representation of whether the token holds unresolvable aliases per mode.

definition

This getter returns the design token definition - containing validation schemas of the token.

Methods

getCollection

This method returns the parent collection of the token if any.

getStatefulValueResult

This method returns a StatefulValueResult instance allowing to map over the token possible values for modes and aliases.

resolveDeepStatefulValueForMode

This method resolves the stateful value for a given mode.

getUIValueResultOnMode

This method returns the Stateful Value representation for frontend usage.

rename

This method renames the token.

renameMode

This method renames a mode of the token.

updateValue

This method updates the whole value of the token (including modes).

updateModeValue

This method updates the value of a specific mode of the token.

resolveValueAliases

This method resolves the aliases from the token.

createModeValue

This method creates a new mode for the token.

deleteModeValue

This method deletes a mode of the token.

getJSONValue

This method returns the JSON representation of the Token value.

getJSONToken

This method returns the JSON representation of the Token.

move

This method moves the item to the specified path.

matchByType

This method matches the token by type.

matchJSONValueByType

This method matches the JSON value of the token by type.

toTokenStateParams

This method returns the token state parameters.

toAnalyzedToken

This method returns the analyzed token.

Matchers

isString

This method checks if the token state is of type 'string'.

isNumber

This method checks if the token state is of type 'number'.

isBoolean

This method checks if the token state is of type 'boolean'.

isNull

This method checks if the token state is of type 'null'.

isArray

This method checks if the token state is of type 'array'.

isObject

This method checks if the token state is of type 'object'.

isIntegerNumber

This method checks if the token state is of type 'integerNumber'.

isZeroToOneNumber

This method checks if the token state is of type 'zeroToOneNumber'.

isArcDegreeNumber

This method checks if the token state is of type 'arcDegreeNumber'.

isRgbColorNumber

This method checks if the token state is of type 'rgbColorNumber'.

isPositiveNumber

This method checks if the token state is of type 'positiveNumber'.

isPositiveIntegerNumber

This method checks if the token state is of type 'positiveIntegerNumber'.

isPercentageNumber

This method checks if the token state is of type 'percentageNumber'.

isHexadecimalColorString

This method checks if the token state is of type 'hexadecimalColorString'.

isBitmap

This method checks if the token state is of type 'bitmap'.

isBitmapFormat

This method checks if the token state is of type 'bitmapFormat'.

isBlur

This method checks if the token state is of type 'blur'.

isBorder

This method checks if the token state is of type 'border'.

isBorderStyle

This method checks if the token state is of type 'borderStyle'.

isBorderStyleLineCap

This method checks if the token state is of type 'borderStyleLineCap'.

isBreakpoint

This method checks if the token state is of type 'breakpoint'.

isColor

This method checks if the token state is of type 'color'.

isCubicBezier

This method checks if the token state is of type 'cubicBezier'.

isDimension

This method checks if the token state is of type 'dimension'.

isDimensionUnit

This method checks if the token state is of type 'dimensionUnit'.

isDuration

This method checks if the token state is of type 'duration'.

isDurationUnit

This method checks if the token state is of type 'durationUnit'.

isFont

This method checks if the token state is of type 'font'.

isFontFamily

This method checks if the token state is of type 'fontFamily'.

isFontFeature

This method checks if the token state is of type 'fontFeature'.

isFontFeatures

This method checks if the token state is of type 'fontFeatures'.

isFontFormat

This method checks if the token state is of type 'fontFormat'.

isFontStyle

This method checks if the token state is of type 'fontStyle'.

isFontWeight

This method checks if the token state is of type 'fontWeight'.

isGradient

This method checks if the token state is of type 'gradient'.

isGradients

This method checks if the token state is of type 'gradients'.

isOpacity

This method checks if the token state is of type 'opacity'.

isRadius

This method checks if the token state is of type 'radius'.

isRadii

This method checks if the token state is of type 'radii'.

isShadow

This method checks if the token state is of type 'shadow'.

isShadows

This method checks if the token state is of type 'shadows'.

isShadowType

This method checks if the token state is of type 'shadowType'.

isSpacing

This method checks if the token state is of type 'spacing'.

isSpacings

This method checks if the token state is of type 'spacings'.

isStepsTimingFunction

This method checks if the token state is of type 'stepsTimingFunction'.

isTextAlignHorizontal

This method checks if the token state is of type 'textAlignHorizontal'.

isTextAlignVertical

This method checks if the token state is of type 'textAlignVertical'.

isTextDecoration

This method checks if the token state is of type 'textDecoration'.

isTextStyle

This method checks if the token state is of type 'textStyle'.

isTextTransform

This method checks if the token state is of type 'textTransform'.

isTransition

This method checks if the token state is of type 'transition'.

isVector

This method checks if the token state is of type 'vector'.

isVectorFormat

This method checks if the token state is of type 'vectorFormat'.

isZIndex

This method checks if the token state is of type 'zIndex'.

Last updated

Was this helpful?