restores Helder in all its glory

This commit is contained in:
2026-09-28 11:34:49 +02:00
parent c2b38b853c
commit 1d29d0952d
280 changed files with 29205 additions and 7 deletions
+47
View File
@@ -0,0 +1,47 @@
import SwiftUI
/// The stepped on/off blink of the caret, terminal cursor and wordmark period: no fade.
struct BlinkModifier: ViewModifier {
var isActive: Bool
func body(content: Content) -> some View {
if isActive {
TimelineView(.periodic(from: .now, by: Metrics.blinkInterval / 2)) { context in
content.opacity(Self.isOn(at: context.date) ? 1 : 0)
}
} else {
content
}
}
/// On for the first half of each 1.1s cycle, off for the second.
static func isOn(at date: Date) -> Bool {
let half = Metrics.blinkInterval / 2
return Int(date.timeIntervalSinceReferenceDate / half).isMultiple(of: 2)
}
}
extension View {
/// Blinks the view with the design's stepped 1.1s cycle.
public func blinking(_ isActive: Bool = true) -> some View {
modifier(BlinkModifier(isActive: isActive))
}
}
/// `Helder` with the blinking amber period.
public struct Wordmark: View {
var role: TypeRole
public init(role: TypeRole = Typography.wordmark) {
self.role = role
}
public var body: some View {
HStack(alignment: .firstTextBaseline, spacing: 0) {
Text("Helder").foregroundStyle(Palette.text1)
Text(".").foregroundStyle(Palette.amber).blinking()
}
.typeRole(role)
.fixedSize()
}
}