Files
feldspar e234cd83fa Added untyped template resolver
commit_hash:299c999f2d6caad74d8568059e890770d7a6b1f2
2026-02-13 12:08:22 +03:00

60 lines
1.6 KiB
Swift

// Generated code. Do not modify.
import Foundation
import Serialization
import VGSL
public final class DivTextRangeMaskSolid: Sendable {
public static let type: String = "solid"
public let color: Expression<Color>
public let isEnabled: Expression<Bool> // default value: true
public func resolveColor(_ resolver: ExpressionResolver) -> Color? {
resolver.resolveColor(color)
}
public func resolveIsEnabled(_ resolver: ExpressionResolver) -> Bool {
resolver.resolveNumeric(isEnabled) ?? true
}
public convenience init(dictionary: [String: Any], context: ParsingContext) throws {
self.init(
color: try dictionary.getExpressionField("color", transform: Color.color(withHexString:), context: context),
isEnabled: try dictionary.getOptionalExpressionField("is_enabled", context: context)
)
}
init(
color: Expression<Color>,
isEnabled: Expression<Bool>? = nil
) {
self.color = color
self.isEnabled = isEnabled ?? .value(true)
}
}
#if DEBUG
extension DivTextRangeMaskSolid: Equatable {
public static func ==(lhs: DivTextRangeMaskSolid, rhs: DivTextRangeMaskSolid) -> Bool {
guard
lhs.color == rhs.color,
lhs.isEnabled == rhs.isEnabled
else {
return false
}
return true
}
}
#endif
extension DivTextRangeMaskSolid: Serializable {
@_optimize(size)
public func toDictionary() -> [String: ValidSerializationValue] {
var result: [String: ValidSerializationValue] = [:]
result["type"] = Self.type
result["color"] = color.toValidSerializationValue()
result["is_enabled"] = isEnabled.toValidSerializationValue()
return result
}
}