@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.
Files changed (323) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/README.md +1 -1
  3. package/dist/features/flow/adapters/inbound/FlowCanvas.d.ts +5 -0
  4. package/dist/features/flow/adapters/inbound/FlowCanvas.d.ts.map +1 -0
  5. package/dist/features/flow/adapters/inbound/FlowCanvas.js +261 -0
  6. package/dist/features/flow/adapters/inbound/FlowCanvas.js.map +1 -0
  7. package/dist/features/flow/application/createFlowEditorController.d.ts +13 -0
  8. package/dist/features/flow/application/createFlowEditorController.d.ts.map +1 -0
  9. package/dist/features/flow/application/createFlowEditorController.js +86 -0
  10. package/dist/features/flow/application/createFlowEditorController.js.map +1 -0
  11. package/dist/features/flow/application/getFlowPortAnchor.d.ts +10 -0
  12. package/dist/features/flow/application/getFlowPortAnchor.d.ts.map +1 -0
  13. package/dist/features/flow/application/getFlowPortAnchor.js +18 -0
  14. package/dist/features/flow/application/getFlowPortAnchor.js.map +1 -0
  15. package/dist/features/flow/application/mapFlowViewport.d.ts +10 -0
  16. package/dist/features/flow/application/mapFlowViewport.d.ts.map +1 -0
  17. package/dist/features/flow/application/mapFlowViewport.js +22 -0
  18. package/dist/features/flow/application/mapFlowViewport.js.map +1 -0
  19. package/dist/features/flow/public.d.ts +3 -0
  20. package/dist/features/flow/public.d.ts.map +1 -0
  21. package/dist/features/flow/public.js +2 -0
  22. package/dist/features/flow/public.js.map +1 -0
  23. package/dist/features/graph-node/adapters/inbound/GraphNode.d.ts +5 -0
  24. package/dist/features/graph-node/adapters/inbound/GraphNode.d.ts.map +1 -0
  25. package/dist/features/graph-node/adapters/inbound/GraphNode.js +190 -0
  26. package/dist/features/graph-node/adapters/inbound/GraphNode.js.map +1 -0
  27. package/dist/features/graph-node/getGraphNodePortGeometry.d.ts +17 -0
  28. package/dist/features/graph-node/getGraphNodePortGeometry.d.ts.map +1 -0
  29. package/dist/features/graph-node/getGraphNodePortGeometry.js +23 -0
  30. package/dist/features/graph-node/getGraphNodePortGeometry.js.map +1 -0
  31. package/dist/features/graph-node/public.d.ts +3 -0
  32. package/dist/features/graph-node/public.d.ts.map +1 -0
  33. package/dist/features/graph-node/public.js +2 -0
  34. package/dist/features/graph-node/public.js.map +1 -0
  35. package/dist/features/grid-view/adapters/inbound/GridView.d.ts +1 -1
  36. package/dist/features/grid-view/adapters/inbound/GridView.d.ts.map +1 -1
  37. package/dist/features/grid-view/adapters/inbound/GridView.js +105 -41
  38. package/dist/features/grid-view/adapters/inbound/GridView.js.map +1 -1
  39. package/dist/features/grid-view/application/createGridScrollSync.d.ts +2 -5
  40. package/dist/features/grid-view/application/createGridScrollSync.d.ts.map +1 -1
  41. package/dist/features/grid-view/application/createGridScrollSync.js +109 -45
  42. package/dist/features/grid-view/application/createGridScrollSync.js.map +1 -1
  43. package/dist/features/grid-view/public.d.ts +1 -1
  44. package/dist/features/grid-view/public.d.ts.map +1 -1
  45. package/dist/features/grid-view/public.js.map +1 -1
  46. package/dist/features/layout/utils/createScrollGestureLock.d.ts.map +1 -1
  47. package/dist/features/layout/utils/createScrollGestureLock.js +4 -0
  48. package/dist/features/layout/utils/createScrollGestureLock.js.map +1 -1
  49. package/dist/features/theme/node.d.ts +5 -0
  50. package/dist/features/theme/node.d.ts.map +1 -0
  51. package/dist/features/theme/node.js +4 -0
  52. package/dist/features/theme/node.js.map +1 -0
  53. package/dist/features/theme/public.d.ts +2 -0
  54. package/dist/features/theme/public.d.ts.map +1 -1
  55. package/dist/features/theme/public.js +1 -0
  56. package/dist/features/theme/public.js.map +1 -1
  57. package/dist/types/flow.d.ts +81 -0
  58. package/dist/types/flow.d.ts.map +1 -0
  59. package/dist/types/flow.js +2 -0
  60. package/dist/types/flow.js.map +1 -0
  61. package/dist/types/graph-node.d.ts +42 -0
  62. package/dist/types/graph-node.d.ts.map +1 -0
  63. package/dist/types/graph-node.js +2 -0
  64. package/dist/types/graph-node.js.map +1 -0
  65. package/dist/types/grid-view.d.ts +27 -3
  66. package/dist/types/grid-view.d.ts.map +1 -1
  67. package/dist/types/grid-view.js.map +1 -1
  68. package/dist/types/layout.d.ts +2 -0
  69. package/dist/types/layout.d.ts.map +1 -1
  70. package/dist/types/layout.js.map +1 -1
  71. package/package.json +21 -3
  72. package/src/features/flow/adapters/inbound/FlowCanvas.tsx +501 -0
  73. package/src/features/flow/application/createFlowEditorController.test.ts +146 -0
  74. package/src/features/flow/application/createFlowEditorController.ts +99 -0
  75. package/src/features/flow/application/getFlowPortAnchor.test.ts +23 -0
  76. package/src/features/flow/application/getFlowPortAnchor.ts +30 -0
  77. package/src/features/flow/application/mapFlowViewport.test.ts +11 -0
  78. package/src/features/flow/application/mapFlowViewport.ts +29 -0
  79. package/src/features/flow/public.test.ts +7 -0
  80. package/src/features/flow/public.ts +13 -0
  81. package/src/features/graph-node/adapters/inbound/GraphNode.test.tsx +80 -0
  82. package/src/features/graph-node/adapters/inbound/GraphNode.tsx +259 -0
  83. package/src/features/graph-node/getGraphNodePortGeometry.test.ts +35 -0
  84. package/src/features/graph-node/getGraphNodePortGeometry.ts +41 -0
  85. package/src/features/graph-node/public.test.ts +7 -0
  86. package/src/features/graph-node/public.ts +2 -0
  87. package/src/features/grid-view/adapters/inbound/GridView.nativeScrollSync.test.tsx +198 -7
  88. package/src/features/grid-view/adapters/inbound/GridView.tsx +248 -145
  89. package/src/features/grid-view/application/createGridScrollSync.test.ts +46 -17
  90. package/src/features/grid-view/application/createGridScrollSync.ts +100 -43
  91. package/src/features/grid-view/public.ts +6 -1
  92. package/src/features/layout/utils/createScrollGestureLock.ts +4 -0
  93. package/src/features/theme/application/use-cases/compileZoraTheme.test.ts +1 -1
  94. package/src/features/theme/node.ts +18 -0
  95. package/src/features/theme/public.ts +7 -0
  96. package/src/platformAcceptance.test.ts +15 -11
  97. package/src/types/flow.ts +99 -0
  98. package/src/types/graph-node.ts +45 -0
  99. package/src/types/grid-view.ts +25 -3
  100. package/src/types/layout.ts +2 -0
  101. package/web-dist/chunks/{Accordion-9dq115tn.js → Accordion-064hgrct.js} +3 -3
  102. package/web-dist/chunks/{Accordion-wbf7gqrm.js → Accordion-2b3sd76b.js} +3 -3
  103. package/web-dist/chunks/{Accordion-k9n1yse4.js → Accordion-2kv6p7by.js} +10 -38
  104. package/web-dist/chunks/{Accordion-6gc0jw1n.js → Accordion-5x4cv0kv.js} +1 -1
  105. package/web-dist/chunks/{Accordion-r8swmfjm.js → Accordion-6d63tc7d.js} +1 -1
  106. package/web-dist/chunks/{Accordion-vbz1mjm6.js → Accordion-7eysykr1.js} +4 -4
  107. package/web-dist/chunks/{Accordion-59x6e7bs.js → Accordion-91qf4q27.js} +1 -1
  108. package/web-dist/chunks/{Accordion-hadw5304.js → Accordion-98886mbn.js} +1 -1
  109. package/web-dist/chunks/{Accordion-vtbs98r4.js → Accordion-a0hbjxg9.js} +4 -4
  110. package/web-dist/chunks/{Accordion-73p2mg3h.js → Accordion-a49s4ywn.js} +4 -4
  111. package/web-dist/chunks/{Accordion-tb0vc91c.js → Accordion-a8b6g53f.js} +4 -4
  112. package/web-dist/chunks/{Accordion-25v2vczc.js → Accordion-afxbyvwp.js} +3 -3
  113. package/web-dist/chunks/{Accordion-g5pvs1aa.js → Accordion-ajqj6ymg.js} +5 -5
  114. package/web-dist/chunks/{Accordion-w2kx944a.js → Accordion-ak6dvant.js} +3 -3
  115. package/web-dist/chunks/{Accordion-778fjjsh.js → Accordion-b1tqkxx6.js} +3 -3
  116. package/web-dist/chunks/{Accordion-rp9cjtpg.js → Accordion-bm30dkbw.js} +2 -2
  117. package/web-dist/chunks/{Accordion-rsw5jt7m.js → Accordion-cah5j61y.js} +2 -2
  118. package/web-dist/chunks/{Accordion-pr1tv6jx.js → Accordion-dfr26j8m.js} +1 -1
  119. package/web-dist/chunks/{Accordion-zmrbktd8.js → Accordion-dnfgtbq3.js} +8 -8
  120. package/web-dist/chunks/{Accordion-m3tq2vcc.js → Accordion-dy1j2a7p.js} +6 -6
  121. package/web-dist/chunks/{Accordion-7pgh8q4h.js → Accordion-e9jwetg7.js} +2 -2
  122. package/web-dist/chunks/{Accordion-gnkzvj03.js → Accordion-e9xmwxzp.js} +1 -1
  123. package/web-dist/chunks/{Accordion-q8ymmar7.js → Accordion-ek0hh2nx.js} +4 -4
  124. package/web-dist/chunks/{Accordion-2berhsg5.js → Accordion-et7xzm6k.js} +9 -9
  125. package/web-dist/chunks/Accordion-eysfka31.js +1590 -0
  126. package/web-dist/chunks/{Accordion-3xfqmr1r.js → Accordion-gy3bx3xa.js} +2 -2
  127. package/web-dist/chunks/{Accordion-tj4fe6wk.js → Accordion-h2rnzgyv.js} +3 -3
  128. package/web-dist/chunks/Accordion-hbwhya78.js +83 -0
  129. package/web-dist/chunks/{Accordion-t9w365ke.js → Accordion-hbwyj12m.js} +1 -1
  130. package/web-dist/chunks/{Accordion-q2yxtdzc.js → Accordion-j3esnt3f.js} +6 -6
  131. package/web-dist/chunks/Accordion-jkgd7dmf.js +1 -0
  132. package/web-dist/chunks/{Accordion-qwftammh.js → Accordion-kxjjp03t.js} +5 -5
  133. package/web-dist/chunks/Accordion-mkd3k28h.js +275 -0
  134. package/web-dist/chunks/{Accordion-xqkkfwkm.js → Accordion-nhf8zjt4.js} +2 -2
  135. package/web-dist/chunks/{Accordion-hg4db1sk.js → Accordion-p84h11ek.js} +4 -4
  136. package/web-dist/chunks/{Accordion-zhgty1ae.js → Accordion-pagdkp07.js} +3 -3
  137. package/web-dist/chunks/{Accordion-dv5c27w4.js → Accordion-pjbmmr20.js} +1 -1
  138. package/web-dist/chunks/{Accordion-7ayxbm7k.js → Accordion-pr4a281g.js} +1 -1
  139. package/web-dist/chunks/{Accordion-yca8r7kx.js → Accordion-qz6ddnmv.js} +3 -3
  140. package/web-dist/chunks/{Accordion-dcjzxzv3.js → Accordion-rv90tjqr.js} +2 -2
  141. package/web-dist/chunks/{Accordion-0zk0xp73.js → Accordion-snk6nggm.js} +326 -174
  142. package/web-dist/chunks/{Accordion-casb2ndy.js → Accordion-th7yhwhf.js} +5 -5
  143. package/web-dist/chunks/{Accordion-e6ettgh0.js → Accordion-vbh3xqv6.js} +2 -2
  144. package/web-dist/chunks/{Accordion-vdzyhtyd.js → Accordion-w4zh2nws.js} +8 -8
  145. package/web-dist/chunks/Accordion-w8zke8fa.js +37 -0
  146. package/web-dist/chunks/{Accordion-3e60xwvy.js → Accordion-wkqemqjw.js} +1 -1
  147. package/web-dist/chunks/{Accordion-vwqf8kn1.js → Accordion-x9sb23p3.js} +3 -3
  148. package/web-dist/chunks/{Accordion-xhkphta6.js → Accordion-y6sg47rv.js} +1 -1
  149. package/web-dist/chunks/{Accordion-mw8zh0vs.js → Accordion-yannd7r3.js} +4 -4
  150. package/web-dist/chunks/{Accordion-457amtv7.js → Accordion-z3m3wvfz.js} +6 -1580
  151. package/web-dist/chunks/{Accordion-pvcdvh3w.js → Accordion-zagrbkq1.js} +2 -2
  152. package/web-dist/chunks/{Accordion-2jcas7qq.js → Accordion-zays65re.js} +5 -5
  153. package/web-dist/chunks/{RichTextClient-w75r2x97.js → RichTextClient-qd6gmm0x.js} +12 -11
  154. package/web-dist/chunks/{Video.native-bb9g33nd.js → Video.native-7zsbp5vg.js} +7 -6
  155. package/web-dist/components/accordion/Accordion.js +6 -5
  156. package/web-dist/components/accordion-item/AccordionItem.js +6 -5
  157. package/web-dist/components/activity-indicator/ActivityIndicator.js +1 -1
  158. package/web-dist/components/app-bar/AppBar.js +8 -7
  159. package/web-dist/components/app-header/AppHeader.js +8 -7
  160. package/web-dist/components/app-shell/AppShell.js +3 -2
  161. package/web-dist/components/audio/Audio.js +6 -5
  162. package/web-dist/components/auth-screen/AuthScreen.js +11 -10
  163. package/web-dist/components/avatar/Avatar.js +6 -5
  164. package/web-dist/components/avatar-group/AvatarGroup.js +6 -5
  165. package/web-dist/components/badge/Badge.js +2 -2
  166. package/web-dist/components/barcode-scanner-view/BarcodeScannerView.js +11 -10
  167. package/web-dist/components/bottom-sheet/BottomSheet.js +4 -3
  168. package/web-dist/components/bottom-sheet-flat-list/BottomSheetFlatList.js +4 -3
  169. package/web-dist/components/bottom-sheet-scroll-view/BottomSheetScrollView.js +4 -3
  170. package/web-dist/components/bottom-sheet-section-list/BottomSheetSectionList.js +4 -3
  171. package/web-dist/components/bottom-sheet-view/BottomSheetView.js +4 -3
  172. package/web-dist/components/bottom-sheet-virtualized-list/BottomSheetVirtualizedList.js +4 -3
  173. package/web-dist/components/breadcrumbs/Breadcrumbs.js +6 -5
  174. package/web-dist/components/button/Button.js +4 -3
  175. package/web-dist/components/button-group/ButtonGroup.js +4 -3
  176. package/web-dist/components/calendar/Calendar.js +8 -7
  177. package/web-dist/components/camera-permission-view/CameraPermissionView.js +11 -10
  178. package/web-dist/components/card/Card.js +10 -9
  179. package/web-dist/components/card-back/CardBack.js +2 -2
  180. package/web-dist/components/card-hand/CardHand.js +2 -2
  181. package/web-dist/components/chat-list-item/ChatListItem.js +8 -7
  182. package/web-dist/components/checkbox/Checkbox.js +5 -4
  183. package/web-dist/components/checkbox-group/CheckboxGroup.js +5 -4
  184. package/web-dist/components/chess-board/ChessBoard.js +4 -3
  185. package/web-dist/components/chip/Chip.js +6 -5
  186. package/web-dist/components/chip-group/ChipGroup.js +6 -5
  187. package/web-dist/components/collection-editor/CollectionEditor.js +10 -9
  188. package/web-dist/components/color-hue-scale/ColorHueScale.js +17 -15
  189. package/web-dist/components/color-picker/ColorPicker.js +17 -15
  190. package/web-dist/components/color-tone/ColorTone.js +17 -15
  191. package/web-dist/components/color-wheel/ColorWheel.js +17 -15
  192. package/web-dist/components/content-rail/ContentRail.js +5 -4
  193. package/web-dist/components/data-table/DataTable.js +16 -15
  194. package/web-dist/components/date-picker/DatePicker.js +10 -9
  195. package/web-dist/components/dialog/Dialog.js +5 -4
  196. package/web-dist/components/divider/Divider.js +3 -2
  197. package/web-dist/components/empty-state/EmptyState.js +11 -10
  198. package/web-dist/components/explorer/Explorer.js +8 -7
  199. package/web-dist/components/field/Field.js +5 -4
  200. package/web-dist/components/file-explorer/FileExplorer.js +8 -7
  201. package/web-dist/components/flat-list/FlatList.js +6 -5
  202. package/web-dist/components/flow-canvas/FlowCanvas.d.ts +7 -0
  203. package/web-dist/components/flow-canvas/FlowCanvas.dependency-0.d.ts +27 -0
  204. package/web-dist/components/flow-canvas/FlowCanvas.dependency-1.d.ts +3 -0
  205. package/web-dist/components/flow-canvas/FlowCanvas.js +513 -0
  206. package/web-dist/components/flow-canvas/FlowCanvas.types-0.d.ts +92 -0
  207. package/web-dist/components/flow-canvas/index.d.ts +2 -0
  208. package/web-dist/components/flow-canvas/index.js +2 -0
  209. package/web-dist/components/forgot-password-form/ForgotPasswordForm.js +11 -10
  210. package/web-dist/components/form/Form.js +7 -6
  211. package/web-dist/components/form-actions/FormActions.js +7 -6
  212. package/web-dist/components/form-error/FormError.js +7 -6
  213. package/web-dist/components/game/Game.js +4 -3
  214. package/web-dist/components/game-entity/GameEntity.js +4 -3
  215. package/web-dist/components/game-field/GameField.js +4 -3
  216. package/web-dist/components/game-input-zone/GameInputZone.js +4 -3
  217. package/web-dist/components/game-measurement-probe/GameMeasurementProbe.js +4 -3
  218. package/web-dist/components/game-overlay/GameOverlay.js +4 -3
  219. package/web-dist/components/gradient/Gradient.js +4 -3
  220. package/web-dist/components/gradient-renderer-provider/GradientRendererProvider.js +4 -3
  221. package/web-dist/components/graph-node/GraphNode.d.ts +7 -0
  222. package/web-dist/components/graph-node/GraphNode.dependency-0.d.ts +27 -0
  223. package/web-dist/components/graph-node/GraphNode.dependency-1.d.ts +3 -0
  224. package/web-dist/components/graph-node/GraphNode.dependency-2.d.ts +5 -0
  225. package/web-dist/components/graph-node/GraphNode.js +20 -0
  226. package/web-dist/components/graph-node/GraphNode.types-0.d.ts +46 -0
  227. package/web-dist/components/graph-node/index.d.ts +2 -0
  228. package/web-dist/components/graph-node/index.js +2 -0
  229. package/web-dist/components/grid/Grid.js +3 -2
  230. package/web-dist/components/grid-line-overlay/GridLineOverlay.js +2 -2
  231. package/web-dist/components/grid-ruler/GridRuler.js +2 -2
  232. package/web-dist/components/grid-view/GridView.d.ts +1 -1
  233. package/web-dist/components/grid-view/GridView.js +2 -1
  234. package/web-dist/components/grid-view/GridView.types-0.d.ts +21 -0
  235. package/web-dist/components/heading/Heading.js +2 -2
  236. package/web-dist/components/hero/Hero.js +10 -9
  237. package/web-dist/components/icon/Icon.js +2 -2
  238. package/web-dist/components/icon-button/IconButton.js +4 -3
  239. package/web-dist/components/image/Image.js +5 -4
  240. package/web-dist/components/keyboard-avoiding-view/KeyboardAvoidingView.js +2 -2
  241. package/web-dist/components/link/Link.js +2 -2
  242. package/web-dist/components/list/List.js +6 -5
  243. package/web-dist/components/list-item/ListItem.js +6 -5
  244. package/web-dist/components/list-section/ListSection.js +6 -5
  245. package/web-dist/components/master-detail/MasterDetail.js +3 -2
  246. package/web-dist/components/matrix-grid/MatrixGrid.js +5 -4
  247. package/web-dist/components/media-card/MediaCard.js +10 -9
  248. package/web-dist/components/media-explorer/MediaExplorer.js +8 -7
  249. package/web-dist/components/message-bubble/MessageBubble.js +8 -7
  250. package/web-dist/components/metric-card/MetricCard.js +10 -9
  251. package/web-dist/components/missing-element/MissingElement.js +5 -4
  252. package/web-dist/components/o-auth-provider-button/OAuthProviderButton.js +11 -10
  253. package/web-dist/components/o-auth-provider-list/OAuthProviderList.js +11 -10
  254. package/web-dist/components/opening-book/OpeningBook.js +4 -3
  255. package/web-dist/components/otp-form/OtpForm.js +11 -10
  256. package/web-dist/components/pagination/Pagination.js +5 -4
  257. package/web-dist/components/palette-item/PaletteItem.js +10 -9
  258. package/web-dist/components/playing-card/PlayingCard.js +2 -2
  259. package/web-dist/components/poker-training-table/PokerTrainingTable.js +2 -2
  260. package/web-dist/components/popover/Popover.js +1 -1
  261. package/web-dist/components/popover-menu/PopoverMenu.js +5 -4
  262. package/web-dist/components/post-card/PostCard.js +10 -9
  263. package/web-dist/components/product-card/ProductCard.js +10 -9
  264. package/web-dist/components/progress/Progress.js +5 -4
  265. package/web-dist/components/progress-ring/ProgressRing.js +5 -4
  266. package/web-dist/components/radio/Radio.js +6 -5
  267. package/web-dist/components/radio-group/RadioGroup.js +6 -5
  268. package/web-dist/components/rating/Rating.js +4 -3
  269. package/web-dist/components/reader/Reader.js +11 -10
  270. package/web-dist/components/rich-text/RichText.js +3 -3
  271. package/web-dist/components/runtime-authoring-overlay/RuntimeAuthoringOverlay.js +4 -3
  272. package/web-dist/components/scan-overlay/ScanOverlay.js +11 -10
  273. package/web-dist/components/screen/Screen.js +3 -2
  274. package/web-dist/components/screen-section/ScreenSection.js +5 -4
  275. package/web-dist/components/scroll-view/ScrollView.js +3 -2
  276. package/web-dist/components/search-input/SearchInput.js +6 -5
  277. package/web-dist/components/section-header/SectionHeader.js +5 -4
  278. package/web-dist/components/section-list/SectionList.js +6 -5
  279. package/web-dist/components/select/Select.js +11 -10
  280. package/web-dist/components/selectable-item/SelectableItem.js +4 -3
  281. package/web-dist/components/selection-provider/SelectionProvider.js +4 -3
  282. package/web-dist/components/sign-in-form/SignInForm.js +11 -10
  283. package/web-dist/components/sign-up-form/SignUpForm.js +11 -10
  284. package/web-dist/components/skeleton/Skeleton.js +13 -12
  285. package/web-dist/components/skeleton-card/SkeletonCard.js +13 -12
  286. package/web-dist/components/skeleton-list/SkeletonList.js +13 -12
  287. package/web-dist/components/skeleton-text/SkeletonText.js +13 -12
  288. package/web-dist/components/spatial-grid/SpatialGrid.js +2 -1
  289. package/web-dist/components/surface/Surface.js +2 -2
  290. package/web-dist/components/switch/Switch.js +1 -1
  291. package/web-dist/components/tab/Tab.js +2 -2
  292. package/web-dist/components/tab-list/TabList.js +2 -2
  293. package/web-dist/components/tab-panel/TabPanel.js +2 -2
  294. package/web-dist/components/tabletop-table/TabletopTable.js +2 -2
  295. package/web-dist/components/tabs/Tabs.js +2 -2
  296. package/web-dist/components/text/Text.js +2 -2
  297. package/web-dist/components/text-input/TextInput.js +5 -4
  298. package/web-dist/components/theme-mode-toggle/ThemeModeToggle.js +4 -3
  299. package/web-dist/components/tile-grid/TileGrid.js +2 -1
  300. package/web-dist/components/time-grid/TimeGrid.js +3 -2
  301. package/web-dist/components/time-picker/TimePicker.js +7 -6
  302. package/web-dist/components/timeline/Timeline.js +6 -5
  303. package/web-dist/components/toast/Toast.js +2 -2
  304. package/web-dist/components/toast-provider/ToastProvider.js +2 -2
  305. package/web-dist/components/toolbar/Toolbar.js +11 -10
  306. package/web-dist/components/tree-item/TreeItem.js +9 -8
  307. package/web-dist/components/uploader/Uploader.js +13 -12
  308. package/web-dist/components/video/Video.js +7 -6
  309. package/web-dist/components/view/View.js +3 -2
  310. package/web-dist/components/zora-provider/ZoraProvider.d.ts +7 -0
  311. package/web-dist/components/zora-provider/ZoraProvider.dependency-0.d.ts +15 -0
  312. package/web-dist/components/zora-provider/ZoraProvider.js +11 -0
  313. package/web-dist/components/zora-provider/ZoraProvider.types-0.d.ts +19 -0
  314. package/web-dist/components/zora-provider/index.d.ts +2 -0
  315. package/web-dist/components/zora-provider/index.js +2 -0
  316. package/web-dist/components/zora-theme-scope/ZoraThemeScope.d.ts +14 -0
  317. package/web-dist/components/zora-theme-scope/ZoraThemeScope.js +11 -0
  318. package/web-dist/components/zora-theme-scope/ZoraThemeScope.types-0.d.ts +3 -0
  319. package/web-dist/components/zora-theme-scope/index.d.ts +2 -0
  320. package/web-dist/components/zora-theme-scope/index.js +2 -0
  321. package/web-dist/components/zora-web-style-sheet/ZoraWebStyleSheet.js +3 -2
  322. package/web-dist/manifest.json +1058 -832
  323. package/web-dist/runtime/ZoraProvider.js +4 -80
