@ankhorage/zora 28.10.1 → 28.11.1

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 (377) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/README.md +1 -1
  3. package/dist/capabilities/index.js +2 -1
  4. package/dist/capabilities/index.js.map +3 -3
  5. package/dist/constants/authoring.d.ts +3 -3
  6. package/dist/constants/authoring.d.ts.map +1 -1
  7. package/dist/constants/authoring.js +1 -0
  8. package/dist/constants/authoring.js.map +1 -1
  9. package/dist/features/accordion/accordionItemMeta.d.ts +1 -1
  10. package/dist/features/bottom-sheet/bottomSheetMeta.d.ts +1 -1
  11. package/dist/features/calendar/adapters/inbound/Calendar.d.ts.map +1 -1
  12. package/dist/features/calendar/adapters/inbound/Calendar.js +91 -7
  13. package/dist/features/calendar/adapters/inbound/Calendar.js.map +1 -1
  14. package/dist/features/card/cardMeta.d.ts +1 -1
  15. package/dist/features/card/mediaCardMeta.d.ts +1 -1
  16. package/dist/features/card/postCardMeta.d.ts +1 -1
  17. package/dist/features/chat/messageBubbleMeta.d.ts +1 -1
  18. package/dist/features/dialog/dialogMeta.d.ts +2 -2
  19. package/dist/features/flow/adapters/inbound/FlowCanvas.d.ts +5 -0
  20. package/dist/features/flow/adapters/inbound/FlowCanvas.d.ts.map +1 -0
  21. package/dist/features/flow/adapters/inbound/FlowCanvas.js +261 -0
  22. package/dist/features/flow/adapters/inbound/FlowCanvas.js.map +1 -0
  23. package/dist/features/flow/application/createFlowEditorController.d.ts +13 -0
  24. package/dist/features/flow/application/createFlowEditorController.d.ts.map +1 -0
  25. package/dist/features/flow/application/createFlowEditorController.js +86 -0
  26. package/dist/features/flow/application/createFlowEditorController.js.map +1 -0
  27. package/dist/features/flow/application/getFlowPortAnchor.d.ts +10 -0
  28. package/dist/features/flow/application/getFlowPortAnchor.d.ts.map +1 -0
  29. package/dist/features/flow/application/getFlowPortAnchor.js +18 -0
  30. package/dist/features/flow/application/getFlowPortAnchor.js.map +1 -0
  31. package/dist/features/flow/application/mapFlowViewport.d.ts +10 -0
  32. package/dist/features/flow/application/mapFlowViewport.d.ts.map +1 -0
  33. package/dist/features/flow/application/mapFlowViewport.js +22 -0
  34. package/dist/features/flow/application/mapFlowViewport.js.map +1 -0
  35. package/dist/features/flow/public.d.ts +3 -0
  36. package/dist/features/flow/public.d.ts.map +1 -0
  37. package/dist/features/flow/public.js +2 -0
  38. package/dist/features/flow/public.js.map +1 -0
  39. package/dist/features/gradient/gradientMeta.d.ts +1 -1
  40. package/dist/features/graph-node/adapters/inbound/GraphNode.d.ts +5 -0
  41. package/dist/features/graph-node/adapters/inbound/GraphNode.d.ts.map +1 -0
  42. package/dist/features/graph-node/adapters/inbound/GraphNode.js +190 -0
  43. package/dist/features/graph-node/adapters/inbound/GraphNode.js.map +1 -0
  44. package/dist/features/graph-node/getGraphNodePortGeometry.d.ts +17 -0
  45. package/dist/features/graph-node/getGraphNodePortGeometry.d.ts.map +1 -0
  46. package/dist/features/graph-node/getGraphNodePortGeometry.js +23 -0
  47. package/dist/features/graph-node/getGraphNodePortGeometry.js.map +1 -0
  48. package/dist/features/graph-node/public.d.ts +3 -0
  49. package/dist/features/graph-node/public.d.ts.map +1 -0
  50. package/dist/features/graph-node/public.js +2 -0
  51. package/dist/features/graph-node/public.js.map +1 -0
  52. package/dist/features/grid-view/adapters/inbound/GridView.d.ts +1 -1
  53. package/dist/features/grid-view/adapters/inbound/GridView.d.ts.map +1 -1
  54. package/dist/features/grid-view/adapters/inbound/GridView.js +105 -41
  55. package/dist/features/grid-view/adapters/inbound/GridView.js.map +1 -1
  56. package/dist/features/grid-view/application/createGridScrollSync.d.ts +2 -5
  57. package/dist/features/grid-view/application/createGridScrollSync.d.ts.map +1 -1
  58. package/dist/features/grid-view/application/createGridScrollSync.js +109 -45
  59. package/dist/features/grid-view/application/createGridScrollSync.js.map +1 -1
  60. package/dist/features/grid-view/public.d.ts +1 -1
  61. package/dist/features/grid-view/public.d.ts.map +1 -1
  62. package/dist/features/grid-view/public.js.map +1 -1
  63. package/dist/features/keyboard-avoiding-view/keyboardAvoidingViewMeta.d.ts +1 -1
  64. package/dist/features/layout/gridMeta.d.ts +1 -1
  65. package/dist/features/layout/screenMeta.d.ts +1 -1
  66. package/dist/features/layout/scrollViewMeta.d.ts +1 -1
  67. package/dist/features/layout/utils/createScrollGestureLock.d.ts.map +1 -1
  68. package/dist/features/layout/utils/createScrollGestureLock.js +4 -0
  69. package/dist/features/layout/utils/createScrollGestureLock.js.map +1 -1
  70. package/dist/features/layout/viewMeta.d.ts +1 -1
  71. package/dist/features/list/flatListMeta.d.ts +1 -1
  72. package/dist/features/list/sectionListMeta.d.ts +1 -1
  73. package/dist/features/master-detail/masterDetailMeta.d.ts +1 -1
  74. package/dist/features/popover/popoverMeta.d.ts +1 -1
  75. package/dist/features/reader/meta.d.ts +2 -2
  76. package/dist/features/registry/bindableComponentMeta.d.ts +2 -2
  77. package/dist/features/scanner/meta.d.ts +2 -2
  78. package/dist/features/section/screenSectionMeta.d.ts +1 -1
  79. package/dist/features/surface/surfaceMeta.d.ts +1 -1
  80. package/dist/features/tabs/tabPanelMeta.d.ts +1 -1
  81. package/dist/features/theme/node.d.ts +5 -0
  82. package/dist/features/theme/node.d.ts.map +1 -0
  83. package/dist/features/theme/node.js +4 -0
  84. package/dist/features/theme/node.js.map +1 -0
  85. package/dist/features/theme/public.d.ts +2 -0
  86. package/dist/features/theme/public.d.ts.map +1 -1
  87. package/dist/features/theme/public.js +1 -0
  88. package/dist/features/theme/public.js.map +1 -1
  89. package/dist/features/time-grid/adapters/inbound/TimeGrid.d.ts +1 -1
  90. package/dist/features/time-grid/adapters/inbound/TimeGrid.d.ts.map +1 -1
  91. package/dist/features/time-grid/adapters/inbound/TimeGrid.js +45 -22
  92. package/dist/features/time-grid/adapters/inbound/TimeGrid.js.map +1 -1
  93. package/dist/types/color.d.ts +3 -3
  94. package/dist/types/color.d.ts.map +1 -1
  95. package/dist/types/color.js.map +1 -1
  96. package/dist/types/flow.d.ts +81 -0
  97. package/dist/types/flow.d.ts.map +1 -0
  98. package/dist/types/flow.js +2 -0
  99. package/dist/types/flow.js.map +1 -0
  100. package/dist/types/graph-node.d.ts +42 -0
  101. package/dist/types/graph-node.d.ts.map +1 -0
  102. package/dist/types/graph-node.js +2 -0
  103. package/dist/types/graph-node.js.map +1 -0
  104. package/dist/types/grid-view.d.ts +27 -3
  105. package/dist/types/grid-view.d.ts.map +1 -1
  106. package/dist/types/grid-view.js.map +1 -1
  107. package/dist/types/layout.d.ts +2 -0
  108. package/dist/types/layout.d.ts.map +1 -1
  109. package/dist/types/layout.js.map +1 -1
  110. package/dist/types/time-grid.d.ts +9 -0
  111. package/dist/types/time-grid.d.ts.map +1 -1
  112. package/dist/types/time-grid.js.map +1 -1
  113. package/package.json +24 -6
  114. package/src/constants/authoring.ts +1 -0
  115. package/src/features/calendar/adapters/inbound/Calendar.interaction.test.tsx +65 -4
  116. package/src/features/calendar/adapters/inbound/Calendar.tsx +172 -22
  117. package/src/features/flow/adapters/inbound/FlowCanvas.tsx +501 -0
  118. package/src/features/flow/application/createFlowEditorController.test.ts +146 -0
  119. package/src/features/flow/application/createFlowEditorController.ts +99 -0
  120. package/src/features/flow/application/getFlowPortAnchor.test.ts +23 -0
  121. package/src/features/flow/application/getFlowPortAnchor.ts +30 -0
  122. package/src/features/flow/application/mapFlowViewport.test.ts +11 -0
  123. package/src/features/flow/application/mapFlowViewport.ts +29 -0
  124. package/src/features/flow/public.test.ts +7 -0
  125. package/src/features/flow/public.ts +13 -0
  126. package/src/features/graph-node/adapters/inbound/GraphNode.test.tsx +80 -0
  127. package/src/features/graph-node/adapters/inbound/GraphNode.tsx +259 -0
  128. package/src/features/graph-node/getGraphNodePortGeometry.test.ts +35 -0
  129. package/src/features/graph-node/getGraphNodePortGeometry.ts +41 -0
  130. package/src/features/graph-node/public.test.ts +7 -0
  131. package/src/features/graph-node/public.ts +2 -0
  132. package/src/features/grid-view/adapters/inbound/GridView.nativeScrollSync.test.tsx +198 -7
  133. package/src/features/grid-view/adapters/inbound/GridView.tsx +248 -145
  134. package/src/features/grid-view/application/createGridScrollSync.test.ts +46 -17
  135. package/src/features/grid-view/application/createGridScrollSync.ts +100 -43
  136. package/src/features/grid-view/public.ts +6 -1
  137. package/src/features/layout/utils/createScrollGestureLock.ts +4 -0
  138. package/src/features/theme/application/use-cases/compileZoraTheme.test.ts +1 -1
  139. package/src/features/theme/node.ts +18 -0
  140. package/src/features/theme/public.ts +7 -0
  141. package/src/features/time-grid/adapters/inbound/TimeGrid.tsx +64 -21
  142. package/src/platformAcceptance.test.ts +15 -11
  143. package/src/types/color.ts +3 -3
  144. package/src/types/flow.ts +99 -0
  145. package/src/types/graph-node.ts +45 -0
  146. package/src/types/grid-view.ts +25 -3
  147. package/src/types/layout.ts +2 -0
  148. package/src/types/time-grid.ts +9 -0
  149. package/web-dist/chunks/{Accordion-9dq115tn.js → Accordion-064hgrct.js} +3 -3
  150. package/web-dist/chunks/{Accordion-wbf7gqrm.js → Accordion-2b3sd76b.js} +3 -3
  151. package/web-dist/chunks/{Accordion-k9n1yse4.js → Accordion-2kv6p7by.js} +10 -38
  152. package/web-dist/chunks/{Accordion-6gc0jw1n.js → Accordion-5x4cv0kv.js} +1 -1
  153. package/web-dist/chunks/{Accordion-r8swmfjm.js → Accordion-6d63tc7d.js} +1 -1
  154. package/web-dist/chunks/{Accordion-vbz1mjm6.js → Accordion-7eysykr1.js} +4 -4
  155. package/web-dist/chunks/{Accordion-q2yxtdzc.js → Accordion-95003ycq.js} +144 -27
  156. package/web-dist/chunks/{Accordion-hadw5304.js → Accordion-98886mbn.js} +1 -1
  157. package/web-dist/chunks/{Accordion-vtbs98r4.js → Accordion-a0hbjxg9.js} +4 -4
  158. package/web-dist/chunks/{Accordion-73p2mg3h.js → Accordion-a49s4ywn.js} +4 -4
  159. package/web-dist/chunks/{Accordion-tb0vc91c.js → Accordion-a8b6g53f.js} +4 -4
  160. package/web-dist/chunks/{Accordion-25v2vczc.js → Accordion-afxbyvwp.js} +3 -3
  161. package/web-dist/chunks/{Accordion-g5pvs1aa.js → Accordion-ajqj6ymg.js} +5 -5
  162. package/web-dist/chunks/{Accordion-w2kx944a.js → Accordion-ak6dvant.js} +3 -3
  163. package/web-dist/chunks/{Accordion-778fjjsh.js → Accordion-b1tqkxx6.js} +3 -3
  164. package/web-dist/chunks/{Accordion-rp9cjtpg.js → Accordion-bm30dkbw.js} +2 -2
  165. package/web-dist/chunks/{Accordion-rsw5jt7m.js → Accordion-cah5j61y.js} +2 -2
  166. package/web-dist/chunks/{Accordion-pr1tv6jx.js → Accordion-dfr26j8m.js} +1 -1
  167. package/web-dist/chunks/{Accordion-zmrbktd8.js → Accordion-dnfgtbq3.js} +8 -8
  168. package/web-dist/chunks/{Accordion-m3tq2vcc.js → Accordion-dy1j2a7p.js} +6 -6
  169. package/web-dist/chunks/{Accordion-7pgh8q4h.js → Accordion-e9jwetg7.js} +2 -2
  170. package/web-dist/chunks/{Accordion-gnkzvj03.js → Accordion-e9xmwxzp.js} +1 -1
  171. package/web-dist/chunks/{Accordion-q8ymmar7.js → Accordion-ek0hh2nx.js} +4 -4
  172. package/web-dist/chunks/{Accordion-2berhsg5.js → Accordion-et7xzm6k.js} +9 -9
  173. package/web-dist/chunks/Accordion-eysfka31.js +1590 -0
  174. package/web-dist/chunks/{Accordion-59x6e7bs.js → Accordion-gb3mfjmx.js} +43 -20
  175. package/web-dist/chunks/{Accordion-3xfqmr1r.js → Accordion-gy3bx3xa.js} +2 -2
  176. package/web-dist/chunks/{Accordion-tj4fe6wk.js → Accordion-h2rnzgyv.js} +3 -3
  177. package/web-dist/chunks/Accordion-hbwhya78.js +83 -0
  178. package/web-dist/chunks/{Accordion-t9w365ke.js → Accordion-hbwyj12m.js} +1 -1
  179. package/web-dist/chunks/Accordion-jkgd7dmf.js +1 -0
  180. package/web-dist/chunks/{Accordion-qwftammh.js → Accordion-kxjjp03t.js} +5 -5
  181. package/web-dist/chunks/Accordion-mkd3k28h.js +275 -0
  182. package/web-dist/chunks/{Accordion-xqkkfwkm.js → Accordion-nhf8zjt4.js} +2 -2
  183. package/web-dist/chunks/{Accordion-hg4db1sk.js → Accordion-p84h11ek.js} +4 -4
  184. package/web-dist/chunks/{Accordion-zhgty1ae.js → Accordion-pagdkp07.js} +3 -3
  185. package/web-dist/chunks/{Accordion-dv5c27w4.js → Accordion-pjbmmr20.js} +1 -1
  186. package/web-dist/chunks/{Accordion-7ayxbm7k.js → Accordion-pr4a281g.js} +1 -1
  187. package/web-dist/chunks/{Accordion-yca8r7kx.js → Accordion-qz6ddnmv.js} +3 -3
  188. package/web-dist/chunks/{Accordion-dcjzxzv3.js → Accordion-rv90tjqr.js} +2 -2
  189. package/web-dist/chunks/{Accordion-0zk0xp73.js → Accordion-snk6nggm.js} +326 -174
  190. package/web-dist/chunks/{Accordion-casb2ndy.js → Accordion-th7yhwhf.js} +5 -5
  191. package/web-dist/chunks/{Accordion-e6ettgh0.js → Accordion-vbh3xqv6.js} +2 -2
  192. package/web-dist/chunks/{Accordion-vdzyhtyd.js → Accordion-w4zh2nws.js} +8 -8
  193. package/web-dist/chunks/Accordion-w8zke8fa.js +37 -0
  194. package/web-dist/chunks/{Accordion-3e60xwvy.js → Accordion-wkqemqjw.js} +1 -1
  195. package/web-dist/chunks/{Accordion-vwqf8kn1.js → Accordion-x9sb23p3.js} +3 -3
  196. package/web-dist/chunks/{Accordion-xhkphta6.js → Accordion-y6sg47rv.js} +1 -1
  197. package/web-dist/chunks/{Accordion-mw8zh0vs.js → Accordion-yannd7r3.js} +4 -4
  198. package/web-dist/chunks/{Accordion-457amtv7.js → Accordion-z3m3wvfz.js} +6 -1580
  199. package/web-dist/chunks/{Accordion-pvcdvh3w.js → Accordion-zagrbkq1.js} +2 -2
  200. package/web-dist/chunks/{Accordion-2jcas7qq.js → Accordion-zays65re.js} +5 -5
  201. package/web-dist/chunks/{RichTextClient-w75r2x97.js → RichTextClient-qd6gmm0x.js} +12 -11
  202. package/web-dist/chunks/{Video.native-bb9g33nd.js → Video.native-7zsbp5vg.js} +7 -6
  203. package/web-dist/components/accordion/Accordion.js +6 -5
  204. package/web-dist/components/accordion-item/AccordionItem.js +6 -5
  205. package/web-dist/components/activity-indicator/ActivityIndicator.js +1 -1
  206. package/web-dist/components/app-bar/AppBar.js +8 -7
  207. package/web-dist/components/app-header/AppHeader.js +8 -7
  208. package/web-dist/components/app-shell/AppShell.js +3 -2
  209. package/web-dist/components/audio/Audio.js +6 -5
  210. package/web-dist/components/auth-screen/AuthScreen.js +11 -10
  211. package/web-dist/components/avatar/Avatar.js +6 -5
  212. package/web-dist/components/avatar-group/AvatarGroup.js +6 -5
  213. package/web-dist/components/badge/Badge.js +2 -2
  214. package/web-dist/components/barcode-scanner-view/BarcodeScannerView.js +11 -10
  215. package/web-dist/components/bottom-sheet/BottomSheet.js +4 -3
  216. package/web-dist/components/bottom-sheet-flat-list/BottomSheetFlatList.js +4 -3
  217. package/web-dist/components/bottom-sheet-scroll-view/BottomSheetScrollView.js +4 -3
  218. package/web-dist/components/bottom-sheet-section-list/BottomSheetSectionList.js +4 -3
  219. package/web-dist/components/bottom-sheet-view/BottomSheetView.js +4 -3
  220. package/web-dist/components/bottom-sheet-virtualized-list/BottomSheetVirtualizedList.js +4 -3
  221. package/web-dist/components/breadcrumbs/Breadcrumbs.js +6 -5
  222. package/web-dist/components/button/Button.js +4 -3
  223. package/web-dist/components/button-group/ButtonGroup.js +4 -3
  224. package/web-dist/components/calendar/Calendar.js +8 -7
  225. package/web-dist/components/camera-permission-view/CameraPermissionView.js +11 -10
  226. package/web-dist/components/card/Card.js +10 -9
  227. package/web-dist/components/card-back/CardBack.js +2 -2
  228. package/web-dist/components/card-hand/CardHand.js +2 -2
  229. package/web-dist/components/chat-list-item/ChatListItem.js +8 -7
  230. package/web-dist/components/checkbox/Checkbox.js +5 -4
  231. package/web-dist/components/checkbox-group/CheckboxGroup.js +5 -4
  232. package/web-dist/components/chess-board/ChessBoard.js +4 -3
  233. package/web-dist/components/chip/Chip.js +6 -5
  234. package/web-dist/components/chip-group/ChipGroup.js +6 -5
  235. package/web-dist/components/collection-editor/CollectionEditor.js +10 -9
  236. package/web-dist/components/color-hue-scale/ColorHueScale.js +17 -15
  237. package/web-dist/components/color-picker/ColorPicker.js +17 -15
  238. package/web-dist/components/color-picker/ColorPicker.types-0.d.ts +3 -3
  239. package/web-dist/components/color-tone/ColorTone.js +17 -15
  240. package/web-dist/components/color-tone/ColorTone.types-0.d.ts +3 -3
  241. package/web-dist/components/color-wheel/ColorWheel.js +17 -15
  242. package/web-dist/components/color-wheel/ColorWheel.types-0.d.ts +1 -1
  243. package/web-dist/components/content-rail/ContentRail.js +5 -4
  244. package/web-dist/components/data-table/DataTable.js +16 -15
  245. package/web-dist/components/date-picker/DatePicker.js +10 -9
  246. package/web-dist/components/dialog/Dialog.js +5 -4
  247. package/web-dist/components/divider/Divider.js +3 -2
  248. package/web-dist/components/empty-state/EmptyState.js +11 -10
  249. package/web-dist/components/explorer/Explorer.js +8 -7
  250. package/web-dist/components/field/Field.js +5 -4
  251. package/web-dist/components/file-explorer/FileExplorer.js +8 -7
  252. package/web-dist/components/flat-list/FlatList.js +6 -5
  253. package/web-dist/components/flow-canvas/FlowCanvas.d.ts +7 -0
  254. package/web-dist/components/flow-canvas/FlowCanvas.dependency-0.d.ts +27 -0
  255. package/web-dist/components/flow-canvas/FlowCanvas.dependency-1.d.ts +3 -0
  256. package/web-dist/components/flow-canvas/FlowCanvas.js +513 -0
  257. package/web-dist/components/flow-canvas/FlowCanvas.types-0.d.ts +92 -0
  258. package/web-dist/components/flow-canvas/index.d.ts +2 -0
  259. package/web-dist/components/flow-canvas/index.js +2 -0
  260. package/web-dist/components/forgot-password-form/ForgotPasswordForm.js +11 -10
  261. package/web-dist/components/form/Form.js +7 -6
  262. package/web-dist/components/form-actions/FormActions.js +7 -6
  263. package/web-dist/components/form-error/FormError.js +7 -6
  264. package/web-dist/components/game/Game.js +4 -3
  265. package/web-dist/components/game-entity/GameEntity.js +4 -3
  266. package/web-dist/components/game-field/GameField.js +4 -3
  267. package/web-dist/components/game-input-zone/GameInputZone.js +4 -3
  268. package/web-dist/components/game-measurement-probe/GameMeasurementProbe.js +4 -3
  269. package/web-dist/components/game-overlay/GameOverlay.js +4 -3
  270. package/web-dist/components/gradient/Gradient.js +4 -3
  271. package/web-dist/components/gradient-renderer-provider/GradientRendererProvider.js +4 -3
  272. package/web-dist/components/graph-node/GraphNode.d.ts +7 -0
  273. package/web-dist/components/graph-node/GraphNode.dependency-0.d.ts +27 -0
  274. package/web-dist/components/graph-node/GraphNode.dependency-1.d.ts +3 -0
  275. package/web-dist/components/graph-node/GraphNode.dependency-2.d.ts +5 -0
  276. package/web-dist/components/graph-node/GraphNode.js +20 -0
  277. package/web-dist/components/graph-node/GraphNode.types-0.d.ts +46 -0
  278. package/web-dist/components/graph-node/index.d.ts +2 -0
  279. package/web-dist/components/graph-node/index.js +2 -0
  280. package/web-dist/components/grid/Grid.js +3 -2
  281. package/web-dist/components/grid-line-overlay/GridLineOverlay.js +2 -2
  282. package/web-dist/components/grid-ruler/GridRuler.js +2 -2
  283. package/web-dist/components/grid-view/GridView.d.ts +1 -1
  284. package/web-dist/components/grid-view/GridView.js +2 -1
  285. package/web-dist/components/grid-view/GridView.types-0.d.ts +21 -0
  286. package/web-dist/components/heading/Heading.js +2 -2
  287. package/web-dist/components/hero/Hero.js +10 -9
  288. package/web-dist/components/icon/Icon.js +2 -2
  289. package/web-dist/components/icon-button/IconButton.js +4 -3
  290. package/web-dist/components/image/Image.js +5 -4
  291. package/web-dist/components/keyboard-avoiding-view/KeyboardAvoidingView.js +2 -2
  292. package/web-dist/components/link/Link.js +2 -2
  293. package/web-dist/components/list/List.js +6 -5
  294. package/web-dist/components/list-item/ListItem.js +6 -5
  295. package/web-dist/components/list-section/ListSection.js +6 -5
  296. package/web-dist/components/master-detail/MasterDetail.js +3 -2
  297. package/web-dist/components/matrix-grid/MatrixGrid.js +5 -4
  298. package/web-dist/components/media-card/MediaCard.js +10 -9
  299. package/web-dist/components/media-explorer/MediaExplorer.js +8 -7
  300. package/web-dist/components/message-bubble/MessageBubble.js +8 -7
  301. package/web-dist/components/metric-card/MetricCard.js +10 -9
  302. package/web-dist/components/missing-element/MissingElement.js +5 -4
  303. package/web-dist/components/o-auth-provider-button/OAuthProviderButton.js +11 -10
  304. package/web-dist/components/o-auth-provider-list/OAuthProviderList.js +11 -10
  305. package/web-dist/components/opening-book/OpeningBook.js +4 -3
  306. package/web-dist/components/otp-form/OtpForm.js +11 -10
  307. package/web-dist/components/pagination/Pagination.js +5 -4
  308. package/web-dist/components/palette-item/PaletteItem.js +10 -9
  309. package/web-dist/components/playing-card/PlayingCard.js +2 -2
  310. package/web-dist/components/poker-training-table/PokerTrainingTable.js +2 -2
  311. package/web-dist/components/popover/Popover.js +1 -1
  312. package/web-dist/components/popover-menu/PopoverMenu.js +5 -4
  313. package/web-dist/components/post-card/PostCard.js +10 -9
  314. package/web-dist/components/product-card/ProductCard.js +10 -9
  315. package/web-dist/components/progress/Progress.js +5 -4
  316. package/web-dist/components/progress-ring/ProgressRing.js +5 -4
  317. package/web-dist/components/radio/Radio.js +6 -5
  318. package/web-dist/components/radio-group/RadioGroup.js +6 -5
  319. package/web-dist/components/rating/Rating.js +4 -3
  320. package/web-dist/components/reader/Reader.js +11 -10
  321. package/web-dist/components/rich-text/RichText.js +3 -3
  322. package/web-dist/components/runtime-authoring-overlay/RuntimeAuthoringOverlay.js +4 -3
  323. package/web-dist/components/scan-overlay/ScanOverlay.js +11 -10
  324. package/web-dist/components/screen/Screen.js +3 -2
  325. package/web-dist/components/screen-section/ScreenSection.js +5 -4
  326. package/web-dist/components/scroll-view/ScrollView.js +3 -2
  327. package/web-dist/components/search-input/SearchInput.js +6 -5
  328. package/web-dist/components/section-header/SectionHeader.js +5 -4
  329. package/web-dist/components/section-list/SectionList.js +6 -5
  330. package/web-dist/components/select/Select.js +11 -10
  331. package/web-dist/components/selectable-item/SelectableItem.js +4 -3
  332. package/web-dist/components/selection-provider/SelectionProvider.js +4 -3
  333. package/web-dist/components/sign-in-form/SignInForm.js +11 -10
  334. package/web-dist/components/sign-up-form/SignUpForm.js +11 -10
  335. package/web-dist/components/skeleton/Skeleton.js +13 -12
  336. package/web-dist/components/skeleton-card/SkeletonCard.js +13 -12
  337. package/web-dist/components/skeleton-list/SkeletonList.js +13 -12
  338. package/web-dist/components/skeleton-text/SkeletonText.js +13 -12
  339. package/web-dist/components/spatial-grid/SpatialGrid.js +2 -1
  340. package/web-dist/components/surface/Surface.js +2 -2
  341. package/web-dist/components/switch/Switch.js +1 -1
  342. package/web-dist/components/tab/Tab.js +2 -2
  343. package/web-dist/components/tab-list/TabList.js +2 -2
  344. package/web-dist/components/tab-panel/TabPanel.js +2 -2
  345. package/web-dist/components/tabletop-table/TabletopTable.js +2 -2
  346. package/web-dist/components/tabs/Tabs.js +2 -2
  347. package/web-dist/components/text/Text.js +2 -2
  348. package/web-dist/components/text-input/TextInput.js +5 -4
  349. package/web-dist/components/theme-mode-toggle/ThemeModeToggle.js +4 -3
  350. package/web-dist/components/tile-grid/TileGrid.js +2 -1
  351. package/web-dist/components/time-grid/TimeGrid.d.ts +1 -1
  352. package/web-dist/components/time-grid/TimeGrid.dependency-2.d.ts +13 -0
  353. package/web-dist/components/time-grid/TimeGrid.js +3 -2
  354. package/web-dist/components/time-grid/TimeGrid.types-0.d.ts +10 -0
  355. package/web-dist/components/time-picker/TimePicker.js +7 -6
  356. package/web-dist/components/timeline/Timeline.js +6 -5
  357. package/web-dist/components/toast/Toast.js +2 -2
  358. package/web-dist/components/toast-provider/ToastProvider.js +2 -2
  359. package/web-dist/components/toolbar/Toolbar.js +11 -10
  360. package/web-dist/components/tree-item/TreeItem.js +9 -8
  361. package/web-dist/components/uploader/Uploader.js +13 -12
  362. package/web-dist/components/video/Video.js +7 -6
  363. package/web-dist/components/view/View.js +3 -2
  364. package/web-dist/components/zora-provider/ZoraProvider.d.ts +7 -0
  365. package/web-dist/components/zora-provider/ZoraProvider.dependency-0.d.ts +15 -0
  366. package/web-dist/components/zora-provider/ZoraProvider.js +11 -0
  367. package/web-dist/components/zora-provider/ZoraProvider.types-0.d.ts +19 -0
  368. package/web-dist/components/zora-provider/index.d.ts +2 -0
  369. package/web-dist/components/zora-provider/index.js +2 -0
  370. package/web-dist/components/zora-theme-scope/ZoraThemeScope.d.ts +14 -0
  371. package/web-dist/components/zora-theme-scope/ZoraThemeScope.js +11 -0
  372. package/web-dist/components/zora-theme-scope/ZoraThemeScope.types-0.d.ts +3 -0
  373. package/web-dist/components/zora-theme-scope/index.d.ts +2 -0
  374. package/web-dist/components/zora-theme-scope/index.js +2 -0
  375. package/web-dist/components/zora-web-style-sheet/ZoraWebStyleSheet.js +3 -2
  376. package/web-dist/manifest.json +1059 -832
  377. package/web-dist/runtime/ZoraProvider.js +4 -80
