Skip to content

Commit cbe3e96

Browse files
committed
refactor: typography semantic tokens with Multiple wrappers (#155)
Signed-off-by: Pierre-Yves Lapersonne <[email protected]>
1 parent 8360f7b commit cbe3e96

18 files changed

+475
-432
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
88

99
### Changed
1010

11+
- [Library] `fontLineHeightMobile*` and `fontLineHeightTablet*` merged in `MultipleFontLineHeightTokens` objects
12+
- [Library] `fontSizeMobile*` and `fontSizeTablet*` merged in `MultipleFontSizeTokens` objects
13+
- [Library] Update semantic and raw tokens for fonts ([#155](https://github.com/Orange-OpenSource/ouds-ios/issues/155))
1114
- [Library] Update semantic tokens for fonts (October 7th) ([#172](https://github.com/Orange-OpenSource/ouds-ios/issues/172))
1215
- [Library] Update raw tokens for fonts (October 7th) ([#170](https://github.com/Orange-OpenSource/ouds-ios/issues/170))
1316
- [Library] Any semantic token of sizing `TypeXXX` has been replaced by `TypeSizeXXX` (update of October 7th)
@@ -20,6 +23,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2023

2124
### Removed
2225

26+
- [Library] `fontSizeMobile*`, `fontSizeTablet*`, `fontLineHeightMobile*`, `fontLineHeightTablet*` removed
2327
- [Library] `spaceRowGapWithIconTaller`, `spaceColumnGapWithIconTaller` removed (update of October 7th)
2428

2529
## [0.3.0](https://github.com/Orange-OpenSource/ouds-ios/compare/0.2.0...0.3.0) - 2024-10-04

OUDS/Core/OUDS/Sources/OUDSTheme/OUDSTheme+SemanticTokens/OUDSTheme+TypographySemanticTokens.swift

+44-69
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ import OUDSTokensSemantic
1818
// ଘ( ・ω・)_/゚・:*:・。☆
1919
// [File to generate with the tokenator]
2020

21+
// swiftlint:disable line_length
22+
2123
/// Defines basic values common to all themes for `TypographySemanticTokens`.
2224
/// These values can be overriden inside `OUDSTheme` subclasses (in extensions or not, in the same module or not) thanks to the `@objc open` combination.
2325
extension OUDSTheme: TypographySemanticTokens {
@@ -33,41 +35,28 @@ extension OUDSTheme: TypographySemanticTokens {
3335

3436
// MARK: Semantic token - Typography - Font - Weight
3537

36-
@objc open var fontWeightDefault: TypographyFontWeightSemanticToken { TypographyRawTokens.fontWeightRegular }
37-
@objc open var fontWeightStrong: TypographyFontWeightSemanticToken { TypographyRawTokens.fontWeightBold }
38-
@objc open var fontWeightDisplay: TypographyFontWeightSemanticToken { TypographyRawTokens.fontWeightBold }
39-
@objc open var fontWeightHeading: TypographyFontWeightSemanticToken { TypographyRawTokens.fontWeightBold }
40-
@objc open var fontWeightBodyDefault: TypographyFontWeightSemanticToken { TypographyRawTokens.fontWeightRegular }
41-
@objc open var fontWeightBodyStrong: TypographyFontWeightSemanticToken { TypographyRawTokens.fontWeightBold }
42-
@objc open var fontWeightLabelDefault: TypographyFontWeightSemanticToken { TypographyRawTokens.fontWeightRegular }
43-
@objc open var fontWeightLabelStrong: TypographyFontWeightSemanticToken { TypographyRawTokens.fontWeightBold }
44-
@objc open var fontWeightCode: TypographyFontWeightSemanticToken { TypographyRawTokens.fontWeightRegular }
45-
46-
// MARK: Semantic token - Typography - Font - Size - Mobile
47-
48-
@objc open var fontSizeMobileDisplayLarge: TypographyFontSizeSemanticToken { TypographyRawTokens.fontSize850 }
49-
@objc open var fontSizeMobileDisplayMedium: TypographyFontSizeSemanticToken { TypographyRawTokens.fontSize750 }
50-
@objc open var fontSizeMobileDisplaySmall: TypographyFontSizeSemanticToken { TypographyRawTokens.fontSize650 }
51-
@objc open var fontSizeMobileHeadingXLarge: TypographyFontSizeSemanticToken { TypographyRawTokens.fontSize550 }
52-
@objc open var fontSizeMobileHeadingLarge: TypographyFontSizeSemanticToken { TypographyRawTokens.fontSize450 }
53-
@objc open var fontSizeMobileHeadingMedium: TypographyFontSizeSemanticToken { TypographyRawTokens.fontSize350 }
54-
@objc open var fontSizeMobileHeadingSmall: TypographyFontSizeSemanticToken { TypographyRawTokens.fontSize300 }
55-
@objc open var fontSizeMobileBodyLarge: TypographyFontSizeSemanticToken { TypographyRawTokens.fontSize250 }
56-
@objc open var fontSizeMobileBodyMedium: TypographyFontSizeSemanticToken { TypographyRawTokens.fontSize200 }
57-
@objc open var fontSizeMobileBodySmall: TypographyFontSizeSemanticToken { TypographyRawTokens.fontSize100 }
58-
59-
// MARK: Semantic token - Typography - Font - Size - Tablet
60-
61-
@objc open var fontSizeTabletDisplayLarge: TypographyFontSizeSemanticToken { TypographyRawTokens.fontSize1450 }
62-
@objc open var fontSizeTabletDisplayMedium: TypographyFontSizeSemanticToken { TypographyRawTokens.fontSize1050 }
63-
@objc open var fontSizeTabletDisplaySmall: TypographyFontSizeSemanticToken { TypographyRawTokens.fontSize850 }
64-
@objc open var fontSizeTabletHeadingXLarge: TypographyFontSizeSemanticToken { TypographyRawTokens.fontSize750 }
65-
@objc open var fontSizeTabletHeadingLarge: TypographyFontSizeSemanticToken { TypographyRawTokens.fontSize550 }
66-
@objc open var fontSizeTabletHeadingMedium: TypographyFontSizeSemanticToken { TypographyRawTokens.fontSize450 }
67-
@objc open var fontSizeTabletHeadingSmall: TypographyFontSizeSemanticToken { TypographyRawTokens.fontSize350 }
68-
@objc open var fontSizeTabletBodyLarge: TypographyFontSizeSemanticToken { TypographyRawTokens.fontSize250 }
69-
@objc open var fontSizeTabletBodyMedium: TypographyFontSizeSemanticToken { TypographyRawTokens.fontSize200 }
70-
@objc open var fontSizeTabletBodySmall: TypographyFontSizeSemanticToken { TypographyRawTokens.fontSize150 }
38+
@objc open var fontWeightDefault: TypographyFontWeightSemanticToken { TypographyRawTokens.fontWeight400 }
39+
@objc open var fontWeightStrong: TypographyFontWeightSemanticToken { TypographyRawTokens.fontWeight700 }
40+
@objc open var fontWeightDisplay: TypographyFontWeightSemanticToken { TypographyRawTokens.fontWeight700 }
41+
@objc open var fontWeightHeading: TypographyFontWeightSemanticToken { TypographyRawTokens.fontWeight700 }
42+
@objc open var fontWeightBodyDefault: TypographyFontWeightSemanticToken { TypographyRawTokens.fontWeight400 }
43+
@objc open var fontWeightBodyStrong: TypographyFontWeightSemanticToken { TypographyRawTokens.fontWeight700 }
44+
@objc open var fontWeightLabelDefault: TypographyFontWeightSemanticToken { TypographyRawTokens.fontWeight400 }
45+
@objc open var fontWeightLabelStrong: TypographyFontWeightSemanticToken { TypographyRawTokens.fontWeight700 }
46+
@objc open var fontWeightCode: TypographyFontWeightSemanticToken { TypographyRawTokens.fontWeight400 }
47+
48+
// MARK: Semantic token - Typography - Font - Size
49+
50+
@objc open var fontSizeDisplayLarge: MultipleFontSizeTokens { MultipleFontSizeTokens(compact: TypographyRawTokens.fontSize850, regular: TypographyRawTokens.fontSize1450) }
51+
@objc open var fontSizeDisplayMedium: MultipleFontSizeTokens { MultipleFontSizeTokens(compact: TypographyRawTokens.fontSize750, regular: TypographyRawTokens.fontSize1050) }
52+
@objc open var fontSizeDisplaySmall: MultipleFontSizeTokens { MultipleFontSizeTokens(compact: TypographyRawTokens.fontSize650, regular: TypographyRawTokens.fontSize850) }
53+
@objc open var fontSizeHeadingXLarge: MultipleFontSizeTokens { MultipleFontSizeTokens(compact: TypographyRawTokens.fontSize550, regular: TypographyRawTokens.fontSize750) }
54+
@objc open var fontSizeHeadingLarge: MultipleFontSizeTokens { MultipleFontSizeTokens(compact: TypographyRawTokens.fontSize450, regular: TypographyRawTokens.fontSize550) }
55+
@objc open var fontSizeHeadingMedium: MultipleFontSizeTokens { MultipleFontSizeTokens(compact: TypographyRawTokens.fontSize350, regular: TypographyRawTokens.fontSize450) }
56+
@objc open var fontSizeHeadingSmall: MultipleFontSizeTokens { MultipleFontSizeTokens(compact: TypographyRawTokens.fontSize300, regular: TypographyRawTokens.fontSize350) }
57+
@objc open var fontSizeBodyLarge: MultipleFontSizeTokens { MultipleFontSizeTokens(TypographyRawTokens.fontSize250) }
58+
@objc open var fontSizeBodyMedium: MultipleFontSizeTokens { MultipleFontSizeTokens(TypographyRawTokens.fontSize200) }
59+
@objc open var fontSizeBodySmall: MultipleFontSizeTokens { MultipleFontSizeTokens(TypographyRawTokens.fontSize150) }
7160

7261
// MARK: Semantic token - Typography - Font - Size - Others
7362

@@ -78,40 +67,24 @@ extension OUDSTheme: TypographySemanticTokens {
7867
@objc open var fontSizeCodeMedium: TypographyFontSizeSemanticToken { TypographyRawTokens.fontSize200 }
7968
@objc open var fontSizeCodeSmall: TypographyFontSizeSemanticToken { TypographyRawTokens.fontSize150 }
8069

81-
// MARK: Semantic token - Typography - Font - Light height - Mobile
82-
83-
@objc open var fontLineHeightMobileDisplayLarge: TypographyFontLineHeightSemanticToken { TypographyRawTokens.fontLineHeight1050 }
84-
@objc open var fontLineHeightMobileDisplayMedium: TypographyFontLineHeightSemanticToken { TypographyRawTokens.fontLineHeight950 }
85-
@objc open var fontLineHeightMobileDisplaySmall: TypographyFontLineHeightSemanticToken { TypographyRawTokens.fontLineHeight850 }
86-
@objc open var fontLineHeightMobileHeadingXLarge: TypographyFontLineHeightSemanticToken { TypographyRawTokens.fontLineHeight750 }
87-
@objc open var fontLineHeightMobileHeadingLarge: TypographyFontLineHeightSemanticToken { TypographyRawTokens.fontLineHeight650 }
88-
@objc open var fontLineHeightMobileHeadingMedium: TypographyFontLineHeightSemanticToken { TypographyRawTokens.fontLineHeight550 }
89-
@objc open var fontLineHeightMobileHeadingSmall: TypographyFontLineHeightSemanticToken { TypographyRawTokens.fontLineHeight450 }
90-
@objc open var fontLineHeightMobileBodyLarge: TypographyFontLineHeightSemanticToken { TypographyRawTokens.fontLineHeight450 }
91-
@objc open var fontLineHeightMobileBodyMedium: TypographyFontLineHeightSemanticToken { TypographyRawTokens.fontLineHeight350 }
92-
@objc open var fontLineHeightMobileBodySmall: TypographyFontLineHeightSemanticToken { TypographyRawTokens.fontLineHeight250 }
93-
94-
// MARK: Semantic token - Typography - Font - Light height - Tablet
95-
96-
@objc open var fontLineHeightTabletDisplayLarge: TypographyFontLineHeightSemanticToken { TypographyRawTokens.fontLineHeight1850 }
97-
@objc open var fontLineHeightTabletDisplayMedium: TypographyFontLineHeightSemanticToken { TypographyRawTokens.fontLineHeight1250 }
98-
@objc open var fontLineHeightTabletDisplaySmall: TypographyFontLineHeightSemanticToken { TypographyRawTokens.fontLineHeight1050 }
99-
@objc open var fontLineHeightTabletHeadingXLarge: TypographyFontLineHeightSemanticToken { TypographyRawTokens.fontLineHeight950 }
100-
@objc open var fontLineHeightTabletHeadingLarge: TypographyFontLineHeightSemanticToken { TypographyRawTokens.fontLineHeight750 }
101-
@objc open var fontLineHeightTabletHeadingMedium: TypographyFontLineHeightSemanticToken { TypographyRawTokens.fontLineHeight650 }
102-
@objc open var fontLineHeightTabletHeadingSmall: TypographyFontLineHeightSemanticToken { TypographyRawTokens.fontLineHeight550 }
103-
@objc open var fontLineHeightTabletBodyLarge: TypographyFontLineHeightSemanticToken { TypographyRawTokens.fontLineHeight450 }
104-
@objc open var fontLineHeightTabletBodyMedium: TypographyFontLineHeightSemanticToken { TypographyRawTokens.fontLineHeight350 }
105-
@objc open var fontLineHeightTabletBodySmall: TypographyFontLineHeightSemanticToken { TypographyRawTokens.fontLineHeight250 }
106-
107-
// MARK: Semantic token - Typography - Font - Light height - Others
108-
109-
@objc open var fontLineHeightLabelXLarge: TypographyFontLineHeightSemanticToken { TypographyRawTokens.fontLineHeight450 }
110-
@objc open var fontLineHeightLabelLarge: TypographyFontLineHeightSemanticToken { TypographyRawTokens.fontLineHeight450 }
111-
@objc open var fontLineHeightLabelMedium: TypographyFontLineHeightSemanticToken { TypographyRawTokens.fontLineHeight350 }
112-
@objc open var fontLineHeightLabelSmall: TypographyFontLineHeightSemanticToken { TypographyRawTokens.fontLineHeight250 }
113-
@objc open var fontLineHeightCodeMedium: TypographyFontLineHeightSemanticToken { TypographyRawTokens.fontLineHeight350 }
114-
@objc open var fontLineHeightCodeSmall: TypographyFontLineHeightSemanticToken { TypographyRawTokens.fontLineHeight250 }
70+
// MARK: - Semantic token - Typography - Font - Line height
71+
72+
@objc open var fontLineHeightDisplayLarge: MultipleFontLineHeightTokens { MultipleFontLineHeightTokens(compact: TypographyRawTokens.fontLineHeight1050, regular: TypographyRawTokens.fontLineHeight1850) }
73+
@objc open var fontLineHeightDisplayMedium: MultipleFontLineHeightTokens { MultipleFontLineHeightTokens(compact: TypographyRawTokens.fontLineHeight950, regular: TypographyRawTokens.fontLineHeight1250) }
74+
@objc open var fontLineHeightDisplaySmall: MultipleFontLineHeightTokens { MultipleFontLineHeightTokens(compact: TypographyRawTokens.fontLineHeight850, regular: TypographyRawTokens.fontLineHeight1050) }
75+
@objc open var fontLineHeightHeadingXLarge: MultipleFontLineHeightTokens { MultipleFontLineHeightTokens(compact: TypographyRawTokens.fontLineHeight750, regular: TypographyRawTokens.fontLineHeight950) }
76+
@objc open var fontLineHeightHeadingLarge: MultipleFontLineHeightTokens { MultipleFontLineHeightTokens(compact: TypographyRawTokens.fontLineHeight650, regular: TypographyRawTokens.fontLineHeight750) }
77+
@objc open var fontLineHeightHeadingMedium: MultipleFontLineHeightTokens { MultipleFontLineHeightTokens(compact: TypographyRawTokens.fontLineHeight550, regular: TypographyRawTokens.fontLineHeight650) }
78+
@objc open var fontLineHeightHeadingSmall: MultipleFontLineHeightTokens { MultipleFontLineHeightTokens(compact: TypographyRawTokens.fontLineHeight450, regular: TypographyRawTokens.fontLineHeight550) }
79+
@objc open var fontLineHeightBodyLarge: MultipleFontLineHeightTokens { MultipleFontLineHeightTokens(TypographyRawTokens.fontLineHeight450) }
80+
@objc open var fontLineHeightBodyMedium: MultipleFontLineHeightTokens { MultipleFontLineHeightTokens(TypographyRawTokens.fontLineHeight350) }
81+
@objc open var fontLineHeightBodySmall: MultipleFontLineHeightTokens { MultipleFontLineHeightTokens(TypographyRawTokens.fontLineHeight250) }
82+
@objc open var fontLineHeightLabelXLarge: MultipleFontLineHeightTokens { MultipleFontLineHeightTokens(TypographyRawTokens.fontLineHeight450) }
83+
@objc open var fontLineHeightLabelLarge: MultipleFontLineHeightTokens { MultipleFontLineHeightTokens(TypographyRawTokens.fontLineHeight450) }
84+
@objc open var fontLineHeightLabelMedium: MultipleFontLineHeightTokens { MultipleFontLineHeightTokens(TypographyRawTokens.fontLineHeight350) }
85+
@objc open var fontLineHeightLabelSmall: MultipleFontLineHeightTokens { MultipleFontLineHeightTokens(TypographyRawTokens.fontLineHeight250) }
86+
@objc open var fontLineHeightCodeMedium: MultipleFontLineHeightTokens { MultipleFontLineHeightTokens(TypographyRawTokens.fontLineHeight350) }
87+
@objc open var fontLineHeightCodeSmall: MultipleFontLineHeightTokens { MultipleFontLineHeightTokens(TypographyRawTokens.fontLineHeight250) }
11588

11689
// MARK: - Semantic token - Typography - Font - Letter spacing - Mobile (extra-compact/compact)
11790

@@ -186,3 +159,5 @@ extension OUDSTheme: TypographySemanticTokens {
186159
@objc open var typeCodeMedium: MultipleTypographyTokens { MultipleTypographyTokens(compact: TypographyRawTokens.typeBold200, regular: TypographyRawTokens.typeBold200) }
187160
@objc open var typeCodeSmall: MultipleTypographyTokens { MultipleTypographyTokens(compact: TypographyRawTokens.typeBold150, regular: TypographyRawTokens.typeBold150) }
188161
}
162+
163+
// swiftlint:enable line_length

0 commit comments

Comments
 (0)