| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190 |
- import _default from './colors.mjs';
- type ArbitraryUtilityValue = {
- kind: 'arbitrary';
- /**
- * ```
- * bg-[color:var(--my-color)]
- * ^^^^^
- *
- * bg-(color:--my-color)
- * ^^^^^
- * ```
- */
- dataType: string | null;
- /**
- * ```
- * bg-[#0088cc]
- * ^^^^^^^
- *
- * bg-[var(--my_variable)]
- * ^^^^^^^^^^^^^^^^^^
- *
- * bg-(--my_variable)
- * ^^^^^^^^^^^^^^
- * ```
- */
- value: string;
- };
- type NamedUtilityValue = {
- kind: 'named';
- /**
- * ```
- * bg-red-500
- * ^^^^^^^
- *
- * w-1/2
- * ^
- * ```
- */
- value: string;
- /**
- * ```
- * w-1/2
- * ^^^
- * ```
- */
- fraction: string | null;
- };
- type ArbitraryModifier = {
- kind: 'arbitrary';
- /**
- * ```
- * bg-red-500/[50%]
- * ^^^
- * ```
- */
- value: string;
- };
- type NamedModifier = {
- kind: 'named';
- /**
- * ```
- * bg-red-500/50
- * ^^
- * ```
- */
- value: string;
- };
- type ArbitraryVariantValue = {
- kind: 'arbitrary';
- value: string;
- };
- type NamedVariantValue = {
- kind: 'named';
- value: string;
- };
- type Variant =
- /**
- * Arbitrary variants are variants that take a selector and generate a variant
- * on the fly.
- *
- * E.g.: `[&_p]`
- */
- {
- kind: 'arbitrary';
- selector: string;
- relative: boolean;
- }
- /**
- * Static variants are variants that don't take any arguments.
- *
- * E.g.: `hover`
- */
- | {
- kind: 'static';
- root: string;
- }
- /**
- * Functional variants are variants that can take an argument. The argument is
- * either a named variant value or an arbitrary variant value.
- *
- * E.g.:
- *
- * - `aria-disabled`
- * - `aria-[disabled]`
- * - `@container-size` -> @container, with named value `size`
- * - `@container-[inline-size]` -> @container, with arbitrary variant value `inline-size`
- * - `@container` -> @container, with no value
- */
- | {
- kind: 'functional';
- root: string;
- value: ArbitraryVariantValue | NamedVariantValue | null;
- modifier: ArbitraryModifier | NamedModifier | null;
- }
- /**
- * Compound variants are variants that take another variant as an argument.
- *
- * E.g.:
- *
- * - `has-[&_p]`
- * - `group-*`
- * - `peer-*`
- */
- | {
- kind: 'compound';
- root: string;
- modifier: ArbitraryModifier | NamedModifier | null;
- variant: Variant;
- };
- type Candidate =
- /**
- * Arbitrary candidates are candidates that register utilities on the fly with
- * a property and a value.
- *
- * E.g.:
- *
- * - `[color:red]`
- * - `[color:red]/50`
- * - `[color:red]/50!`
- */
- {
- kind: 'arbitrary';
- property: string;
- value: string;
- modifier: ArbitraryModifier | NamedModifier | null;
- variants: Variant[];
- important: boolean;
- raw: string;
- }
- /**
- * Static candidates are candidates that don't take any arguments.
- *
- * E.g.:
- *
- * - `underline`
- * - `box-border`
- */
- | {
- kind: 'static';
- root: string;
- variants: Variant[];
- important: boolean;
- raw: string;
- }
- /**
- * Functional candidates are candidates that can take an argument.
- *
- * E.g.:
- *
- * - `bg-red-500`
- * - `bg-[#0088cc]`
- * - `w-1/2`
- */
- | {
- kind: 'functional';
- root: string;
- value: ArbitraryUtilityValue | NamedUtilityValue | null;
- modifier: ArbitraryModifier | NamedModifier | null;
- variants: Variant[];
- important: boolean;
- raw: string;
- };
- type PluginUtils = {
- theme: (keypath: string, defaultValue?: any) => any;
- colors: typeof _default;
- };
- export type { Candidate as C, NamedUtilityValue as N, PluginUtils as P, Variant as V };
|