@unocss/preset-typography 0.55.1 → 0.55.3

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.cjs CHANGED
@@ -28,8 +28,11 @@ const DEFAULT = {
28
28
  "font-style": "italic",
29
29
  "border-left": ".25em solid var(--un-prose-borders)"
30
30
  },
31
+ // taking 16px as a base, we scale h1, h2, h3, and h4 like
32
+ // 16 (base) > 18 (h4) > 22 (h3) > 28 (h2) > 36 (h1)
31
33
  "h1": {
32
34
  "margin": "1rem 0",
35
+ // h1 is always at the top of the page, so only margin 1 * root font size
33
36
  "font-size": "2.25em"
34
37
  },
35
38
  "h2": {
@@ -246,6 +249,7 @@ function presetTypography(options) {
246
249
  "--un-prose-code": colorObject[900] ?? baseColor,
247
250
  "--un-prose-borders": colorObject[200] ?? baseColor,
248
251
  "--un-prose-bg-soft": colorObject[100] ?? baseColor,
252
+ // invert colors (dark mode)
249
253
  "--un-prose-invert-body": colorObject[200] ?? baseColor,
250
254
  "--un-prose-invert-headings": colorObject[100] ?? baseColor,
251
255
  "--un-prose-invert-links": colorObject[100] ?? baseColor,
@@ -290,5 +294,5 @@ function presetTypography(options) {
290
294
  };
291
295
  }
292
296
 
293
- exports["default"] = presetTypography;
297
+ exports.default = presetTypography;
294
298
  exports.presetTypography = presetTypography;
@@ -0,0 +1,65 @@
1
+ import { CSSObject, Preset } from '@unocss/core';
2
+ import { Theme } from '@unocss/preset-mini';
3
+
4
+ /** @public */
5
+ interface TypographyCompatibilityOptions {
6
+ noColonWhere?: boolean
7
+ noColonIs?: boolean
8
+ noColonNot?: boolean
9
+ }
10
+
11
+ /**
12
+ * @public
13
+ */
14
+ interface TypographyOptions {
15
+ /**
16
+ * The selector name to use the typographic utilities.
17
+ * To undo the styles to the elements, use it like
18
+ * `not-${selectorName}` which is by default `not-prose`.
19
+ *
20
+ * Note: `not` utility is only available in class mode.
21
+ *
22
+ * @defaultValue `prose`
23
+ */
24
+ selectorName?: string;
25
+ /**
26
+ * Extend or override CSS selectors with CSS declaration block.
27
+ *
28
+ * @defaultValue undefined
29
+ */
30
+ cssExtend?: Record<string, CSSObject>;
31
+ /**
32
+ * Compatibility option. Notice that it will affect some features.
33
+ * For more instructions, see
34
+ * [README](https://github.com/unocss/unocss/tree/main/packages/preset-typography)
35
+ *
36
+ * @defaultValue undefined
37
+ */
38
+ compatibility?: TypographyCompatibilityOptions;
39
+ /**
40
+ * @deprecated use `selectorName` instead. It will be removed in 1.0.
41
+ */
42
+ className?: string;
43
+ }
44
+ /**
45
+ * UnoCSS Preset for Typography
46
+ *
47
+ * ```js
48
+ * // uno.config.ts
49
+ * import { presetAttributify, presetUno, defineConfig, presetTypography } from 'unocss'
50
+ *
51
+ * export default defineConfig({
52
+ * presets: [
53
+ * presetAttributify(), // required if using attributify mode
54
+ * presetUno(), // required
55
+ * presetTypography()
56
+ * ]
57
+ * })
58
+ * ```
59
+ *
60
+ * @returns typography preset
61
+ * @public
62
+ */
63
+ declare function presetTypography(options?: TypographyOptions): Preset<Theme>;
64
+
65
+ export { type TypographyOptions, presetTypography as default, presetTypography };
@@ -0,0 +1,65 @@
1
+ import { CSSObject, Preset } from '@unocss/core';
2
+ import { Theme } from '@unocss/preset-mini';
3
+
4
+ /** @public */
5
+ interface TypographyCompatibilityOptions {
6
+ noColonWhere?: boolean
7
+ noColonIs?: boolean
8
+ noColonNot?: boolean
9
+ }
10
+
11
+ /**
12
+ * @public
13
+ */
14
+ interface TypographyOptions {
15
+ /**
16
+ * The selector name to use the typographic utilities.
17
+ * To undo the styles to the elements, use it like
18
+ * `not-${selectorName}` which is by default `not-prose`.
19
+ *
20
+ * Note: `not` utility is only available in class mode.
21
+ *
22
+ * @defaultValue `prose`
23
+ */
24
+ selectorName?: string;
25
+ /**
26
+ * Extend or override CSS selectors with CSS declaration block.
27
+ *
28
+ * @defaultValue undefined
29
+ */
30
+ cssExtend?: Record<string, CSSObject>;
31
+ /**
32
+ * Compatibility option. Notice that it will affect some features.
33
+ * For more instructions, see
34
+ * [README](https://github.com/unocss/unocss/tree/main/packages/preset-typography)
35
+ *
36
+ * @defaultValue undefined
37
+ */
38
+ compatibility?: TypographyCompatibilityOptions;
39
+ /**
40
+ * @deprecated use `selectorName` instead. It will be removed in 1.0.
41
+ */
42
+ className?: string;
43
+ }
44
+ /**
45
+ * UnoCSS Preset for Typography
46
+ *
47
+ * ```js
48
+ * // uno.config.ts
49
+ * import { presetAttributify, presetUno, defineConfig, presetTypography } from 'unocss'
50
+ *
51
+ * export default defineConfig({
52
+ * presets: [
53
+ * presetAttributify(), // required if using attributify mode
54
+ * presetUno(), // required
55
+ * presetTypography()
56
+ * ]
57
+ * })
58
+ * ```
59
+ *
60
+ * @returns typography preset
61
+ * @public
62
+ */
63
+ declare function presetTypography(options?: TypographyOptions): Preset<Theme>;
64
+
65
+ export { type TypographyOptions, presetTypography as default, presetTypography };
package/dist/index.d.ts CHANGED
@@ -62,4 +62,4 @@ interface TypographyOptions {
62
62
  */
63
63
  declare function presetTypography(options?: TypographyOptions): Preset<Theme>;
64
64
 
65
- export { TypographyOptions, presetTypography as default, presetTypography };
65
+ export { type TypographyOptions, presetTypography as default, presetTypography };
package/dist/index.mjs CHANGED
@@ -24,8 +24,11 @@ const DEFAULT = {
24
24
  "font-style": "italic",
25
25
  "border-left": ".25em solid var(--un-prose-borders)"
26
26
  },
27
+ // taking 16px as a base, we scale h1, h2, h3, and h4 like
28
+ // 16 (base) > 18 (h4) > 22 (h3) > 28 (h2) > 36 (h1)
27
29
  "h1": {
28
30
  "margin": "1rem 0",
31
+ // h1 is always at the top of the page, so only margin 1 * root font size
29
32
  "font-size": "2.25em"
30
33
  },
31
34
  "h2": {
@@ -242,6 +245,7 @@ function presetTypography(options) {
242
245
  "--un-prose-code": colorObject[900] ?? baseColor,
243
246
  "--un-prose-borders": colorObject[200] ?? baseColor,
244
247
  "--un-prose-bg-soft": colorObject[100] ?? baseColor,
248
+ // invert colors (dark mode)
245
249
  "--un-prose-invert-body": colorObject[200] ?? baseColor,
246
250
  "--un-prose-invert-headings": colorObject[100] ?? baseColor,
247
251
  "--un-prose-invert-links": colorObject[100] ?? baseColor,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unocss/preset-typography",
3
- "version": "0.55.1",
3
+ "version": "0.55.3",
4
4
  "description": "Typography preset for UnoCSS",
5
5
  "author": "Jeff Yang",
6
6
  "license": "MIT",
@@ -32,8 +32,8 @@
32
32
  "dist"
33
33
  ],
34
34
  "dependencies": {
35
- "@unocss/core": "0.55.1",
36
- "@unocss/preset-mini": "0.55.1"
35
+ "@unocss/core": "0.55.3",
36
+ "@unocss/preset-mini": "0.55.3"
37
37
  },
38
38
  "scripts": {
39
39
  "build": "unbuild",