Releases: coenttb/swift-html
v0.12.1 - Dependency Fix
Fix
- Changed swift-css dependency from local path to versioned URL (
from: "0.3.0")
This fixes the dependency resolution error when using swift-html as a package dependency.
Full Changelog: 0.12.0...0.12.1
v0.12.0 - CSS Code Extraction to swift-css
v0.12.0 - CSS Code Extraction to swift-css
This release represents a major architectural change that extracts CSS-related code from swift-html into the dedicated swift-css package. This creates a cleaner separation of concerns and enables CSS functionality to be used independently of HTML.
⚠️ Breaking Changes
Dependency Changes
You now need to add swift-css as a dependency to access CSS functionality:
.package(url: "https://github.com/coenttb/swift-css", from: "0.3.0")Import Changes
// Before (0.11.x)
import HTML
// After (0.12.0)
import HTML
import CSS // For core CSS functionality
import CSS_Theming // For themed colors with dark mode🗑️ Removed from swift-html
The following code has been moved to swift-css:
Color System (6 files)
| File | New Location |
|---|---|
DarkModeColor.swift |
CSS/DarkModeColor/ |
ColorConvertible.swift |
CSS/DarkModeColor/ |
ColorProperty.swift |
CSS/DarkModeColor/ |
Color.WithDarkMode.swift |
Deprecated |
CSS_Standard.Color.swift |
CSS/DarkModeColor/ |
CSS_Standard.Color.Value.swift |
CSS/DarkModeColor/ |
CSS Color Property Extensions (24 files)
All moved to CSS/DarkModeColor/Properties/:
CSS+color.swiftCSS+backgroundColor.swiftCSS+accentColor.swiftCSS+caretColor.swiftCSS+outlineColor.swiftCSS+borderColor.swiftCSS+borderTopColor.swift,CSS+borderBottomColor.swiftCSS+borderLeftColor.swift,CSS+borderRightColor.swiftCSS+borderBlockColor.swift,CSS+borderBlockStartColor.swift,CSS+borderBlockEndColor.swiftCSS+borderInlineColor.swift,CSS+borderInlineStartColor.swift,CSS+borderInlineEndColor.swiftCSS+columnRuleColor.swiftCSS+textDecorationColor.swiftCSS+textEmphasisColor.swiftCSS+fill.swift,CSS+stroke.swiftCSS+floodColor.swift,CSS+stopColor.swift,CSS+lightingColor.swift
Layout Helpers (10 files)
All moved to CSS/Layout/:
Flex.swiftMargin.swiftPadding.swiftPosition.swiftSide.swiftCSS+spacing.swiftCSS+gridItem.swiftCSS+gridContainer.swiftCSS+positioned.swiftCSS+frame.swift
Other Utilities (7 files)
| File | New Location |
|---|---|
AlignItems.swift |
CSS/Alignment/ |
Border.swift |
CSS Theming/ |
CSS+border.swift |
CSS Theming/ |
CSS+text.swift |
CSS/ |
Media.swift |
CSS/ |
ListStyle.swift |
CSS/ |
VerticalAlign.swift |
CSS/ |
Test Files Removed
HTMLTheme Tests/Color Palette Tests.swift→ Now in swift-cssHTMLTheme Tests/Theme Structure Tests.swift→ Now in swift-cssHTMLTheme Tests/Theme Variants Tests.swift→ Now in swift-cssHTMLTheme Tests/Dot Syntax Tests.swift→ Now in swift-cssHTMLTheme Tests/HTMLTheme Tests.swift→ Now in swift-css
🔄 Behavioral Changes
Color Resolution
Color statics (.red, .blue, .green, .gray800, etc.) now resolve to themed DarkModeColor values with automatic dark mode support:
// 0.11.x: .red resolved to CSS named color "red"
div.css.color(.red) // → color: red
// 0.12.0: .red resolves to themed DarkModeColor with dark mode
div.css.color(.red) // → color: #cc3333 + @media (prefers-color-scheme: dark) { color: #ff1a1a }isSingleColor Optimization
When light == dark in a DarkModeColor, no dark mode media query is generated:
// Single color - no dark mode CSS generated
DarkModeColor(light: .red, dark: .red)
// → color: #cc3333
// Different colors - dark mode CSS generated
DarkModeColor(light: .red, dark: .blue)
// → color: #cc3333 + @media (prefers-color-scheme: dark) { color: #3399ff }Using Raw CSS Colors
To use raw CSS colors without dark mode, use explicit types:
// Raw CSS named color (no dark mode)
div.css.color(Color.color(.named(.red))) // → color: red
// Raw hex color (no dark mode)
div.css.color(Color.color(.hex("FF0000"))) // → color: #FF0000📦 Migration Guide
Step 1: Update Package.swift
dependencies: [
.package(url: "https://github.com/coenttb/swift-html", from: "0.12.0"),
.package(url: "https://github.com/coenttb/swift-css", from: "0.3.0"),
]Step 2: Update Imports
import HTML
import CSS
import CSS_Theming // If using themed colorsStep 3: Update Color Usage (if needed)
If you relied on .red producing just color: red:
// Change from:
.css.color(.red)
// To (for raw CSS color):
.css.color(Color.color(.named(.red)))
// Or keep as-is to get themed dark mode supportStep 4: Update Tests
Update snapshot expectations to account for dark mode CSS output from themed colors.
🧪 Test Changes
- All 122 swift-html tests pass
- Test snapshots updated for themed color behavior
- HTMLTheme test suite moved to swift-css (213 tests)
📚 Related Packages
- swift-css v0.3.0 - Contains the extracted CSS code
- swift-css-standard - W3C CSS type definitions
Full Changelog
v0.11.1
Fixes
- Critical: Remove archived pointfree-html-translating dependency
- Fix conditional compilation for Translating module import
- Improve Swift 6.0 compatibility in result builders
Code Quality
- Apply swift-format and SwiftLint fixes
- Standardize CI workflows
This release fixes the build issue where Swift Package Manager tried to fetch the archived pointfree-html-translating repository. The functionality has been replaced with the new Translating trait system introduced in 0.11.0.
0.11.0
Features
- Add comprehensive Translating integration tests (8 test cases)
- Test TranslatedString HTML rendering, styling, and language switching
- Add DependenciesTestSupport for clean test architecture
Documentation
- Add Translating trait usage examples to README
- Document how to enable internationalization support
- Add code examples for TranslatedString in HTML contexts
Testing
- 106 total tests passing (98 core + 8 Translating)
- Tests use
.dependenciestrait for clean setup - All tests properly excluded when trait is not enabled
Breaking Changes
None - backward compatible enhancement to test coverage.
0.10.0
Features
- Add optional Translating trait for internationalization support
- Integrate TranslatedString with HTML rendering via opt-in trait
Documentation
- Standardize README with validation tests
- Update Related Packages categorization
- Add funding configuration
CI/CD
- Migrate SwiftLint to Linux runners
- Migrate Swift Format workflow to Linux runners
- Remove Windows job due to dependency incompatibility
Breaking Changes
None - Translating trait is opt-in and backward compatible.
v0.9.0: SVG Integration and Major Enhancements
🎉 Major Release: Native SVG Support
This release brings first-class SVG support to swift-html through integration with the new swift-svg ecosystem.
What's New
🎨 Native SVG Integration
- Swift-SVG Integration: Added dependency on
swift-svgfor type-safe SVG generation - Modern SVG API: New
SVGIntegrationmodule providing seamless HTML/SVG interoperability - Legacy Compatibility: Existing SVG.swift renamed to LegacySVG.swift to preserve backward compatibility
🚀 New SVG Capabilities (Preview)
- SVG Convenience Methods: Comprehensive helper methods for common SVG patterns (currently disabled for refinement)
- SVG Icon Library: Extensive collection of pre-defined SVG icons (currently disabled for refinement)
- These features are included but disabled (
.disabledextension) while we refine the API
🛠️ Component Improvements
- Enhanced Favicons: Improved SVG generation with better type safety for favicon components
- Label Component: Fixed accessibility attributes and styling consistency
- Navigation Bar: Enhanced responsiveness and SVG logo support
- HTML Markdown: Improved diagnostics and error handling
🧪 Testing
- SVG Integration Tests: Comprehensive test suite for SVG/HTML integration
- Dark Mode Tests: Fixed compatibility issues with color dark mode testing
📦 Infrastructure
- Swift 6.0 Compatibility: Updated package configuration for Swift 6.0
- Dependency Management: Cleaned up Package.swift with better dependency definitions
- Package Structure: Improved module organization for better maintainability
Breaking Changes
- The existing
SVGtype in HTML Enhancements has been renamed toLegacySVG - New SVG functionality requires the
swift-svgdependency
Migration Guide
For existing SVG usage:
// Old (still works with LegacySVG)
import HTML
let svg = SVG { ... } // Now uses LegacySVG internally
// New (recommended)
import HTML
import SVG
let svg = SVG(width: 100, height: 100) {
Circle(cx: 50, cy: 50, r: 40)
.fill("blue")
}For favicon components:
The Favicons component now has improved SVG type safety. Update your favicon initialization to use the new SVG type.
Installation
dependencies: [
.package(url: "https://github.com/coenttb/swift-html.git", from: "0.9.0")
]Dependencies Added
swift-svgv0.1.0 - Type-safe SVG generation
Coming Soon
The disabled SVG convenience methods and icon library will be enabled in a future release once the API is finalized.
Full Changelog: 0.8.1...0.9.0
Release 0.7.0
What's New
✨ New Features
- CSS Enhancements: Added
AlignItemsandVerticalAlignproperties for better layout control - Input Component: New form input component with comprehensive type support
- TranslatedString Component: Built-in internationalization support for Dutch/English translations
- Module Exports: Now exports
PointFreeHTMLTranslatingandTranslatingmodules for translation support
🐛 Improvements
- Fixed
PageModuleformatting and improved code structure - Updated
HTMLComponents.Paragraphnamespace usage for consistency - Updated package dependencies for Swift 6.0 compatibility
📦 Dependencies
- Added support for translation modules from Point-Free
Installation
Add to your Package.swift:
.package(url: "https://github.com/coenttb/swift-html.git", from: "0.7.0")Swift HTML v0.6.0
Release v0.6.0 🚀
What's New
HTMLWebsite Module Enhancement
- CalloutModule: New component for creating highlighted content sections with customizable styling
- Favicons: Comprehensive favicon support including multiple sizes and formats for modern web requirements
- Enhanced exports: Proper module exports for cleaner API surface
HTML Core Improvements
- HTMLColor utilities: New color management utilities for theme support
- String interpolation: Enhanced HTML string handling capabilities
- Border styling: Improved border style APIs
Architecture Improvements
- Modular targets: Expanded Package.swift with better target organization
- Swift 6.0 compatibility: Updated Package@swift-6.0.swift with comprehensive target definitions
- Improved integration: Better EmailMarkdown and HTMLMarkdown integration
Breaking Changes
- None in this release - fully backward compatible
Installation
dependencies: [
.package(url: "https://github.com/coenttb/swift-html", from: "0.6.0")
]What's Next
- Continued expansion of website components
- Enhanced theme system
- More utility functions for common patterns
Support
For issues or questions, please visit the GitHub repository.