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: Paste from webflow 11 (#3623)
Oleg Isonen853c0f7d483f
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 c38555baa9..48a29efb42 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@@ -398,7 +398,7 @@ export const styles = {property: "outlineStyle",value: {type: "keyword",- value: "initial",+ value: "none",},state: ":active",},@@ -406,7 +406,7 @@ export const styles = {property: "outlineStyle",value: {type: "keyword",- value: "initial",+ value: "none",},state: ":hover",},@@ -414,7 +414,7 @@ export const styles = {property: "outlineColor",value: {type: "keyword",- value: "initial",+ value: "currentColor",},state: ":active",},@@ -422,7 +422,7 @@ export const styles = {property: "outlineColor",value: {type: "keyword",- value: "initial",+ value: "currentColor",},state: ":hover",},@@ -447,7 +447,7 @@ export const styles = {property: "borderBottomColor",value: {type: "keyword",- value: "initial",+ value: "currentColor",},},],@@ -691,56 +691,56 @@ export const styles = {property: "borderTopStyle",value: {type: "keyword",- value: "initial",+ value: "none",},},{property: "borderRightStyle",value: {type: "keyword",- value: "initial",+ value: "none",},},{property: "borderBottomStyle",value: {type: "keyword",- value: "initial",+ value: "none",},},{property: "borderLeftStyle",value: {type: "keyword",- value: "initial",+ value: "none",},},{property: "borderTopColor",value: {type: "keyword",- value: "initial",+ value: "currentColor",},},{property: "borderRightColor",value: {type: "keyword",- value: "initial",+ value: "currentColor",},},{property: "borderBottomColor",value: {type: "keyword",- value: "initial",+ value: "currentColor",},},{property: "borderLeftColor",value: {type: "keyword",- value: "initial",+ value: "currentColor",},},{@@ -982,6 +982,106 @@ export const styles = {value: "none",},},+ {+ property: "borderTopWidth",+ value: {+ type: "unit",+ unit: "number",+ value: 0,+ },+ state: "::-moz-focus-inner",+ },+ {+ property: "borderRightWidth",+ value: {+ type: "unit",+ unit: "number",+ value: 0,+ },+ state: "::-moz-focus-inner",+ },+ {+ property: "borderBottomWidth",+ value: {+ type: "unit",+ unit: "number",+ value: 0,+ },+ state: "::-moz-focus-inner",+ },+ {+ property: "borderLeftWidth",+ value: {+ type: "unit",+ unit: "number",+ value: 0,+ },+ state: "::-moz-focus-inner",+ },+ {+ property: "borderTopStyle",+ value: {+ type: "keyword",+ value: "none",+ },+ state: "::-moz-focus-inner",+ },+ {+ property: "borderRightStyle",+ value: {+ type: "keyword",+ value: "none",+ },+ state: "::-moz-focus-inner",+ },+ {+ property: "borderBottomStyle",+ value: {+ type: "keyword",+ value: "none",+ },+ state: "::-moz-focus-inner",+ },+ {+ property: "borderLeftStyle",+ value: {+ type: "keyword",+ value: "none",+ },+ state: "::-moz-focus-inner",+ },+ {+ property: "borderTopColor",+ value: {+ type: "keyword",+ value: "currentColor",+ },+ state: "::-moz-focus-inner",+ },+ {+ property: "borderRightColor",+ value: {+ type: "keyword",+ value: "currentColor",+ },+ state: "::-moz-focus-inner",+ },+ {+ property: "borderBottomColor",+ value: {+ type: "keyword",+ value: "currentColor",+ },+ state: "::-moz-focus-inner",+ },+ {+ property: "borderLeftColor",+ value: {+ type: "keyword",+ value: "currentColor",+ },+ state: "::-moz-focus-inner",+ },{property: "paddingTop",value: {@@ -989,6 +1089,7 @@ export const styles = {unit: "number",value: 0,},+ state: "::-moz-focus-inner",},{property: "paddingRight",@@ -997,6 +1098,7 @@ export const styles = {unit: "number",value: 0,},+ state: "::-moz-focus-inner",},{property: "paddingBottom",@@ -1005,6 +1107,7 @@ export const styles = {unit: "number",value: 0,},+ state: "::-moz-focus-inner",},{property: "paddingLeft",@@ -1013,6 +1116,7 @@ export const styles = {unit: "number",value: 0,},+ state: "::-moz-focus-inner",},{property: "cursor",@@ -1064,56 +1168,56 @@ export const styles = {property: "borderTopStyle",value: {type: "keyword",- value: "initial",+ value: "none",},},{property: "borderRightStyle",value: {type: "keyword",- value: "initial",+ value: "none",},},{property: "borderBottomStyle",value: {type: "keyword",- value: "initial",+ value: "none",},},{property: "borderLeftStyle",value: {type: "keyword",- value: "initial",+ value: "none",},},{property: "borderTopColor",value: {type: "keyword",- value: "initial",+ value: "currentColor",},},{property: "borderRightColor",value: {type: "keyword",- value: "initial",+ value: "currentColor",},},{property: "borderBottomColor",value: {type: "keyword",- value: "initial",+ value: "currentColor",},},{property: "borderLeftColor",value: {type: "keyword",- value: "initial",+ value: "currentColor",},},],@@ -1242,56 +1346,56 @@ export const styles = {property: "borderTopStyle",value: {type: "keyword",- value: "initial",+ value: "none",},},{property: "borderRightStyle",value: {type: "keyword",- value: "initial",+ value: "none",},},{property: "borderBottomStyle",value: {type: "keyword",- value: "initial",+ value: "none",},},{property: "borderLeftStyle",value: {type: "keyword",- value: "initial",+ value: "none",},},{property: "borderTopColor",value: {type: "keyword",- value: "initial",+ value: "currentColor",},},{property: "borderRightColor",value: {type: "keyword",- value: "initial",+ value: "currentColor",},},{property: "borderBottomColor",value: {type: "keyword",- value: "initial",+ value: "currentColor",},},{property: "borderLeftColor",value: {type: "keyword",- value: "initial",+ value: "currentColor",},},{@@ -1690,56 +1794,56 @@ export const styles = {property: "borderTopStyle",value: {type: "keyword",- value: "initial",+ value: "none",},},{property: "borderRightStyle",value: {type: "keyword",- value: "initial",+ value: "none",},},{property: "borderBottomStyle",value: {type: "keyword",- value: "initial",+ value: "none",},},{property: "borderLeftStyle",value: {type: "keyword",- value: "initial",+ value: "none",},},{property: "borderTopColor",value: {type: "keyword",- value: "initial",+ value: "currentColor",},},{property: "borderRightColor",value: {type: "keyword",- value: "initial",+ value: "currentColor",},},{property: "borderBottomColor",value: {type: "keyword",- value: "initial",+ value: "currentColor",},},{property: "borderLeftColor",value: {type: "keyword",- value: "initial",+ value: "currentColor",},},{@@ -2503,56 +2607,56 @@ export const styles = {property: "borderTopStyle",value: {type: "keyword",- value: "initial",+ value: "none",},},{property: "borderRightStyle",value: {type: "keyword",- value: "initial",+ value: "none",},},{property: "borderBottomStyle",value: {type: "keyword",- value: "initial",+ value: "none",},},{property: "borderLeftStyle",value: {type: "keyword",- value: "initial",+ value: "none",},},{property: "borderTopColor",value: {type: "keyword",- value: "initial",+ value: "currentColor",},},{property: "borderRightColor",value: {type: "keyword",- value: "initial",+ value: "currentColor",},},{property: "borderBottomColor",value: {type: "keyword",- value: "initial",+ value: "currentColor",},},{property: "borderLeftColor",value: {type: "keyword",- value: "initial",+ value: "currentColor",},},{@@ -2890,28 +2994,28 @@ export const styles = {property: "borderTopStyle",value: {type: "keyword",- value: "initial",+ value: "none",},},{property: "borderRightStyle",value: {type: "keyword",- value: "initial",+ value: "none",},},{property: "borderBottomStyle",value: {type: "keyword",- value: "initial",+ value: "none",},},{property: "borderLeftStyle",value: {type: "keyword",- value: "initial",+ value: "none",},},{@@ -3910,56 +4014,56 @@ export const styles = {property: "borderTopStyle",value: {type: "keyword",- value: "initial",+ value: "none",},},{property: "borderRightStyle",value: {type: "keyword",- value: "initial",+ value: "none",},},{property: "borderBottomStyle",value: {type: "keyword",- value: "initial",+ value: "none",},},{property: "borderLeftStyle",value: {type: "keyword",- value: "initial",+ value: "none",},},{property: "borderTopColor",value: {type: "keyword",- value: "initial",+ value: "currentColor",},},{property: "borderRightColor",value: {type: "keyword",- value: "initial",+ value: "currentColor",},},{property: "borderBottomColor",value: {type: "keyword",- value: "initial",+ value: "currentColor",},},{property: "borderLeftColor",value: {type: "keyword",- value: "initial",+ value: "currentColor",},},{@@ -4210,6 +4314,16 @@ export const styles = {},],"w-input": [+ {+ property: "color",+ value: {+ type: "rgb",+ alpha: 1,+ r: 51,+ g: 51,+ b: 51,+ },+ },{property: "verticalAlign",value: {@@ -4409,6 +4523,17 @@ export const styles = {},state: ":-moz-placeholder",},+ {+ property: "color",+ value: {+ type: "rgb",+ alpha: 1,+ r: 153,+ g: 153,+ b: 153,+ },+ state: "::-moz-placeholder",+ },{property: "opacity",value: {@@ -4416,6 +4541,7 @@ export const styles = {unit: "number",value: 1,},+ state: "::-moz-placeholder",},{property: "color",@@ -4426,6 +4552,7 @@ export const styles = {g: 153,b: 153,},+ state: "::-webkit-input-placeholder",},{property: "borderTopColor",@@ -4484,7 +4611,7 @@ export const styles = {property: "outlineStyle",value: {type: "keyword",- value: "initial",+ value: "none",},state: ":focus",},@@ -4492,7 +4619,7 @@ export const styles = {property: "outlineColor",value: {type: "keyword",- value: "initial",+ value: "currentColor",},state: ":focus",},@@ -4720,14 +4847,14 @@ export const styles = {property: "outlineStyle",value: {type: "keyword",- value: "initial",+ value: "none",},},{property: "outlineColor",value: {type: "keyword",- value: "initial",+ value: "currentColor",},},{@@ -7256,7 +7383,7 @@ export const styles = {property: "borderTopWidth",value: {type: "keyword",- value: "initial",+ value: "medium",},state: ":after",},@@ -7264,7 +7391,7 @@ export const styles = {property: "borderRightWidth",value: {type: "keyword",- value: "initial",+ value: "medium",},state: ":after",},@@ -7272,7 +7399,7 @@ export const styles = {property: "borderBottomWidth",value: {type: "keyword",- value: "initial",+ value: "medium",},state: ":after",},@@ -7280,7 +7407,7 @@ export const styles = {property: "borderLeftWidth",value: {type: "keyword",- value: "initial",+ value: "medium",},state: ":after",},@@ -8150,7 +8277,7 @@ export const styles = {property: "transitionDelay",value: {type: "unparsed",- value: "0.1s,0.1s",+ value: "0s,0s",},},{@@ -8188,7 +8315,7 @@ export const styles = {property: "outlineWidth",value: {type: "keyword",- value: "initial",+ value: "medium",},state: ":focus",},@@ -8204,7 +8331,7 @@ export const styles = {property: "outlineColor",value: {type: "keyword",- value: "initial",+ value: "currentColor",},state: ":focus",},@@ -8361,7 +8488,7 @@ export const styles = {property: "outlineStyle",value: {type: "keyword",- value: "initial",+ value: "none",},state: ":focus",},@@ -8369,7 +8496,7 @@ export const styles = {property: "outlineColor",value: {type: "keyword",- value: "initial",+ value: "currentColor",},state: ":focus",},@@ -8532,14 +8659,14 @@ export const styles = {property: "outlineStyle",value: {type: "keyword",- value: "initial",+ value: "none",},},{property: "outlineColor",value: {type: "keyword",- value: "initial",+ value: "currentColor",},},{@@ -8602,56 +8729,56 @@ export const styles = {property: "borderTopStyle",value: {type: "keyword",- value: "initial",+ value: "none",},},{property: "borderRightStyle",value: {type: "keyword",- value: "initial",+ value: "none",},},{property: "borderBottomStyle",value: {type: "keyword",- value: "initial",+ value: "none",},},{property: "borderLeftStyle",value: {type: "keyword",- value: "initial",+ value: "none",},},{property: "borderTopColor",value: {type: "keyword",- value: "initial",+ value: "currentColor",},},{property: "borderRightColor",value: {type: "keyword",- value: "initial",+ value: "currentColor",},},{property: "borderBottomColor",value: {type: "keyword",- value: "initial",+ value: "currentColor",},},{property: "borderLeftColor",value: {type: "keyword",- value: "initial",+ value: "currentColor",},},{@@ -9057,7 +9184,7 @@ export const styles = {property: "outlineStyle",value: {type: "keyword",- value: "initial",+ value: "none",},state: ":focus",},@@ -9065,7 +9192,7 @@ export const styles = {property: "outlineColor",value: {type: "keyword",- value: "initial",+ value: "currentColor",},state: ":focus",},@@ -9196,7 +9323,7 @@ export const styles = {property: "outlineStyle",value: {type: "keyword",- value: "initial",+ value: "none",},state: ":focus",},@@ -9204,7 +9331,7 @@ export const styles = {property: "outlineColor",value: {type: "keyword",- value: "initial",+ value: "currentColor",},state: ":focus",},@@ -9504,14 +9631,14 @@ export const styles = {property: "outlineStyle",value: {type: "keyword",- value: "initial",+ value: "none",},},{property: "outlineColor",value: {type: "keyword",- value: "initial",+ value: "currentColor",},},{@@ -10144,7 +10271,7 @@ export const styles = {value: {type: "unit",unit: "s",- value: 0.3,+ value: 0,},},{@@ -11840,7 +11967,7 @@ export const styles = {property: "outlineStyle",value: {type: "keyword",- value: "initial",+ value: "none",},state: ":focus",},@@ -11848,7 +11975,7 @@ export const styles = {property: "outlineColor",value: {type: "keyword",- value: "initial",+ value: "currentColor",},state: ":focus",},@@ -12145,7 +12272,7 @@ export const styles = {property: "outlineStyle",value: {type: "keyword",- value: "initial",+ value: "none",},state: ":focus",},@@ -12153,7 +12280,7 @@ export const styles = {property: "outlineColor",value: {type: "keyword",- value: "initial",+ value: "currentColor",},state: ":focus",},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 3809d6db65..620eb5b979 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@@ -1721,14 +1721,10 @@ describe("Styles", () => {background-color: rgba(0, 0, 0, 0)}a:active {- outline-width: 0;- outline-style: initial;- outline-color: initial+ outline: 0 none currentColor}a:hover {- outline-width: 0;- outline-style: initial;- outline-color: initial+ outline: 0 none currentColor}button {text-align: center@@ -1774,6 +1770,116 @@ describe("Styles", () => {}"`);});++ test("States", async () => {+ const fragment = await toWebstudioFragment({+ type: "@webflow/XscpData",+ payload: {+ nodes: [+ {+ _id: "5c66aeeb-941d-c52f-8e14-c54312878021",+ type: "Link",+ tag: "a",+ classes: ["81cf331a-ed88-7a5f-3538-8915c7788aea"],+ children: [],+ data: {+ link: {+ url: "#",+ },+ },+ },+ ],+ styles: [+ {+ _id: "81cf331a-ed88-7a5f-3538-8915c7788aea",+ fake: false,+ type: "class",+ name: "x",+ namespace: "",+ comb: "",+ styleLess: "transform: translate3d(7px, 74px, 16px);",+ variants: {+ main_hover: {+ styleLess: "background-color: hsla(0, 85.19%, 42.12%, 1.00);",+ },+ tiny_focus: {+ styleLess: "background-color: hsla(264, 73.75%, 38.37%, 1.00);",+ },+ tiny_active: {+ styleLess: "background-color: hsla(0, 46.06%, 51.80%, 1.00);",+ },+ "tiny_focus-visible": {+ styleLess: "background-color: hsla(264, 36.36%, 41.56%, 1.00);",+ },+ tiny_visited: {+ styleLess: "background-color: hsla(0, 83.67%, 42.10%, 1.00);",+ },+ tiny_hover: {+ styleLess: "background-color: hsla(0, 60.99%, 58.99%, 1.00);",+ },+ },+ },+ ],+ assets: [],+ },+ });++ expect(fragment.styleSources).toEqual([+ {+ type: "token",+ id: expect.any(String),+ name: "a",+ },+ {+ type: "token",+ id: expect.any(String),+ name: "x",+ },+ ]);+ expect(fragment.styleSourceSelections).toEqual([+ {+ instanceId: expect.any(String),+ values: [expect.any(String), expect.any(String)],+ },+ ]);++ expect(toCss(fragment)).toMatchInlineSnapshot(`+ "@media all {+ a {+ background-color: rgba(0, 0, 0, 0)+ }+ a:active {+ outline: 0 none currentColor+ }+ a:hover {+ outline: 0 none currentColor+ }+ x {+ transform: translate3d(7px,74px,16px)+ }+ x:hover {+ background-color: rgba(199, 16, 16, 1)+ }+ }+ @media all and (max-width: 479px) {+ x:active {+ background-color: rgba(189, 75, 75, 1)+ }+ x:focus {+ background-color: rgba(83, 26, 170, 1)+ }+ x:focus-visible {+ background-color: rgba(98, 67, 145, 1)+ }+ x:hover {+ background-color: rgba(214, 87, 87, 1)+ }+ x:visited {+ background-color: rgba(197, 18, 18, 1)+ }+ }"+ `);+ });});test("Breakpoints", async () => {diff --git a/apps/builder/app/shared/copy-paste/plugin-webflow/schema.ts b/apps/builder/app/shared/copy-paste/plugin-webflow/schema.tsindex 36642da9bb..902ab33ed6 100644--- a/apps/builder/app/shared/copy-paste/plugin-webflow/schema.ts+++ b/apps/builder/app/shared/copy-paste/plugin-webflow/schema.ts@@ -252,14 +252,7 @@ export const WfStyle = z.object({comb: z.string().optional(),namespace: z.string().optional(),variants: z- .object({- large: z.object({ styleLess: z.string() }).optional(),- medium: z.object({ styleLess: z.string() }).optional(),- small: z.object({ styleLess: z.string() }).optional(),- tiny: z.object({ styleLess: z.string() }).optional(),- xl: z.object({ styleLess: z.string() }).optional(),- xxl: z.object({ styleLess: z.string() }).optional(),- })+ .record(z.string(), z.object({ styleLess: z.string() })).optional(),children: z.array(z.string()).optional(),createdBy: z.string().optional(),diff --git a/apps/builder/app/shared/copy-paste/plugin-webflow/styles.ts b/apps/builder/app/shared/copy-paste/plugin-webflow/styles.tsindex 3ac42a62e8..2a1a2258ab 100644--- a/apps/builder/app/shared/copy-paste/plugin-webflow/styles.ts+++ b/apps/builder/app/shared/copy-paste/plugin-webflow/styles.ts@@ -7,7 +7,7 @@ import type {import type { WfElementNode, WfNode, WfStyle } from "./schema";import { nanoid } from "nanoid";import { $breakpoints } from "~/shared/nano-states";-import { parseCss } from "@webstudio-is/css-data";+import { parseCss, pseudoElements } from "@webstudio-is/css-data";// @todo this should be movedimport type { EmbedTemplateStyleDecl } from "@webstudio-is/react-sdk";import { kebabCase } from "change-case";@@ -39,6 +39,27 @@ const wfBreakpoints = new Map<WfBreakpointName, WfBreakpoint>([["tiny", { maxWidth: 479 }],]);+const parseVariantName = (variant: string) => {+ let [breakpointName, state = ""] = variant.split("_");+ if (state) {+ const separator = pseudoElements.includes(+ state as (typeof pseudoElements)[number]+ )+ ? "::"+ : ":";+ state = separator + state;+ }+ if (wfBreakpoints.has(breakpointName as WfBreakpointName) === false) {+ console.error(`Invalid breakpoint name: ${breakpointName}`);+ breakpointName = "base";+ }++ return {+ breakpointName: breakpointName as WfBreakpointName,+ state,+ };+};+const findWsBreakpoint = (wfBreakpoint: WfBreakpoint,breakpoints: Breakpoints@@ -56,10 +77,7 @@ const replaceAtVariables = (styles: string) => {return styles.replace(/@var_[\w-]+/g, "unset");};-type UnparsedVariants = Map<- WfBreakpointName,- string | Array<EmbedTemplateStyleDecl>->;+type UnparsedVariants = Map<string, string | Array<EmbedTemplateStyleDecl>>;// Variants value can be wf styleLess string which is a styles block// or it can be an array of EmbedTemplateStyleDecl.@@ -69,13 +87,16 @@ const toParsedVariants = (variants: UnparsedVariants) => {WfBreakpointName,Array<EmbedTemplateStyleDecl>>();-- for (const [breakpointName, styles] of variants) {+ for (const [variant, styles] of variants) {+ const { breakpointName, state } = parseVariantName(variant);if (typeof styles === "string") {try {const parsed =- parseCss(`.styles {${replaceAtVariables(styles)}}`).styles ?? [];- parsedVariants.set(breakpointName, parsed);+ parseCss(`.styles${state} {${replaceAtVariables(styles)}}`).styles ??+ [];+ const allBreakpointStyles = parsedVariants.get(breakpointName) ?? [];+ allBreakpointStyles.push(...parsed);+ parsedVariants.set(breakpointName, allBreakpointStyles);} catch (error) {console.error("Failed to parse style", error, breakpointName, styles);}diff --git a/packages/css-data/bin/mdn-data.ts b/packages/css-data/bin/mdn-data.tsindex c3eff9cc1f..79b7876c01 100755--- a/packages/css-data/bin/mdn-data.ts+++ b/packages/css-data/bin/mdn-data.ts@@ -5,6 +5,7 @@ import { join, dirname } from "node:path";import { parse, definitionSyntax, type DSNode, type CssNode } from "css-tree";import properties from "mdn-data/css/properties.json";import syntaxes from "mdn-data/css/syntaxes.json";+import selectors from "mdn-data/css/selectors.json";import data from "css-tree/dist/data";import { camelCase } from "change-case";import type {@@ -321,6 +322,12 @@ for (property in filteredProperties) {};}+const pseudoElements = Object.keys(selectors)+ .filter((selector) => {+ return selector.startsWith("::");+ })+ .map((selector) => selector.slice(2));+const targetDir = join(process.cwd(), process.argv.slice(2).pop() as string);mkdirSync(targetDir, { recursive: true });@@ -389,6 +396,8 @@ writeToFile(animatableProperties);+writeToFile("pseudo-elements.ts", "pseudoElements", pseudoElements);+let types = "";const propertyLiterals = Object.keys(propertiesData).map((property) =>diff --git a/packages/css-data/src/__generated__/pseudo-elements.ts b/packages/css-data/src/__generated__/pseudo-elements.tsnew file mode 100644index 0000000000..abaaaa3e01--- /dev/null+++ b/packages/css-data/src/__generated__/pseudo-elements.ts@@ -0,0 +1,46 @@+// This file was generated by pnpm mdn-data+export const pseudoElements = [+ "target-text",+ "-moz-progress-bar",+ "-moz-range-progress",+ "-moz-range-thumb",+ "-moz-range-track",+ "-ms-browse",+ "-ms-check",+ "-ms-clear",+ "-ms-expand",+ "-ms-fill",+ "-ms-fill-lower",+ "-ms-fill-upper",+ "-ms-reveal",+ "-ms-thumb",+ "-ms-ticks-after",+ "-ms-ticks-before",+ "-ms-tooltip",+ "-ms-track",+ "-ms-value",+ "-webkit-progress-bar",+ "-webkit-progress-inner-value",+ "-webkit-progress-value",+ "-webkit-slider-runnable-track",+ "-webkit-slider-thumb",+ "after",+ "backdrop",+ "before",+ "cue",+ "cue-region",+ "first-letter",+ "first-line",+ "grammar-error",+ "marker",+ "part",+ "placeholder",+ "selection",+ "slotted",+ "spelling-error",+ "view-transition",+ "view-transition-group",+ "view-transition-image-pair",+ "view-transition-new",+ "view-transition-old",+] as const;diff --git a/packages/css-data/src/index.ts b/packages/css-data/src/index.tsindex 10ab103116..c31ad1d9e7 100644--- a/packages/css-data/src/index.ts+++ b/packages/css-data/src/index.ts@@ -10,6 +10,7 @@ export {declarations as declarationDescriptions,} from "./__generated__/property-value-descriptions";export * from "./__generated__/animatable-properties";+export * from "./__generated__/pseudo-elements";// longhand property parsersexport * from "./property-parsers/index";diff --git a/packages/css-data/src/parse-css.test.ts b/packages/css-data/src/parse-css.test.tsindex 6020476700..3f73b6e9ec 100644--- a/packages/css-data/src/parse-css.test.ts+++ b/packages/css-data/src/parse-css.test.ts@@ -93,6 +93,27 @@ describe("Parse CSS", () => {`);});+ test("parse pseudo element", () => {+ expect(parseCss(`input::placeholder { color: #ff0000 }`))+ .toMatchInlineSnapshot(`+ {+ "input": [+ {+ "property": "color",+ "state": "::placeholder",+ "value": {+ "alpha": 1,+ "b": 0,+ "g": 0,+ "r": 255,+ "type": "rgb",+ },+ },+ ],+ }+ `);+ });+test("parse multiple selectors, one with state", () => {expect(parseCss(`a, a:hover { color: #ff0000 }`)).toMatchInlineSnapshot(`{diff --git a/packages/css-data/src/parse-css.ts b/packages/css-data/src/parse-css.tsindex 4a07b65c01..d2ea997817 100644--- a/packages/css-data/src/parse-css.ts+++ b/packages/css-data/src/parse-css.ts@@ -142,8 +142,9 @@ export const parseCss = (css: string) => {const statesArray = states.get(node.name) ?? [];states.set(node.name, statesArray);-- if (item?.next && item.next.data.type === "PseudoClassSelector") {+ if (item?.next && item.next.data.type === "PseudoElementSelector") {+ statesArray.push(`::${item.next.data.name}`);+ } else if (item?.next && item.next.data.type === "PseudoClassSelector") {statesArray.push(`:${item.next.data.name}`);} else {statesArray.push(undefined);diff --git a/packages/css-data/src/shorthands.test.ts b/packages/css-data/src/shorthands.test.tsindex a1228a0f49..a0e47987af 100644--- a/packages/css-data/src/shorthands.test.ts+++ b/packages/css-data/src/shorthands.test.ts@@ -172,7 +172,7 @@ test("expand outline", () => {expect(expandShorthands([["outline", "1px solid"]])).toEqual([["outline-width", "1px"],["outline-style", "solid"],- ["outline-color", "auto"],+ ["outline-color", "currentcolor"],]);});diff --git a/packages/css-data/src/shorthands.ts b/packages/css-data/src/shorthands.tsindex 5649d3c796..69f4527bc8 100644--- a/packages/css-data/src/shorthands.ts+++ b/packages/css-data/src/shorthands.ts@@ -936,7 +936,11 @@ const expandShorthand = function* (property: string, value: CssNode) {);yield [`${property}-width`, width ?? createIdentifier("medium")] as const;yield [`${property}-style`, style ?? createIdentifier("none")] as const;- yield [`${property}-color`, color ?? createIdentifier("auto")] as const;+ yield [+ `${property}-color`,+ // auto is not actually supported but is described in the spec draft+ color ?? createIdentifier("currentcolor"),+ ] as const;break;}