Website : rimsha.abasa.com
backdoor
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
var
/
canvas
/
node_modules
/
@instructure
/
emotion
/
lib
/
Filename :
getTheme.js
back
Copy
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getTheme = exports.default = void 0; var _uiThemes = require("@instructure/ui-themes"); var _themeRegistry = require("@instructure/theme-registry"); var _isBaseTheme = require("@instructure/ui-utils/lib/isBaseTheme.js"); var _mergeDeep = require("@instructure/ui-utils/lib/mergeDeep.js"); /* * The MIT License (MIT) * * Copyright (c) 2015 - present Instructure, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ /** * --- * private: true * --- * Gives back the theme object for the the provider. * * If a valid InstUI theme is given, it just returns the theme. * * If an override object is given, it returns the ancestor theme and * the overrides merged together. * * @param {object} themeOrOverride - A full theme or an override object * @returns {function} A function that returns with the theme object for the [ThemeProvider](https://emotion.sh/docs/theming#themeprovider-reactcomponenttype) */ const getTheme = themeOrOverride => (ancestorTheme = {}) => { var _themeOrOverride, _themeOrOverride$them; try { // If a valid InstUI theme is given, it just returns the theme. if ((0, _isBaseTheme.isBaseTheme)(themeOrOverride)) { return themeOrOverride; } } catch { // If the prop passed is not an Object, it will throw an error. // We are using this fail-safe here for the non-TS users, // because the whole page can break without a theme. if (process.env.NODE_ENV !== 'production') {} // eslint-disable-next-line no-param-reassign themeOrOverride = {}; } // we need to clone the ancestor theme not to override it let currentTheme; if (Object.keys(ancestorTheme).length === 0) { const globalTheme = _themeRegistry.ThemeRegistry.getCurrentTheme(); if (process.env.NODE_ENV !== 'production' && !globalTheme) {} currentTheme = globalTheme || _uiThemes.canvas; } else { currentTheme = ancestorTheme; } const themeName = currentTheme.key; // we pick the overrides for the current theme from the override object const currentThemeOverrides = ((_themeOrOverride = themeOrOverride) === null || _themeOrOverride === void 0 ? void 0 : (_themeOrOverride$them = _themeOrOverride.themeOverrides) === null || _themeOrOverride$them === void 0 ? void 0 : _themeOrOverride$them[themeName]) || themeOrOverride.themeOverrides || {}; return (0, _mergeDeep.mergeDeep)(currentTheme, themeOrOverride, currentThemeOverrides); }; exports.getTheme = getTheme; var _default = exports.default = getTheme;