diff --git a/client/ios/DivKit/generated_sources/DivInput.swift b/client/ios/DivKit/generated_sources/DivInput.swift index a0a15cec8..4da9f8be2 100644 --- a/client/ios/DivKit/generated_sources/DivInput.swift +++ b/client/ios/DivKit/generated_sources/DivInput.swift @@ -45,6 +45,7 @@ public final class DivInput: DivBase { public let fontSize: Expression // constraint: number >= 0; default value: 12 public let fontSizeUnit: Expression // default value: sp public let fontWeight: Expression // default value: regular + public let fontWeightValue: Expression? // constraint: number > 0 public let height: DivSize // default value: .divWrapContentSize(DivWrapContentSize()) public let highlightColor: Expression? public let hintColor: Expression // default value: #73000000 @@ -112,6 +113,10 @@ public final class DivInput: DivBase { resolver.resolveEnum(fontWeight) ?? DivFontWeight.regular } + public func resolveFontWeightValue(_ resolver: ExpressionResolver) -> Int? { + resolver.resolveNumeric(fontWeightValue) + } + public func resolveHighlightColor(_ resolver: ExpressionResolver) -> Color? { resolver.resolveColor(highlightColor) } @@ -181,6 +186,9 @@ public final class DivInput: DivBase { static let fontSizeValidator: AnyValueValidator = makeValueValidator(valueValidator: { $0 >= 0 }) + static let fontWeightValueValidator: AnyValueValidator = + makeValueValidator(valueValidator: { $0 > 0 }) + static let lineHeightValidator: AnyValueValidator = makeValueValidator(valueValidator: { $0 >= 0 }) @@ -211,6 +219,7 @@ public final class DivInput: DivBase { fontSize: Expression? = nil, fontSizeUnit: Expression? = nil, fontWeight: Expression? = nil, + fontWeightValue: Expression? = nil, height: DivSize? = nil, highlightColor: Expression? = nil, hintColor: Expression? = nil, @@ -260,6 +269,7 @@ public final class DivInput: DivBase { self.fontSize = fontSize ?? .value(12) self.fontSizeUnit = fontSizeUnit ?? .value(.sp) self.fontWeight = fontWeight ?? .value(.regular) + self.fontWeightValue = fontWeightValue self.height = height ?? .divWrapContentSize(DivWrapContentSize()) self.highlightColor = highlightColor self.hintColor = hintColor ?? .value(Color.colorWithARGBHexCode(0x73000000)) @@ -331,83 +341,88 @@ extension DivInput: Equatable { guard lhs.fontSizeUnit == rhs.fontSizeUnit, lhs.fontWeight == rhs.fontWeight, - lhs.height == rhs.height + lhs.fontWeightValue == rhs.fontWeightValue else { return false } guard + lhs.height == rhs.height, lhs.highlightColor == rhs.highlightColor, - lhs.hintColor == rhs.hintColor, - lhs.hintText == rhs.hintText + lhs.hintColor == rhs.hintColor else { return false } guard + lhs.hintText == rhs.hintText, lhs.id == rhs.id, - lhs.isEnabled == rhs.isEnabled, - lhs.keyboardType == rhs.keyboardType + lhs.isEnabled == rhs.isEnabled else { return false } guard + lhs.keyboardType == rhs.keyboardType, lhs.letterSpacing == rhs.letterSpacing, - lhs.lineHeight == rhs.lineHeight, - lhs.margins == rhs.margins + lhs.lineHeight == rhs.lineHeight else { return false } guard + lhs.margins == rhs.margins, lhs.mask == rhs.mask, - lhs.maxLength == rhs.maxLength, - lhs.maxVisibleLines == rhs.maxVisibleLines + lhs.maxLength == rhs.maxLength else { return false } guard + lhs.maxVisibleLines == rhs.maxVisibleLines, lhs.nativeInterface == rhs.nativeInterface, - lhs.paddings == rhs.paddings, - lhs.rowSpan == rhs.rowSpan + lhs.paddings == rhs.paddings else { return false } guard + lhs.rowSpan == rhs.rowSpan, lhs.selectAllOnFocus == rhs.selectAllOnFocus, - lhs.selectedActions == rhs.selectedActions, - lhs.textAlignmentHorizontal == rhs.textAlignmentHorizontal + lhs.selectedActions == rhs.selectedActions else { return false } guard + lhs.textAlignmentHorizontal == rhs.textAlignmentHorizontal, lhs.textAlignmentVertical == rhs.textAlignmentVertical, - lhs.textColor == rhs.textColor, - lhs.textVariable == rhs.textVariable + lhs.textColor == rhs.textColor else { return false } guard + lhs.textVariable == rhs.textVariable, lhs.tooltips == rhs.tooltips, - lhs.transform == rhs.transform, - lhs.transitionChange == rhs.transitionChange + lhs.transform == rhs.transform else { return false } guard + lhs.transitionChange == rhs.transitionChange, lhs.transitionIn == rhs.transitionIn, - lhs.transitionOut == rhs.transitionOut, - lhs.transitionTriggers == rhs.transitionTriggers + lhs.transitionOut == rhs.transitionOut else { return false } guard + lhs.transitionTriggers == rhs.transitionTriggers, lhs.validators == rhs.validators, - lhs.variables == rhs.variables, - lhs.visibility == rhs.visibility + lhs.variables == rhs.variables else { return false } guard + lhs.visibility == rhs.visibility, lhs.visibilityAction == rhs.visibilityAction, - lhs.visibilityActions == rhs.visibilityActions, + lhs.visibilityActions == rhs.visibilityActions + else { + return false + } + guard lhs.width == rhs.width else { return false @@ -435,6 +450,7 @@ extension DivInput: Serializable { result["font_size"] = fontSize.toValidSerializationValue() result["font_size_unit"] = fontSizeUnit.toValidSerializationValue() result["font_weight"] = fontWeight.toValidSerializationValue() + result["font_weight_value"] = fontWeightValue?.toValidSerializationValue() result["height"] = height.toDictionary() result["highlight_color"] = highlightColor?.toValidSerializationValue() result["hint_color"] = hintColor.toValidSerializationValue() diff --git a/client/ios/DivKit/generated_sources/DivInputTemplate.swift b/client/ios/DivKit/generated_sources/DivInputTemplate.swift index 8ea068ec0..e600dfd6d 100644 --- a/client/ios/DivKit/generated_sources/DivInputTemplate.swift +++ b/client/ios/DivKit/generated_sources/DivInputTemplate.swift @@ -97,6 +97,7 @@ public final class DivInputTemplate: TemplateValue { public let fontSize: Field>? // constraint: number >= 0; default value: 12 public let fontSizeUnit: Field>? // default value: sp public let fontWeight: Field>? // default value: regular + public let fontWeightValue: Field>? // constraint: number > 0 public let height: Field? // default value: .divWrapContentSize(DivWrapContentSize()) public let highlightColor: Field>? public let hintColor: Field>? // default value: #73000000 @@ -149,6 +150,7 @@ public final class DivInputTemplate: TemplateValue { fontSize: dictionary.getOptionalExpressionField("font_size"), fontSizeUnit: dictionary.getOptionalExpressionField("font_size_unit"), fontWeight: dictionary.getOptionalExpressionField("font_weight"), + fontWeightValue: dictionary.getOptionalExpressionField("font_weight_value"), height: dictionary.getOptionalField("height", templateToType: templateToType), highlightColor: dictionary.getOptionalExpressionField("highlight_color", transform: Color.color(withHexString:)), hintColor: dictionary.getOptionalExpressionField("hint_color", transform: Color.color(withHexString:)), @@ -202,6 +204,7 @@ public final class DivInputTemplate: TemplateValue { fontSize: Field>? = nil, fontSizeUnit: Field>? = nil, fontWeight: Field>? = nil, + fontWeightValue: Field>? = nil, height: Field? = nil, highlightColor: Field>? = nil, hintColor: Field>? = nil, @@ -252,6 +255,7 @@ public final class DivInputTemplate: TemplateValue { self.fontSize = fontSize self.fontSizeUnit = fontSizeUnit self.fontWeight = fontWeight + self.fontWeightValue = fontWeightValue self.height = height self.highlightColor = highlightColor self.hintColor = hintColor @@ -303,6 +307,7 @@ public final class DivInputTemplate: TemplateValue { let fontSizeValue = parent?.fontSize?.resolveOptionalValue(context: context, validator: ResolvedValue.fontSizeValidator) ?? .noValue let fontSizeUnitValue = parent?.fontSizeUnit?.resolveOptionalValue(context: context) ?? .noValue let fontWeightValue = parent?.fontWeight?.resolveOptionalValue(context: context) ?? .noValue + let fontWeightValueValue = parent?.fontWeightValue?.resolveOptionalValue(context: context, validator: ResolvedValue.fontWeightValueValidator) ?? .noValue let heightValue = parent?.height?.resolveOptionalValue(context: context, useOnlyLinks: true) ?? .noValue let highlightColorValue = parent?.highlightColor?.resolveOptionalValue(context: context, transform: Color.color(withHexString:)) ?? .noValue let hintColorValue = parent?.hintColor?.resolveOptionalValue(context: context, transform: Color.color(withHexString:)) ?? .noValue @@ -352,6 +357,7 @@ public final class DivInputTemplate: TemplateValue { fontSizeValue.errorsOrWarnings?.map { .nestedObjectError(field: "font_size", error: $0) }, fontSizeUnitValue.errorsOrWarnings?.map { .nestedObjectError(field: "font_size_unit", error: $0) }, fontWeightValue.errorsOrWarnings?.map { .nestedObjectError(field: "font_weight", error: $0) }, + fontWeightValueValue.errorsOrWarnings?.map { .nestedObjectError(field: "font_weight_value", error: $0) }, heightValue.errorsOrWarnings?.map { .nestedObjectError(field: "height", error: $0) }, highlightColorValue.errorsOrWarnings?.map { .nestedObjectError(field: "highlight_color", error: $0) }, hintColorValue.errorsOrWarnings?.map { .nestedObjectError(field: "hint_color", error: $0) }, @@ -410,6 +416,7 @@ public final class DivInputTemplate: TemplateValue { fontSize: fontSizeValue.value, fontSizeUnit: fontSizeUnitValue.value, fontWeight: fontWeightValue.value, + fontWeightValue: fontWeightValueValue.value, height: heightValue.value, highlightColor: highlightColorValue.value, hintColor: hintColorValue.value, @@ -466,6 +473,7 @@ public final class DivInputTemplate: TemplateValue { var fontSizeValue: DeserializationResult> = parent?.fontSize?.value() ?? .noValue var fontSizeUnitValue: DeserializationResult> = parent?.fontSizeUnit?.value() ?? .noValue var fontWeightValue: DeserializationResult> = parent?.fontWeight?.value() ?? .noValue + var fontWeightValueValue: DeserializationResult> = parent?.fontWeightValue?.value() ?? .noValue var heightValue: DeserializationResult = .noValue var highlightColorValue: DeserializationResult> = parent?.highlightColor?.value() ?? .noValue var hintColorValue: DeserializationResult> = parent?.hintColor?.value() ?? .noValue @@ -530,6 +538,8 @@ public final class DivInputTemplate: TemplateValue { fontSizeUnitValue = deserialize(__dictValue).merged(with: fontSizeUnitValue) case "font_weight": fontWeightValue = deserialize(__dictValue).merged(with: fontWeightValue) + case "font_weight_value": + fontWeightValueValue = deserialize(__dictValue, validator: ResolvedValue.fontWeightValueValidator).merged(with: fontWeightValueValue) case "height": heightValue = deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, type: DivSizeTemplate.self).merged(with: heightValue) case "highlight_color": @@ -626,6 +636,8 @@ public final class DivInputTemplate: TemplateValue { fontSizeUnitValue = fontSizeUnitValue.merged(with: { deserialize(__dictValue) }) case parent?.fontWeight?.link: fontWeightValue = fontWeightValue.merged(with: { deserialize(__dictValue) }) + case parent?.fontWeightValue?.link: + fontWeightValueValue = fontWeightValueValue.merged(with: { deserialize(__dictValue, validator: ResolvedValue.fontWeightValueValidator) }) case parent?.height?.link: heightValue = heightValue.merged(with: { deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, type: DivSizeTemplate.self) }) case parent?.highlightColor?.link: @@ -736,6 +748,7 @@ public final class DivInputTemplate: TemplateValue { fontSizeValue.errorsOrWarnings?.map { .nestedObjectError(field: "font_size", error: $0) }, fontSizeUnitValue.errorsOrWarnings?.map { .nestedObjectError(field: "font_size_unit", error: $0) }, fontWeightValue.errorsOrWarnings?.map { .nestedObjectError(field: "font_weight", error: $0) }, + fontWeightValueValue.errorsOrWarnings?.map { .nestedObjectError(field: "font_weight_value", error: $0) }, heightValue.errorsOrWarnings?.map { .nestedObjectError(field: "height", error: $0) }, highlightColorValue.errorsOrWarnings?.map { .nestedObjectError(field: "highlight_color", error: $0) }, hintColorValue.errorsOrWarnings?.map { .nestedObjectError(field: "hint_color", error: $0) }, @@ -794,6 +807,7 @@ public final class DivInputTemplate: TemplateValue { fontSize: fontSizeValue.value, fontSizeUnit: fontSizeUnitValue.value, fontWeight: fontWeightValue.value, + fontWeightValue: fontWeightValueValue.value, height: heightValue.value, highlightColor: highlightColorValue.value, hintColor: hintColorValue.value, @@ -855,6 +869,7 @@ public final class DivInputTemplate: TemplateValue { fontSize: fontSize ?? mergedParent.fontSize, fontSizeUnit: fontSizeUnit ?? mergedParent.fontSizeUnit, fontWeight: fontWeight ?? mergedParent.fontWeight, + fontWeightValue: fontWeightValue ?? mergedParent.fontWeightValue, height: height ?? mergedParent.height, highlightColor: highlightColor ?? mergedParent.highlightColor, hintColor: hintColor ?? mergedParent.hintColor, @@ -911,6 +926,7 @@ public final class DivInputTemplate: TemplateValue { fontSize: merged.fontSize, fontSizeUnit: merged.fontSizeUnit, fontWeight: merged.fontWeight, + fontWeightValue: merged.fontWeightValue, height: merged.height?.tryResolveParent(templates: templates), highlightColor: merged.highlightColor, hintColor: merged.hintColor, diff --git a/client/ios/DivKit/generated_sources/DivSelect.swift b/client/ios/DivKit/generated_sources/DivSelect.swift index 07ef6665c..55890f48c 100644 --- a/client/ios/DivKit/generated_sources/DivSelect.swift +++ b/client/ios/DivKit/generated_sources/DivSelect.swift @@ -41,6 +41,7 @@ public final class DivSelect: DivBase { public let fontSize: Expression // constraint: number >= 0; default value: 12 public let fontSizeUnit: Expression // default value: sp public let fontWeight: Expression // default value: regular + public let fontWeightValue: Expression? // constraint: number > 0 public let height: DivSize // default value: .divWrapContentSize(DivWrapContentSize()) public let hintColor: Expression // default value: #73000000 public let hintText: Expression? @@ -98,6 +99,10 @@ public final class DivSelect: DivBase { resolver.resolveEnum(fontWeight) ?? DivFontWeight.regular } + public func resolveFontWeightValue(_ resolver: ExpressionResolver) -> Int? { + resolver.resolveNumeric(fontWeightValue) + } + public func resolveHintColor(_ resolver: ExpressionResolver) -> Color { resolver.resolveColor(hintColor) ?? Color.colorWithARGBHexCode(0x73000000) } @@ -135,6 +140,9 @@ public final class DivSelect: DivBase { static let fontSizeValidator: AnyValueValidator = makeValueValidator(valueValidator: { $0 >= 0 }) + static let fontWeightValueValidator: AnyValueValidator = + makeValueValidator(valueValidator: { $0 > 0 }) + static let lineHeightValidator: AnyValueValidator = makeValueValidator(valueValidator: { $0 >= 0 }) @@ -162,6 +170,7 @@ public final class DivSelect: DivBase { fontSize: Expression? = nil, fontSizeUnit: Expression? = nil, fontWeight: Expression? = nil, + fontWeightValue: Expression? = nil, height: DivSize? = nil, hintColor: Expression? = nil, hintText: Expression? = nil, @@ -201,6 +210,7 @@ public final class DivSelect: DivBase { self.fontSize = fontSize ?? .value(12) self.fontSizeUnit = fontSizeUnit ?? .value(.sp) self.fontWeight = fontWeight ?? .value(.regular) + self.fontWeightValue = fontWeightValue self.height = height ?? .divWrapContentSize(DivWrapContentSize()) self.hintColor = hintColor ?? .value(Color.colorWithARGBHexCode(0x73000000)) self.hintText = hintText @@ -262,60 +272,61 @@ extension DivSelect: Equatable { guard lhs.fontSizeUnit == rhs.fontSizeUnit, lhs.fontWeight == rhs.fontWeight, - lhs.height == rhs.height + lhs.fontWeightValue == rhs.fontWeightValue else { return false } guard + lhs.height == rhs.height, lhs.hintColor == rhs.hintColor, - lhs.hintText == rhs.hintText, - lhs.id == rhs.id + lhs.hintText == rhs.hintText else { return false } guard + lhs.id == rhs.id, lhs.letterSpacing == rhs.letterSpacing, - lhs.lineHeight == rhs.lineHeight, - lhs.margins == rhs.margins + lhs.lineHeight == rhs.lineHeight else { return false } guard + lhs.margins == rhs.margins, lhs.options == rhs.options, - lhs.paddings == rhs.paddings, - lhs.rowSpan == rhs.rowSpan + lhs.paddings == rhs.paddings else { return false } guard + lhs.rowSpan == rhs.rowSpan, lhs.selectedActions == rhs.selectedActions, - lhs.textColor == rhs.textColor, - lhs.tooltips == rhs.tooltips + lhs.textColor == rhs.textColor else { return false } guard + lhs.tooltips == rhs.tooltips, lhs.transform == rhs.transform, - lhs.transitionChange == rhs.transitionChange, - lhs.transitionIn == rhs.transitionIn + lhs.transitionChange == rhs.transitionChange else { return false } guard + lhs.transitionIn == rhs.transitionIn, lhs.transitionOut == rhs.transitionOut, - lhs.transitionTriggers == rhs.transitionTriggers, - lhs.valueVariable == rhs.valueVariable + lhs.transitionTriggers == rhs.transitionTriggers else { return false } guard + lhs.valueVariable == rhs.valueVariable, lhs.variables == rhs.variables, - lhs.visibility == rhs.visibility, - lhs.visibilityAction == rhs.visibilityAction + lhs.visibility == rhs.visibility else { return false } guard + lhs.visibilityAction == rhs.visibilityAction, lhs.visibilityActions == rhs.visibilityActions, lhs.width == rhs.width else { @@ -344,6 +355,7 @@ extension DivSelect: Serializable { result["font_size"] = fontSize.toValidSerializationValue() result["font_size_unit"] = fontSizeUnit.toValidSerializationValue() result["font_weight"] = fontWeight.toValidSerializationValue() + result["font_weight_value"] = fontWeightValue?.toValidSerializationValue() result["height"] = height.toDictionary() result["hint_color"] = hintColor.toValidSerializationValue() result["hint_text"] = hintText?.toValidSerializationValue() diff --git a/client/ios/DivKit/generated_sources/DivSelectTemplate.swift b/client/ios/DivKit/generated_sources/DivSelectTemplate.swift index ec042396d..2c2b41990 100644 --- a/client/ios/DivKit/generated_sources/DivSelectTemplate.swift +++ b/client/ios/DivKit/generated_sources/DivSelectTemplate.swift @@ -109,6 +109,7 @@ public final class DivSelectTemplate: TemplateValue { public let fontSize: Field>? // constraint: number >= 0; default value: 12 public let fontSizeUnit: Field>? // default value: sp public let fontWeight: Field>? // default value: regular + public let fontWeightValue: Field>? // constraint: number > 0 public let height: Field? // default value: .divWrapContentSize(DivWrapContentSize()) public let hintColor: Field>? // default value: #73000000 public let hintText: Field>? @@ -151,6 +152,7 @@ public final class DivSelectTemplate: TemplateValue { fontSize: dictionary.getOptionalExpressionField("font_size"), fontSizeUnit: dictionary.getOptionalExpressionField("font_size_unit"), fontWeight: dictionary.getOptionalExpressionField("font_weight"), + fontWeightValue: dictionary.getOptionalExpressionField("font_weight_value"), height: dictionary.getOptionalField("height", templateToType: templateToType), hintColor: dictionary.getOptionalExpressionField("hint_color", transform: Color.color(withHexString:)), hintText: dictionary.getOptionalExpressionField("hint_text"), @@ -194,6 +196,7 @@ public final class DivSelectTemplate: TemplateValue { fontSize: Field>? = nil, fontSizeUnit: Field>? = nil, fontWeight: Field>? = nil, + fontWeightValue: Field>? = nil, height: Field? = nil, hintColor: Field>? = nil, hintText: Field>? = nil, @@ -234,6 +237,7 @@ public final class DivSelectTemplate: TemplateValue { self.fontSize = fontSize self.fontSizeUnit = fontSizeUnit self.fontWeight = fontWeight + self.fontWeightValue = fontWeightValue self.height = height self.hintColor = hintColor self.hintText = hintText @@ -275,6 +279,7 @@ public final class DivSelectTemplate: TemplateValue { let fontSizeValue = parent?.fontSize?.resolveOptionalValue(context: context, validator: ResolvedValue.fontSizeValidator) ?? .noValue let fontSizeUnitValue = parent?.fontSizeUnit?.resolveOptionalValue(context: context) ?? .noValue let fontWeightValue = parent?.fontWeight?.resolveOptionalValue(context: context) ?? .noValue + let fontWeightValueValue = parent?.fontWeightValue?.resolveOptionalValue(context: context, validator: ResolvedValue.fontWeightValueValidator) ?? .noValue let heightValue = parent?.height?.resolveOptionalValue(context: context, useOnlyLinks: true) ?? .noValue let hintColorValue = parent?.hintColor?.resolveOptionalValue(context: context, transform: Color.color(withHexString:)) ?? .noValue let hintTextValue = parent?.hintText?.resolveOptionalValue(context: context) ?? .noValue @@ -314,6 +319,7 @@ public final class DivSelectTemplate: TemplateValue { fontSizeValue.errorsOrWarnings?.map { .nestedObjectError(field: "font_size", error: $0) }, fontSizeUnitValue.errorsOrWarnings?.map { .nestedObjectError(field: "font_size_unit", error: $0) }, fontWeightValue.errorsOrWarnings?.map { .nestedObjectError(field: "font_weight", error: $0) }, + fontWeightValueValue.errorsOrWarnings?.map { .nestedObjectError(field: "font_weight_value", error: $0) }, heightValue.errorsOrWarnings?.map { .nestedObjectError(field: "height", error: $0) }, hintColorValue.errorsOrWarnings?.map { .nestedObjectError(field: "hint_color", error: $0) }, hintTextValue.errorsOrWarnings?.map { .nestedObjectError(field: "hint_text", error: $0) }, @@ -366,6 +372,7 @@ public final class DivSelectTemplate: TemplateValue { fontSize: fontSizeValue.value, fontSizeUnit: fontSizeUnitValue.value, fontWeight: fontWeightValue.value, + fontWeightValue: fontWeightValueValue.value, height: heightValue.value, hintColor: hintColorValue.value, hintText: hintTextValue.value, @@ -412,6 +419,7 @@ public final class DivSelectTemplate: TemplateValue { var fontSizeValue: DeserializationResult> = parent?.fontSize?.value() ?? .noValue var fontSizeUnitValue: DeserializationResult> = parent?.fontSizeUnit?.value() ?? .noValue var fontWeightValue: DeserializationResult> = parent?.fontWeight?.value() ?? .noValue + var fontWeightValueValue: DeserializationResult> = parent?.fontWeightValue?.value() ?? .noValue var heightValue: DeserializationResult = .noValue var hintColorValue: DeserializationResult> = parent?.hintColor?.value() ?? .noValue var hintTextValue: DeserializationResult> = parent?.hintText?.value() ?? .noValue @@ -466,6 +474,8 @@ public final class DivSelectTemplate: TemplateValue { fontSizeUnitValue = deserialize(__dictValue).merged(with: fontSizeUnitValue) case "font_weight": fontWeightValue = deserialize(__dictValue).merged(with: fontWeightValue) + case "font_weight_value": + fontWeightValueValue = deserialize(__dictValue, validator: ResolvedValue.fontWeightValueValidator).merged(with: fontWeightValueValue) case "height": heightValue = deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, type: DivSizeTemplate.self).merged(with: heightValue) case "hint_color": @@ -542,6 +552,8 @@ public final class DivSelectTemplate: TemplateValue { fontSizeUnitValue = fontSizeUnitValue.merged(with: { deserialize(__dictValue) }) case parent?.fontWeight?.link: fontWeightValue = fontWeightValue.merged(with: { deserialize(__dictValue) }) + case parent?.fontWeightValue?.link: + fontWeightValueValue = fontWeightValueValue.merged(with: { deserialize(__dictValue, validator: ResolvedValue.fontWeightValueValidator) }) case parent?.height?.link: heightValue = heightValue.merged(with: { deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, type: DivSizeTemplate.self) }) case parent?.hintColor?.link: @@ -630,6 +642,7 @@ public final class DivSelectTemplate: TemplateValue { fontSizeValue.errorsOrWarnings?.map { .nestedObjectError(field: "font_size", error: $0) }, fontSizeUnitValue.errorsOrWarnings?.map { .nestedObjectError(field: "font_size_unit", error: $0) }, fontWeightValue.errorsOrWarnings?.map { .nestedObjectError(field: "font_weight", error: $0) }, + fontWeightValueValue.errorsOrWarnings?.map { .nestedObjectError(field: "font_weight_value", error: $0) }, heightValue.errorsOrWarnings?.map { .nestedObjectError(field: "height", error: $0) }, hintColorValue.errorsOrWarnings?.map { .nestedObjectError(field: "hint_color", error: $0) }, hintTextValue.errorsOrWarnings?.map { .nestedObjectError(field: "hint_text", error: $0) }, @@ -682,6 +695,7 @@ public final class DivSelectTemplate: TemplateValue { fontSize: fontSizeValue.value, fontSizeUnit: fontSizeUnitValue.value, fontWeight: fontWeightValue.value, + fontWeightValue: fontWeightValueValue.value, height: heightValue.value, hintColor: hintColorValue.value, hintText: hintTextValue.value, @@ -733,6 +747,7 @@ public final class DivSelectTemplate: TemplateValue { fontSize: fontSize ?? mergedParent.fontSize, fontSizeUnit: fontSizeUnit ?? mergedParent.fontSizeUnit, fontWeight: fontWeight ?? mergedParent.fontWeight, + fontWeightValue: fontWeightValue ?? mergedParent.fontWeightValue, height: height ?? mergedParent.height, hintColor: hintColor ?? mergedParent.hintColor, hintText: hintText ?? mergedParent.hintText, @@ -779,6 +794,7 @@ public final class DivSelectTemplate: TemplateValue { fontSize: merged.fontSize, fontSizeUnit: merged.fontSizeUnit, fontWeight: merged.fontWeight, + fontWeightValue: merged.fontWeightValue, height: merged.height?.tryResolveParent(templates: templates), hintColor: merged.hintColor, hintText: merged.hintText, diff --git a/client/ios/DivKit/generated_sources/DivSlider.swift b/client/ios/DivKit/generated_sources/DivSlider.swift index 20a134724..59aae368a 100644 --- a/client/ios/DivKit/generated_sources/DivSlider.swift +++ b/client/ios/DivKit/generated_sources/DivSlider.swift @@ -39,6 +39,7 @@ public final class DivSlider: DivBase { public let fontSize: Expression // constraint: number >= 0 public let fontSizeUnit: Expression // default value: sp public let fontWeight: Expression // default value: regular + public let fontWeightValue: Expression? // constraint: number > 0 public let offset: DivPoint? public let textColor: Expression // default value: #FF000000 @@ -54,6 +55,10 @@ public final class DivSlider: DivBase { resolver.resolveEnum(fontWeight) ?? DivFontWeight.regular } + public func resolveFontWeightValue(_ resolver: ExpressionResolver) -> Int? { + resolver.resolveNumeric(fontWeightValue) + } + public func resolveTextColor(_ resolver: ExpressionResolver) -> Color { resolver.resolveColor(textColor) ?? Color.colorWithARGBHexCode(0xFF000000) } @@ -61,16 +66,21 @@ public final class DivSlider: DivBase { static let fontSizeValidator: AnyValueValidator = makeValueValidator(valueValidator: { $0 >= 0 }) + static let fontWeightValueValidator: AnyValueValidator = + makeValueValidator(valueValidator: { $0 > 0 }) + init( fontSize: Expression, fontSizeUnit: Expression? = nil, fontWeight: Expression? = nil, + fontWeightValue: Expression? = nil, offset: DivPoint? = nil, textColor: Expression? = nil ) { self.fontSize = fontSize self.fontSizeUnit = fontSizeUnit ?? .value(.sp) self.fontWeight = fontWeight ?? .value(.regular) + self.fontWeightValue = fontWeightValue self.offset = offset self.textColor = textColor ?? .value(Color.colorWithARGBHexCode(0xFF000000)) } @@ -436,6 +446,7 @@ extension DivSlider.TextStyle: Equatable { return false } guard + lhs.fontWeightValue == rhs.fontWeightValue, lhs.offset == rhs.offset, lhs.textColor == rhs.textColor else { @@ -464,6 +475,7 @@ extension DivSlider.TextStyle: Serializable { result["font_size"] = fontSize.toValidSerializationValue() result["font_size_unit"] = fontSizeUnit.toValidSerializationValue() result["font_weight"] = fontWeight.toValidSerializationValue() + result["font_weight_value"] = fontWeightValue?.toValidSerializationValue() result["offset"] = offset?.toDictionary() result["text_color"] = textColor.toValidSerializationValue() return result diff --git a/client/ios/DivKit/generated_sources/DivSliderTemplate.swift b/client/ios/DivKit/generated_sources/DivSliderTemplate.swift index 71255c844..59edf1eac 100644 --- a/client/ios/DivKit/generated_sources/DivSliderTemplate.swift +++ b/client/ios/DivKit/generated_sources/DivSliderTemplate.swift @@ -136,6 +136,7 @@ public final class DivSliderTemplate: TemplateValue { public let fontSize: Field>? // constraint: number >= 0 public let fontSizeUnit: Field>? // default value: sp public let fontWeight: Field>? // default value: regular + public let fontWeightValue: Field>? // constraint: number > 0 public let offset: Field? public let textColor: Field>? // default value: #FF000000 @@ -144,6 +145,7 @@ public final class DivSliderTemplate: TemplateValue { fontSize: dictionary.getOptionalExpressionField("font_size"), fontSizeUnit: dictionary.getOptionalExpressionField("font_size_unit"), fontWeight: dictionary.getOptionalExpressionField("font_weight"), + fontWeightValue: dictionary.getOptionalExpressionField("font_weight_value"), offset: dictionary.getOptionalField("offset", templateToType: templateToType), textColor: dictionary.getOptionalExpressionField("text_color", transform: Color.color(withHexString:)) ) @@ -153,12 +155,14 @@ public final class DivSliderTemplate: TemplateValue { fontSize: Field>? = nil, fontSizeUnit: Field>? = nil, fontWeight: Field>? = nil, + fontWeightValue: Field>? = nil, offset: Field? = nil, textColor: Field>? = nil ) { self.fontSize = fontSize self.fontSizeUnit = fontSizeUnit self.fontWeight = fontWeight + self.fontWeightValue = fontWeightValue self.offset = offset self.textColor = textColor } @@ -167,12 +171,14 @@ public final class DivSliderTemplate: TemplateValue { let fontSizeValue = parent?.fontSize?.resolveValue(context: context, validator: ResolvedValue.fontSizeValidator) ?? .noValue let fontSizeUnitValue = parent?.fontSizeUnit?.resolveOptionalValue(context: context) ?? .noValue let fontWeightValue = parent?.fontWeight?.resolveOptionalValue(context: context) ?? .noValue + let fontWeightValueValue = parent?.fontWeightValue?.resolveOptionalValue(context: context, validator: ResolvedValue.fontWeightValueValidator) ?? .noValue let offsetValue = parent?.offset?.resolveOptionalValue(context: context, useOnlyLinks: true) ?? .noValue let textColorValue = parent?.textColor?.resolveOptionalValue(context: context, transform: Color.color(withHexString:)) ?? .noValue var errors = mergeErrors( fontSizeValue.errorsOrWarnings?.map { .nestedObjectError(field: "font_size", error: $0) }, fontSizeUnitValue.errorsOrWarnings?.map { .nestedObjectError(field: "font_size_unit", error: $0) }, fontWeightValue.errorsOrWarnings?.map { .nestedObjectError(field: "font_weight", error: $0) }, + fontWeightValueValue.errorsOrWarnings?.map { .nestedObjectError(field: "font_weight_value", error: $0) }, offsetValue.errorsOrWarnings?.map { .nestedObjectError(field: "offset", error: $0) }, textColorValue.errorsOrWarnings?.map { .nestedObjectError(field: "text_color", error: $0) } ) @@ -188,6 +194,7 @@ public final class DivSliderTemplate: TemplateValue { fontSize: fontSizeNonNil, fontSizeUnit: fontSizeUnitValue.value, fontWeight: fontWeightValue.value, + fontWeightValue: fontWeightValueValue.value, offset: offsetValue.value, textColor: textColorValue.value ) @@ -201,6 +208,7 @@ public final class DivSliderTemplate: TemplateValue { var fontSizeValue: DeserializationResult> = parent?.fontSize?.value() ?? .noValue var fontSizeUnitValue: DeserializationResult> = parent?.fontSizeUnit?.value() ?? .noValue var fontWeightValue: DeserializationResult> = parent?.fontWeight?.value() ?? .noValue + var fontWeightValueValue: DeserializationResult> = parent?.fontWeightValue?.value() ?? .noValue var offsetValue: DeserializationResult = .noValue var textColorValue: DeserializationResult> = parent?.textColor?.value() ?? .noValue context.templateData.forEach { key, __dictValue in @@ -211,6 +219,8 @@ public final class DivSliderTemplate: TemplateValue { fontSizeUnitValue = deserialize(__dictValue).merged(with: fontSizeUnitValue) case "font_weight": fontWeightValue = deserialize(__dictValue).merged(with: fontWeightValue) + case "font_weight_value": + fontWeightValueValue = deserialize(__dictValue, validator: ResolvedValue.fontWeightValueValidator).merged(with: fontWeightValueValue) case "offset": offsetValue = deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, type: DivPointTemplate.self).merged(with: offsetValue) case "text_color": @@ -221,6 +231,8 @@ public final class DivSliderTemplate: TemplateValue { fontSizeUnitValue = fontSizeUnitValue.merged(with: { deserialize(__dictValue) }) case parent?.fontWeight?.link: fontWeightValue = fontWeightValue.merged(with: { deserialize(__dictValue) }) + case parent?.fontWeightValue?.link: + fontWeightValueValue = fontWeightValueValue.merged(with: { deserialize(__dictValue, validator: ResolvedValue.fontWeightValueValidator) }) case parent?.offset?.link: offsetValue = offsetValue.merged(with: { deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, type: DivPointTemplate.self) }) case parent?.textColor?.link: @@ -235,6 +247,7 @@ public final class DivSliderTemplate: TemplateValue { fontSizeValue.errorsOrWarnings?.map { .nestedObjectError(field: "font_size", error: $0) }, fontSizeUnitValue.errorsOrWarnings?.map { .nestedObjectError(field: "font_size_unit", error: $0) }, fontWeightValue.errorsOrWarnings?.map { .nestedObjectError(field: "font_weight", error: $0) }, + fontWeightValueValue.errorsOrWarnings?.map { .nestedObjectError(field: "font_weight_value", error: $0) }, offsetValue.errorsOrWarnings?.map { .nestedObjectError(field: "offset", error: $0) }, textColorValue.errorsOrWarnings?.map { .nestedObjectError(field: "text_color", error: $0) } ) @@ -250,6 +263,7 @@ public final class DivSliderTemplate: TemplateValue { fontSize: fontSizeNonNil, fontSizeUnit: fontSizeUnitValue.value, fontWeight: fontWeightValue.value, + fontWeightValue: fontWeightValueValue.value, offset: offsetValue.value, textColor: textColorValue.value ) @@ -267,6 +281,7 @@ public final class DivSliderTemplate: TemplateValue { fontSize: merged.fontSize, fontSizeUnit: merged.fontSizeUnit, fontWeight: merged.fontWeight, + fontWeightValue: merged.fontWeightValue, offset: merged.offset?.tryResolveParent(templates: templates), textColor: merged.textColor ) diff --git a/client/ios/DivKit/generated_sources/DivText.swift b/client/ios/DivKit/generated_sources/DivText.swift index ff345c2f7..733525ace 100644 --- a/client/ios/DivKit/generated_sources/DivText.swift +++ b/client/ios/DivKit/generated_sources/DivText.swift @@ -89,6 +89,7 @@ public final class DivText: DivBase { public let fontSize: Expression? // constraint: number >= 0 public let fontSizeUnit: Expression // default value: sp public let fontWeight: Expression? + public let fontWeightValue: Expression? // constraint: number > 0 public let letterSpacing: Expression? public let lineHeight: Expression? // constraint: number >= 0 public let start: Expression // constraint: number >= 0 @@ -122,6 +123,10 @@ public final class DivText: DivBase { resolver.resolveEnum(fontWeight) } + public func resolveFontWeightValue(_ resolver: ExpressionResolver) -> Int? { + resolver.resolveNumeric(fontWeightValue) + } + public func resolveLetterSpacing(_ resolver: ExpressionResolver) -> Double? { resolver.resolveNumeric(letterSpacing) } @@ -156,6 +161,9 @@ public final class DivText: DivBase { static let fontSizeValidator: AnyValueValidator = makeValueValidator(valueValidator: { $0 >= 0 }) + static let fontWeightValueValidator: AnyValueValidator = + makeValueValidator(valueValidator: { $0 > 0 }) + static let lineHeightValidator: AnyValueValidator = makeValueValidator(valueValidator: { $0 >= 0 }) @@ -175,6 +183,7 @@ public final class DivText: DivBase { fontSize: Expression? = nil, fontSizeUnit: Expression? = nil, fontWeight: Expression? = nil, + fontWeightValue: Expression? = nil, letterSpacing: Expression? = nil, lineHeight: Expression? = nil, start: Expression, @@ -193,6 +202,7 @@ public final class DivText: DivBase { self.fontSize = fontSize self.fontSizeUnit = fontSizeUnit ?? .value(.sp) self.fontWeight = fontWeight + self.fontWeightValue = fontWeightValue self.letterSpacing = letterSpacing self.lineHeight = lineHeight self.start = start @@ -227,6 +237,7 @@ public final class DivText: DivBase { public let fontSize: Expression // constraint: number >= 0; default value: 12 public let fontSizeUnit: Expression // default value: sp public let fontWeight: Expression // default value: regular + public let fontWeightValue: Expression? // constraint: number > 0 public let height: DivSize // default value: .divWrapContentSize(DivWrapContentSize()) public let id: String? public let images: [Image]? @@ -305,6 +316,10 @@ public final class DivText: DivBase { resolver.resolveEnum(fontWeight) ?? DivFontWeight.regular } + public func resolveFontWeightValue(_ resolver: ExpressionResolver) -> Int? { + resolver.resolveNumeric(fontWeightValue) + } + public func resolveLetterSpacing(_ resolver: ExpressionResolver) -> Double { resolver.resolveNumeric(letterSpacing) ?? 0 } @@ -366,6 +381,9 @@ public final class DivText: DivBase { static let fontSizeValidator: AnyValueValidator = makeValueValidator(valueValidator: { $0 >= 0 }) + static let fontWeightValueValidator: AnyValueValidator = + makeValueValidator(valueValidator: { $0 > 0 }) + static let lineHeightValidator: AnyValueValidator = makeValueValidator(valueValidator: { $0 >= 0 }) @@ -404,6 +422,7 @@ public final class DivText: DivBase { fontSize: Expression? = nil, fontSizeUnit: Expression? = nil, fontWeight: Expression? = nil, + fontWeightValue: Expression? = nil, height: DivSize? = nil, id: String? = nil, images: [Image]? = nil, @@ -460,6 +479,7 @@ public final class DivText: DivBase { self.fontSize = fontSize ?? .value(12) self.fontSizeUnit = fontSizeUnit ?? .value(.sp) self.fontWeight = fontWeight ?? .value(.regular) + self.fontWeightValue = fontWeightValue self.height = height ?? .divWrapContentSize(DivWrapContentSize()) self.id = id self.images = images @@ -550,82 +570,83 @@ extension DivText: Equatable { } guard lhs.fontWeight == rhs.fontWeight, - lhs.height == rhs.height, - lhs.id == rhs.id + lhs.fontWeightValue == rhs.fontWeightValue, + lhs.height == rhs.height else { return false } guard + lhs.id == rhs.id, lhs.images == rhs.images, - lhs.letterSpacing == rhs.letterSpacing, - lhs.lineHeight == rhs.lineHeight + lhs.letterSpacing == rhs.letterSpacing else { return false } guard + lhs.lineHeight == rhs.lineHeight, lhs.longtapActions == rhs.longtapActions, - lhs.margins == rhs.margins, - lhs.maxLines == rhs.maxLines + lhs.margins == rhs.margins else { return false } guard + lhs.maxLines == rhs.maxLines, lhs.minHiddenLines == rhs.minHiddenLines, - lhs.paddings == rhs.paddings, - lhs.ranges == rhs.ranges + lhs.paddings == rhs.paddings else { return false } guard + lhs.ranges == rhs.ranges, lhs.rowSpan == rhs.rowSpan, - lhs.selectable == rhs.selectable, - lhs.selectedActions == rhs.selectedActions + lhs.selectable == rhs.selectable else { return false } guard + lhs.selectedActions == rhs.selectedActions, lhs.strike == rhs.strike, - lhs.text == rhs.text, - lhs.textAlignmentHorizontal == rhs.textAlignmentHorizontal + lhs.text == rhs.text else { return false } guard + lhs.textAlignmentHorizontal == rhs.textAlignmentHorizontal, lhs.textAlignmentVertical == rhs.textAlignmentVertical, - lhs.textColor == rhs.textColor, - lhs.textGradient == rhs.textGradient + lhs.textColor == rhs.textColor else { return false } guard + lhs.textGradient == rhs.textGradient, lhs.textShadow == rhs.textShadow, - lhs.tooltips == rhs.tooltips, - lhs.transform == rhs.transform + lhs.tooltips == rhs.tooltips else { return false } guard + lhs.transform == rhs.transform, lhs.transitionChange == rhs.transitionChange, - lhs.transitionIn == rhs.transitionIn, - lhs.transitionOut == rhs.transitionOut + lhs.transitionIn == rhs.transitionIn else { return false } guard + lhs.transitionOut == rhs.transitionOut, lhs.transitionTriggers == rhs.transitionTriggers, - lhs.underline == rhs.underline, - lhs.variables == rhs.variables + lhs.underline == rhs.underline else { return false } guard + lhs.variables == rhs.variables, lhs.visibility == rhs.visibility, - lhs.visibilityAction == rhs.visibilityAction, - lhs.visibilityActions == rhs.visibilityActions + lhs.visibilityAction == rhs.visibilityAction else { return false } guard + lhs.visibilityActions == rhs.visibilityActions, lhs.width == rhs.width else { return false @@ -661,6 +682,7 @@ extension DivText: Serializable { result["font_size"] = fontSize.toValidSerializationValue() result["font_size_unit"] = fontSizeUnit.toValidSerializationValue() result["font_weight"] = fontWeight.toValidSerializationValue() + result["font_weight_value"] = fontWeightValue?.toValidSerializationValue() result["height"] = height.toDictionary() result["id"] = id result["images"] = images?.map { $0.toDictionary() } @@ -770,20 +792,21 @@ extension DivText.Range: Equatable { return false } guard + lhs.fontWeightValue == rhs.fontWeightValue, lhs.letterSpacing == rhs.letterSpacing, - lhs.lineHeight == rhs.lineHeight, - lhs.start == rhs.start + lhs.lineHeight == rhs.lineHeight else { return false } guard + lhs.start == rhs.start, lhs.strike == rhs.strike, - lhs.textColor == rhs.textColor, - lhs.textShadow == rhs.textShadow + lhs.textColor == rhs.textColor else { return false } guard + lhs.textShadow == rhs.textShadow, lhs.topOffset == rhs.topOffset, lhs.underline == rhs.underline else { @@ -831,6 +854,7 @@ extension DivText.Range: Serializable { result["font_size"] = fontSize?.toValidSerializationValue() result["font_size_unit"] = fontSizeUnit.toValidSerializationValue() result["font_weight"] = fontWeight?.toValidSerializationValue() + result["font_weight_value"] = fontWeightValue?.toValidSerializationValue() result["letter_spacing"] = letterSpacing?.toValidSerializationValue() result["line_height"] = lineHeight?.toValidSerializationValue() result["start"] = start.toValidSerializationValue() diff --git a/client/ios/DivKit/generated_sources/DivTextTemplate.swift b/client/ios/DivKit/generated_sources/DivTextTemplate.swift index 7a6a89906..b253f1c14 100644 --- a/client/ios/DivKit/generated_sources/DivTextTemplate.swift +++ b/client/ios/DivKit/generated_sources/DivTextTemplate.swift @@ -323,6 +323,7 @@ public final class DivTextTemplate: TemplateValue { public let fontSize: Field>? // constraint: number >= 0 public let fontSizeUnit: Field>? // default value: sp public let fontWeight: Field>? + public let fontWeightValue: Field>? // constraint: number > 0 public let letterSpacing: Field>? public let lineHeight: Field>? // constraint: number >= 0 public let start: Field>? // constraint: number >= 0 @@ -343,6 +344,7 @@ public final class DivTextTemplate: TemplateValue { fontSize: dictionary.getOptionalExpressionField("font_size"), fontSizeUnit: dictionary.getOptionalExpressionField("font_size_unit"), fontWeight: dictionary.getOptionalExpressionField("font_weight"), + fontWeightValue: dictionary.getOptionalExpressionField("font_weight_value"), letterSpacing: dictionary.getOptionalExpressionField("letter_spacing"), lineHeight: dictionary.getOptionalExpressionField("line_height"), start: dictionary.getOptionalExpressionField("start"), @@ -364,6 +366,7 @@ public final class DivTextTemplate: TemplateValue { fontSize: Field>? = nil, fontSizeUnit: Field>? = nil, fontWeight: Field>? = nil, + fontWeightValue: Field>? = nil, letterSpacing: Field>? = nil, lineHeight: Field>? = nil, start: Field>? = nil, @@ -382,6 +385,7 @@ public final class DivTextTemplate: TemplateValue { self.fontSize = fontSize self.fontSizeUnit = fontSizeUnit self.fontWeight = fontWeight + self.fontWeightValue = fontWeightValue self.letterSpacing = letterSpacing self.lineHeight = lineHeight self.start = start @@ -402,6 +406,7 @@ public final class DivTextTemplate: TemplateValue { let fontSizeValue = parent?.fontSize?.resolveOptionalValue(context: context, validator: ResolvedValue.fontSizeValidator) ?? .noValue let fontSizeUnitValue = parent?.fontSizeUnit?.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 lineHeightValue = parent?.lineHeight?.resolveOptionalValue(context: context, validator: ResolvedValue.lineHeightValidator) ?? .noValue let startValue = parent?.start?.resolveValue(context: context, validator: ResolvedValue.startValidator) ?? .noValue @@ -420,6 +425,7 @@ public final class DivTextTemplate: TemplateValue { fontSizeValue.errorsOrWarnings?.map { .nestedObjectError(field: "font_size", error: $0) }, fontSizeUnitValue.errorsOrWarnings?.map { .nestedObjectError(field: "font_size_unit", 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) }, lineHeightValue.errorsOrWarnings?.map { .nestedObjectError(field: "line_height", error: $0) }, startValue.errorsOrWarnings?.map { .nestedObjectError(field: "start", error: $0) }, @@ -451,6 +457,7 @@ public final class DivTextTemplate: TemplateValue { fontSize: fontSizeValue.value, fontSizeUnit: fontSizeUnitValue.value, fontWeight: fontWeightValue.value, + fontWeightValue: fontWeightValueValue.value, letterSpacing: letterSpacingValue.value, lineHeight: lineHeightValue.value, start: startNonNil, @@ -476,6 +483,7 @@ public final class DivTextTemplate: TemplateValue { var fontSizeValue: DeserializationResult> = parent?.fontSize?.value() ?? .noValue var fontSizeUnitValue: DeserializationResult> = parent?.fontSizeUnit?.value() ?? .noValue var fontWeightValue: DeserializationResult> = parent?.fontWeight?.value() ?? .noValue + var fontWeightValueValue: DeserializationResult> = parent?.fontWeightValue?.value() ?? .noValue var letterSpacingValue: DeserializationResult> = parent?.letterSpacing?.value() ?? .noValue var lineHeightValue: DeserializationResult> = parent?.lineHeight?.value() ?? .noValue var startValue: DeserializationResult> = parent?.start?.value() ?? .noValue @@ -504,6 +512,8 @@ public final class DivTextTemplate: TemplateValue { fontSizeUnitValue = deserialize(__dictValue).merged(with: fontSizeUnitValue) case "font_weight": fontWeightValue = deserialize(__dictValue).merged(with: fontWeightValue) + case "font_weight_value": + fontWeightValueValue = deserialize(__dictValue, validator: ResolvedValue.fontWeightValueValidator).merged(with: fontWeightValueValue) case "letter_spacing": letterSpacingValue = deserialize(__dictValue).merged(with: letterSpacingValue) case "line_height": @@ -538,6 +548,8 @@ public final class DivTextTemplate: TemplateValue { fontSizeUnitValue = fontSizeUnitValue.merged(with: { deserialize(__dictValue) }) case parent?.fontWeight?.link: fontWeightValue = fontWeightValue.merged(with: { deserialize(__dictValue) }) + case parent?.fontWeightValue?.link: + fontWeightValueValue = fontWeightValueValue.merged(with: { deserialize(__dictValue, validator: ResolvedValue.fontWeightValueValidator) }) case parent?.letterSpacing?.link: letterSpacingValue = letterSpacingValue.merged(with: { deserialize(__dictValue) }) case parent?.lineHeight?.link: @@ -573,6 +585,7 @@ public final class DivTextTemplate: TemplateValue { fontSizeValue.errorsOrWarnings?.map { .nestedObjectError(field: "font_size", error: $0) }, fontSizeUnitValue.errorsOrWarnings?.map { .nestedObjectError(field: "font_size_unit", 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) }, lineHeightValue.errorsOrWarnings?.map { .nestedObjectError(field: "line_height", error: $0) }, startValue.errorsOrWarnings?.map { .nestedObjectError(field: "start", error: $0) }, @@ -604,6 +617,7 @@ public final class DivTextTemplate: TemplateValue { fontSize: fontSizeValue.value, fontSizeUnit: fontSizeUnitValue.value, fontWeight: fontWeightValue.value, + fontWeightValue: fontWeightValueValue.value, letterSpacing: letterSpacingValue.value, lineHeight: lineHeightValue.value, start: startNonNil, @@ -633,6 +647,7 @@ public final class DivTextTemplate: TemplateValue { fontSize: merged.fontSize, fontSizeUnit: merged.fontSizeUnit, fontWeight: merged.fontWeight, + fontWeightValue: merged.fontWeightValue, letterSpacing: merged.letterSpacing, lineHeight: merged.lineHeight, start: merged.start, @@ -669,6 +684,7 @@ public final class DivTextTemplate: TemplateValue { public let fontSize: Field>? // constraint: number >= 0; default value: 12 public let fontSizeUnit: Field>? // default value: sp public let fontWeight: Field>? // default value: regular + public let fontWeightValue: Field>? // constraint: number > 0 public let height: Field? // default value: .divWrapContentSize(DivWrapContentSize()) public let id: Field? public let images: Field<[ImageTemplate]>? @@ -728,6 +744,7 @@ public final class DivTextTemplate: TemplateValue { fontSize: dictionary.getOptionalExpressionField("font_size"), fontSizeUnit: dictionary.getOptionalExpressionField("font_size_unit"), fontWeight: dictionary.getOptionalExpressionField("font_weight"), + fontWeightValue: dictionary.getOptionalExpressionField("font_weight_value"), height: dictionary.getOptionalField("height", templateToType: templateToType), id: dictionary.getOptionalField("id"), images: dictionary.getOptionalArray("images", templateToType: templateToType), @@ -788,6 +805,7 @@ public final class DivTextTemplate: TemplateValue { fontSize: Field>? = nil, fontSizeUnit: Field>? = nil, fontWeight: Field>? = nil, + fontWeightValue: Field>? = nil, height: Field? = nil, id: Field? = nil, images: Field<[ImageTemplate]>? = nil, @@ -845,6 +863,7 @@ public final class DivTextTemplate: TemplateValue { self.fontSize = fontSize self.fontSizeUnit = fontSizeUnit self.fontWeight = fontWeight + self.fontWeightValue = fontWeightValue self.height = height self.id = id self.images = images @@ -903,6 +922,7 @@ public final class DivTextTemplate: TemplateValue { let fontSizeValue = parent?.fontSize?.resolveOptionalValue(context: context, validator: ResolvedValue.fontSizeValidator) ?? .noValue let fontSizeUnitValue = parent?.fontSizeUnit?.resolveOptionalValue(context: context) ?? .noValue let fontWeightValue = parent?.fontWeight?.resolveOptionalValue(context: context) ?? .noValue + let fontWeightValueValue = parent?.fontWeightValue?.resolveOptionalValue(context: context, validator: ResolvedValue.fontWeightValueValidator) ?? .noValue let heightValue = parent?.height?.resolveOptionalValue(context: context, useOnlyLinks: true) ?? .noValue let idValue = parent?.id?.resolveOptionalValue(context: context) ?? .noValue let imagesValue = parent?.images?.resolveOptionalValue(context: context, useOnlyLinks: true) ?? .noValue @@ -959,6 +979,7 @@ public final class DivTextTemplate: TemplateValue { fontSizeValue.errorsOrWarnings?.map { .nestedObjectError(field: "font_size", error: $0) }, fontSizeUnitValue.errorsOrWarnings?.map { .nestedObjectError(field: "font_size_unit", error: $0) }, fontWeightValue.errorsOrWarnings?.map { .nestedObjectError(field: "font_weight", error: $0) }, + fontWeightValueValue.errorsOrWarnings?.map { .nestedObjectError(field: "font_weight_value", error: $0) }, heightValue.errorsOrWarnings?.map { .nestedObjectError(field: "height", error: $0) }, idValue.errorsOrWarnings?.map { .nestedObjectError(field: "id", error: $0) }, imagesValue.errorsOrWarnings?.map { .nestedObjectError(field: "images", error: $0) }, @@ -1024,6 +1045,7 @@ public final class DivTextTemplate: TemplateValue { fontSize: fontSizeValue.value, fontSizeUnit: fontSizeUnitValue.value, fontWeight: fontWeightValue.value, + fontWeightValue: fontWeightValueValue.value, height: heightValue.value, id: idValue.value, images: imagesValue.value, @@ -1087,6 +1109,7 @@ public final class DivTextTemplate: TemplateValue { var fontSizeValue: DeserializationResult> = parent?.fontSize?.value() ?? .noValue var fontSizeUnitValue: DeserializationResult> = parent?.fontSizeUnit?.value() ?? .noValue var fontWeightValue: DeserializationResult> = parent?.fontWeight?.value() ?? .noValue + var fontWeightValueValue: DeserializationResult> = parent?.fontWeightValue?.value() ?? .noValue var heightValue: DeserializationResult = .noValue var idValue: DeserializationResult = parent?.id?.value() ?? .noValue var imagesValue: DeserializationResult<[DivText.Image]> = .noValue @@ -1166,6 +1189,8 @@ public final class DivTextTemplate: TemplateValue { fontSizeUnitValue = deserialize(__dictValue).merged(with: fontSizeUnitValue) case "font_weight": fontWeightValue = deserialize(__dictValue).merged(with: fontWeightValue) + case "font_weight_value": + fontWeightValueValue = deserialize(__dictValue, validator: ResolvedValue.fontWeightValueValidator).merged(with: fontWeightValueValue) case "height": heightValue = deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, type: DivSizeTemplate.self).merged(with: heightValue) case "id": @@ -1276,6 +1301,8 @@ public final class DivTextTemplate: TemplateValue { fontSizeUnitValue = fontSizeUnitValue.merged(with: { deserialize(__dictValue) }) case parent?.fontWeight?.link: fontWeightValue = fontWeightValue.merged(with: { deserialize(__dictValue) }) + case parent?.fontWeightValue?.link: + fontWeightValueValue = fontWeightValueValue.merged(with: { deserialize(__dictValue, validator: ResolvedValue.fontWeightValueValidator) }) case parent?.height?.link: heightValue = heightValue.merged(with: { deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, type: DivSizeTemplate.self) }) case parent?.id?.link: @@ -1399,6 +1426,7 @@ public final class DivTextTemplate: TemplateValue { fontSizeValue.errorsOrWarnings?.map { .nestedObjectError(field: "font_size", error: $0) }, fontSizeUnitValue.errorsOrWarnings?.map { .nestedObjectError(field: "font_size_unit", error: $0) }, fontWeightValue.errorsOrWarnings?.map { .nestedObjectError(field: "font_weight", error: $0) }, + fontWeightValueValue.errorsOrWarnings?.map { .nestedObjectError(field: "font_weight_value", error: $0) }, heightValue.errorsOrWarnings?.map { .nestedObjectError(field: "height", error: $0) }, idValue.errorsOrWarnings?.map { .nestedObjectError(field: "id", error: $0) }, imagesValue.errorsOrWarnings?.map { .nestedObjectError(field: "images", error: $0) }, @@ -1464,6 +1492,7 @@ public final class DivTextTemplate: TemplateValue { fontSize: fontSizeValue.value, fontSizeUnit: fontSizeUnitValue.value, fontWeight: fontWeightValue.value, + fontWeightValue: fontWeightValueValue.value, height: heightValue.value, id: idValue.value, images: imagesValue.value, @@ -1532,6 +1561,7 @@ public final class DivTextTemplate: TemplateValue { fontSize: fontSize ?? mergedParent.fontSize, fontSizeUnit: fontSizeUnit ?? mergedParent.fontSizeUnit, fontWeight: fontWeight ?? mergedParent.fontWeight, + fontWeightValue: fontWeightValue ?? mergedParent.fontWeightValue, height: height ?? mergedParent.height, id: id ?? mergedParent.id, images: images ?? mergedParent.images, @@ -1595,6 +1625,7 @@ public final class DivTextTemplate: TemplateValue { fontSize: merged.fontSize, fontSizeUnit: merged.fontSizeUnit, fontWeight: merged.fontWeight, + fontWeightValue: merged.fontWeightValue, height: merged.height?.tryResolveParent(templates: templates), id: merged.id, images: merged.images?.tryResolveParent(templates: templates),