-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: architecture for components tokens
Signed-off-by: Pierre-Yves Lapersonne <pierreyves.lapersonne@orange.com>
- Loading branch information
Showing
14 changed files
with
155 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
...s/Orange/Sources/Providers/ComponentTokens/OrangeThemeButtonComponentTokensProvider.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// | ||
// 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 | ||
// | ||
|
||
import OUDSFoundations | ||
import OUDSTokensComponent | ||
import OUDSTokensSemantic | ||
|
||
/// Defines a provider of component tokens for `OUDSButton`. | ||
/// Implements `ButtonsComponentTokensRequirements` so as to be forced to get the needed semantic token providers | ||
/// to be able to use them later for definition of `ButtonsComponentTokens` | ||
/// | ||
/// - Since: 0.10.0 | ||
open class OrangeThemeButtonComponentTokensProvider: ButtonsComponentTokensRequirements { | ||
|
||
public var sizes: AllSizeSemanticTokensProvider | ||
public var borders: AllBorderSemanticTokensProvider | ||
public var colors: AllColorSemanticTokensProvider | ||
public var spaces: AllSpaceSemanticTokensProvider | ||
|
||
init(sizes: AllSizeSemanticTokensProvider, | ||
borders: AllBorderSemanticTokensProvider, | ||
colors: AllColorSemanticTokensProvider, | ||
spaces: AllSpaceSemanticTokensProvider) { | ||
OUDSLogger.debug("Init of OrangeThemeButtonComponentTokensProvider") | ||
self.sizes = sizes | ||
self.borders = borders | ||
self.colors = colors | ||
self.spaces = spaces | ||
} | ||
|
||
deinit{ } | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
27 changes: 27 additions & 0 deletions
27
...Core/Themes/Orange/Sources/Values/ComponentTokens/OrangeTheme+ButtonComponentTokens.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// | ||
// 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 | ||
// | ||
|
||
import OUDSTokensComponent | ||
import OUDSTokensRaw | ||
import OUDSTokensSemantic | ||
|
||
// [File to generate and upload with the tokenator] | ||
|
||
extension OrangeThemeButtonComponentTokensProvider: ButtonsComponentTokens { | ||
|
||
public var buttonSizeMaxHeight: SizeSemanticToken { DimensionRawTokens.dimension600 } | ||
public var buttonBorderRadius: BorderRadiusSemanticToken { borders.borderRadiusNone } | ||
public var buttonColorBgDefaultFocusMono: MultipleColorSemanticTokens { colors.colorRepositoryOpacityBlackHigher } | ||
|
||
// ... | ||
} |
16 changes: 16 additions & 0 deletions
16
OUDS/Core/Tokens/ComponentTokens/Sources/TypeAliases/ButtonsComponentTokens+Aliases.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// | ||
// 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 | ||
// | ||
|
||
/// Provider of component tokens for buttons are embeded in `OUDSTheme` as both `ButtonsComponentTokens` and`ButtonsComponentTokensRequirements` | ||
/// to force users to implement these two protocols so as to be able to use semantic tokens providers | ||
public typealias AllButtonComponentTokens = ButtonsComponentTokens & ButtonsComponentTokensRequirements |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters