Files
webstudio/packages/css-data/src/custom-data.ts
T
Bogdan Chadkin 87e69b2e85 Move style schema into css-engine (#2251)
Css-data now responsible for generated data and parsers which requires
heavy dependencies like csstree and openai.

Here moved style schema into css-engine which makes is responsible for
own input representation. So now schema and serialization are co-located
in single package.

Cli install size

```diff
du -ck node_modules
- 42680
+ 35516
```
2023-09-06 15:55:41 +04:00

58 lines
1.3 KiB
TypeScript

import type { StyleValue } from "@webstudio-is/css-engine";
import { popularityIndex } from "./popularity-index";
// Data type used before we generate a the constants.
type RawPropertyData = {
unitGroups: string[];
inherited: boolean;
initial: StyleValue;
popularity: number;
appliesTo: string;
};
export const propertiesData: { [property: string]: RawPropertyData } = {};
export const keywordValues: { [property: string]: Array<string> } = {};
const getPopularityIndex = (property: string) =>
popularityIndex.find((data) => data.property === property)?.dayPercentage ??
0;
propertiesData.WebkitFontSmoothing = {
unitGroups: [],
inherited: true,
initial: {
type: "keyword",
value: "auto",
},
popularity: getPopularityIndex("webkit-font-smoothing"),
appliesTo: "allElements",
};
keywordValues.WebkitFontSmoothing = [
"auto",
"none",
"antialiased",
"subpixel-antialiased",
];
propertiesData.MozOsxFontSmoothing = {
unitGroups: [],
inherited: true,
initial: {
type: "keyword",
value: "auto",
},
popularity: getPopularityIndex("moz-osx-font-smoothing"),
appliesTo: "allElements",
};
keywordValues.MozOsxFontSmoothing = ["auto", "grayscale"];
keywordValues.listStyleType = [
"disc",
"circle",
"square",
"decimal",
"georgian",
"trad-chinese-informal",
"kannada",
];