` or `` based on content.
+/// Generates markup text elements as ` ` or `` based on content.
///
/// Paragraphs are for long form content with multiple sentences and
/// a `` tag is used for a single sentence of text and grouping inline content.
@@ -10,7 +10,7 @@ public struct Text: Element {
private let role: AriaRole?
private let label: String?
private let data: [String: String]?
- private let contentBuilder: HTMLContentBuilder
+ private let contentBuilder: MarkupContentBuilder
/// Creates a new text element with string content.
///
@@ -19,8 +19,8 @@ public struct Text: Element {
///
/// - Parameters:
/// - content: The text content to display.
- /// - id: Unique identifier for the HTML element.
- /// - classes: An array of CSS classnames.
+ /// - id: Unique identifier for the markup element.
+ /// - classes: An array of stylesheet classnames.
/// - role: ARIA role of the element for accessibility.
/// - label: ARIA label to describe the element.
/// - data: Dictionary of `data-*` attributes for element relevant storing data.
@@ -46,13 +46,13 @@ public struct Text: Element {
self.contentBuilder = { [content] }
}
- /// Creates a new text element using HTMLBuilder closure syntax.
+ /// Creates a new text element using MarkupBuilder closure syntax.
///
/// Uses ` ` for multiple sentences, `` for one or fewer.
///
/// - Parameters:
- /// - id: Unique identifier for the HTML element.
- /// - classes: An array of CSS classnames.
+ /// - id: Unique identifier for the markup element.
+ /// - classes: An array of stylesheet classnames.
/// - role: ARIA role of the element for accessibility.
/// - label: ARIA label to describe the element.
/// - data: Dictionary of `data-*` attributes for element relevant storing data.
@@ -68,7 +68,7 @@ public struct Text: Element {
role: AriaRole? = nil,
label: String? = nil,
data: [String: String]? = nil,
- @HTMLBuilder content: @escaping HTMLContentBuilder
+ @MarkupBuilder content: @escaping MarkupContentBuilder
) {
self.id = id
self.classes = classes
@@ -78,11 +78,11 @@ public struct Text: Element {
self.contentBuilder = content
}
- public var body: some HTML {
- HTMLString(content: renderTag())
+ public var body: some Markup {
+ MarkupString(content: buildMarkupTag())
}
- private func renderTag() -> String {
+ private func buildMarkupTag() -> String {
let renderedContent = contentBuilder().map { $0.render() }.joined()
let sentenceCount = renderedContent.components(
separatedBy: CharacterSet(charactersIn: ".!?")
diff --git a/Sources/WebUI/Elements/Text/Time.swift b/Sources/WebUI/Elements/Text/Time.swift
index 67632a2e..adada6b5 100644
--- a/Sources/WebUI/Elements/Text/Time.swift
+++ b/Sources/WebUI/Elements/Text/Time.swift
@@ -20,14 +20,14 @@ public struct Time: Element {
private let role: AriaRole?
private let label: String?
private let data: [String: String]?
- private let contentBuilder: HTMLContentBuilder
+ private let contentBuilder: MarkupContentBuilder
/// Creates a new HTML time element.
///
/// - Parameters:
/// - datetime: The machine-readable timestamp in a valid format (ISO 8601 recommended).
/// - id: Unique identifier for the HTML element, useful for JavaScript interaction and styling.
- /// - classes: An array of CSS classnames for styling the time element.
+ /// - classes: An array of stylesheet classnames for styling the time element.
/// - role: ARIA role of the element for accessibility, enhancing screen reader interpretation.
/// - label: ARIA label to describe the element for accessibility when context isn't sufficient.
/// - data: Dictionary of `data-*` attributes for storing custom data relevant to the time element.
@@ -49,7 +49,7 @@ public struct Time: Element {
role: AriaRole? = nil,
label: String? = nil,
data: [String: String]? = nil,
- @HTMLBuilder content: @escaping HTMLContentBuilder = { [] }
+ @MarkupBuilder content: @escaping MarkupContentBuilder = { [] }
) {
self.datetime = datetime
self.id = id
@@ -60,11 +60,11 @@ public struct Time: Element {
self.contentBuilder = content
}
- public var body: some HTML {
- HTMLString(content: renderTag())
+ public var body: some Markup {
+ MarkupString(content: buildMarkupTag())
}
- private func renderTag() -> String {
+ private func buildMarkupTag() -> String {
var additional: [String] = []
if let datetimeAttr = Attribute.string("datetime", datetime) {
additional.append(datetimeAttr)
@@ -78,7 +78,7 @@ public struct Time: Element {
additional: additional
)
let content = contentBuilder().map { $0.render() }.joined()
- return AttributeBuilder.renderTag(
+ return AttributeBuilder.buildMarkupTag(
"time", attributes: attributes, content: content)
}
}
diff --git a/Sources/WebUI/Styles/Color/BackgroundStyleOperation.swift b/Sources/WebUI/Styles/Color/BackgroundStyleOperation.swift
index 353ced69..d844d124 100644
--- a/Sources/WebUI/Styles/Color/BackgroundStyleOperation.swift
+++ b/Sources/WebUI/Styles/Color/BackgroundStyleOperation.swift
@@ -29,10 +29,10 @@ public struct BackgroundStyleOperation: StyleOperation, @unchecked Sendable {
}
}
- /// Applies the background style and returns the appropriate CSS classes
+ /// Applies the background style and returns the appropriate stylesheet classes
///
/// - Parameter params: The parameters for background styling
- /// - Returns: An array of CSS class names to be applied to elements
+ /// - Returns: An array of stylesheet class names to be applied to elements
public func applyClasses(params: Parameters) -> [String] {
["bg-\(params.color.rawValue)"]
}
@@ -45,7 +45,7 @@ public struct BackgroundStyleOperation: StyleOperation, @unchecked Sendable {
}
// Extension for Element to provide background styling
-extension HTML {
+extension Markup {
/// Applies background color to the element.
///
/// Adds a background color class based on the provided color and optional modifiers.
@@ -70,7 +70,7 @@ extension HTML {
public func background(
color: Color,
on modifiers: Modifier...
- ) -> some HTML {
+ ) -> some Markup {
let params = BackgroundStyleOperation.Parameters(color: color)
return BackgroundStyleOperation.shared.applyTo(
diff --git a/Sources/WebUI/Styles/Effects/Border/BorderRadiusStyleOperation.swift b/Sources/WebUI/Styles/Effects/Border/BorderRadiusStyleOperation.swift
index e4354c0d..5b68d851 100644
--- a/Sources/WebUI/Styles/Effects/Border/BorderRadiusStyleOperation.swift
+++ b/Sources/WebUI/Styles/Effects/Border/BorderRadiusStyleOperation.swift
@@ -38,10 +38,10 @@ public struct BorderRadiusStyleOperation: StyleOperation, @unchecked Sendable {
}
}
- /// Applies the border radius style and returns the appropriate CSS classes
+ /// Applies the border radius style and returns the appropriate stylesheet classes
///
/// - Parameter params: The parameters for border radius styling
- /// - Returns: An array of CSS class names to be applied to elements
+ /// - Returns: An array of stylesheet class names to be applied to elements
public func applyClasses(params: Parameters) -> [String] {
var classes: [String] = []
let size = params.size
@@ -65,7 +65,7 @@ public struct BorderRadiusStyleOperation: StyleOperation, @unchecked Sendable {
}
// Extension for Element to provide border radius styling
-extension HTML {
+extension Markup {
/// Applies border radius styling to the element.
///
/// - Parameters:
@@ -87,7 +87,7 @@ extension HTML {
_ size: RadiusSize? = .md,
_ sides: RadiusSide...,
on modifiers: Modifier...
- ) -> some HTML {
+ ) -> some Markup {
let params = BorderRadiusStyleOperation.Parameters(
size: size,
sides: sides
diff --git a/Sources/WebUI/Styles/Effects/Border/BorderStyleOperation.swift b/Sources/WebUI/Styles/Effects/Border/BorderStyleOperation.swift
index 4260abfb..460df0ba 100644
--- a/Sources/WebUI/Styles/Effects/Border/BorderStyleOperation.swift
+++ b/Sources/WebUI/Styles/Effects/Border/BorderStyleOperation.swift
@@ -52,10 +52,10 @@ public struct BorderStyleOperation: StyleOperation, @unchecked Sendable {
}
}
- /// Applies the border style and returns the appropriate CSS classes
+ /// Applies the border style and returns the appropriate stylesheet classes
///
/// - Parameter params: The parameters for border styling
- /// - Returns: An array of CSS class names to be applied to elements
+ /// - Returns: An array of stylesheet class names to be applied to elements
public func applyClasses(params: Parameters) -> [String] {
var classes: [String] = []
let width = params.width
@@ -100,7 +100,7 @@ public struct BorderStyleOperation: StyleOperation, @unchecked Sendable {
}
// Extension for Element to provide border styling
-extension HTML {
+extension Markup {
/// Applies border styling to the element with specified attributes.
///
/// Adds borders with custom width, style, and color to specified edges of an element.
@@ -125,7 +125,7 @@ extension HTML {
style: BorderStyle? = nil,
color: Color? = nil,
on modifiers: Modifier...
- ) -> some HTML {
+ ) -> some Markup {
let params = BorderStyleOperation.Parameters(
width: width,
edges: edges,
diff --git a/Sources/WebUI/Styles/Effects/Border/EdgeInsets.swift b/Sources/WebUI/Styles/Effects/Border/EdgeInsets.swift
index 173be3f2..552efa5b 100644
--- a/Sources/WebUI/Styles/Effects/Border/EdgeInsets.swift
+++ b/Sources/WebUI/Styles/Effects/Border/EdgeInsets.swift
@@ -64,13 +64,13 @@ public struct EdgeInsets: Sendable, Equatable {
// MARK: - Margin and Padding Style API
-extension HTML {
+extension Markup {
/// Applies margin styling to the element using edge insets.
///
/// - Parameters:
/// - insets: The edge insets to apply as margins.
/// - modifiers: Zero or more modifiers (e.g., `.hover`, `.md`) to scope the styles.
- /// - Returns: HTML with updated margin classes.
+ /// - Returns: Markup with updated margin classes.
///
/// ## Example
/// ```swift
@@ -79,7 +79,7 @@ extension HTML {
public func margins(
_ insets: EdgeInsets,
on modifiers: Modifier...
- ) -> some HTML {
+ ) -> some Markup {
let classes = EdgeInsets.marginClasses(from: insets)
let newClasses = StyleUtilities.combineClasses(classes, withModifiers: modifiers)
return StyleModifier(content: self, classes: newClasses)
@@ -90,7 +90,7 @@ extension HTML {
/// - Parameters:
/// - insets: The edge insets to apply as padding.
/// - modifiers: Zero or more modifiers (e.g., `.hover`, `.md`) to scope the styles.
- /// - Returns: HTML with updated padding classes.
+ /// - Returns: Markup with updated padding classes.
///
/// ## Example
/// ```swift
@@ -99,7 +99,7 @@ extension HTML {
public func padding(
_ insets: EdgeInsets,
on modifiers: Modifier...
- ) -> some HTML {
+ ) -> some Markup {
let classes = EdgeInsets.paddingClasses(from: insets)
let newClasses = StyleUtilities.combineClasses(classes, withModifiers: modifiers)
return StyleModifier(content: self, classes: newClasses)
diff --git a/Sources/WebUI/Styles/Effects/OpacityStyleOperation.swift b/Sources/WebUI/Styles/Effects/OpacityStyleOperation.swift
index 5d2a0534..88b0c83d 100644
--- a/Sources/WebUI/Styles/Effects/OpacityStyleOperation.swift
+++ b/Sources/WebUI/Styles/Effects/OpacityStyleOperation.swift
@@ -28,10 +28,10 @@ public struct OpacityStyleOperation: StyleOperation, @unchecked Sendable {
}
}
- /// Applies the opacity style and returns the appropriate CSS classes
+ /// Applies the opacity style and returns the appropriate stylesheet classes
///
/// - Parameter params: The parameters for opacity styling
- /// - Returns: An array of CSS class names to be applied to elements
+ /// - Returns: An array of stylesheet class names to be applied to elements
public func applyClasses(params: Parameters) -> [String] {
["opacity-\(params.value)"]
}
@@ -44,13 +44,13 @@ public struct OpacityStyleOperation: StyleOperation, @unchecked Sendable {
}
// Extension for HTML to provide opacity styling
-extension HTML {
+extension Markup {
/// Sets the opacity of the element with optional modifiers.
///
/// - Parameters:
/// - value: The opacity value, typically between 0 and 100.
/// - modifiers: Zero or more modifiers (e.g., `.hover`, `.md`) to scope the styles.
- /// - Returns: HTML with updated opacity classes including applied modifiers.
+ /// - Returns: Markup with updated opacity classes including applied modifiers.
///
/// ## Example
/// ```swift
@@ -61,7 +61,7 @@ extension HTML {
public func opacity(
_ value: Int,
on modifiers: Modifier...
- ) -> some HTML {
+ ) -> some Markup {
let params = OpacityStyleOperation.Parameters(value: value)
return OpacityStyleOperation.shared.applyTo(
diff --git a/Sources/WebUI/Styles/Effects/OutlineStyleOperation.swift b/Sources/WebUI/Styles/Effects/OutlineStyleOperation.swift
index cfb4efdf..7cc44ae2 100644
--- a/Sources/WebUI/Styles/Effects/OutlineStyleOperation.swift
+++ b/Sources/WebUI/Styles/Effects/OutlineStyleOperation.swift
@@ -52,10 +52,10 @@ public struct OutlineStyleOperation: StyleOperation, @unchecked Sendable {
}
}
- /// Applies the outline style and returns the appropriate CSS classes
+ /// Applies the outline style and returns the appropriate stylesheet classes
///
/// - Parameter params: The parameters for outline styling
- /// - Returns: An array of CSS class names to be applied to elements
+ /// - Returns: An array of stylesheet class names to be applied to elements
public func applyClasses(params: Parameters) -> [String] {
var classes: [String] = []
@@ -90,7 +90,7 @@ public struct OutlineStyleOperation: StyleOperation, @unchecked Sendable {
}
// Extension for HTML to provide outline styling
-extension HTML {
+extension Markup {
/// Sets outline properties with optional modifiers.
///
/// - Parameters:
@@ -99,7 +99,7 @@ extension HTML {
/// - color: The outline color.
/// - offset: The outline offset in pixels.
/// - modifiers: Zero or more modifiers (e.g., `.hover`, `.md`) to scope the styles.
- /// - Returns: HTML with updated outline classes.
+ /// - Returns: Markup with updated outline classes.
///
/// ## Example
/// ```swift
@@ -118,7 +118,7 @@ extension HTML {
color: Color? = nil,
offset: Int? = nil,
on modifiers: Modifier...
- ) -> some HTML {
+ ) -> some Markup {
let params = OutlineStyleOperation.Parameters(
width: width,
style: style,
diff --git a/Sources/WebUI/Styles/Effects/RingStyleOperation.swift b/Sources/WebUI/Styles/Effects/RingStyleOperation.swift
index f09b7178..5665907b 100644
--- a/Sources/WebUI/Styles/Effects/RingStyleOperation.swift
+++ b/Sources/WebUI/Styles/Effects/RingStyleOperation.swift
@@ -45,10 +45,10 @@ public struct RingStyleOperation: StyleOperation, @unchecked Sendable {
}
}
- /// Applies the ring style and returns the appropriate CSS classes
+ /// Applies the ring style and returns the appropriate stylesheet classes
///
/// - Parameter params: The parameters for ring styling
- /// - Returns: An array of CSS class names to be applied to elements
+ /// - Returns: An array of stylesheet class names to be applied to elements
public func applyClasses(params: Parameters) -> [String] {
var classes: [String] = []
let size = params.size ?? 1
@@ -71,7 +71,7 @@ public struct RingStyleOperation: StyleOperation, @unchecked Sendable {
}
// Extension for HTML to provide ring styling
-extension HTML {
+extension Markup {
/// Applies ring styling to the element with specified attributes.
///
/// Adds rings with custom width, style, and color to specified edges of an element.
@@ -80,7 +80,7 @@ extension HTML {
/// - size: The width of the ring.
/// - color: The ring color.
/// - modifiers: Zero or more modifiers (e.g., `.hover`, `.md`) to scope the styles.
- /// - Returns: HTML with updated ring classes.
+ /// - Returns: Markup with updated ring classes.
///
/// ## Example
/// ```swift
@@ -92,7 +92,7 @@ extension HTML {
size: Int = 1,
color: Color? = nil,
on modifiers: Modifier...
- ) -> some HTML {
+ ) -> some Markup {
let params = RingStyleOperation.Parameters(
size: size,
color: color
diff --git a/Sources/WebUI/Styles/Effects/Shadow/ShadowStyleOperation.swift b/Sources/WebUI/Styles/Effects/Shadow/ShadowStyleOperation.swift
index 1c0b7901..9dad5e78 100644
--- a/Sources/WebUI/Styles/Effects/Shadow/ShadowStyleOperation.swift
+++ b/Sources/WebUI/Styles/Effects/Shadow/ShadowStyleOperation.swift
@@ -38,10 +38,10 @@ public struct ShadowStyleOperation: StyleOperation, @unchecked Sendable {
}
}
- /// Applies the shadow style and returns the appropriate CSS classes
+ /// Applies the shadow style and returns the appropriate stylesheet classes
///
/// - Parameter params: The parameters for shadow styling
- /// - Returns: An array of CSS class names to be applied to elements
+ /// - Returns: An array of stylesheet class names to be applied to elements
public func applyClasses(params: Parameters) -> [String] {
var classes: [String] = []
let size = params.size ?? ShadowSize.md
@@ -64,7 +64,7 @@ public struct ShadowStyleOperation: StyleOperation, @unchecked Sendable {
}
// Extension for HTML to provide shadow styling
-extension HTML {
+extension Markup {
/// Applies shadow styling to the element with specified attributes.
///
/// Adds shadows with custom size and color to an element.
@@ -73,7 +73,7 @@ extension HTML {
/// - size: The shadow size (sm, md, lg).
/// - color: The shadow color.
/// - modifiers: Zero or more modifiers (e.g., `.hover`, `.md`) to scope the styles.
- /// - Returns: HTML with updated shadow classes.
+ /// - Returns: Markup with updated shadow classes.
///
/// ## Example
/// ```swift
@@ -85,7 +85,7 @@ extension HTML {
size: ShadowSize,
color: Color? = nil,
on modifiers: Modifier...
- ) -> some HTML {
+ ) -> some Markup {
let params = ShadowStyleOperation.Parameters(
size: size,
color: color
diff --git a/Sources/WebUI/Styles/Effects/TransformStyleOperation.swift b/Sources/WebUI/Styles/Effects/TransformStyleOperation.swift
index 85af0cfe..dbf2af2b 100644
--- a/Sources/WebUI/Styles/Effects/TransformStyleOperation.swift
+++ b/Sources/WebUI/Styles/Effects/TransformStyleOperation.swift
@@ -52,10 +52,10 @@ public struct TransformStyleOperation: StyleOperation, @unchecked Sendable {
}
}
- /// Applies the transform style and returns the appropriate CSS classes
+ /// Applies the transform style and returns the appropriate stylesheet classes
///
/// - Parameter params: The parameters for transform styling
- /// - Returns: An array of CSS class names to be applied to elements
+ /// - Returns: An array of stylesheet class names to be applied to elements
public func applyClasses(params: Parameters) -> [String] {
var classes: [String] = ["transform"]
@@ -100,7 +100,7 @@ public struct TransformStyleOperation: StyleOperation, @unchecked Sendable {
}
// Extension for Element to provide transform styling
-extension HTML {
+extension Markup {
/// Applies transformation styling to the element.
///
/// Adds classes for scaling, rotating, translating, and skewing, optionally scoped to modifiers.
@@ -119,7 +119,7 @@ extension HTML {
translate: (x: Int?, y: Int?)? = nil,
skew: (x: Int?, y: Int?)? = nil,
on modifiers: Modifier...
- ) -> some HTML {
+ ) -> some Markup {
let params = TransformStyleOperation.Parameters(
scale: scale,
rotate: rotate,
diff --git a/Sources/WebUI/Styles/Effects/Transition/TransitionStyleOperation.swift b/Sources/WebUI/Styles/Effects/Transition/TransitionStyleOperation.swift
index 23bb6600..45d207c7 100644
--- a/Sources/WebUI/Styles/Effects/Transition/TransitionStyleOperation.swift
+++ b/Sources/WebUI/Styles/Effects/Transition/TransitionStyleOperation.swift
@@ -52,10 +52,10 @@ public struct TransitionStyleOperation: StyleOperation, @unchecked Sendable {
}
}
- /// Applies the transition style and returns the appropriate CSS classes
+ /// Applies the transition style and returns the appropriate stylesheet classes
///
/// - Parameter params: The parameters for transition styling
- /// - Returns: An array of CSS class names to be applied to elements
+ /// - Returns: An array of stylesheet class names to be applied to elements
public func applyClasses(params: Parameters) -> [String] {
var classes: [String] = []
@@ -88,7 +88,7 @@ public struct TransitionStyleOperation: StyleOperation, @unchecked Sendable {
}
// Extension for Element to provide transition styling
-extension HTML {
+extension Markup {
/// Applies transition styling to the element.
///
/// Adds classes for animating properties with duration, easing, and delay.
@@ -106,7 +106,7 @@ extension HTML {
easing: Easing? = nil,
delay: Int? = nil,
on modifiers: Modifier...
- ) -> some HTML {
+ ) -> some Markup {
let params = TransitionStyleOperation.Parameters(
property: property,
duration: duration,
diff --git a/Sources/WebUI/Styles/Interactivity/CursorStyleOperation.swift b/Sources/WebUI/Styles/Interactivity/CursorStyleOperation.swift
index e75c1304..f9fb1ce3 100644
--- a/Sources/WebUI/Styles/Interactivity/CursorStyleOperation.swift
+++ b/Sources/WebUI/Styles/Interactivity/CursorStyleOperation.swift
@@ -38,10 +38,10 @@ public struct CursorStyleOperation: StyleOperation, @unchecked Sendable {
}
}
- /// Applies the cursor style and returns the appropriate CSS classes
+ /// Applies the cursor style and returns the appropriate stylesheet classes
///
/// - Parameter params: The parameters for cursor styling
- /// - Returns: An array of CSS class names to be applied to elements
+ /// - Returns: An array of stylesheet class names to be applied to elements
public func applyClasses(params: Parameters) -> [String] {
["cursor-\(params.type.rawValue)"]
}
@@ -54,7 +54,7 @@ public struct CursorStyleOperation: StyleOperation, @unchecked Sendable {
}
// Extension for Element to provide cursor styling
-extension HTML {
+extension Markup {
/// Sets the cursor style of the element with optional modifiers.
///
/// - Parameters:
@@ -73,7 +73,7 @@ extension HTML {
public func cursor(
_ type: CursorType,
on modifiers: Modifier...
- ) -> some HTML {
+ ) -> some Markup {
let params = CursorStyleOperation.Parameters(type: type)
return CursorStyleOperation.shared.applyTo(
diff --git a/Sources/WebUI/Styles/Layout/Display/DisplayStyleOperation.swift b/Sources/WebUI/Styles/Layout/Display/DisplayStyleOperation.swift
index 92c3300f..54ce1d84 100644
--- a/Sources/WebUI/Styles/Layout/Display/DisplayStyleOperation.swift
+++ b/Sources/WebUI/Styles/Layout/Display/DisplayStyleOperation.swift
@@ -28,10 +28,10 @@ public struct DisplayStyleOperation: StyleOperation, @unchecked Sendable {
}
}
- /// Applies the display style and returns the appropriate CSS classes
+ /// Applies the display style and returns the appropriate stylesheet classes
///
/// - Parameter params: The parameters for display styling
- /// - Returns: An array of CSS class names to be applied to elements
+ /// - Returns: An array of stylesheet class names to be applied to elements
public func applyClasses(params: Parameters) -> [String] {
["display-\(params.type.rawValue)"]
}
@@ -44,7 +44,7 @@ public struct DisplayStyleOperation: StyleOperation, @unchecked Sendable {
}
// Extension for Element to provide display styling
-extension HTML {
+extension Markup {
/// Sets the CSS display property with optional modifiers.
///
/// - Parameters:
@@ -66,7 +66,7 @@ extension HTML {
public func display(
_ type: DisplayType,
on modifiers: Modifier...
- ) -> some HTML {
+ ) -> some Markup {
let params = DisplayStyleOperation.Parameters(type: type)
return DisplayStyleOperation.shared.applyTo(
diff --git a/Sources/WebUI/Styles/Layout/Display/DisplayTypes.swift b/Sources/WebUI/Styles/Layout/Display/DisplayTypes.swift
index 21e9d6e1..440adf38 100644
--- a/Sources/WebUI/Styles/Layout/Display/DisplayTypes.swift
+++ b/Sources/WebUI/Styles/Layout/Display/DisplayTypes.swift
@@ -43,7 +43,7 @@ public enum Justify: String {
/// Distributes items with equal space between and around them.
case evenly
- /// Provides the raw CSS class value.
+ /// Provides the raw stylesheet class value.
public var rawValue: String { "justify-\(self)" }
}
diff --git a/Sources/WebUI/Styles/Layout/Display/FlexStyleOperation.swift b/Sources/WebUI/Styles/Layout/Display/FlexStyleOperation.swift
index 7c165ed5..7fe5e7e2 100644
--- a/Sources/WebUI/Styles/Layout/Display/FlexStyleOperation.swift
+++ b/Sources/WebUI/Styles/Layout/Display/FlexStyleOperation.swift
@@ -52,10 +52,10 @@ public struct FlexStyleOperation: StyleOperation, @unchecked Sendable {
}
}
- /// Applies the flex style and returns the appropriate CSS classes
+ /// Applies the flex style and returns the appropriate stylesheet classes
///
/// - Parameter params: The parameters for flex styling
- /// - Returns: An array of CSS class names to be applied to elements
+ /// - Returns: An array of stylesheet class names to be applied to elements
public func applyClasses(params: Parameters) -> [String] {
var classes: [String] = []
@@ -155,8 +155,8 @@ public enum FlexGrow: String {
case one = "1"
}
-// Extension for HTML to provide flex styling
-extension HTML {
+// Extension for Markup to provide flex styling
+extension Markup {
/// Sets flex container properties with optional modifiers.
///
/// - Parameters:
@@ -165,7 +165,7 @@ extension HTML {
/// - align: How to align items along the cross axis.
/// - grow: The flex grow factor.
/// - modifiers: Zero or more modifiers (e.g., `.hover`, `.md`) to scope the styles.
- /// - Returns: HTML with updated flex classes.
+ /// - Returns: Markup with updated flex classes.
///
/// ## Example
///
@@ -185,7 +185,7 @@ extension HTML {
align: FlexAlign? = nil,
grow: FlexGrow? = nil,
on modifiers: Modifier...
- ) -> some HTML {
+ ) -> some Markup {
let params = FlexStyleOperation.Parameters(
direction: direction,
justify: justify,
diff --git a/Sources/WebUI/Styles/Layout/Display/GridStyleOperation.swift b/Sources/WebUI/Styles/Layout/Display/GridStyleOperation.swift
index 1e258532..ca2f76cf 100644
--- a/Sources/WebUI/Styles/Layout/Display/GridStyleOperation.swift
+++ b/Sources/WebUI/Styles/Layout/Display/GridStyleOperation.swift
@@ -59,10 +59,10 @@ public struct GridStyleOperation: StyleOperation, @unchecked Sendable {
}
}
- /// Applies the grid style and returns the appropriate CSS classes
+ /// Applies the grid style and returns the appropriate stylesheet classes
///
/// - Parameter params: The parameters for grid styling
- /// - Returns: An array of CSS class names to be applied to elements
+ /// - Returns: An array of stylesheet class names to be applied to elements
public func applyClasses(params: Parameters) -> [String] {
var classes = ["grid"]
@@ -112,7 +112,7 @@ public enum GridFlow: String {
}
// Extension for HTML to provide grid styling
-extension HTML {
+extension Markup {
/// Sets grid container properties with optional modifiers.
///
/// - Parameters:
@@ -122,7 +122,7 @@ extension HTML {
/// - columnSpan: The column span value.
/// - rowSpan: The row span value.
/// - modifiers: Zero or more modifiers (e.g., `.hover`, `.md`) to scope the styles.
- /// - Returns: HTML with updated grid classes.
+ /// - Returns: Markup with updated grid classes.
///
/// ## Example
/// ```swift
@@ -142,7 +142,7 @@ extension HTML {
columnSpan: Int? = nil,
rowSpan: Int? = nil,
on modifiers: Modifier...
- ) -> some HTML {
+ ) -> some Markup {
let params = GridStyleOperation.Parameters(
columns: columns,
rows: rows,
diff --git a/Sources/WebUI/Styles/Layout/Display/VisibilityStyleOperation.swift b/Sources/WebUI/Styles/Layout/Display/VisibilityStyleOperation.swift
index abcfe582..8a1b1bc0 100644
--- a/Sources/WebUI/Styles/Layout/Display/VisibilityStyleOperation.swift
+++ b/Sources/WebUI/Styles/Layout/Display/VisibilityStyleOperation.swift
@@ -28,10 +28,10 @@ public struct VisibilityStyleOperation: StyleOperation, @unchecked Sendable {
}
}
- /// Applies the visibility style and returns the appropriate CSS classes
+ /// Applies the visibility style and returns the appropriate stylesheet classes
///
/// - Parameter params: The parameters for visibility styling
- /// - Returns: An array of CSS class names to be applied to elements
+ /// - Returns: An array of stylesheet class names to be applied to elements
public func applyClasses(params: Parameters) -> [String] {
if params.isHidden {
return ["hidden"]
@@ -48,13 +48,13 @@ public struct VisibilityStyleOperation: StyleOperation, @unchecked Sendable {
}
// Extension for HTML to provide visibility styling
-extension HTML {
+extension Markup {
/// Controls the visibility of an element with optional modifiers.
///
/// - Parameters:
/// - isHidden: Whether the element should be hidden (default: true).
/// - modifiers: Zero or more modifiers (e.g., `.hover`, `.md`) to scope the styles.
- /// - Returns: HTML with updated visibility classes.
+ /// - Returns: Markup with updated visibility classes.
///
/// ## Example
/// ```swift
@@ -73,7 +73,7 @@ extension HTML {
public func hidden(
_ isHidden: Bool = true,
on modifiers: Modifier...
- ) -> some HTML {
+ ) -> some Markup {
let params = VisibilityStyleOperation.Parameters(isHidden: isHidden)
return VisibilityStyleOperation.shared.applyTo(
@@ -88,7 +88,7 @@ extension HTML {
/// This provides SwiftUI-style conditional visibility syntax.
///
/// - Parameter condition: Boolean condition that determines whether to hide the element
- /// - Returns: HTML with conditional visibility applied
+ /// - Returns: Markup with conditional visibility applied
///
/// ## Example
/// ```swift
@@ -98,11 +98,11 @@ extension HTML {
/// Button("Save")
/// .hidden(when: !isEditing)
/// ```
- public func hidden(when condition: Bool) -> AnyHTML {
+ public func hidden(when condition: Bool) -> AnyMarkup {
if condition {
- return AnyHTML(hidden(true))
+ return AnyMarkup(hidden(true))
} else {
- return AnyHTML(self)
+ return AnyMarkup(self)
}
}
}
diff --git a/Sources/WebUI/Styles/Layout/MarginsStyleOperation.swift b/Sources/WebUI/Styles/Layout/MarginsStyleOperation.swift
index 3d99ba19..d955c916 100644
--- a/Sources/WebUI/Styles/Layout/MarginsStyleOperation.swift
+++ b/Sources/WebUI/Styles/Layout/MarginsStyleOperation.swift
@@ -45,10 +45,10 @@ public struct MarginsStyleOperation: StyleOperation, @unchecked Sendable {
}
}
- /// Applies the margin style and returns the appropriate CSS classes
+ /// Applies the margin style and returns the appropriate stylesheet classes
///
/// - Parameter params: The parameters for margin styling
- /// - Returns: An array of CSS class names to be applied
+ /// - Returns: An array of stylesheet class names to be applied
public func applyClasses(params: Parameters) -> [String] {
var classes: [String] = []
@@ -73,7 +73,7 @@ public struct MarginsStyleOperation: StyleOperation, @unchecked Sendable {
}
// Extension for HTML to provide margin styling
-extension HTML {
+extension Markup {
/// Applies margin styling to the element with one or more edges.
///
/// - Parameters:
@@ -81,13 +81,13 @@ extension HTML {
/// - edges: One or more edges to apply the margin to. Defaults to `.all`.
/// - auto: Whether to use automatic margins instead of a specific length.
/// - modifiers: Zero or more modifiers (e.g., `.hover`, `.md`) to scope the styles.
- /// - Returns: HTML with updated margin classes.
+ /// - Returns: Markup with updated margin classes.
public func margins(
of length: Int? = 4,
at edges: Edge...,
auto: Bool = false,
on modifiers: Modifier...
- ) -> some HTML {
+ ) -> some Markup {
let params = MarginsStyleOperation.Parameters(
length: length,
edges: edges,
diff --git a/Sources/WebUI/Styles/Layout/Overflow/OverflowStyleOperation.swift b/Sources/WebUI/Styles/Layout/Overflow/OverflowStyleOperation.swift
index 3fbac00d..28fde332 100644
--- a/Sources/WebUI/Styles/Layout/Overflow/OverflowStyleOperation.swift
+++ b/Sources/WebUI/Styles/Layout/Overflow/OverflowStyleOperation.swift
@@ -38,10 +38,10 @@ public struct OverflowStyleOperation: StyleOperation, @unchecked Sendable {
}
}
- /// Applies the overflow style and returns the appropriate CSS classes
+ /// Applies the overflow style and returns the appropriate stylesheet classes
///
/// - Parameter params: The parameters for overflow styling
- /// - Returns: An array of CSS class names to be applied to elements
+ /// - Returns: An array of stylesheet class names to be applied to elements
public func applyClasses(params: Parameters) -> [String] {
let axisString =
params.axis.rawValue.isEmpty ? "" : "-\(params.axis.rawValue)"
@@ -56,7 +56,7 @@ public struct OverflowStyleOperation: StyleOperation, @unchecked Sendable {
}
// Extension for Element to provide overflow styling
-extension HTML {
+extension Markup {
/// Applies overflow styling to the element.
///
/// Sets how overflowing content is handled, optionally on a specific axis and with modifiers.
@@ -81,7 +81,7 @@ extension HTML {
_ type: OverflowType,
axis: Axis = .both,
on modifiers: Modifier...
- ) -> some HTML {
+ ) -> some Markup {
let params = OverflowStyleOperation.Parameters(
type: type,
axis: axis
diff --git a/Sources/WebUI/Styles/Layout/PaddingStyleOperation.swift b/Sources/WebUI/Styles/Layout/PaddingStyleOperation.swift
index bb651a88..1bda0464 100644
--- a/Sources/WebUI/Styles/Layout/PaddingStyleOperation.swift
+++ b/Sources/WebUI/Styles/Layout/PaddingStyleOperation.swift
@@ -38,10 +38,10 @@ public struct PaddingStyleOperation: StyleOperation, @unchecked Sendable {
}
}
- /// Applies the padding style and returns the appropriate CSS classes
+ /// Applies the padding style and returns the appropriate stylesheet classes
///
/// - Parameter params: The parameters for padding styling
- /// - Returns: An array of CSS class names to be applied
+ /// - Returns: An array of stylesheet class names to be applied
public func applyClasses(params: Parameters) -> [String] {
var classes: [String] = []
@@ -65,7 +65,7 @@ public struct PaddingStyleOperation: StyleOperation, @unchecked Sendable {
}
// Extension for HTML to provide padding styling
-extension HTML {
+extension Markup {
/// Applies padding styling to the element with one or more edges.
///
/// - Parameters:
@@ -77,7 +77,7 @@ extension HTML {
of length: Int? = 4,
at edges: Edge...,
on modifiers: Modifier...
- ) -> some HTML {
+ ) -> some Markup {
let params = PaddingStyleOperation.Parameters(
length: length,
edges: edges
diff --git a/Sources/WebUI/Styles/Layout/Position/PositionStyleOperation.swift b/Sources/WebUI/Styles/Layout/Position/PositionStyleOperation.swift
index 71a5731e..512653d2 100644
--- a/Sources/WebUI/Styles/Layout/Position/PositionStyleOperation.swift
+++ b/Sources/WebUI/Styles/Layout/Position/PositionStyleOperation.swift
@@ -45,10 +45,10 @@ public struct PositionStyleOperation: StyleOperation, @unchecked Sendable {
}
}
- /// Applies the position style and returns the appropriate CSS classes
+ /// Applies the position style and returns the appropriate stylesheet classes
///
/// - Parameter params: The parameters for position styling
- /// - Returns: An array of CSS class names to be applied to elements
+ /// - Returns: An array of stylesheet class names to be applied to elements
public func applyClasses(params: Parameters) -> [String] {
var classes: [String] = []
@@ -88,7 +88,7 @@ public struct PositionStyleOperation: StyleOperation, @unchecked Sendable {
}
// Extension for Element to provide position styling
-extension HTML {
+extension Markup {
/// Applies positioning styling to the element with one or more edges.
///
/// Sets the position type and optional inset values for specified edges, scoped to modifiers if provided.
@@ -104,7 +104,7 @@ extension HTML {
at edges: Edge...,
offset length: Int? = nil,
on modifiers: Modifier...
- ) -> some HTML {
+ ) -> some Markup {
let params = PositionStyleOperation.Parameters(
type: type,
edges: edges,
diff --git a/Sources/WebUI/Styles/Layout/Scroll/ScrollStyleOperation.swift b/Sources/WebUI/Styles/Layout/Scroll/ScrollStyleOperation.swift
index 11858fa0..33bc9c76 100644
--- a/Sources/WebUI/Styles/Layout/Scroll/ScrollStyleOperation.swift
+++ b/Sources/WebUI/Styles/Layout/Scroll/ScrollStyleOperation.swift
@@ -66,10 +66,10 @@ public struct ScrollStyleOperation: StyleOperation, @unchecked Sendable {
}
}
- /// Applies the scroll style and returns the appropriate CSS classes
+ /// Applies the scroll style and returns the appropriate stylesheet classes
///
/// - Parameter params: The parameters for scroll styling
- /// - Returns: An array of CSS class names to be applied to elements
+ /// - Returns: An array of stylesheet class names to be applied to elements
public func applyClasses(params: Parameters) -> [String] {
var classes: [String] = []
@@ -146,10 +146,10 @@ public struct ScrollStyleOperation: StyleOperation, @unchecked Sendable {
}
// Extension for Element to provide scroll styling
-extension HTML {
+extension Markup {
/// Applies scroll-related styles to the element.
///
- /// Adds Tailwind CSS classes for scroll behavior, margin, padding, and snap properties.
+ /// Adds Tailwind stylesheet classes for scroll behavior, margin, padding, and snap properties.
///
/// - Parameters:
/// - behavior: Sets the scroll behavior (smooth or auto).
@@ -168,7 +168,7 @@ extension HTML {
snapStop: ScrollSnapStop? = nil,
snapType: ScrollSnapType? = nil,
on modifiers: Modifier...
- ) -> some HTML {
+ ) -> some Markup {
let params = ScrollStyleOperation.Parameters(
behavior: behavior,
margin: margin,
diff --git a/Sources/WebUI/Styles/Layout/Sizing/SizingStyleOperation.swift b/Sources/WebUI/Styles/Layout/Sizing/SizingStyleOperation.swift
index d9341be0..483fec73 100644
--- a/Sources/WebUI/Styles/Layout/Sizing/SizingStyleOperation.swift
+++ b/Sources/WebUI/Styles/Layout/Sizing/SizingStyleOperation.swift
@@ -134,10 +134,10 @@ public struct SizingStyleOperation: StyleOperation, @unchecked Sendable {
}
}
- /// Applies the frame style and returns the appropriate CSS classes
+ /// Applies the frame style and returns the appropriate stylesheet classes
///
/// - Parameter params: The parameters for frame styling
- /// - Returns: An array of CSS class names to be applied to elements
+ /// - Returns: An array of stylesheet class names to be applied to elements
public func applyClasses(params: FrameParameters) -> [String] {
var classes: [String] = []
@@ -159,18 +159,18 @@ public struct SizingStyleOperation: StyleOperation, @unchecked Sendable {
return classes
}
- /// Applies the size style and returns the appropriate CSS classes
+ /// Applies the size style and returns the appropriate stylesheet classes
///
/// - Parameter params: The parameters for size styling
- /// - Returns: An array of CSS class names to be applied to elements
+ /// - Returns: An array of stylesheet class names to be applied to elements
public func applySizeClasses(params: SizeParameters) -> [String] {
["size-\(params.value.rawValue)"]
}
- /// Applies the aspect ratio style and returns the appropriate CSS classes
+ /// Applies the aspect ratio style and returns the appropriate stylesheet classes
///
/// - Parameter params: The parameters for aspect ratio styling
- /// - Returns: An array of CSS class names to be applied to elements
+ /// - Returns: An array of stylesheet class names to be applied to elements
public func applyAspectRatioClasses(params: AspectRatioParameters)
-> [String]
{
@@ -193,7 +193,7 @@ public struct SizingStyleOperation: StyleOperation, @unchecked Sendable {
}
// Extension for Element to provide sizing and layout styling
-extension HTML {
+extension Markup {
/// Sets the width and height of the element with comprehensive SwiftUI-like API.
///
/// This method provides control over all width and height properties, supporting
@@ -217,7 +217,7 @@ extension HTML {
minHeight: SizingValue? = nil,
maxHeight: SizingValue? = nil,
on modifiers: Modifier...
- ) -> some HTML {
+ ) -> some Markup {
let params = SizingStyleOperation.FrameParameters(
width: width,
height: height,
@@ -253,7 +253,7 @@ extension HTML {
maxWidth: Double? = nil,
minHeight: Double? = nil,
maxHeight: Double? = nil
- ) -> some HTML {
+ ) -> some Markup {
frame(
width: width.map { .spacing(Int($0)) },
height: height.map { .spacing(Int($0)) },
@@ -273,7 +273,7 @@ extension HTML {
/// - modifiers: Zero or more modifiers to scope the styles.
/// - Returns: A new element with updated sizing classes.
public func size(_ size: SizingValue, on modifiers: Modifier...)
- -> some HTML
+ -> some Markup
{
let params = SizingStyleOperation.SizeParameters(value: size)
let classes = SizingStyleOperation.shared.applySizeClasses(
@@ -294,7 +294,7 @@ extension HTML {
/// - Returns: A new element with aspect ratio classes.
public func aspectRatio(
_ width: Double, _ height: Double, on modifiers: Modifier...
- ) -> some HTML {
+ ) -> some Markup {
let params = SizingStyleOperation.AspectRatioParameters(
width: width, height: height)
let classes = SizingStyleOperation.shared.applyAspectRatioClasses(
@@ -309,7 +309,7 @@ extension HTML {
/// - Parameters:
/// - modifiers: Zero or more modifiers to scope the styles.
/// - Returns: A new element with square aspect ratio.
- public func aspectRatio(on modifiers: Modifier...) -> some HTML {
+ public func aspectRatio(on modifiers: Modifier...) -> some Markup {
let params = SizingStyleOperation.AspectRatioParameters(isSquare: true)
let classes = SizingStyleOperation.shared.applyAspectRatioClasses(
params: params)
@@ -323,7 +323,7 @@ extension HTML {
/// - Parameters:
/// - modifiers: Zero or more modifiers to scope the styles.
/// - Returns: A new element with video aspect ratio.
- public func aspectRatioVideo(on modifiers: Modifier...) -> some HTML {
+ public func aspectRatioVideo(on modifiers: Modifier...) -> some Markup {
let params = SizingStyleOperation.AspectRatioParameters(isVideo: true)
let classes = SizingStyleOperation.shared.applyAspectRatioClasses(
params: params)
diff --git a/Sources/WebUI/Styles/Layout/SpacingStyleOperation.swift b/Sources/WebUI/Styles/Layout/SpacingStyleOperation.swift
index 933a276e..ff9ca1af 100644
--- a/Sources/WebUI/Styles/Layout/SpacingStyleOperation.swift
+++ b/Sources/WebUI/Styles/Layout/SpacingStyleOperation.swift
@@ -38,10 +38,10 @@ public struct SpacingStyleOperation: StyleOperation, @unchecked Sendable {
}
}
- /// Applies the spacing style and returns the appropriate CSS classes
+ /// Applies the spacing style and returns the appropriate stylesheet classes
///
/// - Parameter params: The parameters for spacing styling
- /// - Returns: An array of CSS class names to be applied
+ /// - Returns: An array of stylesheet class names to be applied
public func applyClasses(params: Parameters) -> [String] {
guard let length = params.length else {
return []
@@ -65,19 +65,19 @@ public struct SpacingStyleOperation: StyleOperation, @unchecked Sendable {
}
// Extension for HTML to provide spacing styling
-extension HTML {
+extension Markup {
/// Applies spacing between child elements horizontally and/or vertically.
///
/// - Parameters:
/// - length: The spacing value in `0.25rem` increments.
/// - direction: The direction(s) to apply spacing (`horizontal`, `vertical`, or both).
/// - modifiers: Zero or more modifiers (e.g., `.hover`, `.md`) to scope the styles.
- /// - Returns: HTML with updated spacing classes.
+ /// - Returns: Markup with updated spacing classes.
public func spacing(
of length: Int? = 4,
along direction: Axis = .both,
on modifiers: Modifier...
- ) -> some HTML {
+ ) -> some Markup {
let params = SpacingStyleOperation.Parameters(
length: length,
axis: direction
diff --git a/Sources/WebUI/Styles/Layout/ZIndexStyleOperation.swift b/Sources/WebUI/Styles/Layout/ZIndexStyleOperation.swift
index d1f421a1..ecbe940a 100644
--- a/Sources/WebUI/Styles/Layout/ZIndexStyleOperation.swift
+++ b/Sources/WebUI/Styles/Layout/ZIndexStyleOperation.swift
@@ -28,10 +28,10 @@ public struct ZIndexStyleOperation: StyleOperation, @unchecked Sendable {
}
}
- /// Applies the z-index style and returns the appropriate CSS classes
+ /// Applies the z-index style and returns the appropriate stylesheet classes
///
/// - Parameter params: The parameters for z-index styling
- /// - Returns: An array of CSS class names to be applied to elements
+ /// - Returns: An array of stylesheet class names to be applied to elements
public func applyClasses(params: Parameters) -> [String] {
["z-\(params.value)"]
}
@@ -44,7 +44,7 @@ public struct ZIndexStyleOperation: StyleOperation, @unchecked Sendable {
}
// Extension for HTML to provide z-index styling
-extension HTML {
+extension Markup {
/// Applies a z-index to the element.
///
/// Sets the stacking order of the element, optionally scoped to modifiers.
@@ -52,7 +52,7 @@ extension HTML {
/// - Parameters:
/// - value: Specifies the z-index value as an integer.
/// - modifiers: Zero or more modifiers (e.g., `.hover`, `.md`) to scope the styles.
- /// - Returns: HTML with updated z-index classes.
+ /// - Returns: Markup with updated z-index classes.
///
/// ## Example
/// ```swift
@@ -67,7 +67,7 @@ extension HTML {
public func zIndex(
_ value: Int,
on modifiers: Modifier...
- ) -> some HTML {
+ ) -> some Markup {
let params = ZIndexStyleOperation.Parameters(value: value)
return ZIndexStyleOperation.shared.applyTo(
diff --git a/Sources/WebUI/Styles/Responsive/ResponsiveModifier.swift b/Sources/WebUI/Styles/Responsive/ResponsiveModifier.swift
index a0aa4c6d..d5e786ab 100644
--- a/Sources/WebUI/Styles/Responsive/ResponsiveModifier.swift
+++ b/Sources/WebUI/Styles/Responsive/ResponsiveModifier.swift
@@ -52,34 +52,34 @@ extension Element {
/// }
/// }
/// ```
- public func on(@ResponsiveStyleBuilder _ content: () -> ResponsiveModification) -> some HTML {
+ public func on(@ResponsiveStyleBuilder _ content: () -> ResponsiveModification) -> some Markup {
let builder = ResponsiveBuilder(element: self)
let modification = content()
modification.apply(to: builder)
- return HTMLString(content: builder.element.render())
+ return MarkupString(content: builder.element.render())
}
}
-extension HTML {
+extension Markup {
/// Applies responsive styling across different breakpoints with a declarative syntax.
///
/// This method provides a clean, declarative way to define styles for multiple
/// breakpoints in a single block, improving code readability and maintainability.
///
/// - Parameter content: A closure defining responsive style configurations using the result builder.
- /// - Returns: An HTML element with responsive styles applied.
- public func on(@ResponsiveStyleBuilder _ content: () -> ResponsiveModification) -> AnyHTML {
- // Wrap HTML in an Element to use responsive functionality
- let elementWrapper = HTMLElementWrapper(self)
+ /// - Returns: A markup element with responsive styles applied.
+ public func on(@ResponsiveStyleBuilder _ content: () -> ResponsiveModification) -> AnyMarkup {
+ // Wrap Markup in an Element to use responsive functionality
+ let elementWrapper = MarkupElementWrapper(self)
let builder = ResponsiveBuilder(element: elementWrapper)
let modification = content()
modification.apply(to: builder)
- return AnyHTML(HTMLString(content: builder.element.render()))
+ return AnyMarkup(MarkupString(content: builder.element.render()))
}
}
-/// A wrapper that converts HTML to Element for responsive functionality
-private struct HTMLElementWrapper`, `
`, ` & goodbye"
- /// let content: [any HTML] = [
+ /// let content: [any Markup] = [
/// userInput,
/// Heading(.one) { "Title" }
/// ]
/// ```
public func render() -> String { self }
- /// Sanitizes strings for use in CSS variable names.
+ /// Sanitizes strings for use in stylesheet variable names.
///
- /// Converts a string into a valid CSS variable name by replacing invalid characters
+ /// Converts a string into a valid stylesheet variable name by replacing invalid characters
/// with hyphens and converting to lowercase, ensuring the result is compliant with
- /// CSS naming conventions.
+ /// stylesheet naming conventions.
///
- /// - Returns: A sanitized string suitable for use as a CSS variable name.
+ /// - Returns: A sanitized string suitable for use as a stylesheet variable name.
///
/// - Example:
/// ```swift
/// let rawName = "Button Color!"
- /// let cssName = rawName.sanitizedForCSS() // Returns "button-color-"
- /// let css = "--\(cssName): blue;"
+ /// let styleName = rawName.sanitizedForStyleSheet() // Returns "button-color-"
+ /// let css = "--\(styleName): blue;"
/// ```
- public func sanitizedForCSS() -> String {
+ public func sanitizedForStyleSheet() -> String {
self.replacingOccurrences(
of: "[^a-zA-Z0-9-]", with: "-", options: .regularExpression
)
@@ -66,4 +66,15 @@ extension String: HTML {
.joined(separator: "-")
.trimmingCharacters(in: .whitespaces)
}
+
+ // MARK: - Backward Compatibility
+
+ /// Backward compatibility alias for `sanitizedForStyleSheet()`.
+ ///
+ /// - Deprecated: Use `sanitizedForStyleSheet()` instead.
+ /// - Returns: A sanitized string suitable for use as a stylesheet variable name.
+ @available(*, deprecated, message: "Use sanitizedForStyleSheet() instead")
+ public func sanitizedForCSS() -> String {
+ return sanitizedForStyleSheet()
+ }
}
diff --git a/Sources/WebUIMarkdown/HTMLRenderer.swift b/Sources/WebUIMarkdown/HTMLRenderer.swift
index 238b2881..b6851600 100644
--- a/Sources/WebUIMarkdown/HTMLRenderer.swift
+++ b/Sources/WebUIMarkdown/HTMLRenderer.swift
@@ -1,12 +1,12 @@
-/// A renderer that converts a Markdown Abstract Syntax Tree (AST) into HTML.
+/// A renderer that converts a Markdown Abstract Syntax Tree (AST) into markup.
///
/// `HtmlRenderer` walks through the Markdown document structure and generates appropriate
-/// HTML tags for each Markdown element, with special handling for links, code blocks,
+/// markup tags for each Markdown element, with special handling for links, code blocks,
/// and other formatting constructs.
-/// A renderer that converts a Markdown Abstract Syntax Tree (AST) into HTML with configurable code block rendering options.
+/// A renderer that converts a Markdown Abstract Syntax Tree (AST) into markup with configurable code block rendering options.
///
/// `HtmlRenderer` walks through the Markdown document structure and generates appropriate
-/// HTML tags for each Markdown element, with special handling for links, code blocks,
+/// markup tags for each Markdown element, with special handling for links, code blocks,
/// and other formatting constructs. Code block rendering features such as syntax highlighting,
/// filename display, copy button, and line numbers can be enabled or disabled via boolean flags.
///
diff --git a/Sources/WebUIMarkdown/WebUIMarkdown.swift b/Sources/WebUIMarkdown/WebUIMarkdown.swift
index f983fd65..ac3807c9 100644
--- a/Sources/WebUIMarkdown/WebUIMarkdown.swift
+++ b/Sources/WebUIMarkdown/WebUIMarkdown.swift
@@ -3,11 +3,11 @@ import Markdown
/// A module for parsing and rendering Markdown content with front matter support.
///
-/// This module provides functionality to transform Markdown text into HTML and extract
+/// This module provides functionality to transform Markdown text into markup and extract
/// front matter metadata, making it suitable for content-driven websites and applications.
/// A module for parsing and rendering Markdown content with front matter support and configurable code block rendering.
///
-/// This module provides functionality to transform Markdown text into HTML and extract
+/// This module provides functionality to transform Markdown text into markup and extract
/// front matter metadata, making it suitable for content-driven websites and applications.
/// Code block rendering features such as syntax highlighting, filename display, copy button,
/// and line numbers can be enabled or disabled via boolean flags.
diff --git a/Tests/WebUITests/Core/DocumentTests.swift b/Tests/WebUITests/Core/DocumentTests.swift
index 98b62a31..ae20b7d8 100644
--- a/Tests/WebUITests/Core/DocumentTests.swift
+++ b/Tests/WebUITests/Core/DocumentTests.swift
@@ -15,7 +15,7 @@ struct NoDescriptionDocument: Document {
)
}
- var body: some HTML {
+ var body: some Markup {
Text("Test content")
}
}
@@ -31,7 +31,7 @@ struct BasicTestDocument: Document {
)
}
- var body: some HTML {
+ var body: some Markup {
Text("Hello, world!")
}
}
@@ -55,7 +55,7 @@ struct FullMetadataDocument: Document {
)
}
- var body: some HTML {
+ var body: some Markup {
Text("Content")
}
}
@@ -75,7 +75,7 @@ struct FaviconTestDocument: Document {
)
}
- var body: some HTML {
+ var body: some Markup {
Text("Favicon Test")
}
}
@@ -97,7 +97,7 @@ struct StructuredDataDocument: Document {
)
}
- var body: some HTML {
+ var body: some Markup {
Text("Structured Data Test")
}
}
@@ -121,7 +121,7 @@ struct ScriptTestDocument: Document {
]
}
- var body: some HTML {
+ var body: some Markup {
Text("Script Test")
}
}
@@ -142,7 +142,7 @@ struct StylesheetTestDocument: Document {
]
}
- var body: some HTML {
+ var body: some Markup {
Text("Stylesheet Test")
}
}
@@ -163,7 +163,7 @@ struct CustomHeadDocument: Document {
"""
}
- var body: some HTML {
+ var body: some Markup {
Text("Custom Head Test")
}
}
diff --git a/Tests/WebUITests/Core/MetadataTests.swift b/Tests/WebUITests/Core/MetadataTests.swift
index ef86c8f3..259a3776 100644
--- a/Tests/WebUITests/Core/MetadataTests.swift
+++ b/Tests/WebUITests/Core/MetadataTests.swift
@@ -242,7 +242,7 @@ struct MetadataTests {
#expect(articleData.type == .article)
- let json = articleData.toJSON()
+ let json = articleData.convertToJsonString()
#expect(json.contains("\"@context\":\"https://schema.org\""))
#expect(json.contains("\"@type\":\"Article\""))
#expect(json.contains("\"headline\":\"Test Article\""))
@@ -267,7 +267,7 @@ struct MetadataTests {
#expect(productData.type == .product)
- let json = productData.toJSON()
+ let json = productData.convertToJsonString()
#expect(json.contains("\"@type\":\"Product\""))
#expect(json.contains("\"name\":\"Test Product\""))
#expect(
@@ -288,7 +288,7 @@ struct MetadataTests {
#expect(faqData.type == .faqPage)
- let json = faqData.toJSON()
+ let json = faqData.convertToJsonString()
#expect(json.contains("\"@type\":\"FAQPage\""))
#expect(json.contains("\"@type\":\"Question\""))
#expect(json.contains("\"name\":\"What is this?\""))
@@ -301,7 +301,7 @@ struct MetadataTests {
let structuredData = StructuredData.organization(
name: "Test Org",
logo: "https://example.com/logo.png",
- url: "https://example.com"
+ webAddress: "https://example.com"
)
let metadata = Metadata(
@@ -336,7 +336,7 @@ struct MetadataTests {
jobTitle: "Software Engineer",
email: "jane@example.com",
telephone: "+1-555-123-4567",
- url: "https://janedoe.example.com",
+ webAddress: "https://janedoe.example.com",
address: [
"streetAddress": "123 Main St",
"addressLocality": "Anytown",
@@ -351,7 +351,7 @@ struct MetadataTests {
#expect(personData.type == .person)
- let json = personData.toJSON()
+ let json = personData.convertToJsonString()
#expect(json.contains("\"@context\":\"https://schema.org\""))
#expect(json.contains("\"@type\":\"Person\""))
#expect(json.contains("\"name\":\"Jane Doe\""))
diff --git a/Tests/WebUITests/Core/WebsiteTests.swift b/Tests/WebUITests/Core/WebsiteTests.swift
index 7cc0baa3..13f12c20 100644
--- a/Tests/WebUITests/Core/WebsiteTests.swift
+++ b/Tests/WebUITests/Core/WebsiteTests.swift
@@ -9,18 +9,18 @@ import Testing
struct PageLayout: Element {
var title: String
var description: String
- var content: HTMLContentBuilder
+ var content: MarkupContentBuilder
init(
title: String, description: String,
- @HTMLBuilder content: @escaping HTMLContentBuilder
+ @MarkupBuilder content: @escaping MarkupContentBuilder
) {
self.title = title
self.description = description
self.content = content
}
- var body: some HTML {
+ var body: some Markup {
BodyWrapper {
Header {
Stack {
@@ -48,7 +48,7 @@ struct PageLayout: Element {
.padding()
.margins(at: .bottom)
- HTMLString(content: content().map { $0.render() }.joined())
+ MarkupString(content: content().map { $0.render() }.joined())
}
.padding()
.margins(at: .horizontal, auto: true)
@@ -87,7 +87,7 @@ struct ProjectCard: Element {
var imageUrl: String
var link: String
- var body: some HTML {
+ var body: some Markup {
Stack {
Image(
source: imageUrl, description: title,
@@ -141,7 +141,7 @@ struct ExperienceItem: Element {
var period: String
var description: String
- var body: some HTML {
+ var body: some Markup {
Stack {
Heading(.headline, role)
Text(company)
@@ -154,7 +154,7 @@ struct SkillCategory: Element {
var category: String
var skills: [String]
- var body: some HTML {
+ var body: some Markup {
Stack {
Heading(.subheadline, category)
Stack {
@@ -167,7 +167,7 @@ struct SkillCategory: Element {
}
struct ContactForm: Element {
- var body: some HTML {
+ var body: some Markup {
Form(action: "/submit", method: .post) {
Stack {
Label(for: "name") { "Name" }
@@ -193,7 +193,7 @@ struct HomePage: Document {
)
}
- var body: some HTML {
+ var body: some Markup {
PageLayout(
title: "Welcome to My Portfolio",
description:
@@ -284,7 +284,7 @@ struct AboutPage: Document {
)
}
- var body: some HTML {
+ var body: some Markup {
PageLayout(
title: "About Me",
description: "Learn about my background, skills, and experience"
@@ -384,7 +384,7 @@ struct ProjectsPage: Document {
)
}
- var body: some HTML {
+ var body: some Markup {
PageLayout(
title: "My Projects",
description: "A showcase of my recent work and projects"
@@ -468,7 +468,7 @@ struct ContactPage: Document {
[Script(src: "/js/contact-form.js", attribute: .defer)]
}
- var body: some HTML {
+ var body: some Markup {
PageLayout(
title: "Contact Me",
description:
@@ -579,7 +579,7 @@ struct Portfolio: Website {
ContactPage()
}
- var baseURL: String? {
+ var baseWebAddress: String? {
"https://janedoe.dev"
}
@@ -638,7 +638,7 @@ struct ComprehensiveWebsiteTests {
#expect(portfolio.metadata.site == "Jane Doe")
#expect(portfolio.routes.count == 4)
- #expect(portfolio.baseURL == "https://janedoe.dev")
+ #expect(portfolio.baseWebAddress == "https://janedoe.dev")
#expect(portfolio.sitemapEntries?.count == 2)
#expect(portfolio.robotsRules?.count == 2)
diff --git a/Tests/WebUITests/ElementTests.swift b/Tests/WebUITests/ElementTests.swift
index 68b20090..36408773 100644
--- a/Tests/WebUITests/ElementTests.swift
+++ b/Tests/WebUITests/ElementTests.swift
@@ -1361,7 +1361,7 @@ import Testing
@Test("Conditional modifier - type erasure works correctly")
func testConditionalModifierTypeErasure() async throws {
- // This test ensures that the AnyHTML type erasure doesn't break functionality
+ // This test ensures that the AnyMarkup type erasure doesn't break functionality
let elements = [
Text("First").if(true) { $0.addClass("first") },
Text("Second").hidden(when: false),
diff --git a/Tests/WebUITests/Styles/StyleModifiersTests.swift b/Tests/WebUITests/Styles/StyleModifiersTests.swift
index cc0464e5..6c0f4117 100644
--- a/Tests/WebUITests/Styles/StyleModifiersTests.swift
+++ b/Tests/WebUITests/Styles/StyleModifiersTests.swift
@@ -753,7 +753,7 @@ import Testing
.init(title: "Hello")
}
- var body: some HTML {
+ var body: some Markup {
Text("Hello")
.on {
md {
@@ -767,7 +767,7 @@ import Testing
}
// FIXME: If possible remove `S.` prefix
struct TestElement: Element {
- var body: some HTML {
+ var body: some Markup {
Text("Hello")
.on {
md {