Skip to content

Commit

Permalink
refactor: remove elevation focus semantic tokens (#209)
Browse files Browse the repository at this point in the history
Signed-off-by: Pierre-Yves Lapersonne <[email protected]>
  • Loading branch information
pylapp committed Oct 21, 2024
1 parent 1650e28 commit db63c06
Show file tree
Hide file tree
Showing 8 changed files with 1 addition and 90 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Removed

- [Library] Semantic tokens `elevationBlurFocus`, `elevationXFocus`, `elevationYFocus`, `elevationColorFocus` ([#209](https://github.com/Orange-OpenSource/ouds-ios/issues/209))
- [Library] Semantic token `fontWeightCode` ([#210](https://github.com/Orange-OpenSource/ouds-ios/issues/210))

## [0.4.1](https://github.com/Orange-OpenSource/ouds-ios/compare/0.4.0...0.4.1) - 2024-10-21
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ import OUDSTokensSemantic
// ଘ( ・ω・)_/゚・:*:・。☆
// [File to generate with the tokenator]

// swiftlint:disable line_length

/// Defines basic values common to all themes for `ElevationSemanticTokenss`.
/// These values can be overriden inside `OUDSTheme` subclasses (in extensions or not, in the same module or not) thanks to the `@objc open` combination.
/// The aim of this extensions is to make relationships between all semantic tokens for elevations and associated raw tokens.
Expand All @@ -36,7 +34,6 @@ extension OUDSTheme: ElevationSemanticTokens {
@objc open var elevationXStickyDefault: ElevationXSemanticToken { ElevationRawTokens.elevationX0 }
@objc open var elevationXStickyEmphasized: ElevationXSemanticToken { ElevationRawTokens.elevationX0 }
@objc open var elevationXStickyNavigationScrolled: ElevationXSemanticToken { ElevationRawTokens.elevationX0 }
@objc open var elevationXFocus: ElevationXSemanticToken { ElevationRawTokens.elevationX0 }

// MARK: Semantic token - Elevation - Y

Expand All @@ -48,7 +45,6 @@ extension OUDSTheme: ElevationSemanticTokens {
@objc open var elevationYStickyDefault: ElevationYSemanticToken { ElevationRawTokens.elevationY300 }
@objc open var elevationYStickyEmphasized: ElevationYSemanticToken { ElevationRawTokens.elevationY300 }
@objc open var elevationYStickyNavigationScrolled: ElevationYSemanticToken { ElevationRawTokens.elevationY300 }
@objc open var elevationYFocus: ElevationYSemanticToken { ElevationRawTokens.elevationY0 }

// MARK: Semantic token - Elevation - Blur

Expand All @@ -60,7 +56,6 @@ extension OUDSTheme: ElevationSemanticTokens {
@objc open var elevationBlurStickyDefault: ElevationBlurSemanticToken { ElevationRawTokens.elevationBlur400 }
@objc open var elevationBlurStickyEmphasized: ElevationBlurSemanticToken { ElevationRawTokens.elevationBlur400 }
@objc open var elevationBlurStickyNavigationScrolled: ElevationBlurSemanticToken { ElevationRawTokens.elevationBlur400 }
@objc open var elevationBlurFocus: ElevationBlurSemanticToken { ElevationRawTokens.elevationBlur0 }

// MARK: Semantic token - Elevation - Color

Expand All @@ -72,7 +67,6 @@ extension OUDSTheme: ElevationSemanticTokens {
@objc open var elevationColorStickyDefault: ElevationColorSemanticToken { ElevationColorSemanticToken(ColorRawTokens.colorTransparentBlack300) }
@objc open var elevationColorStickyEmphasized: ElevationColorSemanticToken { ElevationColorSemanticToken(ColorRawTokens.colorTransparentBlack300) }
@objc open var elevationColorStickyNavigationScrolled: ElevationColorSemanticToken { ElevationColorSemanticToken(ColorRawTokens.colorTransparentBlack300) }
@objc open var elevationColorFocus: ElevationColorSemanticToken { ElevationColorSemanticToken(light: ColorRawTokens.colorFunctionalBlack, dark: ColorRawTokens.colorFunctionalLightGray160) }

// MARK: Semantic token - Elevation - Box shadow

Expand All @@ -84,7 +78,4 @@ extension OUDSTheme: ElevationSemanticTokens {
@objc open var elevationStickyDefault: ElevationCompositeSemanticToken { ElevationCompositeSemanticToken(ElevationRawTokens.elevationBottom_3_300) }
@objc open var elevationStickyEmphasized: ElevationCompositeSemanticToken { ElevationCompositeSemanticToken(ElevationRawTokens.elevationBottom_3_300) }
@objc open var elevationStickyNavigationScrolled: ElevationCompositeSemanticToken { ElevationCompositeSemanticToken(ElevationRawTokens.elevationBottom_3_300) }
@objc open var elevationFocus: ElevationCompositeSemanticToken { ElevationCompositeSemanticToken(light: ElevationCompositeRawToken(x: 0, y: 0, blur: 0, color: ColorRawTokens.colorFunctionalBlack), dark: ElevationCompositeRawToken(x: 0, y: 0, blur: 0, color: ColorRawTokens.colorFunctionalLightGray160)) }
}

// swiftlint:enable line_length
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ extension MockTheme {
override open var elevationXStickyDefault: ElevationYSemanticToken { Self.mockThemeElevationXRawToken }
override open var elevationXStickyEmphasized: ElevationYSemanticToken { Self.mockThemeElevationXRawToken }
override open var elevationXStickyNavigationScrolled: ElevationYSemanticToken { Self.mockThemeElevationXRawToken }
override open var elevationXFocus: ElevationYSemanticToken { Self.mockThemeElevationXRawToken }

// MARK: Semantic token - Elevation - Y

Expand All @@ -49,7 +48,6 @@ extension MockTheme {
override open var elevationYStickyDefault: ElevationYSemanticToken { Self.mockThemeElevationYRawToken }
override open var elevationYStickyEmphasized: ElevationYSemanticToken { Self.mockThemeElevationYRawToken }
override open var elevationYStickyNavigationScrolled: ElevationYSemanticToken { Self.mockThemeElevationYRawToken }
override open var elevationYFocus: ElevationYSemanticToken { Self.mockThemeElevationYRawToken }

// MARK: Semantic token - Elevation - Blur

Expand All @@ -61,7 +59,6 @@ extension MockTheme {
override open var elevationBlurStickyDefault: ElevationBlurSemanticToken { Self.mockThemeElevationBlurRawToken }
override open var elevationBlurStickyEmphasized: ElevationBlurSemanticToken { Self.mockThemeElevationBlurRawToken }
override open var elevationBlurStickyNavigationScrolled: ElevationBlurSemanticToken { Self.mockThemeElevationBlurRawToken }
override open var elevationBlurFocus: ElevationBlurSemanticToken { Self.mockThemeElevationBlurRawToken }

// MARK: Semantic token - Elevation - Color - None

Expand Down Expand Up @@ -95,10 +92,6 @@ extension MockTheme {

override open var elevationColorStickyNavigationScrolled: ElevationColorSemanticToken { Self.mockThemeElevationMultipleColorSemanticToken }

// MARK: Semantic token - Elevation - Color - Focus

override open var elevationColorFocus: ElevationColorSemanticToken { Self.mockThemeElevationMultipleColorSemanticToken }

// MARK: Semantic token - Elevation - Box shadow

override open var elevationRaised: ElevationCompositeSemanticToken { Self.mockThemeElevationCompositeSemanticToken }
Expand All @@ -114,7 +107,5 @@ extension MockTheme {
override open var elevationStickyEmphasized: ElevationCompositeSemanticToken { Self.mockThemeElevationCompositeSemanticToken }

override open var elevationStickyNavigationScrolled: ElevationCompositeSemanticToken { Self.mockThemeElevationCompositeSemanticToken }

override open var elevationFocus: ElevationCompositeSemanticToken { Self.mockThemeElevationCompositeSemanticToken }
}
// swiftlint:enable identifier_name
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,6 @@ final class TestThemeOverrideOfElevationSemanticTokens: XCTestCase {
XCTAssertTrue(inheritedTheme.elevationXStickyNavigationScrolled == MockTheme.mockThemeElevationXRawToken)
}

func testInheritedThemeCanOverrideSemanticTokenElevationXFocus() throws {
XCTAssertNotEqual(inheritedTheme.elevationXFocus, abstractTheme.elevationXFocus)
XCTAssertTrue(inheritedTheme.elevationXFocus == MockTheme.mockThemeElevationXRawToken)
}

// MARK: - Semantic token - Elevation - Y

func testInheritedThemeCanOverrideSemanticTokenElevationYNone() throws {
Expand Down Expand Up @@ -121,11 +116,6 @@ final class TestThemeOverrideOfElevationSemanticTokens: XCTestCase {
XCTAssertTrue(inheritedTheme.elevationYStickyNavigationScrolled == MockTheme.mockThemeElevationYRawToken)
}

func testInheritedThemeCanOverrideSemanticTokenElevationYFocus() throws {
XCTAssertNotEqual(inheritedTheme.elevationYFocus, abstractTheme.elevationYFocus)
XCTAssertTrue(inheritedTheme.elevationYFocus == MockTheme.mockThemeElevationYRawToken)
}

// MARK: - Semantic token - Elevation - Blur

func testInheritedThemeCanOverrideSemanticTokenElevationBlurNone() throws {
Expand Down Expand Up @@ -168,11 +158,6 @@ final class TestThemeOverrideOfElevationSemanticTokens: XCTestCase {
XCTAssertTrue(inheritedTheme.elevationBlurStickyNavigationScrolled == MockTheme.mockThemeElevationBlurRawToken)
}

func testInheritedThemeCanOverrideSemanticTokenElevationBlurFocus() throws {
XCTAssertNotEqual(inheritedTheme.elevationBlurFocus, abstractTheme.elevationBlurFocus)
XCTAssertTrue(inheritedTheme.elevationBlurFocus == MockTheme.mockThemeElevationBlurRawToken)
}

// MARK: - Semantic token - Elevation - Color - None

func testInheritedThemeCanOverrideSemanticTokenElevationColorNone() throws {
Expand Down Expand Up @@ -215,11 +200,6 @@ final class TestThemeOverrideOfElevationSemanticTokens: XCTestCase {
XCTAssertTrue(inheritedTheme.elevationColorStickyNavigationScrolled == MockTheme.mockThemeElevationMultipleColorSemanticToken)
}

func testInheritedThemeCanOverrideSemanticTokenElevationColorFocus() throws {
XCTAssertNotEqual(inheritedTheme.elevationColorFocus, abstractTheme.elevationColorFocus)
XCTAssertTrue(inheritedTheme.elevationColorFocus == MockTheme.mockThemeElevationMultipleColorSemanticToken)
}

func testInheritedThemeCanOverrideSemanticTokenElevationCompositeRaised() throws {
XCTAssertNotEqual(inheritedTheme.elevationRaised, abstractTheme.elevationRaised)
XCTAssertTrue(inheritedTheme.elevationRaised == MockTheme.mockThemeElevationCompositeSemanticToken)
Expand Down Expand Up @@ -254,11 +234,6 @@ final class TestThemeOverrideOfElevationSemanticTokens: XCTestCase {
XCTAssertNotEqual(inheritedTheme.elevationStickyNavigationScrolled, abstractTheme.elevationStickyNavigationScrolled)
XCTAssertTrue(inheritedTheme.elevationStickyNavigationScrolled == MockTheme.mockThemeElevationCompositeSemanticToken)
}

func testInheritedThemeCanOverrideSemanticTokenElevationCompositeFocus() throws {
XCTAssertNotEqual(inheritedTheme.elevationFocus, abstractTheme.elevationFocus)
XCTAssertTrue(inheritedTheme.elevationFocus == MockTheme.mockThemeElevationCompositeSemanticToken)
}
}

// swiftlint:enable required_deinit
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,6 @@ final class TestInverseThemeElevationColors: XCTestCase {
XCTAssertEqual(inverseTheme.elevationColorStickyDefault.light, inverseTheme.elevationColorStickyDefault.dark)
XCTAssertEqual(inverseTheme.elevationColorStickyEmphasized.light, inverseTheme.elevationColorStickyEmphasized.dark)
XCTAssertEqual(inverseTheme.elevationColorStickyNavigationScrolled.light, inverseTheme.elevationColorStickyNavigationScrolled.dark)
XCTAssertEqual(inverseTheme.elevationColorFocus.light, inverseTheme.elevationColorFocus.dark)
}

func testElevationEquality() throws {
XCTAssertEqual(inverseTheme.elevationFocus.light, inverseTheme.elevationFocus.dark)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ public protocol ElevationSemanticTokens {
var elevationXStickyDefault: ElevationXSemanticToken { get }
var elevationXStickyEmphasized: ElevationXSemanticToken { get }
var elevationXStickyNavigationScrolled: ElevationXSemanticToken { get }
var elevationXFocus: ElevationXSemanticToken { get }

// MARK: Semantic token - Elevation - Y

Expand All @@ -45,7 +44,6 @@ public protocol ElevationSemanticTokens {
var elevationYStickyDefault: ElevationYSemanticToken { get }
var elevationYStickyEmphasized: ElevationYSemanticToken { get }
var elevationYStickyNavigationScrolled: ElevationYSemanticToken { get }
var elevationYFocus: ElevationYSemanticToken { get }

// MARK: Semantic token - Elevation - Blur

Expand All @@ -57,7 +55,6 @@ public protocol ElevationSemanticTokens {
var elevationBlurStickyDefault: ElevationBlurSemanticToken { get }
var elevationBlurStickyEmphasized: ElevationBlurSemanticToken { get }
var elevationBlurStickyNavigationScrolled: ElevationBlurSemanticToken { get }
var elevationBlurFocus: ElevationBlurSemanticToken { get }

// MARK: Semantic token - Elevation - Color

Expand All @@ -69,7 +66,6 @@ public protocol ElevationSemanticTokens {
var elevationColorStickyDefault: ElevationColorSemanticToken { get }
var elevationColorStickyEmphasized: ElevationColorSemanticToken { get }
var elevationColorStickyNavigationScrolled: ElevationColorSemanticToken { get }
var elevationColorFocus: ElevationColorSemanticToken { get }

// MARK: Semantic token - Elevation - Box shadow

Expand All @@ -81,7 +77,6 @@ public protocol ElevationSemanticTokens {
var elevationStickyDefault: ElevationCompositeSemanticToken { get }
var elevationStickyEmphasized: ElevationCompositeSemanticToken { get }
var elevationStickyNavigationScrolled: ElevationCompositeSemanticToken { get }
var elevationFocus: ElevationCompositeSemanticToken { get }
}

// swiftlint:enable missing_docs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ struct ElevationTokenPage: View {

private enum NamedElevation: String, CaseIterable {
case elevationNone
case elevationFocus
case elevationRaised
case elevationStickyNavigationScrolled
case elevationOverlayDefault
Expand All @@ -69,8 +68,6 @@ private enum NamedElevation: String, CaseIterable {
switch self {
case .elevationNone:
return theme.elevationNone
case .elevationFocus:
return theme.elevationFocus
case .elevationRaised:
return theme.elevationRaised
case .elevationStickyNavigationScrolled:
Expand Down

0 comments on commit db63c06

Please sign in to comment.