File tree Expand file tree Collapse file tree 3 files changed +40
-0
lines changed Expand file tree Collapse file tree 3 files changed +40
-0
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
18
18
- Discard matched variants with non-string values ([ #18799 ] ( https://github.com/tailwindlabs/tailwindcss/pull/18799 ) )
19
19
- Show suggestions for known ` matchVariant ` values ([ #18798 ] ( https://github.com/tailwindlabs/tailwindcss/pull/18798 ) )
20
20
- Replace deprecated ` clip ` with ` clip-path ` in ` sr-only ` ([ #18769 ] ( https://github.com/tailwindlabs/tailwindcss/pull/18769 ) )
21
+ - Hide internal fields from completions in ` matchUtilities ` ([ #18820 ] ( https://github.com/tailwindlabs/tailwindcss/pull/18820 ) )
21
22
- Upgrade: Migrate ` aria ` theme keys to ` @custom-variant ` ([ #18815 ] ( https://github.com/tailwindlabs/tailwindcss/pull/18815 ) )
22
23
- Upgrade: Migrate ` data ` theme keys to ` @custom-variant ` ([ #18816 ] ( https://github.com/tailwindlabs/tailwindcss/pull/18816 ) )
23
24
- Upgrade: Migrate ` supports ` theme keys to ` @custom-variant ` ([ #18817 ] ( https://github.com/tailwindlabs/tailwindcss/pull/18817 ) )
Original file line number Diff line number Diff line change @@ -472,6 +472,10 @@ export function buildPluginApi({
472
472
// work even with legacy configs and plugins
473
473
valueKeys . delete ( '__BARE_VALUE__' )
474
474
475
+ // The `__CSS_VALUES__` key is a special key used by the theme function
476
+ // to transport `@theme` metadata about values from CSS
477
+ valueKeys . delete ( '__CSS_VALUES__' )
478
+
475
479
// The `DEFAULT` key is represented as `null` in the utility API
476
480
if ( valueKeys . has ( 'DEFAULT' ) ) {
477
481
valueKeys . delete ( 'DEFAULT' )
Original file line number Diff line number Diff line change @@ -712,3 +712,38 @@ test('matchVariant', async () => {
712
712
expect ( v1 . name ) . toEqual ( 'foo' )
713
713
expect ( v1 . values ) . toEqual ( [ 'a' , 'b' ] )
714
714
} )
715
+
716
+ test ( 'matchUtilities discards internal only helpers from suggestions when using the theme function' , async ( ) => {
717
+ let input = css `
718
+ @import 'tailwindcss/utilities' ;
719
+ @plugin "./plugin.js" ;
720
+
721
+ @theme {
722
+ --color-red : red;
723
+ }
724
+ `
725
+
726
+ let design = await __unstable__loadDesignSystem ( input , {
727
+ loadStylesheet : async ( _ , base ) => ( {
728
+ path : '' ,
729
+ base,
730
+ content : '@tailwind utilities;' ,
731
+ } ) ,
732
+ loadModule : async ( ) => ( {
733
+ path : '' ,
734
+ base : '' ,
735
+ module : plugin ( ( { matchUtilities, theme } ) => {
736
+ matchUtilities ( { foo : ( val ) => ( { color : val } ) } , { values : theme ( 'colors' ) } )
737
+ matchUtilities ( { bar : ( val ) => ( { color : val } ) } , { values : theme ( 'transitionDuration' ) } )
738
+ } ) ,
739
+ } ) ,
740
+ } )
741
+
742
+ let classNames = design . getClassList ( ) . map ( ( e ) => e [ 0 ] )
743
+
744
+ expect ( classNames ) . not . toContain ( 'foo-__BARE_VALUE__' )
745
+ expect ( classNames ) . not . toContain ( 'bar-__BARE_VALUE__' )
746
+
747
+ expect ( classNames ) . not . toContain ( 'foo-__CSS_VALUES__' )
748
+ expect ( classNames ) . not . toContain ( 'bar-__CSS_VALUES__' )
749
+ } )
You can’t perform that action at this time.
0 commit comments