import { PropertiesFallback, PropertiesHyphenFallback } from 'csstype'; interface CSSCustomProperties { '--tw-rotate'?: string; '--tw-gradient-stops'?: string; } interface CSSProperties extends PropertiesFallback, PropertiesHyphenFallback, CSSCustomProperties { } declare type Falsy = '' | 0 | -0 | false | null | undefined | void; declare type MaybeArray = T | readonly T[]; interface TWCallable { (strings: TemplateStringsArray, ...interpolations: Token[]): string; (...tokens: Token[]): string; } interface TW extends TWCallable { theme: ThemeResolver; } interface Context { /** Allow composition */ readonly tw: TWCallable; /** Access to theme values */ readonly theme: ThemeResolver; /** Create unique identifier (group, custom properties) */ readonly tag: (key: string) => string; readonly css: (rule: Rule[] | string) => CSSRules; } interface Rule { /** * The variants: `[":sm", ":dark", ":hover"]` */ v: string[]; /** * The directive: `"text-sm"`, `"rotate-45"` */ d: string | InlineDirective; /** Is this rule negated: `"-rotate-45"` =\> `true` */ n: boolean | undefined; /** Is this rule marked as important: `"stroke-4!"` =\> `true` */ i: boolean | undefined; /** * The id is the tailwind rule including variants, negate and directive * * Initialy this is set to an empty string. * * This is used to cache the id of static rules (from template literals). */ $: string; } interface InlineDirective { (context: Context): CSSRules | string | Falsy; } interface TokenGrouping extends Record { } declare type TypescriptCompat = boolean | number; declare type Token = string | TokenGrouping | InlineDirective | Token[] | Falsy | TypescriptCompat; declare type CSSAtMedia = Record; declare type CSSAtSupports = Record; declare type CSSAtKeyframes = Record CSSProperties)>; /** * See: https://drafts.csswg.org/css-nesting/#nest-selector * * ``` * "& > * + *": { * marginLeft: 16 * }, * * // In a comma-separated list, each individual selector shall start with "&" * "&:focus, &:active": { * outline: "solid" * }, * * // Self-references are also supported * "& + &": { * color: "green" * } * ``` */ interface CSSRules { /** Global defaults */ [key: string]: CSSProperties | CSSAtMedia | CSSAtSupports | CSSAtKeyframes | CSSRules | string | string[] | Falsy | CSSRulesThunk; } interface CSSRulesThunk { (context: Context): CSSProperties | CSSAtMedia | CSSAtSupports | CSSAtKeyframes | CSSRules | CSSRulesThunk | string | string[] | Falsy; } interface ThemeResolver {
(section: Section): Record>;
(keypath: `${Section}.${string}`): ThemeSectionType | undefined;
(keypath: `${Section}.${string}`, defaultValue: NonNullable>): NonNullable>;
(section: Section, key: string | string[]): ThemeSectionType | undefined;
(section: Section, key: string | string[], defaultValue: NonNullable>): NonNullable>; } declare type Unwrap = T extends string[] ? string : T extends Record ? R : T; declare type ThemeSectionType = T extends ThemeSection ? Unwrap : Exclude>; interface ThemeSectionResolverContext { /** * No-op function as negated values are automatically infered and do _not_ not to be in the theme. */ readonly negative: (records: Record) => Record; readonly breakpoints: (records: Record) => Record; } declare type ThemeSectionRecord = Record; declare type ThemeSectionResolver = (theme: ThemeResolver, context: ThemeSectionResolverContext) => ThemeSectionRecord; declare type ThemeSection = ThemeSectionRecord | ThemeSectionResolver; interface ThemeContainer { screens?: Record; center?: boolean; padding?: string | Record; } declare type ThemeScreenValue = string | { raw: string; } | { min: string; max?: string; } | { min?: string; max: string; }; declare type ThemeScreen = MaybeArray; interface ThemeColorObject extends Record { } declare type ThemeColor = string | ThemeColorObject; declare type ThemeFontSize = string | [size: string, lineHeight: string] | [size: string, options: { lineHeight?: string; letterSpacing?: string; }]; declare type ThemeOutline = [outline: string, offset: string]; interface Theme { colors: ThemeSection; spacing: ThemeSection; durations: ThemeSection; screens: ThemeSection; animation: ThemeSection; backgroundColor: ThemeSection; backgroundImage: ThemeSection; backgroundOpacity: ThemeSection; borderColor: ThemeSection; borderOpacity: ThemeSection; borderRadius: ThemeSection; borderWidth: ThemeSection; boxShadow: ThemeSection; container: ThemeContainer | ThemeSectionResolver; divideColor: ThemeSection; divideOpacity: ThemeSection; divideWidth: ThemeSection; fill: ThemeSection; flex: ThemeSection; fontFamily: ThemeSection; fontSize: ThemeSection; fontWeight: ThemeSection; gap: ThemeSection; gradientColorStops: ThemeSection; height: ThemeSection; inset: ThemeSection; keyframes: ThemeSection>; letterSpacing: ThemeSection; lineHeight: ThemeSection; margin: ThemeSection; maxHeight: ThemeSection; maxWidth: ThemeSection; minHeight: ThemeSection; minWidth: ThemeSection; opacity: ThemeSection; order: ThemeSection; outline: ThemeSection; padding: ThemeSection; placeholderColor: ThemeSection; placeholderOpacity: ThemeSection; ringColor: ThemeSection; ringOffsetColor: ThemeSection; ringOffsetWidth: ThemeSection; ringOpacity: ThemeSection; ringWidth: ThemeSection; rotate: ThemeSection; scale: ThemeSection; skew: ThemeSection; space: ThemeSection; stroke: ThemeSection; strokeWidth: ThemeSection; textColor: ThemeSection; textOpacity: ThemeSection; transitionDelay: ThemeSection; transitionDuration: ThemeSection; transitionProperty: ThemeSection; transitionTimingFunction: ThemeSection; translate: ThemeSection; width: ThemeSection; zIndex: ThemeSection; } /** * [[include:src/observe/README.md]] * * @packageDocumentation * @module twind/observe */ /** * Options for {@link createObserver}. */ interface ShimConfiguration { /** * Custom {@link twind.tw | tw} instance to use (default: {@link twind.tw}). */ tw?: TW; } /** Provides the ability to watch for changes being made to the DOM tree. */ interface TwindObserver { /** * Stops observer from observing any mutations. */ disconnect(): TwindObserver; /** * Observe an additional element. */ observe(target: Node): TwindObserver; } /** * Creates a new {@link TwindObserver}. * * @param options to use */ declare const createObserver: ({ tw }?: ShimConfiguration) => TwindObserver; /** * Creates a new {@link TwindObserver} and {@link TwindObserver.observe | start observing} the passed target element. * @param this to bind * @param target to shim * @param config to use */ declare function observe(this: ShimConfiguration | undefined | void, target: Node, config?: ShimConfiguration | undefined | void): TwindObserver; export { ShimConfiguration, TwindObserver, createObserver, observe }; //# sourceMappingURL=observe.d.ts.map