ζ-0 Setup: Repo-Skelett, iOS-Build grün, Healthz live
- project.yml mit Bundle ev.mana.zitare + Widget + ShareExt-Targets - ManaSwiftCore (ManaCore + ManaTokens) + ManaSwiftUI (ManaAuthUI) als Package-Dependencies via path: - Pure SwiftUI für Native-Surfaces, WKWebView nur für Lese-Tabs (Hybrid-Sonderfall vs cards/memoro/manaspur, dokumentiert im Playbook ZITARE_NATIVE_GREENFIELD.md) - Theme: paper-Variant aus @mana/themes - ZitareAPI.healthCheck via direct URLSession (öffentlicher Endpoint, kein AuthenticatedTransport-Gate) - 6/6 AppConfigTests + 1/1 UI-Smoke grün auf iPhone 16e Simulator - Live: zitare-api.mana.how/healthz → HTTP/2 200 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
commit
0bd59ed148
25 changed files with 1468 additions and 0 deletions
105
Sources/Core/Theme/ZitareTheme.swift
Normal file
105
Sources/Core/Theme/ZitareTheme.swift
Normal file
|
|
@ -0,0 +1,105 @@
|
|||
import SwiftUI
|
||||
|
||||
#if canImport(UIKit)
|
||||
import UIKit
|
||||
|
||||
private typealias PlatformColorType = UIColor
|
||||
#elseif canImport(AppKit)
|
||||
import AppKit
|
||||
|
||||
private typealias PlatformColorType = NSColor
|
||||
#endif
|
||||
|
||||
/// Paper-Variant aus `mana/packages/themes/src/variants/paper.css`.
|
||||
/// Lokal in zitare-native nachgebaut, weil ManaTokens noch keine
|
||||
/// Variants kennt.
|
||||
///
|
||||
/// Sepia, warm, lese-fokussiert — skeumorph an Druckpapier angelehnt,
|
||||
/// passt zum (read)-Surface der Web-App.
|
||||
enum ZitareTheme {
|
||||
/// Page-Hintergrund (warmes Off-White / dunkles Sepia)
|
||||
static let background = dynamic(light: HSL(38, 28, 95), dark: HSL(24, 14, 9))
|
||||
|
||||
/// Standard-Text
|
||||
static let foreground = dynamic(light: HSL(20, 14, 16), dark: HSL(38, 24, 88))
|
||||
|
||||
/// Card, Panel, Modal
|
||||
static let surface = dynamic(light: HSL(0, 0, 100), dark: HSL(24, 12, 13))
|
||||
|
||||
/// Hover-State auf Surface
|
||||
static let surfaceHover = dynamic(light: HSL(38, 24, 92), dark: HSL(24, 14, 17))
|
||||
|
||||
/// Disabled-Felder, Skeleton
|
||||
static let muted = dynamic(light: HSL(38, 20, 90), dark: HSL(24, 12, 18))
|
||||
|
||||
/// Sekundär-Text, Placeholder
|
||||
static let mutedForeground = dynamic(light: HSL(20, 14, 50), dark: HSL(38, 12, 60))
|
||||
|
||||
/// Rahmen, Trennlinien
|
||||
static let border = dynamic(light: HSL(38, 18, 80), dark: HSL(24, 10, 25))
|
||||
|
||||
/// Zitare-Primary — warmes Terra/Sienna im Light, weicheres Sienna im Dark
|
||||
static let primary = dynamic(light: HSL(18, 50, 38), dark: HSL(24, 60, 65))
|
||||
|
||||
/// Text auf Primary
|
||||
static let primaryForeground = dynamic(light: HSL(0, 0, 100), dark: HSL(24, 14, 9))
|
||||
|
||||
static let error = dynamic(light: HSL(0, 65, 45), dark: HSL(0, 60, 55))
|
||||
static let success = dynamic(light: HSL(135, 35, 35), dark: HSL(135, 35, 55))
|
||||
static let warning = dynamic(light: HSL(38, 80, 40), dark: HSL(38, 70, 55))
|
||||
|
||||
// MARK: - HSL Helper
|
||||
|
||||
struct HSL {
|
||||
let hue: Double
|
||||
let saturation: Double
|
||||
let lightness: Double
|
||||
|
||||
init(_ hue: Double, _ saturation: Double, _ lightness: Double) {
|
||||
self.hue = hue
|
||||
self.saturation = saturation
|
||||
self.lightness = lightness
|
||||
}
|
||||
|
||||
var color: Color {
|
||||
Color(
|
||||
hue: hue / 360.0,
|
||||
saturation: saturation / 100.0,
|
||||
brightness: brightnessFromLightness(),
|
||||
opacity: 1.0
|
||||
)
|
||||
}
|
||||
|
||||
/// HSL → HSB Konversion (SwiftUI Color nutzt HSB).
|
||||
private func brightnessFromLightness() -> Double {
|
||||
let l = lightness / 100.0
|
||||
let s = saturation / 100.0
|
||||
return l + s * min(l, 1 - l)
|
||||
}
|
||||
}
|
||||
|
||||
private static func dynamic(light: HSL, dark: HSL) -> Color {
|
||||
#if canImport(UIKit)
|
||||
return Color(
|
||||
PlatformColorType { trait in
|
||||
trait.userInterfaceStyle == .dark
|
||||
? PlatformColorType(dark.color)
|
||||
: PlatformColorType(light.color)
|
||||
}
|
||||
)
|
||||
#elseif canImport(AppKit)
|
||||
return Color(
|
||||
PlatformColorType(name: nil) { appearance in
|
||||
let isDark = appearance.bestMatch(
|
||||
from: [.darkAqua, .aqua]
|
||||
) == .darkAqua
|
||||
return isDark
|
||||
? PlatformColorType(dark.color)
|
||||
: PlatformColorType(light.color)
|
||||
}
|
||||
)
|
||||
#else
|
||||
return light.color
|
||||
#endif
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue