UNPKG

braid-design-system

Version:
48 lines (46 loc) 1.35 kB
declare const flag = "_bdsdm"; declare global { interface Window { [flag]: '0' | '1' | '2'; } } /** * Script to resolve the color mode preference from the query string, used for passing the native mobile app color mode preference to an embedded Braid web UI. * * Pre-minified script tag, designed to be inserted at the beginning of the document head. This ensures the color mode preference is evaluated and applied before any renderering occurs, preventing the flash of light mode. * * --- * * Example usage: * * ```html * <html> * <head> * <!-- Place script here --> * ``` * * --- * * @returns Stringified script tag to place in document head. */ declare const colorModeQueryParamCheck: string; /** * For Braid UIs embedded within the native mobile app. * Retrieves the native app color mode preference as discovered on page load from the query string. * * (Note: Requires the `colorModeQueryParamCheck` to have been included in the head of the document and evaluated first) * * --- * * Example usage: * * ```ts * `/my-url?id=123&${getColorModeQueryParam()}` * ``` * * --- * * @returns Braid color mode preference as query string parameter */ declare const getColorModeQueryParam: () => "_bdsdm=0" | "_bdsdm=1" | "_bdsdm=2" | ""; export { colorModeQueryParamCheck, getColorModeQueryParam };