Skip to content
This repository was archived by the owner on Apr 6, 2021. It is now read-only.

Commit 3ea5421

Browse files
committed
Add support for arbitrary inset
1 parent 7eab7d0 commit 3ea5421

File tree

3 files changed

+16
-9
lines changed

3 files changed

+16
-9
lines changed

src/corePlugins/inset.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
const { asLength, nameClass } = require('../pluginUtils')
1+
const { asValue, nameClass } = require('../pluginUtils')
22

3-
module.exports = function ({ matchUtilities, jit: { theme } }) {
3+
module.exports = function ({ matchUtilities }) {
44
matchUtilities({
55
inset: (modifier, { theme }) => {
6-
let value = asLength(modifier, theme['inset'])
6+
let value = asValue(modifier, theme['inset'])
77

88
if (value === undefined) {
99
return []
@@ -16,7 +16,7 @@ module.exports = function ({ matchUtilities, jit: { theme } }) {
1616
})
1717
matchUtilities({
1818
'inset-x': (modifier, { theme }) => {
19-
let value = asLength(modifier, theme['inset'])
19+
let value = asValue(modifier, theme['inset'])
2020

2121
if (value === undefined) {
2222
return []
@@ -25,7 +25,7 @@ module.exports = function ({ matchUtilities, jit: { theme } }) {
2525
return { [nameClass('inset-x', modifier)]: { left: value, right: value } }
2626
},
2727
'inset-y': (modifier, { theme }) => {
28-
let value = asLength(modifier, theme['inset'])
28+
let value = asValue(modifier, theme['inset'])
2929

3030
if (value === undefined) {
3131
return []
@@ -36,7 +36,7 @@ module.exports = function ({ matchUtilities, jit: { theme } }) {
3636
})
3737
matchUtilities({
3838
top: (modifier, { theme }) => {
39-
let value = asLength(modifier, theme['inset'])
39+
let value = asValue(modifier, theme['inset'])
4040

4141
if (value === undefined) {
4242
return []
@@ -45,7 +45,7 @@ module.exports = function ({ matchUtilities, jit: { theme } }) {
4545
return { [nameClass('top', modifier)]: { top: value } }
4646
},
4747
right: (modifier, { theme }) => {
48-
let value = asLength(modifier, theme['inset'])
48+
let value = asValue(modifier, theme['inset'])
4949

5050
if (value === undefined) {
5151
return []
@@ -54,7 +54,7 @@ module.exports = function ({ matchUtilities, jit: { theme } }) {
5454
return { [nameClass('right', modifier)]: { right: value } }
5555
},
5656
bottom: (modifier, { theme }) => {
57-
let value = asLength(modifier, theme['inset'])
57+
let value = asValue(modifier, theme['inset'])
5858

5959
if (value === undefined) {
6060
return []
@@ -63,7 +63,7 @@ module.exports = function ({ matchUtilities, jit: { theme } }) {
6363
return { [nameClass('bottom', modifier)]: { bottom: value } }
6464
},
6565
left: (modifier, { theme }) => {
66-
let value = asLength(modifier, theme['inset'])
66+
let value = asValue(modifier, theme['inset'])
6767

6868
if (value === undefined) {
6969
return []

tests/08-arbitrary-values.test.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@
77
--tw-ring-offset-shadow: 0 0 #0000;
88
--tw-ring-shadow: 0 0 #0000;
99
}
10+
.inset-\[11px\] {
11+
top: 11px;
12+
right: 11px;
13+
bottom: 11px;
14+
left: 11px;
15+
}
1016
.mt-\[clamp\(30px\2c 100px\)\] {
1117
margin-top: clamp(30px, 100px);
1218
}

tests/08-arbitrary-values.test.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,6 @@
2626
<div class="mt-[clamp(30px,100px)]"></div>
2727
<div class="duration-[var(--app-duration)]"></div>
2828
<div class="p-[var(--app-padding)]"></div>
29+
<div class="inset-[11px]"></div>
2930
</body>
3031
</html>

0 commit comments

Comments
 (0)