Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,9 @@ public struct DesignTokensConverter: Sendable {
return .typography(fontWeightMapping: configuration.fontWeightMapping)
case .gradient:
return .gradient(using: configuration.colorHexFormat)
case .fontWeight, .number,
case .number:
return .number
case .fontWeight,
.duration, .shadow, .strokeStyle, .border,
.cubicBezier, .transition:
fallthrough
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//
// DesignTokensNumberValueExtractor.swift
//
// Created by Volodymyr Voiko on 09.04.2025.
//

import Foundation
import SnappDesignTokens
import SnappTheming

extension DesignTokensTokenValueExtractor {
static var number: Self {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

public?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, extractors are used internally.

.init(\.metricsCache) { $0 }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,14 @@
}
]
}
},
"number": {
"aspect": {
"square": {
"$type": "number",
"$value": 1.0
}
}
}
},
"files": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
"baseDimensionSpacing20" : 20,
"semanticFontsizeBody" : 16,
"semanticFontsizeH1" : 32,
"semanticNumberAspectSquare" : 1,
"semanticSpacingMedium" : 20,
"semanticSpacingSmall" : 10
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,13 @@ struct SnappThemingDesignTokensParserTests {
#"""
{
"unsupported": {
"$type": "number",
"$value": 0.5
"$type": "fontWeight",
"$value": 100
}
}
"""#,
DesignTokensConverter.Error.unsupportedToken(
.value(.number(0.5)),
.value(.fontWeight(FontWeightValue(alias: .thin))),
forKey: "unsupported"
)
),
Expand Down