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: Allow styling staggering and text animations (#5135)

Ivan Starkov0e5d4f739e33
diff --git a/fixtures/webstudio-features/app/__generated__/[animations]._index.tsx b/fixtures/webstudio-features/app/__generated__/[animations]._index.tsx
index 39c4c71f49..98b20e7fd5 100644
--- a/fixtures/webstudio-features/app/__generated__/[animations]._index.tsx
+++ b/fixtures/webstudio-features/app/__generated__/[animations]._index.tsx
@@ -276,7 +276,7 @@ const Page = (_props: { system: any }) => {
isPinned: false,
}}
>
- <AnimateText slidingWindow={20}>
+ <AnimateText slidingWindow={20} className={`w-text-animation`}>
<Heading className={`w-heading c1pdroxx`}>
{"ANIMATED CHILD 1"}
</Heading>
diff --git a/fixtures/webstudio-features/app/__generated__/[text-duration]._index.tsx b/fixtures/webstudio-features/app/__generated__/[text-duration]._index.tsx
index 75b0d3a184..f46671b998 100644
--- a/fixtures/webstudio-features/app/__generated__/[text-duration]._index.tsx
+++ b/fixtures/webstudio-features/app/__generated__/[text-duration]._index.tsx
@@ -86,7 +86,7 @@ const Page = (_props: { system: any }) => {
debug: false,
}}
>
- <AnimateText>
+ <AnimateText className={`w-text-animation`}>
<Heading className={`w-heading cjib6ds`}>
{"HELLO WORLD"}
{""}
diff --git a/fixtures/webstudio-features/app/__generated__/index.css b/fixtures/webstudio-features/app/__generated__/index.css
index a52d0ec6a6..6a94668cb0 100644
--- a/fixtures/webstudio-features/app/__generated__/index.css
+++ b/fixtures/webstudio-features/app/__generated__/index.css
@@ -179,6 +179,14 @@
text-transform: none;
margin: 0;
}
+ div.w-text-animation {
+ box-sizing: border-box;
+ border-top-width: 1px;
+ border-right-width: 1px;
+ border-bottom-width: 1px;
+ border-left-width: 1px;
+ outline-width: 1px;
+ }
}
@media all {
.ceva767 {
diff --git a/packages/sdk-components-animation/private-src b/packages/sdk-components-animation/private-src
index 0ed6ac0869..49cbd49615 160000
--- a/packages/sdk-components-animation/private-src
+++ b/packages/sdk-components-animation/private-src
@@ -1 +1 @@
-Subproject commit 0ed6ac0869eb315433c6f0f6724c9f4ab19ff43a
+Subproject commit 49cbd49615280279ac066eb91e22f23d2a27098c
diff --git a/packages/sdk-components-animation/src/animate-text.tsx b/packages/sdk-components-animation/src/animate-text.tsx
index 2d82c944f5..e8547345b4 100644
--- a/packages/sdk-components-animation/src/animate-text.tsx
+++ b/packages/sdk-components-animation/src/animate-text.tsx
@@ -40,6 +40,8 @@ type AnimateChildrenProps = {
* Defines how the text is split for animation (e.g., by character, space, or symbol).
*/
splitBy?: keyof typeof split;
+} & {
+ className?: string;
};
export const AnimateText = forwardRef<ElementRef<"div">, AnimateChildrenProps>(
diff --git a/packages/sdk-components-animation/src/animate-text.ws.ts b/packages/sdk-components-animation/src/animate-text.ws.ts
index ce8dfb9ebd..43841609b0 100644
--- a/packages/sdk-components-animation/src/animate-text.ws.ts
+++ b/packages/sdk-components-animation/src/animate-text.ws.ts
@@ -2,6 +2,7 @@ import { TextAnimationIcon } from "@webstudio-is/icons/svg";
import type { WsComponentMeta, WsComponentPropsMeta } from "@webstudio-is/sdk";
import { animation } from "./shared/meta";
import { props } from "./__generated__/animate-text.props";
+import { div } from "@webstudio-is/sdk/normalize.css";
export const meta: WsComponentMeta = {
category: "animations",
@@ -18,6 +19,9 @@ export const meta: WsComponentMeta = {
text: false,
},
],
+ presetStyle: {
+ div,
+ },
};
export const propsMeta: WsComponentPropsMeta = {
diff --git a/packages/sdk-components-animation/src/stagger-animation.tsx b/packages/sdk-components-animation/src/stagger-animation.tsx
index e3ae0bca47..41c2a47c49 100644
--- a/packages/sdk-components-animation/src/stagger-animation.tsx
+++ b/packages/sdk-components-animation/src/stagger-animation.tsx
@@ -29,6 +29,8 @@ type StaggerAnimationProps = {
* Text content to animate.
*/
children: React.ReactNode;
+} & {
+ className?: string;
};
export const StaggerAnimation = forwardRef<
diff --git a/packages/sdk-components-animation/src/stagger-animation.ws.ts b/packages/sdk-components-animation/src/stagger-animation.ws.ts
index 8f3685f88e..7d598fe044 100644
--- a/packages/sdk-components-animation/src/stagger-animation.ws.ts
+++ b/packages/sdk-components-animation/src/stagger-animation.ws.ts
@@ -2,6 +2,7 @@ import { StaggerAnimationIcon } from "@webstudio-is/icons/svg";
import type { WsComponentMeta, WsComponentPropsMeta } from "@webstudio-is/sdk";
import { animation } from "./shared/meta";
import { props } from "./__generated__/stagger-animation.props";
+import { div } from "@webstudio-is/sdk/normalize.css";
export const meta: WsComponentMeta = {
category: "animations",
@@ -18,6 +19,9 @@ export const meta: WsComponentMeta = {
text: false,
},
],
+ presetStyle: {
+ div,
+ },
};
export const propsMeta: WsComponentPropsMeta = {