rnwind 0.0.4 → 0.0.5

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 (127) hide show
  1. package/lib/cjs/core/normalize-classname.cjs +25 -0
  2. package/lib/cjs/core/normalize-classname.cjs.map +1 -0
  3. package/lib/cjs/core/normalize-classname.d.ts +10 -0
  4. package/lib/cjs/core/style-builder/build-style.cjs +258 -58
  5. package/lib/cjs/core/style-builder/build-style.cjs.map +1 -1
  6. package/lib/cjs/core/style-builder/build-style.d.ts +6 -1
  7. package/lib/cjs/core/style-builder/union-builder.cjs +37 -3
  8. package/lib/cjs/core/style-builder/union-builder.cjs.map +1 -1
  9. package/lib/cjs/core/style-builder/union-builder.d.ts +21 -1
  10. package/lib/cjs/metro/dts.cjs +7 -16
  11. package/lib/cjs/metro/dts.cjs.map +1 -1
  12. package/lib/cjs/metro/dts.d.ts +2 -4
  13. package/lib/cjs/metro/state.cjs +30 -78
  14. package/lib/cjs/metro/state.cjs.map +1 -1
  15. package/lib/cjs/metro/state.d.ts +8 -25
  16. package/lib/cjs/metro/transformer.cjs +193 -34
  17. package/lib/cjs/metro/transformer.cjs.map +1 -1
  18. package/lib/cjs/metro/with-config.cjs +2 -2
  19. package/lib/cjs/metro/with-config.cjs.map +1 -1
  20. package/lib/cjs/metro/with-config.d.ts +11 -26
  21. package/lib/cjs/metro/wrap-imports.cjs +273 -0
  22. package/lib/cjs/metro/wrap-imports.cjs.map +1 -0
  23. package/lib/cjs/metro/wrap-imports.d.ts +26 -0
  24. package/lib/cjs/runtime/components/rnwind-provider.cjs +0 -17
  25. package/lib/cjs/runtime/components/rnwind-provider.cjs.map +1 -1
  26. package/lib/cjs/runtime/components/rnwind-provider.d.ts +0 -14
  27. package/lib/cjs/runtime/hooks/use-css.cjs +16 -10
  28. package/lib/cjs/runtime/hooks/use-css.cjs.map +1 -1
  29. package/lib/cjs/runtime/hooks/use-css.d.ts +15 -9
  30. package/lib/cjs/runtime/index.cjs +11 -13
  31. package/lib/cjs/runtime/index.cjs.map +1 -1
  32. package/lib/cjs/runtime/index.d.ts +4 -9
  33. package/lib/cjs/runtime/lookup-css.cjs +10 -0
  34. package/lib/cjs/runtime/lookup-css.cjs.map +1 -1
  35. package/lib/cjs/runtime/lookup-css.d.ts +7 -0
  36. package/lib/cjs/runtime/resolve.cjs +348 -0
  37. package/lib/cjs/runtime/resolve.cjs.map +1 -0
  38. package/lib/cjs/runtime/resolve.d.ts +61 -0
  39. package/lib/cjs/runtime/wrap.cjs +254 -0
  40. package/lib/cjs/runtime/wrap.cjs.map +1 -0
  41. package/lib/cjs/runtime/wrap.d.ts +37 -0
  42. package/lib/cjs/testing/index.cjs +81 -50
  43. package/lib/cjs/testing/index.cjs.map +1 -1
  44. package/lib/esm/core/normalize-classname.d.ts +10 -0
  45. package/lib/esm/core/normalize-classname.mjs +23 -0
  46. package/lib/esm/core/normalize-classname.mjs.map +1 -0
  47. package/lib/esm/core/style-builder/build-style.d.ts +6 -1
  48. package/lib/esm/core/style-builder/build-style.mjs +258 -58
  49. package/lib/esm/core/style-builder/build-style.mjs.map +1 -1
  50. package/lib/esm/core/style-builder/union-builder.d.ts +21 -1
  51. package/lib/esm/core/style-builder/union-builder.mjs +37 -3
  52. package/lib/esm/core/style-builder/union-builder.mjs.map +1 -1
  53. package/lib/esm/metro/dts.d.ts +2 -4
  54. package/lib/esm/metro/dts.mjs +7 -16
  55. package/lib/esm/metro/dts.mjs.map +1 -1
  56. package/lib/esm/metro/state.d.ts +8 -25
  57. package/lib/esm/metro/state.mjs +30 -76
  58. package/lib/esm/metro/state.mjs.map +1 -1
  59. package/lib/esm/metro/transformer.mjs +194 -35
  60. package/lib/esm/metro/transformer.mjs.map +1 -1
  61. package/lib/esm/metro/with-config.d.ts +11 -26
  62. package/lib/esm/metro/with-config.mjs +2 -2
  63. package/lib/esm/metro/with-config.mjs.map +1 -1
  64. package/lib/esm/metro/wrap-imports.d.ts +26 -0
  65. package/lib/esm/metro/wrap-imports.mjs +250 -0
  66. package/lib/esm/metro/wrap-imports.mjs.map +1 -0
  67. package/lib/esm/runtime/components/rnwind-provider.d.ts +0 -14
  68. package/lib/esm/runtime/components/rnwind-provider.mjs +1 -17
  69. package/lib/esm/runtime/components/rnwind-provider.mjs.map +1 -1
  70. package/lib/esm/runtime/hooks/use-css.d.ts +15 -9
  71. package/lib/esm/runtime/hooks/use-css.mjs +16 -10
  72. package/lib/esm/runtime/hooks/use-css.mjs.map +1 -1
  73. package/lib/esm/runtime/index.d.ts +4 -9
  74. package/lib/esm/runtime/index.mjs +4 -4
  75. package/lib/esm/runtime/index.mjs.map +1 -1
  76. package/lib/esm/runtime/lookup-css.d.ts +7 -0
  77. package/lib/esm/runtime/lookup-css.mjs +10 -1
  78. package/lib/esm/runtime/lookup-css.mjs.map +1 -1
  79. package/lib/esm/runtime/resolve.d.ts +61 -0
  80. package/lib/esm/runtime/resolve.mjs +341 -0
  81. package/lib/esm/runtime/resolve.mjs.map +1 -0
  82. package/lib/esm/runtime/wrap.d.ts +37 -0
  83. package/lib/esm/runtime/wrap.mjs +251 -0
  84. package/lib/esm/runtime/wrap.mjs.map +1 -0
  85. package/lib/esm/testing/index.mjs +84 -53
  86. package/lib/esm/testing/index.mjs.map +1 -1
  87. package/package.json +2 -1
  88. package/src/core/normalize-classname.ts +19 -0
  89. package/src/core/style-builder/build-style.ts +286 -55
  90. package/src/core/style-builder/union-builder.ts +36 -3
  91. package/src/metro/dts.ts +7 -19
  92. package/src/metro/state.ts +29 -74
  93. package/src/metro/transformer.ts +190 -34
  94. package/src/metro/with-config.ts +13 -28
  95. package/src/metro/wrap-imports.ts +260 -0
  96. package/src/runtime/components/rnwind-provider.tsx +0 -17
  97. package/src/runtime/hooks/use-css.ts +17 -11
  98. package/src/runtime/index.ts +3 -26
  99. package/src/runtime/lookup-css.ts +10 -0
  100. package/src/runtime/resolve.ts +381 -0
  101. package/src/runtime/wrap.tsx +267 -0
  102. package/src/testing/index.ts +106 -56
  103. package/lib/cjs/core/parser/text-truncate.cjs +0 -78
  104. package/lib/cjs/core/parser/text-truncate.cjs.map +0 -1
  105. package/lib/cjs/metro/transform-ast.cjs +0 -1472
  106. package/lib/cjs/metro/transform-ast.cjs.map +0 -1
  107. package/lib/cjs/metro/transform-ast.d.ts +0 -88
  108. package/lib/cjs/runtime/haptics.cjs +0 -113
  109. package/lib/cjs/runtime/haptics.cjs.map +0 -1
  110. package/lib/cjs/runtime/haptics.d.ts +0 -48
  111. package/lib/cjs/runtime/interactive-box.cjs +0 -35
  112. package/lib/cjs/runtime/interactive-box.cjs.map +0 -1
  113. package/lib/cjs/runtime/interactive-box.d.ts +0 -40
  114. package/lib/esm/core/parser/text-truncate.mjs +0 -75
  115. package/lib/esm/core/parser/text-truncate.mjs.map +0 -1
  116. package/lib/esm/metro/transform-ast.d.ts +0 -88
  117. package/lib/esm/metro/transform-ast.mjs +0 -1451
  118. package/lib/esm/metro/transform-ast.mjs.map +0 -1
  119. package/lib/esm/runtime/haptics.d.ts +0 -48
  120. package/lib/esm/runtime/haptics.mjs +0 -110
  121. package/lib/esm/runtime/haptics.mjs.map +0 -1
  122. package/lib/esm/runtime/interactive-box.d.ts +0 -40
  123. package/lib/esm/runtime/interactive-box.mjs +0 -33
  124. package/lib/esm/runtime/interactive-box.mjs.map +0 -1
  125. package/src/metro/transform-ast.ts +0 -1729
  126. package/src/runtime/haptics.ts +0 -120
  127. package/src/runtime/interactive-box.tsx +0 -57
@@ -44,22 +44,6 @@ const RnwindContext = createContext(DEFAULT_STATE);
44
44
  function useRnwind() {
45
45
  return useContext(RnwindContext);
46
46
  }
