@@ -266,22 +266,22 @@ function resolveThemeColor<T extends ThemeKey>(
266266 return value ? asColor ( value , candidate . modifier , theme ) : null
267267}
268268
269+ /**
270+ * The alpha and beta releases used `_` in theme keys to represent a `.`. This meant we used
271+ * `--leading-1_5` instead of `--leading-1\.5` to add utilities like `leading-1.5`.
272+ *
273+ * We prefer the use of the escaped dot now but still want to make sure suggestions for the
274+ * legacy key format still works as expected when surrounded by numbers.
275+ */
276+ const LEGACY_NUMERIC_KEY = / ( \d + ) _ ( \d + ) / g
277+
269278export function createUtilities ( theme : Theme ) {
270279 let utilities = new Utilities ( )
271280
272281 /**
273282 * Register list of suggestions for a class
274283 */
275284 function suggest ( classRoot : string , defns : ( ) => SuggestionDefinition [ ] ) {
276- /**
277- * The alpha and beta releases used `_` in theme keys to represent a `.`. This meant we used
278- * `--leading-1_5` instead of `--leading-1\.5` to add utilities like `leading-1.5`.
279- *
280- * We prefer the use of the escaped dot now but still want to make sure suggestions for the
281- * legacy key format still works as expected when surrounded by numbers.
282- */
283- const LEGACY_NUMERIC_KEY = / ( \d + ) _ ( \d + ) / g
284-
285285 function * resolve ( themeKeys : ThemeKey [ ] ) {
286286 for ( let value of theme . keysInNamespaces ( themeKeys ) ) {
287287 yield value . replace ( LEGACY_NUMERIC_KEY , ( _ , a , b ) => {
@@ -5182,7 +5182,7 @@ export function createUtilities(theme: Theme) {
51825182 {
51835183 valueThemeKeys : [ '--text-shadow' ] ,
51845184 modifiers : Array . from ( { length : 21 } , ( _ , index ) => `${ index * 5 } ` ) ,
5185- hasDefaultValue : true ,
5185+ hasDefaultValue : theme . get ( [ '--text-shadow' ] ) !== null ,
51865186 } ,
51875187 ] )
51885188
@@ -5335,7 +5335,7 @@ export function createUtilities(theme: Theme) {
53355335 {
53365336 valueThemeKeys : [ '--shadow' ] ,
53375337 modifiers : Array . from ( { length : 21 } , ( _ , index ) => `${ index * 5 } ` ) ,
5338- hasDefaultValue : true ,
5338+ hasDefaultValue : theme . get ( [ '--shadow' ] ) !== null ,
53395339 } ,
53405340 ] )
53415341
@@ -5462,7 +5462,7 @@ export function createUtilities(theme: Theme) {
54625462 {
54635463 valueThemeKeys : [ '--inset-shadow' ] ,
54645464 modifiers : Array . from ( { length : 21 } , ( _ , index ) => `${ index * 5 } ` ) ,
5465- hasDefaultValue : true ,
5465+ hasDefaultValue : theme . get ( [ '--inset-shadow' ] ) !== null ,
54665466 } ,
54675467 ] )
54685468
@@ -6060,7 +6060,11 @@ export function createCssUtility(node: AtRule) {
60606060
60616061 // Suggest theme values. E.g.: `--value(--color-*)`
60626062 for ( let value of designSystem . theme . keysInNamespaces ( themeKeys ) ) {
6063- target . push ( value )
6063+ target . push (
6064+ value . replace ( LEGACY_NUMERIC_KEY , ( _ , a , b ) => {
6065+ return `${ a } .${ b } `
6066+ } ) ,
6067+ )
60646068 }
60656069 }
60666070
0 commit comments