1
1
const transform = require ( 'style-dictionary/lib/common/transforms' ) ;
2
- const getPathFromName = require ( 'style-dictionary/lib/utils/references/getPathFromName' ) ;
3
- const createReferenceRegex = require ( 'style-dictionary/lib/utils/references/createReferenceRegex' ) ;
4
2
5
3
const unwrapObjectTransformer = ( token ) => {
6
4
return Object . keys ( token . value ) . map ( ( key ) => {
@@ -17,18 +15,6 @@ const unwrapObjectTransformer = (token) => {
17
15
} , { } ) ;
18
16
} ;
19
17
20
- const resolvePaletteRef = ( token , dictionary ) => {
21
- const regex = createReferenceRegex ( { } ) ;
22
-
23
- const findPalette = ( match , variable ) => {
24
- const [ category , item , ...pathName ] = getPathFromName ( variable ) ;
25
- const pathToSemanticPalette = dictionary . tokens [ category ] [ item ] . palette . original . value . replace ( / [ { } ] / g, '' ) ;
26
- return `{${ pathToSemanticPalette } .${ pathName [ pathName . length - 1 ] } }` ;
27
- } ;
28
- token . original . value = token . original . value . replace ( regex , findPalette ) ;
29
- return token ;
30
- } ;
31
-
32
18
const getMapFromObj = ( object ) => {
33
19
const result = Object . keys ( object )
34
20
. map ( ( key ) => {
@@ -49,9 +35,6 @@ const applyCustomTransformations = (dictionary) => {
49
35
if ( typeof token . value === 'object' && token . type === 'font' ) {
50
36
return unwrapObjectTransformer ( token ) ;
51
37
}
52
- if ( typeof token . original . value === 'string' && token . original . value . includes ( 'palette.value' ) ) {
53
- return resolvePaletteRef ( token , dictionary ) ;
54
- }
55
38
return token ;
56
39
} )
57
40
. filter ( ( token ) => ! token . attributes . palette ) ;
@@ -62,6 +45,5 @@ const applyCustomTransformations = (dictionary) => {
62
45
module . exports = {
63
46
unwrapObjectTransformer,
64
47
getMapFromObj,
65
- resolvePaletteRef,
66
48
applyCustomTransformations
67
49
} ;
0 commit comments