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.

experimental: Breakpoint support for the Animation component (#5012)

Ivan Starkov35d0d7c8ac64
diff --git a/apps/builder/app/canvas/canvas.tsx b/apps/builder/app/canvas/canvas.tsx
index 6feb2554c4..965e4dd867 100644
--- a/apps/builder/app/canvas/canvas.tsx
+++ b/apps/builder/app/canvas/canvas.tsx
@@ -51,6 +51,7 @@ import {
$isContentMode,
subscribeModifierKeys,
assetBaseUrl,
+ $breakpoints,
} from "~/shared/nano-states";
import { useDragAndDrop } from "./shared/use-drag-drop";
import {
@@ -75,6 +76,7 @@ import { $selectedPage } from "~/shared/awareness";
import { createInstanceElement } from "./elements";
import { Body } from "./shared/body";
import { subscribeScrollbarSize } from "./scrollbar-width";
+import { compareMedia } from "@webstudio-is/css-engine";
registerContainers();
@@ -99,6 +101,7 @@ const FallbackComponent = ({ error, resetErrorBoundary }: FallbackProps) => {
const useElementsTree = (components: Components, instances: Instances) => {
const page = useStore($selectedPage);
const isPreviewMode = useStore($isPreviewMode);
+ const breakpointsMap = useStore($breakpoints);
const rootInstanceId = page?.rootInstanceId ?? "";
if (typeof window === "undefined") {
@@ -111,6 +114,11 @@ const useElementsTree = (components: Components, instances: Instances) => {
});
}
+ const breakpoints = useMemo(
+ () => [...breakpointsMap.values()].sort(compareMedia),
+ [breakpointsMap]
+ );
+
return useMemo(() => {
return (
<ReactSdkContext.Provider
@@ -119,6 +127,7 @@ const useElementsTree = (components: Components, instances: Instances) => {
assetBaseUrl,
imageLoader: wsImageLoader,
resources: {},
+ breakpoints,
}}
>
{createInstanceElement({
@@ -132,7 +141,7 @@ const useElementsTree = (components: Components, instances: Instances) => {
})}
</ReactSdkContext.Provider>
);
- }, [instances, rootInstanceId, components, isPreviewMode]);
+ }, [instances, rootInstanceId, components, isPreviewMode, breakpoints]);
};
const DesignMode = () => {
diff --git a/fixtures/react-router-docker/app/__generated__/[another-page]._index.tsx b/fixtures/react-router-docker/app/__generated__/[another-page]._index.tsx
index f089b02f4c..56be7fc447 100644
--- a/fixtures/react-router-docker/app/__generated__/[another-page]._index.tsx
+++ b/fixtures/react-router-docker/app/__generated__/[another-page]._index.tsx
@@ -8,6 +8,13 @@ import { Heading as Heading } from "@webstudio-is/sdk-components-react";
export const siteName = "";
+export const breakpoints = [
+ { id: "rKj-wYctg3-GnqL3WHN9I" },
+ { id: "yH9RXhqCyeaVkrOt8MzLc", maxWidth: 991 },
+ { id: "8nSCZbeS002IVwkTdoIes", maxWidth: 767 },
+ { id: "7gBD25KrrbBdJYNDlhPz7", maxWidth: 479 },
+];
+
export const favIconAsset: string | undefined =
"147-1478573_cat-icon-png-black-cat-png-icon.png_ZJ6-qJjk1RlFzuYwyCXdp.jpeg";
diff --git a/fixtures/react-router-docker/app/__generated__/_index.tsx b/fixtures/react-router-docker/app/__generated__/_index.tsx
index a4a0a49620..d1f54e12b0 100644
--- a/fixtures/react-router-docker/app/__generated__/_index.tsx
+++ b/fixtures/react-router-docker/app/__generated__/_index.tsx
@@ -15,6 +15,13 @@ import {
export const siteName = "";
+export const breakpoints = [
+ { id: "rKj-wYctg3-GnqL3WHN9I" },
+ { id: "yH9RXhqCyeaVkrOt8MzLc", maxWidth: 991 },
+ { id: "8nSCZbeS002IVwkTdoIes", maxWidth: 767 },
+ { id: "7gBD25KrrbBdJYNDlhPz7", maxWidth: 479 },
+];
+
export const favIconAsset: string | undefined =
"147-1478573_cat-icon-png-black-cat-png-icon.png_ZJ6-qJjk1RlFzuYwyCXdp.jpeg";
diff --git a/fixtures/react-router-docker/app/routes/[another-page]._index.tsx b/fixtures/react-router-docker/app/routes/[another-page]._index.tsx
index f60ab4be24..4b100d97fe 100644
--- a/fixtures/react-router-docker/app/routes/[another-page]._index.tsx
+++ b/fixtures/react-router-docker/app/routes/[another-page]._index.tsx
@@ -27,6 +27,7 @@ import {
favIconAsset,
pageFontAssets,
pageBackgroundImageAssets,
+ breakpoints,
} from "../__generated__/[another-page]._index";
import {
getResources,
@@ -272,6 +273,7 @@ const Outlet = () => {
imageLoader,
assetBaseUrl,
resources,
+ breakpoints,
}}
>
{/* Use the URL as the key to force scripts in HTML Embed to reload on dynamic pages */}
diff --git a/fixtures/react-router-docker/app/routes/_index.tsx b/fixtures/react-router-docker/app/routes/_index.tsx
index fbb3ae46b8..dd294abfe9 100644
--- a/fixtures/react-router-docker/app/routes/_index.tsx
+++ b/fixtures/react-router-docker/app/routes/_index.tsx
@@ -27,6 +27,7 @@ import {
favIconAsset,
pageFontAssets,
pageBackgroundImageAssets,
+ breakpoints,
} from "../__generated__/_index";
import {
getResources,
@@ -272,6 +273,7 @@ const Outlet = () => {
imageLoader,
assetBaseUrl,
resources,
+ breakpoints,
}}
>
{/* Use the URL as the key to force scripts in HTML Embed to reload on dynamic pages */}
diff --git a/fixtures/react-router-netlify/app/__generated__/[another-page]._index.tsx b/fixtures/react-router-netlify/app/__generated__/[another-page]._index.tsx
index f089b02f4c..56be7fc447 100644
--- a/fixtures/react-router-netlify/app/__generated__/[another-page]._index.tsx
+++ b/fixtures/react-router-netlify/app/__generated__/[another-page]._index.tsx
@@ -8,6 +8,13 @@ import { Heading as Heading } from "@webstudio-is/sdk-components-react";
export const siteName = "";
+export const breakpoints = [
+ { id: "rKj-wYctg3-GnqL3WHN9I" },
+ { id: "yH9RXhqCyeaVkrOt8MzLc", maxWidth: 991 },
+ { id: "8nSCZbeS002IVwkTdoIes", maxWidth: 767 },
+ { id: "7gBD25KrrbBdJYNDlhPz7", maxWidth: 479 },
+];
+
export const favIconAsset: string | undefined =
"147-1478573_cat-icon-png-black-cat-png-icon.png_ZJ6-qJjk1RlFzuYwyCXdp.jpeg";
diff --git a/fixtures/react-router-netlify/app/__generated__/_index.tsx b/fixtures/react-router-netlify/app/__generated__/_index.tsx
index a4a0a49620..d1f54e12b0 100644
--- a/fixtures/react-router-netlify/app/__generated__/_index.tsx
+++ b/fixtures/react-router-netlify/app/__generated__/_index.tsx
@@ -15,6 +15,13 @@ import {
export const siteName = "";
+export const breakpoints = [
+ { id: "rKj-wYctg3-GnqL3WHN9I" },
+ { id: "yH9RXhqCyeaVkrOt8MzLc", maxWidth: 991 },
+ { id: "8nSCZbeS002IVwkTdoIes", maxWidth: 767 },
+ { id: "7gBD25KrrbBdJYNDlhPz7", maxWidth: 479 },
+];
+
export const favIconAsset: string | undefined =
"147-1478573_cat-icon-png-black-cat-png-icon.png_ZJ6-qJjk1RlFzuYwyCXdp.jpeg";
diff --git a/fixtures/react-router-netlify/app/routes/[another-page]._index.tsx b/fixtures/react-router-netlify/app/routes/[another-page]._index.tsx
index f60ab4be24..4b100d97fe 100644
--- a/fixtures/react-router-netlify/app/routes/[another-page]._index.tsx
+++ b/fixtures/react-router-netlify/app/routes/[another-page]._index.tsx
@@ -27,6 +27,7 @@ import {
favIconAsset,
pageFontAssets,
pageBackgroundImageAssets,
+ breakpoints,
} from "../__generated__/[another-page]._index";
import {
getResources,
@@ -272,6 +273,7 @@ const Outlet = () => {
imageLoader,
assetBaseUrl,
resources,
+ breakpoints,
}}
>
{/* Use the URL as the key to force scripts in HTML Embed to reload on dynamic pages */}
diff --git a/fixtures/react-router-netlify/app/routes/_index.tsx b/fixtures/react-router-netlify/app/routes/_index.tsx
index fbb3ae46b8..dd294abfe9 100644
--- a/fixtures/react-router-netlify/app/routes/_index.tsx
+++ b/fixtures/react-router-netlify/app/routes/_index.tsx
@@ -27,6 +27,7 @@ import {
favIconAsset,
pageFontAssets,
pageBackgroundImageAssets,
+ breakpoints,
} from "../__generated__/_index";
import {
getResources,
@@ -272,6 +273,7 @@ const Outlet = () => {
imageLoader,
assetBaseUrl,
resources,
+ breakpoints,
}}
>
{/* Use the URL as the key to force scripts in HTML Embed to reload on dynamic pages */}
diff --git a/fixtures/react-router-vercel/app/__generated__/[another-page]._index.tsx b/fixtures/react-router-vercel/app/__generated__/[another-page]._index.tsx
index f089b02f4c..56be7fc447 100644
--- a/fixtures/react-router-vercel/app/__generated__/[another-page]._index.tsx
+++ b/fixtures/react-router-vercel/app/__generated__/[another-page]._index.tsx
@@ -8,6 +8,13 @@ import { Heading as Heading } from "@webstudio-is/sdk-components-react";
export const siteName = "";
+export const breakpoints = [
+ { id: "rKj-wYctg3-GnqL3WHN9I" },
+ { id: "yH9RXhqCyeaVkrOt8MzLc", maxWidth: 991 },
+ { id: "8nSCZbeS002IVwkTdoIes", maxWidth: 767 },
+ { id: "7gBD25KrrbBdJYNDlhPz7", maxWidth: 479 },
+];
+
export const favIconAsset: string | undefined =
"147-1478573_cat-icon-png-black-cat-png-icon.png_ZJ6-qJjk1RlFzuYwyCXdp.jpeg";
diff --git a/fixtures/react-router-vercel/app/__generated__/_index.tsx b/fixtures/react-router-vercel/app/__generated__/_index.tsx
index a4a0a49620..d1f54e12b0 100644
--- a/fixtures/react-router-vercel/app/__generated__/_index.tsx
+++ b/fixtures/react-router-vercel/app/__generated__/_index.tsx
@@ -15,6 +15,13 @@ import {
export const siteName = "";
+export const breakpoints = [
+ { id: "rKj-wYctg3-GnqL3WHN9I" },
+ { id: "yH9RXhqCyeaVkrOt8MzLc", maxWidth: 991 },
+ { id: "8nSCZbeS002IVwkTdoIes", maxWidth: 767 },
+ { id: "7gBD25KrrbBdJYNDlhPz7", maxWidth: 479 },
+];
+
export const favIconAsset: string | undefined =
"147-1478573_cat-icon-png-black-cat-png-icon.png_ZJ6-qJjk1RlFzuYwyCXdp.jpeg";
diff --git a/fixtures/react-router-vercel/app/routes/[another-page]._index.tsx b/fixtures/react-router-vercel/app/routes/[another-page]._index.tsx
index f60ab4be24..4b100d97fe 100644
--- a/fixtures/react-router-vercel/app/routes/[another-page]._index.tsx
+++ b/fixtures/react-router-vercel/app/routes/[another-page]._index.tsx
@@ -27,6 +27,7 @@ import {
favIconAsset,
pageFontAssets,
pageBackgroundImageAssets,
+ breakpoints,
} from "../__generated__/[another-page]._index";
import {
getResources,
@@ -272,6 +273,7 @@ const Outlet = () => {
imageLoader,
assetBaseUrl,
resources,
+ breakpoints,
}}
>
{/* Use the URL as the key to force scripts in HTML Embed to reload on dynamic pages */}
diff --git a/fixtures/react-router-vercel/app/routes/_index.tsx b/fixtures/react-router-vercel/app/routes/_index.tsx
index fbb3ae46b8..dd294abfe9 100644
--- a/fixtures/react-router-vercel/app/routes/_index.tsx
+++ b/fixtures/react-router-vercel/app/routes/_index.tsx
@@ -27,6 +27,7 @@ import {
favIconAsset,
pageFontAssets,
pageBackgroundImageAssets,
+ breakpoints,
} from "../__generated__/_index";
import {
getResources,
@@ -272,6 +273,7 @@ const Outlet = () => {
imageLoader,
assetBaseUrl,
resources,
+ breakpoints,
}}
>
{/* Use the URL as the key to force scripts in HTML Embed to reload on dynamic pages */}
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 c0b466c443..eb7a99d6e9 100644
--- a/fixtures/ssg-netlify-by-project-id/app/__generated__/_index.tsx
+++ b/fixtures/ssg-netlify-by-project-id/app/__generated__/_index.tsx
@@ -10,6 +10,13 @@ import {
export const siteName = undefined;
+export const breakpoints = [
+ { id: "pTyOZEX5PG52onfyt3-Vg" },
+ { id: "GzBytedsc258Pp7rh1hiD", maxWidth: 991 },
+ { id: "ugRM71O_Lm78kMKjkrtyz", maxWidth: 767 },
+ { id: "NKdYAYw-oxmW8laNbpiwK", maxWidth: 479 },
+];
+
export const favIconAsset: string | undefined = undefined;
// Font assets on current page (can be preloaded)
diff --git a/fixtures/ssg-netlify-by-project-id/pages/index/+Page.tsx b/fixtures/ssg-netlify-by-project-id/pages/index/+Page.tsx
index 26af1592ea..d316d31c54 100644
--- a/fixtures/ssg-netlify-by-project-id/pages/index/+Page.tsx
+++ b/fixtures/ssg-netlify-by-project-id/pages/index/+Page.tsx
@@ -1,7 +1,7 @@
import type { PageContext } from "vike/types";
import { ReactSdkContext } from "@webstudio-is/react-sdk/runtime";
import { assetBaseUrl, imageLoader } from "../../app/constants.mjs";
-import { Page } from "../../app/__generated__/_index";
+import { Page, breakpoints } from "../../app/__generated__/_index";
const PageComponent = ({ data }: { data: PageContext["data"] }) => {
const { system, resources, url } = data;
@@ -11,6 +11,7 @@ const PageComponent = ({ data }: { data: PageContext["data"] }) => {
imageLoader,
assetBaseUrl,
resources,
+ breakpoints,
}}
>
{/* Use the URL as the key to force scripts in HTML Embed to reload on dynamic pages */}
diff --git a/fixtures/ssg/app/__generated__/[another-page]._index.tsx b/fixtures/ssg/app/__generated__/[another-page]._index.tsx
index 860f58b817..d33cab90ae 100644
--- a/fixtures/ssg/app/__generated__/[another-page]._index.tsx
+++ b/fixtures/ssg/app/__generated__/[another-page]._index.tsx
@@ -10,6 +10,13 @@ import {
export const siteName = "";
+export const breakpoints = [
+ { id: "rKj-wYctg3-GnqL3WHN9I" },
+ { id: "yH9RXhqCyeaVkrOt8MzLc", maxWidth: 991 },
+ { id: "8nSCZbeS002IVwkTdoIes", maxWidth: 767 },
+ { id: "7gBD25KrrbBdJYNDlhPz7", maxWidth: 479 },
+];
+
export const favIconAsset: string | undefined = undefined;
// Font assets on current page (can be preloaded)
diff --git a/fixtures/ssg/app/__generated__/_index.tsx b/fixtures/ssg/app/__generated__/_index.tsx
index e275514d97..7647cb2766 100644
--- a/fixtures/ssg/app/__generated__/_index.tsx
+++ b/fixtures/ssg/app/__generated__/_index.tsx
@@ -13,6 +13,13 @@ import {
export const siteName = "";
+export const breakpoints = [
+ { id: "rKj-wYctg3-GnqL3WHN9I" },
+ { id: "yH9RXhqCyeaVkrOt8MzLc", maxWidth: 991 },
+ { id: "8nSCZbeS002IVwkTdoIes", maxWidth: 767 },
+ { id: "7gBD25KrrbBdJYNDlhPz7", maxWidth: 479 },
+];
+
export const favIconAsset: string | undefined = undefined;
// Font assets on current page (can be preloaded)
diff --git a/fixtures/ssg/pages/another-page/+Page.tsx b/fixtures/ssg/pages/another-page/+Page.tsx
index e767324c82..ff30fd1acd 100644
--- a/fixtures/ssg/pages/another-page/+Page.tsx
+++ b/fixtures/ssg/pages/another-page/+Page.tsx
@@ -1,7 +1,10 @@
import type { PageContext } from "vike/types";
import { ReactSdkContext } from "@webstudio-is/react-sdk/runtime";
import { assetBaseUrl, imageLoader } from "../../app/constants.mjs";
-import { Page } from "../../app/__generated__/[another-page]._index";
+import {
+ Page,
+ breakpoints,
+} from "../../app/__generated__/[another-page]._index";
const PageComponent = ({ data }: { data: PageContext["data"] }) => {
const { system, resources, url } = data;
@@ -11,6 +14,7 @@ const PageComponent = ({ data }: { data: PageContext["data"] }) => {
imageLoader,
assetBaseUrl,
resources,
+ breakpoints,
}}
>
{/* Use the URL as the key to force scripts in HTML Embed to reload on dynamic pages */}
diff --git a/fixtures/ssg/pages/index/+Page.tsx b/fixtures/ssg/pages/index/+Page.tsx
index 26af1592ea..d316d31c54 100644
--- a/fixtures/ssg/pages/index/+Page.tsx
+++ b/fixtures/ssg/pages/index/+Page.tsx
@@ -1,7 +1,7 @@
import type { PageContext } from "vike/types";
import { ReactSdkContext } from "@webstudio-is/react-sdk/runtime";
import { assetBaseUrl, imageLoader } from "../../app/constants.mjs";
-import { Page } from "../../app/__generated__/_index";
+import { Page, breakpoints } from "../../app/__generated__/_index";
const PageComponent = ({ data }: { data: PageContext["data"] }) => {
const { system, resources, url } = data;
@@ -11,6 +11,7 @@ const PageComponent = ({ data }: { data: PageContext["data"] }) => {
imageLoader,
assetBaseUrl,
resources,
+ breakpoints,
}}
>
{/* Use the URL as the key to force scripts in HTML Embed to reload on dynamic pages */}
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 5951a23e06..8ed73e63b0 100644
--- a/fixtures/webstudio-cloudflare-template/app/__generated__/[another-page]._index.tsx
+++ b/fixtures/webstudio-cloudflare-template/app/__generated__/[another-page]._index.tsx
@@ -8,6 +8,13 @@ import { Heading as Heading } from "@webstudio-is/sdk-components-react";
export const siteName = "";
+export const breakpoints = [
+ { id: "rKj-wYctg3-GnqL3WHN9I" },
+ { id: "yH9RXhqCyeaVkrOt8MzLc", maxWidth: 991 },
+ { id: "8nSCZbeS002IVwkTdoIes", maxWidth: 767 },
+ { id: "7gBD25KrrbBdJYNDlhPz7", maxWidth: 479 },
+];
+
export const favIconAsset: string | undefined = undefined;
// Font assets on current page (can be preloaded)
diff --git a/fixtures/webstudio-cloudflare-template/app/__generated__/_index.tsx b/fixtures/webstudio-cloudflare-template/app/__generated__/_index.tsx
index 84dac82e93..4dc70419ac 100644
--- a/fixtures/webstudio-cloudflare-template/app/__generated__/_index.tsx
+++ b/fixtures/webstudio-cloudflare-template/app/__generated__/_index.tsx
@@ -15,6 +15,13 @@ import {
export const siteName = "";
+export const breakpoints = [
+ { id: "rKj-wYctg3-GnqL3WHN9I" },
+ { id: "yH9RXhqCyeaVkrOt8MzLc", maxWidth: 991 },
+ { id: "8nSCZbeS002IVwkTdoIes", maxWidth: 767 },
+ { id: "7gBD25KrrbBdJYNDlhPz7", maxWidth: 479 },
+];
+
export const favIconAsset: string | undefined = undefined;
// Font assets on current page (can be preloaded)
diff --git a/fixtures/webstudio-cloudflare-template/app/routes/[another-page]._index.tsx b/fixtures/webstudio-cloudflare-template/app/routes/[another-page]._index.tsx
index a8e99d49bc..135f9e549e 100644
--- a/fixtures/webstudio-cloudflare-template/app/routes/[another-page]._index.tsx
+++ b/fixtures/webstudio-cloudflare-template/app/routes/[another-page]._index.tsx
@@ -28,6 +28,7 @@ import {
favIconAsset,
pageFontAssets,
pageBackgroundImageAssets,
+ breakpoints,
} from "../__generated__/[another-page]._index";
import {
getResources,
@@ -273,6 +274,7 @@ const Outlet = () => {
imageLoader,
assetBaseUrl,
resources,
+ breakpoints,
}}
>
{/* Use the URL as the key to force scripts in HTML Embed to reload on dynamic pages */}
diff --git a/fixtures/webstudio-cloudflare-template/app/routes/_index.tsx b/fixtures/webstudio-cloudflare-template/app/routes/_index.tsx
index beb3ec3795..d62eb729af 100644
--- a/fixtures/webstudio-cloudflare-template/app/routes/_index.tsx
+++ b/fixtures/webstudio-cloudflare-template/app/routes/_index.tsx
@@ -28,6 +28,7 @@ import {
favIconAsset,
pageFontAssets,
pageBackgroundImageAssets,
+ breakpoints,
} from "../__generated__/_index";
import {
getResources,
@@ -273,6 +274,7 @@ const Outlet = () => {
imageLoader,
assetBaseUrl,
resources,
+ breakpoints,
}}
>
{/* Use the URL as the key to force scripts in HTML Embed to reload on dynamic pages */}
diff --git a/fixtures/webstudio-features/app/__generated__/[_route_with_symbols_]._index.tsx b/fixtures/webstudio-features/app/__generated__/[_route_with_symbols_]._index.tsx
index 2d0e9eae17..84d996af9a 100644
--- a/fixtures/webstudio-features/app/__generated__/[_route_with_symbols_]._index.tsx
+++ b/fixtures/webstudio-features/app/__generated__/[_route_with_symbols_]._index.tsx
@@ -8,6 +8,12 @@ import { Image as Image } from "@webstudio-is/sdk-components-react";
export const siteName = "KittyGuardedZone";
+export const breakpoints = [
+ { id: "UoTkWyaFuTYJihS3MFYK5" },
+ { id: "ZMaWCtWpH-ao0e_kgIHqR", minWidth: 372 },
+ { id: "Z8WjyXWkCrr35PXgjHdpY", minWidth: 472 },
+];
+
export const favIconAsset: string | undefined =
"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";
diff --git a/fixtures/webstudio-features/app/__generated__/[animations]._index.tsx b/fixtures/webstudio-features/app/__generated__/[animations]._index.tsx
index dc5123907c..5dd4013bdb 100644
--- a/fixtures/webstudio-features/app/__generated__/[animations]._index.tsx
+++ b/fixtures/webstudio-features/app/__generated__/[animations]._index.tsx
@@ -15,6 +15,12 @@ import {
export const siteName = "KittyGuardedZone";
+export const breakpoints = [
+ { id: "UoTkWyaFuTYJihS3MFYK5" },
+ { id: "ZMaWCtWpH-ao0e_kgIHqR", minWidth: 372 },
+ { id: "Z8WjyXWkCrr35PXgjHdpY", minWidth: 472 },
+];
+
export const favIconAsset: string | undefined =
"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";
diff --git a/fixtures/webstudio-features/app/__generated__/[class-names]._index.tsx b/fixtures/webstudio-features/app/__generated__/[class-names]._index.tsx
index 5bb7bd10fa..ac41b90427 100644
--- a/fixtures/webstudio-features/app/__generated__/[class-names]._index.tsx
+++ b/fixtures/webstudio-features/app/__generated__/[class-names]._index.tsx
@@ -8,6 +8,12 @@ import { Box as Box } from "@webstudio-is/sdk-components-react";
export const siteName = "KittyGuardedZone";
+export const breakpoints = [
+ { id: "UoTkWyaFuTYJihS3MFYK5" },
+ { id: "ZMaWCtWpH-ao0e_kgIHqR", minWidth: 372 },
+ { id: "Z8WjyXWkCrr35PXgjHdpY", minWidth: 472 },
+];
+
export const favIconAsset: string | undefined =
"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";
diff --git a/fixtures/webstudio-features/app/__generated__/[content-block]._index.tsx b/fixtures/webstudio-features/app/__generated__/[content-block]._index.tsx
index eba6a758c3..941ce891f9 100644
--- a/fixtures/webstudio-features/app/__generated__/[content-block]._index.tsx
+++ b/fixtures/webstudio-features/app/__generated__/[content-block]._index.tsx
@@ -12,6 +12,12 @@ import {
export const siteName = "KittyGuardedZone";
+export const breakpoints = [
+ { id: "UoTkWyaFuTYJihS3MFYK5" },
+ { id: "ZMaWCtWpH-ao0e_kgIHqR", minWidth: 372 },
+ { id: "Z8WjyXWkCrr35PXgjHdpY", minWidth: 472 },
+];
+
export const favIconAsset: string | undefined =
"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";
diff --git a/fixtures/webstudio-features/app/__generated__/[expressions]._index.tsx b/fixtures/webstudio-features/app/__generated__/[expressions]._index.tsx
index a3ba855f71..dbef2d7130 100644
--- a/fixtures/webstudio-features/app/__generated__/[expressions]._index.tsx
+++ b/fixtures/webstudio-features/app/__generated__/[expressions]._index.tsx
@@ -12,6 +12,12 @@ import {
export const siteName = "KittyGuardedZone";
+export const breakpoints = [
+ { id: "UoTkWyaFuTYJihS3MFYK5" },
+ { id: "ZMaWCtWpH-ao0e_kgIHqR", minWidth: 372 },
+ { id: "Z8WjyXWkCrr35PXgjHdpY", minWidth: 472 },
+];
+
export const favIconAsset: string | undefined =
"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";
diff --git a/fixtures/webstudio-features/app/__generated__/[form]._index.tsx b/fixtures/webstudio-features/app/__generated__/[form]._index.tsx
index 12c8d0c3cc..a5bf1fe3fd 100644
--- a/fixtures/webstudio-features/app/__generated__/[form]._index.tsx
+++ b/fixtures/webstudio-features/app/__generated__/[form]._index.tsx
@@ -17,6 +17,12 @@ import {
export const siteName = "KittyGuardedZone";
+export const breakpoints = [
+ { id: "UoTkWyaFuTYJihS3MFYK5" },
+ { id: "ZMaWCtWpH-ao0e_kgIHqR", minWidth: 372 },
+ { id: "Z8WjyXWkCrr35PXgjHdpY", minWidth: 472 },
+];
+
export const favIconAsset: string | undefined =
"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";
diff --git a/fixtures/webstudio-features/app/__generated__/[head-tag]._index.tsx b/fixtures/webstudio-features/app/__generated__/[head-tag]._index.tsx
index 340264fb4b..b934227b05 100644
--- a/fixtures/webstudio-features/app/__generated__/[head-tag]._index.tsx
+++ b/fixtures/webstudio-features/app/__generated__/[head-tag]._index.tsx
@@ -17,6 +17,12 @@ import {
export const siteName = "KittyGuardedZone";
+export const breakpoints = [
+ { id: "UoTkWyaFuTYJihS3MFYK5" },
+ { id: "ZMaWCtWpH-ao0e_kgIHqR", minWidth: 372 },
+ { id: "Z8WjyXWkCrr35PXgjHdpY", minWidth: 472 },
+];
+
export const favIconAsset: string | undefined =
"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";
diff --git a/fixtures/webstudio-features/app/__generated__/[heading-with-id]._index.tsx b/fixtures/webstudio-features/app/__generated__/[heading-with-id]._index.tsx
index 93cddfc1fe..040bdef724 100644
--- a/fixtures/webstudio-features/app/__generated__/[heading-with-id]._index.tsx
+++ b/fixtures/webstudio-features/app/__generated__/[heading-with-id]._index.tsx
@@ -8,6 +8,12 @@ import { Heading as Heading } from "@webstudio-is/sdk-components-react";
export const siteName = "KittyGuardedZone";
+export const breakpoints = [
+ { id: "UoTkWyaFuTYJihS3MFYK5" },
+ { id: "ZMaWCtWpH-ao0e_kgIHqR", minWidth: 372 },
+ { id: "Z8WjyXWkCrr35PXgjHdpY", minWidth: 472 },
+];
+
export const favIconAsset: string | undefined =
"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";
diff --git a/fixtures/webstudio-features/app/__generated__/[nested].[nested-page]._index.tsx b/fixtures/webstudio-features/app/__generated__/[nested].[nested-page]._index.tsx
index f636f4c6d8..0fb38e1f4e 100644
--- a/fixtures/webstudio-features/app/__generated__/[nested].[nested-page]._index.tsx
+++ b/fixtures/webstudio-features/app/__generated__/[nested].[nested-page]._index.tsx
@@ -8,6 +8,12 @@ import { Heading as Heading } from "@webstudio-is/sdk-components-react";
export const siteName = "KittyGuardedZone";
+export const breakpoints = [
+ { id: "UoTkWyaFuTYJihS3MFYK5" },
+ { id: "ZMaWCtWpH-ao0e_kgIHqR", minWidth: 372 },
+ { id: "Z8WjyXWkCrr35PXgjHdpY", minWidth: 472 },
+];
+
export const favIconAsset: string | undefined =
"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";
diff --git a/fixtures/webstudio-features/app/__generated__/[radix]._index.tsx b/fixtures/webstudio-features/app/__generated__/[radix]._index.tsx
index 4f37dcd3cf..4d7f9ebe2d 100644
--- a/fixtures/webstudio-features/app/__generated__/[radix]._index.tsx
+++ b/fixtures/webstudio-features/app/__generated__/[radix]._index.tsx
@@ -19,6 +19,12 @@ import {
export const siteName = "KittyGuardedZone";
+export const breakpoints = [
+ { id: "UoTkWyaFuTYJihS3MFYK5" },
+ { id: "ZMaWCtWpH-ao0e_kgIHqR", minWidth: 372 },
+ { id: "Z8WjyXWkCrr35PXgjHdpY", minWidth: 472 },
+];
+
export const favIconAsset: string | undefined =
"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";
diff --git a/fixtures/webstudio-features/app/__generated__/[resources]._index.tsx b/fixtures/webstudio-features/app/__generated__/[resources]._index.tsx
index 4713f03c76..c4429aab08 100644
--- a/fixtures/webstudio-features/app/__generated__/[resources]._index.tsx
+++ b/fixtures/webstudio-features/app/__generated__/[resources]._index.tsx
@@ -11,6 +11,12 @@ import {
export const siteName = "KittyGuardedZone";
+export const breakpoints = [
+ { id: "UoTkWyaFuTYJihS3MFYK5" },
+ { id: "ZMaWCtWpH-ao0e_kgIHqR", minWidth: 372 },
+ { id: "Z8WjyXWkCrr35PXgjHdpY", minWidth: 472 },
+];
+
export const favIconAsset: string | undefined =
"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";
diff --git a/fixtures/webstudio-features/app/__generated__/[sitemap.xml]._index.tsx b/fixtures/webstudio-features/app/__generated__/[sitemap.xml]._index.tsx
index e7d6aba737..091eb29ef4 100644
--- a/fixtures/webstudio-features/app/__generated__/[sitemap.xml]._index.tsx
+++ b/fixtures/webstudio-features/app/__generated__/[sitemap.xml]._index.tsx
@@ -10,6 +10,12 @@ import {
export const siteName = "KittyGuardedZone";
+export const breakpoints = [
+ { id: "UoTkWyaFuTYJihS3MFYK5" },
+ { id: "ZMaWCtWpH-ao0e_kgIHqR", minWidth: 372 },
+ { id: "Z8WjyXWkCrr35PXgjHdpY", minWidth: 472 },
+];
+
export const favIconAsset: string | undefined =
"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";
diff --git a/fixtures/webstudio-features/app/__generated__/_index.tsx b/fixtures/webstudio-features/app/__generated__/_index.tsx
index e49be5e632..0a439c1273 100644
--- a/fixtures/webstudio-features/app/__generated__/_index.tsx
+++ b/fixtures/webstudio-features/app/__generated__/_index.tsx
@@ -17,6 +17,12 @@ import {
export const siteName = "KittyGuardedZone";
+export const breakpoints = [
+ { id: "UoTkWyaFuTYJihS3MFYK5" },
+ { id: "ZMaWCtWpH-ao0e_kgIHqR", minWidth: 372 },
+ { id: "Z8WjyXWkCrr35PXgjHdpY", minWidth: 472 },
+];
+
export const favIconAsset: string | undefined =
"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";
diff --git a/fixtures/webstudio-features/app/routes/[_route_with_symbols_]._index.tsx b/fixtures/webstudio-features/app/routes/[_route_with_symbols_]._index.tsx
index ad1cf82b28..377bce7d68 100644
--- a/fixtures/webstudio-features/app/routes/[_route_with_symbols_]._index.tsx
+++ b/fixtures/webstudio-features/app/routes/[_route_with_symbols_]._index.tsx
@@ -27,6 +27,7 @@ import {
favIconAsset,
pageFontAssets,
pageBackgroundImageAssets,
+ breakpoints,
} from "../__generated__/[_route_with_symbols_]._index";
import {
getResources,
@@ -272,6 +273,7 @@ const Outlet = () => {
imageLoader,
assetBaseUrl,
resources,
+ breakpoints,
}}
>
{/* Use the URL as the key to force scripts in HTML Embed to reload on dynamic pages */}
diff --git a/fixtures/webstudio-features/app/routes/[animations]._index.tsx b/fixtures/webstudio-features/app/routes/[animations]._index.tsx
index 60ead01f20..867d8184bc 100644
--- a/fixtures/webstudio-features/app/routes/[animations]._index.tsx
+++ b/fixtures/webstudio-features/app/routes/[animations]._index.tsx
@@ -27,6 +27,7 @@ import {
favIconAsset,
pageFontAssets,
pageBackgroundImageAssets,
+ breakpoints,
} from "../__generated__/[animations]._index";
import {
getResources,
@@ -272,6 +273,7 @@ const Outlet = () => {
imageLoader,
assetBaseUrl,
resources,
+ breakpoints,
}}
>
{/* Use the URL as the key to force scripts in HTML Embed to reload on dynamic pages */}
diff --git a/fixtures/webstudio-features/app/routes/[class-names]._index.tsx b/fixtures/webstudio-features/app/routes/[class-names]._index.tsx
index f935be1d30..4dbbb0c185 100644
--- a/fixtures/webstudio-features/app/routes/[class-names]._index.tsx
+++ b/fixtures/webstudio-features/app/routes/[class-names]._index.tsx
@@ -27,6 +27,7 @@ import {
favIconAsset,
pageFontAssets,
pageBackgroundImageAssets,
+ breakpoints,
} from "../__generated__/[class-names]._index";
import {
getResources,
@@ -272,6 +273,7 @@ const Outlet = () => {
imageLoader,
assetBaseUrl,
resources,
+ breakpoints,
}}
>
{/* Use the URL as the key to force scripts in HTML Embed to reload on dynamic pages */}
diff --git a/fixtures/webstudio-features/app/routes/[content-block]._index.tsx b/fixtures/webstudio-features/app/routes/[content-block]._index.tsx
index 4059b7aaaf..fa5b1c5555 100644
--- a/fixtures/webstudio-features/app/routes/[content-block]._index.tsx
+++ b/fixtures/webstudio-features/app/routes/[content-block]._index.tsx
@@ -27,6 +27,7 @@ import {
favIconAsset,
pageFontAssets,
pageBackgroundImageAssets,
+ breakpoints,
} from "../__generated__/[content-block]._index";
import {
getResources,
@@ -272,6 +273,7 @@ const Outlet = () => {
imageLoader,
assetBaseUrl,
resources,
+ breakpoints,
}}
>
{/* Use the URL as the key to force scripts in HTML Embed to reload on dynamic pages */}
diff --git a/fixtures/webstudio-features/app/routes/[expressions]._index.tsx b/fixtures/webstudio-features/app/routes/[expressions]._index.tsx
index b5b1a9ff3f..52b7bf57c4 100644
--- a/fixtures/webstudio-features/app/routes/[expressions]._index.tsx
+++ b/fixtures/webstudio-features/app/routes/[expressions]._index.tsx
@@ -27,6 +27,7 @@ import {
favIconAsset,
pageFontAssets,
pageBackgroundImageAssets,
+ breakpoints,
} from "../__generated__/[expressions]._index";
import {
getResources,
@@ -272,6 +273,7 @@ const Outlet = () => {
imageLoader,
assetBaseUrl,
resources,
+ breakpoints,
}}
>
{/* Use the URL as the key to force scripts in HTML Embed to reload on dynamic pages */}
diff --git a/fixtures/webstudio-features/app/routes/[form]._index.tsx b/fixtures/webstudio-features/app/routes/[form]._index.tsx
index 55e7a6e02e..7475eb2e49 100644
--- a/fixtures/webstudio-features/app/routes/[form]._index.tsx
+++ b/fixtures/webstudio-features/app/routes/[form]._index.tsx
@@ -27,6 +27,7 @@ import {
favIconAsset,
pageFontAssets,
pageBackgroundImageAssets,
+ breakpoints,
} from "../__generated__/[form]._index";
import {
getResources,
@@ -272,6 +273,7 @@ const Outlet = () => {
imageLoader,
assetBaseUrl,
resources,
+ breakpoints,
}}
>
{/* Use the URL as the key to force scripts in HTML Embed to reload on dynamic pages */}
diff --git a/fixtures/webstudio-features/app/routes/[head-tag]._index.tsx b/fixtures/webstudio-features/app/routes/[head-tag]._index.tsx
index 5ac97ec184..bec8de81b9 100644
--- a/fixtures/webstudio-features/app/routes/[head-tag]._index.tsx
+++ b/fixtures/webstudio-features/app/routes/[head-tag]._index.tsx
@@ -27,6 +27,7 @@ import {
favIconAsset,
pageFontAssets,
pageBackgroundImageAssets,
+ breakpoints,
} from "../__generated__/[head-tag]._index";
import {
getResources,
@@ -272,6 +273,7 @@ const Outlet = () => {
imageLoader,
assetBaseUrl,
resources,
+ breakpoints,
}}
>
{/* Use the URL as the key to force scripts in HTML Embed to reload on dynamic pages */}
diff --git a/fixtures/webstudio-features/app/routes/[heading-with-id]._index.tsx b/fixtures/webstudio-features/app/routes/[heading-with-id]._index.tsx
index 9137ef842d..bb21b0d26b 100644
--- a/fixtures/webstudio-features/app/routes/[heading-with-id]._index.tsx
+++ b/fixtures/webstudio-features/app/routes/[heading-with-id]._index.tsx
@@ -27,6 +27,7 @@ import {
favIconAsset,
pageFontAssets,
pageBackgroundImageAssets,
+ breakpoints,
} from "../__generated__/[heading-with-id]._index";
import {
getResources,
@@ -272,6 +273,7 @@ const Outlet = () => {
imageLoader,
assetBaseUrl,
resources,
+ breakpoints,
}}
>
{/* Use the URL as the key to force scripts in HTML Embed to reload on dynamic pages */}
diff --git a/fixtures/webstudio-features/app/routes/[nested].[nested-page]._index.tsx b/fixtures/webstudio-features/app/routes/[nested].[nested-page]._index.tsx
index 96d97fac8a..6c384bf357 100644
--- a/fixtures/webstudio-features/app/routes/[nested].[nested-page]._index.tsx
+++ b/fixtures/webstudio-features/app/routes/[nested].[nested-page]._index.tsx
@@ -27,6 +27,7 @@ import {
favIconAsset,
pageFontAssets,
pageBackgroundImageAssets,
+ breakpoints,
} from "../__generated__/[nested].[nested-page]._index";
import {
getResources,
@@ -272,6 +273,7 @@ const Outlet = () => {
imageLoader,
assetBaseUrl,
resources,
+ breakpoints,
}}
>
{/* Use the URL as the key to force scripts in HTML Embed to reload on dynamic pages */}
diff --git a/fixtures/webstudio-features/app/routes/[radix]._index.tsx b/fixtures/webstudio-features/app/routes/[radix]._index.tsx
index 7368832976..b94d2eb354 100644
--- a/fixtures/webstudio-features/app/routes/[radix]._index.tsx
+++ b/fixtures/webstudio-features/app/routes/[radix]._index.tsx
@@ -27,6 +27,7 @@ import {
favIconAsset,
pageFontAssets,
pageBackgroundImageAssets,
+ breakpoints,
} from "../__generated__/[radix]._index";
import {
getResources,
@@ -272,6 +273,7 @@ const Outlet = () => {
imageLoader,
assetBaseUrl,
resources,
+ breakpoints,
}}
>
{/* Use the URL as the key to force scripts in HTML Embed to reload on dynamic pages */}
diff --git a/fixtures/webstudio-features/app/routes/[resources]._index.tsx b/fixtures/webstudio-features/app/routes/[resources]._index.tsx
index e128e619aa..8d5098e0b4 100644
--- a/fixtures/webstudio-features/app/routes/[resources]._index.tsx
+++ b/fixtures/webstudio-features/app/routes/[resources]._index.tsx
@@ -27,6 +27,7 @@ import {
favIconAsset,
pageFontAssets,
pageBackgroundImageAssets,
+ breakpoints,
} from "../__generated__/[resources]._index";
import {
getResources,
@@ -272,6 +273,7 @@ const Outlet = () => {
imageLoader,
assetBaseUrl,
resources,
+ breakpoints,
}}
>
{/* Use the URL as the key to force scripts in HTML Embed to reload on dynamic pages */}
diff --git a/fixtures/webstudio-features/app/routes/[sitemap.xml]._index.tsx b/fixtures/webstudio-features/app/routes/[sitemap.xml]._index.tsx
index 862a0c3733..4f16ea7a46 100644
--- a/fixtures/webstudio-features/app/routes/[sitemap.xml]._index.tsx
+++ b/fixtures/webstudio-features/app/routes/[sitemap.xml]._index.tsx
@@ -5,7 +5,7 @@ import {
ReactSdkContext,
xmlNodeTagSuffix,
} from "@webstudio-is/react-sdk/runtime";
-import { Page } from "../__generated__/[sitemap.xml]._index";
+import { Page, breakpoints } from "../__generated__/[sitemap.xml]._index";
import {
getPageMeta,
getRemixParams,
@@ -69,6 +69,7 @@ export const loader = async (arg: LoaderFunctionArgs) => {
imageLoader,
assetBaseUrl,
resources,
+ breakpoints,
}}
>
<Page system={system} />
diff --git a/fixtures/webstudio-features/app/routes/_index.tsx b/fixtures/webstudio-features/app/routes/_index.tsx
index fbb3ae46b8..dd294abfe9 100644
--- a/fixtures/webstudio-features/app/routes/_index.tsx
+++ b/fixtures/webstudio-features/app/routes/_index.tsx
@@ -27,6 +27,7 @@ import {
favIconAsset,
pageFontAssets,
pageBackgroundImageAssets,
+ breakpoints,
} from "../__generated__/_index";
import {
getResources,
@@ -272,6 +273,7 @@ const Outlet = () => {
imageLoader,
assetBaseUrl,
resources,
+ breakpoints,
}}
>
{/* Use the URL as the key to force scripts in HTML Embed to reload on dynamic pages */}
diff --git a/packages/cli/package.json b/packages/cli/package.json
index 57c32bf8fe..f4c234ae30 100644
--- a/packages/cli/package.json
+++ b/packages/cli/package.json
@@ -66,6 +66,7 @@
"@webstudio-is/image": "workspace:*",
"@webstudio-is/react-sdk": "workspace:*",
"@webstudio-is/sdk": "workspace:*",
+ "@webstudio-is/css-engine": "workspace:*",
"@webstudio-is/sdk-components-animation": "workspace:*",
"@webstudio-is/sdk-components-react": "workspace:*",
"@webstudio-is/sdk-components-react-radix": "workspace:*",
diff --git a/packages/cli/src/prebuild.ts b/packages/cli/src/prebuild.ts
index dcfc94c4a8..8abe4f74a1 100644
--- a/packages/cli/src/prebuild.ts
+++ b/packages/cli/src/prebuild.ts
@@ -59,6 +59,7 @@ import { htmlToJsx } from "./html-to-jsx";
import { createFramework as createRemixFramework } from "./framework-remix";
import { createFramework as createReactRouterFramework } from "./framework-react-router";
import { createFramework as createVikeSsgFramework } from "./framework-vike-ssg";
+import { compareMedia } from "@webstudio-is/css-engine";
const limit = pLimit(10);
@@ -597,6 +598,14 @@ export const prebuild = async (options: {
const pagePath = getPagePath(page.id, siteData.build.pages);
+ const breakpoints = siteData.build.breakpoints
+ .map(([_, value]) => ({
+ id: value.id,
+ minWidth: value.minWidth,
+ maxWidth: value.maxWidth,
+ }))
+ .sort(compareMedia);
+
// MARK: - TODO: XML GENERATION
const pageExports = `/* eslint-disable */
/* This is a auto generated file for building the project */ \n
@@ -607,6 +616,8 @@ export const prebuild = async (options: {
export const siteName = ${JSON.stringify(projectMeta?.siteName)};
+ export const breakpoints = ${JSON.stringify(breakpoints)};
+
export const favIconAsset: string | undefined =
${JSON.stringify(favIconAsset)};
diff --git a/packages/cli/templates/defaults/app/route-templates/html.tsx b/packages/cli/templates/defaults/app/route-templates/html.tsx
index 58beeac5a3..ddc26948c7 100644
--- a/packages/cli/templates/defaults/app/route-templates/html.tsx
+++ b/packages/cli/templates/defaults/app/route-templates/html.tsx
@@ -28,6 +28,7 @@ import {
favIconAsset,
pageFontAssets,
pageBackgroundImageAssets,
+ breakpoints,
} from "__CLIENT__";
import {
getResources,
@@ -273,6 +274,7 @@ const Outlet = () => {
imageLoader,
assetBaseUrl,
resources,
+ breakpoints,
}}
>
{/* Use the URL as the key to force scripts in HTML Embed to reload on dynamic pages */}
diff --git a/packages/cli/templates/defaults/app/route-templates/xml.tsx b/packages/cli/templates/defaults/app/route-templates/xml.tsx
index 9d0bd38f1a..35bc3f4f13 100644
--- a/packages/cli/templates/defaults/app/route-templates/xml.tsx
+++ b/packages/cli/templates/defaults/app/route-templates/xml.tsx
@@ -5,7 +5,7 @@ import {
ReactSdkContext,
xmlNodeTagSuffix,
} from "@webstudio-is/react-sdk/runtime";
-import { Page } from "__CLIENT__";
+import { Page, breakpoints } from "__CLIENT__";
import { getPageMeta, getRemixParams, getResources } from "__SERVER__";
import { assetBaseUrl, imageLoader } from "__CONSTANTS__";
import { sitemap } from "__SITEMAP__";
@@ -65,6 +65,7 @@ export const loader = async (arg: LoaderFunctionArgs) => {
imageLoader,
assetBaseUrl,
resources,
+ breakpoints,
}}
>
<Page system={system} />
diff --git a/packages/cli/templates/react-router/app/route-templates/html.tsx b/packages/cli/templates/react-router/app/route-templates/html.tsx
index 39be97fc53..faeda66645 100644
--- a/packages/cli/templates/react-router/app/route-templates/html.tsx
+++ b/packages/cli/templates/react-router/app/route-templates/html.tsx
@@ -27,6 +27,7 @@ import {
favIconAsset,
pageFontAssets,
pageBackgroundImageAssets,
+ breakpoints,
} from "__CLIENT__";
import {
getResources,
@@ -272,6 +273,7 @@ const Outlet = () => {
imageLoader,
assetBaseUrl,
resources,
+ breakpoints,
}}
>
{/* Use the URL as the key to force scripts in HTML Embed to reload on dynamic pages */}
diff --git a/packages/cli/templates/react-router/app/route-templates/xml.tsx b/packages/cli/templates/react-router/app/route-templates/xml.tsx
index f48c4d2856..dc1103685e 100644
--- a/packages/cli/templates/react-router/app/route-templates/xml.tsx
+++ b/packages/cli/templates/react-router/app/route-templates/xml.tsx
@@ -5,7 +5,7 @@ import {
ReactSdkContext,
xmlNodeTagSuffix,
} from "@webstudio-is/react-sdk/runtime";
-import { Page } from "__CLIENT__";
+import { Page, breakpoints } from "__CLIENT__";
import { getPageMeta, getRemixParams, getResources } from "__SERVER__";
import { assetBaseUrl, imageLoader } from "__CONSTANTS__";
import { sitemap } from "__SITEMAP__";
@@ -65,6 +65,7 @@ export const loader = async (arg: LoaderFunctionArgs) => {
imageLoader,
assetBaseUrl,
resources,
+ breakpoints,
}}
>
<Page system={system} />
diff --git a/packages/cli/templates/ssg/app/route-templates/html/+Page.tsx b/packages/cli/templates/ssg/app/route-templates/html/+Page.tsx
index 4a8a6c440c..6a2a12eaf6 100644
--- a/packages/cli/templates/ssg/app/route-templates/html/+Page.tsx
+++ b/packages/cli/templates/ssg/app/route-templates/html/+Page.tsx
@@ -1,7 +1,7 @@
import type { PageContext } from "vike/types";
import { ReactSdkContext } from "@webstudio-is/react-sdk/runtime";
import { assetBaseUrl, imageLoader } from "__CONSTANTS__";
-import { Page } from "__CLIENT__";
+import { Page, breakpoints } from "__CLIENT__";
const PageComponent = ({ data }: { data: PageContext["data"] }) => {
const { system, resources, url } = data;
@@ -11,6 +11,7 @@ const PageComponent = ({ data }: { data: PageContext["data"] }) => {
imageLoader,
assetBaseUrl,
resources,
+ breakpoints,
}}
>
{/* Use the URL as the key to force scripts in HTML Embed to reload on dynamic pages */}
diff --git a/packages/react-sdk/placeholder.d.ts b/packages/react-sdk/placeholder.d.ts
index 3bd6ab0110..972b3004fb 100644
--- a/packages/react-sdk/placeholder.d.ts
+++ b/packages/react-sdk/placeholder.d.ts
@@ -11,6 +11,12 @@ declare module "__CLIENT__" {
export const favIconAsset: string | undefined;
+ export const breakpoints: {
+ id: string;
+ minWidth?: number;
+ maxWidth?: number;
+ }[];
+
// Font assets on current page (can be preloaded)
export const pageFontAssets: string[];
diff --git a/packages/react-sdk/src/context.tsx b/packages/react-sdk/src/context.tsx
index f5607bb190..f7b0816a01 100644
--- a/packages/react-sdk/src/context.tsx
+++ b/packages/react-sdk/src/context.tsx
@@ -32,11 +32,13 @@ export const ReactSdkContext = createContext<
// resources need to be any to support accessing unknown fields without extra checks
// eslint-disable-next-line @typescript-eslint/no-explicit-any
resources: Record<string, any>;
+ breakpoints: { id: string; minWidth?: number; maxWidth?: number }[];
}
>({
assetBaseUrl: "/",
imageLoader: ({ src }) => src,
resources: {},
+ breakpoints: [],
});
export const useResource = (name: string) => {
diff --git a/packages/sdk-components-animation/private-src b/packages/sdk-components-animation/private-src
index 3b74f0aca3..9c747258d2 160000
--- a/packages/sdk-components-animation/private-src
+++ b/packages/sdk-components-animation/private-src
@@ -1 +1 @@
-Subproject commit 3b74f0aca33d2ccad4880e0ca92f20a8392e90d1
+Subproject commit 9c747258d2a6a9700a5ea70f303a0ff83b20669b
diff --git a/packages/sdk-components-react/src/html-embed.test.tsx b/packages/sdk-components-react/src/html-embed.test.tsx
index d32ac587aa..48086b9f24 100644
--- a/packages/sdk-components-react/src/html-embed.test.tsx
+++ b/packages/sdk-components-react/src/html-embed.test.tsx
@@ -35,6 +35,7 @@ const App = (props: {
imageLoader: () => "",
renderer: props.renderer,
resources: {},
+ breakpoints: [],
}}
>
<div key={page}>
@@ -281,6 +282,7 @@ describe("Builder renderer= canvas | preview", () => {
imageLoader: () => "",
renderer: "canvas",
resources: {},
+ breakpoints: [],
}}
>
<HtmlEmbed code={code} executeScriptOnCanvas={true} />
diff --git a/packages/sdk-components-react/src/xml-node.stories.tsx b/packages/sdk-components-react/src/xml-node.stories.tsx
index 75bc0e256a..ea0475de04 100644
--- a/packages/sdk-components-react/src/xml-node.stories.tsx
+++ b/packages/sdk-components-react/src/xml-node.stories.tsx
@@ -9,6 +9,7 @@ const Component = () => {
assetBaseUrl: "/",
imageLoader: ({ src }) => src,
resources: {},
+ breakpoints: [],
}}
>
<XmlNode tag="root">
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index ca8a4e9a3e..5193fc5240 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -1126,6 +1126,9 @@ importers:
'@vitejs/plugin-react':
specifier: ^4.3.4
version: 4.3.4([email protected](@types/[email protected]))
+ '@webstudio-is/css-engine':
+ specifier: workspace:*
+ version: link:../css-engine
'@webstudio-is/http-client':
specifier: workspace:*
version: link:../http-client