react-native-unistyles 3.0.0-nightly-20250607 → 3.0.0-nightly-20250613
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/README.md +4 -6
- package/android/src/main/cxx/NativeUnistylesModule.cpp +2 -1
- package/android/src/main/cxx/NativeUnistylesModule.h +4 -0
- package/android/src/main/java/com/unistyles/UnistylesModule.kt +7 -0
- package/cxx/core/UnistyleWrapper.h +4 -1
- package/cxx/core/UnistylesRegistry.cpp +7 -6
- package/cxx/core/UnistylesRegistry.h +2 -1
- package/ios/UnistylesModuleOnLoad.mm +5 -0
- package/lib/commonjs/components/AdaptiveTheme.js +35 -0
- package/lib/commonjs/components/AdaptiveTheme.js.map +1 -0
- package/lib/commonjs/components/ApplyScopedTheme.js +19 -0
- package/lib/commonjs/components/ApplyScopedTheme.js.map +1 -0
- package/lib/commonjs/components/NamedTheme.js +31 -0
- package/lib/commonjs/components/NamedTheme.js.map +1 -0
- package/lib/commonjs/components/ScopedTheme.js +24 -23
- package/lib/commonjs/components/ScopedTheme.js.map +1 -1
- package/lib/commonjs/core/withUnistyles/withUnistyles.native.js.map +1 -1
- package/lib/commonjs/reanimated/index.js +7 -0
- package/lib/commonjs/reanimated/index.js.map +1 -1
- package/lib/commonjs/reanimated/variant/index.js +17 -0
- package/lib/commonjs/reanimated/variant/index.js.map +1 -0
- package/lib/commonjs/reanimated/variant/types.js +2 -0
- package/lib/commonjs/reanimated/variant/types.js.map +1 -0
- package/lib/commonjs/reanimated/variant/useAnimatedVariantColor.js +38 -0
- package/lib/commonjs/reanimated/variant/useAnimatedVariantColor.js.map +1 -0
- package/lib/commonjs/reanimated/variant/useUpdateVariantColor.js +66 -0
- package/lib/commonjs/reanimated/variant/useUpdateVariantColor.js.map +1 -0
- package/lib/commonjs/reanimated/variant/useUpdateVariantColor.native.js +39 -0
- package/lib/commonjs/reanimated/variant/useUpdateVariantColor.native.js.map +1 -0
- package/lib/commonjs/specs/ShadowRegistry/index.js +6 -1
- package/lib/commonjs/specs/ShadowRegistry/index.js.map +1 -1
- package/lib/commonjs/web/convert/pseudo.js +13 -3
- package/lib/commonjs/web/convert/pseudo.js.map +1 -1
- package/lib/commonjs/web/create.js +1 -1
- package/lib/commonjs/web/create.js.map +1 -1
- package/lib/commonjs/web/css/core.js +3 -1
- package/lib/commonjs/web/css/core.js.map +1 -1
- package/lib/commonjs/web/listener.js +2 -0
- package/lib/commonjs/web/listener.js.map +1 -1
- package/lib/commonjs/web/shadowRegistry.js +3 -2
- package/lib/commonjs/web/shadowRegistry.js.map +1 -1
- package/lib/commonjs/web/types.js.map +1 -1
- package/lib/commonjs/web/utils/unistyle.js +13 -1
- package/lib/commonjs/web/utils/unistyle.js.map +1 -1
- package/lib/module/components/AdaptiveTheme.js +29 -0
- package/lib/module/components/AdaptiveTheme.js.map +1 -0
- package/lib/module/components/ApplyScopedTheme.js +14 -0
- package/lib/module/components/ApplyScopedTheme.js.map +1 -0
- package/lib/module/components/NamedTheme.js +25 -0
- package/lib/module/components/NamedTheme.js.map +1 -0
- package/lib/module/components/ScopedTheme.js +24 -23
- package/lib/module/components/ScopedTheme.js.map +1 -1
- package/lib/module/core/withUnistyles/withUnistyles.native.js.map +1 -1
- package/lib/module/reanimated/index.js +1 -0
- package/lib/module/reanimated/index.js.map +1 -1
- package/lib/module/reanimated/variant/index.js +4 -0
- package/lib/module/reanimated/variant/index.js.map +1 -0
- package/lib/module/reanimated/variant/types.js +2 -0
- package/lib/module/reanimated/variant/types.js.map +1 -0
- package/lib/module/reanimated/variant/useAnimatedVariantColor.js +33 -0
- package/lib/module/reanimated/variant/useAnimatedVariantColor.js.map +1 -0
- package/lib/module/reanimated/variant/useUpdateVariantColor.js +61 -0
- package/lib/module/reanimated/variant/useUpdateVariantColor.js.map +1 -0
- package/lib/module/reanimated/variant/useUpdateVariantColor.native.js +34 -0
- package/lib/module/reanimated/variant/useUpdateVariantColor.native.js.map +1 -0
- package/lib/module/specs/ShadowRegistry/index.js +6 -1
- package/lib/module/specs/ShadowRegistry/index.js.map +1 -1
- package/lib/module/web/convert/pseudo.js +10 -2
- package/lib/module/web/convert/pseudo.js.map +1 -1
- package/lib/module/web/create.js +1 -1
- package/lib/module/web/create.js.map +1 -1
- package/lib/module/web/css/core.js +3 -1
- package/lib/module/web/css/core.js.map +1 -1
- package/lib/module/web/listener.js +2 -0
- package/lib/module/web/listener.js.map +1 -1
- package/lib/module/web/shadowRegistry.js +3 -2
- package/lib/module/web/shadowRegistry.js.map +1 -1
- package/lib/module/web/types.js.map +1 -1
- package/lib/module/web/utils/unistyle.js +12 -1
- package/lib/module/web/utils/unistyle.js.map +1 -1
- package/lib/typescript/plugin/src/consts.d.ts.map +1 -1
- package/lib/typescript/src/components/AdaptiveTheme.d.ts +8 -0
- package/lib/typescript/src/components/AdaptiveTheme.d.ts.map +1 -0
- package/lib/typescript/src/components/ApplyScopedTheme.d.ts +7 -0
- package/lib/typescript/src/components/ApplyScopedTheme.d.ts.map +1 -0
- package/lib/typescript/src/components/NamedTheme.d.ts +10 -0
- package/lib/typescript/src/components/NamedTheme.d.ts.map +1 -0
- package/lib/typescript/src/components/ScopedTheme.d.ts +4 -0
- package/lib/typescript/src/components/ScopedTheme.d.ts.map +1 -1
- package/lib/typescript/src/core/withUnistyles/withUnistyles.native.d.ts.map +1 -1
- package/lib/typescript/src/reanimated/index.d.ts +1 -0
- package/lib/typescript/src/reanimated/index.d.ts.map +1 -1
- package/lib/typescript/src/reanimated/variant/index.d.ts +2 -0
- package/lib/typescript/src/reanimated/variant/index.d.ts.map +1 -0
- package/lib/typescript/src/reanimated/variant/types.d.ts +10 -0
- package/lib/typescript/src/reanimated/variant/types.d.ts.map +1 -0
- package/lib/typescript/src/reanimated/variant/useAnimatedVariantColor.d.ts +3 -0
- package/lib/typescript/src/reanimated/variant/useAnimatedVariantColor.d.ts.map +1 -0
- package/lib/typescript/src/reanimated/variant/useUpdateVariantColor.d.ts +6 -0
- package/lib/typescript/src/reanimated/variant/useUpdateVariantColor.d.ts.map +1 -0
- package/lib/typescript/src/reanimated/variant/useUpdateVariantColor.native.d.ts +6 -0
- package/lib/typescript/src/reanimated/variant/useUpdateVariantColor.native.d.ts.map +1 -0
- package/lib/typescript/src/specs/ShadowRegistry/index.d.ts.map +1 -1
- package/lib/typescript/src/web/convert/pseudo.d.ts +6 -3
- package/lib/typescript/src/web/convert/pseudo.d.ts.map +1 -1
- package/lib/typescript/src/web/css/core.d.ts.map +1 -1
- package/lib/typescript/src/web/listener.d.ts.map +1 -1
- package/lib/typescript/src/web/shadowRegistry.d.ts +1 -0
- package/lib/typescript/src/web/shadowRegistry.d.ts.map +1 -1
- package/lib/typescript/src/web/types.d.ts +4 -1
- package/lib/typescript/src/web/types.d.ts.map +1 -1
- package/lib/typescript/src/web/utils/unistyle.d.ts +4 -1
- package/lib/typescript/src/web/utils/unistyle.d.ts.map +1 -1
- package/package.json +3 -3
- package/plugin/index.d.ts +1 -1
- package/plugin/index.js +1 -4
- package/repack-plugin/index.js +1 -4
- package/src/components/AdaptiveTheme.tsx +34 -0
- package/src/components/ApplyScopedTheme.tsx +17 -0
- package/src/components/NamedTheme.tsx +33 -0
- package/src/components/ScopedTheme.tsx +42 -27
- package/src/core/withUnistyles/withUnistyles.native.tsx +1 -0
- package/src/reanimated/index.ts +1 -0
- package/src/reanimated/variant/index.ts +1 -0
- package/src/reanimated/variant/types.ts +14 -0
- package/src/reanimated/variant/useAnimatedVariantColor.ts +38 -0
- package/src/reanimated/variant/useUpdateVariantColor.native.ts +38 -0
- package/src/reanimated/variant/useUpdateVariantColor.ts +81 -0
- package/src/specs/ShadowRegistry/index.ts +6 -1
- package/src/web/convert/pseudo.ts +23 -52
- package/src/web/create.ts +1 -1
- package/src/web/css/core.ts +3 -1
- package/src/web/listener.ts +2 -0
- package/src/web/shadowRegistry.ts +2 -2
- package/src/web/types.ts +4 -1
- package/src/web/utils/unistyle.ts +18 -2
|
@@ -3,7 +3,8 @@ import type { UnistylesBreakpoints } from '../../global'
|
|
|
3
3
|
import type { UnistyleDependency } from '../../specs/NativePlatform/NativePlatform.nitro'
|
|
4
4
|
import { ColorScheme, Orientation } from '../../specs/types'
|
|
5
5
|
import type { StyleSheet, StyleSheetWithSuperPowers, UnistylesValues } from '../../types/stylesheet'
|
|
6
|
-
import { isUnistylesMq, parseMq } from '../../utils'
|
|
6
|
+
import { isDefined, isUnistylesMq, parseMq } from '../../utils'
|
|
7
|
+
import type { UnistylesRuntime } from '../runtime'
|
|
7
8
|
import * as unistyles from '../services'
|
|
8
9
|
import { UNI_GENERATED_KEYS, type UniGeneratedKey, type UniGeneratedStyle } from '../types'
|
|
9
10
|
import { hyphenate, keyInObject, reduceObject } from './common'
|
|
@@ -22,7 +23,7 @@ export type UnistyleSecrets = {
|
|
|
22
23
|
__uni__stylesheet: StyleSheetWithSuperPowers<StyleSheet>,
|
|
23
24
|
__uni__key: string,
|
|
24
25
|
__uni__args?: Array<any>,
|
|
25
|
-
|
|
26
|
+
__stylesheetVariants: Record<string, string | boolean | undefined>
|
|
26
27
|
}
|
|
27
28
|
|
|
28
29
|
export const assignSecrets = <T>(object: T, secrets: UnistyleSecrets) => {
|
|
@@ -158,3 +159,18 @@ export const convertTheme = (key: string, value: any, prev = '-'): [string, any]
|
|
|
158
159
|
|
|
159
160
|
return [key, value]
|
|
160
161
|
}
|
|
162
|
+
|
|
163
|
+
export const getClosestBreakpointValue = <T>(runtime: UnistylesRuntime, values: Partial<Record<keyof UnistylesBreakpoints, T>>) => {
|
|
164
|
+
const breakpoints = runtime.breakpoints
|
|
165
|
+
const breakpointValues = Object.entries(values)
|
|
166
|
+
// Filter out non-breakpoint values
|
|
167
|
+
.filter((pair): pair is [keyof UnistylesBreakpoints, T] => pair[0] in breakpoints)
|
|
168
|
+
// Sort in descending order
|
|
169
|
+
.sort(([a], [b]) => (breakpoints[b] ?? 0) - (breakpoints[a] ?? 0))
|
|
170
|
+
// Get breakpoint value with highest priority
|
|
171
|
+
const [_, currentBreakpointValue] = breakpointValues.find(
|
|
172
|
+
([key]) => isDefined(runtime.breakpoint) && (breakpoints[key] ?? 0) <= (breakpoints[runtime.breakpoint] ?? 0)
|
|
173
|
+
) ?? []
|
|
174
|
+
|
|
175
|
+
return currentBreakpointValue
|
|
176
|
+
}
|