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.
Files changed (98) hide show
  1. package/lib/cjs/core/normalize-classname.cjs +3 -1
  2. package/lib/cjs/core/normalize-classname.cjs.map +1 -1
  3. package/lib/cjs/core/parser/border-dispatcher.cjs +20 -10
  4. package/lib/cjs/core/parser/border-dispatcher.cjs.map +1 -1
  5. package/lib/cjs/core/parser/color-properties-dispatcher.cjs +7 -5
  6. package/lib/cjs/core/parser/color-properties-dispatcher.cjs.map +1 -1
  7. package/lib/cjs/core/parser/color.cjs +194 -10
  8. package/lib/cjs/core/parser/color.cjs.map +1 -1
  9. package/lib/cjs/core/parser/color.d.ts +18 -3
  10. package/lib/cjs/core/parser/declaration.cjs +62 -4
  11. package/lib/cjs/core/parser/declaration.cjs.map +1 -1
  12. package/lib/cjs/core/parser/layout-dispatcher.cjs +32 -2
  13. package/lib/cjs/core/parser/layout-dispatcher.cjs.map +1 -1
  14. package/lib/cjs/core/parser/shorthand.cjs +10 -3
  15. package/lib/cjs/core/parser/shorthand.cjs.map +1 -1
  16. package/lib/cjs/core/parser/tokens.cjs +9 -0
  17. package/lib/cjs/core/parser/tokens.cjs.map +1 -1
  18. package/lib/cjs/core/parser/tw-parser.cjs +89 -2
  19. package/lib/cjs/core/parser/tw-parser.cjs.map +1 -1
  20. package/lib/cjs/core/parser/tw-parser.d.ts +2 -0
  21. package/lib/cjs/core/parser/typography-dispatcher.cjs +15 -8
  22. package/lib/cjs/core/parser/typography-dispatcher.cjs.map +1 -1
  23. package/lib/cjs/core/style-builder/union-builder.cjs +81 -2
  24. package/lib/cjs/core/style-builder/union-builder.cjs.map +1 -1
  25. package/lib/cjs/core/style-builder/union-builder.d.ts +28 -0
  26. package/lib/cjs/metro/state.cjs +74 -13
  27. package/lib/cjs/metro/state.cjs.map +1 -1
  28. package/lib/cjs/metro/state.d.ts +18 -0
  29. package/lib/cjs/metro/transformer.cjs +10 -4
  30. package/lib/cjs/metro/transformer.cjs.map +1 -1
  31. package/lib/cjs/metro/with-config.cjs +57 -0
  32. package/lib/cjs/metro/with-config.cjs.map +1 -1
  33. package/lib/cjs/metro/with-config.d.ts +12 -0
  34. package/lib/cjs/metro/wrap-imports.cjs +36 -1
  35. package/lib/cjs/metro/wrap-imports.cjs.map +1 -1
  36. package/lib/cjs/runtime/hooks/use-scheme.cjs +14 -7
  37. package/lib/cjs/runtime/hooks/use-scheme.cjs.map +1 -1
  38. package/lib/cjs/runtime/resolve.cjs +6 -2
  39. package/lib/cjs/runtime/resolve.cjs.map +1 -1
  40. package/lib/cjs/runtime/resolve.d.ts +5 -1
  41. package/lib/esm/core/normalize-classname.mjs +3 -1
  42. package/lib/esm/core/normalize-classname.mjs.map +1 -1
  43. package/lib/esm/core/parser/border-dispatcher.mjs +21 -11
  44. package/lib/esm/core/parser/border-dispatcher.mjs.map +1 -1
  45. package/lib/esm/core/parser/color-properties-dispatcher.mjs +8 -6
  46. package/lib/esm/core/parser/color-properties-dispatcher.mjs.map +1 -1
  47. package/lib/esm/core/parser/color.d.ts +18 -3
  48. package/lib/esm/core/parser/color.mjs +195 -12
  49. package/lib/esm/core/parser/color.mjs.map +1 -1
  50. package/lib/esm/core/parser/declaration.mjs +63 -5
  51. package/lib/esm/core/parser/declaration.mjs.map +1 -1
  52. package/lib/esm/core/parser/layout-dispatcher.mjs +32 -2
  53. package/lib/esm/core/parser/layout-dispatcher.mjs.map +1 -1
  54. package/lib/esm/core/parser/shorthand.mjs +11 -4
  55. package/lib/esm/core/parser/shorthand.mjs.map +1 -1
  56. package/lib/esm/core/parser/tokens.mjs +10 -1
  57. package/lib/esm/core/parser/tokens.mjs.map +1 -1
  58. package/lib/esm/core/parser/tw-parser.d.ts +2 -0
  59. package/lib/esm/core/parser/tw-parser.mjs +69 -0
  60. package/lib/esm/core/parser/tw-parser.mjs.map +1 -1
  61. package/lib/esm/core/parser/typography-dispatcher.mjs +15 -8
  62. package/lib/esm/core/parser/typography-dispatcher.mjs.map +1 -1
  63. package/lib/esm/core/style-builder/union-builder.d.ts +28 -0
  64. package/lib/esm/core/style-builder/union-builder.mjs +82 -3
  65. package/lib/esm/core/style-builder/union-builder.mjs.map +1 -1
  66. package/lib/esm/metro/state.d.ts +18 -0
  67. package/lib/esm/metro/state.mjs +75 -14
  68. package/lib/esm/metro/state.mjs.map +1 -1
  69. package/lib/esm/metro/transformer.mjs +10 -4
  70. package/lib/esm/metro/transformer.mjs.map +1 -1
  71. package/lib/esm/metro/with-config.d.ts +12 -0
  72. package/lib/esm/metro/with-config.mjs +58 -2
  73. package/lib/esm/metro/with-config.mjs.map +1 -1
  74. package/lib/esm/metro/wrap-imports.mjs +36 -1
  75. package/lib/esm/metro/wrap-imports.mjs.map +1 -1
  76. package/lib/esm/runtime/hooks/use-scheme.mjs +14 -7
  77. package/lib/esm/runtime/hooks/use-scheme.mjs.map +1 -1
  78. package/lib/esm/runtime/resolve.d.ts +5 -1
  79. package/lib/esm/runtime/resolve.mjs +6 -2
  80. package/lib/esm/runtime/resolve.mjs.map +1 -1
  81. package/package.json +1 -1
  82. package/src/core/normalize-classname.ts +4 -1
  83. package/src/core/parser/border-dispatcher.ts +22 -11
  84. package/src/core/parser/color-properties-dispatcher.ts +7 -5
  85. package/src/core/parser/color.ts +182 -11
  86. package/src/core/parser/declaration.ts +61 -5
  87. package/src/core/parser/layout-dispatcher.ts +34 -2
  88. package/src/core/parser/shorthand.ts +9 -3
  89. package/src/core/parser/tokens.ts +10 -1
  90. package/src/core/parser/tw-parser.ts +71 -1
  91. package/src/core/parser/typography-dispatcher.ts +15 -6
  92. package/src/core/style-builder/union-builder.ts +83 -3
  93. package/src/metro/state.ts +117 -12
  94. package/src/metro/transformer.ts +9 -4
  95. package/src/metro/with-config.ts +59 -1
  96. package/src/metro/wrap-imports.ts +36 -1
  97. package/src/runtime/hooks/use-scheme.ts +13 -6
  98. package/src/runtime/resolve.ts +6 -2
@@ -77,12 +77,16 @@ const DIRECTION_POINTS = {
77
77
  };
78
78
  /**
79
79
  * Register one scheme's pre-merged molecules (atom-merged literal
80
- * classNames). Merges onto any existing entries for the scheme.
80
+ * classNames). REPLACES the scheme's map each generated scheme file emits a
81
+ * single `registerMolecules(scheme, …)` carrying the complete molecule set
82
+ * (mirrors `registerAtoms`). Merging instead would leak molecules removed in a
83
+ * Fast Refresh edit, so a deleted/renamed className would keep resolving to its
84
+ * stale pre-edit style.
81
85
  * @param scheme Scheme name (or `'common'`).
82
86
  * @param entries Normalized className → merged style object.
83
87
  */
84
88
  function registerMolecules(scheme, entries) {
85
- molecules[scheme] = { ...molecules[scheme], ...entries };
89
+ molecules[scheme] = entries;
86
90
  registryVersion += 1;
87
91
  }
88
92
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"resolve.cjs","sources":["../../../../src/runtime/resolve.ts"],"sourcesContent":["import { breakpointTier, getStyleVersion, lookupCss, type InteractState } from './lookup-css'\nimport type { RnwindState } from './components/rnwind-provider'\nimport { normalizeClassName } from '../core/normalize-classname'\nimport type { GradientAtomInfo, GradientDirection } from '../core/parser/gradient'\nimport type { HapticRequest, HapticTrigger } from '../core/parser/haptics'\n\n/**\n * Rich className resolver — the runtime heart of the wrap / `useCss`.\n *\n * Resolution order, per className string:\n * 1. **Molecule** — a build-time PRE-MERGED single style object for the\n * whole literal className (per scheme). One map lookup returns it by\n * reference: no array, no merge, no per-atom loop. The common case.\n * 2. **Atom fallback** — for a className the scanner never saw (a\n * runtime-built string like `` `${className} px-2` ``) OR one that\n * carries context-dependent atoms (`pt-safe`, `text-base`, `md:*`),\n * fall back to per-atom resolution via `lookupCss`, which folds in\n * insets / fontScale / breakpoint / scheme.\n *\n * Results are cached by `(normalized className, scheme, insets, fontScale,\n * breakpoint)` so repeated renders return the SAME reference until the\n * reactive context changes. Atoms / molecules / features all live in\n * build-time registries the generated `.rnwind/*.js` modules populate.\n */\n\n/** Always-loaded fallback scheme key. */\nconst COMMON_SCHEME = 'common'\n\n/** Empty style sentinel. */\nconst EMPTY: readonly unknown[] = []\n\n/** scheme → normalized className → pre-merged style object. */\nlet molecules: Record<string, Record<string, unknown>> = Object.create(null)\n/** atom name → gradient role + resolved colour. */\nlet gradients: Record<string, GradientAtomInfo> = Object.create(null)\n/** atom name (incl. `active:`/`focus:` prefix) → haptic request. */\nlet haptics: Record<string, HapticRequest> = Object.create(null)\n/** Bumps on any molecule/gradient/haptic registration. */\nlet registryVersion = 0\n\n/** Per-(className·state) resolved cache — strong references between context changes. */\nconst resolvedCache = new Map<string, ResolvedCss>()\n/** Version the cache was last valid for (`getStyleVersion()` + {@link registryVersion}). */\nlet cachedFor = -1\n\n/**\n * Hard ceiling on the resolved cache. The cache is pure memoisation, so\n * eviction only costs a re-resolve (sub-µs) — never correctness. Build\n * molecules are NOT in here; they live permanently in `molecules`.\n */\nconst MAX_RESOLVED_CACHE = 2048\n\n/**\n * Store a resolved result, bulk-evicting the OLDEST half when the cache\n * hits {@link MAX_RESOLVED_CACHE}. `Map` preserves insertion order, so the\n * first keys are the oldest. Bulk eviction keeps the hot (cache-hit) path\n * free of per-access LRU bookkeeping at the cost of an occasional small\n * recompute burst under sustained pressure (web / long sessions).\n * @param key Cache key.\n * @param value Resolved result to store.\n */\nfunction cacheResolved(key: string, value: ResolvedCss): void {\n if (resolvedCache.size >= MAX_RESOLVED_CACHE) {\n let drop = resolvedCache.size >> 1\n for (const oldKey of resolvedCache.keys()) {\n resolvedCache.delete(oldKey)\n if (--drop <= 0) break\n }\n }\n resolvedCache.set(key, value)\n}\n\n/** A unit-square gradient endpoint. */\ninterface GradientPoint {\n readonly x: number\n readonly y: number\n}\n\n/** Rich resolution: the RN `style` plus any className-derived props. */\nexport interface ResolvedCss {\n /** RN `style` value — a single molecule object (by ref) or an atom array. */\n readonly style: unknown\n /** Gradient stop colours (when the className is a complete gradient). */\n readonly colors?: readonly string[]\n /** Gradient start point. */\n readonly start?: GradientPoint\n /** Gradient end point. */\n readonly end?: GradientPoint\n /** Text truncation line count. */\n readonly numberOfLines?: number\n /** Text ellipsize mode. */\n readonly ellipsizeMode?: 'tail' | 'clip'\n /** Haptic requests present on the className, for the wrap to dispatch. */\n readonly haptics?: readonly { readonly request: HapticRequest; readonly trigger: HapticTrigger }[]\n}\n\n/** `GradientDirection` → expo-linear-gradient start/end points. */\nconst DIRECTION_POINTS: Record<GradientDirection, { start: GradientPoint; end: GradientPoint }> = {\n 'to-t': { start: { x: 0.5, y: 1 }, end: { x: 0.5, y: 0 } },\n 'to-b': { start: { x: 0.5, y: 0 }, end: { x: 0.5, y: 1 } },\n 'to-l': { start: { x: 1, y: 0.5 }, end: { x: 0, y: 0.5 } },\n 'to-r': { start: { x: 0, y: 0.5 }, end: { x: 1, y: 0.5 } },\n 'to-tl': { start: { x: 1, y: 1 }, end: { x: 0, y: 0 } },\n 'to-tr': { start: { x: 0, y: 1 }, end: { x: 1, y: 0 } },\n 'to-bl': { start: { x: 1, y: 0 }, end: { x: 0, y: 1 } },\n 'to-br': { start: { x: 0, y: 0 }, end: { x: 1, y: 1 } },\n unknown: { start: { x: 0, y: 0.5 }, end: { x: 1, y: 0.5 } },\n}\n\n/**\n * Register one scheme's pre-merged molecules (atom-merged literal\n * classNames). Merges onto any existing entries for the scheme.\n * @param scheme Scheme name (or `'common'`).\n * @param entries Normalized className → merged style object.\n */\nexport function registerMolecules(scheme: string, entries: Record<string, unknown>): void {\n molecules[scheme] = { ...molecules[scheme], ...entries }\n registryVersion += 1\n}\n\n/**\n * Register the gradient atom map (atom name → role + resolved colour).\n * @param map Atom name → gradient info.\n */\nexport function registerGradients(map: Record<string, GradientAtomInfo>): void {\n gradients = map\n registryVersion += 1\n}\n\n/**\n * Register the haptic atom map (atom name → request).\n * @param map Atom name → haptic request.\n */\nexport function registerHaptics(map: Record<string, HapticRequest>): void {\n haptics = map\n registryVersion += 1\n}\n\n\n\n/**\n * Per-state-object signature memo. `RnwindState` is created fresh (via the\n * provider's `useMemo`) whenever any field changes, so its identity is a\n * sound key — a new object means a new signature. Keyed weakly so states\n * GC with their provider.\n */\nconst stateSignatureCache = new WeakMap<RnwindState, string>()\n\n/**\n * Cache key dimension for the reactive context — everything that can\n * change a resolved style. Uses the numeric breakpoint TIER (count of\n * thresholds reached) from `breakpointTier(windowWidth)`, NOT the\n * `activeBreakpoint` NAME: the name clamps tier-0 into the smallest\n * breakpoint, so widths straddling that threshold (e.g. 320 vs 700 with\n * `sm=640`) would collide on one cache key and serve a stale style. The\n * tier is exact AND bounded — two widths in the same tier gate every\n * `sm:`/`md:`/… atom identically, so they resolve the same.\n * @param state Rnwind context.\n * @returns Compact signature string.\n */\nfunction stateSignature(state: RnwindState): string {\n const { insets } = state\n return `${state.scheme}|${insets.top},${insets.right},${insets.bottom},${insets.left}|${state.fontScale}|${breakpointTier(state.windowWidth)}`\n}\n\n/**\n * Memoised {@link stateSignature} — one `WeakMap.get` on the hot path\n * instead of rebuilding the template string every resolve.\n * @param state Rnwind context.\n * @returns Cached compact signature.\n */\nfunction stateSignatureCached(state: RnwindState): string {\n let signature = stateSignatureCache.get(state)\n if (signature === undefined) {\n signature = stateSignature(state)\n stateSignatureCache.set(state, signature)\n }\n return signature\n}\n\n/**\n * Compact signature of the live interactive state for the cache key.\n * @param interactState Active/focus flags, or undefined for the plain path.\n * @returns Two-bit signature (`''` when no interactive state).\n */\nfunction interactSignature(interactState?: InteractState): string {\n if (!interactState) return ''\n const active = interactState.active ? 1 : 0\n const focus = interactState.focus ? 1 : 0\n return `${active}${focus}`\n}\n\n/**\n * Whether a token is a feature-ONLY utility (gradient stop/direction,\n * haptic request, or text-truncate) that contributes NO RN `style`. These\n * are folded in via {@link attachFeatures}, so they must be kept OUT of\n * the `lookupCss` input — otherwise the atom resolver treats them as\n * unknown style atoms and emits a spurious \"unknown class\" dev warning\n * (e.g. for `active:haptic-rigid`).\n * @param token Atom name.\n * @returns True when the token carries no style.\n */\nfunction isFeatureOnlyToken(token: string): boolean {\n return Boolean(gradients[token]) || Boolean(haptics[token]) || truncateForToken(token) !== null\n}\n\n/**\n * Lifecycle trigger for a haptic atom from its variant prefix.\n * @param token Atom name (maybe `active:`/`focus:`/`hover:` prefixed).\n * @returns The trigger.\n */\nfunction hapticTriggerForToken(token: string): HapticTrigger {\n const colon = token.indexOf(':')\n if (colon === -1) return 'mount'\n const prefix = token.slice(0, colon)\n if (prefix === 'active') return 'pressIn'\n if (prefix === 'focus') return 'focus'\n if (prefix === 'hover') return 'hover'\n return 'mount'\n}\n\n/**\n * Syntactic text-truncate directive for one atom.\n * @param token Atom name.\n * @returns Partial truncate props, or null.\n */\nfunction truncateForToken(token: string): { numberOfLines?: number; ellipsizeMode?: 'tail' | 'clip' } | null {\n if (token === 'truncate') return { numberOfLines: 1, ellipsizeMode: 'tail' }\n if (token === 'text-ellipsis') return { ellipsizeMode: 'tail' }\n if (token === 'text-clip') return { ellipsizeMode: 'clip' }\n if (token === 'line-clamp-none') return { numberOfLines: 0 }\n if (token.startsWith('line-clamp-')) {\n const count = Number(token.slice('line-clamp-'.length))\n if (Number.isInteger(count) && count >= 0) return { numberOfLines: count }\n }\n return null\n}\n\n/**\n * Assemble gradient props from gradient roles present in the atom list.\n * @param tokens Atom names.\n * @returns `{colors, start, end}` or null when not a complete gradient.\n */\nfunction assembleGradient(tokens: readonly string[]): { colors: string[]; start: GradientPoint; end: GradientPoint } | null {\n let from: string | undefined\n let via: string | undefined\n let to: string | undefined\n let dir: GradientDirection | undefined\n for (const token of tokens) {\n const info = gradients[token]\n if (!info) continue\n switch (info.role) {\n case 'from': {\n from = info.color\n break\n }\n case 'via': {\n via = info.color\n break\n }\n case 'to': {\n to = info.color\n break\n }\n default: {\n ;({ dir } = info)\n }\n }\n }\n if (dir === undefined) return null\n const colors = [from, via, to].filter((color): color is string => color !== undefined)\n if (colors.length < 2) return null\n const points = DIRECTION_POINTS[dir]\n return { colors, start: points.start, end: points.end }\n}\n\n/**\n * Fold every truncate directive across the atom list into one result —\n * last token wins per prop (matches Tailwind last-wins).\n * @param tokens Atom names.\n * @returns Merged truncate props (empty when none apply).\n */\nfunction collectTruncate(tokens: readonly string[]): { numberOfLines?: number; ellipsizeMode?: 'tail' | 'clip' } {\n const out: { numberOfLines?: number; ellipsizeMode?: 'tail' | 'clip' } = {}\n for (const token of tokens) {\n const truncate = truncateForToken(token)\n if (!truncate) continue\n if (truncate.numberOfLines !== undefined) out.numberOfLines = truncate.numberOfLines\n if (truncate.ellipsizeMode !== undefined) out.ellipsizeMode = truncate.ellipsizeMode\n }\n return out\n}\n\n/**\n * Collect every haptic request present in the atom list, tagged with the\n * lifecycle trigger its variant prefix implies.\n * @param tokens Atom names.\n * @returns Haptic request list, or undefined when none apply.\n */\nfunction collectHaptics(tokens: readonly string[]): { request: HapticRequest; trigger: HapticTrigger }[] | undefined {\n let collected: { request: HapticRequest; trigger: HapticTrigger }[] | undefined\n for (const token of tokens) {\n const request = haptics[token]\n if (!request) continue\n collected ??= []\n collected.push({ request, trigger: hapticTriggerForToken(token) })\n }\n return collected\n}\n\n/**\n * Scan tokens for the className-derived feature props (gradient,\n * truncate, haptics) and fold them onto the base result.\n * @param base Result carrying the resolved `style`.\n * @param tokens Atom names.\n * @returns The result with any feature props attached.\n */\nfunction attachFeatures(base: ResolvedCss, tokens: readonly string[]): ResolvedCss {\n const { numberOfLines, ellipsizeMode } = collectTruncate(tokens)\n const collected = collectHaptics(tokens)\n const gradient = assembleGradient(tokens)\n const result: Mutable<ResolvedCss> = { style: base.style }\n if (gradient) {\n result.colors = gradient.colors\n result.start = gradient.start\n result.end = gradient.end\n }\n // `numberOfLines: 0` is kept (RN reads it as \"unlimited\"): `line-clamp-none`\n // must be able to explicitly reset an earlier `line-clamp-N` on the same\n // element — dropping the 0 would silently leave the prior limit in place.\n if (numberOfLines !== undefined) {\n result.numberOfLines = numberOfLines\n if (ellipsizeMode !== undefined) result.ellipsizeMode = ellipsizeMode\n }\n if (collected) result.haptics = collected\n return result\n}\n\n/**\n * Flatten the per-atom style array into ONE object — a *runtime molecule*.\n * RN flattens a style array left-to-right (later wins), which is exactly\n * `Object.assign` semantics, so the merged object renders identically\n * while giving dynamic (cva / clsx) classNames the same single-object\n * shape a build-time molecule has. The caller caches the result per\n * `(className · state)`, so the merge runs once per unique context.\n * @param array Per-atom style array from `lookupCss`.\n * @returns Single merged style object.\n */\nfunction mergeStyleArray(array: readonly unknown[]): Record<string, unknown> {\n const out: Record<string, unknown> = {}\n for (const entry of array) if (entry && typeof entry === 'object') Object.assign(out, entry)\n return out\n}\n\n/**\n * Compose a resolved style with a caller-supplied inline style (user wins).\n * @param style\n * @param userStyle\n */\nfunction withUserStyle(style: unknown, userStyle: unknown): unknown {\n return Array.isArray(style) ? [...style, userStyle] : [style, userStyle]\n}\n\n/**\n * Resolve a className against the reactive context into a style plus any\n * className-derived props. Molecule-first (one lookup, by reference),\n * atom-fallback for unseen / context-dependent strings, cached per\n * `(className, state)`.\n * @param className Raw className string.\n * @param state Rnwind context from `useRnwind()`.\n * @param userStyle Optional inline style appended last (wins).\n * @param interactState Live active/focus flags (for `active:`/`focus:` atoms).\n * @returns The resolved style + feature props.\n */\nexport function resolve(\n className: string | null | undefined,\n state: RnwindState,\n userStyle?: unknown,\n interactState?: InteractState,\n): ResolvedCss {\n const version = getStyleVersion() + registryVersion\n if (version !== cachedFor) {\n resolvedCache.clear()\n cachedFor = version\n }\n if (className == null) {\n return { style: userStyle === undefined || userStyle === null ? EMPTY : [userStyle] }\n }\n // Key on the RAW className so the hot (cache-hit) path skips normalize\n // entirely — normalization only runs on a miss. The state signature is\n // memoised per state object, so the hit path is one WeakMap.get + one\n // string concat + one Map.get.\n const key = `${className}@${stateSignatureCached(state)}@${interactSignature(interactState)}`\n const cached = resolvedCache.get(key)\n if (cached !== undefined) {\n return userStyle === undefined || userStyle === null ? cached : { ...cached, style: withUserStyle(cached.style, userStyle) }\n }\n const normalized = normalizeClassName(className)\n if (normalized.length === 0) {\n const empty: ResolvedCss = { style: EMPTY }\n cacheResolved(key, empty)\n return userStyle === undefined || userStyle === null ? empty : { style: [userStyle] }\n }\n // Molecules are static pre-merges; anything carrying `active:`/`focus:`\n // is never registered as one, so the atom path handles interactive state.\n const tokens = normalized.split(' ')\n const molecule = interactState ? undefined : molecules[state.scheme]?.[normalized] ?? molecules[COMMON_SCHEME]?.[normalized]\n // Feature-only tokens (gradient / haptic / truncate) carry no style — keep\n // them out of the atom lookup so they don't warn as \"unknown class\". The\n // atom array is merged into ONE object (a runtime molecule) so dynamic\n // (cva / clsx) classNames get the same single-object shape as a build\n // molecule; the cache below pins the context, so the merge is correct.\n const style =\n molecule === undefined\n ? mergeStyleArray(lookupCss(tokens.filter((token) => !isFeatureOnlyToken(token)).join(' '), state, undefined, interactState))\n : molecule\n const base = attachFeatures({ style }, tokens)\n cacheResolved(key, base)\n return userStyle === undefined || userStyle === null ? base : { ...base, style: withUserStyle(base.style, userStyle) }\n}\n\n/** Local mutable view for building the frozen-shaped result. */\ntype Mutable<T> = { -readonly [K in keyof T]: T[K] }\n\n/** Test-only — clear the molecule / gradient / haptic registries + cache. */\nexport function __resetResolveState(): void {\n molecules = Object.create(null)\n gradients = Object.create(null)\n haptics = Object.create(null)\n resolvedCache.clear()\n registryVersion += 1\n cachedFor = -1\n}\n\n/** Test-only — current resolved-cache entry count + its hard ceiling. */\nexport function __resolveCacheStats(): { size: number; max: number } {\n return { size: resolvedCache.size, max: MAX_RESOLVED_CACHE }\n}\n\nexport {normalizeClassName} from '../core/normalize-classname'"],"names":["breakpointTier","getStyleVersion","normalizeClassName","lookupCss"],"mappings":";;;;;AAMA;;;;;;;;;;;;;;;;;AAiBG;AAEH;AACA,MAAM,aAAa,GAAG,QAAQ;AAE9B;AACA,MAAM,KAAK,GAAuB,EAAE;AAEpC;AACA,IAAI,SAAS,GAA4C,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC;AAC5E;AACA,IAAI,SAAS,GAAqC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC;AACrE;AACA,IAAI,OAAO,GAAkC,MAA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Ac,CAAC,EAAE,KAAK,EAAE,EAAE,MAAM,CAAC;AAC9C,IAAA,aAAa,CAAC,GAAG,EAAE,IAAI,CAAC;AACxB,IAAA,OAAO,SAAS,KAAK,SAAS,IAAI,SAAS,KAAK,IAAI,GAAG,IAAI,GAAG,EAAE,GAAG,IAAI,EAAE,KAAK,EAAE,aAAa,CAAC,IAAI,CAAC,KAAK,EAAE,SAAS,CAAC,EAAE;AACxH;AAKA;SACgB,mBAAmB,GAAA;AACjC,IAAA,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC;AAC/B,IAAA,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC;AAC/B,IAAA,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC;IAC7B,aAAa,CAAC,KAAK,EAAE;IACrB,eAAe,IAAI,CAAC;IACpB,SAAS,GAAG,EAAE;AAChB;;;;;;;;;"}
1
+ {"version":3,"file":"resolve.cjs","sources":["../../../../src/runtime/resolve.ts"],"sourcesContent":["import { breakpointTier, getStyleVersion, lookupCss, type InteractState } from './lookup-css'\nimport type { RnwindState } from './components/rnwind-provider'\nimport { normalizeClassName } from '../core/normalize-classname'\nimport type { GradientAtomInfo, GradientDirection } from '../core/parser/gradient'\nimport type { HapticRequest, HapticTrigger } from '../core/parser/haptics'\n\n/**\n * Rich className resolver — the runtime heart of the wrap / `useCss`.\n *\n * Resolution order, per className string:\n * 1. **Molecule** — a build-time PRE-MERGED single style object for the\n * whole literal className (per scheme). One map lookup returns it by\n * reference: no array, no merge, no per-atom loop. The common case.\n * 2. **Atom fallback** — for a className the scanner never saw (a\n * runtime-built string like `` `${className} px-2` ``) OR one that\n * carries context-dependent atoms (`pt-safe`, `text-base`, `md:*`),\n * fall back to per-atom resolution via `lookupCss`, which folds in\n * insets / fontScale / breakpoint / scheme.\n *\n * Results are cached by `(normalized className, scheme, insets, fontScale,\n * breakpoint)` so repeated renders return the SAME reference until the\n * reactive context changes. Atoms / molecules / features all live in\n * build-time registries the generated `.rnwind/*.js` modules populate.\n */\n\n/** Always-loaded fallback scheme key. */\nconst COMMON_SCHEME = 'common'\n\n/** Empty style sentinel. */\nconst EMPTY: readonly unknown[] = []\n\n/** scheme → normalized className → pre-merged style object. */\nlet molecules: Record<string, Record<string, unknown>> = Object.create(null)\n/** atom name → gradient role + resolved colour. */\nlet gradients: Record<string, GradientAtomInfo> = Object.create(null)\n/** atom name (incl. `active:`/`focus:` prefix) → haptic request. */\nlet haptics: Record<string, HapticRequest> = Object.create(null)\n/** Bumps on any molecule/gradient/haptic registration. */\nlet registryVersion = 0\n\n/** Per-(className·state) resolved cache — strong references between context changes. */\nconst resolvedCache = new Map<string, ResolvedCss>()\n/** Version the cache was last valid for (`getStyleVersion()` + {@link registryVersion}). */\nlet cachedFor = -1\n\n/**\n * Hard ceiling on the resolved cache. The cache is pure memoisation, so\n * eviction only costs a re-resolve (sub-µs) — never correctness. Build\n * molecules are NOT in here; they live permanently in `molecules`.\n */\nconst MAX_RESOLVED_CACHE = 2048\n\n/**\n * Store a resolved result, bulk-evicting the OLDEST half when the cache\n * hits {@link MAX_RESOLVED_CACHE}. `Map` preserves insertion order, so the\n * first keys are the oldest. Bulk eviction keeps the hot (cache-hit) path\n * free of per-access LRU bookkeeping at the cost of an occasional small\n * recompute burst under sustained pressure (web / long sessions).\n * @param key Cache key.\n * @param value Resolved result to store.\n */\nfunction cacheResolved(key: string, value: ResolvedCss): void {\n if (resolvedCache.size >= MAX_RESOLVED_CACHE) {\n let drop = resolvedCache.size >> 1\n for (const oldKey of resolvedCache.keys()) {\n resolvedCache.delete(oldKey)\n if (--drop <= 0) break\n }\n }\n resolvedCache.set(key, value)\n}\n\n/** A unit-square gradient endpoint. */\ninterface GradientPoint {\n readonly x: number\n readonly y: number\n}\n\n/** Rich resolution: the RN `style` plus any className-derived props. */\nexport interface ResolvedCss {\n /** RN `style` value — a single molecule object (by ref) or an atom array. */\n readonly style: unknown\n /** Gradient stop colours (when the className is a complete gradient). */\n readonly colors?: readonly string[]\n /** Gradient start point. */\n readonly start?: GradientPoint\n /** Gradient end point. */\n readonly end?: GradientPoint\n /** Text truncation line count. */\n readonly numberOfLines?: number\n /** Text ellipsize mode. */\n readonly ellipsizeMode?: 'tail' | 'clip'\n /** Haptic requests present on the className, for the wrap to dispatch. */\n readonly haptics?: readonly { readonly request: HapticRequest; readonly trigger: HapticTrigger }[]\n}\n\n/** `GradientDirection` → expo-linear-gradient start/end points. */\nconst DIRECTION_POINTS: Record<GradientDirection, { start: GradientPoint; end: GradientPoint }> = {\n 'to-t': { start: { x: 0.5, y: 1 }, end: { x: 0.5, y: 0 } },\n 'to-b': { start: { x: 0.5, y: 0 }, end: { x: 0.5, y: 1 } },\n 'to-l': { start: { x: 1, y: 0.5 }, end: { x: 0, y: 0.5 } },\n 'to-r': { start: { x: 0, y: 0.5 }, end: { x: 1, y: 0.5 } },\n 'to-tl': { start: { x: 1, y: 1 }, end: { x: 0, y: 0 } },\n 'to-tr': { start: { x: 0, y: 1 }, end: { x: 1, y: 0 } },\n 'to-bl': { start: { x: 1, y: 0 }, end: { x: 0, y: 1 } },\n 'to-br': { start: { x: 0, y: 0 }, end: { x: 1, y: 1 } },\n unknown: { start: { x: 0, y: 0.5 }, end: { x: 1, y: 0.5 } },\n}\n\n/**\n * Register one scheme's pre-merged molecules (atom-merged literal\n * classNames). REPLACES the scheme's map — each generated scheme file emits a\n * single `registerMolecules(scheme, …)` carrying the complete molecule set\n * (mirrors `registerAtoms`). Merging instead would leak molecules removed in a\n * Fast Refresh edit, so a deleted/renamed className would keep resolving to its\n * stale pre-edit style.\n * @param scheme Scheme name (or `'common'`).\n * @param entries Normalized className → merged style object.\n */\nexport function registerMolecules(scheme: string, entries: Record<string, unknown>): void {\n molecules[scheme] = entries\n registryVersion += 1\n}\n\n/**\n * Register the gradient atom map (atom name → role + resolved colour).\n * @param map Atom name → gradient info.\n */\nexport function registerGradients(map: Record<string, GradientAtomInfo>): void {\n gradients = map\n registryVersion += 1\n}\n\n/**\n * Register the haptic atom map (atom name → request).\n * @param map Atom name → haptic request.\n */\nexport function registerHaptics(map: Record<string, HapticRequest>): void {\n haptics = map\n registryVersion += 1\n}\n\n\n\n/**\n * Per-state-object signature memo. `RnwindState` is created fresh (via the\n * provider's `useMemo`) whenever any field changes, so its identity is a\n * sound key — a new object means a new signature. Keyed weakly so states\n * GC with their provider.\n */\nconst stateSignatureCache = new WeakMap<RnwindState, string>()\n\n/**\n * Cache key dimension for the reactive context — everything that can\n * change a resolved style. Uses the numeric breakpoint TIER (count of\n * thresholds reached) from `breakpointTier(windowWidth)`, NOT the\n * `activeBreakpoint` NAME: the name clamps tier-0 into the smallest\n * breakpoint, so widths straddling that threshold (e.g. 320 vs 700 with\n * `sm=640`) would collide on one cache key and serve a stale style. The\n * tier is exact AND bounded — two widths in the same tier gate every\n * `sm:`/`md:`/… atom identically, so they resolve the same.\n * @param state Rnwind context.\n * @returns Compact signature string.\n */\nfunction stateSignature(state: RnwindState): string {\n const { insets } = state\n return `${state.scheme}|${insets.top},${insets.right},${insets.bottom},${insets.left}|${state.fontScale}|${breakpointTier(state.windowWidth)}`\n}\n\n/**\n * Memoised {@link stateSignature} — one `WeakMap.get` on the hot path\n * instead of rebuilding the template string every resolve.\n * @param state Rnwind context.\n * @returns Cached compact signature.\n */\nfunction stateSignatureCached(state: RnwindState): string {\n let signature = stateSignatureCache.get(state)\n if (signature === undefined) {\n signature = stateSignature(state)\n stateSignatureCache.set(state, signature)\n }\n return signature\n}\n\n/**\n * Compact signature of the live interactive state for the cache key.\n * @param interactState Active/focus flags, or undefined for the plain path.\n * @returns Two-bit signature (`''` when no interactive state).\n */\nfunction interactSignature(interactState?: InteractState): string {\n if (!interactState) return ''\n const active = interactState.active ? 1 : 0\n const focus = interactState.focus ? 1 : 0\n return `${active}${focus}`\n}\n\n/**\n * Whether a token is a feature-ONLY utility (gradient stop/direction,\n * haptic request, or text-truncate) that contributes NO RN `style`. These\n * are folded in via {@link attachFeatures}, so they must be kept OUT of\n * the `lookupCss` input — otherwise the atom resolver treats them as\n * unknown style atoms and emits a spurious \"unknown class\" dev warning\n * (e.g. for `active:haptic-rigid`).\n * @param token Atom name.\n * @returns True when the token carries no style.\n */\nfunction isFeatureOnlyToken(token: string): boolean {\n return Boolean(gradients[token]) || Boolean(haptics[token]) || truncateForToken(token) !== null\n}\n\n/**\n * Lifecycle trigger for a haptic atom from its variant prefix.\n * @param token Atom name (maybe `active:`/`focus:`/`hover:` prefixed).\n * @returns The trigger.\n */\nfunction hapticTriggerForToken(token: string): HapticTrigger {\n const colon = token.indexOf(':')\n if (colon === -1) return 'mount'\n const prefix = token.slice(0, colon)\n if (prefix === 'active') return 'pressIn'\n if (prefix === 'focus') return 'focus'\n if (prefix === 'hover') return 'hover'\n return 'mount'\n}\n\n/**\n * Syntactic text-truncate directive for one atom.\n * @param token Atom name.\n * @returns Partial truncate props, or null.\n */\nfunction truncateForToken(token: string): { numberOfLines?: number; ellipsizeMode?: 'tail' | 'clip' } | null {\n if (token === 'truncate') return { numberOfLines: 1, ellipsizeMode: 'tail' }\n if (token === 'text-ellipsis') return { ellipsizeMode: 'tail' }\n if (token === 'text-clip') return { ellipsizeMode: 'clip' }\n if (token === 'line-clamp-none') return { numberOfLines: 0 }\n if (token.startsWith('line-clamp-')) {\n const count = Number(token.slice('line-clamp-'.length))\n if (Number.isInteger(count) && count >= 0) return { numberOfLines: count }\n }\n return null\n}\n\n/**\n * Assemble gradient props from gradient roles present in the atom list.\n * @param tokens Atom names.\n * @returns `{colors, start, end}` or null when not a complete gradient.\n */\nfunction assembleGradient(tokens: readonly string[]): { colors: string[]; start: GradientPoint; end: GradientPoint } | null {\n let from: string | undefined\n let via: string | undefined\n let to: string | undefined\n let dir: GradientDirection | undefined\n for (const token of tokens) {\n const info = gradients[token]\n if (!info) continue\n switch (info.role) {\n case 'from': {\n from = info.color\n break\n }\n case 'via': {\n via = info.color\n break\n }\n case 'to': {\n to = info.color\n break\n }\n default: {\n ;({ dir } = info)\n }\n }\n }\n if (dir === undefined) return null\n const colors = [from, via, to].filter((color): color is string => color !== undefined)\n if (colors.length < 2) return null\n const points = DIRECTION_POINTS[dir]\n return { colors, start: points.start, end: points.end }\n}\n\n/**\n * Fold every truncate directive across the atom list into one result —\n * last token wins per prop (matches Tailwind last-wins).\n * @param tokens Atom names.\n * @returns Merged truncate props (empty when none apply).\n */\nfunction collectTruncate(tokens: readonly string[]): { numberOfLines?: number; ellipsizeMode?: 'tail' | 'clip' } {\n const out: { numberOfLines?: number; ellipsizeMode?: 'tail' | 'clip' } = {}\n for (const token of tokens) {\n const truncate = truncateForToken(token)\n if (!truncate) continue\n if (truncate.numberOfLines !== undefined) out.numberOfLines = truncate.numberOfLines\n if (truncate.ellipsizeMode !== undefined) out.ellipsizeMode = truncate.ellipsizeMode\n }\n return out\n}\n\n/**\n * Collect every haptic request present in the atom list, tagged with the\n * lifecycle trigger its variant prefix implies.\n * @param tokens Atom names.\n * @returns Haptic request list, or undefined when none apply.\n */\nfunction collectHaptics(tokens: readonly string[]): { request: HapticRequest; trigger: HapticTrigger }[] | undefined {\n let collected: { request: HapticRequest; trigger: HapticTrigger }[] | undefined\n for (const token of tokens) {\n const request = haptics[token]\n if (!request) continue\n collected ??= []\n collected.push({ request, trigger: hapticTriggerForToken(token) })\n }\n return collected\n}\n\n/**\n * Scan tokens for the className-derived feature props (gradient,\n * truncate, haptics) and fold them onto the base result.\n * @param base Result carrying the resolved `style`.\n * @param tokens Atom names.\n * @returns The result with any feature props attached.\n */\nfunction attachFeatures(base: ResolvedCss, tokens: readonly string[]): ResolvedCss {\n const { numberOfLines, ellipsizeMode } = collectTruncate(tokens)\n const collected = collectHaptics(tokens)\n const gradient = assembleGradient(tokens)\n const result: Mutable<ResolvedCss> = { style: base.style }\n if (gradient) {\n result.colors = gradient.colors\n result.start = gradient.start\n result.end = gradient.end\n }\n // `numberOfLines: 0` is kept (RN reads it as \"unlimited\"): `line-clamp-none`\n // must be able to explicitly reset an earlier `line-clamp-N` on the same\n // element — dropping the 0 would silently leave the prior limit in place.\n if (numberOfLines !== undefined) {\n result.numberOfLines = numberOfLines\n if (ellipsizeMode !== undefined) result.ellipsizeMode = ellipsizeMode\n }\n if (collected) result.haptics = collected\n return result\n}\n\n/**\n * Flatten the per-atom style array into ONE object — a *runtime molecule*.\n * RN flattens a style array left-to-right (later wins), which is exactly\n * `Object.assign` semantics, so the merged object renders identically\n * while giving dynamic (cva / clsx) classNames the same single-object\n * shape a build-time molecule has. The caller caches the result per\n * `(className · state)`, so the merge runs once per unique context.\n * @param array Per-atom style array from `lookupCss`.\n * @returns Single merged style object.\n */\nfunction mergeStyleArray(array: readonly unknown[]): Record<string, unknown> {\n const out: Record<string, unknown> = {}\n for (const entry of array) if (entry && typeof entry === 'object') Object.assign(out, entry)\n return out\n}\n\n/**\n * Compose a resolved style with a caller-supplied inline style (user wins).\n * @param style\n * @param userStyle\n */\nfunction withUserStyle(style: unknown, userStyle: unknown): unknown {\n return Array.isArray(style) ? [...style, userStyle] : [style, userStyle]\n}\n\n/**\n * Resolve a className against the reactive context into a style plus any\n * className-derived props. Molecule-first (one lookup, by reference),\n * atom-fallback for unseen / context-dependent strings, cached per\n * `(className, state)`.\n * @param className Raw className string.\n * @param state Rnwind context from `useRnwind()`.\n * @param userStyle Optional inline style appended last (wins).\n * @param interactState Live active/focus flags (for `active:`/`focus:` atoms).\n * @returns The resolved style + feature props.\n */\nexport function resolve(\n className: string | null | undefined,\n state: RnwindState,\n userStyle?: unknown,\n interactState?: InteractState,\n): ResolvedCss {\n const version = getStyleVersion() + registryVersion\n if (version !== cachedFor) {\n resolvedCache.clear()\n cachedFor = version\n }\n if (className == null) {\n return { style: userStyle === undefined || userStyle === null ? EMPTY : [userStyle] }\n }\n // Key on the RAW className so the hot (cache-hit) path skips normalize\n // entirely — normalization only runs on a miss. The state signature is\n // memoised per state object, so the hit path is one WeakMap.get + one\n // string concat + one Map.get.\n const key = `${className}@${stateSignatureCached(state)}@${interactSignature(interactState)}`\n const cached = resolvedCache.get(key)\n if (cached !== undefined) {\n return userStyle === undefined || userStyle === null ? cached : { ...cached, style: withUserStyle(cached.style, userStyle) }\n }\n const normalized = normalizeClassName(className)\n if (normalized.length === 0) {\n const empty: ResolvedCss = { style: EMPTY }\n cacheResolved(key, empty)\n return userStyle === undefined || userStyle === null ? empty : { style: [userStyle] }\n }\n // Molecules are static pre-merges; anything carrying `active:`/`focus:`\n // is never registered as one, so the atom path handles interactive state.\n const tokens = normalized.split(' ')\n const molecule = interactState ? undefined : molecules[state.scheme]?.[normalized] ?? molecules[COMMON_SCHEME]?.[normalized]\n // Feature-only tokens (gradient / haptic / truncate) carry no style — keep\n // them out of the atom lookup so they don't warn as \"unknown class\". The\n // atom array is merged into ONE object (a runtime molecule) so dynamic\n // (cva / clsx) classNames get the same single-object shape as a build\n // molecule; the cache below pins the context, so the merge is correct.\n const style =\n molecule === undefined\n ? mergeStyleArray(lookupCss(tokens.filter((token) => !isFeatureOnlyToken(token)).join(' '), state, undefined, interactState))\n : molecule\n const base = attachFeatures({ style }, tokens)\n cacheResolved(key, base)\n return userStyle === undefined || userStyle === null ? base : { ...base, style: withUserStyle(base.style, userStyle) }\n}\n\n/** Local mutable view for building the frozen-shaped result. */\ntype Mutable<T> = { -readonly [K in keyof T]: T[K] }\n\n/** Test-only — clear the molecule / gradient / haptic registries + cache. */\nexport function __resetResolveState(): void {\n molecules = Object.create(null)\n gradients = Object.create(null)\n haptics = Object.create(null)\n resolvedCache.clear()\n registryVersion += 1\n cachedFor = -1\n}\n\n/** Test-only — current resolved-cache entry count + its hard ceiling. */\nexport function __resolveCacheStats(): { size: number; max: number } {\n return { size: resolvedCache.size, max: MAX_RESOLVED_CACHE }\n}\n\nexport {normalizeClassName} from '../core/normalize-classname'"],"names":["breakpointTier","getStyleVersion","normalizeClassName","lookupCss"],"mappings":";;;;;AAMA;;;;;;;;;;;;;;;;;AAiBG;AAEH;AACA,MAAM,aAAa,GAAG,QAA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AK,KAAK,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,aAAa,CAAC;UAC1H,QAAQ;IACd,MAAM,IAAI,GAAG,cAAc,CAAC,EAAE,KAAK,EAAE,EAAE,MAAM,CAAC;AAC9C,IAAA,aAAa,CAAC,GAAG,EAAE,IAAI,CAAC;AACxB,IAAA,OAAO,SAAS,KAAK,SAAS,IAAI,SAAS,KAAK,IAAI,GAAG,IAAI,GAAG,EAAE,GAAG,IAAI,EAAE,KAAK,EAAE,aAAa,CAAC,IAAI,CAAC,KAAK,EAAE,SAAS,CAAC,EAAE;AACxH;AAKA;SACgB,mBAAmB,GAAA;AACjC,IAAA,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC;AAC/B,IAAA,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC;AAC/B,IAAA,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC;IAC7B,aAAa,CAAC,KAAK,EAAE;IACrB,eAAe,IAAI,CAAC;IACpB,SAAS,GAAG,EAAE;AAChB;;;;;;;;;"}
@@ -29,7 +29,11 @@ export interface ResolvedCss {
29
29
  }
