@astryxdesign/native 0.7.6-canary.eae71cb → 0.7.6-canary.eb282ba

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 (33) hide show
  1. package/apple/README.md +13 -0
  2. package/apple/Sources/Astryx/Avatar/Avatar.swift +9 -12
  3. package/apple/Sources/Astryx/Base/SafeDestination.swift +48 -0
  4. package/apple/Sources/Astryx/Button/Button.swift +3 -21
  5. package/apple/Sources/Astryx/Item/Item.swift +446 -0
  6. package/apple/Sources/Astryx/List/ListItem.swift +255 -0
  7. package/apple/Sources/Astryx/Wire/AstryxNodeView.swift +16 -0
  8. package/apple/Sources/AstryxNative/Generated/AstryxNode.swift +6 -0
  9. package/apple/Sources/AstryxNative/Generated/Item.swift +173 -0
  10. package/apple/Sources/AstryxNative/Generated/ListItem.swift +122 -0
  11. package/apple/Tests/AstryxTests/AvatarTests.swift +14 -0
  12. package/apple/Tests/AstryxTests/ItemTests.swift +295 -0
  13. package/apple/Tests/AstryxTests/ListItemTests.swift +234 -0
  14. package/dist/components/Item.d.ts +10 -0
  15. package/dist/components/Item.d.ts.map +1 -0
  16. package/dist/components/Item.js +22 -0
  17. package/dist/components/ListItem.d.ts +10 -0
  18. package/dist/components/ListItem.d.ts.map +1 -0
  19. package/dist/components/ListItem.js +20 -0
  20. package/dist/components/index.d.ts.map +1 -1
  21. package/dist/components/index.js +4 -0
  22. package/dist/types/android.d.ts +29 -3
  23. package/dist/types/core.d.ts +30 -0
  24. package/dist/types/ios.d.ts +29 -3
  25. package/dist/types/macos.d.ts +29 -3
  26. package/dist/types/shared.d.ts +29 -3
  27. package/dist/types/windows.d.ts +29 -3
  28. package/package.json +3 -3
  29. package/src/components/Item.ts +34 -0
  30. package/src/components/ListItem.ts +32 -0
  31. package/src/components/index.ts +4 -0
  32. package/src/contract/contracts.test.ts +60 -0
  33. package/src/theme/swiftIOSTheme.test.ts +372 -38
@@ -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, 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, 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;
@@ -28,6 +28,12 @@ export declare function HStack(props: HStackProps): unknown;
28
28
  /** Icon props: core contract plus the android contract. */
29
29
  export interface IconProps extends IconCoreProps {}
30
30
  export declare function Icon(props: IconProps): unknown;
31
+ /** Item props: core contract plus the android contract. */
32
+ export interface ItemProps extends ItemCoreProps {}
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;
31
37
  /** ProgressBar props: core contract plus the android contract. */
32
38
  export interface ProgressBarProps extends ProgressBarCoreProps {}
33
39
  export declare function ProgressBar(props: ProgressBarProps): unknown;
@@ -121,6 +127,24 @@ export interface IconNode {
121
127
  base?: AstryxSharedBaseProps;
122
128
  props: {icon: IconName; color?: 'primary' | 'secondary' | 'tertiary' | 'disabled' | 'accent' | 'info' | 'success' | 'error' | 'warning' | 'inherit'; size?: 'xsm' | 'sm' | 'md' | 'lg'; label?: string;};
123
129
  }
130
+ /** Item as JSON from a TypeScript core. */
131
+ export interface ItemNode {
132
+ component: 'Item';
133
+ key: string;
134
+ base?: AstryxSharedBaseProps;
135
+ props: {label: string; marker?: ReadonlyArray<AstryxNode>; startContent?: ReadonlyArray<AstryxNode>; description?: string; endContent?: ReadonlyArray<AstryxNode>; align?: 'center' | 'start' | 'first-line'; density?: 'compact' | 'balanced' | 'spacious'; labelLines?: number; descriptionLines?: number; layout?: 'stacked' | 'inline'; href?: string; isHighlighted?: boolean; isSelected?: boolean; isDisabled?: boolean;};
136
+ /** The callbacks the core listens to. */
137
+ events?: ReadonlyArray<'onClick'>;
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
+ }
124
148
  /** ProgressBar as JSON from a TypeScript core. */
