@multiplatform.one/components 9.12.0 → 9.13.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 (405) hide show
  1. package/dist/cjs/Accordion/index.native.js +1 -1
  2. package/dist/cjs/Accordion/index.native.js.map +1 -1
  3. package/dist/cjs/Alert/index.native.js.map +1 -1
  4. package/dist/cjs/AnimateHeight/index.native.js.map +1 -1
  5. package/dist/cjs/Avatar/getInitials.native.js.map +1 -1
  6. package/dist/cjs/Avatar/index.cjs +4 -15
  7. package/dist/cjs/Avatar/index.native.js +4 -15
  8. package/dist/cjs/Avatar/index.native.js.map +1 -1
  9. package/dist/cjs/Badge/index.native.js.map +1 -1
  10. package/dist/cjs/Button.native.js.map +1 -1
  11. package/dist/cjs/Card.native.js.map +1 -1
  12. package/dist/cjs/CardFooter.native.js.map +1 -1
  13. package/dist/cjs/CardHeader.native.js.map +1 -1
  14. package/dist/cjs/Carousel/geometry.native.js.map +1 -1
  15. package/dist/cjs/Carousel/index.native.js +2 -2
  16. package/dist/cjs/Carousel/index.native.js.map +1 -1
  17. package/dist/cjs/ChatTurn/index.native.js.map +1 -1
  18. package/dist/cjs/CheckGlyph/MenuCheckColumn.native.js.map +1 -1
  19. package/dist/cjs/CheckGlyph/index.native.js.map +1 -1
  20. package/dist/cjs/Chip/index.native.js.map +1 -1
  21. package/dist/cjs/ChoiceChips/index.native.js +1 -1
  22. package/dist/cjs/ChoiceChips/index.native.js.map +1 -1
  23. package/dist/cjs/Collapsible.native.js.map +1 -1
  24. package/dist/cjs/ContextMenu/index.native.js.map +1 -1
  25. package/dist/cjs/CopyField/CopyMenuButton.native.js +1 -1
  26. package/dist/cjs/CopyField/CopyMenuButton.native.js.map +1 -1
  27. package/dist/cjs/CopyField/index.native.js.map +1 -1
  28. package/dist/cjs/Dialog.native.js +1 -1
  29. package/dist/cjs/Dialog.native.js.map +1 -1
  30. package/dist/cjs/Diff/diff.native.js.map +1 -1
  31. package/dist/cjs/Diff/index.native.js.map +1 -1
  32. package/dist/cjs/DotIndicator/index.native.js.map +1 -1
  33. package/dist/cjs/DrillStack/DrillBar.native.js.map +1 -1
  34. package/dist/cjs/DrillStack/context.native.js.map +1 -1
  35. package/dist/cjs/DrillStack/drillMotion.native.js.map +1 -1
  36. package/dist/cjs/DropDownPanel/index.native.js.map +1 -1
  37. package/dist/cjs/DropdownMenu/index.native.js.map +1 -1
  38. package/dist/cjs/DropdownMenu/menuSettle.native.js.map +1 -1
  39. package/dist/cjs/ElapsedProgress/index.native.js.map +1 -1
  40. package/dist/cjs/ErrorBoundary/index.native.js.map +1 -1
  41. package/dist/cjs/Heading.native.js.map +1 -1
  42. package/dist/cjs/Kbd/index.native.js.map +1 -1
  43. package/dist/cjs/Kbd/keys.native.js.map +1 -1
  44. package/dist/cjs/Lightbox/MediaControl.native.js.map +1 -1
  45. package/dist/cjs/Lightbox/index.gnome.native.js.map +1 -1
  46. package/dist/cjs/Lightbox/index.native.js +14 -7
  47. package/dist/cjs/Lightbox/index.native.js.map +1 -1
  48. package/dist/cjs/Lightbox/shared.cjs +20 -0
  49. package/dist/cjs/Lightbox/shared.native.js +22 -0
  50. package/dist/cjs/Lightbox/shared.native.js.map +1 -1
  51. package/dist/cjs/Lightbox/useLightbox.native.js.map +1 -1
  52. package/dist/cjs/MachineLiteral/index.native.js.map +1 -1
  53. package/dist/cjs/Material/index.native.js.map +1 -1
  54. package/dist/cjs/Meter/index.native.js +1 -1
  55. package/dist/cjs/Meter/index.native.js.map +1 -1
  56. package/dist/cjs/Meter/meter.native.js.map +1 -1
  57. package/dist/cjs/MiddleEllipsisText/middleSplit.native.js.map +1 -1
  58. package/dist/cjs/MiddleEllipsisText/types.native.js.map +1 -1
  59. package/dist/cjs/Pagination.native.js +1 -1
  60. package/dist/cjs/Pagination.native.js.map +1 -1
  61. package/dist/cjs/Popover.native.js +1 -1
  62. package/dist/cjs/Popover.native.js.map +1 -1
  63. package/dist/cjs/ProgressSteps/index.native.js.map +1 -1
  64. package/dist/cjs/Quote/index.native.js.map +1 -1
  65. package/dist/cjs/SchemeToggle/index.native.js +1 -1
  66. package/dist/cjs/SchemeToggle/index.native.js.map +1 -1
  67. package/dist/cjs/ScrollView.native.js.map +1 -1
  68. package/dist/cjs/Separator/index.native.js.map +1 -1
  69. package/dist/cjs/Sheet.native.js.map +1 -1
  70. package/dist/cjs/SheetModal/SheetBodyRegion.native.js.map +1 -1
  71. package/dist/cjs/SheetModal/SheetHeader.native.js.map +1 -1
  72. package/dist/cjs/SheetModal/SheetNavigation.native.js.map +1 -1
  73. package/dist/cjs/SheetModal/detents.native.js.map +1 -1
  74. package/dist/cjs/SheetModal/useSheetFrameFocus.native.js.map +1 -1
  75. package/dist/cjs/SheetScrollView/index.native.js.map +1 -1
  76. package/dist/cjs/SheetScrollView/sheetHandoff.native.js.map +1 -1
  77. package/dist/cjs/Skeleton/index.native.js.map +1 -1
  78. package/dist/cjs/SkipLink/index.native.js.map +1 -1
  79. package/dist/cjs/SortableList/SortableHandle.native.js.map +1 -1
  80. package/dist/cjs/SortableList/index.native.js.map +1 -1
  81. package/dist/cjs/SortableList/useSortableRows.native.js.map +1 -1
  82. package/dist/cjs/SortableList/useUserOrder.native.js.map +1 -1
  83. package/dist/cjs/SwipeDismissRow/index.native.js.map +1 -1
  84. package/dist/cjs/Tabs/index.cjs +9 -2
  85. package/dist/cjs/Tabs/index.native.js +9 -2
  86. package/dist/cjs/Tabs/index.native.js.map +1 -1
  87. package/dist/cjs/Text.native.js.map +1 -1
  88. package/dist/cjs/ThemePresetPicker/index.native.js +1 -1
  89. package/dist/cjs/ThemePresetPicker/index.native.js.map +1 -1
  90. package/dist/cjs/Toast/index.native.js.map +1 -1
  91. package/dist/cjs/Toast/store.native.js.map +1 -1
  92. package/dist/cjs/Tooltip/nativePress.native.js.map +1 -1
  93. package/dist/cjs/Tooltip/tooltipShared.native.js.map +1 -1
  94. package/dist/cjs/TreeSelect/index.native.js +2 -2
  95. package/dist/cjs/TreeSelect/index.native.js.map +1 -1
  96. package/dist/cjs/TreeSelect/treeSelectModel.native.js.map +1 -1
  97. package/dist/cjs/Video/PlayerChrome.native.js.map +1 -1
  98. package/dist/cjs/Video/VideoFrame.native.js.map +1 -1
  99. package/dist/cjs/Video/types.native.js.map +1 -1
  100. package/dist/cjs/Wheel/index.native.js.map +1 -1
  101. package/dist/cjs/Wizard/index.native.js +2 -2
  102. package/dist/cjs/Wizard/index.native.js.map +1 -1
  103. package/dist/cjs/actions/ActionBar.native.js.map +1 -1
  104. package/dist/cjs/actions/DangerSection.native.js.map +1 -1
  105. package/dist/cjs/actions/DestructiveAction.native.js.map +1 -1
  106. package/dist/cjs/actions/HeaderActions.native.js +2 -2
  107. package/dist/cjs/actions/HeaderActions.native.js.map +1 -1
  108. package/dist/cjs/actions/StandardAction.native.js +1 -1
  109. package/dist/cjs/actions/StandardAction.native.js.map +1 -1
  110. package/dist/cjs/actions/devWarn.native.js.map +1 -1
  111. package/dist/cjs/actions/index.native.js.map +1 -1
  112. package/dist/cjs/actions/severity.native.js.map +1 -1
  113. package/dist/cjs/appShell/AppShell.native.js +1 -1
  114. package/dist/cjs/appShell/AppShell.native.js.map +1 -1
  115. package/dist/cjs/appShell/BottomChromeClearance.native.js.map +1 -1
  116. package/dist/cjs/appShell/Dock.native.js.map +1 -1
  117. package/dist/cjs/appShell/MpoTabHost.native.js.map +1 -1
  118. package/dist/cjs/appShell/ScopeMenu.native.js +1 -1
  119. package/dist/cjs/appShell/ScopeMenu.native.js.map +1 -1
  120. package/dist/cjs/appShell/SettingsSplit.native.js.map +1 -1
  121. package/dist/cjs/appShell/Springboard.native.js +1 -1
  122. package/dist/cjs/appShell/Springboard.native.js.map +1 -1
  123. package/dist/cjs/appShell/SystemBar.native.js +1 -1
  124. package/dist/cjs/appShell/SystemBar.native.js.map +1 -1
  125. package/dist/cjs/appShell/TabBar.native.js +1 -1
  126. package/dist/cjs/appShell/TabBar.native.js.map +1 -1
  127. package/dist/cjs/appShell/appTile.native.js +1 -1
  128. package/dist/cjs/appShell/appTile.native.js.map +1 -1
  129. package/dist/cjs/appShell/bottomChrome.native.js.map +1 -1
  130. package/dist/cjs/appShell/index.native.js.map +1 -1
  131. package/dist/cjs/appShell/stackBack.native.js.map +1 -1
  132. package/dist/cjs/appShell/systemBarFit.native.js.map +1 -1
  133. package/dist/cjs/canvas/index.cjs +20 -0
  134. package/dist/cjs/canvas/index.native.js +23 -0
  135. package/dist/cjs/canvas/index.native.js.map +1 -0
  136. package/dist/cjs/canvas/panBounds.cjs +76 -0
  137. package/dist/cjs/canvas/panBounds.native.js +83 -0
  138. package/dist/cjs/canvas/panBounds.native.js.map +1 -0
  139. package/dist/cjs/charts/Axis.native.js.map +1 -1
  140. package/dist/cjs/charts/BarChart.native.js.map +1 -1
  141. package/dist/cjs/charts/ChartDataView.native.js +1 -1
  142. package/dist/cjs/charts/ChartDataView.native.js.map +1 -1
  143. package/dist/cjs/charts/ChartSurface.native.js.map +1 -1
  144. package/dist/cjs/charts/LineChart.native.js.map +1 -1
  145. package/dist/cjs/charts/PieChart.native.js.map +1 -1
  146. package/dist/cjs/charts/SeriesLegend.native.js.map +1 -1
  147. package/dist/cjs/charts/Sparkline.native.js.map +1 -1
  148. package/dist/cjs/charts/accessibility.native.js.map +1 -1
  149. package/dist/cjs/charts/chartHeight.native.js.map +1 -1
  150. package/dist/cjs/charts/composeChart.native.js.map +1 -1
  151. package/dist/cjs/charts/index.native.js.map +1 -1
  152. package/dist/cjs/charts/math.native.js.map +1 -1
  153. package/dist/cjs/charts/series.native.js.map +1 -1
  154. package/dist/cjs/charts/svg.native.js.map +1 -1
  155. package/dist/cjs/charts/types.native.js.map +1 -1
  156. package/dist/cjs/charts/useChartTheme.native.js.map +1 -1
  157. package/dist/cjs/code/Code/index.native.js.map +1 -1
  158. package/dist/cjs/code/CodeBlock/index.native.js +7 -7
  159. package/dist/cjs/code/CodeBlock/index.native.js.map +1 -1
  160. package/dist/cjs/code/HighlightedCode/index.native.js.map +1 -1
  161. package/dist/cjs/code/Highlighter/houseSyntaxTheme.native.js.map +1 -1
  162. package/dist/cjs/code/Highlighter/index.native.js.map +1 -1
  163. package/dist/cjs/code/Highlighter/namedGroupMatchAll.native.js.map +1 -1
  164. package/dist/cjs/code/HoldSelect/tapGate.native.js.map +1 -1
  165. package/dist/cjs/code/LogView.native.js.map +1 -1
  166. package/dist/cjs/code/PayloadView/index.native.js +4 -4
  167. package/dist/cjs/code/PayloadView/index.native.js.map +1 -1
  168. package/dist/cjs/code/PayloadView/payloadModel.native.js.map +1 -1
  169. package/dist/cjs/code/Pre/index.native.js.map +1 -1
  170. package/dist/cjs/code/index.native.js +7 -7
  171. package/dist/cjs/code/index.native.js.map +1 -1
  172. package/dist/cjs/componentColors.native.js.map +1 -1
  173. package/dist/cjs/feedback/ConfirmDialog.native.js.map +1 -1
  174. package/dist/cjs/feedback/NotifyHost.native.js +2 -2
  175. package/dist/cjs/feedback/NotifyHost.native.js.map +1 -1
  176. package/dist/cjs/feedback/copy.native.js.map +1 -1
  177. package/dist/cjs/feedback/index.native.js.map +1 -1
  178. package/dist/cjs/feedback/notify.native.js.map +1 -1
  179. package/dist/cjs/feedback/route.native.js.map +1 -1
  180. package/dist/cjs/feedback/store.native.js.map +1 -1
  181. package/dist/cjs/formLayouts/FormLayouts.native.js +1 -1
  182. package/dist/cjs/formLayouts/FormLayouts.native.js.map +1 -1
  183. package/dist/cjs/formLayouts/PreferencePanel.native.js +2 -2
  184. package/dist/cjs/formLayouts/PreferencePanel.native.js.map +1 -1
  185. package/dist/cjs/formLayouts/SingleTaskColumn.native.js.map +1 -1
  186. package/dist/cjs/formLayouts/index.native.js.map +1 -1
  187. package/dist/cjs/hooks/index.native.js +1 -1
  188. package/dist/cjs/hooks/index.native.js.map +1 -1
  189. package/dist/cjs/hooks/useClipboard.native.js.map +1 -1
  190. package/dist/cjs/hooks/useDirection.native.js.map +1 -1
  191. package/dist/cjs/hooks/useDocumentTitle.native.js.map +1 -1
  192. package/dist/cjs/icons/CheckRegular.native.js.map +1 -1
  193. package/dist/cjs/icons/MinusRegular.native.js.map +1 -1
  194. package/dist/cjs/icons/index.native.js.map +1 -1
  195. package/dist/cjs/icons/lucide.native.js.map +1 -1
  196. package/dist/cjs/icons/themed.native.js.map +1 -1
  197. package/dist/cjs/images/Image/ImageFrame.native.js +1 -1
  198. package/dist/cjs/images/Image/ImageFrame.native.js.map +1 -1
  199. package/dist/cjs/images/Image/framing.native.js.map +1 -1
  200. package/dist/cjs/images/Image/index.native.js +1 -1
  201. package/dist/cjs/images/Image/mediaRadius.native.js.map +1 -1
  202. package/dist/cjs/images/Image/shared.native.js +1 -1
  203. package/dist/cjs/images/Image/shared.native.js.map +1 -1
  204. package/dist/cjs/images/Image/types.native.js.map +1 -1
  205. package/dist/cjs/images/RemoteArt/index.native.js +1 -1
  206. package/dist/cjs/images/RemoteArt/remoteArtCache.native.js.map +1 -1
  207. package/dist/cjs/images/RemoteArt/svgMarkup.native.js.map +1 -1
  208. package/dist/cjs/images/RemoteArt/types.native.js.map +1 -1
  209. package/dist/cjs/images/index.native.js.map +1 -1
  210. package/dist/cjs/index.cjs +1 -0
  211. package/dist/cjs/index.gnome.native.js +22 -22
  212. package/dist/cjs/index.gnome.native.js.map +1 -1
  213. package/dist/cjs/index.native.js +46 -45
  214. package/dist/cjs/index.native.js.map +1 -1
  215. package/dist/cjs/knobImmuneExports.native.js.map +1 -1
  216. package/dist/cjs/layouts/AsyncBoundary.native.js +2 -2
  217. package/dist/cjs/layouts/AsyncBoundary.native.js.map +1 -1
  218. package/dist/cjs/layouts/Debug/index.native.js.map +1 -1
  219. package/dist/cjs/layouts/EmptyState.native.js +1 -1
  220. package/dist/cjs/layouts/EmptyState.native.js.map +1 -1
  221. package/dist/cjs/layouts/IdentityPlate.native.js.map +1 -1
  222. package/dist/cjs/layouts/KeyboardAvoidingWrapper/behavior.native.js.map +1 -1
  223. package/dist/cjs/layouts/PageTemplates.native.js.map +1 -1
  224. package/dist/cjs/layouts/PaneScaffold.native.js.map +1 -1
  225. package/dist/cjs/layouts/SafeAreaWrapper/insets.native.js.map +1 -1
  226. package/dist/cjs/layouts/StatusDot.native.js.map +1 -1
  227. package/dist/cjs/layouts/StatusGlyphStrip.native.js +1 -1
  228. package/dist/cjs/layouts/StatusGlyphStrip.native.js.map +1 -1
  229. package/dist/cjs/layouts/ViewSwitcher.native.js.map +1 -1
  230. package/dist/cjs/layouts/asyncFailure.native.js.map +1 -1
  231. package/dist/cjs/layouts/attachments.native.js +2 -2
  232. package/dist/cjs/layouts/attachments.native.js.map +1 -1
  233. package/dist/cjs/layouts/barTitleSpan.native.js.map +1 -1
  234. package/dist/cjs/layouts/bottomAccessory.native.js.map +1 -1
  235. package/dist/cjs/layouts/breadcrumbs.native.js.map +1 -1
  236. package/dist/cjs/layouts/index.native.js +3 -3
  237. package/dist/cjs/layouts/index.native.js.map +1 -1
  238. package/dist/cjs/layouts/page.native.js +1 -1
  239. package/dist/cjs/layouts/page.native.js.map +1 -1
  240. package/dist/cjs/layouts/pageHeadingScope.native.js.map +1 -1
  241. package/dist/cjs/layouts/screenScroll.native.js.map +1 -1
  242. package/dist/cjs/layouts/shellSidebarSlot.native.js.map +1 -1
  243. package/dist/cjs/layouts/sidebar.native.js.map +1 -1
  244. package/dist/cjs/layouts/tags.native.js +1 -1
  245. package/dist/cjs/layouts/tags.native.js.map +1 -1
  246. package/dist/cjs/layouts/timeline.native.js +2 -2
  247. package/dist/cjs/layouts/timeline.native.js.map +1 -1
  248. package/dist/cjs/layouts/toolbar.native.js.map +1 -1
  249. package/dist/cjs/shared/actionScan.native.js.map +1 -1
  250. package/dist/cjs/shared/i18n.native.js.map +1 -1
  251. package/dist/cjs/shared/restoreRetries.native.js.map +1 -1
  252. package/dist/cjs/shared/t.native.js.map +1 -1
  253. package/dist/cjs/shared/textRidesText.native.js.map +1 -1
  254. package/dist/cjs/shared/useReturnFocusOnClose.native.js.map +1 -1
  255. package/dist/cjs/surfaces.native.js +1 -1
  256. package/dist/cjs/surfaces.native.js.map +1 -1
  257. package/dist/cjs/tamagui.native.js.map +1 -1
  258. package/dist/cjs/testSetup.native.js.map +1 -1
  259. package/dist/cjs/utils/unwrapText.native.js.map +1 -1
  260. package/dist/cjs/views/Calendar.cjs +281 -40
  261. package/dist/cjs/views/Calendar.native.js +291 -40
  262. package/dist/cjs/views/Calendar.native.js.map +1 -1
  263. package/dist/cjs/views/CardGrid.native.js.map +1 -1
  264. package/dist/cjs/views/Dashboard.native.js +1 -1
  265. package/dist/cjs/views/Dashboard.native.js.map +1 -1
  266. package/dist/cjs/views/FilePreview.native.js +2 -2
  267. package/dist/cjs/views/FilePreview.native.js.map +1 -1
  268. package/dist/cjs/views/Gantt.native.js +1 -1
  269. package/dist/cjs/views/Gantt.native.js.map +1 -1
  270. package/dist/cjs/views/GanttDateGrip.native.js.map +1 -1
  271. package/dist/cjs/views/ImageGrid.native.js +2 -2
  272. package/dist/cjs/views/ImageGrid.native.js.map +1 -1
  273. package/dist/cjs/views/List.native.js.map +1 -1
  274. package/dist/cjs/views/ListGroup.native.js +1 -1
  275. package/dist/cjs/views/ListGroup.native.js.map +1 -1
  276. package/dist/cjs/views/ListRow.native.js.map +1 -1
  277. package/dist/cjs/views/Matrix.native.js +1 -1
  278. package/dist/cjs/views/Matrix.native.js.map +1 -1
  279. package/dist/cjs/views/ReportBuilder.native.js +1 -1
  280. package/dist/cjs/views/ReportBuilder.native.js.map +1 -1
  281. package/dist/cjs/views/ShortcutCard.native.js.map +1 -1
  282. package/dist/cjs/views/TreeView.native.js.map +1 -1
  283. package/dist/cjs/views/calendarMath.cjs +14 -0
  284. package/dist/cjs/views/calendarMath.native.js +14 -0
  285. package/dist/cjs/views/calendarMath.native.js.map +1 -1
  286. package/dist/cjs/views/ganttIntervals.native.js.map +1 -1
  287. package/dist/cjs/views/ganttMath.native.js.map +1 -1
  288. package/dist/cjs/views/index.native.js +1 -1
  289. package/dist/cjs/views/index.native.js.map +1 -1
  290. package/dist/cjs/views/kanbanDnd.native.js.map +1 -1
  291. package/dist/cjs/views/matrixMath.native.js.map +1 -1
  292. package/dist/cjs/views/sameNameScope.native.js.map +1 -1
  293. package/dist/cjs/views/treeViewDnd.native.js.map +1 -1
  294. package/dist/cjs/views/treeViewLayout.native.js.map +1 -1
  295. package/dist/cjs/views/treeViewMotion.native.js.map +1 -1
  296. package/dist/cjs/views/treeViewReveal.native.js.map +1 -1
  297. package/dist/cjs/views/usePageFlowLoadMore.native.js.map +1 -1
  298. package/dist/cjs/views/widgetChrome.native.js.map +1 -1
  299. package/dist/esm/Avatar/index.mjs +5 -15
  300. package/dist/esm/Avatar/index.mjs.map +1 -1
  301. package/dist/esm/Avatar/index.native.js +5 -15
  302. package/dist/esm/Avatar/index.native.js.map +1 -1
  303. package/dist/esm/Lightbox/index.native.js +14 -7
  304. package/dist/esm/Lightbox/index.native.js.map +1 -1
  305. package/dist/esm/Lightbox/shared.mjs +20 -1
  306. package/dist/esm/Lightbox/shared.mjs.map +1 -1
  307. package/dist/esm/Lightbox/shared.native.js +22 -1
  308. package/dist/esm/Lightbox/shared.native.js.map +1 -1
  309. package/dist/esm/Tabs/index.mjs +10 -3
  310. package/dist/esm/Tabs/index.mjs.map +1 -1
  311. package/dist/esm/Tabs/index.native.js +10 -3
  312. package/dist/esm/Tabs/index.native.js.map +1 -1
  313. package/dist/esm/canvas/index.mjs +2 -0
  314. package/dist/esm/canvas/index.mjs.map +1 -0
  315. package/dist/esm/canvas/index.native.js +2 -0
  316. package/dist/esm/canvas/index.native.js.map +1 -0
  317. package/dist/esm/canvas/panBounds.mjs +46 -0
  318. package/dist/esm/canvas/panBounds.mjs.map +1 -0
  319. package/dist/esm/canvas/panBounds.native.js +50 -0
  320. package/dist/esm/canvas/panBounds.native.js.map +1 -0
  321. package/dist/esm/index.mjs +1 -0
  322. package/dist/esm/index.mjs.map +1 -1
  323. package/dist/esm/index.native.js +1 -0
  324. package/dist/esm/index.native.js.map +1 -1
  325. package/dist/esm/views/Calendar.mjs +283 -42
  326. package/dist/esm/views/Calendar.mjs.map +1 -1
  327. package/dist/esm/views/Calendar.native.js +293 -42
  328. package/dist/esm/views/Calendar.native.js.map +1 -1
  329. package/dist/esm/views/calendarMath.mjs +14 -1
  330. package/dist/esm/views/calendarMath.mjs.map +1 -1
  331. package/dist/esm/views/calendarMath.native.js +14 -1
  332. package/dist/esm/views/calendarMath.native.js.map +1 -1
  333. package/dist/jsx/Avatar/index.mjs +5 -15
  334. package/dist/jsx/Avatar/index.mjs.map +1 -1
  335. package/dist/jsx/Avatar/index.native.js +4 -15
  336. package/dist/jsx/Avatar/index.native.js.map +1 -1
  337. package/dist/jsx/Lightbox/index.native.js +13 -6
  338. package/dist/jsx/Lightbox/index.native.js.map +1 -1
  339. package/dist/jsx/Lightbox/shared.mjs +20 -1
  340. package/dist/jsx/Lightbox/shared.mjs.map +1 -1
  341. package/dist/jsx/Lightbox/shared.native.js +22 -0
  342. package/dist/jsx/Lightbox/shared.native.js.map +1 -1
  343. package/dist/jsx/Tabs/index.mjs +10 -3
  344. package/dist/jsx/Tabs/index.mjs.map +1 -1
  345. package/dist/jsx/Tabs/index.native.js +9 -2
  346. package/dist/jsx/Tabs/index.native.js.map +1 -1
  347. package/dist/jsx/canvas/index.mjs +2 -0
  348. package/dist/jsx/canvas/index.mjs.map +1 -0
  349. package/dist/jsx/canvas/index.native.js +23 -0
  350. package/dist/jsx/canvas/index.native.js.map +1 -0
  351. package/dist/jsx/canvas/panBounds.mjs +46 -0
  352. package/dist/jsx/canvas/panBounds.mjs.map +1 -0
  353. package/dist/jsx/canvas/panBounds.native.js +83 -0
  354. package/dist/jsx/canvas/panBounds.native.js.map +1 -0
  355. package/dist/jsx/index.js +1 -0
  356. package/dist/jsx/index.js.map +1 -1
  357. package/dist/jsx/index.mjs +1 -0
  358. package/dist/jsx/index.mjs.map +1 -1
  359. package/dist/jsx/index.native.js +1 -0
  360. package/dist/jsx/index.native.js.map +1 -1
  361. package/dist/jsx/views/Calendar.mjs +283 -42
  362. package/dist/jsx/views/Calendar.mjs.map +1 -1
  363. package/dist/jsx/views/Calendar.native.js +291 -40
  364. package/dist/jsx/views/Calendar.native.js.map +1 -1
  365. package/dist/jsx/views/calendarMath.mjs +14 -1
  366. package/dist/jsx/views/calendarMath.mjs.map +1 -1
  367. package/dist/jsx/views/calendarMath.native.js +14 -0
  368. package/dist/jsx/views/calendarMath.native.js.map +1 -1
  369. package/package.json +7 -7
  370. package/src/Avatar/Avatar.spec.tsx +7 -18
  371. package/src/Avatar/index.tsx +6 -34
  372. package/src/Lightbox/index.native.tsx +16 -5
  373. package/src/Lightbox/shared.spec.ts +39 -0
  374. package/src/Lightbox/shared.ts +23 -0
  375. package/src/Tabs/Tabs.gutter.spec.tsx +61 -1
  376. package/src/Tabs/Tabs.measurement.spec.tsx +4 -1
  377. package/src/Tabs/Tabs.stories.tsx +39 -0
  378. package/src/Tabs/index.tsx +18 -3
  379. package/src/canvas/index.ts +1 -0
  380. package/src/canvas/panBounds.spec.ts +95 -0
  381. package/src/canvas/panBounds.ts +84 -0
  382. package/src/index.ts +1 -0
  383. package/src/surfaces.spec.tsx +2 -2
  384. package/src/views/Calendar.eventFill.spec.tsx +118 -0
  385. package/src/views/Calendar.nativeResize.spec.tsx +233 -0
  386. package/src/views/Calendar.stories.tsx +3 -0
  387. package/src/views/Calendar.tsx +295 -33
  388. package/src/views/calendarMath.ts +21 -0
  389. package/src/views/dataIdentity.spec.tsx +4 -3
  390. package/types/Avatar/index.d.ts +2 -11
  391. package/types/Avatar/index.d.ts.map +1 -1
  392. package/types/Lightbox/index.native.d.ts.map +1 -1
  393. package/types/Lightbox/shared.d.ts +12 -0
  394. package/types/Lightbox/shared.d.ts.map +1 -1
  395. package/types/Tabs/index.d.ts.map +1 -1
  396. package/types/canvas/index.d.ts +2 -0
  397. package/types/canvas/index.d.ts.map +1 -0
  398. package/types/canvas/panBounds.d.ts +23 -0
  399. package/types/canvas/panBounds.d.ts.map +1 -0
  400. package/types/index.d.ts +1 -0
  401. package/types/index.d.ts.map +1 -1
  402. package/types/views/Calendar.d.ts +7 -2
  403. package/types/views/Calendar.d.ts.map +1 -1
  404. package/types/views/calendarMath.d.ts +13 -0
  405. package/types/views/calendarMath.d.ts.map +1 -1
