@niibase/uniwind 1.6.4 → 1.8.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/CHANGELOG.md +71 -0
- package/dist/cli/index.cjs +91 -0
- package/dist/cli/index.mjs +84 -0
- package/dist/common/{css → bundler/artifacts/css}/index.js +1 -4
- package/dist/common/{css → bundler/artifacts/css}/themes.js +4 -1
- package/dist/common/{utils/buildDtsFile.js → bundler/artifacts/dts.js} +1 -2
- package/dist/common/bundler/cli/index.js +76 -0
- package/dist/common/bundler/config.js +75 -0
- package/dist/common/bundler/css-compiler/compileCSS.js +18 -0
- package/dist/common/bundler/css-compiler/compileNativeCSS.js +19 -0
- package/dist/common/bundler/css-compiler/compileTailwind.js +27 -0
- package/dist/common/bundler/css-compiler/compileWebCSS.js +15 -0
- package/dist/common/{vite → bundler/css-compiler}/index.js +4 -4
- package/dist/common/bundler/css-processor/addMetaToStylesTemplate.js +130 -0
- package/dist/common/bundler/css-processor/animation.js +112 -0
- package/dist/common/bundler/css-processor/color.js +66 -0
- package/dist/common/bundler/css-processor/css.js +510 -0
- package/dist/common/bundler/css-processor/functions.js +145 -0
- package/dist/common/bundler/css-processor/index.js +38 -0
- package/dist/common/bundler/css-processor/mq.js +87 -0
- package/dist/common/bundler/css-processor/processor.js +353 -0
- package/dist/common/bundler/css-processor/rn.js +356 -0
- package/dist/common/bundler/css-processor/serialize.js +86 -0
- package/dist/common/bundler/css-processor/types.js +1 -0
- package/dist/common/bundler/css-processor/units.js +55 -0
- package/dist/common/bundler/css-processor/utils.js +61 -0
- package/dist/common/bundler/css-processor/var.js +20 -0
- package/dist/common/{css-visitor → bundler/css-visitor}/rule-visitor.js +7 -7
- package/dist/common/{css-visitor → bundler/css-visitor}/visitor.js +5 -6
- package/dist/common/bundler/logger.js +44 -0
- package/dist/common/bundler/types.js +1 -0
- package/dist/common/common/consts.js +26 -2
- package/dist/common/components/web/rnw.js +2 -2
- package/dist/common/core/config/config.common.js +9 -9
- package/dist/common/core/config/config.js +2 -2
- package/dist/common/core/config/config.native.js +4 -8
- package/dist/common/core/listener.js +10 -10
- package/dist/common/core/native/native-utils.js +1 -8
- package/dist/common/core/native/parsers/textShadow.js +6 -18
- package/dist/common/core/native/parsers/transforms.js +1 -5
- package/dist/common/core/native/runtime.js +7 -3
- package/dist/common/core/native/store.js +22 -69
- package/dist/common/core/web/cssListener.js +2 -2
- package/dist/common/hoc/withUniwind.js +5 -5
- package/dist/common/hoc/withUniwind.native.js +5 -5
- package/dist/common/hooks/useCSSVariable/getVariableValue.native.js +4 -1
- package/dist/common/hooks/useCSSVariable/useCSSVariable.js +6 -2
- package/dist/common/hooks/useUniwind.js +2 -2
- package/dist/metro/index.cjs +40 -34
- package/dist/metro/index.d.ts +2 -0
- package/dist/metro/index.mjs +28 -22
- package/dist/metro/{metro-transformer.cjs → transformer.cjs} +316 -200
- package/dist/metro/{metro-transformer.mjs → transformer.mjs} +254 -138
- package/dist/module/{css → bundler/artifacts/css}/index.d.ts +1 -1
- package/dist/module/{css → bundler/artifacts/css}/index.js +1 -4
- package/dist/module/{css → bundler/artifacts/css}/themes.js +4 -1
- package/dist/module/{utils/buildDtsFile.js → bundler/artifacts/dts.js} +3 -4
- package/dist/module/bundler/cli/index.d.ts +2 -0
- package/dist/module/bundler/cli/index.js +81 -0
- package/dist/module/bundler/config.d.ts +17 -0
- package/dist/module/bundler/config.js +77 -0
- package/dist/module/bundler/css-compiler/compileCSS.d.ts +2 -0
- package/dist/module/bundler/css-compiler/compileCSS.js +11 -0
- package/dist/module/bundler/css-compiler/compileNativeCSS.d.ts +2 -0
- package/dist/module/bundler/css-compiler/compileNativeCSS.js +33 -0
- package/dist/module/bundler/css-compiler/compileTailwind.d.ts +2 -0
- package/dist/module/bundler/css-compiler/compileTailwind.js +22 -0
- package/dist/module/bundler/css-compiler/compileWebCSS.d.ts +2 -0
- package/dist/module/bundler/css-compiler/compileWebCSS.js +8 -0
- package/dist/module/bundler/css-compiler/index.d.ts +1 -0
- package/dist/module/bundler/css-compiler/index.js +1 -0
- package/dist/module/bundler/css-processor/addMetaToStylesTemplate.d.ts +3 -0
- package/dist/module/bundler/css-processor/addMetaToStylesTemplate.js +136 -0
- package/dist/module/bundler/css-processor/animation.d.ts +6 -0
- package/dist/module/bundler/css-processor/animation.js +112 -0
- package/dist/module/bundler/css-processor/color.d.ts +12 -0
- package/dist/module/bundler/css-processor/color.js +63 -0
- package/dist/module/bundler/css-processor/css.d.ts +23 -0
- package/dist/module/bundler/css-processor/css.js +566 -0
- package/dist/module/bundler/css-processor/functions.d.ts +12 -0
- package/dist/module/bundler/css-processor/functions.js +190 -0
- package/dist/module/bundler/css-processor/index.d.ts +3 -0
- package/dist/module/bundler/css-processor/index.js +3 -0
- package/dist/module/bundler/css-processor/mq.d.ts +12 -0
- package/dist/module/bundler/css-processor/mq.js +78 -0
- package/dist/module/bundler/css-processor/processor.d.ts +36 -0
- package/dist/module/bundler/css-processor/processor.js +336 -0
- package/dist/module/bundler/css-processor/rn.d.ts +10 -0
- package/dist/module/bundler/css-processor/rn.js +400 -0
- package/dist/module/bundler/css-processor/serialize.d.ts +2 -0
- package/dist/module/bundler/css-processor/serialize.js +101 -0
- package/dist/module/bundler/css-processor/types.d.ts +28 -0
- package/dist/module/bundler/css-processor/types.js +0 -0
- package/dist/module/bundler/css-processor/units.d.ts +10 -0
- package/dist/module/bundler/css-processor/units.js +48 -0
- package/dist/module/bundler/css-processor/utils.d.ts +23 -0
- package/dist/{shared/uniwind.PtWWxxnh.mjs → module/bundler/css-processor/utils.js} +12 -18
- package/dist/module/bundler/css-processor/var.d.ts +7 -0
- package/dist/module/bundler/css-processor/var.js +13 -0
- package/dist/module/{css-visitor → bundler/css-visitor}/function-visitor.d.ts +1 -1
- package/dist/module/{css-visitor → bundler/css-visitor}/rule-visitor.d.ts +4 -3
- package/dist/module/{css-visitor → bundler/css-visitor}/rule-visitor.js +7 -7
- package/dist/module/{css-visitor → bundler/css-visitor}/visitor.d.ts +3 -3
- package/dist/module/{css-visitor → bundler/css-visitor}/visitor.js +5 -6
- package/dist/module/bundler/logger.d.ts +12 -0
- package/dist/module/bundler/logger.js +37 -0
- package/dist/module/bundler/types.d.ts +15 -0
- package/dist/module/bundler/types.js +0 -0
- package/dist/module/common/consts.d.ts +21 -0
- package/dist/module/common/consts.js +24 -0
- package/dist/module/components/ScopedTheme/ScopedTheme.native.d.ts +1 -1
- package/dist/module/components/native/Pressable.d.ts +1 -1
- package/dist/module/components/native/TouchableHighlight.d.ts +1 -1
- package/dist/module/components/native/TouchableOpacity.d.ts +1 -1
- package/dist/module/components/native/useAccentColor.d.ts +1 -1
- package/dist/module/components/native/useStyle.d.ts +3 -3
- package/dist/module/components/react-native-gesture-handler/native/BaseButton.d.ts +1 -1
- package/dist/module/components/react-native-gesture-handler/native/BorderlessButton.d.ts +1 -1
- package/dist/module/components/react-native-gesture-handler/native/DrawerLayoutAndroid.d.ts +1 -1
- package/dist/module/components/react-native-gesture-handler/native/FlatList.d.ts +1 -1
- package/dist/module/components/react-native-gesture-handler/native/Pressable.d.ts +1 -1
- package/dist/module/components/react-native-gesture-handler/native/PureNativeButton.d.ts +1 -1
- package/dist/module/components/react-native-gesture-handler/native/RawButton.d.ts +1 -1
- package/dist/module/components/react-native-gesture-handler/native/RectButton.d.ts +1 -1
- package/dist/module/components/react-native-gesture-handler/native/RefreshControl.d.ts +1 -1
- package/dist/module/components/react-native-gesture-handler/native/ScrollView.d.ts +1 -1
- package/dist/module/components/react-native-gesture-handler/native/Switch.d.ts +1 -1
- package/dist/module/components/react-native-gesture-handler/native/Text.d.ts +4 -1
- package/dist/module/components/react-native-gesture-handler/native/TextInput.d.ts +1 -1
- package/dist/module/components/web/Pressable.d.ts +1 -1
- package/dist/module/components/web/TouchableHighlight.d.ts +1 -1
- package/dist/module/components/web/TouchableOpacity.d.ts +1 -1
- package/dist/module/components/web/rnw.js +1 -1
- package/dist/module/core/config/config.common.d.ts +6 -7
- package/dist/module/core/config/config.common.js +2 -2
- package/dist/module/core/config/config.d.ts +1 -1
- package/dist/module/core/config/config.js +1 -1
- package/dist/module/core/config/config.native.d.ts +2 -2
- package/dist/module/core/config/config.native.js +2 -6
- package/dist/module/core/listener.d.ts +1 -1
- package/dist/module/core/listener.js +1 -1
- package/dist/module/core/native/native-utils.d.ts +0 -1
- package/dist/module/core/native/native-utils.js +0 -6
- package/dist/module/core/native/parsers/textShadow.js +6 -18
- package/dist/module/core/native/parsers/transforms.js +1 -5
- package/dist/module/core/native/runtime.js +5 -1
- package/dist/module/core/native/store.d.ts +3 -3
- package/dist/module/core/native/store.js +22 -65
- package/dist/module/core/types.d.ts +12 -7
- package/dist/module/core/web/cssListener.js +1 -1
- package/dist/module/core/web/getWebStyles.d.ts +1 -1
- package/dist/module/hoc/types.d.ts +2 -2
- package/dist/module/hoc/withUniwind.d.ts +1 -1
- package/dist/module/hoc/withUniwind.js +5 -5
- package/dist/module/hoc/withUniwind.native.d.ts +1 -1
- package/dist/module/hoc/withUniwind.native.js +5 -5
- package/dist/module/hooks/useCSSVariable/getVariableValue.native.d.ts +1 -1
- package/dist/module/hooks/useCSSVariable/getVariableValue.native.js +4 -1
- package/dist/module/hooks/useCSSVariable/useCSSVariable.d.ts +1 -1
- package/dist/module/hooks/useCSSVariable/useCSSVariable.js +5 -1
- package/dist/module/hooks/useResolveClassNames.d.ts +1 -1
- package/dist/module/hooks/useUniwind.d.ts +1 -1
- package/dist/module/hooks/useUniwind.js +1 -1
- package/dist/module/index.d.ts +1 -2
- package/dist/shared/{uniwind.r2i22V6d.cjs → uniwind.BEqYiPBB.cjs} +319 -217
- package/dist/shared/uniwind.CFAAUZ2t.mjs +3 -0
- package/dist/shared/uniwind.DJ5M1Q4q.cjs +5 -0
- package/dist/shared/{uniwind.BGiqYvxb.mjs → uniwind.DgC4MT51.mjs} +312 -214
- package/dist/vite/index.cjs +82 -59
- package/dist/vite/index.mjs +80 -58
- package/package.json +37 -21
- package/src/{metro → bundler/adapters/metro}/index.d.ts +2 -0
- package/src/bundler/adapters/metro/index.ts +1 -0
- package/src/bundler/adapters/metro/metro.ts +67 -0
- package/src/{metro/metro-css-patches.ts → bundler/adapters/metro/patches.ts} +3 -2
- package/src/{metro → bundler/adapters/metro}/resolvers.ts +8 -8
- package/src/bundler/adapters/metro/transformer.ts +85 -0
- package/src/bundler/adapters/vite/vite.ts +148 -0
- package/src/{css → bundler/artifacts/css}/extraUtilities.ts +1 -1
- package/src/{css → bundler/artifacts/css}/index.ts +1 -5
- package/src/{css → bundler/artifacts/css}/themes.ts +7 -2
- package/src/{utils/buildDtsFile.ts → bundler/artifacts/dts.ts} +3 -4
- package/src/bundler/cli/index.ts +105 -0
- package/src/bundler/config.ts +94 -0
- package/src/bundler/css-compiler/compileCSS.ts +15 -0
- package/src/bundler/css-compiler/compileNativeCSS.ts +41 -0
- package/src/bundler/css-compiler/compileTailwind.ts +25 -0
- package/src/bundler/css-compiler/compileWebCSS.ts +10 -0
- package/src/bundler/css-compiler/index.ts +1 -0
- package/src/{metro → bundler/css-processor}/addMetaToStylesTemplate.ts +36 -17
- package/src/{metro/processor → bundler/css-processor}/animation.ts +4 -4
- package/src/{metro/processor → bundler/css-processor}/color.ts +5 -4
- package/src/{metro/processor → bundler/css-processor}/css.ts +19 -11
- package/src/{metro/processor → bundler/css-processor}/functions.ts +2 -2
- package/src/bundler/css-processor/index.ts +3 -0
- package/src/{metro/processor → bundler/css-processor}/mq.ts +4 -4
- package/src/{metro/processor → bundler/css-processor}/processor.ts +20 -18
- package/src/{metro/processor → bundler/css-processor}/rn.ts +96 -3
- package/src/{metro/utils → bundler/css-processor}/serialize.ts +2 -2
- package/src/{metro → bundler/css-processor}/types.ts +3 -17
- package/src/{metro/processor → bundler/css-processor}/units.ts +2 -2
- package/src/{metro/utils/common.ts → bundler/css-processor/utils.ts} +2 -5
- package/src/{metro/processor → bundler/css-processor}/var.ts +2 -2
- package/src/{css-visitor → bundler/css-visitor}/function-visitor.ts +1 -1
- package/src/{css-visitor → bundler/css-visitor}/rule-visitor.ts +8 -7
- package/src/{css-visitor → bundler/css-visitor}/visitor.ts +4 -3
- package/src/{metro → bundler}/logger.ts +4 -0
- package/src/bundler/types.ts +17 -0
- package/src/common/consts.ts +25 -0
- package/src/components/ScopedTheme/ScopedTheme.native.tsx +1 -1
- package/src/components/native/ActivityIndicator.tsx +2 -1
- package/src/components/native/Button.tsx +2 -1
- package/src/components/native/FlatList.tsx +2 -1
- package/src/components/native/Image.tsx +2 -1
- package/src/components/native/ImageBackground.tsx +2 -1
- package/src/components/native/InputAccessoryView.tsx +3 -2
- package/src/components/native/KeyboardAvoidingView.tsx +2 -1
- package/src/components/native/Modal.tsx +2 -1
- package/src/components/native/Pressable.tsx +1 -1
- package/src/components/native/RefreshControl.tsx +2 -1
- package/src/components/native/SafeAreaView.tsx +2 -1
- package/src/components/native/ScrollView.tsx +2 -1
- package/src/components/native/SectionList.tsx +2 -1
- package/src/components/native/Switch.tsx +3 -2
- package/src/components/native/Text.tsx +3 -2
- package/src/components/native/TextInput.tsx +3 -2
- package/src/components/native/TouchableHighlight.tsx +3 -2
- package/src/components/native/TouchableNativeFeedback.tsx +3 -2
- package/src/components/native/TouchableOpacity.tsx +3 -2
- package/src/components/native/TouchableWithoutFeedback.tsx +3 -2
- package/src/components/native/View.tsx +2 -1
- package/src/components/native/VirtualizedList.tsx +2 -1
- package/src/components/native/useAccentColor.ts +1 -1
- package/src/components/native/useStyle.ts +2 -2
- package/src/components/react-native-gesture-handler/native/BaseButton.tsx +1 -1
- package/src/components/react-native-gesture-handler/native/BorderlessButton.tsx +1 -1
- package/src/components/react-native-gesture-handler/native/DrawerLayoutAndroid.tsx +1 -1
- package/src/components/react-native-gesture-handler/native/FlatList.tsx +1 -1
- package/src/components/react-native-gesture-handler/native/GestureHandlerRootView.tsx +1 -1
- package/src/components/react-native-gesture-handler/native/Pressable.tsx +1 -1
- package/src/components/react-native-gesture-handler/native/PureNativeButton.tsx +1 -1
- package/src/components/react-native-gesture-handler/native/RawButton.tsx +1 -1
- package/src/components/react-native-gesture-handler/native/RectButton.tsx +1 -1
- package/src/components/react-native-gesture-handler/native/RefreshControl.tsx +1 -1
- package/src/components/react-native-gesture-handler/native/ScrollView.tsx +1 -1
- package/src/components/react-native-gesture-handler/native/Switch.tsx +2 -2
- package/src/components/react-native-gesture-handler/native/Text.tsx +2 -2
- package/src/components/react-native-gesture-handler/native/TextInput.tsx +2 -2
- package/src/components/react-native-gesture-handler/native/TouchableNativeFeedback.tsx +2 -2
- package/src/components/react-native-gesture-handler/native/TouchableOpacity.tsx +2 -2
- package/src/components/react-native-gesture-handler/native/TouchableWithoutFeedback.tsx +2 -2
- package/src/components/web/ActivityIndicator.tsx +2 -1
- package/src/components/web/Button.tsx +2 -1
- package/src/components/web/FlatList.tsx +2 -1
- package/src/components/web/Image.tsx +2 -1
- package/src/components/web/ImageBackground.tsx +2 -1
- package/src/components/web/KeyboardAvoidingView.tsx +2 -1
- package/src/components/web/Modal.tsx +2 -1
- package/src/components/web/Pressable.tsx +2 -1
- package/src/components/web/RefreshControl.tsx +2 -1
- package/src/components/web/SafeAreaView.tsx +2 -1
- package/src/components/web/ScrollView.tsx +2 -1
- package/src/components/web/SectionList.tsx +2 -1
- package/src/components/web/Switch.tsx +2 -1
- package/src/components/web/Text.tsx +2 -1
- package/src/components/web/TextInput.tsx +2 -1
- package/src/components/web/TouchableHighlight.tsx +2 -1
- package/src/components/web/TouchableOpacity.tsx +2 -1
- package/src/components/web/TouchableWithoutFeedback.tsx +2 -1
- package/src/components/web/View.tsx +2 -1
- package/src/components/web/VirtualizedList.tsx +2 -1
- package/src/components/web/rnw.ts +1 -1
- package/src/core/config/config.common.ts +11 -9
- package/src/core/config/config.native.ts +4 -8
- package/src/core/config/config.ts +2 -2
- package/src/core/listener.ts +1 -1
- package/src/core/native/native-utils.ts +0 -9
- package/src/core/native/parsers/textShadow.ts +6 -18
- package/src/core/native/parsers/transforms.ts +1 -5
- package/src/core/native/runtime.ts +6 -1
- package/src/core/native/store.ts +26 -69
- package/src/core/types.ts +13 -7
- package/src/core/web/cssListener.ts +1 -1
- package/src/core/web/getWebStyles.ts +1 -1
- package/src/hoc/types.ts +2 -2
- package/src/hoc/withUniwind.native.tsx +4 -3
- package/src/hoc/withUniwind.tsx +3 -2
- package/src/hooks/useCSSVariable/getVariableValue.native.ts +6 -3
- package/src/hooks/useCSSVariable/useCSSVariable.ts +8 -2
- package/src/hooks/useResolveClassNames.ts +1 -1
- package/src/hooks/useUniwind.ts +2 -2
- package/src/index.ts +1 -2
- package/dist/common/types.js +0 -28
- package/dist/common/utils/stringifyThemes.js +0 -8
- package/dist/common/vite/vite.js +0 -95
- package/dist/module/types.d.ts +0 -21
- package/dist/module/types.js +0 -22
- package/dist/module/utils/stringifyThemes.d.ts +0 -1
- package/dist/module/utils/stringifyThemes.js +0 -1
- package/dist/module/vite/index.d.ts +0 -9
- package/dist/module/vite/index.js +0 -1
- package/dist/module/vite/vite.d.ts +0 -8
- package/dist/module/vite/vite.js +0 -98
- package/dist/shared/uniwind.B5q8hBGv.cjs +0 -18
- package/dist/shared/uniwind.Cv73KtI-.cjs +0 -86
- package/dist/shared/uniwind.JSWK3vHl.mjs +0 -14
- package/src/metro/compileVirtual.ts +0 -85
- package/src/metro/index.ts +0 -1
- package/src/metro/injectThemes.ts +0 -23
- package/src/metro/metro-transformer.ts +0 -116
- package/src/metro/processor/index.ts +0 -1
- package/src/metro/utils/index.ts +0 -2
- package/src/metro/withUniwindConfig.ts +0 -61
- package/src/types.ts +0 -23
- package/src/utils/stringifyThemes.ts +0 -1
- package/src/vite/index.d.ts +0 -9
- package/src/vite/vite.ts +0 -113
- /package/dist/common/{css → bundler/artifacts/css}/extraUtilities.js +0 -0
- /package/dist/common/{css → bundler/artifacts/css}/insets.js +0 -0
- /package/dist/common/{css → bundler/artifacts/css}/overwrite.js +0 -0
- /package/dist/common/{css → bundler/artifacts/css}/variants.js +0 -0
- /package/dist/common/{css-visitor → bundler/css-visitor}/function-visitor.js +0 -0
- /package/dist/common/{css-visitor → bundler/css-visitor}/index.js +0 -0
- /package/dist/module/{css → bundler/artifacts/css}/extraUtilities.d.ts +0 -0
- /package/dist/module/{css → bundler/artifacts/css}/extraUtilities.js +0 -0
- /package/dist/module/{css → bundler/artifacts/css}/insets.d.ts +0 -0
- /package/dist/module/{css → bundler/artifacts/css}/insets.js +0 -0
- /package/dist/module/{css → bundler/artifacts/css}/overwrite.d.ts +0 -0
- /package/dist/module/{css → bundler/artifacts/css}/overwrite.js +0 -0
- /package/dist/module/{css → bundler/artifacts/css}/themes.d.ts +0 -0
- /package/dist/module/{css → bundler/artifacts/css}/variants.d.ts +0 -0
- /package/dist/module/{css → bundler/artifacts/css}/variants.js +0 -0
- /package/dist/module/{utils/buildDtsFile.d.ts → bundler/artifacts/dts.d.ts} +0 -0
- /package/dist/module/{css-visitor → bundler/css-visitor}/function-visitor.js +0 -0
- /package/dist/module/{css-visitor → bundler/css-visitor}/index.d.ts +0 -0
- /package/dist/module/{css-visitor → bundler/css-visitor}/index.js +0 -0
- /package/{dist/common → src/bundler/adapters}/vite/index.d.ts +0 -0
- /package/src/{vite → bundler/adapters/vite}/index.ts +0 -0
- /package/src/{css → bundler/artifacts/css}/insets.ts +0 -0
- /package/src/{css → bundler/artifacts/css}/overwrite.ts +0 -0
- /package/src/{css → bundler/artifacts/css}/variants.ts +0 -0
- /package/src/{css-visitor → bundler/css-visitor}/index.ts +0 -0
|
@@ -5,14 +5,18 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.useCSSVariable = exports.getCSSVariable = void 0;
|
|
7
7
|
var _react = require("react");
|
|
8
|
+
var _reactNative = require("react-native");
|
|
9
|
+
var _consts = require("../../common/consts");
|
|
8
10
|
var _utils = require("../../common/utils");
|
|
9
11
|
var _context = require("../../core/context");
|
|
10
12
|
var _listener = require("../../core/listener");
|
|
11
13
|
var _logger = require("../../core/logger");
|
|
12
|
-
var _types = require("../../types");
|
|
13
14
|
var _getVariableValue = require("./getVariableValue");
|
|
14
15
|
let warned = false;
|
|
15
16
|
const logDevError = name => {
|
|
17
|
+
if (_reactNative.Platform.OS === "web" && (typeof document === "undefined" || typeof window === "undefined")) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
16
20
|
warned = true;
|
|
17
21
|
_logger.Logger.warn(`We couldn't find your variable ${name}. Make sure it's used at least once in your className, or define it in a static theme as described in the docs: https://docs.uniwind.dev/api/use-css-variable`);
|
|
18
22
|
};
|
|
@@ -51,7 +55,7 @@ const useCSSVariable = name => {
|
|
|
51
55
|
}, [name]);
|
|
52
56
|
(0, _react.useLayoutEffect)(() => {
|
|
53
57
|
const updateValue = () => setValue(getCSSVariable(nameRef.current, uniwindContext));
|
|
54
|
-
const dispose = _listener.UniwindListener.subscribe(updateValue, [
|
|
58
|
+
const dispose = _listener.UniwindListener.subscribe(updateValue, [_consts.StyleDependency.Theme, _consts.StyleDependency.Variables]);
|
|
55
59
|
return dispose;
|
|
56
60
|
}, [uniwindContext]);
|
|
57
61
|
return value;
|
|
@@ -5,10 +5,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.useUniwind = void 0;
|
|
7
7
|
var _react = require("react");
|
|
8
|
+
var _consts = require("../common/consts");
|
|
8
9
|
var _core = require("../core");
|
|
9
10
|
var _context = require("../core/context");
|
|
10
11
|
var _listener = require("../core/listener");
|
|
11
|
-
var _types = require("../types");
|
|
12
12
|
const useUniwind = () => {
|
|
13
13
|
const uniwindContext = (0, _context.useUniwindContext)();
|
|
14
14
|
const [theme, setTheme] = (0, _react.useState)(_core.Uniwind.currentTheme);
|
|
@@ -20,7 +20,7 @@ const useUniwind = () => {
|
|
|
20
20
|
const dispose = _listener.UniwindListener.subscribe(() => {
|
|
21
21
|
setTheme(_core.Uniwind.currentTheme);
|
|
22
22
|
setHasAdaptiveThemes(_core.Uniwind.hasAdaptiveThemes);
|
|
23
|
-
}, [
|
|
23
|
+
}, [_consts.StyleDependency.Theme, _consts.StyleDependency.AdaptiveThemes]);
|
|
24
24
|
return () => {
|
|
25
25
|
dispose();
|
|
26
26
|
};
|
package/dist/metro/index.cjs
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const
|
|
3
|
+
const config = require('../shared/uniwind.BEqYiPBB.cjs');
|
|
4
|
+
const node_path = require('node:path');
|
|
5
|
+
const _package = require('../shared/uniwind.DJ5M1Q4q.cjs');
|
|
4
6
|
const FileStoreBase = require('metro-cache/private/stores/FileStore');
|
|
5
7
|
const os = require('os');
|
|
6
8
|
const path = require('path');
|
|
7
|
-
|
|
8
|
-
|
|
9
|
+
require('fs');
|
|
10
|
+
require('@tailwindcss/node');
|
|
11
|
+
require('lightningcss');
|
|
9
12
|
|
|
10
13
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
|
|
11
14
|
|
|
@@ -33,7 +36,7 @@ const patchMetroGraphToSupportUncachedModules = () => {
|
|
|
33
36
|
original_traverseDependencies.__patched = true;
|
|
34
37
|
function traverseDependencies(paths, options) {
|
|
35
38
|
this.dependencies.forEach((dependency) => {
|
|
36
|
-
if (dependency.output.find((file) => file.data
|
|
39
|
+
if (dependency.output.find((file) => file.data?.css?.skipCache === true) && !paths.includes(dependency.path)) {
|
|
37
40
|
dependency.unstable_transformResultKey = `${dependency.unstable_transformResultKey}.`;
|
|
38
41
|
paths.push(dependency.path);
|
|
39
42
|
}
|
|
@@ -79,7 +82,7 @@ const nativeResolver = (extraComponents) => ({
|
|
|
79
82
|
const resolution = resolver(context, moduleName, platform);
|
|
80
83
|
if (cachedInternalBasePath === null) {
|
|
81
84
|
try {
|
|
82
|
-
cachedInternalBasePath = node_path.dirname(require.resolve(`${
|
|
85
|
+
cachedInternalBasePath = node_path.dirname(require.resolve(`${_package.name}/package.json`));
|
|
83
86
|
} catch {
|
|
84
87
|
cachedInternalBasePath = "";
|
|
85
88
|
}
|
|
@@ -92,16 +95,16 @@ const nativeResolver = (extraComponents) => ({
|
|
|
92
95
|
return resolution;
|
|
93
96
|
}
|
|
94
97
|
if (moduleName === "react-native") {
|
|
95
|
-
return resolver(context, `${
|
|
98
|
+
return resolver(context, `${_package.name}/components`, platform);
|
|
96
99
|
}
|
|
97
100
|
if (moduleName === "react-native-gesture-handler") {
|
|
98
|
-
return resolver(context, `${
|
|
101
|
+
return resolver(context, `${_package.name}/components/react-native-gesture-handler`, platform);
|
|
99
102
|
}
|
|
100
103
|
if (resolution.filePath.includes(`${node_path.sep}react-native${node_path.sep}Libraries${node_path.sep}`)) {
|
|
101
104
|
const filename = node_path.basename(resolution.filePath.split(node_path.sep).at(-1) ?? "");
|
|
102
105
|
const module = filename.split(".").at(0);
|
|
103
106
|
if (module !== void 0 && SUPPORTED_COMPONENTS.includes(module)) {
|
|
104
|
-
return resolver(context, `${
|
|
107
|
+
return resolver(context, `${_package.name}/components/${module}`, platform);
|
|
105
108
|
}
|
|
106
109
|
}
|
|
107
110
|
if (moduleName in extraComponents) {
|
|
@@ -119,7 +122,7 @@ const webResolver = (extraComponents) => ({
|
|
|
119
122
|
const resolution = resolver(context, moduleName, platform);
|
|
120
123
|
if (cachedInternalBasePath === null) {
|
|
121
124
|
try {
|
|
122
|
-
cachedInternalBasePath = node_path.dirname(require.resolve(`${
|
|
125
|
+
cachedInternalBasePath = node_path.dirname(require.resolve(`${_package.name}/package.json`));
|
|
123
126
|
} catch {
|
|
124
127
|
cachedInternalBasePath = "";
|
|
125
128
|
}
|
|
@@ -141,45 +144,48 @@ const webResolver = (extraComponents) => ({
|
|
|
141
144
|
if (!isIndex || module === void 0 || !SUPPORTED_COMPONENTS.includes(module) || context.originModulePath.endsWith(`${module}${node_path.sep}index.js`)) {
|
|
142
145
|
return resolution;
|
|
143
146
|
}
|
|
144
|
-
return resolver(context, `${
|
|
147
|
+
return resolver(context, `${_package.name}/components/${module}`, platform);
|
|
145
148
|
};
|
|
146
149
|
|
|
147
|
-
const
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
...uniwindConfig.extraThemes ?? []
|
|
152
|
-
]);
|
|
150
|
+
const isUniwindRequest = (moduleName) => moduleName === _package.name || moduleName.startsWith(`${_package.name}/`);
|
|
151
|
+
const withUniwindConfig = (config$1, uniwindConfig) => {
|
|
152
|
+
const bundlerConfig = config.UniwindBundlerConfig.fromMetroConfig(uniwindConfig);
|
|
153
|
+
const pinnedUniwindOrigin = node_path.join(config$1.projectRoot ?? process.cwd(), "package.json");
|
|
153
154
|
patchMetroGraphToSupportUncachedModules();
|
|
154
|
-
if (typeof uniwindConfig === "undefined") {
|
|
155
|
-
throw new Error("Uniwind: You need to pass second parameter to withUniwindConfig");
|
|
156
|
-
}
|
|
157
|
-
if (typeof uniwindConfig.cssEntryFile === "undefined") {
|
|
158
|
-
throw new Error(
|
|
159
|
-
'Uniwind: You need to pass css css entry file to withUniwindConfig, e.g. withUniwindConfig(config, { cssEntryFile: "./global.css" })'
|
|
160
|
-
);
|
|
161
|
-
}
|
|
162
155
|
return {
|
|
163
|
-
...config,
|
|
156
|
+
...config$1,
|
|
164
157
|
cacheStores: [cacheStore],
|
|
165
|
-
transformerPath: require.resolve("./
|
|
158
|
+
transformerPath: require.resolve("./transformer.cjs"),
|
|
166
159
|
transformer: {
|
|
167
|
-
...config.transformer,
|
|
168
|
-
uniwind:
|
|
160
|
+
...config$1.transformer,
|
|
161
|
+
uniwind: bundlerConfig.toMetroConfig()
|
|
169
162
|
},
|
|
170
163
|
resolver: {
|
|
171
|
-
...config.resolver,
|
|
164
|
+
...config$1.resolver,
|
|
172
165
|
sourceExts: [
|
|
173
|
-
...config.resolver?.sourceExts ?? [],
|
|
166
|
+
...config$1.resolver?.sourceExts ?? [],
|
|
174
167
|
"css"
|
|
175
168
|
],
|
|
176
|
-
assetExts: config.resolver?.assetExts?.filter(
|
|
169
|
+
assetExts: config$1.resolver?.assetExts?.filter(
|
|
177
170
|
(ext) => ext !== "css"
|
|
178
171
|
),
|
|
179
172
|
resolveRequest: (context, moduleName, platform) => {
|
|
180
|
-
const
|
|
181
|
-
const
|
|
182
|
-
|
|
173
|
+
const baseResolver = config$1.resolver?.resolveRequest ?? context.resolveRequest;
|
|
174
|
+
const resolver = (nextContext, nextModuleName, nextPlatform) => {
|
|
175
|
+
if (isUniwindRequest(nextModuleName)) {
|
|
176
|
+
return baseResolver(
|
|
177
|
+
{
|
|
178
|
+
...nextContext,
|
|
179
|
+
originModulePath: pinnedUniwindOrigin
|
|
180
|
+
},
|
|
181
|
+
nextModuleName,
|
|
182
|
+
nextPlatform
|
|
183
|
+
);
|
|
184
|
+
}
|
|
185
|
+
return baseResolver(nextContext, nextModuleName, nextPlatform);
|
|
186
|
+
};
|
|
187
|
+
const platformResolver = platform === config.Platform.Web ? webResolver : nativeResolver;
|
|
188
|
+
const resolved = platformResolver(uniwindConfig.extraComponents ?? {})({
|
|
183
189
|
context,
|
|
184
190
|
moduleName,
|
|
185
191
|
platform,
|
package/dist/metro/index.d.ts
CHANGED
|
@@ -2,11 +2,13 @@ import type { MetroConfig } from 'metro-config'
|
|
|
2
2
|
|
|
3
3
|
type Polyfills = {
|
|
4
4
|
rem?: number
|
|
5
|
+
responsive?: 'text' | 'components' | boolean
|
|
5
6
|
}
|
|
6
7
|
|
|
7
8
|
type UniwindConfig = {
|
|
8
9
|
cssEntryFile: string
|
|
9
10
|
extraThemes?: Array<string>
|
|
11
|
+
extraComponents?: Record<string, string>
|
|
10
12
|
dtsFile?: string
|
|
11
13
|
polyfills?: Polyfills
|
|
12
14
|
debug?: boolean
|
package/dist/metro/index.mjs
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import { P as Platform } from '../shared/uniwind.
|
|
1
|
+
import { U as UniwindBundlerConfig, P as Platform } from '../shared/uniwind.DgC4MT51.mjs';
|
|
2
|
+
import { dirname, sep, basename, join } from 'node:path';
|
|
3
|
+
import { n as name } from '../shared/uniwind.CFAAUZ2t.mjs';
|
|
2
4
|
import FileStoreBase from 'metro-cache/private/stores/FileStore';
|
|
3
5
|
import os from 'os';
|
|
4
6
|
import path from 'path';
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
+
import 'fs';
|
|
8
|
+
import '@tailwindcss/node';
|
|
9
|
+
import 'lightningcss';
|
|
7
10
|
|
|
8
11
|
class FileStore extends FileStoreBase {
|
|
9
12
|
async set(key, value) {
|
|
@@ -25,7 +28,7 @@ const patchMetroGraphToSupportUncachedModules = () => {
|
|
|
25
28
|
original_traverseDependencies.__patched = true;
|
|
26
29
|
function traverseDependencies(paths, options) {
|
|
27
30
|
this.dependencies.forEach((dependency) => {
|
|
28
|
-
if (dependency.output.find((file) => file.data
|
|
31
|
+
if (dependency.output.find((file) => file.data?.css?.skipCache === true) && !paths.includes(dependency.path)) {
|
|
29
32
|
dependency.unstable_transformResultKey = `${dependency.unstable_transformResultKey}.`;
|
|
30
33
|
paths.push(dependency.path);
|
|
31
34
|
}
|
|
@@ -136,28 +139,18 @@ const webResolver = (extraComponents) => ({
|
|
|
136
139
|
return resolver(context, `${name}/components/${module}`, platform);
|
|
137
140
|
};
|
|
138
141
|
|
|
142
|
+
const isUniwindRequest = (moduleName) => moduleName === name || moduleName.startsWith(`${name}/`);
|
|
139
143
|
const withUniwindConfig = (config, uniwindConfig) => {
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
"dark",
|
|
143
|
-
...uniwindConfig.extraThemes ?? []
|
|
144
|
-
]);
|
|
144
|
+
const bundlerConfig = UniwindBundlerConfig.fromMetroConfig(uniwindConfig);
|
|
145
|
+
const pinnedUniwindOrigin = join(config.projectRoot ?? process.cwd(), "package.json");
|
|
145
146
|
patchMetroGraphToSupportUncachedModules();
|
|
146
|
-
if (typeof uniwindConfig === "undefined") {
|
|
147
|
-
throw new Error("Uniwind: You need to pass second parameter to withUniwindConfig");
|
|
148
|
-
}
|
|
149
|
-
if (typeof uniwindConfig.cssEntryFile === "undefined") {
|
|
150
|
-
throw new Error(
|
|
151
|
-
'Uniwind: You need to pass css css entry file to withUniwindConfig, e.g. withUniwindConfig(config, { cssEntryFile: "./global.css" })'
|
|
152
|
-
);
|
|
153
|
-
}
|
|
154
147
|
return {
|
|
155
148
|
...config,
|
|
156
149
|
cacheStores: [cacheStore],
|
|
157
|
-
transformerPath: require.resolve("./
|
|
150
|
+
transformerPath: require.resolve("./transformer.cjs"),
|
|
158
151
|
transformer: {
|
|
159
152
|
...config.transformer,
|
|
160
|
-
uniwind:
|
|
153
|
+
uniwind: bundlerConfig.toMetroConfig()
|
|
161
154
|
},
|
|
162
155
|
resolver: {
|
|
163
156
|
...config.resolver,
|
|
@@ -169,9 +162,22 @@ const withUniwindConfig = (config, uniwindConfig) => {
|
|
|
169
162
|
(ext) => ext !== "css"
|
|
170
163
|
),
|
|
171
164
|
resolveRequest: (context, moduleName, platform) => {
|
|
172
|
-
const
|
|
173
|
-
const
|
|
174
|
-
|
|
165
|
+
const baseResolver = config.resolver?.resolveRequest ?? context.resolveRequest;
|
|
166
|
+
const resolver = (nextContext, nextModuleName, nextPlatform) => {
|
|
167
|
+
if (isUniwindRequest(nextModuleName)) {
|
|
168
|
+
return baseResolver(
|
|
169
|
+
{
|
|
170
|
+
...nextContext,
|
|
171
|
+
originModulePath: pinnedUniwindOrigin
|
|
172
|
+
},
|
|
173
|
+
nextModuleName,
|
|
174
|
+
nextPlatform
|
|
175
|
+
);
|
|
176
|
+
}
|
|
177
|
+
return baseResolver(nextContext, nextModuleName, nextPlatform);
|
|
178
|
+
};
|
|
179
|
+
const platformResolver = platform === Platform.Web ? webResolver : nativeResolver;
|
|
180
|
+
const resolved = platformResolver(uniwindConfig.extraComponents ?? {})({
|
|
175
181
|
context,
|
|
176
182
|
moduleName,
|
|
177
183
|
platform,
|