125
149
  export interface ProgressBarNode {
126
150
  component: 'ProgressBar';
@@ -179,11 +203,13 @@ export interface VStackNode {
179
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>;};
180
204
  }
181
205
  /** Any Astryx component a TypeScript core can send. */
182
- export type AstryxNode = AvatarNode | AvatarStatusDotNode | BadgeNode | ButtonNode | CardNode | DividerNode | HeadingNode | HStackNode | IconNode | 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;
183
207
  /** A callback a native view called, sent back to the core. */
184
208
  export type AstryxAction =
185
209
  | {key: string; component: 'Avatar'; event: 'onClick'; args: []}
186
210
  | {key: string; component: 'Button'; event: 'onClick'; args: []}
211
+ | {key: string; component: 'Item'; event: 'onClick'; args: []}
212
+ | {key: string; component: 'ListItem'; event: 'onClick'; args: []}
187
213
  | {key: string; component: 'Selector'; event: 'onChange'; args: [string]}
188
214
  | {key: string; component: 'Switch'; event: 'onChange'; args: [boolean]}
189
215
  | {key: string; component: 'Thumbnail'; event: 'onRemove'; args: []}
@@ -105,6 +105,36 @@ export interface IconCoreProps extends AstryxSharedBaseProps {
105
105
  label?: string;
106
106
  }
107
107
  /** Core contract. Base props attach to the root. */
