Protocol
SizeMultipleSemanticTokens
This is a group of semantic tokens for size but using MultipleSizeSemanticToken
protocol SizeMultipleSemanticTokens
Overview
In fact the MultipleSizeSemanticToken class will help users (i.e. developers) to handle one semantic token for size containing values for compact and regular viewports / 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 MultipleSizeSemanticToken. A major part the “real” size semantic tokens are declared in SizeSemanticTokens protocol and defined inside OUDSTheme (to be overridable then by subthemes), and othershere. These tokens are updated by the tokenator. Then they are gathered and wrapped so as to be used easily thanks to this MultipleSizeSemanticToken which must be updated manually.
Each token declared in this protocol must have its version Mobile and Tablet deczlre in SizeSemanticTokens protocol in order to define MultipleSizeSemanticToken for each pair of them.
In few words:
// Some sizing raw tokens, defined by the tokenator (in DimensionRawTokens+Values.swift)
public static let _550: DimensionRawToken = 44
public static let _650: DimensionRawToken = 52
// The sizing semantic tokens using them,
// declared (in SizeSemanticTokens.swift) and defined (in OUDSTheme+SizeSemanticTokens.swift) by the tokenator
var iconWithHeadingXlargeSizeSmMobile: SizeSemanticToken { DimensionRawTokens._550 }
var iconWithHeadingXlargeSizeSmTablet: SizeSemanticToken { DimensionRawTokens._650 }
// The 'higher level' size semantic tokens wrapping them and exposed to users,
// declared (in SizeMultipleSemanticTokens.swift) and defined (in OUDSTheme+SizeMultipleSemanticTokens.swift) manualy
var iconWithHeadingXlargeSizeSmall: MultipleSizeSemanticToken {
MultipleSizeSemanticToken(compact: iconWithHeadingXlargeSizeSmMobile, regular: iconWithHeadingXlargeSizeSmTablet)
}
// Thus users can in their components use iconWithHeadingXlargeSizeSm 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