import type { Twind, BaseTheme, TwindConfig, TwindUserConfig, Preset, ExtractThemes } from './types' import { PROD } from 'distilt/env' import { defineConfig } from './define-config' import { setup } from './runtime' import { getSheet } from './sheets' /** * @group Runtime * @param config * @param isProduction */ export function install( config: TwindConfig, isProduction?: boolean, ): Twind export function install[] = Preset[]>( config: TwindUserConfig, isProduction?: boolean, ): Twind> export function install(config: TwindConfig | TwindUserConfig, isProduction = PROD): Twind { const config$ = defineConfig(config as TwindUserConfig) return setup( { ...config$, // in production use short hashed class names hash: config$.hash ?? isProduction, }, () => getSheet(!isProduction), ) }