feat: Removes old version / files

This commit is contained in:
2024-12-03 21:23:54 -05:00
parent 590df275cc
commit 0a18b57dc8
25 changed files with 206 additions and 606 deletions

View File

@@ -1,45 +1,19 @@
import Rainbow
public struct Label<Content: TextNode>: TextNode {
@usableFromInline
let content: Content
public struct Label: Node {
var color: NamedColor?
var styles: [Style]
let node: any Node
public init(
_ label: String,
color: NamedColor? = nil,
style styles: Style...
) {
self.color = color
self.node = label
self.styles = styles
@inlinable
public init(@TextBuilder _ content: () -> Content) {
self.content = content()
}
public init(
_ label: String,
color: NamedColor? = nil,
style styles: [Style] = []
) {
self.color = color
self.node = label
self.styles = styles
@inlinable
public init(_ content: Content) {
self.content = content
}
public init(
color: NamedColor? = nil,
styles: [Style] = [],
@NodeBuilder _ build: () -> any Node
) {
self.color = color
self.styles = styles
self.node = build()
@inlinable
public var body: some TextNode {
content
}
public var body: some Node {
let output = styles.reduce(node.render()) { $0.applyingStyle($1) }
guard let color else { return output }
return output.applyingColor(color)
}
}