@astryxdesign/native 0.7.6-canary.dfc83ee → 0.7.6-canary.e30ffbf
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/Package.swift +0 -2
- package/apple/README.md +18 -3
- package/apple/Sources/Astryx/Avatar/Avatar.swift +2 -9
- package/apple/Sources/Astryx/Base/SafeDestination.swift +48 -0
- package/apple/Sources/Astryx/Button/Button.swift +3 -21
- package/apple/Sources/Astryx/Item/Item.swift +354 -0
- package/apple/Sources/Astryx/Wire/AstryxNodeView.swift +9 -0
- package/apple/Sources/AstryxNative/Generated/AstryxNode.swift +3 -0
- package/apple/Sources/AstryxNative/Generated/Item.swift +173 -0
- package/apple/Tests/AstryxTests/ItemTests.swift +295 -0
- package/dist/components/Item.d.ts +10 -0
- package/dist/components/Item.d.ts.map +1 -0
- package/dist/components/Item.js +22 -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 +18 -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/Item.ts +34 -0
- package/src/components/index.ts +2 -0
- package/src/contract/contracts.test.ts +39 -0
- package/src/theme/swiftIOSTheme.test.ts +372 -38
- package/apple/Sources/Astryx/Avatar/Avatar.spec.md +0 -219
- package/apple/Sources/Astryx/Avatar/AvatarStatusDot.spec.md +0 -162
- package/apple/Sources/Astryx/Button/Button.spec.md +0 -174
- package/apple/Sources/Astryx/Icon/Icon.spec.md +0 -189
- package/apple/Sources/Astryx/TextInput/TextInput.spec.md +0 -179
- package/apple/Sources/Astryx/Thumbnail/Thumbnail.spec.md +0 -191
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, 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, 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';
|
|
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,9 @@ 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;
|
|
31
34
|
/** ProgressBar props: core contract plus the macos contract. */
|
|
32
35
|
export interface ProgressBarProps extends ProgressBarCoreProps {}
|
|
33
36
|
export declare function ProgressBar(props: ProgressBarProps): unknown;
|
|
@@ -118,6 +121,15 @@ export interface IconNode {
|
|
|
118
121
|
base?: AstryxSharedBaseProps;
|
|
119
122
|
props: {icon: IconName; color?: 'primary' | 'secondary' | 'tertiary' | 'disabled' | 'accent' | 'info' | 'success' | 'error' | 'warning' | 'inherit'; size?: 'xsm' | 'sm' | 'md' | 'lg'; label?: string;};
|
|
120
123
|
}
|
|
124
|
+
/** Item as JSON from a TypeScript core. */
|
|
125
|
+
export interface ItemNode {
|
|
126
|
+
component: 'Item';
|
|
127
|
+
key: string;
|
|
128
|
+
base?: AstryxSharedBaseProps;
|
|
129
|
+
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;};
|
|
130
|
+
/** The callbacks the core listens to. */
|
|
131
|
+
events?: ReadonlyArray<'onClick'>;
|
|
132
|
+
}
|
|
121
133
|
/** ProgressBar as JSON from a TypeScript core. */
|
|
122
134
|
export interface ProgressBarNode {
|
|
123
135
|
component: 'ProgressBar';
|
|
@@ -176,11 +188,12 @@ export interface VStackNode {
|
|
|
176
188
|
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
189
|
}
|
|
178
190
|
/** 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;
|
|
191
|
+
export type AstryxNode = AvatarNode | AvatarStatusDotNode | BadgeNode | ButtonNode | CardNode | DividerNode | HeadingNode | HStackNode | IconNode | ItemNode | ProgressBarNode | SelectorNode | SwitchNode | TextNode | ThumbnailNode | TextInputNode | VStackNode;
|
|
180
192
|
/** A callback a native view called, sent back to the core. */
|
|
181
193
|
export type AstryxAction =
|
|
182
194
|
| {key: string; component: 'Avatar'; event: 'onClick'; args: []}
|
|
183
195
|
| {key: string; component: 'Button'; event: 'onClick'; args: []}
|
|
196
|
+
| {key: string; component: 'Item'; event: 'onClick'; args: []}
|
|
184
197
|
| {key: string; component: 'Selector'; event: 'onChange'; args: [string]}
|
|
185
198
|
| {key: string; component: 'Switch'; event: 'onChange'; args: [boolean]}
|
|
186
199
|
| {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, 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, 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';
|
|
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,9 @@ 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;
|
|
31
34
|
/** ProgressBar props: core contract only. */
|
|
32
35
|
export interface ProgressBarProps extends ProgressBarCoreProps {}
|
|
33
36
|
export declare function ProgressBar(props: ProgressBarProps): unknown;
|
|
@@ -116,6 +119,15 @@ export interface IconNode {
|
|
|
116
119
|
base?: AstryxSharedBaseProps;
|
|
117
120
|
props: {icon: IconName; color?: 'primary' | 'secondary' | 'tertiary' | 'disabled' | 'accent' | 'info' | 'success' | 'error' | 'warning' | 'inherit'; size?: 'xsm' | 'sm' | 'md' | 'lg'; label?: string;};
|
|
118
121
|
}
|
|
122
|
+
/** Item as JSON from a TypeScript core. */
|
|
123
|
+
export interface ItemNode {
|
|
124
|
+
component: 'Item';
|
|
125
|
+
key: string;
|
|
126
|
+
base?: AstryxSharedBaseProps;
|
|
127
|
+
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;};
|
|
128
|
+
/** The callbacks the core listens to. */
|
|
129
|
+
events?: ReadonlyArray<'onClick'>;
|
|
130
|
+
}
|
|
119
131
|
/** ProgressBar as JSON from a TypeScript core. */
|
|
120
132
|
export interface ProgressBarNode {
|
|
121
133
|
component: 'ProgressBar';
|
|
@@ -174,11 +186,12 @@ export interface VStackNode {
|
|
|
174
186
|
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
187
|
}
|
|
176
188
|
/** 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;
|
|
189
|
+
export type AstryxNode = AvatarNode | AvatarStatusDotNode | BadgeNode | ButtonNode | CardNode | DividerNode | HeadingNode | HStackNode | IconNode | ItemNode | ProgressBarNode | SelectorNode | SwitchNode | TextNode | ThumbnailNode | TextInputNode | VStackNode;
|
|
178
190
|
/** A callback a native view called, sent back to the core. */
|
|
179
191
|
export type AstryxAction =
|
|
180
192
|
| {key: string; component: 'Avatar'; event: 'onClick'; args: []}
|
|
181
193
|
| {key: string; component: 'Button'; event: 'onClick'; args: []}
|
|
194
|
+
| {key: string; component: 'Item'; event: 'onClick'; args: []}
|
|
182
195
|
| {key: string; component: 'Selector'; event: 'onChange'; args: [string]}
|
|
183
196
|
| {key: string; component: 'Switch'; event: 'onChange'; args: [boolean]}
|
|
184
197
|
| {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, 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, 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';
|
|
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,9 @@ 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;
|
|
31
34
|
/** ProgressBar props: core contract plus the windows contract. */
|
|
32
35
|
export interface ProgressBarProps extends ProgressBarCoreProps {}
|
|
33
36
|
export declare function ProgressBar(props: ProgressBarProps): unknown;
|
|
@@ -119,6 +122,15 @@ export interface IconNode {
|
|
|
119
122
|
base?: AstryxSharedBaseProps;
|
|
120
123
|
props: {icon: IconName; color?: 'primary' | 'secondary' | 'tertiary' | 'disabled' | 'accent' | 'info' | 'success' | 'error' | 'warning' | 'inherit'; size?: 'xsm' | 'sm' | 'md' | 'lg'; label?: string;};
|
|
121
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
|
+
}
|
|
122
134
|
/** ProgressBar as JSON from a TypeScript core. */
|
|
123
135
|
export interface ProgressBarNode {
|
|
124
136
|
component: 'ProgressBar';
|
|
@@ -177,11 +189,12 @@ export interface VStackNode {
|
|
|
177
189
|
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
190
|
}
|
|
179
191
|
/** 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;
|
|
192
|
+
export type AstryxNode = AvatarNode | AvatarStatusDotNode | BadgeNode | ButtonNode | CardNode | DividerNode | HeadingNode | HStackNode | IconNode | ItemNode | ProgressBarNode | SelectorNode | SwitchNode | TextNode | ThumbnailNode | TextInputNode | VStackNode;
|
|
181
193
|
/** A callback a native view called, sent back to the core. */
|
|
182
194
|
export type AstryxAction =
|
|
183
195
|
| {key: string; component: 'Avatar'; event: 'onClick'; args: []}
|
|
184
196
|
| {key: string; component: 'Button'; event: 'onClick'; args: []}
|
|
197
|
+
| {key: string; component: 'Item'; event: 'onClick'; args: []}
|
|
185
198
|
| {key: string; component: 'Selector'; event: 'onChange'; args: [string]}
|
|
186
199
|
| {key: string; component: 'Switch'; event: 'onChange'; args: [boolean]}
|
|
187
200
|
| {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.e30ffbf",
|
|
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.e30ffbf"
|
|
74
74
|
},
|
|
75
75
|
"devDependencies": {
|
|
76
|
-
"@astryxdesign/core": "0.7.6-canary.
|
|
76
|
+
"@astryxdesign/core": "0.7.6-canary.e30ffbf"
|
|
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
|
+
};
|
package/src/components/index.ts
CHANGED
|
@@ -18,6 +18,7 @@ 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';
|
|
21
22
|
import {progressBar} from './ProgressBar.js';
|
|
22
23
|
import {selector} from './Selector.js';
|
|
23
24
|
import {switchControl} from './Switch.js';
|
|
@@ -36,6 +37,7 @@ export const NATIVE_COMPONENTS: readonly NativeAdditions[] = [
|
|
|
36
37
|
heading,
|
|
37
38
|
hStack,
|
|
38
39
|
icon,
|
|
40
|
+
item,
|
|
39
41
|
progressBar,
|
|
40
42
|
selector,
|
|
41
43
|
switchControl,
|
|
@@ -207,6 +207,45 @@ 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
|
+
|
|
210
249
|
it('reports naming and portability errors', () => {
|
|
211
250
|
const bad: ComponentContract = {
|
|
212
251
|
name: 'Bad',
|