rnwind 0.0.10 → 0.0.12
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/lib/cjs/core/normalize-classname.cjs +3 -1
- package/lib/cjs/core/normalize-classname.cjs.map +1 -1
- package/lib/cjs/core/parser/border-dispatcher.cjs +20 -10
- package/lib/cjs/core/parser/border-dispatcher.cjs.map +1 -1
- package/lib/cjs/core/parser/color-properties-dispatcher.cjs +7 -5
- package/lib/cjs/core/parser/color-properties-dispatcher.cjs.map +1 -1
- package/lib/cjs/core/parser/color.cjs +194 -10
- package/lib/cjs/core/parser/color.cjs.map +1 -1
- package/lib/cjs/core/parser/color.d.ts +18 -3
- package/lib/cjs/core/parser/declaration.cjs +62 -4
- package/lib/cjs/core/parser/declaration.cjs.map +1 -1
- package/lib/cjs/core/parser/layout-dispatcher.cjs +32 -2
- package/lib/cjs/core/parser/layout-dispatcher.cjs.map +1 -1
- package/lib/cjs/core/parser/shorthand.cjs +10 -3
- package/lib/cjs/core/parser/shorthand.cjs.map +1 -1
- package/lib/cjs/core/parser/tokens.cjs +9 -0
- package/lib/cjs/core/parser/tokens.cjs.map +1 -1
- package/lib/cjs/core/parser/tw-parser.cjs +89 -2
- package/lib/cjs/core/parser/tw-parser.cjs.map +1 -1
- package/lib/cjs/core/parser/tw-parser.d.ts +2 -0
- package/lib/cjs/core/parser/typography-dispatcher.cjs +15 -8
- package/lib/cjs/core/parser/typography-dispatcher.cjs.map +1 -1
- package/lib/cjs/core/style-builder/union-builder.cjs +81 -2
- package/lib/cjs/core/style-builder/union-builder.cjs.map +1 -1
- package/lib/cjs/core/style-builder/union-builder.d.ts +28 -0
- package/lib/cjs/metro/state.cjs +74 -13
- package/lib/cjs/metro/state.cjs.map +1 -1
- package/lib/cjs/metro/state.d.ts +18 -0
- package/lib/cjs/metro/transformer.cjs +10 -4
- package/lib/cjs/metro/transformer.cjs.map +1 -1
- package/lib/cjs/metro/with-config.cjs +57 -0
- package/lib/cjs/metro/with-config.cjs.map +1 -1
- package/lib/cjs/metro/with-config.d.ts +12 -0
- package/lib/cjs/metro/wrap-imports.cjs +36 -1
- package/lib/cjs/metro/wrap-imports.cjs.map +1 -1
- package/lib/cjs/runtime/hooks/use-scheme.cjs +14 -7
- package/lib/cjs/runtime/hooks/use-scheme.cjs.map +1 -1
- package/lib/cjs/runtime/resolve.cjs +6 -2
- package/lib/cjs/runtime/resolve.cjs.map +1 -1
- package/lib/cjs/runtime/resolve.d.ts +5 -1
- package/lib/esm/core/normalize-classname.mjs +3 -1
- package/lib/esm/core/normalize-classname.mjs.map +1 -1
- package/lib/esm/core/parser/border-dispatcher.mjs +21 -11
- package/lib/esm/core/parser/border-dispatcher.mjs.map +1 -1
- package/lib/esm/core/parser/color-properties-dispatcher.mjs +8 -6
- package/lib/esm/core/parser/color-properties-dispatcher.mjs.map +1 -1
- package/lib/esm/core/parser/color.d.ts +18 -3
- package/lib/esm/core/parser/color.mjs +195 -12
- package/lib/esm/core/parser/color.mjs.map +1 -1
- package/lib/esm/core/parser/declaration.mjs +63 -5
- package/lib/esm/core/parser/declaration.mjs.map +1 -1
- package/lib/esm/core/parser/layout-dispatcher.mjs +32 -2
- package/lib/esm/core/parser/layout-dispatcher.mjs.map +1 -1
- package/lib/esm/core/parser/shorthand.mjs +11 -4
- package/lib/esm/core/parser/shorthand.mjs.map +1 -1
- package/lib/esm/core/parser/tokens.mjs +10 -1
- package/lib/esm/core/parser/tokens.mjs.map +1 -1
- package/lib/esm/core/parser/tw-parser.d.ts +2 -0
- package/lib/esm/core/parser/tw-parser.mjs +69 -0
- package/lib/esm/core/parser/tw-parser.mjs.map +1 -1
- package/lib/esm/core/parser/typography-dispatcher.mjs +15 -8
- package/lib/esm/core/parser/typography-dispatcher.mjs.map +1 -1
- package/lib/esm/core/style-builder/union-builder.d.ts +28 -0
- package/lib/esm/core/style-builder/union-builder.mjs +82 -3
- package/lib/esm/core/style-builder/union-builder.mjs.map +1 -1
- package/lib/esm/metro/state.d.ts +18 -0
- package/lib/esm/metro/state.mjs +75 -14
- package/lib/esm/metro/state.mjs.map +1 -1
- package/lib/esm/metro/transformer.mjs +10 -4
- package/lib/esm/metro/transformer.mjs.map +1 -1
- package/lib/esm/metro/with-config.d.ts +12 -0
- package/lib/esm/metro/with-config.mjs +58 -2
- package/lib/esm/metro/with-config.mjs.map +1 -1
- package/lib/esm/metro/wrap-imports.mjs +36 -1
- package/lib/esm/metro/wrap-imports.mjs.map +1 -1
- package/lib/esm/runtime/hooks/use-scheme.mjs +14 -7
- package/lib/esm/runtime/hooks/use-scheme.mjs.map +1 -1
- package/lib/esm/runtime/resolve.d.ts +5 -1
- package/lib/esm/runtime/resolve.mjs +6 -2
- package/lib/esm/runtime/resolve.mjs.map +1 -1
- package/package.json +1 -1
- package/src/core/normalize-classname.ts +4 -1
- package/src/core/parser/border-dispatcher.ts +22 -11
- package/src/core/parser/color-properties-dispatcher.ts +7 -5
- package/src/core/parser/color.ts +182 -11
- package/src/core/parser/declaration.ts +61 -5
- package/src/core/parser/layout-dispatcher.ts +34 -2
- package/src/core/parser/shorthand.ts +9 -3
- package/src/core/parser/tokens.ts +10 -1
- package/src/core/parser/tw-parser.ts +71 -1
- package/src/core/parser/typography-dispatcher.ts +15 -6
- package/src/core/style-builder/union-builder.ts +83 -3
- package/src/metro/state.ts +117 -12
- package/src/metro/transformer.ts +9 -4
- package/src/metro/with-config.ts +59 -1
- package/src/metro/wrap-imports.ts +36 -1
- package/src/runtime/hooks/use-scheme.ts +13 -6
- package/src/runtime/resolve.ts +6 -2
|
@@ -45,6 +45,10 @@ const RN_UNSUPPORTED_PROPERTIES = new Set([
|
|
|
45
45
|
'clear',
|
|
46
46
|
'table-layout',
|
|
47
47
|
'caption-side',
|
|
48
|
+
// Web table-model props with no RN equivalent. `border-spacing` otherwise
|
|
49
|
+
// reaches the generic fallback and leaks an unresolved `calc(0.25rem * N)`.
|
|
50
|
+
'border-spacing',
|
|
51
|
+
'border-collapse',
|
|
48
52
|
'transform-style',
|
|
49
53
|
'background-blend-mode',
|
|
50
54
|
'scroll-behavior',
|
|
@@ -61,6 +65,20 @@ const RN_UNSUPPORTED_PROPERTIES = new Set([
|
|
|
61
65
|
'field-sizing',
|
|
62
66
|
'forced-color-adjust',
|
|
63
67
|
'text-shadow',
|
|
68
|
+
// Web-only KEYS RN has no style prop for. `order` leaks through the negative
|
|
69
|
+
// variant (`-order-1` → `order: calc(1 * -1)` unparsed → resolves to `-1`);
|
|
70
|
+
// the positive `order-*` already drops since no typed branch claims it. Adding
|
|
71
|
+
// it here drops BOTH signs. `isolation` (`isolate` / `isolation-auto`) reaches
|
|
72
|
+
// the `custom` path as `isolation: isolate|auto` — also no RN equivalent.
|
|
73
|
+
'order',
|
|
74
|
+
'isolation',
|
|
75
|
+
// `normal-nums` reaches the `custom` path as `font-variant-numeric: normal`
|
|
76
|
+
// and leaked the non-RN key `fontVariantNumeric`. RN expresses numeric
|
|
77
|
+
// variants via the `fontVariant` array, not this property — drop it. (The
|
|
78
|
+
// `tabular-nums`/`oldstyle-nums`/… utilities carry their token in dropped
|
|
79
|
+
// `--tw-numeric-*` vars and already resolve to {}; mapping those to
|
|
80
|
+
// `fontVariant` is a tracked future enhancement, not a leak.)
|
|
81
|
+
'font-variant-numeric',
|
|
64
82
|
'touch-action',
|
|
65
83
|
'backdrop-filter',
|
|
66
84
|
'-webkit-backdrop-filter',
|
|
@@ -69,6 +87,23 @@ const RN_UNSUPPORTED_PROPERTIES = new Set([
|
|
|
69
87
|
'-webkit-font-smoothing',
|
|
70
88
|
'-moz-osx-font-smoothing',
|
|
71
89
|
]);
|
|
90
|
+
/**
|
|
91
|
+
* Valid value sets for RN enum style props (keyed by the camelCase RN key).
|
|
92
|
+
* A value outside its prop's set is RN-invalid even when the string itself
|
|
93
|
+
* looks clean — RN ignores or warns on it (`position: 'fixed'`, `display:
|
|
94
|
+
* 'contents'`, `justifyContent: 'stretch' | 'baseline'`, `alignContent:
|
|
95
|
+
* 'normal'`). This is the dimension the leak-shape (`var(`/`calc(`/NaN) check
|
|
96
|
+
* misses. Both the typed `display` / `position` branches AND the generic
|
|
97
|
+
* unparsed fallback consult this — Tailwind routes some keyword-only values
|
|
98
|
+
* (`justify-content: baseline`) through the unparsed channel, which would
|
|
99
|
+
* otherwise emit them via `kebabToCamel` with no enum awareness.
|
|
100
|
+
*/
|
|
101
|
+
const RN_ENUM_VALUES = {
|
|
102
|
+
position: new Set(['absolute', 'relative', 'static']),
|
|
103
|
+
display: new Set(['flex', 'none']),
|
|
104
|
+
justifyContent: new Set(['flex-start', 'flex-end', 'center', 'space-between', 'space-around', 'space-evenly']),
|
|
105
|
+
alignContent: new Set(['flex-start', 'flex-end', 'center', 'stretch', 'space-between', 'space-around', 'space-evenly']),
|
|
106
|
+
};
|
|
72
107
|
/** CSS single-sided logical-inline property → RN writing-direction Yoga key. */
|
|
73
108
|
const LOGICAL_INLINE_TO_RN = {
|
|
74
109
|
'margin-inline-start': 'marginStart',
|
|
@@ -241,6 +276,11 @@ function unparsedToEntries(property, tokens$1, themeVars) {
|
|
|
241
276
|
// multi-token shorthand, not a color: drop it.
|
|
242
277
|
if (hasTopLevelSpace(coerced))
|
|
243
278
|
return [];
|
|
279
|
+
// CSS-wide cascade keywords (`inherit`, `currentColor`, `initial`, `unset`,
|
|
280
|
+
// `revert`, `revert-layer`) have no RN equivalent — RN has no color
|
|
281
|
+
// cascade. Drop rather than leak an invalid color string to RN.
|
|
282
|
+
if (color.isCssWideColorKeyword(coerced))
|
|
283
|
+
return [];
|
|
244
284
|
// Lower modern color spaces (`oklch(…)`, `lab(…)`, `color(p3 …)`) that
|
|
245
285
|
// RN can't paint to sRGB; hex/rgb/hsl/named pass through unchanged.
|
|
246
286
|
const color$1 = color.normalizeColorString(coerced) ?? coerced;
|
|
@@ -251,7 +291,15 @@ function unparsedToEntries(property, tokens$1, themeVars) {
|
|
|
251
291
|
return sides.map((key) => [key, color$1]);
|
|
252
292
|
return [[caseConvert.kebabToCamel(property), color$1]];
|
|
253
293
|
}
|
|
254
|
-
|
|
294
|
+
const camelKey = caseConvert.kebabToCamel(property);
|
|
295
|
+
// Enum props whose value Tailwind sometimes routes through the unparsed
|
|
296
|
+
// channel (`justify-content: baseline` → `justifyContent: 'baseline'`),
|
|
297
|
+
// bypassing the typed dispatcher's keyword map. RN rejects values outside
|
|
298
|
+
// the prop's set, so gate them here exactly like the typed branches do.
|
|
299
|
+
const enumValues = RN_ENUM_VALUES[camelKey];
|
|
300
|
+
if (enumValues && typeof coerced === 'string' && !enumValues.has(coerced))
|
|
301
|
+
return [];
|
|
302
|
+
return [[camelKey, coerced]];
|
|
255
303
|
}
|
|
256
304
|
/**
|
|
257
305
|
* Convert one lightningcss `Declaration` into zero-or-more RN style
|
|
@@ -292,7 +340,13 @@ function declarationToRnEntries(decl, themeVars) {
|
|
|
292
340
|
// literal keyword means UA default. Skip the keyword.
|
|
293
341
|
if (typeof decl.value === 'string')
|
|
294
342
|
return [];
|
|
295
|
-
|
|
343
|
+
const colorString = color.cssColorToString(decl.value);
|
|
344
|
+
// `currentColor` (lightningcss `{type:'currentcolor'}`) and any other
|
|
345
|
+
// CSS-wide cascade keyword have no RN equivalent — drop instead of
|
|
346
|
+
// leaking the keyword string to RN.
|
|
347
|
+
if (color.isCssWideColorKeyword(colorString))
|
|
348
|
+
return [];
|
|
349
|
+
return [[caseConvert.kebabToCamel(decl.property), colorString]];
|
|
296
350
|
}
|
|
297
351
|
case 'border-color': {
|
|
298
352
|
return shorthand.expandBorderColor(decl.value);
|
|
@@ -374,10 +428,14 @@ function declarationToRnEntries(decl, themeVars) {
|
|
|
374
428
|
return [['fontStyle', decl.value.type]];
|
|
375
429
|
}
|
|
376
430
|
case 'display': {
|
|
377
|
-
|
|
431
|
+
// `displayToEntries` can still emit `contents` (a CSS value RN rejects —
|
|
432
|
+
// only `flex` / `none` are valid). Gate the result on the RN-valid set.
|
|
433
|
+
return typography.displayToEntries(decl.value).filter(([, value]) => typeof value === 'string' && RN_ENUM_VALUES.display.has(value));
|
|
378
434
|
}
|
|
379
435
|
case 'position': {
|
|
380
|
-
|
|
436
|
+
// RN `position` accepts only `absolute` / `relative` / `static`; CSS
|
|
437
|
+
// `fixed` / `sticky` are invalid for RN, so drop them.
|
|
438
|
+
return RN_ENUM_VALUES.position.has(decl.value.type) ? [['position', decl.value.type]] : [];
|
|
381
439
|
}
|
|
382
440
|
case 'font-size': {
|
|
383
441
|
const px = typography.fontSizeToPx(decl.value);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"declaration.cjs","sources":["../../../../../src/core/parser/declaration.ts"],"sourcesContent":["/* eslint-disable sonarjs/cognitive-complexity -- the main Declaration → RN-entries dispatcher is intentionally a flat switch so each branch keeps its narrowed value type */\nimport type { Declaration as LcDeclaration, TokenOrValue } from 'lightningcss'\nimport { kebabToCamel } from './case-convert'\nimport { cssColorToString, normalizeColorString } from './color'\nimport { dimensionPercentageToNumber, gapValueToValue, lengthPercentageOrAutoToValue, sizeLikeToValue } from './length'\nimport {\n expandBorderColor,\n expandBorderRadius,\n expandFourSided,\n expandGap,\n expandLogicalBlock,\n expandLogicalInline,\n flexToEntries,\n} from './shorthand'\nimport { coerceFontFamily, coerceUnparsedValue, serializeTokens, substituteThemeVars } from './tokens'\nimport { displayToEntries, fontSizeToPx, fontWeightToValue, zIndexToNumber } from './typography'\nimport { dispatchMotionDeclaration } from './motion-dispatcher'\nimport { dispatchTypographyDeclaration } from './typography-dispatcher'\nimport { dispatchLayoutDeclaration } from './layout-dispatcher'\nimport { dispatchColorPropertyDeclaration } from './color-properties-dispatcher'\nimport { dispatchBorderDeclaration } from './border-dispatcher'\nimport { detectSafeAreaMarker } from './safe-area'\nimport type { RNEntry } from './types'\n\n/** CSS timing-function properties that need `cubic-bezier(...)` snapping. */\nconst TIMING_FUNCTION_PROPS = new Set(['transition-timing-function', 'animation-timing-function'])\n\n/** CSS easing keywords Reanimated v4's CSS engine accepts as strings. */\nconst CSS_EASING_KEYWORDS = new Set(['linear', 'ease', 'ease-in', 'ease-out', 'ease-in-out', 'step-start', 'step-end'])\n\n/** CSS properties with no useful RN equivalent — silently dropped. */\nconst UNSUPPORTED_LOGICAL_PROPS = new Set([\n 'border-inline-style',\n 'border-block-style',\n 'border-inline-start-style',\n 'border-inline-end-style',\n 'border-block-start-style',\n 'border-block-end-style',\n])\n\n/**\n * Web-only CSS properties Tailwind v4 emits that have NO React Native style\n * equivalent. Without this denylist they reach the generic `kebabToCamel`\n * fallback and emit dead keys (`objectPosition`, `textWrap`, `willChange`,\n * `float`, `columns`, `-webkit-line-clamp` → `WebkitLineClamp`, …) that bloat\n * every StyleSheet and read as \"supported\" when they do nothing. Dropping the\n * property name (kebab-case, pre-camel) is safe: it only excludes known\n * web-only props — anything RN supports is handled by a typed branch above.\n * (line-clamp's real RN behaviour comes from `numberOfLines` in text-truncate.)\n */\nconst RN_UNSUPPORTED_PROPERTIES: ReadonlySet<string> = new Set([\n 'object-position',\n 'text-wrap',\n 'will-change',\n 'columns',\n 'float',\n 'clear',\n 'table-layout',\n 'caption-side',\n 'transform-style',\n 'background-blend-mode',\n 'scroll-behavior',\n 'overscroll-behavior',\n 'overscroll-behavior-x',\n 'overscroll-behavior-y',\n 'scroll-snap-type',\n 'scroll-snap-align',\n 'scroll-snap-stop',\n 'break-after',\n 'break-before',\n 'break-inside',\n 'content',\n 'field-sizing',\n 'forced-color-adjust',\n 'text-shadow',\n 'touch-action',\n 'backdrop-filter',\n '-webkit-backdrop-filter',\n '-webkit-line-clamp',\n '-webkit-box-orient',\n '-webkit-font-smoothing',\n '-moz-osx-font-smoothing',\n])\n\n/** CSS single-sided logical-inline property → RN writing-direction Yoga key. */\nconst LOGICAL_INLINE_TO_RN: Record<string, string> = {\n 'margin-inline-start': 'marginStart',\n 'margin-inline-end': 'marginEnd',\n 'padding-inline-start': 'paddingStart',\n 'padding-inline-end': 'paddingEnd',\n}\n\n/**\n * Logical border-COLOR property → physical RN side key(s). Custom `@theme`\n * tokens reach the unparsed path as `border-inline-color: var(--color-x)`,\n * which a plain `kebabToCamel` would turn into `borderInlineColor` — a key RN\n * silently drops, so the border color never paints. Lower to the physical\n * keys RN actually honors, matching the typed `dispatchBorderDeclaration`.\n */\nconst LOGICAL_BORDER_COLOR_SIDES: Record<string, readonly string[]> = {\n 'border-inline-color': ['borderLeftColor', 'borderRightColor'],\n 'border-block-color': ['borderTopColor', 'borderBottomColor'],\n 'border-inline-start-color': ['borderLeftColor'],\n 'border-inline-end-color': ['borderRightColor'],\n 'border-block-start-color': ['borderTopColor'],\n 'border-block-end-color': ['borderBottomColor'],\n}\n\n/**\n * Pick the closest predefined CSS easing keyword for a `cubic-bezier`\n * control-point set. Mirrors {@link snapCubicBezierToKeyword} in\n * `animation.ts` — kept here so the unparsed-string path doesn't need\n * to import a typed-only helper.\n * @param x1 First control-point x (0–1).\n * @param y1 First control-point y (0–1).\n * @param x2 Second control-point x (0–1).\n * @param y2 Second control-point y (0–1).\n * @returns CSS easing keyword.\n */\nfunction snapBezier(x1: number, y1: number, x2: number, y2: number): string {\n const tol = 0.01\n const eq = (a: number, b: number): boolean => Math.abs(a - b) < tol\n if (eq(x1, 0) && eq(y1, 0) && eq(x2, 1) && eq(y2, 1)) return 'linear'\n if (eq(x1, 0.25) && eq(y1, 0.1) && eq(x2, 0.25) && eq(y2, 1)) return 'ease'\n if (eq(x1, 0.4) && eq(y1, 0) && eq(x2, 1) && eq(y2, 1)) return 'ease-in'\n if (eq(x1, 0) && eq(y1, 0) && eq(x2, 0.2) && eq(y2, 1)) return 'ease-out'\n if (eq(x1, 0.4) && eq(y1, 0) && eq(x2, 0.2) && eq(y2, 1)) return 'ease-in-out'\n const startsFlat = x1 < 0.1\n const endsFlat = x2 > 0.9\n if (startsFlat && !endsFlat) return 'ease-out'\n if (!startsFlat && endsFlat) return 'ease-in'\n return 'ease-in-out'\n}\n\n/**\n * Snap a cubic-bezier expression string to the closest CSS keyword\n * Reanimated v4's CSS engine accepts. Strings that already are keywords\n * pass through unchanged.\n * @param value Resolved value text from an unparsed timing-function declaration.\n * @returns CSS easing keyword.\n */\nfunction coerceCubicBezierString(value: string): string {\n const text = value.trim()\n if (CSS_EASING_KEYWORDS.has(text)) return text\n const match = /^cubic-bezier\\(\\s*([\\d.-]+)\\s*,\\s*([\\d.-]+)\\s*,\\s*([\\d.-]+)\\s*,\\s*([\\d.-]+)\\s*\\)$/.exec(text)\n if (!match) return 'ease-in-out'\n const [, x1, y1, x2, y2] = match\n return snapBezier(Number(x1), Number(y1), Number(x2), Number(y2))\n}\n\n/**\n * Whether `text` has a whitespace char OUTSIDE any parenthesised group —\n * the signature of a multi-token CSS value (`2px solid #000`) rather than a\n * single color (`#000`, `rgb(1 2 3)`, `red`).\n * @param text Resolved value text.\n * @returns True when a top-level space is present.\n */\nfunction hasTopLevelSpace(text: string): boolean {\n let depth = 0\n for (const ch of text.trim()) {\n if (ch === '(') depth += 1\n else if (ch === ')') depth = Math.max(0, depth - 1)\n else if (depth === 0 && (ch === ' ' || ch === '\\t' || ch === '\\n')) return true\n }\n return false\n}\n\n/**\n * Fast-path check for the handful of color property names Tailwind emits.\n * @param property Kebab-case CSS property name.\n * @returns Whether the property's value should be treated as a color.\n */\nfunction isColorProperty(property: string): boolean {\n return (\n property === 'color' ||\n property === 'background-color' ||\n // SVG paint props (`fill-<token>` / `stroke-<token>` via react-native-svg) —\n // they don't end in `-color`, so without this they'd skip normalization and\n // leak a raw `oklch(…)` string for custom `@theme` tokens.\n property === 'fill' ||\n property === 'stroke' ||\n (property.startsWith('border-') && property.endsWith('-color')) ||\n property.endsWith('-color')\n )\n}\n\n/**\n * Convert an unparsed declaration (typical Tailwind v4 output containing\n * `var()` / `calc()`) into RN entries. Serializes the token list, then\n * coerces the flat string into a number / keyword / length via a tight\n * set of shapes Tailwind actually emits.\n * @param property Real property name (kebab-case).\n * @param tokens Token list from lightningcss.\n * @param themeVars Optional lookup table for resolving `var(--x)` references.\n * @returns RN entries — usually one, empty when unusable.\n */\nfunction unparsedToEntries(\n property: string,\n tokens: readonly TokenOrValue[],\n themeVars: ReadonlyMap<string, string> | undefined,\n): readonly RNEntry[] {\n if (property.length === 0) return []\n if (RN_UNSUPPORTED_PROPERTIES.has(property)) return []\n // Safe-area detection runs BEFORE token serialization because\n // `env()` serializes to an empty string, which would strip the side\n // info we need. If the tokens encode a recognised `env(safe-area-inset-*)`\n // pattern (pure / `max(..., n)` / `calc(...+n)` / `h-screen-safe`),\n // emit a runtime-resolved marker instead.\n if (UNSUPPORTED_LOGICAL_PROPS.has(property)) return []\n const safe = detectSafeAreaMarker(tokens, themeVars)\n if (safe !== null) return [[kebabToCamel(property), safe]]\n let text = serializeTokens(tokens)\n if (themeVars && themeVars.size > 0) text = substituteThemeVars(text, themeVars)\n const coerced = coerceUnparsedValue(text)\n if (coerced === null) return []\n // Skip values still carrying an unresolved `var(--tw-*)` ANYWHERE in the\n // string — they came from a `@property --tw-*` composable with no real\n // fallback (e.g. `filter: blur(8px) var(--tw-brightness) …`,\n // `transform: rotateX(45deg) var(--tw-rotate-y) …`, `touch-action`,\n // `scroll-snap-type`). RN can't evaluate the cascade, so a leaked `var()`\n // makes the whole declaration an invalid string RN rejects — drop it and\n // rely on RN's default rather than emit garbage. `var(--color-*)` refs are\n // already substituted above, so anything left is a genuine composable miss.\n if (typeof coerced === 'string' && coerced.includes('var(')) return []\n // RN `fontFamily` is a single typeface, not a CSS fallback list — take\n // the first family so `--font-x: \"Name\", sans-serif` works out of the box.\n if (property === 'font-family' && typeof coerced === 'string') {\n return [['fontFamily', coerceFontFamily(coerced)]]\n }\n // Logical-direction CSS properties RN doesn't have direct equivalents\n // for. Keep the dropped names in one place so it's easy to audit.\n if (UNSUPPORTED_LOGICAL_PROPS.has(property)) return []\n if (TIMING_FUNCTION_PROPS.has(property) && typeof coerced === 'string') {\n // `transition-colors` and similar emit `var(--tw-ease, cubic-bezier(...))`\n // which serializes to a cubic-bezier STRING after substitution.\n // Reanimated v4's CSS engine rejects those — snap to the closest\n // predefined keyword (same logic as the typed `EasingFunction` path).\n return [[kebabToCamel(property), coerceCubicBezierString(coerced)]]\n }\n if (isColorProperty(property) && typeof coerced === 'string') {\n // A color is a single token. Tailwind compiles an arbitrary shorthand like\n // `border-[2px_solid_#000]` to `border-color: 2px solid #000` (invalid for\n // a color property → unparsed), which would otherwise emit\n // `borderColor: \"2px solid #000000\"` — a string RN rejects. A top-level\n // space (outside parens — `rgb(1 2 3)` keeps its inner spaces) means it's a\n // multi-token shorthand, not a color: drop it.\n if (hasTopLevelSpace(coerced)) return []\n // Lower modern color spaces (`oklch(…)`, `lab(…)`, `color(p3 …)`) that\n // RN can't paint to sRGB; hex/rgb/hsl/named pass through unchanged.\n const color = normalizeColorString(coerced) ?? coerced\n // Logical border-color utilities must lower to physical RN side keys —\n // RN ignores `borderInlineColor` / `borderInlineStartColor`.\n const sides = LOGICAL_BORDER_COLOR_SIDES[property]\n if (sides) return sides.map((key): RNEntry => [key, color])\n return [[kebabToCamel(property), color]]\n }\n return [[kebabToCamel(property), coerced]]\n}\n\n/**\n * Convert one lightningcss `Declaration` into zero-or-more RN style\n * entries. Shorthand declarations (padding/margin/border-radius/flex) can\n * emit multiple entries; skipped or unsupported properties emit none.\n *\n * The switch branches on `decl.property` so TypeScript narrows\n * `decl.value` to the exact typed shape for each branch — no casts\n * required. Unknown properties fall through to `[]`.\n * @param decl One declaration from a lightningcss style rule.\n * @param themeVars Optional lookup table for resolving `var(--x)` references inside unparsed values.\n * @returns Array of `[key, value]` entries.\n */\nexport function declarationToRnEntries(decl: LcDeclaration, themeVars?: ReadonlyMap<string, string>): readonly RNEntry[] {\n switch (decl.property) {\n case 'custom': {\n // Lightningcss routes two shapes through `custom`:\n // - Actual CSS custom properties (`--my-var`): no RN meaning, drop.\n // - Real properties it doesn't have a dedicated typed entry for\n // (e.g. `object-fit`, `pointer-events`, future CSS keyword-only\n // props): treat like an unparsed declaration so the keyword\n // surfaces in the RN style.\n const customName = decl.value.name\n if (customName.startsWith('--')) return []\n return unparsedToEntries(customName, decl.value.value ?? [], themeVars)\n }\n case 'unparsed': {\n return unparsedToEntries(decl.value.propertyId.property, decl.value.value, themeVars)\n }\n case 'color':\n case 'background-color':\n case 'border-top-color':\n case 'border-right-color':\n case 'border-bottom-color':\n case 'border-left-color': {\n // `background-color` narrows to `CssColor | 'background'` — the\n // literal keyword means UA default. Skip the keyword.\n if (typeof decl.value === 'string') return []\n return [[kebabToCamel(decl.property), cssColorToString(decl.value)]]\n }\n case 'border-color': {\n return expandBorderColor(decl.value)\n }\n case 'opacity': {\n // Lightningcss hands us an `f32` for opacity, so values like `0.8`\n // round-trip as `0.800000011920929`. Snap to 4 decimals to match the\n // rest of the parser's numeric convention.\n return [[decl.property, Math.round(decl.value * 10_000) / 10_000]]\n }\n case 'z-index': {\n return [['zIndex', zIndexToNumber(decl.value)]]\n }\n case 'top':\n case 'right':\n case 'bottom':\n case 'left': {\n const v = lengthPercentageOrAutoToValue(decl.value)\n if (v === null) return []\n return [[decl.property, v]]\n }\n case 'inset': {\n const top = lengthPercentageOrAutoToValue(decl.value.top)\n const right = lengthPercentageOrAutoToValue(decl.value.right)\n const bottom = lengthPercentageOrAutoToValue(decl.value.bottom)\n const left = lengthPercentageOrAutoToValue(decl.value.left)\n if (top === null || right === null || bottom === null || left === null) return []\n return [\n ['top', top],\n ['right', right],\n ['bottom', bottom],\n ['left', left],\n ]\n }\n case 'inset-inline': {\n const start = lengthPercentageOrAutoToValue(decl.value.inlineStart)\n const end = lengthPercentageOrAutoToValue(decl.value.inlineEnd)\n if (start === null || end === null) return []\n return [\n ['left', start],\n ['right', end],\n ]\n }\n case 'inset-block': {\n const start = lengthPercentageOrAutoToValue(decl.value.blockStart)\n const end = lengthPercentageOrAutoToValue(decl.value.blockEnd)\n if (start === null || end === null) return []\n return [\n ['top', start],\n ['bottom', end],\n ]\n }\n case 'width':\n case 'height':\n case 'min-width':\n case 'min-height':\n case 'max-width':\n case 'max-height': {\n const v = sizeLikeToValue(decl.value)\n if (v === null) return []\n return [[kebabToCamel(decl.property), v]]\n }\n case 'gap': {\n return expandGap(decl.value)\n }\n case 'row-gap':\n case 'column-gap': {\n const v = gapValueToValue(decl.value)\n if (v === null) return []\n return [[kebabToCamel(decl.property), v]]\n }\n case 'font-style': {\n return [['fontStyle', decl.value.type]]\n }\n case 'display': {\n return displayToEntries(decl.value)\n }\n case 'position': {\n return [['position', decl.value.type]]\n }\n case 'font-size': {\n const px = fontSizeToPx(decl.value)\n if (px === null) return []\n return [['fontSize', px]]\n }\n case 'font-weight': {\n return [['fontWeight', fontWeightToValue(decl.value)]]\n }\n case 'padding': {\n return expandFourSided('padding', decl.value)\n }\n case 'margin': {\n return expandFourSided('margin', decl.value)\n }\n case 'padding-inline': {\n return expandLogicalInline('padding', decl.value)\n }\n case 'padding-block': {\n return expandLogicalBlock('padding', decl.value)\n }\n case 'margin-inline': {\n return expandLogicalInline('margin', decl.value)\n }\n case 'margin-block': {\n return expandLogicalBlock('margin', decl.value)\n }\n case 'padding-top':\n case 'padding-right':\n case 'padding-bottom':\n case 'padding-left':\n case 'margin-top':\n case 'margin-right':\n case 'margin-bottom':\n case 'margin-left': {\n const v = lengthPercentageOrAutoToValue(decl.value)\n if (v === null) return []\n return [[kebabToCamel(decl.property), v]]\n }\n case 'border-radius': {\n return expandBorderRadius(decl.value)\n }\n case 'border-top-left-radius':\n case 'border-top-right-radius':\n case 'border-bottom-left-radius':\n case 'border-bottom-right-radius': {\n const [xAxis] = decl.value\n const v = dimensionPercentageToNumber(xAxis)\n if (v === null) return []\n return [[kebabToCamel(decl.property), v]]\n }\n case 'flex': {\n return flexToEntries(decl.value)\n }\n case 'flex-grow':\n case 'flex-shrink': {\n return [[kebabToCamel(decl.property), decl.value]]\n }\n case 'flex-basis': {\n const v = lengthPercentageOrAutoToValue(decl.value)\n if (v === null) return []\n return [['flexBasis', v]]\n }\n default: {\n return (\n dispatchLogicalInline(decl) ??\n dispatchLayoutDeclaration(decl) ??\n dispatchTypographyDeclaration(decl) ??\n dispatchColorPropertyDeclaration(decl) ??\n dispatchBorderDeclaration(decl) ??\n dispatchMotionDeclaration(decl) ??\n []\n )\n }\n }\n}\n\n/**\n * Map single-sided CSS logical-inline props to RN's writing-direction-aware\n * Yoga keys: `ms-2` → `marginStart`, `pe-4` → `paddingEnd`, `start-2` →\n * `start`, `end-3` → `end`. RN resolves start/end against the layout\n * direction, so these stay RTL-correct. Returns null for any other property\n * (so the dispatch chain continues).\n * @param decl One declaration from a lightningcss style rule.\n * @returns RN entries, or null when not a logical-inline property.\n */\nfunction dispatchLogicalInline(decl: LcDeclaration): readonly RNEntry[] | null {\n switch (decl.property) {\n case 'margin-inline-start':\n case 'margin-inline-end':\n case 'padding-inline-start':\n case 'padding-inline-end': {\n const v = lengthPercentageOrAutoToValue(decl.value)\n return v === null ? [] : [[LOGICAL_INLINE_TO_RN[decl.property], v]]\n }\n case 'inset-inline-start': {\n const v = lengthPercentageOrAutoToValue(decl.value)\n return v === null ? [] : [['start', v]]\n }\n case 'inset-inline-end': {\n const v = lengthPercentageOrAutoToValue(decl.value)\n return v === null ? [] : [['end', v]]\n }\n // Logical border-radius corners (`rounded-s/e/ss/se/ee/es-*`). RN has\n // matching keys — `kebabToCamel('border-start-start-radius')` is exactly\n // `borderStartStartRadius`. Value is a `[x, y]` tuple like physical corners.\n case 'border-start-start-radius':\n case 'border-start-end-radius':\n case 'border-end-start-radius':\n case 'border-end-end-radius': {\n const [xAxis] = decl.value\n const v = dimensionPercentageToNumber(xAxis)\n return v === null ? [] : [[kebabToCamel(decl.property), v]]\n }\n default: {\n return null\n }\n }\n}\n"],"names":["tokens","detectSafeAreaMarker","kebabToCamel","serializeTokens","substituteThemeVars","coerceUnparsedValue","coerceFontFamily","color","normalizeColorString","cssColorToString","expandBorderColor","zIndexToNumber","lengthPercentageOrAutoToValue","sizeLikeToValue","expandGap","gapValueToValue","displayToEntries","fontSizeToPx","fontWeightToValue","expandFourSided","expandLogicalInline","expandLogicalBlock","expandBorderRadius","dimensionPercentageToNumber","flexToEntries","dispatchLayoutDeclaration","dispatchTypographyDeclaration","dispatchColorPropertyDeclaration","dispatchBorderDeclaration","dispatchMotionDeclaration"],"mappings":";;;;;;;;;;;;;;;AAwBA;AACA,MAAM,qBAAqB,GAAG,IAAI,GAAG,CAAC,CAAC,4BAA4B,EAAE,2BAA2B,CAAC,CAAC;AAElG;AACA,MAAM,mBAAmB,GAAG,IAAI,GAAG,CAAC,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,aAAa,EAAE,YAAY,EAAE,UAAU,CAAC,CAAC;AAEvH;AACA,MAAM,yBAAyB,GAAG,IAAI,GAAG,CAAC;IACxC,qBAAqB;IACrB,oBAAoB;IACpB,2BAA2B;IAC3B,yBAAyB;IACzB,0BAA0B;IAC1B,wBAAwB;AACzB,CAAA,CAAC;AAEF;;;;;;;;;AASG;AACH,MAAM,yBAAyB,GAAwB,IAAI,GAAG,CAAC;IAC7D,iBAAiB;IACjB,WAAW;IACX,aAAa;IACb,SAAS;IACT,OAAO;IACP,OAAO;IACP,cAAc;IACd,cAAc;IACd,iBAAiB;IACjB,uBAAuB;IACvB,iBAAiB;IACjB,qBAAqB;IACrB,uBAAuB;IACvB,uBAAuB;IACvB,kBAAkB;IAClB,mBAAmB;IACnB,kBAAkB;IAClB,aAAa;IACb,cAAc;IACd,cAAc;IACd,SAAS;IACT,cAAc;IACd,qBAAqB;IACrB,aAAa;IACb,cAAc;IACd,iBAAiB;IACjB,yBAAyB;IACzB,oBAAoB;IACpB,oBAAoB;IACpB,wBAAwB;IACxB,yBAAyB;AAC1B,CAAA,CAAC;AAEF;AACA,MAAM,oBAAoB,GAA2B;AACnD,IAAA,qBAAqB,EAAE,aAAa;AACpC,IAAA,mBAAmB,EAAE,WAAW;AAChC,IAAA,sBAAsB,EAAE,cAAc;AACtC,IAAA,oBAAoB,EAAE,YAAY;CACnC;AAED;;;;;;AAMG;AACH,MAAM,0BAA0B,GA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A,QAAA,KAAK,2BAA2B;AAChC,QAAA,KAAK,yBAAyB;AAC9B,QAAA,KAAK,yBAAyB;QAC9B,KAAK,uBAAuB,EAAE;AAC5B,YAAA,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,KAAK;AAC1B,YAAA,MAAM,CAAC,GAAGW,kCAA2B,CAAC,KAAK,CAAC;YAC5C,OAAO,CAAC,KAAK,IAAI,GAAG,EAAE,GAAG,CAAC,CAACrB,wBAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC;QAC7D;QACA,SAAS;AACP,YAAA,OAAO,IAAI;QACb;;AAEJ;;;;"}
|
|
1
|
+
{"version":3,"file":"declaration.cjs","sources":["../../../../../src/core/parser/declaration.ts"],"sourcesContent":["/* eslint-disable sonarjs/cognitive-complexity -- the main Declaration → RN-entries dispatcher is intentionally a flat switch so each branch keeps its narrowed value type */\nimport type { Declaration as LcDeclaration, TokenOrValue } from 'lightningcss'\nimport { kebabToCamel } from './case-convert'\nimport { cssColorToString, isCssWideColorKeyword, normalizeColorString } from './color'\nimport { dimensionPercentageToNumber, gapValueToValue, lengthPercentageOrAutoToValue, sizeLikeToValue } from './length'\nimport {\n expandBorderColor,\n expandBorderRadius,\n expandFourSided,\n expandGap,\n expandLogicalBlock,\n expandLogicalInline,\n flexToEntries,\n} from './shorthand'\nimport { coerceFontFamily, coerceUnparsedValue, serializeTokens, substituteThemeVars } from './tokens'\nimport { displayToEntries, fontSizeToPx, fontWeightToValue, zIndexToNumber } from './typography'\nimport { dispatchMotionDeclaration } from './motion-dispatcher'\nimport { dispatchTypographyDeclaration } from './typography-dispatcher'\nimport { dispatchLayoutDeclaration } from './layout-dispatcher'\nimport { dispatchColorPropertyDeclaration } from './color-properties-dispatcher'\nimport { dispatchBorderDeclaration } from './border-dispatcher'\nimport { detectSafeAreaMarker } from './safe-area'\nimport type { RNEntry } from './types'\n\n/** CSS timing-function properties that need `cubic-bezier(...)` snapping. */\nconst TIMING_FUNCTION_PROPS = new Set(['transition-timing-function', 'animation-timing-function'])\n\n/** CSS easing keywords Reanimated v4's CSS engine accepts as strings. */\nconst CSS_EASING_KEYWORDS = new Set(['linear', 'ease', 'ease-in', 'ease-out', 'ease-in-out', 'step-start', 'step-end'])\n\n/** CSS properties with no useful RN equivalent — silently dropped. */\nconst UNSUPPORTED_LOGICAL_PROPS = new Set([\n 'border-inline-style',\n 'border-block-style',\n 'border-inline-start-style',\n 'border-inline-end-style',\n 'border-block-start-style',\n 'border-block-end-style',\n])\n\n/**\n * Web-only CSS properties Tailwind v4 emits that have NO React Native style\n * equivalent. Without this denylist they reach the generic `kebabToCamel`\n * fallback and emit dead keys (`objectPosition`, `textWrap`, `willChange`,\n * `float`, `columns`, `-webkit-line-clamp` → `WebkitLineClamp`, …) that bloat\n * every StyleSheet and read as \"supported\" when they do nothing. Dropping the\n * property name (kebab-case, pre-camel) is safe: it only excludes known\n * web-only props — anything RN supports is handled by a typed branch above.\n * (line-clamp's real RN behaviour comes from `numberOfLines` in text-truncate.)\n */\nconst RN_UNSUPPORTED_PROPERTIES: ReadonlySet<string> = new Set([\n 'object-position',\n 'text-wrap',\n 'will-change',\n 'columns',\n 'float',\n 'clear',\n 'table-layout',\n 'caption-side',\n // Web table-model props with no RN equivalent. `border-spacing` otherwise\n // reaches the generic fallback and leaks an unresolved `calc(0.25rem * N)`.\n 'border-spacing',\n 'border-collapse',\n 'transform-style',\n 'background-blend-mode',\n 'scroll-behavior',\n 'overscroll-behavior',\n 'overscroll-behavior-x',\n 'overscroll-behavior-y',\n 'scroll-snap-type',\n 'scroll-snap-align',\n 'scroll-snap-stop',\n 'break-after',\n 'break-before',\n 'break-inside',\n 'content',\n 'field-sizing',\n 'forced-color-adjust',\n 'text-shadow',\n // Web-only KEYS RN has no style prop for. `order` leaks through the negative\n // variant (`-order-1` → `order: calc(1 * -1)` unparsed → resolves to `-1`);\n // the positive `order-*` already drops since no typed branch claims it. Adding\n // it here drops BOTH signs. `isolation` (`isolate` / `isolation-auto`) reaches\n // the `custom` path as `isolation: isolate|auto` — also no RN equivalent.\n 'order',\n 'isolation',\n // `normal-nums` reaches the `custom` path as `font-variant-numeric: normal`\n // and leaked the non-RN key `fontVariantNumeric`. RN expresses numeric\n // variants via the `fontVariant` array, not this property — drop it. (The\n // `tabular-nums`/`oldstyle-nums`/… utilities carry their token in dropped\n // `--tw-numeric-*` vars and already resolve to {}; mapping those to\n // `fontVariant` is a tracked future enhancement, not a leak.)\n 'font-variant-numeric',\n 'touch-action',\n 'backdrop-filter',\n '-webkit-backdrop-filter',\n '-webkit-line-clamp',\n '-webkit-box-orient',\n '-webkit-font-smoothing',\n '-moz-osx-font-smoothing',\n])\n\n/**\n * Valid value sets for RN enum style props (keyed by the camelCase RN key).\n * A value outside its prop's set is RN-invalid even when the string itself\n * looks clean — RN ignores or warns on it (`position: 'fixed'`, `display:\n * 'contents'`, `justifyContent: 'stretch' | 'baseline'`, `alignContent:\n * 'normal'`). This is the dimension the leak-shape (`var(`/`calc(`/NaN) check\n * misses. Both the typed `display` / `position` branches AND the generic\n * unparsed fallback consult this — Tailwind routes some keyword-only values\n * (`justify-content: baseline`) through the unparsed channel, which would\n * otherwise emit them via `kebabToCamel` with no enum awareness.\n */\nconst RN_ENUM_VALUES: Readonly<Record<string, ReadonlySet<string>>> = {\n position: new Set(['absolute', 'relative', 'static']),\n display: new Set(['flex', 'none']),\n justifyContent: new Set(['flex-start', 'flex-end', 'center', 'space-between', 'space-around', 'space-evenly']),\n alignContent: new Set(['flex-start', 'flex-end', 'center', 'stretch', 'space-between', 'space-around', 'space-evenly']),\n}\n\n/** CSS single-sided logical-inline property → RN writing-direction Yoga key. */\nconst LOGICAL_INLINE_TO_RN: Record<string, string> = {\n 'margin-inline-start': 'marginStart',\n 'margin-inline-end': 'marginEnd',\n 'padding-inline-start': 'paddingStart',\n 'padding-inline-end': 'paddingEnd',\n}\n\n/**\n * Logical border-COLOR property → physical RN side key(s). Custom `@theme`\n * tokens reach the unparsed path as `border-inline-color: var(--color-x)`,\n * which a plain `kebabToCamel` would turn into `borderInlineColor` — a key RN\n * silently drops, so the border color never paints. Lower to the physical\n * keys RN actually honors, matching the typed `dispatchBorderDeclaration`.\n */\nconst LOGICAL_BORDER_COLOR_SIDES: Record<string, readonly string[]> = {\n 'border-inline-color': ['borderLeftColor', 'borderRightColor'],\n 'border-block-color': ['borderTopColor', 'borderBottomColor'],\n 'border-inline-start-color': ['borderLeftColor'],\n 'border-inline-end-color': ['borderRightColor'],\n 'border-block-start-color': ['borderTopColor'],\n 'border-block-end-color': ['borderBottomColor'],\n}\n\n/**\n * Pick the closest predefined CSS easing keyword for a `cubic-bezier`\n * control-point set. Mirrors {@link snapCubicBezierToKeyword} in\n * `animation.ts` — kept here so the unparsed-string path doesn't need\n * to import a typed-only helper.\n * @param x1 First control-point x (0–1).\n * @param y1 First control-point y (0–1).\n * @param x2 Second control-point x (0–1).\n * @param y2 Second control-point y (0–1).\n * @returns CSS easing keyword.\n */\nfunction snapBezier(x1: number, y1: number, x2: number, y2: number): string {\n const tol = 0.01\n const eq = (a: number, b: number): boolean => Math.abs(a - b) < tol\n if (eq(x1, 0) && eq(y1, 0) && eq(x2, 1) && eq(y2, 1)) return 'linear'\n if (eq(x1, 0.25) && eq(y1, 0.1) && eq(x2, 0.25) && eq(y2, 1)) return 'ease'\n if (eq(x1, 0.4) && eq(y1, 0) && eq(x2, 1) && eq(y2, 1)) return 'ease-in'\n if (eq(x1, 0) && eq(y1, 0) && eq(x2, 0.2) && eq(y2, 1)) return 'ease-out'\n if (eq(x1, 0.4) && eq(y1, 0) && eq(x2, 0.2) && eq(y2, 1)) return 'ease-in-out'\n const startsFlat = x1 < 0.1\n const endsFlat = x2 > 0.9\n if (startsFlat && !endsFlat) return 'ease-out'\n if (!startsFlat && endsFlat) return 'ease-in'\n return 'ease-in-out'\n}\n\n/**\n * Snap a cubic-bezier expression string to the closest CSS keyword\n * Reanimated v4's CSS engine accepts. Strings that already are keywords\n * pass through unchanged.\n * @param value Resolved value text from an unparsed timing-function declaration.\n * @returns CSS easing keyword.\n */\nfunction coerceCubicBezierString(value: string): string {\n const text = value.trim()\n if (CSS_EASING_KEYWORDS.has(text)) return text\n const match = /^cubic-bezier\\(\\s*([\\d.-]+)\\s*,\\s*([\\d.-]+)\\s*,\\s*([\\d.-]+)\\s*,\\s*([\\d.-]+)\\s*\\)$/.exec(text)\n if (!match) return 'ease-in-out'\n const [, x1, y1, x2, y2] = match\n return snapBezier(Number(x1), Number(y1), Number(x2), Number(y2))\n}\n\n/**\n * Whether `text` has a whitespace char OUTSIDE any parenthesised group —\n * the signature of a multi-token CSS value (`2px solid #000`) rather than a\n * single color (`#000`, `rgb(1 2 3)`, `red`).\n * @param text Resolved value text.\n * @returns True when a top-level space is present.\n */\nfunction hasTopLevelSpace(text: string): boolean {\n let depth = 0\n for (const ch of text.trim()) {\n if (ch === '(') depth += 1\n else if (ch === ')') depth = Math.max(0, depth - 1)\n else if (depth === 0 && (ch === ' ' || ch === '\\t' || ch === '\\n')) return true\n }\n return false\n}\n\n/**\n * Fast-path check for the handful of color property names Tailwind emits.\n * @param property Kebab-case CSS property name.\n * @returns Whether the property's value should be treated as a color.\n */\nfunction isColorProperty(property: string): boolean {\n return (\n property === 'color' ||\n property === 'background-color' ||\n // SVG paint props (`fill-<token>` / `stroke-<token>` via react-native-svg) —\n // they don't end in `-color`, so without this they'd skip normalization and\n // leak a raw `oklch(…)` string for custom `@theme` tokens.\n property === 'fill' ||\n property === 'stroke' ||\n (property.startsWith('border-') && property.endsWith('-color')) ||\n property.endsWith('-color')\n )\n}\n\n/**\n * Convert an unparsed declaration (typical Tailwind v4 output containing\n * `var()` / `calc()`) into RN entries. Serializes the token list, then\n * coerces the flat string into a number / keyword / length via a tight\n * set of shapes Tailwind actually emits.\n * @param property Real property name (kebab-case).\n * @param tokens Token list from lightningcss.\n * @param themeVars Optional lookup table for resolving `var(--x)` references.\n * @returns RN entries — usually one, empty when unusable.\n */\nfunction unparsedToEntries(\n property: string,\n tokens: readonly TokenOrValue[],\n themeVars: ReadonlyMap<string, string> | undefined,\n): readonly RNEntry[] {\n if (property.length === 0) return []\n if (RN_UNSUPPORTED_PROPERTIES.has(property)) return []\n // Safe-area detection runs BEFORE token serialization because\n // `env()` serializes to an empty string, which would strip the side\n // info we need. If the tokens encode a recognised `env(safe-area-inset-*)`\n // pattern (pure / `max(..., n)` / `calc(...+n)` / `h-screen-safe`),\n // emit a runtime-resolved marker instead.\n if (UNSUPPORTED_LOGICAL_PROPS.has(property)) return []\n const safe = detectSafeAreaMarker(tokens, themeVars)\n if (safe !== null) return [[kebabToCamel(property), safe]]\n let text = serializeTokens(tokens)\n if (themeVars && themeVars.size > 0) text = substituteThemeVars(text, themeVars)\n const coerced = coerceUnparsedValue(text)\n if (coerced === null) return []\n // Skip values still carrying an unresolved `var(--tw-*)` ANYWHERE in the\n // string — they came from a `@property --tw-*` composable with no real\n // fallback (e.g. `filter: blur(8px) var(--tw-brightness) …`,\n // `transform: rotateX(45deg) var(--tw-rotate-y) …`, `touch-action`,\n // `scroll-snap-type`). RN can't evaluate the cascade, so a leaked `var()`\n // makes the whole declaration an invalid string RN rejects — drop it and\n // rely on RN's default rather than emit garbage. `var(--color-*)` refs are\n // already substituted above, so anything left is a genuine composable miss.\n if (typeof coerced === 'string' && coerced.includes('var(')) return []\n // RN `fontFamily` is a single typeface, not a CSS fallback list — take\n // the first family so `--font-x: \"Name\", sans-serif` works out of the box.\n if (property === 'font-family' && typeof coerced === 'string') {\n return [['fontFamily', coerceFontFamily(coerced)]]\n }\n // Logical-direction CSS properties RN doesn't have direct equivalents\n // for. Keep the dropped names in one place so it's easy to audit.\n if (UNSUPPORTED_LOGICAL_PROPS.has(property)) return []\n if (TIMING_FUNCTION_PROPS.has(property) && typeof coerced === 'string') {\n // `transition-colors` and similar emit `var(--tw-ease, cubic-bezier(...))`\n // which serializes to a cubic-bezier STRING after substitution.\n // Reanimated v4's CSS engine rejects those — snap to the closest\n // predefined keyword (same logic as the typed `EasingFunction` path).\n return [[kebabToCamel(property), coerceCubicBezierString(coerced)]]\n }\n if (isColorProperty(property) && typeof coerced === 'string') {\n // A color is a single token. Tailwind compiles an arbitrary shorthand like\n // `border-[2px_solid_#000]` to `border-color: 2px solid #000` (invalid for\n // a color property → unparsed), which would otherwise emit\n // `borderColor: \"2px solid #000000\"` — a string RN rejects. A top-level\n // space (outside parens — `rgb(1 2 3)` keeps its inner spaces) means it's a\n // multi-token shorthand, not a color: drop it.\n if (hasTopLevelSpace(coerced)) return []\n // CSS-wide cascade keywords (`inherit`, `currentColor`, `initial`, `unset`,\n // `revert`, `revert-layer`) have no RN equivalent — RN has no color\n // cascade. Drop rather than leak an invalid color string to RN.\n if (isCssWideColorKeyword(coerced)) return []\n // Lower modern color spaces (`oklch(…)`, `lab(…)`, `color(p3 …)`) that\n // RN can't paint to sRGB; hex/rgb/hsl/named pass through unchanged.\n const color = normalizeColorString(coerced) ?? coerced\n // Logical border-color utilities must lower to physical RN side keys —\n // RN ignores `borderInlineColor` / `borderInlineStartColor`.\n const sides = LOGICAL_BORDER_COLOR_SIDES[property]\n if (sides) return sides.map((key): RNEntry => [key, color])\n return [[kebabToCamel(property), color]]\n }\n const camelKey = kebabToCamel(property)\n // Enum props whose value Tailwind sometimes routes through the unparsed\n // channel (`justify-content: baseline` → `justifyContent: 'baseline'`),\n // bypassing the typed dispatcher's keyword map. RN rejects values outside\n // the prop's set, so gate them here exactly like the typed branches do.\n const enumValues = RN_ENUM_VALUES[camelKey]\n if (enumValues && typeof coerced === 'string' && !enumValues.has(coerced)) return []\n return [[camelKey, coerced]]\n}\n\n/**\n * Convert one lightningcss `Declaration` into zero-or-more RN style\n * entries. Shorthand declarations (padding/margin/border-radius/flex) can\n * emit multiple entries; skipped or unsupported properties emit none.\n *\n * The switch branches on `decl.property` so TypeScript narrows\n * `decl.value` to the exact typed shape for each branch — no casts\n * required. Unknown properties fall through to `[]`.\n * @param decl One declaration from a lightningcss style rule.\n * @param themeVars Optional lookup table for resolving `var(--x)` references inside unparsed values.\n * @returns Array of `[key, value]` entries.\n */\nexport function declarationToRnEntries(decl: LcDeclaration, themeVars?: ReadonlyMap<string, string>): readonly RNEntry[] {\n switch (decl.property) {\n case 'custom': {\n // Lightningcss routes two shapes through `custom`:\n // - Actual CSS custom properties (`--my-var`): no RN meaning, drop.\n // - Real properties it doesn't have a dedicated typed entry for\n // (e.g. `object-fit`, `pointer-events`, future CSS keyword-only\n // props): treat like an unparsed declaration so the keyword\n // surfaces in the RN style.\n const customName = decl.value.name\n if (customName.startsWith('--')) return []\n return unparsedToEntries(customName, decl.value.value ?? [], themeVars)\n }\n case 'unparsed': {\n return unparsedToEntries(decl.value.propertyId.property, decl.value.value, themeVars)\n }\n case 'color':\n case 'background-color':\n case 'border-top-color':\n case 'border-right-color':\n case 'border-bottom-color':\n case 'border-left-color': {\n // `background-color` narrows to `CssColor | 'background'` — the\n // literal keyword means UA default. Skip the keyword.\n if (typeof decl.value === 'string') return []\n const colorString = cssColorToString(decl.value)\n // `currentColor` (lightningcss `{type:'currentcolor'}`) and any other\n // CSS-wide cascade keyword have no RN equivalent — drop instead of\n // leaking the keyword string to RN.\n if (isCssWideColorKeyword(colorString)) return []\n return [[kebabToCamel(decl.property), colorString]]\n }\n case 'border-color': {\n return expandBorderColor(decl.value)\n }\n case 'opacity': {\n // Lightningcss hands us an `f32` for opacity, so values like `0.8`\n // round-trip as `0.800000011920929`. Snap to 4 decimals to match the\n // rest of the parser's numeric convention.\n return [[decl.property, Math.round(decl.value * 10_000) / 10_000]]\n }\n case 'z-index': {\n return [['zIndex', zIndexToNumber(decl.value)]]\n }\n case 'top':\n case 'right':\n case 'bottom':\n case 'left': {\n const v = lengthPercentageOrAutoToValue(decl.value)\n if (v === null) return []\n return [[decl.property, v]]\n }\n case 'inset': {\n const top = lengthPercentageOrAutoToValue(decl.value.top)\n const right = lengthPercentageOrAutoToValue(decl.value.right)\n const bottom = lengthPercentageOrAutoToValue(decl.value.bottom)\n const left = lengthPercentageOrAutoToValue(decl.value.left)\n if (top === null || right === null || bottom === null || left === null) return []\n return [\n ['top', top],\n ['right', right],\n ['bottom', bottom],\n ['left', left],\n ]\n }\n case 'inset-inline': {\n const start = lengthPercentageOrAutoToValue(decl.value.inlineStart)\n const end = lengthPercentageOrAutoToValue(decl.value.inlineEnd)\n if (start === null || end === null) return []\n return [\n ['left', start],\n ['right', end],\n ]\n }\n case 'inset-block': {\n const start = lengthPercentageOrAutoToValue(decl.value.blockStart)\n const end = lengthPercentageOrAutoToValue(decl.value.blockEnd)\n if (start === null || end === null) return []\n return [\n ['top', start],\n ['bottom', end],\n ]\n }\n case 'width':\n case 'height':\n case 'min-width':\n case 'min-height':\n case 'max-width':\n case 'max-height': {\n const v = sizeLikeToValue(decl.value)\n if (v === null) return []\n return [[kebabToCamel(decl.property), v]]\n }\n case 'gap': {\n return expandGap(decl.value)\n }\n case 'row-gap':\n case 'column-gap': {\n const v = gapValueToValue(decl.value)\n if (v === null) return []\n return [[kebabToCamel(decl.property), v]]\n }\n case 'font-style': {\n return [['fontStyle', decl.value.type]]\n }\n case 'display': {\n // `displayToEntries` can still emit `contents` (a CSS value RN rejects —\n // only `flex` / `none` are valid). Gate the result on the RN-valid set.\n return displayToEntries(decl.value).filter(([, value]) => typeof value === 'string' && RN_ENUM_VALUES.display.has(value))\n }\n case 'position': {\n // RN `position` accepts only `absolute` / `relative` / `static`; CSS\n // `fixed` / `sticky` are invalid for RN, so drop them.\n return RN_ENUM_VALUES.position.has(decl.value.type) ? [['position', decl.value.type]] : []\n }\n case 'font-size': {\n const px = fontSizeToPx(decl.value)\n if (px === null) return []\n return [['fontSize', px]]\n }\n case 'font-weight': {\n return [['fontWeight', fontWeightToValue(decl.value)]]\n }\n case 'padding': {\n return expandFourSided('padding', decl.value)\n }\n case 'margin': {\n return expandFourSided('margin', decl.value)\n }\n case 'padding-inline': {\n return expandLogicalInline('padding', decl.value)\n }\n case 'padding-block': {\n return expandLogicalBlock('padding', decl.value)\n }\n case 'margin-inline': {\n return expandLogicalInline('margin', decl.value)\n }\n case 'margin-block': {\n return expandLogicalBlock('margin', decl.value)\n }\n case 'padding-top':\n case 'padding-right':\n case 'padding-bottom':\n case 'padding-left':\n case 'margin-top':\n case 'margin-right':\n case 'margin-bottom':\n case 'margin-left': {\n const v = lengthPercentageOrAutoToValue(decl.value)\n if (v === null) return []\n return [[kebabToCamel(decl.property), v]]\n }\n case 'border-radius': {\n return expandBorderRadius(decl.value)\n }\n case 'border-top-left-radius':\n case 'border-top-right-radius':\n case 'border-bottom-left-radius':\n case 'border-bottom-right-radius': {\n const [xAxis] = decl.value\n const v = dimensionPercentageToNumber(xAxis)\n if (v === null) return []\n return [[kebabToCamel(decl.property), v]]\n }\n case 'flex': {\n return flexToEntries(decl.value)\n }\n case 'flex-grow':\n case 'flex-shrink': {\n return [[kebabToCamel(decl.property), decl.value]]\n }\n case 'flex-basis': {\n const v = lengthPercentageOrAutoToValue(decl.value)\n if (v === null) return []\n return [['flexBasis', v]]\n }\n default: {\n return (\n dispatchLogicalInline(decl) ??\n dispatchLayoutDeclaration(decl) ??\n dispatchTypographyDeclaration(decl) ??\n dispatchColorPropertyDeclaration(decl) ??\n dispatchBorderDeclaration(decl) ??\n dispatchMotionDeclaration(decl) ??\n []\n )\n }\n }\n}\n\n/**\n * Map single-sided CSS logical-inline props to RN's writing-direction-aware\n * Yoga keys: `ms-2` → `marginStart`, `pe-4` → `paddingEnd`, `start-2` →\n * `start`, `end-3` → `end`. RN resolves start/end against the layout\n * direction, so these stay RTL-correct. Returns null for any other property\n * (so the dispatch chain continues).\n * @param decl One declaration from a lightningcss style rule.\n * @returns RN entries, or null when not a logical-inline property.\n */\nfunction dispatchLogicalInline(decl: LcDeclaration): readonly RNEntry[] | null {\n switch (decl.property) {\n case 'margin-inline-start':\n case 'margin-inline-end':\n case 'padding-inline-start':\n case 'padding-inline-end': {\n const v = lengthPercentageOrAutoToValue(decl.value)\n return v === null ? [] : [[LOGICAL_INLINE_TO_RN[decl.property], v]]\n }\n case 'inset-inline-start': {\n const v = lengthPercentageOrAutoToValue(decl.value)\n return v === null ? [] : [['start', v]]\n }\n case 'inset-inline-end': {\n const v = lengthPercentageOrAutoToValue(decl.value)\n return v === null ? [] : [['end', v]]\n }\n // Logical border-radius corners (`rounded-s/e/ss/se/ee/es-*`). RN has\n // matching keys — `kebabToCamel('border-start-start-radius')` is exactly\n // `borderStartStartRadius`. Value is a `[x, y]` tuple like physical corners.\n case 'border-start-start-radius':\n case 'border-start-end-radius':\n case 'border-end-start-radius':\n case 'border-end-end-radius': {\n const [xAxis] = decl.value\n const v = dimensionPercentageToNumber(xAxis)\n return v === null ? [] : [[kebabToCamel(decl.property), v]]\n }\n default: {\n return null\n }\n }\n}\n"],"names":["tokens","detectSafeAreaMarker","kebabToCamel","serializeTokens","substituteThemeVars","coerceUnparsedValue","coerceFontFamily","isCssWideColorKeyword","color","normalizeColorString","cssColorToString","expandBorderColor","zIndexToNumber","lengthPercentageOrAutoToValue","sizeLikeToValue","expandGap","gapValueToValue","displayToEntries","fontSizeToPx","fontWeightToValue","expandFourSided","expandLogicalInline","expandLogicalBlock","expandBorderRadius","dimensionPercentageToNumber","flexToEntries","dispatchLayoutDeclaration","dispatchTypographyDeclaration","dispatchColorPropertyDeclaration","dispatchBorderDeclaration","dispatchMotionDeclaration"],"mappings":";;;;;;;;;;;;;;;AAwBA;AACA,MAAM,qBAAqB,GAAG,IAAI,GAAG,CAAC,CAAC,4BAA4B,EAAE,2BAA2B,CAAC,CAAC;AAElG;AACA,MAAM,mBAAmB,GAAG,IAAI,GAAG,CAAC,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,aAAa,EAAE,YAAY,EAAE,UAAU,CAAC,CAAC;AAEvH;AACA,MAAM,yBAAyB,GAAG,IAAI,GAAG,CAAC;IACxC,qBAAqB;IACrB,oBAAoB;IACpB,2BAA2B;IAC3B,yBAAyB;IACzB,0BAA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` / `normal` /
|
|
5
|
+
* `left` / `right` (and `start`/`end`, which we lower to `flex-start`/`flex-end`
|
|
6
|
+
* BEFORE this gate). RN rejects anything outside this set — drop it.
|
|
7
|
+
*/
|
|
8
|
+
const RN_JUSTIFY_CONTENT_VALUES = new Set([
|
|
9
|
+
'flex-start',
|
|
10
|
+
'flex-end',
|
|
11
|
+
'center',
|
|
12
|
+
'space-between',
|
|
13
|
+
'space-around',
|
|
14
|
+
'space-evenly',
|
|
15
|
+
]);
|
|
16
|
+
/**
|
|
17
|
+
* `align-content` keywords RN accepts. Differs from `justify-content`: RN
|
|
18
|
+
* allows `stretch` here but rejects `normal`. Drop values outside the set.
|
|
19
|
+
*/
|
|
20
|
+
const RN_ALIGN_CONTENT_VALUES = new Set([
|
|
21
|
+
'flex-start',
|
|
22
|
+
'flex-end',
|
|
23
|
+
'center',
|
|
24
|
+
'stretch',
|
|
25
|
+
'space-between',
|
|
26
|
+
'space-around',
|
|
27
|
+
'space-evenly',
|
|
28
|
+
]);
|
|
3
29
|
/**
|
|
4
30
|
* Lower a CSS `overflow` keyword to one RN's `overflow` prop accepts
|
|
5
31
|
* (`'visible' | 'hidden' | 'scroll'`). `auto` → `scroll` (auto means
|
|
@@ -111,12 +137,16 @@ function dispatchLayoutDeclaration(decl) {
|
|
|
111
137
|
return v === null ? [] : [['alignSelf', v]];
|
|
112
138
|
}
|
|
113
139
|
case 'align-content': {
|
|
140
|
+
// After CSS→RN lowering, gate on RN's valid set — drops `normal`
|
|
141
|
+
// (`content-normal`) which RN's `alignContent` rejects.
|
|
114
142
|
const v = mapAlignKeyword(decl.value);
|
|
115
|
-
return v === null ? [] : [['alignContent', v]];
|
|
143
|
+
return v === null || !RN_ALIGN_CONTENT_VALUES.has(v) ? [] : [['alignContent', v]];
|
|
116
144
|
}
|
|
117
145
|
case 'justify-content': {
|
|
146
|
+
// After CSS→RN lowering, gate on RN's valid set — drops `stretch`
|
|
147
|
+
// (`justify-stretch`) and any other keyword RN's `justifyContent` rejects.
|
|
118
148
|
const v = mapJustifyKeyword(decl.value);
|
|
119
|
-
return v === null ? [] : [['justifyContent', v]];
|
|
149
|
+
return v === null || !RN_JUSTIFY_CONTENT_VALUES.has(v) ? [] : [['justifyContent', v]];
|
|
120
150
|
}
|
|
121
151
|
case 'overflow': {
|
|
122
152
|
// Lightningcss splits CSS `overflow` into `{x, y}` axes; RN only
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout-dispatcher.cjs","sources":["../../../../../src/core/parser/layout-dispatcher.ts"],"sourcesContent":["import type { Declaration as LcDeclaration } from 'lightningcss'\nimport type { RNEntry } from './types'\n\n/**\n * Lower a CSS `overflow` keyword to one RN's `overflow` prop accepts\n * (`'visible' | 'hidden' | 'scroll'`). `auto` → `scroll` (auto means\n * scroll-when-needed), `clip` → `hidden` (closest no-scroll clip). Anything\n * else (an unexpected keyword) drops so RN never sees an invalid value.\n * @param css CSS overflow keyword.\n * @returns RN overflow keyword, or `null` to drop.\n */\nfunction mapOverflow(css: string): string | null {\n if (css === 'visible' || css === 'hidden' || css === 'scroll') return css\n if (css === 'auto') return 'scroll'\n if (css === 'clip') return 'hidden'\n return null\n}\n\n/**\n * Build the RN `overflow` entry for a raw axis value, mapping it to an\n * RN-valid keyword and dropping unrepresentable shapes. Shared by the\n * `overflow` shorthand and the `overflow-x` / `overflow-y` longhands.\n * @param value Raw per-axis overflow value (string keyword or other).\n * @returns Single `[overflow, …]` entry, or empty when unmappable.\n */\nfunction overflowEntry(value: unknown): readonly RNEntry[] {\n const mapped = typeof value === 'string' ? mapOverflow(value) : null\n return mapped === null ? [] : [['overflow', mapped]]\n}\n\n/**\n * Lower CSS alignment keywords to the strings RN accepts. CSS uses\n * `start`/`end` while RN sticks with the legacy `flex-start`/`flex-end`.\n * Shared between `align-items`, `align-self`, `align-content`, and\n * `justify-content` — the lowering rule is identical for all four.\n * @param css CSS keyword (`center` / `start` / `end` / `baseline` / `stretch`).\n * @returns RN-compatible keyword.\n */\nfunction cssToRnAlignment(css: string): string {\n if (css === 'start') return 'flex-start'\n if (css === 'end') return 'flex-end'\n return css\n}\n\n/** Alias kept for clarity at the call site. Identical lowering rule. */\nconst cssToRnJustify = cssToRnAlignment\n\n/**\n * Map lightningcss's `align-items` / `align-self` / `align-content`\n * value (typed as `{type: 'self-position' | 'baseline-position', value: …}`)\n * to the RN keyword RN expects.\n * @param value Typed alignment value.\n * @returns RN alignment string, or `null` when unmappable.\n */\nfunction mapAlignKeyword(value: unknown): string | null {\n if (typeof value === 'string') return cssToRnAlignment(value)\n if (typeof value !== 'object' || value === null) return null\n const tagged = value as { type?: string; value?: string }\n if (tagged.type === 'baseline-position') return 'baseline'\n if (typeof tagged.value === 'string') return cssToRnAlignment(tagged.value)\n // Bare-keyword variants like `{type: 'stretch'}` carry the keyword\n // in the `type` field with no separate `value`.\n if (tagged.type === 'stretch' || tagged.type === 'normal') return cssToRnAlignment(tagged.type)\n return null\n}\n\n/**\n * Map lightningcss's `justify-content` value to the RN keyword.\n * @param value Typed justify value.\n * @returns RN justify string, or `null` when unmappable.\n */\nfunction mapJustifyKeyword(value: unknown): string | null {\n if (typeof value === 'string') return cssToRnJustify(value)\n if (typeof value !== 'object' || value === null) return null\n const tagged = value as { type?: string; value?: string }\n if (typeof tagged.value === 'string') return cssToRnJustify(tagged.value)\n return null\n}\n\n/**\n * Dispatch flexbox-layout declarations (flex-direction, flex-wrap,\n * align-items, align-self, align-content, justify-content). Returns\n * `null` for any property the dispatcher doesn't handle so the caller\n * can fall through to its main switch.\n *\n * RN expects keyword-mapped strings: `flex-start` / `flex-end` instead\n * of CSS's `start` / `end`. We do the lowering here.\n * @param decl One lightningcss declaration.\n * @returns RN entries when the property matched, else `null`.\n */\nexport function dispatchLayoutDeclaration(decl: LcDeclaration): readonly RNEntry[] | null {\n switch (decl.property) {\n case 'flex-direction': {\n return [['flexDirection', String(decl.value)]]\n }\n case 'flex-wrap': {\n return [['flexWrap', String(decl.value)]]\n }\n case 'align-items': {\n const v = mapAlignKeyword(decl.value)\n return v === null ? [] : [['alignItems', v]]\n }\n case 'align-self': {\n const v = mapAlignKeyword(decl.value)\n return v === null ? [] : [['alignSelf', v]]\n }\n case 'align-content': {\n const v = mapAlignKeyword(decl.value)\n return v === null ? [] : [['alignContent', v]]\n }\n case 'justify-content': {\n const v = mapJustifyKeyword(decl.value)\n return v === null ? [] : [['justifyContent', v]]\n }\n case 'overflow': {\n // Lightningcss splits CSS `overflow` into `{x, y}` axes; RN only\n // supports a single `overflow` keyword. Take the `x` axis when the\n // user wrote shorthand; per-axis Tailwind utilities both emit\n // shorthand here so axis splitting is rare.\n return overflowEntry((decl.value as { x?: unknown }).x)\n }\n case 'overflow-x':\n case 'overflow-y': {\n // Tailwind's `overflow-x-*` / `overflow-y-*` emit these longhands,\n // not the `overflow` shorthand. RN has only a single `overflow`,\n // so collapse both axes onto it (last one declared wins via the\n // normal entry-merge order).\n return overflowEntry(decl.value)\n }\n default: {\n return null\n }\n }\n}\n"],"names":[],"mappings":";;AAGA;;;;;;;AAOG;AACH,SAAS,WAAW,CAAC,GAAW,EAAA;IAC9B,IAAI,GAAG,KAAK,SAAS,IAAI,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,QAAQ;AAAE,QAAA,OAAO,GAAG;IACzE,IAAI,GAAG,KAAK,MAAM;AAAE,QAAA,OAAO,QAAQ;IACnC,IAAI,GAAG,KAAK,MAAM;AAAE,QAAA,OAAO,QAAQ;AACnC,IAAA,OAAO,IAAI;AACb;AAEA;;;;;;AAMG;AACH,SAAS,aAAa,CAAC,KAAc,EAAA;AACnC,IAAA,MAAM,MAAM,GAAG,OAAO,KAAK,KAAK,QAAQ,GAAG,WAAW,CAAC,KAAK,CAAC,GAAG,IAAI;AACpE,IAAA,OAAO,MAAM,KAAK,IAAI,GAAG,EAAE,GAAG,CAAC,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;AACtD;AAEA;;;;;;;AAOG;AACH,SAAS,gBAAgB,CAAC,GAAW,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AAyB,CAAC,IAAmB,EAAA;AAC3D,IAAA,QAAQ,IAAI,CAAC,QAAQ;QACnB,KAAK,gBAAgB,EAAE;AACrB,YAAA,OAAO,CAAC,CAAC,eAAe,EAAE,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;QAChD;QACA,KAAK,WAAW,EAAE;AAChB,YAAA,OAAO,CAAC,CAAC,UAAU,EAAE,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;QAC3C;QACA,KAAK,aAAa,EAAE;YAClB,MAAM,CAAC,GAAG,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC;AACrC,YAAA,OAAO,CAAC,KAAK,IAAI,GAAG,EAAE,GAAG,CAAC,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC;QAC9C;QACA,KAAK,YAAY,EAAE;YACjB,MAAM,CAAC,GAAG,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC;AACrC,YAAA,OAAO,CAAC,KAAK,IAAI,GAAG,EAAE,GAAG,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC;QAC7C;QACA,KAAK,eAAe,EAAE
|
|
1
|
+
{"version":3,"file":"layout-dispatcher.cjs","sources":["../../../../../src/core/parser/layout-dispatcher.ts"],"sourcesContent":["import type { Declaration as LcDeclaration } from 'lightningcss'\nimport type { RNEntry } from './types'\n\n/**\n * `justify-content` keywords RN accepts. CSS adds `stretch` / `normal` /\n * `left` / `right` (and `start`/`end`, which we lower to `flex-start`/`flex-end`\n * BEFORE this gate). RN rejects anything outside this set — drop it.\n */\nconst RN_JUSTIFY_CONTENT_VALUES: ReadonlySet<string> = new Set([\n 'flex-start',\n 'flex-end',\n 'center',\n 'space-between',\n 'space-around',\n 'space-evenly',\n])\n\n/**\n * `align-content` keywords RN accepts. Differs from `justify-content`: RN\n * allows `stretch` here but rejects `normal`. Drop values outside the set.\n */\nconst RN_ALIGN_CONTENT_VALUES: ReadonlySet<string> = new Set([\n 'flex-start',\n 'flex-end',\n 'center',\n 'stretch',\n 'space-between',\n 'space-around',\n 'space-evenly',\n])\n\n/**\n * Lower a CSS `overflow` keyword to one RN's `overflow` prop accepts\n * (`'visible' | 'hidden' | 'scroll'`). `auto` → `scroll` (auto means\n * scroll-when-needed), `clip` → `hidden` (closest no-scroll clip). Anything\n * else (an unexpected keyword) drops so RN never sees an invalid value.\n * @param css CSS overflow keyword.\n * @returns RN overflow keyword, or `null` to drop.\n */\nfunction mapOverflow(css: string): string | null {\n if (css === 'visible' || css === 'hidden' || css === 'scroll') return css\n if (css === 'auto') return 'scroll'\n if (css === 'clip') return 'hidden'\n return null\n}\n\n/**\n * Build the RN `overflow` entry for a raw axis value, mapping it to an\n * RN-valid keyword and dropping unrepresentable shapes. Shared by the\n * `overflow` shorthand and the `overflow-x` / `overflow-y` longhands.\n * @param value Raw per-axis overflow value (string keyword or other).\n * @returns Single `[overflow, …]` entry, or empty when unmappable.\n */\nfunction overflowEntry(value: unknown): readonly RNEntry[] {\n const mapped = typeof value === 'string' ? mapOverflow(value) : null\n return mapped === null ? [] : [['overflow', mapped]]\n}\n\n/**\n * Lower CSS alignment keywords to the strings RN accepts. CSS uses\n * `start`/`end` while RN sticks with the legacy `flex-start`/`flex-end`.\n * Shared between `align-items`, `align-self`, `align-content`, and\n * `justify-content` — the lowering rule is identical for all four.\n * @param css CSS keyword (`center` / `start` / `end` / `baseline` / `stretch`).\n * @returns RN-compatible keyword.\n */\nfunction cssToRnAlignment(css: string): string {\n if (css === 'start') return 'flex-start'\n if (css === 'end') return 'flex-end'\n return css\n}\n\n/** Alias kept for clarity at the call site. Identical lowering rule. */\nconst cssToRnJustify = cssToRnAlignment\n\n/**\n * Map lightningcss's `align-items` / `align-self` / `align-content`\n * value (typed as `{type: 'self-position' | 'baseline-position', value: …}`)\n * to the RN keyword RN expects.\n * @param value Typed alignment value.\n * @returns RN alignment string, or `null` when unmappable.\n */\nfunction mapAlignKeyword(value: unknown): string | null {\n if (typeof value === 'string') return cssToRnAlignment(value)\n if (typeof value !== 'object' || value === null) return null\n const tagged = value as { type?: string; value?: string }\n if (tagged.type === 'baseline-position') return 'baseline'\n if (typeof tagged.value === 'string') return cssToRnAlignment(tagged.value)\n // Bare-keyword variants like `{type: 'stretch'}` carry the keyword\n // in the `type` field with no separate `value`.\n if (tagged.type === 'stretch' || tagged.type === 'normal') return cssToRnAlignment(tagged.type)\n return null\n}\n\n/**\n * Map lightningcss's `justify-content` value to the RN keyword.\n * @param value Typed justify value.\n * @returns RN justify string, or `null` when unmappable.\n */\nfunction mapJustifyKeyword(value: unknown): string | null {\n if (typeof value === 'string') return cssToRnJustify(value)\n if (typeof value !== 'object' || value === null) return null\n const tagged = value as { type?: string; value?: string }\n if (typeof tagged.value === 'string') return cssToRnJustify(tagged.value)\n return null\n}\n\n/**\n * Dispatch flexbox-layout declarations (flex-direction, flex-wrap,\n * align-items, align-self, align-content, justify-content). Returns\n * `null` for any property the dispatcher doesn't handle so the caller\n * can fall through to its main switch.\n *\n * RN expects keyword-mapped strings: `flex-start` / `flex-end` instead\n * of CSS's `start` / `end`. We do the lowering here.\n * @param decl One lightningcss declaration.\n * @returns RN entries when the property matched, else `null`.\n */\nexport function dispatchLayoutDeclaration(decl: LcDeclaration): readonly RNEntry[] | null {\n switch (decl.property) {\n case 'flex-direction': {\n return [['flexDirection', String(decl.value)]]\n }\n case 'flex-wrap': {\n return [['flexWrap', String(decl.value)]]\n }\n case 'align-items': {\n const v = mapAlignKeyword(decl.value)\n return v === null ? [] : [['alignItems', v]]\n }\n case 'align-self': {\n const v = mapAlignKeyword(decl.value)\n return v === null ? [] : [['alignSelf', v]]\n }\n case 'align-content': {\n // After CSS→RN lowering, gate on RN's valid set — drops `normal`\n // (`content-normal`) which RN's `alignContent` rejects.\n const v = mapAlignKeyword(decl.value)\n return v === null || !RN_ALIGN_CONTENT_VALUES.has(v) ? [] : [['alignContent', v]]\n }\n case 'justify-content': {\n // After CSS→RN lowering, gate on RN's valid set — drops `stretch`\n // (`justify-stretch`) and any other keyword RN's `justifyContent` rejects.\n const v = mapJustifyKeyword(decl.value)\n return v === null || !RN_JUSTIFY_CONTENT_VALUES.has(v) ? [] : [['justifyContent', v]]\n }\n case 'overflow': {\n // Lightningcss splits CSS `overflow` into `{x, y}` axes; RN only\n // supports a single `overflow` keyword. Take the `x` axis when the\n // user wrote shorthand; per-axis Tailwind utilities both emit\n // shorthand here so axis splitting is rare.\n return overflowEntry((decl.value as { x?: unknown }).x)\n }\n case 'overflow-x':\n case 'overflow-y': {\n // Tailwind's `overflow-x-*` / `overflow-y-*` emit these longhands,\n // not the `overflow` shorthand. RN has only a single `overflow`,\n // so collapse both axes onto it (last one declared wins via the\n // normal entry-merge order).\n return overflowEntry(decl.value)\n }\n default: {\n return null\n }\n }\n}\n"],"names":[],"mappings":";;AAGA;;;;AAIG;AACH,MAAM,yBAAyB,GAAwB,IAAI,GAAG,CAAC;IAC7D,YAAY;IACZ,UAAU;IACV,QAAQ;IACR,eAAe;IACf,cAAc;IACd,cAAc;AACf,CAAA,CAAC;AAEF;;;AAGG;AACH,MAAM,uBAAuB,GAAwB,IAAI,GAAG,CAAC;IAC3D,YAAY;IACZ,UAAU;IACV,QAAQ;IACR,SAAS;IACT,eAAe;IACf,cAAc;IACd,cAAc;AACf,CAAA,CAAC;AAEF;;;;;;;AAOG;AACH,SAAS,WAAW,CAAC,GAAW,EAAA;IAC9B,IAAI,GAAG,KAAK,SAAS,IAAI,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,QAAQ;AAAE,QAAA,OAAO,GAAG;IACzE,IAAI,GAAG,KAAK,MAAM;AAAE,QAAA,OAAO,QAAQ;IACnC,IAAI,GAAG,KAAK,MAAM;AAAE,QAAA,OAAO,QAAQ;AACnC,IAAA,OAAO,IAAI;AACb;AAEA;;;;;;AAMG;AACH,SAAS,aAAa,CAAC,KAAc,EAAA;AACnC,IAAA,MAAM,MAAM,GAAG,OAAO,KAAK,KAAK,QAAQ,GAAG,WAAW,CAAC,KAAK,C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GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,gBAAgB,EAAE,CAAC,CAAC,CAAC;QACvF;QACA,KAAK,UAAU,EAAE;;;;;YAKf,OAAO,aAAa,CAAE,IAAI,CAAC,KAAyB,CAAC,CAAC,CAAC;QACzD;AACA,QAAA,KAAK,YAAY;QACjB,KAAK,YAAY,EAAE;;;;;AAKjB,YAAA,OAAO,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC;QAClC;QACA,SAAS;AACP,YAAA,OAAO,IAAI;QACb;;AAEJ;;;;"}
|
|
@@ -128,14 +128,21 @@ function expandBorderColor(value) {
|
|
|
128
128
|
const right = color.cssColorToString(value.right);
|
|
129
129
|
const bottom = color.cssColorToString(value.bottom);
|
|
130
130
|
const left = color.cssColorToString(value.left);
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
131
|
+
// CSS-wide cascade keywords (`currentColor`, `inherit`, …) have no RN
|
|
132
|
+
// equivalent — drop any side that resolves to one rather than leak the
|
|
133
|
+
// keyword as a `borderColor`/`border*Color` value RN can't paint.
|
|
134
|
+
const sides = [
|
|
134
135
|
['borderTopColor', top],
|
|
135
136
|
['borderRightColor', right],
|
|
136
137
|
['borderBottomColor', bottom],
|
|
137
138
|
['borderLeftColor', left],
|
|
138
139
|
];
|
|
140
|
+
const paintable = sides.filter(([, color$1]) => !color.isCssWideColorKeyword(color$1));
|
|
141
|
+
if (paintable.length === 0)
|
|
142
|
+
return [];
|
|
143
|
+
if (paintable.length === 4 && top === right && right === bottom && bottom === left)
|
|
144
|
+
return [['borderColor', top]];
|
|
145
|
+
return paintable;
|
|
139
146
|
}
|
|
140
147
|
/**
|
|
141
148
|
* Expand `gap` shorthand (`{row, column}`) into RN entries. When both
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shorthand.cjs","sources":["../../../../../src/core/parser/shorthand.ts"],"sourcesContent":["import type {\n BorderColor,\n BorderRadius,\n Flex,\n Gap,\n Margin,\n MarginBlock,\n MarginInline,\n Padding,\n PaddingBlock,\n PaddingInline,\n} from 'lightningcss'\nimport { cssColorToString } from './color'\nimport { dimensionPercentageToNumber, gapValueToValue, lengthPercentageOrAutoToValue } from './length'\nimport type { RNEntry } from './types'\n\n/**\n * Expand `margin` / `padding` shorthand (`{top, right, bottom, left}`) to\n * RN entries. Collapses progressively for a smaller emitted style:\n * - all four equal → single `padding` / `margin`\n * - matching axes → `paddingHorizontal` + `paddingVertical`\n * - one matching axis → that axis collapsed, opposite axis as longhands\n * - otherwise → four longhands\n * @param property `'padding'` or `'margin'`.\n * @param value Typed shorthand record.\n * @returns RN entries.\n */\nexport function expandFourSided(property: 'padding' | 'margin', value: Padding | Margin): readonly RNEntry[] {\n const top = lengthPercentageOrAutoToValue(value.top)\n const right = lengthPercentageOrAutoToValue(value.right)\n const bottom = lengthPercentageOrAutoToValue(value.bottom)\n const left = lengthPercentageOrAutoToValue(value.left)\n if (top === null || right === null || bottom === null || left === null) return []\n if (top === right && right === bottom && bottom === left) return [[property, top]]\n const horizontalEqual = left === right\n const verticalEqual = top === bottom\n if (horizontalEqual && verticalEqual) {\n return [\n [`${property}Vertical`, top],\n [`${property}Horizontal`, left],\n ]\n }\n if (horizontalEqual) {\n return [\n [`${property}Top`, top],\n [`${property}Bottom`, bottom],\n [`${property}Horizontal`, left],\n ]\n }\n if (verticalEqual) {\n return [\n [`${property}Vertical`, top],\n [`${property}Right`, right],\n [`${property}Left`, left],\n ]\n }\n return [\n [`${property}Top`, top],\n [`${property}Right`, right],\n [`${property}Bottom`, bottom],\n [`${property}Left`, left],\n ]\n}\n\n/**\n * Expand `padding-inline` / `margin-inline` (logical property) into RN's\n * physical pair. RN has no RTL-aware logical props at the style-object\n * level, so we lower at compile time. When both sides match, emit the\n * single `paddingHorizontal` / `marginHorizontal` shorthand for a more\n * compact style.\n * @param property `'padding'` or `'margin'`.\n * @param value Typed inline shorthand.\n * @returns RN entries.\n */\nexport function expandLogicalInline(property: 'padding' | 'margin', value: PaddingInline | MarginInline): readonly RNEntry[] {\n const start = lengthPercentageOrAutoToValue(value.inlineStart)\n const end = lengthPercentageOrAutoToValue(value.inlineEnd)\n if (start === null || end === null) return []\n if (start === end) return [[`${property}Horizontal`, start]]\n return [\n [`${property}Left`, start],\n [`${property}Right`, end],\n ]\n}\n\n/**\n * Expand `padding-block` / `margin-block` (logical property) into RN's\n * physical pair. When both sides match, emit `paddingVertical` /\n * `marginVertical` for a more compact style.\n * @param property `'padding'` or `'margin'`.\n * @param value Typed block shorthand.\n * @returns RN entries.\n */\nexport function expandLogicalBlock(property: 'padding' | 'margin', value: PaddingBlock | MarginBlock): readonly RNEntry[] {\n const start = lengthPercentageOrAutoToValue(value.blockStart)\n const end = lengthPercentageOrAutoToValue(value.blockEnd)\n if (start === null || end === null) return []\n if (start === end) return [[`${property}Vertical`, start]]\n return [\n [`${property}Top`, start],\n [`${property}Bottom`, end],\n ]\n}\n\n/**\n * Expand a `border-radius` shorthand into RN corner entries. Each corner\n * is a 2-tuple `[x, y]` in lightningcss; RN exposes one radius per corner\n * so we use the x-axis. When all four corners match, collapse to the\n * single `borderRadius` key.\n * @param value Typed `BorderRadius` record.\n * @returns RN entries.\n */\nexport function expandBorderRadius(value: BorderRadius): readonly RNEntry[] {\n const corners: Array<[string, number | string | null]> = [\n ['borderTopLeftRadius', dimensionPercentageToNumber(value.topLeft[0])],\n ['borderTopRightRadius', dimensionPercentageToNumber(value.topRight[0])],\n ['borderBottomRightRadius', dimensionPercentageToNumber(value.bottomRight[0])],\n ['borderBottomLeftRadius', dimensionPercentageToNumber(value.bottomLeft[0])],\n ]\n const [first] = corners\n if (first?.[1] == null) return []\n if (corners.every(([, v]) => v === first[1])) return [['borderRadius', first[1]]]\n return corners.filter((entry): entry is [string, number | string] => entry[1] !== null)\n}\n\n/**\n * Expand a `border-color` shorthand into RN longhands. When all four\n * sides match, collapse to a single `borderColor`; otherwise emit per-side\n * props.\n * @param value Typed `BorderColor` record.\n * @returns RN entries.\n */\nexport function expandBorderColor(value: BorderColor): readonly RNEntry[] {\n const top = cssColorToString(value.top)\n const right = cssColorToString(value.right)\n const bottom = cssColorToString(value.bottom)\n const left = cssColorToString(value.left)\n if (top === right && right === bottom && bottom === left) return [['borderColor', top]]\n return [\n ['borderTopColor', top],\n ['borderRightColor', right],\n ['borderBottomColor', bottom],\n ['borderLeftColor', left],\n ]\n}\n\n/**\n * Expand `gap` shorthand (`{row, column}`) into RN entries. When both\n * axes equal the same value collapse to the single `gap` key; otherwise\n * emit `rowGap` + `columnGap`.\n * @param value Typed `Gap` record.\n * @returns RN entries.\n */\nexport function expandGap(value: Gap): readonly RNEntry[] {\n const row = gapValueToValue(value.row)\n const column = gapValueToValue(value.column)\n if (row === null || column === null) return []\n if (row === column) return [['gap', row]]\n return [\n ['rowGap', row],\n ['columnGap', column],\n ]\n}\n\n/**\n * Convert `Flex` shorthand to RN entries. When the shape matches `flex:\n * 1` (`{grow:1, shrink:1, basis: 0%}`), emit the single `flex` key RN\n * understands. Otherwise expand to the three longhands.\n * @param value Typed `Flex` record.\n * @returns RN entries.\n */\nexport function flexToEntries(value: Flex): readonly RNEntry[] {\n const basis = lengthPercentageOrAutoToValue(value.basis)\n if (basis === null) return []\n if (value.grow === 1 && value.shrink === 1 && basis === '0%') return [['flex', 1]]\n const entries: RNEntry[] = [\n ['flexGrow', value.grow],\n ['flexShrink', value.shrink],\n ]\n if (basis !== 'auto') entries.push(['flexBasis', basis])\n return entries\n}\n"],"names":["lengthPercentageOrAutoToValue","dimensionPercentageToNumber","cssColorToString","gapValueToValue"],"mappings":";;;;;AAgBA;;;;;;;;;;AAUG;AACG,SAAU,eAAe,CAAC,QAA8B,EAAE,KAAuB,EAAA;IACrF,MAAM,GAAG,GAAGA,oCAA6B,CAAC,KAAK,CAAC,GAAG,CAAC;IACpD,MAAM,KAAK,GAAGA,oCAA6B,CAAC,KAAK,CAAC,KAAK,CAAC;IACxD,MAAM,MAAM,GAAGA,oCAA6B,CAAC,KAAK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AAC,CAAC,CAAC;AAClF,IAAA,MAAM,OAAO,GAAc;AACzB,QAAA,CAAC,UAAU,EAAE,KAAK,CAAC,IAAI,CAAC;AACxB,QAAA,CAAC,YAAY,EAAE,KAAK,CAAC,MAAM,CAAC;KAC7B;IACD,IAAI,KAAK,KAAK,MAAM;QAAE,OAAO,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC;AACxD,IAAA,OAAO,OAAO;AAChB;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"shorthand.cjs","sources":["../../../../../src/core/parser/shorthand.ts"],"sourcesContent":["import type {\n BorderColor,\n BorderRadius,\n Flex,\n Gap,\n Margin,\n MarginBlock,\n MarginInline,\n Padding,\n PaddingBlock,\n PaddingInline,\n} from 'lightningcss'\nimport { cssColorToString, isCssWideColorKeyword } from './color'\nimport { dimensionPercentageToNumber, gapValueToValue, lengthPercentageOrAutoToValue } from './length'\nimport type { RNEntry } from './types'\n\n/**\n * Expand `margin` / `padding` shorthand (`{top, right, bottom, left}`) to\n * RN entries. Collapses progressively for a smaller emitted style:\n * - all four equal → single `padding` / `margin`\n * - matching axes → `paddingHorizontal` + `paddingVertical`\n * - one matching axis → that axis collapsed, opposite axis as longhands\n * - otherwise → four longhands\n * @param property `'padding'` or `'margin'`.\n * @param value Typed shorthand record.\n * @returns RN entries.\n */\nexport function expandFourSided(property: 'padding' | 'margin', value: Padding | Margin): readonly RNEntry[] {\n const top = lengthPercentageOrAutoToValue(value.top)\n const right = lengthPercentageOrAutoToValue(value.right)\n const bottom = lengthPercentageOrAutoToValue(value.bottom)\n const left = lengthPercentageOrAutoToValue(value.left)\n if (top === null || right === null || bottom === null || left === null) return []\n if (top === right && right === bottom && bottom === left) return [[property, top]]\n const horizontalEqual = left === right\n const verticalEqual = top === bottom\n if (horizontalEqual && verticalEqual) {\n return [\n [`${property}Vertical`, top],\n [`${property}Horizontal`, left],\n ]\n }\n if (horizontalEqual) {\n return [\n [`${property}Top`, top],\n [`${property}Bottom`, bottom],\n [`${property}Horizontal`, left],\n ]\n }\n if (verticalEqual) {\n return [\n [`${property}Vertical`, top],\n [`${property}Right`, right],\n [`${property}Left`, left],\n ]\n }\n return [\n [`${property}Top`, top],\n [`${property}Right`, right],\n [`${property}Bottom`, bottom],\n [`${property}Left`, left],\n ]\n}\n\n/**\n * Expand `padding-inline` / `margin-inline` (logical property) into RN's\n * physical pair. RN has no RTL-aware logical props at the style-object\n * level, so we lower at compile time. When both sides match, emit the\n * single `paddingHorizontal` / `marginHorizontal` shorthand for a more\n * compact style.\n * @param property `'padding'` or `'margin'`.\n * @param value Typed inline shorthand.\n * @returns RN entries.\n */\nexport function expandLogicalInline(property: 'padding' | 'margin', value: PaddingInline | MarginInline): readonly RNEntry[] {\n const start = lengthPercentageOrAutoToValue(value.inlineStart)\n const end = lengthPercentageOrAutoToValue(value.inlineEnd)\n if (start === null || end === null) return []\n if (start === end) return [[`${property}Horizontal`, start]]\n return [\n [`${property}Left`, start],\n [`${property}Right`, end],\n ]\n}\n\n/**\n * Expand `padding-block` / `margin-block` (logical property) into RN's\n * physical pair. When both sides match, emit `paddingVertical` /\n * `marginVertical` for a more compact style.\n * @param property `'padding'` or `'margin'`.\n * @param value Typed block shorthand.\n * @returns RN entries.\n */\nexport function expandLogicalBlock(property: 'padding' | 'margin', value: PaddingBlock | MarginBlock): readonly RNEntry[] {\n const start = lengthPercentageOrAutoToValue(value.blockStart)\n const end = lengthPercentageOrAutoToValue(value.blockEnd)\n if (start === null || end === null) return []\n if (start === end) return [[`${property}Vertical`, start]]\n return [\n [`${property}Top`, start],\n [`${property}Bottom`, end],\n ]\n}\n\n/**\n * Expand a `border-radius` shorthand into RN corner entries. Each corner\n * is a 2-tuple `[x, y]` in lightningcss; RN exposes one radius per corner\n * so we use the x-axis. When all four corners match, collapse to the\n * single `borderRadius` key.\n * @param value Typed `BorderRadius` record.\n * @returns RN entries.\n */\nexport function expandBorderRadius(value: BorderRadius): readonly RNEntry[] {\n const corners: Array<[string, number | string | null]> = [\n ['borderTopLeftRadius', dimensionPercentageToNumber(value.topLeft[0])],\n ['borderTopRightRadius', dimensionPercentageToNumber(value.topRight[0])],\n ['borderBottomRightRadius', dimensionPercentageToNumber(value.bottomRight[0])],\n ['borderBottomLeftRadius', dimensionPercentageToNumber(value.bottomLeft[0])],\n ]\n const [first] = corners\n if (first?.[1] == null) return []\n if (corners.every(([, v]) => v === first[1])) return [['borderRadius', first[1]]]\n return corners.filter((entry): entry is [string, number | string] => entry[1] !== null)\n}\n\n/**\n * Expand a `border-color` shorthand into RN longhands. When all four\n * sides match, collapse to a single `borderColor`; otherwise emit per-side\n * props.\n * @param value Typed `BorderColor` record.\n * @returns RN entries.\n */\nexport function expandBorderColor(value: BorderColor): readonly RNEntry[] {\n const top = cssColorToString(value.top)\n const right = cssColorToString(value.right)\n const bottom = cssColorToString(value.bottom)\n const left = cssColorToString(value.left)\n // CSS-wide cascade keywords (`currentColor`, `inherit`, …) have no RN\n // equivalent — drop any side that resolves to one rather than leak the\n // keyword as a `borderColor`/`border*Color` value RN can't paint.\n const sides: readonly (readonly [string, string])[] = [\n ['borderTopColor', top],\n ['borderRightColor', right],\n ['borderBottomColor', bottom],\n ['borderLeftColor', left],\n ]\n const paintable = sides.filter(([, color]) => !isCssWideColorKeyword(color))\n if (paintable.length === 0) return []\n if (paintable.length === 4 && top === right && right === bottom && bottom === left) return [['borderColor', top]]\n return paintable\n}\n\n/**\n * Expand `gap` shorthand (`{row, column}`) into RN entries. When both\n * axes equal the same value collapse to the single `gap` key; otherwise\n * emit `rowGap` + `columnGap`.\n * @param value Typed `Gap` record.\n * @returns RN entries.\n */\nexport function expandGap(value: Gap): readonly RNEntry[] {\n const row = gapValueToValue(value.row)\n const column = gapValueToValue(value.column)\n if (row === null || column === null) return []\n if (row === column) return [['gap', row]]\n return [\n ['rowGap', row],\n ['columnGap', column],\n ]\n}\n\n/**\n * Convert `Flex` shorthand to RN entries. When the shape matches `flex:\n * 1` (`{grow:1, shrink:1, basis: 0%}`), emit the single `flex` key RN\n * understands. Otherwise expand to the three longhands.\n * @param value Typed `Flex` record.\n * @returns RN entries.\n */\nexport function flexToEntries(value: Flex): readonly RNEntry[] {\n const basis = lengthPercentageOrAutoToValue(value.basis)\n if (basis === null) return []\n if (value.grow === 1 && value.shrink === 1 && basis === '0%') return [['flex', 1]]\n const entries: RNEntry[] = [\n ['flexGrow', value.grow],\n ['flexShrink', value.shrink],\n ]\n if (basis !== 'auto') entries.push(['flexBasis', basis])\n return entries\n}\n"],"names":["lengthPercentageOrAutoToValue","dimensionPercentageToNumber","cssColorToString","color","isCssWideColorKeyword","gapValueToValue"],"mappings":";;;;;AAgBA;;;;;;;;;;AAUG;AACG,SAAU,eAAe,CAAC,QAA8B,EAAE,KAAuB,EAAA;IACrF,MAAM,GAAG,GAAGA,oCAA6B,CAAC,KAAK,CAAC,GAAG,CAAC;IACpD,MAAM,KAAK,GAAGA,oCAA6B,CAAC,KAAK,CAAC,KAAK,CAAC;IACxD,MAAM,MAAM,GAAGA,oCAA6B,CAAC,KAAK,CAAC,MAAM,CAAC;IAC1D,MAAM,IAAI,GAAGA,oCAA6B,CAAC,KAAK,CAAC,IAAI,CAAC;AACtD,IAAA,IAAI,GAAG,KAAK,IAAI,IAAI,KAAK,KAAK,IAAI,IAAI,MAAM,KAAK,IAAI,IAAI,IAAI,KAAK,IAAI;AAAE,QAAA,OAAO,EAAE;IACjF,IAAI,GAAG,KAAK,KAAK,IAAI,KAAK,KAAK,MAAM,IAAI,MAAM,KAAK,IAAI;AAAE,QAAA,OAAO,CAAC,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;AAClF,IAAA,MAAM,eAAe,GAAG,IAAI,KAAK,KAAK;AACtC,IAAA,MAAM,aAAa,GAAG,GAAG,KAAK,MAAM;AACpC,IAAA,IAAI,eAAe,IAAI,aAAa,EAAE;QACpC,OAAO;AACL,YAAA,CAAC,CAAA,EAAG,QAAQ,CAAA,QAAA,CAAU,EAAE,GA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;;;;;;;;;;"}
|
|
@@ -257,6 +257,15 @@ function coerceUnparsedValue(text) {
|
|
|
257
257
|
const colorMix = evaluateColorMixWithTransparent(trimmed);
|
|
258
258
|
if (colorMix !== null)
|
|
259
259
|
return colorMix;
|
|
260
|
+
// Real two-color `color-mix(in <space>, A, B)` (not the `, transparent)`
|
|
261
|
+
// opacity shape) — resolve it to a concrete sRGB color via culori so the
|
|
262
|
+
// raw, RN-unreadable `color-mix(...)` string never reaches the StyleSheet.
|
|
263
|
+
if (trimmed.toLowerCase().startsWith('color-mix(')) {
|
|
264
|
+
// Resolved → concrete color; unresolvable → null (DROP). Either way the
|
|
265
|
+
// raw `color-mix(...)` text must never fall through to the string path
|
|
266
|
+
// below, where RN would receive an unreadable value and render nothing.
|
|
267
|
+
return color.normalizeColorString(trimmed);
|
|
268
|
+
}
|
|
260
269
|
const fallback = extractVariableFallback(trimmed);
|
|
261
270
|
if (fallback !== null)
|
|
262
271
|
return coerceUnparsedValue(fallback);
|