@astryxdesign/native 0.7.5-canary.bc40b80 → 0.7.5-canary.c60f571

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/README.md +80 -3
  2. package/apple/Sources/AstryxNative/Generated/AstryxBase.swift +1 -1
  3. package/apple/Sources/AstryxNative/Generated/AstryxNode.swift +66 -0
  4. package/apple/Sources/AstryxNative/Generated/AstryxWire.swift +67 -0
  5. package/apple/Sources/AstryxNative/Generated/Button.swift +79 -3
  6. package/apple/Sources/AstryxNative/Generated/Card.swift +117 -0
  7. package/apple/Sources/AstryxNative/Generated/Divider.swift +54 -2
  8. package/apple/Sources/AstryxNative/Generated/HStack.swift +308 -0
  9. package/apple/Sources/AstryxNative/Generated/Heading.swift +78 -6
  10. package/apple/Sources/AstryxNative/Generated/ProgressBar.swift +74 -2
  11. package/apple/Sources/AstryxNative/Generated/Selector.swift +133 -9
  12. package/apple/Sources/AstryxNative/Generated/Switch.swift +101 -5
  13. package/apple/Sources/AstryxNative/Generated/Text.swift +77 -5
  14. package/apple/Sources/AstryxNative/Generated/TextInput.swift +119 -5
  15. package/apple/Sources/AstryxNative/Generated/VStack.swift +308 -0
  16. package/apple/Tests/AstryxNativeTests/WireTests.swift +53 -0
  17. package/dist/components/Card.d.ts +10 -0
  18. package/dist/components/Card.d.ts.map +1 -0
  19. package/dist/components/Card.js +7 -0
  20. package/dist/components/HStack.d.ts +10 -0
  21. package/dist/components/HStack.d.ts.map +1 -0
  22. package/dist/components/HStack.js +9 -0
  23. package/dist/components/VStack.d.ts +10 -0
  24. package/dist/components/VStack.d.ts.map +1 -0
  25. package/dist/components/VStack.js +9 -0
  26. package/dist/components/index.d.ts.map +1 -1
  27. package/dist/components/index.js +6 -0
  28. package/dist/components/stackShared.d.ts +9 -0
  29. package/dist/components/stackShared.d.ts.map +1 -0
  30. package/dist/components/stackShared.js +4 -0
  31. package/dist/contract/fromComponentDoc.d.ts +3 -2
  32. package/dist/contract/fromComponentDoc.d.ts.map +1 -1
  33. package/dist/contract/fromComponentDoc.js +1 -0
  34. package/dist/contract/generateSwift.d.ts.map +1 -1
  35. package/dist/contract/generateSwift.js +183 -11
  36. package/dist/contract/generateTypeScript.d.ts.map +1 -1
  37. package/dist/contract/generateTypeScript.js +67 -9
  38. package/dist/contract/types.d.ts +4 -0
  39. package/dist/contract/types.d.ts.map +1 -1
  40. package/dist/logic/connectBridge.d.ts +29 -0
  41. package/dist/logic/connectBridge.d.ts.map +1 -0
  42. package/dist/logic/connectBridge.js +32 -0
  43. package/dist/logic/createLogicCore.d.ts +44 -0
  44. package/dist/logic/createLogicCore.d.ts.map +1 -0
  45. package/dist/logic/createLogicCore.js +40 -0
  46. package/dist/logic/index.d.ts +12 -0
  47. package/dist/logic/index.d.ts.map +1 -0
  48. package/dist/logic/index.js +10 -0
  49. package/dist/types/android.d.ts +105 -2
  50. package/dist/types/core.d.ts +48 -0
  51. package/dist/types/ios.d.ts +105 -2
  52. package/dist/types/macos.d.ts +105 -2
  53. package/dist/types/shared.d.ts +105 -2
  54. package/dist/types/windows.d.ts +105 -2
  55. package/package.json +8 -3
  56. package/src/components/Card.ts +18 -0
  57. package/src/components/HStack.ts +20 -0
  58. package/src/components/VStack.ts +20 -0
  59. package/src/components/index.ts +6 -0
  60. package/src/components/stackShared.ts +14 -0
  61. package/src/contract/contracts.test.ts +24 -0
  62. package/src/contract/fromComponentDoc.test.ts +1 -1
  63. package/src/contract/fromComponentDoc.ts +4 -2
  64. package/src/contract/generateSwift.ts +208 -11
  65. package/src/contract/generateTypeScript.ts +81 -10
  66. package/src/contract/types.ts +2 -0
  67. package/src/logic/connectBridge.ts +72 -0
  68. package/src/logic/createLogicCore.ts +97 -0
  69. package/src/logic/index.ts +19 -0
  70. package/src/logic/logic.test.ts +160 -0
