@cssxjs/css-to-react-native 3.2.0-0 → 3.2.0-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/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
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);
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);
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);
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
+ // Check for timing function (cubic-bezier or steps)
340
+ var funcStream = tokenStream.matchesFunction();
341
+ if (funcStream) {
342
+ var funcName = funcStream.functionName;
343
+ var args = [];
344
+ while (funcStream.hasTokens()) {
345
+ if (funcStream.matches(SPACE) || funcStream.matches(COMMA)) {
346
+ continue;
347
+ }
348
+ var val = funcStream.expect(IDENT, TIME, NUMBER, function (node) {
349
+ if (node.type === 'word') return node.value;
350
+ return null;
351
+ });
352
+ args.push(val);
353
+ }
354
+ timingFunction = funcName + "(" + args.join(', ') + ")";
355
+ continue;
356
+ }
357
+
358
+ // Match number (iteration count)
359
+ if (tokenStream.matches(NUMBER)) {
360
+ iterationCount = tokenStream.lastValue;
361
+ continue;
362
+ }
363
+
364
+ // Match time
365
+ if (tokenStream.matches(TIME)) {
366
+ var value = tokenStream.lastValue;
367
+ if (duration === null) {
368
+ duration = value;
369
+ } else {
370
+ delay = value;
371
+ }
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,126 @@ 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] : _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
 
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
+ offsetX = tokenStream.lastValue;
791
+ tokenStream.expect(SPACE);
792
+ offsetY = tokenStream.expect(LENGTH, UNSUPPORTED_LENGTH_UNIT);
793
+ tokenStream.saveRewindPoint();
794
+ if (tokenStream.matches(SPACE) && tokenStream.matches(LENGTH, UNSUPPORTED_LENGTH_UNIT)) {
795
+ radius = tokenStream.lastValue;
796
+ } else {
797
+ tokenStream.rewind();
798
+ }
799
+ } else if (color === undefined && (tokenStream.matches(COLOR) || tokenStream.matches(VARIABLE))) {
800
+ color = tokenStream.lastValue;
801
+ } else {
802
+ tokenStream["throw"]();
803
+ }
804
+ didParseFirst = true;
805
+ }
806
+ if (offsetX === undefined) tokenStream["throw"]();
807
+ return {
808
+ offset: {
809
+ width: offsetX,
810
+ height: offsetY
811
+ },
812
+ radius: radius !== undefined ? radius : 0,
813
+ color: color !== undefined ? color : 'black'
814
+ };
815
+ };
591
816
  var textShadow = function textShadow(tokenStream) {
592
- var _parseShadow2 = parseShadow(tokenStream),
593
- offset = _parseShadow2.offset,
594
- radius = _parseShadow2.radius,
595
- color = _parseShadow2.color;
596
-
817
+ var _parseShadow = parseShadow(tokenStream),
818
+ offset = _parseShadow.offset,
819
+ radius = _parseShadow.radius,
820
+ color = _parseShadow.color;
597
821
  return {
598
822
  textShadowOffset: offset,
599
823
  textShadowRadius: radius,
600
824
  textShadowColor: color
601
825
  };
602
826
  };