@@ -0,0 +1,190 @@
1
+ import React from 'react';
2
+ import { Pressable, View } from 'react-native';
3
+ import { Badge } from '../../../badge/public.js';
4
+ import { Card } from '../../../card/public.js';
5
+ import { Icon } from '../../../icon/public.js';
6
+ import { useScrollGestureLock } from '../../../layout/public.js';
7
+ import { withZoraThemeScope } from '../../../theme/adapters/inbound/withZoraThemeScope.js';
8
+ import { useZoraTheme } from '../../../theme/composition/useZoraTheme.js';
9
+ import { Text } from '../../../typography/public.js';
10
+ import { getGraphNodePortGeometry } from '../../getGraphNodePortGeometry.js';
11
+ const PORT_INSET = 4;
12
+ const PORT_SIZE = 44;
13
+ const DRAG_THRESHOLD = 2;
14
+ /*** Presents one generic node with composed content, optional ports and controlled interactions. */
15
+ export const GraphNode = React.memo(withZoraThemeScope(GraphNodeInner));
16
+ /*** Render node content in the active ZORA theme scope. */
17
+ function GraphNodeInner(props) {
18
+ const { onPortLayout, ports = [] } = props;
19
+ const { theme } = useZoraTheme();
20
+ const drag = useNodeDrag(props);
21
+ const portsOffsetY = React.useRef(0);
22
+ const geometry = getGraphNodePortGeometry({ ports, width: props.width });
23
+ const reportPortAnchors = React.useCallback(() => {
24
+ if (!onPortLayout)
25
+ return;
26
+ getGraphNodePortGeometry({
27
+ ports,
28
+ portsTop: portsOffsetY.current,
29
+ width: props.width,
30
+ }).ports.forEach((port) => onPortLayout(port.id, port.anchor));
31
+ }, [onPortLayout, ports, props.width]);
32
+ React.useLayoutEffect(reportPortAnchors, [reportPortAnchors]);
33
+ const unavailable = props.readOnly === true || props.disabled === true;
34
+ const hasDefaultHeader = props.title !== undefined ||
35
+ props.description !== undefined ||
36
+ props.icon !== undefined ||
37
+ props.badge !== undefined;
38
+ return (<View style={{
39
+ backgroundColor: theme.semantics.surface.default,
40
+ borderRadius: 12,
41
+ elevation: props.selected ? 3 : 1,
42
+ shadowColor: theme.semantics.neutral.text,
43
+ shadowOpacity: props.selected ? 0.16 : 0.08,
44
+ shadowRadius: props.selected ? 10 : 6,
45
+ width: geometry.width,
46
+ }} testID={props.testID ? `${props.testID}-frame` : undefined}>
47
+ <Card compact padding="xs" radius="m" style={{ borderWidth: 0, elevation: 0, shadowOpacity: 0 }}>
48
+ <View accessible={false} collapsable={false} {...drag.handlers}>
49
+ {hasDefaultHeader ? (<Pressable aria-selected={props.selected === true} accessibilityHint={props.onMove ? 'Select this node. Drag to move it.' : undefined} accessibilityLabel={props.title} accessibilityRole="button" accessibilityState={{ disabled: unavailable, selected: props.selected === true }} disabled={props.onPress === undefined || unavailable} style={{ alignItems: 'flex-start', flexDirection: 'row', gap: 8 }} testID={props.testID} onPress={drag.press}>
50
+ {props.icon ? (<View accessible={false} style={{
51
+ alignItems: 'center',
52
+ backgroundColor: theme.semantics.brand.softBg,
53
+ borderRadius: 10,
54
+ height: 36,
55
+ justifyContent: 'center',
56
+ width: 36,
57
+ }}>
58
+ <Icon color={theme.semantics.brand.onSoftText} size={20} {...props.icon}/>
59
+ </View>) : null}
60
+ <View style={{ flex: 1, minWidth: 0 }}>
61
+ {props.title ? (<Text ellipsizeMode="tail" numberOfLines={1} variant="body" weight="bold">
62
+ {props.title}
63
+ </Text>) : null}
64
+ {props.description ? (<Text ellipsizeMode="tail" emphasis="muted" numberOfLines={2} variant="bodySmall">
65
+ {props.description}
66
+ </Text>) : null}
67
+ </View>
68
+ {props.badge ? <Badge size="s">{props.badge}</Badge> : null}
69
+ </Pressable>) : null}
70
+ {props.children}
71
+ </View>
72
+ </Card>
73
+ {ports.length > 0 ? (<View style={{ paddingHorizontal: PORT_INSET }} onLayout={(event) => {
74
+ portsOffsetY.current = event.nativeEvent.layout.y;
75
+ reportPortAnchors();
76
+ }}>
77
+ {ports.map((port) => {
78
+ const disabled = unavailable || port.disabled === true;
79
+ return (<View key={port.id} style={{
80
+ alignItems: 'center',
81
+ flexDirection: 'row',
82
+ height: PORT_SIZE,
83
+ justifyContent: port.direction === 'input' ? 'flex-start' : 'flex-end',
84
+ }}>
85
+ <Pressable accessibilityHint={`Connect ${port.direction} port`} accessibilityLabel={`${props.title}: ${port.label}`} accessibilityRole="button" accessibilityState={{ disabled }} disabled={disabled || props.onPortPress === undefined} style={{
86
+ alignItems: 'center',
87
+ height: PORT_SIZE,
88
+ justifyContent: 'center',
89
+ width: PORT_SIZE,
90
+ }} testID={port.testID} onPress={() => props.onPortPress?.(port.id)}>
91
+ <View accessible={false} style={{
92
+ backgroundColor: port.direction === 'input'
93
+ ? theme.semantics.surface.default
94
+ : theme.semantics.brand.base,
95
+ borderColor: port.direction === 'input'
96
+ ? theme.semantics.brand.outline
97
+ : theme.semantics.brand.base,
98
+ borderRadius: 6,
99
+ borderWidth: 2,
100
+ height: 12,
101
+ width: 12,
102
+ }}/>
103
+ </Pressable>
104
+ </View>);
105
+ })}
106
+ </View>) : null}
107
+ <View pointerEvents="none" style={{
108
+ borderColor: props.selected
109
+ ? theme.semantics.selection.border
110
+ : theme.semantics.neutral.divider,
111
+ borderRadius: 12,
112
+ borderWidth: props.selected ? 2 : 1,
113
+ bottom: 0,
114
+ left: 0,
115
+ position: 'absolute',
116
+ right: 0,
117
+ top: 0,
118
+ }}/>
119
+ </View>);
120
+ }
121
+ /*** Translate responder events into controlled screen-pixel move and press callbacks. */
122
+ function useNodeDrag(props) {
123
+ const scrollLock = useScrollGestureLock();
124
+ const propsRef = React.useRef(props);
125
+ React.useLayoutEffect(() => {
126
+ propsRef.current = props;
127
+ });
128
+ const cancelled = React.useRef(false);
129
+ const moved = React.useRef(false);
130
+ const handledByPointer = React.useRef(false);
131
+ const releaseScrollLock = React.useRef(undefined);
132
+ const start = React.useRef(null);
133
+ const interactive = props.onMove !== undefined;
134
+ const handlers = interactive
135
+ ? {
136
+ onResponderGrant: (event) => {
137
+ releaseScrollLock.current = scrollLock.acquire();
138
+ cancelled.current = false;
139
+ moved.current = false;
140
+ start.current = { x: event.nativeEvent.pageX, y: event.nativeEvent.pageY };
141
+ },
142
+ onResponderMove: (event) => {
143
+ const origin = start.current;
144
+ const { onMove, readOnly } = propsRef.current;
145
+ if (!origin || cancelled.current || readOnly)
146
+ return;
147
+ const delta = {
148
+ x: event.nativeEvent.pageX - origin.x,
149
+ y: event.nativeEvent.pageY - origin.y,
150
+ };
151
+ if (Math.abs(delta.x) < DRAG_THRESHOLD && Math.abs(delta.y) < DRAG_THRESHOLD)
152
+ return;
153
+ moved.current = true;
154
+ start.current = { x: event.nativeEvent.pageX, y: event.nativeEvent.pageY };
155
+ onMove?.(delta);
156
+ },
157
+ onResponderRelease: () => {
158
+ releaseScrollLock.current?.();
159
+ releaseScrollLock.current = undefined;
160
+ start.current = null;
161
+ handledByPointer.current = true;
162
+ const { onPress, readOnly } = propsRef.current;
163
+ if (cancelled.current || readOnly || moved.current)
164
+ return;
165
+ onPress?.();
166
+ },
167
+ onResponderTerminate: () => {
168
+ releaseScrollLock.current?.();
169
+ releaseScrollLock.current = undefined;
170
+ cancelled.current = true;
171
+ start.current = null;
172
+ },
173
+ onResponderTerminationRequest: () => false,
174
+ onStartShouldSetResponderCapture: () => !propsRef.current.readOnly && !propsRef.current.disabled,
175
+ }
176
+ : undefined;
177
+ React.useEffect(() => () => {
178
+ releaseScrollLock.current?.();
179
+ releaseScrollLock.current = undefined;
180
+ }, []);
181
+ const press = () => {
182
+ if (handledByPointer.current) {
183
+ handledByPointer.current = false;
184
+ return;
185
+ }
186
+ propsRef.current.onPress?.();
187
+ };
188
+ return { handlers, press };
189
+ }
190
+ //# sourceMappingURL=GraphNode.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GraphNode.js","sourceRoot":"","sources":["../../../../../src/features/graph-node/adapters/inbound/GraphNode.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAG/C,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC9C,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAC5C,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,oDAAoD,CAAC;AACxF,OAAO,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AACvE,OAAO,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAClD,OAAO,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAE1E,MAAM,UAAU,GAAG,CAAC,CAAC;AACrB,MAAM,SAAS,GAAG,EAAE,CAAC;AACrB,MAAM,cAAc,GAAG,CAAC,CAAC;AAEzB,oGAAoG;AACpG,MAAM,CAAC,MAAM,SAAS,GAAG,KAAK,CAAC,IAAI,CAAC,kBAAkB,CAAC,cAAc,CAAC,CAAC,CAAC;AAExE,2DAA2D;AAC3D,SAAS,cAAc,CAAC,KAAqB;IAC3C,MAAM,EAAE,YAAY,EAAE,KAAK,GAAG,EAAE,EAAE,GAAG,KAAK,CAAC;IAC3C,MAAM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AAC;YACjC,OAAO;QACT,CAAC;QACD,QAAQ,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC;IAC/B,CAAC,CAAC;IACF,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;AAC7B,CAAC","sourcesContent":["import React from 'react';\nimport { Pressable, View } from 'react-native';\n\nimport type { GraphNodePoint, GraphNodeProps } from '../../../../types/graph-node';\nimport { Badge } from '../../../badge/public';\nimport { Card } from '../../../card/public';\nimport { Icon } from '../../../icon/public';\nimport { useScrollGestureLock } from '../../../layout/public';\nimport { withZoraThemeScope } from '../../../theme/adapters/inbound/withZoraThemeScope';\nimport { useZoraTheme } from '../../../theme/composition/useZoraTheme';\nimport { Text } from '../../../typography/public';\nimport { getGraphNodePortGeometry } from '../../getGraphNodePortGeometry';\n\nconst PORT_INSET = 4;\nconst PORT_SIZE = 44;\nconst DRAG_THRESHOLD = 2;\n\n/*** Presents one generic node with composed content, optional ports and controlled interactions. */\nexport const GraphNode = React.memo(withZoraThemeScope(GraphNodeInner));\n\n/*** Render node content in the active ZORA theme scope. */\nfunction GraphNodeInner(props: GraphNodeProps) {\n const { onPortLayout, ports = [] } = props;\n const { theme } = useZoraTheme();\n const drag = useNodeDrag(props);\n const portsOffsetY = React.useRef(0);\n const geometry = getGraphNodePortGeometry({ ports, width: props.width });\n const reportPortAnchors = React.useCallback(() => {\n if (!onPortLayout) return;\n getGraphNodePortGeometry({\n ports,\n portsTop: portsOffsetY.current,\n width: props.width,\n }).ports.forEach((port) => onPortLayout(port.id, port.anchor));\n }, [onPortLayout, ports, props.width]);\n React.useLayoutEffect(reportPortAnchors, [reportPortAnchors]);\n const unavailable = props.readOnly === true || props.disabled === true;\n const hasDefaultHeader =\n props.title !== undefined ||\n props.description !== undefined ||\n props.icon !== undefined ||\n props.badge !== undefined;\n\n return (\n <View\n style={{\n backgroundColor: theme.semantics.surface.default,\n borderRadius: 12,\n elevation: props.selected ? 3 : 1,\n shadowColor: theme.semantics.neutral.text,\n shadowOpacity: props.selected ? 0.16 : 0.08,\n shadowRadius: props.selected ? 10 : 6,\n width: geometry.width,\n }}\n testID={props.testID ? `${props.testID}-frame` : undefined}\n >\n <Card\n compact\n padding=\"xs\"\n radius=\"m\"\n style={{ borderWidth: 0, elevation: 0, shadowOpacity: 0 }}\n >\n <View accessible={false} collapsable={false} {...drag.handlers}>\n {hasDefaultHeader ? (\n <Pressable\n aria-selected={props.selected === true}\n accessibilityHint={props.onMove ? 'Select this node. Drag to move it.' : undefined}\n accessibilityLabel={props.title}\n accessibilityRole=\"button\"\n accessibilityState={{ disabled: unavailable, selected: props.selected === true }}\n disabled={props.onPress === undefined || unavailable}\n style={{ alignItems: 'flex-start', flexDirection: 'row', gap: 8 }}\n testID={props.testID}\n onPress={drag.press}\n >\n {props.icon ? (\n <View\n accessible={false}\n style={{\n alignItems: 'center',\n backgroundColor: theme.semantics.brand.softBg,\n borderRadius: 10,\n height: 36,\n justifyContent: 'center',\n width: 36,\n }}\n >\n <Icon color={theme.semantics.brand.onSoftText} size={20} {...props.icon} />\n </View>\n ) : null}\n <View style={{ flex: 1, minWidth: 0 }}>\n {props.title ? (\n <Text ellipsizeMode=\"tail\" numberOfLines={1} variant=\"body\" weight=\"bold\">\n {props.title}\n </Text>\n ) : null}\n {props.description ? (\n <Text ellipsizeMode=\"tail\" emphasis=\"muted\" numberOfLines={2} variant=\"bodySmall\">\n {props.description}\n </Text>\n ) : null}\n </View>\n {props.badge ? <Badge size=\"s\">{props.badge}</Badge> : null}\n </Pressable>\n ) : null}\n {props.children}\n </View>\n </Card>\n {ports.length > 0 ? (\n <View\n style={{ paddingHorizontal: PORT_INSET }}\n onLayout={(event) => {\n portsOffsetY.current = event.nativeEvent.layout.y;\n reportPortAnchors();\n }}\n >\n {ports.map((port) => {\n const disabled = unavailable || port.disabled === true;\n return (\n <View\n key={port.id}\n style={{\n alignItems: 'center',\n flexDirection: 'row',\n height: PORT_SIZE,\n justifyContent: port.direction === 'input' ? 'flex-start' : 'flex-end',\n }}\n >\n <Pressable\n accessibilityHint={`Connect ${port.direction} port`}\n accessibilityLabel={`${props.title}: ${port.label}`}\n accessibilityRole=\"button\"\n accessibilityState={{ disabled }}\n disabled={disabled || props.onPortPress === undefined}\n style={{\n alignItems: 'center',\n height: PORT_SIZE,\n justifyContent: 'center',\n width: PORT_SIZE,\n }}\n testID={port.testID}\n onPress={() => props.onPortPress?.(port.id)}\n >\n <View\n accessible={false}\n style={{\n backgroundColor:\n port.direction === 'input'\n ? theme.semantics.surface.default\n : theme.semantics.brand.base,\n borderColor:\n port.direction === 'input'\n ? theme.semantics.brand.outline\n : theme.semantics.brand.base,\n borderRadius: 6,\n borderWidth: 2,\n height: 12,\n width: 12,\n }}\n />\n </Pressable>\n </View>\n );\n })}\n </View>\n ) : null}\n <View\n pointerEvents=\"none\"\n style={{\n borderColor: props.selected\n ? theme.semantics.selection.border\n : theme.semantics.neutral.divider,\n borderRadius: 12,\n borderWidth: props.selected ? 2 : 1,\n bottom: 0,\n left: 0,\n position: 'absolute',\n right: 0,\n top: 0,\n }}\n />\n </View>\n );\n}\n\n/*** Translate responder events into controlled screen-pixel move and press callbacks. */\nfunction useNodeDrag(props: GraphNodeProps) {\n const scrollLock = useScrollGestureLock();\n const propsRef = React.useRef(props);\n React.useLayoutEffect(() => {\n propsRef.current = props;\n });\n const cancelled = React.useRef(false);\n const moved = React.useRef(false);\n const handledByPointer = React.useRef(false);\n const releaseScrollLock = React.useRef<(() => void) | undefined>(undefined);\n const start = React.useRef<GraphNodePoint | null>(null);\n const interactive = props.onMove !== undefined;\n const handlers = interactive\n ? {\n onResponderGrant: (event: ResponderEvent) => {\n releaseScrollLock.current = scrollLock.acquire();\n cancelled.current = false;\n moved.current = false;\n start.current = { x: event.nativeEvent.pageX, y: event.nativeEvent.pageY };\n },\n onResponderMove: (event: ResponderEvent) => {\n const origin = start.current;\n const { onMove, readOnly } = propsRef.current;\n if (!origin || cancelled.current || readOnly) return;\n const delta = {\n x: event.nativeEvent.pageX - origin.x,\n y: event.nativeEvent.pageY - origin.y,\n };\n if (Math.abs(delta.x) < DRAG_THRESHOLD && Math.abs(delta.y) < DRAG_THRESHOLD) return;\n moved.current = true;\n start.current = { x: event.nativeEvent.pageX, y: event.nativeEvent.pageY };\n onMove?.(delta);\n },\n onResponderRelease: () => {\n releaseScrollLock.current?.();\n releaseScrollLock.current = undefined;\n start.current = null;\n handledByPointer.current = true;\n const { onPress, readOnly } = propsRef.current;\n if (cancelled.current || readOnly || moved.current) return;\n onPress?.();\n },\n onResponderTerminate: () => {\n releaseScrollLock.current?.();\n releaseScrollLock.current = undefined;\n cancelled.current = true;\n start.current = null;\n },\n onResponderTerminationRequest: () => false,\n onStartShouldSetResponderCapture: () =>\n !propsRef.current.readOnly && !propsRef.current.disabled,\n }\n : undefined;\n React.useEffect(\n () => () => {\n releaseScrollLock.current?.();\n releaseScrollLock.current = undefined;\n },\n [],\n );\n const press = () => {\n if (handledByPointer.current) {\n handledByPointer.current = false;\n return;\n }\n propsRef.current.onPress?.();\n };\n return { handlers, press };\n}\n\ninterface ResponderEvent {\n readonly nativeEvent: { readonly pageX: number; readonly pageY: number };\n}\n"]}
@@ -0,0 +1,17 @@
1
+ import type { GraphNodePoint, GraphNodePort } from '../../types/graph-node';
2
+ type GraphNodePortGeometry = Readonly<{
3
+ readonly anchor: GraphNodePoint;
4
+ readonly id: string;
5
+ }>;
6
+ /*** Resolves the canonical GraphNode port anchors and virtualized height from its rendered layout. */
7
+ export declare function getGraphNodePortGeometry(input: Readonly<{
8
+ readonly ports: readonly GraphNodePort[];
9
+ readonly portsTop?: number;
10
+ readonly width?: number;
11
+ }>): Readonly<{
12
+ readonly height: number;
13
+ readonly ports: readonly GraphNodePortGeometry[];
14
+ readonly width: number;
15
+ }>;
16
+ export {};
17
+ //# sourceMappingURL=getGraphNodePortGeometry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getGraphNodePortGeometry.d.ts","sourceRoot":"","sources":["../../../src/features/graph-node/getGraphNodePortGeometry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAO5E,KAAK,qBAAqB,GAAG,QAAQ,CAAC;IACpC,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC;IAChC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;CACrB,CAAC,CAAC;AAEH,sGAAsG;AACtG,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,QAAQ,CAAC;IACd,QAAQ,CAAC,KAAK,EAAE,SAAS,aAAa,EAAE,CAAC;IACzC,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC,GACD,QAAQ,CAAC;IACV,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,KAAK,EAAE,SAAS,qBAAqB,EAAE,CAAC;IACjD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB,CAAC,CAiBD"}
@@ -0,0 +1,23 @@
1
+ const DEFAULT_GRAPH_NODE_WIDTH = 224;
2
+ const DEFAULT_PORTS_TOP = 32;
3
+ const PORT_INSET = 4;
4
+ const PORT_SIZE = 44;
5
+ /*** Resolves the canonical GraphNode port anchors and virtualized height from its rendered layout. */
6
+ export function getGraphNodePortGeometry(input) {
7
+ const width = input.width ?? DEFAULT_GRAPH_NODE_WIDTH;
8
+ const portsTop = input.portsTop ?? DEFAULT_PORTS_TOP;
9
+ return {
10
+ height: portsTop + input.ports.length * PORT_SIZE,
11
+ ports: input.ports.map((port, index) => ({
12
+ anchor: {
13
+ x: port.direction === 'input'
14
+ ? PORT_INSET + PORT_SIZE / 2
15
+ : width - PORT_INSET - PORT_SIZE / 2,
16
+ y: portsTop + index * PORT_SIZE + PORT_SIZE / 2,
17
+ },
18
+ id: port.id,
19
+ })),
20
+ width,
21
+ };
22
+ }
23
+ //# sourceMappingURL=getGraphNodePortGeometry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getGraphNodePortGeometry.js","sourceRoot":"","sources":["../../../src/features/graph-node/getGraphNodePortGeometry.ts"],"names":[],"mappings":"AAEA,MAAM,wBAAwB,GAAG,GAAG,CAAC;AACrC,MAAM,iBAAiB,GAAG,EAAE,CAAC;AAC7B,MAAM,UAAU,GAAG,CAAC,CAAC;AACrB,MAAM,SAAS,GAAG,EAAE,CAAC;AAOrB,sGAAsG;AACtG,MAAM,UAAU,wBAAwB,CACtC,KAIE;IAMF,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,IAAI,wBAAwB,CAAC;IACtD,MAAM,QAAQ,GAAG,KAAK,CAAC,QAAQ,IAAI,iBAAiB,CAAC;IACrD,OAAO;QACL,MAAM,EAAE,QAAQ,GAAG,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,SAAS;QACjD,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC;YACvC,MAAM,EAAE;gBACN,CAAC,EACC,IAAI,CAAC,SAAS,KAAK,OAAO;oBACxB,CAAC,CAAC,UAAU,GAAG,SAAS,GAAG,CAAC;oBAC5B,CAAC,CAAC,KAAK,GAAG,UAAU,GAAG,SAAS,GAAG,CAAC;gBACxC,CAAC,EAAE,QAAQ,GAAG,KAAK,GAAG,SAAS,GAAG,SAAS,GAAG,CAAC;aAChD;YACD,EAAE,EAAE,IAAI,CAAC,EAAE;SACZ,CAAC,CAAC;QACH,KAAK;KACN,CAAC;AACJ,CAAC","sourcesContent":["import type { GraphNodePoint, GraphNodePort } from '../../types/graph-node';\n\nconst DEFAULT_GRAPH_NODE_WIDTH = 224;\nconst DEFAULT_PORTS_TOP = 32;\nconst PORT_INSET = 4;\nconst PORT_SIZE = 44;\n\ntype GraphNodePortGeometry = Readonly<{\n readonly anchor: GraphNodePoint;\n readonly id: string;\n}>;\n\n/*** Resolves the canonical GraphNode port anchors and virtualized height from its rendered layout. */\nexport function getGraphNodePortGeometry(\n input: Readonly<{\n readonly ports: readonly GraphNodePort[];\n readonly portsTop?: number;\n readonly width?: number;\n }>,\n): Readonly<{\n readonly height: number;\n readonly ports: readonly GraphNodePortGeometry[];\n readonly width: number;\n}> {\n const width = input.width ?? DEFAULT_GRAPH_NODE_WIDTH;\n const portsTop = input.portsTop ?? DEFAULT_PORTS_TOP;\n return {\n height: portsTop + input.ports.length * PORT_SIZE,\n ports: input.ports.map((port, index) => ({\n anchor: {\n x:\n port.direction === 'input'\n ? PORT_INSET + PORT_SIZE / 2\n : width - PORT_INSET - PORT_SIZE / 2,\n y: portsTop + index * PORT_SIZE + PORT_SIZE / 2,\n },\n id: port.id,\n })),\n width,\n };\n}\n"]}
@@ -0,0 +1,3 @@
1
+ export type { GraphNodePoint, GraphNodePort, GraphNodeProps } from '../../types/graph-node';
2
+ export { GraphNode } from './adapters/inbound/GraphNode';
3
+ //# sourceMappingURL=public.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../../src/features/graph-node/public.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,cAAc,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC5F,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { GraphNode } from './adapters/inbound/GraphNode.js';
2
+ //# sourceMappingURL=public.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"public.js","sourceRoot":"","sources":["../../../src/features/graph-node/public.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC","sourcesContent":["export type { GraphNodePoint, GraphNodePort, GraphNodeProps } from '../../types/graph-node';\nexport { GraphNode } from './adapters/inbound/GraphNode';\n"]}
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
2
  import type { GridViewProps } from '../../../../types/grid-view';
