feat: Adds vertical and horizontal separators, renames modifier protocol.

This commit is contained in:
2024-12-05 22:38:42 -05:00
parent bef91c5277
commit 9985b55f88
15 changed files with 253 additions and 93 deletions

View File

@@ -1,18 +1,21 @@
public struct VStack: TextNode {
/// A vertical stack of text nodes.
///
///
public struct VStack: TextNode {
@usableFromInline
let content: [any TextNode]
@usableFromInline
let separator: any TextNode
let separator: Separator.Vertical
@inlinable
public init(
spacing: Int = 1,
separator: Separator.Vertical = .newLine(count: 1),
@TextBuilder content: () -> any TextNode
) {
self.content = array(from: content())
self.separator = seperator("\n", count: spacing > 0 ? spacing - 1 : 0)
self.separator = separator
}
@inlinable