30
30
  /**
31
31
  * Register one scheme's pre-merged molecules (atom-merged literal
32
- * classNames). Merges onto any existing entries for the scheme.
32
+ * classNames). REPLACES the scheme's map each generated scheme file emits a
33
+ * single `registerMolecules(scheme, …)` carrying the complete molecule set
34
+ * (mirrors `registerAtoms`). Merging instead would leak molecules removed in a
35
+ * Fast Refresh edit, so a deleted/renamed className would keep resolving to its
36
+ * stale pre-edit style.
33
37
  * @param scheme Scheme name (or `'common'`).
34
38
  * @param entries Normalized className → merged style object.
35
39
  */
@@ -1,3 +1,5 @@
1
+ /** Whitespace run splitter — hoisted so the runtime hot path doesn't recreate it per call. */
2
+ const WHITESPACE = /\s+/;
1
3
  /**
2
4
  * Normalize a className for molecule keying: trim, collapse runs of
3
5
  * whitespace, and drop exact-duplicate tokens — but PRESERVE ORDER.
@@ -10,7 +12,7 @@
10
12
  function normalizeClassName(className) {
11
13
  const seen = new Set();
12
14
  const out = [];
13
- for (const token of className.trim().split(/\s+/)) {
15
+ for (const token of className.trim().split(WHITESPACE)) {
14
16
  if (token.length === 0 || seen.has(token))
15
17
  continue;
16
18
  seen.add(token);
@@ -1 +1 @@
1
- {"version":3,"file":"normalize-classname.mjs","sources":["../../../../src/core/normalize-classname.ts"],"sourcesContent":["/**\n * Normalize a className for molecule keying: trim, collapse runs of\n * whitespace, and drop exact-duplicate tokens — but PRESERVE ORDER.\n * Tailwind is last-wins for conflicting utilities (`p-4 p-2` ≠ `p-2 p-4`),\n * so sorting would corrupt the merge. Build-time (molecule keys) and\n * runtime (lookup) call the identical function so their keys always match.\n * @param className Raw className string.\n * @returns Normalized, order-preserving className.\n */\nexport function normalizeClassName(className: string): string {\n const seen = new Set<string>()\n const out: string[] = []\n for (const token of className.trim().split(/\\s+/)) {\n if (token.length === 0 || seen.has(token)) continue\n seen.add(token)\n out.push(token)\n }\n return out.join(' ')\n}\n"],"names":[],"mappings":"AAAA;;;;;;;;AAQG;AACG,SAAU,kBAAkB,CAAC,SAAiB,EAAA;AAClD,IAAA,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU;IAC9B,MAAM,GAAG,GAAa,EAAE;AACxB,IAAA,KAAK,MAAM,KAAK,IAAI,SAAS,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE;QACjD,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,IAAI,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC;YAAE;AAC3C,QAAA,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC;AACf,QAAA,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC;IACjB;AACA,IAAA,OAAO,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC;AACtB;;;;"}
1
+ {"version":3,"file":"normalize-classname.mjs","sources":["../../../../src/core/normalize-classname.ts"],"sourcesContent":["/** Whitespace run splitter — hoisted so the runtime hot path doesn't recreate it per call. */\nconst WHITESPACE = /\\s+/\n\n/**\n * Normalize a className for molecule keying: trim, collapse runs of\n * whitespace, and drop exact-duplicate tokens — but PRESERVE ORDER.\n * Tailwind is last-wins for conflicting utilities (`p-4 p-2` ≠ `p-2 p-4`),\n * so sorting would corrupt the merge. Build-time (molecule keys) and\n * runtime (lookup) call the identical function so their keys always match.\n * @param className Raw className string.\n * @returns Normalized, order-preserving className.\n */\nexport function normalizeClassName(className: string): string {\n const seen = new Set<string>()\n const out: string[] = []\n for (const token of className.trim().split(WHITESPACE)) {\n if (token.length === 0 || seen.has(token)) continue\n seen.add(token)\n out.push(token)\n }\n return out.join(' ')\n}\n"],"names":[],"mappings":"AAAA;AACA,MAAM,UAAU,GAAG,KAAK;AAExB;;;;;;;;AAQG;AACG,SAAU,kBAAkB,CAAC,SAAiB,EAAA;AAClD,IAAA,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU;IAC9B,MAAM,GAAG,GAAa,EAAE;AACxB,IAAA,KAAK,MAAM,KAAK,IAAI,SAAS,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,EAAE;QACtD,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,IAAI,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC;YAAE;AAC3C,QAAA,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC;AACf,QAAA,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC;IACjB;AACA,IAAA,OAAO,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC;AACtB;;;;"}
@@ -1,19 +1,29 @@
1
1
  import { kebabToCamel } from './case-convert.mjs';
