Skip to content

An open source design system that's fully customizable and agent ready

TypeScript
5.6 KB
Raw Blame
// Generated by @astryxdesign/native. Do not edit.
public enum TextType: String, CaseIterable, Codable, Sendable {
  case body = "body"
  case large = "large"
  case label = "label"
  case supporting = "supporting"
  case code = "code"
  case display1 = "display-1"
  case display2 = "display-2"
  case display3 = "display-3"
  case inherit = "inherit"
}
public enum TextSize: String, CaseIterable, Codable, Sendable {
  case v4xs = "4xs"
  case v3xs = "3xs"
  case v2xs = "2xs"
  case xsm = "xsm"
  case sm = "sm"
  case base = "base"
  case lg = "lg"
  case xl = "xl"
  case v2xl = "2xl"
  case v3xl = "3xl"
  case v4xl = "4xl"
}
public enum TextColor: String, CaseIterable, Codable, Sendable {
  case primary = "primary"
  case secondary = "secondary"
  case disabled = "disabled"
  case placeholder = "placeholder"
  case accent = "accent"
  case inherit = "inherit"
}
public enum TextWeight: String, CaseIterable, Codable, Sendable {
  case normal = "normal"
  case medium = "medium"
  case semibold = "semibold"
  case bold = "bold"
}
public enum TextJustify: String, CaseIterable, Codable, Sendable {
  case start = "start"
  case center = "center"
  case end = "end"
}
#if os(iOS)
public struct TextProps {
  /// Base props attach to this part on every platform.
  public static let baseTarget: AstryxBaseTarget = .root
  public var base: AstryxBaseProps
  public var type: TextType?
  public var children: String
  public var size: TextSize?
  public var color: TextColor?
  public var weight: TextWeight?
  public var maxLines: Double?
  public var justify: TextJustify?
  public var hasStrikethrough: Bool?
  public var hasTabularNumbers: Bool?
  public init(type: TextType? = nil, children: String, size: TextSize? = nil, color: TextColor? = nil, weight: TextWeight? = nil, maxLines: Double? = nil, justify: TextJustify? = nil, hasStrikethrough: Bool? = nil, hasTabularNumbers: Bool? = nil, base: AstryxBaseProps = AstryxBaseProps()) {
    self.type = type
    self.children = children
    self.size = size
    self.color = color
    self.weight = weight
    self.maxLines = maxLines
    self.justify = justify
    self.hasStrikethrough = hasStrikethrough
    self.hasTabularNumbers = hasTabularNumbers
    self.base = base
  }
}
public struct TextNode: Decodable, Equatable, Sendable {
  public struct Props: Decodable, Equatable, Sendable {
    public var type: TextType?
    public var children: String
    public var size: TextSize?
    public var color: TextColor?
    public var weight: TextWeight?
    public var maxLines: Double?
    public var justify: TextJustify?
    public var hasStrikethrough: Bool?
    public var hasTabularNumbers: Bool?
  }
  public let key: String
  public let base: AstryxBaseProps?
  public let props: Props
  /// The callbacks the core listens to, by prop name.
  public let events: [String]?

  public func listens(_ event: String) -> Bool { events?.contains(event) ?? false }

  /// The contract a Text view takes; its callbacks send actions to the core.
  public func viewProps(send: @escaping @Sendable (AstryxAction) -> Void) -> TextProps {
    return TextProps(
      type: props.type,
      children: props.children,
      size: props.size,
      color: props.color,
      weight: props.weight,
      maxLines: props.maxLines,
      justify: props.justify,
      hasStrikethrough: props.hasStrikethrough,
      hasTabularNumbers: props.hasTabularNumbers,
      base: base ?? AstryxBaseProps()
    )
  }
}
#endif
#if os(macOS)
public struct TextProps {
  /// Base props attach to this part on every platform.
  public static let baseTarget: AstryxBaseTarget = .root
  public var base: AstryxBaseProps
  public var type: TextType?
  public var children: String
  public var size: TextSize?
  public var color: TextColor?
  public var weight: TextWeight?
  public var maxLines: Double?
  public var justify: TextJustify?
  public var hasStrikethrough: Bool?
  public var hasTabularNumbers: Bool?
  public init(type: TextType? = nil, children: String, size: TextSize? = nil, color: TextColor? = nil, weight: TextWeight? = nil, maxLines: Double? = nil, justify: TextJustify? = nil, hasStrikethrough: Bool? = nil, hasTabularNumbers: Bool? = nil, base: AstryxBaseProps = AstryxBaseProps()) {
    self.type = type
    self.children = children
    self.size = size
    self.color = color
    self.weight = weight
    self.maxLines = maxLines
    self.justify = justify
    self.hasStrikethrough = hasStrikethrough
    self.hasTabularNumbers = hasTabularNumbers
    self.base = base
  }
}
public struct TextNode: Decodable, Equatable, Sendable {
  public struct Props: Decodable, Equatable, Sendable {
    public var type: TextType?
    public var children: String
    public var size: TextSize?
    public var color: TextColor?
    public var weight: TextWeight?
    public var maxLines: Double?
    public var justify: TextJustify?
    public var hasStrikethrough: Bool?
    public var hasTabularNumbers: Bool?
  }
  public let key: String
  public let base: AstryxBaseProps?
  public let props: Props
  /// The callbacks the core listens to, by prop name.
  public let events: [String]?

  public func listens(_ event: String) -> Bool { events?.contains(event) ?? false }

  /// The contract a Text view takes; its callbacks send actions to the core.
  public func viewProps(send: @escaping @Sendable (AstryxAction) -> Void) -> TextProps {
    return TextProps(
      type: props.type,
      children: props.children,
      size: props.size,
      color: props.color,
      weight: props.weight,
      maxLines: props.maxLines,
      justify: props.justify,
      hasStrikethrough: props.hasStrikethrough,
      hasTabularNumbers: props.hasTabularNumbers,
      base: base ?? AstryxBaseProps()
    )
  }
}
#endif