@warp-ds/tokenizer
Advanced tools
Comparing version 0.0.3 to 0.0.4
{ | ||
"name": "@warp-ds/tokenizer", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"exports": { | ||
@@ -5,0 +5,0 @@ ".": "./index.js" |
@@ -73,7 +73,14 @@ import fs from 'node:fs'; | ||
export const toCSSMap = ([k, v], duplicateAsRgb) => { | ||
let css = `${tokenKey(k)} var(--w-${v});`; | ||
if (duplicateAsRgb) { | ||
const rgbTokenKey = tokenKey(k.replace(/^(s-)?(color-)?(.*)/, '$1rgb-$3')); | ||
const rgbTokenValue = `var(--w-${v.replace(/^(s-)?(color-)?(.*)/, '$1rgb-$3')});`; | ||
css = css.concat(rgbTokenKey, rgbTokenValue); | ||
let css = `${tokenKey(k)}`; | ||
const alpha = v.match(/([^\/]+)\/(0|[1-9][0-9]?|100)$/); | ||
if (alpha) { | ||
const decimalAlpha = (parseFloat(alpha[2]) / 100).toString().replace(/^0\./, '.'); | ||
css += `rgba(var(--w-${alpha[1].replace(/^(s-)?(color-)?(.*)/, '$1rgb-$3')}),${decimalAlpha});`; | ||
} else { | ||
css += `var(--w-${v});`; | ||
if (duplicateAsRgb) { | ||
const rgbTokenKey = tokenKey(k.replace(/^(s-)?(color-)?(.*)/, '$1rgb-$3')); | ||
const rgbTokenValue = `var(--w-${v.replace(/^(s-)?(color-)?(.*)/, '$1rgb-$3')});`; | ||
css = css.concat(rgbTokenKey, rgbTokenValue); | ||
} | ||
} | ||
@@ -80,0 +87,0 @@ return css; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
13714
303
0