@tailwindcss/typography
Advanced tools
Comparing version 0.0.0-insiders.34097e0 to 0.0.0-insiders.383bee7
{ | ||
"name": "@tailwindcss/typography", | ||
"version": "0.0.0-insiders.34097e0", | ||
"version": "0.0.0-insiders.383bee7", | ||
"description": "A Tailwind CSS plugin for automatically styling plain HTML content with beautiful typographic defaults.", | ||
"main": "src/index.js", | ||
"types": "src/index.d.ts", | ||
"files": [ | ||
"src/*.js", | ||
"src/*.d.ts", | ||
"dist/" | ||
], | ||
"repository": "https://github.com/tailwindcss/typography", | ||
"repository": "https://github.com/tailwindlabs/tailwindcss-typography", | ||
"license": "MIT", | ||
@@ -26,6 +28,8 @@ "publishConfig": { | ||
"export": "next export demo", | ||
"start": "next start demo" | ||
"start": "next start demo", | ||
"release-channel": "node ./scripts/release-channel.js", | ||
"release-notes": "node ./scripts/release-notes.js" | ||
}, | ||
"peerDependencies": { | ||
"tailwindcss": ">=3.0.0 || insiders" | ||
"tailwindcss": ">=3.0.0 || insiders || >=4.0.0-alpha.20" | ||
}, | ||
@@ -38,3 +42,3 @@ "devDependencies": { | ||
"highlight.js": "^10.4.1", | ||
"jest": "^26.6.1", | ||
"jest": "^29.7.0", | ||
"jest-diff": "^27.3.1", | ||
@@ -46,3 +50,3 @@ "next": "^12.0.1", | ||
"react-dom": "^17.0.2", | ||
"tailwindcss": "^3.0.0-alpha.2" | ||
"tailwindcss": "^3.2.2" | ||
}, | ||
@@ -52,3 +56,4 @@ "dependencies": { | ||
"lodash.isplainobject": "^4.0.6", | ||
"lodash.merge": "^4.6.2" | ||
"lodash.merge": "^4.6.2", | ||
"postcss-selector-parser": "6.0.10" | ||
}, | ||
@@ -55,0 +60,0 @@ "jest": { |
388
README.md
<p> | ||
<a href="https://tailwindcss.com/docs/typography-plugin#gh-light-mode-only" target="_blank"> | ||
<img src="./.github/logo-light.svg" alt="Tailwind CSS Typography" width="450" height="70"> | ||
<a href="https://tailwindcss.com/docs/typography-plugin" target="_blank"> | ||
<picture> | ||
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/tailwindlabs/tailwindcss-typography/HEAD/.github/logo-dark.svg"> | ||
<source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/tailwindlabs/tailwindcss-typography/HEAD/.github/logo-light.svg"> | ||
<img alt="Tailwind CSS Typography" src="https://raw.githubusercontent.com/tailwindlabs/tailwindcss-typography/HEAD/.github/logo-light.svg" width="450" height="70" style="max-width: 100%;"> | ||
</picture> | ||
</a> | ||
<a href="https://tailwindcss.com/docs/typography-plugin#gh-dark-mode-only" target="_blank"> | ||
<img src="./.github/logo-dark.svg" alt="Tailwind CSS Typography" width="450" height="70"> | ||
</a> | ||
</p> | ||
A plugin that provides a set of `prose` classes you can use to add beautiful typographic defaults to any vanilla HTML you don't control, like HTML rendered from Markdown, or pulled from a CMS. | ||
The official Tailwind CSS Typography plugin provides a set of `prose` classes you can use to add beautiful typographic defaults to any vanilla HTML you don’t control, like HTML rendered from Markdown, or pulled from a CMS. | ||
```html | ||
<article class="prose lg:prose-xl">{{ markdown }}</article> | ||
``` | ||
To see what it looks like in action, check out our [live demo](https://play.tailwindcss.com/uj1vGACRJA?layout=preview) on Tailwind Play. | ||
--- | ||
## Documentation | ||
## Installation | ||
For full documentation, visit [tailwindcss.com/docs/typography-plugin](https://tailwindcss.com/docs/typography-plugin). | ||
Install the plugin from npm: | ||
```shell | ||
npm install -D @tailwindcss/typography | ||
``` | ||
Then add the plugin to your `tailwind.config.js` file: | ||
```js | ||
/** @type {import('tailwindcss').Config} */ | ||
module.exports = { | ||
theme: { | ||
// ... | ||
}, | ||
plugins: [ | ||
require('@tailwindcss/typography'), | ||
// ... | ||
], | ||
} | ||
``` | ||
--- | ||
## Basic usage | ||
Now you can use the `prose` classes to add sensible typography styles to any vanilla HTML: | ||
```html | ||
<article class="prose lg:prose-xl"> | ||
<h1>Garlic bread with cheese: What the science tells us</h1> | ||
<p> | ||
For years parents have espoused the health benefits of eating garlic bread with cheese to their | ||
children, with the food earning such an iconic status in our culture that kids will often dress | ||
up as warm, cheesy loaf for Halloween. | ||
</p> | ||
<p> | ||
But a recent study shows that the celebrated appetizer may be linked to a series of rabies cases | ||
springing up around the country. | ||
</p> | ||
<!-- ... --> | ||
</article> | ||
``` | ||
### Choosing a gray scale | ||
This plugin includes a modifier class for each of the five gray scales Tailwind includes by default so you can easily style your content to match the grays you're using in your project. | ||
```html | ||
<article class="prose prose-slate">{{ markdown }}</article> | ||
``` | ||
Here are the classes that are generated using a totally default Tailwind CSS v2.0 build: | ||
| Class | Gray scale | | ||
| ------------------------ | ---------- | | ||
| `prose-gray` _(default)_ | Gray | | ||
| `prose-slate` | Slate | | ||
| `prose-zinc` | Zinc | | ||
| `prose-neutral` | Neutral | | ||
| `prose-stone` | Stone | | ||
Modifier classes are designed to be used with the [multi-class modifier pattern](http://nicolasgallagher.com/about-html-semantics-front-end-architecture/#component-modifiers) and must be used in conjunction with the base `prose` class. | ||
> [!NOTE] | ||
> Always include the `prose` class when adding a gray scale modifier | ||
```html | ||
<article class="prose prose-stone">{{ markdown }}</article> | ||
``` | ||
To learn about creating your own color themes, read the [adding custom color themes](#adding-custom-color-themes) documentation. | ||
### Applying a type scale | ||
Size modifiers allow you to adjust the overall size of your typography for different contexts. | ||
```html | ||
<article class="prose prose-xl">{{ markdown }}</article> | ||
``` | ||
Five different typography sizes are included out of the box: | ||
| Class | Body font size | | ||
| ------------------------ | ----------------- | | ||
| `prose-sm` | 0.875rem _(14px)_ | | ||
| `prose-base` _(default)_ | 1rem _(16px)_ | | ||
| `prose-lg` | 1.125rem _(18px)_ | | ||
| `prose-xl` | 1.25rem _(20px)_ | | ||
| `prose-2xl` | 1.5rem _(24px)_ | | ||
These can be used in combination with Tailwind's [breakpoint modifiers](https://tailwindcss.com/docs/responsive-design) to change the overall font size of a piece of content at different viewport sizes: | ||
```html | ||
<article class="prose md:prose-lg lg:prose-xl">{{ markdown }}</article> | ||
``` | ||
Everything about the provided size modifiers has been hand-tuned by professional designers to look as beautiful as possible, including the relationships between font sizes, heading spacing, code block padding, and more. | ||
Size modifiers are designed to be used with the [multi-class modifier pattern](http://nicolasgallagher.com/about-html-semantics-front-end-architecture/#component-modifiers) and must be used in conjunction with the base `prose` class. | ||
> [!NOTE] | ||
> Always include the `prose` class when adding a size modifier | ||
```html | ||
<article class="prose prose-lg">{{ markdown }}</article> | ||
``` | ||
To learn about customizing the included type scales, read the documentation on [customizing the CSS](#customizing-the-css). | ||
### Adapting to dark mode | ||
Each default color theme includes a hand-designed dark mode version that you can trigger by adding the `prose-invert` class: | ||
```html | ||
<article class="prose dark:prose-invert">{{ markdown }}</article> | ||
``` | ||
To learn about creating your own color themes, read the [adding custom color themes](#adding-custom-color-themes) documentation. | ||
### Element modifiers | ||
Use element modifiers to customize the style of individual elements in your content directly in your HTML: | ||
```html | ||
<article class="prose prose-img:rounded-xl prose-headings:underline prose-a:text-blue-600"> | ||
{{ markdown }} | ||
</article> | ||
``` | ||
This makes it easy to do things like style links to match your brand, add a border radius to images, and tons more. | ||
Here's a complete list of available element modifiers: | ||
| Modifier | Target | | ||
| ---------------------------- | ---------------------------- | | ||
| `prose-headings:{utility}` | `h1`, `h2`, `h3`, `h4`, `th` | | ||
| `prose-lead:{utility}` | `[class~="lead"]` | | ||
| `prose-h1:{utility}` | `h1` | | ||
| `prose-h2:{utility}` | `h2` | | ||
| `prose-h3:{utility}` | `h3` | | ||
| `prose-h4:{utility}` | `h4` | | ||
| `prose-p:{utility}` | `p` | | ||
| `prose-a:{utility}` | `a` | | ||
| `prose-blockquote:{utility}` | `blockquote` | | ||
| `prose-figure:{utility}` | `figure` | | ||
| `prose-figcaption:{utility}` | `figcaption` | | ||
| `prose-strong:{utility}` | `strong` | | ||
| `prose-em:{utility}` | `em` | | ||
| `prose-kbd:{utility}` | `kbd` | | ||
| `prose-code:{utility}` | `code` | | ||
| `prose-pre:{utility}` | `pre` | | ||
| `prose-ol:{utility}` | `ol` | | ||
| `prose-ul:{utility}` | `ul` | | ||
| `prose-li:{utility}` | `li` | | ||
| `prose-table:{utility}` | `table` | | ||
| `prose-thead:{utility}` | `thead` | | ||
| `prose-tr:{utility}` | `tr` | | ||
| `prose-th:{utility}` | `th` | | ||
| `prose-td:{utility}` | `td` | | ||
| `prose-img:{utility}` | `img` | | ||
| `prose-video:{utility}` | `video` | | ||
| `prose-hr:{utility}` | `hr` | | ||
When stacking these modifiers with other modifiers like `hover`, you most likely want the other modifier to come first: | ||
```html | ||
<article class="prose prose-a:text-blue-600 hover:prose-a:text-blue-500">{{ markdown }}</article> | ||
``` | ||
Read the Tailwind CSS documentation on [ordering stacked modifiers](https://tailwindcss.com/docs/hover-focus-and-other-states#ordering-stacked-modifiers) to learn more. | ||
### Overriding max-width | ||
Each size modifier comes with a baked in `max-width` designed to keep the content as readable as possible. This isn't always what you want though, and sometimes you'll want the content to just fill the width of its container. | ||
In those cases, all you need to do is add `max-w-none` to your content to override the embedded max-width: | ||
```html | ||
<div class="grid grid-cols-4"> | ||
<div class="col-span-1"> | ||
<!-- ... --> | ||
</div> | ||
<div class="col-span-3"> | ||
<article class="prose max-w-none">{{ markdown }}</article> | ||
</div> | ||
</div> | ||
``` | ||
--- | ||
## Advanced topics | ||
### Undoing typography styles | ||
If you have a block of markup embedded in some content that shouldn't inherit the `prose` styles, use the `not-prose` class to sandbox it: | ||
```html | ||
<article class="prose"> | ||
<h1>My Heading</h1> | ||
<p>...</p> | ||
<div class="not-prose"> | ||
<!-- Some example or demo that needs to be prose-free --> | ||
</div> | ||
<p>...</p> | ||
<!-- ... --> | ||
</article> | ||
``` | ||
Note that you can't nest new `prose` instances within a `not-prose` block at this time. | ||
### Adding custom color themes | ||
You can create your own color theme by adding a new key in the `typography` section of your `tailwind.config.js` file and providing your colors under the `css` key: | ||
```js {{ filename: 'tailwind.config.js' }} | ||
/** @type {import('tailwindcss').Config} */ | ||
module.exports = { | ||
theme: { | ||
extend: { | ||
typography: ({ theme }) => ({ | ||
pink: { | ||
css: { | ||
'--tw-prose-body': theme('colors.pink[800]'), | ||
'--tw-prose-headings': theme('colors.pink[900]'), | ||
'--tw-prose-lead': theme('colors.pink[700]'), | ||
'--tw-prose-links': theme('colors.pink[900]'), | ||
'--tw-prose-bold': theme('colors.pink[900]'), | ||
'--tw-prose-counters': theme('colors.pink[600]'), | ||
'--tw-prose-bullets': theme('colors.pink[400]'), | ||
'--tw-prose-hr': theme('colors.pink[300]'), | ||
'--tw-prose-quotes': theme('colors.pink[900]'), | ||
'--tw-prose-quote-borders': theme('colors.pink[300]'), | ||
'--tw-prose-captions': theme('colors.pink[700]'), | ||
'--tw-prose-code': theme('colors.pink[900]'), | ||
'--tw-prose-pre-code': theme('colors.pink[100]'), | ||
'--tw-prose-pre-bg': theme('colors.pink[900]'), | ||
'--tw-prose-th-borders': theme('colors.pink[300]'), | ||
'--tw-prose-td-borders': theme('colors.pink[200]'), | ||
'--tw-prose-invert-body': theme('colors.pink[200]'), | ||
'--tw-prose-invert-headings': theme('colors.white'), | ||
'--tw-prose-invert-lead': theme('colors.pink[300]'), | ||
'--tw-prose-invert-links': theme('colors.white'), | ||
'--tw-prose-invert-bold': theme('colors.white'), | ||
'--tw-prose-invert-counters': theme('colors.pink[400]'), | ||
'--tw-prose-invert-bullets': theme('colors.pink[600]'), | ||
'--tw-prose-invert-hr': theme('colors.pink[700]'), | ||
'--tw-prose-invert-quotes': theme('colors.pink[100]'), | ||
'--tw-prose-invert-quote-borders': theme('colors.pink[700]'), | ||
'--tw-prose-invert-captions': theme('colors.pink[400]'), | ||
'--tw-prose-invert-code': theme('colors.white'), | ||
'--tw-prose-invert-pre-code': theme('colors.pink[300]'), | ||
'--tw-prose-invert-pre-bg': 'rgb(0 0 0 / 50%)', | ||
'--tw-prose-invert-th-borders': theme('colors.pink[600]'), | ||
'--tw-prose-invert-td-borders': theme('colors.pink[700]'), | ||
}, | ||
}, | ||
}), | ||
}, | ||
}, | ||
plugins: [ | ||
require('@tailwindcss/typography'), | ||
// ... | ||
], | ||
} | ||
``` | ||
See our internal [style definitions](https://github.com/tailwindlabs/tailwindcss-typography/blob/main/src/styles.js) for some more examples. | ||
### Changing the default class name | ||
If you need to use a class name other than `prose` for any reason, you can do so using the `className` option when registering the plugin: | ||
```js {{ filename: 'tailwind.config.js' }} | ||
/** @type {import('tailwindcss').Config} */ | ||
module.exports = { | ||
theme: { | ||
// ... | ||
}, | ||
plugins: [ | ||
require('@tailwindcss/typography')({ | ||
className: 'wysiwyg', | ||
}), | ||
] | ||
... | ||
} | ||
``` | ||
Now every instance of `prose` in the default class names will be replaced by your custom class name: | ||
```html | ||
<article class="wysiwyg wysiwyg-slate lg:wysiwyg-xl"> | ||
<h1>My Heading</h1> | ||
<p>...</p> | ||
<div class="not-wysiwyg"> | ||
<!-- Some example or demo that needs to be prose-free --> | ||
</div> | ||
<p>...</p> | ||
<!-- ... --> | ||
</article> | ||
``` | ||
### Customizing the CSS | ||
If you want to customize the raw CSS generated by this plugin, add your overrides under the `typography` key in the `theme` section of your `tailwind.config.js` file: | ||
```js {{ filename: 'tailwind.config.js' }} | ||
/** @type {import('tailwindcss').Config} */ | ||
module.exports = { | ||
theme: { | ||
extend: { | ||
typography: { | ||
DEFAULT: { | ||
css: { | ||
color: '#333', | ||
a: { | ||
color: '#3182ce', | ||
'&:hover': { | ||
color: '#2c5282', | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
plugins: [ | ||
require('@tailwindcss/typography'), | ||
// ... | ||
], | ||
} | ||
``` | ||
Like with all theme customizations in Tailwind, you can also define the `typography` key as a function if you need access to the `theme` helper: | ||
```js {{ filename: 'tailwind.config.js' }} | ||
/** @type {import('tailwindcss').Config} */ | ||
module.exports = { | ||
theme: { | ||
extend: { | ||
typography: (theme) => ({ | ||
DEFAULT: { | ||
css: { | ||
color: theme('colors.gray.800'), | ||
// ... | ||
}, | ||
}, | ||
}), | ||
}, | ||
}, | ||
plugins: [ | ||
require('@tailwindcss/typography'), | ||
// ... | ||
], | ||
} | ||
``` | ||
Customizations should be applied to a specific modifier like `DEFAULT` or `xl`, and must be added under the `css` property. Customizations are authored in the same [CSS-in-JS syntax](https://tailwindcss.com/docs/plugins#css-in-js-syntax) used to write Tailwind plugins. | ||
See [the default styles](https://github.com/tailwindlabs/tailwindcss-typography/blob/main/src/styles.js) for this plugin for more in-depth examples of configuring each modifier. | ||
--- | ||
## Community | ||
@@ -19,0 +391,0 @@ |
@@ -5,2 +5,3 @@ const plugin = require('tailwindcss/plugin') | ||
const styles = require('./styles') | ||
const { commonTrailingPseudos } = require('./utils') | ||
@@ -12,31 +13,16 @@ const computed = { | ||
function inWhere(selector, { className, prefix }) { | ||
function inWhere(selector, { className, modifier, prefix }) { | ||
let prefixedNot = prefix(`.not-${className}`).slice(1) | ||
let selectorPrefix = selector.startsWith('>') | ||
? `${modifier === 'DEFAULT' ? `.${className}` : `.${className}-${modifier}`} ` | ||
: '' | ||
if (selector.endsWith('::before')) { | ||
if (selector.startsWith('>')) { | ||
return `> :where(${selector.slice(2, -8)}):not(:where([class~="${prefixedNot}"] *))::before` | ||
} | ||
return `:where(${selector.slice(0, -8)}):not(:where([class~="${prefixedNot}"] *))::before` | ||
} | ||
// Parse the selector, if every component ends in the same pseudo element(s) then move it to the end | ||
let [trailingPseudo, rebuiltSelector] = commonTrailingPseudos(selector) | ||
if (selector.endsWith('::after')) { | ||
if (selector.startsWith('>')) { | ||
return `> :where(${selector.slice(2, -7)}):not(:where([class~="${prefixedNot}"] *))::after` | ||
} | ||
return `:where(${selector.slice(0, -7)}):not(:where([class~="${prefixedNot}"] *))::after` | ||
if (trailingPseudo) { | ||
return `:where(${selectorPrefix}${rebuiltSelector}):not(:where([class~="${prefixedNot}"],[class~="${prefixedNot}"] *))${trailingPseudo}` | ||
} | ||
if (selector.endsWith('::marker')) { | ||
if (selector.startsWith('>')) { | ||
return `> :where(${selector.slice(2, -8)}):not(:where([class~="${prefixedNot}"] *))::marker` | ||
} | ||
return `:where(${selector.slice(0, -8)}):not(:where([class~="${prefixedNot}"] *))::marker` | ||
} | ||
if (selector.startsWith('>')) { | ||
return `> :where(${selector.slice(2)}):not(:where([class~="${prefixedNot}"] *))` | ||
} | ||
return `:where(${selector}):not(:where([class~="${prefixedNot}"] *))` | ||
return `:where(${selectorPrefix}${selector}):not(:where([class~="${prefixedNot}"],[class~="${prefixedNot}"] *))` | ||
} | ||
@@ -48,3 +34,3 @@ | ||
function configToCss(config = {}, { target, className, prefix }) { | ||
function configToCss(config = {}, { target, className, modifier, prefix }) { | ||
function updateSelector(k, v) { | ||
@@ -63,3 +49,3 @@ if (target === 'legacy') { | ||
return [ | ||
inWhere(k, { className, prefix }), | ||
inWhere(k, { className, modifier, prefix }), | ||
v, | ||
@@ -70,3 +56,3 @@ Object.fromEntries(Object.entries(v).map(([k, v]) => updateSelector(k, v))), | ||
return [inWhere(k, { className, prefix }), v] | ||
return [inWhere(k, { className, modifier, prefix }), v] | ||
} | ||
@@ -97,5 +83,4 @@ | ||
for (let [name, selector = name] of [ | ||
['headings', 'h1, h2, h3, h4, th'], | ||
['lead', '[class~="lead"]'], | ||
for (let [name, ...selectors] of [ | ||
['headings', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'th'], | ||
['h1'], | ||
@@ -105,2 +90,4 @@ ['h2'], | ||
['h4'], | ||
['h5'], | ||
['h6'], | ||
['p'], | ||
@@ -113,2 +100,3 @@ ['a'], | ||
['em'], | ||
['kbd'], | ||
['code'], | ||
@@ -127,4 +115,13 @@ ['pre'], | ||
['hr'], | ||
['lead', '[class~="lead"]'], | ||
]) { | ||
addVariant(`${className}-${name}`, `& :is(${inWhere(selector, options)})`) | ||
selectors = selectors.length === 0 ? [name] : selectors | ||
let selector = | ||
target === 'legacy' ? selectors.map((selector) => `& ${selector}`) : selectors.join(', ') | ||
addVariant( | ||
`${className}-${name}`, | ||
target === 'legacy' ? selector : `& :is(${inWhere(selector, options)})` | ||
) | ||
} | ||
@@ -139,2 +136,3 @@ | ||
className, | ||
modifier, | ||
prefix, | ||
@@ -141,0 +139,0 @@ } |
@@ -9,2 +9,48 @@ const path = require('path') | ||
let vars = ` | ||
--tw-border-spacing-x: 0; | ||
--tw-border-spacing-y: 0; | ||
--tw-translate-x: 0; | ||
--tw-translate-y: 0; | ||
--tw-rotate: 0; | ||
--tw-skew-x: 0; | ||
--tw-skew-y: 0; | ||
--tw-scale-x: 1; | ||
--tw-scale-y: 1; | ||
--tw-pan-x: ; | ||
--tw-pan-y: ; | ||
--tw-pinch-zoom: ; | ||
--tw-scroll-snap-strictness: proximity; | ||
--tw-ordinal: ; | ||
--tw-slashed-zero: ; | ||
--tw-numeric-figure: ; | ||
--tw-numeric-spacing: ; | ||
--tw-numeric-fraction: ; | ||
--tw-ring-inset: ; | ||
--tw-ring-offset-width: 0px; | ||
--tw-ring-offset-color: #fff; | ||
--tw-ring-color: rgb(59 130 246 / 0.5); | ||
--tw-ring-offset-shadow: 0 0 #0000; | ||
--tw-ring-shadow: 0 0 #0000; | ||
--tw-shadow: 0 0 #0000; | ||
--tw-shadow-colored: 0 0 #0000; | ||
--tw-blur: ; | ||
--tw-brightness: ; | ||
--tw-contrast: ; | ||
--tw-grayscale: ; | ||
--tw-hue-rotate: ; | ||
--tw-invert: ; | ||
--tw-saturate: ; | ||
--tw-sepia: ; | ||
--tw-drop-shadow: ; | ||
--tw-backdrop-blur: ; | ||
--tw-backdrop-brightness: ; | ||
--tw-backdrop-contrast: ; | ||
--tw-backdrop-grayscale: ; | ||
--tw-backdrop-hue-rotate: ; | ||
--tw-backdrop-invert: ; | ||
--tw-backdrop-opacity: ; | ||
--tw-backdrop-saturate: ; | ||
--tw-backdrop-sepia: ; | ||
` | ||
let defaults = css` | ||
@@ -14,45 +60,7 @@ *, | ||
::after { | ||
--tw-translate-x: 0; | ||
--tw-translate-y: 0; | ||
--tw-rotate: 0; | ||
--tw-skew-x: 0; | ||
--tw-skew-y: 0; | ||
--tw-scale-x: 1; | ||
--tw-scale-y: 1; | ||
--tw-pan-x: ; | ||
--tw-pan-y: ; | ||
--tw-pinch-zoom: ; | ||
--tw-scroll-snap-strictness: proximity; | ||
--tw-ordinal: ; | ||
--tw-slashed-zero: ; | ||
--tw-numeric-figure: ; | ||
--tw-numeric-spacing: ; | ||
--tw-numeric-fraction: ; | ||
--tw-ring-inset: ; | ||
--tw-ring-offset-width: 0px; | ||
--tw-ring-offset-color: #fff; | ||
--tw-ring-color: rgb(59 130 246 / 0.5); | ||
--tw-ring-offset-shadow: 0 0 #0000; | ||
--tw-ring-shadow: 0 0 #0000; | ||
--tw-shadow: 0 0 #0000; | ||
--tw-shadow-colored: 0 0 #0000; | ||
--tw-blur: ; | ||
--tw-brightness: ; | ||
--tw-contrast: ; | ||
--tw-grayscale: ; | ||
--tw-hue-rotate: ; | ||
--tw-invert: ; | ||
--tw-saturate: ; | ||
--tw-sepia: ; | ||
--tw-drop-shadow: ; | ||
--tw-backdrop-blur: ; | ||
--tw-backdrop-brightness: ; | ||
--tw-backdrop-contrast: ; | ||
--tw-backdrop-grayscale: ; | ||
--tw-backdrop-hue-rotate: ; | ||
--tw-backdrop-invert: ; | ||
--tw-backdrop-opacity: ; | ||
--tw-backdrop-saturate: ; | ||
--tw-backdrop-sepia: ; | ||
${vars} | ||
} | ||
::backdrop { | ||
${vars} | ||
} | ||
` | ||
@@ -137,36 +145,41 @@ | ||
} | ||
.prose :where([class~='lead']):not(:where([class~='not-prose'] *)) { | ||
.prose :where([class~='lead']):not(:where([class~='not-prose'], [class~='not-prose'] *)) { | ||
color: var(--tw-prose-lead); | ||
} | ||
.prose :where(strong):not(:where([class~='not-prose'] *)) { | ||
.prose :where(strong):not(:where([class~='not-prose'], [class~='not-prose'] *)) { | ||
color: var(--tw-prose-bold); | ||
font-weight: 600; | ||
} | ||
.prose :where(ol[type='A']):not(:where([class~='not-prose'] *)) { | ||
.prose :where(ol[type='A']):not(:where([class~='not-prose'], [class~='not-prose'] *)) { | ||
list-style-type: upper-alpha; | ||
} | ||
.prose :where(blockquote p:first-of-type):not(:where([class~='not-prose'] *))::before { | ||
.prose | ||
:where(blockquote p:first-of-type):not(:where([class~='not-prose'], [class~='not-prose'] | ||
*))::before { | ||
content: open-quote; | ||
} | ||
.prose :where(blockquote p:last-of-type):not(:where([class~='not-prose'] *))::after { | ||
.prose | ||
:where(blockquote p:last-of-type):not(:where([class~='not-prose'], [class~='not-prose'] | ||
*))::after { | ||
content: close-quote; | ||
} | ||
.prose :where(h4 strong):not(:where([class~='not-prose'] *)) { | ||
.prose :where(h4 strong):not(:where([class~='not-prose'], [class~='not-prose'] *)) { | ||
font-weight: 700; | ||
} | ||
.prose :where(figure > *):not(:where([class~='not-prose'] *)) { | ||
.prose :where(figure > *):not(:where([class~='not-prose'], [class~='not-prose'] *)) { | ||
margin: 0; | ||
} | ||
.prose :where(ol > li):not(:where([class~='not-prose'] *))::marker { | ||
.prose :where(ol > li):not(:where([class~='not-prose'], [class~='not-prose'] *))::marker { | ||
font-weight: 400; | ||
color: var(--tw-prose-counters); | ||
} | ||
.prose > :where(ul > li p):not(:where([class~='not-prose'] *)) { | ||
.prose | ||
:where(.prose > ul > li p):not(:where([class~='not-prose'], [class~='not-prose'] *)) { | ||
margin-top: 16px; | ||
margin-bottom: 16px; | ||
} | ||
.prose :where(code):not(:where([class~='not-prose'] *))::before { | ||
.prose :where(code):not(:where([class~='not-prose'], [class~='not-prose'] *))::before { | ||
content: '`'; | ||
} | ||
.prose :where(code):not(:where([class~='not-prose'] *))::after { | ||
.prose :where(code):not(:where([class~='not-prose'], [class~='not-prose'] *))::after { | ||
content: '`'; | ||
@@ -179,2 +192,90 @@ } | ||
test('variants', async () => { | ||
let config = { | ||
content: [{ raw: html`<div class="sm:prose hover:prose-lg lg:prose-lg"></div>` }], | ||
theme: { | ||
typography: { | ||
DEFAULT: { | ||
css: [ | ||
{ | ||
color: 'red', | ||
p: { | ||
color: 'lime', | ||
}, | ||
'> ul > li': { | ||
color: 'purple', | ||
}, | ||
}, | ||
], | ||
}, | ||
lg: { | ||
css: { | ||
color: 'green', | ||
p: { | ||
color: 'tomato', | ||
}, | ||
'> ul > li': { | ||
color: 'blue', | ||
}, | ||
}, | ||
}, | ||
xl: { | ||
css: { | ||
color: 'yellow', | ||
'> ul > li': { | ||
color: 'hotpink', | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
} | ||
return run(config).then((result) => { | ||
expect(result.css).toMatchFormattedCss( | ||
css` | ||
${defaults} | ||
.hover\:prose-lg:hover { | ||
color: green; | ||
} | ||
.hover\:prose-lg:hover :where(p):not(:where([class~='not-prose'], [class~='not-prose'] *)) { | ||
color: tomato; | ||
} | ||
.hover\:prose-lg:hover | ||
:where(.hover\:prose-lg:hover | ||
> ul | ||
> li):not(:where([class~='not-prose'], [class~='not-prose'] *)) { | ||
color: blue; | ||
} | ||
@media (min-width: 640px) { | ||
.sm\:prose { | ||
color: red; | ||
} | ||
.sm\:prose :where(p):not(:where([class~='not-prose'], [class~='not-prose'] *)) { | ||
color: lime; | ||
} | ||
.sm\:prose | ||
:where(.sm\:prose > ul > li):not(:where([class~='not-prose'], [class~='not-prose'] *)) { | ||
color: purple; | ||
} | ||
} | ||
@media (min-width: 1024px) { | ||
.lg\:prose-lg { | ||
color: green; | ||
} | ||
.lg\:prose-lg :where(p):not(:where([class~='not-prose'], [class~='not-prose'] *)) { | ||
color: tomato; | ||
} | ||
.lg\:prose-lg | ||
:where(.lg\:prose-lg > ul > li):not(:where([class~='not-prose'], [class~='not-prose'] | ||
*)) { | ||
color: blue; | ||
} | ||
} | ||
` | ||
) | ||
}) | ||
}) | ||
test('modifiers', async () => { | ||
@@ -241,2 +342,5 @@ let config = { | ||
}, | ||
'> ul > li': { | ||
paddingLeft: '12px', | ||
}, | ||
h1: { | ||
@@ -273,32 +377,36 @@ fontSize: '48px', | ||
} | ||
.prose :where([class~='lead']):not(:where([class~='not-prose'] *)) { | ||
.prose :where([class~='lead']):not(:where([class~='not-prose'], [class~='not-prose'] *)) { | ||
color: var(--tw-prose-lead); | ||
} | ||
.prose :where(strong):not(:where([class~='not-prose'] *)) { | ||
.prose :where(strong):not(:where([class~='not-prose'], [class~='not-prose'] *)) { | ||
color: var(--tw-prose-bold); | ||
font-weight: 600; | ||
} | ||
.prose :where(ol[type='A']):not(:where([class~='not-prose'] *)) { | ||
.prose :where(ol[type='A']):not(:where([class~='not-prose'], [class~='not-prose'] *)) { | ||
list-style-type: upper-alpha; | ||
} | ||
.prose :where(blockquote p:first-of-type):not(:where([class~='not-prose'] *))::before { | ||
.prose | ||
:where(blockquote p:first-of-type):not(:where([class~='not-prose'], [class~='not-prose'] | ||
*))::before { | ||
content: open-quote; | ||
} | ||
.prose :where(blockquote p:last-of-type):not(:where([class~='not-prose'] *))::after { | ||
.prose | ||
:where(blockquote p:last-of-type):not(:where([class~='not-prose'], [class~='not-prose'] | ||
*))::after { | ||
content: close-quote; | ||
} | ||
.prose :where(h4 strong):not(:where([class~='not-prose'] *)) { | ||
.prose :where(h4 strong):not(:where([class~='not-prose'], [class~='not-prose'] *)) { | ||
font-weight: 700; | ||
} | ||
.prose :where(figure > *):not(:where([class~='not-prose'] *)) { | ||
.prose :where(figure > *):not(:where([class~='not-prose'], [class~='not-prose'] *)) { | ||
margin: 0; | ||
} | ||
.prose :where(ol > li):not(:where([class~='not-prose'] *))::marker { | ||
.prose :where(ol > li):not(:where([class~='not-prose'], [class~='not-prose'] *))::marker { | ||
font-weight: 400; | ||
color: var(--tw-prose-counters); | ||
} | ||
.prose :where(code):not(:where([class~='not-prose'] *))::before { | ||
.prose :where(code):not(:where([class~='not-prose'], [class~='not-prose'] *))::before { | ||
content: '`'; | ||
} | ||
.prose :where(code):not(:where([class~='not-prose'] *))::after { | ||
.prose :where(code):not(:where([class~='not-prose'], [class~='not-prose'] *))::after { | ||
content: '`'; | ||
@@ -310,14 +418,19 @@ } | ||
} | ||
.prose-lg :where(p):not(:where([class~='not-prose'] *)) { | ||
.prose-lg :where(p):not(:where([class~='not-prose'], [class~='not-prose'] *)) { | ||
margin-top: 24px; | ||
margin-bottom: 24px; | ||
} | ||
.prose-lg :where([class~='lead']):not(:where([class~='not-prose'] *)) { | ||
.prose-lg | ||
:where([class~='lead']):not(:where([class~='not-prose'], [class~='not-prose'] *)) { | ||
font-size: 22px; | ||
} | ||
.prose-lg :where(blockquote):not(:where([class~='not-prose'] *)) { | ||
.prose-lg :where(blockquote):not(:where([class~='not-prose'], [class~='not-prose'] *)) { | ||
margin-top: 40px; | ||
margin-bottom: 40px; | ||
} | ||
.prose-lg :where(h1):not(:where([class~='not-prose'] *)) { | ||
.prose-lg | ||
:where(.prose-lg > ul > li):not(:where([class~='not-prose'], [class~='not-prose'] *)) { | ||
padding-left: 12px; | ||
} | ||
.prose-lg :where(h1):not(:where([class~='not-prose'], [class~='not-prose'] *)) { | ||
font-size: 48px; | ||
@@ -327,3 +440,3 @@ margin-top: 0; | ||
} | ||
.prose-lg :where(h2):not(:where([class~='not-prose'] *)) { | ||
.prose-lg :where(h2):not(:where([class~='not-prose'], [class~='not-prose'] *)) { | ||
font-size: 30px; | ||
@@ -333,3 +446,3 @@ margin-top: 56px; | ||
} | ||
.prose-lg :where(h3):not(:where([class~='not-prose'] *)) { | ||
.prose-lg :where(h3):not(:where([class~='not-prose'], [class~='not-prose'] *)) { | ||
font-size: 24px; | ||
@@ -347,3 +460,5 @@ margin-top: 40px; | ||
plugins: [typographyPlugin({ target: 'legacy' })], | ||
content: [{ raw: html`<div class="prose"></div>` }], | ||
content: [ | ||
{ raw: html`<div class="prose prose-h1:text-center prose-headings:text-ellipsis"></div>` }, | ||
], | ||
theme: { | ||
@@ -436,2 +551,26 @@ typography: { | ||
} | ||
.prose-headings\:text-ellipsis h1 { | ||
text-overflow: ellipsis; | ||
} | ||
.prose-headings\:text-ellipsis h2 { | ||
text-overflow: ellipsis; | ||
} | ||
.prose-headings\:text-ellipsis h3 { | ||
text-overflow: ellipsis; | ||
} | ||
.prose-headings\:text-ellipsis h4 { | ||
text-overflow: ellipsis; | ||
} | ||
.prose-headings\:text-ellipsis h5 { | ||
text-overflow: ellipsis; | ||
} | ||
.prose-headings\:text-ellipsis h6 { | ||
text-overflow: ellipsis; | ||
} | ||
.prose-headings\:text-ellipsis th { | ||
text-overflow: ellipsis; | ||
} | ||
.prose-h1\:text-center h1 { | ||
text-align: center; | ||
} | ||
` | ||
@@ -501,33 +640,44 @@ ) | ||
} | ||
.markdown :where([class~='lead']):not(:where([class~='not-markdown'] *)) { | ||
.markdown | ||
:where([class~='lead']):not(:where([class~='not-markdown'], [class~='not-markdown'] *)) { | ||
color: var(--tw-prose-lead); | ||
} | ||
.markdown :where(strong):not(:where([class~='not-markdown'] *)) { | ||
.markdown :where(strong):not(:where([class~='not-markdown'], [class~='not-markdown'] *)) { | ||
color: var(--tw-prose-bold); | ||
font-weight: 600; | ||
} | ||
.markdown :where(ol[type='A']):not(:where([class~='not-markdown'] *)) { | ||
.markdown | ||
:where(ol[type='A']):not(:where([class~='not-markdown'], [class~='not-markdown'] *)) { | ||
list-style-type: upper-alpha; | ||
} | ||
.markdown | ||
:where(blockquote p:first-of-type):not(:where([class~='not-markdown'] *))::before { | ||
:where(blockquote | ||
p:first-of-type):not(:where([class~='not-markdown'], [class~='not-markdown'] | ||
*))::before { | ||
content: open-quote; | ||
} | ||
.markdown :where(blockquote p:last-of-type):not(:where([class~='not-markdown'] *))::after { | ||
.markdown | ||
:where(blockquote | ||
p:last-of-type):not(:where([class~='not-markdown'], [class~='not-markdown'] *))::after { | ||
content: close-quote; | ||
} | ||
.markdown :where(h4 strong):not(:where([class~='not-markdown'] *)) { | ||
.markdown | ||
:where(h4 strong):not(:where([class~='not-markdown'], [class~='not-markdown'] *)) { | ||
font-weight: 700; | ||
} | ||
.markdown :where(figure > *):not(:where([class~='not-markdown'] *)) { | ||
.markdown | ||
:where(figure > *):not(:where([class~='not-markdown'], [class~='not-markdown'] *)) { | ||
margin: 0; | ||
} | ||
.markdown :where(ol > li):not(:where([class~='not-markdown'] *))::marker { | ||
.markdown | ||
:where(ol > li):not(:where([class~='not-markdown'], [class~='not-markdown'] *))::marker { | ||
font-weight: 400; | ||
color: var(--tw-prose-counters); | ||
} | ||
.markdown :where(code):not(:where([class~='not-markdown'] *))::before { | ||
.markdown | ||
:where(code):not(:where([class~='not-markdown'], [class~='not-markdown'] *))::before { | ||
content: '`'; | ||
} | ||
.markdown :where(code):not(:where([class~='not-markdown'] *))::after { | ||
.markdown | ||
:where(code):not(:where([class~='not-markdown'], [class~='not-markdown'] *))::after { | ||
content: '`'; | ||
@@ -560,2 +710,3 @@ } | ||
prose-em:italic | ||
prose-kbd:border-b-2 | ||
prose-code:font-mono | ||
@@ -608,101 +759,127 @@ prose-pre:font-mono | ||
} | ||
.prose :where([class~='lead']):not(:where([class~='not-prose'] *)) { | ||
.prose :where([class~='lead']):not(:where([class~='not-prose'], [class~='not-prose'] *)) { | ||
color: var(--tw-prose-lead); | ||
} | ||
.prose :where(strong):not(:where([class~='not-prose'] *)) { | ||
.prose :where(strong):not(:where([class~='not-prose'], [class~='not-prose'] *)) { | ||
color: var(--tw-prose-bold); | ||
font-weight: 600; | ||
} | ||
.prose :where(h4 strong):not(:where([class~='not-prose'] *)) { | ||
.prose :where(h4 strong):not(:where([class~='not-prose'], [class~='not-prose'] *)) { | ||
font-weight: 700; | ||
} | ||
.prose-headings\:underline | ||
:is(:where(h1, h2, h3, h4, th):not(:where([class~='not-prose'] *))) { | ||
:is(:where(h1, h2, h3, h4, h5, h6, th):not(:where([class~='not-prose'], [class~='not-prose'] | ||
*))) { | ||
text-decoration-line: underline; | ||
} | ||
.prose-lead\:italic :is(:where([class~='lead']):not(:where([class~='not-prose'] *))) { | ||
font-style: italic; | ||
} | ||
.prose-h1\:text-3xl :is(:where(h1):not(:where([class~='not-prose'] *))) { | ||
.prose-h1\:text-3xl | ||
:is(:where(h1):not(:where([class~='not-prose'], [class~='not-prose'] *))) { | ||
font-size: 1.875rem; | ||
line-height: 2.25rem; | ||
} | ||
.prose-h2\:text-2xl :is(:where(h2):not(:where([class~='not-prose'] *))) { | ||
.prose-h2\:text-2xl | ||
:is(:where(h2):not(:where([class~='not-prose'], [class~='not-prose'] *))) { | ||
font-size: 1.5rem; | ||
line-height: 2rem; | ||
} | ||
.prose-h3\:text-xl :is(:where(h3):not(:where([class~='not-prose'] *))) { | ||
.prose-h3\:text-xl | ||
:is(:where(h3):not(:where([class~='not-prose'], [class~='not-prose'] *))) { | ||
font-size: 1.25rem; | ||
line-height: 1.75rem; | ||
} | ||
.prose-h4\:text-lg :is(:where(h4):not(:where([class~='not-prose'] *))) { | ||
.prose-h4\:text-lg | ||
:is(:where(h4):not(:where([class~='not-prose'], [class~='not-prose'] *))) { | ||
font-size: 1.125rem; | ||
line-height: 1.75rem; | ||
} | ||
.prose-p\:text-gray-700 :is(:where(p):not(:where([class~='not-prose'] *))) { | ||
.prose-p\:text-gray-700 | ||
:is(:where(p):not(:where([class~='not-prose'], [class~='not-prose'] *))) { | ||
--tw-text-opacity: 1; | ||
color: rgb(55 65 81 / var(--tw-text-opacity)); | ||
} | ||
.prose-a\:font-bold :is(:where(a):not(:where([class~='not-prose'] *))) { | ||
.prose-a\:font-bold | ||
:is(:where(a):not(:where([class~='not-prose'], [class~='not-prose'] *))) { | ||
font-weight: 700; | ||
} | ||
.prose-blockquote\:italic :is(:where(blockquote):not(:where([class~='not-prose'] *))) { | ||
.prose-blockquote\:italic | ||
:is(:where(blockquote):not(:where([class~='not-prose'], [class~='not-prose'] *))) { | ||
font-style: italic; | ||
} | ||
.prose-figure\:mx-auto :is(:where(figure):not(:where([class~='not-prose'] *))) { | ||
.prose-figure\:mx-auto | ||
:is(:where(figure):not(:where([class~='not-prose'], [class~='not-prose'] *))) { | ||
margin-left: auto; | ||
margin-right: auto; | ||
} | ||
.prose-figcaption\:opacity-75 :is(:where(figcaption):not(:where([class~='not-prose'] *))) { | ||
.prose-figcaption\:opacity-75 | ||
:is(:where(figcaption):not(:where([class~='not-prose'], [class~='not-prose'] *))) { | ||
opacity: 0.75; | ||
} | ||
.prose-strong\:font-medium :is(:where(strong):not(:where([class~='not-prose'] *))) { | ||
.prose-strong\:font-medium | ||
:is(:where(strong):not(:where([class~='not-prose'], [class~='not-prose'] *))) { | ||
font-weight: 500; | ||
} | ||
.prose-em\:italic :is(:where(em):not(:where([class~='not-prose'] *))) { | ||
.prose-em\:italic | ||
:is(:where(em):not(:where([class~='not-prose'], [class~='not-prose'] *))) { | ||
font-style: italic; | ||
} | ||
.prose-code\:font-mono :is(:where(code):not(:where([class~='not-prose'] *))) { | ||
.prose-kbd\:border-b-2 | ||
:is(:where(kbd):not(:where([class~='not-prose'], [class~='not-prose'] *))) { | ||
border-bottom-width: 2px; | ||
} | ||
.prose-code\:font-mono | ||
:is(:where(code):not(:where([class~='not-prose'], [class~='not-prose'] *))) { | ||
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', | ||
'Courier New', monospace; | ||
} | ||
.prose-pre\:font-mono :is(:where(pre):not(:where([class~='not-prose'] *))) { | ||
.prose-pre\:font-mono | ||
:is(:where(pre):not(:where([class~='not-prose'], [class~='not-prose'] *))) { | ||
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', | ||
'Courier New', monospace; | ||
} | ||
.prose-ol\:pl-6 :is(:where(ol):not(:where([class~='not-prose'] *))) { | ||
.prose-ol\:pl-6 :is(:where(ol):not(:where([class~='not-prose'], [class~='not-prose'] *))) { | ||
padding-left: 1.5rem; | ||
} | ||
.prose-ul\:pl-8 :is(:where(ul):not(:where([class~='not-prose'] *))) { | ||
.prose-ul\:pl-8 :is(:where(ul):not(:where([class~='not-prose'], [class~='not-prose'] *))) { | ||
padding-left: 2rem; | ||
} | ||
.prose-li\:my-4 :is(:where(li):not(:where([class~='not-prose'] *))) { | ||
.prose-li\:my-4 :is(:where(li):not(:where([class~='not-prose'], [class~='not-prose'] *))) { | ||
margin-top: 1rem; | ||
margin-bottom: 1rem; | ||
} | ||
.prose-table\:my-8 :is(:where(table):not(:where([class~='not-prose'] *))) { | ||
.prose-table\:my-8 | ||
:is(:where(table):not(:where([class~='not-prose'], [class~='not-prose'] *))) { | ||
margin-top: 2rem; | ||
margin-bottom: 2rem; | ||
} | ||
.prose-thead\:border-red-300 :is(:where(thead):not(:where([class~='not-prose'] *))) { | ||
.prose-thead\:border-red-300 | ||
:is(:where(thead):not(:where([class~='not-prose'], [class~='not-prose'] *))) { | ||
--tw-border-opacity: 1; | ||
border-color: rgb(252 165 165 / var(--tw-border-opacity)); | ||
} | ||
.prose-tr\:border-red-200 :is(:where(tr):not(:where([class~='not-prose'] *))) { | ||
.prose-tr\:border-red-200 | ||
:is(:where(tr):not(:where([class~='not-prose'], [class~='not-prose'] *))) { | ||
--tw-border-opacity: 1; | ||
border-color: rgb(254 202 202 / var(--tw-border-opacity)); | ||
} | ||
.prose-th\:text-left :is(:where(th):not(:where([class~='not-prose'] *))) { | ||
.prose-th\:text-left | ||
:is(:where(th):not(:where([class~='not-prose'], [class~='not-prose'] *))) { | ||
text-align: left; | ||
} | ||
.prose-img\:rounded-lg :is(:where(img):not(:where([class~='not-prose'] *))) { | ||
.prose-img\:rounded-lg | ||
:is(:where(img):not(:where([class~='not-prose'], [class~='not-prose'] *))) { | ||
border-radius: 0.5rem; | ||
} | ||
.prose-video\:my-12 :is(:where(video):not(:where([class~='not-prose'] *))) { | ||
.prose-video\:my-12 | ||
:is(:where(video):not(:where([class~='not-prose'], [class~='not-prose'] *))) { | ||
margin-top: 3rem; | ||
margin-bottom: 3rem; | ||
} | ||
.prose-hr\:border-t-2 :is(:where(hr):not(:where([class~='not-prose'] *))) { | ||
.prose-hr\:border-t-2 | ||
:is(:where(hr):not(:where([class~='not-prose'], [class~='not-prose'] *))) { | ||
border-top-width: 2px; | ||
} | ||
.prose-lead\:italic | ||
:is(:where([class~='lead']):not(:where([class~='not-prose'], [class~='not-prose'] *))) { | ||
font-style: italic; | ||
} | ||
` | ||
@@ -734,2 +911,3 @@ ) | ||
markdown-em:italic | ||
markdown-kbd:border-b-2 | ||
markdown-code:font-mono | ||
@@ -782,47 +960,54 @@ markdown-pre:font-mono | ||
} | ||
.markdown :where([class~='lead']):not(:where([class~='not-markdown'] *)) { | ||
.markdown | ||
:where([class~='lead']):not(:where([class~='not-markdown'], [class~='not-markdown'] *)) { | ||
color: var(--tw-prose-lead); | ||
} | ||
.markdown :where(strong):not(:where([class~='not-markdown'] *)) { | ||
.markdown :where(strong):not(:where([class~='not-markdown'], [class~='not-markdown'] *)) { | ||
color: var(--tw-prose-bold); | ||
font-weight: 600; | ||
} | ||
.markdown :where(h4 strong):not(:where([class~='not-markdown'] *)) { | ||
.markdown | ||
:where(h4 strong):not(:where([class~='not-markdown'], [class~='not-markdown'] *)) { | ||
font-weight: 700; | ||
} | ||
.markdown-headings\:underline | ||
:is(:where(h1, h2, h3, h4, th):not(:where([class~='not-markdown'] *))) { | ||
:is(:where(h1, h2, h3, h4, h5, h6, th):not(:where([class~='not-markdown'], [class~='not-markdown'] | ||
*))) { | ||
text-decoration-line: underline; | ||
} | ||
.markdown-lead\:italic :is(:where([class~='lead']):not(:where([class~='not-markdown'] *))) { | ||
font-style: italic; | ||
} | ||
.markdown-h1\:text-3xl :is(:where(h1):not(:where([class~='not-markdown'] *))) { | ||
.markdown-h1\:text-3xl | ||
:is(:where(h1):not(:where([class~='not-markdown'], [class~='not-markdown'] *))) { | ||
font-size: 1.875rem; | ||
line-height: 2.25rem; | ||
} | ||
.markdown-h2\:text-2xl :is(:where(h2):not(:where([class~='not-markdown'] *))) { | ||
.markdown-h2\:text-2xl | ||
:is(:where(h2):not(:where([class~='not-markdown'], [class~='not-markdown'] *))) { | ||
font-size: 1.5rem; | ||
line-height: 2rem; | ||
} | ||
.markdown-h3\:text-xl :is(:where(h3):not(:where([class~='not-markdown'] *))) { | ||
.markdown-h3\:text-xl | ||
:is(:where(h3):not(:where([class~='not-markdown'], [class~='not-markdown'] *))) { | ||
font-size: 1.25rem; | ||
line-height: 1.75rem; | ||
} | ||
.markdown-h4\:text-lg :is(:where(h4):not(:where([class~='not-markdown'] *))) { | ||
.markdown-h4\:text-lg | ||
:is(:where(h4):not(:where([class~='not-markdown'], [class~='not-markdown'] *))) { | ||
font-size: 1.125rem; | ||
line-height: 1.75rem; | ||
} | ||
.markdown-p\:text-gray-700 :is(:where(p):not(:where([class~='not-markdown'] *))) { | ||
.markdown-p\:text-gray-700 | ||
:is(:where(p):not(:where([class~='not-markdown'], [class~='not-markdown'] *))) { | ||
--tw-text-opacity: 1; | ||
color: rgb(55 65 81 / var(--tw-text-opacity)); | ||
} | ||
.markdown-a\:font-bold :is(:where(a):not(:where([class~='not-markdown'] *))) { | ||
.markdown-a\:font-bold | ||
:is(:where(a):not(:where([class~='not-markdown'], [class~='not-markdown'] *))) { | ||
font-weight: 700; | ||
} | ||
.markdown-blockquote\:italic | ||
:is(:where(blockquote):not(:where([class~='not-markdown'] *))) { | ||
:is(:where(blockquote):not(:where([class~='not-markdown'], [class~='not-markdown'] *))) { | ||
font-style: italic; | ||
} | ||
.markdown-figure\:mx-auto :is(:where(figure):not(:where([class~='not-markdown'] *))) { | ||
.markdown-figure\:mx-auto | ||
:is(:where(figure):not(:where([class~='not-markdown'], [class~='not-markdown'] *))) { | ||
margin-left: auto; | ||
@@ -832,54 +1017,77 @@ margin-right: auto; | ||
.markdown-figcaption\:opacity-75 | ||
:is(:where(figcaption):not(:where([class~='not-markdown'] *))) { | ||
:is(:where(figcaption):not(:where([class~='not-markdown'], [class~='not-markdown'] *))) { | ||
opacity: 0.75; | ||
} | ||
.markdown-strong\:font-medium :is(:where(strong):not(:where([class~='not-markdown'] *))) { | ||
.markdown-strong\:font-medium | ||
:is(:where(strong):not(:where([class~='not-markdown'], [class~='not-markdown'] *))) { | ||
font-weight: 500; | ||
} | ||
.markdown-em\:italic :is(:where(em):not(:where([class~='not-markdown'] *))) { | ||
.markdown-em\:italic | ||
:is(:where(em):not(:where([class~='not-markdown'], [class~='not-markdown'] *))) { | ||
font-style: italic; | ||
} | ||
.markdown-code\:font-mono :is(:where(code):not(:where([class~='not-markdown'] *))) { | ||
.markdown-kbd\:border-b-2 | ||
:is(:where(kbd):not(:where([class~='not-markdown'], [class~='not-markdown'] *))) { | ||
border-bottom-width: 2px; | ||
} | ||
.markdown-code\:font-mono | ||
:is(:where(code):not(:where([class~='not-markdown'], [class~='not-markdown'] *))) { | ||
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', | ||
'Courier New', monospace; | ||
} | ||
.markdown-pre\:font-mono :is(:where(pre):not(:where([class~='not-markdown'] *))) { | ||
.markdown-pre\:font-mono | ||
:is(:where(pre):not(:where([class~='not-markdown'], [class~='not-markdown'] *))) { | ||
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', | ||
'Courier New', monospace; | ||
} | ||
.markdown-ol\:pl-6 :is(:where(ol):not(:where([class~='not-markdown'] *))) { | ||
.markdown-ol\:pl-6 | ||
:is(:where(ol):not(:where([class~='not-markdown'], [class~='not-markdown'] *))) { | ||
padding-left: 1.5rem; | ||
} | ||
.markdown-ul\:pl-8 :is(:where(ul):not(:where([class~='not-markdown'] *))) { | ||
.markdown-ul\:pl-8 | ||
:is(:where(ul):not(:where([class~='not-markdown'], [class~='not-markdown'] *))) { | ||
padding-left: 2rem; | ||
} | ||
.markdown-li\:my-4 :is(:where(li):not(:where([class~='not-markdown'] *))) { | ||
.markdown-li\:my-4 | ||
:is(:where(li):not(:where([class~='not-markdown'], [class~='not-markdown'] *))) { | ||
margin-top: 1rem; | ||
margin-bottom: 1rem; | ||
} | ||
.markdown-table\:my-8 :is(:where(table):not(:where([class~='not-markdown'] *))) { | ||
.markdown-table\:my-8 | ||
:is(:where(table):not(:where([class~='not-markdown'], [class~='not-markdown'] *))) { | ||
margin-top: 2rem; | ||
margin-bottom: 2rem; | ||
} | ||
.markdown-thead\:border-red-300 :is(:where(thead):not(:where([class~='not-markdown'] *))) { | ||
.markdown-thead\:border-red-300 | ||
:is(:where(thead):not(:where([class~='not-markdown'], [class~='not-markdown'] *))) { | ||
--tw-border-opacity: 1; | ||
border-color: rgb(252 165 165 / var(--tw-border-opacity)); | ||
} | ||
.markdown-tr\:border-red-200 :is(:where(tr):not(:where([class~='not-markdown'] *))) { | ||
.markdown-tr\:border-red-200 | ||
:is(:where(tr):not(:where([class~='not-markdown'], [class~='not-markdown'] *))) { | ||
--tw-border-opacity: 1; | ||
border-color: rgb(254 202 202 / var(--tw-border-opacity)); | ||
} | ||
.markdown-th\:text-left :is(:where(th):not(:where([class~='not-markdown'] *))) { | ||
.markdown-th\:text-left | ||
:is(:where(th):not(:where([class~='not-markdown'], [class~='not-markdown'] *))) { | ||
text-align: left; | ||
} | ||
.markdown-img\:rounded-lg :is(:where(img):not(:where([class~='not-markdown'] *))) { | ||
.markdown-img\:rounded-lg | ||
:is(:where(img):not(:where([class~='not-markdown'], [class~='not-markdown'] *))) { | ||
border-radius: 0.5rem; | ||
} | ||
.markdown-video\:my-12 :is(:where(video):not(:where([class~='not-markdown'] *))) { | ||
.markdown-video\:my-12 | ||
:is(:where(video):not(:where([class~='not-markdown'], [class~='not-markdown'] *))) { | ||
margin-top: 3rem; | ||
margin-bottom: 3rem; | ||
} | ||
.markdown-hr\:border-t-2 :is(:where(hr):not(:where([class~='not-markdown'] *))) { | ||
.markdown-hr\:border-t-2 | ||
:is(:where(hr):not(:where([class~='not-markdown'], [class~='not-markdown'] *))) { | ||
border-top-width: 2px; | ||
} | ||
.markdown-lead\:italic | ||
:is(:where([class~='lead']):not(:where([class~='not-markdown'], [class~='not-markdown'] | ||
*))) { | ||
font-style: italic; | ||
} | ||
` | ||
@@ -958,3 +1166,3 @@ ) | ||
expect(result.css).toIncludeCss(css` | ||
.prose :where(a):not(:where([class~='not-prose'] *)) { | ||
.prose :where(a):not(:where([class~='not-prose'], [class~='not-prose'] *)) { | ||
color: #888; | ||
@@ -967,3 +1175,3 @@ text-decoration: underline; | ||
expect(result.css).toIncludeCss(css` | ||
.prose :where(a):not(:where([class~='not-prose'] *)):hover { | ||
.prose :where(a):not(:where([class~='not-prose'], [class~='not-prose'] *)):hover { | ||
color: #ff0000; | ||
@@ -974,1 +1182,262 @@ } | ||
}) | ||
it('should be possible to specify custom h5 and h6 styles', () => { | ||
let config = { | ||
plugins: [typographyPlugin()], | ||
content: [ | ||
{ | ||
raw: html`<div class="prose prose-h5:text-sm prose-h6:text-xl"></div>`, | ||
}, | ||
], | ||
} | ||
return run(config).then((result) => { | ||
expect(result.css).toIncludeCss(css` | ||
.prose-h5\:text-sm :is(:where(h5):not(:where([class~='not-prose'], [class~='not-prose'] *))) { | ||
font-size: 0.875rem; | ||
line-height: 1.25rem; | ||
} | ||
.prose-h6\:text-xl :is(:where(h6):not(:where([class~='not-prose'], [class~='not-prose'] *))) { | ||
font-size: 1.25rem; | ||
line-height: 1.75rem; | ||
} | ||
`) | ||
}) | ||
}) | ||
it('should not break with multiple selectors with pseudo elements using variants', () => { | ||
let config = { | ||
darkMode: 'class', | ||
plugins: [typographyPlugin()], | ||
content: [ | ||
{ | ||
raw: html`<div class="dark:prose"></div>`, | ||
}, | ||
], | ||
theme: { | ||
typography: { | ||
DEFAULT: { | ||
css: { | ||
'ol li::before, ul li::before': { | ||
color: 'red', | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
} | ||
return run(config).then((result) => { | ||
expect(result.css).toIncludeCss(css` | ||
.dark | ||
.dark\:prose | ||
:where(ol li, ul li):not(:where([class~='not-prose'], [class~='not-prose'] *))::before { | ||
color: red; | ||
} | ||
`) | ||
}) | ||
}) | ||
it('lifts all common, trailing pseudo elements when the same across all selectors', () => { | ||
let config = { | ||
darkMode: 'class', | ||
plugins: [typographyPlugin()], | ||
content: [ | ||
{ | ||
raw: html`<div class="prose dark:prose"></div>`, | ||
}, | ||
], | ||
theme: { | ||
typography: { | ||
DEFAULT: { | ||
css: { | ||
'ol li::marker::before, ul li::marker::before': { | ||
color: 'red', | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
} | ||
return run(config).then((result) => { | ||
expect(result.css).toIncludeCss(css` | ||
.prose | ||
:where(ol li, ul li):not(:where([class~='not-prose'], [class~='not-prose'] | ||
*))::marker::before { | ||
color: red; | ||
} | ||
`) | ||
// TODO: The output here is a bug in tailwindcss variant selector rewriting | ||
// IT should be ::marker::before | ||
expect(result.css).toIncludeCss(css` | ||
.dark | ||
.dark\:prose | ||
:where(ol li, ul li):not(:where([class~='not-prose'], [class~='not-prose'] | ||
*))::before::marker { | ||
color: red; | ||
} | ||
`) | ||
}) | ||
}) | ||
it('does not modify selectors with differing pseudo elements', () => { | ||
let config = { | ||
darkMode: 'class', | ||
plugins: [typographyPlugin()], | ||
content: [ | ||
{ | ||
raw: html`<div class="prose dark:prose"></div>`, | ||
}, | ||
], | ||
theme: { | ||
typography: { | ||
DEFAULT: { | ||
css: { | ||
'ol li::before, ul li::after': { | ||
color: 'red', | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
} | ||
return run(config).then((result) => { | ||
expect(result.css).toIncludeCss(css` | ||
.prose | ||
:where(ol li::before, ul li::after):not(:where([class~='not-prose'], [class~='not-prose'] | ||
*)) { | ||
color: red; | ||
} | ||
`) | ||
// TODO: The output here is a bug in tailwindcss variant selector rewriting | ||
expect(result.css).toIncludeCss(css` | ||
.dark | ||
.dark\:prose | ||
:where(ol li, ul li):not(:where([class~='not-prose'], [class~='not-prose'] *))::before, | ||
::after { | ||
color: red; | ||
} | ||
`) | ||
}) | ||
}) | ||
it('lifts only the common, trailing pseudo elements from selectors', () => { | ||
let config = { | ||
darkMode: 'class', | ||
plugins: [typographyPlugin()], | ||
content: [ | ||
{ | ||
raw: html`<div class="prose dark:prose"></div>`, | ||
}, | ||
], | ||
theme: { | ||
typography: { | ||
DEFAULT: { | ||
css: { | ||
'ol li::scroll-thumb::before, ul li::scroll-track::before': { | ||
color: 'red', | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
} | ||
return run(config).then((result) => { | ||
expect(result.css).toIncludeCss(css` | ||
.prose | ||
:where(ol li::scroll-thumb, ul | ||
li::scroll-track):not(:where([class~='not-prose'], [class~='not-prose'] *))::before { | ||
color: red; | ||
} | ||
`) | ||
// TODO: The output here is a bug in tailwindcss variant selector rewriting | ||
expect(result.css).toIncludeCss(css` | ||
.dark | ||
.dark\:prose | ||
:where(ol li, ul li):not(:where([class~='not-prose'], [class~='not-prose'] | ||
*))::scroll-thumb, | ||
::scroll-track, | ||
::before { | ||
color: red; | ||
} | ||
`) | ||
}) | ||
}) | ||
it('ignores common non-trailing pseudo-elements in selectors', () => { | ||
let config = { | ||
darkMode: 'class', | ||
plugins: [typographyPlugin()], | ||
content: [ | ||
{ | ||
raw: html`<div class="prose dark:prose"></div>`, | ||
}, | ||
], | ||
theme: { | ||
typography: { | ||
DEFAULT: { | ||
css: { | ||
'ol li::before::scroll-thumb, ul li::before::scroll-track': { | ||
color: 'red', | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
} | ||
return run(config).then((result) => { | ||
expect(result.css).toIncludeCss(css` | ||
.prose | ||
:where(ol li::before::scroll-thumb, ul | ||
li::before::scroll-track):not(:where([class~='not-prose'], [class~='not-prose'] *)) { | ||
color: red; | ||
} | ||
`) | ||
// TODO: The output here is a bug in tailwindcss variant selector rewriting | ||
expect(result.css).toIncludeCss(css` | ||
.dark | ||
.dark\:prose | ||
:where(ol li::scroll-thumb, ul | ||
li::scroll-track):not(:where([class~='not-prose'], [class~='not-prose'] *))::before, | ||
::before { | ||
color: red; | ||
} | ||
`) | ||
}) | ||
}) | ||
test('lead styles are inserted after paragraph styles', async () => { | ||
let config = { | ||
content: [{ raw: html`<div class="prose"></div>` }], | ||
} | ||
return run(config).then((result) => { | ||
expect(result.css).toIncludeCss( | ||
css` | ||
.prose { | ||
color: var(--tw-prose-body); | ||
max-width: 65ch; | ||
} | ||
.prose :where(p):not(:where([class~='not-prose'], [class~='not-prose'] *)) { | ||
margin-top: 1.25em; | ||
margin-bottom: 1.25em; | ||
} | ||
.prose :where([class~='lead']):not(:where([class~='not-prose'], [class~='not-prose'] *)) { | ||
color: var(--tw-prose-lead); | ||
font-size: 1.25em; | ||
line-height: 1.6; | ||
margin-top: 1.2em; | ||
margin-bottom: 1.2em; | ||
} | ||
` | ||
) | ||
}) | ||
}) |
@@ -10,2 +10,10 @@ const colors = require('tailwindcss/colors') | ||
const em = (px, base) => `${round(px / base)}em` | ||
const hexToRgb = (hex) => { | ||
hex = hex.replace('#', '') | ||
hex = hex.length === 3 ? hex.replace(/./g, '$&$&') : hex | ||
const r = parseInt(hex.substring(0, 2), 16) | ||
const g = parseInt(hex.substring(2, 4), 16) | ||
const b = parseInt(hex.substring(4, 6), 16) | ||
return `${r} ${g} ${b}` | ||
} | ||
@@ -31,3 +39,3 @@ let defaultModifiers = { | ||
marginBottom: em(24, 18), | ||
paddingLeft: em(20, 18), | ||
paddingInlineStart: em(20, 18), | ||
}, | ||
@@ -61,18 +69,21 @@ h1: { | ||
}, | ||
video: { | ||
picture: { | ||
marginTop: em(24, 14), | ||
marginBottom: em(24, 14), | ||
}, | ||
figure: { | ||
'picture > img': { | ||
marginTop: '0', | ||
marginBottom: '0', | ||
}, | ||
video: { | ||
marginTop: em(24, 14), | ||
marginBottom: em(24, 14), | ||
}, | ||
'figure > *': { | ||
marginTop: '0', | ||
marginBottom: '0', | ||
}, | ||
figcaption: { | ||
kbd: { | ||
fontSize: em(12, 14), | ||
lineHeight: round(16 / 12), | ||
marginTop: em(8, 12), | ||
borderRadius: rem(5), | ||
paddingTop: em(2, 14), | ||
paddingInlineEnd: em(5, 14), | ||
paddingBottom: em(2, 14), | ||
paddingInlineStart: em(5, 14), | ||
}, | ||
@@ -95,5 +106,5 @@ code: { | ||
paddingTop: em(8, 12), | ||
paddingRight: em(12, 12), | ||
paddingInlineEnd: em(12, 12), | ||
paddingBottom: em(8, 12), | ||
paddingLeft: em(12, 12), | ||
paddingInlineStart: em(12, 12), | ||
}, | ||
@@ -103,3 +114,3 @@ ol: { | ||
marginBottom: em(16, 14), | ||
paddingLeft: em(22, 14), | ||
paddingInlineStart: em(22, 14), | ||
}, | ||
@@ -109,3 +120,3 @@ ul: { | ||
marginBottom: em(16, 14), | ||
paddingLeft: em(22, 14), | ||
paddingInlineStart: em(22, 14), | ||
}, | ||
@@ -117,6 +128,6 @@ li: { | ||
'ol > li': { | ||
paddingLeft: em(6, 14), | ||
paddingInlineStart: em(6, 14), | ||
}, | ||
'ul > li': { | ||
paddingLeft: em(6, 14), | ||
paddingInlineStart: em(6, 14), | ||
}, | ||
@@ -127,12 +138,12 @@ '> ul > li p': { | ||
}, | ||
'> ul > li > *:first-child': { | ||
'> ul > li > p:first-child': { | ||
marginTop: em(16, 14), | ||
}, | ||
'> ul > li > *:last-child': { | ||
'> ul > li > p:last-child': { | ||
marginBottom: em(16, 14), | ||
}, | ||
'> ol > li > *:first-child': { | ||
'> ol > li > p:first-child': { | ||
marginTop: em(16, 14), | ||
}, | ||
'> ol > li > *:last-child': { | ||
'> ol > li > p:last-child': { | ||
marginBottom: em(16, 14), | ||
@@ -144,2 +155,13 @@ }, | ||
}, | ||
dl: { | ||
marginTop: em(16, 14), | ||
marginBottom: em(16, 14), | ||
}, | ||
dt: { | ||
marginTop: em(16, 14), | ||
}, | ||
dd: { | ||
marginTop: em(4, 14), | ||
paddingInlineStart: em(22, 14), | ||
}, | ||
hr: { | ||
@@ -166,24 +188,37 @@ marginTop: em(40, 14), | ||
'thead th': { | ||
paddingRight: em(12, 12), | ||
paddingInlineEnd: em(12, 12), | ||
paddingBottom: em(8, 12), | ||
paddingLeft: em(12, 12), | ||
paddingInlineStart: em(12, 12), | ||
}, | ||
'thead th:first-child': { | ||
paddingLeft: '0', | ||
paddingInlineStart: '0', | ||
}, | ||
'thead th:last-child': { | ||
paddingRight: '0', | ||
paddingInlineEnd: '0', | ||
}, | ||
'tbody td, tfoot td': { | ||
paddingTop: em(8, 12), | ||
paddingRight: em(12, 12), | ||
paddingInlineEnd: em(12, 12), | ||
paddingBottom: em(8, 12), | ||
paddingLeft: em(12, 12), | ||
paddingInlineStart: em(12, 12), | ||
}, | ||
'tbody td:first-child, tfoot td:first-child': { | ||
paddingLeft: '0', | ||
paddingInlineStart: '0', | ||
}, | ||
'tbody td:last-child, tfoot td:last-child': { | ||
paddingRight: '0', | ||
paddingInlineEnd: '0', | ||
}, | ||
figure: { | ||
marginTop: em(24, 14), | ||
marginBottom: em(24, 14), | ||
}, | ||
'figure > *': { | ||
marginTop: '0', | ||
marginBottom: '0', | ||
}, | ||
figcaption: { | ||
fontSize: em(12, 14), | ||
lineHeight: round(16 / 12), | ||
marginTop: em(8, 12), | ||
}, | ||
}, | ||
@@ -218,3 +253,3 @@ { | ||
marginBottom: em(32, 20), | ||
paddingLeft: em(20, 20), | ||
paddingInlineStart: em(20, 20), | ||
}, | ||
@@ -248,18 +283,21 @@ h1: { | ||
}, | ||
video: { | ||
picture: { | ||
marginTop: em(32, 16), | ||
marginBottom: em(32, 16), | ||
}, | ||
figure: { | ||
'picture > img': { | ||
marginTop: '0', | ||
marginBottom: '0', | ||
}, | ||
video: { | ||
marginTop: em(32, 16), | ||
marginBottom: em(32, 16), | ||
}, | ||
'figure > *': { | ||
marginTop: '0', | ||
marginBottom: '0', | ||
}, | ||
figcaption: { | ||
kbd: { | ||
fontSize: em(14, 16), | ||
lineHeight: round(20 / 14), | ||
marginTop: em(12, 14), | ||
borderRadius: rem(5), | ||
paddingTop: em(3, 16), | ||
paddingInlineEnd: em(6, 16), | ||
paddingBottom: em(3, 16), | ||
paddingInlineStart: em(6, 16), | ||
}, | ||
@@ -282,5 +320,5 @@ code: { | ||
paddingTop: em(12, 14), | ||
paddingRight: em(16, 14), | ||
paddingInlineEnd: em(16, 14), | ||
paddingBottom: em(12, 14), | ||
paddingLeft: em(16, 14), | ||
paddingInlineStart: em(16, 14), | ||
}, | ||
@@ -290,3 +328,3 @@ ol: { | ||
marginBottom: em(20, 16), | ||
paddingLeft: em(26, 16), | ||
paddingInlineStart: em(26, 16), | ||
}, | ||
@@ -296,3 +334,3 @@ ul: { | ||
marginBottom: em(20, 16), | ||
paddingLeft: em(26, 16), | ||
paddingInlineStart: em(26, 16), | ||
}, | ||
@@ -304,6 +342,6 @@ li: { | ||
'ol > li': { | ||
paddingLeft: em(6, 16), | ||
paddingInlineStart: em(6, 16), | ||
}, | ||
'ul > li': { | ||
paddingLeft: em(6, 16), | ||
paddingInlineStart: em(6, 16), | ||
}, | ||
@@ -314,12 +352,12 @@ '> ul > li p': { | ||
}, | ||
'> ul > li > *:first-child': { | ||
'> ul > li > p:first-child': { | ||
marginTop: em(20, 16), | ||
}, | ||
'> ul > li > *:last-child': { | ||
'> ul > li > p:last-child': { | ||
marginBottom: em(20, 16), | ||
}, | ||
'> ol > li > *:first-child': { | ||
'> ol > li > p:first-child': { | ||
marginTop: em(20, 16), | ||
}, | ||
'> ol > li > *:last-child': { | ||
'> ol > li > p:last-child': { | ||
marginBottom: em(20, 16), | ||
@@ -331,2 +369,13 @@ }, | ||
}, | ||
dl: { | ||
marginTop: em(20, 16), | ||
marginBottom: em(20, 16), | ||
}, | ||
dt: { | ||
marginTop: em(20, 16), | ||
}, | ||
dd: { | ||
marginTop: em(8, 16), | ||
paddingInlineStart: em(26, 16), | ||
}, | ||
hr: { | ||
@@ -353,24 +402,37 @@ marginTop: em(48, 16), | ||
'thead th': { | ||
paddingRight: em(8, 14), | ||
paddingInlineEnd: em(8, 14), | ||
paddingBottom: em(8, 14), | ||
paddingLeft: em(8, 14), | ||
paddingInlineStart: em(8, 14), | ||
}, | ||
'thead th:first-child': { | ||
paddingLeft: '0', | ||
paddingInlineStart: '0', | ||
}, | ||
'thead th:last-child': { | ||
paddingRight: '0', | ||
paddingInlineEnd: '0', | ||
}, | ||
'tbody td, tfoot td': { | ||
paddingTop: em(8, 14), | ||
paddingRight: em(8, 14), | ||
paddingInlineEnd: em(8, 14), | ||
paddingBottom: em(8, 14), | ||
paddingLeft: em(8, 14), | ||
paddingInlineStart: em(8, 14), | ||
}, | ||
'tbody td:first-child, tfoot td:first-child': { | ||
paddingLeft: '0', | ||
paddingInlineStart: '0', | ||
}, | ||
'tbody td:last-child, tfoot td:last-child': { | ||
paddingRight: '0', | ||
paddingInlineEnd: '0', | ||
}, | ||
figure: { | ||
marginTop: em(32, 16), | ||
marginBottom: em(32, 16), | ||
}, | ||
'figure > *': { | ||
marginTop: '0', | ||
marginBottom: '0', | ||
}, | ||
figcaption: { | ||
fontSize: em(14, 16), | ||
lineHeight: round(20 / 14), | ||
marginTop: em(12, 14), | ||
}, | ||
}, | ||
@@ -405,3 +467,3 @@ { | ||
marginBottom: em(40, 24), | ||
paddingLeft: em(24, 24), | ||
paddingInlineStart: em(24, 24), | ||
}, | ||
@@ -435,18 +497,21 @@ h1: { | ||
}, | ||
video: { | ||
picture: { | ||
marginTop: em(32, 18), | ||
marginBottom: em(32, 18), | ||
}, | ||
figure: { | ||
'picture > img': { | ||
marginTop: '0', | ||
marginBottom: '0', | ||
}, | ||
video: { | ||
marginTop: em(32, 18), | ||
marginBottom: em(32, 18), | ||
}, | ||
'figure > *': { | ||
marginTop: '0', | ||
marginBottom: '0', | ||
}, | ||
figcaption: { | ||
kbd: { | ||
fontSize: em(16, 18), | ||
lineHeight: round(24 / 16), | ||
marginTop: em(16, 16), | ||
borderRadius: rem(5), | ||
paddingTop: em(4, 18), | ||
paddingInlineEnd: em(8, 18), | ||
paddingBottom: em(4, 18), | ||
paddingInlineStart: em(8, 18), | ||
}, | ||
@@ -469,5 +534,5 @@ code: { | ||
paddingTop: em(16, 16), | ||
paddingRight: em(24, 16), | ||
paddingInlineEnd: em(24, 16), | ||
paddingBottom: em(16, 16), | ||
paddingLeft: em(24, 16), | ||
paddingInlineStart: em(24, 16), | ||
}, | ||
@@ -477,3 +542,3 @@ ol: { | ||
marginBottom: em(24, 18), | ||
paddingLeft: em(28, 18), | ||
paddingInlineStart: em(28, 18), | ||
}, | ||
@@ -483,3 +548,3 @@ ul: { | ||
marginBottom: em(24, 18), | ||
paddingLeft: em(28, 18), | ||
paddingInlineStart: em(28, 18), | ||
}, | ||
@@ -491,6 +556,6 @@ li: { | ||
'ol > li': { | ||
paddingLeft: em(8, 18), | ||
paddingInlineStart: em(8, 18), | ||
}, | ||
'ul > li': { | ||
paddingLeft: em(8, 18), | ||
paddingInlineStart: em(8, 18), | ||
}, | ||
@@ -501,12 +566,12 @@ '> ul > li p': { | ||
}, | ||
'> ul > li > *:first-child': { | ||
'> ul > li > p:first-child': { | ||
marginTop: em(24, 18), | ||
}, | ||
'> ul > li > *:last-child': { | ||
'> ul > li > p:last-child': { | ||
marginBottom: em(24, 18), | ||
}, | ||
'> ol > li > *:first-child': { | ||
'> ol > li > p:first-child': { | ||
marginTop: em(24, 18), | ||
}, | ||
'> ol > li > *:last-child': { | ||
'> ol > li > p:last-child': { | ||
marginBottom: em(24, 18), | ||
@@ -518,2 +583,13 @@ }, | ||
}, | ||
dl: { | ||
marginTop: em(24, 18), | ||
marginBottom: em(24, 18), | ||
}, | ||
dt: { | ||
marginTop: em(24, 18), | ||
}, | ||
dd: { | ||
marginTop: em(12, 18), | ||
paddingInlineStart: em(28, 18), | ||
}, | ||
hr: { | ||
@@ -540,24 +616,37 @@ marginTop: em(56, 18), | ||
'thead th': { | ||
paddingRight: em(12, 16), | ||
paddingInlineEnd: em(12, 16), | ||
paddingBottom: em(12, 16), | ||
paddingLeft: em(12, 16), | ||
paddingInlineStart: em(12, 16), | ||
}, | ||
'thead th:first-child': { | ||
paddingLeft: '0', | ||
paddingInlineStart: '0', | ||
}, | ||
'thead th:last-child': { | ||
paddingRight: '0', | ||
paddingInlineEnd: '0', | ||
}, | ||
'tbody td, tfoot td': { | ||
paddingTop: em(12, 16), | ||
paddingRight: em(12, 16), | ||
paddingInlineEnd: em(12, 16), | ||
paddingBottom: em(12, 16), | ||
paddingLeft: em(12, 16), | ||
paddingInlineStart: em(12, 16), | ||
}, | ||
'tbody td:first-child, tfoot td:first-child': { | ||
paddingLeft: '0', | ||
paddingInlineStart: '0', | ||
}, | ||
'tbody td:last-child, tfoot td:last-child': { | ||
paddingRight: '0', | ||
paddingInlineEnd: '0', | ||
}, | ||
figure: { | ||
marginTop: em(32, 18), | ||
marginBottom: em(32, 18), | ||
}, | ||
'figure > *': { | ||
marginTop: '0', | ||
marginBottom: '0', | ||
}, | ||
figcaption: { | ||
fontSize: em(16, 18), | ||
lineHeight: round(24 / 16), | ||
marginTop: em(16, 16), | ||
}, | ||
}, | ||
@@ -592,3 +681,3 @@ { | ||
marginBottom: em(48, 30), | ||
paddingLeft: em(32, 30), | ||
paddingInlineStart: em(32, 30), | ||
}, | ||
@@ -622,18 +711,21 @@ h1: { | ||
}, | ||
video: { | ||
picture: { | ||
marginTop: em(40, 20), | ||
marginBottom: em(40, 20), | ||
}, | ||
figure: { | ||
'picture > img': { | ||
marginTop: '0', | ||
marginBottom: '0', | ||
}, | ||
video: { | ||
marginTop: em(40, 20), | ||
marginBottom: em(40, 20), | ||
}, | ||
'figure > *': { | ||
marginTop: '0', | ||
marginBottom: '0', | ||
}, | ||
figcaption: { | ||
kbd: { | ||
fontSize: em(18, 20), | ||
lineHeight: round(28 / 18), | ||
marginTop: em(18, 18), | ||
borderRadius: rem(5), | ||
paddingTop: em(5, 20), | ||
paddingInlineEnd: em(8, 20), | ||
paddingBottom: em(5, 20), | ||
paddingInlineStart: em(8, 20), | ||
}, | ||
@@ -656,5 +748,5 @@ code: { | ||
paddingTop: em(20, 18), | ||
paddingRight: em(24, 18), | ||
paddingInlineEnd: em(24, 18), | ||
paddingBottom: em(20, 18), | ||
paddingLeft: em(24, 18), | ||
paddingInlineStart: em(24, 18), | ||
}, | ||
@@ -664,3 +756,3 @@ ol: { | ||
marginBottom: em(24, 20), | ||
paddingLeft: em(32, 20), | ||
paddingInlineStart: em(32, 20), | ||
}, | ||
@@ -670,3 +762,3 @@ ul: { | ||
marginBottom: em(24, 20), | ||
paddingLeft: em(32, 20), | ||
paddingInlineStart: em(32, 20), | ||
}, | ||
@@ -678,6 +770,6 @@ li: { | ||
'ol > li': { | ||
paddingLeft: em(8, 20), | ||
paddingInlineStart: em(8, 20), | ||
}, | ||
'ul > li': { | ||
paddingLeft: em(8, 20), | ||
paddingInlineStart: em(8, 20), | ||
}, | ||
@@ -688,12 +780,12 @@ '> ul > li p': { | ||
}, | ||
'> ul > li > *:first-child': { | ||
'> ul > li > p:first-child': { | ||
marginTop: em(24, 20), | ||
}, | ||
'> ul > li > *:last-child': { | ||
'> ul > li > p:last-child': { | ||
marginBottom: em(24, 20), | ||
}, | ||
'> ol > li > *:first-child': { | ||
'> ol > li > p:first-child': { | ||
marginTop: em(24, 20), | ||
}, | ||
'> ol > li > *:last-child': { | ||
'> ol > li > p:last-child': { | ||
marginBottom: em(24, 20), | ||
@@ -705,2 +797,13 @@ }, | ||
}, | ||
dl: { | ||
marginTop: em(24, 20), | ||
marginBottom: em(24, 20), | ||
}, | ||
dt: { | ||
marginTop: em(24, 20), | ||
}, | ||
dd: { | ||
marginTop: em(12, 20), | ||
paddingInlineStart: em(32, 20), | ||
}, | ||
hr: { | ||
@@ -727,24 +830,37 @@ marginTop: em(56, 20), | ||
'thead th': { | ||
paddingRight: em(12, 18), | ||
paddingInlineEnd: em(12, 18), | ||
paddingBottom: em(16, 18), | ||
paddingLeft: em(12, 18), | ||
paddingInlineStart: em(12, 18), | ||
}, | ||
'thead th:first-child': { | ||
paddingLeft: '0', | ||
paddingInlineStart: '0', | ||
}, | ||
'thead th:last-child': { | ||
paddingRight: '0', | ||
paddingInlineEnd: '0', | ||
}, | ||
'tbody td, tfoot td': { | ||
paddingTop: em(16, 18), | ||
paddingRight: em(12, 18), | ||
paddingInlineEnd: em(12, 18), | ||
paddingBottom: em(16, 18), | ||
paddingLeft: em(12, 18), | ||
paddingInlineStart: em(12, 18), | ||
}, | ||
'tbody td:first-child, tfoot td:first-child': { | ||
paddingLeft: '0', | ||
paddingInlineStart: '0', | ||
}, | ||
'tbody td:last-child, tfoot td:last-child': { | ||
paddingRight: '0', | ||
paddingInlineEnd: '0', | ||
}, | ||
figure: { | ||
marginTop: em(40, 20), | ||
marginBottom: em(40, 20), | ||
}, | ||
'figure > *': { | ||
marginTop: '0', | ||
marginBottom: '0', | ||
}, | ||
figcaption: { | ||
fontSize: em(18, 20), | ||
lineHeight: round(28 / 18), | ||
marginTop: em(18, 18), | ||
}, | ||
}, | ||
@@ -779,3 +895,3 @@ { | ||
marginBottom: em(64, 36), | ||
paddingLeft: em(40, 36), | ||
paddingInlineStart: em(40, 36), | ||
}, | ||
@@ -809,18 +925,21 @@ h1: { | ||
}, | ||
video: { | ||
picture: { | ||
marginTop: em(48, 24), | ||
marginBottom: em(48, 24), | ||
}, | ||
figure: { | ||
'picture > img': { | ||
marginTop: '0', | ||
marginBottom: '0', | ||
}, | ||
video: { | ||
marginTop: em(48, 24), | ||
marginBottom: em(48, 24), | ||
}, | ||
'figure > *': { | ||
marginTop: '0', | ||
marginBottom: '0', | ||
}, | ||
figcaption: { | ||
kbd: { | ||
fontSize: em(20, 24), | ||
lineHeight: round(32 / 20), | ||
marginTop: em(20, 20), | ||
borderRadius: rem(6), | ||
paddingTop: em(6, 24), | ||
paddingInlineEnd: em(8, 24), | ||
paddingBottom: em(6, 24), | ||
paddingInlineStart: em(8, 24), | ||
}, | ||
@@ -843,5 +962,5 @@ code: { | ||
paddingTop: em(24, 20), | ||
paddingRight: em(32, 20), | ||
paddingInlineEnd: em(32, 20), | ||
paddingBottom: em(24, 20), | ||
paddingLeft: em(32, 20), | ||
paddingInlineStart: em(32, 20), | ||
}, | ||
@@ -851,3 +970,3 @@ ol: { | ||
marginBottom: em(32, 24), | ||
paddingLeft: em(38, 24), | ||
paddingInlineStart: em(38, 24), | ||
}, | ||
@@ -857,3 +976,3 @@ ul: { | ||
marginBottom: em(32, 24), | ||
paddingLeft: em(38, 24), | ||
paddingInlineStart: em(38, 24), | ||
}, | ||
@@ -865,6 +984,6 @@ li: { | ||
'ol > li': { | ||
paddingLeft: em(10, 24), | ||
paddingInlineStart: em(10, 24), | ||
}, | ||
'ul > li': { | ||
paddingLeft: em(10, 24), | ||
paddingInlineStart: em(10, 24), | ||
}, | ||
@@ -875,12 +994,12 @@ '> ul > li p': { | ||
}, | ||
'> ul > li > *:first-child': { | ||
'> ul > li > p:first-child': { | ||
marginTop: em(32, 24), | ||
}, | ||
'> ul > li > *:last-child': { | ||
'> ul > li > p:last-child': { | ||
marginBottom: em(32, 24), | ||
}, | ||
'> ol > li > *:first-child': { | ||
'> ol > li > p:first-child': { | ||
marginTop: em(32, 24), | ||
}, | ||
'> ol > li > *:last-child': { | ||
'> ol > li > p:last-child': { | ||
marginBottom: em(32, 24), | ||
@@ -892,2 +1011,13 @@ }, | ||
}, | ||
dl: { | ||
marginTop: em(32, 24), | ||
marginBottom: em(32, 24), | ||
}, | ||
dt: { | ||
marginTop: em(32, 24), | ||
}, | ||
dd: { | ||
marginTop: em(12, 24), | ||
paddingInlineStart: em(38, 24), | ||
}, | ||
hr: { | ||
@@ -914,24 +1044,37 @@ marginTop: em(72, 24), | ||
'thead th': { | ||
paddingRight: em(12, 20), | ||
paddingInlineEnd: em(12, 20), | ||
paddingBottom: em(16, 20), | ||
paddingLeft: em(12, 20), | ||
paddingInlineStart: em(12, 20), | ||
}, | ||
'thead th:first-child': { | ||
paddingLeft: '0', | ||
paddingInlineStart: '0', | ||
}, | ||
'thead th:last-child': { | ||
paddingRight: '0', | ||
paddingInlineEnd: '0', | ||
}, | ||
'tbody td, tfoot td': { | ||
paddingTop: em(16, 20), | ||
paddingRight: em(12, 20), | ||
paddingInlineEnd: em(12, 20), | ||
paddingBottom: em(16, 20), | ||
paddingLeft: em(12, 20), | ||
paddingInlineStart: em(12, 20), | ||
}, | ||
'tbody td:first-child, tfoot td:first-child': { | ||
paddingLeft: '0', | ||
paddingInlineStart: '0', | ||
}, | ||
'tbody td:last-child, tfoot td:last-child': { | ||
paddingRight: '0', | ||
paddingInlineEnd: '0', | ||
}, | ||
figure: { | ||
marginTop: em(48, 24), | ||
marginBottom: em(48, 24), | ||
}, | ||
'figure > *': { | ||
marginTop: '0', | ||
marginBottom: '0', | ||
}, | ||
figcaption: { | ||
fontSize: em(20, 24), | ||
lineHeight: round(32 / 20), | ||
marginTop: em(20, 20), | ||
}, | ||
}, | ||
@@ -949,24 +1092,2 @@ { | ||
// Invert (for dark mode) | ||
invert: { | ||
css: { | ||
'--tw-prose-body': 'var(--tw-prose-invert-body)', | ||
'--tw-prose-headings': 'var(--tw-prose-invert-headings)', | ||
'--tw-prose-lead': 'var(--tw-prose-invert-lead)', | ||
'--tw-prose-links': 'var(--tw-prose-invert-links)', | ||
'--tw-prose-bold': 'var(--tw-prose-invert-bold)', | ||
'--tw-prose-counters': 'var(--tw-prose-invert-counters)', | ||
'--tw-prose-bullets': 'var(--tw-prose-invert-bullets)', | ||
'--tw-prose-hr': 'var(--tw-prose-invert-hr)', | ||
'--tw-prose-quotes': 'var(--tw-prose-invert-quotes)', | ||
'--tw-prose-quote-borders': 'var(--tw-prose-invert-quote-borders)', | ||
'--tw-prose-captions': 'var(--tw-prose-invert-captions)', | ||
'--tw-prose-code': 'var(--tw-prose-invert-code)', | ||
'--tw-prose-pre-code': 'var(--tw-prose-invert-pre-code)', | ||
'--tw-prose-pre-bg': 'var(--tw-prose-invert-pre-bg)', | ||
'--tw-prose-th-borders': 'var(--tw-prose-invert-th-borders)', | ||
'--tw-prose-td-borders': 'var(--tw-prose-invert-td-borders)', | ||
}, | ||
}, | ||
// Gray color themes | ||
@@ -987,2 +1108,4 @@ | ||
'--tw-prose-captions': colors.slate[500], | ||
'--tw-prose-kbd': colors.slate[900], | ||
'--tw-prose-kbd-shadows': hexToRgb(colors.slate[900]), | ||
'--tw-prose-code': colors.slate[900], | ||
@@ -1004,2 +1127,4 @@ '--tw-prose-pre-code': colors.slate[200], | ||
'--tw-prose-invert-captions': colors.slate[400], | ||
'--tw-prose-invert-kbd': colors.white, | ||
'--tw-prose-invert-kbd-shadows': hexToRgb(colors.white), | ||
'--tw-prose-invert-code': colors.white, | ||
@@ -1026,2 +1151,4 @@ '--tw-prose-invert-pre-code': colors.slate[300], | ||
'--tw-prose-captions': colors.gray[500], | ||
'--tw-prose-kbd': colors.gray[900], | ||
'--tw-prose-kbd-shadows': hexToRgb(colors.gray[900]), | ||
'--tw-prose-code': colors.gray[900], | ||
@@ -1043,2 +1170,4 @@ '--tw-prose-pre-code': colors.gray[200], | ||
'--tw-prose-invert-captions': colors.gray[400], | ||
'--tw-prose-invert-kbd': colors.white, | ||
'--tw-prose-invert-kbd-shadows': hexToRgb(colors.white), | ||
'--tw-prose-invert-code': colors.white, | ||
@@ -1065,2 +1194,4 @@ '--tw-prose-invert-pre-code': colors.gray[300], | ||
'--tw-prose-captions': colors.zinc[500], | ||
'--tw-prose-kbd': colors.zinc[900], | ||
'--tw-prose-kbd-shadows': hexToRgb(colors.zinc[900]), | ||
'--tw-prose-code': colors.zinc[900], | ||
@@ -1082,2 +1213,4 @@ '--tw-prose-pre-code': colors.zinc[200], | ||
'--tw-prose-invert-captions': colors.zinc[400], | ||
'--tw-prose-invert-kbd': colors.white, | ||
'--tw-prose-invert-kbd-shadows': hexToRgb(colors.white), | ||
'--tw-prose-invert-code': colors.white, | ||
@@ -1104,2 +1237,4 @@ '--tw-prose-invert-pre-code': colors.zinc[300], | ||
'--tw-prose-captions': colors.neutral[500], | ||
'--tw-prose-kbd': colors.neutral[900], | ||
'--tw-prose-kbd-shadows': hexToRgb(colors.neutral[900]), | ||
'--tw-prose-code': colors.neutral[900], | ||
@@ -1121,2 +1256,4 @@ '--tw-prose-pre-code': colors.neutral[200], | ||
'--tw-prose-invert-captions': colors.neutral[400], | ||
'--tw-prose-invert-kbd': colors.white, | ||
'--tw-prose-invert-kbd-shadows': hexToRgb(colors.white), | ||
'--tw-prose-invert-code': colors.white, | ||
@@ -1143,2 +1280,4 @@ '--tw-prose-invert-pre-code': colors.neutral[300], | ||
'--tw-prose-captions': colors.stone[500], | ||
'--tw-prose-kbd': colors.stone[900], | ||
'--tw-prose-kbd-shadows': hexToRgb(colors.stone[900]), | ||
'--tw-prose-code': colors.stone[900], | ||
@@ -1160,2 +1299,4 @@ '--tw-prose-pre-code': colors.stone[200], | ||
'--tw-prose-invert-captions': colors.stone[400], | ||
'--tw-prose-invert-kbd': colors.white, | ||
'--tw-prose-invert-kbd-shadows': hexToRgb(colors.white), | ||
'--tw-prose-invert-code': colors.white, | ||
@@ -1289,2 +1430,26 @@ '--tw-prose-invert-pre-code': colors.stone[300], | ||
}, | ||
// Invert (for dark mode) | ||
invert: { | ||
css: { | ||
'--tw-prose-body': 'var(--tw-prose-invert-body)', | ||
'--tw-prose-headings': 'var(--tw-prose-invert-headings)', | ||
'--tw-prose-lead': 'var(--tw-prose-invert-lead)', | ||
'--tw-prose-links': 'var(--tw-prose-invert-links)', | ||
'--tw-prose-bold': 'var(--tw-prose-invert-bold)', | ||
'--tw-prose-counters': 'var(--tw-prose-invert-counters)', | ||
'--tw-prose-bullets': 'var(--tw-prose-invert-bullets)', | ||
'--tw-prose-hr': 'var(--tw-prose-invert-hr)', | ||
'--tw-prose-quotes': 'var(--tw-prose-invert-quotes)', | ||
'--tw-prose-quote-borders': 'var(--tw-prose-invert-quote-borders)', | ||
'--tw-prose-captions': 'var(--tw-prose-invert-captions)', | ||
'--tw-prose-kbd': 'var(--tw-prose-invert-kbd)', | ||
'--tw-prose-kbd-shadows': 'var(--tw-prose-invert-kbd-shadows)', | ||
'--tw-prose-code': 'var(--tw-prose-invert-code)', | ||
'--tw-prose-pre-code': 'var(--tw-prose-invert-pre-code)', | ||
'--tw-prose-pre-bg': 'var(--tw-prose-invert-pre-bg)', | ||
'--tw-prose-th-borders': 'var(--tw-prose-invert-th-borders)', | ||
'--tw-prose-td-borders': 'var(--tw-prose-invert-td-borders)', | ||
}, | ||
}, | ||
} | ||
@@ -1298,2 +1463,3 @@ | ||
maxWidth: '65ch', | ||
p: {}, // Required to maintain correct order when merging | ||
'[class~="lead"]': { | ||
@@ -1311,2 +1477,11 @@ color: 'var(--tw-prose-lead)', | ||
}, | ||
'a strong': { | ||
color: 'inherit', | ||
}, | ||
'blockquote strong': { | ||
color: 'inherit', | ||
}, | ||
'thead th strong': { | ||
color: 'inherit', | ||
}, | ||
ol: { | ||
@@ -1352,2 +1527,6 @@ listStyleType: 'decimal', | ||
}, | ||
dt: { | ||
color: 'var(--tw-prose-headings)', | ||
fontWeight: '600', | ||
}, | ||
hr: { | ||
@@ -1361,4 +1540,4 @@ borderColor: 'var(--tw-prose-hr)', | ||
color: 'var(--tw-prose-quotes)', | ||
borderLeftWidth: '0.25rem', | ||
borderLeftColor: 'var(--tw-prose-quote-borders)', | ||
borderInlineStartWidth: '0.25rem', | ||
borderInlineStartColor: 'var(--tw-prose-quote-borders)', | ||
quotes: '"\\201C""\\201D""\\2018""\\2019"', | ||
@@ -1378,2 +1557,3 @@ }, | ||
fontWeight: '900', | ||
color: 'inherit', | ||
}, | ||
@@ -1386,2 +1566,3 @@ h2: { | ||
fontWeight: '800', | ||
color: 'inherit', | ||
}, | ||
@@ -1394,2 +1575,3 @@ h3: { | ||
fontWeight: '700', | ||
color: 'inherit', | ||
}, | ||
@@ -1402,8 +1584,16 @@ h4: { | ||
fontWeight: '700', | ||
color: 'inherit', | ||
}, | ||
// TODO: Figure out how to not need this, it's a merging issue | ||
'figure > *': {}, | ||
figcaption: { | ||
color: 'var(--tw-prose-captions)', | ||
img: {}, // Required to maintain correct order when merging | ||
picture: { | ||
display: 'block', | ||
}, | ||
video: {}, // Required to maintain correct order when merging | ||
kbd: { | ||
fontWeight: '500', | ||
fontFamily: 'inherit', | ||
color: 'var(--tw-prose-kbd)', | ||
boxShadow: | ||
'0 0 0 1px rgb(var(--tw-prose-kbd-shadows) / 10%), 0 3px 0 rgb(var(--tw-prose-kbd-shadows) / 10%)', | ||
}, | ||
code: { | ||
@@ -1420,4 +1610,22 @@ color: 'var(--tw-prose-code)', | ||
'a code': { | ||
color: 'var(--tw-prose-links)', | ||
color: 'inherit', | ||
}, | ||
'h1 code': { | ||
color: 'inherit', | ||
}, | ||
'h2 code': { | ||
color: 'inherit', | ||
}, | ||
'h3 code': { | ||
color: 'inherit', | ||
}, | ||
'h4 code': { | ||
color: 'inherit', | ||
}, | ||
'blockquote code': { | ||
color: 'inherit', | ||
}, | ||
'thead th code': { | ||
color: 'inherit', | ||
}, | ||
pre: { | ||
@@ -1449,3 +1657,2 @@ color: 'var(--tw-prose-pre-code)', | ||
tableLayout: 'auto', | ||
textAlign: 'left', | ||
marginTop: em(32, 16), | ||
@@ -1480,2 +1687,9 @@ marginBottom: em(32, 16), | ||
}, | ||
'th, td': { | ||
textAlign: 'start', | ||
}, | ||
'figure > *': {}, // Required to maintain correct order when merging | ||
figcaption: { | ||
color: 'var(--tw-prose-captions)', | ||
}, | ||
}, | ||
@@ -1482,0 +1696,0 @@ defaultModifiers.gray.css, |
const isPlainObject = require('lodash.isplainobject') | ||
const parser = require('postcss-selector-parser') | ||
const parseSelector = parser() | ||
module.exports = { | ||
@@ -7,2 +10,54 @@ isUsableColor(color, values) { | ||
}, | ||
/** | ||
* @param {string} selector | ||
*/ | ||
commonTrailingPseudos(selector) { | ||
let ast = parseSelector.astSync(selector) | ||
/** @type {import('postcss-selector-parser').Pseudo[][]} */ | ||
let matrix = [] | ||
// Put the pseudo elements in reverse order in a sparse, column-major 2D array | ||
for (let [i, sel] of ast.nodes.entries()) { | ||
for (const [j, child] of [...sel.nodes].reverse().entries()) { | ||
// We only care about pseudo elements | ||
if (child.type !== 'pseudo' || !child.value.startsWith('::')) { | ||
break | ||
} | ||
matrix[j] = matrix[j] || [] | ||
matrix[j][i] = child | ||
} | ||
} | ||
let trailingPseudos = parser.selector() | ||
// At this point the pseudo elements are in a column-major 2D array | ||
// This means each row contains one "column" of pseudo elements from each selector | ||
// We can compare all the pseudo elements in a row to see if they are the same | ||
for (const pseudos of matrix) { | ||
// It's a sparse 2D array so there are going to be holes in the rows | ||
// We skip those | ||
if (!pseudos) { | ||
continue | ||
} | ||
let values = new Set(pseudos.map((p) => p.value)) | ||
// The pseudo elements are not the same | ||
if (values.size > 1) { | ||
break | ||
} | ||
pseudos.forEach((pseudo) => pseudo.remove()) | ||
trailingPseudos.prepend(pseudos[0]) | ||
} | ||
if (trailingPseudos.nodes.length) { | ||
return [trailingPseudos.toString(), ast.toString()] | ||
} | ||
return [null, selector] | ||
}, | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
110157
3158
399
0
5
+ Addedpostcss-selector-parser@6.0.10(transitive)
+ Addedtailwindcss@4.0.0-beta.8(transitive)
- Removed@alloc/quick-lru@5.2.0(transitive)
- Removed@isaacs/cliui@8.0.2(transitive)
- Removed@jridgewell/gen-mapping@0.3.8(transitive)
- Removed@jridgewell/resolve-uri@3.1.2(transitive)
- Removed@jridgewell/set-array@1.2.1(transitive)
- Removed@jridgewell/sourcemap-codec@1.5.0(transitive)
- Removed@jridgewell/trace-mapping@0.3.25(transitive)
- Removed@nodelib/fs.scandir@2.1.5(transitive)
- Removed@nodelib/fs.stat@2.0.5(transitive)
- Removed@nodelib/fs.walk@1.2.8(transitive)
- Removed@pkgjs/parseargs@0.11.0(transitive)
- Removedansi-regex@5.0.16.1.0(transitive)
- Removedansi-styles@4.3.06.2.1(transitive)
- Removedany-promise@1.3.0(transitive)
- Removedanymatch@3.1.3(transitive)
- Removedarg@5.0.2(transitive)
- Removedbalanced-match@1.0.2(transitive)
- Removedbinary-extensions@2.3.0(transitive)
- Removedbrace-expansion@2.0.1(transitive)
- Removedbraces@3.0.3(transitive)
- Removedcamelcase-css@2.0.1(transitive)
- Removedchokidar@3.6.0(transitive)
- Removedcolor-convert@2.0.1(transitive)
- Removedcolor-name@1.1.4(transitive)
- Removedcommander@4.1.1(transitive)
- Removedcross-spawn@7.0.6(transitive)
- Removeddidyoumean@1.2.2(transitive)
- Removeddlv@1.1.3(transitive)
- Removedeastasianwidth@0.2.0(transitive)
- Removedemoji-regex@8.0.09.2.2(transitive)
- Removedfast-glob@3.3.2(transitive)
- Removedfastq@1.18.0(transitive)
- Removedfill-range@7.1.1(transitive)
- Removedforeground-child@3.3.0(transitive)
- Removedfsevents@2.3.3(transitive)
- Removedfunction-bind@1.1.2(transitive)
- Removedglob@10.4.5(transitive)
- Removedglob-parent@5.1.26.0.2(transitive)
- Removedhasown@2.0.2(transitive)
- Removedis-binary-path@2.1.0(transitive)
- Removedis-core-module@2.16.1(transitive)
- Removedis-extglob@2.1.1(transitive)
- Removedis-fullwidth-code-point@3.0.0(transitive)
- Removedis-glob@4.0.3(transitive)
- Removedis-number@7.0.0(transitive)
- Removedisexe@2.0.0(transitive)
- Removedjackspeak@3.4.3(transitive)
- Removedjiti@1.21.7(transitive)
- Removedlilconfig@3.1.3(transitive)
- Removedlines-and-columns@1.2.4(transitive)
- Removedlru-cache@10.4.3(transitive)
- Removedmerge2@1.4.1(transitive)
- Removedmicromatch@4.0.8(transitive)
- Removedminimatch@9.0.5(transitive)
- Removedminipass@7.1.2(transitive)
- Removedmz@2.7.0(transitive)
- Removednanoid@3.3.8(transitive)
- Removednormalize-path@3.0.0(transitive)
- Removedobject-assign@4.1.1(transitive)
- Removedobject-hash@3.0.0(transitive)
- Removedpackage-json-from-dist@1.0.1(transitive)
- Removedpath-key@3.1.1(transitive)
- Removedpath-parse@1.0.7(transitive)
- Removedpath-scurry@1.11.1(transitive)
- Removedpicocolors@1.1.1(transitive)
- Removedpicomatch@2.3.1(transitive)
- Removedpify@2.3.0(transitive)
- Removedpirates@4.0.6(transitive)
- Removedpostcss@8.4.49(transitive)
- Removedpostcss-import@15.1.0(transitive)
- Removedpostcss-js@4.0.1(transitive)
- Removedpostcss-load-config@4.0.2(transitive)
- Removedpostcss-nested@6.2.0(transitive)
- Removedpostcss-selector-parser@6.1.2(transitive)
- Removedpostcss-value-parser@4.2.0(transitive)
- Removedqueue-microtask@1.2.3(transitive)
- Removedread-cache@1.0.0(transitive)
- Removedreaddirp@3.6.0(transitive)
- Removedresolve@1.22.10(transitive)
- Removedreusify@1.0.4(transitive)
- Removedrun-parallel@1.2.0(transitive)
- Removedshebang-command@2.0.0(transitive)
- Removedshebang-regex@3.0.0(transitive)
- Removedsignal-exit@4.1.0(transitive)
- Removedsource-map-js@1.2.1(transitive)
- Removedstring-width@4.2.35.1.2(transitive)
- Removedstrip-ansi@6.0.17.1.0(transitive)
- Removedsucrase@3.35.0(transitive)
- Removedsupports-preserve-symlinks-flag@1.0.0(transitive)
- Removedtailwindcss@3.4.17(transitive)
- Removedthenify@3.3.1(transitive)
- Removedthenify-all@1.6.0(transitive)
- Removedto-regex-range@5.0.1(transitive)
- Removedts-interface-checker@0.1.13(transitive)
- Removedwhich@2.0.2(transitive)
- Removedwrap-ansi@7.0.08.1.0(transitive)
- Removedyaml@2.6.1(transitive)