first commit

This commit is contained in:
2026-03-10 16:18:05 +00:00
commit 11f9c069b5
31635 changed files with 3187747 additions and 0 deletions

29
node_modules/expo-symbols/ios/ExpoSymbols.podspec generated vendored Normal file
View File

@@ -0,0 +1,29 @@
require 'json'
package = JSON.parse(File.read(File.join(__dir__, '..', 'package.json')))
Pod::Spec.new do |s|
s.name = 'ExpoSymbols'
s.version = package['version']
s.summary = package['description']
s.description = package['description']
s.license = package['license']
s.author = package['author']
s.homepage = package['homepage']
s.platforms = {
:ios => '15.1',
:tvos => '15.1'
}
s.swift_version = '5.9'
s.source = { git: 'https://github.com/expo/expo.git' }
s.static_framework = true
s.dependency 'ExpoModulesCore'
# Swift/Objective-C compatibility
s.pod_target_xcconfig = {
'DEFINES_MODULE' => 'YES',
}
s.source_files = "**/*.{h,m,swift}"
end

58
node_modules/expo-symbols/ios/SymbolEffects.swift generated vendored Normal file
View File

@@ -0,0 +1,58 @@
@available(iOS 17.0, tvOS 17.0, *)
internal protocol EffectAdding {
func add(to view: UIImageView, with options: SymbolEffectOptions)
}
@available(iOS 17.0, tvOS 17.0, *)
internal struct BounceEffect: EffectAdding {
private let effect: BounceSymbolEffect = .bounce
let wholeSymbol: Bool?
let direction: AnimationDirection?
func add(to view: UIImageView, with options: SymbolEffectOptions) {
var finalEffect = effect
if wholeSymbol ?? false {
finalEffect = finalEffect.wholeSymbol
}
if let direction {
finalEffect = direction == .up ? finalEffect.up : finalEffect.down
}
view.addSymbolEffect(finalEffect, options: options, animated: true)
}
}
@available(iOS 17.0, tvOS 17.0, *)
internal struct PulseEffect: EffectAdding {
private let effect: PulseSymbolEffect = .pulse
let wholeSymbol: Bool?
func add(to view: UIImageView, with options: SymbolEffectOptions) {
var finalEffect = effect
if wholeSymbol ?? false {
finalEffect = finalEffect.wholeSymbol
}
view.addSymbolEffect(finalEffect, options: options, animated: true)
}
}
@available(iOS 17.0, tvOS 17.0, *)
internal struct ScaleEffect: EffectAdding {
private let effect: ScaleSymbolEffect = .scale
let wholeSymbol: Bool?
let direction: AnimationDirection?
func add(to view: UIImageView, with options: SymbolEffectOptions) {
var finalEffect = effect
if wholeSymbol ?? false {
finalEffect = finalEffect.wholeSymbol
}
if let direction {
finalEffect = direction == .up ? finalEffect.up : finalEffect.down
}
view.addSymbolEffect(finalEffect, options: options, animated: true)
}
}

49
node_modules/expo-symbols/ios/SymbolModule.swift generated vendored Normal file
View File

@@ -0,0 +1,49 @@
import ExpoModulesCore
public class SymbolModule: Module {
public func definition() -> ModuleDefinition {
Name("SymbolModule")
View(SymbolView.self) {
Prop("name") { (view, name: String) in
view.name = name
}
Prop("type") { (view, type: SymbolType?) in
view.symbolType = type ?? .monochrome
}
Prop("scale") { (view, scale: SymbolScale?) in
view.scale = scale?.imageSymbolScale() ?? .unspecified
}
Prop("tintColor") { (view, color: UIColor?) in
view.tint = color
}
Prop("animated") { (view, animated: Bool?) in
view.animated = animated ?? false
}
Prop("weight") { (view, weight: SymbolWeight?) in
view.weight = weight?.imageSymbolWeight() ?? .regular
}
Prop("colors") { (view, color: [UIColor]?) in
view.palette = color ?? []
}
Prop("resizeMode") { (view, resizeMode: SymbolContentMode?) in
view.imageContentMode = resizeMode?.toContentMode() ?? .scaleAspectFit
}
Prop("animationSpec") { (view, spec: AnimationSpec?) in
view.animationSpec = spec
}
OnViewDidUpdateProps { view in
view.reloadSymbol()
}
}
}
}

193
node_modules/expo-symbols/ios/SymbolRecords.swift generated vendored Normal file
View File

