Files
TUIkit/Sources/TUIkitView/Environment/ViewServiceEnvironment.swift
phranck d0627bafdc Refactor: Extract TUIkitView module and organize sub-module directories
- Extract View system foundation into new TUIkitView module (Layer 1)
  - View, ViewBuilder, TupleViews, ViewModifier, PrimitiveViews, EquatableView
  - Renderable, RenderContext, RenderCache, ChildInfo, SpacerProtocol
  - State, StateStorage, StateRegistration, HydrationContext
  - EnvironmentValues, EnvironmentModifier, ViewServiceEnvironment
- Introduce SpacerProtocol to decouple ChildInfo from concrete Spacer type
- Split ServiceEnvironment.swift (StateStorageKey/RenderCacheKey to TUIkitView)
- Add @_exported import TUIkitView in Exports.swift for backward compatibility
- Make internal types public for cross-module visibility (Renderable, Layoutable,
  renderToBuffer, ChildView, ChildInfo, ModifiedView, StateStorage, RenderCache)
- Organize TUIkitCore into Rendering/, Environment/, Input/, Extensions/, Concurrency/
- Organize TUIkitStyling into Color/, Theme/, Styles/
2026-02-14 14:11:09 +01:00

39 lines
1016 B
Swift
Raw Permalink Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// 🖥 TUIKit Terminal UI Kit for Swift
// ViewServiceEnvironment.swift
//
// Created by LAYERED.work
// License: MIT
import TUIkitCore
// MARK: - State Storage
/// EnvironmentKey for the persistent `@State` value storage.
private struct StateStorageKey: EnvironmentKey {
static let defaultValue: StateStorage? = nil
}
// MARK: - Render Cache
/// EnvironmentKey for memoized subtree rendering results.
private struct RenderCacheKey: EnvironmentKey {
static let defaultValue: RenderCache? = nil
}
// MARK: - EnvironmentValues Extensions
extension EnvironmentValues {
/// The persistent `@State` value storage indexed by `ViewIdentity`.
public var stateStorage: StateStorage? {
get { self[StateStorageKey.self] }
set { self[StateStorageKey.self] = newValue }
}
/// Cache for memoized subtree rendering results.
public var renderCache: RenderCache? {
get { self[RenderCacheKey.self] }
set { self[RenderCacheKey.self] = newValue }
}
}