@hua-labs/dot
Cross-platform style protocol from utility tokens to web CSSProperties and React Native styles.
Waves 0–3 are complete. The package is dogfooded across HUA apps and docs. The API is stable enough for dependent packages to converge on the same style contract. Public release is gated on AOT extraction tooling (Wave 4).
Key capabilities
One token language
Use one utility-style vocabulary and resolve it to web CSSProperties or React Native style objects. 90%+ Tailwind parity out of the box.
State-aware style maps
Use dotMap() for hover, focus, active, and breakpoint-aware state buckets without string juggling. Responsive cascade is mobile-first.
Web + React Native + Flutter
Three platform targets from a single token string. Import from @hua-labs/dot/native for RN, or pass target: 'flutter' for structured Flutter recipes.
Gradient & shadow composition
from-*/via-*/to-* stops compose into linear-gradient(). shadow-* and ring-* layers compose into a single boxShadow value with correct ordering.
Config + variants
Override tokens with createDotConfig(), merge class-like input with dotCx(), and define typed recipe-style variants with dotVariants().
Capability introspection
dotExplain() returns both resolved styles and a capability report — listing which properties are dropped, approximated, or unsupported on the target.
Implementation waves
Wave 0— FoundationParser, resolver, cache, config, web adapter, dark mode, responsive cascade, !important, arbitrary values
Wave 1— Flutter adapterFull Flutter recipe output: layout, flexbox, sizing, color, typography, border, shadow, transform, gradient
Wave 2— Extended familiesGrid, filter, backdrop-filter, animation, transition, object-fit, scroll, table, list, word-break, divide, isolation
Wave 3— Config & variants hardeningdotVariants(), dotExplain(), capability matrix, value-level overrides, warnUnknown, remBase
Wave 4— AOT extractionStatic extraction companion package (@hua-labs/dot-extract) — build-time token analysis, zero-runtime path
Wave 5— AdvancedCustom breakpoints, element filters, drop-shadow, CSS @layer, server-component SSR path
빠른 시작
1. Web usage
2. State maps
3. React Native entrypoint
4. Flutter adapter
5. Gradient & shadow composition
6. Capability introspection
7. Config + variants
Core API surface
dot(input, options?)Resolve utility tokens into a flat style object. Overloaded for web (CSSProperties), native (RNStyleObject), and Flutter (FlutterRecipe) targets.
dotMap(input, options?)Resolve the same token string into base plus state-specific buckets (hover, focus, active, focus-visible, focus-within, disabled).
dotExplain(input, options?)Returns resolved styles plus a capability report listing dropped, approximated, and limited properties for the target platform.
createDotConfig(config)Override tokens, breakpoints, rem base, runtime target, cache size, and warnUnknown. Applies globally (module-level singleton).
clearDotCache()Reset token and input caches when theme or config changes at runtime.
dotCx(...inputs)Compose multiple utility strings into one, filtering falsy values. Useful for conditional class merging before passing to dot().
dotVariants(config)Define typed recipe-style variants on top of the same dot vocabulary. A CVA-compatible API that resolves to style objects instead of class strings.
adaptFlutter / adaptNative / adaptWebLow-level platform adapters exposed for direct usage. Usually consumed via the target option on dot() rather than directly.
Platform capability matrix
| Family | Web | React Native | Flutter |
|---|---|---|---|
| spacing / color / typography | native | native | native |
| flexbox / border / borderRadius | native | native | native |
| shadow | native | approximate | native |
| gradient | native | unsupported | recipe-only |
| grid | native | unsupported | recipe-only |
| filter / backdrop-filter | native | unsupported | plugin-backed |
| transition / animation | native | unsupported | unsupported |
| transform | native | native | native |
| positioning | native | native | recipe-only |