@ankhorage/zora 28.10.1 → 28.11.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 +10 -0
- package/README.md +1 -1
- package/dist/features/flow/adapters/inbound/FlowCanvas.d.ts +5 -0
- package/dist/features/flow/adapters/inbound/FlowCanvas.d.ts.map +1 -0
- package/dist/features/flow/adapters/inbound/FlowCanvas.js +261 -0
- package/dist/features/flow/adapters/inbound/FlowCanvas.js.map +1 -0
- package/dist/features/flow/application/createFlowEditorController.d.ts +13 -0
- package/dist/features/flow/application/createFlowEditorController.d.ts.map +1 -0
- package/dist/features/flow/application/createFlowEditorController.js +86 -0
- package/dist/features/flow/application/createFlowEditorController.js.map +1 -0
- package/dist/features/flow/application/getFlowPortAnchor.d.ts +10 -0
- package/dist/features/flow/application/getFlowPortAnchor.d.ts.map +1 -0
- package/dist/features/flow/application/getFlowPortAnchor.js +18 -0
- package/dist/features/flow/application/getFlowPortAnchor.js.map +1 -0
- package/dist/features/flow/application/mapFlowViewport.d.ts +10 -0
- package/dist/features/flow/application/mapFlowViewport.d.ts.map +1 -0
- package/dist/features/flow/application/mapFlowViewport.js +22 -0
- package/dist/features/flow/application/mapFlowViewport.js.map +1 -0
- package/dist/features/flow/public.d.ts +3 -0
- package/dist/features/flow/public.d.ts.map +1 -0
- package/dist/features/flow/public.js +2 -0
- package/dist/features/flow/public.js.map +1 -0
- package/dist/features/graph-node/adapters/inbound/GraphNode.d.ts +5 -0
- package/dist/features/graph-node/adapters/inbound/GraphNode.d.ts.map +1 -0
- package/dist/features/graph-node/adapters/inbound/GraphNode.js +190 -0
- package/dist/features/graph-node/adapters/inbound/GraphNode.js.map +1 -0
- package/dist/features/graph-node/getGraphNodePortGeometry.d.ts +17 -0
- package/dist/features/graph-node/getGraphNodePortGeometry.d.ts.map +1 -0
- package/dist/features/graph-node/getGraphNodePortGeometry.js +23 -0
- package/dist/features/graph-node/getGraphNodePortGeometry.js.map +1 -0
- package/dist/features/graph-node/public.d.ts +3 -0
- package/dist/features/graph-node/public.d.ts.map +1 -0
- package/dist/features/graph-node/public.js +2 -0
- package/dist/features/graph-node/public.js.map +1 -0
- package/dist/features/grid-view/adapters/inbound/GridView.d.ts +1 -1
- package/dist/features/grid-view/adapters/inbound/GridView.d.ts.map +1 -1
- package/dist/features/grid-view/adapters/inbound/GridView.js +105 -41
- package/dist/features/grid-view/adapters/inbound/GridView.js.map +1 -1
- package/dist/features/grid-view/application/createGridScrollSync.d.ts +2 -5
- package/dist/features/grid-view/application/createGridScrollSync.d.ts.map +1 -1
- package/dist/features/grid-view/application/createGridScrollSync.js +109 -45
- package/dist/features/grid-view/application/createGridScrollSync.js.map +1 -1
- package/dist/features/grid-view/public.d.ts +1 -1
- package/dist/features/grid-view/public.d.ts.map +1 -1
- package/dist/features/grid-view/public.js.map +1 -1
- package/dist/features/layout/utils/createScrollGestureLock.d.ts.map +1 -1
- package/dist/features/layout/utils/createScrollGestureLock.js +4 -0
- package/dist/features/layout/utils/createScrollGestureLock.js.map +1 -1
- package/dist/features/theme/node.d.ts +5 -0
- package/dist/features/theme/node.d.ts.map +1 -0
- package/dist/features/theme/node.js +4 -0
- package/dist/features/theme/node.js.map +1 -0
- package/dist/features/theme/public.d.ts +2 -0
- package/dist/features/theme/public.d.ts.map +1 -1
- package/dist/features/theme/public.js +1 -0
- package/dist/features/theme/public.js.map +1 -1
- package/dist/types/flow.d.ts +81 -0
- package/dist/types/flow.d.ts.map +1 -0
- package/dist/types/flow.js +2 -0
- package/dist/types/flow.js.map +1 -0
- package/dist/types/graph-node.d.ts +42 -0
- package/dist/types/graph-node.d.ts.map +1 -0
- package/dist/types/graph-node.js +2 -0
- package/dist/types/graph-node.js.map +1 -0
- package/dist/types/grid-view.d.ts +27 -3
- package/dist/types/grid-view.d.ts.map +1 -1
- package/dist/types/grid-view.js.map +1 -1
- package/dist/types/layout.d.ts +2 -0
- package/dist/types/layout.d.ts.map +1 -1
- package/dist/types/layout.js.map +1 -1
- package/package.json +21 -3
- package/src/features/flow/adapters/inbound/FlowCanvas.tsx +501 -0
- package/src/features/flow/application/createFlowEditorController.test.ts +146 -0
- package/src/features/flow/application/createFlowEditorController.ts +99 -0
- package/src/features/flow/application/getFlowPortAnchor.test.ts +23 -0
- package/src/features/flow/application/getFlowPortAnchor.ts +30 -0
- package/src/features/flow/application/mapFlowViewport.test.ts +11 -0
- package/src/features/flow/application/mapFlowViewport.ts +29 -0
- package/src/features/flow/public.test.ts +7 -0
- package/src/features/flow/public.ts +13 -0
- package/src/features/graph-node/adapters/inbound/GraphNode.test.tsx +80 -0
- package/src/features/graph-node/adapters/inbound/GraphNode.tsx +259 -0
- package/src/features/graph-node/getGraphNodePortGeometry.test.ts +35 -0
- package/src/features/graph-node/getGraphNodePortGeometry.ts +41 -0
- package/src/features/graph-node/public.test.ts +7 -0
- package/src/features/graph-node/public.ts +2 -0
- package/src/features/grid-view/adapters/inbound/GridView.nativeScrollSync.test.tsx +198 -7
- package/src/features/grid-view/adapters/inbound/GridView.tsx +248 -145
- package/src/features/grid-view/application/createGridScrollSync.test.ts +46 -17
- package/src/features/grid-view/application/createGridScrollSync.ts +100 -43
- package/src/features/grid-view/public.ts +6 -1
- package/src/features/layout/utils/createScrollGestureLock.ts +4 -0
- package/src/features/theme/application/use-cases/compileZoraTheme.test.ts +1 -1
- package/src/features/theme/node.ts +18 -0
- package/src/features/theme/public.ts +7 -0
- package/src/platformAcceptance.test.ts +15 -11
- package/src/types/flow.ts +99 -0
- package/src/types/graph-node.ts +45 -0
- package/src/types/grid-view.ts +25 -3
- package/src/types/layout.ts +2 -0
- package/web-dist/chunks/{Accordion-9dq115tn.js → Accordion-064hgrct.js} +3 -3
- package/web-dist/chunks/{Accordion-wbf7gqrm.js → Accordion-2b3sd76b.js} +3 -3
- package/web-dist/chunks/{Accordion-k9n1yse4.js → Accordion-2kv6p7by.js} +10 -38
- package/web-dist/chunks/{Accordion-6gc0jw1n.js → Accordion-5x4cv0kv.js} +1 -1
- package/web-dist/chunks/{Accordion-r8swmfjm.js → Accordion-6d63tc7d.js} +1 -1
- package/web-dist/chunks/{Accordion-vbz1mjm6.js → Accordion-7eysykr1.js} +4 -4
- package/web-dist/chunks/{Accordion-59x6e7bs.js → Accordion-91qf4q27.js} +1 -1
- package/web-dist/chunks/{Accordion-hadw5304.js → Accordion-98886mbn.js} +1 -1
- package/web-dist/chunks/{Accordion-vtbs98r4.js → Accordion-a0hbjxg9.js} +4 -4
- package/web-dist/chunks/{Accordion-73p2mg3h.js → Accordion-a49s4ywn.js} +4 -4
- package/web-dist/chunks/{Accordion-tb0vc91c.js → Accordion-a8b6g53f.js} +4 -4
- package/web-dist/chunks/{Accordion-25v2vczc.js → Accordion-afxbyvwp.js} +3 -3
- package/web-dist/chunks/{Accordion-g5pvs1aa.js → Accordion-ajqj6ymg.js} +5 -5
- package/web-dist/chunks/{Accordion-w2kx944a.js → Accordion-ak6dvant.js} +3 -3
- package/web-dist/chunks/{Accordion-778fjjsh.js → Accordion-b1tqkxx6.js} +3 -3
- package/web-dist/chunks/{Accordion-rp9cjtpg.js → Accordion-bm30dkbw.js} +2 -2
- package/web-dist/chunks/{Accordion-rsw5jt7m.js → Accordion-cah5j61y.js} +2 -2
- package/web-dist/chunks/{Accordion-pr1tv6jx.js → Accordion-dfr26j8m.js} +1 -1
- package/web-dist/chunks/{Accordion-zmrbktd8.js → Accordion-dnfgtbq3.js} +8 -8
- package/web-dist/chunks/{Accordion-m3tq2vcc.js → Accordion-dy1j2a7p.js} +6 -6
- package/web-dist/chunks/{Accordion-7pgh8q4h.js → Accordion-e9jwetg7.js} +2 -2
- package/web-dist/chunks/{Accordion-gnkzvj03.js → Accordion-e9xmwxzp.js} +1 -1
- package/web-dist/chunks/{Accordion-q8ymmar7.js → Accordion-ek0hh2nx.js} +4 -4
- package/web-dist/chunks/{Accordion-2berhsg5.js → Accordion-et7xzm6k.js} +9 -9
- package/web-dist/chunks/Accordion-eysfka31.js +1590 -0
- package/web-dist/chunks/{Accordion-3xfqmr1r.js → Accordion-gy3bx3xa.js} +2 -2
- package/web-dist/chunks/{Accordion-tj4fe6wk.js → Accordion-h2rnzgyv.js} +3 -3
- package/web-dist/chunks/Accordion-hbwhya78.js +83 -0
- package/web-dist/chunks/{Accordion-t9w365ke.js → Accordion-hbwyj12m.js} +1 -1
- package/web-dist/chunks/{Accordion-q2yxtdzc.js → Accordion-j3esnt3f.js} +6 -6
- package/web-dist/chunks/Accordion-jkgd7dmf.js +1 -0
- package/web-dist/chunks/{Accordion-qwftammh.js → Accordion-kxjjp03t.js} +5 -5
- package/web-dist/chunks/Accordion-mkd3k28h.js +275 -0
- package/web-dist/chunks/{Accordion-xqkkfwkm.js → Accordion-nhf8zjt4.js} +2 -2
- package/web-dist/chunks/{Accordion-hg4db1sk.js → Accordion-p84h11ek.js} +4 -4
- package/web-dist/chunks/{Accordion-zhgty1ae.js → Accordion-pagdkp07.js} +3 -3
- package/web-dist/chunks/{Accordion-dv5c27w4.js → Accordion-pjbmmr20.js} +1 -1
- package/web-dist/chunks/{Accordion-7ayxbm7k.js → Accordion-pr4a281g.js} +1 -1
- package/web-dist/chunks/{Accordion-yca8r7kx.js → Accordion-qz6ddnmv.js} +3 -3
- package/web-dist/chunks/{Accordion-dcjzxzv3.js → Accordion-rv90tjqr.js} +2 -2
- package/web-dist/chunks/{Accordion-0zk0xp73.js → Accordion-snk6nggm.js} +326 -174
- package/web-dist/chunks/{Accordion-casb2ndy.js → Accordion-th7yhwhf.js} +5 -5
- package/web-dist/chunks/{Accordion-e6ettgh0.js → Accordion-vbh3xqv6.js} +2 -2
- package/web-dist/chunks/{Accordion-vdzyhtyd.js → Accordion-w4zh2nws.js} +8 -8
- package/web-dist/chunks/Accordion-w8zke8fa.js +37 -0
- package/web-dist/chunks/{Accordion-3e60xwvy.js → Accordion-wkqemqjw.js} +1 -1
- package/web-dist/chunks/{Accordion-vwqf8kn1.js → Accordion-x9sb23p3.js} +3 -3
- package/web-dist/chunks/{Accordion-xhkphta6.js → Accordion-y6sg47rv.js} +1 -1
- package/web-dist/chunks/{Accordion-mw8zh0vs.js → Accordion-yannd7r3.js} +4 -4
- package/web-dist/chunks/{Accordion-457amtv7.js → Accordion-z3m3wvfz.js} +6 -1580
- package/web-dist/chunks/{Accordion-pvcdvh3w.js → Accordion-zagrbkq1.js} +2 -2
- package/web-dist/chunks/{Accordion-2jcas7qq.js → Accordion-zays65re.js} +5 -5
- package/web-dist/chunks/{RichTextClient-w75r2x97.js → RichTextClient-qd6gmm0x.js} +12 -11
- package/web-dist/chunks/{Video.native-bb9g33nd.js → Video.native-7zsbp5vg.js} +7 -6
- package/web-dist/components/accordion/Accordion.js +6 -5
- package/web-dist/components/accordion-item/AccordionItem.js +6 -5
- package/web-dist/components/activity-indicator/ActivityIndicator.js +1 -1
- package/web-dist/components/app-bar/AppBar.js +8 -7
- package/web-dist/components/app-header/AppHeader.js +8 -7
- package/web-dist/components/app-shell/AppShell.js +3 -2
- package/web-dist/components/audio/Audio.js +6 -5
- package/web-dist/components/auth-screen/AuthScreen.js +11 -10
- package/web-dist/components/avatar/Avatar.js +6 -5
- package/web-dist/components/avatar-group/AvatarGroup.js +6 -5
- package/web-dist/components/badge/Badge.js +2 -2
- package/web-dist/components/barcode-scanner-view/BarcodeScannerView.js +11 -10
- package/web-dist/components/bottom-sheet/BottomSheet.js +4 -3
- package/web-dist/components/bottom-sheet-flat-list/BottomSheetFlatList.js +4 -3
- package/web-dist/components/bottom-sheet-scroll-view/BottomSheetScrollView.js +4 -3
- package/web-dist/components/bottom-sheet-section-list/BottomSheetSectionList.js +4 -3
- package/web-dist/components/bottom-sheet-view/BottomSheetView.js +4 -3
- package/web-dist/components/bottom-sheet-virtualized-list/BottomSheetVirtualizedList.js +4 -3
- package/web-dist/components/breadcrumbs/Breadcrumbs.js +6 -5
- package/web-dist/components/button/Button.js +4 -3
- package/web-dist/components/button-group/ButtonGroup.js +4 -3
- package/web-dist/components/calendar/Calendar.js +8 -7
- package/web-dist/components/camera-permission-view/CameraPermissionView.js +11 -10
- package/web-dist/components/card/Card.js +10 -9
- package/web-dist/components/card-back/CardBack.js +2 -2
- package/web-dist/components/card-hand/CardHand.js +2 -2
- package/web-dist/components/chat-list-item/ChatListItem.js +8 -7
- package/web-dist/components/checkbox/Checkbox.js +5 -4
- package/web-dist/components/checkbox-group/CheckboxGroup.js +5 -4
- package/web-dist/components/chess-board/ChessBoard.js +4 -3
- package/web-dist/components/chip/Chip.js +6 -5
- package/web-dist/components/chip-group/ChipGroup.js +6 -5
- package/web-dist/components/collection-editor/CollectionEditor.js +10 -9
- package/web-dist/components/color-hue-scale/ColorHueScale.js +17 -15
- package/web-dist/components/color-picker/ColorPicker.js +17 -15
- package/web-dist/components/color-tone/ColorTone.js +17 -15
- package/web-dist/components/color-wheel/ColorWheel.js +17 -15
- package/web-dist/components/content-rail/ContentRail.js +5 -4
- package/web-dist/components/data-table/DataTable.js +16 -15
- package/web-dist/components/date-picker/DatePicker.js +10 -9
- package/web-dist/components/dialog/Dialog.js +5 -4
- package/web-dist/components/divider/Divider.js +3 -2
- package/web-dist/components/empty-state/EmptyState.js +11 -10
- package/web-dist/components/explorer/Explorer.js +8 -7
- package/web-dist/components/field/Field.js +5 -4
- package/web-dist/components/file-explorer/FileExplorer.js +8 -7
- package/web-dist/components/flat-list/FlatList.js +6 -5
- package/web-dist/components/flow-canvas/FlowCanvas.d.ts +7 -0
- package/web-dist/components/flow-canvas/FlowCanvas.dependency-0.d.ts +27 -0
- package/web-dist/components/flow-canvas/FlowCanvas.dependency-1.d.ts +3 -0
- package/web-dist/components/flow-canvas/FlowCanvas.js +513 -0
- package/web-dist/components/flow-canvas/FlowCanvas.types-0.d.ts +92 -0
- package/web-dist/components/flow-canvas/index.d.ts +2 -0
- package/web-dist/components/flow-canvas/index.js +2 -0
- package/web-dist/components/forgot-password-form/ForgotPasswordForm.js +11 -10
- package/web-dist/components/form/Form.js +7 -6
- package/web-dist/components/form-actions/FormActions.js +7 -6
- package/web-dist/components/form-error/FormError.js +7 -6
- package/web-dist/components/game/Game.js +4 -3
- package/web-dist/components/game-entity/GameEntity.js +4 -3
- package/web-dist/components/game-field/GameField.js +4 -3
- package/web-dist/components/game-input-zone/GameInputZone.js +4 -3
- package/web-dist/components/game-measurement-probe/GameMeasurementProbe.js +4 -3
- package/web-dist/components/game-overlay/GameOverlay.js +4 -3
- package/web-dist/components/gradient/Gradient.js +4 -3
- package/web-dist/components/gradient-renderer-provider/GradientRendererProvider.js +4 -3
- package/web-dist/components/graph-node/GraphNode.d.ts +7 -0
- package/web-dist/components/graph-node/GraphNode.dependency-0.d.ts +27 -0
- package/web-dist/components/graph-node/GraphNode.dependency-1.d.ts +3 -0
- package/web-dist/components/graph-node/GraphNode.dependency-2.d.ts +5 -0
- package/web-dist/components/graph-node/GraphNode.js +20 -0
- package/web-dist/components/graph-node/GraphNode.types-0.d.ts +46 -0
- package/web-dist/components/graph-node/index.d.ts +2 -0
- package/web-dist/components/graph-node/index.js +2 -0
- package/web-dist/components/grid/Grid.js +3 -2
- package/web-dist/components/grid-line-overlay/GridLineOverlay.js +2 -2
- package/web-dist/components/grid-ruler/GridRuler.js +2 -2
- package/web-dist/components/grid-view/GridView.d.ts +1 -1
- package/web-dist/components/grid-view/GridView.js +2 -1
- package/web-dist/components/grid-view/GridView.types-0.d.ts +21 -0
- package/web-dist/components/heading/Heading.js +2 -2
- package/web-dist/components/hero/Hero.js +10 -9
- package/web-dist/components/icon/Icon.js +2 -2
- package/web-dist/components/icon-button/IconButton.js +4 -3
- package/web-dist/components/image/Image.js +5 -4
- package/web-dist/components/keyboard-avoiding-view/KeyboardAvoidingView.js +2 -2
- package/web-dist/components/link/Link.js +2 -2
- package/web-dist/components/list/List.js +6 -5
- package/web-dist/components/list-item/ListItem.js +6 -5
- package/web-dist/components/list-section/ListSection.js +6 -5
- package/web-dist/components/master-detail/MasterDetail.js +3 -2
- package/web-dist/components/matrix-grid/MatrixGrid.js +5 -4
- package/web-dist/components/media-card/MediaCard.js +10 -9
- package/web-dist/components/media-explorer/MediaExplorer.js +8 -7
- package/web-dist/components/message-bubble/MessageBubble.js +8 -7
- package/web-dist/components/metric-card/MetricCard.js +10 -9
- package/web-dist/components/missing-element/MissingElement.js +5 -4
- package/web-dist/components/o-auth-provider-button/OAuthProviderButton.js +11 -10
- package/web-dist/components/o-auth-provider-list/OAuthProviderList.js +11 -10
- package/web-dist/components/opening-book/OpeningBook.js +4 -3
- package/web-dist/components/otp-form/OtpForm.js +11 -10
- package/web-dist/components/pagination/Pagination.js +5 -4
- package/web-dist/components/palette-item/PaletteItem.js +10 -9
- package/web-dist/components/playing-card/PlayingCard.js +2 -2
- package/web-dist/components/poker-training-table/PokerTrainingTable.js +2 -2
- package/web-dist/components/popover/Popover.js +1 -1
- package/web-dist/components/popover-menu/PopoverMenu.js +5 -4
- package/web-dist/components/post-card/PostCard.js +10 -9
- package/web-dist/components/product-card/ProductCard.js +10 -9
- package/web-dist/components/progress/Progress.js +5 -4
- package/web-dist/components/progress-ring/ProgressRing.js +5 -4
- package/web-dist/components/radio/Radio.js +6 -5
- package/web-dist/components/radio-group/RadioGroup.js +6 -5
- package/web-dist/components/rating/Rating.js +4 -3
- package/web-dist/components/reader/Reader.js +11 -10
- package/web-dist/components/rich-text/RichText.js +3 -3
- package/web-dist/components/runtime-authoring-overlay/RuntimeAuthoringOverlay.js +4 -3
- package/web-dist/components/scan-overlay/ScanOverlay.js +11 -10
- package/web-dist/components/screen/Screen.js +3 -2
- package/web-dist/components/screen-section/ScreenSection.js +5 -4
- package/web-dist/components/scroll-view/ScrollView.js +3 -2
- package/web-dist/components/search-input/SearchInput.js +6 -5
- package/web-dist/components/section-header/SectionHeader.js +5 -4
- package/web-dist/components/section-list/SectionList.js +6 -5
- package/web-dist/components/select/Select.js +11 -10
- package/web-dist/components/selectable-item/SelectableItem.js +4 -3
- package/web-dist/components/selection-provider/SelectionProvider.js +4 -3
- package/web-dist/components/sign-in-form/SignInForm.js +11 -10
- package/web-dist/components/sign-up-form/SignUpForm.js +11 -10
- package/web-dist/components/skeleton/Skeleton.js +13 -12
- package/web-dist/components/skeleton-card/SkeletonCard.js +13 -12
- package/web-dist/components/skeleton-list/SkeletonList.js +13 -12
- package/web-dist/components/skeleton-text/SkeletonText.js +13 -12
- package/web-dist/components/spatial-grid/SpatialGrid.js +2 -1
- package/web-dist/components/surface/Surface.js +2 -2
- package/web-dist/components/switch/Switch.js +1 -1
- 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/tabletop-table/TabletopTable.js +2 -2
- package/web-dist/components/tabs/Tabs.js +2 -2
- package/web-dist/components/text/Text.js +2 -2
- package/web-dist/components/text-input/TextInput.js +5 -4
- package/web-dist/components/theme-mode-toggle/ThemeModeToggle.js +4 -3
- package/web-dist/components/tile-grid/TileGrid.js +2 -1
- package/web-dist/components/time-grid/TimeGrid.js +3 -2
- package/web-dist/components/time-picker/TimePicker.js +7 -6
- package/web-dist/components/timeline/Timeline.js +6 -5
- package/web-dist/components/toast/Toast.js +2 -2
- package/web-dist/components/toast-provider/ToastProvider.js +2 -2
- package/web-dist/components/toolbar/Toolbar.js +11 -10
- package/web-dist/components/tree-item/TreeItem.js +9 -8
- package/web-dist/components/uploader/Uploader.js +13 -12
- package/web-dist/components/video/Video.js +7 -6
- package/web-dist/components/view/View.js +3 -2
- package/web-dist/components/zora-provider/ZoraProvider.d.ts +7 -0
- package/web-dist/components/zora-provider/ZoraProvider.dependency-0.d.ts +15 -0
- package/web-dist/components/zora-provider/ZoraProvider.js +11 -0
- package/web-dist/components/zora-provider/ZoraProvider.types-0.d.ts +19 -0
- package/web-dist/components/zora-provider/index.d.ts +2 -0
- package/web-dist/components/zora-provider/index.js +2 -0
- package/web-dist/components/zora-theme-scope/ZoraThemeScope.d.ts +14 -0
- package/web-dist/components/zora-theme-scope/ZoraThemeScope.js +11 -0
- package/web-dist/components/zora-theme-scope/ZoraThemeScope.types-0.d.ts +3 -0
- package/web-dist/components/zora-theme-scope/index.d.ts +2 -0
- package/web-dist/components/zora-theme-scope/index.js +2 -0
- package/web-dist/components/zora-web-style-sheet/ZoraWebStyleSheet.js +3 -2
- package/web-dist/manifest.json +1058 -832
- package/web-dist/runtime/ZoraProvider.js +4 -80
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
FlowCanvasProps,
|
|
3
|
+
FlowConnectionRejection,
|
|
4
|
+
FlowNodeData,
|
|
5
|
+
FlowPort,
|
|
6
|
+
FlowPortAddress,
|
|
7
|
+
FlowViewport,
|
|
8
|
+
} from '../../../types/flow';
|
|
9
|
+
|
|
10
|
+
/** Create deterministic controlled-flow interaction callbacks without retaining editor state. */
|
|
11
|
+
export function createFlowEditorController(props: FlowCanvasProps) {
|
|
12
|
+
const selectNode = (nodeId: string) => {
|
|
13
|
+
if (props.readOnly || props.nodes.find((node) => node.id === nodeId)?.disabled) return;
|
|
14
|
+
props.onNodeSelectionChange?.([nodeId]);
|
|
15
|
+
};
|
|
16
|
+
const moveNode = (nodeId: string, delta: { readonly x: number; readonly y: number }) => {
|
|
17
|
+
if (props.readOnly) return;
|
|
18
|
+
const node = props.nodes.find((candidate) => candidate.id === nodeId);
|
|
19
|
+
if (!node || node.disabled) return;
|
|
20
|
+
props.onNodesMove?.(
|
|
21
|
+
props.nodes.map((candidate) =>
|
|
22
|
+
candidate.id === nodeId
|
|
23
|
+
? { ...candidate, position: movePosition(candidate, delta) }
|
|
24
|
+
: candidate,
|
|
25
|
+
),
|
|
26
|
+
);
|
|
27
|
+
};
|
|
28
|
+
const setViewport = (viewport: FlowViewport) => props.onViewportChange?.(viewport);
|
|
29
|
+
const connect = (source: FlowPortAddress, target: FlowPortAddress) => {
|
|
30
|
+
const rejection = connectionRejection(props.nodes, source, target);
|
|
31
|
+
if (props.readOnly || rejection) return rejection;
|
|
32
|
+
props.onConnect?.(source, target);
|
|
33
|
+
return undefined;
|
|
34
|
+
};
|
|
35
|
+
/*** Deliver a controlled deletion request for the currently enabled nodes. */
|
|
36
|
+
const deleteNodes = (nodeIds: readonly string[]) => {
|
|
37
|
+
if (props.readOnly || nodeIds.length === 0) return;
|
|
38
|
+
const enabledNodeIds = nodeIds.filter((nodeId) => {
|
|
39
|
+
const node = props.nodes.find((candidate) => candidate.id === nodeId);
|
|
40
|
+
return node !== undefined && !node.disabled;
|
|
41
|
+
});
|
|
42
|
+
if (enabledNodeIds.length > 0) props.onNodesDelete?.(enabledNodeIds);
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
return { connect, deleteNodes, moveNode, selectNode, setViewport };
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** Move only the caller-owned coordinate of a node. */
|
|
49
|
+
function movePosition(
|
|
50
|
+
node: FlowNodeData,
|
|
51
|
+
delta: { readonly x: number; readonly y: number },
|
|
52
|
+
): FlowNodeData['position'] {
|
|
53
|
+
return { x: node.position.x + delta.x, y: node.position.y + delta.y };
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/** Validates a connection at the Canvas boundary without introducing workflow-engine ownership. */
|
|
57
|
+
function connectionRejection(
|
|
58
|
+
nodes: readonly FlowNodeData[],
|
|
59
|
+
source: FlowPortAddress,
|
|
60
|
+
target: FlowPortAddress,
|
|
61
|
+
): FlowConnectionRejection | undefined {
|
|
62
|
+
if (source.nodeId === target.nodeId) return 'connection_requires_distinct_nodes';
|
|
63
|
+
const sourcePort = findPort(nodes, source);
|
|
64
|
+
const targetPort = findPort(nodes, target);
|
|
65
|
+
if (sourcePort?.direction !== 'output' || targetPort?.direction !== 'input') {
|
|
66
|
+
return 'connection_requires_output_to_input';
|
|
67
|
+
}
|
|
68
|
+
if (sourcePort.disabled || targetPort.disabled) return 'connection_targets_disabled_port';
|
|
69
|
+
return compatibleDataSchemas(sourcePort.data, targetPort.data)
|
|
70
|
+
? undefined
|
|
71
|
+
: 'connection_types_incompatible';
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/** Compares only portable schema references or primitive shapes available to the presentation layer. */
|
|
75
|
+
function compatibleDataSchemas(source: FlowPort['data'], target: FlowPort['data']): boolean {
|
|
76
|
+
const sourceReference = source?.schemaRef?.id ?? source?.schema?.ref?.id;
|
|
77
|
+
const targetReference = target?.schemaRef?.id ?? target?.schema?.ref?.id;
|
|
78
|
+
if (sourceReference && targetReference) return sourceReference === targetReference;
|
|
79
|
+
if (sourceReference || targetReference) return false;
|
|
80
|
+
const sourceTypes = schemaTypes(source?.schema?.type);
|
|
81
|
+
const targetTypes = schemaTypes(target?.schema?.type);
|
|
82
|
+
if (sourceTypes.length === 0 || targetTypes.length === 0) return true;
|
|
83
|
+
return sourceTypes.some((type) => targetTypes.includes(type));
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/** Normalizes a Contracts schema's primitive type union before comparing its declared alternatives. */
|
|
87
|
+
function schemaTypes(type: unknown): readonly string[] {
|
|
88
|
+
if (typeof type === 'string') return [type];
|
|
89
|
+
return Array.isArray(type) && type.every((candidate) => typeof candidate === 'string')
|
|
90
|
+
? type
|
|
91
|
+
: [];
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/** Locate one port through its public address. */
|
|
95
|
+
function findPort(nodes: readonly FlowNodeData[], address: FlowPortAddress): FlowPort | undefined {
|
|
96
|
+
return nodes
|
|
97
|
+
.find((node) => node.id === address.nodeId)
|
|
98
|
+
?.ports.find((port) => port.id === address.portId);
|
|
99
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { expect, test } from 'bun:test';
|
|
2
|
+
|
|
3
|
+
import { getFlowPortAnchor, getFlowPortAnchorKey } from './getFlowPortAnchor';
|
|
4
|
+
|
|
5
|
+
test('anchors edges at measured port centers regardless of node size or port order', () => {
|
|
6
|
+
const anchors = new Map([
|
|
7
|
+
[getFlowPortAnchorKey({ nodeId: 'source', portId: 'out' }), { x: 351, y: 204 }],
|
|
8
|
+
[getFlowPortAnchorKey({ nodeId: 'target', portId: 'in' }), { x: 414, y: 628 }],
|
|
9
|
+
]);
|
|
10
|
+
|
|
11
|
+
expect(getFlowPortAnchor(anchors, { nodeId: 'source', portId: 'out' })).toEqual({
|
|
12
|
+
x: 351,
|
|
13
|
+
y: 204,
|
|
14
|
+
});
|
|
15
|
+
expect(getFlowPortAnchor(anchors, { nodeId: 'target', portId: 'in' })).toEqual({
|
|
16
|
+
x: 414,
|
|
17
|
+
y: 628,
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
test('does not invent an anchor for a missing port', () => {
|
|
22
|
+
expect(getFlowPortAnchor(new Map(), { nodeId: 'source', portId: 'missing' })).toBeUndefined();
|
|
23
|
+
});
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { FlowNodeData, FlowPoint, FlowPortAddress } from '../../../types/flow';
|
|
2
|
+
import { getGraphNodePortGeometry } from '../../graph-node/getGraphNodePortGeometry';
|
|
3
|
+
|
|
4
|
+
/*** Creates the stable local key used for one rendered port measurement. */
|
|
5
|
+
export function getFlowPortAnchorKey(address: FlowPortAddress) {
|
|
6
|
+
return JSON.stringify([address.nodeId, address.portId]);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/*** Resolves the stable canvas coordinate measured at the center of a rendered flow port. */
|
|
10
|
+
export function getFlowPortAnchor(
|
|
11
|
+
anchors: ReadonlyMap<string, FlowPoint>,
|
|
12
|
+
address: FlowPortAddress,
|
|
13
|
+
): FlowPoint | undefined {
|
|
14
|
+
return anchors.get(getFlowPortAnchorKey(address));
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/*** Supplies stable GraphNode port geometry before virtualization has mounted and measured a node. */
|
|
18
|
+
export function getDeterministicFlowPortAnchor(
|
|
19
|
+
node: FlowNodeData,
|
|
20
|
+
address: FlowPortAddress,
|
|
21
|
+
): FlowPoint | undefined {
|
|
22
|
+
return getGraphNodePortGeometry({ ports: node.ports }).ports.find(
|
|
23
|
+
(port) => port.id === address.portId,
|
|
24
|
+
)?.anchor;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/*** Provides a deterministic virtualized item height until GraphNode reports its real layout. */
|
|
28
|
+
export function getDeterministicFlowNodeHeight(node: FlowNodeData): number {
|
|
29
|
+
return getGraphNodePortGeometry({ ports: node.ports }).height;
|
|
30
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { expect, test } from 'bun:test';
|
|
2
|
+
|
|
3
|
+
import { flowViewportToGrid, gridViewportToFlow } from './mapFlowViewport';
|
|
4
|
+
|
|
5
|
+
test('round-trips the public flow viewport through the canonical grid viewport', () => {
|
|
6
|
+
const flow = { pan: { x: 32, y: -24 }, zoom: 2 };
|
|
7
|
+
const grid = flowViewportToGrid(flow, { height: 300, width: 400 });
|
|
8
|
+
|
|
9
|
+
expect(grid).toMatchObject({ offsetX: -16, offsetY: 12, pixelsPerUnitX: 2, pixelsPerUnitY: 2 });
|
|
10
|
+
expect(gridViewportToFlow(grid)).toEqual(flow);
|
|
11
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { GridViewport } from '@ankhorage/grid-view';
|
|
2
|
+
|
|
3
|
+
import type { FlowViewport } from '../../../types/flow';
|
|
4
|
+
|
|
5
|
+
/*** Map the public flow pan/zoom shape onto the canonical grid viewport at the single boundary. */
|
|
6
|
+
export function flowViewportToGrid(
|
|
7
|
+
viewport: FlowViewport,
|
|
8
|
+
size: { readonly width: number; readonly height: number },
|
|
9
|
+
): GridViewport {
|
|
10
|
+
return {
|
|
11
|
+
height: size.height,
|
|
12
|
+
offsetX: -viewport.pan.x / viewport.zoom,
|
|
13
|
+
offsetY: -viewport.pan.y / viewport.zoom,
|
|
14
|
+
pixelsPerUnitX: viewport.zoom,
|
|
15
|
+
pixelsPerUnitY: viewport.zoom,
|
|
16
|
+
width: size.width,
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/*** Map a canonical grid viewport back to the public flow pan/zoom shape. */
|
|
21
|
+
export function gridViewportToFlow(viewport: GridViewport): FlowViewport {
|
|
22
|
+
return {
|
|
23
|
+
pan: {
|
|
24
|
+
x: viewport.offsetX === 0 ? 0 : -viewport.offsetX * viewport.pixelsPerUnitX,
|
|
25
|
+
y: viewport.offsetY === 0 ? 0 : -viewport.offsetY * viewport.pixelsPerUnitY,
|
|
26
|
+
},
|
|
27
|
+
zoom: viewport.pixelsPerUnitX,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { expect, test } from 'bun:test';
|
|
2
|
+
|
|
3
|
+
test('exposes the shared flow canvas component through its public facade', async () => {
|
|
4
|
+
const facade = await Bun.file('src/features/flow/public.ts').text();
|
|
5
|
+
|
|
6
|
+
expect(facade).toContain("export { FlowCanvas } from './adapters/inbound/FlowCanvas';");
|
|
7
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type {
|
|
2
|
+
FlowCanvasProps,
|
|
3
|
+
FlowConnection,
|
|
4
|
+
FlowConnectionRejection,
|
|
5
|
+
FlowNodeData,
|
|
6
|
+
FlowNodeRenderState,
|
|
7
|
+
FlowPaletteItem,
|
|
8
|
+
FlowPoint,
|
|
9
|
+
FlowPort,
|
|
10
|
+
FlowPortAddress,
|
|
11
|
+
FlowViewport,
|
|
12
|
+
} from '../../types/flow';
|
|
13
|
+
export { FlowCanvas } from './adapters/inbound/FlowCanvas';
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { join } from 'node:path';
|
|
2
|
+
import { pathToFileURL } from 'node:url';
|
|
3
|
+
|
|
4
|
+
import { expect, test } from 'bun:test';
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import { renderToStaticMarkup } from 'react-dom/server';
|
|
7
|
+
|
|
8
|
+
import type { GraphViewProps } from '../../../../types/graph-view';
|
|
9
|
+
import type { GraphNode as GraphNodeComponent } from './GraphNode';
|
|
10
|
+
|
|
11
|
+
const webDistRoot = join(import.meta.dir, '../../../../../web-dist');
|
|
12
|
+
const load = (path: string) => import(pathToFileURL(join(webDistRoot, path)).href);
|
|
13
|
+
|
|
14
|
+
async function renderNode(props: React.ComponentProps<typeof GraphNodeComponent>) {
|
|
15
|
+
const { GraphNode } = (await load('components/graph-node/index.js')) as {
|
|
16
|
+
GraphNode: typeof GraphNodeComponent;
|
|
17
|
+
};
|
|
18
|
+
const { ZoraProvider } = (await load('runtime/ZoraProvider.js')) as {
|
|
19
|
+
ZoraProvider: React.ComponentType<React.PropsWithChildren>;
|
|
20
|
+
};
|
|
21
|
+
return renderToStaticMarkup(
|
|
22
|
+
<ZoraProvider>
|
|
23
|
+
<GraphNode {...props} />
|
|
24
|
+
</ZoraProvider>,
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
test('renders composed ZORA content without ports', async () => {
|
|
29
|
+
const markup = await renderNode({
|
|
30
|
+
children: <span>composed-content</span>,
|
|
31
|
+
description: 'Describes the node',
|
|
32
|
+
title: 'Plain node',
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
expect(markup).toContain('Plain node');
|
|
36
|
+
expect(markup).toContain('Describes the node');
|
|
37
|
+
expect(markup).toContain('composed-content');
|
|
38
|
+
expect(markup).not.toContain('Connect');
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
test('renders arbitrary children without the default title anatomy', async () => {
|
|
42
|
+
const markup = await renderNode({ children: <span>fully-composed-node</span> });
|
|
43
|
+
|
|
44
|
+
expect(markup).toContain('fully-composed-node');
|
|
45
|
+
expect(markup).not.toContain('role="button"');
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
test('renders optional ports that stay controlled by the host', async () => {
|
|
49
|
+
const markup = await renderNode({
|
|
50
|
+
ports: [
|
|
51
|
+
{ direction: 'input', id: 'in', label: 'Input' },
|
|
52
|
+
{ direction: 'output', id: 'out', label: 'Output' },
|
|
53
|
+
],
|
|
54
|
+
selected: true,
|
|
55
|
+
title: 'Port node',
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
expect(markup).toContain('Port node: Input');
|
|
59
|
+
expect(markup).toContain('Port node: Output');
|
|
60
|
+
expect(markup).toContain('aria-selected="true"');
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
test('plugs into the Cytoscape GraphView renderNode contract without gesture handlers', async () => {
|
|
64
|
+
const { GraphNode } = (await load('components/graph-node/index.js')) as {
|
|
65
|
+
GraphNode: typeof GraphNodeComponent;
|
|
66
|
+
};
|
|
67
|
+
const renderNode: NonNullable<GraphViewProps['renderNode']> = ({ node, selected }) => (
|
|
68
|
+
<GraphNode selected={selected} title={String(node.id)} />
|
|
69
|
+
);
|
|
70
|
+
const { ZoraProvider } = (await load('runtime/ZoraProvider.js')) as {
|
|
71
|
+
ZoraProvider: React.ComponentType<React.PropsWithChildren>;
|
|
72
|
+
};
|
|
73
|
+
const markup = renderToStaticMarkup(
|
|
74
|
+
<ZoraProvider>
|
|
75
|
+
{renderNode({ hovered: false, node: { id: 'repo' }, selected: false, zoom: 1 })}
|
|
76
|
+
</ZoraProvider>,
|
|
77
|
+
);
|
|
78
|
+
|
|
79
|
+
expect(markup).not.toContain('onResponder');
|
|
80
|
+
});
|
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Pressable, View } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import type { GraphNodePoint, GraphNodeProps } from '../../../../types/graph-node';
|
|
5
|
+
import { Badge } from '../../../badge/public';
|
|
6
|
+
import { Card } from '../../../card/public';
|
|
7
|
+
import { Icon } from '../../../icon/public';
|
|
8
|
+
import { useScrollGestureLock } from '../../../layout/public';
|
|
9
|
+
import { withZoraThemeScope } from '../../../theme/adapters/inbound/withZoraThemeScope';
|
|
10
|
+
import { useZoraTheme } from '../../../theme/composition/useZoraTheme';
|
|
11
|
+
import { Text } from '../../../typography/public';
|
|
12
|
+
import { getGraphNodePortGeometry } from '../../getGraphNodePortGeometry';
|
|
13
|
+
|
|
14
|
+
const PORT_INSET = 4;
|
|
15
|
+
const PORT_SIZE = 44;
|
|
16
|
+
const DRAG_THRESHOLD = 2;
|
|
17
|
+
|
|
18
|
+
/*** Presents one generic node with composed content, optional ports and controlled interactions. */
|
|
19
|
+
export const GraphNode = React.memo(withZoraThemeScope(GraphNodeInner));
|
|
20
|
+
|
|
21
|
+
/*** Render node content in the active ZORA theme scope. */
|
|
22
|
+
function GraphNodeInner(props: GraphNodeProps) {
|
|
23
|
+
const { onPortLayout, ports = [] } = props;
|
|
24
|
+
const { theme } = useZoraTheme();
|
|
25
|
+
const drag = useNodeDrag(props);
|
|
26
|
+
const portsOffsetY = React.useRef(0);
|
|
27
|
+
const geometry = getGraphNodePortGeometry({ ports, width: props.width });
|
|
28
|
+
const reportPortAnchors = React.useCallback(() => {
|
|
29
|
+
if (!onPortLayout) return;
|
|
30
|
+
getGraphNodePortGeometry({
|
|
31
|
+
ports,
|
|
32
|
+
portsTop: portsOffsetY.current,
|
|
33
|
+
width: props.width,
|
|
34
|
+
}).ports.forEach((port) => onPortLayout(port.id, port.anchor));
|
|
35
|
+
}, [onPortLayout, ports, props.width]);
|
|
36
|
+
React.useLayoutEffect(reportPortAnchors, [reportPortAnchors]);
|
|
37
|
+
const unavailable = props.readOnly === true || props.disabled === true;
|
|
38
|
+
const hasDefaultHeader =
|
|
39
|
+
props.title !== undefined ||
|
|
40
|
+
props.description !== undefined ||
|
|
41
|
+
props.icon !== undefined ||
|
|
42
|
+
props.badge !== undefined;
|
|
43
|
+
|
|
44
|
+
return (
|
|
45
|
+
<View
|
|
46
|
+
style={{
|
|
47
|
+
backgroundColor: theme.semantics.surface.default,
|
|
48
|
+
borderRadius: 12,
|
|
49
|
+
elevation: props.selected ? 3 : 1,
|
|
50
|
+
shadowColor: theme.semantics.neutral.text,
|
|
51
|
+
shadowOpacity: props.selected ? 0.16 : 0.08,
|
|
52
|
+
shadowRadius: props.selected ? 10 : 6,
|
|
53
|
+
width: geometry.width,
|
|
54
|
+
}}
|
|
55
|
+
testID={props.testID ? `${props.testID}-frame` : undefined}
|
|
56
|
+
>
|
|
57
|
+
<Card
|
|
58
|
+
compact
|
|
59
|
+
padding="xs"
|
|
60
|
+
radius="m"
|
|
61
|
+
style={{ borderWidth: 0, elevation: 0, shadowOpacity: 0 }}
|
|
62
|
+
>
|
|
63
|
+
<View accessible={false} collapsable={false} {...drag.handlers}>
|
|
64
|
+
{hasDefaultHeader ? (
|
|
65
|
+
<Pressable
|
|
66
|
+
aria-selected={props.selected === true}
|
|
67
|
+
accessibilityHint={props.onMove ? 'Select this node. Drag to move it.' : undefined}
|
|
68
|
+
accessibilityLabel={props.title}
|
|
69
|
+
accessibilityRole="button"
|
|
70
|
+
accessibilityState={{ disabled: unavailable, selected: props.selected === true }}
|
|
71
|
+
disabled={props.onPress === undefined || unavailable}
|
|
72
|
+
style={{ alignItems: 'flex-start', flexDirection: 'row', gap: 8 }}
|
|
73
|
+
testID={props.testID}
|
|
74
|
+
onPress={drag.press}
|
|
75
|
+
>
|
|
76
|
+
{props.icon ? (
|
|
77
|
+
<View
|
|
78
|
+
accessible={false}
|
|
79
|
+
style={{
|
|
80
|
+
alignItems: 'center',
|
|
81
|
+
backgroundColor: theme.semantics.brand.softBg,
|
|
82
|
+
borderRadius: 10,
|
|
83
|
+
height: 36,
|
|
84
|
+
justifyContent: 'center',
|
|
85
|
+
width: 36,
|
|
86
|
+
}}
|
|
87
|
+
>
|
|
88
|
+
<Icon color={theme.semantics.brand.onSoftText} size={20} {...props.icon} />
|
|
89
|
+
</View>
|
|
90
|
+
) : null}
|
|
91
|
+
<View style={{ flex: 1, minWidth: 0 }}>
|
|
92
|
+
{props.title ? (
|
|
93
|
+
<Text ellipsizeMode="tail" numberOfLines={1} variant="body" weight="bold">
|
|
94
|
+
{props.title}
|
|
95
|
+
</Text>
|
|
96
|
+
) : null}
|
|
97
|
+
{props.description ? (
|
|
98
|
+
<Text ellipsizeMode="tail" emphasis="muted" numberOfLines={2} variant="bodySmall">
|
|
99
|
+
{props.description}
|
|
100
|
+
</Text>
|
|
101
|
+
) : null}
|
|
102
|
+
</View>
|
|
103
|
+
{props.badge ? <Badge size="s">{props.badge}</Badge> : null}
|
|
104
|
+
</Pressable>
|
|
105
|
+
) : null}
|
|
106
|
+
{props.children}
|
|
107
|
+
</View>
|
|
108
|
+
</Card>
|
|
109
|
+
{ports.length > 0 ? (
|
|
110
|
+
<View
|
|
111
|
+
style={{ paddingHorizontal: PORT_INSET }}
|
|
112
|
+
onLayout={(event) => {
|
|
113
|
+
portsOffsetY.current = event.nativeEvent.layout.y;
|
|
114
|
+
reportPortAnchors();
|
|
115
|
+
}}
|
|
116
|
+
>
|
|
117
|
+
{ports.map((port) => {
|
|
118
|
+
const disabled = unavailable || port.disabled === true;
|
|
119
|
+
return (
|
|
120
|
+
<View
|
|
121
|
+
key={port.id}
|
|
122
|
+
style={{
|
|
123
|
+
alignItems: 'center',
|
|
124
|
+
flexDirection: 'row',
|
|
125
|
+
height: PORT_SIZE,
|
|
126
|
+
justifyContent: port.direction === 'input' ? 'flex-start' : 'flex-end',
|
|
127
|
+
}}
|
|
128
|
+
>
|
|
129
|
+
<Pressable
|
|
130
|
+
accessibilityHint={`Connect ${port.direction} port`}
|
|
131
|
+
accessibilityLabel={`${props.title}: ${port.label}`}
|
|
132
|
+
accessibilityRole="button"
|
|
133
|
+
accessibilityState={{ disabled }}
|
|
134
|
+
disabled={disabled || props.onPortPress === undefined}
|
|
135
|
+
style={{
|
|
136
|
+
alignItems: 'center',
|
|
137
|
+
height: PORT_SIZE,
|
|
138
|
+
justifyContent: 'center',
|
|
139
|
+
width: PORT_SIZE,
|
|
140
|
+
}}
|
|
141
|
+
testID={port.testID}
|
|
142
|
+
onPress={() => props.onPortPress?.(port.id)}
|
|
143
|
+
>
|
|
144
|
+
<View
|
|
145
|
+
accessible={false}
|
|
146
|
+
style={{
|
|
147
|
+
backgroundColor:
|
|
148
|
+
port.direction === 'input'
|
|
149
|
+
? theme.semantics.surface.default
|
|
150
|
+
: theme.semantics.brand.base,
|
|
151
|
+
borderColor:
|
|
152
|
+
port.direction === 'input'
|
|
153
|
+
? theme.semantics.brand.outline
|
|
154
|
+
: theme.semantics.brand.base,
|
|
155
|
+
borderRadius: 6,
|
|
156
|
+
borderWidth: 2,
|
|
157
|
+
height: 12,
|
|
158
|
+
width: 12,
|
|
159
|
+
}}
|
|
160
|
+
/>
|
|
161
|
+
</Pressable>
|
|
162
|
+
</View>
|
|
163
|
+
);
|
|
164
|
+
})}
|
|
165
|
+
</View>
|
|
166
|
+
) : null}
|
|
167
|
+
<View
|
|
168
|
+
pointerEvents="none"
|
|
169
|
+
style={{
|
|
170
|
+
borderColor: props.selected
|
|
171
|
+
? theme.semantics.selection.border
|
|
172
|
+
: theme.semantics.neutral.divider,
|
|
173
|
+
borderRadius: 12,
|
|
174
|
+
borderWidth: props.selected ? 2 : 1,
|
|
175
|
+
bottom: 0,
|
|
176
|
+
left: 0,
|
|
177
|
+
position: 'absolute',
|
|
178
|
+
right: 0,
|
|
179
|
+
top: 0,
|
|
180
|
+
}}
|
|
181
|
+
/>
|
|
182
|
+
</View>
|
|
183
|
+
);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/*** Translate responder events into controlled screen-pixel move and press callbacks. */
|
|
187
|
+
function useNodeDrag(props: GraphNodeProps) {
|
|
188
|
+
const scrollLock = useScrollGestureLock();
|
|
189
|
+
const propsRef = React.useRef(props);
|
|
190
|
+
React.useLayoutEffect(() => {
|
|
191
|
+
propsRef.current = props;
|
|
192
|
+
});
|
|
193
|
+
const cancelled = React.useRef(false);
|
|
194
|
+
const moved = React.useRef(false);
|
|
195
|
+
const handledByPointer = React.useRef(false);
|
|
196
|
+
const releaseScrollLock = React.useRef<(() => void) | undefined>(undefined);
|
|
197
|
+
const start = React.useRef<GraphNodePoint | null>(null);
|
|
198
|
+
const interactive = props.onMove !== undefined;
|
|
199
|
+
const handlers = interactive
|
|
200
|
+
? {
|
|
201
|
+
onResponderGrant: (event: ResponderEvent) => {
|
|
202
|
+
releaseScrollLock.current = scrollLock.acquire();
|
|
203
|
+
cancelled.current = false;
|
|
204
|
+
moved.current = false;
|
|
205
|
+
start.current = { x: event.nativeEvent.pageX, y: event.nativeEvent.pageY };
|
|
206
|
+
},
|
|
207
|
+
onResponderMove: (event: ResponderEvent) => {
|
|
208
|
+
const origin = start.current;
|
|
209
|
+
const { onMove, readOnly } = propsRef.current;
|
|
210
|
+
if (!origin || cancelled.current || readOnly) return;
|
|
211
|
+
const delta = {
|
|
212
|
+
x: event.nativeEvent.pageX - origin.x,
|
|
213
|
+
y: event.nativeEvent.pageY - origin.y,
|
|
214
|
+
};
|
|
215
|
+
if (Math.abs(delta.x) < DRAG_THRESHOLD && Math.abs(delta.y) < DRAG_THRESHOLD) return;
|
|
216
|
+
moved.current = true;
|
|
217
|
+
start.current = { x: event.nativeEvent.pageX, y: event.nativeEvent.pageY };
|
|
218
|
+
onMove?.(delta);
|
|
219
|
+
},
|
|
220
|
+
onResponderRelease: () => {
|
|
221
|
+
releaseScrollLock.current?.();
|
|
222
|
+
releaseScrollLock.current = undefined;
|
|
223
|
+
start.current = null;
|
|
224
|
+
handledByPointer.current = true;
|
|
225
|
+
const { onPress, readOnly } = propsRef.current;
|
|
226
|
+
if (cancelled.current || readOnly || moved.current) return;
|
|
227
|
+
onPress?.();
|
|
228
|
+
},
|
|
229
|
+
onResponderTerminate: () => {
|
|
230
|
+
releaseScrollLock.current?.();
|
|
231
|
+
releaseScrollLock.current = undefined;
|
|
232
|
+
cancelled.current = true;
|
|
233
|
+
start.current = null;
|
|
234
|
+
},
|
|
235
|
+
onResponderTerminationRequest: () => false,
|
|
236
|
+
onStartShouldSetResponderCapture: () =>
|
|
237
|
+
!propsRef.current.readOnly && !propsRef.current.disabled,
|
|
238
|
+
}
|
|
239
|
+
: undefined;
|
|
240
|
+
React.useEffect(
|
|
241
|
+
() => () => {
|
|
242
|
+
releaseScrollLock.current?.();
|
|
243
|
+
releaseScrollLock.current = undefined;
|
|
244
|
+
},
|
|
245
|
+
[],
|
|
246
|
+
);
|
|
247
|
+
const press = () => {
|
|
248
|
+
if (handledByPointer.current) {
|
|
249
|
+
handledByPointer.current = false;
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
propsRef.current.onPress?.();
|
|
253
|
+
};
|
|
254
|
+
return { handlers, press };
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
interface ResponderEvent {
|
|
258
|
+
readonly nativeEvent: { readonly pageX: number; readonly pageY: number };
|
|
259
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { expect, test } from 'bun:test';
|
|
2
|
+
|
|
3
|
+
import { getGraphNodePortGeometry } from './getGraphNodePortGeometry';
|
|
4
|
+
|
|
5
|
+
test('provides shared virtualized dimensions and anchors for GraphNode ports', () => {
|
|
6
|
+
expect(
|
|
7
|
+
getGraphNodePortGeometry({
|
|
8
|
+
ports: [
|
|
9
|
+
{ direction: 'input', id: 'input', label: 'Input' },
|
|
10
|
+
{ direction: 'output', id: 'output', label: 'Output' },
|
|
11
|
+
],
|
|
12
|
+
}),
|
|
13
|
+
).toEqual({
|
|
14
|
+
height: 120,
|
|
15
|
+
ports: [
|
|
16
|
+
{ anchor: { x: 26, y: 54 }, id: 'input' },
|
|
17
|
+
{ anchor: { x: 198, y: 98 }, id: 'output' },
|
|
18
|
+
],
|
|
19
|
+
width: 224,
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
test('uses the measured port section offset without changing horizontal anchors', () => {
|
|
24
|
+
expect(
|
|
25
|
+
getGraphNodePortGeometry({
|
|
26
|
+
ports: [{ direction: 'output', id: 'output', label: 'Output' }],
|
|
27
|
+
portsTop: 71,
|
|
28
|
+
width: 300,
|
|
29
|
+
}),
|
|
30
|
+
).toEqual({
|
|
31
|
+
height: 115,
|
|
32
|
+
ports: [{ anchor: { x: 274, y: 93 }, id: 'output' }],
|
|
33
|
+
width: 300,
|
|
34
|
+
});
|
|
35
|
+
});
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { GraphNodePoint, GraphNodePort } from '../../types/graph-node';
|
|
2
|
+
|
|
3
|
+
const DEFAULT_GRAPH_NODE_WIDTH = 224;
|
|
4
|
+
const DEFAULT_PORTS_TOP = 32;
|
|
5
|
+
const PORT_INSET = 4;
|
|
6
|
+
const PORT_SIZE = 44;
|
|
7
|
+
|
|
8
|
+
type GraphNodePortGeometry = Readonly<{
|
|
9
|
+
readonly anchor: GraphNodePoint;
|
|
10
|
+
readonly id: string;
|
|
11
|
+
}>;
|
|
12
|
+
|
|
13
|
+
/*** Resolves the canonical GraphNode port anchors and virtualized height from its rendered layout. */
|
|
14
|
+
export function getGraphNodePortGeometry(
|
|
15
|
+
input: Readonly<{
|
|
16
|
+
readonly ports: readonly GraphNodePort[];
|
|
17
|
+
readonly portsTop?: number;
|
|
18
|
+
readonly width?: number;
|
|
19
|
+
}>,
|
|
20
|
+
): Readonly<{
|
|
21
|
+
readonly height: number;
|
|
22
|
+
readonly ports: readonly GraphNodePortGeometry[];
|
|
23
|
+
readonly width: number;
|
|
24
|
+
}> {
|
|
25
|
+
const width = input.width ?? DEFAULT_GRAPH_NODE_WIDTH;
|
|
26
|
+
const portsTop = input.portsTop ?? DEFAULT_PORTS_TOP;
|
|
27
|
+
return {
|
|
28
|
+
height: portsTop + input.ports.length * PORT_SIZE,
|
|
29
|
+
ports: input.ports.map((port, index) => ({
|
|
30
|
+
anchor: {
|
|
31
|
+
x:
|
|
32
|
+
port.direction === 'input'
|
|
33
|
+
? PORT_INSET + PORT_SIZE / 2
|
|
34
|
+
: width - PORT_INSET - PORT_SIZE / 2,
|
|
35
|
+
y: portsTop + index * PORT_SIZE + PORT_SIZE / 2,
|
|
36
|
+
},
|
|
37
|
+
id: port.id,
|
|
38
|
+
})),
|
|
39
|
+
width,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { expect, test } from 'bun:test';
|
|
2
|
+
|
|
3
|
+
test('exposes the generic GraphNode through its public facade', async () => {
|
|
4
|
+
const facade = await Bun.file('src/features/graph-node/public.ts').text();
|
|
5
|
+
|
|
6
|
+
expect(facade).toContain("export { GraphNode } from './adapters/inbound/GraphNode';");
|
|
7
|
+
});
|