603
-
604
827
  var oneOfTypes = function oneOfTypes(tokenTypes) {
605
828
  return function (functionStream) {
606
829
  var value = functionStream.expect.apply(functionStream, tokenTypes);
@@ -608,19 +831,15 @@ var oneOfTypes = function oneOfTypes(tokenTypes) {
608
831
  return value;
609
832
  };
610
833
  };
611
-
612
834
  var singleNumber = oneOfTypes([NUMBER]);
613
835
  var singleLengthOrPercent = oneOfTypes([LENGTH, PERCENT]);
614
836
  var singleAngle = oneOfTypes([ANGLE]);
615
-
616
837
  var xyTransformFactory = function xyTransformFactory(tokenTypes) {
617
838
  return function (key, valueIfOmitted) {
618
839
  return function (functionStream) {
619
840
  var _ref3, _ref4;
620
-
621
841
  var x = functionStream.expect.apply(functionStream, tokenTypes);
622
842
  var y;
623
-
624
843
  if (functionStream.hasTokens()) {
625
844
  functionStream.expect(COMMA);
626
845
  y = functionStream.expect.apply(functionStream, tokenTypes);
@@ -631,13 +850,11 @@ var xyTransformFactory = function xyTransformFactory(tokenTypes) {
631
850
  // I.e. scale(5) => [{ scale: 5 }] rather than [{ scaleX: 5 }, { scaleY: 5 }]
632
851
  return x;
633
852
  }
634
-
635
853
  functionStream.expectEmpty();
636
854
  return [(_ref3 = {}, _ref3[key + "Y"] = y, _ref3), (_ref4 = {}, _ref4[key + "X"] = x, _ref4)];
637
855
  };
638
856
  };
639
857
  };
640
-
641
858
  var xyNumber = xyTransformFactory([NUMBER]);
642
859
  var xyLengthOrPercent = xyTransformFactory([LENGTH, PERCENT]);
643
860
  var xyAngle = xyTransformFactory([ANGLE]);
@@ -657,38 +874,252 @@ var partTransforms = {
657
874
  skewY: singleAngle,
658
875
  skew: xyAngle('skew', '0deg')
659
876
  };
660
-
661
877
  var transform = function transform(tokenStream) {
662
878
  var transforms = [];
663
879
  var didParseFirst = false;
664
-
665
880
  while (tokenStream.hasTokens()) {
666
881
  if (didParseFirst) tokenStream.expect(SPACE);
667
882
  var functionStream = tokenStream.expectFunction();
668
883
  var functionName = functionStream.functionName;
669
884
  var transformedValues = partTransforms[functionName](functionStream);
670
-
671
885
  if (!Array.isArray(transformedValues)) {
672
886
  var _ref5;
673
-
674
887
  transformedValues = [(_ref5 = {}, _ref5[functionName] = transformedValues, _ref5)];
675
888
  }
676
-
677
889
  transforms = transformedValues.concat(transforms);
678
890
  didParseFirst = true;
679
891
  }
680
-
681
892
  return {
682
893
  transform: transforms
683
894
  };
684
895
  };
685
896
 
897
+ // Timing function keywords
898
+ var timingFunctionKeywords$1 = ['ease', 'linear', 'ease-in', 'ease-out', 'ease-in-out', 'step-start', 'step-end'];
899
+ var isTimingFunction$1 = function isTimingFunction$1(value) {
900
+ if (timingFunctionKeywords$1.includes(value.toLowerCase())) {
901
+ return true;
902
+ }
903
+ // cubic-bezier and steps are handled as functions
904
+ return false;
905
+ };
906
+ var isTime$1 = function isTime$1(value) {
907
+ return /^[+-]?(?:\d*\.)?\d+(?:ms|s)$/i.test(value);
908
+ };
909
+
910
+ // Helper to parse comma-separated values
911
+ // Returns single value if only one, array if multiple
912
+ var parseCommaSeparatedValues$1 = function parseCommaSeparatedValues$1(tokenStream, parseValue) {
913
+ var values = [];
914
+ var parsingFirst = true;
915
+ while (tokenStream.hasTokens()) {
916
+ if (!parsingFirst) {
917
+ tokenStream.expect(COMMA);
918
+ }
919
+
920
+ // Skip leading/trailing spaces
921
+ if (tokenStream.matches(SPACE)) ;
922
+ var value = parseValue(tokenStream);
923
+ values.push(value);
924
+
925
+ // Skip trailing spaces
926
+ if (tokenStream.matches(SPACE)) ;
927
+ parsingFirst = false;
928
+ }
929
+ return values.length === 1 ? values[0] : values;
930
+ };
931
+
932
+ // Transform for transition-property
933
+ var transitionProperty = function transitionProperty(tokenStream) {
934
+ var properties = parseCommaSeparatedValues$1(tokenStream, function (ts) {
935
+ var prop = ts.expect(IDENT, NONE);
936
+ // Don't camelize special values like 'all' and 'none'
937
+ return prop === 'all' || prop === 'none' ? prop : camelizeStyleName(prop);
938
+ });
939
+ return {
940
+ transitionProperty: properties
941
+ };
942
+ };
943
+
944
+ // Transform for transition-duration
945
+ var transitionDuration = function transitionDuration(tokenStream) {
946
+ var durations = parseCommaSeparatedValues$1(tokenStream, function (ts) {
947
+ return ts.expect(TIME);
948
+ });
949
+ return {
950
+ transitionDuration: durations
951
+ };
952
+ };
953
+
954
+ // Transform for transition-timing-function
955
+ var transitionTimingFunction = function transitionTimingFunction(tokenStream) {
956
+ var timingFunctions = parseCommaSeparatedValues$1(tokenStream, function (ts) {
957
+ // Check for function (cubic-bezier or steps)
958
+ var funcStream = ts.matchesFunction();
959
+ if (funcStream) {
960
+ var funcName = funcStream.functionName;
961
+ var args = [];
962
+ while (funcStream.hasTokens()) {
963
+ if (funcStream.matches(SPACE) || funcStream.matches(COMMA)) {
964
+ continue;
965
+ }
966
+ var val = funcStream.expect(IDENT, TIME, function (node) {
967
+ if (node.type === 'word') return node.value;
968
+ return null;
969
+ });
970
+ args.push(val);
971
+ }
972
+ return funcName + "(" + args.join(', ') + ")";
973
+ }
974
+ return ts.expect(IDENT);
975
+ });
976
+ return {
977
+ transitionTimingFunction: timingFunctions
978
+ };
979
+ };
980
+
981
+ // Transform for transition-delay
982
+ var transitionDelay = function transitionDelay(tokenStream) {
983
+ var delays = parseCommaSeparatedValues$1(tokenStream, function (ts) {
984
+ return ts.expect(TIME);
985
+ });
986
+ return {
987
+ transitionDelay: delays
988
+ };
989
+ };
990
+ var transition = function transition(tokenStream) {
991
+ // Handle 'none'
992
+ if (tokenStream.matches(NONE)) {
993
+ tokenStream.expectEmpty();
994
+ return {
995
+ transitionProperty: 'none',
996
+ transitionDuration: '0s',
997
+ transitionTimingFunction: 'ease',
998
+ transitionDelay: '0s'
999
+ };
1000
+ }
1001
+ var properties = [];
1002
+ var durations = [];
1003
+ var timingFunctions = [];
1004
+ var delays = [];
1005
+ var parsingFirst = true;
1006
+ while (tokenStream.hasTokens()) {
1007
+ if (!parsingFirst) {
1008
+ tokenStream.expect(COMMA);
1009
+ }
1010
+
1011
+ // Parse single transition: property duration timing-function delay
1012
+ // Order can vary, but typically: property duration [timing-function] [delay]
1013
+ var property = null;
1014
+ var duration = null;
1015
+ var timingFunction = null;
1016
+ var delay = null;
1017
+
1018
+ // Skip leading space
1019
+ if (tokenStream.matches(SPACE)) ;
1020
+
1021
+ // Parse tokens for this transition
1022
+ while (tokenStream.hasTokens()) {
1023
+ // Check for comma (next transition)
1024
+ tokenStream.saveRewindPoint();
1025
+ if (tokenStream.matches(SPACE)) {
1026
+ if (tokenStream.matches(COMMA)) {
1027
+ tokenStream.rewind();
1028
+ break;
1029
+ }
1030
+ }
1031
+ if (tokenStream.matches(COMMA)) {
1032
+ tokenStream.rewind();
1033
+ break;
1034
+ }
1035
+ tokenStream.rewind();
1036
+
1037
+ // Try to match different token types
1038
+ if (tokenStream.matches(SPACE)) {
1039
+ continue;
1040
+ }
1041
+
1042
+ // Check for timing function (cubic-bezier or steps)
1043
+ var funcStream = tokenStream.matchesFunction();
1044
+ if (funcStream) {
1045
+ // It's a function like cubic-bezier() or steps()
1046
+ var funcName = funcStream.functionName;
1047
+ var args = [];
1048
+ while (funcStream.hasTokens()) {
1049
+ if (funcStream.matches(SPACE) || funcStream.matches(COMMA)) {
1050
+ continue;
1051
+ }
1052
+ var val = funcStream.expect(IDENT, TIME, function (node) {
1053
+ if (node.type === 'word') return node.value;
1054
+ return null;
1055
+ });
1056
+ args.push(val);
1057
+ }
1058
+ timingFunction = funcName + "(" + args.join(', ') + ")";
1059
+ continue;
1060
+ }
1061
+
1062
+ // Match word or time
1063
+ if (tokenStream.matches(IDENT)) {
1064
+ var value = tokenStream.lastValue;
1065
+ if (isTimingFunction$1(value)) {
1066
+ timingFunction = value;
1067
+ } else {
1068
+ property = value;
1069
+ }
1070
+ continue;
1071
+ }
1072
+ if (tokenStream.matches(TIME)) {
1073
+ var _value2 = tokenStream.lastValue;
1074
+ if (duration === null) {
1075
+ duration = _value2;
1076
+ } else {
1077
+ delay = _value2;
1078
+ }
1079
+ continue;
1080
+ }
1081
+
1082
+ // Try to match as word for property names like 'all', 'opacity', etc.
1083
+ var wordMatch = tokenStream.expect(function (node) {
1084
+ if (node.type === 'word') return node.value;
1085
+ return null;
1086
+ });
1087
+ if (isTime$1(wordMatch)) {
1088
+ if (duration === null) {
1089
+ duration = wordMatch;
1090
+ } else {
1091
+ delay = wordMatch;
1092
+ }
1093
+ } else if (isTimingFunction$1(wordMatch)) {
1094
+ timingFunction = wordMatch;
1095
+ } else {
1096
+ property = wordMatch;
1097
+ }
1098
+ }
1099
+
1100
+ // Apply defaults and camelize property name
1101
+ var propName = property || 'all';
1102
+ properties.push(propName === 'all' ? 'all' : camelizeStyleName(propName));
1103
+ durations.push(duration || '0s');
1104
+ timingFunctions.push(timingFunction || 'ease');
1105
+ delays.push(delay || '0s');
1106
+ parsingFirst = false;
1107
+ }
1108
+
1109
+ // Return single values if only one transition, arrays if multiple
1110
+ var isSingle = properties.length === 1;
1111
+ return {
1112
+ transitionProperty: isSingle ? properties[0] : properties,
1113
+ transitionDuration: isSingle ? durations[0] : durations,
1114
+ transitionTimingFunction: isSingle ? timingFunctions[0] : timingFunctions,
1115
+ transitionDelay: isSingle ? delays[0] : delays
1116
+ };
1117
+ };
686
1118
  var background = function background(tokenStream) {
687
1119
  return {
688
1120
  backgroundColor: tokenStream.expect(COLOR, VARIABLE)
689
1121
  };
690
1122
  };
691
-
692
1123
  var borderColor = directionFactory({
693
1124
  types: [COLOR, VARIABLE],
694
1125
  prefix: 'border',
@@ -710,27 +1141,31 @@ var margin = directionFactory({
710
1141
  var padding = directionFactory({
711
1142
  prefix: 'padding'
712
1143
  });
713
-
714
1144
  var fontWeight = function fontWeight(tokenStream) {
715
1145
  return {
716
1146
  fontWeight: tokenStream.expect(WORD) // Also match numbers as strings
717
-
718
1147
  };
719
1148
  };
720
-
721
1149
  var shadowOffset = function shadowOffset(tokenStream) {
722
1150
  return {
723
1151
  shadowOffset: parseShadowOffset(tokenStream)
724
1152
  };
725
1153
  };
726
-
727
1154
  var textShadowOffset = function textShadowOffset(tokenStream) {
728
1155
  return {
729
1156
  textShadowOffset: parseShadowOffset(tokenStream)
730
1157
  };
731
1158
  };
732
-
733
1159
  var transforms = {
1160
+ animation: animation,
1161
+ animationName: animationName,
1162
+ animationDuration: animationDuration,
1163
+ animationTimingFunction: animationTimingFunction,
1164
+ animationDelay: animationDelay,
1165
+ animationIterationCount: animationIterationCount,
1166
+ animationDirection: animationDirection,
1167
+ animationFillMode: animationFillMode,
1168
+ animationPlayState: animationPlayState,
734
1169
  aspectRatio: aspectRatio,
735
1170
  background: background,
736
1171
  border: border,
@@ -752,20 +1187,20 @@ var transforms = {
752
1187
  textShadowOffset: textShadowOffset,
753
1188
  textDecoration: textDecoration,
754
1189
  textDecorationLine: textDecorationLine,
755
- transform: transform
1190
+ transform: transform,
1191
+ transition: transition,
1192
+ transitionProperty: transitionProperty,
1193
+ transitionDuration: transitionDuration,
1194
+ transitionTimingFunction: transitionTimingFunction,
1195
+ transitionDelay: transitionDelay
756
1196
  };
757
1197
  var propertiesWithoutUnits;
758
-
759
1198
  if (process.env.NODE_ENV !== 'production') {
760
1199
  propertiesWithoutUnits = ['aspectRatio', 'elevation', 'flexGrow', 'flexShrink', 'opacity', 'shadowOpacity', 'zIndex'];
761
1200
  }
762
-
763
1201
  var devPropertiesWithUnitsRegExp = propertiesWithoutUnits != null ? new RegExp(propertiesWithoutUnits.join('|')) : null;
764
1202
  var SYMBOL_MATCH = 'SYMBOL_MATCH';
765
-
766
- var TokenStream =
767
- /*#__PURE__*/
768
- function () {
1203
+ var TokenStream = /*#__PURE__*/function () {
769
1204
  function TokenStream(nodes, parent) {
770
1205
  this.index = 0;
771
1206
  this.nodes = nodes;
@@ -773,40 +1208,31 @@ function () {
773
1208
  this.lastValue = null;
774
1209
  this.rewindIndex = -1;
775
1210
  }
776
-
777
1211
  var _proto = TokenStream.prototype;
778
-
779
1212
  _proto.hasTokens = function hasTokens() {
780
1213
  return this.index <= this.nodes.length - 1;
781
1214
  };
782
-
783
1215
  _proto[SYMBOL_MATCH] = function () {
784
1216
  if (!this.hasTokens()) return null;
785
1217
  var node = this.nodes[this.index];
786
-
787
1218
  for (var i = 0; i < arguments.length; i += 1) {
788
1219
  var tokenDescriptor = i < 0 || arguments.length <= i ? undefined : arguments[i];
789
1220
  var value = tokenDescriptor(node);
790
-
791
1221
  if (value !== null) {
792
1222
  this.index += 1;
793
1223
  this.lastValue = value;
794
1224
  return value;
795
1225
  }
796
1226
  }
797
-
798
1227
  return null;
799
1228
  };
800
-
801
1229
  _proto.matches = function matches() {
802
1230
  return this[SYMBOL_MATCH].apply(this, arguments) !== null;
803
1231
  };
804
-
805
1232
  _proto.expect = function expect() {
806
1233
  var value = this[SYMBOL_MATCH].apply(this, arguments);
807
1234
  return value !== null ? value : this["throw"]();
808
1235
  };
809
-
810
1236
  _proto.matchesFunction = function matchesFunction() {
811
1237
  var node = this.nodes[this.index];
812
1238
  if (node.type !== 'function') return null;
@@ -815,58 +1241,48 @@ function () {
815
1241
  this.lastValue = null;
816
1242
  return value;
817
1243
  };
818
-
819
1244
  _proto.expectFunction = function expectFunction() {
820
1245
  var value = this.matchesFunction();
821
1246
  return value !== null ? value : this["throw"]();
822
1247
  };
823
-
824
1248
  _proto.expectEmpty = function expectEmpty() {
825
1249
  if (this.hasTokens()) this["throw"]();
826
1250
  };
827
-
828
1251
  _proto["throw"] = function _throw() {
829
1252
  throw new Error("Unexpected token type: " + this.nodes[this.index].type);
830
1253
  };
831
-
832
1254
  _proto.saveRewindPoint = function saveRewindPoint() {
833
1255
  this.rewindIndex = this.index;
834
1256
  };
835
-
836
1257
  _proto.rewind = function rewind() {
837
1258
  if (this.rewindIndex === -1) throw new Error('Internal error');
838
1259
  this.index = this.rewindIndex;
839
1260
  this.lastValue = null;
840
1261
  };
841
-
842
1262
  return TokenStream;
843
1263
  }();
844
1264
  /* eslint-disable no-param-reassign */
845
1265
  // Note if this is wrong, you'll need to change tokenTypes.js too
846
-
847
-
848
1266
  var numberOrLengthRe = /^([+-]?(?:\d*\.)?\d+(?:e[+-]?\d+)?)(?:px)?$/i;
849
1267
  var numberOnlyRe = /^[+-]?(?:\d*\.\d*|[1-9]\d*)(?:e[+-]?\d+)?$/i;
850
1268
  var boolRe = /^true|false$/i;
851
1269
  var nullRe = /^null$/i;
852
- var undefinedRe = /^undefined$/i; // Undocumented export
1270
+ var undefinedRe = /^undefined$/i;
853
1271
 
1272
+ // Undocumented export
854
1273
  var transformRawValue = function transformRawValue(propName, value) {
855
1274
  if (process.env.NODE_ENV !== 'production') {
856
1275
  var needsUnit = !devPropertiesWithUnitsRegExp.test(propName);
857
1276
  var isNumberWithoutUnit = numberOnlyRe.test(value);
858
-
859
1277
  if (needsUnit && isNumberWithoutUnit) {
860
1278
  // eslint-disable-next-line no-console
861
1279
  console.warn("Expected style \"" + propName + ": " + value + "\" to contain units");
862
1280
  }
863
-
864
1281
  if (!needsUnit && value !== '0' && !isNumberWithoutUnit) {
865
1282
  // eslint-disable-next-line no-console
866
1283
  console.warn("Expected style \"" + propName + ": " + value + "\" to be unitless");
867
1284
  }
868
1285
  }
869
-
870
1286
  var numberMatch = value.match(numberOrLengthRe);
871
1287
  if (numberMatch !== null) return Number(numberMatch[1]);
872
1288
  var boolMatch = value.match(boolRe);
@@ -877,13 +1293,11 @@ var transformRawValue = function transformRawValue(propName, value) {
877
1293
  if (undefinedMatch !== null) return undefined;
878
1294
  return value;
879
1295
  };
880
-
881
1296
  var baseTransformShorthandValue = function baseTransformShorthandValue(propName, value) {
882
1297
  var ast = parse__default(value);
883
1298
  var tokenStream = new TokenStream(ast.nodes);
884
1299
  return transforms[propName](tokenStream);
885
1300
  };
886
-
887
1301
  var transformShorthandValue = process.env.NODE_ENV === 'production' ? baseTransformShorthandValue : function (propName, value) {
888
1302
  try {
889
1303
  return baseTransformShorthandValue(propName, value);
@@ -891,39 +1305,154 @@ var transformShorthandValue = process.env.NODE_ENV === 'production' ? baseTransf
891
1305
  throw new Error("Failed to parse declaration \"" + propName + ": " + value + "\"");
892
1306
  }
893
1307
  };
894
-
895
1308
  var getStylesForProperty = function getStylesForProperty(propName, inputValue, allowShorthand) {
896
1309
  var _ref6;
897
-
898
1310
  var isRawValue = allowShorthand === false || !(propName in transforms);
899
1311
  var value = inputValue.trim();
900
1312
  var propValues = isRawValue ? (_ref6 = {}, _ref6[propName] = transformRawValue(propName, value), _ref6) : transformShorthandValue(propName, value);
901
1313
  return propValues;
902
1314
  };
903
-
904
1315
  var getPropertyName = function getPropertyName(propName) {
905
1316
  var isCustomProp = /^--\w+/.test(propName);
906
-
907
1317
  if (isCustomProp) {
908
1318
  return propName;
909
1319
  }
910
-
911
1320
  return camelizeStyleName(propName);
912
1321
  };
913
1322
 
914
- var index = function index(rules, shorthandBlacklist) {
915
- if (shorthandBlacklist === void 0) {
916
- shorthandBlacklist = [];
1323
+ /**
1324
+ * Strip CSS comments from a string
1325
+ * Handles both single-line and multi-line comments
1326
+ */
1327
+ var stripCssComments = function stripCssComments(css) {
1328
+ return css.replace(/\/\*[\s\S]*?\*\//g, '');
1329
+ };
1330
+
1331
+ /**
1332
+ * Parse CSS declarations into React Native styles (for keyframes)
1333
+ */
1334
+ var parseKeyframeDeclarations = function parseKeyframeDeclarations(declarationsStr) {
1335
+ var declarations = [];
1336
+ var parts = declarationsStr.split(';');
1337
+ for (var _iterator = _createForOfIteratorHelperLoose(parts), _step; !(_step = _iterator()).done;) {
1338
+ var part = _step.value;
1339
+ var trimmed = part.trim();
1340
+ if (!trimmed) continue;
1341
+ var colonIndex = trimmed.indexOf(':');
1342
+ if (colonIndex === -1) continue;
1343
+ var property = trimmed.substring(0, colonIndex).trim();
1344
+ var value = trimmed.substring(colonIndex + 1).trim();
1345
+ if (property && value) {
1346
+ declarations.push([property, value]);
1347
+ }
1348
+ }
1349
+ if (declarations.length === 0) {
1350
+ return {};
917
1351
  }
918
1352
 
919
- return rules.reduce(function (accum, rule) {
1353
+ // Transform each declaration
1354
+ return declarations.reduce(function (accum, rule) {
920
1355
  var propertyName = getPropertyName(rule[0]);
921
1356
  var value = rule[1];
922
- var allowShorthand = shorthandBlacklist.indexOf(propertyName) === -1;
923
- return Object.assign(accum, getStylesForProperty(propertyName, value, allowShorthand));
1357
+ return Object.assign(accum, getStylesForProperty(propertyName, value, true));
924
1358
  }, {});
925
1359
  };
926
1360
 
1361
+ /**
1362
+ * Parse keyframe body CSS into a keyframe object
1363
+ * @param {string} body - CSS keyframe body
1364
+ * @returns {Object} Keyframe object with selectors as keys
1365
+ */
1366
+ var parseKeyframeBody = function parseKeyframeBody(body) {
1367
+ // Strip CSS comments before parsing
1368
+ var cleanBody = stripCssComments(body);
1369
+ var keyframeObject = {};
1370
+ var selectorRegex = /([a-zA-Z0-9%,\s]+)\s*\{\s*([^}]*)\s*\}/g;
1371
+ var selectorMatch;
1372
+
1373
+ // eslint-disable-next-line no-cond-assign
1374
+ while ((selectorMatch = selectorRegex.exec(cleanBody)) !== null) {
1375
+ var selectors = selectorMatch[1].split(',').map(function (s) {
1376
+ return s.trim();
1377
+ }).filter(function (s) {
1378
+ return s;
1379
+ });
1380
+ var declarations = selectorMatch[2];
1381
+
1382
+ // Parse CSS declarations into style object
1383
+ var styles = parseKeyframeDeclarations(declarations);
1384
+ for (var _iterator2 = _createForOfIteratorHelperLoose(selectors), _step2; !(_step2 = _iterator2()).done;) {
1385
+ var selector = _step2.value;
1386
+ keyframeObject[selector] = styles;
1387
+ }
1388
+ }
1389
+ return keyframeObject;
1390
+ };
1391
+
1392
+ /**
1393
+ * Check if a property name is a @keyframes rule
1394
+ */
1395
+ var isKeyframesRule = function isKeyframesRule(propName) {
1396
+ return propName.startsWith('@keyframes ') || propName.startsWith('@keyframes\t');
1397
+ };
1398
+
1399
+ /**
1400
+ * Extract keyframe name from @keyframes rule
1401
+ */
1402
+ var getKeyframeName = function getKeyframeName(propName) {
1403
+ return propName.replace(/^@keyframes\s+/, '').trim();
1404
+ };
1405
+ var index = function index(rules, shorthandBlacklist) {
1406
+ if (shorthandBlacklist === void 0) {
1407
+ shorthandBlacklist = [];
1408
+ }
1409
+ // First pass: collect @keyframes definitions
1410
+ var keyframesMap = {};
1411
+ for (var _iterator3 = _createForOfIteratorHelperLoose(rules), _step3; !(_step3 = _iterator3()).done;) {
1412
+ var rule = _step3.value;
1413
+ var propName = rule[0];
1414
+ if (isKeyframesRule(propName)) {
1415
+ var keyframeName = getKeyframeName(propName);
1416
+ var keyframeBody = rule[1];
1417
+ keyframesMap[keyframeName] = parseKeyframeBody(keyframeBody);
1418
+ }
1419
+ }
1420
+
1421
+ // Second pass: transform all non-keyframes rules
1422
+ var result = {};
1423
+ for (var _iterator4 = _createForOfIteratorHelperLoose(rules), _step4; !(_step4 = _iterator4()).done;) {
1424
+ var _rule = _step4.value;
1425
+ var _propName = _rule[0];
1426
+
1427
+ // Skip @keyframes rules in the output
1428
+ if (isKeyframesRule(_propName)) {
1429
+ continue;
1430
+ }
1431
+ var propertyName = getPropertyName(_propName);
1432
+ var value = _rule[1];
1433
+ var allowShorthand = shorthandBlacklist.indexOf(propertyName) === -1;
1434
+ var propValues = getStylesForProperty(propertyName, value, allowShorthand);
1435
+ Object.assign(result, propValues);
1436
+ }
1437
+
1438
+ // Third pass: replace animationName strings with actual keyframe objects
1439
+ if (result.animationName) {
1440
+ if (Array.isArray(result.animationName)) {
1441
+ result.animationName = result.animationName.map(function (name) {
1442
+ if (typeof name === 'string' && name !== 'none' && keyframesMap[name]) {
1443
+ return keyframesMap[name];
1444
+ }
1445
+ return name;
1446
+ });
1447
+ } else if (typeof result.animationName === 'string') {
1448
+ // Handle single value case
1449
+ if (result.animationName !== 'none' && keyframesMap[result.animationName]) {
1450
+ result.animationName = keyframesMap[result.animationName];
1451
+ }
1452
+ }
1453
+ }
1454
+ return result;
1455
+ };
927
1456
  exports["default"] = index;
928
1457
  exports.getPropertyName = getPropertyName;
929
1458
  exports.getStylesForProperty = getStylesForProperty;