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

package.dist.theming.getThemeDesignerTheme.js.map Maven / Gradle / Ivy

{"version":3,"file":"getThemeDesignerTheme.js","sourceRoot":"","sources":["../../src/theming/getThemeDesignerTheme.ts"],"names":[],"mappings":"AAUA,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAU,CAAC;AAEnC,MAAM,gBAAgB,GAAG,GAAG,EAAE;IAC7B,qGAAqG;IACrG,IAAI,EAAE,GAAG,QAAQ,CAAC,aAAa,CAAC,gCAAgC,CAAC,IAAI,QAAQ,CAAC,aAAa,CAAC,mCAAmC,CAAC,CAAC;IACjI,IAAI,EAAE,EAAE;QACP,OAAO,gBAAgB,CAAC,EAAE,CAAC,CAAC,eAAe,CAAC;KAC5C;IAED,EAAE,GAAG,QAAQ,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;IACnC,EAAsB,CAAC,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC;IAE/C,+CAA+C;IAC/C,EAAE,CAAC,SAAS,CAAC,GAAG,CAAC,+BAA+B,CAAC,CAAC;IAClD,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;IAC9B,IAAI,QAAQ,GAAG,gBAAgB,CAAC,EAAE,CAAC,CAAC,eAAe,CAAC;IAEpD,wFAAwF;IACxF,IAAI,QAAQ,KAAK,MAAM,EAAE;QACxB,EAAE,CAAC,SAAS,CAAC,GAAG,CAAC,kCAAkC,CAAC,CAAC;QACrD,QAAQ,GAAG,gBAAgB,CAAC,EAAE,CAAC,CAAC,eAAe,CAAC;KAChD;IAED,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;IAE9B,OAAO,QAAQ,CAAC;AACjB,CAAC,CAAC;AAEF,MAAM,kBAAkB,GAAG,CAAC,cAAsB,EAAE,EAAE;IACrD,MAAM,MAAM,GAAG,8CAA8C,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IACnF,IAAI,MAAM,IAAI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AAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE;YAC5B,OAAO,CAAC,IAAI,CAAC,iCAAiC,EAAE,QAAQ,CAAC,CAAC,CAAC,sBAAsB;YACjF,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;SACvB;QACD,OAAO;KACP;IAED,OAAO;QACN,SAAS;QACT,aAAa;KACb,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,qBAAqB,GAAG,GAAgC,EAAE;IAC/D,MAAM,cAAc,GAAG,gBAAgB,EAAE,CAAC;IAC1C,IAAI,CAAC,cAAc,IAAI,cAAc,KAAK,MAAM,EAAE;QACjD,OAAO;KACP;IAED,MAAM,QAAQ,GAAG,kBAAkB,CAAC,cAAc,CAAC,CAAC;IAEpD,IAAI,QAAQ,EAAE;QACb,OAAO,oBAAoB,CAAC,QAAQ,CAAC,CAAC;KACtC;AACF,CAAC,CAAC;AAEF,eAAe,qBAAqB,CAAC","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"]}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy