15 Commits

Author SHA1 Message Date
phranck 5ad97132b8 Feat: Add @Observable support with Observation framework
- 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
2026-02-15 23:49:34 +01:00
phranck 55ab4a7ffd Refactor: Make Box internal and simplify container width calculation
- Make Box struct internal (use .border() modifier instead)
- Update example app to use .border() instead of Box
- Simplify resolveContainerWidth to just return content width
- Simplify resolveContainerHeight to just return content height
- Remove auto-expansion logic from containers
- Containers now size to fit their content, not fill available space
- Spacers in HStack still expand correctly to fill remaining space
- Update tests for renamed BorderViaContainerViewTests
2026-02-13 16:18:14 +01:00
phranck 1249c263b3 Chore: Update example app pages
- ContainersPage: Use trackStyle() instead of deprecated progressBarStyle()
- LayoutPage: Simplify Spacer demo section
2026-02-13 16:18:14 +01:00
phranck ac5e63eb84 Feat: Add ButtonRole, horizontal Alert buttons, ESC dismiss, arrow key navigation
- Add ButtonRole (.cancel, .destructive) with SwiftUI-conformant API
- Alert renders buttons horizontally, sorted by role (cancel left)
- Alert max width capped at 60 characters for readability
- ESC key dismisses alerts via AlertPresentationModifier handler
- FocusManager: Left/Right arrows navigate within sections (like Up/Down)
- Move completed plans to done/ directory
- Update example pages with minor adjustments
2026-02-08 23:00:59 +01:00
phranck 989b90effa Refactor: Rename .foregroundColor() to .foregroundStyle() for SwiftUI API parity 2026-02-08 16:36:53 +01:00
phranck d3f8ff60f3 Chore: Change license to MIT
- Add LICENSE file (MIT)
- Update 141 Swift file headers: CC BY-NC-SA 4.0 → License: MIT
2026-02-06 00:21:51 +01:00
phranck 45d08c447d Feat: Add ProgressView with 5 bar styles and SwiftUI-matching API
Determinate progress bar with block, blockFine, shade, bar, and dot
styles. 4 initializers matching SwiftUI signatures (value/total, label,
currentValueLabel, string title). Style selection via .progressBarStyle()
modifier. Colors: foregroundSecondary (filled), foregroundTertiary (empty),
accent (dot head). 26 tests in 3 suites.
2026-02-05 23:18:38 +01:00
phranck 20547de056 Feat: apply .equatable() to static example app subtrees
Add Equatable conformance and .equatable() wrapper to extracted views:
- FeatureBox (MainMenuPage): title/subtitle comparison, 3 instances
- ContainerTypesRow (ContainersPage): property-free, always cache-hits
- SettingsAndAlignmentRow (ContainersPage): property-free, always cache-hits

These subtrees are purely palette-driven with no @State dependencies.
During Spinner/Pulse animation frames (25 FPS), the render cache skips
their entire subtree rendering — only the animated views re-render.
2026-02-05 14:47:31 +01:00
phranck 095c67e021 Refactor: decompose ContainersPage and MainMenuPage into smaller view structs
Extract static, state-free subtrees into standalone View structs to
prepare for .equatable() memoization in Phase 5:

- FeatureBox: extracted from MainMenuPage's private featureBox() method
- ContainerTypesRow: Card/Box/Panel examples from ContainersPage
- SettingsAndAlignmentRow: settings panel + alignment demos

ButtonsPage left as-is — nearly all sections depend on @State clickCount
through Button actions, making decomposition ineffective for memoization.
2026-02-05 14:46:12 +01:00
phranck df4ee3253b Feat: AppHeader — framework-managed header bar rendered outside the view tree
AppHeader is rendered at the top of the terminal by RenderLoop, similar to
StatusBar at the bottom. Views declare header content via .appHeader { }
ViewBuilder modifier. Supports standard (thin divider) and block (half-block
with appHeaderBackground) appearance. Hidden when no content is set.
Diff cache invalidates on header height changes to prevent ghosting.
2026-02-03 21:21:41 +01:00
phranck f77cd8bdec Chore: Unified file headers across all Swift files
Update IDETemplateMacros.plist and replace headers in 136 Swift files with
new format: 🖥️ TUIKit — Terminal UI Kit for Swift. Remove sdsd.swift template draft.
2026-02-03 20:48:29 +01:00
phranck 50825d61da Feat: Structural identity for @State — persistent state across view reconstruction
Implement SwiftUI-style structural identity so @State values survive
full view-tree reconstruction on every render pass. State is keyed by
ViewIdentity (path-based) and property index in a central StateStorage.

- Add ViewIdentity (path-based structural identity for views)
- Add StateStorage with GC and branch invalidation
- Refactor @State to self-hydrate from StateStorage during init
- Set root hydration context in RenderLoop before app.body evaluation
- Extend RenderContext with identity propagation helpers
- Add ConditionalView branch invalidation on switch
- Remove scene cache from RenderLoop (app.body evaluated fresh per frame)
- Enhance Example App pages with @State (ButtonsPage, OverlaysPage, ContainersPage)
- Update DocC articles (StateManagement, RenderCycle)
- Add 12 tests for state storage identity
2026-02-02 18:31:53 +01:00
phranck 68fcf47637 Refactor: Restrict access levels to minimize public API surface
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.
2026-01-31 14:29:39 +01:00
phranck 9f7092d4c8 Refactor: Replace EnvironmentStorage singleton with semantic colors and deprecate @Environment (Phase 6) 2026-01-31 01:13:31 +01:00
phranck 95029184e7 Chore: Rename TUIKit to TUIkit
- Rename module, targets and products in Package.swift
- Rename directories: Sources/TUIkit, TUIkitExample, Tests/TUIkitTests
- Rename files: TUIkit.swift, TUIkit.docc/TUIkit.md
- Update all import statements, module-qualified calls, file headers
- Update doc comments, string literals and DocC articles
- Update CI workflow, README, .swiftlint.yml and markdown docs
- Merge platform badges into single combined badge in README
- Add "Example App auslagern" task to to-dos.md
2026-01-30 20:29:29 +01:00