@@ -1,11 +1,4 @@
1
- import {
2
- Children,
3
- createContext,
4
- isValidElement,
5
- useContext,
6
- type ReactElement,
7
- type ReactNode,
8
- } from "react";
1
+ import { Children, createContext, isValidElement, useContext, type ReactNode } from "react";
9
2
  import { UserIcon } from "@phosphor-icons/react";
10
3
  import {
11
4
  MIN_PRESS_TARGET,
@@ -191,30 +184,11 @@ export function initialsMetrics(px: number): InitialsMetrics {
191
184
  };
192
185
  }
193
186
 
194
- /**
195
- * LC-276: the widest capital's advance in em. Two of them at the initials em
196
- * set the box a covered initials face must keep clear of the face on top.
197
- */
198
- export const initialsCapAdvance = 0.84;
199
-
200
- const PHOTO_STACK_OVERLAP = 0.32;
201
-
202
- export type AvatarGroupCovered = "photo" | "initials";
203
-
204
- /**
205
- * LC-276: how far each face slides under the next. A covered photo keeps the
206
- * Primer 32% stack; a covered initials face gives way until both letters clear.
207
- */
208
- export function avatarGroupOverlapPx(px: number, covered: AvatarGroupCovered): number {
209
- const photo = Math.round(px * PHOTO_STACK_OVERLAP);
210
- if (covered === "photo") return photo;
211
- const clear = Math.floor(px / 2 - initialsCapAdvance * initialsMetrics(px).fontPx);
212
- return Math.max(0, Math.min(photo, clear));
213
- }
187
+ const STACK_OVERLAP = 0.32;
214
188
 
215
- function showsInitials(child: ReactElement): boolean {
216
- const props = child.props as { src?: string; children?: ReactNode };
217
- return !props.src && props.children == null;
189
+ /** LC-276: each face slides under the next by the Primer 32% of its diameter. */
190
+ export function avatarGroupOverlapPx(px: number): number {
191
+ return Math.round(px * STACK_OVERLAP);
218
192
  }
219
193
 
220
194
  // The RN/Tamagui `onPress` type is `((event: GestureResponderEvent) => void)
@@ -417,9 +391,7 @@ function AvatarGroup({
417
391
  const items = Children.toArray(children).filter(isValidElement);
418
392
  const shown = items.slice(0, Math.max(1, max));
419
393
  const extra = items.length - shown.length;
420
- const covered = extra > 0 ? shown : shown.slice(0, -1);
421
- const coveredFace = covered.some(showsInitials) ? "initials" : "photo";
422
- const overlapPx = overlap ? avatarGroupOverlapPx(visualPx, coveredFace) : 0;
394
+ const overlapPx = overlap ? avatarGroupOverlapPx(visualPx) : 0;
423
395
  const total = shown.length + (extra > 0 ? 1 : 0);
424
396
  const overflowLabel = extra > 9 ? "9+" : `+${extra}`;
425
397
 
@@ -33,6 +33,7 @@ import {
33
33
  isOpenIndex,
34
34
  maxZoom,
35
35
  positionLabel,
36
+ panShift,
36
37
  zoomRect,
37
38
  } from "./shared";
38
39
 
@@ -189,9 +190,17 @@ function LightboxPage({ item, width, height, animate, onZoomChange, onSingleTap
189
190
  const next = Math.min(maxZoom, Math.max(1, (state.scale * distance) / state.distance));
190
191
  state.current = next;
191
192
  scale.setValue(next);
193
+ shift.setValue(panShift(next, { x: state.x, y: state.y }, width, height));
192
194
  return;
193
195
  }
194
- shift.setValue({ x: state.x + gesture.dx, y: state.y + gesture.dy });
196
+ shift.setValue(
197
+ panShift(
198
+ state.current,
199
+ { x: state.x + gesture.dx, y: state.y + gesture.dy },
200
+ width,
201
+ height,
202
+ ),
203
+ );
195
204
  },
196
205
  onPanResponderRelease: (_event, gesture) => {
197
206
  const state = pinch.current;
@@ -200,10 +209,12 @@ function LightboxPage({ item, width, height, animate, onZoomChange, onSingleTap
200
209
  settleAndroid(1, 0, 0);
201
210
  return;
202
211
  }
203
- const limitX = (width * (state.current - 1)) / 2;
204
- const limitY = (height * (state.current - 1)) / 2;
205
- const x = Math.min(limitX, Math.max(-limitX, state.x + gesture.dx));
206
- const y = Math.min(limitY, Math.max(-limitY, state.y + gesture.dy));
212
+ const { x, y } = panShift(
213
+ state.current,
214
+ { x: state.x + gesture.dx, y: state.y + gesture.dy },
215
+ width,
216
+ height,
217
+ );
207
218
  settleAndroid(state.current, x, y);
208
219
  },
209
220
  onPanResponderTerminationRequest: () => !zoomedRef.current,
@@ -2,6 +2,9 @@ import { describe, expect, it } from "vitest";
2
2
  import {
3
3
  classifyDrag,
4
4
  dismissDistance,
5
+ doubleTapZoom,
6
+ maxZoom,
7
+ panShift,
5
8
  dragGroundOpacity,
6
9
  isOpenIndex,
7
10
  positionLabel,
@@ -76,3 +79,39 @@ describe("Lightbox double-tap zoom", () => {
76
79
  expect(zoomRect(400, 800, 400, 800, 2)).toEqual({ x: 200, y: 400, width: 200, height: 400 });
77
80
  });
78
81
  });
82
+
83
+ describe("Lightbox pan stays on the photo (LC-283)", () => {
84
+ const width = 390;
85
+ const height = 844;
86
+
87
+ it("stops a drag past the edge at the photo's edge while zoomed", () => {
88
+ const limitX = (width * (doubleTapZoom - 1)) / 2;
89
+ const limitY = (height * (doubleTapZoom - 1)) / 2;
90
+ expect(panShift(doubleTapZoom, { x: 5000, y: -5000 }, width, height)).toEqual({
91
+ x: limitX,
92
+ y: -limitY,
93
+ });
94
+ });
95
+
96
+ it("never shows ground beside the photo at any zoom", () => {
97
+ for (const scale of [1, 1.5, doubleTapZoom, maxZoom]) {
98
+ for (const shift of [
99
+ { x: 900, y: 0 },
100
+ { x: -900, y: 1200 },
101
+ { x: 30, y: -40 },
102
+ ]) {
103
+ const next = panShift(scale, shift, width, height);
104
+ const left = width / 2 - (width * scale) / 2 + next.x;
105
+ const top = height / 2 - (height * scale) / 2 + next.y;
106
+ expect(left).toBeLessThanOrEqual(1e-6);
107
+ expect(left + width * scale).toBeGreaterThanOrEqual(width - 1e-6);
108
+ expect(top).toBeLessThanOrEqual(1e-6);
109
+ expect(top + height * scale).toBeGreaterThanOrEqual(height - 1e-6);
110
+ }
111
+ }
112
+ });
113
+
114
+ it("returns to centre at 1x", () => {
115
+ expect(panShift(1, { x: 80, y: -60 }, width, height)).toEqual({ x: 0, y: 0 });
116
+ });
117
+ });
@@ -1,3 +1,4 @@
1
+ import { clampView } from "../canvas/panBounds";
1
2
  import type { ImageProps } from "../images/Image/types";
2
3
 
3
4
  export interface LightboxItem {
@@ -89,6 +90,28 @@ export function zoomRect(
89
90
  return { x, y, width: w, height: h };
90
91
  }
91
92
 
93
+ /**
94
+ * Clamps a zoomed page's shift so the photo never slides off the screen at any
95
+ * scale (LC-283). The page scales about its centre, so the shift is measured
96
+ * from there.
97
+ */
98
+ export function panShift(
99
+ scale: number,
100
+ shift: { x: number; y: number },
101
+ width: number,
102
+ height: number,
103
+ ): { x: number; y: number } {
104
+ const page = { width, height };
105
+ const origin = (size: number) => (size - size * scale) / 2;
106
+ const view = clampView(
107
+ { scale, x: origin(width) + shift.x, y: origin(height) + shift.y },
108
+ page,
109
+ page,
110
+ { maxScale: maxZoom },
111
+ );
112
+ return { x: view.x - origin(width) || 0, y: view.y - origin(height) || 0 };
113
+ }
114
+
92
115
  /** "2 of 5", or empty for a single item. */
93
116
  export function positionLabel(
94
117
  index: number,
@@ -8,7 +8,7 @@
8
8
  */
9
9
  import { cleanup, screen } from "@testing-library/react";
10
10
  import { renderWithProviders } from "@multiplatform.one/test-utils";
11
- import { PageGutter } from "@multiplatform.one/theme";
11
+ import { PageGutter, panelPaddingPx, useResolvedKnobs } from "@multiplatform.one/theme";
12
12
  import type { ReactNode } from "react";
13
13
  import { afterEach, describe, expect, it } from "vitest";
14
14
  import { Screen } from "../layouts/page";
@@ -93,3 +93,63 @@ describe.each(["underline", "contained", "band"] as const)("%s Tabs panel inset"
93
93
  expect(atoms(panel, "_pr-").map(value)).toEqual([gutter]);
94
94
  });
95
95
  });
96
+
97
+ /**
98
+ * LC-287 STRIP-ON-PAGE-LINE: an edge-to-edge strip insets its row so the first
99
+ * label (underline) or the track and band columns (contained, band) start on
100
+ * the gutter its panel pads by; the strip itself still spans the edges.
101
+ */
102
+ function TabPadProbe() {
103
+ const { knobProps } = useResolvedKnobs({ component: "Tabs" });
104
+ return <span data-testid="tab-pad" data-px={knobProps.tab.paddingHorizontal} />;
105
+ }
106
+
107
+ function stripInset(container: HTMLElement): number {
108
+ return Number(
109
+ container.querySelector("[data-tabs-strip-inset]")?.getAttribute("data-tabs-strip-inset"),
110
+ );
111
+ }
112
+
113
+ describe("LC-287 an edge-to-edge strip starts on the page line", () => {
114
+ it.each([
115
+ ["standalone", (tabs: ReactNode) => tabs],
116
+ ["noPadding Screen", (tabs: ReactNode) => <Screen noPadding>{tabs}</Screen>],
117
+ ])("underline (%s): first label sits on the panel gutter", (_name, wrap) => {
118
+ const { container } = renderWithProviders(
119
+ <>
120
+ <TabPadProbe />
121
+ {wrap(<Tabs items={items} variant="underline" />)}
122
+ </>,
123
+ );
124
+ const padX = Number(screen.getByTestId("tab-pad").getAttribute("data-px"));
125
+ expect(padX).toBeGreaterThan(0);
126
+ expect(stripInset(container) + padX).toBe(panelPaddingPx());
127
+ });
128
+
129
+ it.each(["contained", "band"] as const)("%s: the track starts on the panel gutter", (variant) => {
130
+ const { container } = renderWithProviders(<Tabs items={items} variant={variant} />);
131
+ expect(stripInset(container)).toBe(panelPaddingPx());
132
+ });
133
+
134
+ it.each(["underline", "contained", "band"] as const)(
135
+ "%s under a page gutter adds no strip inset",
136
+ (variant) => {
137
+ const { container } = renderWithProviders(
138
+ <PageGutter inset="$4">
139
+ <Tabs items={items} variant={variant} />
140
+ </PageGutter>,
141
+ );
142
+ expect(stripInset(container)).toBe(0);
143
+ },
144
+ );
145
+
146
+ it("pads the scroll content, so the hairline and scrolled labels still reach both edges", () => {
147
+ const { container } = renderWithProviders(<Tabs items={items} variant="underline" />);
148
+ const inset = stripInset(container);
149
+ const scroller = container.querySelector('[data-tabs-scroll="true"]') as HTMLElement;
150
+ const content = scroller.firstElementChild as HTMLElement;
151
+ expect(getComputedStyle(content).paddingLeft).toBe(`${inset}px`);
152
+ expect(getComputedStyle(content).paddingRight).toBe(`${inset}px`);
153
+ expect(getComputedStyle(scroller).paddingLeft || "0px").toMatch(/^0(px)?$/);
154
+ });
155
+ });
@@ -160,7 +160,10 @@ it("rechecks changed content width without fighting subsequent manual scroll", (
160
160
  tree.content(620);
161
161
  expect(tree.scroll).not.toHaveBeenCalled();
162
162
  tree.content(650);
163
- expect(tree.scroll).toHaveBeenCalledExactlyOnceWith({ x: 242, animated: true });
163
+ const inset = Number(
164
+ document.querySelector("[data-tabs-strip-inset]")?.getAttribute("data-tabs-strip-inset"),
165
+ );
166
+ expect(tree.scroll).toHaveBeenCalledExactlyOnceWith({ x: 242 + inset, animated: true });
164
167
  });
165
168
 
166
169
  it("waits for the latest selected tab's layout when dimensions were pending", () => {
@@ -494,3 +494,42 @@ export const InPageGutter: Story = {
494
494
  </Screen>
495
495
  ),
496
496
  };
497
+
498
+ const consoleTabs: TabsItem[] = [
499
+ "Overview",
500
+ "Apps",
501
+ "Services",
502
+ "Volumes",
503
+ "Networks",
504
+ "Secrets",
505
+ "Logs",
506
+ "Events",
507
+ "Backups",
508
+ "Domains",
509
+ "Settings",
510
+ ].map((label) => ({
511
+ value: label.toLowerCase(),
512
+ label,
513
+ content: <Panel title={label} body="The panel pads by the page gutter." />,
514
+ }));
515
+
516
+ export const EdgeToEdgeStrip: Story = {
517
+ parameters: {
518
+ layout: "fullscreen",
519
+ docs: {
520
+ description: {
521
+ story:
522
+ "LC-287 STRIP-ON-PAGE-LINE (FZ-7972): in an edge-to-edge surface the strip and its hairline run to both edges, while the first label starts on the gutter the header and panel use, and the last label ends on it once scrolled to the end.",
523
+ },
524
+ },
525
+ },
526
+ args: { variant: "underline" },
527
+ render: (args) => (
528
+ <Screen noPadding scroll={false}>
529
+ <YStack paddingHorizontal="$4">
530
+ <PageHeader title="mpo-stack" subtitle="11 sections" />
531
+ </YStack>
532
+ <Tabs {...args} items={consoleTabs} />
533
+ </Screen>
534
+ ),
535
+ };
@@ -28,6 +28,7 @@ import { IconSlot } from "@multiplatform.one/theme";
28
28
  import {
29
29
  MIN_PRESS_TARGET,
30
30
  PageGutter,
31
+ panelPaddingPx,
31
32
  usePageGutter,
32
33
  ensureKeyboardModalityTracking,
33
34
  getGroupPosition,
@@ -449,6 +450,12 @@ function TabsRoot({
449
450
  component: "Tabs",
450
451
  size,
451
452
  });
453
+ const stripInsetPx = pageInset
454
+ ? 0
455
+ : Math.max(
456
+ 0,
457
+ panelPaddingPx() - (variant === "underline" ? knobProps.tab.paddingHorizontal : 0),
458
+ );
452
459
 
453
460
  if (isWeb) ensureKeyboardModalityTracking();
454
461
  // Tab value currently showing the manual keyboard focus ring (see tracker note)
@@ -578,11 +585,17 @@ function TabsRoot({
578
585
  React.useEffect(() => {
579
586
  if (!activeLayout || activeLayout.value !== currentValue) return;
580
587
  const { offset, viewport, content } = scrollMetrics.current;
581
- const target = tabsScrollIntoViewX(activeLayout, offset, viewport, content, direction);
588
+ const target = tabsScrollIntoViewX(
589
+ { ...activeLayout, x: activeLayout.x + stripInsetPx },
590
+ offset,
591
+ viewport,
592
+ content,
593
+ direction,
594
+ );
582
595
  if (target !== undefined && Math.abs(target - offset) >= 1) {
583
596
  scrollRef.current?.scrollTo({ x: target, animated: true });
584
597
  }
585
- }, [activeLayout, currentValue, direction, sizeRevision]);
598
+ }, [activeLayout, currentValue, direction, sizeRevision, stripInsetPx]);
586
599
 
587
600
  const isUnderline = variant === "underline";
588
601
  const isBand = variant === "band";
@@ -943,11 +956,12 @@ function TabsRoot({
943
956
  {...(isUnderline || isFrame
944
957
  ? { ...hairline.bottom, borderColor: componentColors.surface.border }
945
958
  : undefined)}
959
+ data-tabs-strip-inset={stripInsetPx}
946
960
  data-fade-left={fades.left ? "true" : undefined}
947
961
  data-fade-right={fades.right ? "true" : undefined}
948
962
  >
949
963
  {equalDistribution ? (
950
- <View alignSelf="stretch" minWidth={0}>
964
+ <View alignSelf="stretch" minWidth={0} paddingHorizontal={stripInsetPx}>
951
965
  {tabList}
952
966
  </View>
953
967
  ) : (
@@ -961,6 +975,7 @@ function TabsRoot({
961
975
  // the painted tab is smaller than the floor (LC-54 / nested scale).
962
976
  contentContainerStyle={{
963
977
  paddingVertical: slop,
978
+ paddingHorizontal: stripInsetPx,
964
979
  ...(isFrame ? { flexGrow: 1 } : undefined),
965
980
  }}
966
981
  marginVertical={-slop}
@@ -0,0 +1 @@
1
+ export * from "./panBounds";
@@ -0,0 +1,95 @@
1
+ import { describe, expect, it } from "vitest";
2
+ import { clampView, fitScale, zoomAt, type CanvasExtent, type CanvasView } from "./panBounds";
3
+
4
+ const viewport: CanvasExtent = { width: 400, height: 300 };
5
+
6
+ function coversOrCentres(view: CanvasView, content: CanvasExtent, port: CanvasExtent) {
7
+ const width = content.width * view.scale;
8
+ const height = content.height * view.scale;
9
+ const eps = 1e-6;
10
+ if (width > port.width) {
11
+ expect(view.x).toBeLessThanOrEqual(eps);
12
+ expect(view.x + width).toBeGreaterThanOrEqual(port.width - eps);
13
+ } else {
14
+ expect(view.x).toBeCloseTo((port.width - width) / 2, 6);
15
+ }
16
+ if (height > port.height) {
17
+ expect(view.y).toBeLessThanOrEqual(eps);
18
+ expect(view.y + height).toBeGreaterThanOrEqual(port.height - eps);
19
+ } else {
20
+ expect(view.y).toBeCloseTo((port.height - height) / 2, 6);
21
+ }
22
+ }
23
+
24
+ function seeded(seed: number) {
25
+ let state = seed;
26
+ return () => {
27
+ state = (state * 1664525 + 1013904223) % 4294967296;
28
+ return state / 4294967296;
29
+ };
30
+ }
31
+
32
+ describe("LC-283 pan bounds: a zoomable canvas pans only over its content", () => {
33
+ it("fits the whole content at the least scale, never above 1:1, with a floor", () => {
34
+ expect(fitScale({ width: 800, height: 300 }, viewport)).toBe(0.5);
35
+ expect(fitScale({ width: 200, height: 100 }, viewport)).toBe(1);
36
+ expect(fitScale({ width: 40000, height: 300 }, viewport)).toBe(0.1);
37
+ });
38
+
39
+ it("stops a pan at the content's edge instead of showing empty space", () => {
40
+ const content = { width: 1000, height: 800 };
41
+ expect(clampView({ scale: 1, x: 250, y: -2000 }, content, viewport)).toEqual({
42
+ scale: 1,
43
+ x: 0,
44
+ y: -500,
45
+ });
46
+ });
47
+
48
+ it("centres an axis where the content is smaller than the viewport", () => {
49
+ const content = { width: 200, height: 1000 };
50
+ const view = clampView({ scale: 1, x: -90, y: 0 }, content, viewport);
51
+ expect(view.x).toBe(100);
52
+ });
53
+
54
+ it("caps zoom-in at 1:1 unless the canvas is a magnifier", () => {
55
+ const content = { width: 1000, height: 800 };
56
+ expect(clampView({ scale: 3, x: 0, y: 0 }, content, viewport).scale).toBe(1);
57
+ expect(clampView({ scale: 3, x: 0, y: 0 }, content, viewport, { maxScale: 4 }).scale).toBe(3);
58
+ });
59
+
60
+ it("keeps the point under the focal spot while zooming, inside the bounds", () => {
61
+ const content = { width: 1000, height: 800 };
62
+ const start = { scale: 0.5, x: -100, y: -50 };
63
+ const next = zoomAt(start, 1, { x: 200, y: 150 }, content, viewport);
64
+ expect(next.scale).toBe(1);
65
+ expect(next.x).toBe(200 - (200 - -100) * 2);
66
+ coversOrCentres(next, content, viewport);
67
+ });
68
+
69
+ it("never lets any pan or zoom leave the content (1,000 random views)", () => {
70
+ const random = seeded(283);
71
+ for (let i = 0; i < 1000; i++) {
72
+ const content = { width: 50 + random() * 3000, height: 50 + random() * 3000 };
73
+ const port = { width: 100 + random() * 1200, height: 100 + random() * 900 };
74
+ const maxScale = random() < 0.5 ? 1 : 4;
75
+ const wild = {
76
+ scale: random() * 6,
77
+ x: (random() - 0.5) * 8000,
78
+ y: (random() - 0.5) * 8000,
79
+ };
80
+ const view = clampView(wild, content, port, { maxScale });
81
+ expect(view.scale).toBeGreaterThanOrEqual(fitScale(content, port) - 1e-9);
82
+ expect(view.scale).toBeLessThanOrEqual(maxScale);
83
+ coversOrCentres(view, content, port);
84
+ const zoomed = zoomAt(
85
+ view,
86
+ random() * 6,
87
+ { x: random() * port.width, y: random() * port.height },
88
+ content,
89
+ port,
90
+ { maxScale },
91
+ );
92
+ coversOrCentres(zoomed, content, port);
93
+ }
94
+ });
95
+ });
@@ -0,0 +1,84 @@
1
+ export interface CanvasExtent {
2
+ width: number;
3
+ height: number;
4
+ }
5
+
6
+ export interface CanvasView {
7
+ scale: number;
8
+ x: number;
9
+ y: number;
10
+ }
11
+
12
+ export interface CanvasBounds {
13
+ maxScale?: number;
14
+ floor?: number;
15
+ }
16
+
17
+ export const canvasZoomFloor = 0.1;
18
+
19
+ export function fitScale(
20
+ content: CanvasExtent,
21
+ viewport: CanvasExtent,
22
+ bounds: CanvasBounds = {},
23
+ ): number {
24
+ "worklet";
25
+ const { maxScale = 1, floor = canvasZoomFloor } = bounds;
26
+ if (content.width <= 0 || content.height <= 0 || viewport.width <= 0 || viewport.height <= 0)
27
+ return 1;
28
+ const fit = Math.min(viewport.width / content.width, viewport.height / content.height);
29
+ return Math.min(1, maxScale, Math.max(floor, fit));
30
+ }
31
+
32
+ export function clampOffset(offset: number, content: number, viewport: number): number {
33
+ "worklet";
34
+ if (content <= viewport) return (viewport - content) / 2;
35
+ return Math.min(0, Math.max(viewport - content, offset));
36
+ }
37
+
38
+ export function clampScale(
39
+ scale: number,
40
+ content: CanvasExtent,
41
+ viewport: CanvasExtent,
42
+ bounds: CanvasBounds = {},
43
+ ): number {
44
+ "worklet";
45
+ return Math.min(bounds.maxScale ?? 1, Math.max(fitScale(content, viewport, bounds), scale));
46
+ }
47
+
48
+ export function clampView(
49
+ view: CanvasView,
50
+ content: CanvasExtent,
51
+ viewport: CanvasExtent,
52
+ bounds: CanvasBounds = {},
53
+ ): CanvasView {
54
+ "worklet";
55
+ const scale = clampScale(view.scale, content, viewport, bounds);
56
+ return {
57
+ scale,
58
+ x: clampOffset(view.x, content.width * scale, viewport.width),
59
+ y: clampOffset(view.y, content.height * scale, viewport.height),
60
+ };
61
+ }
62
+
63
+ export function zoomAt(
64
+ view: CanvasView,
65
+ scale: number,
66
+ focal: { x: number; y: number },
67
+ content: CanvasExtent,
68
+ viewport: CanvasExtent,
69
+ bounds: CanvasBounds = {},
70
+ ): CanvasView {
71
+ "worklet";
72
+ const next = clampScale(scale, content, viewport, bounds);
73
+ const ratio = next / view.scale;
74
+ return clampView(
75
+ {
76
+ scale: next,
77
+ x: focal.x - (focal.x - view.x) * ratio,
78
+ y: focal.y - (focal.y - view.y) * ratio,
79
+ },
80
+ content,
81
+ viewport,
82
+ bounds,
83
+ );
84
+ }
package/src/index.ts CHANGED
@@ -19,6 +19,7 @@ export type {
19
19
  } from "./SortableList";
20
20
  export * from "./Badge";
21
21
  export * from "./Carousel";
22
+ export * from "./canvas";
22
23
  export * from "./Chip";
23
24
  export * from "./SwipeDismissRow";
24
25
  export * from "./DropDownPanel";
@@ -244,11 +244,11 @@ describe("overlay containers take the Axiom 1 child-clip cap (MPO-150)", () => {
244
244
  expect(capped, "the cap must spread AFTER the uncapped scale token").toBeGreaterThan(elevated);
245
245
  });
246
246
 
247
- const sheetStop = { medium: 20, large: 44, full: 44 } as const;
247
+ const sheetStop = { medium: 16, large: 20, full: 44 } as const;
248
248
  for (const [borderRadius, stop] of Object.entries({ medium: 14, large: 20, full: 44 })) {
249
249
  {
250
250
  const capped = Math.min(stop, 16);
251
- const sheetCapped = Math.min(sheetStop[borderRadius as keyof typeof sheetStop], 16);
251
+ const sheetCapped = sheetStop[borderRadius as keyof typeof sheetStop];
252
252
  it(`caps every overlay frame at ${capped}px for borderRadius=${borderRadius} on the panelPadding role`, () => {
253
253
  render(
254
254
  <TamaguiProvider config={overlayCapConfig} defaultTheme="light">