@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,199 @@
|
|
|
1
|
+
import { CalcFor_DimensionPercentageFor_LengthValue, CalcFor_Length, CssColor, Function as FunctionType } from 'lightningcss'
|
|
2
|
+
import { Logger } from '../logger'
|
|
3
|
+
import { pipe } from '../utils'
|
|
4
|
+
import type { ProcessorBuilder } from './processor'
|
|
5
|
+
|
|
6
|
+
export class Functions {
|
|
7
|
+
private readonly logger = new Logger('Functions')
|
|
8
|
+
|
|
9
|
+
constructor(private readonly Processor: ProcessorBuilder) {}
|
|
10
|
+
|
|
11
|
+
processCalc(calc: CalcFor_DimensionPercentageFor_LengthValue | CalcFor_Length): string {
|
|
12
|
+
switch (calc.type) {
|
|
13
|
+
case 'sum': {
|
|
14
|
+
const sum = calc.value.map(x => this.processCalc(x)).join(' + ')
|
|
15
|
+
|
|
16
|
+
return this.tryEval(sum)
|
|
17
|
+
}
|
|
18
|
+
case 'value':
|
|
19
|
+
return this.Processor.CSS.processValue(calc.value)
|
|
20
|
+
case 'function':
|
|
21
|
+
return this.Processor.CSS.processValue(calc.value)
|
|
22
|
+
case 'number':
|
|
23
|
+
return String(calc.value)
|
|
24
|
+
default:
|
|
25
|
+
this.logger.warn(`Unsupported calc type - ${calc.type}`)
|
|
26
|
+
|
|
27
|
+
return ''
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
processFunction(fn: string | FunctionType) {
|
|
32
|
+
if (typeof fn !== 'object') {
|
|
33
|
+
this.logger.warn(`Unsupported function - ${fn}`)
|
|
34
|
+
|
|
35
|
+
return fn
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if (fn.name === 'calc') {
|
|
39
|
+
const calc = this.Processor.CSS.processValue(fn.arguments)
|
|
40
|
+
|
|
41
|
+
return pipe(calc)(
|
|
42
|
+
String,
|
|
43
|
+
x => this.Processor.Functions.tryEval(x),
|
|
44
|
+
)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if (fn.name === 'cubic-bezier') {
|
|
48
|
+
const cubicArguments = pipe(this.Processor.CSS.processValue(fn.arguments))(
|
|
49
|
+
String,
|
|
50
|
+
x => x.replace(/,\s/g, ','),
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
return `rt.cubicBezier(${cubicArguments})`
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (fn.name === 'max') {
|
|
57
|
+
return `Math.max(${this.Processor.CSS.processValue(fn.arguments)})`
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if (fn.name === 'linear-gradient') {
|
|
61
|
+
return this.Processor.CSS.processValue(fn.arguments)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (fn.name === 'color-mix') {
|
|
65
|
+
return this.processColorMix(fn)
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if (
|
|
69
|
+
[
|
|
70
|
+
'rgb',
|
|
71
|
+
'oklab',
|
|
72
|
+
'oklch',
|
|
73
|
+
'hsl',
|
|
74
|
+
'hwb',
|
|
75
|
+
'lab',
|
|
76
|
+
'lch',
|
|
77
|
+
'srgb',
|
|
78
|
+
].includes(fn.name)
|
|
79
|
+
) {
|
|
80
|
+
const color = `${fn.name}(${this.Processor.CSS.processValue(fn.arguments)})`
|
|
81
|
+
|
|
82
|
+
return this.Processor.Color.processColor(color as CssColor)
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if (
|
|
86
|
+
[
|
|
87
|
+
'blur',
|
|
88
|
+
'brightness',
|
|
89
|
+
'contrast',
|
|
90
|
+
'grayscale',
|
|
91
|
+
'hue-rotate',
|
|
92
|
+
'invert',
|
|
93
|
+
'opacity',
|
|
94
|
+
'saturate',
|
|
95
|
+
'sepia',
|
|
96
|
+
'conic-gradient',
|
|
97
|
+
'radial-gradient',
|
|
98
|
+
].includes(fn.name)
|
|
99
|
+
) {
|
|
100
|
+
// Not supported by RN
|
|
101
|
+
return '""'
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
if (['skewX', 'skewY'].includes(fn.name)) {
|
|
105
|
+
return `"${fn.name}(${this.Processor.CSS.processValue(fn.arguments).replace(/"/g, '')})"`
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
if (fn.name === 'hairlineWidth') {
|
|
109
|
+
return 'rt.hairlineWidth'
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
if (fn.name === 'pixelRatio') {
|
|
113
|
+
return `rt.pixelRatio(${this.Processor.CSS.processValue(fn.arguments)})`
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
if (fn.name === 'fontScale') {
|
|
117
|
+
return `rt.fontScale(${this.Processor.CSS.processValue(fn.arguments)})`
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
if (fn.name === 'drop-shadow') {
|
|
121
|
+
return undefined
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
this.logger.warn(`Unsupported function - ${fn.name}`)
|
|
125
|
+
|
|
126
|
+
return fn.name
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
processMathFunction(
|
|
130
|
+
name: string,
|
|
131
|
+
value:
|
|
132
|
+
| Array<CalcFor_DimensionPercentageFor_LengthValue>
|
|
133
|
+
| Array<CalcFor_Length>
|
|
134
|
+
| CalcFor_DimensionPercentageFor_LengthValue
|
|
135
|
+
| CalcFor_Length,
|
|
136
|
+
) {
|
|
137
|
+
if (!Array.isArray(value)) {
|
|
138
|
+
return `Math.${name}(${this.processCalc(value)})`
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
const values = value.map(x => this.processCalc(x)).join(' , ')
|
|
142
|
+
|
|
143
|
+
return `Math.${name}(${values})`
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
private tryEval(value: string) {
|
|
147
|
+
// Match units like %, deg, rad, grad, turn that are not preceded by letters or hyphens
|
|
148
|
+
const units = Array.from(
|
|
149
|
+
value
|
|
150
|
+
.replace(/"/g, '')
|
|
151
|
+
.match(/(?<![A-Za-z-])(?:%|deg|rad|grad|turn)(?=\s|$)/g) ?? [],
|
|
152
|
+
)
|
|
153
|
+
|
|
154
|
+
if (units.length === 0) {
|
|
155
|
+
return value
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
if (new Set(units).size !== 1) {
|
|
159
|
+
this.logger.error(`Invalid calc, you can't mix multiple units`)
|
|
160
|
+
|
|
161
|
+
return value
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
if (units.includes('%') && value.includes('+')) {
|
|
165
|
+
this.logger.error(`Invalid calc, you can't mix % with other units`)
|
|
166
|
+
|
|
167
|
+
return value
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
const unit = units.at(0) ?? ''
|
|
171
|
+
|
|
172
|
+
try {
|
|
173
|
+
const numericValue = value
|
|
174
|
+
.replace(/"/g, '')
|
|
175
|
+
.replace(new RegExp(unit, 'g'), '')
|
|
176
|
+
|
|
177
|
+
// eslint-disable-next-line @typescript-eslint/no-implied-eval, no-new-func
|
|
178
|
+
return new Function(`return ${numericValue} + '${unit}'`)()
|
|
179
|
+
} catch {
|
|
180
|
+
this.logger.error(`Invalid calc ${value}`)
|
|
181
|
+
|
|
182
|
+
return value
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
private processColorMix(fn: FunctionType) {
|
|
187
|
+
const tokens = fn.arguments
|
|
188
|
+
.map(arg =>
|
|
189
|
+
pipe(arg)(
|
|
190
|
+
x => this.Processor.CSS.processValue(x),
|
|
191
|
+
String,
|
|
192
|
+
x => x.trim(),
|
|
193
|
+
)
|
|
194
|
+
)
|
|
195
|
+
.filter(token => !['', ',', 'in', 'srgb', 'rgb', 'hsl', 'hwb', 'lab', 'lch', 'oklab', 'oklch'].includes(token.replace(/"/g, '')))
|
|
196
|
+
|
|
197
|
+
return `rt.colorMix(${tokens.join(', ')})`
|
|
198
|
+
}
|
|
199
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './processor'
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { MediaQuery, QueryFeatureFor_MediaFeatureId } from 'lightningcss'
|
|
2
|
+
import { ColorScheme, Orientation } from '../../types'
|
|
3
|
+
import { MediaQueryResolver, Platform } from '../types'
|
|
4
|
+
import type { ProcessorBuilder } from './processor'
|
|
5
|
+
|
|
6
|
+
export class MQ {
|
|
7
|
+
constructor(private readonly Processor: ProcessorBuilder) {}
|
|
8
|
+
|
|
9
|
+
processMediaQueries(mediaQueries: Array<MediaQuery>) {
|
|
10
|
+
const mq = this.getInitialMediaQueryResolver()
|
|
11
|
+
|
|
12
|
+
mediaQueries.forEach(mediaQuery => {
|
|
13
|
+
const { condition, mediaType } = mediaQuery
|
|
14
|
+
|
|
15
|
+
if ([Platform.Android, Platform.iOS, Platform.Native].includes(mediaType as Platform)) {
|
|
16
|
+
mq.platform = mediaType as Platform
|
|
17
|
+
|
|
18
|
+
return
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
if (condition?.type !== 'feature') {
|
|
22
|
+
return
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
if (condition.value.type === 'range') {
|
|
26
|
+
this.processWidthMediaQuery(condition.value, mq)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (condition.value.type === 'plain') {
|
|
30
|
+
this.processPlainMediaQuery(condition.value, mq)
|
|
31
|
+
}
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
return mq
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
private processWidthMediaQuery(query: QueryFeatureFor_MediaFeatureId & { type: 'range' }, mq: MediaQueryResolver) {
|
|
38
|
+
const { operator, value } = query
|
|
39
|
+
const result = this.Processor.CSS.processValue(value)
|
|
40
|
+
|
|
41
|
+
if (operator === 'greater-than-equal' || operator === 'greater-than') {
|
|
42
|
+
mq.minWidth = result
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
if (operator === 'less-than-equal' || operator === 'less-than') {
|
|
46
|
+
mq.maxWidth = result
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
private processPlainMediaQuery(query: QueryFeatureFor_MediaFeatureId & { type: 'plain' }, mq: MediaQueryResolver) {
|
|
51
|
+
const { value, name } = query
|
|
52
|
+
|
|
53
|
+
switch (name) {
|
|
54
|
+
case 'orientation':
|
|
55
|
+
mq.orientation = value.value as Orientation
|
|
56
|
+
|
|
57
|
+
break
|
|
58
|
+
case 'prefers-color-scheme':
|
|
59
|
+
mq.colorScheme = value.value as ColorScheme
|
|
60
|
+
|
|
61
|
+
break
|
|
62
|
+
default:
|
|
63
|
+
break
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
private getInitialMediaQueryResolver(): MediaQueryResolver {
|
|
68
|
+
return {
|
|
69
|
+
minWidth: 0,
|
|
70
|
+
maxWidth: Number.MAX_VALUE,
|
|
71
|
+
platform: null,
|
|
72
|
+
rtl: null,
|
|
73
|
+
important: false,
|
|
74
|
+
colorScheme: null,
|
|
75
|
+
orientation: null,
|
|
76
|
+
theme: null,
|
|
77
|
+
active: null,
|
|
78
|
+
focus: null,
|
|
79
|
+
disabled: null,
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
import { Declaration, MediaQuery, Rule, transform } from 'lightningcss'
|
|
2
|
+
import { Polyfills, ProcessMetaValues } from '../types'
|
|
3
|
+
import { Color } from './color'
|
|
4
|
+
import { CSS } from './css'
|
|
5
|
+
import { Functions } from './functions'
|
|
6
|
+
import { MQ } from './mq'
|
|
7
|
+
import { RN } from './rn'
|
|
8
|
+
import { Units } from './units'
|
|
9
|
+
import { Var } from './var'
|
|
10
|
+
|
|
11
|
+
export class ProcessorBuilder {
|
|
12
|
+
stylesheets = {} as Record<string, Array<any>>
|
|
13
|
+
vars = {} as Record<string, any>
|
|
14
|
+
scopedVars = {} as Record<string, Record<string, any>>
|
|
15
|
+
CSS = new CSS(this)
|
|
16
|
+
RN = new RN(this)
|
|
17
|
+
Var = new Var(this)
|
|
18
|
+
MQ = new MQ(this)
|
|
19
|
+
Color = new Color(this)
|
|
20
|
+
Units = new Units(this)
|
|
21
|
+
Functions = new Functions(this)
|
|
22
|
+
meta = {} as ProcessMetaValues
|
|
23
|
+
|
|
24
|
+
private declarationConfig = this.getDeclarationConfig()
|
|
25
|
+
|
|
26
|
+
constructor(private readonly themes: Array<string>, readonly polyfills: Polyfills | undefined) {
|
|
27
|
+
this.vars['--uniwind-em'] = polyfills?.rem ?? 16
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
transform(css: string) {
|
|
31
|
+
transform({
|
|
32
|
+
filename: 'tailwind.css',
|
|
33
|
+
code: Buffer.from(css),
|
|
34
|
+
visitor: {
|
|
35
|
+
StyleSheet: styleSheet =>
|
|
36
|
+
styleSheet.rules.forEach(rule => {
|
|
37
|
+
this.declarationConfig = this.getDeclarationConfig()
|
|
38
|
+
this.parseRuleRec(rule)
|
|
39
|
+
}),
|
|
40
|
+
},
|
|
41
|
+
})
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
private getDeclarationConfig() {
|
|
45
|
+
return ({
|
|
46
|
+
className: null as string | null,
|
|
47
|
+
rtl: null as boolean | null,
|
|
48
|
+
mediaQueries: [] as Array<MediaQuery>,
|
|
49
|
+
root: false,
|
|
50
|
+
theme: null as string | null,
|
|
51
|
+
active: null as boolean | null,
|
|
52
|
+
focus: null as boolean | null,
|
|
53
|
+
disabled: null as boolean | null,
|
|
54
|
+
})
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
private addDeclaration(declaration: Declaration, important = false) {
|
|
58
|
+
const isVar = this.declarationConfig.root || this.declarationConfig.className === null
|
|
59
|
+
const mq = this.MQ.processMediaQueries(this.declarationConfig.mediaQueries)
|
|
60
|
+
const style = (() => {
|
|
61
|
+
if (!isVar) {
|
|
62
|
+
return this.stylesheets[this.declarationConfig.className!]?.at(-1)
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
if (mq.platform !== null) {
|
|
66
|
+
const platformKey = `__uniwind-platform-${mq.platform}`
|
|
67
|
+
this.scopedVars[platformKey] ??= {}
|
|
68
|
+
|
|
69
|
+
return this.scopedVars[platformKey]
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if (this.declarationConfig.theme === null) {
|
|
73
|
+
return this.vars
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const themeKey = `__uniwind-theme-${this.declarationConfig.theme}`
|
|
77
|
+
this.scopedVars[themeKey] ??= {}
|
|
78
|
+
|
|
79
|
+
return this.scopedVars[themeKey]
|
|
80
|
+
})()
|
|
81
|
+
|
|
82
|
+
if (!isVar) {
|
|
83
|
+
Object.assign(style, mq)
|
|
84
|
+
style.importantProperties ??= []
|
|
85
|
+
style.rtl = this.declarationConfig.rtl
|
|
86
|
+
style.theme = mq.colorScheme ?? this.declarationConfig.theme
|
|
87
|
+
style.active = this.declarationConfig.active
|
|
88
|
+
style.focus = this.declarationConfig.focus
|
|
89
|
+
style.disabled = this.declarationConfig.disabled
|
|
90
|
+
this.meta.className = this.declarationConfig.className
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
if (declaration.property === 'unparsed') {
|
|
94
|
+
style[declaration.value.propertyId.property] = this.CSS.processValue(declaration.value.value)
|
|
95
|
+
|
|
96
|
+
if (!isVar && important) {
|
|
97
|
+
style.importantProperties.push(declaration.value.propertyId.property)
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
return
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
if (declaration.property === 'custom') {
|
|
104
|
+
style[declaration.value.name] = this.CSS.processValue(declaration.value.value)
|
|
105
|
+
|
|
106
|
+
if (!isVar && important) {
|
|
107
|
+
style.importantProperties.push(declaration.value.name)
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
return
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
style[declaration.property] = this.CSS.processValue(declaration.value)
|
|
114
|
+
|
|
115
|
+
if (!isVar && important) {
|
|
116
|
+
style.importantProperties.push(declaration.property)
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
private parseRuleRec(rule: Rule<Declaration, MediaQuery>) {
|
|
121
|
+
if (this.declarationConfig.className !== null) {
|
|
122
|
+
const lastStyle = this.stylesheets[this.declarationConfig.className]?.at(-1)
|
|
123
|
+
|
|
124
|
+
if (lastStyle !== undefined && Object.keys(lastStyle).length > 0) {
|
|
125
|
+
this.stylesheets[this.declarationConfig.className]?.push({})
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
if (rule.type === 'style') {
|
|
130
|
+
rule.value.selectors.forEach(selector => {
|
|
131
|
+
const [maybeClassNameSelector] = selector
|
|
132
|
+
const newClassName = maybeClassNameSelector?.type === 'class' ? maybeClassNameSelector.name : undefined
|
|
133
|
+
|
|
134
|
+
if (newClassName !== undefined) {
|
|
135
|
+
this.declarationConfig.className = newClassName
|
|
136
|
+
this.stylesheets[newClassName] ??= []
|
|
137
|
+
this.stylesheets[newClassName].push({})
|
|
138
|
+
|
|
139
|
+
rule.value.declarations?.declarations?.forEach(declaration => this.addDeclaration(declaration))
|
|
140
|
+
rule.value.declarations?.importantDeclarations?.forEach(declaration => this.addDeclaration(declaration, true))
|
|
141
|
+
rule.value.rules?.forEach(rule => this.parseRuleRec(rule))
|
|
142
|
+
|
|
143
|
+
return
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
let rtl = null as boolean | null
|
|
147
|
+
let theme = null as string | null
|
|
148
|
+
let active = null as boolean | null
|
|
149
|
+
let focus = null as boolean | null
|
|
150
|
+
let disabled = null as boolean | null
|
|
151
|
+
|
|
152
|
+
selector.forEach(selector => {
|
|
153
|
+
if (selector.type === 'pseudo-class' && selector.kind === 'where') {
|
|
154
|
+
selector.selectors.forEach(selector => {
|
|
155
|
+
selector.forEach(selector => {
|
|
156
|
+
if (selector.type === 'class' && this.themes.includes(selector.name)) {
|
|
157
|
+
theme = selector.name
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
if (selector.type === 'pseudo-class' && selector.kind === 'dir') {
|
|
161
|
+
rtl = selector.direction === 'rtl'
|
|
162
|
+
}
|
|
163
|
+
})
|
|
164
|
+
})
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
if (selector.type === 'pseudo-class' && selector.kind === 'active') {
|
|
168
|
+
active = true
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
if (selector.type === 'pseudo-class' && selector.kind === 'focus') {
|
|
172
|
+
focus = true
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
if (selector.type === 'pseudo-class' && selector.kind === 'disabled') {
|
|
176
|
+
disabled = true
|
|
177
|
+
}
|
|
178
|
+
})
|
|
179
|
+
|
|
180
|
+
if ([rtl, theme, active, focus, disabled].some(Boolean)) {
|
|
181
|
+
this.declarationConfig.rtl = rtl
|
|
182
|
+
this.declarationConfig.theme = theme
|
|
183
|
+
this.declarationConfig.active = active
|
|
184
|
+
this.declarationConfig.focus = focus
|
|
185
|
+
this.declarationConfig.disabled = disabled
|
|
186
|
+
|
|
187
|
+
rule.value.declarations?.declarations?.forEach(declaration => this.addDeclaration(declaration))
|
|
188
|
+
rule.value.declarations?.importantDeclarations?.forEach(declaration => this.addDeclaration(declaration, true))
|
|
189
|
+
rule.value.rules?.forEach(rule => this.parseRuleRec(rule))
|
|
190
|
+
|
|
191
|
+
this.declarationConfig.rtl = null
|
|
192
|
+
this.declarationConfig.theme = null
|
|
193
|
+
this.declarationConfig.active = null
|
|
194
|
+
this.declarationConfig.focus = null
|
|
195
|
+
this.declarationConfig.disabled = null
|
|
196
|
+
|
|
197
|
+
return
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
selector.forEach(selectorToken => {
|
|
201
|
+
if (selectorToken.type === 'pseudo-class' && selectorToken.kind === 'root') {
|
|
202
|
+
this.declarationConfig.root = true
|
|
203
|
+
|
|
204
|
+
rule.value.declarations?.declarations?.forEach(declaration => this.addDeclaration(declaration))
|
|
205
|
+
rule.value.declarations?.importantDeclarations?.forEach(declaration => this.addDeclaration(declaration, true))
|
|
206
|
+
rule.value.rules?.forEach(rule => this.parseRuleRec(rule))
|
|
207
|
+
}
|
|
208
|
+
})
|
|
209
|
+
})
|
|
210
|
+
|
|
211
|
+
return
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
if (rule.type === 'supports') {
|
|
215
|
+
rule.value.rules.forEach(rule => this.parseRuleRec(rule))
|
|
216
|
+
|
|
217
|
+
return
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
if (rule.type === 'media') {
|
|
221
|
+
const { mediaQueries } = rule.value.query
|
|
222
|
+
|
|
223
|
+
this.declarationConfig.mediaQueries.push(...mediaQueries)
|
|
224
|
+
rule.value.rules.forEach(rule => {
|
|
225
|
+
this.parseRuleRec(rule)
|
|
226
|
+
this.declarationConfig = this.getDeclarationConfig()
|
|
227
|
+
})
|
|
228
|
+
|
|
229
|
+
return
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
if (rule.type === 'layer-block') {
|
|
233
|
+
rule.value.rules.forEach(rule => this.parseRuleRec(rule))
|
|
234
|
+
|
|
235
|
+
return
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
if (rule.type === 'nested-declarations') {
|
|
239
|
+
rule.value.declarations.declarations?.forEach(declaration => this.addDeclaration(declaration))
|
|
240
|
+
rule.value.declarations.importantDeclarations?.forEach(declaration => this.addDeclaration(declaration, true))
|
|
241
|
+
|
|
242
|
+
return
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
if (rule.type === 'property' && rule.value.initialValue) {
|
|
246
|
+
this.vars[rule.value.name] = this.CSS.processValue(rule.value.initialValue)
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
}
|