11import  type  {  ConfigBase  }  from  '@unocss/core' ; 
22import  {  createGenerator  }  from  '@unocss/core' ; 
33import  {  presetTypography  }  from  '@unocss/preset-typography' ; 
4- import  {  presetWind  }  from  '@unocss/preset-wind ' ; 
5- import  {  presetUno  }  from  '@unocss/preset-uno ' ; 
4+ import  {  presetWind3  }  from  '@unocss/preset-wind3 ' ; 
5+ import  {  presetWind4  }  from  '@unocss/preset-wind4 ' ; 
66import  {  presetRemToPx  }  from  '@unocss/preset-rem-to-px' ; 
77import  transformerCompileClass  from  '@unocss/transformer-compile-class' ; 
88import  transformerVariantGroup  from  '@unocss/transformer-variant-group' ; 
@@ -26,11 +26,19 @@ export interface TailwindProps {
2626    'layers'  |  'presets'  |  'rules'  |  'separators'  |  'shortcuts'  |  'theme'  |  'variants' 
2727  > ; 
2828  production ?: boolean ; 
29+   version ?: '3'  |  '4' ; 
30+ } 
31+ 
32+ interface  GetUnoOptions  { 
33+   config : ConfigBase ; 
34+   production : boolean ; 
35+   version : '3'  |  '4' ; 
2936} 
3037
3138const  debugProps  =  debug . elements . enabled  ? {  dataType : 'jsx-email/tailwind'  }  : { } ; 
3239
33- const  getUno  =  async  ( config : ConfigBase ,  production : boolean )  =>  { 
40+ const  getUno  =  async  ( options : GetUnoOptions )  =>  { 
41+   const  {  config,  production,  version }  =  options ; 
3442  const  transformers  =  [ transformerVariantGroup ( ) ] ; 
3543
3644  if  ( production ) 
@@ -55,8 +63,7 @@ const getUno = async (config: ConfigBase, production: boolean) => {
5563    // Convert all `rem` values to `px` 
5664    presetRemToPx ( ) , 
5765    presetTypography ( ) , 
58-     presetUno ( {  dark : 'media'  } ) , 
59-     presetWind ( ) 
66+     version  ===  '3'  ? presetWind3 ( {  dark : 'media'  } )  : presetWind4 ( {  dark : 'media'  } ) 
6067  ] ; 
6168  const  uno  =  await  createGenerator ( { 
6269    ...( config  as  any ) , 
@@ -70,9 +77,10 @@ const getUno = async (config: ConfigBase, production: boolean) => {
7077const  render  =  async  ( { 
7178  children, 
7279  config =  { } , 
73-   production =  false 
80+   production =  false , 
81+   version =  '3' 
7482} : React . PropsWithChildren < TailwindProps > )  =>  { 
75-   const  uno  =  await  getUno ( config ,  production ) ; 
83+   const  uno  =  await  getUno ( {   config,  production,  version  } ) ; 
7684  const  html  =  await  jsxToString ( < > { children } </ > ) ; 
7785  const  code  =  production  ? html . replace ( / c l a s s = " / g,  'class=":jsx: ' )  : html ; 
7886  const  s  =  new  MagicString ( code ) ; 
0 commit comments