@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,68 @@
|
|
|
1
|
+
const name = "@niibase/uniwind";
|
|
2
|
+
|
|
3
|
+
const isDefined = (value) => value !== null && value !== void 0;
|
|
4
|
+
const toCamelCase = (str) => str.replace(/-([a-z])/g, (_, letter) => letter.toUpperCase());
|
|
5
|
+
const pipe = (data) => ((...fns) => fns.reduce((acc, fn) => fn(acc), data));
|
|
6
|
+
const isNumber = (data) => {
|
|
7
|
+
if (typeof data === "number") {
|
|
8
|
+
return true;
|
|
9
|
+
}
|
|
10
|
+
if (typeof data === "string" && data !== "") {
|
|
11
|
+
return !isNaN(Number(data));
|
|
12
|
+
}
|
|
13
|
+
return false;
|
|
14
|
+
};
|
|
15
|
+
const smartSplit = (str, separator = " ") => {
|
|
16
|
+
const escaper = "&&&";
|
|
17
|
+
return pipe(str)(
|
|
18
|
+
(x) => x.replace(/\s\?\?\s/g, `${escaper}??${escaper}`),
|
|
19
|
+
(x) => x.replace(/\s([+\-*/])\s/g, `${escaper}$1${escaper}`),
|
|
20
|
+
(x) => x.split(separator),
|
|
21
|
+
(x) => x.map((token) => token.replace(new RegExp(escaper, "g"), " "))
|
|
22
|
+
);
|
|
23
|
+
};
|
|
24
|
+
const addMissingSpaces = (str) => pipe(str)(
|
|
25
|
+
(x) => x.trim(),
|
|
26
|
+
(x) => x.replace(/([^ {])this/g, "$1 this"),
|
|
27
|
+
(x) => x.replace(/\](?=\d)/g, "] "),
|
|
28
|
+
(x) => x.replace(/\)(?=\S)/g, ") "),
|
|
29
|
+
(x) => x.replace(/(?<!^)(?<!\s)"(?=\d)/g, '" ')
|
|
30
|
+
);
|
|
31
|
+
const uniq = (arr) => Array.from(new Set(arr));
|
|
32
|
+
const isValidJSValue = (jsValueString) => {
|
|
33
|
+
try {
|
|
34
|
+
new Function(`const test = ${jsValueString}`);
|
|
35
|
+
return true;
|
|
36
|
+
} catch {
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
const shouldBeSerialized = (value) => {
|
|
41
|
+
if (value.includes("-")) {
|
|
42
|
+
return value.split("-").some(shouldBeSerialized);
|
|
43
|
+
}
|
|
44
|
+
return [
|
|
45
|
+
isNumber(value),
|
|
46
|
+
value.startsWith("this["),
|
|
47
|
+
value.startsWith("rt."),
|
|
48
|
+
/[*/+-]/.test(value),
|
|
49
|
+
value.includes('"'),
|
|
50
|
+
value.includes(" ")
|
|
51
|
+
].some(Boolean);
|
|
52
|
+
};
|
|
53
|
+
const roundToPrecision = (value, precision) => parseFloat(value.toFixed(precision));
|
|
54
|
+
const deepEqual = (a, b) => {
|
|
55
|
+
if (Object.is(a, b)) {
|
|
56
|
+
return true;
|
|
57
|
+
}
|
|
58
|
+
if (typeof a !== "object" || a === null || typeof b !== "object" || b === null) {
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
61
|
+
const keysA = Object.keys(a);
|
|
62
|
+
if (keysA.length !== Object.keys(b).length) {
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
65
|
+
return keysA.every((key) => deepEqual(a[key], b[key]) && Object.prototype.hasOwnProperty.call(b, key));
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
export { isValidJSValue as a, addMissingSpaces as b, isDefined as c, deepEqual as d, shouldBeSerialized as e, isNumber as i, name as n, pipe as p, roundToPrecision as r, smartSplit as s, toCamelCase as t, uniq as u };
|
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const node = require('@tailwindcss/node');
|
|
6
|
+
const lightningcss = require('lightningcss');
|
|
7
|
+
const common = require('./uniwind.BgZDHdUR.cjs');
|
|
8
|
+
|
|
9
|
+
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
|
|
10
|
+
|
|
11
|
+
const fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
|
|
12
|
+
const path__default = /*#__PURE__*/_interopDefaultCompat(path);
|
|
13
|
+
|
|
14
|
+
const red = "\x1B[91m";
|
|
15
|
+
const yellow = "\x1B[33m";
|
|
16
|
+
const blue = "\x1B[36m";
|
|
17
|
+
const reset = "\x1B[0m";
|
|
18
|
+
class Logger {
|
|
19
|
+
constructor(name) {
|
|
20
|
+
this.name = name;
|
|
21
|
+
}
|
|
22
|
+
static debug = false;
|
|
23
|
+
static log(message, meta = "") {
|
|
24
|
+
if (!Logger.debug) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
console.log(`${blue}Uniwind ${meta}- ${message}${reset}`);
|
|
28
|
+
}
|
|
29
|
+
static error(message, meta = "") {
|
|
30
|
+
console.log(`${red}Uniwind Error ${meta}- ${message}${reset}`);
|
|
31
|
+
}
|
|
32
|
+
static warn(message, meta = "") {
|
|
33
|
+
if (!Logger.debug) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
console.log(`${yellow}Uniwind Warning ${meta}- ${message}${reset}`);
|
|
37
|
+
}
|
|
38
|
+
log(message) {
|
|
39
|
+
Logger.log(message, `[${this.name} Processor] `);
|
|
40
|
+
}
|
|
41
|
+
error(message) {
|
|
42
|
+
Logger.error(message, `[${this.name} Processor] `);
|
|
43
|
+
}
|
|
44
|
+
warn(message) {
|
|
45
|
+
Logger.warn(message, `[${this.name} Processor] `);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const ONE_PX = {
|
|
50
|
+
type: "token",
|
|
51
|
+
value: { type: "dimension", unit: "px", value: 1 }
|
|
52
|
+
};
|
|
53
|
+
const processFunctions = {
|
|
54
|
+
pixelRatio: (fn) => {
|
|
55
|
+
return {
|
|
56
|
+
type: "function",
|
|
57
|
+
value: {
|
|
58
|
+
name: "calc",
|
|
59
|
+
arguments: [
|
|
60
|
+
fn.arguments.at(0) ?? ONE_PX,
|
|
61
|
+
{ type: "token", value: { type: "delim", value: "*" } },
|
|
62
|
+
ONE_PX
|
|
63
|
+
]
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
},
|
|
67
|
+
fontScale: (fn) => {
|
|
68
|
+
return {
|
|
69
|
+
type: "function",
|
|
70
|
+
value: {
|
|
71
|
+
name: "calc",
|
|
72
|
+
arguments: [
|
|
73
|
+
fn.arguments.at(0) ?? ONE_PX,
|
|
74
|
+
{ type: "token", value: { type: "delim", value: "*" } },
|
|
75
|
+
{
|
|
76
|
+
type: "token",
|
|
77
|
+
value: { type: "dimension", value: 1, unit: "rem" }
|
|
78
|
+
}
|
|
79
|
+
]
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
},
|
|
83
|
+
hairlineWidth: () => ONE_PX
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
const types = ["m", "p"];
|
|
87
|
+
const sides = ["", "x", "y", "t", "b", "l", "r"];
|
|
88
|
+
const spacing = "--spacing(--value(integer))";
|
|
89
|
+
const length = "--value([length])";
|
|
90
|
+
const generateCSSForInsets = () => {
|
|
91
|
+
let css = `@utility h-screen-safe {
|
|
92
|
+
height: calc(100vh - (env(safe-area-inset-top) + env(safe-area-inset-bottom)));
|
|
93
|
+
}
|
|
94
|
+
`;
|
|
95
|
+
const getInsetsForSide = (side) => {
|
|
96
|
+
switch (side) {
|
|
97
|
+
case "t":
|
|
98
|
+
return ["top"];
|
|
99
|
+
case "b":
|
|
100
|
+
return ["bottom"];
|
|
101
|
+
case "l":
|
|
102
|
+
return ["left"];
|
|
103
|
+
case "r":
|
|
104
|
+
return ["right"];
|
|
105
|
+
case "x":
|
|
106
|
+
return ["left", "right"];
|
|
107
|
+
case "y":
|
|
108
|
+
return ["top", "bottom"];
|
|
109
|
+
default:
|
|
110
|
+
return ["top", "bottom", "left", "right"];
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
types.forEach((type) => {
|
|
114
|
+
sides.forEach((side) => {
|
|
115
|
+
const styleName = type === "m" ? "margin" : "padding";
|
|
116
|
+
const insets = getInsetsForSide(side);
|
|
117
|
+
const styles = insets.map((inset) => `${styleName}-${inset}: env(safe-area-inset-${inset});`);
|
|
118
|
+
const safeStyles = styles.flatMap((style) => {
|
|
119
|
+
const styleWithoutSemicolon = style.replace(";", "");
|
|
120
|
+
return [
|
|
121
|
+
styleWithoutSemicolon.replace(/: (env.*)/, (_, env) => `: max(${env}, ${spacing});`),
|
|
122
|
+
styleWithoutSemicolon.replace(/: (env.*)/, (_, env) => `: max(${env}, ${length});`)
|
|
123
|
+
];
|
|
124
|
+
});
|
|
125
|
+
const safeOffsetStyles = styles.flatMap((style) => {
|
|
126
|
+
const styleWithoutSemicolon = style.replace(";", "");
|
|
127
|
+
return [
|
|
128
|
+
styleWithoutSemicolon.replace(/: (env.*)/, (_, env) => `: calc(${env} + ${spacing});`),
|
|
129
|
+
styleWithoutSemicolon.replace(/: (env.*)/, (_, env) => `: calc(${env} + ${length});`)
|
|
130
|
+
];
|
|
131
|
+
});
|
|
132
|
+
css += `
|
|
133
|
+
@utility ${type}${side}-safe {
|
|
134
|
+
${styles.join("\n ")}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
@utility ${type}${side}-safe-or-* {
|
|
138
|
+
${safeStyles.join("\n ")}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
@utility ${type}${side}-safe-offset-* {
|
|
142
|
+
${safeOffsetStyles.join("\n ")}
|
|
143
|
+
}
|
|
144
|
+
`;
|
|
145
|
+
});
|
|
146
|
+
});
|
|
147
|
+
return css.replaceAll(" ", "").trim() + "\n";
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
const readFileSafe = (filePath) => {
|
|
151
|
+
try {
|
|
152
|
+
return fs__default.readFileSync(filePath, "utf-8");
|
|
153
|
+
} catch {
|
|
154
|
+
return null;
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
const isExcludedDependency = (url) => [
|
|
158
|
+
url.includes("node_modules/tailwindcss"),
|
|
159
|
+
url.includes("node_modules/@tailwindcss"),
|
|
160
|
+
url.includes("node_modules/uniwind")
|
|
161
|
+
].some(Boolean);
|
|
162
|
+
const generateCSSForThemes = async (themes, input) => {
|
|
163
|
+
const themesVariables = Object.fromEntries(themes.map((theme) => [theme, /* @__PURE__ */ new Set()]));
|
|
164
|
+
const findVariantsRec = async (cssPath) => {
|
|
165
|
+
const css = readFileSafe(cssPath);
|
|
166
|
+
if (css === null) {
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
const { dependencies } = lightningcss.transform({
|
|
170
|
+
code: Buffer.from(css),
|
|
171
|
+
filename: "uniwind.css",
|
|
172
|
+
analyzeDependencies: true,
|
|
173
|
+
visitor: {
|
|
174
|
+
Rule: (rule) => {
|
|
175
|
+
if (rule.type === "unknown" && rule.value.name === "variant") {
|
|
176
|
+
const [firstPrelude] = rule.value.prelude;
|
|
177
|
+
if (firstPrelude?.type !== "token" || firstPrelude.value.type !== "ident" || !themes.includes(firstPrelude.value.value)) {
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
const theme = firstPrelude.value.value;
|
|
181
|
+
rule.value.block?.forEach((block) => {
|
|
182
|
+
if (block.type === "dashed-ident") {
|
|
183
|
+
themesVariables[theme]?.add(block.value);
|
|
184
|
+
}
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
});
|
|
190
|
+
if (!Array.isArray(dependencies)) {
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
const importUrls = /* @__PURE__ */ new Set();
|
|
194
|
+
const importsCSS = dependencies.filter((dependency) => {
|
|
195
|
+
if (dependency.url.startsWith(".")) {
|
|
196
|
+
importUrls.add(path__default.resolve(path__default.dirname(cssPath), dependency.url));
|
|
197
|
+
return false;
|
|
198
|
+
}
|
|
199
|
+
return !isExcludedDependency(dependency.url);
|
|
200
|
+
}).map((dependency) => `@import "${dependency.url}";`).join("\n");
|
|
201
|
+
await node.compile(importsCSS, {
|
|
202
|
+
base: path__default.resolve(path__default.dirname(cssPath)),
|
|
203
|
+
onDependency: (dependency) => {
|
|
204
|
+
if (isExcludedDependency(dependency)) {
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
importUrls.add(dependency);
|
|
208
|
+
}
|
|
209
|
+
});
|
|
210
|
+
for (const filePath of importUrls) {
|
|
211
|
+
await findVariantsRec(filePath);
|
|
212
|
+
}
|
|
213
|
+
};
|
|
214
|
+
await findVariantsRec(input);
|
|
215
|
+
let hasErrors = false;
|
|
216
|
+
const hasVariables = Object.values(themesVariables).some((variables) => variables.size > 0);
|
|
217
|
+
Object.values(themesVariables).forEach((variables) => {
|
|
218
|
+
Object.entries(themesVariables).forEach(([checkedTheme, checkedVariables]) => {
|
|
219
|
+
variables.forEach((variable) => {
|
|
220
|
+
if (!checkedVariables.has(variable)) {
|
|
221
|
+
Logger.error(`Theme ${checkedTheme} is missing variable ${variable}`);
|
|
222
|
+
hasErrors = true;
|
|
223
|
+
}
|
|
224
|
+
});
|
|
225
|
+
});
|
|
226
|
+
});
|
|
227
|
+
if (hasErrors) {
|
|
228
|
+
Logger.error("All themes must have the same variables");
|
|
229
|
+
}
|
|
230
|
+
const variablesCSS = hasVariables ? [
|
|
231
|
+
"",
|
|
232
|
+
"@theme {",
|
|
233
|
+
...Array.from(Object.values(themesVariables).at(0) ?? []).map((variable) => ` ${variable}: unset;`),
|
|
234
|
+
"}"
|
|
235
|
+
] : [];
|
|
236
|
+
const uniwindCSS = [
|
|
237
|
+
...themes.map((theme) => `@custom-variant ${theme} (&:where(.${theme}, .${theme} *));`),
|
|
238
|
+
...variablesCSS
|
|
239
|
+
].join("\n");
|
|
240
|
+
return uniwindCSS;
|
|
241
|
+
};
|
|
242
|
+
|
|
243
|
+
const variants = ["ios", "android", "web", "native"];
|
|
244
|
+
const generateCSSForVariants = () => {
|
|
245
|
+
let css = "";
|
|
246
|
+
variants.forEach((variant) => {
|
|
247
|
+
css += `@custom-variant ${variant} (${variant === "web" ? "html &" : `@media ${variant}`});
|
|
248
|
+
`;
|
|
249
|
+
});
|
|
250
|
+
return css;
|
|
251
|
+
};
|
|
252
|
+
|
|
253
|
+
const dirname = typeof __dirname !== "undefined" ? __dirname : undefined;
|
|
254
|
+
const buildCSS = async (themes, input) => {
|
|
255
|
+
const variants = generateCSSForVariants();
|
|
256
|
+
const insets = generateCSSForInsets();
|
|
257
|
+
const themesCSS = await generateCSSForThemes(themes, input);
|
|
258
|
+
const cssFilePath = path__default.join(dirname, "../../uniwind.css");
|
|
259
|
+
const oldCSSFile = fs__default.existsSync(cssFilePath) ? fs__default.readFileSync(cssFilePath, "utf-8") : "";
|
|
260
|
+
const newCssFile = [
|
|
261
|
+
variants,
|
|
262
|
+
insets,
|
|
263
|
+
themesCSS
|
|
264
|
+
].join("\n");
|
|
265
|
+
if (oldCSSFile === newCssFile) {
|
|
266
|
+
return;
|
|
267
|
+
}
|
|
268
|
+
fs__default.writeFileSync(
|
|
269
|
+
cssFilePath,
|
|
270
|
+
newCssFile
|
|
271
|
+
);
|
|
272
|
+
};
|
|
273
|
+
|
|
274
|
+
const buildDtsFile = (dtsPath, stringifiedThemes) => {
|
|
275
|
+
const oldDtsContent = fs__default.existsSync(dtsPath) ? fs__default.readFileSync(dtsPath, "utf-8") : "";
|
|
276
|
+
const dtsContent = [
|
|
277
|
+
`// NOTE: This file is generated by ${common.name} and it should not be edited manually.`,
|
|
278
|
+
`/// <reference types="${common.name}/types" />`,
|
|
279
|
+
"",
|
|
280
|
+
`declare module '${common.name}' {`,
|
|
281
|
+
` export interface UniwindConfig {`,
|
|
282
|
+
` themes: readonly ${stringifiedThemes}`,
|
|
283
|
+
` }`,
|
|
284
|
+
`}`,
|
|
285
|
+
"",
|
|
286
|
+
`export {}`,
|
|
287
|
+
""
|
|
288
|
+
].join("\n");
|
|
289
|
+
if (oldDtsContent === dtsContent) {
|
|
290
|
+
return;
|
|
291
|
+
}
|
|
292
|
+
fs__default.writeFileSync(dtsPath, dtsContent);
|
|
293
|
+
};
|
|
294
|
+
|
|
295
|
+
const stringifyThemes = (themes = []) => `[${themes.map((theme) => `'${theme}'`).join(", ")}]`;
|
|
296
|
+
|
|
297
|
+
exports.Logger = Logger;
|
|
298
|
+
exports.buildCSS = buildCSS;
|
|
299
|
+
exports.buildDtsFile = buildDtsFile;
|
|
300
|
+
exports.processFunctions = processFunctions;
|
|
301
|
+
exports.stringifyThemes = stringifyThemes;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const node = require('@tailwindcss/node');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const common = require('../shared/uniwind.BgZDHdUR.cjs');
|
|
6
|
+
const stringifyThemes = require('../shared/uniwind.D_6s2EM-.cjs');
|
|
7
|
+
require('fs');
|
|
8
|
+
require('lightningcss');
|
|
9
|
+
|
|
10
|
+
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
|
|
11
|
+
|
|
12
|
+
const path__default = /*#__PURE__*/_interopDefaultCompat(path);
|
|
13
|
+
|
|
14
|
+
const dirname = typeof __dirname !== "undefined" ? __dirname : undefined;
|
|
15
|
+
const componentPath = path__default.resolve(
|
|
16
|
+
dirname,
|
|
17
|
+
"../module/components/web/index.js"
|
|
18
|
+
);
|
|
19
|
+
const uniwind = ({
|
|
20
|
+
cssEntryFile,
|
|
21
|
+
extraThemes,
|
|
22
|
+
dtsFile = "uniwind-types.d.ts"
|
|
23
|
+
}) => {
|
|
24
|
+
const themes = common.uniq([
|
|
25
|
+
"light",
|
|
26
|
+
"dark",
|
|
27
|
+
...extraThemes ?? []
|
|
28
|
+
]);
|
|
29
|
+
const stringifiedThemes = stringifyThemes.stringifyThemes(themes);
|
|
30
|
+
return {
|
|
31
|
+
name: "uniwind",
|
|
32
|
+
config: () => ({
|
|
33
|
+
css: {
|
|
34
|
+
transformer: "lightningcss",
|
|
35
|
+
lightningcss: {
|
|
36
|
+
visitor: {
|
|
37
|
+
Function: stringifyThemes.processFunctions
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
optimizeDeps: {
|
|
42
|
+
exclude: [common.name, "react-native"]
|
|
43
|
+
},
|
|
44
|
+
resolve: {
|
|
45
|
+
alias: [
|
|
46
|
+
{
|
|
47
|
+
find: /^react-native$/,
|
|
48
|
+
replacement: componentPath,
|
|
49
|
+
customResolver: {
|
|
50
|
+
resolveId(_, importer) {
|
|
51
|
+
if (importer !== void 0 && node.normalizePath(importer).includes(`${common.name}/dist`)) {
|
|
52
|
+
return this.resolve("react-native-web");
|
|
53
|
+
}
|
|
54
|
+
return componentPath;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
]
|
|
59
|
+
}
|
|
60
|
+
}),
|
|
61
|
+
transform: (code, id) => {
|
|
62
|
+
const normalizedId = node.normalizePath(id);
|
|
63
|
+
if (normalizedId.includes(`${common.name}/dist`) && normalizedId.includes("config/config.js")) {
|
|
64
|
+
return {
|
|
65
|
+
code: `${code}Uniwind.__reinit(() => ({}), ${stringifiedThemes})`
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
buildStart: async () => {
|
|
70
|
+
await stringifyThemes.buildCSS(themes, cssEntryFile);
|
|
71
|
+
stringifyThemes.buildDtsFile(dtsFile, stringifiedThemes);
|
|
72
|
+
},
|
|
73
|
+
generateBundle: async () => {
|
|
74
|
+
await stringifyThemes.buildCSS(themes, cssEntryFile);
|
|
75
|
+
stringifyThemes.buildDtsFile(dtsFile, stringifiedThemes);
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
exports.uniwind = uniwind;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { normalizePath } from '@tailwindcss/node';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import { u as uniq, n as name } from '../shared/uniwind.D3fvrgEG.mjs';
|
|
4
|
+
import { s as stringifyThemes, p as processFunctions, a as buildCSS, b as buildDtsFile } from '../shared/uniwind.Bt3kqZo6.mjs';
|
|
5
|
+
import 'fs';
|
|
6
|
+
import 'lightningcss';
|
|
7
|
+
|
|
8
|
+
const dirname = typeof __dirname !== "undefined" ? __dirname : import.meta.dirname;
|
|
9
|
+
const componentPath = path.resolve(
|
|
10
|
+
dirname,
|
|
11
|
+
"../module/components/web/index.js"
|
|
12
|
+
);
|
|
13
|
+
const uniwind = ({
|
|
14
|
+
cssEntryFile,
|
|
15
|
+
extraThemes,
|
|
16
|
+
dtsFile = "uniwind-types.d.ts"
|
|
17
|
+
}) => {
|
|
18
|
+
const themes = uniq([
|
|
19
|
+
"light",
|
|
20
|
+
"dark",
|
|
21
|
+
...extraThemes ?? []
|
|
22
|
+
]);
|
|
23
|
+
const stringifiedThemes = stringifyThemes(themes);
|
|
24
|
+
return {
|
|
25
|
+
name: "uniwind",
|
|
26
|
+
config: () => ({
|
|
27
|
+
css: {
|
|
28
|
+
transformer: "lightningcss",
|
|
29
|
+
lightningcss: {
|
|
30
|
+
visitor: {
|
|
31
|
+
Function: processFunctions
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
optimizeDeps: {
|
|
36
|
+
exclude: [name, "react-native"]
|
|
37
|
+
},
|
|
38
|
+
resolve: {
|
|
39
|
+
alias: [
|
|
40
|
+
{
|
|
41
|
+
find: /^react-native$/,
|
|
42
|
+
replacement: componentPath,
|
|
43
|
+
customResolver: {
|
|
44
|
+
resolveId(_, importer) {
|
|
45
|
+
if (importer !== void 0 && normalizePath(importer).includes(`${name}/dist`)) {
|
|
46
|
+
return this.resolve("react-native-web");
|
|
47
|
+
}
|
|
48
|
+
return componentPath;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
]
|
|
53
|
+
}
|
|
54
|
+
}),
|
|
55
|
+
transform: (code, id) => {
|
|
56
|
+
const normalizedId = normalizePath(id);
|
|
57
|
+
if (normalizedId.includes(`${name}/dist`) && normalizedId.includes("config/config.js")) {
|
|
58
|
+
return {
|
|
59
|
+
code: `${code}Uniwind.__reinit(() => ({}), ${stringifiedThemes})`
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
buildStart: async () => {
|
|
64
|
+
await buildCSS(themes, cssEntryFile);
|
|
65
|
+
buildDtsFile(dtsFile, stringifiedThemes);
|
|
66
|
+
},
|
|
67
|
+
generateBundle: async () => {
|
|
68
|
+
await buildCSS(themes, cssEntryFile);
|
|
69
|
+
buildDtsFile(dtsFile, stringifiedThemes);
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export { uniwind };
|
package/package.json
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
{
|
|
2
|
+
"private": false,
|
|
3
|
+
"name": "@niibase/uniwind",
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"description": "The fastest Tailwind bindings for React Native",
|
|
6
|
+
"homepage": "https://uniwind.dev",
|
|
7
|
+
"author": "Unistack",
|
|
8
|
+
"type": "module",
|
|
9
|
+
"repository": "https://github.com/divineniiquaye/uniwind",
|
|
10
|
+
"sideEffects": false,
|
|
11
|
+
"scripts": {
|
|
12
|
+
"precommit": "bun lint",
|
|
13
|
+
"build": "unbuild",
|
|
14
|
+
"check:typescript": "tsc --noEmit",
|
|
15
|
+
"lint": "eslint src",
|
|
16
|
+
"lint:fix": "eslint src --fix",
|
|
17
|
+
"format": "dprint fmt",
|
|
18
|
+
"prepublishOnly": "bun run build",
|
|
19
|
+
"circular:check": "dpdm --no-warning --no-tree -T --exit-code circular:1 'src/**/*.ts' 'src/**/*.tsx'",
|
|
20
|
+
"build:css": "bun run src/css/index.ts",
|
|
21
|
+
"test": "jest"
|
|
22
|
+
},
|
|
23
|
+
"keywords": [
|
|
24
|
+
"unistyles",
|
|
25
|
+
"react-native-unistyles",
|
|
26
|
+
"react-native",
|
|
27
|
+
"react",
|
|
28
|
+
"native",
|
|
29
|
+
"tailwind",
|
|
30
|
+
"tailwindcss",
|
|
31
|
+
"theme",
|
|
32
|
+
"style"
|
|
33
|
+
],
|
|
34
|
+
"license": "MIT",
|
|
35
|
+
"style": "./uniwind.css",
|
|
36
|
+
"source": "src/index",
|
|
37
|
+
"exports": {
|
|
38
|
+
".": {
|
|
39
|
+
"style": "./uniwind.css",
|
|
40
|
+
"types": "./dist/module/index.d.ts",
|
|
41
|
+
"react-native": "./src/index.ts",
|
|
42
|
+
"import": "./dist/module/index.js",
|
|
43
|
+
"default": "./dist/common/index.js"
|
|
44
|
+
},
|
|
45
|
+
"./components": {
|
|
46
|
+
"types": "./no-types.d.ts",
|
|
47
|
+
"default": "./src/components/index.ts"
|
|
48
|
+
},
|
|
49
|
+
"./components/*": {
|
|
50
|
+
"types": "./no-types.d.ts",
|
|
51
|
+
"react-native": "./src/components/native/*.tsx",
|
|
52
|
+
"import": "./dist/module/components/web/*.js",
|
|
53
|
+
"default": "./dist/common/components/web/*.js"
|
|
54
|
+
},
|
|
55
|
+
"./metro": {
|
|
56
|
+
"types": "./dist/metro/index.d.ts",
|
|
57
|
+
"import": "./dist/metro/index.mjs",
|
|
58
|
+
"default": "./dist/metro/index.cjs"
|
|
59
|
+
},
|
|
60
|
+
"./vite": {
|
|
61
|
+
"types": "./dist/vite/index.d.ts",
|
|
62
|
+
"import": "./dist/vite/index.mjs",
|
|
63
|
+
"default": "./dist/vite/index.cjs"
|
|
64
|
+
},
|
|
65
|
+
"./types": "./types.d.ts",
|
|
66
|
+
"./package.json": "./package.json"
|
|
67
|
+
},
|
|
68
|
+
"files": [
|
|
69
|
+
"src",
|
|
70
|
+
"dist",
|
|
71
|
+
"metro",
|
|
72
|
+
"vite",
|
|
73
|
+
"uniwind.css",
|
|
74
|
+
"types.d.ts",
|
|
75
|
+
"readme.md",
|
|
76
|
+
"LICENSE"
|
|
77
|
+
],
|
|
78
|
+
"dependencies": {
|
|
79
|
+
"@tailwindcss/node": "4.1.17",
|
|
80
|
+
"@tailwindcss/oxide": "4.1.17",
|
|
81
|
+
"culori": "4.0.2",
|
|
82
|
+
"lightningcss": "1.30.2"
|
|
83
|
+
},
|
|
84
|
+
"peerDependencies": {
|
|
85
|
+
"react": ">=19.0.0",
|
|
86
|
+
"react-native": ">=0.81.0",
|
|
87
|
+
"tailwindcss": ">=4"
|
|
88
|
+
},
|
|
89
|
+
"devDependencies": {
|
|
90
|
+
"@types/bun": "catalog:",
|
|
91
|
+
"@types/culori": "4.0.1",
|
|
92
|
+
"@types/react": "catalog:",
|
|
93
|
+
"typescript": "catalog:",
|
|
94
|
+
"metro": "0.83.3",
|
|
95
|
+
"dpdm": "3.14.0",
|
|
96
|
+
"unbuild": "3.6.1",
|
|
97
|
+
"vite": "7.2.7",
|
|
98
|
+
"jest": "30.2.0",
|
|
99
|
+
"react-test-renderer": "19.1.0",
|
|
100
|
+
"@react-native/babel-preset": "0.83.0",
|
|
101
|
+
"@testing-library/jest-native": "5.4.3",
|
|
102
|
+
"@testing-library/react-native": "13.3.3",
|
|
103
|
+
"prettier": "3.7.4",
|
|
104
|
+
"@types/jest": "30.0.0"
|
|
105
|
+
}
|
|
106
|
+
}
|