Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/compiler/__tests__/declarations.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { compile } from "../compiler";

const tests = [
["caret-color: black", [{ d: [["#000", ["cursorColor"]]], s: [1, 1] }]],
["stroke: black;", [{ d: [["#000", ["stroke"]]], s: [1, 1] }]],
] as const;

Expand Down
5 changes: 4 additions & 1 deletion src/compiler/atRules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,10 @@ function isPropAtRule(rule: Rule | PropAtRule): rule is PropAtRule {
}

export function parsePropAtRule(rules?: (Rule | PropAtRule)[]) {
const mapping: StyleRuleMapping = {};
// Include any default mapping here
const mapping: StyleRuleMapping = {
"caret-color": ["cursorColor"],
};

if (!rules) return mapping;

Expand Down
13 changes: 1 addition & 12 deletions src/compiler/declarations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ const parsers: {
"border-width": parseBorderWidth,
"bottom": parseSizeDeclaration,
"box-shadow": parseBoxShadow,
"caret-color": parseCaretColor,
"caret-color": parseColorOrAutoDeclaration,
"color": parseFontColorDeclaration,
"column-gap": parseGap,
"container": parseContainer,
Expand Down Expand Up @@ -244,17 +244,6 @@ const parsers: {

const validProperties = new Set(Object.keys(parsers));

function parseCaretColor(
declaration: DeclarationType<"caret-color">,
builder: StylesheetBuilder,
) {
builder.addMapping({ [declaration.property]: ["cursorColor"] });
builder.addDescriptor(
"caret-color",
parseColorOrAutoDeclaration(declaration, builder),
);
}

export function parseDeclaration(
declaration: Declaration,
builder: StylesheetBuilder,
Expand Down
1 change: 1 addition & 0 deletions src/compiler/stylesheet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export class StylesheetBuilder {
private ruleTemplate: StyleRule = {
s: [],
},
// Any default mapping should be included in the @prop parsing
private mapping: StyleRuleMapping = {},
public descriptorProperty?: string,
private shared: {
Expand Down
Loading