import type { CSSDirective } from "@microsoft/fast-element"; import { CSSDesignToken } from "@microsoft/fast-foundation"; import { InteractiveColorRecipe, InteractiveColorRecipeBySet } from "../color/recipe.js"; import { Paint } from "../color/paint.js"; import { TypedCSSDesignToken, TypedDesignToken } from "../adaptive-design-tokens.js"; import { InteractiveTokenGroup, InteractiveValues } from "../types.js"; import { StyleModuleTarget, StyleProperty, StylePropertyShorthand } from "./types.js"; /** * Key for a style property, a {@link (StyleProperty:type)}, {@link (StylePropertyShorthand:type)}, or a string for any other CSS property. * * @public */ export type StyleKey = StyleProperty | StylePropertyShorthand | (string & Record); /** * Supported values for a style property. * * @public */ export type StyleValue = CSSDesignToken | InteractiveValues | CSSDirective | string | number; /** * An object of style definitions, where the key is the {@link (StyleKey:type)} and the value is the token or final value. * * @remarks * The `Record` format is a convenience for manual authoring of style modules (instead of a `Map`). * * @public */ export type StyleProperties = Partial>; /** * A `Map` of style definitions, where the key is the {@link (StyleKey:type)} and the value is the token or final value. * * @public */ export type StylePropertiesMap = Map; /** * A `Map` of style definitions, where the key is a string and the value is the token or final value. * * @public */ export type EffectiveStylePropertiesMap = Map; /** * The properties and values for a {@link StyleRule} definition. * * A declaration should have `styles` and/or `properties` - `styles` are applied before `properties`. * * @public */ export type StyleDeclaration = { /** * The {@link Styles} for this rule. * * @remarks * Optional. If not applicable, provide `properties`. */ styles?: Styles | Iterable; /** * A collection of properties to define a new {@link Styles} or augment those provided as `styles`. * * @remarks * Optional. If not applicable, provide `styles`. */ properties?: StyleProperties; }; /** * Definition for a single Adaptive UI style rule, which maps to a rule in a normal CSS style sheet. * * @public */ export type StyleRule = { /** * The target for the style rule, used to build the CSS selector. * * @remarks * Optional. If not supplied defaults to the host element for web components. */ target?: StyleModuleTarget; } & StyleDeclaration; /** * @public */ export declare const Fill: { backgroundAndForeground: (background: InteractiveTokenGroup, foregroundRecipe: TypedDesignToken) => StyleProperties; backgroundAndForegroundBySet: (background: InteractiveTokenGroup, foregroundRecipe: TypedDesignToken) => StyleProperties; backgroundNonInteractive: (background: TypedCSSDesignToken, disabled?: TypedCSSDesignToken) => StyleProperties; foregroundNonInteractive: (foreground: TypedCSSDesignToken, disabled?: TypedCSSDesignToken) => StyleProperties; }; /** * @public * @deprecated Use StylePropertyShorthand instead */ export declare const BorderFill: { all: (value: StyleValue) => StyleProperties; }; /** * @public * @deprecated Use StylePropertyShorthand instead */ export declare const BorderThickness: { all: (value: StyleValue) => StyleProperties; }; /** * @public * @deprecated Use StylePropertyShorthand instead */ export declare const BorderStyle: { all: (value: StyleValue) => StyleProperties; }; /** * @public * @deprecated Use StylePropertyShorthand instead */ export declare const CornerRadius: { all: (value: StyleValue) => StyleProperties; }; /** * @public * @deprecated Use StylePropertyShorthand instead */ export declare const Padding: { all: (value: StyleValue) => StyleProperties; verticalHorizontal: (valueVertical: StyleValue, valueHorizontal: StyleValue) => StyleProperties; }; /** * Converts `Styles` to focus-only state. This allows styles to be constructed as usual, using interactive sets * or simple values, but convert the styles specifically to focus state to the necessary structure. * * @param styles - The input `Styles` to convert to focus-only styles. * @returns Converted `Styles`. * * @public */ export declare const convertStylesToFocusState: (styles: Styles) => Styles; /** * A composable definition of style properties, either an alias to another style or a collection of style properties. * * @public */ export declare class Styles { /** * The style module name. */ readonly name: string | undefined; private _composed?; private _properties?; private _effectiveProperties; private constructor(); /** * Gets the array of composed styles. */ get composed(): Styles[] | undefined; /** * Clears the array of composed styles. */ clearComposed(): void; appendComposed(styles: Styles): void; /** * The local properties or composition overrides. */ get properties(): Readonly | undefined; set properties(properties: StylePropertiesMap | undefined); /** * Gets the full effective set of properties, from composed styles and local properties as applicable. */ get effectiveProperties(): EffectiveStylePropertiesMap; /** * Gets the set of effective properties that support Adaptive UI design-to-code. */ get effectiveAdaptiveProperties(): Map; private createEffectiveProperties; static Shared: Map; /** * Creates a new Styles object for the composed styles. * * @param styles - An array of styles to compose. * @param properties - Individual properties to append to the styles. * @param name - A name for the styles used for lookup. * @returns A new Styles object representing the composed styles. */ static compose(styles: Styles[], properties?: StyleProperties, name?: string): Styles; /** * Creates a new Styles object for the individual properties. * * @param properties - Individual properties for the new style module. * @param name - A name for the styles used for lookup. * @returns A new Styles object representing the properties. */ static fromProperties(properties: StyleProperties, name?: string): Styles; /** * Creates a new Styles object for the declared styles. * * @param declaration - The style declaration * @param name - A name for the styles used for lookup. * @returns A new Styles object representing the declared styles. */ static fromDeclaration(declaration: StyleDeclaration, name?: string): Styles; }