diff --git a/DesignKit/Common.xcconfig b/DesignKit/Common.xcconfig deleted file mode 100644 index eb4b88c16..000000000 --- a/DesignKit/Common.xcconfig +++ /dev/null @@ -1,28 +0,0 @@ -// -// Copyright 2021 Vector Creations Ltd -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -// Configuration settings file format documentation can be found at: -// https://help.apple.com/xcode/#/dev745c5c974 - -#include "Config/AppIdentifiers.xcconfig" -#include "Config/AppVersion.xcconfig" - -PRODUCT_NAME = DesignKit -PRODUCT_BUNDLE_IDENTIFIER = $(BASE_BUNDLE_IDENTIFIER).designkit - -INFOPLIST_FILE = DesignKit/Info.plist - -SKIP_INSTALL = YES diff --git a/DesignKit/Debug.xcconfig b/DesignKit/Debug.xcconfig deleted file mode 100644 index 11a7288a4..000000000 --- a/DesignKit/Debug.xcconfig +++ /dev/null @@ -1,20 +0,0 @@ -// -// Copyright 2021 Vector Creations Ltd -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -// Configuration settings file format documentation can be found at: -// https://help.apple.com/xcode/#/dev745c5c974 - -#include "Common.xcconfig" diff --git a/DesignKit/DesignKit.h b/DesignKit/DesignKit.h deleted file mode 100644 index 4ff68e722..000000000 --- a/DesignKit/DesignKit.h +++ /dev/null @@ -1,27 +0,0 @@ -// -// Copyright 2021 New Vector Ltd -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -#import - -//! Project version number for DesignKit. -FOUNDATION_EXPORT double DesignKitVersionNumber; - -//! Project version string for DesignKit. -FOUNDATION_EXPORT const unsigned char DesignKitVersionString[]; - -// In this header, you should import all the public headers of your framework using statements like #import - - diff --git a/DesignKit/Extensions/UIFont.swift b/DesignKit/Extensions/UIFont.swift deleted file mode 100644 index 7804c8066..000000000 --- a/DesignKit/Extensions/UIFont.swift +++ /dev/null @@ -1,55 +0,0 @@ -// -// Copyright 2021 New Vector Ltd -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -import UIKit - -public extension UIFont { - - // MARK: - Convenient methods - - /// Update current font with a SymbolicTraits - func vc_withTraits(_ traits: UIFontDescriptor.SymbolicTraits) -> UIFont { - guard let descriptor = fontDescriptor.withSymbolicTraits(traits) else { - return self - } - return UIFont(descriptor: descriptor, size: 0) // Size 0 means keep the size as it is - } - - /// Update current font with a given Weight - func vc_withWeight(weight: Weight) -> UIFont { - // Add the font weight to the descriptor - let weightedFontDescriptor = fontDescriptor.addingAttributes([ - UIFontDescriptor.AttributeName.traits: [ - UIFontDescriptor.TraitKey.weight: weight - ] - ]) - return UIFont(descriptor: weightedFontDescriptor, size: 0) - } - - // MARK: - Shortcuts - - var vc_bold: UIFont { - return self.vc_withTraits(.traitBold) - } - - var vc_semiBold: UIFont { - return self.vc_withWeight(weight: .semibold) - } - - var vc_italic: UIFont { - return self.vc_withTraits(.traitItalic) - } -} diff --git a/DesignKit/Info.plist b/DesignKit/Info.plist deleted file mode 100644 index c0701c6d7..000000000 --- a/DesignKit/Info.plist +++ /dev/null @@ -1,22 +0,0 @@ - - - - - CFBundleDevelopmentRegion - $(DEVELOPMENT_LANGUAGE) - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - $(PRODUCT_BUNDLE_PACKAGE_TYPE) - CFBundleShortVersionString - $(MARKETING_VERSION) - CFBundleVersion - $(CURRENT_PROJECT_VERSION) - - diff --git a/DesignKit/Release.xcconfig b/DesignKit/Release.xcconfig deleted file mode 100644 index 11a7288a4..000000000 --- a/DesignKit/Release.xcconfig +++ /dev/null @@ -1,20 +0,0 @@ -// -// Copyright 2021 Vector Creations Ltd -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -// Configuration settings file format documentation can be found at: -// https://help.apple.com/xcode/#/dev745c5c974 - -#include "Common.xcconfig" diff --git a/DesignKit/Source/ColorValues.swift b/DesignKit/Source/ColorValues.swift deleted file mode 100644 index 338d1cfe8..000000000 --- a/DesignKit/Source/ColorValues.swift +++ /dev/null @@ -1,52 +0,0 @@ -// -// Copyright 2021 New Vector Ltd -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -import Foundation -import UIKit - -/** - Struct for holding colour values for a particular theme. - */ -public struct ColorValues: Colors { - - public let accent: UIColor - - public let alert: UIColor - - public let primaryContent: UIColor - - public let secondaryContent: UIColor - - public let tertiaryContent: UIColor - - public let quarterlyContent: UIColor - - public let quinaryContent: UIColor - - public let separator: UIColor - - public let system: UIColor - - public let tile: UIColor - - public let navigation: UIColor - - public let background: UIColor - - public let ems: UIColor - - public let namesAndAvatars: [UIColor] -} diff --git a/DesignKit/Source/Colors.swift b/DesignKit/Source/Colors.swift deleted file mode 100644 index bf3e9abd3..000000000 --- a/DesignKit/Source/Colors.swift +++ /dev/null @@ -1,73 +0,0 @@ -// -// Copyright 2021 New Vector Ltd -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -import Foundation - -/// Colors at https://www.figma.com/file/X4XTH9iS2KGJ2wFKDqkyed/Compound?node-id=1255%3A1104 -public protocol Colors { - - associatedtype ColorType - - /// - Focused/Active states - /// - CTAs - var accent: ColorType { get } - - /// - Error messages - /// - Content requiring user attention - /// - Notification, alerts - var alert: ColorType { get } - - /// - Text - /// - Icons - var primaryContent: ColorType { get } - - /// - Text - /// - Icons - var secondaryContent: ColorType { get } - - /// - Text - /// - Icons - var tertiaryContent: ColorType { get } - - /// - Text - /// - Icons - var quarterlyContent: ColorType { get } - - /// - separating lines and other UI components - var quinaryContent: ColorType { get } - - /// - System-based areas and backgrounds - var system: ColorType { get } - - /// Separating line - var separator: ColorType { get } - - /// Cards, tiles - var tile: ColorType { get } - - /// Top navigation background on iOS - var navigation: ColorType { get } - - /// Background UI color - var background: ColorType { get } - - /// Global color: The EMS brand's purple colour. - var ems: ColorType { get } - - /// - Names in chat timeline - /// - Avatars default states that include first name letter - var namesAndAvatars: [ColorType] { get } -} diff --git a/DesignKit/Source/ColorsSwiftUI.swift b/DesignKit/Source/ColorsSwiftUI.swift deleted file mode 100644 index ea3ca6779..000000000 --- a/DesignKit/Source/ColorsSwiftUI.swift +++ /dev/null @@ -1,69 +0,0 @@ -// -// Copyright 2021 New Vector Ltd -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -import Foundation -import SwiftUI - -/** - Struct for holding colors for use in SwiftUI. - */ -public struct ColorSwiftUI: Colors { - - public let accent: Color - - public let alert: Color - - public let primaryContent: Color - - public let secondaryContent: Color - - public let tertiaryContent: Color - - public let quarterlyContent: Color - - public let quinaryContent: Color - - public let separator: Color - - public var system: Color - - public let tile: Color - - public let navigation: Color - - public let background: Color - - public var ems: Color - - public let namesAndAvatars: [Color] - - init(values: ColorValues) { - accent = Color(values.accent) - alert = Color(values.alert) - primaryContent = Color(values.primaryContent) - secondaryContent = Color(values.secondaryContent) - tertiaryContent = Color(values.tertiaryContent) - quarterlyContent = Color(values.quarterlyContent) - quinaryContent = Color(values.quinaryContent) - separator = Color(values.separator) - system = Color(values.system) - tile = Color(values.tile) - navigation = Color(values.navigation) - background = Color(values.background) - ems = Color(values.ems) - namesAndAvatars = values.namesAndAvatars.map({ Color($0) }) - } -} diff --git a/DesignKit/Source/ColorsUIkit.swift b/DesignKit/Source/ColorsUIkit.swift deleted file mode 100644 index 3add385c3..000000000 --- a/DesignKit/Source/ColorsUIkit.swift +++ /dev/null @@ -1,67 +0,0 @@ -// -// Copyright 2021 New Vector Ltd -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -import Foundation -import UIKit - -/** - ObjC class for holding colors for use in UIKit. - */ -@objcMembers public class ColorsUIKit: NSObject { - - public let accent: UIColor - - public let alert: UIColor - - public let primaryContent: UIColor - - public let secondaryContent: UIColor - - public let tertiaryContent: UIColor - - public let quarterlyContent: UIColor - - public let quinaryContent: UIColor - - public let separator: UIColor - - public let system: UIColor - - public let tile: UIColor - - public let navigation: UIColor - - public let background: UIColor - - public let namesAndAvatars: [UIColor] - - init(values: ColorValues) { - accent = values.accent - alert = values.alert - primaryContent = values.primaryContent - secondaryContent = values.secondaryContent - tertiaryContent = values.tertiaryContent - quarterlyContent = values.quarterlyContent - quinaryContent = values.quinaryContent - separator = values.separator - system = values.system - tile = values.tile - navigation = values.navigation - background = values.background - namesAndAvatars = values.namesAndAvatars - } -} - diff --git a/DesignKit/Source/Fonts.swift b/DesignKit/Source/Fonts.swift deleted file mode 100644 index 1203a2888..000000000 --- a/DesignKit/Source/Fonts.swift +++ /dev/null @@ -1,85 +0,0 @@ -// -// Copyright 2021 New Vector Ltd -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -import UIKit - -/// Describe fonts used in the application. -/// Font names are based on Element typograhy https://www.figma.com/file/X4XTH9iS2KGJ2wFKDqkyed/Compound?node-id=1362%3A0 which is based on Apple font text styles (UIFont.TextStyle): https://developer.apple.com/documentation/uikit/uifonttextstyle -/// Create a custom TextStyle enum (like DesignKit.Fonts.TextStyle) is also a possiblity -public protocol Fonts { - - associatedtype FontType - - /// The font for large titles. - var largeTitle: FontType { get } - - /// `largeTitle` with a Bold weight. - var largeTitleB: FontType { get } - - /// The font for first-level hierarchical headings. - var title1: FontType { get } - - /// `title1` with a Bold weight. - var title1B: FontType { get } - - /// The font for second-level hierarchical headings. - var title2: FontType { get } - - /// `title2` with a Bold weight. - var title2B: FontType { get } - - /// The font for third-level hierarchical headings. - var title3: FontType { get } - - /// `title3` with a Semi Bold weight. - var title3SB: FontType { get } - - /// The font for headings. - var headline: FontType { get } - - /// The font for subheadings. - var subheadline: FontType { get } - - /// The font for body text. - var body: FontType { get } - - /// `body` with a Semi Bold weight. - var bodySB: FontType { get } - - /// The font for callouts. - var callout: FontType { get } - - /// `callout` with a Semi Bold weight. - var calloutSB: FontType { get } - - /// The font for footnotes. - var footnote: FontType { get } - - /// `footnote` with a Semi Bold weight. - var footnoteSB: FontType { get } - - /// The font for standard captions. - var caption1: FontType { get } - - /// `caption1` with a Semi Bold weight. - var caption1SB: FontType { get } - - /// The font for alternate captions. - var caption2: FontType { get } - - /// `caption2` with a Semi Bold weight. - var caption2SB: FontType { get } -} diff --git a/DesignKit/Source/FontsSwiftUI.swift b/DesignKit/Source/FontsSwiftUI.swift deleted file mode 100644 index 83b4e820b..000000000 --- a/DesignKit/Source/FontsSwiftUI.swift +++ /dev/null @@ -1,91 +0,0 @@ -// -// Copyright 2021 New Vector Ltd -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -import Foundation -import SwiftUI - -/** - Struct for holding fonts for use in SwiftUI. - */ -public struct FontSwiftUI: Fonts { - - public let uiFonts: FontsUIKit - - public var largeTitle: Font - - public var largeTitleB: Font - - public var title1: Font - - public var title1B: Font - - public var title2: Font - - public var title2B: Font - - public var title3: Font - - public var title3SB: Font - - public var headline: Font - - public var subheadline: Font - - public var body: Font - - public var bodySB: Font - - public var callout: Font - - public var calloutSB: Font - - public var footnote: Font - - public var footnoteSB: Font - - public var caption1: Font - - public var caption1SB: Font - - public var caption2: Font - - public var caption2SB: Font - - public init(values: ElementFonts) { - self.uiFonts = FontsUIKit(values: values) - - self.largeTitle = values.largeTitle.font - self.largeTitleB = values.largeTitleB.font - self.title1 = values.title1.font - self.title1B = values.title1B.font - self.title2 = values.title2.font - self.title2B = values.title2B.font - self.title3 = values.title3.font - self.title3SB = values.title3SB.font - self.headline = values.headline.font - self.subheadline = values.subheadline.font - self.body = values.body.font - self.bodySB = values.bodySB.font - self.callout = values.callout.font - self.calloutSB = values.calloutSB.font - self.footnote = values.footnote.font - self.footnoteSB = values.footnoteSB.font - self.caption1 = values.caption1.font - self.caption1SB = values.caption1SB.font - self.caption2 = values.caption2.font - self.caption2SB = values.caption2SB.font - } -} diff --git a/DesignKit/Source/FontsUIkit.swift b/DesignKit/Source/FontsUIkit.swift deleted file mode 100644 index ec65cdaa6..000000000 --- a/DesignKit/Source/FontsUIkit.swift +++ /dev/null @@ -1,87 +0,0 @@ -// -// Copyright 2021 New Vector Ltd -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -import Foundation -import UIKit - -/** - ObjC class for holding fonts for use in UIKit. - */ -@objcMembers public class FontsUIKit: NSObject, Fonts { - - public var largeTitle: UIFont - - public var largeTitleB: UIFont - - public var title1: UIFont - - public var title1B: UIFont - - public var title2: UIFont - - public var title2B: UIFont - - public var title3: UIFont - - public var title3SB: UIFont - - public var headline: UIFont - - public var subheadline: UIFont - - public var body: UIFont - - public var bodySB: UIFont - - public var callout: UIFont - - public var calloutSB: UIFont - - public var footnote: UIFont - - public var footnoteSB: UIFont - - public var caption1: UIFont - - public var caption1SB: UIFont - - public var caption2: UIFont - - public var caption2SB: UIFont - - public init(values: ElementFonts) { - self.largeTitle = values.largeTitle.uiFont - self.largeTitleB = values.largeTitleB.uiFont - self.title1 = values.title1.uiFont - self.title1B = values.title1B.uiFont - self.title2 = values.title2.uiFont - self.title2B = values.title2B.uiFont - self.title3 = values.title3.uiFont - self.title3SB = values.title3SB.uiFont - self.headline = values.headline.uiFont - self.subheadline = values.subheadline.uiFont - self.body = values.body.uiFont - self.bodySB = values.bodySB.uiFont - self.callout = values.callout.uiFont - self.calloutSB = values.calloutSB.uiFont - self.footnote = values.footnote.uiFont - self.footnoteSB = values.footnoteSB.uiFont - self.caption1 = values.caption1.uiFont - self.caption1SB = values.caption1SB.uiFont - self.caption2 = values.caption2.uiFont - self.caption2SB = values.caption2SB.uiFont - } -} diff --git a/DesignKit/Variants/Colors/Dark/DarkColors.swift b/DesignKit/Variants/Colors/Dark/DarkColors.swift deleted file mode 100644 index 88bd12ff3..000000000 --- a/DesignKit/Variants/Colors/Dark/DarkColors.swift +++ /dev/null @@ -1,51 +0,0 @@ -// -// Copyright 2021 New Vector Ltd -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -import Foundation -import UIKit -import SwiftUI - -/// Dark theme colors. -public class DarkColors { - private static let values = ColorValues( - accent: UIColor(rgb:0x0DBD8B), - alert: UIColor(rgb:0xFF4B55), - primaryContent: UIColor(rgb:0xFFFFFF), - secondaryContent: UIColor(rgb:0xA9B2BC), - tertiaryContent: UIColor(rgb:0x8E99A4), - quarterlyContent: UIColor(rgb:0x6F7882), - quinaryContent: UIColor(rgb:0x394049), - separator: UIColor(rgb:0x21262C), - system: UIColor(rgb:0x21262C), - tile: UIColor(rgb:0x394049), - navigation: UIColor(rgb:0x21262C), - background: UIColor(rgb:0x15191E), - ems: UIColor(rgb: 0x7E69FF), - namesAndAvatars: [ - UIColor(rgb:0x368BD6), - UIColor(rgb:0xAC3BA8), - UIColor(rgb:0x03B381), - UIColor(rgb:0xE64F7A), - UIColor(rgb:0xFF812D), - UIColor(rgb:0x2DC2C5), - UIColor(rgb:0x5C56F5), - UIColor(rgb:0x74D12C) - ] - ) - - public static var uiKit = ColorsUIKit(values: values) - public static var swiftUI = ColorSwiftUI(values: values) -} diff --git a/DesignKit/Variants/Colors/Light/LightColors.swift b/DesignKit/Variants/Colors/Light/LightColors.swift deleted file mode 100644 index 93cb3eadb..000000000 --- a/DesignKit/Variants/Colors/Light/LightColors.swift +++ /dev/null @@ -1,57 +0,0 @@ -// -// Copyright 2021 New Vector Ltd -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -import Foundation -import UIKit -import SwiftUI - - -/// Light theme colors. -public class LightColors { - private static let values = ColorValues( - accent: UIColor(rgb:0x0DBD8B), - alert: UIColor(rgb:0xFF4B55), - primaryContent: UIColor(rgb:0x17191C), - secondaryContent: UIColor(rgb:0x737D8C), - tertiaryContent: UIColor(rgb:0x8D97A5), - quarterlyContent: UIColor(rgb:0xC1C6CD), - quinaryContent: UIColor(rgb:0xE3E8F0), - separator: UIColor(rgb:0xE3E8F0), - system: UIColor(rgb:0xF4F6FA), - tile: UIColor(rgb:0xF3F8FD), - navigation: UIColor(rgb:0xF4F6FA), - background: UIColor(rgb:0xFFFFFF), - ems: UIColor(rgb: 0x7E69FF), - namesAndAvatars: [ - UIColor(rgb:0x368BD6), - UIColor(rgb:0xAC3BA8), - UIColor(rgb:0x03B381), - UIColor(rgb:0xE64F7A), - UIColor(rgb:0xFF812D), - UIColor(rgb:0x2DC2C5), - UIColor(rgb:0x5C56F5), - UIColor(rgb:0x74D12C) - ] - ) - - public static var uiKit = ColorsUIKit(values: values) - public static var swiftUI = ColorSwiftUI(values: values) -} - - - - - diff --git a/DesignKit/Variants/Fonts/ElementFonts.swift b/DesignKit/Variants/Fonts/ElementFonts.swift deleted file mode 100644 index e0a612f85..000000000 --- a/DesignKit/Variants/Fonts/ElementFonts.swift +++ /dev/null @@ -1,150 +0,0 @@ -// -// Copyright 2021 New Vector Ltd -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -import SwiftUI - -/// Fonts at https://www.figma.com/file/X4XTH9iS2KGJ2wFKDqkyed/Compound?node-id=1362%3A0 -@objcMembers -public class ElementFonts { - - // MARK: - Types - - /// A wrapper to provide both a `UIFont` and a SwiftUI `Font` in the same type. - /// The need for this comes from `Font` not adapting for dynamic type until the app - /// is restarted (or working at all in Xcode Previews) when initialised from a `UIFont` - /// (even if that font was created with the appropriate metrics). - public struct SharedFont { - public let uiFont: UIFont - public let font: Font - } - - // MARK: - Setup - - public init() { - } - - // MARK: - Private - - /// Returns an instance of the font associated with the text style and scaled appropriately for the content size category defined in the trait collection. - /// Keep this method private method at the moment and create a DesignKit.Fonts.TextStyle if needed. - fileprivate func font(forTextStyle textStyle: UIFont.TextStyle, compatibleWith traitCollection: UITraitCollection? = nil) -> UIFont { - return UIFont.preferredFont(forTextStyle: textStyle, compatibleWith: traitCollection) - } -} - -// MARK: - Fonts protocol -extension ElementFonts: Fonts { - - public var largeTitle: SharedFont { - let uiFont = self.font(forTextStyle: .largeTitle) - return SharedFont(uiFont: uiFont, font: .largeTitle) - } - - public var largeTitleB: SharedFont { - let uiFont = self.largeTitle.uiFont.vc_bold - return SharedFont(uiFont: uiFont, font: .largeTitle.bold()) - } - - public var title1: SharedFont { - let uiFont = self.font(forTextStyle: .title1) - return SharedFont(uiFont: uiFont, font: .title) - } - - public var title1B: SharedFont { - let uiFont = self.title1.uiFont.vc_bold - return SharedFont(uiFont: uiFont, font: .title.bold()) - } - - public var title2: SharedFont { - let uiFont = self.font(forTextStyle: .title2) - return SharedFont(uiFont: uiFont, font: .title2) - } - - public var title2B: SharedFont { - let uiFont = self.title2.uiFont.vc_bold - return SharedFont(uiFont: uiFont, font: .title2.bold()) - } - - public var title3: SharedFont { - let uiFont = self.font(forTextStyle: .title3) - return SharedFont(uiFont: uiFont, font: .title3) - } - - public var title3SB: SharedFont { - let uiFont = self.title3.uiFont.vc_semiBold - return SharedFont(uiFont: uiFont, font: .title3.weight(.semibold)) - } - - public var headline: SharedFont { - let uiFont = self.font(forTextStyle: .headline) - return SharedFont(uiFont: uiFont, font: .headline) - } - - public var subheadline: SharedFont { - let uiFont = self.font(forTextStyle: .subheadline) - return SharedFont(uiFont: uiFont, font: .subheadline) - } - - public var body: SharedFont { - let uiFont = self.font(forTextStyle: .body) - return SharedFont(uiFont: uiFont, font: .body) - } - - public var bodySB: SharedFont { - let uiFont = self.body.uiFont.vc_semiBold - return SharedFont(uiFont: uiFont, font: .body.weight(.semibold)) - } - - public var callout: SharedFont { - let uiFont = self.font(forTextStyle: .callout) - return SharedFont(uiFont: uiFont, font: .callout) - } - - public var calloutSB: SharedFont { - let uiFont = self.callout.uiFont.vc_semiBold - return SharedFont(uiFont: uiFont, font: .callout.weight(.semibold)) - } - - public var footnote: SharedFont { - let uiFont = self.font(forTextStyle: .footnote) - return SharedFont(uiFont: uiFont, font: .footnote) - } - - public var footnoteSB: SharedFont { - let uiFont = self.footnote.uiFont.vc_semiBold - return SharedFont(uiFont: uiFont, font: .footnote.weight(.semibold)) - } - - public var caption1: SharedFont { - let uiFont = self.font(forTextStyle: .caption1) - return SharedFont(uiFont: uiFont, font: .caption) - } - - public var caption1SB: SharedFont { - let uiFont = self.caption1.uiFont.vc_semiBold - return SharedFont(uiFont: uiFont, font: .caption.weight(.semibold)) - } - - public var caption2: SharedFont { - let uiFont = self.font(forTextStyle: .caption2) - return SharedFont(uiFont: uiFont, font: .caption2) - } - - public var caption2SB: SharedFont { - let uiFont = self.caption2.uiFont.vc_semiBold - return SharedFont(uiFont: uiFont, font: .caption2.weight(.semibold)) - } -} diff --git a/DesignKit/target.yml b/DesignKit/target.yml deleted file mode 100644 index e10f76f12..000000000 --- a/DesignKit/target.yml +++ /dev/null @@ -1,33 +0,0 @@ -name: DesignKit - -schemes: - DesignKit: - analyze: - config: Debug - archive: - config: Release - build: - targets: - DesignKit: - - running - - profiling - - analyzing - - archiving - profile: - config: Release - run: - config: Debug - disableMainThreadChecker: true - -targets: - DesignKit: - type: framework - platform: iOS - - configFiles: - Debug: Debug.xcconfig - Release: Release.xcconfig - - sources: - - path: . - - path: ../Riot/Categories/UIColor.swift diff --git a/DesignKit/Source/ThemeV2.swift b/Riot/Managers/Theme/ThemeV2.swift similarity index 58% rename from DesignKit/Source/ThemeV2.swift rename to Riot/Managers/Theme/ThemeV2.swift index dedc4d6df..1dff3cf19 100644 --- a/DesignKit/Source/ThemeV2.swift +++ b/Riot/Managers/Theme/ThemeV2.swift @@ -14,29 +14,38 @@ // limitations under the License. // -import Foundation import UIKit +import DesignKit +import DesignTokens /// Theme v2. May be named again as `Theme` when the migration completed. @objc public protocol ThemeV2 { /// Colors object - var colors: ColorsUIKit { get } + var colors: ElementUIColors { get } /// Fonts object - var fonts: FontsUIKit { get } + var fonts: ElementUIFonts { get } /// may contain more design components in future, like icons, audio files etc. } -/// Theme v2 for SwiftUI. -public protocol ThemeSwiftUIType { - - /// Colors object - var colors: ColorSwiftUI { get } - - /// Fonts object - var fonts: FontSwiftUI { get } - - /// may contain more design components in future, like icons, audio files etc. +#warning("Temporary missing colors") +public extension ElementUIColors { + var quarterlyContent: UIColor { quaternaryContent } + var navigation: UIColor { system } + var tile: UIColor { system } + var separator: UIColor { system } + var namesAndAvatars: [UIColor] { + [ + globalAzure, + globalGrape, + globalVerde, + globalPolly, + globalMelon, + globalAqua, + globalPrune, + globalKiwi + ] + } } diff --git a/Riot/Managers/Theme/Themes/DarkTheme.swift b/Riot/Managers/Theme/Themes/DarkTheme.swift index 84b0239ce..4facd084c 100644 --- a/Riot/Managers/Theme/Themes/DarkTheme.swift +++ b/Riot/Managers/Theme/Themes/DarkTheme.swift @@ -181,9 +181,9 @@ class DarkTheme: NSObject, Theme { button.setTitleColor(self.tintColor, for: .normal) } - /// MARK: - Theme v2 - var colors: ColorsUIKit = DarkColors.uiKit + // MARK: - Theme v2 + var colors = UIColor.element - var fonts: FontsUIKit = FontsUIKit(values: ElementFonts()) + var fonts = UIFont.element } diff --git a/Riot/Managers/Theme/Themes/DefaultTheme.swift b/Riot/Managers/Theme/Themes/DefaultTheme.swift index a07de1e8f..6145b76a3 100644 --- a/Riot/Managers/Theme/Themes/DefaultTheme.swift +++ b/Riot/Managers/Theme/Themes/DefaultTheme.swift @@ -14,7 +14,6 @@ limitations under the License. */ -import Foundation import UIKit import DesignKit @@ -186,8 +185,8 @@ class DefaultTheme: NSObject, Theme { button.setTitleColor(self.tintColor, for: .normal) } - /// MARK: - Theme v2 - var colors: ColorsUIKit = LightColors.uiKit + // MARK: - Theme v2 + var colors = UIColor.element - var fonts: FontsUIKit = FontsUIKit(values: ElementFonts()) + var fonts = UIFont.element } diff --git a/Riot/Modules/Settings/Security/ManageSession/ManageSessionViewController.m b/Riot/Modules/Settings/Security/ManageSession/ManageSessionViewController.m index d06b4a577..dce0e8a62 100644 --- a/Riot/Modules/Settings/Security/ManageSession/ManageSessionViewController.m +++ b/Riot/Modules/Settings/Security/ManageSession/ManageSessionViewController.m @@ -493,7 +493,7 @@ enum { // Customize label style UITableViewHeaderFooterView *tableViewHeaderFooterView = (UITableViewHeaderFooterView*)view; tableViewHeaderFooterView.textLabel.textColor = ThemeService.shared.theme.colors.secondaryContent; - tableViewHeaderFooterView.textLabel.font = ThemeService.shared.theme.fonts.footnote; + tableViewHeaderFooterView.textLabel.font = [UIFont preferredFontForTextStyle:UIFontTextStyleFootnote]; } } diff --git a/Riot/Modules/Settings/Security/SecurityViewController.m b/Riot/Modules/Settings/Security/SecurityViewController.m index 6d5c7c10b..9f25ba711 100644 --- a/Riot/Modules/Settings/Security/SecurityViewController.m +++ b/Riot/Modules/Settings/Security/SecurityViewController.m @@ -1297,7 +1297,7 @@ TableViewSectionsDelegate> // Customize label style UITableViewHeaderFooterView *tableViewHeaderFooterView = (UITableViewHeaderFooterView*)view; tableViewHeaderFooterView.textLabel.textColor = ThemeService.shared.theme.colors.secondaryContent; - tableViewHeaderFooterView.textLabel.font = ThemeService.shared.theme.fonts.footnote; + tableViewHeaderFooterView.textLabel.font = [UIFont preferredFontForTextStyle:UIFontTextStyleFootnote]; } } diff --git a/Riot/Modules/Settings/SettingsViewController.m b/Riot/Modules/Settings/SettingsViewController.m index b0d5ffc15..e296c9263 100644 --- a/Riot/Modules/Settings/SettingsViewController.m +++ b/Riot/Modules/Settings/SettingsViewController.m @@ -2634,7 +2634,7 @@ ChangePasswordCoordinatorBridgePresenterDelegate> // Customize label style UITableViewHeaderFooterView *tableViewHeaderFooterView = (UITableViewHeaderFooterView*)view; tableViewHeaderFooterView.textLabel.textColor = ThemeService.shared.theme.colors.secondaryContent; - tableViewHeaderFooterView.textLabel.font = ThemeService.shared.theme.fonts.footnote; + tableViewHeaderFooterView.textLabel.font = [UIFont preferredFontForTextStyle:UIFontTextStyleFootnote]; } } diff --git a/Riot/target.yml b/Riot/target.yml index ec016f09a..5a0505ad7 100644 --- a/Riot/target.yml +++ b/Riot/target.yml @@ -34,8 +34,8 @@ targets: - target: RiotShareExtension - target: SiriIntents - target: RiotNSE - - target: DesignKit - target: CommonKit + - package: DesignKit - package: Mapbox - package: OrderedCollections diff --git a/RiotShareExtension/target.yml b/RiotShareExtension/target.yml index bf2a032f5..c50705aa0 100644 --- a/RiotShareExtension/target.yml +++ b/RiotShareExtension/target.yml @@ -30,6 +30,8 @@ targets: RiotShareExtension: platform: iOS type: app-extension + dependencies: + - package: DesignKit configFiles: Debug: Debug.xcconfig diff --git a/DesignKit/Source/AvatarSize.swift b/RiotSwiftUI/Modules/Common/Avatar/Model/AvatarSize.swift similarity index 95% rename from DesignKit/Source/AvatarSize.swift rename to RiotSwiftUI/Modules/Common/Avatar/Model/AvatarSize.swift index bac46e6f3..09daff1d2 100644 --- a/DesignKit/Source/AvatarSize.swift +++ b/RiotSwiftUI/Modules/Common/Avatar/Model/AvatarSize.swift @@ -17,6 +17,8 @@ import Foundation import UIKit +// TODO: Move into element-design-tokens repo. + // Figma Avatar Sizes: https://www.figma.com/file/X4XTH9iS2KGJ2wFKDqkyed/Compound?node-id=1258%3A19678 public enum AvatarSize: Int { case xxSmall = 16 diff --git a/RiotSwiftUI/Modules/Common/Theme/ThemeSwiftUI.swift b/RiotSwiftUI/Modules/Common/Theme/ThemeSwiftUI.swift index f5a15424f..e0ff5bdc1 100644 --- a/RiotSwiftUI/Modules/Common/Theme/ThemeSwiftUI.swift +++ b/RiotSwiftUI/Modules/Common/Theme/ThemeSwiftUI.swift @@ -14,10 +14,43 @@ // limitations under the License. // -import Foundation +import SwiftUI import DesignKit +import DesignTokens protocol ThemeSwiftUI: ThemeSwiftUIType { var identifier: ThemeIdentifier { get } var isDark: Bool { get } } + +/// Theme v2 for SwiftUI. +@available(iOS 14.0, *) +public protocol ThemeSwiftUIType { + + /// Colors object + var colors: ElementColors { get } + + /// Fonts object + var fonts: ElementFonts { get } + + /// may contain more design components in future, like icons, audio files etc. +} + +#warning("Temporary missing colors") +public extension ElementColors { + var quarterlyContent: Color { quaternaryContent } + var navigation: Color { system } + var tile: Color { system } + var namesAndAvatars: [Color] { + [ + globalAzure, + globalGrape, + globalVerde, + globalPolly, + globalMelon, + globalAqua, + globalPrune, + globalKiwi + ] + } +} diff --git a/RiotSwiftUI/Modules/Common/Theme/Themes/DarkThemeSwiftUI.swift b/RiotSwiftUI/Modules/Common/Theme/Themes/DarkThemeSwiftUI.swift index 0e9250070..a572a4694 100644 --- a/RiotSwiftUI/Modules/Common/Theme/Themes/DarkThemeSwiftUI.swift +++ b/RiotSwiftUI/Modules/Common/Theme/Themes/DarkThemeSwiftUI.swift @@ -14,12 +14,12 @@ // limitations under the License. // -import Foundation +import SwiftUI import DesignKit struct DarkThemeSwiftUI: ThemeSwiftUI { var identifier: ThemeIdentifier = .dark let isDark: Bool = true - var colors: ColorSwiftUI = DarkColors.swiftUI - var fonts: FontSwiftUI = FontSwiftUI(values: ElementFonts()) + var colors = Color.element + var fonts = Font.element } diff --git a/RiotSwiftUI/Modules/Common/Theme/Themes/DefaultThemeSwiftUI.swift b/RiotSwiftUI/Modules/Common/Theme/Themes/DefaultThemeSwiftUI.swift index 85ba4d810..bfc2e87c0 100644 --- a/RiotSwiftUI/Modules/Common/Theme/Themes/DefaultThemeSwiftUI.swift +++ b/RiotSwiftUI/Modules/Common/Theme/Themes/DefaultThemeSwiftUI.swift @@ -14,12 +14,12 @@ // limitations under the License. // -import Foundation +import SwiftUI import DesignKit struct DefaultThemeSwiftUI: ThemeSwiftUI { var identifier: ThemeIdentifier = .light let isDark: Bool = false - var colors: ColorSwiftUI = LightColors.swiftUI - var fonts: FontSwiftUI = FontSwiftUI(values: ElementFonts()) + var colors = Color.element + var fonts = Font.element } diff --git a/RiotSwiftUI/Modules/Common/Util/MultilineTextField.swift b/RiotSwiftUI/Modules/Common/Util/MultilineTextField.swift index 5e20f11b0..c447d7c7b 100644 --- a/RiotSwiftUI/Modules/Common/Util/MultilineTextField.swift +++ b/RiotSwiftUI/Modules/Common/Util/MultilineTextField.swift @@ -75,7 +75,7 @@ struct MultilineTextField: View { .overlay(rect.stroke(borderColor, lineWidth: borderWidth)) .introspectTextView { textView in textView.textColor = UIColor(textColor) - textView.font = theme.fonts.uiFonts.callout + textView.font = .element.callout } } diff --git a/RiotSwiftUI/target.yml b/RiotSwiftUI/target.yml index 2fc955cb9..3ceb278ab 100644 --- a/RiotSwiftUI/target.yml +++ b/RiotSwiftUI/target.yml @@ -30,7 +30,7 @@ targets: type: application platform: iOS dependencies: - - target: DesignKit + - package: DesignKit - package: Mapbox sources: - path: . diff --git a/project.yml b/project.yml index 84a0cb73f..e06807c8d 100644 --- a/project.yml +++ b/project.yml @@ -32,7 +32,6 @@ include: - path: RiotShareExtension/target.yml - path: SiriIntents/target.yml - path: RiotNSE/target.yml - - path: DesignKit/target.yml - path: RiotSwiftUI/target.yml - path: RiotSwiftUI/targetUnitTests.yml - path: RiotSwiftUI/targetUITests.yml @@ -40,6 +39,9 @@ include: - path: CommonKit/targetUnitTests.yml packages: + DesignKit: + url: https://github.com/vector-im/element-x-ios + branch: doug/designkit Mapbox: url: https://github.com/maplibre/maplibre-gl-native-distribution minVersion: 5.12.2