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,19 @@
/// A horizontal group of text nodes.
public struct HStack: TextNode {
@usableFromInline
let content: [any TextNode]
@usableFromInline
let separator: any TextNode
let separator: Separator.Horizontal
@inlinable
public init(
spacing: Int = 1,
separator: Separator.Horizontal = .space(count: 1),
@TextBuilder content: () -> any TextNode
) {
self.content = array(from: content())
self.separator = seperator(" ", count: spacing > 0 ? spacing - 1 : 0)
self.separator = separator
}
@inlinable