Protocol
SpaceMultipleSemanticTokens
This is a group of semantic tokens for spacings but using MultipleSpaceSemanticToken.
protocol SpaceMultipleSemanticTokens
Overview
In fact the MultipleSpaceSemanticToken class will help users (i.e. developers) to handle one semantic token for spacing containing values for compact (mobile) or regular (tablet) size classes. Because Figma is not able to manage pair of values for one token, and its produced JSON does not reflect this mecanism, the tokenator cannot provide such MultipleSpaceSemanticToken. Thus the “real” color semantic tokens are declared in SpaceSemanticTokens protocol and defined inside OUDSTheme (to be overridable then by subthemes). These tokens are updated by the tokenator. Then they are gathered and wrapped so as to be used easily thanks to this SpaceMultipleSemanticTokens which must be updated manually.
Each token declared in this protocol must have its version Mobile and Tablet declared in SpaceSemanticTokens protocol in order to define MultipleSpaceSemanticToken for each pair of them.
In few words:
// Some spacing raw tokens, defined by the tokenator (in DimensionRawTokens+Values.swift)
public static let _0: DimensionRawToken = 0
public static let _25: DimensionRawToken = 2
// The spacing semantic tokens using them,
// declared (in SpaceSemanticTokens.swift) and defined (in OUDSTheme+SpaceSemanticTokens.swift) by the tokenator
var scaledNoneMobile: SpaceSemanticToken { DimensionRawTokens._0 }
var scaledNoneTablet: SpaceSemanticToken { DimensionRawTokens.outOfSystem50 }
// The 'higher level' spacing semantic tokens wrapping them and exposed to users,
// declared (in SpaceMultipleSemanticTokens.swift) and defined (in OUDSTheme+SpaceMultipleSemanticTokens.swift) manualy
var scaledNone: MultipleSpaceSemanticToken { MultipleSpaceSemanticToken(compact: scaledNoneMobile, regular: scaledNoneTablet) }
// Thus users can in their components use scaledNone as defined in their design system
// (even if they are still able to use 'lower level' semantic tokens but it is more error-prone)
Since
0.8.0
Topics
Instance Properties