UNPKG

3.25 kBSource Map (JSON)View Raw
1{"version":3,"file":"scheme.js","sourceRoot":"../src/","sources":["styles/scheme.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,aAAa,EAAsB,MAAM,qBAAqB,CAAC;AAGxF;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,gBAAgB,CAC9B,OAA2B,EAC3B,MAAqB,EACrB,KAAc;IAEd,IAAI,UAAU,GAAuB,OAAO,CAAC;IAC7C,IAAI,WAAW,CAAC;IAEhB,+EAA+E;IAC/E,IAAI,YAAY,GAAG,KAAK,IAAI,cAAc,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,EAAE,SAAS,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC,KAAK,CAAC;IAE3G,IAAI,KAAK,EAAE;QACT,WAAW,GAAG,EAAE,KAAK,OAAA,EAAE,CAAC;KACzB;IAED,IAAM,WAAW,GACf,MAAM,IAAI,YAAY,IAAI,YAAY,CAAC,OAAO,IAAI,YAAY,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAEjF,sGAAsG;IACtG,+BAA+B;IAC/B,IAAI,YAAY,IAAI,WAAW,IAAI,YAAY,KAAK,WAAW,EAAE;QAC/D,WAAW,GAAG,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC;QACrC,WAAW,CAAC,KAAK,CAAC,OAAO,GAAG,YAAY,CAAC,OAAO,CAAC;KAClD;IAED,IAAI,WAAW,EAAE;QACf,UAAU,GAAG;YACX,cAAc,EAAE;gBACd,QAAQ,EAAE,aAAa,CAAC,OAAO,CAAC,cAAc,CAAC,QAAQ,EAAE,WAAW,CAAC;gBACrE,cAAc,EAAE,OAAO,CAAC,cAAc,CAAC,cAAc;aACtD;SACF,CAAC;KACH;IAED,OAAO,UAAU,CAAC;AACpB,CAAC","sourcesContent":["import { Customizations, mergeSettings, ICustomizerContext } from '@uifabric/utilities';\nimport { ISchemeNames, ITheme } from '../interfaces/index';\n\n/**\n * @internal\n * This function is still in experimental phase in support of Foundation experimental development.\n * Its API signature and existence are subject to change.\n *\n * Modify context to activate the specified scheme or theme. For schemes, look in context (if available) and fall back\n * to global Customizations. If both scheme and theme are specified, scheme will be looked up in theme. In this case,\n * scheme must be present in theme arg, otherwise new context will default to theme arg (there is no fallback to\n * settings to look up scheme.)\n *\n * @param context - Context in which to get schemed customizations.\n * @param scheme - Scheme to get customizations for from theme arg (if supplied) OR from context and global settings.\n * @param theme - Theme to merge into context.\n * @returns modified schemed context if scheme is valid and not already applied, unmodified context otherwise.\n */\nexport function getThemedContext(\n context: ICustomizerContext,\n scheme?: ISchemeNames,\n theme?: ITheme,\n): ICustomizerContext {\n let newContext: ICustomizerContext = context;\n let newSettings;\n\n // Only fall back to context and customizations when theme arg is not provided.\n let schemeSource = theme || Customizations.getSettings(['theme'], undefined, context.customizations).theme;\n\n if (theme) {\n newSettings = { theme };\n }\n\n const schemeTheme: ITheme | undefined =\n scheme && schemeSource && schemeSource.schemes && schemeSource.schemes[scheme];\n\n // These first two checks are logically redundant but TS doesn't infer schemeSource.schemes is defined\n // when schemeTheme is defined.\n if (schemeSource && schemeTheme && schemeSource !== schemeTheme) {\n newSettings = { theme: schemeTheme };\n newSettings.theme.schemes = schemeSource.schemes;\n }\n\n if (newSettings) {\n newContext = {\n customizations: {\n settings: mergeSettings(context.customizations.settings, newSettings),\n scopedSettings: context.customizations.scopedSettings,\n },\n };\n }\n\n return newContext;\n}\n"]}
\No newline at end of file