Skip to content

Commit 6b5048c

Browse files
committed
continue with tags
1 parent 41f29ff commit 6b5048c

16 files changed

+221
-38
lines changed

Sources/SwiftHTML/Attributes/CrossoriginAttribute.swift

Lines changed: 0 additions & 15 deletions
This file was deleted.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
public struct AutoplayAttribute: HTMLAttribute {
2+
public var value: String?
3+
4+
public init() {
5+
self.value = nil
6+
}
7+
}
8+
9+
public protocol AutoplayAttributeModifier {
10+
11+
}
12+
13+
extension AutoplayAttributeModifier where Self: Attributes & Mutable {
14+
15+
public func autoplay() -> Self {
16+
setAttribute(AutoplayAttribute())
17+
}
18+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
public struct CrossoriginAttribute: HTMLAttribute {
2+
3+
public enum Value: String, Sendable {
4+
case anonymous
5+
case useCredentials = "use-credentials"
6+
}
7+
8+
public var value: String?
9+
10+
public init(
11+
_ value: Value?
12+
) {
13+
self.value = value?.rawValue
14+
}
15+
}
16+
17+
public protocol CrossoriginAttributeModifier {
18+
19+
}
20+
21+
extension CrossoriginAttributeModifier where Self: Attributes & Mutable {
22+
23+
public func crossorigin(
24+
_ value: CrossoriginAttribute.Value?
25+
) -> Self {
26+
setAttribute(CrossoriginAttribute(value))
27+
}
28+
}
Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
public struct DownloadAttribute: HTMLAttribute {
2+
23
public var value: String?
34

4-
public init() {
5-
self.value = nil
5+
public init(
6+
_ value: String? = nil
7+
) {
8+
self.value = value
69
}
710
}
811

@@ -12,14 +15,9 @@ public protocol DownloadAttributeModifier {
1215

1316
extension DownloadAttributeModifier where Self: Attributes & Mutable {
1417

15-
public func download( // _ value: Bool = true
16-
) -> Self
17-
{
18-
// if value {
19-
setAttribute(DownloadAttribute())
20-
// }
21-
// else {
22-
// removeAttribute(DownloadAttribute.self)
23-
// }
18+
public func download(
19+
_ value: String?
20+
) -> Self {
21+
setAttribute(DownloadAttribute(value))
2422
}
2523
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
public struct HreflangAttribute: HTMLAttribute {
2+
3+
public var value: String?
4+
5+
public init(
6+
_ value: String? = nil
7+
) {
8+
self.value = value
9+
}
10+
}
11+
12+
public protocol HreflangAttributeModifier {
13+
14+
}
15+
16+
extension HreflangAttributeModifier where Self: Attributes & Mutable {
17+
18+
public func hreflang(
19+
_ value: String?
20+
) -> Self {
21+
setAttribute(HrefAttribute(value))
22+
}
23+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
public struct LoopAttribute: HTMLAttribute {
2+
public var value: String?
3+
4+
public init() {
5+
self.value = nil
6+
}
7+
}
8+
9+
public protocol LoopAttributeModifier {
10+
11+
}
12+
13+
extension LoopAttributeModifier where Self: Attributes & Mutable {
14+
15+
public func loop() -> Self {
16+
setAttribute(LoopAttribute())
17+
}
18+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
public struct MutedAttribute: HTMLAttribute {
2+
public var value: String?
3+
4+
public init() {
5+
self.value = nil
6+
}
7+
}
8+
9+
public protocol MutedAttributeModifier {
10+
11+
}
12+
13+
extension MutedAttributeModifier where Self: Attributes & Mutable {
14+
15+
public func muted() -> Self {
16+
setAttribute(MutedAttribute())
17+
}
18+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
public struct PreloadAttribute: HTMLAttribute {
2+
3+
public enum Value: String, Sendable {
4+
case auto
5+
case metadata
6+
case none
7+
}
8+
9+
public var value: String?
10+
11+
public init(
12+
_ value: Value?
13+
) {
14+
self.value = value?.rawValue
15+
}
16+
}
17+
18+
public protocol PreloadAttributeModifier {
19+
20+
}
21+
22+
extension PreloadAttributeModifier where Self: Attributes & Mutable {
23+
24+
public func preload(
25+
_ value: PreloadAttribute.Value?
26+
) -> Self {
27+
setAttribute(PreloadAttribute(value))
28+
}
29+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
public struct SrcAttribute: HTMLAttribute {
2+
3+
public var value: String?
4+
5+
public init(
6+
_ value: String? = nil
7+
) {
8+
self.value = value
9+
}
10+
}
11+
12+
public protocol SrcAttributeModifier {
13+
14+
}
15+
16+
extension SrcAttributeModifier where Self: Attributes & Mutable {
17+
18+
public func src(
19+
_ value: String?
20+
) -> Self {
21+
setAttribute(SrcAttribute(value))
22+
}
23+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
public struct TypeAttribute: HTMLAttribute {
2+
3+
public var value: String?
4+
5+
public init(
6+
_ value: String? = nil
7+
) {
8+
self.value = value
9+
}
10+
}
11+
12+
public protocol TypeAttributeModifier {
13+
14+
}
15+
16+
extension TypeAttributeModifier where Self: Attributes & Mutable {
17+
18+
public func type(
19+
_ value: String?
20+
) -> Self {
21+
setAttribute(TypeAttribute(value))
22+
}
23+
}

0 commit comments

Comments
 (0)