@webstudio-is/sdk-components-animation 0.203.0 → 0.205.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.
- package/lib/animate-children.js +27 -0
- package/lib/components.js +2 -2
- package/lib/hooks.js +3 -2
- package/lib/metas.js +4 -1
- package/lib/props.js +4 -1
- package/lib/scroll.ws.js +23 -0
- package/lib/shared/consts.js +4 -0
- package/lib/types/animate-children.d.ts +10 -0
- package/lib/types/components.d.ts +1 -1
- package/lib/types/metas.d.ts +1 -1
- package/lib/types/props.d.ts +1 -1
- package/lib/types/scroll.ws.d.ts +3 -0
- package/lib/types/shared/consts.d.ts +1 -0
- package/package.json +19 -11
- package/lib/scroll.js +0 -8
- package/lib/types/scroll.d.ts +0 -8
- package/lib/types/shared/animation-types.d.ts +0 -49
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as m } from "react";
|
|
3
|
+
import { animationCanPlayOnCanvasProperty as o } from "./shared/consts.js";
|
|
4
|
+
const c = m(
|
|
5
|
+
({ debug: t = !1, action: n, ...i }, s) => /* @__PURE__ */ r("div", { ref: s, style: { display: "contents" }, ...i })
|
|
6
|
+
), a = "AnimateChildren";
|
|
7
|
+
c.displayName = a;
|
|
8
|
+
const e = "@webstudio-is/sdk-components-animation", h = {
|
|
9
|
+
onNavigatorUnselect: (t, n) => {
|
|
10
|
+
n.instancePath.length > 0 && n.instancePath[0].component === `${e}:${a}` && t.setMemoryProp(
|
|
11
|
+
n.instancePath[0],
|
|
12
|
+
o,
|
|
13
|
+
void 0
|
|
14
|
+
);
|
|
15
|
+
},
|
|
16
|
+
onNavigatorSelect: (t, n) => {
|
|
17
|
+
n.instancePath.length > 0 && n.instancePath[0].component === `${e}:${a}` && t.setMemoryProp(
|
|
18
|
+
n.instancePath[0],
|
|
19
|
+
o,
|
|
20
|
+
!0
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
export {
|
|
25
|
+
c as AnimateChildren,
|
|
26
|
+
h as hooksAnimateChildren
|
|
27
|
+
};
|
package/lib/components.js
CHANGED
package/lib/hooks.js
CHANGED
package/lib/metas.js
CHANGED
package/lib/props.js
CHANGED
package/lib/scroll.ws.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { SlotComponentIcon as n } from "@webstudio-is/icons/svg";
|
|
2
|
+
const i = {
|
|
3
|
+
category: "general",
|
|
4
|
+
type: "container",
|
|
5
|
+
description: "Animate Children",
|
|
6
|
+
icon: n,
|
|
7
|
+
order: 5,
|
|
8
|
+
label: "Animate Children"
|
|
9
|
+
}, t = {
|
|
10
|
+
props: {
|
|
11
|
+
action: {
|
|
12
|
+
required: !1,
|
|
13
|
+
control: "animationAction",
|
|
14
|
+
type: "animationAction",
|
|
15
|
+
description: "Animation Action"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
initialProps: ["action"]
|
|
19
|
+
};
|
|
20
|
+
export {
|
|
21
|
+
i as meta,
|
|
22
|
+
t as propsMeta
|
|
23
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Hook } from "@webstudio-is/react-sdk";
|
|
2
|
+
import type { AnimationAction } from "@webstudio-is/sdk";
|
|
3
|
+
type ScrollProps = {
|
|
4
|
+
debug?: boolean;
|
|
5
|
+
children?: React.ReactNode;
|
|
6
|
+
action: AnimationAction;
|
|
7
|
+
};
|
|
8
|
+
export declare const AnimateChildren: import("react").ForwardRefExoticComponent<ScrollProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
9
|
+
export declare const hooksAnimateChildren: Hook;
|
|
10
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { AnimateChildren } from "./animate-children";
|
package/lib/types/metas.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export { meta as AnimateChildren } from "./scroll.ws";
|
package/lib/types/props.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export { propsMeta as AnimateChildren } from "./scroll.ws";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const animationCanPlayOnCanvasProperty = "data-ws-animation-can-play-on-canvas";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webstudio-is/sdk-components-animation",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.205.0",
|
|
4
4
|
"description": "Webstudio components for animation",
|
|
5
5
|
"author": "Webstudio <github@webstudio.is>",
|
|
6
6
|
"homepage": "https://webstudio.is",
|
|
@@ -45,32 +45,40 @@
|
|
|
45
45
|
"react-dom": "18.3.0-canary-14898b6a9-20240318"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
+
"change-case": "^5.4.4",
|
|
48
49
|
"react-error-boundary": "^5.0.0",
|
|
49
50
|
"scroll-timeline-polyfill": "^1.1.0",
|
|
50
|
-
"@webstudio-is/css-engine": "0.
|
|
51
|
-
"@webstudio-is/
|
|
52
|
-
"@webstudio-is/
|
|
53
|
-
"@webstudio-is/sdk": "0.
|
|
51
|
+
"@webstudio-is/css-engine": "0.205.0",
|
|
52
|
+
"@webstudio-is/react-sdk": "0.205.0",
|
|
53
|
+
"@webstudio-is/icons": "0.205.0",
|
|
54
|
+
"@webstudio-is/sdk": "0.205.0"
|
|
54
55
|
},
|
|
55
56
|
"devDependencies": {
|
|
56
57
|
"@types/react": "^18.2.70",
|
|
57
58
|
"@types/react-dom": "^18.2.25",
|
|
59
|
+
"@vitest/browser": "^3.0.4",
|
|
60
|
+
"fast-glob": "^3.3.2",
|
|
61
|
+
"playwright": "^1.50.1",
|
|
58
62
|
"react": "18.3.0-canary-14898b6a9-20240318",
|
|
59
63
|
"react-dom": "18.3.0-canary-14898b6a9-20240318",
|
|
60
64
|
"type-fest": "^4.32.0",
|
|
65
|
+
"vitest": "^3.0.4",
|
|
66
|
+
"zod": "^3.22.4",
|
|
67
|
+
"@webstudio-is/css-data": "0.0.0",
|
|
61
68
|
"@webstudio-is/generate-arg-types": "0.0.0",
|
|
62
|
-
"@webstudio-is/sdk-components-react": "0.203.0",
|
|
63
69
|
"@webstudio-is/sdk-cli": "^0.94.0",
|
|
64
|
-
"@webstudio-is/
|
|
65
|
-
"@webstudio-is/
|
|
66
|
-
"@webstudio-is/
|
|
67
|
-
"@webstudio-is/
|
|
70
|
+
"@webstudio-is/design-system": "0.0.0",
|
|
71
|
+
"@webstudio-is/sdk-components-react": "0.205.0",
|
|
72
|
+
"@webstudio-is/template": "0.205.0",
|
|
73
|
+
"@webstudio-is/tsconfig": "1.0.7"
|
|
68
74
|
},
|
|
69
75
|
"scripts": {
|
|
70
76
|
"build": "vite build --config ../../vite.sdk-components.config.ts",
|
|
71
77
|
"build:args": "NODE_OPTIONS=--conditions=webstudio generate-arg-types './src/*.tsx !./src/*.stories.tsx !./src/*.ws.ts !./src/*.template.tsx !./src/*.test.{ts,tsx}' -e asChild -e modal -e defaultOpen -e defaultChecked && prettier --write \"**/*.props.ts\"",
|
|
72
78
|
"build:stories": "webstudio-sdk generate-stories && prettier --write \"src/__generated__/*.stories.tsx\"",
|
|
73
79
|
"dts": "tsc --project tsconfig.dts.json",
|
|
74
|
-
"typecheck": "tsc"
|
|
80
|
+
"typecheck": "tsc",
|
|
81
|
+
"test": "vitest run",
|
|
82
|
+
"playwright-init": "playwright install --with-deps"
|
|
75
83
|
}
|
|
76
84
|
}
|
package/lib/scroll.js
DELETED
package/lib/types/scroll.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { AnimationAction } from "./shared/animation-types";
|
|
2
|
-
type ScrollProps = {
|
|
3
|
-
debug?: boolean;
|
|
4
|
-
children?: React.ReactNode;
|
|
5
|
-
action: AnimationAction;
|
|
6
|
-
};
|
|
7
|
-
export declare const Scroll: import("react").ForwardRefExoticComponent<ScrollProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
8
|
-
export {};
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import type { StyleValue } from "@webstudio-is/css-engine";
|
|
2
|
-
export type KeyframeStyles = {
|
|
3
|
-
[property: string]: StyleValue | undefined;
|
|
4
|
-
};
|
|
5
|
-
export type AnimationKeyframe = {
|
|
6
|
-
offset: number | undefined;
|
|
7
|
-
styles: KeyframeStyles;
|
|
8
|
-
};
|
|
9
|
-
declare const RANGE_UNITS: readonly ["%", "px", "cm", "mm", "q", "in", "pt", "pc", "em", "rem", "ex", "rex", "cap", "rcap", "ch", "rch", "lh", "rlh", "vw", "svw", "lvw", "dvw", "vh", "svh", "lvh", "dvh", "vi", "svi", "lvi", "dvi", "vb", "svb", "lvb", "dvb", "vmin", "svmin", "lvmin", "dvmin", "vmax", "svmax", "lvmax", "dvmax"];
|
|
10
|
-
export type RangeUnit = (typeof RANGE_UNITS)[number];
|
|
11
|
-
export declare const isRangeUnit: (value: unknown) => value is RangeUnit;
|
|
12
|
-
export type RangeUnitValue = {
|
|
13
|
-
type: "unit";
|
|
14
|
-
value: number;
|
|
15
|
-
unit: RangeUnit;
|
|
16
|
-
};
|
|
17
|
-
type KeyframeEffectOptions = {
|
|
18
|
-
easing?: string;
|
|
19
|
-
fill?: FillMode;
|
|
20
|
-
};
|
|
21
|
-
/**
|
|
22
|
-
* Scroll does not support https://drafts.csswg.org/scroll-animations/#named-ranges
|
|
23
|
-
* However, for simplicity and type unification with the view, we will use the names "start" and "end,"
|
|
24
|
-
* which will be transformed as follows:
|
|
25
|
-
* - "start" → `calc(0% + range)`
|
|
26
|
-
* - "end" → `calc(100% - range)`
|
|
27
|
-
*/
|
|
28
|
-
type ScrollNamedRange = "start" | "end";
|
|
29
|
-
/**
|
|
30
|
-
* Scroll does not support https://drafts.csswg.org/scroll-animations/#named-ranges
|
|
31
|
-
* However, for simplicity and type unification with the view, we will use the names "start" and "end,"
|
|
32
|
-
* See ScrollNamedRange type for more information.
|
|
33
|
-
*/
|
|
34
|
-
export type ScrollRangeValue = [name: ScrollNamedRange, value: RangeUnitValue];
|
|
35
|
-
type ScrollRangeOptions = {
|
|
36
|
-
rangeStart?: ScrollRangeValue | undefined;
|
|
37
|
-
rangeEnd?: ScrollRangeValue | undefined;
|
|
38
|
-
};
|
|
39
|
-
type ScrollAction = {
|
|
40
|
-
type: "scroll";
|
|
41
|
-
source?: "closest" | "nearest" | "root";
|
|
42
|
-
axis?: "block" | "inline" | "x" | "y";
|
|
43
|
-
animations: {
|
|
44
|
-
timing: KeyframeEffectOptions & ScrollRangeOptions;
|
|
45
|
-
keyframes: AnimationKeyframe[];
|
|
46
|
-
}[];
|
|
47
|
-
};
|
|
48
|
-
export type AnimationAction = ScrollAction;
|
|
49
|
-
export {};
|