@autoguru/overdrive 4.14.5 → 4.14.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/utils/css.d.ts +3 -0
- package/dist/utils/css.d.ts.map +1 -0
- package/dist/utils/css.js +14 -0
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"css.d.ts","sourceRoot":"","sources":["../../lib/utils/css.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,YAAY,UAAW,MAAM,WAIzC,CAAC;AAEF,eAAO,MAAM,kBAAkB,eAAgB,MAAM,SAAS,MAAM,KAAG,MAAM,GAAG,IAK/E,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const cssVarRegExp = /var\(([^)]+)\)/;
|
|
4
|
+
export const cssVarUnwrap = value => {
|
|
5
|
+
const matches = cssVarRegExp.exec(value);
|
|
6
|
+
return matches ? matches[1] : value;
|
|
7
|
+
};
|
|
8
|
+
export const getThemeTokenValue = (themeClass, token) => {
|
|
9
|
+
var _getComputedStyle$get;
|
|
10
|
+
const cssVar = cssVarUnwrap(token);
|
|
11
|
+
const themedElement = document.querySelector(".".concat(themeClass));
|
|
12
|
+
if (!themedElement || !cssVar) return null;
|
|
13
|
+
return ((_getComputedStyle$get = getComputedStyle(themedElement).getPropertyValue(cssVar)) === null || _getComputedStyle$get === void 0 ? void 0 : _getComputedStyle$get.trim()) || null;
|
|
14
|
+
};
|