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: fix webflow html embed preset styles (#3791)
Oleg Isonen7f1af26ad897
diff --git a/apps/builder/app/shared/copy-paste/plugin-webflow/__generated__/style-presets.ts b/apps/builder/app/shared/copy-paste/plugin-webflow/__generated__/style-presets.tsindex 98d9d56005..be70ec3a1a 100644--- a/apps/builder/app/shared/copy-paste/plugin-webflow/__generated__/style-presets.ts+++ b/apps/builder/app/shared/copy-paste/plugin-webflow/__generated__/style-presets.ts@@ -1,7 +1,7 @@/* eslint-disable *//* This file was generated by css-to-ws.ts */-export const _styles = {+export const styles = {html: [{selector: "html",@@ -469,7 +469,7 @@ export const _styles = {property: "outlineColor",value: {type: "keyword",- value: "currentColor",+ value: "currentcolor",},state: ":active",},@@ -497,7 +497,7 @@ export const _styles = {property: "outlineColor",value: {type: "keyword",- value: "currentColor",+ value: "currentcolor",},state: ":hover",},@@ -525,7 +525,7 @@ export const _styles = {property: "borderBottomColor",value: {type: "keyword",- value: "currentColor",+ value: "currentcolor",},},],@@ -937,7 +937,7 @@ export const _styles = {property: "borderTopColor",value: {type: "keyword",- value: "currentColor",+ value: "currentcolor",},},{@@ -945,7 +945,7 @@ export const _styles = {property: "borderRightColor",value: {type: "keyword",- value: "currentColor",+ value: "currentcolor",},},{@@ -953,7 +953,7 @@ export const _styles = {property: "borderBottomColor",value: {type: "keyword",- value: "currentColor",+ value: "currentcolor",},},{@@ -961,7 +961,7 @@ export const _styles = {property: "borderLeftColor",value: {type: "keyword",- value: "currentColor",+ value: "currentcolor",},},{@@ -1343,7 +1343,7 @@ export const _styles = {property: "borderTopColor",value: {type: "keyword",- value: "currentColor",+ value: "currentcolor",},state: "::-moz-focus-inner",},@@ -1352,7 +1352,7 @@ export const _styles = {property: "borderRightColor",value: {type: "keyword",- value: "currentColor",+ value: "currentcolor",},state: "::-moz-focus-inner",},@@ -1361,7 +1361,7 @@ export const _styles = {property: "borderBottomColor",value: {type: "keyword",- value: "currentColor",+ value: "currentcolor",},state: "::-moz-focus-inner",},@@ -1370,7 +1370,7 @@ export const _styles = {property: "borderLeftColor",value: {type: "keyword",- value: "currentColor",+ value: "currentcolor",},state: "::-moz-focus-inner",},@@ -1487,7 +1487,7 @@ export const _styles = {property: "borderTopColor",value: {type: "keyword",- value: "currentColor",+ value: "currentcolor",},},{@@ -1495,7 +1495,7 @@ export const _styles = {property: "borderRightColor",value: {type: "keyword",- value: "currentColor",+ value: "currentcolor",},},{@@ -1503,7 +1503,7 @@ export const _styles = {property: "borderBottomColor",value: {type: "keyword",- value: "currentColor",+ value: "currentcolor",},},{@@ -1511,7 +1511,7 @@ export const _styles = {property: "borderLeftColor",value: {type: "keyword",- value: "currentColor",+ value: "currentcolor",},},],@@ -1713,7 +1713,7 @@ export const _styles = {property: "borderTopColor",value: {type: "keyword",- value: "currentColor",+ value: "currentcolor",},state: "::-moz-focus-inner",},@@ -1722,7 +1722,7 @@ export const _styles = {property: "borderRightColor",value: {type: "keyword",- value: "currentColor",+ value: "currentcolor",},state: "::-moz-focus-inner",},@@ -1731,7 +1731,7 @@ export const _styles = {property: "borderBottomColor",value: {type: "keyword",- value: "currentColor",+ value: "currentcolor",},state: "::-moz-focus-inner",},@@ -1740,7 +1740,7 @@ export const _styles = {property: "borderLeftColor",value: {type: "keyword",- value: "currentColor",+ value: "currentcolor",},state: "::-moz-focus-inner",},@@ -2249,7 +2249,7 @@ export const _styles = {property: "borderTopColor",value: {type: "keyword",- value: "currentColor",+ value: "currentcolor",},},{@@ -2257,7 +2257,7 @@ export const _styles = {property: "borderRightColor",value: {type: "keyword",- value: "currentColor",+ value: "currentcolor",},},{@@ -2265,7 +2265,7 @@ export const _styles = {property: "borderBottomColor",value: {type: "keyword",- value: "currentColor",+ value: "currentcolor",},},{@@ -2273,7 +2273,7 @@ export const _styles = {property: "borderLeftColor",value: {type: "keyword",- value: "currentColor",+ value: "currentcolor",},},{@@ -3098,7 +3098,7 @@ export const _styles = {property: "borderTopColor",value: {type: "keyword",- value: "currentColor",+ value: "currentcolor",},},{@@ -3106,7 +3106,7 @@ export const _styles = {property: "borderRightColor",value: {type: "keyword",- value: "currentColor",+ value: "currentcolor",},},{@@ -3114,7 +3114,7 @@ export const _styles = {property: "borderBottomColor",value: {type: "keyword",- value: "currentColor",+ value: "currentcolor",},},{@@ -3122,7 +3122,7 @@ export const _styles = {property: "borderLeftColor",value: {type: "keyword",- value: "currentColor",+ value: "currentcolor",},},{@@ -3201,7 +3201,7 @@ export const _styles = {property: "textDecorationStyle",value: {type: "keyword",- value: "initial",+ value: "solid",},},{@@ -3209,7 +3209,7 @@ export const _styles = {property: "textDecorationColor",value: {type: "keyword",- value: "initial",+ value: "currentcolor",},},{@@ -3316,23 +3316,23 @@ export const _styles = {value: [{type: "unit",- value: 0,unit: "number",+ value: 0,},{type: "unit",- value: 0,unit: "number",+ value: 0,},{type: "unit",- value: 0,unit: "number",+ value: 0,},{type: "unit",- value: 1,unit: "px",+ value: 1,},{type: "rgb",@@ -3348,18 +3348,18 @@ export const _styles = {value: [{type: "unit",- value: 0,unit: "number",+ value: 0,},{type: "unit",- value: 1,unit: "px",+ value: 1,},{type: "unit",- value: 3,unit: "px",+ value: 3,},{type: "rgb",@@ -3528,7 +3528,7 @@ export const _styles = {property: "textDecorationStyle",value: {type: "keyword",- value: "initial",+ value: "solid",},},{@@ -3536,7 +3536,7 @@ export const _styles = {property: "textDecorationColor",value: {type: "keyword",- value: "initial",+ value: "currentcolor",},},{@@ -4049,8 +4049,8 @@ export const _styles = {value: [{type: "unit",- value: 0,unit: "s",+ value: 0,},],},@@ -4076,8 +4076,8 @@ export const _styles = {value: [{type: "unit",- value: 0,unit: "s",+ value: 0,},],},@@ -4165,8 +4165,13 @@ export const _styles = {selector: "w-webflow-badge",property: "transform",value: {- type: "keyword",- value: "none",+ type: "tuple",+ value: [+ {+ type: "keyword",+ value: "none",+ },+ ],},},],@@ -4889,7 +4894,7 @@ export const _styles = {property: "borderTopColor",value: {type: "keyword",- value: "currentColor",+ value: "currentcolor",},},{@@ -4897,7 +4902,7 @@ export const _styles = {property: "borderRightColor",value: {type: "keyword",- value: "currentColor",+ value: "currentcolor",},},{@@ -4905,7 +4910,7 @@ export const _styles = {property: "borderBottomColor",value: {type: "keyword",- value: "currentColor",+ value: "currentcolor",},},{@@ -4913,7 +4918,7 @@ export const _styles = {property: "borderLeftColor",value: {type: "keyword",- value: "currentColor",+ value: "currentcolor",},},{@@ -5553,7 +5558,7 @@ export const _styles = {property: "outlineColor",value: {type: "keyword",- value: "currentColor",+ value: "currentcolor",},state: ":focus",},@@ -5915,7 +5920,7 @@ export const _styles = {property: "outlineColor",value: {type: "keyword",- value: "currentColor",+ value: "currentcolor",},state: ":focus",},@@ -10489,18 +10494,18 @@ export const _styles = {value: [{type: "unit",- value: 0,unit: "number",+ value: 0,},{type: "unit",- value: 0,unit: "number",+ value: 0,},{type: "unit",- value: 3,unit: "px",+ value: 3,},{type: "rgb",@@ -10658,13 +10663,13 @@ export const _styles = {value: [{type: "unit",- value: 0.1,unit: "s",+ value: 0.1,},{type: "unit",- value: 0.1,unit: "s",+ value: 0.1,},],},@@ -10694,13 +10699,13 @@ export const _styles = {value: [{type: "unit",- value: 0,unit: "s",+ value: 0,},{type: "unit",- value: 0,unit: "s",+ value: 0,},],},@@ -10761,7 +10766,7 @@ export const _styles = {property: "outlineColor",value: {type: "keyword",- value: "currentColor",+ value: "currentcolor",},state: ":focus",},@@ -10968,7 +10973,7 @@ export const _styles = {property: "outlineColor",value: {type: "keyword",- value: "currentColor",+ value: "currentcolor",},state: ":focus",},@@ -11165,7 +11170,7 @@ export const _styles = {property: "outlineColor",value: {type: "keyword",- value: "currentColor",+ value: "currentcolor",},state: ":focus",},@@ -11261,7 +11266,7 @@ export const _styles = {property: "borderTopColor",value: {type: "keyword",- value: "currentColor",+ value: "currentcolor",},},{@@ -11269,7 +11274,7 @@ export const _styles = {property: "borderRightColor",value: {type: "keyword",- value: "currentColor",+ value: "currentcolor",},},{@@ -11277,7 +11282,7 @@ export const _styles = {property: "borderBottomColor",value: {type: "keyword",- value: "currentColor",+ value: "currentcolor",},},{@@ -11285,7 +11290,7 @@ export const _styles = {property: "borderLeftColor",value: {type: "keyword",- value: "currentColor",+ value: "currentcolor",},},{@@ -11573,7 +11578,7 @@ export const _styles = {property: "textDecorationStyle",value: {type: "keyword",- value: "initial",+ value: "solid",},},{@@ -11581,7 +11586,7 @@ export const _styles = {property: "textDecorationColor",value: {type: "keyword",- value: "initial",+ value: "currentcolor",},},{@@ -11702,7 +11707,7 @@ export const _styles = {property: "textDecorationStyle",value: {type: "keyword",- value: "initial",+ value: "solid",},},{@@ -11710,7 +11715,7 @@ export const _styles = {property: "textDecorationColor",value: {type: "keyword",- value: "initial",+ value: "currentcolor",},},{@@ -11769,7 +11774,7 @@ export const _styles = {property: "outlineColor",value: {type: "keyword",- value: "currentColor",+ value: "currentcolor",},state: ":focus",},@@ -11883,7 +11888,7 @@ export const _styles = {property: "textDecorationStyle",value: {type: "keyword",- value: "initial",+ value: "solid",},},{@@ -11891,7 +11896,7 @@ export const _styles = {property: "textDecorationColor",value: {type: "keyword",- value: "initial",+ value: "currentcolor",},},{@@ -11934,7 +11939,7 @@ export const _styles = {property: "outlineColor",value: {type: "keyword",- value: "currentColor",+ value: "currentcolor",},state: ":focus",},@@ -12191,7 +12196,7 @@ export const _styles = {property: "textDecorationStyle",value: {type: "keyword",- value: "initial",+ value: "solid",},},{@@ -12199,7 +12204,7 @@ export const _styles = {property: "textDecorationColor",value: {type: "keyword",- value: "initial",+ value: "currentcolor",},},{@@ -12512,7 +12517,7 @@ export const _styles = {property: "outlineColor",value: {type: "keyword",- value: "currentColor",+ value: "currentcolor",},},{@@ -12630,8 +12635,23 @@ export const _styles = {selector: "w-lightbox-backdrop",property: "transform",value: {- type: "unparsed",- value: "translate(0)",+ type: "tuple",+ value: [+ {+ type: "function",+ args: {+ type: "layers",+ value: [+ {+ type: "unit",+ unit: "number",+ value: 0,+ },+ ],+ },+ name: "translate",+ },+ ],},},{@@ -13423,8 +13443,8 @@ export const _styles = {value: [{type: "unit",- value: 0.3,unit: "s",+ value: 0.3,},],},@@ -13450,8 +13470,8 @@ export const _styles = {value: [{type: "unit",- value: 0,unit: "s",+ value: 0,},],},@@ -13872,8 +13892,33 @@ export const _styles = {selector: "w-lightbox-item",property: "transform",value: {- type: "unparsed",- value: "translate3d(0,0,0)",+ type: "tuple",+ value: [+ {+ type: "function",+ args: {+ type: "layers",+ value: [+ {+ type: "unit",+ unit: "number",+ value: 0,+ },+ {+ type: "unit",+ unit: "number",+ value: 0,+ },+ {+ type: "unit",+ unit: "number",+ value: 0,+ },+ ],+ },+ name: "translate3d",+ },+ ],},},],@@ -15413,7 +15458,7 @@ export const _styles = {property: "textDecorationStyle",value: {type: "keyword",- value: "initial",+ value: "solid",},},{@@ -15421,7 +15466,7 @@ export const _styles = {property: "textDecorationColor",value: {type: "keyword",- value: "initial",+ value: "currentcolor",},},{@@ -15679,7 +15724,7 @@ export const _styles = {property: "outlineColor",value: {type: "keyword",- value: "currentColor",+ value: "currentcolor",},state: ":focus",},@@ -15977,7 +16022,7 @@ export const _styles = {property: "textDecorationStyle",value: {type: "keyword",- value: "initial",+ value: "solid",},},{@@ -15985,7 +16030,7 @@ export const _styles = {property: "textDecorationColor",value: {type: "keyword",- value: "initial",+ value: "currentcolor",},},{@@ -16028,7 +16073,7 @@ export const _styles = {property: "outlineColor",value: {type: "keyword",- value: "currentColor",+ value: "currentcolor",},state: ":focus",},@@ -16995,23 +17040,23 @@ export const _styles = {value: [{type: "unit",- value: 0,unit: "number",+ value: 0,},{type: "unit",- value: 0,unit: "number",+ value: 0,},{type: "unit",- value: 3,unit: "px",+ value: 3,},{type: "unit",- value: 1,unit: "px",+ value: 1,},{type: "rgb",@@ -17200,23 +17245,23 @@ export const _styles = {value: [{type: "unit",- value: 0,unit: "number",+ value: 0,},{type: "unit",- value: 0,unit: "number",+ value: 0,},{type: "unit",- value: 3,unit: "px",+ value: 3,},{type: "unit",- value: 1,unit: "px",+ value: 1,},{type: "rgb",@@ -17400,23 +17445,23 @@ export const _styles = {value: [{type: "unit",- value: 0,unit: "number",+ value: 0,},{type: "unit",- value: 0,unit: "number",+ value: 0,},{type: "unit",- value: 3,unit: "px",+ value: 3,},{type: "unit",- value: 1,unit: "px",+ value: 1,},{type: "rgb",@@ -17712,9 +17757,3 @@ export const _styles = {},],};-type WIcons = Record<- `w-icon-${string}`,- (typeof _styles)[`w-icon-slider-right`]->;-export type Styles = typeof _styles & WIcons;-export const styles: Styles = _styles;diff --git a/apps/builder/app/shared/copy-paste/plugin-webflow/plugin-webflow.test.tsx b/apps/builder/app/shared/copy-paste/plugin-webflow/plugin-webflow.test.tsxindex 78f0197370..e5a6d4850f 100644--- a/apps/builder/app/shared/copy-paste/plugin-webflow/plugin-webflow.test.tsx+++ b/apps/builder/app/shared/copy-paste/plugin-webflow/plugin-webflow.test.tsx@@ -185,10 +185,10 @@ test("Link Block, Button, Text Link", async () => {background-color: rgba(0, 0, 0, 0)}a:active {- outline: 0 none currentColor+ outline: 0 none currentcolor}a:hover {- outline: 0 none currentColor+ outline: 0 none currentcolor}}"`);@@ -941,7 +941,7 @@ test("Image", async () => {vertical-align: middle;max-width: 100%;display: inline-block;- border: 0 none currentColor+ border: 0 none currentcolor}}"`);@@ -968,6 +968,9 @@ test("HtmlEmbed", async () => {equalFragment(fragment, <$.HtmlEmbed code="some html" clientOnly={true} />);expect(toCss(fragment)).toMatchInlineSnapshot(`"@media all {+ w-embed {+ display: block+ }w-embed:after {content: " ";grid-row-start: 1;@@ -1501,10 +1504,10 @@ test("RichText", async () => {background-color: rgba(0, 0, 0, 0)}a:active {- outline: 0 none currentColor+ outline: 0 none currentcolor}a:hover {- outline: 0 none currentColor+ outline: 0 none currentcolor}strong {font-weight: bold@@ -1655,7 +1658,7 @@ test("Form", async () => {padding: 0}input::-moz-focus-inner {- border: 0 none currentColor;+ border: 0 none currentcolor;padding: 0}w-input {@@ -1690,7 +1693,7 @@ test("Form", async () => {border-right-color: rgba(56, 152, 236, 1);border-bottom-color: rgba(56, 152, 236, 1);border-left-color: rgba(56, 152, 236, 1);- outline: 0 none currentColor+ outline: 0 none currentcolor}}"`);@@ -1739,7 +1742,7 @@ test("FormButton", async () => {padding: 0}input::-moz-focus-inner {- border: 0 none currentColor;+ border: 0 none currentcolor;padding: 0}w-button {@@ -1755,11 +1758,11 @@ test("FormButton", async () => {padding-bottom: 9px;padding-left: 15px;text-decoration-line: none;- text-decoration-style: initial;- text-decoration-color: initial;+ text-decoration-style: solid;+ text-decoration-color: currentcolor;display: inline-block;appearance: button;- border: 0 none currentColor+ border: 0 none currentcolor}}"`);@@ -1827,7 +1830,7 @@ test("FormTextInput", async () => {padding: 0}input::-moz-focus-inner {- border: 0 none currentColor;+ border: 0 none currentcolor;padding: 0}w-input {@@ -1862,7 +1865,7 @@ test("FormTextInput", async () => {border-right-color: rgba(56, 152, 236, 1);border-bottom-color: rgba(56, 152, 236, 1);border-left-color: rgba(56, 152, 236, 1);- outline: 0 none currentColor+ outline: 0 none currentcolor}}"`);@@ -1996,7 +1999,7 @@ test("FormTextarea", async () => {border-right-color: rgba(56, 152, 236, 1);border-bottom-color: rgba(56, 152, 236, 1);border-left-color: rgba(56, 152, 236, 1);- outline: 0 none currentColor+ outline: 0 none currentcolor}}"`);@@ -2146,7 +2149,7 @@ test("FormCheckboxWrapper, FormCheckboxInput, FormInlineLabel", async () => {padding: 0}input::-moz-focus-inner {- border: 0 none currentColor;+ border: 0 none currentcolor;padding: 0}w-checkbox-input {@@ -2271,7 +2274,7 @@ test("FormRadioWrapper, FormRadioInput, FormInlineLabel", async () => {padding: 0}input::-moz-focus-inner {- border: 0 none currentColor;+ border: 0 none currentcolor;padding: 0}w-radio-input {@@ -2673,10 +2676,10 @@ describe("Styles", () => {background-color: rgba(0, 0, 0, 0)}a:active {- outline: 0 none currentColor+ outline: 0 none currentcolor}a:hover {- outline: 0 none currentColor+ outline: 0 none currentcolor}button.is-small.is-secondary {text-align: center;@@ -2884,10 +2887,10 @@ describe("Styles", () => {background-color: rgba(0, 0, 0, 0)}a:active {- outline: 0 none currentColor+ outline: 0 none currentcolor}a:hover {- outline: 0 none currentColor+ outline: 0 none currentcolor}x {transform: translate3d(7px, 74px, 16px)diff --git a/apps/builder/app/shared/copy-paste/plugin-webflow/style-presets-overrides.ts b/apps/builder/app/shared/copy-paste/plugin-webflow/style-presets-overrides.tsnew file mode 100644index 0000000000..a1c6a98ad1--- /dev/null+++ b/apps/builder/app/shared/copy-paste/plugin-webflow/style-presets-overrides.ts@@ -0,0 +1,24 @@+import type { ParsedStyleDecl } from "@webstudio-is/css-data";+import { styles } from "./__generated__/style-presets";++const _stylePresets = {+ ...styles,+ "w-embed": [+ ...styles["w-embed"],+ {+ selector: "w-embed",+ property: "display",+ value: {+ type: "keyword",+ value: "block",+ },+ },+ ],+};++type Key = keyof typeof _stylePresets;++type WfIcons = Record<`w-icon-${string}`, ParsedStyleDecl>;++export type WfStylePresets = Record<Key, Array<ParsedStyleDecl>> & WfIcons;+export const stylePresets = _stylePresets as WfStylePresets;diff --git a/apps/builder/app/shared/copy-paste/plugin-webflow/styles.ts b/apps/builder/app/shared/copy-paste/plugin-webflow/styles.tsindex 0d8bdc05fb..d8e9823a59 100644--- a/apps/builder/app/shared/copy-paste/plugin-webflow/styles.ts+++ b/apps/builder/app/shared/copy-paste/plugin-webflow/styles.ts@@ -13,7 +13,7 @@ import {} from "@webstudio-is/css-data";import { kebabCase } from "change-case";import { equalMedia, hyphenateProperty } from "@webstudio-is/css-engine";-import type { Styles as WfStylePresets } from "./__generated__/style-presets";+import type { WfStylePresets } from "./style-presets-overrides";import { builderApi } from "~/shared/builder-api";import { url } from "css-tree";import { mapGroupBy } from "~/shared/shim";@@ -501,9 +501,7 @@ export const addStyles = async ({fragment: WebstudioFragment;generateStyleSourceId: (sourceData: string) => Promise<string>;}) => {- const { styles: stylePresets } = await import(- "./__generated__/style-presets"- );+ const { stylePresets } = await import("./style-presets-overrides");for (const wfNode of wfNodes.values()) {if ("text" in wfNode) {diff --git a/packages/css-data/bin/css-to-ws.ts b/packages/css-data/bin/css-to-ws.tsindex 3b79c73bea..f6844b2b4c 100755--- a/packages/css-data/bin/css-to-ws.ts+++ b/packages/css-data/bin/css-to-ws.ts@@ -40,13 +40,7 @@ mkdirSync(path.dirname(destinationPath), { recursive: true });const code = `/* eslint-disable *//* This file was generated by css-to-ws.ts */-export const _styles = ${JSON.stringify(records, null, 2)};-type WIcons = Record<- \`w-icon-\${string}\`,- (typeof _styles)[\`w-icon-slider-right\`]->;-export type Styles = typeof _styles & WIcons;-export const styles: Styles = _styles;+export const styles = ${JSON.stringify(records, null, 2)};`;writeFileSync(destinationPath, code, "utf8");