@adelin-io/cli 0.0.0-stage → 0.1.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.
Files changed (175) hide show
  1. package/README.md +76 -2
  2. package/authoring-release.json +174 -0
  3. package/package.json +30 -4
  4. package/runtime-integrity.json +9 -0
  5. package/scripts/adelin.mjs +7768 -0
  6. package/scripts/assemble-checkout.mjs +93 -0
  7. package/scripts/local-save.mjs +513 -0
  8. package/scripts/materialize.mjs +319 -0
  9. package/scripts/runtime.mjs +8950 -0
  10. package/scripts/typecheck.mjs +72 -0
  11. package/scripts/workspace-state.mjs +183 -0
  12. package/skill/README.md +77 -0
  13. package/skill/SKILL.md +100 -0
  14. package/skill/authoring/access.md +193 -0
  15. package/skill/authoring/analytics.md +20 -0
  16. package/skill/authoring/app-memory.md +128 -0
  17. package/skill/authoring/app-requirements.md +99 -0
  18. package/skill/authoring/app-structure.md +265 -0
  19. package/skill/authoring/assets.md +117 -0
  20. package/skill/authoring/auth.md +261 -0
  21. package/skill/authoring/content-binding.md +26 -0
  22. package/skill/authoring/i18n.md +184 -0
  23. package/skill/authoring/language.md +503 -0
  24. package/skill/authoring/local-workflow.md +1665 -0
  25. package/skill/authoring/offline/connectivity.md +50 -0
  26. package/skill/authoring/offline/example.md +102 -0
  27. package/skill/authoring/offline/history-sync.md +39 -0
  28. package/skill/authoring/offline/index.md +29 -0
  29. package/skill/authoring/offline/package-storage.md +37 -0
  30. package/skill/authoring/offline/platforms.md +35 -0
  31. package/skill/authoring/offline/startup-navigation.md +53 -0
  32. package/skill/authoring/platform-files.md +616 -0
  33. package/skill/authoring/player/casting.md +47 -0
  34. package/skill/authoring/player/controls.md +95 -0
  35. package/skill/authoring/player/downloads.md +90 -0
  36. package/skill/authoring/player/drm.md +31 -0
  37. package/skill/authoring/player/index.md +39 -0
  38. package/skill/authoring/player/live-dvr.md +33 -0
  39. package/skill/authoring/player/platforms.md +47 -0
  40. package/skill/authoring/player/playback.md +42 -0
  41. package/skill/authoring/player/tracks-subtitles.md +32 -0
  42. package/skill/authoring/profiles.md +213 -0
  43. package/skill/authoring/remote-keys.md +139 -0
  44. package/skill/authoring/search.md +27 -0
  45. package/skill/authoring/store.md +85 -0
  46. package/skill/authoring/tv-text-entry.md +146 -0
  47. package/skill/design/approved/README.md +14 -0
  48. package/skill/design/approved/vesper-phone-home.jpg +0 -0
  49. package/skill/design/approved/vesper-tv-detail.jpg +0 -0
  50. package/skill/design/approved/vesper-tv-home.jpg +0 -0
  51. package/skill/design/design-guide.md +610 -0
  52. package/skill/design/edge-to-edge.md +66 -0
  53. package/skill/design/icons.md +50 -0
  54. package/skill/design/responsive-layout.md +175 -0
  55. package/skill/design/safe-area.md +221 -0
  56. package/skill/design/streaming-playbook.md +131 -0
  57. package/skill/design/visual-review.md +150 -0
  58. package/skill/examples/README.md +24 -0
  59. package/skill/examples/cinema/DESIGN.md +58 -0
  60. package/skill/examples/cinema/app.tsx +17 -0
  61. package/skill/examples/cinema/assets/logo.png +0 -0
  62. package/skill/examples/cinema/components/Action.tsx +40 -0
  63. package/skill/examples/cinema/components/Action.tv.tsx +44 -0
  64. package/skill/examples/cinema/components/CatalogGrid.tsx +31 -0
  65. package/skill/examples/cinema/components/ContinueRail.tsx +98 -0
  66. package/skill/examples/cinema/components/Feedback.tsx +28 -0
  67. package/skill/examples/cinema/components/Field.tsx +41 -0
  68. package/skill/examples/cinema/components/LibraryRail.tsx +46 -0
  69. package/skill/examples/cinema/components/PlayAction.tsx +29 -0
  70. package/skill/examples/cinema/components/Root.tsx +59 -0
  71. package/skill/examples/cinema/components/Shell.tsx +70 -0
  72. package/skill/examples/cinema/components/Tab.tsx +22 -0
  73. package/skill/examples/cinema/components/TitleCard.tsx +68 -0
  74. package/skill/examples/cinema/components/TitleMeta.tsx +36 -0
  75. package/skill/examples/cinema/locales/en.ts +211 -0
  76. package/skill/examples/cinema/locales/lt.ts +211 -0
  77. package/skill/examples/cinema/preview/phone-home.jpg +0 -0
  78. package/skill/examples/cinema/preview/tv-detail.jpg +0 -0
  79. package/skill/examples/cinema/preview/tv-home.jpg +0 -0
  80. package/skill/examples/cinema/screens/portrait/Account.tsx +110 -0
  81. package/skill/examples/cinema/screens/portrait/Browse.tsx +73 -0
  82. package/skill/examples/cinema/screens/portrait/Detail.tsx +159 -0
  83. package/skill/examples/cinema/screens/portrait/Home.tsx +196 -0
  84. package/skill/examples/cinema/screens/portrait/Player.tsx +299 -0
  85. package/skill/examples/cinema/screens/portrait/Search.tsx +46 -0
  86. package/skill/examples/cinema/screens/portrait/Search.tv.tsx +55 -0
  87. package/skill/examples/cinema/screens/portrait/SignIn.tsx +101 -0
  88. package/skill/examples/cinema/screens/portrait/SignUp.tsx +106 -0
  89. package/skill/examples/cinema/store.tsx +132 -0
  90. package/skill/examples/cinema/theme.ts +32 -0
  91. package/skill/examples/documentary/DESIGN.md +33 -0
  92. package/skill/examples/documentary/app.tsx +17 -0
  93. package/skill/examples/documentary/components/Action.tsx +43 -0
  94. package/skill/examples/documentary/components/CatalogGrid.tsx +47 -0
  95. package/skill/examples/documentary/components/Feedback.tsx +27 -0
  96. package/skill/examples/documentary/components/Field.tsx +33 -0
  97. package/skill/examples/documentary/components/LibraryRail.tsx +47 -0
  98. package/skill/examples/documentary/components/Root.tsx +62 -0
  99. package/skill/examples/documentary/components/Shell.tsx +93 -0
  100. package/skill/examples/documentary/components/StoryCard.tsx +53 -0
  101. package/skill/examples/documentary/components/StoryMeta.tsx +22 -0
  102. package/skill/examples/documentary/preview/phone-home.jpg +0 -0
  103. package/skill/examples/documentary/preview/tv-detail.jpg +0 -0
  104. package/skill/examples/documentary/preview/tv-home.jpg +0 -0
  105. package/skill/examples/documentary/screens/portrait/Account.tsx +97 -0
  106. package/skill/examples/documentary/screens/portrait/Browse.tsx +71 -0
  107. package/skill/examples/documentary/screens/portrait/Detail.tsx +133 -0
  108. package/skill/examples/documentary/screens/portrait/Home.tsx +89 -0
  109. package/skill/examples/documentary/screens/portrait/Player.tsx +116 -0
  110. package/skill/examples/documentary/screens/portrait/Search.tsx +48 -0
  111. package/skill/examples/documentary/screens/portrait/SignIn.tsx +96 -0
  112. package/skill/examples/documentary/screens/portrait/SignUp.tsx +101 -0
  113. package/skill/examples/documentary/store.tsx +115 -0
  114. package/skill/examples/documentary/theme.ts +20 -0
  115. package/skill/examples/series/DESIGN.md +55 -0
  116. package/skill/examples/series/app.tsx +17 -0
  117. package/skill/examples/series/components/Action.tsx +42 -0
  118. package/skill/examples/series/components/CatalogGrid.tsx +43 -0
  119. package/skill/examples/series/components/ContinueRail.tsx +78 -0
  120. package/skill/examples/series/components/Feedback.tsx +26 -0
  121. package/skill/examples/series/components/Field.tsx +34 -0
  122. package/skill/examples/series/components/LibraryRail.tsx +38 -0
  123. package/skill/examples/series/components/OutcomeNote.tsx +28 -0
  124. package/skill/examples/series/components/PlayAction.tsx +29 -0
  125. package/skill/examples/series/components/RestoreAction.tsx +33 -0
  126. package/skill/examples/series/components/Root.tsx +75 -0
  127. package/skill/examples/series/components/SaveTitle.tsx +34 -0
  128. package/skill/examples/series/components/Shell.tsx +75 -0
  129. package/skill/examples/series/components/TitleCard.tsx +62 -0
  130. package/skill/examples/series/components/UnlockAction.tsx +10 -0
  131. package/skill/examples/series/preview/phone-home.jpg +0 -0
  132. package/skill/examples/series/preview/tv-detail.jpg +0 -0
  133. package/skill/examples/series/preview/tv-home.jpg +0 -0
  134. package/skill/examples/series/screens/portrait/Account.tsx +125 -0
  135. package/skill/examples/series/screens/portrait/Browse.tsx +61 -0
  136. package/skill/examples/series/screens/portrait/Detail.tsx +231 -0
  137. package/skill/examples/series/screens/portrait/Home.tsx +109 -0
  138. package/skill/examples/series/screens/portrait/MyList.tsx +44 -0
  139. package/skill/examples/series/screens/portrait/Plans.tsx +131 -0
  140. package/skill/examples/series/screens/portrait/Player.tsx +138 -0
  141. package/skill/examples/series/screens/portrait/Profiles.tsx +103 -0
  142. package/skill/examples/series/screens/portrait/Search.tsx +50 -0
  143. package/skill/examples/series/screens/portrait/SignIn.tsx +94 -0
  144. package/skill/examples/series/screens/portrait/SignUp.tsx +100 -0
  145. package/skill/examples/series/store.tsx +192 -0
  146. package/skill/examples/series/theme.ts +32 -0
  147. package/skill/guides/final-pricing-capabilities.md +13 -0
  148. package/skill/reference/api.md +842 -0
  149. package/skill/reference/components.md +1782 -0
  150. package/skill/reference/packages.md +24 -0
  151. package/skill/scripts/assemble-checkout.mjs +93 -0
  152. package/skill/scripts/local-save.mjs +513 -0
  153. package/skill/scripts/materialize.mjs +319 -0
  154. package/skill/scripts/workspace-state.mjs +183 -0
  155. package/types/adelin-access.d.ts +70 -0
  156. package/types/adelin-analytics.d.ts +5 -0
  157. package/types/adelin-assets.d.ts +26 -0
  158. package/types/adelin-auth.d.ts +37 -0
  159. package/types/adelin-content.d.ts +112 -0
  160. package/types/adelin-device.d.ts +195 -0
  161. package/types/adelin-downloads.d.ts +47 -0
  162. package/types/adelin-env.d.ts +8 -0
  163. package/types/adelin-globals.d.ts +19 -0
  164. package/types/adelin-i18n.d.ts +31 -0
  165. package/types/adelin-native-stack.d.ts +178 -0
  166. package/types/adelin-navigation.d.ts +264 -0
  167. package/types/adelin-profiles.d.ts +51 -0
  168. package/types/adelin-react.d.ts +49 -0
  169. package/types/adelin-reanimated.d.ts +376 -0
  170. package/types/adelin-storage.d.ts +9 -0
  171. package/types/adelin-store.d.ts +74 -0
  172. package/types/adelin-ui.d.ts +1518 -0
  173. package/types/adelin-utils.d.ts +7 -0
  174. package/types/adelin-worklets.d.ts +15 -0
  175. package/workspace-tsconfig.json +53 -0
