Skip to content

Releases: coenttb/swift-html

v0.12.1 - Dependency Fix

16 Dec 20:38

Choose a tag to compare

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

16 Dec 20:35

Choose a tag to compare

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.swift
  • CSS+backgroundColor.swift
  • CSS+accentColor.swift
  • CSS+caretColor.swift
  • CSS+outlineColor.swift
  • CSS+borderColor.swift
  • CSS+borderTopColor.swift, CSS+borderBottomColor.swift
  • CSS+borderLeftColor.swift, CSS+borderRightColor.swift
  • CSS+borderBlockColor.swift, CSS+borderBlockStartColor.swift, CSS+borderBlockEndColor.swift
  • CSS+borderInlineColor.swift, CSS+borderInlineStartColor.swift, CSS+borderInlineEndColor.swift
  • CSS+columnRuleColor.swift
  • CSS+textDecorationColor.swift
  • CSS+textEmphasisColor.swift
  • CSS+fill.swift, CSS+stroke.swift
  • CSS+floodColor.swift, CSS+stopColor.swift, CSS+lightingColor.swift

Layout Helpers (10 files)

All moved to CSS/Layout/:

  • Flex.swift
  • Margin.swift
  • Padding.swift
  • Position.swift
  • Side.swift
  • CSS+spacing.swift
  • CSS+gridItem.swift
  • CSS+gridContainer.swift
  • CSS+positioned.swift
  • CSS+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-css
  • HTMLTheme Tests/Theme Structure Tests.swift → Now in swift-css
  • HTMLTheme Tests/Theme Variants Tests.swift → Now in swift-css
  • HTMLTheme Tests/Dot Syntax Tests.swift → Now in swift-css
  • HTMLTheme 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 colors

Step 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 support

Step 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


Full Changelog

0.11.1...0.12.0

v0.11.1

04 Nov 08:42

Choose a tag to compare

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

31 Oct 16:46

Choose a tag to compare

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 .dependencies trait for clean setup
  • All tests properly excluded when trait is not enabled

Breaking Changes

None - backward compatible enhancement to test coverage.

0.10.0

31 Oct 16:46

Choose a tag to compare

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

26 Sep 20:23

Choose a tag to compare

🎉 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-svg for type-safe SVG generation
  • Modern SVG API: New SVGIntegration module 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 (.disabled extension) 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 SVG type in HTML Enhancements has been renamed to LegacySVG
  • New SVG functionality requires the swift-svg dependency

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-svg v0.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

01 Sep 18:21

Choose a tag to compare

What's New

✨ New Features

  • CSS Enhancements: Added AlignItems and VerticalAlign properties 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 PointFreeHTMLTranslating and Translating modules for translation support

🐛 Improvements

  • Fixed PageModule formatting and improved code structure
  • Updated HTMLComponents.Paragraph namespace 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

01 Sep 17:04

Choose a tag to compare

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.

0.1.2

01 Aug 11:26

Choose a tag to compare

Fix HTMLDocument UIViewRepresentable implementation

0.1.1

31 Jul 12:01

Choose a tag to compare

Fix HTMLDocument view representable implementations

This patch release fixes issues in the NSViewRepresentable and UIViewRepresentable implementations for HTMLDocument.