yc-design-vue 1.8.7 → 1.8.9
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/es/Affix/index.vue.js +1 -0
- package/es/Alert/index.d.ts +3 -3
- package/es/Alert/index.vue.d.ts +1 -1
- package/es/Alert/index.vue.js +1 -0
- package/es/Anchor/Anchor.vue.js +1 -0
- package/es/Anchor/AnchorLink.vue.js +1 -0
- package/es/Anchor/hooks/useContext.js +1 -0
- package/es/AutoComplete/index.d.ts +19 -19
- package/es/AutoComplete/index.vue.d.ts +33 -33
- package/es/AutoComplete/index.vue.js +1 -0
- package/es/Avatar/Avatar.vue.d.ts +2 -2
- package/es/Avatar/Avatar.vue.js +1 -0
- package/es/Avatar/AvatarGroup.vue.js +1 -0
- package/es/Avatar/index.d.ts +5 -5
- package/es/BackTop/index.vue.js +1 -0
- package/es/Badge/index.vue.js +1 -0
- package/es/Breadcrumb/Breadcrumb.vue.js +1 -0
- package/es/Breadcrumb/BreadcrumbItem.vue.js +1 -0
- package/es/Breadcrumb/BreadcrumbMore.vue.js +1 -0
- package/es/Breadcrumb/BreadcrumbSeparator.vue.js +1 -0
- package/es/Button/Button.vue.d.ts +3 -3
- package/es/Button/ButtonGroup.vue.d.ts +1 -1
- package/es/Button/hooks/useContext.js +1 -0
- package/es/Button/index.d.ts +12 -12
- package/es/Calendar/Calendar.vue.js +2 -1
- package/es/Calendar/CalendarMonth.vue.d.ts +1 -1
- package/es/Calendar/CalendarMonth.vue.js +1 -1
- package/es/Calendar/CalendarYear.vue.js +1 -1
- package/es/Card/Card.vue.d.ts +1 -1
- package/es/Card/Card.vue.js +1 -0
- package/es/Card/CardMeta.vue.d.ts +1 -1
- package/es/Card/CardMeta.vue.js +1 -0
- package/es/Card/index.d.ts +6 -6
- package/es/Carousel/Carousel.vue.js +1 -0
- package/es/Carousel/CarouselArrow.vue.js +1 -0
- package/es/Carousel/CarouselIndicator.vue.js +1 -0
- package/es/Carousel/hooks/useContext.js +1 -0
- package/es/Cascader/Cascader.vue.d.ts +17 -17
- package/es/Cascader/Cascader.vue.js +1 -0
- package/es/Cascader/CascaderIcon.vue.js +1 -0
- package/es/Cascader/CascaderOption.vue.js +1 -0
- package/es/Cascader/CascaderPanel.vue.js +1 -0
- package/es/Cascader/CascaderSearchPanel.vue.js +1 -0
- package/es/Cascader/hooks/useContext.js +1 -0
- package/es/Cascader/index.d.ts +16 -16
- package/es/Checkbox/Checkbox.vue.js +1 -0
- package/es/Checkbox/CheckboxGroup.vue.d.ts +1 -1
- package/es/Checkbox/hooks/useContext.js +1 -0
- package/es/Checkbox/index.d.ts +3 -3
- package/es/Collapse/CollapseItem.vue.js +1 -0
- package/es/Collapse/hooks/useContext.js +1 -0
- package/es/ColorPicker/ColorControl.vue.js +1 -0
- package/es/ColorPicker/ColorInput.vue.js +1 -0
- package/es/ColorPicker/ColorList.vue.js +7 -1
- package/es/ColorPicker/ColorPalette.vue.js +1 -0
- package/es/ColorPicker/ColorPanel.vue.js +7 -1
- package/es/ColorPicker/hooks/useContext.js +1 -0
- package/es/Comment/index.vue.js +1 -0
- package/es/ConfigProvider/index.d.ts +3 -3
- package/es/ConfigProvider/index.vue.d.ts +1 -1
- package/es/ConfigProvider/index.vue.js +4 -12
- package/es/ConfigProvider/type.d.ts +3 -2
- package/es/Descriptions/ReuseItem.vue.js +1 -0
- package/es/Descriptions/ReuseTd.vue.js +1 -0
- package/es/Descriptions/hooks/useContext.js +1 -0
- package/es/Divider/index.d.ts +3 -3
- package/es/Divider/index.vue.d.ts +1 -1
- package/es/Divider/index.vue.js +1 -0
- package/es/Drawer/Drawer.vue.d.ts +4 -4
- package/es/Drawer/Drawer.vue.js +2 -1
- package/es/Drawer/DrawerService.vue.d.ts +2 -2
- package/es/Drawer/DrawerService.vue.js +1 -0
- package/es/Drawer/index.d.ts +11 -11
- package/es/Dropdown/Dropdown.vue.js +1 -0
- package/es/Dropdown/DropdownButton.vue.d.ts +1 -1
- package/es/Dropdown/DropdownButton.vue.js +1 -0
- package/es/Dropdown/Dsubmenu.vue.js +1 -0
- package/es/Dropdown/hooks/useContext.js +1 -0
- package/es/Dropdown/index.d.ts +3 -3
- package/es/Empty/index.vue.js +2 -1
- package/es/Grid/Grid.vue.js +1 -0
- package/es/Grid/GridCol.vue.js +1 -0
- package/es/Grid/GridItem.vue.js +1 -0
- package/es/Grid/GridRow.vue.js +1 -0
- package/es/Grid/hooks/useContext.js +1 -0
- package/es/Image/Image.vue.d.ts +2 -2
- package/es/Image/Image.vue.js +2 -1
- package/es/Image/ImagePreview.vue.js +1 -0
- package/es/Image/ImagePreviewArrow.vue.js +1 -0
- package/es/Image/ImagePreviewToolbar.vue.js +8 -7
- package/es/Image/hooks/useContext.js +1 -0
- package/es/Image/index.d.ts +6 -6
- package/es/Input/Input.vue.d.ts +3 -3
- package/es/Input/Input.vue.js +1 -0
- package/es/Input/InputSuffix.vue.js +1 -0
- package/es/Input/hooks/useLimitedInput.js +1 -0
- package/es/Input/index.d.ts +9 -9
- package/es/InputNumber/InputNumber.vue.d.ts +18 -18
- package/es/InputNumber/InputNumber.vue.js +1 -0
- package/es/InputNumber/InputOperaBtn.vue.js +1 -0
- package/es/InputNumber/index.d.ts +19 -19
- package/es/InputTag/index.d.ts +6 -6
- package/es/InputTag/index.vue.d.ts +2 -2
- package/es/InputTag/index.vue.js +1 -0
- package/es/Layout/Layout.vue.js +1 -0
- package/es/Layout/LayoutSider.vue.js +1 -0
- package/es/Layout/hooks/useSiderContext.js +1 -0
- package/es/Link/index.d.ts +3 -3
- package/es/Link/index.vue.d.ts +1 -1
- package/es/Link/index.vue.js +1 -0
- package/es/List/List.vue.d.ts +7 -7
- package/es/List/List.vue.js +1 -0
- package/es/List/ListItemMeta.vue.d.ts +1 -1
- package/es/List/hooks/useScrollReach.js +1 -0
- package/es/List/index.d.ts +9 -9
- package/es/Mention/index.d.ts +22 -22
- package/es/Mention/index.vue.d.ts +39 -39
- package/es/Mention/index.vue.js +1 -0
- package/es/Menu/Menu.vue.js +1 -0
- package/es/Menu/MenuEllipsis.vue.js +1 -0
- package/es/Menu/MenuItem.vue.js +1 -0
- package/es/Menu/MenuItemGroup.vue.js +1 -0
- package/es/Menu/SubMenu.vue.js +1 -0
- package/es/Menu/hooks/useContext.js +1 -0
- package/es/Message/Message.vue.d.ts +1 -1
- package/es/Message/Message.vue.js +1 -0
- package/es/Message/index.d.ts +3 -3
- package/es/Message/index.js +1 -0
- package/es/Modal/Modal.vue.d.ts +4 -4
- package/es/Modal/Modal.vue.js +2 -1
- package/es/Modal/ModalService.vue.d.ts +2 -2
- package/es/Modal/ModalService.vue.js +1 -0
- package/es/Modal/hooks/useModalClose.js +1 -0
- package/es/Modal/hooks/useModalDraggable.js +1 -0
- package/es/Modal/hooks/useOnBeforeClose.js +1 -0
- package/es/Modal/index.d.ts +11 -11
- package/es/Notification/Notification.vue.d.ts +1 -1
- package/es/Notification/Notification.vue.js +1 -0
- package/es/Notification/index.d.ts +3 -3
- package/es/Notification/index.js +1 -0
- package/es/OverflowList/index.d.ts +3 -3
- package/es/OverflowList/index.vue.d.ts +1 -1
- package/es/OverflowList/index.vue.js +1 -0
- package/es/PageHeader/index.vue.js +1 -0
- package/es/Pagination/Pagination.vue.js +6 -2
- package/es/Pagination/PaginationItem.vue.js +1 -0
- package/es/Pagination/hooks/useContext.d.ts +1 -256
- package/es/Pagination/hooks/useContext.js +2 -1
- package/es/Popconfirm/index.d.ts +19 -19
- package/es/Popconfirm/index.vue.d.ts +7 -7
- package/es/Popconfirm/index.vue.js +2 -1
- package/es/Popover/index.vue.js +1 -0
- package/es/Progress/Progress.vue.d.ts +1 -1
- package/es/Progress/Progress.vue.js +1 -0
- package/es/Progress/ProgressCircle.vue.js +1 -0
- package/es/Progress/ProgressLine.vue.js +1 -0
- package/es/Progress/ProgressSteps.vue.js +1 -0
- package/es/Progress/index.d.ts +3 -3
- package/es/Radio/Radio.vue.d.ts +1 -1
- package/es/Radio/Radio.vue.js +1 -0
- package/es/Radio/RadioGroup.vue.d.ts +1 -1
- package/es/Radio/hooks/useContext.js +1 -0
- package/es/Radio/index.d.ts +6 -6
- package/es/Rate/index.vue.js +1 -0
- package/es/ResizeBox/index.vue.js +1 -0
- package/es/Scrollbar/Scrollbar.vue.d.ts +1 -1
- package/es/Scrollbar/Scrollbar.vue.js +1 -0
- package/es/Scrollbar/ScrollbarTrack.vue.js +1 -0
- package/es/Scrollbar/index.d.ts +3 -3
- package/es/Select/Option.vue.js +1 -0
- package/es/Select/Select.vue.d.ts +26 -26
- package/es/Select/Select.vue.js +1 -0
- package/es/Select/SelectIcon.vue.js +1 -0
- package/es/Select/SelectRealList.vue.js +1 -0
- package/es/Select/SelectView.vue.js +1 -0
- package/es/Select/SelectVirtualList.vue.js +1 -0
- package/es/Select/hooks/useContext.js +1 -0
- package/es/Select/hooks/useSelectOptions.js +1 -0
- package/es/Select/index.d.ts +14 -14
- package/es/Skeleton/SkeletonLine.vue.js +1 -0
- package/es/Skeleton/SkeletonShape.vue.js +1 -0
- package/es/Slider/Slider.vue.d.ts +3 -3
- package/es/Slider/SliderBtn.vue.js +1 -0
- package/es/Slider/hooks/useContext.js +1 -0
- package/es/Slider/hooks/useSliderDraggable.js +1 -0
- package/es/Slider/index.d.ts +9 -9
- package/es/Space/index.d.ts +3 -3
- package/es/Space/index.vue.d.ts +1 -1
- package/es/Space/index.vue.js +1 -0
- package/es/Spin/index.d.ts +3 -3
- package/es/Spin/index.vue.d.ts +1 -1
- package/es/Spin/index.vue.js +1 -0
- package/es/Split/index.d.ts +6 -6
- package/es/Split/index.vue.d.ts +2 -2
- package/es/Split/index.vue.js +1 -0
- package/es/Statistic/Countdown.vue.d.ts +2 -2
- package/es/Statistic/Countdown.vue.js +1 -0
- package/es/Statistic/Statistic.vue.d.ts +2 -2
- package/es/Statistic/Statistic.vue.js +1 -0
- package/es/Statistic/index.d.ts +12 -12
- package/es/Steps/Step.vue.d.ts +1 -1
- package/es/Steps/Step.vue.js +1 -0
- package/es/Steps/Steps.vue.d.ts +1 -1
- package/es/Steps/hooks/useContext.js +1 -0
- package/es/Steps/index.d.ts +6 -6
- package/es/Switch/index.d.ts +6 -6
- package/es/Switch/index.vue.d.ts +2 -2
- package/es/Switch/index.vue.js +1 -0
- package/es/Tabs/TabButton.vue.js +1 -0
- package/es/Tabs/TabPane.vue.js +1 -0
- package/es/Tabs/Tabs.vue.d.ts +3 -3
- package/es/Tabs/Tabs.vue.js +1 -0
- package/es/Tabs/TabsNavInk.vue.js +1 -0
- package/es/Tabs/TabsTab.vue.js +1 -0
- package/es/Tabs/hooks/useContext.js +1 -0
- package/es/Tabs/hooks/useTabsScroll.js +1 -0
- package/es/Tabs/index.d.ts +8 -8
- package/es/Tag/index.d.ts +3 -3
- package/es/Tag/index.vue.d.ts +1 -1
- package/es/Tag/index.vue.js +1 -0
- package/es/Textarea/hooks/useTextareaHeight.js +1 -0
- package/es/Textarea/index.d.ts +6 -6
- package/es/Textarea/index.vue.d.ts +2 -2
- package/es/Textarea/index.vue.js +1 -0
- package/es/TimePicker/TimePicker.vue.d.ts +3 -3
- package/es/TimePicker/TimePicker.vue.js +6 -6
- package/es/TimePicker/TimePickerPanel.vue.js +10 -10
- package/es/TimePicker/hooks/useContext.d.ts +1 -0
- package/es/TimePicker/hooks/useContext.js +11 -2
- package/es/TimePicker/index.d.ts +9 -9
- package/es/Timeline/TimelineItemPending.vue.js +1 -0
- package/es/Timeline/hooks/useContext.js +1 -0
- package/es/Tooltip/index.vue.js +1 -0
- package/es/Transfer/Transfer.vue.js +1 -0
- package/es/Transfer/TransferPanel.vue.js +1 -0
- package/es/Transfer/hooks/useContext.js +1 -0
- package/es/Trigger/hooks/useContext.js +1 -0
- package/es/Trigger/hooks/useTriggerPosition.js +1 -0
- package/es/Trigger/hooks/useTriggerVisible.js +1 -0
- package/es/Trigger/index.vue.js +1 -0
- package/es/Typography/TypographyBase.vue.d.ts +19 -19
- package/es/Typography/TypographyBase.vue.js +2 -1
- package/es/VerificationCode/index.d.ts +6 -6
- package/es/VerificationCode/index.vue.d.ts +2 -2
- package/es/VerificationCode/index.vue.js +1 -0
- package/es/Watermark/index.d.ts +3 -3
- package/es/Watermark/index.vue.d.ts +1 -1
- package/es/Watermark/index.vue.js +1 -0
- package/es/_lang/ar-eg.d.ts +206 -0
- package/es/_lang/de-de.d.ts +206 -0
- package/es/_lang/en-us.d.ts +254 -0
- package/es/_lang/es-es.d.ts +206 -0
- package/es/_lang/fr-fr.d.ts +206 -0
- package/es/_lang/id-id.d.ts +206 -0
- package/es/_lang/index.css +0 -0
- package/es/_lang/interface.d.ts +151 -0
- package/es/_lang/it-it.d.ts +206 -0
- package/es/_lang/ja-jp.d.ts +254 -0
- package/es/_lang/km-kh.d.ts +206 -0
- package/es/_lang/ko-kr.d.ts +206 -0
- package/es/_lang/ms-my.d.ts +206 -0
- package/es/_lang/nl-nl.d.ts +254 -0
- package/es/_lang/pt-pt.d.ts +206 -0
- package/es/_lang/ru-ru.d.ts +254 -0
- package/es/_lang/th-th.d.ts +206 -0
- package/es/_lang/vi-vn.d.ts +206 -0
- package/es/{_shared/locale/lang → _lang}/zh-cn.d.ts +39 -38
- package/es/_lang/zh-cn.js +202 -0
- package/es/_lang/zh-tw.d.ts +254 -0
- package/es/_shared/components/ExpandTransition.vue2.js +1 -0
- package/es/_shared/components/Icon.vue3.js +1 -0
- package/es/_shared/components/IconButton.vue.js +1 -0
- package/es/_shared/constants/index.js +1 -0
- package/es/_shared/icons/IconFullScreen.vue.js +1 -17
- package/es/_shared/icons/IconFullScreen.vue2.js +17 -1
- package/es/_shared/icons/IconOriginSize.vue.js +1 -23
- package/es/_shared/icons/IconOriginSize.vue2.js +23 -1
- package/es/_shared/icons/IconRotateLeft.vue.js +1 -17
- package/es/_shared/icons/IconRotateLeft.vue2.js +17 -1
- package/es/_shared/icons/IconRotateRight.vue.js +1 -17
- package/es/_shared/icons/IconRotateRight.vue2.js +17 -1
- package/es/_shared/icons/IconZoomIn.vue.js +1 -17
- package/es/_shared/icons/IconZoomIn.vue2.js +17 -1
- package/es/_shared/icons/IconZoomOut.vue.js +1 -17
- package/es/_shared/icons/IconZoomOut.vue2.js +17 -1
- package/es/_shared/utils/control.js +1 -0
- package/es/_shared/utils/global-config.d.ts +3 -1
- package/es/_shared/utils/global-config.js +4 -0
- package/es/_shared/utils/index.d.ts +1 -0
- package/es/_shared/utils/locale.d.ts +22 -0
- package/es/_shared/utils/locale.js +39 -0
- package/es/index.d.ts +27 -27
- package/es/index.js +0 -2
- package/lib/Affix/index.vue.js +1 -1
- package/lib/Alert/index.d.ts +3 -3
- package/lib/Alert/index.vue.d.ts +1 -1
- package/lib/Alert/index.vue.js +1 -1
- package/lib/Anchor/Anchor.vue.js +1 -1
- package/lib/Anchor/AnchorLink.vue.js +1 -1
- package/lib/Anchor/hooks/useContext.js +1 -1
- package/lib/AutoComplete/index.d.ts +19 -19
- package/lib/AutoComplete/index.vue.d.ts +33 -33
- package/lib/AutoComplete/index.vue.js +1 -1
- package/lib/Avatar/Avatar.vue.d.ts +2 -2
- package/lib/Avatar/Avatar.vue.js +1 -1
- package/lib/Avatar/AvatarGroup.vue.js +1 -1
- package/lib/Avatar/index.d.ts +5 -5
- package/lib/BackTop/index.vue.js +1 -1
- package/lib/Badge/index.vue.js +1 -1
- package/lib/Breadcrumb/Breadcrumb.vue.js +1 -1
- package/lib/Breadcrumb/BreadcrumbItem.vue.js +1 -1
- package/lib/Breadcrumb/BreadcrumbMore.vue.js +1 -1
- package/lib/Breadcrumb/BreadcrumbSeparator.vue.js +1 -1
- package/lib/Button/Button.vue.d.ts +3 -3
- package/lib/Button/ButtonGroup.vue.d.ts +1 -1
- package/lib/Button/hooks/useContext.js +1 -1
- package/lib/Button/index.d.ts +12 -12
- package/lib/Calendar/Calendar.vue.js +1 -1
- package/lib/Calendar/CalendarMonth.vue.d.ts +1 -1
- package/lib/Calendar/CalendarMonth.vue.js +1 -1
- package/lib/Calendar/CalendarYear.vue.js +1 -1
- package/lib/Card/Card.vue.d.ts +1 -1
- package/lib/Card/Card.vue.js +1 -1
- package/lib/Card/CardMeta.vue.d.ts +1 -1
- package/lib/Card/CardMeta.vue.js +1 -1
- package/lib/Card/index.d.ts +6 -6
- package/lib/Carousel/Carousel.vue.js +1 -1
- package/lib/Carousel/CarouselArrow.vue.js +1 -1
- package/lib/Carousel/CarouselIndicator.vue.js +1 -1
- package/lib/Carousel/hooks/useContext.js +1 -1
- package/lib/Cascader/Cascader.vue.d.ts +17 -17
- package/lib/Cascader/Cascader.vue.js +1 -1
- package/lib/Cascader/CascaderIcon.vue.js +1 -1
- package/lib/Cascader/CascaderOption.vue.js +1 -1
- package/lib/Cascader/CascaderPanel.vue.js +1 -1
- package/lib/Cascader/CascaderSearchPanel.vue.js +1 -1
- package/lib/Cascader/hooks/useContext.js +1 -1
- package/lib/Cascader/index.d.ts +16 -16
- package/lib/Checkbox/Checkbox.vue.js +1 -1
- package/lib/Checkbox/CheckboxGroup.vue.d.ts +1 -1
- package/lib/Checkbox/hooks/useContext.js +1 -1
- package/lib/Checkbox/index.d.ts +3 -3
- package/lib/Collapse/CollapseItem.vue.js +1 -1
- package/lib/Collapse/hooks/useContext.js +1 -1
- package/lib/ColorPicker/ColorControl.vue.js +1 -1
- package/lib/ColorPicker/ColorInput.vue.js +1 -1
- package/lib/ColorPicker/ColorList.vue.js +1 -1
- package/lib/ColorPicker/ColorPalette.vue.js +1 -1
- package/lib/ColorPicker/ColorPanel.vue.js +1 -1
- package/lib/ColorPicker/hooks/useContext.js +1 -1
- package/lib/Comment/index.vue.js +1 -1
- package/lib/ConfigProvider/index.d.ts +3 -3
- package/lib/ConfigProvider/index.vue.d.ts +1 -1
- package/lib/ConfigProvider/index.vue.js +1 -1
- package/lib/ConfigProvider/type.d.ts +3 -2
- package/lib/Descriptions/ReuseItem.vue.js +1 -1
- package/lib/Descriptions/ReuseTd.vue.js +1 -1
- package/lib/Descriptions/hooks/useContext.js +1 -1
- package/lib/Divider/index.d.ts +3 -3
- package/lib/Divider/index.vue.d.ts +1 -1
- package/lib/Divider/index.vue.js +1 -1
- package/lib/Drawer/Drawer.vue.d.ts +4 -4
- package/lib/Drawer/Drawer.vue.js +1 -1
- package/lib/Drawer/DrawerService.vue.d.ts +2 -2
- package/lib/Drawer/DrawerService.vue.js +1 -1
- package/lib/Drawer/index.d.ts +11 -11
- package/lib/Dropdown/Dropdown.vue.js +1 -1
- package/lib/Dropdown/DropdownButton.vue.d.ts +1 -1
- package/lib/Dropdown/DropdownButton.vue.js +1 -1
- package/lib/Dropdown/Dsubmenu.vue.js +1 -1
- package/lib/Dropdown/hooks/useContext.js +1 -1
- package/lib/Dropdown/index.d.ts +3 -3
- package/lib/Empty/index.vue.js +1 -1
- package/lib/Grid/Grid.vue.js +1 -1
- package/lib/Grid/GridCol.vue.js +1 -1
- package/lib/Grid/GridItem.vue.js +1 -1
- package/lib/Grid/GridRow.vue.js +1 -1
- package/lib/Grid/hooks/useContext.js +1 -1
- package/lib/Image/Image.vue.d.ts +2 -2
- package/lib/Image/Image.vue.js +1 -1
- package/lib/Image/ImagePreview.vue.js +1 -1
- package/lib/Image/ImagePreviewArrow.vue.js +1 -1
- package/lib/Image/ImagePreviewToolbar.vue.js +1 -1
- package/lib/Image/hooks/useContext.js +1 -1
- package/lib/Image/index.d.ts +6 -6
- package/lib/Input/Input.vue.d.ts +3 -3
- package/lib/Input/Input.vue.js +1 -1
- package/lib/Input/InputSuffix.vue.js +1 -1
- package/lib/Input/hooks/useLimitedInput.js +1 -1
- package/lib/Input/index.d.ts +9 -9
- package/lib/InputNumber/InputNumber.vue.d.ts +18 -18
- package/lib/InputNumber/InputNumber.vue.js +1 -1
- package/lib/InputNumber/InputOperaBtn.vue.js +1 -1
- package/lib/InputNumber/index.d.ts +19 -19
- package/lib/InputTag/index.d.ts +6 -6
- package/lib/InputTag/index.vue.d.ts +2 -2
- package/lib/InputTag/index.vue.js +1 -1
- package/lib/Layout/Layout.vue.js +1 -1
- package/lib/Layout/LayoutSider.vue.js +1 -1
- package/lib/Layout/hooks/useSiderContext.js +1 -1
- package/lib/Link/index.d.ts +3 -3
- package/lib/Link/index.vue.d.ts +1 -1
- package/lib/Link/index.vue.js +1 -1
- package/lib/List/List.vue.d.ts +7 -7
- package/lib/List/List.vue.js +1 -1
- package/lib/List/ListItemMeta.vue.d.ts +1 -1
- package/lib/List/hooks/useScrollReach.js +1 -1
- package/lib/List/index.d.ts +9 -9
- package/lib/Mention/index.d.ts +22 -22
- package/lib/Mention/index.vue.d.ts +39 -39
- package/lib/Mention/index.vue.js +1 -1
- package/lib/Menu/Menu.vue.js +1 -1
- package/lib/Menu/MenuEllipsis.vue.js +1 -1
- package/lib/Menu/MenuItem.vue.js +1 -1
- package/lib/Menu/MenuItemGroup.vue.js +1 -1
- package/lib/Menu/SubMenu.vue.js +1 -1
- package/lib/Menu/hooks/useContext.js +1 -1
- package/lib/Message/Message.vue.d.ts +1 -1
- package/lib/Message/Message.vue.js +1 -1
- package/lib/Message/index.d.ts +3 -3
- package/lib/Message/index.js +1 -1
- package/lib/Modal/Modal.vue.d.ts +4 -4
- package/lib/Modal/Modal.vue.js +1 -1
- package/lib/Modal/ModalService.vue.d.ts +2 -2
- package/lib/Modal/ModalService.vue.js +1 -1
- package/lib/Modal/hooks/useModalClose.js +1 -1
- package/lib/Modal/hooks/useModalDraggable.js +1 -1
- package/lib/Modal/hooks/useOnBeforeClose.js +1 -1
- package/lib/Modal/index.d.ts +11 -11
- package/lib/Notification/Notification.vue.d.ts +1 -1
- package/lib/Notification/Notification.vue.js +1 -1
- package/lib/Notification/index.d.ts +3 -3
- package/lib/Notification/index.js +1 -1
- package/lib/OverflowList/index.d.ts +3 -3
- package/lib/OverflowList/index.vue.d.ts +1 -1
- package/lib/OverflowList/index.vue.js +1 -1
- package/lib/PageHeader/index.vue.js +1 -1
- package/lib/Pagination/Pagination.vue.js +1 -1
- package/lib/Pagination/PaginationItem.vue.js +1 -1
- package/lib/Pagination/hooks/useContext.d.ts +1 -256
- package/lib/Pagination/hooks/useContext.js +1 -1
- package/lib/Popconfirm/index.d.ts +19 -19
- package/lib/Popconfirm/index.vue.d.ts +7 -7
- package/lib/Popconfirm/index.vue.js +1 -1
- package/lib/Popover/index.vue.js +1 -1
- package/lib/Progress/Progress.vue.d.ts +1 -1
- package/lib/Progress/Progress.vue.js +1 -1
- package/lib/Progress/ProgressCircle.vue.js +1 -1
- package/lib/Progress/ProgressLine.vue.js +1 -1
- package/lib/Progress/ProgressSteps.vue.js +1 -1
- package/lib/Progress/index.d.ts +3 -3
- package/lib/Radio/Radio.vue.d.ts +1 -1
- package/lib/Radio/Radio.vue.js +1 -1
- package/lib/Radio/RadioGroup.vue.d.ts +1 -1
- package/lib/Radio/hooks/useContext.js +1 -1
- package/lib/Radio/index.d.ts +6 -6
- package/lib/Rate/index.vue.js +1 -1
- package/lib/ResizeBox/index.vue.js +1 -1
- package/lib/Scrollbar/Scrollbar.vue.d.ts +1 -1
- package/lib/Scrollbar/Scrollbar.vue.js +1 -1
- package/lib/Scrollbar/ScrollbarTrack.vue.js +1 -1
- package/lib/Scrollbar/index.d.ts +3 -3
- package/lib/Select/Option.vue.js +1 -1
- package/lib/Select/Select.vue.d.ts +26 -26
- package/lib/Select/Select.vue.js +1 -1
- package/lib/Select/SelectIcon.vue.js +1 -1
- package/lib/Select/SelectRealList.vue.js +1 -1
- package/lib/Select/SelectView.vue.js +1 -1
- package/lib/Select/SelectVirtualList.vue.js +1 -1
- package/lib/Select/hooks/useContext.js +1 -1
- package/lib/Select/hooks/useSelectOptions.js +1 -1
- package/lib/Select/index.d.ts +14 -14
- package/lib/Skeleton/SkeletonLine.vue.js +1 -1
- package/lib/Skeleton/SkeletonShape.vue.js +1 -1
- package/lib/Slider/Slider.vue.d.ts +3 -3
- package/lib/Slider/SliderBtn.vue.js +1 -1
- package/lib/Slider/hooks/useContext.js +1 -1
- package/lib/Slider/hooks/useSliderDraggable.js +1 -1
- package/lib/Slider/index.d.ts +9 -9
- package/lib/Space/index.d.ts +3 -3
- package/lib/Space/index.vue.d.ts +1 -1
- package/lib/Space/index.vue.js +1 -1
- package/lib/Spin/index.d.ts +3 -3
- package/lib/Spin/index.vue.d.ts +1 -1
- package/lib/Spin/index.vue.js +1 -1
- package/lib/Split/index.d.ts +6 -6
- package/lib/Split/index.vue.d.ts +2 -2
- package/lib/Split/index.vue.js +1 -1
- package/lib/Statistic/Countdown.vue.d.ts +2 -2
- package/lib/Statistic/Countdown.vue.js +1 -1
- package/lib/Statistic/Statistic.vue.d.ts +2 -2
- package/lib/Statistic/Statistic.vue.js +1 -1
- package/lib/Statistic/index.d.ts +12 -12
- package/lib/Steps/Step.vue.d.ts +1 -1
- package/lib/Steps/Step.vue.js +1 -1
- package/lib/Steps/Steps.vue.d.ts +1 -1
- package/lib/Steps/hooks/useContext.js +1 -1
- package/lib/Steps/index.d.ts +6 -6
- package/lib/Switch/index.d.ts +6 -6
- package/lib/Switch/index.vue.d.ts +2 -2
- package/lib/Switch/index.vue.js +1 -1
- package/lib/Tabs/TabButton.vue.js +1 -1
- package/lib/Tabs/TabPane.vue.js +1 -1
- package/lib/Tabs/Tabs.vue.d.ts +3 -3
- package/lib/Tabs/Tabs.vue.js +1 -1
- package/lib/Tabs/TabsNavInk.vue.js +1 -1
- package/lib/Tabs/TabsTab.vue.js +1 -1
- package/lib/Tabs/hooks/useContext.js +1 -1
- package/lib/Tabs/hooks/useTabsScroll.js +1 -1
- package/lib/Tabs/index.d.ts +8 -8
- package/lib/Tag/index.d.ts +3 -3
- package/lib/Tag/index.vue.d.ts +1 -1
- package/lib/Tag/index.vue.js +1 -1
- package/lib/Textarea/hooks/useTextareaHeight.js +1 -1
- package/lib/Textarea/index.d.ts +6 -6
- package/lib/Textarea/index.vue.d.ts +2 -2
- package/lib/Textarea/index.vue.js +1 -1
- package/lib/TimePicker/TimePicker.vue.d.ts +3 -3
- package/lib/TimePicker/TimePicker.vue.js +1 -1
- package/lib/TimePicker/TimePickerPanel.vue.js +1 -1
- package/lib/TimePicker/hooks/useContext.d.ts +1 -0
- package/lib/TimePicker/hooks/useContext.js +1 -1
- package/lib/TimePicker/index.d.ts +9 -9
- package/lib/Timeline/TimelineItemPending.vue.js +1 -1
- package/lib/Timeline/hooks/useContext.js +1 -1
- package/lib/Tooltip/index.vue.js +1 -1
- package/lib/Transfer/Transfer.vue.js +1 -1
- package/lib/Transfer/TransferPanel.vue.js +1 -1
- package/lib/Transfer/hooks/useContext.js +1 -1
- package/lib/Trigger/hooks/useContext.js +1 -1
- package/lib/Trigger/hooks/useTriggerPosition.js +1 -1
- package/lib/Trigger/hooks/useTriggerVisible.js +1 -1
- package/lib/Trigger/index.vue.js +1 -1
- package/lib/Typography/TypographyBase.vue.d.ts +19 -19
- package/lib/Typography/TypographyBase.vue.js +1 -1
- package/lib/VerificationCode/index.d.ts +6 -6
- package/lib/VerificationCode/index.vue.d.ts +2 -2
- package/lib/VerificationCode/index.vue.js +1 -1
- package/lib/Watermark/index.d.ts +3 -3
- package/lib/Watermark/index.vue.d.ts +1 -1
- package/lib/Watermark/index.vue.js +1 -1
- package/lib/_lang/ar-eg.d.ts +206 -0
- package/lib/_lang/de-de.d.ts +206 -0
- package/lib/_lang/en-us.d.ts +254 -0
- package/lib/_lang/es-es.d.ts +206 -0
- package/lib/_lang/fr-fr.d.ts +206 -0
- package/lib/_lang/id-id.d.ts +206 -0
- package/lib/_lang/index.css +0 -0
- package/lib/_lang/interface.d.ts +151 -0
- package/lib/_lang/it-it.d.ts +206 -0
- package/lib/_lang/ja-jp.d.ts +254 -0
- package/lib/_lang/km-kh.d.ts +206 -0
- package/lib/_lang/ko-kr.d.ts +206 -0
- package/lib/_lang/ms-my.d.ts +206 -0
- package/lib/_lang/nl-nl.d.ts +254 -0
- package/lib/_lang/pt-pt.d.ts +206 -0
- package/lib/_lang/ru-ru.d.ts +254 -0
- package/lib/_lang/th-th.d.ts +206 -0
- package/lib/_lang/vi-vn.d.ts +206 -0
- package/lib/{_shared/locale/lang → _lang}/zh-cn.d.ts +39 -38
- package/lib/_lang/zh-cn.js +1 -0
- package/lib/_lang/zh-tw.d.ts +254 -0
- package/lib/_shared/components/ExpandTransition.vue2.js +1 -1
- package/lib/_shared/components/Icon.vue3.js +1 -1
- package/lib/_shared/components/IconButton.vue.js +1 -1
- package/lib/_shared/constants/index.js +1 -1
- package/lib/_shared/icons/IconFullScreen.vue.js +1 -1
- package/lib/_shared/icons/IconFullScreen.vue2.js +1 -1
- package/lib/_shared/icons/IconOriginSize.vue.js +1 -1
- package/lib/_shared/icons/IconOriginSize.vue2.js +1 -1
- package/lib/_shared/icons/IconRotateLeft.vue.js +1 -1
- package/lib/_shared/icons/IconRotateLeft.vue2.js +1 -1
- package/lib/_shared/icons/IconRotateRight.vue.js +1 -1
- package/lib/_shared/icons/IconRotateRight.vue2.js +1 -1
- package/lib/_shared/icons/IconZoomIn.vue.js +1 -1
- package/lib/_shared/icons/IconZoomIn.vue2.js +1 -1
- package/lib/_shared/icons/IconZoomOut.vue.js +1 -1
- package/lib/_shared/icons/IconZoomOut.vue2.js +1 -1
- package/lib/_shared/utils/control.js +1 -1
- package/lib/_shared/utils/global-config.d.ts +3 -1
- package/lib/_shared/utils/global-config.js +1 -1
- package/lib/_shared/utils/index.d.ts +1 -0
- package/lib/_shared/utils/locale.d.ts +22 -0
- package/lib/_shared/utils/locale.js +1 -0
- package/lib/index.d.ts +27 -27
- package/lib/index.js +1 -1
- package/package.json +10 -22
- package/es/_shared/locale/i18n.d.ts +0 -512
- package/es/_shared/locale/i18n.js +0 -43
- package/es/_shared/locale/lang/ar-eg.json.js +0 -251
- package/es/_shared/locale/lang/de-de.json.d.ts +0 -207
- package/es/_shared/locale/lang/de-de.json.js +0 -251
- package/es/_shared/locale/lang/en-us.json.d.ts +0 -210
- package/es/_shared/locale/lang/en-us.json.js +0 -256
- package/es/_shared/locale/lang/es-es.json.d.ts +0 -207
- package/es/_shared/locale/lang/es-es.json.js +0 -251
- package/es/_shared/locale/lang/fr-fr.json.d.ts +0 -207
- package/es/_shared/locale/lang/fr-fr.json.js +0 -251
- package/es/_shared/locale/lang/id-id.json.d.ts +0 -207
- package/es/_shared/locale/lang/id-id.json.js +0 -251
- package/es/_shared/locale/lang/it-it.json.d.ts +0 -207
- package/es/_shared/locale/lang/it-it.json.js +0 -251
- package/es/_shared/locale/lang/ja-jp.json.d.ts +0 -255
- package/es/_shared/locale/lang/ja-jp.json.js +0 -301
- package/es/_shared/locale/lang/km-kh.json.d.ts +0 -207
- package/es/_shared/locale/lang/km-kh.json.js +0 -251
- package/es/_shared/locale/lang/ko-kr.json.d.ts +0 -207
- package/es/_shared/locale/lang/ko-kr.json.js +0 -251
- package/es/_shared/locale/lang/ms-my.json.d.ts +0 -207
- package/es/_shared/locale/lang/ms-my.json.js +0 -251
- package/es/_shared/locale/lang/nl-nl.json.d.ts +0 -255
- package/es/_shared/locale/lang/nl-nl.json.js +0 -301
- package/es/_shared/locale/lang/pt-pt.json.d.ts +0 -207
- package/es/_shared/locale/lang/pt-pt.json.js +0 -251
- package/es/_shared/locale/lang/ru-ru.json.d.ts +0 -255
- package/es/_shared/locale/lang/ru-ru.json.js +0 -301
- package/es/_shared/locale/lang/th-th.json.d.ts +0 -207
- package/es/_shared/locale/lang/th-th.json.js +0 -251
- package/es/_shared/locale/lang/vi-vn.json.d.ts +0 -207
- package/es/_shared/locale/lang/vi-vn.json.js +0 -251
- package/es/_shared/locale/lang/zh-cn.json.d.ts +0 -255
- package/es/_shared/locale/lang/zh-cn.json.js +0 -301
- package/es/_shared/locale/lang/zh-tw.json.d.ts +0 -255
- package/es/_shared/locale/lang/zh-tw.json.js +0 -301
- package/es/node_modules/@intlify/core-base/dist/core-base.js +0 -1126
- package/es/node_modules/@intlify/message-compiler/dist/message-compiler.js +0 -65
- package/es/node_modules/@intlify/shared/dist/shared.js +0 -199
- package/es/node_modules/@intlify/vue-i18n-core/dist/vue-i18n-core.js +0 -1375
- package/es/node_modules/@vue/devtools-api/lib/esm/const.js +0 -6
- package/es/node_modules/@vue/devtools-api/lib/esm/env.js +0 -12
- package/es/node_modules/@vue/devtools-api/lib/esm/index.js +0 -26
- package/es/node_modules/@vue/devtools-api/lib/esm/proxy.js +0 -103
- package/es/node_modules/@vue/devtools-api/lib/esm/time.js +0 -25
- package/lib/_shared/locale/i18n.d.ts +0 -512
- package/lib/_shared/locale/i18n.js +0 -1
- package/lib/_shared/locale/lang/ar-eg.json.js +0 -1
- package/lib/_shared/locale/lang/de-de.json.d.ts +0 -207
- package/lib/_shared/locale/lang/de-de.json.js +0 -1
- package/lib/_shared/locale/lang/en-us.json.d.ts +0 -210
- package/lib/_shared/locale/lang/en-us.json.js +0 -1
- package/lib/_shared/locale/lang/es-es.json.d.ts +0 -207
- package/lib/_shared/locale/lang/es-es.json.js +0 -1
- package/lib/_shared/locale/lang/fr-fr.json.d.ts +0 -207
- package/lib/_shared/locale/lang/fr-fr.json.js +0 -1
- package/lib/_shared/locale/lang/id-id.json.d.ts +0 -207
- package/lib/_shared/locale/lang/id-id.json.js +0 -1
- package/lib/_shared/locale/lang/it-it.json.d.ts +0 -207
- package/lib/_shared/locale/lang/it-it.json.js +0 -1
- package/lib/_shared/locale/lang/ja-jp.json.d.ts +0 -255
- package/lib/_shared/locale/lang/ja-jp.json.js +0 -1
- package/lib/_shared/locale/lang/km-kh.json.d.ts +0 -207
- package/lib/_shared/locale/lang/km-kh.json.js +0 -1
- package/lib/_shared/locale/lang/ko-kr.json.d.ts +0 -207
- package/lib/_shared/locale/lang/ko-kr.json.js +0 -1
- package/lib/_shared/locale/lang/ms-my.json.d.ts +0 -207
- package/lib/_shared/locale/lang/ms-my.json.js +0 -1
- package/lib/_shared/locale/lang/nl-nl.json.d.ts +0 -255
- package/lib/_shared/locale/lang/nl-nl.json.js +0 -1
- package/lib/_shared/locale/lang/pt-pt.json.d.ts +0 -207
- package/lib/_shared/locale/lang/pt-pt.json.js +0 -1
- package/lib/_shared/locale/lang/ru-ru.json.d.ts +0 -255
- package/lib/_shared/locale/lang/ru-ru.json.js +0 -1
- package/lib/_shared/locale/lang/th-th.json.d.ts +0 -207
- package/lib/_shared/locale/lang/th-th.json.js +0 -1
- package/lib/_shared/locale/lang/vi-vn.json.d.ts +0 -207
- package/lib/_shared/locale/lang/vi-vn.json.js +0 -1
- package/lib/_shared/locale/lang/zh-cn.json.d.ts +0 -255
- package/lib/_shared/locale/lang/zh-cn.json.js +0 -1
- package/lib/_shared/locale/lang/zh-tw.json.d.ts +0 -255
- package/lib/_shared/locale/lang/zh-tw.json.js +0 -1
- package/lib/node_modules/@intlify/core-base/dist/core-base.js +0 -1
- package/lib/node_modules/@intlify/message-compiler/dist/message-compiler.js +0 -6
- package/lib/node_modules/@intlify/shared/dist/shared.js +0 -7
- package/lib/node_modules/@intlify/vue-i18n-core/dist/vue-i18n-core.js +0 -1
- package/lib/node_modules/@vue/devtools-api/lib/esm/const.js +0 -1
- package/lib/node_modules/@vue/devtools-api/lib/esm/env.js +0 -1
- package/lib/node_modules/@vue/devtools-api/lib/esm/index.js +0 -1
- package/lib/node_modules/@vue/devtools-api/lib/esm/proxy.js +0 -1
- package/lib/node_modules/@vue/devtools-api/lib/esm/time.js +0 -1
@@ -1,1126 +0,0 @@
|
|
1
|
-
import { isFunction, warn, isString, isArray, isPlainObject, create, assign, isBoolean, isRegExp, warnOnce, isObject, hasOwn, format, getGlobalThis, isNumber, isEmptyObject, isDate, escapeHtml, inBrowser, mark, measure, join, toDisplayString, isPromise, generateFormatCacheKey, generateCodeFrame } from "../../shared/dist/shared.js";
|
2
|
-
import { createCompileError, COMPILE_ERROR_CODES_EXTEND_POINT } from "../../message-compiler/dist/message-compiler.js";
|
3
|
-
/*!
|
4
|
-
* core-base v12.0.0-alpha.3
|
5
|
-
* (c) 2016-present kazuya kawaguchi and contributors
|
6
|
-
* Released under the MIT License.
|
7
|
-
*/
|
8
|
-
function initFeatureFlags() {
|
9
|
-
if (typeof __INTLIFY_PROD_DEVTOOLS__ !== "boolean") {
|
10
|
-
getGlobalThis().__INTLIFY_PROD_DEVTOOLS__ = false;
|
11
|
-
}
|
12
|
-
}
|
13
|
-
function isMessageAST(val) {
|
14
|
-
return isObject(val) && resolveType(val) === 0 && (hasOwn(val, "b") || hasOwn(val, "body"));
|
15
|
-
}
|
16
|
-
const PROPS_BODY = ["b", "body"];
|
17
|
-
const PROPS_CASES = ["c", "cases"];
|
18
|
-
const PROPS_STATIC = ["s", "static"];
|
19
|
-
const PROPS_ITEMS = ["i", "items"];
|
20
|
-
const PROPS_TYPE = ["t", "type"];
|
21
|
-
function resolveType(node) {
|
22
|
-
return resolveProps(node, PROPS_TYPE);
|
23
|
-
}
|
24
|
-
const PROPS_VALUE = ["v", "value"];
|
25
|
-
const PROPS_MODIFIER = ["m", "modifier"];
|
26
|
-
const PROPS_KEY = ["k", "key"];
|
27
|
-
function resolveProps(node, props, defaultValue) {
|
28
|
-
for (let i = 0; i < props.length; i++) {
|
29
|
-
const prop = props[i];
|
30
|
-
if (hasOwn(node, prop) && node[prop] != null) {
|
31
|
-
return node[prop];
|
32
|
-
}
|
33
|
-
}
|
34
|
-
return defaultValue;
|
35
|
-
}
|
36
|
-
const AST_NODE_PROPS_KEYS = [
|
37
|
-
...PROPS_BODY,
|
38
|
-
...PROPS_CASES,
|
39
|
-
...PROPS_STATIC,
|
40
|
-
...PROPS_ITEMS,
|
41
|
-
...PROPS_KEY,
|
42
|
-
...PROPS_MODIFIER,
|
43
|
-
...PROPS_VALUE,
|
44
|
-
...PROPS_TYPE
|
45
|
-
];
|
46
|
-
let devtools = null;
|
47
|
-
function setDevToolsHook(hook) {
|
48
|
-
devtools = hook;
|
49
|
-
}
|
50
|
-
function initI18nDevTools(i18n, version, meta) {
|
51
|
-
devtools && devtools.emit("i18n:init", {
|
52
|
-
timestamp: Date.now(),
|
53
|
-
i18n,
|
54
|
-
version,
|
55
|
-
meta
|
56
|
-
});
|
57
|
-
}
|
58
|
-
const translateDevTools = /* @__PURE__ */ createDevToolsHook("function:translate");
|
59
|
-
function createDevToolsHook(hook) {
|
60
|
-
return (payloads) => devtools && devtools.emit(hook, payloads);
|
61
|
-
}
|
62
|
-
const CoreErrorCodes = {
|
63
|
-
INVALID_ARGUMENT: COMPILE_ERROR_CODES_EXTEND_POINT,
|
64
|
-
// 17
|
65
|
-
INVALID_DATE_ARGUMENT: 18,
|
66
|
-
INVALID_ISO_DATE_ARGUMENT: 19,
|
67
|
-
NOT_SUPPORT_NON_STRING_MESSAGE: 20,
|
68
|
-
NOT_SUPPORT_LOCALE_PROMISE_VALUE: 21,
|
69
|
-
NOT_SUPPORT_LOCALE_ASYNC_FUNCTION: 22,
|
70
|
-
NOT_SUPPORT_LOCALE_TYPE: 23
|
71
|
-
};
|
72
|
-
const CORE_ERROR_CODES_EXTEND_POINT = 24;
|
73
|
-
function createCoreError(code) {
|
74
|
-
return createCompileError(code, null, process.env.NODE_ENV !== "production" ? { messages: errorMessages } : void 0);
|
75
|
-
}
|
76
|
-
const errorMessages = {
|
77
|
-
[CoreErrorCodes.INVALID_ARGUMENT]: "Invalid arguments",
|
78
|
-
[CoreErrorCodes.INVALID_DATE_ARGUMENT]: "The date provided is an invalid Date object.Make sure your Date represents a valid date.",
|
79
|
-
[CoreErrorCodes.INVALID_ISO_DATE_ARGUMENT]: "The argument provided is not a valid ISO date string",
|
80
|
-
[CoreErrorCodes.NOT_SUPPORT_NON_STRING_MESSAGE]: "Not support non-string message",
|
81
|
-
[CoreErrorCodes.NOT_SUPPORT_LOCALE_PROMISE_VALUE]: "cannot support promise value",
|
82
|
-
[CoreErrorCodes.NOT_SUPPORT_LOCALE_ASYNC_FUNCTION]: "cannot support async function",
|
83
|
-
[CoreErrorCodes.NOT_SUPPORT_LOCALE_TYPE]: "cannot support locale type"
|
84
|
-
};
|
85
|
-
function getLocale(context, options) {
|
86
|
-
return options.locale != null ? resolveLocale(options.locale) : resolveLocale(context.locale);
|
87
|
-
}
|
88
|
-
let _resolveLocale;
|
89
|
-
function resolveLocale(locale) {
|
90
|
-
if (isString(locale)) {
|
91
|
-
return locale;
|
92
|
-
} else {
|
93
|
-
if (isFunction(locale)) {
|
94
|
-
if (locale.resolvedOnce && _resolveLocale != null) {
|
95
|
-
return _resolveLocale;
|
96
|
-
} else if (locale.constructor.name === "Function") {
|
97
|
-
const resolve = locale();
|
98
|
-
if (isPromise(resolve)) {
|
99
|
-
throw createCoreError(CoreErrorCodes.NOT_SUPPORT_LOCALE_PROMISE_VALUE);
|
100
|
-
}
|
101
|
-
return _resolveLocale = resolve;
|
102
|
-
} else {
|
103
|
-
throw createCoreError(CoreErrorCodes.NOT_SUPPORT_LOCALE_ASYNC_FUNCTION);
|
104
|
-
}
|
105
|
-
} else {
|
106
|
-
throw createCoreError(CoreErrorCodes.NOT_SUPPORT_LOCALE_TYPE);
|
107
|
-
}
|
108
|
-
}
|
109
|
-
}
|
110
|
-
function fallbackWithSimple(ctx, fallback, start) {
|
111
|
-
return [.../* @__PURE__ */ new Set([
|
112
|
-
start,
|
113
|
-
...isArray(fallback) ? fallback : isObject(fallback) ? Object.keys(fallback) : isString(fallback) ? [fallback] : [start]
|
114
|
-
])];
|
115
|
-
}
|
116
|
-
function fallbackWithLocaleChain(ctx, fallback, start) {
|
117
|
-
const startLocale = isString(start) ? start : DEFAULT_LOCALE;
|
118
|
-
const context = ctx;
|
119
|
-
if (!context.__localeChainCache) {
|
120
|
-
context.__localeChainCache = /* @__PURE__ */ new Map();
|
121
|
-
}
|
122
|
-
let chain = context.__localeChainCache.get(startLocale);
|
123
|
-
if (!chain) {
|
124
|
-
chain = [];
|
125
|
-
let block = [start];
|
126
|
-
while (isArray(block)) {
|
127
|
-
block = appendBlockToChain(chain, block, fallback);
|
128
|
-
}
|
129
|
-
const defaults = isArray(fallback) || !isPlainObject(fallback) ? fallback : fallback["default"] ? fallback["default"] : null;
|
130
|
-
block = isString(defaults) ? [defaults] : defaults;
|
131
|
-
if (isArray(block)) {
|
132
|
-
appendBlockToChain(chain, block, false);
|
133
|
-
}
|
134
|
-
context.__localeChainCache.set(startLocale, chain);
|
135
|
-
}
|
136
|
-
return chain;
|
137
|
-
}
|
138
|
-
function appendBlockToChain(chain, block, blocks) {
|
139
|
-
let follow = true;
|
140
|
-
for (let i = 0; i < block.length && isBoolean(follow); i++) {
|
141
|
-
const locale = block[i];
|
142
|
-
if (isString(locale)) {
|
143
|
-
follow = appendLocaleToChain(chain, block[i], blocks);
|
144
|
-
}
|
145
|
-
}
|
146
|
-
return follow;
|
147
|
-
}
|
148
|
-
function appendLocaleToChain(chain, locale, blocks) {
|
149
|
-
let follow;
|
150
|
-
const tokens = locale.split("-");
|
151
|
-
do {
|
152
|
-
const target = tokens.join("-");
|
153
|
-
follow = appendItemToChain(chain, target, blocks);
|
154
|
-
tokens.splice(-1, 1);
|
155
|
-
} while (tokens.length && follow === true);
|
156
|
-
return follow;
|
157
|
-
}
|
158
|
-
function appendItemToChain(chain, target, blocks) {
|
159
|
-
let follow = false;
|
160
|
-
if (!chain.includes(target)) {
|
161
|
-
follow = true;
|
162
|
-
if (target) {
|
163
|
-
follow = target[target.length - 1] !== "!";
|
164
|
-
const locale = target.replace(/!/g, "");
|
165
|
-
chain.push(locale);
|
166
|
-
if ((isArray(blocks) || isPlainObject(blocks)) && blocks[locale]) {
|
167
|
-
follow = blocks[locale];
|
168
|
-
}
|
169
|
-
}
|
170
|
-
}
|
171
|
-
return follow;
|
172
|
-
}
|
173
|
-
function resolveWithKeyValue(obj, path) {
|
174
|
-
return isObject(obj) ? obj[path] : null;
|
175
|
-
}
|
176
|
-
const CoreWarnCodes = {
|
177
|
-
NOT_FOUND_KEY: 1,
|
178
|
-
FALLBACK_TO_TRANSLATE: 2,
|
179
|
-
CANNOT_FORMAT_NUMBER: 3,
|
180
|
-
FALLBACK_TO_NUMBER_FORMAT: 4,
|
181
|
-
CANNOT_FORMAT_DATE: 5,
|
182
|
-
FALLBACK_TO_DATE_FORMAT: 6,
|
183
|
-
EXPERIMENTAL_CUSTOM_MESSAGE_COMPILER: 7
|
184
|
-
};
|
185
|
-
const CORE_WARN_CODES_EXTEND_POINT = 8;
|
186
|
-
const warnMessages = {
|
187
|
-
[CoreWarnCodes.NOT_FOUND_KEY]: `Not found '{key}' key in '{locale}' locale messages.`,
|
188
|
-
[CoreWarnCodes.FALLBACK_TO_TRANSLATE]: `Fall back to translate '{key}' key with '{target}' locale.`,
|
189
|
-
[CoreWarnCodes.CANNOT_FORMAT_NUMBER]: `Cannot format a number value due to not supported Intl.NumberFormat.`,
|
190
|
-
[CoreWarnCodes.FALLBACK_TO_NUMBER_FORMAT]: `Fall back to number format '{key}' key with '{target}' locale.`,
|
191
|
-
[CoreWarnCodes.CANNOT_FORMAT_DATE]: `Cannot format a date value due to not supported Intl.DateTimeFormat.`,
|
192
|
-
[CoreWarnCodes.FALLBACK_TO_DATE_FORMAT]: `Fall back to datetime format '{key}' key with '{target}' locale.`,
|
193
|
-
[CoreWarnCodes.EXPERIMENTAL_CUSTOM_MESSAGE_COMPILER]: `This project is using Custom Message Compiler, which is an experimental feature. It may receive breaking changes or be removed in the future.`
|
194
|
-
};
|
195
|
-
function getWarnMessage(code, ...args) {
|
196
|
-
return format(warnMessages[code], ...args);
|
197
|
-
}
|
198
|
-
const VERSION = "12.0.0-alpha.3";
|
199
|
-
const NOT_RESOLVED = -1;
|
200
|
-
const DEFAULT_LOCALE = "en-US";
|
201
|
-
const MISSING_RESOLVE_VALUE = "";
|
202
|
-
const capitalize = (str) => `${str.charAt(0).toLocaleUpperCase()}${str.substr(1)}`;
|
203
|
-
function getDefaultLinkedModifiers() {
|
204
|
-
return {
|
205
|
-
upper: (val, type) => {
|
206
|
-
return type === "text" && isString(val) ? val.toUpperCase() : type === "vnode" && isObject(val) && "__v_isVNode" in val ? val.children.toUpperCase() : val;
|
207
|
-
},
|
208
|
-
lower: (val, type) => {
|
209
|
-
return type === "text" && isString(val) ? val.toLowerCase() : type === "vnode" && isObject(val) && "__v_isVNode" in val ? val.children.toLowerCase() : val;
|
210
|
-
},
|
211
|
-
capitalize: (val, type) => {
|
212
|
-
return type === "text" && isString(val) ? capitalize(val) : type === "vnode" && isObject(val) && "__v_isVNode" in val ? capitalize(val.children) : val;
|
213
|
-
}
|
214
|
-
};
|
215
|
-
}
|
216
|
-
let _compiler;
|
217
|
-
let _additionalMeta = null;
|
218
|
-
const setAdditionalMeta = /* @__NO_SIDE_EFFECTS__ */ (meta) => {
|
219
|
-
_additionalMeta = meta;
|
220
|
-
};
|
221
|
-
const getAdditionalMeta = /* @__NO_SIDE_EFFECTS__ */ () => _additionalMeta;
|
222
|
-
let _fallbackContext = null;
|
223
|
-
const setFallbackContext = (context) => {
|
224
|
-
_fallbackContext = context;
|
225
|
-
};
|
226
|
-
const getFallbackContext = () => _fallbackContext;
|
227
|
-
let _cid = 0;
|
228
|
-
function createCoreContext(options = {}) {
|
229
|
-
const onWarn = isFunction(options.onWarn) ? options.onWarn : warn;
|
230
|
-
const version = isString(options.version) ? options.version : VERSION;
|
231
|
-
const locale = isString(options.locale) || isFunction(options.locale) ? options.locale : DEFAULT_LOCALE;
|
232
|
-
const _locale = isFunction(locale) ? DEFAULT_LOCALE : locale;
|
233
|
-
const fallbackLocale = isArray(options.fallbackLocale) || isPlainObject(options.fallbackLocale) || isString(options.fallbackLocale) || options.fallbackLocale === false ? options.fallbackLocale : _locale;
|
234
|
-
const messages = isPlainObject(options.messages) ? options.messages : createResources(_locale);
|
235
|
-
const datetimeFormats = isPlainObject(options.datetimeFormats) ? options.datetimeFormats : createResources(_locale);
|
236
|
-
const numberFormats = isPlainObject(options.numberFormats) ? options.numberFormats : createResources(_locale);
|
237
|
-
const modifiers = assign(create(), options.modifiers, getDefaultLinkedModifiers());
|
238
|
-
const pluralRules = options.pluralRules || create();
|
239
|
-
const missing = isFunction(options.missing) ? options.missing : null;
|
240
|
-
const missingWarn = isBoolean(options.missingWarn) || isRegExp(options.missingWarn) ? options.missingWarn : true;
|
241
|
-
const fallbackWarn = isBoolean(options.fallbackWarn) || isRegExp(options.fallbackWarn) ? options.fallbackWarn : true;
|
242
|
-
const fallbackFormat = !!options.fallbackFormat;
|
243
|
-
const unresolving = !!options.unresolving;
|
244
|
-
const postTranslation = isFunction(options.postTranslation) ? options.postTranslation : null;
|
245
|
-
const processor = isPlainObject(options.processor) ? options.processor : null;
|
246
|
-
const warnHtmlMessage = isBoolean(options.warnHtmlMessage) ? options.warnHtmlMessage : true;
|
247
|
-
const escapeParameter = !!options.escapeParameter;
|
248
|
-
const messageCompiler = isFunction(options.messageCompiler) ? options.messageCompiler : _compiler;
|
249
|
-
if (process.env.NODE_ENV !== "production" && true && true && isFunction(options.messageCompiler)) {
|
250
|
-
warnOnce(getWarnMessage(CoreWarnCodes.EXPERIMENTAL_CUSTOM_MESSAGE_COMPILER));
|
251
|
-
}
|
252
|
-
const messageResolver = isFunction(options.messageResolver) ? options.messageResolver : resolveWithKeyValue;
|
253
|
-
const localeFallbacker = isFunction(options.localeFallbacker) ? options.localeFallbacker : fallbackWithSimple;
|
254
|
-
const fallbackContext = isObject(options.fallbackContext) ? options.fallbackContext : void 0;
|
255
|
-
const internalOptions = options;
|
256
|
-
const __datetimeFormatters = isObject(internalOptions.__datetimeFormatters) ? internalOptions.__datetimeFormatters : /* @__PURE__ */ new Map();
|
257
|
-
const __numberFormatters = isObject(internalOptions.__numberFormatters) ? internalOptions.__numberFormatters : /* @__PURE__ */ new Map();
|
258
|
-
const __meta = isObject(internalOptions.__meta) ? internalOptions.__meta : {};
|
259
|
-
_cid++;
|
260
|
-
const context = {
|
261
|
-
version,
|
262
|
-
cid: _cid,
|
263
|
-
locale,
|
264
|
-
fallbackLocale,
|
265
|
-
messages,
|
266
|
-
modifiers,
|
267
|
-
pluralRules,
|
268
|
-
missing,
|
269
|
-
missingWarn,
|
270
|
-
fallbackWarn,
|
271
|
-
fallbackFormat,
|
272
|
-
unresolving,
|
273
|
-
postTranslation,
|
274
|
-
processor,
|
275
|
-
warnHtmlMessage,
|
276
|
-
escapeParameter,
|
277
|
-
messageCompiler,
|
278
|
-
messageResolver,
|
279
|
-
localeFallbacker,
|
280
|
-
fallbackContext,
|
281
|
-
onWarn,
|
282
|
-
__meta
|
283
|
-
};
|
284
|
-
{
|
285
|
-
context.datetimeFormats = datetimeFormats;
|
286
|
-
context.numberFormats = numberFormats;
|
287
|
-
context.__datetimeFormatters = __datetimeFormatters;
|
288
|
-
context.__numberFormatters = __numberFormatters;
|
289
|
-
}
|
290
|
-
if (process.env.NODE_ENV !== "production") {
|
291
|
-
context.__v_emitter = internalOptions.__v_emitter != null ? internalOptions.__v_emitter : void 0;
|
292
|
-
}
|
293
|
-
if (process.env.NODE_ENV !== "production" || __INTLIFY_PROD_DEVTOOLS__) {
|
294
|
-
initI18nDevTools(context, version, __meta);
|
295
|
-
}
|
296
|
-
return context;
|
297
|
-
}
|
298
|
-
const createResources = (locale) => ({ [locale]: create() });
|
299
|
-
function isTranslateFallbackWarn(fallback, key) {
|
300
|
-
return fallback instanceof RegExp ? fallback.test(key) : fallback;
|
301
|
-
}
|
302
|
-
function isTranslateMissingWarn(missing, key) {
|
303
|
-
return missing instanceof RegExp ? missing.test(key) : missing;
|
304
|
-
}
|
305
|
-
function handleMissing(context, key, locale, missingWarn, type) {
|
306
|
-
const { missing, onWarn } = context;
|
307
|
-
if (process.env.NODE_ENV !== "production") {
|
308
|
-
const emitter = context.__v_emitter;
|
309
|
-
if (emitter) {
|
310
|
-
emitter.emit("missing", {
|
311
|
-
locale,
|
312
|
-
key,
|
313
|
-
type,
|
314
|
-
groupId: `${type}:${key}`
|
315
|
-
});
|
316
|
-
}
|
317
|
-
}
|
318
|
-
if (missing !== null) {
|
319
|
-
const ret = missing(context, locale, key, type);
|
320
|
-
return isString(ret) ? ret : key;
|
321
|
-
} else {
|
322
|
-
if (process.env.NODE_ENV !== "production" && isTranslateMissingWarn(missingWarn, key)) {
|
323
|
-
onWarn(getWarnMessage(CoreWarnCodes.NOT_FOUND_KEY, { key, locale }));
|
324
|
-
}
|
325
|
-
return key;
|
326
|
-
}
|
327
|
-
}
|
328
|
-
function updateFallbackLocale(ctx, locale, fallback) {
|
329
|
-
const context = ctx;
|
330
|
-
context.__localeChainCache = /* @__PURE__ */ new Map();
|
331
|
-
ctx.localeFallbacker(ctx, fallback, locale);
|
332
|
-
}
|
333
|
-
function isAlmostSameLocale(locale, compareLocale) {
|
334
|
-
if (locale === compareLocale)
|
335
|
-
return false;
|
336
|
-
return locale.split("-")[0] === compareLocale.split("-")[0];
|
337
|
-
}
|
338
|
-
function isImplicitFallback(targetLocale, locales) {
|
339
|
-
const index = locales.indexOf(targetLocale);
|
340
|
-
if (index === -1) {
|
341
|
-
return false;
|
342
|
-
}
|
343
|
-
for (let i = index + 1; i < locales.length; i++) {
|
344
|
-
if (isAlmostSameLocale(targetLocale, locales[i])) {
|
345
|
-
return true;
|
346
|
-
}
|
347
|
-
}
|
348
|
-
return false;
|
349
|
-
}
|
350
|
-
const intlDefined = typeof Intl !== "undefined";
|
351
|
-
const Availabilities = {
|
352
|
-
dateTimeFormat: intlDefined && typeof Intl.DateTimeFormat !== "undefined",
|
353
|
-
numberFormat: intlDefined && typeof Intl.NumberFormat !== "undefined"
|
354
|
-
};
|
355
|
-
function datetime(context, ...args) {
|
356
|
-
const { datetimeFormats, unresolving, fallbackLocale, onWarn, localeFallbacker } = context;
|
357
|
-
const { __datetimeFormatters } = context;
|
358
|
-
if (process.env.NODE_ENV !== "production" && !Availabilities.dateTimeFormat) {
|
359
|
-
onWarn(getWarnMessage(CoreWarnCodes.CANNOT_FORMAT_DATE));
|
360
|
-
return MISSING_RESOLVE_VALUE;
|
361
|
-
}
|
362
|
-
const [key, value, options, overrides] = parseDateTimeArgs(...args);
|
363
|
-
const missingWarn = isBoolean(options.missingWarn) ? options.missingWarn : context.missingWarn;
|
364
|
-
const fallbackWarn = isBoolean(options.fallbackWarn) ? options.fallbackWarn : context.fallbackWarn;
|
365
|
-
const part = !!options.part;
|
366
|
-
const locale = getLocale(context, options);
|
367
|
-
const locales = localeFallbacker(
|
368
|
-
context,
|
369
|
-
// eslint-disable-line @typescript-eslint/no-explicit-any
|
370
|
-
fallbackLocale,
|
371
|
-
locale
|
372
|
-
);
|
373
|
-
if (!isString(key) || key === "") {
|
374
|
-
return new Intl.DateTimeFormat(locale, overrides).format(value);
|
375
|
-
}
|
376
|
-
let datetimeFormat = {};
|
377
|
-
let targetLocale;
|
378
|
-
let format2 = null;
|
379
|
-
let from = locale;
|
380
|
-
let to = null;
|
381
|
-
const type = "datetime format";
|
382
|
-
for (let i = 0; i < locales.length; i++) {
|
383
|
-
targetLocale = to = locales[i];
|
384
|
-
if (process.env.NODE_ENV !== "production" && locale !== targetLocale && isTranslateFallbackWarn(fallbackWarn, key)) {
|
385
|
-
onWarn(getWarnMessage(CoreWarnCodes.FALLBACK_TO_DATE_FORMAT, {
|
386
|
-
key,
|
387
|
-
target: targetLocale
|
388
|
-
}));
|
389
|
-
}
|
390
|
-
if (process.env.NODE_ENV !== "production" && locale !== targetLocale) {
|
391
|
-
const emitter = context.__v_emitter;
|
392
|
-
if (emitter) {
|
393
|
-
emitter.emit("fallback", {
|
394
|
-
type,
|
395
|
-
key,
|
396
|
-
from,
|
397
|
-
to,
|
398
|
-
groupId: `${type}:${key}`
|
399
|
-
});
|
400
|
-
}
|
401
|
-
}
|
402
|
-
datetimeFormat = datetimeFormats[targetLocale] || {};
|
403
|
-
format2 = datetimeFormat[key];
|
404
|
-
if (isPlainObject(format2))
|
405
|
-
break;
|
406
|
-
handleMissing(context, key, targetLocale, missingWarn, type);
|
407
|
-
from = to;
|
408
|
-
}
|
409
|
-
if (!isPlainObject(format2) || !isString(targetLocale)) {
|
410
|
-
return unresolving ? NOT_RESOLVED : key;
|
411
|
-
}
|
412
|
-
let id = `${targetLocale}__${key}`;
|
413
|
-
if (!isEmptyObject(overrides)) {
|
414
|
-
id = `${id}__${JSON.stringify(overrides)}`;
|
415
|
-
}
|
416
|
-
let formatter = __datetimeFormatters.get(id);
|
417
|
-
if (!formatter) {
|
418
|
-
formatter = new Intl.DateTimeFormat(targetLocale, assign({}, format2, overrides));
|
419
|
-
__datetimeFormatters.set(id, formatter);
|
420
|
-
}
|
421
|
-
return !part ? formatter.format(value) : formatter.formatToParts(value);
|
422
|
-
}
|
423
|
-
const DATETIME_FORMAT_OPTIONS_KEYS = [
|
424
|
-
"localeMatcher",
|
425
|
-
"weekday",
|
426
|
-
"era",
|
427
|
-
"year",
|
428
|
-
"month",
|
429
|
-
"day",
|
430
|
-
"hour",
|
431
|
-
"minute",
|
432
|
-
"second",
|
433
|
-
"timeZoneName",
|
434
|
-
"formatMatcher",
|
435
|
-
"hour12",
|
436
|
-
"timeZone",
|
437
|
-
"dateStyle",
|
438
|
-
"timeStyle",
|
439
|
-
"calendar",
|
440
|
-
"dayPeriod",
|
441
|
-
"numberingSystem",
|
442
|
-
"hourCycle",
|
443
|
-
"fractionalSecondDigits"
|
444
|
-
];
|
445
|
-
function parseDateTimeArgs(...args) {
|
446
|
-
const [arg1, arg2, arg3, arg4] = args;
|
447
|
-
const options = create();
|
448
|
-
let overrides = create();
|
449
|
-
let value;
|
450
|
-
if (isString(arg1)) {
|
451
|
-
const matches = arg1.match(/(\d{4}-\d{2}-\d{2})(T|\s)?(.*)/);
|
452
|
-
if (!matches) {
|
453
|
-
throw createCoreError(CoreErrorCodes.INVALID_ISO_DATE_ARGUMENT);
|
454
|
-
}
|
455
|
-
const dateTime = matches[3] ? matches[3].trim().startsWith("T") ? `${matches[1].trim()}${matches[3].trim()}` : `${matches[1].trim()}T${matches[3].trim()}` : matches[1].trim();
|
456
|
-
value = new Date(dateTime);
|
457
|
-
try {
|
458
|
-
value.toISOString();
|
459
|
-
} catch {
|
460
|
-
throw createCoreError(CoreErrorCodes.INVALID_ISO_DATE_ARGUMENT);
|
461
|
-
}
|
462
|
-
} else if (isDate(arg1)) {
|
463
|
-
if (isNaN(arg1.getTime())) {
|
464
|
-
throw createCoreError(CoreErrorCodes.INVALID_DATE_ARGUMENT);
|
465
|
-
}
|
466
|
-
value = arg1;
|
467
|
-
} else if (isNumber(arg1)) {
|
468
|
-
value = arg1;
|
469
|
-
} else {
|
470
|
-
throw createCoreError(CoreErrorCodes.INVALID_ARGUMENT);
|
471
|
-
}
|
472
|
-
if (isString(arg2)) {
|
473
|
-
options.key = arg2;
|
474
|
-
} else if (isPlainObject(arg2)) {
|
475
|
-
Object.keys(arg2).forEach((key) => {
|
476
|
-
if (DATETIME_FORMAT_OPTIONS_KEYS.includes(key)) {
|
477
|
-
overrides[key] = arg2[key];
|
478
|
-
} else {
|
479
|
-
options[key] = arg2[key];
|
480
|
-
}
|
481
|
-
});
|
482
|
-
}
|
483
|
-
if (isString(arg3)) {
|
484
|
-
options.locale = arg3;
|
485
|
-
} else if (isPlainObject(arg3)) {
|
486
|
-
overrides = arg3;
|
487
|
-
}
|
488
|
-
if (isPlainObject(arg4)) {
|
489
|
-
overrides = arg4;
|
490
|
-
}
|
491
|
-
return [options.key || "", value, options, overrides];
|
492
|
-
}
|
493
|
-
function clearDateTimeFormat(ctx, locale, format2) {
|
494
|
-
const context = ctx;
|
495
|
-
for (const key in format2) {
|
496
|
-
const id = `${locale}__${key}`;
|
497
|
-
if (!context.__datetimeFormatters.has(id)) {
|
498
|
-
continue;
|
499
|
-
}
|
500
|
-
context.__datetimeFormatters.delete(id);
|
501
|
-
}
|
502
|
-
}
|
503
|
-
function number(context, ...args) {
|
504
|
-
const { numberFormats, unresolving, fallbackLocale, onWarn, localeFallbacker } = context;
|
505
|
-
const { __numberFormatters } = context;
|
506
|
-
if (process.env.NODE_ENV !== "production" && !Availabilities.numberFormat) {
|
507
|
-
onWarn(getWarnMessage(CoreWarnCodes.CANNOT_FORMAT_NUMBER));
|
508
|
-
return MISSING_RESOLVE_VALUE;
|
509
|
-
}
|
510
|
-
const [key, value, options, overrides] = parseNumberArgs(...args);
|
511
|
-
const missingWarn = isBoolean(options.missingWarn) ? options.missingWarn : context.missingWarn;
|
512
|
-
const fallbackWarn = isBoolean(options.fallbackWarn) ? options.fallbackWarn : context.fallbackWarn;
|
513
|
-
const part = !!options.part;
|
514
|
-
const locale = getLocale(context, options);
|
515
|
-
const locales = localeFallbacker(
|
516
|
-
context,
|
517
|
-
// eslint-disable-line @typescript-eslint/no-explicit-any
|
518
|
-
fallbackLocale,
|
519
|
-
locale
|
520
|
-
);
|
521
|
-
if (!isString(key) || key === "") {
|
522
|
-
return new Intl.NumberFormat(locale, overrides).format(value);
|
523
|
-
}
|
524
|
-
let numberFormat = {};
|
525
|
-
let targetLocale;
|
526
|
-
let format2 = null;
|
527
|
-
let from = locale;
|
528
|
-
let to = null;
|
529
|
-
const type = "number format";
|
530
|
-
for (let i = 0; i < locales.length; i++) {
|
531
|
-
targetLocale = to = locales[i];
|
532
|
-
if (process.env.NODE_ENV !== "production" && locale !== targetLocale && isTranslateFallbackWarn(fallbackWarn, key)) {
|
533
|
-
onWarn(getWarnMessage(CoreWarnCodes.FALLBACK_TO_NUMBER_FORMAT, {
|
534
|
-
key,
|
535
|
-
target: targetLocale
|
536
|
-
}));
|
537
|
-
}
|
538
|
-
if (process.env.NODE_ENV !== "production" && locale !== targetLocale) {
|
539
|
-
const emitter = context.__v_emitter;
|
540
|
-
if (emitter) {
|
541
|
-
emitter.emit("fallback", {
|
542
|
-
type,
|
543
|
-
key,
|
544
|
-
from,
|
545
|
-
to,
|
546
|
-
groupId: `${type}:${key}`
|
547
|
-
});
|
548
|
-
}
|
549
|
-
}
|
550
|
-
numberFormat = numberFormats[targetLocale] || {};
|
551
|
-
format2 = numberFormat[key];
|
552
|
-
if (isPlainObject(format2))
|
553
|
-
break;
|
554
|
-
handleMissing(context, key, targetLocale, missingWarn, type);
|
555
|
-
from = to;
|
556
|
-
}
|
557
|
-
if (!isPlainObject(format2) || !isString(targetLocale)) {
|
558
|
-
return unresolving ? NOT_RESOLVED : key;
|
559
|
-
}
|
560
|
-
let id = `${targetLocale}__${key}`;
|
561
|
-
if (!isEmptyObject(overrides)) {
|
562
|
-
id = `${id}__${JSON.stringify(overrides)}`;
|
563
|
-
}
|
564
|
-
let formatter = __numberFormatters.get(id);
|
565
|
-
if (!formatter) {
|
566
|
-
formatter = new Intl.NumberFormat(targetLocale, assign({}, format2, overrides));
|
567
|
-
__numberFormatters.set(id, formatter);
|
568
|
-
}
|
569
|
-
return !part ? formatter.format(value) : formatter.formatToParts(value);
|
570
|
-
}
|
571
|
-
const NUMBER_FORMAT_OPTIONS_KEYS = [
|
572
|
-
"localeMatcher",
|
573
|
-
"style",
|
574
|
-
"currency",
|
575
|
-
"currencyDisplay",
|
576
|
-
"currencySign",
|
577
|
-
"useGrouping",
|
578
|
-
"minimumIntegerDigits",
|
579
|
-
"minimumFractionDigits",
|
580
|
-
"maximumFractionDigits",
|
581
|
-
"minimumSignificantDigits",
|
582
|
-
"maximumSignificantDigits",
|
583
|
-
"compactDisplay",
|
584
|
-
"notation",
|
585
|
-
"signDisplay",
|
586
|
-
"unit",
|
587
|
-
"unitDisplay",
|
588
|
-
"roundingMode",
|
589
|
-
"roundingPriority",
|
590
|
-
"roundingIncrement",
|
591
|
-
"trailingZeroDisplay"
|
592
|
-
];
|
593
|
-
function parseNumberArgs(...args) {
|
594
|
-
const [arg1, arg2, arg3, arg4] = args;
|
595
|
-
const options = create();
|
596
|
-
let overrides = create();
|
597
|
-
if (!isNumber(arg1)) {
|
598
|
-
throw createCoreError(CoreErrorCodes.INVALID_ARGUMENT);
|
599
|
-
}
|
600
|
-
const value = arg1;
|
601
|
-
if (isString(arg2)) {
|
602
|
-
options.key = arg2;
|
603
|
-
} else if (isPlainObject(arg2)) {
|
604
|
-
Object.keys(arg2).forEach((key) => {
|
605
|
-
if (NUMBER_FORMAT_OPTIONS_KEYS.includes(key)) {
|
606
|
-
overrides[key] = arg2[key];
|
607
|
-
} else {
|
608
|
-
options[key] = arg2[key];
|
609
|
-
}
|
610
|
-
});
|
611
|
-
}
|
612
|
-
if (isString(arg3)) {
|
613
|
-
options.locale = arg3;
|
614
|
-
} else if (isPlainObject(arg3)) {
|
615
|
-
overrides = arg3;
|
616
|
-
}
|
617
|
-
if (isPlainObject(arg4)) {
|
618
|
-
overrides = arg4;
|
619
|
-
}
|
620
|
-
return [options.key || "", value, options, overrides];
|
621
|
-
}
|
622
|
-
function clearNumberFormat(ctx, locale, format2) {
|
623
|
-
const context = ctx;
|
624
|
-
for (const key in format2) {
|
625
|
-
const id = `${locale}__${key}`;
|
626
|
-
if (!context.__numberFormatters.has(id)) {
|
627
|
-
continue;
|
628
|
-
}
|
629
|
-
context.__numberFormatters.delete(id);
|
630
|
-
}
|
631
|
-
}
|
632
|
-
const DEFAULT_MODIFIER = (str) => str;
|
633
|
-
const DEFAULT_MESSAGE = (ctx) => "";
|
634
|
-
const DEFAULT_MESSAGE_DATA_TYPE = "text";
|
635
|
-
const DEFAULT_NORMALIZE = (values) => values.length === 0 ? "" : join(values);
|
636
|
-
const DEFAULT_INTERPOLATE = toDisplayString;
|
637
|
-
function pluralDefault(choice, choicesLength) {
|
638
|
-
choice = Math.abs(choice);
|
639
|
-
if (choicesLength === 2) {
|
640
|
-
return choice ? choice > 1 ? 1 : 0 : 1;
|
641
|
-
}
|
642
|
-
return choice ? Math.min(choice, 2) : 0;
|
643
|
-
}
|
644
|
-
function getPluralIndex(options) {
|
645
|
-
const index = isNumber(options.pluralIndex) ? options.pluralIndex : -1;
|
646
|
-
return options.named && (isNumber(options.named.count) || isNumber(options.named.n)) ? isNumber(options.named.count) ? options.named.count : isNumber(options.named.n) ? options.named.n : index : index;
|
647
|
-
}
|
648
|
-
function normalizeNamed(pluralIndex, props) {
|
649
|
-
if (!props.count) {
|
650
|
-
props.count = pluralIndex;
|
651
|
-
}
|
652
|
-
if (!props.n) {
|
653
|
-
props.n = pluralIndex;
|
654
|
-
}
|
655
|
-
}
|
656
|
-
function createMessageContext(options = {}) {
|
657
|
-
const locale = options.locale;
|
658
|
-
const pluralIndex = getPluralIndex(options);
|
659
|
-
const pluralRule = isObject(options.pluralRules) && isString(locale) && isFunction(options.pluralRules[locale]) ? options.pluralRules[locale] : pluralDefault;
|
660
|
-
const orgPluralRule = isObject(options.pluralRules) && isString(locale) && isFunction(options.pluralRules[locale]) ? pluralDefault : void 0;
|
661
|
-
const plural = (messages) => {
|
662
|
-
return messages[pluralRule(pluralIndex, messages.length, orgPluralRule)];
|
663
|
-
};
|
664
|
-
const _list = options.list || [];
|
665
|
-
const list = (index) => _list[index];
|
666
|
-
const _named = options.named || create();
|
667
|
-
isNumber(options.pluralIndex) && normalizeNamed(pluralIndex, _named);
|
668
|
-
const named = (key) => _named[key];
|
669
|
-
function message(key, useLinked) {
|
670
|
-
const msg = isFunction(options.messages) ? options.messages(key, !!useLinked) : isObject(options.messages) ? options.messages[key] : false;
|
671
|
-
return !msg ? options.parent ? options.parent.message(key) : DEFAULT_MESSAGE : msg;
|
672
|
-
}
|
673
|
-
const _modifier = (name) => options.modifiers ? options.modifiers[name] : DEFAULT_MODIFIER;
|
674
|
-
const normalize = isPlainObject(options.processor) && isFunction(options.processor.normalize) ? options.processor.normalize : DEFAULT_NORMALIZE;
|
675
|
-
const interpolate = isPlainObject(options.processor) && isFunction(options.processor.interpolate) ? options.processor.interpolate : DEFAULT_INTERPOLATE;
|
676
|
-
const type = isPlainObject(options.processor) && isString(options.processor.type) ? options.processor.type : DEFAULT_MESSAGE_DATA_TYPE;
|
677
|
-
const linked = (key, ...args) => {
|
678
|
-
const [arg1, arg2] = args;
|
679
|
-
let type2 = "text";
|
680
|
-
let modifier = "";
|
681
|
-
if (args.length === 1) {
|
682
|
-
if (isObject(arg1)) {
|
683
|
-
modifier = arg1.modifier || modifier;
|
684
|
-
type2 = arg1.type || type2;
|
685
|
-
} else if (isString(arg1)) {
|
686
|
-
modifier = arg1 || modifier;
|
687
|
-
}
|
688
|
-
} else if (args.length === 2) {
|
689
|
-
if (isString(arg1)) {
|
690
|
-
modifier = arg1 || modifier;
|
691
|
-
}
|
692
|
-
if (isString(arg2)) {
|
693
|
-
type2 = arg2 || type2;
|
694
|
-
}
|
695
|
-
}
|
696
|
-
const ret = message(key, true)(ctx);
|
697
|
-
const msg = (
|
698
|
-
// The message in vnode resolved with linked are returned as an array by processor.nomalize
|
699
|
-
type2 === "vnode" && isArray(ret) && modifier ? ret[0] : ret
|
700
|
-
);
|
701
|
-
return modifier ? _modifier(modifier)(msg, type2) : msg;
|
702
|
-
};
|
703
|
-
const ctx = {
|
704
|
-
[
|
705
|
-
"list"
|
706
|
-
/* HelperNameMap.LIST */
|
707
|
-
]: list,
|
708
|
-
[
|
709
|
-
"named"
|
710
|
-
/* HelperNameMap.NAMED */
|
711
|
-
]: named,
|
712
|
-
[
|
713
|
-
"plural"
|
714
|
-
/* HelperNameMap.PLURAL */
|
715
|
-
]: plural,
|
716
|
-
[
|
717
|
-
"linked"
|
718
|
-
/* HelperNameMap.LINKED */
|
719
|
-
]: linked,
|
720
|
-
[
|
721
|
-
"message"
|
722
|
-
/* HelperNameMap.MESSAGE */
|
723
|
-
]: message,
|
724
|
-
[
|
725
|
-
"type"
|
726
|
-
/* HelperNameMap.TYPE */
|
727
|
-
]: type,
|
728
|
-
[
|
729
|
-
"interpolate"
|
730
|
-
/* HelperNameMap.INTERPOLATE */
|
731
|
-
]: interpolate,
|
732
|
-
[
|
733
|
-
"normalize"
|
734
|
-
/* HelperNameMap.NORMALIZE */
|
735
|
-
]: normalize,
|
736
|
-
[
|
737
|
-
"values"
|
738
|
-
/* HelperNameMap.VALUES */
|
739
|
-
]: assign(create(), _list, _named)
|
740
|
-
};
|
741
|
-
return ctx;
|
742
|
-
}
|
743
|
-
const NOOP_MESSAGE_FUNCTION = () => "";
|
744
|
-
const isMessageFunction = (val) => isFunction(val);
|
745
|
-
function translate(context, ...args) {
|
746
|
-
const { fallbackFormat, postTranslation, unresolving, messageCompiler, fallbackLocale, messages } = context;
|
747
|
-
const [key, options] = parseTranslateArgs(...args);
|
748
|
-
const missingWarn = isBoolean(options.missingWarn) ? options.missingWarn : context.missingWarn;
|
749
|
-
const fallbackWarn = isBoolean(options.fallbackWarn) ? options.fallbackWarn : context.fallbackWarn;
|
750
|
-
const escapeParameter = isBoolean(options.escapeParameter) ? options.escapeParameter : context.escapeParameter;
|
751
|
-
const resolvedMessage = !!options.resolvedMessage;
|
752
|
-
const defaultMsgOrKey = isString(options.default) || isBoolean(options.default) ? !isBoolean(options.default) ? options.default : !messageCompiler ? () => key : key : fallbackFormat ? !messageCompiler ? () => key : key : null;
|
753
|
-
const enableDefaultMsg = fallbackFormat || defaultMsgOrKey != null && (isString(defaultMsgOrKey) || isFunction(defaultMsgOrKey));
|
754
|
-
const locale = getLocale(context, options);
|
755
|
-
escapeParameter && escapeParams(options);
|
756
|
-
let [formatScope, targetLocale, message] = !resolvedMessage ? resolveMessageFormat(context, key, locale, fallbackLocale, fallbackWarn, missingWarn) : [
|
757
|
-
key,
|
758
|
-
locale,
|
759
|
-
messages[locale] || create()
|
760
|
-
];
|
761
|
-
let format2 = formatScope;
|
762
|
-
let cacheBaseKey = key;
|
763
|
-
if (!resolvedMessage && !(isString(format2) || isMessageAST(format2) || isMessageFunction(format2))) {
|
764
|
-
if (enableDefaultMsg) {
|
765
|
-
format2 = defaultMsgOrKey;
|
766
|
-
cacheBaseKey = format2;
|
767
|
-
}
|
768
|
-
}
|
769
|
-
if (!resolvedMessage && (!(isString(format2) || isMessageAST(format2) || isMessageFunction(format2)) || !isString(targetLocale))) {
|
770
|
-
return unresolving ? NOT_RESOLVED : key;
|
771
|
-
}
|
772
|
-
if (process.env.NODE_ENV !== "production" && isString(format2) && context.messageCompiler == null) {
|
773
|
-
warn(`The message format compilation is not supported in this build. Because message compiler isn't included. You need to pre-compilation all message format. So translate function return '${key}'.`);
|
774
|
-
return key;
|
775
|
-
}
|
776
|
-
let occurred = false;
|
777
|
-
const onError = () => {
|
778
|
-
occurred = true;
|
779
|
-
};
|
780
|
-
const msg = !isMessageFunction(format2) ? compileMessageFormat(context, key, targetLocale, format2, cacheBaseKey, onError) : format2;
|
781
|
-
if (occurred) {
|
782
|
-
return format2;
|
783
|
-
}
|
784
|
-
const ctxOptions = getMessageContextOptions(context, targetLocale, message, options);
|
785
|
-
const msgContext = createMessageContext(ctxOptions);
|
786
|
-
const messaged = evaluateMessage(context, msg, msgContext);
|
787
|
-
const ret = postTranslation ? postTranslation(messaged, key) : messaged;
|
788
|
-
if (process.env.NODE_ENV !== "production" || __INTLIFY_PROD_DEVTOOLS__) {
|
789
|
-
const payloads = {
|
790
|
-
timestamp: Date.now(),
|
791
|
-
key: isString(key) ? key : isMessageFunction(format2) ? format2.key : "",
|
792
|
-
locale: targetLocale || (isMessageFunction(format2) ? format2.locale : ""),
|
793
|
-
format: isString(format2) ? format2 : isMessageFunction(format2) ? format2.source : "",
|
794
|
-
message: ret
|
795
|
-
};
|
796
|
-
payloads.meta = assign({}, context.__meta, /* @__PURE__ */ getAdditionalMeta() || {});
|
797
|
-
translateDevTools(payloads);
|
798
|
-
}
|
799
|
-
return ret;
|
800
|
-
}
|
801
|
-
function escapeParams(options) {
|
802
|
-
if (isArray(options.list)) {
|
803
|
-
options.list = options.list.map((item) => isString(item) ? escapeHtml(item) : item);
|
804
|
-
} else if (isObject(options.named)) {
|
805
|
-
Object.keys(options.named).forEach((key) => {
|
806
|
-
if (isString(options.named[key])) {
|
807
|
-
options.named[key] = escapeHtml(options.named[key]);
|
808
|
-
}
|
809
|
-
});
|
810
|
-
}
|
811
|
-
}
|
812
|
-
function resolveMessageFormat(context, key, locale, fallbackLocale, fallbackWarn, missingWarn) {
|
813
|
-
const { messages, onWarn, messageResolver: resolveValue2, localeFallbacker } = context;
|
814
|
-
const locales = localeFallbacker(context, fallbackLocale, locale);
|
815
|
-
let message = create();
|
816
|
-
let targetLocale;
|
817
|
-
let format2 = null;
|
818
|
-
let from = locale;
|
819
|
-
let to = null;
|
820
|
-
const type = "translate";
|
821
|
-
for (let i = 0; i < locales.length; i++) {
|
822
|
-
targetLocale = to = locales[i];
|
823
|
-
if (process.env.NODE_ENV !== "production" && locale !== targetLocale && !isAlmostSameLocale(locale, targetLocale) && isTranslateFallbackWarn(fallbackWarn, key)) {
|
824
|
-
onWarn(getWarnMessage(CoreWarnCodes.FALLBACK_TO_TRANSLATE, {
|
825
|
-
key,
|
826
|
-
target: targetLocale
|
827
|
-
}));
|
828
|
-
}
|
829
|
-
if (process.env.NODE_ENV !== "production" && locale !== targetLocale) {
|
830
|
-
const emitter = context.__v_emitter;
|
831
|
-
if (emitter) {
|
832
|
-
emitter.emit("fallback", {
|
833
|
-
type,
|
834
|
-
key,
|
835
|
-
from,
|
836
|
-
to,
|
837
|
-
groupId: `${type}:${key}`
|
838
|
-
});
|
839
|
-
}
|
840
|
-
}
|
841
|
-
message = messages[targetLocale] || create();
|
842
|
-
let start = null;
|
843
|
-
let startTag;
|
844
|
-
let endTag;
|
845
|
-
if (process.env.NODE_ENV !== "production" && inBrowser) {
|
846
|
-
start = window.performance.now();
|
847
|
-
startTag = "intlify-message-resolve-start";
|
848
|
-
endTag = "intlify-message-resolve-end";
|
849
|
-
mark && mark(startTag);
|
850
|
-
}
|
851
|
-
if ((format2 = resolveValue2(message, key)) === null) {
|
852
|
-
format2 = message[key];
|
853
|
-
}
|
854
|
-
if (process.env.NODE_ENV !== "production" && inBrowser) {
|
855
|
-
const end = window.performance.now();
|
856
|
-
const emitter = context.__v_emitter;
|
857
|
-
if (emitter && start && format2) {
|
858
|
-
emitter.emit("message-resolve", {
|
859
|
-
type: "message-resolve",
|
860
|
-
key,
|
861
|
-
message: format2,
|
862
|
-
time: end - start,
|
863
|
-
groupId: `${type}:${key}`
|
864
|
-
});
|
865
|
-
}
|
866
|
-
if (startTag && endTag && mark && measure) {
|
867
|
-
mark(endTag);
|
868
|
-
measure("intlify message resolve", startTag, endTag);
|
869
|
-
}
|
870
|
-
}
|
871
|
-
if (isString(format2) || isMessageAST(format2) || isMessageFunction(format2)) {
|
872
|
-
break;
|
873
|
-
}
|
874
|
-
if (!isImplicitFallback(targetLocale, locales)) {
|
875
|
-
const missingRet = handleMissing(
|
876
|
-
context,
|
877
|
-
// eslint-disable-line @typescript-eslint/no-explicit-any
|
878
|
-
key,
|
879
|
-
targetLocale,
|
880
|
-
missingWarn,
|
881
|
-
type
|
882
|
-
);
|
883
|
-
if (missingRet !== key) {
|
884
|
-
format2 = missingRet;
|
885
|
-
}
|
886
|
-
}
|
887
|
-
from = to;
|
888
|
-
}
|
889
|
-
return [format2, targetLocale, message];
|
890
|
-
}
|
891
|
-
function compileMessageFormat(context, key, targetLocale, format2, cacheBaseKey, onError) {
|
892
|
-
const { messageCompiler, warnHtmlMessage } = context;
|
893
|
-
if (isMessageFunction(format2)) {
|
894
|
-
const msg2 = format2;
|
895
|
-
msg2.locale = msg2.locale || targetLocale;
|
896
|
-
msg2.key = msg2.key || key;
|
897
|
-
return msg2;
|
898
|
-
}
|
899
|
-
if (messageCompiler == null) {
|
900
|
-
const msg2 = () => format2;
|
901
|
-
msg2.locale = targetLocale;
|
902
|
-
msg2.key = key;
|
903
|
-
return msg2;
|
904
|
-
}
|
905
|
-
let start = null;
|
906
|
-
let startTag;
|
907
|
-
let endTag;
|
908
|
-
if (process.env.NODE_ENV !== "production" && inBrowser) {
|
909
|
-
start = window.performance.now();
|
910
|
-
startTag = "intlify-message-compilation-start";
|
911
|
-
endTag = "intlify-message-compilation-end";
|
912
|
-
mark && mark(startTag);
|
913
|
-
}
|
914
|
-
const msg = messageCompiler(format2, getCompileContext(context, targetLocale, cacheBaseKey, format2, warnHtmlMessage, onError));
|
915
|
-
if (process.env.NODE_ENV !== "production" && inBrowser) {
|
916
|
-
const end = window.performance.now();
|
917
|
-
const emitter = context.__v_emitter;
|
918
|
-
if (emitter && start) {
|
919
|
-
emitter.emit("message-compilation", {
|
920
|
-
type: "message-compilation",
|
921
|
-
message: format2,
|
922
|
-
time: end - start,
|
923
|
-
groupId: `${"translate"}:${key}`
|
924
|
-
});
|
925
|
-
}
|
926
|
-
if (startTag && endTag && mark && measure) {
|
927
|
-
mark(endTag);
|
928
|
-
measure("intlify message compilation", startTag, endTag);
|
929
|
-
}
|
930
|
-
}
|
931
|
-
msg.locale = targetLocale;
|
932
|
-
msg.key = key;
|
933
|
-
msg.source = format2;
|
934
|
-
return msg;
|
935
|
-
}
|
936
|
-
function evaluateMessage(context, msg, msgCtx) {
|
937
|
-
let start = null;
|
938
|
-
let startTag;
|
939
|
-
let endTag;
|
940
|
-
if (process.env.NODE_ENV !== "production" && inBrowser) {
|
941
|
-
start = window.performance.now();
|
942
|
-
startTag = "intlify-message-evaluation-start";
|
943
|
-
endTag = "intlify-message-evaluation-end";
|
944
|
-
mark && mark(startTag);
|
945
|
-
}
|
946
|
-
const messaged = msg(msgCtx);
|
947
|
-
if (process.env.NODE_ENV !== "production" && inBrowser) {
|
948
|
-
const end = window.performance.now();
|
949
|
-
const emitter = context.__v_emitter;
|
950
|
-
if (emitter && start) {
|
951
|
-
emitter.emit("message-evaluation", {
|
952
|
-
type: "message-evaluation",
|
953
|
-
value: messaged,
|
954
|
-
time: end - start,
|
955
|
-
groupId: `${"translate"}:${msg.key}`
|
956
|
-
});
|
957
|
-
}
|
958
|
-
if (startTag && endTag && mark && measure) {
|
959
|
-
mark(endTag);
|
960
|
-
measure("intlify message evaluation", startTag, endTag);
|
961
|
-
}
|
962
|
-
}
|
963
|
-
return messaged;
|
964
|
-
}
|
965
|
-
function parseTranslateArgs(...args) {
|
966
|
-
const [arg1, arg2, arg3] = args;
|
967
|
-
const options = create();
|
968
|
-
if (!isString(arg1) && !isNumber(arg1) && !isMessageFunction(arg1) && !isMessageAST(arg1)) {
|
969
|
-
throw createCoreError(CoreErrorCodes.INVALID_ARGUMENT);
|
970
|
-
}
|
971
|
-
const key = isNumber(arg1) ? String(arg1) : isMessageFunction(arg1) ? arg1 : arg1;
|
972
|
-
if (isNumber(arg2)) {
|
973
|
-
options.plural = arg2;
|
974
|
-
} else if (isString(arg2)) {
|
975
|
-
options.default = arg2;
|
976
|
-
} else if (isPlainObject(arg2) && !isEmptyObject(arg2)) {
|
977
|
-
options.named = arg2;
|
978
|
-
} else if (isArray(arg2)) {
|
979
|
-
options.list = arg2;
|
980
|
-
}
|
981
|
-
if (isNumber(arg3)) {
|
982
|
-
options.plural = arg3;
|
983
|
-
} else if (isString(arg3)) {
|
984
|
-
options.default = arg3;
|
985
|
-
} else if (isPlainObject(arg3)) {
|
986
|
-
assign(options, arg3);
|
987
|
-
}
|
988
|
-
return [key, options];
|
989
|
-
}
|
990
|
-
function getCompileContext(context, locale, key, source, warnHtmlMessage, onError) {
|
991
|
-
return {
|
992
|
-
locale,
|
993
|
-
key,
|
994
|
-
warnHtmlMessage,
|
995
|
-
onError: (err) => {
|
996
|
-
onError && onError(err);
|
997
|
-
if (process.env.NODE_ENV !== "production") {
|
998
|
-
const _source = getSourceForCodeFrame(source);
|
999
|
-
const message = `Message compilation error: ${err.message}`;
|
1000
|
-
const codeFrame = err.location && _source && generateCodeFrame(_source, err.location.start.offset, err.location.end.offset);
|
1001
|
-
const emitter = context.__v_emitter;
|
1002
|
-
if (emitter && _source) {
|
1003
|
-
emitter.emit("compile-error", {
|
1004
|
-
message: _source,
|
1005
|
-
error: err.message,
|
1006
|
-
start: err.location && err.location.start.offset,
|
1007
|
-
end: err.location && err.location.end.offset,
|
1008
|
-
groupId: `${"translate"}:${key}`
|
1009
|
-
});
|
1010
|
-
}
|
1011
|
-
console.error(codeFrame ? `${message}
|
1012
|
-
${codeFrame}` : message);
|
1013
|
-
} else {
|
1014
|
-
throw err;
|
1015
|
-
}
|
1016
|
-
},
|
1017
|
-
onCacheKey: (source2) => generateFormatCacheKey(locale, key, source2)
|
1018
|
-
};
|
1019
|
-
}
|
1020
|
-
function getSourceForCodeFrame(source) {
|
1021
|
-
if (isString(source)) {
|
1022
|
-
return source;
|
1023
|
-
} else {
|
1024
|
-
if (source.loc && source.loc.source) {
|
1025
|
-
return source.loc.source;
|
1026
|
-
}
|
1027
|
-
}
|
1028
|
-
}
|
1029
|
-
function getMessageContextOptions(context, locale, message, options) {
|
1030
|
-
const { modifiers, pluralRules, messageResolver: resolveValue2, fallbackLocale, fallbackWarn, missingWarn, fallbackContext } = context;
|
1031
|
-
const resolveMessage = (key, useLinked) => {
|
1032
|
-
let val = resolveValue2(message, key);
|
1033
|
-
if (val == null && (fallbackContext || useLinked)) {
|
1034
|
-
const [, , message2] = resolveMessageFormat(
|
1035
|
-
fallbackContext || context,
|
1036
|
-
// NOTE: if has fallbackContext, fallback to root, else if use linked, fallback to local context
|
1037
|
-
key,
|
1038
|
-
locale,
|
1039
|
-
fallbackLocale,
|
1040
|
-
fallbackWarn,
|
1041
|
-
missingWarn
|
1042
|
-
);
|
1043
|
-
val = resolveValue2(message2, key);
|
1044
|
-
}
|
1045
|
-
if (isString(val) || isMessageAST(val)) {
|
1046
|
-
let occurred = false;
|
1047
|
-
const onError = () => {
|
1048
|
-
occurred = true;
|
1049
|
-
};
|
1050
|
-
const msg = compileMessageFormat(context, key, locale, val, key, onError);
|
1051
|
-
return !occurred ? msg : NOOP_MESSAGE_FUNCTION;
|
1052
|
-
} else if (isMessageFunction(val)) {
|
1053
|
-
return val;
|
1054
|
-
} else {
|
1055
|
-
return NOOP_MESSAGE_FUNCTION;
|
1056
|
-
}
|
1057
|
-
};
|
1058
|
-
const ctxOptions = {
|
1059
|
-
locale,
|
1060
|
-
modifiers,
|
1061
|
-
pluralRules,
|
1062
|
-
messages: resolveMessage
|
1063
|
-
};
|
1064
|
-
if (context.processor) {
|
1065
|
-
ctxOptions.processor = context.processor;
|
1066
|
-
}
|
1067
|
-
if (options.list) {
|
1068
|
-
ctxOptions.list = options.list;
|
1069
|
-
}
|
1070
|
-
if (options.named) {
|
1071
|
-
ctxOptions.named = options.named;
|
1072
|
-
}
|
1073
|
-
if (isNumber(options.plural)) {
|
1074
|
-
ctxOptions.pluralIndex = options.plural;
|
1075
|
-
}
|
1076
|
-
return ctxOptions;
|
1077
|
-
}
|
1078
|
-
{
|
1079
|
-
initFeatureFlags();
|
1080
|
-
}
|
1081
|
-
export {
|
1082
|
-
AST_NODE_PROPS_KEYS,
|
1083
|
-
CORE_ERROR_CODES_EXTEND_POINT,
|
1084
|
-
CORE_WARN_CODES_EXTEND_POINT,
|
1085
|
-
CoreWarnCodes,
|
1086
|
-
DATETIME_FORMAT_OPTIONS_KEYS,
|
1087
|
-
DEFAULT_LOCALE,
|
1088
|
-
DEFAULT_MESSAGE_DATA_TYPE,
|
1089
|
-
MISSING_RESOLVE_VALUE,
|
1090
|
-
NOT_RESOLVED,
|
1091
|
-
NUMBER_FORMAT_OPTIONS_KEYS,
|
1092
|
-
VERSION,
|
1093
|
-
clearDateTimeFormat,
|
1094
|
-
clearNumberFormat,
|
1095
|
-
createCompileError,
|
1096
|
-
createCoreContext,
|
1097
|
-
createCoreError,
|
1098
|
-
createMessageContext,
|
1099
|
-
datetime,
|
1100
|
-
fallbackWithLocaleChain,
|
1101
|
-
fallbackWithSimple,
|
1102
|
-
getAdditionalMeta,
|
1103
|
-
getFallbackContext,
|
1104
|
-
getLocale,
|
1105
|
-
getWarnMessage,
|
1106
|
-
handleMissing,
|
1107
|
-
initI18nDevTools,
|
1108
|
-
isAlmostSameLocale,
|
1109
|
-
isImplicitFallback,
|
1110
|
-
isMessageAST,
|
1111
|
-
isMessageFunction,
|
1112
|
-
isTranslateFallbackWarn,
|
1113
|
-
isTranslateMissingWarn,
|
1114
|
-
number,
|
1115
|
-
parseDateTimeArgs,
|
1116
|
-
parseNumberArgs,
|
1117
|
-
parseTranslateArgs,
|
1118
|
-
resolveLocale,
|
1119
|
-
resolveWithKeyValue,
|
1120
|
-
setAdditionalMeta,
|
1121
|
-
setDevToolsHook,
|
1122
|
-
setFallbackContext,
|
1123
|
-
translate,
|
1124
|
-
translateDevTools,
|
1125
|
-
updateFallbackLocale
|
1126
|
-
};
|