-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathprocessFunctions.ts
More file actions
39 lines (37 loc) · 985 Bytes
/
processFunctions.ts
File metadata and controls
39 lines (37 loc) · 985 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import { CustomAtRules, TokenOrValue, Visitor } from "lightningcss";
const ONE_PX = {
type: "token",
value: { type: "dimension", unit: "px", value: 1 },
} satisfies TokenOrValue;
export const processFunctions: Visitor<CustomAtRules>["Function"] = {
pixelRatio: (fn) => {
return {
type: "function",
value: {
name: "calc",
arguments: [
fn.arguments.at(0) ?? ONE_PX,
{ type: "token", value: { type: "delim", value: "*" } },
ONE_PX,
],
},
} satisfies TokenOrValue;
},
fontScale: (fn) => {
return {
type: "function",
value: {
name: "calc",
arguments: [
fn.arguments.at(0) ?? ONE_PX,
{ type: "token", value: { type: "delim", value: "*" } },
{
type: "token",
value: { type: "dimension", value: 1, unit: "rem" },
},
],
},
} satisfies TokenOrValue;
},
hairlineWidth: () => ONE_PX,
};