Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions apps/builder/app/builder/features/components/components.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,12 @@ const $metas = computed(
continue;
}

if (
isFeatureEnabled("animation") === false &&
name.endsWith(":AnimateText")
) {
continue;
}
// only set available components from component meta
availableComponents.add(name);
if (
Expand Down
4 changes: 3 additions & 1 deletion packages/sdk-components-animation/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,10 @@
"@webstudio-is/react-sdk": "workspace:*",
"@webstudio-is/sdk": "workspace:*",
"change-case": "^5.4.4",
"nanostores": "^0.11.3",
"react-error-boundary": "^5.0.0",
"scroll-timeline-polyfill": "^1.1.0"
"scroll-timeline-polyfill": "^1.1.0",
"shallow-equal": "^3.1.0"
},
"devDependencies": {
"@types/react": "^18.2.70",
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk-components-animation/private-src

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 29 additions & 0 deletions packages/sdk-components-animation/src/animate-text.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { forwardRef, type ElementRef } from "react";

const easings = {
linear: true,
easeIn: true,
easeInCubic: true,
easeInQuart: true,
easeOut: true,
easeOutCubic: true,
easeOutQuart: true,
ease: true,
easeInOutCubic: true,
easeInOutQuart: true,
};

type AnimateChildrenProps = {
charWindow: number;
easing: keyof typeof easings;
children: React.ReactNode;
};

export const AnimateText = forwardRef<ElementRef<"div">, AnimateChildrenProps>(
({ charWindow: _, easing: __, ...props }, ref) => {
return <div ref={ref} {...props} />;
}
);

const displayName = "AnimateText";
AnimateText.displayName = displayName;
17 changes: 17 additions & 0 deletions packages/sdk-components-animation/src/animate-text.ws.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { TextIcon } from "@webstudio-is/icons/svg";
import type { WsComponentMeta, WsComponentPropsMeta } from "@webstudio-is/sdk";
import { props } from "./__generated__/animate-text.props";

export const meta: WsComponentMeta = {
category: "general",
type: "container",
description: "Animate Text",
icon: TextIcon,
order: 6,
label: "Animate Text",
};

export const propsMeta: WsComponentPropsMeta = {
props,
initialProps: ["charWindow", "easing"],
};
1 change: 1 addition & 0 deletions packages/sdk-components-animation/src/components.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export { AnimateChildren } from "./animate-children";
export { AnimateText } from "./animate-text";
3 changes: 2 additions & 1 deletion packages/sdk-components-animation/src/metas.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export { meta as AnimateChildren } from "./scroll.ws";
export { meta as AnimateChildren } from "./animate-children.ws";
export { meta as AnimateText } from "./animate-text.ws";
3 changes: 2 additions & 1 deletion packages/sdk-components-animation/src/props.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export { propsMeta as AnimateChildren } from "./scroll.ws";
export { propsMeta as AnimateChildren } from "./animate-children.ws";
export { propsMeta as AnimateText } from "./animate-text.ws";
6 changes: 6 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.