@astryxdesign/native 0.7.6-canary.e30ffbf → 0.7.6-canary.e3bd3d5
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.
- package/apple/README.md +1 -0
- package/apple/Sources/Astryx/Avatar/Avatar.swift +7 -3
- package/apple/Sources/Astryx/Item/Item.swift +99 -7
- package/apple/Sources/Astryx/List/ListItem.swift +255 -0
- package/apple/Sources/Astryx/Wire/AstryxNodeView.swift +7 -0
- package/apple/Sources/AstryxNative/Generated/AstryxNode.swift +3 -0
- package/apple/Sources/AstryxNative/Generated/ListItem.swift +122 -0
- package/apple/Tests/AstryxTests/AvatarTests.swift +14 -0
- package/apple/Tests/AstryxTests/ListItemTests.swift +234 -0
- package/dist/components/ListItem.d.ts +10 -0
- package/dist/components/ListItem.d.ts.map +1 -0
- package/dist/components/ListItem.js +20 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +2 -0
- package/dist/types/android.d.ts +16 -3
- package/dist/types/core.d.ts +12 -0
- package/dist/types/ios.d.ts +16 -3
- package/dist/types/macos.d.ts +16 -3
- package/dist/types/shared.d.ts +16 -3
- package/dist/types/windows.d.ts +16 -3
- package/package.json +3 -3
- package/src/components/ListItem.ts +32 -0
- package/src/components/index.ts +2 -0
- package/src/contract/contracts.test.ts +21 -0
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
import AstryxNative
|
|
4
|
+
import SwiftUI
|
|
5
|
+
import Testing
|
|
6
|
+
@testable import Astryx
|
|
7
|
+
|
|
8
|
+
// Swift ListItem spec (component:swift/ListItem): an Item that takes its
|
|
9
|
+
// density, marker, dividers, and edge from its list.
|
|
10
|
+
|
|
11
|
+
private let red = [255, 0, 0, 255]
|
|
12
|
+
@MainActor private func swatch() -> some View { Color(red: 1, green: 0, blue: 0).frame(width: 10, height: 10) }
|
|
13
|
+
|
|
14
|
+
@MainActor
|
|
15
|
+
private func inList<V: View>(_ view: V, _ context: ListContext) -> some View {
|
|
16
|
+
view.environment(\.astryxListContext, context).frame(width: 240)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
@MainActor
|
|
20
|
+
@Test func listItemInitializersBuildTheSameProps() {
|
|
21
|
+
let labeled = ListItem("Ada", description: "Mathematician", align: .start, href: "https://example.com", isDisabled: true, isSelected: true).props
|
|
22
|
+
let fromProps = ListItem(ListItemProps(label: "Ada", description: "Mathematician", href: "https://example.com", align: .start, isDisabled: true, isSelected: true)).props
|
|
23
|
+
#expect(labeled.label == fromProps.label)
|
|
24
|
+
#expect(labeled.description == fromProps.description)
|
|
25
|
+
#expect(labeled.align == fromProps.align)
|
|
26
|
+
#expect(labeled.href == fromProps.href)
|
|
27
|
+
#expect(labeled.isDisabled == fromProps.isDisabled)
|
|
28
|
+
#expect(labeled.isSelected == fromProps.isSelected)
|
|
29
|
+
#expect(labeled.base == fromProps.base)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
@MainActor
|
|
33
|
+
@Test func aListItemAloneDrawsAsAnItem() {
|
|
34
|
+
let row = Pixels(ListItem("Ada", description: "Mathematician").frame(width: 240))
|
|
35
|
+
let item = Pixels(Item("Ada", description: "Mathematician").frame(width: 240))
|
|
36
|
+
#expect(row.width == item.width && row.height == item.height)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
@MainActor
|
|
40
|
+
@Test func aListItemTakesItsListsDensity() {
|
|
41
|
+
let compact = Pixels(inList(ListItem("Ada"), ListContext(density: .compact, hasDividers: false, isFlush: false)))
|
|
42
|
+
let spacious = Pixels(inList(ListItem("Ada"), ListContext(density: .spacious, hasDividers: false, isFlush: false)))
|
|
43
|
+
let tokens = Theme.default.light.space
|
|
44
|
+
#expect(spacious.height - compact.height == Int(2 * (tokens.s3 - tokens.s1)))
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
@MainActor
|
|
48
|
+
@Test func aFlushListDropsTheRowsInlineInset() {
|
|
49
|
+
let padded = Pixels(inList(ListItem("Ada", startContent: { swatch() }), ListContext(hasDividers: false, isFlush: false)))
|
|
50
|
+
let flush = Pixels(inList(ListItem("Ada", startContent: { swatch() }), ListContext(hasDividers: false, isFlush: true)))
|
|
51
|
+
#expect(!close(padded.at(1, padded.height / 2), red))
|
|
52
|
+
#expect(close(flush.at(1, flush.height / 2), red))
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
@MainActor
|
|
56
|
+
@Test func rowsBetweenDividersHaveSquareCorners() {
|
|
57
|
+
let accent = Theme.default.light.color.accentMuted
|
|
58
|
+
let rounded = Pixels(inList(ListItem("Ada", isSelected: true), ListContext(hasDividers: false, isFlush: false)))
|
|
59
|
+
let square = Pixels(inList(ListItem("Ada", isSelected: true), ListContext(hasDividers: true, isFlush: false)))
|
|
60
|
+
#expect(rounded.at(0, 0)[3] < 8)
|
|
61
|
+
#expect(close(square.at(0, 0), plate(accent), within: 6))
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
@MainActor
|
|
65
|
+
@Test func aDecimalListNumbersItsRows() {
|
|
66
|
+
#expect(ListItem<EmptyView, EmptyView>.number(ordinal: 3) == "3.")
|
|
67
|
+
let numbers = ListNumbers()
|
|
68
|
+
let first = UUID(), second = UUID()
|
|
69
|
+
numbers.assign([first, second], start: 3)
|
|
70
|
+
#expect(numbers.number(for: first) == 3 && numbers.number(for: second) == 4)
|
|
71
|
+
let numbered = Pixels(inList(ListItem("MMMMMM"), ListContext(hasDividers: false, isFlush: false, marker: .decimal)))
|
|
72
|
+
let plain = Pixels(inList(ListItem("MMMMMM"), ListContext(hasDividers: false, isFlush: false)))
|
|
73
|
+
// The number takes a marker column, so a run of blank columns opens
|
|
74
|
+
// between it and the words; without a marker the words start at once.
|
|
75
|
+
func longestBlankRun(_ p: Pixels) -> Int {
|
|
76
|
+
var longest = 0, run = 0
|
|
77
|
+
for x in 8..<80 {
|
|
78
|
+
let blank = (0..<p.height).allSatisfy { y in p.at(x, y)[3] < 64 }
|
|
79
|
+
run = blank ? run + 1 : 0
|
|
80
|
+
longest = max(longest, run)
|
|
81
|
+
}
|
|
82
|
+
return longest
|
|
83
|
+
}
|
|
84
|
+
#expect(longestBlankRun(numbered) >= 5)
|
|
85
|
+
#expect(longestBlankRun(plain) < 5)
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
@MainActor
|
|
89
|
+
@Test func aMarkerSitsOnTheLabelsFirstLineWhateverTheAlignment() {
|
|
90
|
+
func dotCenter(_ p: Pixels) -> Double {
|
|
91
|
+
let rows = (0..<p.height).filter { y in (8..<24).contains { x in p.at(x, y)[3] > 200 } }
|
|
92
|
+
return Double(rows.first! + rows.last!) / 2
|
|
93
|
+
}
|
|
94
|
+
func labelCenter(_ p: Pixels) -> Double {
|
|
95
|
+
let ink = (0..<p.height).map { y in (40..<140).contains { x in p.at(x, y)[3] > 128 } }
|
|
96
|
+
let top = ink.firstIndex(of: true)!
|
|
97
|
+
var bottom = top
|
|
98
|
+
while bottom + 1 < ink.count && ink[bottom + 1] { bottom += 1 }
|
|
99
|
+
return Double(top + bottom) / 2
|
|
100
|
+
}
|
|
101
|
+
let context = ListContext(hasDividers: false, isFlush: false, marker: .disc)
|
|
102
|
+
for align in [ListItemAlign.center, .start, .firstLine] {
|
|
103
|
+
let row = Pixels(inList(ListItem("Ada", description: "Mathematician", align: align), context))
|
|
104
|
+
#expect(abs(dotCenter(row) - labelCenter(row)) <= 1.5, "\(align)")
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/// A translucent theme color as the renderer stores it, premultiplied.
|
|
109
|
+
private func plate(_ color: Color) -> [Int] {
|
|
110
|
+
let c = rgba(color)
|
|
111
|
+
return [c[0] * c[3] / 255, c[1] * c[3] / 255, c[2] * c[3] / 255, c[3]]
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
@MainActor
|
|
115
|
+
@Test func aWideNumberKeepsTheListsTextEdge() {
|
|
116
|
+
// The column is space.s4 wide while a number fits it and the row's inset,
|
|
117
|
+
// so labels line up; "10." reaches into a balanced row's 8-point inset.
|
|
118
|
+
let s4 = Int(Theme.default.light.space.s4)
|
|
119
|
+
#expect(Pixels(ListMarkerNumber(text: "1.", inset: 8)).width == s4)
|
|
120
|
+
#expect(Pixels(ListMarkerNumber(text: "10.", inset: 8)).width == s4)
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
@MainActor
|
|
124
|
+
@Test func numbersEndAtTheColumnsEndSoPeriodsLineUp() {
|
|
125
|
+
// Core's numbered markers end where the marker ends, with tabular figures,
|
|
126
|
+
// so "1." and "10." put their periods at the same place.
|
|
127
|
+
func rightmostInk(_ p: Pixels) -> Int {
|
|
128
|
+
(0..<p.width).last { x in (0..<p.height).contains { y in p.at(x, y)[3] > 64 } } ?? -1
|
|
129
|
+
}
|
|
130
|
+
let one = Pixels(ListMarkerNumber(text: "1.", inset: 8))
|
|
131
|
+
let ten = Pixels(ListMarkerNumber(text: "10.", inset: 8))
|
|
132
|
+
#expect(rightmostInk(one) >= 0)
|
|
133
|
+
#expect(abs(rightmostInk(one) - rightmostInk(ten)) <= 1)
|
|
134
|
+
// The number sits at the column's end, not its start.
|
|
135
|
+
#expect(rightmostInk(one) >= one.width - 3)
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
@Test func aNumberWiderThanTheColumnAndInsetWidensTheSharedColumn() {
|
|
139
|
+
typealias Row = ListItem<EmptyView, EmptyView>
|
|
140
|
+
#expect(Row.numberColumn(base: 16, widest: 20, inset: 8) == 16)
|
|
141
|
+
#expect(Row.numberColumn(base: 16, widest: 40, inset: 8) == 32)
|
|
142
|
+
#expect(Row.numberColumn(base: 16, widest: 30, inset: 0) == 30)
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
@MainActor
|
|
146
|
+
@Test func aListSharesItsWidestNumber() {
|
|
147
|
+
let numbers = ListNumbers()
|
|
148
|
+
let first = UUID(), second = UUID()
|
|
149
|
+
numbers.assign([first, second], start: 1)
|
|
150
|
+
numbers.report(first, width: 20)
|
|
151
|
+
numbers.report(second, width: 30)
|
|
152
|
+
#expect(numbers.widest == 30)
|
|
153
|
+
// A row that leaves the list no longer widens it.
|
|
154
|
+
numbers.assign([first], start: 1)
|
|
155
|
+
#expect(numbers.widest == 20)
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
@Test func onlyANumberMarkerIsRead() {
|
|
159
|
+
#expect(ListItem<EmptyView, EmptyView>.markerIsRead(.decimal))
|
|
160
|
+
#expect(!ListItem<EmptyView, EmptyView>.markerIsRead(.disc))
|
|
161
|
+
#expect(!ListItem<EmptyView, EmptyView>.markerIsRead(.circle))
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
@MainActor
|
|
165
|
+
@Test func aMarkerStaysOnTheFirstLineAtTheLargestTextSize() {
|
|
166
|
+
let context = ListContext(hasDividers: false, isFlush: false, marker: .disc)
|
|
167
|
+
let large = Pixels(inList(ListItem("Ada", description: "Mathematician"), context))
|
|
168
|
+
let largest = Pixels(inList(ListItem("Ada", description: "Mathematician"), context), typeSize: .accessibility5)
|
|
169
|
+
#expect(largest.height > large.height)
|
|
170
|
+
// The dot sits in the top part of the row, by the first line, not its middle.
|
|
171
|
+
// The marker column grows with text, so look across it.
|
|
172
|
+
let rows = (0..<largest.height).filter { y in (8..<60).contains { x in largest.at(x, y)[3] > 200 } }
|
|
173
|
+
#expect(!rows.isEmpty && rows.last! < largest.height / 2)
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
@MainActor
|
|
177
|
+
@Test func markersDrawInEachThemesPrimaryText() {
|
|
178
|
+
for theme in [Theme.neutral, Theme.butter] {
|
|
179
|
+
let drawn = Pixels(inList(ListItem("Ada"), ListContext(hasDividers: false, isFlush: false, marker: .disc)), theme: theme)
|
|
180
|
+
let ink = (0..<drawn.height).flatMap { y in (8..<24).map { x in drawn.at(x, y) } }.filter { $0[3] == 255 }
|
|
181
|
+
#expect(ink.contains { close($0, rgba(theme.light.color.textPrimary), within: 8) })
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
@MainActor
|
|
186
|
+
@Test func aRowNestedInASlotTakesNoListLook() {
|
|
187
|
+
// A nested row has no marker column, so its words start at its own inset.
|
|
188
|
+
let context = ListContext(hasDividers: false, isFlush: true, marker: .disc)
|
|
189
|
+
let nested = Pixels(inList(ListItem("Outer", endContent: { ListItem("MMMM").frame(width: 100) }), context))
|
|
190
|
+
let alone = Pixels(ListItem("MMMM").frame(width: 100))
|
|
191
|
+
let start = { (p: Pixels, from: Int) in (from..<p.width).first { x in (0..<p.height).contains { y in p.at(x, y)[3] > 128 } } ?? -1 }
|
|
192
|
+
#expect(start(nested, 140) - 140 == start(alone, 0))
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
@MainActor
|
|
196
|
+
@Test func aNumberFitsItsColumnAtTheLargestTextSize() {
|
|
197
|
+
// The column grows with the number, so a one-digit number never runs into
|
|
198
|
+
// its label at the largest text size.
|
|
199
|
+
let column = Pixels(ListMarkerNumber(text: "9."), typeSize: .accessibility5).width
|
|
200
|
+
let drawn = Pixels(
|
|
201
|
+
ZStack(alignment: .leading) {
|
|
202
|
+
Color.clear.frame(width: 200, height: 80)
|
|
203
|
+
ListMarkerNumber(text: "9.")
|
|
204
|
+
},
|
|
205
|
+
typeSize: .accessibility5)
|
|
206
|
+
let rightmostInk = (0..<200).last { x in (0..<drawn.height).contains { y in drawn.at(x, y)[3] > 64 } } ?? 0
|
|
207
|
+
#expect(column > Int(Theme.default.light.space.s4))
|
|
208
|
+
#expect(rightmostInk < column)
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
// AST-082 FR19: a ListItem node draws as a ListItem, with its content slots.
|
|
212
|
+
@MainActor
|
|
213
|
+
@Test func aListItemNodeDrawsItsContentSlots() {
|
|
214
|
+
let json = """
|
|
215
|
+
{"component":"ListItem","key":"r","props":{"label":"Ada Lovelace",
|
|
216
|
+
"startContent":[{"component":"Avatar","key":"a","props":{"name":"Ada Lovelace","size":"sm"}}]}}
|
|
217
|
+
"""
|
|
218
|
+
guard let node = try? JSONDecoder().decode(AstryxNode.self, from: Data(json.utf8)) else {
|
|
219
|
+
Issue.record("the row did not decode")
|
|
220
|
+
return
|
|
221
|
+
}
|
|
222
|
+
#expect(AstryxNodeView.componentName(node) == "ListItem")
|
|
223
|
+
let wired = Pixels(AstryxNodeView(node) { _ in }.frame(width: 240))
|
|
224
|
+
let direct = Pixels(ListItem("Ada Lovelace") { Avatar("Ada Lovelace", size: .sm) }.frame(width: 240))
|
|
225
|
+
let bare = Pixels(ListItem("Ada Lovelace").frame(width: 240))
|
|
226
|
+
#expect(wired.width == direct.width && wired.height == direct.height)
|
|
227
|
+
// The slot draws: the leading 40 points hold the avatar, which a bare row
|
|
228
|
+
// leaves empty.
|
|
229
|
+
var leadingDiffers = false
|
|
230
|
+
for y in 0..<min(wired.height, bare.height) {
|
|
231
|
+
for x in 0..<40 where wired.at(x, y) != bare.at(x, y) { leadingDiffers = true }
|
|
232
|
+
}
|
|
233
|
+
#expect(leadingDiffers)
|
|
234
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file components/ListItem.ts
|
|
3
|
+
* @input None
|
|
4
|
+
* @output What @astryxdesign/native adds to the core ListItem contract
|
|
5
|
+
* @position Native additions read by fromComponentDoc together with core's
|
|
6
|
+
* ListItem documentation
|
|
7
|
+
*/
|
|
8
|
+
import type { NativeAdditions } from '../contract/fromComponentDoc.js';
|
|
9
|
+
export declare const listItem: NativeAdditions;
|
|
10
|
+
//# sourceMappingURL=ListItem.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ListItem.d.ts","sourceRoot":"","sources":["../../src/components/ListItem.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,iCAAiC,CAAC;AAErE,eAAO,MAAM,QAAQ,EAAE,eAmBtB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
export const listItem = {
|
|
3
|
+
name: 'ListItem',
|
|
4
|
+
doc: { file: 'List/ListItem' },
|
|
5
|
+
baseTarget: 'root',
|
|
6
|
+
slots: {
|
|
7
|
+
label: 'text',
|
|
8
|
+
description: 'text',
|
|
9
|
+
startContent: 'content',
|
|
10
|
+
endContent: 'content',
|
|
11
|
+
},
|
|
12
|
+
callbacks: ['onClick'],
|
|
13
|
+
sameMeaning: { onClick: 'a press, as in Compose' },
|
|
14
|
+
webOnly: {
|
|
15
|
+
target: 'HTML link target',
|
|
16
|
+
rel: 'HTML link relationship',
|
|
17
|
+
swipeActions: "a native platform's swipe actions work only inside its own scrolling list, so a row elsewhere could not honor them",
|
|
18
|
+
swipeBehavior: 'applies only with swipeActions',
|
|
19
|
+
},
|
|
20
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,iCAAiC,CAAC;AAoBrE,eAAO,MAAM,iBAAiB,EAAE,SAAS,eAAe,EAmBvD,CAAC"}
|
package/dist/components/index.js
CHANGED
|
@@ -9,6 +9,7 @@ import { heading } from './Heading.js';
|
|
|
9
9
|
import { hStack } from './HStack.js';
|
|
10
10
|
import { icon } from './Icon.js';
|
|
11
11
|
import { item } from './Item.js';
|
|
12
|
+
import { listItem } from './ListItem.js';
|
|
12
13
|
import { progressBar } from './ProgressBar.js';
|
|
13
14
|
import { selector } from './Selector.js';
|
|
14
15
|
import { switchControl } from './Switch.js';
|
|
@@ -27,6 +28,7 @@ export const NATIVE_COMPONENTS = [
|
|
|
27
28
|
hStack,
|
|
28
29
|
icon,
|
|
29
30
|
item,
|
|
31
|
+
listItem,
|
|
30
32
|
progressBar,
|
|
31
33
|
selector,
|
|
32
34
|
switchControl,
|
package/dist/types/android.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Generated by @astryxdesign/native. Do not edit.
|
|
2
|
-
import type {AstryxSharedBaseProps, IconName, SelectorOption, AvatarCoreProps, AvatarStatusDotCoreProps, BadgeCoreProps, ButtonCoreProps, CardCoreProps, DividerCoreProps, HeadingCoreProps, HStackCoreProps, IconCoreProps, ItemCoreProps, ProgressBarCoreProps, SelectorCoreProps, SwitchCoreProps, TextCoreProps, ThumbnailCoreProps, TextInputCoreProps, VStackCoreProps} from './core.js';
|
|
3
|
-
export type {AstryxSharedBaseProps, AstryxContentNode, IconName, AvatarCoreProps, AvatarStatusDotCoreProps, BadgeCoreProps, ButtonCoreProps, CardCoreProps, DividerCoreProps, HeadingCoreProps, HStackCoreProps, IconCoreProps, ItemCoreProps, ProgressBarCoreProps, SelectorOption, SelectorCoreProps, SwitchCoreProps, TextCoreProps, ThumbnailCoreProps, TextInputCoreProps, VStackCoreProps} from './core.js';
|
|
2
|
+
import type {AstryxSharedBaseProps, IconName, SelectorOption, AvatarCoreProps, AvatarStatusDotCoreProps, BadgeCoreProps, ButtonCoreProps, CardCoreProps, DividerCoreProps, HeadingCoreProps, HStackCoreProps, IconCoreProps, ItemCoreProps, ListItemCoreProps, ProgressBarCoreProps, SelectorCoreProps, SwitchCoreProps, TextCoreProps, ThumbnailCoreProps, TextInputCoreProps, VStackCoreProps} from './core.js';
|
|
3
|
+
export type {AstryxSharedBaseProps, AstryxContentNode, IconName, AvatarCoreProps, AvatarStatusDotCoreProps, BadgeCoreProps, ButtonCoreProps, CardCoreProps, DividerCoreProps, HeadingCoreProps, HStackCoreProps, IconCoreProps, ItemCoreProps, ListItemCoreProps, ProgressBarCoreProps, SelectorOption, SelectorCoreProps, SwitchCoreProps, TextCoreProps, ThumbnailCoreProps, TextInputCoreProps, VStackCoreProps} from './core.js';
|
|
4
4
|
/** Avatar props: core contract plus the android contract. */
|
|
5
5
|
export interface AvatarProps extends AvatarCoreProps {}
|
|
6
6
|
export declare function Avatar(props: AvatarProps): unknown;
|
|
@@ -31,6 +31,9 @@ export declare function Icon(props: IconProps): unknown;
|
|
|
31
31
|
/** Item props: core contract plus the android contract. */
|
|
32
32
|
export interface ItemProps extends ItemCoreProps {}
|
|
33
33
|
export declare function Item(props: ItemProps): unknown;
|
|
34
|
+
/** ListItem props: core contract plus the android contract. */
|
|
35
|
+
export interface ListItemProps extends ListItemCoreProps {}
|
|
36
|
+
export declare function ListItem(props: ListItemProps): unknown;
|
|
34
37
|
/** ProgressBar props: core contract plus the android contract. */
|
|
35
38
|
export interface ProgressBarProps extends ProgressBarCoreProps {}
|
|
36
39
|
export declare function ProgressBar(props: ProgressBarProps): unknown;
|
|
@@ -133,6 +136,15 @@ export interface ItemNode {
|
|
|
133
136
|
/** The callbacks the core listens to. */
|
|
134
137
|
events?: ReadonlyArray<'onClick'>;
|
|
135
138
|
}
|
|
139
|
+
/** ListItem as JSON from a TypeScript core. */
|
|
140
|
+
export interface ListItemNode {
|
|
141
|
+
component: 'ListItem';
|
|
142
|
+
key: string;
|
|
143
|
+
base?: AstryxSharedBaseProps;
|
|
144
|
+
props: {label: string; description?: string; startContent?: ReadonlyArray<AstryxNode>; endContent?: ReadonlyArray<AstryxNode>; href?: string; align?: 'center' | 'start' | 'first-line'; isDisabled?: boolean; isSelected?: boolean;};
|
|
145
|
+
/** The callbacks the core listens to. */
|
|
146
|
+
events?: ReadonlyArray<'onClick'>;
|
|
147
|
+
}
|
|
136
148
|
/** ProgressBar as JSON from a TypeScript core. */
|
|
137
149
|
export interface ProgressBarNode {
|
|
138
150
|
component: 'ProgressBar';
|
|
@@ -191,12 +203,13 @@ export interface VStackNode {
|
|
|
191
203
|
props: {gap?: 0 | 0.5 | 1 | 1.5 | 2 | 3 | 4 | 5 | 6 | 8 | 10; padding?: 0 | 0.5 | 1 | 1.5 | 2 | 3 | 4 | 5 | 6 | 8 | 10; paddingInline?: 0 | 0.5 | 1 | 1.5 | 2 | 3 | 4 | 5 | 6 | 8 | 10; paddingInlineStart?: 0 | 0.5 | 1 | 1.5 | 2 | 3 | 4 | 5 | 6 | 8 | 10; paddingInlineEnd?: 0 | 0.5 | 1 | 1.5 | 2 | 3 | 4 | 5 | 6 | 8 | 10; paddingBlock?: 0 | 0.5 | 1 | 1.5 | 2 | 3 | 4 | 5 | 6 | 8 | 10; paddingBlockStart?: 0 | 0.5 | 1 | 1.5 | 2 | 3 | 4 | 5 | 6 | 8 | 10; paddingBlockEnd?: 0 | 0.5 | 1 | 1.5 | 2 | 3 | 4 | 5 | 6 | 8 | 10; isScrollable?: boolean; hAlign?: 'start' | 'center' | 'end' | 'stretch'; vAlign?: 'start' | 'center' | 'end' | 'between' | 'around' | 'evenly'; justify?: 'start' | 'center' | 'end' | 'between' | 'around' | 'evenly'; align?: 'start' | 'center' | 'end' | 'stretch'; wrap?: 'nowrap' | 'wrap' | 'wrap-reverse'; children?: ReadonlyArray<AstryxNode>;};
|
|
192
204
|
}
|
|
193
205
|
/** Any Astryx component a TypeScript core can send. */
|
|
194
|
-
export type AstryxNode = AvatarNode | AvatarStatusDotNode | BadgeNode | ButtonNode | CardNode | DividerNode | HeadingNode | HStackNode | IconNode | ItemNode | ProgressBarNode | SelectorNode | SwitchNode | TextNode | ThumbnailNode | TextInputNode | VStackNode;
|
|
206
|
+
export type AstryxNode = AvatarNode | AvatarStatusDotNode | BadgeNode | ButtonNode | CardNode | DividerNode | HeadingNode | HStackNode | IconNode | ItemNode | ListItemNode | ProgressBarNode | SelectorNode | SwitchNode | TextNode | ThumbnailNode | TextInputNode | VStackNode;
|
|
195
207
|
/** A callback a native view called, sent back to the core. */
|
|
196
208
|
export type AstryxAction =
|
|
197
209
|
| {key: string; component: 'Avatar'; event: 'onClick'; args: []}
|
|
198
210
|
| {key: string; component: 'Button'; event: 'onClick'; args: []}
|
|
199
211
|
| {key: string; component: 'Item'; event: 'onClick'; args: []}
|
|
212
|
+
| {key: string; component: 'ListItem'; event: 'onClick'; args: []}
|
|
200
213
|
| {key: string; component: 'Selector'; event: 'onChange'; args: [string]}
|
|
201
214
|
| {key: string; component: 'Switch'; event: 'onChange'; args: [boolean]}
|
|
202
215
|
| {key: string; component: 'Thumbnail'; event: 'onRemove'; args: []}
|
package/dist/types/core.d.ts
CHANGED
|
@@ -123,6 +123,18 @@ export interface ItemCoreProps extends AstryxSharedBaseProps {
|
|
|
123
123
|
isDisabled?: boolean;
|
|
124
124
|
}
|
|
125
125
|
/** Core contract. Base props attach to the root. */
|
|
126
|
+
export interface ListItemCoreProps extends AstryxSharedBaseProps {
|
|
127
|
+
label: string;
|
|
128
|
+
description?: string;
|
|
129
|
+
startContent?: ReadonlyArray<AstryxContentNode>;
|
|
130
|
+
endContent?: ReadonlyArray<AstryxContentNode>;
|
|
131
|
+
onClick?: () => void;
|
|
132
|
+
href?: string;
|
|
133
|
+
align?: 'center' | 'start' | 'first-line';
|
|
134
|
+
isDisabled?: boolean;
|
|
135
|
+
isSelected?: boolean;
|
|
136
|
+
}
|
|
137
|
+
/** Core contract. Base props attach to the root. */
|
|
126
138
|
export interface ProgressBarCoreProps extends AstryxSharedBaseProps {
|
|
127
139
|
label: string;
|
|
128
140
|
value?: number;
|
package/dist/types/ios.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Generated by @astryxdesign/native. Do not edit.
|
|
2
|
-
import type {AstryxSharedBaseProps, IconName, SelectorOption, AvatarCoreProps, AvatarStatusDotCoreProps, BadgeCoreProps, ButtonCoreProps, CardCoreProps, DividerCoreProps, HeadingCoreProps, HStackCoreProps, IconCoreProps, ItemCoreProps, ProgressBarCoreProps, SelectorCoreProps, SwitchCoreProps, TextCoreProps, ThumbnailCoreProps, TextInputCoreProps, VStackCoreProps} from './core.js';
|
|
3
|
-
export type {AstryxSharedBaseProps, AstryxContentNode, IconName, AvatarCoreProps, AvatarStatusDotCoreProps, BadgeCoreProps, ButtonCoreProps, CardCoreProps, DividerCoreProps, HeadingCoreProps, HStackCoreProps, IconCoreProps, ItemCoreProps, ProgressBarCoreProps, SelectorOption, SelectorCoreProps, SwitchCoreProps, TextCoreProps, ThumbnailCoreProps, TextInputCoreProps, VStackCoreProps} from './core.js';
|
|
2
|
+
import type {AstryxSharedBaseProps, IconName, SelectorOption, AvatarCoreProps, AvatarStatusDotCoreProps, BadgeCoreProps, ButtonCoreProps, CardCoreProps, DividerCoreProps, HeadingCoreProps, HStackCoreProps, IconCoreProps, ItemCoreProps, ListItemCoreProps, ProgressBarCoreProps, SelectorCoreProps, SwitchCoreProps, TextCoreProps, ThumbnailCoreProps, TextInputCoreProps, VStackCoreProps} from './core.js';
|
|
3
|
+
export type {AstryxSharedBaseProps, AstryxContentNode, IconName, AvatarCoreProps, AvatarStatusDotCoreProps, BadgeCoreProps, ButtonCoreProps, CardCoreProps, DividerCoreProps, HeadingCoreProps, HStackCoreProps, IconCoreProps, ItemCoreProps, ListItemCoreProps, ProgressBarCoreProps, SelectorOption, SelectorCoreProps, SwitchCoreProps, TextCoreProps, ThumbnailCoreProps, TextInputCoreProps, VStackCoreProps} from './core.js';
|
|
4
4
|
/** Avatar props: core contract plus the ios contract. */
|
|
5
5
|
export interface AvatarProps extends AvatarCoreProps {}
|
|
6
6
|
export declare function Avatar(props: AvatarProps): unknown;
|
|
@@ -31,6 +31,9 @@ export declare function Icon(props: IconProps): unknown;
|
|
|
31
31
|
/** Item props: core contract plus the ios contract. */
|
|
32
32
|
export interface ItemProps extends ItemCoreProps {}
|
|
33
33
|
export declare function Item(props: ItemProps): unknown;
|
|
34
|
+
/** ListItem props: core contract plus the ios contract. */
|
|
35
|
+
export interface ListItemProps extends ListItemCoreProps {}
|
|
36
|
+
export declare function ListItem(props: ListItemProps): unknown;
|
|
34
37
|
/** ProgressBar props: core contract plus the ios contract. */
|
|
35
38
|
export interface ProgressBarProps extends ProgressBarCoreProps {}
|
|
36
39
|
export declare function ProgressBar(props: ProgressBarProps): unknown;
|
|
@@ -130,6 +133,15 @@ export interface ItemNode {
|
|
|
130
133
|
/** The callbacks the core listens to. */
|
|
131
134
|
events?: ReadonlyArray<'onClick'>;
|
|
132
135
|
}
|
|
136
|
+
/** ListItem as JSON from a TypeScript core. */
|
|
137
|
+
export interface ListItemNode {
|
|
138
|
+
component: 'ListItem';
|
|
139
|
+
key: string;
|
|
140
|
+
base?: AstryxSharedBaseProps;
|
|
141
|
+
props: {label: string; description?: string; startContent?: ReadonlyArray<AstryxNode>; endContent?: ReadonlyArray<AstryxNode>; href?: string; align?: 'center' | 'start' | 'first-line'; isDisabled?: boolean; isSelected?: boolean;};
|
|
142
|
+
/** The callbacks the core listens to. */
|
|
143
|
+
events?: ReadonlyArray<'onClick'>;
|
|
144
|
+
}
|
|
133
145
|
/** ProgressBar as JSON from a TypeScript core. */
|
|
134
146
|
export interface ProgressBarNode {
|
|
135
147
|
component: 'ProgressBar';
|
|
@@ -188,12 +200,13 @@ export interface VStackNode {
|
|
|
188
200
|
props: {gap?: 0 | 0.5 | 1 | 1.5 | 2 | 3 | 4 | 5 | 6 | 8 | 10; padding?: 0 | 0.5 | 1 | 1.5 | 2 | 3 | 4 | 5 | 6 | 8 | 10; paddingInline?: 0 | 0.5 | 1 | 1.5 | 2 | 3 | 4 | 5 | 6 | 8 | 10; paddingInlineStart?: 0 | 0.5 | 1 | 1.5 | 2 | 3 | 4 | 5 | 6 | 8 | 10; paddingInlineEnd?: 0 | 0.5 | 1 | 1.5 | 2 | 3 | 4 | 5 | 6 | 8 | 10; paddingBlock?: 0 | 0.5 | 1 | 1.5 | 2 | 3 | 4 | 5 | 6 | 8 | 10; paddingBlockStart?: 0 | 0.5 | 1 | 1.5 | 2 | 3 | 4 | 5 | 6 | 8 | 10; paddingBlockEnd?: 0 | 0.5 | 1 | 1.5 | 2 | 3 | 4 | 5 | 6 | 8 | 10; isScrollable?: boolean; hAlign?: 'start' | 'center' | 'end' | 'stretch'; vAlign?: 'start' | 'center' | 'end' | 'between' | 'around' | 'evenly'; justify?: 'start' | 'center' | 'end' | 'between' | 'around' | 'evenly'; align?: 'start' | 'center' | 'end' | 'stretch'; wrap?: 'nowrap' | 'wrap' | 'wrap-reverse'; children?: ReadonlyArray<AstryxNode>;};
|
|
189
201
|
}
|
|
190
202
|
/** Any Astryx component a TypeScript core can send. */
|
|
191
|
-
export type AstryxNode = AvatarNode | AvatarStatusDotNode | BadgeNode | ButtonNode | CardNode | DividerNode | HeadingNode | HStackNode | IconNode | ItemNode | ProgressBarNode | SelectorNode | SwitchNode | TextNode | ThumbnailNode | TextInputNode | VStackNode;
|
|
203
|
+
export type AstryxNode = AvatarNode | AvatarStatusDotNode | BadgeNode | ButtonNode | CardNode | DividerNode | HeadingNode | HStackNode | IconNode | ItemNode | ListItemNode | ProgressBarNode | SelectorNode | SwitchNode | TextNode | ThumbnailNode | TextInputNode | VStackNode;
|
|
192
204
|
/** A callback a native view called, sent back to the core. */
|
|
193
205
|
export type AstryxAction =
|
|
194
206
|
| {key: string; component: 'Avatar'; event: 'onClick'; args: []}
|
|
195
207
|
| {key: string; component: 'Button'; event: 'onClick'; args: []}
|
|
196
208
|
| {key: string; component: 'Item'; event: 'onClick'; args: []}
|
|
209
|
+
| {key: string; component: 'ListItem'; event: 'onClick'; args: []}
|
|
197
210
|
| {key: string; component: 'Selector'; event: 'onChange'; args: [string]}
|
|
198
211
|
| {key: string; component: 'Switch'; event: 'onChange'; args: [boolean]}
|
|
199
212
|
| {key: string; component: 'Thumbnail'; event: 'onRemove'; args: []}
|
package/dist/types/macos.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Generated by @astryxdesign/native. Do not edit.
|
|
2
|
-
import type {AstryxSharedBaseProps, IconName, SelectorOption, AvatarCoreProps, AvatarStatusDotCoreProps, BadgeCoreProps, ButtonCoreProps, CardCoreProps, DividerCoreProps, HeadingCoreProps, HStackCoreProps, IconCoreProps, ItemCoreProps, ProgressBarCoreProps, SelectorCoreProps, SwitchCoreProps, TextCoreProps, ThumbnailCoreProps, TextInputCoreProps, VStackCoreProps} from './core.js';
|
|
3
|
-
export type {AstryxSharedBaseProps, AstryxContentNode, IconName, AvatarCoreProps, AvatarStatusDotCoreProps, BadgeCoreProps, ButtonCoreProps, CardCoreProps, DividerCoreProps, HeadingCoreProps, HStackCoreProps, IconCoreProps, ItemCoreProps, ProgressBarCoreProps, SelectorOption, SelectorCoreProps, SwitchCoreProps, TextCoreProps, ThumbnailCoreProps, TextInputCoreProps, VStackCoreProps} from './core.js';
|
|
2
|
+
import type {AstryxSharedBaseProps, IconName, SelectorOption, AvatarCoreProps, AvatarStatusDotCoreProps, BadgeCoreProps, ButtonCoreProps, CardCoreProps, DividerCoreProps, HeadingCoreProps, HStackCoreProps, IconCoreProps, ItemCoreProps, ListItemCoreProps, ProgressBarCoreProps, SelectorCoreProps, SwitchCoreProps, TextCoreProps, ThumbnailCoreProps, TextInputCoreProps, VStackCoreProps} from './core.js';
|
|
3
|
+
export type {AstryxSharedBaseProps, AstryxContentNode, IconName, AvatarCoreProps, AvatarStatusDotCoreProps, BadgeCoreProps, ButtonCoreProps, CardCoreProps, DividerCoreProps, HeadingCoreProps, HStackCoreProps, IconCoreProps, ItemCoreProps, ListItemCoreProps, ProgressBarCoreProps, SelectorOption, SelectorCoreProps, SwitchCoreProps, TextCoreProps, ThumbnailCoreProps, TextInputCoreProps, VStackCoreProps} from './core.js';
|
|
4
4
|
/** Avatar props: core contract plus the macos contract. */
|
|
5
5
|
export interface AvatarProps extends AvatarCoreProps {}
|
|
6
6
|
export declare function Avatar(props: AvatarProps): unknown;
|
|
@@ -31,6 +31,9 @@ export declare function Icon(props: IconProps): unknown;
|
|
|
31
31
|
/** Item props: core contract plus the macos contract. */
|
|
32
32
|
export interface ItemProps extends ItemCoreProps {}
|
|
33
33
|
export declare function Item(props: ItemProps): unknown;
|
|
34
|
+
/** ListItem props: core contract plus the macos contract. */
|
|
35
|
+
export interface ListItemProps extends ListItemCoreProps {}
|
|
36
|
+
export declare function ListItem(props: ListItemProps): unknown;
|
|
34
37
|
/** ProgressBar props: core contract plus the macos contract. */
|
|
35
38
|
export interface ProgressBarProps extends ProgressBarCoreProps {}
|
|
36
39
|
export declare function ProgressBar(props: ProgressBarProps): unknown;
|
|
@@ -130,6 +133,15 @@ export interface ItemNode {
|
|
|
130
133
|
/** The callbacks the core listens to. */
|
|
131
134
|
events?: ReadonlyArray<'onClick'>;
|
|
132
135
|
}
|
|
136
|
+
/** ListItem as JSON from a TypeScript core. */
|
|
137
|
+
export interface ListItemNode {
|
|
138
|
+
component: 'ListItem';
|
|
139
|
+
key: string;
|
|
140
|
+
base?: AstryxSharedBaseProps;
|
|
141
|
+
props: {label: string; description?: string; startContent?: ReadonlyArray<AstryxNode>; endContent?: ReadonlyArray<AstryxNode>; href?: string; align?: 'center' | 'start' | 'first-line'; isDisabled?: boolean; isSelected?: boolean;};
|
|
142
|
+
/** The callbacks the core listens to. */
|
|
143
|
+
events?: ReadonlyArray<'onClick'>;
|
|
144
|
+
}
|
|
133
145
|
/** ProgressBar as JSON from a TypeScript core. */
|
|
134
146
|
export interface ProgressBarNode {
|
|
135
147
|
component: 'ProgressBar';
|
|
@@ -188,12 +200,13 @@ export interface VStackNode {
|
|
|
188
200
|
props: {gap?: 0 | 0.5 | 1 | 1.5 | 2 | 3 | 4 | 5 | 6 | 8 | 10; padding?: 0 | 0.5 | 1 | 1.5 | 2 | 3 | 4 | 5 | 6 | 8 | 10; paddingInline?: 0 | 0.5 | 1 | 1.5 | 2 | 3 | 4 | 5 | 6 | 8 | 10; paddingInlineStart?: 0 | 0.5 | 1 | 1.5 | 2 | 3 | 4 | 5 | 6 | 8 | 10; paddingInlineEnd?: 0 | 0.5 | 1 | 1.5 | 2 | 3 | 4 | 5 | 6 | 8 | 10; paddingBlock?: 0 | 0.5 | 1 | 1.5 | 2 | 3 | 4 | 5 | 6 | 8 | 10; paddingBlockStart?: 0 | 0.5 | 1 | 1.5 | 2 | 3 | 4 | 5 | 6 | 8 | 10; paddingBlockEnd?: 0 | 0.5 | 1 | 1.5 | 2 | 3 | 4 | 5 | 6 | 8 | 10; isScrollable?: boolean; hAlign?: 'start' | 'center' | 'end' | 'stretch'; vAlign?: 'start' | 'center' | 'end' | 'between' | 'around' | 'evenly'; justify?: 'start' | 'center' | 'end' | 'between' | 'around' | 'evenly'; align?: 'start' | 'center' | 'end' | 'stretch'; wrap?: 'nowrap' | 'wrap' | 'wrap-reverse'; children?: ReadonlyArray<AstryxNode>;};
|
|
189
201
|
}
|
|
190
202
|
/** Any Astryx component a TypeScript core can send. */
|
|
191
|
-
export type AstryxNode = AvatarNode | AvatarStatusDotNode | BadgeNode | ButtonNode | CardNode | DividerNode | HeadingNode | HStackNode | IconNode | ItemNode | ProgressBarNode | SelectorNode | SwitchNode | TextNode | ThumbnailNode | TextInputNode | VStackNode;
|
|
203
|
+
export type AstryxNode = AvatarNode | AvatarStatusDotNode | BadgeNode | ButtonNode | CardNode | DividerNode | HeadingNode | HStackNode | IconNode | ItemNode | ListItemNode | ProgressBarNode | SelectorNode | SwitchNode | TextNode | ThumbnailNode | TextInputNode | VStackNode;
|
|
192
204
|
/** A callback a native view called, sent back to the core. */
|
|
193
205
|
export type AstryxAction =
|
|
194
206
|
| {key: string; component: 'Avatar'; event: 'onClick'; args: []}
|
|
195
207
|
| {key: string; component: 'Button'; event: 'onClick'; args: []}
|
|
196
208
|
| {key: string; component: 'Item'; event: 'onClick'; args: []}
|
|
209
|
+
| {key: string; component: 'ListItem'; event: 'onClick'; args: []}
|
|
197
210
|
| {key: string; component: 'Selector'; event: 'onChange'; args: [string]}
|
|
198
211
|
| {key: string; component: 'Switch'; event: 'onChange'; args: [boolean]}
|
|
199
212
|
| {key: string; component: 'Thumbnail'; event: 'onRemove'; args: []}
|
package/dist/types/shared.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Generated by @astryxdesign/native. Do not edit.
|
|
2
|
-
import type {AstryxSharedBaseProps, IconName, SelectorOption, AvatarCoreProps, AvatarStatusDotCoreProps, BadgeCoreProps, ButtonCoreProps, CardCoreProps, DividerCoreProps, HeadingCoreProps, HStackCoreProps, IconCoreProps, ItemCoreProps, ProgressBarCoreProps, SelectorCoreProps, SwitchCoreProps, TextCoreProps, ThumbnailCoreProps, TextInputCoreProps, VStackCoreProps} from './core.js';
|
|
3
|
-
export type {AstryxSharedBaseProps, AstryxContentNode, IconName, AvatarCoreProps, AvatarStatusDotCoreProps, BadgeCoreProps, ButtonCoreProps, CardCoreProps, DividerCoreProps, HeadingCoreProps, HStackCoreProps, IconCoreProps, ItemCoreProps, ProgressBarCoreProps, SelectorOption, SelectorCoreProps, SwitchCoreProps, TextCoreProps, ThumbnailCoreProps, TextInputCoreProps, VStackCoreProps} from './core.js';
|
|
2
|
+
import type {AstryxSharedBaseProps, IconName, SelectorOption, AvatarCoreProps, AvatarStatusDotCoreProps, BadgeCoreProps, ButtonCoreProps, CardCoreProps, DividerCoreProps, HeadingCoreProps, HStackCoreProps, IconCoreProps, ItemCoreProps, ListItemCoreProps, ProgressBarCoreProps, SelectorCoreProps, SwitchCoreProps, TextCoreProps, ThumbnailCoreProps, TextInputCoreProps, VStackCoreProps} from './core.js';
|
|
3
|
+
export type {AstryxSharedBaseProps, AstryxContentNode, IconName, AvatarCoreProps, AvatarStatusDotCoreProps, BadgeCoreProps, ButtonCoreProps, CardCoreProps, DividerCoreProps, HeadingCoreProps, HStackCoreProps, IconCoreProps, ItemCoreProps, ListItemCoreProps, ProgressBarCoreProps, SelectorOption, SelectorCoreProps, SwitchCoreProps, TextCoreProps, ThumbnailCoreProps, TextInputCoreProps, VStackCoreProps} from './core.js';
|
|
4
4
|
/** Avatar props: core contract only. */
|
|
5
5
|
export interface AvatarProps extends AvatarCoreProps {}
|
|
6
6
|
export declare function Avatar(props: AvatarProps): unknown;
|
|
@@ -31,6 +31,9 @@ export declare function Icon(props: IconProps): unknown;
|
|
|
31
31
|
/** Item props: core contract only. */
|
|
32
32
|
export interface ItemProps extends ItemCoreProps {}
|
|
33
33
|
export declare function Item(props: ItemProps): unknown;
|
|
34
|
+
/** ListItem props: core contract only. */
|
|
35
|
+
export interface ListItemProps extends ListItemCoreProps {}
|
|
36
|
+
export declare function ListItem(props: ListItemProps): unknown;
|
|
34
37
|
/** ProgressBar props: core contract only. */
|
|
35
38
|
export interface ProgressBarProps extends ProgressBarCoreProps {}
|
|
36
39
|
export declare function ProgressBar(props: ProgressBarProps): unknown;
|
|
@@ -128,6 +131,15 @@ export interface ItemNode {
|
|
|
128
131
|
/** The callbacks the core listens to. */
|
|
129
132
|
events?: ReadonlyArray<'onClick'>;
|
|
130
133
|
}
|
|
134
|
+
/** ListItem as JSON from a TypeScript core. */
|
|
135
|
+
export interface ListItemNode {
|
|
136
|
+
component: 'ListItem';
|
|
137
|
+
key: string;
|
|
138
|
+
base?: AstryxSharedBaseProps;
|
|
139
|
+
props: {label: string; description?: string; startContent?: ReadonlyArray<AstryxNode>; endContent?: ReadonlyArray<AstryxNode>; href?: string; align?: 'center' | 'start' | 'first-line'; isDisabled?: boolean; isSelected?: boolean;};
|
|
140
|
+
/** The callbacks the core listens to. */
|
|
141
|
+
events?: ReadonlyArray<'onClick'>;
|
|
142
|
+
}
|
|
131
143
|
/** ProgressBar as JSON from a TypeScript core. */
|
|
132
144
|
export interface ProgressBarNode {
|
|
133
145
|
component: 'ProgressBar';
|
|
@@ -186,12 +198,13 @@ export interface VStackNode {
|
|
|
186
198
|
props: {gap?: 0 | 0.5 | 1 | 1.5 | 2 | 3 | 4 | 5 | 6 | 8 | 10; padding?: 0 | 0.5 | 1 | 1.5 | 2 | 3 | 4 | 5 | 6 | 8 | 10; paddingInline?: 0 | 0.5 | 1 | 1.5 | 2 | 3 | 4 | 5 | 6 | 8 | 10; paddingInlineStart?: 0 | 0.5 | 1 | 1.5 | 2 | 3 | 4 | 5 | 6 | 8 | 10; paddingInlineEnd?: 0 | 0.5 | 1 | 1.5 | 2 | 3 | 4 | 5 | 6 | 8 | 10; paddingBlock?: 0 | 0.5 | 1 | 1.5 | 2 | 3 | 4 | 5 | 6 | 8 | 10; paddingBlockStart?: 0 | 0.5 | 1 | 1.5 | 2 | 3 | 4 | 5 | 6 | 8 | 10; paddingBlockEnd?: 0 | 0.5 | 1 | 1.5 | 2 | 3 | 4 | 5 | 6 | 8 | 10; isScrollable?: boolean; hAlign?: 'start' | 'center' | 'end' | 'stretch'; vAlign?: 'start' | 'center' | 'end' | 'between' | 'around' | 'evenly'; justify?: 'start' | 'center' | 'end' | 'between' | 'around' | 'evenly'; align?: 'start' | 'center' | 'end' | 'stretch'; wrap?: 'nowrap' | 'wrap' | 'wrap-reverse'; children?: ReadonlyArray<AstryxNode>;};
|
|
187
199
|
}
|
|
188
200
|
/** Any Astryx component a TypeScript core can send. */
|
|
189
|
-
export type AstryxNode = AvatarNode | AvatarStatusDotNode | BadgeNode | ButtonNode | CardNode | DividerNode | HeadingNode | HStackNode | IconNode | ItemNode | ProgressBarNode | SelectorNode | SwitchNode | TextNode | ThumbnailNode | TextInputNode | VStackNode;
|
|
201
|
+
export type AstryxNode = AvatarNode | AvatarStatusDotNode | BadgeNode | ButtonNode | CardNode | DividerNode | HeadingNode | HStackNode | IconNode | ItemNode | ListItemNode | ProgressBarNode | SelectorNode | SwitchNode | TextNode | ThumbnailNode | TextInputNode | VStackNode;
|
|
190
202
|
/** A callback a native view called, sent back to the core. */
|
|
191
203
|
export type AstryxAction =
|
|
192
204
|
| {key: string; component: 'Avatar'; event: 'onClick'; args: []}
|
|
193
205
|
| {key: string; component: 'Button'; event: 'onClick'; args: []}
|
|
194
206
|
| {key: string; component: 'Item'; event: 'onClick'; args: []}
|
|
207
|
+
| {key: string; component: 'ListItem'; event: 'onClick'; args: []}
|
|
195
208
|
| {key: string; component: 'Selector'; event: 'onChange'; args: [string]}
|
|
196
209
|
| {key: string; component: 'Switch'; event: 'onChange'; args: [boolean]}
|
|
197
210
|
| {key: string; component: 'Thumbnail'; event: 'onRemove'; args: []}
|
package/dist/types/windows.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Generated by @astryxdesign/native. Do not edit.
|
|
2
|
-
import type {AstryxSharedBaseProps, IconName, SelectorOption, AvatarCoreProps, AvatarStatusDotCoreProps, BadgeCoreProps, ButtonCoreProps, CardCoreProps, DividerCoreProps, HeadingCoreProps, HStackCoreProps, IconCoreProps, ItemCoreProps, ProgressBarCoreProps, SelectorCoreProps, SwitchCoreProps, TextCoreProps, ThumbnailCoreProps, TextInputCoreProps, VStackCoreProps} from './core.js';
|
|
3
|
-
export type {AstryxSharedBaseProps, AstryxContentNode, IconName, AvatarCoreProps, AvatarStatusDotCoreProps, BadgeCoreProps, ButtonCoreProps, CardCoreProps, DividerCoreProps, HeadingCoreProps, HStackCoreProps, IconCoreProps, ItemCoreProps, ProgressBarCoreProps, SelectorOption, SelectorCoreProps, SwitchCoreProps, TextCoreProps, ThumbnailCoreProps, TextInputCoreProps, VStackCoreProps} from './core.js';
|
|
2
|
+
import type {AstryxSharedBaseProps, IconName, SelectorOption, AvatarCoreProps, AvatarStatusDotCoreProps, BadgeCoreProps, ButtonCoreProps, CardCoreProps, DividerCoreProps, HeadingCoreProps, HStackCoreProps, IconCoreProps, ItemCoreProps, ListItemCoreProps, ProgressBarCoreProps, SelectorCoreProps, SwitchCoreProps, TextCoreProps, ThumbnailCoreProps, TextInputCoreProps, VStackCoreProps} from './core.js';
|
|
3
|
+
export type {AstryxSharedBaseProps, AstryxContentNode, IconName, AvatarCoreProps, AvatarStatusDotCoreProps, BadgeCoreProps, ButtonCoreProps, CardCoreProps, DividerCoreProps, HeadingCoreProps, HStackCoreProps, IconCoreProps, ItemCoreProps, ListItemCoreProps, ProgressBarCoreProps, SelectorOption, SelectorCoreProps, SwitchCoreProps, TextCoreProps, ThumbnailCoreProps, TextInputCoreProps, VStackCoreProps} from './core.js';
|
|
4
4
|
/** Avatar props: core contract plus the windows contract. */
|
|
5
5
|
export interface AvatarProps extends AvatarCoreProps {}
|
|
6
6
|
export declare function Avatar(props: AvatarProps): unknown;
|
|
@@ -31,6 +31,9 @@ export declare function Icon(props: IconProps): unknown;
|
|
|
31
31
|
/** Item props: core contract plus the windows contract. */
|
|
32
32
|
export interface ItemProps extends ItemCoreProps {}
|
|
33
33
|
export declare function Item(props: ItemProps): unknown;
|
|
34
|
+
/** ListItem props: core contract plus the windows contract. */
|
|
35
|
+
export interface ListItemProps extends ListItemCoreProps {}
|
|
36
|
+
export declare function ListItem(props: ListItemProps): unknown;
|
|
34
37
|
/** ProgressBar props: core contract plus the windows contract. */
|
|
35
38
|
export interface ProgressBarProps extends ProgressBarCoreProps {}
|
|
36
39
|
export declare function ProgressBar(props: ProgressBarProps): unknown;
|
|
@@ -131,6 +134,15 @@ export interface ItemNode {
|
|
|
131
134
|
/** The callbacks the core listens to. */
|
|
132
135
|
events?: ReadonlyArray<'onClick'>;
|
|
133
136
|
}
|
|
137
|
+
/** ListItem as JSON from a TypeScript core. */
|
|
138
|
+
export interface ListItemNode {
|
|
139
|
+
component: 'ListItem';
|
|
140
|
+
key: string;
|
|
141
|
+
base?: AstryxSharedBaseProps;
|
|
142
|
+
props: {label: string; description?: string; startContent?: ReadonlyArray<AstryxNode>; endContent?: ReadonlyArray<AstryxNode>; href?: string; align?: 'center' | 'start' | 'first-line'; isDisabled?: boolean; isSelected?: boolean;};
|
|
143
|
+
/** The callbacks the core listens to. */
|
|
144
|
+
events?: ReadonlyArray<'onClick'>;
|
|
145
|
+
}
|
|
134
146
|
/** ProgressBar as JSON from a TypeScript core. */
|
|
135
147
|
export interface ProgressBarNode {
|
|
136
148
|
component: 'ProgressBar';
|
|
@@ -189,12 +201,13 @@ export interface VStackNode {
|
|
|
189
201
|
props: {gap?: 0 | 0.5 | 1 | 1.5 | 2 | 3 | 4 | 5 | 6 | 8 | 10; padding?: 0 | 0.5 | 1 | 1.5 | 2 | 3 | 4 | 5 | 6 | 8 | 10; paddingInline?: 0 | 0.5 | 1 | 1.5 | 2 | 3 | 4 | 5 | 6 | 8 | 10; paddingInlineStart?: 0 | 0.5 | 1 | 1.5 | 2 | 3 | 4 | 5 | 6 | 8 | 10; paddingInlineEnd?: 0 | 0.5 | 1 | 1.5 | 2 | 3 | 4 | 5 | 6 | 8 | 10; paddingBlock?: 0 | 0.5 | 1 | 1.5 | 2 | 3 | 4 | 5 | 6 | 8 | 10; paddingBlockStart?: 0 | 0.5 | 1 | 1.5 | 2 | 3 | 4 | 5 | 6 | 8 | 10; paddingBlockEnd?: 0 | 0.5 | 1 | 1.5 | 2 | 3 | 4 | 5 | 6 | 8 | 10; isScrollable?: boolean; hAlign?: 'start' | 'center' | 'end' | 'stretch'; vAlign?: 'start' | 'center' | 'end' | 'between' | 'around' | 'evenly'; justify?: 'start' | 'center' | 'end' | 'between' | 'around' | 'evenly'; align?: 'start' | 'center' | 'end' | 'stretch'; wrap?: 'nowrap' | 'wrap' | 'wrap-reverse'; children?: ReadonlyArray<AstryxNode>;};
|
|
190
202
|
}
|
|
191
203
|
/** Any Astryx component a TypeScript core can send. */
|
|
192
|
-
export type AstryxNode = AvatarNode | AvatarStatusDotNode | BadgeNode | ButtonNode | CardNode | DividerNode | HeadingNode | HStackNode | IconNode | ItemNode | ProgressBarNode | SelectorNode | SwitchNode | TextNode | ThumbnailNode | TextInputNode | VStackNode;
|
|
204
|
+
export type AstryxNode = AvatarNode | AvatarStatusDotNode | BadgeNode | ButtonNode | CardNode | DividerNode | HeadingNode | HStackNode | IconNode | ItemNode | ListItemNode | ProgressBarNode | SelectorNode | SwitchNode | TextNode | ThumbnailNode | TextInputNode | VStackNode;
|
|
193
205
|
/** A callback a native view called, sent back to the core. */
|
|
194
206
|
export type AstryxAction =
|
|
195
207
|
| {key: string; component: 'Avatar'; event: 'onClick'; args: []}
|
|
196
208
|
| {key: string; component: 'Button'; event: 'onClick'; args: []}
|
|
197
209
|
| {key: string; component: 'Item'; event: 'onClick'; args: []}
|
|
210
|
+
| {key: string; component: 'ListItem'; event: 'onClick'; args: []}
|
|
198
211
|
| {key: string; component: 'Selector'; event: 'onChange'; args: [string]}
|
|
199
212
|
| {key: string; component: 'Switch'; event: 'onChange'; args: [boolean]}
|
|
200
213
|
| {key: string; component: 'Thumbnail'; event: 'onRemove'; args: []}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astryxdesign/native",
|
|
3
|
-
"version": "0.7.6-canary.
|
|
3
|
+
"version": "0.7.6-canary.e3bd3d5",
|
|
4
4
|
"description": "Experimental native platforms for Astryx (iOS, Android, macOS, Windows) — published to npm only under the @canary dist-tag; never released as a stable (latest) version.",
|
|
5
5
|
"author": "Meta Open Source",
|
|
6
6
|
"license": "MIT",
|
|
@@ -70,10 +70,10 @@
|
|
|
70
70
|
}
|
|
71
71
|
},
|
|
72
72
|
"peerDependencies": {
|
|
73
|
-
"@astryxdesign/core": "0.7.6-canary.
|
|
73
|
+
"@astryxdesign/core": "0.7.6-canary.e3bd3d5"
|
|
74
74
|
},
|
|
75
75
|
"devDependencies": {
|
|
76
|
-
"@astryxdesign/core": "0.7.6-canary.
|
|
76
|
+
"@astryxdesign/core": "0.7.6-canary.e3bd3d5"
|
|
77
77
|
},
|
|
78
78
|
"scripts": {
|
|
79
79
|
"build": "node ../../scripts/clean-dist.mjs && tsc --project tsconfig.build.json && node scripts/generate.mjs --types",
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file components/ListItem.ts
|
|
5
|
+
* @input None
|
|
6
|
+
* @output What @astryxdesign/native adds to the core ListItem contract
|
|
7
|
+
* @position Native additions read by fromComponentDoc together with core's
|
|
8
|
+
* ListItem documentation
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import type {NativeAdditions} from '../contract/fromComponentDoc.js';
|
|
12
|
+
|
|
13
|
+
export const listItem: NativeAdditions = {
|
|
14
|
+
name: 'ListItem',
|
|
15
|
+
doc: {file: 'List/ListItem'},
|
|
16
|
+
baseTarget: 'root',
|
|
17
|
+
slots: {
|
|
18
|
+
label: 'text',
|
|
19
|
+
description: 'text',
|
|
20
|
+
startContent: 'content',
|
|
21
|
+
endContent: 'content',
|
|
22
|
+
},
|
|
23
|
+
callbacks: ['onClick'],
|
|
24
|
+
sameMeaning: {onClick: 'a press, as in Compose'},
|
|
25
|
+
webOnly: {
|
|
26
|
+
target: 'HTML link target',
|
|
27
|
+
rel: 'HTML link relationship',
|
|
28
|
+
swipeActions:
|
|
29
|
+
"a native platform's swipe actions work only inside its own scrolling list, so a row elsewhere could not honor them",
|
|
30
|
+
swipeBehavior: 'applies only with swipeActions',
|
|
31
|
+
},
|
|
32
|
+
};
|