react-native-terra-ui 0.1.0 → 0.2.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 (304) hide show
  1. package/CHANGELOG.md +90 -0
  2. package/lib/module/components/avatar/Avatar.js +118 -35
  3. package/lib/module/components/avatar/Avatar.js.map +1 -1
  4. package/lib/module/components/avatar/index.js.map +1 -1
  5. package/lib/module/components/box/Box.js +15 -2
  6. package/lib/module/components/box/Box.js.map +1 -1
  7. package/lib/module/components/box/index.js.map +1 -1
  8. package/lib/module/components/box/utils.js +5 -2
  9. package/lib/module/components/box/utils.js.map +1 -1
  10. package/lib/module/components/button/Button.js +7 -14
  11. package/lib/module/components/button/Button.js.map +1 -1
  12. package/lib/module/components/button/index.js.map +1 -1
  13. package/lib/module/components/chip/Chip.js +372 -0
  14. package/lib/module/components/chip/Chip.js.map +1 -0
  15. package/lib/module/components/chip/index.js +4 -0
  16. package/lib/module/components/chip/index.js.map +1 -0
  17. package/lib/module/components/chip/types.js +2 -0
  18. package/lib/module/components/chip/types.js.map +1 -0
  19. package/lib/module/components/chip/utils.js +36 -0
  20. package/lib/module/components/chip/utils.js.map +1 -0
  21. package/lib/module/components/empty-state/EmptyState.js +200 -0
  22. package/lib/module/components/empty-state/EmptyState.js.map +1 -0
  23. package/lib/module/components/empty-state/index.js +4 -0
  24. package/lib/module/components/empty-state/index.js.map +1 -0
  25. package/lib/module/components/empty-state/types.js +2 -0
  26. package/lib/module/components/empty-state/types.js.map +1 -0
  27. package/lib/module/components/header/Header.js.map +1 -1
  28. package/lib/module/components/header/header-buttons.js +31 -36
  29. package/lib/module/components/header/header-buttons.js.map +1 -1
  30. package/lib/module/components/header/index.js +1 -1
  31. package/lib/module/components/header/index.js.map +1 -1
  32. package/lib/module/components/header/parts/HeaderGradientOverlay.js +38 -0
  33. package/lib/module/components/header/parts/HeaderGradientOverlay.js.map +1 -0
  34. package/lib/module/components/header/variants/LargeTitleHeader/index.js +71 -101
  35. package/lib/module/components/header/variants/LargeTitleHeader/index.js.map +1 -1
  36. package/lib/module/components/header/variants/TitleHeader/index.js +34 -65
  37. package/lib/module/components/header/variants/TitleHeader/index.js.map +1 -1
  38. package/lib/module/components/icon/Icon.js +21 -9
  39. package/lib/module/components/icon/Icon.js.map +1 -1
  40. package/lib/module/components/icon/index.js.map +1 -1
  41. package/lib/module/components/image/Image.js +54 -0
  42. package/lib/module/components/image/Image.js.map +1 -0
  43. package/lib/module/components/image/index.js +4 -0
  44. package/lib/module/components/image/index.js.map +1 -0
  45. package/lib/module/components/image/types.js +4 -0
  46. package/lib/module/components/image/types.js.map +1 -0
  47. package/lib/module/components/index.js +4 -0
  48. package/lib/module/components/index.js.map +1 -1
  49. package/lib/module/components/page-indicator/PageIndicator.js.map +1 -1
  50. package/lib/module/components/page-indicator/PageIndicatorRoot.js.map +1 -1
  51. package/lib/module/components/page-indicator/hooks/use-page-indicator-colors.js +1 -1
  52. package/lib/module/components/page-indicator/hooks/use-page-indicator-colors.js.map +1 -1
  53. package/lib/module/components/page-indicator/hooks/use-page-indicator-core.js.map +1 -1
  54. package/lib/module/components/page-indicator/hooks/use-page-indicator-progress.js.map +1 -1
  55. package/lib/module/components/page-indicator/index.js.map +1 -1
  56. package/lib/module/components/page-indicator/variants/DotIndicator/InactiveDot.js.map +1 -1
  57. package/lib/module/components/page-indicator/variants/DotIndicator/LoadingOrbit.js.map +1 -1
  58. package/lib/module/components/page-indicator/variants/DotIndicator/TravelingPill.js.map +1 -1
  59. package/lib/module/components/page-indicator/variants/DotIndicator/index.js.map +1 -1
  60. package/lib/module/components/page-indicator/variants/PillIndicator/PillIndicatorDot.js.map +1 -1
  61. package/lib/module/components/page-indicator/variants/PillIndicator/index.js.map +1 -1
  62. package/lib/module/components/portal/Portal.js +42 -0
  63. package/lib/module/components/portal/Portal.js.map +1 -0
  64. package/lib/module/components/portal/PortalContext.js +1 -16
  65. package/lib/module/components/portal/PortalContext.js.map +1 -1
  66. package/lib/module/components/portal/PortalHost.js +16 -14
  67. package/lib/module/components/portal/PortalHost.js.map +1 -1
  68. package/lib/module/components/portal/PortalProvider.js +51 -19
  69. package/lib/module/components/portal/PortalProvider.js.map +1 -1
  70. package/lib/module/components/portal/index.js +1 -1
  71. package/lib/module/components/portal/index.js.map +1 -1
  72. package/lib/module/components/screen/Screen.js +26 -29
  73. package/lib/module/components/screen/Screen.js.map +1 -1
  74. package/lib/module/components/screen/ScreenContext.js +7 -5
  75. package/lib/module/components/screen/ScreenContext.js.map +1 -1
  76. package/lib/module/components/screen/ScreenFlashList.js +144 -0
  77. package/lib/module/components/screen/ScreenFlashList.js.map +1 -0
  78. package/lib/module/components/screen/ScreenFlatList.js +88 -27
  79. package/lib/module/components/screen/ScreenFlatList.js.map +1 -1
  80. package/lib/module/components/screen/ScreenScrollView.js +101 -34
  81. package/lib/module/components/screen/ScreenScrollView.js.map +1 -1
  82. package/lib/module/components/screen/index.js +1 -0
  83. package/lib/module/components/screen/index.js.map +1 -1
  84. package/lib/module/components/screen/parts/BottomSafeArea.js +62 -0
  85. package/lib/module/components/screen/parts/BottomSafeArea.js.map +1 -0
  86. package/lib/module/components/screen/parts/ScreenPlaceholder.js +50 -0
  87. package/lib/module/components/screen/parts/ScreenPlaceholder.js.map +1 -0
  88. package/lib/module/components/screen/types.js +4 -0
  89. package/lib/module/components/screen/types.js.map +1 -0
  90. package/lib/module/components/screen/utils.js +12 -9
  91. package/lib/module/components/screen/utils.js.map +1 -1
  92. package/lib/module/components/slot/Slot.js.map +1 -1
  93. package/lib/module/components/slot/index.js.map +1 -1
  94. package/lib/module/components/spinner/Spinner.js +1 -1
  95. package/lib/module/components/spinner/Spinner.js.map +1 -1
  96. package/lib/module/components/spinner/index.js.map +1 -1
  97. package/lib/module/components/surface/Surface.js +16 -9
  98. package/lib/module/components/surface/Surface.js.map +1 -1
  99. package/lib/module/components/surface/index.js.map +1 -1
  100. package/lib/module/components/text/Text.js +25 -7
  101. package/lib/module/components/text/Text.js.map +1 -1
  102. package/lib/module/components/text/index.js.map +1 -1
  103. package/lib/module/components/toast/Toast.js +8 -8
  104. package/lib/module/components/toast/Toast.js.map +1 -1
  105. package/lib/module/components/toast/ToastProvider.js.map +1 -1
  106. package/lib/module/components/toast/index.js.map +1 -1
  107. package/lib/module/components/toolbar/Toolbar.js +268 -0
  108. package/lib/module/components/toolbar/Toolbar.js.map +1 -0
  109. package/lib/module/components/toolbar/index.js +4 -0
  110. package/lib/module/components/toolbar/index.js.map +1 -0
  111. package/lib/module/context/ThemeProvider.js +5 -2
  112. package/lib/module/context/ThemeProvider.js.map +1 -1
  113. package/lib/module/context/index.js.map +1 -1
  114. package/lib/module/index.js.map +1 -1
  115. package/lib/module/{components/icon/utils.js → theme/defaults/icons.js} +1 -1
  116. package/lib/module/theme/defaults/icons.js.map +1 -0
  117. package/lib/module/theme/defaults/image.js +30 -0
  118. package/lib/module/theme/defaults/image.js.map +1 -0
  119. package/lib/module/theme/index.js +6 -6
  120. package/lib/module/theme/index.js.map +1 -1
  121. package/lib/module/theme/{configure.js → registry.js} +23 -30
  122. package/lib/module/theme/registry.js.map +1 -0
  123. package/lib/module/theme/runtime.js +1 -1
  124. package/lib/module/theme/runtime.js.map +1 -1
  125. package/lib/module/theme/theme.js +92 -11
  126. package/lib/module/theme/theme.js.map +1 -1
  127. package/lib/module/theme/tokens/dark.js +59 -68
  128. package/lib/module/theme/tokens/dark.js.map +1 -1
  129. package/lib/module/theme/tokens/light.js +49 -67
  130. package/lib/module/theme/tokens/light.js.map +1 -1
  131. package/lib/module/theme/tokens/primitives.js +241 -20
  132. package/lib/module/theme/tokens/primitives.js.map +1 -1
  133. package/lib/module/utils/accent-utils.js +4 -4
  134. package/lib/module/utils/accent-utils.js.map +1 -1
  135. package/lib/typescript/src/components/avatar/Avatar.d.ts.map +1 -1
  136. package/lib/typescript/src/components/avatar/types.d.ts +5 -5
  137. package/lib/typescript/src/components/avatar/types.d.ts.map +1 -1
  138. package/lib/typescript/src/components/box/Box.d.ts.map +1 -1
  139. package/lib/typescript/src/components/box/utils.d.ts +6 -1
  140. package/lib/typescript/src/components/box/utils.d.ts.map +1 -1
  141. package/lib/typescript/src/components/button/Button.d.ts +2 -2
  142. package/lib/typescript/src/components/button/Button.d.ts.map +1 -1
  143. package/lib/typescript/src/components/chip/Chip.d.ts +24 -0
  144. package/lib/typescript/src/components/chip/Chip.d.ts.map +1 -0
  145. package/lib/typescript/src/components/chip/index.d.ts +4 -0
  146. package/lib/typescript/src/components/chip/index.d.ts.map +1 -0
  147. package/lib/typescript/src/components/chip/types.d.ts +8 -0
  148. package/lib/typescript/src/components/chip/types.d.ts.map +1 -0
  149. package/lib/typescript/src/components/chip/utils.d.ts +8 -0
  150. package/lib/typescript/src/components/chip/utils.d.ts.map +1 -0
  151. package/lib/typescript/src/components/empty-state/EmptyState.d.ts +45 -0
  152. package/lib/typescript/src/components/empty-state/EmptyState.d.ts.map +1 -0
  153. package/lib/typescript/src/components/empty-state/index.d.ts +4 -0
  154. package/lib/typescript/src/components/empty-state/index.d.ts.map +1 -0
  155. package/lib/typescript/src/components/empty-state/types.d.ts +6 -0
  156. package/lib/typescript/src/components/empty-state/types.d.ts.map +1 -0
  157. package/lib/typescript/src/components/header/header-buttons.d.ts +27 -0
  158. package/lib/typescript/src/components/header/header-buttons.d.ts.map +1 -1
  159. package/lib/typescript/src/components/header/index.d.ts +1 -1
  160. package/lib/typescript/src/components/header/index.d.ts.map +1 -1
  161. package/lib/typescript/src/components/header/parts/HeaderGradientOverlay.d.ts +7 -0
  162. package/lib/typescript/src/components/header/parts/HeaderGradientOverlay.d.ts.map +1 -0
  163. package/lib/typescript/src/components/header/variants/LargeTitleHeader/index.d.ts +1 -1
  164. package/lib/typescript/src/components/header/variants/LargeTitleHeader/index.d.ts.map +1 -1
  165. package/lib/typescript/src/components/header/variants/TitleHeader/index.d.ts +19 -8
  166. package/lib/typescript/src/components/header/variants/TitleHeader/index.d.ts.map +1 -1
  167. package/lib/typescript/src/components/icon/Icon.d.ts +1 -1
  168. package/lib/typescript/src/components/icon/Icon.d.ts.map +1 -1
  169. package/lib/typescript/src/components/image/Image.d.ts +16 -0
  170. package/lib/typescript/src/components/image/Image.d.ts.map +1 -0
  171. package/lib/typescript/src/components/image/index.d.ts +3 -0
  172. package/lib/typescript/src/components/image/index.d.ts.map +1 -0
  173. package/lib/typescript/src/components/image/types.d.ts +7 -0
  174. package/lib/typescript/src/components/image/types.d.ts.map +1 -0
  175. package/lib/typescript/src/components/index.d.ts +4 -0
  176. package/lib/typescript/src/components/index.d.ts.map +1 -1
  177. package/lib/typescript/src/components/page-indicator/PageIndicator.d.ts +1 -1
  178. package/lib/typescript/src/components/page-indicator/hooks/use-page-indicator-colors.d.ts +1 -1
  179. package/lib/typescript/src/components/page-indicator/variants/DotIndicator/index.d.ts +1 -1
  180. package/lib/typescript/src/components/page-indicator/variants/PillIndicator/index.d.ts +1 -1
  181. package/lib/typescript/src/components/portal/Portal.d.ts +26 -0
  182. package/lib/typescript/src/components/portal/Portal.d.ts.map +1 -0
  183. package/lib/typescript/src/components/portal/PortalContext.d.ts +11 -14
  184. package/lib/typescript/src/components/portal/PortalContext.d.ts.map +1 -1
  185. package/lib/typescript/src/components/portal/PortalHost.d.ts +9 -4
  186. package/lib/typescript/src/components/portal/PortalHost.d.ts.map +1 -1
  187. package/lib/typescript/src/components/portal/PortalProvider.d.ts +3 -3
  188. package/lib/typescript/src/components/portal/PortalProvider.d.ts.map +1 -1
  189. package/lib/typescript/src/components/portal/index.d.ts +4 -2
  190. package/lib/typescript/src/components/portal/index.d.ts.map +1 -1
  191. package/lib/typescript/src/components/screen/Screen.d.ts +19 -14
  192. package/lib/typescript/src/components/screen/Screen.d.ts.map +1 -1
  193. package/lib/typescript/src/components/screen/ScreenContext.d.ts +12 -9
  194. package/lib/typescript/src/components/screen/ScreenContext.d.ts.map +1 -1
  195. package/lib/typescript/src/components/screen/ScreenFlashList.d.ts +43 -0
  196. package/lib/typescript/src/components/screen/ScreenFlashList.d.ts.map +1 -0
  197. package/lib/typescript/src/components/screen/ScreenFlatList.d.ts +17 -7
  198. package/lib/typescript/src/components/screen/ScreenFlatList.d.ts.map +1 -1
  199. package/lib/typescript/src/components/screen/ScreenScrollView.d.ts +51 -16
  200. package/lib/typescript/src/components/screen/ScreenScrollView.d.ts.map +1 -1
  201. package/lib/typescript/src/components/screen/index.d.ts +3 -0
  202. package/lib/typescript/src/components/screen/index.d.ts.map +1 -1
  203. package/lib/typescript/src/components/screen/parts/BottomSafeArea.d.ts +30 -0
  204. package/lib/typescript/src/components/screen/parts/BottomSafeArea.d.ts.map +1 -0
  205. package/lib/typescript/src/components/screen/parts/ScreenPlaceholder.d.ts +22 -0
  206. package/lib/typescript/src/components/screen/parts/ScreenPlaceholder.d.ts.map +1 -0
  207. package/lib/typescript/src/components/screen/types.d.ts +42 -0
  208. package/lib/typescript/src/components/screen/types.d.ts.map +1 -0
  209. package/lib/typescript/src/components/screen/utils.d.ts +9 -9
  210. package/lib/typescript/src/components/screen/utils.d.ts.map +1 -1
  211. package/lib/typescript/src/components/spinner/Spinner.d.ts +1 -1
  212. package/lib/typescript/src/components/surface/Surface.d.ts +8 -1
  213. package/lib/typescript/src/components/surface/Surface.d.ts.map +1 -1
  214. package/lib/typescript/src/components/text/Text.d.ts +1 -1
  215. package/lib/typescript/src/components/text/Text.d.ts.map +1 -1
  216. package/lib/typescript/src/components/toast/Toast.d.ts +1 -1
  217. package/lib/typescript/src/components/toolbar/Toolbar.d.ts +115 -0
  218. package/lib/typescript/src/components/toolbar/Toolbar.d.ts.map +1 -0
  219. package/lib/typescript/src/components/toolbar/index.d.ts +3 -0
  220. package/lib/typescript/src/components/toolbar/index.d.ts.map +1 -0
  221. package/lib/typescript/src/context/ThemeProvider.d.ts.map +1 -1
  222. package/lib/typescript/src/{components/icon/utils.d.ts → theme/defaults/icons.d.ts} +2 -2
  223. package/lib/typescript/src/theme/defaults/icons.d.ts.map +1 -0
  224. package/lib/typescript/src/theme/defaults/image.d.ts +4 -0
  225. package/lib/typescript/src/theme/defaults/image.d.ts.map +1 -0
  226. package/lib/typescript/src/theme/index.d.ts +7 -7
  227. package/lib/typescript/src/theme/index.d.ts.map +1 -1
  228. package/lib/typescript/src/theme/{configure.d.ts → registry.d.ts} +1 -1
  229. package/lib/typescript/src/theme/registry.d.ts.map +1 -0
  230. package/lib/typescript/src/theme/theme.d.ts +21 -1
  231. package/lib/typescript/src/theme/theme.d.ts.map +1 -1
  232. package/lib/typescript/src/theme/tokens/dark.d.ts +41 -64
  233. package/lib/typescript/src/theme/tokens/dark.d.ts.map +1 -1
  234. package/lib/typescript/src/theme/tokens/light.d.ts +44 -65
  235. package/lib/typescript/src/theme/tokens/light.d.ts.map +1 -1
  236. package/lib/typescript/src/theme/tokens/primitives.d.ts +228 -17
  237. package/lib/typescript/src/theme/tokens/primitives.d.ts.map +1 -1
  238. package/lib/typescript/src/theme/types.d.ts +66 -36
  239. package/lib/typescript/src/theme/types.d.ts.map +1 -1
  240. package/lib/typescript/src/utils/accent-utils.d.ts +1 -1
  241. package/lib/typescript/src/utils/resolve-theme-color.d.ts +1 -1
  242. package/lib/typescript/src/utils/typography.d.ts +1 -1
  243. package/package.json +28 -12
  244. package/skills/terra-ui/SKILL.md +193 -0
  245. package/skills/terra-ui/references/recipes.md +198 -0
  246. package/skills/terra-ui/references/troubleshooting.md +112 -0
  247. package/src/components/avatar/Avatar.tsx +128 -38
  248. package/src/components/avatar/types.ts +5 -5
  249. package/src/components/box/Box.tsx +13 -1
  250. package/src/components/box/utils.ts +10 -0
  251. package/src/components/button/Button.tsx +7 -15
  252. package/src/components/chip/Chip.tsx +444 -0
  253. package/src/components/chip/index.ts +3 -0
  254. package/src/components/chip/types.ts +15 -0
  255. package/src/components/chip/utils.ts +34 -0
  256. package/src/components/empty-state/EmptyState.tsx +209 -0
  257. package/src/components/empty-state/index.ts +3 -0
  258. package/src/components/empty-state/types.ts +5 -0
  259. package/src/components/header/header-buttons.tsx +33 -45
  260. package/src/components/header/index.ts +2 -0
  261. package/src/components/header/parts/HeaderGradientOverlay.tsx +29 -0
  262. package/src/components/header/variants/LargeTitleHeader/index.tsx +68 -102
  263. package/src/components/header/variants/TitleHeader/index.tsx +47 -56
  264. package/src/components/icon/Icon.tsx +20 -15
  265. package/src/components/image/Image.tsx +48 -0
  266. package/src/components/image/index.ts +2 -0
  267. package/src/components/image/types.ts +7 -0
  268. package/src/components/index.ts +4 -0
  269. package/src/components/portal/Portal.tsx +55 -0
  270. package/src/components/portal/PortalContext.tsx +14 -22
  271. package/src/components/portal/PortalHost.tsx +17 -10
  272. package/src/components/portal/PortalProvider.tsx +58 -21
  273. package/src/components/portal/index.ts +4 -2
  274. package/src/components/screen/Screen.tsx +45 -59
  275. package/src/components/screen/ScreenContext.tsx +19 -12
  276. package/src/components/screen/ScreenFlashList.tsx +196 -0
  277. package/src/components/screen/ScreenFlatList.tsx +100 -39
  278. package/src/components/screen/ScreenScrollView.tsx +114 -53
  279. package/src/components/screen/index.ts +3 -0
  280. package/src/components/screen/parts/BottomSafeArea.tsx +60 -0
  281. package/src/components/screen/parts/ScreenPlaceholder.tsx +55 -0
  282. package/src/components/screen/types.ts +43 -0
  283. package/src/components/screen/utils.ts +29 -15
  284. package/src/components/surface/Surface.tsx +17 -20
  285. package/src/components/text/Text.tsx +23 -5
  286. package/src/components/toast/Toast.tsx +8 -8
  287. package/src/components/toolbar/Toolbar.tsx +353 -0
  288. package/src/components/toolbar/index.ts +6 -0
  289. package/src/context/ThemeProvider.tsx +5 -4
  290. package/src/{components/icon/utils.tsx → theme/defaults/icons.tsx} +1 -1
  291. package/src/theme/defaults/image.tsx +34 -0
  292. package/src/theme/index.ts +1 -1
  293. package/src/theme/{configure.ts → registry.ts} +19 -34
  294. package/src/theme/runtime.ts +1 -1
  295. package/src/theme/theme.ts +127 -13
  296. package/src/theme/tokens/dark.ts +60 -69
  297. package/src/theme/tokens/light.ts +50 -68
  298. package/src/theme/tokens/primitives.ts +248 -20
  299. package/src/theme/types.ts +67 -35
  300. package/src/utils/accent-utils.ts +4 -4
  301. package/lib/module/components/icon/utils.js.map +0 -1
  302. package/lib/module/theme/configure.js.map +0 -1
  303. package/lib/typescript/src/components/icon/utils.d.ts.map +0 -1
  304. package/lib/typescript/src/theme/configure.d.ts.map +0 -1
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+
3
+ import { useContext, useEffect, useRef } from 'react';
4
+ import { PortalContext } from "./PortalContext.js";
5
+ import { PortalHost } from "./PortalHost.js";
6
+ import { PortalProvider } from "./PortalProvider.js";
7
+ let nextPortalKey = 1;
8
+ const PortalComponent = ({
9
+ hostName,
10
+ children
11
+ }) => {
12
+ const context = useContext(PortalContext);
13
+ const upsertPortal = context?.upsertPortal;
14
+ const removePortal = context?.removePortal;
15
+ const portalKeyRef = useRef(nextPortalKey++);
16
+ useEffect(() => {
17
+ if (!upsertPortal || !removePortal) {
18
+ return;
19
+ }
20
+ upsertPortal(hostName, portalKeyRef.current, children ?? null);
21
+ return () => {
22
+ removePortal(hostName, portalKeyRef.current);
23
+ };
24
+ }, [children, hostName, removePortal, upsertPortal]);
25
+ return null;
26
+ };
27
+ /**
28
+ * Declaratively teleports `children` into the `PortalHost` named `hostName`,
29
+ * for as long as this component stays mounted.
30
+ *
31
+ * @example
32
+ * ```tsx
33
+ * <Portal hostName="screen-header">
34
+ * <LargeTitle />
35
+ * </Portal>
36
+ * ```
37
+ */
38
+ export const Portal = Object.assign(PortalComponent, {
39
+ Provider: PortalProvider,
40
+ Host: PortalHost
41
+ });
42
+ //# sourceMappingURL=Portal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useContext","useEffect","useRef","PortalContext","PortalHost","PortalProvider","nextPortalKey","PortalComponent","hostName","children","context","upsertPortal","removePortal","portalKeyRef","current","Portal","Object","assign","Provider","Host"],"sourceRoot":"../../../../src","sources":["components/portal/Portal.tsx"],"mappings":";;AAAA,SAAkCA,UAAU,EAAEC,SAAS,EAAEC,MAAM,QAAQ,OAAO;AAE9E,SAASC,aAAa;AACtB,SAASC,UAAU;AACnB,SAASC,cAAc;AAEvB,IAAIC,aAAa,GAAG,CAAC;AAQrB,MAAMC,eAAgC,GAAGA,CAAC;EAAEC,QAAQ;EAAEC;AAAS,CAAC,KAAK;EACnE,MAAMC,OAAO,GAAGV,UAAU,CAACG,aAAa,CAAC;EACzC,MAAMQ,YAAY,GAAGD,OAAO,EAAEC,YAAY;EAC1C,MAAMC,YAAY,GAAGF,OAAO,EAAEE,YAAY;EAC1C,MAAMC,YAAY,GAAGX,MAAM,CAASI,aAAa,EAAE,CAAC;EAEpDL,SAAS,CAAC,MAAM;IACd,IAAI,CAACU,YAAY,IAAI,CAACC,YAAY,EAAE;MAClC;IACF;IAEAD,YAAY,CAACH,QAAQ,EAAEK,YAAY,CAACC,OAAO,EAAEL,QAAQ,IAAI,IAAI,CAAC;IAE9D,OAAO,MAAM;MACXG,YAAY,CAACJ,QAAQ,EAAEK,YAAY,CAACC,OAAO,CAAC;IAC9C,CAAC;EACH,CAAC,EAAE,CAACL,QAAQ,EAAED,QAAQ,EAAEI,YAAY,EAAED,YAAY,CAAC,CAAC;EAEpD,OAAO,IAAI;AACb,CAAC;AAOD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMI,MAAM,GAAGC,MAAM,CAACC,MAAM,CAACV,eAAe,EAAE;EACnDW,QAAQ,EAAEb,cAAc;EACxBc,IAAI,EAAEf;AACR,CAAC,CAAwB","ignoreList":[]}
@@ -1,20 +1,5 @@
1
1
  "use strict";
