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
31 lines
932 B
Swift
31 lines
932 B
Swift
// 🖥️ TUIKit — Terminal UI Kit for Swift
|
||
// ImageDemoHelpers.swift
|
||
//
|
||
// Created by LAYERED.work
|
||
// License: MIT
|
||
|
||
import TUIkit
|
||
|
||
/// Shared image demo configuration used by both `ImageFilePage` and `ImageURLPage`.
|
||
enum ImageDemoHelpers {
|
||
static let charSets: [ASCIICharacterSet] = [.blocks, .ascii, .braille]
|
||
static let colorModes: [ASCIIColorMode] = [.trueColor, .ansi256, .grayscale, .mono]
|
||
|
||
static func charSetLabel(_ index: Int) -> String {
|
||
switch charSets[index] {
|
||
case .ascii: return "chars:ascii"
|
||
case .blocks: return "chars:blocks"
|
||
case .braille: return "chars:braille"
|
||
}
|
||
}
|
||
|
||
static func colorModeLabel(_ index: Int) -> String {
|
||
switch colorModes[index] {
|
||
case .trueColor: return "color:true"
|
||
case .ansi256: return "color:256"
|
||
case .grayscale: return "color:gray"
|
||
case .mono: return "color:mono"
|
||
}
|
||
}
|
||
}
|