@ankhorage/zora 28.3.0 → 28.5.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 +12 -0
- package/README.md +1 -1
- package/dist/capabilities/index.js +52 -1
- package/dist/capabilities/index.js.map +6 -5
- package/dist/constants/authoring.d.ts +4 -3
- package/dist/constants/authoring.d.ts.map +1 -1
- package/dist/constants/authoring.js +2 -0
- package/dist/constants/authoring.js.map +1 -1
- package/dist/features/accordion/accordionItemMeta.d.ts +1 -1
- 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/adapters/inbound/ZoraWebStyleSheet.d.ts +4 -0
- package/dist/features/layout/adapters/inbound/ZoraWebStyleSheet.d.ts.map +1 -0
- package/dist/features/layout/adapters/inbound/ZoraWebStyleSheet.js +18 -0
- package/dist/features/layout/adapters/inbound/ZoraWebStyleSheet.js.map +1 -0
- package/dist/features/layout/gridMeta.d.ts +1 -1
- package/dist/features/layout/public.d.ts +1 -0
- package/dist/features/layout/public.d.ts.map +1 -1
- package/dist/features/layout/public.js +1 -0
- package/dist/features/layout/public.js.map +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/popover/adapters/inbound/Popover.d.ts +4 -0
- package/dist/features/popover/adapters/inbound/Popover.d.ts.map +1 -0
- package/dist/features/popover/adapters/inbound/Popover.js +9 -0
- package/dist/features/popover/adapters/inbound/Popover.js.map +1 -0
- package/dist/features/popover/public.d.ts +3 -0
- package/dist/features/popover/public.d.ts.map +1 -0
- package/dist/features/popover/public.js +2 -0
- package/dist/features/popover/public.js.map +1 -0
- 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 +2 -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 +2 -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/theme/adapters/inbound/ZoraProvider.d.ts.map +1 -1
- package/dist/features/theme/adapters/inbound/ZoraProvider.js +10 -8
- package/dist/features/theme/adapters/inbound/ZoraProvider.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/readerFree.d.ts +1 -0
- package/dist/readerFree.d.ts.map +1 -1
- package/dist/readerFree.js +1 -0
- package/dist/readerFree.js.map +1 -1
- package/dist/types/popover.d.ts +7 -0
- package/dist/types/popover.d.ts.map +1 -0
- package/dist/types/popover.js +2 -0
- package/dist/types/popover.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/package.json +56 -2
- package/src/constants/authoring.ts +2 -0
- package/src/features/layout/adapters/inbound/ZoraWebStyleSheet.tsx +26 -0
- package/src/features/layout/public.test.ts +9 -1
- package/src/features/layout/public.ts +1 -0
- package/src/features/master-detail/adapters/inbound/MasterDetail.runtime.test.tsx +1 -0
- package/src/features/popover/adapters/inbound/Popover.tsx +17 -0
- package/src/features/popover/public.test.ts +9 -0
- package/src/features/popover/public.ts +2 -0
- package/src/features/registry/ZORA_BASE_COMPONENT_REGISTRY.ts +2 -0
- package/src/features/registry/componentMeta.test.ts +1 -0
- package/src/features/registry/componentMeta.ts +2 -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/theme/adapters/inbound/ZoraProvider.tsx +10 -8
- package/src/features/theme/themeScopeStructure.test.ts +3 -2
- package/src/index.ts +7 -0
- package/src/readerFree.ts +1 -0
- package/src/types/popover.ts +12 -0
- package/src/types/rich-text.ts +24 -0
- package/src/webPackageExports.test.ts +9 -0
- package/web-dist/chunks/{Accordion-nmpzv3b0.js → Accordion-0egwarcs.js} +3 -3
- package/web-dist/chunks/{Accordion-htm3j8r8.js → Accordion-0spfxhpg.js} +4 -4
- package/web-dist/chunks/{Accordion-r75ep5pg.js → Accordion-19aegsx2.js} +4 -4
- package/web-dist/chunks/{Accordion-gnbt6w4q.js → Accordion-1g91we37.js} +4 -4
- package/web-dist/chunks/{Accordion-sh79sr5g.js → Accordion-224snqz3.js} +2 -2
- package/web-dist/chunks/{Accordion-za0jcjgn.js → Accordion-2ad57stc.js} +2 -2
- package/web-dist/chunks/{Accordion-d405whfb.js → Accordion-2bygfpwg.js} +1 -1
- package/web-dist/chunks/Accordion-3cpkxpdg.js +37 -0
- package/web-dist/chunks/{Accordion-5rwztz14.js → Accordion-49d0frg7.js} +2 -2
- package/web-dist/chunks/{Accordion-f8a49gy8.js → Accordion-4mg3epm9.js} +19 -1
- package/web-dist/chunks/Accordion-4qrva6ye.js +15 -0
- package/web-dist/chunks/{Accordion-01bsg7zt.js → Accordion-4yrszsvs.js} +1 -1
- package/web-dist/chunks/{Accordion-38xvj0cq.js → Accordion-516n2cx4.js} +4 -4
- package/web-dist/chunks/{Accordion-tqagt6cz.js → Accordion-77514sk9.js} +1 -1
- package/web-dist/chunks/{Accordion-2xkxthf1.js → Accordion-78astqx3.js} +6 -6
- package/web-dist/chunks/{Accordion-fdzyyqe9.js → Accordion-7knb9jk2.js} +3 -3
- package/web-dist/chunks/{Accordion-bp9y7738.js → Accordion-8jw8g2aq.js} +7 -7
- package/web-dist/chunks/{Accordion-kcm6jcpp.js → Accordion-9b4bsxwe.js} +1 -1
- package/web-dist/chunks/{Accordion-bd9vzpbz.js → Accordion-9gk4scdz.js} +8 -8
- package/web-dist/chunks/{Accordion-a1mgdfg7.js → Accordion-9m5asd8r.js} +1 -1
- package/web-dist/chunks/{Accordion-f1vargnk.js → Accordion-9tgvr155.js} +4 -4
- package/web-dist/chunks/{Accordion-q683s6kd.js → Accordion-a4dmyntn.js} +3 -3
- package/web-dist/chunks/{Accordion-bzgy9sg3.js → Accordion-agt9vt85.js} +2 -2
- package/web-dist/chunks/{Accordion-xzaa9s7f.js → Accordion-akwd4brm.js} +1 -13
- package/web-dist/chunks/{Accordion-379mgrse.js → Accordion-arr9ayv0.js} +1 -1
- package/web-dist/chunks/{Accordion-vb52sts9.js → Accordion-d9sd2vs7.js} +3 -3
- package/web-dist/chunks/{Accordion-5qz4j8tt.js → Accordion-ge7cjtwy.js} +5 -5
- package/web-dist/chunks/{Accordion-e0vm82xr.js → Accordion-gs838h0n.js} +2 -2
- package/web-dist/chunks/{Accordion-4zb6dcys.js → Accordion-j1zerr6z.js} +1 -1
- package/web-dist/chunks/{Accordion-2ys50fc8.js → Accordion-jtgh2tep.js} +1 -1
- package/web-dist/chunks/{Accordion-9qg7cjt8.js → Accordion-kcspvk6q.js} +2 -2
- package/web-dist/chunks/{Accordion-vkqqktc5.js → Accordion-khfjh10v.js} +2 -2
- package/web-dist/chunks/{Accordion-axe7nsht.js → Accordion-kzjq1snp.js} +1 -1
- package/web-dist/chunks/{Accordion-hdyzyw8q.js → Accordion-mnxf855g.js} +1 -1
- package/web-dist/chunks/{Accordion-17s33h1a.js → Accordion-q8a423pk.js} +1 -1
- package/web-dist/chunks/{Accordion-rtamzg9j.js → Accordion-qjxbf8nt.js} +1 -1
- package/web-dist/chunks/{Accordion-v6vhyv31.js → Accordion-qjxx43r1.js} +1 -1
- package/web-dist/chunks/{Accordion-h63c9k9k.js → Accordion-sbdgq8d5.js} +1 -1
- package/web-dist/chunks/{Accordion-2xb252py.js → Accordion-skdtw2er.js} +5 -5
- package/web-dist/chunks/{Accordion-rq311z1k.js → Accordion-tdrk9cyn.js} +4 -4
- package/web-dist/chunks/{Accordion-kdb9g5b1.js → Accordion-vx8bjm5k.js} +4 -4
- package/web-dist/chunks/{Accordion-f8zpd80k.js → Accordion-x4yhr2wm.js} +3 -3
- package/web-dist/chunks/{Accordion-2wggrer7.js → Accordion-ytf9ba8v.js} +2 -2
- package/web-dist/chunks/{Accordion-t9n4ey2r.js → Accordion-zd15byha.js} +1 -1
- package/web-dist/chunks/RichTextClient-70qt7037.js +1676 -0
- package/web-dist/chunks/{Video.native-97x0098j.js → Video.native-6142s9f7.js} +5 -5
- package/web-dist/chunks/{index-cnnsfz6n.js → index-n6p0wdvg.js} +1 -1
- package/web-dist/components/accordion/Accordion.js +2 -2
- package/web-dist/components/accordion-item/AccordionItem.js +2 -2
- package/web-dist/components/app-bar/AppBar.js +8 -8
- package/web-dist/components/app-header/AppHeader.js +8 -8
- package/web-dist/components/app-shell/AppShell.js +1 -1
- package/web-dist/components/audio/Audio.js +6 -6
- package/web-dist/components/auth-screen/AuthScreen.js +10 -10
- package/web-dist/components/avatar/Avatar.js +2 -2
- package/web-dist/components/avatar-group/AvatarGroup.js +2 -2
- package/web-dist/components/badge/Badge.js +2 -2
- package/web-dist/components/barcode-scanner-view/BarcodeScannerView.js +9 -9
- package/web-dist/components/bottom-sheet/BottomSheet.js +2 -2
- package/web-dist/components/bottom-sheet-flat-list/BottomSheetFlatList.js +2 -2
- package/web-dist/components/bottom-sheet-scroll-view/BottomSheetScrollView.js +2 -2
- package/web-dist/components/bottom-sheet-section-list/BottomSheetSectionList.js +2 -2
- package/web-dist/components/bottom-sheet-view/BottomSheetView.js +2 -2
- package/web-dist/components/bottom-sheet-virtualized-list/BottomSheetVirtualizedList.js +2 -2
- 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 +9 -9
- package/web-dist/components/card/Card.js +8 -8
- 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 +3 -3
- package/web-dist/components/chip-group/ChipGroup.js +3 -3
- package/web-dist/components/collection-editor/CollectionEditor.js +8 -8
- package/web-dist/components/color-hue-scale/ColorHueScale.js +15 -15
- package/web-dist/components/color-picker/ColorPicker.js +15 -15
- package/web-dist/components/color-tone/ColorTone.js +15 -15
- package/web-dist/components/color-wheel/ColorWheel.js +15 -15
- package/web-dist/components/content-rail/ContentRail.js +4 -4
- package/web-dist/components/data-table/DataTable.js +16 -16
- package/web-dist/components/date-picker/DatePicker.js +11 -11
- package/web-dist/components/dialog/Dialog.js +3 -3
- package/web-dist/components/divider/Divider.js +1 -1
- package/web-dist/components/empty-state/EmptyState.js +9 -9
- package/web-dist/components/explorer/Explorer.js +3 -3
- package/web-dist/components/field/Field.js +4 -4
- package/web-dist/components/file-explorer/FileExplorer.js +3 -3
- package/web-dist/components/flat-list/FlatList.js +5 -5
- package/web-dist/components/forgot-password-form/ForgotPasswordForm.js +10 -10
- 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 +2 -2
- package/web-dist/components/game-entity/GameEntity.js +2 -2
- package/web-dist/components/game-field/GameField.js +2 -2
- package/web-dist/components/game-input-zone/GameInputZone.js +2 -2
- package/web-dist/components/game-measurement-probe/GameMeasurementProbe.js +2 -2
- package/web-dist/components/game-overlay/GameOverlay.js +2 -2
- package/web-dist/components/gradient/Gradient.js +2 -2
- package/web-dist/components/gradient-renderer-provider/GradientRendererProvider.js +2 -2
- package/web-dist/components/grid/Grid.js +1 -1
- package/web-dist/components/hero/Hero.js +8 -8
- package/web-dist/components/icon-button/IconButton.js +4 -4
- package/web-dist/components/image/Image.js +2 -2
- 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 +1 -1
- package/web-dist/components/media-card/MediaCard.js +8 -8
- package/web-dist/components/media-explorer/MediaExplorer.js +3 -3
- package/web-dist/components/message-bubble/MessageBubble.js +6 -6
- package/web-dist/components/metric-card/MetricCard.js +8 -8
- package/web-dist/components/missing-element/MissingElement.js +3 -3
- package/web-dist/components/o-auth-provider-button/OAuthProviderButton.js +10 -10
- package/web-dist/components/o-auth-provider-list/OAuthProviderList.js +10 -10
- package/web-dist/components/otp-form/OtpForm.js +10 -10
- package/web-dist/components/pagination/Pagination.js +4 -4
- package/web-dist/components/palette-item/PaletteItem.js +8 -8
- package/web-dist/components/popover/Popover.d.ts +5 -0
- package/web-dist/components/popover/Popover.dependency-0.d.ts +27 -0
- package/web-dist/components/popover/Popover.dependency-1.d.ts +3 -0
- package/web-dist/components/popover/Popover.js +29 -0
- package/web-dist/components/popover/Popover.types-0.d.ts +10 -0
- package/web-dist/components/popover/index.d.ts +2 -0
- package/web-dist/components/popover/index.js +2 -0
- package/web-dist/components/popover-menu/PopoverMenu.js +5 -5
- package/web-dist/components/post-card/PostCard.js +8 -8
- package/web-dist/components/product-card/ProductCard.js +8 -8
- package/web-dist/components/progress/Progress.js +2 -2
- package/web-dist/components/progress-ring/ProgressRing.js +2 -2
- 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 +1 -1
- 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 +9 -9
- package/web-dist/components/screen/Screen.js +1 -1
- package/web-dist/components/screen-section/ScreenSection.js +2 -2
- package/web-dist/components/scroll-view/ScrollView.js +1 -1
- package/web-dist/components/search-input/SearchInput.js +6 -6
- package/web-dist/components/section-header/SectionHeader.js +2 -2
- 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 +10 -10
- package/web-dist/components/sign-up-form/SignUpForm.js +10 -10
- package/web-dist/components/skeleton/Skeleton.js +11 -11
- package/web-dist/components/skeleton-card/SkeletonCard.js +11 -11
- package/web-dist/components/skeleton-list/SkeletonList.js +11 -11
- package/web-dist/components/skeleton-text/SkeletonText.js +11 -11
- package/web-dist/components/switch/Switch.js +3 -3
- 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 +6 -6
- package/web-dist/components/theme-mode-toggle/ThemeModeToggle.js +4 -4
- package/web-dist/components/time-picker/TimePicker.js +10 -10
- package/web-dist/components/timeline/Timeline.js +2 -2
- 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 +13 -42
- 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.js +4 -4
- package/web-dist/components/view/View.js +1 -1
- package/web-dist/components/zora-web-style-sheet/ZoraWebStyleSheet.d.ts +5 -0
- package/web-dist/components/zora-web-style-sheet/ZoraWebStyleSheet.js +14 -0
- package/web-dist/components/zora-web-style-sheet/index.d.ts +1 -0
- package/web-dist/components/zora-web-style-sheet/index.js +2 -0
- package/web-dist/manifest.json +826 -713
- package/web-dist/runtime/ZoraProvider.js +14 -12
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ankhorage/zora",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "28.
|
|
4
|
+
"version": "28.5.0",
|
|
5
5
|
"description": "Opinionated React Native and React Native Web UI kit built on @ankhorage/surface.",
|
|
6
6
|
"homepage": "https://github.com/ankhorage/zora#readme",
|
|
7
7
|
"bugs": {
|
|
@@ -56,7 +56,9 @@
|
|
|
56
56
|
"expo-audio": "~57.0.5",
|
|
57
57
|
"expo-document-picker": "~57.0.3",
|
|
58
58
|
"expo-image-picker": "~57.0.20",
|
|
59
|
-
"expo-video": "~57.0.5"
|
|
59
|
+
"expo-video": "~57.0.5",
|
|
60
|
+
"react-native-enriched-html": "1.2.0",
|
|
61
|
+
"xss": "^1.0.17"
|
|
60
62
|
},
|
|
61
63
|
"files": [
|
|
62
64
|
"dist",
|
|
@@ -1582,6 +1584,58 @@
|
|
|
1582
1584
|
}
|
|
1583
1585
|
}
|
|
1584
1586
|
},
|
|
1587
|
+
{
|
|
1588
|
+
"id": "richText.changeHtml",
|
|
1589
|
+
"owner": "@ankhorage/zora",
|
|
1590
|
+
"access": [
|
|
1591
|
+
"emit"
|
|
1592
|
+
],
|
|
1593
|
+
"binding": {
|
|
1594
|
+
"kind": "event",
|
|
1595
|
+
"bindableAs": [
|
|
1596
|
+
"source"
|
|
1597
|
+
]
|
|
1598
|
+
},
|
|
1599
|
+
"label": "HTML change",
|
|
1600
|
+
"description": "Emitted when the editor produces normalized HTML.",
|
|
1601
|
+
"output": {
|
|
1602
|
+
"schema": {
|
|
1603
|
+
"type": "object",
|
|
1604
|
+
"properties": {
|
|
1605
|
+
"html": {
|
|
1606
|
+
"type": "string",
|
|
1607
|
+
"title": "HTML"
|
|
1608
|
+
}
|
|
1609
|
+
}
|
|
1610
|
+
}
|
|
1611
|
+
}
|
|
1612
|
+
},
|
|
1613
|
+
{
|
|
1614
|
+
"id": "richText.linkPress",
|
|
1615
|
+
"owner": "@ankhorage/zora",
|
|
1616
|
+
"access": [
|
|
1617
|
+
"emit"
|
|
1618
|
+
],
|
|
1619
|
+
"binding": {
|
|
1620
|
+
"kind": "event",
|
|
1621
|
+
"bindableAs": [
|
|
1622
|
+
"source"
|
|
1623
|
+
]
|
|
1624
|
+
},
|
|
1625
|
+
"label": "Link press",
|
|
1626
|
+
"description": "Requests host-owned navigation for a rich-text link.",
|
|
1627
|
+
"output": {
|
|
1628
|
+
"schema": {
|
|
1629
|
+
"type": "object",
|
|
1630
|
+
"properties": {
|
|
1631
|
+
"url": {
|
|
1632
|
+
"type": "string",
|
|
1633
|
+
"title": "URL"
|
|
1634
|
+
}
|
|
1635
|
+
}
|
|
1636
|
+
}
|
|
1637
|
+
}
|
|
1638
|
+
},
|
|
1585
1639
|
{
|
|
1586
1640
|
"id": "scrollView.refresh",
|
|
1587
1641
|
"owner": "@ankhorage/zora",
|
|
@@ -40,6 +40,7 @@ export const FEATURE_MANIFEST_ELEMENTS = {
|
|
|
40
40
|
link: ['Link'],
|
|
41
41
|
'master-detail': ['MasterDetail'],
|
|
42
42
|
'content-rail': ['ContentRail'],
|
|
43
|
+
'rich-text': ['RichText'],
|
|
43
44
|
layout: ['Divider', 'Grid', 'Screen', 'ScrollView', 'View'],
|
|
44
45
|
section: ['ScreenSection', 'SectionHeader'],
|
|
45
46
|
list: ['FlatList', 'SectionList'],
|
|
@@ -116,6 +117,7 @@ export const CONTAINER_ALLOWED_CHILDREN = [
|
|
|
116
117
|
'RadioGroup',
|
|
117
118
|
'ThemeModeToggle',
|
|
118
119
|
'TextInput',
|
|
120
|
+
'RichText',
|
|
119
121
|
'TimePicker',
|
|
120
122
|
'Timeline',
|
|
121
123
|
'Form',
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Platform, StyleSheet } from 'react-native';
|
|
3
|
+
|
|
4
|
+
type ReactNativeWebStyleSheet = Readonly<{
|
|
5
|
+
id: string;
|
|
6
|
+
textContent: string;
|
|
7
|
+
}>;
|
|
8
|
+
|
|
9
|
+
/*** Hoists the React Native Web styles required by a server-rendered ZORA application. */
|
|
10
|
+
export function ZoraWebStyleSheet() {
|
|
11
|
+
const sheet = getReactNativeWebStyleSheet();
|
|
12
|
+
if (sheet === null) return null;
|
|
13
|
+
|
|
14
|
+
return (
|
|
15
|
+
<style id={sheet.id} precedence="react-native-web">
|
|
16
|
+
{sheet.textContent}
|
|
17
|
+
</style>
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/*** Reads React Native Web's public stylesheet without changing native rendering. */
|
|
22
|
+
function getReactNativeWebStyleSheet(): ReactNativeWebStyleSheet | null {
|
|
23
|
+
if (Platform.OS !== 'web' || !('getSheet' in StyleSheet)) return null;
|
|
24
|
+
|
|
25
|
+
return (StyleSheet.getSheet as () => ReactNativeWebStyleSheet)();
|
|
26
|
+
}
|
|
@@ -23,7 +23,15 @@ const removedPublicNames = [
|
|
|
23
23
|
|
|
24
24
|
describe('canonical layout boundary', () => {
|
|
25
25
|
test('exports only the current layout primitives and semantic screen composition', () => {
|
|
26
|
-
for (const name of [
|
|
26
|
+
for (const name of [
|
|
27
|
+
'AppShell',
|
|
28
|
+
'Divider',
|
|
29
|
+
'Grid',
|
|
30
|
+
'Screen',
|
|
31
|
+
'ScrollView',
|
|
32
|
+
'View',
|
|
33
|
+
'ZoraWebStyleSheet',
|
|
34
|
+
]) {
|
|
27
35
|
expect(publicSource).toMatch(new RegExp(`\\b${name}\\b`, 'u'));
|
|
28
36
|
}
|
|
29
37
|
|
|
@@ -14,3 +14,4 @@ export { Screen } from './adapters/inbound/Screen';
|
|
|
14
14
|
export { ScrollView } from './adapters/inbound/ScrollView';
|
|
15
15
|
export { useScrollGestureLock } from './adapters/inbound/useScrollGestureLock';
|
|
16
16
|
export { View } from './adapters/inbound/View';
|
|
17
|
+
export { ZoraWebStyleSheet } from './adapters/inbound/ZoraWebStyleSheet';
|
|
@@ -43,6 +43,7 @@ await mock.module('@ankhorage/surface', () => ({
|
|
|
43
43
|
}));
|
|
44
44
|
|
|
45
45
|
await mock.module('react-native', () => ({
|
|
46
|
+
Platform: { OS: 'web' },
|
|
46
47
|
StyleSheet: { create: <T,>(styles: T) => styles },
|
|
47
48
|
Text: ({ children }: React.PropsWithChildren) => <span>{children}</span>,
|
|
48
49
|
View: ({ children }: React.PropsWithChildren) => <div>{children}</div>,
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Popover as SurfacePopover } from '@ankhorage/surface';
|
|
2
|
+
|
|
3
|
+
import type { PopoverProps } from '../../../../types/popover';
|
|
4
|
+
import { withZoraThemeScope } from '../../../theme/adapters/inbound/withZoraThemeScope';
|
|
5
|
+
|
|
6
|
+
/*** Presents arbitrary anchored content through the ZORA-owned popover boundary. */
|
|
7
|
+
export const Popover = withZoraThemeScope(PopoverInner);
|
|
8
|
+
|
|
9
|
+
/*** Delegates overlay placement and controllable state to the Surface foundation. */
|
|
10
|
+
function PopoverInner({
|
|
11
|
+
inverted: _inverted,
|
|
12
|
+
mode: _mode,
|
|
13
|
+
themeId: _themeId,
|
|
14
|
+
...props
|
|
15
|
+
}: PopoverProps) {
|
|
16
|
+
return <SurfacePopover {...props} />;
|
|
17
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { expect, test } from 'bun:test';
|
|
2
|
+
|
|
3
|
+
test('Popover exposes the narrow ZORA-owned Surface overlay boundary', async () => {
|
|
4
|
+
const source = await Bun.file('src/features/popover/adapters/inbound/Popover.tsx').text();
|
|
5
|
+
|
|
6
|
+
expect(source).toContain('Popover as SurfacePopover');
|
|
7
|
+
expect(source).toContain('<SurfacePopover');
|
|
8
|
+
expect(source).toContain('withZoraThemeScope');
|
|
9
|
+
});
|
|
@@ -67,6 +67,7 @@ import { PaletteItem } from '../palette-item/public';
|
|
|
67
67
|
import { PopoverMenu } from '../popover-menu/public';
|
|
68
68
|
import { Progress, ProgressRing } from '../progress/public';
|
|
69
69
|
import { Rating } from '../rating/public';
|
|
70
|
+
import { RichText } from '../rich-text/public';
|
|
70
71
|
import { BarcodeScannerView, CameraPermissionView, ScanOverlay } from '../scanner/public';
|
|
71
72
|
import { ScreenSection, SectionHeader } from '../section/public';
|
|
72
73
|
import { SelectableItem } from '../selection/public';
|
|
@@ -161,6 +162,7 @@ const _ZORA_BASE_COMPONENT_REGISTRY = {
|
|
|
161
162
|
PopoverMenu,
|
|
162
163
|
Progress,
|
|
163
164
|
ProgressRing,
|
|
165
|
+
RichText,
|
|
164
166
|
Radio,
|
|
165
167
|
RadioGroup,
|
|
166
168
|
Rating,
|
|
@@ -81,6 +81,7 @@ import { popoverMenuMeta } from '../popover-menu/popoverMenuMeta';
|
|
|
81
81
|
import { progressMeta, progressRingMeta } from '../progress/progressMeta';
|
|
82
82
|
import { ratingMeta } from '../rating/ratingMeta';
|
|
83
83
|
import { readerMeta } from '../reader/meta';
|
|
84
|
+
import { richTextMeta } from '../rich-text/richTextMeta';
|
|
84
85
|
import { barcodeScannerViewMeta, cameraPermissionViewMeta, scanOverlayMeta } from '../scanner/meta';
|
|
85
86
|
import { screenSectionMeta } from '../section/screenSectionMeta';
|
|
86
87
|
import { sectionHeaderMeta } from '../section/sectionHeaderMeta';
|
|
@@ -170,6 +171,7 @@ export const ZORA_COMPONENT_META: ZoraComponentMetaRegistry = finalizeFeatureMet
|
|
|
170
171
|
PopoverMenu: popoverMenuMeta,
|
|
171
172
|
Progress: progressMeta,
|
|
172
173
|
ProgressRing: progressRingMeta,
|
|
174
|
+
RichText: richTextMeta,
|
|
173
175
|
Radio: radioMeta,
|
|
174
176
|
RadioGroup: radioGroupMeta,
|
|
175
177
|
Rating: ratingMeta,
|
|
@@ -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;
|
|
@@ -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
|
+
});
|