@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.
- package/CHANGELOG.md +17 -0
- package/README.md +1 -1
- package/dist/capabilities/index.js +127 -2
- package/dist/capabilities/index.js.map +8 -5
- package/dist/constants/authoring.d.ts +6 -3
- package/dist/constants/authoring.d.ts.map +1 -1
- package/dist/constants/authoring.js +6 -0
- package/dist/constants/authoring.js.map +1 -1
- package/dist/features/accordion/accordionItemMeta.d.ts +1 -1
- package/dist/features/audio/adapters/inbound/Audio.d.ts +5 -0
- package/dist/features/audio/adapters/inbound/Audio.d.ts.map +1 -0
- package/dist/features/audio/adapters/inbound/Audio.js +80 -0
- package/dist/features/audio/adapters/inbound/Audio.js.map +1 -0
- package/dist/features/audio/audioMeta.d.ts +22 -0
- package/dist/features/audio/audioMeta.d.ts.map +1 -0
- package/dist/features/audio/audioMeta.js +18 -0
- package/dist/features/audio/audioMeta.js.map +1 -0
- package/dist/features/audio/composition/AudioController.d.ts +13 -0
- package/dist/features/audio/composition/AudioController.d.ts.map +1 -0
- package/dist/features/audio/composition/AudioController.js +2 -0
- package/dist/features/audio/composition/AudioController.js.map +1 -0
- package/dist/features/audio/composition/useAudioController.d.ts +5 -0
- package/dist/features/audio/composition/useAudioController.d.ts.map +1 -0
- package/dist/features/audio/composition/useAudioController.js +22 -0
- package/dist/features/audio/composition/useAudioController.js.map +1 -0
- package/dist/features/audio/composition/useAudioController.web.d.ts +5 -0
- package/dist/features/audio/composition/useAudioController.web.d.ts.map +1 -0
- package/dist/features/audio/composition/useAudioController.web.js +80 -0
- package/dist/features/audio/composition/useAudioController.web.js.map +1 -0
- package/dist/features/audio/public.d.ts +3 -0
- package/dist/features/audio/public.d.ts.map +1 -0
- package/dist/features/audio/public.js +2 -0
- package/dist/features/audio/public.js.map +1 -0
- package/dist/features/bottom-sheet/bottomSheetMeta.d.ts +1 -1
- package/dist/features/card/cardMeta.d.ts +1 -1
- package/dist/features/card/mediaCardMeta.d.ts +1 -1
- package/dist/features/card/postCardMeta.d.ts +1 -1
- package/dist/features/chat/messageBubbleMeta.d.ts +1 -1
- package/dist/features/dialog/dialogMeta.d.ts +2 -2
- package/dist/features/gradient/gradientMeta.d.ts +1 -1
- package/dist/features/keyboard-avoiding-view/keyboardAvoidingViewMeta.d.ts +1 -1
- package/dist/features/layout/gridMeta.d.ts +1 -1
- package/dist/features/layout/screenMeta.d.ts +1 -1
- package/dist/features/layout/scrollViewMeta.d.ts +1 -1
- package/dist/features/layout/viewMeta.d.ts +1 -1
- package/dist/features/list/flatListMeta.d.ts +1 -1
- package/dist/features/list/sectionListMeta.d.ts +1 -1
- package/dist/features/master-detail/masterDetailMeta.d.ts +1 -1
- package/dist/features/reader/meta.d.ts +2 -2
- package/dist/features/registry/ZORA_BASE_COMPONENT_REGISTRY.d.ts.map +1 -1
- package/dist/features/registry/ZORA_BASE_COMPONENT_REGISTRY.js +6 -0
- package/dist/features/registry/ZORA_BASE_COMPONENT_REGISTRY.js.map +1 -1
- package/dist/features/registry/bindableComponentMeta.d.ts +2 -2
- package/dist/features/registry/componentMeta.d.ts.map +1 -1
- package/dist/features/registry/componentMeta.js +6 -0
- package/dist/features/registry/componentMeta.js.map +1 -1
- package/dist/features/rich-text/adapters/inbound/RichText.d.ts +11 -0
- package/dist/features/rich-text/adapters/inbound/RichText.d.ts.map +1 -0
- package/dist/features/rich-text/adapters/inbound/RichText.js +11 -0
- package/dist/features/rich-text/adapters/inbound/RichText.js.map +1 -0
- package/dist/features/rich-text/adapters/inbound/RichText.web.d.ts +5 -0
- package/dist/features/rich-text/adapters/inbound/RichText.web.d.ts.map +1 -0
- package/dist/features/rich-text/adapters/inbound/RichText.web.js +17 -0
- package/dist/features/rich-text/adapters/inbound/RichText.web.js.map +1 -0
- package/dist/features/rich-text/adapters/inbound/RichTextClient.d.ts +5 -0
- package/dist/features/rich-text/adapters/inbound/RichTextClient.d.ts.map +1 -0
- package/dist/features/rich-text/adapters/inbound/RichTextClient.js +94 -0
- package/dist/features/rich-text/adapters/inbound/RichTextClient.js.map +1 -0
- package/dist/features/rich-text/public.d.ts +3 -0
- package/dist/features/rich-text/public.d.ts.map +1 -0
- package/dist/features/rich-text/public.js +2 -0
- package/dist/features/rich-text/public.js.map +1 -0
- package/dist/features/rich-text/richTextMeta.d.ts +65 -0
- package/dist/features/rich-text/richTextMeta.d.ts.map +1 -0
- package/dist/features/rich-text/richTextMeta.js +48 -0
- package/dist/features/rich-text/richTextMeta.js.map +1 -0
- package/dist/features/rich-text/utils/resolveRichTextHtmlStyle.d.ts +5 -0
- package/dist/features/rich-text/utils/resolveRichTextHtmlStyle.d.ts.map +1 -0
- package/dist/features/rich-text/utils/resolveRichTextHtmlStyle.js +29 -0
- package/dist/features/rich-text/utils/resolveRichTextHtmlStyle.js.map +1 -0
- package/dist/features/rich-text/utils/sanitizeRichTextHtml.d.ts +3 -0
- package/dist/features/rich-text/utils/sanitizeRichTextHtml.d.ts.map +1 -0
- package/dist/features/rich-text/utils/sanitizeRichTextHtml.js +38 -0
- package/dist/features/rich-text/utils/sanitizeRichTextHtml.js.map +1 -0
- package/dist/features/scanner/meta.d.ts +2 -2
- package/dist/features/section/screenSectionMeta.d.ts +1 -1
- package/dist/features/surface/surfaceMeta.d.ts +1 -1
- package/dist/features/tabs/tabPanelMeta.d.ts +1 -1
- package/dist/features/video/adapters/inbound/Video.d.ts +2 -0
- package/dist/features/video/adapters/inbound/Video.d.ts.map +1 -0
- package/dist/features/video/adapters/inbound/Video.js +2 -0
- package/dist/features/video/adapters/inbound/Video.js.map +1 -0
- package/dist/features/video/adapters/inbound/Video.native.d.ts +5 -0
- package/dist/features/video/adapters/inbound/Video.native.d.ts.map +1 -0
- package/dist/features/video/adapters/inbound/Video.native.js +160 -0
- package/dist/features/video/adapters/inbound/Video.native.js.map +1 -0
- package/dist/features/video/adapters/inbound/Video.web.d.ts +5 -0
- package/dist/features/video/adapters/inbound/Video.web.d.ts.map +1 -0
- package/dist/features/video/adapters/inbound/Video.web.js +30 -0
- package/dist/features/video/adapters/inbound/Video.web.js.map +1 -0
- package/dist/features/video/public.d.ts +3 -0
- package/dist/features/video/public.d.ts.map +1 -0
- package/dist/features/video/public.js +2 -0
- package/dist/features/video/public.js.map +1 -0
- package/dist/features/video/videoMeta.d.ts +64 -0
- package/dist/features/video/videoMeta.d.ts.map +1 -0
- package/dist/features/video/videoMeta.js +50 -0
- package/dist/features/video/videoMeta.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/readerFree.d.ts +4 -0
- package/dist/readerFree.d.ts.map +1 -1
- package/dist/readerFree.js +3 -0
- package/dist/readerFree.js.map +1 -1
- package/dist/types/audio.d.ts +15 -0
- package/dist/types/audio.d.ts.map +1 -0
- package/dist/types/audio.js +2 -0
- package/dist/types/audio.js.map +1 -0
- package/dist/types/rich-text.d.ts +24 -0
- package/dist/types/rich-text.d.ts.map +1 -0
- package/dist/types/rich-text.js +2 -0
- package/dist/types/rich-text.js.map +1 -0
- package/dist/types/video.d.ts +24 -0
- package/dist/types/video.d.ts.map +1 -0
- package/dist/types/video.js +2 -0
- package/dist/types/video.js.map +1 -0
- package/package.json +61 -3
- package/src/constants/authoring.ts +6 -0
- package/src/features/audio/adapters/inbound/Audio.tsx +158 -0
- package/src/features/audio/audioMeta.ts +20 -0
- package/src/features/audio/composition/AudioController.ts +12 -0
- package/src/features/audio/composition/useAudioController.ts +27 -0
- package/src/features/audio/composition/useAudioController.web.ts +106 -0
- package/src/features/audio/public.test.ts +37 -0
- package/src/features/audio/public.ts +2 -0
- package/src/features/registry/ZORA_BASE_COMPONENT_REGISTRY.ts +6 -0
- package/src/features/registry/componentMeta.test.ts +17 -0
- package/src/features/registry/componentMeta.ts +6 -0
- package/src/features/rich-text/adapters/inbound/RichText.tsx +15 -0
- package/src/features/rich-text/adapters/inbound/RichText.web.tsx +28 -0
- package/src/features/rich-text/adapters/inbound/RichTextClient.tsx +246 -0
- package/src/features/rich-text/public.ts +2 -0
- package/src/features/rich-text/richTextMeta.test.ts +52 -0
- package/src/features/rich-text/richTextMeta.ts +50 -0
- package/src/features/rich-text/utils/resolveRichTextHtmlStyle.test.ts +17 -0
- package/src/features/rich-text/utils/resolveRichTextHtmlStyle.ts +31 -0
- package/src/features/rich-text/utils/sanitizeRichTextHtml.test.ts +29 -0
- package/src/features/rich-text/utils/sanitizeRichTextHtml.ts +40 -0
- package/src/features/video/adapters/inbound/Video.native.tsx +296 -0
- package/src/features/video/adapters/inbound/Video.test.tsx +188 -0
- package/src/features/video/adapters/inbound/Video.tsx +1 -0
- package/src/features/video/adapters/inbound/Video.web.tsx +70 -0
- package/src/features/video/public.ts +7 -0
- package/src/features/video/videoMeta.ts +51 -0
- package/src/index.ts +2 -0
- package/src/readerFree.ts +14 -0
- package/src/types/audio.ts +16 -0
- package/src/types/rich-text.ts +24 -0
- package/src/types/video.ts +28 -0
- package/src/webPackageExports.test.ts +9 -0
- package/web-dist/chunks/{Accordion-4v920xz8.js → Accordion-01bsg7zt.js} +1 -1
- package/web-dist/chunks/{Accordion-pvfmhrm0.js → Accordion-17s33h1a.js} +1 -1
- package/web-dist/chunks/{Accordion-vyw2bzye.js → Accordion-2wggrer7.js} +2 -2
- package/web-dist/chunks/{Accordion-bjq32vq2.js → Accordion-2xb252py.js} +3 -3
- package/web-dist/chunks/{Accordion-kr1reyt9.js → Accordion-2xkxthf1.js} +7 -7
- package/web-dist/chunks/{Accordion-fc058wqp.js → Accordion-2ys50fc8.js} +1 -1
- package/web-dist/chunks/{Accordion-7zhdzn00.js → Accordion-379mgrse.js} +1 -1
- package/web-dist/chunks/{Accordion-xeyw6ndr.js → Accordion-38xvj0cq.js} +4 -4
- package/web-dist/chunks/{Accordion-8gfgaq01.js → Accordion-4zb6dcys.js} +1 -1
- package/web-dist/chunks/{Accordion-nrwc0rx2.js → Accordion-5mga7hty.js} +1 -1
- package/web-dist/chunks/{Accordion-3qvtv4g6.js → Accordion-5qz4j8tt.js} +6 -6
- package/web-dist/chunks/{Accordion-4zbh7wfn.js → Accordion-5rwztz14.js} +1 -1
- package/web-dist/chunks/{Accordion-frfh3nz6.js → Accordion-9qg7cjt8.js} +2 -2
- package/web-dist/chunks/{Accordion-g07r4t2f.js → Accordion-a1mgdfg7.js} +1 -1
- package/web-dist/chunks/{Accordion-dcm6ywt2.js → Accordion-axe7nsht.js} +1 -1
- package/web-dist/chunks/{Accordion-e2b9yja2.js → Accordion-bd9vzpbz.js} +6 -6
- package/web-dist/chunks/{Accordion-csz7sgjm.js → Accordion-bp9y7738.js} +6 -6
- package/web-dist/chunks/{Accordion-64w34bgd.js → Accordion-bzgy9sg3.js} +2 -2
- package/web-dist/chunks/{Accordion-r30bwg03.js → Accordion-e0vm82xr.js} +2 -2
- package/web-dist/chunks/{Accordion-em4ktbkk.js → Accordion-f1vargnk.js} +4 -4
- package/web-dist/chunks/{Accordion-k6v7p2na.js → Accordion-f8a49gy8.js} +1 -1
- package/web-dist/chunks/{Accordion-g5c5sqn7.js → Accordion-f8zpd80k.js} +4 -4
- package/web-dist/chunks/{Accordion-22z6y8kw.js → Accordion-gnbt6w4q.js} +3 -3
- package/web-dist/chunks/{Accordion-s1qjbbb0.js → Accordion-hdyzyw8q.js} +1 -1
- package/web-dist/chunks/{Accordion-q0cbpr2d.js → Accordion-htm3j8r8.js} +4 -4
- package/web-dist/chunks/{Accordion-mh3bhcb4.js → Accordion-kdb9g5b1.js} +3 -3
- package/web-dist/chunks/{Accordion-zsd0ar2p.js → Accordion-nmpzv3b0.js} +3 -3
- package/web-dist/chunks/{Accordion-b8ncebyz.js → Accordion-pdjhezmz.js} +1 -1
- package/web-dist/chunks/{Accordion-zqa9mt13.js → Accordion-q683s6kd.js} +2 -2
- package/web-dist/chunks/{Accordion-30284ah1.js → Accordion-r75ep5pg.js} +4 -4
- package/web-dist/chunks/{Accordion-rmakadh6.js → Accordion-rq311z1k.js} +4 -4
- package/web-dist/chunks/{Accordion-w28mb1ed.js → Accordion-rtamzg9j.js} +1 -1
- package/web-dist/chunks/{Accordion-nv1evygk.js → Accordion-sh79sr5g.js} +1 -1
- package/web-dist/chunks/{Accordion-t93g1wq3.js → Accordion-t9n4ey2r.js} +1 -1
- package/web-dist/chunks/{Accordion-zanzeryt.js → Accordion-tqagt6cz.js} +1 -1
- package/web-dist/chunks/{Accordion-0n3y5ry1.js → Accordion-v6vhyv31.js} +1 -1
- package/web-dist/chunks/Accordion-v86n9tvj.js +37 -0
- package/web-dist/chunks/{Accordion-6pkteb8k.js → Accordion-vb52sts9.js} +3 -3
- package/web-dist/chunks/{Accordion-rwjbwm18.js → Accordion-vkqqktc5.js} +1 -1
- package/web-dist/chunks/{Accordion-9zwdqhf2.js → Accordion-za0jcjgn.js} +2 -2
- package/web-dist/chunks/RichTextClient-8x3t7bwd.js +1676 -0
- package/web-dist/chunks/Video.native-97x0098j.js +905 -0
- package/web-dist/chunks/index-cnnsfz6n.js +1807 -0
- package/web-dist/components/accordion/Accordion.js +3 -3
- package/web-dist/components/accordion-item/AccordionItem.js +3 -3
- package/web-dist/components/app-bar/AppBar.js +7 -7
- package/web-dist/components/app-header/AppHeader.js +7 -7
- package/web-dist/components/app-shell/AppShell.js +2 -2
- package/web-dist/components/audio/Audio.d.ts +7 -0
- package/web-dist/components/audio/Audio.dependency-0.d.ts +27 -0
- package/web-dist/components/audio/Audio.dependency-1.d.ts +3 -0
- package/web-dist/components/audio/Audio.js +264 -0
- package/web-dist/components/audio/Audio.types-0.d.ts +18 -0
- package/web-dist/components/audio/index.d.ts +2 -0
- package/web-dist/components/audio/index.js +2 -0
- package/web-dist/components/auth-screen/AuthScreen.js +11 -11
- package/web-dist/components/avatar/Avatar.js +3 -3
- package/web-dist/components/avatar-group/AvatarGroup.js +3 -3
- package/web-dist/components/badge/Badge.js +2 -2
- package/web-dist/components/barcode-scanner-view/BarcodeScannerView.js +10 -10
- package/web-dist/components/bottom-sheet/BottomSheet.js +4 -4
- package/web-dist/components/bottom-sheet-flat-list/BottomSheetFlatList.js +4 -4
- package/web-dist/components/bottom-sheet-scroll-view/BottomSheetScrollView.js +4 -4
- package/web-dist/components/bottom-sheet-section-list/BottomSheetSectionList.js +4 -4
- package/web-dist/components/bottom-sheet-view/BottomSheetView.js +4 -4
- package/web-dist/components/bottom-sheet-virtualized-list/BottomSheetVirtualizedList.js +4 -4
- package/web-dist/components/breadcrumbs/Breadcrumbs.js +4 -4
- package/web-dist/components/button/Button.js +4 -4
- package/web-dist/components/button-group/ButtonGroup.js +4 -4
- package/web-dist/components/calendar/Calendar.js +5 -5
- package/web-dist/components/camera-permission-view/CameraPermissionView.js +10 -10
- package/web-dist/components/card/Card.js +9 -9
- package/web-dist/components/chat-list-item/ChatListItem.js +6 -6
- package/web-dist/components/checkbox/Checkbox.js +4 -4
- package/web-dist/components/checkbox-group/CheckboxGroup.js +4 -4
- package/web-dist/components/chip/Chip.js +4 -4
- package/web-dist/components/chip-group/ChipGroup.js +4 -4
- package/web-dist/components/collection-editor/CollectionEditor.js +9 -9
- package/web-dist/components/color-hue-scale/ColorHueScale.js +14 -14
- package/web-dist/components/color-picker/ColorPicker.js +14 -14
- package/web-dist/components/color-tone/ColorTone.js +14 -14
- package/web-dist/components/color-wheel/ColorWheel.js +14 -14
- package/web-dist/components/content-rail/ContentRail.js +4 -4
- package/web-dist/components/data-table/DataTable.js +15 -15
- package/web-dist/components/date-picker/DatePicker.js +9 -9
- package/web-dist/components/dialog/Dialog.js +4 -4
- package/web-dist/components/divider/Divider.js +2 -2
- package/web-dist/components/empty-state/EmptyState.js +10 -10
- package/web-dist/components/explorer/Explorer.js +4 -4
- package/web-dist/components/field/Field.js +4 -4
- package/web-dist/components/file-explorer/FileExplorer.js +4 -4
- package/web-dist/components/flat-list/FlatList.js +5 -5
- package/web-dist/components/forgot-password-form/ForgotPasswordForm.js +11 -11
- package/web-dist/components/form/Form.js +7 -7
- package/web-dist/components/form-actions/FormActions.js +7 -7
- package/web-dist/components/form-error/FormError.js +7 -7
- package/web-dist/components/game/Game.js +3 -3
- package/web-dist/components/game-entity/GameEntity.js +3 -3
- package/web-dist/components/game-field/GameField.js +3 -3
- package/web-dist/components/game-input-zone/GameInputZone.js +3 -3
- package/web-dist/components/game-measurement-probe/GameMeasurementProbe.js +3 -3
- package/web-dist/components/game-overlay/GameOverlay.js +3 -3
- package/web-dist/components/gradient/Gradient.js +3 -3
- package/web-dist/components/gradient-renderer-provider/GradientRendererProvider.js +3 -3
- package/web-dist/components/grid/Grid.js +2 -2
- package/web-dist/components/hero/Hero.js +9 -9
- package/web-dist/components/icon-button/IconButton.js +4 -4
- package/web-dist/components/image/Image.js +3 -3
- package/web-dist/components/list/List.js +5 -5
- package/web-dist/components/list-item/ListItem.js +5 -5
- package/web-dist/components/list-section/ListSection.js +5 -5
- package/web-dist/components/master-detail/MasterDetail.js +2 -2
- package/web-dist/components/media-card/MediaCard.js +9 -9
- package/web-dist/components/media-explorer/MediaExplorer.js +4 -4
- package/web-dist/components/message-bubble/MessageBubble.js +6 -6
- package/web-dist/components/metric-card/MetricCard.js +9 -9
- package/web-dist/components/missing-element/MissingElement.js +3 -3
- package/web-dist/components/o-auth-provider-button/OAuthProviderButton.js +11 -11
- package/web-dist/components/o-auth-provider-list/OAuthProviderList.js +11 -11
- package/web-dist/components/otp-form/OtpForm.js +11 -11
- package/web-dist/components/pagination/Pagination.js +4 -4
- package/web-dist/components/palette-item/PaletteItem.js +9 -9
- package/web-dist/components/popover-menu/PopoverMenu.js +4 -4
- package/web-dist/components/post-card/PostCard.js +9 -9
- package/web-dist/components/product-card/ProductCard.js +9 -9
- package/web-dist/components/progress/Progress.js +3 -3
- package/web-dist/components/progress-ring/ProgressRing.js +3 -3
- package/web-dist/components/radio/Radio.js +4 -4
- package/web-dist/components/radio-group/RadioGroup.js +4 -4
- package/web-dist/components/rating/Rating.js +2 -2
- package/web-dist/components/reader/Reader.js +10 -10
- package/web-dist/components/rich-text/RichText.d.ts +13 -0
- package/web-dist/components/rich-text/RichText.dependency-0.d.ts +27 -0
- package/web-dist/components/rich-text/RichText.dependency-1.d.ts +3 -0
- package/web-dist/components/rich-text/RichText.js +35 -0
- package/web-dist/components/rich-text/RichText.types-0.d.ts +24 -0
- package/web-dist/components/rich-text/index.d.ts +2 -0
- package/web-dist/components/rich-text/index.js +2 -0
- package/web-dist/components/scan-overlay/ScanOverlay.js +10 -10
- package/web-dist/components/screen/Screen.js +2 -2
- package/web-dist/components/screen-section/ScreenSection.js +3 -3
- package/web-dist/components/scroll-view/ScrollView.js +2 -2
- package/web-dist/components/search-input/SearchInput.js +5 -5
- package/web-dist/components/section-header/SectionHeader.js +3 -3
- package/web-dist/components/section-list/SectionList.js +5 -5
- package/web-dist/components/select/Select.js +9 -9
- package/web-dist/components/sign-in-form/SignInForm.js +11 -11
- package/web-dist/components/sign-up-form/SignUpForm.js +11 -11
- package/web-dist/components/skeleton/Skeleton.js +12 -12
- package/web-dist/components/skeleton-card/SkeletonCard.js +12 -12
- package/web-dist/components/skeleton-list/SkeletonList.js +12 -12
- package/web-dist/components/skeleton-text/SkeletonText.js +12 -12
- package/web-dist/components/surface/Surface.js +3 -3
- package/web-dist/components/switch/Switch.js +2 -2
- package/web-dist/components/tab/Tab.js +2 -2
- package/web-dist/components/tab-list/TabList.js +2 -2
- package/web-dist/components/tab-panel/TabPanel.js +2 -2
- package/web-dist/components/tabs/Tabs.js +2 -2
- package/web-dist/components/text-input/TextInput.js +5 -5
- package/web-dist/components/theme-mode-toggle/ThemeModeToggle.js +4 -4
- package/web-dist/components/time-picker/TimePicker.js +8 -8
- package/web-dist/components/timeline/Timeline.js +3 -3
- package/web-dist/components/toast/Toast.js +4 -4
- package/web-dist/components/toast-provider/ToastProvider.js +4 -4
- package/web-dist/components/toolbar/Toolbar.js +14 -43
- package/web-dist/components/tree-item/TreeItem.js +6 -6
- package/web-dist/components/uploader/Uploader.js +12 -12
- package/web-dist/components/video/Video.d.ts +7 -0
- package/web-dist/components/video/Video.dependency-0.d.ts +27 -0
- package/web-dist/components/video/Video.dependency-1.d.ts +3 -0
- package/web-dist/components/video/Video.dependency-2.d.ts +9 -0
- package/web-dist/components/video/Video.dependency-3.d.ts +23 -0
- package/web-dist/components/video/Video.js +80 -0
- package/web-dist/components/video/Video.types-0.d.ts +29 -0
- package/web-dist/components/video/index.d.ts +2 -0
- package/web-dist/components/video/index.js +2 -0
- package/web-dist/components/view/View.js +2 -2
- package/web-dist/manifest.json +802 -675
- package/web-dist/runtime/ZoraProvider.js +3 -3
- /package/web-dist/chunks/{Accordion-5kaxyqy1.js → Accordion-ww4f12ty.js} +0 -0
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import type { AudioProps } from '../../../types/audio';
|
|
4
|
+
import type { AudioController } from './AudioController';
|
|
5
|
+
|
|
6
|
+
interface ExpoAudioPlayer {
|
|
7
|
+
readonly currentTime: number;
|
|
8
|
+
readonly duration: number;
|
|
9
|
+
readonly isLoaded: boolean;
|
|
10
|
+
readonly playing: boolean;
|
|
11
|
+
volume: number;
|
|
12
|
+
pause(): void;
|
|
13
|
+
play(): void;
|
|
14
|
+
remove(): void;
|
|
15
|
+
seekTo(seconds: number): Promise<void>;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
interface ExpoAudioModule {
|
|
19
|
+
createAudioPlayer(
|
|
20
|
+
source: AudioProps['source'],
|
|
21
|
+
options: { readonly updateInterval: number },
|
|
22
|
+
): ExpoAudioPlayer;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const UNAVAILABLE_AUDIO_CONTROLLER: AudioController = {
|
|
26
|
+
currentTime: 0,
|
|
27
|
+
duration: 0,
|
|
28
|
+
isLoaded: false,
|
|
29
|
+
pause: () => undefined,
|
|
30
|
+
play: () => undefined,
|
|
31
|
+
playing: false,
|
|
32
|
+
seekTo: () => Promise.resolve(),
|
|
33
|
+
setVolume: () => undefined,
|
|
34
|
+
volume: 1,
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
/** Applies the requested volume through Expo Audio's mutable web player boundary. */
|
|
38
|
+
function setWebAudioPlayerVolume(player: ExpoAudioPlayer, volume: number): void {
|
|
39
|
+
player.volume = volume;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** Connects web Audio controls to Expo Audio after the SSR-safe client boundary mounts. */
|
|
43
|
+
export function useAudioController(source: AudioProps['source']): AudioController {
|
|
44
|
+
const [player, setPlayer] = React.useState<ExpoAudioPlayer | null>(null);
|
|
45
|
+
const [state, setState] = React.useState<AudioController>(UNAVAILABLE_AUDIO_CONTROLLER);
|
|
46
|
+
|
|
47
|
+
React.useEffect(() => {
|
|
48
|
+
let active = true;
|
|
49
|
+
let resolvedPlayer: ExpoAudioPlayer | null = null;
|
|
50
|
+
let timer: ReturnType<typeof setInterval> | null = null;
|
|
51
|
+
|
|
52
|
+
/** Publishes the latest lightweight Expo Audio player state. */
|
|
53
|
+
const publish = () => {
|
|
54
|
+
const activePlayer = resolvedPlayer;
|
|
55
|
+
if (!activePlayer || !active) return;
|
|
56
|
+
setState((current) => ({
|
|
57
|
+
...current,
|
|
58
|
+
currentTime: activePlayer.currentTime,
|
|
59
|
+
duration: activePlayer.duration,
|
|
60
|
+
isLoaded: activePlayer.isLoaded,
|
|
61
|
+
playing: activePlayer.playing,
|
|
62
|
+
volume: activePlayer.volume,
|
|
63
|
+
}));
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
/** Loads Expo Audio only after hydration, preserving a safe web module entrypoint. */
|
|
67
|
+
const load = async () => {
|
|
68
|
+
const expoAudio = (await import('expo-audio')) as ExpoAudioModule;
|
|
69
|
+
if (!active) return;
|
|
70
|
+
resolvedPlayer = expoAudio.createAudioPlayer(source, { updateInterval: 250 });
|
|
71
|
+
setPlayer(resolvedPlayer);
|
|
72
|
+
publish();
|
|
73
|
+
timer = setInterval(publish, 250);
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
void load();
|
|
77
|
+
|
|
78
|
+
return () => {
|
|
79
|
+
active = false;
|
|
80
|
+
if (timer) clearInterval(timer);
|
|
81
|
+
resolvedPlayer?.remove();
|
|
82
|
+
setPlayer(null);
|
|
83
|
+
setState(UNAVAILABLE_AUDIO_CONTROLLER);
|
|
84
|
+
};
|
|
85
|
+
}, [source]);
|
|
86
|
+
|
|
87
|
+
return {
|
|
88
|
+
...state,
|
|
89
|
+
pause: () => {
|
|
90
|
+
player?.pause();
|
|
91
|
+
setState((current) => ({ ...current, playing: false }));
|
|
92
|
+
},
|
|
93
|
+
play: () => {
|
|
94
|
+
player?.play();
|
|
95
|
+
setState((current) => ({ ...current, playing: true }));
|
|
96
|
+
},
|
|
97
|
+
seekTo: async (seconds) => {
|
|
98
|
+
await player?.seekTo(seconds);
|
|
99
|
+
setState((current) => ({ ...current, currentTime: seconds }));
|
|
100
|
+
},
|
|
101
|
+
setVolume: (volume) => {
|
|
102
|
+
if (player) setWebAudioPlayerVolume(player, volume);
|
|
103
|
+
setState((current) => ({ ...current, volume }));
|
|
104
|
+
},
|
|
105
|
+
};
|
|
106
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { MediaAssetReference } from '@ankhorage/contracts';
|
|
2
|
+
import { describe, expect, test } from 'bun:test';
|
|
3
|
+
|
|
4
|
+
import type { AudioManifestProps, AudioProps } from '../../types/audio';
|
|
5
|
+
import { audioMeta } from './audioMeta';
|
|
6
|
+
|
|
7
|
+
describe('Audio public contract', () => {
|
|
8
|
+
test('keeps the authored source portable and the runtime source resolved', () => {
|
|
9
|
+
const manifestProps: AudioManifestProps = { source: { mediaId: 'intro-audio' } };
|
|
10
|
+
const runtimeProps: AudioProps = { source: { uri: 'https://example.test/intro.mp3' } };
|
|
11
|
+
const reference: MediaAssetReference = manifestProps.source;
|
|
12
|
+
|
|
13
|
+
expect(reference.mediaId).toBe('intro-audio');
|
|
14
|
+
expect(runtimeProps.source).toEqual({ uri: 'https://example.test/intro.mp3' });
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
test('publishes the SDK 57 audio boundary and authoring metadata', async () => {
|
|
18
|
+
const [packageJson, rootSource, readerFreeSource, publicSource, nativeControllerSource] =
|
|
19
|
+
await Promise.all([
|
|
20
|
+
Bun.file('package.json').json() as Promise<{
|
|
21
|
+
dependencies: Readonly<Record<string, string>>;
|
|
22
|
+
}>,
|
|
23
|
+
Bun.file('src/index.ts').text(),
|
|
24
|
+
Bun.file('src/readerFree.ts').text(),
|
|
25
|
+
Bun.file('src/features/audio/public.ts').text(),
|
|
26
|
+
Bun.file('src/features/audio/composition/useAudioController.ts').text(),
|
|
27
|
+
]);
|
|
28
|
+
|
|
29
|
+
expect(packageJson.dependencies['expo-audio']).toMatch(/^~57\.0\./u);
|
|
30
|
+
expect(packageJson.dependencies['expo-asset']).toMatch(/^~57\./u);
|
|
31
|
+
expect(`${rootSource}\n${readerFreeSource}`).toContain("from './features/audio/public'");
|
|
32
|
+
expect(publicSource).toContain('export { Audio }');
|
|
33
|
+
expect(nativeControllerSource).toContain("from 'expo-audio'");
|
|
34
|
+
expect(audioMeta.props.source).toMatchObject({ type: 'media', mediaKinds: ['audio'] });
|
|
35
|
+
expect(audioMeta.allowedChildren).toEqual([]);
|
|
36
|
+
});
|
|
37
|
+
});
|
|
@@ -6,6 +6,7 @@ import { Accordion, AccordionItem } from '../accordion/public';
|
|
|
6
6
|
import { ActivityIndicator } from '../activity-indicator/public';
|
|
7
7
|
import { AppBar } from '../app-bar/public';
|
|
8
8
|
import { AppHeader } from '../app-header/public';
|
|
9
|
+
import { Audio } from '../audio/public';
|
|
9
10
|
import {
|
|
10
11
|
AuthScreen,
|
|
11
12
|
ForgotPasswordForm,
|
|
@@ -66,6 +67,7 @@ import { PaletteItem } from '../palette-item/public';
|
|
|
66
67
|
import { PopoverMenu } from '../popover-menu/public';
|
|
67
68
|
import { Progress, ProgressRing } from '../progress/public';
|
|
68
69
|
import { Rating } from '../rating/public';
|
|
70
|
+
import { RichText } from '../rich-text/public';
|
|
69
71
|
import { BarcodeScannerView, CameraPermissionView, ScanOverlay } from '../scanner/public';
|
|
70
72
|
import { ScreenSection, SectionHeader } from '../section/public';
|
|
71
73
|
import { SelectableItem } from '../selection/public';
|
|
@@ -89,6 +91,7 @@ import { Toolbar } from '../toolbar/public';
|
|
|
89
91
|
import { TreeItem, TreeView } from '../tree-view/public';
|
|
90
92
|
import { Heading, Text } from '../typography/public';
|
|
91
93
|
import { Uploader } from '../uploader/public';
|
|
94
|
+
import { Video } from '../video/public';
|
|
92
95
|
|
|
93
96
|
type ComponentPropsFor<K extends keyof typeof _ZORA_BASE_COMPONENT_REGISTRY> = React.ComponentProps<
|
|
94
97
|
(typeof _ZORA_BASE_COMPONENT_REGISTRY)[K]
|
|
@@ -117,6 +120,7 @@ const _ZORA_BASE_COMPONENT_REGISTRY = {
|
|
|
117
120
|
Accordion,
|
|
118
121
|
AccordionItem,
|
|
119
122
|
ActivityIndicator,
|
|
123
|
+
Audio,
|
|
120
124
|
AppBar,
|
|
121
125
|
AppHeader,
|
|
122
126
|
Avatar,
|
|
@@ -158,6 +162,7 @@ const _ZORA_BASE_COMPONENT_REGISTRY = {
|
|
|
158
162
|
PopoverMenu,
|
|
159
163
|
Progress,
|
|
160
164
|
ProgressRing,
|
|
165
|
+
RichText,
|
|
161
166
|
Radio,
|
|
162
167
|
RadioGroup,
|
|
163
168
|
Rating,
|
|
@@ -177,6 +182,7 @@ const _ZORA_BASE_COMPONENT_REGISTRY = {
|
|
|
177
182
|
Toast,
|
|
178
183
|
Toolbar,
|
|
179
184
|
Uploader,
|
|
185
|
+
Video,
|
|
180
186
|
BottomSheet,
|
|
181
187
|
FlatList,
|
|
182
188
|
SectionList,
|
|
@@ -240,6 +240,7 @@ describe('ZORA_COMPONENT_META invariants', () => {
|
|
|
240
240
|
test('direct manifest node leaf/container rules', () => {
|
|
241
241
|
const expectedLeafNodes = new Set([
|
|
242
242
|
'ActivityIndicator',
|
|
243
|
+
'Audio',
|
|
243
244
|
'AuthScreen',
|
|
244
245
|
'ForgotPasswordForm',
|
|
245
246
|
'OAuthProviderButton',
|
|
@@ -297,12 +298,14 @@ describe('ZORA_COMPONENT_META invariants', () => {
|
|
|
297
298
|
'Progress',
|
|
298
299
|
'ProgressRing',
|
|
299
300
|
'Reader',
|
|
301
|
+
'RichText',
|
|
300
302
|
'MissingElement',
|
|
301
303
|
'TimePicker',
|
|
302
304
|
'TabletopTable',
|
|
303
305
|
'PokerTrainingTable',
|
|
304
306
|
'Timeline',
|
|
305
307
|
'Link',
|
|
308
|
+
'Video',
|
|
306
309
|
]);
|
|
307
310
|
|
|
308
311
|
const expectedContainerNodes = new Set([
|
|
@@ -458,6 +461,20 @@ describe('ZORA_COMPONENT_META invariants', () => {
|
|
|
458
461
|
expect(ZORA_COMPONENT_META.Image.props.alt?.authoring).toEqual({ authority: 'instance' });
|
|
459
462
|
});
|
|
460
463
|
|
|
464
|
+
test('Video is a direct manifest leaf with canonical video and poster media metadata', () => {
|
|
465
|
+
expect(ZORA_COMPONENT_META.Video.directManifestNode).toBe(true);
|
|
466
|
+
expect(ZORA_COMPONENT_META.Video.allowedChildren).toEqual([]);
|
|
467
|
+
expect(ZORA_COMPONENT_META.Video.props.source).toMatchObject({
|
|
468
|
+
type: 'media',
|
|
469
|
+
mediaKinds: ['video'],
|
|
470
|
+
});
|
|
471
|
+
expect(ZORA_COMPONENT_META.Video.props.poster).toMatchObject({
|
|
472
|
+
type: 'media',
|
|
473
|
+
mediaKinds: ['image'],
|
|
474
|
+
});
|
|
475
|
+
expect(ZORA_COMPONENT_META.Video.props.aspectRatio?.default).toBe(16 / 9);
|
|
476
|
+
});
|
|
477
|
+
|
|
461
478
|
test('RadioGroup is a direct manifest leaf with card presentation and normalized value events', () => {
|
|
462
479
|
const radioGroup = ZORA_COMPONENT_META.RadioGroup;
|
|
463
480
|
|
|
@@ -4,6 +4,7 @@ import { accordionMeta } from '../accordion/accordionMeta';
|
|
|
4
4
|
import { activityIndicatorMeta } from '../activity-indicator/activityIndicatorMeta';
|
|
5
5
|
import { appBarMeta } from '../app-bar/appBarMeta';
|
|
6
6
|
import { appHeaderMeta } from '../app-header/appHeaderMeta';
|
|
7
|
+
import { audioMeta } from '../audio/audioMeta';
|
|
7
8
|
import { authScreenMeta } from '../auth/authScreenMeta';
|
|
8
9
|
import { forgotPasswordFormMeta } from '../auth/forgotPasswordFormMeta';
|
|
9
10
|
import { oauthProviderButtonMeta } from '../auth/oauthProviderButtonMeta';
|
|
@@ -80,6 +81,7 @@ import { popoverMenuMeta } from '../popover-menu/popoverMenuMeta';
|
|
|
80
81
|
import { progressMeta, progressRingMeta } from '../progress/progressMeta';
|
|
81
82
|
import { ratingMeta } from '../rating/ratingMeta';
|
|
82
83
|
import { readerMeta } from '../reader/meta';
|
|
84
|
+
import { richTextMeta } from '../rich-text/richTextMeta';
|
|
83
85
|
import { barcodeScannerViewMeta, cameraPermissionViewMeta, scanOverlayMeta } from '../scanner/meta';
|
|
84
86
|
import { screenSectionMeta } from '../section/screenSectionMeta';
|
|
85
87
|
import { sectionHeaderMeta } from '../section/sectionHeaderMeta';
|
|
@@ -114,12 +116,14 @@ import { treeItemMeta, treeViewMeta } from '../tree-view/meta';
|
|
|
114
116
|
import { headingMeta } from '../typography/headingMeta';
|
|
115
117
|
import { textMeta } from '../typography/textMeta';
|
|
116
118
|
import { uploaderMeta } from '../uploader/uploaderMeta';
|
|
119
|
+
import { videoMeta } from '../video/videoMeta';
|
|
117
120
|
import { finalizeFeatureMetadata } from './finalizeFeatureMetadata';
|
|
118
121
|
|
|
119
122
|
export const ZORA_COMPONENT_META: ZoraComponentMetaRegistry = finalizeFeatureMetadata({
|
|
120
123
|
Accordion: accordionMeta,
|
|
121
124
|
AccordionItem: accordionItemMeta,
|
|
122
125
|
ActivityIndicator: activityIndicatorMeta,
|
|
126
|
+
Audio: audioMeta,
|
|
123
127
|
View: viewMeta,
|
|
124
128
|
ScrollView: scrollViewMeta,
|
|
125
129
|
Grid: gridMeta,
|
|
@@ -167,6 +171,7 @@ export const ZORA_COMPONENT_META: ZoraComponentMetaRegistry = finalizeFeatureMet
|
|
|
167
171
|
PopoverMenu: popoverMenuMeta,
|
|
168
172
|
Progress: progressMeta,
|
|
169
173
|
ProgressRing: progressRingMeta,
|
|
174
|
+
RichText: richTextMeta,
|
|
170
175
|
Radio: radioMeta,
|
|
171
176
|
RadioGroup: radioGroupMeta,
|
|
172
177
|
Rating: ratingMeta,
|
|
@@ -187,6 +192,7 @@ export const ZORA_COMPONENT_META: ZoraComponentMetaRegistry = finalizeFeatureMet
|
|
|
187
192
|
ToastProvider: toastProviderMeta,
|
|
188
193
|
Toolbar: toolbarMeta,
|
|
189
194
|
Uploader: uploaderMeta,
|
|
195
|
+
Video: videoMeta,
|
|
190
196
|
BottomSheet: bottomSheetMeta,
|
|
191
197
|
FlatList: flatListMeta,
|
|
192
198
|
SectionList: sectionListMeta,
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
|
|
3
|
+
import type { RichTextProps } from '../../../../types/rich-text';
|
|
4
|
+
import { withZoraThemeScope } from '../../../theme/adapters/inbound/withZoraThemeScope';
|
|
5
|
+
import { RichTextClient } from './RichTextClient';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Renders canonical HTML read-only or through the supported WYSIWYG editor.
|
|
9
|
+
*
|
|
10
|
+
* Web uses the upstream TipTap history keyboard shortcuts. Native uses the
|
|
11
|
+
* platform text-control history. The upstream public editor handle exposes no
|
|
12
|
+
* programmatic undo or redo controls.
|
|
13
|
+
*/
|
|
14
|
+
export const RichText: (props: RichTextProps) => React.ReactElement | null =
|
|
15
|
+
withZoraThemeScope(RichTextClient);
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import type { RichTextProps } from '../../../../types/rich-text';
|
|
4
|
+
import { withZoraThemeScope } from '../../../theme/adapters/inbound/withZoraThemeScope';
|
|
5
|
+
|
|
6
|
+
const RichTextClient = React.lazy(async () => ({
|
|
7
|
+
default: (await import('./RichTextClient')).RichTextClient,
|
|
8
|
+
}));
|
|
9
|
+
|
|
10
|
+
/*** Renders RichText only after browser hydration because its upstream web implementation is client-only. */
|
|
11
|
+
export const RichText = withZoraThemeScope(RichTextBoundary);
|
|
12
|
+
|
|
13
|
+
/*** Defers the upstream DOM-dependent editor until this component has mounted in a browser. */
|
|
14
|
+
function RichTextBoundary(props: RichTextProps) {
|
|
15
|
+
const hydrated = React.useSyncExternalStore(
|
|
16
|
+
() => () => undefined,
|
|
17
|
+
() => true,
|
|
18
|
+
() => false,
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
if (!hydrated) return null;
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<React.Suspense fallback={null}>
|
|
25
|
+
<RichTextClient {...props} />
|
|
26
|
+
</React.Suspense>
|
|
27
|
+
);
|
|
28
|
+
}
|
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {
|
|
3
|
+
EnrichedText,
|
|
4
|
+
EnrichedTextInput,
|
|
5
|
+
type EnrichedTextInputInstance,
|
|
6
|
+
} from 'react-native-enriched-html';
|
|
7
|
+
|
|
8
|
+
import type { RichTextProps } from '../../../../types/rich-text';
|
|
9
|
+
import { IconButton } from '../../../button/public';
|
|
10
|
+
import { TextInput } from '../../../form/text-input/public';
|
|
11
|
+
import { View } from '../../../layout/public';
|
|
12
|
+
import { useZoraTheme } from '../../../theme/composition/useZoraTheme';
|
|
13
|
+
import { Toolbar } from '../../../toolbar/public';
|
|
14
|
+
import { resolveRichTextHtmlStyle } from '../../utils/resolveRichTextHtmlStyle';
|
|
15
|
+
import { sanitizeRichTextHtml } from '../../utils/sanitizeRichTextHtml';
|
|
16
|
+
|
|
17
|
+
interface RichTextSelection {
|
|
18
|
+
readonly start: number;
|
|
19
|
+
readonly end: number;
|
|
20
|
+
readonly text: string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/*** Applies ZORA theme tokens and controlled HTML updates to the upstream editor. */
|
|
24
|
+
export function RichTextClient({
|
|
25
|
+
html,
|
|
26
|
+
editable = false,
|
|
27
|
+
placeholder,
|
|
28
|
+
onChangeHtml,
|
|
29
|
+
onLinkPress,
|
|
30
|
+
interactionPolicy,
|
|
31
|
+
testID,
|
|
32
|
+
}: RichTextProps) {
|
|
33
|
+
const { theme } = useZoraTheme();
|
|
34
|
+
const editorRef = React.useRef<EnrichedTextInputInstance>(null);
|
|
35
|
+
const sanitizedHtml = React.useMemo(() => sanitizeRichTextHtml(html), [html]);
|
|
36
|
+
const currentHtml = React.useRef(sanitizedHtml);
|
|
37
|
+
const [selection, setSelection] = React.useState<RichTextSelection>({
|
|
38
|
+
start: 0,
|
|
39
|
+
end: 0,
|
|
40
|
+
text: '',
|
|
41
|
+
});
|
|
42
|
+
const [linkEditorVisible, setLinkEditorVisible] = React.useState(false);
|
|
43
|
+
const [linkUrl, setLinkUrl] = React.useState('');
|
|
44
|
+
const htmlStyle = React.useMemo(() => resolveRichTextHtmlStyle(theme), [theme]);
|
|
45
|
+
const contentStyle = React.useMemo(
|
|
46
|
+
() => ({
|
|
47
|
+
backgroundColor: theme.semantics.surface.default,
|
|
48
|
+
borderColor: theme.semantics.border.default,
|
|
49
|
+
borderRadius: theme.radii.l,
|
|
50
|
+
borderWidth: 1,
|
|
51
|
+
color: theme.semantics.content.default,
|
|
52
|
+
fontFamily: theme.typography.fonts.normal[theme.typography.weights.regular],
|
|
53
|
+
fontSize: theme.typography.sizes.m,
|
|
54
|
+
lineHeight: 24,
|
|
55
|
+
padding: theme.spacing.m,
|
|
56
|
+
}),
|
|
57
|
+
[theme],
|
|
58
|
+
);
|
|
59
|
+
const passive = interactionPolicy === 'passive';
|
|
60
|
+
const canEdit = editable && !passive;
|
|
61
|
+
const handleLinkPress = React.useCallback(
|
|
62
|
+
({ url }: { readonly url: string }) => {
|
|
63
|
+
if (!passive) onLinkPress?.(url);
|
|
64
|
+
},
|
|
65
|
+
[onLinkPress, passive],
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
React.useEffect(() => {
|
|
69
|
+
if (sanitizedHtml === currentHtml.current) return;
|
|
70
|
+
editorRef.current?.setValue(sanitizedHtml);
|
|
71
|
+
currentHtml.current = sanitizedHtml;
|
|
72
|
+
}, [sanitizedHtml]);
|
|
73
|
+
|
|
74
|
+
if (!editable) {
|
|
75
|
+
return (
|
|
76
|
+
<EnrichedText
|
|
77
|
+
htmlStyle={htmlStyle}
|
|
78
|
+
onLinkPress={onLinkPress === undefined || passive ? undefined : handleLinkPress}
|
|
79
|
+
selectable={!passive}
|
|
80
|
+
style={contentStyle}
|
|
81
|
+
testID={testID}
|
|
82
|
+
>
|
|
83
|
+
{sanitizedHtml}
|
|
84
|
+
</EnrichedText>
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
return (
|
|
89
|
+
<View gap="s">
|
|
90
|
+
<RichTextToolbar
|
|
91
|
+
disabled={!canEdit}
|
|
92
|
+
editorRef={editorRef}
|
|
93
|
+
linkEditorVisible={linkEditorVisible}
|
|
94
|
+
onLinkEditorVisibilityChange={setLinkEditorVisible}
|
|
95
|
+
/>
|
|
96
|
+
{linkEditorVisible ? (
|
|
97
|
+
<View align="center" direction="row" gap="s">
|
|
98
|
+
<TextInput
|
|
99
|
+
disabled={!canEdit}
|
|
100
|
+
onChangeText={setLinkUrl}
|
|
101
|
+
placeholder="https://example.com"
|
|
102
|
+
size="m"
|
|
103
|
+
value={linkUrl}
|
|
104
|
+
/>
|
|
105
|
+
<IconButton
|
|
106
|
+
color="primary"
|
|
107
|
+
disabled={!canEdit || linkUrl.length === 0}
|
|
108
|
+
icon={{ name: 'check', provider: 'FontAwesome6', variant: 'solid' }}
|
|
109
|
+
label="Apply link"
|
|
110
|
+
onPress={() => {
|
|
111
|
+
if (selection.text.length === 0) return;
|
|
112
|
+
editorRef.current?.setLink(selection.start, selection.end, selection.text, linkUrl);
|
|
113
|
+
setLinkEditorVisible(false);
|
|
114
|
+
setLinkUrl('');
|
|
115
|
+
}}
|
|
116
|
+
/>
|
|
117
|
+
</View>
|
|
118
|
+
) : null}
|
|
119
|
+
<EnrichedTextInput
|
|
120
|
+
cursorColor={theme.semantics.border.focus}
|
|
121
|
+
defaultValue={sanitizedHtml}
|
|
122
|
+
editable={canEdit}
|
|
123
|
+
htmlStyle={htmlStyle}
|
|
124
|
+
onChangeHtml={(event) => {
|
|
125
|
+
const nextHtml = sanitizeRichTextHtml(event.nativeEvent.value);
|
|
126
|
+
currentHtml.current = nextHtml;
|
|
127
|
+
onChangeHtml?.(nextHtml);
|
|
128
|
+
}}
|
|
129
|
+
onChangeSelection={(event) => setSelection(event.nativeEvent)}
|
|
130
|
+
onLinkPress={onLinkPress === undefined || passive ? undefined : handleLinkPress}
|
|
131
|
+
placeholder={placeholder}
|
|
132
|
+
placeholderTextColor={theme.semantics.content.muted}
|
|
133
|
+
ref={editorRef}
|
|
134
|
+
selectionColor={theme.semantics.action.primary.softBg}
|
|
135
|
+
style={contentStyle}
|
|
136
|
+
testID={testID}
|
|
137
|
+
/>
|
|
138
|
+
</View>
|
|
139
|
+
);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/*** Renders the supported rich-text formatting actions with ZORA toolbar controls. */
|
|
143
|
+
function RichTextToolbar({
|
|
144
|
+
disabled,
|
|
145
|
+
editorRef,
|
|
146
|
+
linkEditorVisible,
|
|
147
|
+
onLinkEditorVisibilityChange,
|
|
148
|
+
}: {
|
|
149
|
+
readonly disabled: boolean;
|
|
150
|
+
readonly editorRef: React.RefObject<EnrichedTextInputInstance | null>;
|
|
151
|
+
readonly linkEditorVisible: boolean;
|
|
152
|
+
readonly onLinkEditorVisibilityChange: (visible: boolean) => void;
|
|
153
|
+
}) {
|
|
154
|
+
return (
|
|
155
|
+
<View gap="s">
|
|
156
|
+
<Toolbar compact>
|
|
157
|
+
<IconButton
|
|
158
|
+
disabled={disabled}
|
|
159
|
+
icon={{ name: 'heading', provider: 'FontAwesome6', variant: 'solid' }}
|
|
160
|
+
label="Heading level 1"
|
|
161
|
+
onPress={() => editorRef.current?.toggleH1()}
|
|
162
|
+
/>
|
|
163
|
+
<IconButton
|
|
164
|
+
disabled={disabled}
|
|
165
|
+
icon={{ name: 'heading', provider: 'FontAwesome6', variant: 'solid' }}
|
|
166
|
+
label="Heading level 2"
|
|
167
|
+
onPress={() => editorRef.current?.toggleH2()}
|
|
168
|
+
/>
|
|
169
|
+
<IconButton
|
|
170
|
+
disabled={disabled}
|
|
171
|
+
icon={{ name: 'heading', provider: 'FontAwesome6', variant: 'solid' }}
|
|
172
|
+
label="Heading level 3"
|
|
173
|
+
onPress={() => editorRef.current?.toggleH3()}
|
|
174
|
+
/>
|
|
175
|
+
<IconButton
|
|
176
|
+
disabled={disabled}
|
|
177
|
+
icon={{ name: 'bold', provider: 'FontAwesome6', variant: 'solid' }}
|
|
178
|
+
label="Bold"
|
|
179
|
+
onPress={() => editorRef.current?.toggleBold()}
|
|
180
|
+
/>
|
|
181
|
+
<IconButton
|
|
182
|
+
disabled={disabled}
|
|
183
|
+
icon={{ name: 'italic', provider: 'FontAwesome6', variant: 'solid' }}
|
|
184
|
+
label="Italic"
|
|
185
|
+
onPress={() => editorRef.current?.toggleItalic()}
|
|
186
|
+
/>
|
|
187
|
+
<IconButton
|
|
188
|
+
disabled={disabled}
|
|
189
|
+
icon={{ name: 'underline', provider: 'FontAwesome6', variant: 'solid' }}
|
|
190
|
+
label="Underline"
|
|
191
|
+
onPress={() => editorRef.current?.toggleUnderline()}
|
|
192
|
+
/>
|
|
193
|
+
<IconButton
|
|
194
|
+
disabled={disabled}
|
|
195
|
+
icon={{ name: 'strikethrough', provider: 'FontAwesome6', variant: 'solid' }}
|
|
196
|
+
label="Strikethrough"
|
|
197
|
+
onPress={() => editorRef.current?.toggleStrikeThrough()}
|
|
198
|
+
/>
|
|
199
|
+
<IconButton
|
|
200
|
+
disabled={disabled}
|
|
201
|
+
icon={{ name: 'link', provider: 'FontAwesome6', variant: 'solid' }}
|
|
202
|
+
label="Link"
|
|
203
|
+
onPress={() => onLinkEditorVisibilityChange(!linkEditorVisible)}
|
|
204
|
+
/>
|
|
205
|
+
</Toolbar>
|
|
206
|
+
<Toolbar compact>
|
|
207
|
+
<IconButton
|
|
208
|
+
disabled={disabled}
|
|
209
|
+
icon={{ name: 'list-ol', provider: 'FontAwesome6', variant: 'solid' }}
|
|
210
|
+
label="Ordered list"
|
|
211
|
+
onPress={() => editorRef.current?.toggleOrderedList()}
|
|
212
|
+
/>
|
|
213
|
+
<IconButton
|
|
214
|
+
disabled={disabled}
|
|
215
|
+
icon={{ name: 'list-ul', provider: 'FontAwesome6', variant: 'solid' }}
|
|
216
|
+
label="Unordered list"
|
|
217
|
+
onPress={() => editorRef.current?.toggleUnorderedList()}
|
|
218
|
+
/>
|
|
219
|
+
<IconButton
|
|
220
|
+
disabled={disabled}
|
|
221
|
+
icon={{ name: 'align-left', provider: 'FontAwesome6', variant: 'solid' }}
|
|
222
|
+
label="Align left"
|
|
223
|
+
onPress={() => editorRef.current?.setTextAlignment('left')}
|
|
224
|
+
/>
|
|
225
|
+
<IconButton
|
|
226
|
+
disabled={disabled}
|
|
227
|
+
icon={{ name: 'align-center', provider: 'FontAwesome6', variant: 'solid' }}
|
|
228
|
+
label="Align center"
|
|
229
|
+
onPress={() => editorRef.current?.setTextAlignment('center')}
|
|
230
|
+
/>
|
|
231
|
+
<IconButton
|
|
232
|
+
disabled={disabled}
|
|
233
|
+
icon={{ name: 'align-right', provider: 'FontAwesome6', variant: 'solid' }}
|
|
234
|
+
label="Align right"
|
|
235
|
+
onPress={() => editorRef.current?.setTextAlignment('right')}
|
|
236
|
+
/>
|
|
237
|
+
<IconButton
|
|
238
|
+
disabled={disabled}
|
|
239
|
+
icon={{ name: 'align-justify', provider: 'FontAwesome6', variant: 'solid' }}
|
|
240
|
+
label="Justify"
|
|
241
|
+
onPress={() => editorRef.current?.setTextAlignment('justify')}
|
|
242
|
+
/>
|
|
243
|
+
</Toolbar>
|
|
244
|
+
</View>
|
|
245
|
+
);
|
|
246
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { describe, expect, test } from 'bun:test';
|
|
2
|
+
|
|
3
|
+
import { richTextMeta } from './richTextMeta';
|
|
4
|
+
|
|
5
|
+
describe('RichText authoring metadata', () => {
|
|
6
|
+
test('uses upstream history and suppresses editor and link interactions while passive', async () => {
|
|
7
|
+
const [clientSource, nativeSource, webSource] = await Promise.all([
|
|
8
|
+
Bun.file('src/features/rich-text/adapters/inbound/RichTextClient.tsx').text(),
|
|
9
|
+
Bun.file('src/features/rich-text/adapters/inbound/RichText.tsx').text(),
|
|
10
|
+
Bun.file('src/features/rich-text/adapters/inbound/RichText.web.tsx').text(),
|
|
11
|
+
]);
|
|
12
|
+
|
|
13
|
+
expect(nativeSource).toContain('upstream TipTap history keyboard shortcuts');
|
|
14
|
+
expect(nativeSource).toContain('platform text-control history');
|
|
15
|
+
expect(nativeSource).toContain('programmatic undo or redo controls');
|
|
16
|
+
expect(webSource).toContain("await import('./RichTextClient')");
|
|
17
|
+
expect(clientSource).toContain("from '../../utils/sanitizeRichTextHtml'");
|
|
18
|
+
expect(clientSource).toContain(
|
|
19
|
+
'const sanitizedHtml = React.useMemo(() => sanitizeRichTextHtml(html), [html]);',
|
|
20
|
+
);
|
|
21
|
+
expect(clientSource).toContain(
|
|
22
|
+
'const nextHtml = sanitizeRichTextHtml(event.nativeEvent.value);',
|
|
23
|
+
);
|
|
24
|
+
expect(clientSource).toContain("const passive = interactionPolicy === 'passive';");
|
|
25
|
+
expect(clientSource).toContain('editable={canEdit}');
|
|
26
|
+
expect(clientSource).toContain('selectable={!passive}');
|
|
27
|
+
expect(clientSource).toContain(
|
|
28
|
+
'onLinkPress={onLinkPress === undefined || passive ? undefined : handleLinkPress}',
|
|
29
|
+
);
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
test('describes the serializable HTML component contract and host-owned events', () => {
|
|
33
|
+
expect(richTextMeta.directManifestNode).toBe(true);
|
|
34
|
+
expect(richTextMeta.allowedChildren).toEqual([]);
|
|
35
|
+
expect(richTextMeta.blueprint.defaultProps).toEqual({
|
|
36
|
+
html: '<p>Rich text</p>',
|
|
37
|
+
editable: false,
|
|
38
|
+
});
|
|
39
|
+
expect(richTextMeta.props.html).toMatchObject({
|
|
40
|
+
type: 'string',
|
|
41
|
+
authoring: { authority: 'instance' },
|
|
42
|
+
});
|
|
43
|
+
expect(richTextMeta.events.changeHtml).toMatchObject({
|
|
44
|
+
eventType: 'richText.changeHtml',
|
|
45
|
+
payloadFields: [{ path: 'html', type: 'string', label: 'HTML' }],
|
|
46
|
+
});
|
|
47
|
+
expect(richTextMeta.events.linkPress).toMatchObject({
|
|
48
|
+
eventType: 'richText.linkPress',
|
|
49
|
+
payloadFields: [{ path: 'url', type: 'string', label: 'URL' }],
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
});
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { ZoraComponentMeta } from '../../types/authoring';
|
|
2
|
+
|
|
3
|
+
export const richTextMeta = {
|
|
4
|
+
name: 'RichText',
|
|
5
|
+
category: 'component',
|
|
6
|
+
directManifestNode: true,
|
|
7
|
+
allowedChildren: [],
|
|
8
|
+
description:
|
|
9
|
+
'Portable normalized HTML rendered read-only or edited with the supported cross-platform WYSIWYG editor.',
|
|
10
|
+
blueprint: {
|
|
11
|
+
label: 'Rich text',
|
|
12
|
+
defaultProps: { html: '<p>Rich text</p>', editable: false },
|
|
13
|
+
},
|
|
14
|
+
events: {
|
|
15
|
+
changeHtml: {
|
|
16
|
+
label: 'HTML change',
|
|
17
|
+
eventType: 'richText.changeHtml',
|
|
18
|
+
description: 'Emitted when the editor produces normalized HTML.',
|
|
19
|
+
payloadFields: [{ path: 'html', type: 'string', label: 'HTML' }],
|
|
20
|
+
},
|
|
21
|
+
linkPress: {
|
|
22
|
+
label: 'Link press',
|
|
23
|
+
eventType: 'richText.linkPress',
|
|
24
|
+
description: 'Requests host-owned navigation for a rich-text link.',
|
|
25
|
+
payloadFields: [{ path: 'url', type: 'string', label: 'URL' }],
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
props: {
|
|
29
|
+
html: {
|
|
30
|
+
type: 'string',
|
|
31
|
+
category: 'Content',
|
|
32
|
+
label: 'HTML',
|
|
33
|
+
default: '<p>Rich text</p>',
|
|
34
|
+
authoring: { authority: 'instance' },
|
|
35
|
+
},
|
|
36
|
+
editable: {
|
|
37
|
+
type: 'boolean',
|
|
38
|
+
category: 'State',
|
|
39
|
+
label: 'Editable',
|
|
40
|
+
default: false,
|
|
41
|
+
authoring: { authority: 'instance' },
|
|
42
|
+
},
|
|
43
|
+
placeholder: {
|
|
44
|
+
type: 'string',
|
|
45
|
+
category: 'Content',
|
|
46
|
+
label: 'Placeholder',
|
|
47
|
+
authoring: { authority: 'instance' },
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
} as const satisfies ZoraComponentMeta;
|