@udixio/tailwind 2.4.10 → 2.4.11
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/CHANGELOG.md +10 -0
- package/dist/browser.cjs +1 -1
- package/dist/browser.js +2 -2
- package/dist/main.d.ts +1 -0
- package/dist/main.d.ts.map +1 -1
- package/dist/node/tailwind.plugin.d.ts.map +1 -1
- package/dist/node.cjs +5 -3
- package/dist/node.js +6 -4
- package/dist/plugins-tailwind/font.d.ts +4 -0
- package/dist/plugins-tailwind/font.d.ts.map +1 -1
- package/dist/{tailwind.plugin-CwaBY8Mt.cjs → tailwind.plugin-DCCnMjHz.cjs} +15 -4
- package/dist/{tailwind.plugin-CJB7VyGG.js → tailwind.plugin-DONDY0v2.js} +15 -4
- package/package.json +1 -1
- package/src/main.ts +13 -0
- package/src/node/tailwind.plugin.ts +5 -1
- package/src/plugins-tailwind/font.ts +13 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
## 2.4.11 (2026-01-26)
|
|
2
|
+
|
|
3
|
+
### 🩹 Fixes
|
|
4
|
+
|
|
5
|
+
- **tailwind:** improve `fontFamily` support with improved processing for CSS compatibility ([5538980](https://github.com/Udixio/UI/commit/5538980))
|
|
6
|
+
|
|
7
|
+
### ❤️ Thank You
|
|
8
|
+
|
|
9
|
+
- Joël VIGREUX
|
|
10
|
+
|
|
1
11
|
## 2.4.10 (2026-01-26)
|
|
2
12
|
|
|
3
13
|
### 🩹 Fixes
|
package/dist/browser.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
-
const tailwind_plugin = require("./tailwind.plugin-
|
|
3
|
+
const tailwind_plugin = require("./tailwind.plugin-DCCnMjHz.cjs");
|
|
4
4
|
exports.TailwindImplPluginBrowser = tailwind_plugin.TailwindImplPluginBrowser;
|
|
5
5
|
exports.TailwindPlugin = tailwind_plugin.TailwindPlugin;
|
|
6
6
|
exports.animation = tailwind_plugin.animation;
|
package/dist/browser.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { m as main } from "./tailwind.plugin-
|
|
2
|
-
import { T, b, a, f, s } from "./tailwind.plugin-
|
|
1
|
+
import { m as main } from "./tailwind.plugin-DONDY0v2.js";
|
|
2
|
+
import { T, b, a, f, s } from "./tailwind.plugin-DONDY0v2.js";
|
|
3
3
|
export {
|
|
4
4
|
T as TailwindImplPluginBrowser,
|
|
5
5
|
b as TailwindPlugin,
|
package/dist/main.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export type ConfigCss = {
|
|
|
5
5
|
colorKeys: string[];
|
|
6
6
|
fontStyles: string[];
|
|
7
7
|
responsiveBreakPoints: string[];
|
|
8
|
+
fontFamily: string[];
|
|
8
9
|
};
|
|
9
10
|
export declare const main: import('node_modules/tailwindcss/dist/types-CJYAW1ql.mjs').c<ConfigJs>;
|
|
10
11
|
//# sourceMappingURL=main.d.ts.map
|
package/dist/main.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"AAEA,OAAO,EAAQ,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,EAAS,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAG/D,MAAM,MAAM,QAAQ,GAAG,iBAAiB,GAAG,YAAY,CAAC;AACxD,MAAM,MAAM,SAAS,GAAG;IACtB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,qBAAqB,EAAE,MAAM,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"AAEA,OAAO,EAAQ,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,EAAS,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAG/D,MAAM,MAAM,QAAQ,GAAG,iBAAiB,GAAG,YAAY,CAAC;AACxD,MAAM,MAAM,SAAS,GAAG;IACtB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,qBAAqB,EAAE,MAAM,EAAE,CAAC;IAChC,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC;AAEF,eAAO,MAAM,IAAI,wEAoDf,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tailwind.plugin.d.ts","sourceRoot":"","sources":["../../src/node/tailwind.plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE3D,OAAO,EACL,yBAAyB,EACzB,qBAAqB,IAAI,4BAA4B,EACtD,MAAM,4BAA4B,CAAC;AAIpC,MAAM,MAAM,qBAAqB,GAAG,4BAA4B,CAAC;AAEjE,qBAAa,cAAe,SAAQ,cAAc,CAChD,kBAAkB,EAClB,qBAAqB,CACtB;IACQ,YAAY,wBAAgB;IAC5B,IAAI,SAAc;IACzB,WAAW,4BAAsB;CAClC;AAED,cAAM,kBAAmB,SAAQ,yBAAyB;IACxD,OAAO,CAAC,QAAQ;IAQD,MAAM;
|
|
1
|
+
{"version":3,"file":"tailwind.plugin.d.ts","sourceRoot":"","sources":["../../src/node/tailwind.plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE3D,OAAO,EACL,yBAAyB,EACzB,qBAAqB,IAAI,4BAA4B,EACtD,MAAM,4BAA4B,CAAC;AAIpC,MAAM,MAAM,qBAAqB,GAAG,4BAA4B,CAAC;AAEjE,qBAAa,cAAe,SAAQ,cAAc,CAChD,kBAAkB,EAClB,qBAAqB,CACtB;IACQ,YAAY,wBAAgB;IAC5B,IAAI,SAAc;IACzB,WAAW,4BAAsB;CAClC;AAED,cAAM,kBAAmB,SAAQ,yBAAyB;IACxD,OAAO,CAAC,QAAQ;IAQD,MAAM;CAuFtB"}
|
package/dist/node.cjs
CHANGED
|
@@ -24,7 +24,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
24
24
|
));
|
|
25
25
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
26
26
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
27
|
-
const tailwind_plugin = require("./tailwind.plugin-
|
|
27
|
+
const tailwind_plugin = require("./tailwind.plugin-DCCnMjHz.cjs");
|
|
28
28
|
const theme = require("@udixio/theme");
|
|
29
29
|
const fs = require("fs");
|
|
30
30
|
const console = require("node:console");
|
|
@@ -100,18 +100,20 @@ class TailwindImplPlugin extends tailwind_plugin.TailwindImplPluginBrowser {
|
|
|
100
100
|
).join(", "),
|
|
101
101
|
responsiveBreakPoints: Object.entries(
|
|
102
102
|
this.options.responsiveBreakPoints ?? {}
|
|
103
|
-
).map(([key, value]) => `${key} ${value}`).join(", ")
|
|
103
|
+
).map(([key, value]) => `${key} ${value}`).join(", "),
|
|
104
|
+
fontFamily: Object.entries(fontFamily).map(([key, values]) => `${key} ${values.join("|")}`).join(", ")
|
|
104
105
|
};
|
|
105
106
|
this.outputCss += `@plugin "@udixio/tailwind" {
|
|
106
107
|
colorKeys: ${configCss.colorKeys};
|
|
107
108
|
fontStyles: ${configCss.fontStyles};
|
|
108
109
|
responsiveBreakPoints: ${configCss.responsiveBreakPoints};
|
|
110
|
+
fontFamily: ${configCss.fontFamily};
|
|
109
111
|
}`;
|
|
110
112
|
this.loadColor({ isDynamic: false });
|
|
111
113
|
this.outputCss += `
|
|
112
114
|
@theme {
|
|
113
115
|
${Object.entries(fontFamily).map(
|
|
114
|
-
([key, values]) => `--font-${key}: ${values.map((value) => `"${value}"`).join(", ")};`
|
|
116
|
+
([key, values]) => `--font-${key}: ${values.map((value) => value.trim().startsWith("var(") ? value : `"${value}"`).join(", ")};`
|
|
115
117
|
).join("\n ")}
|
|
116
118
|
}`;
|
|
117
119
|
await createOrUpdateFile2(udixioCssPath, this.outputCss);
|
package/dist/node.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
3
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
-
import { T as TailwindImplPluginBrowser, m as main } from "./tailwind.plugin-
|
|
5
|
-
import { a, f, s } from "./tailwind.plugin-
|
|
4
|
+
import { T as TailwindImplPluginBrowser, m as main } from "./tailwind.plugin-DONDY0v2.js";
|
|
5
|
+
import { a, f, s } from "./tailwind.plugin-DONDY0v2.js";
|
|
6
6
|
import { PluginAbstract, FontPlugin } from "@udixio/theme";
|
|
7
7
|
import * as fs from "fs";
|
|
8
8
|
import * as console from "node:console";
|
|
@@ -60,18 +60,20 @@ class TailwindImplPlugin extends TailwindImplPluginBrowser {
|
|
|
60
60
|
).join(", "),
|
|
61
61
|
responsiveBreakPoints: Object.entries(
|
|
62
62
|
this.options.responsiveBreakPoints ?? {}
|
|
63
|
-
).map(([key, value]) => `${key} ${value}`).join(", ")
|
|
63
|
+
).map(([key, value]) => `${key} ${value}`).join(", "),
|
|
64
|
+
fontFamily: Object.entries(fontFamily).map(([key, values]) => `${key} ${values.join("|")}`).join(", ")
|
|
64
65
|
};
|
|
65
66
|
this.outputCss += `@plugin "@udixio/tailwind" {
|
|
66
67
|
colorKeys: ${configCss.colorKeys};
|
|
67
68
|
fontStyles: ${configCss.fontStyles};
|
|
68
69
|
responsiveBreakPoints: ${configCss.responsiveBreakPoints};
|
|
70
|
+
fontFamily: ${configCss.fontFamily};
|
|
69
71
|
}`;
|
|
70
72
|
this.loadColor({ isDynamic: false });
|
|
71
73
|
this.outputCss += `
|
|
72
74
|
@theme {
|
|
73
75
|
${Object.entries(fontFamily).map(
|
|
74
|
-
([key, values]) => `--font-${key}: ${values.map((value) => `"${value}"`).join(", ")};`
|
|
76
|
+
([key, values]) => `--font-${key}: ${values.map((value) => value.trim().startsWith("var(") ? value : `"${value}"`).join(", ")};`
|
|
75
77
|
).join("\n ")}
|
|
76
78
|
}`;
|
|
77
79
|
await createOrUpdateFile2(udixioCssPath, this.outputCss);
|
|
@@ -2,6 +2,10 @@ import { FontRole, FontSize, FontStyle } from '@udixio/theme';
|
|
|
2
2
|
export interface FontPluginOptions {
|
|
3
3
|
fontStyles: Record<FontRole, Record<FontSize, FontStyle>>;
|
|
4
4
|
responsiveBreakPoints: Record<string, number>;
|
|
5
|
+
fontFamily: {
|
|
6
|
+
expressive: string[];
|
|
7
|
+
neutral: string[];
|
|
8
|
+
};
|
|
5
9
|
}
|
|
6
10
|
export declare const font: import('node_modules/tailwindcss/dist/types-CJYAW1ql.mjs').c<FontPluginOptions>;
|
|
7
11
|
//# sourceMappingURL=font.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"font.d.ts","sourceRoot":"","sources":["../../src/plugins-tailwind/font.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAG9D,MAAM,WAAW,iBAAiB;IAChC,UAAU,EAAE,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC;IAC1D,qBAAqB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"font.d.ts","sourceRoot":"","sources":["../../src/plugins-tailwind/font.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAG9D,MAAM,WAAW,iBAAiB;IAChC,UAAU,EAAE,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC;IAC1D,qBAAqB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9C,UAAU,EAAE;QACV,UAAU,EAAE,MAAM,EAAE,CAAC;QACrB,OAAO,EAAE,MAAM,EAAE,CAAC;KACnB,CAAC;CACH;AAED,eAAO,MAAM,IAAI,iFA6Df,CAAC"}
|
|
@@ -454,17 +454,18 @@ const font = plugin.withOptions((options) => {
|
|
|
454
454
|
addUtilities,
|
|
455
455
|
theme: theme2
|
|
456
456
|
}) => {
|
|
457
|
-
const { fontStyles, responsiveBreakPoints } = options;
|
|
457
|
+
const { fontStyles, responsiveBreakPoints, fontFamily } = options;
|
|
458
458
|
const pixelUnit = "rem";
|
|
459
459
|
const newUtilities = {};
|
|
460
460
|
const baseTextStyle = (sizeValue) => {
|
|
461
|
-
const
|
|
461
|
+
const fontFamilyArray = fontFamily[sizeValue.fontFamily];
|
|
462
|
+
const processedFontFamily = fontFamilyArray.map((font2) => font2.trim().startsWith("var(") ? font2 : `"${font2}"`).join(", ");
|
|
462
463
|
return {
|
|
463
464
|
fontSize: sizeValue.fontSize + pixelUnit,
|
|
464
465
|
fontWeight: sizeValue.fontWeight,
|
|
465
466
|
lineHeight: sizeValue.lineHeight + pixelUnit,
|
|
466
467
|
letterSpacing: sizeValue.letterSpacing ? sizeValue.letterSpacing + pixelUnit : null,
|
|
467
|
-
fontFamily:
|
|
468
|
+
fontFamily: processedFontFamily
|
|
468
469
|
};
|
|
469
470
|
};
|
|
470
471
|
const responsiveTextStyle = (sizeValue, breakPointName, breakPointRatio) => ({
|
|
@@ -634,10 +635,20 @@ const main = plugin.withOptions((args) => {
|
|
|
634
635
|
const [key, value] = line.split(" ");
|
|
635
636
|
responsiveBreakPoints[key] = value;
|
|
636
637
|
});
|
|
638
|
+
let fontFamilyCss = configCss.fontFamily;
|
|
639
|
+
if (!Array.isArray(fontFamilyCss)) {
|
|
640
|
+
fontFamilyCss = [fontFamilyCss];
|
|
641
|
+
}
|
|
642
|
+
const fontFamily = {};
|
|
643
|
+
fontFamilyCss.forEach((line) => {
|
|
644
|
+
const [key, ...values] = line.split(" ");
|
|
645
|
+
fontFamily[key] = values.join(" ").split("|");
|
|
646
|
+
});
|
|
637
647
|
const options = {
|
|
638
648
|
colorKeys: configCss.colorKeys,
|
|
639
649
|
fontStyles,
|
|
640
|
-
responsiveBreakPoints
|
|
650
|
+
responsiveBreakPoints,
|
|
651
|
+
fontFamily
|
|
641
652
|
};
|
|
642
653
|
return (api) => {
|
|
643
654
|
font(options).handler(api);
|
|
@@ -453,17 +453,18 @@ const font = plugin.withOptions((options) => {
|
|
|
453
453
|
addUtilities,
|
|
454
454
|
theme
|
|
455
455
|
}) => {
|
|
456
|
-
const { fontStyles, responsiveBreakPoints } = options;
|
|
456
|
+
const { fontStyles, responsiveBreakPoints, fontFamily } = options;
|
|
457
457
|
const pixelUnit = "rem";
|
|
458
458
|
const newUtilities = {};
|
|
459
459
|
const baseTextStyle = (sizeValue) => {
|
|
460
|
-
const
|
|
460
|
+
const fontFamilyArray = fontFamily[sizeValue.fontFamily];
|
|
461
|
+
const processedFontFamily = fontFamilyArray.map((font2) => font2.trim().startsWith("var(") ? font2 : `"${font2}"`).join(", ");
|
|
461
462
|
return {
|
|
462
463
|
fontSize: sizeValue.fontSize + pixelUnit,
|
|
463
464
|
fontWeight: sizeValue.fontWeight,
|
|
464
465
|
lineHeight: sizeValue.lineHeight + pixelUnit,
|
|
465
466
|
letterSpacing: sizeValue.letterSpacing ? sizeValue.letterSpacing + pixelUnit : null,
|
|
466
|
-
fontFamily:
|
|
467
|
+
fontFamily: processedFontFamily
|
|
467
468
|
};
|
|
468
469
|
};
|
|
469
470
|
const responsiveTextStyle = (sizeValue, breakPointName, breakPointRatio) => ({
|
|
@@ -633,10 +634,20 @@ const main = plugin.withOptions((args) => {
|
|
|
633
634
|
const [key, value] = line.split(" ");
|
|
634
635
|
responsiveBreakPoints[key] = value;
|
|
635
636
|
});
|
|
637
|
+
let fontFamilyCss = configCss.fontFamily;
|
|
638
|
+
if (!Array.isArray(fontFamilyCss)) {
|
|
639
|
+
fontFamilyCss = [fontFamilyCss];
|
|
640
|
+
}
|
|
641
|
+
const fontFamily = {};
|
|
642
|
+
fontFamilyCss.forEach((line) => {
|
|
643
|
+
const [key, ...values] = line.split(" ");
|
|
644
|
+
fontFamily[key] = values.join(" ").split("|");
|
|
645
|
+
});
|
|
636
646
|
const options = {
|
|
637
647
|
colorKeys: configCss.colorKeys,
|
|
638
648
|
fontStyles,
|
|
639
|
-
responsiveBreakPoints
|
|
649
|
+
responsiveBreakPoints,
|
|
650
|
+
fontFamily
|
|
640
651
|
};
|
|
641
652
|
return (api) => {
|
|
642
653
|
font(options).handler(api);
|
package/package.json
CHANGED
package/src/main.ts
CHANGED
|
@@ -9,6 +9,7 @@ export type ConfigCss = {
|
|
|
9
9
|
colorKeys: string[];
|
|
10
10
|
fontStyles: string[];
|
|
11
11
|
responsiveBreakPoints: string[];
|
|
12
|
+
fontFamily: string[];
|
|
12
13
|
};
|
|
13
14
|
|
|
14
15
|
export const main = plugin.withOptions<ConfigJs>((args) => {
|
|
@@ -39,10 +40,22 @@ export const main = plugin.withOptions<ConfigJs>((args) => {
|
|
|
39
40
|
responsiveBreakPoints[key] = value;
|
|
40
41
|
});
|
|
41
42
|
|
|
43
|
+
let fontFamilyCss = configCss.fontFamily;
|
|
44
|
+
if (!Array.isArray(fontFamilyCss)) {
|
|
45
|
+
fontFamilyCss = [fontFamilyCss];
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const fontFamily: any = {};
|
|
49
|
+
fontFamilyCss.forEach((line) => {
|
|
50
|
+
const [key, ...values] = line.split(' ');
|
|
51
|
+
fontFamily[key] = values.join(' ').split('|');
|
|
52
|
+
});
|
|
53
|
+
|
|
42
54
|
const options: ConfigJs = {
|
|
43
55
|
colorKeys: configCss.colorKeys,
|
|
44
56
|
fontStyles: fontStyles,
|
|
45
57
|
responsiveBreakPoints,
|
|
58
|
+
fontFamily,
|
|
46
59
|
};
|
|
47
60
|
|
|
48
61
|
return (api: PluginAPI) => {
|
|
@@ -90,12 +90,16 @@ class TailwindImplPlugin extends TailwindImplPluginBrowser {
|
|
|
90
90
|
)
|
|
91
91
|
.map(([key, value]) => `${key} ${value}`)
|
|
92
92
|
.join(', ') as any,
|
|
93
|
+
fontFamily: Object.entries(fontFamily)
|
|
94
|
+
.map(([key, values]) => `${key} ${values.join('|')}`)
|
|
95
|
+
.join(', ') as any,
|
|
93
96
|
};
|
|
94
97
|
|
|
95
98
|
this.outputCss += `@plugin "@udixio/tailwind" {
|
|
96
99
|
colorKeys: ${configCss.colorKeys};
|
|
97
100
|
fontStyles: ${configCss.fontStyles};
|
|
98
101
|
responsiveBreakPoints: ${configCss.responsiveBreakPoints};
|
|
102
|
+
fontFamily: ${configCss.fontFamily};
|
|
99
103
|
}`;
|
|
100
104
|
this.loadColor({ isDynamic: false });
|
|
101
105
|
this.outputCss += `
|
|
@@ -103,7 +107,7 @@ class TailwindImplPlugin extends TailwindImplPluginBrowser {
|
|
|
103
107
|
${Object.entries(fontFamily)
|
|
104
108
|
.map(
|
|
105
109
|
([key, values]) =>
|
|
106
|
-
`--font-${key}: ${values.map((value) => `"${value}"`).join(', ')};`,
|
|
110
|
+
`--font-${key}: ${values.map((value) => value.trim().startsWith('var(') ? value : `"${value}"`).join(', ')};`,
|
|
107
111
|
)
|
|
108
112
|
.join('\n ')}
|
|
109
113
|
}`;
|
|
@@ -4,6 +4,10 @@ import plugin, { PluginAPI } from 'tailwindcss/plugin';
|
|
|
4
4
|
export interface FontPluginOptions {
|
|
5
5
|
fontStyles: Record<FontRole, Record<FontSize, FontStyle>>;
|
|
6
6
|
responsiveBreakPoints: Record<string, number>;
|
|
7
|
+
fontFamily: {
|
|
8
|
+
expressive: string[];
|
|
9
|
+
neutral: string[];
|
|
10
|
+
};
|
|
7
11
|
}
|
|
8
12
|
|
|
9
13
|
export const font = plugin.withOptions((options: FontPluginOptions) => {
|
|
@@ -11,13 +15,19 @@ export const font = plugin.withOptions((options: FontPluginOptions) => {
|
|
|
11
15
|
addUtilities,
|
|
12
16
|
theme,
|
|
13
17
|
}: Pick<PluginAPI, 'addUtilities' | 'theme'>) => {
|
|
14
|
-
const { fontStyles, responsiveBreakPoints } = options;
|
|
18
|
+
const { fontStyles, responsiveBreakPoints, fontFamily } = options;
|
|
15
19
|
|
|
16
20
|
const pixelUnit = 'rem';
|
|
17
21
|
const newUtilities: Record<string, any> = {};
|
|
18
22
|
|
|
19
23
|
const baseTextStyle = (sizeValue: FontStyle) => {
|
|
20
|
-
const
|
|
24
|
+
const fontFamilyArray = fontFamily[sizeValue.fontFamily as keyof typeof fontFamily];
|
|
25
|
+
|
|
26
|
+
// Process font family: keep var() without quotes, add quotes to others
|
|
27
|
+
const processedFontFamily = fontFamilyArray
|
|
28
|
+
.map((font) => (font.trim().startsWith('var(') ? font : `"${font}"`))
|
|
29
|
+
.join(', ');
|
|
30
|
+
|
|
21
31
|
return {
|
|
22
32
|
fontSize: sizeValue.fontSize + pixelUnit,
|
|
23
33
|
fontWeight: sizeValue.fontWeight as unknown as any,
|
|
@@ -25,9 +35,7 @@ export const font = plugin.withOptions((options: FontPluginOptions) => {
|
|
|
25
35
|
letterSpacing: sizeValue.letterSpacing
|
|
26
36
|
? sizeValue.letterSpacing + pixelUnit
|
|
27
37
|
: null,
|
|
28
|
-
fontFamily:
|
|
29
|
-
? fontFamilyValue.join(', ')
|
|
30
|
-
: fontFamilyValue,
|
|
38
|
+
fontFamily: processedFontFamily,
|
|
31
39
|
};
|
|
32
40
|
};
|
|
33
41
|
|