Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
package.dist.prod.theming.getThemeDesignerTheme.js.map Maven / Gradle / Ivy
{
"version": 3,
"sources": ["../../../src/theming/getThemeDesignerTheme.ts"],
"sourcesContent": ["type ThemeDescriptor = {\n\tthemeName: string,\n\tbaseThemeName?: string,\n};\n\ntype ThemeMetadata = {\n\tPath: string,\n\tExtends: Array,\n};\n\nconst warnings = new Set();\n\nconst getThemeMetadata = () => {\n\t// Check if the class was already applied, most commonly to the link/style tag with the CSS Variables\n\tlet el = document.querySelector(\".sapThemeMetaData-Base-baseLib\") || document.querySelector(\".sapThemeMetaData-UI5-sap-ui-core\");\n\tif (el) {\n\t\treturn getComputedStyle(el).backgroundImage;\n\t}\n\n\tel = document.createElement(\"span\");\n\t(el as HTMLSpanElement).style.display = \"none\";\n\n\t// Try with sapThemeMetaData-Base-baseLib first\n\tel.classList.add(\"sapThemeMetaData-Base-baseLib\");\n\tdocument.body.appendChild(el);\n\tlet metadata = getComputedStyle(el).backgroundImage;\n\n\t// Try with sapThemeMetaData-UI5-sap-ui-core only if the previous selector was not found\n\tif (metadata === \"none\") {\n\t\tel.classList.add(\"sapThemeMetaData-UI5-sap-ui-core\");\n\t\tmetadata = getComputedStyle(el).backgroundImage;\n\t}\n\n\tdocument.body.removeChild(el);\n\n\treturn metadata;\n};\n\nconst parseThemeMetadata = (metadataString: string) => {\n\tconst params = /\\([\"']?data:text\\/plain;utf-8,(.*?)['\"]?\\)$/i.exec(metadataString);\n\tif (params && params.length >= 2) {\n\t\tlet paramsString = params[1];\n\t\tparamsString = paramsString.replace(/\\\\\"/g, `\"`);\n\t\tif (paramsString.charAt(0) !== \"{\" && paramsString.charAt(paramsString.length - 1) !== \"}\") {\n\t\t\ttry {\n\t\t\t\tparamsString = decodeURIComponent(paramsString);\n\t\t\t} catch (ex) {\n\t\t\t\tif (!warnings.has(\"decode\")) {\n\t\t\t\t\tconsole.warn(\"Malformed theme metadata string, unable to decodeURIComponent\"); // eslint-disable-line\n\t\t\t\t\twarnings.add(\"decode\");\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\ttry {\n\t\t\treturn JSON.parse(paramsString) as ThemeMetadata;\n\t\t} catch (ex) {\n\t\t\tif (!warnings.has(\"parse\")) {\n\t\t\t\tconsole.warn(\"Malformed theme metadata string, unable to parse JSON\"); // eslint-disable-line\n\t\t\t\twarnings.add(\"parse\");\n\t\t\t}\n\t\t}\n\t}\n};\n\nconst processThemeMetadata = (metadata: ThemeMetadata): ThemeDescriptor | undefined => {\n\tlet themeName;\n\tlet baseThemeName;\n\n\ttry {\n\t\tthemeName = metadata.Path.match(/\\.([^.]+)\\.css_variables$/)![1];\n\t\tbaseThemeName = metadata.Extends[0];\n\t} catch (ex) {\n\t\tif (!warnings.has(\"object\")) {\n\t\t\tconsole.warn(\"Malformed theme metadata Object\", metadata); // eslint-disable-line\n\t\t\twarnings.add(\"object\");\n\t\t}\n\t\treturn;\n\t}\n\n\treturn {\n\t\tthemeName,\n\t\tbaseThemeName,\n\t};\n};\n\nconst getThemeDesignerTheme = (): ThemeDescriptor | undefined => {\n\tconst metadataString = getThemeMetadata();\n\tif (!metadataString || metadataString === \"none\") {\n\t\treturn;\n\t}\n\n\tconst metadata = parseThemeMetadata(metadataString);\n\n\tif (metadata) {\n\t\treturn processThemeMetadata(metadata);\n\t}\n};\n\nexport default getThemeDesignerTheme;\nexport type { ThemeDescriptor };\n"],
"mappings": "aAUA,MAAMA,EAAW,IAAI,IAEfC,EAAmB,IAAM,CAE9B,IAAIC,EAAK,SAAS,cAAc,gCAAgC,GAAK,SAAS,cAAc,mCAAmC,EAC/H,GAAIA,EACH,OAAO,iBAAiBA,CAAE,EAAE,gBAG7BA,EAAK,SAAS,cAAc,MAAM,EACjCA,EAAuB,MAAM,QAAU,OAGxCA,EAAG,UAAU,IAAI,+BAA+B,EAChD,SAAS,KA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AeQ",
"names": ["warnings", "getThemeMetadata", "el", "metadata", "parseThemeMetadata", "metadataString", "params", "paramsString", "processThemeMetadata", "themeName", "baseThemeName", "getThemeDesignerTheme"]
}