2
- import { cssColorToString } from './color.mjs';
2
+ import { cssColorToString, isCssWideColorKeyword } from './color.mjs';
3
3
 
4
4
  /**
5
- * Build an inline-color pair from a `{start, end}`-shaped value.
5
+ * Build a single border-side color entry, dropping CSS-wide cascade keywords
6
+ * (`currentColor`, `inherit`, …) — RN has no color cascade, so the keyword
7
+ * would reach the native view manager as an invalid color.
8
+ * @param key RN side key (e.g. `borderLeftColor`).
9
+ * @param value Typed `CssColor` value.
10
+ * @returns One RN entry, or empty when the value is a cascade keyword.
11
+ */
12
+ function colorSide(key, value) {
13
+ const color = cssColorToString(value);
14
+ return isCssWideColorKeyword(color) ? [] : [[key, color]];
15
+ }
16
+ /**
17
+ * Build an inline-color pair from a `{start, end}`-shaped value. Each side
18
+ * drops independently when it resolves to a CSS-wide cascade keyword.
6
19
  * @param leftKey RN key for the start side.
7
20
  * @param rightKey RN key for the end side.
8
21
  * @param value Typed `{start, end}` color value.
9
- * @returns Two RN entries.
22
+ * @returns Up to two RN entries (cascade-keyword sides omitted).
10
23
  */
