Skip to content

Commit

Permalink
add mdn-data for css functions
Browse files Browse the repository at this point in the history
  • Loading branch information
rviscomi committed Mar 3, 2025
1 parent f07bb3c commit acba6e3
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 85 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@
"got": "^14.4.2",
"lint-staged": "^15.2.7",
"mdast-util-from-markdown": "^2.0.2",
"mdn-data": "^2.17.0",
"mocha": "^10.4.0",
"prettier": "^3.4.1",
"rollup": "^4.16.2",
Expand Down
84 changes: 0 additions & 84 deletions src/data/baseline-data.js
Original file line number Diff line number Diff line change
Expand Up @@ -563,49 +563,23 @@ export const types = new Map([
["anchor", 0],
["anchor-size", 0],
["inset", 10],
["time", 10],
["fallback", 0],
["type-or-unit", 0],
["attr", 10],
["blend-mode", 10],
["line-style", 10],
["calc", 10],
["gradient", 10],
["nested", 10],
["number", 10],
["calc-keyword", 5],
["NaN", 5],
["e", 5],
["infinity", 5],
["pi", 5],
["calc-size", 0],
["cap", 0],
["revert-layer", 10],
["ch", 10],
["shape", 10],
["rect", 10],
["color", 5],
["color-mix", 5],
["conic-gradient", 5],
["repeating-conic-gradient", 5],
["container", 5],
["string", 10],
["unicode", 10],
["counter", 10],
["counters", 10],
["cross-fade", 0],
["easing-function", 10],
["cubic-bezier", 10],
["currentcolor", 10],
["element", 0],
["em", 10],
["ex", 0],
["exp", 5],
["hypot", 5],
["log", 5],
["pow", 5],
["sqrt", 5],
["filter-function", 10],
["blur", 10],
["brightness", 10],
["contrast", 10],
Expand All @@ -616,78 +590,33 @@ export const types = new Map([
["opacity", 10],
["saturate", 10],
["sepia", 10],
["url", 10],
["linear-gradient", 10],
["radial-gradient", 10],
["repeating-linear-gradient", 10],
["repeating-radial-gradient", 10],
["image", 10],
["flex", 10],
["hsl", 5],
["hwb", 5],
["ic", 5],
["image-set", 5],
["global", 10],
["inherit", 10],
["initial", 10],
["lab", 5],
["lch", 5],
["lh", 5],
["light-dark", 5],
["linear-function", 5],
["ratio", 10],
["clamp", 10],
["max", 10],
["min", 10],
["ray", 5],
["position", 10],
["size", 5],
["named-color", 10],
["oklab", 5],
["oklch", 5],
["scientific", 10],
["overlay", 0],
["overflow", 5],
["clip", 5],
["paint", 0],
["path", 0],
["Q", 10],
["rcap", 0],
["rch", 0],
["rgb", 10],
["rem", 5],
["resolution", 5],
["dpcm", 5],
["dpi", 5],
["dppx", 5],
["x", 5],
["revert", 10],
["rex", 0],
["alpha", 10],
["ric", 0],
["rlh", 5],
["mod", 5],
["round", 5],
["basic-shape", 10],
["animation", 10],
["circle", 10],
["ellipse", 10],
["polygon", 10],
["xywh", 10],
["steps", 10],
["system-color", 10],
["text-edge", 0],
["alphabetic", 0],
["text", 0],
["angle", 10],
["angle-percentage", 10],
["deg", 10],
["grad", 10],
["rad", 10],
["turn", 10],
["four", 10],
["keyword", 10],
["transform-function", 10],
["matrix", 10],
["rotate", 10],
["scale", 10],
Expand Down Expand Up @@ -716,19 +645,6 @@ export const types = new Map([
["cos", 5],
["sin", 5],
["tan", 5],
["unset", 10],
["vb", 5],
["vi", 5],
["viewport", 5],
["vh", 10],
["vmax", 10],
["vmin", 10],
["vw", 10],
["dimension", 10],
["length", 10],
["length-percentage", 10],
["percentage", 10],
["integer", 10],
]);
export const selectors = new Map([
["active-view-transition", 0],
Expand Down
7 changes: 6 additions & 1 deletion tools/generate-baseline.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
//------------------------------------------------------------------------------

import { features as webFeatures } from "web-features";
import mdnData from "mdn-data";
import prettier from "prettier";
import fs from "node:fs";

Expand Down Expand Up @@ -126,7 +127,11 @@ function extractCSSFeatures(features) {

// types
if ((match = cssTypePattern.exec(key)) !== null) {
types[match.groups.type] = baselineIds.get(baseline);
const type = match.groups.type;
if (!(`${type}()` in mdnData.css.functions)) {
continue;
}
types[type] = baselineIds.get(baseline);
continue;
}

Expand Down

0 comments on commit acba6e3

Please sign in to comment.