mirror of
https://github.com/phranck/TUIkit.git
synced 2026-05-21 09:50:35 +00:00
5ad97132b8
- Replace custom Observable protocol and @Published with Apple's @Observable macro - Add withObservationTracking in renderToBuffer for automatic per-property dependency tracking - Add type-based @Environment(Type.self) and .environment(object) for observable objects - Add ObjectEnvironmentModifier for injecting observable objects into the environment - Add needsCacheClear flag to AppState for thread-safe cache invalidation - Add cross-platform test script (scripts/test-linux.sh) for Docker-based Linux verification - Add DemoAppHeader with system info display (OS, version, architecture) - Consolidate Example App: extract ImageDemoHelpers, KeyboardHelpSection, ValueDisplayRow - Add pre-push verification rule to CLAUDE.md - Verified on both macOS and Linux (swift:6.0 container), 1155 tests passing
35 lines
846 B
Swift
35 lines
846 B
Swift
// 🖥️ TUIKit — Terminal UI Kit for Swift
|
||
// ValueDisplayRow.swift
|
||
//
|
||
// Created by LAYERED.work
|
||
// License: MIT
|
||
|
||
import TUIkit
|
||
|
||
/// A label-value row for displaying current state in demo pages.
|
||
///
|
||
/// Renders the label in secondary color and the value in bold accent color.
|
||
///
|
||
/// # Example
|
||
///
|
||
/// ```swift
|
||
/// ValueDisplayRow("Volume:", String(format: "%.0f%%", volume * 100))
|
||
/// ValueDisplayRow("Selection:", selection ?? "(none)")
|
||
/// ```
|
||
struct ValueDisplayRow: View {
|
||
let label: String
|
||
let value: String
|
||
|
||
init(_ label: String, _ value: String) {
|
||
self.label = label
|
||
self.value = value
|
||
}
|
||
|
||
var body: some View {
|
||
HStack(spacing: 1) {
|
||
Text(label).foregroundStyle(.palette.foregroundSecondary)
|
||
Text(value).bold().foregroundStyle(.palette.accent)
|
||
}
|
||
}
|
||
}
|