Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.
TypeScript accessibilityalternativecloudflarecloudflare-workersdesignfreefrontendopen-sourceradix-uireactremixweb-developmentwebflowwebsite-builderwebsite-developmentwebsiteswebstudio
Fix switch display (#569)
Ivan Starkovb39e6a6376dc
diff --git a/@types/css-tree.d.ts b/@types/css-tree.d.tsindex da19694c77..58cf893b15 100644--- a/@types/css-tree.d.ts+++ b/@types/css-tree.d.ts@@ -9,6 +9,10 @@ declare module "css-tree" {syntax: { type: "Property"; name: string };match: Match[];}+ | {+ syntax: { type: "Type"; name: string };+ match: Match[];+ }| {syntax: { type: "Keyword"; name: string };token: string;diff --git a/apps/designer/app/designer/features/style-panel/shared/parse-css-value.test.ts b/apps/designer/app/designer/features/style-panel/shared/parse-css-value.test.tsindex 827894492f..ff4fc43119 100644--- a/apps/designer/app/designer/features/style-panel/shared/parse-css-value.test.ts+++ b/apps/designer/app/designer/features/style-panel/shared/parse-css-value.test.ts@@ -36,6 +36,13 @@ describe("Parse CSS value", () => {});});+ test("keyword display block", () => {+ expect(parseCssValue("display", "block")).toEqual({+ type: "keyword",+ value: "block",+ });+ });+test("keyword with unit", () => {expect(parseCssValue("width", "autopx")).toEqual({type: "invalid",diff --git a/apps/designer/app/designer/features/style-panel/shared/parse-css-value.ts b/apps/designer/app/designer/features/style-panel/shared/parse-css-value.tsindex 5a91dc50bf..4cda81d8f4 100644--- a/apps/designer/app/designer/features/style-panel/shared/parse-css-value.ts+++ b/apps/designer/app/designer/features/style-panel/shared/parse-css-value.ts@@ -107,15 +107,28 @@ export const parseCssValue = (const match ="match" in matchResult.matched ? matchResult.matched.match : undefined;- if (- match != null &&- match.length === 1 &&- match[0].syntax?.type === "Keyword"- ) {- return {- type: "keyword",- value: input,- } as const;+ if (match?.length === 1) {+ const singleMatch = match[0];++ if (singleMatch.syntax?.type === "Keyword") {+ return {+ type: "keyword",+ value: input,+ } as const;+ }++ if (singleMatch.syntax?.type === "Type") {+ if ("match" in singleMatch && singleMatch.match.length === 1) {+ const singleMatchMatch = singleMatch.match[0];++ if (singleMatchMatch.syntax?.type === "Keyword") {+ return {+ type: "keyword",+ value: input,+ } as const;+ }+ }+ }}}