@niibase/uniwind 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/LICENSE +20 -0
- package/dist/common/components/index.js +314 -0
- package/dist/common/components/native/ActivityIndicator.js +21 -0
- package/dist/common/components/native/Button.js +18 -0
- package/dist/common/components/native/FlatList.js +30 -0
- package/dist/common/components/native/Image.js +21 -0
- package/dist/common/components/native/ImageBackground.js +23 -0
- package/dist/common/components/native/InputAccessoryView.js +21 -0
- package/dist/common/components/native/KeyboardAvoidingView.js +20 -0
- package/dist/common/components/native/Modal.js +21 -0
- package/dist/common/components/native/Pressable.js +29 -0
- package/dist/common/components/native/RefreshControl.js +27 -0
- package/dist/common/components/native/SafeAreaView.js +18 -0
- package/dist/common/components/native/ScrollView.js +23 -0
- package/dist/common/components/native/SectionList.js +27 -0
- package/dist/common/components/native/Switch.js +32 -0
- package/dist/common/components/native/Text.js +36 -0
- package/dist/common/components/native/TextInput.js +53 -0
- package/dist/common/components/native/TouchableHighlight.js +35 -0
- package/dist/common/components/native/TouchableNativeFeedback.js +32 -0
- package/dist/common/components/native/TouchableOpacity.js +32 -0
- package/dist/common/components/native/TouchableWithoutFeedback.js +32 -0
- package/dist/common/components/native/View.js +18 -0
- package/dist/common/components/native/VirtualizedList.js +27 -0
- package/dist/common/components/native/useStyle.js +29 -0
- package/dist/common/components/utils.js +18 -0
- package/dist/common/components/web/ActivityIndicator.js +20 -0
- package/dist/common/components/web/Button.js +18 -0
- package/dist/common/components/web/FlatList.js +22 -0
- package/dist/common/components/web/Image.js +20 -0
- package/dist/common/components/web/ImageBackground.js +21 -0
- package/dist/common/components/web/KeyboardAvoidingView.js +18 -0
- package/dist/common/components/web/Modal.js +17 -0
- package/dist/common/components/web/Pressable.js +17 -0
- package/dist/common/components/web/RefreshControl.js +17 -0
- package/dist/common/components/web/SafeAreaView.js +17 -0
- package/dist/common/components/web/ScrollView.js +18 -0
- package/dist/common/components/web/SectionList.js +20 -0
- package/dist/common/components/web/Switch.js +26 -0
- package/dist/common/components/web/Text.js +17 -0
- package/dist/common/components/web/TextInput.js +17 -0
- package/dist/common/components/web/TouchableHighlight.js +20 -0
- package/dist/common/components/web/TouchableNativeFeedback.js +13 -0
- package/dist/common/components/web/TouchableOpacity.js +17 -0
- package/dist/common/components/web/TouchableWithoutFeedback.js +17 -0
- package/dist/common/components/web/View.js +17 -0
- package/dist/common/components/web/VirtualizedList.js +20 -0
- package/dist/common/components/web/index.js +187 -0
- package/dist/common/components/web/metro-injected.js +1 -0
- package/dist/common/components/web/rnw.js +42 -0
- package/dist/common/core/config/config.common.js +80 -0
- package/dist/common/core/config/config.js +51 -0
- package/dist/common/core/config/config.native.js +67 -0
- package/dist/common/core/config/index.js +16 -0
- package/dist/common/core/index.js +16 -0
- package/dist/common/core/listener.js +51 -0
- package/dist/common/core/logger.js +18 -0
- package/dist/common/core/native/index.js +27 -0
- package/dist/common/core/native/native-utils.js +36 -0
- package/dist/common/core/native/parsers/boxShadow.js +10 -0
- package/dist/common/core/native/parsers/fontVariant.js +8 -0
- package/dist/common/core/native/parsers/gradient.js +31 -0
- package/dist/common/core/native/parsers/index.js +60 -0
- package/dist/common/core/native/parsers/textShadow.js +39 -0
- package/dist/common/core/native/parsers/transforms.js +44 -0
- package/dist/common/core/native/runtime.js +34 -0
- package/dist/common/core/native/store.js +181 -0
- package/dist/common/core/types.js +1 -0
- package/dist/common/core/web/cssListener.js +146 -0
- package/dist/common/core/web/formatColor.js +15 -0
- package/dist/common/core/web/getWebStyles.js +51 -0
- package/dist/common/core/web/index.js +49 -0
- package/dist/common/core/web/parseCSSValue.js +15 -0
- package/dist/common/css/index.js +26 -0
- package/dist/common/css/insets.js +64 -0
- package/dist/common/css/processFunctions.js +54 -0
- package/dist/common/css/themes.js +95 -0
- package/dist/common/css/variants.js +16 -0
- package/dist/common/hoc/index.js +16 -0
- package/dist/common/hoc/types.js +1 -0
- package/dist/common/hoc/withUniwind.js +95 -0
- package/dist/common/hoc/withUniwind.native.js +106 -0
- package/dist/common/hoc/withUniwindUtils.js +16 -0
- package/dist/common/hooks/index.js +49 -0
- package/dist/common/hooks/useCSSVariable/getVariableValue.js +19 -0
- package/dist/common/hooks/useCSSVariable/getVariableValue.native.js +9 -0
- package/dist/common/hooks/useCSSVariable/index.js +16 -0
- package/dist/common/hooks/useCSSVariable/useCSSVariable.js +58 -0
- package/dist/common/hooks/useResolveClassNames.js +22 -0
- package/dist/common/hooks/useResolveClassNames.native.js +29 -0
- package/dist/common/hooks/useUniwind.js +28 -0
- package/dist/common/hooks/useUniwindAccent.js +13 -0
- package/dist/common/hooks/useUniwindAccent.native.js +12 -0
- package/dist/common/index.js +38 -0
- package/dist/common/types.js +28 -0
- package/dist/common/utils/buildDtsFile.js +18 -0
- package/dist/common/utils/stringifyThemes.js +8 -0
- package/dist/common/vite/index.d.ts +9 -0
- package/dist/common/vite/index.js +16 -0
- package/dist/common/vite/vite.js +72 -0
- package/dist/metro/index.cjs +166 -0
- package/dist/metro/index.d.ts +15 -0
- package/dist/metro/index.mjs +158 -0
- package/dist/metro/metro-transformer.cjs +1565 -0
- package/dist/metro/metro-transformer.mjs +1558 -0
- package/dist/module/components/index.d.ts +0 -0
- package/dist/module/components/index.js +312 -0
- package/dist/module/components/native/ActivityIndicator.d.ts +3 -0
- package/dist/module/components/native/ActivityIndicator.js +18 -0
- package/dist/module/components/native/Button.d.ts +3 -0
- package/dist/module/components/native/Button.js +15 -0
- package/dist/module/components/native/FlatList.d.ts +3 -0
- package/dist/module/components/native/FlatList.js +27 -0
- package/dist/module/components/native/Image.d.ts +3 -0
- package/dist/module/components/native/Image.js +18 -0
- package/dist/module/components/native/ImageBackground.d.ts +3 -0
- package/dist/module/components/native/ImageBackground.js +20 -0
- package/dist/module/components/native/InputAccessoryView.d.ts +3 -0
- package/dist/module/components/native/InputAccessoryView.js +21 -0
- package/dist/module/components/native/KeyboardAvoidingView.d.ts +3 -0
- package/dist/module/components/native/KeyboardAvoidingView.js +17 -0
- package/dist/module/components/native/Modal.d.ts +3 -0
- package/dist/module/components/native/Modal.js +18 -0
- package/dist/module/components/native/Pressable.d.ts +3 -0
- package/dist/module/components/native/Pressable.js +29 -0
- package/dist/module/components/native/RefreshControl.d.ts +3 -0
- package/dist/module/components/native/RefreshControl.js +24 -0
- package/dist/module/components/native/SafeAreaView.d.ts +3 -0
- package/dist/module/components/native/SafeAreaView.js +15 -0
- package/dist/module/components/native/ScrollView.d.ts +3 -0
- package/dist/module/components/native/ScrollView.js +20 -0
- package/dist/module/components/native/SectionList.d.ts +3 -0
- package/dist/module/components/native/SectionList.js +24 -0
- package/dist/module/components/native/Switch.d.ts +3 -0
- package/dist/module/components/native/Switch.js +26 -0
- package/dist/module/components/native/Text.d.ts +3 -0
- package/dist/module/components/native/Text.js +33 -0
- package/dist/module/components/native/TextInput.d.ts +3 -0
- package/dist/module/components/native/TextInput.js +50 -0
- package/dist/module/components/native/TouchableHighlight.d.ts +3 -0
- package/dist/module/components/native/TouchableHighlight.js +32 -0
- package/dist/module/components/native/TouchableNativeFeedback.d.ts +3 -0
- package/dist/module/components/native/TouchableNativeFeedback.js +29 -0
- package/dist/module/components/native/TouchableOpacity.d.ts +3 -0
- package/dist/module/components/native/TouchableOpacity.js +29 -0
- package/dist/module/components/native/TouchableWithoutFeedback.d.ts +3 -0
- package/dist/module/components/native/TouchableWithoutFeedback.js +29 -0
- package/dist/module/components/native/View.d.ts +3 -0
- package/dist/module/components/native/View.js +15 -0
- package/dist/module/components/native/VirtualizedList.d.ts +3 -0
- package/dist/module/components/native/VirtualizedList.js +24 -0
- package/dist/module/components/native/useStyle.d.ts +2 -0
- package/dist/module/components/native/useStyle.js +22 -0
- package/dist/module/components/utils.d.ts +1 -0
- package/dist/module/components/utils.js +11 -0
- package/dist/module/components/web/ActivityIndicator.d.ts +3 -0
- package/dist/module/components/web/ActivityIndicator.js +17 -0
- package/dist/module/components/web/Button.d.ts +3 -0
- package/dist/module/components/web/Button.js +15 -0
- package/dist/module/components/web/FlatList.d.ts +3 -0
- package/dist/module/components/web/FlatList.js +19 -0
- package/dist/module/components/web/Image.d.ts +3 -0
- package/dist/module/components/web/Image.js +17 -0
- package/dist/module/components/web/ImageBackground.d.ts +3 -0
- package/dist/module/components/web/ImageBackground.js +18 -0
- package/dist/module/components/web/KeyboardAvoidingView.d.ts +3 -0
- package/dist/module/components/web/KeyboardAvoidingView.js +15 -0
- package/dist/module/components/web/Modal.d.ts +3 -0
- package/dist/module/components/web/Modal.js +14 -0
- package/dist/module/components/web/Pressable.d.ts +3 -0
- package/dist/module/components/web/Pressable.js +14 -0
- package/dist/module/components/web/RefreshControl.d.ts +3 -0
- package/dist/module/components/web/RefreshControl.js +14 -0
- package/dist/module/components/web/SafeAreaView.d.ts +3 -0
- package/dist/module/components/web/SafeAreaView.js +14 -0
- package/dist/module/components/web/ScrollView.d.ts +3 -0
- package/dist/module/components/web/ScrollView.js +15 -0
- package/dist/module/components/web/SectionList.d.ts +3 -0
- package/dist/module/components/web/SectionList.js +17 -0
- package/dist/module/components/web/Switch.d.ts +3 -0
- package/dist/module/components/web/Switch.js +20 -0
- package/dist/module/components/web/Text.d.ts +3 -0
- package/dist/module/components/web/Text.js +14 -0
- package/dist/module/components/web/TextInput.d.ts +3 -0
- package/dist/module/components/web/TextInput.js +14 -0
- package/dist/module/components/web/TouchableHighlight.d.ts +3 -0
- package/dist/module/components/web/TouchableHighlight.js +17 -0
- package/dist/module/components/web/TouchableNativeFeedback.d.ts +2 -0
- package/dist/module/components/web/TouchableNativeFeedback.js +2 -0
- package/dist/module/components/web/TouchableOpacity.d.ts +3 -0
- package/dist/module/components/web/TouchableOpacity.js +14 -0
- package/dist/module/components/web/TouchableWithoutFeedback.d.ts +3 -0
- package/dist/module/components/web/TouchableWithoutFeedback.js +14 -0
- package/dist/module/components/web/View.d.ts +3 -0
- package/dist/module/components/web/View.js +14 -0
- package/dist/module/components/web/VirtualizedList.d.ts +3 -0
- package/dist/module/components/web/VirtualizedList.js +17 -0
- package/dist/module/components/web/index.d.ts +22 -0
- package/dist/module/components/web/index.js +22 -0
- package/dist/module/components/web/metro-injected.d.ts +0 -0
- package/dist/module/components/web/metro-injected.js +0 -0
- package/dist/module/components/web/rnw.d.ts +2 -0
- package/dist/module/components/web/rnw.js +35 -0
- package/dist/module/core/config/config.common.d.ts +18 -0
- package/dist/module/core/config/config.common.js +74 -0
- package/dist/module/core/config/config.d.ts +11 -0
- package/dist/module/core/config/config.js +48 -0
- package/dist/module/core/config/config.native.d.ts +12 -0
- package/dist/module/core/config/config.native.js +61 -0
- package/dist/module/core/config/index.d.ts +1 -0
- package/dist/module/core/config/index.js +1 -0
- package/dist/module/core/index.d.ts +1 -0
- package/dist/module/core/index.js +1 -0
- package/dist/module/core/listener.d.ts +12 -0
- package/dist/module/core/listener.js +45 -0
- package/dist/module/core/logger.d.ts +5 -0
- package/dist/module/core/logger.js +11 -0
- package/dist/module/core/native/index.d.ts +2 -0
- package/dist/module/core/native/index.js +2 -0
- package/dist/module/core/native/native-utils.d.ts +4 -0
- package/dist/module/core/native/native-utils.js +27 -0
- package/dist/module/core/native/parsers/boxShadow.d.ts +1 -0
- package/dist/module/core/native/parsers/boxShadow.js +3 -0
- package/dist/module/core/native/parsers/fontVariant.d.ts +1 -0
- package/dist/module/core/native/parsers/fontVariant.js +1 -0
- package/dist/module/core/native/parsers/gradient.d.ts +8 -0
- package/dist/module/core/native/parsers/gradient.js +26 -0
- package/dist/module/core/native/parsers/index.d.ts +5 -0
- package/dist/module/core/native/parsers/index.js +5 -0
- package/dist/module/core/native/parsers/textShadow.d.ts +1 -0
- package/dist/module/core/native/parsers/textShadow.js +32 -0
- package/dist/module/core/native/parsers/transforms.d.ts +1 -0
- package/dist/module/core/native/parsers/transforms.js +48 -0
- package/dist/module/core/native/runtime.d.ts +2 -0
- package/dist/module/core/native/runtime.js +28 -0
- package/dist/module/core/native/store.d.ts +19 -0
- package/dist/module/core/native/store.js +172 -0
- package/dist/module/core/types.d.ts +73 -0
- package/dist/module/core/types.js +0 -0
- package/dist/module/core/web/cssListener.d.ts +19 -0
- package/dist/module/core/web/cssListener.js +137 -0
- package/dist/module/core/web/formatColor.d.ts +1 -0
- package/dist/module/core/web/formatColor.js +8 -0
- package/dist/module/core/web/getWebStyles.d.ts +2 -0
- package/dist/module/core/web/getWebStyles.js +49 -0
- package/dist/module/core/web/index.d.ts +4 -0
- package/dist/module/core/web/index.js +4 -0
- package/dist/module/core/web/parseCSSValue.d.ts +1 -0
- package/dist/module/core/web/parseCSSValue.js +8 -0
- package/dist/module/css/index.d.ts +1 -0
- package/dist/module/css/index.js +25 -0
- package/dist/module/css/insets.d.ts +1 -0
- package/dist/module/css/insets.js +63 -0
- package/dist/module/css/processFunctions.d.ts +2 -0
- package/dist/module/css/processFunctions.js +36 -0
- package/dist/module/css/themes.d.ts +1 -0
- package/dist/module/css/themes.js +97 -0
- package/dist/module/css/variants.d.ts +1 -0
- package/dist/module/css/variants.js +9 -0
- package/dist/module/hoc/index.d.ts +1 -0
- package/dist/module/hoc/index.js +1 -0
- package/dist/module/hoc/types.d.ts +27 -0
- package/dist/module/hoc/types.js +0 -0
- package/dist/module/hoc/withUniwind.d.ts +2 -0
- package/dist/module/hoc/withUniwind.js +76 -0
- package/dist/module/hoc/withUniwind.native.d.ts +2 -0
- package/dist/module/hoc/withUniwind.native.js +81 -0
- package/dist/module/hoc/withUniwindUtils.d.ts +5 -0
- package/dist/module/hoc/withUniwindUtils.js +5 -0
- package/dist/module/hooks/index.d.ts +4 -0
- package/dist/module/hooks/index.js +4 -0
- package/dist/module/hooks/useCSSVariable/getVariableValue.d.ts +1 -0
- package/dist/module/hooks/useCSSVariable/getVariableValue.js +12 -0
- package/dist/module/hooks/useCSSVariable/getVariableValue.native.d.ts +1 -0
- package/dist/module/hooks/useCSSVariable/getVariableValue.native.js +2 -0
- package/dist/module/hooks/useCSSVariable/index.d.ts +1 -0
- package/dist/module/hooks/useCSSVariable/index.js +1 -0
- package/dist/module/hooks/useCSSVariable/useCSSVariable.d.ts +13 -0
- package/dist/module/hooks/useCSSVariable/useCSSVariable.js +56 -0
- package/dist/module/hooks/useResolveClassNames.d.ts +2 -0
- package/dist/module/hooks/useResolveClassNames.js +18 -0
- package/dist/module/hooks/useResolveClassNames.native.d.ts +2 -0
- package/dist/module/hooks/useResolveClassNames.native.js +22 -0
- package/dist/module/hooks/useUniwind.d.ts +5 -0
- package/dist/module/hooks/useUniwind.js +21 -0
- package/dist/module/hooks/useUniwindAccent.d.ts +1 -0
- package/dist/module/hooks/useUniwindAccent.js +6 -0
- package/dist/module/hooks/useUniwindAccent.native.d.ts +2 -0
- package/dist/module/hooks/useUniwindAccent.native.js +5 -0
- package/dist/module/index.d.ts +5 -0
- package/dist/module/index.js +3 -0
- package/dist/module/types.d.ts +21 -0
- package/dist/module/types.js +22 -0
- package/dist/module/utils/buildDtsFile.d.ts +1 -0
- package/dist/module/utils/buildDtsFile.js +22 -0
- package/dist/module/utils/stringifyThemes.d.ts +1 -0
- package/dist/module/utils/stringifyThemes.js +1 -0
- package/dist/module/vite/index.d.ts +9 -0
- package/dist/module/vite/index.js +1 -0
- package/dist/module/vite/vite.d.ts +8 -0
- package/dist/module/vite/vite.js +73 -0
- package/dist/shared/uniwind.BZIuaszw.cjs +11 -0
- package/dist/shared/uniwind.BgZDHdUR.cjs +81 -0
- package/dist/shared/uniwind.Bt3kqZo6.mjs +290 -0
- package/dist/shared/uniwind.CyoRUwOj.mjs +9 -0
- package/dist/shared/uniwind.D3fvrgEG.mjs +68 -0
- package/dist/shared/uniwind.D_6s2EM-.cjs +301 -0
- package/dist/vite/index.cjs +80 -0
- package/dist/vite/index.d.ts +9 -0
- package/dist/vite/index.mjs +74 -0
- package/metro/package.json +3 -0
- package/package.json +106 -0
- package/readme.md +71 -0
- package/src/components/index.ts +313 -0
- package/src/components/native/ActivityIndicator.tsx +19 -0
- package/src/components/native/Button.tsx +16 -0
- package/src/components/native/FlatList.tsx +28 -0
- package/src/components/native/Image.tsx +19 -0
- package/src/components/native/ImageBackground.tsx +21 -0
- package/src/components/native/InputAccessoryView.tsx +23 -0
- package/src/components/native/KeyboardAvoidingView.tsx +18 -0
- package/src/components/native/Modal.tsx +19 -0
- package/src/components/native/Pressable.tsx +31 -0
- package/src/components/native/RefreshControl.tsx +25 -0
- package/src/components/native/SafeAreaView.tsx +16 -0
- package/src/components/native/ScrollView.tsx +21 -0
- package/src/components/native/SectionList.tsx +25 -0
- package/src/components/native/Switch.tsx +28 -0
- package/src/components/native/Text.tsx +39 -0
- package/src/components/native/TextInput.tsx +52 -0
- package/src/components/native/TouchableHighlight.tsx +34 -0
- package/src/components/native/TouchableNativeFeedback.tsx +31 -0
- package/src/components/native/TouchableOpacity.tsx +31 -0
- package/src/components/native/TouchableWithoutFeedback.tsx +31 -0
- package/src/components/native/View.tsx +16 -0
- package/src/components/native/VirtualizedList.tsx +25 -0
- package/src/components/native/useStyle.ts +33 -0
- package/src/components/utils.ts +16 -0
- package/src/components/web/ActivityIndicator.tsx +18 -0
- package/src/components/web/Button.tsx +16 -0
- package/src/components/web/FlatList.tsx +20 -0
- package/src/components/web/Image.tsx +18 -0
- package/src/components/web/ImageBackground.tsx +19 -0
- package/src/components/web/KeyboardAvoidingView.tsx +15 -0
- package/src/components/web/Modal.tsx +14 -0
- package/src/components/web/Pressable.tsx +14 -0
- package/src/components/web/RefreshControl.tsx +14 -0
- package/src/components/web/SafeAreaView.tsx +14 -0
- package/src/components/web/ScrollView.tsx +15 -0
- package/src/components/web/SectionList.tsx +17 -0
- package/src/components/web/Switch.tsx +21 -0
- package/src/components/web/Text.tsx +14 -0
- package/src/components/web/TextInput.tsx +14 -0
- package/src/components/web/TouchableHighlight.tsx +18 -0
- package/src/components/web/TouchableNativeFeedback.tsx +2 -0
- package/src/components/web/TouchableOpacity.tsx +14 -0
- package/src/components/web/TouchableWithoutFeedback.tsx +14 -0
- package/src/components/web/View.tsx +14 -0
- package/src/components/web/VirtualizedList.tsx +17 -0
- package/src/components/web/index.ts +22 -0
- package/src/components/web/metro-injected.ts +1 -0
- package/src/components/web/rnw.ts +52 -0
- package/src/core/config/config.common.ts +98 -0
- package/src/core/config/config.native.ts +79 -0
- package/src/core/config/config.ts +64 -0
- package/src/core/config/index.ts +1 -0
- package/src/core/index.ts +1 -0
- package/src/core/listener.ts +59 -0
- package/src/core/logger.ts +15 -0
- package/src/core/native/index.ts +2 -0
- package/src/core/native/native-utils.ts +41 -0
- package/src/core/native/parsers/boxShadow.ts +7 -0
- package/src/core/native/parsers/fontVariant.ts +3 -0
- package/src/core/native/parsers/gradient.ts +39 -0
- package/src/core/native/parsers/index.ts +5 -0
- package/src/core/native/parsers/textShadow.ts +37 -0
- package/src/core/native/parsers/transforms.ts +64 -0
- package/src/core/native/runtime.ts +32 -0
- package/src/core/native/store.ts +238 -0
- package/src/core/types.ts +92 -0
- package/src/core/web/cssListener.ts +185 -0
- package/src/core/web/formatColor.ts +13 -0
- package/src/core/web/getWebStyles.ts +76 -0
- package/src/core/web/index.ts +4 -0
- package/src/core/web/parseCSSValue.ts +10 -0
- package/src/css/index.ts +32 -0
- package/src/css/insets.ts +73 -0
- package/src/css/processFunctions.ts +39 -0
- package/src/css/themes.ts +130 -0
- package/src/css/variants.ts +11 -0
- package/src/hoc/index.ts +1 -0
- package/src/hoc/types.ts +45 -0
- package/src/hoc/withUniwind.native.tsx +118 -0
- package/src/hoc/withUniwind.tsx +115 -0
- package/src/hoc/withUniwindUtils.ts +10 -0
- package/src/hooks/index.ts +4 -0
- package/src/hooks/useCSSVariable/getVariableValue.native.ts +3 -0
- package/src/hooks/useCSSVariable/getVariableValue.ts +19 -0
- package/src/hooks/useCSSVariable/index.ts +1 -0
- package/src/hooks/useCSSVariable/useCSSVariable.ts +89 -0
- package/src/hooks/useResolveClassNames.native.ts +29 -0
- package/src/hooks/useResolveClassNames.ts +26 -0
- package/src/hooks/useUniwind.ts +26 -0
- package/src/hooks/useUniwindAccent.native.ts +8 -0
- package/src/hooks/useUniwindAccent.ts +10 -0
- package/src/index.ts +5 -0
- package/src/metro/addMetaToStylesTemplate.ts +152 -0
- package/src/metro/compileVirtual.ts +74 -0
- package/src/metro/index.d.ts +15 -0
- package/src/metro/index.ts +1 -0
- package/src/metro/injectThemes.ts +23 -0
- package/src/metro/logger.ts +44 -0
- package/src/metro/metro-css-patches.ts +57 -0
- package/src/metro/metro-transformer.ts +99 -0
- package/src/metro/polyfillWeb.ts +14 -0
- package/src/metro/processor/color.ts +76 -0
- package/src/metro/processor/css.ts +541 -0
- package/src/metro/processor/functions.ts +199 -0
- package/src/metro/processor/index.ts +1 -0
- package/src/metro/processor/mq.ts +82 -0
- package/src/metro/processor/processor.ts +249 -0
- package/src/metro/processor/rn.ts +277 -0
- package/src/metro/processor/units.ts +58 -0
- package/src/metro/processor/var.ts +18 -0
- package/src/metro/resolvers.ts +101 -0
- package/src/metro/types.ts +74 -0
- package/src/metro/utils/common.ts +103 -0
- package/src/metro/utils/index.ts +2 -0
- package/src/metro/utils/serialize.ts +116 -0
- package/src/metro/withUniwindConfig.ts +60 -0
- package/src/types.ts +24 -0
- package/src/utils/buildDtsFile.ts +27 -0
- package/src/utils/stringifyThemes.ts +1 -0
- package/src/vite/index.d.ts +9 -0
- package/src/vite/index.ts +1 -0
- package/src/vite/vite.ts +86 -0
- package/types.d.ts +109 -0
- package/uniwind.css +262 -0
- package/vite/package.json +3 -0
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _cssListener = require("./cssListener");
|
|
7
|
+
Object.keys(_cssListener).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _cssListener[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _cssListener[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
var _formatColor = require("./formatColor");
|
|
18
|
+
Object.keys(_formatColor).forEach(function (key) {
|
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
|
20
|
+
if (key in exports && exports[key] === _formatColor[key]) return;
|
|
21
|
+
Object.defineProperty(exports, key, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () {
|
|
24
|
+
return _formatColor[key];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
var _getWebStyles = require("./getWebStyles");
|
|
29
|
+
Object.keys(_getWebStyles).forEach(function (key) {
|
|
30
|
+
if (key === "default" || key === "__esModule") return;
|
|
31
|
+
if (key in exports && exports[key] === _getWebStyles[key]) return;
|
|
32
|
+
Object.defineProperty(exports, key, {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
get: function () {
|
|
35
|
+
return _getWebStyles[key];
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
var _parseCSSValue = require("./parseCSSValue");
|
|
40
|
+
Object.keys(_parseCSSValue).forEach(function (key) {
|
|
41
|
+
if (key === "default" || key === "__esModule") return;
|
|
42
|
+
if (key in exports && exports[key] === _parseCSSValue[key]) return;
|
|
43
|
+
Object.defineProperty(exports, key, {
|
|
44
|
+
enumerable: true,
|
|
45
|
+
get: function () {
|
|
46
|
+
return _parseCSSValue[key];
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.parseCSSValue = void 0;
|
|
7
|
+
var _culori = require("culori");
|
|
8
|
+
var _formatColor = require("./formatColor");
|
|
9
|
+
const parseCSSValue = value => {
|
|
10
|
+
if (isNaN(Number(value)) && (0, _culori.parse)(value) !== void 0) {
|
|
11
|
+
return (0, _formatColor.formatColor)(value);
|
|
12
|
+
}
|
|
13
|
+
return value;
|
|
14
|
+
};
|
|
15
|
+
exports.parseCSSValue = parseCSSValue;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.buildCSS = void 0;
|
|
7
|
+
var _fs = _interopRequireDefault(require("fs"));
|
|
8
|
+
var _path = _interopRequireDefault(require("path"));
|
|
9
|
+
var _insets = require("./insets");
|
|
10
|
+
var _themes = require("./themes");
|
|
11
|
+
var _variants = require("./variants");
|
|
12
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
|
+
const dirname = typeof __dirname !== "undefined" ? __dirname : import.meta.dirname;
|
|
14
|
+
const buildCSS = async (themes, input) => {
|
|
15
|
+
const variants = (0, _variants.generateCSSForVariants)();
|
|
16
|
+
const insets = (0, _insets.generateCSSForInsets)();
|
|
17
|
+
const themesCSS = await (0, _themes.generateCSSForThemes)(themes, input);
|
|
18
|
+
const cssFilePath = _path.default.join(dirname, "../../uniwind.css");
|
|
19
|
+
const oldCSSFile = _fs.default.existsSync(cssFilePath) ? _fs.default.readFileSync(cssFilePath, "utf-8") : "";
|
|
20
|
+
const newCssFile = [variants, insets, themesCSS].join("\n");
|
|
21
|
+
if (oldCSSFile === newCssFile) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
_fs.default.writeFileSync(cssFilePath, newCssFile);
|
|
25
|
+
};
|
|
26
|
+
exports.buildCSS = buildCSS;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.generateCSSForInsets = void 0;
|
|
7
|
+
const types = ["m", "p"];
|
|
8
|
+
const sides = ["", "x", "y", "t", "b", "l", "r"];
|
|
9
|
+
const spacing = "--spacing(--value(integer))";
|
|
10
|
+
const length = "--value([length])";
|
|
11
|
+
const generateCSSForInsets = () => {
|
|
12
|
+
let css = `@utility h-screen-safe {
|
|
13
|
+
height: calc(100vh - (env(safe-area-inset-top) + env(safe-area-inset-bottom)));
|
|
14
|
+
}
|
|
15
|
+
`;
|
|
16
|
+
const getInsetsForSide = side => {
|
|
17
|
+
switch (side) {
|
|
18
|
+
case "t":
|
|
19
|
+
return ["top"];
|
|
20
|
+
case "b":
|
|
21
|
+
return ["bottom"];
|
|
22
|
+
case "l":
|
|
23
|
+
return ["left"];
|
|
24
|
+
case "r":
|
|
25
|
+
return ["right"];
|
|
26
|
+
case "x":
|
|
27
|
+
return ["left", "right"];
|
|
28
|
+
case "y":
|
|
29
|
+
return ["top", "bottom"];
|
|
30
|
+
default:
|
|
31
|
+
return ["top", "bottom", "left", "right"];
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
types.forEach(type => {
|
|
35
|
+
sides.forEach(side => {
|
|
36
|
+
const styleName = type === "m" ? "margin" : "padding";
|
|
37
|
+
const insets = getInsetsForSide(side);
|
|
38
|
+
const styles = insets.map(inset => `${styleName}-${inset}: env(safe-area-inset-${inset});`);
|
|
39
|
+
const safeStyles = styles.flatMap(style => {
|
|
40
|
+
const styleWithoutSemicolon = style.replace(";", "");
|
|
41
|
+
return [styleWithoutSemicolon.replace(/: (env.*)/, (_, env) => `: max(${env}, ${spacing});`), styleWithoutSemicolon.replace(/: (env.*)/, (_, env) => `: max(${env}, ${length});`)];
|
|
42
|
+
});
|
|
43
|
+
const safeOffsetStyles = styles.flatMap(style => {
|
|
44
|
+
const styleWithoutSemicolon = style.replace(";", "");
|
|
45
|
+
return [styleWithoutSemicolon.replace(/: (env.*)/, (_, env) => `: calc(${env} + ${spacing});`), styleWithoutSemicolon.replace(/: (env.*)/, (_, env) => `: calc(${env} + ${length});`)];
|
|
46
|
+
});
|
|
47
|
+
css += `
|
|
48
|
+
@utility ${type}${side}-safe {
|
|
49
|
+
${styles.join("\n ")}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
@utility ${type}${side}-safe-or-* {
|
|
53
|
+
${safeStyles.join("\n ")}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
@utility ${type}${side}-safe-offset-* {
|
|
57
|
+
${safeOffsetStyles.join("\n ")}
|
|
58
|
+
}
|
|
59
|
+
`;
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
return css.replaceAll(" ", "").trim() + "\n";
|
|
63
|
+
};
|
|
64
|
+
exports.generateCSSForInsets = generateCSSForInsets;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.processFunctions = void 0;
|
|
7
|
+
const ONE_PX = {
|
|
8
|
+
type: "token",
|
|
9
|
+
value: {
|
|
10
|
+
type: "dimension",
|
|
11
|
+
unit: "px",
|
|
12
|
+
value: 1
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
const processFunctions = exports.processFunctions = {
|
|
16
|
+
pixelRatio: fn => {
|
|
17
|
+
return {
|
|
18
|
+
type: "function",
|
|
19
|
+
value: {
|
|
20
|
+
name: "calc",
|
|
21
|
+
arguments: [fn.arguments.at(0) ?? ONE_PX, {
|
|
22
|
+
type: "token",
|
|
23
|
+
value: {
|
|
24
|
+
type: "delim",
|
|
25
|
+
value: "*"
|
|
26
|
+
}
|
|
27
|
+
}, ONE_PX]
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
},
|
|
31
|
+
fontScale: fn => {
|
|
32
|
+
return {
|
|
33
|
+
type: "function",
|
|
34
|
+
value: {
|
|
35
|
+
name: "calc",
|
|
36
|
+
arguments: [fn.arguments.at(0) ?? ONE_PX, {
|
|
37
|
+
type: "token",
|
|
38
|
+
value: {
|
|
39
|
+
type: "delim",
|
|
40
|
+
value: "*"
|
|
41
|
+
}
|
|
42
|
+
}, {
|
|
43
|
+
type: "token",
|
|
44
|
+
value: {
|
|
45
|
+
type: "dimension",
|
|
46
|
+
value: 1,
|
|
47
|
+
unit: "rem"
|
|
48
|
+
}
|
|
49
|
+
}]
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
},
|
|
53
|
+
hairlineWidth: () => ONE_PX
|
|
54
|
+
};
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.generateCSSForThemes = void 0;
|
|
7
|
+
var _node = require("@tailwindcss/node");
|
|
8
|
+
var _fs = _interopRequireDefault(require("fs"));
|
|
9
|
+
var _lightningcss = require("lightningcss");
|
|
10
|
+
var _path = _interopRequireDefault(require("path"));
|
|
11
|
+
var _logger = require("../metro/logger");
|
|
12
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
|
+
const readFileSafe = filePath => {
|
|
14
|
+
try {
|
|
15
|
+
return _fs.default.readFileSync(filePath, "utf-8");
|
|
16
|
+
} catch {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
const isExcludedDependency = url => [url.includes("node_modules/tailwindcss"), url.includes("node_modules/@tailwindcss"), url.includes("node_modules/uniwind")].some(Boolean);
|
|
21
|
+
const generateCSSForThemes = async (themes, input) => {
|
|
22
|
+
const themesVariables = Object.fromEntries(themes.map(theme => [theme, /* @__PURE__ */new Set()]));
|
|
23
|
+
const findVariantsRec = async cssPath => {
|
|
24
|
+
const css = readFileSafe(cssPath);
|
|
25
|
+
if (css === null) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
const {
|
|
29
|
+
dependencies
|
|
30
|
+
} = (0, _lightningcss.transform)({
|
|
31
|
+
code: Buffer.from(css),
|
|
32
|
+
filename: "uniwind.css",
|
|
33
|
+
analyzeDependencies: true,
|
|
34
|
+
visitor: {
|
|
35
|
+
Rule: rule => {
|
|
36
|
+
if (rule.type === "unknown" && rule.value.name === "variant") {
|
|
37
|
+
const [firstPrelude] = rule.value.prelude;
|
|
38
|
+
if (firstPrelude?.type !== "token" || firstPrelude.value.type !== "ident" || !themes.includes(firstPrelude.value.value)) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
const theme = firstPrelude.value.value;
|
|
42
|
+
rule.value.block?.forEach(block => {
|
|
43
|
+
if (block.type === "dashed-ident") {
|
|
44
|
+
themesVariables[theme]?.add(block.value);
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
if (!Array.isArray(dependencies)) {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
const importUrls = /* @__PURE__ */new Set();
|
|
55
|
+
const importsCSS = dependencies.filter(dependency => {
|
|
56
|
+
if (dependency.url.startsWith(".")) {
|
|
57
|
+
importUrls.add(_path.default.resolve(_path.default.dirname(cssPath), dependency.url));
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
return !isExcludedDependency(dependency.url);
|
|
61
|
+
}).map(dependency => `@import "${dependency.url}";`).join("\n");
|
|
62
|
+
await (0, _node.compile)(importsCSS, {
|
|
63
|
+
base: _path.default.resolve(_path.default.dirname(cssPath)),
|
|
64
|
+
onDependency: dependency => {
|
|
65
|
+
if (isExcludedDependency(dependency)) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
importUrls.add(dependency);
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
for (const filePath of importUrls) {
|
|
72
|
+
await findVariantsRec(filePath);
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
await findVariantsRec(input);
|
|
76
|
+
let hasErrors = false;
|
|
77
|
+
const hasVariables = Object.values(themesVariables).some(variables => variables.size > 0);
|
|
78
|
+
Object.values(themesVariables).forEach(variables => {
|
|
79
|
+
Object.entries(themesVariables).forEach(([checkedTheme, checkedVariables]) => {
|
|
80
|
+
variables.forEach(variable => {
|
|
81
|
+
if (!checkedVariables.has(variable)) {
|
|
82
|
+
_logger.Logger.error(`Theme ${checkedTheme} is missing variable ${variable}`);
|
|
83
|
+
hasErrors = true;
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
if (hasErrors) {
|
|
89
|
+
_logger.Logger.error("All themes must have the same variables");
|
|
90
|
+
}
|
|
91
|
+
const variablesCSS = hasVariables ? ["", "@theme {", ...Array.from(Object.values(themesVariables).at(0) ?? []).map(variable => ` ${variable}: unset;`), "}"] : [];
|
|
92
|
+
const uniwindCSS = [...themes.map(theme => `@custom-variant ${theme} (&:where(.${theme}, .${theme} *));`), ...variablesCSS].join("\n");
|
|
93
|
+
return uniwindCSS;
|
|
94
|
+
};
|
|
95
|
+
exports.generateCSSForThemes = generateCSSForThemes;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.generateCSSForVariants = void 0;
|
|
7
|
+
const variants = ["ios", "android", "web", "native"];
|
|
8
|
+
const generateCSSForVariants = () => {
|
|
9
|
+
let css = "";
|
|
10
|
+
variants.forEach(variant => {
|
|
11
|
+
css += `@custom-variant ${variant} (${variant === "web" ? "html &" : `@media ${variant}`});
|
|
12
|
+
`;
|
|
13
|
+
});
|
|
14
|
+
return css;
|
|
15
|
+
};
|
|
16
|
+
exports.generateCSSForVariants = generateCSSForVariants;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _withUniwind = require("./withUniwind");
|
|
7
|
+
Object.keys(_withUniwind).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _withUniwind[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _withUniwind[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.withUniwind = void 0;
|
|
7
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
8
|
+
var _react = require("react");
|
|
9
|
+
var _web = require("../core/web");
|
|
10
|
+
var _withUniwindUtils = require("./withUniwindUtils");
|
|
11
|
+
const withUniwind = (Component2, options) => options ? withManualUniwind(Component2, options) : withAutoUniwind(Component2);
|
|
12
|
+
exports.withUniwind = withUniwind;
|
|
13
|
+
const withAutoUniwind = Component2 => props => {
|
|
14
|
+
const {
|
|
15
|
+
classNames,
|
|
16
|
+
generatedProps
|
|
17
|
+
} = Object.entries(props).reduce((acc, [propName, propValue]) => {
|
|
18
|
+
if ((0, _withUniwindUtils.isColorClassProperty)(propName)) {
|
|
19
|
+
const colorProp = (0, _withUniwindUtils.classToColor)(propName);
|
|
20
|
+
if (props[colorProp] !== void 0) {
|
|
21
|
+
return acc;
|
|
22
|
+
}
|
|
23
|
+
const className = propValue;
|
|
24
|
+
const color = (0, _web.getWebStyles)(className).accentColor;
|
|
25
|
+
acc.generatedProps[colorProp] = color !== void 0 ? (0, _web.formatColor)(color) : void 0;
|
|
26
|
+
acc.classNames += `${className} `;
|
|
27
|
+
return acc;
|
|
28
|
+
}
|
|
29
|
+
if ((0, _withUniwindUtils.isClassProperty)(propName)) {
|
|
30
|
+
const styleProp = (0, _withUniwindUtils.classToStyle)(propName);
|
|
31
|
+
acc.generatedProps[styleProp] ??= [];
|
|
32
|
+
acc.generatedProps[styleProp][0] = {
|
|
33
|
+
$$css: true,
|
|
34
|
+
tailwind: propValue
|
|
35
|
+
};
|
|
36
|
+
return acc;
|
|
37
|
+
}
|
|
38
|
+
if ((0, _withUniwindUtils.isStyleProperty)(propName)) {
|
|
39
|
+
acc.generatedProps[propName] ??= [];
|
|
40
|
+
acc.generatedProps[propName][1] = propValue;
|
|
41
|
+
return acc;
|
|
42
|
+
}
|
|
43
|
+
return acc;
|
|
44
|
+
}, {
|
|
45
|
+
generatedProps: {},
|
|
46
|
+
classNames: ""
|
|
47
|
+
});
|
|
48
|
+
const [, rerender] = (0, _react.useReducer)(() => ({}), {});
|
|
49
|
+
(0, _react.useEffect)(() => {
|
|
50
|
+
const dispose = _web.CSSListener.subscribeToClassName(classNames, rerender);
|
|
51
|
+
return dispose;
|
|
52
|
+
}, [classNames]);
|
|
53
|
+
return /* @__PURE__ */(0, _jsxRuntime.jsx)(Component2, {
|
|
54
|
+
...props,
|
|
55
|
+
...generatedProps
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
const withManualUniwind = (Component2, options) => props => {
|
|
59
|
+
const {
|
|
60
|
+
generatedProps,
|
|
61
|
+
classNames
|
|
62
|
+
} = Object.entries(options).reduce((acc, [propName, option]) => {
|
|
63
|
+
const className = props[option.fromClassName];
|
|
64
|
+
if (className === void 0) {
|
|
65
|
+
return acc;
|
|
66
|
+
}
|
|
67
|
+
if (option.styleProperty !== void 0) {
|
|
68
|
+
if (props[propName] !== void 0) {
|
|
69
|
+
return acc;
|
|
70
|
+
}
|
|
71
|
+
const value = (0, _web.getWebStyles)(className)[option.styleProperty];
|
|
72
|
+
const transformedValue = value !== void 0 && option.styleProperty.toLowerCase().includes("color") ? (0, _web.formatColor)(value) : value;
|
|
73
|
+
acc.classNames += `${className} `;
|
|
74
|
+
acc.generatedProps[propName] = transformedValue;
|
|
75
|
+
return acc;
|
|
76
|
+
}
|
|
77
|
+
acc.generatedProps[propName] = [{
|
|
78
|
+
$$css: true,
|
|
79
|
+
tailwind: className
|
|
80
|
+
}, props[propName]];
|
|
81
|
+
return acc;
|
|
82
|
+
}, {
|
|
83
|
+
generatedProps: {},
|
|
84
|
+
classNames: ""
|
|
85
|
+
});
|
|
86
|
+
const [, rerender] = (0, _react.useReducer)(() => ({}), {});
|
|
87
|
+
(0, _react.useEffect)(() => {
|
|
88
|
+
const dispose = _web.CSSListener.subscribeToClassName(classNames, rerender);
|
|
89
|
+
return dispose;
|
|
90
|
+
}, [classNames]);
|
|
91
|
+
return /* @__PURE__ */(0, _jsxRuntime.jsx)(Component2, {
|
|
92
|
+
...props,
|
|
93
|
+
...generatedProps
|
|
94
|
+
});
|
|
95
|
+
};
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.withUniwind = void 0;
|
|
7
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
8
|
+
var _react = require("react");
|
|
9
|
+
var _listener = require("../core/listener");
|
|
10
|
+
var _native = require("../core/native");
|
|
11
|
+
var _withUniwindUtils = require("./withUniwindUtils");
|
|
12
|
+
const withUniwind = (Component2, options) => options ? withManualUniwind(Component2, options) : withAutoUniwind(Component2);
|
|
13
|
+
exports.withUniwind = withUniwind;
|
|
14
|
+
const withAutoUniwind = Component2 => props => {
|
|
15
|
+
const {
|
|
16
|
+
dependencies,
|
|
17
|
+
generatedProps
|
|
18
|
+
} = Object.entries(props).reduce((acc, [propName, propValue]) => {
|
|
19
|
+
if ((0, _withUniwindUtils.isColorClassProperty)(propName)) {
|
|
20
|
+
const colorProp = (0, _withUniwindUtils.classToColor)(propName);
|
|
21
|
+
if (props[colorProp] !== void 0) {
|
|
22
|
+
return acc;
|
|
23
|
+
}
|
|
24
|
+
const {
|
|
25
|
+
styles,
|
|
26
|
+
dependencies: dependencies2
|
|
27
|
+
} = _native.UniwindStore.getStyles(propValue);
|
|
28
|
+
acc.dependencies.push(...dependencies2);
|
|
29
|
+
acc.generatedProps[colorProp] = styles.accentColor;
|
|
30
|
+
return acc;
|
|
31
|
+
}
|
|
32
|
+
if ((0, _withUniwindUtils.isClassProperty)(propName)) {
|
|
33
|
+
const styleProp = (0, _withUniwindUtils.classToStyle)(propName);
|
|
34
|
+
const {
|
|
35
|
+
styles,
|
|
36
|
+
dependencies: dependencies2
|
|
37
|
+
} = _native.UniwindStore.getStyles(propValue);
|
|
38
|
+
acc.dependencies.push(...dependencies2);
|
|
39
|
+
acc.generatedProps[styleProp] ??= [];
|
|
40
|
+
acc.generatedProps[styleProp][0] = styles;
|
|
41
|
+
return acc;
|
|
42
|
+
}
|
|
43
|
+
if ((0, _withUniwindUtils.isStyleProperty)(propName)) {
|
|
44
|
+
acc.generatedProps[propName] ??= [];
|
|
45
|
+
acc.generatedProps[propName][1] = propValue;
|
|
46
|
+
return acc;
|
|
47
|
+
}
|
|
48
|
+
return acc;
|
|
49
|
+
}, {
|
|
50
|
+
generatedProps: {},
|
|
51
|
+
dependencies: []
|
|
52
|
+
});
|
|
53
|
+
const deps = Array.from(new Set(dependencies));
|
|
54
|
+
const [, rerender] = (0, _react.useReducer)(() => ({}), {});
|
|
55
|
+
(0, _react.useEffect)(() => {
|
|
56
|
+
const dispose = _listener.UniwindListener.subscribe(rerender, deps);
|
|
57
|
+
return dispose;
|
|
58
|
+
}, [deps]);
|
|
59
|
+
return /* @__PURE__ */(0, _jsxRuntime.jsx)(Component2, {
|
|
60
|
+
...props,
|
|
61
|
+
...generatedProps
|
|
62
|
+
});
|
|
63
|
+
};
|
|
64
|
+
const withManualUniwind = (Component2, options) => props => {
|
|
65
|
+
const {
|
|
66
|
+
generatedProps,
|
|
67
|
+
dependencies
|
|
68
|
+
} = Object.entries(options).reduce((acc, [propName, option]) => {
|
|
69
|
+
const className = props[option.fromClassName];
|
|
70
|
+
if (className === void 0) {
|
|
71
|
+
return acc;
|
|
72
|
+
}
|
|
73
|
+
if (option.styleProperty !== void 0) {
|
|
74
|
+
if (props[propName] !== void 0) {
|
|
75
|
+
return acc;
|
|
76
|
+
}
|
|
77
|
+
const {
|
|
78
|
+
styles: styles2,
|
|
79
|
+
dependencies: dependencies3
|
|
80
|
+
} = _native.UniwindStore.getStyles(className);
|
|
81
|
+
acc.generatedProps[propName] = styles2[option.styleProperty];
|
|
82
|
+
acc.dependencies.push(...dependencies3);
|
|
83
|
+
return acc;
|
|
84
|
+
}
|
|
85
|
+
const {
|
|
86
|
+
styles,
|
|
87
|
+
dependencies: dependencies2
|
|
88
|
+
} = _native.UniwindStore.getStyles(className);
|
|
89
|
+
acc.generatedProps[propName] = styles;
|
|
90
|
+
acc.dependencies.push(...dependencies2);
|
|
91
|
+
return acc;
|
|
92
|
+
}, {
|
|
93
|
+
generatedProps: {},
|
|
94
|
+
dependencies: []
|
|
95
|
+
});
|
|
96
|
+
const deps = Array.from(new Set(dependencies));
|
|
97
|
+
const [, rerender] = (0, _react.useReducer)(() => ({}), {});
|
|
98
|
+
(0, _react.useEffect)(() => {
|
|
99
|
+
const dispose = _listener.UniwindListener.subscribe(rerender, deps);
|
|
100
|
+
return dispose;
|
|
101
|
+
}, [deps]);
|
|
102
|
+
return /* @__PURE__ */(0, _jsxRuntime.jsx)(Component2, {
|
|
103
|
+
...props,
|
|
104
|
+
...generatedProps
|
|
105
|
+
});
|
|
106
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.isStyleProperty = exports.isColorClassProperty = exports.isClassProperty = exports.classToStyle = exports.classToColor = void 0;
|
|
7
|
+
const classToStyle = className => className === "className" ? "style" : className.replace("ClassName", "Style");
|
|
8
|
+
exports.classToStyle = classToStyle;
|
|
9
|
+
const classToColor = className => className.replace("ClassName", "");
|
|
10
|
+
exports.classToColor = classToColor;
|
|
11
|
+
const isColorClassProperty = prop => prop.toLowerCase().includes("color") && prop.endsWith("ClassName");
|
|
12
|
+
exports.isColorClassProperty = isColorClassProperty;
|
|
13
|
+
const isClassProperty = prop => prop === "className" || prop.endsWith("ClassName");
|
|
14
|
+
exports.isClassProperty = isClassProperty;
|
|
15
|
+
const isStyleProperty = prop => prop === "style" || prop.endsWith("Style");
|
|
16
|
+
exports.isStyleProperty = isStyleProperty;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _useCSSVariable = require("./useCSSVariable");
|
|
7
|
+
Object.keys(_useCSSVariable).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _useCSSVariable[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _useCSSVariable[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
var _useResolveClassNames = require("./useResolveClassNames");
|
|
18
|
+
Object.keys(_useResolveClassNames).forEach(function (key) {
|
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
|
20
|
+
if (key in exports && exports[key] === _useResolveClassNames[key]) return;
|
|
21
|
+
Object.defineProperty(exports, key, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () {
|
|
24
|
+
return _useResolveClassNames[key];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
var _useUniwind = require("./useUniwind");
|
|
29
|
+
Object.keys(_useUniwind).forEach(function (key) {
|
|
30
|
+
if (key === "default" || key === "__esModule") return;
|
|
31
|
+
if (key in exports && exports[key] === _useUniwind[key]) return;
|
|
32
|
+
Object.defineProperty(exports, key, {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
get: function () {
|
|
35
|
+
return _useUniwind[key];
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
var _useUniwindAccent = require("./useUniwindAccent");
|
|
40
|
+
Object.keys(_useUniwindAccent).forEach(function (key) {
|
|
41
|
+
if (key === "default" || key === "__esModule") return;
|
|
42
|
+
if (key in exports && exports[key] === _useUniwindAccent[key]) return;
|
|
43
|
+
Object.defineProperty(exports, key, {
|
|
44
|
+
enumerable: true,
|
|
45
|
+
get: function () {
|
|
46
|
+
return _useUniwindAccent[key];
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getVariableValue = void 0;
|
|
7
|
+
var _web = require("../../core/web");
|
|
8
|
+
const documentStyles = typeof document !== "undefined" ? window.getComputedStyle(document.documentElement) : null;
|
|
9
|
+
const getVariableValue = name => {
|
|
10
|
+
if (!documentStyles) {
|
|
11
|
+
return void 0;
|
|
12
|
+
}
|
|
13
|
+
const value = documentStyles.getPropertyValue(name).trim();
|
|
14
|
+
if (value === "") {
|
|
15
|
+
return void 0;
|
|
16
|
+
}
|
|
17
|
+
return (0, _web.parseCSSValue)(value);
|
|
18
|
+
};
|
|
19
|
+
exports.getVariableValue = getVariableValue;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getVariableValue = void 0;
|
|
7
|
+
var _native = require("../../core/native");
|
|
8
|
+
const getVariableValue = name => _native.UniwindStore.vars[name];
|
|
9
|
+
exports.getVariableValue = getVariableValue;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _useCSSVariable = require("./useCSSVariable");
|
|
7
|
+
Object.keys(_useCSSVariable).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _useCSSVariable[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _useCSSVariable[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|