Skip to content

Commit 410187e

Browse files
committed
Prepare for 0.0.1 release
- Apply SwiftLint fixes for code formatting - All tests passing - Build verified successful - Ready for initial release
1 parent 1fe8487 commit 410187e

File tree

577 files changed

+1393
-1404
lines changed

Some content is hidden

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

577 files changed

+1393
-1404
lines changed

Package.swift

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,15 @@ let package = Package(
2929
.library(name: .htmlAttributeTypes, targets: [.htmlAttributeTypes]),
3030
.library(name: .htmlAttributeTypesFoundation, targets: [.htmlAttributeTypesFoundation]),
3131
.library(name: .htmlElementTypes, targets: [.htmlElementTypes]),
32-
.library(name: .htmlElementTypesFoundation, targets: [.htmlElementTypesFoundation]),
32+
.library(name: .htmlElementTypesFoundation, targets: [.htmlElementTypesFoundation])
3333
],
3434
dependencies: [],
3535
targets: [
3636
.target(
3737
name: .htmlTypes,
3838
dependencies: [
3939
.htmlAttributeTypes,
40-
.htmlElementTypes,
40+
.htmlElementTypes
4141
]
4242
),
4343
.target(
@@ -53,7 +53,7 @@ let package = Package(
5353
.target(
5454
name: .htmlElementTypes,
5555
dependencies: [
56-
.htmlAttributeTypes,
56+
.htmlAttributeTypes
5757
]
5858
),
5959
.testTarget(
@@ -78,7 +78,7 @@ let package = Package(
7878
.target(
7979
name: .htmlAttributeTypesFoundation,
8080
dependencies: [
81-
.htmlAttributeTypes,
81+
.htmlAttributeTypes
8282
]
8383
),
8484
.testTarget(
@@ -90,19 +90,17 @@ let package = Package(
9090
.target(
9191
name: .htmlElementTypesFoundation,
9292
dependencies: [
93-
.htmlElementTypes,
93+
.htmlElementTypes
9494
]
9595
),
9696
.testTarget(
9797
name: .htmlElementTypesFoundation.tests,
9898
dependencies: [
9999
.htmlElementTypesFoundation
100100
]
101-
),
101+
)
102102
],
103103
swiftLanguageModes: [.v5]
104104
)
105105

106-
extension String {
107-
var tests: Self { "\(self) Tests" }
108-
}
106+
extension String { var tests: Self { "\(self) Tests" } }

[email protected]

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,4 @@ let package = Package(
103103
swiftLanguageModes: [.v6]
104104
)
105105

106-
extension String {
107-
var tests: Self { "\(self) Tests" }
108-
}
106+
extension String { var tests: Self { "\(self) Tests" } }

Sources/HTMLAttributeTypes/Attributes/Form.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public struct Form: Sendable, Hashable {
1717
///
1818
/// This attribute corresponds to the `accept-charset` attribute on the `<form>` element.
1919
public var acceptCharset: HTMLAttributeTypes.AcceptCharset?
20-
20+
2121
/// A string indicating the URL to which to submit the data. This takes precedence over the action attribute on the `<form>` element that owns the `<input>`.
2222
///
2323
/// This attribute is also available on `<input type="submit">` and `<button>` elements.

Sources/HTMLAttributeTypesFoundation/Attributes/Global/Nonce.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ extension Nonce {
2626
#if canImport(Darwin)
2727
_ = data.withUnsafeMutableBytes { SecRandomCopyBytes(kSecRandomDefault, length, $0.baseAddress!) }
2828
#else
29-
let charset = Array<Character>("0123456789ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvwxyz-._")
29+
let charset = [Character]("0123456789ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvwxyz-._")
3030
var rng = SystemRandomNumberGenerator()
3131
data.withUnsafeMutableBytes { (p: UnsafeMutableRawBufferPointer) in
3232
for i in 0..<length {

Sources/HTMLAttributeTypesFoundation/Attributes/Href.swift

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,26 +21,25 @@ extension Href {
2121
public init(_ url: URL) {
2222
self = .init(url.absoluteString)
2323
}
24-
24+
2525
public static func url(_ url: URL) -> Href {
2626
.init(url)
2727
}
28-
28+
2929
/// Creates a link with a fragment identifier (#section)
3030
public static func fragment(_ base: String, fragment: String) -> Href {
3131
let baseWithoutFragment = base.split(separator: "#")[0]
3232
let fragmentWithoutHash = fragment.hasPrefix("#") ? String(fragment.dropFirst()) : fragment
3333
return Href("\(baseWithoutFragment)#\(fragmentWithoutHash)")
3434
}
35-
35+
3636
/// Creates a link to a specific fragment on the current page
3737
public static func anchor(_ fragmentId: String) -> Href {
3838
let fragmentWithoutHash = fragmentId.hasPrefix("#") ? fragmentId : "#\(fragmentId)"
3939
return Href(fragmentWithoutHash)
4040
}
4141
}
4242

43-
4443
#if canImport(Foundation)
4544
import Foundation
4645

@@ -50,46 +49,46 @@ extension Href {
5049
// Define a custom allowed character set that excludes ?, &, =, and other special chars
5150
var allowedCharacters = CharacterSet.urlQueryAllowed
5251
allowedCharacters.remove(charactersIn: "?&=+%")
53-
52+
5453
var url = "mailto:\(address)"
55-
54+
5655
if subject != nil || body != nil {
5756
url += "?"
5857
var queryParts: [String] = []
59-
58+
6059
if let subject = subject {
6160
// Properly encode the subject
6261
let encodedSubject = subject.addingPercentEncoding(withAllowedCharacters: allowedCharacters) ?? subject
6362
queryParts.append("subject=\(encodedSubject)")
6463
}
65-
64+
6665
if let body = body {
6766
// Properly encode the body
6867
let encodedBody = body.addingPercentEncoding(withAllowedCharacters: allowedCharacters) ?? body
6968
queryParts.append("body=\(encodedBody)")
7069
}
71-
70+
7271
url += queryParts.joined(separator: "&")
7372
}
74-
73+
7574
return Href(url)
7675
}
77-
76+
7877
/// Creates a telephone link (tel:) - Foundation only
7978
public static func tel(_ phoneNumber: String) -> Href {
8079
let formattedNumber = phoneNumber.replacingOccurrences(of: #"[^\d+]"#, with: "", options: .regularExpression)
8180
return Href("tel:\(formattedNumber)")
8281
}
83-
82+
8483
/// Creates an SMS link (sms:) - Foundation only
8584
public static func sms(_ phoneNumber: String, body: String? = nil) -> Href {
8685
let formattedNumber = phoneNumber.replacingOccurrences(of: #"[^\d+]"#, with: "", options: .regularExpression)
87-
86+
8887
if let body = body {
8988
// Define a custom allowed character set that excludes ?, &, =, and other special chars
9089
var allowedCharacters = CharacterSet.urlQueryAllowed
9190
allowedCharacters.remove(charactersIn: "?&=+%")
92-
91+
9392
// Properly encode the body
9493
let encodedBody = body.addingPercentEncoding(withAllowedCharacters: allowedCharacters) ?? body
9594
return Href("sms:\(formattedNumber)?body=\(encodedBody)")

Sources/HTMLAttributeTypesFoundation/Attributes/Max.swift

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
//
1111
// ===----------------------------------------------------------------------===//
1212

13-
1413
import HTMLAttributeTypes
1514

1615
#if canImport(FoundationEssentials)
@@ -22,7 +21,7 @@ extension Max {
2221
/// Initialize with a date (Foundation only)
2322
public init(date: Date, format: DateFormat = .fullDate) {
2423
let formatter: DateFormatter
25-
24+
2625
switch format {
2726
case .fullDate:
2827
formatter = DateFormatter()
@@ -48,7 +47,7 @@ extension Max {
4847
formatter = DateFormatter()
4948
formatter.dateFormat = "yyyy-MM-dd'T'HH:mm"
5049
}
51-
50+
5251
self = .init(formatter.string(from: date))
5352
}
5453
}
@@ -59,25 +58,24 @@ extension Max {
5958
public static func date(_ year: Int, month: Int, day: Int) -> Max {
6059
return Max(String.format(year: year, month: month, day: day))
6160
}
62-
61+
6362
/// Create a max value for a month input
6463
public static func month(_ year: Int, month: Int) -> Max {
6564
return Max(String.format(year: year, month: month))
6665
}
67-
66+
6867
/// Create a max value for a week input
6968
public static func week(_ year: Int, week: Int) -> Max {
7069
return Max(String.format(year: year, week: week))
7170
}
72-
71+
7372
/// Create a max value for a time input
7473
public static func time(_ hour: Int, minute: Int) -> Max {
7574
return Max(String.format(hour: hour, minute: minute))
7675
}
77-
76+
7877
/// Create a max value for a datetime-local input
7978
public static func dateTimeLocal(_ year: Int, month: Int, day: Int, hour: Int, minute: Int) -> Max {
8079
return Max(String.format(year: year, month: month, day: day, hour: hour, minute: minute))
8180
}
8281
}
83-

Sources/HTMLAttributeTypesFoundation/Attributes/Min.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ extension Min {
5353

5454
#endif
5555

56-
5756
extension Min {
5857
/// Create a min value for a date input
5958
public static func date(_ year: Int, month: Int, day: Int) -> Min {

Sources/HTMLAttributeTypesFoundation/String.format.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,23 @@ extension String {
1616
static func format(year: Int, month: Int, day: Int) -> String {
1717
return "\(String(year).padded(to: 4, with: "0"))-\(String(month).padded(to: 2, with: "0"))-\(String(day).padded(to: 2, with: "0"))"
1818
}
19-
19+
2020
static func format(year: Int, month: Int) -> String {
2121
return "\(String(year).padded(to: 4, with: "0"))-\(String(month).padded(to: 2, with: "0"))"
2222
}
23-
23+
2424
static func format(year: Int, week: Int) -> String {
2525
return "\(String(year).padded(to: 4, with: "0"))-W\(String(week).padded(to: 2, with: "0"))"
2626
}
27-
27+
2828
static func format(hour: Int, minute: Int) -> String {
2929
return "\(String(hour).padded(to: 2, with: "0")):\(String(minute).padded(to: 2, with: "0"))"
3030
}
31-
31+
3232
static func format(year: Int, month: Int, day: Int, hour: Int, minute: Int) -> String {
3333
return "\(String(year).padded(to: 4, with: "0"))-\(String(month).padded(to: 2, with: "0"))-\(String(day).padded(to: 2, with: "0"))T\(String(hour).padded(to: 2, with: "0")):\(String(minute).padded(to: 2, with: "0"))"
3434
}
35-
35+
3636
func padded(to width: Int, with character: Character) -> String {
3737
let padding = max(0, width - self.count)
3838
return String(repeating: character, count: padding) + self

Sources/HTMLElementTypesFoundation/Elements/<a> Anchor.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@
1111
// ===----------------------------------------------------------------------===//
1212

1313
import Foundation
14-
import HTMLElementTypes
14+
import HTMLElementTypes

Sources/HTMLElementTypesFoundation/Elements/<abbr> Abbreviation.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@
1111
// ===----------------------------------------------------------------------===//
1212

1313
import Foundation
14-
import HTMLElementTypes
14+
import HTMLElementTypes

0 commit comments

Comments
 (0)