tailwindcss/src
Robin Malfait 1ec5438448
Improve arbitrary value support (#5568)
* simplify `inset` plugin

* run `prettier` on stub file

* simplify `align` utility

* improve arbitrary support for outline

This will allow us to use `outline-[OUTLINE,OPTIONAL_OFFSET]`

Input:
```html
outline-[2px_solid_black]
```

Output:
```css
.outline-\[2px_solid_black\] {
  outline: 2px solid black;
  outline-offset: 0;
}
```

---

Input:
```html
outline-[2px_solid_black,2px]
```

Output:
```css
.outline-\[2px_solid_black\2c 2px\] {
  outline: 2px solid black;
  outline-offset: 2px;
}
```

* remove default `type`

* simplify createUtilityPlugin, use types directly

* find first matching type when coercing the value

* introduce css data types

Ref: https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Types

These data types will be used to "guess" the type of an arbitrary value
if there is some ambiguity going on. For example:

```
bg-[#0088cc]      -> This is a `color`  -> `background-color`
bg-[url('...')]   -> This is a `url`    -> `background-image`
```

If you are using css variables, then there is no way of knowing which
type it is referring to, in that case you can be explicit:

```
bg-[color:var(--value)]   -> This is a `color`  -> `background-color`
bg-[url:var(--value)]     -> This is a `url`    -> `background-image`
```

When you explicitly pass a data type, then we bypass the type system and
assume you are right. This is nice in a way because now we don't have to
run all of the guessing type code. On the other hand, you can introduce
runtime issues that we are not able to detect:

```
:root {
  --value: 12px;
}

/* Later... */
bg-[color:var(--value)] -> Assumes `color` -> *eventually* -> `background-color: 12px`
```

* add a bunch of new tests for advanced arbitrary values
2021-09-24 18:45:42 +02:00
..
css Inline plugins (#5455) 2021-09-09 09:22:50 -04:00
lib Improve arbitrary value support (#5568) 2021-09-24 18:45:42 +02:00
util Improve arbitrary value support (#5568) 2021-09-24 18:45:42 +02:00
cli-peer-dependencies.js Improve new JIT-compatible CLI (#4558) 2021-06-04 10:28:09 -04:00
cli.js ensure that we fallback to the first argument without any flags (#5464) 2021-09-10 10:14:44 +02:00
constants.js Adds support for tailwind.config.cjs files (#3181) 2021-05-07 13:56:10 -04:00
corePlugins.js Improve arbitrary value support (#5568) 2021-09-24 18:45:42 +02:00
featureFlags.js Remove lodash (#5390) 2021-09-06 14:15:10 -04:00
index.js Remove AOT (#5340) 2021-09-01 17:13:59 +02:00
processTailwindFeatures.js Warn when nesting is detected (#5489) 2021-09-16 14:13:45 +02:00