Skip to content

Commit bc5a82a

Browse files
committed
Copy JIT over, tests passing separately, not yet integrated
1 parent 60b5d63 commit bc5a82a

File tree

195 files changed

+9932
-9
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

195 files changed

+9932
-9
lines changed

jit/corePlugins/accessibility.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
const { createSimpleStaticUtilityPlugin } = require('../pluginUtils')
2+
3+
module.exports = createSimpleStaticUtilityPlugin({
4+
'.sr-only': {
5+
position: 'absolute',
6+
width: '1px',
7+
height: '1px',
8+
padding: '0',
9+
margin: '-1px',
10+
overflow: 'hidden',
11+
clip: 'rect(0, 0, 0, 0)',
12+
whiteSpace: 'nowrap',
13+
borderWidth: '0',
14+
},
15+
'.not-sr-only': {
16+
position: 'static',
17+
width: 'auto',
18+
height: 'auto',
19+
padding: '0',
20+
margin: '0',
21+
overflow: 'visible',
22+
clip: 'auto',
23+
whiteSpace: 'normal',
24+
},
25+
})

jit/corePlugins/alignContent.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
const { createSimpleStaticUtilityPlugin } = require('../pluginUtils')
2+
3+
module.exports = createSimpleStaticUtilityPlugin({
4+
'.content-center': {
5+
'align-content': 'center',
6+
},
7+
'.content-start': {
8+
'align-content': 'flex-start',
9+
},
10+
'.content-end': {
11+
'align-content': 'flex-end',
12+
},
13+
'.content-between': {
14+
'align-content': 'space-between',
15+
},
16+
'.content-around': {
17+
'align-content': 'space-around',
18+
},
19+
'.content-evenly': {
20+
'align-content': 'space-evenly',
21+
},
22+
})

jit/corePlugins/alignItems.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
const { createSimpleStaticUtilityPlugin } = require('../pluginUtils')
2+
3+
module.exports = createSimpleStaticUtilityPlugin({
4+
'.items-start': {
5+
'align-items': 'flex-start',
6+
},
7+
'.items-end': {
8+
'align-items': 'flex-end',
9+
},
10+
'.items-center': {
11+
'align-items': 'center',
12+
},
13+
'.items-baseline': {
14+
'align-items': 'baseline',
15+
},
16+
'.items-stretch': {
17+
'align-items': 'stretch',
18+
},
19+
})

jit/corePlugins/alignSelf.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
const { createSimpleStaticUtilityPlugin } = require('../pluginUtils')
2+
3+
module.exports = createSimpleStaticUtilityPlugin({
4+
'.self-auto': {
5+
'align-self': 'auto',
6+
},
7+
'.self-start': {
8+
'align-self': 'flex-start',
9+
},
10+
'.self-end': {
11+
'align-self': 'flex-end',
12+
},
13+
'.self-center': {
14+
'align-self': 'center',
15+
},
16+
'.self-stretch': {
17+
'align-self': 'stretch',
18+
},
19+
})

jit/corePlugins/animation.js

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
const { nameClass } = require('../pluginUtils')
2+
const transformThemeValue = require('tailwindcss/lib/util/transformThemeValue').default
3+
const parseAnimationValue = require('tailwindcss/lib/util/parseAnimationValue').default
4+
5+
module.exports = function ({ matchUtilities, jit: { theme } }) {
6+
let keyframes = Object.fromEntries(
7+
Object.entries(theme.keyframes).map(([key, value]) => {
8+
return [
9+
key,
10+
[
11+
{
12+
[`@keyframes ${key}`]: value,
13+
},
14+
{ respectVariants: false },
15+
],
16+
]
17+
})
18+
)
19+
20+
let transformValue = transformThemeValue('animation')
21+
matchUtilities({
22+
animate: [
23+
(modifier, { theme }) => {
24+
let value = transformValue(theme.animation[modifier])
25+
26+
if (modifier === '' || value === undefined) {
27+
return []
28+
}
29+
30+
let { name: animationName } = parseAnimationValue(value)
31+
32+
return [
33+
keyframes[animationName],
34+
{ [nameClass('animate', modifier)]: { animation: value } },
35+
].filter(Boolean)
36+
},
37+
],
38+
})
39+
}

jit/corePlugins/appearance.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
const { createSimpleStaticUtilityPlugin } = require('../pluginUtils')
2+
3+
module.exports = createSimpleStaticUtilityPlugin({
4+
'.appearance-none': { appearance: 'none' },
5+
})
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
const { createSimpleStaticUtilityPlugin } = require('../pluginUtils')
2+
3+
module.exports = createSimpleStaticUtilityPlugin({
4+
'.bg-fixed': { 'background-attachment': 'fixed' },
5+
'.bg-local': { 'background-attachment': 'local' },
6+
'.bg-scroll': { 'background-attachment': 'scroll' },
7+
})

jit/corePlugins/backgroundClip.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
const { createSimpleStaticUtilityPlugin } = require('../pluginUtils')
2+
3+
module.exports = createSimpleStaticUtilityPlugin({
4+
'.bg-clip-border': { 'background-clip': 'border-box' },
5+
'.bg-clip-padding': { 'background-clip': 'padding-box' },
6+
'.bg-clip-content': { 'background-clip': 'content-box' },
7+
'.bg-clip-text': { 'background-clip': 'text' },
8+
})

jit/corePlugins/backgroundColor.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
const transformThemeValue = require('tailwindcss/lib/util/transformThemeValue').default
2+
const flattenColorPalette = require('tailwindcss/lib/util/flattenColorPalette').default
3+
const withAlphaVariable = require('tailwindcss/lib/util/withAlphaVariable').default
4+
const toColorValue = require('tailwindcss/lib/util/toColorValue').default
5+
const { asColor, nameClass } = require('../pluginUtils')
6+
7+
module.exports = function ({ matchUtilities, jit: { theme } }) {
8+
let colorPalette = flattenColorPalette(theme.backgroundColor)
9+
10+
matchUtilities({
11+
bg: (modifier, { theme }) => {
12+
let value = asColor(modifier, colorPalette)
13+
14+
if (value === undefined) {
15+
return []
16+
}
17+
18+
return {
19+
[nameClass('bg', modifier)]: withAlphaVariable({
20+
color: value,
21+
property: 'background-color',
22+
variable: '--tw-bg-opacity',
23+
}),
24+
}
25+
},
26+
})
27+
}

jit/corePlugins/backgroundImage.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
const { nameClass } = require('../pluginUtils')
2+
3+
module.exports = function ({ matchUtilities, jit: { theme } }) {
4+
matchUtilities({
5+
bg: (modifier, { theme }) => {
6+
let value = theme.backgroundImage[modifier]
7+
8+
if (value === undefined) {
9+
return []
10+
}
11+
12+
return { [nameClass('bg', modifier)]: { 'background-image': value } }
13+
},
14+
})
15+
}

0 commit comments

Comments
 (0)