@ankhorage/zora 28.10.0 → 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 +16 -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 +24 -6
  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
@@ -1 +1 @@
1
- {"version":3,"file":"GridView.js","sourceRoot":"","sources":["../../../../../src/features/grid-view/adapters/inbound/GridView.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EAInB,WAAW,EACX,eAAe,EACf,eAAe,EACf,cAAc,GACf,MAAM,sBAAsB,CAAC;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AC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC;YACpF,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC;SACtF;KACF,CAAC;AACJ,CAAC","sourcesContent":["import {\n constrainViewport,\n getVisibleGridItems,\n type GridPoint,\n type GridViewport,\n type GridViewportConstraints,\n panViewport,\n revealWorldRect,\n worldToViewport,\n zoomViewportAt,\n} from '@ankhorage/grid-view';\nimport React from 'react';\nimport {\n Pressable as NativePressable,\n ScrollView as NativeScrollView,\n Text as NativeText,\n View as NativeView,\n} from 'react-native';\n\nimport type { GridScrollAxis, GridScrollSync, GridViewProps } from '../../../../types/grid-view';\nimport type { ReactNativeComponentInstance } from '../../../../types/react-native';\nimport { createGridScrollSync } from '../../application/createGridScrollSync';\n\ntype PinchGesture = Readonly<{ distance: number; focalPoint: GridPoint }>;\ntype ScrollAxisMapping = Readonly<{ contentSize: number; origin: number; position: number }>;\ntype ScrollMapping = Readonly<{\n horizontal: ScrollAxisMapping;\n vertical: ScrollAxisMapping;\n}>;\ntype ViewportOrigin = Readonly<{ x: number; y: number }>;\ntype FocusRevealProposal = Readonly<{\n focusedItemId: string;\n sourceViewport: GridViewport;\n viewport: GridViewport;\n}>;\ntype PinchTouch = Readonly<{ pageX: number; pageY: number }>;\n\n/*** Renders a controlled or uncontrolled, virtualized 2D world through the canonical grid viewport engine. */\nexport function GridView({\n items,\n contentWidth,\n contentHeight,\n width,\n height,\n viewport: controlledViewport,\n defaultViewport,\n viewportConstraints,\n zoomLimits,\n zoom = 1,\n overscanPixels = 160,\n focusedItemId,\n revealPaddingPixels = 8,\n interactionPolicy,\n onViewportChange,\n onVisibleItemIdsChange,\n renderItem,\n testID,\n viewportInteraction = 'enabled',\n}: GridViewProps) {\n const [uncontrolledViewport, setUncontrolledViewport] = React.useState(() =>\n createInitialViewport(width, height, zoom, defaultViewport),\n );\n const horizontalScrollRef =\n React.useRef<ReactNativeComponentInstance<typeof NativeScrollView>>(null);\n const verticalScrollRef =\n React.useRef<ReactNativeComponentInstance<typeof NativeScrollView>>(null);\n const gridRef = React.useRef<ReactNativeComponentInstance<typeof NativeView>>(null);\n const panRef = React.useRef<(displacement: GridPoint) => void>(() => undefined);\n const scrollSyncRef = React.useRef<GridScrollSync | undefined>(undefined);\n const pinchGestureRef = React.useRef<PinchGesture | undefined>(undefined);\n const pinchMeasurementRef = React.useRef(0);\n const pinchSessionRef = React.useRef(0);\n const viewportOriginRef = React.useRef<ViewportOrigin>({ x: 0, y: 0 });\n const focusRevealProposalRef = React.useRef<FocusRevealProposal | undefined>(undefined);\n const focusRevealViewportRef = React.useRef<GridViewport | undefined>(undefined);\n const [isPinching, setIsPinching] = React.useState(false);\n const constraints = React.useMemo(\n () => viewportConstraints ?? createContentConstraints(contentWidth, contentHeight),\n [contentHeight, contentWidth, viewportConstraints],\n );\n const sourceViewport = controlledViewport ?? uncontrolledViewport;\n const viewport = React.useMemo(\n () => constrainViewport({ ...sourceViewport, height, width }, constraints),\n [constraints, height, sourceViewport, width],\n );\n const viewportRef = React.useRef(viewport);\n const visibleItems = React.useMemo(\n () => getVisibleGridItems(items, viewport, overscanPixels),\n [items, overscanPixels, viewport],\n );\n const viewportVisibleIds = React.useMemo(\n () => getVisibleGridItems(visibleItems, viewport).map((item) => item.id),\n [viewport, visibleItems],\n );\n const focusedItem = items.find((item) => item.id === focusedItemId);\n const focusedItemHeight = focusedItem?.height;\n const focusedItemIdForReveal = focusedItem?.id;\n const focusedItemWidth = focusedItem?.width;\n const focusedItemX = focusedItem?.x;\n const focusedItemY = focusedItem?.y;\n const previousVisibleIdsRef = React.useRef<readonly string[]>([]);\n const uncontrolled = controlledViewport === undefined;\n const interactive = interactionPolicy !== 'passive';\n const viewportInteractive = interactive && viewportInteraction === 'enabled';\n\n const publish = React.useCallback(\n (nextViewport: GridViewport) => {\n if (areViewportsEqual(viewportRef.current, nextViewport)) return;\n viewportRef.current = nextViewport;\n if (uncontrolled) setUncontrolledViewport(nextViewport);\n onViewportChange?.(nextViewport);\n },\n [onViewportChange, uncontrolled],\n );\n const publishRef = React.useRef(publish);\n const pan = (displacement: GridPoint) =>\n publish(panViewport(viewportRef.current, displacement, constraints));\n const zoomAt = (focalPoint: GridPoint, factor: number) =>\n publish(\n zoomViewportAt(\n viewportRef.current,\n focalPoint,\n {\n pixelsPerUnitX: viewportRef.current.pixelsPerUnitX * factor,\n pixelsPerUnitY: viewportRef.current.pixelsPerUnitY * factor,\n },\n zoomLimits,\n constraints,\n ),\n );\n\n React.useEffect(() => {\n viewportRef.current = viewport;\n }, [viewport]);\n\n React.useEffect(() => {\n publishRef.current = publish;\n }, [publish]);\n\n React.useEffect(() => {\n panRef.current = pan;\n });\n\n // Declared before the viewport-sync effect so the arbiter exists when that effect runs.\n React.useEffect(() => {\n const scrollSync = createGridScrollSync({\n onProgrammaticScroll: (axis, displacement) =>\n panRef.current(axis === 'x' ? { x: -displacement, y: 0 } : { x: 0, y: -displacement }),\n onUserScroll: (axis, displacement) =>\n panRef.current(axis === 'x' ? { x: -displacement, y: 0 } : { x: 0, y: -displacement }),\n scrollTo: (axis, offset, animated) => {\n if (axis === 'x') horizontalScrollRef.current?.scrollTo({ animated, x: offset });\n else verticalScrollRef.current?.scrollTo({ animated, y: offset });\n },\n });\n scrollSyncRef.current = scrollSync;\n return () => {\n scrollSync.dispose();\n scrollSyncRef.current = undefined;\n };\n }, []);\n\n /** Routes native scroll events to the arbiter unless a pinch owns the gesture. */\n const handleNativeScroll = (axis: GridScrollAxis, offset: number) => {\n if (!pinchGestureRef.current) scrollSyncRef.current?.scrolled(axis, offset);\n };\n\n const refreshViewportOrigin = React.useCallback(() => {\n gridRef.current?.measureInWindow((x, y) => {\n viewportOriginRef.current = { x, y };\n });\n }, []);\n\n const measurePinchGesture = React.useCallback(\n (\n touches: readonly PinchTouch[],\n session: number,\n onMeasured: (pinch: PinchGesture | undefined) => void,\n ) => {\n const measurement = pinchMeasurementRef.current + 1;\n pinchMeasurementRef.current = measurement;\n gridRef.current?.measureInWindow((x, y) => {\n if (measurement !== pinchMeasurementRef.current || session !== pinchSessionRef.current) {\n return;\n }\n viewportOriginRef.current = { x, y };\n onMeasured(getPinchGesture(touches, width, height, { x, y }));\n });\n },\n [height, width],\n );\n\n React.useLayoutEffect(() => {\n refreshViewportOrigin();\n }, [height, refreshViewportOrigin, width]);\n\n React.useEffect(\n () => () => {\n pinchMeasurementRef.current += 1;\n pinchSessionRef.current += 1;\n },\n [],\n );\n\n React.useEffect(() => {\n if (!onVisibleItemIdsChange) return;\n const previous = previousVisibleIdsRef.current;\n if (\n previous.length === viewportVisibleIds.length &&\n previous.every((id, index) => id === viewportVisibleIds.at(index))\n ) {\n return;\n }\n previousVisibleIdsRef.current = viewportVisibleIds;\n onVisibleItemIdsChange(viewportVisibleIds);\n }, [onVisibleItemIdsChange, viewportVisibleIds]);\n\n React.useEffect(() => {\n const position = createScrollMapping(viewport, constraints);\n const nextPosition = {\n x: position.horizontal.position,\n y: position.vertical.position,\n };\n if (scrollSyncRef.current?.isCurrent(nextPosition)) return;\n const animated =\n focusRevealViewportRef.current !== undefined &&\n areViewportsEqual(viewport, focusRevealViewportRef.current);\n scrollSyncRef.current?.request(nextPosition, animated);\n if (animated) focusRevealViewportRef.current = undefined;\n }, [constraints, viewport]);\n\n React.useEffect(() => {\n if (\n focusedItemHeight === undefined ||\n focusedItemIdForReveal === undefined ||\n focusedItemWidth === undefined ||\n focusedItemX === undefined ||\n focusedItemY === undefined\n ) {\n focusRevealProposalRef.current = undefined;\n return;\n }\n const sourceViewport = viewportRef.current;\n const revealed = revealWorldRect(\n sourceViewport,\n {\n height: focusedItemHeight,\n width: focusedItemWidth,\n x: focusedItemX,\n y: focusedItemY,\n },\n revealPaddingPixels,\n constraints,\n );\n if (\n isRepeatedControlledFocusRevealProposal({\n controlled: !uncontrolled,\n focusedItemId: focusedItemIdForReveal,\n previous: focusRevealProposalRef.current,\n sourceViewport,\n viewport: revealed,\n })\n ) {\n return;\n }\n focusRevealProposalRef.current = {\n focusedItemId: focusedItemIdForReveal,\n sourceViewport,\n viewport: revealed,\n };\n focusRevealViewportRef.current = areViewportsEqual(sourceViewport, revealed)\n ? undefined\n : revealed;\n publishRef.current(revealed);\n }, [\n constraints,\n focusedItemHeight,\n focusedItemIdForReveal,\n focusedItemWidth,\n focusedItemX,\n focusedItemY,\n revealPaddingPixels,\n uncontrolled,\n ]);\n\n const scrollMapping = createScrollMapping(viewport, constraints);\n\n const syncScrollPosition = () => {\n const nextMapping = createScrollMapping(viewportRef.current, constraints);\n const nextPosition = {\n x: nextMapping.horizontal.position,\n y: nextMapping.vertical.position,\n };\n scrollSyncRef.current?.request(nextPosition, false);\n };\n\n return (\n <NativeView\n ref={gridRef}\n accessibilityLabel=\"Interactive grid viewport\"\n onLayout={refreshViewportOrigin}\n onTouchEnd={() => {\n const wasPinching = pinchGestureRef.current !== undefined;\n pinchMeasurementRef.current += 1;\n pinchSessionRef.current += 1;\n pinchGestureRef.current = undefined;\n setIsPinching(false);\n if (wasPinching) syncScrollPosition();\n }}\n onTouchCancel={() => {\n const wasPinching = pinchGestureRef.current !== undefined;\n pinchMeasurementRef.current += 1;\n pinchSessionRef.current += 1;\n pinchGestureRef.current = undefined;\n setIsPinching(false);\n if (wasPinching) syncScrollPosition();\n }}\n onTouchMove={(event) => {\n if (!viewportInteractive) return;\n measurePinchGesture([...event.nativeEvent.touches], pinchSessionRef.current, (pinch) => {\n const previous = pinchGestureRef.current;\n pinchGestureRef.current = pinch;\n setIsPinching(pinch !== undefined);\n if (!pinch || !previous) return;\n zoomAt(pinch.focalPoint, pinch.distance / previous.distance);\n });\n }}\n onTouchStart={(event) => {\n const session = pinchSessionRef.current + 1;\n pinchSessionRef.current = session;\n measurePinchGesture([...event.nativeEvent.touches], session, (pinch) => {\n pinchGestureRef.current = pinch;\n setIsPinching(pinch !== undefined);\n });\n }}\n style={{ height, overflow: 'hidden', width }}\n testID={testID}\n >\n <NativeScrollView\n ref={horizontalScrollRef}\n testID={testID ? `${testID}-horizontal-scroll` : undefined}\n horizontal\n scrollEnabled={viewportInteractive && !isPinching}\n scrollEventThrottle={16}\n showsHorizontalScrollIndicator\n style={{ height, width }}\n onMomentumScrollEnd={(event) =>\n scrollSyncRef.current?.scrollEnded('x', event.nativeEvent.contentOffset.x)\n }\n onScroll={(event) => handleNativeScroll('x', event.nativeEvent.contentOffset.x)}\n onScrollBeginDrag={(event) =>\n scrollSyncRef.current?.dragBegan('x', event.nativeEvent.contentOffset.x)\n }\n >\n <NativeScrollView\n ref={verticalScrollRef}\n testID={testID ? `${testID}-vertical-scroll` : undefined}\n scrollEnabled={viewportInteractive && !isPinching}\n scrollEventThrottle={16}\n showsVerticalScrollIndicator\n style={{ height, width: scrollMapping.horizontal.contentSize }}\n onMomentumScrollEnd={(event) =>\n scrollSyncRef.current?.scrollEnded('y', event.nativeEvent.contentOffset.y)\n }\n onScroll={(event) => handleNativeScroll('y', event.nativeEvent.contentOffset.y)}\n onScrollBeginDrag={(event) =>\n scrollSyncRef.current?.dragBegan('y', event.nativeEvent.contentOffset.y)\n }\n >\n <NativeView\n style={{\n height: scrollMapping.vertical.contentSize,\n width: scrollMapping.horizontal.contentSize,\n }}\n >\n {visibleItems.map((item) => {\n const position = worldToViewport(\n { x: item.x, y: item.y },\n { ...viewport, offsetX: 0, offsetY: 0 },\n );\n return (\n <NativeView\n key={item.id}\n style={{\n height: item.height * viewport.pixelsPerUnitY,\n left: position.x + scrollMapping.horizontal.origin,\n position: 'absolute',\n top: position.y + scrollMapping.vertical.origin,\n width: item.width * viewport.pixelsPerUnitX,\n }}\n >\n {renderItem(item)}\n </NativeView>\n );\n })}\n </NativeView>\n </NativeScrollView>\n </NativeScrollView>\n {viewportInteractive ? (\n <NativeView accessibilityLabel=\"Viewport controls\" style={controlsStyle}>\n <NativePressable\n accessibilityLabel=\"Pan left\"\n accessibilityRole=\"button\"\n onPress={() => pan({ x: 48, y: 0 })}\n >\n <NativeText>←</NativeText>\n </NativePressable>\n <NativePressable\n accessibilityLabel=\"Pan right\"\n accessibilityRole=\"button\"\n onPress={() => pan({ x: -48, y: 0 })}\n >\n <NativeText>→</NativeText>\n </NativePressable>\n <NativePressable\n accessibilityLabel=\"Pan up\"\n accessibilityRole=\"button\"\n onPress={() => pan({ x: 0, y: 48 })}\n >\n <NativeText>↑</NativeText>\n </NativePressable>\n <NativePressable\n accessibilityLabel=\"Pan down\"\n accessibilityRole=\"button\"\n onPress={() => pan({ x: 0, y: -48 })}\n >\n <NativeText>↓</NativeText>\n </NativePressable>\n <NativePressable\n accessibilityLabel=\"Zoom in\"\n accessibilityRole=\"button\"\n onPress={() => zoomAt({ x: width / 2, y: height / 2 }, 1.2)}\n >\n <NativeText>+</NativeText>\n </NativePressable>\n <NativePressable\n accessibilityLabel=\"Zoom out\"\n accessibilityRole=\"button\"\n onPress={() => zoomAt({ x: width / 2, y: height / 2 }, 1 / 1.2)}\n >\n <NativeText>−</NativeText>\n </NativePressable>\n </NativeView>\n ) : null}\n </NativeView>\n );\n}\n\nconst controlsStyle = { bottom: 8, gap: 4, position: 'absolute' as const, right: 8 };\n\n/*** Builds the initial world position and independent scales for uncontrolled rendering. */\nfunction createInitialViewport(\n width: number,\n height: number,\n zoom: number,\n viewport: GridViewProps['defaultViewport'],\n): GridViewport {\n return {\n height,\n offsetX: viewport?.offsetX ?? 0,\n offsetY: viewport?.offsetY ?? 0,\n pixelsPerUnitX: viewport?.pixelsPerUnitX ?? zoom,\n pixelsPerUnitY: viewport?.pixelsPerUnitY ?? zoom,\n width,\n };\n}\n\n/*** Uses the rendered content extent as the default finite world boundary. */\nfunction createContentConstraints(\n contentWidth: number,\n contentHeight: number,\n): GridViewportConstraints {\n return { world: { height: contentHeight, width: contentWidth, x: 0, y: 0 } };\n}\n\n/*** Maps engine-constrained world offsets to nonnegative native scroll coordinates. */\nfunction createScrollMapping(\n viewport: GridViewport,\n constraints: GridViewportConstraints,\n): ScrollMapping {\n const horizontalMinimum = constrainViewport(\n { ...viewport, offsetX: -Number.MAX_SAFE_INTEGER },\n constraints,\n ).offsetX;\n const horizontalMaximum = constrainViewport(\n { ...viewport, offsetX: Number.MAX_SAFE_INTEGER },\n constraints,\n ).offsetX;\n const verticalMinimum = constrainViewport(\n { ...viewport, offsetY: -Number.MAX_SAFE_INTEGER },\n constraints,\n ).offsetY;\n const verticalMaximum = constrainViewport(\n { ...viewport, offsetY: Number.MAX_SAFE_INTEGER },\n constraints,\n ).offsetY;\n return {\n horizontal: createScrollAxisMapping({\n maximum: horizontalMaximum,\n minimum: horizontalMinimum,\n offset: viewport.offsetX,\n scale: viewport.pixelsPerUnitX,\n viewportSize: viewport.width,\n }),\n vertical: createScrollAxisMapping({\n maximum: verticalMaximum,\n minimum: verticalMinimum,\n offset: viewport.offsetY,\n scale: viewport.pixelsPerUnitY,\n viewportSize: viewport.height,\n }),\n };\n}\n\ntype ScrollAxisMappingInput = Readonly<{\n maximum: number;\n minimum: number;\n offset: number;\n scale: number;\n viewportSize: number;\n}>;\n\n/*** Derives a physical scroll axis from the published engine constraint result. */\nfunction createScrollAxisMapping({\n maximum,\n minimum,\n offset,\n scale,\n viewportSize,\n}: ScrollAxisMappingInput): ScrollAxisMapping {\n const range = (maximum - minimum) * scale;\n return {\n contentSize: viewportSize + range,\n origin: -minimum * scale,\n position: (offset - minimum) * scale,\n };\n}\n\n/*** Compares canonical viewport fields without treating equal proposals as state changes. */\nfunction areViewportsEqual(left: GridViewport, right: GridViewport): boolean {\n return (\n left.width === right.width &&\n left.height === right.height &&\n left.offsetX === right.offsetX &&\n left.offsetY === right.offsetY &&\n left.pixelsPerUnitX === right.pixelsPerUnitX &&\n left.pixelsPerUnitY === right.pixelsPerUnitY\n );\n}\n\n/*** Skips a rejected controlled focus proposal until its focus or incoming viewport changes. */\nfunction isRepeatedControlledFocusRevealProposal({\n controlled,\n focusedItemId,\n previous,\n sourceViewport,\n viewport,\n}: Readonly<{\n controlled: boolean;\n focusedItemId: string | undefined;\n previous: FocusRevealProposal | undefined;\n sourceViewport: GridViewport;\n viewport: GridViewport;\n}>): boolean {\n return (\n controlled &&\n focusedItemId !== undefined &&\n previous?.focusedItemId === focusedItemId &&\n areViewportsEqual(previous.sourceViewport, sourceViewport) &&\n areViewportsEqual(previous.viewport, viewport)\n );\n}\n\n/*** Extracts a stable two-finger focal point in the measured outer viewport coordinate space. */\nfunction getPinchGesture(\n touches: readonly Readonly<{\n pageX: number;\n pageY: number;\n }>[],\n width: number,\n height: number,\n viewportOrigin: ViewportOrigin,\n): PinchGesture | undefined {\n const [first, second] = touches;\n if (!first || !second) return undefined;\n const deltaX = second.pageX - first.pageX;\n const deltaY = second.pageY - first.pageY;\n const distance = Math.hypot(deltaX, deltaY);\n if (!Number.isFinite(distance) || distance === 0) return undefined;\n return {\n distance,\n focalPoint: {\n x: Math.min(width, Math.max(0, (first.pageX + second.pageX) / 2 - viewportOrigin.x)),\n y: Math.min(height, Math.max(0, (first.pageY + second.pageY) / 2 - viewportOrigin.y)),\n },\n };\n}\n"]}
1
+ {"version":3,"file":"GridView.js","sourceRoot":"","sources":["../../../../../src/features/grid-view/adapters/inbound/GridView.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EAInB,WAAW,EACX,eAAe,EACf,eAAe,EACf,cAAc,GACf,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EACL,QAAQ,EACR,SAAS,IAAI,eAAe,EAC5B,UAAU,IAAI,gBAAgB,EAC9B,IAAI,IAAI,UAAU,EAClB,IAAI,IAAI,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,IAAI,CAAC,MAAM;QAAE,OAAO,SAAS,CAAC;IACxC,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;IAC1C,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;IAC1C,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC5C,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,QAAQ,KAAK,CAAC;QAAE,OAAO,SAAS,CAAC;IACnE,OAAO;QACL,QAAQ;QACR,UAAU,EAAE;YACV,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC;YACpF,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC;SACtF;KACF,CAAC;AACJ,CAAC","sourcesContent":["import {\n constrainViewport,\n getVisibleGridItems,\n type GridPoint,\n type GridViewport,\n type GridViewportConstraints,\n panViewport,\n revealWorldRect,\n worldToViewport,\n zoomViewportAt,\n} from '@ankhorage/grid-view';\nimport React from 'react';\nimport {\n Platform,\n Pressable as NativePressable,\n ScrollView as NativeScrollView,\n Text as NativeText,\n View as NativeView,\n} from 'react-native';\n\nimport type { GridScrollAxis, GridScrollSync, GridViewProps } from '../../../../types/grid-view';\nimport type { ReactNativeComponentInstance } from '../../../../types/react-native';\nimport { ScrollGestureLockContext } from '../../../layout/adapters/inbound/ScrollGestureLockContext';\nimport { useScrollGestureLock } from '../../../layout/adapters/inbound/useScrollGestureLock';\nimport { createScrollGestureLock } from '../../../layout/utils/createScrollGestureLock';\nimport { createGridScrollSync } from '../../application/createGridScrollSync';\n\ntype PinchGesture = Readonly<{ distance: number; focalPoint: GridPoint }>;\ntype ScrollAxisMapping = Readonly<{ contentSize: number; origin: number; position: number }>;\ntype ScrollMapping = Readonly<{\n horizontal: ScrollAxisMapping;\n vertical: ScrollAxisMapping;\n}>;\ntype ViewportOrigin = Readonly<{ x: number; y: number }>;\ntype FocusRevealProposal = Readonly<{\n focusedItemId: string;\n sourceViewport: GridViewport;\n viewport: GridViewport;\n}>;\ntype PinchTouch = Readonly<{ pageX: number; pageY: number }>;\n\n/*** Renders a controlled or uncontrolled, virtualized 2D world through the canonical grid viewport engine. */\nexport function GridView({\n items,\n contentWidth,\n contentHeight,\n width,\n height,\n viewport: controlledViewport,\n defaultViewport,\n viewportConstraints,\n zoomLimits,\n zoom = 1,\n overscanPixels = 160,\n focusedItemId,\n revealPaddingPixels = 8,\n interactionPolicy,\n onViewportChange,\n onVisibleItemIdsChange,\n renderItem,\n testID,\n viewportInteraction = 'enabled',\n viewportControls = 'visible',\n renderWorldLayer,\n}: GridViewProps) {\n const parentScrollLock = useScrollGestureLock();\n const [uncontrolledViewport, setUncontrolledViewport] = React.useState(() =>\n createInitialViewport(width, height, zoom, defaultViewport),\n );\n const horizontalScrollRef =\n React.useRef<ReactNativeComponentInstance<typeof NativeScrollView>>(null);\n const verticalScrollRef =\n React.useRef<ReactNativeComponentInstance<typeof NativeScrollView>>(null);\n const gridRef = React.useRef<ReactNativeComponentInstance<typeof NativeView>>(null);\n const panRef = React.useRef<(displacement: GridPoint) => void>(() => undefined);\n const scrollSyncRef = React.useRef<GridScrollSync | undefined>(undefined);\n const dragPanRef = React.useRef<GridPoint | undefined>(undefined);\n const pinchGestureRef = React.useRef<PinchGesture | undefined>(undefined);\n const pinchMeasurementRef = React.useRef(0);\n const pinchSessionRef = React.useRef(0);\n const viewportOriginRef = React.useRef<ViewportOrigin>({ x: 0, y: 0 });\n const focusRevealProposalRef = React.useRef<FocusRevealProposal | undefined>(undefined);\n const focusRevealViewportRef = React.useRef<GridViewport | undefined>(undefined);\n const [activeItemGestures, setActiveItemGestures] = React.useState(0);\n const [isPinching, setIsPinching] = React.useState(false);\n const constraints = React.useMemo(\n () => viewportConstraints ?? createContentConstraints(contentWidth, contentHeight),\n [contentHeight, contentWidth, viewportConstraints],\n );\n const sourceViewport = controlledViewport ?? uncontrolledViewport;\n const viewport = React.useMemo(\n () => constrainViewport({ ...sourceViewport, height, width }, constraints),\n [constraints, height, sourceViewport, width],\n );\n const viewportRef = React.useRef(viewport);\n const visibleItems = React.useMemo(\n () => getVisibleGridItems(items, viewport, overscanPixels),\n [items, overscanPixels, viewport],\n );\n const viewportVisibleIds = React.useMemo(\n () => getVisibleGridItems(visibleItems, viewport).map((item) => item.id),\n [viewport, visibleItems],\n );\n const focusedItem = items.find((item) => item.id === focusedItemId);\n const focusedItemHeight = focusedItem?.height;\n const focusedItemIdForReveal = focusedItem?.id;\n const focusedItemWidth = focusedItem?.width;\n const focusedItemX = focusedItem?.x;\n const focusedItemY = focusedItem?.y;\n const previousVisibleIdsRef = React.useRef<readonly string[]>([]);\n const uncontrolled = controlledViewport === undefined;\n const interactive = interactionPolicy !== 'passive';\n const viewportInteractive = interactive && viewportInteraction === 'enabled';\n const scrollLock = React.useMemo(\n () =>\n createScrollGestureLock(parentScrollLock, (delta) =>\n setActiveItemGestures((count) => count + delta),\n ),\n [parentScrollLock],\n );\n\n const publish = React.useCallback(\n (nextViewport: GridViewport) => {\n if (areViewportsEqual(viewportRef.current, nextViewport)) return;\n viewportRef.current = nextViewport;\n if (uncontrolled) setUncontrolledViewport(nextViewport);\n onViewportChange?.(nextViewport);\n },\n [onViewportChange, uncontrolled],\n );\n const publishRef = React.useRef(publish);\n const pan = (displacement: GridPoint) =>\n publish(panViewport(viewportRef.current, displacement, constraints));\n const zoomAt = (focalPoint: GridPoint, factor: number) =>\n publish(\n zoomViewportAt(\n viewportRef.current,\n focalPoint,\n {\n pixelsPerUnitX: viewportRef.current.pixelsPerUnitX * factor,\n pixelsPerUnitY: viewportRef.current.pixelsPerUnitY * factor,\n },\n zoomLimits,\n constraints,\n ),\n );\n\n React.useLayoutEffect(() => {\n viewportRef.current = viewport;\n }, [viewport]);\n\n React.useEffect(() => {\n publishRef.current = publish;\n }, [publish]);\n\n React.useEffect(() => {\n panRef.current = pan;\n });\n\n // Declared before the viewport-sync effect so the arbiter exists when that effect runs.\n React.useEffect(() => {\n const scrollSync = createGridScrollSync({\n acceptUnownedScroll: Platform.OS === 'web',\n onUserScroll: (axis, displacement) =>\n panRef.current(axis === 'x' ? { x: -displacement, y: 0 } : { x: 0, y: -displacement }),\n scrollTo: (axis, offset, animated) => {\n if (axis === 'x') horizontalScrollRef.current?.scrollTo({ animated, x: offset });\n else verticalScrollRef.current?.scrollTo({ animated, y: offset });\n },\n });\n scrollSyncRef.current = scrollSync;\n return () => {\n scrollSync.dispose();\n scrollSyncRef.current = undefined;\n };\n }, []);\n\n /** Routes native scroll events to the arbiter unless a pinch or an item gesture owns the scroll. */\n const handleNativeScroll = (axis: GridScrollAxis, offset: number) => {\n if (scrollLock.isActive?.()) {\n const mapping = createScrollMapping(viewportRef.current, constraints);\n scrollSyncRef.current?.restore(\n axis,\n offset,\n axis === 'x' ? mapping.horizontal.position : mapping.vertical.position,\n );\n return;\n }\n if (!pinchGestureRef.current) scrollSyncRef.current?.scrolled(axis, offset);\n };\n\n /*** Keeps locked native lifecycle signals under the same restore ownership as their scroll frames. */\n const handleNativeScrollBegan = (axis: GridScrollAxis, offset: number) => {\n if (scrollLock.isActive?.()) {\n const mapping = createScrollMapping(viewportRef.current, constraints);\n scrollSyncRef.current?.restore(\n axis,\n offset,\n axis === 'x' ? mapping.horizontal.position : mapping.vertical.position,\n );\n return;\n }\n scrollSyncRef.current?.dragBegan(axis, offset);\n };\n\n /*** Keeps locked native completion signals from settling a descendant gesture as a viewport pan. */\n const handleNativeScrollEnded = (axis: GridScrollAxis, offset: number) => {\n if (scrollLock.isActive?.()) {\n const mapping = createScrollMapping(viewportRef.current, constraints);\n scrollSyncRef.current?.restore(\n axis,\n offset,\n axis === 'x' ? mapping.horizontal.position : mapping.vertical.position,\n );\n return;\n }\n scrollSyncRef.current?.scrollEnded(axis, offset);\n };\n\n const refreshViewportOrigin = React.useCallback(() => {\n gridRef.current?.measureInWindow((x, y) => {\n viewportOriginRef.current = { x, y };\n });\n }, []);\n\n const measurePinchGesture = React.useCallback(\n (\n touches: readonly PinchTouch[],\n session: number,\n onMeasured: (pinch: PinchGesture | undefined) => void,\n ) => {\n const measurement = pinchMeasurementRef.current + 1;\n pinchMeasurementRef.current = measurement;\n gridRef.current?.measureInWindow((x, y) => {\n if (measurement !== pinchMeasurementRef.current || session !== pinchSessionRef.current) {\n return;\n }\n viewportOriginRef.current = { x, y };\n onMeasured(getPinchGesture(touches, width, height, { x, y }));\n });\n },\n [height, width],\n );\n\n React.useLayoutEffect(() => {\n refreshViewportOrigin();\n }, [height, refreshViewportOrigin, width]);\n\n React.useEffect(\n () => () => {\n pinchMeasurementRef.current += 1;\n pinchSessionRef.current += 1;\n },\n [],\n );\n\n React.useEffect(() => {\n if (!onVisibleItemIdsChange) return;\n const previous = previousVisibleIdsRef.current;\n if (\n previous.length === viewportVisibleIds.length &&\n previous.every((id, index) => id === viewportVisibleIds.at(index))\n ) {\n return;\n }\n previousVisibleIdsRef.current = viewportVisibleIds;\n onVisibleItemIdsChange(viewportVisibleIds);\n }, [onVisibleItemIdsChange, viewportVisibleIds]);\n\n React.useEffect(() => {\n const position = createScrollMapping(viewport, constraints);\n const nextPosition = {\n x: position.horizontal.position,\n y: position.vertical.position,\n };\n if (scrollSyncRef.current?.isCurrent(nextPosition)) return;\n const animated =\n focusRevealViewportRef.current !== undefined &&\n areViewportsEqual(viewport, focusRevealViewportRef.current);\n scrollSyncRef.current?.request(nextPosition, animated);\n if (animated) focusRevealViewportRef.current = undefined;\n }, [constraints, viewport]);\n\n React.useEffect(() => {\n if (\n focusedItemHeight === undefined ||\n focusedItemIdForReveal === undefined ||\n focusedItemWidth === undefined ||\n focusedItemX === undefined ||\n focusedItemY === undefined\n ) {\n focusRevealProposalRef.current = undefined;\n return;\n }\n const sourceViewport = viewportRef.current;\n const revealed = revealWorldRect(\n sourceViewport,\n {\n height: focusedItemHeight,\n width: focusedItemWidth,\n x: focusedItemX,\n y: focusedItemY,\n },\n revealPaddingPixels,\n constraints,\n );\n if (\n isRepeatedControlledFocusRevealProposal({\n controlled: !uncontrolled,\n focusedItemId: focusedItemIdForReveal,\n previous: focusRevealProposalRef.current,\n sourceViewport,\n viewport: revealed,\n })\n ) {\n return;\n }\n focusRevealProposalRef.current = {\n focusedItemId: focusedItemIdForReveal,\n sourceViewport,\n viewport: revealed,\n };\n focusRevealViewportRef.current = areViewportsEqual(sourceViewport, revealed)\n ? undefined\n : revealed;\n publishRef.current(revealed);\n }, [\n constraints,\n focusedItemHeight,\n focusedItemIdForReveal,\n focusedItemWidth,\n focusedItemX,\n focusedItemY,\n revealPaddingPixels,\n uncontrolled,\n ]);\n\n const scrollMapping = createScrollMapping(viewport, constraints);\n\n const syncScrollPosition = () => {\n const nextMapping = createScrollMapping(viewportRef.current, constraints);\n const nextPosition = {\n x: nextMapping.horizontal.position,\n y: nextMapping.vertical.position,\n };\n scrollSyncRef.current?.request(nextPosition, false);\n };\n\n return (\n <ScrollGestureLockContext.Provider value={scrollLock}>\n <NativeView\n ref={gridRef}\n accessibilityLabel=\"Interactive grid viewport\"\n onLayout={refreshViewportOrigin}\n onTouchEnd={() => {\n const wasPinching = pinchGestureRef.current !== undefined;\n pinchMeasurementRef.current += 1;\n pinchSessionRef.current += 1;\n pinchGestureRef.current = undefined;\n setIsPinching(false);\n if (wasPinching) syncScrollPosition();\n }}\n onTouchCancel={() => {\n const wasPinching = pinchGestureRef.current !== undefined;\n pinchMeasurementRef.current += 1;\n pinchSessionRef.current += 1;\n pinchGestureRef.current = undefined;\n setIsPinching(false);\n if (wasPinching) syncScrollPosition();\n }}\n onTouchMove={(event) => {\n if (!viewportInteractive) return;\n measurePinchGesture([...event.nativeEvent.touches], pinchSessionRef.current, (pinch) => {\n const previous = pinchGestureRef.current;\n pinchGestureRef.current = pinch;\n setIsPinching(pinch !== undefined);\n if (!pinch || !previous) return;\n zoomAt(pinch.focalPoint, pinch.distance / previous.distance);\n });\n }}\n onTouchStart={(event) => {\n const session = pinchSessionRef.current + 1;\n pinchSessionRef.current = session;\n measurePinchGesture([...event.nativeEvent.touches], session, (pinch) => {\n pinchGestureRef.current = pinch;\n setIsPinching(pinch !== undefined);\n });\n }}\n style={{ height, overflow: 'hidden', width }}\n testID={testID}\n >\n <NativeScrollView\n ref={horizontalScrollRef}\n disableScrollViewPanResponder\n nestedScrollEnabled\n testID={testID ? `${testID}-horizontal-scroll` : undefined}\n horizontal\n scrollEnabled={viewportInteractive && activeItemGestures === 0 && !isPinching}\n scrollEventThrottle={16}\n showsHorizontalScrollIndicator\n style={{ height, width }}\n onMomentumScrollEnd={(event) =>\n handleNativeScrollEnded('x', event.nativeEvent.contentOffset.x)\n }\n onScroll={(event) => handleNativeScroll('x', event.nativeEvent.contentOffset.x)}\n onScrollBeginDrag={(event) =>\n handleNativeScrollBegan('x', event.nativeEvent.contentOffset.x)\n }\n >\n <NativeScrollView\n ref={verticalScrollRef}\n disableScrollViewPanResponder\n nestedScrollEnabled\n testID={testID ? `${testID}-vertical-scroll` : undefined}\n scrollEnabled={viewportInteractive && activeItemGestures === 0 && !isPinching}\n scrollEventThrottle={16}\n showsVerticalScrollIndicator\n style={{ height, width: scrollMapping.horizontal.contentSize }}\n onMomentumScrollEnd={(event) =>\n handleNativeScrollEnded('y', event.nativeEvent.contentOffset.y)\n }\n onScroll={(event) => handleNativeScroll('y', event.nativeEvent.contentOffset.y)}\n onScrollBeginDrag={(event) =>\n handleNativeScrollBegan('y', event.nativeEvent.contentOffset.y)\n }\n >\n <NativeView\n style={{\n height: scrollMapping.vertical.contentSize,\n width: scrollMapping.horizontal.contentSize,\n }}\n >\n {Platform.OS === 'web' && viewportInteractive ? (\n <NativeView\n accessible={false}\n onResponderGrant={(event) => {\n dragPanRef.current = { x: event.nativeEvent.pageX, y: event.nativeEvent.pageY };\n }}\n onResponderMove={(event) => {\n const previous = dragPanRef.current;\n if (!previous) return;\n const next = { x: event.nativeEvent.pageX, y: event.nativeEvent.pageY };\n dragPanRef.current = next;\n pan({ x: next.x - previous.x, y: next.y - previous.y });\n }}\n onResponderRelease={() => {\n dragPanRef.current = undefined;\n }}\n onResponderTerminate={() => {\n dragPanRef.current = undefined;\n }}\n onStartShouldSetResponderCapture={() => true}\n style={fillStyle}\n testID={testID ? `${testID}-background` : undefined}\n />\n ) : null}\n {renderWorldLayer ? (\n <NativeView pointerEvents=\"box-none\" style={fillStyle}>\n {renderWorldLayer({\n height: scrollMapping.vertical.contentSize,\n origin: {\n x: scrollMapping.horizontal.origin,\n y: scrollMapping.vertical.origin,\n },\n pixelsPerUnitX: viewport.pixelsPerUnitX,\n pixelsPerUnitY: viewport.pixelsPerUnitY,\n width: scrollMapping.horizontal.contentSize,\n })}\n </NativeView>\n ) : null}\n {visibleItems.map((item) => {\n const position = worldToViewport(\n { x: item.x, y: item.y },\n { ...viewport, offsetX: 0, offsetY: 0 },\n );\n return (\n <NativeView\n key={item.id}\n style={{\n height: item.height * viewport.pixelsPerUnitY,\n left: position.x + scrollMapping.horizontal.origin,\n position: 'absolute',\n top: position.y + scrollMapping.vertical.origin,\n width: item.width * viewport.pixelsPerUnitX,\n }}\n >\n {renderItem(item)}\n </NativeView>\n );\n })}\n </NativeView>\n </NativeScrollView>\n </NativeScrollView>\n {viewportInteractive && viewportControls === 'visible' ? (\n <NativeView accessibilityLabel=\"Viewport controls\" style={controlsStyle}>\n <NativePressable\n accessibilityLabel=\"Pan left\"\n accessibilityRole=\"button\"\n onPress={() => pan({ x: 48, y: 0 })}\n >\n <NativeText>←</NativeText>\n </NativePressable>\n <NativePressable\n accessibilityLabel=\"Pan right\"\n accessibilityRole=\"button\"\n onPress={() => pan({ x: -48, y: 0 })}\n >\n <NativeText>→</NativeText>\n </NativePressable>\n <NativePressable\n accessibilityLabel=\"Pan up\"\n accessibilityRole=\"button\"\n onPress={() => pan({ x: 0, y: 48 })}\n >\n <NativeText>↑</NativeText>\n </NativePressable>\n <NativePressable\n accessibilityLabel=\"Pan down\"\n accessibilityRole=\"button\"\n onPress={() => pan({ x: 0, y: -48 })}\n >\n <NativeText>↓</NativeText>\n </NativePressable>\n <NativePressable\n accessibilityLabel=\"Zoom in\"\n accessibilityRole=\"button\"\n onPress={() => zoomAt({ x: width / 2, y: height / 2 }, 1.2)}\n >\n <NativeText>+</NativeText>\n </NativePressable>\n <NativePressable\n accessibilityLabel=\"Zoom out\"\n accessibilityRole=\"button\"\n onPress={() => zoomAt({ x: width / 2, y: height / 2 }, 1 / 1.2)}\n >\n <NativeText>−</NativeText>\n </NativePressable>\n </NativeView>\n ) : null}\n </NativeView>\n </ScrollGestureLockContext.Provider>\n );\n}\n\nconst fillStyle = { bottom: 0, left: 0, position: 'absolute' as const, right: 0, top: 0 };\nconst controlsStyle = { bottom: 8, gap: 4, position: 'absolute' as const, right: 8 };\nconst VIEWPORT_NUMERIC_TOLERANCE = Number.EPSILON * 1024;\n\n/*** Builds the initial world position and independent scales for uncontrolled rendering. */\nfunction createInitialViewport(\n width: number,\n height: number,\n zoom: number,\n viewport: GridViewProps['defaultViewport'],\n): GridViewport {\n return {\n height,\n offsetX: viewport?.offsetX ?? 0,\n offsetY: viewport?.offsetY ?? 0,\n pixelsPerUnitX: viewport?.pixelsPerUnitX ?? zoom,\n pixelsPerUnitY: viewport?.pixelsPerUnitY ?? zoom,\n width,\n };\n}\n\n/*** Uses the rendered content extent as the default finite world boundary. */\nfunction createContentConstraints(\n contentWidth: number,\n contentHeight: number,\n): GridViewportConstraints {\n return { world: { height: contentHeight, width: contentWidth, x: 0, y: 0 } };\n}\n\n/*** Maps engine-constrained world offsets to nonnegative native scroll coordinates. */\nfunction createScrollMapping(\n viewport: GridViewport,\n constraints: GridViewportConstraints,\n): ScrollMapping {\n const horizontalMinimum = constrainViewport(\n { ...viewport, offsetX: -Number.MAX_SAFE_INTEGER },\n constraints,\n ).offsetX;\n const horizontalMaximum = constrainViewport(\n { ...viewport, offsetX: Number.MAX_SAFE_INTEGER },\n constraints,\n ).offsetX;\n const verticalMinimum = constrainViewport(\n { ...viewport, offsetY: -Number.MAX_SAFE_INTEGER },\n constraints,\n ).offsetY;\n const verticalMaximum = constrainViewport(\n { ...viewport, offsetY: Number.MAX_SAFE_INTEGER },\n constraints,\n ).offsetY;\n return {\n horizontal: createScrollAxisMapping({\n maximum: horizontalMaximum,\n minimum: horizontalMinimum,\n offset: viewport.offsetX,\n scale: viewport.pixelsPerUnitX,\n viewportSize: viewport.width,\n }),\n vertical: createScrollAxisMapping({\n maximum: verticalMaximum,\n minimum: verticalMinimum,\n offset: viewport.offsetY,\n scale: viewport.pixelsPerUnitY,\n viewportSize: viewport.height,\n }),\n };\n}\n\ntype ScrollAxisMappingInput = Readonly<{\n maximum: number;\n minimum: number;\n offset: number;\n scale: number;\n viewportSize: number;\n}>;\n\n/*** Derives a physical scroll axis from the published engine constraint result. */\nfunction createScrollAxisMapping({\n maximum,\n minimum,\n offset,\n scale,\n viewportSize,\n}: ScrollAxisMappingInput): ScrollAxisMapping {\n const range = (maximum - minimum) * scale;\n return {\n contentSize: viewportSize + range,\n origin: -minimum * scale,\n position: (offset - minimum) * scale,\n };\n}\n\n/*** Compares canonical viewport fields without treating equal proposals as state changes. */\nfunction areViewportsEqual(left: GridViewport, right: GridViewport): boolean {\n return (\n areViewportValuesEqual(left.width, right.width) &&\n areViewportValuesEqual(left.height, right.height) &&\n areViewportValuesEqual(left.offsetX, right.offsetX) &&\n areViewportValuesEqual(left.offsetY, right.offsetY) &&\n areViewportValuesEqual(left.pixelsPerUnitX, right.pixelsPerUnitX) &&\n areViewportValuesEqual(left.pixelsPerUnitY, right.pixelsPerUnitY)\n );\n}\n\n/*** Treats machine-scale arithmetic residue as unchanged without rounding real viewport movement. */\nfunction areViewportValuesEqual(left: number, right: number): boolean {\n return Math.abs(left - right) <= VIEWPORT_NUMERIC_TOLERANCE;\n}\n\n/*** Skips a rejected controlled focus proposal until its focus or incoming viewport changes. */\nfunction isRepeatedControlledFocusRevealProposal({\n controlled,\n focusedItemId,\n previous,\n sourceViewport,\n viewport,\n}: Readonly<{\n controlled: boolean;\n focusedItemId: string | undefined;\n previous: FocusRevealProposal | undefined;\n sourceViewport: GridViewport;\n viewport: GridViewport;\n}>): boolean {\n return (\n controlled &&\n focusedItemId !== undefined &&\n previous?.focusedItemId === focusedItemId &&\n areViewportsEqual(previous.sourceViewport, sourceViewport) &&\n areViewportsEqual(previous.viewport, viewport)\n );\n}\n\n/*** Extracts a stable two-finger focal point in the measured outer viewport coordinate space. */\nfunction getPinchGesture(\n touches: readonly Readonly<{\n pageX: number;\n pageY: number;\n }>[],\n width: number,\n height: number,\n viewportOrigin: ViewportOrigin,\n): PinchGesture | undefined {\n const [first, second] = touches;\n if (!first || !second) return undefined;\n const deltaX = second.pageX - first.pageX;\n const deltaY = second.pageY - first.pageY;\n const distance = Math.hypot(deltaX, deltaY);\n if (!Number.isFinite(distance) || distance === 0) return undefined;\n return {\n distance,\n focalPoint: {\n x: Math.min(width, Math.max(0, (first.pageX + second.pageX) / 2 - viewportOrigin.x)),\n y: Math.min(height, Math.max(0, (first.pageY + second.pageY) / 2 - viewportOrigin.y)),\n },\n };\n}\n"]}
@@ -1,7 +1,4 @@
1
1
  import type { GridScrollSync, GridScrollSyncOptions } from '../../../types/grid-view';
2
- /***
3
- * Arbitrates each native scroll axis between programmatic requests and the user,
4
- * so echoes of GridView's own scrollTo calls never become viewport pans.
5
- */
6
- export declare function createGridScrollSync({ scrollTo, onUserScroll, onProgrammaticScroll, now, schedule, cancel, }: GridScrollSyncOptions): GridScrollSync;
2
+ /*** Arbitrates native scroll ownership so programmatic offsets never become viewport proposals. */
3
+ export declare function createGridScrollSync({ scrollTo, onUserScroll, acceptUnownedScroll, now, schedule, cancel, }: GridScrollSyncOptions): GridScrollSync;
7
4
  //# sourceMappingURL=createGridScrollSync.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"createGridScrollSync.d.ts","sourceRoot":"","sources":["../../../../src/features/grid-view/application/createGridScrollSync.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAIV,cAAc,EACd,qBAAqB,EACtB,MAAM,0BAA0B,CAAC;AAclC;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,EACnC,QAAQ,EACR,YAAY,EACZ,oBAAoB,EACpB,GAAc,EACd,QAAqB,EACrB,MAAqB,GACtB,EAAE,qBAAqB,GAAG,cAAc,CA4GxC"}
1
+ {"version":3,"file":"createGridScrollSync.d.ts","sourceRoot":"","sources":["../../../../src/features/grid-view/application/createGridScrollSync.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAIV,cAAc,EACd,qBAAqB,EACtB,MAAM,0BAA0B,CAAC;AAclC,mGAAmG;AACnG,wBAAgB,oBAAoB,CAAC,EACnC,QAAQ,EACR,YAAY,EACZ,mBAA0B,EAC1B,GAAc,EACd,QAAqB,EACrB,MAAqB,GACtB,EAAE,qBAAqB,GAAG,cAAc,CAwKxC"}
@@ -1,15 +1,15 @@
1
1
  import { ANIMATED_SCROLL_WINDOW_MS, IMMEDIATE_SCROLL_WINDOW_MS, SCROLL_POSITION_TOLERANCE, } from '../constants/scroll.js';
2
2
  import { resolveScrollEventSource } from './resolveScrollEventSource.js';
3
3
  const AXES = ['x', 'y'];
4
- /***
5
- * Arbitrates each native scroll axis between programmatic requests and the user,
6
- * so echoes of GridView's own scrollTo calls never become viewport pans.
7
- */
8
- export function createGridScrollSync({ scrollTo, onUserScroll, onProgrammaticScroll, now = Date.now, schedule = setTimeout, cancel = clearTimeout, }) {
9
- let position = { x: 0, y: 0 };
4
+ /*** Arbitrates native scroll ownership so programmatic offsets never become viewport proposals. */
5
+ export function createGridScrollSync({ scrollTo, onUserScroll, acceptUnownedScroll = true, now = Date.now, schedule = setTimeout, cancel = clearTimeout, }) {
6
+ // A requested native position is not proof that the platform reached it. Keeping
7
+ // target and observed positions separate prevents rebasing echoes becoming pans.
8
+ let expectedPosition = { x: 0, y: 0 };
9
+ let observedPosition = { x: 0, y: 0 };
10
10
  const pending = new Map();
11
11
  const inFlight = new Map();
12
- // Keep ownership of late frames even after a stalled animation is reconciled.
12
+ const userGestures = new Set();
13
13
  const echoTails = new Map();
14
14
  const timers = new Map();
15
15
  const clearTimer = (axis) => {
@@ -24,8 +24,16 @@ export function createGridScrollSync({ scrollTo, onUserScroll, onProgrammaticScr
24
24
  inFlight.delete(axis);
25
25
  };
26
26
  const adopt = (axis, offset) => {
27
- const displacement = offset - readAxis(position, axis);
28
- position = withAxis(position, axis, offset);
27
+ const displacement = offset - readAxis(observedPosition, axis);
28
+ observedPosition = withAxis(observedPosition, axis, offset);
29
+ expectedPosition = withAxis(expectedPosition, axis, offset);
30
+ if (displacement !== 0)
31
+ onUserScroll(axis, displacement);
32
+ };
33
+ const adoptFromExpected = (axis, offset) => {
34
+ const displacement = offset - readAxis(expectedPosition, axis);
35
+ observedPosition = withAxis(observedPosition, axis, offset);
36
+ expectedPosition = withAxis(expectedPosition, axis, offset);
29
37
  if (displacement !== 0)
30
38
  onUserScroll(axis, displacement);
31
39
  };
@@ -33,26 +41,53 @@ export function createGridScrollSync({ scrollTo, onUserScroll, onProgrammaticScr
33
41
  const pendingScroll = pending.get(axis);
34
42
  const offset = finalOffset ?? inFlight.get(axis);
35
43
  release(axis);
36
- if (offset !== undefined) {
37
- if (finalOffset === undefined &&
38
- pendingScroll?.animated &&
39
- !isSameOffset(offset, pendingScroll.target)) {
40
- echoTails.set(axis, { lastOffset: offset, target: pendingScroll.target });
41
- }
42
- else {
43
- echoTails.delete(axis);
44
- }
45
- adopt(axis, offset);
44
+ if (offset === undefined)
45
+ return;
46
+ if (pendingScroll?.animated && !isSameOffset(offset, pendingScroll.target)) {
47
+ echoTails.set(axis, { lastOffset: offset, target: pendingScroll.target });
46
48
  }
49
+ else {
50
+ echoTails.delete(axis);
51
+ }
52
+ if (acceptUnownedScroll)
53
+ adoptFromExpected(axis, offset);
54
+ else
55
+ observedPosition = withAxis(observedPosition, axis, offset);
56
+ };
57
+ /*** Restores a locked native axis and retains ownership until a new native drag takes it over. */
58
+ const restore = (axis, offset, target) => {
59
+ release(axis);
60
+ echoTails.delete(axis);
61
+ userGestures.delete(axis);
62
+ observedPosition = withAxis(observedPosition, axis, offset);
63
+ expectedPosition = withAxis(expectedPosition, axis, target);
64
+ pending.set(axis, {
65
+ animated: false,
66
+ expiresAt: Number.POSITIVE_INFINITY,
67
+ restoring: true,
68
+ target,
69
+ });
70
+ if (!isSameOffset(offset, target))
71
+ scrollTo(axis, target, false);
47
72
  };
48
73
  const scrolled = (axis, offset) => {
74
+ const pendingScroll = pending.get(axis);
75
+ if (pendingScroll?.restoring) {
76
+ observedPosition = withAxis(observedPosition, axis, offset);
77
+ if (!isSameOffset(offset, pendingScroll.target))
78
+ restore(axis, offset, pendingScroll.target);
79
+ return;
80
+ }
81
+ if (userGestures.has(axis)) {
82
+ adopt(axis, offset);
83
+ return;
84
+ }
49
85
  const tail = echoTails.get(axis);
50
86
  if (tail) {
51
87
  if (isContinuingProgrammaticEcho(tail, offset)) {
52
- const displacement = offset - readAxis(position, axis);
53
- position = withAxis(position, axis, offset);
54
- if (displacement !== 0)
55
- onProgrammaticScroll(axis, displacement);
88
+ observedPosition = withAxis(observedPosition, axis, offset);
89
+ if (acceptUnownedScroll)
90
+ expectedPosition = withAxis(expectedPosition, axis, offset);
56
91
  if (isSameOffset(offset, tail.target))
57
92
  echoTails.delete(axis);
58
93
  else
@@ -61,53 +96,81 @@ export function createGridScrollSync({ scrollTo, onUserScroll, onProgrammaticScr
61
96
  }
62
97
  echoTails.delete(axis);
63
98
  }
64
- let pendingScroll = pending.get(axis);
65
- if (pendingScroll?.animated && now() > pendingScroll.expiresAt) {
66
- // A native scroll may deliver its first frame after the initial deadline.
67
- // Without an explicit drag/end, that is still an echo of our scrollTo.
68
- pendingScroll = { ...pendingScroll, expiresAt: now() + ANIMATED_SCROLL_WINDOW_MS };
69
- pending.set(axis, pendingScroll);
99
+ let currentPending = pendingScroll;
100
+ if (currentPending?.animated && now() > currentPending.expiresAt) {
101
+ currentPending = { ...currentPending, expiresAt: now() + ANIMATED_SCROLL_WINDOW_MS };
102
+ pending.set(axis, currentPending);
70
103
  }
71
- const source = resolveScrollEventSource(pendingScroll, offset, now());
72
- if (source === 'in-flight' && pendingScroll) {
104
+ const source = resolveScrollEventSource(currentPending, offset, now());
105
+ if (source === 'in-flight' && currentPending) {
73
106
  clearTimer(axis);
74
107
  inFlight.set(axis, offset);
75
- // Native animation frames can pause longer than 120ms; only reconcile at the
76
- // original request deadline, or earlier on an explicit drag/end/target echo.
77
- timers.set(axis, schedule(() => settle(axis), Math.max(0, pendingScroll.expiresAt - now())));
108
+ timers.set(axis, schedule(() => settle(axis), Math.max(0, currentPending.expiresAt - now())));
109
+ observedPosition = withAxis(observedPosition, axis, offset);
78
110
  return;
79
111
  }
80
- release(axis);
81
- if (source === 'user')
112
+ if (source === 'settled') {
113
+ release(axis);
114
+ observedPosition = withAxis(observedPosition, axis, offset);
115
+ return;
116
+ }
117
+ if (currentPending && !acceptUnownedScroll) {
118
+ release(axis);
119
+ observedPosition = withAxis(observedPosition, axis, offset);
120
+ return;
121
+ }
122
+ if (acceptUnownedScroll)
123
+ adoptFromExpected(axis, offset);
124
+ else
82
125
  adopt(axis, offset);
83
126
  };
84
127
  return {
85
- isCurrent: (next) => AXES.every((axis) => isSameOffset(readAxis(position, axis), readAxis(next, axis))),
128
+ isCurrent: (next) => AXES.every((axis) => isSameOffset(readAxis(expectedPosition, axis), readAxis(next, axis))),
86
129
  request: (next, animated) => {
87
130
  const windowMs = animated ? ANIMATED_SCROLL_WINDOW_MS : IMMEDIATE_SCROLL_WINDOW_MS;
88
131
  const expiresAt = now() + windowMs;
89
132
  for (const axis of AXES) {
90
133
  const target = readAxis(next, axis);
91
- if (isSameOffset(readAxis(position, axis), target))
134
+ if (isSameOffset(readAxis(expectedPosition, axis), target))
92
135
  continue;
93
136
  release(axis);
94
137
  echoTails.delete(axis);
138
+ userGestures.delete(axis);
95
139
  pending.set(axis, { animated, expiresAt, target });
96
140
  scrollTo(axis, target, animated);
141
+ expectedPosition = withAxis(expectedPosition, axis, target);
97
142
  }
98
- position = next;
99
143
  },
144
+ restore,
100
145
  scrolled,
101
146
  dragBegan: (axis, offset) => {
102
- const hadTail = echoTails.delete(axis);
103
- if (pending.has(axis) || inFlight.has(axis))
104
- settle(axis, offset);
105
- else if (hadTail)
106
- adopt(axis, offset);
147
+ const pendingScroll = pending.get(axis);
148
+ if (pendingScroll?.restoring && !isSameOffset(offset, pendingScroll.target)) {
149
+ restore(axis, offset, pendingScroll.target);
150
+ return;
151
+ }
152
+ release(axis);
153
+ echoTails.delete(axis);
154
+ userGestures.add(axis);
155
+ // Native scroll-begin can arrive after a descendant responder releases and already
156
+ // includes that responder's terminal displacement. It establishes the scroll baseline;
157
+ // only subsequent scroll frames are user viewport movement.
158
+ observedPosition = withAxis(observedPosition, axis, offset);
159
+ expectedPosition = withAxis(expectedPosition, axis, offset);
107
160
  },
108
161
  scrollEnded: (axis, offset) => {
162
+ const pendingScroll = pending.get(axis);
163
+ if (pendingScroll?.restoring) {
164
+ if (!isSameOffset(offset, pendingScroll.target))
165
+ restore(axis, offset, pendingScroll.target);
166
+ return;
167
+ }
168
+ if (userGestures.has(axis)) {
169
+ scrolled(axis, offset);
170
+ userGestures.delete(axis);
171
+ return;
172
+ }
109
173
  scrolled(axis, offset);
110
- echoTails.delete(axis);
111
174
  if (pending.has(axis))
112
175
  settle(axis, offset);
113
176
  },
@@ -115,6 +178,7 @@ export function createGridScrollSync({ scrollTo, onUserScroll, onProgrammaticScr
115
178
  for (const axis of AXES)
116
179
  release(axis);
117
180
  echoTails.clear();
181
+ userGestures.clear();
118
182
  },
119
183
  };
120
184
  }
@@ -1 +1 @@
1
- {"version":3,"file":"createGridScrollSync.js","sourceRoot":"","sources":["../../../../src/features/grid-view/application/createGridScrollSync.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,yBAAyB,EACzB,0BAA0B,EAC1B,yBAAyB,GAC1B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAEtE,MAAM,IAAI,GAA8B,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;AAMnD;;;GAGG;AACH,MAAM,UAAU,oBAAoB,CAAC,EACnC,QAAQ,EACR,YAAY,EACZ,oBAAoB,EACpB,GAAG,GAAG,IAAI,CAAC,GAAG,EACd,QAAQ,GAAG,UAAU,EACrB,MAAM,GAAG,YAAY,GACC;IACtB,IAAI,QAAQ,GAAuB,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;IAClD,MAAM,OAAO,GAAG,IAAI,GAAG,EAAqC,CAAC;IAC7D,MAAM,QAAQ,GAAG,IAAI,GAAG,EAA0B,CAAC;IACnD,8EAA8E;IAC9E,MAAM,SAAS,GAAG,IAAI,GAAG,EAA4B,CAAC;IACtD,MAAM,MAAM,GAAG,IAAI,GAAG,EAAiD,CAAC;IAExE,MAAM,UAAU,GAAG,CAAC,IAAoB,EAAE,EAAE;QAC1C,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAC/B,IAAI,KAAK,KAAK,SAAS;YAAE,MAAM,CAAC,KAAK,CAAC,CAAC;QACvC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACtB,CAAC,CAAC;IACF,MAAM,OAAO,GAAG,CAAC,IAAoB,EAAE,EAAE;QACvC,UAAU,CAAC,IAAI,CAAC,CAAC;QACjB,OAAO,CAAC,MAAM,CAAC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AAC,GAAG,yBAAyB,CACvF,CAAC;AACJ,CAAC;AAED,qDAAqD;AACrD,SAAS,QAAQ,CAAC,KAAyB,EAAE,IAAoB;IAC/D,OAAO,IAAI,KAAK,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;AAC1C,CAAC;AAED,wDAAwD;AACxD,SAAS,QAAQ,CACf,KAAyB,EACzB,IAAoB,EACpB,MAAc;IAEd,OAAO,IAAI,KAAK,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC;AAC1E,CAAC;AAED,yFAAyF;AACzF,SAAS,YAAY,CAAC,IAAY,EAAE,KAAa;IAC/C,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI,yBAAyB,CAAC;AAC7D,CAAC","sourcesContent":["import type {\n GridPendingScroll,\n GridScrollAxis,\n GridScrollPosition,\n GridScrollSync,\n GridScrollSyncOptions,\n} from '../../../types/grid-view';\nimport {\n ANIMATED_SCROLL_WINDOW_MS,\n IMMEDIATE_SCROLL_WINDOW_MS,\n SCROLL_POSITION_TOLERANCE,\n} from '../constants/scroll';\nimport { resolveScrollEventSource } from './resolveScrollEventSource';\n\nconst AXES: readonly GridScrollAxis[] = ['x', 'y'];\ninterface EchoTail {\n lastOffset: number;\n target: number;\n}\n\n/***\n * Arbitrates each native scroll axis between programmatic requests and the user,\n * so echoes of GridView's own scrollTo calls never become viewport pans.\n */\nexport function createGridScrollSync({\n scrollTo,\n onUserScroll,\n onProgrammaticScroll,\n now = Date.now,\n schedule = setTimeout,\n cancel = clearTimeout,\n}: GridScrollSyncOptions): GridScrollSync {\n let position: GridScrollPosition = { x: 0, y: 0 };\n const pending = new Map<GridScrollAxis, GridPendingScroll>();\n const inFlight = new Map<GridScrollAxis, number>();\n // Keep ownership of late frames even after a stalled animation is reconciled.\n const echoTails = new Map<GridScrollAxis, EchoTail>();\n const timers = new Map<GridScrollAxis, ReturnType<typeof setTimeout>>();\n\n const clearTimer = (axis: GridScrollAxis) => {\n const timer = timers.get(axis);\n if (timer !== undefined) cancel(timer);\n timers.delete(axis);\n };\n const release = (axis: GridScrollAxis) => {\n clearTimer(axis);\n pending.delete(axis);\n inFlight.delete(axis);\n };\n const adopt = (axis: GridScrollAxis, offset: number) => {\n const displacement = offset - readAxis(position, axis);\n position = withAxis(position, axis, offset);\n if (displacement !== 0) onUserScroll(axis, displacement);\n };\n const settle = (axis: GridScrollAxis, finalOffset?: number) => {\n const pendingScroll = pending.get(axis);\n const offset = finalOffset ?? inFlight.get(axis);\n release(axis);\n if (offset !== undefined) {\n if (\n finalOffset === undefined &&\n pendingScroll?.animated &&\n !isSameOffset(offset, pendingScroll.target)\n ) {\n echoTails.set(axis, { lastOffset: offset, target: pendingScroll.target });\n } else {\n echoTails.delete(axis);\n }\n adopt(axis, offset);\n }\n };\n const scrolled = (axis: GridScrollAxis, offset: number) => {\n const tail = echoTails.get(axis);\n if (tail) {\n if (isContinuingProgrammaticEcho(tail, offset)) {\n const displacement = offset - readAxis(position, axis);\n position = withAxis(position, axis, offset);\n if (displacement !== 0) onProgrammaticScroll(axis, displacement);\n if (isSameOffset(offset, tail.target)) echoTails.delete(axis);\n else tail.lastOffset = offset;\n return;\n }\n echoTails.delete(axis);\n }\n let pendingScroll = pending.get(axis);\n if (pendingScroll?.animated && now() > pendingScroll.expiresAt) {\n // A native scroll may deliver its first frame after the initial deadline.\n // Without an explicit drag/end, that is still an echo of our scrollTo.\n pendingScroll = { ...pendingScroll, expiresAt: now() + ANIMATED_SCROLL_WINDOW_MS };\n pending.set(axis, pendingScroll);\n }\n const source = resolveScrollEventSource(pendingScroll, offset, now());\n if (source === 'in-flight' && pendingScroll) {\n clearTimer(axis);\n inFlight.set(axis, offset);\n // Native animation frames can pause longer than 120ms; only reconcile at the\n // original request deadline, or earlier on an explicit drag/end/target echo.\n timers.set(\n axis,\n schedule(() => settle(axis), Math.max(0, pendingScroll.expiresAt - now())),\n );\n return;\n }\n release(axis);\n if (source === 'user') adopt(axis, offset);\n };\n\n return {\n isCurrent: (next) =>\n AXES.every((axis) => isSameOffset(readAxis(position, axis), readAxis(next, axis))),\n request: (next, animated) => {\n const windowMs = animated ? ANIMATED_SCROLL_WINDOW_MS : IMMEDIATE_SCROLL_WINDOW_MS;\n const expiresAt = now() + windowMs;\n for (const axis of AXES) {\n const target = readAxis(next, axis);\n if (isSameOffset(readAxis(position, axis), target)) continue;\n release(axis);\n echoTails.delete(axis);\n pending.set(axis, { animated, expiresAt, target });\n scrollTo(axis, target, animated);\n }\n position = next;\n },\n scrolled,\n dragBegan: (axis, offset) => {\n const hadTail = echoTails.delete(axis);\n if (pending.has(axis) || inFlight.has(axis)) settle(axis, offset);\n else if (hadTail) adopt(axis, offset);\n },\n scrollEnded: (axis, offset) => {\n scrolled(axis, offset);\n echoTails.delete(axis);\n if (pending.has(axis)) settle(axis, offset);\n },\n dispose: () => {\n for (const axis of AXES) release(axis);\n echoTails.clear();\n },\n };\n}\n\n/*** Suppresses delayed monotonic frames toward the old programmatic target until an actual drag/end. */\nfunction isContinuingProgrammaticEcho({ lastOffset, target }: EchoTail, offset: number): boolean {\n const step = offset - lastOffset;\n if (Math.abs(step) <= SCROLL_POSITION_TOLERANCE) return true;\n return (\n Math.sign(step) === Math.sign(target - lastOffset) &&\n Math.abs(target - offset) <= Math.abs(target - lastOffset) + SCROLL_POSITION_TOLERANCE\n );\n}\n\n/*** Reads one axis of a physical scroll position. */\nfunction readAxis(value: GridScrollPosition, axis: GridScrollAxis): number {\n return axis === 'x' ? value.x : value.y;\n}\n\n/*** Replaces one axis of a physical scroll position. */\nfunction withAxis(\n value: GridScrollPosition,\n axis: GridScrollAxis,\n offset: number,\n): GridScrollPosition {\n return axis === 'x' ? { ...value, x: offset } : { ...value, y: offset };\n}\n\n/*** Treats offsets within the native positioning tolerance as the same scroll offset. */\nfunction isSameOffset(left: number, right: number): boolean {\n return Math.abs(left - right) <= SCROLL_POSITION_TOLERANCE;\n}\n"]}
1
+ {"version":3,"file":"createGridScrollSync.js","sourceRoot":"","sources":["../../../../src/features/grid-view/application/createGridScrollSync.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,yBAAyB,EACzB,0BAA0B,EAC1B,yBAAyB,GAC1B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAEtE,MAAM,IAAI,GAA8B,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;AAMnD,mGAAmG;AACnG,MAAM,UAAU,oBAAoB,CAAC,EACnC,QAAQ,EACR,YAAY,EACZ,mBAAmB,GAAG,IAAI,EAC1B,GAAG,GAAG,IAAI,CAAC,GAAG,EACd,QAAQ,GAAG,UAAU,EACrB,MAAM,GAAG,YAAY,GACC;IACtB,iFAAiF;IACjF,iFAAiF;IACjF,IAAI,gBAAgB,GAAuB,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;IAC1D,IAAI,gBAAgB,GAAuB,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;IAC1D,MAAM,OAAO,GAAG,IAAI,GAAG,EAAqC,CAAC;IAC7D,MAAM,QAAQ,GAAG,IAAI,GAAG,EAA0B,CAAC;IACnD,MAAM,YAAY,GAAG,IAAI,GAAG,EAAkB,CAAC;IAC/C,MAAM,SAAS,GAAG,IAAI,GAAG,EAA4B,CAAC;IACtD,MAAM,MAAM,GAAG,IAAI,GAAG,EAAiD,CAAC;IAExE,MAAM,UAAU,GAAG,CAAC,IAAoB,EAAE,EAAE;QAC1C,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAC/B,IAAI,KAAK,KAAK,SAAS;YAAE,MAAM,CAAC,KAAK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,CAAC","sourcesContent":["import type {\n GridPendingScroll,\n GridScrollAxis,\n GridScrollPosition,\n GridScrollSync,\n GridScrollSyncOptions,\n} from '../../../types/grid-view';\nimport {\n ANIMATED_SCROLL_WINDOW_MS,\n IMMEDIATE_SCROLL_WINDOW_MS,\n SCROLL_POSITION_TOLERANCE,\n} from '../constants/scroll';\nimport { resolveScrollEventSource } from './resolveScrollEventSource';\n\nconst AXES: readonly GridScrollAxis[] = ['x', 'y'];\ninterface EchoTail {\n lastOffset: number;\n target: number;\n}\n\n/*** Arbitrates native scroll ownership so programmatic offsets never become viewport proposals. */\nexport function createGridScrollSync({\n scrollTo,\n onUserScroll,\n acceptUnownedScroll = true,\n now = Date.now,\n schedule = setTimeout,\n cancel = clearTimeout,\n}: GridScrollSyncOptions): GridScrollSync {\n // A requested native position is not proof that the platform reached it. Keeping\n // target and observed positions separate prevents rebasing echoes becoming pans.\n let expectedPosition: GridScrollPosition = { x: 0, y: 0 };\n let observedPosition: GridScrollPosition = { x: 0, y: 0 };\n const pending = new Map<GridScrollAxis, GridPendingScroll>();\n const inFlight = new Map<GridScrollAxis, number>();\n const userGestures = new Set<GridScrollAxis>();\n const echoTails = new Map<GridScrollAxis, EchoTail>();\n const timers = new Map<GridScrollAxis, ReturnType<typeof setTimeout>>();\n\n const clearTimer = (axis: GridScrollAxis) => {\n const timer = timers.get(axis);\n if (timer !== undefined) cancel(timer);\n timers.delete(axis);\n };\n const release = (axis: GridScrollAxis) => {\n clearTimer(axis);\n pending.delete(axis);\n inFlight.delete(axis);\n };\n const adopt = (axis: GridScrollAxis, offset: number) => {\n const displacement = offset - readAxis(observedPosition, axis);\n observedPosition = withAxis(observedPosition, axis, offset);\n expectedPosition = withAxis(expectedPosition, axis, offset);\n if (displacement !== 0) onUserScroll(axis, displacement);\n };\n const adoptFromExpected = (axis: GridScrollAxis, offset: number) => {\n const displacement = offset - readAxis(expectedPosition, axis);\n observedPosition = withAxis(observedPosition, axis, offset);\n expectedPosition = withAxis(expectedPosition, axis, offset);\n if (displacement !== 0) onUserScroll(axis, displacement);\n };\n const settle = (axis: GridScrollAxis, finalOffset?: number) => {\n const pendingScroll = pending.get(axis);\n const offset = finalOffset ?? inFlight.get(axis);\n release(axis);\n if (offset === undefined) return;\n if (pendingScroll?.animated && !isSameOffset(offset, pendingScroll.target)) {\n echoTails.set(axis, { lastOffset: offset, target: pendingScroll.target });\n } else {\n echoTails.delete(axis);\n }\n if (acceptUnownedScroll) adoptFromExpected(axis, offset);\n else observedPosition = withAxis(observedPosition, axis, offset);\n };\n /*** Restores a locked native axis and retains ownership until a new native drag takes it over. */\n const restore = (axis: GridScrollAxis, offset: number, target: number) => {\n release(axis);\n echoTails.delete(axis);\n userGestures.delete(axis);\n observedPosition = withAxis(observedPosition, axis, offset);\n expectedPosition = withAxis(expectedPosition, axis, target);\n pending.set(axis, {\n animated: false,\n expiresAt: Number.POSITIVE_INFINITY,\n restoring: true,\n target,\n });\n if (!isSameOffset(offset, target)) scrollTo(axis, target, false);\n };\n const scrolled = (axis: GridScrollAxis, offset: number) => {\n const pendingScroll = pending.get(axis);\n if (pendingScroll?.restoring) {\n observedPosition = withAxis(observedPosition, axis, offset);\n if (!isSameOffset(offset, pendingScroll.target)) restore(axis, offset, pendingScroll.target);\n return;\n }\n if (userGestures.has(axis)) {\n adopt(axis, offset);\n return;\n }\n const tail = echoTails.get(axis);\n if (tail) {\n if (isContinuingProgrammaticEcho(tail, offset)) {\n observedPosition = withAxis(observedPosition, axis, offset);\n if (acceptUnownedScroll) expectedPosition = withAxis(expectedPosition, axis, offset);\n if (isSameOffset(offset, tail.target)) echoTails.delete(axis);\n else tail.lastOffset = offset;\n return;\n }\n echoTails.delete(axis);\n }\n let currentPending = pendingScroll;\n if (currentPending?.animated && now() > currentPending.expiresAt) {\n currentPending = { ...currentPending, expiresAt: now() + ANIMATED_SCROLL_WINDOW_MS };\n pending.set(axis, currentPending);\n }\n const source = resolveScrollEventSource(currentPending, offset, now());\n if (source === 'in-flight' && currentPending) {\n clearTimer(axis);\n inFlight.set(axis, offset);\n timers.set(\n axis,\n schedule(() => settle(axis), Math.max(0, currentPending.expiresAt - now())),\n );\n observedPosition = withAxis(observedPosition, axis, offset);\n return;\n }\n if (source === 'settled') {\n release(axis);\n observedPosition = withAxis(observedPosition, axis, offset);\n return;\n }\n if (currentPending && !acceptUnownedScroll) {\n release(axis);\n observedPosition = withAxis(observedPosition, axis, offset);\n return;\n }\n if (acceptUnownedScroll) adoptFromExpected(axis, offset);\n else adopt(axis, offset);\n };\n\n return {\n isCurrent: (next) =>\n AXES.every((axis) => isSameOffset(readAxis(expectedPosition, axis), readAxis(next, axis))),\n request: (next, animated) => {\n const windowMs = animated ? ANIMATED_SCROLL_WINDOW_MS : IMMEDIATE_SCROLL_WINDOW_MS;\n const expiresAt = now() + windowMs;\n for (const axis of AXES) {\n const target = readAxis(next, axis);\n if (isSameOffset(readAxis(expectedPosition, axis), target)) continue;\n release(axis);\n echoTails.delete(axis);\n userGestures.delete(axis);\n pending.set(axis, { animated, expiresAt, target });\n scrollTo(axis, target, animated);\n expectedPosition = withAxis(expectedPosition, axis, target);\n }\n },\n restore,\n scrolled,\n dragBegan: (axis, offset) => {\n const pendingScroll = pending.get(axis);\n if (pendingScroll?.restoring && !isSameOffset(offset, pendingScroll.target)) {\n restore(axis, offset, pendingScroll.target);\n return;\n }\n release(axis);\n echoTails.delete(axis);\n userGestures.add(axis);\n // Native scroll-begin can arrive after a descendant responder releases and already\n // includes that responder's terminal displacement. It establishes the scroll baseline;\n // only subsequent scroll frames are user viewport movement.\n observedPosition = withAxis(observedPosition, axis, offset);\n expectedPosition = withAxis(expectedPosition, axis, offset);\n },\n scrollEnded: (axis, offset) => {\n const pendingScroll = pending.get(axis);\n if (pendingScroll?.restoring) {\n if (!isSameOffset(offset, pendingScroll.target))\n restore(axis, offset, pendingScroll.target);\n return;\n }\n if (userGestures.has(axis)) {\n scrolled(axis, offset);\n userGestures.delete(axis);\n return;\n }\n scrolled(axis, offset);\n if (pending.has(axis)) settle(axis, offset);\n },\n dispose: () => {\n for (const axis of AXES) release(axis);\n echoTails.clear();\n userGestures.clear();\n },\n };\n}\n\n/*** Suppresses delayed monotonic frames toward the old programmatic target until an actual drag/end. */\nfunction isContinuingProgrammaticEcho({ lastOffset, target }: EchoTail, offset: number): boolean {\n const step = offset - lastOffset;\n if (Math.abs(step) <= SCROLL_POSITION_TOLERANCE) return true;\n return (\n Math.sign(step) === Math.sign(target - lastOffset) &&\n Math.abs(target - offset) <= Math.abs(target - lastOffset) + SCROLL_POSITION_TOLERANCE\n );\n}\n\n/*** Reads one axis of a physical scroll position. */\nfunction readAxis(value: GridScrollPosition, axis: GridScrollAxis): number {\n return axis === 'x' ? value.x : value.y;\n}\n\n/*** Replaces one axis of a physical scroll position. */\nfunction withAxis(\n value: GridScrollPosition,\n axis: GridScrollAxis,\n offset: number,\n): GridScrollPosition {\n return axis === 'x' ? { ...value, x: offset } : { ...value, y: offset };\n}\n\n/*** Treats offsets within the native positioning tolerance as the same scroll offset. */\nfunction isSameOffset(left: number, right: number): boolean {\n return Math.abs(left - right) <= SCROLL_POSITION_TOLERANCE;\n}\n"]}
@@ -1,4 +1,4 @@
1
- export type { GridViewProps, TileGridItem, TileGridProps } from '../../types/grid-view';
1
+ export type { GridViewProps, GridWorldLayerContext, TileGridItem, TileGridProps, } from '../../types/grid-view';
2
2
  export { GridView } from './adapters/inbound/GridView';
3
3
  export { TileGrid } from './adapters/inbound/TileGrid';
4
4
  export { layoutTileGrid } from './application/layoutTileGrid';
@@ -1 +1 @@
1
- {"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../../src/features/grid-view/public.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACxF,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC"}
1
+ {"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../../src/features/grid-view/public.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,aAAa,EACb,qBAAqB,EACrB,YAAY,EACZ,aAAa,GACd,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"public.js","sourceRoot":"","sources":["../../../src/features/grid-view/public.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC","sourcesContent":["export type { GridViewProps, TileGridItem, TileGridProps } from '../../types/grid-view';\nexport { GridView } from './adapters/inbound/GridView';\nexport { TileGrid } from './adapters/inbound/TileGrid';\nexport { layoutTileGrid } from './application/layoutTileGrid';\n"]}
1
+ {"version":3,"file":"public.js","sourceRoot":"","sources":["../../../src/features/grid-view/public.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC","sourcesContent":["export type {\n GridViewProps,\n GridWorldLayerContext,\n TileGridItem,\n TileGridProps,\n} from '../../types/grid-view';\nexport { GridView } from './adapters/inbound/GridView';\nexport { TileGrid } from './adapters/inbound/TileGrid';\nexport { layoutTileGrid } from './application/layoutTileGrid';\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"createScrollGestureLock.d.ts","sourceRoot":"","sources":["../../../../src/features/layout/utils/createScrollGestureLock.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE/D,yHAAyH;AACzH,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,iBAAiB,EACzB,sBAAsB,EAAE,CAAC,KAAK,EAAE,CAAC,GAAG,CAAC,CAAC,KAAK,IAAI,GAC9C,iBAAiB,CAcnB"}
1
+ {"version":3,"file":"createScrollGestureLock.d.ts","sourceRoot":"","sources":["../../../../src/features/layout/utils/createScrollGestureLock.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE/D,yHAAyH;AACzH,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,iBAAiB,EACzB,sBAAsB,EAAE,CAAC,KAAK,EAAE,CAAC,GAAG,CAAC,CAAC,KAAK,IAAI,GAC9C,iBAAiB,CAkBnB"}
@@ -1,14 +1,18 @@
1
1
  /*** Creates a lock that reports each held gesture to its scroll container and also suspends every ancestor container. */
2
2
  export function createScrollGestureLock(parent, onActiveGesturesChange) {
3
+ let activeGestures = 0;
3
4
  return {
5
+ isActive: () => activeGestures > 0,
4
6
  acquire: () => {
5
7
  const releaseParent = parent.acquire();
6
8
  let released = false;
9
+ activeGestures += 1;
7
10
  onActiveGesturesChange(1);
8
11
  return () => {
9
12
  if (released)
10
13
  return;
11
14
  released = true;
15
+ activeGestures -= 1;
12
16
  onActiveGesturesChange(-1);
13
17
  releaseParent();
14
18
  };
@@ -1 +1 @@
1
- {"version":3,"file":"createScrollGestureLock.js","sourceRoot":"","sources":["../../../../src/features/layout/utils/createScrollGestureLock.ts"],"names":[],"mappings":"AAEA,yHAAyH;AACzH,MAAM,UAAU,uBAAuB,CACrC,MAAyB,EACzB,sBAA+C;IAE/C,OAAO;QACL,OAAO,EAAE,GAAG,EAAE;YACZ,MAAM,aAAa,GAAG,MAAM,CAAC,OAAO,EAAE,CAAC;YACvC,IAAI,QAAQ,GAAG,KAAK,CAAC;YACrB,sBAAsB,CAAC,CAAC,CAAC,CAAC;YAC1B,OAAO,GAAG,EAAE;gBACV,IAAI,QAAQ;oBAAE,OAAO;gBACrB,QAAQ,GAAG,IAAI,CAAC;gBAChB,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC;gBAC3B,aAAa,EAAE,CAAC;YAClB,CAAC,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["import type { ScrollGestureLock } from '../../../types/layout';\n\n/*** Creates a lock that reports each held gesture to its scroll container and also suspends every ancestor container. */\nexport function createScrollGestureLock(\n parent: ScrollGestureLock,\n onActiveGesturesChange: (delta: 1 | -1) => void,\n): ScrollGestureLock {\n return {\n acquire: () => {\n const releaseParent = parent.acquire();\n let released = false;\n onActiveGesturesChange(1);\n return () => {\n if (released) return;\n released = true;\n onActiveGesturesChange(-1);\n releaseParent();\n };\n },\n };\n}\n"]}
1
+ {"version":3,"file":"createScrollGestureLock.js","sourceRoot":"","sources":["../../../../src/features/layout/utils/createScrollGestureLock.ts"],"names":[],"mappings":"AAEA,yHAAyH;AACzH,MAAM,UAAU,uBAAuB,CACrC,MAAyB,EACzB,sBAA+C;IAE/C,IAAI,cAAc,GAAG,CAAC,CAAC;IACvB,OAAO;QACL,QAAQ,EAAE,GAAG,EAAE,CAAC,cAAc,GAAG,CAAC;QAClC,OAAO,EAAE,GAAG,EAAE;YACZ,MAAM,aAAa,GAAG,MAAM,CAAC,OAAO,EAAE,CAAC;YACvC,IAAI,QAAQ,GAAG,KAAK,CAAC;YACrB,cAAc,IAAI,CAAC,CAAC;YACpB,sBAAsB,CAAC,CAAC,CAAC,CAAC;YAC1B,OAAO,GAAG,EAAE;gBACV,IAAI,QAAQ;oBAAE,OAAO;gBACrB,QAAQ,GAAG,IAAI,CAAC;gBAChB,cAAc,IAAI,CAAC,CAAC;gBACpB,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC;gBAC3B,aAAa,EAAE,CAAC;YAClB,CAAC,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["import type { ScrollGestureLock } from '../../../types/layout';\n\n/*** Creates a lock that reports each held gesture to its scroll container and also suspends every ancestor container. */\nexport function createScrollGestureLock(\n parent: ScrollGestureLock,\n onActiveGesturesChange: (delta: 1 | -1) => void,\n): ScrollGestureLock {\n let activeGestures = 0;\n return {\n isActive: () => activeGestures > 0,\n acquire: () => {\n const releaseParent = parent.acquire();\n let released = false;\n activeGestures += 1;\n onActiveGesturesChange(1);\n return () => {\n if (released) return;\n released = true;\n activeGestures -= 1;\n onActiveGesturesChange(-1);\n releaseParent();\n };\n },\n };\n}\n"]}
@@ -0,0 +1,5 @@
1
+ export { compileZoraTheme } from '#zora/theme/application/use-cases/compileZoraTheme';
2
+ export { createZoraThemeConfig } from '#zora/theme/application/use-cases/createZoraThemeConfig';
3
+ export { zoraDefaultTheme } from '#zora/theme/zoraDefaultTheme';
4
+ export type { ZoraComputedTheme, ZoraComputedThemeMode, ZoraTheme, ZoraThemeCompilationDiagnostic, ZoraThemeCompilationDiagnosticCode, ZoraThemeCompilationOptions, ZoraThemeId, ZoraThemeMode, ZoraThemeProvenanceEntry, ZoraThemeSelectionResult, ZoraThemeSelectionTarget, ZoraThemeSwatchRole, ZoraThemeValueOrigin, } from '#zora/types/theme';
5
+ //# sourceMappingURL=node.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../../src/features/theme/node.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oDAAoD,CAAC;AACtF,OAAO,EAAE,qBAAqB,EAAE,MAAM,yDAAyD,CAAC;AAChG,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,YAAY,EACV,iBAAiB,EACjB,qBAAqB,EACrB,SAAS,EACT,8BAA8B,EAC9B,kCAAkC,EAClC,2BAA2B,EAC3B,WAAW,EACX,aAAa,EACb,wBAAwB,EACxB,wBAAwB,EACxB,wBAAwB,EACxB,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,mBAAmB,CAAC"}
@@ -0,0 +1,4 @@
1
+ export { compileZoraTheme } from '#zora/theme/application/use-cases/compileZoraTheme';
2
+ export { createZoraThemeConfig } from '#zora/theme/application/use-cases/createZoraThemeConfig';
3
+ export { zoraDefaultTheme } from '#zora/theme/zoraDefaultTheme';
4
+ //# sourceMappingURL=node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node.js","sourceRoot":"","sources":["../../../src/features/theme/node.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oDAAoD,CAAC;AACtF,OAAO,EAAE,qBAAqB,EAAE,MAAM,yDAAyD,CAAC;AAChG,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC","sourcesContent":["export { compileZoraTheme } from '#zora/theme/application/use-cases/compileZoraTheme';\nexport { createZoraThemeConfig } from '#zora/theme/application/use-cases/createZoraThemeConfig';\nexport { zoraDefaultTheme } from '#zora/theme/zoraDefaultTheme';\nexport type {\n ZoraComputedTheme,\n ZoraComputedThemeMode,\n ZoraTheme,\n ZoraThemeCompilationDiagnostic,\n ZoraThemeCompilationDiagnosticCode,\n ZoraThemeCompilationOptions,\n ZoraThemeId,\n ZoraThemeMode,\n ZoraThemeProvenanceEntry,\n ZoraThemeSelectionResult,\n ZoraThemeSelectionTarget,\n ZoraThemeSwatchRole,\n ZoraThemeValueOrigin,\n} from '#zora/types/theme';\n"]}
@@ -1,3 +1,5 @@
1
+ export type { ZoraBaseProps, ZoraProviderProps, ZoraThemeScopeProps, ZoraToastCapability, } from './runtime';
2
+ export { useZoraTheme, withZoraThemeScope, ZoraProvider, ZoraThemeScope } from './runtime';
1
3
  export { compileZoraTheme } from '#zora/theme/application/use-cases/compileZoraTheme';
2
4
  export { createZoraThemeConfig } from '#zora/theme/application/use-cases/createZoraThemeConfig';
3
5
  export { zoraDefaultTheme } from '#zora/theme/zoraDefaultTheme';
@@ -1 +1 @@
1
- {"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../../src/features/theme/public.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oDAAoD,CAAC;AACtF,OAAO,EAAE,qBAAqB,EAAE,MAAM,yDAAyD,CAAC;AAChG,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,YAAY,EACV,iBAAiB,EACjB,qBAAqB,EACrB,SAAS,EACT,8BAA8B,EAC9B,kCAAkC,EAClC,2BAA2B,EAC3B,WAAW,EACX,aAAa,EACb,wBAAwB,EACxB,wBAAwB,EACxB,wBAAwB,EACxB,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../../src/features/theme/public.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,aAAa,EACb,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3F,OAAO,EAAE,gBAAgB,EAAE,MAAM,oDAAoD,CAAC;AACtF,OAAO,EAAE,qBAAqB,EAAE,MAAM,yDAAyD,CAAC;AAChG,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,YAAY,EACV,iBAAiB,EACjB,qBAAqB,EACrB,SAAS,EACT,8BAA8B,EAC9B,kCAAkC,EAClC,2BAA2B,EAC3B,WAAW,EACX,aAAa,EACb,wBAAwB,EACxB,wBAAwB,EACxB,wBAAwB,EACxB,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,mBAAmB,CAAC"}