Skip to content

Commit 4aa6037

Browse files
authored
fix: gap shorthand parsing (#55)
1 parent 72dc12d commit 4aa6037

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

src/compiler/declarations.ts

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import type {
1515
FontStyle,
1616
FontVariantCaps,
1717
FontWeight,
18+
GapValue,
1819
Gradient,
1920
GradientItemFor_DimensionPercentageFor_LengthValue,
2021
Length,
@@ -2065,8 +2066,14 @@ export function parseGap(
20652066
builder: StylesheetBuilder,
20662067
) {
20672068
if ("column" in declaration.value) {
2068-
builder.addDescriptor("row-gap", parseGap(declaration, builder));
2069-
builder.addDescriptor("column-gap", parseGap(declaration, builder));
2069+
builder.addDescriptor(
2070+
"row-gap",
2071+
parseGapValue(declaration.value.row, builder),
2072+
);
2073+
builder.addDescriptor(
2074+
"column-gap",
2075+
parseGapValue(declaration.value.column, builder),
2076+
);
20702077

20712078
return;
20722079
} else {
@@ -2079,6 +2086,17 @@ export function parseGap(
20792086
}
20802087
}
20812088

2089+
function parseGapValue(
2090+
value: GapValue,
2091+
builder: StylesheetBuilder,
2092+
): StyleDescriptor {
2093+
if (value.type === "normal") {
2094+
return;
2095+
} else {
2096+
return parseLength(value.value, builder);
2097+
}
2098+
}
2099+
20822100
export function parseTextAlign(
20832101
{ value }: DeclarationType<"text-align">,
20842102
builder: StylesheetBuilder,

0 commit comments

Comments
 (0)