react-native-system-ui 0.0.6 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +53 -30
- package/dist/cjs/components/action-sheet/ActionSheet.js +97 -105
- package/dist/cjs/components/action-sheet/tokens.js +16 -27
- package/dist/cjs/components/area/Area.js +54 -67
- package/dist/cjs/components/area/tokens.js +6 -3
- package/dist/cjs/components/avatar/Avatar.js +25 -23
- package/dist/cjs/components/badge/Badge.js +31 -31
- package/dist/cjs/components/badge/tokens.js +6 -8
- package/dist/cjs/components/button/Button.js +115 -151
- package/dist/cjs/components/button/ButtonGroup.js +8 -42
- package/dist/cjs/components/button/tokens.js +1 -8
- package/dist/cjs/components/calendar/Calendar.js +212 -223
- package/dist/cjs/components/calendar/tokens.js +3 -3
- package/dist/cjs/components/cascader/Cascader.js +177 -180
- package/dist/cjs/components/cascader/tokens.js +2 -2
- package/dist/cjs/components/cascader/useCascaderExtend.js +25 -29
- package/dist/cjs/components/cell/Cell.js +70 -83
- package/dist/cjs/components/cell/CellGroup.js +16 -29
- package/dist/cjs/components/checkbox/Checkbox.js +139 -132
- package/dist/cjs/components/checkbox/CheckboxGroup.js +4 -35
- package/dist/cjs/components/checkbox/tokens.js +7 -10
- package/dist/cjs/components/circle/Circle.js +25 -24
- package/dist/cjs/components/collapse/Collapse.js +75 -91
- package/dist/cjs/components/config-provider/ConfigProvider.js +16 -3
- package/dist/cjs/components/config-provider/DirectionContext.js +15 -0
- package/dist/cjs/components/config-provider/index.js +7 -0
- package/dist/cjs/components/config-provider/locale/en-US.js +32 -0
- package/dist/cjs/components/config-provider/locale/zh-CN.js +32 -0
- package/dist/cjs/components/config-provider/useDirection.js +16 -0
- package/dist/cjs/components/count-down/CountDown.js +20 -15
- package/dist/cjs/components/datetime-picker/DatetimePicker.js +61 -84
- package/dist/cjs/components/datetime-picker/tokens.js +14 -3
- package/dist/cjs/components/dialog/Dialog.js +153 -121
- package/dist/cjs/components/dialog/imperative.js +17 -30
- package/dist/cjs/components/divider/Divider.js +26 -28
- package/dist/cjs/components/empty/Empty.js +35 -39
- package/dist/cjs/components/error-boundary/ErrorBoundary.js +73 -0
- package/dist/cjs/components/error-boundary/index.js +19 -0
- package/dist/cjs/components/field/Field.js +109 -106
- package/dist/cjs/components/flex/Flex.js +18 -18
- package/dist/cjs/components/flex/FlexItem.js +26 -27
- package/dist/cjs/components/form/Form.js +142 -161
- package/dist/cjs/components/form/FormItem.js +69 -97
- package/dist/cjs/components/form/FormList.js +49 -37
- package/dist/cjs/components/form/tokens.js +6 -3
- package/dist/cjs/components/form/utils.js +15 -34
- package/dist/cjs/components/grid/Grid.js +30 -29
- package/dist/cjs/components/grid/GridItem.js +84 -85
- package/dist/cjs/components/image/Image.js +55 -59
- package/dist/cjs/components/image/tokens.js +2 -2
- package/dist/cjs/components/image-preview/ImagePreview.js +124 -112
- package/dist/cjs/components/image-preview/imperative.js +4 -13
- package/dist/cjs/components/index.js +13 -0
- package/dist/cjs/components/input/Input.js +30 -22
- package/dist/cjs/components/loading/Loading.js +14 -15
- package/dist/cjs/components/nav-bar/NavBar.js +68 -83
- package/dist/cjs/components/nav-bar/tokens.js +1 -9
- package/dist/cjs/components/notice-bar/NoticeBar.js +74 -77
- package/dist/cjs/components/notify/Notify.js +88 -84
- package/dist/cjs/components/notify/imperative.js +20 -43
- package/dist/cjs/components/notify/tokens.js +1 -11
- package/dist/cjs/components/number-keyboard/NumberKeyboard.js +187 -209
- package/dist/cjs/components/overlay/Overlay.js +37 -52
- package/dist/cjs/components/overlay/tokens.js +5 -3
- package/dist/cjs/components/password-input/PasswordInput.js +98 -79
- package/dist/cjs/components/picker/Picker.js +440 -421
- package/dist/cjs/components/picker/tokens.js +1 -1
- package/dist/cjs/components/popup/Popup.js +263 -293
- package/dist/cjs/components/portal/Portal.js +12 -29
- package/dist/cjs/components/portal/PortalHost.js +151 -234
- package/dist/cjs/components/progress/Progress.js +51 -48
- package/dist/cjs/components/radio/Radio.js +45 -42
- package/dist/cjs/components/radio/RadioGroup.js +8 -40
- package/dist/cjs/components/radio/tokens.js +7 -10
- package/dist/cjs/components/safe-area-view/SafeAreaView.js +22 -26
- package/dist/cjs/components/search/Search.js +51 -43
- package/dist/cjs/components/selector/Selector.js +14 -13
- package/dist/cjs/components/share-sheet/ShareSheet.js +160 -161
- package/dist/cjs/components/sidebar/Sidebar.js +39 -45
- package/dist/cjs/components/sidebar/SidebarContext.js +1 -2
- package/dist/cjs/components/sidebar/SidebarItem.js +13 -16
- package/dist/cjs/components/sidebar/tokens.js +1 -3
- package/dist/cjs/components/skeleton/Skeleton.js +30 -37
- package/dist/cjs/components/skeleton/tokens.js +1 -2
- package/dist/cjs/components/slider/Slider.js +156 -135
- package/dist/cjs/components/space/Space.js +46 -69
- package/dist/cjs/components/stepper/Stepper.js +177 -155
- package/dist/cjs/components/swiper/Swiper.js +251 -253
- package/dist/cjs/components/swiper/SwiperPagIndicator.js +25 -27
- package/dist/cjs/components/swiper/tokens.js +10 -3
- package/dist/cjs/components/switch/Switch.js +13 -15
- package/dist/cjs/components/tabbar/Tabbar.js +35 -27
- package/dist/cjs/components/tabbar/TabbarContext.js +1 -2
- package/dist/cjs/components/tabbar/TabbarItem.js +65 -68
- package/dist/cjs/components/tabs/Tabs.js +286 -313
- package/dist/cjs/components/tag/Tag.js +46 -37
- package/dist/cjs/components/toast/Toast.js +90 -90
- package/dist/cjs/components/toast/imperative.js +16 -41
- package/dist/cjs/components/typography/Typography.js +3 -5
- package/dist/cjs/components/water-mark/WaterMark.js +31 -29
- package/dist/cjs/design-system/ThemeProvider.js +5 -11
- package/dist/cjs/design-system/createComponentTokensHook.js +11 -13
- package/dist/cjs/design-system/presets.js +2 -3
- package/dist/cjs/design-system/tokens.js +2 -11
- package/dist/cjs/hooks/animation/index.js +25 -0
- package/dist/cjs/hooks/animation/useAnimatedTransition.js +72 -0
- package/dist/cjs/hooks/animation/useReducedMotion.js +75 -0
- package/dist/cjs/hooks/aria/useAriaListBox.js +8 -16
- package/dist/cjs/hooks/aria/useAriaOverlay.js +3 -3
- package/dist/cjs/hooks/aria/useAriaPress.js +8 -21
- package/dist/cjs/hooks/aria/useAriaToggle.js +3 -3
- package/dist/cjs/hooks/gesture/useGestureScroll.js +60 -61
- package/dist/cjs/hooks/index.js +12 -0
- package/dist/cjs/hooks/overlay/OverlayStackStore.js +49 -69
- package/dist/cjs/hooks/overlay/useOverlayStack.js +13 -19
- package/dist/cjs/hooks/useControllableValue.js +10 -21
- package/dist/cjs/hooks/useCountDown.js +14 -22
- package/dist/cjs/hooks/useHairline.js +17 -29
- package/dist/cjs/hooks/useSafeAreaPadding.js +1 -4
- package/dist/cjs/index.js +67 -1
- package/dist/cjs/platform/animation.js +10 -2
- package/dist/cjs/platform/measure.js +18 -36
- package/dist/cjs/utils/color.js +21 -35
- package/dist/cjs/utils/compare.js +7 -12
- package/dist/cjs/utils/createPlatformShadow.js +28 -39
- package/dist/cjs/utils/date.js +20 -50
- package/dist/cjs/utils/deepMerge.js +16 -26
- package/dist/cjs/utils/hairline.js +74 -71
- package/dist/cjs/utils/index.js +22 -0
- package/dist/cjs/utils/number.js +21 -29
- package/dist/cjs/utils/render.js +27 -0
- package/dist/cjs/utils/rtl.js +25 -0
- package/dist/cjs/utils/string.js +8 -25
- package/dist/es/components/action-sheet/ActionSheet.js +99 -107
- package/dist/es/components/action-sheet/tokens.js +16 -27
- package/dist/es/components/area/Area.js +55 -68
- package/dist/es/components/area/tokens.js +6 -3
- package/dist/es/components/avatar/Avatar.js +25 -23
- package/dist/es/components/avatar/index.js +1 -2
- package/dist/es/components/badge/Badge.js +33 -33
- package/dist/es/components/badge/tokens.js +6 -8
- package/dist/es/components/button/Button.js +116 -152
- package/dist/es/components/button/ButtonGroup.js +9 -43
- package/dist/es/components/button/tokens.js +2 -3
- package/dist/es/components/calendar/Calendar.js +214 -225
- package/dist/es/components/calendar/tokens.js +3 -3
- package/dist/es/components/cascader/Cascader.js +180 -183
- package/dist/es/components/cascader/tokens.js +2 -2
- package/dist/es/components/cascader/useCascaderExtend.js +25 -29
- package/dist/es/components/cell/Cell.js +71 -84
- package/dist/es/components/cell/CellGroup.js +16 -28
- package/dist/es/components/checkbox/Checkbox.js +140 -133
- package/dist/es/components/checkbox/CheckboxGroup.js +5 -36
- package/dist/es/components/checkbox/tokens.js +7 -10
- package/dist/es/components/circle/Circle.js +25 -23
- package/dist/es/components/collapse/Collapse.js +77 -92
- package/dist/es/components/config-provider/ConfigProvider.js +10 -3
- package/dist/es/components/config-provider/DirectionContext.js +2 -0
- package/dist/es/components/config-provider/index.js +1 -0
- package/dist/es/components/config-provider/locale/en-US.js +32 -0
- package/dist/es/components/config-provider/locale/zh-CN.js +32 -0
- package/dist/es/components/config-provider/useDirection.js +3 -0
- package/dist/es/components/count-down/CountDown.js +23 -18
- package/dist/es/components/datetime-picker/DatetimePicker.js +61 -84
- package/dist/es/components/datetime-picker/tokens.js +14 -3
- package/dist/es/components/dialog/Dialog.js +154 -121
- package/dist/es/components/dialog/imperative.js +17 -30
- package/dist/es/components/divider/Divider.js +28 -29
- package/dist/es/components/empty/Empty.js +36 -39
- package/dist/es/components/error-boundary/ErrorBoundary.js +61 -0
- package/dist/es/components/error-boundary/index.js +1 -0
- package/dist/es/components/field/Field.js +109 -106
- package/dist/es/components/flex/Flex.js +18 -17
- package/dist/es/components/flex/FlexItem.js +27 -27
- package/dist/es/components/form/Form.js +143 -162
- package/dist/es/components/form/FormItem.js +68 -95
- package/dist/es/components/form/FormList.js +49 -37
- package/dist/es/components/form/tokens.js +6 -3
- package/dist/es/components/form/utils.js +15 -34
- package/dist/es/components/grid/Grid.js +30 -28
- package/dist/es/components/grid/GridItem.js +84 -84
- package/dist/es/components/image/Image.js +58 -62
- package/dist/es/components/image/tokens.js +2 -2
- package/dist/es/components/image-preview/ImagePreview.js +124 -112
- package/dist/es/components/image-preview/imperative.js +4 -13
- package/dist/es/components/index.js +3 -1
- package/dist/es/components/input/Input.js +31 -23
- package/dist/es/components/loading/Loading.js +16 -16
- package/dist/es/components/nav-bar/NavBar.js +68 -83
- package/dist/es/components/nav-bar/tokens.js +1 -3
- package/dist/es/components/notice-bar/NoticeBar.js +74 -76
- package/dist/es/components/notify/Notify.js +92 -87
- package/dist/es/components/notify/imperative.js +21 -44
- package/dist/es/components/notify/tokens.js +1 -5
- package/dist/es/components/number-keyboard/NumberKeyboard.js +187 -209
- package/dist/es/components/overlay/Overlay.js +36 -51
- package/dist/es/components/overlay/tokens.js +5 -3
- package/dist/es/components/password-input/PasswordInput.js +98 -79
- package/dist/es/components/picker/Picker.js +440 -421
- package/dist/es/components/picker/tokens.js +1 -1
- package/dist/es/components/popup/Popup.js +263 -292
- package/dist/es/components/portal/Portal.js +13 -29
- package/dist/es/components/portal/PortalHost.js +152 -234
- package/dist/es/components/progress/Progress.js +51 -48
- package/dist/es/components/radio/Radio.js +47 -44
- package/dist/es/components/radio/RadioGroup.js +10 -41
- package/dist/es/components/radio/tokens.js +7 -10
- package/dist/es/components/safe-area-view/SafeAreaView.js +22 -25
- package/dist/es/components/search/Search.js +52 -44
- package/dist/es/components/selector/Selector.js +14 -13
- package/dist/es/components/share-sheet/ShareSheet.js +162 -163
- package/dist/es/components/sidebar/Sidebar.js +41 -47
- package/dist/es/components/sidebar/SidebarContext.js +1 -2
- package/dist/es/components/sidebar/SidebarItem.js +13 -15
- package/dist/es/components/sidebar/tokens.js +1 -3
- package/dist/es/components/skeleton/Skeleton.js +30 -37
- package/dist/es/components/skeleton/tokens.js +1 -2
- package/dist/es/components/slider/Slider.js +156 -134
- package/dist/es/components/space/Space.js +48 -71
- package/dist/es/components/stepper/Stepper.js +178 -156
- package/dist/es/components/swiper/Swiper.js +252 -254
- package/dist/es/components/swiper/SwiperPagIndicator.js +25 -27
- package/dist/es/components/swiper/tokens.js +10 -3
- package/dist/es/components/switch/Switch.js +13 -15
- package/dist/es/components/tabbar/Tabbar.js +36 -28
- package/dist/es/components/tabbar/TabbarContext.js +1 -2
- package/dist/es/components/tabbar/TabbarItem.js +66 -69
- package/dist/es/components/tabs/Tabs.js +286 -313
- package/dist/es/components/tag/Tag.js +49 -39
- package/dist/es/components/toast/Toast.js +93 -91
- package/dist/es/components/toast/imperative.js +16 -41
- package/dist/es/components/typography/Typography.js +3 -5
- package/dist/es/components/water-mark/WaterMark.js +32 -30
- package/dist/es/design-system/ThemeProvider.js +5 -11
- package/dist/es/design-system/createComponentTokensHook.js +11 -13
- package/dist/es/design-system/presets.js +2 -3
- package/dist/es/design-system/tokens.js +1 -9
- package/dist/es/hooks/animation/index.js +2 -0
- package/dist/es/hooks/animation/useAnimatedTransition.js +53 -0
- package/dist/es/hooks/animation/useReducedMotion.js +54 -0
- package/dist/es/hooks/aria/useAriaListBox.js +8 -16
- package/dist/es/hooks/aria/useAriaOverlay.js +3 -3
- package/dist/es/hooks/aria/useAriaPress.js +8 -21
- package/dist/es/hooks/aria/useAriaToggle.js +3 -3
- package/dist/es/hooks/gesture/useGestureScroll.js +60 -61
- package/dist/es/hooks/index.js +1 -0
- package/dist/es/hooks/overlay/OverlayStackStore.js +49 -69
- package/dist/es/hooks/overlay/useOverlayStack.js +13 -19
- package/dist/es/hooks/useControllableValue.js +10 -21
- package/dist/es/hooks/useCountDown.js +14 -22
- package/dist/es/hooks/useHairline.js +16 -28
- package/dist/es/hooks/useSafeAreaPadding.js +1 -4
- package/dist/es/index.js +8 -1
- package/dist/es/platform/animation.js +9 -1
- package/dist/es/platform/measure.js +18 -36
- package/dist/es/utils/color.js +21 -35
- package/dist/es/utils/compare.js +7 -12
- package/dist/es/utils/createPlatformShadow.js +28 -39
- package/dist/es/utils/date.js +20 -50
- package/dist/es/utils/deepMerge.js +16 -26
- package/dist/es/utils/hairline.js +73 -65
- package/dist/es/utils/index.js +2 -0
- package/dist/es/utils/number.js +21 -29
- package/dist/es/utils/render.js +7 -0
- package/dist/es/utils/rtl.js +17 -0
- package/dist/es/utils/string.js +8 -25
- package/dist/types/components/action-sheet/ActionSheet.d.ts +1 -1
- package/dist/types/components/area/Area.d.ts +1 -1
- package/dist/types/components/area/tokens.d.ts +4 -0
- package/dist/types/components/avatar/Avatar.d.ts +1 -1
- package/dist/types/components/avatar/index.d.ts +1 -2
- package/dist/types/components/badge/Badge.d.ts +1 -1
- package/dist/types/components/button/Button.d.ts +1 -1
- package/dist/types/components/button/index.d.ts +1 -1
- package/dist/types/components/calendar/Calendar.d.ts +1 -1
- package/dist/types/components/cascader/Cascader.d.ts +1 -1
- package/dist/types/components/cell/Cell.d.ts +1 -1
- package/dist/types/components/cell/CellGroup.d.ts +1 -1
- package/dist/types/components/cell/index.d.ts +2 -2
- package/dist/types/components/checkbox/Checkbox.d.ts +1 -1
- package/dist/types/components/circle/Circle.d.ts +1 -1
- package/dist/types/components/collapse/Collapse.d.ts +1 -2
- package/dist/types/components/config-provider/DirectionContext.d.ts +3 -0
- package/dist/types/components/config-provider/index.d.ts +2 -1
- package/dist/types/components/config-provider/locale/en-US.d.ts +32 -0
- package/dist/types/components/config-provider/locale/zh-CN.d.ts +32 -0
- package/dist/types/components/config-provider/useDirection.d.ts +1 -0
- package/dist/types/components/count-down/CountDown.d.ts +1 -1
- package/dist/types/components/datetime-picker/DatetimePicker.d.ts +1 -1
- package/dist/types/components/datetime-picker/tokens.d.ts +12 -0
- package/dist/types/components/dialog/Dialog.d.ts +1 -1
- package/dist/types/components/divider/Divider.d.ts +1 -1
- package/dist/types/components/empty/Empty.d.ts +1 -1
- package/dist/types/components/error-boundary/ErrorBoundary.d.ts +6 -0
- package/dist/types/components/error-boundary/index.d.ts +2 -0
- package/dist/types/components/field/Field.d.ts +1 -1
- package/dist/types/components/flex/Flex.d.ts +1 -1
- package/dist/types/components/flex/FlexItem.d.ts +1 -1
- package/dist/types/components/flex/index.d.ts +2 -2
- package/dist/types/components/form/Form.d.ts +1 -1
- package/dist/types/components/form/FormItem.d.ts +2 -1
- package/dist/types/components/form/index.d.ts +2 -2
- package/dist/types/components/form/tokens.d.ts +4 -0
- package/dist/types/components/grid/Grid.d.ts +1 -1
- package/dist/types/components/grid/GridItem.d.ts +1 -1
- package/dist/types/components/grid/index.d.ts +2 -2
- package/dist/types/components/image/Image.d.ts +1 -1
- package/dist/types/components/image-preview/ImagePreview.d.ts +1 -1
- package/dist/types/components/index.d.ts +4 -1
- package/dist/types/components/input/Input.d.ts +3 -3
- package/dist/types/components/loading/Loading.d.ts +1 -1
- package/dist/types/components/nav-bar/NavBar.d.ts +1 -1
- package/dist/types/components/notice-bar/NoticeBar.d.ts +1 -1
- package/dist/types/components/notify/Notify.d.ts +2 -2
- package/dist/types/components/notify/index.d.ts +1 -1
- package/dist/types/components/overlay/Overlay.d.ts +1 -5
- package/dist/types/components/overlay/tokens.d.ts +3 -0
- package/dist/types/components/password-input/PasswordInput.d.ts +1 -1
- package/dist/types/components/picker/Picker.d.ts +5 -5
- package/dist/types/components/popup/Popup.d.ts +3 -42
- package/dist/types/components/portal/Portal.d.ts +9 -6
- package/dist/types/components/portal/PortalHost.d.ts +1 -1
- package/dist/types/components/radio/RadioGroup.d.ts +1 -1
- package/dist/types/components/safe-area-view/SafeAreaView.d.ts +1 -1
- package/dist/types/components/search/Search.d.ts +1 -1
- package/dist/types/components/share-sheet/ShareSheet.d.ts +1 -1
- package/dist/types/components/sidebar/Sidebar.d.ts +1 -1
- package/dist/types/components/sidebar/SidebarContext.d.ts +1 -1
- package/dist/types/components/sidebar/SidebarItem.d.ts +1 -1
- package/dist/types/components/sidebar/index.d.ts +2 -2
- package/dist/types/components/skeleton/Skeleton.d.ts +1 -1
- package/dist/types/components/slider/Slider.d.ts +1 -1
- package/dist/types/components/stepper/Stepper.d.ts +1 -1
- package/dist/types/components/swiper/Swiper.d.ts +1 -1
- package/dist/types/components/swiper/index.d.ts +1 -1
- package/dist/types/components/swiper/tokens.d.ts +8 -0
- package/dist/types/components/tabbar/Tabbar.d.ts +2 -2
- package/dist/types/components/tabbar/TabbarContext.d.ts +1 -1
- package/dist/types/components/tabbar/TabbarItem.d.ts +2 -2
- package/dist/types/components/tabs/Tabs.d.ts +1 -1
- package/dist/types/components/tabs/index.d.ts +1 -1
- package/dist/types/components/tag/Tag.d.ts +1 -1
- package/dist/types/components/toast/Toast.d.ts +2 -2
- package/dist/types/components/toast/index.d.ts +1 -1
- package/dist/types/components/water-mark/WaterMark.d.ts +1 -1
- package/dist/types/design-system/tokens.d.ts +0 -1
- package/dist/types/hooks/animation/index.d.ts +3 -0
- package/dist/types/hooks/animation/useAnimatedTransition.d.ts +13 -0
- package/dist/types/hooks/animation/useReducedMotion.d.ts +3 -0
- package/dist/types/hooks/aria/useAriaOverlay.d.ts +1 -1
- package/dist/types/hooks/gesture/useGestureScroll.d.ts +11 -10
- package/dist/types/hooks/index.d.ts +1 -0
- package/dist/types/hooks/overlay/OverlayStackStore.d.ts +8 -8
- package/dist/types/hooks/useHairline.d.ts +1 -1
- package/dist/types/index.d.ts +5 -0
- package/dist/types/platform/animation.d.ts +8 -0
- package/dist/types/platform/measure.d.ts +1 -1
- package/dist/types/utils/compare.d.ts +1 -1
- package/dist/types/utils/createPlatformShadow.d.ts +2 -2
- package/dist/types/utils/date.d.ts +2 -2
- package/dist/types/utils/hairline.d.ts +5 -10
- package/dist/types/utils/index.d.ts +2 -0
- package/dist/types/utils/number.d.ts +2 -2
- package/dist/types/utils/render.d.ts +5 -0
- package/dist/types/utils/rtl.d.ts +5 -0
- package/package.json +10 -3
package/dist/cjs/index.js
CHANGED
|
@@ -3,9 +3,68 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
var _exportNames = {
|
|
7
|
+
flipStyle: true,
|
|
8
|
+
rtlRow: true,
|
|
9
|
+
deepMerge: true,
|
|
10
|
+
createPlatformShadow: true,
|
|
11
|
+
nativeDriverEnabled: true,
|
|
12
|
+
isWeb: true,
|
|
13
|
+
isIOS: true,
|
|
14
|
+
isAndroid: true
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "createPlatformShadow", {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
get: function () {
|
|
19
|
+
return _createPlatformShadow.createPlatformShadow;
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
Object.defineProperty(exports, "deepMerge", {
|
|
23
|
+
enumerable: true,
|
|
24
|
+
get: function () {
|
|
25
|
+
return _deepMerge.deepMerge;
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
Object.defineProperty(exports, "flipStyle", {
|
|
29
|
+
enumerable: true,
|
|
30
|
+
get: function () {
|
|
31
|
+
return _rtl.flipStyle;
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
Object.defineProperty(exports, "isAndroid", {
|
|
35
|
+
enumerable: true,
|
|
36
|
+
get: function () {
|
|
37
|
+
return _runtime.isAndroid;
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
Object.defineProperty(exports, "isIOS", {
|
|
41
|
+
enumerable: true,
|
|
42
|
+
get: function () {
|
|
43
|
+
return _runtime.isIOS;
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
Object.defineProperty(exports, "isWeb", {
|
|
47
|
+
enumerable: true,
|
|
48
|
+
get: function () {
|
|
49
|
+
return _runtime.isWeb;
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
Object.defineProperty(exports, "nativeDriverEnabled", {
|
|
53
|
+
enumerable: true,
|
|
54
|
+
get: function () {
|
|
55
|
+
return _animation.nativeDriverEnabled;
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
Object.defineProperty(exports, "rtlRow", {
|
|
59
|
+
enumerable: true,
|
|
60
|
+
get: function () {
|
|
61
|
+
return _rtl.rtlRow;
|
|
62
|
+
}
|
|
63
|
+
});
|
|
6
64
|
var _components = require("./components");
|
|
7
65
|
Object.keys(_components).forEach(function (key) {
|
|
8
66
|
if (key === "default" || key === "__esModule") return;
|
|
67
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
9
68
|
if (key in exports && exports[key] === _components[key]) return;
|
|
10
69
|
Object.defineProperty(exports, key, {
|
|
11
70
|
enumerable: true,
|
|
@@ -17,6 +76,7 @@ Object.keys(_components).forEach(function (key) {
|
|
|
17
76
|
var _designSystem = require("./design-system");
|
|
18
77
|
Object.keys(_designSystem).forEach(function (key) {
|
|
19
78
|
if (key === "default" || key === "__esModule") return;
|
|
79
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
20
80
|
if (key in exports && exports[key] === _designSystem[key]) return;
|
|
21
81
|
Object.defineProperty(exports, key, {
|
|
22
82
|
enumerable: true,
|
|
@@ -28,6 +88,7 @@ Object.keys(_designSystem).forEach(function (key) {
|
|
|
28
88
|
var _hooks = require("./hooks");
|
|
29
89
|
Object.keys(_hooks).forEach(function (key) {
|
|
30
90
|
if (key === "default" || key === "__esModule") return;
|
|
91
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
31
92
|
if (key in exports && exports[key] === _hooks[key]) return;
|
|
32
93
|
Object.defineProperty(exports, key, {
|
|
33
94
|
enumerable: true,
|
|
@@ -35,4 +96,9 @@ Object.keys(_hooks).forEach(function (key) {
|
|
|
35
96
|
return _hooks[key];
|
|
36
97
|
}
|
|
37
98
|
});
|
|
38
|
-
});
|
|
99
|
+
});
|
|
100
|
+
var _rtl = require("./utils/rtl");
|
|
101
|
+
var _deepMerge = require("./utils/deepMerge");
|
|
102
|
+
var _createPlatformShadow = require("./utils/createPlatformShadow");
|
|
103
|
+
var _animation = require("./platform/animation");
|
|
104
|
+
var _runtime = require("./platform/runtime");
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.nativeDriverEnabled = void 0;
|
|
6
|
+
exports.nativeDriverEnabled = exports.hardwareAccelerationProps = exports.defaultAnimationConfig = void 0;
|
|
7
7
|
function _reactNative() {
|
|
8
8
|
const data = require("react-native");
|
|
9
9
|
_reactNative = function () {
|
|
@@ -11,4 +11,12 @@ function _reactNative() {
|
|
|
11
11
|
};
|
|
12
12
|
return data;
|
|
13
13
|
}
|
|
14
|
-
const nativeDriverEnabled = exports.nativeDriverEnabled = _reactNative().Platform.OS !== 'web';
|
|
14
|
+
const nativeDriverEnabled = exports.nativeDriverEnabled = _reactNative().Platform.OS !== 'web';
|
|
15
|
+
const defaultAnimationConfig = exports.defaultAnimationConfig = {
|
|
16
|
+
useNativeDriver: nativeDriverEnabled,
|
|
17
|
+
isInteraction: false
|
|
18
|
+
};
|
|
19
|
+
const hardwareAccelerationProps = exports.hardwareAccelerationProps = {
|
|
20
|
+
renderToHardwareTextureAndroid: _reactNative().Platform.OS === 'android',
|
|
21
|
+
shouldRasterizeIOS: _reactNative().Platform.OS === 'ios'
|
|
22
|
+
};
|
|
@@ -5,51 +5,33 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.measureInWindow = void 0;
|
|
7
7
|
var _validate = require("../utils/validate");
|
|
8
|
-
const
|
|
8
|
+
const toRect = (x, y, w, h) => [x, y, w, h].every(Number.isFinite) ? {
|
|
9
|
+
x: x,
|
|
10
|
+
y: y,
|
|
11
|
+
width: w,
|
|
12
|
+
height: h
|
|
13
|
+
} : null;
|
|
14
|
+
const measureInWindow = (node, cb) => {
|
|
9
15
|
if (!node) {
|
|
10
|
-
|
|
16
|
+
cb(null);
|
|
11
17
|
return;
|
|
12
18
|
}
|
|
13
19
|
try {
|
|
14
|
-
const
|
|
15
|
-
if ((0, _validate.isFunction)(
|
|
16
|
-
|
|
17
|
-
if (![x, y, width, height].every(Number.isFinite)) {
|
|
18
|
-
callback(null);
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
21
|
-
callback({
|
|
22
|
-
x,
|
|
23
|
-
y,
|
|
24
|
-
width,
|
|
25
|
-
height
|
|
26
|
-
});
|
|
27
|
-
});
|
|
20
|
+
const mn = node;
|
|
21
|
+
if ((0, _validate.isFunction)(mn.measureInWindow)) {
|
|
22
|
+
mn.measureInWindow((x, y, w, h) => cb(toRect(x, y, w, h)));
|
|
28
23
|
return;
|
|
29
24
|
}
|
|
30
|
-
const
|
|
31
|
-
if ((0, _validate.isFunction)(
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
const y = rect?.top;
|
|
35
|
-
const width = rect?.width;
|
|
36
|
-
const height = rect?.height;
|
|
37
|
-
if (![x, y, width, height].every(Number.isFinite)) {
|
|
38
|
-
callback(null);
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
callback({
|
|
42
|
-
x: x,
|
|
43
|
-
y: y,
|
|
44
|
-
width: width,
|
|
45
|
-
height: height
|
|
46
|
-
});
|
|
25
|
+
const dn = node;
|
|
26
|
+
if ((0, _validate.isFunction)(dn.getBoundingClientRect)) {
|
|
27
|
+
const r = dn.getBoundingClientRect();
|
|
28
|
+
cb(toRect(r?.left, r?.top, r?.width, r?.height));
|
|
47
29
|
return;
|
|
48
30
|
}
|
|
49
|
-
} catch
|
|
50
|
-
|
|
31
|
+
} catch {
|
|
32
|
+
cb(null);
|
|
51
33
|
return;
|
|
52
34
|
}
|
|
53
|
-
|
|
35
|
+
cb(null);
|
|
54
36
|
};
|
|
55
37
|
exports.measureInWindow = measureInWindow;
|
package/dist/cjs/utils/color.js
CHANGED
|
@@ -5,48 +5,34 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.withAlpha = exports.hexToRgb = exports.extractFirstColorToken = exports.ensureRgba = void 0;
|
|
7
7
|
var _number = require("./number");
|
|
8
|
-
const
|
|
8
|
+
const HEX_RE = /^#([0-9a-f]{3}|[0-9a-f]{6})$/i;
|
|
9
9
|
const hexToRgb = input => {
|
|
10
|
-
if (!
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
const g = intVal >> 8 & 255;
|
|
15
|
-
const b = intVal & 255;
|
|
16
|
-
return [r, g, b];
|
|
10
|
+
if (!HEX_RE.test(input)) return null;
|
|
11
|
+
const h = input.length === 4 ? `#${input[1]}${input[1]}${input[2]}${input[2]}${input[3]}${input[3]}` : input;
|
|
12
|
+
const v = parseInt(h.slice(1), 16);
|
|
13
|
+
return [v >> 16 & 255, v >> 8 & 255, v & 255];
|
|
17
14
|
};
|
|
18
15
|
exports.hexToRgb = hexToRgb;
|
|
19
|
-
const
|
|
20
|
-
const
|
|
21
|
-
if (!
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
if (!numeric.every(channel => Number.isFinite(channel))) return null;
|
|
25
|
-
return [numeric[0], numeric[1], numeric[2]];
|
|
16
|
+
const parseRgb = input => {
|
|
17
|
+
const m = input.match(/^rgba?\(([^)]*)\)$/i);
|
|
18
|
+
if (!m) return null;
|
|
19
|
+
const n = m[1].split(',').map(s => Number(s.trim()));
|
|
20
|
+
return n.length >= 3 && n.every(Number.isFinite) ? [n[0], n[1], n[2]] : null;
|
|
26
21
|
};
|
|
27
22
|
const withAlpha = (color, alpha) => {
|
|
28
|
-
const
|
|
29
|
-
const
|
|
30
|
-
if (!
|
|
31
|
-
if (
|
|
32
|
-
const rgb = hexToRgb(
|
|
33
|
-
return rgb ? `rgba(${rgb[0]}, ${rgb[1]}, ${rgb[2]}, ${
|
|
23
|
+
const a = (0, _number.clamp01)(alpha);
|
|
24
|
+
const t = color?.trim?.() ?? '';
|
|
25
|
+
if (!t) return color;
|
|
26
|
+
if (t.startsWith('#')) {
|
|
27
|
+
const rgb = hexToRgb(t);
|
|
28
|
+
return rgb ? `rgba(${rgb[0]}, ${rgb[1]}, ${rgb[2]}, ${a})` : color;
|
|
34
29
|
}
|
|
35
|
-
const rgb =
|
|
36
|
-
|
|
37
|
-
return trimmed;
|
|
30
|
+
const rgb = parseRgb(t);
|
|
31
|
+
return rgb ? `rgba(${rgb[0]}, ${rgb[1]}, ${rgb[2]}, ${a})` : t;
|
|
38
32
|
};
|
|
39
33
|
exports.withAlpha = withAlpha;
|
|
40
|
-
const ensureRgba = (color, alpha) =>
|
|
41
|
-
const trimmed = color.trim().toLowerCase();
|
|
42
|
-
if (trimmed.startsWith('rgba')) return color;
|
|
43
|
-
return withAlpha(color, alpha);
|
|
44
|
-
};
|
|
34
|
+
const ensureRgba = (color, alpha) => color.trim().toLowerCase().startsWith('rgba') ? color : withAlpha(color, alpha);
|
|
45
35
|
exports.ensureRgba = ensureRgba;
|
|
46
|
-
const
|
|
47
|
-
const extractFirstColorToken = input =>
|
|
48
|
-
if (!input) return undefined;
|
|
49
|
-
const match = input.match(gradientColorRegex);
|
|
50
|
-
return match ? match[0] : undefined;
|
|
51
|
-
};
|
|
36
|
+
const GRADIENT_RE = /(#[0-9a-fA-F]{3,8}|rgba?\([^)]*\)|hsla?\([^)]*\))/i;
|
|
37
|
+
const extractFirstColorToken = input => input ? input.match(GRADIENT_RE)?.[0] : undefined;
|
|
52
38
|
exports.extractFirstColorToken = extractFirstColorToken;
|
|
@@ -6,21 +6,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.shallowEqualObject = exports.shallowEqualArray = void 0;
|
|
7
7
|
const shallowEqualArray = (a = [], b = []) => {
|
|
8
8
|
if (a.length !== b.length) return false;
|
|
9
|
-
for (let i = 0; i < a.length; i
|
|
10
|
-
if (a[i] !== b[i]) return false;
|
|
11
|
-
}
|
|
9
|
+
for (let i = 0; i < a.length; i++) if (a[i] !== b[i]) return false;
|
|
12
10
|
return true;
|
|
13
11
|
};
|
|
14
12
|
exports.shallowEqualArray = shallowEqualArray;
|
|
15
|
-
const shallowEqualObject = (
|
|
16
|
-
if (
|
|
17
|
-
if (!
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
if (
|
|
21
|
-
for (const key of prevKeys) {
|
|
22
|
-
if (prev[key] !== next[key]) return false;
|
|
23
|
-
}
|
|
13
|
+
const shallowEqualObject = (a, b) => {
|
|
14
|
+
if (a === b) return true;
|
|
15
|
+
if (!a || !b) return false;
|
|
16
|
+
const ak = Object.keys(a);
|
|
17
|
+
if (ak.length !== Object.keys(b).length) return false;
|
|
18
|
+
for (const k of ak) if (a[k] !== b[k]) return false;
|
|
24
19
|
return true;
|
|
25
20
|
};
|
|
26
21
|
exports.shallowEqualObject = shallowEqualObject;
|
|
@@ -11,52 +11,41 @@ function _reactNative() {
|
|
|
11
11
|
};
|
|
12
12
|
return data;
|
|
13
13
|
}
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
const g = bigint >> 8 & 255;
|
|
23
|
-
const b = bigint & 255;
|
|
24
|
-
const clampedAlpha = Math.max(0, Math.min(1, alpha));
|
|
25
|
-
return `rgba(${r}, ${g}, ${b}, ${clampedAlpha})`;
|
|
26
|
-
};
|
|
27
|
-
const ensureRgbaColor = (color, alpha) => {
|
|
28
|
-
const trimmed = color.trim().toLowerCase();
|
|
29
|
-
if (trimmed.startsWith('#')) {
|
|
30
|
-
return hexToRgba(trimmed, alpha);
|
|
31
|
-
}
|
|
32
|
-
if (trimmed.startsWith('rgba')) {
|
|
33
|
-
return color;
|
|
34
|
-
}
|
|
35
|
-
if (trimmed.startsWith('rgb(')) {
|
|
36
|
-
return color.replace(/rgb\(([^)]*)\)/i, (_, inner) => `rgba(${inner}, ${alpha})`);
|
|
14
|
+
const toRgba = (color, alpha) => {
|
|
15
|
+
const t = color.trim();
|
|
16
|
+
if (t.startsWith('#')) {
|
|
17
|
+
const h = t.replace('#', '');
|
|
18
|
+
const e = h.length === 3 ? h.split('').map(c => c + c).join('') : h;
|
|
19
|
+
if (e.length < 6) return color;
|
|
20
|
+
const n = parseInt(e.slice(0, 6), 16);
|
|
21
|
+
return `rgba(${n >> 16 & 255}, ${n >> 8 & 255}, ${n & 255}, ${Math.max(0, Math.min(1, alpha))})`;
|
|
37
22
|
}
|
|
23
|
+
if (t.startsWith('rgba')) return color;
|
|
24
|
+
if (t.startsWith('rgb(')) return color.replace(/rgb\(([^)]*)\)/i, (_, i) => `rgba(${i}, ${alpha})`);
|
|
38
25
|
return color;
|
|
39
26
|
};
|
|
40
|
-
const createPlatformShadow =
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
27
|
+
const createPlatformShadow = ({
|
|
28
|
+
color,
|
|
29
|
+
opacity,
|
|
30
|
+
radius,
|
|
31
|
+
offsetY,
|
|
32
|
+
offsetX = 0,
|
|
33
|
+
elevation
|
|
34
|
+
}) => {
|
|
35
|
+
if (_reactNative().Platform.OS !== 'web') return {
|
|
36
|
+
shadowColor: color,
|
|
37
|
+
shadowOpacity: opacity,
|
|
38
|
+
shadowRadius: radius,
|
|
45
39
|
shadowOffset: {
|
|
46
|
-
width:
|
|
47
|
-
height:
|
|
40
|
+
width: offsetX,
|
|
41
|
+
height: offsetY
|
|
48
42
|
},
|
|
49
|
-
...(
|
|
50
|
-
elevation
|
|
51
|
-
}
|
|
43
|
+
...(elevation !== undefined && {
|
|
44
|
+
elevation
|
|
45
|
+
})
|
|
52
46
|
};
|
|
53
|
-
if (_reactNative().Platform.OS !== 'web') {
|
|
54
|
-
return nativeShadow;
|
|
55
|
-
}
|
|
56
|
-
const blur = Math.max(config.radius * 1.5, config.radius);
|
|
57
|
-
const boxShadowColor = ensureRgbaColor(config.color, config.opacity);
|
|
58
47
|
return {
|
|
59
|
-
boxShadow: `${
|
|
48
|
+
boxShadow: `${offsetX}px ${offsetY}px ${radius * 1.5}px ${toRgba(color, opacity)}`
|
|
60
49
|
};
|
|
61
50
|
};
|
|
62
51
|
exports.createPlatformShadow = createPlatformShadow;
|
package/dist/cjs/utils/date.js
CHANGED
|
@@ -5,71 +5,41 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.times = exports.padZero = exports.isValidDate = exports.getTrueValue = exports.getMonthEndDay = exports.formatDuration = void 0;
|
|
7
7
|
const padZero = (value, length = 2) => {
|
|
8
|
-
const
|
|
9
|
-
return
|
|
8
|
+
const s = String(value);
|
|
9
|
+
return s.length >= length ? s : `${'0'.repeat(length - s.length)}${s}`;
|
|
10
10
|
};
|
|
11
11
|
exports.padZero = padZero;
|
|
12
|
-
const times = (count,
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}, (_, index) => iteratee(index));
|
|
16
|
-
};
|
|
12
|
+
const times = (count, fn) => Array.from({
|
|
13
|
+
length: count
|
|
14
|
+
}, (_, i) => fn(i));
|
|
17
15
|
exports.times = times;
|
|
18
16
|
const getTrueValue = value => {
|
|
19
17
|
if (!value) return 0;
|
|
20
|
-
const
|
|
21
|
-
return Number.isNaN(
|
|
18
|
+
const n = parseInt(value, 10);
|
|
19
|
+
return Number.isNaN(n) ? 0 : n;
|
|
22
20
|
};
|
|
23
21
|
exports.getTrueValue = getTrueValue;
|
|
24
|
-
const getMonthEndDay = (year, month) =>
|
|
25
|
-
return 32 - new Date(year, month - 1, 32).getDate();
|
|
26
|
-
};
|
|
22
|
+
const getMonthEndDay = (year, month) => 32 - new Date(year, month - 1, 32).getDate();
|
|
27
23
|
exports.getMonthEndDay = getMonthEndDay;
|
|
28
|
-
const isValidDate = value =>
|
|
29
|
-
return value instanceof Date && !Number.isNaN(value.getTime());
|
|
30
|
-
};
|
|
24
|
+
const isValidDate = value => value instanceof Date && !Number.isNaN(value.getTime());
|
|
31
25
|
exports.isValidDate = isValidDate;
|
|
32
|
-
const formatDuration = (format,
|
|
33
|
-
const {
|
|
34
|
-
days
|
|
35
|
-
} = currentTime;
|
|
26
|
+
const formatDuration = (format, time) => {
|
|
36
27
|
let {
|
|
28
|
+
days,
|
|
37
29
|
hours,
|
|
38
30
|
minutes,
|
|
39
31
|
seconds,
|
|
40
32
|
milliseconds
|
|
41
|
-
} =
|
|
42
|
-
let
|
|
43
|
-
if (
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
if (template.includes('HH')) {
|
|
49
|
-
template = template.replace('HH', padZero(hours));
|
|
50
|
-
} else {
|
|
51
|
-
minutes += hours * 60;
|
|
52
|
-
}
|
|
53
|
-
if (template.includes('mm')) {
|
|
54
|
-
template = template.replace('mm', padZero(minutes));
|
|
55
|
-
} else {
|
|
56
|
-
seconds += minutes * 60;
|
|
57
|
-
}
|
|
58
|
-
if (template.includes('ss')) {
|
|
59
|
-
template = template.replace('ss', padZero(seconds));
|
|
60
|
-
} else {
|
|
61
|
-
milliseconds += seconds * 1000;
|
|
62
|
-
}
|
|
63
|
-
if (template.includes('S')) {
|
|
33
|
+
} = time;
|
|
34
|
+
let t = format;
|
|
35
|
+
if (t.includes('DD')) t = t.replace('DD', padZero(days));else hours += days * 24;
|
|
36
|
+
if (t.includes('HH')) t = t.replace('HH', padZero(hours));else minutes += hours * 60;
|
|
37
|
+
if (t.includes('mm')) t = t.replace('mm', padZero(minutes));else seconds += minutes * 60;
|
|
38
|
+
if (t.includes('ss')) t = t.replace('ss', padZero(seconds));else milliseconds += seconds * 1000;
|
|
39
|
+
if (t.includes('S')) {
|
|
64
40
|
const ms = padZero(milliseconds, 3);
|
|
65
|
-
if (
|
|
66
|
-
template = template.replace('SSS', ms);
|
|
67
|
-
} else if (template.includes('SS')) {
|
|
68
|
-
template = template.replace('SS', ms.slice(0, 2));
|
|
69
|
-
} else {
|
|
70
|
-
template = template.replace('S', ms.charAt(0));
|
|
71
|
-
}
|
|
41
|
+
if (t.includes('SSS')) t = t.replace('SSS', ms);else if (t.includes('SS')) t = t.replace('SS', ms.slice(0, 2));else t = t.replace('S', ms.charAt(0));
|
|
72
42
|
}
|
|
73
|
-
return
|
|
43
|
+
return t;
|
|
74
44
|
};
|
|
75
45
|
exports.formatDuration = formatDuration;
|
|
@@ -4,34 +4,24 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.deepMerge = deepMerge;
|
|
7
|
-
const isPlainObject =
|
|
8
|
-
return Object.prototype.toString.call(value) === '[object Object]';
|
|
9
|
-
};
|
|
7
|
+
const isPlainObject = v => Object.prototype.toString.call(v) === '[object Object]';
|
|
10
8
|
function deepMerge(target, source) {
|
|
11
|
-
if (!source)
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
if (!Array.isArray(target) && !isPlainObject(target)) {
|
|
15
|
-
return source;
|
|
16
|
-
}
|
|
17
|
-
const output = Array.isArray(target) ? [...target] : {
|
|
9
|
+
if (!source) return target;
|
|
10
|
+
if (!Array.isArray(target) && !isPlainObject(target)) return source;
|
|
11
|
+
const out = Array.isArray(target) ? [...target] : {
|
|
18
12
|
...target
|
|
19
13
|
};
|
|
20
|
-
Object.keys(source)
|
|
21
|
-
const
|
|
22
|
-
if (
|
|
23
|
-
|
|
14
|
+
for (const key of Object.keys(source)) {
|
|
15
|
+
const sv = source[key];
|
|
16
|
+
if (sv === undefined) continue;
|
|
17
|
+
const tv = target[key];
|
|
18
|
+
if (isPlainObject(tv) && isPlainObject(sv)) {
|
|
19
|
+
out[key] = deepMerge(tv, sv);
|
|
20
|
+
continue;
|
|
24
21
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
31
|
-
;
|
|
32
|
-
output[key] = Array.isArray(sourceValue) ? [...sourceValue] : isPlainObject(sourceValue) ? {
|
|
33
|
-
...sourceValue
|
|
34
|
-
} : sourceValue;
|
|
35
|
-
});
|
|
36
|
-
return output;
|
|
22
|
+
out[key] = Array.isArray(sv) ? [...sv] : isPlainObject(sv) ? {
|
|
23
|
+
...sv
|
|
24
|
+
} : sv;
|
|
25
|
+
}
|
|
26
|
+
return out;
|
|
37
27
|
}
|