@webstudio-is/sdk-components-animation 0.208.0 → 0.210.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,11 +1,6 @@
1
1
  const e = {
2
- charWindow: {
3
- required: !1,
4
- control: "number",
5
- type: "number",
6
- defaultValue: 5
7
- },
8
2
  easing: {
3
+ description: "Easing function applied within the sliding window.",
9
4
  required: !1,
10
5
  control: "select",
11
6
  type: "string",
@@ -22,6 +17,24 @@ const e = {
22
17
  "easeInOutCubic",
23
18
  "easeInOutQuart"
24
19
  ]
20
+ },
21
+ slidingWindow: {
22
+ description: `Size of the sliding window for the animation:
23
+ - 0: Typewriter effect (no animation).
24
+ - (0..1]: Animates one part of the text at a time.
25
+ - (1..n]: Animates multiple parts of the text within the sliding window.`,
26
+ required: !1,
27
+ control: "number",
28
+ type: "number",
29
+ defaultValue: 5
30
+ },
31
+ splitBy: {
32
+ description: "Defines how the text is split for animation (e.g., by character, space, or symbol).",
33
+ required: !1,
34
+ control: "select",
35
+ type: "string",
36
+ defaultValue: "char",
37
+ options: ["char", "space", 'symbol "#"', 'symbol "~"']
25
38
  }
26
39
  };
