Skip to content

Commit be232d6

Browse files
committed
refactor: Comment out unused Dimension protocol
Avoid naming conflict with Dimension module's Scale type.
1 parent 1defc4a commit be232d6

File tree

1 file changed

+70
-70
lines changed

1 file changed

+70
-70
lines changed
Lines changed: 70 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,70 @@
1-
/// Represents a CSS dimension, which is a number with a unit.
2-
///
3-
/// The `Dimension` data type is the generic parent type for all CSS values that combine
4-
/// a numeric value with a unit, such as lengths, times, frequencies, and resolutions.
5-
///
6-
/// This protocol provides common functionality for various dimension types such as
7-
/// `Length`, `Time`, `Frequency`, and `Resolution`.
8-
///
9-
/// - Note: A dimension value always consists of a number immediately followed by a unit.
10-
/// No whitespace is allowed between the number and unit.
11-
///
12-
/// - SeeAlso: [MDN Web Docs on dimension values](https://developer.mozilla.org/en-US/docs/Web/CSS/dimension)
13-
public protocol Dimension: Sendable, Hashable, CustomStringConvertible {
14-
/// The numeric value of the dimension
15-
var value: Double { get }
16-
17-
/// The unit of the dimension
18-
var unit: String { get }
19-
}
20-
21-
/// Default implementation for Dimension types
22-
extension Dimension {
23-
/// Converts the dimension to its CSS string representation
24-
///
25-
/// This method formats the numeric value with its unit for CSS output.
26-
public var description: String {
27-
return "\(value.formatted(.number))\(unit)"
28-
}
29-
}
30-
31-
/// Represents a CSS length dimension.
32-
///
33-
/// The `Length` type represents CSS length values with various units like
34-
/// pixels, ems, percentages, etc. This is a concrete implementation of
35-
/// the `Dimension` protocol for length values.
36-
///
37-
/// ```swift
38-
/// let pixels = Length(20, unit: "px") // 20px
39-
/// let ems = Length(1.5, unit: "em") // 1.5em
40-
/// ```
41-
///
42-
/// - Note: This is a basic implementation. The full library would likely have
43-
/// specialized types for each specific dimension category.
44-
public struct GenericDimension: Dimension {
45-
/// The numeric value of the dimension
46-
public let value: Double
47-
48-
/// The unit of the dimension
49-
public let unit: String
50-
51-
/// Creates a new dimension with the specified value and unit
52-
///
53-
/// - Parameters:
54-
/// - value: The numeric value of the dimension
55-
/// - unit: The unit of the dimension
56-
public init(_ value: Double, unit: String) {
57-
self.value = value
58-
self.unit = unit
59-
}
60-
61-
/// Creates a new dimension with the specified value and unit
62-
///
63-
/// - Parameters:
64-
/// - value: The numeric value of the dimension as an integer
65-
/// - unit: The unit of the dimension
66-
public init(_ value: Int, unit: String) {
67-
self.value = Double(value)
68-
self.unit = unit
69-
}
70-
}
1+
///// Represents a CSS dimension, which is a number with a unit.
2+
/////
3+
///// The `Dimension` data type is the generic parent type for all CSS values that combine
4+
///// a numeric value with a unit, such as lengths, times, frequencies, and resolutions.
5+
/////
6+
///// This protocol provides common functionality for various dimension types such as
7+
///// `Length`, `Time`, `Frequency`, and `Resolution`.
8+
/////
9+
///// - Note: A dimension value always consists of a number immediately followed by a unit.
10+
///// No whitespace is allowed between the number and unit.
11+
/////
12+
///// - SeeAlso: [MDN Web Docs on dimension values](https://developer.mozilla.org/en-US/docs/Web/CSS/dimension)
13+
//package protocol Dimension: Sendable, Hashable, CustomStringConvertible {
14+
// /// The numeric value of the dimension
15+
// var value: Double { get }
16+
//
17+
// /// The unit of the dimension
18+
// var unit: String { get }
19+
//}
20+
//
21+
///// Default implementation for Dimension types
22+
//extension Dimension {
23+
// /// Converts the dimension to its CSS string representation
24+
// ///
25+
// /// This method formats the numeric value with its unit for CSS output.
26+
// public var description: String {
27+
// return "\(value.formatted(.number))\(unit)"
28+
// }
29+
//}
30+
//
31+
///// Represents a CSS length dimension.
32+
/////
33+
///// The `Length` type represents CSS length values with various units like
34+
///// pixels, ems, percentages, etc. This is a concrete implementation of
35+
///// the `Dimension` protocol for length values.
36+
/////
37+
///// ```swift
38+
///// let pixels = Length(20, unit: "px") // 20px
39+
///// let ems = Length(1.5, unit: "em") // 1.5em
40+
///// ```
41+
/////
42+
///// - Note: This is a basic implementation. The full library would likely have
43+
///// specialized types for each specific dimension category.
44+
//public struct GenericDimension: Dimension {
45+
// /// The numeric value of the dimension
46+
// public let value: Double
47+
//
48+
// /// The unit of the dimension
49+
// public let unit: String
50+
//
51+
// /// Creates a new dimension with the specified value and unit
52+
// ///
53+
// /// - Parameters:
54+
// /// - value: The numeric value of the dimension
55+
// /// - unit: The unit of the dimension
56+
// public init(_ value: Double, unit: String) {
57+
// self.value = value
58+
// self.unit = unit
59+
// }
60+
//
61+
// /// Creates a new dimension with the specified value and unit
62+
// ///
63+
// /// - Parameters:
64+
// /// - value: The numeric value of the dimension as an integer
65+
// /// - unit: The unit of the dimension
66+
// public init(_ value: Int, unit: String) {
67+
// self.value = Double(value)
68+
// self.unit = unit
69+
// }
70+
//}

0 commit comments

Comments
 (0)