package/README.md CHANGED
@@ -19,9 +19,11 @@ rests on evidence.
19
19
  | Swift binding | `apple/` | A Swift package with props generated from the same contracts. iOS and macOS props sit behind `#if os(...)`. |
20
20
  | Native theme | `defineNativeTheme` | Durable theme intent (`material: 'opaque' \| 'translucent'`) plus platform entries scoped by OS version, such as Liquid Glass from iOS 26. Never sets tokens. |
21
21
  | Icons | `NATIVE_ICON_DEFAULTS` | Astryx's built-in icon names mapped to SF Symbols on Apple platforms and Material Symbols on Android. |
22
+ | Wire | `AstryxNode`, `AstryxAction` | Each component as JSON a TypeScript core sends a native host (arm C), and the action a host sends back when a view calls a callback. Swift decodes `<Name>Node` and turns it into `<Name>Props` with `viewProps(send:)`. |
23
+ | Logic core | `@astryxdesign/native/logic` | `createLogicCore` holds a screen's state, builds its node tree, and reduces actions; `connectBridge` carries it to a native host as JSON. ECMAScript built-ins only, so it runs in Hermes. Shaped after EJ Campbell's astryx-swift spike. |
22
24
 
23
- Contracts cover Button, Divider, Heading, ProgressBar, Selector, Switch, Text,
24
- and TextInput. React Native and Android bindings are not built yet; see
25
+ Contracts cover Button, Card, Divider, Heading, HStack, ProgressBar, Selector,
26
+ Switch, Text, TextInput, and VStack. React Native and Android bindings are not built yet; see
25
27
  [the experiment matrix](#experiment-matrix).
26
28
 
27
29
  ```ts
@@ -45,12 +47,80 @@ How core documentation becomes a contract:
45
47
  arguments. A callback with an event before a value stays on the web either
46
48
  way.
47
49
  - Free-form content becomes a typed slot only where a component declares one
48
- in `slots`; `text` is a string, as for a badge's label or a heading's words.
50
+ in `slots`; `text` is a string, as for a badge's label or a heading's words,
51
+ and `content` is child Astryx components, as for a stack's or a card's
52
+ children. A SwiftUI view takes content as a view builder, so `<Name>Props`
53
+ leaves it out; `<Name>Node` carries it as child nodes.
49
54
  - A closed set of numbers, such as a heading level, is a Swift enum with raw
50
55
  values.
51
56
  - A core prop may share a platform toolkit's name only when the component
52
57
  declares in `sameMeaning` that it means the same thing there.
53
58
 
59
+ ### The wire (arm C)
60
+
61
+ A TypeScript core sends a tree of nodes and receives actions. A node lists the
62
+ callbacks the core listens to in `events`; a view gets only those callbacks.
63
+
64
+ ```ts
65
+ // tsconfig: "customConditions": ["ios"]
66
+ import type {AstryxAction, AstryxNode} from '@astryxdesign/native/components';
67
+
68
+ const screen: AstryxNode = {
69
+ component: 'VStack',
70
+ key: 'root',
71
+ props: {
72
+ gap: 2,
73
+ children: [
74
+ {
75
+ component: 'Switch',
76
+ key: 'wifi',
77
+ props: {label: 'Wi-Fi', value: true},
78
+ events: ['onChange'],
79
+ },
80
+ ],
81
+ },
82
+ };
83
+ // What the host sends back when the switch is turned off:
84
+ const action: AstryxAction = {
85
+ key: 'wifi',
86
+ component: 'Switch',
87
+ event: 'onChange',
88
+ args: [false],
89
+ };
90
+ ```
91
+
92
+ ```swift
93
+ let node = try JSONDecoder().decode(AstryxNode.self, from: snapshot)
94
+ if case .switch(let wifi) = node {
95
+ let props = wifi.viewProps { action in core.dispatch(action.json) }
96
+ }
97
+ ```
98
+
99
+ ```ts
100
+ import {connectBridge, createLogicCore} from '@astryxdesign/native/logic';
101
+
102
+ const core = createLogicCore<{wifi: boolean}, AstryxNode, AstryxAction>({
103
+ initial: {wifi: true},
104
+ view: state => ({
105
+ component: 'Switch',
106
+ key: 'wifi',
107
+ props: {label: 'Wi-Fi', value: state.wifi},
108
+ events: ['onChange'],
109
+ }),
110
+ reduce: (state, action) =>
111
+ action.component === 'Switch' && action.event === 'onChange'
112
+ ? {wifi: action.args[0]}
113
+ : state,
114
+ });
115
+ // In the app's JavaScript engine: the host reads snapshots and dispatches actions.
116
+ const bridge = connectBridge(core, {
117
+ connected() {},
118
+ changed(json) {
119
+ /* to Swift */
120
+ },
121
+ });
122
+ ```
123
+
54
124
  ## Working on it
55
125
 
56
126
  ```sh
@@ -62,6 +132,13 @@ pnpm vitest run --project node packages/native
62
132
  Generated Swift is committed so a Swift package can pin a commit. A test fails
63
133
  when it drifts from the contracts.
64
134
 
135
+ **Cleanup needed.** Committing the generated Swift
136
+ (`apple/Sources/AstryxNative/Generated`) is temporary. It is there only because
137
+ Swift Package Manager installs a package from a git commit and cannot run the
138
+ Node generator. The intended replacement: CI generates the Swift files and
139
+ publishes them to a Swift-only branch or tag that apps pin, and the generated
140
+ files are ignored on `main`.
141
+
65
142
  Boundaries, checked by `pnpm check:package-boundaries`:
66
143
 
67
144
  - `@astryxdesign/core` never imports this package.
@@ -2,7 +2,7 @@
2
2
  public enum AstryxBaseTarget: String, Sendable { case root, trigger, control, container }
3
3
 
4
4
  /// Base props shared by every platform (AST-082 FR7).
5
- public struct AstryxBaseProps: Equatable, Sendable {
5
+ public struct AstryxBaseProps: Equatable, Codable, Sendable {
6
6
  public var id: String?
7
7
  public var isHidden: Bool?
8
8
  public init(id: String? = nil, isHidden: Bool? = nil) {
@@ -0,0 +1,66 @@
1
+ // Generated by @astryxdesign/native. Do not edit.
2
+ import Foundation
3
+
4
+ #if os(iOS) || os(macOS)
5
+ /// One Astryx component in a tree a TypeScript core sends, by its `component` name.
6
+ /// A node this binding cannot read decodes as `unsupported`: an unknown component,
7
+ /// or a known one with a value its enums lack or a required prop missing. An older
8
+ /// app then keeps drawing the rest of a newer core's tree.
9
+ public enum AstryxNode: Decodable, Equatable, Sendable {
10
+ case button(ButtonNode)
11
+ case card(CardNode)
12
+ case divider(DividerNode)
13
+ case heading(HeadingNode)
14
+ case hStack(HStackNode)
15
+ case progressBar(ProgressBarNode)
16
+ case selector(SelectorNode)
17
+ case `switch`(SwitchNode)
18
+ case text(TextNode)
19
+ case textInput(TextInputNode)
20
+ case vStack(VStackNode)
21
+ case unsupported(component: String, key: String)
22
+
23
+ public var key: String {
24
+ switch self {
25
+ case .button(let node): return node.key
26
+ case .card(let node): return node.key
27
+ case .divider(let node): return node.key
28
+ case .heading(let node): return node.key
29
+ case .hStack(let node): return node.key
30
+ case .progressBar(let node): return node.key
31
+ case .selector(let node): return node.key
32
+ case .`switch`(let node): return node.key
33
+ case .text(let node): return node.key
34
+ case .textInput(let node): return node.key
35
+ case .vStack(let node): return node.key
36
+ case .unsupported(_, let key): return key
37
+ }
38
+ }
39
+
40
+ private enum Keys: String, CodingKey { case component, key }
41
+
42
+ public init(from decoder: any Decoder) throws {
43
+ let container = try decoder.container(keyedBy: Keys.self)
44
+ let component = try container.decode(String.self, forKey: .component)
45
+ let key = try container.decode(String.self, forKey: .key)
46
+ do {
47
+ switch component {
48
+ case "Button": self = .button(try ButtonNode(from: decoder))
49
+ case "Card": self = .card(try CardNode(from: decoder))
50
+ case "Divider": self = .divider(try DividerNode(from: decoder))
51
+ case "Heading": self = .heading(try HeadingNode(from: decoder))
52
+ case "HStack": self = .hStack(try HStackNode(from: decoder))
53
+ case "ProgressBar": self = .progressBar(try ProgressBarNode(from: decoder))
54
+ case "Selector": self = .selector(try SelectorNode(from: decoder))
55
+ case "Switch": self = .`switch`(try SwitchNode(from: decoder))
56
+ case "Text": self = .text(try TextNode(from: decoder))
57
+ case "TextInput": self = .textInput(try TextInputNode(from: decoder))
58
+ case "VStack": self = .vStack(try VStackNode(from: decoder))
59
+ default: self = .unsupported(component: component, key: key)
60
+ }
61
+ } catch {
62
+ self = .unsupported(component: component, key: key)
63
+ }
64
+ }
65
+ }
66
+ #endif
@@ -0,0 +1,67 @@
1
+ // Generated by @astryxdesign/native. Do not edit.
2
+ import Foundation
3
+
4
+ /// A JSON value: a portable callback argument on its way to the core.
5
+ public enum AstryxValue: Codable, Equatable, Sendable {
6
+ case null
7
+ case bool(Bool)
8
+ case number(Double)
9
+ case string(String)
10
+ case array([AstryxValue])
11
+ case object([String: AstryxValue])
12
+
13
+ /// Any portable value (a contract's strings, numbers, enums, and records) as JSON.
14
+ public init<T: Encodable>(_ value: T) {
15
+ guard let data = try? JSONEncoder().encode(value),
16
+ let decoded = try? JSONDecoder().decode(AstryxValue.self, from: data) else {
17
+ self = .null
18
+ return
19
+ }
20
+ self = decoded
21
+ }
22
+
23
+ public init(from decoder: any Decoder) throws {
24
+ let container = try decoder.singleValueContainer()
25
+ if container.decodeNil() { self = .null }
26
+ else if let value = try? container.decode(Bool.self) { self = .bool(value) }
27
+ else if let value = try? container.decode(Double.self) { self = .number(value) }
28
+ else if let value = try? container.decode(String.self) { self = .string(value) }
29
+ else if let value = try? container.decode([AstryxValue].self) { self = .array(value) }
30
+ else { self = .object(try container.decode([String: AstryxValue].self)) }
31
+ }
32
+
33
+ public func encode(to encoder: any Encoder) throws {
34
+ var container = encoder.singleValueContainer()
35
+ switch self {
36
+ case .null: try container.encodeNil()
37
+ case .bool(let value): try container.encode(value)
38
+ case .number(let value): try container.encode(value)
39
+ case .string(let value): try container.encode(value)
40
+ case .array(let value): try container.encode(value)
41
+ case .object(let value): try container.encode(value)
42
+ }
43
+ }
44
+ }
45
+
46
+ /// A callback a view called: which node, which prop, and its arguments.
47
+ public struct AstryxAction: Codable, Equatable, Sendable {
48
+ public let key: String
49
+ public let component: String
50
+ public let event: String
51
+ public let args: [AstryxValue]
52
+
53
+ public init(key: String, component: String, event: String, args: [AstryxValue]) {
54
+ self.key = key
55
+ self.component = component
56
+ self.event = event
57
+ self.args = args
58
+ }
59
+
60
+ /// The JSON the core receives.
61
+ public var json: String {
62
+ let encoder = JSONEncoder()
63
+ encoder.outputFormatting = [.sortedKeys, .withoutEscapingSlashes]
64
+ guard let data = try? encoder.encode(self) else { return "{}" }
65
+ return String(decoding: data, as: UTF8.self)
66
+ }
67
+ }
@@ -1,16 +1,16 @@
1
1
  // Generated by @astryxdesign/native. Do not edit.
2
- public enum ButtonVariant: String, CaseIterable, Sendable {
2
+ public enum ButtonVariant: String, CaseIterable, Codable, Sendable {
3
3
  case primary = "primary"
4
4
  case secondary = "secondary"
5
5
  case ghost = "ghost"
6
6
  case destructive = "destructive"
7
7
  }
8
- public enum ButtonSize: String, CaseIterable, Sendable {
8
+ public enum ButtonSize: String, CaseIterable, Codable, Sendable {
9
9
  case sm = "sm"
10
10
  case md = "md"
11
11
  case lg = "lg"
12
12
  }
13
- public enum ButtonElevation: String, CaseIterable, Sendable {
13
+ public enum ButtonElevation: String, CaseIterable, Codable, Sendable {
14
14
  case none = "none"
15
15
  case low = "low"
16
16
  case med = "med"
@@ -45,6 +45,44 @@ public struct ButtonProps {
45
45
  self.base = base
46
46
  }
47
47
  }
48
+ public struct ButtonNode: Decodable, Equatable, Sendable {
49
+ public struct Props: Decodable, Equatable, Sendable {
50
+ public var label: String
51
+ public var variant: ButtonVariant?
52
+ public var size: ButtonSize?
53
+ public var elevation: ButtonElevation?
54
+ public var isLoading: Bool?
55
+ public var isInterruptible: Bool?
56
+ public var isDisabled: Bool?
57
+ public var tooltip: String?
58
+ public var href: String?
59
+ }
60
+ public let key: String
61
+ public let base: AstryxBaseProps?
62
+ public let props: Props
63
+ /// The callbacks the core listens to, by prop name.
64
+ public let events: [String]?
65
+
66
+ public func listens(_ event: String) -> Bool { events?.contains(event) ?? false }
67
+
68
+ /// The contract a Button view takes; its callbacks send actions to the core.
69
+ public func viewProps(send: @escaping @Sendable (AstryxAction) -> Void) -> ButtonProps {
70
+ let key = self.key
71
+ return ButtonProps(
72
+ label: props.label,
73
+ variant: props.variant,
74
+ size: props.size,
75
+ elevation: props.elevation,
76
+ isLoading: props.isLoading,
77
+ isInterruptible: props.isInterruptible,
78
+ isDisabled: props.isDisabled,
79
+ tooltip: props.tooltip,
80
+ onClick: listens("onClick") ? { send(AstryxAction(key: key, component: "Button", event: "onClick", args: [])) } : nil,
81
+ href: props.href,
82
+ base: base ?? AstryxBaseProps()
83
+ )
84
+ }
85
+ }
48
86
  #endif
49
87
  #if os(macOS)
50
88
  public struct ButtonProps {
@@ -75,4 +113,42 @@ public struct ButtonProps {
75
113
  self.base = base
76
114
  }
77
115
  }
116
+ public struct ButtonNode: Decodable, Equatable, Sendable {
117
+ public struct Props: Decodable, Equatable, Sendable {
118
+ public var label: String
119
+ public var variant: ButtonVariant?
120
+ public var size: ButtonSize?
121
+ public var elevation: ButtonElevation?
122
+ public var isLoading: Bool?
123
+ public var isInterruptible: Bool?
124
+ public var isDisabled: Bool?
125
+ public var tooltip: String?
126
+ public var href: String?
127
+ }
128
+ public let key: String
129
+ public let base: AstryxBaseProps?
130
+ public let props: Props
131
+ /// The callbacks the core listens to, by prop name.
132
+ public let events: [String]?
133
+
134
+ public func listens(_ event: String) -> Bool { events?.contains(event) ?? false }
135
+
136
+ /// The contract a Button view takes; its callbacks send actions to the core.
137
+ public func viewProps(send: @escaping @Sendable (AstryxAction) -> Void) -> ButtonProps {
138
+ let key = self.key
139
+ return ButtonProps(
140
+ label: props.label,
141
+ variant: props.variant,
142
+ size: props.size,
143
+ elevation: props.elevation,
144
+ isLoading: props.isLoading,
145
+ isInterruptible: props.isInterruptible,
146
+ isDisabled: props.isDisabled,
147
+ tooltip: props.tooltip,
148
+ onClick: listens("onClick") ? { send(AstryxAction(key: key, component: "Button", event: "onClick", args: [])) } : nil,
149
+ href: props.href,
150
+ base: base ?? AstryxBaseProps()
151
+ )
152
+ }
153
+ }
78
154
  #endif
@@ -0,0 +1,117 @@
1
+ // Generated by @astryxdesign/native. Do not edit.
2
+ public enum CardPadding: Double, CaseIterable, Codable, Sendable {
3
+ case v0 = 0
4
+ case v0_5 = 0.5
5
+ case v1 = 1
6
+ case v1_5 = 1.5
7
+ case v2 = 2
8
+ case v3 = 3
9
+ case v4 = 4
10
+ case v5 = 5
11
+ case v6 = 6
12
+ case v8 = 8
13
+ case v10 = 10
14
+ }
15
+ public enum CardVariant: String, CaseIterable, Codable, Sendable {
16
+ case `default` = "default"
17
+ case transparent = "transparent"
18
+ case muted = "muted"
19
+ case blue = "blue"
20
+ case cyan = "cyan"
21
+ case gray = "gray"
22
+ case green = "green"
23
+ case orange = "orange"
24
+ case pink = "pink"
25
+ case purple = "purple"
26
+ case red = "red"
27
+ case teal = "teal"
28
+ case yellow = "yellow"
29
+ }
30
+ public enum CardElevation: String, CaseIterable, Codable, Sendable {
31
+ case none = "none"
32
+ case low = "low"
33
+ case med = "med"
34
+ case high = "high"
35
+ }
36
+ #if os(iOS)
37
+ public struct CardProps {
38
+ /// Base props attach to this part on every platform.
39
+ public static let baseTarget: AstryxBaseTarget = .container
40
+ public var base: AstryxBaseProps
41
+ public var padding: CardPadding?
42
+ public var variant: CardVariant?
43
+ public var elevation: CardElevation?
44
+ public init(padding: CardPadding? = nil, variant: CardVariant? = nil, elevation: CardElevation? = nil, base: AstryxBaseProps = AstryxBaseProps()) {
45
+ self.padding = padding
46
+ self.variant = variant
47
+ self.elevation = elevation
48
+ self.base = base
49
+ }
50
+ }
51
+ public struct CardNode: Decodable, Equatable, Sendable {
52
+ public struct Props: Decodable, Equatable, Sendable {
53
+ public var children: [AstryxNode]?
54
+ public var padding: CardPadding?
55
+ public var variant: CardVariant?
56
+ public var elevation: CardElevation?
57
+ }
58
+ public let key: String
59
+ public let base: AstryxBaseProps?
60
+ public let props: Props
61
+ /// The callbacks the core listens to, by prop name.
62
+ public let events: [String]?
63
+
64
+ public func listens(_ event: String) -> Bool { events?.contains(event) ?? false }
65
+
66
+ /// The contract a Card view takes; its callbacks send actions to the core.
67
+ public func viewProps(send: @escaping @Sendable (AstryxAction) -> Void) -> CardProps {
68
+ return CardProps(
69
+ padding: props.padding,
70
+ variant: props.variant,
71
+ elevation: props.elevation,
72
+ base: base ?? AstryxBaseProps()
73
+ )
74
+ }
75
+ }
76
+ #endif
77
+ #if os(macOS)
78
+ public struct CardProps {
79
+ /// Base props attach to this part on every platform.
80
+ public static let baseTarget: AstryxBaseTarget = .container
81
+ public var base: AstryxBaseProps
82
+ public var padding: CardPadding?
83
+ public var variant: CardVariant?
84
+ public var elevation: CardElevation?
85
+ public init(padding: CardPadding? = nil, variant: CardVariant? = nil, elevation: CardElevation? = nil, base: AstryxBaseProps = AstryxBaseProps()) {
86
+ self.padding = padding
87
+ self.variant = variant
88
+ self.elevation = elevation
89
+ self.base = base
90
+ }
91
+ }
92
+ public struct CardNode: Decodable, Equatable, Sendable {
93
+ public struct Props: Decodable, Equatable, Sendable {
94
+ public var children: [AstryxNode]?
95
+ public var padding: CardPadding?
96
+ public var variant: CardVariant?
97
+ public var elevation: CardElevation?
98
+ }
99
+ public let key: String
100
+ public let base: AstryxBaseProps?
101
+ public let props: Props
102
+ /// The callbacks the core listens to, by prop name.
103
+ public let events: [String]?
104
+
105
+ public func listens(_ event: String) -> Bool { events?.contains(event) ?? false }
106
+
107
+ /// The contract a Card view takes; its callbacks send actions to the core.
108
+ public func viewProps(send: @escaping @Sendable (AstryxAction) -> Void) -> CardProps {
109
+ return CardProps(
110
+ padding: props.padding,
111
+ variant: props.variant,
112
+ elevation: props.elevation,
113
+ base: base ?? AstryxBaseProps()
114
+ )
115
+ }
116
+ }
117
+ #endif
@@ -1,9 +1,9 @@
1
1
  // Generated by @astryxdesign/native. Do not edit.
2
- public enum DividerOrientation: String, CaseIterable, Sendable {
2
+ public enum DividerOrientation: String, CaseIterable, Codable, Sendable {
3
3
  case horizontal = "horizontal"
4
4
  case vertical = "vertical"
5
5
  }
6
- public enum DividerVariant: String, CaseIterable, Sendable {
6
+ public enum DividerVariant: String, CaseIterable, Codable, Sendable {
7
7
  case subtle = "subtle"
8
8
  case strong = "strong"
9
9
  }
@@ -24,6 +24,32 @@ public struct DividerProps {
24
24
  self.base = base
25
25
  }
26
26
  }
27
+ public struct DividerNode: Decodable, Equatable, Sendable {
28
+ public struct Props: Decodable, Equatable, Sendable {
29
+ public var orientation: DividerOrientation?
30
+ public var label: String?
31
+ public var variant: DividerVariant?
32
+ public var isFullBleed: Bool?
33
+ }
34
+ public let key: String
35
+ public let base: AstryxBaseProps?
36
+ public let props: Props
37
+ /// The callbacks the core listens to, by prop name.
38
+ public let events: [String]?
39
+
40
+ public func listens(_ event: String) -> Bool { events?.contains(event) ?? false }
41
+
42
+ /// The contract a Divider view takes; its callbacks send actions to the core.
43
+ public func viewProps(send: @escaping @Sendable (AstryxAction) -> Void) -> DividerProps {
44
+ return DividerProps(
45
+ orientation: props.orientation,
46
+ label: props.label,
47
+ variant: props.variant,
48
+ isFullBleed: props.isFullBleed,
49
+ base: base ?? AstryxBaseProps()
50
+ )
51
+ }
52
+ }
27
53
  #endif
28
54
  #if os(macOS)
29
55
  public struct DividerProps {
@@ -42,4 +68,30 @@ public struct DividerProps {
42
68
  self.base = base
43
69
  }
44
70
  }
71
+ public struct DividerNode: Decodable, Equatable, Sendable {
72
+ public struct Props: Decodable, Equatable, Sendable {
73
+ public var orientation: DividerOrientation?
74
+ public var label: String?
75
+ public var variant: DividerVariant?
76
+ public var isFullBleed: Bool?
77
+ }
78
+ public let key: String
79
+ public let base: AstryxBaseProps?
80
+ public let props: Props
81
+ /// The callbacks the core listens to, by prop name.
82
+ public let events: [String]?
83
+
84
+ public func listens(_ event: String) -> Bool { events?.contains(event) ?? false }
85
+
86
+ /// The contract a Divider view takes; its callbacks send actions to the core.
87
+ public func viewProps(send: @escaping @Sendable (AstryxAction) -> Void) -> DividerProps {
88
+ return DividerProps(
89
+ orientation: props.orientation,
90
+ label: props.label,
91
+ variant: props.variant,
92
+ isFullBleed: props.isFullBleed,
93
+ base: base ?? AstryxBaseProps()
94
+ )
95
+ }
96
+ }
45
97
  #endif