@momo-framework/ui 0.0.0-stage → 0.16.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.
- package/LICENSE +661 -0
- package/README.hy.md +143 -0
- package/README.md +142 -2
- package/README.ru.md +143 -0
- package/bin/momo-ui-skills.mjs +25 -0
- package/dist/components/Accordion.d.ts +2 -0
- package/dist/components/Accordion.js +6 -0
- package/dist/components/Accordion.js.map +1 -0
- package/dist/components/Accordion.vue.d.ts +45 -0
- package/dist/components/Accordion.vue_vue_type_script_setup_true_lang.js +91 -0
- package/dist/components/Accordion.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/Alert.d.ts +2 -0
- package/dist/components/Alert.js +6 -0
- package/dist/components/Alert.js.map +1 -0
- package/dist/components/Alert.vue.d.ts +29 -0
- package/dist/components/Alert.vue_vue_type_script_setup_true_lang.js +53 -0
- package/dist/components/Alert.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/AppShell.d.ts +2 -0
- package/dist/components/AppShell.js +6 -0
- package/dist/components/AppShell.js.map +1 -0
- package/dist/components/AppShell.vue.d.ts +70 -0
- package/dist/components/AppShell.vue_vue_type_script_setup_true_lang.js +370 -0
- package/dist/components/AppShell.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/AspectRatio.d.ts +2 -0
- package/dist/components/AspectRatio.js +6 -0
- package/dist/components/AspectRatio.js.map +1 -0
- package/dist/components/AspectRatio.vue.d.ts +22 -0
- package/dist/components/AspectRatio.vue_vue_type_script_setup_true_lang.js +24 -0
- package/dist/components/AspectRatio.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/Avatar.d.ts +2 -0
- package/dist/components/Avatar.js +6 -0
- package/dist/components/Avatar.js.map +1 -0
- package/dist/components/Avatar.vue.d.ts +14 -0
- package/dist/components/Avatar.vue_vue_type_script_setup_true_lang.js +37 -0
- package/dist/components/Avatar.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/Badge.d.ts +2 -0
- package/dist/components/Badge.js +6 -0
- package/dist/components/Badge.js.map +1 -0
- package/dist/components/Badge.vue.d.ts +27 -0
- package/dist/components/Badge.vue_vue_type_script_setup_true_lang.js +25 -0
- package/dist/components/Badge.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/Breadcrumbs.d.ts +2 -0
- package/dist/components/Breadcrumbs.js +6 -0
- package/dist/components/Breadcrumbs.js.map +1 -0
- package/dist/components/Breadcrumbs.vue.d.ts +14 -0
- package/dist/components/Breadcrumbs.vue_vue_type_script_setup_true_lang.js +50 -0
- package/dist/components/Breadcrumbs.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/Button.d.ts +2 -0
- package/dist/components/Button.js +6 -0
- package/dist/components/Button.js.map +1 -0
- package/dist/components/Button.vue.d.ts +36 -0
- package/dist/components/Button.vue_vue_type_script_setup_true_lang.js +78 -0
- package/dist/components/Button.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/ButtonGroup.d.ts +2 -0
- package/dist/components/ButtonGroup.js +6 -0
- package/dist/components/ButtonGroup.js.map +1 -0
- package/dist/components/ButtonGroup.vue.d.ts +29 -0
- package/dist/components/ButtonGroup.vue_vue_type_script_setup_true_lang.js +46 -0
- package/dist/components/ButtonGroup.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/Calendar.d.ts +2 -0
- package/dist/components/Calendar.js +6 -0
- package/dist/components/Calendar.js.map +1 -0
- package/dist/components/Calendar.vue.d.ts +30 -0
- package/dist/components/Calendar.vue_vue_type_script_setup_true_lang.js +309 -0
- package/dist/components/Calendar.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/Card.d.ts +2 -0
- package/dist/components/Card.js +6 -0
- package/dist/components/Card.js.map +1 -0
- package/dist/components/Card.vue.d.ts +36 -0
- package/dist/components/Card.vue_vue_type_script_setup_true_lang.js +54 -0
- package/dist/components/Card.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/Carousel.d.ts +2 -0
- package/dist/components/Carousel.js +6 -0
- package/dist/components/Carousel.js.map +1 -0
- package/dist/components/Carousel.vue.d.ts +37 -0
- package/dist/components/Carousel.vue_vue_type_script_setup_true_lang.js +146 -0
- package/dist/components/Carousel.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/Checkbox.d.ts +2 -0
- package/dist/components/Checkbox.js +6 -0
- package/dist/components/Checkbox.js.map +1 -0
- package/dist/components/Checkbox.vue.d.ts +42 -0
- package/dist/components/Checkbox.vue_vue_type_script_setup_true_lang.js +99 -0
- package/dist/components/Checkbox.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/Clock.d.ts +2 -0
- package/dist/components/Clock.js +6 -0
- package/dist/components/Clock.js.map +1 -0
- package/dist/components/Clock.vue.d.ts +34 -0
- package/dist/components/Clock.vue_vue_type_script_setup_true_lang.js +330 -0
- package/dist/components/Clock.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/Collapsible.d.ts +2 -0
- package/dist/components/Collapsible.js +6 -0
- package/dist/components/Collapsible.js.map +1 -0
- package/dist/components/Collapsible.vue.d.ts +33 -0
- package/dist/components/Collapsible.vue_vue_type_script_setup_true_lang.js +69 -0
- package/dist/components/Collapsible.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/ColorPicker.d.ts +2 -0
- package/dist/components/ColorPicker.js +6 -0
- package/dist/components/ColorPicker.js.map +1 -0
- package/dist/components/ColorPicker.vue.d.ts +29 -0
- package/dist/components/ColorPicker.vue_vue_type_script_setup_true_lang.js +125 -0
- package/dist/components/ColorPicker.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/Combobox.d.ts +2 -0
- package/dist/components/Combobox.js +6 -0
- package/dist/components/Combobox.js.map +1 -0
- package/dist/components/Combobox.vue.d.ts +55 -0
- package/dist/components/Combobox.vue_vue_type_script_setup_true_lang.js +247 -0
- package/dist/components/Combobox.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/CommandPalette.d.ts +2 -0
- package/dist/components/CommandPalette.js +6 -0
- package/dist/components/CommandPalette.js.map +1 -0
- package/dist/components/CommandPalette.vue.d.ts +31 -0
- package/dist/components/CommandPalette.vue_vue_type_script_setup_true_lang.js +193 -0
- package/dist/components/CommandPalette.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/ConfirmDialog.d.ts +2 -0
- package/dist/components/ConfirmDialog.js +6 -0
- package/dist/components/ConfirmDialog.js.map +1 -0
- package/dist/components/ConfirmDialog.vue.d.ts +6 -0
- package/dist/components/ConfirmDialog.vue_vue_type_script_setup_true_lang.js +65 -0
- package/dist/components/ConfirmDialog.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/Container.d.ts +2 -0
- package/dist/components/Container.js +6 -0
- package/dist/components/Container.js.map +1 -0
- package/dist/components/Container.vue.d.ts +27 -0
- package/dist/components/Container.vue_vue_type_script_setup_true_lang.js +41 -0
- package/dist/components/Container.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/ConversationItem.d.ts +2 -0
- package/dist/components/ConversationItem.js +6 -0
- package/dist/components/ConversationItem.js.map +1 -0
- package/dist/components/ConversationItem.vue.d.ts +40 -0
- package/dist/components/ConversationItem.vue_vue_type_script_setup_true_lang.js +71 -0
- package/dist/components/ConversationItem.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/DataTable.d.ts +2 -0
- package/dist/components/DataTable.js +6 -0
- package/dist/components/DataTable.js.map +1 -0
- package/dist/components/DataTable.vue.d.ts +67 -0
- package/dist/components/DataTable.vue_vue_type_script_setup_true_lang.js +412 -0
- package/dist/components/DataTable.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/DateDivider.d.ts +2 -0
- package/dist/components/DateDivider.js +6 -0
- package/dist/components/DateDivider.js.map +1 -0
- package/dist/components/DateDivider.vue.d.ts +14 -0
- package/dist/components/DateDivider.vue_vue_type_script_setup_true_lang.js +27 -0
- package/dist/components/DateDivider.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/DatePicker.d.ts +2 -0
- package/dist/components/DatePicker.js +6 -0
- package/dist/components/DatePicker.js.map +1 -0
- package/dist/components/DatePicker.vue.d.ts +39 -0
- package/dist/components/DatePicker.vue_vue_type_script_setup_true_lang.js +166 -0
- package/dist/components/DatePicker.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/Defaults.d.ts +2 -0
- package/dist/components/Defaults.js +6 -0
- package/dist/components/Defaults.js.map +1 -0
- package/dist/components/Defaults.vue.d.ts +16 -0
- package/dist/components/Defaults.vue_vue_type_script_setup_true_lang.js +17 -0
- package/dist/components/Defaults.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/DescriptionList.d.ts +2 -0
- package/dist/components/DescriptionList.js +6 -0
- package/dist/components/DescriptionList.js.map +1 -0
- package/dist/components/DescriptionList.vue.d.ts +32 -0
- package/dist/components/DescriptionList.vue_vue_type_script_setup_true_lang.js +33 -0
- package/dist/components/DescriptionList.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/Dialog.d.ts +2 -0
- package/dist/components/Dialog.js +6 -0
- package/dist/components/Dialog.js.map +1 -0
- package/dist/components/Dialog.vue.d.ts +44 -0
- package/dist/components/Dialog.vue_vue_type_script_setup_true_lang.js +119 -0
- package/dist/components/Dialog.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/Divider.d.ts +2 -0
- package/dist/components/Divider.js +6 -0
- package/dist/components/Divider.js.map +1 -0
- package/dist/components/Divider.vue.d.ts +22 -0
- package/dist/components/Divider.vue_vue_type_script_setup_true_lang.js +29 -0
- package/dist/components/Divider.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/EmptyState.d.ts +2 -0
- package/dist/components/EmptyState.js +6 -0
- package/dist/components/EmptyState.js.map +1 -0
- package/dist/components/EmptyState.vue.d.ts +20 -0
- package/dist/components/EmptyState.vue_vue_type_script_setup_true_lang.js +31 -0
- package/dist/components/EmptyState.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/Field.d.ts +2 -0
- package/dist/components/Field.js +6 -0
- package/dist/components/Field.js.map +1 -0
- package/dist/components/Field.vue.d.ts +32 -0
- package/dist/components/Field.vue_vue_type_script_setup_true_lang.js +71 -0
- package/dist/components/Field.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/FileUpload.d.ts +2 -0
- package/dist/components/FileUpload.js +6 -0
- package/dist/components/FileUpload.js.map +1 -0
- package/dist/components/FileUpload.vue.d.ts +35 -0
- package/dist/components/FileUpload.vue_vue_type_script_setup_true_lang.js +150 -0
- package/dist/components/FileUpload.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/FullscreenButton.d.ts +2 -0
- package/dist/components/FullscreenButton.js +6 -0
- package/dist/components/FullscreenButton.js.map +1 -0
- package/dist/components/FullscreenButton.vue.d.ts +13 -0
- package/dist/components/FullscreenButton.vue_vue_type_script_setup_true_lang.js +48 -0
- package/dist/components/FullscreenButton.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/Glyph.d.ts +2 -0
- package/dist/components/Glyph.js +6 -0
- package/dist/components/Glyph.js.map +1 -0
- package/dist/components/Glyph.vue.d.ts +7 -0
- package/dist/components/Glyph.vue_vue_type_script_setup_true_lang.js +25 -0
- package/dist/components/Glyph.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/Grid.d.ts +2 -0
- package/dist/components/Grid.js +6 -0
- package/dist/components/Grid.js.map +1 -0
- package/dist/components/Grid.vue.d.ts +33 -0
- package/dist/components/Grid.vue_vue_type_script_setup_true_lang.js +54 -0
- package/dist/components/Grid.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/Icon.d.ts +2 -0
- package/dist/components/Icon.js +6 -0
- package/dist/components/Icon.js.map +1 -0
- package/dist/components/Icon.vue.d.ts +9 -0
- package/dist/components/Icon.vue_vue_type_script_setup_true_lang.js +68 -0
- package/dist/components/Icon.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/Input.d.ts +2 -0
- package/dist/components/Input.js +6 -0
- package/dist/components/Input.js.map +1 -0
- package/dist/components/Input.vue.d.ts +43 -0
- package/dist/components/Input.vue_vue_type_script_setup_true_lang.js +96 -0
- package/dist/components/Input.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/Kbd.d.ts +2 -0
- package/dist/components/Kbd.js +6 -0
- package/dist/components/Kbd.js.map +1 -0
- package/dist/components/Kbd.vue.d.ts +18 -0
- package/dist/components/Kbd.vue_vue_type_script_setup_true_lang.js +22 -0
- package/dist/components/Kbd.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/List.d.ts +2 -0
- package/dist/components/List.js +6 -0
- package/dist/components/List.js.map +1 -0
- package/dist/components/List.vue.d.ts +41 -0
- package/dist/components/List.vue_vue_type_script_setup_true_lang.js +40 -0
- package/dist/components/List.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/LocaleSwitcher.d.ts +2 -0
- package/dist/components/LocaleSwitcher.js +6 -0
- package/dist/components/LocaleSwitcher.js.map +1 -0
- package/dist/components/LocaleSwitcher.vue.d.ts +20 -0
- package/dist/components/LocaleSwitcher.vue_vue_type_script_setup_true_lang.js +94 -0
- package/dist/components/LocaleSwitcher.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/Menu.d.ts +2 -0
- package/dist/components/Menu.js +6 -0
- package/dist/components/Menu.js.map +1 -0
- package/dist/components/Menu.vue.d.ts +40 -0
- package/dist/components/Menu.vue_vue_type_script_setup_true_lang.js +188 -0
- package/dist/components/Menu.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/Message.d.ts +2 -0
- package/dist/components/Message.js +6 -0
- package/dist/components/Message.js.map +1 -0
- package/dist/components/Message.vue.d.ts +23 -0
- package/dist/components/Message.vue_vue_type_script_setup_true_lang.js +28 -0
- package/dist/components/Message.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/MessageGroup.d.ts +2 -0
- package/dist/components/MessageGroup.js +6 -0
- package/dist/components/MessageGroup.js.map +1 -0
- package/dist/components/MessageGroup.vue.d.ts +28 -0
- package/dist/components/MessageGroup.vue_vue_type_script_setup_true_lang.js +25 -0
- package/dist/components/MessageGroup.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/NavList.d.ts +2 -0
- package/dist/components/NavList.js +6 -0
- package/dist/components/NavList.js.map +1 -0
- package/dist/components/NavList.vue.d.ts +46 -0
- package/dist/components/NavList.vue_vue_type_script_setup_true_lang.js +381 -0
- package/dist/components/NavList.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/NavigationSwitcher.d.ts +2 -0
- package/dist/components/NavigationSwitcher.js +6 -0
- package/dist/components/NavigationSwitcher.js.map +1 -0
- package/dist/components/NavigationSwitcher.vue.d.ts +26 -0
- package/dist/components/NavigationSwitcher.vue_vue_type_script_setup_true_lang.js +108 -0
- package/dist/components/NavigationSwitcher.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/NumberInput.d.ts +2 -0
- package/dist/components/NumberInput.js +6 -0
- package/dist/components/NumberInput.js.map +1 -0
- package/dist/components/NumberInput.vue.d.ts +38 -0
- package/dist/components/NumberInput.vue_vue_type_script_setup_true_lang.js +184 -0
- package/dist/components/NumberInput.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/OverlayTransition.d.ts +2 -0
- package/dist/components/OverlayTransition.js +6 -0
- package/dist/components/OverlayTransition.js.map +1 -0
- package/dist/components/OverlayTransition.vue.d.ts +19 -0
- package/dist/components/OverlayTransition.vue_vue_type_script_setup_true_lang.js +43 -0
- package/dist/components/OverlayTransition.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/Pagination.d.ts +2 -0
- package/dist/components/Pagination.js +6 -0
- package/dist/components/Pagination.js.map +1 -0
- package/dist/components/Pagination.vue.d.ts +22 -0
- package/dist/components/Pagination.vue_vue_type_script_setup_true_lang.js +87 -0
- package/dist/components/Pagination.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/Panel.d.ts +2 -0
- package/dist/components/Panel.js +6 -0
- package/dist/components/Panel.js.map +1 -0
- package/dist/components/Panel.vue.d.ts +29 -0
- package/dist/components/Panel.vue_vue_type_script_setup_true_lang.js +36 -0
- package/dist/components/Panel.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/PasswordInput.d.ts +2 -0
- package/dist/components/PasswordInput.js +6 -0
- package/dist/components/PasswordInput.js.map +1 -0
- package/dist/components/PasswordInput.vue.d.ts +48 -0
- package/dist/components/PasswordInput.vue_vue_type_script_setup_true_lang.js +206 -0
- package/dist/components/PasswordInput.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/PinInput.d.ts +2 -0
- package/dist/components/PinInput.js +6 -0
- package/dist/components/PinInput.js.map +1 -0
- package/dist/components/PinInput.vue.d.ts +33 -0
- package/dist/components/PinInput.vue_vue_type_script_setup_true_lang.js +145 -0
- package/dist/components/PinInput.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/Popover.d.ts +2 -0
- package/dist/components/Popover.js +6 -0
- package/dist/components/Popover.js.map +1 -0
- package/dist/components/Popover.vue.d.ts +37 -0
- package/dist/components/Popover.vue_vue_type_script_setup_true_lang.js +92 -0
- package/dist/components/Popover.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/Progress.d.ts +2 -0
- package/dist/components/Progress.js +6 -0
- package/dist/components/Progress.js.map +1 -0
- package/dist/components/Progress.vue.d.ts +20 -0
- package/dist/components/Progress.vue_vue_type_script_setup_true_lang.js +46 -0
- package/dist/components/Progress.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/QrCode.d.ts +2 -0
- package/dist/components/QrCode.js +6 -0
- package/dist/components/QrCode.js.map +1 -0
- package/dist/components/QrCode.vue.d.ts +15 -0
- package/dist/components/QrCode.vue_vue_type_script_setup_true_lang.js +57 -0
- package/dist/components/QrCode.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/RadioGroup.d.ts +2 -0
- package/dist/components/RadioGroup.js +6 -0
- package/dist/components/RadioGroup.js.map +1 -0
- package/dist/components/RadioGroup.vue.d.ts +47 -0
- package/dist/components/RadioGroup.vue_vue_type_script_setup_true_lang.js +99 -0
- package/dist/components/RadioGroup.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/Rating.d.ts +2 -0
- package/dist/components/Rating.js +6 -0
- package/dist/components/Rating.js.map +1 -0
- package/dist/components/Rating.vue.d.ts +29 -0
- package/dist/components/Rating.vue_vue_type_script_setup_true_lang.js +103 -0
- package/dist/components/Rating.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/ScrollArea.d.ts +2 -0
- package/dist/components/ScrollArea.js +6 -0
- package/dist/components/ScrollArea.js.map +1 -0
- package/dist/components/ScrollArea.vue.d.ts +26 -0
- package/dist/components/ScrollArea.vue_vue_type_script_setup_true_lang.js +71 -0
- package/dist/components/ScrollArea.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/SegmentedControl.d.ts +2 -0
- package/dist/components/SegmentedControl.js +6 -0
- package/dist/components/SegmentedControl.js.map +1 -0
- package/dist/components/SegmentedControl.vue.d.ts +41 -0
- package/dist/components/SegmentedControl.vue_vue_type_script_setup_true_lang.js +107 -0
- package/dist/components/SegmentedControl.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/Select.d.ts +2 -0
- package/dist/components/Select.js +6 -0
- package/dist/components/Select.js.map +1 -0
- package/dist/components/Select.vue.d.ts +64 -0
- package/dist/components/Select.vue_vue_type_script_setup_true_lang.js +364 -0
- package/dist/components/Select.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/SelectionBar.d.ts +2 -0
- package/dist/components/SelectionBar.js +6 -0
- package/dist/components/SelectionBar.js.map +1 -0
- package/dist/components/SelectionBar.vue.d.ts +27 -0
- package/dist/components/SelectionBar.vue_vue_type_script_setup_true_lang.js +59 -0
- package/dist/components/SelectionBar.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/Skeleton.d.ts +2 -0
- package/dist/components/Skeleton.js +6 -0
- package/dist/components/Skeleton.js.map +1 -0
- package/dist/components/Skeleton.vue.d.ts +14 -0
- package/dist/components/Skeleton.vue_vue_type_script_setup_true_lang.js +31 -0
- package/dist/components/Skeleton.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/Slider.d.ts +2 -0
- package/dist/components/Slider.js +6 -0
- package/dist/components/Slider.js.map +1 -0
- package/dist/components/Slider.vue.d.ts +30 -0
- package/dist/components/Slider.vue_vue_type_script_setup_true_lang.js +90 -0
- package/dist/components/Slider.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/Spacer.d.ts +2 -0
- package/dist/components/Spacer.js +6 -0
- package/dist/components/Spacer.js.map +1 -0
- package/dist/components/Spacer.vue.d.ts +8 -0
- package/dist/components/Spacer.vue_vue_type_script_setup_true_lang.js +19 -0
- package/dist/components/Spacer.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/Spinner.d.ts +2 -0
- package/dist/components/Spinner.js +6 -0
- package/dist/components/Spinner.js.map +1 -0
- package/dist/components/Spinner.vue.d.ts +11 -0
- package/dist/components/Spinner.vue_vue_type_script_setup_true_lang.js +43 -0
- package/dist/components/Spinner.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/Split.d.ts +2 -0
- package/dist/components/Split.js +6 -0
- package/dist/components/Split.js.map +1 -0
- package/dist/components/Split.vue.d.ts +36 -0
- package/dist/components/Split.vue_vue_type_script_setup_true_lang.js +60 -0
- package/dist/components/Split.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/Stack.d.ts +2 -0
- package/dist/components/Stack.js +6 -0
- package/dist/components/Stack.js.map +1 -0
- package/dist/components/Stack.vue.d.ts +35 -0
- package/dist/components/Stack.vue_vue_type_script_setup_true_lang.js +59 -0
- package/dist/components/Stack.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/Stat.d.ts +2 -0
- package/dist/components/Stat.js +6 -0
- package/dist/components/Stat.js.map +1 -0
- package/dist/components/Stat.vue.d.ts +25 -0
- package/dist/components/Stat.vue_vue_type_script_setup_true_lang.js +68 -0
- package/dist/components/Stat.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/Stepper.d.ts +2 -0
- package/dist/components/Stepper.js +6 -0
- package/dist/components/Stepper.js.map +1 -0
- package/dist/components/Stepper.vue.d.ts +29 -0
- package/dist/components/Stepper.vue_vue_type_script_setup_true_lang.js +82 -0
- package/dist/components/Stepper.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/Switch.d.ts +2 -0
- package/dist/components/Switch.js +6 -0
- package/dist/components/Switch.js.map +1 -0
- package/dist/components/Switch.vue.d.ts +33 -0
- package/dist/components/Switch.vue_vue_type_script_setup_true_lang.js +52 -0
- package/dist/components/Switch.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/Tabs.d.ts +2 -0
- package/dist/components/Tabs.js +6 -0
- package/dist/components/Tabs.js.map +1 -0
- package/dist/components/Tabs.vue.d.ts +38 -0
- package/dist/components/Tabs.vue_vue_type_script_setup_true_lang.js +92 -0
- package/dist/components/Tabs.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/Tag.d.ts +2 -0
- package/dist/components/Tag.js +6 -0
- package/dist/components/Tag.js.map +1 -0
- package/dist/components/Tag.vue.d.ts +32 -0
- package/dist/components/Tag.vue_vue_type_script_setup_true_lang.js +60 -0
- package/dist/components/Tag.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/TagsInput.d.ts +2 -0
- package/dist/components/TagsInput.js +6 -0
- package/dist/components/TagsInput.js.map +1 -0
- package/dist/components/TagsInput.vue.d.ts +34 -0
- package/dist/components/TagsInput.vue_vue_type_script_setup_true_lang.js +126 -0
- package/dist/components/TagsInput.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/Textarea.d.ts +2 -0
- package/dist/components/Textarea.js +6 -0
- package/dist/components/Textarea.js.map +1 -0
- package/dist/components/Textarea.vue.d.ts +32 -0
- package/dist/components/Textarea.vue_vue_type_script_setup_true_lang.js +97 -0
- package/dist/components/Textarea.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/ThemeScope.d.ts +2 -0
- package/dist/components/ThemeScope.js +6 -0
- package/dist/components/ThemeScope.js.map +1 -0
- package/dist/components/ThemeScope.vue.d.ts +27 -0
- package/dist/components/ThemeScope.vue_vue_type_script_setup_true_lang.js +62 -0
- package/dist/components/ThemeScope.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/ThemeSwitcher.d.ts +2 -0
- package/dist/components/ThemeSwitcher.js +6 -0
- package/dist/components/ThemeSwitcher.js.map +1 -0
- package/dist/components/ThemeSwitcher.vue.d.ts +22 -0
- package/dist/components/ThemeSwitcher.vue_vue_type_script_setup_true_lang.js +135 -0
- package/dist/components/ThemeSwitcher.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/TimePicker.d.ts +2 -0
- package/dist/components/TimePicker.js +6 -0
- package/dist/components/TimePicker.js.map +1 -0
- package/dist/components/TimePicker.vue.d.ts +39 -0
- package/dist/components/TimePicker.vue_vue_type_script_setup_true_lang.js +154 -0
- package/dist/components/TimePicker.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/TimeRangePicker.d.ts +2 -0
- package/dist/components/TimeRangePicker.js +6 -0
- package/dist/components/TimeRangePicker.js.map +1 -0
- package/dist/components/TimeRangePicker.vue.d.ts +51 -0
- package/dist/components/TimeRangePicker.vue_vue_type_script_setup_true_lang.js +257 -0
- package/dist/components/TimeRangePicker.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/Timeline.d.ts +2 -0
- package/dist/components/Timeline.js +6 -0
- package/dist/components/Timeline.js.map +1 -0
- package/dist/components/Timeline.vue.d.ts +32 -0
- package/dist/components/Timeline.vue_vue_type_script_setup_true_lang.js +32 -0
- package/dist/components/Timeline.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/ToastViewport.d.ts +2 -0
- package/dist/components/ToastViewport.js +6 -0
- package/dist/components/ToastViewport.js.map +1 -0
- package/dist/components/ToastViewport.vue.d.ts +11 -0
- package/dist/components/ToastViewport.vue_vue_type_script_setup_true_lang.js +85 -0
- package/dist/components/ToastViewport.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/ToggleButton.d.ts +2 -0
- package/dist/components/ToggleButton.js +6 -0
- package/dist/components/ToggleButton.js.map +1 -0
- package/dist/components/ToggleButton.vue.d.ts +36 -0
- package/dist/components/ToggleButton.vue_vue_type_script_setup_true_lang.js +68 -0
- package/dist/components/ToggleButton.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/Tooltip.d.ts +2 -0
- package/dist/components/Tooltip.js +6 -0
- package/dist/components/Tooltip.js.map +1 -0
- package/dist/components/Tooltip.vue.d.ts +28 -0
- package/dist/components/Tooltip.vue_vue_type_script_setup_true_lang.js +98 -0
- package/dist/components/Tooltip.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/Tree.d.ts +2 -0
- package/dist/components/Tree.js +6 -0
- package/dist/components/Tree.js.map +1 -0
- package/dist/components/Tree.vue.d.ts +45 -0
- package/dist/components/Tree.vue_vue_type_script_setup_true_lang.js +164 -0
- package/dist/components/Tree.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/VisuallyHidden.d.ts +2 -0
- package/dist/components/VisuallyHidden.js +6 -0
- package/dist/components/VisuallyHidden.js.map +1 -0
- package/dist/components/VisuallyHidden.vue.d.ts +21 -0
- package/dist/components/VisuallyHidden.vue_vue_type_script_setup_true_lang.js +26 -0
- package/dist/components/VisuallyHidden.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/composables/confirm.d.ts +17 -0
- package/dist/composables/confirm.js +36 -0
- package/dist/composables/confirm.js.map +1 -0
- package/dist/composables/dates.d.ts +14 -0
- package/dist/composables/dates.js +83 -0
- package/dist/composables/dates.js.map +1 -0
- package/dist/composables/defaults.d.ts +7 -0
- package/dist/composables/defaults.js +39 -0
- package/dist/composables/defaults.js.map +1 -0
- package/dist/composables/direction.d.ts +2 -0
- package/dist/composables/direction.js +12 -0
- package/dist/composables/direction.js.map +1 -0
- package/dist/composables/dismiss.d.ts +4 -0
- package/dist/composables/dismiss.js +39 -0
- package/dist/composables/dismiss.js.map +1 -0
- package/dist/composables/dispose.d.ts +1 -0
- package/dist/composables/dispose.js +10 -0
- package/dist/composables/dispose.js.map +1 -0
- package/dist/composables/field.d.ts +28 -0
- package/dist/composables/field.js +25 -0
- package/dist/composables/field.js.map +1 -0
- package/dist/composables/floating.d.ts +14 -0
- package/dist/composables/floating.js +124 -0
- package/dist/composables/floating.js.map +1 -0
- package/dist/composables/focus.d.ts +3 -0
- package/dist/composables/focus.js +89 -0
- package/dist/composables/focus.js.map +1 -0
- package/dist/composables/fullscreen.d.ts +8 -0
- package/dist/composables/fullscreen.js +50 -0
- package/dist/composables/fullscreen.js.map +1 -0
- package/dist/composables/layers.d.ts +7 -0
- package/dist/composables/layers.js +38 -0
- package/dist/composables/layers.js.map +1 -0
- package/dist/composables/locale.d.ts +13 -0
- package/dist/composables/locale.js +32 -0
- package/dist/composables/locale.js.map +1 -0
- package/dist/composables/mounted.d.ts +2 -0
- package/dist/composables/mounted.js +12 -0
- package/dist/composables/mounted.js.map +1 -0
- package/dist/composables/scroll-lock.d.ts +2 -0
- package/dist/composables/scroll-lock.js +45 -0
- package/dist/composables/scroll-lock.js.map +1 -0
- package/dist/composables/shell.d.ts +24 -0
- package/dist/composables/shell.js +12 -0
- package/dist/composables/shell.js.map +1 -0
- package/dist/composables/theme.d.ts +13 -0
- package/dist/composables/theme.js +58 -0
- package/dist/composables/theme.js.map +1 -0
- package/dist/composables/times.d.ts +30 -0
- package/dist/composables/times.js +130 -0
- package/dist/composables/times.js.map +1 -0
- package/dist/composables/toast.d.ts +26 -0
- package/dist/composables/toast.js +76 -0
- package/dist/composables/toast.js.map +1 -0
- package/dist/composables/use-theme.d.ts +11 -0
- package/dist/composables/use-theme.js +30 -0
- package/dist/composables/use-theme.js.map +1 -0
- package/dist/composables/view-transition.d.ts +2 -0
- package/dist/composables/view-transition.js +15 -0
- package/dist/composables/view-transition.js.map +1 -0
- package/dist/composables/visible.d.ts +1 -0
- package/dist/composables/visible.js +16 -0
- package/dist/composables/visible.js.map +1 -0
- package/dist/config.d.ts +65 -0
- package/dist/config.js +109 -0
- package/dist/config.js.map +1 -0
- package/dist/directives/ripple.d.ts +2 -0
- package/dist/directives/ripple.js +65 -0
- package/dist/directives/ripple.js.map +1 -0
- package/dist/i18n.d.ts +32 -0
- package/dist/i18n.js +81 -0
- package/dist/i18n.js.map +1 -0
- package/dist/icons/index.d.ts +5 -0
- package/dist/icons/lucide.d.ts +153 -0
- package/dist/icons/lucide.js +193 -0
- package/dist/icons/lucide.js.map +1 -0
- package/dist/icons/registry.d.ts +6 -0
- package/dist/icons/registry.js +35 -0
- package/dist/icons/registry.js.map +1 -0
- package/dist/icons/resolve.d.ts +6 -0
- package/dist/icons/resolve.js +34 -0
- package/dist/icons/resolve.js.map +1 -0
- package/dist/icons/types.d.ts +14 -0
- package/dist/index.d.ts +3868 -0
- package/dist/index.js +199 -0
- package/dist/index.js.map +1 -0
- package/dist/locales/en.js +115 -0
- package/dist/locales/en.js.map +1 -0
- package/dist/locales/hy.js +115 -0
- package/dist/locales/hy.js.map +1 -0
- package/dist/locales/ru.js +115 -0
- package/dist/locales/ru.js.map +1 -0
- package/dist/motion/enter.d.ts +9 -0
- package/dist/motion/enter.js +25 -0
- package/dist/motion/enter.js.map +1 -0
- package/dist/motion/install.d.ts +7 -0
- package/dist/motion/install.js +15 -0
- package/dist/motion/install.js.map +1 -0
- package/dist/motion/overlays.d.ts +11 -0
- package/dist/motion/overlays.js +98 -0
- package/dist/motion/overlays.js.map +1 -0
- package/dist/pt.d.ts +16 -0
- package/dist/pt.js +48 -0
- package/dist/pt.js.map +1 -0
- package/dist/scale.d.ts +8 -0
- package/dist/scale.js +29 -0
- package/dist/scale.js.map +1 -0
- package/dist/skills/momo-ui/SKILL.md +233 -0
- package/dist/skills/momo-ui/api/firstDayOf.md +17 -0
- package/dist/skills/momo-ui/api/parseDate.md +17 -0
- package/dist/skills/momo-ui/api/registerIconCollection.md +17 -0
- package/dist/skills/momo-ui/api/toIso.md +18 -0
- package/dist/skills/momo-ui/api/tokens.md +17 -0
- package/dist/skills/momo-ui/api/useColorMode.md +19 -0
- package/dist/skills/momo-ui/api/useConfig.md +15 -0
- package/dist/skills/momo-ui/api/useConfirm.md +26 -0
- package/dist/skills/momo-ui/api/useDefaults.md +17 -0
- package/dist/skills/momo-ui/api/useDismiss.md +16 -0
- package/dist/skills/momo-ui/api/useField.md +22 -0
- package/dist/skills/momo-ui/api/useFloating.md +16 -0
- package/dist/skills/momo-ui/api/useFocusTrap.md +17 -0
- package/dist/skills/momo-ui/api/useFullscreen.md +20 -0
- package/dist/skills/momo-ui/api/useLocale.md +20 -0
- package/dist/skills/momo-ui/api/usePart.md +22 -0
- package/dist/skills/momo-ui/api/useScrollLock.md +16 -0
- package/dist/skills/momo-ui/api/useShell.md +20 -0
- package/dist/skills/momo-ui/api/useT.md +16 -0
- package/dist/skills/momo-ui/api/useTheme.md +23 -0
- package/dist/skills/momo-ui/api/useToast.md +23 -0
- package/dist/skills/momo-ui/api/vRipple.md +17 -0
- package/dist/skills/momo-ui/api/withViewTransition.md +16 -0
- package/dist/skills/momo-ui/components/Accordion.md +46 -0
- package/dist/skills/momo-ui/components/Alert.md +34 -0
- package/dist/skills/momo-ui/components/AppShell.md +54 -0
- package/dist/skills/momo-ui/components/AspectRatio.md +25 -0
- package/dist/skills/momo-ui/components/Avatar.md +22 -0
- package/dist/skills/momo-ui/components/Badge.md +27 -0
- package/dist/skills/momo-ui/components/Breadcrumbs.md +30 -0
- package/dist/skills/momo-ui/components/Button.md +55 -0
- package/dist/skills/momo-ui/components/ButtonGroup.md +30 -0
- package/dist/skills/momo-ui/components/Calendar.md +35 -0
- package/dist/skills/momo-ui/components/Card.md +36 -0
- package/dist/skills/momo-ui/components/Carousel.md +33 -0
- package/dist/skills/momo-ui/components/Checkbox.md +37 -0
- package/dist/skills/momo-ui/components/Clock.md +44 -0
- package/dist/skills/momo-ui/components/Collapsible.md +33 -0
- package/dist/skills/momo-ui/components/ColorPicker.md +32 -0
- package/dist/skills/momo-ui/components/Combobox.md +49 -0
- package/dist/skills/momo-ui/components/CommandPalette.md +41 -0
- package/dist/skills/momo-ui/components/ConfirmDialog.md +16 -0
- package/dist/skills/momo-ui/components/Container.md +28 -0
- package/dist/skills/momo-ui/components/ConversationItem.md +36 -0
- package/dist/skills/momo-ui/components/DataTable.md +74 -0
- package/dist/skills/momo-ui/components/DateDivider.md +23 -0
- package/dist/skills/momo-ui/components/DatePicker.md +38 -0
- package/dist/skills/momo-ui/components/Defaults.md +19 -0
- package/dist/skills/momo-ui/components/DescriptionList.md +35 -0
- package/dist/skills/momo-ui/components/Dialog.md +41 -0
- package/dist/skills/momo-ui/components/Divider.md +26 -0
- package/dist/skills/momo-ui/components/EmptyState.md +28 -0
- package/dist/skills/momo-ui/components/Field.md +37 -0
- package/dist/skills/momo-ui/components/FileUpload.md +36 -0
- package/dist/skills/momo-ui/components/FullscreenButton.md +19 -0
- package/dist/skills/momo-ui/components/Grid.md +32 -0
- package/dist/skills/momo-ui/components/Icon.md +18 -0
- package/dist/skills/momo-ui/components/Input.md +42 -0
- package/dist/skills/momo-ui/components/Kbd.md +24 -0
- package/dist/skills/momo-ui/components/List.md +39 -0
- package/dist/skills/momo-ui/components/LocaleSwitcher.md +27 -0
- package/dist/skills/momo-ui/components/Menu.md +43 -0
- package/dist/skills/momo-ui/components/Message.md +29 -0
- package/dist/skills/momo-ui/components/MessageGroup.md +31 -0
- package/dist/skills/momo-ui/components/NavList.md +55 -0
- package/dist/skills/momo-ui/components/NavigationSwitcher.md +26 -0
- package/dist/skills/momo-ui/components/NumberInput.md +38 -0
- package/dist/skills/momo-ui/components/Pagination.md +27 -0
- package/dist/skills/momo-ui/components/Panel.md +35 -0
- package/dist/skills/momo-ui/components/PasswordInput.md +50 -0
- package/dist/skills/momo-ui/components/PinInput.md +33 -0
- package/dist/skills/momo-ui/components/Popover.md +33 -0
- package/dist/skills/momo-ui/components/Progress.md +25 -0
- package/dist/skills/momo-ui/components/QrCode.md +23 -0
- package/dist/skills/momo-ui/components/RadioGroup.md +49 -0
- package/dist/skills/momo-ui/components/Rating.md +32 -0
- package/dist/skills/momo-ui/components/ScrollArea.md +28 -0
- package/dist/skills/momo-ui/components/SegmentedControl.md +43 -0
- package/dist/skills/momo-ui/components/Select.md +64 -0
- package/dist/skills/momo-ui/components/SelectionBar.md +29 -0
- package/dist/skills/momo-ui/components/Skeleton.md +23 -0
- package/dist/skills/momo-ui/components/Slider.md +33 -0
- package/dist/skills/momo-ui/components/Spacer.md +17 -0
- package/dist/skills/momo-ui/components/Spinner.md +21 -0
- package/dist/skills/momo-ui/components/Split.md +33 -0
- package/dist/skills/momo-ui/components/Stack.md +32 -0
- package/dist/skills/momo-ui/components/Stat.md +33 -0
- package/dist/skills/momo-ui/components/Stepper.md +39 -0
- package/dist/skills/momo-ui/components/Switch.md +32 -0
- package/dist/skills/momo-ui/components/Tabs.md +42 -0
- package/dist/skills/momo-ui/components/Tag.md +34 -0
- package/dist/skills/momo-ui/components/TagsInput.md +34 -0
- package/dist/skills/momo-ui/components/Textarea.md +36 -0
- package/dist/skills/momo-ui/components/ThemeScope.md +27 -0
- package/dist/skills/momo-ui/components/ThemeSwitcher.md +27 -0
- package/dist/skills/momo-ui/components/TimePicker.md +39 -0
- package/dist/skills/momo-ui/components/TimeRangePicker.md +44 -0
- package/dist/skills/momo-ui/components/Timeline.md +38 -0
- package/dist/skills/momo-ui/components/ToastViewport.md +20 -0
- package/dist/skills/momo-ui/components/ToggleButton.md +34 -0
- package/dist/skills/momo-ui/components/Tooltip.md +28 -0
- package/dist/skills/momo-ui/components/Tree.md +47 -0
- package/dist/skills/momo-ui/components/VisuallyHidden.md +25 -0
- package/dist/styles.css +2228 -0
- package/dist/tokens.d.ts +2 -0
- package/dist/tokens.js +18 -0
- package/dist/tokens.js.map +1 -0
- package/package.json +102 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme.js","names":[],"sources":["../../src/composables/theme.ts"],"sourcesContent":["import { ref } from 'vue'\nimport type { Ref } from 'vue'\n\nexport type ColorMode = 'light' | 'dark' | 'system'\n\nexport interface ColorModeSource {\n mode: Ref<ColorMode>\n set: (mode: ColorMode) => void\n}\n\nconst STORAGE = 'momo-theme'\nconst DARK = '(prefers-color-scheme: dark)'\nconst own: Ref<ColorMode> = ref('system')\nconst systemChanges = ref(0)\nlet source: ColorModeSource | null = null\nlet listening = false\n\nfunction followSystem(): void {\n if (listening || typeof window === 'undefined' || typeof window.matchMedia !== 'function') {\n return\n }\n listening = true\n window.matchMedia(DARK).addEventListener?.('change', () => systemChanges.value++)\n}\n\nexport function useColorModeSource(next: ColorModeSource | null): void {\n source = next\n}\n\nexport function useColorMode() {\n const mode = source?.mode ?? own\n followSystem()\n\n const set = (value: ColorMode) => {\n if (source) {\n source.set(value)\n return\n }\n own.value = value\n if (typeof document === 'undefined') {\n return\n }\n if (value === 'system') {\n delete document.documentElement.dataset.theme\n }\n else {\n document.documentElement.dataset.theme = value\n }\n try {\n localStorage.setItem(STORAGE, value)\n }\n catch {\n return\n }\n }\n\n const restore = () => {\n if (source) {\n return\n }\n try {\n const saved = localStorage.getItem(STORAGE)\n if (saved === 'light' || saved === 'dark' || saved === 'system') {\n set(saved)\n }\n }\n catch {\n return\n }\n }\n\n const resolved = (): 'light' | 'dark' => {\n if (mode.value !== 'system') {\n return mode.value\n }\n void systemChanges.value\n return typeof window !== 'undefined' && window.matchMedia?.(DARK).matches ? 'dark' : 'light'\n }\n\n return { mode, set, restore, resolved }\n}\n"],"mappings":";;AAUA,IAAM,UAAU;AAChB,IAAM,OAAO;AACb,IAAM,MAAsB,IAAI,QAAQ;AACxC,IAAM,gBAAgB,IAAI,CAAC;AAC3B,IAAI,SAAiC;AACrC,IAAI,YAAY;AAEhB,SAAS,eAAqB;CAC5B,IAAI,aAAa,OAAO,WAAW,eAAe,OAAO,OAAO,eAAe,YAC7E;CAEF,YAAY;CACZ,OAAO,WAAW,IAAI,CAAC,CAAC,mBAAmB,gBAAgB,cAAc,OAAO;AAClF;AAEA,SAAgB,mBAAmB,MAAoC;CACrE,SAAS;AACX;AAEA,SAAgB,eAAe;CAC7B,MAAM,OAAO,QAAQ,QAAQ;CAC7B,aAAa;CAEb,MAAM,OAAO,UAAqB;EAChC,IAAI,QAAQ;GACV,OAAO,IAAI,KAAK;GAChB;EACF;EACA,IAAI,QAAQ;EACZ,IAAI,OAAO,aAAa,aACtB;EAEF,IAAI,UAAU,UACZ,OAAO,SAAS,gBAAgB,QAAQ;OAGxC,SAAS,gBAAgB,QAAQ,QAAQ;EAE3C,IAAI;GACF,aAAa,QAAQ,SAAS,KAAK;EACrC,QACM;GACJ;EACF;CACF;CAEA,MAAM,gBAAgB;EACpB,IAAI,QACF;EAEF,IAAI;GACF,MAAM,QAAQ,aAAa,QAAQ,OAAO;GAC1C,IAAI,UAAU,WAAW,UAAU,UAAU,UAAU,UACrD,IAAI,KAAK;EAEb,QACM;GACJ;EACF;CACF;CAEA,MAAM,iBAAmC;EACvC,IAAI,KAAK,UAAU,UACjB,OAAO,KAAK;EAEd,cAAmB;EACnB,OAAO,OAAO,WAAW,eAAe,OAAO,aAAa,IAAI,CAAC,CAAC,UAAU,SAAS;CACvF;CAEA,OAAO;EAAE;EAAM;EAAK;EAAS;CAAS;AACxC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { MaybeRefOrGetter, Ref } from 'vue';
|
|
2
|
+
export type DayMinute = number;
|
|
3
|
+
export type HourCycle = 12 | 24;
|
|
4
|
+
export declare const DAY: number;
|
|
5
|
+
export declare function hourCycleOf(locale: string): HourCycle;
|
|
6
|
+
export declare function periodsOf(locale: string): [string, string];
|
|
7
|
+
export declare function formatTime(minute: DayMinute, cycle?: HourCycle, locale?: string): string;
|
|
8
|
+
export declare function parseTime(text: string, locale?: string): DayMinute | null;
|
|
9
|
+
export declare function formatDuration(minutes: number, locale?: string): string;
|
|
10
|
+
export interface TimeLimits {
|
|
11
|
+
min?: DayMinute;
|
|
12
|
+
max?: DayMinute;
|
|
13
|
+
unavailable?: (minute: DayMinute) => boolean;
|
|
14
|
+
}
|
|
15
|
+
export declare function blockedBy(limits: TimeLimits, minute: DayMinute): boolean;
|
|
16
|
+
export declare function walk(limits: TimeLimits, start: DayMinute, by: number, end?: number): DayMinute | null;
|
|
17
|
+
export declare function snapStep(minute: DayMinute, unit: number, direction: number): DayMinute;
|
|
18
|
+
export declare function lastMinute(limits: TimeLimits): DayMinute;
|
|
19
|
+
export declare function useTimeText(model: Ref<DayMinute | null>, options: {
|
|
20
|
+
cycle: MaybeRefOrGetter<HourCycle>;
|
|
21
|
+
locale: MaybeRefOrGetter<string>;
|
|
22
|
+
step: MaybeRefOrGetter<number>;
|
|
23
|
+
limits: () => TimeLimits;
|
|
24
|
+
}): {
|
|
25
|
+
text: Ref<string, string>;
|
|
26
|
+
wrong: Ref<boolean, boolean>;
|
|
27
|
+
example: import("vue").ComputedRef<string>;
|
|
28
|
+
commit: () => void;
|
|
29
|
+
nudge: (event: KeyboardEvent) => void;
|
|
30
|
+
};
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { wordsIn } from "../i18n.js";
|
|
2
|
+
import { computed, ref, toValue, watch } from "vue";
|
|
3
|
+
// src/composables/times.ts
|
|
4
|
+
var DAY = 1440;
|
|
5
|
+
var pad = (n) => String(n).padStart(2, "0");
|
|
6
|
+
function hourCycleOf(locale) {
|
|
7
|
+
const cycle = new Intl.DateTimeFormat(locale, { hour: "numeric" }).resolvedOptions().hourCycle;
|
|
8
|
+
return cycle === "h11" || cycle === "h12" ? 12 : 24;
|
|
9
|
+
}
|
|
10
|
+
function periodsOf(locale) {
|
|
11
|
+
const label = (hour) => new Intl.DateTimeFormat(locale, {
|
|
12
|
+
hour: "numeric",
|
|
13
|
+
hour12: true,
|
|
14
|
+
timeZone: "UTC"
|
|
15
|
+
}).formatToParts(new Date(Date.UTC(2e3, 0, 1, hour))).find((part) => part.type === "dayPeriod")?.value ?? (hour < 12 ? "AM" : "PM");
|
|
16
|
+
return [label(9), label(15)];
|
|
17
|
+
}
|
|
18
|
+
function formatTime(minute, cycle = 24, locale = "en") {
|
|
19
|
+
if (cycle === 24) return `${pad(Math.floor(minute / 60))}:${pad(minute % 60)}`;
|
|
20
|
+
const [am, pm] = periodsOf(locale);
|
|
21
|
+
const hour = Math.floor(minute / 60) % 24;
|
|
22
|
+
return `${hour % 12 || 12}:${pad(minute % 60)} ${hour < 12 ? am : pm}`;
|
|
23
|
+
}
|
|
24
|
+
function periodIn(text, locale) {
|
|
25
|
+
const bare = text.toLowerCase().replace(/[\s.]+/g, "");
|
|
26
|
+
const [am, pm] = periodsOf(locale).map((label) => label.toLowerCase().replace(/[\s.]+/g, ""));
|
|
27
|
+
if (bare.includes(pm) || /\dp(m)?$/.test(bare)) return "pm";
|
|
28
|
+
if (bare.includes(am) || /\da(m)?$/.test(bare)) return "am";
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
function parseTime(text, locale = "en") {
|
|
32
|
+
const groups = text.match(/\d+/g);
|
|
33
|
+
if (!groups || groups.length > 2) return null;
|
|
34
|
+
const digits = groups.join("");
|
|
35
|
+
let hour;
|
|
36
|
+
let minute;
|
|
37
|
+
if (groups.length === 2) {
|
|
38
|
+
hour = Number(groups[0]);
|
|
39
|
+
minute = Number(groups[1]);
|
|
40
|
+
} else if (digits.length <= 2) {
|
|
41
|
+
hour = Number(digits);
|
|
42
|
+
minute = 0;
|
|
43
|
+
} else if (digits.length <= 4) {
|
|
44
|
+
hour = Number(digits.slice(0, -2));
|
|
45
|
+
minute = Number(digits.slice(-2));
|
|
46
|
+
} else return null;
|
|
47
|
+
const period = periodIn(text, locale);
|
|
48
|
+
if (period) {
|
|
49
|
+
if (hour < 1 || hour > 12) return null;
|
|
50
|
+
hour = hour % 12 + (period === "pm" ? 12 : 0);
|
|
51
|
+
}
|
|
52
|
+
if (minute > 59 || hour > 24 || hour === 24 && minute > 0) return null;
|
|
53
|
+
return hour * 60 + minute;
|
|
54
|
+
}
|
|
55
|
+
function formatDuration(minutes, locale = "en") {
|
|
56
|
+
const unit = (value, name) => wordsIn(locale, `duration_${name}`, { n: new Intl.NumberFormat(locale).format(value) }) ?? new Intl.NumberFormat(locale, {
|
|
57
|
+
style: "unit",
|
|
58
|
+
unit: name,
|
|
59
|
+
unitDisplay: "short"
|
|
60
|
+
}).format(value);
|
|
61
|
+
const hours = Math.floor(minutes / 60);
|
|
62
|
+
const rest = minutes % 60;
|
|
63
|
+
return [hours ? unit(hours, "hour") : "", rest || !hours ? unit(rest, "minute") : ""].filter(Boolean).join(" ");
|
|
64
|
+
}
|
|
65
|
+
function blockedBy(limits, minute) {
|
|
66
|
+
return limits.min !== void 0 && minute < limits.min || limits.max !== void 0 && minute > limits.max || (limits.unavailable?.(minute) ?? false);
|
|
67
|
+
}
|
|
68
|
+
function walk(limits, start, by, end = 1439) {
|
|
69
|
+
for (let next = start; next >= 0 && next <= end; next += by) if (!blockedBy(limits, next)) return next;
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
72
|
+
function snapStep(minute, unit, direction) {
|
|
73
|
+
return direction > 0 ? Math.floor(minute / unit) * unit + unit : Math.ceil(minute / unit) * unit - unit;
|
|
74
|
+
}
|
|
75
|
+
function lastMinute(limits) {
|
|
76
|
+
return limits.max !== void 0 && limits.max >= 1440 ? DAY : 1439;
|
|
77
|
+
}
|
|
78
|
+
function useTimeText(model, options) {
|
|
79
|
+
const text = ref("");
|
|
80
|
+
const wrong = ref(false);
|
|
81
|
+
const show = (minute) => formatTime(minute, toValue(options.cycle), toValue(options.locale));
|
|
82
|
+
const example = computed(() => show(570));
|
|
83
|
+
watch([
|
|
84
|
+
model,
|
|
85
|
+
() => toValue(options.cycle),
|
|
86
|
+
() => toValue(options.locale)
|
|
87
|
+
], () => {
|
|
88
|
+
text.value = model.value === null ? "" : show(model.value);
|
|
89
|
+
wrong.value = false;
|
|
90
|
+
}, { immediate: true });
|
|
91
|
+
function commit() {
|
|
92
|
+
const typed = text.value.trim();
|
|
93
|
+
if (typed === "") {
|
|
94
|
+
wrong.value = false;
|
|
95
|
+
model.value = null;
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
const minute = parseTime(typed, toValue(options.locale));
|
|
99
|
+
if (minute === null || blockedBy(options.limits(), minute)) {
|
|
100
|
+
wrong.value = true;
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
wrong.value = false;
|
|
104
|
+
model.value = minute;
|
|
105
|
+
text.value = show(minute);
|
|
106
|
+
}
|
|
107
|
+
function nudge(event) {
|
|
108
|
+
const direction = {
|
|
109
|
+
ArrowUp: 1,
|
|
110
|
+
ArrowDown: -1
|
|
111
|
+
}[event.key];
|
|
112
|
+
if (!direction) return;
|
|
113
|
+
event.preventDefault();
|
|
114
|
+
const limits = options.limits();
|
|
115
|
+
const unit = event.shiftKey ? 60 : toValue(options.step);
|
|
116
|
+
const end = lastMinute(limits);
|
|
117
|
+
const next = walk(limits, model.value === null ? direction > 0 ? limits.min ?? 0 : Math.min(limits.max ?? end, end) : snapStep(model.value, unit, direction), direction * unit, end);
|
|
118
|
+
if (next !== null) model.value = next;
|
|
119
|
+
}
|
|
120
|
+
return {
|
|
121
|
+
text,
|
|
122
|
+
wrong,
|
|
123
|
+
example,
|
|
124
|
+
commit,
|
|
125
|
+
nudge
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
export { DAY, blockedBy, formatDuration, formatTime, hourCycleOf, lastMinute, parseTime, periodsOf, snapStep, useTimeText, walk };
|
|
129
|
+
|
|
130
|
+
//# sourceMappingURL=times.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"times.js","names":[],"sources":["../../src/composables/times.ts"],"sourcesContent":["import { wordsIn } from '../i18n.ts'\nimport { computed, ref, toValue, watch } from 'vue'\nimport type { MaybeRefOrGetter, Ref } from 'vue'\n\nexport type DayMinute = number\nexport type HourCycle = 12 | 24\n\nexport const DAY = 24 * 60\n\nconst pad = (n: number) => String(n).padStart(2, '0')\n\nexport function hourCycleOf(locale: string): HourCycle {\n const cycle = new Intl.DateTimeFormat(locale, { hour: 'numeric' }).resolvedOptions().hourCycle\n return cycle === 'h11' || cycle === 'h12' ? 12 : 24\n}\n\nexport function periodsOf(locale: string): [string, string] {\n const label = (hour: number) => new Intl.DateTimeFormat(locale, { hour: 'numeric', hour12: true, timeZone: 'UTC' })\n .formatToParts(new Date(Date.UTC(2000, 0, 1, hour)))\n .find(part => part.type === 'dayPeriod')?.value ?? (hour < 12 ? 'AM' : 'PM')\n return [label(9), label(15)]\n}\n\nexport function formatTime(minute: DayMinute, cycle: HourCycle = 24, locale = 'en'): string {\n if (cycle === 24) {\n return `${pad(Math.floor(minute / 60))}:${pad(minute % 60)}`\n }\n const [am, pm] = periodsOf(locale)\n const hour = Math.floor(minute / 60) % 24\n return `${hour % 12 || 12}:${pad(minute % 60)} ${hour < 12 ? am : pm}`\n}\n\nfunction periodIn(text: string, locale: string): 'am' | 'pm' | null {\n const bare = text.toLowerCase().replace(/[\\s.]+/g, '')\n const [am, pm] = periodsOf(locale).map(label => label.toLowerCase().replace(/[\\s.]+/g, ''))\n if (bare.includes(pm as string) || /\\dp(m)?$/.test(bare)) {\n return 'pm'\n }\n if (bare.includes(am as string) || /\\da(m)?$/.test(bare)) {\n return 'am'\n }\n return null\n}\n\nexport function parseTime(text: string, locale = 'en'): DayMinute | null {\n const groups = text.match(/\\d+/g)\n if (!groups || groups.length > 2) {\n return null\n }\n const digits = groups.join('')\n let hour: number\n let minute: number\n if (groups.length === 2) {\n hour = Number(groups[0])\n minute = Number(groups[1])\n }\n else if (digits.length <= 2) {\n hour = Number(digits)\n minute = 0\n }\n else if (digits.length <= 4) {\n hour = Number(digits.slice(0, -2))\n minute = Number(digits.slice(-2))\n }\n else {\n return null\n }\n const period = periodIn(text, locale)\n if (period) {\n if (hour < 1 || hour > 12) {\n return null\n }\n hour = (hour % 12) + (period === 'pm' ? 12 : 0)\n }\n if (minute > 59 || hour > 24 || (hour === 24 && minute > 0)) {\n return null\n }\n return hour * 60 + minute\n}\n\nexport function formatDuration(minutes: number, locale = 'en'): string {\n const unit = (value: number, name: 'hour' | 'minute') => wordsIn(locale, `duration_${name}`, { n: new Intl.NumberFormat(locale).format(value) })\n ?? new Intl.NumberFormat(locale, { style: 'unit', unit: name, unitDisplay: 'short' }).format(value)\n const hours = Math.floor(minutes / 60)\n const rest = minutes % 60\n return [hours ? unit(hours, 'hour') : '', rest || !hours ? unit(rest, 'minute') : ''].filter(Boolean).join(' ')\n}\n\nexport interface TimeLimits {\n min?: DayMinute\n max?: DayMinute\n unavailable?: (minute: DayMinute) => boolean\n}\n\nexport function blockedBy(limits: TimeLimits, minute: DayMinute): boolean {\n return (limits.min !== undefined && minute < limits.min) || (limits.max !== undefined && minute > limits.max) || (limits.unavailable?.(minute) ?? false)\n}\n\nexport function walk(limits: TimeLimits, start: DayMinute, by: number, end = DAY - 1): DayMinute | null {\n for (let next = start; next >= 0 && next <= end; next += by) {\n if (!blockedBy(limits, next)) {\n return next\n }\n }\n return null\n}\n\nexport function snapStep(minute: DayMinute, unit: number, direction: number): DayMinute {\n return direction > 0 ? Math.floor(minute / unit) * unit + unit : Math.ceil(minute / unit) * unit - unit\n}\n\nexport function lastMinute(limits: TimeLimits): DayMinute {\n return limits.max !== undefined && limits.max >= DAY ? DAY : DAY - 1\n}\n\nexport function useTimeText(\n model: Ref<DayMinute | null>,\n options: { cycle: MaybeRefOrGetter<HourCycle>, locale: MaybeRefOrGetter<string>, step: MaybeRefOrGetter<number>, limits: () => TimeLimits },\n) {\n const text = ref('')\n const wrong = ref(false)\n const show = (minute: DayMinute) => formatTime(minute, toValue(options.cycle), toValue(options.locale))\n const example = computed(() => show(9 * 60 + 30))\n\n watch([model, () => toValue(options.cycle), () => toValue(options.locale)], () => {\n text.value = model.value === null ? '' : show(model.value)\n wrong.value = false\n }, { immediate: true })\n\n function commit(): void {\n const typed = text.value.trim()\n if (typed === '') {\n wrong.value = false\n model.value = null\n return\n }\n const minute = parseTime(typed, toValue(options.locale))\n if (minute === null || blockedBy(options.limits(), minute)) {\n wrong.value = true\n return\n }\n wrong.value = false\n model.value = minute\n text.value = show(minute)\n }\n\n function nudge(event: KeyboardEvent): void {\n const direction = ({ ArrowUp: 1, ArrowDown: -1 } as Record<string, number>)[event.key]\n if (!direction) {\n return\n }\n event.preventDefault()\n const limits = options.limits()\n const unit = event.shiftKey ? 60 : toValue(options.step)\n const end = lastMinute(limits)\n const start = model.value === null ? (direction > 0 ? limits.min ?? 0 : Math.min(limits.max ?? end, end)) : snapStep(model.value, unit, direction)\n const next = walk(limits, start, direction * unit, end)\n if (next !== null) {\n model.value = next\n }\n }\n\n return { text, wrong, example, commit, nudge }\n}\n"],"mappings":"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"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export type Tone = 'primary' | 'neutral' | 'positive' | 'negative' | 'warning' | 'info';
|
|
2
|
+
export interface ToastAction {
|
|
3
|
+
label: string;
|
|
4
|
+
onClick: () => void;
|
|
5
|
+
}
|
|
6
|
+
export interface Toast {
|
|
7
|
+
id: number;
|
|
8
|
+
title: string;
|
|
9
|
+
description?: string;
|
|
10
|
+
tone: Tone;
|
|
11
|
+
duration: number;
|
|
12
|
+
action?: ToastAction;
|
|
13
|
+
}
|
|
14
|
+
export type ToastInput = Omit<Toast, 'id' | 'tone' | 'duration'> & Partial<Pick<Toast, 'tone' | 'duration'>>;
|
|
15
|
+
export declare function useToast(): {
|
|
16
|
+
toasts: import("vue").Reactive<Toast[]>;
|
|
17
|
+
add: (input: ToastInput) => number;
|
|
18
|
+
dismiss: (id: number) => void;
|
|
19
|
+
hold: (id: number) => void;
|
|
20
|
+
release: (id: number) => void;
|
|
21
|
+
clear: () => void;
|
|
22
|
+
success: (title: string, rest?: Omit<ToastInput, "title">) => number;
|
|
23
|
+
error: (title: string, rest?: Omit<ToastInput, "title">) => number;
|
|
24
|
+
info: (title: string, rest?: Omit<ToastInput, "title">) => number;
|
|
25
|
+
warning: (title: string, rest?: Omit<ToastInput, "title">) => number;
|
|
26
|
+
};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { reactive } from "vue";
|
|
2
|
+
// src/composables/toast.ts
|
|
3
|
+
var TOAST_DURATION = 2e3;
|
|
4
|
+
var toasts = reactive([]);
|
|
5
|
+
var timers = /* @__PURE__ */ new Map();
|
|
6
|
+
var next = 1;
|
|
7
|
+
function useToast() {
|
|
8
|
+
const start = (id, ms) => {
|
|
9
|
+
timers.set(id, {
|
|
10
|
+
handle: setTimeout(() => dismiss(id), ms),
|
|
11
|
+
endsAt: Date.now() + ms,
|
|
12
|
+
left: ms
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
const dismiss = (id) => {
|
|
16
|
+
clearTimeout(timers.get(id)?.handle);
|
|
17
|
+
timers.delete(id);
|
|
18
|
+
const index = toasts.findIndex((t) => t.id === id);
|
|
19
|
+
if (index >= 0) toasts.splice(index, 1);
|
|
20
|
+
};
|
|
21
|
+
const add = (input) => {
|
|
22
|
+
const tone = input.tone ?? "neutral";
|
|
23
|
+
const toast = {
|
|
24
|
+
duration: TOAST_DURATION,
|
|
25
|
+
...input,
|
|
26
|
+
tone,
|
|
27
|
+
id: next++
|
|
28
|
+
};
|
|
29
|
+
toasts.push(toast);
|
|
30
|
+
if (toast.duration > 0) start(toast.id, toast.duration);
|
|
31
|
+
return toast.id;
|
|
32
|
+
};
|
|
33
|
+
const hold = (id) => {
|
|
34
|
+
const countdown = timers.get(id);
|
|
35
|
+
if (countdown?.handle !== void 0) {
|
|
36
|
+
clearTimeout(countdown.handle);
|
|
37
|
+
countdown.handle = void 0;
|
|
38
|
+
countdown.left = Math.max(0, countdown.endsAt - Date.now());
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
const release = (id) => {
|
|
42
|
+
const countdown = timers.get(id);
|
|
43
|
+
if (countdown && countdown.handle === void 0) start(id, countdown.left);
|
|
44
|
+
};
|
|
45
|
+
return {
|
|
46
|
+
toasts,
|
|
47
|
+
add,
|
|
48
|
+
dismiss,
|
|
49
|
+
hold,
|
|
50
|
+
release,
|
|
51
|
+
clear: () => [...toasts].forEach((t) => dismiss(t.id)),
|
|
52
|
+
success: (title, rest = {}) => add({
|
|
53
|
+
...rest,
|
|
54
|
+
title,
|
|
55
|
+
tone: "positive"
|
|
56
|
+
}),
|
|
57
|
+
error: (title, rest = {}) => add({
|
|
58
|
+
...rest,
|
|
59
|
+
title,
|
|
60
|
+
tone: "negative"
|
|
61
|
+
}),
|
|
62
|
+
info: (title, rest = {}) => add({
|
|
63
|
+
...rest,
|
|
64
|
+
title,
|
|
65
|
+
tone: "info"
|
|
66
|
+
}),
|
|
67
|
+
warning: (title, rest = {}) => add({
|
|
68
|
+
...rest,
|
|
69
|
+
title,
|
|
70
|
+
tone: "warning"
|
|
71
|
+
})
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
export { useToast };
|
|
75
|
+
|
|
76
|
+
//# sourceMappingURL=toast.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toast.js","names":[],"sources":["../../src/composables/toast.ts"],"sourcesContent":["import { reactive } from 'vue'\n\nexport type Tone = 'primary' | 'neutral' | 'positive' | 'negative' | 'warning' | 'info'\n\nexport interface ToastAction {\n label: string\n onClick: () => void\n}\n\nexport interface Toast {\n id: number\n title: string\n description?: string\n tone: Tone\n duration: number\n action?: ToastAction\n}\n\nexport type ToastInput = Omit<Toast, 'id' | 'tone' | 'duration'> & Partial<Pick<Toast, 'tone' | 'duration'>>\n\nconst TOAST_DURATION = 2000\n\ninterface Countdown {\n handle: ReturnType<typeof setTimeout> | undefined\n endsAt: number\n left: number\n}\n\nconst toasts = reactive<Toast[]>([])\nconst timers = new Map<number, Countdown>()\nlet next = 1\n\nexport function useToast() {\n const start = (id: number, ms: number) => {\n timers.set(id, { handle: setTimeout(() => dismiss(id), ms), endsAt: Date.now() + ms, left: ms })\n }\n\n const dismiss = (id: number) => {\n clearTimeout(timers.get(id)?.handle)\n timers.delete(id)\n const index = toasts.findIndex(t => t.id === id)\n if (index >= 0) {\n toasts.splice(index, 1)\n }\n }\n\n const add = (input: ToastInput): number => {\n const tone = input.tone ?? 'neutral'\n const toast: Toast = { duration: TOAST_DURATION, ...input, tone, id: next++ }\n toasts.push(toast)\n if (toast.duration > 0) {\n start(toast.id, toast.duration)\n }\n return toast.id\n }\n\n const hold = (id: number) => {\n const countdown = timers.get(id)\n if (countdown?.handle !== undefined) {\n clearTimeout(countdown.handle)\n countdown.handle = undefined\n countdown.left = Math.max(0, countdown.endsAt - Date.now())\n }\n }\n\n const release = (id: number) => {\n const countdown = timers.get(id)\n if (countdown && countdown.handle === undefined) {\n start(id, countdown.left)\n }\n }\n\n return {\n toasts,\n add,\n dismiss,\n hold,\n release,\n clear: () => [...toasts].forEach(t => dismiss(t.id)),\n success: (title: string, rest: Omit<ToastInput, 'title'> = {}) => add({ ...rest, title, tone: 'positive' }),\n error: (title: string, rest: Omit<ToastInput, 'title'> = {}) => add({ ...rest, title, tone: 'negative' }),\n info: (title: string, rest: Omit<ToastInput, 'title'> = {}) => add({ ...rest, title, tone: 'info' }),\n warning: (title: string, rest: Omit<ToastInput, 'title'> = {}) => add({ ...rest, title, tone: 'warning' }),\n }\n}\n"],"mappings":";;AAoBA,IAAM,iBAAiB;AAQvB,IAAM,SAAS,SAAkB,CAAC,CAAC;AACnC,IAAM,yBAAS,IAAI,IAAuB;AAC1C,IAAI,OAAO;AAEX,SAAgB,WAAW;CACzB,MAAM,SAAS,IAAY,OAAe;EACxC,OAAO,IAAI,IAAI;GAAE,QAAQ,iBAAiB,QAAQ,EAAE,GAAG,EAAE;GAAG,QAAQ,KAAK,IAAI,IAAI;GAAI,MAAM;EAAG,CAAC;CACjG;CAEA,MAAM,WAAW,OAAe;EAC9B,aAAa,OAAO,IAAI,EAAE,CAAC,EAAE,MAAM;EACnC,OAAO,OAAO,EAAE;EAChB,MAAM,QAAQ,OAAO,WAAU,MAAK,EAAE,OAAO,EAAE;EAC/C,IAAI,SAAS,GACX,OAAO,OAAO,OAAO,CAAC;CAE1B;CAEA,MAAM,OAAO,UAA8B;EACzC,MAAM,OAAO,MAAM,QAAQ;EAC3B,MAAM,QAAe;GAAE,UAAU;GAAgB,GAAG;GAAO;GAAM,IAAI;EAAO;EAC5E,OAAO,KAAK,KAAK;EACjB,IAAI,MAAM,WAAW,GACnB,MAAM,MAAM,IAAI,MAAM,QAAQ;EAEhC,OAAO,MAAM;CACf;CAEA,MAAM,QAAQ,OAAe;EAC3B,MAAM,YAAY,OAAO,IAAI,EAAE;EAC/B,IAAI,WAAW,WAAW,KAAA,GAAW;GACnC,aAAa,UAAU,MAAM;GAC7B,UAAU,SAAS,KAAA;GACnB,UAAU,OAAO,KAAK,IAAI,GAAG,UAAU,SAAS,KAAK,IAAI,CAAC;EAC5D;CACF;CAEA,MAAM,WAAW,OAAe;EAC9B,MAAM,YAAY,OAAO,IAAI,EAAE;EAC/B,IAAI,aAAa,UAAU,WAAW,KAAA,GACpC,MAAM,IAAI,UAAU,IAAI;CAE5B;CAEA,OAAO;EACL;EACA;EACA;EACA;EACA;EACA,aAAa,CAAC,GAAG,MAAM,CAAC,CAAC,SAAQ,MAAK,QAAQ,EAAE,EAAE,CAAC;EACnD,UAAU,OAAe,OAAkC,CAAC,MAAM,IAAI;GAAE,GAAG;GAAM;GAAO,MAAM;EAAW,CAAC;EAC1G,QAAQ,OAAe,OAAkC,CAAC,MAAM,IAAI;GAAE,GAAG;GAAM;GAAO,MAAM;EAAW,CAAC;EACxG,OAAO,OAAe,OAAkC,CAAC,MAAM,IAAI;GAAE,GAAG;GAAM;GAAO,MAAM;EAAO,CAAC;EACnG,UAAU,OAAe,OAAkC,CAAC,MAAM,IAAI;GAAE,GAAG;GAAM;GAAO,MAAM;EAAU,CAAC;CAC3G;AACF"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Preset, PresetOverrides, ThemeOptions } from '@momo-framework/themes';
|
|
2
|
+
export declare function useTheme(): {
|
|
3
|
+
state: import("vue").ComputedRef<{
|
|
4
|
+
name: string;
|
|
5
|
+
options: import("@momo-framework/themes").PresetOptions;
|
|
6
|
+
}>;
|
|
7
|
+
use: (preset: Preset, keep?: boolean) => void;
|
|
8
|
+
set: (options: ThemeOptions) => void;
|
|
9
|
+
update: (overrides: PresetOverrides) => void;
|
|
10
|
+
get: () => Preset;
|
|
11
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { applyPreset, current } from "../config.js";
|
|
2
|
+
import { createTheme, definePreset } from "@momo-framework/themes";
|
|
3
|
+
import { computed } from "vue";
|
|
4
|
+
// src/composables/use-theme.ts
|
|
5
|
+
var state = computed(() => ({
|
|
6
|
+
name: current.preset.name,
|
|
7
|
+
options: current.preset.options
|
|
8
|
+
}));
|
|
9
|
+
function useTheme() {
|
|
10
|
+
const write = (preset) => applyPreset(preset, current.css);
|
|
11
|
+
return {
|
|
12
|
+
state,
|
|
13
|
+
use: (preset, keep = true) => {
|
|
14
|
+
const { primary, surface, density, ripple, inputVariant } = current.preset.options;
|
|
15
|
+
write(keep ? createTheme(preset, {
|
|
16
|
+
primary,
|
|
17
|
+
surface,
|
|
18
|
+
density,
|
|
19
|
+
ripple,
|
|
20
|
+
inputVariant
|
|
21
|
+
}) : preset);
|
|
22
|
+
},
|
|
23
|
+
set: (options) => write(createTheme(current.preset, options)),
|
|
24
|
+
update: (overrides) => write(definePreset(current.preset, overrides)),
|
|
25
|
+
get: () => current.preset
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
export { useTheme };
|
|
29
|
+
|
|
30
|
+
//# sourceMappingURL=use-theme.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-theme.js","names":[],"sources":["../../src/composables/use-theme.ts"],"sourcesContent":["import { createTheme, definePreset } from '@momo-framework/themes'\nimport type { Preset, PresetOverrides, ThemeOptions } from '@momo-framework/themes'\nimport { computed } from 'vue'\nimport { applyPreset, current } from '../config.ts'\n\nconst state = computed(() => ({ name: current.preset.name, options: current.preset.options }))\n\nexport function useTheme() {\n const write = (preset: Preset) => applyPreset(preset, current.css)\n\n return {\n state,\n use: (preset: Preset, keep = true) => {\n const { primary, surface, density, ripple, inputVariant } = current.preset.options\n write(keep ? createTheme(preset, { primary, surface: surface as ThemeOptions['surface'], density, ripple, inputVariant }) : preset)\n },\n set: (options: ThemeOptions) => write(createTheme(current.preset, options)),\n update: (overrides: PresetOverrides) => write(definePreset(current.preset, overrides)),\n get: (): Preset => current.preset,\n }\n}\n"],"mappings":";;;;AAKA,IAAM,QAAQ,gBAAgB;CAAE,MAAM,QAAQ,OAAO;CAAM,SAAS,QAAQ,OAAO;AAAQ,EAAE;AAE7F,SAAgB,WAAW;CACzB,MAAM,SAAS,WAAmB,YAAY,QAAQ,QAAQ,GAAG;CAEjE,OAAO;EACL;EACA,MAAM,QAAgB,OAAO,SAAS;GACpC,MAAM,EAAE,SAAS,SAAS,SAAS,QAAQ,iBAAiB,QAAQ,OAAO;GAC3E,MAAM,OAAO,YAAY,QAAQ;IAAE;IAAkB;IAAoC;IAAS;IAAQ;GAAa,CAAC,IAAI,MAAM;EACpI;EACA,MAAM,YAA0B,MAAM,YAAY,QAAQ,QAAQ,OAAO,CAAC;EAC1E,SAAS,cAA+B,MAAM,aAAa,QAAQ,QAAQ,SAAS,CAAC;EACrF,WAAmB,QAAQ;CAC7B;AACF"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// src/composables/view-transition.ts
|
|
2
|
+
function withViewTransition(change, kind = "fade") {
|
|
3
|
+
const doc = typeof document === "undefined" ? void 0 : document;
|
|
4
|
+
const reduced = typeof matchMedia === "function" && matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
5
|
+
if (!doc?.startViewTransition || reduced || doc.visibilityState === "hidden") {
|
|
6
|
+
change();
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
const root = doc.documentElement;
|
|
10
|
+
root.dataset.mTransition = kind;
|
|
11
|
+
doc.startViewTransition(change).finished.finally(() => delete root.dataset.mTransition).catch(() => void 0);
|
|
12
|
+
}
|
|
13
|
+
export { withViewTransition };
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=view-transition.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"view-transition.js","names":[],"sources":["../../src/composables/view-transition.ts"],"sourcesContent":["interface ViewTransition {\n finished: Promise<void>\n}\n\ntype WithTransitions = Document & { startViewTransition?: (update: () => void | Promise<void>) => ViewTransition }\n\nexport type ViewTransitionKind = 'fade' | 'morph'\n\nexport function withViewTransition(change: () => void | Promise<void>, kind: ViewTransitionKind = 'fade'): void {\n const doc = typeof document === 'undefined' ? undefined : document as WithTransitions\n const reduced = typeof matchMedia === 'function' && matchMedia('(prefers-reduced-motion: reduce)').matches\n if (!doc?.startViewTransition || reduced || doc.visibilityState === 'hidden') {\n void change()\n return\n }\n\n const root = doc.documentElement\n root.dataset.mTransition = kind\n const transition = doc.startViewTransition(change)\n void transition.finished.finally(() => delete root.dataset.mTransition).catch(() => undefined)\n}\n"],"mappings":";AAQA,SAAgB,mBAAmB,QAAoC,OAA2B,QAAc;CAC9G,MAAM,MAAM,OAAO,aAAa,cAAc,KAAA,IAAY;CAC1D,MAAM,UAAU,OAAO,eAAe,cAAc,WAAW,kCAAkC,CAAC,CAAC;CACnG,IAAI,CAAC,KAAK,uBAAuB,WAAW,IAAI,oBAAoB,UAAU;EAC5E,OAAY;EACZ;CACF;CAEA,MAAM,OAAO,IAAI;CACjB,KAAK,QAAQ,cAAc;CAE3B,IADuB,oBAAoB,MACtC,CAAA,CAAW,SAAS,cAAc,OAAO,KAAK,QAAQ,WAAW,CAAC,CAAC,YAAY,KAAA,CAAS;AAC/F"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function watchVisible(root: HTMLElement | undefined, selector: string, seen: (elements: HTMLElement[]) => void): () => void;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// src/composables/visible.ts
|
|
2
|
+
function watchVisible(root, selector, seen) {
|
|
3
|
+
if (!root || typeof IntersectionObserver === "undefined") return () => void 0;
|
|
4
|
+
const observer = new IntersectionObserver((entries) => {
|
|
5
|
+
const visible = entries.filter((entry) => entry.isIntersecting && entry.intersectionRatio > .6).map((entry) => entry.target);
|
|
6
|
+
if (visible.length > 0) seen(visible);
|
|
7
|
+
}, {
|
|
8
|
+
root,
|
|
9
|
+
threshold: [.6]
|
|
10
|
+
});
|
|
11
|
+
root.querySelectorAll(selector).forEach((element) => observer.observe(element));
|
|
12
|
+
return () => observer.disconnect();
|
|
13
|
+
}
|
|
14
|
+
export { watchVisible };
|
|
15
|
+
|
|
16
|
+
//# sourceMappingURL=visible.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"visible.js","names":[],"sources":["../../src/composables/visible.ts"],"sourcesContent":["export function watchVisible(root: HTMLElement | undefined, selector: string, seen: (elements: HTMLElement[]) => void): () => void {\n if (!root || typeof IntersectionObserver === 'undefined') {\n return () => undefined\n }\n const observer = new IntersectionObserver((entries) => {\n const visible = entries.filter(entry => entry.isIntersecting && entry.intersectionRatio > 0.6).map(entry => entry.target as HTMLElement)\n if (visible.length > 0) {\n seen(visible)\n }\n }, { root, threshold: [0.6] })\n root.querySelectorAll(selector).forEach(element => observer.observe(element))\n return () => observer.disconnect()\n}\n"],"mappings":";AAAA,SAAgB,aAAa,MAA+B,UAAkB,MAAqD;CACjI,IAAI,CAAC,QAAQ,OAAO,yBAAyB,aAC3C,aAAa,KAAA;CAEf,MAAM,WAAW,IAAI,sBAAsB,YAAY;EACrD,MAAM,UAAU,QAAQ,QAAO,UAAS,MAAM,kBAAkB,MAAM,oBAAoB,EAAG,CAAC,CAAC,KAAI,UAAS,MAAM,MAAqB;EACvI,IAAI,QAAQ,SAAS,GACnB,KAAK,OAAO;CAEhB,GAAG;EAAE;EAAM,WAAW,CAAC,EAAG;CAAE,CAAC;CAC7B,KAAK,iBAAiB,QAAQ,CAAC,CAAC,SAAQ,YAAW,SAAS,QAAQ,OAAO,CAAC;CAC5E,aAAa,SAAS,WAAW;AACnC"}
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { CssOptions, Preset, ThemeOptions } from '@momo-framework/themes';
|
|
2
|
+
import type { App, InjectionKey } from 'vue';
|
|
3
|
+
import type { ColorModeSource } from './composables/theme.js';
|
|
4
|
+
import type { ComponentDefaults } from './composables/defaults.js';
|
|
5
|
+
import type { Translator, VueI18nLike } from './i18n.js';
|
|
6
|
+
import type { MotionOptions } from './motion/install.js';
|
|
7
|
+
import type { OverlayMotion } from './motion/overlays.js';
|
|
8
|
+
import type { IconData, IconifyIcon } from './icons/types.js';
|
|
9
|
+
import type { GlobalPassThrough } from './pt.js';
|
|
10
|
+
export interface IconOptions {
|
|
11
|
+
bridge?: string | null;
|
|
12
|
+
fallbackToApi?: boolean;
|
|
13
|
+
apiEndpoint?: string;
|
|
14
|
+
collections?: Record<string, Record<string, IconData | IconifyIcon>>;
|
|
15
|
+
}
|
|
16
|
+
export interface IconConfig {
|
|
17
|
+
bridge: string | null;
|
|
18
|
+
fallbackToApi: boolean;
|
|
19
|
+
apiEndpoint: string;
|
|
20
|
+
}
|
|
21
|
+
export interface MomoUIOptions {
|
|
22
|
+
preset?: Preset | false;
|
|
23
|
+
current?: Preset;
|
|
24
|
+
theme?: ThemeOptions;
|
|
25
|
+
css?: CssOptions;
|
|
26
|
+
dir?: 'ltr' | 'rtl';
|
|
27
|
+
unstyled?: boolean;
|
|
28
|
+
pt?: GlobalPassThrough;
|
|
29
|
+
ptOptions?: {
|
|
30
|
+
mergeSections?: boolean;
|
|
31
|
+
mergeProps?: boolean;
|
|
32
|
+
};
|
|
33
|
+
locale?: string;
|
|
34
|
+
i18n?: VueI18nLike | false;
|
|
35
|
+
colorMode?: ColorModeSource;
|
|
36
|
+
prefix?: string;
|
|
37
|
+
components?: boolean;
|
|
38
|
+
motion?: MotionOptions | false;
|
|
39
|
+
defaults?: ComponentDefaults;
|
|
40
|
+
reset?: boolean;
|
|
41
|
+
icons?: IconOptions;
|
|
42
|
+
}
|
|
43
|
+
export interface MomoUIConfig {
|
|
44
|
+
unstyled: boolean;
|
|
45
|
+
dir: 'ltr' | 'rtl' | null;
|
|
46
|
+
pt: GlobalPassThrough;
|
|
47
|
+
ptOptions: {
|
|
48
|
+
mergeSections: boolean;
|
|
49
|
+
mergeProps: boolean;
|
|
50
|
+
};
|
|
51
|
+
i18n: Translator;
|
|
52
|
+
motion: OverlayMotion | false;
|
|
53
|
+
defaults: ComponentDefaults;
|
|
54
|
+
icons: IconConfig;
|
|
55
|
+
}
|
|
56
|
+
export declare const CONFIG: InjectionKey<MomoUIConfig>;
|
|
57
|
+
export declare function createConfig(options?: MomoUIOptions): MomoUIConfig;
|
|
58
|
+
export declare function useConfig(): MomoUIConfig;
|
|
59
|
+
export declare function applyPreset(preset: Preset, options?: CssOptions): void;
|
|
60
|
+
export declare const current: {
|
|
61
|
+
preset: Preset;
|
|
62
|
+
css: CssOptions;
|
|
63
|
+
};
|
|
64
|
+
export declare function install(app: App, options?: MomoUIOptions, components?: Record<string, object>): MomoUIConfig;
|
|
65
|
+
export declare function useT(): Translator['t'];
|
package/dist/config.js
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { useColorModeSource } from "./composables/theme.js";
|
|
2
|
+
import { createTranslator, directionOf, fromVueI18n } from "./i18n.js";
|
|
3
|
+
import { installMotion } from "./motion/install.js";
|
|
4
|
+
import { registerIconCollection } from "./icons/registry.js";
|
|
5
|
+
import { createTheme, material, toCss } from "@momo-framework/themes";
|
|
6
|
+
import { inject, markRaw, reactive, shallowReactive, watch } from "vue";
|
|
7
|
+
// src/config.ts
|
|
8
|
+
var ICON_DEFAULTS = {
|
|
9
|
+
bridge: null,
|
|
10
|
+
fallbackToApi: true,
|
|
11
|
+
apiEndpoint: "https://api.iconify.design"
|
|
12
|
+
};
|
|
13
|
+
function iconConfig(options = {}) {
|
|
14
|
+
return {
|
|
15
|
+
bridge: options.bridge ?? ICON_DEFAULTS.bridge,
|
|
16
|
+
fallbackToApi: options.fallbackToApi ?? ICON_DEFAULTS.fallbackToApi,
|
|
17
|
+
apiEndpoint: (options.apiEndpoint ?? ICON_DEFAULTS.apiEndpoint).replace(/\/+$/, "")
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
var CONFIG = Symbol("momo-ui");
|
|
21
|
+
var STYLE_ID = "momo-tokens";
|
|
22
|
+
var fallback = reactive({
|
|
23
|
+
unstyled: false,
|
|
24
|
+
dir: null,
|
|
25
|
+
pt: {},
|
|
26
|
+
ptOptions: {
|
|
27
|
+
mergeSections: true,
|
|
28
|
+
mergeProps: true
|
|
29
|
+
},
|
|
30
|
+
i18n: markRaw(createTranslator()),
|
|
31
|
+
motion: {},
|
|
32
|
+
defaults: {},
|
|
33
|
+
icons: iconConfig()
|
|
34
|
+
});
|
|
35
|
+
function createConfig(options = {}) {
|
|
36
|
+
return reactive({
|
|
37
|
+
unstyled: options.unstyled ?? false,
|
|
38
|
+
dir: options.dir ?? null,
|
|
39
|
+
pt: options.pt ?? {},
|
|
40
|
+
ptOptions: {
|
|
41
|
+
mergeSections: true,
|
|
42
|
+
mergeProps: true,
|
|
43
|
+
...options.ptOptions
|
|
44
|
+
},
|
|
45
|
+
i18n: markRaw(createTranslator(options.locale)),
|
|
46
|
+
motion: {},
|
|
47
|
+
defaults: options.defaults ?? {},
|
|
48
|
+
icons: iconConfig(options.icons)
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
function translatorFor(app, options) {
|
|
52
|
+
const external = options.i18n === false ? void 0 : options.i18n ?? app.config.globalProperties.$i18n;
|
|
53
|
+
return markRaw(external ? fromVueI18n(external) : createTranslator(options.locale));
|
|
54
|
+
}
|
|
55
|
+
function useConfig() {
|
|
56
|
+
return inject(CONFIG, fallback);
|
|
57
|
+
}
|
|
58
|
+
function applyPreset(preset, options = {}) {
|
|
59
|
+
current.preset = preset;
|
|
60
|
+
current.css = options;
|
|
61
|
+
if (typeof document === "undefined") return;
|
|
62
|
+
let style = document.getElementById(STYLE_ID);
|
|
63
|
+
if (!style) {
|
|
64
|
+
style = document.createElement("style");
|
|
65
|
+
style.id = STYLE_ID;
|
|
66
|
+
document.head.append(style);
|
|
67
|
+
}
|
|
68
|
+
style.textContent = toCss(preset, options);
|
|
69
|
+
document.documentElement.dataset.preset = preset.name;
|
|
70
|
+
}
|
|
71
|
+
var current = shallowReactive({
|
|
72
|
+
preset: material,
|
|
73
|
+
css: {}
|
|
74
|
+
});
|
|
75
|
+
function install(app, options = {}, components = {}) {
|
|
76
|
+
const config = createConfig(options);
|
|
77
|
+
for (const [prefix, icons] of Object.entries(options.icons?.collections ?? {})) registerIconCollection(prefix, icons);
|
|
78
|
+
config.i18n = translatorFor(app, options);
|
|
79
|
+
config.motion = installMotion(app, options.motion, config.unstyled);
|
|
80
|
+
useColorModeSource(options.colorMode ?? null);
|
|
81
|
+
app.provide(CONFIG, config);
|
|
82
|
+
app.config.globalProperties.$momo = config;
|
|
83
|
+
const preset = options.preset ?? material;
|
|
84
|
+
if (preset === false && options.current) {
|
|
85
|
+
current.preset = options.current;
|
|
86
|
+
current.css = options.css ?? {};
|
|
87
|
+
}
|
|
88
|
+
if (preset !== false) applyPreset(options.theme ? createTheme(preset, options.theme) : preset, options.css);
|
|
89
|
+
if (typeof document !== "undefined") {
|
|
90
|
+
if (options.reset === false) document.documentElement.dataset.mReset = "off";
|
|
91
|
+
if (options.dir) document.documentElement.dir = options.dir;
|
|
92
|
+
else watch(config.i18n.locale, (code) => {
|
|
93
|
+
document.documentElement.lang = code;
|
|
94
|
+
document.documentElement.dir = directionOf(code);
|
|
95
|
+
}, { immediate: true });
|
|
96
|
+
}
|
|
97
|
+
if (options.components !== false) {
|
|
98
|
+
const prefix = options.prefix ?? "M";
|
|
99
|
+
for (const [name, component] of Object.entries(components)) app.component(`${prefix}${name}`, component);
|
|
100
|
+
}
|
|
101
|
+
return config;
|
|
102
|
+
}
|
|
103
|
+
function useT() {
|
|
104
|
+
const config = useConfig();
|
|
105
|
+
return (key, params) => config.i18n.t(key, params);
|
|
106
|
+
}
|
|
107
|
+
export { CONFIG, applyPreset, createConfig, current, install, useConfig, useT };
|
|
108
|
+
|
|
109
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","names":[],"sources":["../src/config.ts"],"sourcesContent":["import { createTheme, material, toCss } from '@momo-framework/themes'\nimport type { CssOptions, Preset, ThemeOptions } from '@momo-framework/themes'\nimport { inject, markRaw, reactive, shallowReactive, watch } from 'vue'\nimport type { App, InjectionKey } from 'vue'\nimport { useColorModeSource } from './composables/theme.ts'\nimport type { ColorModeSource } from './composables/theme.ts'\nimport type { ComponentDefaults } from './composables/defaults.ts'\nimport { createTranslator, directionOf, fromVueI18n } from './i18n.ts'\nimport type { Translator, VueI18nLike } from './i18n.ts'\nimport { installMotion } from './motion/install.ts'\nimport type { MotionOptions } from './motion/install.ts'\nimport type { OverlayMotion } from './motion/overlays.ts'\nimport { registerIconCollection } from './icons/registry.ts'\nimport type { IconData, IconifyIcon } from './icons/types.ts'\nimport type { GlobalPassThrough } from './pt.ts'\n\nexport interface IconOptions {\n bridge?: string | null\n fallbackToApi?: boolean\n apiEndpoint?: string\n collections?: Record<string, Record<string, IconData | IconifyIcon>>\n}\n\nexport interface IconConfig {\n bridge: string | null\n fallbackToApi: boolean\n apiEndpoint: string\n}\n\nconst ICON_DEFAULTS: IconConfig = { bridge: null, fallbackToApi: true, apiEndpoint: 'https://api.iconify.design' }\n\nfunction iconConfig(options: IconOptions = {}): IconConfig {\n return {\n bridge: options.bridge ?? ICON_DEFAULTS.bridge,\n fallbackToApi: options.fallbackToApi ?? ICON_DEFAULTS.fallbackToApi,\n apiEndpoint: (options.apiEndpoint ?? ICON_DEFAULTS.apiEndpoint).replace(/\\/+$/, ''),\n }\n}\n\nexport interface MomoUIOptions {\n preset?: Preset | false\n current?: Preset\n theme?: ThemeOptions\n css?: CssOptions\n dir?: 'ltr' | 'rtl'\n unstyled?: boolean\n pt?: GlobalPassThrough\n ptOptions?: {\n mergeSections?: boolean\n mergeProps?: boolean\n }\n locale?: string\n i18n?: VueI18nLike | false\n colorMode?: ColorModeSource\n prefix?: string\n components?: boolean\n motion?: MotionOptions | false\n defaults?: ComponentDefaults\n reset?: boolean\n icons?: IconOptions\n}\n\nexport interface MomoUIConfig {\n unstyled: boolean\n dir: 'ltr' | 'rtl' | null\n pt: GlobalPassThrough\n ptOptions: { mergeSections: boolean, mergeProps: boolean }\n i18n: Translator\n motion: OverlayMotion | false\n defaults: ComponentDefaults\n icons: IconConfig\n}\n\nexport const CONFIG: InjectionKey<MomoUIConfig> = Symbol('momo-ui')\n\nconst STYLE_ID = 'momo-tokens'\n\nconst fallback: MomoUIConfig = reactive({\n unstyled: false,\n dir: null,\n pt: {},\n ptOptions: { mergeSections: true, mergeProps: true },\n i18n: markRaw(createTranslator()),\n motion: {},\n defaults: {},\n icons: iconConfig(),\n})\n\nexport function createConfig(options: MomoUIOptions = {}): MomoUIConfig {\n return reactive({\n unstyled: options.unstyled ?? false,\n dir: options.dir ?? null,\n pt: options.pt ?? {},\n ptOptions: { mergeSections: true, mergeProps: true, ...options.ptOptions },\n i18n: markRaw(createTranslator(options.locale)),\n motion: {},\n defaults: options.defaults ?? {},\n icons: iconConfig(options.icons),\n })\n}\n\nfunction translatorFor(app: App, options: MomoUIOptions): Translator {\n const external = options.i18n === false ? undefined : options.i18n ?? (app.config.globalProperties as { $i18n?: VueI18nLike }).$i18n\n return markRaw(external ? fromVueI18n(external) : createTranslator(options.locale))\n}\n\nexport function useConfig(): MomoUIConfig {\n return inject(CONFIG, fallback)\n}\n\nexport function applyPreset(preset: Preset, options: CssOptions = {}): void {\n current.preset = preset\n current.css = options\n if (typeof document === 'undefined') {\n return\n }\n\n let style = document.getElementById(STYLE_ID) as HTMLStyleElement | null\n if (!style) {\n style = document.createElement('style')\n style.id = STYLE_ID\n document.head.append(style)\n }\n style.textContent = toCss(preset, options)\n document.documentElement.dataset.preset = preset.name\n}\n\nexport const current: { preset: Preset, css: CssOptions } = shallowReactive({ preset: material, css: {} })\n\nexport function install(app: App, options: MomoUIOptions = {}, components: Record<string, object> = {}): MomoUIConfig {\n const config = createConfig(options)\n for (const [prefix, icons] of Object.entries(options.icons?.collections ?? {})) {\n registerIconCollection(prefix, icons)\n }\n config.i18n = translatorFor(app, options)\n config.motion = installMotion(app, options.motion, config.unstyled)\n useColorModeSource(options.colorMode ?? null)\n app.provide(CONFIG, config)\n app.config.globalProperties.$momo = config\n\n const preset = options.preset ?? material\n if (preset === false && options.current) {\n current.preset = options.current\n current.css = options.css ?? {}\n }\n if (preset !== false) {\n applyPreset(options.theme ? createTheme(preset, options.theme) : preset, options.css)\n }\n if (typeof document !== 'undefined') {\n if (options.reset === false) {\n document.documentElement.dataset.mReset = 'off'\n }\n if (options.dir) {\n document.documentElement.dir = options.dir\n }\n else {\n watch(config.i18n.locale, (code) => {\n document.documentElement.lang = code\n document.documentElement.dir = directionOf(code)\n }, { immediate: true })\n }\n }\n\n if (options.components !== false) {\n const prefix = options.prefix ?? 'M'\n for (const [name, component] of Object.entries(components)) {\n app.component(`${prefix}${name}`, component)\n }\n }\n\n return config\n}\n\nexport function useT(): Translator['t'] {\n const config = useConfig()\n return (key, params) => config.i18n.t(key, params)\n}\n"],"mappings":"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"}
|