
import { StyleDetails, UnitHandler } from "../parser/types.js";
import { StyleHandlerDefinition } from "../utils/styles.js";
import { RecipeStyles } from "../styles/types.js";

//#region src/tasty/plugins/types.d.ts
/**
 * A tasty plugin that extends the style system with custom functions, units, states, or handlers.
 */
interface TastyPlugin {
  /** Unique name for the plugin (used for debugging and conflict detection) */
  name: string;
  /** Custom functions that transform parsed style groups into CSS values */
  funcs?: Record<string, (groups: StyleDetails[]) => string>;
  /** Custom units that transform numeric values (e.g., `2x` → `calc(2 * var(--gap))`) */
  units?: Record<string, string | UnitHandler>;
  /** Custom state aliases (e.g., `'@mobile': '@media(w < 768px)'`) */
  states?: Record<string, string>;
  /**
   * Custom style handlers that transform style properties into CSS declarations.
   * Handlers replace built-in handlers for the same style name.
   * @example
   * ```ts
   * handlers: {
   *   // Simple handler - lookup style inferred from key
   *   fill: ({ fill }) => fill ? { 'background-color': fill } : undefined,
   *   // Multi-property handler
   *   spacing: [['gap', 'padding'], ({ gap, padding }) => ({ ... })],
   * }
   * ```
   */
  handlers?: Record<string, StyleHandlerDefinition>;
  /** Predefined tokens replaced during style parsing (`$name` or `#name`) */
  tokens?: {
    [key: `$${string}` | `#${string}`]: string | number;
  };
  /**
   * Predefined style recipes -- named style bundles that can be applied via `recipe` style property.
   * Recipe values are flat tasty styles (no sub-element keys).
   * @example
   * ```ts
   * recipes: {
   *   card: { padding: '4x', fill: '#surface', radius: '1r', border: true },
   *   elevated: { shadow: '2x 2x 4x #shadow' },
   * }
   * ```
   */
  recipes?: Record<string, RecipeStyles>;
}
//#endregion
export { TastyPlugin };
//# sourceMappingURL=types.d.ts.map