All Downloads are FREE. Search and download functionalities are using the official Maven repository.

package.dist.prod.theming.applyTheme.js.map Maven / Gradle / Ivy

{
  "version": 3,
  "sources": ["../../../src/theming/applyTheme.ts"],
  "sourcesContent": ["import { getThemeProperties, getRegisteredPackages, isThemeRegistered } from \"../asset-registries/Themes.js\";\nimport { removeStyle, createOrUpdateStyle } from \"../ManagedStyles.js\";\nimport getThemeDesignerTheme from \"./getThemeDesignerTheme.js\";\nimport { fireThemeLoaded } from \"./ThemeLoaded.js\";\nimport { getFeature } from \"../FeaturesRegistry.js\";\nimport { attachCustomThemeStylesToHead, getThemeRoot } from \"../config/ThemeRoot.js\";\nimport type OpenUI5Support from \"../features/OpenUI5Support.js\";\nimport { DEFAULT_THEME } from \"../generated/AssetParameters.js\";\nimport { getCurrentRuntimeIndex } from \"../Runtimes.js\";\n\nconst BASE_THEME_PACKAGE = \"@ui5/webcomponents-theming\";\n\nconst isThemeBaseRegistered = () => {\n\tconst registeredPackages = getRegisteredPackages();\n\treturn registeredPackages.has(BASE_THEME_PACKAGE);\n};\n\nconst loadThemeBase = async (theme: string) => {\n\tif (!isThemeBaseRegistered()) {\n\t\treturn;\n\t}\n\n\tconst cssData = await getThemeProperties(BASE_THEME_PACKAGE, theme);\n\tif (cssData) {\n\t\tcreateOrUpdateStyle(cssData, \"data-ui5-theme-properties\", BASE_THEME_PACKAGE, theme);\n\t}\n};\n\nconst deleteThemeBase = () => {\n\tremoveStyle(\"data-ui5-theme-properties\", BASE_THEME_PACKAGE);\n};\n\nconst loadComponentPackages = async (theme: string, externalThemeName?: string) => {\n\tconst registeredPackages = getRegisteredPackages();\n\n\tconst packagesStylesPromises = [...registeredPackages].map(async packageName => {\n\t\tif (packageName === BASE_THEME_PACKAGE) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst cssData = await getThemeProperties(packageName, theme, externalThemeName);\n\t\tif (cssData) {\n\t\t\tcreateOrUpdateStyle(cssData, `data-ui5-component-properties-${getCurrentRuntimeIndex()}`, packageName);\n\t\t}\n\t});\n\n\treturn Promise.all(packagesStylesPromises);\n};\n\nconst detectExternalTheme = async (theme: string) => {\n\t// If theme designer theme is detected, use this\n\tconst extTheme = getThemeDesignerTheme();\n\tif (extTheme) {\n\t\treturn extTheme;\n\t}\n\n\t// If OpenUI5Support is enabled, try to find out if it loaded variables\n\tconst openUI5Support = getFeature(\"OpenUI5Support\");\n\tif (openUI5Support && openUI5Support.isOpenUI5Detected()) {\n\t\tconst varsLoaded = openUI5Support.cssVariablesLoaded();\n\t\tif (varsLoaded) {\n\t\t\treturn {\n\t\t\t\tthemeName: openUI5Support.getConfigurationSettingsObject()?.theme, // just themeName\n\t\t\t\tbaseThemeName: \"\", // baseThemeName is only relevant for custom themes\n\t\t\t};\n\t\t}\n\t} else if (getThemeRoot()) {\n\t\tawait attachCustomThemeStylesToHead(theme);\n\n\t\treturn getThemeDesignerTheme();\n\t}\n};\n\nconst applyTheme = async (theme: string) => {\n\tconst extTheme = await detectExternalTheme(theme);\n\n\t// Only load theme_base properties if there is no externally loaded theme, or there is, but it is not being loaded\n\tif (!extTheme || theme !== extTheme.themeName) {\n\t\tawait loadThemeBase(theme);\n\t} else {\n\t\tdeleteThemeBase();\n\t}\n\n\t// Always load component packages properties. For non-registered themes, try with the base theme, if any\n\tconst packagesTheme = isThemeRegistered(theme) ? theme : extTheme && extTheme.baseThemeName;\n\tawait loadComponentPackages(packagesTheme || DEFAULT_THEME, extTheme && extTheme.themeName === theme ? theme : undefined);\n\n\tfireThemeLoaded(theme);\n};\n\nexport default applyTheme;\n"],
  "mappings": "aAAA,OAAS,sBAAAA,EAAoB,yBAAAC,EAAuB,qBAAAC,MAAyB,gCAC7E,OAAS,eAAAC,EAAa,uBAAAC,MAA2B,sBACjD,OAAOC,MAA2B,6BAClC,OAAS,mBAAAC,MAAuB,mBAChC,OAAS,cAAAC,MAAkB,yBAC3B,OAAS,iCAAAC,EAA+B,gBAAAC,MAAoB,yBAE5D,OAAS,iBAAAC,MAAqB,kCAC9B,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,YAAcR,EAAQA,EAAQ,MAAS,EAExHT,EAAgBS,CAAK,CACtB,EAEA,eAAeU",
  "names": ["getThemeProperties", "getRegisteredPackages", "isThemeRegistered", "removeStyle", "createOrUpdateStyle", "getThemeDesignerTheme", "fireThemeLoaded", "getFeature", "attachCustomThemeStylesToHead", "getThemeRoot", "DEFAULT_THEME", "getCurrentRuntimeIndex", "BASE_THEME_PACKAGE", "isThemeBaseRegistered", "loadThemeBase", "theme", "cssData", "deleteThemeBase", "loadComponentPackages", "externalThemeName", "packagesStylesPromises", "packageName", "detectExternalTheme", "extTheme", "openUI5Support", "applyTheme", "packagesTheme"]
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy