@colorye/react-native-css 0.2.1

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/index.js ADDED
@@ -0,0 +1,158 @@
1
+ "use strict";
2
+
3
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
4
+ var _fs = _interopRequireDefault(require("fs"));
5
+ var _path = _interopRequireDefault(require("path"));
6
+ var _css = require("css");
7
+ var _stylesheet = _interopRequireDefault(require("./features/stylesheet"));
8
+ var _css2 = require("./utils/css");
9
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
10
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
11
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
12
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
13
+ function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
14
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
15
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
16
+ function getStylesheet(css, filename) {
17
+ // 1. Run Tailwind CSS v4 preprocessing (supports oklch, @layer flattening, etc.)
18
+ var preprocessedCss = (0, _css2.preprocessTailwindCss)(css);
19
+ var ast = (0, _css.parse)(preprocessedCss);
20
+ var stylesheet = new _stylesheet["default"]();
21
+
22
+ // Process regular rules
23
+ var _iterator = _createForOfIteratorHelper(ast.stylesheet.rules || []),
24
+ _step;
25
+ try {
26
+ var _loop = function _loop() {
27
+ var rule = _step.value;
28
+ if (!stylesheet.isRuleTypeSupported(rule.type)) return 1; // continue
29
+ if (rule.type === "rule") {
30
+ var declarations = stylesheet.simplifyDeclarations(rule.declarations);
31
+ rule.selectors.forEach(function (selector) {
32
+ if (!stylesheet.isSelectorSupported(selector)) return;
33
+ stylesheet.upsert(selector, declarations);
34
+ });
35
+ }
36
+ };
37
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
38
+ if (_loop()) continue;
39
+ }
40
+
41
+ // Process @media rules (injected at the end)
42
+ } catch (err) {
43
+ _iterator.e(err);
44
+ } finally {
45
+ _iterator.f();
46
+ }
47
+ var _iterator2 = _createForOfIteratorHelper(ast.stylesheet.rules || []),
48
+ _step2;
49
+ try {
50
+ var _loop2 = function _loop2() {
51
+ var rule = _step2.value;
52
+ if (!stylesheet.isRuleTypeSupported(rule.type)) return 1; // continue
53
+ if (rule.type === "media") {
54
+ var _iterator3 = _createForOfIteratorHelper(rule.rules || []),
55
+ _step3;
56
+ try {
57
+ var _loop3 = function _loop3() {
58
+ var mediaRule = _step3.value;
59
+ if (!stylesheet.isRuleTypeSupported(mediaRule.type)) return 1; // continue
60
+ if (mediaRule.type === "rule") {
61
+ var declarations = stylesheet.simplifyDeclarations(mediaRule.declarations);
62
+ mediaRule.selectors.forEach(function (selector) {
63
+ if (!stylesheet.isSelectorSupported(selector)) return;
64
+ stylesheet.upsert(selector, _defineProperty({}, "@media ".concat(rule.media), declarations));
65
+ });
66
+ }
67
+ };
68
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
69
+ if (_loop3()) continue;
70
+ }
71
+ } catch (err) {
72
+ _iterator3.e(err);
73
+ } finally {
74
+ _iterator3.f();
75
+ }
76
+ }
77
+ };
78
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
79
+ if (_loop2()) continue;
80
+ }
81
+ } catch (err) {
82
+ _iterator2.e(err);
83
+ } finally {
84
+ _iterator2.f();
85
+ }
86
+ var jsonContent = stylesheet.toJSON();
87
+
88
+ // Always write the pre-computed stylesheet for Babel to read
89
+ writeStylesheetJSON(jsonContent, filename);
90
+ return jsonContent;
91
+ }
92
+ function writeStylesheetJSON(content, filename) {
93
+ try {
94
+ // Write to lib directory (where dist will be)
95
+ var libDir = _path["default"].join(__dirname);
96
+ _fs["default"].writeFileSync(_path["default"].join(libDir, "exported-stylesheet.json"), content, {
97
+ mode: 493
98
+ });
99
+
100
+ // Also write next to the source CSS file for easier debugging
101
+ if (filename) {
102
+ _fs["default"].writeFileSync("".concat(filename, ".json"), content, {
103
+ mode: 493
104
+ });
105
+ }
106
+ } catch (_unused) {
107
+ // Silently fail - Babel will fall back to runtime
108
+ }
109
+ }
110
+ module.exports.transform = function (_ref) {
111
+ var src = _ref.src,
112
+ filename = _ref.filename,
113
+ options = _ref.options;
114
+ var projectRoot = options && options.projectRoot ? options.projectRoot : process.cwd();
115
+ var resolveTransformer = function () {
116
+ var resolveOptions = {
117
+ paths: [projectRoot]
118
+ };
119
+ try {
120
+ return require(require.resolve("@expo/metro-config/babel-transformer", resolveOptions));
121
+ } catch (error) {
122
+ try {
123
+ return require(require.resolve("@react-native/metro-babel-transformer", resolveOptions));
124
+ } catch (error2) {
125
+ try {
126
+ return require(require.resolve("metro-react-native-babel-transformer", resolveOptions));
127
+ } catch (err) {
128
+ // Fallback to normal require in case of non-standard setups
129
+ try {
130
+ return require("@expo/metro-config/babel-transformer");
131
+ } catch (e) {
132
+ try {
133
+ return require("@react-native/metro-babel-transformer");
134
+ } catch (e2) {
135
+ try {
136
+ return require("metro-react-native-babel-transformer");
137
+ } catch (e3) {
138
+ throw new Error("Failed to load any upstream babel-transformer. Please ensure either '@expo/metro-config', '@react-native/metro-babel-transformer', or 'metro-react-native-babel-transformer' is installed.");
139
+ }
140
+ }
141
+ }
142
+ }
143
+ }
144
+ }
145
+ }();
146
+ if (filename.endsWith(".css")) {
147
+ return resolveTransformer.transform({
148
+ src: "module.exports = ".concat(getStylesheet(src, filename)),
149
+ filename: filename,
150
+ options: options
151
+ });
152
+ }
153
+ return resolveTransformer.transform({
154
+ src: src,
155
+ filename: filename,
156
+ options: options
157
+ });
158
+ };
@@ -0,0 +1,310 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = void 0;
7
+ var _reactNative = require("react-native");
8
+ var _cssCalc = _interopRequireDefault(require("./features/css-calc"));
9
+ var _cssMedia = _interopRequireDefault(require("./features/css-media"));
10
+ var _cssTransform = _interopRequireDefault(require("./features/css-transform"));
11
+ var _cssVars = _interopRequireDefault(require("./features/css-vars"));
12
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
13
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
14
+ function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
15
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
16
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
17
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
18
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
19
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
20
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
21
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
22
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
23
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
24
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
25
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
26
+ // ============================================================================
27
+ // Constants
28
+ // ============================================================================
29
+ var INHERIT_PROPERTIES = ["color", "fontFamily", "fontSize", "fontStyle", "fontWeight", "fontVariant", "letterSpacing", "lineHeight", "textAlign", "textTransform"];
30
+
31
+ // ============================================================================
32
+ // Singleton Helper Instances
33
+ // ============================================================================
34
+ var vars = new _cssVars["default"]();
35
+ var transform = new _cssTransform["default"]();
36
+ var calc = new _cssCalc["default"]();
37
+ var media = new _cssMedia["default"]();
38
+
39
+ // ============================================================================
40
+ // Cached Dimensions and Appearance
41
+ // ============================================================================
42
+ var cachedDimensions = null;
43
+ var cachedColorScheme = null;
44
+ var TRANSFORM_CACHE = {};
45
+ var currentCacheKey = null;
46
+ function getDimensions() {
47
+ if (!cachedDimensions) {
48
+ cachedDimensions = _reactNative.Dimensions.get("window");
49
+ }
50
+ return cachedDimensions;
51
+ }
52
+ function getColorScheme() {
53
+ if (cachedColorScheme === null) {
54
+ cachedColorScheme = _reactNative.Appearance.getColorScheme();
55
+ }
56
+ return cachedColorScheme;
57
+ }
58
+ function getCacheKey() {
59
+ var _getDimensions = getDimensions(),
60
+ width = _getDimensions.width,
61
+ height = _getDimensions.height;
62
+ var colorScheme = getColorScheme();
63
+ return "".concat(width, "x").concat(height, ":").concat(colorScheme);
64
+ }
65
+ function invalidateCache() {
66
+ cachedDimensions = null;
67
+ cachedColorScheme = null;
68
+ TRANSFORM_CACHE = {};
69
+ currentCacheKey = null;
70
+ }
71
+
72
+ // Event listeners for cache invalidation
73
+ _reactNative.Dimensions.addEventListener("change", invalidateCache);
74
+ _reactNative.Appearance.addChangeListener(invalidateCache);
75
+
76
+ // ============================================================================
77
+ // Flatten Style
78
+ // ============================================================================
79
+ function getFlattenStyle(declarations) {
80
+ if (!Array.isArray(declarations)) {
81
+ return declarations;
82
+ }
83
+ var result = {};
84
+ function merge(item) {
85
+ if (!item) return;
86
+ if (Array.isArray(item)) {
87
+ for (var i = 0; i < item.length; i++) {
88
+ merge(item[i]);
89
+ }
90
+ } else {
91
+ Object.assign(result, item);
92
+ }
93
+ }
94
+ for (var i = 0; i < declarations.length; i++) {
95
+ merge(declarations[i]);
96
+ }
97
+ return Object.keys(result).length > 0 ? result : undefined;
98
+ }
99
+
100
+ // ============================================================================
101
+ // Main Transform Function
102
+ // ============================================================================
103
+ function transformStyles(stylesheet, classNames) {
104
+ if (!stylesheet || !classNames) return undefined;
105
+ var _getDimensions2 = getDimensions(),
106
+ width = _getDimensions2.width,
107
+ height = _getDimensions2.height;
108
+ var colorScheme = getColorScheme();
109
+
110
+ // Check cache validity
111
+ var cacheKey = getCacheKey();
112
+ if (cacheKey !== currentCacheKey) {
113
+ TRANSFORM_CACHE = {};
114
+ currentCacheKey = cacheKey;
115
+ }
116
+ var transformedDeclarations = classNames.split(" ").map(function (className) {
117
+ if (!className) return null;
118
+
119
+ // Check cache
120
+ if (TRANSFORM_CACHE[className] !== undefined) {
121
+ return TRANSFORM_CACHE[className];
122
+ }
123
+ var declaration = stylesheet[className];
124
+ var globalDeclaration = stylesheet[":root"];
125
+ if (!declaration && !globalDeclaration) {
126
+ TRANSFORM_CACHE[className] = null;
127
+ return null;
128
+ }
129
+
130
+ // Reset vars helper
131
+ vars.global = {};
132
+ vars.data = {};
133
+ if (globalDeclaration) {
134
+ // Handle global with potential _static/_dynamic format
135
+ var globalRaw = globalDeclaration._static ? _objectSpread(_objectSpread({}, globalDeclaration._static), globalDeclaration._dynamic) : globalDeclaration;
136
+ vars.setGlobal(globalRaw, {
137
+ width: width,
138
+ height: height
139
+ });
140
+ }
141
+ if (declaration) {
142
+ // Handle declaration with potential _static/_dynamic format
143
+ var declRaw = declaration._static ? _objectSpread(_objectSpread({}, declaration._static), declaration._dynamic) : declaration;
144
+ vars.set(className, declRaw, {
145
+ width: width,
146
+ height: height
147
+ });
148
+ }
149
+
150
+ // Get static and dynamic parts
151
+ var staticPart = (declaration === null || declaration === void 0 ? void 0 : declaration._static) || {};
152
+ var dynamicPart = (declaration === null || declaration === void 0 ? void 0 : declaration._dynamic) || (declaration !== null && declaration !== void 0 && declaration._static ? {} : declaration) || {};
153
+
154
+ // Start with pre-computed static styles
155
+ var results = _objectSpread({}, staticPart);
156
+
157
+ // Process dynamic properties
158
+ var _transformDynamic = function transformDynamic(currentSelector, decl) {
159
+ for (var property in decl) {
160
+ if (vars.isVar(property)) continue;
161
+ var value = decl[property];
162
+
163
+ // Handle media queries
164
+ var _media$match = media.match(property, {
165
+ width: width,
166
+ height: height,
167
+ colorScheme: colorScheme
168
+ }),
169
+ _media$match2 = _slicedToArray(_media$match, 2),
170
+ isMedia = _media$match2[0],
171
+ matchedMedia = _media$match2[1];
172
+ if (isMedia) {
173
+ if (matchedMedia) {
174
+ var _value, _value2, _value3;
175
+ vars.set(property, value);
176
+ // Media query value might have _static/_dynamic too
177
+ var mediaStatic = ((_value = value) === null || _value === void 0 ? void 0 : _value._static) || {};
178
+ var mediaDynamic = ((_value2 = value) === null || _value2 === void 0 ? void 0 : _value2._dynamic) || ((_value3 = value) !== null && _value3 !== void 0 && _value3._static ? {} : value) || {};
179
+ Object.assign(results, mediaStatic);
180
+ _transformDynamic(property, mediaDynamic);
181
+ }
182
+ continue;
183
+ }
184
+
185
+ // Transform the value
186
+ var _transform$transformU = transform.transformUnsafeValue(property, value);
187
+ var _transform$transformU2 = _slicedToArray(_transform$transformU, 2);
188
+ property = _transform$transformU2[0];
189
+ value = _transform$transformU2[1];
190
+ if (!property) continue;
191
+ value = vars.injectVar(currentSelector, value);
192
+ value = transform.transformUnsupportedUnit(value);
193
+ value = transform.transformViewportUnit(value, {
194
+ width: width,
195
+ height: height
196
+ });
197
+ value = transform.removeUnit(value);
198
+ value = calc.calc(value);
199
+ value = calc.calcColor(value);
200
+ value = transform.transformFontScaling(property, value, {
201
+ width: width,
202
+ height: height,
203
+ roundFn: _reactNative.PixelRatio.roundToNearestPixel
204
+ });
205
+ if (value === undefined) continue;
206
+ var transformed = transform.transform(property, value, {
207
+ width: width,
208
+ height: height
209
+ });
210
+ if (transformed) {
211
+ Object.assign(results, transformed);
212
+ }
213
+ }
214
+ };
215
+ _transformDynamic(className, dynamicPart);
216
+ TRANSFORM_CACHE[className] = results;
217
+ return results;
218
+ });
219
+ return getFlattenStyle(transformedDeclarations);
220
+ }
221
+
222
+ // ============================================================================
223
+ // Inherit Style
224
+ // ============================================================================
225
+ function getInheritStyle(declarations) {
226
+ if (!declarations) return undefined;
227
+ var inheritDeclarations = {};
228
+ var _iterator = _createForOfIteratorHelper(INHERIT_PROPERTIES),
229
+ _step;
230
+ try {
231
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
232
+ var key = _step.value;
233
+ if (declarations[key] !== undefined) {
234
+ inheritDeclarations[key] = declarations[key];
235
+ }
236
+ }
237
+ } catch (err) {
238
+ _iterator.e(err);
239
+ } finally {
240
+ _iterator.f();
241
+ }
242
+ return Object.keys(inheritDeclarations).length > 0 ? inheritDeclarations : undefined;
243
+ }
244
+
245
+ // ============================================================================
246
+ // Main Entry Point
247
+ // ============================================================================
248
+ function getStyle(stylesheet, _ref) {
249
+ var _ref2 = _slicedToArray(_ref, 3),
250
+ inheritStyle = _ref2[0],
251
+ className = _ref2[1],
252
+ style = _ref2[2];
253
+ return getFlattenStyle([getInheritStyle(getFlattenStyle(inheritStyle)), transformStyles(stylesheet, className), style]);
254
+ }
255
+
256
+ // ============================================================================
257
+ // Lightweight Merge for Static Styles
258
+ // ============================================================================
259
+
260
+ /**
261
+ * Lightweight merge function for static styles with inheritStyle
262
+ * Much cheaper than full getStyle() - just extracts inherited props and merges
263
+ */
264
+ function mergeStyles(inheritStyle, staticStyles, inlineStyle) {
265
+ // Fast path: no inheritStyle
266
+ if (!inheritStyle && !inlineStyle) {
267
+ return staticStyles;
268
+ }
269
+
270
+ // Extract inherited properties from inheritStyle
271
+ var inherited;
272
+ if (inheritStyle) {
273
+ var flatInherit = getFlattenStyle(inheritStyle);
274
+ if (flatInherit) {
275
+ inherited = {};
276
+ var _iterator2 = _createForOfIteratorHelper(INHERIT_PROPERTIES),
277
+ _step2;
278
+ try {
279
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
280
+ var key = _step2.value;
281
+ if (flatInherit[key] !== undefined) {
282
+ inherited[key] = flatInherit[key];
283
+ }
284
+ }
285
+ } catch (err) {
286
+ _iterator2.e(err);
287
+ } finally {
288
+ _iterator2.f();
289
+ }
290
+ if (Object.keys(inherited).length === 0) {
291
+ inherited = undefined;
292
+ }
293
+ }
294
+ }
295
+
296
+ // Merge: inheritStyle (lowest) -> staticStyles -> inlineStyle (highest)
297
+ if (!inherited && !inlineStyle) {
298
+ return staticStyles;
299
+ }
300
+ var result = {};
301
+ if (inherited) Object.assign(result, inherited);
302
+ if (staticStyles) Object.assign(result, staticStyles);
303
+ if (inlineStyle) Object.assign(result, inlineStyle);
304
+ return Object.keys(result).length > 0 ? result : undefined;
305
+ }
306
+ var _default = exports["default"] = {
307
+ getStyle: getStyle,
308
+ getInheritStyle: getInheritStyle,
309
+ mergeStyles: mergeStyles
310
+ };