import { z } from 'zod'; declare const TokenConfigSchema: z.ZodObject<{ name: z.ZodString; values: z.ZodRecord>; asRoot: z.ZodOptional; }, z.core.$strip>; type TokenConfigInput = z.infer; declare const LiveTokenUpdateSchema: z.ZodObject<{ tokens: z.ZodRecord; source: z.ZodOptional; }, z.core.$strip>; type LiveTokenUpdateInput = z.infer; declare const ThemeRegistrationSchema: z.ZodObject<{ name: z.ZodString; tokens: z.ZodRecord>; isDefault: z.ZodOptional; }, z.core.$strip>; type ThemeRegistrationInput = z.infer; declare const parseTokenConfig: (data: unknown) => { name: string; values: Record>; asRoot?: boolean | undefined; }; declare const parseLiveTokenUpdate: (data: unknown) => { tokens: Record; source?: string | undefined; }; /** * tailwind-styled-v5 — Multi-Theme Engine (Node-only, native-required) * * Sengaja TERPISAH dari index.ts (lihat catatan di sana). File ini cuma * berisi bagian theme engine yang BENAR-BENAR butuh native Rust binding * (createTheme / compileDesignTokens — tidak ada JS fallback, throw FATAL * kalau binding tidak tersedia) dan TIDAK mengimpor liveTokenEngine.ts sama * sekali — sehingga TIDAK PERNAH ke-tag "use client" oleh preserveDirectives() * di tsup.config.ts. Kalau file ini ikut bawa "use client", Next.js/Turbopack * akan coba bundle dia ke app-client chunking layer, dan native-bridge.ts * punya top-level `import path from "node:path"` dkk yang gagal di-resolve * di layer itu (lihat known-issues 2026-06-28 — exact bug yang sama dengan * dist/index.mjs, tapi index.mjs aman di-redirect ke stub karena ada JS * fallback; createTheme/compileDesignTokens TIDAK punya fallback, jadi * redirect ke stub bakal bikin dia throw FATAL tiap dipanggil. Pisahin entry * adalah satu-satunya cara aman buat tetap pakai native Rust binding penuh * di sini sambil tetap lolos Turbopack build. * * Live token engine (applyTokenSet, liveToken, dkk) TIDAK di-export di sini * — itu sudah tersedia lewat: * - "tailwind-styled-v4" (main entry) — sudah seperti ini sejak awal * - "@tailwind-styled/theme/live-tokens" (dipakai internal oleh package lain) * Konsumen yang sebelumnya import live-token functions dari * "tailwind-styled-v4/theme" subpath harus pindah ke main entry * "tailwind-styled-v4" — lihat CHANGELOG. */ type ThemeTokenMap = Record>; interface ThemeContract { _contract: T; _vars: ThemeVars; } type ThemeVars = { [Group in keyof T]: { [Token in keyof T[Group]]: string; }; }; interface Theme { name: string; contract: ThemeContract; values: T; /** CSS string to inject (`:root` or `[data-theme="name"]`) */ css: string; /** CSS variables as a flat record */ vars: Record; /** Apply this theme to an element via data attribute */ selector: string; } /** * Define the shape of your theme. All themes must satisfy this contract. * Returns typed CSS variable references for use in tw components. * * @example * const contract = defineThemeContract({ * colors: { bg: "", fg: "", primary: "" }, * font: { sans: "" }, * }) * * // Use in components: * const Card = tw.div`bg-[${contract._vars.colors.bg}]` * // → tw.div`bg-[var(--colors-bg)]` */ declare function defineThemeContract(shape: T): ThemeContract; /** * Create a typed theme that satisfies a contract. * * @param contract - Theme contract from defineThemeContract() * @param name - Theme name ("light", "dark", "brand", etc.) * @param values - Token values (TypeScript enforces completeness) * @param asRoot - If true, use :root selector. Default: false (uses [data-theme]) */ declare function createTheme(contract: ThemeContract, name: string, values: T, asRoot?: boolean): Theme; declare class ThemeRegistry { private themes; private defaultTheme; /** Register a theme */ register(theme: Theme, isDefault?: boolean): this; /** Get a theme by name */ get(name: string): Theme | undefined; /** Get all theme names */ names(): string[]; /** * Generate combined CSS for all themes. * Inject into or a .css file. * * @example * // In globals.css or layout.tsx * const css = registry.generateCss() */ generateCss(): string; /** * Get the CSS for a specific theme only. */ getThemeCss(name: string): string | null; /** * Inject all theme CSS into document (browser only). * Call once on app init. */ inject(styleId?: string): void; /** * Switch active theme by setting data-theme on . */ apply(name: string, target?: HTMLElement): void; /** * Get current active theme name from data-theme attribute. */ current(target?: HTMLElement): string | null; } interface MultiThemeConfig { contract: ThemeContract; light: T; dark: T; /** Additional named themes (brand, high-contrast, etc.) */ extras?: Record; } /** * Create a ThemeRegistry with light/dark + optional extras in one call. * * @example * const { registry, vars } = createMultiTheme({ * contract: defineThemeContract({ * colors: { bg: "", fg: "", primary: "", border: "" } * }), * light: { * colors: { bg: "#fff", fg: "#09090b", primary: "#3b82f6", border: "#e5e7eb" } * }, * dark: { * colors: { bg: "#09090b", fg: "#fafafa", primary: "#60a5fa", border: "#27272a" } * }, * }) * * // Inject CSS: * registry.inject() * * // Use tokens in components: * const Card = tw.div`bg-[${vars.colors.bg}] text-[${vars.colors.fg}]` */ declare function createMultiTheme(config: MultiThemeConfig): { registry: ThemeRegistry; vars: ThemeVars; light: Theme; dark: Theme; }; interface DesignTokens { [path: string]: string | DesignTokens; } /** * Flatten nested design token object into CSS variables. * Supports Figma-style nested tokens. * * @example * compileDesignTokens({ * color: { * brand: { primary: "#3b82f6", secondary: "#6366f1" }, * neutral: { 50: "#fafafa", 900: "#09090b" } * }, * spacing: { base: "4px", lg: "16px" } * }) * → * :root { * --color-brand-primary: #3b82f6; * --color-brand-secondary: #6366f1; * --color-neutral-50: #fafafa; * --color-neutral-900: #09090b; * --spacing-base: 4px; * --spacing-lg: 16px; * } */ declare function compileDesignTokens(tokens: DesignTokens, prefix?: string): string; export { type DesignTokens, type LiveTokenUpdateInput, LiveTokenUpdateSchema, type MultiThemeConfig, type Theme, type ThemeContract, type ThemeRegistrationInput, ThemeRegistrationSchema, ThemeRegistry, type ThemeTokenMap, type ThemeVars, type TokenConfigInput, TokenConfigSchema, compileDesignTokens, createMultiTheme, createTheme, defineThemeContract, parseLiveTokenUpdate, parseTokenConfig };