@trackunit/ui-design-tokens
Advanced tools
Comparing version 1.0.1 to 1.0.3
@@ -106,7 +106,6 @@ 'use strict'; | ||
const getHEX = (variable) => { | ||
var _a, _b, _c, _d, _e; | ||
const regex = /rgb\(var\((.*?)\) \/ var\(--tw-bg-opacity\)\)/g; | ||
const root = document.documentElement; | ||
const match = regex.exec(variable); | ||
const colorValue = getComputedStyle(root).getPropertyValue((_b = (_a = match === null || match === void 0 ? void 0 : match[1]) === null || _a === void 0 ? void 0 : _a.trim()) !== null && _b !== void 0 ? _b : variable); | ||
const colorValue = getComputedStyle(root).getPropertyValue(match?.[1]?.trim() ?? variable); | ||
const RGB = colorValue | ||
@@ -116,3 +115,3 @@ .trim() | ||
.map(channel => Number(channel)); | ||
return rgbToHex((_c = RGB[0]) !== null && _c !== void 0 ? _c : NaN, (_d = RGB[1]) !== null && _d !== void 0 ? _d : NaN, (_e = RGB[2]) !== null && _e !== void 0 ? _e : NaN); | ||
return rgbToHex(RGB[0] ?? NaN, RGB[1] ?? NaN, RGB[2] ?? NaN); | ||
}; | ||
@@ -599,9 +598,9 @@ | ||
function color(ColorKey, arg2, arg3) { | ||
var _a, _b; | ||
const colorName = themeColors[ColorKey].name; | ||
const colorVariants = themeColors[ColorKey].variants; | ||
// defaultVariant or 600 or the "middel" value available. | ||
const defaultVariant = (_b = (_a = themeColors[ColorKey].defaultVariant) !== null && _a !== void 0 ? _a : | ||
// @ts-ignore - suppressImplicitAnyIndexErrors | ||
(colorVariants[600] && 600)) !== null && _b !== void 0 ? _b : Object.keys(colorVariants)[Math.floor(Object.keys(colorVariants).length / 2)]; | ||
const defaultVariant = themeColors[ColorKey].defaultVariant ?? | ||
// @ts-ignore - suppressImplicitAnyIndexErrors | ||
(colorVariants[600] && 600) ?? | ||
Object.keys(colorVariants)[Math.floor(Object.keys(colorVariants).length / 2)]; | ||
let variant = defaultVariant; | ||
@@ -608,0 +607,0 @@ let output = "CSS"; |
@@ -104,7 +104,6 @@ /** | ||
const getHEX = (variable) => { | ||
var _a, _b, _c, _d, _e; | ||
const regex = /rgb\(var\((.*?)\) \/ var\(--tw-bg-opacity\)\)/g; | ||
const root = document.documentElement; | ||
const match = regex.exec(variable); | ||
const colorValue = getComputedStyle(root).getPropertyValue((_b = (_a = match === null || match === void 0 ? void 0 : match[1]) === null || _a === void 0 ? void 0 : _a.trim()) !== null && _b !== void 0 ? _b : variable); | ||
const colorValue = getComputedStyle(root).getPropertyValue(match?.[1]?.trim() ?? variable); | ||
const RGB = colorValue | ||
@@ -114,3 +113,3 @@ .trim() | ||
.map(channel => Number(channel)); | ||
return rgbToHex((_c = RGB[0]) !== null && _c !== void 0 ? _c : NaN, (_d = RGB[1]) !== null && _d !== void 0 ? _d : NaN, (_e = RGB[2]) !== null && _e !== void 0 ? _e : NaN); | ||
return rgbToHex(RGB[0] ?? NaN, RGB[1] ?? NaN, RGB[2] ?? NaN); | ||
}; | ||
@@ -597,9 +596,9 @@ | ||
function color(ColorKey, arg2, arg3) { | ||
var _a, _b; | ||
const colorName = themeColors[ColorKey].name; | ||
const colorVariants = themeColors[ColorKey].variants; | ||
// defaultVariant or 600 or the "middel" value available. | ||
const defaultVariant = (_b = (_a = themeColors[ColorKey].defaultVariant) !== null && _a !== void 0 ? _a : | ||
// @ts-ignore - suppressImplicitAnyIndexErrors | ||
(colorVariants[600] && 600)) !== null && _b !== void 0 ? _b : Object.keys(colorVariants)[Math.floor(Object.keys(colorVariants).length / 2)]; | ||
const defaultVariant = themeColors[ColorKey].defaultVariant ?? | ||
// @ts-ignore - suppressImplicitAnyIndexErrors | ||
(colorVariants[600] && 600) ?? | ||
Object.keys(colorVariants)[Math.floor(Object.keys(colorVariants).length / 2)]; | ||
let variant = defaultVariant; | ||
@@ -606,0 +605,0 @@ let output = "CSS"; |
{ | ||
"name": "@trackunit/ui-design-tokens", | ||
"version": "1.0.1", | ||
"version": "1.0.3", | ||
"repository": "https://github.com/Trackunit/manager", | ||
@@ -5,0 +5,0 @@ "license": "SEE LICENSE IN LICENSE.txt", |
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
5332
0
98900
3114