mirror of
https://github.com/divkit/divkit.git
synced 2026-06-06 20:07:59 +00:00
1477 lines
63 KiB
Swift
1477 lines
63 KiB
Swift
// Generated code. Do not modify.
|
|
|
|
import Foundation
|
|
import Serialization
|
|
import VGSL
|
|
|
|
public final class DivText: DivBase, @unchecked Sendable {
|
|
@frozen
|
|
public enum Truncate: String, CaseIterable, Sendable {
|
|
case none = "none"
|
|
case start = "start"
|
|
case end = "end"
|
|
case middle = "middle"
|
|
}
|
|
|
|
public final class Ellipsis: Sendable {
|
|
public let actions: [DivAction]?
|
|
public let imageBuilder: ImageBuilder?
|
|
public let images: [Image]?
|
|
public let rangeBuilder: RangeBuilder?
|
|
public let ranges: [Range]?
|
|
public let text: Expression<String>
|
|
|
|
public func resolveText(_ resolver: ExpressionResolver) -> String? {
|
|
resolver.resolveString(text)
|
|
}
|
|
|
|
public convenience init(dictionary: [String: Any], context: ParsingContext) throws {
|
|
self.init(
|
|
actions: try dictionary.getOptionalArray("actions", transform: { (dict: [String: Any]) in try? DivAction(dictionary: dict, context: context) }),
|
|
imageBuilder: try dictionary.getOptionalField("image_builder", transform: { (dict: [String: Any]) in try DivText.ImageBuilder(dictionary: dict, context: context) }),
|
|
images: try dictionary.getOptionalArray("images", transform: { (dict: [String: Any]) in try? DivText.Image(dictionary: dict, context: context) }),
|
|
rangeBuilder: try dictionary.getOptionalField("range_builder", transform: { (dict: [String: Any]) in try DivText.RangeBuilder(dictionary: dict, context: context) }),
|
|
ranges: try dictionary.getOptionalArray("ranges", transform: { (dict: [String: Any]) in try? DivText.Range(dictionary: dict, context: context) }),
|
|
text: try dictionary.getExpressionField("text", context: context)
|
|
)
|
|
}
|
|
|
|
init(
|
|
actions: [DivAction]? = nil,
|
|
imageBuilder: ImageBuilder? = nil,
|
|
images: [Image]? = nil,
|
|
rangeBuilder: RangeBuilder? = nil,
|
|
ranges: [Range]? = nil,
|
|
text: Expression<String>
|
|
) {
|
|
self.actions = actions
|
|
self.imageBuilder = imageBuilder
|
|
self.images = images
|
|
self.rangeBuilder = rangeBuilder
|
|
self.ranges = ranges
|
|
self.text = text
|
|
}
|
|
}
|
|
|
|
public final class Image: Sendable {
|
|
@frozen
|
|
public enum IndexingDirection: String, CaseIterable, Sendable {
|
|
case normal = "normal"
|
|
case reversed = "reversed"
|
|
}
|
|
|
|
public final class Accessibility: Sendable {
|
|
@frozen
|
|
public enum Kind: String, CaseIterable, Sendable {
|
|
case none = "none"
|
|
case button = "button"
|
|
case image = "image"
|
|
case text = "text"
|
|
case auto = "auto"
|
|
}
|
|
|
|
public let description: Expression<String>?
|
|
public let type: Kind // default value: auto
|
|
|
|
public func resolveDescription(_ resolver: ExpressionResolver) -> String? {
|
|
resolver.resolveString(description)
|
|
}
|
|
|
|
public convenience init(dictionary: [String: Any], context: ParsingContext) throws {
|
|
self.init(
|
|
description: try dictionary.getOptionalExpressionField("description", context: context),
|
|
type: try dictionary.getOptionalField("type", context: context)
|
|
)
|
|
}
|
|
|
|
init(
|
|
description: Expression<String>? = nil,
|
|
type: Kind? = nil
|
|
) {
|
|
self.description = description
|
|
self.type = type ?? .auto
|
|
}
|
|
}
|
|
|
|
public let accessibility: Accessibility?
|
|
public let alignmentVertical: Expression<DivTextAlignmentVertical> // default value: center
|
|
public let height: DivFixedSize // default value: DivFixedSize(value: .value(20))
|
|
public let indexingDirection: Expression<IndexingDirection> // default value: normal
|
|
public let preloadRequired: Expression<Bool> // default value: false
|
|
public let start: Expression<Int> // constraint: number >= 0
|
|
public let tintColor: Expression<Color>?
|
|
public let tintMode: Expression<DivBlendMode> // default value: source_in
|
|
public let url: Expression<URL>
|
|
public let width: DivFixedSize // default value: DivFixedSize(value: .value(20))
|
|
|
|
public func resolveAlignmentVertical(_ resolver: ExpressionResolver) -> DivTextAlignmentVertical {
|
|
resolver.resolveEnum(alignmentVertical) ?? DivTextAlignmentVertical.center
|
|
}
|
|
|
|
public func resolveIndexingDirection(_ resolver: ExpressionResolver) -> IndexingDirection {
|
|
resolver.resolveEnum(indexingDirection) ?? IndexingDirection.normal
|
|
}
|
|
|
|
public func resolvePreloadRequired(_ resolver: ExpressionResolver) -> Bool {
|
|
resolver.resolveNumeric(preloadRequired) ?? false
|
|
}
|
|
|
|
public func resolveStart(_ resolver: ExpressionResolver) -> Int? {
|
|
resolver.resolveNumeric(start)
|
|
}
|
|
|
|
public func resolveTintColor(_ resolver: ExpressionResolver) -> Color? {
|
|
resolver.resolveColor(tintColor)
|
|
}
|
|
|
|
public func resolveTintMode(_ resolver: ExpressionResolver) -> DivBlendMode {
|
|
resolver.resolveEnum(tintMode) ?? DivBlendMode.sourceIn
|
|
}
|
|
|
|
public func resolveUrl(_ resolver: ExpressionResolver) -> URL? {
|
|
resolver.resolveUrl(url)
|
|
}
|
|
|
|
static let startValidator: AnyValueValidator<Int> =
|
|
makeValueValidator(valueValidator: { $0 >= 0 })
|
|
|
|
public convenience init(dictionary: [String: Any], context: ParsingContext) throws {
|
|
self.init(
|
|
accessibility: try dictionary.getOptionalField("accessibility", transform: { (dict: [String: Any]) in try DivText.Image.Accessibility(dictionary: dict, context: context) }),
|
|
alignmentVertical: try dictionary.getOptionalExpressionField("alignment_vertical", context: context),
|
|
height: try dictionary.getOptionalField("height", transform: { (dict: [String: Any]) in try DivFixedSize(dictionary: dict, context: context) }),
|
|
indexingDirection: try dictionary.getOptionalExpressionField("indexing_direction", context: context),
|
|
preloadRequired: try dictionary.getOptionalExpressionField("preload_required", context: context),
|
|
start: try dictionary.getExpressionField("start", validator: Self.startValidator, context: context),
|
|
tintColor: try dictionary.getOptionalExpressionField("tint_color", transform: Color.color(withHexString:), context: context),
|
|
tintMode: try dictionary.getOptionalExpressionField("tint_mode", context: context),
|
|
url: try dictionary.getExpressionField("url", transform: URL.makeFromNonEncodedString, context: context),
|
|
width: try dictionary.getOptionalField("width", transform: { (dict: [String: Any]) in try DivFixedSize(dictionary: dict, context: context) })
|
|
)
|
|
}
|
|
|
|
init(
|
|
accessibility: Accessibility? = nil,
|
|
alignmentVertical: Expression<DivTextAlignmentVertical>? = nil,
|
|
height: DivFixedSize? = nil,
|
|
indexingDirection: Expression<IndexingDirection>? = nil,
|
|
preloadRequired: Expression<Bool>? = nil,
|
|
start: Expression<Int>,
|
|
tintColor: Expression<Color>? = nil,
|
|
tintMode: Expression<DivBlendMode>? = nil,
|
|
url: Expression<URL>,
|
|
width: DivFixedSize? = nil
|
|
) {
|
|
self.accessibility = accessibility
|
|
self.alignmentVertical = alignmentVertical ?? .value(.center)
|
|
self.height = height ?? DivFixedSize(value: .value(20))
|
|
self.indexingDirection = indexingDirection ?? .value(.normal)
|
|
self.preloadRequired = preloadRequired ?? .value(false)
|
|
self.start = start
|
|
self.tintColor = tintColor
|
|
self.tintMode = tintMode ?? .value(.sourceIn)
|
|
self.url = url
|
|
self.width = width ?? DivFixedSize(value: .value(20))
|
|
}
|
|
}
|
|
|
|
public final class ImageBuilder: @unchecked Sendable {
|
|
public final class Prototype: Sendable {
|
|
public let image: Image
|
|
public let selector: Expression<Bool> // default value: true
|
|
|
|
public func resolveSelector(_ resolver: ExpressionResolver) -> Bool {
|
|
resolver.resolveNumeric(selector) ?? true
|
|
}
|
|
|
|
public convenience init(dictionary: [String: Any], context: ParsingContext) throws {
|
|
self.init(
|
|
image: try dictionary.getField("image", transform: { (dict: [String: Any]) in try DivText.Image(dictionary: dict, context: context) }, context: context),
|
|
selector: try dictionary.getOptionalExpressionField("selector", context: context)
|
|
)
|
|
}
|
|
|
|
init(
|
|
image: Image,
|
|
selector: Expression<Bool>? = nil
|
|
) {
|
|
self.image = image
|
|
self.selector = selector ?? .value(true)
|
|
}
|
|
}
|
|
|
|
public let data: Expression<[Any]>
|
|
public let dataElementName: String // default value: it
|
|
public let prototypes: [Prototype] // at least 1 elements
|
|
|
|
public func resolveData(_ resolver: ExpressionResolver) -> [Any]? {
|
|
resolver.resolveArray(data)
|
|
}
|
|
|
|
static let prototypesValidator: AnyArrayValueValidator<DivText.ImageBuilder.Prototype> =
|
|
makeArrayValidator(minItems: 1)
|
|
|
|
public convenience init(dictionary: [String: Any], context: ParsingContext) throws {
|
|
self.init(
|
|
data: try dictionary.getExpressionField("data", context: context),
|
|
dataElementName: try dictionary.getOptionalField("data_element_name", context: context),
|
|
prototypes: try dictionary.getArray("prototypes", transform: { (dict: [String: Any]) in try? DivText.ImageBuilder.Prototype(dictionary: dict, context: context) }, validator: Self.prototypesValidator, context: context)
|
|
)
|
|
}
|
|
|
|
init(
|
|
data: Expression<[Any]>,
|
|
dataElementName: String? = nil,
|
|
prototypes: [Prototype]
|
|
) {
|
|
self.data = data
|
|
self.dataElementName = dataElementName ?? "it"
|
|
self.prototypes = prototypes
|
|
}
|
|
}
|
|
|
|
public final class Range: @unchecked Sendable {
|
|
public let actions: [DivAction]?
|
|
public let alignmentVertical: Expression<DivTextAlignmentVertical>?
|
|
public let background: DivTextRangeBackground?
|
|
public let baselineOffset: Expression<Double> // default value: 0
|
|
public let border: DivTextRangeBorder?
|
|
public let end: Expression<Int>? // constraint: number > 0
|
|
public let fontFamily: Expression<String>?
|
|
public let fontFeatureSettings: Expression<String>?
|
|
public let fontSize: Expression<Int>? // constraint: number >= 0
|
|
public let fontSizeUnit: Expression<DivSizeUnit> // default value: sp
|
|
public let fontVariationSettings: Expression<[String: Any]>?
|
|
public let fontWeight: Expression<DivFontWeight>?
|
|
public let fontWeightValue: Expression<Int>? // constraint: number > 0
|
|
public let letterSpacing: Expression<Double>?
|
|
public let lineHeight: Expression<Int>? // constraint: number >= 0
|
|
public let mask: DivTextRangeMask?
|
|
public let start: Expression<Int> // constraint: number >= 0; default value: 0
|
|
public let strike: Expression<DivLineStyle>?
|
|
public let textColor: Expression<Color>?
|
|
public let textShadow: DivShadow?
|
|
public let topOffset: Expression<Int>? // constraint: number >= 0
|
|
public let underline: Expression<DivLineStyle>?
|
|
|
|
public func resolveAlignmentVertical(_ resolver: ExpressionResolver) -> DivTextAlignmentVertical? {
|
|
resolver.resolveEnum(alignmentVertical)
|
|
}
|
|
|
|
public func resolveBaselineOffset(_ resolver: ExpressionResolver) -> Double {
|
|
resolver.resolveNumeric(baselineOffset) ?? 0
|
|
}
|
|
|
|
public func resolveEnd(_ resolver: ExpressionResolver) -> Int? {
|
|
resolver.resolveNumeric(end)
|
|
}
|
|
|
|
public func resolveFontFamily(_ resolver: ExpressionResolver) -> String? {
|
|
resolver.resolveString(fontFamily)
|
|
}
|
|
|
|
public func resolveFontFeatureSettings(_ resolver: ExpressionResolver) -> String? {
|
|
resolver.resolveString(fontFeatureSettings)
|
|
}
|
|
|
|
public func resolveFontSize(_ resolver: ExpressionResolver) -> Int? {
|
|
resolver.resolveNumeric(fontSize)
|
|
}
|
|
|
|
public func resolveFontSizeUnit(_ resolver: ExpressionResolver) -> DivSizeUnit {
|
|
resolver.resolveEnum(fontSizeUnit) ?? DivSizeUnit.sp
|
|
}
|
|
|
|
public func resolveFontVariationSettings(_ resolver: ExpressionResolver) -> [String: Any]? {
|
|
resolver.resolveDict(fontVariationSettings)
|
|
}
|
|
|
|
public func resolveFontWeight(_ resolver: ExpressionResolver) -> DivFontWeight? {
|
|
resolver.resolveEnum(fontWeight)
|
|
}
|
|
|
|
public func resolveFontWeightValue(_ resolver: ExpressionResolver) -> Int? {
|
|
resolver.resolveNumeric(fontWeightValue)
|
|
}
|
|
|
|
public func resolveLetterSpacing(_ resolver: ExpressionResolver) -> Double? {
|
|
resolver.resolveNumeric(letterSpacing)
|
|
}
|
|
|
|
public func resolveLineHeight(_ resolver: ExpressionResolver) -> Int? {
|
|
resolver.resolveNumeric(lineHeight)
|
|
}
|
|
|
|
public func resolveStart(_ resolver: ExpressionResolver) -> Int {
|
|
resolver.resolveNumeric(start) ?? 0
|
|
}
|
|
|
|
public func resolveStrike(_ resolver: ExpressionResolver) -> DivLineStyle? {
|
|
resolver.resolveEnum(strike)
|
|
}
|
|
|
|
public func resolveTextColor(_ resolver: ExpressionResolver) -> Color? {
|
|
resolver.resolveColor(textColor)
|
|
}
|
|
|
|
public func resolveTopOffset(_ resolver: ExpressionResolver) -> Int? {
|
|
resolver.resolveNumeric(topOffset)
|
|
}
|
|
|
|
public func resolveUnderline(_ resolver: ExpressionResolver) -> DivLineStyle? {
|
|
resolver.resolveEnum(underline)
|
|
}
|
|
|
|
static let endValidator: AnyValueValidator<Int> =
|
|
makeValueValidator(valueValidator: { $0 > 0 })
|
|
|
|
static let fontSizeValidator: AnyValueValidator<Int> =
|
|
makeValueValidator(valueValidator: { $0 >= 0 })
|
|
|
|
static let fontWeightValueValidator: AnyValueValidator<Int> =
|
|
makeValueValidator(valueValidator: { $0 > 0 })
|
|
|
|
static let lineHeightValidator: AnyValueValidator<Int> =
|
|
makeValueValidator(valueValidator: { $0 >= 0 })
|
|
|
|
static let startValidator: AnyValueValidator<Int> =
|
|
makeValueValidator(valueValidator: { $0 >= 0 })
|
|
|
|
static let topOffsetValidator: AnyValueValidator<Int> =
|
|
makeValueValidator(valueValidator: { $0 >= 0 })
|
|
|
|
public convenience init(dictionary: [String: Any], context: ParsingContext) throws {
|
|
self.init(
|
|
actions: try dictionary.getOptionalArray("actions", transform: { (dict: [String: Any]) in try? DivAction(dictionary: dict, context: context) }),
|
|
alignmentVertical: try dictionary.getOptionalExpressionField("alignment_vertical", context: context),
|
|
background: try dictionary.getOptionalField("background", transform: { (dict: [String: Any]) in try DivTextRangeBackground(dictionary: dict, context: context) }),
|
|
baselineOffset: try dictionary.getOptionalExpressionField("baseline_offset", context: context),
|
|
border: try dictionary.getOptionalField("border", transform: { (dict: [String: Any]) in try DivTextRangeBorder(dictionary: dict, context: context) }),
|
|
end: try dictionary.getOptionalExpressionField("end", validator: Self.endValidator, context: context),
|
|
fontFamily: try dictionary.getOptionalExpressionField("font_family", context: context),
|
|
fontFeatureSettings: try dictionary.getOptionalExpressionField("font_feature_settings", context: context),
|
|
fontSize: try dictionary.getOptionalExpressionField("font_size", validator: Self.fontSizeValidator, context: context),
|
|
fontSizeUnit: try dictionary.getOptionalExpressionField("font_size_unit", context: context),
|
|
fontVariationSettings: try dictionary.getOptionalExpressionField("font_variation_settings", context: context),
|
|
fontWeight: try dictionary.getOptionalExpressionField("font_weight", context: context),
|
|
fontWeightValue: try dictionary.getOptionalExpressionField("font_weight_value", validator: Self.fontWeightValueValidator, context: context),
|
|
letterSpacing: try dictionary.getOptionalExpressionField("letter_spacing", context: context),
|
|
lineHeight: try dictionary.getOptionalExpressionField("line_height", validator: Self.lineHeightValidator, context: context),
|
|
mask: try dictionary.getOptionalField("mask", transform: { (dict: [String: Any]) in try DivTextRangeMask(dictionary: dict, context: context) }),
|
|
start: try dictionary.getOptionalExpressionField("start", validator: Self.startValidator, context: context),
|
|
strike: try dictionary.getOptionalExpressionField("strike", context: context),
|
|
textColor: try dictionary.getOptionalExpressionField("text_color", transform: Color.color(withHexString:), context: context),
|
|
textShadow: try dictionary.getOptionalField("text_shadow", transform: { (dict: [String: Any]) in try DivShadow(dictionary: dict, context: context) }),
|
|
topOffset: try dictionary.getOptionalExpressionField("top_offset", validator: Self.topOffsetValidator, context: context),
|
|
underline: try dictionary.getOptionalExpressionField("underline", context: context)
|
|
)
|
|
}
|
|
|
|
init(
|
|
actions: [DivAction]? = nil,
|
|
alignmentVertical: Expression<DivTextAlignmentVertical>? = nil,
|
|
background: DivTextRangeBackground? = nil,
|
|
baselineOffset: Expression<Double>? = nil,
|
|
border: DivTextRangeBorder? = nil,
|
|
end: Expression<Int>? = nil,
|
|
fontFamily: Expression<String>? = nil,
|
|
fontFeatureSettings: Expression<String>? = nil,
|
|
fontSize: Expression<Int>? = nil,
|
|
fontSizeUnit: Expression<DivSizeUnit>? = nil,
|
|
fontVariationSettings: Expression<[String: Any]>? = nil,
|
|
fontWeight: Expression<DivFontWeight>? = nil,
|
|
fontWeightValue: Expression<Int>? = nil,
|
|
letterSpacing: Expression<Double>? = nil,
|
|
lineHeight: Expression<Int>? = nil,
|
|
mask: DivTextRangeMask? = nil,
|
|
start: Expression<Int>? = nil,
|
|
strike: Expression<DivLineStyle>? = nil,
|
|
textColor: Expression<Color>? = nil,
|
|
textShadow: DivShadow? = nil,
|
|
topOffset: Expression<Int>? = nil,
|
|
underline: Expression<DivLineStyle>? = nil
|
|
) {
|
|
self.actions = actions
|
|
self.alignmentVertical = alignmentVertical
|
|
self.background = background
|
|
self.baselineOffset = baselineOffset ?? .value(0)
|
|
self.border = border
|
|
self.end = end
|
|
self.fontFamily = fontFamily
|
|
self.fontFeatureSettings = fontFeatureSettings
|
|
self.fontSize = fontSize
|
|
self.fontSizeUnit = fontSizeUnit ?? .value(.sp)
|
|
self.fontVariationSettings = fontVariationSettings
|
|
self.fontWeight = fontWeight
|
|
self.fontWeightValue = fontWeightValue
|
|
self.letterSpacing = letterSpacing
|
|
self.lineHeight = lineHeight
|
|
self.mask = mask
|
|
self.start = start ?? .value(0)
|
|
self.strike = strike
|
|
self.textColor = textColor
|
|
self.textShadow = textShadow
|
|
self.topOffset = topOffset
|
|
self.underline = underline
|
|
}
|
|
}
|
|
|
|
public final class RangeBuilder: @unchecked Sendable {
|
|
public final class Prototype: Sendable {
|
|
public let range: Range
|
|
public let selector: Expression<Bool> // default value: true
|
|
|
|
public func resolveSelector(_ resolver: ExpressionResolver) -> Bool {
|
|
resolver.resolveNumeric(selector) ?? true
|
|
}
|
|
|
|
public convenience init(dictionary: [String: Any], context: ParsingContext) throws {
|
|
self.init(
|
|
range: try dictionary.getField("range", transform: { (dict: [String: Any]) in try DivText.Range(dictionary: dict, context: context) }, context: context),
|
|
selector: try dictionary.getOptionalExpressionField("selector", context: context)
|
|
)
|
|
}
|
|
|
|
init(
|
|
range: Range,
|
|
selector: Expression<Bool>? = nil
|
|
) {
|
|
self.range = range
|
|
self.selector = selector ?? .value(true)
|
|
}
|
|
}
|
|
|
|
public let data: Expression<[Any]>
|
|
public let dataElementName: String // default value: it
|
|
public let prototypes: [Prototype] // at least 1 elements
|
|
|
|
public func resolveData(_ resolver: ExpressionResolver) -> [Any]? {
|
|
resolver.resolveArray(data)
|
|
}
|
|
|
|
static let prototypesValidator: AnyArrayValueValidator<DivText.RangeBuilder.Prototype> =
|
|
makeArrayValidator(minItems: 1)
|
|
|
|
public convenience init(dictionary: [String: Any], context: ParsingContext) throws {
|
|
self.init(
|
|
data: try dictionary.getExpressionField("data", context: context),
|
|
dataElementName: try dictionary.getOptionalField("data_element_name", context: context),
|
|
prototypes: try dictionary.getArray("prototypes", transform: { (dict: [String: Any]) in try? DivText.RangeBuilder.Prototype(dictionary: dict, context: context) }, validator: Self.prototypesValidator, context: context)
|
|
)
|
|
}
|
|
|
|
init(
|
|
data: Expression<[Any]>,
|
|
dataElementName: String? = nil,
|
|
prototypes: [Prototype]
|
|
) {
|
|
self.data = data
|
|
self.dataElementName = dataElementName ?? "it"
|
|
self.prototypes = prototypes
|
|
}
|
|
}
|
|
|
|
public static let type: String = "text"
|
|
public let accessibility: DivAccessibility?
|
|
public let action: DivAction?
|
|
public let actionAnimation: DivAnimation // default value: DivAnimation(duration: .value(100), endValue: .value(0.6), name: .value(.fade), startValue: .value(1))
|
|
public let actions: [DivAction]?
|
|
public let alignmentHorizontal: Expression<DivAlignmentHorizontal>?
|
|
public let alignmentVertical: Expression<DivAlignmentVertical>?
|
|
public let alpha: Expression<Double> // constraint: number >= 0.0 && number <= 1.0; default value: 1.0
|
|
public let animators: [DivAnimator]?
|
|
public let autoEllipsize: Expression<Bool>?
|
|
public let background: [DivBackground]?
|
|
public let border: DivBorder?
|
|
public let captureFocusOnAction: Expression<Bool> // default value: true
|
|
public let columnSpan: Expression<Int>? // constraint: number >= 0
|
|
public let disappearActions: [DivDisappearAction]?
|
|
public let doubletapActions: [DivAction]?
|
|
public let ellipsis: Ellipsis?
|
|
public let extensions: [DivExtension]?
|
|
public let focus: DivFocus?
|
|
public let focusedTextColor: Expression<Color>?
|
|
public let fontFamily: Expression<String>?
|
|
public let fontFeatureSettings: Expression<String>?
|
|
public let fontSize: Expression<Int> // constraint: number >= 0; default value: 12
|
|
public let fontSizeUnit: Expression<DivSizeUnit> // default value: sp
|
|
public let fontVariationSettings: Expression<[String: Any]>?
|
|
public let fontWeight: Expression<DivFontWeight>?
|
|
public let fontWeightValue: Expression<Int>? // constraint: number > 0
|
|
public let functions: [DivFunction]?
|
|
public let height: DivSize // default value: .divWrapContentSize(DivWrapContentSize())
|
|
public let hoverEndActions: [DivAction]?
|
|
public let hoverStartActions: [DivAction]?
|
|
public let id: String?
|
|
public let imageBuilder: ImageBuilder?
|
|
public let images: [Image]?
|
|
public let layoutProvider: DivLayoutProvider?
|
|
public let letterSpacing: Expression<Double> // default value: 0
|
|
public let lineHeight: Expression<Int>? // constraint: number >= 0
|
|
public let longtapActions: [DivAction]?
|
|
public let margins: DivEdgeInsets?
|
|
public let maxLines: Expression<Int>? // constraint: number >= 0
|
|
public let minHiddenLines: Expression<Int>? // constraint: number >= 0
|
|
public let paddings: DivEdgeInsets?
|
|
public let pressEndActions: [DivAction]?
|
|
public let pressStartActions: [DivAction]?
|
|
public let rangeBuilder: RangeBuilder?
|
|
public let ranges: [Range]?
|
|
public let reuseId: Expression<String>?
|
|
public let rowSpan: Expression<Int>? // constraint: number >= 0
|
|
public let selectable: Expression<Bool> // default value: false
|
|
public let selectedActions: [DivAction]?
|
|
public let strike: Expression<DivLineStyle> // default value: none
|
|
public let text: Expression<String>
|
|
public let textAlignmentHorizontal: Expression<DivAlignmentHorizontal> // default value: start
|
|
public let textAlignmentVertical: Expression<DivAlignmentVertical> // default value: top
|
|
public let textColor: Expression<Color> // default value: #FF000000
|
|
public let textGradient: DivTextGradient?
|
|
public let textShadow: DivShadow?
|
|
public let tightenWidth: Expression<Bool> // default value: false
|
|
public let tooltips: [DivTooltip]?
|
|
public let transform: DivTransform?
|
|
public let transformations: [DivTransformation]?
|
|
public let transitionChange: DivChangeTransition?
|
|
public let transitionIn: DivAppearanceTransition?
|
|
public let transitionOut: DivAppearanceTransition?
|
|
public let transitionTriggers: [DivTransitionTrigger]? // at least 1 elements
|
|
public let truncate: Expression<Truncate> // default value: end
|
|
public let underline: Expression<DivLineStyle> // default value: none
|
|
public let variableTriggers: [DivTrigger]?
|
|
public let variables: [DivVariable]?
|
|
public let visibility: Expression<DivVisibility> // default value: visible
|
|
public let visibilityAction: DivVisibilityAction?
|
|
public let visibilityActions: [DivVisibilityAction]?
|
|
public let width: DivSize // default value: .divMatchParentSize(DivMatchParentSize())
|
|
|
|
public func resolveAlignmentHorizontal(_ resolver: ExpressionResolver) -> DivAlignmentHorizontal? {
|
|
resolver.resolveEnum(alignmentHorizontal)
|
|
}
|
|
|
|
public func resolveAlignmentVertical(_ resolver: ExpressionResolver) -> DivAlignmentVertical? {
|
|
resolver.resolveEnum(alignmentVertical)
|
|
}
|
|
|
|
public func resolveAlpha(_ resolver: ExpressionResolver) -> Double {
|
|
resolver.resolveNumeric(alpha) ?? 1.0
|
|
}
|
|
|
|
public func resolveAutoEllipsize(_ resolver: ExpressionResolver) -> Bool? {
|
|
resolver.resolveNumeric(autoEllipsize)
|
|
}
|
|
|
|
public func resolveCaptureFocusOnAction(_ resolver: ExpressionResolver) -> Bool {
|
|
resolver.resolveNumeric(captureFocusOnAction) ?? true
|
|
}
|
|
|
|
public func resolveColumnSpan(_ resolver: ExpressionResolver) -> Int? {
|
|
resolver.resolveNumeric(columnSpan)
|
|
}
|
|
|
|
public func resolveFocusedTextColor(_ resolver: ExpressionResolver) -> Color? {
|
|
resolver.resolveColor(focusedTextColor)
|
|
}
|
|
|
|
public func resolveFontFamily(_ resolver: ExpressionResolver) -> String? {
|
|
resolver.resolveString(fontFamily)
|
|
}
|
|
|
|
public func resolveFontFeatureSettings(_ resolver: ExpressionResolver) -> String? {
|
|
resolver.resolveString(fontFeatureSettings)
|
|
}
|
|
|
|
public func resolveFontSize(_ resolver: ExpressionResolver) -> Int {
|
|
resolver.resolveNumeric(fontSize) ?? 12
|
|
}
|
|
|
|
public func resolveFontSizeUnit(_ resolver: ExpressionResolver) -> DivSizeUnit {
|
|
resolver.resolveEnum(fontSizeUnit) ?? DivSizeUnit.sp
|
|
}
|
|
|
|
public func resolveFontVariationSettings(_ resolver: ExpressionResolver) -> [String: Any]? {
|
|
resolver.resolveDict(fontVariationSettings)
|
|
}
|
|
|
|
public func resolveFontWeight(_ resolver: ExpressionResolver) -> DivFontWeight? {
|
|
resolver.resolveEnum(fontWeight)
|
|
}
|
|
|
|
public func resolveFontWeightValue(_ resolver: ExpressionResolver) -> Int? {
|
|
resolver.resolveNumeric(fontWeightValue)
|
|
}
|
|
|
|
public func resolveLetterSpacing(_ resolver: ExpressionResolver) -> Double {
|
|
resolver.resolveNumeric(letterSpacing) ?? 0
|
|
}
|
|
|
|
public func resolveLineHeight(_ resolver: ExpressionResolver) -> Int? {
|
|
resolver.resolveNumeric(lineHeight)
|
|
}
|
|
|
|
public func resolveMaxLines(_ resolver: ExpressionResolver) -> Int? {
|
|
resolver.resolveNumeric(maxLines)
|
|
}
|
|
|
|
public func resolveMinHiddenLines(_ resolver: ExpressionResolver) -> Int? {
|
|
resolver.resolveNumeric(minHiddenLines)
|
|
}
|
|
|
|
public func resolveReuseId(_ resolver: ExpressionResolver) -> String? {
|
|
resolver.resolveString(reuseId)
|
|
}
|
|
|
|
public func resolveRowSpan(_ resolver: ExpressionResolver) -> Int? {
|
|
resolver.resolveNumeric(rowSpan)
|
|
}
|
|
|
|
public func resolveSelectable(_ resolver: ExpressionResolver) -> Bool {
|
|
resolver.resolveNumeric(selectable) ?? false
|
|
}
|
|
|
|
public func resolveStrike(_ resolver: ExpressionResolver) -> DivLineStyle {
|
|
resolver.resolveEnum(strike) ?? DivLineStyle.none
|
|
}
|
|
|
|
public func resolveText(_ resolver: ExpressionResolver) -> String? {
|
|
resolver.resolveString(text)
|
|
}
|
|
|
|
public func resolveTextAlignmentHorizontal(_ resolver: ExpressionResolver) -> DivAlignmentHorizontal {
|
|
resolver.resolveEnum(textAlignmentHorizontal) ?? DivAlignmentHorizontal.start
|
|
}
|
|
|
|
public func resolveTextAlignmentVertical(_ resolver: ExpressionResolver) -> DivAlignmentVertical {
|
|
resolver.resolveEnum(textAlignmentVertical) ?? DivAlignmentVertical.top
|
|
}
|
|
|
|
public func resolveTextColor(_ resolver: ExpressionResolver) -> Color {
|
|
resolver.resolveColor(textColor) ?? Color.colorWithARGBHexCode(0xFF000000)
|
|
}
|
|
|
|
public func resolveTightenWidth(_ resolver: ExpressionResolver) -> Bool {
|
|
resolver.resolveNumeric(tightenWidth) ?? false
|
|
}
|
|
|
|
public func resolveTruncate(_ resolver: ExpressionResolver) -> Truncate {
|
|
resolver.resolveEnum(truncate) ?? Truncate.end
|
|
}
|
|
|
|
public func resolveUnderline(_ resolver: ExpressionResolver) -> DivLineStyle {
|
|
resolver.resolveEnum(underline) ?? DivLineStyle.none
|
|
}
|
|
|
|
public func resolveVisibility(_ resolver: ExpressionResolver) -> DivVisibility {
|
|
resolver.resolveEnum(visibility) ?? DivVisibility.visible
|
|
}
|
|
|
|
static let alphaValidator: AnyValueValidator<Double> =
|
|
makeValueValidator(valueValidator: { $0 >= 0.0 && $0 <= 1.0 })
|
|
|
|
static let columnSpanValidator: AnyValueValidator<Int> =
|
|
makeValueValidator(valueValidator: { $0 >= 0 })
|
|
|
|
static let fontSizeValidator: AnyValueValidator<Int> =
|
|
makeValueValidator(valueValidator: { $0 >= 0 })
|
|
|
|
static let fontWeightValueValidator: AnyValueValidator<Int> =
|
|
makeValueValidator(valueValidator: { $0 > 0 })
|
|
|
|
static let lineHeightValidator: AnyValueValidator<Int> =
|
|
makeValueValidator(valueValidator: { $0 >= 0 })
|
|
|
|
static let maxLinesValidator: AnyValueValidator<Int> =
|
|
makeValueValidator(valueValidator: { $0 >= 0 })
|
|
|
|
static let minHiddenLinesValidator: AnyValueValidator<Int> =
|
|
makeValueValidator(valueValidator: { $0 >= 0 })
|
|
|
|
static let rowSpanValidator: AnyValueValidator<Int> =
|
|
makeValueValidator(valueValidator: { $0 >= 0 })
|
|
|
|
static let transitionTriggersValidator: AnyArrayValueValidator<DivTransitionTrigger> =
|
|
makeArrayValidator(minItems: 1)
|
|
|
|
public convenience init(dictionary: [String: Any], context: ParsingContext) throws {
|
|
self.init(
|
|
accessibility: try dictionary.getOptionalField("accessibility", transform: { (dict: [String: Any]) in try DivAccessibility(dictionary: dict, context: context) }),
|
|
action: try dictionary.getOptionalField("action", transform: { (dict: [String: Any]) in try DivAction(dictionary: dict, context: context) }),
|
|
actionAnimation: try dictionary.getOptionalField("action_animation", transform: { (dict: [String: Any]) in try DivAnimation(dictionary: dict, context: context) }),
|
|
actions: try dictionary.getOptionalArray("actions", transform: { (dict: [String: Any]) in try? DivAction(dictionary: dict, context: context) }),
|
|
alignmentHorizontal: try dictionary.getOptionalExpressionField("alignment_horizontal", context: context),
|
|
alignmentVertical: try dictionary.getOptionalExpressionField("alignment_vertical", context: context),
|
|
alpha: try dictionary.getOptionalExpressionField("alpha", validator: Self.alphaValidator, context: context),
|
|
animators: try dictionary.getOptionalArray("animators", transform: { (dict: [String: Any]) in try? DivAnimator(dictionary: dict, context: context) }),
|
|
autoEllipsize: try dictionary.getOptionalExpressionField("auto_ellipsize", context: context),
|
|
background: try dictionary.getOptionalArray("background", transform: { (dict: [String: Any]) in try? DivBackground(dictionary: dict, context: context) }),
|
|
border: try dictionary.getOptionalField("border", transform: { (dict: [String: Any]) in try DivBorder(dictionary: dict, context: context) }),
|
|
captureFocusOnAction: try dictionary.getOptionalExpressionField("capture_focus_on_action", context: context),
|
|
columnSpan: try dictionary.getOptionalExpressionField("column_span", validator: Self.columnSpanValidator, context: context),
|
|
disappearActions: try dictionary.getOptionalArray("disappear_actions", transform: { (dict: [String: Any]) in try? DivDisappearAction(dictionary: dict, context: context) }),
|
|
doubletapActions: try dictionary.getOptionalArray("doubletap_actions", transform: { (dict: [String: Any]) in try? DivAction(dictionary: dict, context: context) }),
|
|
ellipsis: try dictionary.getOptionalField("ellipsis", transform: { (dict: [String: Any]) in try DivText.Ellipsis(dictionary: dict, context: context) }),
|
|
extensions: try dictionary.getOptionalArray("extensions", transform: { (dict: [String: Any]) in try? DivExtension(dictionary: dict, context: context) }),
|
|
focus: try dictionary.getOptionalField("focus", transform: { (dict: [String: Any]) in try DivFocus(dictionary: dict, context: context) }),
|
|
focusedTextColor: try dictionary.getOptionalExpressionField("focused_text_color", transform: Color.color(withHexString:), context: context),
|
|
fontFamily: try dictionary.getOptionalExpressionField("font_family", context: context),
|
|
fontFeatureSettings: try dictionary.getOptionalExpressionField("font_feature_settings", context: context),
|
|
fontSize: try dictionary.getOptionalExpressionField("font_size", validator: Self.fontSizeValidator, context: context),
|
|
fontSizeUnit: try dictionary.getOptionalExpressionField("font_size_unit", context: context),
|
|
fontVariationSettings: try dictionary.getOptionalExpressionField("font_variation_settings", context: context),
|
|
fontWeight: try dictionary.getOptionalExpressionField("font_weight", context: context),
|
|
fontWeightValue: try dictionary.getOptionalExpressionField("font_weight_value", validator: Self.fontWeightValueValidator, context: context),
|
|
functions: try dictionary.getOptionalArray("functions", transform: { (dict: [String: Any]) in try? DivFunction(dictionary: dict, context: context) }),
|
|
height: try dictionary.getOptionalField("height", transform: { (dict: [String: Any]) in try DivSize(dictionary: dict, context: context) }),
|
|
hoverEndActions: try dictionary.getOptionalArray("hover_end_actions", transform: { (dict: [String: Any]) in try? DivAction(dictionary: dict, context: context) }),
|
|
hoverStartActions: try dictionary.getOptionalArray("hover_start_actions", transform: { (dict: [String: Any]) in try? DivAction(dictionary: dict, context: context) }),
|
|
id: try dictionary.getOptionalField("id", context: context),
|
|
imageBuilder: try dictionary.getOptionalField("image_builder", transform: { (dict: [String: Any]) in try DivText.ImageBuilder(dictionary: dict, context: context) }),
|
|
images: try dictionary.getOptionalArray("images", transform: { (dict: [String: Any]) in try? DivText.Image(dictionary: dict, context: context) }),
|
|
layoutProvider: try dictionary.getOptionalField("layout_provider", transform: { (dict: [String: Any]) in try DivLayoutProvider(dictionary: dict, context: context) }),
|
|
letterSpacing: try dictionary.getOptionalExpressionField("letter_spacing", context: context),
|
|
lineHeight: try dictionary.getOptionalExpressionField("line_height", validator: Self.lineHeightValidator, context: context),
|
|
longtapActions: try dictionary.getOptionalArray("longtap_actions", transform: { (dict: [String: Any]) in try? DivAction(dictionary: dict, context: context) }),
|
|
margins: try dictionary.getOptionalField("margins", transform: { (dict: [String: Any]) in try DivEdgeInsets(dictionary: dict, context: context) }),
|
|
maxLines: try dictionary.getOptionalExpressionField("max_lines", validator: Self.maxLinesValidator, context: context),
|
|
minHiddenLines: try dictionary.getOptionalExpressionField("min_hidden_lines", validator: Self.minHiddenLinesValidator, context: context),
|
|
paddings: try dictionary.getOptionalField("paddings", transform: { (dict: [String: Any]) in try DivEdgeInsets(dictionary: dict, context: context) }),
|
|
pressEndActions: try dictionary.getOptionalArray("press_end_actions", transform: { (dict: [String: Any]) in try? DivAction(dictionary: dict, context: context) }),
|
|
pressStartActions: try dictionary.getOptionalArray("press_start_actions", transform: { (dict: [String: Any]) in try? DivAction(dictionary: dict, context: context) }),
|
|
rangeBuilder: try dictionary.getOptionalField("range_builder", transform: { (dict: [String: Any]) in try DivText.RangeBuilder(dictionary: dict, context: context) }),
|
|
ranges: try dictionary.getOptionalArray("ranges", transform: { (dict: [String: Any]) in try? DivText.Range(dictionary: dict, context: context) }),
|
|
reuseId: try dictionary.getOptionalExpressionField("reuse_id", context: context),
|
|
rowSpan: try dictionary.getOptionalExpressionField("row_span", validator: Self.rowSpanValidator, context: context),
|
|
selectable: try dictionary.getOptionalExpressionField("selectable", context: context),
|
|
selectedActions: try dictionary.getOptionalArray("selected_actions", transform: { (dict: [String: Any]) in try? DivAction(dictionary: dict, context: context) }),
|
|
strike: try dictionary.getOptionalExpressionField("strike", context: context),
|
|
text: try dictionary.getExpressionField("text", context: context),
|
|
textAlignmentHorizontal: try dictionary.getOptionalExpressionField("text_alignment_horizontal", context: context),
|
|
textAlignmentVertical: try dictionary.getOptionalExpressionField("text_alignment_vertical", context: context),
|
|
textColor: try dictionary.getOptionalExpressionField("text_color", transform: Color.color(withHexString:), context: context),
|
|
textGradient: try dictionary.getOptionalField("text_gradient", transform: { (dict: [String: Any]) in try DivTextGradient(dictionary: dict, context: context) }),
|
|
textShadow: try dictionary.getOptionalField("text_shadow", transform: { (dict: [String: Any]) in try DivShadow(dictionary: dict, context: context) }),
|
|
tightenWidth: try dictionary.getOptionalExpressionField("tighten_width", context: context),
|
|
tooltips: try dictionary.getOptionalArray("tooltips", transform: { (dict: [String: Any]) in try? DivTooltip(dictionary: dict, context: context) }),
|
|
transform: try dictionary.getOptionalField("transform", transform: { (dict: [String: Any]) in try DivTransform(dictionary: dict, context: context) }),
|
|
transformations: try dictionary.getOptionalArray("transformations", transform: { (dict: [String: Any]) in try? DivTransformation(dictionary: dict, context: context) }),
|
|
transitionChange: try dictionary.getOptionalField("transition_change", transform: { (dict: [String: Any]) in try DivChangeTransition(dictionary: dict, context: context) }),
|
|
transitionIn: try dictionary.getOptionalField("transition_in", transform: { (dict: [String: Any]) in try DivAppearanceTransition(dictionary: dict, context: context) }),
|
|
transitionOut: try dictionary.getOptionalField("transition_out", transform: { (dict: [String: Any]) in try DivAppearanceTransition(dictionary: dict, context: context) }),
|
|
transitionTriggers: try dictionary.getOptionalArray("transition_triggers", validator: Self.transitionTriggersValidator, context: context),
|
|
truncate: try dictionary.getOptionalExpressionField("truncate", context: context),
|
|
underline: try dictionary.getOptionalExpressionField("underline", context: context),
|
|
variableTriggers: try dictionary.getOptionalArray("variable_triggers", transform: { (dict: [String: Any]) in try? DivTrigger(dictionary: dict, context: context) }),
|
|
variables: try dictionary.getOptionalArray("variables", transform: { (dict: [String: Any]) in try? DivVariable(dictionary: dict, context: context) }),
|
|
visibility: try dictionary.getOptionalExpressionField("visibility", context: context),
|
|
visibilityAction: try dictionary.getOptionalField("visibility_action", transform: { (dict: [String: Any]) in try DivVisibilityAction(dictionary: dict, context: context) }),
|
|
visibilityActions: try dictionary.getOptionalArray("visibility_actions", transform: { (dict: [String: Any]) in try? DivVisibilityAction(dictionary: dict, context: context) }),
|
|
width: try dictionary.getOptionalField("width", transform: { (dict: [String: Any]) in try DivSize(dictionary: dict, context: context) })
|
|
)
|
|
}
|
|
|
|
init(
|
|
accessibility: DivAccessibility? = nil,
|
|
action: DivAction? = nil,
|
|
actionAnimation: DivAnimation? = nil,
|
|
actions: [DivAction]? = nil,
|
|
alignmentHorizontal: Expression<DivAlignmentHorizontal>? = nil,
|
|
alignmentVertical: Expression<DivAlignmentVertical>? = nil,
|
|
alpha: Expression<Double>? = nil,
|
|
animators: [DivAnimator]? = nil,
|
|
autoEllipsize: Expression<Bool>? = nil,
|
|
background: [DivBackground]? = nil,
|
|
border: DivBorder? = nil,
|
|
captureFocusOnAction: Expression<Bool>? = nil,
|
|
columnSpan: Expression<Int>? = nil,
|
|
disappearActions: [DivDisappearAction]? = nil,
|
|
doubletapActions: [DivAction]? = nil,
|
|
ellipsis: Ellipsis? = nil,
|
|
extensions: [DivExtension]? = nil,
|
|
focus: DivFocus? = nil,
|
|
focusedTextColor: Expression<Color>? = nil,
|
|
fontFamily: Expression<String>? = nil,
|
|
fontFeatureSettings: Expression<String>? = nil,
|
|
fontSize: Expression<Int>? = nil,
|
|
fontSizeUnit: Expression<DivSizeUnit>? = nil,
|
|
fontVariationSettings: Expression<[String: Any]>? = nil,
|
|
fontWeight: Expression<DivFontWeight>? = nil,
|
|
fontWeightValue: Expression<Int>? = nil,
|
|
functions: [DivFunction]? = nil,
|
|
height: DivSize? = nil,
|
|
hoverEndActions: [DivAction]? = nil,
|
|
hoverStartActions: [DivAction]? = nil,
|
|
id: String? = nil,
|
|
imageBuilder: ImageBuilder? = nil,
|
|
images: [Image]? = nil,
|
|
layoutProvider: DivLayoutProvider? = nil,
|
|
letterSpacing: Expression<Double>? = nil,
|
|
lineHeight: Expression<Int>? = nil,
|
|
longtapActions: [DivAction]? = nil,
|
|
margins: DivEdgeInsets? = nil,
|
|
maxLines: Expression<Int>? = nil,
|
|
minHiddenLines: Expression<Int>? = nil,
|
|
paddings: DivEdgeInsets? = nil,
|
|
pressEndActions: [DivAction]? = nil,
|
|
pressStartActions: [DivAction]? = nil,
|
|
rangeBuilder: RangeBuilder? = nil,
|
|
ranges: [Range]? = nil,
|
|
reuseId: Expression<String>? = nil,
|
|
rowSpan: Expression<Int>? = nil,
|
|
selectable: Expression<Bool>? = nil,
|
|
selectedActions: [DivAction]? = nil,
|
|
strike: Expression<DivLineStyle>? = nil,
|
|
text: Expression<String>,
|
|
textAlignmentHorizontal: Expression<DivAlignmentHorizontal>? = nil,
|
|
textAlignmentVertical: Expression<DivAlignmentVertical>? = nil,
|
|
textColor: Expression<Color>? = nil,
|
|
textGradient: DivTextGradient? = nil,
|
|
textShadow: DivShadow? = nil,
|
|
tightenWidth: Expression<Bool>? = nil,
|
|
tooltips: [DivTooltip]? = nil,
|
|
transform: DivTransform? = nil,
|
|
transformations: [DivTransformation]? = nil,
|
|
transitionChange: DivChangeTransition? = nil,
|
|
transitionIn: DivAppearanceTransition? = nil,
|
|
transitionOut: DivAppearanceTransition? = nil,
|
|
transitionTriggers: [DivTransitionTrigger]? = nil,
|
|
truncate: Expression<Truncate>? = nil,
|
|
underline: Expression<DivLineStyle>? = nil,
|
|
variableTriggers: [DivTrigger]? = nil,
|
|
variables: [DivVariable]? = nil,
|
|
visibility: Expression<DivVisibility>? = nil,
|
|
visibilityAction: DivVisibilityAction? = nil,
|
|
visibilityActions: [DivVisibilityAction]? = nil,
|
|
width: DivSize? = nil
|
|
) {
|
|
self.accessibility = accessibility
|
|
self.action = action
|
|
self.actionAnimation = actionAnimation ?? DivAnimation(duration: .value(100), endValue: .value(0.6), name: .value(.fade), startValue: .value(1))
|
|
self.actions = actions
|
|
self.alignmentHorizontal = alignmentHorizontal
|
|
self.alignmentVertical = alignmentVertical
|
|
self.alpha = alpha ?? .value(1.0)
|
|
self.animators = animators
|
|
self.autoEllipsize = autoEllipsize
|
|
self.background = background
|
|
self.border = border
|
|
self.captureFocusOnAction = captureFocusOnAction ?? .value(true)
|
|
self.columnSpan = columnSpan
|
|
self.disappearActions = disappearActions
|
|
self.doubletapActions = doubletapActions
|
|
self.ellipsis = ellipsis
|
|
self.extensions = extensions
|
|
self.focus = focus
|
|
self.focusedTextColor = focusedTextColor
|
|
self.fontFamily = fontFamily
|
|
self.fontFeatureSettings = fontFeatureSettings
|
|
self.fontSize = fontSize ?? .value(12)
|
|
self.fontSizeUnit = fontSizeUnit ?? .value(.sp)
|
|
self.fontVariationSettings = fontVariationSettings
|
|
self.fontWeight = fontWeight
|
|
self.fontWeightValue = fontWeightValue
|
|
self.functions = functions
|
|
self.height = height ?? .divWrapContentSize(DivWrapContentSize())
|
|
self.hoverEndActions = hoverEndActions
|
|
self.hoverStartActions = hoverStartActions
|
|
self.id = id
|
|
self.imageBuilder = imageBuilder
|
|
self.images = images
|
|
self.layoutProvider = layoutProvider
|
|
self.letterSpacing = letterSpacing ?? .value(0)
|
|
self.lineHeight = lineHeight
|
|
self.longtapActions = longtapActions
|
|
self.margins = margins
|
|
self.maxLines = maxLines
|
|
self.minHiddenLines = minHiddenLines
|
|
self.paddings = paddings
|
|
self.pressEndActions = pressEndActions
|
|
self.pressStartActions = pressStartActions
|
|
self.rangeBuilder = rangeBuilder
|
|
self.ranges = ranges
|
|
self.reuseId = reuseId
|
|
self.rowSpan = rowSpan
|
|
self.selectable = selectable ?? .value(false)
|
|
self.selectedActions = selectedActions
|
|
self.strike = strike ?? .value(.none)
|
|
self.text = text
|
|
self.textAlignmentHorizontal = textAlignmentHorizontal ?? .value(.start)
|
|
self.textAlignmentVertical = textAlignmentVertical ?? .value(.top)
|
|
self.textColor = textColor ?? .value(Color.colorWithARGBHexCode(0xFF000000))
|
|
self.textGradient = textGradient
|
|
self.textShadow = textShadow
|
|
self.tightenWidth = tightenWidth ?? .value(false)
|
|
self.tooltips = tooltips
|
|
self.transform = transform
|
|
self.transformations = transformations
|
|
self.transitionChange = transitionChange
|
|
self.transitionIn = transitionIn
|
|
self.transitionOut = transitionOut
|
|
self.transitionTriggers = transitionTriggers
|
|
self.truncate = truncate ?? .value(.end)
|
|
self.underline = underline ?? .value(.none)
|
|
self.variableTriggers = variableTriggers
|
|
self.variables = variables
|
|
self.visibility = visibility ?? .value(.visible)
|
|
self.visibilityAction = visibilityAction
|
|
self.visibilityActions = visibilityActions
|
|
self.width = width ?? .divMatchParentSize(DivMatchParentSize())
|
|
}
|
|
}
|
|
|
|
#if DEBUG
|
|
// WARNING: this == is incomplete because of [String: Any] in class fields
|
|
extension DivText: Equatable {
|
|
public static func ==(lhs: DivText, rhs: DivText) -> Bool {
|
|
guard
|
|
lhs.accessibility == rhs.accessibility,
|
|
lhs.action == rhs.action,
|
|
lhs.actionAnimation == rhs.actionAnimation
|
|
else {
|
|
return false
|
|
}
|
|
guard
|
|
lhs.actions == rhs.actions,
|
|
lhs.alignmentHorizontal == rhs.alignmentHorizontal,
|
|
lhs.alignmentVertical == rhs.alignmentVertical
|
|
else {
|
|
return false
|
|
}
|
|
guard
|
|
lhs.alpha == rhs.alpha,
|
|
lhs.animators == rhs.animators,
|
|
lhs.autoEllipsize == rhs.autoEllipsize
|
|
else {
|
|
return false
|
|
}
|
|
guard
|
|
lhs.background == rhs.background,
|
|
lhs.border == rhs.border,
|
|
lhs.captureFocusOnAction == rhs.captureFocusOnAction
|
|
else {
|
|
return false
|
|
}
|
|
guard
|
|
lhs.columnSpan == rhs.columnSpan,
|
|
lhs.disappearActions == rhs.disappearActions,
|
|
lhs.doubletapActions == rhs.doubletapActions
|
|
else {
|
|
return false
|
|
}
|
|
guard
|
|
lhs.ellipsis == rhs.ellipsis,
|
|
lhs.extensions == rhs.extensions,
|
|
lhs.focus == rhs.focus
|
|
else {
|
|
return false
|
|
}
|
|
guard
|
|
lhs.focusedTextColor == rhs.focusedTextColor,
|
|
lhs.fontFamily == rhs.fontFamily,
|
|
lhs.fontFeatureSettings == rhs.fontFeatureSettings
|
|
else {
|
|
return false
|
|
}
|
|
guard
|
|
lhs.fontSize == rhs.fontSize,
|
|
lhs.fontSizeUnit == rhs.fontSizeUnit,
|
|
lhs.fontWeight == rhs.fontWeight
|
|
else {
|
|
return false
|
|
}
|
|
guard
|
|
lhs.fontWeightValue == rhs.fontWeightValue,
|
|
lhs.functions == rhs.functions,
|
|
lhs.height == rhs.height
|
|
else {
|
|
return false
|
|
}
|
|
guard
|
|
lhs.hoverEndActions == rhs.hoverEndActions,
|
|
lhs.hoverStartActions == rhs.hoverStartActions,
|
|
lhs.id == rhs.id
|
|
else {
|
|
return false
|
|
}
|
|
guard
|
|
lhs.imageBuilder == rhs.imageBuilder,
|
|
lhs.images == rhs.images,
|
|
lhs.layoutProvider == rhs.layoutProvider
|
|
else {
|
|
return false
|
|
}
|
|
guard
|
|
lhs.letterSpacing == rhs.letterSpacing,
|
|
lhs.lineHeight == rhs.lineHeight,
|
|
lhs.longtapActions == rhs.longtapActions
|
|
else {
|
|
return false
|
|
}
|
|
guard
|
|
lhs.margins == rhs.margins,
|
|
lhs.maxLines == rhs.maxLines,
|
|
lhs.minHiddenLines == rhs.minHiddenLines
|
|
else {
|
|
return false
|
|
}
|
|
guard
|
|
lhs.paddings == rhs.paddings,
|
|
lhs.pressEndActions == rhs.pressEndActions,
|
|
lhs.pressStartActions == rhs.pressStartActions
|
|
else {
|
|
return false
|
|
}
|
|
guard
|
|
lhs.rangeBuilder == rhs.rangeBuilder,
|
|
lhs.ranges == rhs.ranges,
|
|
lhs.reuseId == rhs.reuseId
|
|
else {
|
|
return false
|
|
}
|
|
guard
|
|
lhs.rowSpan == rhs.rowSpan,
|
|
lhs.selectable == rhs.selectable,
|
|
lhs.selectedActions == rhs.selectedActions
|
|
else {
|
|
return false
|
|
}
|
|
guard
|
|
lhs.strike == rhs.strike,
|
|
lhs.text == rhs.text,
|
|
lhs.textAlignmentHorizontal == rhs.textAlignmentHorizontal
|
|
else {
|
|
return false
|
|
}
|
|
guard
|
|
lhs.textAlignmentVertical == rhs.textAlignmentVertical,
|
|
lhs.textColor == rhs.textColor,
|
|
lhs.textGradient == rhs.textGradient
|
|
else {
|
|
return false
|
|
}
|
|
guard
|
|
lhs.textShadow == rhs.textShadow,
|
|
lhs.tightenWidth == rhs.tightenWidth,
|
|
lhs.tooltips == rhs.tooltips
|
|
else {
|
|
return false
|
|
}
|
|
guard
|
|
lhs.transform == rhs.transform,
|
|
lhs.transformations == rhs.transformations,
|
|
lhs.transitionChange == rhs.transitionChange
|
|
else {
|
|
return false
|
|
}
|
|
guard
|
|
lhs.transitionIn == rhs.transitionIn,
|
|
lhs.transitionOut == rhs.transitionOut,
|
|
lhs.transitionTriggers == rhs.transitionTriggers
|
|
else {
|
|
return false
|
|
}
|
|
guard
|
|
lhs.truncate == rhs.truncate,
|
|
lhs.underline == rhs.underline,
|
|
lhs.variableTriggers == rhs.variableTriggers
|
|
else {
|
|
return false
|
|
}
|
|
guard
|
|
lhs.variables == rhs.variables,
|
|
lhs.visibility == rhs.visibility,
|
|
lhs.visibilityAction == rhs.visibilityAction
|
|
else {
|
|
return false
|
|
}
|
|
guard
|
|
lhs.visibilityActions == rhs.visibilityActions,
|
|
lhs.width == rhs.width
|
|
else {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
}
|
|
#endif
|
|
|
|
extension DivText: Serializable {
|
|
@_optimize(size)
|
|
public func toDictionary() -> [String: ValidSerializationValue] {
|
|
var result: [String: ValidSerializationValue] = [:]
|
|
result["type"] = Self.type
|
|
result["accessibility"] = accessibility?.toDictionary()
|
|
result["action"] = action?.toDictionary()
|
|
result["action_animation"] = actionAnimation.toDictionary()
|
|
result["actions"] = actions?.map { $0.toDictionary() }
|
|
result["alignment_horizontal"] = alignmentHorizontal?.toValidSerializationValue()
|
|
result["alignment_vertical"] = alignmentVertical?.toValidSerializationValue()
|
|
result["alpha"] = alpha.toValidSerializationValue()
|
|
result["animators"] = animators?.map { $0.toDictionary() }
|
|
result["auto_ellipsize"] = autoEllipsize?.toValidSerializationValue()
|
|
result["background"] = background?.map { $0.toDictionary() }
|
|
result["border"] = border?.toDictionary()
|
|
result["capture_focus_on_action"] = captureFocusOnAction.toValidSerializationValue()
|
|
result["column_span"] = columnSpan?.toValidSerializationValue()
|
|
result["disappear_actions"] = disappearActions?.map { $0.toDictionary() }
|
|
result["doubletap_actions"] = doubletapActions?.map { $0.toDictionary() }
|
|
result["ellipsis"] = ellipsis?.toDictionary()
|
|
result["extensions"] = extensions?.map { $0.toDictionary() }
|
|
result["focus"] = focus?.toDictionary()
|
|
result["focused_text_color"] = focusedTextColor?.toValidSerializationValue()
|
|
result["font_family"] = fontFamily?.toValidSerializationValue()
|
|
result["font_feature_settings"] = fontFeatureSettings?.toValidSerializationValue()
|
|
result["font_size"] = fontSize.toValidSerializationValue()
|
|
result["font_size_unit"] = fontSizeUnit.toValidSerializationValue()
|
|
result["font_variation_settings"] = fontVariationSettings?.toValidSerializationValue()
|
|
result["font_weight"] = fontWeight?.toValidSerializationValue()
|
|
result["font_weight_value"] = fontWeightValue?.toValidSerializationValue()
|
|
result["functions"] = functions?.map { $0.toDictionary() }
|
|
result["height"] = height.toDictionary()
|
|
result["hover_end_actions"] = hoverEndActions?.map { $0.toDictionary() }
|
|
result["hover_start_actions"] = hoverStartActions?.map { $0.toDictionary() }
|
|
result["id"] = id
|
|
result["image_builder"] = imageBuilder?.toDictionary()
|
|
result["images"] = images?.map { $0.toDictionary() }
|
|
result["layout_provider"] = layoutProvider?.toDictionary()
|
|
result["letter_spacing"] = letterSpacing.toValidSerializationValue()
|
|
result["line_height"] = lineHeight?.toValidSerializationValue()
|
|
result["longtap_actions"] = longtapActions?.map { $0.toDictionary() }
|
|
result["margins"] = margins?.toDictionary()
|
|
result["max_lines"] = maxLines?.toValidSerializationValue()
|
|
result["min_hidden_lines"] = minHiddenLines?.toValidSerializationValue()
|
|
result["paddings"] = paddings?.toDictionary()
|
|
result["press_end_actions"] = pressEndActions?.map { $0.toDictionary() }
|
|
result["press_start_actions"] = pressStartActions?.map { $0.toDictionary() }
|
|
result["range_builder"] = rangeBuilder?.toDictionary()
|
|
result["ranges"] = ranges?.map { $0.toDictionary() }
|
|
result["reuse_id"] = reuseId?.toValidSerializationValue()
|
|
result["row_span"] = rowSpan?.toValidSerializationValue()
|
|
result["selectable"] = selectable.toValidSerializationValue()
|
|
result["selected_actions"] = selectedActions?.map { $0.toDictionary() }
|
|
result["strike"] = strike.toValidSerializationValue()
|
|
result["text"] = text.toValidSerializationValue()
|
|
result["text_alignment_horizontal"] = textAlignmentHorizontal.toValidSerializationValue()
|
|
result["text_alignment_vertical"] = textAlignmentVertical.toValidSerializationValue()
|
|
result["text_color"] = textColor.toValidSerializationValue()
|
|
result["text_gradient"] = textGradient?.toDictionary()
|
|
result["text_shadow"] = textShadow?.toDictionary()
|
|
result["tighten_width"] = tightenWidth.toValidSerializationValue()
|
|
result["tooltips"] = tooltips?.map { $0.toDictionary() }
|
|
result["transform"] = transform?.toDictionary()
|
|
result["transformations"] = transformations?.map { $0.toDictionary() }
|
|
result["transition_change"] = transitionChange?.toDictionary()
|
|
result["transition_in"] = transitionIn?.toDictionary()
|
|
result["transition_out"] = transitionOut?.toDictionary()
|
|
result["transition_triggers"] = transitionTriggers?.map { $0.rawValue }
|
|
result["truncate"] = truncate.toValidSerializationValue()
|
|
result["underline"] = underline.toValidSerializationValue()
|
|
result["variable_triggers"] = variableTriggers?.map { $0.toDictionary() }
|
|
result["variables"] = variables?.map { $0.toDictionary() }
|
|
result["visibility"] = visibility.toValidSerializationValue()
|
|
result["visibility_action"] = visibilityAction?.toDictionary()
|
|
result["visibility_actions"] = visibilityActions?.map { $0.toDictionary() }
|
|
result["width"] = width.toDictionary()
|
|
return result
|
|
}
|
|
}
|
|
|
|
#if DEBUG
|
|
// WARNING: this == is incomplete because of [String: Any] in class fields
|
|
extension DivText.ImageBuilder: Equatable {
|
|
public static func ==(lhs: DivText.ImageBuilder, rhs: DivText.ImageBuilder) -> Bool {
|
|
guard
|
|
lhs.dataElementName == rhs.dataElementName,
|
|
lhs.prototypes == rhs.prototypes
|
|
else {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
}
|
|
#endif
|
|
|
|
#if DEBUG
|
|
// WARNING: this == is incomplete because of [String: Any] in class fields
|
|
extension DivText.Range: Equatable {
|
|
public static func ==(lhs: DivText.Range, rhs: DivText.Range) -> Bool {
|
|
guard
|
|
lhs.actions == rhs.actions,
|
|
lhs.alignmentVertical == rhs.alignmentVertical,
|
|
lhs.background == rhs.background
|
|
else {
|
|
return false
|
|
}
|
|
guard
|
|
lhs.baselineOffset == rhs.baselineOffset,
|
|
lhs.border == rhs.border,
|
|
lhs.end == rhs.end
|
|
else {
|
|
return false
|
|
}
|
|
guard
|
|
lhs.fontFamily == rhs.fontFamily,
|
|
lhs.fontFeatureSettings == rhs.fontFeatureSettings,
|
|
lhs.fontSize == rhs.fontSize
|
|
else {
|
|
return false
|
|
}
|
|
guard
|
|
lhs.fontSizeUnit == rhs.fontSizeUnit,
|
|
lhs.fontWeight == rhs.fontWeight,
|
|
lhs.fontWeightValue == rhs.fontWeightValue
|
|
else {
|
|
return false
|
|
}
|
|
guard
|
|
lhs.letterSpacing == rhs.letterSpacing,
|
|
lhs.lineHeight == rhs.lineHeight,
|
|
lhs.mask == rhs.mask
|
|
else {
|
|
return false
|
|
}
|
|
guard
|
|
lhs.start == rhs.start,
|
|
lhs.strike == rhs.strike,
|
|
lhs.textColor == rhs.textColor
|
|
else {
|
|
return false
|
|
}
|
|
guard
|
|
lhs.textShadow == rhs.textShadow,
|
|
lhs.topOffset == rhs.topOffset,
|
|
lhs.underline == rhs.underline
|
|
else {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
}
|
|
#endif
|
|
|
|
#if DEBUG
|
|
// WARNING: this == is incomplete because of [String: Any] in class fields
|
|
extension DivText.RangeBuilder: Equatable {
|
|
public static func ==(lhs: DivText.RangeBuilder, rhs: DivText.RangeBuilder) -> Bool {
|
|
guard
|
|
lhs.dataElementName == rhs.dataElementName,
|
|
lhs.prototypes == rhs.prototypes
|
|
else {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
}
|
|
#endif
|
|
|
|
#if DEBUG
|
|
extension DivText.Ellipsis: Equatable {
|
|
public static func ==(lhs: DivText.Ellipsis, rhs: DivText.Ellipsis) -> Bool {
|
|
guard
|
|
lhs.actions == rhs.actions,
|
|
lhs.imageBuilder == rhs.imageBuilder,
|
|
lhs.images == rhs.images
|
|
else {
|
|
return false
|
|
}
|
|
guard
|
|
lhs.rangeBuilder == rhs.rangeBuilder,
|
|
lhs.ranges == rhs.ranges,
|
|
lhs.text == rhs.text
|
|
else {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
}
|
|
#endif
|
|
|
|
#if DEBUG
|
|
extension DivText.Image.Accessibility: Equatable {
|
|
public static func ==(lhs: DivText.Image.Accessibility, rhs: DivText.Image.Accessibility) -> Bool {
|
|
guard
|
|
lhs.description == rhs.description,
|
|
lhs.type == rhs.type
|
|
else {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
}
|
|
#endif
|
|
|
|
#if DEBUG
|
|
extension DivText.Image: Equatable {
|
|
public static func ==(lhs: DivText.Image, rhs: DivText.Image) -> Bool {
|
|
guard
|
|
lhs.accessibility == rhs.accessibility,
|
|
lhs.alignmentVertical == rhs.alignmentVertical,
|
|
lhs.height == rhs.height
|
|
else {
|
|
return false
|
|
}
|
|
guard
|
|
lhs.indexingDirection == rhs.indexingDirection,
|
|
lhs.preloadRequired == rhs.preloadRequired,
|
|
lhs.start == rhs.start
|
|
else {
|
|
return false
|
|
}
|
|
guard
|
|
lhs.tintColor == rhs.tintColor,
|
|
lhs.tintMode == rhs.tintMode,
|
|
lhs.url == rhs.url
|
|
else {
|
|
return false
|
|
}
|
|
guard
|
|
lhs.width == rhs.width
|
|
else {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
}
|
|
#endif
|
|
|
|
#if DEBUG
|
|
extension DivText.ImageBuilder.Prototype: Equatable {
|
|
public static func ==(lhs: DivText.ImageBuilder.Prototype, rhs: DivText.ImageBuilder.Prototype) -> Bool {
|
|
guard
|
|
lhs.image == rhs.image,
|
|
lhs.selector == rhs.selector
|
|
else {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
}
|
|
#endif
|
|
|
|
#if DEBUG
|
|
extension DivText.RangeBuilder.Prototype: Equatable {
|
|
public static func ==(lhs: DivText.RangeBuilder.Prototype, rhs: DivText.RangeBuilder.Prototype) -> Bool {
|
|
guard
|
|
lhs.range == rhs.range,
|
|
lhs.selector == rhs.selector
|
|
else {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
}
|
|
#endif
|
|
|
|
extension DivText.Ellipsis: Serializable {
|
|
@_optimize(size)
|
|
public func toDictionary() -> [String: ValidSerializationValue] {
|
|
var result: [String: ValidSerializationValue] = [:]
|
|
result["actions"] = actions?.map { $0.toDictionary() }
|
|
result["image_builder"] = imageBuilder?.toDictionary()
|
|
result["images"] = images?.map { $0.toDictionary() }
|
|
result["range_builder"] = rangeBuilder?.toDictionary()
|
|
result["ranges"] = ranges?.map { $0.toDictionary() }
|
|
result["text"] = text.toValidSerializationValue()
|
|
return result
|
|
}
|
|
}
|
|
|
|
extension DivText.Image.Accessibility: Serializable {
|
|
@_optimize(size)
|
|
public func toDictionary() -> [String: ValidSerializationValue] {
|
|
var result: [String: ValidSerializationValue] = [:]
|
|
result["description"] = description?.toValidSerializationValue()
|
|
result["type"] = type.rawValue
|
|
return result
|
|
}
|
|
}
|
|
|
|
extension DivText.Image: Serializable {
|
|
@_optimize(size)
|
|
public func toDictionary() -> [String: ValidSerializationValue] {
|
|
var result: [String: ValidSerializationValue] = [:]
|
|
result["accessibility"] = accessibility?.toDictionary()
|
|
result["alignment_vertical"] = alignmentVertical.toValidSerializationValue()
|
|
result["height"] = height.toDictionary()
|
|
result["indexing_direction"] = indexingDirection.toValidSerializationValue()
|
|
result["preload_required"] = preloadRequired.toValidSerializationValue()
|
|
result["start"] = start.toValidSerializationValue()
|
|
result["tint_color"] = tintColor?.toValidSerializationValue()
|
|
result["tint_mode"] = tintMode.toValidSerializationValue()
|
|
result["url"] = url.toValidSerializationValue()
|
|
result["width"] = width.toDictionary()
|
|
return result
|
|
}
|
|
}
|
|
|
|
extension DivText.ImageBuilder.Prototype: Serializable {
|
|
@_optimize(size)
|
|
public func toDictionary() -> [String: ValidSerializationValue] {
|
|
var result: [String: ValidSerializationValue] = [:]
|
|
result["image"] = image.toDictionary()
|
|
result["selector"] = selector.toValidSerializationValue()
|
|
return result
|
|
}
|
|
}
|
|
|
|
extension DivText.ImageBuilder: Serializable {
|
|
@_optimize(size)
|
|
public func toDictionary() -> [String: ValidSerializationValue] {
|
|
var result: [String: ValidSerializationValue] = [:]
|
|
result["data"] = data.toValidSerializationValue()
|
|
result["data_element_name"] = dataElementName
|
|
result["prototypes"] = prototypes.map { $0.toDictionary() }
|
|
return result
|
|
}
|
|
}
|
|
|
|
extension DivText.Range: Serializable {
|
|
@_optimize(size)
|
|
public func toDictionary() -> [String: ValidSerializationValue] {
|
|
var result: [String: ValidSerializationValue] = [:]
|
|
result["actions"] = actions?.map { $0.toDictionary() }
|
|
result["alignment_vertical"] = alignmentVertical?.toValidSerializationValue()
|
|
result["background"] = background?.toDictionary()
|
|
result["baseline_offset"] = baselineOffset.toValidSerializationValue()
|
|
result["border"] = border?.toDictionary()
|
|
result["end"] = end?.toValidSerializationValue()
|
|
result["font_family"] = fontFamily?.toValidSerializationValue()
|
|
result["font_feature_settings"] = fontFeatureSettings?.toValidSerializationValue()
|
|
result["font_size"] = fontSize?.toValidSerializationValue()
|
|
result["font_size_unit"] = fontSizeUnit.toValidSerializationValue()
|
|
result["font_variation_settings"] = fontVariationSettings?.toValidSerializationValue()
|
|
result["font_weight"] = fontWeight?.toValidSerializationValue()
|
|
result["font_weight_value"] = fontWeightValue?.toValidSerializationValue()
|
|
result["letter_spacing"] = letterSpacing?.toValidSerializationValue()
|
|
result["line_height"] = lineHeight?.toValidSerializationValue()
|
|
result["mask"] = mask?.toDictionary()
|
|
result["start"] = start.toValidSerializationValue()
|
|
result["strike"] = strike?.toValidSerializationValue()
|
|
result["text_color"] = textColor?.toValidSerializationValue()
|
|
result["text_shadow"] = textShadow?.toDictionary()
|
|
result["top_offset"] = topOffset?.toValidSerializationValue()
|
|
result["underline"] = underline?.toValidSerializationValue()
|
|
return result
|
|
}
|
|
}
|
|
|
|
extension DivText.RangeBuilder.Prototype: Serializable {
|
|
@_optimize(size)
|
|
public func toDictionary() -> [String: ValidSerializationValue] {
|
|
var result: [String: ValidSerializationValue] = [:]
|
|
result["range"] = range.toDictionary()
|
|
result["selector"] = selector.toValidSerializationValue()
|
|
return result
|
|
}
|
|
}
|
|
|
|
extension DivText.RangeBuilder: Serializable {
|
|
@_optimize(size)
|
|
public func toDictionary() -> [String: ValidSerializationValue] {
|
|
var result: [String: ValidSerializationValue] = [:]
|
|
result["data"] = data.toValidSerializationValue()
|
|
result["data_element_name"] = dataElementName
|
|
result["prototypes"] = prototypes.map { $0.toDictionary() }
|
|
return result
|
|
}
|
|
}
|