Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@tailwindcss/typography

Package Overview
Dependencies
Maintainers
5
Versions
134
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tailwindcss/typography - npm Package Compare versions

Comparing version 0.0.0-insiders.57f5022 to 0.0.0-insiders.595ea7d

src/index.d.ts

27

CHANGELOG.md

@@ -12,2 +12,24 @@ # Changelog

## [0.5.8] - 2022-11-07
### Fixed
- Fix selector when using a non-default class (e.g. `prose-sm`) ([#289](https://github.com/tailwindlabs/tailwindcss-typography/pull/289))
## [0.5.7] - 2022-09-02
### Fixed
- Update TypeScript types ([#284](https://github.com/tailwindlabs/tailwindcss-typography/pull/284))
## [0.5.6] - 2022-09-01
- Actually publish types ([a54c1a8](https://github.com/tailwindlabs/tailwindcss-typography/commit/a54c1a82a64efdf23aab57e62edaa369d1a857f1))
## [0.5.5] - 2022-09-01
### Added
- Add typescript types ([#283](https://github.com/tailwindlabs/tailwindcss-typography/pull/283))
## [0.5.4] - 2022-07-12

@@ -140,3 +162,6 @@

[unreleased]: https://github.com/tailwindlabs/tailwindcss-typography/compare/v0.5.4...HEAD
[unreleased]: https://github.com/tailwindlabs/tailwindcss-typography/compare/v0.5.7...HEAD
[0.5.7]: https://github.com/tailwindlabs/tailwindcss-typography/compare/v0.5.6...v0.5.7
[0.5.6]: https://github.com/tailwindlabs/tailwindcss-typography/compare/v0.5.5...v0.5.6
[0.5.5]: https://github.com/tailwindlabs/tailwindcss-typography/compare/v0.5.4...v0.5.5
[0.5.4]: https://github.com/tailwindlabs/tailwindcss-typography/compare/v0.5.3...v0.5.4

@@ -143,0 +168,0 @@ [0.5.3]: https://github.com/tailwindlabs/tailwindcss-typography/compare/v0.5.2...v0.5.3

5

package.json
{
"name": "@tailwindcss/typography",
"version": "0.0.0-insiders.57f5022",
"version": "0.0.0-insiders.595ea7d",
"description": "A Tailwind CSS plugin for automatically styling plain HTML content with beautiful typographic defaults.",

@@ -9,2 +9,3 @@ "main": "src/index.js",

"src/*.js",
"src/*.d.ts",
"dist/"

@@ -46,3 +47,3 @@ ],

"react-dom": "^17.0.2",
"tailwindcss": "^3.0.0-alpha.2"
"tailwindcss": "^3.2.2"
},

@@ -49,0 +50,0 @@ "dependencies": {

@@ -12,5 +12,7 @@ const plugin = require('tailwindcss/plugin')

function inWhere(selector, { className, prefix }) {
function inWhere(selector, { className, modifier, prefix }) {
let prefixedNot = prefix(`.not-${className}`).slice(1)
let selectorPrefix = selector.startsWith('>') ? `.${className} ` : ''
let selectorPrefix = selector.startsWith('>')
? `${modifier === 'DEFAULT' ? `.${className}` : `.${className}-${modifier}`} `
: ''

@@ -31,3 +33,3 @@ // Parse the selector, if every component ends in the same pseudo element(s) then move it to the end

function configToCss(config = {}, { target, className, prefix }) {
function configToCss(config = {}, { target, className, modifier, prefix }) {
function updateSelector(k, v) {

@@ -46,3 +48,3 @@ if (target === 'legacy') {

return [
inWhere(k, { className, prefix }),
inWhere(k, { className, modifier, prefix }),
v,

@@ -53,3 +55,3 @@ Object.fromEntries(Object.entries(v).map(([k, v]) => updateSelector(k, v))),

return [inWhere(k, { className, prefix }), v]
return [inWhere(k, { className, modifier, prefix }), v]
}

@@ -128,2 +130,3 @@

className,
modifier,
prefix,

@@ -130,0 +133,0 @@ }

@@ -9,2 +9,48 @@ const path = require('path')

let vars = `
--tw-border-spacing-x: 0;
--tw-border-spacing-y: 0;
--tw-translate-x: 0;
--tw-translate-y: 0;
--tw-rotate: 0;
--tw-skew-x: 0;
--tw-skew-y: 0;
--tw-scale-x: 1;
--tw-scale-y: 1;
--tw-pan-x: ;
--tw-pan-y: ;
--tw-pinch-zoom: ;
--tw-scroll-snap-strictness: proximity;
--tw-ordinal: ;
--tw-slashed-zero: ;
--tw-numeric-figure: ;
--tw-numeric-spacing: ;
--tw-numeric-fraction: ;
--tw-ring-inset: ;
--tw-ring-offset-width: 0px;
--tw-ring-offset-color: #fff;
--tw-ring-color: rgb(59 130 246 / 0.5);
--tw-ring-offset-shadow: 0 0 #0000;
--tw-ring-shadow: 0 0 #0000;
--tw-shadow: 0 0 #0000;
--tw-shadow-colored: 0 0 #0000;
--tw-blur: ;
--tw-brightness: ;
--tw-contrast: ;
--tw-grayscale: ;
--tw-hue-rotate: ;
--tw-invert: ;
--tw-saturate: ;
--tw-sepia: ;
--tw-drop-shadow: ;
--tw-backdrop-blur: ;
--tw-backdrop-brightness: ;
--tw-backdrop-contrast: ;
--tw-backdrop-grayscale: ;
--tw-backdrop-hue-rotate: ;
--tw-backdrop-invert: ;
--tw-backdrop-opacity: ;
--tw-backdrop-saturate: ;
--tw-backdrop-sepia: ;
`
let defaults = css`

@@ -14,45 +60,7 @@ *,

::after {
--tw-translate-x: 0;
--tw-translate-y: 0;
--tw-rotate: 0;
--tw-skew-x: 0;
--tw-skew-y: 0;
--tw-scale-x: 1;
--tw-scale-y: 1;
--tw-pan-x: ;
--tw-pan-y: ;
--tw-pinch-zoom: ;
--tw-scroll-snap-strictness: proximity;
--tw-ordinal: ;
--tw-slashed-zero: ;
--tw-numeric-figure: ;
--tw-numeric-spacing: ;
--tw-numeric-fraction: ;
--tw-ring-inset: ;
--tw-ring-offset-width: 0px;
--tw-ring-offset-color: #fff;
--tw-ring-color: rgb(59 130 246 / 0.5);
--tw-ring-offset-shadow: 0 0 #0000;
--tw-ring-shadow: 0 0 #0000;
--tw-shadow: 0 0 #0000;
--tw-shadow-colored: 0 0 #0000;
--tw-blur: ;
--tw-brightness: ;
--tw-contrast: ;
--tw-grayscale: ;
--tw-hue-rotate: ;
--tw-invert: ;
--tw-saturate: ;
--tw-sepia: ;
--tw-drop-shadow: ;
--tw-backdrop-blur: ;
--tw-backdrop-brightness: ;
--tw-backdrop-contrast: ;
--tw-backdrop-grayscale: ;
--tw-backdrop-hue-rotate: ;
--tw-backdrop-invert: ;
--tw-backdrop-opacity: ;
--tw-backdrop-saturate: ;
--tw-backdrop-sepia: ;
${vars}
}
::backdrop {
${vars}
}
`

@@ -178,2 +186,85 @@

test('variants', async () => {
let config = {
content: [{ raw: html`<div class="sm:prose hover:prose-lg lg:prose-lg"></div>` }],
theme: {
typography: {
DEFAULT: {
css: [
{
color: 'red',
p: {
color: 'lime',
},
'> ul > li': {
color: 'purple',
},
},
],
},
lg: {
css: {
color: 'green',
p: {
color: 'tomato',
},
'> ul > li': {
color: 'blue',
},
},
},
xl: {
css: {
color: 'yellow',
'> ul > li': {
color: 'hotpink',
},
},
},
},
},
}
return run(config).then((result) => {
expect(result.css).toMatchFormattedCss(
css`
${defaults}
.hover\:prose-lg:hover {
color: green;
}
.hover\:prose-lg:hover :where(p):not(:where([class~='not-prose'] *)) {
color: tomato;
}
.hover\:prose-lg:hover
:where(.hover\:prose-lg:hover > ul > li):not(:where([class~='not-prose'] *)) {
color: blue;
}
@media (min-width: 640px) {
.sm\:prose {
color: red;
}
.sm\:prose :where(p):not(:where([class~='not-prose'] *)) {
color: lime;
}
.sm\:prose :where(.sm\:prose > ul > li):not(:where([class~='not-prose'] *)) {
color: purple;
}
}
@media (min-width: 1024px) {
.lg\:prose-lg {
color: green;
}
.lg\:prose-lg :where(p):not(:where([class~='not-prose'] *)) {
color: tomato;
}
.lg\:prose-lg :where(.lg\:prose-lg > ul > li):not(:where([class~='not-prose'] *)) {
color: blue;
}
}
`
)
})
})
test('modifiers', async () => {

@@ -240,2 +331,5 @@ let config = {

},
'> ul > li': {
paddingLeft: '12px',
},
h1: {

@@ -319,2 +413,5 @@ fontSize: '48px',

}
.prose-lg :where(.prose-lg > ul > li):not(:where([class~='not-prose'] *)) {
padding-left: 12px;
}
.prose-lg :where(h1):not(:where([class~='not-prose'] *)) {

@@ -321,0 +418,0 @@ font-size: 48px;

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc