@getcortexlabs/mavis 0.1.0-alpha.3 → 0.1.0-alpha.5

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 (451) hide show
  1. package/README.md +9 -5
  2. package/dist/files.d.ts +4 -0
  3. package/dist/files.d.ts.map +1 -0
  4. package/dist/files.js +3 -0
  5. package/dist/files.js.map +1 -0
  6. package/dist/native/avatar-image.d.ts +4 -0
  7. package/dist/native/avatar-image.d.ts.map +1 -0
  8. package/dist/native/avatar-image.js +12 -0
  9. package/dist/native/avatar-image.js.map +1 -0
  10. package/dist/native/avatar-label.android.d.ts +9 -0
  11. package/dist/native/avatar-label.android.d.ts.map +1 -0
  12. package/dist/native/avatar-label.android.js +9 -0
  13. package/dist/native/avatar-label.android.js.map +1 -0
  14. package/dist/native/avatar-label.d.ts +2 -0
  15. package/dist/native/avatar-label.d.ts.map +1 -0
  16. package/dist/native/avatar-label.js +2 -0
  17. package/dist/native/avatar-label.js.map +1 -0
  18. package/dist/native/box.ios.d.ts.map +1 -1
  19. package/dist/native/box.ios.js +16 -1
  20. package/dist/native/box.ios.js.map +1 -1
  21. package/dist/native/button.ios.d.ts +9 -1
  22. package/dist/native/button.ios.d.ts.map +1 -1
  23. package/dist/native/button.ios.js +17 -1
  24. package/dist/native/button.ios.js.map +1 -1
  25. package/dist/native/checkbox.android.d.ts +7 -0
  26. package/dist/native/checkbox.android.d.ts.map +1 -0
  27. package/dist/native/checkbox.android.js +26 -0
  28. package/dist/native/checkbox.android.js.map +1 -0
  29. package/dist/native/checkbox.d.ts +7 -0
  30. package/dist/native/checkbox.d.ts.map +1 -0
  31. package/dist/native/checkbox.js +7 -0
  32. package/dist/native/checkbox.js.map +1 -0
  33. package/dist/native/combobox-editor.android.d.ts +3 -0
  34. package/dist/native/combobox-editor.android.d.ts.map +1 -0
  35. package/dist/native/combobox-editor.android.js +5 -0
  36. package/dist/native/combobox-editor.android.js.map +1 -0
  37. package/dist/native/combobox-editor.d.ts +4 -0
  38. package/dist/native/combobox-editor.d.ts.map +1 -0
  39. package/dist/native/combobox-editor.js +5 -0
  40. package/dist/native/combobox-editor.js.map +1 -0
  41. package/dist/native/composed-button.android.d.ts +4 -0
  42. package/dist/native/composed-button.android.d.ts.map +1 -0
  43. package/dist/native/composed-button.android.js +53 -0
  44. package/dist/native/composed-button.android.js.map +1 -0
  45. package/dist/native/composed-button.d.ts +3 -0
  46. package/dist/native/composed-button.d.ts.map +1 -0
  47. package/dist/native/composed-button.js +4 -0
  48. package/dist/native/composed-button.js.map +1 -0
  49. package/dist/native/dialog.android.d.ts +12 -0
  50. package/dist/native/dialog.android.d.ts.map +1 -0
  51. package/dist/native/dialog.android.js +46 -0
  52. package/dist/native/dialog.android.js.map +1 -0
  53. package/dist/native/dialog.d.ts +12 -0
  54. package/dist/native/dialog.d.ts.map +1 -0
  55. package/dist/native/dialog.ios.d.ts +12 -0
  56. package/dist/native/dialog.ios.d.ts.map +1 -0
  57. package/dist/native/dialog.ios.js +13 -0
  58. package/dist/native/dialog.ios.js.map +1 -0
  59. package/dist/native/dialog.js +4 -0
  60. package/dist/native/dialog.js.map +1 -0
  61. package/dist/native/dynamic-type.d.ts +15 -0
  62. package/dist/native/dynamic-type.d.ts.map +1 -0
  63. package/dist/native/dynamic-type.js +47 -0
  64. package/dist/native/dynamic-type.js.map +1 -0
  65. package/dist/native/file-access.d.ts +23 -0
  66. package/dist/native/file-access.d.ts.map +1 -0
  67. package/dist/native/file-access.js +55 -0
  68. package/dist/native/file-access.js.map +1 -0
  69. package/dist/native/file-picker.android.d.ts +3 -0
  70. package/dist/native/file-picker.android.d.ts.map +1 -0
  71. package/dist/native/file-picker.android.js +147 -0
  72. package/dist/native/file-picker.android.js.map +1 -0
  73. package/dist/native/file-picker.d.ts +4 -0
  74. package/dist/native/file-picker.d.ts.map +1 -0
  75. package/dist/native/file-picker.ios.d.ts +3 -0
  76. package/dist/native/file-picker.ios.d.ts.map +1 -0
  77. package/dist/native/file-picker.ios.js +152 -0
  78. package/dist/native/file-picker.ios.js.map +1 -0
  79. package/dist/native/file-picker.js +7 -0
  80. package/dist/native/file-picker.js.map +1 -0
  81. package/dist/native/flex-layout.ios.d.ts +5 -0
  82. package/dist/native/flex-layout.ios.d.ts.map +1 -1
  83. package/dist/native/flex-layout.ios.js +63 -2
  84. package/dist/native/flex-layout.ios.js.map +1 -1
  85. package/dist/native/input-action.d.ts +5 -0
  86. package/dist/native/input-action.d.ts.map +1 -0
  87. package/dist/native/input-action.js +13 -0
  88. package/dist/native/input-action.js.map +1 -0
  89. package/dist/native/keyboard-dismiss.ios.d.ts.map +1 -1
  90. package/dist/native/keyboard-dismiss.ios.js +3 -0
  91. package/dist/native/keyboard-dismiss.ios.js.map +1 -1
  92. package/dist/native/label.android.d.ts +12 -0
  93. package/dist/native/label.android.d.ts.map +1 -0
  94. package/dist/native/label.android.js +19 -0
  95. package/dist/native/label.android.js.map +1 -0
  96. package/dist/native/label.ios.d.ts +10 -1
  97. package/dist/native/label.ios.d.ts.map +1 -1
  98. package/dist/native/label.ios.js +25 -1
  99. package/dist/native/label.ios.js.map +1 -1
  100. package/dist/native/motion-owner.d.ts +5 -0
  101. package/dist/native/motion-owner.d.ts.map +1 -0
  102. package/dist/native/motion-owner.js +53 -0
  103. package/dist/native/motion-owner.js.map +1 -0
  104. package/dist/native/motion-region.d.ts +6 -0
  105. package/dist/native/motion-region.d.ts.map +1 -0
  106. package/dist/native/motion-region.js +199 -0
  107. package/dist/native/motion-region.js.map +1 -0
  108. package/dist/native/motion-surface.d.ts +9 -0
  109. package/dist/native/motion-surface.d.ts.map +1 -0
  110. package/dist/native/motion-surface.js +137 -0
  111. package/dist/native/motion-surface.js.map +1 -0
  112. package/dist/native/press.d.ts +5 -2
  113. package/dist/native/press.d.ts.map +1 -1
  114. package/dist/native/press.js +52 -8
  115. package/dist/native/press.js.map +1 -1
  116. package/dist/native/progress.d.ts +7 -0
  117. package/dist/native/progress.d.ts.map +1 -0
  118. package/dist/native/progress.js +77 -0
  119. package/dist/native/progress.js.map +1 -0
  120. package/dist/native/scroll-motion.d.ts +12 -0
  121. package/dist/native/scroll-motion.d.ts.map +1 -0
  122. package/dist/native/scroll-motion.js +100 -0
  123. package/dist/native/scroll-motion.js.map +1 -0
  124. package/dist/native/segmented.d.ts +14 -0
  125. package/dist/native/segmented.d.ts.map +1 -0
  126. package/dist/native/segmented.js +86 -0
  127. package/dist/native/segmented.js.map +1 -0
  128. package/dist/native/sheet.android.d.ts +5 -1
  129. package/dist/native/sheet.android.d.ts.map +1 -1
  130. package/dist/native/sheet.android.js +2 -2
  131. package/dist/native/sheet.android.js.map +1 -1
  132. package/dist/native/sheet.d.ts +5 -1
  133. package/dist/native/sheet.d.ts.map +1 -1
  134. package/dist/native/sheet.ios.d.ts +5 -1
  135. package/dist/native/sheet.ios.d.ts.map +1 -1
  136. package/dist/native/sheet.ios.js +12 -3
  137. package/dist/native/sheet.ios.js.map +1 -1
  138. package/dist/native/sheet.js +2 -2
  139. package/dist/native/sheet.js.map +1 -1
  140. package/dist/native/tabs.android.d.ts +3 -0
  141. package/dist/native/tabs.android.d.ts.map +1 -0
  142. package/dist/native/tabs.android.js +29 -0
  143. package/dist/native/tabs.android.js.map +1 -0
  144. package/dist/native/tabs.d.ts +3 -0
  145. package/dist/native/tabs.d.ts.map +1 -0
  146. package/dist/native/tabs.js +4 -0
  147. package/dist/native/tabs.js.map +1 -0
  148. package/dist/native/text-field.android.d.ts +1 -0
  149. package/dist/native/text-field.android.d.ts.map +1 -1
  150. package/dist/native/text-field.android.js +13 -0
  151. package/dist/native/text-field.android.js.map +1 -1
  152. package/dist/native/text-field.ios.d.ts +9 -0
  153. package/dist/native/text-field.ios.d.ts.map +1 -0
  154. package/dist/native/text-field.ios.js +52 -0
  155. package/dist/native/text-field.ios.js.map +1 -0
  156. package/dist/native/text-view.ios.d.ts +7 -0
  157. package/dist/native/text-view.ios.d.ts.map +1 -0
  158. package/dist/native/text-view.ios.js +10 -0
  159. package/dist/native/text-view.ios.js.map +1 -0
  160. package/dist/native/toast.android.d.ts +4 -0
  161. package/dist/native/toast.android.d.ts.map +1 -0
  162. package/dist/native/toast.android.js +10 -0
  163. package/dist/native/toast.android.js.map +1 -0
  164. package/dist/native/toast.d.ts +4 -0
  165. package/dist/native/toast.d.ts.map +1 -0
  166. package/dist/native/toast.ios.d.ts +4 -0
  167. package/dist/native/toast.ios.d.ts.map +1 -0
  168. package/dist/native/toast.ios.js +8 -0
  169. package/dist/native/toast.ios.js.map +1 -0
  170. package/dist/native/toast.js +5 -0
  171. package/dist/native/toast.js.map +1 -0
  172. package/dist/vue/components/ChoiceControl.d.ts +111 -0
  173. package/dist/vue/components/ChoiceControl.d.ts.map +1 -0
  174. package/dist/vue/components/ChoiceControl.js +196 -0
  175. package/dist/vue/components/ChoiceControl.js.map +1 -0
  176. package/dist/vue/components/DateCalendar.d.ts +94 -0
  177. package/dist/vue/components/DateCalendar.d.ts.map +1 -0
  178. package/dist/vue/components/DateCalendar.js +96 -0
  179. package/dist/vue/components/DateCalendar.js.map +1 -0
  180. package/dist/vue/components/MAccordion.d.ts +119 -0
  181. package/dist/vue/components/MAccordion.d.ts.map +1 -0
  182. package/dist/vue/components/MAccordion.js +83 -0
  183. package/dist/vue/components/MAccordion.js.map +1 -0
  184. package/dist/vue/components/MAlert.d.ts +109 -0
  185. package/dist/vue/components/MAlert.d.ts.map +1 -0
  186. package/dist/vue/components/MAlert.js +126 -0
  187. package/dist/vue/components/MAlert.js.map +1 -0
  188. package/dist/vue/components/MAvatar.d.ts +80 -0
  189. package/dist/vue/components/MAvatar.d.ts.map +1 -0
  190. package/dist/vue/components/MAvatar.js +86 -0
  191. package/dist/vue/components/MAvatar.js.map +1 -0
  192. package/dist/vue/components/MBadge.d.ts +70 -0
  193. package/dist/vue/components/MBadge.d.ts.map +1 -0
  194. package/dist/vue/components/MBadge.js +30 -0
  195. package/dist/vue/components/MBadge.js.map +1 -0
  196. package/dist/vue/components/MButton.d.ts +126 -32
  197. package/dist/vue/components/MButton.d.ts.map +1 -1
  198. package/dist/vue/components/MButton.js +129 -11
  199. package/dist/vue/components/MButton.js.map +1 -1
  200. package/dist/vue/components/MCard.d.ts +70 -24
  201. package/dist/vue/components/MCard.d.ts.map +1 -1
  202. package/dist/vue/components/MCard.js +14 -4
  203. package/dist/vue/components/MCard.js.map +1 -1
  204. package/dist/vue/components/MCheckbox.d.ts +103 -0
  205. package/dist/vue/components/MCheckbox.d.ts.map +1 -0
  206. package/dist/vue/components/MCheckbox.js +26 -0
  207. package/dist/vue/components/MCheckbox.js.map +1 -0
  208. package/dist/vue/components/MChip.d.ts +117 -0
  209. package/dist/vue/components/MChip.d.ts.map +1 -0
  210. package/dist/vue/components/MChip.js +120 -0
  211. package/dist/vue/components/MChip.js.map +1 -0
  212. package/dist/vue/components/MCombobox.d.ts +279 -0
  213. package/dist/vue/components/MCombobox.d.ts.map +1 -0
  214. package/dist/vue/components/MCombobox.js +234 -0
  215. package/dist/vue/components/MCombobox.js.map +1 -0
  216. package/dist/vue/components/MDatePicker.d.ts +1254 -0
  217. package/dist/vue/components/MDatePicker.d.ts.map +1 -0
  218. package/dist/vue/components/MDatePicker.js +35 -0
  219. package/dist/vue/components/MDatePicker.js.map +1 -0
  220. package/dist/vue/components/MDialog.d.ts +97 -0
  221. package/dist/vue/components/MDialog.d.ts.map +1 -0
  222. package/dist/vue/components/MDialog.js +245 -0
  223. package/dist/vue/components/MDialog.js.map +1 -0
  224. package/dist/vue/components/MEmptyState.d.ts +117 -0
  225. package/dist/vue/components/MEmptyState.d.ts.map +1 -0
  226. package/dist/vue/components/MEmptyState.js +79 -0
  227. package/dist/vue/components/MEmptyState.js.map +1 -0
  228. package/dist/vue/components/MFilePicker.d.ts +112 -0
  229. package/dist/vue/components/MFilePicker.d.ts.map +1 -0
  230. package/dist/vue/components/MFilePicker.js +196 -0
  231. package/dist/vue/components/MFilePicker.js.map +1 -0
  232. package/dist/vue/components/MIcon.d.ts +5 -3
  233. package/dist/vue/components/MIcon.d.ts.map +1 -1
  234. package/dist/vue/components/MInput.d.ts +178 -51
  235. package/dist/vue/components/MInput.d.ts.map +1 -1
  236. package/dist/vue/components/MInput.js +88 -14
  237. package/dist/vue/components/MInput.js.map +1 -1
  238. package/dist/vue/components/MListItem.d.ts +104 -0
  239. package/dist/vue/components/MListItem.d.ts.map +1 -0
  240. package/dist/vue/components/MListItem.js +53 -0
  241. package/dist/vue/components/MListItem.js.map +1 -0
  242. package/dist/vue/components/MProgress.d.ts +122 -0
  243. package/dist/vue/components/MProgress.d.ts.map +1 -0
  244. package/dist/vue/components/MProgress.js +75 -0
  245. package/dist/vue/components/MProgress.js.map +1 -0
  246. package/dist/vue/components/MRadioGroup.d.ts +103 -0
  247. package/dist/vue/components/MRadioGroup.d.ts.map +1 -0
  248. package/dist/vue/components/MRadioGroup.js +57 -0
  249. package/dist/vue/components/MRadioGroup.js.map +1 -0
  250. package/dist/vue/components/MReveal.d.ts +75 -39
  251. package/dist/vue/components/MReveal.d.ts.map +1 -1
  252. package/dist/vue/components/MReveal.js +5 -7
  253. package/dist/vue/components/MReveal.js.map +1 -1
  254. package/dist/vue/components/MScreen.d.ts +21 -6
  255. package/dist/vue/components/MScreen.d.ts.map +1 -1
  256. package/dist/vue/components/MScreen.js +19 -4
  257. package/dist/vue/components/MScreen.js.map +1 -1
  258. package/dist/vue/components/MSegmentedControl.d.ts +95 -0
  259. package/dist/vue/components/MSegmentedControl.d.ts.map +1 -0
  260. package/dist/vue/components/MSegmentedControl.js +172 -0
  261. package/dist/vue/components/MSegmentedControl.js.map +1 -0
  262. package/dist/vue/components/MSelect.d.ts +140 -0
  263. package/dist/vue/components/MSelect.d.ts.map +1 -0
  264. package/dist/vue/components/MSelect.js +158 -0
  265. package/dist/vue/components/MSelect.js.map +1 -0
  266. package/dist/vue/components/MSeparator.d.ts +56 -0
  267. package/dist/vue/components/MSeparator.d.ts.map +1 -0
  268. package/dist/vue/components/MSeparator.js +36 -0
  269. package/dist/vue/components/MSeparator.js.map +1 -0
  270. package/dist/vue/components/MSheet.d.ts +26 -14
  271. package/dist/vue/components/MSheet.d.ts.map +1 -1
  272. package/dist/vue/components/MSheet.js +66 -34
  273. package/dist/vue/components/MSheet.js.map +1 -1
  274. package/dist/vue/components/MSkeleton.d.ts +78 -0
  275. package/dist/vue/components/MSkeleton.d.ts.map +1 -0
  276. package/dist/vue/components/MSkeleton.js +87 -0
  277. package/dist/vue/components/MSkeleton.js.map +1 -0
  278. package/dist/vue/components/MSlider.d.ts +8 -4
  279. package/dist/vue/components/MSlider.d.ts.map +1 -1
  280. package/dist/vue/components/MSlider.js +2 -1
  281. package/dist/vue/components/MSlider.js.map +1 -1
  282. package/dist/vue/components/MSwitch.d.ts +89 -0
  283. package/dist/vue/components/MSwitch.d.ts.map +1 -0
  284. package/dist/vue/components/MSwitch.js +163 -0
  285. package/dist/vue/components/MSwitch.js.map +1 -0
  286. package/dist/vue/components/MTabs.d.ts +101 -0
  287. package/dist/vue/components/MTabs.d.ts.map +1 -0
  288. package/dist/vue/components/MTabs.js +245 -0
  289. package/dist/vue/components/MTabs.js.map +1 -0
  290. package/dist/vue/components/MText.d.ts +51 -26
  291. package/dist/vue/components/MText.d.ts.map +1 -1
  292. package/dist/vue/components/MText.js +43 -17
  293. package/dist/vue/components/MText.js.map +1 -1
  294. package/dist/vue/components/MToast.d.ts +23 -0
  295. package/dist/vue/components/MToast.d.ts.map +1 -0
  296. package/dist/vue/components/MToast.js +242 -0
  297. package/dist/vue/components/MToast.js.map +1 -0
  298. package/dist/vue/components/layout.d.ts +206 -97
  299. package/dist/vue/components/layout.d.ts.map +1 -1
  300. package/dist/vue/components/layout.js +6 -4
  301. package/dist/vue/components/layout.js.map +1 -1
  302. package/dist/vue/components/workflows.d.ts +251 -0
  303. package/dist/vue/components/workflows.d.ts.map +1 -0
  304. package/dist/vue/components/workflows.js +35 -0
  305. package/dist/vue/components/workflows.js.map +1 -0
  306. package/dist/vue/index.d.ts +29 -3
  307. package/dist/vue/index.d.ts.map +1 -1
  308. package/dist/vue/index.js +56 -4
  309. package/dist/vue/index.js.map +1 -1
  310. package/dist/vue/layers.d.ts +2 -0
  311. package/dist/vue/layers.d.ts.map +1 -1
  312. package/dist/vue/layers.js.map +1 -1
  313. package/dist/vue/reveal-motion.d.ts +13 -0
  314. package/dist/vue/reveal-motion.d.ts.map +1 -0
  315. package/dist/vue/reveal-motion.js +55 -0
  316. package/dist/vue/reveal-motion.js.map +1 -0
  317. package/dist/vue/use-motion-region.d.ts +7 -0
  318. package/dist/vue/use-motion-region.d.ts.map +1 -0
  319. package/dist/vue/use-motion-region.js +28 -0
  320. package/dist/vue/use-motion-region.js.map +1 -0
  321. package/dist/vue/use-motion-surface.d.ts +8 -0
  322. package/dist/vue/use-motion-surface.d.ts.map +1 -0
  323. package/dist/vue/use-motion-surface.js +76 -0
  324. package/dist/vue/use-motion-surface.js.map +1 -0
  325. package/dist/vue/use-press.d.ts +1 -1
  326. package/dist/vue/use-press.d.ts.map +1 -1
  327. package/dist/vue/use-press.js +12 -4
  328. package/dist/vue/use-press.js.map +1 -1
  329. package/dist/vue/use-scroll-motion.d.ts +7 -0
  330. package/dist/vue/use-scroll-motion.d.ts.map +1 -0
  331. package/dist/vue/use-scroll-motion.js +30 -0
  332. package/dist/vue/use-scroll-motion.js.map +1 -0
  333. package/package.json +3 -3
  334. package/platforms/android/java/com/mavis/ui/Box.java +3 -1
  335. package/platforms/android/java/com/mavis/ui/ContentWidth.java +77 -0
  336. package/platforms/android/java/com/mavis/ui/FlexLayout.java +5 -1
  337. package/src/files.ts +3 -0
  338. package/src/native/avatar-image.ts +9 -0
  339. package/src/native/avatar-label.android.ts +14 -0
  340. package/src/native/avatar-label.ts +1 -0
  341. package/src/native/box.ios.ts +21 -1
  342. package/src/native/button.ios.ts +40 -2
  343. package/src/native/checkbox.android.ts +35 -0
  344. package/src/native/checkbox.ts +9 -0
  345. package/src/native/combobox-editor.android.ts +11 -0
  346. package/src/native/combobox-editor.ts +6 -0
  347. package/src/native/composed-button.android.ts +74 -0
  348. package/src/native/composed-button.ts +9 -0
  349. package/src/native/dialog.android.ts +56 -0
  350. package/src/native/dialog.ios.ts +23 -0
  351. package/src/native/dialog.ts +10 -0
  352. package/src/native/dynamic-type.ts +71 -0
  353. package/src/native/file-access.ts +71 -0
  354. package/src/native/file-picker.android.ts +191 -0
  355. package/src/native/file-picker.ios.ts +230 -0
  356. package/src/native/file-picker.ts +8 -0
  357. package/src/native/flex-layout.ios.ts +74 -2
  358. package/src/native/input-action.ts +15 -0
  359. package/src/native/keyboard-dismiss.ios.ts +2 -0
  360. package/src/native/label.android.ts +27 -0
  361. package/src/native/label.ios.ts +40 -1
  362. package/src/native/motion-owner.ts +59 -0
  363. package/src/native/motion-region.ts +213 -0
  364. package/src/native/motion-surface.ts +162 -0
  365. package/src/native/press.ts +52 -10
  366. package/src/native/progress.ts +78 -0
  367. package/src/native/scroll-motion.ts +106 -0
  368. package/src/native/segmented.ts +95 -0
  369. package/src/native/sheet.android.ts +2 -2
  370. package/src/native/sheet.ios.ts +12 -3
  371. package/src/native/sheet.ts +2 -2
  372. package/src/native/tabs.android.ts +58 -0
  373. package/src/native/tabs.ts +8 -0
  374. package/src/native/text-field.android.ts +19 -0
  375. package/src/native/text-field.ios.ts +53 -0
  376. package/src/native/text-view.ios.ts +10 -0
  377. package/src/native/toast.android.ts +9 -0
  378. package/src/native/toast.ios.ts +13 -0
  379. package/src/native/toast.ts +6 -0
  380. package/src/vue/components/ChoiceControl.ts +238 -0
  381. package/src/vue/components/DateCalendar.ts +117 -0
  382. package/src/vue/components/MAccordion.ts +123 -0
  383. package/src/vue/components/MAlert.ts +156 -0
  384. package/src/vue/components/MAvatar.ts +103 -0
  385. package/src/vue/components/MBadge.ts +34 -0
  386. package/src/vue/components/MButton.ts +176 -9
  387. package/src/vue/components/MCard.ts +23 -3
  388. package/src/vue/components/MCheckbox.ts +25 -0
  389. package/src/vue/components/MChip.ts +134 -0
  390. package/src/vue/components/MCombobox.ts +257 -0
  391. package/src/vue/components/MDatePicker.ts +33 -0
  392. package/src/vue/components/MDialog.ts +312 -0
  393. package/src/vue/components/MEmptyState.ts +96 -0
  394. package/src/vue/components/MFilePicker.ts +226 -0
  395. package/src/vue/components/MInput.ts +96 -12
  396. package/src/vue/components/MListItem.ts +66 -0
  397. package/src/vue/components/MProgress.ts +94 -0
  398. package/src/vue/components/MRadioGroup.ts +64 -0
  399. package/src/vue/components/MReveal.ts +6 -7
  400. package/src/vue/components/MScreen.ts +21 -6
  401. package/src/vue/components/MSegmentedControl.ts +214 -0
  402. package/src/vue/components/MSelect.ts +185 -0
  403. package/src/vue/components/MSeparator.ts +40 -0
  404. package/src/vue/components/MSheet.ts +83 -43
  405. package/src/vue/components/MSkeleton.ts +100 -0
  406. package/src/vue/components/MSlider.ts +7 -1
  407. package/src/vue/components/MSwitch.ts +187 -0
  408. package/src/vue/components/MTabs.ts +302 -0
  409. package/src/vue/components/MText.ts +37 -6
  410. package/src/vue/components/MToast.ts +289 -0
  411. package/src/vue/components/layout.ts +6 -3
  412. package/src/vue/components/workflows.ts +38 -0
  413. package/src/vue/index.ts +93 -2
  414. package/src/vue/layers.ts +2 -0
  415. package/src/vue/reveal-motion.ts +61 -0
  416. package/src/vue/use-motion-region.ts +29 -0
  417. package/src/vue/use-motion-surface.ts +84 -0
  418. package/src/vue/use-press.ts +12 -4
  419. package/src/vue/use-scroll-motion.ts +31 -0
  420. package/dist/native/input-description.android.d.ts +0 -4
  421. package/dist/native/input-description.android.d.ts.map +0 -1
  422. package/dist/native/input-description.android.js +0 -18
  423. package/dist/native/input-description.android.js.map +0 -1
  424. package/dist/theme/resolve.d.ts +0 -3
  425. package/dist/theme/resolve.d.ts.map +0 -1
  426. package/dist/theme/resolve.js +0 -8
  427. package/dist/theme/resolve.js.map +0 -1
  428. package/dist/theme/themes.d.ts +0 -6
  429. package/dist/theme/themes.d.ts.map +0 -1
  430. package/dist/theme/themes.js +0 -83
  431. package/dist/theme/themes.js.map +0 -1
  432. package/dist/theme/types.d.ts +0 -50
  433. package/dist/theme/types.d.ts.map +0 -1
  434. package/dist/theme/types.js +0 -2
  435. package/dist/theme/types.js.map +0 -1
  436. package/dist/vue/global-components.d.ts +0 -21
  437. package/dist/vue/global-components.d.ts.map +0 -1
  438. package/dist/vue/global-components.js +0 -2
  439. package/dist/vue/global-components.js.map +0 -1
  440. package/dist/vue/layout-context.d.ts +0 -5
  441. package/dist/vue/layout-context.d.ts.map +0 -1
  442. package/dist/vue/layout-context.js +0 -7
  443. package/dist/vue/layout-context.js.map +0 -1
  444. package/dist/vue/text-content.d.ts +0 -4
  445. package/dist/vue/text-content.d.ts.map +0 -1
  446. package/dist/vue/text-content.js +0 -17
  447. package/dist/vue/text-content.js.map +0 -1
  448. package/dist/vue/theme.d.ts +0 -177
  449. package/dist/vue/theme.d.ts.map +0 -1
  450. package/dist/vue/theme.js +0 -17
  451. package/dist/vue/theme.js.map +0 -1
