@@ -49,6 +49,20 @@ StyleDictionary.registerTransform({
4949 } ,
5050} ) ;
5151
52+ /**
53+ * Custom Transform: Re-join negative number name segments
54+ * Looks for occurrences of `n-{number}` and removes the `-`. Useful for keeping
55+ * negative number modular scale step token names consistent with related class
56+ * names.
57+ */
58+ StyleDictionary . registerTransform ( {
59+ name : 'custom/name/i/kebab-rejoin-n' ,
60+ type : 'name' ,
61+ transformer : function ( prop ) {
62+ return prop . name . replace ( / - n - ( \d ) / g, '-n$1' ) ;
63+ } ,
64+ } ) ;
65+
5266/**
5367 * Custom Transform Group: CSS
5468 * This is a modified version of the CSS transform group without the time,
@@ -57,7 +71,12 @@ StyleDictionary.registerTransform({
5771 */
5872StyleDictionary . registerTransformGroup ( {
5973 name : 'custom/transform-group/css' ,
60- transforms : [ 'attribute/cti' , 'name/cti/kebab' , 'color/css' ] ,
74+ transforms : [
75+ 'attribute/cti' ,
76+ 'name/cti/kebab' ,
77+ 'custom/name/i/kebab-rejoin-n' ,
78+ 'color/css' ,
79+ ] ,
6180} ) ;
6281
6382/**
@@ -67,7 +86,12 @@ StyleDictionary.registerTransformGroup({
6786 */
6887StyleDictionary . registerTransformGroup ( {
6988 name : 'custom/transform-group/css-category' ,
70- transforms : [ 'attribute/cti' , 'custom/name/ti/kebab' , 'color/css' ] ,
89+ transforms : [
90+ 'attribute/cti' ,
91+ 'custom/name/ti/kebab' ,
92+ 'custom/name/i/kebab-rejoin-n' ,
93+ 'color/css' ,
94+ ] ,
7195} ) ;
7296
7397/**
@@ -77,7 +101,12 @@ StyleDictionary.registerTransformGroup({
77101 */
78102StyleDictionary . registerTransformGroup ( {
79103 name : 'custom/transform-group/css-category-type' ,
80- transforms : [ 'attribute/cti' , 'custom/name/i/kebab' , 'color/css' ] ,
104+ transforms : [
105+ 'attribute/cti' ,
106+ 'custom/name/i/kebab' ,
107+ 'custom/name/i/kebab-rejoin-n' ,
108+ 'color/css' ,
109+ ] ,
81110} ) ;
82111
83112/**
0 commit comments