@@ -0,0 +1,501 @@
1
+ import {
2
+ type GridPoint,
3
+ type GridRect,
4
+ type GridRectItem,
5
+ type GridViewport,
6
+ type GridViewportConstraints,
7
+ viewportToWorld,
8
+ } from '@ankhorage/grid-view';
9
+ import React from 'react';
10
+ import { Pressable, Text, View } from 'react-native';
11
+ import Svg, { Path } from 'react-native-svg';
12
+
13
+ import type {
14
+ FlowCanvasProps,
15
+ FlowNodeData,
16
+ FlowPoint,
17
+ FlowPortAddress,
18
+ } from '../../../../types/flow';
19
+ import type { GridWorldLayerContext } from '../../../../types/grid-view';
20
+ import { getGraphNodePortGeometry } from '../../../graph-node/getGraphNodePortGeometry';
21
+ import { GraphNode } from '../../../graph-node/public';
22
+ import { GridView } from '../../../grid-view/public';
23
+ import { withZoraThemeScope } from '../../../theme/adapters/inbound/withZoraThemeScope';
24
+ import { useZoraTheme } from '../../../theme/composition/useZoraTheme';
25
+ import { createFlowEditorController } from '../../application/createFlowEditorController';
26
+ import {
27
+ getDeterministicFlowNodeHeight,
28
+ getDeterministicFlowPortAnchor,
29
+ getFlowPortAnchor,
30
+ getFlowPortAnchorKey,
31
+ } from '../../application/getFlowPortAnchor';
32
+ import { flowViewportToGrid, gridViewportToFlow } from '../../application/mapFlowViewport';
33
+
34
+ const WORLD_PADDING = 2000;
35
+
36
+ /** Render the controlled, accessible process-editor canvas shared by React Native and React Native Web. */
37
+ export const FlowCanvas = withZoraThemeScope(FlowCanvasInner);
38
+
39
+ /** Compose controlled flow interactions on the canonical GridView viewport. */
40
+ function FlowCanvasInner(props: FlowCanvasProps) {
41
+ const propsRef = React.useRef(props);
42
+ const controllerRef = React.useRef(createFlowEditorController(props));
43
+ const pendingSourceRef = React.useRef<FlowPortAddress | null>(null);
44
+ React.useLayoutEffect(() => {
45
+ propsRef.current = props;
46
+ controllerRef.current = createFlowEditorController(props);
47
+ }, [props]);
48
+ const [localAnchors, setLocalAnchors] = React.useState<ReadonlyMap<string, FlowPoint>>(new Map());
49
+ const [nodeHeights, setNodeHeights] = React.useState<ReadonlyMap<string, number>>(new Map());
50
+ const [size, setSize] = React.useState({ height: 0, width: 0 });
51
+ const { theme } = useZoraTheme();
52
+ const selectedNodeIdSet = React.useMemo(
53
+ () => new Set(props.selectedNodeIds ?? []),
54
+ [props.selectedNodeIds],
55
+ );
56
+ const minZoom = props.minZoom ?? 0.5;
57
+ const maxZoom = props.maxZoom ?? 2;
58
+ const gridViewport = React.useMemo(
59
+ () => flowViewportToGrid(props.viewport, size),
60
+ [props.viewport, size],
61
+ );
62
+ const items = React.useMemo(
63
+ (): readonly GridRectItem[] =>
64
+ props.nodes.map((node) => ({
65
+ height: nodeHeights.get(node.id) ?? getDeterministicFlowNodeHeight(node),
66
+ id: node.id,
67
+ width: getGraphNodePortGeometry({ ports: node.ports }).width,
68
+ x: node.position.x,
69
+ y: node.position.y,
70
+ })),
71
+ [nodeHeights, props.nodes],
72
+ );
73
+ const world = React.useMemo(() => createWorldBounds(items, gridViewport), [gridViewport, items]);
74
+ const constraints = React.useMemo((): GridViewportConstraints => ({ world }), [world]);
75
+ const nodeById = React.useMemo(
76
+ () => new Map(props.nodes.map((node) => [node.id, node])),
77
+ [props.nodes],
78
+ );
79
+ const selectPort = React.useCallback((address: FlowPortAddress) => {
80
+ const { current } = propsRef;
81
+ const port = current.nodes
82
+ .find((node) => node.id === address.nodeId)
83
+ ?.ports.find((item) => item.id === address.portId);
84
+ if (!port || current.readOnly) return;
85
+ const pendingSource = pendingSourceRef.current;
86
+ if (pendingSource === null) {
87
+ if (port.direction === 'output') pendingSourceRef.current = address;
88
+ return;
89
+ }
90
+ const rejection = controllerRef.current.connect(pendingSource, address);
91
+ if (rejection) current.onConnectionRejected?.(pendingSource, address, rejection);
92
+ pendingSourceRef.current = null;
93
+ }, []);
94
+ const setZoom = React.useCallback(
95
+ (zoom: number) => {
96
+ const { current } = propsRef;
97
+ controllerRef.current.setViewport({
98
+ ...current.viewport,
99
+ zoom: Math.max(minZoom, Math.min(maxZoom, zoom)),
100
+ });
101
+ },
102
+ [maxZoom, minZoom],
103
+ );
104
+ const setPortAnchor = React.useCallback((address: FlowPortAddress, anchor: FlowPoint) => {
105
+ const key = getFlowPortAnchorKey(address);
106
+ setLocalAnchors((current) => {
107
+ const previous = current.get(key);
108
+ if (previous?.x === anchor.x && previous.y === anchor.y) return current;
109
+ return new Map(current).set(key, anchor);
110
+ });
111
+ }, []);
112
+ const setNodeHeight = React.useCallback((nodeId: string, height: number) => {
113
+ setNodeHeights((current) =>
114
+ current.get(nodeId) === height ? current : new Map(current).set(nodeId, height),
115
+ );
116
+ }, []);
117
+ const publishViewport = React.useCallback(
118
+ (next: GridViewport) => controllerRef.current.setViewport(gridViewportToFlow(next)),
119
+ [],
120
+ );
121
+ const viewportRef = React.useRef(gridViewport);
122
+ React.useLayoutEffect(() => {
123
+ viewportRef.current = gridViewport;
124
+ }, [gridViewport]);
125
+ const moveNode = React.useCallback((nodeId: string, delta: GridPoint) => {
126
+ const grid = viewportRef.current;
127
+ const origin = viewportToWorld({ x: 0, y: 0 }, grid);
128
+ const target = viewportToWorld(delta, grid);
129
+ controllerRef.current.moveNode(nodeId, { x: target.x - origin.x, y: target.y - origin.y });
130
+ }, []);
131
+ const disconnect = React.useCallback(
132
+ (connectionId: string) => propsRef.current.onDisconnect?.(connectionId),
133
+ [],
134
+ );
135
+ /*** Request deletion from the controlled host for the current selection. */
136
+ const deleteSelectedNodes = React.useCallback(
137
+ () => controllerRef.current.deleteNodes(propsRef.current.selectedNodeIds ?? []),
138
+ [],
139
+ );
140
+ const renderNode = (item: GridRectItem) => {
141
+ const node = nodeById.get(item.id);
142
+ if (!node) return null;
143
+ const selected = selectedNodeIdSet.has(node.id);
144
+ return (
145
+ <View
146
+ style={{
147
+ transform: [{ scale: props.viewport.zoom }],
148
+ transformOrigin: 'top left',
149
+ width: getGraphNodePortGeometry({ ports: node.ports }).width,
150
+ }}
151
+ onLayout={(event) => setNodeHeight(node.id, event.nativeEvent.layout.height)}
152
+ >
153
+ <GraphNode
154
+ description={node.description}
155
+ disabled={node.disabled}
156
+ ports={node.ports.map((port) => ({
157
+ ...port,
158
+ testID: `flow-port-${node.id}-${port.id}`,
159
+ }))}
160
+ readOnly={props.readOnly === true}
161
+ selected={selected}
162
+ testID={`flow-node-${node.id}`}
163
+ title={node.title}
164
+ width={getGraphNodePortGeometry({ ports: node.ports }).width}
165
+ onMove={(delta) => moveNode(node.id, delta)}
166
+ onPortLayout={(portId, anchor) => setPortAnchor({ nodeId: node.id, portId }, anchor)}
167
+ onPortPress={(portId) => selectPort({ nodeId: node.id, portId })}
168
+ onPress={() => controllerRef.current.selectNode(node.id)}
169
+ >
170
+ {props.renderNode?.(node, { selected })}
171
+ </GraphNode>
172
+ </View>
173
+ );
174
+ };
175
+
176
+ return (
177
+ <View
178
+ style={{
179
+ backgroundColor: theme.semantics.neutral.surfaceHover,
180
+ borderColor: theme.semantics.neutral.divider,
181
+ borderRadius: 14,
182
+ borderWidth: 1,
183
+ flex: 1,
184
+ minHeight: 360,
185
+ overflow: 'hidden',
186
+ }}
187
+ testID={props.testID}
188
+ >
189
+ <FlowToolbar
190
+ canRedo={props.canRedo === true}
191
+ canUndo={props.canUndo === true}
192
+ canDelete={(props.selectedNodeIds?.length ?? 0) > 0}
193
+ readOnly={props.readOnly === true}
194
+ onDelete={deleteSelectedNodes}
195
+ onRedo={props.onRedo}
196
+ onUndo={props.onUndo}
197
+ onZoomIn={() => setZoom(props.viewport.zoom + 0.1)}
198
+ onZoomOut={() => setZoom(props.viewport.zoom - 0.1)}
199
+ />
200
+ <View
201
+ onLayout={(event) =>
202
+ setSize({
203
+ height: Math.round(event.nativeEvent.layout.height),
204
+ width: Math.round(event.nativeEvent.layout.width),
205
+ })
206
+ }
207
+ testID={props.testID ? `${props.testID}-viewport` : undefined}
208
+ style={{ backgroundColor: theme.semantics.surface.default, flex: 1, minHeight: 300 }}
209
+ >
210
+ {size.width > 0 && size.height > 0 ? (
211
+ <GridView
212
+ contentHeight={world.height}
213
+ contentWidth={world.width}
214
+ height={size.height}
215
+ items={items}
216
+ renderItem={renderNode}
217
+ renderWorldLayer={(layer) => (
218
+ <FlowEdges
219
+ anchors={localAnchors}
220
+ connections={props.connections}
221
+ layer={layer}
222
+ nodes={nodeById}
223
+ readOnly={props.readOnly === true}
224
+ onDisconnect={disconnect}
225
+ />
226
+ )}
227
+ testID={props.testID ? `${props.testID}-grid` : undefined}
228
+ viewport={gridViewport}
229
+ viewportConstraints={constraints}
230
+ viewportControls="hidden"
231
+ width={size.width}
232
+ zoomLimits={{ maxX: maxZoom, maxY: maxZoom, minX: minZoom, minY: minZoom }}
233
+ onViewportChange={publishViewport}
234
+ />
235
+ ) : null}
236
+ </View>
237
+ <FlowPalette
238
+ items={props.paletteItems}
239
+ readOnly={props.readOnly === true}
240
+ onInsert={props.onInsert}
241
+ />
242
+ </View>
243
+ );
244
+ }
245
+
246
+ /** Bound the world to the nodes plus generous space and always include the supplied viewport. */
247
+ function createWorldBounds(items: readonly GridRectItem[], viewport: GridViewport): GridRect {
248
+ const visibleWidth = viewport.width / viewport.pixelsPerUnitX;
249
+ const visibleHeight = viewport.height / viewport.pixelsPerUnitY;
250
+ let minX = viewport.offsetX;
251
+ let minY = viewport.offsetY;
252
+ let maxX = viewport.offsetX + visibleWidth;
253
+ let maxY = viewport.offsetY + visibleHeight;
254
+ for (const item of items) {
255
+ minX = Math.min(minX, item.x - WORLD_PADDING);
256
+ minY = Math.min(minY, item.y - WORLD_PADDING);
257
+ maxX = Math.max(maxX, item.x + item.width + WORLD_PADDING);
258
+ maxY = Math.max(maxY, item.y + item.height + WORLD_PADDING);
259
+ }
260
+ return { height: maxY - minY, width: maxX - minX, x: minX, y: minY };
261
+ }
262
+
263
+ interface FlowToolbarProps {
264
+ readonly canDelete: boolean;
265
+ readonly canUndo: boolean;
266
+ readonly canRedo: boolean;
267
+ readonly readOnly: boolean;
268
+ readonly onDelete: () => void;
269
+ readonly onUndo: (() => void) | undefined;
270
+ readonly onRedo: (() => void) | undefined;
271
+ readonly onZoomIn: () => void;
272
+ readonly onZoomOut: () => void;
273
+ }
274
+
275
+ /** Present keyboard-accessible viewport and history controls. */
276
+ function FlowToolbar(props: FlowToolbarProps) {
277
+ const { theme } = useZoraTheme();
278
+ return (
279
+ <View
280
+ style={{
281
+ backgroundColor: theme.semantics.surface.default,
282
+ borderBottomColor: theme.semantics.neutral.divider,
283
+ borderBottomWidth: 1,
284
+ flexDirection: 'row',
285
+ flexWrap: 'wrap',
286
+ gap: 8,
287
+ padding: 10,
288
+ width: '100%',
289
+ }}
290
+ >
291
+ <FlowControl label="Zoom out" onPress={props.onZoomOut} />
292
+ <FlowControl label="Zoom in" onPress={props.onZoomIn} />
293
+ <FlowControl
294
+ disabled={props.readOnly || !props.canDelete}
295
+ label="Delete selected nodes"
296
+ onPress={props.onDelete}
297
+ />
298
+ <FlowControl
299
+ disabled={props.readOnly || !props.canUndo}
300
+ label="Undo"
301
+ onPress={props.onUndo}
302
+ />
303
+ <FlowControl
304
+ disabled={props.readOnly || !props.canRedo}
305
+ label="Redo"
306
+ onPress={props.onRedo}
307
+ />
308
+ </View>
309
+ );
310
+ }
311
+
312
+ /** Render one focusable command control. */
313
+ function FlowControl(props: {
314
+ readonly label: string;
315
+ readonly disabled?: boolean;
316
+ readonly onPress?: () => void;
317
+ }) {
318
+ const { theme } = useZoraTheme();
319
+ return (
320
+ <Pressable
321
+ accessibilityLabel={props.label}
322
+ accessibilityRole="button"
323
+ accessibilityState={{ disabled: props.disabled }}
324
+ disabled={props.disabled}
325
+ style={{
326
+ backgroundColor: props.disabled
327
+ ? theme.semantics.neutral.surfaceHover
328
+ : theme.semantics.neutral.surface,
329
+ borderColor: props.disabled ? theme.semantics.neutral.divider : theme.colors.primary,
330
+ borderRadius: 9,
331
+ borderWidth: 1,
332
+ justifyContent: 'center',
333
+ minHeight: 44,
334
+ minWidth: 44,
335
+ paddingHorizontal: 10,
336
+ paddingVertical: 7,
337
+ }}
338
+ onPress={props.onPress}
339
+ >
340
+ <Text
341
+ style={{
342
+ color: props.disabled ? theme.semantics.neutral.textMuted : theme.colors.primary,
343
+ fontSize: 12,
344
+ fontWeight: '700',
345
+ }}
346
+ >
347
+ {props.label}
348
+ </Text>
349
+ </Pressable>
350
+ );
351
+ }
352
+
353
+ /** Render Bezier edges in the same world coordinates as the nodes they join. */
354
+ const FlowEdges = React.memo(function FlowEdges(props: {
355
+ readonly anchors: ReadonlyMap<string, FlowPoint>;
356
+ readonly connections: FlowCanvasProps['connections'];
357
+ readonly layer: GridWorldLayerContext;
358
+ readonly nodes: ReadonlyMap<string, FlowNodeData>;
359
+ readonly readOnly: boolean;
360
+ readonly onDisconnect: FlowCanvasProps['onDisconnect'];
361
+ }) {
362
+ const { theme } = useZoraTheme();
363
+ const { layer } = props;
364
+ const resolve = (address: FlowPortAddress): FlowPoint | undefined => {
365
+ const node = props.nodes.get(address.nodeId);
366
+ if (!node) return undefined;
367
+ const deterministic = getDeterministicFlowPortAnchor(node, address);
368
+ if (!deterministic) return undefined;
369
+ const local = getFlowPortAnchor(props.anchors, address) ?? deterministic;
370
+ return {
371
+ x: layer.origin.x + (node.position.x + local.x) * layer.pixelsPerUnitX,
372
+ y: layer.origin.y + (node.position.y + local.y) * layer.pixelsPerUnitY,
373
+ };
374
+ };
375
+ const edges = props.connections.map((connection) => ({
376
+ connection,
377
+ source: resolve(connection.source),
378
+ target: resolve(connection.target),
379
+ }));
380
+ return (
381
+ <>
382
+ <Svg
383
+ height={layer.height}
384
+ pointerEvents="none"
385
+ style={{ left: 0, position: 'absolute', top: 0 }}
386
+ width={layer.width}
387
+ >
388
+ {edges.map((edge) => (
389
+ <FlowEdgePath
390
+ key={edge.connection.id}
391
+ source={edge.source}
392
+ stroke={theme.colors.primary}
393
+ target={edge.target}
394
+ testID={`flow-edge-${edge.connection.id}`}
395
+ />
396
+ ))}
397
+ </Svg>
398
+ {edges.map((edge) => (
399
+ <FlowEdgeControl
400
+ key={edge.connection.id}
401
+ connection={edge.connection}
402
+ onDisconnect={props.onDisconnect}
403
+ readOnly={props.readOnly}
404
+ source={edge.source}
405
+ target={edge.target}
406
+ />
407
+ ))}
408
+ </>
409
+ );
410
+ });
411
+
412
+ /** Render one edge path only when either endpoint's measured geometry changes. */
413
+ const FlowEdgePath = React.memo(function FlowEdgePath(props: {
414
+ readonly source: FlowPoint | undefined;
415
+ readonly stroke: string;
416
+ readonly target: FlowPoint | undefined;
417
+ readonly testID: string;
418
+ }) {
419
+ if (!props.source || !props.target) return null;
420
+ const controlDistance = Math.max(48, Math.abs(props.target.x - props.source.x) / 2);
421
+ return (
422
+ <Path
423
+ d={`M ${props.source.x} ${props.source.y} C ${props.source.x + controlDistance} ${props.source.y}, ${props.target.x - controlDistance} ${props.target.y}, ${props.target.x} ${props.target.y}`}
424
+ fill="none"
425
+ stroke={props.stroke}
426
+ strokeWidth={3}
427
+ testID={props.testID}
428
+ />
429
+ );
430
+ });
431
+
432
+ /** Keep each accessible disconnect target aligned with its two measured endpoints. */
433
+ const FlowEdgeControl = React.memo(function FlowEdgeControl(props: {
434
+ readonly connection: FlowCanvasProps['connections'][number];
435
+ readonly onDisconnect: FlowCanvasProps['onDisconnect'];
436
+ readonly readOnly: boolean;
437
+ readonly source: FlowPoint | undefined;
438
+ readonly target: FlowPoint | undefined;
439
+ }) {
440
+ if (!props.source || !props.target) return null;
441
+ return (
442
+ <Pressable
443
+ accessibilityHint="Disconnect this flow connection"
444
+ accessibilityLabel={props.connection.label ?? `Connection ${props.connection.id}`}
445
+ accessibilityRole="button"
446
+ accessibilityState={{ disabled: props.readOnly }}
447
+ disabled={props.readOnly}
448
+ style={{
449
+ height: 44,
450
+ left: (props.source.x + props.target.x) / 2 - 22,
451
+ position: 'absolute',
452
+ top: (props.source.y + props.target.y) / 2 - 22,
453
+ width: 44,
454
+ zIndex: 1,
455
+ }}
456
+ onPress={() => props.onDisconnect?.(props.connection.id)}
457
+ />
458
+ );
459
+ });
460
+
461
+ /** Render controlled palette insertion requests. */
462
+ function FlowPalette(props: {
463
+ readonly items: FlowCanvasProps['paletteItems'];
464
+ readonly readOnly: boolean;
465
+ readonly onInsert: FlowCanvasProps['onInsert'];
466
+ }) {
467
+ const { theme } = useZoraTheme();
468
+ if (!props.items?.length) return null;
469
+ return (
470
+ <View
471
+ accessibilityLabel="Flow palette"
472
+ style={{ backgroundColor: theme.colors.primary, gap: 8, padding: 12 }}
473
+ >
474
+ {props.items.map((item) => (
475
+ <Pressable
476
+ key={item.id}
477
+ accessibilityHint="Insert this node"
478
+ accessibilityLabel={item.title}
479
+ accessibilityRole="button"
480
+ accessibilityState={{ disabled: props.readOnly || item.disabled }}
481
+ disabled={props.readOnly || item.disabled}
482
+ style={{
483
+ backgroundColor: theme.semantics.neutral.surface,
484
+ borderRadius: 8,
485
+ justifyContent: 'center',
486
+ minHeight: 44,
487
+ padding: 10,
488
+ }}
489
+ onPress={() => props.onInsert?.(item.id)}
490
+ >
491
+ <Text style={{ color: theme.semantics.neutral.text, fontWeight: '700' }}>
492
+ {item.title}
493
+ </Text>
494
+ {item.description ? (
495
+ <Text style={{ color: theme.semantics.neutral.textMuted }}>{item.description}</Text>
496
+ ) : null}
497
+ </Pressable>
498
+ ))}
499
+ </View>
500
+ );
501
+ }
@@ -0,0 +1,146 @@
1
+ import { expect, test } from 'bun:test';
2
+
3
+ import type { FlowCanvasProps, FlowNodeData } from '../../../types/flow';
4
+ import { createFlowEditorController } from './createFlowEditorController';
5
+
6
+ const nodes: readonly FlowNodeData[] = [
7
+ {
8
+ id: 'source',
9
+ position: { x: 10, y: 20 },
10
+ ports: [{ direction: 'output', id: 'out', label: 'Output' }],
11
+ title: 'Source',
12
+ },
13
+ {
14
+ id: 'target',
15
+ position: { x: 40, y: 50 },
16
+ ports: [{ direction: 'input', id: 'in', label: 'Input' }],
17
+ title: 'Target',
18
+ },
19
+ ];
20
+
21
+ /** Create a minimal controlled editor contract for interaction assertions. */
22
+ function createProps(overrides: Partial<FlowCanvasProps> = {}): FlowCanvasProps {
23
+ return {
24
+ connections: [],
25
+ nodes,
26
+ viewport: { pan: { x: 0, y: 0 }, zoom: 1 },
27
+ ...overrides,
28
+ };
29
+ }
30
+
31
+ test('emits controlled selection, movement and viewport updates', () => {
32
+ const selected: string[][] = [];
33
+ const moved: (readonly FlowNodeData[])[] = [];
34
+ const viewports: FlowCanvasProps['viewport'][] = [];
35
+ const controller = createFlowEditorController(
36
+ createProps({
37
+ onNodeSelectionChange: (ids) => selected.push([...ids]),
38
+ onNodesMove: (next) => {
39
+ moved.push(next);
40
+ },
41
+ onViewportChange: (viewport) => viewports.push(viewport),
42
+ }),
43
+ );
44
+
45
+ controller.selectNode('source');
46
+ controller.moveNode('source', { x: 3, y: -2 });
47
+ controller.setViewport({ pan: { x: 4, y: 5 }, zoom: 1.25 });
48
+
49
+ expect(selected).toEqual([['source']]);
50
+ expect(moved[0]?.[0]?.position).toEqual({ x: 13, y: 18 });
51
+ expect(viewports).toEqual([{ pan: { x: 4, y: 5 }, zoom: 1.25 }]);
52
+ });
53
+
54
+ test('connects only an enabled output to an input on a different node', () => {
55
+ const connections: { readonly source: string; readonly target: string }[] = [];
56
+ const controller = createFlowEditorController(
57
+ createProps({
58
+ onConnect: (source, target) =>
59
+ connections.push({ source: source.portId, target: target.portId }),
60
+ }),
61
+ );
62
+
63
+ controller.connect({ nodeId: 'source', portId: 'out' }, { nodeId: 'target', portId: 'in' });
64
+ controller.connect({ nodeId: 'target', portId: 'in' }, { nodeId: 'source', portId: 'out' });
65
+
66
+ expect(connections).toEqual([{ source: 'out', target: 'in' }]);
67
+ });
68
+
69
+ test('rejects an output and input whose published Contracts schema types do not overlap', () => {
70
+ const connections: { readonly source: string; readonly target: string }[] = [];
71
+ const source = nodes.find((node) => node.id === 'source');
72
+ const target = nodes.find((node) => node.id === 'target');
73
+ if (!source || !target) throw new Error('The typed-port test requires source and target nodes.');
74
+ const controller = createFlowEditorController(
75
+ createProps({
76
+ nodes: [
77
+ {
78
+ ...source,
79
+ ports: [
80
+ {
81
+ data: { schema: { type: 'string' } },
82
+ direction: 'output',
83
+ id: 'out',
84
+ label: 'Text output',
85
+ },
86
+ ],
87
+ },
88
+ {
89
+ ...target,
90
+ ports: [
91
+ {
92
+ data: { schema: { type: 'number' } },
93
+ direction: 'input',
94
+ id: 'in',
95
+ label: 'Number input',
96
+ },
97
+ ],
98
+ },
99
+ ],
100
+ onConnect: (connectionSource, connectionTarget) =>
101
+ connections.push({ source: connectionSource.portId, target: connectionTarget.portId }),
102
+ }),
103
+ );
104
+
105
+ expect(
106
+ controller.connect({ nodeId: 'source', portId: 'out' }, { nodeId: 'target', portId: 'in' }),
107
+ ).toBe('connection_types_incompatible');
108
+ expect(connections).toEqual([]);
109
+ });
110
+
111
+ test('suppresses mutation intents in read-only mode', () => {
112
+ const deleted: string[][] = [];
113
+ const moved: (readonly FlowNodeData[])[] = [];
114
+ const selected: string[][] = [];
115
+ const controller = createFlowEditorController(
116
+ createProps({
117
+ onNodeSelectionChange: (ids) => selected.push([...ids]),
118
+ onNodesMove: (next) => {
119
+ moved.push(next);
120
+ },
121
+ onNodesDelete: (ids) => deleted.push([...ids]),
122
+ readOnly: true,
123
+ }),
124
+ );
125
+
126
+ controller.selectNode('source');
127
+ controller.moveNode('source', { x: 3, y: -2 });
128
+ controller.deleteNodes(['source']);
129
+
130
+ expect(selected).toEqual([]);
131
+ expect(moved).toEqual([]);
132
+ expect(deleted).toEqual([]);
133
+ });
134
+
135
+ test('deletes only enabled selected nodes through the controlled host', () => {
136
+ const deleted: string[][] = [];
137
+ const controller = createFlowEditorController(
138
+ createProps({ onNodesDelete: (ids) => deleted.push([...ids]) }),
139
+ );
140
+
141
+ controller.deleteNodes(['source']);
142
+ controller.deleteNodes([]);
143
+ controller.deleteNodes(['missing']);
144
+
145
+ expect(deleted).toEqual([['source']]);
146
+ });