import { DesignSystem } from '@microsoft/fast-foundation'; /** * DesignSystemModule. * @public */ export interface DesignSystemModule { provideDesignSystem(element?: HTMLElement, prefix?: string): DesignSystem | Pick; [key: string]: any; } /** * DesignSystemResource. * @public */ export type DesignSystemResource = Promise; /** * assureDesignSystem. * * @remarks * Webpack caching strategies can backfill missing modules with placeholders in an attempt to prevent errors. In the case * of offline remotes, we rely on the error to fall back to local versions. This utility assures we have a design system. * * @example * ```ts * async function zeroDesignSystemImport(): Promise { * let module: DesignSystemModule; * let type: ResourceType = ResourceType.remote; * try { * module = await import('foundationZero/ZeroDesignSystem'); * return assureDesignSystem(module); * } catch (e) { * logger.info( * `Please note remoteEntry.js load errors are expected if module federated dependencies are offline. Falling back to locally bundled versions.`, * ); * type = ResourceType.local; * module = await import('@genesislcap/foundation-zero'); * return assureDesignSystem(module); * } finally { * logger.debug(`Using '${type}' version of foundation-zero`); * } * } * ``` * * @example You should also instruct webpack to use strict module handling. * ```ts * output: { * strictModuleErrorHandling: true, * strictModuleExceptionHandling: true, * } * ``` * * @public */ export declare function assureDesignSystem(module: DesignSystemModule): DesignSystemModule; /** * Get the current design system provider element and prefix by checking available providers. * If no provider is found, falls back to the provided prefix. * @param element - The starting HTML element * @param fallbackPrefix - The prefix to fallback to if the provider is not available * @returns An object containing the current design system provider element and prefix * * @example * ```ts * const { element: providerElement, prefix } = getCurrentDesignSystem(myElement, 'default-prefix'); * logger.debug(prefix); // e.g., 'rapid' or 'default-prefix' * logger.debug(providerElement); // The provider element or null * ``` * @public */ export declare function getCurrentDesignSystem(element: HTMLElement, fallbackPrefix: string): { element: HTMLElement | null; prefix: string; }; /** * Get the current design system prefix by checking available providers. * If no provider is found, falls back to the provided prefix. * @param element - The starting HTML element * @param fallbackPrefix - The prefix to fallback to if the provider is not available * @returns The current design system prefix * * @example * ```ts * const prefix = getCurrentDesignSystemPrefix(myElement, 'default-prefix'); * logger.debug(prefix); // e.g., 'rapid' or 'default-prefix' * ``` * @public */ export declare function getCurrentDesignSystemPrefix(element: HTMLElement, fallbackPrefix: string): string; //# sourceMappingURL=design-system.d.ts.map