@getcortexlabs/mavis 0.1.0-alpha.1 → 0.1.0-alpha.11
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.
- package/README.md +9 -5
- package/dist/app-icons.d.ts +26 -0
- package/dist/app-icons.d.ts.map +1 -0
- package/dist/app-icons.js +9 -0
- package/dist/app-icons.js.map +1 -0
- package/dist/date-format.d.ts +3 -0
- package/dist/date-format.d.ts.map +1 -0
- package/dist/date-format.js +2 -0
- package/dist/date-format.js.map +1 -0
- package/dist/files.d.ts +4 -0
- package/dist/files.d.ts.map +1 -0
- package/dist/files.js +3 -0
- package/dist/files.js.map +1 -0
- package/dist/native/app-icons.android.d.ts +4 -0
- package/dist/native/app-icons.android.d.ts.map +1 -0
- package/dist/native/app-icons.android.js +67 -0
- package/dist/native/app-icons.android.js.map +1 -0
- package/dist/native/app-icons.d.ts +4 -0
- package/dist/native/app-icons.d.ts.map +1 -0
- package/dist/native/app-icons.ios.d.ts +4 -0
- package/dist/native/app-icons.ios.d.ts.map +1 -0
- package/dist/native/app-icons.ios.js +45 -0
- package/dist/native/app-icons.ios.js.map +1 -0
- package/dist/native/app-icons.js +9 -0
- package/dist/native/app-icons.js.map +1 -0
- package/dist/native/appearance.android.d.ts +4 -0
- package/dist/native/appearance.android.d.ts.map +1 -0
- package/dist/native/appearance.android.js +55 -0
- package/dist/native/appearance.android.js.map +1 -0
- package/dist/native/appearance.d.ts +4 -0
- package/dist/native/appearance.d.ts.map +1 -0
- package/dist/native/appearance.js +31 -0
- package/dist/native/appearance.js.map +1 -0
- package/dist/native/avatar-image.d.ts +4 -0
- package/dist/native/avatar-image.d.ts.map +1 -0
- package/dist/native/avatar-image.js +12 -0
- package/dist/native/avatar-image.js.map +1 -0
- package/dist/native/avatar-label.android.d.ts +9 -0
- package/dist/native/avatar-label.android.d.ts.map +1 -0
- package/dist/native/avatar-label.android.js +9 -0
- package/dist/native/avatar-label.android.js.map +1 -0
- package/dist/native/avatar-label.d.ts +2 -0
- package/dist/native/avatar-label.d.ts.map +1 -0
- package/dist/native/avatar-label.js +2 -0
- package/dist/native/avatar-label.js.map +1 -0
- package/dist/native/box.android.d.ts +5 -0
- package/dist/native/box.android.d.ts.map +1 -0
- package/dist/native/box.android.js +7 -0
- package/dist/native/box.android.js.map +1 -0
- package/dist/native/box.d.ts +2 -0
- package/dist/native/box.d.ts.map +1 -0
- package/dist/native/box.ios.d.ts +10 -0
- package/dist/native/box.ios.d.ts.map +1 -0
- package/dist/native/box.ios.js +40 -0
- package/dist/native/box.ios.js.map +1 -0
- package/dist/native/box.js +3 -0
- package/dist/native/box.js.map +1 -0
- package/dist/native/button.android.d.ts +11 -0
- package/dist/native/button.android.d.ts.map +1 -0
- package/dist/native/button.android.js +31 -0
- package/dist/native/button.android.js.map +1 -0
- package/dist/native/button.ios.d.ts +13 -1
- package/dist/native/button.ios.d.ts.map +1 -1
- package/dist/native/button.ios.js +29 -1
- package/dist/native/button.ios.js.map +1 -1
- package/dist/native/checkbox.android.d.ts +7 -0
- package/dist/native/checkbox.android.d.ts.map +1 -0
- package/dist/native/checkbox.android.js +26 -0
- package/dist/native/checkbox.android.js.map +1 -0
- package/dist/native/checkbox.d.ts +7 -0
- package/dist/native/checkbox.d.ts.map +1 -0
- package/dist/native/checkbox.js +7 -0
- package/dist/native/checkbox.js.map +1 -0
- package/dist/native/collection-motion.d.ts +5 -0
- package/dist/native/collection-motion.d.ts.map +1 -0
- package/dist/native/collection-motion.js +157 -0
- package/dist/native/collection-motion.js.map +1 -0
- package/dist/native/combobox-editor.android.d.ts +3 -0
- package/dist/native/combobox-editor.android.d.ts.map +1 -0
- package/dist/native/combobox-editor.android.js +5 -0
- package/dist/native/combobox-editor.android.js.map +1 -0
- package/dist/native/combobox-editor.d.ts +4 -0
- package/dist/native/combobox-editor.d.ts.map +1 -0
- package/dist/native/combobox-editor.js +5 -0
- package/dist/native/combobox-editor.js.map +1 -0
- package/dist/native/composed-button.android.d.ts +4 -0
- package/dist/native/composed-button.android.d.ts.map +1 -0
- package/dist/native/composed-button.android.js +53 -0
- package/dist/native/composed-button.android.js.map +1 -0
- package/dist/native/composed-button.d.ts +3 -0
- package/dist/native/composed-button.d.ts.map +1 -0
- package/dist/native/composed-button.js +4 -0
- package/dist/native/composed-button.js.map +1 -0
- package/dist/native/date-format.android.d.ts +5 -0
- package/dist/native/date-format.android.d.ts.map +1 -0
- package/dist/native/date-format.android.js +39 -0
- package/dist/native/date-format.android.js.map +1 -0
- package/dist/native/date-format.d.ts +6 -0
- package/dist/native/date-format.d.ts.map +1 -0
- package/dist/native/date-format.ios.d.ts +5 -0
- package/dist/native/date-format.ios.d.ts.map +1 -0
- package/dist/native/date-format.ios.js +29 -0
- package/dist/native/date-format.ios.js.map +1 -0
- package/dist/native/date-format.js +8 -0
- package/dist/native/date-format.js.map +1 -0
- package/dist/native/dialog.android.d.ts +12 -0
- package/dist/native/dialog.android.d.ts.map +1 -0
- package/dist/native/dialog.android.js +46 -0
- package/dist/native/dialog.android.js.map +1 -0
- package/dist/native/dialog.d.ts +12 -0
- package/dist/native/dialog.d.ts.map +1 -0
- package/dist/native/dialog.ios.d.ts +12 -0
- package/dist/native/dialog.ios.d.ts.map +1 -0
- package/dist/native/dialog.ios.js +13 -0
- package/dist/native/dialog.ios.js.map +1 -0
- package/dist/native/dialog.js +4 -0
- package/dist/native/dialog.js.map +1 -0
- package/dist/native/dynamic-type.d.ts +15 -0
- package/dist/native/dynamic-type.d.ts.map +1 -0
- package/dist/native/dynamic-type.js +47 -0
- package/dist/native/dynamic-type.js.map +1 -0
- package/dist/native/file-access.d.ts +23 -0
- package/dist/native/file-access.d.ts.map +1 -0
- package/dist/native/file-access.js +55 -0
- package/dist/native/file-access.js.map +1 -0
- package/dist/native/file-picker.android.d.ts +3 -0
- package/dist/native/file-picker.android.d.ts.map +1 -0
- package/dist/native/file-picker.android.js +147 -0
- package/dist/native/file-picker.android.js.map +1 -0
- package/dist/native/file-picker.d.ts +4 -0
- package/dist/native/file-picker.d.ts.map +1 -0
- package/dist/native/file-picker.ios.d.ts +3 -0
- package/dist/native/file-picker.ios.d.ts.map +1 -0
- package/dist/native/file-picker.ios.js +152 -0
- package/dist/native/file-picker.ios.js.map +1 -0
- package/dist/native/file-picker.js +7 -0
- package/dist/native/file-picker.js.map +1 -0
- package/dist/native/flex-children.d.ts +4 -0
- package/dist/native/flex-children.d.ts.map +1 -0
- package/dist/native/flex-children.js +12 -0
- package/dist/native/flex-children.js.map +1 -0
- package/dist/native/flex-layout.android.d.ts +3 -1
- package/dist/native/flex-layout.android.d.ts.map +1 -1
- package/dist/native/flex-layout.android.js +9 -0
- package/dist/native/flex-layout.android.js.map +1 -1
- package/dist/native/flex-layout.ios.d.ts +14 -1
- package/dist/native/flex-layout.ios.d.ts.map +1 -1
- package/dist/native/flex-layout.ios.js +113 -0
- package/dist/native/flex-layout.ios.js.map +1 -1
- package/dist/native/image-effects.d.ts +11 -0
- package/dist/native/image-effects.d.ts.map +1 -0
- package/dist/native/image-effects.js +61 -0
- package/dist/native/image-effects.js.map +1 -0
- package/dist/native/input-action.d.ts +5 -0
- package/dist/native/input-action.d.ts.map +1 -0
- package/dist/native/input-action.js +13 -0
- package/dist/native/input-action.js.map +1 -0
- package/dist/native/keyboard-dismiss.android.d.ts +8 -0
- package/dist/native/keyboard-dismiss.android.d.ts.map +1 -0
- package/dist/native/keyboard-dismiss.android.js +9 -0
- package/dist/native/keyboard-dismiss.android.js.map +1 -0
- package/dist/native/keyboard-dismiss.d.ts +10 -0
- package/dist/native/keyboard-dismiss.d.ts.map +1 -0
- package/dist/native/keyboard-dismiss.ios.d.ts +8 -0
- package/dist/native/keyboard-dismiss.ios.d.ts.map +1 -0
- package/dist/native/keyboard-dismiss.ios.js +91 -0
- package/dist/native/keyboard-dismiss.ios.js.map +1 -0
- package/dist/native/keyboard-dismiss.js +6 -0
- package/dist/native/keyboard-dismiss.js.map +1 -0
- package/dist/native/label.android.d.ts +12 -0
- package/dist/native/label.android.d.ts.map +1 -0
- package/dist/native/label.android.js +19 -0
- package/dist/native/label.android.js.map +1 -0
- package/dist/native/label.ios.d.ts +14 -1
- package/dist/native/label.ios.d.ts.map +1 -1
- package/dist/native/label.ios.js +37 -1
- package/dist/native/label.ios.js.map +1 -1
- package/dist/native/measure-memo.d.ts +37 -0
- package/dist/native/measure-memo.d.ts.map +1 -0
- package/dist/native/measure-memo.js +82 -0
- package/dist/native/measure-memo.js.map +1 -0
- package/dist/native/motion-owner.d.ts +5 -0
- package/dist/native/motion-owner.d.ts.map +1 -0
- package/dist/native/motion-owner.js +58 -0
- package/dist/native/motion-owner.js.map +1 -0
- package/dist/native/motion-region.d.ts +7 -0
- package/dist/native/motion-region.d.ts.map +1 -0
- package/dist/native/motion-region.js +249 -0
- package/dist/native/motion-region.js.map +1 -0
- package/dist/native/motion-surface.d.ts +9 -0
- package/dist/native/motion-surface.d.ts.map +1 -0
- package/dist/native/motion-surface.js +229 -0
- package/dist/native/motion-surface.js.map +1 -0
- package/dist/native/platform-motion.d.ts +5 -0
- package/dist/native/platform-motion.d.ts.map +1 -0
- package/dist/native/platform-motion.js +90 -0
- package/dist/native/platform-motion.js.map +1 -0
- package/dist/native/press.d.ts +8 -2
- package/dist/native/press.d.ts.map +1 -1
- package/dist/native/press.js +58 -8
- package/dist/native/press.js.map +1 -1
- package/dist/native/progress.d.ts +7 -0
- package/dist/native/progress.d.ts.map +1 -0
- package/dist/native/progress.js +77 -0
- package/dist/native/progress.js.map +1 -0
- package/dist/native/screen.android.d.ts +6 -0
- package/dist/native/screen.android.d.ts.map +1 -0
- package/dist/native/screen.android.js +8 -0
- package/dist/native/screen.android.js.map +1 -0
- package/dist/native/screen.d.ts +2 -0
- package/dist/native/screen.d.ts.map +1 -0
- package/dist/native/screen.js +3 -0
- package/dist/native/screen.js.map +1 -0
- package/dist/native/scroll-motion.d.ts +12 -0
- package/dist/native/scroll-motion.d.ts.map +1 -0
- package/dist/native/scroll-motion.js +100 -0
- package/dist/native/scroll-motion.js.map +1 -0
- package/dist/native/section-scroll.d.ts +9 -0
- package/dist/native/section-scroll.d.ts.map +1 -0
- package/dist/native/section-scroll.js +69 -0
- package/dist/native/section-scroll.js.map +1 -0
- package/dist/native/segmented.d.ts +14 -0
- package/dist/native/segmented.d.ts.map +1 -0
- package/dist/native/segmented.js +86 -0
- package/dist/native/segmented.js.map +1 -0
- package/dist/native/sheet.android.d.ts +18 -0
- package/dist/native/sheet.android.d.ts.map +1 -0
- package/dist/native/sheet.android.js +16 -0
- package/dist/native/sheet.android.js.map +1 -0
- package/dist/native/sheet.d.ts +21 -0
- package/dist/native/sheet.d.ts.map +1 -0
- package/dist/native/sheet.ios.d.ts +19 -0
- package/dist/native/sheet.ios.d.ts.map +1 -0
- package/dist/native/sheet.ios.js +41 -0
- package/dist/native/sheet.ios.js.map +1 -0
- package/dist/native/sheet.js +17 -0
- package/dist/native/sheet.js.map +1 -0
- package/dist/native/surface-effects.d.ts +4 -0
- package/dist/native/surface-effects.d.ts.map +1 -0
- package/dist/native/surface-effects.js +31 -0
- package/dist/native/surface-effects.js.map +1 -0
- package/dist/native/tabs.android.d.ts +3 -0
- package/dist/native/tabs.android.d.ts.map +1 -0
- package/dist/native/tabs.android.js +29 -0
- package/dist/native/tabs.android.js.map +1 -0
- package/dist/native/tabs.d.ts +3 -0
- package/dist/native/tabs.d.ts.map +1 -0
- package/dist/native/tabs.js +4 -0
- package/dist/native/tabs.js.map +1 -0
- package/dist/native/text-field.android.d.ts +1 -0
- package/dist/native/text-field.android.d.ts.map +1 -1
- package/dist/native/text-field.android.js +13 -0
- package/dist/native/text-field.android.js.map +1 -1
- package/dist/native/text-field.ios.d.ts +9 -0
- package/dist/native/text-field.ios.d.ts.map +1 -0
- package/dist/native/text-field.ios.js +52 -0
- package/dist/native/text-field.ios.js.map +1 -0
- package/dist/native/text-view.ios.d.ts +7 -0
- package/dist/native/text-view.ios.d.ts.map +1 -0
- package/dist/native/text-view.ios.js +10 -0
- package/dist/native/text-view.ios.js.map +1 -0
- package/dist/native/toast.android.d.ts +4 -0
- package/dist/native/toast.android.d.ts.map +1 -0
- package/dist/native/toast.android.js +10 -0
- package/dist/native/toast.android.js.map +1 -0
- package/dist/native/toast.d.ts +4 -0
- package/dist/native/toast.d.ts.map +1 -0
- package/dist/native/toast.ios.d.ts +4 -0
- package/dist/native/toast.ios.d.ts.map +1 -0
- package/dist/native/toast.ios.js +8 -0
- package/dist/native/toast.ios.js.map +1 -0
- package/dist/native/toast.js +5 -0
- package/dist/native/toast.js.map +1 -0
- package/dist/native/visual-effects.d.ts +5 -0
- package/dist/native/visual-effects.d.ts.map +1 -0
- package/dist/native/visual-effects.js +126 -0
- package/dist/native/visual-effects.js.map +1 -0
- package/dist/vue/components/ChartPlot.d.ts +65 -0
- package/dist/vue/components/ChartPlot.d.ts.map +1 -0
- package/dist/vue/components/ChartPlot.js +100 -0
- package/dist/vue/components/ChartPlot.js.map +1 -0
- package/dist/vue/components/ChoiceControl.d.ts +114 -0
- package/dist/vue/components/ChoiceControl.d.ts.map +1 -0
- package/dist/vue/components/ChoiceControl.js +218 -0
- package/dist/vue/components/ChoiceControl.js.map +1 -0
- package/dist/vue/components/DateCalendar.d.ts +109 -0
- package/dist/vue/components/DateCalendar.d.ts.map +1 -0
- package/dist/vue/components/DateCalendar.js +98 -0
- package/dist/vue/components/DateCalendar.js.map +1 -0
- package/dist/vue/components/LoadingDecoration.d.ts +116 -0
- package/dist/vue/components/LoadingDecoration.d.ts.map +1 -0
- package/dist/vue/components/LoadingDecoration.js +34 -0
- package/dist/vue/components/LoadingDecoration.js.map +1 -0
- package/dist/vue/components/MAccordion.d.ts +119 -0
- package/dist/vue/components/MAccordion.d.ts.map +1 -0
- package/dist/vue/components/MAccordion.js +83 -0
- package/dist/vue/components/MAccordion.js.map +1 -0
- package/dist/vue/components/MAlert.d.ts +109 -0
- package/dist/vue/components/MAlert.d.ts.map +1 -0
- package/dist/vue/components/MAlert.js +126 -0
- package/dist/vue/components/MAlert.js.map +1 -0
- package/dist/vue/components/MAvatar.d.ts +80 -0
- package/dist/vue/components/MAvatar.d.ts.map +1 -0
- package/dist/vue/components/MAvatar.js +86 -0
- package/dist/vue/components/MAvatar.js.map +1 -0
- package/dist/vue/components/MBadge.d.ts +70 -0
- package/dist/vue/components/MBadge.d.ts.map +1 -0
- package/dist/vue/components/MBadge.js +30 -0
- package/dist/vue/components/MBadge.js.map +1 -0
- package/dist/vue/components/MButton.d.ts +212 -32
- package/dist/vue/components/MButton.d.ts.map +1 -1
- package/dist/vue/components/MButton.js +192 -20
- package/dist/vue/components/MButton.js.map +1 -1
- package/dist/vue/components/MCard.d.ts +113 -21
- package/dist/vue/components/MCard.d.ts.map +1 -1
- package/dist/vue/components/MCard.js +24 -6
- package/dist/vue/components/MCard.js.map +1 -1
- package/dist/vue/components/MCheckbox.d.ts +103 -0
- package/dist/vue/components/MCheckbox.d.ts.map +1 -0
- package/dist/vue/components/MCheckbox.js +26 -0
- package/dist/vue/components/MCheckbox.js.map +1 -0
- package/dist/vue/components/MChip.d.ts +117 -0
- package/dist/vue/components/MChip.d.ts.map +1 -0
- package/dist/vue/components/MChip.js +120 -0
- package/dist/vue/components/MChip.js.map +1 -0
- package/dist/vue/components/MCombobox.d.ts +279 -0
- package/dist/vue/components/MCombobox.d.ts.map +1 -0
- package/dist/vue/components/MCombobox.js +234 -0
- package/dist/vue/components/MCombobox.js.map +1 -0
- package/dist/vue/components/MDatePicker.d.ts +1350 -0
- package/dist/vue/components/MDatePicker.d.ts.map +1 -0
- package/dist/vue/components/MDatePicker.js +25 -0
- package/dist/vue/components/MDatePicker.js.map +1 -0
- package/dist/vue/components/MDialog.d.ts +100 -0
- package/dist/vue/components/MDialog.d.ts.map +1 -0
- package/dist/vue/components/MDialog.js +245 -0
- package/dist/vue/components/MDialog.js.map +1 -0
- package/dist/vue/components/MEmptyState.d.ts +117 -0
- package/dist/vue/components/MEmptyState.d.ts.map +1 -0
- package/dist/vue/components/MEmptyState.js +79 -0
- package/dist/vue/components/MEmptyState.js.map +1 -0
- package/dist/vue/components/MFilePicker.d.ts +112 -0
- package/dist/vue/components/MFilePicker.d.ts.map +1 -0
- package/dist/vue/components/MFilePicker.js +196 -0
- package/dist/vue/components/MFilePicker.js.map +1 -0
- package/dist/vue/components/MGrid.d.ts +165 -0
- package/dist/vue/components/MGrid.d.ts.map +1 -0
- package/dist/vue/components/MGrid.js +52 -0
- package/dist/vue/components/MGrid.js.map +1 -0
- package/dist/vue/components/MIcon.d.ts +75 -0
- package/dist/vue/components/MIcon.d.ts.map +1 -0
- package/dist/vue/components/MIcon.js +45 -0
- package/dist/vue/components/MIcon.js.map +1 -0
- package/dist/vue/components/MImage.d.ts +248 -0
- package/dist/vue/components/MImage.d.ts.map +1 -0
- package/dist/vue/components/MImage.js +157 -0
- package/dist/vue/components/MImage.js.map +1 -0
- package/dist/vue/components/MInput.d.ts +195 -50
- package/dist/vue/components/MInput.d.ts.map +1 -1
- package/dist/vue/components/MInput.js +134 -20
- package/dist/vue/components/MInput.js.map +1 -1
- package/dist/vue/components/MLink.d.ts +120 -0
- package/dist/vue/components/MLink.d.ts.map +1 -0
- package/dist/vue/components/MLink.js +76 -0
- package/dist/vue/components/MLink.js.map +1 -0
- package/dist/vue/components/MListItem.d.ts +106 -0
- package/dist/vue/components/MListItem.d.ts.map +1 -0
- package/dist/vue/components/MListItem.js +53 -0
- package/dist/vue/components/MListItem.js.map +1 -0
- package/dist/vue/components/MPopover.d.ts +106 -0
- package/dist/vue/components/MPopover.d.ts.map +1 -0
- package/dist/vue/components/MPopover.js +209 -0
- package/dist/vue/components/MPopover.js.map +1 -0
- package/dist/vue/components/MProgress.d.ts +122 -0
- package/dist/vue/components/MProgress.d.ts.map +1 -0
- package/dist/vue/components/MProgress.js +75 -0
- package/dist/vue/components/MProgress.js.map +1 -0
- package/dist/vue/components/MRadioGroup.d.ts +103 -0
- package/dist/vue/components/MRadioGroup.d.ts.map +1 -0
- package/dist/vue/components/MRadioGroup.js +57 -0
- package/dist/vue/components/MRadioGroup.js.map +1 -0
- package/dist/vue/components/MRangeSlider.d.ts +105 -0
- package/dist/vue/components/MRangeSlider.d.ts.map +1 -0
- package/dist/vue/components/MRangeSlider.js +107 -0
- package/dist/vue/components/MRangeSlider.js.map +1 -0
- package/dist/vue/components/MReveal.d.ts +73 -37
- package/dist/vue/components/MReveal.d.ts.map +1 -1
- package/dist/vue/components/MReveal.js +80 -37
- package/dist/vue/components/MReveal.js.map +1 -1
- package/dist/vue/components/MScreen.d.ts +42 -8
- package/dist/vue/components/MScreen.d.ts.map +1 -1
- package/dist/vue/components/MScreen.js +91 -6
- package/dist/vue/components/MScreen.js.map +1 -1
- package/dist/vue/components/MSegmentedControl.d.ts +95 -0
- package/dist/vue/components/MSegmentedControl.d.ts.map +1 -0
- package/dist/vue/components/MSegmentedControl.js +172 -0
- package/dist/vue/components/MSegmentedControl.js.map +1 -0
- package/dist/vue/components/MSelect.d.ts +140 -0
- package/dist/vue/components/MSelect.d.ts.map +1 -0
- package/dist/vue/components/MSelect.js +158 -0
- package/dist/vue/components/MSelect.js.map +1 -0
- package/dist/vue/components/MSeparator.d.ts +56 -0
- package/dist/vue/components/MSeparator.d.ts.map +1 -0
- package/dist/vue/components/MSeparator.js +36 -0
- package/dist/vue/components/MSeparator.js.map +1 -0
- package/dist/vue/components/MSheet.d.ts +116 -0
- package/dist/vue/components/MSheet.d.ts.map +1 -0
- package/dist/vue/components/MSheet.js +313 -0
- package/dist/vue/components/MSheet.js.map +1 -0
- package/dist/vue/components/MSkeleton.d.ts +89 -0
- package/dist/vue/components/MSkeleton.d.ts.map +1 -0
- package/dist/vue/components/MSkeleton.js +89 -0
- package/dist/vue/components/MSkeleton.js.map +1 -0
- package/dist/vue/components/MSlider.d.ts +8 -4
- package/dist/vue/components/MSlider.d.ts.map +1 -1
- package/dist/vue/components/MSlider.js +3 -2
- package/dist/vue/components/MSlider.js.map +1 -1
- package/dist/vue/components/MStack.d.ts +199 -0
- package/dist/vue/components/MStack.d.ts.map +1 -0
- package/dist/vue/components/MStack.js +62 -0
- package/dist/vue/components/MStack.js.map +1 -0
- package/dist/vue/components/MSwitch.d.ts +89 -0
- package/dist/vue/components/MSwitch.d.ts.map +1 -0
- package/dist/vue/components/MSwitch.js +173 -0
- package/dist/vue/components/MSwitch.js.map +1 -0
- package/dist/vue/components/MTabs.d.ts +101 -0
- package/dist/vue/components/MTabs.d.ts.map +1 -0
- package/dist/vue/components/MTabs.js +245 -0
- package/dist/vue/components/MTabs.js.map +1 -0
- package/dist/vue/components/MText.d.ts +61 -25
- package/dist/vue/components/MText.d.ts.map +1 -1
- package/dist/vue/components/MText.js +47 -19
- package/dist/vue/components/MText.js.map +1 -1
- package/dist/vue/components/MTimePicker.d.ts +655 -0
- package/dist/vue/components/MTimePicker.d.ts.map +1 -0
- package/dist/vue/components/MTimePicker.js +50 -0
- package/dist/vue/components/MTimePicker.js.map +1 -0
- package/dist/vue/components/MToast.d.ts +23 -0
- package/dist/vue/components/MToast.d.ts.map +1 -0
- package/dist/vue/components/MToast.js +242 -0
- package/dist/vue/components/MToast.js.map +1 -0
- package/dist/vue/components/MTooltip.d.ts +65 -0
- package/dist/vue/components/MTooltip.d.ts.map +1 -0
- package/dist/vue/components/MTooltip.js +35 -0
- package/dist/vue/components/MTooltip.js.map +1 -0
- package/dist/vue/components/MVirtualList.d.ts +3 -0
- package/dist/vue/components/MVirtualList.d.ts.map +1 -0
- package/dist/vue/components/MVirtualList.js +88 -0
- package/dist/vue/components/MVirtualList.js.map +1 -0
- package/dist/vue/components/configurator.d.ts +541 -0
- package/dist/vue/components/configurator.d.ts.map +1 -0
- package/dist/vue/components/configurator.js +24 -0
- package/dist/vue/components/configurator.js.map +1 -0
- package/dist/vue/components/discovery.d.ts +282 -0
- package/dist/vue/components/discovery.d.ts.map +1 -0
- package/dist/vue/components/discovery.js +67 -0
- package/dist/vue/components/discovery.js.map +1 -0
- package/dist/vue/components/layout.d.ts +230 -88
- package/dist/vue/components/layout.d.ts.map +1 -1
- package/dist/vue/components/layout.js +16 -9
- package/dist/vue/components/layout.js.map +1 -1
- package/dist/vue/components/navigation.d.ts +225 -0
- package/dist/vue/components/navigation.d.ts.map +1 -0
- package/dist/vue/components/navigation.js +16 -0
- package/dist/vue/components/navigation.js.map +1 -0
- package/dist/vue/components/wayfinding.d.ts +441 -0
- package/dist/vue/components/wayfinding.d.ts.map +1 -0
- package/dist/vue/components/wayfinding.js +37 -0
- package/dist/vue/components/wayfinding.js.map +1 -0
- package/dist/vue/components/workflows.d.ts +251 -0
- package/dist/vue/components/workflows.d.ts.map +1 -0
- package/dist/vue/components/workflows.js +35 -0
- package/dist/vue/components/workflows.js.map +1 -0
- package/dist/vue/index.d.ts +54 -9
- package/dist/vue/index.d.ts.map +1 -1
- package/dist/vue/index.js +105 -7
- package/dist/vue/index.js.map +1 -1
- package/dist/vue/layers.d.ts +19 -0
- package/dist/vue/layers.d.ts.map +1 -0
- package/dist/vue/layers.js +26 -0
- package/dist/vue/layers.js.map +1 -0
- package/dist/vue/native-view.d.ts +6 -0
- package/dist/vue/native-view.d.ts.map +1 -0
- package/dist/vue/native-view.js +5 -0
- package/dist/vue/native-view.js.map +1 -0
- package/dist/vue/navigation.d.ts +4 -0
- package/dist/vue/navigation.d.ts.map +1 -0
- package/dist/vue/navigation.js +16 -0
- package/dist/vue/navigation.js.map +1 -0
- package/dist/vue/props.d.ts +12 -11
- package/dist/vue/props.d.ts.map +1 -1
- package/dist/vue/props.js +25 -10
- package/dist/vue/props.js.map +1 -1
- package/dist/vue/router-navigation.d.ts +25 -0
- package/dist/vue/router-navigation.d.ts.map +1 -0
- package/dist/vue/router-navigation.js +15 -0
- package/dist/vue/router-navigation.js.map +1 -0
- package/dist/vue/services.d.ts +16 -0
- package/dist/vue/services.d.ts.map +1 -0
- package/dist/vue/services.js +23 -0
- package/dist/vue/services.js.map +1 -0
- package/dist/vue/system-back.d.ts +11 -0
- package/dist/vue/system-back.d.ts.map +1 -0
- package/dist/vue/system-back.js +2 -0
- package/dist/vue/system-back.js.map +1 -0
- package/dist/vue/use-choice-paint.d.ts +9 -0
- package/dist/vue/use-choice-paint.d.ts.map +1 -0
- package/dist/vue/use-choice-paint.js +32 -0
- package/dist/vue/use-choice-paint.js.map +1 -0
- package/dist/vue/use-motion-region.d.ts +7 -0
- package/dist/vue/use-motion-region.d.ts.map +1 -0
- package/dist/vue/use-motion-region.js +28 -0
- package/dist/vue/use-motion-region.js.map +1 -0
- package/dist/vue/use-motion-surface.d.ts +8 -0
- package/dist/vue/use-motion-surface.d.ts.map +1 -0
- package/dist/vue/use-motion-surface.js +105 -0
- package/dist/vue/use-motion-surface.js.map +1 -0
- package/dist/vue/use-press.d.ts +1 -1
- package/dist/vue/use-press.d.ts.map +1 -1
- package/dist/vue/use-press.js +13 -5
- package/dist/vue/use-press.js.map +1 -1
- package/dist/vue/use-scroll-motion.d.ts +7 -0
- package/dist/vue/use-scroll-motion.d.ts.map +1 -0
- package/dist/vue/use-scroll-motion.js +30 -0
- package/dist/vue/use-scroll-motion.js.map +1 -0
- package/fonts/LICENSE +45 -0
- package/fonts/lucide.ttf +0 -0
- package/package.json +20 -4
- package/platforms/android/java/com/mavis/ui/Box.java +65 -0
- package/platforms/android/java/com/mavis/ui/ContentWidth.java +77 -0
- package/platforms/android/java/com/mavis/ui/FlexLayout.java +101 -4
- package/platforms/android/java/com/mavis/ui/MeasureMemo.java +145 -0
- package/platforms/android/java/com/mavis/ui/Screen.java +108 -0
- package/src/app-icons.ts +21 -0
- package/src/date-format.ts +2 -0
- package/src/files.ts +3 -0
- package/src/native/app-icons.android.ts +95 -0
- package/src/native/app-icons.ios.ts +74 -0
- package/src/native/app-icons.ts +12 -0
- package/src/native/appearance.android.ts +75 -0
- package/src/native/appearance.ts +33 -0
- package/src/native/avatar-image.ts +9 -0
- package/src/native/avatar-label.android.ts +14 -0
- package/src/native/avatar-label.ts +1 -0
- package/src/native/box.android.ts +11 -0
- package/src/native/box.ios.ts +61 -0
- package/src/native/box.ts +2 -0
- package/src/native/button.android.ts +38 -0
- package/src/native/button.ios.ts +53 -1
- package/src/native/checkbox.android.ts +35 -0
- package/src/native/checkbox.ts +9 -0
- package/src/native/collection-motion.ts +166 -0
- package/src/native/combobox-editor.android.ts +11 -0
- package/src/native/combobox-editor.ts +6 -0
- package/src/native/composed-button.android.ts +74 -0
- package/src/native/composed-button.ts +9 -0
- package/src/native/date-format.android.ts +72 -0
- package/src/native/date-format.ios.ts +54 -0
- package/src/native/date-format.ts +17 -0
- package/src/native/dialog.android.ts +56 -0
- package/src/native/dialog.ios.ts +23 -0
- package/src/native/dialog.ts +10 -0
- package/src/native/dynamic-type.ts +71 -0
- package/src/native/file-access.ts +71 -0
- package/src/native/file-picker.android.ts +191 -0
- package/src/native/file-picker.ios.ts +230 -0
- package/src/native/file-picker.ts +8 -0
- package/src/native/flex-children.ts +12 -0
- package/src/native/flex-layout.android.ts +12 -1
- package/src/native/flex-layout.ios.ts +148 -1
- package/src/native/image-effects.ts +71 -0
- package/src/native/input-action.ts +15 -0
- package/src/native/keyboard-dismiss.android.ts +17 -0
- package/src/native/keyboard-dismiss.ios.ts +124 -0
- package/src/native/keyboard-dismiss.ts +14 -0
- package/src/native/label.android.ts +27 -0
- package/src/native/label.ios.ts +54 -1
- package/src/native/measure-memo.ts +116 -0
- package/src/native/motion-owner.ts +66 -0
- package/src/native/motion-region.ts +293 -0
- package/src/native/motion-surface.ts +273 -0
- package/src/native/platform-motion.ts +103 -0
- package/src/native/press.ts +58 -10
- package/src/native/progress.ts +78 -0
- package/src/native/screen.android.ts +12 -0
- package/src/native/screen.ts +2 -0
- package/src/native/scroll-motion.ts +106 -0
- package/src/native/section-scroll.ts +81 -0
- package/src/native/segmented.ts +95 -0
- package/src/native/sheet.android.ts +24 -0
- package/src/native/sheet.ios.ts +52 -0
- package/src/native/sheet.ts +26 -0
- package/src/native/surface-effects.ts +33 -0
- package/src/native/tabs.android.ts +58 -0
- package/src/native/tabs.ts +8 -0
- package/src/native/text-field.android.ts +19 -0
- package/src/native/text-field.ios.ts +53 -0
- package/src/native/text-view.ios.ts +10 -0
- package/src/native/toast.android.ts +9 -0
- package/src/native/toast.ios.ts +13 -0
- package/src/native/toast.ts +6 -0
- package/src/native/visual-effects.ts +147 -0
- package/src/vue/components/ChartPlot.ts +114 -0
- package/src/vue/components/ChoiceControl.ts +265 -0
- package/src/vue/components/DateCalendar.ts +121 -0
- package/src/vue/components/LoadingDecoration.ts +38 -0
- package/src/vue/components/MAccordion.ts +123 -0
- package/src/vue/components/MAlert.ts +156 -0
- package/src/vue/components/MAvatar.ts +103 -0
- package/src/vue/components/MBadge.ts +34 -0
- package/src/vue/components/MButton.ts +255 -18
- package/src/vue/components/MCard.ts +44 -5
- package/src/vue/components/MCheckbox.ts +25 -0
- package/src/vue/components/MChip.ts +134 -0
- package/src/vue/components/MCombobox.ts +257 -0
- package/src/vue/components/MDatePicker.ts +25 -0
- package/src/vue/components/MDialog.ts +312 -0
- package/src/vue/components/MEmptyState.ts +96 -0
- package/src/vue/components/MFilePicker.ts +226 -0
- package/src/vue/components/MGrid.ts +86 -0
- package/src/vue/components/MIcon.ts +53 -0
- package/src/vue/components/MImage.ts +181 -0
- package/src/vue/components/MInput.ts +143 -21
- package/src/vue/components/MLink.ts +99 -0
- package/src/vue/components/MListItem.ts +66 -0
- package/src/vue/components/MPopover.ts +254 -0
- package/src/vue/components/MProgress.ts +94 -0
- package/src/vue/components/MRadioGroup.ts +64 -0
- package/src/vue/components/MRangeSlider.ts +125 -0
- package/src/vue/components/MReveal.ts +89 -48
- package/src/vue/components/MScreen.ts +122 -6
- package/src/vue/components/MSegmentedControl.ts +214 -0
- package/src/vue/components/MSelect.ts +185 -0
- package/src/vue/components/MSeparator.ts +40 -0
- package/src/vue/components/MSheet.ts +375 -0
- package/src/vue/components/MSkeleton.ts +102 -0
- package/src/vue/components/MSlider.ts +8 -2
- package/src/vue/components/MStack.ts +83 -0
- package/src/vue/components/MSwitch.ts +200 -0
- package/src/vue/components/MTabs.ts +302 -0
- package/src/vue/components/MText.ts +48 -10
- package/src/vue/components/MTimePicker.ts +57 -0
- package/src/vue/components/MToast.ts +289 -0
- package/src/vue/components/MTooltip.ts +39 -0
- package/src/vue/components/MVirtualList.ts +120 -0
- package/src/vue/components/configurator.ts +27 -0
- package/src/vue/components/discovery.ts +92 -0
- package/src/vue/components/layout.ts +24 -9
- package/src/vue/components/navigation.ts +19 -0
- package/src/vue/components/wayfinding.ts +46 -0
- package/src/vue/components/workflows.ts +38 -0
- package/src/vue/index.ts +217 -22
- package/src/vue/layers.ts +48 -0
- package/src/vue/native-view.ts +6 -0
- package/src/vue/navigation.ts +15 -0
- package/src/vue/props.ts +37 -12
- package/src/vue/router-navigation.ts +39 -0
- package/src/vue/services.ts +39 -0
- package/src/vue/system-back.ts +12 -0
- package/src/vue/use-choice-paint.ts +39 -0
- package/src/vue/use-motion-region.ts +29 -0
- package/src/vue/use-motion-surface.ts +115 -0
- package/src/vue/use-press.ts +13 -5
- package/src/vue/use-scroll-motion.ts +31 -0
- package/dist/native/input-description.android.d.ts +0 -4
- package/dist/native/input-description.android.d.ts.map +0 -1
- package/dist/native/input-description.android.js +0 -18
- package/dist/native/input-description.android.js.map +0 -1
- package/dist/theme/resolve.d.ts +0 -3
- package/dist/theme/resolve.d.ts.map +0 -1
- package/dist/theme/resolve.js +0 -8
- package/dist/theme/resolve.js.map +0 -1
- package/dist/theme/themes.d.ts +0 -6
- package/dist/theme/themes.d.ts.map +0 -1
- package/dist/theme/themes.js +0 -83
- package/dist/theme/themes.js.map +0 -1
- package/dist/theme/types.d.ts +0 -50
- package/dist/theme/types.d.ts.map +0 -1
- package/dist/theme/types.js +0 -2
- package/dist/theme/types.js.map +0 -1
- package/dist/vue/global-components.d.ts +0 -21
- package/dist/vue/global-components.d.ts.map +0 -1
- package/dist/vue/global-components.js +0 -2
- package/dist/vue/global-components.js.map +0 -1
- package/dist/vue/layout-context.d.ts +0 -5
- package/dist/vue/layout-context.d.ts.map +0 -1
- package/dist/vue/layout-context.js +0 -7
- package/dist/vue/layout-context.js.map +0 -1
- package/dist/vue/text-content.d.ts +0 -4
- package/dist/vue/text-content.d.ts.map +0 -1
- package/dist/vue/text-content.js +0 -17
- package/dist/vue/text-content.js.map +0 -1
- package/dist/vue/theme.d.ts +0 -177
- package/dist/vue/theme.d.ts.map +0 -1
- package/dist/vue/theme.js +0 -17
- package/dist/vue/theme.js.map +0 -1
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import { LayoutBase, isIOS, type View } from '@nativescript/core'
|
|
2
|
+
import { scrollHeader, type MotionScope } from '@rafaelaugusto/jolt'
|
|
3
|
+
import { reorder, type Reorder } from '@rafaelaugusto/jolt/reorder'
|
|
4
|
+
import {
|
|
5
|
+
mapMotionItems,
|
|
6
|
+
type MotionRegionAdapter,
|
|
7
|
+
type MotionSurfaceAdapter,
|
|
8
|
+
} from '@getcortexlabs/mavis-core/experimental'
|
|
9
|
+
import { nativeScrollElement } from './scroll-motion.js'
|
|
10
|
+
|
|
11
|
+
const headerInsets = new WeakMap<LayoutBase, { previous: boolean; owners: number }>()
|
|
12
|
+
function retainHeaderLayout(header: LayoutBase) {
|
|
13
|
+
if (!isIOS) return () => {}
|
|
14
|
+
const state = headerInsets.get(header) ?? { previous: header.iosIgnoreSafeArea, owners: 0 }
|
|
15
|
+
state.owners++
|
|
16
|
+
headerInsets.set(header, state)
|
|
17
|
+
header.iosIgnoreSafeArea = true
|
|
18
|
+
let released = false
|
|
19
|
+
return () => {
|
|
20
|
+
if (released) return
|
|
21
|
+
released = true
|
|
22
|
+
if (--state.owners) return
|
|
23
|
+
headerInsets.delete(header)
|
|
24
|
+
if (header.iosIgnoreSafeArea === true) header.iosIgnoreSafeArea = state.previous
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function nativeCollectionMotion(
|
|
29
|
+
target: View,
|
|
30
|
+
resolve: (surface: MotionSurfaceAdapter) => View,
|
|
31
|
+
scope: MotionScope,
|
|
32
|
+
): Pick<MotionRegionAdapter, 'scrollHeader' | 'reorder'> {
|
|
33
|
+
return {
|
|
34
|
+
scrollHeader(source, options) {
|
|
35
|
+
const {
|
|
36
|
+
header,
|
|
37
|
+
artwork,
|
|
38
|
+
title,
|
|
39
|
+
toolbar,
|
|
40
|
+
toolbarTitle,
|
|
41
|
+
section,
|
|
42
|
+
items,
|
|
43
|
+
expanded,
|
|
44
|
+
minimum,
|
|
45
|
+
...rest
|
|
46
|
+
} = options
|
|
47
|
+
const headerView = resolve(header)
|
|
48
|
+
if (!(headerView instanceof LayoutBase))
|
|
49
|
+
throw new TypeError('Use a layout surface for the header.')
|
|
50
|
+
const artworkView = resolve(artwork)
|
|
51
|
+
// The moving header already sits inside MScreen's safe area. Reapplying
|
|
52
|
+
// UIKit's changing insets to its children would shift them during reflow.
|
|
53
|
+
const restoreHeader = retainHeaderLayout(headerView)
|
|
54
|
+
let headerControl: ReturnType<typeof scrollHeader>
|
|
55
|
+
try {
|
|
56
|
+
headerControl = scrollHeader(nativeScrollElement(source), {
|
|
57
|
+
...rest,
|
|
58
|
+
header: headerView,
|
|
59
|
+
artwork: artworkView,
|
|
60
|
+
title: resolve(title),
|
|
61
|
+
toolbar: resolve(toolbar),
|
|
62
|
+
toolbarTitle: resolve(toolbarTitle),
|
|
63
|
+
section: resolve(section),
|
|
64
|
+
expandedHeight: expanded,
|
|
65
|
+
minimumHeight: minimum,
|
|
66
|
+
items: () => mapMotionItems(items(), resolve),
|
|
67
|
+
})
|
|
68
|
+
} catch (error) {
|
|
69
|
+
restoreHeader()
|
|
70
|
+
throw error
|
|
71
|
+
}
|
|
72
|
+
const control = headerControl
|
|
73
|
+
let released = false
|
|
74
|
+
const lifetime = scope.add({
|
|
75
|
+
dispose() {
|
|
76
|
+
if (released) return
|
|
77
|
+
released = true
|
|
78
|
+
try {
|
|
79
|
+
control.dispose()
|
|
80
|
+
} finally {
|
|
81
|
+
restoreHeader()
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
})
|
|
85
|
+
return {
|
|
86
|
+
get ready() {
|
|
87
|
+
return control.ready
|
|
88
|
+
},
|
|
89
|
+
get state() {
|
|
90
|
+
return {
|
|
91
|
+
offset: control.state.offset,
|
|
92
|
+
refreshing: control.state.refresh === 'refreshing',
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
refresh: () => control.refresh(),
|
|
96
|
+
cancelRefresh: () => control.cancelRefresh(),
|
|
97
|
+
remeasure: () => control.remeasure(),
|
|
98
|
+
preserveAnchor: (change) => control.preserveAnchor(change),
|
|
99
|
+
scrollToItem(key, animated = true) {
|
|
100
|
+
const index = items().findIndex((item) => item.key === key)
|
|
101
|
+
if (index < 0) return false
|
|
102
|
+
control.scrollToItem(index, animated)
|
|
103
|
+
return true
|
|
104
|
+
},
|
|
105
|
+
scrollToTop: (animated = true) => control.scrollToTop(animated),
|
|
106
|
+
pause: () => control.pause(),
|
|
107
|
+
play: () => control.play(),
|
|
108
|
+
dispose: () => lifetime.dispose(),
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
reorder(options) {
|
|
112
|
+
const { container, items, scroll, accessibility, ...rest } = options
|
|
113
|
+
const layout = resolve(container)
|
|
114
|
+
if (!(layout instanceof LayoutBase))
|
|
115
|
+
throw new TypeError('Use a layout motion surface for retained rows.')
|
|
116
|
+
let control: Reorder<string> | undefined
|
|
117
|
+
let disposed = false,
|
|
118
|
+
paused = false,
|
|
119
|
+
queued = false
|
|
120
|
+
const attach = () => {
|
|
121
|
+
if (disposed || control) return
|
|
122
|
+
layout.off('layoutChanged', laidOut)
|
|
123
|
+
control = reorder(layout, {
|
|
124
|
+
...rest,
|
|
125
|
+
scroll: nativeScrollElement(scroll),
|
|
126
|
+
items: () => mapMotionItems(items(), resolve),
|
|
127
|
+
accessibility: { moveUp: accessibility?.moveUp, moveDown: accessibility?.moveDown },
|
|
128
|
+
})
|
|
129
|
+
if (paused) control.pause()
|
|
130
|
+
}
|
|
131
|
+
// `loaded` precedes native layout. Wait for that lifecycle boundary once;
|
|
132
|
+
// Jolt owns subsequent geometry updates, gestures and animation scheduling.
|
|
133
|
+
const laidOut = () => {
|
|
134
|
+
if (queued) return
|
|
135
|
+
queued = true
|
|
136
|
+
void Promise.resolve().then(attach)
|
|
137
|
+
}
|
|
138
|
+
if (layout.isLayoutValid && layout.getActualSize().height > 0) attach()
|
|
139
|
+
else layout.on('layoutChanged', laidOut)
|
|
140
|
+
return scope.add({
|
|
141
|
+
get activeKey() {
|
|
142
|
+
return control?.activeKey
|
|
143
|
+
},
|
|
144
|
+
move: (key: string, before: string | null) => control?.move(key, before) ?? false,
|
|
145
|
+
moveUp: (key: string) => control?.moveUp(key) ?? false,
|
|
146
|
+
moveDown: (key: string) => control?.moveDown(key) ?? false,
|
|
147
|
+
refresh: () => control?.refresh(),
|
|
148
|
+
cancel: () => control?.cancel(),
|
|
149
|
+
pause() {
|
|
150
|
+
paused = true
|
|
151
|
+
control?.pause()
|
|
152
|
+
},
|
|
153
|
+
play() {
|
|
154
|
+
paused = false
|
|
155
|
+
control?.play()
|
|
156
|
+
},
|
|
157
|
+
dispose() {
|
|
158
|
+
disposed = true
|
|
159
|
+
layout.off('layoutChanged', laidOut)
|
|
160
|
+
control?.dispose()
|
|
161
|
+
control = undefined
|
|
162
|
+
},
|
|
163
|
+
})
|
|
164
|
+
},
|
|
165
|
+
}
|
|
166
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { TextField } from '@nativescript/core'
|
|
2
|
+
declare const android: {
|
|
3
|
+
view: { inputmethod: { BaseInputConnection: { getComposingSpanStart(text: unknown): number } } }
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export function comboboxComposing(view: TextField | undefined): boolean {
|
|
7
|
+
return Boolean(
|
|
8
|
+
view?.android &&
|
|
9
|
+
android.view.inputmethod.BaseInputConnection.getComposingSpanStart(view.android.getText()) >= 0,
|
|
10
|
+
)
|
|
11
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import type { View } from '@nativescript/core'
|
|
2
|
+
|
|
3
|
+
declare const android: {
|
|
4
|
+
view: {
|
|
5
|
+
View: {
|
|
6
|
+
OnKeyListener: new (listener: {
|
|
7
|
+
onKey(
|
|
8
|
+
view: unknown,
|
|
9
|
+
key: number,
|
|
10
|
+
event: {
|
|
11
|
+
getAction(): number
|
|
12
|
+
getRepeatCount(): number
|
|
13
|
+
isCanceled(): boolean
|
|
14
|
+
},
|
|
15
|
+
): boolean
|
|
16
|
+
}) => unknown
|
|
17
|
+
OnFocusChangeListener: new (listener: {
|
|
18
|
+
onFocusChange(view: unknown, focused: boolean): void
|
|
19
|
+
}) => unknown
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** A composed surface keeps a single Android keyboard/accessibility action. */
|
|
25
|
+
export function observeComposedButton(
|
|
26
|
+
view: View,
|
|
27
|
+
focus: (focused: boolean) => void,
|
|
28
|
+
activate: () => void,
|
|
29
|
+
press: (pressed: boolean) => void,
|
|
30
|
+
) {
|
|
31
|
+
const button = view.android
|
|
32
|
+
let down = false
|
|
33
|
+
const cancel = () => {
|
|
34
|
+
if (down) press(false)
|
|
35
|
+
down = false
|
|
36
|
+
}
|
|
37
|
+
const keys = new android.view.View.OnKeyListener({
|
|
38
|
+
onKey(_view, key, event) {
|
|
39
|
+
if (![23, 62, 66].includes(key)) return false
|
|
40
|
+
if (!view.isEnabled) {
|
|
41
|
+
cancel()
|
|
42
|
+
return false
|
|
43
|
+
}
|
|
44
|
+
if (event.getAction() === 0) {
|
|
45
|
+
if (!event.getRepeatCount()) {
|
|
46
|
+
down = true
|
|
47
|
+
press(true)
|
|
48
|
+
}
|
|
49
|
+
} else if (event.getAction() === 1 && down) {
|
|
50
|
+
const accepted = !event.isCanceled()
|
|
51
|
+
cancel()
|
|
52
|
+
if (accepted) activate()
|
|
53
|
+
}
|
|
54
|
+
return true
|
|
55
|
+
},
|
|
56
|
+
})
|
|
57
|
+
const focused = new android.view.View.OnFocusChangeListener({
|
|
58
|
+
onFocusChange(_view, value) {
|
|
59
|
+
focus(value)
|
|
60
|
+
if (!value) cancel()
|
|
61
|
+
},
|
|
62
|
+
})
|
|
63
|
+
view.on('isEnabledChange', cancel)
|
|
64
|
+
button.setDescendantFocusability(393216) // FOCUS_BLOCK_DESCENDANTS
|
|
65
|
+
button.setFocusable(true)
|
|
66
|
+
button.setOnKeyListener(keys)
|
|
67
|
+
button.setOnFocusChangeListener(focused)
|
|
68
|
+
return () => {
|
|
69
|
+
cancel()
|
|
70
|
+
view.off('isEnabledChange', cancel)
|
|
71
|
+
button.setOnKeyListener(null)
|
|
72
|
+
if (button.getOnFocusChangeListener() === focused) button.setOnFocusChangeListener(null)
|
|
73
|
+
}
|
|
74
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import {
|
|
2
|
+
civilDate,
|
|
3
|
+
dateTimeMilliseconds,
|
|
4
|
+
resolveDateTimeOptions,
|
|
5
|
+
type DateTimeValue,
|
|
6
|
+
type DateTimeFormatOptions,
|
|
7
|
+
} from '@getcortexlabs/mavis-core'
|
|
8
|
+
export type { DateTimeValue, DateTimeFormatOptions, DateTimeStyle } from '@getcortexlabs/mavis-core'
|
|
9
|
+
|
|
10
|
+
interface Formatter {
|
|
11
|
+
setTimeZone(zone: unknown): void
|
|
12
|
+
setCalendar(calendar: unknown): void
|
|
13
|
+
format(date: unknown): string
|
|
14
|
+
}
|
|
15
|
+
declare const java: {
|
|
16
|
+
util: {
|
|
17
|
+
Date: new (milliseconds: number) => unknown
|
|
18
|
+
GregorianCalendar: new (
|
|
19
|
+
zone: unknown,
|
|
20
|
+
locale: unknown,
|
|
21
|
+
) => { setGregorianChange(date: unknown): void }
|
|
22
|
+
Locale: { forLanguageTag(locale: string): unknown; US: unknown }
|
|
23
|
+
TimeZone: { getAvailableIDs(): ArrayLike<string>; getTimeZone(id: string): unknown }
|
|
24
|
+
}
|
|
25
|
+
text: {
|
|
26
|
+
DateFormat: {
|
|
27
|
+
getDateTimeInstance(date: number, time: number, locale: unknown): Formatter
|
|
28
|
+
getDateInstance(date: number, locale: unknown): Formatter
|
|
29
|
+
getTimeInstance(time: number, locale: unknown): Formatter
|
|
30
|
+
}
|
|
31
|
+
SimpleDateFormat: new (pattern: string, locale: unknown) => Formatter
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
function zone(name: string) {
|
|
35
|
+
// TimeZone.getTimeZone silently returns GMT for unknown identifiers. Reject that fallback.
|
|
36
|
+
const known = Array.from(java.util.TimeZone.getAvailableIDs())
|
|
37
|
+
if (!known.includes(name)) throw new RangeError(`Unknown timeZone: ${name}`)
|
|
38
|
+
return java.util.TimeZone.getTimeZone(name)
|
|
39
|
+
}
|
|
40
|
+
function configureCalendar(formatter: Formatter, timeZone: string, locale: unknown) {
|
|
41
|
+
const value = zone(timeZone)
|
|
42
|
+
const calendar = new java.util.GregorianCalendar(value, locale)
|
|
43
|
+
calendar.setGregorianChange(new java.util.Date(-8640000000000000))
|
|
44
|
+
formatter.setCalendar(calendar)
|
|
45
|
+
}
|
|
46
|
+
export function formatDateTime(value: DateTimeValue, options: DateTimeFormatOptions): string {
|
|
47
|
+
const milliseconds = dateTimeMilliseconds(value)
|
|
48
|
+
const config = resolveDateTimeOptions(options)
|
|
49
|
+
const locale = java.util.Locale.forLanguageTag(config.locale)
|
|
50
|
+
const styles = { full: 0, long: 1, medium: 2, short: 3 }
|
|
51
|
+
const factory = java.text.DateFormat
|
|
52
|
+
const result =
|
|
53
|
+
config.dateStyle && config.timeStyle
|
|
54
|
+
? factory.getDateTimeInstance(styles[config.dateStyle], styles[config.timeStyle], locale)
|
|
55
|
+
: config.dateStyle
|
|
56
|
+
? factory.getDateInstance(styles[config.dateStyle], locale)
|
|
57
|
+
: factory.getTimeInstance(styles[config.timeStyle!], locale)
|
|
58
|
+
configureCalendar(result, config.timeZone, locale)
|
|
59
|
+
return String(result.format(new java.util.Date(milliseconds)))
|
|
60
|
+
}
|
|
61
|
+
export function dateTimeToCivilDate(
|
|
62
|
+
value: DateTimeValue,
|
|
63
|
+
options: Pick<DateTimeFormatOptions, 'timeZone'>,
|
|
64
|
+
) {
|
|
65
|
+
const milliseconds = dateTimeMilliseconds(value)
|
|
66
|
+
const { timeZone } = resolveDateTimeOptions(options)
|
|
67
|
+
const result = new java.text.SimpleDateFormat('G yyyy-MM-dd', java.util.Locale.US)
|
|
68
|
+
configureCalendar(result, timeZone, java.util.Locale.US)
|
|
69
|
+
const text = String(result.format(new java.util.Date(milliseconds)))
|
|
70
|
+
if (!text.startsWith('AD ')) throw new RangeError('Civil dates support years 0001–9999.')
|
|
71
|
+
return civilDate(text.slice(3))
|
|
72
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import {
|
|
2
|
+
civilDate,
|
|
3
|
+
dateTimeMilliseconds,
|
|
4
|
+
resolveDateTimeOptions,
|
|
5
|
+
type DateTimeValue,
|
|
6
|
+
type DateTimeFormatOptions,
|
|
7
|
+
} from '@getcortexlabs/mavis-core'
|
|
8
|
+
export type { DateTimeValue, DateTimeFormatOptions, DateTimeStyle } from '@getcortexlabs/mavis-core'
|
|
9
|
+
|
|
10
|
+
declare const NSDate: { dateWithTimeIntervalSince1970(seconds: number): unknown }
|
|
11
|
+
declare const NSTimeZone: { timeZoneWithName(name: string): unknown | null }
|
|
12
|
+
declare const NSLocale: { alloc(): { initWithLocaleIdentifier(locale: string): unknown } }
|
|
13
|
+
declare const NSCalendar: { calendarWithIdentifier(identifier: string): unknown }
|
|
14
|
+
interface Formatter {
|
|
15
|
+
locale: unknown
|
|
16
|
+
timeZone: unknown
|
|
17
|
+
calendar: unknown
|
|
18
|
+
dateStyle: number
|
|
19
|
+
timeStyle: number
|
|
20
|
+
dateFormat: string
|
|
21
|
+
gregorianStartDate: unknown
|
|
22
|
+
stringFromDate(value: unknown): string
|
|
23
|
+
}
|
|
24
|
+
declare const NSDateFormatter: { new: () => Formatter }
|
|
25
|
+
function formatter(options: DateTimeFormatOptions) {
|
|
26
|
+
const config = resolveDateTimeOptions(options)
|
|
27
|
+
const zone = NSTimeZone.timeZoneWithName(config.timeZone)
|
|
28
|
+
if (!zone) throw new RangeError(`Unknown timeZone: ${config.timeZone}`)
|
|
29
|
+
const result = NSDateFormatter.new()
|
|
30
|
+
result.locale = NSLocale.alloc().initWithLocaleIdentifier(config.locale)
|
|
31
|
+
result.calendar = NSCalendar.calendarWithIdentifier('gregorian')
|
|
32
|
+
result.gregorianStartDate = NSDate.dateWithTimeIntervalSince1970(-8640000000000)
|
|
33
|
+
result.timeZone = zone
|
|
34
|
+
const styles = { short: 1, medium: 2, long: 3, full: 4 }
|
|
35
|
+
result.dateStyle = config.dateStyle ? styles[config.dateStyle] : 0
|
|
36
|
+
result.timeStyle = config.timeStyle ? styles[config.timeStyle] : 0
|
|
37
|
+
return result
|
|
38
|
+
}
|
|
39
|
+
export function formatDateTime(value: DateTimeValue, options: DateTimeFormatOptions): string {
|
|
40
|
+
const instant = NSDate.dateWithTimeIntervalSince1970(dateTimeMilliseconds(value) / 1000)
|
|
41
|
+
return formatter(options).stringFromDate(instant)
|
|
42
|
+
}
|
|
43
|
+
export function dateTimeToCivilDate(
|
|
44
|
+
value: DateTimeValue,
|
|
45
|
+
options: Pick<DateTimeFormatOptions, 'timeZone'>,
|
|
46
|
+
) {
|
|
47
|
+
const result = formatter({ ...options, locale: 'en-US-POSIX', dateStyle: 'short' })
|
|
48
|
+
result.dateFormat = 'G yyyy-MM-dd'
|
|
49
|
+
const text = result.stringFromDate(
|
|
50
|
+
NSDate.dateWithTimeIntervalSince1970(dateTimeMilliseconds(value) / 1000),
|
|
51
|
+
)
|
|
52
|
+
if (!text.startsWith('AD ')) throw new RangeError('Civil dates support years 0001–9999.')
|
|
53
|
+
return civilDate(text.slice(3))
|
|
54
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { DateTimeValue, DateTimeFormatOptions, CivilDate } from '@getcortexlabs/mavis-core'
|
|
2
|
+
export type { DateTimeValue, DateTimeFormatOptions, DateTimeStyle } from '@getcortexlabs/mavis-core'
|
|
3
|
+
|
|
4
|
+
/** NativeScript resolves the .ios/.android implementation in a device bundle. */
|
|
5
|
+
export function formatDateTime(_value: DateTimeValue, _options: DateTimeFormatOptions): string {
|
|
6
|
+
throw new Error(
|
|
7
|
+
'Native date formatting requires an iOS or Android runtime. Use the Web formatter on the server.',
|
|
8
|
+
)
|
|
9
|
+
}
|
|
10
|
+
export function dateTimeToCivilDate(
|
|
11
|
+
_value: DateTimeValue,
|
|
12
|
+
_options: Pick<DateTimeFormatOptions, 'timeZone'>,
|
|
13
|
+
): CivilDate {
|
|
14
|
+
throw new Error(
|
|
15
|
+
'Native date formatting requires an iOS or Android runtime. Use the Web formatter on the server.',
|
|
16
|
+
)
|
|
17
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { View } from '@nativescript/core'
|
|
2
|
+
export interface DialogFocusViews {
|
|
3
|
+
panel: View
|
|
4
|
+
title: View
|
|
5
|
+
cancel: View
|
|
6
|
+
confirm: View
|
|
7
|
+
}
|
|
8
|
+
declare const android: {
|
|
9
|
+
view: {
|
|
10
|
+
View: {
|
|
11
|
+
OnKeyListener: new (handler: {
|
|
12
|
+
onKey(
|
|
13
|
+
view: unknown,
|
|
14
|
+
code: number,
|
|
15
|
+
event: { getAction(): number; isShiftPressed(): boolean },
|
|
16
|
+
): boolean
|
|
17
|
+
}) => unknown
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
export function bindDialogFocus(views: DialogFocusViews, escape: () => void) {
|
|
22
|
+
const panel = views.panel.android
|
|
23
|
+
const cancel = views.cancel.android
|
|
24
|
+
const confirm = views.confirm.android
|
|
25
|
+
const previous = panel.getRootView().findFocus()
|
|
26
|
+
let busy = false
|
|
27
|
+
// Touch-focusable buttons consume their first tap to focus instead of clicking.
|
|
28
|
+
// Only the busy panel needs that behavior; buttons retain Android's defaults.
|
|
29
|
+
panel.setFocusableInTouchMode(true)
|
|
30
|
+
const listener = new android.view.View.OnKeyListener({
|
|
31
|
+
onKey(view, code, event) {
|
|
32
|
+
if (event.getAction() !== 0) return false
|
|
33
|
+
if (code === 111) {
|
|
34
|
+
escape()
|
|
35
|
+
return true
|
|
36
|
+
}
|
|
37
|
+
if (code !== 61) return false
|
|
38
|
+
if (busy) panel.requestFocus()
|
|
39
|
+
else if (view === cancel) confirm.requestFocus()
|
|
40
|
+
else if (view === confirm) cancel.requestFocus()
|
|
41
|
+
else (event.isShiftPressed() ? confirm : cancel).requestFocus()
|
|
42
|
+
return true
|
|
43
|
+
},
|
|
44
|
+
})
|
|
45
|
+
for (const view of [panel, cancel, confirm]) view.setOnKeyListener(listener)
|
|
46
|
+
return {
|
|
47
|
+
update(loading: boolean) {
|
|
48
|
+
busy = loading
|
|
49
|
+
;(loading ? panel : cancel).requestFocus()
|
|
50
|
+
},
|
|
51
|
+
dispose(restore: boolean) {
|
|
52
|
+
for (const view of [panel, cancel, confirm]) view.setOnKeyListener(null)
|
|
53
|
+
if (restore && previous?.isAttachedToWindow()) previous.requestFocus()
|
|
54
|
+
},
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { View } from '@nativescript/core'
|
|
2
|
+
import { notifyAccessibilityLayout } from './accessibility-layout'
|
|
3
|
+
export interface DialogFocusViews {
|
|
4
|
+
panel: View
|
|
5
|
+
title: View
|
|
6
|
+
cancel: View
|
|
7
|
+
confirm: View
|
|
8
|
+
}
|
|
9
|
+
declare function UIAccessibilityFocusedElement(technology: string): unknown
|
|
10
|
+
declare const UIAccessibilityNotificationVoiceOverIdentifier: string
|
|
11
|
+
declare const UIAccessibilityLayoutChangedNotification: number
|
|
12
|
+
declare function UIAccessibilityPostNotification(notification: number, argument: unknown): void
|
|
13
|
+
export function bindDialogFocus(views: DialogFocusViews, _escape: () => void) {
|
|
14
|
+
const previous = UIAccessibilityFocusedElement(UIAccessibilityNotificationVoiceOverIdentifier)
|
|
15
|
+
notifyAccessibilityLayout(views.title)
|
|
16
|
+
return {
|
|
17
|
+
update(_loading: boolean) {},
|
|
18
|
+
dispose(restore: boolean) {
|
|
19
|
+
if (restore && previous)
|
|
20
|
+
UIAccessibilityPostNotification(UIAccessibilityLayoutChangedNotification, previous)
|
|
21
|
+
},
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { View } from '@nativescript/core'
|
|
2
|
+
export interface DialogFocusViews {
|
|
3
|
+
panel: View
|
|
4
|
+
title: View
|
|
5
|
+
cancel: View
|
|
6
|
+
confirm: View
|
|
7
|
+
}
|
|
8
|
+
export function bindDialogFocus(_views: DialogFocusViews, _escape: () => void) {
|
|
9
|
+
return { update(_loading: boolean) {}, dispose(_restore: boolean) {} }
|
|
10
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { Font, type TextBase } from '@nativescript/core'
|
|
2
|
+
import type { TextVariant } from '@getcortexlabs/mavis-core'
|
|
3
|
+
|
|
4
|
+
interface Metrics {
|
|
5
|
+
scaledValueForValueCompatibleWithTraitCollection(value: number, traits: unknown): number
|
|
6
|
+
}
|
|
7
|
+
declare const UIApplication: { sharedApplication: { preferredContentSizeCategory: string } }
|
|
8
|
+
declare const UITraitCollection: {
|
|
9
|
+
traitCollectionWithPreferredContentSizeCategory(category: string): unknown
|
|
10
|
+
}
|
|
11
|
+
declare const UIFontMetrics: { metricsForTextStyle(style: string): Metrics }
|
|
12
|
+
declare const UIButton: unknown
|
|
13
|
+
declare const UIFontTextStyleLargeTitle: string
|
|
14
|
+
declare const UIFontTextStyleTitle1: string
|
|
15
|
+
declare const UIFontTextStyleTitle3: string
|
|
16
|
+
declare const UIFontTextStyleBody: string
|
|
17
|
+
declare const UIFontTextStyleFootnote: string
|
|
18
|
+
declare const UIFontTextStyleCaption2: string
|
|
19
|
+
|
|
20
|
+
export interface DynamicTypeView extends TextBase {
|
|
21
|
+
dynamicTypeStyle?: TextVariant
|
|
22
|
+
}
|
|
23
|
+
interface NativeText {
|
|
24
|
+
font: { pointSize: number }
|
|
25
|
+
titleLabel?: { font: { pointSize: number } }
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// The iOS text style whose default size is closest to each Mavis variant.
|
|
29
|
+
const textStyle = (variant: TextVariant) =>
|
|
30
|
+
({
|
|
31
|
+
display: UIFontTextStyleLargeTitle,
|
|
32
|
+
title: UIFontTextStyleTitle1,
|
|
33
|
+
heading: UIFontTextStyleTitle3,
|
|
34
|
+
body: UIFontTextStyleBody,
|
|
35
|
+
caption: UIFontTextStyleFootnote,
|
|
36
|
+
overline: UIFontTextStyleCaption2,
|
|
37
|
+
})[variant]
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* The ratio iOS applies to a font of `size` points in the view's text style at the current
|
|
41
|
+
* content size category. Core maps the categories to its own table, which halves text at the
|
|
42
|
+
* smallest size and snaps any other value back to it, so Mavis reads the system's Dynamic Type
|
|
43
|
+
* curve instead. The curve is not linear since iOS 17, so the ratio depends on the size.
|
|
44
|
+
*/
|
|
45
|
+
export function dynamicTypeScale(view: DynamicTypeView, size: number): number {
|
|
46
|
+
if (!view.iosAccessibilityAdjustsFontSize || !(size > 0)) return 1
|
|
47
|
+
const category = UIApplication.sharedApplication.preferredContentSizeCategory
|
|
48
|
+
const traits = UITraitCollection.traitCollectionWithPreferredContentSizeCategory(category)
|
|
49
|
+
const metrics = UIFontMetrics.metricsForTextStyle(textStyle(view.dynamicTypeStyle ?? 'body'))
|
|
50
|
+
let scale = metrics.scaledValueForValueCompatibleWithTraitCollection(size, traits) / size
|
|
51
|
+
const { iosAccessibilityMinFontScale: min, iosAccessibilityMaxFontScale: max } = view
|
|
52
|
+
if (min && min > scale) scale = min
|
|
53
|
+
if (max && max < scale) scale = max
|
|
54
|
+
return scale
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** Core's font scale setter with the system ratio in place of Core's table. */
|
|
58
|
+
export function applyDynamicType(view: DynamicTypeView) {
|
|
59
|
+
const native = view.nativeTextViewProtected as NativeText | undefined
|
|
60
|
+
if (!native) return
|
|
61
|
+
const label =
|
|
62
|
+
native instanceof (UIButton as never) && native.titleLabel ? native.titleLabel : native
|
|
63
|
+
const font = view.style.fontInternal || Font.default.withFontSize(label.font.pointSize)
|
|
64
|
+
const scale = dynamicTypeScale(view, font.fontSize)
|
|
65
|
+
if (font.fontScale !== scale) {
|
|
66
|
+
view.style.fontInternal = font.withFontScale(scale)
|
|
67
|
+
view.requestLayout()
|
|
68
|
+
} else if (!view.style.fontInternal) {
|
|
69
|
+
view.style.fontInternal = font
|
|
70
|
+
}
|
|
71
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import type { FileHandle } from '@getcortexlabs/mavis-core'
|
|
2
|
+
|
|
3
|
+
export interface NativeFileReadHandle {
|
|
4
|
+
/** Android java.io.InputStream or an opened iOS NSInputStream. */
|
|
5
|
+
readonly native: unknown
|
|
6
|
+
close(): void
|
|
7
|
+
}
|
|
8
|
+
export interface NativeFileAccess {
|
|
9
|
+
readonly platform: 'android' | 'ios'
|
|
10
|
+
/** Android content Uri or iOS NSURL. Never a portable filesystem path. */
|
|
11
|
+
readonly native: unknown
|
|
12
|
+
/** Close after use. Removing/disposal also closes streams still owned by this handle. */
|
|
13
|
+
openRead(): NativeFileReadHandle
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const handles = new WeakMap<FileHandle, NativeFileAccess>()
|
|
17
|
+
|
|
18
|
+
export function getNativeFile(handle: FileHandle): NativeFileAccess {
|
|
19
|
+
const access = handles.get(handle)
|
|
20
|
+
if (!access) throw new Error('This native file handle is unavailable or has been released')
|
|
21
|
+
return access
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** @internal Platform adapters register a resource without exposing it in item metadata. */
|
|
25
|
+
export function ownNativeFile(
|
|
26
|
+
platform: NativeFileAccess['platform'],
|
|
27
|
+
native: unknown,
|
|
28
|
+
open: () => { native: unknown; close(): void },
|
|
29
|
+
cleanup: () => void,
|
|
30
|
+
) {
|
|
31
|
+
const handle = Object.freeze({}) as FileHandle
|
|
32
|
+
const readers = new Set<NativeFileReadHandle>()
|
|
33
|
+
let released = false
|
|
34
|
+
const access: NativeFileAccess = {
|
|
35
|
+
platform,
|
|
36
|
+
native,
|
|
37
|
+
openRead() {
|
|
38
|
+
if (released) throw new Error('This native file has been released')
|
|
39
|
+
const reader = open()
|
|
40
|
+
let closed = false
|
|
41
|
+
const owned = {
|
|
42
|
+
native: reader.native,
|
|
43
|
+
close() {
|
|
44
|
+
if (closed) return
|
|
45
|
+
closed = true
|
|
46
|
+
readers.delete(owned)
|
|
47
|
+
reader.close()
|
|
48
|
+
},
|
|
49
|
+
}
|
|
50
|
+
readers.add(owned)
|
|
51
|
+
return owned
|
|
52
|
+
},
|
|
53
|
+
}
|
|
54
|
+
handles.set(handle, access)
|
|
55
|
+
return {
|
|
56
|
+
handle,
|
|
57
|
+
release() {
|
|
58
|
+
if (released) return
|
|
59
|
+
released = true
|
|
60
|
+
handles.delete(handle)
|
|
61
|
+
for (const reader of readers) {
|
|
62
|
+
try {
|
|
63
|
+
reader.close()
|
|
64
|
+
} catch {
|
|
65
|
+
/* continue cleanup */
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
cleanup()
|
|
69
|
+
},
|
|
70
|
+
}
|
|
71
|
+
}
|