An open source design system that's fully customizable and agent ready
TypeScript
// Generated by @astryxdesign/native. Do not edit.
public enum CardPadding: Double, CaseIterable, Codable, Sendable {
case v0 = 0
case v0_5 = 0.5
case v1 = 1
case v1_5 = 1.5
case v2 = 2
case v3 = 3
case v4 = 4
case v5 = 5
case v6 = 6
case v8 = 8
case v10 = 10
}
public enum CardVariant: String, CaseIterable, Codable, Sendable {
case `default` = "default"
case transparent = "transparent"
case muted = "muted"
case blue = "blue"
case cyan = "cyan"
case gray = "gray"
case green = "green"
case orange = "orange"
case pink = "pink"
case purple = "purple"
case red = "red"
case teal = "teal"
case yellow = "yellow"
}
public enum CardElevation: String, CaseIterable, Codable, Sendable {
case none = "none"
case low = "low"
case med = "med"
case high = "high"
}
#if os(iOS)
public struct CardProps {
/// Base props attach to this part on every platform.
public static let baseTarget: AstryxBaseTarget = .container
public var base: AstryxBaseProps
public var padding: CardPadding?
public var variant: CardVariant?
public var elevation: CardElevation?
public init(padding: CardPadding? = nil, variant: CardVariant? = nil, elevation: CardElevation? = nil, base: AstryxBaseProps = AstryxBaseProps()) {
self.padding = padding
self.variant = variant
self.elevation = elevation
self.base = base
}
}
public struct CardNode: Decodable, Equatable, Sendable {
public struct Props: Decodable, Equatable, Sendable {
public var children: [AstryxNode]?
public var padding: CardPadding?
public var variant: CardVariant?
public var elevation: CardElevation?
}
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 Card view takes; its callbacks send actions to the core.
public func viewProps(send: @escaping @Sendable (AstryxAction) -> Void) -> CardProps {
return CardProps(
padding: props.padding,
variant: props.variant,
elevation: props.elevation,
base: base ?? AstryxBaseProps()
)
}
}
#endif
#if os(macOS)
public struct CardProps {
/// Base props attach to this part on every platform.
public static let baseTarget: AstryxBaseTarget = .container
public var base: AstryxBaseProps
public var padding: CardPadding?
public var variant: CardVariant?
public var elevation: CardElevation?
public init(padding: CardPadding? = nil, variant: CardVariant? = nil, elevation: CardElevation? = nil, base: AstryxBaseProps = AstryxBaseProps()) {
self.padding = padding
self.variant = variant
self.elevation = elevation
self.base = base
}
}
public struct CardNode: Decodable, Equatable, Sendable {
public struct Props: Decodable, Equatable, Sendable {
public var children: [AstryxNode]?
public var padding: CardPadding?
public var variant: CardVariant?
public var elevation: CardElevation?
}
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 Card view takes; its callbacks send actions to the core.
public func viewProps(send: @escaping @Sendable (AstryxAction) -> Void) -> CardProps {
return CardProps(
padding: props.padding,
variant: props.variant,
elevation: props.elevation,
base: base ?? AstryxBaseProps()
)
}
}
#endif