47
- /**
48
- * Internal context hook the babel transformer injects at the top of
49
- * every rewritten component as `const _t = useR_()`. Same body as the
50
- * public {@link useRnwind} — exposed under a `use*`-prefixed name so
51
- * react-refresh's babel plugin (which only tracks call-sites whose
52
- * identifier matches `^use[A-Z]`) folds it into each component's
53
- * fast-refresh signature. Without that prefix the signature stayed
54
- * stable across transformer changes; HMR then preserved fiber state
55
- * while the rendered hook list shifted, surfacing as "change in the
56
- * order of Hooks" runtime errors. Trailing underscore keeps it
57
- * visually distinct from the user-facing `useRnwind`.
58
- * @returns Active rnwind state.
59
- */
60
- function useR_() {
61
- return useContext(RnwindContext);
62
- }
63
47
  /**
64
48
  * Provider for rnwind's full runtime state. fontScale + windowWidth
65
49
  * come from `useWindowDimensions()` so they react to OS-level
@@ -90,5 +74,5 @@ function RnwindProvider({ scheme, tables, insets, onHaptics, children }) {
90
74
  return jsx(RnwindContext.Provider, { value: value, children: children });
91
75
  }
92
76
 
93
- export { RnwindProvider, useR_, useRnwind };
77
+ export { RnwindProvider, useRnwind };
94
78
  //# sourceMappingURL=rnwind-provider.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"rnwind-provider.mjs","sources":["../../../../../src/runtime/components/rnwind-provider.tsx"],"sourcesContent":["import { createContext, useContext, useMemo, type ReactNode } from 'react'\nimport { useWindowDimensions } from 'react-native'\nimport type { ThemeTables } from '../../core/types'\nimport type { Scheme } from '../types'\nimport type { OnHaptics } from '../../core/parser/haptics'\nimport { activeBreakpointFor, BASE_BREAKPOINT, loadScheme } from '../lookup-css'\n\n/**\n * Per-render safe-area insets snapshot. Bridge from any source\n * (`useSafeAreaInsets()`, expo-router insets, a manually computed\n * value) into the {@link RnwindProvider} — rnwind stays\n * library-agnostic.\n */\nexport type Insets = Readonly<{\n top: number\n right: number\n bottom: number\n left: number\n}>\n\n/**\n * Single value carried by the rnwind context. Every piece of runtime\n * state rnwind needs — scheme, theme tables, insets, font scale,\n * window width, active responsive breakpoint, optional haptic\n * dispatcher — lives on this one bag. Consumers read it via\n * {@link useRnwind} and either destructure or forward straight to\n * `lookupCss` / `useCss`.\n *\n * `activeBreakpoint` is the highest-threshold registered breakpoint\n * whose min-width is `<= windowWidth`, or `'base'` when below the\n * smallest one (mobile-first tier) or when no breakpoints are\n * registered yet (tests, bundles without rnwind-transformed sources).\n * Always a string — never null. Reactive: it updates with\n * `useWindowDimensions().width`, so consumers can branch on it\n * without a separate hook.\n */\nexport type RnwindState = Readonly<{\n scheme: Scheme\n tables: ThemeTables\n insets: Insets\n onHaptics: OnHaptics | undefined\n fontScale: number\n windowWidth: number\n activeBreakpoint: string\n}>\n\n/** Props accepted by {@link RnwindProvider}. */\nexport type RnwindProviderProps = Readonly<{\n scheme: Scheme\n tables?: ThemeTables\n insets?: Partial<Insets>\n onHaptics?: OnHaptics\n children?: ReactNode\n}>\n\nconst EMPTY_TABLES: ThemeTables = {}\nconst ZERO_INSETS: Insets = { top: 0, right: 0, bottom: 0, left: 0 }\nconst DEFAULT_STATE: RnwindState = {\n scheme: 'light' as Scheme,\n tables: EMPTY_TABLES,\n insets: ZERO_INSETS,\n onHaptics: undefined,\n fontScale: 1,\n windowWidth: 0,\n activeBreakpoint: BASE_BREAKPOINT,\n}\n\n/**\n * Normalise a `Partial<Insets>` into a complete {@link Insets}, returning\n * the shared {@link ZERO_INSETS} reference when nothing is supplied so\n * downstream memoisation stays stable.\n * @param partial Caller-supplied insets (or undefined).\n * @returns Complete insets record.\n */\nfunction normaliseInsets(partial: Partial<Insets> | undefined): Insets {\n if (!partial) return ZERO_INSETS\n const top = partial.top ?? 0\n const right = partial.right ?? 0\n const bottom = partial.bottom ?? 0\n const left = partial.left ?? 0\n if (top === 0 && right === 0 && bottom === 0 && left === 0) return ZERO_INSETS\n return { top, right, bottom, left }\n}\n\n/** Single internal context the runtime reads from. */\nconst RnwindContext = createContext<RnwindState>(DEFAULT_STATE)\n\n/**\n * Read rnwind's full runtime state — scheme, theme tables, insets,\n * fontScale, windowWidth, onHaptics — in one go. Pass the returned\n * value straight to `lookupCss` / `useCss`, or destructure what you\n * need.\n * @returns Active rnwind state under the nearest {@link RnwindProvider}.\n */\nexport function useRnwind(): RnwindState {\n return useContext(RnwindContext)\n}\n\n/**\n * Internal context hook the babel transformer injects at the top of\n * every rewritten component as `const _t = useR_()`. Same body as the\n * public {@link useRnwind} — exposed under a `use*`-prefixed name so\n * react-refresh's babel plugin (which only tracks call-sites whose\n * identifier matches `^use[A-Z]`) folds it into each component's\n * fast-refresh signature. Without that prefix the signature stayed\n * stable across transformer changes; HMR then preserved fiber state\n * while the rendered hook list shifted, surfacing as \"change in the\n * order of Hooks\" runtime errors. Trailing underscore keeps it\n * visually distinct from the user-facing `useRnwind`.\n * @returns Active rnwind state.\n */\nexport function useR_(): RnwindState {\n return useContext(RnwindContext)\n}\n\n/**\n * Provider for rnwind's full runtime state. fontScale + windowWidth\n * come from `useWindowDimensions()` so they react to OS-level\n * orientation / accessibility-text-size changes automatically.\n * @param props Provider props.\n * @param props.scheme Active scheme name.\n * @param props.tables Optional pre-resolved token tables.\n * @param props.insets Optional safe-area insets.\n * @param props.onHaptics Optional haptic dispatcher.\n * @param props.children React subtree.\n * @returns Provider element.\n */\nexport function RnwindProvider({ scheme, tables, insets, onHaptics, children }: RnwindProviderProps): ReactNode {\n const normalized = normaliseInsets(insets)\n const { fontScale, width } = useWindowDimensions()\n const value = useMemo<RnwindState>(() => {\n loadScheme(scheme)\n return {\n scheme,\n tables: tables ?? EMPTY_TABLES,\n insets: normalized,\n onHaptics,\n fontScale,\n windowWidth: width,\n activeBreakpoint: activeBreakpointFor(width),\n }\n }, [scheme, tables, normalized, onHaptics, fontScale, width])\n return <RnwindContext.Provider value={value}>{children}</RnwindContext.Provider>\n}\n"],"names":["_jsx"],"mappings":";;;;;AAuDA,MAAM,YAAY,GAAgB,EAAE;AACpC,MAAM,WAAW,GAAW,EAAE,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE;AACpE,MAAM,aAAa,GAAgB;AACjC,IAAA,MAAM,EAAE,OAAiB;AACzB,IAAA,MAAM,EAAE,YAAY;AACpB,IAAA,MAAM,EAAE,WAAW;AACnB,IAAA,SAAS,EAAE,SAAS;AACpB,IAAA,SAAS,EAAE,CAAC;AACZ,IAAA,WAAW,EAAE,CA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YAClB,SAAS;YACT,SAAS;AACT,YAAA,WAAW,EAAE,KAAK;AAClB,YAAA,gBAAgB,EAAE,mBAAmB,CAAC,KAAK,CAAC;SAC7C;AACH,IAAA,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;IAC7D,OAAOA,GAAA,CAAC,aAAa,CAAC,QAAQ,EAAA,EAAC,KAAK,EAAE,KAAK,EAAA,QAAA,EAAG,QAAQ,EAAA,CAA0B;AAClF;;;;"}
1
+ {"version":3,"file":"rnwind-provider.mjs","sources":["../../../../../src/runtime/components/rnwind-provider.tsx"],"sourcesContent":["import { createContext, useContext, useMemo, type ReactNode } from 'react'\nimport { useWindowDimensions } from 'react-native'\nimport type { ThemeTables } from '../../core/types'\nimport type { Scheme } from '../types'\nimport type { OnHaptics } from '../../core/parser/haptics'\nimport { activeBreakpointFor, BASE_BREAKPOINT, loadScheme } from '../lookup-css'\n\n/**\n * Per-render safe-area insets snapshot. Bridge from any source\n * (`useSafeAreaInsets()`, expo-router insets, a manually computed\n * value) into the {@link RnwindProvider} — rnwind stays\n * library-agnostic.\n */\nexport type Insets = Readonly<{\n top: number\n right: number\n bottom: number\n left: number\n}>\n\n/**\n * Single value carried by the rnwind context. Every piece of runtime\n * state rnwind needs — scheme, theme tables, insets, font scale,\n * window width, active responsive breakpoint, optional haptic\n * dispatcher — lives on this one bag. Consumers read it via\n * {@link useRnwind} and either destructure or forward straight to\n * `lookupCss` / `useCss`.\n *\n * `activeBreakpoint` is the highest-threshold registered breakpoint\n * whose min-width is `<= windowWidth`, or `'base'` when below the\n * smallest one (mobile-first tier) or when no breakpoints are\n * registered yet (tests, bundles without rnwind-transformed sources).\n * Always a string — never null. Reactive: it updates with\n * `useWindowDimensions().width`, so consumers can branch on it\n * without a separate hook.\n */\nexport type RnwindState = Readonly<{\n scheme: Scheme\n tables: ThemeTables\n insets: Insets\n onHaptics: OnHaptics | undefined\n fontScale: number\n windowWidth: number\n activeBreakpoint: string\n}>\n\n/** Props accepted by {@link RnwindProvider}. */\nexport type RnwindProviderProps = Readonly<{\n scheme: Scheme\n tables?: ThemeTables\n insets?: Partial<Insets>\n onHaptics?: OnHaptics\n children?: ReactNode\n}>\n\nconst EMPTY_TABLES: ThemeTables = {}\nconst ZERO_INSETS: Insets = { top: 0, right: 0, bottom: 0, left: 0 }\nconst DEFAULT_STATE: RnwindState = {\n scheme: 'light' as Scheme,\n tables: EMPTY_TABLES,\n insets: ZERO_INSETS,\n onHaptics: undefined,\n fontScale: 1,\n windowWidth: 0,\n activeBreakpoint: BASE_BREAKPOINT,\n}\n\n/**\n * Normalise a `Partial<Insets>` into a complete {@link Insets}, returning\n * the shared {@link ZERO_INSETS} reference when nothing is supplied so\n * downstream memoisation stays stable.\n * @param partial Caller-supplied insets (or undefined).\n * @returns Complete insets record.\n */\nfunction normaliseInsets(partial: Partial<Insets> | undefined): Insets {\n if (!partial) return ZERO_INSETS\n const top = partial.top ?? 0\n const right = partial.right ?? 0\n const bottom = partial.bottom ?? 0\n const left = partial.left ?? 0\n if (top === 0 && right === 0 && bottom === 0 && left === 0) return ZERO_INSETS\n return { top, right, bottom, left }\n}\n\n/** Single internal context the runtime reads from. */\nconst RnwindContext = createContext<RnwindState>(DEFAULT_STATE)\n\n/**\n * Read rnwind's full runtime state — scheme, theme tables, insets,\n * fontScale, windowWidth, onHaptics — in one go. Pass the returned\n * value straight to `lookupCss` / `useCss`, or destructure what you\n * need.\n * @returns Active rnwind state under the nearest {@link RnwindProvider}.\n */\nexport function useRnwind(): RnwindState {\n return useContext(RnwindContext)\n}\n\n/**\n * Provider for rnwind's full runtime state. fontScale + windowWidth\n * come from `useWindowDimensions()` so they react to OS-level\n * orientation / accessibility-text-size changes automatically.\n * @param props Provider props.\n * @param props.scheme Active scheme name.\n * @param props.tables Optional pre-resolved token tables.\n * @param props.insets Optional safe-area insets.\n * @param props.onHaptics Optional haptic dispatcher.\n * @param props.children React subtree.\n * @returns Provider element.\n */\nexport function RnwindProvider({ scheme, tables, insets, onHaptics, children }: RnwindProviderProps): ReactNode {\n const normalized = normaliseInsets(insets)\n const { fontScale, width } = useWindowDimensions()\n const value = useMemo<RnwindState>(() => {\n loadScheme(scheme)\n return {\n scheme,\n tables: tables ?? EMPTY_TABLES,\n insets: normalized,\n onHaptics,\n fontScale,\n windowWidth: width,\n activeBreakpoint: activeBreakpointFor(width),\n }\n }, [scheme, tables, normalized, onHaptics, fontScale, width])\n return <RnwindContext.Provider value={value}>{children}</RnwindContext.Provider>\n}\n"],"names":["_jsx"],"mappings":";;;;;AAuDA,MAAM,YAAY,GAAgB,EAAE;AACpC,MAAM,WAAW,GAAW,EAAE,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE;AACpE,MAAM,aAAa,GAAgB;AACjC,IAAA,MAAM,EAAE,OAAiB;AACzB,IAAA,MAAM,EAAE,YAAY;AACpB,IAAA,MAAM,EAAE,WAAW;AACnB,IAAA,SAAS,EAAE,SAAS;AACpB,IAAA,SAAS,EAAE,CAAC;AACZ,IAAA,WAAW,EAAE,CAAC;AACd,IAAA,gBAAgB,EAAE,eAAe;CAClC;AAED;;;;;;AAMG;AACH,SAAS,eAAe,CAAC,OAAoC,EAAA;AAC3D,IAAA,IAAI,CAAC,OAAO;AAAE,QAAA,OAAO,WAAW;AAChC,IAAA,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,IAAI,CAAC;AAC5B,IAAA,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,CAAC;AAChC,IAAA,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,CAAC;AAClC,IAAA,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,IAAI,CAAC;AAC9B,IAAA,IAAI,GAAG,KAAK,CAAC,IAAI,KAAK,KAAK,CAAC,IAAI,MAAM,KAAK,CAAC,IAAI,IAAI,KAAK,CAAC;AAAE,QAAA,OAAO,WAAW;IAC9E,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE;AACrC;AAEA;AACA,MAAM,aAAa,GAAG,aAAa,CAAc,aAAa,CAAC;AAE/D;;;;;;AAMG;SACa,SAAS,GAAA;AACvB,IAAA,OAAO,UAAU,CAAC,aAAa,CAAC;AAClC;AAEA;;;;;;;;;;;AAWG;AACG,SAAU,cAAc,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAuB,EAAA;AACjG,IAAA,MAAM,UAAU,GAAG,eAAe,CAAC,MAAM,CAAC;IAC1C,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,mBAAmB,EAAE;AAClD,IAAA,MAAM,KAAK,GAAG,OAAO,CAAc,MAAK;QACtC,UAAU,CAAC,MAAM,CAAC;QAClB,OAAO;YACL,MAAM;YACN,MAAM,EAAE,MAAM,IAAI,YAAY;AAC9B,YAAA,MAAM,EAAE,UAAU;YAClB,SAAS;YACT,SAAS;AACT,YAAA,WAAW,EAAE,KAAK;AAClB,YAAA,gBAAgB,EAAE,mBAAmB,CAAC,KAAK,CAAC;SAC7C;AACH,IAAA,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;IAC7D,OAAOA,GAAA,CAAC,aAAa,CAAC,QAAQ,EAAA,EAAC,KAAK,EAAE,KAAK,EAAA,QAAA,EAAG,QAAQ,EAAA,CAA0B;AAClF;;;;"}
@@ -1,11 +1,17 @@
1
1
  /**
2
- * Convenience hook: `useRnwind()` + `lookupCss()` rolled into one. Use
3
- * inside any component that wants the resolved style array without
4
- * threading the rnwind context manually. JSX-heavy components should
5
- * still call `useRnwind()` once and pass it to `lookupCss(...)` per
6
- * element so React only does a single context read per render.
7
- * @param className Raw className string or transformer-hoisted atom-name array.
8
- * @param userStyle Optional caller-supplied style appended last.
9
- * @returns Frozen style array for React Native's `style` prop.
2
+ * Resolve a className to a React Native `style` value against the active
3
+ * rnwind context (scheme, insets, fontScale, breakpoint). Molecule-fast:
4
+ * a literal className the scanner saw returns a pre-merged object by
5
+ * reference; anything else falls back to per-atom resolution. The escape
6
+ * hatch for custom components that hold a `className` prop:
7
+ *
8
+ * ```tsx
9
+ * function Card({ className, style, ...rest }) {
10
+ * return <RNView style={useCss(className, style)} {...rest} />
11
+ * }
12
+ * ```
13
+ * @param className Raw className string.
14
+ * @param userStyle Optional caller-supplied style appended last (wins).
15
+ * @returns RN `style` value (a single object or an array).
10
16
  */
