mirror of
https://github.com/phranck/TUIkit.git
synced 2026-06-20 09:54:37 +00:00
Systematically audit and restrict public declarations across the entire framework. Internal plumbing (rendering, registries, framework services) is now internal/private while the user-facing API remains public. Categories changed: - Rendering infrastructure (Renderable, ANSIRenderer, BorderRenderer, Terminal, ViewRenderer) → internal - Framework services (PreferenceStorage, LifecycleManager, TUIContext, KeyEventDispatcher) → internal - Implementation modifier types (OnAppearModifier, OnDisappearModifier, TaskModifier, StatusBarItemsModifier, etc.) → internal - View properties (Text.content, Button.label, Menu.items, etc.) → internal - Registries (PaletteRegistry, AppearanceRegistry) → internal - Styling internals (ANSIColor, SemanticColor, GeneratedPalette.Hue, BorderStyle block-styles) → internal - ContainerView/ContainerConfig/ContainerStyle → fully internal - ThemeManager.items/init → internal - ViewBuilder glue types properties/inits → internal Also includes: - Doc warnings (/// - Important:) on types public only for technical reasons - DocC landing page and CustomViews article updated for internal types - All DocC symbol links to internal types converted to code text (0 warnings) - README test badge updated to 498 - Example app ContainerView usage replaced with Panel 498 tests passing, 0 DocC warnings.
111 lines
4.4 KiB
Swift
111 lines
4.4 KiB
Swift
//
|
|
// ContainersPage.swift
|
|
// TUIkitExample
|
|
//
|
|
// Demonstrates container view capabilities.
|
|
//
|
|
|
|
import TUIkit
|
|
|
|
/// Container views demo page.
|
|
///
|
|
/// Shows various container views including:
|
|
/// - Card (bordered container with padding)
|
|
/// - Box (simple bordered container)
|
|
/// - Panel (container with title in border)
|
|
/// - ContainerView (with header and footer)
|
|
struct ContainersPage: View {
|
|
var body: some View {
|
|
VStack(spacing: 1) {
|
|
HeaderView(title: "Container Views Demo")
|
|
|
|
HStack(spacing: 2) {
|
|
// Card example
|
|
VStack(alignment: .leading) {
|
|
Text("Card").bold().foregroundColor(.palette.accent)
|
|
Card(borderColor: .palette.border) {
|
|
Text("A Card view").foregroundColor(.palette.foreground)
|
|
Text("with padding").foregroundColor(.palette.foregroundSecondary)
|
|
}
|
|
}
|
|
|
|
// Box example
|
|
VStack(alignment: .leading) {
|
|
Text("Box").bold().foregroundColor(.palette.accent)
|
|
Box(color: .palette.border) {
|
|
Text("Simple Box").foregroundColor(.palette.foreground)
|
|
}
|
|
}
|
|
|
|
// Panel example
|
|
VStack(alignment: .leading) {
|
|
Text("Panel").bold().foregroundColor(.palette.accent)
|
|
Panel("Info", titleColor: .palette.accent) {
|
|
Text("Title in border").foregroundColor(.palette.foreground)
|
|
}
|
|
}
|
|
}
|
|
|
|
HStack(spacing: 2) {
|
|
// Panel with Header and Footer (best for block appearance)
|
|
DemoSection("Panel (Header + Footer)") {
|
|
Panel("Settings", titleColor: .palette.accent) {
|
|
Text("Primary text (foreground)").foregroundColor(.palette.foreground)
|
|
Text("Secondary text (foregroundSecondary)").foregroundColor(.palette.foregroundSecondary)
|
|
Text("Tertiary text (foregroundTertiary)").foregroundColor(.palette.foregroundTertiary)
|
|
} footer: {
|
|
Text("Footer: Press Enter to confirm").foregroundColor(.palette.foreground)
|
|
}
|
|
}
|
|
|
|
// Alignment examples - uses different text lengths to show alignment
|
|
DemoSection("Content Alignment") {
|
|
HStack(spacing: 1) {
|
|
Box {
|
|
VStack(alignment: .leading) {
|
|
Text("Leading align").foregroundColor(.palette.foreground)
|
|
Text("short").foregroundColor(.palette.foregroundSecondary)
|
|
}
|
|
}
|
|
Box {
|
|
VStack(alignment: .center) {
|
|
Text("Center align").foregroundColor(.palette.foreground)
|
|
Text("short").foregroundColor(.palette.foregroundSecondary)
|
|
}
|
|
}
|
|
Box {
|
|
VStack(alignment: .trailing) {
|
|
Text("Trailing align").foregroundColor(.palette.foreground)
|
|
Text("short").foregroundColor(.palette.foregroundSecondary)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
DemoSection("Padding") {
|
|
HStack(spacing: 1) {
|
|
Box {
|
|
Text("h:1 v:0").foregroundColor(.palette.foreground)
|
|
.padding(.horizontal, 1)
|
|
}
|
|
Box {
|
|
Text("h:1 v:1").foregroundColor(.palette.foreground)
|
|
.padding(EdgeInsets(horizontal: 1, vertical: 1))
|
|
}
|
|
Box {
|
|
Text("h:1 v:2").foregroundColor(.palette.foreground)
|
|
.padding(EdgeInsets(horizontal: 1, vertical: 2))
|
|
}
|
|
}
|
|
}
|
|
|
|
DemoSection("Appearance & BorderStyle") {
|
|
Text("BorderStyle is determined by Appearance. Press 'a' to cycle.").foregroundColor(.palette.foregroundSecondary)
|
|
}
|
|
|
|
Spacer()
|
|
}
|
|
}
|
|
}
|