108
+ export interface ItemCoreProps extends AstryxSharedBaseProps {
109
+ label: string;
110
+ marker?: ReadonlyArray<AstryxContentNode>;
111
+ startContent?: ReadonlyArray<AstryxContentNode>;
112
+ description?: string;
113
+ endContent?: ReadonlyArray<AstryxContentNode>;
114
+ align?: 'center' | 'start' | 'first-line';
115
+ density?: 'compact' | 'balanced' | 'spacious';
116
+ labelLines?: number;
117
+ descriptionLines?: number;
118
+ layout?: 'stacked' | 'inline';
119
+ onClick?: () => void;
120
+ href?: string;
121
+ isHighlighted?: boolean;
122
+ isSelected?: boolean;
123
+ isDisabled?: boolean;
124
+ }
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. */
108
138
  export interface ProgressBarCoreProps extends AstryxSharedBaseProps {
109
139
  label: string;
110
140
  value?: number;
@@ -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, 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, 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;
@@ -28,6 +28,12 @@ export declare function HStack(props: HStackProps): unknown;
28
28
  /** Icon props: core contract plus the ios contract. */
29
29
  export interface IconProps extends IconCoreProps {}
30
30
  export declare function Icon(props: IconProps): unknown;
31
+ /** Item props: core contract plus the ios contract. */
32
+ export interface ItemProps extends ItemCoreProps {}
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;
31
37
  /** ProgressBar props: core contract plus the ios contract. */
32
38
  export interface ProgressBarProps extends ProgressBarCoreProps {}
33
39
  export declare function ProgressBar(props: ProgressBarProps): unknown;
@@ -118,6 +124,24 @@ export interface IconNode {
118
124
  base?: AstryxSharedBaseProps;
119
125
  props: {icon: IconName; color?: 'primary' | 'secondary' | 'tertiary' | 'disabled' | 'accent' | 'info' | 'success' | 'error' | 'warning' | 'inherit'; size?: 'xsm' | 'sm' | 'md' | 'lg'; label?: string;};
120
126
  }
127
+ /** Item as JSON from a TypeScript core. */
128
+ export interface ItemNode {
129
+ component: 'Item';
130
+ key: string;
131
+ base?: AstryxSharedBaseProps;
132
+ props: {label: string; marker?: ReadonlyArray<AstryxNode>; startContent?: ReadonlyArray<AstryxNode>; description?: string; endContent?: ReadonlyArray<AstryxNode>; align?: 'center' | 'start' | 'first-line'; density?: 'compact' | 'balanced' | 'spacious'; labelLines?: number; descriptionLines?: number; layout?: 'stacked' | 'inline'; href?: string; isHighlighted?: boolean; isSelected?: boolean; isDisabled?: boolean;};
133
+ /** The callbacks the core listens to. */
134
+ events?: ReadonlyArray<'onClick'>;
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
+ }
121
145
  /** ProgressBar as JSON from a TypeScript core. */
122
146
  export interface ProgressBarNode {
123
147
  component: 'ProgressBar';
@@ -176,11 +200,13 @@ export interface VStackNode {
176
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>;};
177
201
  }
178
202
  /** Any Astryx component a TypeScript core can send. */
179
- export type AstryxNode = AvatarNode | AvatarStatusDotNode | BadgeNode | ButtonNode | CardNode | DividerNode | HeadingNode | HStackNode | IconNode | 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;
180
204
  /** A callback a native view called, sent back to the core. */
181
205
  export type AstryxAction =
182
206
  | {key: string; component: 'Avatar'; event: 'onClick'; args: []}
183
207
  | {key: string; component: 'Button'; event: 'onClick'; args: []}
208
+ | {key: string; component: 'Item'; event: 'onClick'; args: []}
209
+ | {key: string; component: 'ListItem'; event: 'onClick'; args: []}
184
210
  | {key: string; component: 'Selector'; event: 'onChange'; args: [string]}
185
211
  | {key: string; component: 'Switch'; event: 'onChange'; args: [boolean]}
186
212
  | {key: string; component: 'Thumbnail'; event: 'onRemove'; args: []}
@@ -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, 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, 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;
@@ -28,6 +28,12 @@ export declare function HStack(props: HStackProps): unknown;
28
28
  /** Icon props: core contract plus the macos contract. */
29
29
  export interface IconProps extends IconCoreProps {}
30
30
  export declare function Icon(props: IconProps): unknown;
31
+ /** Item props: core contract plus the macos contract. */
32
+ export interface ItemProps extends ItemCoreProps {}
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;
31
37
  /** ProgressBar props: core contract plus the macos contract. */
32
38
  export interface ProgressBarProps extends ProgressBarCoreProps {}
33
39
  export declare function ProgressBar(props: ProgressBarProps): unknown;
@@ -118,6 +124,24 @@ export interface IconNode {
118
124
  base?: AstryxSharedBaseProps;
119
125
  props: {icon: IconName; color?: 'primary' | 'secondary' | 'tertiary' | 'disabled' | 'accent' | 'info' | 'success' | 'error' | 'warning' | 'inherit'; size?: 'xsm' | 'sm' | 'md' | 'lg'; label?: string;};
120
126
  }
127
+ /** Item as JSON from a TypeScript core. */
128
+ export interface ItemNode {
129
+ component: 'Item';
130
+ key: string;
131
+ base?: AstryxSharedBaseProps;
132
+ props: {label: string; marker?: ReadonlyArray<AstryxNode>; startContent?: ReadonlyArray<AstryxNode>; description?: string; endContent?: ReadonlyArray<AstryxNode>; align?: 'center' | 'start' | 'first-line'; density?: 'compact' | 'balanced' | 'spacious'; labelLines?: number; descriptionLines?: number; layout?: 'stacked' | 'inline'; href?: string; isHighlighted?: boolean; isSelected?: boolean; isDisabled?: boolean;};
133
+ /** The callbacks the core listens to. */
134
+ events?: ReadonlyArray<'onClick'>;
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
+ }
121
145
  /** ProgressBar as JSON from a TypeScript core. */
122
146
  export interface ProgressBarNode {
123
147
  component: 'ProgressBar';
@@ -176,11 +200,13 @@ export interface VStackNode {
176
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>;};
177
201
  }
178
202
  /** Any Astryx component a TypeScript core can send. */
179
- export type AstryxNode = AvatarNode | AvatarStatusDotNode | BadgeNode | ButtonNode | CardNode | DividerNode | HeadingNode | HStackNode | IconNode | 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;
180
204
  /** A callback a native view called, sent back to the core. */
181
205
  export type AstryxAction =
182
206
  | {key: string; component: 'Avatar'; event: 'onClick'; args: []}
183
207
  | {key: string; component: 'Button'; event: 'onClick'; args: []}
208
+ | {key: string; component: 'Item'; event: 'onClick'; args: []}
209
+ | {key: string; component: 'ListItem'; event: 'onClick'; args: []}
184
210
  | {key: string; component: 'Selector'; event: 'onChange'; args: [string]}
185
211
  | {key: string; component: 'Switch'; event: 'onChange'; args: [boolean]}
186
212
  | {key: string; component: 'Thumbnail'; event: 'onRemove'; args: []}
@@ -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, 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, 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;
@@ -28,6 +28,12 @@ export declare function HStack(props: HStackProps): unknown;
28
28
  /** Icon props: core contract only. */
29
29
  export interface IconProps extends IconCoreProps {}
30
30
  export declare function Icon(props: IconProps): unknown;
31
+ /** Item props: core contract only. */
32
+ export interface ItemProps extends ItemCoreProps {}
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;
31
37
  /** ProgressBar props: core contract only. */
32
38
  export interface ProgressBarProps extends ProgressBarCoreProps {}
33
39
  export declare function ProgressBar(props: ProgressBarProps): unknown;
@@ -116,6 +122,24 @@ export interface IconNode {
116
122
  base?: AstryxSharedBaseProps;
117
123
  props: {icon: IconName; color?: 'primary' | 'secondary' | 'tertiary' | 'disabled' | 'accent' | 'info' | 'success' | 'error' | 'warning' | 'inherit'; size?: 'xsm' | 'sm' | 'md' | 'lg'; label?: string;};
118
124
  }
125
+ /** Item as JSON from a TypeScript core. */
126
+ export interface ItemNode {
127
+ component: 'Item';
128
+ key: string;
129
+ base?: AstryxSharedBaseProps;
130
+ props: {label: string; marker?: ReadonlyArray<AstryxNode>; startContent?: ReadonlyArray<AstryxNode>; description?: string; endContent?: ReadonlyArray<AstryxNode>; align?: 'center' | 'start' | 'first-line'; density?: 'compact' | 'balanced' | 'spacious'; labelLines?: number; descriptionLines?: number; layout?: 'stacked' | 'inline'; href?: string; isHighlighted?: boolean; isSelected?: boolean; isDisabled?: boolean;};
131
+ /** The callbacks the core listens to. */
132
+ events?: ReadonlyArray<'onClick'>;
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
+ }
119
143
  /** ProgressBar as JSON from a TypeScript core. */
120
144
  export interface ProgressBarNode {
121
145
  component: 'ProgressBar';
@@ -174,11 +198,13 @@ export interface VStackNode {
174
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>;};
175
199
  }
176
200
  /** Any Astryx component a TypeScript core can send. */
177
- export type AstryxNode = AvatarNode | AvatarStatusDotNode | BadgeNode | ButtonNode | CardNode | DividerNode | HeadingNode | HStackNode | IconNode | 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;
178
202
  /** A callback a native view called, sent back to the core. */
179
203
  export type AstryxAction =
180
204
  | {key: string; component: 'Avatar'; event: 'onClick'; args: []}
181
205
  | {key: string; component: 'Button'; event: 'onClick'; args: []}
206
+ | {key: string; component: 'Item'; event: 'onClick'; args: []}
207
+ | {key: string; component: 'ListItem'; event: 'onClick'; args: []}
182
208
  | {key: string; component: 'Selector'; event: 'onChange'; args: [string]}
183
209
  | {key: string; component: 'Switch'; event: 'onChange'; args: [boolean]}
184
210
  | {key: string; component: 'Thumbnail'; event: 'onRemove'; args: []}
@@ -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, 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, 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;
@@ -28,6 +28,12 @@ export declare function HStack(props: HStackProps): unknown;
28
28
  /** Icon props: core contract plus the windows contract. */
29
29
  export interface IconProps extends IconCoreProps {}
30
30
  export declare function Icon(props: IconProps): unknown;
31
+ /** Item props: core contract plus the windows contract. */
32
+ export interface ItemProps extends ItemCoreProps {}
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;
31
37
  /** ProgressBar props: core contract plus the windows contract. */
32
38
  export interface ProgressBarProps extends ProgressBarCoreProps {}
33
39
  export declare function ProgressBar(props: ProgressBarProps): unknown;
@@ -119,6 +125,24 @@ export interface IconNode {
119
125
  base?: AstryxSharedBaseProps;
120
126
  props: {icon: IconName; color?: 'primary' | 'secondary' | 'tertiary' | 'disabled' | 'accent' | 'info' | 'success' | 'error' | 'warning' | 'inherit'; size?: 'xsm' | 'sm' | 'md' | 'lg'; label?: string;};
121
127
  }
128
+ /** Item as JSON from a TypeScript core. */
129
+ export interface ItemNode {
130
+ component: 'Item';
131
+ key: string;
132
+ base?: AstryxSharedBaseProps;
133
+ props: {label: string; marker?: ReadonlyArray<AstryxNode>; startContent?: ReadonlyArray<AstryxNode>; description?: string; endContent?: ReadonlyArray<AstryxNode>; align?: 'center' | 'start' | 'first-line'; density?: 'compact' | 'balanced' | 'spacious'; labelLines?: number; descriptionLines?: number; layout?: 'stacked' | 'inline'; href?: string; isHighlighted?: boolean; isSelected?: boolean; isDisabled?: boolean;};
134
+ /** The callbacks the core listens to. */
135
+ events?: ReadonlyArray<'onClick'>;
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
+ }
122
146
  /** ProgressBar as JSON from a TypeScript core. */
123
147
  export interface ProgressBarNode {
124
148
  component: 'ProgressBar';
@@ -177,11 +201,13 @@ export interface VStackNode {
177
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>;};
178
202
  }
179
203
  /** Any Astryx component a TypeScript core can send. */
180
- export type AstryxNode = AvatarNode | AvatarStatusDotNode | BadgeNode | ButtonNode | CardNode | DividerNode | HeadingNode | HStackNode | IconNode | 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;
181
205
  /** A callback a native view called, sent back to the core. */
182
206
  export type AstryxAction =
183
207
  | {key: string; component: 'Avatar'; event: 'onClick'; args: []}
184
208
  | {key: string; component: 'Button'; event: 'onClick'; args: []}
209
+ | {key: string; component: 'Item'; event: 'onClick'; args: []}
210
+ | {key: string; component: 'ListItem'; event: 'onClick'; args: []}
185
211
  | {key: string; component: 'Selector'; event: 'onChange'; args: [string]}
186
212
  | {key: string; component: 'Switch'; event: 'onChange'; args: [boolean]}
187
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.eae71cb",
3
+ "version": "0.7.6-canary.eb282ba",
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.eae71cb"
73
+ "@astryxdesign/core": "0.7.6-canary.eb282ba"
74
74
  },
