File tree Expand file tree Collapse file tree 4 files changed +35
-36
lines changed Expand file tree Collapse file tree 4 files changed +35
-36
lines changed Original file line number Diff line number Diff line change 7
7
family ,
8
8
observable ,
9
9
observableBatch ,
10
- rootVariables ,
11
10
type Observable ,
12
11
} from "./reactivity" ;
12
+ import { rootVariables } from "./root" ;
13
13
14
14
export function StyleCollection ( ) {
15
15
return null ;
Original file line number Diff line number Diff line change 7
7
type LayoutRectangle ,
8
8
} from "react-native" ;
9
9
10
- import type { StyleDescriptor , VariableValue } from "../../compiler" ;
11
- import { testMediaQuery } from "./conditions/media-query" ;
10
+ import type { StyleDescriptor } from "../../compiler" ;
12
11
13
12
export type Effect = {
14
13
observers : Set < Effect > ;
@@ -190,33 +189,6 @@ export const VariableContext = createContext<VariableContextValue>({
190
189
[ VAR_SYMBOL ] : true ,
191
190
} ) ;
192
191
193
- const rootVariableFamily = ( ) => {
194
- return family < string , Observable < StyleDescriptor , VariableValue [ ] > > ( ( ) => {
195
- const obs = observable < StyleDescriptor , VariableValue [ ] > (
196
- ( read , variableValue ) => {
197
- if ( ! variableValue ) return undefined ;
198
-
199
- for ( const [ value , mediaQuery ] of variableValue ) {
200
- if ( ! mediaQuery ) {
201
- return value ;
202
- }
203
-
204
- if ( testMediaQuery ( mediaQuery , read ) ) {
205
- return value ;
206
- }
207
- }
208
-
209
- return undefined ;
210
- } ,
211
- ) ;
212
-
213
- return obs ;
214
- } ) ;
215
- } ;
216
-
217
- export const rootVariables = rootVariableFamily ( ) ;
218
- export const universalVariables = rootVariableFamily ( ) ;
219
-
220
192
/** Units *********************************************************************/
221
193
222
194
export const rem = observable ( 14 ) ;
Original file line number Diff line number Diff line change
1
+ import type { StyleDescriptor , VariableValue } from "react-native-css/compiler" ;
2
+
3
+ import { testMediaQuery } from "./conditions/media-query" ;
4
+ import { family , observable , type Observable } from "./reactivity" ;
5
+
6
+ const rootVariableFamily = ( ) => {
7
+ return family < string , Observable < StyleDescriptor , VariableValue [ ] > > ( ( ) => {
8
+ const obs = observable < StyleDescriptor , VariableValue [ ] > (
9
+ ( read , variableValue ) => {
10
+ if ( ! variableValue ) return undefined ;
11
+
12
+ for ( const [ value , mediaQuery ] of variableValue ) {
13
+ if ( ! mediaQuery ) {
14
+ return value ;
15
+ }
16
+
17
+ if ( testMediaQuery ( mediaQuery , read ) ) {
18
+ return value ;
19
+ }
20
+ }
21
+
22
+ return undefined ;
23
+ } ,
24
+ ) ;
25
+
26
+ return obs ;
27
+ } ) ;
28
+ } ;
29
+
30
+ export const rootVariables = rootVariableFamily ( ) ;
31
+ export const universalVariables = rootVariableFamily ( ) ;
Original file line number Diff line number Diff line change 1
1
import type { StyleDescriptor , StyleFunction } from "../../../compiler" ;
2
2
import { isStyleDescriptorArray } from "../../utils" ;
3
- import {
4
- rootVariables ,
5
- universalVariables ,
6
- VAR_SYMBOL ,
7
- type Getter ,
8
- } from "../reactivity" ;
3
+ import { VAR_SYMBOL , type Getter } from "../reactivity" ;
4
+ import { rootVariables , universalVariables } from "../root" ;
9
5
import type { ResolveValueOptions , SimpleResolveValue } from "./resolve" ;
10
6
11
7
export function varResolver (
You can’t perform that action at this time.
0 commit comments