@@ -0,0 +1,264 @@
1
+ /** Canonical authored navigation declarations for an Adelin workspace, mirroring `@react-navigation/native`. */
2
+ declare module "@adelin/navigation" {
3
+ type DialectValue = import("@adelin/content").DialectValue;
4
+ type Node = {} | null | undefined;
5
+ type Keyof<T extends {}> = Extract<keyof T, string>;
6
+ type UnionToIntersection<U> = (U extends unknown ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
7
+ type NavigateOptions = { merge?: boolean; pop?: boolean };
8
+ type NavigateArgs<P extends {}, R extends keyof P> = R extends unknown
9
+ ? undefined extends P[R] ? [screen: R, params?: P[R], options?: NavigateOptions] : [screen: R, params: P[R], options?: NavigateOptions]
10
+ : never;
11
+ type NavigateObject<P extends {}, R extends keyof P> = R extends unknown
12
+ ? { name: R; params?: P[R]; path?: string; merge?: boolean; pop?: boolean }
13
+ : never;
14
+ type ParamArgs<P extends {}, R extends keyof P> = R extends unknown ? undefined extends P[R] ? [screen: R, params?: P[R]] : [screen: R, params: P[R]] : never;
15
+ type EventMapBase = Record<string, { data?: unknown; canPreventDefault?: boolean }>;
16
+ type EventMapCore<State> = {
17
+ focus: { data: undefined };
18
+ blur: { data: undefined };
19
+ state: { data: { state: State } };
20
+ beforeRemove: { data: { action: NavigationAction }; canPreventDefault: true };
21
+ };
22
+ type EventListener<M extends EventMapBase, E extends keyof M> = (
23
+ e: EventArg<E, M[E]["canPreventDefault"] extends true ? true : false, M[E]["data"]>,
24
+ ) => void;
25
+ class ParamStore<T extends [unknown, unknown, unknown]> {
26
+ protected ""?: T;
27
+ }
28
+ type Context<T> = {
29
+ Provider: (props: { value: T; children?: Node }) => unknown;
30
+ Consumer: (props: { children: (value: T) => Node }) => unknown;
31
+ };
32
+
33
+ export type AuthoredComponent = (props: never) => unknown;
34
+
35
+ /** Every screen name a navigator registers, mapped to its params (`undefined` for none). */
36
+ export type ParamListBase = Record<string, object | undefined>;
37
+ /** An action a navigator handles, as `CommonActions` and `StackActions` create it. */
38
+ export type NavigationAction = { readonly type: string; readonly payload?: object; readonly source?: string; readonly target?: string };
39
+ /** One route on the stack: its key, name and params. */
40
+ export type Route<Name extends string = string, Params = object | undefined> = Readonly<{ key: string; name: Name; path?: string }> &
41
+ (undefined extends Params ? Readonly<{ params?: Readonly<Params> }> : Readonly<{ params: Readonly<Params> }>);
42
+ /** The route of screen `N` in param list `P`. */
43
+ export type RouteProp<P extends ParamListBase, N extends keyof P = Keyof<P>> = Route<Extract<N, string>, P[N]>;
44
+ /** A navigator's state: its routes and which one is shown. */
45
+ export interface NavigationState<P extends {} = ParamListBase> {
46
+ index?: number;
47
+ key?: string;
48
+ type?: string;
49
+ stale?: boolean;
50
+ routeNames?: Keyof<P>[];
51
+ history?: Record<string, unknown>[];
52
+ routes: { name: string; key?: string; path?: string; params?: Record<string, unknown>; state?: NavigationState }[];
53
+ preloadedRoutes?: { name: string; key?: string; path?: string; params?: Record<string, unknown>; state?: NavigationState }[];
54
+ }
55
+ /** The value a listener receives; `preventDefault` exists only where the action can be stopped. */
56
+ export type EventArg<EventName, CanPreventDefault extends boolean | undefined = false, Data = undefined> = { readonly type: EventName; readonly target?: string } &
57
+ (CanPreventDefault extends true ? { readonly defaultPrevented: boolean; preventDefault(): void } : {}) &
58
+ (undefined extends Data ? { readonly data?: Readonly<Data> } : { readonly data: Readonly<Data> });
59
+ /** The navigation object a screen of navigator `P` receives. */
60
+ export type NavigationProp<
61
+ P extends {},
62
+ N extends keyof P = Keyof<P>,
63
+ NavigatorID extends string | undefined = string | undefined,
64
+ State extends NavigationState<any> = NavigationState<P>,
65
+ ScreenOptions extends {} = {},
66
+ EventMap extends EventMapBase = {},
67
+ > = {
68
+ dispatch(action: NavigationAction | ((state: Readonly<State>) => NavigationAction)): void;
69
+ navigate<R extends keyof P>(...args: NavigateArgs<P, R>): void;
70
+ navigate<R extends keyof P>(options: NavigateObject<P, R>): void;
71
+ /** @deprecated Use navigate(name, params, { pop: true }). */
72
+ navigateDeprecated<R extends keyof P>(...args: ParamArgs<P, R>): void;
73
+ preload<R extends keyof P>(...args: ParamArgs<P, R>): void;
74
+ push<R extends keyof P>(...args: ParamArgs<P, R>): void;
75
+ replace<R extends keyof P>(...args: ParamArgs<P, R>): void;
76
+ pop(count?: number): void;
77
+ popTo<R extends keyof P>(...args: NavigateArgs<P, R>): void;
78
+ popToTop(): void;
79
+ reset(state: NavigationState): void;
80
+ goBack(): void;
81
+ isFocused(): boolean;
82
+ canGoBack(): boolean;
83
+ getId(): string | undefined;
84
+ getParent<T = NavigationProp<ParamListBase> | undefined>(id?: NavigatorID): T;
85
+ getState(): State;
86
+ setParams(params: P[N] extends undefined ? undefined : Partial<P[N]>): void;
87
+ replaceParams(params: P[N] extends undefined ? undefined : P[N]): void;
88
+ addListener<E extends Keyof<EventMap & EventMapCore<State>>>(type: E, callback: EventListener<EventMap & EventMapCore<State>, E>): () => void;
89
+ removeListener<E extends Keyof<EventMap & EventMapCore<State>>>(type: E, callback: EventListener<EventMap & EventMapCore<State>, E>): void;
90
+ } & ParamStore<[P, N, EventMap]>;
91
+ type ParamsOf<X> = X extends ParamStore<[infer T, unknown, unknown]> ? T : never;
92
+ type RouteNameOf<X> = X extends ParamStore<[unknown, infer R, unknown]> ? R : string;
93
+ /** A screen's navigation combined with an enclosing navigator's, so either's screens can be reached. */
94
+ export type CompositeNavigationProp<A extends NavigationProp<any, any, any, any, any, any>, B extends NavigationProp<any, any, any, any, any, any>> = Omit<A & B, keyof NavigationProp<{}>> &
95
+ NavigationProp<ParamsOf<A> & ParamsOf<B>, RouteNameOf<A>>;
96
+ /** Screen props whose navigation also reaches an enclosing navigator's screens. */
97
+ export type CompositeScreenProps<
98
+ A extends { navigation: NavigationProp<any, any, any, any, any, any>; route: RouteProp<any, any> },
99
+ B extends { navigation: NavigationProp<any, any, any, any, any, any> },
100
+ > = { navigation: CompositeNavigationProp<A["navigation"], B["navigation"]>; route: A["route"] };
101
+ /** Params that open a screen of a nested navigator. */
102
+ export type NavigatorScreenParams<P extends {}> =
103
+ | { screen?: never; params?: never; path?: string; state: NavigationState | undefined }
104
+ | {
105
+ [R in keyof P]: undefined extends P[R]
106
+ ? { screen: R; params?: P[R]; merge?: boolean; initial?: boolean; path?: string; pop?: boolean; state?: never }
107
+ : { screen: R; params: P[R]; merge?: boolean; initial?: boolean; path?: string; pop?: boolean; state?: never };
108
+ }[keyof P];
109
+ type FontStyle = { fontFamily: string; fontWeight: "normal" | "bold" | "100" | "200" | "300" | "400" | "500" | "600" | "700" | "800" | "900" };
110
+ /** The colours and fonts a NavigationContainer theme provides. */
111
+ export interface Theme {
112
+ dark: boolean;
113
+ colors: { primary: string; background: string; card: string; text: string; border: string; notification: string };
114
+ fonts: { regular: FontStyle; medium: FontStyle; bold: FontStyle; heavy: FontStyle };
115
+ }
116
+ type ContainerEventMap = {
117
+ ready: { data: undefined };
118
+ state: { data: { state: NavigationState | undefined } };
119
+ options: { data: { options: object } };
120
+ };
121
+ /** The navigation object of the whole app, reachable outside any screen. */
122
+ export type NavigationContainerRef<P extends {}> = Pick<
123
+ NavigationProp<P>,
124
+ "dispatch" | "navigate" | "preload" | "reset" | "goBack" | "isFocused" | "canGoBack" | "getId" | "getState" | "setParams" | "replaceParams"
125
+ > & {
126
+ resetRoot(state?: NavigationState): void;
127
+ getRootState(): NavigationState | undefined;
128
+ getCurrentRoute(): Route | undefined;
129
+ getCurrentOptions(): object | undefined;
130
+ isReady(): boolean;
131
+ addListener<E extends Keyof<ContainerEventMap>>(type: E, callback: EventListener<ContainerEventMap, E>): () => void;
132
+ removeListener<E extends Keyof<ContainerEventMap>>(type: E, callback: EventListener<ContainerEventMap, E>): void;
133
+ };
134
+ type NavigationContainerRefWithCurrent<P extends {}> = NavigationContainerRef<P> & { current: NavigationContainerRef<P> | null };
135
+ type StaticScreens = Record<string, unknown>;
136
+ type ParamsForStaticScreen<S> = S extends { screen: infer C } ? ParamsForStaticScreen<C>
137
+ : S extends { config: { screens?: StaticScreens } } ? NavigatorScreenParams<StaticParamList<S>> | undefined
138
+ : S extends (props: { route: { params: infer Params } }) => unknown ? (unknown extends Params ? undefined : Params)
139
+ : undefined;
140
+ type StaticScreensParamList<S> = { [K in Keyof<S & {}>]: ParamsForStaticScreen<(S & {})[K]> };
141
+ type StaticGroupsParamList<G> = G extends Record<string, { screens: StaticScreens }> ? UnionToIntersection<StaticScreensParamList<G[keyof G]["screens"]>> : {};
142
+ /** A static-config screen's props: its route with the params type given. */
143
+ export type StaticScreenProps<T extends Record<string, unknown> | undefined> = { route: { params: T } };
144
+ /** The param list of a navigator made from a static configuration. */
145
+ export type StaticParamList<T extends { config: { screens?: StaticScreens; groups?: Record<string, { screens: StaticScreens }> } }> = StaticScreensParamList<
146
+ T["config"]["screens"]
147
+ > &
148
+ StaticGroupsParamList<T["config"]["groups"]>;
149
+ interface NavigationContainerProps {
150
+ theme?: Theme;
151
+ ref?: { current: NavigationContainerRef<any> | null } | null;
152
+ onReady?: () => void;
153
+ onStateChange?: (state: Readonly<NavigationState> | undefined) => void;
154
+ onUnhandledAction?: (action: Readonly<NavigationAction>) => void;
155
+ initialState?: NavigationState;
156
+ fallback?: Node;
157
+ direction?: "ltr" | "rtl";
158
+ documentTitle?: { enabled?: boolean; formatter?: (options: Record<string, any> | undefined, route: Route | undefined) => string };
159
+ navigationInChildEnabled?: boolean;
160
+ children?: Node;
161
+ }
162
+
163
+ /** The app's one navigation tree, wrapped around the root stack. */
164
+ export function NavigationContainer(props: NavigationContainerProps): unknown;
165
+ /** The container without linking, document title or `direction`. */
166
+ export function BaseNavigationContainer(props: Omit<NavigationContainerProps, "fallback" | "direction" | "documentTitle">): unknown;
167
+ /** Makes the NavigationContainer inside it a separate tree: its own screens, Back and ref. */
168
+ export function NavigationIndependentTree(props: { children?: Node }): unknown;
169
+ /** True between a NavigationIndependentTree and the container inside it. */
170
+ export function useNavigationIndependentTree(): boolean;
171
+ /** For server rendering only; on a device it renders its children unchanged. */
172
+ export function ServerContainer(props: { location: { pathname: string; search?: string }; children?: Node }): unknown;
173
+ /** The navigation object of the screen it is called in. */
174
+ export function useNavigation<T = NavigationProp<ParamListBase>>(): T;
175
+ /** The route of the screen it is called in: its key and params. */
176
+ export function useRoute(): { key: string; name: string; params: Record<string, DialectValue> };
177
+ export function useRoute<T extends Route>(): T;
178
+ /** Runs the effect each time the screen gains focus; wrap it in useCallback. */
179
+ export function useFocusEffect(effect: () => void | (() => void)): void;
180
+ /** Whether the screen it is called in is focused. */
181
+ export function useIsFocused(): boolean;
182
+ /** A value selected from the enclosing navigator's state. */
183
+ export function useNavigationState<P extends ParamListBase = ParamListBase, T = unknown>(selector: (state: NavigationState<P>) => T): T;
184
+ /** Asks the callback before the screen is removed while `preventRemove` is true. */
185
+ export function usePreventRemove(preventRemove: boolean, callback: (options: { data: { action: NavigationAction } }) => void): void;
186
+ /** The NavigationContainer theme. */
187
+ export function useTheme(): Theme;
188
+ /** Scrolls the referenced list to the top when its screen's section is chosen again. */
189
+ export function useScrollToTop(ref: { current: unknown }): void;
190
+ /** The text direction the NavigationContainer uses. */
191
+ export function useLocale(): { direction: "ltr" | "rtl" };
192
+ /** A ref to the app's navigation object, made inside a component. */
193
+ export function useNavigationContainerRef<P extends {} = ParamListBase>(): NavigationContainerRefWithCurrent<P>;
194
+ /** A ref to the app's navigation object, made at the top of a file. */
195
+ export function createNavigationContainerRef<P extends {} = ParamListBase>(): NavigationContainerRefWithCurrent<P>;
196
+ /** Action creators every navigator handles, passed to navigation.dispatch. */
197
+ export const CommonActions: {
198
+ goBack(): NavigationAction;
199
+ navigate(name: string, params?: object, options?: NavigateOptions): NavigationAction;
200
+ navigate(options: { name: string; params?: object; path?: string; merge?: boolean; pop?: boolean }): NavigationAction;
201
+ /** @deprecated Use navigate(name, params, { pop: true }). */
202
+ navigateDeprecated(name: string, params?: object): NavigationAction;
203
+ preload(name: string, params?: object): NavigationAction;
204
+ reset(state: NavigationState): NavigationAction;
205
+ setParams(params: object): NavigationAction;
206
+ replaceParams(params: object): NavigationAction;
207
+ };
208
+ /** Stack action creators, passed to navigation.dispatch. */
209
+ export const StackActions: {
210
+ replace(name: string, params?: object): NavigationAction;
211
+ push(name: string, params?: object): NavigationAction;
212
+ pop(count?: number): NavigationAction;
213
+ popToTop(): NavigationAction;
214
+ popTo(name: string, params?: object, options?: { merge?: boolean }): NavigationAction;
215
+ };
216
+ /** The light theme NavigationContainer uses by default. */
217
+ export const DefaultTheme: Theme;
218
+ /** The dark theme. */
219
+ export const DarkTheme: Theme;
220
+ /** Provides `value` to useTheme below it. */
221
+ export function ThemeProvider(props: { value: Theme; children?: Node }): unknown;
222
+ /** The theme context useTheme reads. */
223
+ export const ThemeContext: Context<Theme | undefined>;
224
+ /** The navigation object of the enclosing screen. */
225
+ export const NavigationContext: Context<NavigationProp<ParamListBase> | undefined>;
226
+ /** The route of the enclosing screen. */
227
+ export const NavigationRouteContext: Context<Route | undefined>;
228
+ /** The text direction of the NavigationContainer. */
229
+ export const LocaleDirContext: Context<"ltr" | "rtl">;
230
+ /** A pressable text that runs its `onPress`, then navigates to `screen` or dispatches `action`; other props are Text props. */
231
+ export function Link(props: ({ screen: string; params?: object; action?: NavigationAction } | { screen?: undefined; params?: undefined; action: NavigationAction }) & Omit<import("@adelin/ui").TextProps, "style" | "children" | "onPress"> & {
232
+ style?: unknown;
233
+ onPress?: (event: { preventDefault(): void; defaultPrevented?: boolean }) => void;
234
+ children?: Node;
235
+ }): unknown;
236
+ /** The focused route at the bottom of a nested state. */
237
+ export function findFocusedRoute(state: NavigationState): Route | undefined;
238
+ /** The name of the focused screen inside the navigator a route renders. */
239
+ export function getFocusedRouteNameFromRoute(route: Partial<Route>): string | undefined;
240
+ /** The root component of a navigator made from a static configuration. */
241
+ export function createStaticNavigation(tree: { config: object }): (props: Omit<NavigationContainerProps, "children">) => unknown;
242
+ /** @deprecated Use RootStack.getComponent(). */
243
+ export function createComponentForStaticNavigation(tree: { config: object }, displayName: string): () => unknown;
244
+ /** The app-wide navigation object, for callbacks outside any screen. */
245
+ export const appNavigation: NavigationProp<ParamListBase>;
246
+
247
+ export interface AppConfig {
248
+ name: string;
249
+ version: string;
250
+ root: AuthoredComponent;
251
+ /** A separate authored entry for explicitly enabled offline startup. */
252
+ offline?: { root: AuthoredComponent };
253
+ statusBar?: { style?: string };
254
+ onBack?: () => void;
255
+ /** TV text entry currently uses the app keyboard for either value; omit this setting. */
256
+ tvKeyboard?: "custom" | "native";
257
+ /** One shared download library per device; `perAccount: true` gives each signed-in account its own. */
258
+ downloads?: { perAccount?: boolean };
259
+ /** Persistent visual direction for later app edits. */
260
+ designIntent?: { audience: string; thesis: string; palette: string; typography: string; composition: string; motif: string };
261
+ }
262
+ /** The application metadata and freely authored root component. */
263
+ export function defineApp(config: AppConfig): AppConfig;
264
+ }
@@ -0,0 +1,51 @@
1
+ // Viewer profiles, each profile's saved titles and watch progress; call them inside createAsyncThunk.
2
+ declare module "@adelin/profiles" {
3
+ /** One profile of the signed-in viewer. */
4
+ export interface Profile {
5
+ readonly id: string;
6
+ readonly name: string;
7
+ readonly avatar: string | null;
8
+ readonly isDefault: boolean;
9
+ /** The profile's language, or null to follow the device. */
10
+ readonly language: string | null;
11
+ }
12
+
13
+ /** The signed-in viewer's profiles and the one chosen on this device. */
14
+ export const profiles: {
15
+ list(): Promise<Profile[]>;
16
+ create(input: Readonly<{ name: string; avatar?: string; language?: string | null }>): Promise<Profile>;
17
+ update(id: string, input: Readonly<{ name?: string; avatar?: string; language?: string | null }>): Promise<Profile>;
18
+ remove(id: string): Promise<void>;
19
+ select(id: string): Promise<void>;
20
+ active(): Promise<string | null>;
21
+ };
22
+
23
+ /** The content entry ids a profile saved. */
24
+ export const favorites: {
25
+ list(profileId: string): Promise<string[]>;
26
+ add(profileId: string, entryId: string): Promise<void>;
27
+ remove(profileId: string, entryId: string): Promise<void>;
28
+ };
29
+
30
+ /** A profile's place in one title, in seconds. */
31
+ export interface Progress {
32
+ readonly entryId: string;
33
+ readonly position: number;
34
+ readonly duration: number;
35
+ readonly finished: boolean;
36
+ readonly watched: boolean;
37
+ }
38
+
39
+ /** Where a profile stopped watching; the player saves it by itself. */
40
+ export const progress: {
41
+ list(profileId: string): Promise<Progress[]>;
42
+ get(profileId: string, entryId: string): Promise<Progress | null>;
43
+ clear(profileId: string, entryId: string): Promise<void>;
44
+ /** The ids watched within this title: the entry itself and its episodes. */
45
+ watched(profileId: string, entryId: string): Promise<string[]>;
46
+ /** Which of these entry ids are watched, in the order given: exact ids only (a title does not count its episodes), at most 100. */
47
+ watchedAmong(profileId: string, entryIds: readonly string[]): Promise<string[]>;
48
+ markWatched(profileId: string, entryId: string): Promise<void>;
49
+ markUnwatched(profileId: string, entryId: string): Promise<void>;
50
+ };
51
+ }
@@ -0,0 +1,49 @@
1
+ // The portable React hooks and React's types an Adelin workspace may import; anything else is TS2305.
2
+ declare module "@adelin/react" {
3
+ namespace React {
4
+ export type ReactNode = unknown;
5
+ /** The workspace's JSX element type, which is `any`. */
6
+ export type ReactElement<P = unknown, T = unknown> = any;
7
+ export namespace JSX {
8
+ export type Element = ReactElement;
9
+ }
10
+ export type Key = string | number | bigint;
11
+ export type JSXElementConstructor<P> = (props: P) => ReactNode;
12
+ export interface FunctionComponent<P = {}> {
13
+ (props: P): ReactNode;
14
+ displayName?: string;
15
+ }
16
+ export type FC<P = {}> = FunctionComponent<P>;
17
+ export type ComponentType<P = {}> = FunctionComponent<P>;
18
+ export type ElementType<P = any> = JSXElementConstructor<P>;
19
+ export type PropsWithChildren<P = unknown> = P & { children?: ReactNode };
20
+ /** A component's props: `ComponentProps<typeof Text>`. */
21
+ export type ComponentProps<T> = T extends (props: infer P) => unknown ? P : {};
22
+ export type ComponentPropsWithoutRef<T> = ComponentProps<T>;
23
+ export type SetStateAction<S> = S | ((prevState: S) => S);
24
+ export type Dispatch<A> = (value: A) => void;
25
+ export type Reducer<S, A> = (prevState: S, action: A) => S;
26
+ export type RefObject<T> = { current: T };
27
+ export type MutableRefObject<T> = { current: T };
28
+ export type DependencyList = readonly unknown[];
29
+ export type EffectCallback = () => void | (() => void);
30
+ /** Local state cell. */
31
+ export function useState<S>(init: S | (() => S)): [S, (v: S | ((prev: S) => S)) => void];
32
+ export function useState<S = undefined>(): [S | undefined, (v: S | undefined | ((prev: S | undefined) => S | undefined)) => void];
33
+ /** Effect with a required dependency list; `[]` runs on mount. */
34
+ export function useEffect(effect: () => void | (() => void), deps: readonly unknown[]): void;
35
+ /** Derived value recomputed when a dependency changes. */
36
+ export function useMemo<T>(fn: () => T, deps: readonly unknown[]): T;
37
+ /** Returns the handler itself. */
38
+ export function useCallback<F extends (...a: never[]) => unknown>(fn: F, deps: readonly unknown[]): F;
39
+ /** Mutable value that does not re-render; as element `ref={}` only a Carousel takes it (`useRef<CarouselRef>(null)`). */
40
+ export function useRef<T>(initial: T): { current: T };
41
+ export function useRef<T>(initial: T | null): { current: T | null };
42
+ /** Local reducer state. */
43
+ export function useReducer<S, A>(reducer: (s: S, a: A) => S, initial: S): [S, (a: A) => void];
44
+ /** Reads a navigation context: ThemeContext, NavigationContext, NavigationRouteContext or LocaleDirContext. */
45
+ export function useContext<T>(context: { Provider: (props: { value: T; children?: never }) => unknown }): T;
46
+ }
47
+ /** Named imports, `import React from "@adelin/react"` and `import * as React` all reach these hooks. */
48
+ export = React;
49
+ }