75
75
  "devDependencies": {
76
- "@astryxdesign/core": "0.7.6-canary.eae71cb"
76
+ "@astryxdesign/core": "0.7.6-canary.eb282ba"
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,34 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /**
4
+ * @file components/Item.ts
5
+ * @input None
6
+ * @output What @astryxdesign/native adds to the core Item contract
7
+ * @position Native additions read by fromComponentDoc together with core's
8
+ * Item documentation
9
+ */
10
+
11
+ import type {NativeAdditions} from '../contract/fromComponentDoc.js';
12
+
13
+ export const item: NativeAdditions = {
14
+ name: 'Item',
15
+ doc: {file: 'Item/Item', component: 'Item'},
16
+ baseTarget: 'root',
17
+ slots: {
18
+ label: 'text',
19
+ description: 'text',
20
+ marker: 'content',
21
+ startContent: 'content',
22
+ endContent: 'content',
23
+ },
24
+ callbacks: ['onClick'],
25
+ sameMeaning: {onClick: 'a press, as in Compose'},
26
+ webOnly: {
27
+ target: 'HTML link target',
28
+ rel: 'HTML link relationship',
29
+ 'data-testid': 'web test selector; native platforms use the base id',
30
+ swipeActions:
31
+ "a native platform's swipe actions work only inside its own scrolling list, so a row elsewhere could not honor them",
32
+ swipeBehavior: 'applies only with swipeActions',
33
+ },
34
+ };
@@ -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
+ };
@@ -18,6 +18,8 @@ import {divider} from './Divider.js';
18
18
  import {heading} from './Heading.js';
