@ankhorage/zora 28.2.0 → 28.4.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 (342) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/README.md +1 -1
  3. package/dist/capabilities/index.js +127 -2
  4. package/dist/capabilities/index.js.map +8 -5
  5. package/dist/constants/authoring.d.ts +6 -3
  6. package/dist/constants/authoring.d.ts.map +1 -1
  7. package/dist/constants/authoring.js +6 -0
  8. package/dist/constants/authoring.js.map +1 -1
  9. package/dist/features/accordion/accordionItemMeta.d.ts +1 -1
  10. package/dist/features/audio/adapters/inbound/Audio.d.ts +5 -0
  11. package/dist/features/audio/adapters/inbound/Audio.d.ts.map +1 -0
  12. package/dist/features/audio/adapters/inbound/Audio.js +80 -0
  13. package/dist/features/audio/adapters/inbound/Audio.js.map +1 -0
  14. package/dist/features/audio/audioMeta.d.ts +22 -0
  15. package/dist/features/audio/audioMeta.d.ts.map +1 -0
  16. package/dist/features/audio/audioMeta.js +18 -0
  17. package/dist/features/audio/audioMeta.js.map +1 -0
  18. package/dist/features/audio/composition/AudioController.d.ts +13 -0
  19. package/dist/features/audio/composition/AudioController.d.ts.map +1 -0
  20. package/dist/features/audio/composition/AudioController.js +2 -0
  21. package/dist/features/audio/composition/AudioController.js.map +1 -0
  22. package/dist/features/audio/composition/useAudioController.d.ts +5 -0
  23. package/dist/features/audio/composition/useAudioController.d.ts.map +1 -0
  24. package/dist/features/audio/composition/useAudioController.js +22 -0
  25. package/dist/features/audio/composition/useAudioController.js.map +1 -0
  26. package/dist/features/audio/composition/useAudioController.web.d.ts +5 -0
  27. package/dist/features/audio/composition/useAudioController.web.d.ts.map +1 -0
  28. package/dist/features/audio/composition/useAudioController.web.js +80 -0
  29. package/dist/features/audio/composition/useAudioController.web.js.map +1 -0
  30. package/dist/features/audio/public.d.ts +3 -0
  31. package/dist/features/audio/public.d.ts.map +1 -0
  32. package/dist/features/audio/public.js +2 -0
  33. package/dist/features/audio/public.js.map +1 -0
  34. package/dist/features/bottom-sheet/bottomSheetMeta.d.ts +1 -1
  35. package/dist/features/card/cardMeta.d.ts +1 -1
  36. package/dist/features/card/mediaCardMeta.d.ts +1 -1
  37. package/dist/features/card/postCardMeta.d.ts +1 -1
  38. package/dist/features/chat/messageBubbleMeta.d.ts +1 -1
  39. package/dist/features/dialog/dialogMeta.d.ts +2 -2
  40. package/dist/features/gradient/gradientMeta.d.ts +1 -1
  41. package/dist/features/keyboard-avoiding-view/keyboardAvoidingViewMeta.d.ts +1 -1
  42. package/dist/features/layout/gridMeta.d.ts +1 -1
  43. package/dist/features/layout/screenMeta.d.ts +1 -1
  44. package/dist/features/layout/scrollViewMeta.d.ts +1 -1
  45. package/dist/features/layout/viewMeta.d.ts +1 -1
  46. package/dist/features/list/flatListMeta.d.ts +1 -1
  47. package/dist/features/list/sectionListMeta.d.ts +1 -1
  48. package/dist/features/master-detail/masterDetailMeta.d.ts +1 -1
  49. package/dist/features/reader/meta.d.ts +2 -2
  50. package/dist/features/registry/ZORA_BASE_COMPONENT_REGISTRY.d.ts.map +1 -1
  51. package/dist/features/registry/ZORA_BASE_COMPONENT_REGISTRY.js +6 -0
  52. package/dist/features/registry/ZORA_BASE_COMPONENT_REGISTRY.js.map +1 -1
  53. package/dist/features/registry/bindableComponentMeta.d.ts +2 -2
  54. package/dist/features/registry/componentMeta.d.ts.map +1 -1
  55. package/dist/features/registry/componentMeta.js +6 -0
  56. package/dist/features/registry/componentMeta.js.map +1 -1
  57. package/dist/features/rich-text/adapters/inbound/RichText.d.ts +11 -0
  58. package/dist/features/rich-text/adapters/inbound/RichText.d.ts.map +1 -0
  59. package/dist/features/rich-text/adapters/inbound/RichText.js +11 -0
  60. package/dist/features/rich-text/adapters/inbound/RichText.js.map +1 -0
  61. package/dist/features/rich-text/adapters/inbound/RichText.web.d.ts +5 -0
  62. package/dist/features/rich-text/adapters/inbound/RichText.web.d.ts.map +1 -0
  63. package/dist/features/rich-text/adapters/inbound/RichText.web.js +17 -0
  64. package/dist/features/rich-text/adapters/inbound/RichText.web.js.map +1 -0
  65. package/dist/features/rich-text/adapters/inbound/RichTextClient.d.ts +5 -0
  66. package/dist/features/rich-text/adapters/inbound/RichTextClient.d.ts.map +1 -0
  67. package/dist/features/rich-text/adapters/inbound/RichTextClient.js +94 -0
  68. package/dist/features/rich-text/adapters/inbound/RichTextClient.js.map +1 -0
  69. package/dist/features/rich-text/public.d.ts +3 -0
  70. package/dist/features/rich-text/public.d.ts.map +1 -0
  71. package/dist/features/rich-text/public.js +2 -0
  72. package/dist/features/rich-text/public.js.map +1 -0
  73. package/dist/features/rich-text/richTextMeta.d.ts +65 -0
  74. package/dist/features/rich-text/richTextMeta.d.ts.map +1 -0
  75. package/dist/features/rich-text/richTextMeta.js +48 -0
  76. package/dist/features/rich-text/richTextMeta.js.map +1 -0
  77. package/dist/features/rich-text/utils/resolveRichTextHtmlStyle.d.ts +5 -0
  78. package/dist/features/rich-text/utils/resolveRichTextHtmlStyle.d.ts.map +1 -0
  79. package/dist/features/rich-text/utils/resolveRichTextHtmlStyle.js +29 -0
  80. package/dist/features/rich-text/utils/resolveRichTextHtmlStyle.js.map +1 -0
  81. package/dist/features/rich-text/utils/sanitizeRichTextHtml.d.ts +3 -0
  82. package/dist/features/rich-text/utils/sanitizeRichTextHtml.d.ts.map +1 -0
  83. package/dist/features/rich-text/utils/sanitizeRichTextHtml.js +38 -0
  84. package/dist/features/rich-text/utils/sanitizeRichTextHtml.js.map +1 -0
  85. package/dist/features/scanner/meta.d.ts +2 -2
  86. package/dist/features/section/screenSectionMeta.d.ts +1 -1
  87. package/dist/features/surface/surfaceMeta.d.ts +1 -1
  88. package/dist/features/tabs/tabPanelMeta.d.ts +1 -1
  89. package/dist/features/video/adapters/inbound/Video.d.ts +2 -0
  90. package/dist/features/video/adapters/inbound/Video.d.ts.map +1 -0
  91. package/dist/features/video/adapters/inbound/Video.js +2 -0
  92. package/dist/features/video/adapters/inbound/Video.js.map +1 -0
  93. package/dist/features/video/adapters/inbound/Video.native.d.ts +5 -0
  94. package/dist/features/video/adapters/inbound/Video.native.d.ts.map +1 -0
  95. package/dist/features/video/adapters/inbound/Video.native.js +160 -0
  96. package/dist/features/video/adapters/inbound/Video.native.js.map +1 -0
  97. package/dist/features/video/adapters/inbound/Video.web.d.ts +5 -0
  98. package/dist/features/video/adapters/inbound/Video.web.d.ts.map +1 -0
  99. package/dist/features/video/adapters/inbound/Video.web.js +30 -0
  100. package/dist/features/video/adapters/inbound/Video.web.js.map +1 -0
  101. package/dist/features/video/public.d.ts +3 -0
  102. package/dist/features/video/public.d.ts.map +1 -0
  103. package/dist/features/video/public.js +2 -0
  104. package/dist/features/video/public.js.map +1 -0
  105. package/dist/features/video/videoMeta.d.ts +64 -0
  106. package/dist/features/video/videoMeta.d.ts.map +1 -0
  107. package/dist/features/video/videoMeta.js +50 -0
  108. package/dist/features/video/videoMeta.js.map +1 -0
  109. package/dist/index.d.ts +2 -0
  110. package/dist/index.d.ts.map +1 -1
  111. package/dist/index.js +1 -0
  112. package/dist/index.js.map +1 -1
  113. package/dist/readerFree.d.ts +4 -0
  114. package/dist/readerFree.d.ts.map +1 -1
  115. package/dist/readerFree.js +3 -0
  116. package/dist/readerFree.js.map +1 -1
  117. package/dist/types/audio.d.ts +15 -0
  118. package/dist/types/audio.d.ts.map +1 -0
  119. package/dist/types/audio.js +2 -0
  120. package/dist/types/audio.js.map +1 -0
  121. package/dist/types/rich-text.d.ts +24 -0
  122. package/dist/types/rich-text.d.ts.map +1 -0
  123. package/dist/types/rich-text.js +2 -0
  124. package/dist/types/rich-text.js.map +1 -0
  125. package/dist/types/video.d.ts +24 -0
  126. package/dist/types/video.d.ts.map +1 -0
  127. package/dist/types/video.js +2 -0
  128. package/dist/types/video.js.map +1 -0
  129. package/package.json +61 -3
  130. package/src/constants/authoring.ts +6 -0
  131. package/src/features/audio/adapters/inbound/Audio.tsx +158 -0
  132. package/src/features/audio/audioMeta.ts +20 -0
  133. package/src/features/audio/composition/AudioController.ts +12 -0
  134. package/src/features/audio/composition/useAudioController.ts +27 -0
  135. package/src/features/audio/composition/useAudioController.web.ts +106 -0
  136. package/src/features/audio/public.test.ts +37 -0
  137. package/src/features/audio/public.ts +2 -0
  138. package/src/features/registry/ZORA_BASE_COMPONENT_REGISTRY.ts +6 -0
  139. package/src/features/registry/componentMeta.test.ts +17 -0
  140. package/src/features/registry/componentMeta.ts +6 -0
  141. package/src/features/rich-text/adapters/inbound/RichText.tsx +15 -0
  142. package/src/features/rich-text/adapters/inbound/RichText.web.tsx +28 -0
  143. package/src/features/rich-text/adapters/inbound/RichTextClient.tsx +246 -0
  144. package/src/features/rich-text/public.ts +2 -0
  145. package/src/features/rich-text/richTextMeta.test.ts +52 -0
  146. package/src/features/rich-text/richTextMeta.ts +50 -0
  147. package/src/features/rich-text/utils/resolveRichTextHtmlStyle.test.ts +17 -0
  148. package/src/features/rich-text/utils/resolveRichTextHtmlStyle.ts +31 -0
  149. package/src/features/rich-text/utils/sanitizeRichTextHtml.test.ts +29 -0
  150. package/src/features/rich-text/utils/sanitizeRichTextHtml.ts +40 -0
  151. package/src/features/video/adapters/inbound/Video.native.tsx +296 -0
  152. package/src/features/video/adapters/inbound/Video.test.tsx +188 -0
  153. package/src/features/video/adapters/inbound/Video.tsx +1 -0
  154. package/src/features/video/adapters/inbound/Video.web.tsx +70 -0
  155. package/src/features/video/public.ts +7 -0
  156. package/src/features/video/videoMeta.ts +51 -0
  157. package/src/index.ts +2 -0
  158. package/src/readerFree.ts +14 -0
  159. package/src/types/audio.ts +16 -0
  160. package/src/types/rich-text.ts +24 -0
  161. package/src/types/video.ts +28 -0
  162. package/src/webPackageExports.test.ts +9 -0
  163. package/web-dist/chunks/{Accordion-4v920xz8.js → Accordion-01bsg7zt.js} +1 -1
  164. package/web-dist/chunks/{Accordion-pvfmhrm0.js → Accordion-17s33h1a.js} +1 -1
  165. package/web-dist/chunks/{Accordion-vyw2bzye.js → Accordion-2wggrer7.js} +2 -2
  166. package/web-dist/chunks/{Accordion-bjq32vq2.js → Accordion-2xb252py.js} +3 -3
  167. package/web-dist/chunks/{Accordion-kr1reyt9.js → Accordion-2xkxthf1.js} +7 -7
  168. package/web-dist/chunks/{Accordion-fc058wqp.js → Accordion-2ys50fc8.js} +1 -1
  169. package/web-dist/chunks/{Accordion-7zhdzn00.js → Accordion-379mgrse.js} +1 -1
  170. package/web-dist/chunks/{Accordion-xeyw6ndr.js → Accordion-38xvj0cq.js} +4 -4
  171. package/web-dist/chunks/{Accordion-8gfgaq01.js → Accordion-4zb6dcys.js} +1 -1
  172. package/web-dist/chunks/{Accordion-nrwc0rx2.js → Accordion-5mga7hty.js} +1 -1
  173. package/web-dist/chunks/{Accordion-3qvtv4g6.js → Accordion-5qz4j8tt.js} +6 -6
  174. package/web-dist/chunks/{Accordion-4zbh7wfn.js → Accordion-5rwztz14.js} +1 -1
  175. package/web-dist/chunks/{Accordion-frfh3nz6.js → Accordion-9qg7cjt8.js} +2 -2
  176. package/web-dist/chunks/{Accordion-g07r4t2f.js → Accordion-a1mgdfg7.js} +1 -1
  177. package/web-dist/chunks/{Accordion-dcm6ywt2.js → Accordion-axe7nsht.js} +1 -1
  178. package/web-dist/chunks/{Accordion-e2b9yja2.js → Accordion-bd9vzpbz.js} +6 -6
  179. package/web-dist/chunks/{Accordion-csz7sgjm.js → Accordion-bp9y7738.js} +6 -6
  180. package/web-dist/chunks/{Accordion-64w34bgd.js → Accordion-bzgy9sg3.js} +2 -2
  181. package/web-dist/chunks/{Accordion-r30bwg03.js → Accordion-e0vm82xr.js} +2 -2
  182. package/web-dist/chunks/{Accordion-em4ktbkk.js → Accordion-f1vargnk.js} +4 -4
  183. package/web-dist/chunks/{Accordion-k6v7p2na.js → Accordion-f8a49gy8.js} +1 -1
  184. package/web-dist/chunks/{Accordion-g5c5sqn7.js → Accordion-f8zpd80k.js} +4 -4
  185. package/web-dist/chunks/{Accordion-22z6y8kw.js → Accordion-gnbt6w4q.js} +3 -3
  186. package/web-dist/chunks/{Accordion-s1qjbbb0.js → Accordion-hdyzyw8q.js} +1 -1
  187. package/web-dist/chunks/{Accordion-q0cbpr2d.js → Accordion-htm3j8r8.js} +4 -4
  188. package/web-dist/chunks/{Accordion-mh3bhcb4.js → Accordion-kdb9g5b1.js} +3 -3
  189. package/web-dist/chunks/{Accordion-zsd0ar2p.js → Accordion-nmpzv3b0.js} +3 -3
  190. package/web-dist/chunks/{Accordion-b8ncebyz.js → Accordion-pdjhezmz.js} +1 -1
  191. package/web-dist/chunks/{Accordion-zqa9mt13.js → Accordion-q683s6kd.js} +2 -2
  192. package/web-dist/chunks/{Accordion-30284ah1.js → Accordion-r75ep5pg.js} +4 -4
  193. package/web-dist/chunks/{Accordion-rmakadh6.js → Accordion-rq311z1k.js} +4 -4
  194. package/web-dist/chunks/{Accordion-w28mb1ed.js → Accordion-rtamzg9j.js} +1 -1
  195. package/web-dist/chunks/{Accordion-nv1evygk.js → Accordion-sh79sr5g.js} +1 -1
  196. package/web-dist/chunks/{Accordion-t93g1wq3.js → Accordion-t9n4ey2r.js} +1 -1
  197. package/web-dist/chunks/{Accordion-zanzeryt.js → Accordion-tqagt6cz.js} +1 -1
  198. package/web-dist/chunks/{Accordion-0n3y5ry1.js → Accordion-v6vhyv31.js} +1 -1
  199. package/web-dist/chunks/Accordion-v86n9tvj.js +37 -0
  200. package/web-dist/chunks/{Accordion-6pkteb8k.js → Accordion-vb52sts9.js} +3 -3
  201. package/web-dist/chunks/{Accordion-rwjbwm18.js → Accordion-vkqqktc5.js} +1 -1
  202. package/web-dist/chunks/{Accordion-9zwdqhf2.js → Accordion-za0jcjgn.js} +2 -2
  203. package/web-dist/chunks/RichTextClient-8x3t7bwd.js +1676 -0
  204. package/web-dist/chunks/Video.native-97x0098j.js +905 -0
  205. package/web-dist/chunks/index-cnnsfz6n.js +1807 -0
  206. package/web-dist/components/accordion/Accordion.js +3 -3
  207. package/web-dist/components/accordion-item/AccordionItem.js +3 -3
  208. package/web-dist/components/app-bar/AppBar.js +7 -7
  209. package/web-dist/components/app-header/AppHeader.js +7 -7
  210. package/web-dist/components/app-shell/AppShell.js +2 -2
  211. package/web-dist/components/audio/Audio.d.ts +7 -0
  212. package/web-dist/components/audio/Audio.dependency-0.d.ts +27 -0
  213. package/web-dist/components/audio/Audio.dependency-1.d.ts +3 -0
  214. package/web-dist/components/audio/Audio.js +264 -0
  215. package/web-dist/components/audio/Audio.types-0.d.ts +18 -0
  216. package/web-dist/components/audio/index.d.ts +2 -0
  217. package/web-dist/components/audio/index.js +2 -0
  218. package/web-dist/components/auth-screen/AuthScreen.js +11 -11
  219. package/web-dist/components/avatar/Avatar.js +3 -3
  220. package/web-dist/components/avatar-group/AvatarGroup.js +3 -3
  221. package/web-dist/components/badge/Badge.js +2 -2
  222. package/web-dist/components/barcode-scanner-view/BarcodeScannerView.js +10 -10
  223. package/web-dist/components/bottom-sheet/BottomSheet.js +4 -4
  224. package/web-dist/components/bottom-sheet-flat-list/BottomSheetFlatList.js +4 -4
  225. package/web-dist/components/bottom-sheet-scroll-view/BottomSheetScrollView.js +4 -4
  226. package/web-dist/components/bottom-sheet-section-list/BottomSheetSectionList.js +4 -4
  227. package/web-dist/components/bottom-sheet-view/BottomSheetView.js +4 -4
  228. package/web-dist/components/bottom-sheet-virtualized-list/BottomSheetVirtualizedList.js +4 -4
  229. package/web-dist/components/breadcrumbs/Breadcrumbs.js +4 -4
  230. package/web-dist/components/button/Button.js +4 -4
  231. package/web-dist/components/button-group/ButtonGroup.js +4 -4
  232. package/web-dist/components/calendar/Calendar.js +5 -5
  233. package/web-dist/components/camera-permission-view/CameraPermissionView.js +10 -10
  234. package/web-dist/components/card/Card.js +9 -9
  235. package/web-dist/components/chat-list-item/ChatListItem.js +6 -6
  236. package/web-dist/components/checkbox/Checkbox.js +4 -4
  237. package/web-dist/components/checkbox-group/CheckboxGroup.js +4 -4
  238. package/web-dist/components/chip/Chip.js +4 -4
  239. package/web-dist/components/chip-group/ChipGroup.js +4 -4
  240. package/web-dist/components/collection-editor/CollectionEditor.js +9 -9
  241. package/web-dist/components/color-hue-scale/ColorHueScale.js +14 -14
  242. package/web-dist/components/color-picker/ColorPicker.js +14 -14
  243. package/web-dist/components/color-tone/ColorTone.js +14 -14
  244. package/web-dist/components/color-wheel/ColorWheel.js +14 -14
  245. package/web-dist/components/content-rail/ContentRail.js +4 -4
  246. package/web-dist/components/data-table/DataTable.js +15 -15
  247. package/web-dist/components/date-picker/DatePicker.js +9 -9
  248. package/web-dist/components/dialog/Dialog.js +4 -4
  249. package/web-dist/components/divider/Divider.js +2 -2
  250. package/web-dist/components/empty-state/EmptyState.js +10 -10
  251. package/web-dist/components/explorer/Explorer.js +4 -4
  252. package/web-dist/components/field/Field.js +4 -4
  253. package/web-dist/components/file-explorer/FileExplorer.js +4 -4
  254. package/web-dist/components/flat-list/FlatList.js +5 -5
  255. package/web-dist/components/forgot-password-form/ForgotPasswordForm.js +11 -11
  256. package/web-dist/components/form/Form.js +7 -7
  257. package/web-dist/components/form-actions/FormActions.js +7 -7
  258. package/web-dist/components/form-error/FormError.js +7 -7
  259. package/web-dist/components/game/Game.js +3 -3
  260. package/web-dist/components/game-entity/GameEntity.js +3 -3
  261. package/web-dist/components/game-field/GameField.js +3 -3
  262. package/web-dist/components/game-input-zone/GameInputZone.js +3 -3
  263. package/web-dist/components/game-measurement-probe/GameMeasurementProbe.js +3 -3
  264. package/web-dist/components/game-overlay/GameOverlay.js +3 -3
  265. package/web-dist/components/gradient/Gradient.js +3 -3
  266. package/web-dist/components/gradient-renderer-provider/GradientRendererProvider.js +3 -3
  267. package/web-dist/components/grid/Grid.js +2 -2
  268. package/web-dist/components/hero/Hero.js +9 -9
  269. package/web-dist/components/icon-button/IconButton.js +4 -4
  270. package/web-dist/components/image/Image.js +3 -3
  271. package/web-dist/components/list/List.js +5 -5
  272. package/web-dist/components/list-item/ListItem.js +5 -5
  273. package/web-dist/components/list-section/ListSection.js +5 -5
  274. package/web-dist/components/master-detail/MasterDetail.js +2 -2
  275. package/web-dist/components/media-card/MediaCard.js +9 -9
  276. package/web-dist/components/media-explorer/MediaExplorer.js +4 -4
  277. package/web-dist/components/message-bubble/MessageBubble.js +6 -6
  278. package/web-dist/components/metric-card/MetricCard.js +9 -9
  279. package/web-dist/components/missing-element/MissingElement.js +3 -3
  280. package/web-dist/components/o-auth-provider-button/OAuthProviderButton.js +11 -11
  281. package/web-dist/components/o-auth-provider-list/OAuthProviderList.js +11 -11
  282. package/web-dist/components/otp-form/OtpForm.js +11 -11
  283. package/web-dist/components/pagination/Pagination.js +4 -4
  284. package/web-dist/components/palette-item/PaletteItem.js +9 -9
  285. package/web-dist/components/popover-menu/PopoverMenu.js +4 -4
  286. package/web-dist/components/post-card/PostCard.js +9 -9
  287. package/web-dist/components/product-card/ProductCard.js +9 -9
  288. package/web-dist/components/progress/Progress.js +3 -3
  289. package/web-dist/components/progress-ring/ProgressRing.js +3 -3
  290. package/web-dist/components/radio/Radio.js +4 -4
  291. package/web-dist/components/radio-group/RadioGroup.js +4 -4
  292. package/web-dist/components/rating/Rating.js +2 -2
  293. package/web-dist/components/reader/Reader.js +10 -10
  294. package/web-dist/components/rich-text/RichText.d.ts +13 -0
  295. package/web-dist/components/rich-text/RichText.dependency-0.d.ts +27 -0
  296. package/web-dist/components/rich-text/RichText.dependency-1.d.ts +3 -0
  297. package/web-dist/components/rich-text/RichText.js +35 -0
  298. package/web-dist/components/rich-text/RichText.types-0.d.ts +24 -0
  299. package/web-dist/components/rich-text/index.d.ts +2 -0
  300. package/web-dist/components/rich-text/index.js +2 -0
  301. package/web-dist/components/scan-overlay/ScanOverlay.js +10 -10
  302. package/web-dist/components/screen/Screen.js +2 -2
  303. package/web-dist/components/screen-section/ScreenSection.js +3 -3
  304. package/web-dist/components/scroll-view/ScrollView.js +2 -2
  305. package/web-dist/components/search-input/SearchInput.js +5 -5
  306. package/web-dist/components/section-header/SectionHeader.js +3 -3
  307. package/web-dist/components/section-list/SectionList.js +5 -5
  308. package/web-dist/components/select/Select.js +9 -9
  309. package/web-dist/components/sign-in-form/SignInForm.js +11 -11
  310. package/web-dist/components/sign-up-form/SignUpForm.js +11 -11
  311. package/web-dist/components/skeleton/Skeleton.js +12 -12
  312. package/web-dist/components/skeleton-card/SkeletonCard.js +12 -12
  313. package/web-dist/components/skeleton-list/SkeletonList.js +12 -12
  314. package/web-dist/components/skeleton-text/SkeletonText.js +12 -12
  315. package/web-dist/components/surface/Surface.js +3 -3
  316. package/web-dist/components/switch/Switch.js +2 -2
  317. package/web-dist/components/tab/Tab.js +2 -2
  318. package/web-dist/components/tab-list/TabList.js +2 -2
  319. package/web-dist/components/tab-panel/TabPanel.js +2 -2
  320. package/web-dist/components/tabs/Tabs.js +2 -2
  321. package/web-dist/components/text-input/TextInput.js +5 -5
  322. package/web-dist/components/theme-mode-toggle/ThemeModeToggle.js +4 -4
  323. package/web-dist/components/time-picker/TimePicker.js +8 -8
  324. package/web-dist/components/timeline/Timeline.js +3 -3
  325. package/web-dist/components/toast/Toast.js +4 -4
  326. package/web-dist/components/toast-provider/ToastProvider.js +4 -4
  327. package/web-dist/components/toolbar/Toolbar.js +14 -43
  328. package/web-dist/components/tree-item/TreeItem.js +6 -6
  329. package/web-dist/components/uploader/Uploader.js +12 -12
  330. package/web-dist/components/video/Video.d.ts +7 -0
  331. package/web-dist/components/video/Video.dependency-0.d.ts +27 -0
  332. package/web-dist/components/video/Video.dependency-1.d.ts +3 -0
  333. package/web-dist/components/video/Video.dependency-2.d.ts +9 -0
  334. package/web-dist/components/video/Video.dependency-3.d.ts +23 -0
  335. package/web-dist/components/video/Video.js +80 -0
  336. package/web-dist/components/video/Video.types-0.d.ts +29 -0
  337. package/web-dist/components/video/index.d.ts +2 -0
  338. package/web-dist/components/video/index.js +2 -0
  339. package/web-dist/components/view/View.js +2 -2
  340. package/web-dist/manifest.json +802 -675
  341. package/web-dist/runtime/ZoraProvider.js +3 -3
  342. /package/web-dist/chunks/{Accordion-5kaxyqy1.js → Accordion-ww4f12ty.js} +0 -0
