feat: Moves core functionality into it's own library.
This commit is contained in:
23
Sources/CliDocCore/Nodes/VStack.swift
Normal file
23
Sources/CliDocCore/Nodes/VStack.swift
Normal file
@@ -0,0 +1,23 @@
|
||||
public struct VStack: TextNode {
|
||||
|
||||
@usableFromInline
|
||||
let content: [any TextNode]
|
||||
|
||||
@usableFromInline
|
||||
let separator: any TextNode
|
||||
|
||||
@inlinable
|
||||
public init(
|
||||
spacing: Int = 1,
|
||||
@TextBuilder content: () -> any TextNode
|
||||
) {
|
||||
self.content = array(from: content())
|
||||
self.separator = seperator("\n", count: spacing > 0 ? spacing - 1 : 0)
|
||||
}
|
||||
|
||||
@inlinable
|
||||
public var body: some TextNode {
|
||||
content.removingEmptys()
|
||||
.joined(separator: separator.render())
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user