3
3
  /*** Renders a controlled or uncontrolled, virtualized 2D world through the canonical grid viewport engine. */
4
- export declare function GridView({ items, contentWidth, contentHeight, width, height, viewport: controlledViewport, defaultViewport, viewportConstraints, zoomLimits, zoom, overscanPixels, focusedItemId, revealPaddingPixels, interactionPolicy, onViewportChange, onVisibleItemIdsChange, renderItem, testID, viewportInteraction, }: GridViewProps): React.JSX.Element;
4
+ export declare function GridView({ items, contentWidth, contentHeight, width, height, viewport: controlledViewport, defaultViewport, viewportConstraints, zoomLimits, zoom, overscanPixels, focusedItemId, revealPaddingPixels, interactionPolicy, onViewportChange, onVisibleItemIdsChange, renderItem, testID, viewportInteraction, viewportControls, renderWorldLayer, }: GridViewProps): React.JSX.Element;
5
5
  //# sourceMappingURL=GridView.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"GridView.d.ts","sourceRoot":"","sources":["../../../../../src/features/grid-view/adapters/inbound/GridView.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,MAAM,OAAO,CAAC;AAQ1B,OAAO,KAAK,EAAkC,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAkBjG,8GAA8G;AAC9G,wBAAgB,QAAQ,CAAC,EACvB,KAAK,EACL,YAAY,EACZ,aAAa,EACb,KAAK,EACL,MAAM,EACN,QAAQ,EAAE,kBAAkB,EAC5B,eAAe,EACf,mBAAmB,EACnB,UAAU,EACV,IAAQ,EACR,cAAoB,EACpB,aAAa,EACb,mBAAuB,EACvB,iBAAiB,EACjB,gBAAgB,EAChB,sBAAsB,EACtB,UAAU,EACV,MAAM,EACN,mBAA+B,GAChC,EAAE,aAAa,qBAoYf"}