11
24
  function colorPair(leftKey, rightKey, value) {
12
25
  const tagged = value;
13
- return [
14
- [leftKey, cssColorToString(tagged.start)],
15
- [rightKey, cssColorToString(tagged.end)],
16
- ];
26
+ return [...colorSide(leftKey, tagged.start), ...colorSide(rightKey, tagged.end)];
17
27
  }
18
28
  /**
19
29
  * Coerce a border-width-shaped length to a pixel number. Drops
@@ -111,16 +121,16 @@ function dispatchBorderDeclaration(decl) {
111
121
  return colorPair('borderTopColor', 'borderBottomColor', decl.value);
112
122
  }
113
123
  case 'border-inline-start-color': {
114
- return [['borderLeftColor', cssColorToString(decl.value)]];
124
+ return colorSide('borderLeftColor', decl.value);
115
125
  }
116
126
  case 'border-inline-end-color': {
117
- return [['borderRightColor', cssColorToString(decl.value)]];
127
+ return colorSide('borderRightColor', decl.value);
118
128
  }
119
129
  case 'border-block-start-color': {
120
- return [['borderTopColor', cssColorToString(decl.value)]];
130
+ return colorSide('borderTopColor', decl.value);
121
131
  }
122
132
  case 'border-block-end-color': {
123
- return [['borderBottomColor', cssColorToString(decl.value)]];
133
+ return colorSide('borderBottomColor', decl.value);
124
134
  }
125
135
  case 'border-width': {
126
136
  return borderWidthShorthand(decl.value);
@@ -1 +1 @@
1
- {"version":3,"file":"border-dispatcher.mjs","sources":["../../../../../src/core/parser/border-dispatcher.ts"],"sourcesContent":["import type { Declaration as LcDeclaration } from 'lightningcss'\nimport { kebabToCamel } from './case-convert'\nimport { cssColorToString } from './color'\nimport type { RNEntry } from './types'\n\n/**\n * Build an inline-color pair from a `{start, end}`-shaped value.\n * @param leftKey RN key for the start side.\n * @param rightKey RN key for the end side.\n * @param value Typed `{start, end}` color value.\n * @returns Two RN entries.\n */\nfunction colorPair(leftKey: string, rightKey: string, value: unknown): readonly RNEntry[] {\n const tagged = value as { start?: unknown; end?: unknown }\n return [\n [leftKey, cssColorToString(tagged.start as never)],\n [rightKey, cssColorToString(tagged.end as never)],\n ]\n}\n\n/**\n * Coerce a border-width-shaped length to a pixel number. Drops\n * percentages — RN borders don't accept them.\n * @param value Typed length value (`{type: 'length', value: {unit, value}}`).\n * @returns Pixel number, or null when unrepresentable.\n */\nfunction lengthToPxValue(value: unknown): number | null {\n if (typeof value !== 'object' || value === null) return null\n const tagged = value as {\n type?: string\n value?: { type?: string; value?: { unit?: string; value?: number } } | { unit?: string; value?: number }\n }\n const inner =\n tagged.type === 'length'\n ? (tagged.value as { type?: string; value?: { unit?: string; value?: number } })?.value\n : tagged.value\n if (!inner || typeof (inner as { value?: number }).value !== 'number') return null\n const dim = inner as { unit?: string; value: number }\n if (dim.unit === 'px') return dim.value\n if (dim.unit === 'rem' || dim.unit === 'em') return dim.value * 16\n return dim.value\n}\n\n/**\n * Build an inline-width pair from a `{start, end}`-shaped value.\n * @param leftKey RN key for the start side.\n * @param rightKey RN key for the end side.\n * @param value Typed `{start, end}` length value.\n * @returns Two RN entries, or empty when either side is unrepresentable.\n */\nfunction widthPair(leftKey: string, rightKey: string, value: unknown): readonly RNEntry[] {\n const tagged = value as { start?: unknown; end?: unknown }\n const start = lengthToPxValue(tagged.start)\n const end = lengthToPxValue(tagged.end)\n if (start === null || end === null) return []\n return [\n [leftKey, start],\n [rightKey, end],\n ]\n}\n\n/**\n * Expand a `border-width` shorthand to RN longhands. Collapses to the\n * `borderWidth` shorthand when all four sides match.\n * @param value Typed border-width value with `{top, right, bottom, left}`.\n * @returns RN entries.\n */\nfunction borderWidthShorthand(value: unknown): readonly RNEntry[] {\n const tagged = value as { top?: unknown; right?: unknown; bottom?: unknown; left?: unknown }\n const top = lengthToPxValue(tagged.top)\n const right = lengthToPxValue(tagged.right)\n const bottom = lengthToPxValue(tagged.bottom)\n const left = lengthToPxValue(tagged.left)\n if (top === null || right === null || bottom === null || left === null) return []\n if (top === right && right === bottom && bottom === left) return [['borderWidth', top]]\n return [\n ['borderTopWidth', top],\n ['borderRightWidth', right],\n ['borderBottomWidth', bottom],\n ['borderLeftWidth', left],\n ]\n}\n\n/**\n * Map CSS `border-style` keywords to the strings RN accepts. RN\n * supports only `solid` / `dashed` / `dotted` / `none` — fall back to\n * `solid` for everything else.\n * @param css CSS border-style keyword.\n * @returns RN border-style.\n */\nfunction mapBorderStyle(css: string): string {\n if (css === 'dashed' || css === 'dotted' || css === 'none') return css\n return 'solid'\n}\n\n/**\n * Dispatch border-* longhands and their logical-direction variants to\n * RN style entries. Returns `null` for any property the dispatcher\n * doesn't handle so the caller can fall through.\n *\n * Logical-direction inputs (`border-inline-*`, `border-block-*`,\n * `border-inline-start-*`, …) lower to RN's physical pairs\n * (`borderLeft*` / `borderRight*` / `borderTop*` / `borderBottom*`)\n * since RN doesn't honor logical directions at the style level.\n * @param decl One lightningcss declaration.\n * @returns RN entries when the property matched, else `null`.\n */\nexport function dispatchBorderDeclaration(decl: LcDeclaration): readonly RNEntry[] | null {\n switch (decl.property) {\n case 'border-inline-color': {\n return colorPair('borderLeftColor', 'borderRightColor', decl.value)\n }\n case 'border-block-color': {\n return colorPair('borderTopColor', 'borderBottomColor', decl.value)\n }\n case 'border-inline-start-color': {\n return [['borderLeftColor', cssColorToString(decl.value)]]\n }\n case 'border-inline-end-color': {\n return [['borderRightColor', cssColorToString(decl.value)]]\n }\n case 'border-block-start-color': {\n return [['borderTopColor', cssColorToString(decl.value)]]\n }\n case 'border-block-end-color': {\n return [['borderBottomColor', cssColorToString(decl.value)]]\n }\n case 'border-width': {\n return borderWidthShorthand(decl.value)\n }\n case 'border-top-width':\n case 'border-right-width':\n case 'border-bottom-width':\n case 'border-left-width': {\n const v = lengthToPxValue(decl.value)\n return v === null ? [] : [[kebabToCamel(decl.property), v]]\n }\n case 'border-inline-width': {\n return widthPair('borderLeftWidth', 'borderRightWidth', decl.value)\n }\n case 'border-block-width': {\n return widthPair('borderTopWidth', 'borderBottomWidth', decl.value)\n }\n case 'border-inline-start-width': {\n const v = lengthToPxValue(decl.value)\n return v === null ? [] : [['borderLeftWidth', v]]\n }\n case 'border-inline-end-width': {\n const v = lengthToPxValue(decl.value)\n return v === null ? [] : [['borderRightWidth', v]]\n }\n case 'border-block-start-width': {\n const v = lengthToPxValue(decl.value)\n return v === null ? [] : [['borderTopWidth', v]]\n }\n case 'border-block-end-width': {\n const v = lengthToPxValue(decl.value)\n return v === null ? [] : [['borderBottomWidth', v]]\n }\n case 'border-style': {\n const styleValue = (decl.value as { top?: string }).top\n if (typeof styleValue !== 'string') return []\n return [['borderStyle', mapBorderStyle(styleValue)]]\n }\n case 'border-top-style':\n case 'border-right-style':\n case 'border-bottom-style':\n case 'border-left-style': {\n if (typeof decl.value !== 'string') return []\n return [['borderStyle', mapBorderStyle(decl.value)]]\n }\n default: {\n return null\n }\n }\n}\n"],"names":[],"mappings":";;;AAKA;;;;;;AAMG;AACH,SAAS,SAAS,CAAC,OAAe,EAAE,QAAgB,EAAE,KAAc,EAAA;IAClE,MAAM,MAAM,GAAG,KAA2C;IAC1D,OAAO;QACL,CAAC,OAAO,EAAE,gBAAgB,CAAC,MAAM,CAAC,KAAc,CAAC,CAAC;QAClD,CAAC,QAAQ,EAAE,gBAAgB,CAAC,MAAM,CAAC,GAAY,CAAC,CAAC;KAClD;AACH;AAEA;;;;;AAKG;AACH,SAAS,eAAe,CAAC,KAAc,EAAA;AACrC,I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YAAA,OAAO,CAAC,KAAK,IAAI,GAAG,EAAE,GAAG,CAAC,CAAC,kBAAkB,EAAE,CAAC,CAAC,CAAC;QACpD;QACA,KAAK,0BAA0B,EAAE;YAC/B,MAAM,CAAC,GAAG,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC;AACrC,YAAA,OAAO,CAAC,KAAK,IAAI,GAAG,EAAE,GAAG,CAAC,CAAC,gBAAgB,EAAE,CAAC,CAAC,CAAC;QAClD;QACA,KAAK,wBAAwB,EAAE;YAC7B,MAAM,CAAC,GAAG,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC;AACrC,YAAA,OAAO,CAAC,KAAK,IAAI,GAAG,EAAE,GAAG,CAAC,CAAC,mBAAmB,EAAE,CAAC,CAAC,CAAC;QACrD;QACA,KAAK,cAAc,EAAE;AACnB,YAAA,MAAM,UAAU,GAAI,IAAI,CAAC,KAA0B,CAAC,GAAG;YACvD,IAAI,OAAO,UAAU,KAAK,QAAQ;AAAE,gBAAA,OAAO,EAAE;YAC7C,OAAO,CAAC,CAAC,aAAa,EAAE,cAAc,CAAC,UAAU,CAAC,CAAC,CAAC;QACtD;AACA,QAAA,KAAK,kBAAkB;AACvB,QAAA,KAAK,oBAAoB;AACzB,QAAA,KAAK,qBAAqB;QAC1B,KAAK,mBAAmB,EAAE;AACxB,YAAA,IAAI,OAAO,IAAI,CAAC,KAAK,KAAK,QAAQ;AAAE,gBAAA,OAAO,EAAE;AAC7C,YAAA,OAAO,CAAC,CAAC,aAAa,EAAE,cAAc,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;QACtD;QACA,SAAS;AACP,YAAA,OAAO,IAAI;QACb;;AAEJ;;;;"}
1
+ {"version":3,"file":"border-dispatcher.mjs","sources":["../../../../../src/core/parser/border-dispatcher.ts"],"sourcesContent":["import type { Declaration as LcDeclaration } from 'lightningcss'\nimport { kebabToCamel } from './case-convert'\nimport { cssColorToString, isCssWideColorKeyword } from './color'\nimport type { RNEntry } from './types'\n\n/**\n * Build a single border-side color entry, dropping CSS-wide cascade keywords\n * (`currentColor`, `inherit`, …) — RN has no color cascade, so the keyword\n * would reach the native view manager as an invalid color.\n * @param key RN side key (e.g. `borderLeftColor`).\n * @param value Typed `CssColor` value.\n * @returns One RN entry, or empty when the value is a cascade keyword.\n */\nfunction colorSide(key: string, value: unknown): readonly RNEntry[] {\n const color = cssColorToString(value as never)\n return isCssWideColorKeyword(color) ? [] : [[key, color]]\n}\n\n/**\n * Build an inline-color pair from a `{start, end}`-shaped value. Each side\n * drops independently when it resolves to a CSS-wide cascade keyword.\n * @param leftKey RN key for the start side.\n * @param rightKey RN key for the end side.\n * @param value Typed `{start, end}` color value.\n * @returns Up to two RN entries (cascade-keyword sides omitted).\n */\nfunction colorPair(leftKey: string, rightKey: string, value: unknown): readonly RNEntry[] {\n const tagged = value as { start?: unknown; end?: unknown }\n return [...colorSide(leftKey, tagged.start), ...colorSide(rightKey, tagged.end)]\n}\n\n/**\n * Coerce a border-width-shaped length to a pixel number. Drops\n * percentages — RN borders don't accept them.\n * @param value Typed length value (`{type: 'length', value: {unit, value}}`).\n * @returns Pixel number, or null when unrepresentable.\n */\nfunction lengthToPxValue(value: unknown): number | null {\n if (typeof value !== 'object' || value === null) return null\n const tagged = value as {\n type?: string\n value?: { type?: string; value?: { unit?: string; value?: number } } | { unit?: string; value?: number }\n }\n const inner =\n tagged.type === 'length'\n ? (tagged.value as { type?: string; value?: { unit?: string; value?: number } })?.value\n : tagged.value\n if (!inner || typeof (inner as { value?: number }).value !== 'number') return null\n const dim = inner as { unit?: string; value: number }\n if (dim.unit === 'px') return dim.value\n if (dim.unit === 'rem' || dim.unit === 'em') return dim.value * 16\n return dim.value\n}\n\n/**\n * Build an inline-width pair from a `{start, end}`-shaped value.\n * @param leftKey RN key for the start side.\n * @param rightKey RN key for the end side.\n * @param value Typed `{start, end}` length value.\n * @returns Two RN entries, or empty when either side is unrepresentable.\n */\nfunction widthPair(leftKey: string, rightKey: string, value: unknown): readonly RNEntry[] {\n const tagged = value as { start?: unknown; end?: unknown }\n const start = lengthToPxValue(tagged.start)\n const end = lengthToPxValue(tagged.end)\n if (start === null || end === null) return []\n return [\n [leftKey, start],\n [rightKey, end],\n ]\n}\n\n/**\n * Expand a `border-width` shorthand to RN longhands. Collapses to the\n * `borderWidth` shorthand when all four sides match.\n * @param value Typed border-width value with `{top, right, bottom, left}`.\n * @returns RN entries.\n */\nfunction borderWidthShorthand(value: unknown): readonly RNEntry[] {\n const tagged = value as { top?: unknown; right?: unknown; bottom?: unknown; left?: unknown }\n const top = lengthToPxValue(tagged.top)\n const right = lengthToPxValue(tagged.right)\n const bottom = lengthToPxValue(tagged.bottom)\n const left = lengthToPxValue(tagged.left)\n if (top === null || right === null || bottom === null || left === null) return []\n if (top === right && right === bottom && bottom === left) return [['borderWidth', top]]\n return [\n ['borderTopWidth', top],\n ['borderRightWidth', right],\n ['borderBottomWidth', bottom],\n ['borderLeftWidth', left],\n ]\n}\n\n/**\n * Map CSS `border-style` keywords to the strings RN accepts. RN\n * supports only `solid` / `dashed` / `dotted` / `none` — fall back to\n * `solid` for everything else.\n * @param css CSS border-style keyword.\n * @returns RN border-style.\n */\nfunction mapBorderStyle(css: string): string {\n if (css === 'dashed' || css === 'dotted' || css === 'none') return css\n return 'solid'\n}\n\n/**\n * Dispatch border-* longhands and their logical-direction variants to\n * RN style entries. Returns `null` for any property the dispatcher\n * doesn't handle so the caller can fall through.\n *\n * Logical-direction inputs (`border-inline-*`, `border-block-*`,\n * `border-inline-start-*`, …) lower to RN's physical pairs\n * (`borderLeft*` / `borderRight*` / `borderTop*` / `borderBottom*`)\n * since RN doesn't honor logical directions at the style level.\n * @param decl One lightningcss declaration.\n * @returns RN entries when the property matched, else `null`.\n */\nexport function dispatchBorderDeclaration(decl: LcDeclaration): readonly RNEntry[] | null {\n switch (decl.property) {\n case 'border-inline-color': {\n return colorPair('borderLeftColor', 'borderRightColor', decl.value)\n }\n case 'border-block-color': {\n return colorPair('borderTopColor', 'borderBottomColor', decl.value)\n }\n case 'border-inline-start-color': {\n return colorSide('borderLeftColor', decl.value)\n }\n case 'border-inline-end-color': {\n return colorSide('borderRightColor', decl.value)\n }\n case 'border-block-start-color': {\n return colorSide('borderTopColor', decl.value)\n }\n case 'border-block-end-color': {\n return colorSide('borderBottomColor', decl.value)\n }\n case 'border-width': {\n return borderWidthShorthand(decl.value)\n }\n case 'border-top-width':\n case 'border-right-width':\n case 'border-bottom-width':\n case 'border-left-width': {\n const v = lengthToPxValue(decl.value)\n return v === null ? [] : [[kebabToCamel(decl.property), v]]\n }\n case 'border-inline-width': {\n return widthPair('borderLeftWidth', 'borderRightWidth', decl.value)\n }\n case 'border-block-width': {\n return widthPair('borderTopWidth', 'borderBottomWidth', decl.value)\n }\n case 'border-inline-start-width': {\n const v = lengthToPxValue(decl.value)\n return v === null ? [] : [['borderLeftWidth', v]]\n }\n case 'border-inline-end-width': {\n const v = lengthToPxValue(decl.value)\n return v === null ? [] : [['borderRightWidth', v]]\n }\n case 'border-block-start-width': {\n const v = lengthToPxValue(decl.value)\n return v === null ? [] : [['borderTopWidth', v]]\n }\n case 'border-block-end-width': {\n const v = lengthToPxValue(decl.value)\n return v === null ? [] : [['borderBottomWidth', v]]\n }\n case 'border-style': {\n const styleValue = (decl.value as { top?: string }).top\n if (typeof styleValue !== 'string') return []\n return [['borderStyle', mapBorderStyle(styleValue)]]\n }\n case 'border-top-style':\n case 'border-right-style':\n case 'border-bottom-style':\n case 'border-left-style': {\n if (typeof decl.value !== 'string') return []\n return [['borderStyle', mapBorderStyle(decl.value)]]\n }\n default: {\n return null\n }\n }\n}\n"],"names":[],"mappings":";;;AAKA;;;;;;;AAOG;AACH,SAAS,SAAS,CAAC,GAAW,EAAE,KAAc,EAAA;AAC5C,IAAA,MAAM,KAAK,GAAG,gBAAgB,CAAC,KAAc,CAAC;AAC9C,IAAA,OAAO,qBAAqB,CAAC,KAAK,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,GAAG,EA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AI;QACb;;AAEJ;;;;"}
@@ -1,8 +1,10 @@
1
- import { cssColorToString } from './color.mjs';
1
+ import { isCssWideColorKeyword, cssColorToString } from './color.mjs';
2
2
 
