react-native-css 3.0.1 → 3.0.2
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/native/styles/index.js +202 -15
- package/dist/commonjs/native/styles/index.js.map +1 -1
- package/dist/module/native/styles/index.js +203 -15
- package/dist/module/native/styles/index.js.map +1 -1
- package/dist/typescript/commonjs/src/native/styles/index.d.ts.map +1 -1
- package/dist/typescript/module/src/native/styles/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/native/styles/index.ts +231 -18
|
@@ -11,6 +11,126 @@ var _reactivity = require("../reactivity.js");
|
|
|
11
11
|
var _calculateProps = require("./calculate-props.js");
|
|
12
12
|
/* eslint-disable */
|
|
13
13
|
|
|
14
|
+
/**
|
|
15
|
+
* Checks if the left style object has any properties that are not present in the right style object.
|
|
16
|
+
* This is used to determine if styles need to be preserved in an array or if right can completely override left.
|
|
17
|
+
*
|
|
18
|
+
* Note: This intentionally only checks one direction (left → right). We don't need to check if right has
|
|
19
|
+
* properties that left doesn't have, because right will always be applied/merged. The question we're
|
|
20
|
+
* answering is: "Does left have any properties that would be lost if we just used right?" If yes, we
|
|
21
|
+
* create a style array [left, right] to preserve both. If no, right can safely replace left entirely.
|
|
22
|
+
*
|
|
23
|
+
* @param left - The left style object to check
|
|
24
|
+
* @param right - The right style object to compare against
|
|
25
|
+
* @returns true if left has at least one property key that doesn't exist in right, false otherwise
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* hasNonOverlappingProperties({color: 'red', fontSize: 12}, {color: 'blue'}) // true - fontSize is not in right
|
|
29
|
+
* hasNonOverlappingProperties({color: 'red'}, {color: 'blue', fontSize: 12}) // false - all left keys exist in right
|
|
30
|
+
*/
|
|
31
|
+
function hasNonOverlappingProperties(left, right) {
|
|
32
|
+
// Null safety check
|
|
33
|
+
if (!left || !right) {
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// Only check own properties to avoid prototype pollution
|
|
38
|
+
for (const key in left) {
|
|
39
|
+
if (Object.prototype.hasOwnProperty.call(left, key)) {
|
|
40
|
+
if (!Object.prototype.hasOwnProperty.call(right, key)) {
|
|
41
|
+
return true;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Flattens a style array into a single object when possible, with rightmost values taking precedence.
|
|
50
|
+
* Returns the original array if it contains any non-plain objects, arrays, or CSS variable objects.
|
|
51
|
+
*
|
|
52
|
+
* Note: This function assumes the input array has already been filtered (e.g., by filterCssVariables),
|
|
53
|
+
* so empty arrays should not reach this function. If they do, they will be treated as non-flattenable.
|
|
54
|
+
*
|
|
55
|
+
* @param styleArray - The style array to potentially flatten
|
|
56
|
+
* @returns A single merged object if all items are plain objects, otherwise the original array
|
|
57
|
+
*/
|
|
58
|
+
function flattenStyleArray(styleArray) {
|
|
59
|
+
// Check if we can flatten to a single object (all items are plain objects)
|
|
60
|
+
for (const item of styleArray) {
|
|
61
|
+
// Use explicit null check instead of !item to allow falsy values like 0 or false
|
|
62
|
+
if (item == null || typeof item !== "object" || Array.isArray(item) || Object.prototype.hasOwnProperty.call(item, _reactivity.VAR_SYMBOL)) {
|
|
63
|
+
return styleArray;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// Use reduce to avoid spread operator performance issues with large arrays
|
|
68
|
+
return styleArray.reduce((acc, item) => Object.assign(acc, item), {});
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Recursively filters out CSS variable objects (with VAR_SYMBOL) from style values.
|
|
73
|
+
* This prevents CSS variable runtime objects from leaking into React Native component props.
|
|
74
|
+
*
|
|
75
|
+
* @param value - The value to filter (can be any type: object, array, primitive, etc.)
|
|
76
|
+
* @param depth - Internal recursion depth counter to prevent stack overflow (max 100)
|
|
77
|
+
* @returns The filtered value with CSS variables removed, or `undefined` if the entire value
|
|
78
|
+
* should be filtered out (e.g., empty arrays, objects with only VAR_SYMBOL properties)
|
|
79
|
+
*
|
|
80
|
+
* Filtering behavior:
|
|
81
|
+
* - Objects with VAR_SYMBOL property: returns `undefined` (completely filtered)
|
|
82
|
+
* - Arrays: filters out VAR_SYMBOL objects, returns `undefined` if empty after filtering
|
|
83
|
+
* - Objects: recursively filters properties, returns `undefined` if no properties remain
|
|
84
|
+
* - Primitives (null, undefined, numbers, strings, booleans): returned as-is
|
|
85
|
+
* - Symbol properties: intentionally filtered out for React Native compatibility
|
|
86
|
+
*
|
|
87
|
+
* @example
|
|
88
|
+
* filterCssVariables({fontSize: 16, color: {[VAR_SYMBOL]: true}}) // {fontSize: 16}
|
|
89
|
+
* filterCssVariables([{margin: 10}, {[VAR_SYMBOL]: true}]) // [{margin: 10}]
|
|
90
|
+
* filterCssVariables({color: {[VAR_SYMBOL]: true}}) // undefined (all props filtered)
|
|
91
|
+
*/
|
|
92
|
+
function filterCssVariables(value, depth = 0) {
|
|
93
|
+
// Prevent stack overflow on deeply nested structures
|
|
94
|
+
if (depth > 100) {
|
|
95
|
+
return value;
|
|
96
|
+
}
|
|
97
|
+
if (value === null || value === undefined) {
|
|
98
|
+
return value;
|
|
99
|
+
}
|
|
100
|
+
if (Array.isArray(value)) {
|
|
101
|
+
// Single-pass filter with map operation
|
|
102
|
+
const filtered = [];
|
|
103
|
+
for (const item of value) {
|
|
104
|
+
const filteredItem = filterCssVariables(item, depth + 1);
|
|
105
|
+
if (filteredItem !== undefined && !(typeof filteredItem === "object" && filteredItem !== null && Object.prototype.hasOwnProperty.call(filteredItem, _reactivity.VAR_SYMBOL))) {
|
|
106
|
+
filtered.push(filteredItem);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
return filtered.length > 0 ? filtered : undefined;
|
|
110
|
+
}
|
|
111
|
+
if (typeof value === "object") {
|
|
112
|
+
// If the object itself has VAR_SYMBOL, filter it out (check own property only)
|
|
113
|
+
if (Object.prototype.hasOwnProperty.call(value, _reactivity.VAR_SYMBOL)) {
|
|
114
|
+
return undefined;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// Otherwise, filter VAR_SYMBOL properties from nested objects
|
|
118
|
+
const filtered = {};
|
|
119
|
+
let hasProperties = false;
|
|
120
|
+
|
|
121
|
+
// Use Object.keys to only iterate own string properties (not inherited, not Symbols)
|
|
122
|
+
// This intentionally filters out Symbol properties for React Native compatibility
|
|
123
|
+
for (const key of Object.keys(value)) {
|
|
124
|
+
const filteredValue = filterCssVariables(value[key], depth + 1);
|
|
125
|
+
if (filteredValue !== undefined) {
|
|
126
|
+
filtered[key] = filteredValue;
|
|
127
|
+
hasProperties = true;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
return hasProperties ? filtered : undefined;
|
|
131
|
+
}
|
|
132
|
+
return value;
|
|
133
|
+
}
|
|
14
134
|
const stylesFamily = exports.stylesFamily = (0, _reactivity.family)((hash, rules) => {
|
|
15
135
|
const sortedRules = Array.from(rules).sort(_utilities.specificityCompareFn);
|
|
16
136
|
const obs = (0, _reactivity.observable)(read => (0, _calculateProps.calculateProps)(read, sortedRules));
|
|
@@ -66,9 +186,86 @@ function deepMergeConfig(config, left, right, rightIsInline = false) {
|
|
|
66
186
|
...left
|
|
67
187
|
};
|
|
68
188
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
189
|
+
|
|
190
|
+
// Handle style merging to support both className and inline style props
|
|
191
|
+
let result;
|
|
192
|
+
if (config.target) {
|
|
193
|
+
if (Array.isArray(config.target) && config.target.length === 1 && config.target[0] === "style") {
|
|
194
|
+
// Special handling for style target when we have inline styles
|
|
195
|
+
result = {
|
|
196
|
+
...left,
|
|
197
|
+
...right
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
// Handle null/undefined inline styles
|
|
201
|
+
if (right?.style === null || right?.style === undefined) {
|
|
202
|
+
if (left?.style) {
|
|
203
|
+
result.style = left.style;
|
|
204
|
+
}
|
|
205
|
+
} else if (rightIsInline && right?.style) {
|
|
206
|
+
// Filter inline styles if rightIsInline is true
|
|
207
|
+
const filteredRightStyle = filterCssVariables(right.style);
|
|
208
|
+
if (left?.style) {
|
|
209
|
+
if (!filteredRightStyle) {
|
|
210
|
+
// All inline styles were CSS variables, only use left
|
|
211
|
+
result.style = left.style;
|
|
212
|
+
} else {
|
|
213
|
+
const leftStyle = left.style;
|
|
214
|
+
|
|
215
|
+
// For arrays or objects, check if we need to create a style array
|
|
216
|
+
const leftIsObject = typeof leftStyle === "object" && !Array.isArray(leftStyle);
|
|
217
|
+
const rightIsObject = typeof filteredRightStyle === "object" && !Array.isArray(filteredRightStyle);
|
|
218
|
+
if (leftIsObject && rightIsObject) {
|
|
219
|
+
if (hasNonOverlappingProperties(leftStyle, filteredRightStyle)) {
|
|
220
|
+
result.style = [leftStyle, filteredRightStyle];
|
|
221
|
+
} else {
|
|
222
|
+
// All left properties are in right, right overrides
|
|
223
|
+
result.style = filteredRightStyle;
|
|
224
|
+
}
|
|
225
|
+
} else {
|
|
226
|
+
// One or both are arrays, merge them
|
|
227
|
+
result.style = [leftStyle, filteredRightStyle];
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
} else {
|
|
231
|
+
// No left style, just use filtered right
|
|
232
|
+
if (filteredRightStyle) {
|
|
233
|
+
result.style = filteredRightStyle;
|
|
234
|
+
} else {
|
|
235
|
+
// All filtered out, remove style prop
|
|
236
|
+
delete result.style;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
} else if (!rightIsInline && right?.style) {
|
|
240
|
+
// Merging non-inline styles (e.g., important styles)
|
|
241
|
+
if (left?.style) {
|
|
242
|
+
// If left.style is an array, append right.style
|
|
243
|
+
if (Array.isArray(left.style)) {
|
|
244
|
+
const combined = [...left.style, right.style];
|
|
245
|
+
result.style = flattenStyleArray(combined);
|
|
246
|
+
} else if (typeof left.style === "object" && typeof right.style === "object") {
|
|
247
|
+
// Both are objects, check for overlaps
|
|
248
|
+
if (hasNonOverlappingProperties(left.style, right.style)) {
|
|
249
|
+
result.style = flattenStyleArray([left.style, right.style]);
|
|
250
|
+
} else {
|
|
251
|
+
// All left properties are overridden by right
|
|
252
|
+
result.style = right.style;
|
|
253
|
+
}
|
|
254
|
+
} else {
|
|
255
|
+
// One or both are arrays/mixed types
|
|
256
|
+
const combined = [left.style, right.style];
|
|
257
|
+
result.style = flattenStyleArray(combined);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
} else {
|
|
262
|
+
result = Object.assign({}, left, right);
|
|
263
|
+
}
|
|
264
|
+
} else {
|
|
265
|
+
result = {
|
|
266
|
+
...left
|
|
267
|
+
};
|
|
268
|
+
}
|
|
72
269
|
if (right && rightIsInline && config.source in right && config.target !== config.source) {
|
|
73
270
|
delete result[config.source];
|
|
74
271
|
}
|
|
@@ -96,18 +293,8 @@ function deepMergeConfig(config, left, right, rightIsInline = false) {
|
|
|
96
293
|
let rightValue = right?.[target];
|
|
97
294
|
|
|
98
295
|
// Strip any inline variables from the target
|
|
99
|
-
if (rightIsInline && rightValue) {
|
|
100
|
-
|
|
101
|
-
rightValue = rightValue.filter(v => {
|
|
102
|
-
return typeof v !== "object" || !(v && _reactivity.VAR_SYMBOL in v);
|
|
103
|
-
});
|
|
104
|
-
if (rightValue.length === 0) {
|
|
105
|
-
rightValue = undefined;
|
|
106
|
-
}
|
|
107
|
-
} else if (typeof rightValue === "object" && rightValue && _reactivity.VAR_SYMBOL in rightValue) {
|
|
108
|
-
rightValue = undefined;
|
|
109
|
-
delete result[target][_reactivity.VAR_SYMBOL];
|
|
110
|
-
}
|
|
296
|
+
if (rightIsInline && rightValue !== undefined) {
|
|
297
|
+
rightValue = filterCssVariables(rightValue);
|
|
111
298
|
}
|
|
112
299
|
if (rightValue !== undefined) {
|
|
113
300
|
result[target] = left && target in left ? [left[target], rightValue] : rightValue;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_utilities","require","_interaction","_reactivity","_calculateProps","stylesFamily","exports","family","hash","rules","sortedRules","Array","from","sort","specificityCompareFn","obs","observable","read","calculateProps","Object","assign","cleanup","effect","observers","delete","size","getStyledProps","state","inline","result","styledProps","stylesObs","get","styleEffect","config","configs","deepMergeConfig","nativeStyleMapping","normal","important","hoverFamily","has","ruleEffectGetter","onHoverIn","getInteractionHandler","onHoverOut","activeFamily","onPress","onPressIn","onPressOut","focusFamily","onBlur","onFocus","containerLayoutFamily","onLayout","left","right","rightIsInline","target","source","isArray","i","length","key","undefined","slice","rightValue","filter","v","VAR_SYMBOL","props","tokens","lastToken","pop","token","path","entries","styleValue","split"],"sourceRoot":"../../../../src","sources":["native/styles/index.ts"],"mappings":";;;;;;;AAEA,IAAAA,UAAA,GAAAC,OAAA;AAEA,IAAAC,YAAA,GAAAD,OAAA;AAEA,IAAAE,WAAA,GAAAF,OAAA;AAWA,IAAAG,eAAA,GAAAH,OAAA;AAjBA;;AAmBO,MAAMI,YAAY,GAAAC,OAAA,CAAAD,YAAA,GAAG,IAAAE,kBAAM,EAChC,CACEC,IAAY,EACZC,KAA6D,KAC1D;EACH,MAAMC,WAAW,GAAGC,KAAK,CAACC,IAAI,CAACH,KAAK,CAAC,CAACI,IAAI,CAACC,+BAAoB,CAAC;EAEhE,MAAMC,GAAG,GAAG,IAAAC,sBAAU,EAAEC,IAAI,IAAK,IAAAC,8BAAc,EAACD,IAAI,EAAEP,WAAW,CAAC,CAAC;;EAEnE;AACJ;AACA;EACI,OAAOS,MAAM,CAACC,MAAM,CAACL,GAAG,EAAE;IACxBM,OAAO,EAAGC,MAAc,IAAK;MAC3BP,GAAG,CAACQ,SAAS,CAACC,MAAM,CAACF,MAAM,CAAC;MAC5B,IAAIP,GAAG,CAACQ,SAAS,CAACE,IAAI,KAAK,CAAC,EAAE;QAC5BpB,YAAY,CAACmB,MAAM,CAAChB,IAAI,CAAC;MAC3B;IACF;EACF,CAAC,CAAC;AACJ,CACF,CAAC;AAEM,S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yD,OAAO,CAAC1C,MAAM,CAACG,kBAAkB,CAAC,EAAE;IACnE,MAAMwC,UAAU,GAAGlB,MAAM,CAACI,GAAG,CAAC;IAE9B,OAAOJ,MAAM,CAACI,GAAG,CAAC;IAElB,IAAIc,UAAU,KAAKb,SAAS,EAAE;MAC5B;IACF;IAEA,IAAIN,MAAM,GAAGY,KAAK;IAClB,MAAMC,MAAM,GAAGI,IAAI,CAACG,KAAK,CAAC,GAAG,CAAC;IAC9B,MAAMN,SAAS,GAAGD,MAAM,CAACE,GAAG,CAAC,CAAC;IAC9B,KAAK,MAAMC,KAAK,IAAIH,MAAM,EAAE;MAC1Bb,MAAM,CAACgB,KAAK,CAAC,KAAK,CAAC,CAAC;MACpBhB,MAAM,GAAGA,MAAM,CAACgB,KAAK,CAAC;IACxB;IAEAhB,MAAM,CAACc,SAAS,CAAE,GAAGK,UAAU;EACjC;EAEA,OAAOP,KAAK;AACd","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_utilities","require","_interaction","_reactivity","_calculateProps","hasNonOverlappingProperties","left","right","key","Object","prototype","hasOwnProperty","call","flattenStyleArray","styleArray","item","Array","isArray","VAR_SYMBOL","reduce","acc","assign","filterCssVariables","value","depth","undefined","filtered","filteredItem","push","length","hasProperties","keys","filteredValue","stylesFamily","exports","family","hash","rules","sortedRules","from","sort","specificityCompareFn","obs","observable","read","calculateProps","cleanup","effect","observers","delete","size","getStyledProps","state","inline","result","styledProps","stylesObs","get","styleEffect","config","configs","deepMergeConfig","nativeStyleMapping","normal","important","hoverFamily","has","ruleEffectGetter","onHoverIn","getInteractionHandler","onHoverOut","activeFamily","onPress","onPressIn","onPressOut","focusFamily","onBlur","onFocus","containerLayoutFamily","onLayout","rightIsInline","target","style","filteredRightStyle","leftStyle","leftIsObject","rightIsObject","combined","source","i","slice","rightValue","props","tokens","lastToken","pop","token","path","entries","styleValue","split"],"sourceRoot":"../../../../src","sources":["native/styles/index.ts"],"mappings":";;;;;;;AAEA,IAAAA,UAA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MAAM,KAAK,KAAK,EAAE;IAClCO,MAAM,GAAGI,KAAK,CAAC,OAAO,CAAC;EACzB,CAAC,MAAM;IACL,MAAMC,MAAM,GAAG,CAAC,GAAGlC,MAAM,CAACsB,MAAM,CAAC;IACjC,MAAMa,SAAS,GAAGD,MAAM,CAACE,GAAG,CAAC,CAAE;IAE/BP,MAAM,GAAGI,KAAK;IACd,KAAK,MAAMI,KAAK,IAAIH,MAAM,EAAE;MAC1BL,MAAM,GAAGA,MAAM,CAACQ,KAAK,CAAC;MACtB,IAAI,CAACR,MAAM,EAAE;QACX,OAAOI,KAAK;MACd;IACF;IAEAJ,MAAM,GAAGA,MAAM,CAACM,SAAS,CAAC;EAC5B;EAEA,IAAI,CAACN,MAAM,EAAE;IACX,OAAOI,KAAK;EACd;EAEA,KAAK,MAAM,CAACpF,GAAG,EAAEyF,IAAI,CAAC,IAAIxF,MAAM,CAACyF,OAAO,CAACvC,MAAM,CAACG,kBAAkB,CAAC,EAAE;IACnE,MAAMqC,UAAU,GAAGX,MAAM,CAAChF,GAAG,CAAC;IAE9B,OAAOgF,MAAM,CAAChF,GAAG,CAAC;IAElB,IAAI2F,UAAU,KAAK1E,SAAS,EAAE;MAC5B;IACF;IAEA,IAAIwD,MAAM,GAAGW,KAAK;IAClB,MAAMC,MAAM,GAAGI,IAAI,CAACG,KAAK,CAAC,GAAG,CAAC;IAC9B,MAAMN,SAAS,GAAGD,MAAM,CAACE,GAAG,CAAC,CAAC;IAC9B,KAAK,MAAMC,KAAK,IAAIH,MAAM,EAAE;MAC1BZ,MAAM,CAACe,KAAK,CAAC,KAAK,CAAC,CAAC;MACpBf,MAAM,GAAGA,MAAM,CAACe,KAAK,CAAC;IACxB;IAEAf,MAAM,CAACa,SAAS,CAAE,GAAGK,UAAU;EACjC;EAEA,OAAOP,KAAK;AACd","ignoreList":[]}
|
|
@@ -6,6 +6,127 @@ import { specificityCompareFn } from "react-native-css/utilities";
|
|
|
6
6
|
import { getInteractionHandler } from "../react/interaction.js";
|
|
7
7
|
import { activeFamily, containerLayoutFamily, family, focusFamily, hoverFamily, observable, VAR_SYMBOL } from "../reactivity.js";
|
|
8
8
|
import { calculateProps } from "./calculate-props.js";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Checks if the left style object has any properties that are not present in the right style object.
|
|
12
|
+
* This is used to determine if styles need to be preserved in an array or if right can completely override left.
|
|
13
|
+
*
|
|
14
|
+
* Note: This intentionally only checks one direction (left → right). We don't need to check if right has
|
|
15
|
+
* properties that left doesn't have, because right will always be applied/merged. The question we're
|
|
16
|
+
* answering is: "Does left have any properties that would be lost if we just used right?" If yes, we
|
|
17
|
+
* create a style array [left, right] to preserve both. If no, right can safely replace left entirely.
|
|
18
|
+
*
|
|
19
|
+
* @param left - The left style object to check
|
|
20
|
+
* @param right - The right style object to compare against
|
|
21
|
+
* @returns true if left has at least one property key that doesn't exist in right, false otherwise
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* hasNonOverlappingProperties({color: 'red', fontSize: 12}, {color: 'blue'}) // true - fontSize is not in right
|
|
25
|
+
* hasNonOverlappingProperties({color: 'red'}, {color: 'blue', fontSize: 12}) // false - all left keys exist in right
|
|
26
|
+
*/
|
|
27
|
+
function hasNonOverlappingProperties(left, right) {
|
|
28
|
+
// Null safety check
|
|
29
|
+
if (!left || !right) {
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// Only check own properties to avoid prototype pollution
|
|
34
|
+
for (const key in left) {
|
|
35
|
+
if (Object.prototype.hasOwnProperty.call(left, key)) {
|
|
36
|
+
if (!Object.prototype.hasOwnProperty.call(right, key)) {
|
|
37
|
+
return true;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Flattens a style array into a single object when possible, with rightmost values taking precedence.
|
|
46
|
+
* Returns the original array if it contains any non-plain objects, arrays, or CSS variable objects.
|
|
47
|
+
*
|
|
48
|
+
* Note: This function assumes the input array has already been filtered (e.g., by filterCssVariables),
|
|
49
|
+
* so empty arrays should not reach this function. If they do, they will be treated as non-flattenable.
|
|
50
|
+
*
|
|
51
|
+
* @param styleArray - The style array to potentially flatten
|
|
52
|
+
* @returns A single merged object if all items are plain objects, otherwise the original array
|
|
53
|
+
*/
|
|
54
|
+
function flattenStyleArray(styleArray) {
|
|
55
|
+
// Check if we can flatten to a single object (all items are plain objects)
|
|
56
|
+
for (const item of styleArray) {
|
|
57
|
+
// Use explicit null check instead of !item to allow falsy values like 0 or false
|
|
58
|
+
if (item == null || typeof item !== "object" || Array.isArray(item) || Object.prototype.hasOwnProperty.call(item, VAR_SYMBOL)) {
|
|
59
|
+
return styleArray;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// Use reduce to avoid spread operator performance issues with large arrays
|
|
64
|
+
return styleArray.reduce((acc, item) => Object.assign(acc, item), {});
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Recursively filters out CSS variable objects (with VAR_SYMBOL) from style values.
|
|
69
|
+
* This prevents CSS variable runtime objects from leaking into React Native component props.
|
|
70
|
+
*
|
|
71
|
+
* @param value - The value to filter (can be any type: object, array, primitive, etc.)
|
|
72
|
+
* @param depth - Internal recursion depth counter to prevent stack overflow (max 100)
|
|
73
|
+
* @returns The filtered value with CSS variables removed, or `undefined` if the entire value
|
|
74
|
+
* should be filtered out (e.g., empty arrays, objects with only VAR_SYMBOL properties)
|
|
75
|
+
*
|
|
76
|
+
* Filtering behavior:
|
|
77
|
+
* - Objects with VAR_SYMBOL property: returns `undefined` (completely filtered)
|
|
78
|
+
* - Arrays: filters out VAR_SYMBOL objects, returns `undefined` if empty after filtering
|
|
79
|
+
* - Objects: recursively filters properties, returns `undefined` if no properties remain
|
|
80
|
+
* - Primitives (null, undefined, numbers, strings, booleans): returned as-is
|
|
81
|
+
* - Symbol properties: intentionally filtered out for React Native compatibility
|
|
82
|
+
*
|
|
83
|
+
* @example
|
|
84
|
+
* filterCssVariables({fontSize: 16, color: {[VAR_SYMBOL]: true}}) // {fontSize: 16}
|
|
85
|
+
* filterCssVariables([{margin: 10}, {[VAR_SYMBOL]: true}]) // [{margin: 10}]
|
|
86
|
+
* filterCssVariables({color: {[VAR_SYMBOL]: true}}) // undefined (all props filtered)
|
|
87
|
+
*/
|
|
88
|
+
function filterCssVariables(value, depth = 0) {
|
|
89
|
+
// Prevent stack overflow on deeply nested structures
|
|
90
|
+
if (depth > 100) {
|
|
91
|
+
return value;
|
|
92
|
+
}
|
|
93
|
+
if (value === null || value === undefined) {
|
|
94
|
+
return value;
|
|
95
|
+
}
|
|
96
|
+
if (Array.isArray(value)) {
|
|
97
|
+
// Single-pass filter with map operation
|
|
98
|
+
const filtered = [];
|
|
99
|
+
for (const item of value) {
|
|
100
|
+
const filteredItem = filterCssVariables(item, depth + 1);
|
|
101
|
+
if (filteredItem !== undefined && !(typeof filteredItem === "object" && filteredItem !== null && Object.prototype.hasOwnProperty.call(filteredItem, VAR_SYMBOL))) {
|
|
102
|
+
filtered.push(filteredItem);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
return filtered.length > 0 ? filtered : undefined;
|
|
106
|
+
}
|
|
107
|
+
if (typeof value === "object") {
|
|
108
|
+
// If the object itself has VAR_SYMBOL, filter it out (check own property only)
|
|
109
|
+
if (Object.prototype.hasOwnProperty.call(value, VAR_SYMBOL)) {
|
|
110
|
+
return undefined;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// Otherwise, filter VAR_SYMBOL properties from nested objects
|
|
114
|
+
const filtered = {};
|
|
115
|
+
let hasProperties = false;
|
|
116
|
+
|
|
117
|
+
// Use Object.keys to only iterate own string properties (not inherited, not Symbols)
|
|
118
|
+
// This intentionally filters out Symbol properties for React Native compatibility
|
|
119
|
+
for (const key of Object.keys(value)) {
|
|
120
|
+
const filteredValue = filterCssVariables(value[key], depth + 1);
|
|
121
|
+
if (filteredValue !== undefined) {
|
|
122
|
+
filtered[key] = filteredValue;
|
|
123
|
+
hasProperties = true;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
return hasProperties ? filtered : undefined;
|
|
127
|
+
}
|
|
128
|
+
return value;
|
|
129
|
+
}
|
|
9
130
|
export const stylesFamily = family((hash, rules) => {
|
|
10
131
|
const sortedRules = Array.from(rules).sort(specificityCompareFn);
|
|
11
132
|
const obs = observable(read => calculateProps(read, sortedRules));
|
|
@@ -61,9 +182,86 @@ function deepMergeConfig(config, left, right, rightIsInline = false) {
|
|
|
61
182
|
...left
|
|
62
183
|
};
|
|
63
184
|
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
185
|
+
|
|
186
|
+
// Handle style merging to support both className and inline style props
|
|
187
|
+
let result;
|
|
188
|
+
if (config.target) {
|
|
189
|
+
if (Array.isArray(config.target) && config.target.length === 1 && config.target[0] === "style") {
|
|
190
|
+
// Special handling for style target when we have inline styles
|
|
191
|
+
result = {
|
|
192
|
+
...left,
|
|
193
|
+
...right
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
// Handle null/undefined inline styles
|
|
197
|
+
if (right?.style === null || right?.style === undefined) {
|
|
198
|
+
if (left?.style) {
|
|
199
|
+
result.style = left.style;
|
|
200
|
+
}
|
|
201
|
+
} else if (rightIsInline && right?.style) {
|
|
202
|
+
// Filter inline styles if rightIsInline is true
|
|
203
|
+
const filteredRightStyle = filterCssVariables(right.style);
|
|
204
|
+
if (left?.style) {
|
|
205
|
+
if (!filteredRightStyle) {
|
|
206
|
+
// All inline styles were CSS variables, only use left
|
|
207
|
+
result.style = left.style;
|
|
208
|
+
} else {
|
|
209
|
+
const leftStyle = left.style;
|
|
210
|
+
|
|
211
|
+
// For arrays or objects, check if we need to create a style array
|
|
212
|
+
const leftIsObject = typeof leftStyle === "object" && !Array.isArray(leftStyle);
|
|
213
|
+
const rightIsObject = typeof filteredRightStyle === "object" && !Array.isArray(filteredRightStyle);
|
|
214
|
+
if (leftIsObject && rightIsObject) {
|
|
215
|
+
if (hasNonOverlappingProperties(leftStyle, filteredRightStyle)) {
|
|
216
|
+
result.style = [leftStyle, filteredRightStyle];
|
|
217
|
+
} else {
|
|
218
|
+
// All left properties are in right, right overrides
|
|
219
|
+
result.style = filteredRightStyle;
|
|
220
|
+
}
|
|
221
|
+
} else {
|
|
222
|
+
// One or both are arrays, merge them
|
|
223
|
+
result.style = [leftStyle, filteredRightStyle];
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
} else {
|
|
227
|
+
// No left style, just use filtered right
|
|
228
|
+
if (filteredRightStyle) {
|
|
229
|
+
result.style = filteredRightStyle;
|
|
230
|
+
} else {
|
|
231
|
+
// All filtered out, remove style prop
|
|
232
|
+
delete result.style;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
} else if (!rightIsInline && right?.style) {
|
|
236
|
+
// Merging non-inline styles (e.g., important styles)
|
|
237
|
+
if (left?.style) {
|
|
238
|
+
// If left.style is an array, append right.style
|
|
239
|
+
if (Array.isArray(left.style)) {
|
|
240
|
+
const combined = [...left.style, right.style];
|
|
241
|
+
result.style = flattenStyleArray(combined);
|
|
242
|
+
} else if (typeof left.style === "object" && typeof right.style === "object") {
|
|
243
|
+
// Both are objects, check for overlaps
|
|
244
|
+
if (hasNonOverlappingProperties(left.style, right.style)) {
|
|
245
|
+
result.style = flattenStyleArray([left.style, right.style]);
|
|
246
|
+
} else {
|
|
247
|
+
// All left properties are overridden by right
|
|
248
|
+
result.style = right.style;
|
|
249
|
+
}
|
|
250
|
+
} else {
|
|
251
|
+
// One or both are arrays/mixed types
|
|
252
|
+
const combined = [left.style, right.style];
|
|
253
|
+
result.style = flattenStyleArray(combined);
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
} else {
|
|
258
|
+
result = Object.assign({}, left, right);
|
|
259
|
+
}
|
|
260
|
+
} else {
|
|
261
|
+
result = {
|
|
262
|
+
...left
|
|
263
|
+
};
|
|
264
|
+
}
|
|
67
265
|
if (right && rightIsInline && config.source in right && config.target !== config.source) {
|
|
68
266
|
delete result[config.source];
|
|
69
267
|
}
|
|
@@ -91,18 +289,8 @@ function deepMergeConfig(config, left, right, rightIsInline = false) {
|
|
|
91
289
|
let rightValue = right?.[target];
|
|
92
290
|
|
|
93
291
|
// Strip any inline variables from the target
|
|
94
|
-
if (rightIsInline && rightValue) {
|
|
95
|
-
|
|
96
|
-
rightValue = rightValue.filter(v => {
|
|
97
|
-
return typeof v !== "object" || !(v && VAR_SYMBOL in v);
|
|
98
|
-
});
|
|
99
|
-
if (rightValue.length === 0) {
|
|
100
|
-
rightValue = undefined;
|
|
101
|
-
}
|
|
102
|
-
} else if (typeof rightValue === "object" && rightValue && VAR_SYMBOL in rightValue) {
|
|
103
|
-
rightValue = undefined;
|
|
104
|
-
delete result[target][VAR_SYMBOL];
|
|
105
|
-
}
|
|
292
|
+
if (rightIsInline && rightValue !== undefined) {
|
|
293
|
+
rightValue = filterCssVariables(rightValue);
|
|
106
294
|
}
|
|
107
295
|
if (rightValue !== undefined) {
|
|
108
296
|
result[target] = left && target in left ? [left[target], rightValue] : rightValue;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["specificityCompareFn","getInteractionHandler","activeFamily","containerLayoutFamily","family","focusFamily","hoverFamily","observable","VAR_SYMBOL","calculateProps","stylesFamily","hash","rules","sortedRules","Array","from","sort","obs","read","Object","assign","cleanup","effect","observers","delete","size","getStyledProps","state","inline","result","styledProps","stylesObs","get","styleEffect","config","configs","deepMergeConfig","nativeStyleMapping","normal","important","has","ruleEffectGetter","onHoverIn","onHoverOut","onPress","onPressIn","onPressOut","onBlur","onFocus","onLayout","left","right","rightIsInline","target","source","isArray","i","length","key","undefined","slice","rightValue","filter","v","props","tokens","lastToken","pop","token","path","entries","styleValue","split"],"sourceRoot":"../../../../src","sources":["native/styles/index.ts"],"mappings":";;AAAA;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,GAAGA,MAAM,CAACe,KAAK,CAAC;IACxB;IAEAf,MAAM,CAACa,SAAS,CAAE,GAAGK,UAAU;EACjC;EAEA,OAAOP,KAAK;AACd","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["specificityCompareFn","getInteractionHandler","activeFamily","containerLayoutFamily","family","focusFamily","hoverFamily","observable","VAR_SYMBOL","calculateProps","hasNonOverlappingProperties","left","right","key","Object","prototype","hasOwnProperty","call","flattenStyleArray","styleArray","item","Array","isArray","reduce","acc","assign","filterCssVariables","value","depth","undefined","filtered","filteredItem","push","length","hasProperties","keys","filteredValue","stylesFamily","hash","rules","sortedRules","from","sort","obs","read","cleanup","effect","observers","delete","size","getStyledProps","state","inline","result","styledProps","stylesObs","get","styleEffect","config","configs","deepMergeConfig","nativeStyleMapping","normal","important","has","ruleEffectGetter","onHoverIn","onHoverOut","onPress","onPressIn","onPressOut","onBlur","onFocus","onLayout","rightIsInline","target","style","filteredRightStyle","leftStyle","leftIsObject","rightIsObject","combined","source","i","slice","rightValue","props","tokens","lastToken","pop","token","path","entries","styleValue","split"],"sourceRoot":"../../../../src","sources":["native/styles/index.ts"],"mappings":";;AAAA;;AAEA,SAASA,oBAAoB,QAAQ,4BAA4B;AAEjE,SAASC,qBAAqB,QAAQ,yBAAsB;AAE5D,SACEC,YAAY,EACZC,qBAAqB,EACrBC,MAAM,EACNC,WAAW,EACXC,WAAW,EACXC,UAAU,EACVC,UAAU,QAGL,kBAAe;AACtB,SAASC,cAAc,QAAQ,sBAAmB;;AAElD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,2BAA2BA,CAClCC,IAAyB,EACzBC,KAA0B,EACjB;EACT;EACA,IAAI,CAACD,IAAI,IAAI,CAACC,KAAK,EAAE;IACnB,OAAO,KAAK;EACd;;EAEA;EACA,KAAK,MAAMC,GAAG,IAAIF,IAAI,EAAE;IACtB,IAAIG,MAAM,CAACC,SAAS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,GAAG,EAAE8E,IAAI,CAAC,IAAI7E,MAAM,CAAC8E,OAAO,CAAClC,MAAM,CAACG,kBAAkB,CAAC,EAAE;IACnE,MAAMgC,UAAU,GAAGX,MAAM,CAACrE,GAAG,CAAC;IAE9B,OAAOqE,MAAM,CAACrE,GAAG,CAAC;IAElB,IAAIgF,UAAU,KAAKhE,SAAS,EAAE;MAC5B;IACF;IAEA,IAAI8C,MAAM,GAAGW,KAAK;IAClB,MAAMC,MAAM,GAAGI,IAAI,CAACG,KAAK,CAAC,GAAG,CAAC;IAC9B,MAAMN,SAAS,GAAGD,MAAM,CAACE,GAAG,CAAC,CAAC;IAC9B,KAAK,MAAMC,KAAK,IAAIH,MAAM,EAAE;MAC1BZ,MAAM,CAACe,KAAK,CAAC,KAAK,CAAC,CAAC;MACpBf,MAAM,GAAGA,MAAM,CAACe,KAAK,CAAC;IACxB;IAEAf,MAAM,CAACa,SAAS,CAAE,GAAGK,UAAU;EACjC;EAEA,OAAOP,KAAK;AACd","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/native/styles/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAI3E,OAAO,KAAK,EAAE,cAAc,EAAU,MAAM,uBAAuB,CAAC;AACpE,OAAO,EAQL,KAAK,MAAM,EACX,KAAK,oBAAoB,EAC1B,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/native/styles/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAI3E,OAAO,KAAK,EAAE,cAAc,EAAU,MAAM,uBAAuB,CAAC;AACpE,OAAO,EAQL,KAAK,MAAM,EACX,KAAK,oBAAoB,EAC1B,MAAM,eAAe,CAAC;AAkJvB,eAAO,MAAM,YAAY;;;;;;;;;sBAaD,MAAM;;;;CAQ7B,CAAC;AAEF,wBAAgB,cAAc,CAC5B,KAAK,EAAE,cAAc,EACrB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,SAAS,GAAG,IAAI,mCAiF/C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/native/styles/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAI3E,OAAO,KAAK,EAAE,cAAc,EAAU,MAAM,uBAAuB,CAAC;AACpE,OAAO,EAQL,KAAK,MAAM,EACX,KAAK,oBAAoB,EAC1B,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/native/styles/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAI3E,OAAO,KAAK,EAAE,cAAc,EAAU,MAAM,uBAAuB,CAAC;AACpE,OAAO,EAQL,KAAK,MAAM,EACX,KAAK,oBAAoB,EAC1B,MAAM,eAAe,CAAC;AAkJvB,eAAO,MAAM,YAAY;;;;;;;;;sBAaD,MAAM;;;;CAQ7B,CAAC;AAEF,wBAAgB,cAAc,CAC5B,KAAK,EAAE,cAAc,EACrB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,SAAS,GAAG,IAAI,mCAiF/C"}
|
package/package.json
CHANGED
|
@@ -17,6 +17,149 @@ import {
|
|
|
17
17
|
} from "../reactivity";
|
|
18
18
|
import { calculateProps } from "./calculate-props";
|
|
19
19
|
|
|
20
|
+
/**
|
|
21
|
+
* Checks if the left style object has any properties that are not present in the right style object.
|
|
22
|
+
* This is used to determine if styles need to be preserved in an array or if right can completely override left.
|
|
23
|
+
*
|
|
24
|
+
* Note: This intentionally only checks one direction (left → right). We don't need to check if right has
|
|
25
|
+
* properties that left doesn't have, because right will always be applied/merged. The question we're
|
|
26
|
+
* answering is: "Does left have any properties that would be lost if we just used right?" If yes, we
|
|
27
|
+
* create a style array [left, right] to preserve both. If no, right can safely replace left entirely.
|
|
28
|
+
*
|
|
29
|
+
* @param left - The left style object to check
|
|
30
|
+
* @param right - The right style object to compare against
|
|
31
|
+
* @returns true if left has at least one property key that doesn't exist in right, false otherwise
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* hasNonOverlappingProperties({color: 'red', fontSize: 12}, {color: 'blue'}) // true - fontSize is not in right
|
|
35
|
+
* hasNonOverlappingProperties({color: 'red'}, {color: 'blue', fontSize: 12}) // false - all left keys exist in right
|
|
36
|
+
*/
|
|
37
|
+
function hasNonOverlappingProperties(
|
|
38
|
+
left: Record<string, any>,
|
|
39
|
+
right: Record<string, any>,
|
|
40
|
+
): boolean {
|
|
41
|
+
// Null safety check
|
|
42
|
+
if (!left || !right) {
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// Only check own properties to avoid prototype pollution
|
|
47
|
+
for (const key in left) {
|
|
48
|
+
if (Object.prototype.hasOwnProperty.call(left, key)) {
|
|
49
|
+
if (!Object.prototype.hasOwnProperty.call(right, key)) {
|
|
50
|
+
return true;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Flattens a style array into a single object when possible, with rightmost values taking precedence.
|
|
59
|
+
* Returns the original array if it contains any non-plain objects, arrays, or CSS variable objects.
|
|
60
|
+
*
|
|
61
|
+
* Note: This function assumes the input array has already been filtered (e.g., by filterCssVariables),
|
|
62
|
+
* so empty arrays should not reach this function. If they do, they will be treated as non-flattenable.
|
|
63
|
+
*
|
|
64
|
+
* @param styleArray - The style array to potentially flatten
|
|
65
|
+
* @returns A single merged object if all items are plain objects, otherwise the original array
|
|
66
|
+
*/
|
|
67
|
+
function flattenStyleArray(styleArray: any[]): any {
|
|
68
|
+
// Check if we can flatten to a single object (all items are plain objects)
|
|
69
|
+
for (const item of styleArray) {
|
|
70
|
+
// Use explicit null check instead of !item to allow falsy values like 0 or false
|
|
71
|
+
if (
|
|
72
|
+
item == null ||
|
|
73
|
+
typeof item !== "object" ||
|
|
74
|
+
Array.isArray(item) ||
|
|
75
|
+
Object.prototype.hasOwnProperty.call(item, VAR_SYMBOL)
|
|
76
|
+
) {
|
|
77
|
+
return styleArray;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// Use reduce to avoid spread operator performance issues with large arrays
|
|
82
|
+
return styleArray.reduce((acc, item) => Object.assign(acc, item), {});
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Recursively filters out CSS variable objects (with VAR_SYMBOL) from style values.
|
|
87
|
+
* This prevents CSS variable runtime objects from leaking into React Native component props.
|
|
88
|
+
*
|
|
89
|
+
* @param value - The value to filter (can be any type: object, array, primitive, etc.)
|
|
90
|
+
* @param depth - Internal recursion depth counter to prevent stack overflow (max 100)
|
|
91
|
+
* @returns The filtered value with CSS variables removed, or `undefined` if the entire value
|
|
92
|
+
* should be filtered out (e.g., empty arrays, objects with only VAR_SYMBOL properties)
|
|
93
|
+
*
|
|
94
|
+
* Filtering behavior:
|
|
95
|
+
* - Objects with VAR_SYMBOL property: returns `undefined` (completely filtered)
|
|
96
|
+
* - Arrays: filters out VAR_SYMBOL objects, returns `undefined` if empty after filtering
|
|
97
|
+
* - Objects: recursively filters properties, returns `undefined` if no properties remain
|
|
98
|
+
* - Primitives (null, undefined, numbers, strings, booleans): returned as-is
|
|
99
|
+
* - Symbol properties: intentionally filtered out for React Native compatibility
|
|
100
|
+
*
|
|
101
|
+
* @example
|
|
102
|
+
* filterCssVariables({fontSize: 16, color: {[VAR_SYMBOL]: true}}) // {fontSize: 16}
|
|
103
|
+
* filterCssVariables([{margin: 10}, {[VAR_SYMBOL]: true}]) // [{margin: 10}]
|
|
104
|
+
* filterCssVariables({color: {[VAR_SYMBOL]: true}}) // undefined (all props filtered)
|
|
105
|
+
*/
|
|
106
|
+
function filterCssVariables(value: any, depth = 0): any | undefined {
|
|
107
|
+
// Prevent stack overflow on deeply nested structures
|
|
108
|
+
if (depth > 100) {
|
|
109
|
+
return value;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
if (value === null || value === undefined) {
|
|
113
|
+
return value;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
if (Array.isArray(value)) {
|
|
117
|
+
// Single-pass filter with map operation
|
|
118
|
+
const filtered: any[] = [];
|
|
119
|
+
|
|
120
|
+
for (const item of value) {
|
|
121
|
+
const filteredItem = filterCssVariables(item, depth + 1);
|
|
122
|
+
if (
|
|
123
|
+
filteredItem !== undefined &&
|
|
124
|
+
!(
|
|
125
|
+
typeof filteredItem === "object" &&
|
|
126
|
+
filteredItem !== null &&
|
|
127
|
+
Object.prototype.hasOwnProperty.call(filteredItem, VAR_SYMBOL)
|
|
128
|
+
)
|
|
129
|
+
) {
|
|
130
|
+
filtered.push(filteredItem);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
return filtered.length > 0 ? filtered : undefined;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
if (typeof value === "object") {
|
|
138
|
+
// If the object itself has VAR_SYMBOL, filter it out (check own property only)
|
|
139
|
+
if (Object.prototype.hasOwnProperty.call(value, VAR_SYMBOL)) {
|
|
140
|
+
return undefined;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
// Otherwise, filter VAR_SYMBOL properties from nested objects
|
|
144
|
+
const filtered: Record<string, any> = {};
|
|
145
|
+
let hasProperties = false;
|
|
146
|
+
|
|
147
|
+
// Use Object.keys to only iterate own string properties (not inherited, not Symbols)
|
|
148
|
+
// This intentionally filters out Symbol properties for React Native compatibility
|
|
149
|
+
for (const key of Object.keys(value)) {
|
|
150
|
+
const filteredValue = filterCssVariables(value[key], depth + 1);
|
|
151
|
+
if (filteredValue !== undefined) {
|
|
152
|
+
filtered[key] = filteredValue;
|
|
153
|
+
hasProperties = true;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
return hasProperties ? filtered : undefined;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
return value;
|
|
161
|
+
}
|
|
162
|
+
|
|
20
163
|
export const stylesFamily = family(
|
|
21
164
|
(
|
|
22
165
|
hash: string,
|
|
@@ -135,7 +278,92 @@ function deepMergeConfig(
|
|
|
135
278
|
return { ...left };
|
|
136
279
|
}
|
|
137
280
|
|
|
138
|
-
|
|
281
|
+
// Handle style merging to support both className and inline style props
|
|
282
|
+
let result: Record<string, any>;
|
|
283
|
+
if (config.target) {
|
|
284
|
+
if (
|
|
285
|
+
Array.isArray(config.target) &&
|
|
286
|
+
config.target.length === 1 &&
|
|
287
|
+
config.target[0] === "style"
|
|
288
|
+
) {
|
|
289
|
+
// Special handling for style target when we have inline styles
|
|
290
|
+
result = { ...left, ...right };
|
|
291
|
+
|
|
292
|
+
// Handle null/undefined inline styles
|
|
293
|
+
if (right?.style === null || right?.style === undefined) {
|
|
294
|
+
if (left?.style) {
|
|
295
|
+
result.style = left.style;
|
|
296
|
+
}
|
|
297
|
+
} else if (rightIsInline && right?.style) {
|
|
298
|
+
// Filter inline styles if rightIsInline is true
|
|
299
|
+
const filteredRightStyle = filterCssVariables(right.style);
|
|
300
|
+
|
|
301
|
+
if (left?.style) {
|
|
302
|
+
if (!filteredRightStyle) {
|
|
303
|
+
// All inline styles were CSS variables, only use left
|
|
304
|
+
result.style = left.style;
|
|
305
|
+
} else {
|
|
306
|
+
const leftStyle = left.style;
|
|
307
|
+
|
|
308
|
+
// For arrays or objects, check if we need to create a style array
|
|
309
|
+
const leftIsObject =
|
|
310
|
+
typeof leftStyle === "object" && !Array.isArray(leftStyle);
|
|
311
|
+
const rightIsObject =
|
|
312
|
+
typeof filteredRightStyle === "object" &&
|
|
313
|
+
!Array.isArray(filteredRightStyle);
|
|
314
|
+
|
|
315
|
+
if (leftIsObject && rightIsObject) {
|
|
316
|
+
if (hasNonOverlappingProperties(leftStyle, filteredRightStyle)) {
|
|
317
|
+
result.style = [leftStyle, filteredRightStyle];
|
|
318
|
+
} else {
|
|
319
|
+
// All left properties are in right, right overrides
|
|
320
|
+
result.style = filteredRightStyle;
|
|
321
|
+
}
|
|
322
|
+
} else {
|
|
323
|
+
// One or both are arrays, merge them
|
|
324
|
+
result.style = [leftStyle, filteredRightStyle];
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
} else {
|
|
328
|
+
// No left style, just use filtered right
|
|
329
|
+
if (filteredRightStyle) {
|
|
330
|
+
result.style = filteredRightStyle;
|
|
331
|
+
} else {
|
|
332
|
+
// All filtered out, remove style prop
|
|
333
|
+
delete result.style;
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
} else if (!rightIsInline && right?.style) {
|
|
337
|
+
// Merging non-inline styles (e.g., important styles)
|
|
338
|
+
if (left?.style) {
|
|
339
|
+
// If left.style is an array, append right.style
|
|
340
|
+
if (Array.isArray(left.style)) {
|
|
341
|
+
const combined = [...left.style, right.style];
|
|
342
|
+
result.style = flattenStyleArray(combined);
|
|
343
|
+
} else if (
|
|
344
|
+
typeof left.style === "object" &&
|
|
345
|
+
typeof right.style === "object"
|
|
346
|
+
) {
|
|
347
|
+
// Both are objects, check for overlaps
|
|
348
|
+
if (hasNonOverlappingProperties(left.style, right.style)) {
|
|
349
|
+
result.style = flattenStyleArray([left.style, right.style]);
|
|
350
|
+
} else {
|
|
351
|
+
// All left properties are overridden by right
|
|
352
|
+
result.style = right.style;
|
|
353
|
+
}
|
|
354
|
+
} else {
|
|
355
|
+
// One or both are arrays/mixed types
|
|
356
|
+
const combined = [left.style, right.style];
|
|
357
|
+
result.style = flattenStyleArray(combined);
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
} else {
|
|
362
|
+
result = Object.assign({}, left, right);
|
|
363
|
+
}
|
|
364
|
+
} else {
|
|
365
|
+
result = { ...left };
|
|
366
|
+
}
|
|
139
367
|
|
|
140
368
|
if (
|
|
141
369
|
right &&
|
|
@@ -177,23 +405,8 @@ function deepMergeConfig(
|
|
|
177
405
|
let rightValue = right?.[target];
|
|
178
406
|
|
|
179
407
|
// Strip any inline variables from the target
|
|
180
|
-
if (rightIsInline && rightValue) {
|
|
181
|
-
|
|
182
|
-
rightValue = rightValue.filter((v) => {
|
|
183
|
-
return typeof v !== "object" || !(v && VAR_SYMBOL in v);
|
|
184
|
-
});
|
|
185
|
-
|
|
186
|
-
if (rightValue.length === 0) {
|
|
187
|
-
rightValue = undefined;
|
|
188
|
-
}
|
|
189
|
-
} else if (
|
|
190
|
-
typeof rightValue === "object" &&
|
|
191
|
-
rightValue &&
|
|
192
|
-
VAR_SYMBOL in rightValue
|
|
193
|
-
) {
|
|
194
|
-
rightValue = undefined;
|
|
195
|
-
delete result[target][VAR_SYMBOL];
|
|
196
|
-
}
|
|
408
|
+
if (rightIsInline && rightValue !== undefined) {
|
|
409
|
+
rightValue = filterCssVariables(rightValue);
|
|
197
410
|
}
|
|
198
411
|
|
|
199
412
|
if (rightValue !== undefined) {
|