@webstudio-is/sdk-components-animation 0.201.0 → 0.203.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/components.js CHANGED
@@ -1 +1,4 @@
1
-
1
+ import { Scroll as l } from "./scroll.js";
2
+ export {
3
+ l as Scroll
4
+ };
package/lib/scroll.js ADDED
@@ -0,0 +1,8 @@
1
+ import { jsx as t } from "react/jsx-runtime";
2
+ import { forwardRef as e } from "react";
3
+ const n = e(
4
+ ({ debug: s = !1, action: f, ...o }, r) => /* @__PURE__ */ t("div", { ref: r, style: { display: "contents" }, ...o })
5
+ );
6
+ export {
7
+ n as Scroll
8
+ };
@@ -1 +1 @@
1
- export {};
1
+ export { Scroll } from "./scroll";
@@ -0,0 +1,8 @@
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 {};
@@ -0,0 +1,49 @@
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 {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webstudio-is/sdk-components-animation",
3
- "version": "0.201.0",
3
+ "version": "0.203.0",
4
4
  "description": "Webstudio components for animation",
5
5
  "author": "Webstudio <github@webstudio.is>",
6
6
  "homepage": "https://webstudio.is",
@@ -14,6 +14,7 @@
14
14
  ],
15
15
  "exports": {
16
16
  ".": {
17
+ "webstudio-private": "./private-src/components.ts",
17
18
  "webstudio": "./src/components.ts",
18
19
  "types": "./lib/types/components.d.ts",
19
20
  "import": "./lib/components.js"
@@ -44,20 +45,26 @@
44
45
  "react-dom": "18.3.0-canary-14898b6a9-20240318"
45
46
  },
46
47
  "dependencies": {
47
- "@webstudio-is/icons": "0.201.0",
48
- "@webstudio-is/react-sdk": "0.201.0",
49
- "@webstudio-is/sdk": "0.201.0"
48
+ "react-error-boundary": "^5.0.0",
49
+ "scroll-timeline-polyfill": "^1.1.0",
50
+ "@webstudio-is/css-engine": "0.203.0",
51
+ "@webstudio-is/icons": "0.203.0",
52
+ "@webstudio-is/react-sdk": "0.203.0",
53
+ "@webstudio-is/sdk": "0.203.0"
50
54
  },
51
55
  "devDependencies": {
52
56
  "@types/react": "^18.2.70",
53
57
  "@types/react-dom": "^18.2.25",
54
58
  "react": "18.3.0-canary-14898b6a9-20240318",
55
59
  "react-dom": "18.3.0-canary-14898b6a9-20240318",
60
+ "type-fest": "^4.32.0",
56
61
  "@webstudio-is/generate-arg-types": "0.0.0",
62
+ "@webstudio-is/sdk-components-react": "0.203.0",
57
63
  "@webstudio-is/sdk-cli": "^0.94.0",
58
- "@webstudio-is/template": "0.201.0",
64
+ "@webstudio-is/template": "0.203.0",
59
65
  "@webstudio-is/tsconfig": "1.0.7",
60
- "@webstudio-is/sdk-components-react": "0.201.0"
66
+ "@webstudio-is/css-data": "0.0.0",
67
+ "@webstudio-is/design-system": "0.0.0"
61
68
  },
62
69
  "scripts": {
63
70
  "build": "vite build --config ../../vite.sdk-components.config.ts",
@@ -1,17 +0,0 @@
1
- export declare const animation: Record<string, {
2
- displayName: string;
3
- } & ((props: Record<string, unknown> & Record<`${string}:expression`, string> & {
4
- "ws:id"?: string;
5
- "ws:label"?: string;
6
- "ws:style"?: import("@webstudio-is/template").TemplateStyleDecl[];
7
- "ws:show"?: boolean | {
8
- chunks: string[];
9
- variables: Array<import("@webstudio-is/template").Variable | import("@webstudio-is/template").Parameter>;
10
- serialize(variableIds: string[]): string;
11
- };
12
- children?: import("react").ReactNode | import("@webstudio-is/template").ExpressionValue | {
13
- chunks: string[];
14
- variables: Array<import("@webstudio-is/template").Variable | import("@webstudio-is/template").Parameter>;
15
- serialize(variableIds: string[]): string;
16
- } | import("@webstudio-is/template").PlaceholderValue;
17
- }) => import("react").ReactNode)>;