rnwind 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/core/parser/animation.cjs +427 -0
- package/lib/cjs/core/parser/animation.cjs.map +1 -0
- package/lib/cjs/core/parser/animation.d.ts +126 -0
- package/lib/cjs/core/parser/border-dispatcher.cjs +180 -0
- package/lib/cjs/core/parser/border-dispatcher.cjs.map +1 -0
- package/lib/cjs/core/parser/border-dispatcher.d.ts +15 -0
- package/lib/cjs/core/parser/case-convert.cjs +15 -0
- package/lib/cjs/core/parser/case-convert.cjs.map +1 -0
- package/lib/cjs/core/parser/case-convert.d.ts +6 -0
- package/lib/cjs/core/parser/color-properties-dispatcher.cjs +84 -0
- package/lib/cjs/core/parser/color-properties-dispatcher.cjs.map +1 -0
- package/lib/cjs/core/parser/color-properties-dispatcher.d.ts +19 -0
- package/lib/cjs/core/parser/color.cjs +164 -0
- package/lib/cjs/core/parser/color.cjs.map +1 -0
- package/lib/cjs/core/parser/color.d.ts +12 -0
- package/lib/cjs/core/parser/constants.cjs +21 -0
- package/lib/cjs/core/parser/constants.cjs.map +1 -0
- package/lib/cjs/core/parser/constants.d.ts +8 -0
- package/lib/cjs/core/parser/declaration.cjs +347 -0
- package/lib/cjs/core/parser/declaration.cjs.map +1 -0
- package/lib/cjs/core/parser/declaration.d.ts +15 -0
- package/lib/cjs/core/parser/gradient.cjs +132 -0
- package/lib/cjs/core/parser/gradient.cjs.map +1 -0
- package/lib/cjs/core/parser/gradient.d.ts +59 -0
- package/lib/cjs/core/parser/haptics.cjs +73 -0
- package/lib/cjs/core/parser/haptics.cjs.map +1 -0
- package/lib/cjs/core/parser/haptics.d.ts +47 -0
- package/lib/cjs/core/parser/index.d.ts +8 -0
- package/lib/cjs/core/parser/keyframes.cjs +95 -0
- package/lib/cjs/core/parser/keyframes.cjs.map +1 -0
- package/lib/cjs/core/parser/keyframes.d.ts +26 -0
- package/lib/cjs/core/parser/layout-dispatcher.cjs +100 -0
- package/lib/cjs/core/parser/layout-dispatcher.cjs.map +1 -0
- package/lib/cjs/core/parser/layout-dispatcher.d.ts +14 -0
- package/lib/cjs/core/parser/length.cjs +96 -0
- package/lib/cjs/core/parser/length.cjs.map +1 -0
- package/lib/cjs/core/parser/length.d.ts +48 -0
- package/lib/cjs/core/parser/motion-dispatcher.cjs +77 -0
- package/lib/cjs/core/parser/motion-dispatcher.cjs.map +1 -0
- package/lib/cjs/core/parser/motion-dispatcher.d.ts +11 -0
- package/lib/cjs/core/parser/property.cjs +22 -0
- package/lib/cjs/core/parser/property.cjs.map +1 -0
- package/lib/cjs/core/parser/property.d.ts +8 -0
- package/lib/cjs/core/parser/safe-area.cjs +404 -0
- package/lib/cjs/core/parser/safe-area.cjs.map +1 -0
- package/lib/cjs/core/parser/safe-area.d.ts +39 -0
- package/lib/cjs/core/parser/selector.cjs +22 -0
- package/lib/cjs/core/parser/selector.cjs.map +1 -0
- package/lib/cjs/core/parser/selector.d.ts +11 -0
- package/lib/cjs/core/parser/shorthand.cjs +156 -0
- package/lib/cjs/core/parser/shorthand.cjs.map +1 -0
- package/lib/cjs/core/parser/shorthand.d.ts +61 -0
- package/lib/cjs/core/parser/text-truncate.cjs +78 -0
- package/lib/cjs/core/parser/text-truncate.cjs.map +1 -0
- package/lib/cjs/core/parser/text-truncate.d.ts +44 -0
- package/lib/cjs/core/parser/theme-vars.cjs +414 -0
- package/lib/cjs/core/parser/theme-vars.cjs.map +1 -0
- package/lib/cjs/core/parser/theme-vars.d.ts +61 -0
- package/lib/cjs/core/parser/tokens.cjs +304 -0
- package/lib/cjs/core/parser/tokens.cjs.map +1 -0
- package/lib/cjs/core/parser/tokens.d.ts +45 -0
- package/lib/cjs/core/parser/transform.cjs +198 -0
- package/lib/cjs/core/parser/transform.cjs.map +1 -0
- package/lib/cjs/core/parser/transform.d.ts +36 -0
- package/lib/cjs/core/parser/tw-parser.cjs +1567 -0
- package/lib/cjs/core/parser/tw-parser.cjs.map +1 -0
- package/lib/cjs/core/parser/tw-parser.d.ts +194 -0
- package/lib/cjs/core/parser/types.d.ts +37 -0
- package/lib/cjs/core/parser/typography-dispatcher.cjs +93 -0
- package/lib/cjs/core/parser/typography-dispatcher.cjs.map +1 -0
- package/lib/cjs/core/parser/typography-dispatcher.d.ts +11 -0
- package/lib/cjs/core/parser/typography.cjs +97 -0
- package/lib/cjs/core/parser/typography.cjs.map +1 -0
- package/lib/cjs/core/parser/typography.d.ts +43 -0
- package/lib/cjs/core/style-builder/build-style.cjs +397 -0
- package/lib/cjs/core/style-builder/build-style.cjs.map +1 -0
- package/lib/cjs/core/style-builder/build-style.d.ts +54 -0
- package/lib/cjs/core/style-builder/index.d.ts +3 -0
- package/lib/cjs/core/style-builder/union-builder.cjs +326 -0
- package/lib/cjs/core/style-builder/union-builder.cjs.map +1 -0
- package/lib/cjs/core/style-builder/union-builder.d.ts +128 -0
- package/lib/cjs/core/types.d.ts +14 -0
- package/lib/cjs/metro/dts.cjs +127 -0
- package/lib/cjs/metro/dts.cjs.map +1 -0
- package/lib/cjs/metro/dts.d.ts +16 -0
- package/lib/cjs/metro/index.cjs +19 -0
- package/lib/cjs/metro/index.cjs.map +1 -0
- package/lib/cjs/metro/index.d.ts +9 -0
- package/lib/cjs/metro/resolver.cjs +47 -0
- package/lib/cjs/metro/resolver.cjs.map +1 -0
- package/lib/cjs/metro/resolver.d.ts +22 -0
- package/lib/cjs/metro/state.cjs +251 -0
- package/lib/cjs/metro/state.cjs.map +1 -0
- package/lib/cjs/metro/state.d.ts +72 -0
- package/lib/cjs/metro/transform-ast.cjs +1255 -0
- package/lib/cjs/metro/transform-ast.cjs.map +1 -0
- package/lib/cjs/metro/transform-ast.d.ts +73 -0
- package/lib/cjs/metro/transformer.cjs +345 -0
- package/lib/cjs/metro/transformer.cjs.map +1 -0
- package/lib/cjs/metro/transformer.d.ts +47 -0
- package/lib/cjs/metro/warn-unknown-classes.cjs +86 -0
- package/lib/cjs/metro/warn-unknown-classes.cjs.map +1 -0
- package/lib/cjs/metro/warn-unknown-classes.d.ts +21 -0
- package/lib/cjs/metro/with-config.cjs +196 -0
- package/lib/cjs/metro/with-config.cjs.map +1 -0
- package/lib/cjs/metro/with-config.d.ts +57 -0
- package/lib/cjs/runtime/chain-handlers.cjs +37 -0
- package/lib/cjs/runtime/chain-handlers.cjs.map +1 -0
- package/lib/cjs/runtime/chain-handlers.d.ts +33 -0
- package/lib/cjs/runtime/components/rnwind-provider.cjs +98 -0
- package/lib/cjs/runtime/components/rnwind-provider.cjs.map +1 -0
- package/lib/cjs/runtime/components/rnwind-provider.d.ts +84 -0
- package/lib/cjs/runtime/gradient-types.d.ts +58 -0
- package/lib/cjs/runtime/haptics.cjs +113 -0
- package/lib/cjs/runtime/haptics.cjs.map +1 -0
- package/lib/cjs/runtime/haptics.d.ts +48 -0
- package/lib/cjs/runtime/hooks/use-css.cjs +21 -0
- package/lib/cjs/runtime/hooks/use-css.cjs.map +1 -0
- package/lib/cjs/runtime/hooks/use-css.d.ts +11 -0
- package/lib/cjs/runtime/hooks/use-interact.cjs +46 -0
- package/lib/cjs/runtime/hooks/use-interact.cjs.map +1 -0
- package/lib/cjs/runtime/hooks/use-interact.d.ts +42 -0
- package/lib/cjs/runtime/hooks/use-scheme.cjs +68 -0
- package/lib/cjs/runtime/hooks/use-scheme.cjs.map +1 -0
- package/lib/cjs/runtime/hooks/use-scheme.d.ts +34 -0
- package/lib/cjs/runtime/index.cjs +45 -0
- package/lib/cjs/runtime/index.cjs.map +1 -0
- package/lib/cjs/runtime/index.d.ts +27 -0
- package/lib/cjs/runtime/interactive-box.cjs +35 -0
- package/lib/cjs/runtime/interactive-box.cjs.map +1 -0
- package/lib/cjs/runtime/interactive-box.d.ts +40 -0
- package/lib/cjs/runtime/lookup-css.cjs +542 -0
- package/lib/cjs/runtime/lookup-css.cjs.map +1 -0
- package/lib/cjs/runtime/lookup-css.d.ts +164 -0
- package/lib/cjs/runtime/types.d.ts +29 -0
- package/lib/cjs/testing/index.cjs +367 -0
- package/lib/cjs/testing/index.cjs.map +1 -0
- package/lib/cjs/testing/index.d.ts +145 -0
- package/lib/esm/core/parser/animation.d.ts +126 -0
- package/lib/esm/core/parser/animation.mjs +408 -0
- package/lib/esm/core/parser/animation.mjs.map +1 -0
- package/lib/esm/core/parser/border-dispatcher.d.ts +15 -0
- package/lib/esm/core/parser/border-dispatcher.mjs +178 -0
- package/lib/esm/core/parser/border-dispatcher.mjs.map +1 -0
- package/lib/esm/core/parser/case-convert.d.ts +6 -0
- package/lib/esm/core/parser/case-convert.mjs +13 -0
- package/lib/esm/core/parser/case-convert.mjs.map +1 -0
- package/lib/esm/core/parser/color-properties-dispatcher.d.ts +19 -0
- package/lib/esm/core/parser/color-properties-dispatcher.mjs +82 -0
- package/lib/esm/core/parser/color-properties-dispatcher.mjs.map +1 -0
- package/lib/esm/core/parser/color.d.ts +12 -0
- package/lib/esm/core/parser/color.mjs +162 -0
- package/lib/esm/core/parser/color.mjs.map +1 -0
- package/lib/esm/core/parser/constants.d.ts +8 -0
- package/lib/esm/core/parser/constants.mjs +13 -0
- package/lib/esm/core/parser/constants.mjs.map +1 -0
- package/lib/esm/core/parser/declaration.d.ts +15 -0
- package/lib/esm/core/parser/declaration.mjs +345 -0
- package/lib/esm/core/parser/declaration.mjs.map +1 -0
- package/lib/esm/core/parser/gradient.d.ts +59 -0
- package/lib/esm/core/parser/gradient.mjs +130 -0
- package/lib/esm/core/parser/gradient.mjs.map +1 -0
- package/lib/esm/core/parser/haptics.d.ts +47 -0
- package/lib/esm/core/parser/haptics.mjs +71 -0
- package/lib/esm/core/parser/haptics.mjs.map +1 -0
- package/lib/esm/core/parser/index.d.ts +8 -0
- package/lib/esm/core/parser/keyframes.d.ts +26 -0
- package/lib/esm/core/parser/keyframes.mjs +91 -0
- package/lib/esm/core/parser/keyframes.mjs.map +1 -0
- package/lib/esm/core/parser/layout-dispatcher.d.ts +14 -0
- package/lib/esm/core/parser/layout-dispatcher.mjs +98 -0
- package/lib/esm/core/parser/layout-dispatcher.mjs.map +1 -0
- package/lib/esm/core/parser/length.d.ts +48 -0
- package/lib/esm/core/parser/length.mjs +90 -0
- package/lib/esm/core/parser/length.mjs.map +1 -0
- package/lib/esm/core/parser/motion-dispatcher.d.ts +11 -0
- package/lib/esm/core/parser/motion-dispatcher.mjs +75 -0
- package/lib/esm/core/parser/motion-dispatcher.mjs.map +1 -0
- package/lib/esm/core/parser/property.d.ts +8 -0
- package/lib/esm/core/parser/property.mjs +20 -0
- package/lib/esm/core/parser/property.mjs.map +1 -0
- package/lib/esm/core/parser/safe-area.d.ts +39 -0
- package/lib/esm/core/parser/safe-area.mjs +402 -0
- package/lib/esm/core/parser/safe-area.mjs.map +1 -0
- package/lib/esm/core/parser/selector.d.ts +11 -0
- package/lib/esm/core/parser/selector.mjs +20 -0
- package/lib/esm/core/parser/selector.mjs.map +1 -0
- package/lib/esm/core/parser/shorthand.d.ts +61 -0
- package/lib/esm/core/parser/shorthand.mjs +148 -0
- package/lib/esm/core/parser/shorthand.mjs.map +1 -0
- package/lib/esm/core/parser/text-truncate.d.ts +44 -0
- package/lib/esm/core/parser/text-truncate.mjs +75 -0
- package/lib/esm/core/parser/text-truncate.mjs.map +1 -0
- package/lib/esm/core/parser/theme-vars.d.ts +61 -0
- package/lib/esm/core/parser/theme-vars.mjs +409 -0
- package/lib/esm/core/parser/theme-vars.mjs.map +1 -0
- package/lib/esm/core/parser/tokens.d.ts +45 -0
- package/lib/esm/core/parser/tokens.mjs +298 -0
- package/lib/esm/core/parser/tokens.mjs.map +1 -0
- package/lib/esm/core/parser/transform.d.ts +36 -0
- package/lib/esm/core/parser/transform.mjs +193 -0
- package/lib/esm/core/parser/transform.mjs.map +1 -0
- package/lib/esm/core/parser/tw-parser.d.ts +194 -0
- package/lib/esm/core/parser/tw-parser.mjs +1565 -0
- package/lib/esm/core/parser/tw-parser.mjs.map +1 -0
- package/lib/esm/core/parser/types.d.ts +37 -0
- package/lib/esm/core/parser/typography-dispatcher.d.ts +11 -0
- package/lib/esm/core/parser/typography-dispatcher.mjs +91 -0
- package/lib/esm/core/parser/typography-dispatcher.mjs.map +1 -0
- package/lib/esm/core/parser/typography.d.ts +43 -0
- package/lib/esm/core/parser/typography.mjs +91 -0
- package/lib/esm/core/parser/typography.mjs.map +1 -0
- package/lib/esm/core/style-builder/build-style.d.ts +54 -0
- package/lib/esm/core/style-builder/build-style.mjs +395 -0
- package/lib/esm/core/style-builder/build-style.mjs.map +1 -0
- package/lib/esm/core/style-builder/index.d.ts +3 -0
- package/lib/esm/core/style-builder/union-builder.d.ts +128 -0
- package/lib/esm/core/style-builder/union-builder.mjs +324 -0
- package/lib/esm/core/style-builder/union-builder.mjs.map +1 -0
- package/lib/esm/core/types.d.ts +14 -0
- package/lib/esm/metro/dts.d.ts +16 -0
- package/lib/esm/metro/dts.mjs +125 -0
- package/lib/esm/metro/dts.mjs.map +1 -0
- package/lib/esm/metro/index.d.ts +9 -0
- package/lib/esm/metro/index.mjs +6 -0
- package/lib/esm/metro/index.mjs.map +1 -0
- package/lib/esm/metro/resolver.d.ts +22 -0
- package/lib/esm/metro/resolver.mjs +43 -0
- package/lib/esm/metro/resolver.mjs.map +1 -0
- package/lib/esm/metro/state.d.ts +72 -0
- package/lib/esm/metro/state.mjs +243 -0
- package/lib/esm/metro/state.mjs.map +1 -0
- package/lib/esm/metro/transform-ast.d.ts +73 -0
- package/lib/esm/metro/transform-ast.mjs +1234 -0
- package/lib/esm/metro/transform-ast.mjs.map +1 -0
- package/lib/esm/metro/transformer.d.ts +47 -0
- package/lib/esm/metro/transformer.mjs +322 -0
- package/lib/esm/metro/transformer.mjs.map +1 -0
- package/lib/esm/metro/warn-unknown-classes.d.ts +21 -0
- package/lib/esm/metro/warn-unknown-classes.mjs +84 -0
- package/lib/esm/metro/warn-unknown-classes.mjs.map +1 -0
- package/lib/esm/metro/with-config.d.ts +57 -0
- package/lib/esm/metro/with-config.mjs +194 -0
- package/lib/esm/metro/with-config.mjs.map +1 -0
- package/lib/esm/runtime/chain-handlers.d.ts +33 -0
- package/lib/esm/runtime/chain-handlers.mjs +34 -0
- package/lib/esm/runtime/chain-handlers.mjs.map +1 -0
- package/lib/esm/runtime/components/rnwind-provider.d.ts +84 -0
- package/lib/esm/runtime/components/rnwind-provider.mjs +94 -0
- package/lib/esm/runtime/components/rnwind-provider.mjs.map +1 -0
- package/lib/esm/runtime/gradient-types.d.ts +58 -0
- package/lib/esm/runtime/haptics.d.ts +48 -0
- package/lib/esm/runtime/haptics.mjs +110 -0
- package/lib/esm/runtime/haptics.mjs.map +1 -0
- package/lib/esm/runtime/hooks/use-css.d.ts +11 -0
- package/lib/esm/runtime/hooks/use-css.mjs +19 -0
- package/lib/esm/runtime/hooks/use-css.mjs.map +1 -0
- package/lib/esm/runtime/hooks/use-interact.d.ts +42 -0
- package/lib/esm/runtime/hooks/use-interact.mjs +44 -0
- package/lib/esm/runtime/hooks/use-interact.mjs.map +1 -0
- package/lib/esm/runtime/hooks/use-scheme.d.ts +34 -0
- package/lib/esm/runtime/hooks/use-scheme.mjs +63 -0
- package/lib/esm/runtime/hooks/use-scheme.mjs.map +1 -0
- package/lib/esm/runtime/index.d.ts +27 -0
- package/lib/esm/runtime/index.mjs +18 -0
- package/lib/esm/runtime/index.mjs.map +1 -0
- package/lib/esm/runtime/interactive-box.d.ts +40 -0
- package/lib/esm/runtime/interactive-box.mjs +33 -0
- package/lib/esm/runtime/interactive-box.mjs.map +1 -0
- package/lib/esm/runtime/lookup-css.d.ts +164 -0
- package/lib/esm/runtime/lookup-css.mjs +531 -0
- package/lib/esm/runtime/lookup-css.mjs.map +1 -0
- package/lib/esm/runtime/types.d.ts +29 -0
- package/lib/esm/testing/index.d.ts +145 -0
- package/lib/esm/testing/index.mjs +344 -0
- package/lib/esm/testing/index.mjs.map +1 -0
- package/package.json +79 -13
- package/preset.css +1171 -0
- package/src/core/parser/animation.ts +404 -0
- package/src/core/parser/border-dispatcher.ts +176 -0
- package/src/core/parser/case-convert.ts +10 -0
- package/src/core/parser/color-properties-dispatcher.ts +78 -0
- package/src/core/parser/color.ts +157 -0
- package/src/core/parser/constants.ts +11 -0
- package/src/core/parser/declaration.ts +340 -0
- package/src/core/parser/gradient.ts +148 -0
- package/src/core/parser/haptics.ts +88 -0
- package/src/core/parser/index.ts +8 -0
- package/src/core/parser/keyframes.ts +84 -0
- package/src/core/parser/layout-dispatcher.ts +92 -0
- package/src/core/parser/length.ts +100 -0
- package/src/core/parser/motion-dispatcher.ts +89 -0
- package/src/core/parser/property.ts +15 -0
- package/src/core/parser/safe-area.ts +404 -0
- package/src/core/parser/selector.ts +17 -0
- package/src/core/parser/shorthand.ts +152 -0
- package/src/core/parser/text-truncate.ts +79 -0
- package/src/core/parser/theme-vars.ts +412 -0
- package/src/core/parser/tokens.ts +286 -0
- package/src/core/parser/transform.ts +195 -0
- package/src/core/parser/tw-parser.ts +1709 -0
- package/src/core/parser/types.ts +45 -0
- package/src/core/parser/typography-dispatcher.ts +83 -0
- package/src/core/parser/typography.ts +83 -0
- package/src/core/style-builder/build-style.ts +442 -0
- package/src/core/style-builder/index.ts +3 -0
- package/src/core/style-builder/union-builder.ts +328 -0
- package/src/core/types.ts +15 -0
- package/src/metro/dts.ts +128 -0
- package/src/metro/index.ts +9 -0
- package/src/metro/resolver.ts +42 -0
- package/src/metro/state.ts +257 -0
- package/src/metro/transform-ast.ts +1498 -0
- package/src/metro/transformer.ts +347 -0
- package/src/metro/warn-unknown-classes.ts +79 -0
- package/src/metro/with-config.ts +229 -0
- package/src/runtime/chain-handlers.ts +47 -0
- package/src/runtime/components/rnwind-provider.tsx +144 -0
- package/src/runtime/gradient-types.ts +60 -0
- package/src/runtime/haptics.ts +120 -0
- package/src/runtime/hooks/use-css.ts +16 -0
- package/src/runtime/hooks/use-interact.ts +65 -0
- package/src/runtime/hooks/use-scheme.ts +63 -0
- package/src/runtime/index.ts +54 -0
- package/src/runtime/interactive-box.tsx +57 -0
- package/src/runtime/lookup-css.ts +628 -0
- package/src/runtime/types.ts +32 -0
- package/src/testing/index.ts +507 -0
- package/src/types/tailwindcss-node.d.ts +33 -0
- package/src/index.ts +0 -1
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import { type SourceEntry } from '@tailwindcss/oxide';
|
|
2
|
+
import { type GradientAtomInfo } from './gradient';
|
|
3
|
+
import { type HapticRequest } from './haptics';
|
|
4
|
+
import type { RNStyle } from './types';
|
|
5
|
+
/** Parser configuration — one instance per Metro session, theme CSS fixed. */
|
|
6
|
+
export interface TailwindParserConfig {
|
|
7
|
+
/**
|
|
8
|
+
* Theme CSS passed to `@tailwindcss/node`'s compiler. Typically the
|
|
9
|
+
* user's `global.css`. We append `theme(inline)` to the tailwindcss
|
|
10
|
+
* import so Tailwind resolves every `var(--theme-token)` at compile
|
|
11
|
+
* time — that gives lightningcss fully-typed values (integers / rems /
|
|
12
|
+
* colors) instead of unresolved `var()` references.
|
|
13
|
+
*/
|
|
14
|
+
themeCss: string;
|
|
15
|
+
/**
|
|
16
|
+
* Glob sources the oxide Scanner walks at project-scan time
|
|
17
|
+
* (`parseProject()`). Typically
|
|
18
|
+
* `[{ base: projectRoot, pattern: '**\/*.{ts,tsx,js,jsx}', negated: false }]`
|
|
19
|
+
* plus negated globs for `node_modules` and the rnwind cache dir.
|
|
20
|
+
*
|
|
21
|
+
* When omitted, the scanner has no sources and `parseProject()`
|
|
22
|
+
* returns an empty result — `parseAtoms()` (per-file, content-driven)
|
|
23
|
+
* still works without sources.
|
|
24
|
+
*/
|
|
25
|
+
sources?: readonly SourceEntry[];
|
|
26
|
+
}
|
|
27
|
+
/** Per-call inputs — Metro hands us file content + filename; we derive the extension. */
|
|
28
|
+
export interface ParseOptions {
|
|
29
|
+
content: string;
|
|
30
|
+
extension: string;
|
|
31
|
+
}
|
|
32
|
+
/** One parsed keyframe step — offset plus the RN style at that offset. */
|
|
33
|
+
export interface KeyframeStep {
|
|
34
|
+
offset: string;
|
|
35
|
+
style: RNStyle;
|
|
36
|
+
}
|
|
37
|
+
/** One parsed `@keyframes` animation block. */
|
|
38
|
+
export interface KeyframeBlock {
|
|
39
|
+
name: string;
|
|
40
|
+
steps: KeyframeStep[];
|
|
41
|
+
}
|
|
42
|
+
/** Interactive variant ('active' / 'focus') an `active:`/`focus:` atom carries. */
|
|
43
|
+
export type InteractiveStateTag = 'active' | 'focus';
|
|
44
|
+
/**
|
|
45
|
+
* Per-scheme resolved style for a single utility class. Keys are scheme
|
|
46
|
+
* names declared via `@variant <name>` in the theme CSS (or the synthetic
|
|
47
|
+
* `'base'` scheme for themes without variants). Values are the RN style
|
|
48
|
+
* object under that scheme.
|
|
49
|
+
*
|
|
50
|
+
* The reserved `__state` key is set on `active:` / `focus:` atoms so
|
|
51
|
+
* the build-side style-builder can tag the atom for `precomputeHoist`
|
|
52
|
+
* — which routes interactive atoms into the stated-hoist's 4-state
|
|
53
|
+
* precompute. Standard atoms have no `__state`.
|
|
54
|
+
*/
|
|
55
|
+
export type SchemedStyle = Readonly<Record<string, RNStyle>> & {
|
|
56
|
+
/** Interactive-state gate set by `active:` / `focus:` variants. */
|
|
57
|
+
readonly __state?: InteractiveStateTag;
|
|
58
|
+
};
|
|
59
|
+
/** Full result of one `parseAtoms` call. */
|
|
60
|
+
export interface ParsedOutput {
|
|
61
|
+
/** Resolved RN style per utility class, per declared scheme. */
|
|
62
|
+
atoms: Map<string, SchemedStyle>;
|
|
63
|
+
/** `@keyframes <name> { ... }` blocks the candidates pulled in. */
|
|
64
|
+
keyframes: Map<string, KeyframeBlock>;
|
|
65
|
+
/** `@property --x { initial-value: y }` declared custom-property defaults. */
|
|
66
|
+
propertyDefaults: Map<string, string>;
|
|
67
|
+
/**
|
|
68
|
+
* Gradient metadata per atom, for atoms that play a role in a
|
|
69
|
+
* Tailwind v4 gradient (`from-*`, `via-*`, `to-*`, `bg-gradient-to-*`,
|
|
70
|
+
* `bg-linear-to-*`). The transformer reads this map to extract
|
|
71
|
+
* `colors / start / end` props at JSX-rewrite time. Regular non-
|
|
72
|
+
* gradient atoms don't appear here.
|
|
73
|
+
*/
|
|
74
|
+
gradientAtoms: Map<string, GradientAtomInfo>;
|
|
75
|
+
/**
|
|
76
|
+
* Haptic metadata per atom for classes that emit a
|
|
77
|
+
* `--rnwind-haptic` marker. The transformer reads this map to
|
|
78
|
+
* strip the atom from the className and wire a mount-time or
|
|
79
|
+
* press-time call into the `onHaptics` callback registered on
|
|
80
|
+
* `<SchemeProvider>`.
|
|
81
|
+
*/
|
|
82
|
+
hapticAtoms: Map<string, HapticRequest>;
|
|
83
|
+
/** Candidates oxide surfaced, in document order. */
|
|
84
|
+
candidates: readonly string[];
|
|
85
|
+
/** Every scheme the theme declares (or `['base']` when there are no `@variant` blocks). */
|
|
86
|
+
schemes: readonly string[];
|
|
87
|
+
/**
|
|
88
|
+
* Responsive breakpoint name → minimum-width threshold (px). Pulled from
|
|
89
|
+
* `--breakpoint-*` tokens in the compiled `:root` block, so both
|
|
90
|
+
* Tailwind defaults (`sm`, `md`, `lg`, `xl`, `2xl`) and any user
|
|
91
|
+
* override (e.g. `--breakpoint-3xl: 120rem`) land here. Used by the
|
|
92
|
+
* style-builder to emit `registerBreakpoints({...})` in the manifest
|
|
93
|
+
* so the runtime can filter `md:*` / `lg:*` atoms based on the
|
|
94
|
+
* provider's `windowWidth`.
|
|
95
|
+
*/
|
|
96
|
+
breakpoints: ReadonlyMap<string, number>;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Parses one source file's Tailwind usage into RN-ready style objects.
|
|
100
|
+
*
|
|
101
|
+
* Pipeline:
|
|
102
|
+
* 1. `@tailwindcss/oxide` Scanner finds every Tailwind candidate.
|
|
103
|
+
* 2. `@tailwindcss/node` compiler emits CSS for those candidates with
|
|
104
|
+
* theme tokens inlined.
|
|
105
|
+
* 3. lightningcss `transform` + typed visitor walks the emitted CSS:
|
|
106
|
+
* - `style` rules → per-class RN-style object.
|
|
107
|
+
* - `@keyframes` rules → per-name step map (Reanimated-ready).
|
|
108
|
+
* - `@property` rules → custom-property initial values.
|
|
109
|
+
*
|
|
110
|
+
* One instance holds one Scanner + one lazily-built compiler so repeated
|
|
111
|
+
* calls share upstream state. Theme CSS is fixed at construction — theme
|
|
112
|
+
* edits require a new parser.
|
|
113
|
+
*/
|
|
114
|
+
export declare class TailwindParser {
|
|
115
|
+
private readonly config;
|
|
116
|
+
private readonly scanner;
|
|
117
|
+
private compiler;
|
|
118
|
+
private readonly themeSchemes;
|
|
119
|
+
private readonly schemeAliases;
|
|
120
|
+
/**
|
|
121
|
+
* Memoise `resolveCandidates` results by candidate-list fingerprint.
|
|
122
|
+
* Fast Refresh hits this on every save: oxide's scan is cheap, but
|
|
123
|
+
* the LightningCSS visitor walk over the compiled CSS is ~2ms per
|
|
124
|
+
* file. A file whose `className` literals didn't change returns the
|
|
125
|
+
* SAME candidate set, so the second `parseAtoms` call returns the
|
|
126
|
+
* cached `ParsedOutput` — zero compile, zero visitor walk.
|
|
127
|
+
*
|
|
128
|
+
* Theme CSS changes build a new `TailwindParser` (from
|
|
129
|
+
* `getRnwindState` detecting the hash shift), so this cache is
|
|
130
|
+
* naturally invalidated — no stale-theme values leak through.
|
|
131
|
+
*/
|
|
132
|
+
private readonly parseCache;
|
|
133
|
+
/**
|
|
134
|
+
* Build a parser bound to a theme CSS source. `@theme` and
|
|
135
|
+
* `@variant` blocks are extracted eagerly into a scheme table the
|
|
136
|
+
* visitor consults when resolving `var(--x)` references.
|
|
137
|
+
* @param config Parser configuration.
|
|
138
|
+
*/
|
|
139
|
+
constructor(config: TailwindParserConfig);
|
|
140
|
+
/**
|
|
141
|
+
* Schemes declared by the user — either every `@variant <name>` block
|
|
142
|
+
* found (in declaration order) or just `['base']` for themes without
|
|
143
|
+
* any variants. Used to decide how many per-scheme buckets the
|
|
144
|
+
* per-atom resolver fills. Exposed publicly so Metro integration can
|
|
145
|
+
* hand the names to the `.d.ts` generator without a full parse.
|
|
146
|
+
* @returns Scheme names.
|
|
147
|
+
*/
|
|
148
|
+
get declaredSchemes(): readonly string[];
|
|
149
|
+
/**
|
|
150
|
+
* Build an effective var table for one scheme — base vars overridden by
|
|
151
|
+
* variant vars. When the scheme IS `'base'` (no variants declared), the
|
|
152
|
+
* base table is returned unchanged.
|
|
153
|
+
* @param scheme Scheme name.
|
|
154
|
+
* @returns Effective var name → value lookup for the scheme.
|
|
155
|
+
*/
|
|
156
|
+
private effectiveVars;
|
|
157
|
+
/**
|
|
158
|
+
* Build the Tailwind compiler on first use and cache it. The theme CSS
|
|
159
|
+
* gets a `theme(inline)` modifier on its `@import 'tailwindcss'` so
|
|
160
|
+
* lightningcss sees resolved colors/lengths instead of `var()` refs.
|
|
161
|
+
* @returns Cached compiler instance.
|
|
162
|
+
*/
|
|
163
|
+
private ensureCompiler;
|
|
164
|
+
/**
|
|
165
|
+
* Parse one file's Tailwind usage into the full typed result.
|
|
166
|
+
* @param options Source content + extension.
|
|
167
|
+
* @param options.content Raw source text to scan for Tailwind candidates.
|
|
168
|
+
* @param options.extension File extension (`tsx`, `ts`, `jsx`, `js`) — feeds oxide's tokenizer.
|
|
169
|
+
* @returns RN atoms, keyframes, property defaults, candidates list.
|
|
170
|
+
*/
|
|
171
|
+
parseAtoms({ content, extension }: ParseOptions): Promise<ParsedOutput>;
|
|
172
|
+
/**
|
|
173
|
+
* Scan every source file the Scanner was configured to watch via
|
|
174
|
+
* `sources` and resolve the union of candidates in one pass. Used by
|
|
175
|
+
* `UnionBuilder` at Metro startup (and on first worker access) to
|
|
176
|
+
* populate the complete atom registry before ANY per-file transform
|
|
177
|
+
* has run — so scheme files never ship a partial view of the theme.
|
|
178
|
+
*
|
|
179
|
+
* Hot-reload path uses `parseAtoms` for the per-file delta; this one
|
|
180
|
+
* only runs once per parser instance (and whenever the parser is
|
|
181
|
+
* rebuilt due to a theme CSS change).
|
|
182
|
+
* @returns Full RN atoms, keyframes, property defaults for every
|
|
183
|
+
* candidate discovered across the configured sources.
|
|
184
|
+
*/
|
|
185
|
+
parseProject(): Promise<ParsedOutput>;
|
|
186
|
+
/**
|
|
187
|
+
* Compile + typed-visit the given candidate class names. Shared
|
|
188
|
+
* implementation for both `parseAtoms` (single file) and
|
|
189
|
+
* `parseProject` (whole project).
|
|
190
|
+
* @param candidates Class-name candidates the oxide Scanner produced.
|
|
191
|
+
* @returns Fully-typed parser result.
|
|
192
|
+
*/
|
|
193
|
+
private resolveCandidates;
|
|
194
|
+
}
|