react-native-unistyles 3.0.0-nightly-20250203 → 3.0.0-nightly-20250207
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/cxx/core/HostUnistyle.cpp +18 -4
- package/lib/commonjs/components/native/Animated.js +2 -2
- package/lib/commonjs/components/native/Animated.js.map +1 -1
- package/lib/commonjs/components/native/ImageBackground.js +5 -5
- package/lib/commonjs/components/native/ImageBackground.js.map +1 -1
- package/lib/commonjs/components/native/NativeText.native.js.map +1 -1
- package/lib/commonjs/components/native/NativeView.native.js.map +1 -1
- package/lib/commonjs/components/native/Pressable.js +1 -1
- package/lib/commonjs/components/native/Pressable.js.map +1 -1
- package/lib/commonjs/components/native/Pressable.native.js +6 -10
- package/lib/commonjs/components/native/Pressable.native.js.map +1 -1
- package/lib/commonjs/core/createUnistylesElement.js +5 -5
- package/lib/commonjs/core/createUnistylesElement.js.map +1 -1
- package/lib/commonjs/core/createUnistylesElement.native.js +1 -1
- package/lib/commonjs/core/createUnistylesElement.native.js.map +1 -1
- package/lib/commonjs/core/createUnistylesImageBackground.js +1 -1
- package/lib/commonjs/core/createUnistylesImageBackground.js.map +1 -1
- package/lib/commonjs/core/withUnistyles/withUnistyles.js +1 -1
- package/lib/commonjs/core/withUnistyles/withUnistyles.js.map +1 -1
- package/lib/commonjs/core/withUnistyles/withUnistyles.native.js +1 -1
- package/lib/commonjs/core/withUnistyles/withUnistyles.native.js.map +1 -1
- package/lib/commonjs/hooks/useMedia.native.js +1 -1
- package/lib/commonjs/hooks/useMedia.native.js.map +1 -1
- package/lib/commonjs/mq.js.map +1 -1
- package/lib/commonjs/server/getServerUnistyles.js +1 -1
- package/lib/commonjs/server/getServerUnistyles.js.map +1 -1
- package/lib/commonjs/server/hydrateServerUnistyles.js +1 -1
- package/lib/commonjs/server/hydrateServerUnistyles.js.map +1 -1
- package/lib/commonjs/server/resetServerUnistyles.js +1 -1
- package/lib/commonjs/server/resetServerUnistyles.js.map +1 -1
- package/lib/commonjs/server/useServerUnistyles.js +2 -2
- package/lib/commonjs/server/useServerUnistyles.js.map +1 -1
- package/lib/commonjs/specs/StatusBar/index.js.map +1 -1
- package/lib/commonjs/specs/StyleSheet/index.js +1 -1
- package/lib/commonjs/specs/StyleSheet/index.js.map +1 -1
- package/lib/commonjs/specs/UnistylesRuntime/index.js +1 -1
- package/lib/commonjs/specs/UnistylesRuntime/index.js.map +1 -1
- package/lib/commonjs/specs/index.native.js +3 -3
- package/lib/commonjs/specs/index.native.js.map +1 -1
- package/lib/commonjs/web/convert/index.js +3 -3
- package/lib/commonjs/web/convert/index.js.map +1 -1
- package/lib/commonjs/web/convert/object/boxShadow.js +4 -4
- package/lib/commonjs/web/convert/object/boxShadow.js.map +1 -1
- package/lib/commonjs/web/convert/object/filter.js +3 -3
- package/lib/commonjs/web/convert/object/filter.js.map +1 -1
- package/lib/commonjs/web/convert/object/transform.js +1 -1
- package/lib/commonjs/web/convert/object/transform.js.map +1 -1
- package/lib/commonjs/web/convert/utils.js.map +1 -1
- package/lib/commonjs/web/index.js +1 -1
- package/lib/commonjs/web/index.js.map +1 -1
- package/lib/commonjs/web/registry.js +1 -1
- package/lib/commonjs/web/registry.js.map +1 -1
- package/lib/commonjs/web/runtime.js.map +1 -1
- package/lib/commonjs/web/shadowRegistry.js +1 -1
- package/lib/commonjs/web/shadowRegistry.js.map +1 -1
- package/lib/commonjs/web/state.js +1 -1
- package/lib/commonjs/web/state.js.map +1 -1
- package/lib/commonjs/web/utils/unistyle.js +2 -2
- package/lib/commonjs/web/utils/unistyle.js.map +1 -1
- package/lib/module/components/native/Animated.js +2 -2
- package/lib/module/components/native/Animated.js.map +1 -1
- package/lib/module/components/native/ImageBackground.js +3 -3
- package/lib/module/components/native/ImageBackground.js.map +1 -1
- package/lib/module/components/native/NativeText.native.js.map +1 -1
- package/lib/module/components/native/NativeView.native.js.map +1 -1
- package/lib/module/components/native/Pressable.js +1 -1
- package/lib/module/components/native/Pressable.js.map +1 -1
- package/lib/module/components/native/Pressable.native.js +6 -10
- package/lib/module/components/native/Pressable.native.js.map +1 -1
- package/lib/module/core/createUnistylesElement.js +3 -3
- package/lib/module/core/createUnistylesElement.js.map +1 -1
- package/lib/module/core/createUnistylesElement.native.js +1 -1
- package/lib/module/core/createUnistylesElement.native.js.map +1 -1
- package/lib/module/core/createUnistylesImageBackground.js +1 -1
- package/lib/module/core/createUnistylesImageBackground.js.map +1 -1
- package/lib/module/core/useProxifiedUnistyles/useProxifiedUnistyles.js.map +1 -1
- package/lib/module/core/withUnistyles/withUnistyles.js +1 -1
- package/lib/module/core/withUnistyles/withUnistyles.js.map +1 -1
- package/lib/module/core/withUnistyles/withUnistyles.native.js +1 -1
- package/lib/module/core/withUnistyles/withUnistyles.native.js.map +1 -1
- package/lib/module/hooks/useMedia.native.js +1 -1
- package/lib/module/hooks/useMedia.native.js.map +1 -1
- package/lib/module/mq.js.map +1 -1
- package/lib/module/server/getServerUnistyles.js +1 -1
- package/lib/module/server/getServerUnistyles.js.map +1 -1
- package/lib/module/server/hydrateServerUnistyles.js +1 -1
- package/lib/module/server/hydrateServerUnistyles.js.map +1 -1
- package/lib/module/server/resetServerUnistyles.js +1 -1
- package/lib/module/server/resetServerUnistyles.js.map +1 -1
- package/lib/module/server/useServerUnistyles.js +2 -2
- package/lib/module/server/useServerUnistyles.js.map +1 -1
- package/lib/module/specs/StatusBar/index.js.map +1 -1
- package/lib/module/specs/StyleSheet/index.js +1 -1
- package/lib/module/specs/StyleSheet/index.js.map +1 -1
- package/lib/module/specs/UnistylesRuntime/index.js +1 -1
- package/lib/module/specs/UnistylesRuntime/index.js.map +1 -1
- package/lib/module/specs/index.native.js +4 -4
- package/lib/module/specs/index.native.js.map +1 -1
- package/lib/module/web/convert/index.js +4 -4
- package/lib/module/web/convert/index.js.map +1 -1
- package/lib/module/web/convert/object/boxShadow.js +2 -2
- package/lib/module/web/convert/object/boxShadow.js.map +1 -1
- package/lib/module/web/convert/object/filter.js +3 -3
- package/lib/module/web/convert/object/filter.js.map +1 -1
- package/lib/module/web/convert/object/transform.js +1 -1
- package/lib/module/web/convert/object/transform.js.map +1 -1
- package/lib/module/web/convert/utils.js.map +1 -1
- package/lib/module/web/index.js +1 -1
- package/lib/module/web/index.js.map +1 -1
- package/lib/module/web/registry.js +1 -1
- package/lib/module/web/registry.js.map +1 -1
- package/lib/module/web/runtime.js.map +1 -1
- package/lib/module/web/shadowRegistry.js +1 -1
- package/lib/module/web/shadowRegistry.js.map +1 -1
- package/lib/module/web/state.js +1 -1
- package/lib/module/web/state.js.map +1 -1
- package/lib/module/web/utils/unistyle.js +2 -2
- package/lib/module/web/utils/unistyle.js.map +1 -1
- package/lib/typescript/src/components/native/Pressable.d.ts.map +1 -1
- package/lib/typescript/src/components/native/Pressable.native.d.ts.map +1 -1
- package/lib/typescript/src/core/useProxifiedUnistyles/useProxifiedUnistyles.d.ts.map +1 -1
- package/lib/typescript/src/core/withUnistyles/withUnistyles.d.ts.map +1 -1
- package/lib/typescript/src/core/withUnistyles/withUnistyles.native.d.ts.map +1 -1
- package/lib/typescript/src/mq.d.ts +1 -1
- package/lib/typescript/src/mq.d.ts.map +1 -1
- package/lib/typescript/src/server/hydrateServerUnistyles.d.ts.map +1 -1
- package/lib/typescript/src/server/useServerUnistyles.d.ts.map +1 -1
- package/lib/typescript/src/specs/StatusBar/index.d.ts +1 -1
- package/lib/typescript/src/specs/StatusBar/index.d.ts.map +1 -1
- package/lib/typescript/src/specs/StyleSheet/index.d.ts +1 -1
- package/lib/typescript/src/specs/StyleSheet/index.d.ts.map +1 -1
- package/lib/typescript/src/specs/UnistylesRuntime/UnistylesRuntime.nitro.d.ts +1 -1
- package/lib/typescript/src/specs/UnistylesRuntime/UnistylesRuntime.nitro.d.ts.map +1 -1
- package/lib/typescript/src/specs/UnistylesRuntime/index.d.ts +5 -5
- package/lib/typescript/src/specs/UnistylesRuntime/index.d.ts.map +1 -1
- package/lib/typescript/src/specs/index.native.d.ts +4 -4
- package/lib/typescript/src/specs/index.native.d.ts.map +1 -1
- package/lib/typescript/src/types/breakpoints.d.ts +2 -2
- package/lib/typescript/src/types/breakpoints.d.ts.map +1 -1
- package/lib/typescript/src/types/core.d.ts +1 -1
- package/lib/typescript/src/types/core.d.ts.map +1 -1
- package/lib/typescript/src/types/stylesheet.d.ts +4 -4
- package/lib/typescript/src/types/stylesheet.d.ts.map +1 -1
- package/lib/typescript/src/web/convert/object/filter.d.ts.map +1 -1
- package/lib/typescript/src/web/convert/object/transform.d.ts.map +1 -1
- package/lib/typescript/src/web/convert/types.d.ts +1 -1
- package/lib/typescript/src/web/convert/types.d.ts.map +1 -1
- package/lib/typescript/src/web/convert/utils.d.ts +2 -2
- package/lib/typescript/src/web/convert/utils.d.ts.map +1 -1
- package/lib/typescript/src/web/create.d.ts +1 -1
- package/lib/typescript/src/web/create.d.ts.map +1 -1
- package/lib/typescript/src/web/index.d.ts +1 -1
- package/lib/typescript/src/web/index.d.ts.map +1 -1
- package/lib/typescript/src/web/registry.d.ts +1 -1
- package/lib/typescript/src/web/registry.d.ts.map +1 -1
- package/lib/typescript/src/web/runtime.d.ts +1 -1
- package/lib/typescript/src/web/runtime.d.ts.map +1 -1
- package/lib/typescript/src/web/shadowRegistry.d.ts.map +1 -1
- package/lib/typescript/src/web/state.d.ts +1 -1
- package/lib/typescript/src/web/state.d.ts.map +1 -1
- package/lib/typescript/src/web/utils/unistyle.d.ts.map +1 -1
- package/package.json +4 -2
- package/plugin/index.js +27 -29
- package/plugin/stylesheet.js +423 -188
- package/src/components/native/Animated.tsx +2 -2
- package/src/components/native/ImageBackground.tsx +4 -4
- package/src/components/native/NativeText.native.tsx +1 -1
- package/src/components/native/NativeView.native.tsx +1 -1
- package/src/components/native/Pressable.native.tsx +7 -12
- package/src/components/native/Pressable.tsx +1 -1
- package/src/core/createUnistylesElement.native.tsx +1 -1
- package/src/core/createUnistylesElement.tsx +3 -3
- package/src/core/createUnistylesImageBackground.tsx +1 -1
- package/src/core/useProxifiedUnistyles/useProxifiedUnistyles.ts +1 -1
- package/src/core/withUnistyles/withUnistyles.native.tsx +2 -2
- package/src/core/withUnistyles/withUnistyles.tsx +3 -3
- package/src/hooks/useMedia.native.ts +1 -1
- package/src/mq.ts +1 -1
- package/src/server/getServerUnistyles.tsx +1 -1
- package/src/server/hydrateServerUnistyles.ts +1 -1
- package/src/server/resetServerUnistyles.ts +1 -1
- package/src/server/useServerUnistyles.tsx +2 -2
- package/src/specs/StatusBar/index.ts +1 -1
- package/src/specs/StyleSheet/index.ts +3 -3
- package/src/specs/UnistylesRuntime/UnistylesRuntime.nitro.ts +1 -1
- package/src/specs/UnistylesRuntime/index.ts +5 -5
- package/src/specs/index.native.ts +4 -4
- package/src/types/breakpoints.ts +2 -2
- package/src/types/core.ts +1 -1
- package/src/types/stylesheet.ts +4 -4
- package/src/web/convert/index.ts +4 -4
- package/src/web/convert/object/boxShadow.ts +2 -2
- package/src/web/convert/object/filter.ts +3 -3
- package/src/web/convert/object/transform.ts +2 -2
- package/src/web/convert/types.ts +1 -1
- package/src/web/convert/utils.ts +2 -2
- package/src/web/create.ts +1 -1
- package/src/web/index.ts +3 -3
- package/src/web/registry.ts +2 -2
- package/src/web/runtime.ts +2 -2
- package/src/web/shadowRegistry.ts +2 -2
- package/src/web/state.ts +4 -4
- package/src/web/utils/unistyle.ts +3 -3
- package/plugin/common.js +0 -154
package/package.json
CHANGED
@@ -1,14 +1,16 @@
|
|
1
1
|
{
|
2
2
|
"name": "react-native-unistyles",
|
3
|
-
"version": "3.0.0-nightly-
|
3
|
+
"version": "3.0.0-nightly-20250207",
|
4
4
|
"description": "Level up your React Native StyleSheet",
|
5
5
|
"scripts": {
|
6
6
|
"test": "jest",
|
7
7
|
"test:coverage": "jest --passWithNoTests --coverage",
|
8
8
|
"tsc": "node_modules/typescript/bin/tsc --noEmit",
|
9
9
|
"lint": "biome lint",
|
10
|
+
"check": "biome check --write",
|
11
|
+
"check:ci": "biome check",
|
10
12
|
"prepare": "husky && bob build",
|
11
|
-
"precommit": "concurrently 'yarn tsc' 'yarn lint' 'yarn test'",
|
13
|
+
"precommit": "concurrently 'yarn tsc' 'yarn lint' 'yarn check' 'yarn test'",
|
12
14
|
"release": "release-it"
|
13
15
|
},
|
14
16
|
"main": "lib/commonjs/index.js",
|
package/plugin/index.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
const { addUnistylesImport, isInsideNodeModules } = require('./import')
|
2
2
|
const { hasStringRef } = require('./ref')
|
3
|
-
const { isUnistylesStyleSheet,
|
3
|
+
const { isUnistylesStyleSheet, addStyleSheetTag, isKindOfStyleSheet, getStylesDependenciesFromFunction, addDependencies, getStylesDependenciesFromObject } = require('./stylesheet')
|
4
4
|
const { extractVariants } = require('./variants')
|
5
5
|
const { REACT_NATIVE_COMPONENT_NAMES, REPLACE_WITH_UNISTYLES_PATHS, REPLACE_WITH_UNISTYLES_EXOTIC_PATHS, NATIVE_COMPONENTS_PATHS } = require('./consts')
|
6
6
|
const { handleExoticImport } = require('./exotic')
|
@@ -17,6 +17,7 @@ module.exports = function ({ types: t }) {
|
|
17
17
|
.some(path => state.filename.includes(path))
|
18
18
|
|
19
19
|
state.file.hasAnyUnistyle = false
|
20
|
+
state.file.hasUnistylesImport = false
|
20
21
|
state.file.hasVariants = false
|
21
22
|
state.file.styleSheetLocalName = ''
|
22
23
|
state.file.tagNumber = 0
|
@@ -95,6 +96,8 @@ module.exports = function ({ types: t }) {
|
|
95
96
|
const importSource = path.node.source.value
|
96
97
|
|
97
98
|
if (importSource.includes('react-native-unistyles')) {
|
99
|
+
state.file.hasUnistylesImport = true
|
100
|
+
|
98
101
|
path.node.specifiers.forEach(specifier => {
|
99
102
|
if (specifier.imported && specifier.imported.name === 'StyleSheet') {
|
100
103
|
state.file.styleSheetLocalName = specifier.local.name
|
@@ -149,43 +152,38 @@ module.exports = function ({ types: t }) {
|
|
149
152
|
|
150
153
|
const arg = path.node.arguments[0]
|
151
154
|
|
152
|
-
// Object passed to StyleSheet.create
|
155
|
+
// Object passed to StyleSheet.create (may contain variants)
|
153
156
|
if (t.isObjectExpression(arg)) {
|
154
|
-
|
155
|
-
if (t.isObjectProperty(property)) {
|
156
|
-
const propertyValues = getUnistyles(t, property)
|
157
|
+
const detectedDependencies = getStylesDependenciesFromObject(t, path)
|
157
158
|
|
158
|
-
|
159
|
-
|
159
|
+
if (detectedDependencies) {
|
160
|
+
if (t.isObjectExpression(arg)) {
|
161
|
+
arg.properties.forEach(property => {
|
162
|
+
if (detectedDependencies[property.key.name]) {
|
163
|
+
addDependencies(t, state, property.key.name, property, detectedDependencies[property.key.name])
|
164
|
+
}
|
160
165
|
})
|
161
166
|
}
|
162
|
-
}
|
167
|
+
}
|
163
168
|
}
|
164
169
|
|
165
170
|
// Function passed to StyleSheet.create (e.g., theme => ({ container: {} }))
|
166
171
|
if (t.isArrowFunctionExpression(arg) || t.isFunctionExpression(arg)) {
|
167
|
-
const
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
body
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
// maybe user used inlined theme? ({ container: theme.components.container })
|
180
|
-
if (propertyValues.length === 0 && maybeAddThemeDependencyToMemberExpression(t, property, localNames.theme)) {
|
181
|
-
addThemeDependencyToMemberExpression(t, property)
|
172
|
+
const detectedDependencies = getStylesDependenciesFromFunction(t, path)
|
173
|
+
|
174
|
+
if (detectedDependencies) {
|
175
|
+
const body = t.isBlockStatement(arg.body)
|
176
|
+
? arg.body.body.find(statement => t.isReturnStatement(statement)).argument
|
177
|
+
: arg.body
|
178
|
+
|
179
|
+
// Ensure the function body returns an object
|
180
|
+
if (t.isObjectExpression(body)) {
|
181
|
+
body.properties.forEach(property => {
|
182
|
+
if (detectedDependencies[property.key.name]) {
|
183
|
+
addDependencies(t, state, property.key.name, property, detectedDependencies[property.key.name])
|
182
184
|
}
|
183
|
-
|
184
|
-
|
185
|
-
analyzeDependencies(t, state, property.key.name, propertyValue, localNames.theme, localNames.miniRuntime)
|
186
|
-
})
|
187
|
-
}
|
188
|
-
})
|
185
|
+
})
|
186
|
+
}
|
189
187
|
}
|
190
188
|
}
|
191
189
|
}
|