@0610studio/zs-ui 0.18.0 → 0.19.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/build/ZsUiModule.d.ts.map +1 -1
- package/build/ZsUiModule.js +0 -2
- package/build/ZsUiModule.js.map +1 -1
- package/build/assets/SvgExclamation.d.ts.map +1 -1
- package/build/assets/SvgExclamation.js.map +1 -1
- package/build/assets/SvgTooltipTail.d.ts +7 -0
- package/build/assets/SvgTooltipTail.d.ts.map +1 -0
- package/build/assets/SvgTooltipTail.js +7 -0
- package/build/assets/SvgTooltipTail.js.map +1 -0
- package/build/context/OverlayContext.d.ts.map +1 -1
- package/build/context/OverlayContext.js +11 -14
- package/build/context/OverlayContext.js.map +1 -1
- package/build/context/ThemeContext.d.ts +9 -0
- package/build/context/ThemeContext.d.ts.map +1 -1
- package/build/context/ThemeContext.js +24 -15
- package/build/context/ThemeContext.js.map +1 -1
- package/build/index.d.ts +16 -3
- package/build/index.d.ts.map +1 -1
- package/build/index.js +7 -7
- package/build/index.js.map +1 -1
- package/build/model/globalOverlay.d.ts +0 -8
- package/build/model/globalOverlay.d.ts.map +1 -1
- package/build/model/globalOverlay.js +0 -9
- package/build/model/globalOverlay.js.map +1 -1
- package/build/model/types.d.ts +2 -1
- package/build/model/types.d.ts.map +1 -1
- package/build/model/types.js.map +1 -1
- package/build/model/useFoldingState.d.ts.map +1 -1
- package/build/model/useFoldingState.js +51 -32
- package/build/model/useFoldingState.js.map +1 -1
- package/build/model/useKeyboard.d.ts.map +1 -1
- package/build/model/useKeyboard.js +8 -4
- package/build/model/useKeyboard.js.map +1 -1
- package/build/model/utils.d.ts +1 -1
- package/build/model/utils.d.ts.map +1 -1
- package/build/model/utils.js +2 -1
- package/build/model/utils.js.map +1 -1
- package/build/overlay/AlertOverlay/index.d.ts +1 -2
- package/build/overlay/AlertOverlay/index.d.ts.map +1 -1
- package/build/overlay/AlertOverlay/index.js +13 -11
- package/build/overlay/AlertOverlay/index.js.map +1 -1
- package/build/overlay/BottomSheetOverlay/index.d.ts.map +1 -1
- package/build/overlay/BottomSheetOverlay/index.js +22 -11
- package/build/overlay/BottomSheetOverlay/index.js.map +1 -1
- package/build/overlay/LoadingNotify/index.d.ts +2 -2
- package/build/overlay/LoadingNotify/index.d.ts.map +1 -1
- package/build/overlay/LoadingNotify/index.js +2 -2
- package/build/overlay/LoadingNotify/index.js.map +1 -1
- package/build/overlay/Modality/index.d.ts.map +1 -1
- package/build/overlay/Modality/index.js +6 -12
- package/build/overlay/Modality/index.js.map +1 -1
- package/build/overlay/PopOver/PopOverMenu.d.ts.map +1 -1
- package/build/overlay/PopOver/PopOverMenu.js +7 -8
- package/build/overlay/PopOver/PopOverMenu.js.map +1 -1
- package/build/overlay/SnackbarNotify/index.d.ts +3 -3
- package/build/overlay/SnackbarNotify/index.d.ts.map +1 -1
- package/build/overlay/SnackbarNotify/index.js +5 -4
- package/build/overlay/SnackbarNotify/index.js.map +1 -1
- package/build/overlay/SnackbarNotify/ui/SnackbarItem.d.ts +4 -4
- package/build/overlay/SnackbarNotify/ui/SnackbarItem.d.ts.map +1 -1
- package/build/overlay/SnackbarNotify/ui/SnackbarItem.js +9 -9
- package/build/overlay/SnackbarNotify/ui/SnackbarItem.js.map +1 -1
- package/build/overlay/ZSPortal/index.d.ts.map +1 -1
- package/build/overlay/ZSPortal/index.js +15 -4
- package/build/overlay/ZSPortal/index.js.map +1 -1
- package/build/overlay/ui/ModalBackground.js.map +1 -1
- package/build/theme/elevation.d.ts +94 -10
- package/build/theme/elevation.d.ts.map +1 -1
- package/build/theme/elevation.js +39 -35
- package/build/theme/elevation.js.map +1 -1
- package/build/theme/intentColors.d.ts +9 -0
- package/build/theme/intentColors.d.ts.map +1 -0
- package/build/theme/intentColors.js +30 -0
- package/build/theme/intentColors.js.map +1 -0
- package/build/theme/palette.d.ts +1 -5
- package/build/theme/palette.d.ts.map +1 -1
- package/build/theme/palette.js +3 -12
- package/build/theme/palette.js.map +1 -1
- package/build/theme/resolveColor.d.ts +4 -0
- package/build/theme/resolveColor.d.ts.map +1 -0
- package/build/theme/resolveColor.js +29 -0
- package/build/theme/resolveColor.js.map +1 -0
- package/build/theme/tokens.d.ts +35 -0
- package/build/theme/tokens.d.ts.map +1 -0
- package/build/theme/tokens.js +35 -0
- package/build/theme/tokens.js.map +1 -0
- package/build/theme/typography.d.ts.map +1 -1
- package/build/theme/typography.js +36 -72
- package/build/theme/typography.js.map +1 -1
- package/build/ui/ZSBlockButton/index.d.ts +4 -2
- package/build/ui/ZSBlockButton/index.d.ts.map +1 -1
- package/build/ui/ZSBlockButton/index.js +17 -80
- package/build/ui/ZSBlockButton/index.js.map +1 -1
- package/build/ui/ZSBorderBeam/index.d.ts +48 -0
- package/build/ui/ZSBorderBeam/index.d.ts.map +1 -0
- package/build/ui/ZSBorderBeam/index.js +135 -0
- package/build/ui/ZSBorderBeam/index.js.map +1 -0
- package/build/ui/ZSCheckBox/index.d.ts +18 -0
- package/build/ui/ZSCheckBox/index.d.ts.map +1 -0
- package/build/ui/ZSCheckBox/index.js +60 -0
- package/build/ui/ZSCheckBox/index.js.map +1 -0
- package/build/ui/ZSChip/index.d.ts +28 -0
- package/build/ui/ZSChip/index.d.ts.map +1 -0
- package/build/ui/ZSChip/index.js +76 -0
- package/build/ui/ZSChip/index.js.map +1 -0
- package/build/ui/ZSContainer/index.d.ts +19 -0
- package/build/ui/ZSContainer/index.d.ts.map +1 -1
- package/build/ui/ZSContainer/index.js +29 -15
- package/build/ui/ZSContainer/index.js.map +1 -1
- package/build/ui/ZSPressable/index.d.ts.map +1 -1
- package/build/ui/ZSPressable/index.js +9 -6
- package/build/ui/ZSPressable/index.js.map +1 -1
- package/build/ui/ZSRadioGroup/index.d.ts +4 -4
- package/build/ui/ZSRadioGroup/index.d.ts.map +1 -1
- package/build/ui/ZSRadioGroup/index.js +72 -52
- package/build/ui/ZSRadioGroup/index.js.map +1 -1
- package/build/ui/ZSSegmented/index.d.ts +26 -0
- package/build/ui/ZSSegmented/index.d.ts.map +1 -0
- package/build/ui/ZSSegmented/index.js +124 -0
- package/build/ui/ZSSegmented/index.js.map +1 -0
- package/build/ui/ZSSkeleton/SkiaShimmer.d.ts +18 -0
- package/build/ui/ZSSkeleton/SkiaShimmer.d.ts.map +1 -0
- package/build/ui/ZSSkeleton/SkiaShimmer.js +73 -0
- package/build/ui/ZSSkeleton/SkiaShimmer.js.map +1 -0
- package/build/ui/ZSSkeleton/index.d.ts +9 -3
- package/build/ui/ZSSkeleton/index.d.ts.map +1 -1
- package/build/ui/ZSSkeleton/index.js +13 -44
- package/build/ui/ZSSkeleton/index.js.map +1 -1
- package/build/ui/ZSSkeletonBox/index.d.ts +10 -3
- package/build/ui/ZSSkeletonBox/index.d.ts.map +1 -1
- package/build/ui/ZSSkeletonBox/index.js +9 -47
- package/build/ui/ZSSkeletonBox/index.js.map +1 -1
- package/build/ui/ZSSwitch/index.d.ts +4 -2
- package/build/ui/ZSSwitch/index.d.ts.map +1 -1
- package/build/ui/ZSSwitch/index.js +8 -6
- package/build/ui/ZSSwitch/index.js.map +1 -1
- package/build/ui/ZSText/index.d.ts +3 -2
- package/build/ui/ZSText/index.d.ts.map +1 -1
- package/build/ui/ZSText/index.js +5 -16
- package/build/ui/ZSText/index.js.map +1 -1
- package/build/ui/ZSTextField/index.d.ts.map +1 -1
- package/build/ui/ZSTextField/index.js +57 -40
- package/build/ui/ZSTextField/index.js.map +1 -1
- package/build/ui/ZSTextField/ui/ButtonClose.d.ts.map +1 -1
- package/build/ui/ZSTextField/ui/ButtonClose.js +4 -1
- package/build/ui/ZSTextField/ui/ButtonClose.js.map +1 -1
- package/build/ui/ZSTooltip/index.d.ts +38 -0
- package/build/ui/ZSTooltip/index.d.ts.map +1 -0
- package/build/ui/ZSTooltip/index.js +99 -0
- package/build/ui/ZSTooltip/index.js.map +1 -0
- package/build/ui/ZSView/index.d.ts +3 -2
- package/build/ui/ZSView/index.d.ts.map +1 -1
- package/build/ui/ZSView/index.js +7 -8
- package/build/ui/ZSView/index.js.map +1 -1
- package/build/ui/atoms/AnimatedWrapper.d.ts.map +1 -1
- package/build/ui/atoms/AnimatedWrapper.js +33 -40
- package/build/ui/atoms/AnimatedWrapper.js.map +1 -1
- package/build/ui/atoms/TextAtom.d.ts +1 -2
- package/build/ui/atoms/TextAtom.d.ts.map +1 -1
- package/build/ui/atoms/TextAtom.js.map +1 -1
- package/build/ui/atoms/ViewAtom.d.ts +1 -2
- package/build/ui/atoms/ViewAtom.d.ts.map +1 -1
- package/build/ui/atoms/ViewAtom.js.map +1 -1
- package/package.json +6 -1
|
@@ -1,41 +1,33 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import React, { useMemo } from 'react';
|
|
3
|
-
import { View
|
|
3
|
+
import { View } from 'react-native';
|
|
4
4
|
import Animated, { FadeInDown, FadeOut, useAnimatedStyle, withTiming, useSharedValue, useDerivedValue } from 'react-native-reanimated';
|
|
5
5
|
import { useTheme } from '../../context/ThemeContext';
|
|
6
|
-
import {
|
|
6
|
+
import { resolveViewColor } from '../../theme/resolveColor';
|
|
7
|
+
import { IOS_SHADOW, parseColorChannels } from '../../theme/elevation';
|
|
7
8
|
const DEFAULT_DURATION = 200;
|
|
8
9
|
const SHADOW_DURATION = 50;
|
|
9
|
-
const IS_IOS = Platform.OS === 'ios';
|
|
10
|
-
function isColorMap(value) {
|
|
11
|
-
return typeof value === 'object' && value !== null;
|
|
12
|
-
}
|
|
13
10
|
function AnimatedWrapper({ isAnimation = true, elevationLevel = 0, duration = DEFAULT_DURATION, style, children, color, ...props }) {
|
|
14
11
|
const { elevation, palette } = useTheme();
|
|
15
12
|
const animationFinished = useSharedValue(false);
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
13
|
+
const shadowConfig = useMemo(() => {
|
|
14
|
+
const shadow = IOS_SHADOW[elevationLevel];
|
|
15
|
+
const { r, g, b, a } = parseColorChannels(palette.elevationShadow[elevationLevel] ?? '');
|
|
16
|
+
return {
|
|
17
|
+
offsetX: shadow.shadowOffset.width,
|
|
18
|
+
offsetY: shadow.shadowOffset.height,
|
|
19
|
+
blurRadius: shadow.shadowRadius,
|
|
20
|
+
maxAlpha: a * shadow.shadowOpacity,
|
|
21
|
+
r,
|
|
22
|
+
g,
|
|
23
|
+
b,
|
|
24
|
+
};
|
|
25
|
+
}, [elevationLevel, palette]);
|
|
21
26
|
const backgroundColor = useMemo(() => {
|
|
22
27
|
if (!color) {
|
|
23
28
|
return elevationLevel ? palette.background.base : undefined;
|
|
24
29
|
}
|
|
25
|
-
|
|
26
|
-
if (c02) {
|
|
27
|
-
if (c01 === 'background')
|
|
28
|
-
return palette.background[c02];
|
|
29
|
-
if (c01 === 'text')
|
|
30
|
-
return palette.text[c02];
|
|
31
|
-
const semanticPalette = palette[c01];
|
|
32
|
-
return isColorMap(semanticPalette) ? semanticPalette[c02] : undefined;
|
|
33
|
-
}
|
|
34
|
-
if (c01)
|
|
35
|
-
return palette.background[c01] ?? palette[c01]?.main;
|
|
36
|
-
if (elevationLevel)
|
|
37
|
-
return palette.background.base;
|
|
38
|
-
return undefined;
|
|
30
|
+
return resolveViewColor(palette, color);
|
|
39
31
|
}, [color, palette, elevationLevel]);
|
|
40
32
|
const staticStyle = elevation[elevationLevel];
|
|
41
33
|
const shadowProgress = useDerivedValue(() => {
|
|
@@ -46,12 +38,19 @@ function AnimatedWrapper({ isAnimation = true, elevationLevel = 0, duration = DE
|
|
|
46
38
|
return 0;
|
|
47
39
|
}, []);
|
|
48
40
|
const animatedStyle = useAnimatedStyle(() => {
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
41
|
+
const alpha = shadowConfig.maxAlpha * shadowProgress.value;
|
|
42
|
+
return {
|
|
43
|
+
boxShadow: [
|
|
44
|
+
{
|
|
45
|
+
offsetX: shadowConfig.offsetX,
|
|
46
|
+
offsetY: shadowConfig.offsetY,
|
|
47
|
+
blurRadius: shadowConfig.blurRadius,
|
|
48
|
+
spreadDistance: 0,
|
|
49
|
+
color: `rgba(${shadowConfig.r}, ${shadowConfig.g}, ${shadowConfig.b}, ${alpha})`,
|
|
50
|
+
},
|
|
51
|
+
],
|
|
52
|
+
};
|
|
53
|
+
}, [shadowConfig]);
|
|
55
54
|
const animationProps = useMemo(() => ({
|
|
56
55
|
entering: FadeInDown.duration(duration).withCallback((finished) => {
|
|
57
56
|
'worklet';
|
|
@@ -61,15 +60,9 @@ function AnimatedWrapper({ isAnimation = true, elevationLevel = 0, duration = DE
|
|
|
61
60
|
}),
|
|
62
61
|
exiting: FadeOut.duration(50),
|
|
63
62
|
}), [duration]);
|
|
64
|
-
const
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
staticStyle
|
|
68
|
-
];
|
|
69
|
-
const animatedStyleArray = [
|
|
70
|
-
...baseStyle,
|
|
71
|
-
animatedStyle
|
|
72
|
-
];
|
|
63
|
+
const bgStyle = useMemo(() => (backgroundColor ? { backgroundColor } : undefined), [backgroundColor]);
|
|
64
|
+
const baseStyle = useMemo(() => [style, bgStyle, staticStyle], [style, bgStyle, staticStyle]);
|
|
65
|
+
const animatedStyleArray = useMemo(() => [style, bgStyle, staticStyle, animatedStyle], [style, bgStyle, staticStyle, animatedStyle]);
|
|
73
66
|
if (!isAnimation) {
|
|
74
67
|
return _jsx(View, { style: baseStyle, ...props, children: children });
|
|
75
68
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AnimatedWrapper.js","sourceRoot":"","sources":["../../../src/ui/atoms/AnimatedWrapper.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAE,IAAI,EAAa,
|
|
1
|
+
{"version":3,"file":"AnimatedWrapper.js","sourceRoot":"","sources":["../../../src/ui/atoms/AnimatedWrapper.tsx"],"names":[],"mapp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ViewProps } from 'react-native';\nimport Animated, { FadeInDown, FadeOut, useAnimatedStyle, withTiming, useSharedValue, useDerivedValue } from 'react-native-reanimated';\nimport { useTheme } from '../../context/ThemeContext';\nimport { ShadowLevel, ViewColorOptions } from '../../theme/types';\nimport { resolveViewColor } from '../../theme/resolveColor';\nimport { IOS_SHADOW, parseColorChannels } from '../../theme/elevation';\n\nconst DEFAULT_DURATION = 200 as const;\nconst SHADOW_DURATION = 50 as const;\n\ninterface AnimatedWrapperProps extends ViewProps {\n isAnimation: boolean;\n elevationLevel?: ShadowLevel;\n duration?: number;\n color?: ViewColorOptions;\n}\n\nfunction AnimatedWrapper({\n isAnimation = true,\n elevationLevel = 0,\n duration = DEFAULT_DURATION,\n style,\n children,\n color,\n ...props\n}: AnimatedWrapperProps) {\n const { elevation, palette } = useTheme();\n const animationFinished = useSharedValue(false);\n\n const shadowConfig = useMemo(() => {\n const shadow = IOS_SHADOW[elevationLevel];\n const { r, g, b, a } = parseColorChannels(palette.elevationShadow[elevationLevel] ?? '');\n return {\n offsetX: shadow.shadowOffset.width,\n offsetY: shadow.shadowOffset.height,\n blurRadius: shadow.shadowRadius,\n maxAlpha: a * shadow.shadowOpacity,\n r,\n g,\n b,\n };\n }, [elevationLevel, palette]);\n\n const backgroundColor = useMemo(() => {\n if (!color) {\n return elevationLevel ? palette.background.base : undefined;\n }\n return resolveViewColor(palette, color);\n }, [color, palette, elevationLevel]);\n\n const staticStyle = elevation[elevationLevel];\n\n const shadowProgress = useDerivedValue(() => {\n 'worklet';\n if (animationFinished.value) {\n return withTiming(1, { duration: SHADOW_DURATION });\n }\n return 0;\n }, []);\n\n const animatedStyle = useAnimatedStyle(() => {\n const alpha = shadowConfig.maxAlpha * shadowProgress.value;\n\n return {\n boxShadow: [\n {\n offsetX: shadowConfig.offsetX,\n offsetY: shadowConfig.offsetY,\n blurRadius: shadowConfig.blurRadius,\n spreadDistance: 0,\n color: `rgba(${shadowConfig.r}, ${shadowConfig.g}, ${shadowConfig.b}, ${alpha})`,\n },\n ],\n };\n }, [shadowConfig]);\n\n const animationProps = useMemo(() => ({\n entering: FadeInDown.duration(duration).withCallback((finished) => {\n 'worklet';\n if (finished) {\n animationFinished.value = true;\n }\n }),\n exiting: FadeOut.duration(50),\n }), [duration]);\n\n const bgStyle = useMemo(\n () => (backgroundColor ? { backgroundColor } : undefined),\n [backgroundColor]\n );\n\n const baseStyle = useMemo(\n () => [style, bgStyle, staticStyle],\n [style, bgStyle, staticStyle]\n );\n\n const animatedStyleArray = useMemo(\n () => [style, bgStyle, staticStyle, animatedStyle],\n [style, bgStyle, staticStyle, animatedStyle]\n );\n\n if (!isAnimation) {\n return <View style={baseStyle} {...props}>{children}</View>;\n }\n\n return (\n <Animated.View\n style={animatedStyleArray}\n {...animationProps}\n {...props}\n >\n {children}\n </Animated.View>\n );\n}\n\nexport default React.memo(AnimatedWrapper);\n"]}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { TextProps } from 'react-native';
|
|
3
|
-
|
|
4
|
-
declare function TextAtom({ children, ...props }: TextAtomProps): React.JSX.Element;
|
|
3
|
+
declare function TextAtom({ children, ...props }: TextProps): React.JSX.Element;
|
|
5
4
|
export default TextAtom;
|
|
6
5
|
//# sourceMappingURL=TextAtom.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextAtom.d.ts","sourceRoot":"","sources":["../../../src/ui/atoms/TextAtom.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAQ,SAAS,EAAE,MAAM,cAAc,CAAC;AAE/C,
|
|
1
|
+
{"version":3,"file":"TextAtom.d.ts","sourceRoot":"","sources":["../../../src/ui/atoms/TextAtom.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAQ,SAAS,EAAE,MAAM,cAAc,CAAC;AAE/C,iBAAS,QAAQ,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,SAAS,qBAMlD;AAED,eAAe,QAAQ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextAtom.js","sourceRoot":"","sources":["../../../src/ui/atoms/TextAtom.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,IAAI,EAAa,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"TextAtom.js","sourceRoot":"","sources":["../../../src/ui/atoms/TextAtom.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,IAAI,EAAa,MAAM,cAAc,CAAC;AAE/C,SAAS,QAAQ,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAa;IACjD,OAAO,CACL,KAAC,IAAI,OAAK,KAAK,YACZ,QAAQ,GACJ,CACR,CAAC;AACJ,CAAC;AAED,eAAe,QAAQ,CAAC","sourcesContent":["import React from 'react';\nimport { Text, TextProps } from 'react-native';\n\nfunction TextAtom({ children, ...props }: TextProps) {\n return (\n <Text {...props}>\n {children}\n </Text>\n );\n}\n\nexport default TextAtom;\n"]}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ViewProps } from 'react-native';
|
|
3
|
-
|
|
4
|
-
declare function ViewAtom({ children, ...props }: ViewAtomProps): React.JSX.Element;
|
|
3
|
+
declare function ViewAtom({ children, ...props }: ViewProps): React.JSX.Element;
|
|
5
4
|
export default ViewAtom;
|
|
6
5
|
//# sourceMappingURL=ViewAtom.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ViewAtom.d.ts","sourceRoot":"","sources":["../../../src/ui/atoms/ViewAtom.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAQ,SAAS,EAAE,MAAM,cAAc,CAAC;AAE/C,
|
|
1
|
+
{"version":3,"file":"ViewAtom.d.ts","sourceRoot":"","sources":["../../../src/ui/atoms/ViewAtom.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAQ,SAAS,EAAE,MAAM,cAAc,CAAC;AAE/C,iBAAS,QAAQ,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,SAAS,qBAMlD;AAED,eAAe,QAAQ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ViewAtom.js","sourceRoot":"","sources":["../../../src/ui/atoms/ViewAtom.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,IAAI,EAAa,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"ViewAtom.js","sourceRoot":"","sources":["../../../src/ui/atoms/ViewAtom.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,IAAI,EAAa,MAAM,cAAc,CAAC;AAE/C,SAAS,QAAQ,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAa;IACjD,OAAO,CACL,KAAC,IAAI,OAAK,KAAK,YACZ,QAAQ,GACJ,CACR,CAAC;AACJ,CAAC;AAED,eAAe,QAAQ,CAAC","sourcesContent":["import React from 'react';\nimport { View, ViewProps } from 'react-native';\n\nfunction ViewAtom({ children, ...props }: ViewProps) {\n return (\n <View {...props}>\n {children}\n </View>\n );\n}\n\nexport default ViewAtom;\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@0610studio/zs-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.19.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "EXPO ZS-UI",
|
|
6
6
|
"type": "commonjs",
|
|
@@ -42,6 +42,7 @@
|
|
|
42
42
|
"homepage": "https://github.com/0610studio/zs-ui",
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@babel/core": "^7.20.0",
|
|
45
|
+
"@shopify/react-native-skia": "2.6.6",
|
|
45
46
|
"@babel/plugin-transform-modules-commonjs": "^7.29.7",
|
|
46
47
|
"@babel/preset-react": "^7.29.7",
|
|
47
48
|
"@babel/preset-typescript": "^7.29.7",
|
|
@@ -75,6 +76,7 @@
|
|
|
75
76
|
},
|
|
76
77
|
"peerDependencies": {
|
|
77
78
|
"@react-native-async-storage/async-storage": "*",
|
|
79
|
+
"@shopify/react-native-skia": ">=2.0.0",
|
|
78
80
|
"expo": ">=56.0.0",
|
|
79
81
|
"expo-navigation-bar": ">=56.0.0",
|
|
80
82
|
"expo-router": "*",
|
|
@@ -89,6 +91,9 @@
|
|
|
89
91
|
"@react-native-async-storage/async-storage": {
|
|
90
92
|
"optional": false
|
|
91
93
|
},
|
|
94
|
+
"@shopify/react-native-skia": {
|
|
95
|
+
"optional": false
|
|
96
|
+
},
|
|
92
97
|
"expo-navigation-bar": {
|
|
93
98
|
"optional": false
|
|
94
99
|
},
|