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
72 lines
2.0 KiB
Swift
72 lines
2.0 KiB
Swift
// 🖥️ TUIKit — Terminal UI Kit for Swift
|
||
// LayoutPage.swift
|
||
//
|
||
// Created by LAYERED.work
|
||
// License: MIT
|
||
|
||
import TUIkit
|
||
|
||
/// Layout system demo page.
|
||
///
|
||
/// Shows various layout options including:
|
||
/// - VStack (vertical stacking)
|
||
/// - HStack (horizontal stacking)
|
||
/// - Spacer (flexible space)
|
||
/// - Padding and frame modifiers
|
||
struct LayoutPage: View {
|
||
var body: some View {
|
||
VStack(alignment: .leading, spacing: 1) {
|
||
|
||
DemoSection("VStack (Vertical)") {
|
||
VStack(spacing: 0) {
|
||
Text("Item 1")
|
||
Text("Item 2")
|
||
Text("Item 3")
|
||
}
|
||
.border(color: .brightBlack)
|
||
}
|
||
|
||
DemoSection("HStack (Horizontal)") {
|
||
HStack(spacing: 2) {
|
||
Text("Left")
|
||
Text("Center")
|
||
Text("Right")
|
||
}
|
||
.border()
|
||
}
|
||
|
||
DemoSection("Spacer") {
|
||
HStack {
|
||
Text("Start")
|
||
Spacer()
|
||
Text("End")
|
||
}
|
||
.border()
|
||
}
|
||
|
||
DemoSection("Padding & Frame") {
|
||
HStack(spacing: 2) {
|
||
VStack {
|
||
Text(".padding()").dim()
|
||
Text("Padded")
|
||
.frame(width: 25, alignment: .center)
|
||
.padding(EdgeInsets(all: 1))
|
||
.border() // Uses appearance default
|
||
}
|
||
VStack {
|
||
Text(".frame()").dim()
|
||
Text("Framed")
|
||
.frame(width: 15, alignment: .center)
|
||
.border() // Uses appearance default
|
||
}
|
||
}
|
||
}
|
||
|
||
Spacer()
|
||
}
|
||
.appHeader {
|
||
DemoAppHeader("Layout System Demo")
|
||
}
|
||
}
|
||
}
|