react-native-css 3.0.0-nightly.75f8b74 → 3.0.0-nightly.fa5e95b
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/dist/commonjs/compiler/atRules.js +1 -1
- package/dist/commonjs/compiler/attributes.test.js +1 -1
- package/dist/commonjs/compiler/attributes.test.js.map +1 -1
- package/dist/commonjs/compiler/compiler.js +25 -14
- package/dist/commonjs/compiler/compiler.js.map +1 -1
- package/dist/commonjs/compiler/declarations.js +40 -11
- package/dist/commonjs/compiler/declarations.js.map +1 -1
- package/dist/commonjs/compiler/inheritance.test.js +3 -3
- package/dist/commonjs/compiler/inheritance.test.js.map +1 -1
- package/dist/commonjs/compiler/stylesheet.js +87 -29
- package/dist/commonjs/compiler/stylesheet.js.map +1 -1
- package/dist/commonjs/jest/index.js +16 -5
- package/dist/commonjs/jest/index.js.map +1 -1
- package/dist/commonjs/poison.pill.js +4 -1
- package/dist/commonjs/poison.pill.js.map +1 -1
- package/dist/commonjs/runtime/native/conditions/container-query.js +21 -21
- package/dist/commonjs/runtime/native/conditions/container-query.js.map +1 -1
- package/dist/commonjs/runtime/native/conditions/guards.js.map +1 -1
- package/dist/commonjs/runtime/native/conditions/index.js +8 -8
- package/dist/commonjs/runtime/native/conditions/index.js.map +1 -1
- package/dist/commonjs/runtime/native/conditions/media-query.js +17 -17
- package/dist/commonjs/runtime/native/conditions/media-query.js.map +1 -1
- package/dist/commonjs/runtime/native/react/interaction.js +10 -10
- package/dist/commonjs/runtime/native/react/interaction.js.map +1 -1
- package/dist/commonjs/runtime/native/react/rules.js +9 -9
- package/dist/commonjs/runtime/native/react/rules.js.map +1 -1
- package/dist/commonjs/runtime/native/react/useNativeCss.js +1 -0
- package/dist/commonjs/runtime/native/react/useNativeCss.js.map +1 -1
- package/dist/commonjs/runtime/native/reactivity.js +15 -6
- package/dist/commonjs/runtime/native/reactivity.js.map +1 -1
- package/dist/commonjs/runtime/native/styles/calculate-props.js +53 -48
- package/dist/commonjs/runtime/native/styles/calculate-props.js.map +1 -1
- package/dist/commonjs/runtime/native/styles/index.js +12 -12
- package/dist/commonjs/runtime/native/styles/index.js.map +1 -1
- package/dist/commonjs/runtime/native/styles/units.js +6 -3
- package/dist/commonjs/runtime/native/styles/units.js.map +1 -1
- package/dist/module/compiler/atRules.js +1 -1
- package/dist/module/compiler/attributes.test.js +1 -1
- package/dist/module/compiler/attributes.test.js.map +1 -1
- package/dist/module/compiler/compiler.js +25 -14
- package/dist/module/compiler/compiler.js.map +1 -1
- package/dist/module/compiler/compiler.types.js.map +1 -1
- package/dist/module/compiler/declarations.js +39 -11
- package/dist/module/compiler/declarations.js.map +1 -1
- package/dist/module/compiler/inheritance.test.js +3 -3
- package/dist/module/compiler/inheritance.test.js.map +1 -1
- package/dist/module/compiler/stylesheet.js +87 -29
- package/dist/module/compiler/stylesheet.js.map +1 -1
- package/dist/module/jest/index.js +16 -4
- package/dist/module/jest/index.js.map +1 -1
- package/dist/module/poison.pill.js +4 -1
- package/dist/module/poison.pill.js.map +1 -1
- package/dist/module/runtime/native/conditions/container-query.js +21 -21
- package/dist/module/runtime/native/conditions/container-query.js.map +1 -1
- package/dist/module/runtime/native/conditions/guards.js.map +1 -1
- package/dist/module/runtime/native/conditions/index.js +8 -8
- package/dist/module/runtime/native/conditions/index.js.map +1 -1
- package/dist/module/runtime/native/conditions/media-query.js +17 -17
- package/dist/module/runtime/native/conditions/media-query.js.map +1 -1
- package/dist/module/runtime/native/react/interaction.js +10 -10
- package/dist/module/runtime/native/react/interaction.js.map +1 -1
- package/dist/module/runtime/native/react/rules.js +9 -9
- package/dist/module/runtime/native/react/rules.js.map +1 -1
- package/dist/module/runtime/native/react/useNativeCss.js +1 -0
- package/dist/module/runtime/native/react/useNativeCss.js.map +1 -1
- package/dist/module/runtime/native/reactivity.js +15 -6
- package/dist/module/runtime/native/reactivity.js.map +1 -1
- package/dist/module/runtime/native/styles/calculate-props.js +53 -48
- package/dist/module/runtime/native/styles/calculate-props.js.map +1 -1
- package/dist/module/runtime/native/styles/index.js +12 -12
- package/dist/module/runtime/native/styles/index.js.map +1 -1
- package/dist/module/runtime/native/styles/units.js +6 -3
- package/dist/module/runtime/native/styles/units.js.map +1 -1
- package/dist/typescript/commonjs/src/compiler/compiler.d.ts +9 -2
- package/dist/typescript/commonjs/src/compiler/compiler.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/compiler/compiler.types.d.ts +5 -4
- package/dist/typescript/commonjs/src/compiler/compiler.types.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/compiler/declarations.d.ts +2 -1
- package/dist/typescript/commonjs/src/compiler/declarations.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/compiler/stylesheet.d.ts +16 -2
- package/dist/typescript/commonjs/src/compiler/stylesheet.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/jest/index.d.ts +8 -1
- package/dist/typescript/commonjs/src/jest/index.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/poison.pill.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/conditions/container-query.d.ts +3 -3
- package/dist/typescript/commonjs/src/runtime/native/conditions/container-query.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/conditions/guards.d.ts +2 -2
- package/dist/typescript/commonjs/src/runtime/native/conditions/guards.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/conditions/index.d.ts +2 -2
- package/dist/typescript/commonjs/src/runtime/native/conditions/index.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/conditions/media-query.d.ts +2 -2
- package/dist/typescript/commonjs/src/runtime/native/conditions/media-query.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/react/interaction.d.ts +2 -2
- package/dist/typescript/commonjs/src/runtime/native/react/interaction.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/react/useNativeCss.d.ts +2 -1
- package/dist/typescript/commonjs/src/runtime/native/react/useNativeCss.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/reactivity.d.ts +4 -4
- package/dist/typescript/commonjs/src/runtime/native/reactivity.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/styles/calculate-props.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/styles/units.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/compiler.d.ts +9 -2
- package/dist/typescript/module/src/compiler/compiler.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/compiler.types.d.ts +5 -4
- package/dist/typescript/module/src/compiler/compiler.types.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/declarations.d.ts +2 -1
- package/dist/typescript/module/src/compiler/declarations.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/stylesheet.d.ts +16 -2
- package/dist/typescript/module/src/compiler/stylesheet.d.ts.map +1 -1
- package/dist/typescript/module/src/jest/index.d.ts +8 -1
- package/dist/typescript/module/src/jest/index.d.ts.map +1 -1
- package/dist/typescript/module/src/poison.pill.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/conditions/container-query.d.ts +3 -3
- package/dist/typescript/module/src/runtime/native/conditions/container-query.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/conditions/guards.d.ts +2 -2
- package/dist/typescript/module/src/runtime/native/conditions/guards.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/conditions/index.d.ts +2 -2
- package/dist/typescript/module/src/runtime/native/conditions/index.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/conditions/media-query.d.ts +2 -2
- package/dist/typescript/module/src/runtime/native/conditions/media-query.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/react/interaction.d.ts +2 -2
- package/dist/typescript/module/src/runtime/native/react/interaction.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/react/useNativeCss.d.ts +2 -1
- package/dist/typescript/module/src/runtime/native/react/useNativeCss.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/reactivity.d.ts +4 -4
- package/dist/typescript/module/src/runtime/native/reactivity.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/styles/calculate-props.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/styles/units.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/compiler/atRules.ts +1 -1
- package/src/compiler/attributes.test.ts +1 -1
- package/src/compiler/compiler.ts +29 -24
- package/src/compiler/compiler.types.ts +7 -5
- package/src/compiler/declarations.ts +59 -13
- package/src/compiler/inheritance.test.ts +3 -3
- package/src/compiler/stylesheet.ts +113 -32
- package/src/jest/index.ts +19 -4
- package/src/poison.pill.ts +5 -1
- package/src/runtime/native/conditions/container-query.ts +22 -22
- package/src/runtime/native/conditions/guards.ts +1 -2
- package/src/runtime/native/conditions/index.ts +9 -9
- package/src/runtime/native/conditions/media-query.ts +18 -20
- package/src/runtime/native/react/interaction.ts +12 -12
- package/src/runtime/native/react/rules.ts +9 -9
- package/src/runtime/native/react/useNativeCss.ts +3 -0
- package/src/runtime/native/reactivity.ts +22 -13
- package/src/runtime/native/styles/calculate-props.ts +59 -49
- package/src/runtime/native/styles/index.ts +12 -12
- package/src/runtime/native/styles/units.ts +7 -3
|
@@ -104,7 +104,7 @@ export function updateRules(
|
|
|
104
104
|
if (
|
|
105
105
|
!testRule(
|
|
106
106
|
rule,
|
|
107
|
-
state.
|
|
107
|
+
state.ruleEffectGetter,
|
|
108
108
|
currentProps,
|
|
109
109
|
guards,
|
|
110
110
|
inheritedContainers,
|
|
@@ -132,20 +132,20 @@ export function updateRules(
|
|
|
132
132
|
containers = {
|
|
133
133
|
...inheritedContainers,
|
|
134
134
|
// This container becomes the default container
|
|
135
|
-
[DEFAULT_CONTAINER_NAME]: state.
|
|
135
|
+
[DEFAULT_CONTAINER_NAME]: state.ruleEffectGetter,
|
|
136
136
|
};
|
|
137
137
|
}
|
|
138
138
|
|
|
139
139
|
// This this component as the named container
|
|
140
140
|
for (const name of rule.c) {
|
|
141
|
-
containers![name] = state.
|
|
141
|
+
containers![name] = state.ruleEffectGetter;
|
|
142
142
|
}
|
|
143
143
|
|
|
144
144
|
// Enable hover/active/focus/layout handlers
|
|
145
|
-
hoverFamily(state.
|
|
146
|
-
activeFamily(state.
|
|
147
|
-
focusFamily(state.
|
|
148
|
-
containerLayoutFamily(state.
|
|
145
|
+
hoverFamily(state.ruleEffectGetter);
|
|
146
|
+
activeFamily(state.ruleEffectGetter);
|
|
147
|
+
focusFamily(state.ruleEffectGetter);
|
|
148
|
+
containerLayoutFamily(state.ruleEffectGetter);
|
|
149
149
|
}
|
|
150
150
|
|
|
151
151
|
if (rule.a) {
|
|
@@ -163,7 +163,7 @@ export function updateRules(
|
|
|
163
163
|
|
|
164
164
|
if (process.env.NODE_ENV !== "production") {
|
|
165
165
|
if (isRerender) {
|
|
166
|
-
let pressable = activeFamily.has(state.
|
|
166
|
+
let pressable = activeFamily.has(state.ruleEffectGetter);
|
|
167
167
|
|
|
168
168
|
if (Boolean(variables) !== Boolean(state.variables)) {
|
|
169
169
|
console.log(
|
|
@@ -190,7 +190,7 @@ export function updateRules(
|
|
|
190
190
|
let pressable =
|
|
191
191
|
process.env.NODE_ENV === "production"
|
|
192
192
|
? undefined
|
|
193
|
-
: activeFamily.has(state.
|
|
193
|
+
: activeFamily.has(state.ruleEffectGetter);
|
|
194
194
|
|
|
195
195
|
if (!rules.size && !state.stylesObs && !inlineVariables.size) {
|
|
196
196
|
return {
|
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
VariableContext,
|
|
18
18
|
type ContainerContextValue,
|
|
19
19
|
type Effect,
|
|
20
|
+
type Getter,
|
|
20
21
|
type VariableContextValue,
|
|
21
22
|
} from "../reactivity";
|
|
22
23
|
import { getStyledProps, stylesFamily } from "../styles";
|
|
@@ -35,6 +36,7 @@ export type ComponentState = {
|
|
|
35
36
|
|
|
36
37
|
/** Reactive tracking */
|
|
37
38
|
ruleEffect: Effect;
|
|
39
|
+
ruleEffectGetter: Getter;
|
|
38
40
|
styleEffect: Effect;
|
|
39
41
|
|
|
40
42
|
/** The components props */
|
|
@@ -94,6 +96,7 @@ export function useNativeCss(
|
|
|
94
96
|
return updateRules(
|
|
95
97
|
{
|
|
96
98
|
ruleEffect,
|
|
99
|
+
ruleEffectGetter: (observable) => observable.get(ruleEffect),
|
|
97
100
|
styleEffect,
|
|
98
101
|
configs,
|
|
99
102
|
inheritedContainers,
|
|
@@ -7,7 +7,8 @@ import {
|
|
|
7
7
|
type LayoutRectangle,
|
|
8
8
|
} from "react-native";
|
|
9
9
|
|
|
10
|
-
import type {
|
|
10
|
+
import type { StyleDescriptor, VariableValue } from "../../compiler";
|
|
11
|
+
import { testMediaQuery } from "./conditions/media-query";
|
|
11
12
|
|
|
12
13
|
export type Effect = {
|
|
13
14
|
observers: Set<Effect>;
|
|
@@ -189,24 +190,32 @@ export const VariableContext = createContext<VariableContextValue>({
|
|
|
189
190
|
[VAR_SYMBOL]: true,
|
|
190
191
|
});
|
|
191
192
|
|
|
192
|
-
const
|
|
193
|
-
return family<string, Observable<StyleDescriptor,
|
|
194
|
-
const obs = observable<StyleDescriptor,
|
|
195
|
-
(read,
|
|
196
|
-
|
|
197
|
-
read(colorScheme) ?? Appearance.getColorScheme() ?? "light";
|
|
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
198
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
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;
|
|
202
210
|
},
|
|
203
211
|
);
|
|
204
212
|
|
|
205
213
|
return obs;
|
|
206
214
|
});
|
|
207
215
|
};
|
|
208
|
-
|
|
209
|
-
export const
|
|
216
|
+
|
|
217
|
+
export const rootVariables = rootVariableFamily();
|
|
218
|
+
export const universalVariables = rootVariableFamily();
|
|
210
219
|
|
|
211
220
|
/** Units *********************************************************************/
|
|
212
221
|
|
|
@@ -237,7 +246,7 @@ Appearance.addChangeListener((event) => colorScheme.set(event.colorScheme));
|
|
|
237
246
|
|
|
238
247
|
/** Containers ****************************************************************/
|
|
239
248
|
|
|
240
|
-
export type ContainerContextValue = Record<string,
|
|
249
|
+
export type ContainerContextValue = Record<string, WeakKey>;
|
|
241
250
|
export const ContainerContext = createContext<ContainerContextValue>({});
|
|
242
251
|
|
|
243
252
|
export const containerLayoutFamily = weakFamily(() => {
|
|
@@ -103,63 +103,73 @@ export function applyDeclarations(
|
|
|
103
103
|
// Dynamic styles
|
|
104
104
|
let value: any = declaration[0];
|
|
105
105
|
let propPath = declaration[1];
|
|
106
|
-
let prop
|
|
106
|
+
let prop: string;
|
|
107
107
|
|
|
108
|
-
if (
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
108
|
+
if (Array.isArray(propPath)) {
|
|
109
|
+
const [first, ...rest] = propPath;
|
|
110
|
+
|
|
111
|
+
if (!first) {
|
|
112
|
+
continue;
|
|
112
113
|
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
114
|
+
|
|
115
|
+
const final = rest.pop();
|
|
116
|
+
|
|
117
|
+
if (final) {
|
|
118
|
+
if (first !== "*") {
|
|
119
|
+
topLevelTarget[first] ??= {};
|
|
120
|
+
target = topLevelTarget[first];
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
for (prop of rest) {
|
|
124
|
+
target[prop] ??= {};
|
|
125
|
+
target = target[prop];
|
|
121
126
|
}
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
127
|
|
|
125
|
-
|
|
126
|
-
const shouldDelay = declaration[2];
|
|
127
|
-
|
|
128
|
-
if (shouldDelay) {
|
|
129
|
-
/**
|
|
130
|
-
* We need to delay the resolution of this value until after all
|
|
131
|
-
* styles have been calculated. But another style might override
|
|
132
|
-
* this value. So we set a placeholder value and only override
|
|
133
|
-
* if the placeholder is preserved
|
|
134
|
-
*
|
|
135
|
-
* This also ensures the props exist, so setValue will properly
|
|
136
|
-
* mutate the props object and not create a new one
|
|
137
|
-
*/
|
|
138
|
-
const originalValue = value;
|
|
139
|
-
value = {};
|
|
140
|
-
delayedStyles.push(() => {
|
|
141
|
-
if (target[prop] === value) {
|
|
142
|
-
delete target[prop];
|
|
143
|
-
value = resolveValue(originalValue, get, {
|
|
144
|
-
inlineVariables,
|
|
145
|
-
inheritedVariables,
|
|
146
|
-
renderGuards: guards,
|
|
147
|
-
calculateProps,
|
|
148
|
-
});
|
|
149
|
-
applyValue(target, prop, value);
|
|
150
|
-
}
|
|
151
|
-
});
|
|
128
|
+
prop = final;
|
|
152
129
|
} else {
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
inheritedVariables,
|
|
156
|
-
renderGuards: guards,
|
|
157
|
-
calculateProps,
|
|
158
|
-
});
|
|
130
|
+
target = topLevelTarget;
|
|
131
|
+
prop = first;
|
|
159
132
|
}
|
|
133
|
+
} else {
|
|
134
|
+
prop = propPath;
|
|
135
|
+
}
|
|
160
136
|
|
|
161
|
-
|
|
137
|
+
const shouldDelay = declaration[2];
|
|
138
|
+
|
|
139
|
+
if (shouldDelay) {
|
|
140
|
+
/**
|
|
141
|
+
* We need to delay the resolution of this value until after all
|
|
142
|
+
* styles have been calculated. But another style might override
|
|
143
|
+
* this value. So we set a placeholder value and only override
|
|
144
|
+
* if the placeholder is preserved
|
|
145
|
+
*
|
|
146
|
+
* This also ensures the props exist, so setValue will properly
|
|
147
|
+
* mutate the props object and not create a new one
|
|
148
|
+
*/
|
|
149
|
+
const originalValue = value;
|
|
150
|
+
value = {};
|
|
151
|
+
delayedStyles.push(() => {
|
|
152
|
+
if (target[prop] === value) {
|
|
153
|
+
delete target[prop];
|
|
154
|
+
value = resolveValue(originalValue, get, {
|
|
155
|
+
inlineVariables,
|
|
156
|
+
inheritedVariables,
|
|
157
|
+
renderGuards: guards,
|
|
158
|
+
calculateProps,
|
|
159
|
+
});
|
|
160
|
+
applyValue(target, prop, value);
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
} else {
|
|
164
|
+
value = resolveValue(value, get, {
|
|
165
|
+
inlineVariables,
|
|
166
|
+
inheritedVariables,
|
|
167
|
+
renderGuards: guards,
|
|
168
|
+
calculateProps,
|
|
169
|
+
});
|
|
162
170
|
}
|
|
171
|
+
|
|
172
|
+
applyValue(target, prop, value);
|
|
163
173
|
}
|
|
164
174
|
}
|
|
165
175
|
}
|
|
@@ -55,57 +55,57 @@ export function getStyledProps(
|
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
// Apply the handlers
|
|
58
|
-
if (hoverFamily.has(state.
|
|
58
|
+
if (hoverFamily.has(state.ruleEffectGetter)) {
|
|
59
59
|
result ??= {};
|
|
60
60
|
result.onHoverIn = getInteractionHandler(
|
|
61
|
-
state.
|
|
61
|
+
state.ruleEffectGetter,
|
|
62
62
|
"onHoverIn",
|
|
63
63
|
inline?.onHoverIn,
|
|
64
64
|
);
|
|
65
65
|
result.onHoverOut = getInteractionHandler(
|
|
66
|
-
state.
|
|
66
|
+
state.ruleEffectGetter,
|
|
67
67
|
"onHoverOut",
|
|
68
68
|
inline?.onHoverOut,
|
|
69
69
|
);
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
if (activeFamily.has(state.
|
|
72
|
+
if (activeFamily.has(state.ruleEffectGetter)) {
|
|
73
73
|
result ??= {};
|
|
74
74
|
result.onPress = getInteractionHandler(
|
|
75
|
-
state.
|
|
75
|
+
state.ruleEffectGetter,
|
|
76
76
|
"onPress",
|
|
77
77
|
inline?.onPress,
|
|
78
78
|
);
|
|
79
79
|
result.onPressIn = getInteractionHandler(
|
|
80
|
-
state.
|
|
80
|
+
state.ruleEffectGetter,
|
|
81
81
|
"onPressIn",
|
|
82
82
|
inline?.onPressIn,
|
|
83
83
|
);
|
|
84
84
|
result.onPressOut = getInteractionHandler(
|
|
85
|
-
state.
|
|
85
|
+
state.ruleEffectGetter,
|
|
86
86
|
"onPressOut",
|
|
87
87
|
inline?.onPressOut,
|
|
88
88
|
);
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
-
if (focusFamily.has(state.
|
|
91
|
+
if (focusFamily.has(state.ruleEffectGetter)) {
|
|
92
92
|
result ??= {};
|
|
93
93
|
result.onBlur = getInteractionHandler(
|
|
94
|
-
state.
|
|
94
|
+
state.ruleEffectGetter,
|
|
95
95
|
"onBlur",
|
|
96
96
|
inline?.onBlur,
|
|
97
97
|
);
|
|
98
98
|
result.onFocus = getInteractionHandler(
|
|
99
|
-
state.
|
|
99
|
+
state.ruleEffectGetter,
|
|
100
100
|
"onFocus",
|
|
101
101
|
inline?.onFocus,
|
|
102
102
|
);
|
|
103
103
|
}
|
|
104
104
|
|
|
105
|
-
if (containerLayoutFamily.has(state.
|
|
105
|
+
if (containerLayoutFamily.has(state.ruleEffectGetter)) {
|
|
106
106
|
result ??= {};
|
|
107
107
|
result.onLayout = getInteractionHandler(
|
|
108
|
-
state.
|
|
108
|
+
state.ruleEffectGetter,
|
|
109
109
|
"onLayout",
|
|
110
110
|
inline?.onLayout,
|
|
111
111
|
);
|
|
@@ -2,17 +2,21 @@
|
|
|
2
2
|
import { rem as remObs, vh as vhObs, vw as vwObs } from "../reactivity";
|
|
3
3
|
import type { StyleFunctionResolver } from "./resolve";
|
|
4
4
|
|
|
5
|
-
export const em: StyleFunctionResolver = (resolve, func) => {
|
|
5
|
+
export const em: StyleFunctionResolver = (resolve, func, get) => {
|
|
6
6
|
let value = func[2];
|
|
7
7
|
|
|
8
8
|
if (!value) {
|
|
9
9
|
return;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
let emValue = resolve([{}, "var", ["__rn-css-em"]]);
|
|
13
13
|
|
|
14
14
|
if (typeof emValue !== "number") {
|
|
15
|
-
|
|
15
|
+
emValue = get(remObs);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
if (typeof emValue !== "number") {
|
|
19
|
+
return;
|
|
16
20
|
}
|
|
17
21
|
|
|
18
22
|
return round(Number(value) * emValue);
|