import type { ControlVar } from "./ControlVar.js"; import type { InterpolatedVarsOptions, InterpolatorOptions, KeyNamer } from "./types.js"; /** * * The default key naming function. * * Names keys like `foo-0`, `foo-1`, etc. */ export declare const defaultKeyNamer: InterpolatedVarsOptions["keyName"]; /** See {@link defaultKeyNamer} */ export declare const padNum: (num: number, limit: number, steps: number) => string; /** * * A padded key naming function. * * Names keys like `foo-000`, `foo-100`, etc. * * Note the number depends on the limit and the number of steps passed. The number is rounded to the nearest integer. * * e.g. 10 steps with a limit of 1000: [foo-000, foo-100, ... foo-900] * * Note that the last key will be foo-900 NOT foo-1000. * * To make it end at foo-1000 use `paddedKeyNamer((stepCount + 1) * desiredPadAmount)`. * */ export declare const paddedKeyNamer: (keyLimit?: number) => InterpolatedVarsOptions["keyName"]; /** * Similar to {@link paddedKeyNamer} but just multiplies the step by the given pad amount. */ export declare const paddedByStepKeyNamer: (stepPadAmount?: number) => InterpolatedVarsOptions["keyName"]; export declare const tailwindColorKeyNamer: KeyNamer; /** * Creates an array from a ratio. */ export declare const createArrayfromRatio: ({ ratio, length }: { ratio: number; length: 10; }) => number[]; /** * If passed a number, rounds it, otherwise returns it. */ export declare const roundIfNeeded: (roundTo: number | false, num: number | any) => typeof num; /** * Multiplies each step by the start value. * * Useful when using array steps with custom percentages. * * For example: * * ```ts * const spacingControl = new ControlVar(Unit.rem, 1) * const spacingSteps = [0, 1, 2, 3] * const spacing = new InterpolatedVars("spacing", Unit.rem, [spacingControl], { * steps: spacingSteps, * interpolator: createNumericalInterpolator(scaleValue), * }) * // spacing values are now [0rem, 1rem, 2rem, 3rem] * spacingControl.set(2) * // scales to [0rem, 2rem, 4rem, 6rem] * ``` */ export declare const scaleValue: NumericalInterpolator; /** Lerps between the start and end values. */ export declare const lerpValue: NumericalInterpolator; export type NumericalInterpolator = (opts: Omit>, "start" | "end"> & { start: number; end: number; }) => number; /** * A utility function for creating a numerical interpolators. * * It iterates through the keys of the start and end values, and passes those as the start and end values to the interpolator given ({@link lerpValue} by default). */ export declare const createNumericalInterpolator: (interpolator?: NumericalInterpolator) => (opts: InterpolatorOptions>) => Record; /** The default interpolator. */ export declare const lerp: (opts: InterpolatorOptions>) => Record; /** Helper to create a modified object with some change applied to it's keys. */ export declare const modifiyKeys: (modify: (key: string) => string, obj: Record) => Record; /** * Converts the css object returned by {@link Theme} to a string. * * Can be used to, for example, set the inner html of a style element directly. * * ```ts * styleEl.innerHTML = `:root{\n${cssObjectToString(baseTheme.css)}\n}` * ``` */ export declare const cssObjectToString: (obj: Record) => string; /** * Replaces invalid css variable name characters. */ export declare const escapeKey: (key: string, sep: string) => string; //# sourceMappingURL=utils.d.ts.map