@@ -10,6 +10,10 @@ import {
10
10
  // Core 9.1.3 computes row heights before growing children. This adapter runs after width
11
11
  // allocation and before cross-axis alignment; no global prototype or consumer styles change.
12
12
  interface FlexMeasurement {
13
+ _checkSizeConstraints(child: View): void
14
+ _stretchViewHorizontally(child: View, crossSize: number): void
15
+ _currentWidthMeasureSpec: number
16
+ _currentHeightMeasureSpec: number
13
17
  _determineMainSize(direction: string, widthSpec: number, heightSpec: number): void
14
18
  _flexLines: {
15
19
  _itemCount: number
@@ -29,6 +33,61 @@ const base = FlexboxLayout.prototype as unknown as FlexMeasurement
29
33
  export class MavisFlexLayout extends FlexboxLayout {
30
34
  measureRecord?: MeasureRecord
31
35
 
36
+ // Core's iOS Flexbox omits borders from its content insets. Keep the adjustment local
37
+ // to measurement/layout and leave the declared padding and derived values intact afterwards.
38
+ private withBorderPadding(run: () => void) {
39
+ const left = this.effectivePaddingLeft
40
+ const right = this.effectivePaddingRight
41
+ const top = this.effectivePaddingTop
42
+ const bottom = this.effectivePaddingBottom
43
+ this.effectivePaddingLeft += this.effectiveBorderLeftWidth
44
+ this.effectivePaddingRight += this.effectiveBorderRightWidth
45
+ this.effectivePaddingTop += this.effectiveBorderTopWidth
46
+ this.effectivePaddingBottom += this.effectiveBorderBottomWidth
47
+ try {
48
+ run()
49
+ } finally {
50
+ this.effectivePaddingLeft = left
51
+ this.effectivePaddingRight = right
52
+ this.effectivePaddingTop = top
53
+ this.effectivePaddingBottom = bottom
54
+ }
55
+ }
56
+
57
+ onMeasure(widthSpec: number, heightSpec: number) {
58
+ this.withBorderPadding(() => super.onMeasure(widthSpec, heightSpec))
59
+ }
60
+
61
+ onLayout(left: number, top: number, right: number, bottom: number) {
62
+ this.withBorderPadding(() => super.onLayout(left, top, right, bottom))
63
+ }
64
+
65
+ _checkSizeConstraints(child: View) {
66
+ const measurement = this as unknown as FlexMeasurement
67
+ const width = child.width
68
+ const spec = measurement._currentWidthMeasureSpec
69
+ if (
70
+ typeof width === 'object' &&
71
+ width.unit === '%' &&
72
+ layout.getMeasureSpecMode(spec) !== layout.UNSPECIFIED
73
+ ) {
74
+ // Core initially resolves percentages against the outer request. Correct the derived
75
+ // size before it forms flex lines, so wrapping/growth/shrink use the content-box basis.
76
+ child.effectiveWidth =
77
+ Math.max(
78
+ 0,
79
+ layout.getMeasureSpecSize(spec) - this.effectivePaddingLeft - this.effectivePaddingRight,
80
+ ) * width.value
81
+ this.measureAtWidth(child, child.effectiveWidth, measurement._currentHeightMeasureSpec)
82
+ }
83
+ base._checkSizeConstraints.call(this, child)
84
+ }
85
+
86
+ _stretchViewHorizontally(child: View, crossSize: number) {
87
+ // A declared width wins over alignItems=stretch, as it does in CSS flex layout.
88
+ if (child.effectiveWidth < 0) base._stretchViewHorizontally.call(this, child, crossSize)
89
+ }
90
+
32
91
  measure(widthSpec: number, heightSpec: number) {
33
92
  if (reuseMeasurement(this, widthSpec, heightSpec)) return
34
93
  super.measure(widthSpec, heightSpec)
@@ -48,8 +107,20 @@ export class MavisFlexLayout extends FlexboxLayout {
48
107
  const column = this.flexDirection.startsWith('column')
49
108
  const main = measurement._getLargestMainSize()
50
109
  const cross = measurement._getSumOfCrossSize()
51
- const maxHeight = column ? main : cross + this.effectivePaddingTop + this.effectivePaddingBottom
52
- const maxWidth = column ? cross + this.effectivePaddingLeft + this.effectivePaddingRight : main
110
+ const maxHeight = column
111
+ ? main
112
+ : cross +
113
+ this.effectivePaddingTop +
114
+ this.effectivePaddingBottom +
115
+ this.effectiveBorderTopWidth +
116
+ this.effectiveBorderBottomWidth
117
+ const maxWidth = column
118
+ ? cross +
119
+ this.effectivePaddingLeft +
120
+ this.effectivePaddingRight +
121
+ this.effectiveBorderLeftWidth +
122
+ this.effectiveBorderRightWidth
123
+ : main
53
124
  const exceeds = (spec: number, size: number) =>
54
125
  layout.getMeasureSpecMode(spec) === layout.AT_MOST && layout.getMeasureSpecSize(spec) < size
55
126
  return exceeds(heightSpec, maxHeight) || exceeds(widthSpec, maxWidth)
@@ -83,6 +154,7 @@ export class MavisFlexLayout extends FlexboxLayout {
83
154
  for (let i = 0; i < line._itemCount; i++, index++) {
84
155
  const child = measurement._getReorderedChildAt(index)
85
156
  if (!child || child.isCollapsed) continue
157
+ if (child.effectiveWidth >= 0) continue
86
158
  const alignSelf = FlexboxLayout.getAlignSelf(child)
87
159
  if (alignSelf !== 'auto' && alignSelf !== 'stretch') continue
88
160
  const oldHeight = child.getMeasuredHeight()
@@ -0,0 +1,15 @@
1
+ import type { View } from '@nativescript/core'
2
+
3
+ const actions = new WeakMap<object, () => boolean>()
4
+
5
+ /** An input's own action is part of the active edit, not a tap outside it. */
6
+ export function keepEditingOn(action: View, editor: () => View | undefined): () => void {
7
+ const native = action.ios as object | undefined
8
+ if (!native) return () => {}
9
+ actions.set(native, () => editor()?.ios?.isFirstResponder === true)
10
+ return () => actions.delete(native)
11
+ }
12
+
13
+ export function isEditingAction(native: object) {
14
+ return actions.get(native)?.() ?? false
15
+ }
@@ -1,4 +1,5 @@
1
1
  import { ScrollView, type View } from '@nativescript/core'
2
+ import { isEditingAction } from './input-action'
2
3
 
3
4
  export interface KeyboardDismissal {
4
5
  tap: boolean
@@ -34,6 +35,7 @@ declare const interop: { types: { void: unknown } }
34
35
 
35
36
  const editor = (view: NativeView | null) => {
36
37
  for (let current = view; current; current = current.superview) {
38
+ if (isEditingAction(current)) return true
37
39
  if (current instanceof (UITextField as never) || current instanceof (UITextView as never))
38
40
  return true
39
41
  }
@@ -0,0 +1,27 @@
1
+ import { Label, type FormattedString } from '@nativescript/core'
2
+
3
+ declare const android: { text: { style: { AbsoluteSizeSpan: { class: unknown } } } }
4
+ interface StyledText {
5
+ length(): number
6
+ getSpans(start: number, end: number, type: unknown): ArrayLike<unknown>
7
+ removeSpan(span: unknown): void
8
+ }
9
+ const format = (
10
+ Label.prototype as unknown as {
11
+ createFormattedTextNative(value: FormattedString): StyledText
12
+ }
13
+ ).createFormattedTextNative
14
+
15
+ /** MSpan inherits one label size; keep Android's scaled text size instead of Core's fixed-size spans. */
16
+ export class MavisLabel extends Label {
17
+ createFormattedTextNative(value: FormattedString) {
18
+ const text = format.call(this, value)
19
+ if (!text) return text
20
+ // Core skips the TextView size setter for formatted text. Use sp here so the
21
+ // same inherited size reaches every run and Android applies system scaling.
22
+ if (this.fontSize > 0) this.nativeTextViewProtected.setTextSize(this.fontSize)
23
+ const sizes = text.getSpans(0, text.length(), android.text.style.AbsoluteSizeSpan.class)
24
+ for (let index = 0; index < sizes.length; index++) text.removeSpan(sizes[index])
25
+ return text
26
+ }
27
+ }
@@ -1,8 +1,47 @@
1
- import { Label, Utils } from '@nativescript/core'
1
+ import { Label, Utils, Font, type Span } from '@nativescript/core'
2
+ import { fontScaleInternalProperty } from '@nativescript/core/ui/styling/style-properties'
3
+ import type { TextVariant } from '@getcortexlabs/mavis-core'
2
4
  import { recordMeasurement, reuseMeasurement, type MeasureRecord } from './measure-memo'
5
+ import { applyDynamicType, dynamicTypeScale } from './dynamic-type'
6
+
7
+ const spanDetails = (
8
+ Label.prototype as unknown as {
9
+ createMutableStringDetails(span: Span, text: string, index: number): { iosFont: unknown }
10
+ }
11
+ ).createMutableStringDetails
3
12
 
4
13
  export class MavisLabel extends Label {
14
+ createMutableStringDetails(span: Span, text: string, index: number) {
15
+ const details = spanDetails.call(this, span, text, index)
16
+ const style = span.style
17
+ const size = style.fontSize || this.fontSize
18
+ const font = new Font(
19
+ style.fontFamily,
20
+ size,
21
+ style.fontStyle,
22
+ style.fontWeight,
23
+ dynamicTypeScale(this, size),
24
+ )
25
+ details.iosFont = font.getUIFont(this.ios.font)
26
+ return details
27
+ }
28
+
5
29
  measureRecord?: MeasureRecord
30
+ private textStyle: TextVariant = 'body'
31
+
32
+ get dynamicTypeStyle() {
33
+ return this.textStyle
34
+ }
35
+
36
+ set dynamicTypeStyle(value: TextVariant) {
37
+ if (value === this.textStyle) return
38
+ this.textStyle = value
39
+ applyDynamicType(this)
40
+ }
41
+
42
+ [fontScaleInternalProperty.setNative]() {
43
+ applyDynamicType(this)
44
+ }
6
45
 
7
46
  measure(widthSpec: number, heightSpec: number) {
8
47
  if (reuseMeasurement(this, widthSpec, heightSpec)) return
@@ -0,0 +1,59 @@
1
+ import { motionScope } from '@rafaelaugusto/jolt'
2
+ import type { MotionSurfaceAdapter } from '@getcortexlabs/mavis-core/experimental'
3
+ import type { View } from '@nativescript/core'
4
+ import { registerNativeSurface } from './motion-region.js'
5
+
6
+ /** Native scopes also recreate subscriptions after application suspension. */
7
+ export function nativeMotionOwner(
8
+ adapter: MotionSurfaceAdapter,
9
+ target: View,
10
+ ): MotionSurfaceAdapter {
11
+ const result: MotionSurfaceAdapter = {
12
+ ...adapter,
13
+ use(setup) {
14
+ const parent = motionScope()
15
+ try {
16
+ parent.use(() => {
17
+ const child = motionScope()
18
+ const owned: MotionSurfaceAdapter = {
19
+ ...result,
20
+ animate: (...args) => child.add(result.animate(...args)),
21
+ set: (...args) => child.add(result.set(...args)),
22
+ motionValue:
23
+ result.motionValue && ((...args) => child.add(result.motionValue!(...args))),
24
+ springValue:
25
+ result.springValue && ((...args) => child.add(result.springValue!(...args))),
26
+ map: result.map && ((...args) => child.add(result.map!(...args))),
27
+ bind: result.bind && ((...args) => child.add(result.bind!(...args))),
28
+ drag: result.drag && ((...args) => child.add(result.drag!(...args))),
29
+ pointerFollow:
30
+ result.pointerFollow && ((...args) => child.add(result.pointerFollow!(...args))),
31
+ scrollLinked:
32
+ result.scrollLinked && ((...args) => child.add(result.scrollLinked!(...args))),
33
+ }
34
+ registerNativeSurface(owned, target)
35
+ let cleanup: () => void
36
+ try {
37
+ cleanup = setup(owned)
38
+ } catch (error) {
39
+ child.dispose()
40
+ throw error
41
+ }
42
+ return () => {
43
+ try {
44
+ cleanup()
45
+ } finally {
46
+ child.dispose()
47
+ }
48
+ }
49
+ })
50
+ } catch (error) {
51
+ parent.dispose()
52
+ throw error
53
+ }
54
+ return () => parent.dispose()
55
+ },
56
+ }
57
+ registerNativeSurface(result, target)
58
+ return result
59
+ }
@@ -0,0 +1,213 @@
1
+ import { Application, ScrollView, type View } from '@nativescript/core'
2
+ import { animate, reducedMotion, onReducedMotion } from '@rafaelaugusto/jolt'
3
+ import { sharedLayout } from '@rafaelaugusto/jolt/shared-layout'
4
+ import {
5
+ bindMotionRegion,
6
+ type MotionRegion,
7
+ type MotionRegionAdapter,
8
+ type MotionSurfaceAdapter,
9
+ } from '@getcortexlabs/mavis-core/experimental'
10
+ import { nativeScrollElement } from './scroll-motion.js'
11
+
12
+ const targets = new WeakMap<MotionSurfaceAdapter, View>()
13
+ const regions = new WeakMap<MotionRegionAdapter, View>()
14
+ export function assertNativeRegion(adapter: MotionRegionAdapter, target: View) {
15
+ const region = regions.get(adapter)
16
+ if (!region || region === target || !inside(target, region))
17
+ throw new TypeError('Use a separate enclosing native motion region.')
18
+ }
19
+ export function registerNativeSurface(adapter: MotionSurfaceAdapter, target: View) {
20
+ targets.set(adapter, target)
21
+ }
22
+ function resolve(adapter: MotionSurfaceAdapter) {
23
+ const target = targets.get(adapter)
24
+ if (!target?.isLoaded) throw new Error('Use a loaded native motion surface.')
25
+ return target
26
+ }
27
+ function inside(view: View, container: View) {
28
+ for (let current: View | undefined = view; current; current = current.parent as View | undefined)
29
+ if (current === container) return true
30
+ return false
31
+ }
32
+
33
+ /** Native observation is event-driven geometry; Jolt remains the only playback clock. */
34
+ function viewportEnter(
35
+ container: View,
36
+ surfaces: readonly MotionSurfaceAdapter[],
37
+ options: Parameters<MotionRegionAdapter['viewportEnter']>[1],
38
+ ) {
39
+ const targets = surfaces.map(resolve)
40
+ let root: View = options.root ? nativeScrollElement(options.root) : container
41
+ if (!options.root) {
42
+ for (
43
+ let parent = container.parent as View | undefined;
44
+ parent;
45
+ parent = parent.parent as View | undefined
46
+ )
47
+ if (parent instanceof ScrollView) {
48
+ root = parent
49
+ break
50
+ }
51
+ }
52
+ const states = targets.map((target, index) => ({
53
+ target,
54
+ index,
55
+ visible: false,
56
+ completed: false,
57
+ animation: undefined as ReturnType<typeof animate> | undefined,
58
+ }))
59
+ let disposed = false,
60
+ disabled = options.disabled ?? false,
61
+ observing = false
62
+ const stop = (state: (typeof states)[number]) => {
63
+ const handle = state.animation
64
+ state.animation = undefined
65
+ if (handle) {
66
+ handle.progress = 1
67
+ handle.stop()
68
+ }
69
+ }
70
+ const detach = () => {
71
+ if (!observing) return
72
+ observing = false
73
+ root.off('scroll', refresh)
74
+ root.off('layoutChanged', refresh)
75
+ for (const state of states) state.target.off('layoutChanged', refresh)
76
+ }
77
+ const refresh = () => {
78
+ if (disposed || disabled || Application.suspended || reducedMotion()) {
79
+ for (const state of states) {
80
+ stop(state)
81
+ state.visible = false
82
+ }
83
+ return
84
+ }
85
+ const size = root.getActualSize(),
86
+ margin = options.margin ?? 0
87
+ for (const state of states) {
88
+ if (!state.target.isLoaded || (options.once !== false && state.completed)) continue
89
+ const point = state.target.getLocationRelativeTo(root),
90
+ bounds = state.target.getActualSize()
91
+ const area = bounds.width * bounds.height
92
+ const overlap = point
93
+ ? Math.max(
94
+ 0,
95
+ Math.min(point.x + bounds.width, size.width + margin) - Math.max(point.x, -margin),
96
+ ) *
97
+ Math.max(
98
+ 0,
99
+ Math.min(point.y + bounds.height, size.height + margin) - Math.max(point.y, -margin),
100
+ )
101
+ : 0
102
+ const visible = area > 0 && overlap > 0 && overlap / area >= (options.threshold ?? 0)
103
+ if (!visible) stop(state)
104
+ if (visible && !state.visible && !state.animation) {
105
+ const animation = animate(state.target, options.frames ?? { opacity: [0, 1], y: [20, 0] }, {
106
+ duration: 450,
107
+ ...options.transition,
108
+ delay: (options.transition?.delay ?? 0) + state.index * (options.stagger ?? 70),
109
+ })
110
+ state.animation = animation
111
+ void animation.finished.then((completed) => {
112
+ if (disposed || state.animation !== animation) return
113
+ state.animation = undefined
114
+ if (completed) state.completed = true
115
+ if (
116
+ options.once !== false &&
117
+ states.every((entry) => entry.completed || !entry.target.isLoaded)
118
+ )
119
+ detach()
120
+ })
121
+ }
122
+ state.visible = visible
123
+ }
124
+ }
125
+ const attach = () => {
126
+ if (
127
+ observing ||
128
+ disposed ||
129
+ disabled ||
130
+ (options.once !== false && states.every((state) => state.completed))
131
+ )
132
+ return
133
+ observing = true
134
+ root.on('scroll', refresh)
135
+ root.on('layoutChanged', refresh)
136
+ for (const state of states) state.target.on('layoutChanged', refresh)
137
+ }
138
+ const preference = onReducedMotion(() => {
139
+ attach()
140
+ refresh()
141
+ })
142
+ Application.on(Application.suspendEvent, refresh)
143
+ Application.on(Application.resumeEvent, refresh)
144
+ attach()
145
+ refresh()
146
+ return {
147
+ execution: 'native-layout' as const,
148
+ get pending() {
149
+ return states.filter((state) => state.animation).length
150
+ },
151
+ get completed() {
152
+ return states.filter((state) => state.completed).length
153
+ },
154
+ update(state: { disabled: boolean }) {
155
+ disabled = state.disabled
156
+ if (disabled) detach()
157
+ else attach()
158
+ refresh()
159
+ },
160
+ refresh,
161
+ dispose() {
162
+ if (disposed) return
163
+ disposed = true
164
+ detach()
165
+ preference()
166
+ Application.off(Application.suspendEvent, refresh)
167
+ Application.off(Application.resumeEvent, refresh)
168
+ for (const state of states) stop(state)
169
+ },
170
+ }
171
+ }
172
+
173
+ export function attachNativeMotionRegion(reference: MotionRegion, target: View) {
174
+ const resolveChild = (adapter: MotionSurfaceAdapter) => {
175
+ const child = resolve(adapter)
176
+ if (!inside(child, target) || child === target)
177
+ throw new Error('Declare each surface inside this motion region.')
178
+ return child
179
+ }
180
+ const adapter: MotionRegionAdapter = {
181
+ kind: 'native',
182
+ viewportEnter(surfaces, options) {
183
+ surfaces.forEach(resolveChild)
184
+ return viewportEnter(target, surfaces, options)
185
+ },
186
+ sharedLayout(options) {
187
+ const control = sharedLayout(target, options)
188
+ return {
189
+ get active() {
190
+ return control.active
191
+ },
192
+ attach: (surface, identity) => control.attach(resolveChild(surface), identity),
193
+ transition: (change, options) => control.transition(change, options),
194
+ cancel: () => control.cancel(),
195
+ dispose: () => control.dispose(),
196
+ }
197
+ },
198
+ }
199
+ regions.set(adapter, target)
200
+ try {
201
+ const release = bindMotionRegion(reference, adapter)
202
+ return () => {
203
+ try {
204
+ release()
205
+ } finally {
206
+ regions.delete(adapter)
207
+ }
208
+ }
209
+ } catch (error) {
210
+ regions.delete(adapter)
211
+ throw error
212
+ }
213
+ }
@@ -0,0 +1,162 @@
1
+ import { nativeScrollMotion } from './scroll-motion.js'
2
+ import { assertNativeRegion } from './motion-region.js'
3
+ import type { View, EventData, TouchGestureEventData } from '@nativescript/core'
4
+ import {
5
+ bind,
6
+ motionValue,
7
+ springValue,
8
+ set,
9
+ stop,
10
+ drag,
11
+ type DerivedValue,
12
+ } from '@rafaelaugusto/jolt'
13
+ import type {
14
+ MotionSurfaceAdapter,
15
+ MotionValueAdapter,
16
+ } from '@getcortexlabs/mavis-core/experimental'
17
+
18
+ export function nativeContinuousSurface(target: View, enabled: () => boolean) {
19
+ const sources = new WeakMap<object, DerivedValue>()
20
+ const refreshes = new Set<() => void>()
21
+ const scrolls = new Set<ReturnType<typeof nativeScrollMotion>>()
22
+ const interrupt = (properties: readonly string[]) => {
23
+ for (const scroll of scrolls) scroll.interrupt(properties)
24
+ }
25
+ let suppressUntil = 0
26
+ const adapter: Pick<
27
+ MotionSurfaceAdapter,
28
+ | 'motionValue'
29
+ | 'springValue'
30
+ | 'bind'
31
+ | 'drag'
32
+ | 'map'
33
+ | 'refresh'
34
+ | 'scrollLinked'
35
+ | 'pointerFollow'
36
+ > = {
37
+ pointerFollow(region, options) {
38
+ assertNativeRegion(region, target)
39
+ const x = adapter.motionValue!(options.rest?.x ?? 0)
40
+ const y = adapter.motionValue!(options.rest?.y ?? 0)
41
+ return {
42
+ x,
43
+ y,
44
+ execution: 'static',
45
+ active: false,
46
+ update() {},
47
+ refresh() {},
48
+ dispose() {
49
+ x.dispose()
50
+ y.dispose()
51
+ },
52
+ }
53
+ },
54
+ scrollLinked(source, frames, options) {
55
+ interrupt(Object.keys(frames))
56
+ const scroll = nativeScrollMotion(source, target, frames, options)
57
+ scrolls.add(scroll)
58
+ return {
59
+ get execution() {
60
+ return scroll.execution
61
+ },
62
+ refresh: () => scroll.refresh(),
63
+ dispose() {
64
+ scrolls.delete(scroll)
65
+ scroll.dispose()
66
+ },
67
+ }
68
+ },
69
+ // Native views keep their fractional pivot through layout; no surface recreation.
70
+ refresh: () => target.requestLayout(),
71
+ map(source, input, output, options) {
72
+ const mapped = sources.get(source)!.to(input, output, options)
73
+ const value = { get: () => mapped.get(), dispose() {} }
74
+ sources.set(value, mapped)
75
+ return value
76
+ },
77
+ motionValue(initial) {
78
+ const source = motionValue(initial)
79
+ const value: MotionValueAdapter = {
80
+ get: () => source.get(),
81
+ set: (value) => set(source, value),
82
+ dispose: () => stop(source),
83
+ }
84
+ sources.set(value, source)
85
+ return value
86
+ },
87
+ springValue(input, options) {
88
+ const spring = springValue(sources.get(input)!, options)
89
+ const value = {
90
+ get: () => spring.get(),
91
+ getVelocity: () => spring.getVelocity(),
92
+ get moving() {
93
+ return spring.moving
94
+ },
95
+ get paused() {
96
+ return spring.paused
97
+ },
98
+ pause: () => spring.pause(),
99
+ resume: () => spring.play(),
100
+ dispose: () => spring.dispose(),
101
+ }
102
+ sources.set(value, spring)
103
+ return value
104
+ },
105
+ bind(values) {
106
+ interrupt(Object.keys(values))
107
+ const dispose = bind(
108
+ target,
109
+ Object.fromEntries(
110
+ Object.entries(values).map(([key, value]) => [key, sources.get(value)!]),
111
+ ),
112
+ )
113
+ return { dispose }
114
+ },
115
+ drag(options) {
116
+ let paused = false
117
+ const gesture = drag(target, {
118
+ ...options,
119
+ onMove: () => {
120
+ suppressUntil = Date.now() + 500
121
+ },
122
+ onRelease: () => {
123
+ suppressUntil = Date.now() + 500
124
+ },
125
+ })
126
+ const refresh = () => (paused || !enabled() ? gesture.pause() : gesture.play())
127
+ refreshes.add(refresh)
128
+ refresh()
129
+ const touch = (event: EventData) => {
130
+ if ((event as TouchGestureEventData).action === 'down') suppressUntil = 0
131
+ }
132
+ target.on('touch', touch)
133
+ return {
134
+ get dragging() {
135
+ return gesture.dragging
136
+ },
137
+ pause() {
138
+ paused = true
139
+ refresh()
140
+ },
141
+ resume() {
142
+ paused = false
143
+ refresh()
144
+ },
145
+ cancel: () => gesture.cancel(),
146
+ dispose() {
147
+ refreshes.delete(refresh)
148
+ target.off('touch', touch)
149
+ gesture.dispose()
150
+ },
151
+ }
152
+ },
153
+ }
154
+ return {
155
+ adapter,
156
+ interrupt,
157
+ refresh() {
158
+ for (const refresh of refreshes) refresh()
159
+ },
160
+ allowsActivation: () => Date.now() >= suppressUntil,
161
+ }
162
+ }