@@ -0,0 +1,17 @@
1
+ import { createTheme } from '@ankhorage/surface/theme';
2
+ import { expect, test } from 'bun:test';
3
+
4
+ import { resolveRichTextHtmlStyle } from './resolveRichTextHtmlStyle';
5
+
6
+ test('resolves headings, links, and lists from the active ZORA theme', () => {
7
+ const theme = createTheme();
8
+ const style = resolveRichTextHtmlStyle(theme);
9
+
10
+ expect(style.h1).toEqual({ fontSize: theme.typography.headings[1].size, bold: true });
11
+ expect(style.a).toMatchObject({
12
+ color: theme.semantics.action.primary.base,
13
+ pressColor: theme.semantics.action.primary.hover,
14
+ });
15
+ expect(style.ol?.markerColor).toBe(theme.semantics.content.default);
16
+ expect(style.ul?.bulletColor).toBe(theme.semantics.content.default);
17
+ });
@@ -0,0 +1,31 @@
1
+ import type { SurfaceTheme } from '@ankhorage/surface';
2
+ import type { EnrichedTextHtmlStyle, HtmlStyle } from 'react-native-enriched-html';
3
+
4
+ /** Resolves the upstream HTML renderer tokens from the active ZORA theme. */
5
+ export function resolveRichTextHtmlStyle(theme: SurfaceTheme): HtmlStyle & EnrichedTextHtmlStyle {
6
+ return {
7
+ h1: { fontSize: theme.typography.headings[1].size, bold: true },
8
+ h2: { fontSize: theme.typography.headings[2].size, bold: true },
9
+ h3: { fontSize: theme.typography.headings[3].size, bold: true },
10
+ h4: { fontSize: theme.typography.headings[4].size, bold: true },
11
+ h5: { fontSize: theme.typography.headings[5].size, bold: true },
12
+ h6: { fontSize: theme.typography.headings[6].size, bold: true },
13
+ a: {
14
+ color: theme.semantics.action.primary.base,
15
+ pressColor: theme.semantics.action.primary.hover,
16
+ textDecorationLine: 'underline',
17
+ },
18
+ ol: {
19
+ gapWidth: theme.spacing.s,
20
+ marginLeft: theme.spacing.l,
21
+ markerColor: theme.semantics.content.default,
22
+ markerFontWeight: theme.typography.weights.regular,
23
+ },
24
+ ul: {
25
+ bulletColor: theme.semantics.content.default,
26
+ bulletSize: theme.spacing.xs,
27
+ gapWidth: theme.spacing.s,
28
+ marginLeft: theme.spacing.l,
29
+ },
30
+ };
31
+ }
@@ -0,0 +1,29 @@
1
+ import { describe, expect, test } from 'bun:test';
2
+
3
+ import { sanitizeRichTextHtml } from './sanitizeRichTextHtml';
4
+
5
+ describe('sanitizeRichTextHtml', () => {
6
+ test('preserves the supported RichText formatting vocabulary', () => {
7
+ expect(
8
+ sanitizeRichTextHtml(
9
+ '<h1 style="text-align: center">Heading</h1><p><b>Bold</b><i>Italic</i><u>Underline</u><s>Strike</s><a href="https://example.com">Link</a></p><ol style="text-align: right"><li>One</li></ol><ul><li>Two</li></ul>',
10
+ ),
11
+ ).toBe(
12
+ '<h1 style="text-align:center;">Heading</h1><p><b>Bold</b><i>Italic</i><u>Underline</u><s>Strike</s><a href="https://example.com">Link</a></p><ol style="text-align:right;"><li>One</li></ol><ul><li>Two</li></ul>',
13
+ );
14
+
15
+ expect(sanitizeRichTextHtml('<html><h1>Title</h1><br><p>Some body text.</p></html>')).toBe(
16
+ '<html><h1>Title</h1><br><p>Some body text.</p></html>',
17
+ );
18
+ });
19
+
20
+ test('removes executable content and unsupported formatting', () => {
21
+ expect(
22
+ sanitizeRichTextHtml(
23
+ '<script>alert(1)</script><p style="color: red; text-align: justify" onclick="alert(1)"><a href="javascript:alert(1)">Unsafe</a></p><img src="https://example.com/image.png">',
24
+ ),
25
+ ).toBe(
26
+ '<p style="text-align:justify;"><a href>Unsafe</a></p>&lt;img src="https://example.com/image.png"&gt;',
27
+ );
28
+ });
29
+ });
@@ -0,0 +1,40 @@
1
+ import { FilterXSS } from 'xss';
2
+
3
+ /** Sanitizes RichText HTML to the formatting vocabulary supported by every platform. */
4
+ export function sanitizeRichTextHtml(html: string): string {
5
+ return richTextHtmlSanitizer.process(html);
6
+ }
7
+
8
+ const alignmentAttributes = ['style'];
9
+
10
+ const richTextHtmlSanitizer = new FilterXSS({
11
+ whiteList: {
12
+ a: ['href'],
13
+ b: [],
14
+ br: [],
15
+ del: [],
16
+ em: [],
17
+ h1: alignmentAttributes,
18
+ h2: alignmentAttributes,
19
+ h3: alignmentAttributes,
20
+ h4: alignmentAttributes,
21
+ h5: alignmentAttributes,
22
+ h6: alignmentAttributes,
23
+ html: [],
24
+ i: [],
25
+ li: [],
26
+ ol: alignmentAttributes,
27
+ p: alignmentAttributes,
28
+ s: [],
29
+ strike: [],
30
+ strong: [],
31
+ u: [],
32
+ ul: alignmentAttributes,
33
+ },
34
+ css: {
35
+ whiteList: {
36
+ 'text-align': /^(left|center|right|justify)$/,
37
+ },
38
+ },
39
+ stripIgnoreTagBody: ['script', 'style'],
40
+ });
@@ -0,0 +1,296 @@
1
+ import {
2
+ type PlayingChangeEventPayload,
3
+ type SourceLoadEventPayload,
4
+ type TimeUpdateEventPayload,
5
+ useVideoPlayer,
6
+ VideoView,
7
+ type VolumeChangeEventPayload,
8
+ } from 'expo-video';
9
+ import React from 'react';
10
+ import { Pressable } from 'react-native';
11
+
12
+ import type { VideoProps } from '../../../../types/video';
13
+ import { IconButton } from '../../../button/public';
14
+ import { Image } from '../../../image/public';
15
+ import { View } from '../../../layout/public';
16
+ import { withZoraThemeScope } from '../../../theme/adapters/inbound/withZoraThemeScope';
17
+ import { useZoraTheme } from '../../../theme/composition/useZoraTheme';
18
+ import { Text } from '../../../typography/public';
19
+
20
+ /*** Renders Expo-backed video playback through ZORA's portable source and themed controls. */
21
+ export const Video = withZoraThemeScope(VideoInner);
22
+
23
+ /*** Configures the adapter-private Expo player for the ZORA control surface. */
24
+ function configureVideoPlayer(player: ReturnType<typeof useVideoPlayer>, volume: number): void {
25
+ player.timeUpdateEventInterval = 0.25;
26
+ setVideoPlayerVolume(player, volume);
27
+ }
28
+
29
+ /*** Renders one Video player and synchronizes its themed controls with Expo playback state. */
30
+ function VideoInner({
31
+ themeId: _themeId,
32
+ mode: _mode,
33
+ interactionPolicy,
34
+ source,
35
+ poster,
36
+ aspectRatio = 16 / 9,
37
+ contentFit = 'contain',
38
+ volume = 1,
39
+ accessibilityLabel = 'Video player',
40
+ testID,
41
+ }: VideoProps) {
42
+ const { theme } = useZoraTheme();
43
+ const videoRef = React.useRef<VideoView>(null);
44
+ const player = useVideoPlayer(source ?? null, (nextPlayer) =>
45
+ configureVideoPlayer(nextPlayer, volume),
46
+ );
47
+ const playbackEvents = useVideoPlayerEvents(player);
48
+ const [renderedSource, setRenderedSource] = React.useState<VideoProps['source']>(null);
49
+ const [progressWidth, setProgressWidth] = React.useState(0);
50
+ const currentTime = playbackEvents.timeUpdate?.currentTime ?? player.currentTime;
51
+ const duration = playbackEvents.sourceLoad?.duration ?? player.duration;
52
+ const isPlaying = playbackEvents.playingChange?.isPlaying ?? player.playing;
53
+ const currentVolume = playbackEvents.volumeChange?.volume ?? player.volume;
54
+ const canInteract = interactionPolicy !== 'passive' && source !== null && source !== undefined;
55
+ const safeAspectRatio = isPositiveFiniteNumber(aspectRatio) ? aspectRatio : 16 / 9;
56
+ const safeDuration = isPositiveFiniteNumber(duration) ? duration : 0;
57
+ const safeCurrentTime = clamp(currentTime, 0, safeDuration);
58
+
59
+ React.useEffect(() => {
60
+ setVideoPlayerVolume(player, volume);
61
+ }, [player, volume]);
62
+
63
+ const togglePlayback = () => {
64
+ if (player.playing) {
65
+ player.pause();
66
+ return;
67
+ }
68
+
69
+ player.play();
70
+ };
71
+
72
+ const seekToProgress = (locationX: number) => {
73
+ if (progressWidth <= 0 || safeDuration === 0) return;
74
+ setVideoPlayerCurrentTime(player, clamp(locationX / progressWidth, 0, 1) * safeDuration);
75
+ };
76
+
77
+ const changeVolume = (difference: number) => {
78
+ setVideoPlayerVolume(player, currentVolume + difference);
79
+ };
80
+
81
+ const enterFullscreen = () => {
82
+ void videoRef.current?.enterFullscreen().catch(() => undefined);
83
+ };
84
+
85
+ return (
86
+ <View
87
+ bg={theme.semantics.surface.raised}
88
+ borderColor={theme.semantics.neutral.divider}
89
+ borderWidth={1}
90
+ radius="m"
91
+ testID={testID}
92
+ overflow="hidden"
93
+ >
94
+ <View bg={theme.semantics.neutral.surface} style={{ aspectRatio: safeAspectRatio }}>
95
+ <VideoView
96
+ contentFit={contentFit}
97
+ fullscreenOptions={{ enable: true }}
98
+ nativeControls={false}
99
+ onFirstFrameRender={() => setRenderedSource(source ?? null)}
100
+ player={player}
101
+ ref={videoRef}
102
+ style={{ height: '100%', width: '100%' }}
103
+ />
104
+ {poster && renderedSource !== source ? (
105
+ <View
106
+ style={{ bottom: 0, left: 0, position: 'absolute', right: 0, top: 0 }}
107
+ pointerEvents="none"
108
+ >
109
+ <Image
110
+ alt=""
111
+ aspectRatio={safeAspectRatio}
112
+ fit={contentFit === 'fill' ? 'stretch' : contentFit}
113
+ source={poster}
114
+ />
115
+ </View>
116
+ ) : null}
117
+ </View>
118
+ <View gap="s" p="m">
119
+ <Pressable
120
+ accessibilityLabel="Seek video"
121
+ accessibilityRole="adjustable"
122
+ accessibilityValue={{ max: safeDuration, min: 0, now: safeCurrentTime }}
123
+ disabled={!canInteract || safeDuration === 0}
124
+ onLayout={(event) => setProgressWidth(event.nativeEvent.layout.width)}
125
+ onPress={(event) => seekToProgress(event.nativeEvent.locationX)}
126
+ >
127
+ <View
128
+ bg={theme.semantics.neutral.surface}
129
+ borderColor={theme.semantics.neutral.divider}
130
+ borderWidth={1}
131
+ radius="full"
132
+ style={{ height: 8, overflow: 'hidden' }}
133
+ >
134
+ <View
135
+ bg={theme.semantics.action.primary.base}
136
+ style={{
137
+ height: '100%',
138
+ width: `${resolveProgressPercent(safeCurrentTime, safeDuration)}%`,
139
+ }}
140
+ />
141
+ </View>
142
+ </Pressable>
143
+ <View align="center" direction="row" justify="space-between" wrap="nowrap">
144
+ <Text accessibilityLiveRegion="polite" emphasis="muted" variant="caption">
145
+ {formatVideoTime(safeCurrentTime)} / {formatVideoTime(safeDuration)}
146
+ </Text>
147
+ <View align="center" direction="row" gap="xs" wrap="nowrap">
148
+ <IconButton
149
+ disabled={!canInteract}
150
+ icon={{ name: 'play-skip-back' }}
151
+ interactionPolicy={interactionPolicy}
152
+ label="Seek back 10 seconds"
153
+ onPress={() => player.seekBy(-10)}
154
+ size="s"
155
+ />
156
+ <IconButton
157
+ disabled={!canInteract}
158
+ icon={{ name: isPlaying ? 'pause' : 'play' }}
159
+ interactionPolicy={interactionPolicy}
160
+ label={isPlaying ? 'Pause video' : 'Play video'}
161
+ onPress={togglePlayback}
162
+ size="m"
163
+ />
164
+ <IconButton
165
+ disabled={!canInteract}
166
+ icon={{ name: 'play-skip-forward' }}
167
+ interactionPolicy={interactionPolicy}
168
+ label="Seek forward 10 seconds"
169
+ onPress={() => player.seekBy(10)}
170
+ size="s"
171
+ />
172
+ </View>
173
+ <View align="center" direction="row" gap="xs" wrap="nowrap">
174
+ <IconButton
175
+ disabled={!canInteract || currentVolume <= 0}
176
+ icon={{ name: 'volume-low' }}
177
+ interactionPolicy={interactionPolicy}
178
+ label="Lower volume"
179
+ onPress={() => changeVolume(-0.1)}
180
+ size="s"
181
+ />
182
+ <IconButton
183
+ disabled={!canInteract || currentVolume >= 1}
184
+ icon={{ name: 'volume-high' }}
185
+ interactionPolicy={interactionPolicy}
186
+ label="Raise volume"
187
+ onPress={() => changeVolume(0.1)}
188
+ size="s"
189
+ />
190
+ <IconButton
191
+ disabled={!canInteract}
192
+ icon={{ name: 'expand' }}
193
+ interactionPolicy={interactionPolicy}
194
+ label={`Enter fullscreen ${accessibilityLabel}`}
195
+ onPress={enterFullscreen}
196
+ size="s"
197
+ />
198
+ </View>
199
+ </View>
200
+ </View>
201
+ </View>
202
+ );
203
+ }
204
+
205
+ /*** Clamps a finite numeric value to its inclusive playback range. */
206
+ function clamp(value: number, minimum: number, maximum: number): number {
207
+ if (!Number.isFinite(value)) return minimum;
208
+ return Math.min(Math.max(value, minimum), maximum);
209
+ }
210
+
211
+ /*** Updates the Expo adapter's private current-time property with a safe playback position. */
212
+ function setVideoPlayerCurrentTime(
213
+ player: ReturnType<typeof useVideoPlayer>,
214
+ currentTime: number,
215
+ ): void {
216
+ player.currentTime = currentTime;
217
+ }
218
+
219
+ /*** Updates the Expo adapter's private volume property with a normalized value. */
220
+ function setVideoPlayerVolume(player: ReturnType<typeof useVideoPlayer>, volume: number): void {
221
+ player.volume = clamp(volume, 0, 1);
222
+ }
223
+
224
+ /*** Formats a playback duration in seconds as a readable elapsed-time label. */
225
+ function formatVideoTime(value: number): string {
226
+ const totalSeconds = Math.floor(Math.max(0, Number.isFinite(value) ? value : 0));
227
+ const seconds = totalSeconds % 60;
228
+ const minutes = Math.floor(totalSeconds / 60) % 60;
229
+ const hours = Math.floor(totalSeconds / 3600);
230
+ const minuteLabel = hours > 0 ? String(minutes).padStart(2, '0') : String(minutes);
231
+ const secondLabel = String(seconds).padStart(2, '0');
232
+
233
+ return hours > 0 ? `${hours}:${minuteLabel}:${secondLabel}` : `${minuteLabel}:${secondLabel}`;
234
+ }
235
+
236
+ /*** Identifies finite dimensions and durations that can be used by the playback UI. */
237
+ function isPositiveFiniteNumber(value: number): boolean {
238
+ return Number.isFinite(value) && value > 0;
239
+ }
240
+
241
+ /*** Converts elapsed playback to a percentage suitable for the visual progress track. */
242
+ function resolveProgressPercent(currentTime: number, duration: number): number {
243
+ if (duration <= 0) return 0;
244
+ return clamp((currentTime / duration) * 100, 0, 100);
245
+ }
246
+
247
+ /*** Keeps Expo player events synchronized with the themed control surface. */
248
+ function useVideoPlayerEvents(player: ReturnType<typeof useVideoPlayer>): VideoPlaybackEvents {
249
+ const [events, setEvents] = React.useState<VideoPlaybackEvents>({
250
+ player: null,
251
+ playingChange: null,
252
+ sourceLoad: null,
253
+ timeUpdate: null,
254
+ volumeChange: null,
255
+ });
256
+
257
+ React.useEffect(() => {
258
+ const timeUpdate = player.addListener('timeUpdate', (value) => {
259
+ setEvents((current) => ({ ...current, player, timeUpdate: value }));
260
+ });
261
+ const sourceLoad = player.addListener('sourceLoad', (value) => {
262
+ setEvents((current) => ({ ...current, player, sourceLoad: value }));
263
+ });
264
+ const playingChange = player.addListener('playingChange', (value) => {
265
+ setEvents((current) => ({ ...current, player, playingChange: value }));
266
+ });
267
+ const volumeChange = player.addListener('volumeChange', (value) => {
268
+ setEvents((current) => ({ ...current, player, volumeChange: value }));
269
+ });
270
+
271
+ return () => {
272
+ timeUpdate.remove();
273
+ sourceLoad.remove();
274
+ playingChange.remove();
275
+ volumeChange.remove();
276
+ };
277
+ }, [player]);
278
+
279
+ return events.player === player ? events : EMPTY_VIDEO_PLAYBACK_EVENTS;
280
+ }
281
+
282
+ interface VideoPlaybackEvents {
283
+ readonly player: ReturnType<typeof useVideoPlayer> | null;
284
+ readonly playingChange: PlayingChangeEventPayload | null;
285
+ readonly sourceLoad: SourceLoadEventPayload | null;
286
+ readonly timeUpdate: TimeUpdateEventPayload | null;
287
+ readonly volumeChange: VolumeChangeEventPayload | null;
288
+ }
289
+
290
+ const EMPTY_VIDEO_PLAYBACK_EVENTS: VideoPlaybackEvents = {
291
+ player: null,
292
+ playingChange: null,
293
+ sourceLoad: null,
294
+ timeUpdate: null,
295
+ volumeChange: null,
296
+ };
@@ -0,0 +1,188 @@
1
+ import { afterAll, expect, mock, test } from 'bun:test';
2
+ import { Window } from 'happy-dom';
3
+ import React, { act } from 'react';
4
+ import { createRoot } from 'react-dom/client';
5
+
6
+ const browser = new Window();
7
+ const globals = ['window', 'document', 'Node', 'navigator', 'IS_REACT_ACT_ENVIRONMENT'] as const;
8
+ const previousGlobals = globals.map(
9
+ (key) => [key, Object.getOwnPropertyDescriptor(globalThis, key)] as const,
10
+ );
11
+ Object.assign(globalThis, {
12
+ IS_REACT_ACT_ENVIRONMENT: true,
13
+ Node: browser.Node,
14
+ document: browser.document,
15
+ navigator: browser.navigator,
16
+ window: browser,
17
+ });
18
+
19
+ const calls = { fullscreen: 0, pause: 0, play: 0, seeks: [] as number[] };
20
+ const player = {
21
+ addListener: () => ({ remove: () => undefined }),
22
+ currentTime: 15,
23
+ duration: 120,
24
+ pause: () => {
25
+ calls.pause += 1;
26
+ },
27
+ play: () => {
28
+ calls.play += 1;
29
+ },
30
+ playing: false,
31
+ seekBy: (seconds: number) => calls.seeks.push(seconds),
32
+ timeUpdateEventInterval: 0,
33
+ volume: 0.5,
34
+ };
35
+
36
+ await mock.module('expo-video', () => ({
37
+ VideoView: React.forwardRef((_props, ref) => {
38
+ React.useImperativeHandle(ref, () => ({
39
+ enterFullscreen: () => {
40
+ calls.fullscreen += 1;
41
+ return Promise.resolve();
42
+ },
43
+ }));
44
+ return <video data-testid="expo-video" />;
45
+ }),
46
+ useVideoPlayer: (source: string | null, configure: (value: typeof player) => void) => {
47
+ configure(player);
48
+ return source === null ? { ...player, currentTime: 0, duration: 0 } : player;
49
+ },
50
+ }));
51
+ await mock.module('react-native', () => ({
52
+ Pressable: ({
53
+ accessibilityLabel,
54
+ children,
55
+ disabled,
56
+ onPress,
57
+ }: {
58
+ accessibilityLabel?: string;
59
+ children?: React.ReactNode;
60
+ disabled?: boolean;
61
+ onPress?: () => void;
62
+ }) => (
63
+ <button aria-label={accessibilityLabel} disabled={disabled} onClick={onPress}>
64
+ {children}
65
+ </button>
66
+ ),
67
+ }));
68
+ await mock.module('../../../button/public', () => ({
69
+ IconButton: ({
70
+ disabled,
71
+ label,
72
+ onPress,
73
+ }: {
74
+ disabled?: boolean;
75
+ label: string;
76
+ onPress?: () => void;
77
+ }) => (
78
+ <button aria-label={label} disabled={disabled} onClick={onPress}>
79
+ {label}
80
+ </button>
81
+ ),
82
+ }));
83
+ await mock.module('../../../image/public', () => ({
84
+ Image: ({ source }: { source?: string }) => <img alt="" src={source} />,
85
+ }));
86
+ await mock.module('../../../layout/public', () => ({
87
+ View: ({ children, testID }: { children?: React.ReactNode; testID?: string }) => (
88
+ <div data-testid={testID}>{children}</div>
89
+ ),
90
+ }));
91
+ await mock.module('../../../theme/adapters/inbound/withZoraThemeScope', () => ({
92
+ withZoraThemeScope: <P,>(Component: React.ComponentType<P>) => Component,
93
+ }));
94
+ await mock.module('../../../theme/composition/useZoraTheme', () => ({
95
+ useZoraTheme: () => ({
96
+ theme: {
97
+ semantics: {
98
+ action: { primary: { base: '#123456' } },
99
+ neutral: { divider: '#999999', surface: '#eeeeee' },
100
+ surface: { raised: '#ffffff' },
101
+ },
102
+ },
103
+ }),
104
+ }));
105
+ await mock.module('../../../typography/public', () => ({
106
+ Text: ({ children }: { children?: React.ReactNode }) => <span>{children}</span>,
107
+ }));
108
+
109
+ const { Video } = await import('./Video');
110
+ const { Video: WebVideo } = await import('./Video.web');
111
+
112
+ afterAll(() => {
113
+ browser.close();
114
+ for (const [key, descriptor] of previousGlobals) {
115
+ if (descriptor) Object.defineProperty(globalThis, key, descriptor);
116
+ else Reflect.deleteProperty(globalThis, key);
117
+ }
118
+ });
119
+
120
+ test('renders themed playback controls and delegates transport to expo-video', async () => {
121
+ const host = document.createElement('div');
122
+ document.body.append(host);
123
+ const root = createRoot(host);
124
+
125
+ try {
126
+ await act(() =>
127
+ Promise.resolve().then(() => root.render(<Video source="https://example.test/video.mp4" />)),
128
+ );
129
+
130
+ expect(player.timeUpdateEventInterval).toBe(0.25);
131
+ expect(host.textContent).toContain('0:15 / 2:00');
132
+ expect(host.querySelector('[data-testid="expo-video"]')).not.toBeNull();
133
+
134
+ host.querySelector<HTMLButtonElement>('[aria-label="Play video"]')?.click();
135
+ host.querySelector<HTMLButtonElement>('[aria-label="Seek back 10 seconds"]')?.click();
136
+ host.querySelector<HTMLButtonElement>('[aria-label="Seek forward 10 seconds"]')?.click();
137
+ host.querySelector<HTMLButtonElement>('[aria-label="Lower volume"]')?.click();
138
+ host.querySelector<HTMLButtonElement>('[aria-label="Enter fullscreen Video player"]')?.click();
139
+
140
+ expect(calls.play).toBe(1);
141
+ expect(calls.seeks).toEqual([-10, 10]);
142
+ expect(player.volume).toBeCloseTo(0.9);
143
+ expect(calls.fullscreen).toBe(1);
144
+ } finally {
145
+ await act(() => Promise.resolve().then(() => root.unmount()));
146
+ host.remove();
147
+ }
148
+ });
149
+
150
+ test('keeps playback controls passive after the web adapter loads the video implementation', async () => {
151
+ const host = document.createElement('div');
152
+ document.body.append(host);
153
+ const root = createRoot(host);
154
+ const initialCalls = { ...calls, seeks: [...calls.seeks] };
155
+
156
+ try {
157
+ await act(() =>
158
+ Promise.resolve().then(() =>
159
+ root.render(
160
+ <WebVideo interactionPolicy="passive" source="https://example.test/video.mp4" />,
161
+ ),
162
+ ),
163
+ );
164
+
165
+ await act(() => Promise.resolve());
166
+
167
+ const controls = [
168
+ 'Seek video',
169
+ 'Seek back 10 seconds',
170
+ 'Play video',
171
+ 'Seek forward 10 seconds',
172
+ 'Lower volume',
173
+ 'Raise volume',
174
+ 'Enter fullscreen Video player',
175
+ ];
176
+ const buttons = controls.map((label) =>
177
+ host.querySelector<HTMLButtonElement>(`[aria-label="${label}"]`),
178
+ );
179
+
180
+ expect(buttons.every((button) => button?.disabled === true)).toBe(true);
181
+ for (const button of buttons) button?.click();
182
+
183
+ expect(calls).toEqual(initialCalls);
184
+ } finally {
185
+ await act(() => Promise.resolve().then(() => root.unmount()));
186
+ host.remove();
187
+ }
188
+ });
@@ -0,0 +1 @@
1
+ export { Video } from './Video.native';
@@ -0,0 +1,70 @@
1
+ import React from 'react';
2
+
3
+ import type { VideoProps } from '../../../../types/video';
4
+ import { Image } from '../../../image/public';
5
+ import { View } from '../../../layout/public';
6
+ import { withZoraThemeScope } from '../../../theme/adapters/inbound/withZoraThemeScope';
7
+ import { useZoraTheme } from '../../../theme/composition/useZoraTheme';
8
+
9
+ /*** Defers Expo Video's browser runtime until after hydration while preserving a themed poster shell. */
10
+ export const Video = withZoraThemeScope(VideoWebInner);
11
+
12
+ /*** Renders the SSR-safe video poster, then loads the Expo-backed adapter in a browser runtime. */
13
+ function VideoWebInner({
14
+ themeId: _themeId,
15
+ mode: _mode,
16
+ interactionPolicy,
17
+ poster,
18
+ aspectRatio = 16 / 9,
19
+ contentFit = 'contain',
20
+ ...props
21
+ }: VideoProps) {
22
+ const { theme } = useZoraTheme();
23
+ const [NativeVideo, setNativeVideo] = React.useState<React.ComponentType<VideoProps> | null>(
24
+ null,
25
+ );
26
+ const safeAspectRatio = Number.isFinite(aspectRatio) && aspectRatio > 0 ? aspectRatio : 16 / 9;
27
+
28
+ React.useEffect(() => {
29
+ let active = true;
30
+ void import('./Video.native').then(({ Video: LoadedVideo }) => {
31
+ if (active) setNativeVideo(() => LoadedVideo);
32
+ });
33
+
34
+ return () => {
35
+ active = false;
36
+ };
37
+ }, []);
38
+
39
+ if (NativeVideo) {
40
+ return (
41
+ <NativeVideo
42
+ {...props}
43
+ aspectRatio={safeAspectRatio}
44
+ contentFit={contentFit}
45
+ interactionPolicy={interactionPolicy}
46
+ poster={poster}
47
+ />
48
+ );
49
+ }
50
+
51
+ return (
52
+ <View
53
+ bg={theme.semantics.neutral.surface}
54
+ borderColor={theme.semantics.neutral.divider}
55
+ borderWidth={1}
56
+ overflow="hidden"
57
+ radius="m"
58
+ style={{ aspectRatio: safeAspectRatio }}
59
+ >
60
+ {poster ? (
61
+ <Image
62
+ alt=""
63
+ aspectRatio={safeAspectRatio}
64
+ fit={contentFit === 'fill' ? 'stretch' : contentFit}
65
+ source={poster}
66
+ />
67
+ ) : null}
68
+ </View>
69
+ );
70
+ }
@@ -0,0 +1,7 @@
1
+ export type {
2
+ VideoContentFit,
3
+ VideoManifestProps,
4
+ VideoProps,
5
+ VideoResolvedSource,
6
+ } from '../../types/video';
7
+ export { Video } from './adapters/inbound/Video';