-
Notifications
You must be signed in to change notification settings - Fork 493
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This reverts commit 2398c15.
- Loading branch information
Showing
55 changed files
with
1,051 additions
and
191 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// | ||
// 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 |
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,20 @@ | ||
// | ||
// 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" |
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 @@ | ||
// | ||
// 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/Foundation.h> | ||
|
||
//! 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 <DesignKit/PublicHeader.h> | ||
|
||
|
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,55 @@ | ||
// | ||
// 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) | ||
} | ||
} |
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,22 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>CFBundleDevelopmentRegion</key> | ||
<string>$(DEVELOPMENT_LANGUAGE)</string> | ||
<key>CFBundleExecutable</key> | ||
<string>$(EXECUTABLE_NAME)</string> | ||
<key>CFBundleIdentifier</key> | ||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> | ||
<key>CFBundleInfoDictionaryVersion</key> | ||
<string>6.0</string> | ||
<key>CFBundleName</key> | ||
<string>$(PRODUCT_NAME)</string> | ||
<key>CFBundlePackageType</key> | ||
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string> | ||
<key>CFBundleShortVersionString</key> | ||
<string>$(MARKETING_VERSION)</string> | ||
<key>CFBundleVersion</key> | ||
<string>$(CURRENT_PROJECT_VERSION)</string> | ||
</dict> | ||
</plist> |
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,20 @@ | ||
// | ||
// 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" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// | ||
// 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] | ||
} |
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,73 @@ | ||
// | ||
// 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 } | ||
} |
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,69 @@ | ||
// | ||
// 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) }) | ||
} | ||
} |
Oops, something went wrong.