Skip to content

Commit 2f7eac3

Browse files
committed
refactor: update for swift-css DarkModeColor changes
- Remove HTMLTheme Tests (moved to swift-css) - Update Color API Tests for themed color behavior - Update snapshots for themed colors with dark mode support - Color statics now resolve to DarkModeColor with dark mode variants
1 parent b5cfc95 commit 2f7eac3

42 files changed

Lines changed: 524 additions & 1727 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Sources/HTML/CSS Enhancements/Font.swift

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
// Created by Coen ten Thije Boonkkamp on 26/06/2025.
66
//
77

8-
import Dependencies
98
import CSS
109
import CSS_Standard
10+
import Dependencies
1111

1212
public struct Font: Hashable, Sendable {
1313
public let family: CSS_Standard.FontFamily
@@ -42,25 +42,27 @@ extension CSS {
4242
@inlinable
4343
public func font(
4444
_ font: Font
45-
) -> CSS<HTML.Styled<
45+
) -> CSS<
4646
HTML.Styled<
4747
HTML.Styled<
4848
HTML.Styled<
4949
HTML.Styled<
5050
HTML.Styled<
51-
HTML.Styled<Base, FontFamily>,
52-
CSS_Standard.FontSize
51+
HTML.Styled<
52+
HTML.Styled<Base, FontFamily>,
53+
CSS_Standard.FontSize
54+
>,
55+
FontStretch
5356
>,
54-
FontStretch
57+
FontStyle
5558
>,
56-
FontStyle
59+
FontVariant
5760
>,
58-
FontVariant
61+
FontWeight
5962
>,
60-
FontWeight
61-
>,
62-
LineHeight
63-
>> {
63+
LineHeight
64+
>
65+
> {
6466
self
6567
.fontFamily(font.family)
6668
.fontSize(font.size)

Sources/HTML/CSS Enhancements/Style.swift

Lines changed: 0 additions & 17 deletions
This file was deleted.

Sources/HTML/Css.normalize.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
// Created by Coen ten Thije Boonkkamp on 27/07/2024.
66
//
77

8-
98
public let renderedNormalizeCss: StaticString = """
109
/*! normalize.css v8.0.0 | MIT License | github.com/necolas/normalize.css */html{line-height:1.15;-webkit-text-size-adjust:100%}body{margin:0}h1{font-size:2em;margin:.67em 0}hr{box-sizing:content-box;height:0;overflow:visible}pre{font-family:monospace,monospace;font-size:1em}a{background-color:transparent}abbr[title]{border-bottom:none;text-decoration:underline;text-decoration:underline dotted}b,strong{font-weight:bolder}code,kbd,samp{font-family:monospace,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}img{border-style:none}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0}button,input{overflow:visible}button,select{text-transform:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner,button::-moz-focus-inner{border-style:none;padding:0}[type=button]:-moz-focusring,[type=reset]:-moz-focusring,[type=submit]:-moz-focusring,button:-moz-focusring{outline:1px dotted ButtonText}fieldset{padding:.35em .75em .625em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal}progress{vertical-align:baseline}textarea{overflow:auto}[type=checkbox],[type=radio]{box-sizing:border-box;padding:0}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}details{display:block}summary{display:list-item}template{display:none}[hidden]{display:none}
1110
"""

Sources/HTML/HTML Enhancements/Attribute.onclick.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
// Created by Coen ten Thije Boonkkamp on 26/08/2025.
66
//
77

8-
import HTML_Rendering
98
import CSS
9+
import HTML_Rendering
1010

1111
extension HTML.View {
1212
public func onclick(_ content: String) -> some HTML.View {

Sources/HTML/HTML Enhancements/HTMLColor.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,10 @@ extension HTMLColor {
3434
/// Calculates the midpoint color between two HTMLColors for gradients
3535
public static func gradientMidpoint(from color1: HTMLColor, to color2: HTMLColor) -> HTMLColor?
3636
{
37-
func midpoint(_ c1: CSS_Standard.Color.Value, _ c2: CSS_Standard.Color.Value) -> CSS_Standard.Color.Value? {
37+
func midpoint(
38+
_ c1: CSS_Standard.Color.Value,
39+
_ c2: CSS_Standard.Color.Value
40+
) -> CSS_Standard.Color.Value? {
3841
let rgb1 = toRGB(c1)
3942
let rgb2 = toRGB(c2)
4043

Sources/HTML/HTML Enhancements/HTMLForEach.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,21 +39,21 @@ public struct HTMLForEach<Content: HTML.View>: HTML.View {
3939
// }
4040
// }
4141
// }
42-
//
42+
//
4343
// for element in 1...10 {
4444
// HTML.AnyView {
4545
// li {
4646
// "\(element)"
4747
// }
4848
// }
4949
// }
50-
//
50+
//
5151
// // TO-DO: currently doesn't compile.
5252
// // for element in 1...10 {
5353
// // li {
5454
// // "\(element)"
55-
// }
56-
// }
55+
// }
56+
// }
5757
// }
5858
// }
5959
// }

Sources/HTML/HTML Enhancements/LegacySVG.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import RFC_4648
22
import WHATWG_HTML_Elements
33
import WHATWG_HTML_MediaAttributes
44

5-
65
@available(*, deprecated, message: "Use InlineSVG from SVG Integration instead")
76
public struct LegacySVG: HTML.View, Sendable {
87
private enum Storage {
Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,35 @@
1+
////
2+
//// HStack.swift
3+
//// swift-html
4+
////
15
//
2-
// HStack.swift
3-
// swift-html
6+
// import Foundation
7+
// import HTML_Rendering
8+
// import CSS
49
//
5-
6-
import Foundation
7-
import HTML_Rendering
8-
import CSS
9-
10-
public struct HStack<Content: HTML.View>: HTML.View {
11-
let alignment: VerticalAlign
12-
let spacing: CSS_Standard.Length?
13-
let content: Content
14-
15-
public init(
16-
alignment: VerticalAlign = .middle,
17-
spacing: CSS_Standard.Length? = nil,
18-
@HTML.Builder content: () -> Content
19-
) {
20-
self.alignment = alignment
21-
self.spacing = spacing
22-
self.content = content()
23-
}
24-
25-
public var body: some HTML.View {
26-
div { content }
27-
.css
28-
.alignItems(AlignItems.stretch)
29-
.verticalAlign(alignment)
30-
.display(Display.flex)
31-
.flexDirection(FlexDirection.row)
32-
.maxHeight(MaxHeight.percentage(100))
33-
.columnGap(ColumnGap.length(spacing == 0 ? .zero : spacing ?? 1.rem))
34-
}
35-
}
10+
// public struct HStack<Content: HTML.View>: HTML.View {
11+
// let alignment: VerticalAlign
12+
// let spacing: CSS_Standard.Length?
13+
// let content: Content
14+
//
15+
// public init(
16+
// alignment: VerticalAlign = .middle,
17+
// spacing: CSS_Standard.Length? = nil,
18+
// @HTML.Builder content: () -> Content
19+
// ) {
20+
// self.alignment = alignment
21+
// self.spacing = spacing
22+
// self.content = content()
23+
// }
24+
//
25+
// public var body: some HTML.View {
26+
// div { content }
27+
// .css
28+
// .alignItems(AlignItems.stretch)
29+
// .verticalAlign(alignment)
30+
// .display(Display.flex)
31+
// .flexDirection(FlexDirection.row)
32+
// .maxHeight(MaxHeight.percentage(100))
33+
// .columnGap(ColumnGap.length(spacing == 0 ? .zero : spacing ?? 1.rem))
34+
// }
35+
// }

Sources/HTML/HTML Enhancements/Stacks/LazyVGrid.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
// swift-html
44
//
55

6+
import CSS
67
import Foundation
78
import HTML_Rendering
8-
import CSS
99
import OrderedCollections
1010

1111
public struct LazyVGrid<Content: HTML.View>: HTML.View {

Sources/HTML/HTML Enhancements/Stacks/Spacer.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
// swift-html
44
//
55

6-
import HTML_Rendering
76
import CSS
7+
import HTML_Rendering
88

99
public struct Spacer: HTML.View {
1010
public init() {}

0 commit comments

Comments
 (0)