@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,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "TouchableNativeFeedback", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _reactNative.TouchableNativeFeedback;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
require("./rnw");
|
|
13
|
+
var _reactNative = require("react-native");
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
module.exports = exports.TouchableOpacity = void 0;
|
|
7
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
8
|
+
var _reactNative = require("react-native");
|
|
9
|
+
var _utils = require("../utils");
|
|
10
|
+
var _rnw = require("./rnw");
|
|
11
|
+
const TouchableOpacity = exports.TouchableOpacity = (0, _utils.copyComponentProperties)(_reactNative.TouchableOpacity, props => {
|
|
12
|
+
return /* @__PURE__ */(0, _jsxRuntime.jsx)(_reactNative.TouchableOpacity, {
|
|
13
|
+
...props,
|
|
14
|
+
style: [(0, _rnw.toRNWClassName)(props.className), props.style]
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
module.exports = TouchableOpacity;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
module.exports = exports.TouchableWithoutFeedback = void 0;
|
|
7
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
8
|
+
var _reactNative = require("react-native");
|
|
9
|
+
var _utils = require("../utils");
|
|
10
|
+
var _rnw = require("./rnw");
|
|
11
|
+
const TouchableWithoutFeedback = exports.TouchableWithoutFeedback = (0, _utils.copyComponentProperties)(_reactNative.TouchableWithoutFeedback, props => {
|
|
12
|
+
return /* @__PURE__ */(0, _jsxRuntime.jsx)(_reactNative.TouchableWithoutFeedback, {
|
|
13
|
+
...props,
|
|
14
|
+
style: [(0, _rnw.toRNWClassName)(props.className), props.style]
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
module.exports = TouchableWithoutFeedback;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
module.exports = exports.View = void 0;
|
|
7
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
8
|
+
var _reactNative = require("react-native");
|
|
9
|
+
var _utils = require("../utils");
|
|
10
|
+
var _rnw = require("./rnw");
|
|
11
|
+
const View = exports.View = (0, _utils.copyComponentProperties)(_reactNative.View, props => {
|
|
12
|
+
return /* @__PURE__ */(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
13
|
+
...props,
|
|
14
|
+
style: [(0, _rnw.toRNWClassName)(props.className), props.style]
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
module.exports = View;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
module.exports = exports.VirtualizedList = void 0;
|
|
7
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
8
|
+
var _reactNative = require("react-native");
|
|
9
|
+
var _utils = require("../utils");
|
|
10
|
+
var _rnw = require("./rnw");
|
|
11
|
+
const VirtualizedList = exports.VirtualizedList = (0, _utils.copyComponentProperties)(_reactNative.VirtualizedList, props => {
|
|
12
|
+
return /* @__PURE__ */(0, _jsxRuntime.jsx)(_reactNative.VirtualizedList, {
|
|
13
|
+
...props,
|
|
14
|
+
style: [(0, _rnw.toRNWClassName)(props.className), props.style],
|
|
15
|
+
contentContainerStyle: [(0, _rnw.toRNWClassName)(props.contentContainerClassName), props.contentContainerStyle],
|
|
16
|
+
ListFooterComponentStyle: [(0, _rnw.toRNWClassName)(props.ListFooterComponentClassName), props.ListFooterComponentStyle],
|
|
17
|
+
ListHeaderComponentStyle: [(0, _rnw.toRNWClassName)(props.ListHeaderComponentClassName), props.ListHeaderComponentStyle]
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
module.exports = VirtualizedList;
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _exportNames = {
|
|
7
|
+
ActivityIndicator: true,
|
|
8
|
+
Button: true,
|
|
9
|
+
FlatList: true,
|
|
10
|
+
Image: true,
|
|
11
|
+
ImageBackground: true,
|
|
12
|
+
KeyboardAvoidingView: true,
|
|
13
|
+
Modal: true,
|
|
14
|
+
Pressable: true,
|
|
15
|
+
RefreshControl: true,
|
|
16
|
+
SafeAreaView: true,
|
|
17
|
+
ScrollView: true,
|
|
18
|
+
SectionList: true,
|
|
19
|
+
Switch: true,
|
|
20
|
+
Text: true,
|
|
21
|
+
TextInput: true,
|
|
22
|
+
TouchableHighlight: true,
|
|
23
|
+
TouchableNativeFeedback: true,
|
|
24
|
+
TouchableOpacity: true,
|
|
25
|
+
TouchableWithoutFeedback: true,
|
|
26
|
+
View: true,
|
|
27
|
+
VirtualizedList: true
|
|
28
|
+
};
|
|
29
|
+
Object.defineProperty(exports, "ActivityIndicator", {
|
|
30
|
+
enumerable: true,
|
|
31
|
+
get: function () {
|
|
32
|
+
return _ActivityIndicator.ActivityIndicator;
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
Object.defineProperty(exports, "Button", {
|
|
36
|
+
enumerable: true,
|
|
37
|
+
get: function () {
|
|
38
|
+
return _Button.Button;
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
Object.defineProperty(exports, "FlatList", {
|
|
42
|
+
enumerable: true,
|
|
43
|
+
get: function () {
|
|
44
|
+
return _FlatList.FlatList;
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
Object.defineProperty(exports, "Image", {
|
|
48
|
+
enumerable: true,
|
|
49
|
+
get: function () {
|
|
50
|
+
return _Image.Image;
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
Object.defineProperty(exports, "ImageBackground", {
|
|
54
|
+
enumerable: true,
|
|
55
|
+
get: function () {
|
|
56
|
+
return _ImageBackground.ImageBackground;
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
Object.defineProperty(exports, "KeyboardAvoidingView", {
|
|
60
|
+
enumerable: true,
|
|
61
|
+
get: function () {
|
|
62
|
+
return _KeyboardAvoidingView.KeyboardAvoidingView;
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
Object.defineProperty(exports, "Modal", {
|
|
66
|
+
enumerable: true,
|
|
67
|
+
get: function () {
|
|
68
|
+
return _Modal.Modal;
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
Object.defineProperty(exports, "Pressable", {
|
|
72
|
+
enumerable: true,
|
|
73
|
+
get: function () {
|
|
74
|
+
return _Pressable.Pressable;
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
Object.defineProperty(exports, "RefreshControl", {
|
|
78
|
+
enumerable: true,
|
|
79
|
+
get: function () {
|
|
80
|
+
return _RefreshControl.RefreshControl;
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
Object.defineProperty(exports, "SafeAreaView", {
|
|
84
|
+
enumerable: true,
|
|
85
|
+
get: function () {
|
|
86
|
+
return _SafeAreaView.SafeAreaView;
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
Object.defineProperty(exports, "ScrollView", {
|
|
90
|
+
enumerable: true,
|
|
91
|
+
get: function () {
|
|
92
|
+
return _ScrollView.ScrollView;
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
Object.defineProperty(exports, "SectionList", {
|
|
96
|
+
enumerable: true,
|
|
97
|
+
get: function () {
|
|
98
|
+
return _SectionList.SectionList;
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
Object.defineProperty(exports, "Switch", {
|
|
102
|
+
enumerable: true,
|
|
103
|
+
get: function () {
|
|
104
|
+
return _Switch.Switch;
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
Object.defineProperty(exports, "Text", {
|
|
108
|
+
enumerable: true,
|
|
109
|
+
get: function () {
|
|
110
|
+
return _Text.Text;
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
Object.defineProperty(exports, "TextInput", {
|
|
114
|
+
enumerable: true,
|
|
115
|
+
get: function () {
|
|
116
|
+
return _TextInput.TextInput;
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
Object.defineProperty(exports, "TouchableHighlight", {
|
|
120
|
+
enumerable: true,
|
|
121
|
+
get: function () {
|
|
122
|
+
return _TouchableHighlight.TouchableHighlight;
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
Object.defineProperty(exports, "TouchableNativeFeedback", {
|
|
126
|
+
enumerable: true,
|
|
127
|
+
get: function () {
|
|
128
|
+
return _TouchableNativeFeedback.TouchableNativeFeedback;
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
Object.defineProperty(exports, "TouchableOpacity", {
|
|
132
|
+
enumerable: true,
|
|
133
|
+
get: function () {
|
|
134
|
+
return _TouchableOpacity.TouchableOpacity;
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
Object.defineProperty(exports, "TouchableWithoutFeedback", {
|
|
138
|
+
enumerable: true,
|
|
139
|
+
get: function () {
|
|
140
|
+
return _TouchableWithoutFeedback.TouchableWithoutFeedback;
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
Object.defineProperty(exports, "View", {
|
|
144
|
+
enumerable: true,
|
|
145
|
+
get: function () {
|
|
146
|
+
return _View.View;
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
Object.defineProperty(exports, "VirtualizedList", {
|
|
150
|
+
enumerable: true,
|
|
151
|
+
get: function () {
|
|
152
|
+
return _VirtualizedList.VirtualizedList;
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
var _reactNative = require("react-native");
|
|
156
|
+
Object.keys(_reactNative).forEach(function (key) {
|
|
157
|
+
if (key === "default" || key === "__esModule") return;
|
|
158
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
159
|
+
if (key in exports && exports[key] === _reactNative[key]) return;
|
|
160
|
+
Object.defineProperty(exports, key, {
|
|
161
|
+
enumerable: true,
|
|
162
|
+
get: function () {
|
|
163
|
+
return _reactNative[key];
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
});
|
|
167
|
+
var _ActivityIndicator = require("./ActivityIndicator");
|
|
168
|
+
var _Button = require("./Button");
|
|
169
|
+
var _FlatList = require("./FlatList");
|
|
170
|
+
var _Image = require("./Image");
|
|
171
|
+
var _ImageBackground = require("./ImageBackground");
|
|
172
|
+
var _KeyboardAvoidingView = require("./KeyboardAvoidingView");
|
|
173
|
+
var _Modal = require("./Modal");
|
|
174
|
+
var _Pressable = require("./Pressable");
|
|
175
|
+
var _RefreshControl = require("./RefreshControl");
|
|
176
|
+
var _SafeAreaView = require("./SafeAreaView");
|
|
177
|
+
var _ScrollView = require("./ScrollView");
|
|
178
|
+
var _SectionList = require("./SectionList");
|
|
179
|
+
var _Switch = require("./Switch");
|
|
180
|
+
var _Text = require("./Text");
|
|
181
|
+
var _TextInput = require("./TextInput");
|
|
182
|
+
var _TouchableHighlight = require("./TouchableHighlight");
|
|
183
|
+
var _TouchableNativeFeedback = require("./TouchableNativeFeedback");
|
|
184
|
+
var _TouchableOpacity = require("./TouchableOpacity");
|
|
185
|
+
var _TouchableWithoutFeedback = require("./TouchableWithoutFeedback");
|
|
186
|
+
var _View = require("./View");
|
|
187
|
+
var _VirtualizedList = require("./VirtualizedList");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.toRNWClassName = void 0;
|
|
7
|
+
var _core = require("../../core");
|
|
8
|
+
var _listener = require("../../core/listener");
|
|
9
|
+
var _types = require("../../types");
|
|
10
|
+
require("./metro-injected");
|
|
11
|
+
const moveCssRulesToUtilitiesLayer = sourceSheet => {
|
|
12
|
+
const layerRuleIndex = sourceSheet.insertRule("@layer rnw {}", 0);
|
|
13
|
+
const layerRule = sourceSheet.cssRules[layerRuleIndex];
|
|
14
|
+
while (sourceSheet.cssRules.length > 1) {
|
|
15
|
+
const nextRule = sourceSheet.cssRules[1];
|
|
16
|
+
layerRule.insertRule(nextRule.cssText, layerRule.cssRules.length);
|
|
17
|
+
sourceSheet.deleteRule(1);
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
if (typeof window !== "undefined" && typeof document !== "undefined") {
|
|
21
|
+
const rnwStyleSheet = document.querySelector("#react-native-stylesheet");
|
|
22
|
+
if (rnwStyleSheet?.sheet) {
|
|
23
|
+
moveCssRulesToUtilitiesLayer(rnwStyleSheet.sheet);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
const addClassNameToRoot = () => {
|
|
27
|
+
if (typeof document === "undefined") {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
const root = document.documentElement;
|
|
31
|
+
_core.Uniwind.themes.forEach(theme => root.classList.remove(theme));
|
|
32
|
+
root.classList.add(_core.Uniwind.currentTheme);
|
|
33
|
+
};
|
|
34
|
+
_listener.UniwindListener.subscribe(() => {
|
|
35
|
+
addClassNameToRoot();
|
|
36
|
+
}, [_types.StyleDependency.Theme]);
|
|
37
|
+
addClassNameToRoot();
|
|
38
|
+
const toRNWClassName = className => className !== void 0 ? {
|
|
39
|
+
$$css: true,
|
|
40
|
+
tailwind: className
|
|
41
|
+
} : {};
|
|
42
|
+
exports.toRNWClassName = toRNWClassName;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.UniwindConfigBuilder = exports.Uniwind = void 0;
|
|
7
|
+
var _reactNative = require("react-native");
|
|
8
|
+
var _types = require("../../types");
|
|
9
|
+
var _listener = require("../listener");
|
|
10
|
+
const SYSTEM_THEME = "system";
|
|
11
|
+
class UniwindConfigBuilder {
|
|
12
|
+
themes = ["light", "dark"];
|
|
13
|
+
#hasAdaptiveThemes = true;
|
|
14
|
+
#currentTheme = this.colorScheme;
|
|
15
|
+
constructor() {
|
|
16
|
+
_reactNative.Appearance.addChangeListener(event => {
|
|
17
|
+
const colorScheme = event.colorScheme ?? _types.ColorScheme.Light;
|
|
18
|
+
const prevTheme = this.#currentTheme;
|
|
19
|
+
if (this.#hasAdaptiveThemes && prevTheme !== colorScheme) {
|
|
20
|
+
this.#currentTheme = colorScheme;
|
|
21
|
+
this.onThemeChange();
|
|
22
|
+
_listener.UniwindListener.notify([_types.StyleDependency.Theme]);
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
get hasAdaptiveThemes() {
|
|
27
|
+
return this.#hasAdaptiveThemes;
|
|
28
|
+
}
|
|
29
|
+
get currentTheme() {
|
|
30
|
+
return this.#currentTheme;
|
|
31
|
+
}
|
|
32
|
+
get colorScheme() {
|
|
33
|
+
return _reactNative.Appearance.getColorScheme() ?? _types.ColorScheme.Light;
|
|
34
|
+
}
|
|
35
|
+
// eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents
|
|
36
|
+
setTheme(theme) {
|
|
37
|
+
const prevTheme = this.#currentTheme;
|
|
38
|
+
const prevHasAdaptiveThemes = this.#hasAdaptiveThemes;
|
|
39
|
+
const isAdaptiveTheme = ["light", "dark"].includes(theme);
|
|
40
|
+
try {
|
|
41
|
+
if (theme === SYSTEM_THEME) {
|
|
42
|
+
this.#hasAdaptiveThemes = true;
|
|
43
|
+
this.#currentTheme = this.colorScheme;
|
|
44
|
+
if (_reactNative.Platform.OS !== "web") {
|
|
45
|
+
_reactNative.Appearance.setColorScheme(void 0);
|
|
46
|
+
}
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
if (!this.themes.includes(theme)) {
|
|
50
|
+
throw new Error(`Uniwind: You're trying to setTheme to '${theme}', but it was not registered.`);
|
|
51
|
+
}
|
|
52
|
+
this.#hasAdaptiveThemes = false;
|
|
53
|
+
this.#currentTheme = theme;
|
|
54
|
+
if (_reactNative.Platform.OS !== "web") {
|
|
55
|
+
_reactNative.Appearance.setColorScheme(isAdaptiveTheme ? this.#currentTheme : void 0);
|
|
56
|
+
}
|
|
57
|
+
} finally {
|
|
58
|
+
if (prevTheme !== this.#currentTheme) {
|
|
59
|
+
this.onThemeChange();
|
|
60
|
+
_listener.UniwindListener.notify([_types.StyleDependency.Theme]);
|
|
61
|
+
}
|
|
62
|
+
if (prevHasAdaptiveThemes !== this.#hasAdaptiveThemes) {
|
|
63
|
+
_listener.UniwindListener.notify([_types.StyleDependency.AdaptiveThemes]);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
updateCSSVariables(theme, variables) {
|
|
68
|
+
theme;
|
|
69
|
+
variables;
|
|
70
|
+
}
|
|
71
|
+
updateInsets(insets) {
|
|
72
|
+
insets;
|
|
73
|
+
}
|
|
74
|
+
__reinit(_, themes) {
|
|
75
|
+
this.themes = themes;
|
|
76
|
+
}
|
|
77
|
+
onThemeChange() {}
|
|
78
|
+
}
|
|
79
|
+
exports.UniwindConfigBuilder = UniwindConfigBuilder;
|
|
80
|
+
const Uniwind = exports.Uniwind = new UniwindConfigBuilder();
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Uniwind = void 0;
|
|
7
|
+
var _types = require("../../types");
|
|
8
|
+
var _listener = require("../listener");
|
|
9
|
+
var _logger = require("../logger");
|
|
10
|
+
var _config = require("./config.common");
|
|
11
|
+
class UniwindConfigBuilder extends _config.UniwindConfigBuilder {
|
|
12
|
+
runtimeCSSVariables = /* @__PURE__ */new Map();
|
|
13
|
+
constructor() {
|
|
14
|
+
super();
|
|
15
|
+
}
|
|
16
|
+
onThemeChange() {
|
|
17
|
+
if (typeof document === "undefined") {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
document.documentElement.removeAttribute("style");
|
|
21
|
+
const runtimeCSSVariables = this.runtimeCSSVariables.get(this.currentTheme);
|
|
22
|
+
if (!runtimeCSSVariables) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
Object.entries(runtimeCSSVariables).forEach(([varName, varValue]) => {
|
|
26
|
+
this.applyCSSVariable(varName, varValue);
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
updateCSSVariables(theme, variables) {
|
|
30
|
+
Object.entries(variables).forEach(([varName, varValue]) => {
|
|
31
|
+
if (!varName.startsWith("--") && __DEV__) {
|
|
32
|
+
_logger.Logger.error(`CSS variable name must start with "--", instead got: ${varName}`);
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
const runtimeCSSVariables = this.runtimeCSSVariables.get(theme) ?? {};
|
|
36
|
+
runtimeCSSVariables[varName] = varValue;
|
|
37
|
+
this.runtimeCSSVariables.set(theme, runtimeCSSVariables);
|
|
38
|
+
this.applyCSSVariable(varName, varValue);
|
|
39
|
+
});
|
|
40
|
+
if (theme === this.currentTheme) {
|
|
41
|
+
_listener.UniwindListener.notify([_types.StyleDependency.Variables]);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
applyCSSVariable(varName, varValue) {
|
|
45
|
+
if (typeof document === "undefined") {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
document.documentElement.style.setProperty(varName, typeof varValue === "number" ? `${varValue}px` : varValue);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
const Uniwind = exports.Uniwind = new UniwindConfigBuilder();
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Uniwind = void 0;
|
|
7
|
+
var _culori = require("culori");
|
|
8
|
+
var _types = require("../../types");
|
|
9
|
+
var _listener = require("../listener");
|
|
10
|
+
var _logger = require("../logger");
|
|
11
|
+
var _native = require("../native");
|
|
12
|
+
var _config = require("./config.common");
|
|
13
|
+
class UniwindConfigBuilder extends _config.UniwindConfigBuilder {
|
|
14
|
+
constructor() {
|
|
15
|
+
super();
|
|
16
|
+
}
|
|
17
|
+
__reinit(generateStyleSheetCallback, themes) {
|
|
18
|
+
super.__reinit(generateStyleSheetCallback, themes);
|
|
19
|
+
_native.UniwindStore.reinit(generateStyleSheetCallback);
|
|
20
|
+
}
|
|
21
|
+
onThemeChange() {
|
|
22
|
+
_native.UniwindStore.runtime.currentThemeName = this.currentTheme;
|
|
23
|
+
_native.UniwindStore.reinit();
|
|
24
|
+
}
|
|
25
|
+
updateCSSVariables(theme, variables) {
|
|
26
|
+
Object.entries(variables).forEach(([varName, varValue]) => {
|
|
27
|
+
if (!varName.startsWith("--") && __DEV__) {
|
|
28
|
+
_logger.Logger.error(`CSS variable name must start with "--", instead got: ${varName}`);
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
const getValue = () => {
|
|
32
|
+
if (typeof varValue === "number") {
|
|
33
|
+
return varValue;
|
|
34
|
+
}
|
|
35
|
+
const parsedColor = (0, _culori.parse)(varValue);
|
|
36
|
+
if (parsedColor) {
|
|
37
|
+
return parsedColor.alpha === void 0 || parsedColor.alpha === 1 ? (0, _culori.formatHex)(parsedColor) : (0, _culori.formatHex8)(parsedColor);
|
|
38
|
+
}
|
|
39
|
+
return varValue;
|
|
40
|
+
};
|
|
41
|
+
const value = getValue();
|
|
42
|
+
const runtimeThemeVariables = _native.UniwindStore.runtimeThemeVariables.get(theme) ?? {};
|
|
43
|
+
Object.defineProperty(_native.UniwindStore.vars, varName, {
|
|
44
|
+
configurable: true,
|
|
45
|
+
enumerable: true,
|
|
46
|
+
get: () => value
|
|
47
|
+
});
|
|
48
|
+
Object.defineProperty(runtimeThemeVariables, varName, {
|
|
49
|
+
configurable: true,
|
|
50
|
+
enumerable: true,
|
|
51
|
+
get: () => value
|
|
52
|
+
});
|
|
53
|
+
_native.UniwindStore.runtimeThemeVariables.set(theme, runtimeThemeVariables);
|
|
54
|
+
});
|
|
55
|
+
if (theme === this.currentTheme) {
|
|
56
|
+
_listener.UniwindListener.notify([_types.StyleDependency.Variables]);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
updateInsets(insets) {
|
|
60
|
+
_native.UniwindStore.runtime.insets.bottom = insets.bottom ?? 0;
|
|
61
|
+
_native.UniwindStore.runtime.insets.top = insets.top ?? 0;
|
|
62
|
+
_native.UniwindStore.runtime.insets.left = insets.left ?? 0;
|
|
63
|
+
_native.UniwindStore.runtime.insets.right = insets.right ?? 0;
|
|
64
|
+
_listener.UniwindListener.notify([_types.StyleDependency.Insets]);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
const Uniwind = exports.Uniwind = new UniwindConfigBuilder();
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _config = require("./config");
|
|
7
|
+
Object.keys(_config).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _config[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _config[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _config = require("./config");
|
|
7
|
+
Object.keys(_config).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _config[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _config[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.UniwindListener = void 0;
|
|
7
|
+
var _types = require("../types");
|
|
8
|
+
class UniwindListenerBuilder {
|
|
9
|
+
listeners = {
|
|
10
|
+
[_types.StyleDependency.ColorScheme]: /* @__PURE__ */new Set(),
|
|
11
|
+
[_types.StyleDependency.Theme]: /* @__PURE__ */new Set(),
|
|
12
|
+
[_types.StyleDependency.Dimensions]: /* @__PURE__ */new Set(),
|
|
13
|
+
[_types.StyleDependency.Orientation]: /* @__PURE__ */new Set(),
|
|
14
|
+
[_types.StyleDependency.Insets]: /* @__PURE__ */new Set(),
|
|
15
|
+
[_types.StyleDependency.FontScale]: /* @__PURE__ */new Set(),
|
|
16
|
+
[_types.StyleDependency.Rtl]: /* @__PURE__ */new Set(),
|
|
17
|
+
[_types.StyleDependency.AdaptiveThemes]: /* @__PURE__ */new Set(),
|
|
18
|
+
[_types.StyleDependency.Variables]: /* @__PURE__ */new Set()
|
|
19
|
+
};
|
|
20
|
+
notify(dependencies) {
|
|
21
|
+
dependencies.forEach(dep => {
|
|
22
|
+
this.listeners[dep].forEach(callback => callback());
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
notifyAll() {
|
|
26
|
+
Object.values(this.listeners).forEach(listenerSet => {
|
|
27
|
+
listenerSet.forEach(callback => callback());
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
subscribe(listener, dependencies, options) {
|
|
31
|
+
const wrappedListeners = /* @__PURE__ */new Map();
|
|
32
|
+
const dispose = () => {
|
|
33
|
+
wrappedListeners.forEach((wrappedListener, dep) => {
|
|
34
|
+
this.listeners[dep].delete(wrappedListener);
|
|
35
|
+
});
|
|
36
|
+
wrappedListeners.clear();
|
|
37
|
+
};
|
|
38
|
+
dependencies.forEach(dep => {
|
|
39
|
+
const wrappedListener = () => {
|
|
40
|
+
listener();
|
|
41
|
+
if (options?.once) {
|
|
42
|
+
dispose();
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
wrappedListeners.set(dep, wrappedListener);
|
|
46
|
+
this.listeners[dep].add(wrappedListener);
|
|
47
|
+
});
|
|
48
|
+
return dispose;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
const UniwindListener = exports.UniwindListener = new UniwindListenerBuilder();
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Logger = void 0;
|
|
7
|
+
class Logger {
|
|
8
|
+
static log(message) {
|
|
9
|
+
console.log(`Uniwind - ${message}`);
|
|
10
|
+
}
|
|
11
|
+
static error(message) {
|
|
12
|
+
console.error(`Uniwind - ${message}`);
|
|
13
|
+
}
|
|
14
|
+
static warn(message) {
|
|
15
|
+
console.warn(`Uniwind - ${message}`);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.Logger = Logger;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _runtime = require("./runtime");
|
|
7
|
+
Object.keys(_runtime).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _runtime[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _runtime[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
var _store = require("./store");
|
|
18
|
+
Object.keys(_store).forEach(function (key) {
|
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
|
20
|
+
if (key in exports && exports[key] === _store[key]) return;
|
|
21
|
+
Object.defineProperty(exports, key, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () {
|
|
24
|
+
return _store[key];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|