Skip to content

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.

fix: User defined class name is not being escaped (#4185)

Ivan Starkov0765d38047ee
diff --git a/fixtures/ssg-netlify-by-project-id/app/__generated__/_index.tsx b/fixtures/ssg-netlify-by-project-id/app/__generated__/_index.tsx
index 358ed16bc9..76e8270f73 100644
--- a/fixtures/ssg-netlify-by-project-id/app/__generated__/_index.tsx
+++ b/fixtures/ssg-netlify-by-project-id/app/__generated__/_index.tsx
@@ -24,8 +24,8 @@ export const CustomCode = () => {
const Page = ({}: { system: any }) => {
return (
- <Body className="w-body">
- <Heading className="w-heading">{"FIXTURE-CLIENT-DO-NOT-TOUCH"}</Heading>
+ <Body className={"w-body"}>
+ <Heading className={"w-heading"}>{"FIXTURE-CLIENT-DO-NOT-TOUCH"}</Heading>
</Body>
);
};
diff --git a/fixtures/ssg/app/__generated__/[another-page]._index.tsx b/fixtures/ssg/app/__generated__/[another-page]._index.tsx
index b7bb680030..c13624022c 100644
--- a/fixtures/ssg/app/__generated__/[another-page]._index.tsx
+++ b/fixtures/ssg/app/__generated__/[another-page]._index.tsx
@@ -20,8 +20,8 @@ export const pageBackgroundImageAssets: ImageAsset[] = [];
const Page = ({}: { system: any }) => {
return (
- <Body className="w-body">
- <Heading className="w-heading">{"Another page"}</Heading>
+ <Body className={"w-body"}>
+ <Heading className={"w-heading"}>{"Another page"}</Heading>
</Body>
);
};
diff --git a/fixtures/ssg/app/__generated__/_index.tsx b/fixtures/ssg/app/__generated__/_index.tsx
index 26bd19c14c..40d3ff00d6 100644
--- a/fixtures/ssg/app/__generated__/_index.tsx
+++ b/fixtures/ssg/app/__generated__/_index.tsx
@@ -27,23 +27,23 @@ export const CustomCode = () => {
const Page = ({}: { system: any }) => {
return (
- <Body className="w-body c1jaw2zx cbipm55 ctniqj4 ctgx88l">
- <Heading className="w-heading">{"Simple Project to test CLI"}</Heading>
- <Text className="w-text cn3rfux">
+ <Body className={"w-body c1jaw2zx cbipm55 ctniqj4 ctgx88l"}>
+ <Heading className={"w-heading"}>{"Simple Project to test CLI"}</Heading>
+ <Text className={"w-text cn3rfux"}>
{"Please don't change directly in the fixture"}
</Text>
- <Link href={"/another-page"} className="w-link">
+ <Link href={"/another-page"} className={"w-link"}>
{"Test another page link"}
</Link>
<Image
src={"/assets/iconly_svg_converted-converted_zMaMiAAutUl8XrITgz7d1.svg"}
width={14}
height={16}
- className="w-image c161qeci"
+ className={"w-image c161qeci"}
/>
<Image
src={"https://picsum.photos/id/237/100/100.jpg?blur=4&grayscale"}
- className="w-image"
+ className={"w-image"}
/>
</Body>
);
diff --git a/fixtures/webstudio-cloudflare-template/app/__generated__/[another-page]._index.tsx b/fixtures/webstudio-cloudflare-template/app/__generated__/[another-page]._index.tsx
index 6d5a498a6c..bd18852286 100644
--- a/fixtures/webstudio-cloudflare-template/app/__generated__/[another-page]._index.tsx
+++ b/fixtures/webstudio-cloudflare-template/app/__generated__/[another-page]._index.tsx
@@ -18,8 +18,8 @@ export const pageBackgroundImageAssets: ImageAsset[] = [];
const Page = ({}: { system: any }) => {
return (
- <Body className="w-body">
- <Heading className="w-heading">{"Another page"}</Heading>
+ <Body className={"w-body"}>
+ <Heading className={"w-heading"}>{"Another page"}</Heading>
</Body>
);
};
diff --git a/fixtures/webstudio-cloudflare-template/app/__generated__/_index.tsx b/fixtures/webstudio-cloudflare-template/app/__generated__/_index.tsx
index 58e6855e5e..6563f87af5 100644
--- a/fixtures/webstudio-cloudflare-template/app/__generated__/_index.tsx
+++ b/fixtures/webstudio-cloudflare-template/app/__generated__/_index.tsx
@@ -29,23 +29,23 @@ export const CustomCode = () => {
const Page = ({}: { system: any }) => {
return (
- <Body className="w-body c1jaw2zx cbipm55 ctniqj4 ctgx88l">
- <Heading className="w-heading">{"Simple Project to test CLI"}</Heading>
- <Text className="w-text cn3rfux">
+ <Body className={"w-body c1jaw2zx cbipm55 ctniqj4 ctgx88l"}>
+ <Heading className={"w-heading"}>{"Simple Project to test CLI"}</Heading>
+ <Text className={"w-text cn3rfux"}>
{"Please don't change directly in the fixture"}
</Text>
- <Link href={"/another-page"} className="w-link">
+ <Link href={"/another-page"} className={"w-link"}>
{"Test another page link"}
</Link>
<Image
src={"/assets/iconly_svg_converted-converted_zMaMiAAutUl8XrITgz7d1.svg"}
width={14}
height={16}
- className="w-image c161qeci"
+ className={"w-image c161qeci"}
/>
<Image
src={"https://picsum.photos/id/237/100/100.jpg?blur=4&grayscale"}
- className="w-image"
+ className={"w-image"}
/>
</Body>
);
diff --git a/fixtures/webstudio-custom-template/app/__generated__/[script-test]._index.tsx b/fixtures/webstudio-custom-template/app/__generated__/[script-test]._index.tsx
index a3f0332849..d4a416078a 100644
--- a/fixtures/webstudio-custom-template/app/__generated__/[script-test]._index.tsx
+++ b/fixtures/webstudio-custom-template/app/__generated__/[script-test]._index.tsx
@@ -34,23 +34,23 @@ export const pageBackgroundImageAssets: ImageAsset[] = [];
const Page = ({}: { system: any }) => {
return (
- <Body className="w-body cjrgi00">
- <Heading className="w-heading">{"Script Test"}</Heading>
- <Link href={"/"} className="w-link">
+ <Body className={"w-body cjrgi00"}>
+ <Heading className={"w-heading"}>{"Script Test"}</Heading>
+ <Link href={"/"} className={"w-link"}>
{"Go Home"}
</Link>
<HtmlEmbed
code={
"<br>\n<script>console.log('SCRIPT TEST SSR')</script>\n<script>console.log('SCRIPT TEST SSR 2')</script>\nSCRIPTS ARE HERE 2<br>"
}
- className="w-html-embed"
+ className={"w-html-embed"}
/>
<HtmlEmbed
code={
"<script>console.log('SCRIPTS TEST Client')</script>\n<script>console.log('SCRIPTS TEST 2 Client')</script>\nSCRIPTS ARE HERE <br>"
}
clientOnly={true}
- className="w-html-embed"
+ className={"w-html-embed"}
/>
</Body>
);
diff --git a/fixtures/webstudio-custom-template/app/__generated__/[sitemap.xml]._index.tsx b/fixtures/webstudio-custom-template/app/__generated__/[sitemap.xml]._index.tsx
index a8befd76df..e04972f988 100644
--- a/fixtures/webstudio-custom-template/app/__generated__/[sitemap.xml]._index.tsx
+++ b/fixtures/webstudio-custom-template/app/__generated__/[sitemap.xml]._index.tsx
@@ -30,7 +30,7 @@ const Body = (props: any) => props.children;
const Page = ({ system: system }: { system: any }) => {
let sitemapxml = useResource("sitemapxml_1");
return (
- <Body className="w-body">
+ <Body className={"w-body"}>
<XmlNode
tag={"urlset"}
xmlns={"http://www.sitemaps.org/schemas/sitemap/0.9"}
diff --git a/fixtures/webstudio-custom-template/app/__generated__/[world]._index.tsx b/fixtures/webstudio-custom-template/app/__generated__/[world]._index.tsx
index 6f3314924c..79de258e31 100644
--- a/fixtures/webstudio-custom-template/app/__generated__/[world]._index.tsx
+++ b/fixtures/webstudio-custom-template/app/__generated__/[world]._index.tsx
@@ -28,8 +28,8 @@ export const pageBackgroundImageAssets: ImageAsset[] = [];
const Page = ({}: { system: any }) => {
return (
- <Body className="w-body">
- <Heading className="w-heading">{"Привет Мир"}</Heading>
+ <Body className={"w-body"}>
+ <Heading className={"w-heading"}>{"Привет Мир"}</Heading>
</Body>
);
};
diff --git a/fixtures/webstudio-custom-template/app/__generated__/_index.tsx b/fixtures/webstudio-custom-template/app/__generated__/_index.tsx
index 862b5f704c..ff780c8f69 100644
--- a/fixtures/webstudio-custom-template/app/__generated__/_index.tsx
+++ b/fixtures/webstudio-custom-template/app/__generated__/_index.tsx
@@ -81,7 +81,6 @@ export const CustomCode = () => {
return (
<>
<Script>{"console.log('HELLO')"}</Script>
- {"\n"}
<meta property={"saas:test"} content={"test"}></meta>
</>
);
@@ -89,68 +88,80 @@ export const CustomCode = () => {
const Page = ({}: { system: any }) => {
return (
- <Body className="w-body cjrgi00">
- <Heading className="w-heading ce7mxws cd0g70b c1ku1ozg c1kbs9xq c1m6kmmg crjoqt7 c1n5sjmn c1hqh3e6 cwdggon c4o64du">
+ <Body className={"w-body cjrgi00"}>
+ <Heading
+ className={
+ "w-heading ce7mxws cd0g70b c1ku1ozg c1kbs9xq c1m6kmmg crjoqt7 c1n5sjmn c1hqh3e6 cwdggon c4o64du"
+ }
+ >
{"DO NOT TOUCH THIS PROJECT, IT'S USED FOR FIXTURES"}
</Heading>
- <Box className="w-box cxb89wn c12qr5j7 c111rqf8 cp8i2p0 cwfevk3">
+ <Box className={"w-box cxb89wn c12qr5j7 c111rqf8 cp8i2p0 cwfevk3"}>
<Image
src={
"/custom-folder/_937084ed-a798-49fe-8664-df93a2af605e_1JqSy_0Wy9fY5mXNZSLJ0.jpeg"
}
width={1024}
height={1024}
- className="w-image ccgiojm cv4f3rn cer5re4 c9lz7ss"
+ className={"w-image ccgiojm cv4f3rn cer5re4 c9lz7ss"}
/>
- <Box className="w-box ccgiojm cv4f3rn cer5re4 c9lz7ss" />
+ <Box className={"w-box ccgiojm cv4f3rn cer5re4 c9lz7ss"} />
</Box>
- <Heading className="w-heading">{"Below Image"}</Heading>
+ <Heading className={"w-heading"}>{"Below Image"}</Heading>
<HtmlEmbed
code={
"<script>console.log('PAGE MAIN Client')</script>\n<script>console.log('PAGE MAIN 2 Client')</script>\nSCRIPTS ARE HERE <br>"
}
clientOnly={true}
- className="w-html-embed"
+ className={"w-html-embed"}
/>
<HtmlEmbed
code={
"<script>console.log('PAGE MAIN SSR')</script>\n<script>console.log('PAGE MAIN 2 SSR')</script>\nSCRIPTS ARE HERE <br>"
}
- className="w-html-embed"
+ className={"w-html-embed"}
/>
- <Link href={"/script-test"} className="w-link">
+ <Link href={"/script-test"} className={"w-link"}>
{"Goto Scr"}
</Link>
<Vimeo
url={"https://player.vimeo.com/video/831343124"}
showPreview={true}
- className="w-vimeo c17osjft c5kxibo c8mrdqb"
+ className={"w-vimeo c17osjft c5kxibo c8mrdqb"}
>
<VimeoPreviewImage
alt={"Vimeo video preview image"}
sizes={"100vw"}
src={"/custom-folder/home_wsKvRSqvkajPPBeycZ-C8.svg"}
- className="w-preview-image c13adha2 c19kjzjn c8mrdqb chv0hit c1vw7ut7 c64vnj4 cow7xo6 cddunt6 cqjhyu2"
+ className={
+ "w-preview-image c13adha2 c19kjzjn c8mrdqb chv0hit c1vw7ut7 c64vnj4 cow7xo6 cddunt6 cqjhyu2"
+ }
/>
- <VimeoSpinner className="w-spinner c13adha2 c1ifzo79 c1ljqvnn c10zke2u cplzsl2 c1ardg8l ces5mo3">
+ <VimeoSpinner
+ className={
+ "w-spinner c13adha2 c1ifzo79 c1ljqvnn c10zke2u cplzsl2 c1ardg8l ces5mo3"
+ }
+ >
<HtmlEmbed
code={
'<svg xmlns="http://www.w3.org/2000/svg" id="e2CRglijn891" shape-rendering="geometricPrecision" text-rendering="geometricPrecision" viewBox="0 0 128 128" fill="currentColor" width="100%" height="100%" style="display: block;"><style>@keyframes e2CRglijn892_tr__tr{0%{transform:translate(64px,64px) rotate(90deg);animation-timing-function:cubic-bezier(.42,0,.58,1)}50%{transform:translate(64px,64px) rotate(810deg);animation-timing-function:cubic-bezier(.42,0,.58,1)}to{transform:translate(64px,64px) rotate(1530deg)}}@keyframes e2CRglijn892_s_p{0%,to{stroke:#39fbbb}25%{stroke:#4a4efa}50%{stroke:#e63cfe}75%{stroke:#ffae3c}}@keyframes e2CRglijn892_s_do{0%{stroke-dashoffset:251.89}2.5%,52.5%{stroke-dashoffset:263.88;animation-timing-function:cubic-bezier(.42,0,.58,1)}25%,75%{stroke-dashoffset:131.945}to{stroke-dashoffset:251.885909}}#e2CRglijn892_tr{animation:e2CRglijn892_tr__tr 3000ms linear infinite normal forwards}#e2CRglijn892{animation-name:e2CRglijn892_s_p,e2CRglijn892_s_do;animation-duration:3000ms;animation-fill-mode:forwards;animation-timing-function:linear;animation-direction:normal;animation-iteration-count:infinite}</style><g id="e2CRglijn892_tr" transform="translate(64,64) rotate(90)"><circle id="e2CRglijn892" r="42" fill="none" stroke="#39fbbb" stroke-dasharray="263.89" stroke-dashoffset="251.89" stroke-linecap="round" stroke-width="16" transform="scale(-1,1) translate(0,0)"/></g></svg>'
}
executeScriptOnCanvas={false}
- className="w-html-embed"
+ className={"w-html-embed"}
/>
</VimeoSpinner>
<VimeoPlayButton
aria-label={"Play button"}
- className="w-play-button c13adha2 c1t88ri8 ca7kf99 c1ifzo79 c1ljqvnn c1bld9op ctly9e6 cxb89wn cwcnvqs cvchf4 c1y7dyx c1bnrgjg c1joowif c120xed6 c2eug5n cvwgylz c1f0qcby c1syyj1x cil01r8 c11087u4 coba2o7 c82nx6d"
+ className={
+ "w-play-button c13adha2 c1t88ri8 ca7kf99 c1ifzo79 c1ljqvnn c1bld9op ctly9e6 cxb89wn cwcnvqs cvchf4 c1y7dyx c1bnrgjg c1joowif c120xed6 c2eug5n cvwgylz c1f0qcby c1syyj1x cil01r8 c11087u4 coba2o7 c82nx6d"
+ }
>
- <Box aria-hidden={"true"} className="w-box c1cccshn c1eyznz">
+ <Box aria-hidden={"true"} className={"w-box c1cccshn c1eyznz"}>
<HtmlEmbed
code={
'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 22 22" fill="currentColor" width="100%" height="100%" style="display: block;"><path d="M4.766 5.765c0-.725 0-1.088.178-1.288a.93.93 0 0 1 .648-.294c.294-.015.65.186 1.359.588l9.234 5.235c.586.332.88.498.982.708.09.183.09.389 0 .572-.102.21-.396.376-.982.708l-9.234 5.235c-.71.402-1.065.603-1.359.588a.93.93 0 0 1-.648-.294c-.178-.2-.178-.563-.178-1.288V5.765Z"/></svg>'
}
- className="w-html-embed"
+ className={"w-html-embed"}
/>
</Box>
</VimeoPlayButton>
diff --git a/fixtures/webstudio-remix-netlify-edge-functions/app/__generated__/[another-page]._index.tsx b/fixtures/webstudio-remix-netlify-edge-functions/app/__generated__/[another-page]._index.tsx
index 6d5a498a6c..bd18852286 100644
--- a/fixtures/webstudio-remix-netlify-edge-functions/app/__generated__/[another-page]._index.tsx
+++ b/fixtures/webstudio-remix-netlify-edge-functions/app/__generated__/[another-page]._index.tsx
@@ -18,8 +18,8 @@ export const pageBackgroundImageAssets: ImageAsset[] = [];
const Page = ({}: { system: any }) => {
return (
- <Body className="w-body">
- <Heading className="w-heading">{"Another page"}</Heading>
+ <Body className={"w-body"}>
+ <Heading className={"w-heading"}>{"Another page"}</Heading>
</Body>
);
};
diff --git a/fixtures/webstudio-remix-netlify-edge-functions/app/__generated__/_index.tsx b/fixtures/webstudio-remix-netlify-edge-functions/app/__generated__/_index.tsx
index 58e6855e5e..6563f87af5 100644
--- a/fixtures/webstudio-remix-netlify-edge-functions/app/__generated__/_index.tsx
+++ b/fixtures/webstudio-remix-netlify-edge-functions/app/__generated__/_index.tsx
@@ -29,23 +29,23 @@ export const CustomCode = () => {
const Page = ({}: { system: any }) => {
return (
- <Body className="w-body c1jaw2zx cbipm55 ctniqj4 ctgx88l">
- <Heading className="w-heading">{"Simple Project to test CLI"}</Heading>
- <Text className="w-text cn3rfux">
+ <Body className={"w-body c1jaw2zx cbipm55 ctniqj4 ctgx88l"}>
+ <Heading className={"w-heading"}>{"Simple Project to test CLI"}</Heading>
+ <Text className={"w-text cn3rfux"}>
{"Please don't change directly in the fixture"}
</Text>
- <Link href={"/another-page"} className="w-link">
+ <Link href={"/another-page"} className={"w-link"}>
{"Test another page link"}
</Link>
<Image
src={"/assets/iconly_svg_converted-converted_zMaMiAAutUl8XrITgz7d1.svg"}
width={14}
height={16}
- className="w-image c161qeci"
+ className={"w-image c161qeci"}
/>
<Image
src={"https://picsum.photos/id/237/100/100.jpg?blur=4&grayscale"}
- className="w-image"
+ className={"w-image"}
/>
</Body>
);
diff --git a/fixtures/webstudio-remix-netlify-functions/app/__generated__/[another-page]._index.tsx b/fixtures/webstudio-remix-netlify-functions/app/__generated__/[another-page]._index.tsx
index 6d5a498a6c..bd18852286 100644
--- a/fixtures/webstudio-remix-netlify-functions/app/__generated__/[another-page]._index.tsx
+++ b/fixtures/webstudio-remix-netlify-functions/app/__generated__/[another-page]._index.tsx
@@ -18,8 +18,8 @@ export const pageBackgroundImageAssets: ImageAsset[] = [];
const Page = ({}: { system: any }) => {
return (
- <Body className="w-body">
- <Heading className="w-heading">{"Another page"}</Heading>
+ <Body className={"w-body"}>
+ <Heading className={"w-heading"}>{"Another page"}</Heading>
</Body>
);
};
diff --git a/fixtures/webstudio-remix-netlify-functions/app/__generated__/_index.tsx b/fixtures/webstudio-remix-netlify-functions/app/__generated__/_index.tsx
index 58e6855e5e..6563f87af5 100644
--- a/fixtures/webstudio-remix-netlify-functions/app/__generated__/_index.tsx
+++ b/fixtures/webstudio-remix-netlify-functions/app/__generated__/_index.tsx
@@ -29,23 +29,23 @@ export const CustomCode = () => {
const Page = ({}: { system: any }) => {
return (
- <Body className="w-body c1jaw2zx cbipm55 ctniqj4 ctgx88l">
- <Heading className="w-heading">{"Simple Project to test CLI"}</Heading>
- <Text className="w-text cn3rfux">
+ <Body className={"w-body c1jaw2zx cbipm55 ctniqj4 ctgx88l"}>
+ <Heading className={"w-heading"}>{"Simple Project to test CLI"}</Heading>
+ <Text className={"w-text cn3rfux"}>
{"Please don't change directly in the fixture"}
</Text>
- <Link href={"/another-page"} className="w-link">
+ <Link href={"/another-page"} className={"w-link"}>
{"Test another page link"}
</Link>
<Image
src={"/assets/iconly_svg_converted-converted_zMaMiAAutUl8XrITgz7d1.svg"}
width={14}
height={16}
- className="w-image c161qeci"
+ className={"w-image c161qeci"}
/>
<Image
src={"https://picsum.photos/id/237/100/100.jpg?blur=4&grayscale"}
- className="w-image"
+ className={"w-image"}
/>
</Body>
);
diff --git a/fixtures/webstudio-remix-vercel/.webstudio/data.json b/fixtures/webstudio-remix-vercel/.webstudio/data.json
index f287c2d2ec..ef47814702 100644
--- a/fixtures/webstudio-remix-vercel/.webstudio/data.json
+++ b/fixtures/webstudio-remix-vercel/.webstudio/data.json
@@ -1,10 +1,10 @@
{
"build": {
- "id": "5df1744d-0383-4775-819c-1648300d55cd",
+ "id": "40962d82-ea2d-4536-b94f-dece81312190",
"projectId": "cddc1d44-af37-4cb6-a430-d300cf6f932d",
- "version": 300,
- "createdAt": "2024-09-19T19:27:53.953+00:00",
- "updatedAt": "2024-09-19T19:27:53.953+00:00",
+ "version": 315,
+ "createdAt": "2024-09-30T13:22:48.689+00:00",
+ "updatedAt": "2024-09-30T13:22:48.689+00:00",
"pages": {
"meta": {
"siteName": "KittyGuardedZone",
@@ -134,6 +134,27 @@
"include": false
},
"path": "/expressions"
+ },
+ {
+ "id": "lTS5DKrDEC_mXSAc5ZDDA",
+ "name": "class-names",
+ "title": "\"Untitled\"",
+ "rootInstanceId": "mdyCS8QnKx3fL1MLXifmy",
+ "systemDataSourceId": "5o_tom3ekCqphQfInC6NH",
+ "meta": {
+ "description": "\"\"",
+ "excludePageFromSearch": "true",
+ "language": "\"\"",
+ "socialImageUrl": "\"\"",
+ "status": "200",
+ "redirect": "\"\"",
+ "documentType": "html",
+ "custom": []
+ },
+ "marketplace": {
+ "include": false
+ },
+ "path": "/class-names"
}
],
"folders": [
@@ -149,7 +170,8 @@
"-J9I4Oo6mONfQlf_3-OqG",
"TS39WeBd0Qr3QgbSlzdf2",
"42cWhASQ3tTtKDnsvzhUF",
- "9xlwLSHxuk8HmS3-EEGcf"
+ "9xlwLSHxuk8HmS3-EEGcf",
+ "lTS5DKrDEC_mXSAc5ZDDA"
]
},
{
@@ -1505,6 +1527,19 @@
"value": "hidden"
}
}
+ ],
+ [
+ "o9VRyqmvIarF6HrGMccU8:UoTkWyaFuTYJihS3MFYK5:width:",
+ {
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
+ "styleSourceId": "o9VRyqmvIarF6HrGMccU8",
+ "property": "width",
+ "value": {
+ "type": "unit",
+ "unit": "px",
+ "value": 300
+ }
+ }
]
],
"styleSources": [
@@ -1675,6 +1710,13 @@
"type": "local",
"id": "y8DFYnVCeQ_smp3u6CSTn"
}
+ ],
+ [
+ "o9VRyqmvIarF6HrGMccU8",
+ {
+ "type": "local",
+ "id": "o9VRyqmvIarF6HrGMccU8"
+ }
]
],
"styleSourceSelections": [
@@ -1845,6 +1887,13 @@
"instanceId": "81ejLVXyFEV1SxiJrWhyw",
"values": ["y8DFYnVCeQ_smp3u6CSTn"]
}
+ ],
+ [
+ "drCx7m8q_gnNQLrhPDA-g",
+ {
+ "instanceId": "drCx7m8q_gnNQLrhPDA-g",
+ "values": ["o9VRyqmvIarF6HrGMccU8"]
+ }
]
],
"props": [
@@ -2228,6 +2277,26 @@
"type": "expression",
"value": "`<script>\nconst a = ${$ws$dataSource$LYqm_7uq8W4T7BKky9zcj.data.args}\n\nconst b = ${$ws$dataSource$KqMdUAQ4YmObkN1ofVzeO}\n\nconsole.log(a, b);\n</script>`"
}
+ ],
+ [
+ "8GVa_kUsGQz9Ppne_hLj-",
+ {
+ "id": "8GVa_kUsGQz9Ppne_hLj-",
+ "instanceId": "drCx7m8q_gnNQLrhPDA-g",
+ "name": "className",
+ "type": "string",
+ "value": "custom-class \"broken 'with `symbols"
+ }
+ ],
+ [
+ "UVdfQwl7RfYB2wI__NFXr",
+ {
+ "id": "UVdfQwl7RfYB2wI__NFXr",
+ "instanceId": "drCx7m8q_gnNQLrhPDA-g",
+ "name": "id",
+ "type": "string",
+ "value": "\"broken'with`symbols"
+ }
]
],
"dataSources": [
@@ -2385,6 +2454,15 @@
}
}
}
+ ],
+ [
+ "5o_tom3ekCqphQfInC6NH",
+ {
+ "type": "parameter",
+ "id": "5o_tom3ekCqphQfInC6NH",
+ "scopeInstanceId": "mdyCS8QnKx3fL1MLXifmy",
+ "name": "system"
+ }
]
],
"resources": [
@@ -3492,12 +3570,36 @@
"component": "HtmlEmbed",
"children": []
}
+ ],
+ [
+ "mdyCS8QnKx3fL1MLXifmy",
+ {
+ "type": "instance",
+ "id": "mdyCS8QnKx3fL1MLXifmy",
+ "component": "Body",
+ "children": [
+ {
+ "type": "id",
+ "value": "drCx7m8q_gnNQLrhPDA-g"
+ }
+ ]
+ }
+ ],
+ [
+ "drCx7m8q_gnNQLrhPDA-g",
+ {
+ "type": "instance",
+ "id": "drCx7m8q_gnNQLrhPDA-g",
+ "component": "Box",
+ "children": []
+ }
]
],
"deployment": {
"destination": "saas",
- "domains": [],
- "projectDomain": "webstudio-fixture-project-a-0su3o"
+ "domains": ["webstudio-fixture-project-a-0su3o"],
+ "assetsDomain": "webstudio-fixture-project-a-0su3o",
+ "excludeWstdDomainFromSearch": false
}
},
"page": {
@@ -3641,6 +3743,27 @@
"include": false
},
"path": "/expressions"
+ },
+ {
+ "id": "lTS5DKrDEC_mXSAc5ZDDA",
+ "name": "class-names",
+ "title": "\"Untitled\"",
+ "rootInstanceId": "mdyCS8QnKx3fL1MLXifmy",
+ "systemDataSourceId": "5o_tom3ekCqphQfInC6NH",
+ "meta": {
+ "description": "\"\"",
+ "excludePageFromSearch": "true",
+ "language": "\"\"",
+ "socialImageUrl": "\"\"",
+ "status": "200",
+ "redirect": "\"\"",
+ "documentType": "html",
+ "custom": []
+ },
+ "marketplace": {
+ "include": false
+ },
+ "path": "/class-names"
}
],
"assets": [
diff --git a/fixtures/webstudio-remix-vercel/app/__generated__/$resources.sitemap.xml.ts b/fixtures/webstudio-remix-vercel/app/__generated__/$resources.sitemap.xml.ts
index b67b1cd10c..0422d75129 100644
--- a/fixtures/webstudio-remix-vercel/app/__generated__/$resources.sitemap.xml.ts
+++ b/fixtures/webstudio-remix-vercel/app/__generated__/$resources.sitemap.xml.ts
@@ -1,26 +1,26 @@
export const sitemap = [
{
path: "/",
- lastModified: "2024-09-19",
+ lastModified: "2024-09-30",
},
{
path: "/_route_with_symbols_",
- lastModified: "2024-09-19",
+ lastModified: "2024-09-30",
},
{
path: "/form",
- lastModified: "2024-09-19",
+ lastModified: "2024-09-30",
},
{
path: "/heading-with-id",
- lastModified: "2024-09-19",
+ lastModified: "2024-09-30",
},
{
path: "/resources",
- lastModified: "2024-09-19",
+ lastModified: "2024-09-30",
},
{
path: "/nested/nested-page",
- lastModified: "2024-09-19",
+ lastModified: "2024-09-30",
},
];
diff --git a/fixtures/webstudio-remix-vercel/app/__generated__/[_route_with_symbols_]._index.tsx b/fixtures/webstudio-remix-vercel/app/__generated__/[_route_with_symbols_]._index.tsx
index 3234e4ad59..fdb11ca6b4 100644
--- a/fixtures/webstudio-remix-vercel/app/__generated__/[_route_with_symbols_]._index.tsx
+++ b/fixtures/webstudio-remix-vercel/app/__generated__/[_route_with_symbols_]._index.tsx
@@ -28,10 +28,10 @@ export const pageBackgroundImageAssets: ImageAsset[] = [];
const Page = ({}: { system: any }) => {
return (
- <Body className="w-body">
+ <Body className={"w-body"}>
<Image
src={"/assets/small-avif-kitty_FnabJsioMWpBtXZSGf4DR.webp"}
- className="w-image c1czoo99"
+ className={"w-image c1czoo99"}
/>
</Body>
);
diff --git a/fixtures/webstudio-remix-vercel/app/__generated__/[class-names]._index.server.tsx b/fixtures/webstudio-remix-vercel/app/__generated__/[class-names]._index.server.tsx
new file mode 100644
index 0000000000..6c968b385b
--- /dev/null
+++ b/fixtures/webstudio-remix-vercel/app/__generated__/[class-names]._index.server.tsx
@@ -0,0 +1,39 @@
+/* eslint-disable */
+/* This is a auto generated file for building the project */
+
+import type { PageMeta } from "@webstudio-is/sdk";
+import type { System, ResourceRequest } from "@webstudio-is/sdk";
+export const getResources = (_props: { system: System }) => {
+ const _data = new Map<string, ResourceRequest>([]);
+ const _action = new Map<string, ResourceRequest>([]);
+ return { data: _data, action: _action };
+};
+
+export const getPageMeta = ({
+ system,
+ resources,
+}: {
+ system: System;
+ resources: Record<string, any>;
+}): PageMeta => {
+ return {
+ title: "Untitled",
+ description: "",
+ excludePageFromSearch: true,
+ language: "",
+ socialImageAssetName: undefined,
+ socialImageUrl: "",
+ status: 200,
+ redirect: "",
+ custom: [],
+ };
+};
+
+type Params = Record<string, string | undefined>;
+export const getRemixParams = ({ ...params }: Params): Params => {
+ return params;
+};
+
+export const projectId = "cddc1d44-af37-4cb6-a430-d300cf6f932d";
+
+export const contactEmail = "[email protected]";
diff --git a/fixtures/webstudio-remix-vercel/app/__generated__/[class-names]._index.tsx b/fixtures/webstudio-remix-vercel/app/__generated__/[class-names]._index.tsx
new file mode 100644
index 0000000000..0c101c31ef
--- /dev/null
+++ b/fixtures/webstudio-remix-vercel/app/__generated__/[class-names]._index.tsx
@@ -0,0 +1,40 @@
+/* eslint-disable */
+/* This is a auto generated file for building the project */
+
+import { Fragment, useState } from "react";
+import type { FontAsset, ImageAsset } from "@webstudio-is/sdk";
+import { useResource, useVariableState } from "@webstudio-is/react-sdk/runtime";
+import { Body as Body } from "@webstudio-is/sdk-components-react-remix";
+import { Box as Box } from "@webstudio-is/sdk-components-react";
+
+export const siteName = "KittyGuardedZone";
+
+export const favIconAsset: ImageAsset | undefined = {
+ id: "88d5e2ff-b8f2-4899-aaf8-dde4ade6da10",
+ name: "DALL_E_2023-10-30_12.39.46_-_Photo_logo_with_a_bold_cat_silhouette_centered_on_a_contrasting_background_designed_for_clarity_at_small_32x32_favicon_resolution_00h6cEA8u2pJRvVJv7hRe.png",
+ description: null,
+ projectId: "cddc1d44-af37-4cb6-a430-d300cf6f932d",
+ size: 268326,
+ type: "image",
+ format: "png",
+ createdAt: "2023-10-30T13:51:08.416+00:00",
+ meta: { width: 790, height: 786 },
+};
+
+// Font assets on current page (can be preloaded)
+export const pageFontAssets: FontAsset[] = [];
+
+export const pageBackgroundImageAssets: ImageAsset[] = [];
+
+const Page = ({}: { system: any }) => {
+ return (
+ <Body className={"w-body"}>
+ <Box
+ id={"\"broken'with`symbols"}
+ className={"w-box cm16yxw custom-class \"broken 'with `symbols"}
+ />
+ </Body>
+ );
+};
+
+export { Page };
diff --git a/fixtures/webstudio-remix-vercel/app/__generated__/[expressions]._index.tsx b/fixtures/webstudio-remix-vercel/app/__generated__/[expressions]._index.tsx
index 24c431a0f1..d4f9228ed9 100644
--- a/fixtures/webstudio-remix-vercel/app/__generated__/[expressions]._index.tsx
+++ b/fixtures/webstudio-remix-vercel/app/__generated__/[expressions]._index.tsx
@@ -33,8 +33,8 @@ const Page = ({}: { system: any }) => {
let jsonResourceVariable = useResource("jsonResourceVariable_1");
let [jsonVar, set$jsonVar] = useVariableState<any>({ hello: "world" });
return (
- <Body className="w-body">
- <Heading className="w-heading">
+ <Body className={"w-body"}>
+ <Heading className={"w-heading"}>
{`${jsonResourceVariable?.data?.args}`}
</Heading>
<HtmlEmbed
@@ -45,7 +45,7 @@ const b = ${jsonVar}
console.log(a, b);
</script>`}
- className="w-html-embed"
+ className={"w-html-embed"}
/>
</Body>
);
diff --git a/fixtures/webstudio-remix-vercel/app/__generated__/[form]._index.tsx b/fixtures/webstudio-remix-vercel/app/__generated__/[form]._index.tsx
index bdb5313926..1a21e85aad 100644
--- a/fixtures/webstudio-remix-vercel/app/__generated__/[form]._index.tsx
+++ b/fixtures/webstudio-remix-vercel/app/__generated__/[form]._index.tsx
@@ -39,32 +39,32 @@ const Page = ({}: { system: any }) => {
let [formState, set$formState] = useVariableState<any>("initial");
let [formState_1, set$formState_1] = useVariableState<any>("initial");
return (
- <Body className="w-body">
+ <Body className={"w-body"}>
<Form
state={formState}
onStateChange={(state: any) => {
formState = state;
set$formState(formState);
}}
- className="w-webhook-form"
+ className={"w-webhook-form"}
>
{(formState === "initial" || formState === "error") && (
- <Box className="w-box">
- <Heading tag={"h3"} className="w-heading">
+ <Box className={"w-box"}>
+ <Heading tag={"h3"} className={"w-heading"}>
{"Default form"}
</Heading>
- <Label className="w-input-label">{"Name"}</Label>
- <Input name={"name"} className="w-text-input" />
- <Label className="w-input-label">{"Email"}</Label>
- <Input name={"email"} className="w-text-input" />
- <Button className="w-button">{"Submit"}</Button>
+ <Label className={"w-input-label"}>{"Name"}</Label>
+ <Input name={"name"} className={"w-text-input"} />
+ <Label className={"w-input-label"}>{"Email"}</Label>
+ <Input name={"email"} className={"w-text-input"} />
+ <Button className={"w-button"}>{"Submit"}</Button>
</Box>
)}
{formState === "success" && (
- <Box className="w-box">{"Thank you for getting in touch!"}</Box>
+ <Box className={"w-box"}>{"Thank you for getting in touch!"}</Box>
)}
{formState === "error" && (
- <Box className="w-box">{"Sorry, something went wrong."}</Box>
+ <Box className={"w-box"}>{"Sorry, something went wrong."}</Box>
)}
</Form>
<Form
@@ -74,25 +74,25 @@ const Page = ({}: { system: any }) => {
set$formState_1(formState_1);
}}
action={"action"}
- className="w-webhook-form"
+ className={"w-webhook-form"}
>
{(formState_1 === "initial" || formState_1 === "error") && (
- <Box className="w-box">
- <Heading tag={"h3"} className="w-heading">
+ <Box className={"w-box"}>
+ <Heading tag={"h3"} className={"w-heading"}>
{"Form with custom action and method"}
</Heading>
- <Label className="w-input-label">{"Name"}</Label>
- <Input name={"name"} className="w-text-input" />
- <Label className="w-input-label">{"Email"}</Label>
- <Input name={"email"} className="w-text-input" />
- <Button className="w-button">{"Submit"}</Button>
+ <Label className={"w-input-label"}>{"Name"}</Label>
+ <Input name={"name"} className={"w-text-input"} />
+ <Label className={"w-input-label"}>{"Email"}</Label>
+ <Input name={"email"} className={"w-text-input"} />
+ <Button className={"w-button"}>{"Submit"}</Button>
</Box>
)}
{formState_1 === "success" && (
- <Box className="w-box">{"Thank you for getting in touch!"}</Box>
+ <Box className={"w-box"}>{"Thank you for getting in touch!"}</Box>
)}
{formState_1 === "error" && (
- <Box className="w-box">{"Sorry, something went wrong."}</Box>
+ <Box className={"w-box"}>{"Sorry, something went wrong."}</Box>
)}
</Form>
</Body>
diff --git a/fixtures/webstudio-remix-vercel/app/__generated__/[heading-with-id]._index.tsx b/fixtures/webstudio-remix-vercel/app/__generated__/[heading-with-id]._index.tsx
index c7239c7f85..bb7f44cbbb 100644
--- a/fixtures/webstudio-remix-vercel/app/__generated__/[heading-with-id]._index.tsx
+++ b/fixtures/webstudio-remix-vercel/app/__generated__/[heading-with-id]._index.tsx
@@ -28,8 +28,8 @@ export const pageBackgroundImageAssets: ImageAsset[] = [];
const Page = ({}: { system: any }) => {
return (
- <Body className="w-body">
- <Heading id={"my-heading"} className="w-heading">
+ <Body className={"w-body"}>
+ <Heading id={"my-heading"} className={"w-heading"}>
{"Heading you can edit"}
</Heading>
</Body>
diff --git a/fixtures/webstudio-remix-vercel/app/__generated__/[nested].[nested-page]._index.tsx b/fixtures/webstudio-remix-vercel/app/__generated__/[nested].[nested-page]._index.tsx
index 36902bb991..a8a0efe4fe 100644
--- a/fixtures/webstudio-remix-vercel/app/__generated__/[nested].[nested-page]._index.tsx
+++ b/fixtures/webstudio-remix-vercel/app/__generated__/[nested].[nested-page]._index.tsx
@@ -28,8 +28,8 @@ export const pageBackgroundImageAssets: ImageAsset[] = [];
const Page = ({}: { system: any }) => {
return (
- <Body className="w-body">
- <Heading className="w-heading">{"Nested page"}</Heading>
+ <Body className={"w-body"}>
+ <Heading className={"w-heading"}>{"Nested page"}</Heading>
</Body>
);
};
diff --git a/fixtures/webstudio-remix-vercel/app/__generated__/[radix]._index.tsx b/fixtures/webstudio-remix-vercel/app/__generated__/[radix]._index.tsx
index 0b5afb1ce4..4ebb3da276 100644
--- a/fixtures/webstudio-remix-vercel/app/__generated__/[radix]._index.tsx
+++ b/fixtures/webstudio-remix-vercel/app/__generated__/[radix]._index.tsx
@@ -40,7 +40,7 @@ export const pageBackgroundImageAssets: ImageAsset[] = [];
const Page = ({}: { system: any }) => {
let [accordionValue, set$accordionValue] = useVariableState<any>("0");
return (
- <Body className="w-body">
+ <Body className={"w-body"}>
<Accordion
collapsible={true}
value={accordionValue}
@@ -48,61 +48,97 @@ const Page = ({}: { system: any }) => {
accordionValue = value;
set$accordionValue(accordionValue);
}}
- className="w-accordion"
+ className={"w-accordion"}
>
- <AccordionItem data-ws-index="0" className="w-item c2onvcp">
- <AccordionHeader className="w-item-header c13v7j50">
- <AccordionTrigger className="w-item-trigger c13v7j50 c1qxdkbn chhejm9 c13bviim cpjvam0 c1tw5o2 cqw88jp c44srea c14kxsax cg783j6 c1ad236a c1s4llbc">
- <Text className="w-text">{"Is it accessible?"}</Text>
- <Box className="w-box c14hansb c6d2sb5 cwwiftc c16vb2zi c1hl6g8z c1xm49r0 c1vri55v">
+ <AccordionItem data-ws-index="0" className={"w-item c2onvcp"}>
+ <AccordionHeader className={"w-item-header c13v7j50"}>
+ <AccordionTrigger
+ className={
+ "w-item-trigger c13v7j50 c1qxdkbn chhejm9 c13bviim cpjvam0 c1tw5o2 cqw88jp c44srea c14kxsax cg783j6 c1ad236a c1s4llbc"
+ }
+ >
+ <Text className={"w-text"}>{"Is it accessible?"}</Text>
+ <Box
+ className={
+ "w-box c14hansb c6d2sb5 cwwiftc c16vb2zi c1hl6g8z c1xm49r0 c1vri55v"
+ }
+ >
<HtmlEmbed
code={
'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor" width="100%" height="100%" style="display: block;"><path d="M4.04 6.284a.65.65 0 0 1 .92.001L8 9.335l3.04-3.05a.65.65 0 1 1 .921.918l-3.5 3.512a.65.65 0 0 1-.921 0L4.039 7.203a.65.65 0 0 1 .001-.92Z"/></svg>'
}
- className="w-html-embed"
+ className={"w-html-embed"}
/>
</Box>
</AccordionTrigger>
</AccordionHeader>
- <AccordionContent className="w-item-content c1j0j9ep c1gl2i2 c44srea c1xcxvc0 c12ct49k">
+ <AccordionContent
+ className={
+ "w-item-content c1j0j9ep c1gl2i2 c44srea c1xcxvc0 c12ct49k"
+ }
+ >
{"Yes. It adheres to the WAI-ARIA design pattern."}
</AccordionContent>
</AccordionItem>
- <AccordionItem data-ws-index="1" className="w-item c2onvcp">
- <AccordionHeader className="w-item-header c13v7j50">
- <AccordionTrigger className="w-item-trigger c13v7j50 c1qxdkbn chhejm9 c13bviim cpjvam0 c1tw5o2 cqw88jp c44srea c14kxsax cg783j6 c1ad236a c1s4llbc">
- <Text className="w-text">{"Is it styled?"}</Text>
- <Box className="w-box c14hansb c6d2sb5 cwwiftc c16vb2zi c1hl6g8z c1xm49r0 c1vri55v">
+ <AccordionItem data-ws-index="1" className={"w-item c2onvcp"}>
+ <AccordionHeader className={"w-item-header c13v7j50"}>
+ <AccordionTrigger
+ className={
+ "w-item-trigger c13v7j50 c1qxdkbn chhejm9 c13bviim cpjvam0 c1tw5o2 cqw88jp c44srea c14kxsax cg783j6 c1ad236a c1s4llbc"
+ }
+ >
+ <Text className={"w-text"}>{"Is it styled?"}</Text>
+ <Box
+ className={
+ "w-box c14hansb c6d2sb5 cwwiftc c16vb2zi c1hl6g8z c1xm49r0 c1vri55v"
+ }
+ >
<HtmlEmbed
code={
'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor" width="100%" height="100%" style="display: block;"><path d="M4.04 6.284a.65.65 0 0 1 .92.001L8 9.335l3.04-3.05a.65.65 0 1 1 .921.918l-3.5 3.512a.65.65 0 0 1-.921 0L4.039 7.203a.65.65 0 0 1 .001-.92Z"/></svg>'
}
- className="w-html-embed"
+ className={"w-html-embed"}
/>
</Box>
</AccordionTrigger>
</AccordionHeader>
- <AccordionContent className="w-item-content c1j0j9ep c1gl2i2 c44srea c1xcxvc0 c12ct49k">
+ <AccordionContent
+ className={
+ "w-item-content c1j0j9ep c1gl2i2 c44srea c1xcxvc0 c12ct49k"
+ }
+ >
{
"Yes. It comes with default styles that matches the other components' aesthetic."
}
</AccordionContent>
</AccordionItem>
- <AccordionItem data-ws-index="2" className="w-item c2onvcp">
- <AccordionHeader className="w-item-header c13v7j50">
- <AccordionTrigger className="w-item-trigger c13v7j50 c1qxdkbn chhejm9 c13bviim cpjvam0 c1tw5o2 cqw88jp c44srea c14kxsax cg783j6 c1ad236a c1s4llbc">
- <Text className="w-text">{"Is it animated?"}</Text>
- <Box className="w-box c14hansb c6d2sb5 cwwiftc c16vb2zi c1hl6g8z c1xm49r0 c1vri55v">
+ <AccordionItem data-ws-index="2" className={"w-item c2onvcp"}>
+ <AccordionHeader className={"w-item-header c13v7j50"}>
+ <AccordionTrigger
+ className={
+ "w-item-trigger c13v7j50 c1qxdkbn chhejm9 c13bviim cpjvam0 c1tw5o2 cqw88jp c44srea c14kxsax cg783j6 c1ad236a c1s4llbc"
+ }
+ >
+ <Text className={"w-text"}>{"Is it animated?"}</Text>
+ <Box
+ className={
+ "w-box c14hansb c6d2sb5 cwwiftc c16vb2zi c1hl6g8z c1xm49r0 c1vri55v"
+ }
+ >
<HtmlEmbed
code={
'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor" width="100%" height="100%" style="display: block;"><path d="M4.04 6.284a.65.65 0 0 1 .92.001L8 9.335l3.04-3.05a.65.65 0 1 1 .921.918l-3.5 3.512a.65.65 0 0 1-.921 0L4.039 7.203a.65.65 0 0 1 .001-.92Z"/></svg>'
}
- className="w-html-embed"
+ className={"w-html-embed"}
/>
</Box>
</AccordionTrigger>
</AccordionHeader>
- <AccordionContent className="w-item-content c1j0j9ep c1gl2i2 c44srea c1xcxvc0 c12ct49k">
+ <AccordionContent
+ className={
+ "w-item-content c1j0j9ep c1gl2i2 c44srea c1xcxvc0 c12ct49k"
+ }
+ >
{
"Yes. It's animated by default, but you can disable it if you prefer."
}
diff --git a/fixtures/webstudio-remix-vercel/app/__generated__/[resources]._index.tsx b/fixtures/webstudio-remix-vercel/app/__generated__/[resources]._index.tsx
index e8ed028308..837da2c239 100644
--- a/fixtures/webstudio-remix-vercel/app/__generated__/[resources]._index.tsx
+++ b/fixtures/webstudio-remix-vercel/app/__generated__/[resources]._index.tsx
@@ -32,11 +32,11 @@ export const pageBackgroundImageAssets: ImageAsset[] = [];
const Page = ({}: { system: any }) => {
let list = useResource("list_1");
return (
- <Body className="w-body">
+ <Body className={"w-body"}>
{list?.data?.map((collectionItem: any, index: number) => (
<Fragment key={index}>
- <Box className="w-box">
- <HtmlEmbed code={collectionItem?.name} className="w-html-embed" />
+ <Box className={"w-box"}>
+ <HtmlEmbed code={collectionItem?.name} className={"w-html-embed"} />
</Box>
</Fragment>
))}
diff --git a/fixtures/webstudio-remix-vercel/app/__generated__/_index.tsx b/fixtures/webstudio-remix-vercel/app/__generated__/_index.tsx
index af3fb0025f..4e127d7bf0 100644
--- a/fixtures/webstudio-remix-vercel/app/__generated__/_index.tsx
+++ b/fixtures/webstudio-remix-vercel/app/__generated__/_index.tsx
@@ -54,51 +54,53 @@ export const CustomCode = () => {
return (
<>
<Script>{"console.log('KittyGuardedZone')"}</Script>
- {"\n"}
</>
);
};
const Page = ({}: { system: any }) => {
return (
- <Body className="w-body cielobv">
- <Heading className="w-heading ceva767">
+ <Body className={"w-body cielobv"}>
+ <Heading className={"w-heading ceva767"}>
{"DO NOT TOUCH THIS PROJECT, IT'S USED FOR FIXTURES"}
</Heading>
- <Box className="w-box c13v7j50 cqkqnmd cv6wa71">
- <Box className="w-box c1t3ybra c1qxdkbn c1ogzcge cv3kvac">
- <Heading className="w-heading">{"Heading"}</Heading>
- <Paragraph className="w-paragraph">
+ <Box className={"w-box c13v7j50 cqkqnmd cv6wa71"}>
+ <Box className={"w-box c1t3ybra c1qxdkbn c1ogzcge cv3kvac"}>
+ <Heading className={"w-heading"}>{"Heading"}</Heading>
+ <Paragraph className={"w-paragraph"}>
{
"a little kitten painted in black and white gouache with a thick brush"
}
</Paragraph>
- <Link href={"https://github.com/"} className="w-link">
+ <Link href={"https://github.com/"} className={"w-link"}>
{"Click here to adore more kittens"}
</Link>
- <Text tag={"span"} className="w-text">
+ <Text tag={"span"} className={"w-text"}>
{" or "}
</Text>
<Link
href={"/assets/small-avif-kitty_FnabJsioMWpBtXZSGf4DR.webp"}
- className="w-link"
+ className={"w-link"}
>
{"go download this little kitten"}
</Link>
- <Box className="w-box" />
- <Link href={"/_route_with_symbols_"} className="w-link ch2exr5">
+ <Box className={"w-box"} />
+ <Link href={"/_route_with_symbols_"} className={"w-link ch2exr5"}>
{"Symbols in path"}
</Link>
- <Link href={"/heading-with-id#my-heading"} className="w-link ch2exr5">
+ <Link
+ href={"/heading-with-id#my-heading"}
+ className={"w-link ch2exr5"}
+ >
{"Link to instance"}
</Link>
</Box>
- <Box className="w-box c1t3ybra c1qxdkbn c1ogzcge cv3kvac">
+ <Box className={"w-box c1t3ybra c1qxdkbn c1ogzcge cv3kvac"}>
<Image
src={
"/assets/_937084ed-a798-49fe-8664-df93a2af605e_uiBk3o6UWdqolyakMvQJ9.jpeg"
}
- className="w-image c1czoo99"
+ className={"w-image c1czoo99"}
/>
</Box>
</Box>
diff --git a/fixtures/webstudio-remix-vercel/app/__generated__/index.css b/fixtures/webstudio-remix-vercel/app/__generated__/index.css
index 66c976ef55..eef654c3a0 100644
--- a/fixtures/webstudio-remix-vercel/app/__generated__/index.css
+++ b/fixtures/webstudio-remix-vercel/app/__generated__/index.css
@@ -383,4 +383,7 @@ html {
.ch2exr5 {
display: block;
}
+ .cm16yxw {
+ width: 300px;
+ }
}
diff --git a/fixtures/webstudio-remix-vercel/app/routes/[class-names]._index.tsx b/fixtures/webstudio-remix-vercel/app/routes/[class-names]._index.tsx
new file mode 100644
index 0000000000..9b7e92450e
--- /dev/null
+++ b/fixtures/webstudio-remix-vercel/app/routes/[class-names]._index.tsx
@@ -0,0 +1,342 @@
+import {
+ type ServerRuntimeMetaFunction as MetaFunction,
+ type LinksFunction,
+ type LinkDescriptor,
+ type ActionFunctionArgs,
+ type LoaderFunctionArgs,
+ type HeadersFunction,
+ json,
+ redirect,
+} from "@remix-run/server-runtime";
+import { useLoaderData } from "@remix-run/react";
+import {
+ isLocalResource,
+ loadResource,
+ loadResources,
+ formIdFieldName,
+ formBotFieldName,
+} from "@webstudio-is/sdk";
+import { ReactSdkContext } from "@webstudio-is/react-sdk/runtime";
+import {
+ Page,
+ siteName,
+ favIconAsset,
+ pageFontAssets,
+ pageBackgroundImageAssets,
+} from "../__generated__/[class-names]._index";
+import {
+ getResources,
+ getPageMeta,
+ getRemixParams,
+ projectId,
+ contactEmail,
+} from "../__generated__/[class-names]._index.server";
+import { assetBaseUrl, imageBaseUrl, imageLoader } from "../constants.mjs";
+import css from "../__generated__/index.css?url";
+import { sitemap } from "../__generated__/$resources.sitemap.xml";
+
+const customFetch: typeof fetch = (input, init) => {
+ if (typeof input !== "string") {
+ return fetch(input, init);
+ }
+
+ if (isLocalResource(input, "sitemap.xml")) {
+ // @todo: dynamic import sitemap ???
+ const response = new Response(JSON.stringify(sitemap));
+ response.headers.set("content-type", "application/json; charset=utf-8");
+ return Promise.resolve(response);
+ }
+
+ return fetch(input, init);
+};
+
+export const loader = async (arg: LoaderFunctionArgs) => {
+ const url = new URL(arg.request.url);
+ const host =
+ arg.request.headers.get("x-forwarded-host") ||
+ arg.request.headers.get("host") ||
+ "";
+ url.host = host;
+ url.protocol = "https";
+
+ const params = getRemixParams(arg.params);
+ const system = {
+ params,
+ search: Object.fromEntries(url.searchParams),
+ origin: url.origin,
+ };
+
+ const resources = await loadResources(
+ customFetch,
+ getResources({ system }).data
+ );
+ const pageMeta = getPageMeta({ system, resources });
+
+ if (pageMeta.redirect) {
+ const status =
+ pageMeta.status === 301 || pageMeta.status === 302
+ ? pageMeta.status
+ : 302;
+ return redirect(pageMeta.redirect, status);
+ }
+
+ // typecheck
+ arg.context.EXCLUDE_FROM_SEARCH satisfies boolean;
+
+ if (arg.context.EXCLUDE_FROM_SEARCH) {
+ pageMeta.excludePageFromSearch = arg.context.EXCLUDE_FROM_SEARCH;
+ }
+
+ return json(
+ {
+ host,
+ url: url.href,
+ system,
+ resources,
+ pageMeta,
+ },
+ // No way for current information to change, so add cache for 10 minutes
+ // In case of CRM Data, this should be set to 0
+ {
+ status: pageMeta.status,
+ headers: {
+ "Cache-Control": "public, max-age=600",
+ },
+ }
+ );
+};
+
+export const headers: HeadersFunction = () => {
+ return {
+ "Cache-Control": "public, max-age=0, must-revalidate",
+ };
+};
+
+export const meta: MetaFunction<typeof loader> = ({ data }) => {
+ const metas: ReturnType<MetaFunction> = [];
+ if (data === undefined) {
+ return metas;
+ }
+ const { pageMeta } = data;
+
+ if (data.url) {
+ metas.push({
+ property: "og:url",
+ content: data.url,
+ });
+ }
+
+ if (pageMeta.title) {
+ metas.push({ title: pageMeta.title });
+
+ metas.push({
+ property: "og:title",
+ content: pageMeta.title,
+ });
+ }
+
+ metas.push({ property: "og:type", content: "website" });
+
+ const origin = `https://${data.host}`;
+
+ if (siteName) {
+ metas.push({
+ property: "og:site_name",
+ content: siteName,
+ });
+ metas.push({
+ "script:ld+json": {
+ "@context": "https://schema.org",
+ "@type": "WebSite",
+ name: siteName,
+ url: origin,
+ },
+ });
+ }
+
+ if (pageMeta.excludePageFromSearch) {
+ metas.push({
+ name: "robots",
+ content: "noindex, nofollow",
+ });
+ }
+
+ if (pageMeta.description) {
+ metas.push({
+ name: "description",
+ content: pageMeta.description,
+ });
+ metas.push({
+ property: "og:description",
+ content: pageMeta.description,
+ });
+ }
+
+ if (pageMeta.socialImageAssetName) {
+ metas.push({
+ property: "og:image",
+ content: `https://${data.host}${imageLoader({
+ src: pageMeta.socialImageAssetName,
+ // Do not transform social image (not enough information do we need to do this)
+ format: "raw",
+ })}`,
+ });
+ } else if (pageMeta.socialImageUrl) {
+ metas.push({
+ property: "og:image",
+ content: pageMeta.socialImageUrl,
+ });
+ }
+
+ metas.push(...pageMeta.custom);
+
+ return metas;
+};
+
+export const links: LinksFunction = () => {
+ const result: LinkDescriptor[] = [];
+
+ result.push({
+ rel: "stylesheet",
+ href: css,
+ });
+
+ if (favIconAsset) {
+ result.push({
+ rel: "icon",
+ href: imageLoader({
+ src: favIconAsset.name,
+ // width,height must be multiple of 48 https://developers.google.com/search/docs/appearance/favicon-in-search
+ width: 144,
+ height: 144,
+ fit: "pad",
+ quality: 100,
+ format: "auto",
+ }),
+ type: undefined,
+ });
+ }
+
+ for (const asset of pageFontAssets) {
+ result.push({
+ rel: "preload",
+ href: `${assetBaseUrl}${asset.name}`,
+ as: "font",
+ crossOrigin: "anonymous",
+ });
+ }
+
+ for (const backgroundImageAsset of pageBackgroundImageAssets) {
+ result.push({
+ rel: "preload",
+ href: `${assetBaseUrl}${backgroundImageAsset.name}`,
+ as: "image",
+ });
+ }
+
+ return result;
+};
+
+const getRequestHost = (request: Request): string =>
+ request.headers.get("x-forwarded-host") || request.headers.get("host") || "";
+
+export const action = async ({
+ request,
+ context,
+}: ActionFunctionArgs): Promise<
+ { success: true } | { success: false; errors: string[] }
+> => {
+ try {
+ const url = new URL(request.url);
+ url.host = getRequestHost(request);
+
+ const formData = await request.formData();
+
+ const system = {
+ params: {},
+ search: {},
+ origin: url.origin,
+ };
+
+ const resourceName = formData.get(formIdFieldName);
+ let resource =
+ typeof resourceName === "string"
+ ? getResources({ system }).action.get(resourceName)
+ : undefined;
+
+ const formBotValue = formData.get(formBotFieldName);
+
+ if (formBotValue == null || typeof formBotValue !== "string") {
+ throw new Error("Form bot field not found");
+ }
+
+ const submitTime = parseInt(formBotValue, 16);
+ // Assumes that the difference between the server time and the form submission time,
+ // including any client-server time drift, is within a 5-minute range.
+ // Note: submitTime might be NaN because formBotValue can be any string used for logging purposes.
+ // Example: `formBotValue: jsdom`, or `formBotValue: headless-env`
+ if (
+ Number.isNaN(submitTime) ||
+ Math.abs(Date.now() - submitTime) > 1000 * 60 * 5
+ ) {
+ throw new Error(`Form bot value invalid ${formBotValue}`);
+ }
+
+ formData.delete(formIdFieldName);
+ formData.delete(formBotFieldName);
+
+ if (resource) {
+ resource.headers.push({
+ name: "Content-Type",
+ value: "application/json",
+ });
+ resource.body = Object.fromEntries(formData);
+ } else {
+ if (contactEmail === undefined) {
+ throw new Error("Contact email not found");
+ }
+
+ resource = context.getDefaultActionResource?.({
+ url,
+ projectId,
+ contactEmail,
+ formData,
+ });
+ }
+
+ if (resource === undefined) {
+ throw Error("Resource not found");
+ }
+ const { ok, statusText } = await loadResource(fetch, resource);
+ if (ok) {
+ return { success: true };
+ }
+ return { success: false, errors: [statusText] };
+ } catch (error) {
+ console.error(error);
+
+ return {
+ success: false,
+ errors: [error instanceof Error ? error.message : "Unknown error"],
+ };
+ }
+};
+
+const Outlet = () => {
+ const { system, resources, url } = useLoaderData<typeof loader>();
+ return (
+ <ReactSdkContext.Provider
+ value={{
+ imageLoader,
+ assetBaseUrl,
+ imageBaseUrl,
+ resources,
+ }}
+ >
+ {/* Use the URL as the key to force scripts in HTML Embed to reload on dynamic pages */}
+ <Page key={url} system={system} />
+ </ReactSdkContext.Provider>
+ );
+};
+
+export default Outlet;
diff --git a/fixtures/webstudio-remix-vercel/package.json b/fixtures/webstudio-remix-vercel/package.json
index a41b39d7cc..37d4ef34fe 100644
--- a/fixtures/webstudio-remix-vercel/package.json
+++ b/fixtures/webstudio-remix-vercel/package.json
@@ -6,7 +6,7 @@
"typecheck": "tsc",
"cli": "NODE_OPTIONS='--conditions=webstudio --import=tsx' webstudio",
"fixtures:link": "pnpm cli link --link https://p-cddc1d44-af37-4cb6-a430-d300cf6f932d-dot-${BUILDER_HOST:-main.development.webstudio.is}'?authToken=1cdc6026-dd5b-4624-b89b-9bd45e9bcc3d'",
- "fixtures:sync": "pnpm cli sync --buildId 5df1744d-0383-4775-819c-1648300d55cd && pnpm prettier --write ./.webstudio/",
+ "fixtures:sync": "pnpm cli sync --buildId 40962d82-ea2d-4536-b94f-dece81312190 && pnpm prettier --write ./.webstudio/",
"fixtures:build": "pnpm cli build --template vercel --template internal --preview && pnpm prettier --write ./app/ ./package.json ./tsconfig.json"
},
"private": true,
diff --git a/packages/cli/src/html-to-jsx.ts b/packages/cli/src/html-to-jsx.ts
index 7cebb5e359..ea48885f87 100644
--- a/packages/cli/src/html-to-jsx.ts
+++ b/packages/cli/src/html-to-jsx.ts
@@ -141,6 +141,11 @@ export const htmlToJsx = (html: string) => {
case "text": {
const escapedValue = escape(walkNode.value);
+ const re = /^\s$/g;
+ if (re.test(walkNode.value)) {
+ break;
+ }
+
result += escapedValue ? "{" + escapedValue + "}" : "";
break;
}
diff --git a/packages/react-sdk/src/component-generator.test.tsx b/packages/react-sdk/src/component-generator.test.tsx
index abbe882cde..f99fed98f7 100644
--- a/packages/react-sdk/src/component-generator.test.tsx
+++ b/packages/react-sdk/src/component-generator.test.tsx
@@ -1,3 +1,4 @@
+import ts from "typescript";
import { expect, test } from "@jest/globals";
import stripIndent from "strip-indent";
import { createScope, type DataSource } from "@webstudio-is/sdk";
@@ -18,6 +19,52 @@ import {
generateWebstudioComponent,
} from "./component-generator";
+const isValidJSX = (code: string): boolean => {
+ // Create a "virtual" TypeScript program
+ const compilerHost = ts.createCompilerHost({});
+ const fileName = "virtual.tsx";
+
+ compilerHost.getSourceFile = (filename) => {
+ if (filename === fileName) {
+ return ts.createSourceFile(
+ filename,
+ code,
+ ts.ScriptTarget.Latest,
+ true,
+ ts.ScriptKind.TSX
+ );
+ }
+ return undefined;
+ };
+
+ const program = ts.createProgram(
+ [fileName],
+ {
+ jsx: ts.JsxEmit.React,
+ strict: true,
+ },
+ compilerHost
+ );
+
+ const sourceFile = program.getSourceFile(fileName);
+
+ if (!sourceFile) {
+ return false;
+ }
+
+ const diagnostics = [
+ ...program.getSyntacticDiagnostics(sourceFile),
+ // ...program.getSemanticDiagnostics(sourceFile),
+ ];
+
+ return diagnostics.length === 0;
+};
+
+const validateJSX = (code: string) => {
+ expect(isValidJSX(code)).toBeTruthy();
+ return code;
+};
+
const clear = (input: string) =>
stripIndent(input).trimStart().replace(/ +$/, "");
@@ -35,11 +82,13 @@ test("generate jsx element with children and without them", () => {
...renderJsx(<$.Body ws:id="body">Children</$.Body>),
})
).toEqual(
- clear(`
+ validateJSX(
+ clear(`
<Body>
{"Children"}
</Body>
`)
+ )
);
expect(
generateJsxChildren({
@@ -51,9 +100,11 @@ test("generate jsx element with children and without them", () => {
...renderJsx(<$.Image ws:id="image"></$.Image>),
})
).toEqual(
- clear(`
+ validateJSX(
+ clear(`
<Image />
`)
+ )
);
});
@@ -69,9 +120,11 @@ test("generate jsx element with namespaces components", () => {
...renderJsx(<library.Body ws:id="body"></library.Body>),
})
).toEqual(
- clear(`
+ validateJSX(
+ clear(`
<Body />
`)
+ )
);
expect(
generateJsxChildren({
@@ -83,9 +136,11 @@ test("generate jsx element with namespaces components", () => {
...renderJsx(<library.Image ws:id="image"></library.Image>),
})
).toEqual(
- clear(`
+ validateJSX(
+ clear(`
<Image />
`)
+ )
);
});
@@ -100,11 +155,13 @@ test("generate jsx element with literal props", () => {
...renderJsx(<$.Body ws:id="body" string="string" number={0}></$.Body>),
})
).toEqual(
- clear(`
+ validateJSX(
+ clear(`
<Body
string={"string"}
number={0} />
`)
+ )
);
expect(
generateJsxChildren({
@@ -122,11 +179,13 @@ test("generate jsx element with literal props", () => {
),
})
).toEqual(
- clear(`
+ validateJSX(
+ clear(`
<Image
boolean={true}
stringArray={["value1","value2"]} />
`)
+ )
);
});
@@ -147,9 +206,11 @@ test("ignore asset and page props", () => {
),
})
).toEqual(
- clear(`
+ validateJSX(
+ clear(`
<Box />
`)
+ )
);
});
@@ -180,7 +241,8 @@ test("generate jsx element with data sources and action", () => {
),
})
).toEqual(
- clear(`
+ validateJSX(
+ clear(`
<Box
variable={variableName}
expression={variableName + 1}
@@ -189,6 +251,7 @@ test("generate jsx element with data sources and action", () => {
set$variableName(variableName)
}} />
`)
+ )
);
});
@@ -203,9 +266,11 @@ test("generate jsx element with condition based on show prop", () => {
...renderJsx(<$.Box ws:id="box" data-ws-show={true}></$.Box>),
})
).toEqual(
- clear(`
+ validateJSX(
+ clear(`
<Box />
`)
+ )
);
expect(
generateJsxChildren({
@@ -239,11 +304,13 @@ test("generate jsx element with condition based on show prop", () => {
),
})
).toEqual(
- clear(`
+ validateJSX(
+ clear(`
{(conditionName) &&
<Box />
}
`)
+ )
);
});
@@ -258,10 +325,12 @@ test("generate jsx element with index prop", () => {
...renderJsx(<$.Box ws:id="box"></$.Box>),
})
).toEqual(
- clear(`
+ validateJSX(
+ clear(`
<Box
data-ws-index="5" />
`)
+ )
);
});
@@ -280,12 +349,14 @@ test("generate jsx children with text", () => {
indexesWithinAncestors: new Map(),
})
).toEqual(
- clear(`
+ validateJSX(
+ clear(`
{"Some"}
<br />
{"text"}
{"Escaped \\"text\\""}
`)
+ )
);
});
@@ -305,9 +376,11 @@ test("exclude text placeholders", () => {
excludePlaceholders: true,
})
).toEqual(
- clear(`
+ validateJSX(
+ clear(`
{"Text"}
`)
+ )
);
});
@@ -333,9 +406,11 @@ test("generate jsx children with expression", () => {
indexesWithinAncestors: new Map(),
})
).toEqual(
- clear(`
+ validateJSX(
+ clear(`
{'Hello ' + myvar}
`)
+ )
);
});
@@ -355,13 +430,15 @@ test("generate jsx children with nested instances", () => {
),
})
).toEqual(
- clear(`
+ validateJSX(
+ clear(`
<Form
prop={"value"}>
<Input />
<Button />
</Form>
`)
+ )
);
});
@@ -429,7 +506,8 @@ test("generate collection component as map", () => {
),
})
).toEqual(
- clear(`
+ validateJSX(
+ clear(`
{data?.map((element: any, index: number) =>
<Fragment key={index}>
<Label />
@@ -438,6 +516,7 @@ test("generate collection component as map", () => {
</Fragment>
)}
`)
+ )
);
});
@@ -470,7 +549,8 @@ test("generate component with variables and actions", () => {
),
})
).toEqual(
- clear(`
+ validateJSX(
+ clear(`
const Page = () => {
let [variableName, set$variableName] = useVariableState<any>("initial")
return <Body>
@@ -483,6 +563,7 @@ test("generate component with variables and actions", () => {
</Body>
}
`)
+ )
);
});
@@ -499,12 +580,14 @@ test("add classes and merge classes", () => {
...renderJsx(<$.Body ws:id="body" className='cls2 "cls3"'></$.Body>),
})
).toEqual(
- clear(`
- const Page = () => {
- return <Body
- className="cls1 cls2 \\"cls3\\"" />
- }
+ validateJSX(
+ clear(`
+ const Page = () => {
+ return <Body
+ className={"cls1 cls2 \\"cls3\\""} />
+ }
`)
+ )
);
});
@@ -543,7 +626,8 @@ test("avoid generating collection parameter variable as state", () => {
),
})
).toEqual(
- clear(`
+ validateJSX(
+ clear(`
const Page = () => {
let [data, set$data] = useVariableState<any>(["apple","orange","mango"])
return <Body>
@@ -554,6 +638,7 @@ test("avoid generating collection parameter variable as state", () => {
</Body>
}
`)
+ )
);
});
@@ -590,12 +675,14 @@ test("generate system variable when present", () => {
),
})
).toEqual(
- clear(`
+ validateJSX(
+ clear(`
const Page = ({ system: system_1, }: { system: any; }) => {
return <Body
data-slug={system_1?.params?.slug} />
}
`)
+ )
);
});
@@ -635,7 +722,8 @@ test("generate resources loading", () => {
),
})
).toEqual(
- clear(`
+ validateJSX(
+ clear(`
const Page = () => {
let [data, set$data] = useVariableState<any>("data")
let data_1 = useResource("data_2")
@@ -644,6 +732,7 @@ test("generate resources loading", () => {
data-resource={data_1} />
}
`)
+ )
);
});
diff --git a/packages/react-sdk/src/component-generator.ts b/packages/react-sdk/src/component-generator.ts
index 0c2a68a366..3cc6e65778 100644
--- a/packages/react-sdk/src/component-generator.ts
+++ b/packages/react-sdk/src/component-generator.ts
@@ -217,7 +217,7 @@ export const generateJsxElement = ({
}
if (classes.length !== 0) {
- generatedProps += `\nclassName=${JSON.stringify(classes.join(" "))}`;
+ generatedProps += `\nclassName={${JSON.stringify(classes.join(" "))}}`;
}
let generatedElement = "";