Integration layer combining HTML types, CSS types, and PointFree HTML rendering for type-safe web development.
This package provides the integration layer that bridges:
- swift-html-types - Type definitions for HTML elements and attributes
- swift-css-types - Type definitions for CSS properties and values
- pointfree-html - HTML rendering engine
It serves as the foundational PointFree HTML integration layer for the swift-html package.
- PointFree HTML extensions for HTML elements (HTMLElements+PointFreeHTML)
- PointFree HTML extensions for HTML attributes (HTMLAttributes+PointFreeHTML)
- PointFree HTML extensions for CSS properties (CSS+PointFreeHTML)
- Combined HTML and CSS functionality (HTML+CSS+PointFreeHTML)
- Type-safe CSS property application on HTML elements
- Media query support for responsive design
- Pseudo-class support for interactive styling
Use coenttb/swift-html instead. The swift-html package provides a complete, developer-friendly API for building type-safe HTML and CSS in Swift.
If you need to use this integration layer directly:
dependencies: [
.package(url: "https://github.com/coenttb/swift-html-css-pointfree", from: "0.0.1")
]Then add the appropriate module to your target dependencies:
.target(
name: "YourTarget",
dependencies: [
.product(name: "HTMLCSSPointFreeHTML", package: "swift-html-css-pointfree"),
// Or specific modules:
// .product(name: "CSSPointFreeHTML", package: "swift-html-css-pointfree"),
// .product(name: "HTMLElementsPointFreeHTML", package: "swift-html-css-pointfree"),
// .product(name: "HTMLAttributesPointFreeHTML", package: "swift-html-css-pointfree"),
]
)import HTMLCSSPointFreeHTML
import PointFreeHTML
let document = HTMLDocument {
ContentDivision {
"Hello World"
}
.color(.red)
.backgroundColor(.hex("F0F0F0"))
}
let html = String(bytes: document.render(), encoding: .utf8)!import HTMLCSSPointFreeHTML
// Apply color with type safety
let styledDiv = ContentDivision {
"Styled content"
}
.color(.blue)
.fontSize(.px(16))
.padding(.rem(1))// Responsive styling
let responsiveDiv = ContentDivision {
"Responsive content"
}
.padding(.rem(1), media: .mobile)
.padding(.rem(2), media: .tablet)
.padding(.rem(3), media: .desktop)// Interactive styling
let interactiveLink = Anchor(href: "/path") {
"Hover me"
}
.color(.blue)
.color(.red, pseudo: .hover)let complexElement = ContentDivision {
Paragraph {
"Complex styling"
}
.color(.named(.darkblue))
.fontSize(.px(18))
}
.backgroundColor(.hex("FFFFFF"))
.padding(.rem(2))
.margin(.px(10))- CSSPointFreeHTML - CSS property extensions for PointFree HTML elements
- HTMLElementsPointFreeHTML - HTML element definitions with PointFree HTML support
- HTMLAttributesPointFreeHTML - HTML attribute extensions for PointFree HTML
- HTMLCSSPointFreeHTML - Combined HTML+CSS functionality (umbrella module)
HTMLCSSPointFreeHTML
├── CSSPointFreeHTML
│ ├── swift-css-types (CSSTypes)
│ └── pointfree-html (PointFreeHTML)
├── HTMLElementsPointFreeHTML
│ ├── swift-html-types (HTMLElementTypes)
│ ├── HTMLAttributesPointFreeHTML
│ └── pointfree-html (PointFreeHTML)
└── HTMLAttributesPointFreeHTML
├── swift-html-types (HTMLAttributeTypes)
└── pointfree-html (PointFreeHTML)
- pointfree-html: A fork of pointfreeco/swift-html with extended functionality.
- swift-css-types: A Swift package with foundational types for CSS.
- swift-html-types: A Swift package with foundational types for HTML.
- coenttb-web: A Swift package with tools for web development building on swift-web.
- swift-html: The Swift library for domain-accurate and type-safe HTML & CSS.
This project is licensed under the Apache 2.0 License. See LICENSE for details.
Contributions are welcome. Please submit a Pull Request or open an issue.