19
19
  import {hStack} from './HStack.js';
20
20
  import {icon} from './Icon.js';
21
+ import {item} from './Item.js';
22
+ import {listItem} from './ListItem.js';
21
23
  import {progressBar} from './ProgressBar.js';
22
24
  import {selector} from './Selector.js';
23
25
  import {switchControl} from './Switch.js';
@@ -36,6 +38,8 @@ export const NATIVE_COMPONENTS: readonly NativeAdditions[] = [
36
38
  heading,
37
39
  hStack,
38
40
  icon,
41
+ item,
42
+ listItem,
39
43
  progressBar,
40
44
  selector,
41
45
  switchControl,
@@ -207,6 +207,66 @@ describe('native contracts', () => {
207
207
  );
208
208
  });
209
209
 
210
+ it('gives Item typed text and content slots, a press, and a link, and leaves swipes on the web', async () => {
211
+ const {contracts} = await buildContracts(loadCoreDoc);
212
+ const item = contracts.find(contract => contract.name === 'Item');
213
+ expect(item).toBeDefined();
214
+ expect(item!.core.label).toMatchObject({
215
+ type: {kind: 'string'},
216
+ optional: false,
217
+ });
218
+ expect(item!.core.description?.type).toEqual({kind: 'string'});
219
+ for (const slot of ['marker', 'startContent', 'endContent']) {
220
+ expect(item!.core[slot]?.type).toEqual({kind: 'content'});
221
+ }
222
+ expect(Object.keys(item!.core)).toEqual(
223
+ expect.arrayContaining([
224
+ 'align',
225
+ 'density',
226
+ 'labelLines',
227
+ 'descriptionLines',
228
+ 'layout',
229
+ 'onClick',
230
+ 'href',
231
+ 'isHighlighted',
232
+ 'isSelected',
233
+ 'isDisabled',
234
+ ]),
235
+ );
236
+ expect(item!.webOnly.map(prop => prop.name)).toEqual(
237
+ expect.arrayContaining([
238
+ 'swipeActions',
239
+ 'swipeBehavior',
240
+ 'target',
241
+ 'rel',
242
+ 'data-testid',
243
+ 'as',
244
+ 'interactiveRef',
245
+ ]),
246
+ );
247
+ });
248
+
249
+ it('gives ListItem the row contract without density or markers, which come from its list', async () => {
250
+ const {contracts} = await buildContracts(loadCoreDoc);
251
+ const row = contracts.find(contract => contract.name === 'ListItem');
252
+ expect(row).toBeDefined();
253
+ expect(row!.core.label).toMatchObject({
254
+ type: {kind: 'string'},
255
+ optional: false,
256
+ });
257
+ expect(row!.core.startContent?.type).toEqual({kind: 'content'});
258
+ expect(Object.keys(row!.core)).not.toContain('density');
259
+ expect(row!.webOnly.map(prop => prop.name)).toEqual(
260
+ expect.arrayContaining([
261
+ 'swipeActions',
262
+ 'swipeBehavior',
263
+ 'target',
264
+ 'rel',
265
+ 'interactiveRef',
266
+ ]),
267
+ );
268
+ });
269
+
210
270
  it('reports naming and portability errors', () => {
211
271
  const bad: ComponentContract = {
212
272
  name: 'Bad',