@unocss/preset-typography 0.65.2 → 0.65.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.mjs +61 -0
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -161,6 +161,42 @@ function DEFAULT(theme) {
|
|
|
161
161
|
}
|
|
162
162
|
};
|
|
163
163
|
}
|
|
164
|
+
const modifiers = [
|
|
165
|
+
["headings", "h1", "h2", "h3", "h4", "h5", "h6", "th"],
|
|
166
|
+
["h1"],
|
|
167
|
+
["h2"],
|
|
168
|
+
["h3"],
|
|
169
|
+
["h4"],
|
|
170
|
+
["h5"],
|
|
171
|
+
["h6"],
|
|
172
|
+
["p"],
|
|
173
|
+
["a"],
|
|
174
|
+
["blockquote"],
|
|
175
|
+
["figure"],
|
|
176
|
+
["figcaption"],
|
|
177
|
+
["strong"],
|
|
178
|
+
["em"],
|
|
179
|
+
["kbd"],
|
|
180
|
+
["code"],
|
|
181
|
+
["pre"],
|
|
182
|
+
["ol"],
|
|
183
|
+
["ul"],
|
|
184
|
+
["li"],
|
|
185
|
+
["table"],
|
|
186
|
+
["thead"],
|
|
187
|
+
["tr"],
|
|
188
|
+
["th"],
|
|
189
|
+
["td"],
|
|
190
|
+
["img"],
|
|
191
|
+
["video"],
|
|
192
|
+
["hr"]
|
|
193
|
+
];
|
|
194
|
+
function getElements(modifier) {
|
|
195
|
+
for (const [name, ...selectors] of modifiers) {
|
|
196
|
+
if (name === modifier)
|
|
197
|
+
return selectors.length > 0 ? selectors : [name];
|
|
198
|
+
}
|
|
199
|
+
}
|
|
164
200
|
|
|
165
201
|
function getCSS(options) {
|
|
166
202
|
let css = "";
|
|
@@ -214,6 +250,7 @@ const presetTypography = definePreset((options) => {
|
|
|
214
250
|
const selectorNameRE = new RegExp(`^${selectorName}$`);
|
|
215
251
|
const colorsRE = new RegExp(`^${selectorName}-([-\\w]+)$`);
|
|
216
252
|
const invertRE = new RegExp(`^${selectorName}-invert$`);
|
|
253
|
+
const disableNotUtility = options?.compatibility?.noColonNot || options?.compatibility?.noColonWhere;
|
|
217
254
|
return {
|
|
218
255
|
name: "@unocss/preset-typography",
|
|
219
256
|
enforce: "post",
|
|
@@ -276,6 +313,30 @@ const presetTypography = definePreset((options) => {
|
|
|
276
313
|
{ layer: "typography" }
|
|
277
314
|
]
|
|
278
315
|
],
|
|
316
|
+
variants: [
|
|
317
|
+
{
|
|
318
|
+
name: "typography element modifiers",
|
|
319
|
+
match: (matcher) => {
|
|
320
|
+
if (matcher.startsWith(`${selectorName}-`)) {
|
|
321
|
+
const modifyRe = new RegExp(`^${selectorName}-(\\w+)[:-].+$`);
|
|
322
|
+
const modifier = matcher.match(modifyRe)?.[1];
|
|
323
|
+
if (modifier) {
|
|
324
|
+
const elements = getElements(modifier);
|
|
325
|
+
if (elements?.length) {
|
|
326
|
+
return {
|
|
327
|
+
matcher: matcher.slice(selectorName.length + modifier.length + 2),
|
|
328
|
+
selector: (s) => {
|
|
329
|
+
const notProseSelector = `:not(:where(.not-${selectorName},.not-${selectorName} *))`;
|
|
330
|
+
const escapedSelector = disableNotUtility ? elements.map((e) => `${s} ${e}`).join(",") : `${s} :is(:where(${elements})${notProseSelector})`;
|
|
331
|
+
return escapedSelector;
|
|
332
|
+
}
|
|
333
|
+
};
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
],
|
|
279
340
|
preflights: [
|
|
280
341
|
{
|
|
281
342
|
layer: "typography",
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unocss/preset-typography",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.65.
|
|
4
|
+
"version": "0.65.4",
|
|
5
5
|
"description": "Typography preset for UnoCSS",
|
|
6
6
|
"author": "Jeff Yang",
|
|
7
7
|
"license": "MIT",
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
"dist"
|
|
33
33
|
],
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@unocss/core": "0.65.
|
|
36
|
-
"@unocss/preset-mini": "0.65.
|
|
35
|
+
"@unocss/core": "0.65.4",
|
|
36
|
+
"@unocss/preset-mini": "0.65.4"
|
|
37
37
|
},
|
|
38
38
|
"scripts": {
|
|
39
39
|
"build": "unbuild",
|