@ankhorage/contracts 11.0.0 → 12.0.0
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/CHANGELOG.md +15 -0
- package/README.md +1 -1
- package/dist/appManifest/navigator.js +1 -7
- package/dist/appManifest/navigator.js.map +1 -1
- package/dist/appManifest/navigatorOptions.js +18 -17
- package/dist/appManifest/navigatorOptions.js.map +1 -1
- package/dist/navigator/catalog.d.ts +42 -0
- package/dist/navigator/catalog.d.ts.map +1 -0
- package/dist/navigator/catalog.js +2 -0
- package/dist/navigator/catalog.js.map +1 -0
- package/dist/navigator/extensions.d.ts +23 -0
- package/dist/navigator/extensions.d.ts.map +1 -0
- package/dist/navigator/extensions.js +2 -0
- package/dist/navigator/extensions.js.map +1 -0
- package/dist/navigator/generation.d.ts +36 -0
- package/dist/navigator/generation.d.ts.map +1 -0
- package/dist/navigator/generation.js +2 -0
- package/dist/navigator/generation.js.map +1 -0
- package/dist/navigator/planning.d.ts +105 -0
- package/dist/navigator/planning.d.ts.map +1 -0
- package/dist/navigator/planning.js +2 -0
- package/dist/navigator/planning.js.map +1 -0
- package/dist/navigator.d.ts +21 -23
- package/dist/navigator.d.ts.map +1 -1
- package/dist/navigator.js +9 -9
- package/dist/navigator.js.map +1 -1
- package/package.json +4 -4
- package/src/appManifest/navigator.ts +1 -10
- package/src/appManifest/navigatorOptions.ts +19 -18
- package/src/navigator/catalog.ts +79 -0
- package/src/navigator/extensions.ts +26 -0
- package/src/navigator/generation.ts +46 -0
- package/src/navigator/planning.ts +147 -0
- package/src/navigator-runtime-contracts.test.ts +104 -0
- package/src/navigator-validation.test.ts +31 -4
- package/src/navigator.test.ts +37 -16
- package/src/navigator.ts +69 -29
package/dist/navigator.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { IconSpec, ManifestValue } from './types';
|
|
2
2
|
export declare const NAVIGATOR_TYPES: readonly ["slot", "stack", "tabs", "drawer", "split-view", "custom"];
|
|
3
3
|
export type NavigatorType = (typeof NAVIGATOR_TYPES)[number];
|
|
4
|
-
export declare const NAVIGATOR_PRESETS: readonly ["slot", "stack", "tabs", "tabs-stack", "
|
|
4
|
+
export declare const NAVIGATOR_PRESETS: readonly ["slot", "stack", "tabs", "tabs-stack", "stack-tabs", "stack-tabs-stack", "drawer", "drawer-stack", "stack-drawer", "stack-drawer-stack", "drawer-tabs", "drawer-tabs-stack", "stack-drawer-tabs", "stack-drawer-tabs-stack", "split-view", "custom"];
|
|
5
5
|
export type NavigatorPreset = (typeof NAVIGATOR_PRESETS)[number];
|
|
6
6
|
export declare const STACK_IMPLEMENTATIONS: readonly ["native", "javascript", "experimental"];
|
|
7
7
|
export type StackImplementation = (typeof STACK_IMPLEMENTATIONS)[number];
|
|
@@ -49,21 +49,21 @@ export interface DrawerNavigatorOptions {
|
|
|
49
49
|
swipeEnabled?: boolean;
|
|
50
50
|
headerShown?: boolean;
|
|
51
51
|
}
|
|
52
|
-
export declare const
|
|
53
|
-
export type
|
|
54
|
-
export declare const
|
|
55
|
-
export type
|
|
52
|
+
export declare const FIXED_HEADLESS_TABS_PRESENTATIONS: readonly ["bottom", "top", "rail", "sidebar"];
|
|
53
|
+
export type FixedHeadlessTabsPresentation = (typeof FIXED_HEADLESS_TABS_PRESENTATIONS)[number];
|
|
54
|
+
export declare const HEADLESS_TABS_PRESENTATIONS: readonly ["bottom", "top", "rail", "sidebar", "responsive", "custom"];
|
|
55
|
+
export type HeadlessTabsPresentation = (typeof HEADLESS_TABS_PRESENTATIONS)[number];
|
|
56
56
|
export declare const JAVASCRIPT_TABS_PRESENTATIONS: readonly ["bottom", "top"];
|
|
57
57
|
export type JavaScriptTabsPresentation = (typeof JAVASCRIPT_TABS_PRESENTATIONS)[number];
|
|
58
58
|
export declare const NATIVE_TABS_MINIMIZE_BEHAVIORS: readonly ["automatic", "never", "onScrollDown", "onScrollUp"];
|
|
59
59
|
export type NativeTabsMinimizeBehavior = (typeof NATIVE_TABS_MINIMIZE_BEHAVIORS)[number];
|
|
60
60
|
export interface ResponsiveTabsPresentation {
|
|
61
|
-
compact:
|
|
62
|
-
medium?:
|
|
63
|
-
expanded:
|
|
61
|
+
compact: FixedHeadlessTabsPresentation;
|
|
62
|
+
medium?: FixedHeadlessTabsPresentation;
|
|
63
|
+
expanded: FixedHeadlessTabsPresentation;
|
|
64
64
|
}
|
|
65
|
-
export type
|
|
66
|
-
presentation:
|
|
65
|
+
export type HeadlessTabsPresentationConfig = {
|
|
66
|
+
presentation: FixedHeadlessTabsPresentation;
|
|
67
67
|
responsive?: never;
|
|
68
68
|
customPresentationId?: never;
|
|
69
69
|
} | {
|
|
@@ -76,10 +76,10 @@ export type CustomTabsPresentationConfig = {
|
|
|
76
76
|
/** Serializable registered presentation id. */
|
|
77
77
|
customPresentationId: string;
|
|
78
78
|
};
|
|
79
|
-
export type
|
|
80
|
-
implementation: '
|
|
81
|
-
} &
|
|
82
|
-
export type
|
|
79
|
+
export type HeadlessTabsConfig = {
|
|
80
|
+
implementation: 'headless';
|
|
81
|
+
} & HeadlessTabsPresentationConfig;
|
|
82
|
+
export type HeadlessTabsWebConfig = HeadlessTabsPresentationConfig;
|
|
83
83
|
export interface NavigatorScreenReference {
|
|
84
84
|
screenId: string;
|
|
85
85
|
}
|
|
@@ -99,10 +99,10 @@ export interface AdaptiveTabsConfig {
|
|
|
99
99
|
implementation?: 'adaptive';
|
|
100
100
|
/** Android/iOS branch. Expo Router may expose this implementation as unstable. */
|
|
101
101
|
native?: NativeTabsConfig;
|
|
102
|
-
/** Web branch rendered through headless
|
|
103
|
-
web?:
|
|
102
|
+
/** Web branch rendered through headless tabs. */
|
|
103
|
+
web?: HeadlessTabsWebConfig;
|
|
104
104
|
}
|
|
105
|
-
export type TabsImplementationConfig = AdaptiveTabsConfig |
|
|
105
|
+
export type TabsImplementationConfig = AdaptiveTabsConfig | HeadlessTabsConfig | JavaScriptTabsConfig | NativeTabsConfig;
|
|
106
106
|
interface NavigatorNodeBase {
|
|
107
107
|
initialRouteName?: string;
|
|
108
108
|
routes: RouteDefinition[];
|
|
@@ -150,10 +150,6 @@ export interface RouteDefinition {
|
|
|
150
150
|
stackOptions?: StackScreenOptions;
|
|
151
151
|
navigator?: NavigatorNode;
|
|
152
152
|
}
|
|
153
|
-
export interface NavigatorFlows {
|
|
154
|
-
onboarding?: boolean;
|
|
155
|
-
authentication?: boolean;
|
|
156
|
-
}
|
|
157
153
|
export interface NavigatorDefaults {
|
|
158
154
|
tabs?: TabsImplementationConfig;
|
|
159
155
|
stack?: StackImplementationConfig;
|
|
@@ -175,9 +171,11 @@ export interface NavigatorPlatforms {
|
|
|
175
171
|
*/
|
|
176
172
|
export type AppNavigatorManifest = NavigatorNode & {
|
|
177
173
|
preset?: NavigatorPreset;
|
|
178
|
-
flows?: NavigatorFlows;
|
|
179
174
|
defaults?: NavigatorDefaults;
|
|
180
175
|
platforms?: NavigatorPlatforms;
|
|
181
176
|
};
|
|
182
|
-
export {};
|
|
177
|
+
export type { NavigatorCapabilityDescriptor, NavigatorCapabilityRequirement, NavigatorCapabilityTarget, NavigatorCapabilityVerification, NavigatorCatalog, NavigatorImplementation, NavigatorPresentation, NavigatorPresetDescriptor, NavigatorVerificationKind, NavigatorVerificationStatus, } from './navigator/catalog';
|
|
178
|
+
export type { CustomNavigatorConfigIssue, CustomNavigatorRegistration, CustomNavigatorRegistry, } from './navigator/extensions';
|
|
179
|
+
export type { NavigatorDependencyRequirement, NavigatorGeneratedFile, NavigatorGenerationBindings, NavigatorGenerationOptions, NavigatorGenerationResult, NavigatorScreenModule, } from './navigator/generation';
|
|
180
|
+
export type { CreateNavigatorPlanOptions, ExpoRouterNavigatorModule, NavigatorAdapterId, NavigatorAdapterPlan, NavigatorApiStability, NavigatorCapabilityId, NavigatorDiagnostic, NavigatorNodePlan, NavigatorPlan, NavigatorResponsiveSize, NavigatorRoutePlan, NavigatorRuntimePlatform, NavigatorSupportStatus, NavigatorValidationContext, ResolvedHeadlessTabsPresentation, ResolvedTabsImplementation, ResolvedTabsPresentation, TabsNavigatorPlan, } from './navigator/planning';
|
|
183
181
|
//# sourceMappingURL=navigator.d.ts.map
|
package/dist/navigator.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"navigator.d.ts","sourceRoot":"","sources":["../src/navigator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAEvD,eAAO,MAAM,eAAe,sEAAuE,CAAC;AACpG,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC;AAE7D,eAAO,MAAM,iBAAiB,
|
|
1
|
+
{"version":3,"file":"navigator.d.ts","sourceRoot":"","sources":["../src/navigator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAEvD,eAAO,MAAM,eAAe,sEAAuE,CAAC;AACpG,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC;AAE7D,eAAO,MAAM,iBAAiB,gQAiBpB,CAAC;AACX,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEjE,eAAO,MAAM,qBAAqB,mDAAoD,CAAC;AACvF,MAAM,MAAM,mBAAmB,GAAG,CAAC,OAAO,qBAAqB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEzE,eAAO,MAAM,mBAAmB,+HAQtB,CAAC;AACX,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,CAAC,CAAC;AAErE,eAAO,MAAM,8BAA8B,gDAAiD,CAAC;AAC7F,MAAM,MAAM,2BAA2B,GAAG,CAAC,OAAO,8BAA8B,CAAC,CAAC,MAAM,CAAC,CAAC;AAE1F,MAAM,WAAW,kBAAkB;IAC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,CAAC,EAAE,uBAAuB,CAAC;IAClC,GAAG,CAAC,EAAE,uBAAuB,CAAC;IAC9B,GAAG,CAAC,EAAE,uBAAuB,CAAC;CAC/B;AAED;;;;;GAKG;AACH,MAAM,MAAM,oBAAoB,GAAG,aAAa,GAAG;IACjD,MAAM,CAAC,EAAE,eAAe,CAAC;IACzB,QAAQ,CAAC,EAAE,iBAAiB,CAAC;IAC7B,SAAS,CAAC,EAAE,kBAAkB,CAAC;CAChC,CAAC;AAEF,YAAY,EACV,6BAA6B,EAC7B,8BAA8B,EAC9B,yBAAyB,EACzB,+BAA+B,EAC/B,gBAAgB,EAChB,uBAAuB,EACvB,qBAAqB,EACrB,yBAAyB,EACzB,yBAAyB,EACzB,2BAA2B,GAC5B,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EACV,0BAA0B,EAC1B,2BAA2B,EAC3B,uBAAuB,GACxB,MAAM,wBAAwB,CAAC;AAChC,YAAY,EACV,8BAA8B,EAC9B,sBAAsB,EACtB,2BAA2B,EAC3B,0BAA0B,EAC1B,yBAAyB,EACzB,qBAAqB,GACtB,MAAM,wBAAwB,CAAC;AAChC,YAAY,EACV,0BAA0B,EAC1B,yBAAyB,EACzB,kBAAkB,EAClB,oBAAoB,EACpB,qBAAqB,EACrB,qBAAqB,EACrB,mBAAmB,EACnB,iBAAiB,EACjB,aAAa,EACb,uBAAuB,EACvB,kBAAkB,EAClB,wBAAwB,EACxB,sBAAsB,EACtB,0BAA0B,EAC1B,gCAAgC,EAChC,0BAA0B,EAC1B,wBAAwB,EACxB,iBAAiB,GAClB,MAAM,sBAAsB,CAAC"}
|
package/dist/navigator.js
CHANGED
|
@@ -4,16 +4,16 @@ export const NAVIGATOR_PRESETS = [
|
|
|
4
4
|
'stack',
|
|
5
5
|
'tabs',
|
|
6
6
|
'tabs-stack',
|
|
7
|
+
'stack-tabs',
|
|
8
|
+
'stack-tabs-stack',
|
|
7
9
|
'drawer',
|
|
8
10
|
'drawer-stack',
|
|
11
|
+
'stack-drawer',
|
|
12
|
+
'stack-drawer-stack',
|
|
9
13
|
'drawer-tabs',
|
|
10
14
|
'drawer-tabs-stack',
|
|
11
|
-
'
|
|
12
|
-
'
|
|
13
|
-
'root-stack-drawer',
|
|
14
|
-
'root-stack-drawer-stack',
|
|
15
|
-
'root-stack-drawer-tabs',
|
|
16
|
-
'root-stack-drawer-tabs-stack',
|
|
15
|
+
'stack-drawer-tabs',
|
|
16
|
+
'stack-drawer-tabs-stack',
|
|
17
17
|
'split-view',
|
|
18
18
|
'custom',
|
|
19
19
|
];
|
|
@@ -30,9 +30,9 @@ export const STACK_PRESENTATIONS = [
|
|
|
30
30
|
export const JAVASCRIPT_STACK_PRESENTATIONS = ['card', 'modal', 'transparentModal'];
|
|
31
31
|
export const DRAWER_POSITIONS = ['left', 'right'];
|
|
32
32
|
export const DRAWER_TYPES = ['front', 'back', 'slide', 'permanent'];
|
|
33
|
-
export const
|
|
34
|
-
export const
|
|
35
|
-
...
|
|
33
|
+
export const FIXED_HEADLESS_TABS_PRESENTATIONS = ['bottom', 'top', 'rail', 'sidebar'];
|
|
34
|
+
export const HEADLESS_TABS_PRESENTATIONS = [
|
|
35
|
+
...FIXED_HEADLESS_TABS_PRESENTATIONS,
|
|
36
36
|
'responsive',
|
|
37
37
|
'custom',
|
|
38
38
|
];
|
package/dist/navigator.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"navigator.js","sourceRoot":"","sources":["../src/navigator.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,QAAQ,CAAU,CAAC;AAGpG,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,MAAM;IACN,OAAO;IACP,MAAM;IACN,YAAY;IACZ,QAAQ;IACR,cAAc;IACd,aAAa;IACb,mBAAmB;IACnB,iBAAiB;IACjB,uBAAuB;IACvB,mBAAmB;IACnB,yBAAyB;IACzB,wBAAwB;IACxB,8BAA8B;IAC9B,YAAY;IACZ,QAAQ;CACA,CAAC;AAGX,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,QAAQ,EAAE,YAAY,EAAE,cAAc,CAAU,CAAC;AAGvF,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,MAAM;IACN,OAAO;IACP,kBAAkB;IAClB,gBAAgB;IAChB,2BAA2B;IAC3B,iBAAiB;IACjB,WAAW;CACH,CAAC;AAGX,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAAC,MAAM,EAAE,OAAO,EAAE,kBAAkB,CAAU,CAAC;AA4C7F,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,MAAM,EAAE,OAAO,CAAU,CAAC;AAG3D,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,CAAU,CAAC;AAU7E,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAAC,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,CAAU,CAAC;AAG7F,MAAM,CAAC,MAAM,yBAAyB,GAAG;IACvC,GAAG,+BAA+B;IAClC,YAAY;IACZ,QAAQ;CACA,CAAC;AAGX,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC,QAAQ,EAAE,KAAK,CAAU,CAAC;AAGxE,MAAM,CAAC,MAAM,8BAA8B,GAAG;IAC5C,WAAW;IACX,OAAO;IACP,cAAc;IACd,YAAY;CACJ,CAAC","sourcesContent":["import type { IconSpec, ManifestValue } from './types';\n\nexport const NAVIGATOR_TYPES = ['slot', 'stack', 'tabs', 'drawer', 'split-view', 'custom'] as const;\nexport type NavigatorType = (typeof NAVIGATOR_TYPES)[number];\n\nexport const NAVIGATOR_PRESETS = [\n 'slot',\n 'stack',\n 'tabs',\n 'tabs-stack',\n 'drawer',\n 'drawer-stack',\n 'drawer-tabs',\n 'drawer-tabs-stack',\n 'root-stack-tabs',\n 'root-stack-tabs-stack',\n 'root-stack-drawer',\n 'root-stack-drawer-stack',\n 'root-stack-drawer-tabs',\n 'root-stack-drawer-tabs-stack',\n 'split-view',\n 'custom',\n] as const;\nexport type NavigatorPreset = (typeof NAVIGATOR_PRESETS)[number];\n\nexport const STACK_IMPLEMENTATIONS = ['native', 'javascript', 'experimental'] as const;\nexport type StackImplementation = (typeof STACK_IMPLEMENTATIONS)[number];\n\nexport const STACK_PRESENTATIONS = [\n 'card',\n 'modal',\n 'transparentModal',\n 'containedModal',\n 'containedTransparentModal',\n 'fullScreenModal',\n 'formSheet',\n] as const;\nexport type StackPresentation = (typeof STACK_PRESENTATIONS)[number];\n\nexport const JAVASCRIPT_STACK_PRESENTATIONS = ['card', 'modal', 'transparentModal'] as const;\nexport type JavaScriptStackPresentation = (typeof JAVASCRIPT_STACK_PRESENTATIONS)[number];\n\nexport interface StackHeaderOptions {\n title?: string;\n headerShown?: boolean;\n headerTransparent?: boolean;\n headerBackVisible?: boolean;\n}\n\nexport type StackScreenOptions = StackHeaderOptions &\n (\n | {\n presentation?: Exclude<StackPresentation, 'formSheet'>;\n sheetAllowedDetents?: never;\n sheetGrabberVisible?: never;\n }\n | {\n presentation: 'formSheet';\n sheetAllowedDetents?: 'fitToContents' | number[];\n sheetGrabberVisible?: boolean;\n }\n );\n\nexport type JavaScriptStackScreenOptions = StackHeaderOptions & {\n presentation?: JavaScriptStackPresentation;\n};\n\nexport type StackImplementationConfig =\n | {\n /** Omission selects the stable native stack implementation. */\n implementation?: 'native';\n options?: StackScreenOptions;\n }\n | {\n implementation: 'javascript';\n options?: JavaScriptStackScreenOptions;\n }\n | {\n /** Expo Router Experimental Stack is alpha, native-only, and available from SDK 56. */\n implementation: 'experimental';\n options?: StackHeaderOptions;\n };\n\nexport const DRAWER_POSITIONS = ['left', 'right'] as const;\nexport type DrawerPosition = (typeof DRAWER_POSITIONS)[number];\n\nexport const DRAWER_TYPES = ['front', 'back', 'slide', 'permanent'] as const;\nexport type DrawerType = (typeof DRAWER_TYPES)[number];\n\nexport interface DrawerNavigatorOptions {\n drawerPosition?: DrawerPosition;\n drawerType?: DrawerType;\n swipeEnabled?: boolean;\n headerShown?: boolean;\n}\n\nexport const FIXED_CUSTOM_TABS_PRESENTATIONS = ['bottom', 'top', 'rail', 'sidebar'] as const;\nexport type FixedCustomTabsPresentation = (typeof FIXED_CUSTOM_TABS_PRESENTATIONS)[number];\n\nexport const CUSTOM_TABS_PRESENTATIONS = [\n ...FIXED_CUSTOM_TABS_PRESENTATIONS,\n 'responsive',\n 'custom',\n] as const;\nexport type CustomTabsPresentation = (typeof CUSTOM_TABS_PRESENTATIONS)[number];\n\nexport const JAVASCRIPT_TABS_PRESENTATIONS = ['bottom', 'top'] as const;\nexport type JavaScriptTabsPresentation = (typeof JAVASCRIPT_TABS_PRESENTATIONS)[number];\n\nexport const NATIVE_TABS_MINIMIZE_BEHAVIORS = [\n 'automatic',\n 'never',\n 'onScrollDown',\n 'onScrollUp',\n] as const;\nexport type NativeTabsMinimizeBehavior = (typeof NATIVE_TABS_MINIMIZE_BEHAVIORS)[number];\n\nexport interface ResponsiveTabsPresentation {\n compact: FixedCustomTabsPresentation;\n medium?: FixedCustomTabsPresentation;\n expanded: FixedCustomTabsPresentation;\n}\n\nexport type CustomTabsPresentationConfig =\n | {\n presentation: FixedCustomTabsPresentation;\n responsive?: never;\n customPresentationId?: never;\n }\n | {\n presentation: 'responsive';\n responsive: ResponsiveTabsPresentation;\n customPresentationId?: never;\n }\n | {\n presentation: 'custom';\n responsive?: never;\n /** Serializable registered presentation id. */\n customPresentationId: string;\n };\n\nexport type CustomTabsConfig = {\n implementation: 'custom';\n} & CustomTabsPresentationConfig;\n\nexport type CustomTabsWebConfig = CustomTabsPresentationConfig;\n\nexport interface NavigatorScreenReference {\n screenId: string;\n}\n\nexport interface NativeTabsConfig {\n implementation: 'native';\n /** Expo Router Native Tabs is alpha; minimizing is available on iOS 26+ from SDK 55. */\n minimizeBehavior?: NativeTabsMinimizeBehavior;\n /** Registered screen rendered through NativeTabs.BottomAccessory, available from SDK 55. */\n bottomAccessory?: NavigatorScreenReference;\n}\n\nexport interface JavaScriptTabsConfig {\n implementation: 'javascript';\n presentation?: JavaScriptTabsPresentation;\n}\n\nexport interface AdaptiveTabsConfig {\n /** Omission selects the canonical adaptive default. */\n implementation?: 'adaptive';\n /** Android/iOS branch. Expo Router may expose this implementation as unstable. */\n native?: NativeTabsConfig;\n /** Web branch rendered through headless custom tabs. */\n web?: CustomTabsWebConfig;\n}\n\nexport type TabsImplementationConfig =\n AdaptiveTabsConfig | CustomTabsConfig | JavaScriptTabsConfig | NativeTabsConfig;\n\ninterface NavigatorNodeBase {\n initialRouteName?: string;\n routes: RouteDefinition[];\n}\n\nexport interface SlotNavigatorNode extends NavigatorNodeBase {\n type: 'slot';\n}\n\nexport type StackNavigatorNode = NavigatorNodeBase & {\n type: 'stack';\n} & StackImplementationConfig;\n\nexport interface DrawerNavigatorNode extends NavigatorNodeBase {\n type: 'drawer';\n options?: DrawerNavigatorOptions;\n}\n\nexport type TabsNavigatorConfig = {\n type: 'tabs';\n} & TabsImplementationConfig;\n\nexport type TabsNavigatorNode = NavigatorNodeBase & TabsNavigatorConfig;\n\nexport interface SplitViewNavigatorNode extends NavigatorNodeBase {\n type: 'split-view';\n columns: {\n primary: NavigatorScreenReference;\n supplementary?: NavigatorScreenReference;\n };\n inspector?: NavigatorScreenReference;\n /** Split View is alpha and iOS-only; other platforms fall back to Slot. */\n topColumnForCollapsing?: 'primary' | 'supplementary' | 'secondary';\n}\n\nexport interface CustomNavigatorNode extends NavigatorNodeBase {\n type: 'custom';\n navigatorId: string;\n config?: Readonly<Record<string, ManifestValue>>;\n}\n\nexport type NavigatorNode =\n | CustomNavigatorNode\n | DrawerNavigatorNode\n | SlotNavigatorNode\n | SplitViewNavigatorNode\n | StackNavigatorNode\n | TabsNavigatorNode;\n\nexport interface RouteDefinition {\n name: string;\n path?: string;\n label?: string;\n icon?: IconSpec;\n /** Hide this route from primary Tabs/Drawer presentation without making it unnavigable. */\n showInPrimaryNavigation?: boolean;\n guards?: string[];\n screenId?: string;\n /** Presentation applied by the resolved parent stack implementation. */\n stackOptions?: StackScreenOptions;\n navigator?: NavigatorNode;\n}\n\nexport interface NavigatorFlows {\n onboarding?: boolean;\n authentication?: boolean;\n}\n\nexport interface NavigatorDefaults {\n tabs?: TabsImplementationConfig;\n stack?: StackImplementationConfig;\n}\n\nexport interface NavigatorPlatformConfig {\n tabs?: TabsImplementationConfig;\n stack?: StackImplementationConfig;\n}\n\nexport interface NavigatorPlatforms {\n android?: NavigatorPlatformConfig;\n ios?: NavigatorPlatformConfig;\n web?: NavigatorPlatformConfig;\n}\n\n/**\n * Serializable desired state for `AppManifest.navigator`.\n *\n * The manifest slice is the root navigator tree itself; optional authoring metadata does not add\n * a redundant `root` wrapper. The standalone Navigator capability consumes this slice directly.\n */\nexport type AppNavigatorManifest = NavigatorNode & {\n preset?: NavigatorPreset;\n flows?: NavigatorFlows;\n defaults?: NavigatorDefaults;\n platforms?: NavigatorPlatforms;\n};\n"]}
|
|
1
|
+
{"version":3,"file":"navigator.js","sourceRoot":"","sources":["../src/navigator.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,QAAQ,CAAU,CAAC;AAGpG,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,MAAM;IACN,OAAO;IACP,MAAM;IACN,YAAY;IACZ,YAAY;IACZ,kBAAkB;IAClB,QAAQ;IACR,cAAc;IACd,cAAc;IACd,oBAAoB;IACpB,aAAa;IACb,mBAAmB;IACnB,mBAAmB;IACnB,yBAAyB;IACzB,YAAY;IACZ,QAAQ;CACA,CAAC;AAGX,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,QAAQ,EAAE,YAAY,EAAE,cAAc,CAAU,CAAC;AAGvF,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,MAAM;IACN,OAAO;IACP,kBAAkB;IAClB,gBAAgB;IAChB,2BAA2B;IAC3B,iBAAiB;IACjB,WAAW;CACH,CAAC;AAGX,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAAC,MAAM,EAAE,OAAO,EAAE,kBAAkB,CAAU,CAAC;AA4C7F,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,MAAM,EAAE,OAAO,CAAU,CAAC;AAG3D,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,CAAU,CAAC;AAU7E,MAAM,CAAC,MAAM,iCAAiC,GAAG,CAAC,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,CAAU,CAAC;AAG/F,MAAM,CAAC,MAAM,2BAA2B,GAAG;IACzC,GAAG,iCAAiC;IACpC,YAAY;IACZ,QAAQ;CACA,CAAC;AAGX,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC,QAAQ,EAAE,KAAK,CAAU,CAAC;AAGxE,MAAM,CAAC,MAAM,8BAA8B,GAAG;IAC5C,WAAW;IACX,OAAO;IACP,cAAc;IACd,YAAY;CACJ,CAAC","sourcesContent":["import type { IconSpec, ManifestValue } from './types';\n\nexport const NAVIGATOR_TYPES = ['slot', 'stack', 'tabs', 'drawer', 'split-view', 'custom'] as const;\nexport type NavigatorType = (typeof NAVIGATOR_TYPES)[number];\n\nexport const NAVIGATOR_PRESETS = [\n 'slot',\n 'stack',\n 'tabs',\n 'tabs-stack',\n 'stack-tabs',\n 'stack-tabs-stack',\n 'drawer',\n 'drawer-stack',\n 'stack-drawer',\n 'stack-drawer-stack',\n 'drawer-tabs',\n 'drawer-tabs-stack',\n 'stack-drawer-tabs',\n 'stack-drawer-tabs-stack',\n 'split-view',\n 'custom',\n] as const;\nexport type NavigatorPreset = (typeof NAVIGATOR_PRESETS)[number];\n\nexport const STACK_IMPLEMENTATIONS = ['native', 'javascript', 'experimental'] as const;\nexport type StackImplementation = (typeof STACK_IMPLEMENTATIONS)[number];\n\nexport const STACK_PRESENTATIONS = [\n 'card',\n 'modal',\n 'transparentModal',\n 'containedModal',\n 'containedTransparentModal',\n 'fullScreenModal',\n 'formSheet',\n] as const;\nexport type StackPresentation = (typeof STACK_PRESENTATIONS)[number];\n\nexport const JAVASCRIPT_STACK_PRESENTATIONS = ['card', 'modal', 'transparentModal'] as const;\nexport type JavaScriptStackPresentation = (typeof JAVASCRIPT_STACK_PRESENTATIONS)[number];\n\nexport interface StackHeaderOptions {\n title?: string;\n headerShown?: boolean;\n headerTransparent?: boolean;\n headerBackVisible?: boolean;\n}\n\nexport type StackScreenOptions = StackHeaderOptions &\n (\n | {\n presentation?: Exclude<StackPresentation, 'formSheet'>;\n sheetAllowedDetents?: never;\n sheetGrabberVisible?: never;\n }\n | {\n presentation: 'formSheet';\n sheetAllowedDetents?: 'fitToContents' | number[];\n sheetGrabberVisible?: boolean;\n }\n );\n\nexport type JavaScriptStackScreenOptions = StackHeaderOptions & {\n presentation?: JavaScriptStackPresentation;\n};\n\nexport type StackImplementationConfig =\n | {\n /** Omission selects the stable native stack implementation. */\n implementation?: 'native';\n options?: StackScreenOptions;\n }\n | {\n implementation: 'javascript';\n options?: JavaScriptStackScreenOptions;\n }\n | {\n /** Expo Router Experimental Stack is alpha, native-only, and available from SDK 56. */\n implementation: 'experimental';\n options?: StackHeaderOptions;\n };\n\nexport const DRAWER_POSITIONS = ['left', 'right'] as const;\nexport type DrawerPosition = (typeof DRAWER_POSITIONS)[number];\n\nexport const DRAWER_TYPES = ['front', 'back', 'slide', 'permanent'] as const;\nexport type DrawerType = (typeof DRAWER_TYPES)[number];\n\nexport interface DrawerNavigatorOptions {\n drawerPosition?: DrawerPosition;\n drawerType?: DrawerType;\n swipeEnabled?: boolean;\n headerShown?: boolean;\n}\n\nexport const FIXED_HEADLESS_TABS_PRESENTATIONS = ['bottom', 'top', 'rail', 'sidebar'] as const;\nexport type FixedHeadlessTabsPresentation = (typeof FIXED_HEADLESS_TABS_PRESENTATIONS)[number];\n\nexport const HEADLESS_TABS_PRESENTATIONS = [\n ...FIXED_HEADLESS_TABS_PRESENTATIONS,\n 'responsive',\n 'custom',\n] as const;\nexport type HeadlessTabsPresentation = (typeof HEADLESS_TABS_PRESENTATIONS)[number];\n\nexport const JAVASCRIPT_TABS_PRESENTATIONS = ['bottom', 'top'] as const;\nexport type JavaScriptTabsPresentation = (typeof JAVASCRIPT_TABS_PRESENTATIONS)[number];\n\nexport const NATIVE_TABS_MINIMIZE_BEHAVIORS = [\n 'automatic',\n 'never',\n 'onScrollDown',\n 'onScrollUp',\n] as const;\nexport type NativeTabsMinimizeBehavior = (typeof NATIVE_TABS_MINIMIZE_BEHAVIORS)[number];\n\nexport interface ResponsiveTabsPresentation {\n compact: FixedHeadlessTabsPresentation;\n medium?: FixedHeadlessTabsPresentation;\n expanded: FixedHeadlessTabsPresentation;\n}\n\nexport type HeadlessTabsPresentationConfig =\n | {\n presentation: FixedHeadlessTabsPresentation;\n responsive?: never;\n customPresentationId?: never;\n }\n | {\n presentation: 'responsive';\n responsive: ResponsiveTabsPresentation;\n customPresentationId?: never;\n }\n | {\n presentation: 'custom';\n responsive?: never;\n /** Serializable registered presentation id. */\n customPresentationId: string;\n };\n\nexport type HeadlessTabsConfig = {\n implementation: 'headless';\n} & HeadlessTabsPresentationConfig;\n\nexport type HeadlessTabsWebConfig = HeadlessTabsPresentationConfig;\n\nexport interface NavigatorScreenReference {\n screenId: string;\n}\n\nexport interface NativeTabsConfig {\n implementation: 'native';\n /** Expo Router Native Tabs is alpha; minimizing is available on iOS 26+ from SDK 55. */\n minimizeBehavior?: NativeTabsMinimizeBehavior;\n /** Registered screen rendered through NativeTabs.BottomAccessory, available from SDK 55. */\n bottomAccessory?: NavigatorScreenReference;\n}\n\nexport interface JavaScriptTabsConfig {\n implementation: 'javascript';\n presentation?: JavaScriptTabsPresentation;\n}\n\nexport interface AdaptiveTabsConfig {\n /** Omission selects the canonical adaptive default. */\n implementation?: 'adaptive';\n /** Android/iOS branch. Expo Router may expose this implementation as unstable. */\n native?: NativeTabsConfig;\n /** Web branch rendered through headless tabs. */\n web?: HeadlessTabsWebConfig;\n}\n\nexport type TabsImplementationConfig =\n AdaptiveTabsConfig | HeadlessTabsConfig | JavaScriptTabsConfig | NativeTabsConfig;\n\ninterface NavigatorNodeBase {\n initialRouteName?: string;\n routes: RouteDefinition[];\n}\n\nexport interface SlotNavigatorNode extends NavigatorNodeBase {\n type: 'slot';\n}\n\nexport type StackNavigatorNode = NavigatorNodeBase & {\n type: 'stack';\n} & StackImplementationConfig;\n\nexport interface DrawerNavigatorNode extends NavigatorNodeBase {\n type: 'drawer';\n options?: DrawerNavigatorOptions;\n}\n\nexport type TabsNavigatorConfig = {\n type: 'tabs';\n} & TabsImplementationConfig;\n\nexport type TabsNavigatorNode = NavigatorNodeBase & TabsNavigatorConfig;\n\nexport interface SplitViewNavigatorNode extends NavigatorNodeBase {\n type: 'split-view';\n columns: {\n primary: NavigatorScreenReference;\n supplementary?: NavigatorScreenReference;\n };\n inspector?: NavigatorScreenReference;\n /** Split View is alpha and iOS-only; other platforms fall back to Slot. */\n topColumnForCollapsing?: 'primary' | 'supplementary' | 'secondary';\n}\n\nexport interface CustomNavigatorNode extends NavigatorNodeBase {\n type: 'custom';\n navigatorId: string;\n config?: Readonly<Record<string, ManifestValue>>;\n}\n\nexport type NavigatorNode =\n | CustomNavigatorNode\n | DrawerNavigatorNode\n | SlotNavigatorNode\n | SplitViewNavigatorNode\n | StackNavigatorNode\n | TabsNavigatorNode;\n\nexport interface RouteDefinition {\n name: string;\n path?: string;\n label?: string;\n icon?: IconSpec;\n /** Hide this route from primary Tabs/Drawer presentation without making it unnavigable. */\n showInPrimaryNavigation?: boolean;\n guards?: string[];\n screenId?: string;\n /** Presentation applied by the resolved parent stack implementation. */\n stackOptions?: StackScreenOptions;\n navigator?: NavigatorNode;\n}\n\nexport interface NavigatorDefaults {\n tabs?: TabsImplementationConfig;\n stack?: StackImplementationConfig;\n}\n\nexport interface NavigatorPlatformConfig {\n tabs?: TabsImplementationConfig;\n stack?: StackImplementationConfig;\n}\n\nexport interface NavigatorPlatforms {\n android?: NavigatorPlatformConfig;\n ios?: NavigatorPlatformConfig;\n web?: NavigatorPlatformConfig;\n}\n\n/**\n * Serializable desired state for `AppManifest.navigator`.\n *\n * The manifest slice is the root navigator tree itself; optional authoring metadata does not add\n * a redundant `root` wrapper. The standalone Navigator capability consumes this slice directly.\n */\nexport type AppNavigatorManifest = NavigatorNode & {\n preset?: NavigatorPreset;\n defaults?: NavigatorDefaults;\n platforms?: NavigatorPlatforms;\n};\n\nexport type {\n NavigatorCapabilityDescriptor,\n NavigatorCapabilityRequirement,\n NavigatorCapabilityTarget,\n NavigatorCapabilityVerification,\n NavigatorCatalog,\n NavigatorImplementation,\n NavigatorPresentation,\n NavigatorPresetDescriptor,\n NavigatorVerificationKind,\n NavigatorVerificationStatus,\n} from './navigator/catalog';\nexport type {\n CustomNavigatorConfigIssue,\n CustomNavigatorRegistration,\n CustomNavigatorRegistry,\n} from './navigator/extensions';\nexport type {\n NavigatorDependencyRequirement,\n NavigatorGeneratedFile,\n NavigatorGenerationBindings,\n NavigatorGenerationOptions,\n NavigatorGenerationResult,\n NavigatorScreenModule,\n} from './navigator/generation';\nexport type {\n CreateNavigatorPlanOptions,\n ExpoRouterNavigatorModule,\n NavigatorAdapterId,\n NavigatorAdapterPlan,\n NavigatorApiStability,\n NavigatorCapabilityId,\n NavigatorDiagnostic,\n NavigatorNodePlan,\n NavigatorPlan,\n NavigatorResponsiveSize,\n NavigatorRoutePlan,\n NavigatorRuntimePlatform,\n NavigatorSupportStatus,\n NavigatorValidationContext,\n ResolvedHeadlessTabsPresentation,\n ResolvedTabsImplementation,\n ResolvedTabsPresentation,\n TabsNavigatorPlan,\n} from './navigator/planning';\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ankhorage/contracts",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "12.0.0",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"ankh": {
|
|
6
6
|
"category": "contracts",
|
|
@@ -13,9 +13,9 @@
|
|
|
13
13
|
"@ankhorage/color-theory": "^0.3.0"
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
|
-
"@ankhorage/devtools": "^1.
|
|
16
|
+
"@ankhorage/devtools": "^1.12.0",
|
|
17
17
|
"@ankhorage/paradox": "^0.1.24",
|
|
18
|
-
"@types/bun": "^1.4.
|
|
18
|
+
"@types/bun": "^1.4.1",
|
|
19
19
|
"@types/node": "^25.2.3",
|
|
20
20
|
"typescript": "^5.9.3"
|
|
21
21
|
},
|
|
@@ -104,7 +104,7 @@
|
|
|
104
104
|
"CHANGELOG.md",
|
|
105
105
|
"LICENSE"
|
|
106
106
|
],
|
|
107
|
-
"packageManager": "bun@1.4.
|
|
107
|
+
"packageManager": "bun@1.4.2",
|
|
108
108
|
"repository": {
|
|
109
109
|
"type": "git",
|
|
110
110
|
"url": "git+https://github.com/ankhorage/contracts.git"
|
|
@@ -20,7 +20,7 @@ export function isAppNavigatorManifest(value: unknown): boolean {
|
|
|
20
20
|
isNavigatorNode(value) &&
|
|
21
21
|
(value.preset === undefined ||
|
|
22
22
|
(typeof value.preset === 'string' && NAVIGATOR_PRESET_SET.has(value.preset))) &&
|
|
23
|
-
|
|
23
|
+
value.flows === undefined &&
|
|
24
24
|
(value.defaults === undefined || isNavigatorDefaults(value.defaults)) &&
|
|
25
25
|
(value.platforms === undefined || isNavigatorPlatforms(value.platforms))
|
|
26
26
|
);
|
|
@@ -134,15 +134,6 @@ function isNavigatorJsonValue(value: unknown, ancestors: Set<object>): boolean {
|
|
|
134
134
|
return isValid;
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
-
/*** Validate optional app-level navigator flow intent. */
|
|
138
|
-
function isNavigatorFlows(value: unknown): boolean {
|
|
139
|
-
return (
|
|
140
|
-
isRecord(value) &&
|
|
141
|
-
isOptionalBoolean(value.onboarding) &&
|
|
142
|
-
isOptionalBoolean(value.authentication)
|
|
143
|
-
);
|
|
144
|
-
}
|
|
145
|
-
|
|
146
137
|
/*** Validate package-owned navigator defaults without requiring a navigator node type. */
|
|
147
138
|
function isNavigatorDefaults(value: unknown): boolean {
|
|
148
139
|
return (
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
|
-
CUSTOM_TABS_PRESENTATIONS,
|
|
3
2
|
DRAWER_POSITIONS,
|
|
4
3
|
DRAWER_TYPES,
|
|
5
|
-
|
|
4
|
+
FIXED_HEADLESS_TABS_PRESENTATIONS,
|
|
5
|
+
HEADLESS_TABS_PRESENTATIONS,
|
|
6
6
|
JAVASCRIPT_STACK_PRESENTATIONS,
|
|
7
7
|
JAVASCRIPT_TABS_PRESENTATIONS,
|
|
8
8
|
NATIVE_TABS_MINIMIZE_BEHAVIORS,
|
|
@@ -10,10 +10,10 @@ import {
|
|
|
10
10
|
} from '../navigator';
|
|
11
11
|
import { isOptionalBoolean, isOptionalString, isRecord } from './shared';
|
|
12
12
|
|
|
13
|
-
const
|
|
13
|
+
const HEADLESS_TABS_PRESENTATION_SET = new Set<string>(HEADLESS_TABS_PRESENTATIONS);
|
|
14
14
|
const DRAWER_POSITION_SET = new Set<string>(DRAWER_POSITIONS);
|
|
15
15
|
const DRAWER_TYPE_SET = new Set<string>(DRAWER_TYPES);
|
|
16
|
-
const
|
|
16
|
+
const FIXED_HEADLESS_TABS_PRESENTATION_SET = new Set<string>(FIXED_HEADLESS_TABS_PRESENTATIONS);
|
|
17
17
|
const JAVASCRIPT_STACK_PRESENTATION_SET = new Set<string>(JAVASCRIPT_STACK_PRESENTATIONS);
|
|
18
18
|
const JAVASCRIPT_TABS_PRESENTATION_SET = new Set<string>(JAVASCRIPT_TABS_PRESENTATIONS);
|
|
19
19
|
const NATIVE_TABS_MINIMIZE_BEHAVIOR_SET = new Set<string>(NATIVE_TABS_MINIMIZE_BEHAVIORS);
|
|
@@ -98,9 +98,9 @@ export function isTabsImplementationConfig(value: Record<string, unknown>): bool
|
|
|
98
98
|
if (value.implementation === 'native') return isFullNativeTabsConfig(value);
|
|
99
99
|
if (value.implementation === 'javascript') return isJavaScriptTabsConfig(value);
|
|
100
100
|
return (
|
|
101
|
-
value.implementation === '
|
|
101
|
+
value.implementation === 'headless' &&
|
|
102
102
|
hasNoDefinedKeys(value, ['options', 'native', 'web', 'minimizeBehavior', 'bottomAccessory']) &&
|
|
103
|
-
|
|
103
|
+
isHeadlessTabsPresentationConfig(value)
|
|
104
104
|
);
|
|
105
105
|
}
|
|
106
106
|
|
|
@@ -181,7 +181,7 @@ function isAdaptiveTabsConfig(value: Record<string, unknown>): boolean {
|
|
|
181
181
|
'bottomAccessory',
|
|
182
182
|
]) &&
|
|
183
183
|
(value.native === undefined || isNativeTabsConfig(value.native)) &&
|
|
184
|
-
(value.web === undefined ||
|
|
184
|
+
(value.web === undefined || isHeadlessTabsWebConfig(value.web))
|
|
185
185
|
);
|
|
186
186
|
}
|
|
187
187
|
|
|
@@ -237,20 +237,20 @@ function isNativeTabsFields(value: Record<string, unknown>): boolean {
|
|
|
237
237
|
);
|
|
238
238
|
}
|
|
239
239
|
|
|
240
|
-
/*** Validate the implementation-free
|
|
241
|
-
function
|
|
240
|
+
/*** Validate the implementation-free headless-tabs Web branch inside adaptive tabs. */
|
|
241
|
+
function isHeadlessTabsWebConfig(value: unknown): boolean {
|
|
242
242
|
return (
|
|
243
243
|
isRecord(value) &&
|
|
244
244
|
hasOnlyKeys(value, ['presentation', 'responsive', 'customPresentationId']) &&
|
|
245
|
-
|
|
245
|
+
isHeadlessTabsPresentationConfig(value)
|
|
246
246
|
);
|
|
247
247
|
}
|
|
248
248
|
|
|
249
|
-
/*** Validate
|
|
250
|
-
function
|
|
249
|
+
/*** Validate headless-tab presentation and its conditional serializable configuration. */
|
|
250
|
+
function isHeadlessTabsPresentationConfig(value: Record<string, unknown>): boolean {
|
|
251
251
|
if (
|
|
252
252
|
typeof value.presentation !== 'string' ||
|
|
253
|
-
!
|
|
253
|
+
!HEADLESS_TABS_PRESENTATION_SET.has(value.presentation)
|
|
254
254
|
) {
|
|
255
255
|
return false;
|
|
256
256
|
}
|
|
@@ -258,7 +258,7 @@ function isCustomTabsPresentationConfig(value: Record<string, unknown>): boolean
|
|
|
258
258
|
return false;
|
|
259
259
|
}
|
|
260
260
|
if (!isOptionalString(value.customPresentationId)) return false;
|
|
261
|
-
if (
|
|
261
|
+
if (FIXED_HEADLESS_TABS_PRESENTATION_SET.has(value.presentation)) {
|
|
262
262
|
return value.responsive === undefined && value.customPresentationId === undefined;
|
|
263
263
|
}
|
|
264
264
|
if (value.presentation === 'responsive') {
|
|
@@ -271,17 +271,18 @@ function isCustomTabsPresentationConfig(value: Record<string, unknown>): boolean
|
|
|
271
271
|
);
|
|
272
272
|
}
|
|
273
273
|
|
|
274
|
-
/*** Validate semantic compact/medium/expanded
|
|
274
|
+
/*** Validate semantic compact/medium/expanded headless-tab presentation mapping. */
|
|
275
275
|
function isResponsiveTabsPresentation(value: unknown): boolean {
|
|
276
276
|
return (
|
|
277
277
|
isRecord(value) &&
|
|
278
278
|
hasOnlyKeys(value, ['compact', 'medium', 'expanded']) &&
|
|
279
279
|
typeof value.compact === 'string' &&
|
|
280
|
-
|
|
280
|
+
FIXED_HEADLESS_TABS_PRESENTATION_SET.has(value.compact) &&
|
|
281
281
|
(value.medium === undefined ||
|
|
282
|
-
(typeof value.medium === 'string' &&
|
|
282
|
+
(typeof value.medium === 'string' &&
|
|
283
|
+
FIXED_HEADLESS_TABS_PRESENTATION_SET.has(value.medium))) &&
|
|
283
284
|
typeof value.expanded === 'string' &&
|
|
284
|
-
|
|
285
|
+
FIXED_HEADLESS_TABS_PRESENTATION_SET.has(value.expanded)
|
|
285
286
|
);
|
|
286
287
|
}
|
|
287
288
|
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
HeadlessTabsPresentation,
|
|
3
|
+
JavaScriptTabsPresentation,
|
|
4
|
+
NavigatorPreset,
|
|
5
|
+
NavigatorType,
|
|
6
|
+
StackPresentation,
|
|
7
|
+
} from '../navigator';
|
|
8
|
+
import type { NavigatorDependencyRequirement } from './generation';
|
|
9
|
+
import type {
|
|
10
|
+
NavigatorApiStability,
|
|
11
|
+
NavigatorCapabilityId,
|
|
12
|
+
NavigatorRuntimePlatform,
|
|
13
|
+
NavigatorSupportStatus,
|
|
14
|
+
} from './planning';
|
|
15
|
+
|
|
16
|
+
export type NavigatorVerificationKind =
|
|
17
|
+
| 'structural'
|
|
18
|
+
| 'generation'
|
|
19
|
+
| 'format'
|
|
20
|
+
| 'lint'
|
|
21
|
+
| 'dependency'
|
|
22
|
+
| 'typescript'
|
|
23
|
+
| 'install'
|
|
24
|
+
| 'build'
|
|
25
|
+
| 'export'
|
|
26
|
+
| 'browser'
|
|
27
|
+
| 'simulator'
|
|
28
|
+
| 'device';
|
|
29
|
+
|
|
30
|
+
export type NavigatorVerificationStatus = 'verified' | 'unverified';
|
|
31
|
+
|
|
32
|
+
export type NavigatorImplementation = 'native' | 'javascript' | 'headless' | 'experimental';
|
|
33
|
+
|
|
34
|
+
export type NavigatorPresentation =
|
|
35
|
+
| StackPresentation
|
|
36
|
+
| HeadlessTabsPresentation
|
|
37
|
+
| JavaScriptTabsPresentation
|
|
38
|
+
| 'two-column'
|
|
39
|
+
| 'three-column';
|
|
40
|
+
|
|
41
|
+
export interface NavigatorCapabilityVerification {
|
|
42
|
+
kind: NavigatorVerificationKind;
|
|
43
|
+
status: NavigatorVerificationStatus;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export interface NavigatorCapabilityTarget {
|
|
47
|
+
platform: NavigatorRuntimePlatform;
|
|
48
|
+
support: NavigatorSupportStatus;
|
|
49
|
+
verification: readonly NavigatorCapabilityVerification[];
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export interface NavigatorCapabilityRequirement {
|
|
53
|
+
id: string;
|
|
54
|
+
description: string;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export interface NavigatorCapabilityDescriptor {
|
|
58
|
+
id: NavigatorCapabilityId;
|
|
59
|
+
topology: NavigatorType;
|
|
60
|
+
implementation?: NavigatorImplementation;
|
|
61
|
+
presentation?: NavigatorPresentation;
|
|
62
|
+
stability: NavigatorApiStability;
|
|
63
|
+
targets: readonly NavigatorCapabilityTarget[];
|
|
64
|
+
dependencies: readonly NavigatorDependencyRequirement[];
|
|
65
|
+
requirements: readonly NavigatorCapabilityRequirement[];
|
|
66
|
+
incompatibilities: readonly NavigatorCapabilityId[];
|
|
67
|
+
limitations: readonly string[];
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export interface NavigatorPresetDescriptor {
|
|
71
|
+
id: NavigatorPreset;
|
|
72
|
+
description: string;
|
|
73
|
+
topology: readonly NavigatorType[];
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export interface NavigatorCatalog {
|
|
77
|
+
capabilities: readonly NavigatorCapabilityDescriptor[];
|
|
78
|
+
presets: readonly NavigatorPresetDescriptor[];
|
|
79
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { CustomNavigatorNode } from '../navigator';
|
|
2
|
+
import type { NavigatorApiStability, NavigatorRuntimePlatform } from './planning';
|
|
3
|
+
export interface CustomNavigatorConfigIssue {
|
|
4
|
+
code: string;
|
|
5
|
+
message: string;
|
|
6
|
+
path?: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface CustomNavigatorRegistration {
|
|
10
|
+
readonly id: string;
|
|
11
|
+
readonly platforms: readonly NavigatorRuntimePlatform[];
|
|
12
|
+
readonly stability: NavigatorApiStability;
|
|
13
|
+
readonly integration: 'expo-router-standard';
|
|
14
|
+
readonly router: 'stack' | 'tab';
|
|
15
|
+
readonly module: string;
|
|
16
|
+
readonly exportName: string;
|
|
17
|
+
readonly validateConfig: (
|
|
18
|
+
config: CustomNavigatorNode['config'],
|
|
19
|
+
) => readonly CustomNavigatorConfigIssue[];
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export type CustomNavigatorRegistry = Readonly<Record<string, CustomNavigatorRegistration>> & {
|
|
23
|
+
readonly [CUSTOM_NAVIGATOR_REGISTRY]: true;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
declare const CUSTOM_NAVIGATOR_REGISTRY: unique symbol;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
NavigatorCapabilityId,
|
|
3
|
+
NavigatorDiagnostic,
|
|
4
|
+
NavigatorPlan,
|
|
5
|
+
NavigatorSupportStatus,
|
|
6
|
+
} from './planning';
|
|
7
|
+
|
|
8
|
+
export interface NavigatorGeneratedFile {
|
|
9
|
+
path: string;
|
|
10
|
+
contents: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface NavigatorGenerationBindings {
|
|
14
|
+
screens: Readonly<Record<string, NavigatorScreenModule>>;
|
|
15
|
+
guards: Readonly<Record<string, NavigatorScreenModule>>;
|
|
16
|
+
iconSourceResolver?: NavigatorScreenModule;
|
|
17
|
+
tabPresentations?: Readonly<Record<string, NavigatorScreenModule>>;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface NavigatorDependencyRequirement {
|
|
21
|
+
packageName: string;
|
|
22
|
+
versionRange: string;
|
|
23
|
+
kind: 'dependency' | 'peerDependency';
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface NavigatorGenerationResult {
|
|
27
|
+
support: NavigatorSupportStatus;
|
|
28
|
+
capabilityIds: readonly NavigatorCapabilityId[];
|
|
29
|
+
dependencies: readonly NavigatorDependencyRequirement[];
|
|
30
|
+
diagnostics: readonly NavigatorDiagnostic[];
|
|
31
|
+
plan: NavigatorPlan;
|
|
32
|
+
files: readonly NavigatorGeneratedFile[];
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** Options for placing Navigator-owned files inside a consumer-owned Expo Router app shell. */
|
|
36
|
+
export interface NavigatorGenerationOptions {
|
|
37
|
+
/** Directory that receives the root navigator layout. Must be `src/app` or one of its safe descendants. */
|
|
38
|
+
rootDirectory?: string;
|
|
39
|
+
/** Emit routed screen re-export modules in addition to layouts. Defaults to true. */
|
|
40
|
+
includeScreenFiles?: boolean;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export interface NavigatorScreenModule {
|
|
44
|
+
module: string;
|
|
45
|
+
exportName: string;
|
|
46
|
+
}
|