@primer/primitives
Advanced tools
Comparing version
@@ -154,3 +154,5 @@ import { getReferences, usesReferences } from 'style-dictionary/utils'; | ||
.map((prop, index) => { | ||
if (originalValue[prop].startsWith('{')) { | ||
var _a; | ||
if (originalValue[prop].startsWith('{') && | ||
((_a = refs.find(ref => ref.path.join('.') === originalValue[prop].replace(/[{}]/g, ''))) === null || _a === void 0 ? void 0 : _a.isSource) === true) { | ||
return originalValue[prop]; | ||
@@ -186,3 +188,4 @@ } | ||
// technically speaking a reference can be made to a number or boolean token, in this case we stringify it first | ||
value = `${value}`.replace(value.match(/{/) ? new RegExp(`{${ref.path.join('\\.')}(\\.\\$?value)?}`, 'g') : refVal, replaceFunc); | ||
const regex = new RegExp(`{${ref.path.join('\\.')}(\\.\\$?value)?}`, 'g'); | ||
value = `${value}`.replace(regex, replaceFunc); | ||
} | ||
@@ -201,5 +204,4 @@ }); | ||
} | ||
// console.log('toRetToken', toRetToken) | ||
return toRetToken; | ||
}; | ||
} |
import { isFromFile, isSource } from '../filters/index.js'; | ||
import { outputReferencesTransformed, outputReferencesFilter } from 'style-dictionary/utils'; | ||
import { outputReferencesTransformedWithObject } from './utilities/outputReferencesTransformedWithObject.js'; | ||
import { outputReferencesFilterObject } from './utilities/outputReferencesFilterObject.js'; | ||
const getCssSelectors = (outputFile) => { | ||
@@ -56,4 +57,6 @@ // check for dark in the beginning of the output filename | ||
// outputReferences: true, | ||
outputReferences: (token, platformOptions) => outputReferencesFilter(token, platformOptions) && | ||
outputReferencesTransformedWithObject(token, platformOptions), descriptions: false, queries: getCssSelectors(outputFile) }, options === null || options === void 0 ? void 0 : options.options), | ||
outputReferences: (token, platformOptions) => { | ||
return (outputReferencesFilterObject(token, platformOptions) && | ||
outputReferencesTransformedWithObject(token, platformOptions)); | ||
}, descriptions: false, queries: getCssSelectors(outputFile) }, options === null || options === void 0 ? void 0 : options.options), | ||
}, | ||
@@ -60,0 +63,0 @@ { |
@@ -19,10 +19,10 @@ import { resolveReferences } from 'style-dictionary/utils'; | ||
if (typeof originalValue === 'object') { | ||
const values = Object.values(originalValue).filter(val => typeof val === 'string'); | ||
return values.every(val => { | ||
const originalValues = Object.values(originalValue).filter(val => typeof val === 'string'); | ||
return originalValues.some(origVal => { | ||
var _a; | ||
const resolvedValue = resolveReferences(val, (_a = dictionary.unfilteredTokens) !== null && _a !== void 0 ? _a : dictionary.tokens, { | ||
const resolvedValue = resolveReferences(origVal, (_a = dictionary.unfilteredTokens) !== null && _a !== void 0 ? _a : dictionary.tokens, { | ||
usesDtcg, | ||
warnImmediately: false, | ||
}); | ||
return typeof resolvedValue === 'string' ? values.includes(resolvedValue) : true; | ||
return typeof resolvedValue === 'string' ? value.split(' ').includes(resolvedValue) : false; | ||
}); | ||
@@ -29,0 +29,0 @@ } |
{ | ||
"name": "@primer/primitives", | ||
"version": "0.0.0-20250123103827", | ||
"version": "0.0.0-20250124091336", | ||
"description": "Typography, spacing, and color primitives for Primer design system", | ||
@@ -5,0 +5,0 @@ "type": "module", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
14303202
-5.9%415
-1.66%482505
-3.28%