27
40
  export {
@@ -0,0 +1,34 @@
1
+ const e = {
2
+ easing: {
3
+ description: "Easing function applied within the sliding window.",
4
+ required: !1,
5
+ control: "select",
6
+ type: "string",
7
+ defaultValue: "linear",
8
+ options: [
9
+ "linear",
10
+ "easeIn",
11
+ "easeInCubic",
12
+ "easeInQuart",
13
+ "easeOut",
14
+ "easeOutCubic",
15
+ "easeOutQuart",
16
+ "ease",
17
+ "easeInOutCubic",
18
+ "easeInOutQuart"
19
+ ]
20
+ },
21
+ slidingWindow: {
22
+ description: `Size of the sliding window for the animation:
23
+ - 0: Typewriter effect (no animation).
24
+ - (0..1]: Animates one child at a time.
25
+ - (1..n]: Animates multiple children within the sliding window.`,
26
+ required: !1,
27
+ control: "number",
28
+ type: "number",
29
+ defaultValue: 1
30
+ }
31
+ };
32
+ export {
33
+ e as props
34
+ };
@@ -1,11 +1,15 @@
1
- import { SlotComponentIcon as n } from "@webstudio-is/icons/svg";
2
- const i = {
3
- category: "general",
1
+ import { AnimationGroupIcon as i } from "@webstudio-is/icons/svg";
2
+ const o = {
3
+ category: "animations",
4
4
  type: "container",
5
- description: "Animate Children",
6
- icon: n,
5
+ description: "Animation Group component is designed to animate its children.",
6
+ icon: i,
7
7
  order: 5,
8
- label: "Animate Children"
8
+ label: "Animation Group",
9
+ constraints: {
10
+ relation: "child",
11
+ text: !1
12
+ }
9
13
  }, t = {
10
14
  props: {
11
15
  action: {
@@ -18,6 +22,6 @@ const i = {
18
22
  initialProps: ["action"]
19
23
  };
20
24
  export {
21
- i as meta,
25
+ o as meta,
22
26
  t as propsMeta
23
27
  };
@@ -1,9 +1,9 @@
1
- import { jsx as a } from "react/jsx-runtime";
2
- import { forwardRef as i } from "react";
3
- const t = i(
4
- ({ charWindow: m = 5, easing: n = "linear", ...e }, r) => /* @__PURE__ */ a("div", { ref: r, ...e })
5
- ), o = "AnimateText";
6
- t.displayName = o;
1
+ import { jsx as r } from "react/jsx-runtime";
2
+ import { forwardRef as t } from "react";
3
+ const a = t(
4
+ ({ slidingWindow: o = 5, easing: m = "linear", splitBy: s = "char", ...i }, e) => /* @__PURE__ */ r("div", { ref: e, ...i })
5
+ ), n = "AnimateText";
6
+ a.displayName = n;
7
7
  export {
8
- t as AnimateText
8
+ a as AnimateText
9
9
  };
@@ -1,17 +1,25 @@
1
- import { TextIcon as e } from "@webstudio-is/icons/svg";
2
- import { props as o } from "./__generated__/animate-text.props.js";
3
- const i = {
4
- category: "general",
1
+ import { TextAnimationIcon as t } from "@webstudio-is/icons/svg";
2
+ import { animation as o } from "./shared/meta.js";
3
+ import { props as i } from "./__generated__/animate-text.props.js";
4
+ const r = {
5
+ category: "animations",
5
6
  type: "container",
6
- description: "Animate Text",
7
- icon: e,
7
+ description: "Text animation allows you to split text by char or by word to animate it.",
8
+ icon: t,
8
9
  order: 6,
9
- label: "Animate Text"
10
- }, n = {
11
- props: o,
12
- initialProps: ["charWindow", "easing"]
10
+ label: "Text Animation",
11
+ constraints: [
12
+ { relation: "parent", component: { $eq: o.AnimateChildren } },
13
+ {
14
+ relation: "child",
15
+ text: !1
16
+ }
17
+ ]
18
+ }, m = {
19
+ props: i,
20
+ initialProps: ["slidingWindow", "easing", "splitBy"]
13
21
  };
14
22
  export {
15
- i as meta,
16
- n as propsMeta
23
+ r as meta,
24
+ m as propsMeta
17
25
  };
package/lib/components.js CHANGED
@@ -1,6 +1,8 @@
1
1
  import { AnimateChildren as t } from "./animate-children.js";
2
- import { AnimateText as o } from "./animate-text.js";
2
+ import { AnimateText as m } from "./animate-text.js";
3
+ import { StaggerAnimation as n } from "./stagger-animation.js";
3
4
  export {
4
5
  t as AnimateChildren,
5
- o as AnimateText
6
+ m as AnimateText,
7
+ n as StaggerAnimation
6
8
  };
package/lib/metas.js CHANGED
@@ -1,6 +1,8 @@
1
1
  import { meta as a } from "./animate-children.ws.js";
2
2
  import { meta as r } from "./animate-text.ws.js";
3
+ import { meta as i } from "./stagger-animation.ws.js";
3
4
  export {
4
5
  a as AnimateChildren,
5
- r as AnimateText
6
+ r as AnimateText,
7
+ i as StaggerAnimation
6
8
  };
package/lib/props.js CHANGED
@@ -1,6 +1,8 @@
1
1
  import { propsMeta as t } from "./animate-children.ws.js";
2
2
  import { propsMeta as o } from "./animate-text.ws.js";
3
+ import { propsMeta as m } from "./stagger-animation.ws.js";
3
4
  export {
4
5
  t as AnimateChildren,
5
- o as AnimateText
6
+ o as AnimateText,
7
+ m as StaggerAnimation
6
8
  };
@@ -0,0 +1,13 @@
1
+ const n = (t) => new Proxy(
2
+ {},
3
+ {
4
+ get(o, e) {
5
+ return `${t}${e}`;
6
+ }
7
+ }
8
+ ), r = n(
9
+ "@webstudio-is/sdk-components-animation:"
10
+ );
11
+ export {
12
+ r as animation
13
+ };
@@ -0,0 +1,7 @@
1
+ import { jsx as a } from "react/jsx-runtime";
2
+ import { forwardRef as n } from "react";
3
+ const o = n(({ slidingWindow: e = 1, easing: m = "linear", ...i }, r) => /* @__PURE__ */ a("div", { ref: r, ...i })), t = "StaggerAnimation";
4
+ o.displayName = t;
5
+ export {
6
+ o as StaggerAnimation
7
+ };
@@ -0,0 +1,25 @@
1
+ import { StaggerAnimationIcon as i } from "@webstudio-is/icons/svg";
2
+ import { animation as n } from "./shared/meta.js";
3
+ import { props as t } from "./__generated__/stagger-animation.props.js";
4
+ const r = {
5
+ category: "animations",
6
+ type: "container",
7
+ description: "Stagger animation allows you to animate children elements with a sliding window.",
8
+ icon: i,
9
+ order: 6,
10
+ label: "Stagger Animation",
11
+ constraints: [
12
+ { relation: "parent", component: { $eq: n.AnimateChildren } },
13
+ {
14
+ relation: "child",
15
+ text: !1
16
+ }
17
+ ]
18
+ }, m = {
19
+ props: t,
20
+ initialProps: ["slidingWindow", "easing"]
21
+ };
22
+ export {
23
+ r as meta,
24
+ m as propsMeta
25
+ };
@@ -0,0 +1,2 @@
1
+ import type { PropMeta } from "@webstudio-is/sdk";
2
+ export declare const props: Record<string, PropMeta>;
@@ -10,10 +10,32 @@ declare const easings: {
10
10
  easeInOutCubic: boolean;
11
11
  easeInOutQuart: boolean;
12
12
  };
13
+ declare const split: {
14
+ char: boolean;
15
+ space: boolean;
16
+ 'symbol "#"': boolean;
17
+ 'symbol "~"': boolean;
18
+ };
13
19
  type AnimateChildrenProps = {
14
- charWindow?: number;
20
+ /**
21
+ * Size of the sliding window for the animation:
22
+ * - 0: Typewriter effect (no animation).
23
+ * - (0..1]: Animates one part of the text at a time.
24
+ * - (1..n]: Animates multiple parts of the text within the sliding window.
25
+ */
26
+ slidingWindow?: number;
27
+ /**
28
+ * Easing function applied within the sliding window.
29
+ */
15
30
  easing?: keyof typeof easings;
31
+ /**
32
+ * Text content to animate.
33
+ */
16
34
  children: React.ReactNode;
35
+ /**
36
+ * Defines how the text is split for animation (e.g., by character, space, or symbol).
37
+ */
38
+ splitBy?: keyof typeof split;
17
39
  };
18
40
  export declare const AnimateText: import("react").ForwardRefExoticComponent<AnimateChildrenProps & import("react").RefAttributes<HTMLDivElement>>;
19
41
  export {};
@@ -1,2 +1,3 @@
1
1
  export { AnimateChildren } from "./animate-children";
2
2
  export { AnimateText } from "./animate-text";
3
+ export { StaggerAnimation } from "./stagger-animation";
@@ -1,2 +1,3 @@
1
1
  export { meta as AnimateChildren } from "./animate-children.ws";
2
2
  export { meta as AnimateText } from "./animate-text.ws";
3
+ export { meta as StaggerAnimation } from "./stagger-animation.ws";
@@ -1,2 +1,3 @@
1
1
  export { propsMeta as AnimateChildren } from "./animate-children.ws";
2
2
  export { propsMeta as AnimateText } from "./animate-text.ws";
3
+ export { propsMeta as StaggerAnimation } from "./stagger-animation.ws";
@@ -0,0 +1 @@
1
+ export declare const animation: Record<string, string>;
@@ -0,0 +1,31 @@
1
+ declare const easings: {
2
+ linear: boolean;
3
+ easeIn: boolean;
4
+ easeInCubic: boolean;
5
+ easeInQuart: boolean;
6
+ easeOut: boolean;
7
+ easeOutCubic: boolean;
8
+ easeOutQuart: boolean;
9
+ ease: boolean;
10
+ easeInOutCubic: boolean;
11
+ easeInOutQuart: boolean;
12
+ };
13
+ type StaggerAnimationProps = {
14
+ /**
15
+ * Size of the sliding window for the animation:
16
+ * - 0: Typewriter effect (no animation).
17
+ * - (0..1]: Animates one child at a time.
18
+ * - (1..n]: Animates multiple children within the sliding window.
19
+ */
20
+ slidingWindow?: number;
21
+ /**
22
+ * Easing function applied within the sliding window.
23
+ */
24
+ easing?: keyof typeof easings;
25
+ /**
26
+ * Text content to animate.
27
+ */
28
+ children: React.ReactNode;
29
+ };
30
+ export declare const StaggerAnimation: import("react").ForwardRefExoticComponent<StaggerAnimationProps & import("react").RefAttributes<HTMLDivElement>>;
31
+ export {};
@@ -0,0 +1,3 @@
1
+ import type { WsComponentMeta, WsComponentPropsMeta } from "@webstudio-is/sdk";
2
+ export declare const meta: WsComponentMeta;
3
+ export declare const propsMeta: WsComponentPropsMeta;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webstudio-is/sdk-components-animation",
3
- "version": "0.208.0",
3
+ "version": "0.210.0",
4
4
  "description": "Webstudio components for animation",
5
5
  "author": "Webstudio <github@webstudio.is>",
6
6
  "homepage": "https://webstudio.is",
@@ -49,10 +49,10 @@
49
49
  "nanostores": "^0.11.3",
50
50
  "react-error-boundary": "^5.0.0",
51
51
  "shallow-equal": "^3.1.0",
52
- "@webstudio-is/css-engine": "0.208.0",
53
- "@webstudio-is/icons": "0.208.0",
54
- "@webstudio-is/sdk": "0.208.0",
55
- "@webstudio-is/react-sdk": "0.208.0"
52
+ "@webstudio-is/css-engine": "0.210.0",
53
+ "@webstudio-is/icons": "0.210.0",
54
+ "@webstudio-is/react-sdk": "0.210.0",
55
+ "@webstudio-is/sdk": "0.210.0"
56
56
  },
57
57
  "devDependencies": {
58
58
  "@types/react": "^18.2.70",
@@ -64,14 +64,14 @@
64
64
  "react-dom": "18.3.0-canary-14898b6a9-20240318",
65
65
  "type-fest": "^4.37.0",
66
66
  "vitest": "^3.0.8",
67
- "zod": "^3.22.4",
67
+ "zod": "^3.24.2",
68
68
  "@webstudio-is/css-data": "0.0.0",
69
69
  "@webstudio-is/design-system": "0.0.0",
70
- "@webstudio-is/generate-arg-types": "0.0.0",
71
70
  "@webstudio-is/sdk-cli": "^0.94.0",
72
- "@webstudio-is/sdk-components-react": "0.208.0",
73
- "@webstudio-is/tsconfig": "1.0.7",
74
- "@webstudio-is/template": "0.208.0"
71
+ "@webstudio-is/generate-arg-types": "0.0.0",
72
+ "@webstudio-is/sdk-components-react": "0.210.0",
73
+ "@webstudio-is/template": "0.210.0",
74
+ "@webstudio-is/tsconfig": "1.0.7"
75
75
  },
76
76
  "scripts": {
77
77
  "build": "vite build --config ../../vite.sdk-components.config.ts",