2
2
 
3
- import { createContext, useContext } from 'react';
3
+ import { createContext } from 'react';
4
4
  export const PortalContext = /*#__PURE__*/createContext(null);
5
-
6
- /**
7
- * Access the nearest {@link PortalProvider}. Used by components that need to
8
- * teleport content into a `PortalHost` rendered elsewhere in the tree (e.g. the
9
- * large-title header injecting its title into the scroll content).
10
- *
11
- * @throws if called outside a `PortalProvider`.
12
- */
13
- export function usePortal() {
14
- const context = useContext(PortalContext);
15
- if (!context) {
16
- throw new Error('usePortal must be used within a PortalProvider');
17
- }
18
- return context;
19
- }
20
5
  //# sourceMappingURL=PortalContext.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["createContext","useContext","PortalContext","usePortal","context","Error"],"sourceRoot":"../../../../src","sources":["components/portal/PortalContext.tsx"],"mappings":";;AAAA,SAASA,aAAa,EAAkBC,UAAU,QAAQ,OAAO;AAWjE,OAAO,MAAMC,aAAa,gBAAGF,aAAa,CAA4B,IAAI,CAAC;;AAE3E;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASG,SAASA,CAAA,EAAuB;EAC9C,MAAMC,OAAO,GAAGH,UAAU,CAACC,aAAa,CAAC;EACzC,IAAI,CAACE,OAAO,EAAE;IACZ,MAAM,IAAIC,KAAK,CAAC,gDAAgD,CAAC;EACnE;EACA,OAAOD,OAAO;AAChB","ignoreList":[]}
