mark unsupported properties

commit_hash:5e29e60e9e868d1a6ad9a9af35ca2dbc3cd937b8
This commit is contained in:
babaevmm
2025-06-17 12:27:50 +03:00
parent cadef1850f
commit b408de840f
6 changed files with 49 additions and 8 deletions
@@ -42,6 +42,7 @@ public final class DivSlider: DivBase, Sendable {
public let fontVariationSettings: Expression<[String: Any]>?
public let fontWeight: Expression<DivFontWeight> // default value: regular
public let fontWeightValue: Expression<Int>? // constraint: number > 0
public let letterSpacing: Expression<Double> // default value: 0
public let offset: DivPoint?
public let textColor: Expression<Color> // default value: #FF000000
@@ -69,6 +70,10 @@ public final class DivSlider: DivBase, Sendable {
resolver.resolveNumeric(fontWeightValue)
}
public func resolveLetterSpacing(_ resolver: ExpressionResolver) -> Double {
resolver.resolveNumeric(letterSpacing) ?? 0
}
public func resolveTextColor(_ resolver: ExpressionResolver) -> Color {
resolver.resolveColor(textColor) ?? Color.colorWithARGBHexCode(0xFF000000)
}
@@ -86,6 +91,7 @@ public final class DivSlider: DivBase, Sendable {
fontVariationSettings: Expression<[String: Any]>? = nil,
fontWeight: Expression<DivFontWeight>? = nil,
fontWeightValue: Expression<Int>? = nil,
letterSpacing: Expression<Double>? = nil,
offset: DivPoint? = nil,
textColor: Expression<Color>? = nil
) {
@@ -95,6 +101,7 @@ public final class DivSlider: DivBase, Sendable {
self.fontVariationSettings = fontVariationSettings
self.fontWeight = fontWeight ?? .value(.regular)
self.fontWeightValue = fontWeightValue
self.letterSpacing = letterSpacing ?? .value(0)
self.offset = offset
self.textColor = textColor ?? .value(Color.colorWithARGBHexCode(0xFF000000))
}
@@ -488,11 +495,12 @@ extension DivSlider.TextStyle: Equatable {
guard
lhs.fontWeight == rhs.fontWeight,
lhs.fontWeightValue == rhs.fontWeightValue,
lhs.offset == rhs.offset
lhs.letterSpacing == rhs.letterSpacing
else {
return false
}
guard
lhs.offset == rhs.offset,
lhs.textColor == rhs.textColor
else {
return false
@@ -544,6 +552,7 @@ extension DivSlider.TextStyle: Serializable {
result["font_variation_settings"] = fontVariationSettings?.toValidSerializationValue()
result["font_weight"] = fontWeight.toValidSerializationValue()
result["font_weight_value"] = fontWeightValue?.toValidSerializationValue()
result["letter_spacing"] = letterSpacing.toValidSerializationValue()
result["offset"] = offset?.toDictionary()
result["text_color"] = textColor.toValidSerializationValue()
return result
@@ -171,6 +171,7 @@ public final class DivSliderTemplate: TemplateValue, Sendable {
public let fontVariationSettings: Field<Expression<[String: Any]>>?
public let fontWeight: Field<Expression<DivFontWeight>>? // default value: regular
public let fontWeightValue: Field<Expression<Int>>? // constraint: number > 0
public let letterSpacing: Field<Expression<Double>>? // default value: 0
public let offset: Field<DivPointTemplate>?
public let textColor: Field<Expression<Color>>? // default value: #FF000000
@@ -182,6 +183,7 @@ public final class DivSliderTemplate: TemplateValue, Sendable {
fontVariationSettings: dictionary.getOptionalExpressionField("font_variation_settings"),
fontWeight: dictionary.getOptionalExpressionField("font_weight"),
fontWeightValue: dictionary.getOptionalExpressionField("font_weight_value"),
letterSpacing: dictionary.getOptionalExpressionField("letter_spacing"),
offset: dictionary.getOptionalField("offset", templateToType: templateToType),
textColor: dictionary.getOptionalExpressionField("text_color", transform: Color.color(withHexString:))
)
@@ -194,6 +196,7 @@ public final class DivSliderTemplate: TemplateValue, Sendable {
fontVariationSettings: Field<Expression<[String: Any]>>? = nil,
fontWeight: Field<Expression<DivFontWeight>>? = nil,
fontWeightValue: Field<Expression<Int>>? = nil,
letterSpacing: Field<Expression<Double>>? = nil,
offset: Field<DivPointTemplate>? = nil,
textColor: Field<Expression<Color>>? = nil
) {
@@ -203,6 +206,7 @@ public final class DivSliderTemplate: TemplateValue, Sendable {
self.fontVariationSettings = fontVariationSettings
self.fontWeight = fontWeight
self.fontWeightValue = fontWeightValue
self.letterSpacing = letterSpacing
self.offset = offset
self.textColor = textColor
}
@@ -214,6 +218,7 @@ public final class DivSliderTemplate: TemplateValue, Sendable {
let fontVariationSettingsValue = { parent?.fontVariationSettings?.resolveOptionalValue(context: context) ?? .noValue }()
let fontWeightValue = { parent?.fontWeight?.resolveOptionalValue(context: context) ?? .noValue }()
let fontWeightValueValue = { parent?.fontWeightValue?.resolveOptionalValue(context: context, validator: ResolvedValue.fontWeightValueValidator) ?? .noValue }()
let letterSpacingValue = { parent?.letterSpacing?.resolveOptionalValue(context: context) ?? .noValue }()
let offsetValue = { parent?.offset?.resolveOptionalValue(context: context, useOnlyLinks: true) ?? .noValue }()
let textColorValue = { parent?.textColor?.resolveOptionalValue(context: context, transform: Color.color(withHexString:)) ?? .noValue }()
let errors = mergeErrors(
@@ -223,6 +228,7 @@ public final class DivSliderTemplate: TemplateValue, Sendable {
fontVariationSettingsValue.errorsOrWarnings?.map { .nestedObjectError(field: "font_variation_settings", error: $0) },
fontWeightValue.errorsOrWarnings?.map { .nestedObjectError(field: "font_weight", error: $0) },
fontWeightValueValue.errorsOrWarnings?.map { .nestedObjectError(field: "font_weight_value", error: $0) },
letterSpacingValue.errorsOrWarnings?.map { .nestedObjectError(field: "letter_spacing", error: $0) },
offsetValue.errorsOrWarnings?.map { .nestedObjectError(field: "offset", error: $0) },
textColorValue.errorsOrWarnings?.map { .nestedObjectError(field: "text_color", error: $0) }
)
@@ -233,6 +239,7 @@ public final class DivSliderTemplate: TemplateValue, Sendable {
fontVariationSettings: { fontVariationSettingsValue.value }(),
fontWeight: { fontWeightValue.value }(),
fontWeightValue: { fontWeightValueValue.value }(),
letterSpacing: { letterSpacingValue.value }(),
offset: { offsetValue.value }(),
textColor: { textColorValue.value }()
)
@@ -249,6 +256,7 @@ public final class DivSliderTemplate: TemplateValue, Sendable {
var fontVariationSettingsValue: DeserializationResult<Expression<[String: Any]>> = { parent?.fontVariationSettings?.value() ?? .noValue }()
var fontWeightValue: DeserializationResult<Expression<DivFontWeight>> = { parent?.fontWeight?.value() ?? .noValue }()
var fontWeightValueValue: DeserializationResult<Expression<Int>> = { parent?.fontWeightValue?.value() ?? .noValue }()
var letterSpacingValue: DeserializationResult<Expression<Double>> = { parent?.letterSpacing?.value() ?? .noValue }()
var offsetValue: DeserializationResult<DivPoint> = .noValue
var textColorValue: DeserializationResult<Expression<Color>> = { parent?.textColor?.value() ?? .noValue }()
_ = {
@@ -286,6 +294,11 @@ public final class DivSliderTemplate: TemplateValue, Sendable {
fontWeightValueValue = deserialize(__dictValue, validator: ResolvedValue.fontWeightValueValidator).merged(with: fontWeightValueValue)
}
}()
_ = {
if key == "letter_spacing" {
letterSpacingValue = deserialize(__dictValue).merged(with: letterSpacingValue)
}
}()
_ = {
if key == "offset" {
offsetValue = deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, type: DivPointTemplate.self).merged(with: offsetValue)
@@ -326,6 +339,11 @@ public final class DivSliderTemplate: TemplateValue, Sendable {
fontWeightValueValue = fontWeightValueValue.merged(with: { deserialize(__dictValue, validator: ResolvedValue.fontWeightValueValidator) })
}
}()
_ = {
if key == parent?.letterSpacing?.link {
letterSpacingValue = letterSpacingValue.merged(with: { deserialize(__dictValue) })
}
}()
_ = {
if key == parent?.offset?.link {
offsetValue = offsetValue.merged(with: { deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, type: DivPointTemplate.self) })
@@ -348,6 +366,7 @@ public final class DivSliderTemplate: TemplateValue, Sendable {
fontVariationSettingsValue.errorsOrWarnings?.map { .nestedObjectError(field: "font_variation_settings", error: $0) },
fontWeightValue.errorsOrWarnings?.map { .nestedObjectError(field: "font_weight", error: $0) },
fontWeightValueValue.errorsOrWarnings?.map { .nestedObjectError(field: "font_weight_value", error: $0) },
letterSpacingValue.errorsOrWarnings?.map { .nestedObjectError(field: "letter_spacing", error: $0) },
offsetValue.errorsOrWarnings?.map { .nestedObjectError(field: "offset", error: $0) },
textColorValue.errorsOrWarnings?.map { .nestedObjectError(field: "text_color", error: $0) }
)
@@ -358,6 +377,7 @@ public final class DivSliderTemplate: TemplateValue, Sendable {
fontVariationSettings: { fontVariationSettingsValue.value }(),
fontWeight: { fontWeightValue.value }(),
fontWeightValue: { fontWeightValueValue.value }(),
letterSpacing: { letterSpacingValue.value }(),
offset: { offsetValue.value }(),
textColor: { textColorValue.value }()
)
@@ -378,6 +398,7 @@ public final class DivSliderTemplate: TemplateValue, Sendable {
fontVariationSettings: merged.fontVariationSettings,
fontWeight: merged.fontWeight,
fontWeightValue: merged.fontWeightValue,
letterSpacing: merged.letterSpacing,
offset: merged.offset?.tryResolveParent(templates: templates),
textColor: merged.textColor
)
+8 -4
View File
@@ -47,7 +47,8 @@
"android"
],
"unsupported_platforms": {
"web": "There is no direct implementation, no plans for support."
"web": "There is no direct implementation, no plans for support.",
"ios": "There is no direct implementation, no plans for support."
}
},
"down": {
@@ -56,7 +57,8 @@
"android"
],
"unsupported_platforms": {
"web": "There is no direct implementation, no plans for support."
"web": "There is no direct implementation, no plans for support.",
"ios": "There is no direct implementation, no plans for support."
}
},
"left": {
@@ -65,7 +67,8 @@
"android"
],
"unsupported_platforms": {
"web": "There is no direct implementation, no plans for support."
"web": "There is no direct implementation, no plans for support.",
"ios": "There is no direct implementation, no plans for support."
}
},
"up": {
@@ -74,7 +77,8 @@
"android"
],
"unsupported_platforms": {
"web": "There is no direct implementation, no plans for support."
"web": "There is no direct implementation, no plans for support.",
"ios": "There is no direct implementation, no plans for support."
}
}
}
+2 -1
View File
@@ -121,7 +121,8 @@
"$description": "translations.json#/div_scrollbar",
"platforms": [
"web",
"android"
"android",
"ios"
]
}
}
+4 -1
View File
@@ -125,7 +125,10 @@
"$description": "translations.json#/div_slider_secondary_value_accessibility",
"platforms": [
"web"
]
],
"unsupported_platforms": {
"ios": "There is no direct implementation, no plans for support."
}
},
"is_enabled": {
"$ref": "common.json#/boolean_int",
+4 -1
View File
@@ -216,7 +216,10 @@
"platforms": [
"android",
"web"
]
],
"unsupported_platforms": {
"ios": "There is no direct implementation, no plans for support."
}
},
"alignment_vertical": {
"$ref": "div-text-alignment-vertical.json",