UNPKG

@meonode/ui

Version:

A structured approach to component composition, direct CSS-first prop styling, built-in theming, smart prop handling (including raw property pass-through), and dynamic children.

36 lines 2 kB
import type { Theme } from '../types/node.type.js'; export declare function getActiveServerTheme(): Theme | undefined; export declare function setActiveServerTheme(theme: Theme): void; export declare function registerServerThemeVariables(theme: Theme): void; export declare function consumeServerThemeVariablesCss(): { id: string; cssText: string; } | undefined; /** * Builds the `:root{--meonode-theme-*: …}` CSS text directly from a Theme without * touching the server-only variable store. Safe to call on the client for pure * SPA flows (Vite/CRA) where there is no SSR emission to pick up. */ export declare function buildThemeVariablesCss(theme: Theme): string; /** * Replaces `theme.*` token strings with `var(--meonode-theme-*)` references, * walking arbitrary structures iteratively with copy-on-write semantics. * * Mirrors `ThemeUtil.resolveObjWithTheme`'s traversal contract: * - Only descends into plain objects and arrays. Class instances (refs, * Date, RegExp, MUI internals, React elements, etc.) are passed through * untouched so their identity and prototype chain are preserved. * - Copy-on-write: untouched subtrees keep their original reference, which * matters when forwarding props to memoized components. * - Iterative with a manual work stack — safe for deeply nested trees. * - Detects cycles via a path Set. * - Only transforms string **values**, never object keys. Keys that hold * theme tokens (e.g. `'@media (max-width: theme.breakpoint.md)'`) must * resolve to concrete values, since CSS variables are invalid inside * media features and selector text. Key resolution is left to * `ThemeUtil.resolveObjWithTheme`, which has access to the live theme. * - Memoized via a module-level WeakMap so the same input reference (e.g. * a `sx` object defined outside a render body) is converted at most once. */ export declare function replaceThemeTokensWithCssVars<T>(value: T): T; //# sourceMappingURL=server-theme.util.d.ts.map