11
- export declare function useCss(className?: string | readonly string[] | null, userStyle?: unknown): readonly unknown[];
17
+ export declare function useCss(className?: string | null, userStyle?: unknown): unknown;
@@ -1,18 +1,24 @@
1
1
  import { useRnwind } from '../components/rnwind-provider.mjs';
2
- import { lookupCss } from '../lookup-css.mjs';
2
+ import { resolve } from '../resolve.mjs';
3
3
 
4
4
  /**
5
- * Convenience hook: `useRnwind()` + `lookupCss()` rolled into one. Use
6
- * inside any component that wants the resolved style array without
7
- * threading the rnwind context manually. JSX-heavy components should
8
- * still call `useRnwind()` once and pass it to `lookupCss(...)` per
9
- * element so React only does a single context read per render.
10
- * @param className Raw className string or transformer-hoisted atom-name array.
11
- * @param userStyle Optional caller-supplied style appended last.
12
- * @returns Frozen style array for React Native's `style` prop.
5
+ * Resolve a className to a React Native `style` value against the active
6
+ * rnwind context (scheme, insets, fontScale, breakpoint). Molecule-fast:
7
+ * a literal className the scanner saw returns a pre-merged object by
8
+ * reference; anything else falls back to per-atom resolution. The escape
9
+ * hatch for custom components that hold a `className` prop:
10
+ *
11
+ * ```tsx
12
+ * function Card({ className, style, ...rest }) {
13
+ * return <RNView style={useCss(className, style)} {...rest} />
14
+ * }
15
+ * ```
16
+ * @param className Raw className string.
17
+ * @param userStyle Optional caller-supplied style appended last (wins).
18
+ * @returns RN `style` value (a single object or an array).
13
19
  */
14
20
  function useCss(className, userStyle) {
15
- return lookupCss(className, useRnwind(), userStyle);
21
+ return resolve(className, useRnwind(), userStyle).style;
16
22
  }
17
23
 
18
24
  export { useCss };
@@ -1 +1 @@
1
- {"version":3,"file":"use-css.mjs","sources":["../../../../../src/runtime/hooks/use-css.ts"],"sourcesContent":["import { useRnwind } from '../components/rnwind-provider'\nimport { lookupCss } from '../lookup-css'\n\n/**\n * Convenience hook: `useRnwind()` + `lookupCss()` rolled into one. Use\n * inside any component that wants the resolved style array without\n * threading the rnwind context manually. JSX-heavy components should\n * still call `useRnwind()` once and pass it to `lookupCss(...)` per\n * element so React only does a single context read per render.\n * @param className Raw className string or transformer-hoisted atom-name array.\n * @param userStyle Optional caller-supplied style appended last.\n * @returns Frozen style array for React Native's `style` prop.\n */\nexport function useCss(className?: string | readonly string[] | null, userStyle?: unknown): readonly unknown[] {\n return lookupCss(className, useRnwind(), userStyle)\n}\n"],"names":[],"mappings":";;;AAGA;;;;;;;;;AASG;AACG,SAAU,MAAM,CAAC,SAA6C,EAAE,SAAmB,EAAA;IACvF,OAAO,SAAS,CAAC,SAAS,EAAE,SAAS,EAAE,EAAE,SAAS,CAAC;AACrD;;;;"}
1
+ {"version":3,"file":"use-css.mjs","sources":["../../../../../src/runtime/hooks/use-css.ts"],"sourcesContent":["import { useRnwind } from '../components/rnwind-provider'\nimport { resolve } from '../resolve'\n\n/**\n * Resolve a className to a React Native `style` value against the active\n * rnwind context (scheme, insets, fontScale, breakpoint). Molecule-fast:\n * a literal className the scanner saw returns a pre-merged object by\n * reference; anything else falls back to per-atom resolution. The escape\n * hatch for custom components that hold a `className` prop:\n *\n * ```tsx\n * function Card({ className, style, ...rest }) {\n * return <RNView style={useCss(className, style)} {...rest} />\n * }\n * ```\n * @param className Raw className string.\n * @param userStyle Optional caller-supplied style appended last (wins).\n * @returns RN `style` value (a single object or an array).\n */\nexport function useCss(className?: string | null, userStyle?: unknown): unknown {\n return resolve(className, useRnwind(), userStyle).style\n}\n"],"names":[],"mappings":";;;AAGA;;;;;;;;;;;;;;;AAeG;AACG,SAAU,MAAM,CAAC,SAAyB,EAAE,SAAmB,EAAA;IACnE,OAAO,OAAO,CAAC,SAAS,EAAE,SAAS,EAAE,EAAE,SAAS,CAAC,CAAC,KAAK;AACzD;;;;"}
@@ -1,19 +1,14 @@
1
- export { lookupCss, registerAtoms, registerBreakpoints, registerSchemeLoader, setWindowHeightProvider, getBreakpoints, activeBreakpointFor, lookupCss as _l, } from './lookup-css';
2
- export { useR_ } from './components/rnwind-provider';
1
+ export { lookupCss, registerAtoms, registerBreakpoints, registerSchemeLoader, setWindowHeightProvider, getBreakpoints, activeBreakpointFor, } from './lookup-css';
3
2
  export type { HoistedClassName, InteractState, LookupInsets, SafeMarkerSpec } from './lookup-css';
3
+ export { wrap, wrapNamespace } from './wrap';
4
+ export { resolve, registerMolecules, registerGradients, registerHaptics } from './resolve';
5
+ export type { ResolvedCss } from './resolve';
4
6
  export { useCss } from './hooks/use-css';
5
7
  export { useInteract } from './hooks/use-interact';
6
8
  export type { UseInteractResult } from './hooks/use-interact';
7
9
  export { chainPress, chainFocus } from './chain-handlers';
8
- export { InteractiveBox, InteractiveBox as _ib } from './interactive-box';
9
- export type { InteractiveBoxProps, InteractiveSpec } from './interactive-box';
10
10
  export { RnwindProvider, useRnwind } from './components/rnwind-provider';
11
11
  export type { RnwindProviderProps, RnwindState, Insets } from './components/rnwind-provider';
12
- export { useMountHaptic, triggerHaptic, triggerHaptic as _ht, useMountHaptic as _hm } from './haptics';
13
- /** @internal */
14
- /** @internal */
15
- /** @internal */
16
- /** @internal */
17
12
  export type { HapticRequest, HapticTrigger, OnHaptics } from '../core/parser/haptics';
18
13
  export type { AsLinearGradientProps, LinearGradientPoint } from './gradient-types';
19
14
  export type { ThemeTable, ThemeTables } from '../core/types';
@@ -1,10 +1,10 @@
1
- export { lookupCss as _l, activeBreakpointFor, getBreakpoints, lookupCss, registerAtoms, registerBreakpoints, registerSchemeLoader, setWindowHeightProvider } from './lookup-css.mjs';
2
- export { RnwindProvider, useR_, useRnwind } from './components/rnwind-provider.mjs';
1
+ export { activeBreakpointFor, getBreakpoints, lookupCss, registerAtoms, registerBreakpoints, registerSchemeLoader, setWindowHeightProvider } from './lookup-css.mjs';
2
+ export { wrap, wrapNamespace } from './wrap.mjs';
3
+ export { registerGradients, registerHaptics, registerMolecules, resolve } from './resolve.mjs';
3
4
  export { useCss } from './hooks/use-css.mjs';
4
5
  export { useInteract } from './hooks/use-interact.mjs';
5
6
  export { chainFocus, chainPress } from './chain-handlers.mjs';
6
- export { InteractiveBox, InteractiveBox as _ib } from './interactive-box.mjs';
7
- export { useMountHaptic as _hm, triggerHaptic as _ht, triggerHaptic, useMountHaptic } from './haptics.mjs';
7
+ export { RnwindProvider, useRnwind } from './components/rnwind-provider.mjs';
8
8
  export { useColor, useSize, useTheme, useToken } from './hooks/use-scheme.mjs';
9
9
 
10
10
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":["../../../../src/runtime/index.ts"],"sourcesContent":["\n\n\n\nexport {\n lookupCss,\n registerAtoms,\n registerBreakpoints,\n registerSchemeLoader,\n setWindowHeightProvider,\n getBreakpoints,\n activeBreakpointFor,\n lookupCss as _l,\n} from './lookup-css'\nexport { useR_ } from './components/rnwind-provider'\nexport type { HoistedClassName, InteractState, LookupInsets, SafeMarkerSpec } from './lookup-css'\nexport { useCss } from './hooks/use-css'\nexport { useInteract } from './hooks/use-interact'\nexport type { UseInteractResult } from './hooks/use-interact'\nexport { chainPress, chainFocus } from './chain-handlers'\nexport { InteractiveBox, InteractiveBox as _ib } from './interactive-box'\nexport type { InteractiveBoxProps, InteractiveSpec } from './interactive-box'\nexport { RnwindProvider, useRnwind } from './components/rnwind-provider'\nexport type { RnwindProviderProps, RnwindState, Insets } from './components/rnwind-provider'\nexport { useMountHaptic, triggerHaptic, triggerHaptic as _ht, useMountHaptic as _hm } from './haptics'\n\n// ──────────────────────────────────────────────────────────────────────\n// Internal aliases the babel transformer uses. Underscore-prefixed so\n// user code (which imports the public names above) can never collide\n// with what we inject at JSX sites — even if the user shadows\n// `lookupCss` / `useHaptics` / `InteractiveBox` with a local symbol,\n// the transformer's emitted code still references the private alias.\n// Don't import these in app code.\n// ──────────────────────────────────────────────────────────────────────\n/** @internal */\n\n/** @internal */\n\n/** @internal */\n\n/** @internal */\n\nexport type { HapticRequest, HapticTrigger, OnHaptics } from '../core/parser/haptics'\nexport type { AsLinearGradientProps, LinearGradientPoint } from './gradient-types'\nexport type { ThemeTable, ThemeTables } from '../core/types'\nexport { useTheme, useToken, useColor, useSize } from './hooks/use-scheme'\nexport type { Scheme, RnwindConfig } from './types'\n\n/**\n * Installed rnwind version, inlined at publish time. Compare against a pinned\n * string when integrating with build tooling that may see multiple rnwind\n * copies (e.g. workspace overrides).\n */\nexport const VERSION = '0.0.1' as const\n"],"names":[],"mappings":";;;;;;;;;AAgDA;;;;AAIG;AACI,MAAM,OAAO,GAAG;;;;"}
1
+ {"version":3,"file":"index.mjs","sources":["../../../../src/runtime/index.ts"],"sourcesContent":["export {\n lookupCss,\n registerAtoms,\n registerBreakpoints,\n registerSchemeLoader,\n setWindowHeightProvider,\n getBreakpoints,\n activeBreakpointFor,\n} from './lookup-css'\nexport type { HoistedClassName, InteractState, LookupInsets, SafeMarkerSpec } from './lookup-css'\nexport { wrap, wrapNamespace } from './wrap'\nexport { resolve, registerMolecules, registerGradients, registerHaptics } from './resolve'\nexport type { ResolvedCss } from './resolve'\nexport { useCss } from './hooks/use-css'\nexport { useInteract } from './hooks/use-interact'\nexport type { UseInteractResult } from './hooks/use-interact'\nexport { chainPress, chainFocus } from './chain-handlers'\nexport { RnwindProvider, useRnwind } from './components/rnwind-provider'\nexport type { RnwindProviderProps, RnwindState, Insets } from './components/rnwind-provider'\nexport type { HapticRequest, HapticTrigger, OnHaptics } from '../core/parser/haptics'\nexport type { AsLinearGradientProps, LinearGradientPoint } from './gradient-types'\nexport type { ThemeTable, ThemeTables } from '../core/types'\nexport { useTheme, useToken, useColor, useSize } from './hooks/use-scheme'\nexport type { Scheme, RnwindConfig } from './types'\n\n/**\n * Installed rnwind version, inlined at publish time. Compare against a pinned\n * string when integrating with build tooling that may see multiple rnwind\n * copies (e.g. workspace overrides).\n */\nexport const VERSION = '0.0.1' as const\n"],"names":[],"mappings":";;;;;;;;;AAyBA;;;;AAIG;AACI,MAAM,OAAO,GAAG;;;;"}
@@ -95,6 +95,13 @@ export declare function loadScheme(scheme: string): void;
95
95
  * @param atoms Plain record keyed by atom name.
