@dreamy-ui/panda-preset
Version:
A panda preset for Dreamy UI React component library
171 lines (164 loc) • 6.42 kB
TypeScript
import * as _pandacss_types from '@pandacss/types';
import { SystemStyleObject, Preset } from '@pandacss/dev';
interface DreamyPluginOptions {
/**
* Whether to remove the jsx generated files from the `jsx` directory in the `styled-system` folder.
* @default true
*/
removeJsxElements?: boolean;
/**
* Whether to remove the "dreamy" factory from the style context.
* @default true
*/
removeFactoryFromStyleContext?: boolean;
/**
* Whether to update the factory and types files to match dreamy ui needs.
* @default true
*/
updateFactory?: boolean;
/**
* The current working directory.
* @default process.cwd()
*/
cwd?: string;
}
/**
* This plugin is used to modify the `styled-system` folder to remove default
* JSX generated components from patterns, since Dreamy UI has its own components.
*
* It also updates the `styled` factory and types files to match Dreamy UI needs.
*
* `jsxFactory: "dreamy"` is required in `panda.config.ts` to make Dreamy UI work.
*/
declare function dreamyPlugin(options?: DreamyPluginOptions): _pandacss_types.PandaPlugin;
declare const schemeNames: readonly ["primary", "secondary", "success", "warning", "error", "info", "none"];
type SchemeName = (typeof schemeNames)[number];
declare function getColorSchemes<T extends string>(cssVar: string, schemeProps?: (scheme: SchemeName) => Record<any, SystemStyleObject>,
/**
* if it is a slot recipe, select a main slot to apply the color scheme
*/
slot?: T, generateFg?: boolean): Record<SchemeName, T extends string ? Record<T, Record<any, SystemStyleObject>> : Record<any, SystemStyleObject>>;
declare function mapJsx(root: string, jsx: string[]): string[];
type BorderRadius = (typeof BorderRadii)[number];
declare const BorderRadii: readonly ["none", "xs", "sm", "md", "lg", "xl", "2xl"];
type DeepPartial<T> = T extends object ? {
[P in keyof T]?: DeepPartial<T[P]>;
} : T;
interface LightDarkColor {
light: string;
dark: string;
}
interface LightDarkNumber {
light: number;
dark: number;
}
/** Per-token lightness offset for foreground tokens (OKLCH 0–1 scale). */
interface FgLightnessOffset {
/** `fg.max` token — the most prominent text (e.g. headings). */
max?: number | LightDarkNumber;
/** `fg` / `fg.normal` token — default body text. */
normal?: number | LightDarkNumber;
/** `fg.medium` token — secondary / muted text. */
medium?: number | LightDarkNumber;
/** `fg.disabled` token — disabled state text. */
disabled?: number | LightDarkNumber;
}
/** Per-token lightness offset for border tokens (OKLCH 0–1 scale). */
interface BorderLightnessOffset {
/**
* `border` / `border.default` token.
* @default fgLightnessOffset.normal when `borderLightnessOffset` is not set
*/
default?: number | LightDarkNumber;
/**
* `border.muted` token.
* @default fgLightnessOffset.disabled when `borderLightnessOffset` is not set
*/
muted?: number | LightDarkNumber;
/**
* `border.hover` token.
* @default fgLightnessOffset.normal when `borderLightnessOffset` is not set
*/
hover?: number | LightDarkNumber;
}
interface ColorTuning {
/**
* Multiplier applied to the computed foreground token chroma (color tint intensity).
* Values above `1` increase the color tint of text tokens; values below `1` make them
* more neutral/grayscale. The result is still clamped to safe bounds.
* Provide a `{ light, dark }` object to tune each color mode independently.
* @default 1
*/
fgChromaScale?: number | LightDarkNumber;
/**
* Multiplier applied to the computed border token chroma (color tint intensity).
* Values above `1` increase the color tint of border tokens; values below `1` make them
* more neutral/grayscale. The result is still clamped to safe bounds.
* Provide a `{ light, dark }` object to tune each color mode independently.
* @default fgChromaScale (falls back to 1 if that is also not set)
*/
borderChromaScale?: number | LightDarkNumber;
/**
* Per-token lightness offset for foreground tokens (OKLCH 0–1 scale).
* Positive values brighten a token; negative values darken it.
* Omitted tokens are left at their default lightness.
*/
fgLightnessOffset?: FgLightnessOffset;
/**
* Per-token lightness offset for border tokens (OKLCH 0–1 scale).
* When this entire option is omitted, border tokens fall back to corresponding
* fg offsets: `default` ← `fg.normal`, `muted` ← `fg.disabled`, `hover` ← `fg.normal`.
*/
borderLightnessOffset?: BorderLightnessOffset;
}
interface PresetOptions {
backgrounds: {
light: string;
dark: string;
};
fonts: {
body: string;
heading: string;
mono: string;
};
primaryColor: string | LightDarkColor;
secondaryColor: string | LightDarkColor;
rounded: BorderRadius;
/**
* Color for the primary button. It depends on the `primaryColor` option.
* @default Dreamy UI will automatically resolve contrast to match the `primaryColor` option.
*/
buttonPrimaryTextColor: string | LightDarkColor;
/**
* Color for the secondary button. It depends on the `secondaryColor` option.
* @default Dreamy UI will automatically resolve contrast to match the `secondaryColor` option.
*/
buttonSecondaryTextColor: string | LightDarkColor;
/**
* Fine-tune the chroma (color tint intensity) of auto-generated foreground and border tokens.
* Useful when the default generation feels too colorful or too neutral for a given background.
*/
colorTuning?: ColorTuning;
}
declare const defaultPresetOptions: {
backgrounds: {
light: string;
dark: string;
};
fonts: {
body: string;
heading: string;
mono: string;
};
primaryColor: {
light: string;
dark: string;
};
secondaryColor: {
light: string;
dark: string;
};
rounded: "md";
};
declare function createDreamyPreset(optionsArg?: DeepPartial<PresetOptions>): Preset;
export { BorderRadii, type BorderRadius, type DeepPartial, type DreamyPluginOptions, type PresetOptions, createDreamyPreset as default, defaultPresetOptions, dreamyPlugin, getColorSchemes, mapJsx };