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
experimental: support columns and list-style shorthands (#3557)
Bogdan Chadkin132e94d290d5
diff --git a/packages/css-data/src/shorthands.test.ts b/packages/css-data/src/shorthands.test.tsindex 8df94e16a4..a86821d8da 100644--- a/packages/css-data/src/shorthands.test.ts+++ b/packages/css-data/src/shorthands.test.ts@@ -487,17 +487,54 @@ test("expand flex-flow", () => {]);});+test("expand columns", () => {+ expect(expandShorthands([["columns", "4 20px"]])).toEqual([+ ["column-width", "20px"],+ ["column-count", "4"],+ ]);+ expect(expandShorthands([["columns", "4"]])).toEqual([+ ["column-width", "initial"],+ ["column-count", "4"],+ ]);+ expect(expandShorthands([["columns", "20px"]])).toEqual([+ ["column-width", "20px"],+ ["column-count", "initial"],+ ]);+});++test("expand column-rule", () => {+ expect(expandShorthands([["column-rule", "thick inset blue"]])).toEqual([+ ["column-rule-width", "thick"],+ ["column-rule-style", "inset"],+ ["column-rule-color", "blue"],+ ]);+});++test("expand list-style", () => {+ expect(+ expandShorthands([+ ["list-style", `lower-roman url("img/shape.png") outside`],+ ])+ ).toEqual([+ ["list-style-position", "outside"],+ ["list-style-image", "url(img/shape.png)"],+ ["list-style-type", "lower-roman"],+ ]);+ expect(expandShorthands([["list-style", `square`]])).toEqual([+ ["list-style-position", "initial"],+ ["list-style-image", "initial"],+ ["list-style-type", "square"],+ ]);+});+test.todo("animation");test.todo("container");-test.todo("columns");-test.todo("column-rule");test.todo("contain-intrinsic-size");test.todo("grid");test.todo("grid-area");test.todo("grid-column");test.todo("grid-row");test.todo("grid-template");-test.todo("list-style");test.todo("mask");test.todo("mask-border");test.todo("offset");diff --git a/packages/css-data/src/shorthands.ts b/packages/css-data/src/shorthands.tsindex a5c3ef9c9e..a487d6eeda 100644--- a/packages/css-data/src/shorthands.ts+++ b/packages/css-data/src/shorthands.ts@@ -435,6 +435,46 @@ const expandShorthandsAst = function* (property: string, value: CssNode) {break;}+ case "columns": {+ const [width, count] = parseUnordered(+ ["<'column-width'>", "<'column-count'>"],+ value+ );+ yield ["column-width", width ?? createInitialNode()] as const;+ yield ["column-count", count ?? createInitialNode()] as const;+ break;+ }++ case "column-rule": {+ const [width, style, color] = parseUnordered(+ [+ "<'column-rule-width'>",+ "<'column-rule-style'>",+ "<'column-rule-color'>",+ ],+ value+ );+ yield ["column-rule-width", width ?? createInitialNode()] as const;+ yield ["column-rule-style", style ?? createInitialNode()] as const;+ yield ["column-rule-color", color ?? createInitialNode()] as const;+ break;+ }++ case "list-style": {+ const [position, image, type] = parseUnordered(+ [+ "<'list-style-position'>",+ "<'list-style-image'>",+ "<'list-style-type'>",+ ],+ value+ );+ yield ["list-style-position", position ?? createInitialNode()] as const;+ yield ["list-style-image", image ?? createInitialNode()] as const;+ yield ["list-style-type", type ?? createInitialNode()] as const;+ break;+ }+default:yield [property, value] as const;}