@@ -0,0 +1,193 @@
import ExpoModulesCore
enum SymbolScale: String, Enumerable {
case `default`
case unspecified
case small
case medium
case large
func imageSymbolScale() -> UIImage.SymbolScale {
switch self {
case .default:
return .default
case .small:
return .small
case .medium:
return .medium
case .large:
return .large
case .unspecified:
return .unspecified
}
}
}
enum SymbolWeight: String, Enumerable {
case unspecified
case ultraLight
case thin
case light
case regular
case medium
case semibold
case bold
case heavy
case black
func imageSymbolWeight() -> UIImage.SymbolWeight {
switch self {
case .unspecified:
return .unspecified
case .ultraLight:
return .ultraLight
case .thin:
return .thin
case .light:
return .light
case .regular:
return .regular
case .medium:
return .medium
case .semibold:
return .semibold
case .bold:
return .bold
case .heavy:
return .heavy
case .black:
return .black
}
}
}
enum SymbolContentMode: String, Enumerable {
case scaleToFill
case scaleAspectFit
case scaleAspectFill
case redraw
case center
case top
case bottom
case left
case right
case topLeft
case topRight
case bottomLeft
case bottomRight
func toContentMode() -> UIView.ContentMode {
switch self {
case .scaleToFill:
return .scaleToFill
case .scaleAspectFit:
return .scaleAspectFit
case .scaleAspectFill:
return .scaleAspectFill
case .redraw:
return .redraw
case .center:
return .center
case .top:
return .top
case .bottom:
return .bottom
case .left:
return .left
case .right:
return .right
case .topLeft:
return .topLeft
case .topRight:
return .topRight
case .bottomLeft:
return .bottomLeft
case .bottomRight:
return .bottomRight
}
}
}
enum SymbolType: String, Enumerable {
case monochrome
case hierarchical
case palette
case multicolor
}
enum AnimationDirection: String, Enumerable {
case up
case down
}
enum AnimationType: String, Enumerable {
case bounce
case pulse
case scale
}
internal struct AnimationSpec: Record {
@Field var effect: AnimationEffect?
@Field var repeating: Bool?
@Field var repeatCount: Int?
@Field var speed: Double?
@Field var variableAnimationSpec: VariableColorSpec?
}
internal struct AnimationEffect: Record {
@Field var type: AnimationType = .bounce
@Field var wholeSymbol: Bool?
@Field var direction: AnimationDirection?
@available(iOS 17.0, tvOS 17.0, *)
func toEffect() -> EffectAdding {
switch type {
case .bounce:
return BounceEffect(wholeSymbol: wholeSymbol, direction: direction)
case .pulse:
return PulseEffect(wholeSymbol: wholeSymbol)
case .scale:
return ScaleEffect(wholeSymbol: wholeSymbol, direction: direction)
}
}
}
internal struct VariableColorSpec: Record {
@Field var reversing: Bool?
@Field var nonReversing: Bool?
@Field var cumulative: Bool?
@Field var iterative: Bool?
@Field var hideInactiveLayers: Bool?
@Field var dimInactiveLayers: Bool?
@available(iOS 17.0, tvOS 17.0, *)
func toVariableEffect() -> VariableColorSymbolEffect {
var effect: VariableColorSymbolEffect = .variableColor
if cumulative != nil {
effect = effect.cumulative
}
if iterative != nil {
effect = effect.iterative
}
if hideInactiveLayers != nil {
effect = effect.hideInactiveLayers
}
if dimInactiveLayers != nil {
effect = effect.dimInactiveLayers
}
if reversing != nil {
effect = effect.reversing
}
if nonReversing != nil {
effect = effect.nonReversing
}
return effect
}
}

98
node_modules/expo-symbols/ios/SymbolView.swift generated vendored Normal file
View File

@@ -0,0 +1,98 @@
import ExpoModulesCore
class SymbolView: ExpoView {
let imageView = UIImageView()
// MARK: Properties
var name: String = ""
var weight: UIImage.SymbolWeight = .unspecified
var scale: UIImage.SymbolScale = .default
var imageContentMode: UIView.ContentMode = .scaleToFill
var symbolType: SymbolType = .monochrome
var tint: UIColor?
var animationSpec: AnimationSpec?
var palette = [UIColor]()
var animated = false
required init(appContext: AppContext? = nil) {
super.init(appContext: appContext)
addSubview(imageView)
}
override func layoutSubviews() {
imageView.frame = bounds
}
func reloadSymbol() {
guard let image = UIImage(systemName: name) else {
return
}
imageView.image = image
imageView.contentMode = imageContentMode
imageView.preferredSymbolConfiguration = getSymbolConfig()
if let tint {
if symbolType != .hierarchical {
imageView.image = image.withTintColor(tint, renderingMode: .alwaysOriginal)
}
}
// Effects need to be added last
if #available(iOS 17.0, tvOS 17.0, *) {
imageView.removeAllSymbolEffects()
if animated {
addSymbolEffects()
}
}
}
@available(iOS 17.0, tvOS 17.0, *)
private func addSymbolEffects() {
if let animationSpec {
let repeating = animationSpec.repeating ?? false
var options: SymbolEffectOptions = repeating ? .repeating : .nonRepeating
if let repeatCount = animationSpec.repeatCount {
options = options.repeat(abs(repeatCount))
}
if let speed = animationSpec.speed {
options = options.speed(speed)
}
if let variableAnimationSpec = animationSpec.variableAnimationSpec {
imageView.addSymbolEffect(variableAnimationSpec.toVariableEffect())
return
}
if let animation = animationSpec.effect {
animation.toEffect().add(to: imageView, with: options)
}
}
}
private func getSymbolConfig() -> UIImage.SymbolConfiguration {
#if os(tvOS)
var config = UIImage.SymbolConfiguration(pointSize: 18.0, weight: weight, scale: scale)
#else
var config = UIImage.SymbolConfiguration(pointSize: UIFont.systemFontSize, weight: weight, scale: scale)
#endif
switch symbolType {
case .monochrome:
if #available(iOS 16.0, tvOS 16.0, *) {
config = config.applying(UIImage.SymbolConfiguration.preferringMonochrome())
}
case .hierarchical:
config = config.applying(UIImage.SymbolConfiguration(hierarchicalColor: tint ?? .systemBlue))
case .palette:
if palette.count > 1 {
config = config.applying(UIImage.SymbolConfiguration(paletteColors: palette))
}
case .multicolor:
config = config.applying(UIImage.SymbolConfiguration.preferringMulticolor())
}
return config
}
}