diff --git a/OUDS/Core/OUDS/Sources/OUDSTheme/OUDSTheme+SemanticTokens/OUDSTheme+BorderSemanticTokens.swift b/OUDS/Core/OUDS/Sources/OUDSTheme/OUDSTheme+SemanticTokens/OUDSTheme+BorderSemanticTokens.swift index 00f8e8e438..074429e422 100644 --- a/OUDS/Core/OUDS/Sources/OUDSTheme/OUDSTheme+SemanticTokens/OUDSTheme+BorderSemanticTokens.swift +++ b/OUDS/Core/OUDS/Sources/OUDSTheme/OUDSTheme+SemanticTokens/OUDSTheme+BorderSemanticTokens.swift @@ -15,7 +15,7 @@ import Foundation import OUDSTokensRaw import OUDSTokensSemantic -extension OUDSTheme: BorderSemanticTokens { +extension OUDSBorderSemanticTokensWrapper: BorderSemanticTokens { @objc open var borderRadiusDefault: BorderRadiusSemanticToken { BorderRawTokens.borderRadius0 } @objc open var borderRadiusMedium: BorderRadiusSemanticToken { BorderRawTokens.borderRadius150 } @objc open var borderRadiusNone: BorderRadiusSemanticToken { BorderRawTokens.borderRadius0 } diff --git a/OUDS/Core/OUDS/Sources/OUDSTheme/OUDSTheme.swift b/OUDS/Core/OUDS/Sources/OUDSTheme/OUDSTheme.swift index 532174b645..575dc96d5b 100644 --- a/OUDS/Core/OUDS/Sources/OUDSTheme/OUDSTheme.swift +++ b/OUDS/Core/OUDS/Sources/OUDSTheme/OUDSTheme.swift @@ -20,30 +20,41 @@ import OUDSTokensSemantic /// Any properties of an overridable theme should be defined so as to provide defaults values. /// We allow this theme to be derivated and be overriden. /// -/// `OUDSTheme` can be seen as a kind of "abstract class" in _object oriented paradigm_. +/// ``OUDSTheme`` can be seen as a kind of "abstract class" in _object oriented paradigm_. /// /// Because `OUDSTheme` is not a *final* class, its type cannot be seen as `Sendable`, that is the reason why this conformity is unchecked. /// /// **Warning: You are not supposed to use this abstract default theme directly. Please prefer `OrangeTheme` instead** open class OUDSTheme: @unchecked Sendable { + // MARK: - Properties + + /// All semantic tokens of border exposed in one object + public let borders: BorderSemanticTokens + /// A theme can have a custom font which is not the system font public let customFontFamily: FontFamilySemanticToken? + // MARK: - Initializers + /// Defines a basic kind of abstract theme to subclass then. /// No custom font family will be used. - public convenience init() { - self.init(customFontFamily: nil) + /// - Parameters: + /// - borders: An object providing all the border semantic tokens, by default `OUDSBorderSemanticTokensWrapper` + public init(borders: BorderSemanticTokens = OUDSBorderSemanticTokensWrapper()) { + self.borders = borders + customFontFamily = nil } /// Defines a basic kind of abstract theme to subclass then. /// - Parameters: + /// - borders: An object providing all the border semantic tokens, as `BorderSemanticTokens` implementation /// - customFontFamily: Set `nil` if system font to use, otherwise use the `FontFamilySemanticToken` you want to apply - public init(customFontFamily: FontFamilySemanticToken?) { + public init(borders: BorderSemanticTokens, + customFontFamily: FontFamilySemanticToken?) { self.customFontFamily = customFontFamily + self.borders = borders } deinit { } - - // Please refer to extensions for properties, it will be more clear } diff --git a/OUDS/Core/OUDS/Tests/OUDSTheme/MockThemes/MockTheme+BorderSemanticTokens.swift b/OUDS/Core/OUDS/Tests/OUDSTheme/MockThemes/MockTheme+BorderSemanticTokens.swift index 53ee96a155..7f7e0977b8 100644 --- a/OUDS/Core/OUDS/Tests/OUDSTheme/MockThemes/MockTheme+BorderSemanticTokens.swift +++ b/OUDS/Core/OUDS/Tests/OUDSTheme/MockThemes/MockTheme+BorderSemanticTokens.swift @@ -4,7 +4,7 @@ // SPDX-License-Identifier: MIT // // This software is distributed under the MIT license, -// the text of which is available at https://opensource.org/license/MIT/ +// the text of which is available at https://publicsource.org/license/MIT/ // or see the "LICENSE" file for more details. // // Authors: See CONTRIBUTORS.txt @@ -15,9 +15,11 @@ import Foundation import OUDSTokensRaw import OUDSTokensSemantic -/// Overrides **all** the border semantic tokens (from its super class, i.e. `OUDSTheme` so as to test overriding of them (unit tests) +// swiftlint:disable required_deinit + +/// Overrides **all** the border semantic tokens (from its super class, i.e. `OUDSBorderSemanticTokensWrapper` so as to test overriding of them (unit tests) /// and to act like smoke tests with crashing tests if some tokens disappeared. -extension MockTheme { +final class MockThemeBorderSemanticTokensWrapper: OUDSBorderSemanticTokensWrapper { static let mockThemeBorderWidthRawToken: BorderWidthRawToken = 1_337 static let mockThemeBorderRadiusRawToken: BorderRadiusRawToken = 42 @@ -25,25 +27,27 @@ extension MockTheme { // MARK: Semantic token - Border - Width - override open var borderWidthNone: BorderWidthSemanticToken { Self.mockThemeBorderWidthRawToken } - override open var borderWidthDefault: BorderWidthSemanticToken { Self.mockThemeBorderWidthRawToken } - override open var borderWidthThin: BorderWidthSemanticToken { Self.mockThemeBorderWidthRawToken } - override open var borderWidthMedium: BorderWidthSemanticToken { Self.mockThemeBorderWidthRawToken } - override open var borderWidthThick: BorderWidthSemanticToken { Self.mockThemeBorderWidthRawToken } - override open var borderWidthThicker: BorderWidthSemanticToken { Self.mockThemeBorderWidthRawToken } - override open var borderWidthFocus: BorderWidthSemanticToken { Self.mockThemeBorderWidthRawToken } - override open var borderWidthFocusInset: BorderWidthSemanticToken { Self.mockThemeBorderWidthRawToken } + override public var borderWidthNone: BorderWidthSemanticToken { Self.mockThemeBorderWidthRawToken } + override public var borderWidthDefault: BorderWidthSemanticToken { Self.mockThemeBorderWidthRawToken } + override public var borderWidthThin: BorderWidthSemanticToken { Self.mockThemeBorderWidthRawToken } + override public var borderWidthMedium: BorderWidthSemanticToken { Self.mockThemeBorderWidthRawToken } + override public var borderWidthThick: BorderWidthSemanticToken { Self.mockThemeBorderWidthRawToken } + override public var borderWidthThicker: BorderWidthSemanticToken { Self.mockThemeBorderWidthRawToken } + override public var borderWidthFocus: BorderWidthSemanticToken { Self.mockThemeBorderWidthRawToken } + override public var borderWidthFocusInset: BorderWidthSemanticToken { Self.mockThemeBorderWidthRawToken } // MARK: Semantic token - Border - Radius - override open var borderRadiusNone: BorderRadiusSemanticToken { Self.mockThemeBorderRadiusRawToken } - override open var borderRadiusDefault: BorderRadiusSemanticToken { Self.mockThemeBorderRadiusRawToken } - override open var borderRadiusShort: BorderRadiusSemanticToken { Self.mockThemeBorderRadiusRawToken } - override open var borderRadiusMedium: BorderRadiusSemanticToken { Self.mockThemeBorderRadiusRawToken } - override open var borderRadiusTall: BorderRadiusSemanticToken { Self.mockThemeBorderRadiusRawToken } + override public var borderRadiusNone: BorderRadiusSemanticToken { Self.mockThemeBorderRadiusRawToken } + override public var borderRadiusDefault: BorderRadiusSemanticToken { Self.mockThemeBorderRadiusRawToken } + override public var borderRadiusShort: BorderRadiusSemanticToken { Self.mockThemeBorderRadiusRawToken } + override public var borderRadiusMedium: BorderRadiusSemanticToken { Self.mockThemeBorderRadiusRawToken } + override public var borderRadiusTall: BorderRadiusSemanticToken { Self.mockThemeBorderRadiusRawToken } // MARK: Semantic token - Border - Style - override open var borderStyleDefault: BorderStyleSemanticToken { Self.mockThemeBorderStyleRawToken } - override open var borderStyleDrag: BorderStyleSemanticToken { Self.mockThemeBorderStyleRawToken } + override public var borderStyleDefault: BorderStyleSemanticToken { Self.mockThemeBorderStyleRawToken } + override public var borderStyleDrag: BorderStyleSemanticToken { Self.mockThemeBorderStyleRawToken } } + +// swiftlint:enable required_deinit diff --git a/OUDS/Core/OUDS/Tests/OUDSTheme/MockThemes/MockTheme.swift b/OUDS/Core/OUDS/Tests/OUDSTheme/MockThemes/MockTheme.swift index 823cf10fc6..4365aa09c6 100644 --- a/OUDS/Core/OUDS/Tests/OUDSTheme/MockThemes/MockTheme.swift +++ b/OUDS/Core/OUDS/Tests/OUDSTheme/MockThemes/MockTheme.swift @@ -15,7 +15,11 @@ import Foundation import OUDS import OUDSTokensSemantic -/// A mock theme for tests +/// A mock theme for tests. It helps to make tests on themes, mainly for the architecture and the overriding of tokens. +/// *open* to allow some derivative mock themes like ``OtherMockTheme``. +/// +/// Uses its own tokens wrappers for tests: +/// - ``MockThemeBorderSemanticTokensWrapper`` for borders open class MockTheme: OUDSTheme, @unchecked Sendable { convenience init() { @@ -23,10 +27,9 @@ open class MockTheme: OUDSTheme, @unchecked Sendable { } init(customFont: String?) { - super.init(customFontFamily: customFont) + super.init(borders: MockThemeBorderSemanticTokensWrapper(), + customFontFamily: customFont) } deinit { } - - // Please refer to extensions } diff --git a/OUDS/Core/OUDS/Tests/OUDSTheme/TestThemeOverrideOfBorderSemanticTokens.swift b/OUDS/Core/OUDS/Tests/OUDSTheme/TestThemeOverrideOfBorderSemanticTokens.swift index ba197c84ad..a8d1ce6f38 100644 --- a/OUDS/Core/OUDS/Tests/OUDSTheme/TestThemeOverrideOfBorderSemanticTokens.swift +++ b/OUDS/Core/OUDS/Tests/OUDSTheme/TestThemeOverrideOfBorderSemanticTokens.swift @@ -36,82 +36,82 @@ final class TestThemeOverrideOfBorderSemanticTokens: XCTestCase { // MARK: - Semantic token - Border - Width func testInheritedThemeCanOverrideSemanticTokenBorderWidthNone() throws { - XCTAssertNotEqual(inheritedTheme.borderWidthNone, abstractTheme.borderWidthNone) - XCTAssertTrue(inheritedTheme.borderWidthNone == MockTheme.mockThemeBorderWidthRawToken) + XCTAssertNotEqual(inheritedTheme.borders.borderWidthNone, abstractTheme.borders.borderWidthNone) + XCTAssertTrue(inheritedTheme.borders.borderWidthNone == MockThemeBorderSemanticTokensWrapper.mockThemeBorderWidthRawToken) } func testInheritedThemeCanOverrideSemanticTokenBorderWidthDefault() throws { - XCTAssertNotEqual(inheritedTheme.borderWidthDefault, abstractTheme.borderWidthDefault) - XCTAssertTrue(inheritedTheme.borderWidthDefault == MockTheme.mockThemeBorderWidthRawToken) + XCTAssertNotEqual(inheritedTheme.borders.borderWidthDefault, abstractTheme.borders.borderWidthDefault) + XCTAssertTrue(inheritedTheme.borders.borderWidthDefault == MockThemeBorderSemanticTokensWrapper.mockThemeBorderWidthRawToken) } func testInheritedThemeCanOverrideSemanticTokenBorderWidthThin() throws { - XCTAssertNotEqual(inheritedTheme.borderWidthThin, abstractTheme.borderWidthThin) - XCTAssertTrue(inheritedTheme.borderWidthThin == MockTheme.mockThemeBorderWidthRawToken) + XCTAssertNotEqual(inheritedTheme.borders.borderWidthThin, abstractTheme.borders.borderWidthThin) + XCTAssertTrue(inheritedTheme.borders.borderWidthThin == MockThemeBorderSemanticTokensWrapper.mockThemeBorderWidthRawToken) } func testInheritedThemeCanOverrideSemanticTokenBorderWidthMedium() throws { - XCTAssertNotEqual(inheritedTheme.borderWidthMedium, abstractTheme.borderWidthMedium) - XCTAssertTrue(inheritedTheme.borderWidthMedium == MockTheme.mockThemeBorderWidthRawToken) + XCTAssertNotEqual(inheritedTheme.borders.borderWidthMedium, abstractTheme.borders.borderWidthMedium) + XCTAssertTrue(inheritedTheme.borders.borderWidthMedium == MockThemeBorderSemanticTokensWrapper.mockThemeBorderWidthRawToken) } func testInheritedThemeCanOverrideSemanticTokenBorderWidthThick() throws { - XCTAssertNotEqual(inheritedTheme.borderWidthThick, abstractTheme.borderWidthThick) - XCTAssertTrue(inheritedTheme.borderWidthThick == MockTheme.mockThemeBorderWidthRawToken) + XCTAssertNotEqual(inheritedTheme.borders.borderWidthThick, abstractTheme.borders.borderWidthThick) + XCTAssertTrue(inheritedTheme.borders.borderWidthThick == MockThemeBorderSemanticTokensWrapper.mockThemeBorderWidthRawToken) } func testInheritedThemeCanOverrideSemanticTokenBorderWidthThicker() throws { - XCTAssertNotEqual(inheritedTheme.borderWidthThicker, abstractTheme.borderWidthThicker) - XCTAssertTrue(inheritedTheme.borderWidthThicker == MockTheme.mockThemeBorderWidthRawToken) + XCTAssertNotEqual(inheritedTheme.borders.borderWidthThicker, abstractTheme.borders.borderWidthThicker) + XCTAssertTrue(inheritedTheme.borders.borderWidthThicker == MockThemeBorderSemanticTokensWrapper.mockThemeBorderWidthRawToken) } func testInheritedThemeCanOverrideSemanticTokenBorderWidthFocus() throws { - XCTAssertNotEqual(inheritedTheme.borderWidthFocus, abstractTheme.borderWidthFocus) - XCTAssertTrue(inheritedTheme.borderWidthFocus == MockTheme.mockThemeBorderWidthRawToken) + XCTAssertNotEqual(inheritedTheme.borders.borderWidthFocus, abstractTheme.borders.borderWidthFocus) + XCTAssertTrue(inheritedTheme.borders.borderWidthFocus == MockThemeBorderSemanticTokensWrapper.mockThemeBorderWidthRawToken) } func testInheritedThemeCanOverrideSemanticTokenBorderWidthFocusInset() throws { - XCTAssertNotEqual(inheritedTheme.borderWidthFocusInset, abstractTheme.borderWidthFocusInset) - XCTAssertTrue(inheritedTheme.borderWidthFocusInset == MockTheme.mockThemeBorderWidthRawToken) + XCTAssertNotEqual(inheritedTheme.borders.borderWidthFocusInset, abstractTheme.borders.borderWidthFocusInset) + XCTAssertTrue(inheritedTheme.borders.borderWidthFocusInset == MockThemeBorderSemanticTokensWrapper.mockThemeBorderWidthRawToken) } // MARK: - Semantic token - Border - Radius func testInheritedThemeCanOverrideSemanticTokenBorderRadiusNone() throws { - XCTAssertNotEqual(inheritedTheme.borderRadiusNone, abstractTheme.borderRadiusNone) - XCTAssertTrue(inheritedTheme.borderRadiusNone == MockTheme.mockThemeBorderRadiusRawToken) + XCTAssertNotEqual(inheritedTheme.borders.borderRadiusNone, abstractTheme.borders.borderRadiusNone) + XCTAssertTrue(inheritedTheme.borders.borderRadiusNone == MockThemeBorderSemanticTokensWrapper.mockThemeBorderRadiusRawToken) } func testInheritedThemeCanOverrideSemanticTokenBorderRadiusDefault() throws { - XCTAssertNotEqual(inheritedTheme.borderRadiusDefault, abstractTheme.borderRadiusDefault) - XCTAssertTrue(inheritedTheme.borderRadiusDefault == MockTheme.mockThemeBorderRadiusRawToken) + XCTAssertNotEqual(inheritedTheme.borders.borderRadiusDefault, abstractTheme.borders.borderRadiusDefault) + XCTAssertTrue(inheritedTheme.borders.borderRadiusDefault == MockThemeBorderSemanticTokensWrapper.mockThemeBorderRadiusRawToken) } func testInheritedThemeCanOverrideSemanticTokenBorderRadiusShort() throws { - XCTAssertNotEqual(inheritedTheme.borderRadiusShort, abstractTheme.borderRadiusShort) - XCTAssertTrue(inheritedTheme.borderRadiusShort == MockTheme.mockThemeBorderRadiusRawToken) + XCTAssertNotEqual(inheritedTheme.borders.borderRadiusShort, abstractTheme.borders.borderRadiusShort) + XCTAssertTrue(inheritedTheme.borders.borderRadiusShort == MockThemeBorderSemanticTokensWrapper.mockThemeBorderRadiusRawToken) } func testInheritedThemeCanOverrideSemanticTokenBorderRadiusMedium() throws { - XCTAssertNotEqual(inheritedTheme.borderRadiusMedium, abstractTheme.borderRadiusMedium) - XCTAssertTrue(inheritedTheme.borderRadiusMedium == MockTheme.mockThemeBorderRadiusRawToken) + XCTAssertNotEqual(inheritedTheme.borders.borderRadiusMedium, abstractTheme.borders.borderRadiusMedium) + XCTAssertTrue(inheritedTheme.borders.borderRadiusMedium == MockThemeBorderSemanticTokensWrapper.mockThemeBorderRadiusRawToken) } func testInheritedThemeCanOverrideSemanticTokenBorderRadiusTall() throws { - XCTAssertNotEqual(inheritedTheme.borderRadiusTall, abstractTheme.borderRadiusTall) - XCTAssertTrue(inheritedTheme.borderRadiusTall == MockTheme.mockThemeBorderRadiusRawToken) + XCTAssertNotEqual(inheritedTheme.borders.borderRadiusTall, abstractTheme.borders.borderRadiusTall) + XCTAssertTrue(inheritedTheme.borders.borderRadiusTall == MockThemeBorderSemanticTokensWrapper.mockThemeBorderRadiusRawToken) } // MARK: - Semantic token - Border - Style func testInheritedThemeCanOverrideSemanticTokenBorderStyleDefault() throws { - XCTAssertNotEqual(inheritedTheme.borderStyleDefault, abstractTheme.borderStyleDefault) - XCTAssertTrue(inheritedTheme.borderStyleDefault == MockTheme.mockThemeBorderStyleRawToken) + XCTAssertNotEqual(inheritedTheme.borders.borderStyleDefault, abstractTheme.borders.borderStyleDefault) + XCTAssertTrue(inheritedTheme.borders.borderStyleDefault == MockThemeBorderSemanticTokensWrapper.mockThemeBorderStyleRawToken) } func testInheritedThemeCanOverrideSemanticTokenBorderStyleDrag() throws { - XCTAssertNotEqual(inheritedTheme.borderStyleDrag, abstractTheme.borderStyleDrag) - XCTAssertTrue(inheritedTheme.borderStyleDrag == MockTheme.mockThemeBorderStyleRawToken) + XCTAssertNotEqual(inheritedTheme.borders.borderStyleDrag, abstractTheme.borders.borderStyleDrag) + XCTAssertTrue(inheritedTheme.borders.borderStyleDrag == MockThemeBorderSemanticTokensWrapper.mockThemeBorderStyleRawToken) } } diff --git a/OUDS/Core/Themes/Orange/Sources/OrangeTheme.swift b/OUDS/Core/Themes/Orange/Sources/OrangeTheme.swift index 24a57b50d2..4749543087 100644 --- a/OUDS/Core/Themes/Orange/Sources/OrangeTheme.swift +++ b/OUDS/Core/Themes/Orange/Sources/OrangeTheme.swift @@ -12,12 +12,21 @@ // import OUDS +import OUDSTokensSemantic -/// This is an override of the default basic ``OUDSTheme` and should be seen as the default theme for the OUDS library. -/// It can overrides any properties from its superclass, and can be derived too. +/// This is an override of the default basic ``OUDSTheme`` and should be seen as the default theme for the OUDS library. +/// It can override any properties from its superclass, and can be derived too. open class OrangeTheme: OUDSTheme, @unchecked Sendable { - deinit { } + // MARK: - Initializers - // For clarity reasons, please override OUDSTheme properties in extensions + /// Defines a basic kind of abstract theme to subclass then. + /// No custom font family will be used. + /// - Parameters: + /// - borders: An object providing all the border semantic tokens, as `BorderSemanticTokens` implementation + public override init(borders: BorderSemanticTokens) { + super.init(borders: borders) + } + + deinit { } } diff --git a/OUDS/Core/Tokens/SemanticTokens/Sources/Values/BorderSemanticTokens.swift b/OUDS/Core/Tokens/SemanticTokens/Sources/Values/BorderSemanticTokens.swift index 67b72a37a4..5ae900f43b 100644 --- a/OUDS/Core/Tokens/SemanticTokens/Sources/Values/BorderSemanticTokens.swift +++ b/OUDS/Core/Tokens/SemanticTokens/Sources/Values/BorderSemanticTokens.swift @@ -19,7 +19,7 @@ /// This is a group of semantic tokens for **borders**. /// It defines all ``BorderWidthSemanticToken``, ``BorderRadiusSemanticToken`` and ``BorderStyleSemanticToken`` a theme must have. -/// Any border semantic token must be declared there. +/// Any border semantic token must be declared there as wrappers like ``OUDSBorderSemanticTokensWrapper`` will then expose them through `OUDSTheme`. public protocol BorderSemanticTokens { // MARK: - Semantic token - Border - Width diff --git a/OUDS/Core/Tokens/SemanticTokens/Sources/Values/OUDSBorderSemanticTokensWrapper.swift b/OUDS/Core/Tokens/SemanticTokens/Sources/Values/OUDSBorderSemanticTokensWrapper.swift new file mode 100644 index 0000000000..829860d247 --- /dev/null +++ b/OUDS/Core/Tokens/SemanticTokens/Sources/Values/OUDSBorderSemanticTokensWrapper.swift @@ -0,0 +1,28 @@ +// +// Software Name: OUDS iOS +// SPDX-FileCopyrightText: Copyright (c) Orange SA +// SPDX-License-Identifier: MIT +// +// This software is distributed under the MIT license, +// the text of which is available at https://opensource.org/license/MIT/ +// or see the "LICENSE" file for more details. +// +// Authors: See CONTRIBUTORS.txt +// Software description: A SwiftUI components library with code examples for Orange Unified Design System +// + +/// A class which wraps all ``BorderSemanticTokens`` and expose them. +/// This wrapper should be integrated as a ``BorderSemanticTokens`` implementation inside `OUDSTheme` so as to provide +/// all tokens to the users. +open class OUDSBorderSemanticTokensWrapper { + + /// Intializes the wrapper + public init() { } + + deinit{ } + + // ଘ( ・ω・)_/゚・:*:・。☆ + // Note: So as to help the integration of generated code produced by the tokenator + // the implemention of BorderSemanticTokens is not here but in OUDS/OUDSTheme/OUDSTheme+SemanticTokens/OUDSTheme+BorderSemanticTokens.swift + // This declaration of BorderSemanticTokensWrapper is here to allow to write documentation. +} diff --git a/Showcase/Showcase/Pages/Tokens/Border/BorderTokenPage.swift b/Showcase/Showcase/Pages/Tokens/Border/BorderTokenPage.swift index 1ca14bd4ae..40e6899f86 100644 --- a/Showcase/Showcase/Pages/Tokens/Border/BorderTokenPage.swift +++ b/Showcase/Showcase/Pages/Tokens/Border/BorderTokenPage.swift @@ -24,7 +24,7 @@ struct BorderTokenPage: View { VStack(alignment: .leading, spacing: theme.spaceFixedMedium) { Section { VStack(alignment: .leading, spacing: theme.spaceFixedNone) { - ShowcaseCode(code: "theme.borderWidthDefault") + ShowcaseCode(code: "theme.borders.borderWidthDefault") } } Section { @@ -93,9 +93,9 @@ struct BorderTokenPage: View { ShowcaseTokenIllustration(tokenName: name, tokenValue: value) { RectangleBackground() - .oudsBorder(style: theme.borderStyleDefault, + .oudsBorder(style: theme.borders.borderStyleDefault, width: token, - radius: theme.borderRadiusNone, + radius: theme.borders.borderRadiusNone, color: theme.colorBorderDefault) } } @@ -114,8 +114,8 @@ struct BorderTokenPage: View { ShowcaseTokenIllustration(tokenName: name, tokenValue: value) { RectangleBackground() - .oudsBorder(style: theme.borderStyleDefault, - width: theme.borderWidthDefault, + .oudsBorder(style: theme.borders.borderStyleDefault, + width: theme.borders.borderWidthDefault, radius: token, color: theme.colorBorderDefault) } @@ -136,8 +136,8 @@ struct BorderTokenPage: View { ShowcaseTokenIllustration(tokenName: name, tokenValue: value) { RectangleBackground() .oudsBorder(style: token, - width: theme.borderWidthDefault, - radius: theme.borderRadiusNone, + width: theme.borders.borderWidthDefault, + radius: theme.borders.borderRadiusNone, color: theme.colorBorderDefault) } } @@ -154,15 +154,15 @@ enum NamedBorderRadius: String, CaseIterable { func token(from theme: OUDSTheme) -> BorderRadiusSemanticToken { switch self { case .borderRadiusNone: - return theme.borderRadiusNone + return theme.borders.borderRadiusNone case .borderRadiusDefault: - return theme.borderRadiusDefault + return theme.borders.borderRadiusDefault case .borderRadiusShort: - return theme.borderRadiusShort + return theme.borders.borderRadiusShort case .borderRadiusMedium: - return theme.borderRadiusMedium + return theme.borders.borderRadiusMedium case .borderRadiusTall: - return theme.borderRadiusTall + return theme.borders.borderRadiusTall } } } @@ -180,21 +180,21 @@ enum NamedBorderWidth: String, CaseIterable { func token(from theme: OUDSTheme) -> BorderWidthSemanticToken { switch self { case .borderWidthNone: - return theme.borderWidthNone + return theme.borders.borderWidthNone case .borderWidthDefault: - return theme.borderWidthDefault + return theme.borders.borderWidthDefault case .borderWidthThin: - return theme.borderWidthThin + return theme.borders.borderWidthThin case .borderWidthMedium: - return theme.borderWidthMedium + return theme.borders.borderWidthMedium case .borderWidthThick: - return theme.borderWidthThick + return theme.borders.borderWidthThick case .borderWidthThicker: - return theme.borderWidthThicker + return theme.borders.borderWidthThicker case .borderWidthFocus: - return theme.borderWidthFocus + return theme.borders.borderWidthFocus case .borderWidthFocusInset: - return theme.borderWidthFocusInset + return theme.borders.borderWidthFocusInset } } } @@ -206,9 +206,9 @@ enum NamedBorderStyle: String, CaseIterable { func token(from theme: OUDSTheme) -> BorderStyleSemanticToken { switch self { case .borderStyleDefault: - return theme.borderStyleDefault + return theme.borders.borderStyleDefault case .borderStyleDrag: - return theme.borderStyleDrag + return theme.borders.borderStyleDrag } } } diff --git a/Showcase/Showcase/Pages/Tokens/Color/ColorTokenPage.swift b/Showcase/Showcase/Pages/Tokens/Color/ColorTokenPage.swift index a8d1367cc8..3bb131d70c 100644 --- a/Showcase/Showcase/Pages/Tokens/Color/ColorTokenPage.swift +++ b/Showcase/Showcase/Pages/Tokens/Color/ColorTokenPage.swift @@ -153,9 +153,9 @@ struct ColorTokenPage: View { .fill(colorRawToken.color) .frame(width: 64, height: 64) .oudsBorder( - style: theme.borderStyleDefault, - width: theme.borderWidthThin, - radius: theme.borderRadiusNone, + style: theme.borders.borderStyleDefault, + width: theme.borders.borderWidthThin, + radius: theme.borders.borderRadiusNone, color: theme.colorBorderDefault ) } diff --git a/Showcase/Showcase/Pages/Tokens/Dimension/Space/SpaceTokenCommonIllustration.swift b/Showcase/Showcase/Pages/Tokens/Dimension/Space/SpaceTokenCommonIllustration.swift index eeeba8c73a..d16629bd86 100644 --- a/Showcase/Showcase/Pages/Tokens/Dimension/Space/SpaceTokenCommonIllustration.swift +++ b/Showcase/Showcase/Pages/Tokens/Dimension/Space/SpaceTokenCommonIllustration.swift @@ -316,7 +316,7 @@ struct SpaceHeaderDescription: View { var body: some View { content - .oudsBorder(style: theme.borderStyleDrag, width: theme.borderWidthThin, radius: theme.borderRadiusNone, color: theme.colorBgEmphasized) + .oudsBorder(style: theme.borders.borderStyleDrag, width: theme.borders.borderWidthThin, radius: theme.borders.borderRadiusNone, color: theme.colorBgEmphasized) .padding(.all, theme.spaceFixedMedium) .background(theme.colorBgEmphasized.color(for: colorScheme)) } diff --git a/Showcase/Showcase/Pages/Tokens/Opacity/OpacityTokenPage.swift b/Showcase/Showcase/Pages/Tokens/Opacity/OpacityTokenPage.swift index 01e278382f..f7eec8e53c 100644 --- a/Showcase/Showcase/Pages/Tokens/Opacity/OpacityTokenPage.swift +++ b/Showcase/Showcase/Pages/Tokens/Opacity/OpacityTokenPage.swift @@ -62,9 +62,9 @@ struct OpacityTokenPage: View { .fill(theme.colorBgEmphasized.color(for: colorScheme)) .opacity(token) .frame(width: 48, height: 48) - .oudsBorder(style: theme.borderStyleDefault, - width: theme.borderWidthThin, - radius: theme.borderRadiusNone, + .oudsBorder(style: theme.borders.borderStyleDefault, + width: theme.borders.borderWidthThin, + radius: theme.borders.borderRadiusNone, color: theme.colorBorderEmphasized) .padding(.top, 24) .padding(.leading, 24) diff --git a/Showcase/Showcase/Pages/Utils/ShowcaseCode.swift b/Showcase/Showcase/Pages/Utils/ShowcaseCode.swift index b2ff57fd3a..23b1de2990 100644 --- a/Showcase/Showcase/Pages/Utils/ShowcaseCode.swift +++ b/Showcase/Showcase/Pages/Utils/ShowcaseCode.swift @@ -99,9 +99,9 @@ struct ShowcaseCode: View { Rectangle() .opacity(theme.opacityInvisible) .frame(minWidth: 40, maxWidth: .infinity, alignment: .leading) - .oudsBorder(style: theme.borderStyleDefault, - width: theme.borderWidthThin, - radius: theme.borderRadiusDefault, + .oudsBorder(style: theme.borders.borderStyleDefault, + width: theme.borders.borderWidthThin, + radius: theme.borders.borderRadiusDefault, color: theme.colorBorderDefault) ) } diff --git a/Showcase/Showcase/Pages/Utils/ShowcaseConfiguration.swift b/Showcase/Showcase/Pages/Utils/ShowcaseConfiguration.swift index 5624d44996..a62ee12dd1 100644 --- a/Showcase/Showcase/Pages/Utils/ShowcaseConfiguration.swift +++ b/Showcase/Showcase/Pages/Utils/ShowcaseConfiguration.swift @@ -38,9 +38,9 @@ struct ShowcaseConfiguration: View where Configuration: View { configuration() } .padding(.all, theme.spaceFixedMedium) - .oudsBorder(style: theme.borderStyleDefault, - width: theme.borderWidthThin, - radius: theme.borderRadiusMedium, + .oudsBorder(style: theme.borders.borderStyleDefault, + width: theme.borders.borderWidthThin, + radius: theme.borders.borderRadiusMedium, color: theme.colorBorderDefault) } }