11import fs from 'fs'
22import * as path from 'path'
33import postcss from 'postcss'
4+ import { env } from './lib/sharedState'
45import createUtilityPlugin from './util/createUtilityPlugin'
56import buildMediaQuery from './util/buildMediaQuery'
67import escapeClassName from './util/escapeClassName'
@@ -646,6 +647,8 @@ export let corePlugins = {
646647 [ 'inset-y' , [ 'top' , 'bottom' ] ] ,
647648 ] ,
648649 [
650+ [ 'start' , [ 'inset-inline-start' ] ] ,
651+ [ 'end' , [ 'inset-inline-end' ] ] ,
649652 [ 'top' , [ 'top' ] ] ,
650653 [ 'right' , [ 'right' ] ] ,
651654 [ 'bottom' , [ 'bottom' ] ] ,
@@ -697,6 +700,8 @@ export let corePlugins = {
697700 [ 'my' , [ 'margin-top' , 'margin-bottom' ] ] ,
698701 ] ,
699702 [
703+ [ 'ms' , [ 'margin-inline-start' ] ] ,
704+ [ 'me' , [ 'margin-inline-end' ] ] ,
700705 [ 'mt' , [ 'margin-top' ] ] ,
701706 [ 'mr' , [ 'margin-right' ] ] ,
702707 [ 'mb' , [ 'margin-bottom' ] ] ,
@@ -767,6 +772,13 @@ export let corePlugins = {
767772 } )
768773 } ,
769774
775+ captionSide : ( { addUtilities } ) => {
776+ addUtilities ( {
777+ '.caption-top' : { 'caption-side' : 'top' } ,
778+ '.caption-bottom' : { 'caption-side' : 'bottom' } ,
779+ } )
780+ } ,
781+
770782 borderCollapse : ( { addUtilities } ) => {
771783 addUtilities ( {
772784 '.border-collapse' : { 'border-collapse' : 'collapse' } ,
@@ -1045,6 +1057,8 @@ export let corePlugins = {
10451057 [ 'scroll-my' , [ 'scroll-margin-top' , 'scroll-margin-bottom' ] ] ,
10461058 ] ,
10471059 [
1060+ [ 'scroll-ms' , [ 'scroll-margin-inline-start' ] ] ,
1061+ [ 'scroll-me' , [ 'scroll-margin-inline-end' ] ] ,
10481062 [ 'scroll-mt' , [ 'scroll-margin-top' ] ] ,
10491063 [ 'scroll-mr' , [ 'scroll-margin-right' ] ] ,
10501064 [ 'scroll-mb' , [ 'scroll-margin-bottom' ] ] ,
@@ -1061,6 +1075,8 @@ export let corePlugins = {
10611075 [ 'scroll-py' , [ 'scroll-padding-top' , 'scroll-padding-bottom' ] ] ,
10621076 ] ,
10631077 [
1078+ [ 'scroll-ps' , [ 'scroll-padding-inline-start' ] ] ,
1079+ [ 'scroll-pe' , [ 'scroll-padding-inline-end' ] ] ,
10641080 [ 'scroll-pt' , [ 'scroll-padding-top' ] ] ,
10651081 [ 'scroll-pr' , [ 'scroll-padding-right' ] ] ,
10661082 [ 'scroll-pb' , [ 'scroll-padding-bottom' ] ] ,
@@ -1234,6 +1250,16 @@ export let corePlugins = {
12341250 'space-x' : ( value ) => {
12351251 value = value === '0' ? '0px' : value
12361252
1253+ if ( env . OXIDE ) {
1254+ return {
1255+ '& > :not([hidden]) ~ :not([hidden])' : {
1256+ '--tw-space-x-reverse' : '0' ,
1257+ 'margin-inline-end' : `calc(${ value } * var(--tw-space-x-reverse))` ,
1258+ 'margin-inline-start' : `calc(${ value } * calc(1 - var(--tw-space-x-reverse)))` ,
1259+ } ,
1260+ }
1261+ }
1262+
12371263 return {
12381264 '& > :not([hidden]) ~ :not([hidden])' : {
12391265 '--tw-space-x-reverse' : '0' ,
@@ -1269,6 +1295,17 @@ export let corePlugins = {
12691295 'divide-x' : ( value ) => {
12701296 value = value === '0' ? '0px' : value
12711297
1298+ if ( env . OXIDE ) {
1299+ return {
1300+ '& > :not([hidden]) ~ :not([hidden])' : {
1301+ '@defaults border-width' : { } ,
1302+ '--tw-divide-x-reverse' : '0' ,
1303+ 'border-inline-end-width' : `calc(${ value } * var(--tw-divide-x-reverse))` ,
1304+ 'border-inline-start-width' : `calc(${ value } * calc(1 - var(--tw-divide-x-reverse)))` ,
1305+ } ,
1306+ }
1307+ }
1308+
12721309 return {
12731310 '& > :not([hidden]) ~ :not([hidden])' : {
12741311 '@defaults border-width' : { } ,
@@ -1436,6 +1473,14 @@ export let corePlugins = {
14361473 } )
14371474 } ,
14381475
1476+ hyphens : ( { addUtilities } ) => {
1477+ addUtilities ( {
1478+ '.hyphens-none' : { hyphens : 'none' } ,
1479+ '.hyphens-manual' : { hyphens : 'manual' } ,
1480+ '.hyphens-auto' : { hyphens : 'auto' } ,
1481+ } )
1482+ } ,
1483+
14391484 whitespace : ( { addUtilities } ) => {
14401485 addUtilities ( {
14411486 '.whitespace-normal' : { 'white-space' : 'normal' } ,
@@ -1458,12 +1503,18 @@ export let corePlugins = {
14581503 borderRadius : createUtilityPlugin ( 'borderRadius' , [
14591504 [ 'rounded' , [ 'border-radius' ] ] ,
14601505 [
1506+ [ 'rounded-s' , [ 'border-start-start-radius' , 'border-end-start-radius' ] ] ,
1507+ [ 'rounded-e' , [ 'border-start-end-radius' , 'border-end-end-radius' ] ] ,
14611508 [ 'rounded-t' , [ 'border-top-left-radius' , 'border-top-right-radius' ] ] ,
14621509 [ 'rounded-r' , [ 'border-top-right-radius' , 'border-bottom-right-radius' ] ] ,
14631510 [ 'rounded-b' , [ 'border-bottom-right-radius' , 'border-bottom-left-radius' ] ] ,
14641511 [ 'rounded-l' , [ 'border-top-left-radius' , 'border-bottom-left-radius' ] ] ,
14651512 ] ,
14661513 [
1514+ [ 'rounded-ss' , [ 'border-start-start-radius' ] ] ,
1515+ [ 'rounded-se' , [ 'border-start-end-radius' ] ] ,
1516+ [ 'rounded-ee' , [ 'border-end-end-radius' ] ] ,
1517+ [ 'rounded-es' , [ 'border-end-start-radius' ] ] ,
14671518 [ 'rounded-tl' , [ 'border-top-left-radius' ] ] ,
14681519 [ 'rounded-tr' , [ 'border-top-right-radius' ] ] ,
14691520 [ 'rounded-br' , [ 'border-bottom-right-radius' ] ] ,
@@ -1480,6 +1531,8 @@ export let corePlugins = {
14801531 [ 'border-y' , [ [ '@defaults border-width' , { } ] , 'border-top-width' , 'border-bottom-width' ] ] ,
14811532 ] ,
14821533 [
1534+ [ 'border-s' , [ [ '@defaults border-width' , { } ] , 'border-inline-start-width' ] ] ,
1535+ [ 'border-e' , [ [ '@defaults border-width' , { } ] , 'border-inline-end-width' ] ] ,
14831536 [ 'border-t' , [ [ '@defaults border-width' , { } ] , 'border-top-width' ] ] ,
14841537 [ 'border-r' , [ [ '@defaults border-width' , { } ] , 'border-right-width' ] ] ,
14851538 [ 'border-b' , [ [ '@defaults border-width' , { } ] , 'border-bottom-width' ] ] ,
@@ -1562,6 +1615,32 @@ export let corePlugins = {
15621615
15631616 matchUtilities (
15641617 {
1618+ 'border-s' : ( value ) => {
1619+ if ( ! corePlugins ( 'borderOpacity' ) ) {
1620+ return {
1621+ 'border-inline-start-color' : toColorValue ( value ) ,
1622+ }
1623+ }
1624+
1625+ return withAlphaVariable ( {
1626+ color : value ,
1627+ property : 'border-inline-start-color' ,
1628+ variable : '--tw-border-opacity' ,
1629+ } )
1630+ } ,
1631+ 'border-e' : ( value ) => {
1632+ if ( ! corePlugins ( 'borderOpacity' ) ) {
1633+ return {
1634+ 'border-inline-end-color' : toColorValue ( value ) ,
1635+ }
1636+ }
1637+
1638+ return withAlphaVariable ( {
1639+ color : value ,
1640+ property : 'border-inline-end-color' ,
1641+ variable : '--tw-border-opacity' ,
1642+ } )
1643+ } ,
15651644 'border-t' : ( value ) => {
15661645 if ( ! corePlugins ( 'borderOpacity' ) ) {
15671646 return {
@@ -1798,6 +1877,8 @@ export let corePlugins = {
17981877 [ 'py' , [ 'padding-top' , 'padding-bottom' ] ] ,
17991878 ] ,
18001879 [
1880+ [ 'ps' , [ 'padding-inline-start' ] ] ,
1881+ [ 'pe' , [ 'padding-inline-end' ] ] ,
18011882 [ 'pt' , [ 'padding-top' ] ] ,
18021883 [ 'pr' , [ 'padding-right' ] ] ,
18031884 [ 'pb' , [ 'padding-bottom' ] ] ,
@@ -1841,13 +1922,16 @@ export let corePlugins = {
18411922 font : ( value ) => {
18421923 let [ families , options = { } ] =
18431924 Array . isArray ( value ) && isPlainObject ( value [ 1 ] ) ? value : [ value ]
1844- let { fontFeatureSettings } = options
1925+ let { fontFeatureSettings, fontVariationSettings } = options
18451926
18461927 return {
18471928 'font-family' : Array . isArray ( families ) ? families . join ( ', ' ) : families ,
18481929 ...( fontFeatureSettings === undefined
18491930 ? { }
18501931 : { 'font-feature-settings' : fontFeatureSettings } ) ,
1932+ ...( fontVariationSettings === undefined
1933+ ? { }
1934+ : { 'font-variation-settings' : fontVariationSettings } ) ,
18511935 }
18521936 } ,
18531937 } ,
@@ -1861,9 +1945,16 @@ export let corePlugins = {
18611945 fontSize : ( { matchUtilities, theme } ) => {
18621946 matchUtilities (
18631947 {
1864- text : ( value ) => {
1948+ text : ( value , { modifier } ) => {
18651949 let [ fontSize , options ] = Array . isArray ( value ) ? value : [ value ]
18661950
1951+ if ( modifier ) {
1952+ return {
1953+ 'font-size' : fontSize ,
1954+ 'line-height' : modifier ,
1955+ }
1956+ }
1957+
18671958 let { lineHeight, letterSpacing, fontWeight } = isPlainObject ( options )
18681959 ? options
18691960 : { lineHeight : options }
@@ -1878,6 +1969,7 @@ export let corePlugins = {
18781969 } ,
18791970 {
18801971 values : theme ( 'fontSize' ) ,
1972+ modifiers : theme ( 'lineHeight' ) ,
18811973 type : [ 'absolute-size' , 'relative-size' , 'length' , 'percentage' ] ,
18821974 }
18831975 )
0 commit comments