FIN INIT
This commit is contained in:
21
node_modules/@tailwindcss/typography/LICENSE
generated
vendored
Normal file
21
node_modules/@tailwindcss/typography/LICENSE
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Tailwind Labs, Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
398
node_modules/@tailwindcss/typography/README.md
generated
vendored
Normal file
398
node_modules/@tailwindcss/typography/README.md
generated
vendored
Normal file
@ -0,0 +1,398 @@
|
||||
<p>
|
||||
<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>
|
||||
</p>
|
||||
|
||||
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.
|
||||
|
||||
---
|
||||
|
||||
## Installation
|
||||
|
||||
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
|
||||
|
||||
For help, discussion about best practices, or any other conversation that would benefit from being searchable:
|
||||
|
||||
[Discuss the Tailwind CSS Typography plugin on GitHub](https://github.com/tailwindlabs/tailwindcss/discussions)
|
||||
|
||||
For casual chit-chat with others using the framework:
|
||||
|
||||
[Join the Tailwind CSS Discord Server](https://tailwindcss.com/discord)
|
873
node_modules/@tailwindcss/typography/node_modules/postcss-selector-parser/API.md
generated
vendored
Normal file
873
node_modules/@tailwindcss/typography/node_modules/postcss-selector-parser/API.md
generated
vendored
Normal file
@ -0,0 +1,873 @@
|
||||
# API Documentation
|
||||
|
||||
*Please use only this documented API when working with the parser. Methods
|
||||
not documented here are subject to change at any point.*
|
||||
|
||||
## `parser` function
|
||||
|
||||
This is the module's main entry point.
|
||||
|
||||
```js
|
||||
const parser = require('postcss-selector-parser');
|
||||
```
|
||||
|
||||
### `parser([transform], [options])`
|
||||
|
||||
Creates a new `processor` instance
|
||||
|
||||
```js
|
||||
const processor = parser();
|
||||
```
|
||||
|
||||
Or, with optional transform function
|
||||
|
||||
```js
|
||||
const transform = selectors => {
|
||||
selectors.walkUniversals(selector => {
|
||||
selector.remove();
|
||||
});
|
||||
};
|
||||
|
||||
const processor = parser(transform)
|
||||
|
||||
// Example
|
||||
const result = processor.processSync('*.class');
|
||||
// => .class
|
||||
```
|
||||
|
||||
[See processor documentation](#processor)
|
||||
|
||||
Arguments:
|
||||
|
||||
* `transform (function)`: Provide a function to work with the parsed AST.
|
||||
* `options (object)`: Provide default options for all calls on the returned `Processor`.
|
||||
|
||||
### `parser.attribute([props])`
|
||||
|
||||
Creates a new attribute selector.
|
||||
|
||||
```js
|
||||
parser.attribute({attribute: 'href'});
|
||||
// => [href]
|
||||
```
|
||||
|
||||
Arguments:
|
||||
|
||||
* `props (object)`: The new node's properties.
|
||||
|
||||
### `parser.className([props])`
|
||||
|
||||
Creates a new class selector.
|
||||
|
||||
```js
|
||||
parser.className({value: 'button'});
|
||||
// => .button
|
||||
```
|
||||
|
||||
Arguments:
|
||||
|
||||
* `props (object)`: The new node's properties.
|
||||
|
||||
### `parser.combinator([props])`
|
||||
|
||||
Creates a new selector combinator.
|
||||
|
||||
```js
|
||||
parser.combinator({value: '+'});
|
||||
// => +
|
||||
```
|
||||
|
||||
Arguments:
|
||||
|
||||
* `props (object)`: The new node's properties.
|
||||
|
||||
Notes:
|
||||
* **Descendant Combinators** The value of descendant combinators created by the
|
||||
parser always just a single space (`" "`). For descendant selectors with no
|
||||
comments, additional space is now stored in `node.spaces.before`. Depending
|
||||
on the location of comments, additional spaces may be stored in
|
||||
`node.raws.spaces.before`, `node.raws.spaces.after`, or `node.raws.value`.
|
||||
* **Named Combinators** Although, nonstandard and unlikely to ever become a standard,
|
||||
named combinators like `/deep/` and `/for/` are parsed as combinators. The
|
||||
`node.value` is name after being unescaped and normalized as lowercase. The
|
||||
original value for the combinator name is stored in `node.raws.value`.
|
||||
|
||||
|
||||
### `parser.comment([props])`
|
||||
|
||||
Creates a new comment.
|
||||
|
||||
```js
|
||||
parser.comment({value: '/* Affirmative, Dave. I read you. */'});
|
||||
// => /* Affirmative, Dave. I read you. */
|
||||
```
|
||||
|
||||
Arguments:
|
||||
|
||||
* `props (object)`: The new node's properties.
|
||||
|
||||
### `parser.id([props])`
|
||||
|
||||
Creates a new id selector.
|
||||
|
||||
```js
|
||||
parser.id({value: 'search'});
|
||||
// => #search
|
||||
```
|
||||
|
||||
Arguments:
|
||||
|
||||
* `props (object)`: The new node's properties.
|
||||
|
||||
### `parser.nesting([props])`
|
||||
|
||||
Creates a new nesting selector.
|
||||
|
||||
```js
|
||||
parser.nesting();
|
||||
// => &
|
||||
```
|
||||
|
||||
Arguments:
|
||||
|
||||
* `props (object)`: The new node's properties.
|
||||
|
||||
### `parser.pseudo([props])`
|
||||
|
||||
Creates a new pseudo selector.
|
||||
|
||||
```js
|
||||
parser.pseudo({value: '::before'});
|
||||
// => ::before
|
||||
```
|
||||
|
||||
Arguments:
|
||||
|
||||
* `props (object)`: The new node's properties.
|
||||
|
||||
### `parser.root([props])`
|
||||
|
||||
Creates a new root node.
|
||||
|
||||
```js
|
||||
parser.root();
|
||||
// => (empty)
|
||||
```
|
||||
|
||||
Arguments:
|
||||
|
||||
* `props (object)`: The new node's properties.
|
||||
|
||||
### `parser.selector([props])`
|
||||
|
||||
Creates a new selector node.
|
||||
|
||||
```js
|
||||
parser.selector();
|
||||
// => (empty)
|
||||
```
|
||||
|
||||
Arguments:
|
||||
|
||||
* `props (object)`: The new node's properties.
|
||||
|
||||
### `parser.string([props])`
|
||||
|
||||
Creates a new string node.
|
||||
|
||||
```js
|
||||
parser.string();
|
||||
// => (empty)
|
||||
```
|
||||
|
||||
Arguments:
|
||||
|
||||
* `props (object)`: The new node's properties.
|
||||
|
||||
### `parser.tag([props])`
|
||||
|
||||
Creates a new tag selector.
|
||||
|
||||
```js
|
||||
parser.tag({value: 'button'});
|
||||
// => button
|
||||
```
|
||||
|
||||
Arguments:
|
||||
|
||||
* `props (object)`: The new node's properties.
|
||||
|
||||
### `parser.universal([props])`
|
||||
|
||||
Creates a new universal selector.
|
||||
|
||||
```js
|
||||
parser.universal();
|
||||
// => *
|
||||
```
|
||||
|
||||
Arguments:
|
||||
|
||||
* `props (object)`: The new node's properties.
|
||||
|
||||
## Node types
|
||||
|
||||
### `node.type`
|
||||
|
||||
A string representation of the selector type. It can be one of the following;
|
||||
`attribute`, `class`, `combinator`, `comment`, `id`, `nesting`, `pseudo`,
|
||||
`root`, `selector`, `string`, `tag`, or `universal`. Note that for convenience,
|
||||
these constants are exposed on the main `parser` as uppercased keys. So for
|
||||
example you can get `id` by querying `parser.ID`.
|
||||
|
||||
```js
|
||||
parser.attribute({attribute: 'href'}).type;
|
||||
// => 'attribute'
|
||||
```
|
||||
|
||||
### `node.parent`
|
||||
|
||||
Returns the parent node.
|
||||
|
||||
```js
|
||||
root.nodes[0].parent === root;
|
||||
```
|
||||
|
||||
### `node.toString()`, `String(node)`, or `'' + node`
|
||||
|
||||
Returns a string representation of the node.
|
||||
|
||||
```js
|
||||
const id = parser.id({value: 'search'});
|
||||
console.log(String(id));
|
||||
// => #search
|
||||
```
|
||||
|
||||
### `node.next()` & `node.prev()`
|
||||
|
||||
Returns the next/previous child of the parent node.
|
||||
|
||||
```js
|
||||
const next = id.next();
|
||||
if (next && next.type !== 'combinator') {
|
||||
throw new Error('Qualified IDs are not allowed!');
|
||||
}
|
||||
```
|
||||
|
||||
### `node.replaceWith(node)`
|
||||
|
||||
Replace a node with another.
|
||||
|
||||
```js
|
||||
const attr = selectors.first.first;
|
||||
const className = parser.className({value: 'test'});
|
||||
attr.replaceWith(className);
|
||||
```
|
||||
|
||||
Arguments:
|
||||
|
||||
* `node`: The node to substitute the original with.
|
||||
|
||||
### `node.remove()`
|
||||
|
||||
Removes the node from its parent node.
|
||||
|
||||
```js
|
||||
if (node.type === 'id') {
|
||||
node.remove();
|
||||
}
|
||||
```
|
||||
|
||||
### `node.clone()`
|
||||
|
||||
Returns a copy of a node, detached from any parent containers that the
|
||||
original might have had.
|
||||
|
||||
```js
|
||||
const cloned = parser.id({value: 'search'});
|
||||
String(cloned);
|
||||
|
||||
// => #search
|
||||
```
|
||||
|
||||
### `node.isAtPosition(line, column)`
|
||||
|
||||
Return a `boolean` indicating whether this node includes the character at the
|
||||
position of the given line and column. Returns `undefined` if the nodes lack
|
||||
sufficient source metadata to determine the position.
|
||||
|
||||
Arguments:
|
||||
|
||||
* `line`: 1-index based line number relative to the start of the selector.
|
||||
* `column`: 1-index based column number relative to the start of the selector.
|
||||
|
||||
### `node.spaces`
|
||||
|
||||
Extra whitespaces around the node will be moved into `node.spaces.before` and
|
||||
`node.spaces.after`. So for example, these spaces will be moved as they have
|
||||
no semantic meaning:
|
||||
|
||||
```css
|
||||
h1 , h2 {}
|
||||
```
|
||||
|
||||
For descendent selectors, the value is always a single space.
|
||||
|
||||
```css
|
||||
h1 h2 {}
|
||||
```
|
||||
|
||||
Additional whitespace is found in either the `node.spaces.before` and `node.spaces.after` depending on the presence of comments or other whitespace characters. If the actual whitespace does not start or end with a single space, the node's raw value is set to the actual space(s) found in the source.
|
||||
|
||||
### `node.source`
|
||||
|
||||
An object describing the node's start/end, line/column source position.
|
||||
|
||||
Within the following CSS, the `.bar` class node ...
|
||||
|
||||
```css
|
||||
.foo,
|
||||
.bar {}
|
||||
```
|
||||
|
||||
... will contain the following `source` object.
|
||||
|
||||
```js
|
||||
source: {
|
||||
start: {
|
||||
line: 2,
|
||||
column: 3
|
||||
},
|
||||
end: {
|
||||
line: 2,
|
||||
column: 6
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### `node.sourceIndex`
|
||||
|
||||
The zero-based index of the node within the original source string.
|
||||
|
||||
Within the following CSS, the `.baz` class node will have a `sourceIndex` of `12`.
|
||||
|
||||
```css
|
||||
.foo, .bar, .baz {}
|
||||
```
|
||||
|
||||
## Container types
|
||||
|
||||
The `root`, `selector`, and `pseudo` nodes have some helper methods for working
|
||||
with their children.
|
||||
|
||||
### `container.nodes`
|
||||
|
||||
An array of the container's children.
|
||||
|
||||
```js
|
||||
// Input: h1 h2
|
||||
selectors.at(0).nodes.length // => 3
|
||||
selectors.at(0).nodes[0].value // => 'h1'
|
||||
selectors.at(0).nodes[1].value // => ' '
|
||||
```
|
||||
|
||||
### `container.first` & `container.last`
|
||||
|
||||
The first/last child of the container.
|
||||
|
||||
```js
|
||||
selector.first === selector.nodes[0];
|
||||
selector.last === selector.nodes[selector.nodes.length - 1];
|
||||
```
|
||||
|
||||
### `container.at(index)`
|
||||
|
||||
Returns the node at position `index`.
|
||||
|
||||
```js
|
||||
selector.at(0) === selector.first;
|
||||
selector.at(0) === selector.nodes[0];
|
||||
```
|
||||
|
||||
Arguments:
|
||||
|
||||
* `index`: The index of the node to return.
|
||||
|
||||
### `container.atPosition(line, column)`
|
||||
|
||||
Returns the node at the source position `index`.
|
||||
|
||||
```js
|
||||
selector.at(0) === selector.first;
|
||||
selector.at(0) === selector.nodes[0];
|
||||
```
|
||||
|
||||
Arguments:
|
||||
|
||||
* `index`: The index of the node to return.
|
||||
|
||||
### `container.index(node)`
|
||||
|
||||
Return the index of the node within its container.
|
||||
|
||||
```js
|
||||
selector.index(selector.nodes[2]) // => 2
|
||||
```
|
||||
|
||||
Arguments:
|
||||
|
||||
* `node`: A node within the current container.
|
||||
|
||||
### `container.length`
|
||||
|
||||
Proxy to the length of the container's nodes.
|
||||
|
||||
```js
|
||||
container.length === container.nodes.length
|
||||
```
|
||||
|
||||
### `container` Array iterators
|
||||
|
||||
The container class provides proxies to certain Array methods; these are:
|
||||
|
||||
* `container.map === container.nodes.map`
|
||||
* `container.reduce === container.nodes.reduce`
|
||||
* `container.every === container.nodes.every`
|
||||
* `container.some === container.nodes.some`
|
||||
* `container.filter === container.nodes.filter`
|
||||
* `container.sort === container.nodes.sort`
|
||||
|
||||
Note that these methods only work on a container's immediate children; recursive
|
||||
iteration is provided by `container.walk`.
|
||||
|
||||
### `container.each(callback)`
|
||||
|
||||
Iterate the container's immediate children, calling `callback` for each child.
|
||||
You may return `false` within the callback to break the iteration.
|
||||
|
||||
```js
|
||||
let className;
|
||||
selectors.each((selector, index) => {
|
||||
if (selector.type === 'class') {
|
||||
className = selector.value;
|
||||
return false;
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
Note that unlike `Array#forEach()`, this iterator is safe to use whilst adding
|
||||
or removing nodes from the container.
|
||||
|
||||
Arguments:
|
||||
|
||||
* `callback (function)`: A function to call for each node, which receives `node`
|
||||
and `index` arguments.
|
||||
|
||||
### `container.walk(callback)`
|
||||
|
||||
Like `container#each`, but will also iterate child nodes as long as they are
|
||||
`container` types.
|
||||
|
||||
```js
|
||||
selectors.walk((selector, index) => {
|
||||
// all nodes
|
||||
});
|
||||
```
|
||||
|
||||
Arguments:
|
||||
|
||||
* `callback (function)`: A function to call for each node, which receives `node`
|
||||
and `index` arguments.
|
||||
|
||||
This iterator is safe to use whilst mutating `container.nodes`,
|
||||
like `container#each`.
|
||||
|
||||
### `container.walk` proxies
|
||||
|
||||
The container class provides proxy methods for iterating over types of nodes,
|
||||
so that it is easier to write modules that target specific selectors. Those
|
||||
methods are:
|
||||
|
||||
* `container.walkAttributes`
|
||||
* `container.walkClasses`
|
||||
* `container.walkCombinators`
|
||||
* `container.walkComments`
|
||||
* `container.walkIds`
|
||||
* `container.walkNesting`
|
||||
* `container.walkPseudos`
|
||||
* `container.walkTags`
|
||||
* `container.walkUniversals`
|
||||
|
||||
### `container.split(callback)`
|
||||
|
||||
This method allows you to split a group of nodes by returning `true` from
|
||||
a callback. It returns an array of arrays, where each inner array corresponds
|
||||
to the groups that you created via the callback.
|
||||
|
||||
```js
|
||||
// (input) => h1 h2>>h3
|
||||
const list = selectors.first.split(selector => {
|
||||
return selector.type === 'combinator';
|
||||
});
|
||||
|
||||
// (node values) => [['h1', ' '], ['h2', '>>'], ['h3']]
|
||||
```
|
||||
|
||||
Arguments:
|
||||
|
||||
* `callback (function)`: A function to call for each node, which receives `node`
|
||||
as an argument.
|
||||
|
||||
### `container.prepend(node)` & `container.append(node)`
|
||||
|
||||
Add a node to the start/end of the container. Note that doing so will set
|
||||
the parent property of the node to this container.
|
||||
|
||||
```js
|
||||
const id = parser.id({value: 'search'});
|
||||
selector.append(id);
|
||||
```
|
||||
|
||||
Arguments:
|
||||
|
||||
* `node`: The node to add.
|
||||
|
||||
### `container.insertBefore(old, new)` & `container.insertAfter(old, new)`
|
||||
|
||||
Add a node before or after an existing node in a container:
|
||||
|
||||
```js
|
||||
selectors.walk(selector => {
|
||||
if (selector.type !== 'class') {
|
||||
const className = parser.className({value: 'theme-name'});
|
||||
selector.parent.insertAfter(selector, className);
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
Arguments:
|
||||
|
||||
* `old`: The existing node in the container.
|
||||
* `new`: The new node to add before/after the existing node.
|
||||
|
||||
### `container.removeChild(node)`
|
||||
|
||||
Remove the node from the container. Note that you can also use
|
||||
`node.remove()` if you would like to remove just a single node.
|
||||
|
||||
```js
|
||||
selector.length // => 2
|
||||
selector.remove(id)
|
||||
selector.length // => 1;
|
||||
id.parent // undefined
|
||||
```
|
||||
|
||||
Arguments:
|
||||
|
||||
* `node`: The node to remove.
|
||||
|
||||
### `container.removeAll()` or `container.empty()`
|
||||
|
||||
Remove all children from the container.
|
||||
|
||||
```js
|
||||
selector.removeAll();
|
||||
selector.length // => 0
|
||||
```
|
||||
|
||||
## Root nodes
|
||||
|
||||
A root node represents a comma separated list of selectors. Indeed, all
|
||||
a root's `toString()` method does is join its selector children with a ','.
|
||||
Other than this, it has no special functionality and acts like a container.
|
||||
|
||||
### `root.trailingComma`
|
||||
|
||||
This will be set to `true` if the input has a trailing comma, in order to
|
||||
support parsing of legacy CSS hacks.
|
||||
|
||||
## Selector nodes
|
||||
|
||||
A selector node represents a single complex selector. For example, this
|
||||
selector string `h1 h2 h3, [href] > p`, is represented as two selector nodes.
|
||||
It has no special functionality of its own.
|
||||
|
||||
## Pseudo nodes
|
||||
|
||||
A pseudo selector extends a container node; if it has any parameters of its
|
||||
own (such as `h1:not(h2, h3)`), they will be its children. Note that the pseudo
|
||||
`value` will always contain the colons preceding the pseudo identifier. This
|
||||
is so that both `:before` and `::before` are properly represented in the AST.
|
||||
|
||||
## Attribute nodes
|
||||
|
||||
### `attribute.quoted`
|
||||
|
||||
Returns `true` if the attribute's value is wrapped in quotation marks, false if it is not.
|
||||
Remains `undefined` if there is no attribute value.
|
||||
|
||||
```css
|
||||
[href=foo] /* false */
|
||||
[href='foo'] /* true */
|
||||
[href="foo"] /* true */
|
||||
[href] /* undefined */
|
||||
```
|
||||
|
||||
### `attribute.qualifiedAttribute`
|
||||
|
||||
Returns the attribute name qualified with the namespace if one is given.
|
||||
|
||||
### `attribute.offsetOf(part)`
|
||||
|
||||
Returns the offset of the attribute part specified relative to the
|
||||
start of the node of the output string. This is useful in raising
|
||||
error messages about a specific part of the attribute, especially
|
||||
in combination with `attribute.sourceIndex`.
|
||||
|
||||
Returns `-1` if the name is invalid or the value doesn't exist in this
|
||||
attribute.
|
||||
|
||||
The legal values for `part` are:
|
||||
|
||||
* `"ns"` - alias for "namespace"
|
||||
* `"namespace"` - the namespace if it exists.
|
||||
* `"attribute"` - the attribute name
|
||||
* `"attributeNS"` - the start of the attribute or its namespace
|
||||
* `"operator"` - the match operator of the attribute
|
||||
* `"value"` - The value (string or identifier)
|
||||
* `"insensitive"` - the case insensitivity flag
|
||||
|
||||
### `attribute.raws.unquoted`
|
||||
|
||||
Returns the unquoted content of the attribute's value.
|
||||
Remains `undefined` if there is no attribute value.
|
||||
|
||||
```css
|
||||
[href=foo] /* foo */
|
||||
[href='foo'] /* foo */
|
||||
[href="foo"] /* foo */
|
||||
[href] /* undefined */
|
||||
```
|
||||
|
||||
### `attribute.spaces`
|
||||
|
||||
Like `node.spaces` with the `before` and `after` values containing the spaces
|
||||
around the element, the parts of the attribute can also have spaces before
|
||||
and after them. The for each of `attribute`, `operator`, `value` and
|
||||
`insensitive` there is corresponding property of the same nam in
|
||||
`node.spaces` that has an optional `before` or `after` string containing only
|
||||
whitespace.
|
||||
|
||||
Note that corresponding values in `attributes.raws.spaces` contain values
|
||||
including any comments. If set, these values will override the
|
||||
`attribute.spaces` value. Take care to remove them if changing
|
||||
`attribute.spaces`.
|
||||
|
||||
### `attribute.raws`
|
||||
|
||||
The raws object stores comments and other information necessary to re-render
|
||||
the node exactly as it was in the source.
|
||||
|
||||
If a comment is embedded within the identifiers for the `namespace`, `attribute`
|
||||
or `value` then a property is placed in the raws for that value containing the full source of the propery including comments.
|
||||
|
||||
If a comment is embedded within the space between parts of the attribute
|
||||
then the raw for that space is set accordingly.
|
||||
|
||||
Setting an attribute's property `raws` value to be deleted.
|
||||
|
||||
For now, changing the spaces required also updating or removing any of the
|
||||
raws values that override them.
|
||||
|
||||
Example: `[ /*before*/ href /* after-attr */ = /* after-operator */ te/*inside-value*/st/* wow */ /*omg*/i/*bbq*/ /*whodoesthis*/]` would parse as:
|
||||
|
||||
```js
|
||||
{
|
||||
attribute: "href",
|
||||
operator: "=",
|
||||
value: "test",
|
||||
spaces: {
|
||||
before: '',
|
||||
after: '',
|
||||
attribute: { before: ' ', after: ' ' },
|
||||
operator: { after: ' ' },
|
||||
value: { after: ' ' },
|
||||
insensitive: { after: ' ' }
|
||||
},
|
||||
raws: {
|
||||
spaces: {
|
||||
attribute: { before: ' /*before*/ ', after: ' /* after-attr */ ' },
|
||||
operator: { after: ' /* after-operator */ ' },
|
||||
value: { after: '/* wow */ /*omg*/' },
|
||||
insensitive: { after: '/*bbq*/ /*whodoesthis*/' }
|
||||
},
|
||||
unquoted: 'test',
|
||||
value: 'te/*inside-value*/st'
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## `Processor`
|
||||
|
||||
### `ProcessorOptions`
|
||||
|
||||
* `lossless` - When `true`, whitespace is preserved. Defaults to `true`.
|
||||
* `updateSelector` - When `true`, if any processor methods are passed a postcss
|
||||
`Rule` node instead of a string, then that Rule's selector is updated
|
||||
with the results of the processing. Defaults to `true`.
|
||||
|
||||
### `process|processSync(selectors, [options])`
|
||||
|
||||
Processes the `selectors`, returning a string from the result of processing.
|
||||
|
||||
Note: when the `updateSelector` option is set, the rule's selector
|
||||
will be updated with the resulting string.
|
||||
|
||||
**Example:**
|
||||
|
||||
```js
|
||||
const parser = require("postcss-selector-parser");
|
||||
const processor = parser();
|
||||
|
||||
let result = processor.processSync(' .class');
|
||||
console.log(result);
|
||||
// => .class
|
||||
|
||||
// Asynchronous operation
|
||||
let promise = processor.process(' .class').then(result => {
|
||||
console.log(result)
|
||||
// => .class
|
||||
});
|
||||
|
||||
// To have the parser normalize whitespace values, utilize the options
|
||||
result = processor.processSync(' .class ', {lossless: false});
|
||||
console.log(result);
|
||||
// => .class
|
||||
|
||||
// For better syntax errors, pass a PostCSS Rule node.
|
||||
const postcss = require('postcss');
|
||||
rule = postcss.rule({selector: ' #foo > a, .class '});
|
||||
processor.process(rule, {lossless: false, updateSelector: true}).then(result => {
|
||||
console.log(result);
|
||||
// => #foo>a,.class
|
||||
console.log("rule:", rule.selector);
|
||||
// => rule: #foo>a,.class
|
||||
})
|
||||
```
|
||||
|
||||
Arguments:
|
||||
|
||||
* `selectors (string|postcss.Rule)`: Either a selector string or a PostCSS Rule
|
||||
node.
|
||||
* `[options] (object)`: Process options
|
||||
|
||||
|
||||
### `ast|astSync(selectors, [options])`
|
||||
|
||||
Like `process()` and `processSync()` but after
|
||||
processing the `selectors` these methods return the `Root` node of the result
|
||||
instead of a string.
|
||||
|
||||
Note: when the `updateSelector` option is set, the rule's selector
|
||||
will be updated with the resulting string.
|
||||
|
||||
### `transform|transformSync(selectors, [options])`
|
||||
|
||||
Like `process()` and `processSync()` but after
|
||||
processing the `selectors` these methods return the value returned by the
|
||||
processor callback.
|
||||
|
||||
Note: when the `updateSelector` option is set, the rule's selector
|
||||
will be updated with the resulting string.
|
||||
|
||||
### Error Handling Within Selector Processors
|
||||
|
||||
The root node passed to the selector processor callback
|
||||
has a method `error(message, options)` that returns an
|
||||
error object. This method should always be used to raise
|
||||
errors relating to the syntax of selectors. The options
|
||||
to this method are passed to postcss's error constructor
|
||||
([documentation](http://api.postcss.org/Container.html#error)).
|
||||
|
||||
#### Async Error Example
|
||||
|
||||
```js
|
||||
let processor = (root) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
root.walkClasses((classNode) => {
|
||||
if (/^(.*)[-_]/.test(classNode.value)) {
|
||||
let msg = "classes may not have underscores or dashes in them";
|
||||
reject(root.error(msg, {
|
||||
index: classNode.sourceIndex + RegExp.$1.length + 1,
|
||||
word: classNode.value
|
||||
}));
|
||||
}
|
||||
});
|
||||
resolve();
|
||||
});
|
||||
};
|
||||
|
||||
const postcss = require("postcss");
|
||||
const parser = require("postcss-selector-parser");
|
||||
const selectorProcessor = parser(processor);
|
||||
const plugin = postcss.plugin('classValidator', (options) => {
|
||||
return (root) => {
|
||||
let promises = [];
|
||||
root.walkRules(rule => {
|
||||
promises.push(selectorProcessor.process(rule));
|
||||
});
|
||||
return Promise.all(promises);
|
||||
};
|
||||
});
|
||||
postcss(plugin()).process(`
|
||||
.foo-bar {
|
||||
color: red;
|
||||
}
|
||||
`.trim(), {from: 'test.css'}).catch((e) => console.error(e.toString()));
|
||||
|
||||
// CssSyntaxError: classValidator: ./test.css:1:5: classes may not have underscores or dashes in them
|
||||
//
|
||||
// > 1 | .foo-bar {
|
||||
// | ^
|
||||
// 2 | color: red;
|
||||
// 3 | }
|
||||
```
|
||||
|
||||
#### Synchronous Error Example
|
||||
|
||||
```js
|
||||
let processor = (root) => {
|
||||
root.walkClasses((classNode) => {
|
||||
if (/.*[-_]/.test(classNode.value)) {
|
||||
let msg = "classes may not have underscores or dashes in them";
|
||||
throw root.error(msg, {
|
||||
index: classNode.sourceIndex,
|
||||
word: classNode.value
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const postcss = require("postcss");
|
||||
const parser = require("postcss-selector-parser");
|
||||
const selectorProcessor = parser(processor);
|
||||
const plugin = postcss.plugin('classValidator', (options) => {
|
||||
return (root) => {
|
||||
root.walkRules(rule => {
|
||||
selectorProcessor.processSync(rule);
|
||||
});
|
||||
};
|
||||
});
|
||||
postcss(plugin()).process(`
|
||||
.foo-bar {
|
||||
color: red;
|
||||
}
|
||||
`.trim(), {from: 'test.css'}).catch((e) => console.error(e.toString()));
|
||||
|
||||
// CssSyntaxError: classValidator: ./test.css:1:5: classes may not have underscores or dashes in them
|
||||
//
|
||||
// > 1 | .foo-bar {
|
||||
// | ^
|
||||
// 2 | color: red;
|
||||
// 3 | }
|
||||
```
|
513
node_modules/@tailwindcss/typography/node_modules/postcss-selector-parser/CHANGELOG.md
generated
vendored
Normal file
513
node_modules/@tailwindcss/typography/node_modules/postcss-selector-parser/CHANGELOG.md
generated
vendored
Normal file
@ -0,0 +1,513 @@
|
||||
# 6.0.10
|
||||
|
||||
- Fixed: `isPseudoElement()` supports `:first-letter` and `:first-line`
|
||||
|
||||
# 6.0.9
|
||||
|
||||
- Fixed: `Combinator.raws` property type
|
||||
|
||||
# 6.0.8
|
||||
|
||||
- Fixed: reduced size
|
||||
|
||||
# 6.0.7
|
||||
|
||||
- Fixed: parse animation percents
|
||||
|
||||
# 6.0.6
|
||||
|
||||
- Fixed: parse quoted attributes containing a newline correctly
|
||||
|
||||
# 6.0.5
|
||||
|
||||
- Perf: rework unesc for a 63+% performance boost
|
||||
|
||||
# 6.0.4
|
||||
|
||||
- Fixed: ts errors
|
||||
|
||||
# 6.0.3
|
||||
|
||||
- Fixed: replace node built-in "util" module with "util-deprecate"
|
||||
- Fixed: handle uppercase pseudo elements
|
||||
- Fixed: do not create invalid combinator before comment
|
||||
|
||||
# 6.0.2
|
||||
|
||||
- Fixed an issue with parsing and stringifying an empty attribute value
|
||||
|
||||
# 6.0.1
|
||||
|
||||
- Fixed an issue with unicode surrogate pair parsing
|
||||
|
||||
# 6.0.0
|
||||
|
||||
- Updated: `cssesc` to 3.0.0 (major)
|
||||
- Fixed: Issues with escaped `id` and `class` selectors
|
||||
|
||||
# 5.0.0
|
||||
|
||||
- Allow escaped dot within class name.
|
||||
- Update PostCSS to 7.0.7 (patch)
|
||||
|
||||
# 5.0.0-rc.4
|
||||
|
||||
- Fixed an issue where comments immediately after an insensitive (in attribute)
|
||||
were not parsed correctly.
|
||||
- Updated `cssesc` to 2.0.0 (major).
|
||||
- Removed outdated integration tests.
|
||||
- Added tests for custom selectors, tags with attributes, the universal
|
||||
selector with pseudos, and tokens after combinators.
|
||||
|
||||
# 5.0.0-rc.1
|
||||
|
||||
To ease adoption of the v5.0 release, we have relaxed the node version
|
||||
check performed by npm at installation time to allow for node 4, which
|
||||
remains officially unsupported, but likely to continue working for the
|
||||
time being.
|
||||
|
||||
# 5.0.0-rc.0
|
||||
|
||||
This release has **BREAKING CHANGES** that were required to fix regressions
|
||||
in 4.0.0 and to make the Combinator Node API consistent for all combinator
|
||||
types. Please read carefully.
|
||||
|
||||
## Summary of Changes
|
||||
|
||||
* The way a descendent combinator that isn't a single space character (E.g. `.a .b`) is stored in the AST has changed.
|
||||
* Named Combinators (E.g. `.a /for/ .b`) are now properly parsed as a combinator.
|
||||
* It is now possible to look up a node based on the source location of a character in that node and to query nodes if they contain some character.
|
||||
* Several bug fixes that caused the parser to hang and run out of memory when a `/` was encountered have been fixed.
|
||||
* The minimum supported version of Node is now `v6.0.0`.
|
||||
|
||||
### Changes to the Descendent Combinator
|
||||
|
||||
In prior releases, the value of a descendant combinator with multiple spaces included all the spaces.
|
||||
|
||||
* `.a .b`: Extra spaces are now stored as space before.
|
||||
- Old & Busted:
|
||||
- `combinator.value === " "`
|
||||
- New hotness:
|
||||
- `combinator.value === " " && combinator.spaces.before === " "`
|
||||
* `.a /*comment*/.b`: A comment at the end of the combinator causes extra space to become after space.
|
||||
- Old & Busted:
|
||||
- `combinator.value === " "`
|
||||
- `combinator.raws.value === " /*comment/"`
|
||||
- New hotness:
|
||||
- `combinator.value === " "`
|
||||
- `combinator.spaces.after === " "`
|
||||
- `combinator.raws.spaces.after === " /*comment*/"`
|
||||
* `.a<newline>.b`: whitespace that doesn't start or end with a single space character is stored as a raw value.
|
||||
- Old & Busted:
|
||||
- `combinator.value === "\n"`
|
||||
- `combinator.raws.value === undefined`
|
||||
- New hotness:
|
||||
- `combinator.value === " "`
|
||||
- `combinator.raws.value === "\n"`
|
||||
|
||||
### Support for "Named Combinators"
|
||||
|
||||
Although, nonstandard and unlikely to ever become a standard, combinators like `/deep/` and `/for/` are now properly supported.
|
||||
|
||||
Because they've been taken off the standardization track, there is no spec-official name for combinators of the form `/<ident>/`. However, I talked to [Tab Atkins](https://twitter.com/tabatkins) and we agreed to call them "named combinators" so now they are called that.
|
||||
|
||||
Before this release such named combinators were parsed without intention and generated three nodes of type `"tag"` where the first and last nodes had a value of `"/"`.
|
||||
|
||||
* `.a /for/ .b` is parsed as a combinator.
|
||||
- Old & Busted:
|
||||
- `root.nodes[0].nodes[1].type === "tag"`
|
||||
- `root.nodes[0].nodes[1].value === "/"`
|
||||
- New hotness:
|
||||
- `root.nodes[0].nodes[1].type === "combinator"`
|
||||
- `root.nodes[0].nodes[1].value === "/for/"`
|
||||
* `.a /F\6fR/ .b` escapes are handled and uppercase is normalized.
|
||||
- Old & Busted:
|
||||
- `root.nodes[0].nodes[2].type === "tag"`
|
||||
- `root.nodes[0].nodes[2].value === "F\\6fR"`
|
||||
- New hotness:
|
||||
- `root.nodes[0].nodes[1].type === "combinator"`
|
||||
- `root.nodes[0].nodes[1].value === "/for/"`
|
||||
- `root.nodes[0].nodes[1].raws.value === "/F\\6fR/"`
|
||||
|
||||
### Source position checks and lookups
|
||||
|
||||
A new API was added to look up a node based on the source location.
|
||||
|
||||
```js
|
||||
const selectorParser = require("postcss-selector-parser");
|
||||
// You can find the most specific node for any given character
|
||||
let combinator = selectorParser.astSync(".a > .b").atPosition(1,4);
|
||||
combinator.toString() === " > ";
|
||||
// You can check if a node includes a specific character
|
||||
// Whitespace surrounding the node that is owned by that node
|
||||
// is included in the check.
|
||||
[2,3,4,5,6].map(column => combinator.isAtPosition(1, column));
|
||||
// => [false, true, true, true, false]
|
||||
```
|
||||
|
||||
# 4.0.0
|
||||
|
||||
This release has **BREAKING CHANGES** that were required to fix bugs regarding values with escape sequences. Please read carefully.
|
||||
|
||||
* **Identifiers with escapes** - CSS escape sequences are now hidden from the public API by default.
|
||||
The normal value of a node like a class name or ID, or an aspect of a node such as attribute
|
||||
selector's value, is unescaped. Escapes representing Non-ascii characters are unescaped into
|
||||
unicode characters. For example: `bu\tton, .\31 00, #i\2764\FE0Fu, [attr="value is \"quoted\""]`
|
||||
will parse respectively to the values `button`, `100`, `i❤️u`, `value is "quoted"`.
|
||||
The original escape sequences for these values can be found in the corresponding property name
|
||||
in `node.raws`. Where possible, deprecation warnings were added, but the nature
|
||||
of escape handling makes it impossible to detect what is escaped or not. Our expectation is
|
||||
that most users are neither expecting nor handling escape sequences in their use of this library,
|
||||
and so for them, this is a bug fix. Users who are taking care to handle escapes correctly can
|
||||
now update their code to remove the escape handling and let us do it for them.
|
||||
|
||||
* **Mutating values with escapes** - When you make an update to a node property that has escape handling
|
||||
The value is assumed to be unescaped, and any special characters are escaped automatically and
|
||||
the corresponding `raws` value is immediately updated. This can result in changes to the original
|
||||
escape format. Where the exact value of the escape sequence is important there are methods that
|
||||
allow both values to be set in conjunction. There are a number of new convenience methods for
|
||||
manipulating values that involve escapes, especially for attributes values where the quote mark
|
||||
is involved. See https://github.com/postcss/postcss-selector-parser/pull/133 for an extensive
|
||||
write-up on these changes.
|
||||
|
||||
|
||||
**Upgrade/API Example**
|
||||
|
||||
In `3.x` there was no unescape handling and internal consistency of several properties was the caller's job to maintain. It was very easy for the developer
|
||||
to create a CSS file that did not parse correctly when some types of values
|
||||
were in use.
|
||||
|
||||
```js
|
||||
const selectorParser = require("postcss-selector-parser");
|
||||
let attr = selectorParser.attribute({attribute: "id", operator: "=", value: "a-value"});
|
||||
attr.value; // => "a-value"
|
||||
attr.toString(); // => [id=a-value]
|
||||
// Add quotes to an attribute's value.
|
||||
// All these values have to be set by the caller to be consistent:
|
||||
// no internal consistency is maintained.
|
||||
attr.raws.unquoted = attr.value
|
||||
attr.value = "'" + attr.value + "'";
|
||||
attr.value; // => "'a-value'"
|
||||
attr.quoted = true;
|
||||
attr.toString(); // => "[id='a-value']"
|
||||
```
|
||||
|
||||
In `4.0` there is a convenient API for setting and mutating values
|
||||
that may need escaping. Especially for attributes.
|
||||
|
||||
```js
|
||||
const selectorParser = require("postcss-selector-parser");
|
||||
|
||||
// The constructor requires you specify the exact escape sequence
|
||||
let className = selectorParser.className({value: "illegal class name", raws: {value: "illegal\\ class\\ name"}});
|
||||
className.toString(); // => '.illegal\\ class\\ name'
|
||||
|
||||
// So it's better to set the value as a property
|
||||
className = selectorParser.className();
|
||||
// Most properties that deal with identifiers work like this
|
||||
className.value = "escape for me";
|
||||
className.value; // => 'escape for me'
|
||||
className.toString(); // => '.escape\\ for\\ me'
|
||||
|
||||
// emoji and all non-ascii are escaped to ensure it works in every css file.
|
||||
className.value = "😱🦄😍";
|
||||
className.value; // => '😱🦄😍'
|
||||
className.toString(); // => '.\\1F631\\1F984\\1F60D'
|
||||
|
||||
// you can control the escape sequence if you want, or do bad bad things
|
||||
className.setPropertyAndEscape('value', 'xxxx', 'yyyy');
|
||||
className.value; // => "xxxx"
|
||||
className.toString(); // => ".yyyy"
|
||||
|
||||
// Pass a value directly through to the css output without escaping it.
|
||||
className.setPropertyWithoutEscape('value', '$REPLACE_ME$');
|
||||
className.value; // => "$REPLACE_ME$"
|
||||
className.toString(); // => ".$REPLACE_ME$"
|
||||
|
||||
// The biggest changes are to the Attribute class
|
||||
// passing quoteMark explicitly is required to avoid a deprecation warning.
|
||||
let attr = selectorParser.attribute({attribute: "id", operator: "=", value: "a-value", quoteMark: null});
|
||||
attr.toString(); // => "[id=a-value]"
|
||||
// Get the value with quotes on it and any necessary escapes.
|
||||
// This is the same as reading attr.value in 3.x.
|
||||
attr.getQuotedValue(); // => "a-value";
|
||||
attr.quoteMark; // => null
|
||||
|
||||
// Add quotes to an attribute's value.
|
||||
attr.quoteMark = "'"; // This is all that's required.
|
||||
attr.toString(); // => "[id='a-value']"
|
||||
attr.quoted; // => true
|
||||
// The value is still the same, only the quotes have changed.
|
||||
attr.value; // => a-value
|
||||
attr.getQuotedValue(); // => "'a-value'";
|
||||
|
||||
// deprecated assignment, no warning because there's no escapes
|
||||
attr.value = "new-value";
|
||||
// no quote mark is needed so it is removed
|
||||
attr.getQuotedValue(); // => "new-value";
|
||||
|
||||
// deprecated assignment,
|
||||
attr.value = "\"a 'single quoted' value\"";
|
||||
// > (node:27859) DeprecationWarning: Assigning an attribute a value containing characters that might need to be escaped is deprecated. Call attribute.setValue() instead.
|
||||
attr.getQuotedValue(); // => '"a \'single quoted\' value"';
|
||||
// quote mark inferred from first and last characters.
|
||||
attr.quoteMark; // => '"'
|
||||
|
||||
// setValue takes options to make manipulating the value simple.
|
||||
attr.setValue('foo', {smart: true});
|
||||
// foo doesn't require any escapes or quotes.
|
||||
attr.toString(); // => '[id=foo]'
|
||||
attr.quoteMark; // => null
|
||||
|
||||
// An explicit quote mark can be specified
|
||||
attr.setValue('foo', {quoteMark: '"'});
|
||||
attr.toString(); // => '[id="foo"]'
|
||||
|
||||
// preserves quote mark by default
|
||||
attr.setValue('bar');
|
||||
attr.toString(); // => '[id="bar"]'
|
||||
attr.quoteMark = null;
|
||||
attr.toString(); // => '[id=bar]'
|
||||
|
||||
// with no arguments, it preserves quote mark even when it's not a great idea
|
||||
attr.setValue('a value \n that should be quoted');
|
||||
attr.toString(); // => '[id=a\\ value\\ \\A\\ that\\ should\\ be\\ quoted]'
|
||||
|
||||
// smart preservation with a specified default
|
||||
attr.setValue('a value \n that should be quoted', {smart: true, preferCurrentQuoteMark: true, quoteMark: "'"});
|
||||
// => "[id='a value \\A that should be quoted']"
|
||||
attr.quoteMark = '"';
|
||||
// => '[id="a value \\A that should be quoted"]'
|
||||
|
||||
// this keeps double quotes because it wants to quote the value and the existing value has double quotes.
|
||||
attr.setValue('this should be quoted', {smart: true, preferCurrentQuoteMark: true, quoteMark: "'"});
|
||||
// => '[id="this should be quoted"]'
|
||||
|
||||
// picks single quotes because the value has double quotes
|
||||
attr.setValue('a "double quoted" value', {smart: true, preferCurrentQuoteMark: true, quoteMark: "'"});
|
||||
// => "[id='a "double quoted" value']"
|
||||
|
||||
// setPropertyAndEscape lets you do anything you want. Even things that are a bad idea and illegal.
|
||||
attr.setPropertyAndEscape('value', 'xxxx', 'the password is 42');
|
||||
attr.value; // => "xxxx"
|
||||
attr.toString(); // => "[id=the password is 42]"
|
||||
|
||||
// Pass a value directly through to the css output without escaping it.
|
||||
attr.setPropertyWithoutEscape('value', '$REPLACEMENT$');
|
||||
attr.value; // => "$REPLACEMENT$"
|
||||
attr.toString(); // => "[id=$REPLACEMENT$]"
|
||||
```
|
||||
|
||||
# 3.1.2
|
||||
|
||||
* Fix: Removed dot-prop dependency since it's no longer written in es5.
|
||||
|
||||
# 3.1.1
|
||||
|
||||
* Fix: typescript definitions weren't in the published package.
|
||||
|
||||
# 3.1.0
|
||||
|
||||
* Fixed numerous bugs in attribute nodes relating to the handling of comments
|
||||
and whitespace. There's significant changes to `attrNode.spaces` and `attrNode.raws` since the `3.0.0` release.
|
||||
* Added `Attribute#offsetOf(part)` to get the offset location of
|
||||
attribute parts like `"operator"` and `"value"`. This is most
|
||||
often added to `Attribute#sourceIndex` for error reporting.
|
||||
|
||||
# 3.0.0
|
||||
|
||||
## Breaking changes
|
||||
|
||||
* Some tweaks to the tokenizer/attribute selector parsing mean that whitespace
|
||||
locations might be slightly different to the 2.x code.
|
||||
* Better attribute selector parsing with more validation; postcss-selector-parser
|
||||
no longer uses regular expressions to parse attribute selectors.
|
||||
* Added an async API (thanks to @jacobp100); the default `process` API is now
|
||||
async, and the sync API is now accessed through `processSync` instead.
|
||||
* `process()` and `processSync()` now return a string instead of the Processor
|
||||
instance.
|
||||
* Tweaks handling of Less interpolation (thanks to @jwilsson).
|
||||
* Removes support for Node 0.12.
|
||||
|
||||
## Other changes
|
||||
|
||||
* `ast()` and `astSync()` methods have been added to the `Processor`. These
|
||||
return the `Root` node of the selectors after processing them.
|
||||
* `transform()` and `transformSync()` methods have been added to the
|
||||
`Processor`. These return the value returned by the processor callback
|
||||
after processing the selectors.
|
||||
* Set the parent when inserting a node (thanks to @chriseppstein).
|
||||
* Correctly adjust indices when using insertBefore/insertAfter (thanks to @tivac).
|
||||
* Fixes handling of namespaces with qualified tag selectors.
|
||||
* `process`, `ast` and `transform` (and their sync variants) now accept a
|
||||
`postcss` rule node. When provided, better errors are generated and selector
|
||||
processing is automatically set back to the rule selector (unless the `updateSelector` option is set to `false`.)
|
||||
* Now more memory efficient when tokenizing selectors.
|
||||
|
||||
### Upgrade hints
|
||||
|
||||
The pattern of:
|
||||
|
||||
`rule.selector = processor.process(rule.selector).result.toString();`
|
||||
|
||||
is now:
|
||||
|
||||
`processor.processSync(rule)`
|
||||
|
||||
# 2.2.3
|
||||
|
||||
* Resolves an issue where the parser would not reduce multiple spaces between an
|
||||
ampersand and another simple selector in lossy mode (thanks to @adam-26).
|
||||
|
||||
# 2.2.2
|
||||
|
||||
* No longer hangs on an unescaped semicolon; instead the parser will throw
|
||||
an exception for these cases.
|
||||
|
||||
# 2.2.1
|
||||
|
||||
* Allows a consumer to specify whitespace tokens when creating a new Node
|
||||
(thanks to @Semigradsky).
|
||||
|
||||
# 2.2.0
|
||||
|
||||
* Added a new option to normalize whitespace when parsing the selector string
|
||||
(thanks to @adam-26).
|
||||
|
||||
# 2.1.1
|
||||
|
||||
* Better unquoted value handling within attribute selectors
|
||||
(thanks to @evilebottnawi).
|
||||
|
||||
# 2.1.0
|
||||
|
||||
* Added: Use string constants for all node types & expose them on the main
|
||||
parser instance (thanks to @Aweary).
|
||||
|
||||
# 2.0.0
|
||||
|
||||
This release contains the following breaking changes:
|
||||
|
||||
* Renamed all `eachInside` iterators to `walk`. For example, `eachTag` is now
|
||||
`walkTags`, and `eachInside` is now `walk`.
|
||||
* Renamed `Node#removeSelf()` to `Node#remove()`.
|
||||
* Renamed `Container#remove()` to `Container#removeChild()`.
|
||||
* Renamed `Node#raw` to `Node#raws` (thanks to @davidtheclark).
|
||||
* Now parses `&` as the *nesting* selector, rather than a *tag* selector.
|
||||
* Fixes misinterpretation of Sass interpolation (e.g. `#{foo}`) as an
|
||||
id selector (thanks to @davidtheclark).
|
||||
|
||||
and;
|
||||
|
||||
* Fixes parsing of attribute selectors with equals signs in them
|
||||
(e.g. `[data-attr="foo=bar"]`) (thanks to @montmanu).
|
||||
* Adds `quoted` and `raw.unquoted` properties to attribute nodes
|
||||
(thanks to @davidtheclark).
|
||||
|
||||
# 1.3.3
|
||||
|
||||
* Fixes an infinite loop on `)` and `]` tokens when they had no opening pairs.
|
||||
Now postcss-selector-parser will throw when it encounters these lone tokens.
|
||||
|
||||
# 1.3.2
|
||||
|
||||
* Now uses plain integers rather than `str.charCodeAt(0)` for compiled builds.
|
||||
|
||||
# 1.3.1
|
||||
|
||||
* Update flatten to v1.x (thanks to @shinnn).
|
||||
|
||||
# 1.3.0
|
||||
|
||||
* Adds a new node type, `String`, to fix a crash on selectors such as
|
||||
`foo:bar("test")`.
|
||||
|
||||
# 1.2.1
|
||||
|
||||
* Fixes a crash when the parser encountered a trailing combinator.
|
||||
|
||||
# 1.2.0
|
||||
|
||||
* A more descriptive error is thrown when the parser expects to find a
|
||||
pseudo-class/pseudo-element (thanks to @ashelley).
|
||||
* Adds support for line/column locations for selector nodes, as well as a
|
||||
`Node#sourceIndex` method (thanks to @davidtheclark).
|
||||
|
||||
# 1.1.4
|
||||
|
||||
* Fixes a crash when a selector started with a `>` combinator. The module will
|
||||
now no longer throw if a selector has a leading/trailing combinator node.
|
||||
|
||||
# 1.1.3
|
||||
|
||||
* Fixes a crash on `@` tokens.
|
||||
|
||||
# 1.1.2
|
||||
|
||||
* Fixes an infinite loop caused by using parentheses in a non-pseudo element
|
||||
context.
|
||||
|
||||
# 1.1.1
|
||||
|
||||
* Fixes a crash when a backslash ended a selector string.
|
||||
|
||||
# 1.1.0
|
||||
|
||||
* Adds support for replacing multiple nodes at once with `replaceWith`
|
||||
(thanks to @jonathantneal).
|
||||
* Parser no longer throws on sequential IDs and trailing commas, to support
|
||||
parsing of selector hacks.
|
||||
|
||||
# 1.0.1
|
||||
|
||||
* Fixes using `insertAfter` and `insertBefore` during iteration.
|
||||
|
||||
# 1.0.0
|
||||
|
||||
* Adds `clone` and `replaceWith` methods to nodes.
|
||||
* Adds `insertBefore` and `insertAfter` to containers.
|
||||
* Stabilises API.
|
||||
|
||||
# 0.0.5
|
||||
|
||||
* Fixes crash on extra whitespace inside a pseudo selector's parentheses.
|
||||
* Adds sort function to the container class.
|
||||
* Enables the parser to pass its input through without transforming.
|
||||
* Iteration-safe `each` and `eachInside`.
|
||||
|
||||
# 0.0.4
|
||||
|
||||
* Tidy up redundant duplication.
|
||||
* Fixes a bug where the parser would loop infinitely on universal selectors
|
||||
inside pseudo selectors.
|
||||
* Adds `length` getter and `eachInside`, `map`, `reduce` to the container class.
|
||||
* When a selector has been removed from the tree, the root node will no longer
|
||||
cast it to a string.
|
||||
* Adds node type iterators to the container class (e.g. `eachComment`).
|
||||
* Adds filter function to the container class.
|
||||
* Adds split function to the container class.
|
||||
* Create new node types by doing `parser.id(opts)` etc.
|
||||
* Adds support for pseudo classes anywhere in the selector.
|
||||
|
||||
# 0.0.3
|
||||
|
||||
* Adds `next` and `prev` to the node class.
|
||||
* Adds `first` and `last` getters to the container class.
|
||||
* Adds `every` and `some` iterators to the container class.
|
||||
* Add `empty` alias for `removeAll`.
|
||||
* Combinators are now types of node.
|
||||
* Fixes the at method so that it is not an alias for `index`.
|
||||
* Tidy up creation of new nodes in the parser.
|
||||
* Refactors how namespaces are handled for consistency & less redundant code.
|
||||
* Refactors AST to use `nodes` exclusively, and eliminates excessive nesting.
|
||||
* Fixes nested pseudo parsing.
|
||||
* Fixes whitespace parsing.
|
||||
|
||||
# 0.0.2
|
||||
|
||||
* Adds support for namespace selectors.
|
||||
* Adds support for selectors joined by escaped spaces - such as `.\31\ 0`.
|
||||
|
||||
# 0.0.1
|
||||
|
||||
* Initial release.
|
22
node_modules/@tailwindcss/typography/node_modules/postcss-selector-parser/LICENSE-MIT
generated
vendored
Normal file
22
node_modules/@tailwindcss/typography/node_modules/postcss-selector-parser/LICENSE-MIT
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
Copyright (c) Ben Briggs <beneb.info@gmail.com> (http://beneb.info)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation
|
||||
files (the "Software"), to deal in the Software without
|
||||
restriction, including without limitation the rights to use,
|
||||
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following
|
||||
conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
49
node_modules/@tailwindcss/typography/node_modules/postcss-selector-parser/README.md
generated
vendored
Normal file
49
node_modules/@tailwindcss/typography/node_modules/postcss-selector-parser/README.md
generated
vendored
Normal file
@ -0,0 +1,49 @@
|
||||
# postcss-selector-parser [](https://travis-ci.org/postcss/postcss-selector-parser)
|
||||
|
||||
> Selector parser with built in methods for working with selector strings.
|
||||
|
||||
## Install
|
||||
|
||||
With [npm](https://npmjs.com/package/postcss-selector-parser) do:
|
||||
|
||||
```
|
||||
npm install postcss-selector-parser
|
||||
```
|
||||
|
||||
## Quick Start
|
||||
|
||||
```js
|
||||
const parser = require('postcss-selector-parser');
|
||||
const transform = selectors => {
|
||||
selectors.walk(selector => {
|
||||
// do something with the selector
|
||||
console.log(String(selector))
|
||||
});
|
||||
};
|
||||
|
||||
const transformed = parser(transform).processSync('h1, h2, h3');
|
||||
```
|
||||
|
||||
To normalize selector whitespace:
|
||||
|
||||
```js
|
||||
const parser = require('postcss-selector-parser');
|
||||
const normalized = parser().processSync('h1, h2, h3', {lossless: false});
|
||||
// -> h1,h2,h3
|
||||
```
|
||||
|
||||
Async support is provided through `parser.process` and will resolve a Promise
|
||||
with the resulting selector string.
|
||||
|
||||
## API
|
||||
|
||||
Please see [API.md](API.md).
|
||||
|
||||
## Credits
|
||||
|
||||
* Huge thanks to Andrey Sitnik (@ai) for work on PostCSS which helped
|
||||
accelerate this module's development.
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
24
node_modules/@tailwindcss/typography/node_modules/postcss-selector-parser/dist/index.js
generated
vendored
Normal file
24
node_modules/@tailwindcss/typography/node_modules/postcss-selector-parser/dist/index.js
generated
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports["default"] = void 0;
|
||||
|
||||
var _processor = _interopRequireDefault(require("./processor"));
|
||||
|
||||
var selectors = _interopRequireWildcard(require("./selectors"));
|
||||
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
|
||||
var parser = function parser(processor) {
|
||||
return new _processor["default"](processor);
|
||||
};
|
||||
|
||||
Object.assign(parser, selectors);
|
||||
delete parser.__esModule;
|
||||
var _default = parser;
|
||||
exports["default"] = _default;
|
||||
module.exports = exports.default;
|
1243
node_modules/@tailwindcss/typography/node_modules/postcss-selector-parser/dist/parser.js
generated
vendored
Normal file
1243
node_modules/@tailwindcss/typography/node_modules/postcss-selector-parser/dist/parser.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
206
node_modules/@tailwindcss/typography/node_modules/postcss-selector-parser/dist/processor.js
generated
vendored
Normal file
206
node_modules/@tailwindcss/typography/node_modules/postcss-selector-parser/dist/processor.js
generated
vendored
Normal file
@ -0,0 +1,206 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports["default"] = void 0;
|
||||
|
||||
var _parser = _interopRequireDefault(require("./parser"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
|
||||
var Processor = /*#__PURE__*/function () {
|
||||
function Processor(func, options) {
|
||||
this.func = func || function noop() {};
|
||||
|
||||
this.funcRes = null;
|
||||
this.options = options;
|
||||
}
|
||||
|
||||
var _proto = Processor.prototype;
|
||||
|
||||
_proto._shouldUpdateSelector = function _shouldUpdateSelector(rule, options) {
|
||||
if (options === void 0) {
|
||||
options = {};
|
||||
}
|
||||
|
||||
var merged = Object.assign({}, this.options, options);
|
||||
|
||||
if (merged.updateSelector === false) {
|
||||
return false;
|
||||
} else {
|
||||
return typeof rule !== "string";
|
||||
}
|
||||
};
|
||||
|
||||
_proto._isLossy = function _isLossy(options) {
|
||||
if (options === void 0) {
|
||||
options = {};
|
||||
}
|
||||
|
||||
var merged = Object.assign({}, this.options, options);
|
||||
|
||||
if (merged.lossless === false) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
_proto._root = function _root(rule, options) {
|
||||
if (options === void 0) {
|
||||
options = {};
|
||||
}
|
||||
|
||||
var parser = new _parser["default"](rule, this._parseOptions(options));
|
||||
return parser.root;
|
||||
};
|
||||
|
||||
_proto._parseOptions = function _parseOptions(options) {
|
||||
return {
|
||||
lossy: this._isLossy(options)
|
||||
};
|
||||
};
|
||||
|
||||
_proto._run = function _run(rule, options) {
|
||||
var _this = this;
|
||||
|
||||
if (options === void 0) {
|
||||
options = {};
|
||||
}
|
||||
|
||||
return new Promise(function (resolve, reject) {
|
||||
try {
|
||||
var root = _this._root(rule, options);
|
||||
|
||||
Promise.resolve(_this.func(root)).then(function (transform) {
|
||||
var string = undefined;
|
||||
|
||||
if (_this._shouldUpdateSelector(rule, options)) {
|
||||
string = root.toString();
|
||||
rule.selector = string;
|
||||
}
|
||||
|
||||
return {
|
||||
transform: transform,
|
||||
root: root,
|
||||
string: string
|
||||
};
|
||||
}).then(resolve, reject);
|
||||
} catch (e) {
|
||||
reject(e);
|
||||
return;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
_proto._runSync = function _runSync(rule, options) {
|
||||
if (options === void 0) {
|
||||
options = {};
|
||||
}
|
||||
|
||||
var root = this._root(rule, options);
|
||||
|
||||
var transform = this.func(root);
|
||||
|
||||
if (transform && typeof transform.then === "function") {
|
||||
throw new Error("Selector processor returned a promise to a synchronous call.");
|
||||
}
|
||||
|
||||
var string = undefined;
|
||||
|
||||
if (options.updateSelector && typeof rule !== "string") {
|
||||
string = root.toString();
|
||||
rule.selector = string;
|
||||
}
|
||||
|
||||
return {
|
||||
transform: transform,
|
||||
root: root,
|
||||
string: string
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Process rule into a selector AST.
|
||||
*
|
||||
* @param rule {postcss.Rule | string} The css selector to be processed
|
||||
* @param options The options for processing
|
||||
* @returns {Promise<parser.Root>} The AST of the selector after processing it.
|
||||
*/
|
||||
;
|
||||
|
||||
_proto.ast = function ast(rule, options) {
|
||||
return this._run(rule, options).then(function (result) {
|
||||
return result.root;
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Process rule into a selector AST synchronously.
|
||||
*
|
||||
* @param rule {postcss.Rule | string} The css selector to be processed
|
||||
* @param options The options for processing
|
||||
* @returns {parser.Root} The AST of the selector after processing it.
|
||||
*/
|
||||
;
|
||||
|
||||
_proto.astSync = function astSync(rule, options) {
|
||||
return this._runSync(rule, options).root;
|
||||
}
|
||||
/**
|
||||
* Process a selector into a transformed value asynchronously
|
||||
*
|
||||
* @param rule {postcss.Rule | string} The css selector to be processed
|
||||
* @param options The options for processing
|
||||
* @returns {Promise<any>} The value returned by the processor.
|
||||
*/
|
||||
;
|
||||
|
||||
_proto.transform = function transform(rule, options) {
|
||||
return this._run(rule, options).then(function (result) {
|
||||
return result.transform;
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Process a selector into a transformed value synchronously.
|
||||
*
|
||||
* @param rule {postcss.Rule | string} The css selector to be processed
|
||||
* @param options The options for processing
|
||||
* @returns {any} The value returned by the processor.
|
||||
*/
|
||||
;
|
||||
|
||||
_proto.transformSync = function transformSync(rule, options) {
|
||||
return this._runSync(rule, options).transform;
|
||||
}
|
||||
/**
|
||||
* Process a selector into a new selector string asynchronously.
|
||||
*
|
||||
* @param rule {postcss.Rule | string} The css selector to be processed
|
||||
* @param options The options for processing
|
||||
* @returns {string} the selector after processing.
|
||||
*/
|
||||
;
|
||||
|
||||
_proto.process = function process(rule, options) {
|
||||
return this._run(rule, options).then(function (result) {
|
||||
return result.string || result.root.toString();
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Process a selector into a new selector string synchronously.
|
||||
*
|
||||
* @param rule {postcss.Rule | string} The css selector to be processed
|
||||
* @param options The options for processing
|
||||
* @returns {string} the selector after processing.
|
||||
*/
|
||||
;
|
||||
|
||||
_proto.processSync = function processSync(rule, options) {
|
||||
var result = this._runSync(rule, options);
|
||||
|
||||
return result.string || result.root.toString();
|
||||
};
|
||||
|
||||
return Processor;
|
||||
}();
|
||||
|
||||
exports["default"] = Processor;
|
||||
module.exports = exports.default;
|
515
node_modules/@tailwindcss/typography/node_modules/postcss-selector-parser/dist/selectors/attribute.js
generated
vendored
Normal file
515
node_modules/@tailwindcss/typography/node_modules/postcss-selector-parser/dist/selectors/attribute.js
generated
vendored
Normal file
@ -0,0 +1,515 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.unescapeValue = unescapeValue;
|
||||
exports["default"] = void 0;
|
||||
|
||||
var _cssesc = _interopRequireDefault(require("cssesc"));
|
||||
|
||||
var _unesc = _interopRequireDefault(require("../util/unesc"));
|
||||
|
||||
var _namespace = _interopRequireDefault(require("./namespace"));
|
||||
|
||||
var _types = require("./types");
|
||||
|
||||
var _CSSESC_QUOTE_OPTIONS;
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
|
||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
||||
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
||||
|
||||
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
|
||||
|
||||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
||||
|
||||
var deprecate = require("util-deprecate");
|
||||
|
||||
var WRAPPED_IN_QUOTES = /^('|")([^]*)\1$/;
|
||||
var warnOfDeprecatedValueAssignment = deprecate(function () {}, "Assigning an attribute a value containing characters that might need to be escaped is deprecated. " + "Call attribute.setValue() instead.");
|
||||
var warnOfDeprecatedQuotedAssignment = deprecate(function () {}, "Assigning attr.quoted is deprecated and has no effect. Assign to attr.quoteMark instead.");
|
||||
var warnOfDeprecatedConstructor = deprecate(function () {}, "Constructing an Attribute selector with a value without specifying quoteMark is deprecated. Note: The value should be unescaped now.");
|
||||
|
||||
function unescapeValue(value) {
|
||||
var deprecatedUsage = false;
|
||||
var quoteMark = null;
|
||||
var unescaped = value;
|
||||
var m = unescaped.match(WRAPPED_IN_QUOTES);
|
||||
|
||||
if (m) {
|
||||
quoteMark = m[1];
|
||||
unescaped = m[2];
|
||||
}
|
||||
|
||||
unescaped = (0, _unesc["default"])(unescaped);
|
||||
|
||||
if (unescaped !== value) {
|
||||
deprecatedUsage = true;
|
||||
}
|
||||
|
||||
return {
|
||||
deprecatedUsage: deprecatedUsage,
|
||||
unescaped: unescaped,
|
||||
quoteMark: quoteMark
|
||||
};
|
||||
}
|
||||
|
||||
function handleDeprecatedContructorOpts(opts) {
|
||||
if (opts.quoteMark !== undefined) {
|
||||
return opts;
|
||||
}
|
||||
|
||||
if (opts.value === undefined) {
|
||||
return opts;
|
||||
}
|
||||
|
||||
warnOfDeprecatedConstructor();
|
||||
|
||||
var _unescapeValue = unescapeValue(opts.value),
|
||||
quoteMark = _unescapeValue.quoteMark,
|
||||
unescaped = _unescapeValue.unescaped;
|
||||
|
||||
if (!opts.raws) {
|
||||
opts.raws = {};
|
||||
}
|
||||
|
||||
if (opts.raws.value === undefined) {
|
||||
opts.raws.value = opts.value;
|
||||
}
|
||||
|
||||
opts.value = unescaped;
|
||||
opts.quoteMark = quoteMark;
|
||||
return opts;
|
||||
}
|
||||
|
||||
var Attribute = /*#__PURE__*/function (_Namespace) {
|
||||
_inheritsLoose(Attribute, _Namespace);
|
||||
|
||||
function Attribute(opts) {
|
||||
var _this;
|
||||
|
||||
if (opts === void 0) {
|
||||
opts = {};
|
||||
}
|
||||
|
||||
_this = _Namespace.call(this, handleDeprecatedContructorOpts(opts)) || this;
|
||||
_this.type = _types.ATTRIBUTE;
|
||||
_this.raws = _this.raws || {};
|
||||
Object.defineProperty(_this.raws, 'unquoted', {
|
||||
get: deprecate(function () {
|
||||
return _this.value;
|
||||
}, "attr.raws.unquoted is deprecated. Call attr.value instead."),
|
||||
set: deprecate(function () {
|
||||
return _this.value;
|
||||
}, "Setting attr.raws.unquoted is deprecated and has no effect. attr.value is unescaped by default now.")
|
||||
});
|
||||
_this._constructed = true;
|
||||
return _this;
|
||||
}
|
||||
/**
|
||||
* Returns the Attribute's value quoted such that it would be legal to use
|
||||
* in the value of a css file. The original value's quotation setting
|
||||
* used for stringification is left unchanged. See `setValue(value, options)`
|
||||
* if you want to control the quote settings of a new value for the attribute.
|
||||
*
|
||||
* You can also change the quotation used for the current value by setting quoteMark.
|
||||
*
|
||||
* Options:
|
||||
* * quoteMark {'"' | "'" | null} - Use this value to quote the value. If this
|
||||
* option is not set, the original value for quoteMark will be used. If
|
||||
* indeterminate, a double quote is used. The legal values are:
|
||||
* * `null` - the value will be unquoted and characters will be escaped as necessary.
|
||||
* * `'` - the value will be quoted with a single quote and single quotes are escaped.
|
||||
* * `"` - the value will be quoted with a double quote and double quotes are escaped.
|
||||
* * preferCurrentQuoteMark {boolean} - if true, prefer the source quote mark
|
||||
* over the quoteMark option value.
|
||||
* * smart {boolean} - if true, will select a quote mark based on the value
|
||||
* and the other options specified here. See the `smartQuoteMark()`
|
||||
* method.
|
||||
**/
|
||||
|
||||
|
||||
var _proto = Attribute.prototype;
|
||||
|
||||
_proto.getQuotedValue = function getQuotedValue(options) {
|
||||
if (options === void 0) {
|
||||
options = {};
|
||||
}
|
||||
|
||||
var quoteMark = this._determineQuoteMark(options);
|
||||
|
||||
var cssescopts = CSSESC_QUOTE_OPTIONS[quoteMark];
|
||||
var escaped = (0, _cssesc["default"])(this._value, cssescopts);
|
||||
return escaped;
|
||||
};
|
||||
|
||||
_proto._determineQuoteMark = function _determineQuoteMark(options) {
|
||||
return options.smart ? this.smartQuoteMark(options) : this.preferredQuoteMark(options);
|
||||
}
|
||||
/**
|
||||
* Set the unescaped value with the specified quotation options. The value
|
||||
* provided must not include any wrapping quote marks -- those quotes will
|
||||
* be interpreted as part of the value and escaped accordingly.
|
||||
*/
|
||||
;
|
||||
|
||||
_proto.setValue = function setValue(value, options) {
|
||||
if (options === void 0) {
|
||||
options = {};
|
||||
}
|
||||
|
||||
this._value = value;
|
||||
this._quoteMark = this._determineQuoteMark(options);
|
||||
|
||||
this._syncRawValue();
|
||||
}
|
||||
/**
|
||||
* Intelligently select a quoteMark value based on the value's contents. If
|
||||
* the value is a legal CSS ident, it will not be quoted. Otherwise a quote
|
||||
* mark will be picked that minimizes the number of escapes.
|
||||
*
|
||||
* If there's no clear winner, the quote mark from these options is used,
|
||||
* then the source quote mark (this is inverted if `preferCurrentQuoteMark` is
|
||||
* true). If the quoteMark is unspecified, a double quote is used.
|
||||
*
|
||||
* @param options This takes the quoteMark and preferCurrentQuoteMark options
|
||||
* from the quoteValue method.
|
||||
*/
|
||||
;
|
||||
|
||||
_proto.smartQuoteMark = function smartQuoteMark(options) {
|
||||
var v = this.value;
|
||||
var numSingleQuotes = v.replace(/[^']/g, '').length;
|
||||
var numDoubleQuotes = v.replace(/[^"]/g, '').length;
|
||||
|
||||
if (numSingleQuotes + numDoubleQuotes === 0) {
|
||||
var escaped = (0, _cssesc["default"])(v, {
|
||||
isIdentifier: true
|
||||
});
|
||||
|
||||
if (escaped === v) {
|
||||
return Attribute.NO_QUOTE;
|
||||
} else {
|
||||
var pref = this.preferredQuoteMark(options);
|
||||
|
||||
if (pref === Attribute.NO_QUOTE) {
|
||||
// pick a quote mark that isn't none and see if it's smaller
|
||||
var quote = this.quoteMark || options.quoteMark || Attribute.DOUBLE_QUOTE;
|
||||
var opts = CSSESC_QUOTE_OPTIONS[quote];
|
||||
var quoteValue = (0, _cssesc["default"])(v, opts);
|
||||
|
||||
if (quoteValue.length < escaped.length) {
|
||||
return quote;
|
||||
}
|
||||
}
|
||||
|
||||
return pref;
|
||||
}
|
||||
} else if (numDoubleQuotes === numSingleQuotes) {
|
||||
return this.preferredQuoteMark(options);
|
||||
} else if (numDoubleQuotes < numSingleQuotes) {
|
||||
return Attribute.DOUBLE_QUOTE;
|
||||
} else {
|
||||
return Attribute.SINGLE_QUOTE;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Selects the preferred quote mark based on the options and the current quote mark value.
|
||||
* If you want the quote mark to depend on the attribute value, call `smartQuoteMark(opts)`
|
||||
* instead.
|
||||
*/
|
||||
;
|
||||
|
||||
_proto.preferredQuoteMark = function preferredQuoteMark(options) {
|
||||
var quoteMark = options.preferCurrentQuoteMark ? this.quoteMark : options.quoteMark;
|
||||
|
||||
if (quoteMark === undefined) {
|
||||
quoteMark = options.preferCurrentQuoteMark ? options.quoteMark : this.quoteMark;
|
||||
}
|
||||
|
||||
if (quoteMark === undefined) {
|
||||
quoteMark = Attribute.DOUBLE_QUOTE;
|
||||
}
|
||||
|
||||
return quoteMark;
|
||||
};
|
||||
|
||||
_proto._syncRawValue = function _syncRawValue() {
|
||||
var rawValue = (0, _cssesc["default"])(this._value, CSSESC_QUOTE_OPTIONS[this.quoteMark]);
|
||||
|
||||
if (rawValue === this._value) {
|
||||
if (this.raws) {
|
||||
delete this.raws.value;
|
||||
}
|
||||
} else {
|
||||
this.raws.value = rawValue;
|
||||
}
|
||||
};
|
||||
|
||||
_proto._handleEscapes = function _handleEscapes(prop, value) {
|
||||
if (this._constructed) {
|
||||
var escaped = (0, _cssesc["default"])(value, {
|
||||
isIdentifier: true
|
||||
});
|
||||
|
||||
if (escaped !== value) {
|
||||
this.raws[prop] = escaped;
|
||||
} else {
|
||||
delete this.raws[prop];
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
_proto._spacesFor = function _spacesFor(name) {
|
||||
var attrSpaces = {
|
||||
before: '',
|
||||
after: ''
|
||||
};
|
||||
var spaces = this.spaces[name] || {};
|
||||
var rawSpaces = this.raws.spaces && this.raws.spaces[name] || {};
|
||||
return Object.assign(attrSpaces, spaces, rawSpaces);
|
||||
};
|
||||
|
||||
_proto._stringFor = function _stringFor(name, spaceName, concat) {
|
||||
if (spaceName === void 0) {
|
||||
spaceName = name;
|
||||
}
|
||||
|
||||
if (concat === void 0) {
|
||||
concat = defaultAttrConcat;
|
||||
}
|
||||
|
||||
var attrSpaces = this._spacesFor(spaceName);
|
||||
|
||||
return concat(this.stringifyProperty(name), attrSpaces);
|
||||
}
|
||||
/**
|
||||
* returns the offset of the attribute part specified relative to the
|
||||
* start of the node of the output string.
|
||||
*
|
||||
* * "ns" - alias for "namespace"
|
||||
* * "namespace" - the namespace if it exists.
|
||||
* * "attribute" - the attribute name
|
||||
* * "attributeNS" - the start of the attribute or its namespace
|
||||
* * "operator" - the match operator of the attribute
|
||||
* * "value" - The value (string or identifier)
|
||||
* * "insensitive" - the case insensitivity flag;
|
||||
* @param part One of the possible values inside an attribute.
|
||||
* @returns -1 if the name is invalid or the value doesn't exist in this attribute.
|
||||
*/
|
||||
;
|
||||
|
||||
_proto.offsetOf = function offsetOf(name) {
|
||||
var count = 1;
|
||||
|
||||
var attributeSpaces = this._spacesFor("attribute");
|
||||
|
||||
count += attributeSpaces.before.length;
|
||||
|
||||
if (name === "namespace" || name === "ns") {
|
||||
return this.namespace ? count : -1;
|
||||
}
|
||||
|
||||
if (name === "attributeNS") {
|
||||
return count;
|
||||
}
|
||||
|
||||
count += this.namespaceString.length;
|
||||
|
||||
if (this.namespace) {
|
||||
count += 1;
|
||||
}
|
||||
|
||||
if (name === "attribute") {
|
||||
return count;
|
||||
}
|
||||
|
||||
count += this.stringifyProperty("attribute").length;
|
||||
count += attributeSpaces.after.length;
|
||||
|
||||
var operatorSpaces = this._spacesFor("operator");
|
||||
|
||||
count += operatorSpaces.before.length;
|
||||
var operator = this.stringifyProperty("operator");
|
||||
|
||||
if (name === "operator") {
|
||||
return operator ? count : -1;
|
||||
}
|
||||
|
||||
count += operator.length;
|
||||
count += operatorSpaces.after.length;
|
||||
|
||||
var valueSpaces = this._spacesFor("value");
|
||||
|
||||
count += valueSpaces.before.length;
|
||||
var value = this.stringifyProperty("value");
|
||||
|
||||
if (name === "value") {
|
||||
return value ? count : -1;
|
||||
}
|
||||
|
||||
count += value.length;
|
||||
count += valueSpaces.after.length;
|
||||
|
||||
var insensitiveSpaces = this._spacesFor("insensitive");
|
||||
|
||||
count += insensitiveSpaces.before.length;
|
||||
|
||||
if (name === "insensitive") {
|
||||
return this.insensitive ? count : -1;
|
||||
}
|
||||
|
||||
return -1;
|
||||
};
|
||||
|
||||
_proto.toString = function toString() {
|
||||
var _this2 = this;
|
||||
|
||||
var selector = [this.rawSpaceBefore, '['];
|
||||
selector.push(this._stringFor('qualifiedAttribute', 'attribute'));
|
||||
|
||||
if (this.operator && (this.value || this.value === '')) {
|
||||
selector.push(this._stringFor('operator'));
|
||||
selector.push(this._stringFor('value'));
|
||||
selector.push(this._stringFor('insensitiveFlag', 'insensitive', function (attrValue, attrSpaces) {
|
||||
if (attrValue.length > 0 && !_this2.quoted && attrSpaces.before.length === 0 && !(_this2.spaces.value && _this2.spaces.value.after)) {
|
||||
attrSpaces.before = " ";
|
||||
}
|
||||
|
||||
return defaultAttrConcat(attrValue, attrSpaces);
|
||||
}));
|
||||
}
|
||||
|
||||
selector.push(']');
|
||||
selector.push(this.rawSpaceAfter);
|
||||
return selector.join('');
|
||||
};
|
||||
|
||||
_createClass(Attribute, [{
|
||||
key: "quoted",
|
||||
get: function get() {
|
||||
var qm = this.quoteMark;
|
||||
return qm === "'" || qm === '"';
|
||||
},
|
||||
set: function set(value) {
|
||||
warnOfDeprecatedQuotedAssignment();
|
||||
}
|
||||
/**
|
||||
* returns a single (`'`) or double (`"`) quote character if the value is quoted.
|
||||
* returns `null` if the value is not quoted.
|
||||
* returns `undefined` if the quotation state is unknown (this can happen when
|
||||
* the attribute is constructed without specifying a quote mark.)
|
||||
*/
|
||||
|
||||
}, {
|
||||
key: "quoteMark",
|
||||
get: function get() {
|
||||
return this._quoteMark;
|
||||
}
|
||||
/**
|
||||
* Set the quote mark to be used by this attribute's value.
|
||||
* If the quote mark changes, the raw (escaped) value at `attr.raws.value` of the attribute
|
||||
* value is updated accordingly.
|
||||
*
|
||||
* @param {"'" | '"' | null} quoteMark The quote mark or `null` if the value should be unquoted.
|
||||
*/
|
||||
,
|
||||
set: function set(quoteMark) {
|
||||
if (!this._constructed) {
|
||||
this._quoteMark = quoteMark;
|
||||
return;
|
||||
}
|
||||
|
||||
if (this._quoteMark !== quoteMark) {
|
||||
this._quoteMark = quoteMark;
|
||||
|
||||
this._syncRawValue();
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "qualifiedAttribute",
|
||||
get: function get() {
|
||||
return this.qualifiedName(this.raws.attribute || this.attribute);
|
||||
}
|
||||
}, {
|
||||
key: "insensitiveFlag",
|
||||
get: function get() {
|
||||
return this.insensitive ? 'i' : '';
|
||||
}
|
||||
}, {
|
||||
key: "value",
|
||||
get: function get() {
|
||||
return this._value;
|
||||
}
|
||||
/**
|
||||
* Before 3.0, the value had to be set to an escaped value including any wrapped
|
||||
* quote marks. In 3.0, the semantics of `Attribute.value` changed so that the value
|
||||
* is unescaped during parsing and any quote marks are removed.
|
||||
*
|
||||
* Because the ambiguity of this semantic change, if you set `attr.value = newValue`,
|
||||
* a deprecation warning is raised when the new value contains any characters that would
|
||||
* require escaping (including if it contains wrapped quotes).
|
||||
*
|
||||
* Instead, you should call `attr.setValue(newValue, opts)` and pass options that describe
|
||||
* how the new value is quoted.
|
||||
*/
|
||||
,
|
||||
set: function set(v) {
|
||||
if (this._constructed) {
|
||||
var _unescapeValue2 = unescapeValue(v),
|
||||
deprecatedUsage = _unescapeValue2.deprecatedUsage,
|
||||
unescaped = _unescapeValue2.unescaped,
|
||||
quoteMark = _unescapeValue2.quoteMark;
|
||||
|
||||
if (deprecatedUsage) {
|
||||
warnOfDeprecatedValueAssignment();
|
||||
}
|
||||
|
||||
if (unescaped === this._value && quoteMark === this._quoteMark) {
|
||||
return;
|
||||
}
|
||||
|
||||
this._value = unescaped;
|
||||
this._quoteMark = quoteMark;
|
||||
|
||||
this._syncRawValue();
|
||||
} else {
|
||||
this._value = v;
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "attribute",
|
||||
get: function get() {
|
||||
return this._attribute;
|
||||
},
|
||||
set: function set(name) {
|
||||
this._handleEscapes("attribute", name);
|
||||
|
||||
this._attribute = name;
|
||||
}
|
||||
}]);
|
||||
|
||||
return Attribute;
|
||||
}(_namespace["default"]);
|
||||
|
||||
exports["default"] = Attribute;
|
||||
Attribute.NO_QUOTE = null;
|
||||
Attribute.SINGLE_QUOTE = "'";
|
||||
Attribute.DOUBLE_QUOTE = '"';
|
||||
var CSSESC_QUOTE_OPTIONS = (_CSSESC_QUOTE_OPTIONS = {
|
||||
"'": {
|
||||
quotes: 'single',
|
||||
wrap: true
|
||||
},
|
||||
'"': {
|
||||
quotes: 'double',
|
||||
wrap: true
|
||||
}
|
||||
}, _CSSESC_QUOTE_OPTIONS[null] = {
|
||||
isIdentifier: true
|
||||
}, _CSSESC_QUOTE_OPTIONS);
|
||||
|
||||
function defaultAttrConcat(attrValue, attrSpaces) {
|
||||
return "" + attrSpaces.before + attrValue + attrSpaces.after;
|
||||
}
|
69
node_modules/@tailwindcss/typography/node_modules/postcss-selector-parser/dist/selectors/className.js
generated
vendored
Normal file
69
node_modules/@tailwindcss/typography/node_modules/postcss-selector-parser/dist/selectors/className.js
generated
vendored
Normal file
@ -0,0 +1,69 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports["default"] = void 0;
|
||||
|
||||
var _cssesc = _interopRequireDefault(require("cssesc"));
|
||||
|
||||
var _util = require("../util");
|
||||
|
||||
var _node = _interopRequireDefault(require("./node"));
|
||||
|
||||
var _types = require("./types");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
|
||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
||||
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
||||
|
||||
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
|
||||
|
||||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
||||
|
||||
var ClassName = /*#__PURE__*/function (_Node) {
|
||||
_inheritsLoose(ClassName, _Node);
|
||||
|
||||
function ClassName(opts) {
|
||||
var _this;
|
||||
|
||||
_this = _Node.call(this, opts) || this;
|
||||
_this.type = _types.CLASS;
|
||||
_this._constructed = true;
|
||||
return _this;
|
||||
}
|
||||
|
||||
var _proto = ClassName.prototype;
|
||||
|
||||
_proto.valueToString = function valueToString() {
|
||||
return '.' + _Node.prototype.valueToString.call(this);
|
||||
};
|
||||
|
||||
_createClass(ClassName, [{
|
||||
key: "value",
|
||||
get: function get() {
|
||||
return this._value;
|
||||
},
|
||||
set: function set(v) {
|
||||
if (this._constructed) {
|
||||
var escaped = (0, _cssesc["default"])(v, {
|
||||
isIdentifier: true
|
||||
});
|
||||
|
||||
if (escaped !== v) {
|
||||
(0, _util.ensureObject)(this, "raws");
|
||||
this.raws.value = escaped;
|
||||
} else if (this.raws) {
|
||||
delete this.raws.value;
|
||||
}
|
||||
}
|
||||
|
||||
this._value = v;
|
||||
}
|
||||
}]);
|
||||
|
||||
return ClassName;
|
||||
}(_node["default"]);
|
||||
|
||||
exports["default"] = ClassName;
|
||||
module.exports = exports.default;
|
31
node_modules/@tailwindcss/typography/node_modules/postcss-selector-parser/dist/selectors/combinator.js
generated
vendored
Normal file
31
node_modules/@tailwindcss/typography/node_modules/postcss-selector-parser/dist/selectors/combinator.js
generated
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports["default"] = void 0;
|
||||
|
||||
var _node = _interopRequireDefault(require("./node"));
|
||||
|
||||
var _types = require("./types");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
|
||||
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
|
||||
|
||||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
||||
|
||||
var Combinator = /*#__PURE__*/function (_Node) {
|
||||
_inheritsLoose(Combinator, _Node);
|
||||
|
||||
function Combinator(opts) {
|
||||
var _this;
|
||||
|
||||
_this = _Node.call(this, opts) || this;
|
||||
_this.type = _types.COMBINATOR;
|
||||
return _this;
|
||||
}
|
||||
|
||||
return Combinator;
|
||||
}(_node["default"]);
|
||||
|
||||
exports["default"] = Combinator;
|
||||
module.exports = exports.default;
|
31
node_modules/@tailwindcss/typography/node_modules/postcss-selector-parser/dist/selectors/comment.js
generated
vendored
Normal file
31
node_modules/@tailwindcss/typography/node_modules/postcss-selector-parser/dist/selectors/comment.js
generated
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports["default"] = void 0;
|
||||
|
||||
var _node = _interopRequireDefault(require("./node"));
|
||||
|
||||
var _types = require("./types");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
|
||||
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
|
||||
|
||||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
||||
|
||||
var Comment = /*#__PURE__*/function (_Node) {
|
||||
_inheritsLoose(Comment, _Node);
|
||||
|
||||
function Comment(opts) {
|
||||
var _this;
|
||||
|
||||
_this = _Node.call(this, opts) || this;
|
||||
_this.type = _types.COMMENT;
|
||||
return _this;
|
||||
}
|
||||
|
||||
return Comment;
|
||||
}(_node["default"]);
|
||||
|
||||
exports["default"] = Comment;
|
||||
module.exports = exports.default;
|
102
node_modules/@tailwindcss/typography/node_modules/postcss-selector-parser/dist/selectors/constructors.js
generated
vendored
Normal file
102
node_modules/@tailwindcss/typography/node_modules/postcss-selector-parser/dist/selectors/constructors.js
generated
vendored
Normal file
@ -0,0 +1,102 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.universal = exports.tag = exports.string = exports.selector = exports.root = exports.pseudo = exports.nesting = exports.id = exports.comment = exports.combinator = exports.className = exports.attribute = void 0;
|
||||
|
||||
var _attribute = _interopRequireDefault(require("./attribute"));
|
||||
|
||||
var _className = _interopRequireDefault(require("./className"));
|
||||
|
||||
var _combinator = _interopRequireDefault(require("./combinator"));
|
||||
|
||||
var _comment = _interopRequireDefault(require("./comment"));
|
||||
|
||||
var _id = _interopRequireDefault(require("./id"));
|
||||
|
||||
var _nesting = _interopRequireDefault(require("./nesting"));
|
||||
|
||||
var _pseudo = _interopRequireDefault(require("./pseudo"));
|
||||
|
||||
var _root = _interopRequireDefault(require("./root"));
|
||||
|
||||
var _selector = _interopRequireDefault(require("./selector"));
|
||||
|
||||
var _string = _interopRequireDefault(require("./string"));
|
||||
|
||||
var _tag = _interopRequireDefault(require("./tag"));
|
||||
|
||||
var _universal = _interopRequireDefault(require("./universal"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
|
||||
var attribute = function attribute(opts) {
|
||||
return new _attribute["default"](opts);
|
||||
};
|
||||
|
||||
exports.attribute = attribute;
|
||||
|
||||
var className = function className(opts) {
|
||||
return new _className["default"](opts);
|
||||
};
|
||||
|
||||
exports.className = className;
|
||||
|
||||
var combinator = function combinator(opts) {
|
||||
return new _combinator["default"](opts);
|
||||
};
|
||||
|
||||
exports.combinator = combinator;
|
||||
|
||||
var comment = function comment(opts) {
|
||||
return new _comment["default"](opts);
|
||||
};
|
||||
|
||||
exports.comment = comment;
|
||||
|
||||
var id = function id(opts) {
|
||||
return new _id["default"](opts);
|
||||
};
|
||||
|
||||
exports.id = id;
|
||||
|
||||
var nesting = function nesting(opts) {
|
||||
return new _nesting["default"](opts);
|
||||
};
|
||||
|
||||
exports.nesting = nesting;
|
||||
|
||||
var pseudo = function pseudo(opts) {
|
||||
return new _pseudo["default"](opts);
|
||||
};
|
||||
|
||||
exports.pseudo = pseudo;
|
||||
|
||||
var root = function root(opts) {
|
||||
return new _root["default"](opts);
|
||||
};
|
||||
|
||||
exports.root = root;
|
||||
|
||||
var selector = function selector(opts) {
|
||||
return new _selector["default"](opts);
|
||||
};
|
||||
|
||||
exports.selector = selector;
|
||||
|
||||
var string = function string(opts) {
|
||||
return new _string["default"](opts);
|
||||
};
|
||||
|
||||
exports.string = string;
|
||||
|
||||
var tag = function tag(opts) {
|
||||
return new _tag["default"](opts);
|
||||
};
|
||||
|
||||
exports.tag = tag;
|
||||
|
||||
var universal = function universal(opts) {
|
||||
return new _universal["default"](opts);
|
||||
};
|
||||
|
||||
exports.universal = universal;
|
395
node_modules/@tailwindcss/typography/node_modules/postcss-selector-parser/dist/selectors/container.js
generated
vendored
Normal file
395
node_modules/@tailwindcss/typography/node_modules/postcss-selector-parser/dist/selectors/container.js
generated
vendored
Normal file
@ -0,0 +1,395 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports["default"] = void 0;
|
||||
|
||||
var _node = _interopRequireDefault(require("./node"));
|
||||
|
||||
var types = _interopRequireWildcard(require("./types"));
|
||||
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
|
||||
function _createForOfIteratorHelperLoose(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; return function () { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } it = o[Symbol.iterator](); return it.next.bind(it); }
|
||||
|
||||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
||||
|
||||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
||||
|
||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
||||
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
||||
|
||||
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
|
||||
|
||||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
||||
|
||||
var Container = /*#__PURE__*/function (_Node) {
|
||||
_inheritsLoose(Container, _Node);
|
||||
|
||||
function Container(opts) {
|
||||
var _this;
|
||||
|
||||
_this = _Node.call(this, opts) || this;
|
||||
|
||||
if (!_this.nodes) {
|
||||
_this.nodes = [];
|
||||
}
|
||||
|
||||
return _this;
|
||||
}
|
||||
|
||||
var _proto = Container.prototype;
|
||||
|
||||
_proto.append = function append(selector) {
|
||||
selector.parent = this;
|
||||
this.nodes.push(selector);
|
||||
return this;
|
||||
};
|
||||
|
||||
_proto.prepend = function prepend(selector) {
|
||||
selector.parent = this;
|
||||
this.nodes.unshift(selector);
|
||||
return this;
|
||||
};
|
||||
|
||||
_proto.at = function at(index) {
|
||||
return this.nodes[index];
|
||||
};
|
||||
|
||||
_proto.index = function index(child) {
|
||||
if (typeof child === 'number') {
|
||||
return child;
|
||||
}
|
||||
|
||||
return this.nodes.indexOf(child);
|
||||
};
|
||||
|
||||
_proto.removeChild = function removeChild(child) {
|
||||
child = this.index(child);
|
||||
this.at(child).parent = undefined;
|
||||
this.nodes.splice(child, 1);
|
||||
var index;
|
||||
|
||||
for (var id in this.indexes) {
|
||||
index = this.indexes[id];
|
||||
|
||||
if (index >= child) {
|
||||
this.indexes[id] = index - 1;
|
||||
}
|
||||
}
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
_proto.removeAll = function removeAll() {
|
||||
for (var _iterator = _createForOfIteratorHelperLoose(this.nodes), _step; !(_step = _iterator()).done;) {
|
||||
var node = _step.value;
|
||||
node.parent = undefined;
|
||||
}
|
||||
|
||||
this.nodes = [];
|
||||
return this;
|
||||
};
|
||||
|
||||
_proto.empty = function empty() {
|
||||
return this.removeAll();
|
||||
};
|
||||
|
||||
_proto.insertAfter = function insertAfter(oldNode, newNode) {
|
||||
newNode.parent = this;
|
||||
var oldIndex = this.index(oldNode);
|
||||
this.nodes.splice(oldIndex + 1, 0, newNode);
|
||||
newNode.parent = this;
|
||||
var index;
|
||||
|
||||
for (var id in this.indexes) {
|
||||
index = this.indexes[id];
|
||||
|
||||
if (oldIndex <= index) {
|
||||
this.indexes[id] = index + 1;
|
||||
}
|
||||
}
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
_proto.insertBefore = function insertBefore(oldNode, newNode) {
|
||||
newNode.parent = this;
|
||||
var oldIndex = this.index(oldNode);
|
||||
this.nodes.splice(oldIndex, 0, newNode);
|
||||
newNode.parent = this;
|
||||
var index;
|
||||
|
||||
for (var id in this.indexes) {
|
||||
index = this.indexes[id];
|
||||
|
||||
if (index <= oldIndex) {
|
||||
this.indexes[id] = index + 1;
|
||||
}
|
||||
}
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
_proto._findChildAtPosition = function _findChildAtPosition(line, col) {
|
||||
var found = undefined;
|
||||
this.each(function (node) {
|
||||
if (node.atPosition) {
|
||||
var foundChild = node.atPosition(line, col);
|
||||
|
||||
if (foundChild) {
|
||||
found = foundChild;
|
||||
return false;
|
||||
}
|
||||
} else if (node.isAtPosition(line, col)) {
|
||||
found = node;
|
||||
return false;
|
||||
}
|
||||
});
|
||||
return found;
|
||||
}
|
||||
/**
|
||||
* Return the most specific node at the line and column number given.
|
||||
* The source location is based on the original parsed location, locations aren't
|
||||
* updated as selector nodes are mutated.
|
||||
*
|
||||
* Note that this location is relative to the location of the first character
|
||||
* of the selector, and not the location of the selector in the overall document
|
||||
* when used in conjunction with postcss.
|
||||
*
|
||||
* If not found, returns undefined.
|
||||
* @param {number} line The line number of the node to find. (1-based index)
|
||||
* @param {number} col The column number of the node to find. (1-based index)
|
||||
*/
|
||||
;
|
||||
|
||||
_proto.atPosition = function atPosition(line, col) {
|
||||
if (this.isAtPosition(line, col)) {
|
||||
return this._findChildAtPosition(line, col) || this;
|
||||
} else {
|
||||
return undefined;
|
||||
}
|
||||
};
|
||||
|
||||
_proto._inferEndPosition = function _inferEndPosition() {
|
||||
if (this.last && this.last.source && this.last.source.end) {
|
||||
this.source = this.source || {};
|
||||
this.source.end = this.source.end || {};
|
||||
Object.assign(this.source.end, this.last.source.end);
|
||||
}
|
||||
};
|
||||
|
||||
_proto.each = function each(callback) {
|
||||
if (!this.lastEach) {
|
||||
this.lastEach = 0;
|
||||
}
|
||||
|
||||
if (!this.indexes) {
|
||||
this.indexes = {};
|
||||
}
|
||||
|
||||
this.lastEach++;
|
||||
var id = this.lastEach;
|
||||
this.indexes[id] = 0;
|
||||
|
||||
if (!this.length) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
var index, result;
|
||||
|
||||
while (this.indexes[id] < this.length) {
|
||||
index = this.indexes[id];
|
||||
result = callback(this.at(index), index);
|
||||
|
||||
if (result === false) {
|
||||
break;
|
||||
}
|
||||
|
||||
this.indexes[id] += 1;
|
||||
}
|
||||
|
||||
delete this.indexes[id];
|
||||
|
||||
if (result === false) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
_proto.walk = function walk(callback) {
|
||||
return this.each(function (node, i) {
|
||||
var result = callback(node, i);
|
||||
|
||||
if (result !== false && node.length) {
|
||||
result = node.walk(callback);
|
||||
}
|
||||
|
||||
if (result === false) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
_proto.walkAttributes = function walkAttributes(callback) {
|
||||
var _this2 = this;
|
||||
|
||||
return this.walk(function (selector) {
|
||||
if (selector.type === types.ATTRIBUTE) {
|
||||
return callback.call(_this2, selector);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
_proto.walkClasses = function walkClasses(callback) {
|
||||
var _this3 = this;
|
||||
|
||||
return this.walk(function (selector) {
|
||||
if (selector.type === types.CLASS) {
|
||||
return callback.call(_this3, selector);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
_proto.walkCombinators = function walkCombinators(callback) {
|
||||
var _this4 = this;
|
||||
|
||||
return this.walk(function (selector) {
|
||||
if (selector.type === types.COMBINATOR) {
|
||||
return callback.call(_this4, selector);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
_proto.walkComments = function walkComments(callback) {
|
||||
var _this5 = this;
|
||||
|
||||
return this.walk(function (selector) {
|
||||
if (selector.type === types.COMMENT) {
|
||||
return callback.call(_this5, selector);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
_proto.walkIds = function walkIds(callback) {
|
||||
var _this6 = this;
|
||||
|
||||
return this.walk(function (selector) {
|
||||
if (selector.type === types.ID) {
|
||||
return callback.call(_this6, selector);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
_proto.walkNesting = function walkNesting(callback) {
|
||||
var _this7 = this;
|
||||
|
||||
return this.walk(function (selector) {
|
||||
if (selector.type === types.NESTING) {
|
||||
return callback.call(_this7, selector);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
_proto.walkPseudos = function walkPseudos(callback) {
|
||||
var _this8 = this;
|
||||
|
||||
return this.walk(function (selector) {
|
||||
if (selector.type === types.PSEUDO) {
|
||||
return callback.call(_this8, selector);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
_proto.walkTags = function walkTags(callback) {
|
||||
var _this9 = this;
|
||||
|
||||
return this.walk(function (selector) {
|
||||
if (selector.type === types.TAG) {
|
||||
return callback.call(_this9, selector);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
_proto.walkUniversals = function walkUniversals(callback) {
|
||||
var _this10 = this;
|
||||
|
||||
return this.walk(function (selector) {
|
||||
if (selector.type === types.UNIVERSAL) {
|
||||
return callback.call(_this10, selector);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
_proto.split = function split(callback) {
|
||||
var _this11 = this;
|
||||
|
||||
var current = [];
|
||||
return this.reduce(function (memo, node, index) {
|
||||
var split = callback.call(_this11, node);
|
||||
current.push(node);
|
||||
|
||||
if (split) {
|
||||
memo.push(current);
|
||||
current = [];
|
||||
} else if (index === _this11.length - 1) {
|
||||
memo.push(current);
|
||||
}
|
||||
|
||||
return memo;
|
||||
}, []);
|
||||
};
|
||||
|
||||
_proto.map = function map(callback) {
|
||||
return this.nodes.map(callback);
|
||||
};
|
||||
|
||||
_proto.reduce = function reduce(callback, memo) {
|
||||
return this.nodes.reduce(callback, memo);
|
||||
};
|
||||
|
||||
_proto.every = function every(callback) {
|
||||
return this.nodes.every(callback);
|
||||
};
|
||||
|
||||
_proto.some = function some(callback) {
|
||||
return this.nodes.some(callback);
|
||||
};
|
||||
|
||||
_proto.filter = function filter(callback) {
|
||||
return this.nodes.filter(callback);
|
||||
};
|
||||
|
||||
_proto.sort = function sort(callback) {
|
||||
return this.nodes.sort(callback);
|
||||
};
|
||||
|
||||
_proto.toString = function toString() {
|
||||
return this.map(String).join('');
|
||||
};
|
||||
|
||||
_createClass(Container, [{
|
||||
key: "first",
|
||||
get: function get() {
|
||||
return this.at(0);
|
||||
}
|
||||
}, {
|
||||
key: "last",
|
||||
get: function get() {
|
||||
return this.at(this.length - 1);
|
||||
}
|
||||
}, {
|
||||
key: "length",
|
||||
get: function get() {
|
||||
return this.nodes.length;
|
||||
}
|
||||
}]);
|
||||
|
||||
return Container;
|
||||
}(_node["default"]);
|
||||
|
||||
exports["default"] = Container;
|
||||
module.exports = exports.default;
|
64
node_modules/@tailwindcss/typography/node_modules/postcss-selector-parser/dist/selectors/guards.js
generated
vendored
Normal file
64
node_modules/@tailwindcss/typography/node_modules/postcss-selector-parser/dist/selectors/guards.js
generated
vendored
Normal file
@ -0,0 +1,64 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.isNode = isNode;
|
||||
exports.isPseudoElement = isPseudoElement;
|
||||
exports.isPseudoClass = isPseudoClass;
|
||||
exports.isContainer = isContainer;
|
||||
exports.isNamespace = isNamespace;
|
||||
exports.isUniversal = exports.isTag = exports.isString = exports.isSelector = exports.isRoot = exports.isPseudo = exports.isNesting = exports.isIdentifier = exports.isComment = exports.isCombinator = exports.isClassName = exports.isAttribute = void 0;
|
||||
|
||||
var _types = require("./types");
|
||||
|
||||
var _IS_TYPE;
|
||||
|
||||
var IS_TYPE = (_IS_TYPE = {}, _IS_TYPE[_types.ATTRIBUTE] = true, _IS_TYPE[_types.CLASS] = true, _IS_TYPE[_types.COMBINATOR] = true, _IS_TYPE[_types.COMMENT] = true, _IS_TYPE[_types.ID] = true, _IS_TYPE[_types.NESTING] = true, _IS_TYPE[_types.PSEUDO] = true, _IS_TYPE[_types.ROOT] = true, _IS_TYPE[_types.SELECTOR] = true, _IS_TYPE[_types.STRING] = true, _IS_TYPE[_types.TAG] = true, _IS_TYPE[_types.UNIVERSAL] = true, _IS_TYPE);
|
||||
|
||||
function isNode(node) {
|
||||
return typeof node === "object" && IS_TYPE[node.type];
|
||||
}
|
||||
|
||||
function isNodeType(type, node) {
|
||||
return isNode(node) && node.type === type;
|
||||
}
|
||||
|
||||
var isAttribute = isNodeType.bind(null, _types.ATTRIBUTE);
|
||||
exports.isAttribute = isAttribute;
|
||||
var isClassName = isNodeType.bind(null, _types.CLASS);
|
||||
exports.isClassName = isClassName;
|
||||
var isCombinator = isNodeType.bind(null, _types.COMBINATOR);
|
||||
exports.isCombinator = isCombinator;
|
||||
var isComment = isNodeType.bind(null, _types.COMMENT);
|
||||
exports.isComment = isComment;
|
||||
var isIdentifier = isNodeType.bind(null, _types.ID);
|
||||
exports.isIdentifier = isIdentifier;
|
||||
var isNesting = isNodeType.bind(null, _types.NESTING);
|
||||
exports.isNesting = isNesting;
|
||||
var isPseudo = isNodeType.bind(null, _types.PSEUDO);
|
||||
exports.isPseudo = isPseudo;
|
||||
var isRoot = isNodeType.bind(null, _types.ROOT);
|
||||
exports.isRoot = isRoot;
|
||||
var isSelector = isNodeType.bind(null, _types.SELECTOR);
|
||||
exports.isSelector = isSelector;
|
||||
var isString = isNodeType.bind(null, _types.STRING);
|
||||
exports.isString = isString;
|
||||
var isTag = isNodeType.bind(null, _types.TAG);
|
||||
exports.isTag = isTag;
|
||||
var isUniversal = isNodeType.bind(null, _types.UNIVERSAL);
|
||||
exports.isUniversal = isUniversal;
|
||||
|
||||
function isPseudoElement(node) {
|
||||
return isPseudo(node) && node.value && (node.value.startsWith("::") || node.value.toLowerCase() === ":before" || node.value.toLowerCase() === ":after" || node.value.toLowerCase() === ":first-letter" || node.value.toLowerCase() === ":first-line");
|
||||
}
|
||||
|
||||
function isPseudoClass(node) {
|
||||
return isPseudo(node) && !isPseudoElement(node);
|
||||
}
|
||||
|
||||
function isContainer(node) {
|
||||
return !!(isNode(node) && node.walk);
|
||||
}
|
||||
|
||||
function isNamespace(node) {
|
||||
return isAttribute(node) || isTag(node);
|
||||
}
|
37
node_modules/@tailwindcss/typography/node_modules/postcss-selector-parser/dist/selectors/id.js
generated
vendored
Normal file
37
node_modules/@tailwindcss/typography/node_modules/postcss-selector-parser/dist/selectors/id.js
generated
vendored
Normal file
@ -0,0 +1,37 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports["default"] = void 0;
|
||||
|
||||
var _node = _interopRequireDefault(require("./node"));
|
||||
|
||||
var _types = require("./types");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
|
||||
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
|
||||
|
||||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
||||
|
||||
var ID = /*#__PURE__*/function (_Node) {
|
||||
_inheritsLoose(ID, _Node);
|
||||
|
||||
function ID(opts) {
|
||||
var _this;
|
||||
|
||||
_this = _Node.call(this, opts) || this;
|
||||
_this.type = _types.ID;
|
||||
return _this;
|
||||
}
|
||||
|
||||
var _proto = ID.prototype;
|
||||
|
||||
_proto.valueToString = function valueToString() {
|
||||
return '#' + _Node.prototype.valueToString.call(this);
|
||||
};
|
||||
|
||||
return ID;
|
||||
}(_node["default"]);
|
||||
|
||||
exports["default"] = ID;
|
||||
module.exports = exports.default;
|
27
node_modules/@tailwindcss/typography/node_modules/postcss-selector-parser/dist/selectors/index.js
generated
vendored
Normal file
27
node_modules/@tailwindcss/typography/node_modules/postcss-selector-parser/dist/selectors/index.js
generated
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
var _types = require("./types");
|
||||
|
||||
Object.keys(_types).forEach(function (key) {
|
||||
if (key === "default" || key === "__esModule") return;
|
||||
if (key in exports && exports[key] === _types[key]) return;
|
||||
exports[key] = _types[key];
|
||||
});
|
||||
|
||||
var _constructors = require("./constructors");
|
||||
|
||||
Object.keys(_constructors).forEach(function (key) {
|
||||
if (key === "default" || key === "__esModule") return;
|
||||
if (key in exports && exports[key] === _constructors[key]) return;
|
||||
exports[key] = _constructors[key];
|
||||
});
|
||||
|
||||
var _guards = require("./guards");
|
||||
|
||||
Object.keys(_guards).forEach(function (key) {
|
||||
if (key === "default" || key === "__esModule") return;
|
||||
if (key in exports && exports[key] === _guards[key]) return;
|
||||
exports[key] = _guards[key];
|
||||
});
|
101
node_modules/@tailwindcss/typography/node_modules/postcss-selector-parser/dist/selectors/namespace.js
generated
vendored
Normal file
101
node_modules/@tailwindcss/typography/node_modules/postcss-selector-parser/dist/selectors/namespace.js
generated
vendored
Normal file
@ -0,0 +1,101 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports["default"] = void 0;
|
||||
|
||||
var _cssesc = _interopRequireDefault(require("cssesc"));
|
||||
|
||||
var _util = require("../util");
|
||||
|
||||
var _node = _interopRequireDefault(require("./node"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
|
||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
||||
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
||||
|
||||
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
|
||||
|
||||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
||||
|
||||
var Namespace = /*#__PURE__*/function (_Node) {
|
||||
_inheritsLoose(Namespace, _Node);
|
||||
|
||||
function Namespace() {
|
||||
return _Node.apply(this, arguments) || this;
|
||||
}
|
||||
|
||||
var _proto = Namespace.prototype;
|
||||
|
||||
_proto.qualifiedName = function qualifiedName(value) {
|
||||
if (this.namespace) {
|
||||
return this.namespaceString + "|" + value;
|
||||
} else {
|
||||
return value;
|
||||
}
|
||||
};
|
||||
|
||||
_proto.valueToString = function valueToString() {
|
||||
return this.qualifiedName(_Node.prototype.valueToString.call(this));
|
||||
};
|
||||
|
||||
_createClass(Namespace, [{
|
||||
key: "namespace",
|
||||
get: function get() {
|
||||
return this._namespace;
|
||||
},
|
||||
set: function set(namespace) {
|
||||
if (namespace === true || namespace === "*" || namespace === "&") {
|
||||
this._namespace = namespace;
|
||||
|
||||
if (this.raws) {
|
||||
delete this.raws.namespace;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
var escaped = (0, _cssesc["default"])(namespace, {
|
||||
isIdentifier: true
|
||||
});
|
||||
this._namespace = namespace;
|
||||
|
||||
if (escaped !== namespace) {
|
||||
(0, _util.ensureObject)(this, "raws");
|
||||
this.raws.namespace = escaped;
|
||||
} else if (this.raws) {
|
||||
delete this.raws.namespace;
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "ns",
|
||||
get: function get() {
|
||||
return this._namespace;
|
||||
},
|
||||
set: function set(namespace) {
|
||||
this.namespace = namespace;
|
||||
}
|
||||
}, {
|
||||
key: "namespaceString",
|
||||
get: function get() {
|
||||
if (this.namespace) {
|
||||
var ns = this.stringifyProperty("namespace");
|
||||
|
||||
if (ns === true) {
|
||||
return '';
|
||||
} else {
|
||||
return ns;
|
||||
}
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
}]);
|
||||
|
||||
return Namespace;
|
||||
}(_node["default"]);
|
||||
|
||||
exports["default"] = Namespace;
|
||||
;
|
||||
module.exports = exports.default;
|
32
node_modules/@tailwindcss/typography/node_modules/postcss-selector-parser/dist/selectors/nesting.js
generated
vendored
Normal file
32
node_modules/@tailwindcss/typography/node_modules/postcss-selector-parser/dist/selectors/nesting.js
generated
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports["default"] = void 0;
|
||||
|
||||
var _node = _interopRequireDefault(require("./node"));
|
||||
|
||||
var _types = require("./types");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
|
||||
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
|
||||
|
||||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
||||
|
||||
var Nesting = /*#__PURE__*/function (_Node) {
|
||||
_inheritsLoose(Nesting, _Node);
|
||||
|
||||
function Nesting(opts) {
|
||||
var _this;
|
||||
|
||||
_this = _Node.call(this, opts) || this;
|
||||
_this.type = _types.NESTING;
|
||||
_this.value = '&';
|
||||
return _this;
|
||||
}
|
||||
|
||||
return Nesting;
|
||||
}(_node["default"]);
|
||||
|
||||
exports["default"] = Nesting;
|
||||
module.exports = exports.default;
|
239
node_modules/@tailwindcss/typography/node_modules/postcss-selector-parser/dist/selectors/node.js
generated
vendored
Normal file
239
node_modules/@tailwindcss/typography/node_modules/postcss-selector-parser/dist/selectors/node.js
generated
vendored
Normal file
@ -0,0 +1,239 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports["default"] = void 0;
|
||||
|
||||
var _util = require("../util");
|
||||
|
||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
||||
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
||||
|
||||
var cloneNode = function cloneNode(obj, parent) {
|
||||
if (typeof obj !== 'object' || obj === null) {
|
||||
return obj;
|
||||
}
|
||||
|
||||
var cloned = new obj.constructor();
|
||||
|
||||
for (var i in obj) {
|
||||
if (!obj.hasOwnProperty(i)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
var value = obj[i];
|
||||
var type = typeof value;
|
||||
|
||||
if (i === 'parent' && type === 'object') {
|
||||
if (parent) {
|
||||
cloned[i] = parent;
|
||||
}
|
||||
} else if (value instanceof Array) {
|
||||
cloned[i] = value.map(function (j) {
|
||||
return cloneNode(j, cloned);
|
||||
});
|
||||
} else {
|
||||
cloned[i] = cloneNode(value, cloned);
|
||||
}
|
||||
}
|
||||
|
||||
return cloned;
|
||||
};
|
||||
|
||||
var Node = /*#__PURE__*/function () {
|
||||
function Node(opts) {
|
||||
if (opts === void 0) {
|
||||
opts = {};
|
||||
}
|
||||
|
||||
Object.assign(this, opts);
|
||||
this.spaces = this.spaces || {};
|
||||
this.spaces.before = this.spaces.before || '';
|
||||
this.spaces.after = this.spaces.after || '';
|
||||
}
|
||||
|
||||
var _proto = Node.prototype;
|
||||
|
||||
_proto.remove = function remove() {
|
||||
if (this.parent) {
|
||||
this.parent.removeChild(this);
|
||||
}
|
||||
|
||||
this.parent = undefined;
|
||||
return this;
|
||||
};
|
||||
|
||||
_proto.replaceWith = function replaceWith() {
|
||||
if (this.parent) {
|
||||
for (var index in arguments) {
|
||||
this.parent.insertBefore(this, arguments[index]);
|
||||
}
|
||||
|
||||
this.remove();
|
||||
}
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
_proto.next = function next() {
|
||||
return this.parent.at(this.parent.index(this) + 1);
|
||||
};
|
||||
|
||||
_proto.prev = function prev() {
|
||||
return this.parent.at(this.parent.index(this) - 1);
|
||||
};
|
||||
|
||||
_proto.clone = function clone(overrides) {
|
||||
if (overrides === void 0) {
|
||||
overrides = {};
|
||||
}
|
||||
|
||||
var cloned = cloneNode(this);
|
||||
|
||||
for (var name in overrides) {
|
||||
cloned[name] = overrides[name];
|
||||
}
|
||||
|
||||
return cloned;
|
||||
}
|
||||
/**
|
||||
* Some non-standard syntax doesn't follow normal escaping rules for css.
|
||||
* This allows non standard syntax to be appended to an existing property
|
||||
* by specifying the escaped value. By specifying the escaped value,
|
||||
* illegal characters are allowed to be directly inserted into css output.
|
||||
* @param {string} name the property to set
|
||||
* @param {any} value the unescaped value of the property
|
||||
* @param {string} valueEscaped optional. the escaped value of the property.
|
||||
*/
|
||||
;
|
||||
|
||||
_proto.appendToPropertyAndEscape = function appendToPropertyAndEscape(name, value, valueEscaped) {
|
||||
if (!this.raws) {
|
||||
this.raws = {};
|
||||
}
|
||||
|
||||
var originalValue = this[name];
|
||||
var originalEscaped = this.raws[name];
|
||||
this[name] = originalValue + value; // this may trigger a setter that updates raws, so it has to be set first.
|
||||
|
||||
if (originalEscaped || valueEscaped !== value) {
|
||||
this.raws[name] = (originalEscaped || originalValue) + valueEscaped;
|
||||
} else {
|
||||
delete this.raws[name]; // delete any escaped value that was created by the setter.
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Some non-standard syntax doesn't follow normal escaping rules for css.
|
||||
* This allows the escaped value to be specified directly, allowing illegal
|
||||
* characters to be directly inserted into css output.
|
||||
* @param {string} name the property to set
|
||||
* @param {any} value the unescaped value of the property
|
||||
* @param {string} valueEscaped the escaped value of the property.
|
||||
*/
|
||||
;
|
||||
|
||||
_proto.setPropertyAndEscape = function setPropertyAndEscape(name, value, valueEscaped) {
|
||||
if (!this.raws) {
|
||||
this.raws = {};
|
||||
}
|
||||
|
||||
this[name] = value; // this may trigger a setter that updates raws, so it has to be set first.
|
||||
|
||||
this.raws[name] = valueEscaped;
|
||||
}
|
||||
/**
|
||||
* When you want a value to passed through to CSS directly. This method
|
||||
* deletes the corresponding raw value causing the stringifier to fallback
|
||||
* to the unescaped value.
|
||||
* @param {string} name the property to set.
|
||||
* @param {any} value The value that is both escaped and unescaped.
|
||||
*/
|
||||
;
|
||||
|
||||
_proto.setPropertyWithoutEscape = function setPropertyWithoutEscape(name, value) {
|
||||
this[name] = value; // this may trigger a setter that updates raws, so it has to be set first.
|
||||
|
||||
if (this.raws) {
|
||||
delete this.raws[name];
|
||||
}
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param {number} line The number (starting with 1)
|
||||
* @param {number} column The column number (starting with 1)
|
||||
*/
|
||||
;
|
||||
|
||||
_proto.isAtPosition = function isAtPosition(line, column) {
|
||||
if (this.source && this.source.start && this.source.end) {
|
||||
if (this.source.start.line > line) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.source.end.line < line) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.source.start.line === line && this.source.start.column > column) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.source.end.line === line && this.source.end.column < column) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return undefined;
|
||||
};
|
||||
|
||||
_proto.stringifyProperty = function stringifyProperty(name) {
|
||||
return this.raws && this.raws[name] || this[name];
|
||||
};
|
||||
|
||||
_proto.valueToString = function valueToString() {
|
||||
return String(this.stringifyProperty("value"));
|
||||
};
|
||||
|
||||
_proto.toString = function toString() {
|
||||
return [this.rawSpaceBefore, this.valueToString(), this.rawSpaceAfter].join('');
|
||||
};
|
||||
|
||||
_createClass(Node, [{
|
||||
key: "rawSpaceBefore",
|
||||
get: function get() {
|
||||
var rawSpace = this.raws && this.raws.spaces && this.raws.spaces.before;
|
||||
|
||||
if (rawSpace === undefined) {
|
||||
rawSpace = this.spaces && this.spaces.before;
|
||||
}
|
||||
|
||||
return rawSpace || "";
|
||||
},
|
||||
set: function set(raw) {
|
||||
(0, _util.ensureObject)(this, "raws", "spaces");
|
||||
this.raws.spaces.before = raw;
|
||||
}
|
||||
}, {
|
||||
key: "rawSpaceAfter",
|
||||
get: function get() {
|
||||
var rawSpace = this.raws && this.raws.spaces && this.raws.spaces.after;
|
||||
|
||||
if (rawSpace === undefined) {
|
||||
rawSpace = this.spaces.after;
|
||||
}
|
||||
|
||||
return rawSpace || "";
|
||||
},
|
||||
set: function set(raw) {
|
||||
(0, _util.ensureObject)(this, "raws", "spaces");
|
||||
this.raws.spaces.after = raw;
|
||||
}
|
||||
}]);
|
||||
|
||||
return Node;
|
||||
}();
|
||||
|
||||
exports["default"] = Node;
|
||||
module.exports = exports.default;
|
38
node_modules/@tailwindcss/typography/node_modules/postcss-selector-parser/dist/selectors/pseudo.js
generated
vendored
Normal file
38
node_modules/@tailwindcss/typography/node_modules/postcss-selector-parser/dist/selectors/pseudo.js
generated
vendored
Normal file
@ -0,0 +1,38 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports["default"] = void 0;
|
||||
|
||||
var _container = _interopRequireDefault(require("./container"));
|
||||
|
||||
var _types = require("./types");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
|
||||
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
|
||||
|
||||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
||||
|
||||
var Pseudo = /*#__PURE__*/function (_Container) {
|
||||
_inheritsLoose(Pseudo, _Container);
|
||||
|
||||
function Pseudo(opts) {
|
||||
var _this;
|
||||
|
||||
_this = _Container.call(this, opts) || this;
|
||||
_this.type = _types.PSEUDO;
|
||||
return _this;
|
||||
}
|
||||
|
||||
var _proto = Pseudo.prototype;
|
||||
|
||||
_proto.toString = function toString() {
|
||||
var params = this.length ? '(' + this.map(String).join(',') + ')' : '';
|
||||
return [this.rawSpaceBefore, this.stringifyProperty("value"), params, this.rawSpaceAfter].join('');
|
||||
};
|
||||
|
||||
return Pseudo;
|
||||
}(_container["default"]);
|
||||
|
||||
exports["default"] = Pseudo;
|
||||
module.exports = exports.default;
|
60
node_modules/@tailwindcss/typography/node_modules/postcss-selector-parser/dist/selectors/root.js
generated
vendored
Normal file
60
node_modules/@tailwindcss/typography/node_modules/postcss-selector-parser/dist/selectors/root.js
generated
vendored
Normal file
@ -0,0 +1,60 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports["default"] = void 0;
|
||||
|
||||
var _container = _interopRequireDefault(require("./container"));
|
||||
|
||||
var _types = require("./types");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
|
||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
||||
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
||||
|
||||
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
|
||||
|
||||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
||||
|
||||
var Root = /*#__PURE__*/function (_Container) {
|
||||
_inheritsLoose(Root, _Container);
|
||||
|
||||
function Root(opts) {
|
||||
var _this;
|
||||
|
||||
_this = _Container.call(this, opts) || this;
|
||||
_this.type = _types.ROOT;
|
||||
return _this;
|
||||
}
|
||||
|
||||
var _proto = Root.prototype;
|
||||
|
||||
_proto.toString = function toString() {
|
||||
var str = this.reduce(function (memo, selector) {
|
||||
memo.push(String(selector));
|
||||
return memo;
|
||||
}, []).join(',');
|
||||
return this.trailingComma ? str + ',' : str;
|
||||
};
|
||||
|
||||
_proto.error = function error(message, options) {
|
||||
if (this._error) {
|
||||
return this._error(message, options);
|
||||
} else {
|
||||
return new Error(message);
|
||||
}
|
||||
};
|
||||
|
||||
_createClass(Root, [{
|
||||
key: "errorGenerator",
|
||||
set: function set(handler) {
|
||||
this._error = handler;
|
||||
}
|
||||
}]);
|
||||
|
||||
return Root;
|
||||
}(_container["default"]);
|
||||
|
||||
exports["default"] = Root;
|
||||
module.exports = exports.default;
|
31
node_modules/@tailwindcss/typography/node_modules/postcss-selector-parser/dist/selectors/selector.js
generated
vendored
Normal file
31
node_modules/@tailwindcss/typography/node_modules/postcss-selector-parser/dist/selectors/selector.js
generated
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports["default"] = void 0;
|
||||
|
||||
var _container = _interopRequireDefault(require("./container"));
|
||||
|
||||
var _types = require("./types");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
|
||||
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
|
||||
|
||||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
||||
|
||||
var Selector = /*#__PURE__*/function (_Container) {
|
||||
_inheritsLoose(Selector, _Container);
|
||||
|
||||
function Selector(opts) {
|
||||
var _this;
|
||||
|
||||
_this = _Container.call(this, opts) || this;
|
||||
_this.type = _types.SELECTOR;
|
||||
return _this;
|
||||
}
|
||||
|
||||
return Selector;
|
||||
}(_container["default"]);
|
||||
|
||||
exports["default"] = Selector;
|
||||
module.exports = exports.default;
|
31
node_modules/@tailwindcss/typography/node_modules/postcss-selector-parser/dist/selectors/string.js
generated
vendored
Normal file
31
node_modules/@tailwindcss/typography/node_modules/postcss-selector-parser/dist/selectors/string.js
generated
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports["default"] = void 0;
|
||||
|
||||
var _node = _interopRequireDefault(require("./node"));
|
||||
|
||||
var _types = require("./types");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
|
||||
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
|
||||
|
||||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
||||
|
||||
var String = /*#__PURE__*/function (_Node) {
|
||||
_inheritsLoose(String, _Node);
|
||||
|
||||
function String(opts) {
|
||||
var _this;
|
||||
|
||||
_this = _Node.call(this, opts) || this;
|
||||
_this.type = _types.STRING;
|
||||
return _this;
|
||||
}
|
||||
|
||||
return String;
|
||||
}(_node["default"]);
|
||||
|
||||
exports["default"] = String;
|
||||
module.exports = exports.default;
|
31
node_modules/@tailwindcss/typography/node_modules/postcss-selector-parser/dist/selectors/tag.js
generated
vendored
Normal file
31
node_modules/@tailwindcss/typography/node_modules/postcss-selector-parser/dist/selectors/tag.js
generated
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports["default"] = void 0;
|
||||
|
||||
var _namespace = _interopRequireDefault(require("./namespace"));
|
||||
|
||||
var _types = require("./types");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
|
||||
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
|
||||
|
||||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
||||
|
||||
var Tag = /*#__PURE__*/function (_Namespace) {
|
||||
_inheritsLoose(Tag, _Namespace);
|
||||
|
||||
function Tag(opts) {
|
||||
var _this;
|
||||
|
||||
_this = _Namespace.call(this, opts) || this;
|
||||
_this.type = _types.TAG;
|
||||
return _this;
|
||||
}
|
||||
|
||||
return Tag;
|
||||
}(_namespace["default"]);
|
||||
|
||||
exports["default"] = Tag;
|
||||
module.exports = exports.default;
|
28
node_modules/@tailwindcss/typography/node_modules/postcss-selector-parser/dist/selectors/types.js
generated
vendored
Normal file
28
node_modules/@tailwindcss/typography/node_modules/postcss-selector-parser/dist/selectors/types.js
generated
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.UNIVERSAL = exports.ATTRIBUTE = exports.CLASS = exports.COMBINATOR = exports.COMMENT = exports.ID = exports.NESTING = exports.PSEUDO = exports.ROOT = exports.SELECTOR = exports.STRING = exports.TAG = void 0;
|
||||
var TAG = 'tag';
|
||||
exports.TAG = TAG;
|
||||
var STRING = 'string';
|
||||
exports.STRING = STRING;
|
||||
var SELECTOR = 'selector';
|
||||
exports.SELECTOR = SELECTOR;
|
||||
var ROOT = 'root';
|
||||
exports.ROOT = ROOT;
|
||||
var PSEUDO = 'pseudo';
|
||||
exports.PSEUDO = PSEUDO;
|
||||
var NESTING = 'nesting';
|
||||
exports.NESTING = NESTING;
|
||||
var ID = 'id';
|
||||
exports.ID = ID;
|
||||
var COMMENT = 'comment';
|
||||
exports.COMMENT = COMMENT;
|
||||
var COMBINATOR = 'combinator';
|
||||
exports.COMBINATOR = COMBINATOR;
|
||||
var CLASS = 'class';
|
||||
exports.CLASS = CLASS;
|
||||
var ATTRIBUTE = 'attribute';
|
||||
exports.ATTRIBUTE = ATTRIBUTE;
|
||||
var UNIVERSAL = 'universal';
|
||||
exports.UNIVERSAL = UNIVERSAL;
|
32
node_modules/@tailwindcss/typography/node_modules/postcss-selector-parser/dist/selectors/universal.js
generated
vendored
Normal file
32
node_modules/@tailwindcss/typography/node_modules/postcss-selector-parser/dist/selectors/universal.js
generated
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports["default"] = void 0;
|
||||
|
||||
var _namespace = _interopRequireDefault(require("./namespace"));
|
||||
|
||||
var _types = require("./types");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
|
||||
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
|
||||
|
||||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
||||
|
||||
var Universal = /*#__PURE__*/function (_Namespace) {
|
||||
_inheritsLoose(Universal, _Namespace);
|
||||
|
||||
function Universal(opts) {
|
||||
var _this;
|
||||
|
||||
_this = _Namespace.call(this, opts) || this;
|
||||
_this.type = _types.UNIVERSAL;
|
||||
_this.value = '*';
|
||||
return _this;
|
||||
}
|
||||
|
||||
return Universal;
|
||||
}(_namespace["default"]);
|
||||
|
||||
exports["default"] = Universal;
|
||||
module.exports = exports.default;
|
13
node_modules/@tailwindcss/typography/node_modules/postcss-selector-parser/dist/sortAscending.js
generated
vendored
Normal file
13
node_modules/@tailwindcss/typography/node_modules/postcss-selector-parser/dist/sortAscending.js
generated
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports["default"] = sortAscending;
|
||||
|
||||
function sortAscending(list) {
|
||||
return list.sort(function (a, b) {
|
||||
return a - b;
|
||||
});
|
||||
}
|
||||
|
||||
;
|
||||
module.exports = exports.default;
|
95
node_modules/@tailwindcss/typography/node_modules/postcss-selector-parser/dist/tokenTypes.js
generated
vendored
Normal file
95
node_modules/@tailwindcss/typography/node_modules/postcss-selector-parser/dist/tokenTypes.js
generated
vendored
Normal file
@ -0,0 +1,95 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.combinator = exports.word = exports.comment = exports.str = exports.tab = exports.newline = exports.feed = exports.cr = exports.backslash = exports.bang = exports.slash = exports.doubleQuote = exports.singleQuote = exports.space = exports.greaterThan = exports.pipe = exports.equals = exports.plus = exports.caret = exports.tilde = exports.dollar = exports.closeSquare = exports.openSquare = exports.closeParenthesis = exports.openParenthesis = exports.semicolon = exports.colon = exports.comma = exports.at = exports.asterisk = exports.ampersand = void 0;
|
||||
var ampersand = 38; // `&`.charCodeAt(0);
|
||||
|
||||
exports.ampersand = ampersand;
|
||||
var asterisk = 42; // `*`.charCodeAt(0);
|
||||
|
||||
exports.asterisk = asterisk;
|
||||
var at = 64; // `@`.charCodeAt(0);
|
||||
|
||||
exports.at = at;
|
||||
var comma = 44; // `,`.charCodeAt(0);
|
||||
|
||||
exports.comma = comma;
|
||||
var colon = 58; // `:`.charCodeAt(0);
|
||||
|
||||
exports.colon = colon;
|
||||
var semicolon = 59; // `;`.charCodeAt(0);
|
||||
|
||||
exports.semicolon = semicolon;
|
||||
var openParenthesis = 40; // `(`.charCodeAt(0);
|
||||
|
||||
exports.openParenthesis = openParenthesis;
|
||||
var closeParenthesis = 41; // `)`.charCodeAt(0);
|
||||
|
||||
exports.closeParenthesis = closeParenthesis;
|
||||
var openSquare = 91; // `[`.charCodeAt(0);
|
||||
|
||||
exports.openSquare = openSquare;
|
||||
var closeSquare = 93; // `]`.charCodeAt(0);
|
||||
|
||||
exports.closeSquare = closeSquare;
|
||||
var dollar = 36; // `$`.charCodeAt(0);
|
||||
|
||||
exports.dollar = dollar;
|
||||
var tilde = 126; // `~`.charCodeAt(0);
|
||||
|
||||
exports.tilde = tilde;
|
||||
var caret = 94; // `^`.charCodeAt(0);
|
||||
|
||||
exports.caret = caret;
|
||||
var plus = 43; // `+`.charCodeAt(0);
|
||||
|
||||
exports.plus = plus;
|
||||
var equals = 61; // `=`.charCodeAt(0);
|
||||
|
||||
exports.equals = equals;
|
||||
var pipe = 124; // `|`.charCodeAt(0);
|
||||
|
||||
exports.pipe = pipe;
|
||||
var greaterThan = 62; // `>`.charCodeAt(0);
|
||||
|
||||
exports.greaterThan = greaterThan;
|
||||
var space = 32; // ` `.charCodeAt(0);
|
||||
|
||||
exports.space = space;
|
||||
var singleQuote = 39; // `'`.charCodeAt(0);
|
||||
|
||||
exports.singleQuote = singleQuote;
|
||||
var doubleQuote = 34; // `"`.charCodeAt(0);
|
||||
|
||||
exports.doubleQuote = doubleQuote;
|
||||
var slash = 47; // `/`.charCodeAt(0);
|
||||
|
||||
exports.slash = slash;
|
||||
var bang = 33; // `!`.charCodeAt(0);
|
||||
|
||||
exports.bang = bang;
|
||||
var backslash = 92; // '\\'.charCodeAt(0);
|
||||
|
||||
exports.backslash = backslash;
|
||||
var cr = 13; // '\r'.charCodeAt(0);
|
||||
|
||||
exports.cr = cr;
|
||||
var feed = 12; // '\f'.charCodeAt(0);
|
||||
|
||||
exports.feed = feed;
|
||||
var newline = 10; // '\n'.charCodeAt(0);
|
||||
|
||||
exports.newline = newline;
|
||||
var tab = 9; // '\t'.charCodeAt(0);
|
||||
// Expose aliases primarily for readability.
|
||||
|
||||
exports.tab = tab;
|
||||
var str = singleQuote; // No good single character representation!
|
||||
|
||||
exports.str = str;
|
||||
var comment = -1;
|
||||
exports.comment = comment;
|
||||
var word = -2;
|
||||
exports.word = word;
|
||||
var combinator = -3;
|
||||
exports.combinator = combinator;
|
271
node_modules/@tailwindcss/typography/node_modules/postcss-selector-parser/dist/tokenize.js
generated
vendored
Normal file
271
node_modules/@tailwindcss/typography/node_modules/postcss-selector-parser/dist/tokenize.js
generated
vendored
Normal file
@ -0,0 +1,271 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports["default"] = tokenize;
|
||||
exports.FIELDS = void 0;
|
||||
|
||||
var t = _interopRequireWildcard(require("./tokenTypes"));
|
||||
|
||||
var _unescapable, _wordDelimiters;
|
||||
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
var unescapable = (_unescapable = {}, _unescapable[t.tab] = true, _unescapable[t.newline] = true, _unescapable[t.cr] = true, _unescapable[t.feed] = true, _unescapable);
|
||||
var wordDelimiters = (_wordDelimiters = {}, _wordDelimiters[t.space] = true, _wordDelimiters[t.tab] = true, _wordDelimiters[t.newline] = true, _wordDelimiters[t.cr] = true, _wordDelimiters[t.feed] = true, _wordDelimiters[t.ampersand] = true, _wordDelimiters[t.asterisk] = true, _wordDelimiters[t.bang] = true, _wordDelimiters[t.comma] = true, _wordDelimiters[t.colon] = true, _wordDelimiters[t.semicolon] = true, _wordDelimiters[t.openParenthesis] = true, _wordDelimiters[t.closeParenthesis] = true, _wordDelimiters[t.openSquare] = true, _wordDelimiters[t.closeSquare] = true, _wordDelimiters[t.singleQuote] = true, _wordDelimiters[t.doubleQuote] = true, _wordDelimiters[t.plus] = true, _wordDelimiters[t.pipe] = true, _wordDelimiters[t.tilde] = true, _wordDelimiters[t.greaterThan] = true, _wordDelimiters[t.equals] = true, _wordDelimiters[t.dollar] = true, _wordDelimiters[t.caret] = true, _wordDelimiters[t.slash] = true, _wordDelimiters);
|
||||
var hex = {};
|
||||
var hexChars = "0123456789abcdefABCDEF";
|
||||
|
||||
for (var i = 0; i < hexChars.length; i++) {
|
||||
hex[hexChars.charCodeAt(i)] = true;
|
||||
}
|
||||
/**
|
||||
* Returns the last index of the bar css word
|
||||
* @param {string} css The string in which the word begins
|
||||
* @param {number} start The index into the string where word's first letter occurs
|
||||
*/
|
||||
|
||||
|
||||
function consumeWord(css, start) {
|
||||
var next = start;
|
||||
var code;
|
||||
|
||||
do {
|
||||
code = css.charCodeAt(next);
|
||||
|
||||
if (wordDelimiters[code]) {
|
||||
return next - 1;
|
||||
} else if (code === t.backslash) {
|
||||
next = consumeEscape(css, next) + 1;
|
||||
} else {
|
||||
// All other characters are part of the word
|
||||
next++;
|
||||
}
|
||||
} while (next < css.length);
|
||||
|
||||
return next - 1;
|
||||
}
|
||||
/**
|
||||
* Returns the last index of the escape sequence
|
||||
* @param {string} css The string in which the sequence begins
|
||||
* @param {number} start The index into the string where escape character (`\`) occurs.
|
||||
*/
|
||||
|
||||
|
||||
function consumeEscape(css, start) {
|
||||
var next = start;
|
||||
var code = css.charCodeAt(next + 1);
|
||||
|
||||
if (unescapable[code]) {// just consume the escape char
|
||||
} else if (hex[code]) {
|
||||
var hexDigits = 0; // consume up to 6 hex chars
|
||||
|
||||
do {
|
||||
next++;
|
||||
hexDigits++;
|
||||
code = css.charCodeAt(next + 1);
|
||||
} while (hex[code] && hexDigits < 6); // if fewer than 6 hex chars, a trailing space ends the escape
|
||||
|
||||
|
||||
if (hexDigits < 6 && code === t.space) {
|
||||
next++;
|
||||
}
|
||||
} else {
|
||||
// the next char is part of the current word
|
||||
next++;
|
||||
}
|
||||
|
||||
return next;
|
||||
}
|
||||
|
||||
var FIELDS = {
|
||||
TYPE: 0,
|
||||
START_LINE: 1,
|
||||
START_COL: 2,
|
||||
END_LINE: 3,
|
||||
END_COL: 4,
|
||||
START_POS: 5,
|
||||
END_POS: 6
|
||||
};
|
||||
exports.FIELDS = FIELDS;
|
||||
|
||||
function tokenize(input) {
|
||||
var tokens = [];
|
||||
var css = input.css.valueOf();
|
||||
var _css = css,
|
||||
length = _css.length;
|
||||
var offset = -1;
|
||||
var line = 1;
|
||||
var start = 0;
|
||||
var end = 0;
|
||||
var code, content, endColumn, endLine, escaped, escapePos, last, lines, next, nextLine, nextOffset, quote, tokenType;
|
||||
|
||||
function unclosed(what, fix) {
|
||||
if (input.safe) {
|
||||
// fyi: this is never set to true.
|
||||
css += fix;
|
||||
next = css.length - 1;
|
||||
} else {
|
||||
throw input.error('Unclosed ' + what, line, start - offset, start);
|
||||
}
|
||||
}
|
||||
|
||||
while (start < length) {
|
||||
code = css.charCodeAt(start);
|
||||
|
||||
if (code === t.newline) {
|
||||
offset = start;
|
||||
line += 1;
|
||||
}
|
||||
|
||||
switch (code) {
|
||||
case t.space:
|
||||
case t.tab:
|
||||
case t.newline:
|
||||
case t.cr:
|
||||
case t.feed:
|
||||
next = start;
|
||||
|
||||
do {
|
||||
next += 1;
|
||||
code = css.charCodeAt(next);
|
||||
|
||||
if (code === t.newline) {
|
||||
offset = next;
|
||||
line += 1;
|
||||
}
|
||||
} while (code === t.space || code === t.newline || code === t.tab || code === t.cr || code === t.feed);
|
||||
|
||||
tokenType = t.space;
|
||||
endLine = line;
|
||||
endColumn = next - offset - 1;
|
||||
end = next;
|
||||
break;
|
||||
|
||||
case t.plus:
|
||||
case t.greaterThan:
|
||||
case t.tilde:
|
||||
case t.pipe:
|
||||
next = start;
|
||||
|
||||
do {
|
||||
next += 1;
|
||||
code = css.charCodeAt(next);
|
||||
} while (code === t.plus || code === t.greaterThan || code === t.tilde || code === t.pipe);
|
||||
|
||||
tokenType = t.combinator;
|
||||
endLine = line;
|
||||
endColumn = start - offset;
|
||||
end = next;
|
||||
break;
|
||||
// Consume these characters as single tokens.
|
||||
|
||||
case t.asterisk:
|
||||
case t.ampersand:
|
||||
case t.bang:
|
||||
case t.comma:
|
||||
case t.equals:
|
||||
case t.dollar:
|
||||
case t.caret:
|
||||
case t.openSquare:
|
||||
case t.closeSquare:
|
||||
case t.colon:
|
||||
case t.semicolon:
|
||||
case t.openParenthesis:
|
||||
case t.closeParenthesis:
|
||||
next = start;
|
||||
tokenType = code;
|
||||
endLine = line;
|
||||
endColumn = start - offset;
|
||||
end = next + 1;
|
||||
break;
|
||||
|
||||
case t.singleQuote:
|
||||
case t.doubleQuote:
|
||||
quote = code === t.singleQuote ? "'" : '"';
|
||||
next = start;
|
||||
|
||||
do {
|
||||
escaped = false;
|
||||
next = css.indexOf(quote, next + 1);
|
||||
|
||||
if (next === -1) {
|
||||
unclosed('quote', quote);
|
||||
}
|
||||
|
||||
escapePos = next;
|
||||
|
||||
while (css.charCodeAt(escapePos - 1) === t.backslash) {
|
||||
escapePos -= 1;
|
||||
escaped = !escaped;
|
||||
}
|
||||
} while (escaped);
|
||||
|
||||
tokenType = t.str;
|
||||
endLine = line;
|
||||
endColumn = start - offset;
|
||||
end = next + 1;
|
||||
break;
|
||||
|
||||
default:
|
||||
if (code === t.slash && css.charCodeAt(start + 1) === t.asterisk) {
|
||||
next = css.indexOf('*/', start + 2) + 1;
|
||||
|
||||
if (next === 0) {
|
||||
unclosed('comment', '*/');
|
||||
}
|
||||
|
||||
content = css.slice(start, next + 1);
|
||||
lines = content.split('\n');
|
||||
last = lines.length - 1;
|
||||
|
||||
if (last > 0) {
|
||||
nextLine = line + last;
|
||||
nextOffset = next - lines[last].length;
|
||||
} else {
|
||||
nextLine = line;
|
||||
nextOffset = offset;
|
||||
}
|
||||
|
||||
tokenType = t.comment;
|
||||
line = nextLine;
|
||||
endLine = nextLine;
|
||||
endColumn = next - nextOffset;
|
||||
} else if (code === t.slash) {
|
||||
next = start;
|
||||
tokenType = code;
|
||||
endLine = line;
|
||||
endColumn = start - offset;
|
||||
end = next + 1;
|
||||
} else {
|
||||
next = consumeWord(css, start);
|
||||
tokenType = t.word;
|
||||
endLine = line;
|
||||
endColumn = next - offset;
|
||||
}
|
||||
|
||||
end = next + 1;
|
||||
break;
|
||||
} // Ensure that the token structure remains consistent
|
||||
|
||||
|
||||
tokens.push([tokenType, // [0] Token type
|
||||
line, // [1] Starting line
|
||||
start - offset, // [2] Starting column
|
||||
endLine, // [3] Ending line
|
||||
endColumn, // [4] Ending column
|
||||
start, // [5] Start position / Source index
|
||||
end // [6] End position
|
||||
]); // Reset offset for the next token
|
||||
|
||||
if (nextOffset) {
|
||||
offset = nextOffset;
|
||||
nextOffset = null;
|
||||
}
|
||||
|
||||
start = end;
|
||||
}
|
||||
|
||||
return tokens;
|
||||
}
|
22
node_modules/@tailwindcss/typography/node_modules/postcss-selector-parser/dist/util/ensureObject.js
generated
vendored
Normal file
22
node_modules/@tailwindcss/typography/node_modules/postcss-selector-parser/dist/util/ensureObject.js
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports["default"] = ensureObject;
|
||||
|
||||
function ensureObject(obj) {
|
||||
for (var _len = arguments.length, props = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
||||
props[_key - 1] = arguments[_key];
|
||||
}
|
||||
|
||||
while (props.length > 0) {
|
||||
var prop = props.shift();
|
||||
|
||||
if (!obj[prop]) {
|
||||
obj[prop] = {};
|
||||
}
|
||||
|
||||
obj = obj[prop];
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = exports.default;
|
24
node_modules/@tailwindcss/typography/node_modules/postcss-selector-parser/dist/util/getProp.js
generated
vendored
Normal file
24
node_modules/@tailwindcss/typography/node_modules/postcss-selector-parser/dist/util/getProp.js
generated
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports["default"] = getProp;
|
||||
|
||||
function getProp(obj) {
|
||||
for (var _len = arguments.length, props = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
||||
props[_key - 1] = arguments[_key];
|
||||
}
|
||||
|
||||
while (props.length > 0) {
|
||||
var prop = props.shift();
|
||||
|
||||
if (!obj[prop]) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
obj = obj[prop];
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
module.exports = exports.default;
|
22
node_modules/@tailwindcss/typography/node_modules/postcss-selector-parser/dist/util/index.js
generated
vendored
Normal file
22
node_modules/@tailwindcss/typography/node_modules/postcss-selector-parser/dist/util/index.js
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.stripComments = exports.ensureObject = exports.getProp = exports.unesc = void 0;
|
||||
|
||||
var _unesc = _interopRequireDefault(require("./unesc"));
|
||||
|
||||
exports.unesc = _unesc["default"];
|
||||
|
||||
var _getProp = _interopRequireDefault(require("./getProp"));
|
||||
|
||||
exports.getProp = _getProp["default"];
|
||||
|
||||
var _ensureObject = _interopRequireDefault(require("./ensureObject"));
|
||||
|
||||
exports.ensureObject = _ensureObject["default"];
|
||||
|
||||
var _stripComments = _interopRequireDefault(require("./stripComments"));
|
||||
|
||||
exports.stripComments = _stripComments["default"];
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
27
node_modules/@tailwindcss/typography/node_modules/postcss-selector-parser/dist/util/stripComments.js
generated
vendored
Normal file
27
node_modules/@tailwindcss/typography/node_modules/postcss-selector-parser/dist/util/stripComments.js
generated
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports["default"] = stripComments;
|
||||
|
||||
function stripComments(str) {
|
||||
var s = "";
|
||||
var commentStart = str.indexOf("/*");
|
||||
var lastEnd = 0;
|
||||
|
||||
while (commentStart >= 0) {
|
||||
s = s + str.slice(lastEnd, commentStart);
|
||||
var commentEnd = str.indexOf("*/", commentStart + 2);
|
||||
|
||||
if (commentEnd < 0) {
|
||||
return s;
|
||||
}
|
||||
|
||||
lastEnd = commentEnd + 2;
|
||||
commentStart = str.indexOf("/*", lastEnd);
|
||||
}
|
||||
|
||||
s = s + str.slice(lastEnd);
|
||||
return s;
|
||||
}
|
||||
|
||||
module.exports = exports.default;
|
93
node_modules/@tailwindcss/typography/node_modules/postcss-selector-parser/dist/util/unesc.js
generated
vendored
Normal file
93
node_modules/@tailwindcss/typography/node_modules/postcss-selector-parser/dist/util/unesc.js
generated
vendored
Normal file
@ -0,0 +1,93 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports["default"] = unesc;
|
||||
|
||||
// Many thanks for this post which made this migration much easier.
|
||||
// https://mathiasbynens.be/notes/css-escapes
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {string} str
|
||||
* @returns {[string, number]|undefined}
|
||||
*/
|
||||
function gobbleHex(str) {
|
||||
var lower = str.toLowerCase();
|
||||
var hex = '';
|
||||
var spaceTerminated = false;
|
||||
|
||||
for (var i = 0; i < 6 && lower[i] !== undefined; i++) {
|
||||
var code = lower.charCodeAt(i); // check to see if we are dealing with a valid hex char [a-f|0-9]
|
||||
|
||||
var valid = code >= 97 && code <= 102 || code >= 48 && code <= 57; // https://drafts.csswg.org/css-syntax/#consume-escaped-code-point
|
||||
|
||||
spaceTerminated = code === 32;
|
||||
|
||||
if (!valid) {
|
||||
break;
|
||||
}
|
||||
|
||||
hex += lower[i];
|
||||
}
|
||||
|
||||
if (hex.length === 0) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
var codePoint = parseInt(hex, 16);
|
||||
var isSurrogate = codePoint >= 0xD800 && codePoint <= 0xDFFF; // Add special case for
|
||||
// "If this number is zero, or is for a surrogate, or is greater than the maximum allowed code point"
|
||||
// https://drafts.csswg.org/css-syntax/#maximum-allowed-code-point
|
||||
|
||||
if (isSurrogate || codePoint === 0x0000 || codePoint > 0x10FFFF) {
|
||||
return ["\uFFFD", hex.length + (spaceTerminated ? 1 : 0)];
|
||||
}
|
||||
|
||||
return [String.fromCodePoint(codePoint), hex.length + (spaceTerminated ? 1 : 0)];
|
||||
}
|
||||
|
||||
var CONTAINS_ESCAPE = /\\/;
|
||||
|
||||
function unesc(str) {
|
||||
var needToProcess = CONTAINS_ESCAPE.test(str);
|
||||
|
||||
if (!needToProcess) {
|
||||
return str;
|
||||
}
|
||||
|
||||
var ret = "";
|
||||
|
||||
for (var i = 0; i < str.length; i++) {
|
||||
if (str[i] === "\\") {
|
||||
var gobbled = gobbleHex(str.slice(i + 1, i + 7));
|
||||
|
||||
if (gobbled !== undefined) {
|
||||
ret += gobbled[0];
|
||||
i += gobbled[1];
|
||||
continue;
|
||||
} // Retain a pair of \\ if double escaped `\\\\`
|
||||
// https://github.com/postcss/postcss-selector-parser/commit/268c9a7656fb53f543dc620aa5b73a30ec3ff20e
|
||||
|
||||
|
||||
if (str[i + 1] === "\\") {
|
||||
ret += "\\";
|
||||
i++;
|
||||
continue;
|
||||
} // if \\ is at the end of the string retain it
|
||||
// https://github.com/postcss/postcss-selector-parser/commit/01a6b346e3612ce1ab20219acc26abdc259ccefb
|
||||
|
||||
|
||||
if (str.length === i + 1) {
|
||||
ret += str[i];
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
ret += str[i];
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
module.exports = exports.default;
|
78
node_modules/@tailwindcss/typography/node_modules/postcss-selector-parser/package.json
generated
vendored
Normal file
78
node_modules/@tailwindcss/typography/node_modules/postcss-selector-parser/package.json
generated
vendored
Normal file
@ -0,0 +1,78 @@
|
||||
{
|
||||
"name": "postcss-selector-parser",
|
||||
"version": "6.0.10",
|
||||
"devDependencies": {
|
||||
"@babel/cli": "^7.11.6",
|
||||
"@babel/core": "^7.11.6",
|
||||
"@babel/eslint-parser": "^7.11.5",
|
||||
"@babel/eslint-plugin": "^7.11.5",
|
||||
"@babel/plugin-proposal-class-properties": "^7.10.4",
|
||||
"@babel/preset-env": "^7.11.5",
|
||||
"@babel/register": "^7.11.5",
|
||||
"ava": "^3.12.1",
|
||||
"babel-plugin-add-module-exports": "^1.0.4",
|
||||
"coveralls": "^3.1.0",
|
||||
"del-cli": "^3.0.1",
|
||||
"eslint": "^7.9.0",
|
||||
"eslint-plugin-import": "^2.22.0",
|
||||
"glob": "^7.1.6",
|
||||
"minimist": "^1.2.5",
|
||||
"nyc": "^15.1.0",
|
||||
"postcss": "^8.0.0",
|
||||
"semver": "^7.3.2",
|
||||
"typescript": "^4.0.3"
|
||||
},
|
||||
"main": "dist/index.js",
|
||||
"types": "postcss-selector-parser.d.ts",
|
||||
"files": [
|
||||
"API.md",
|
||||
"CHANGELOG.md",
|
||||
"LICENSE-MIT",
|
||||
"dist",
|
||||
"postcss-selector-parser.d.ts",
|
||||
"!**/__tests__"
|
||||
],
|
||||
"scripts": {
|
||||
"pretest": "eslint src && tsc --noEmit postcss-selector-parser.d.ts",
|
||||
"prepare": "del-cli dist && BABEL_ENV=publish babel src --out-dir dist --ignore /__tests__/",
|
||||
"lintfix": "eslint --fix src",
|
||||
"report": "nyc report --reporter=html",
|
||||
"test": "nyc ava src/__tests__/*.js ",
|
||||
"testone": "ava"
|
||||
},
|
||||
"dependencies": {
|
||||
"cssesc": "^3.0.0",
|
||||
"util-deprecate": "^1.0.2"
|
||||
},
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
},
|
||||
"homepage": "https://github.com/postcss/postcss-selector-parser",
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Ben Briggs",
|
||||
"email": "beneb.info@gmail.com",
|
||||
"url": "http://beneb.info"
|
||||
},
|
||||
{
|
||||
"name": "Chris Eppstein",
|
||||
"email": "chris@eppsteins.net",
|
||||
"url": "http://twitter.com/chriseppstein"
|
||||
}
|
||||
],
|
||||
"repository": "postcss/postcss-selector-parser",
|
||||
"ava": {
|
||||
"require": [
|
||||
"@babel/register"
|
||||
],
|
||||
"concurrency": 5,
|
||||
"timeout": "25s"
|
||||
},
|
||||
"nyc": {
|
||||
"exclude": [
|
||||
"node_modules",
|
||||
"**/__tests__"
|
||||
]
|
||||
}
|
||||
}
|
555
node_modules/@tailwindcss/typography/node_modules/postcss-selector-parser/postcss-selector-parser.d.ts
generated
vendored
Normal file
555
node_modules/@tailwindcss/typography/node_modules/postcss-selector-parser/postcss-selector-parser.d.ts
generated
vendored
Normal file
@ -0,0 +1,555 @@
|
||||
// Type definitions for postcss-selector-parser 2.2.3
|
||||
// Definitions by: Chris Eppstein <chris@eppsteins.net>
|
||||
|
||||
/*~ Note that ES6 modules cannot directly export callable functions.
|
||||
*~ This file should be imported using the CommonJS-style:
|
||||
*~ import x = require('someLibrary');
|
||||
*~
|
||||
*~ Refer to the documentation to understand common
|
||||
*~ workarounds for this limitation of ES6 modules.
|
||||
*/
|
||||
|
||||
/*~ This declaration specifies that the function
|
||||
*~ is the exported object from the file
|
||||
*/
|
||||
export = parser;
|
||||
|
||||
// A type that's T but not U.
|
||||
type Diff<T, U> = T extends U ? never : T;
|
||||
|
||||
// TODO: Conditional types in TS 1.8 will really clean this up.
|
||||
declare function parser(): parser.Processor<never>;
|
||||
declare function parser<Transform>(processor: parser.AsyncProcessor<Transform>): parser.Processor<Transform, never>;
|
||||
declare function parser(processor: parser.AsyncProcessor<void>): parser.Processor<never, never>;
|
||||
declare function parser<Transform>(processor: parser.SyncProcessor<Transform>): parser.Processor<Transform>;
|
||||
declare function parser(processor: parser.SyncProcessor<void>): parser.Processor<never>;
|
||||
declare function parser<Transform>(processor?: parser.SyncProcessor<Transform> | parser.AsyncProcessor<Transform>): parser.Processor<Transform>;
|
||||
|
||||
/*~ If you want to expose types from your module as well, you can
|
||||
*~ place them in this block. Often you will want to describe the
|
||||
*~ shape of the return type of the function; that type should
|
||||
*~ be declared in here, as this example shows.
|
||||
*/
|
||||
declare namespace parser {
|
||||
/* copied from postcss -- so we don't need to add a dependency */
|
||||
type ErrorOptions = {
|
||||
plugin?: string;
|
||||
word?: string;
|
||||
index?: number
|
||||
};
|
||||
/* the bits we use of postcss.Rule, copied from postcss -- so we don't need to add a dependency */
|
||||
type PostCSSRuleNode = {
|
||||
selector: string
|
||||
/**
|
||||
* @returns postcss.CssSyntaxError but it's a complex object, caller
|
||||
* should cast to it if they have a dependency on postcss.
|
||||
*/
|
||||
error(message: string, options?: ErrorOptions): Error;
|
||||
};
|
||||
/** Accepts a string */
|
||||
type Selectors = string | PostCSSRuleNode
|
||||
type ProcessorFn<ReturnType = void> = (root: parser.Root) => ReturnType;
|
||||
type SyncProcessor<Transform = void> = ProcessorFn<Transform>;
|
||||
type AsyncProcessor<Transform = void> = ProcessorFn<PromiseLike<Transform>>;
|
||||
|
||||
const TAG: "tag";
|
||||
const STRING: "string";
|
||||
const SELECTOR: "selector";
|
||||
const ROOT: "root";
|
||||
const PSEUDO: "pseudo";
|
||||
const NESTING: "nesting";
|
||||
const ID: "id";
|
||||
const COMMENT: "comment";
|
||||
const COMBINATOR: "combinator";
|
||||
const CLASS: "class";
|
||||
const ATTRIBUTE: "attribute";
|
||||
const UNIVERSAL: "universal";
|
||||
|
||||
interface NodeTypes {
|
||||
tag: Tag,
|
||||
string: String,
|
||||
selector: Selector,
|
||||
root: Root,
|
||||
pseudo: Pseudo,
|
||||
nesting: Nesting,
|
||||
id: Identifier,
|
||||
comment: Comment,
|
||||
combinator: Combinator,
|
||||
class: ClassName,
|
||||
attribute: Attribute,
|
||||
universal: Universal
|
||||
}
|
||||
|
||||
type Node = NodeTypes[keyof NodeTypes];
|
||||
|
||||
function isNode(node: any): node is Node;
|
||||
|
||||
interface Options {
|
||||
/**
|
||||
* Preserve whitespace when true. Default: false;
|
||||
*/
|
||||
lossless: boolean;
|
||||
/**
|
||||
* When true and a postcss.Rule is passed, set the result of
|
||||
* processing back onto the rule when done. Default: false.
|
||||
*/
|
||||
updateSelector: boolean;
|
||||
}
|
||||
class Processor<
|
||||
TransformType = never,
|
||||
SyncSelectorsType extends Selectors | never = Selectors
|
||||
> {
|
||||
res: Root;
|
||||
readonly result: String;
|
||||
ast(selectors: Selectors, options?: Partial<Options>): Promise<Root>;
|
||||
astSync(selectors: SyncSelectorsType, options?: Partial<Options>): Root;
|
||||
transform(selectors: Selectors, options?: Partial<Options>): Promise<TransformType>;
|
||||
transformSync(selectors: SyncSelectorsType, options?: Partial<Options>): TransformType;
|
||||
process(selectors: Selectors, options?: Partial<Options>): Promise<string>;
|
||||
processSync(selectors: SyncSelectorsType, options?: Partial<Options>): string;
|
||||
}
|
||||
interface ParserOptions {
|
||||
css: string;
|
||||
error: (message: string, options: ErrorOptions) => Error;
|
||||
options: Options;
|
||||
}
|
||||
class Parser {
|
||||
input: ParserOptions;
|
||||
lossy: boolean;
|
||||
position: number;
|
||||
root: Root;
|
||||
selectors: string;
|
||||
current: Selector;
|
||||
constructor(input: ParserOptions);
|
||||
/**
|
||||
* Raises an error, if the processor is invoked on
|
||||
* a postcss Rule node, a better error message is raised.
|
||||
*/
|
||||
error(message: string, options?: ErrorOptions): void;
|
||||
}
|
||||
interface NodeSource {
|
||||
start?: {
|
||||
line: number,
|
||||
column: number
|
||||
},
|
||||
end?: {
|
||||
line: number,
|
||||
column: number
|
||||
}
|
||||
}
|
||||
interface SpaceAround {
|
||||
before: string;
|
||||
after: string;
|
||||
}
|
||||
interface Spaces extends SpaceAround {
|
||||
[spaceType: string]: string | Partial<SpaceAround> | undefined;
|
||||
}
|
||||
interface NodeOptions<Value = string> {
|
||||
value: Value;
|
||||
spaces?: Partial<Spaces>;
|
||||
source?: NodeSource;
|
||||
sourceIndex?: number;
|
||||
}
|
||||
interface Base<
|
||||
Value extends string | undefined = string,
|
||||
ParentType extends Container | undefined = Container | undefined
|
||||
> {
|
||||
type: keyof NodeTypes;
|
||||
parent: ParentType;
|
||||
value: Value;
|
||||
spaces: Spaces;
|
||||
source?: NodeSource;
|
||||
sourceIndex: number;
|
||||
rawSpaceBefore: string;
|
||||
rawSpaceAfter: string;
|
||||
remove(): Node;
|
||||
replaceWith(...nodes: Node[]): Node;
|
||||
next(): Node;
|
||||
prev(): Node;
|
||||
clone(opts: {[override: string]:any}): Node;
|
||||
/**
|
||||
* Return whether this node includes the character at the position of the given line and column.
|
||||
* Returns undefined if the nodes lack sufficient source metadata to determine the position.
|
||||
* @param line 1-index based line number relative to the start of the selector.
|
||||
* @param column 1-index based column number relative to the start of the selector.
|
||||
*/
|
||||
isAtPosition(line: number, column: number): boolean | undefined;
|
||||
/**
|
||||
* Some non-standard syntax doesn't follow normal escaping rules for css,
|
||||
* this allows the escaped value to be specified directly, allowing illegal characters to be
|
||||
* directly inserted into css output.
|
||||
* @param name the property to set
|
||||
* @param value the unescaped value of the property
|
||||
* @param valueEscaped optional. the escaped value of the property.
|
||||
*/
|
||||
setPropertyAndEscape(name: string, value: any, valueEscaped: string): void;
|
||||
/**
|
||||
* When you want a value to passed through to CSS directly. This method
|
||||
* deletes the corresponding raw value causing the stringifier to fallback
|
||||
* to the unescaped value.
|
||||
* @param name the property to set.
|
||||
* @param value The value that is both escaped and unescaped.
|
||||
*/
|
||||
setPropertyWithoutEscape(name: string, value: any): void;
|
||||
/**
|
||||
* Some non-standard syntax doesn't follow normal escaping rules for css.
|
||||
* This allows non standard syntax to be appended to an existing property
|
||||
* by specifying the escaped value. By specifying the escaped value,
|
||||
* illegal characters are allowed to be directly inserted into css output.
|
||||
* @param {string} name the property to set
|
||||
* @param {any} value the unescaped value of the property
|
||||
* @param {string} valueEscaped optional. the escaped value of the property.
|
||||
*/
|
||||
appendToPropertyAndEscape(name: string, value: any, valueEscaped: string): void;
|
||||
toString(): string;
|
||||
}
|
||||
interface ContainerOptions extends NodeOptions {
|
||||
nodes?: Array<Node>;
|
||||
}
|
||||
interface Container<
|
||||
Value extends string | undefined = string,
|
||||
Child extends Node = Node
|
||||
> extends Base<Value> {
|
||||
nodes: Array<Child>;
|
||||
append(selector: Selector): this;
|
||||
prepend(selector: Selector): this;
|
||||
at(index: number): Child;
|
||||
/**
|
||||
* Return the most specific node at the line and column number given.
|
||||
* The source location is based on the original parsed location, locations aren't
|
||||
* updated as selector nodes are mutated.
|
||||
*
|
||||
* Note that this location is relative to the location of the first character
|
||||
* of the selector, and not the location of the selector in the overall document
|
||||
* when used in conjunction with postcss.
|
||||
*
|
||||
* If not found, returns undefined.
|
||||
* @param line The line number of the node to find. (1-based index)
|
||||
* @param col The column number of the node to find. (1-based index)
|
||||
*/
|
||||
atPosition(line: number, column: number): Child;
|
||||
index(child: Child): number;
|
||||
readonly first: Child;
|
||||
readonly last: Child;
|
||||
readonly length: number;
|
||||
removeChild(child: Child): this;
|
||||
removeAll(): Container;
|
||||
empty(): Container;
|
||||
insertAfter(oldNode: Child, newNode: Child): this;
|
||||
insertBefore(oldNode: Child, newNode: Child): this;
|
||||
each(callback: (node: Child) => boolean | void): boolean | undefined;
|
||||
walk(
|
||||
callback: (node: Node) => boolean | void
|
||||
): boolean | undefined;
|
||||
walkAttributes(
|
||||
callback: (node: Attribute) => boolean | void
|
||||
): boolean | undefined;
|
||||
walkClasses(
|
||||
callback: (node: ClassName) => boolean | void
|
||||
): boolean | undefined;
|
||||
walkCombinators(
|
||||
callback: (node: Combinator) => boolean | void
|
||||
): boolean | undefined;
|
||||
walkComments(
|
||||
callback: (node: Comment) => boolean | void
|
||||
): boolean | undefined;
|
||||
walkIds(
|
||||
callback: (node: Identifier) => boolean | void
|
||||
): boolean | undefined;
|
||||
walkNesting(
|
||||
callback: (node: Nesting) => boolean | void
|
||||
): boolean | undefined;
|
||||
walkPseudos(
|
||||
callback: (node: Pseudo) => boolean | void
|
||||
): boolean | undefined;
|
||||
walkTags(callback: (node: Tag) => boolean | void): boolean | undefined;
|
||||
split(callback: (node: Child) => boolean): [Child[], Child[]];
|
||||
map<T>(callback: (node: Child) => T): T[];
|
||||
reduce(
|
||||
callback: (
|
||||
previousValue: Child,
|
||||
currentValue: Child,
|
||||
currentIndex: number,
|
||||
array: readonly Child[]
|
||||
) => Child
|
||||
): Child;
|
||||
reduce(
|
||||
callback: (
|
||||
previousValue: Child,
|
||||
currentValue: Child,
|
||||
currentIndex: number,
|
||||
array: readonly Child[]
|
||||
) => Child,
|
||||
initialValue: Child
|
||||
): Child;
|
||||
reduce<T>(
|
||||
callback: (
|
||||
previousValue: T,
|
||||
currentValue: Child,
|
||||
currentIndex: number,
|
||||
array: readonly Child[]
|
||||
) => T,
|
||||
initialValue: T
|
||||
): T;
|
||||
every(callback: (node: Child) => boolean): boolean;
|
||||
some(callback: (node: Child) => boolean): boolean;
|
||||
filter(callback: (node: Child) => boolean): Child[];
|
||||
sort(callback: (nodeA: Child, nodeB: Child) => number): Child[];
|
||||
toString(): string;
|
||||
}
|
||||
function isContainer(node: any): node is Root | Selector | Pseudo;
|
||||
|
||||
interface NamespaceOptions<Value extends string | undefined = string> extends NodeOptions<Value> {
|
||||
namespace?: string | true;
|
||||
}
|
||||
interface Namespace<Value extends string | undefined = string> extends Base<Value> {
|
||||
/** alias for namespace */
|
||||
ns: string | true;
|
||||
/**
|
||||
* namespace prefix.
|
||||
*/
|
||||
namespace: string | true;
|
||||
/**
|
||||
* If a namespace exists, prefix the value provided with it, separated by |.
|
||||
*/
|
||||
qualifiedName(value: string): string;
|
||||
/**
|
||||
* A string representing the namespace suitable for output.
|
||||
*/
|
||||
readonly namespaceString: string;
|
||||
}
|
||||
function isNamespace(node: any): node is Attribute | Tag;
|
||||
|
||||
interface Root extends Container<undefined, Selector> {
|
||||
type: "root";
|
||||
/**
|
||||
* Raises an error, if the processor is invoked on
|
||||
* a postcss Rule node, a better error message is raised.
|
||||
*/
|
||||
error(message: string, options?: ErrorOptions): Error;
|
||||
nodeAt(line: number, column: number): Node
|
||||
}
|
||||
function root(opts: ContainerOptions): Root;
|
||||
function isRoot(node: any): node is Root;
|
||||
|
||||
interface _Selector<S> extends Container<string, Diff<Node, S>> {
|
||||
type: "selector";
|
||||
}
|
||||
type Selector = _Selector<Selector>;
|
||||
function selector(opts: ContainerOptions): Selector;
|
||||
function isSelector(node: any): node is Selector;
|
||||
|
||||
interface CombinatorRaws {
|
||||
value?: string;
|
||||
spaces?: {
|
||||
before?: string;
|
||||
after?: string;
|
||||
};
|
||||
}
|
||||
interface Combinator extends Base {
|
||||
type: "combinator";
|
||||
raws?: CombinatorRaws;
|
||||
}
|
||||
function combinator(opts: NodeOptions): Combinator;
|
||||
function isCombinator(node: any): node is Combinator;
|
||||
|
||||
interface ClassName extends Base {
|
||||
type: "class";
|
||||
}
|
||||
function className(opts: NamespaceOptions): ClassName;
|
||||
function isClassName(node: any): node is ClassName;
|
||||
|
||||
type AttributeOperator = "=" | "~=" | "|=" | "^=" | "$=" | "*=";
|
||||
type QuoteMark = '"' | "'" | null;
|
||||
interface PreferredQuoteMarkOptions {
|
||||
quoteMark?: QuoteMark;
|
||||
preferCurrentQuoteMark?: boolean;
|
||||
}
|
||||
interface SmartQuoteMarkOptions extends PreferredQuoteMarkOptions {
|
||||
smart?: boolean;
|
||||
}
|
||||
interface AttributeOptions extends NamespaceOptions<string | undefined> {
|
||||
attribute: string;
|
||||
operator?: AttributeOperator;
|
||||
insensitive?: boolean;
|
||||
quoteMark?: QuoteMark;
|
||||
/** @deprecated Use quoteMark instead. */
|
||||
quoted?: boolean;
|
||||
spaces?: {
|
||||
before?: string;
|
||||
after?: string;
|
||||
attribute?: Partial<SpaceAround>;
|
||||
operator?: Partial<SpaceAround>;
|
||||
value?: Partial<SpaceAround>;
|
||||
insensitive?: Partial<SpaceAround>;
|
||||
}
|
||||
raws: {
|
||||
unquoted?: string;
|
||||
attribute?: string;
|
||||
operator?: string;
|
||||
value?: string;
|
||||
insensitive?: string;
|
||||
spaces?: {
|
||||
attribute?: Partial<Spaces>;
|
||||
operator?: Partial<Spaces>;
|
||||
value?: Partial<Spaces>;
|
||||
insensitive?: Partial<Spaces>;
|
||||
}
|
||||
};
|
||||
}
|
||||
interface Attribute extends Namespace<string | undefined> {
|
||||
type: "attribute";
|
||||
attribute: string;
|
||||
operator?: AttributeOperator;
|
||||
insensitive?: boolean;
|
||||
quoteMark: QuoteMark;
|
||||
quoted?: boolean;
|
||||
spaces: {
|
||||
before: string;
|
||||
after: string;
|
||||
attribute?: Partial<Spaces>;
|
||||
operator?: Partial<Spaces>;
|
||||
value?: Partial<Spaces>;
|
||||
insensitive?: Partial<Spaces>;
|
||||
}
|
||||
raws: {
|
||||
/** @deprecated The attribute value is unquoted, use that instead.. */
|
||||
unquoted?: string;
|
||||
attribute?: string;
|
||||
operator?: string;
|
||||
/** The value of the attribute with quotes and escapes. */
|
||||
value?: string;
|
||||
insensitive?: string;
|
||||
spaces?: {
|
||||
attribute?: Partial<Spaces>;
|
||||
operator?: Partial<Spaces>;
|
||||
value?: Partial<Spaces>;
|
||||
insensitive?: Partial<Spaces>;
|
||||
}
|
||||
};
|
||||
/**
|
||||
* The attribute name after having been qualified with a namespace.
|
||||
*/
|
||||
readonly qualifiedAttribute: string;
|
||||
|
||||
/**
|
||||
* The case insensitivity flag or an empty string depending on whether this
|
||||
* attribute is case insensitive.
|
||||
*/
|
||||
readonly insensitiveFlag : 'i' | '';
|
||||
|
||||
/**
|
||||
* Returns the attribute's value quoted such that it would be legal to use
|
||||
* in the value of a css file. The original value's quotation setting
|
||||
* used for stringification is left unchanged. See `setValue(value, options)`
|
||||
* if you want to control the quote settings of a new value for the attribute or
|
||||
* `set quoteMark(mark)` if you want to change the quote settings of the current
|
||||
* value.
|
||||
*
|
||||
* You can also change the quotation used for the current value by setting quoteMark.
|
||||
**/
|
||||
getQuotedValue(options?: SmartQuoteMarkOptions): string;
|
||||
|
||||
/**
|
||||
* Set the unescaped value with the specified quotation options. The value
|
||||
* provided must not include any wrapping quote marks -- those quotes will
|
||||
* be interpreted as part of the value and escaped accordingly.
|
||||
* @param value
|
||||
*/
|
||||
setValue(value: string, options?: SmartQuoteMarkOptions): void;
|
||||
|
||||
/**
|
||||
* Intelligently select a quoteMark value based on the value's contents. If
|
||||
* the value is a legal CSS ident, it will not be quoted. Otherwise a quote
|
||||
* mark will be picked that minimizes the number of escapes.
|
||||
*
|
||||
* If there's no clear winner, the quote mark from these options is used,
|
||||
* then the source quote mark (this is inverted if `preferCurrentQuoteMark` is
|
||||
* true). If the quoteMark is unspecified, a double quote is used.
|
||||
**/
|
||||
smartQuoteMark(options: PreferredQuoteMarkOptions): QuoteMark;
|
||||
|
||||
/**
|
||||
* Selects the preferred quote mark based on the options and the current quote mark value.
|
||||
* If you want the quote mark to depend on the attribute value, call `smartQuoteMark(opts)`
|
||||
* instead.
|
||||
*/
|
||||
preferredQuoteMark(options: PreferredQuoteMarkOptions): QuoteMark
|
||||
|
||||
/**
|
||||
* returns the offset of the attribute part specified relative to the
|
||||
* start of the node of the output string.
|
||||
*
|
||||
* * "ns" - alias for "namespace"
|
||||
* * "namespace" - the namespace if it exists.
|
||||
* * "attribute" - the attribute name
|
||||
* * "attributeNS" - the start of the attribute or its namespace
|
||||
* * "operator" - the match operator of the attribute
|
||||
* * "value" - The value (string or identifier)
|
||||
* * "insensitive" - the case insensitivity flag;
|
||||
* @param part One of the possible values inside an attribute.
|
||||
* @returns -1 if the name is invalid or the value doesn't exist in this attribute.
|
||||
*/
|
||||
offsetOf(part: "ns" | "namespace" | "attribute" | "attributeNS" | "operator" | "value" | "insensitive"): number;
|
||||
}
|
||||
function attribute(opts: AttributeOptions): Attribute;
|
||||
function isAttribute(node: any): node is Attribute;
|
||||
|
||||
interface Pseudo extends Container<string, Selector> {
|
||||
type: "pseudo";
|
||||
}
|
||||
function pseudo(opts: ContainerOptions): Pseudo;
|
||||
/**
|
||||
* Checks wether the node is the Psuedo subtype of node.
|
||||
*/
|
||||
function isPseudo(node: any): node is Pseudo;
|
||||
|
||||
/**
|
||||
* Checks wether the node is, specifically, a pseudo element instead of
|
||||
* pseudo class.
|
||||
*/
|
||||
function isPseudoElement(node: any): node is Pseudo;
|
||||
|
||||
/**
|
||||
* Checks wether the node is, specifically, a pseudo class instead of
|
||||
* pseudo element.
|
||||
*/
|
||||
function isPseudoClass(node: any): node is Pseudo;
|
||||
|
||||
|
||||
interface Tag extends Namespace {
|
||||
type: "tag";
|
||||
}
|
||||
function tag(opts: NamespaceOptions): Tag;
|
||||
function isTag(node: any): node is Tag;
|
||||
|
||||
interface Comment extends Base {
|
||||
type: "comment";
|
||||
}
|
||||
function comment(opts: NodeOptions): Comment;
|
||||
function isComment(node: any): node is Comment;
|
||||
|
||||
interface Identifier extends Base {
|
||||
type: "id";
|
||||
}
|
||||
function id(opts: any): any;
|
||||
function isIdentifier(node: any): node is Identifier;
|
||||
|
||||
interface Nesting extends Base {
|
||||
type: "nesting";
|
||||
}
|
||||
function nesting(opts: any): any;
|
||||
function isNesting(node: any): node is Nesting;
|
||||
|
||||
interface String extends Base {
|
||||
type: "string";
|
||||
}
|
||||
function string(opts: NodeOptions): String;
|
||||
function isString(node: any): node is String;
|
||||
|
||||
interface Universal extends Base {
|
||||
type: "universal";
|
||||
}
|
||||
function universal(opts?: NamespaceOptions): any;
|
||||
function isUniversal(node: any): node is Universal;
|
||||
}
|
61
node_modules/@tailwindcss/typography/package.json
generated
vendored
Normal file
61
node_modules/@tailwindcss/typography/package.json
generated
vendored
Normal file
@ -0,0 +1,61 @@
|
||||
{
|
||||
"name": "@tailwindcss/typography",
|
||||
"version": "0.5.16",
|
||||
"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/tailwindlabs/tailwindcss-typography",
|
||||
"license": "MIT",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"prettier": {
|
||||
"printWidth": 100,
|
||||
"semi": false,
|
||||
"singleQuote": true,
|
||||
"trailingComma": "es5"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "jest",
|
||||
"dev": "next dev demo",
|
||||
"build": "next build demo",
|
||||
"export": "next export 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 || >=4.0.0-alpha.20 || >=4.0.0-beta.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@mdx-js/loader": "^1.0.19",
|
||||
"@mdx-js/mdx": "^1.6.6",
|
||||
"@next/mdx": "^8.1.0",
|
||||
"autoprefixer": "^10.2.1",
|
||||
"highlight.js": "^10.4.1",
|
||||
"jest": "^29.7.0",
|
||||
"jest-diff": "^27.3.1",
|
||||
"next": "^12.0.1",
|
||||
"postcss": "^8.2.3",
|
||||
"prettier": "^2.1.2",
|
||||
"react": "^17.0.2",
|
||||
"react-dom": "^17.0.2",
|
||||
"tailwindcss": "^3.2.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"lodash.castarray": "^4.4.0",
|
||||
"lodash.isplainobject": "^4.0.6",
|
||||
"lodash.merge": "^4.6.2",
|
||||
"postcss-selector-parser": "6.0.10"
|
||||
},
|
||||
"jest": {
|
||||
"setupFilesAfterEnv": [
|
||||
"<rootDir>/jest/customMatchers.js"
|
||||
]
|
||||
}
|
||||
}
|
9
node_modules/@tailwindcss/typography/src/index.d.ts
generated
vendored
Normal file
9
node_modules/@tailwindcss/typography/src/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
declare function plugin(options?: Partial<{ className: string; target: 'modern' | 'legacy' }>): {
|
||||
handler: () => void
|
||||
}
|
||||
|
||||
declare namespace plugin {
|
||||
const __isOptionsFunction: true
|
||||
}
|
||||
|
||||
export = plugin
|
140
node_modules/@tailwindcss/typography/src/index.js
generated
vendored
Normal file
140
node_modules/@tailwindcss/typography/src/index.js
generated
vendored
Normal file
@ -0,0 +1,140 @@
|
||||
const plugin = require('tailwindcss/plugin')
|
||||
const merge = require('lodash.merge')
|
||||
const castArray = require('lodash.castarray')
|
||||
const styles = require('./styles')
|
||||
const { commonTrailingPseudos } = require('./utils')
|
||||
|
||||
const computed = {
|
||||
// Reserved for future "magic properties", for example:
|
||||
// bulletColor: (color) => ({ 'ul > li::before': { backgroundColor: color } }),
|
||||
}
|
||||
|
||||
function inWhere(selector, { className, modifier, prefix }) {
|
||||
let prefixedNot = prefix(`.not-${className}`).slice(1)
|
||||
let selectorPrefix = selector.startsWith('>')
|
||||
? `${modifier === 'DEFAULT' ? `.${className}` : `.${className}-${modifier}`} `
|
||||
: ''
|
||||
|
||||
// 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 (trailingPseudo) {
|
||||
return `:where(${selectorPrefix}${rebuiltSelector}):not(:where([class~="${prefixedNot}"],[class~="${prefixedNot}"] *))${trailingPseudo}`
|
||||
}
|
||||
|
||||
return `:where(${selectorPrefix}${selector}):not(:where([class~="${prefixedNot}"],[class~="${prefixedNot}"] *))`
|
||||
}
|
||||
|
||||
function isObject(value) {
|
||||
return typeof value === 'object' && value !== null
|
||||
}
|
||||
|
||||
function configToCss(config = {}, { target, className, modifier, prefix }) {
|
||||
function updateSelector(k, v) {
|
||||
if (target === 'legacy') {
|
||||
return [k, v]
|
||||
}
|
||||
|
||||
if (Array.isArray(v)) {
|
||||
return [k, v]
|
||||
}
|
||||
|
||||
if (isObject(v)) {
|
||||
let nested = Object.values(v).some(isObject)
|
||||
if (nested) {
|
||||
return [
|
||||
inWhere(k, { className, modifier, prefix }),
|
||||
v,
|
||||
Object.fromEntries(Object.entries(v).map(([k, v]) => updateSelector(k, v))),
|
||||
]
|
||||
}
|
||||
|
||||
return [inWhere(k, { className, modifier, prefix }), v]
|
||||
}
|
||||
|
||||
return [k, v]
|
||||
}
|
||||
|
||||
return Object.fromEntries(
|
||||
Object.entries(
|
||||
merge(
|
||||
{},
|
||||
...Object.keys(config)
|
||||
.filter((key) => computed[key])
|
||||
.map((key) => computed[key](config[key])),
|
||||
...castArray(config.css || {})
|
||||
)
|
||||
).map(([k, v]) => updateSelector(k, v))
|
||||
)
|
||||
}
|
||||
|
||||
module.exports = plugin.withOptions(
|
||||
({ className = 'prose', target = 'modern' } = {}) => {
|
||||
return function ({ addVariant, addComponents, theme, prefix }) {
|
||||
let modifiers = theme('typography')
|
||||
|
||||
let options = { className, prefix }
|
||||
|
||||
for (let [name, ...selectors] of [
|
||||
['headings', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'th'],
|
||||
['h1'],
|
||||
['h2'],
|
||||
['h3'],
|
||||
['h4'],
|
||||
['h5'],
|
||||
['h6'],
|
||||
['p'],
|
||||
['a'],
|
||||
['blockquote'],
|
||||
['figure'],
|
||||
['figcaption'],
|
||||
['strong'],
|
||||
['em'],
|
||||
['kbd'],
|
||||
['code'],
|
||||
['pre'],
|
||||
['ol'],
|
||||
['ul'],
|
||||
['li'],
|
||||
['table'],
|
||||
['thead'],
|
||||
['tr'],
|
||||
['th'],
|
||||
['td'],
|
||||
['img'],
|
||||
['video'],
|
||||
['hr'],
|
||||
['lead', '[class~="lead"]'],
|
||||
]) {
|
||||
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)})`
|
||||
)
|
||||
}
|
||||
|
||||
addComponents(
|
||||
Object.keys(modifiers).map((modifier) => ({
|
||||
[modifier === 'DEFAULT' ? `.${className}` : `.${className}-${modifier}`]: configToCss(
|
||||
modifiers[modifier],
|
||||
{
|
||||
target,
|
||||
className,
|
||||
modifier,
|
||||
prefix,
|
||||
}
|
||||
),
|
||||
}))
|
||||
)
|
||||
}
|
||||
},
|
||||
() => {
|
||||
return {
|
||||
theme: { typography: styles },
|
||||
}
|
||||
}
|
||||
)
|
1423
node_modules/@tailwindcss/typography/src/index.test.js
generated
vendored
Normal file
1423
node_modules/@tailwindcss/typography/src/index.test.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1632
node_modules/@tailwindcss/typography/src/styles.js
generated
vendored
Normal file
1632
node_modules/@tailwindcss/typography/src/styles.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
62
node_modules/@tailwindcss/typography/src/utils.js
generated
vendored
Normal file
62
node_modules/@tailwindcss/typography/src/utils.js
generated
vendored
Normal file
@ -0,0 +1,62 @@
|
||||
const isPlainObject = require('lodash.isplainobject')
|
||||
|
||||
const parser = require('postcss-selector-parser')
|
||||
const parseSelector = parser()
|
||||
|
||||
module.exports = {
|
||||
isUsableColor(color, values) {
|
||||
return isPlainObject(values) && color !== 'gray' && values[600]
|
||||
},
|
||||
|
||||
/**
|
||||
* @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]
|
||||
},
|
||||
}
|
Reference in New Issue
Block a user