1
+ {"version":3,"file":"GridView.d.ts","sourceRoot":"","sources":["../../../../../src/features/grid-view/adapters/inbound/GridView.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,MAAM,OAAO,CAAC;AAS1B,OAAO,KAAK,EAAkC,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAqBjG,8GAA8G;AAC9G,wBAAgB,QAAQ,CAAC,EACvB,KAAK,EACL,YAAY,EACZ,aAAa,EACb,KAAK,EACL,MAAM,EACN,QAAQ,EAAE,kBAAkB,EAC5B,eAAe,EACf,mBAAmB,EACnB,UAAU,EACV,IAAQ,EACR,cAAoB,EACpB,aAAa,EACb,mBAAuB,EACvB,iBAAiB,EACjB,gBAAgB,EAChB,sBAAsB,EACtB,UAAU,EACV,MAAM,EACN,mBAA+B,EAC/B,gBAA4B,EAC5B,gBAAgB,GACjB,EAAE,aAAa,qBA8df"}
@@ -1,21 +1,27 @@
1
1
  import { constrainViewport, getVisibleGridItems, panViewport, revealWorldRect, worldToViewport, zoomViewportAt, } from '@ankhorage/grid-view';
2
2
  import React from 'react';
3
- import { Pressable as NativePressable, ScrollView as NativeScrollView, Text as NativeText, View as NativeView, } from 'react-native';
3
+ import { Platform, Pressable as NativePressable, ScrollView as NativeScrollView, Text as NativeText, View as NativeView, } from 'react-native';
4
+ import { ScrollGestureLockContext } from '../../../layout/adapters/inbound/ScrollGestureLockContext.js';
5
+ import { useScrollGestureLock } from '../../../layout/adapters/inbound/useScrollGestureLock.js';
6
+ import { createScrollGestureLock } from '../../../layout/utils/createScrollGestureLock.js';
4
7
  import { createGridScrollSync } from '../../application/createGridScrollSync.js';
5
8
  /*** Renders a controlled or uncontrolled, virtualized 2D world through the canonical grid viewport engine. */
6
- export function GridView({ items, contentWidth, contentHeight, width, height, viewport: controlledViewport, defaultViewport, viewportConstraints, zoomLimits, zoom = 1, overscanPixels = 160, focusedItemId, revealPaddingPixels = 8, interactionPolicy, onViewportChange, onVisibleItemIdsChange, renderItem, testID, viewportInteraction = 'enabled', }) {
9
+ export function GridView({ items, contentWidth, contentHeight, width, height, viewport: controlledViewport, defaultViewport, viewportConstraints, zoomLimits, zoom = 1, overscanPixels = 160, focusedItemId, revealPaddingPixels = 8, interactionPolicy, onViewportChange, onVisibleItemIdsChange, renderItem, testID, viewportInteraction = 'enabled', viewportControls = 'visible', renderWorldLayer, }) {
10
+ const parentScrollLock = useScrollGestureLock();
7
11
  const [uncontrolledViewport, setUncontrolledViewport] = React.useState(() => createInitialViewport(width, height, zoom, defaultViewport));
8
12
  const horizontalScrollRef = React.useRef(null);
9
13
  const verticalScrollRef = React.useRef(null);
10
14
  const gridRef = React.useRef(null);
11
15
  const panRef = React.useRef(() => undefined);
12
16
  const scrollSyncRef = React.useRef(undefined);
17
+ const dragPanRef = React.useRef(undefined);
13
18
  const pinchGestureRef = React.useRef(undefined);
14
19
  const pinchMeasurementRef = React.useRef(0);
15
20
  const pinchSessionRef = React.useRef(0);
16
21
  const viewportOriginRef = React.useRef({ x: 0, y: 0 });
17
22
  const focusRevealProposalRef = React.useRef(undefined);
18
23
  const focusRevealViewportRef = React.useRef(undefined);
24
+ const [activeItemGestures, setActiveItemGestures] = React.useState(0);
19
25
  const [isPinching, setIsPinching] = React.useState(false);
20
26
  const constraints = React.useMemo(() => viewportConstraints ?? createContentConstraints(contentWidth, contentHeight), [contentHeight, contentWidth, viewportConstraints]);
21
27
  const sourceViewport = controlledViewport ?? uncontrolledViewport;
@@ -33,6 +39,7 @@ export function GridView({ items, contentWidth, contentHeight, width, height, vi
33
39
  const uncontrolled = controlledViewport === undefined;
34
40
  const interactive = interactionPolicy !== 'passive';
35
41
  const viewportInteractive = interactive && viewportInteraction === 'enabled';
42
+ const scrollLock = React.useMemo(() => createScrollGestureLock(parentScrollLock, (delta) => setActiveItemGestures((count) => count + delta)), [parentScrollLock]);
36
43
  const publish = React.useCallback((nextViewport) => {
37
44
  if (areViewportsEqual(viewportRef.current, nextViewport))
38
45
  return;
@@ -47,7 +54,7 @@ export function GridView({ items, contentWidth, contentHeight, width, height, vi
47
54
  pixelsPerUnitX: viewportRef.current.pixelsPerUnitX * factor,
48
55
  pixelsPerUnitY: viewportRef.current.pixelsPerUnitY * factor,
49
56
  }, zoomLimits, constraints));
50
- React.useEffect(() => {
57
+ React.useLayoutEffect(() => {
51
58
  viewportRef.current = viewport;
52
59
  }, [viewport]);
53
60
  React.useEffect(() => {
@@ -59,7 +66,7 @@ export function GridView({ items, contentWidth, contentHeight, width, height, vi
59
66
  // Declared before the viewport-sync effect so the arbiter exists when that effect runs.
60
67
  React.useEffect(() => {
61
68
  const scrollSync = createGridScrollSync({
62
- onProgrammaticScroll: (axis, displacement) => panRef.current(axis === 'x' ? { x: -displacement, y: 0 } : { x: 0, y: -displacement }),
69
+ acceptUnownedScroll: Platform.OS === 'web',
63
70
  onUserScroll: (axis, displacement) => panRef.current(axis === 'x' ? { x: -displacement, y: 0 } : { x: 0, y: -displacement }),
64
71
  scrollTo: (axis, offset, animated) => {
65
72
  if (axis === 'x')
@@ -74,11 +81,34 @@ export function GridView({ items, contentWidth, contentHeight, width, height, vi
74
81
  scrollSyncRef.current = undefined;
75
82
  };
76
83
  }, []);
77
- /** Routes native scroll events to the arbiter unless a pinch owns the gesture. */
84
+ /** Routes native scroll events to the arbiter unless a pinch or an item gesture owns the scroll. */
78
85
  const handleNativeScroll = (axis, offset) => {
86
+ if (scrollLock.isActive?.()) {
87
+ const mapping = createScrollMapping(viewportRef.current, constraints);
88
+ scrollSyncRef.current?.restore(axis, offset, axis === 'x' ? mapping.horizontal.position : mapping.vertical.position);
89
+ return;
90
+ }
79
91
  if (!pinchGestureRef.current)
80
92
  scrollSyncRef.current?.scrolled(axis, offset);
81
93
  };
94
+ /*** Keeps locked native lifecycle signals under the same restore ownership as their scroll frames. */
95
+ const handleNativeScrollBegan = (axis, offset) => {
96
+ if (scrollLock.isActive?.()) {
97
+ const mapping = createScrollMapping(viewportRef.current, constraints);
98
+ scrollSyncRef.current?.restore(axis, offset, axis === 'x' ? mapping.horizontal.position : mapping.vertical.position);
99
+ return;
100
+ }
101
+ scrollSyncRef.current?.dragBegan(axis, offset);
102
+ };
103
+ /*** Keeps locked native completion signals from settling a descendant gesture as a viewport pan. */
104
+ const handleNativeScrollEnded = (axis, offset) => {
105
+ if (scrollLock.isActive?.()) {
106
+ const mapping = createScrollMapping(viewportRef.current, constraints);
107
+ scrollSyncRef.current?.restore(axis, offset, axis === 'x' ? mapping.horizontal.position : mapping.vertical.position);
108
+ return;
109
+ }
110
+ scrollSyncRef.current?.scrollEnded(axis, offset);
111
+ };
82
112
  const refreshViewportOrigin = React.useCallback(() => {
83
113
  gridRef.current?.measureInWindow((x, y) => {
84
114
  viewportOriginRef.current = { x, y };
@@ -180,7 +210,8 @@ export function GridView({ items, contentWidth, contentHeight, width, height, vi
180
210
  };
181
211
  scrollSyncRef.current?.request(nextPosition, false);
182
212
  };
183
- return (<NativeView ref={gridRef} accessibilityLabel="Interactive grid viewport" onLayout={refreshViewportOrigin} onTouchEnd={() => {
213
+ return (<ScrollGestureLockContext.Provider value={scrollLock}>
214
+ <NativeView ref={gridRef} accessibilityLabel="Interactive grid viewport" onLayout={refreshViewportOrigin} onTouchEnd={() => {
184
215
  const wasPinching = pinchGestureRef.current !== undefined;
185
216
  pinchMeasurementRef.current += 1;
186
217
  pinchSessionRef.current += 1;
@@ -215,13 +246,39 @@ export function GridView({ items, contentWidth, contentHeight, width, height, vi
215
246
  setIsPinching(pinch !== undefined);
216
247
  });
217
248
  }} style={{ height, overflow: 'hidden', width }} testID={testID}>
218
- <NativeScrollView ref={horizontalScrollRef} testID={testID ? `${testID}-horizontal-scroll` : undefined} horizontal scrollEnabled={viewportInteractive && !isPinching} scrollEventThrottle={16} showsHorizontalScrollIndicator style={{ height, width }} onMomentumScrollEnd={(event) => scrollSyncRef.current?.scrollEnded('x', event.nativeEvent.contentOffset.x)} onScroll={(event) => handleNativeScroll('x', event.nativeEvent.contentOffset.x)} onScrollBeginDrag={(event) => scrollSyncRef.current?.dragBegan('x', event.nativeEvent.contentOffset.x)}>
219
- <NativeScrollView ref={verticalScrollRef} testID={testID ? `${testID}-vertical-scroll` : undefined} scrollEnabled={viewportInteractive && !isPinching} scrollEventThrottle={16} showsVerticalScrollIndicator style={{ height, width: scrollMapping.horizontal.contentSize }} onMomentumScrollEnd={(event) => scrollSyncRef.current?.scrollEnded('y', event.nativeEvent.contentOffset.y)} onScroll={(event) => handleNativeScroll('y', event.nativeEvent.contentOffset.y)} onScrollBeginDrag={(event) => scrollSyncRef.current?.dragBegan('y', event.nativeEvent.contentOffset.y)}>
220
- <NativeView style={{
249
+ <NativeScrollView ref={horizontalScrollRef} disableScrollViewPanResponder nestedScrollEnabled testID={testID ? `${testID}-horizontal-scroll` : undefined} horizontal scrollEnabled={viewportInteractive && activeItemGestures === 0 && !isPinching} scrollEventThrottle={16} showsHorizontalScrollIndicator style={{ height, width }} onMomentumScrollEnd={(event) => handleNativeScrollEnded('x', event.nativeEvent.contentOffset.x)} onScroll={(event) => handleNativeScroll('x', event.nativeEvent.contentOffset.x)} onScrollBeginDrag={(event) => handleNativeScrollBegan('x', event.nativeEvent.contentOffset.x)}>
250
+ <NativeScrollView ref={verticalScrollRef} disableScrollViewPanResponder nestedScrollEnabled testID={testID ? `${testID}-vertical-scroll` : undefined} scrollEnabled={viewportInteractive && activeItemGestures === 0 && !isPinching} scrollEventThrottle={16} showsVerticalScrollIndicator style={{ height, width: scrollMapping.horizontal.contentSize }} onMomentumScrollEnd={(event) => handleNativeScrollEnded('y', event.nativeEvent.contentOffset.y)} onScroll={(event) => handleNativeScroll('y', event.nativeEvent.contentOffset.y)} onScrollBeginDrag={(event) => handleNativeScrollBegan('y', event.nativeEvent.contentOffset.y)}>
251
+ <NativeView style={{
221
252
  height: scrollMapping.vertical.contentSize,
222
253
  width: scrollMapping.horizontal.contentSize,
223
254
  }}>
224
- {visibleItems.map((item) => {
255
+ {Platform.OS === 'web' && viewportInteractive ? (<NativeView accessible={false} onResponderGrant={(event) => {
256
+ dragPanRef.current = { x: event.nativeEvent.pageX, y: event.nativeEvent.pageY };
257
+ }} onResponderMove={(event) => {
258
+ const previous = dragPanRef.current;
259
+ if (!previous)
260
+ return;
261
+ const next = { x: event.nativeEvent.pageX, y: event.nativeEvent.pageY };
262
+ dragPanRef.current = next;
263
+ pan({ x: next.x - previous.x, y: next.y - previous.y });
264
+ }} onResponderRelease={() => {
265
+ dragPanRef.current = undefined;
266
+ }} onResponderTerminate={() => {
267
+ dragPanRef.current = undefined;
268
+ }} onStartShouldSetResponderCapture={() => true} style={fillStyle} testID={testID ? `${testID}-background` : undefined}/>) : null}
269
+ {renderWorldLayer ? (<NativeView pointerEvents="box-none" style={fillStyle}>
270
+ {renderWorldLayer({
271
+ height: scrollMapping.vertical.contentSize,
272
+ origin: {
273
+ x: scrollMapping.horizontal.origin,
274
+ y: scrollMapping.vertical.origin,
275
+ },
276
+ pixelsPerUnitX: viewport.pixelsPerUnitX,
277
+ pixelsPerUnitY: viewport.pixelsPerUnitY,
278
+ width: scrollMapping.horizontal.contentSize,
279
+ })}
280
+ </NativeView>) : null}
281
+ {visibleItems.map((item) => {
225
282
  const position = worldToViewport({ x: item.x, y: item.y }, { ...viewport, offsetX: 0, offsetY: 0 });
226
283
  return (<NativeView key={item.id} style={{
227
284
  height: item.height * viewport.pixelsPerUnitY,
@@ -230,35 +287,38 @@ export function GridView({ items, contentWidth, contentHeight, width, height, vi
230
287
  top: position.y + scrollMapping.vertical.origin,
231
288
  width: item.width * viewport.pixelsPerUnitX,
232
289
  }}>
233
- {renderItem(item)}
234
- </NativeView>);
290
+ {renderItem(item)}
291
+ </NativeView>);
235
292
  })}
236
- </NativeView>
293
+ </NativeView>
294
+ </NativeScrollView>
237
295
  </NativeScrollView>
238
- </NativeScrollView>
239
- {viewportInteractive ? (<NativeView accessibilityLabel="Viewport controls" style={controlsStyle}>
240
- <NativePressable accessibilityLabel="Pan left" accessibilityRole="button" onPress={() => pan({ x: 48, y: 0 })}>
241
- <NativeText>←</NativeText>
242
- </NativePressable>
243
- <NativePressable accessibilityLabel="Pan right" accessibilityRole="button" onPress={() => pan({ x: -48, y: 0 })}>
244
- <NativeText>→</NativeText>
245
- </NativePressable>
246
- <NativePressable accessibilityLabel="Pan up" accessibilityRole="button" onPress={() => pan({ x: 0, y: 48 })}>
247
- <NativeText>↑</NativeText>
248
- </NativePressable>
249
- <NativePressable accessibilityLabel="Pan down" accessibilityRole="button" onPress={() => pan({ x: 0, y: -48 })}>
250
- <NativeText>↓</NativeText>
251
- </NativePressable>
252
- <NativePressable accessibilityLabel="Zoom in" accessibilityRole="button" onPress={() => zoomAt({ x: width / 2, y: height / 2 }, 1.2)}>
253
- <NativeText>+</NativeText>
254
- </NativePressable>
255
- <NativePressable accessibilityLabel="Zoom out" accessibilityRole="button" onPress={() => zoomAt({ x: width / 2, y: height / 2 }, 1 / 1.2)}>
256
- <NativeText>−</NativeText>
257
- </NativePressable>
258
- </NativeView>) : null}
259
- </NativeView>);
296
+ {viewportInteractive && viewportControls === 'visible' ? (<NativeView accessibilityLabel="Viewport controls" style={controlsStyle}>
297
+ <NativePressable accessibilityLabel="Pan left" accessibilityRole="button" onPress={() => pan({ x: 48, y: 0 })}>
298
+ <NativeText>←</NativeText>
299
+ </NativePressable>
300
+ <NativePressable accessibilityLabel="Pan right" accessibilityRole="button" onPress={() => pan({ x: -48, y: 0 })}>
301
+ <NativeText>→</NativeText>
302
+ </NativePressable>
303
+ <NativePressable accessibilityLabel="Pan up" accessibilityRole="button" onPress={() => pan({ x: 0, y: 48 })}>
304
+ <NativeText>↑</NativeText>
305
+ </NativePressable>
306
+ <NativePressable accessibilityLabel="Pan down" accessibilityRole="button" onPress={() => pan({ x: 0, y: -48 })}>
307
+ <NativeText>↓</NativeText>
308
+ </NativePressable>
309
+ <NativePressable accessibilityLabel="Zoom in" accessibilityRole="button" onPress={() => zoomAt({ x: width / 2, y: height / 2 }, 1.2)}>
310
+ <NativeText>+</NativeText>
311
+ </NativePressable>
312
+ <NativePressable accessibilityLabel="Zoom out" accessibilityRole="button" onPress={() => zoomAt({ x: width / 2, y: height / 2 }, 1 / 1.2)}>
313
+ <NativeText>−</NativeText>
314
+ </NativePressable>
315
+ </NativeView>) : null}
316
+ </NativeView>
317
+ </ScrollGestureLockContext.Provider>);
260
318
  }
319
+ const fillStyle = { bottom: 0, left: 0, position: 'absolute', right: 0, top: 0 };
261
320
  const controlsStyle = { bottom: 8, gap: 4, position: 'absolute', right: 8 };
321
+ const VIEWPORT_NUMERIC_TOLERANCE = Number.EPSILON * 1024;
262
322
  /*** Builds the initial world position and independent scales for uncontrolled rendering. */
263
323
  function createInitialViewport(width, height, zoom, viewport) {
264
324
  return {
@@ -308,12 +368,16 @@ function createScrollAxisMapping({ maximum, minimum, offset, scale, viewportSize
308
368
  }
309
369
  /*** Compares canonical viewport fields without treating equal proposals as state changes. */
310
370
  function areViewportsEqual(left, right) {
311
- return (left.width === right.width &&
312
- left.height === right.height &&
313
- left.offsetX === right.offsetX &&
314
- left.offsetY === right.offsetY &&
315
- left.pixelsPerUnitX === right.pixelsPerUnitX &&
316
- left.pixelsPerUnitY === right.pixelsPerUnitY);
371
+ return (areViewportValuesEqual(left.width, right.width) &&
372
+ areViewportValuesEqual(left.height, right.height) &&
373
+ areViewportValuesEqual(left.offsetX, right.offsetX) &&
374
+ areViewportValuesEqual(left.offsetY, right.offsetY) &&
375
+ areViewportValuesEqual(left.pixelsPerUnitX, right.pixelsPerUnitX) &&
376
+ areViewportValuesEqual(left.pixelsPerUnitY, right.pixelsPerUnitY));
377
+ }
378
+ /*** Treats machine-scale arithmetic residue as unchanged without rounding real viewport movement. */
379
+ function areViewportValuesEqual(left, right) {
380
+ return Math.abs(left - right) <= VIEWPORT_NUMERIC_TOLERANCE;
317
381
  }
318
382
  /*** Skips a rejected controlled focus proposal until its focus or incoming viewport changes. */
319
383
  function isRepeatedControlledFocusRevealProposal({ controlled, focusedItemId, previous, sourceViewport, viewport, }) {