@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
@@ -0,0 +1,302 @@
1
+ import {
2
+ computed,
3
+ KeepAlive,
4
+ defineComponent,
5
+ h,
6
+ mergeProps,
7
+ onBeforeUnmount,
8
+ ref,
9
+ registerElement,
10
+ watch,
11
+ type SlotsType,
12
+ } from 'nativescript-vue'
13
+ import type { EventData, ScrollView, View } from '@nativescript/core'
14
+ import { animate, onReducedMotion, set } from '@rafaelaugusto/jolt'
15
+ import {
16
+ canChoose,
17
+ choiceKey,
18
+ tabFocusTarget,
19
+ tabScrollOffset,
20
+ validateTabs,
21
+ type TabOption,
22
+ type TabPanelProps,
23
+ } from '@getcortexlabs/mavis-core'
24
+ import { useButtonAction, tabsProps, tabsEmits, useMavisTheme } from '@getcortexlabs/mavis-core/vue'
25
+ import { MavisButton } from '../../native/button'
26
+ import { observeTab } from '../../native/tabs'
27
+ import { useNativeViewAttrs } from '../accessibility.js'
28
+ import { MColumn } from './layout.js'
29
+
30
+ registerElement('MavisTabButton', () => MavisButton)
31
+
32
+ export const MTabs = defineComponent({
33
+ name: 'MTabs',
34
+ inheritAttrs: false,
35
+ props: tabsProps,
36
+ emits: tabsEmits,
37
+ slots: Object as SlotsType<{ default: TabPanelProps }>,
38
+ setup(props, { attrs, emit, slots }) {
39
+ useButtonAction()
40
+ const { theme } = useMavisTheme()
41
+ const nativeAttrs = useNativeViewAttrs(props)
42
+ const controls = new Map<string, View>()
43
+ const observers = new Map<string, () => void>()
44
+ const focusKey = ref<string>()
45
+ const selected = computed(() => {
46
+ validateTabs(props.tabs, props.modelValue, props.label)
47
+ return props.tabs.find((tab) => tab.value === props.modelValue)
48
+ })
49
+ let scroll: ScrollView | undefined, row: View | undefined, indicator: View | undefined
50
+ let motion: ReturnType<typeof animate> | undefined
51
+ let timer: ReturnType<typeof setTimeout> | undefined
52
+ let reduced: (() => void) | undefined
53
+ let previous: { key: string; x: number; width: number } | undefined
54
+ let animateNext = false
55
+ function reveal(view: View) {
56
+ if (!scroll || !row) return
57
+ const point = view.getLocationRelativeTo(row)
58
+ if (!point) return
59
+ const offset = tabScrollOffset(
60
+ point.x,
61
+ view.getActualSize().width,
62
+ scroll.horizontalOffset,
63
+ scroll.getActualSize().width,
64
+ )
65
+ if (Math.abs(offset - scroll.horizontalOffset) > 0.5)
66
+ scroll.scrollToHorizontalOffset(offset, false)
67
+ }
68
+ function update() {
69
+ timer = undefined
70
+ if (!scroll || !row || !indicator) return
71
+ const active = selected.value
72
+ const key = active && choiceKey(active.value)
73
+ const button = key && controls.get(key)
74
+ const point = button && button.getLocationRelativeTo(row)
75
+ const width = button && button.getActualSize().width
76
+ if (!key || !button || !point || !width) {
77
+ motion?.stop()
78
+ motion = undefined
79
+ indicator.opacity = 0
80
+ previous = undefined
81
+ animateNext = false
82
+ return
83
+ }
84
+ const changed = !previous || previous.x !== point.x || previous.width !== width
85
+ if (changed) {
86
+ motion?.stop()
87
+ motion = undefined
88
+ indicator.width = width
89
+ indicator.opacity = 1
90
+ if (previous && animateNext)
91
+ motion = animate(indicator, { x: point.x }, { type: 'spring', duration: 240, bounce: 0 })
92
+ else set(indicator, { x: point.x })
93
+ }
94
+ previous = { key, x: point.x, width }
95
+ animateNext = false
96
+ reveal(button)
97
+ }
98
+ function schedule(animated = false) {
99
+ animateNext ||= animated
100
+ if (timer === undefined) timer = setTimeout(update, 0)
101
+ }
102
+ function release() {
103
+ clearTimeout(timer)
104
+ timer = undefined
105
+ motion?.stop()
106
+ motion = undefined
107
+ reduced?.()
108
+ reduced = undefined
109
+ for (const dispose of observers.values()) dispose()
110
+ observers.clear()
111
+ controls.clear()
112
+ scroll = undefined
113
+ row = indicator = undefined
114
+ previous = undefined
115
+ animateNext = false
116
+ focusKey.value = undefined
117
+ }
118
+ onBeforeUnmount(release)
119
+ watch(
120
+ () => props.modelValue,
121
+ () => schedule(true),
122
+ { flush: 'post' },
123
+ )
124
+ watch(
125
+ () => [props.tabs, props.disabled],
126
+ () => schedule(),
127
+ { deep: true, flush: 'post' },
128
+ )
129
+ function navigate(tab: TabOption, key: string) {
130
+ if (props.disabled || props.tabs.find((item) => item.value === tab.value)?.disabled) return
131
+ const next = tabFocusTarget(props.tabs, tab.value, key)
132
+ const button = next && controls.get(choiceKey(next.value))
133
+ if (button) {
134
+ button.focus()
135
+ reveal(button)
136
+ }
137
+ }
138
+ return () => {
139
+ const active = selected.value
140
+ const { colors, typography } = theme.value
141
+ return h(
142
+ MColumn,
143
+ mergeProps(attrs, {
144
+ id: props.id,
145
+ width: props.width,
146
+ grow: props.grow,
147
+ shrink: props.shrink,
148
+ gap: 'md',
149
+ accessibilityHidden: props.accessibilityHidden,
150
+ }),
151
+ {
152
+ default: () => [
153
+ h(
154
+ 'ScrollView',
155
+ {
156
+ orientation: 'horizontal',
157
+ scrollBarIndicatorVisible: false,
158
+ accessibilityHidden: props.accessibilityHidden,
159
+ onLoaded: (event: EventData) => {
160
+ scroll = event.object as ScrollView
161
+ reduced?.()
162
+ reduced = onReducedMotion((value) => {
163
+ if (value && indicator && previous) {
164
+ motion?.stop()
165
+ motion = undefined
166
+ set(indicator, { x: previous.x })
167
+ }
168
+ })
169
+ schedule()
170
+ },
171
+ onLayoutChanged: () => schedule(),
172
+ onUnloaded: release,
173
+ },
174
+ [
175
+ h('MavisBox', { verticalAlignment: 'top' }, [
176
+ h(
177
+ 'StackLayout',
178
+ {
179
+ orientation: 'horizontal',
180
+ horizontalAlignment: 'left',
181
+ borderBottomWidth: 1,
182
+ borderBottomColor: colors.border,
183
+ onLoaded: (event: EventData) => {
184
+ row = event.object as View
185
+ schedule()
186
+ },
187
+ onLayoutChanged: () => schedule(),
188
+ },
189
+ props.tabs.map((tab) => {
190
+ const key = choiceKey(tab.value),
191
+ chosen = active?.value === tab.value
192
+ const disabled = props.disabled || Boolean(tab.disabled)
193
+ return h('MavisTabButton', {
194
+ ...nativeAttrs(),
195
+ id: undefined,
196
+ key,
197
+ text: tab.label,
198
+ textWrap: false,
199
+ accessible: true,
200
+ accessibilityRole: 'button',
201
+ accessibilityLabel: tab.label,
202
+ accessibilityHint: props.label,
203
+ accessibilityState: [chosen ? 'selected' : '', disabled ? 'disabled' : '']
204
+ .filter(Boolean)
205
+ .join(','),
206
+ isEnabled: !disabled,
207
+ iosAccessibilityAdjustsFontSize: true,
208
+ style: {
209
+ minHeight: 52,
210
+ minWidth: 48,
211
+ margin: 0,
212
+ paddingLeft: 20,
213
+ paddingRight: 20,
214
+ paddingTop: 14,
215
+ paddingBottom: 17,
216
+ fontSize: typography.body.fontSize,
217
+ fontWeight: '600',
218
+ textTransform: 'none',
219
+ color: chosen ? colors.primary : colors.muted,
220
+ backgroundColor:
221
+ focusKey.value === key ? colors.primarySoft : 'transparent',
222
+ borderWidth: 0,
223
+ borderRadius: 0,
224
+ opacity: disabled ? 0.4 : 1,
225
+ androidElevation: 0,
226
+ androidDynamicElevationOffset: 0,
227
+ },
228
+ onTap: () => {
229
+ if (canChoose(tab, props.modelValue, props.disabled))
230
+ emit('update:modelValue', tab.value)
231
+ },
232
+ onLoaded: (event: EventData) => {
233
+ const button = event.object as View
234
+ controls.set(key, button)
235
+ observers.get(key)?.()
236
+ observers.set(
237
+ key,
238
+ observeTab(
239
+ button,
240
+ (focused) => {
241
+ if (focused) focusKey.value = key
242
+ else if (focusKey.value === key) focusKey.value = undefined
243
+ },
244
+ (direction) => navigate(tab, direction),
245
+ ),
246
+ )
247
+ schedule()
248
+ },
249
+ onUnloaded: () => {
250
+ observers.get(key)?.()
251
+ observers.delete(key)
252
+ controls.delete(key)
253
+ },
254
+ onLayoutChanged: () => schedule(),
255
+ })
256
+ }),
257
+ ),
258
+ h('MavisBox', {
259
+ accessible: false,
260
+ accessibilityHidden: true,
261
+ isUserInteractionEnabled: false,
262
+ horizontalAlignment: 'left',
263
+ verticalAlignment: 'bottom',
264
+ width: 1,
265
+ height: 3,
266
+ borderRadius: 2,
267
+ backgroundColor: colors.primary,
268
+ opacity: 0,
269
+ onLoaded: (event: EventData) => {
270
+ indicator = event.object as View
271
+ schedule()
272
+ },
273
+ }),
274
+ ]),
275
+ ],
276
+ ),
277
+ props.keepAlive
278
+ ? props.tabs.map((tab) =>
279
+ h(
280
+ KeepAlive,
281
+ { key: choiceKey(tab.value), max: 1 },
282
+ {
283
+ default: () =>
284
+ active?.value === tab.value
285
+ ? h(MColumn, {}, { default: () => slots.default?.({ value: tab.value }) })
286
+ : null,
287
+ },
288
+ ),
289
+ )
290
+ : active
291
+ ? h(
292
+ MColumn,
293
+ { key: choiceKey(active.value) },
294
+ { default: () => slots.default?.({ value: active.value }) },
295
+ )
296
+ : null,
297
+ ],
298
+ },
299
+ )
300
+ }
301
+ },
302
+ })
@@ -2,10 +2,11 @@ import { defineComponent, h, mergeProps, registerElement } from 'nativescript-vu
2
2
  import {
3
3
  textProps,
4
4
  useMavisTheme,
5
- textContent,
5
+ inlineContent,
6
6
  useDefaultShrink,
7
7
  } from '@getcortexlabs/mavis-core/vue'
