feat: Removes old version / files
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user