3
3
  /**
4
- * Build a `[key, hex]` entry from a typed CssColor. Drops keyword colors
5
- * (e.g. `'currentcolor'` strings — RN can't render them).
4
+ * Build a `[key, hex]` entry from a typed CssColor. Drops CSS-wide cascade
5
+ * keywords (`currentColor`, `inherit`, `initial`, `unset`, `revert`,
6
+ * `revert-layer`) — RN has no color cascade, so those reach the native view
7
+ * manager as invalid color strings.
6
8
  * @param key RN style key (camelCase).
7
9
  * @param value Typed `CssColor`-shaped value.
8
10
  * @returns Single-entry list or empty.
@@ -11,10 +13,10 @@ function colorEntry(key, value) {
11
13
  if (value === null || value === undefined)
12
14
  return [];
13
15
  if (typeof value === 'string')
14
- return [[key, value]];
16
+ return isCssWideColorKeyword(value) ? [] : [[key, value]];
15
17
  const hex = cssColorToString(value);
16
- if (!hex || hex === 'transparent' || hex === 'currentColor')
17
- return [[key, hex]];
18
+ if (isCssWideColorKeyword(hex))
19
+ return [];
18
20
  return [[key, hex]];
19
21
  }
20
22
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"color-properties-dispatcher.mjs","sources":["../../../../../src/core/parser/color-properties-dispatcher.ts"],"sourcesContent":["import type { Declaration as LcDeclaration } from 'lightningcss'\nimport { cssColorToString } from './color'\nimport type { RNEntry } from './types'\n\n/**\n * Build a `[key, hex]` entry from a typed CssColor. Drops keyword colors\n * (e.g. `'currentcolor'` strings — RN can't render them).\n * @param key RN style key (camelCase).\n * @param value Typed `CssColor`-shaped value.\n * @returns Single-entry list or empty.\n */\nfunction colorEntry(key: string, value: unknown): readonly RNEntry[] {\n if (value === null || value === undefined) return []\n if (typeof value === 'string') return [[key, value]]\n const hex = cssColorToString(value as never)\n if (!hex || hex === 'transparent' || hex === 'currentColor') return [[key, hex]]\n return [[key, hex]]\n}\n\n/**\n * Several typed color properties wrap their `CssColor` payload inside a\n * `{type: 'color', value: CssColor}` envelope. Unwrap so the inner color\n * reaches {@link cssColorToString}.\n * @param value Either a `CssColor` directly or a `{type: 'color', value}` wrapper.\n * @returns Unwrapped `CssColor` (or the input untouched).\n */\nfunction unwrapTaggedColor(value: unknown): unknown {\n if (typeof value !== 'object' || value === null) return value\n const tagged = value as { type?: string; value?: unknown }\n if (tagged.type === 'color') return tagged.value\n return value\n}\n\n/**\n * Dispatch color-typed CSS properties (text-decoration-color, fill,\n * stroke, caret-color, outline-color, …) to RN-compatible style entries.\n *\n * lightningcss emits two shapes for color properties:\n * - bare `CssColor` value (e.g. `text-decoration-color`, `outline-color`)\n * - wrapped `{type: 'color', value: CssColor}` (e.g. `fill`, `stroke`,\n * `caret-color`, `accent-color`)\n * We unwrap both and run them through {@link cssColorToString} to land\n * at hex/rgba.\n *\n * Returns `null` for any property the dispatcher doesn't handle so the\n * caller can fall through to the next dispatcher.\n * @param decl One lightningcss declaration.\n * @returns RN entries when the property matched, else `null`.\n */\nexport function dispatchColorPropertyDeclaration(decl: LcDeclaration): readonly RNEntry[] | null {\n switch (decl.property) {\n case 'text-decoration-color': {\n return colorEntry('textDecorationColor', decl.value)\n }\n case 'caret-color': {\n return colorEntry('caretColor', unwrapTaggedColor(decl.value))\n }\n case 'fill': {\n return colorEntry('fill', unwrapTaggedColor(decl.value))\n }\n case 'stroke': {\n return colorEntry('stroke', unwrapTaggedColor(decl.value))\n }\n case 'outline-color': {\n // RN doesn't render outlines, but tooling like react-native-web /\n // a11y overlays read it — keep so cross-platform code carries the\n // value through.\n return colorEntry('outlineColor', decl.value)\n }\n case 'accent-color': {\n // RN has no native accent color; skip silently.\n return []\n }\n default: {\n return null\n }\n }\n}\n"],"names":[],"mappings":";;AAIA;;;;;;AAMG;AACH,SAAS,UAAU,CAAC,GAAW,EAAE,KAAc,EAAA;AAC7C,IAAA,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS;AAAE,QAAA,OAAO,EAAE;IACpD,I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AAI,CAAC,KAAK,CAAC;QAC/C;QACA,KAAK,cAAc,EAAE;;AAEnB,YAAA,OAAO,EAAE;QACX;QACA,SAAS;AACP,YAAA,OAAO,IAAI;QACb;;AAEJ;;;;"}
1
+ {"version":3,"file":"color-properties-dispatcher.mjs","sources":["../../../../../src/core/parser/color-properties-dispatcher.ts"],"sourcesContent":["import type { Declaration as LcDeclaration } from 'lightningcss'\nimport { cssColorToString, isCssWideColorKeyword } from './color'\nimport type { RNEntry } from './types'\n\n/**\n * Build a `[key, hex]` entry from a typed CssColor. Drops CSS-wide cascade\n * keywords (`currentColor`, `inherit`, `initial`, `unset`, `revert`,\n * `revert-layer`) — RN has no color cascade, so those reach the native view\n * manager as invalid color strings.\n * @param key RN style key (camelCase).\n * @param value Typed `CssColor`-shaped value.\n * @returns Single-entry list or empty.\n */\nfunction colorEntry(key: string, value: unknown): readonly RNEntry[] {\n if (value === null || value === undefined) return []\n if (typeof value === 'string') return isCssWideColorKeyword(value) ? [] : [[key, value]]\n const hex = cssColorToString(value as never)\n if (isCssWideColorKeyword(hex)) return []\n return [[key, hex]]\n}\n\n/**\n * Several typed color properties wrap their `CssColor` payload inside a\n * `{type: 'color', value: CssColor}` envelope. Unwrap so the inner color\n * reaches {@link cssColorToString}.\n * @param value Either a `CssColor` directly or a `{type: 'color', value}` wrapper.\n * @returns Unwrapped `CssColor` (or the input untouched).\n */\nfunction unwrapTaggedColor(value: unknown): unknown {\n if (typeof value !== 'object' || value === null) return value\n const tagged = value as { type?: string; value?: unknown }\n if (tagged.type === 'color') return tagged.value\n return value\n}\n\n/**\n * Dispatch color-typed CSS properties (text-decoration-color, fill,\n * stroke, caret-color, outline-color, …) to RN-compatible style entries.\n *\n * lightningcss emits two shapes for color properties:\n * - bare `CssColor` value (e.g. `text-decoration-color`, `outline-color`)\n * - wrapped `{type: 'color', value: CssColor}` (e.g. `fill`, `stroke`,\n * `caret-color`, `accent-color`)\n * We unwrap both and run them through {@link cssColorToString} to land\n * at hex/rgba.\n *\n * Returns `null` for any property the dispatcher doesn't handle so the\n * caller can fall through to the next dispatcher.\n * @param decl One lightningcss declaration.\n * @returns RN entries when the property matched, else `null`.\n */\nexport function dispatchColorPropertyDeclaration(decl: LcDeclaration): readonly RNEntry[] | null {\n switch (decl.property) {\n case 'text-decoration-color': {\n return colorEntry('textDecorationColor', decl.value)\n }\n case 'caret-color': {\n return colorEntry('caretColor', unwrapTaggedColor(decl.value))\n }\n case 'fill': {\n return colorEntry('fill', unwrapTaggedColor(decl.value))\n }\n case 'stroke': {\n return colorEntry('stroke', unwrapTaggedColor(decl.value))\n }\n case 'outline-color': {\n // RN doesn't render outlines, but tooling like react-native-web /\n // a11y overlays read it — keep so cross-platform code carries the\n // value through.\n return colorEntry('outlineColor', decl.value)\n }\n case 'accent-color': {\n // RN has no native accent color; skip silently.\n return []\n }\n default: {\n return null\n }\n }\n}\n"],"names":[],"mappings":";;AAIA;;;;;;;;AAQG;AACH,SAAS,UAAU,CAAC,GAAW,EAAE,KAAc,EAAA;AAC7C,IAAA,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS;AAAE,QAAA,OAAO,EAAE;IACpD,IAAI,OAAO,KAAK,KAAK,QAAQ;AAAE,QAAA,OAAO,qBAAqB,CAAC,KAAK,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;AACxF,IAAA,MAAM,GAAG,GAAG,gBAAgB,CAAC,KAAc,CAAC;IAC5C,IAAI,qBAAqB,CAAC,GAAG,CAAC;AAAE,QAAA,OAAO,EAAE;AACzC,IAAA,OAAO,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;AACrB;AAEA;;;;;;AAMG;AACH,SAAS,iBAAiB,CAAC,KAAc,EAAA;AACvC,IAAA,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI;AAAE,QAAA,OAAO,KAAK;IAC7D,MAAM,MAAM,GAAG,KAA2C;AAC1D,IAAA,IAAI,MAAM,CAAC,IAAI,KAAK,OAAO;QAAE,OAAO,MAAM,CAAC,KAAK;AAChD,IAAA,OAAO,KAAK;AACd;AAEA;;;;;;;;;;;;;;;AAeG;AACG,SAAU,gCAAgC,CAAC,IAAmB,EAAA;AAClE,IAAA,QAAQ,IAAI,CAAC,QAAQ;QACnB,KAAK,uBAAuB,EAAE;YAC5B,OAAO,UAAU,CAAC,qBAAqB,EAAE,IAAI,CAAC,KAAK,CAAC;QACtD;QACA,KAAK,aAAa,EAAE;YAClB,OAAO,UAAU,CAAC,YAAY,EAAE,iBAAiB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAChE;QACA,KAAK,MAAM,EAAE;YACX,OAAO,UAAU,CAAC,MAAM,EAAE,iBAAiB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC1D;QACA,KAAK,QAAQ,EAAE;YACb,OAAO,UAAU,CAAC,QAAQ,EAAE,iBAAiB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC5D;QACA,KAAK,eAAe,EAAE;;;;YAIpB,OAAO,UAAU,CAAC,cAAc,EAAE,IAAI,CAAC,KAAK,CAAC;QAC/C;QACA,KAAK,cAAc,EAAE;;AAEnB,YAAA,OAAO,EAAE;QACX;QACA,SAAS;AACP,YAAA,OAAO,IAAI;QACb;;AAEJ;;;;"}
@@ -1,14 +1,29 @@
1
1
  import type { CssColor } from 'lightningcss';
2
2
  /**
3
3
  * Lower a wide-gamut / modern CSS color STRING (`oklch(…)`, `lab(…)`,
4
- * `color(display-p3 …)`, …) to an sRGB hex/rgba string RN can paint. Returns
5
- * `null` for anything RN already understands (hex, rgb, hsl, named) so the
6
- * caller keeps the original text — only the unrepresentable forms convert.
4
+ * `color(display-p3 …)`, `color-mix(…)`) to an sRGB hex/rgba string RN can
5
+ * paint. Returns `null` for anything RN already understands (hex, rgb, hsl,
6
+ * named) so the caller keeps the original text — only the unrepresentable
7
+ * forms convert. `color-mix()` is resolved via culori's interpolator; when it
8
+ * (or any other modern form) can't resolve, returns null so the caller DROPS
9
+ * the value rather than leaking the raw, RN-unreadable string.
7
10
  * Mirrors {@link cssColorToString}'s culori lowering for the string path.
8
11
  * @param text Resolved CSS color text (post theme-var substitution).
9
12
  * @returns sRGB color string, or `null` when no conversion is needed/possible.
10
13
  */
11
14
  export declare function normalizeColorString(text: string): string | null;
15
+ /**
16
+ * Whether a resolved color STRING is a CSS-wide cascade keyword
17
+ * (`currentColor`, `inherit`, `initial`, `unset`, `revert`, `revert-layer`)
18
+ * with no React Native equivalent. RN has no color cascade, so the color path
19
+ * must DROP (omit the key) when this is true rather than emit the keyword —
20
+ * RN would otherwise receive an invalid color string and render nothing.
21
+ * `transparent` is NOT a cascade keyword: it is a concrete color the converters
22
+ * lower to `rgba(0, 0, 0, 0)`, so it returns false here and resolves normally.
23
+ * @param text Resolved color text (post theme-var substitution / typed-color stringification).
24
+ * @returns True when the value is an RN-unrepresentable CSS-wide keyword.
25
+ */
26
+ export declare function isCssWideColorKeyword(text: string): boolean;
12
27
  /**
13
28
  * Convert a lightningcss `CssColor` to an RN-safe color string. RGB
14
29
  * passes through unchanged. LAB / LCH / OKLAB / OKLCH / `color(xyz-…)`