feat: Adds stack separators, removes some unused nodes from cli-doc module
All checks were successful
CI / Run tests. (push) Successful in 52s
All checks were successful
CI / Run tests. (push) Successful in 52s
This commit is contained in:
29
Sources/CliDocCore/Nodes/StackConfiguration.swift
Normal file
29
Sources/CliDocCore/Nodes/StackConfiguration.swift
Normal file
@@ -0,0 +1,29 @@
|
||||
/// Represents the content of an ``HStack`` or a ``VStack``.
|
||||
///
|
||||
///
|
||||
public struct StackConfiguration {
|
||||
public let content: [any TextNode]
|
||||
}
|
||||
|
||||
@usableFromInline
|
||||
struct AnySeparatableStackNode<Separator: TextNode>: TextNode {
|
||||
|
||||
@usableFromInline
|
||||
let content: [any TextNode]
|
||||
|
||||
@usableFromInline
|
||||
let separator: Separator
|
||||
|
||||
@usableFromInline
|
||||
init(content: StackConfiguration, separator: Separator) {
|
||||
self.content = content.content
|
||||
self.separator = separator
|
||||
}
|
||||
|
||||
@usableFromInline
|
||||
var body: some TextNode {
|
||||
content.removingEmptys()
|
||||
.map { $0.render() }
|
||||
.joined(separator: separator.render())
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user