Releases: coenttb/swift-html
Releases · coenttb/swift-html
swift-html 0.1.0
swift-html 0.1.0
Major Features
🌙 Comprehensive Dark Mode Support
- Added dark mode convenience methods for all CSS color properties (24+ properties)
- Automatic dark color generation when not explicitly provided
- Proper media query handling with
@media (prefers-color-scheme: dark)
New Features
- Color type - Type-safe color handling with built-in dark mode support
- Enhanced color API - Better disambiguation and improved usability
- Button conveniences - Added
.submitconvenience method - Comprehensive test suite - 40+ tests covering all dark mode functionality
CSS Properties with Dark Mode Support
- All border colors (block, inline, directional)
- Text colors (color, decoration, emphasis)
- Background and accent colors
- SVG colors (fill, stroke, lighting, flood, stop)
- UI colors (caret, outline, column-rule)
Developer Experience
- Fixed compiler warnings for better Swift compatibility
- Improved API design and documentation
- Enhanced type safety across the codebase
Example Usage
// Define custom colors with dark mode support
extension Color {
static let brand = Color(light: .hex("007AFF"), dark: .hex("0A84FF"))
static let surface = Color(light: .white, dark: .hex("1C1C1E"))
}
// Use them seamlessly in your HTML
HTMLDocument {
div {
H1 { "Hello World" }
.color(.brand) // Uses both light & dark automatically
.backgroundColor(.surface)
p { "Traditional syntax also works" }
.color(light: .blue, dark: .lightBlue)
}
}This release significantly enhances the dark mode capabilities of swift-html, making it easy to create responsive designs that automatically adapt to user preferences.
swift-html 0.0.1
swift-html 0.0.1
🎉 Initial Release
The first official release of swift-html - your entry point into type-safe web development in Swift.
✨ Features
- Type-safe HTML elements - All HTML elements as strongly-typed Swift types
- Compile-time CSS validation - Catch styling errors before runtime
- Dark mode support - First-class support for light/dark color schemes
- SwiftUI-like syntax - Familiar patterns for Swift developers
- High-performance rendering - Direct byte-level rendering for servers
- Comprehensive documentation - Full DocC documentation with examples
- Testing utilities - Integration with Swift Testing and inline snapshots
📦 Installation
Add to your Package.swift:
dependencies: [
.package(url: "https://github.com/coenttb/swift-html", from: "0.0.1")
]🚀 Quick Start
import HTML
let page = HTMLDocument {
div {
h1 { "Welcome to swift-html" }
.color(.systemBlue)
p { "Type-safe web development in Swift" }
}
.padding(.rem(2))
} head: {
title { "My Page" }
}
let html = try String(page)📚 Documentation
See the comprehensive documentation for detailed guides and examples.
🌟 Example
Check out coenttb.com - a production website built 100% with swift-html.