@astryxdesign/native 0.0.0-bootstrap.1 → 0.7.4-canary.720bb10
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/LICENSE +21 -0
- package/README.md +119 -1
- package/apple/Package.swift +18 -0
- package/apple/Sources/AstryxNative/Generated/AstryxBase.swift +12 -0
- package/apple/Sources/AstryxNative/Generated/Selector.swift +159 -0
- package/apple/Tests/AstryxNativeTests/SelectorPropsTests.swift +17 -0
- package/dist/components/Selector.d.ts +10 -0
- package/dist/components/Selector.d.ts.map +1 -0
- package/dist/components/Selector.js +38 -0
- package/dist/components/index.d.ts +10 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +3 -0
- package/dist/contract/fromComponentDoc.d.ts +32 -0
- package/dist/contract/fromComponentDoc.d.ts.map +1 -0
- package/dist/contract/fromComponentDoc.js +81 -0
- package/dist/contract/generateSwift.d.ts +4 -0
- package/dist/contract/generateSwift.d.ts.map +1 -0
- package/dist/contract/generateSwift.js +133 -0
- package/dist/contract/generateTypeScript.d.ts +4 -0
- package/dist/contract/generateTypeScript.d.ts.map +1 -0
- package/dist/contract/generateTypeScript.js +87 -0
- package/dist/contract/index.d.ts +20 -0
- package/dist/contract/index.d.ts.map +1 -0
- package/dist/contract/index.js +33 -0
- package/dist/contract/names.d.ts +20 -0
- package/dist/contract/names.d.ts.map +1 -0
- package/dist/contract/names.js +90 -0
- package/dist/contract/parseDocType.d.ts +22 -0
- package/dist/contract/parseDocType.d.ts.map +1 -0
- package/dist/contract/parseDocType.js +183 -0
- package/dist/contract/rules.d.ts +10 -0
- package/dist/contract/rules.d.ts.map +1 -0
- package/dist/contract/rules.js +87 -0
- package/dist/contract/types.d.ts +57 -0
- package/dist/contract/types.d.ts.map +1 -0
- package/dist/contract/types.js +2 -0
- package/dist/icons/defaults.d.ts +25 -0
- package/dist/icons/defaults.d.ts.map +1 -0
- package/dist/icons/defaults.js +111 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +12 -0
- package/dist/platforms.d.ts +13 -0
- package/dist/platforms.d.ts.map +1 -0
- package/dist/platforms.js +14 -0
- package/dist/theme/defineNativeTheme.d.ts +75 -0
- package/dist/theme/defineNativeTheme.d.ts.map +1 -0
- package/dist/theme/defineNativeTheme.js +126 -0
- package/dist/types/android.d.ts +8 -0
- package/dist/types/core.d.ts +35 -0
- package/dist/types/ios.d.ts +8 -0
- package/dist/types/macos.d.ts +8 -0
- package/dist/types/shared.d.ts +6 -0
- package/dist/types/windows.d.ts +6 -0
- package/package.json +72 -5
- package/src/components/Selector.ts +50 -0
- package/src/components/index.ts +14 -0
- package/src/contract/contracts.test.ts +150 -0
- package/src/contract/fromComponentDoc.ts +131 -0
- package/src/contract/generateSwift.ts +170 -0
- package/src/contract/generateTypeScript.ts +115 -0
- package/src/contract/index.ts +53 -0
- package/src/contract/names.ts +103 -0
- package/src/contract/parseDocType.test.ts +52 -0
- package/src/contract/parseDocType.ts +211 -0
- package/src/contract/rules.ts +132 -0
- package/src/contract/types.ts +52 -0
- package/src/icons/defaults.test.ts +47 -0
- package/src/icons/defaults.ts +136 -0
- package/src/index.ts +35 -0
- package/src/platforms.ts +20 -0
- package/src/theme/defineNativeTheme.test.ts +88 -0
- package/src/theme/defineNativeTheme.ts +224 -0
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
/**
|
|
3
|
+
* @file contract/rules.ts
|
|
4
|
+
* @input A component contract
|
|
5
|
+
* @output Naming and portability issues under AST-082 FR4 and FR8
|
|
6
|
+
* @position Run by the generator before it writes any binding; an error stops
|
|
7
|
+
* generation
|
|
8
|
+
*/
|
|
9
|
+
import { NATIVE_PLATFORMS } from '../platforms.js';
|
|
10
|
+
import { KOTLIN_KEYWORDS, RECLAIMED, SWIFT_KEYWORDS, TOOLKIT_NAMES, } from './names.js';
|
|
11
|
+
/** Why a core prop name is not allowed, or null when it is. */
|
|
12
|
+
export function coreNameProblem(name) {
|
|
13
|
+
if (SWIFT_KEYWORDS.has(name)) {
|
|
14
|
+
return `"${name}" is a Swift keyword`;
|
|
15
|
+
}
|
|
16
|
+
if (KOTLIN_KEYWORDS.has(name)) {
|
|
17
|
+
return `"${name}" is a Kotlin keyword`;
|
|
18
|
+
}
|
|
19
|
+
if (RECLAIMED.has(name)) {
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
for (const [toolkit, names] of Object.entries(TOOLKIT_NAMES)) {
|
|
23
|
+
if (names.has(name)) {
|
|
24
|
+
return `"${name}" already means something else in ${toolkit}`;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
function namedTypesIn(type, into) {
|
|
30
|
+
if (type.kind === 'named') {
|
|
31
|
+
into.add(type.name);
|
|
32
|
+
}
|
|
33
|
+
else if (type.kind === 'array') {
|
|
34
|
+
namedTypesIn(type.of, into);
|
|
35
|
+
}
|
|
36
|
+
else if (type.kind === 'fn') {
|
|
37
|
+
type.args.forEach(arg => namedTypesIn(arg, into));
|
|
38
|
+
}
|
|
39
|
+
else if (type.kind === 'record') {
|
|
40
|
+
Object.values(type.fields).forEach(field => namedTypesIn(field.type, into));
|
|
41
|
+
}
|
|
42
|
+
return into;
|
|
43
|
+
}
|
|
44
|
+
export function checkContract(contract) {
|
|
45
|
+
const issues = [];
|
|
46
|
+
const add = (level, rule, message) => issues.push({ level, rule, message: `${contract.name}: ${message}` });
|
|
47
|
+
const referenced = new Set();
|
|
48
|
+
const collect = (props) => Object.values(props).forEach(spec => namedTypesIn(spec.type, referenced));
|
|
49
|
+
for (const name of Object.keys(contract.core)) {
|
|
50
|
+
const problem = coreNameProblem(name);
|
|
51
|
+
if (problem) {
|
|
52
|
+
add('error', SWIFT_KEYWORDS.has(name) || KOTLIN_KEYWORDS.has(name)
|
|
53
|
+
? 'name-keyword'
|
|
54
|
+
: 'name-toolkit', `core prop ${problem}`);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
collect(contract.core);
|
|
58
|
+
const seen = new Map();
|
|
59
|
+
for (const platform of NATIVE_PLATFORMS) {
|
|
60
|
+
const props = contract.platforms[platform] ?? {};
|
|
61
|
+
collect(props);
|
|
62
|
+
for (const [name, spec] of Object.entries(props)) {
|
|
63
|
+
if (name in contract.core) {
|
|
64
|
+
add('error', 'platform-shadows-core', `${platform} prop "${name}" reuses a core prop name`);
|
|
65
|
+
}
|
|
66
|
+
if (SWIFT_KEYWORDS.has(name) || KOTLIN_KEYWORDS.has(name)) {
|
|
67
|
+
add('error', 'name-keyword', `${platform} prop "${name}" is a Swift or Kotlin keyword`);
|
|
68
|
+
}
|
|
69
|
+
const type = JSON.stringify(spec.type);
|
|
70
|
+
const earlier = seen.get(name);
|
|
71
|
+
if (earlier && earlier.type !== type) {
|
|
72
|
+
add('warning', 'same-name-different-meaning', `"${name}" has different values on ${earlier.platform} and ${platform}; ` +
|
|
73
|
+
'allowed in platform-scoped types, never in a merged type');
|
|
74
|
+
}
|
|
75
|
+
if (!earlier) {
|
|
76
|
+
seen.set(name, { platform, type });
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
Object.values(contract.types).forEach(collect);
|
|
81
|
+
for (const name of referenced) {
|
|
82
|
+
if (!(name in contract.types)) {
|
|
83
|
+
add('error', 'unknown-type', `type "${name}" has no definition`);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return issues;
|
|
87
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file contract/types.ts
|
|
3
|
+
* @input None (pure type definitions)
|
|
4
|
+
* @output The contract model: portable prop types, prop specs, and component contracts
|
|
5
|
+
* @position Foundation of the contract generator; parseDocType produces these,
|
|
6
|
+
* generators consume them
|
|
7
|
+
*/
|
|
8
|
+
import type { NativePlatform } from '../platforms.js';
|
|
9
|
+
/** A prop type every supported platform language can express (AST-082 FR4). */
|
|
10
|
+
export type PropType = {
|
|
11
|
+
kind: 'string';
|
|
12
|
+
} | {
|
|
13
|
+
kind: 'number';
|
|
14
|
+
} | {
|
|
15
|
+
kind: 'boolean';
|
|
16
|
+
} | {
|
|
17
|
+
kind: 'enum';
|
|
18
|
+
values: readonly string[];
|
|
19
|
+
} | {
|
|
20
|
+
kind: 'array';
|
|
21
|
+
of: PropType;
|
|
22
|
+
} | {
|
|
23
|
+
kind: 'record';
|
|
24
|
+
fields: Readonly<Record<string, PropSpec>>;
|
|
25
|
+
} | {
|
|
26
|
+
kind: 'fn';
|
|
27
|
+
args: readonly PropType[];
|
|
28
|
+
} | {
|
|
29
|
+
kind: 'named';
|
|
30
|
+
name: string;
|
|
31
|
+
};
|
|
32
|
+
export interface PropSpec {
|
|
33
|
+
readonly type: PropType;
|
|
34
|
+
readonly optional?: boolean;
|
|
35
|
+
readonly doc?: string;
|
|
36
|
+
}
|
|
37
|
+
export type PropMap = Readonly<Record<string, PropSpec>>;
|
|
38
|
+
/** The part of a component its base props attach to (AST-082 FR7). */
|
|
39
|
+
export type BaseTarget = 'root' | 'trigger' | 'control' | 'container';
|
|
40
|
+
/** A web prop left out of the core contract, with the reason. */
|
|
41
|
+
export interface WebOnlyProp {
|
|
42
|
+
readonly name: string;
|
|
43
|
+
readonly reason: string;
|
|
44
|
+
}
|
|
45
|
+
export interface ComponentContract {
|
|
46
|
+
readonly name: string;
|
|
47
|
+
readonly baseTarget: BaseTarget;
|
|
48
|
+
/** Named record types the contract references, such as an option shape. */
|
|
49
|
+
readonly types: Readonly<Record<string, PropMap>>;
|
|
50
|
+
/** Shared on every platform that offers the component. */
|
|
51
|
+
readonly core: PropMap;
|
|
52
|
+
/** Added per native platform; never removes or renames a core prop. */
|
|
53
|
+
readonly platforms: Readonly<Partial<Record<NativePlatform, PropMap>>>;
|
|
54
|
+
/** Core-doc props that stay in the web contract. */
|
|
55
|
+
readonly webOnly: readonly WebOnlyProp[];
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/contract/types.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,iBAAiB,CAAC;AAEpD,+EAA+E;AAC/E,MAAM,MAAM,QAAQ,GAChB;IAAC,IAAI,EAAE,QAAQ,CAAA;CAAC,GAChB;IAAC,IAAI,EAAE,QAAQ,CAAA;CAAC,GAChB;IAAC,IAAI,EAAE,SAAS,CAAA;CAAC,GACjB;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAA;CAAC,GACzC;IAAC,IAAI,EAAE,OAAO,CAAC;IAAC,EAAE,EAAE,QAAQ,CAAA;CAAC,GAC7B;IAAC,IAAI,EAAE,QAAQ,CAAC;IAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAA;CAAC,GAC5D;IAAC,IAAI,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,SAAS,QAAQ,EAAE,CAAA;CAAC,GACvC;IAAC,IAAI,EAAE,OAAO,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAC,CAAC;AAElC,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IACxB,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,MAAM,OAAO,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC;AAEzD,sEAAsE;AACtE,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,WAAW,CAAC;AAEtE,iEAAiE;AACjE,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;IAChC,2EAA2E;IAC3E,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAClD,0DAA0D;IAC1D,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,uEAAuE;IACvE,QAAQ,CAAC,SAAS,EAAE,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;IACvE,oDAAoD;IACpD,QAAQ,CAAC,OAAO,EAAE,SAAS,WAAW,EAAE,CAAC;CAC1C"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file icons/defaults.ts
|
|
3
|
+
* @input None
|
|
4
|
+
* @output Shared icon names and each native platform's default system symbol
|
|
5
|
+
* @position Native icon defaults (AST-082 FR17, DEC-10). An icon the app or
|
|
6
|
+
* theme defines replaces these
|
|
7
|
+
*/
|
|
8
|
+
import type { PlatformIcon } from '../theme/defineNativeTheme.js';
|
|
9
|
+
/**
|
|
10
|
+
* Astryx's built-in icon names. Until core's portable entry carries them,
|
|
11
|
+
* a test keeps this list equal to core's `IconName` union.
|
|
12
|
+
*/
|
|
13
|
+
export declare const BUILTIN_ICON_NAMES: readonly ["close", "chevronDown", "chevronLeft", "chevronRight", "chevronsLeft", "chevronsRight", "check", "success", "error", "warning", "info", "calendar", "clock", "externalLink", "menu", "moreHorizontal", "search", "upload", "arrowUp", "arrowDown", "arrowsUpDown", "funnel", "eyeSlash", "viewColumns", "copy", "checkDouble", "wrench", "stop", "microphone"];
|
|
14
|
+
export type BuiltinIconName = (typeof BUILTIN_ICON_NAMES)[number];
|
|
15
|
+
/**
|
|
16
|
+
* Default icons per native platform. Windows has no map yet, so it is not a
|
|
17
|
+
* supported platform for icons (FR17).
|
|
18
|
+
*/
|
|
19
|
+
export declare const NATIVE_ICON_DEFAULTS: {
|
|
20
|
+
readonly ios: Record<"close" | "chevronDown" | "chevronLeft" | "chevronRight" | "chevronsLeft" | "chevronsRight" | "check" | "success" | "error" | "warning" | "info" | "calendar" | "clock" | "externalLink" | "menu" | "moreHorizontal" | "search" | "upload" | "arrowUp" | "arrowDown" | "arrowsUpDown" | "funnel" | "eyeSlash" | "viewColumns" | "copy" | "checkDouble" | "wrench" | "stop" | "microphone", PlatformIcon>;
|
|
21
|
+
readonly macos: Record<"close" | "chevronDown" | "chevronLeft" | "chevronRight" | "chevronsLeft" | "chevronsRight" | "check" | "success" | "error" | "warning" | "info" | "calendar" | "clock" | "externalLink" | "menu" | "moreHorizontal" | "search" | "upload" | "arrowUp" | "arrowDown" | "arrowsUpDown" | "funnel" | "eyeSlash" | "viewColumns" | "copy" | "checkDouble" | "wrench" | "stop" | "microphone", PlatformIcon>;
|
|
22
|
+
readonly android: Record<"close" | "chevronDown" | "chevronLeft" | "chevronRight" | "chevronsLeft" | "chevronsRight" | "check" | "success" | "error" | "warning" | "info" | "calendar" | "clock" | "externalLink" | "menu" | "moreHorizontal" | "search" | "upload" | "arrowUp" | "arrowDown" | "arrowsUpDown" | "funnel" | "eyeSlash" | "viewColumns" | "copy" | "checkDouble" | "wrench" | "stop" | "microphone", PlatformIcon>;
|
|
23
|
+
};
|
|
24
|
+
export declare const SF_SYMBOL_NAMES: Readonly<Record<BuiltinIconName, string>>;
|
|
25
|
+
//# sourceMappingURL=defaults.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../../src/icons/defaults.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,+BAA+B,CAAC;AAEhE;;;GAGG;AACH,eAAO,MAAM,kBAAkB,0WA8BrB,CAAC;AAEX,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAC;AA4ElE;;;GAGG;AACH,eAAO,MAAM,oBAAoB;;;;CAIvB,CAAC;AAEX,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,MAAM,CAAC,eAAe,EAAE,MAAM,CAAC,CAC1D,CAAC"}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
/**
|
|
3
|
+
* Astryx's built-in icon names. Until core's portable entry carries them,
|
|
4
|
+
* a test keeps this list equal to core's `IconName` union.
|
|
5
|
+
*/
|
|
6
|
+
export const BUILTIN_ICON_NAMES = [
|
|
7
|
+
'close',
|
|
8
|
+
'chevronDown',
|
|
9
|
+
'chevronLeft',
|
|
10
|
+
'chevronRight',
|
|
11
|
+
'chevronsLeft',
|
|
12
|
+
'chevronsRight',
|
|
13
|
+
'check',
|
|
14
|
+
'success',
|
|
15
|
+
'error',
|
|
16
|
+
'warning',
|
|
17
|
+
'info',
|
|
18
|
+
'calendar',
|
|
19
|
+
'clock',
|
|
20
|
+
'externalLink',
|
|
21
|
+
'menu',
|
|
22
|
+
'moreHorizontal',
|
|
23
|
+
'search',
|
|
24
|
+
'upload',
|
|
25
|
+
'arrowUp',
|
|
26
|
+
'arrowDown',
|
|
27
|
+
'arrowsUpDown',
|
|
28
|
+
'funnel',
|
|
29
|
+
'eyeSlash',
|
|
30
|
+
'viewColumns',
|
|
31
|
+
'copy',
|
|
32
|
+
'checkDouble',
|
|
33
|
+
'wrench',
|
|
34
|
+
'stop',
|
|
35
|
+
'microphone',
|
|
36
|
+
];
|
|
37
|
+
/** SF Symbols, shared by iOS and macOS. */
|
|
38
|
+
const SF_SYMBOLS = {
|
|
39
|
+
close: 'xmark',
|
|
40
|
+
chevronDown: 'chevron.down',
|
|
41
|
+
chevronLeft: 'chevron.left',
|
|
42
|
+
chevronRight: 'chevron.right',
|
|
43
|
+
chevronsLeft: 'chevron.left.2',
|
|
44
|
+
chevronsRight: 'chevron.right.2',
|
|
45
|
+
check: 'checkmark',
|
|
46
|
+
success: 'checkmark.circle.fill',
|
|
47
|
+
error: 'exclamationmark.circle.fill',
|
|
48
|
+
warning: 'exclamationmark.triangle.fill',
|
|
49
|
+
info: 'info.circle.fill',
|
|
50
|
+
calendar: 'calendar',
|
|
51
|
+
clock: 'clock',
|
|
52
|
+
externalLink: 'arrow.up.right.square',
|
|
53
|
+
menu: 'line.3.horizontal',
|
|
54
|
+
moreHorizontal: 'ellipsis',
|
|
55
|
+
search: 'magnifyingglass',
|
|
56
|
+
upload: 'square.and.arrow.up',
|
|
57
|
+
arrowUp: 'arrow.up',
|
|
58
|
+
arrowDown: 'arrow.down',
|
|
59
|
+
arrowsUpDown: 'arrow.up.arrow.down',
|
|
60
|
+
funnel: 'line.3.horizontal.decrease',
|
|
61
|
+
eyeSlash: 'eye.slash',
|
|
62
|
+
viewColumns: 'rectangle.split.3x1',
|
|
63
|
+
copy: 'doc.on.doc',
|
|
64
|
+
checkDouble: 'checkmark.message',
|
|
65
|
+
wrench: 'wrench.adjustable',
|
|
66
|
+
stop: 'stop.fill',
|
|
67
|
+
microphone: 'mic',
|
|
68
|
+
};
|
|
69
|
+
/** Material Symbols names for Android. */
|
|
70
|
+
const MATERIAL_SYMBOLS = {
|
|
71
|
+
close: 'close',
|
|
72
|
+
chevronDown: 'expand_more',
|
|
73
|
+
chevronLeft: 'chevron_left',
|
|
74
|
+
chevronRight: 'chevron_right',
|
|
75
|
+
chevronsLeft: 'keyboard_double_arrow_left',
|
|
76
|
+
chevronsRight: 'keyboard_double_arrow_right',
|
|
77
|
+
check: 'check',
|
|
78
|
+
success: 'check_circle',
|
|
79
|
+
error: 'error',
|
|
80
|
+
warning: 'warning',
|
|
81
|
+
info: 'info',
|
|
82
|
+
calendar: 'calendar_today',
|
|
83
|
+
clock: 'schedule',
|
|
84
|
+
externalLink: 'open_in_new',
|
|
85
|
+
menu: 'menu',
|
|
86
|
+
moreHorizontal: 'more_horiz',
|
|
87
|
+
search: 'search',
|
|
88
|
+
upload: 'upload',
|
|
89
|
+
arrowUp: 'arrow_upward',
|
|
90
|
+
arrowDown: 'arrow_downward',
|
|
91
|
+
arrowsUpDown: 'swap_vert',
|
|
92
|
+
funnel: 'filter_alt',
|
|
93
|
+
eyeSlash: 'visibility_off',
|
|
94
|
+
viewColumns: 'view_column',
|
|
95
|
+
copy: 'content_copy',
|
|
96
|
+
checkDouble: 'done_all',
|
|
97
|
+
wrench: 'build',
|
|
98
|
+
stop: 'stop',
|
|
99
|
+
microphone: 'mic',
|
|
100
|
+
};
|
|
101
|
+
const mapIcons = (names, make) => Object.fromEntries(BUILTIN_ICON_NAMES.map(name => [name, make(names[name])]));
|
|
102
|
+
/**
|
|
103
|
+
* Default icons per native platform. Windows has no map yet, so it is not a
|
|
104
|
+
* supported platform for icons (FR17).
|
|
105
|
+
*/
|
|
106
|
+
export const NATIVE_ICON_DEFAULTS = {
|
|
107
|
+
ios: mapIcons(SF_SYMBOLS, systemName => ({ systemName })),
|
|
108
|
+
macos: mapIcons(SF_SYMBOLS, systemName => ({ systemName })),
|
|
109
|
+
android: mapIcons(MATERIAL_SYMBOLS, materialSymbol => ({ materialSymbol })),
|
|
110
|
+
};
|
|
111
|
+
export const SF_SYMBOL_NAMES = SF_SYMBOLS;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file index.ts
|
|
3
|
+
* @input None
|
|
4
|
+
* @output The run-time API of @astryxdesign/native: platforms, native theme
|
|
5
|
+
* configuration, and native icon defaults
|
|
6
|
+
* @position Package root. Experimental and canary-only (AST-082 FR15); component
|
|
7
|
+
* types live at `@astryxdesign/native/components`
|
|
8
|
+
*/
|
|
9
|
+
export { NATIVE_PLATFORMS, SHARED_CONDITION, isNativePlatform, } from './platforms.js';
|
|
10
|
+
export type { NativePlatform } from './platforms.js';
|
|
11
|
+
export { compareVersions, defineNativeTheme, resolveNativeTheme, } from './theme/defineNativeTheme.js';
|
|
12
|
+
export type { DefineNativeThemeOptions, DurableMaterial, NativeTheme, NativeThemeConfig, PlatformEntry, PlatformIcon, PlatformVocabulary, PortableThemeLike, ResolvedNativeTheme, } from './theme/defineNativeTheme.js';
|
|
13
|
+
export { BUILTIN_ICON_NAMES, NATIVE_ICON_DEFAULTS } from './icons/defaults.js';
|
|
14
|
+
export type { BuiltinIconName } from './icons/defaults.js';
|
|
15
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AAEH,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,gBAAgB,CAAC;AACxB,YAAY,EAAC,cAAc,EAAC,MAAM,gBAAgB,CAAC;AACnD,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,8BAA8B,CAAC;AACtC,YAAY,EACV,wBAAwB,EACxB,eAAe,EACf,WAAW,EACX,iBAAiB,EACjB,aAAa,EACb,YAAY,EACZ,kBAAkB,EAClB,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAC,kBAAkB,EAAE,oBAAoB,EAAC,MAAM,qBAAqB,CAAC;AAC7E,YAAY,EAAC,eAAe,EAAC,MAAM,qBAAqB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
/**
|
|
3
|
+
* @file index.ts
|
|
4
|
+
* @input None
|
|
5
|
+
* @output The run-time API of @astryxdesign/native: platforms, native theme
|
|
6
|
+
* configuration, and native icon defaults
|
|
7
|
+
* @position Package root. Experimental and canary-only (AST-082 FR15); component
|
|
8
|
+
* types live at `@astryxdesign/native/components`
|
|
9
|
+
*/
|
|
10
|
+
export { NATIVE_PLATFORMS, SHARED_CONDITION, isNativePlatform, } from './platforms.js';
|
|
11
|
+
export { compareVersions, defineNativeTheme, resolveNativeTheme, } from './theme/defineNativeTheme.js';
|
|
12
|
+
export { BUILTIN_ICON_NAMES, NATIVE_ICON_DEFAULTS } from './icons/defaults.js';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file platforms.ts
|
|
3
|
+
* @input None
|
|
4
|
+
* @output The native platform names shared by contracts, types, themes, and icons
|
|
5
|
+
* @position Foundation; every other module keys platform data by these names
|
|
6
|
+
*/
|
|
7
|
+
/** Native platforms, in the order AST-082 lists them. */
|
|
8
|
+
export declare const NATIVE_PLATFORMS: readonly ["ios", "android", "macos", "windows"];
|
|
9
|
+
export type NativePlatform = (typeof NATIVE_PLATFORMS)[number];
|
|
10
|
+
/** Type-resolution condition that exposes only core contracts (AST-082 FR6). */
|
|
11
|
+
export declare const SHARED_CONDITION = "shared";
|
|
12
|
+
export declare function isNativePlatform(value: string): value is NativePlatform;
|
|
13
|
+
//# sourceMappingURL=platforms.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platforms.d.ts","sourceRoot":"","sources":["../src/platforms.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AAEH,yDAAyD;AACzD,eAAO,MAAM,gBAAgB,iDAAkD,CAAC;AAEhF,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE/D,gFAAgF;AAChF,eAAO,MAAM,gBAAgB,WAAW,CAAC;AAEzC,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,cAAc,CAEvE"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
/**
|
|
3
|
+
* @file platforms.ts
|
|
4
|
+
* @input None
|
|
5
|
+
* @output The native platform names shared by contracts, types, themes, and icons
|
|
6
|
+
* @position Foundation; every other module keys platform data by these names
|
|
7
|
+
*/
|
|
8
|
+
/** Native platforms, in the order AST-082 lists them. */
|
|
9
|
+
export const NATIVE_PLATFORMS = ['ios', 'android', 'macos', 'windows'];
|
|
10
|
+
/** Type-resolution condition that exposes only core contracts (AST-082 FR6). */
|
|
11
|
+
export const SHARED_CONDITION = 'shared';
|
|
12
|
+
export function isNativePlatform(value) {
|
|
13
|
+
return NATIVE_PLATFORMS.includes(value);
|
|
14
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file theme/defineNativeTheme.ts
|
|
3
|
+
* @input A defined theme (its portable part) and native theme configuration
|
|
4
|
+
* @output A native theme, and its resolution for one platform and OS version
|
|
5
|
+
* @position Native theme configuration (AST-082 FR10, FR18). Builds on the
|
|
6
|
+
* defined theme without changing it and never sets tokens
|
|
7
|
+
*/
|
|
8
|
+
import { type NativePlatform } from '../platforms.js';
|
|
9
|
+
/**
|
|
10
|
+
* The portable part of a defined theme (AST-082 FR18). A core `DefinedTheme`
|
|
11
|
+
* satisfies it structurally, so native never imports core to accept one.
|
|
12
|
+
*/
|
|
13
|
+
export interface PortableThemeLike {
|
|
14
|
+
readonly name: string;
|
|
15
|
+
readonly tokens: Readonly<Record<string, string>>;
|
|
16
|
+
readonly localTokens?: Readonly<Record<string, string>>;
|
|
17
|
+
}
|
|
18
|
+
/** Durable outcomes a person sees; no platform feature names (DEC-5). */
|
|
19
|
+
export type DurableMaterial = 'opaque' | 'translucent';
|
|
20
|
+
export interface PlatformVocabulary {
|
|
21
|
+
ios: {
|
|
22
|
+
material: DurableMaterial | 'liquidGlass';
|
|
23
|
+
};
|
|
24
|
+
macos: {
|
|
25
|
+
material: DurableMaterial | 'liquidGlass';
|
|
26
|
+
};
|
|
27
|
+
android: {
|
|
28
|
+
material: DurableMaterial;
|
|
29
|
+
};
|
|
30
|
+
windows: {
|
|
31
|
+
material: DurableMaterial | 'mica' | 'acrylic';
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
/** Platform icon reference, as data (AST-082 FR17). */
|
|
35
|
+
export type PlatformIcon = {
|
|
36
|
+
readonly systemName: string;
|
|
37
|
+
} | {
|
|
38
|
+
readonly materialSymbol: string;
|
|
39
|
+
};
|
|
40
|
+
export type PlatformEntry<P extends NativePlatform> = Partial<PlatformVocabulary[P]> & {
|
|
41
|
+
readonly minVersion?: string;
|
|
42
|
+
readonly maxVersion?: string;
|
|
43
|
+
/** Overrides for this platform's theme targets, keyed by target. */
|
|
44
|
+
readonly components?: Readonly<Record<string, Readonly<Record<string, string | number>>>>;
|
|
45
|
+
readonly icons?: Readonly<Record<string, PlatformIcon>>;
|
|
46
|
+
};
|
|
47
|
+
export interface NativeThemeConfig {
|
|
48
|
+
readonly material?: DurableMaterial;
|
|
49
|
+
readonly platforms?: {
|
|
50
|
+
readonly [P in NativePlatform]?: ReadonlyArray<PlatformEntry<P>>;
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
export interface NativeTheme {
|
|
54
|
+
readonly theme: PortableThemeLike;
|
|
55
|
+
readonly config: NativeThemeConfig;
|
|
56
|
+
}
|
|
57
|
+
export interface DefineNativeThemeOptions {
|
|
58
|
+
/** Native theme to extend: durable members merge, platform entry lists replace. */
|
|
59
|
+
readonly extends?: NativeTheme;
|
|
60
|
+
/** Receives each report; defaults to console.warn outside production. */
|
|
61
|
+
readonly onReport?: (message: string) => void;
|
|
62
|
+
}
|
|
63
|
+
export declare function compareVersions(a: string, b: string): number;
|
|
64
|
+
export declare function defineNativeTheme(theme: PortableThemeLike, config: NativeThemeConfig, options?: DefineNativeThemeOptions): NativeTheme;
|
|
65
|
+
export interface ResolvedNativeTheme {
|
|
66
|
+
readonly material?: string;
|
|
67
|
+
readonly components: Readonly<Record<string, Readonly<Record<string, string | number>>>>;
|
|
68
|
+
readonly icons: Readonly<Record<string, PlatformIcon>>;
|
|
69
|
+
}
|
|
70
|
+
/** Applies durable intent, then each matching platform entry in order. */
|
|
71
|
+
export declare function resolveNativeTheme(nativeTheme: NativeTheme, target: {
|
|
72
|
+
readonly platform: NativePlatform;
|
|
73
|
+
readonly osVersion: string;
|
|
74
|
+
}): ResolvedNativeTheme;
|
|
75
|
+
//# sourceMappingURL=defineNativeTheme.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defineNativeTheme.d.ts","sourceRoot":"","sources":["../../src/theme/defineNativeTheme.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
/**
|
|
3
|
+
* @file theme/defineNativeTheme.ts
|
|
4
|
+
* @input A defined theme (its portable part) and native theme configuration
|
|
5
|
+
* @output A native theme, and its resolution for one platform and OS version
|
|
6
|
+
* @position Native theme configuration (AST-082 FR10, FR18). Builds on the
|
|
7
|
+
* defined theme without changing it and never sets tokens
|
|
8
|
+
*/
|
|
9
|
+
import { NATIVE_PLATFORMS } from '../platforms.js';
|
|
10
|
+
/** Platform terms that exist only from a given OS version. */
|
|
11
|
+
const FEATURE_FLOORS = {
|
|
12
|
+
ios: { liquidGlass: '26' },
|
|
13
|
+
macos: { liquidGlass: '26' },
|
|
14
|
+
windows: { mica: '11' },
|
|
15
|
+
};
|
|
16
|
+
/** Web-only parts of a defined theme that have no native meaning (FR18). */
|
|
17
|
+
const WEB_PARTS = [
|
|
18
|
+
'components',
|
|
19
|
+
'icons',
|
|
20
|
+
'indicators',
|
|
21
|
+
'__onDark',
|
|
22
|
+
'__onLight',
|
|
23
|
+
'__adaptations',
|
|
24
|
+
];
|
|
25
|
+
export function compareVersions(a, b) {
|
|
26
|
+
const pa = a.split('.').map(Number);
|
|
27
|
+
const pb = b.split('.').map(Number);
|
|
28
|
+
for (let i = 0; i < Math.max(pa.length, pb.length); i++) {
|
|
29
|
+
const diff = (pa[i] ?? 0) - (pb[i] ?? 0);
|
|
30
|
+
if (diff !== 0) {
|
|
31
|
+
return diff;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return 0;
|
|
35
|
+
}
|
|
36
|
+
function hasContent(value) {
|
|
37
|
+
if (value == null) {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
if (Array.isArray(value)) {
|
|
41
|
+
return value.length > 0;
|
|
42
|
+
}
|
|
43
|
+
if (typeof value === 'object') {
|
|
44
|
+
return Object.keys(value).length > 0;
|
|
45
|
+
}
|
|
46
|
+
return true;
|
|
47
|
+
}
|
|
48
|
+
function validate(config) {
|
|
49
|
+
const errors = [];
|
|
50
|
+
for (const platform of NATIVE_PLATFORMS) {
|
|
51
|
+
for (const entry of config.platforms?.[platform] ?? []) {
|
|
52
|
+
const material = entry.material;
|
|
53
|
+
const floor = material ? FEATURE_FLOORS[platform]?.[material] : undefined;
|
|
54
|
+
if (floor &&
|
|
55
|
+
(entry.minVersion == null ||
|
|
56
|
+
compareVersions(entry.minVersion, floor) < 0)) {
|
|
57
|
+
errors.push(`${platform} material "${material}" exists only from ${platform} ${floor}; ` +
|
|
58
|
+
`scope its entry with minVersion: '${floor}' or later`);
|
|
59
|
+
}
|
|
60
|
+
if (entry.minVersion &&
|
|
61
|
+
entry.maxVersion &&
|
|
62
|
+
compareVersions(entry.minVersion, entry.maxVersion) > 0) {
|
|
63
|
+
errors.push(`${platform} entry has minVersion above maxVersion`);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return errors;
|
|
68
|
+
}
|
|
69
|
+
export function defineNativeTheme(theme, config, options = {}) {
|
|
70
|
+
const merged = options.extends
|
|
71
|
+
? {
|
|
72
|
+
...options.extends.config,
|
|
73
|
+
...config,
|
|
74
|
+
platforms: { ...options.extends.config.platforms, ...config.platforms },
|
|
75
|
+
}
|
|
76
|
+
: config;
|
|
77
|
+
const errors = validate(merged);
|
|
78
|
+
if (errors.length > 0) {
|
|
79
|
+
throw new Error(`defineNativeTheme(${theme.name}): ${errors.join('; ')}`);
|
|
80
|
+
}
|
|
81
|
+
const report = options.onReport ??
|
|
82
|
+
((message) => {
|
|
83
|
+
const env = typeof process === 'undefined' ? undefined : process.env?.NODE_ENV;
|
|
84
|
+
if (env !== 'production') {
|
|
85
|
+
console.warn(message);
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
const received = theme;
|
|
89
|
+
for (const part of WEB_PARTS) {
|
|
90
|
+
if (hasContent(received[part])) {
|
|
91
|
+
report(`defineNativeTheme(${theme.name}): "${part.replace(/^__/, '')}" is web-only and has ` +
|
|
92
|
+
'no native meaning; use native platform entries instead');
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
const portable = {
|
|
96
|
+
name: theme.name,
|
|
97
|
+
tokens: theme.tokens,
|
|
98
|
+
...(theme.localTokens ? { localTokens: theme.localTokens } : {}),
|
|
99
|
+
};
|
|
100
|
+
return { theme: portable, config: merged };
|
|
101
|
+
}
|
|
102
|
+
/** Applies durable intent, then each matching platform entry in order. */
|
|
103
|
+
export function resolveNativeTheme(nativeTheme, target) {
|
|
104
|
+
let resolved = {
|
|
105
|
+
...(nativeTheme.config.material
|
|
106
|
+
? { material: nativeTheme.config.material }
|
|
107
|
+
: {}),
|
|
108
|
+
components: {},
|
|
109
|
+
icons: {},
|
|
110
|
+
};
|
|
111
|
+
const entries = (nativeTheme.config.platforms?.[target.platform] ??
|
|
112
|
+
[]);
|
|
113
|
+
for (const entry of entries) {
|
|
114
|
+
if (entry.minVersion &&
|
|
115
|
+
compareVersions(target.osVersion, entry.minVersion) < 0) {
|
|
116
|
+
continue;
|
|
117
|
+
}
|
|
118
|
+
if (entry.maxVersion &&
|
|
119
|
+
compareVersions(target.osVersion, entry.maxVersion) > 0) {
|
|
120
|
+
continue;
|
|
121
|
+
}
|
|
122
|
+
const { minVersion: _min, maxVersion: _max, ...members } = entry;
|
|
123
|
+
resolved = { ...resolved, ...members };
|
|
124
|
+
}
|
|
125
|
+
return resolved;
|
|
126
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// Generated by @astryxdesign/native. Do not edit.
|
|
2
|
+
import type {SelectorCoreProps} from './core.js';
|
|
3
|
+
export type {AstryxSharedBaseProps, SelectorOption, SelectorCoreProps} from './core.js';
|
|
4
|
+
/** Selector props: core contract plus the android contract. */
|
|
5
|
+
export interface SelectorProps extends SelectorCoreProps {
|
|
6
|
+
menuStyle?: 'dropdown' | 'bottomSheet';
|
|
7
|
+
}
|
|
8
|
+
export declare function Selector(props: SelectorProps): unknown;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// Generated by @astryxdesign/native. Do not edit.
|
|
2
|
+
/** Base props shared by every platform (AST-082 FR7). */
|
|
3
|
+
export interface AstryxSharedBaseProps {
|
|
4
|
+
id?: string;
|
|
5
|
+
isHidden?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export interface SelectorOption {
|
|
8
|
+
value: string;
|
|
9
|
+
label?: string;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
}
|
|
12
|
+
/** Core contract. Base props attach to the trigger. */
|
|
13
|
+
export interface SelectorCoreProps extends AstryxSharedBaseProps {
|
|
14
|
+
label: string;
|
|
15
|
+
options: ReadonlyArray<SelectorOption>;
|
|
16
|
+
value?: string;
|
|
17
|
+
onChange?: (arg0: string) => void;
|
|
18
|
+
hasClear?: boolean;
|
|
19
|
+
hasSearch?: boolean;
|
|
20
|
+
searchPlaceholder?: string;
|
|
21
|
+
placeholder?: string;
|
|
22
|
+
size?: 'sm' | 'md' | 'lg';
|
|
23
|
+
variant?: 'input' | 'secondary' | 'ghost';
|
|
24
|
+
isDisabled?: boolean;
|
|
25
|
+
isReadOnly?: boolean;
|
|
26
|
+
disabledMessage?: string;
|
|
27
|
+
isLabelHidden?: boolean;
|
|
28
|
+
description?: string;
|
|
29
|
+
isOptional?: boolean;
|
|
30
|
+
isRequired?: boolean;
|
|
31
|
+
status?: {type: 'error' | 'warning' | 'success'; message?: string;};
|
|
32
|
+
statusVariant?: 'attached' | 'detached' | 'tooltip';
|
|
33
|
+
indicatorPosition?: 'start' | 'end';
|
|
34
|
+
isLoading?: boolean;
|
|
35
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// Generated by @astryxdesign/native. Do not edit.
|
|
2
|
+
import type {SelectorCoreProps} from './core.js';
|
|
3
|
+
export type {AstryxSharedBaseProps, SelectorOption, SelectorCoreProps} from './core.js';
|
|
4
|
+
/** Selector props: core contract plus the ios contract. */
|
|
5
|
+
export interface SelectorProps extends SelectorCoreProps {
|
|
6
|
+
menuStyle?: 'popUp' | 'pullDown';
|
|
7
|
+
}
|
|
8
|
+
export declare function Selector(props: SelectorProps): unknown;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// Generated by @astryxdesign/native. Do not edit.
|
|
2
|
+
import type {SelectorCoreProps} from './core.js';
|
|
3
|
+
export type {AstryxSharedBaseProps, SelectorOption, SelectorCoreProps} from './core.js';
|
|
4
|
+
/** Selector props: core contract plus the macos contract. */
|
|
5
|
+
export interface SelectorProps extends SelectorCoreProps {
|
|
6
|
+
menuStyle?: 'popUp' | 'pullDown';
|
|
7
|
+
}
|
|
8
|
+
export declare function Selector(props: SelectorProps): unknown;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// Generated by @astryxdesign/native. Do not edit.
|
|
2
|
+
import type {SelectorCoreProps} from './core.js';
|
|
3
|
+
export type {AstryxSharedBaseProps, SelectorOption, SelectorCoreProps} from './core.js';
|
|
4
|
+
/** Selector props: core contract only. */
|
|
5
|
+
export interface SelectorProps extends SelectorCoreProps {}
|
|
6
|
+
export declare function Selector(props: SelectorProps): unknown;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// Generated by @astryxdesign/native. Do not edit.
|
|
2
|
+
import type {SelectorCoreProps} from './core.js';
|
|
3
|
+
export type {AstryxSharedBaseProps, SelectorOption, SelectorCoreProps} from './core.js';
|
|
4
|
+
/** Selector props: core contract plus the windows contract. */
|
|
5
|
+
export interface SelectorProps extends SelectorCoreProps {}
|
|
6
|
+
export declare function Selector(props: SelectorProps): unknown;
|