AI-native design editor. Open-source Figma alternative.
fix(dom-css): write corner radius from Tailwind's radius scale (#1067)
Danila Poyarkov6b5df387ba18
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 84d1be48b..2969394db 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -173,6 +173,7 @@### Fixed+- Tailwind exports keep corner radius: Tailwind JSX and HTML with Tailwind classes write radius from Tailwind's radius scale, such as `rounded-xl` for 12px, instead of classes like `rounded-3` that Tailwind v4 does not generate, and other values as `rounded-[20px]`.- ⌘Z right after arrow-key nudges undoes the nudges instead of the edit before them.- <kbd>⇧</kbd>-dragging a corner handle follows the side the pointer stretched most relative to the layer's size, as Figma does, instead of the side it moved more pixels along.- The AI provider list labels its "Your agents" and "Providers" groups in the app language instead of always in English.diff --git a/bun.lock b/bun.lockindex 0a663bb18..483e351a2 100644--- a/bun.lock+++ b/bun.lock@@ -235,7 +235,7 @@"svg-path-properties": "^2.0.2","svg2pdf.js": "^2.8.1","svgpath": "^2.6.0",- "twirlwind": "^0.4.0",+ "twirlwind": "^0.4.1","unifont": "0.7.4","valibot": "^1.5.0","yoga-layout": "npm:@open-pencil/[email protected]",@@ -304,7 +304,7 @@"parse5": "^8.0.1","postcss-value-parser": "^4.2.0","tailwindcss": "^4.3.3",- "twirlwind": "^0.4.0",+ "twirlwind": "^0.4.1",},"devDependencies": {"@iconify/react": "^6.0.2",@@ -4276,7 +4276,7 @@"tw-animate-css": ["[email protected]", "", {}, "sha512-7bziOlRqH0hJx80h/3mbicLW7o8qLsH5+RaLR2t+OHM3D0JlWGODQKQ4cxbK7WlvmUxpcj6Kgu6EKqjrGFe3QQ=="],- "twirlwind": ["[email protected]", "", { "dependencies": { "postcss-value-parser": "^4.2.0" } }, "sha512-CAb/KHW0ZuIbkrnffc7PpbNpvW41YtxvqC5e3vWsQZMUa1jw8Dd4Ay4J0HRBYQS4V5fK3Cv75aNrhyp1eFqVvA=="],+ "twirlwind": ["[email protected]", "", { "dependencies": { "postcss-value-parser": "^4.2.0" } }, "sha512-Sc9z+IF3QCTAGPBRjpLKHIUROAsOnoyn3AaejpkAJrz1DFHsQKPd4Ic250gPRgRS5d7Jm5O4fLzu2Ip2IRp6Tg=="],"twoslash": ["[email protected]", "", { "dependencies": { "@typescript/vfs": "^1.6.4", "twoslash-protocol": "0.3.9" }, "peerDependencies": { "typescript": "^5.5.0 || ^6.0.0" } }, "sha512-rDclk+OtzuTX+tnea7DYLCkqGQ3eP0IyfD+kzUJ7t46X/NzlaxwrhecmEBNuSCuEn3V+n1PhcjUUQQ7gUJzX5Q=="],diff --git a/packages/core/package.json b/packages/core/package.jsonindex b98e3875a..eb932df5d 100644--- a/packages/core/package.json+++ b/packages/core/package.json@@ -214,7 +214,7 @@"svg-path-properties": "^2.0.2","svg2pdf.js": "^2.8.1","svgpath": "^2.6.0",- "twirlwind": "^0.4.0",+ "twirlwind": "^0.4.1","unifont": "0.7.4","valibot": "^1.5.0","yoga-layout": "npm:@open-pencil/[email protected]"diff --git a/packages/dom-css/package.json b/packages/dom-css/package.jsonindex f0c865ee0..20ad46ba9 100644--- a/packages/dom-css/package.json+++ b/packages/dom-css/package.json@@ -106,6 +106,6 @@"parse5": "^8.0.1","postcss-value-parser": "^4.2.0","tailwindcss": "^4.3.3",- "twirlwind": "^0.4.0"+ "twirlwind": "^0.4.1"}}diff --git a/packages/dom-css/tests/export/components/layers.test.ts b/packages/dom-css/tests/export/components/layers.test.tsindex a6f831788..bfb649953 100644--- a/packages/dom-css/tests/export/components/layers.test.ts+++ b/packages/dom-css/tests/export/components/layers.test.ts@@ -3,6 +3,7 @@ import { describe, expect, test } from 'bun:test'import { switchSet } from '#dom-css-tests/behaviours/fixtures'import { fileText } from '#dom-css-tests/helpers'import { layerComponents, layerMarkup } from '#dom-css/export'+import { compileTailwindCSS } from '#dom-css/import/tailwind'import { SceneGraph } from '@open-pencil/scene-graph'@@ -122,6 +123,19 @@ describe('layers as HTML and CSS', () => {expect(css).toBe('')})+ test("styled with Tailwind, corners are rounded from Tailwind's radius scale", async () => {+ const graph = new SceneGraph()+ const frame = card(graph, 'Card')+ graph.updateNode(frame.id, { cornerRadius: 16 })++ const { html } = await layerMarkup(graph, [frame.id], { styling: 'tailwind' })+ const classes = /class="([^"]*)"/.exec(html)?.[1].split(' ') ?? []++ // Radius has no spacing scale: `rounded-4` would generate nothing.+ expect(classes).toContain('rounded-2xl')+ expect(await compileTailwindCSS(classes)).toContain('border-radius: var(--radius-2xl)')+ })+test('layers named alike keep their rules apart', async () => {const graph = new SceneGraph()const first = card(graph, 'Card')