Skip to content

Commit 4abb7cf

Browse files
authored
feat: support svg properties in style panel (#5332)
Ref #5258 Newer mdn-data contains all stylable svg properties (they finally got through some documentation and implementation process). Tweaked all experimental stuff and ditched obsolete properties. <img width="286" height="538" alt="image" src="https://github.com/user-attachments/assets/1e579be0-0a12-4013-ab04-09d5e008aeed" />
1 parent 1eb11fd commit 4abb7cf

File tree

12 files changed

+2020
-806
lines changed

12 files changed

+2020
-806
lines changed

apps/builder/app/builder/features/settings-panel/props-section/animation/animation-keyframes.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ const OffsetInput = ({
6767
intermediateValue={intermediateValue}
6868
styleSource="default"
6969
/* same as offset has 0 - 100% */
70-
property={"font-stretch"}
70+
property={"opacity"}
7171
value={
7272
value !== undefined
7373
? { type: "unit", value: roundOffset(value), unit: "%" }

apps/builder/app/builder/features/style-panel/shared/css-value-input/parse-intermediate-or-invalid-value.ts.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ describe("Parse intermediate or invalid value without math evaluation", () => {
4949
});
5050

5151
test("fallback to % if px is not supported", () => {
52-
const result = parseIntermediateOrInvalidValue("font-stretch", {
52+
const result = parseIntermediateOrInvalidValue("opacity", {
5353
type: "intermediate",
5454
value: "10",
5555
});

packages/css-data/bin/mdn-data.ts

Lines changed: 11 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -235,25 +235,18 @@ const writeToFile = (fileName: string, constant: string, data: unknown) => {
235235
};
236236

237237
const supportedExperimentalProperties = [
238-
"appearance",
239-
"aspect-ratio",
238+
"field-sizing",
240239
"text-size-adjust",
241-
"-webkit-line-clamp",
242-
"background-position-x",
243-
"background-position-y",
244240
"-webkit-tap-highlight-color",
245241
"-webkit-overflow-scrolling",
246-
"transition-behavior",
247-
"offset-position",
248-
// https://github.com/mdn/data/pull/759
249-
// offset-anchor is standard according to mdn.
250-
// But the mdn_url is missing from its config which is skipping othe starndard check.
251-
"offset-anchor",
252242
];
253243

254244
// Properties we don't support in this form.
255245
const unsupportedProperties = [
256246
"--*",
247+
"-webkit-text-fill-color",
248+
"-webkit-text-stroke-color",
249+
"-webkit-text-stroke-width",
257250
// shorthand properties
258251
"all",
259252
"font-synthesis",
@@ -262,6 +255,12 @@ const unsupportedProperties = [
262255
"white-space",
263256
"text-wrap",
264257
"background-position",
258+
"border-block-style",
259+
"border-block-width",
260+
"border-block-color",
261+
"border-inline-style",
262+
"border-inline-width",
263+
"border-inline-color",
265264
];
266265

267266
type FilteredProperties = { [property: string]: Value };
@@ -334,7 +333,7 @@ const getPropertiesData = (
334333
const unitGroups = new Set<string>();
335334
walkSyntax(config.syntax, (node) => {
336335
if (node.type === "Type") {
337-
if (node.name === "integer" || node.name === "number") {
336+
if (node.name === "number-token" || node.name === "number") {
338337
unitGroups.add("number");
339338
return;
340339
}
@@ -374,10 +373,6 @@ const pseudoElements = Object.keys(selectors)
374373

375374
const getKeywordValues = (filteredProperties: FilteredProperties) => {
376375
const result = { ...customData.keywordValues };
377-
// Non-standard properties are just missing in mdn data
378-
const nonStandardValues = {
379-
"background-clip": ["text"],
380-
};
381376
// https://www.w3.org/TR/css-values/#common-keywords
382377
const commonKeywords = ["initial", "inherit", "unset"];
383378

@@ -393,13 +388,6 @@ const getKeywordValues = (filteredProperties: FilteredProperties) => {
393388
}
394389
});
395390

396-
if (property in nonStandardValues) {
397-
for (const nonStandartKeyword of nonStandardValues[
398-
property as keyof typeof nonStandardValues
399-
]) {
400-
keywords.add(nonStandartKeyword);
401-
}
402-
}
403391
for (const commonKeyword of commonKeywords) {
404392
// Delete to add commonKeyword at the end of the set
405393
keywords.delete(commonKeyword);

packages/css-data/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"@types/css-tree": "^2.3.1",
2020
"@webstudio-is/tsconfig": "workspace:*",
2121
"html-tags": "^4.0.0",
22-
"mdn-data": "2.8.0",
22+
"mdn-data": "2.23.0",
2323
"vitest": "^3.1.2",
2424
"zod": "^3.24.2"
2525
},

packages/css-data/src/__generated__/animatable-properties.ts

Lines changed: 28 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)