96
96
  */
97
97
  export declare function registerAtoms(scheme: string, atoms: Record<string, unknown>): void;
98
+ /**
99
+ * Current registry version — bumps on every `registerAtoms` /
100
+ * `registerBreakpoints`. The molecule resolver folds it into its cache
101
+ * key so an HMR atom reload invalidates derived results.
102
+ * @returns Monotonic version counter.
103
+ */
104
+ export declare function getStyleVersion(): number;
98
105
  /**
99
106
  * Register the responsive-breakpoint table the manifest module emits at
100
107
  * load time. Replaces the prior table — calling with `{}` clears it.
@@ -407,6 +407,15 @@ function registerAtoms(scheme, atoms) {
407
407
  cache.atoms[scheme] = atoms;
408
408
  atomVersion += 1;
409
409
  }
410
+ /**
411
+ * Current registry version — bumps on every `registerAtoms` /
412
+ * `registerBreakpoints`. The molecule resolver folds it into its cache
413
+ * key so an HMR atom reload invalidates derived results.
414
+ * @returns Monotonic version counter.
415
+ */
416
+ function getStyleVersion() {
417
+ return atomVersion;
418
+ }
410
419
  /**
411
420
  * Register the responsive-breakpoint table the manifest module emits at
412
421
  * load time. Replaces the prior table — calling with `{}` clears it.
@@ -527,5 +536,5 @@ function __resetLookupCssState() {
527
536
  atomVersion += 1;
528
537
  }
529
538
 
530
- export { BASE_BREAKPOINT, __resetLookupCssState, activeBreakpointFor, getBreakpoints, loadScheme, lookupCss, registerAtoms, registerBreakpoints, registerSchemeLoader, setWindowHeightProvider };
539
+ export { BASE_BREAKPOINT, __resetLookupCssState, activeBreakpointFor, getBreakpoints, getStyleVersion, loadScheme, lookupCss, registerAtoms, registerBreakpoints, registerSchemeLoader, setWindowHeightProvider };
531
540
  //# sourceMappingURL=lookup-css.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"lookup-css.mjs","sources":["../../../../src/runtime/lookup-css.ts"],"sourcesContent":["/**\n * Runtime resolver for rnwind-transformed files.\n *\n * Hot path is ONE WeakMap.get + cached-array return for stable atoms\n * (no `active:`/`focus:`/`*-safe` variance beyond what the cache key\n * captures). First call per (hoist, scheme, stateIndex) walks the\n * atoms once, looks each up as\n *\n * `cache.atoms[scheme]?.[atom] ?? cache.atoms.common?.[atom]`\n *\n * and caches the result. `registerAtoms(scheme, record)` bumps a\n * version counter; the next lookup notices the mismatch and rebuilds.\n *\n * Keyframes are inlined directly into atom values via `animationName`\n * at build time — no separate registry.\n */\n\nimport type { RnwindState } from './components/rnwind-provider'\n\n/** Empty sentinel returned when the input is null / undefined / empty. */\nconst EMPTY_STYLES: readonly unknown[] = []\n\n/** Registry key for the always-loaded fallback scheme. */\nconst COMMON_SCHEME = 'common'\n\n/** Atom name prefix marking a press-state-gated atom. */\nconst ACTIVE_PREFIX = 'active:'\n\n/** Atom name prefix marking a focus-state-gated atom. */\nconst FOCUS_PREFIX = 'focus:'\n\n/** Partial record — missing keys resolve to undefined, which the fallback handles. */\ntype SchemeAtomsRecord = Partial<Record<string, unknown>>\n\n/** 0 = idle, 1 = active, 2 = focus, 3 = both. */\ntype StateIndex = 0 | 1 | 2 | 3\n\n/**\n * One entry in the sorted-by-threshold breakpoints array. The runtime\n * derives an atom's threshold by matching its `<prefix>:` against\n * `name`; the array form is preferred over a Map so the hot-path\n * `tierFor(width)` walk is a tight numeric loop.\n */\ninterface BreakpointEntry {\n readonly name: string\n readonly minWidth: number\n}\n\n/**\n * Process-global style cache. Replaced key-by-key by {@link registerAtoms}.\n * Plain record-of-records: `scheme → atom → style`. Active scheme\n * lookup is `cache.atoms[scheme]?.[atom]` — two property reads with\n * an `?? cache.atoms.common[atom]` fallback. No loops over the\n * registry, ever.\n *\n * `breakpoints` mirrors the build-time table the manifest module\n * registers via {@link registerBreakpoints} — `name → px-threshold` for\n * fast prefix-based atom filtering plus the sorted-by-threshold list\n * for cheap tier-index computation in `lookupCss`.\n */\nconst cache = {\n atoms: Object.create(null) as Partial<Record<string, SchemeAtomsRecord>>,\n breakpoints: Object.create(null) as Partial<Record<string, number>>,\n breakpointList: [] as readonly BreakpointEntry[],\n}\n\n/**\n * Bumps on every {@link registerAtoms} call. {@link HoistCache} entries\n * stamp themselves with the current version; a mismatch on read\n * triggers a rebuild so HMR-reloaded atoms propagate without manual\n * invalidation.\n */\nlet atomVersion = 0\n\n/** Optional window-height provider for the `screen-minus-y` marker. */\ntype WindowHeightProvider = () => number\nlet windowHeightProvider: WindowHeightProvider | null = null\n\n/**\n * Optional scheme loader. Registered by the generated manifest module\n * (`rnwind/__generated/schemes`) once at import time. SchemeProvider\n * calls it synchronously on every render with the active scheme name;\n * first call per scheme pulls the scheme's style module in via an\n * inline `require()` — subsequent calls are a no-op through Metro's\n * module cache.\n */\ntype SchemeLoader = (scheme: string) => void\nlet schemeLoader: SchemeLoader | null = null\n\n/** Module-scope flag so the missing-insets warning fires at most once. */\nlet WARNED_MISSING_INSETS = false\n\n/** Atoms we've already dev-warned about — keeps the noise to ONE line per typo per session. */\nconst WARNED_UNKNOWN_ATOMS = new Set<string>()\n\n/**\n * Compute the state-array index from the live interactState. Bit-or\n * encoding: 0 = idle, 1 = active, 2 = focus, 3 = both.\n * @param interactState Snapshot from `useInteract()` (or undefined).\n * @returns 0 / 1 / 2 / 3.\n */\nfunction stateIndexFor(interactState: InteractState | undefined): StateIndex {\n if (!interactState) return 0\n return (((interactState.active ? 1 : 0) | (interactState.focus ? 2 : 0)) as StateIndex)\n}\n\n/**\n * Fetch the px inset for one side. Falls back to 0 when insets is undefined.\n * @param side Compact side tag (`t` / `r` / `b` / `l`).\n * @param insets Active insets.\n * @returns Px value for that side.\n */\nfunction insetOf(side: string, insets: LookupInsets | undefined): number {\n if (!insets) return 0\n if (side === 't') return insets.top\n if (side === 'r') return insets.right\n if (side === 'b') return insets.bottom\n if (side === 'l') return insets.left\n return 0\n}\n\n/**\n * Collapse one safe-area marker into a concrete px number using the\n * active insets.\n * @param spec Marker spec tuple `[cssKey, sideTag, or, offset]`.\n * @param insets Active insets (or undefined → 0).\n * @returns Resolved px number.\n */\nfunction resolveMarker(spec: SafeMarkerSpec, insets: LookupInsets | undefined): number {\n const [, side, or_, offset] = spec\n if (side === 'screen-minus-y') {\n const h = windowHeightProvider ? windowHeightProvider() : 0\n return Math.max(0, h - insetOf('t', insets) - insetOf('b', insets))\n }\n let base = insetOf(side, insets)\n if (or_ !== undefined) base = Math.max(base, or_)\n if (offset !== undefined) base += offset\n return base\n}\n\n/**\n * Emit a one-shot dev warning when a safe-area atom resolves without\n * real insets in scope.\n * @param insets Insets received by the resolver.\n */\nfunction warnMissingInsetsOnce(insets: LookupInsets | undefined): void {\n if (WARNED_MISSING_INSETS) return\n const isDevelopment = typeof __DEV__ === 'undefined' || __DEV__\n if (!isDevelopment) return\n if (insets && (insets.top !== 0 || insets.right !== 0 || insets.bottom !== 0 || insets.left !== 0)) return\n WARNED_MISSING_INSETS = true\n // eslint-disable-next-line no-console\n console.warn(\n 'rnwind: a `*-safe` utility resolved with zero insets. Wire `insets` on <SchemeProvider> ' +\n '(e.g. `insets={useSafeAreaInsets()}` from react-native-safe-area-context).',\n )\n}\n\n/**\n * Resolve precomputed safe-area marker specs into a fresh RN style\n * object. Cannot be cached — insets vary per render with rotation /\n * keyboard.\n * @param specs Array of spec tuples.\n * @param insets Live safe-area insets.\n * @returns Fresh RN style object with concrete numbers.\n */\nfunction resolveSafe(specs: readonly SafeMarkerSpec[], insets: LookupInsets | undefined): Record<string, number> {\n warnMissingInsetsOnce(insets)\n const out: Record<string, number> = {}\n for (const spec of specs) out[spec[0]] = resolveMarker(spec, insets)\n return out\n}\n\n/**\n * Multiply `fontSize` / `lineHeight` in a resolved atom value by the\n * active font scale. Early-returns the original reference for any atom\n * that doesn't carry either property (most of them) — zero allocation\n * on the hot path for non-text atoms.\n * @param value Atom value as registered in the global table.\n * @param fontScale Multiplier from `useWindowDimensions().fontScale`.\n * @returns Scaled style object, or the original when no scaling applied.\n */\nfunction applyFontScale(value: unknown, fontScale: number): unknown {\n if (fontScale === 1) return value\n if (typeof value !== 'object' || value === null) return value\n const record = value as Record<string, unknown>\n const fs = record.fontSize\n const lh = record.lineHeight\n if (typeof fs !== 'number' && typeof lh !== 'number') return value\n const scaled: Record<string, unknown> = { ...record }\n if (typeof fs === 'number') scaled.fontSize = fs * fontScale\n if (typeof lh === 'number') scaled.lineHeight = lh * fontScale\n return scaled\n}\n\n/**\n * Read the precomputed safe-area marker spec list off an atom value.\n * Build-side `envelopeSafeMarkers` wraps safe atoms in\n * `{__safeStyle: [...]}`; this is a single property access.\n * @param value Atom value as registered in the global table.\n * @returns Spec array when the atom is safe-area, else null.\n */\nfunction readSafeSpecs(value: unknown): readonly SafeMarkerSpec[] | null {\n if (typeof value !== 'object' || value === null) return null\n const safe = (value as { __safeStyle?: readonly SafeMarkerSpec[] }).__safeStyle\n return safe ?? null\n}\n\n/**\n * Per-atom lookup. Two property reads: scheme's own table then the\n * common fallback. Returns `undefined` for unknown atoms — the caller\n * skips them.\n * @param scheme Active scheme.\n * @param atom Atom name.\n * @returns Resolved value, or undefined.\n */\nfunction lookupAtom(scheme: string, atom: string): unknown {\n const schemeTable = cache.atoms[scheme]\n if (schemeTable !== undefined) {\n const own = schemeTable[atom]\n if (own !== undefined) return own\n }\n const common = cache.atoms[COMMON_SCHEME]\n return common === undefined ? undefined : common[atom]\n}\n\n/**\n * Whether an atom should participate in a given interact-state index.\n * - idle (0): no `active:` / `focus:` atoms.\n * - active (1): base + `active:`.\n * - focus (2): base + `focus:`.\n * - both (3): base + `active:` + `focus:`.\n * @param atom Atom name.\n * @param stateIndex Encoded state (0/1/2/3).\n * @returns True when the atom should be emitted for this state.\n */\nfunction atomMatchesState(atom: string, stateIndex: StateIndex): boolean {\n // Cheap prefix check — check the first code point before the full\n // `startsWith` so we skip it for any atom whose first letter isn't\n // `a` / `f`.\n const code = atom.codePointAt(0)\n if (code === 97 /* a */ && atom.startsWith(ACTIVE_PREFIX)) return (stateIndex & 1) !== 0\n if (code === 102 /* f */ && atom.startsWith(FOCUS_PREFIX)) return (stateIndex & 2) !== 0\n return true\n}\n\n/**\n * Whether an atom passes the responsive-breakpoint gate for the\n * current `windowWidth`. Atoms without a registered `<prefix>:` are\n * always-on (the common case — `bg-red-500`, `active:bg-blue-700`).\n * Atoms whose first prefix matches a registered breakpoint name pass\n * only when `windowWidth >= threshold`.\n * @param atom Atom name.\n * @param windowWidth Live `useWindowDimensions().width` snapshot.\n * @returns True when the atom should be emitted for this width.\n */\nfunction atomMatchesBreakpoint(atom: string, windowWidth: number): boolean {\n const colon = atom.indexOf(':')\n if (colon === -1) return true\n const prefix = atom.slice(0, colon)\n const threshold = cache.breakpoints[prefix]\n if (threshold === undefined) return true\n return windowWidth >= threshold\n}\n\n/**\n * Tier index — count of registered breakpoints whose threshold is\n * `<= windowWidth`. Bounded by the breakpoint count, so it's a stable\n * cache-key dimension instead of the unbounded raw width. Crossings\n * happen ~5 times across the device-width spectrum, not per-pixel.\n * @param windowWidth Live width.\n * @returns Tier 0..N where N = `cache.breakpointList.length`.\n */\nfunction tierFor(windowWidth: number): number {\n let tier = 0\n for (const entry of cache.breakpointList) {\n if (windowWidth >= entry.minWidth) tier += 1\n else break\n }\n return tier\n}\n\n/**\n * Build the style array for a (hoist, scheme, state, width) tuple.\n * Walks the atom list, applies the interact-state and breakpoint\n * filters, resolves each atom via scheme→common fallback, and\n * envelopes safe values via {@link resolveSafe}.\n * @param atoms Atom name list (build-time constant).\n * @param scheme Active scheme.\n * @param stateIndex Encoded active/focus state.\n * @param insets Live safe-area insets.\n * @param fontScale Font scale multiplier.\n * @param windowWidth Live window width — gates `md:*` / `lg:*` atoms.\n * @returns Fresh style array.\n */\nfunction buildStyleArray(\n atoms: readonly string[],\n scheme: string,\n stateIndex: StateIndex,\n insets: LookupInsets | undefined,\n fontScale: number,\n windowWidth: number,\n): readonly unknown[] {\n const out: unknown[] = []\n for (const atom of atoms) {\n if (!atomMatchesState(atom, stateIndex)) continue\n if (!atomMatchesBreakpoint(atom, windowWidth)) continue\n const value = lookupAtom(scheme, atom)\n if (value === undefined) {\n warnUnknownAtomOnce(atom)\n continue\n }\n const safe = readSafeSpecs(value)\n const resolved = safe === null ? value : resolveSafe(safe, insets)\n out.push(applyFontScale(resolved, fontScale))\n }\n return out\n}\n\n/**\n * Emit a one-shot dev warning when an atom name doesn't resolve in the\n * registry. The two real causes are a typo (`bg-red-501`) or a class\n * the build-time scanner never saw because it lives in a string the\n * oxide tokeniser can't see (e.g. computed at runtime). Either way, a\n * silent empty style is the worst possible UX — surface it.\n *\n * Filters cosmetic non-issues: empty strings, build-time `__safeStyle`\n * envelopes that wandered in, etc.\n * @param atom Class name that didn't resolve.\n */\nfunction warnUnknownAtomOnce(atom: string): void {\n if (atom.length === 0) return\n const isDevelopment = typeof __DEV__ === 'undefined' || __DEV__\n if (!isDevelopment) return\n if (WARNED_UNKNOWN_ATOMS.has(atom)) return\n WARNED_UNKNOWN_ATOMS.add(atom)\n // eslint-disable-next-line no-console\n console.warn(\n `rnwind: unknown class \"${atom}\" — typo, or the class is built dynamically and the build-time ` +\n `scanner never saw it. Static literals + ternaries are scanned automatically; runtime-built ` +\n `strings need to appear somewhere as a literal so oxide can pick them up.`,\n )\n}\n\n/**\n * Per-hoist cache entry. `version` stamps `atomVersion` at build time\n * so HMR reloads (which bump the counter) invalidate cleanly on next\n * read. `hasSafe` prevents caching results whose values depend on\n * per-render insets. `byKey` maps `\"${scheme}|${stateIndex}\"` to the\n * cached result.\n */\ninterface HoistCache {\n version: number\n hasSafe: boolean\n byKey: Partial<Record<string, readonly unknown[]>>\n}\n\n/**\n * Per-atom-list cache keyed on the hoist reference. WeakMap so\n * hoists GC with their host module on HMR.\n */\nconst resultCache = new WeakMap<readonly string[], HoistCache>()\n\n/**\n * Walk the atom list once to detect safe-area atoms — results that\n * vary per render with `insets`. When any atom envelopes safe specs\n * we skip the cache and rebuild every call.\n * @param atoms Hoist atom list.\n * @param scheme Active scheme.\n * @returns Whether the hoist resolves a safe atom under this scheme.\n */\nfunction detectHasSafe(atoms: readonly string[], scheme: string): boolean {\n for (const atom of atoms) {\n const value = lookupAtom(scheme, atom)\n if (readSafeSpecs(value) !== null) return true\n }\n return false\n}\n\n/**\n * Cache-keyed resolution for the common static-schema case. Returns a\n * stable array reference across renders until `atomVersion` bumps.\n * For hoists containing safe atoms — which depend on per-render\n * insets — rebuilds every call.\n *\n * The `tier` dimension keeps the cache bounded under responsive\n * variants: instead of keying on raw `windowWidth` (which would explode\n * the cache to one entry per pixel), we key on the count of registered\n * breakpoints whose threshold is reached. That gives at most\n * `breakpointCount + 1` cache rows per (scheme, state, fontScale).\n * @param atoms Hoist atom list.\n * @param scheme Active scheme.\n * @param stateIndex Encoded interact state.\n * @param insets Live safe-area insets.\n * @param fontScale Font scale multiplier.\n * @param windowWidth Live window width.\n * @returns Style array.\n */\nfunction lookupCached(\n atoms: readonly string[],\n scheme: string,\n stateIndex: StateIndex,\n insets: LookupInsets | undefined,\n fontScale: number,\n windowWidth: number,\n): readonly unknown[] {\n let entry = resultCache.get(atoms)\n if (entry?.version !== atomVersion) {\n entry = { version: atomVersion, hasSafe: detectHasSafe(atoms, scheme), byKey: Object.create(null) }\n resultCache.set(atoms, entry)\n }\n if (entry.hasSafe) return buildStyleArray(atoms, scheme, stateIndex, insets, fontScale, windowWidth)\n const tier = tierFor(windowWidth)\n const key = `${scheme}|${stateIndex}|${fontScale}|${tier}`\n const cached = entry.byKey[key]\n if (cached !== undefined) return cached\n const fresh = buildStyleArray(atoms, scheme, stateIndex, insets, fontScale, windowWidth)\n entry.byKey[key] = fresh\n return fresh\n}\n\n/**\n * Per-render snapshot of which interactive states (active, focus) are\n * currently engaged. Forwarded from the `useInteract()` hook the\n * transformer injects.\n */\nexport interface InteractState {\n active?: boolean\n focus?: boolean\n}\n\n/**\n * Safe-area insets bundle the transformer passes to `lookupCss` when a\n * file uses any `*-safe` utility.\n */\nexport interface LookupInsets {\n top: number\n right: number\n bottom: number\n left: number\n}\n\n\n/**\n * Precomputed safe-area marker spec emitted by the build-side\n * `envelopeSafeMarkers`. Tuple form: `[cssKey, sideTag, or, offset]`.\n */\nexport type SafeMarkerSpec = readonly [string, string, number | undefined, number | undefined]\n\n/** Type alias: the atom-list build output the transformer emits. */\nexport type HoistedClassName = readonly string[]\n\n/**\n * Register a window-height provider used by the `screen-minus-y`\n * safe-area variant. When not wired, `h-screen-safe` resolves to `0`.\n * @param provider Callback returning the current window height in px.\n */\nexport function setWindowHeightProvider(provider: WindowHeightProvider | null): void {\n windowHeightProvider = provider\n}\n\n/**\n * Register the scheme-loader function exported by the generated\n * manifest module. Called once at manifest-module evaluation time —\n * subsequent registrations override the previous loader (useful for\n * tests).\n * @param loader Manifest's `ensureSchemeLoaded` function, or null to\n * detach (tests).\n */\nexport function registerSchemeLoader(loader: SchemeLoader | null): void {\n schemeLoader = loader\n}\n\n/**\n * Ensure the given scheme's style module is loaded. Safe to call in\n * render — zero-cost after the first call per scheme thanks to\n * Metro's module cache, and a no-op when no loader is registered\n * (tests, or a bundle without rnwind-transformed sources).\n * @param scheme Active scheme name.\n */\nexport function loadScheme(scheme: string): void {\n if (schemeLoader) schemeLoader(scheme)\n}\n\n/**\n * Register (or re-register) one scheme's atoms in the global registry.\n * Pure property assignment — no iteration, no allocation. The version\n * counter bump invalidates every hoist-level result cache lazily on\n * next read.\n * @param scheme Registry key — `'common'` for the always-loaded\n * fallback, or a variant name (`'dark'`, `'light'`, `'brand'`, ...).\n * @param atoms Plain record keyed by atom name.\n */\nexport function registerAtoms(scheme: string, atoms: Record<string, unknown>): void {\n cache.atoms[scheme] = atoms\n atomVersion += 1\n}\n\n/**\n * Register the responsive-breakpoint table the manifest module emits at\n * load time. Replaces the prior table — calling with `{}` clears it.\n * Bumps `atomVersion` so any cached lookup invalidates on next read,\n * which matters during a theme HMR cycle that adds/removes breakpoints.\n * @param breakpoints Breakpoint name → minimum-width threshold (px).\n */\nexport function registerBreakpoints(breakpoints: Record<string, number>): void {\n const fresh: Partial<Record<string, number>> = Object.create(null)\n const list: BreakpointEntry[] = []\n for (const name of Object.keys(breakpoints)) {\n const minWidth = breakpoints[name]\n if (!Number.isFinite(minWidth) || minWidth <= 0) continue\n fresh[name] = minWidth\n list.push({ name, minWidth })\n }\n list.sort((a, b) => a.minWidth - b.minWidth || a.name.localeCompare(b.name))\n cache.breakpoints = fresh\n cache.breakpointList = list\n atomVersion += 1\n}\n\n/**\n * Snapshot of the registered breakpoints, for callers that want to\n * compute their own derivations (e.g. the provider deriving the active\n * breakpoint name). Returns a fresh array — callers can iterate without\n * worrying about concurrent mutation from a manifest reload.\n * @returns Breakpoints sorted by ascending min-width threshold.\n */\nexport function getBreakpoints(): readonly BreakpointEntry[] {\n return cache.breakpointList\n}\n\n/**\n * Sentinel name returned by {@link activeBreakpointFor} ONLY when no\n * breakpoints are registered at all (bundle without rnwind-transformed\n * sources, fresh test setup). When at least one breakpoint is\n * registered, the function falls back to the smallest registered name\n * instead — so phone-width devices (402 dp on a stock iPhone, well\n * below `sm = 640`) report `activeBreakpoint === 'sm'` rather than the\n * abstract `'base'`. This matches the user expectation that the value\n * is always a real Tailwind breakpoint label they can branch on.\n *\n * Note: this is decoupled from the className filter. `sm:*` atoms\n * still only fire at `windowWidth >= 640` per Tailwind's mobile-first\n * spec — `activeBreakpoint === 'sm'` at 402 means \"I'm in the smallest\n * tier\", not \"`sm:` classes are firing\".\n */\nexport const BASE_BREAKPOINT = 'base'\n\n/**\n * Resolve the currently-active breakpoint name for a width:\n * - `windowWidth >= some threshold` → the highest matching breakpoint name.\n * - below every registered threshold → the smallest registered name.\n * - no breakpoints registered → {@link BASE_BREAKPOINT}.\n * Always returns a string so consumers can branch on it without\n * null-handling.\n * @param windowWidth Live window width in px.\n * @returns Active breakpoint name (never null).\n */\nexport function activeBreakpointFor(windowWidth: number): string {\n const list = cache.breakpointList\n if (list.length === 0) return BASE_BREAKPOINT\n let active: string = list[0]!.name\n for (const entry of list) {\n if (windowWidth >= entry.minWidth) active = entry.name\n else break\n }\n return active\n}\n\n/**\n * Resolve a className input against the active rnwind context. Hot\n * path:\n * - Array input (build hoist): ONE WeakMap.get + ONE record-access\n * + cached array return. No per-render allocation when there's no\n * userStyle and the hoist has no safe atoms.\n * - String input (dynamic `className={expr}`): tokenise + walk.\n * @param input Hoisted atom list or raw className string.\n * @param ctx Rnwind context — `{scheme, fontScale, insets}` (extra\n * fields ignored). Pass the result of `useRnwind()` directly.\n * @param userStyle Optional caller-supplied style appended last.\n * @param interactState Live active/focus flags from `useInteract()`.\n * @returns Style array for React Native's `style` prop.\n */\nexport function lookupCss(\n input: HoistedClassName | string | null | undefined,\n ctx: RnwindState,\n userStyle?: unknown,\n interactState?: InteractState,\n): readonly unknown[] {\n if (input === null || input === undefined) {\n return userStyle === undefined || userStyle === null ? EMPTY_STYLES : [userStyle]\n }\n const { scheme, insets, fontScale, windowWidth } = ctx\n if (typeof input === 'string') {\n const trimmed = input.trim()\n if (trimmed.length === 0) {\n return userStyle === undefined || userStyle === null ? EMPTY_STYLES : [userStyle]\n }\n const atoms = trimmed.split(/\\s+/)\n const out = buildStyleArray(atoms, scheme, stateIndexFor(interactState), insets, fontScale, windowWidth)\n if (userStyle === undefined || userStyle === null) return out\n return [...out, userStyle]\n }\n const base = lookupCached(input, scheme, stateIndexFor(interactState), insets, fontScale, windowWidth)\n if (userStyle === undefined || userStyle === null) return base\n return [...base, userStyle]\n}\n\n/** Test-only — clear the global registry between suites. */\nexport function __resetLookupCssState(): void {\n for (const key of Object.keys(cache.atoms)) delete cache.atoms[key]\n for (const key of Object.keys(cache.breakpoints)) delete cache.breakpoints[key]\n cache.breakpointList = []\n windowHeightProvider = null\n schemeLoader = null\n WARNED_MISSING_INSETS = false\n WARNED_UNKNOWN_ATOMS.clear()\n atomVersion += 1\n}\n\n/**\n * Test-only sugar: accept a single-scheme record and register it as the\n * `common` table.\n * @param record Atom name → value record (registered under `common`).\n */\nexport function __registerAtomsFromRecord(record: Record<string, unknown>): void {\n registerAtoms(COMMON_SCHEME, record)\n}\n"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;AAeG;AAIH;AACA,MAAM,YAAY,GAAuB,EAAE;AAE3C;AACA,MAAM,aAAa,GAAG,QAAQ;AAE9B;AACA,MAAM,aAAa,GAAG,SAAS;AAE/B;AACA,MAAM,YAAY,GAAG,QAAQ;AAmB7B;;;;;;;;;;;AAWG;AACH,MAAM,KAAK,GAAG;AACZ,IAAA,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,CAA+C;AACxE,IAAA,WAAW,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAoC;AACnE,IAAA,cAAc,EAAE,EAAgC;CACjD;AAED;;;;;AAKG;AACH,IAAI,WAAW,GAAG,CAAC;AAInB,IAAI,oBAAoB,GAAgC,IAAI;AAW5D,IAAI,YAAY,GAAwB,IAAI;AAE5C;AACA,IAAI,qBAAqB,GAAG,KAAK;AAEjC;AACA,MAAM,oBAAoB,GAAG,IAAI,GAAG,EAAU;AAE9C;;;;;AAKG;AACH,SAAS,aAAa,CAAC,aAAwC,EAAA;AAC7D,IAAA,IAAI,CAAC,aAAa;AAAE,QAAA,OAAO,CAAC;AAC5B,IAAA,QAAS,CAAC,aAAa,CAAC,MAAM,GAAG,CAAC,GAAG,CAAC,KAAK,aAAa,CAAC,KAAK,GAAG,CAAC,GAAG,CAAC,CAAC;AACzE;AAEA;;;;;AAKG;AACH,SAAS,OAAO,CAAC,IAAY,EAAE,MAAgC,EAAA;AAC7D,IAAA,IAAI,CAAC,MAAM;AAAE,QAAA,OAAO,CAAC;IACrB,IAAI,IAAI,KAAK,GAAG;QAAE,OAAO,MAAM,CAAC,GAAG;IACnC,IAAI,I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AAE,QAAA,OAAO,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC;IACnE,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC;AAAE,QAAA,OAAO,KAAK,CAAC,WAAW,CAAC,GAAG,CAAC;AAC/E,IAAA,KAAK,CAAC,cAAc,GAAG,EAAE;IACzB,oBAAoB,GAAG,IAAI;IAC3B,YAAY,GAAG,IAAI;IACnB,qBAAqB,GAAG,KAAK;IAC7B,oBAAoB,CAAC,KAAK,EAAE;IAC5B,WAAW,IAAI,CAAC;AAClB;;;;"}
1
+ {"version":3,"file":"lookup-css.mjs","sources":["../../../../src/runtime/lookup-css.ts"],"sourcesContent":["/**\n * Runtime resolver for rnwind-transformed files.\n *\n * Hot path is ONE WeakMap.get + cached-array return for stable atoms\n * (no `active:`/`focus:`/`*-safe` variance beyond what the cache key\n * captures). First call per (hoist, scheme, stateIndex) walks the\n * atoms once, looks each up as\n *\n * `cache.atoms[scheme]?.[atom] ?? cache.atoms.common?.[atom]`\n *\n * and caches the result. `registerAtoms(scheme, record)` bumps a\n * version counter; the next lookup notices the mismatch and rebuilds.\n *\n * Keyframes are inlined directly into atom values via `animationName`\n * at build time — no separate registry.\n */\n\nimport type { RnwindState } from './components/rnwind-provider'\n\n/** Empty sentinel returned when the input is null / undefined / empty. */\nconst EMPTY_STYLES: readonly unknown[] = []\n\n/** Registry key for the always-loaded fallback scheme. */\nconst COMMON_SCHEME = 'common'\n\n/** Atom name prefix marking a press-state-gated atom. */\nconst ACTIVE_PREFIX = 'active:'\n\n/** Atom name prefix marking a focus-state-gated atom. */\nconst FOCUS_PREFIX = 'focus:'\n\n/** Partial record — missing keys resolve to undefined, which the fallback handles. */\ntype SchemeAtomsRecord = Partial<Record<string, unknown>>\n\n/** 0 = idle, 1 = active, 2 = focus, 3 = both. */\ntype StateIndex = 0 | 1 | 2 | 3\n\n/**\n * One entry in the sorted-by-threshold breakpoints array. The runtime\n * derives an atom's threshold by matching its `<prefix>:` against\n * `name`; the array form is preferred over a Map so the hot-path\n * `tierFor(width)` walk is a tight numeric loop.\n */\ninterface BreakpointEntry {\n readonly name: string\n readonly minWidth: number\n}\n\n/**\n * Process-global style cache. Replaced key-by-key by {@link registerAtoms}.\n * Plain record-of-records: `scheme → atom → style`. Active scheme\n * lookup is `cache.atoms[scheme]?.[atom]` — two property reads with\n * an `?? cache.atoms.common[atom]` fallback. No loops over the\n * registry, ever.\n *\n * `breakpoints` mirrors the build-time table the manifest module\n * registers via {@link registerBreakpoints} — `name → px-threshold` for\n * fast prefix-based atom filtering plus the sorted-by-threshold list\n * for cheap tier-index computation in `lookupCss`.\n */\nconst cache = {\n atoms: Object.create(null) as Partial<Record<string, SchemeAtomsRecord>>,\n breakpoints: Object.create(null) as Partial<Record<string, number>>,\n breakpointList: [] as readonly BreakpointEntry[],\n}\n\n/**\n * Bumps on every {@link registerAtoms} call. {@link HoistCache} entries\n * stamp themselves with the current version; a mismatch on read\n * triggers a rebuild so HMR-reloaded atoms propagate without manual\n * invalidation.\n */\nlet atomVersion = 0\n\n/** Optional window-height provider for the `screen-minus-y` marker. */\ntype WindowHeightProvider = () => number\nlet windowHeightProvider: WindowHeightProvider | null = null\n\n/**\n * Optional scheme loader. Registered by the generated manifest module\n * (`rnwind/__generated/schemes`) once at import time. SchemeProvider\n * calls it synchronously on every render with the active scheme name;\n * first call per scheme pulls the scheme's style module in via an\n * inline `require()` — subsequent calls are a no-op through Metro's\n * module cache.\n */\ntype SchemeLoader = (scheme: string) => void\nlet schemeLoader: SchemeLoader | null = null\n\n/** Module-scope flag so the missing-insets warning fires at most once. */\nlet WARNED_MISSING_INSETS = false\n\n/** Atoms we've already dev-warned about — keeps the noise to ONE line per typo per session. */\nconst WARNED_UNKNOWN_ATOMS = new Set<string>()\n\n/**\n * Compute the state-array index from the live interactState. Bit-or\n * encoding: 0 = idle, 1 = active, 2 = focus, 3 = both.\n * @param interactState Snapshot from `useInteract()` (or undefined).\n * @returns 0 / 1 / 2 / 3.\n */\nfunction stateIndexFor(interactState: InteractState | undefined): StateIndex {\n if (!interactState) return 0\n return (((interactState.active ? 1 : 0) | (interactState.focus ? 2 : 0)) as StateIndex)\n}\n\n/**\n * Fetch the px inset for one side. Falls back to 0 when insets is undefined.\n * @param side Compact side tag (`t` / `r` / `b` / `l`).\n * @param insets Active insets.\n * @returns Px value for that side.\n */\nfunction insetOf(side: string, insets: LookupInsets | undefined): number {\n if (!insets) return 0\n if (side === 't') return insets.top\n if (side === 'r') return insets.right\n if (side === 'b') return insets.bottom\n if (side === 'l') return insets.left\n return 0\n}\n\n/**\n * Collapse one safe-area marker into a concrete px number using the\n * active insets.\n * @param spec Marker spec tuple `[cssKey, sideTag, or, offset]`.\n * @param insets Active insets (or undefined → 0).\n * @returns Resolved px number.\n */\nfunction resolveMarker(spec: SafeMarkerSpec, insets: LookupInsets | undefined): number {\n const [, side, or_, offset] = spec\n if (side === 'screen-minus-y') {\n const h = windowHeightProvider ? windowHeightProvider() : 0\n return Math.max(0, h - insetOf('t', insets) - insetOf('b', insets))\n }\n let base = insetOf(side, insets)\n if (or_ !== undefined) base = Math.max(base, or_)\n if (offset !== undefined) base += offset\n return base\n}\n\n/**\n * Emit a one-shot dev warning when a safe-area atom resolves without\n * real insets in scope.\n * @param insets Insets received by the resolver.\n */\nfunction warnMissingInsetsOnce(insets: LookupInsets | undefined): void {\n if (WARNED_MISSING_INSETS) return\n const isDevelopment = typeof __DEV__ === 'undefined' || __DEV__\n if (!isDevelopment) return\n if (insets && (insets.top !== 0 || insets.right !== 0 || insets.bottom !== 0 || insets.left !== 0)) return\n WARNED_MISSING_INSETS = true\n // eslint-disable-next-line no-console\n console.warn(\n 'rnwind: a `*-safe` utility resolved with zero insets. Wire `insets` on <SchemeProvider> ' +\n '(e.g. `insets={useSafeAreaInsets()}` from react-native-safe-area-context).',\n )\n}\n\n/**\n * Resolve precomputed safe-area marker specs into a fresh RN style\n * object. Cannot be cached — insets vary per render with rotation /\n * keyboard.\n * @param specs Array of spec tuples.\n * @param insets Live safe-area insets.\n * @returns Fresh RN style object with concrete numbers.\n */\nfunction resolveSafe(specs: readonly SafeMarkerSpec[], insets: LookupInsets | undefined): Record<string, number> {\n warnMissingInsetsOnce(insets)\n const out: Record<string, number> = {}\n for (const spec of specs) out[spec[0]] = resolveMarker(spec, insets)\n return out\n}\n\n/**\n * Multiply `fontSize` / `lineHeight` in a resolved atom value by the\n * active font scale. Early-returns the original reference for any atom\n * that doesn't carry either property (most of them) — zero allocation\n * on the hot path for non-text atoms.\n * @param value Atom value as registered in the global table.\n * @param fontScale Multiplier from `useWindowDimensions().fontScale`.\n * @returns Scaled style object, or the original when no scaling applied.\n */\nfunction applyFontScale(value: unknown, fontScale: number): unknown {\n if (fontScale === 1) return value\n if (typeof value !== 'object' || value === null) return value\n const record = value as Record<string, unknown>\n const fs = record.fontSize\n const lh = record.lineHeight\n if (typeof fs !== 'number' && typeof lh !== 'number') return value\n const scaled: Record<string, unknown> = { ...record }\n if (typeof fs === 'number') scaled.fontSize = fs * fontScale\n if (typeof lh === 'number') scaled.lineHeight = lh * fontScale\n return scaled\n}\n\n/**\n * Read the precomputed safe-area marker spec list off an atom value.\n * Build-side `envelopeSafeMarkers` wraps safe atoms in\n * `{__safeStyle: [...]}`; this is a single property access.\n * @param value Atom value as registered in the global table.\n * @returns Spec array when the atom is safe-area, else null.\n */\nfunction readSafeSpecs(value: unknown): readonly SafeMarkerSpec[] | null {\n if (typeof value !== 'object' || value === null) return null\n const safe = (value as { __safeStyle?: readonly SafeMarkerSpec[] }).__safeStyle\n return safe ?? null\n}\n\n/**\n * Per-atom lookup. Two property reads: scheme's own table then the\n * common fallback. Returns `undefined` for unknown atoms — the caller\n * skips them.\n * @param scheme Active scheme.\n * @param atom Atom name.\n * @returns Resolved value, or undefined.\n */\nfunction lookupAtom(scheme: string, atom: string): unknown {\n const schemeTable = cache.atoms[scheme]\n if (schemeTable !== undefined) {\n const own = schemeTable[atom]\n if (own !== undefined) return own\n }\n const common = cache.atoms[COMMON_SCHEME]\n return common === undefined ? undefined : common[atom]\n}\n\n/**\n * Whether an atom should participate in a given interact-state index.\n * - idle (0): no `active:` / `focus:` atoms.\n * - active (1): base + `active:`.\n * - focus (2): base + `focus:`.\n * - both (3): base + `active:` + `focus:`.\n * @param atom Atom name.\n * @param stateIndex Encoded state (0/1/2/3).\n * @returns True when the atom should be emitted for this state.\n */\nfunction atomMatchesState(atom: string, stateIndex: StateIndex): boolean {\n // Cheap prefix check — check the first code point before the full\n // `startsWith` so we skip it for any atom whose first letter isn't\n // `a` / `f`.\n const code = atom.codePointAt(0)\n if (code === 97 /* a */ && atom.startsWith(ACTIVE_PREFIX)) return (stateIndex & 1) !== 0\n if (code === 102 /* f */ && atom.startsWith(FOCUS_PREFIX)) return (stateIndex & 2) !== 0\n return true\n}\n\n/**\n * Whether an atom passes the responsive-breakpoint gate for the\n * current `windowWidth`. Atoms without a registered `<prefix>:` are\n * always-on (the common case — `bg-red-500`, `active:bg-blue-700`).\n * Atoms whose first prefix matches a registered breakpoint name pass\n * only when `windowWidth >= threshold`.\n * @param atom Atom name.\n * @param windowWidth Live `useWindowDimensions().width` snapshot.\n * @returns True when the atom should be emitted for this width.\n */\nfunction atomMatchesBreakpoint(atom: string, windowWidth: number): boolean {\n const colon = atom.indexOf(':')\n if (colon === -1) return true\n const prefix = atom.slice(0, colon)\n const threshold = cache.breakpoints[prefix]\n if (threshold === undefined) return true\n return windowWidth >= threshold\n}\n\n/**\n * Tier index — count of registered breakpoints whose threshold is\n * `<= windowWidth`. Bounded by the breakpoint count, so it's a stable\n * cache-key dimension instead of the unbounded raw width. Crossings\n * happen ~5 times across the device-width spectrum, not per-pixel.\n * @param windowWidth Live width.\n * @returns Tier 0..N where N = `cache.breakpointList.length`.\n */\nfunction tierFor(windowWidth: number): number {\n let tier = 0\n for (const entry of cache.breakpointList) {\n if (windowWidth >= entry.minWidth) tier += 1\n else break\n }\n return tier\n}\n\n/**\n * Build the style array for a (hoist, scheme, state, width) tuple.\n * Walks the atom list, applies the interact-state and breakpoint\n * filters, resolves each atom via scheme→common fallback, and\n * envelopes safe values via {@link resolveSafe}.\n * @param atoms Atom name list (build-time constant).\n * @param scheme Active scheme.\n * @param stateIndex Encoded active/focus state.\n * @param insets Live safe-area insets.\n * @param fontScale Font scale multiplier.\n * @param windowWidth Live window width — gates `md:*` / `lg:*` atoms.\n * @returns Fresh style array.\n */\nfunction buildStyleArray(\n atoms: readonly string[],\n scheme: string,\n stateIndex: StateIndex,\n insets: LookupInsets | undefined,\n fontScale: number,\n windowWidth: number,\n): readonly unknown[] {\n const out: unknown[] = []\n for (const atom of atoms) {\n if (!atomMatchesState(atom, stateIndex)) continue\n if (!atomMatchesBreakpoint(atom, windowWidth)) continue\n const value = lookupAtom(scheme, atom)\n if (value === undefined) {\n warnUnknownAtomOnce(atom)\n continue\n }\n const safe = readSafeSpecs(value)\n const resolved = safe === null ? value : resolveSafe(safe, insets)\n out.push(applyFontScale(resolved, fontScale))\n }\n return out\n}\n\n/**\n * Emit a one-shot dev warning when an atom name doesn't resolve in the\n * registry. The two real causes are a typo (`bg-red-501`) or a class\n * the build-time scanner never saw because it lives in a string the\n * oxide tokeniser can't see (e.g. computed at runtime). Either way, a\n * silent empty style is the worst possible UX — surface it.\n *\n * Filters cosmetic non-issues: empty strings, build-time `__safeStyle`\n * envelopes that wandered in, etc.\n * @param atom Class name that didn't resolve.\n */\nfunction warnUnknownAtomOnce(atom: string): void {\n if (atom.length === 0) return\n const isDevelopment = typeof __DEV__ === 'undefined' || __DEV__\n if (!isDevelopment) return\n if (WARNED_UNKNOWN_ATOMS.has(atom)) return\n WARNED_UNKNOWN_ATOMS.add(atom)\n // eslint-disable-next-line no-console\n console.warn(\n `rnwind: unknown class \"${atom}\" — typo, or the class is built dynamically and the build-time ` +\n `scanner never saw it. Static literals + ternaries are scanned automatically; runtime-built ` +\n `strings need to appear somewhere as a literal so oxide can pick them up.`,\n )\n}\n\n/**\n * Per-hoist cache entry. `version` stamps `atomVersion` at build time\n * so HMR reloads (which bump the counter) invalidate cleanly on next\n * read. `hasSafe` prevents caching results whose values depend on\n * per-render insets. `byKey` maps `\"${scheme}|${stateIndex}\"` to the\n * cached result.\n */\ninterface HoistCache {\n version: number\n hasSafe: boolean\n byKey: Partial<Record<string, readonly unknown[]>>\n}\n\n/**\n * Per-atom-list cache keyed on the hoist reference. WeakMap so\n * hoists GC with their host module on HMR.\n */\nconst resultCache = new WeakMap<readonly string[], HoistCache>()\n\n/**\n * Walk the atom list once to detect safe-area atoms — results that\n * vary per render with `insets`. When any atom envelopes safe specs\n * we skip the cache and rebuild every call.\n * @param atoms Hoist atom list.\n * @param scheme Active scheme.\n * @returns Whether the hoist resolves a safe atom under this scheme.\n */\nfunction detectHasSafe(atoms: readonly string[], scheme: string): boolean {\n for (const atom of atoms) {\n const value = lookupAtom(scheme, atom)\n if (readSafeSpecs(value) !== null) return true\n }\n return false\n}\n\n/**\n * Cache-keyed resolution for the common static-schema case. Returns a\n * stable array reference across renders until `atomVersion` bumps.\n * For hoists containing safe atoms — which depend on per-render\n * insets — rebuilds every call.\n *\n * The `tier` dimension keeps the cache bounded under responsive\n * variants: instead of keying on raw `windowWidth` (which would explode\n * the cache to one entry per pixel), we key on the count of registered\n * breakpoints whose threshold is reached. That gives at most\n * `breakpointCount + 1` cache rows per (scheme, state, fontScale).\n * @param atoms Hoist atom list.\n * @param scheme Active scheme.\n * @param stateIndex Encoded interact state.\n * @param insets Live safe-area insets.\n * @param fontScale Font scale multiplier.\n * @param windowWidth Live window width.\n * @returns Style array.\n */\nfunction lookupCached(\n atoms: readonly string[],\n scheme: string,\n stateIndex: StateIndex,\n insets: LookupInsets | undefined,\n fontScale: number,\n windowWidth: number,\n): readonly unknown[] {\n let entry = resultCache.get(atoms)\n if (entry?.version !== atomVersion) {\n entry = { version: atomVersion, hasSafe: detectHasSafe(atoms, scheme), byKey: Object.create(null) }\n resultCache.set(atoms, entry)\n }\n if (entry.hasSafe) return buildStyleArray(atoms, scheme, stateIndex, insets, fontScale, windowWidth)\n const tier = tierFor(windowWidth)\n const key = `${scheme}|${stateIndex}|${fontScale}|${tier}`\n const cached = entry.byKey[key]\n if (cached !== undefined) return cached\n const fresh = buildStyleArray(atoms, scheme, stateIndex, insets, fontScale, windowWidth)\n entry.byKey[key] = fresh\n return fresh\n}\n\n/**\n * Per-render snapshot of which interactive states (active, focus) are\n * currently engaged. Forwarded from the `useInteract()` hook the\n * transformer injects.\n */\nexport interface InteractState {\n active?: boolean\n focus?: boolean\n}\n\n/**\n * Safe-area insets bundle the transformer passes to `lookupCss` when a\n * file uses any `*-safe` utility.\n */\nexport interface LookupInsets {\n top: number\n right: number\n bottom: number\n left: number\n}\n\n\n/**\n * Precomputed safe-area marker spec emitted by the build-side\n * `envelopeSafeMarkers`. Tuple form: `[cssKey, sideTag, or, offset]`.\n */\nexport type SafeMarkerSpec = readonly [string, string, number | undefined, number | undefined]\n\n/** Type alias: the atom-list build output the transformer emits. */\nexport type HoistedClassName = readonly string[]\n\n/**\n * Register a window-height provider used by the `screen-minus-y`\n * safe-area variant. When not wired, `h-screen-safe` resolves to `0`.\n * @param provider Callback returning the current window height in px.\n */\nexport function setWindowHeightProvider(provider: WindowHeightProvider | null): void {\n windowHeightProvider = provider\n}\n\n/**\n * Register the scheme-loader function exported by the generated\n * manifest module. Called once at manifest-module evaluation time —\n * subsequent registrations override the previous loader (useful for\n * tests).\n * @param loader Manifest's `ensureSchemeLoaded` function, or null to\n * detach (tests).\n */\nexport function registerSchemeLoader(loader: SchemeLoader | null): void {\n schemeLoader = loader\n}\n\n/**\n * Ensure the given scheme's style module is loaded. Safe to call in\n * render — zero-cost after the first call per scheme thanks to\n * Metro's module cache, and a no-op when no loader is registered\n * (tests, or a bundle without rnwind-transformed sources).\n * @param scheme Active scheme name.\n */\nexport function loadScheme(scheme: string): void {\n if (schemeLoader) schemeLoader(scheme)\n}\n\n/**\n * Register (or re-register) one scheme's atoms in the global registry.\n * Pure property assignment — no iteration, no allocation. The version\n * counter bump invalidates every hoist-level result cache lazily on\n * next read.\n * @param scheme Registry key — `'common'` for the always-loaded\n * fallback, or a variant name (`'dark'`, `'light'`, `'brand'`, ...).\n * @param atoms Plain record keyed by atom name.\n */\nexport function registerAtoms(scheme: string, atoms: Record<string, unknown>): void {\n cache.atoms[scheme] = atoms\n atomVersion += 1\n}\n\n/**\n * Current registry version — bumps on every `registerAtoms` /\n * `registerBreakpoints`. The molecule resolver folds it into its cache\n * key so an HMR atom reload invalidates derived results.\n * @returns Monotonic version counter.\n */\nexport function getStyleVersion(): number {\n return atomVersion\n}\n\n/**\n * Register the responsive-breakpoint table the manifest module emits at\n * load time. Replaces the prior table — calling with `{}` clears it.\n * Bumps `atomVersion` so any cached lookup invalidates on next read,\n * which matters during a theme HMR cycle that adds/removes breakpoints.\n * @param breakpoints Breakpoint name → minimum-width threshold (px).\n */\nexport function registerBreakpoints(breakpoints: Record<string, number>): void {\n const fresh: Partial<Record<string, number>> = Object.create(null)\n const list: BreakpointEntry[] = []\n for (const name of Object.keys(breakpoints)) {\n const minWidth = breakpoints[name]\n if (!Number.isFinite(minWidth) || minWidth <= 0) continue\n fresh[name] = minWidth\n list.push({ name, minWidth })\n }\n list.sort((a, b) => a.minWidth - b.minWidth || a.name.localeCompare(b.name))\n cache.breakpoints = fresh\n cache.breakpointList = list\n atomVersion += 1\n}\n\n/**\n * Snapshot of the registered breakpoints, for callers that want to\n * compute their own derivations (e.g. the provider deriving the active\n * breakpoint name). Returns a fresh array — callers can iterate without\n * worrying about concurrent mutation from a manifest reload.\n * @returns Breakpoints sorted by ascending min-width threshold.\n */\nexport function getBreakpoints(): readonly BreakpointEntry[] {\n return cache.breakpointList\n}\n\n/**\n * Sentinel name returned by {@link activeBreakpointFor} ONLY when no\n * breakpoints are registered at all (bundle without rnwind-transformed\n * sources, fresh test setup). When at least one breakpoint is\n * registered, the function falls back to the smallest registered name\n * instead — so phone-width devices (402 dp on a stock iPhone, well\n * below `sm = 640`) report `activeBreakpoint === 'sm'` rather than the\n * abstract `'base'`. This matches the user expectation that the value\n * is always a real Tailwind breakpoint label they can branch on.\n *\n * Note: this is decoupled from the className filter. `sm:*` atoms\n * still only fire at `windowWidth >= 640` per Tailwind's mobile-first\n * spec — `activeBreakpoint === 'sm'` at 402 means \"I'm in the smallest\n * tier\", not \"`sm:` classes are firing\".\n */\nexport const BASE_BREAKPOINT = 'base'\n\n/**\n * Resolve the currently-active breakpoint name for a width:\n * - `windowWidth >= some threshold` → the highest matching breakpoint name.\n * - below every registered threshold → the smallest registered name.\n * - no breakpoints registered → {@link BASE_BREAKPOINT}.\n * Always returns a string so consumers can branch on it without\n * null-handling.\n * @param windowWidth Live window width in px.\n * @returns Active breakpoint name (never null).\n */\nexport function activeBreakpointFor(windowWidth: number): string {\n const list = cache.breakpointList\n if (list.length === 0) return BASE_BREAKPOINT\n let active: string = list[0]!.name\n for (const entry of list) {\n if (windowWidth >= entry.minWidth) active = entry.name\n else break\n }\n return active\n}\n\n/**\n * Resolve a className input against the active rnwind context. Hot\n * path:\n * - Array input (build hoist): ONE WeakMap.get + ONE record-access\n * + cached array return. No per-render allocation when there's no\n * userStyle and the hoist has no safe atoms.\n * - String input (dynamic `className={expr}`): tokenise + walk.\n * @param input Hoisted atom list or raw className string.\n * @param ctx Rnwind context — `{scheme, fontScale, insets}` (extra\n * fields ignored). Pass the result of `useRnwind()` directly.\n * @param userStyle Optional caller-supplied style appended last.\n * @param interactState Live active/focus flags from `useInteract()`.\n * @returns Style array for React Native's `style` prop.\n */\nexport function lookupCss(\n input: HoistedClassName | string | null | undefined,\n ctx: RnwindState,\n userStyle?: unknown,\n interactState?: InteractState,\n): readonly unknown[] {\n if (input === null || input === undefined) {\n return userStyle === undefined || userStyle === null ? EMPTY_STYLES : [userStyle]\n }\n const { scheme, insets, fontScale, windowWidth } = ctx\n if (typeof input === 'string') {\n const trimmed = input.trim()\n if (trimmed.length === 0) {\n return userStyle === undefined || userStyle === null ? EMPTY_STYLES : [userStyle]\n }\n const atoms = trimmed.split(/\\s+/)\n const out = buildStyleArray(atoms, scheme, stateIndexFor(interactState), insets, fontScale, windowWidth)\n if (userStyle === undefined || userStyle === null) return out\n return [...out, userStyle]\n }\n const base = lookupCached(input, scheme, stateIndexFor(interactState), insets, fontScale, windowWidth)\n if (userStyle === undefined || userStyle === null) return base\n return [...base, userStyle]\n}\n\n/** Test-only — clear the global registry between suites. */\nexport function __resetLookupCssState(): void {\n for (const key of Object.keys(cache.atoms)) delete cache.atoms[key]\n for (const key of Object.keys(cache.breakpoints)) delete cache.breakpoints[key]\n cache.breakpointList = []\n windowHeightProvider = null\n schemeLoader = null\n WARNED_MISSING_INSETS = false\n WARNED_UNKNOWN_ATOMS.clear()\n atomVersion += 1\n}\n\n/**\n * Test-only sugar: accept a single-scheme record and register it as the\n * `common` table.\n * @param record Atom name → value record (registered under `common`).\n */\nexport function __registerAtomsFromRecord(record: Record<string, unknown>): void {\n registerAtoms(COMMON_SCHEME, record)\n}\n"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;AAeG;AAIH;AACA,MAAM,YAAY,GAAuB,EAAE;AAE3C;AACA,MAAM,aAAa,GAAG,QAAQ;AAE9B;AACA,MAAM,aAAa,GAAG,SAAS;AAE/B;AACA,MAAM,YAAY,GAAG,QAAQ;AAmB7B;;;;;;;;;;;AAWG;AACH,MAAM,KAAK,GAAG;AACZ,IAAA,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,CAA+C;AACxE,IAAA,WAAW,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAoC;AACnE,IAAA,cAAc,EAAE,EAAgC;CACjD;AAED;;;;;AAKG;AACH,IAAI,WAAW,GAAG,CAAC;AAInB,IAAI,oBAAoB,GAAgC,IAAI;AAW5D,IAAI,YAAY,GAAwB,IAAI;AAE5C;AACA,IAAI,qBAAqB,GAAG,KAAK;AAEjC;AACA,MAAM,oBAAoB,GAAG,IAAI,GAAG,EAA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AS,IAAI,SAAS,KAAK,IAAI;AAAE,YAAA,OAAO,GAAG;AAC7D,QAAA,OAAO,CAAC,GAAG,GAAG,EAAE,SAAS,CAAC;IAC5B;AACA,IAAA,MAAM,IAAI,GAAG,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,aAAa,CAAC,aAAa,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,CAAC;AACtG,IAAA,IAAI,SAAS,KAAK,SAAS,IAAI,SAAS,KAAK,IAAI;AAAE,QAAA,OAAO,IAAI;AAC9D,IAAA,OAAO,CAAC,GAAG,IAAI,EAAE,SAAS,CAAC;AAC7B;AAEA;SACgB,qBAAqB,GAAA;IACnC,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC;AAAE,QAAA,OAAO,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC;IACnE,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC;AAAE,QAAA,OAAO,KAAK,CAAC,WAAW,CAAC,GAAG,CAAC;AAC/E,IAAA,KAAK,CAAC,cAAc,GAAG,EAAE;IACzB,oBAAoB,GAAG,IAAI;IAC3B,YAAY,GAAG,IAAI;IACnB,qBAAqB,GAAG,KAAK;IAC7B,oBAAoB,CAAC,KAAK,EAAE;IAC5B,WAAW,IAAI,CAAC;AAClB;;;;"}
@@ -0,0 +1,61 @@
1
+ import { type InteractState } from './lookup-css';
2
+ import type { RnwindState } from './components/rnwind-provider';
3
+ import type { GradientAtomInfo } from '../core/parser/gradient';
4
+ import type { HapticRequest, HapticTrigger } from '../core/parser/haptics';
5
+ /** A unit-square gradient endpoint. */
6
+ interface GradientPoint {
7
+ readonly x: number;
8
+ readonly y: number;
9
+ }
10
+ /** Rich resolution: the RN `style` plus any className-derived props. */
11
+ export interface ResolvedCss {
12
+ /** RN `style` value — a single molecule object (by ref) or an atom array. */
13
+ readonly style: unknown;
14
+ /** Gradient stop colours (when the className is a complete gradient). */
15
+ readonly colors?: readonly string[];
16
+ /** Gradient start point. */
17
+ readonly start?: GradientPoint;
18
+ /** Gradient end point. */
19
+ readonly end?: GradientPoint;
20
+ /** Text truncation line count. */
21
+ readonly numberOfLines?: number;
22
+ /** Text ellipsize mode. */
23
+ readonly ellipsizeMode?: 'tail' | 'clip';
24
+ /** Haptic requests present on the className, for the wrap to dispatch. */
25
+ readonly haptics?: readonly {
26
+ readonly request: HapticRequest;
27
+ readonly trigger: HapticTrigger;
28
+ }[];
29
+ }
30
+ /**
31
+ * Register one scheme's pre-merged molecules (atom-merged literal
32
+ * classNames). Merges onto any existing entries for the scheme.
33
+ * @param scheme Scheme name (or `'common'`).
34
+ * @param entries Normalized className → merged style object.
35
+ */
36
+ export declare function registerMolecules(scheme: string, entries: Record<string, unknown>): void;
37
+ /**
38
+ * Register the gradient atom map (atom name → role + resolved colour).
39
+ * @param map Atom name → gradient info.
40
+ */
41
+ export declare function registerGradients(map: Record<string, GradientAtomInfo>): void;
42
+ /**
43
+ * Register the haptic atom map (atom name → request).
44
+ * @param map Atom name → haptic request.
45
+ */
46
+ export declare function registerHaptics(map: Record<string, HapticRequest>): void;
47
+ /**
48
+ * Resolve a className against the reactive context into a style plus any
49
+ * className-derived props. Molecule-first (one lookup, by reference),
50
+ * atom-fallback for unseen / context-dependent strings, cached per
51
+ * `(className, state)`.
52
+ * @param className Raw className string.
53
+ * @param state Rnwind context from `useRnwind()`.
54
+ * @param userStyle Optional inline style appended last (wins).
55
+ * @param interactState Live active/focus flags (for `active:`/`focus:` atoms).
56
+ * @returns The resolved style + feature props.
57
+ */
58
+ export declare function resolve(className: string | null | undefined, state: RnwindState, userStyle?: unknown, interactState?: InteractState): ResolvedCss;
59
+ /** Test-only — clear the molecule / gradient / haptic registries + cache. */
60
+ export declare function __resetResolveState(): void;
61
+ export { normalizeClassName } from '../core/normalize-classname';