8
- import { nonNegative } from '@getcortexlabs/mavis-core'
8
+ import { fontFamily, nonNegative, validateWeight } from '@getcortexlabs/mavis-core'
9
+ import { isAndroid } from '@nativescript/core'
9
10
  import { MavisLabel } from '../../native/label'
10
11
  import { useNativeViewAttrs } from '../accessibility.js'
11
12
 
@@ -19,18 +20,29 @@ export const MText = defineComponent({
19
20
  const { theme } = useMavisTheme()
20
21
  const nativeAttrs = useNativeViewAttrs(props)
21
22
  const shrink = useDefaultShrink()
22
- return () =>
23
- h(
23
+ return () => {
24
+ const type = theme.value.typography[props.variant]
25
+ const runs =
26
+ props.text !== undefined ? [{ text: props.text }] : inlineContent(slots.default?.())
27
+ const text = runs.map((run) => run.text).join('')
28
+ const formatted = runs.some((run) => run.weight || run.tone || run.strong || run.italic)
29
+ return h(
24
30
  'MavisLabel',
25
31
  mergeProps(
26
32
  {
27
- text: props.text ?? textContent(slots.default?.()),
33
+ text,
34
+ ...(formatted ? {} : { formattedText: null }),
28
35
  textWrap: props.wrap,
29
36
  iosAccessibilityAdjustsFontSize: true,
37
+ dynamicTypeStyle: props.variant,
30
38
  accessible: true,
31
39
  accessibilityRole: /^h[1-6]$/.test(props.as) ? 'header' : 'text',
32
40
  style: {
33
- ...theme.value.typography[props.variant],
41
+ ...type,
42
+ fontFamily: fontFamily(type.fontFamily, isAndroid ? 'android' : 'ios'),
43
+ fontWeight: props.weight ? validateWeight(props.weight) : type.fontWeight,
44
+ // Core's lineHeight is additional leading in device-independent units.
45
+ lineHeight: type.fontSize * (type.lineHeight - 1),
34
46
  color: theme.value.colors[props.tone],
35
47
  textAlignment: props.align,
36
48
  flexGrow: nonNegative(props.grow, 'grow'),
@@ -41,6 +53,25 @@ export const MText = defineComponent({
41
53
  nativeAttrs(),
42
54
  attrs,
43
55
  ),
56
+ formatted
57
+ ? [
58
+ h(
59
+ 'FormattedString',
60
+ {},
61
+ runs.map((run) => {
62
+ if (run.tone && !(run.tone in theme.value.colors))
63
+ throw new RangeError(`Unknown text tone: ${run.tone}`)
64
+ return h('Span', {
65
+ text: run.text,
66
+ fontWeight: run.weight,
67
+ fontStyle: run.italic ? 'italic' : undefined,
68
+ color: run.tone ? theme.value.colors[run.tone] : undefined,
69
+ })
70
+ }),
71
+ ),
72
+ ]
73
+ : undefined,
44
74
  )
75
+ }
45
76
  },
46
77
  })
@@ -0,0 +1,289 @@
1
+ import { useButtonAction, themeKey, type MavisThemeContext } from '@getcortexlabs/mavis-core/vue'
2
+ import {
3
+ provide,
4
+ defineComponent,
5
+ h,
6
+ onBeforeUnmount,
7
+ onActivated,
8
+ onDeactivated,
9
+ ref,
10
+ watch,
11
+ type PropType,
12
+ } from 'nativescript-vue'
13
+ import { Application, isIOS, Utils, type EventData, type View } from '@nativescript/core'
14
+ import { JoltTransition } from '@rafaelaugusto/jolt/vue'
15
+ import { toastProps, useMavisTheme, useToastHost } from '@getcortexlabs/mavis-core/vue'
16
+ import type { IconName, ToastTone } from '@getcortexlabs/mavis-core'
17
+ import { useLayerHost } from '../layers.js'
18
+ import { announceToast, toastReaderActive } from '../../native/toast'
19
+ import { observeCheckbox } from '../../native/checkbox'
20
+ import { MColumn, MBox } from './layout.js'
21
+ import { MText } from './MText.js'
22
+ import { MIcon } from './MIcon.js'
23
+ import { MButton } from './MButton.js'
24
+
25
+ const icons: Record<ToastTone, IconName> = {
26
+ success: 'circle-check',
27
+ error: 'circle-alert',
28
+ warning: 'triangle-alert',
29
+ info: 'info',
30
+ }
31
+ const tones = { success: 'success', error: 'danger', warning: 'warning', info: 'accent' } as const
32
+
33
+ type Bridge = {
34
+ context: MavisThemeContext
35
+ host: ReturnType<typeof useToastHost>
36
+ theme: ReturnType<typeof useMavisTheme>['theme']
37
+ props: Readonly<{
38
+ controller: import('@getcortexlabs/mavis-core').ToastController
39
+ closeLabel: string
40
+ }>
41
+ }
42
+ const ToastLayer = defineComponent({
43
+ name: 'MToastLayer',
44
+ props: { bridge: { type: Object as PropType<Bridge>, required: true }, covered: Boolean },
45
+ setup(props) {
46
+ provide(themeKey, props.bridge.context)
47
+ const { host, theme } = props.bridge
48
+ const width = ref(320)
49
+ const height = ref(600)
50
+ let enteredId: number | undefined
51
+ let announcedId: number | undefined
52
+ let root: View | undefined
53
+ let parent: View | undefined
54
+ let focus: ReturnType<typeof observeCheckbox> | undefined
55
+ const size = () => {
56
+ const bounds = parent?.getActualSize()
57
+ if (bounds) {
58
+ // The parent includes iOS safe areas even though Core lays this layer inside them.
59
+ const insets = isIOS ? parent?.getSafeAreaInsets() : undefined
60
+ const horizontal = insets
61
+ ? Utils.layout.toDeviceIndependentPixels(insets.left + insets.right)
62
+ : 0
63
+ const vertical = insets
64
+ ? Utils.layout.toDeviceIndependentPixels(insets.top + insets.bottom)
65
+ : 0
66
+ width.value = Math.max(0, Math.min(440, bounds.width - horizontal - 32))
67
+ height.value = Math.max(48, bounds.height - vertical - 32)
68
+ }
69
+ }
70
+ let background = false
71
+ const suspend = () => {
72
+ background = true
73
+ host.pause('background', true)
74
+ }
75
+ const resume = () => {
76
+ background = false
77
+ if (root?.isLoaded) host.pause('background', false)
78
+ }
79
+ Application.on(Application.suspendEvent, suspend)
80
+ Application.on(Application.resumeEvent, resume)
81
+ function unload() {
82
+ parent?.off('layoutChanged', size)
83
+ focus?.dispose()
84
+ focus = undefined
85
+ root = parent = undefined
86
+ // NativeScript also unloads the page when the app enters the background.
87
+ if (!background) host.deactivate()
88
+ }
89
+ function announce() {
90
+ const item = host.snapshot.value.message
91
+ if (!root || props.covered || !item || item.id !== enteredId || item.id === announcedId)
92
+ return
93
+ announceToast(root, [item.title, item.message].filter(Boolean).join('. '))
94
+ announcedId = item.id
95
+ }
96
+ watch(
97
+ () => props.covered,
98
+ (covered) => {
99
+ host.pause('modal', covered)
100
+ if (!covered) announce()
101
+ },
102
+ { immediate: true },
103
+ )
104
+ onBeforeUnmount(() => {
105
+ unload()
106
+ host.deactivate()
107
+ Application.off(Application.suspendEvent, suspend)
108
+ Application.off(Application.resumeEvent, resume)
109
+ })
110
+ return () => {
111
+ const { colors, radius } = theme.value
112
+ const { message, visible } = host.snapshot.value
113
+ const tone = message ? tones[message.tone] : 'accent'
114
+ return h(
115
+ 'MavisBox',
116
+ {
117
+ width: width.value,
118
+ margin: 16,
119
+ verticalAlignment: 'top',
120
+ horizontalAlignment: 'center',
121
+ visibility: props.covered || !message ? 'collapse' : 'visible',
122
+ accessibilityHidden: props.covered || !message,
123
+ onLoaded: (event: EventData) => {
124
+ root = event.object as View
125
+ parent = root.parent as View
126
+ size()
127
+ parent?.on('layoutChanged', size)
128
+ host.pause('background', background)
129
+ host.pause('modal', props.covered)
130
+ host.activate()
131
+ },
132
+ onUnloaded: unload,
133
+ },
134
+ [
135
+ h(
136
+ JoltTransition,
137
+ {
138
+ appear: true,
139
+ enter: [{ opacity: [0, 1], y: [-8, 0] }, { duration: 180 }],
140
+ leave: [{ opacity: 0, y: -4 }, { duration: 120 }],
141
+ onBeforeEnter: () => {
142
+ if (message) host.begin(message.id)
143
+ },
144
+ onAfterEnter: () => {
145
+ if (!message) return
146
+ host.pause('reader', toastReaderActive())
147
+ enteredId = message.id
148
+ announce()
149
+ host.entered(message.id)
150
+ },
151
+ onBeforeLeave: (element: { nativeView?: View }) => {
152
+ if (element.nativeView) element.nativeView.accessibilityHidden = true
153
+ },
154
+ onAfterLeave: () => {
155
+ if (message) host.left(message.id)
156
+ },
157
+ },
158
+ {
159
+ default: () =>
160
+ message && visible
161
+ ? h(
162
+ 'MavisBox',
163
+ {
164
+ key: message.id,
165
+ columns: '40,*,44',
166
+ padding: 16,
167
+ borderWidth: 1,
168
+ borderColor: colors.border,
169
+ borderRadius: radius.lg,
170
+ backgroundColor: colors.surface,
171
+ style: isIOS ? { boxShadow: '0 6 18 0 rgba(26, 15, 25, 0.12)' } : undefined,
172
+ },
173
+ [
174
+ h(
175
+ MBox,
176
+ {
177
+ col: 0,
178
+ width: 40,
179
+ height: 40,
180
+ radius: 'full',
181
+ backgroundColor: colors.elevated,
182
+ verticalAlignment: 'top',
183
+ },
184
+ {
185
+ default: () =>
186
+ h(MIcon, {
187
+ name: icons[message.tone],
188
+ tone,
189
+ horizontalAlignment: 'center',
190
+ verticalAlignment: 'middle',
191
+ }),
192
+ },
193
+ ),
194
+ h(
195
+ 'ScrollView',
196
+ {
197
+ col: 1,
198
+ marginLeft: 12,
199
+ style: { maxHeight: height.value - 34 },
200
+ },
201
+ [
202
+ h(
203
+ MColumn,
204
+ {
205
+ gap: 'xs',
206
+ verticalAlignment: 'top',
207
+ },
208
+ {
209
+ default: () => [
210
+ message.title
211
+ ? h(MText, {
212
+ text: message.title,
213
+ style: { fontWeight: '600' },
214
+ })
215
+ : null,
216
+ h(MText, {
217
+ text: message.message,
218
+ tone: message.title ? 'muted' : 'text',
219
+ }),
220
+ ],
221
+ },
222
+ ),
223
+ ],
224
+ ),
225
+ h(MButton, {
226
+ col: 2,
227
+ size: 'sm',
228
+ variant: 'ghost',
229
+ icon: 'x',
230
+ width: 44,
231
+ verticalAlignment: 'top',
232
+ accessibilityLabel: props.bridge.props.closeLabel,
233
+ style: { paddingLeft: 0, paddingRight: 0 },
234
+ onClick: () => props.bridge.props.controller.dismiss(message.id),
235
+ onLoaded: (event: EventData) => {
236
+ focus?.dispose()
237
+ focus = observeCheckbox(event.object as View, (value) =>
238
+ host.pause('focus', value),
239
+ )
240
+ },
241
+ onUnloaded: () => {
242
+ focus?.dispose()
243
+ focus = undefined
244
+ host.pause('focus', false)
245
+ },
246
+ }),
247
+ ],
248
+ )
249
+ : null,
250
+ },
251
+ ),
252
+ ],
253
+ )
254
+ }
255
+ },
256
+ })
257
+
258
+ export const MToast = defineComponent({
259
+ name: 'MToast',
260
+ inheritAttrs: false,
261
+ props: toastProps,
262
+ setup(props) {
263
+ useButtonAction()
264
+ const layers = useLayerHost('MToast')
265
+ const host = useToastHost(() => props.controller)
266
+ const context = useMavisTheme()
267
+ const { theme } = context
268
+ let remove: (() => void) | undefined
269
+ const attach = () => {
270
+ if (!remove)
271
+ remove = layers.add({
272
+ component: ToastLayer,
273
+ props: { bridge: { host, theme, props, context } },
274
+ presented: ref(true),
275
+ modal: false,
276
+ })
277
+ }
278
+ const detach = () => {
279
+ remove?.()
280
+ remove = undefined
281
+ host.deactivate()
282
+ }
283
+ attach()
284
+ onActivated(attach)
285
+ onDeactivated(detach)
286
+ onBeforeUnmount(detach)
287
+ return () => null
288
+ },
289
+ })
@@ -4,13 +4,15 @@ import {
4
4
  useMavisTheme,
5
5
  layoutDirection,
6
6
  useDefaultShrink,
7
+ motionBoxProps,
7
8
  } from '@getcortexlabs/mavis-core/vue'
8
9
  import { defineComponent, h, mergeProps, provide, registerElement } from 'nativescript-vue'
9
10
  import { resolveSpace } from '@getcortexlabs/mavis-core'
10
- import { boxProps, boxStyle } from '../props.js'
11
+ import { boxStyle } from '../props.js'
11
12
  import { MavisFlexLayout } from '../../native/flex-layout'
12
13
  import { MavisBox } from '../../native/box'
13
14
  import { useNativeViewAttrs } from '../accessibility.js'
15
+ import { useMotionRegion } from '../use-motion-region.js'
14
16
 
15
17
  export type { Align, Justify } from '@getcortexlabs/mavis-core/vue'
16
18
 
@@ -74,15 +76,16 @@ export const MColumn = createLayout('MColumn', 'column')
74
76
  export const MBox = defineComponent({
75
77
  name: 'MBox',
76
78
  inheritAttrs: false,
77
- props: boxProps,
79
+ props: motionBoxProps,
78
80
  setup(props, { attrs, slots }) {
81
+ const region = useMotionRegion(() => props.motionRegion)
79
82
  const { theme } = useMavisTheme()
80
83
  const nativeAttrs = useNativeViewAttrs(props)
81
84
  const shrink = useDefaultShrink()
82
85
  return () =>
83
86
  h(
84
87
  'MavisBox',
85
- mergeProps({ style: boxStyle(theme.value, props, shrink) }, nativeAttrs(), attrs),
88
+ mergeProps({ style: boxStyle(theme.value, props, shrink) }, nativeAttrs(), attrs, region),
86
89
  slots.default?.(),
87
90
  )
88
91
  },