1
+ {"version":3,"names":["createContext","PortalContext"],"sourceRoot":"../../../../src","sources":["components/portal/PortalContext.tsx"],"mappings":";;AAAA,SAASA,aAAa,QAAwB,OAAO;AAkBrD,OAAO,MAAMC,aAAa,gBAAGD,aAAa,CAA4B,IAAI,CAAC","ignoreList":[]}
@@ -1,23 +1,25 @@
1
1
  "use strict";
2
2
 
3
+ import { Fragment, useContext } from 'react';
3
4
  import { View } from 'react-native';
4
- import { usePortal } from "./PortalContext.js";
5
-
5
+ import { PortalContext } from "./PortalContext.js";
6
+ import { jsx as _jsx } from "react/jsx-runtime";
6
7
  /**
7
- * Renders every node currently registered with the nearest
8
- * {@link PortalProvider}, in insertion order. Place it where teleported content
9
- * should appear (e.g. at the top of a `Screen.ScrollView`).
8
+ * Renders every entry currently registered under `name` on the nearest
9
+ * {@link PortalProvider}. Place it where teleported content should appear
10
+ * (e.g. at the top of a `Screen.ScrollView`).
10
11
  */
11
- import { jsx as _jsx } from "react/jsx-runtime";
12
- export function PortalHost() {
13
- const {
14
- contents
15
- } = usePortal();
12
+ export function PortalHost({
13
+ name,
14
+ ...viewProps
15
+ }) {
16
+ const context = useContext(PortalContext);
17
+ const hostPortals = context?.portals[name] ?? [];
16
18
  return /*#__PURE__*/_jsx(View, {
17
- collapsable: false,
18
- children: Array.from(contents.entries()).map(([id, content]) => /*#__PURE__*/_jsx(View, {
19
- children: content
20
- }, id))
19
+ ...viewProps,
20
+ children: hostPortals.map(entry => /*#__PURE__*/_jsx(Fragment, {
21
+ children: entry.node
22
+ }, entry.key))
21
23
  });
22
24
  }
23
25
  //# sourceMappingURL=PortalHost.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["View","usePortal","jsx","_jsx","PortalHost","contents","collapsable","children","Array","from","entries","map","id","content"],"sourceRoot":"../../../../src","sources":["components/portal/PortalHost.tsx"],"mappings":";;AAAA,SAASA,IAAI,QAAQ,cAAc;AAEnC,SAASC,SAAS,QAAQ,oBAAiB;;AAE3C;AACA;AACA;AACA;AACA;AAJA,SAAAC,GAAA,IAAAC,IAAA;AAKA,OAAO,SAASC,UAAUA,CAAA,EAAG;EAC3B,MAAM;IAAEC;EAAS,CAAC,GAAGJ,SAAS,CAAC,CAAC;EAEhC,oBACEE,IAAA,CAACH,IAAI;IAACM,WAAW,EAAE,KAAM;IAAAC,QAAA,EACtBC,KAAK,CAACC,IAAI,CAACJ,QAAQ,CAACK,OAAO,CAAC,CAAC,CAAC,CAACC,GAAG,CAAC,CAAC,CAACC,EAAE,EAAEC,OAAO,CAAC,kBAChDV,IAAA,CAACH,IAAI;MAAAO,QAAA,EAAWM;IAAO,GAAZD,EAAmB,CAC/B;EAAC,CACE,CAAC;AAEX","ignoreList":[]}
1
+ {"version":3,"names":["Fragment","useContext","View","PortalContext","jsx","_jsx","PortalHost","name","viewProps","context","hostPortals","portals","children","map","entry","node","key"],"sourceRoot":"../../../../src","sources":["components/portal/PortalHost.tsx"],"mappings":";;AAAA,SAASA,QAAQ,EAAEC,UAAU,QAAQ,OAAO;AAC5C,SAASC,IAAI,QAAwB,cAAc;AAEnD,SAASC,aAAa;AAA0B,SAAAC,GAAA,IAAAC,IAAA;AAOhD;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,UAAUA,CAAC;EAAEC,IAAI;EAAE,GAAGC;AAA2B,CAAC,EAAE;EAClE,MAAMC,OAAO,GAAGR,UAAU,CAACE,aAAa,CAAC;EACzC,MAAMO,WAAW,GAAGD,OAAO,EAAEE,OAAO,CAACJ,IAAI,CAAC,IAAI,EAAE;EAEhD,oBACEF,IAAA,CAACH,IAAI;IAAA,GAAKM,SAAS;IAAAI,QAAA,EAChBF,WAAW,CAACG,GAAG,CAAEC,KAAK,iBACrBT,IAAA,CAACL,QAAQ;MAAAY,QAAA,EAAkBE,KAAK,CAACC;IAAI,GAAtBD,KAAK,CAACE,GAA2B,CACjD;EAAC,CACE,CAAC;AAEX","ignoreList":[]}
@@ -4,34 +4,66 @@ import { useCallback, useMemo, useState } from 'react';
4
4
  import { PortalContext } from "./PortalContext.js";
5
5
  import { jsx as _jsx } from "react/jsx-runtime";
6
6
  /**
7
- * Holds a registry of teleported content. Children register/unregister nodes by
8
- * id (see {@link usePortal}); a `PortalHost` placed anywhere below renders them.
9
- * Context-only no animation dependency.
7
+ * Holds a registry of teleported content, keyed by host name. Descendant
8
+ * `Portal` components register/unregister entries; a `PortalHost` placed
9
+ * anywhere below renders the entries for its `name`.
10
10
  */
11
11
  export function PortalProvider({
12
12
  children
13
13
  }) {
14
- const [contents, setContents] = useState(() => new Map());
15
- const registerContent = useCallback((id, content) => {
16
- setContents(prev => {
17
- const next = new Map(prev);
18
- next.set(id, content);
19
- return next;
14
+ const [portals, setPortals] = useState({});
15
+ const upsertPortal = useCallback((hostName, key, node) => {
16
+ setPortals(prev => {
17
+ const hostPortals = prev[hostName] ?? [];
18
+ const existingIndex = hostPortals.findIndex(entry => entry.key === key);
19
+ if (existingIndex === -1) {
20
+ return {
21
+ ...prev,
22
+ [hostName]: [...hostPortals, {
23
+ key,
24
+ node
25
+ }]
26
+ };
27
+ }
28
+ if (hostPortals[existingIndex]?.node === node) {
29
+ return prev;
30
+ }
31
+ const nextHostPortals = [...hostPortals];
32
+ nextHostPortals[existingIndex] = {
33
+ key,
34
+ node
35
+ };
36
+ return {
37
+ ...prev,
38
+ [hostName]: nextHostPortals
39
+ };
20
40
  });
21
41
  }, []);
22
- const unregisterContent = useCallback(id => {
23
- setContents(prev => {
24
- if (!prev.has(id)) return prev;
25
- const next = new Map(prev);
26
- next.delete(id);
27
- return next;
42
+ const removePortal = useCallback((hostName, key) => {
43
+ setPortals(prev => {
44
+ const hostPortals = prev[hostName] ?? [];
45
+ const nextHostPortals = hostPortals.filter(entry => entry.key !== key);
46
+ if (nextHostPortals.length === hostPortals.length) {
47
+ return prev;
48
+ }
49
+ if (nextHostPortals.length === 0) {
50
+ const {
51
+ [hostName]: _removed,
52
+ ...rest
53
+ } = prev;
54
+ return rest;
55
+ }
56
+ return {
57
+ ...prev,
58
+ [hostName]: nextHostPortals
59
+ };
28
60
  });
29
61
  }, []);
30
62
  const value = useMemo(() => ({
31
- registerContent,
32
- unregisterContent,
33
- contents
34
- }), [registerContent, unregisterContent, contents]);
63
+ portals,
64
+ upsertPortal,
65
+ removePortal
66
+ }), [portals, removePortal, upsertPortal]);
35
67
  return /*#__PURE__*/_jsx(PortalContext.Provider, {
36
68
  value: value,
37
69
  children: children
@@ -1 +1 @@
1
- {"version":3,"names":["useCallback","useMemo","useState","PortalContext","jsx","_jsx","PortalProvider","children","contents","setContents","Map","registerContent","id","content","prev","next","set","unregisterContent","has","delete","value","Provider"],"sourceRoot":"../../../../src","sources":["components/portal/PortalProvider.tsx"],"mappings":";;AAAA,SAAyBA,WAAW,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,OAAO;AAEtE,SAASC,aAAa,QAAiC,oBAAiB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAMzE;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,cAAcA,CAAC;EAAEC;AAA8B,CAAC,EAAE;EAChE,MAAM,CAACC,QAAQ,EAAEC,WAAW,CAAC,GAAGP,QAAQ,CACtC,MAAM,IAAIQ,GAAG,CAAC,CAChB,CAAC;EAED,MAAMC,eAAe,GAAGX,WAAW,CAAC,CAACY,EAAU,EAAEC,OAAkB,KAAK;IACtEJ,WAAW,CAAEK,IAAI,IAAK;MACpB,MAAMC,IAAI,GAAG,IAAIL,GAAG,CAACI,IAAI,CAAC;MAC1BC,IAAI,CAACC,GAAG,CAACJ,EAAE,EAAEC,OAAO,CAAC;MACrB,OAAOE,IAAI;IACb,CAAC,CAAC;EACJ,CAAC,EAAE,EAAE,CAAC;EAEN,MAAME,iBAAiB,GAAGjB,WAAW,CAAEY,EAAU,IAAK;IACpDH,WAAW,CAAEK,IAAI,IAAK;MACpB,IAAI,CAACA,IAAI,CAACI,GAAG,CAACN,EAAE,CAAC,EAAE,OAAOE,IAAI;MAC9B,MAAMC,IAAI,GAAG,IAAIL,GAAG,CAACI,IAAI,CAAC;MAC1BC,IAAI,CAACI,MAAM,CAACP,EAAE,CAAC;MACf,OAAOG,IAAI;IACb,CAAC,CAAC;EACJ,CAAC,EAAE,EAAE,CAAC;EAEN,MAAMK,KAAK,GAAGnB,OAAO,CACnB,OAAO;IAAEU,eAAe;IAAEM,iBAAiB;IAAET;EAAS,CAAC,CAAC,EACxD,CAACG,eAAe,EAAEM,iBAAiB,EAAET,QAAQ,CAC/C,CAAC;EAED,oBACEH,IAAA,CAACF,aAAa,CAACkB,QAAQ;IAACD,KAAK,EAAEA,KAAM;IAAAb,QAAA,EAAEA;EAAQ,CAAyB,CAAC;AAE7E","ignoreList":[]}
1
+ {"version":3,"names":["useCallback","useMemo","useState","PortalContext","jsx","_jsx","PortalProvider","children","portals","setPortals","upsertPortal","hostName","key","node","prev","hostPortals","existingIndex","findIndex","entry","nextHostPortals","removePortal","filter","length","_removed","rest","value","Provider"],"sourceRoot":"../../../../src","sources":["components/portal/PortalProvider.tsx"],"mappings":";;AAAA,SAAyBA,WAAW,EAAEC,OAAO,EAAEC,QAA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MAAM,CAAEH,KAAK,IAAKA,KAAK,CAACN,GAAG,KAAKA,GAAG,CAAC;MAExE,IAAIO,eAAe,CAACG,MAAM,KAAKP,WAAW,CAACO,MAAM,EAAE;QACjD,OAAOR,IAAI;MACb;MAEA,IAAIK,eAAe,CAACG,MAAM,KAAK,CAAC,EAAE;QAChC,MAAM;UAAE,CAACX,QAAQ,GAAGY,QAAQ;UAAE,GAAGC;QAAK,CAAC,GAAGV,IAAI;QAC9C,OAAOU,IAAI;MACb;MAEA,OAAO;QACL,GAAGV,IAAI;QACP,CAACH,QAAQ,GAAGQ;MACd,CAAC;IACH,CAAC,CAAC;EACJ,CAAC,EAAE,EAAE,CAAC;EAEN,MAAMM,KAAK,GAAGxB,OAAO,CACnB,OAAO;IAAEO,OAAO;IAAEE,YAAY;IAAEU;EAAa,CAAC,CAAC,EAC/C,CAACZ,OAAO,EAAEY,YAAY,EAAEV,YAAY,CACtC,CAAC;EAED,oBACEL,IAAA,CAACF,aAAa,CAACuB,QAAQ;IAACD,KAAK,EAAEA,KAAM;IAAAlB,QAAA,EAAEA;EAAQ,CAAyB,CAAC;AAE7E","ignoreList":[]}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- export { usePortal } from "./PortalContext.js";
3
+ export { Portal } from "./Portal.js";
4
4
  export { PortalHost } from "./PortalHost.js";
5
5
  export { PortalProvider } from "./PortalProvider.js";
6
6
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["usePortal","PortalHost","PortalProvider"],"sourceRoot":"../../../../src","sources":["components/portal/index.ts"],"mappings":";;AACA,SAASA,SAAS,QAAQ,oBAAiB;AAC3C,SAASC,UAAU,QAAQ,iBAAc;AAEzC,SAASC,cAAc,QAAQ,qBAAkB","ignoreList":[]}
1
+ {"version":3,"names":["Portal","PortalHost","PortalProvider"],"sourceRoot":"../../../../src","sources":["components/portal/index.ts"],"mappings":";;AACA,SAASA,MAAM;AAGf,SAASC,UAAU;AAEnB,SAASC,cAAc","ignoreList":[]}
@@ -1,11 +1,12 @@
1
1
  "use strict";
2
2
 
3
3
  import { Children, Fragment, forwardRef, isValidElement, useMemo } from 'react';
4
- import { SafeAreaView } from 'react-native-safe-area-context';
5
- import { useUnistyles } from 'react-native-unistyles';
6
- import { resolveThemeColor } from '#utils/resolve-theme-color';
4
+ import { View } from 'react-native';
5
+ import { StyleSheet, useUnistyles } from 'react-native-unistyles';
6
+ import { resolveThemeColor } from "../../utils/resolve-theme-color.js";
7
7
  import { PortalProvider } from "../portal/index.js";
8
8
  import { ScreenScrollProvider } from "./ScreenContext.js";
9
+ import { ScreenFlashList } from "./ScreenFlashList.js";
9
10
  import { ScreenFlatList } from "./ScreenFlatList.js";
10
11
  import { ScreenScrollView } from "./ScreenScrollView.js";
11
12
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -32,13 +33,14 @@ function ScreenHeader({
32
33
  children: children
33
34
  });
34
35
  }
36
+ ScreenHeader.displayName = 'Screen.Header';
35
37
 
36
38
  /** True if `children` directly contains a `Screen.Header`. */
37
39
  function hasScreenHeader(children) {
38
40
  let found = false;
39
41
  Children.forEach(children, child => {
40
42
  if (found) return;
41
- if (/*#__PURE__*/isValidElement(child) && child.type === ScreenHeader) found = true;
43
+ if (/*#__PURE__*/isValidElement(child) && typeof child.type !== 'string' && child.type.displayName === 'Screen.Header') found = true;
42
44
  });
43
45
  return found;
44
46
  }
@@ -58,36 +60,25 @@ function hasScreenHeader(children) {
58
60
  const ScreenBase = /*#__PURE__*/forwardRef(function Screen({
59
61
  children,
60
62
  bg = 'background',
61
- edges,
62
- inTabView = false,
63
- margins = true,
63
+ margins,
64
+ hasMargins,
64
65
  style,
65
66
  ...rest
66
- }, ref) {
67
+ }, _ref) {
68
+ const hasHeader = useMemo(() => hasScreenHeader(children), [children]);
69
+ const resolvedMargins = margins ?? (hasMargins === false ? 'none' : 'all');
67
70
  const {
68
71
  theme
69
72
  } = useUnistyles();
70
- const backgroundColor = resolveThemeColor(bg, theme) ?? theme.color.background;
71
- const hasHeader = useMemo(() => hasScreenHeader(children), [children]);
72
- const safeEdges = useMemo(() => {
73
- if (edges) {
74
- return hasHeader ? edges.filter(edge => edge !== 'top') : edges;
75
- }
76
- return hasHeader ? [] : ['top', 'bottom'];
77
- }, [edges, hasHeader]);
78
- return /*#__PURE__*/_jsx(ScreenScrollProvider, {
79
- isInTabView: inTabView,
80
- margins: margins,
81
- hasHeader: hasHeader,
82
- children: /*#__PURE__*/_jsx(PortalProvider, {
83
- children: /*#__PURE__*/_jsx(SafeAreaView, {
84
- ref: ref,
85
- edges: safeEdges,
86
- style: [{
87
- flex: 1,
88
- backgroundColor
89
- }, style],
90
- ...rest,
73
+ const resolvedBg = resolveThemeColor(bg, theme) ?? theme.color.background;
74
+ return /*#__PURE__*/_jsx(View, {
75
+ style: [styles.container, style],
76
+ ...rest,
77
+ children: /*#__PURE__*/_jsx(ScreenScrollProvider, {
78
+ background: resolvedBg,
79
+ margins: resolvedMargins,
80
+ hasHeader: hasHeader,
81
+ children: /*#__PURE__*/_jsx(PortalProvider, {
91
82
  children: children
92
83
  })
93
84
  })
@@ -96,5 +87,11 @@ const ScreenBase = /*#__PURE__*/forwardRef(function Screen({
96
87
  ScreenBase.Header = ScreenHeader;
97
88
  ScreenBase.ScrollView = ScreenScrollView;
98
89
  ScreenBase.FlatList = ScreenFlatList;
90
+ ScreenBase.FlashList = ScreenFlashList;
99
91
  export const Screen = ScreenBase;
92
+ const styles = StyleSheet.create((_theme, _runtime) => ({
93
+ container: {
94
+ flex: 1
95
+ }
96
+ }));
100
97
  //# sourceMappingURL=Screen.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["Children","Fragment","forwardRef","isValidElement","useMemo","SafeAreaView","useUnistyles","resolveThemeColor","PortalProvider","ScreenScrollProvider","ScreenFlatList","ScreenScrollView","jsx","_jsx","ScreenHeader","children","as","rest","Component","hasScreenHeader","found","forEach","child","type","ScreenBase","Screen","bg","edges","inTabView","margins","style","ref","theme","backgroundColor","color","background","hasHeader","safeEdges","filter","edge","isInTabView","flex","Header","ScrollView","FlatList"],"sourceRoot":"../../../../src","sources":["components/screen/Screen.tsx"],"mappings":";;AAAA,SACEA,QAAQ,EAIRC,QAAQ,EACRC,UAAU,EACVC,cAAc,EAGdC,OAAO,QACF,OAAO;AACd,SAEEC,YAAY,QAEP,gCAAgC;AACvC,SAASC,YAAY,QAAQ,wBAAwB;AAGrD,SAASC,iBAAiB,QAAQ,4BAA4B;AAE9D,SAASC,cAAc,QAAQ,oBAAW;AAC1C,SAASC,oBAAoB,QAAQ,oBAAiB;AACtD,SAASC,cAAc,QAAQ,qBAAkB;AACjD,SAASC,gBAAgB,QAAQ,uBAAoB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AActD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,YAAYA,CAA0C;EAC7DC,QAAQ;EACRC,EAAE;EACF,GAAGC;AACiB,CAAC,EAAE;EACvB,MAAMC,SAAS,GAAGF,EAAE,IAAIf,QAAQ;EAChC,oBAAOY,IAAA,CAACK,SAAS;IAAA,GAAKD,IAAI;IAAAF,QAAA,EAAGA;EAAQ,CAAY,CAAC;AACpD;;AAEA;AACA,SAASI,eAAeA,CAACJ,QAAmB,EAAW;EACrD,IAAIK,KAAK,GAAG,KAAK;EACjBpB,QAAQ,CAACqB,OAAO,CAACN,QAAQ,EAAGO,KAAK,IAAK;IACpC,IAAIF,KAAK,EAAE;IACX,IAAI,aAAAjB,cAAc,CAACmB,KAAK,CAAC,IAAIA,KAAK,CAACC,IAAI,KAAKT,YAAY,EAAEM,KAAK,GAAG,IAAI;EACxE,CAAC,CAAC;EACF,OAAOA,KAAK;AACd;AA8BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMI,UAAU,gBAAGtB,UAAU,CAC3B,SAASuB,MAAMA,CACb;EACEV,QAAQ;EACRW,EAAE,GAAG,YAAY;EACjBC,K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AGlC,cAAc;AAEpC,OAAO,MAAMe,MAAM,GAAGD,UAAU","ignoreList":[]}
1
+ {"version":3,"names":["Children","Fragment","forwardRef","isValidElement","useMemo","View","StyleSheet","useUnistyles","resolveThemeColor","PortalProvider","ScreenScrollProvider","ScreenFlashList","ScreenFlatList","ScreenScrollView","jsx","_jsx","ScreenHeader","children","as","rest","Component","displayName","hasScreenHeader","found","forEach","child","type","ScreenBase","Screen","bg","margins","hasMargins","style","_ref","hasHeader","resolvedMargins","theme","resolvedBg","color","background","styles","container","Header","ScrollView","FlatList","FlashList","create","_theme","_runtime","flex"],"sourceRoot":"../../../../src","sources":["components/screen/Screen.tsx"],"mappings":";;AAAA,SACEA,QAAQ,EAIRC,QAAQ,EACRC,UAAU,EACVC,cAAc,EAGdC,OAAO,QACF,OAAO;AACd,SAASC,IAAI,QAAQ,cAAc;AAEnC,SAASC,UAAU,EAAEC,YAAY,QAAQ,wBAAwB;AAEjE,SAASC,iBAAiB;AAC1B,SAASC,cAAc;AACvB,SAASC,oBAAoB;AAC7B,SAASC,eAAe;AACxB,SAASC,cAAc;AACvB,SAASC,gBAAgB;AAA6B,SAAAC,GAAA,IAAAC,IAAA;AAetD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,YAAYA,CAA0C;EAC7DC,QAAQ;EACRC,EAAE;EACF,GAAGC;AACiB,CAAC,EAAE;EACvB,MAAMC,SAAS,GAAGF,EAAE,IAAIjB,QAAQ;EAChC,oBAAOc,IAAA,CAACK,SAAS;IAAA,GAAKD,IAAI;IAAAF,QAAA,EAAGA;EAAQ,CAAY,CAAC;AACpD;AACAD,YAAY,CAACK,WAAW,GAAG,eAAe;;AAE1C;AACA,SAASC,eAAeA,CAACL,QAAmB,EAAW;EACrD,IAAIM,KAAK,GAAG,KAAK;EACjBvB,QAAQ,CAACwB,OAAO,CAACP,QAAQ,EAAGQ,KAAK,IAAK;IACpC,IAAIF,KAAK,EAAE;IACX,IACE,aA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,GAAG9B,gBAAgB;AACxCc,UAAU,CAACiB,QAAQ,GAAGhC,cAAc;AACpCe,UAAU,CAACkB,SAAS,GAAGlC,eAAe;AAEtC,OAAO,MAAMiB,MAAM,GAAGD,UAAU;AAEhC,MAAMa,MAAM,GAAGlC,UAAU,CAACwC,MAAM,CAAC,CAACC,MAAM,EAAEC,QAAQ,MAAM;EACtDP,SAAS,EAAE;IACTQ,IAAI,EAAE;EACR;AACF,CAAC,CAAC,CAAC","ignoreList":[]}
@@ -3,6 +3,8 @@
3
3
  import { createContext, useCallback, useContext, useMemo, useState } from 'react';
4
4
  import { useAnimatedRef, useAnimatedScrollHandler, useSharedValue } from 'react-native-reanimated';
5
5
  import { jsx as _jsx } from "react/jsx-runtime";
6
+ /** `PortalHost` name shared by `Screen.ScrollView` / `Screen.FlatList` and header variants that portal content into them. */
7
+ export const SCREEN_HEADER_PORTAL_HOST = 'screen-header';
6
8
  export const ScreenContext = /*#__PURE__*/createContext(null);
7
9
  /**
8
10
  * Owns the screen's shared scroll ref, offset, snap offsets, and header collapse
@@ -10,9 +12,9 @@ export const ScreenContext = /*#__PURE__*/createContext(null);
10
12
  * scroll containers bind the ref via {@link useScreen}.
11
13
  */
12
14
  export function ScreenScrollProvider({
15
+ background = 'transparent',
13
16
  children,
14
- isInTabView,
15
- margins = true,
17
+ margins = 'all',
16
18
  hasHeader = false
17
19
  }) {
18
20
  const scrollY = useSharedValue(0);
@@ -30,6 +32,7 @@ export function ScreenScrollProvider({
30
32
  }
31
33
  });
32
34
  const value = useMemo(() => ({
35
+ background,
33
36
  margins,
34
37
  hasHeader,
35
38
  scrollY,
@@ -37,9 +40,8 @@ export function ScreenScrollProvider({
37
40
  headerSnapOffsets,
38
41
  setHeaderCollapseHeight,
39
42
  scrollRef,
40
- scrollHandler,
41
- isInTabView
42
- }), [margins, hasHeader, scrollY, headerCollapseHeight, headerSnapOffsets, setHeaderCollapseHeight, scrollRef, scrollHandler, isInTabView]);
43
+ scrollHandler
44
+ }), [background, margins, hasHeader, scrollY, headerCollapseHeight, headerSnapOffsets, setHeaderCollapseHeight, scrollRef, scrollHandler]);
43
45
  return /*#__PURE__*/_jsx(ScreenContext.Provider, {
44
46
  value: value,
45
47
  children: children
@@ -1 +1 @@
1
- {"version":3,"names":["createContext","useCallback","useContext","useMemo","useState","useAnimatedRef","useAnimatedScrollHandler","useSharedValue","jsx","_jsx","ScreenContext","ScreenScrollProvider","children","isInTabView","margins","hasHeader","scrollY","headerCollapseHeight","headerSnapOffsets","setHeaderSnapOffsets","scrollRef","setHeaderCollapseHeight","height","rounded","Math","round","value","undefined","scrollHandler","onScroll","event","contentOffset","y","Provider","useScreen","context","Error"],"sourceRoot":"../../../../src","sources":["components/screen/ScreenContext.tsx"],"mappings":";;AAAA,SACEA,aAAa,EAEbC,WAAW,EACXC,UAAU,EACVC,OAAO,EACPC,QAAQ,QACH,OAAO;AAEd,SAIEC,cAAc,EACdC,wBAAwB,EACxBC,cAAc,QACT,yBAAyB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAuCjC,OAAO,MAAMC,aAAa,gBAAGV,aAAa,CAA4B,IAAI,CAAC;AAW3E;AACA;AACA;AACA;AACA;AACA,OAAO,SAASW,oBAAoBA,CAAC;EACnCC,QAAQ;EACRC,WAAW;EACXC,OAAO,GAAG,IAAI;EACdC,SAAS,GAAG;AACa,CAAC,EAAE;EAC5B,MAAMC,OAAO,GAAGT,cAAc,CAAC,CAAC,CAAC;EACjC,MAAMU,oBAAoB,GAAGV,cAAc,CAAC,CAAC,CAAC;EAC9C,MAAM,CAACW,iBAAiB,EAAEC,oBAAoB,CAAC,GAAGf,QAAQ,CAAW,CAAC;EACtE,MAAMgB,SAAS,GAAGf,cAAc,CAAsB,CAAC;EAEvD,MAAMgB,uBAAuB,GAAGpB,WAAW,CACxCqB,MAAc,IAAK;IAClB,MAAMC,OAAO,GAAGC,IAAI,CAACC,KAAK,CAACH,MAAM,CAAC;IAClCL,oBAAoB,CAACS,KAAK,GAAGH,OAAO;IACpCJ,oBAAoB,CAACI,OAAO,GAAG,CAAC,GAAG,CAAC,CAAC,EAAEA,OAAO,CAAC,GAAGI,SAAS,CAAC;EAC9D,CAAC,EACD,CAACV,oBAAoB,CACvB,CAAC;EAED,MAAMW,aAAa,GAAGtB,wBAAwB,CAAC;IAC7CuB,QAAQ,EAAGC,KAAK,IAAK;MACnBd,OAAO,CAACU,KAAK,GAAGI,KAAK,CAACC,aAAa,CAACC,CAAC;IACvC;EACF,CAAC,CAAC;EAEF,MAAMN,KAAK,GAAGvB,OAAO,CACnB,OAAO;IACLW,OAAO;IACPC,SAAS;IACTC,OAAO;IACPC,oBAAoB;IACpBC,iBAAiB;IACjBG,uBAAuB;IACvBD,SAAS;IACTQ,aAAa;IACbf;EACF,CAAC,CAAC,EACF,CACEC,OAAO,EACPC,SAAS,EACTC,OAAO,EACPC,oBAAoB,EACpBC,iBAAiB,EACjBG,uBAAuB,EACvBD,SAAS,EACTQ,aAAa,EACbf,WAAW,CAEf,CAAC;EAED,oBACEJ,IAAA,CAACC,aAAa,CAACuB,QAAQ;IAACP,KAAK,EAAEA,KAAM;IAAAd,QAAA,EAAEA;EAAQ,CAAyB,CAAC;AAE7E;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASsB,SAASA,CAAA,EAAuB;EAC9C,MAAMC,OAAO,GAAGjC,UAAU,CAACQ,aAAa,CAAC;EACzC,IAAI,CAACyB,OAAO,EAAE;IACZ,MAAM,IAAIC,KAAK,CAAC,kDAAkD,CAAC;EACrE;EACA,OAAOD,OAAO;AAChB","ignoreList":[]}
1
+ {"version":3,"names":["createContext","useCallback","useContext","useMemo","useState","useAnimatedRef","useAnimatedScrollHandler","useSharedValue","jsx","_jsx","SCREEN_HEADER_PORTAL_HOST","ScreenContext","ScreenScrollProvider","background","children","margins","hasHeader","scrollY","headerCollapseHeight","headerSnapOffsets","setHeaderSnapOffsets","scrollRef","setHeaderCollapseHeight","height","rounded","Math","round","value","undefined","scrollHandler","onScroll","event","contentOffset","y","Provider","useScreen","context","Error"],"sourceRoot":"../../../../src","sources":["components/screen/ScreenContext.tsx"],"mappings":";;AAAA,SACEA,aAAa,EAEbC,WAAW,EACXC,UAAU,EACVC,OAAO,EACPC,QAAQ,QACH,OAAO;AAEd,SAIEC,cAAc,EACdC,wBAAwB,EACxBC,cAAc,QACT,yBAAyB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAMjC;AACA,OAAO,MAAMC,yBAAyB,GAAG,eAAe;AAsCxD,OAAO,MAAMC,aAAa,gBAAGX,aAAa,CAA4B,IAAI,CAAC;AAY3E;AACA;AACA;AACA;AACA;AACA,OAAO,SAASY,oBAAoBA,CAAC;EACnCC,UAAU,GAAG,aAAa;EAC1BC,QAAQ;EACRC,OAAO,GAAG,KAAK;EACfC,SAAS,GAAG;AACa,CAAC,EAAE;EAC5B,MAAMC,OAAO,GAAGV,cAAc,CAAC,CAAC,CAAC;EACjC,MAAMW,oBAAoB,GAAGX,cAAc,CAAC,CAAC,CAAC;EAC9C,MAAM,CAACY,iBAAiB,EAAEC,oBAAoB,CAAC,GAAGhB,QAAQ,CAAW,CAAC;EACtE,MAAMiB,SAAS,GAAGhB,cAAc,CAAsB,CAAC;EAEvD,MAAMiB,uBAAuB,GAAGrB,WAAW,CACxCsB,MAAc,IAAK;IAClB,MAAMC,OAAO,GAAGC,IAAI,CAACC,KAAK,CAACH,MAAM,CAAC;IAClCL,oBAAoB,CAACS,KAAK,GAAGH,OAAO;IACpCJ,oBAAoB,CAACI,OAAO,GAAG,CAAC,GAAG,CAAC,CAAC,EAAEA,OAAO,CAAC,GAAGI,SAAS,CAAC;EAC9D,CAAC,EACD,CAACV,oBAAoB,CACvB,CAAC;EAED,MAAMW,aAAa,GAAGvB,wBAAwB,CAAC;IAC7CwB,QAAQ,EAAGC,KAAK,IAAK;MACnBd,OAAO,CAACU,KAAK,GAAGI,KAAK,CAACC,aAAa,CAACC,CAAC;IACvC;EACF,CAAC,CAAC;EAEF,MAAMN,KAAK,GAAGxB,OAAO,CACnB,OAAO;IACLU,UAAU;IACVE,OAAO;IACPC,SAAS;IACTC,OAAO;IACPC,oBAAoB;IACpBC,iBAAiB;IACjBG,uBAAuB;IACvBD,SAAS;IACTQ;EACF,CAAC,CAAC,EACF,CACEhB,UAAU,EACVE,OAAO,EACPC,SAAS,EACTC,OAAO,EACPC,oBAAoB,EACpBC,iBAAiB,EACjBG,uBAAuB,EACvBD,SAAS,EACTQ,aAAa,CAEjB,CAAC;EAED,oBACEpB,IAAA,CAACE,aAAa,CAACuB,QAAQ;IAACP,KAAK,EAAEA,KAAM;IAAAb,QAAA,EAAEA;EAAQ,CAAyB,CAAC;AAE7E;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASqB,SAASA,CAAA,EAAuB;EAC9C,MAAMC,OAAO,GAAGlC,UAAU,CAACS,aAAa,CAAC;EACzC,IAAI,CAACyB,OAAO,EAAE;IACZ,MAAM,IAAIC,KAAK,CAAC,kDAAkD,CAAC;EACrE;EACA,OAAOD,OAAO;AAChB","ignoreList":[]}
@@ -0,0 +1,144 @@
1
+ "use strict";
2
+
3
+ import { FlashList } from '@shopify/flash-list';
4
+ import { View } from 'react-native';
5
+ import Animated, { useAnimatedScrollHandler, useComposedEventHandler } from 'react-native-reanimated';
6
+ import { StyleSheet } from 'react-native-unistyles';
7
+ import { PortalHost } from "../portal/index.js";
8
+ import { BottomSafeArea } from "./parts/BottomSafeArea.js";
9
+ import { renderScreenPlaceholder } from "./parts/ScreenPlaceholder.js";
10
+ import { SCREEN_HEADER_PORTAL_HOST, useScreen } from "./ScreenContext.js";
11
+ import { hasXMargin, hasYMargin, renderListHeader } from "./utils.js";
12
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
13
+ const AnimatedFlashList = Animated.createAnimatedComponent(FlashList);
14
+ /**
15
+ * `FlashList` variant of `Screen.ScrollView`: mirrors scroll offset into the
16
+ * screen's shared `scrollY`, hosts the portal target above the list, and
17
+ * applies token-driven content padding.
18
+ *
19
+ * Requires `@shopify/flash-list` — it is a peer dependency of
20
+ * `react-native-terra-ui` and must be installed in the consuming app.
21
+ *
22
+ * Note: unlike `Screen.FlatList`, this does not bind the screen's shared
23
+ * imperative `scrollRef` — `FlashList`'s ref exposes a different (non
24
+ * Reanimated-compatible) imperative API.
25
+ *
26
+ * Shares `loading` / `LoadingComponent` / `EmptyComponent` / `margins` /
27
+ * `horizontal` with `Screen.ScrollView`, so a screen can swap one container for
28
+ * another without relearning its API.
29
+ *
30
+ * @example
31
+ * ```tsx
32
+ * <Screen.FlashList data={items} renderItem={({ item }) => <Row item={item} />} />
33
+ * ```
34
+ *
35
+ * @example Loading and empty placeholders
36
+ * ```tsx
37
+ * <Screen.FlashList
38
+ * data={items}
39
+ * loading={isLoading}
40
+ * EmptyComponent={<EmptyState icon="status.info" title="Nothing yet" fill />}
41
+ * renderItem={({ item }) => <Row item={item} />}
42
+ * />
43
+ * ```
44
+ */
45
+ export function ScreenFlashList({
46
+ data,
47
+ style,
48
+ contentContainerStyle,
49
+ ListHeaderComponent,
50
+ ListFooterComponent,
51
+ ListEmptyComponent,
52
+ horizontal = false,
53
+ loading = false,
54
+ LoadingComponent,
55
+ EmptyComponent,
56
+ margins,
57
+ bottomInset,
58
+ onScroll,
59
+ ...rest
60
+ }) {
61
+ if (FlashList == null) {
62
+ throw new Error('[react-native-terra-ui] Screen.FlashList requires "@shopify/flash-list" to be installed in your app. Run `yarn add @shopify/flash-list` (or the npm/pnpm equivalent) and rebuild.');
63
+ }
64
+ const {
65
+ background,
66
+ scrollHandler,
67
+ headerSnapOffsets,
68
+ margins: screenMargins,
69
+ hasHeader
70
+ } = useScreen();
71
+ const resolvedMargins = margins ?? screenMargins;
72
+ // The placeholder rides in on `ListEmptyComponent` rather than replacing the
73
+ // list, so the header portal and snap offsets stay put. While loading the
74
+ // list is fed an empty `data` so that slot is the one that renders.
75
+ const placeholder = renderScreenPlaceholder({
76
+ loading,
77
+ LoadingComponent,
78
+ EmptyComponent,
79
+ isEmpty: !data || data.length === 0
80
+ });
81
+ const jsScrollHandler = useAnimatedScrollHandler(event => {
82
+ if (onScroll) onScroll(event);
83
+ }, [onScroll]);
84
+ const composedHandler = useComposedEventHandler([scrollHandler, jsScrollHandler]);
85
+
86
+ // `AnimatedFlashList` is typed for `unknown` items, so the remaining props
87
+ // are cast back to its prop type — minus the ones set explicitly below,
88
+ // which the spread would otherwise re-supply.
89
+ const listProps = rest;
90
+
91
+ // A caller naming its own `bottomInset` has taken the bottom over entirely,
92
+ // and a horizontal list has no bottom edge to clear.
93
+ const needsBottomSafeArea = bottomInset === undefined && !horizontal;
94
+ const footerComponent = /*#__PURE__*/_jsxs(_Fragment, {
95
+ children: [renderListHeader(ListFooterComponent), needsBottomSafeArea ? /*#__PURE__*/_jsx(BottomSafeArea, {}) : null]
96
+ });
97
+ const headerComponent = /*#__PURE__*/_jsxs(View, {
98
+ style: styles.headerWrapper(resolvedMargins),
99
+ children: [/*#__PURE__*/_jsx(PortalHost, {
100
+ name: SCREEN_HEADER_PORTAL_HOST
101
+ }), renderListHeader(ListHeaderComponent)]
102
+ });
103
+ return /*#__PURE__*/_jsx(AnimatedFlashList, {
104
+ data: loading ? [] : data,
105
+ style: [{
106
+ backgroundColor: background
107
+ }, style],
108
+ horizontal: horizontal,
109
+ contentInsetAdjustmentBehavior: hasHeader ? 'never' : undefined,
110
+ contentContainerStyle: [styles.content(resolvedMargins, hasHeader, bottomInset), contentContainerStyle],
111
+ ListHeaderComponent: headerComponent,
112
+ ListFooterComponent: footerComponent,
113
+ ListEmptyComponent: placeholder ?? ListEmptyComponent,
114
+ showsVerticalScrollIndicator: false,
115
+ scrollEventThrottle: 16,
116
+ snapToOffsets: headerSnapOffsets,
117
+ ...listProps,
118
+ onScroll: composedHandler
119
+ });
120
+ }
121
+ const styles = StyleSheet.create((theme, runtime) => ({
122
+ content: (margins, hasHeader, bottomInset) => {
123
+ return {
124
+ flexGrow: 1,
125
+ // The header is absolutely positioned, so the list reserves its full
126
+ // height — bar plus top safe area. This assumes the scroll view does not
127
+ // also get UIKit's automatic inset adjustment: on a native tab screen
128
+ // that means `disableAutomaticContentInsets` on the tab, or the two
129
+ // insets are counted twice.
130
+ paddingTop: (hasHeader ? theme.layout.header.height + runtime.insets.top : 0) + (hasYMargin(margins) ? theme.layout.screen.margin.y : 0),
131
+ paddingHorizontal: hasXMargin(margins) ? theme.layout.screen.margin.x : 0,
132
+ // The safe area is `BottomSafeArea`'s job; counting it here as well
133
+ // would leave a gap the height of the gesture bar.
134
+ paddingBottom: bottomInset ?? (hasYMargin(margins) ? theme.layout.screen.margin.y : 0)
135
+ };
136
+ },
137
+ safeArea: {
138
+ height: runtime.insets.top
139
+ },
140
+ headerWrapper: margins => ({
141
+ marginHorizontal: hasXMargin(margins) ? -theme.layout.screen.margin.x : 0
142
+ })
143
+ }));
144
+ //# sourceMappingURL=ScreenFlashList.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["FlashList","View","Animated","useAnimatedScrollHandler","useComposedEventHandler","StyleSheet","PortalHost","BottomSafeArea","renderScreenPlaceholder","SCREEN_HEADER_PORTAL_HOST","useScreen","hasXMargin","hasYMargin","renderListHeader","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","AnimatedFlashList","createAnimatedComponent","ScreenFlashList","data","style","contentContainerStyle","ListHeaderComponent","ListFooterComponent","ListEmptyComponent","horizontal","loading","LoadingComponent","EmptyComponent","margins","bottomInset","onScroll","rest","Error","background","scrollHandler","headerSnapOffsets","screenMargins","hasHeader","resolvedMargins","placeholder","isEmpty","length","jsScrollHandler","event","composedHandler","listProps","needsBottomSafeArea","undefined","footerComponent","children","headerComponent","styles","headerWrapper","name","backgroundColor","contentInsetAdjustmentBehavior","content","showsVerticalScrollIndicator","scrollEventThrottle","snapToOffsets","create","theme","runtime","flexGrow","paddingTop","layout","header","height","insets","top","screen","margin","y","paddingHorizontal","x","paddingBottom","safeArea","marginHorizontal"],"sourceRoot":"../../../../src","sources":["components/screen/ScreenFlashList.tsx"],"mappings":";;AAAA,SAASA,SAAS,QAA6B,qBAAqB;AAEpE,SAGEC,IAAI,QACC,cAAc;AACrB,OAAOC,QAAQ,IACbC,wBAAwB,EACxBC,uBAAuB,QAClB,yBAAyB;AAEhC,SAASC,UAAU,QAAQ,wBAAwB;AAEnD,SAASC,UAAU;AACnB,SAASC,cAAc;AACvB,SAASC,uBAAuB;AAChC,SAASC,yBAAyB,EAAEC,SAAS;AAE7C,SAASC,UAAU,EAAEC,UAAU,EAAEC,gBAAgB;AAAkB,SAAAC,GAAA,IAAAC,IAAA,EAAAC,QAAA,IAAAC,SAAA,EAAAC,IAAA,IAAAC,KAAA;AAEnE,MAAMC,iBAAiB,GAAGlB,QAAQ,CAACmB,uBAAuB,CACxDrB,SACF,CAAC;AAaD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASsB,eAAeA,CAAI;EACjCC,IAAI;EACJC,KAAK;EACLC,qBAAqB;EACrBC,mBAAmB;EACnBC,mBAAmB;EACnBC,kBAAkB;EAClBC,UAAU,GAAG,KAAK;EAClBC,OAAO,GAAG,KAAK;EACfC,gBAAgB;EAChBC,cAAc;EACdC,OAAO;EACPC,WAAW;EACXC,QAAQ;EACR,GAAGC;AACoB,CAAC,EAAE;EAC1B,IAAIpC,SAAS,IAAI,IAAI,EAAE;IACrB,MAAM,IAAIqC,KAAK,CACb,mLACF,CAAC;EACH;EAEA,MAAM;IACJC,UAAU;IACVC,aAAa;IACbC,iBAAiB;IACjBP,OAAO,EAAEQ,aAAa;IACtBC;EACF,CAAC,GAAGhC,SAAS,CAAC,CAAC;EAEf,MAAMiC,eAAe,GAAGV,OAAO,IAAIQ,aAAa;EA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