@cssxjs/css-to-react-native 3.2.0-0 → 3.2.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/index.js CHANGED
@@ -1,112 +1,85 @@
1
1
  'use strict';
2
2
 
3
- function _templateObject() {
4
- var data = _taggedTemplateLiteralLoose([", "]);
5
-
6
- _templateObject = function _templateObject() {
7
- return data;
8
- };
9
-
10
- return data;
11
- }
12
-
13
- function _taggedTemplateLiteralLoose(strings, raw) { if (!raw) { raw = strings.slice(0); } strings.raw = raw; return strings; }
14
-
3
+ var _templateObject;
4
+ function _createForOfIteratorHelperLoose(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (t) return (t = t.call(r)).next.bind(t); if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var o = 0; return function () { return o >= r.length ? { done: !0 } : { done: !1, value: r[o++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
5
+ 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; } }
6
+ 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; }
7
+ function _taggedTemplateLiteralLoose(e, t) { return t || (t = e.slice(0)), e.raw = t, e; }
15
8
  Object.defineProperty(exports, '__esModule', {
16
9
  value: true
17
10
  });
18
-
19
11
  function _interopDefault(ex) {
20
12
  return ex && typeof ex === 'object' && 'default' in ex ? ex['default'] : ex;
21
13
  }
22
-
23
14
  var parse = require('postcss-value-parser');
24
-
25
15
  var parse__default = _interopDefault(parse);
26
-
27
16
  var camelizeStyleName = _interopDefault(require('camelize'));
28
-
29
17
  var cssColorKeywords = _interopDefault(require('css-color-keywords'));
30
-
31
18
  var matchString = function matchString(node) {
32
19
  if (node.type !== 'string') return null;
33
20
  return node.value.replace(/\\([0-9a-f]{1,6})(?:\s|$)/gi, function (match, charCode) {
34
21
  return String.fromCharCode(parseInt(charCode, 16));
35
22
  }).replace(/\\/g, '');
36
23
  };
37
-
38
24
  var hexColorRe = /^(#(?:[0-9a-f]{3,4}){1,2})$/i;
39
25
  var cssFunctionNameRe = /^(rgba?|hsla?|hwb|lab|lch|gray|color)$/;
40
-
41
26
  var matchColor = function matchColor(node) {
42
27
  if (node.type === 'word' && (hexColorRe.test(node.value) || node.value in cssColorKeywords || node.value === 'transparent')) {
43
28
  return node.value;
44
29
  } else if (node.type === 'function' && cssFunctionNameRe.test(node.value)) {
45
30
  return parse.stringify(node);
46
31
  }
47
-
48
32
  return null;
49
33
  };
50
-
51
34
  var matchVariable = function matchVariable(node) {
52
- if (node.type !== 'function' && node.value !== 'var' || node.nodes.length === 0) return null;
35
+ if (node.type !== 'function' || node.value !== 'var' || node.nodes.length === 0) return null;
53
36
  var variableName = node.nodes[0].value;
54
-
55
37
  if (node.nodes.length === 1) {
56
38
  return "var(" + variableName + ")";
57
39
  }
58
-
59
40
  var defaultValues = node.nodes.slice(1).filter(function (subnode) {
60
41
  return subnode.type !== 'div';
61
42
  }).map(function (subnode) {
62
43
  if (subnode.type === 'string') {
63
44
  return "'" + matchString(subnode) + "'";
64
45
  }
65
-
66
46
  if (subnode.type === 'function' && ['rgb', 'rgba', 'hls', 'hlsa'].includes(subnode.value)) {
67
47
  return subnode.value + "(" + subnode.nodes.map(function (n) {
68
48
  return n.value;
69
49
  }).join('') + ")";
70
50
  }
71
-
72
51
  return subnode.value;
73
52
  });
74
-
75
53
  if (defaultValues.length !== (node.nodes.length - 1) / 2) {
76
54
  return null;
77
55
  }
78
-
79
- return "var(" + variableName + ", " + defaultValues.join(_templateObject()) + ")";
56
+ return "var(" + variableName + ", " + defaultValues.join(_templateObject || (_templateObject = _taggedTemplateLiteralLoose([", "]))) + ")";
80
57
  };
81
-
82
58
  var noneRe = /^(none)$/i;
83
59
  var autoRe = /^(auto)$/i;
84
- var identRe = /(^-?[_a-z][_a-z0-9-]*$)/i; // Note if these are wrong, you'll need to change index.js too
85
-
86
- var numberRe = /^([+-]?(?:\d*\.)?\d+(?:e[+-]?\d+)?)$/i; // Note lengthRe is sneaky: you can omit units for 0
87
-
60
+ var identRe = /(^-?[_a-z][_a-z0-9-]*$)/i;
61
+ // Note if these are wrong, you'll need to change index.js too
62
+ var numberRe = /^([+-]?(?:\d*\.)?\d+(?:e[+-]?\d+)?)$/i;
63
+ // Note lengthRe is sneaky: you can omit units for 0
88
64
  var lengthRe = /^(0$|(?:[+-]?(?:\d*\.)?\d+(?:e[+-]?\d+)?)(?=px$))/i;
89
65
  var unsupportedUnitRe = /^([+-]?(?:\d*\.)?\d+(?:e[+-]?\d+)?(ch|em|ex|rem|vh|vw|vmin|vmax|cm|mm|in|pc|pt))$/i;
90
66
  var angleRe = /^([+-]?(?:\d*\.)?\d+(?:e[+-]?\d+)?(?:deg|rad|grad|turn))$/i;
91
67
  var percentRe = /^([+-]?(?:\d*\.)?\d+(?:e[+-]?\d+)?%)$/i;
92
-
68
+ var timeRe = /^([+-]?(?:\d*\.)?\d+(?:e[+-]?\d+)?(?:ms|s))$/i;
93
69
  var noopToken = function noopToken(predicate) {
94
70
  return function (node) {
95
71
  return predicate(node) ? '<token>' : null;
96
72
  };
97
73
  };
98
-
99
74
  var valueForTypeToken = function valueForTypeToken(type) {
100
75
  return function (node) {
101
76
  return node.type === type ? node.value : null;
102
77
  };
103
78
  };
104
-
105
79
  var regExpToken = function regExpToken(regExp, transform) {
106
80
  if (transform === void 0) {
107
81
  transform = String;
108
82
  }
109
-
110
83
  return function (node) {
111
84
  if (node.type !== 'word') return null;
112
85
  var match = node.value.match(regExp);
@@ -115,7 +88,6 @@ var regExpToken = function regExpToken(regExp, transform) {
115
88
  return value;
116
89
  };
117
90
  };
118
-
119
91
  var SPACE = noopToken(function (node) {
120
92
  return node.type === 'space';
121
93
  });
@@ -135,35 +107,360 @@ var ANGLE = regExpToken(angleRe, function (angle) {
135
107
  return angle.toLowerCase();
136
108
  });
137
109
  var PERCENT = regExpToken(percentRe);
110
+ var TIME = regExpToken(timeRe);
138
111
  var IDENT = regExpToken(identRe);
139
112
  var STRING = matchString;
140
113
  var COLOR = matchColor;
141
114
  var LINE = regExpToken(/^(none|underline|line-through)$/i);
142
115
  var VARIABLE = matchVariable;
143
116
 
117
+ // Timing function keywords
118
+ var timingFunctionKeywords = ['ease', 'linear', 'ease-in', 'ease-out', 'ease-in-out', 'step-start', 'step-end'];
119
+
120
+ // Direction keywords
121
+ var directionKeywords = ['normal', 'reverse', 'alternate', 'alternate-reverse'];
122
+
123
+ // Fill mode keywords
124
+ var fillModeKeywords = ['none', 'forwards', 'backwards', 'both'];
125
+
126
+ // Play state keywords
127
+ var playStateKeywords = ['running', 'paused'];
128
+ var isTimingFunction = function isTimingFunction(value) {
129
+ return timingFunctionKeywords.includes(value.toLowerCase());
130
+ };
131
+ var isDirection = function isDirection(value) {
132
+ return directionKeywords.includes(value.toLowerCase());
133
+ };
134
+ var isFillMode = function isFillMode(value) {
135
+ return fillModeKeywords.includes(value.toLowerCase());
136
+ };
137
+ var isPlayState = function isPlayState(value) {
138
+ return playStateKeywords.includes(value.toLowerCase());
139
+ };
140
+ var isTime = function isTime(value) {
141
+ return /^[+-]?(?:\d*\.)?\d+(?:ms|s)$/i.test(value);
142
+ };
143
+ var isIterationCount = function isIterationCount(value) {
144
+ return value.toLowerCase() === 'infinite' || /^[+-]?(?:\d*\.)?\d+$/.test(value);
145
+ };
146
+
147
+ // Helper to parse comma-separated values
148
+ // Returns single value if only one, array if multiple
149
+ var parseCommaSeparatedValues = function parseCommaSeparatedValues(tokenStream, parseValue) {
150
+ var values = [];
151
+ var parsingFirst = true;
152
+ while (tokenStream.hasTokens()) {
153
+ if (!parsingFirst) {
154
+ tokenStream.expect(COMMA);
155
+ }
156
+
157
+ // Skip leading/trailing spaces
158
+ if (tokenStream.matches(SPACE)) ;
159
+ var value = parseValue(tokenStream);
160
+ values.push(value);
161
+
162
+ // Skip trailing spaces
163
+ if (tokenStream.matches(SPACE)) ;
164
+ parsingFirst = false;
165
+ }
166
+ return values.length === 1 ? values[0] : values;
167
+ };
168
+
169
+ // Transform for animation-name property
170
+ var animationName = function animationName(tokenStream) {
171
+ var names = parseCommaSeparatedValues(tokenStream, function (ts) {
172
+ return ts.expect(IDENT, NONE, VARIABLE);
173
+ });
174
+ return {
175
+ animationName: names
176
+ };
177
+ };
178
+
179
+ // Transform for animation-duration property
180
+ var animationDuration = function animationDuration(tokenStream) {
181
+ var durations = parseCommaSeparatedValues(tokenStream, function (ts) {
182
+ return ts.expect(TIME, VARIABLE);
183
+ });
184
+ return {
185
+ animationDuration: durations
186
+ };
187
+ };
188
+
189
+ // Transform for animation-timing-function property
190
+ var animationTimingFunction = function animationTimingFunction(tokenStream) {
191
+ var timingFunctions = parseCommaSeparatedValues(tokenStream, function (ts) {
192
+ // Check for function (cubic-bezier or steps)
193
+ var funcStream = ts.matchesFunction();
194
+ if (funcStream) {
195
+ var funcName = funcStream.functionName;
196
+ var args = [];
197
+ while (funcStream.hasTokens()) {
198
+ if (funcStream.matches(SPACE) || funcStream.matches(COMMA)) {
199
+ continue;
200
+ }
201
+ var val = funcStream.expect(IDENT, TIME, NUMBER, function (node) {
202
+ if (node.type === 'word') return node.value;
203
+ return null;
204
+ });
205
+ args.push(val);
206
+ }
207
+ return funcName + "(" + args.join(', ') + ")";
208
+ }
209
+ return ts.expect(IDENT);
210
+ });
211
+ return {
212
+ animationTimingFunction: timingFunctions
213
+ };
214
+ };
215
+
216
+ // Transform for animation-delay property
217
+ var animationDelay = function animationDelay(tokenStream) {
218
+ var delays = parseCommaSeparatedValues(tokenStream, function (ts) {
219
+ return ts.expect(TIME, VARIABLE);
220
+ });
221
+ return {
222
+ animationDelay: delays
223
+ };
224
+ };
225
+
226
+ // Transform for animation-iteration-count property
227
+ var animationIterationCount = function animationIterationCount(tokenStream) {
228
+ var counts = parseCommaSeparatedValues(tokenStream, function (ts) {
229
+ if (ts.matches(IDENT)) {
230
+ var value = ts.lastValue;
231
+ return value.toLowerCase() === 'infinite' ? 'infinite' : Number(value);
232
+ }
233
+ if (ts.matches(NUMBER)) {
234
+ return ts.lastValue;
235
+ }
236
+ var word = ts.expect(function (node) {
237
+ if (node.type === 'word') return node.value;
238
+ return null;
239
+ });
240
+ return word.toLowerCase() === 'infinite' ? 'infinite' : Number(word);
241
+ });
242
+ return {
243
+ animationIterationCount: counts
244
+ };
245
+ };
246
+
247
+ // Transform for animation-direction property
248
+ var animationDirection = function animationDirection(tokenStream) {
249
+ var directions = parseCommaSeparatedValues(tokenStream, function (ts) {
250
+ return ts.expect(IDENT);
251
+ });
252
+ return {
253
+ animationDirection: directions
254
+ };
255
+ };
256
+
257
+ // Transform for animation-fill-mode property
258
+ var animationFillMode = function animationFillMode(tokenStream) {
259
+ var fillModes = parseCommaSeparatedValues(tokenStream, function (ts) {
260
+ return ts.expect(IDENT);
261
+ });
262
+ return {
263
+ animationFillMode: fillModes
264
+ };
265
+ };
266
+
267
+ // Transform for animation-play-state property
268
+ var animationPlayState = function animationPlayState(tokenStream) {
269
+ var playStates = parseCommaSeparatedValues(tokenStream, function (ts) {
270
+ return ts.expect(IDENT);
271
+ });
272
+ return {
273
+ animationPlayState: playStates
274
+ };
275
+ };
276
+ var animation = function animation(tokenStream) {
277
+ // Handle 'none'
278
+ if (tokenStream.matches(NONE)) {
279
+ tokenStream.expectEmpty();
280
+ return {
281
+ animationName: 'none',
282
+ animationDuration: '0s',
283
+ animationTimingFunction: 'ease',
284
+ animationDelay: '0s',
285
+ animationIterationCount: 1,
286
+ animationDirection: 'normal',
287
+ animationFillMode: 'none',
288
+ animationPlayState: 'running'
289
+ };
290
+ }
291
+ var names = [];
292
+ var durations = [];
293
+ var timingFunctions = [];
294
+ var delays = [];
295
+ var iterationCounts = [];
296
+ var directions = [];
297
+ var fillModes = [];
298
+ var playStates = [];
299
+ var parsingFirst = true;
300
+ while (tokenStream.hasTokens()) {
301
+ if (!parsingFirst) {
302
+ tokenStream.expect(COMMA);
303
+ }
304
+
305
+ // Parse single animation
306
+ var name = null;
307
+ var duration = null;
308
+ var timingFunction = null;
309
+ var delay = null;
310
+ var iterationCount = null;
311
+ var direction = null;
312
+ var fillMode = null;
313
+ var playState = null;
314
+
315
+ // Skip leading space
316
+ if (tokenStream.matches(SPACE)) ;
317
+
318
+ // Parse tokens for this animation
319
+ while (tokenStream.hasTokens()) {
320
+ // Check for comma (next animation)
321
+ tokenStream.saveRewindPoint();
322
+ if (tokenStream.matches(SPACE)) {
323
+ if (tokenStream.matches(COMMA)) {
324
+ tokenStream.rewind();
325
+ break;
326
+ }
327
+ }
328
+ if (tokenStream.matches(COMMA)) {
329
+ tokenStream.rewind();
330
+ break;
331
+ }
332
+ tokenStream.rewind();
333
+
334
+ // Skip spaces
335
+ if (tokenStream.matches(SPACE)) {
336
+ continue;
337
+ }
338
+
339
+ // Match time or variable (for duration/delay) - check before functions
340
+ if (tokenStream.matches(TIME) || tokenStream.matches(VARIABLE)) {
341
+ var value = tokenStream.lastValue;
342
+ if (duration === null) {
343
+ duration = value;
344
+ } else {
345
+ delay = value;
346
+ }
347
+ continue;
348
+ }
349
+
350
+ // Check for timing function (cubic-bezier or steps)
351
+ var funcStream = tokenStream.matchesFunction();
352
+ if (funcStream) {
353
+ var funcName = funcStream.functionName;
354
+ var args = [];
355
+ while (funcStream.hasTokens()) {
356
+ if (funcStream.matches(SPACE) || funcStream.matches(COMMA)) {
357
+ continue;
358
+ }
359
+ var val = funcStream.expect(IDENT, TIME, NUMBER, function (node) {
360
+ if (node.type === 'word') return node.value;
361
+ return null;
362
+ });
363
+ args.push(val);
364
+ }
365
+ timingFunction = funcName + "(" + args.join(', ') + ")";
366
+ continue;
367
+ }
368
+
369
+ // Match number (iteration count)
370
+ if (tokenStream.matches(NUMBER)) {
371
+ iterationCount = tokenStream.lastValue;
372
+ continue;
373
+ }
374
+
375
+ // Match identifier
376
+ if (tokenStream.matches(IDENT)) {
377
+ var _value = tokenStream.lastValue;
378
+ if (isTimingFunction(_value)) {
379
+ timingFunction = _value;
380
+ } else if (isDirection(_value)) {
381
+ direction = _value;
382
+ } else if (isFillMode(_value)) {
383
+ fillMode = _value;
384
+ } else if (isPlayState(_value)) {
385
+ playState = _value;
386
+ } else if (_value.toLowerCase() === 'infinite') {
387
+ iterationCount = 'infinite';
388
+ } else {
389
+ // It's the animation name
390
+ name = _value;
391
+ }
392
+ continue;
393
+ }
394
+
395
+ // Try to match as generic word
396
+ var wordMatch = tokenStream.expect(function (node) {
397
+ if (node.type === 'word') return node.value;
398
+ return null;
399
+ });
400
+ if (isTime(wordMatch)) {
401
+ if (duration === null) {
402
+ duration = wordMatch;
403
+ } else {
404
+ delay = wordMatch;
405
+ }
406
+ } else if (isTimingFunction(wordMatch)) {
407
+ timingFunction = wordMatch;
408
+ } else if (isDirection(wordMatch)) {
409
+ direction = wordMatch;
410
+ } else if (isFillMode(wordMatch)) {
411
+ fillMode = wordMatch;
412
+ } else if (isPlayState(wordMatch)) {
413
+ playState = wordMatch;
414
+ } else if (isIterationCount(wordMatch)) {
415
+ iterationCount = wordMatch.toLowerCase() === 'infinite' ? 'infinite' : Number(wordMatch);
416
+ } else {
417
+ name = wordMatch;
418
+ }
419
+ }
420
+
421
+ // Apply defaults and push
422
+ names.push(name || 'none');
423
+ durations.push(duration || '0s');
424
+ timingFunctions.push(timingFunction || 'ease');
425
+ delays.push(delay || '0s');
426
+ iterationCounts.push(iterationCount !== null ? iterationCount : 1);
427
+ directions.push(direction || 'normal');
428
+ fillModes.push(fillMode || 'none');
429
+ playStates.push(playState || 'running');
430
+ parsingFirst = false;
431
+ }
432
+
433
+ // Return single values if only one animation, arrays if multiple
434
+ var isSingle = names.length === 1;
435
+ return {
436
+ animationName: isSingle ? names[0] : names,
437
+ animationDuration: isSingle ? durations[0] : durations,
438
+ animationTimingFunction: isSingle ? timingFunctions[0] : timingFunctions,
439
+ animationDelay: isSingle ? delays[0] : delays,
440
+ animationIterationCount: isSingle ? iterationCounts[0] : iterationCounts,
441
+ animationDirection: isSingle ? directions[0] : directions,
442
+ animationFillMode: isSingle ? fillModes[0] : fillModes,
443
+ animationPlayState: isSingle ? playStates[0] : playStates
444
+ };
445
+ };
144
446
  var aspectRatio = function aspectRatio(tokenStream) {
145
447
  var aspectRatio = tokenStream.expect(NUMBER);
146
-
147
448
  if (tokenStream.hasTokens()) {
148
449
  tokenStream.expect(SLASH);
149
450
  aspectRatio /= tokenStream.expect(NUMBER);
150
451
  }
151
-
152
452
  return {
153
453
  aspectRatio: aspectRatio
154
454
  };
155
455
  };
156
-
157
456
  var BORDER_STYLE = regExpToken(/^(solid|dashed|dotted)$/);
158
457
  var defaultBorderWidth = 1;
159
458
  var defaultBorderColor = 'black';
160
459
  var defaultBorderStyle = 'solid';
161
-
162
460
  var border = function border(tokenStream) {
163
461
  var borderWidth;
164
462
  var borderColor;
165
463
  var borderStyle;
166
-
167
464
  if (tokenStream.matches(NONE)) {
168
465
  tokenStream.expectEmpty();
169
466
  return {
@@ -172,12 +469,9 @@ var border = function border(tokenStream) {
172
469
  borderStyle: 'solid'
173
470
  };
174
471
  }
175
-
176
472
  var partsParsed = 0;
177
-
178
473
  while (partsParsed < 3 && tokenStream.hasTokens()) {
179
474
  if (partsParsed !== 0) tokenStream.expect(SPACE);
180
-
181
475
  if (borderWidth === undefined && tokenStream.matches(LENGTH, UNSUPPORTED_LENGTH_UNIT)) {
182
476
  borderWidth = tokenStream.lastValue;
183
477
  } else if (borderColor === undefined && (tokenStream.matches(COLOR) || tokenStream.matches(VARIABLE))) {
@@ -187,10 +481,8 @@ var border = function border(tokenStream) {
187
481
  } else {
188
482
  tokenStream["throw"]();
189
483
  }
190
-
191
484
  partsParsed += 1;
192
485
  }
193
-
194
486
  tokenStream.expectEmpty();
195
487
  if (borderWidth === undefined) borderWidth = defaultBorderWidth;
196
488
  if (borderColor === undefined) borderColor = defaultBorderColor;
@@ -201,132 +493,21 @@ var border = function border(tokenStream) {
201
493
  borderStyle: borderStyle
202
494
  };
203
495
  };
204
-
205
- var directionFactory = function directionFactory(_ref) {
206
- var _ref$types = _ref.types,
207
- types = _ref$types === void 0 ? [LENGTH, UNSUPPORTED_LENGTH_UNIT, PERCENT] : _ref$types,
208
- _ref$directions = _ref.directions,
209
- directions = _ref$directions === void 0 ? ['Top', 'Right', 'Bottom', 'Left'] : _ref$directions,
210
- _ref$prefix = _ref.prefix,
211
- prefix = _ref$prefix === void 0 ? '' : _ref$prefix,
212
- _ref$suffix = _ref.suffix,
213
- suffix = _ref$suffix === void 0 ? '' : _ref$suffix;
214
- return function (tokenStream) {
215
- var _ref2;
216
-
217
- var values = []; // borderWidth doesn't currently allow a percent value, but may do in the future
218
-
219
- values.push(tokenStream.expect.apply(tokenStream, types));
220
-
221
- while (values.length < 4 && tokenStream.hasTokens()) {
222
- tokenStream.expect(SPACE);
223
- values.push(tokenStream.expect.apply(tokenStream, types));
224
- }
225
-
226
- tokenStream.expectEmpty();
227
- var top = values[0],
228
- _values$ = values[1],
229
- right = _values$ === void 0 ? top : _values$,
230
- _values$2 = values[2],
231
- bottom = _values$2 === void 0 ? top : _values$2,
232
- _values$3 = values[3],
233
- left = _values$3 === void 0 ? right : _values$3;
234
-
235
- var keyFor = function keyFor(n) {
236
- return "" + prefix + directions[n] + suffix;
237
- };
238
-
239
- return _ref2 = {}, _ref2[keyFor(0)] = top, _ref2[keyFor(1)] = right, _ref2[keyFor(2)] = bottom, _ref2[keyFor(3)] = left, _ref2;
240
- };
241
- };
242
-
243
- var parseShadowOffset = function parseShadowOffset(tokenStream) {
244
- var width = tokenStream.expect(LENGTH);
245
- var height = tokenStream.matches(SPACE) ? tokenStream.expect(LENGTH) : width;
246
- tokenStream.expectEmpty();
247
- return {
248
- width: width,
249
- height: height
250
- };
251
- };
252
-
253
- var parseShadow = function parseShadow(tokenStream) {
254
- var offsetX;
255
- var offsetY;
256
- var radius;
257
- var color;
258
-
259
- if (tokenStream.matches(NONE)) {
260
- tokenStream.expectEmpty();
261
- return {
262
- offset: {
263
- width: 0,
264
- height: 0
265
- },
266
- radius: 0,
267
- color: 'black'
268
- };
269
- }
270
-
271
- var didParseFirst = false;
272
-
273
- while (tokenStream.hasTokens()) {
274
- if (didParseFirst) tokenStream.expect(SPACE);
275
-
276
- if (offsetX === undefined && tokenStream.matches(LENGTH, UNSUPPORTED_LENGTH_UNIT)) {
277
- offsetX = tokenStream.lastValue;
278
- tokenStream.expect(SPACE);
279
- offsetY = tokenStream.expect(LENGTH, UNSUPPORTED_LENGTH_UNIT);
280
- tokenStream.saveRewindPoint();
281
-
282
- if (tokenStream.matches(SPACE) && tokenStream.matches(LENGTH, UNSUPPORTED_LENGTH_UNIT)) {
283
- radius = tokenStream.lastValue;
284
- } else {
285
- tokenStream.rewind();
286
- }
287
- } else if (color === undefined && (tokenStream.matches(COLOR) || tokenStream.matches(VARIABLE))) {
288
- color = tokenStream.lastValue;
289
- } else {
290
- tokenStream["throw"]();
291
- }
292
-
293
- didParseFirst = true;
294
- }
295
-
296
- if (offsetX === undefined) tokenStream["throw"]();
297
- return {
298
- offset: {
299
- width: offsetX,
300
- height: offsetY
301
- },
302
- radius: radius !== undefined ? radius : 0,
303
- color: color !== undefined ? color : 'black'
304
- };
305
- };
306
-
307
496
  var boxShadow = function boxShadow(tokenStream) {
308
- var _parseShadow = parseShadow(tokenStream),
309
- offset = _parseShadow.offset,
310
- radius = _parseShadow.radius,
311
- color = _parseShadow.color;
312
-
497
+ // React Native now supports web-style box-shadow format directly
498
+ // Pass through the original CSS value as boxShadow
499
+ var value = parse.stringify(tokenStream.nodes);
313
500
  return {
314
- shadowOffset: offset,
315
- shadowRadius: radius,
316
- shadowColor: color,
317
- shadowOpacity: 1
501
+ boxShadow: value
318
502
  };
319
503
  };
320
-
321
504
  var defaultFlexGrow = 1;
322
505
  var defaultFlexShrink = 1;
323
506
  var defaultFlexBasis = 0;
324
-
325
507
  var flex = function flex(tokenStream) {
326
508
  var flexGrow;
327
509
  var flexShrink;
328
510
  var flexBasis;
329
-
330
511
  if (tokenStream.matches(NONE)) {
331
512
  tokenStream.expectEmpty();
332
513
  return {
@@ -335,9 +516,7 @@ var flex = function flex(tokenStream) {
335
516
  flexBasis: 'auto'
336
517
  };
337
518
  }
338
-
339
519
  tokenStream.saveRewindPoint();
340
-
341
520
  if (tokenStream.matches(AUTO) && !tokenStream.hasTokens()) {
342
521
  return {
343
522
  flexGrow: 1,
@@ -345,17 +524,13 @@ var flex = function flex(tokenStream) {
345
524
  flexBasis: 'auto'
346
525
  };
347
526
  }
348
-
349
527
  tokenStream.rewind();
350
528
  var partsParsed = 0;
351
-
352
529
  while (partsParsed < 2 && tokenStream.hasTokens()) {
353
530
  if (partsParsed !== 0) tokenStream.expect(SPACE);
354
-
355
531
  if (flexGrow === undefined && tokenStream.matches(NUMBER)) {
356
532
  flexGrow = tokenStream.lastValue;
357
533
  tokenStream.saveRewindPoint();
358
-
359
534
  if (tokenStream.matches(SPACE) && tokenStream.matches(NUMBER)) {
360
535
  flexShrink = tokenStream.lastValue;
361
536
  } else {
@@ -368,10 +543,8 @@ var flex = function flex(tokenStream) {
368
543
  } else {
369
544
  tokenStream["throw"]();
370
545
  }
371
-
372
546
  partsParsed += 1;
373
547
  }
374
-
375
548
  tokenStream.expectEmpty();
376
549
  if (flexGrow === undefined) flexGrow = defaultFlexGrow;
377
550
  if (flexShrink === undefined) flexShrink = defaultFlexShrink;
@@ -382,20 +555,16 @@ var flex = function flex(tokenStream) {
382
555
  flexBasis: flexBasis
383
556
  };
384
557
  };
385
-
386
558
  var FLEX_WRAP = regExpToken(/(nowrap|wrap|wrap-reverse)/);
387
559
  var FLEX_DIRECTION = regExpToken(/(row|row-reverse|column|column-reverse)/);
388
560
  var defaultFlexWrap = 'nowrap';
389
561
  var defaultFlexDirection = 'row';
390
-
391
562
  var flexFlow = function flexFlow(tokenStream) {
392
563
  var flexWrap;
393
564
  var flexDirection;
394
565
  var partsParsed = 0;
395
-
396
566
  while (partsParsed < 2 && tokenStream.hasTokens()) {
397
567
  if (partsParsed !== 0) tokenStream.expect(SPACE);
398
-
399
568
  if (flexWrap === undefined && tokenStream.matches(FLEX_WRAP)) {
400
569
  flexWrap = tokenStream.lastValue;
401
570
  } else if (flexDirection === undefined && tokenStream.matches(FLEX_DIRECTION)) {
@@ -403,10 +572,8 @@ var flexFlow = function flexFlow(tokenStream) {
403
572
  } else {
404
573
  tokenStream["throw"]();
405
574
  }
406
-
407
575
  partsParsed += 1;
408
576
  }
409
-
410
577
  tokenStream.expectEmpty();
411
578
  if (flexWrap === undefined) flexWrap = defaultFlexWrap;
412
579
  if (flexDirection === undefined) flexDirection = defaultFlexDirection;
@@ -415,28 +582,23 @@ var flexFlow = function flexFlow(tokenStream) {
415
582
  flexDirection: flexDirection
416
583
  };
417
584
  };
418
-
419
585
  var fontFamily = function fontFamily(tokenStream) {
420
586
  var fontFamily;
421
-
422
587
  if (tokenStream.matches(STRING)) {
423
588
  fontFamily = tokenStream.lastValue;
424
589
  } else {
425
590
  fontFamily = tokenStream.expect(IDENT);
426
-
427
591
  while (tokenStream.hasTokens()) {
428
592
  tokenStream.expect(SPACE);
429
593
  var nextIdent = tokenStream.expect(IDENT);
430
594
  fontFamily += " " + nextIdent;
431
595
  }
432
596
  }
433
-
434
597
  tokenStream.expectEmpty();
435
598
  return {
436
599
  fontFamily: fontFamily
437
600
  };
438
601
  };
439
-
440
602
  var NORMAL = regExpToken(/^(normal)$/);
441
603
  var STYLE = regExpToken(/^(italic)$/);
442
604
  var WEIGHT = regExpToken(/^([1-9]00|bold)$/);
@@ -444,16 +606,15 @@ var VARIANT = regExpToken(/^(small-caps)$/);
444
606
  var defaultFontStyle = 'normal';
445
607
  var defaultFontWeight = 'normal';
446
608
  var defaultFontVariant = [];
447
-
448
609
  var font = function font(tokenStream) {
449
610
  var fontStyle;
450
611
  var fontWeight;
451
- var fontVariant; // let fontSize;
452
-
453
- var lineHeight; // let fontFamily;
612
+ var fontVariant;
613
+ // let fontSize;
614
+ var lineHeight;
615
+ // let fontFamily;
454
616
 
455
617
  var numStyleWeightVariantMatched = 0;
456
-
457
618
  while (numStyleWeightVariantMatched < 3 && tokenStream.hasTokens()) {
458
619
  if (tokenStream.matches(NORMAL)) ;else if (fontStyle === undefined && tokenStream.matches(STYLE)) {
459
620
  fontStyle = tokenStream.lastValue;
@@ -467,18 +628,13 @@ var font = function font(tokenStream) {
467
628
  tokenStream.expect(SPACE);
468
629
  numStyleWeightVariantMatched += 1;
469
630
  }
470
-
471
631
  var fontSize = tokenStream.expect(LENGTH, UNSUPPORTED_LENGTH_UNIT);
472
-
473
632
  if (tokenStream.matches(SLASH)) {
474
633
  lineHeight = tokenStream.expect(LENGTH, UNSUPPORTED_LENGTH_UNIT);
475
634
  }
476
-
477
635
  tokenStream.expect(SPACE);
478
-
479
636
  var _fontFamily = fontFamily(tokenStream),
480
- fontFamily$1 = _fontFamily.fontFamily;
481
-
637
+ fontFamily$1 = _fontFamily.fontFamily;
482
638
  if (fontStyle === undefined) fontStyle = defaultFontStyle;
483
639
  if (fontWeight === undefined) fontWeight = defaultFontWeight;
484
640
  if (fontVariant === undefined) fontVariant = defaultFontVariant;
@@ -492,67 +648,54 @@ var font = function font(tokenStream) {
492
648
  if (lineHeight !== undefined) out.lineHeight = lineHeight;
493
649
  return out;
494
650
  };
495
-
496
651
  var fontVariant = function fontVariant(tokenStream) {
497
652
  var values = [tokenStream.expect(IDENT)];
498
-
499
653
  while (tokenStream.hasTokens()) {
500
654
  tokenStream.expect(SPACE);
501
655
  values.push(tokenStream.expect(IDENT));
502
656
  }
503
-
504
657
  return {
505
658
  fontVariant: values
506
659
  };
507
660
  };
508
-
509
661
  var ALIGN_CONTENT = regExpToken(/(flex-(?:start|end)|center|stretch|space-(?:between|around))/);
510
662
  var JUSTIFY_CONTENT = regExpToken(/(flex-(?:start|end)|center|space-(?:between|around|evenly))/);
511
-
512
663
  var placeContent = function placeContent(tokenStream) {
513
664
  var alignContent = tokenStream.expect(ALIGN_CONTENT);
514
665
  var justifyContent;
515
-
516
666
  if (tokenStream.hasTokens()) {
517
667
  tokenStream.expect(SPACE);
518
668
  justifyContent = tokenStream.expect(JUSTIFY_CONTENT);
519
669
  } else {
520
670
  justifyContent = 'stretch';
521
671
  }
522
-
523
672
  tokenStream.expectEmpty();
524
673
  return {
525
674
  alignContent: alignContent,
526
675
  justifyContent: justifyContent
527
676
  };
528
677
  };
529
-
530
678
  var STYLE$1 = regExpToken(/^(solid|double|dotted|dashed)$/);
531
679
  var defaultTextDecorationLine = 'none';
532
680
  var defaultTextDecorationStyle = 'solid';
533
681
  var defaultTextDecorationColor = 'black';
534
-
535
682
  var textDecoration = function textDecoration(tokenStream) {
536
683
  var line;
537
684
  var style;
538
685
  var color;
539
686
  var didParseFirst = false;
540
-
541
687
  while (tokenStream.hasTokens()) {
542
688
  if (didParseFirst) tokenStream.expect(SPACE);
543
-
544
689
  if (line === undefined && tokenStream.matches(LINE)) {
545
690
  var lines = [tokenStream.lastValue.toLowerCase()];
546
691
  tokenStream.saveRewindPoint();
547
-
548
692
  if (lines[0] !== 'none' && tokenStream.matches(SPACE) && tokenStream.matches(LINE)) {
549
- lines.push(tokenStream.lastValue.toLowerCase()); // Underline comes before line-through
550
-
693
+ lines.push(tokenStream.lastValue.toLowerCase());
694
+ // Underline comes before line-through
551
695
  lines.sort().reverse();
552
696
  } else {
553
697
  tokenStream.rewind();
554
698
  }
555
-
556
699
  line = lines.join(' ');
557
700
  } else if (style === undefined && tokenStream.matches(STYLE$1)) {
558
701
  style = tokenStream.lastValue;
@@ -561,46 +704,144 @@ var textDecoration = function textDecoration(tokenStream) {
561
704
  } else {
562
705
  tokenStream["throw"]();
563
706
  }
564
-
565
707
  didParseFirst = true;
566
708
  }
567
-
568
709
  return {
569
710
  textDecorationLine: line !== undefined ? line : defaultTextDecorationLine,
570
711
  textDecorationColor: color !== undefined ? color : defaultTextDecorationColor,
571
712
  textDecorationStyle: style !== undefined ? style : defaultTextDecorationStyle
572
713
  };
573
714
  };
574
-
575
715
  var textDecorationLine = function textDecorationLine(tokenStream) {
576
716
  var lines = [];
577
717
  var didParseFirst = false;
578
-
579
718
  while (tokenStream.hasTokens()) {
580
719
  if (didParseFirst) tokenStream.expect(SPACE);
581
720
  lines.push(tokenStream.expect(LINE).toLowerCase());
582
721
  didParseFirst = true;
583
722
  }
584
-
585
723
  lines.sort().reverse();
586
724
  return {
587
725
  textDecorationLine: lines.join(' ')
588
726
  };
589
727
  };
728
+ var directionFactory = function directionFactory(_ref) {
729
+ var _ref$types = _ref.types,
730
+ types = _ref$types === void 0 ? [LENGTH, UNSUPPORTED_LENGTH_UNIT, PERCENT, VARIABLE] : _ref$types,
731
+ _ref$directions = _ref.directions,
732
+ directions = _ref$directions === void 0 ? ['Top', 'Right', 'Bottom', 'Left'] : _ref$directions,
733
+ _ref$prefix = _ref.prefix,
734
+ prefix = _ref$prefix === void 0 ? '' : _ref$prefix,
735
+ _ref$suffix = _ref.suffix,
736
+ suffix = _ref$suffix === void 0 ? '' : _ref$suffix;
737
+ return function (tokenStream) {
738
+ var _ref2;
739
+ var values = [];
590
740
 
591
- var textShadow = function textShadow(tokenStream) {
592
- var _parseShadow2 = parseShadow(tokenStream),
593
- offset = _parseShadow2.offset,
594
- radius = _parseShadow2.radius,
595
- color = _parseShadow2.color;
741
+ // borderWidth doesn't currently allow a percent value, but may do in the future
742
+ values.push(tokenStream.expect.apply(tokenStream, types));
743
+ while (values.length < 4 && tokenStream.hasTokens()) {
744
+ tokenStream.expect(SPACE);
745
+ values.push(tokenStream.expect.apply(tokenStream, types));
746
+ }
747
+ tokenStream.expectEmpty();
748
+ var top = values[0],
749
+ _values$ = values[1],
750
+ right = _values$ === void 0 ? top : _values$,
751
+ _values$2 = values[2],
752
+ bottom = _values$2 === void 0 ? top : _values$2,
753
+ _values$3 = values[3],
754
+ left = _values$3 === void 0 ? right : _values$3;
755
+ var keyFor = function keyFor(n) {
756
+ return "" + prefix + directions[n] + suffix;
757
+ };
758
+ return _ref2 = {}, _ref2[keyFor(0)] = top, _ref2[keyFor(1)] = right, _ref2[keyFor(2)] = bottom, _ref2[keyFor(3)] = left, _ref2;
759
+ };
760
+ };
761
+ var parseShadowOffset = function parseShadowOffset(tokenStream) {
762
+ var width = tokenStream.expect(LENGTH);
763
+ var height = tokenStream.matches(SPACE) ? tokenStream.expect(LENGTH) : width;
764
+ tokenStream.expectEmpty();
765
+ return {
766
+ width: width,
767
+ height: height
768
+ };
769
+ };
770
+ var parseShadow = function parseShadow(tokenStream) {
771
+ var offsetX;
772
+ var offsetY;
773
+ var radius;
774
+ var color;
775
+ if (tokenStream.matches(NONE)) {
776
+ tokenStream.expectEmpty();
777
+ return {
778
+ offset: {
779
+ width: 0,
780
+ height: 0
781
+ },
782
+ radius: 0,
783
+ color: 'black'
784
+ };
785
+ }
786
+ var didParseFirst = false;
787
+ while (tokenStream.hasTokens()) {
788
+ if (didParseFirst) tokenStream.expect(SPACE);
789
+ if (offsetX === undefined && tokenStream.matches(LENGTH, UNSUPPORTED_LENGTH_UNIT)) {
790
+ // First offset must be a concrete LENGTH to distinguish from color
791
+ offsetX = tokenStream.lastValue;
792
+ tokenStream.expect(SPACE);
793
+ // Second offset and radius can be VARIABLE
794
+ offsetY = tokenStream.expect(LENGTH, UNSUPPORTED_LENGTH_UNIT, VARIABLE);
596
795
 
796
+ // Try to match optional blur-radius (concrete LENGTH only here)
797
+ tokenStream.saveRewindPoint();
798
+ if (tokenStream.matches(SPACE) && tokenStream.matches(LENGTH, UNSUPPORTED_LENGTH_UNIT)) {
799
+ radius = tokenStream.lastValue;
800
+ } else {
801
+ tokenStream.rewind();
802
+ }
803
+ } else if (offsetX !== undefined && radius === undefined && color === undefined && tokenStream.matches(VARIABLE)) {
804
+ // VARIABLE after offsets - could be radius or color
805
+ // Peek ahead to determine which
806
+ var potentialValue = tokenStream.lastValue;
807
+ tokenStream.saveRewindPoint();
808
+ if (tokenStream.matches(SPACE) && tokenStream.hasTokens()) {
809
+ // There's more content - this VARIABLE is the radius
810
+ tokenStream.rewind();
811
+ radius = potentialValue;
812
+ } else {
813
+ // No more content - this VARIABLE is the color
814
+ tokenStream.rewind();
815
+ color = potentialValue;
816
+ }
817
+ } else if (color === undefined && (tokenStream.matches(COLOR) || tokenStream.matches(VARIABLE))) {
818
+ color = tokenStream.lastValue;
819
+ } else {
820
+ tokenStream["throw"]();
821
+ }
822
+ didParseFirst = true;
823
+ }
824
+ if (offsetX === undefined) tokenStream["throw"]();
825
+ return {
826
+ offset: {
827
+ width: offsetX,
828
+ height: offsetY
829
+ },
830
+ radius: radius !== undefined ? radius : 0,
831
+ color: color !== undefined ? color : 'black'
832
+ };
833
+ };
834
+ var textShadow = function textShadow(tokenStream) {
835
+ var _parseShadow = parseShadow(tokenStream),
836
+ offset = _parseShadow.offset,
837
+ radius = _parseShadow.radius,
838
+ color = _parseShadow.color;
597
839
  return {
598
840
  textShadowOffset: offset,
599
841
  textShadowRadius: radius,
600
842
  textShadowColor: color
601
843
  };
602
844
  };
603
-
604
845
  var oneOfTypes = function oneOfTypes(tokenTypes) {
605
846
  return function (functionStream) {
606
847
  var value = functionStream.expect.apply(functionStream, tokenTypes);
@@ -608,19 +849,15 @@ var oneOfTypes = function oneOfTypes(tokenTypes) {
608
849
  return value;
609
850
  };
610
851
  };
611
-
612
- var singleNumber = oneOfTypes([NUMBER]);
613
- var singleLengthOrPercent = oneOfTypes([LENGTH, PERCENT]);
614
- var singleAngle = oneOfTypes([ANGLE]);
615
-
852
+ var singleNumber = oneOfTypes([NUMBER, VARIABLE]);
853
+ var singleLengthOrPercent = oneOfTypes([LENGTH, PERCENT, VARIABLE]);
854
+ var singleAngle = oneOfTypes([ANGLE, VARIABLE]);
616
855
  var xyTransformFactory = function xyTransformFactory(tokenTypes) {
617
856
  return function (key, valueIfOmitted) {
618
857
  return function (functionStream) {
619
858
  var _ref3, _ref4;
620
-
621
859
  var x = functionStream.expect.apply(functionStream, tokenTypes);
622
860
  var y;
623
-
624
861
  if (functionStream.hasTokens()) {
625
862
  functionStream.expect(COMMA);
626
863
  y = functionStream.expect.apply(functionStream, tokenTypes);
@@ -631,16 +868,14 @@ var xyTransformFactory = function xyTransformFactory(tokenTypes) {
631
868
  // I.e. scale(5) => [{ scale: 5 }] rather than [{ scaleX: 5 }, { scaleY: 5 }]
632
869
  return x;
633
870
  }
634
-
635
871
  functionStream.expectEmpty();
636
872
  return [(_ref3 = {}, _ref3[key + "Y"] = y, _ref3), (_ref4 = {}, _ref4[key + "X"] = x, _ref4)];
637
873
  };
638
874
  };
639
875
  };
640
-
641
- var xyNumber = xyTransformFactory([NUMBER]);
642
- var xyLengthOrPercent = xyTransformFactory([LENGTH, PERCENT]);
643
- var xyAngle = xyTransformFactory([ANGLE]);
876
+ var xyNumber = xyTransformFactory([NUMBER, VARIABLE]);
877
+ var xyLengthOrPercent = xyTransformFactory([LENGTH, PERCENT, VARIABLE]);
878
+ var xyAngle = xyTransformFactory([ANGLE, VARIABLE]);
644
879
  var partTransforms = {
645
880
  perspective: singleNumber,
646
881
  scale: xyNumber('scale'),
@@ -657,38 +892,253 @@ var partTransforms = {
657
892
  skewY: singleAngle,
658
893
  skew: xyAngle('skew', '0deg')
659
894
  };
660
-
661
895
  var transform = function transform(tokenStream) {
662
896
  var transforms = [];
663
897
  var didParseFirst = false;
664
-
665
898
  while (tokenStream.hasTokens()) {
666
899
  if (didParseFirst) tokenStream.expect(SPACE);
667
900
  var functionStream = tokenStream.expectFunction();
668
901
  var functionName = functionStream.functionName;
669
902
  var transformedValues = partTransforms[functionName](functionStream);
670
-
671
903
  if (!Array.isArray(transformedValues)) {
672
904
  var _ref5;
673
-
674
905
  transformedValues = [(_ref5 = {}, _ref5[functionName] = transformedValues, _ref5)];
675
906
  }
676
-
677
907
  transforms = transformedValues.concat(transforms);
678
908
  didParseFirst = true;
679
909
  }
680
-
681
910
  return {
682
911
  transform: transforms
683
912
  };
684
913
  };
685
914
 
915
+ // Timing function keywords
916
+ var timingFunctionKeywords$1 = ['ease', 'linear', 'ease-in', 'ease-out', 'ease-in-out', 'step-start', 'step-end'];
917
+ var isTimingFunction$1 = function isTimingFunction$1(value) {
918
+ if (timingFunctionKeywords$1.includes(value.toLowerCase())) {
919
+ return true;
920
+ }
921
+ // cubic-bezier and steps are handled as functions
922
+ return false;
923
+ };
924
+ var isTime$1 = function isTime$1(value) {
925
+ return /^[+-]?(?:\d*\.)?\d+(?:ms|s)$/i.test(value);
926
+ };
927
+
928
+ // Helper to parse comma-separated values
929
+ // Returns single value if only one, array if multiple
930
+ var parseCommaSeparatedValues$1 = function parseCommaSeparatedValues$1(tokenStream, parseValue) {
931
+ var values = [];
932
+ var parsingFirst = true;
933
+ while (tokenStream.hasTokens()) {
934
+ if (!parsingFirst) {
935
+ tokenStream.expect(COMMA);
936
+ }
937
+
938
+ // Skip leading/trailing spaces
939
+ if (tokenStream.matches(SPACE)) ;
940
+ var value = parseValue(tokenStream);
941
+ values.push(value);
942
+
943
+ // Skip trailing spaces
944
+ if (tokenStream.matches(SPACE)) ;
945
+ parsingFirst = false;
946
+ }
947
+ return values.length === 1 ? values[0] : values;
948
+ };
949
+
950
+ // Transform for transition-property
951
+ var transitionProperty = function transitionProperty(tokenStream) {
952
+ var properties = parseCommaSeparatedValues$1(tokenStream, function (ts) {
953
+ var prop = ts.expect(IDENT, NONE);
954
+ // Don't camelize special values like 'all' and 'none'
955
+ return prop === 'all' || prop === 'none' ? prop : camelizeStyleName(prop);
956
+ });
957
+ return {
958
+ transitionProperty: properties
959
+ };
960
+ };
961
+
962
+ // Transform for transition-duration
963
+ var transitionDuration = function transitionDuration(tokenStream) {
964
+ var durations = parseCommaSeparatedValues$1(tokenStream, function (ts) {
965
+ return ts.expect(TIME, VARIABLE);
966
+ });
967
+ return {
968
+ transitionDuration: durations
969
+ };
970
+ };
971
+
972
+ // Transform for transition-timing-function
973
+ var transitionTimingFunction = function transitionTimingFunction(tokenStream) {
974
+ var timingFunctions = parseCommaSeparatedValues$1(tokenStream, function (ts) {
975
+ // Check for function (cubic-bezier or steps)
976
+ var funcStream = ts.matchesFunction();
977
+ if (funcStream) {
978
+ var funcName = funcStream.functionName;
979
+ var args = [];
980
+ while (funcStream.hasTokens()) {
981
+ if (funcStream.matches(SPACE) || funcStream.matches(COMMA)) {
982
+ continue;
983
+ }
984
+ var val = funcStream.expect(IDENT, TIME, function (node) {
985
+ if (node.type === 'word') return node.value;
986
+ return null;
987
+ });
988
+ args.push(val);
989
+ }
990
+ return funcName + "(" + args.join(', ') + ")";
991
+ }
992
+ return ts.expect(IDENT);
993
+ });
994
+ return {
995
+ transitionTimingFunction: timingFunctions
996
+ };
997
+ };
998
+
999
+ // Transform for transition-delay
1000
+ var transitionDelay = function transitionDelay(tokenStream) {
1001
+ var delays = parseCommaSeparatedValues$1(tokenStream, function (ts) {
1002
+ return ts.expect(TIME, VARIABLE);
1003
+ });
1004
+ return {
1005
+ transitionDelay: delays
1006
+ };
1007
+ };
1008
+ var transition = function transition(tokenStream) {
1009
+ // Handle 'none'
1010
+ if (tokenStream.matches(NONE)) {
1011
+ tokenStream.expectEmpty();
1012
+ return {
1013
+ transitionProperty: 'none',
1014
+ transitionDuration: '0s',
1015
+ transitionTimingFunction: 'ease',
1016
+ transitionDelay: '0s'
1017
+ };
1018
+ }
1019
+ var properties = [];
1020
+ var durations = [];
1021
+ var timingFunctions = [];
1022
+ var delays = [];
1023
+ var parsingFirst = true;
1024
+ while (tokenStream.hasTokens()) {
1025
+ if (!parsingFirst) {
1026
+ tokenStream.expect(COMMA);
1027
+ }
1028
+
1029
+ // Parse single transition: property duration timing-function delay
1030
+ // Order can vary, but typically: property duration [timing-function] [delay]
1031
+ var property = null;
1032
+ var duration = null;
1033
+ var timingFunction = null;
1034
+ var delay = null;
1035
+
1036
+ // Skip leading space
1037
+ if (tokenStream.matches(SPACE)) ;
1038
+
1039
+ // Parse tokens for this transition
1040
+ while (tokenStream.hasTokens()) {
1041
+ // Check for comma (next transition)
1042
+ tokenStream.saveRewindPoint();
1043
+ if (tokenStream.matches(SPACE)) {
1044
+ if (tokenStream.matches(COMMA)) {
1045
+ tokenStream.rewind();
1046
+ break;
1047
+ }
1048
+ }
1049
+ if (tokenStream.matches(COMMA)) {
1050
+ tokenStream.rewind();
1051
+ break;
1052
+ }
1053
+ tokenStream.rewind();
1054
+
1055
+ // Try to match different token types
1056
+ if (tokenStream.matches(SPACE)) {
1057
+ continue;
1058
+ }
1059
+
1060
+ // Match time or variable (for duration/delay) - check before functions
1061
+ if (tokenStream.matches(TIME) || tokenStream.matches(VARIABLE)) {
1062
+ var value = tokenStream.lastValue;
1063
+ if (duration === null) {
1064
+ duration = value;
1065
+ } else {
1066
+ delay = value;
1067
+ }
1068
+ continue;
1069
+ }
1070
+
1071
+ // Check for timing function (cubic-bezier or steps)
1072
+ var funcStream = tokenStream.matchesFunction();
1073
+ if (funcStream) {
1074
+ var funcName = funcStream.functionName;
1075
+ var args = [];
1076
+ while (funcStream.hasTokens()) {
1077
+ if (funcStream.matches(SPACE) || funcStream.matches(COMMA)) {
1078
+ continue;
1079
+ }
1080
+ var val = funcStream.expect(IDENT, TIME, function (node) {
1081
+ if (node.type === 'word') return node.value;
1082
+ return null;
1083
+ });
1084
+ args.push(val);
1085
+ }
1086
+ timingFunction = funcName + "(" + args.join(', ') + ")";
1087
+ continue;
1088
+ }
1089
+
1090
+ // Match word or time
1091
+ if (tokenStream.matches(IDENT)) {
1092
+ var _value2 = tokenStream.lastValue;
1093
+ if (isTimingFunction$1(_value2)) {
1094
+ timingFunction = _value2;
1095
+ } else {
1096
+ property = _value2;
1097
+ }
1098
+ continue;
1099
+ }
1100
+
1101
+ // Try to match as word for property names like 'all', 'opacity', etc.
1102
+ var wordMatch = tokenStream.expect(function (node) {
1103
+ if (node.type === 'word') return node.value;
1104
+ return null;
1105
+ });
1106
+ if (isTime$1(wordMatch)) {
1107
+ if (duration === null) {
1108
+ duration = wordMatch;
1109
+ } else {
1110
+ delay = wordMatch;
1111
+ }
1112
+ } else if (isTimingFunction$1(wordMatch)) {
1113
+ timingFunction = wordMatch;
1114
+ } else {
1115
+ property = wordMatch;
1116
+ }
1117
+ }
1118
+
1119
+ // Apply defaults and camelize property name
1120
+ var propName = property || 'all';
1121
+ properties.push(propName === 'all' ? 'all' : camelizeStyleName(propName));
1122
+ durations.push(duration || '0s');
1123
+ timingFunctions.push(timingFunction || 'ease');
1124
+ delays.push(delay || '0s');
1125
+ parsingFirst = false;
1126
+ }
1127
+
1128
+ // Return single values if only one transition, arrays if multiple
1129
+ var isSingle = properties.length === 1;
1130
+ return {
1131
+ transitionProperty: isSingle ? properties[0] : properties,
1132
+ transitionDuration: isSingle ? durations[0] : durations,
1133
+ transitionTimingFunction: isSingle ? timingFunctions[0] : timingFunctions,
1134
+ transitionDelay: isSingle ? delays[0] : delays
1135
+ };
1136
+ };
686
1137
  var background = function background(tokenStream) {
687
1138
  return {
688
1139
  backgroundColor: tokenStream.expect(COLOR, VARIABLE)
689
1140
  };
690
1141
  };
691
-
692
1142
  var borderColor = directionFactory({
693
1143
  types: [COLOR, VARIABLE],
694
1144
  prefix: 'border',
@@ -704,33 +1154,37 @@ var borderWidth = directionFactory({
704
1154
  suffix: 'Width'
705
1155
  });
706
1156
  var margin = directionFactory({
707
- types: [LENGTH, UNSUPPORTED_LENGTH_UNIT, PERCENT, AUTO],
1157
+ types: [LENGTH, UNSUPPORTED_LENGTH_UNIT, PERCENT, AUTO, VARIABLE],
708
1158
  prefix: 'margin'
709
1159
  });
710
1160
  var padding = directionFactory({
711
1161
  prefix: 'padding'
712
1162
  });
713
-
714
1163
  var fontWeight = function fontWeight(tokenStream) {
715
1164
  return {
716
1165
  fontWeight: tokenStream.expect(WORD) // Also match numbers as strings
717
-
718
1166
  };
719
1167
  };
720
-
721
1168
  var shadowOffset = function shadowOffset(tokenStream) {
722
1169
  return {
723
1170
  shadowOffset: parseShadowOffset(tokenStream)
724
1171
  };
725
1172
  };
726
-
727
1173
  var textShadowOffset = function textShadowOffset(tokenStream) {
728
1174
  return {
729
1175
  textShadowOffset: parseShadowOffset(tokenStream)
730
1176
  };
731
1177
  };
732
-
733
1178
  var transforms = {
1179
+ animation: animation,
1180
+ animationName: animationName,
1181
+ animationDuration: animationDuration,
1182
+ animationTimingFunction: animationTimingFunction,
1183
+ animationDelay: animationDelay,
1184
+ animationIterationCount: animationIterationCount,
1185
+ animationDirection: animationDirection,
1186
+ animationFillMode: animationFillMode,
1187
+ animationPlayState: animationPlayState,
734
1188
  aspectRatio: aspectRatio,
735
1189
  background: background,
736
1190
  border: border,
@@ -752,20 +1206,20 @@ var transforms = {
752
1206
  textShadowOffset: textShadowOffset,
753
1207
  textDecoration: textDecoration,
754
1208
  textDecorationLine: textDecorationLine,
755
- transform: transform
1209
+ transform: transform,
1210
+ transition: transition,
1211
+ transitionProperty: transitionProperty,
1212
+ transitionDuration: transitionDuration,
1213
+ transitionTimingFunction: transitionTimingFunction,
1214
+ transitionDelay: transitionDelay
756
1215
  };
757
1216
  var propertiesWithoutUnits;
758
-
759
1217
  if (process.env.NODE_ENV !== 'production') {
760
1218
  propertiesWithoutUnits = ['aspectRatio', 'elevation', 'flexGrow', 'flexShrink', 'opacity', 'shadowOpacity', 'zIndex'];
761
1219
  }
762
-
763
1220
  var devPropertiesWithUnitsRegExp = propertiesWithoutUnits != null ? new RegExp(propertiesWithoutUnits.join('|')) : null;
764
1221
  var SYMBOL_MATCH = 'SYMBOL_MATCH';
765
-
766
- var TokenStream =
767
- /*#__PURE__*/
768
- function () {
1222
+ var TokenStream = /*#__PURE__*/function () {
769
1223
  function TokenStream(nodes, parent) {
770
1224
  this.index = 0;
771
1225
  this.nodes = nodes;
@@ -773,40 +1227,31 @@ function () {
773
1227
  this.lastValue = null;
774
1228
  this.rewindIndex = -1;
775
1229
  }
776
-
777
1230
  var _proto = TokenStream.prototype;
778
-
779
1231
  _proto.hasTokens = function hasTokens() {
780
1232
  return this.index <= this.nodes.length - 1;
781
1233
  };
782
-
783
1234
  _proto[SYMBOL_MATCH] = function () {
784
1235
  if (!this.hasTokens()) return null;
785
1236
  var node = this.nodes[this.index];
786
-
787
1237
  for (var i = 0; i < arguments.length; i += 1) {
788
1238
  var tokenDescriptor = i < 0 || arguments.length <= i ? undefined : arguments[i];
789
1239
  var value = tokenDescriptor(node);
790
-
791
1240
  if (value !== null) {
792
1241
  this.index += 1;
793
1242
  this.lastValue = value;
794
1243
  return value;
795
1244
  }
796
1245
  }
797
-
798
1246
  return null;
799
1247
  };
800
-
801
1248
  _proto.matches = function matches() {
802
1249
  return this[SYMBOL_MATCH].apply(this, arguments) !== null;
803
1250
  };
804
-
805
1251
  _proto.expect = function expect() {
806
1252
  var value = this[SYMBOL_MATCH].apply(this, arguments);
807
1253
  return value !== null ? value : this["throw"]();
808
1254
  };
809
-
810
1255
  _proto.matchesFunction = function matchesFunction() {
811
1256
  var node = this.nodes[this.index];
812
1257
  if (node.type !== 'function') return null;
@@ -815,58 +1260,48 @@ function () {
815
1260
  this.lastValue = null;
816
1261
  return value;
817
1262
  };
818
-
819
1263
  _proto.expectFunction = function expectFunction() {
820
1264
  var value = this.matchesFunction();
821
1265
  return value !== null ? value : this["throw"]();
822
1266
  };
823
-
824
1267
  _proto.expectEmpty = function expectEmpty() {
825
1268
  if (this.hasTokens()) this["throw"]();
826
1269
  };
827
-
828
1270
  _proto["throw"] = function _throw() {
829
1271
  throw new Error("Unexpected token type: " + this.nodes[this.index].type);
830
1272
  };
831
-
832
1273
  _proto.saveRewindPoint = function saveRewindPoint() {
833
1274
  this.rewindIndex = this.index;
834
1275
  };
835
-
836
1276
  _proto.rewind = function rewind() {
837
1277
  if (this.rewindIndex === -1) throw new Error('Internal error');
838
1278
  this.index = this.rewindIndex;
839
1279
  this.lastValue = null;
840
1280
  };
841
-
842
1281
  return TokenStream;
843
1282
  }();
844
1283
  /* eslint-disable no-param-reassign */
845
1284
  // Note if this is wrong, you'll need to change tokenTypes.js too
846
-
847
-
848
1285
  var numberOrLengthRe = /^([+-]?(?:\d*\.)?\d+(?:e[+-]?\d+)?)(?:px)?$/i;
849
1286
  var numberOnlyRe = /^[+-]?(?:\d*\.\d*|[1-9]\d*)(?:e[+-]?\d+)?$/i;
850
1287
  var boolRe = /^true|false$/i;
851
1288
  var nullRe = /^null$/i;
852
- var undefinedRe = /^undefined$/i; // Undocumented export
1289
+ var undefinedRe = /^undefined$/i;
853
1290
 
1291
+ // Undocumented export
854
1292
  var transformRawValue = function transformRawValue(propName, value) {
855
1293
  if (process.env.NODE_ENV !== 'production') {
856
1294
  var needsUnit = !devPropertiesWithUnitsRegExp.test(propName);
857
1295
  var isNumberWithoutUnit = numberOnlyRe.test(value);
858
-
859
1296
  if (needsUnit && isNumberWithoutUnit) {
860
1297
  // eslint-disable-next-line no-console
861
1298
  console.warn("Expected style \"" + propName + ": " + value + "\" to contain units");
862
1299
  }
863
-
864
1300
  if (!needsUnit && value !== '0' && !isNumberWithoutUnit) {
865
1301
  // eslint-disable-next-line no-console
866
1302
  console.warn("Expected style \"" + propName + ": " + value + "\" to be unitless");
867
1303
  }
868
1304
  }
869
-
870
1305
  var numberMatch = value.match(numberOrLengthRe);
871
1306
  if (numberMatch !== null) return Number(numberMatch[1]);
872
1307
  var boolMatch = value.match(boolRe);
@@ -877,13 +1312,11 @@ var transformRawValue = function transformRawValue(propName, value) {
877
1312
  if (undefinedMatch !== null) return undefined;
878
1313
  return value;
879
1314
  };
880
-
881
1315
  var baseTransformShorthandValue = function baseTransformShorthandValue(propName, value) {
882
1316
  var ast = parse__default(value);
883
1317
  var tokenStream = new TokenStream(ast.nodes);
884
1318
  return transforms[propName](tokenStream);
885
1319
  };
886
-
887
1320
  var transformShorthandValue = process.env.NODE_ENV === 'production' ? baseTransformShorthandValue : function (propName, value) {
888
1321
  try {
889
1322
  return baseTransformShorthandValue(propName, value);
@@ -891,39 +1324,154 @@ var transformShorthandValue = process.env.NODE_ENV === 'production' ? baseTransf
891
1324
  throw new Error("Failed to parse declaration \"" + propName + ": " + value + "\"");
892
1325
  }
893
1326
  };
894
-
895
1327
  var getStylesForProperty = function getStylesForProperty(propName, inputValue, allowShorthand) {
896
1328
  var _ref6;
897
-
898
1329
  var isRawValue = allowShorthand === false || !(propName in transforms);
899
1330
  var value = inputValue.trim();
900
1331
  var propValues = isRawValue ? (_ref6 = {}, _ref6[propName] = transformRawValue(propName, value), _ref6) : transformShorthandValue(propName, value);
901
1332
  return propValues;
902
1333
  };
903
-
904
1334
  var getPropertyName = function getPropertyName(propName) {
905
1335
  var isCustomProp = /^--\w+/.test(propName);
906
-
907
1336
  if (isCustomProp) {
908
1337
  return propName;
909
1338
  }
910
-
911
1339
  return camelizeStyleName(propName);
912
1340
  };
913
1341
 
914
- var index = function index(rules, shorthandBlacklist) {
915
- if (shorthandBlacklist === void 0) {
916
- shorthandBlacklist = [];
1342
+ /**
1343
+ * Strip CSS comments from a string
1344
+ * Handles both single-line and multi-line comments
1345
+ */
1346
+ var stripCssComments = function stripCssComments(css) {
1347
+ return css.replace(/\/\*[\s\S]*?\*\//g, '');
1348
+ };
1349
+
1350
+ /**
1351
+ * Parse CSS declarations into React Native styles (for keyframes)
1352
+ */
1353
+ var parseKeyframeDeclarations = function parseKeyframeDeclarations(declarationsStr) {
1354
+ var declarations = [];
1355
+ var parts = declarationsStr.split(';');
1356
+ for (var _iterator = _createForOfIteratorHelperLoose(parts), _step; !(_step = _iterator()).done;) {
1357
+ var part = _step.value;
1358
+ var trimmed = part.trim();
1359
+ if (!trimmed) continue;
1360
+ var colonIndex = trimmed.indexOf(':');
1361
+ if (colonIndex === -1) continue;
1362
+ var property = trimmed.substring(0, colonIndex).trim();
1363
+ var value = trimmed.substring(colonIndex + 1).trim();
1364
+ if (property && value) {
1365
+ declarations.push([property, value]);
1366
+ }
1367
+ }
1368
+ if (declarations.length === 0) {
1369
+ return {};
917
1370
  }
918
1371
 
919
- return rules.reduce(function (accum, rule) {
1372
+ // Transform each declaration
1373
+ return declarations.reduce(function (accum, rule) {
920
1374
  var propertyName = getPropertyName(rule[0]);
921
1375
  var value = rule[1];
922
- var allowShorthand = shorthandBlacklist.indexOf(propertyName) === -1;
923
- return Object.assign(accum, getStylesForProperty(propertyName, value, allowShorthand));
1376
+ return Object.assign(accum, getStylesForProperty(propertyName, value, true));
924
1377
  }, {});
925
1378
  };
926
1379
 
1380
+ /**
1381
+ * Parse keyframe body CSS into a keyframe object
1382
+ * @param {string} body - CSS keyframe body
1383
+ * @returns {Object} Keyframe object with selectors as keys
1384
+ */
1385
+ var parseKeyframeBody = function parseKeyframeBody(body) {
1386
+ // Strip CSS comments before parsing
1387
+ var cleanBody = stripCssComments(body);
1388
+ var keyframeObject = {};
1389
+ var selectorRegex = /([a-zA-Z0-9%,\s]+)\s*\{\s*([^}]*)\s*\}/g;
1390
+ var selectorMatch;
1391
+
1392
+ // eslint-disable-next-line no-cond-assign
1393
+ while ((selectorMatch = selectorRegex.exec(cleanBody)) !== null) {
1394
+ var selectors = selectorMatch[1].split(',').map(function (s) {
1395
+ return s.trim();
1396
+ }).filter(function (s) {
1397
+ return s;
1398
+ });
1399
+ var declarations = selectorMatch[2];
1400
+
1401
+ // Parse CSS declarations into style object
1402
+ var styles = parseKeyframeDeclarations(declarations);
1403
+ for (var _iterator2 = _createForOfIteratorHelperLoose(selectors), _step2; !(_step2 = _iterator2()).done;) {
1404
+ var selector = _step2.value;
1405
+ keyframeObject[selector] = styles;
1406
+ }
1407
+ }
1408
+ return keyframeObject;
1409
+ };
1410
+
1411
+ /**
1412
+ * Check if a property name is a @keyframes rule
1413
+ */
1414
+ var isKeyframesRule = function isKeyframesRule(propName) {
1415
+ return propName.startsWith('@keyframes ') || propName.startsWith('@keyframes\t');
1416
+ };
1417
+
1418
+ /**
1419
+ * Extract keyframe name from @keyframes rule
1420
+ */
1421
+ var getKeyframeName = function getKeyframeName(propName) {
1422
+ return propName.replace(/^@keyframes\s+/, '').trim();
1423
+ };
1424
+ var index = function index(rules, shorthandBlacklist) {
1425
+ if (shorthandBlacklist === void 0) {
1426
+ shorthandBlacklist = [];
1427
+ }
1428
+ // First pass: collect @keyframes definitions
1429
+ var keyframesMap = {};
1430
+ for (var _iterator3 = _createForOfIteratorHelperLoose(rules), _step3; !(_step3 = _iterator3()).done;) {
1431
+ var rule = _step3.value;
1432
+ var propName = rule[0];
1433
+ if (isKeyframesRule(propName)) {
1434
+ var keyframeName = getKeyframeName(propName);
1435
+ var keyframeBody = rule[1];
1436
+ keyframesMap[keyframeName] = parseKeyframeBody(keyframeBody);
1437
+ }
1438
+ }
1439
+
1440
+ // Second pass: transform all non-keyframes rules
1441
+ var result = {};
1442
+ for (var _iterator4 = _createForOfIteratorHelperLoose(rules), _step4; !(_step4 = _iterator4()).done;) {
1443
+ var _rule = _step4.value;
1444
+ var _propName = _rule[0];
1445
+
1446
+ // Skip @keyframes rules in the output
1447
+ if (isKeyframesRule(_propName)) {
1448
+ continue;
1449
+ }
1450
+ var propertyName = getPropertyName(_propName);
1451
+ var value = _rule[1];
1452
+ var allowShorthand = shorthandBlacklist.indexOf(propertyName) === -1;
1453
+ var propValues = getStylesForProperty(propertyName, value, allowShorthand);
1454
+ Object.assign(result, propValues);
1455
+ }
1456
+
1457
+ // Third pass: replace animationName strings with actual keyframe objects
1458
+ if (result.animationName) {
1459
+ if (Array.isArray(result.animationName)) {
1460
+ result.animationName = result.animationName.map(function (name) {
1461
+ if (typeof name === 'string' && name !== 'none' && keyframesMap[name]) {
1462
+ return keyframesMap[name];
1463
+ }
1464
+ return name;
1465
+ });
1466
+ } else if (typeof result.animationName === 'string') {
1467
+ // Handle single value case
1468
+ if (result.animationName !== 'none' && keyframesMap[result.animationName]) {
1469
+ result.animationName = keyframesMap[result.animationName];
1470
+ }
1471
+ }
1472
+ }
1473
+ return result;
1474
+ };
927
1475
  exports["default"] = index;
928
1476
  exports.getPropertyName = getPropertyName;
929
1477
  exports.getStylesForProperty = getStylesForProperty;