@studiometa/ui 1.7.0 → 1.9.0-beta.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/Data/DataBind.d.ts +1 -1
- package/Fetch/Fetch.d.ts +17 -17
- package/Fetch/Fetch.js.map +2 -2
- package/Fetch/utils.js +1 -4
- package/Fetch/utils.js.map +2 -2
- package/Frame/Frame.d.ts +4 -4
- package/Frame/FrameForm.d.ts +1 -1
- package/Frame/FrameTarget.d.ts +4 -4
- package/Frame/FrameTarget.js.map +2 -2
- package/ScrollAnimation/AbstractScrollAnimation.d.ts +8 -0
- package/ScrollAnimation/AbstractScrollAnimation.js +20 -1
- package/ScrollAnimation/AbstractScrollAnimation.js.map +2 -2
- package/ScrollAnimation/ScrollAnimation.d.ts +6 -0
- package/ScrollAnimation/ScrollAnimation.js +12 -0
- package/ScrollAnimation/ScrollAnimation.js.map +2 -2
- package/ScrollAnimation/ScrollAnimationChild.d.ts +6 -0
- package/ScrollAnimation/ScrollAnimationChild.js +17 -4
- package/ScrollAnimation/ScrollAnimationChild.js.map +2 -2
- package/ScrollAnimation/ScrollAnimationChildWithEase.d.ts +7 -1
- package/ScrollAnimation/ScrollAnimationChildWithEase.js +12 -0
- package/ScrollAnimation/ScrollAnimationChildWithEase.js.map +2 -2
- package/ScrollAnimation/ScrollAnimationParent.d.ts +6 -0
- package/ScrollAnimation/ScrollAnimationParent.js +12 -0
- package/ScrollAnimation/ScrollAnimationParent.js.map +2 -2
- package/ScrollAnimation/ScrollAnimationTarget.d.ts +43 -0
- package/ScrollAnimation/ScrollAnimationTarget.js +68 -0
- package/ScrollAnimation/ScrollAnimationTarget.js.map +7 -0
- package/ScrollAnimation/ScrollAnimationTimeline.d.ts +35 -0
- package/ScrollAnimation/ScrollAnimationTimeline.js +28 -0
- package/ScrollAnimation/ScrollAnimationTimeline.js.map +7 -0
- package/ScrollAnimation/ScrollAnimationWithEase.d.ts +7 -1
- package/ScrollAnimation/ScrollAnimationWithEase.js +12 -0
- package/ScrollAnimation/ScrollAnimationWithEase.js.map +2 -2
- package/ScrollAnimation/animationScrollWithEase.d.ts +2 -0
- package/ScrollAnimation/animationScrollWithEase.js +12 -1
- package/ScrollAnimation/animationScrollWithEase.js.map +2 -2
- package/ScrollAnimation/index.d.ts +3 -0
- package/ScrollAnimation/index.js +3 -0
- package/ScrollAnimation/index.js.map +2 -2
- package/ScrollAnimation/withScrollAnimationDebug.d.ts +28 -0
- package/ScrollAnimation/withScrollAnimationDebug.js +309 -0
- package/ScrollAnimation/withScrollAnimationDebug.js.map +7 -0
- package/package.json +3 -3
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { BaseConfig, BaseProps, ScrollInViewProps, WithScrolledInViewProps } from '@studiometa/js-toolkit';
|
|
2
|
+
import { AbstractScrollAnimation } from './AbstractScrollAnimation.js';
|
|
3
|
+
export interface ScrollAnimationTargetProps extends BaseProps {
|
|
4
|
+
$options: WithScrolledInViewProps['$options'];
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* ScrollAnimationTarget class.
|
|
8
|
+
*
|
|
9
|
+
* A component that animates based on scroll progress from a parent `ScrollAnimationTimeline`.
|
|
10
|
+
* Each target can have its own animation keyframes and play range.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```html
|
|
14
|
+
* <div data-component="ScrollAnimationTimeline">
|
|
15
|
+
* <div
|
|
16
|
+
* data-component="ScrollAnimationTarget"
|
|
17
|
+
* data-option-from='{"opacity": 0, "transform": "translateY(20px)"}'
|
|
18
|
+
* data-option-to='{"opacity": 1, "transform": "translateY(0)"}'
|
|
19
|
+
* data-option-play-range='[0, 0.5]'
|
|
20
|
+
* >
|
|
21
|
+
* Animated content
|
|
22
|
+
* </div>
|
|
23
|
+
* </div>
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export declare class ScrollAnimationTarget<T extends BaseProps = BaseProps> extends AbstractScrollAnimation<T & ScrollAnimationTargetProps> {
|
|
27
|
+
/**
|
|
28
|
+
* Config.
|
|
29
|
+
*/
|
|
30
|
+
static config: BaseConfig;
|
|
31
|
+
/**
|
|
32
|
+
* Local damped current values.
|
|
33
|
+
*/
|
|
34
|
+
dampedCurrent: ScrollInViewProps['dampedCurrent'];
|
|
35
|
+
/**
|
|
36
|
+
* Local damped progress.
|
|
37
|
+
*/
|
|
38
|
+
dampedProgress: ScrollInViewProps['dampedCurrent'];
|
|
39
|
+
/**
|
|
40
|
+
* Compute local damped progress.
|
|
41
|
+
*/
|
|
42
|
+
scrolledInView(props: ScrollInViewProps): void;
|
|
43
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { damp, clamp01, domScheduler } from "@studiometa/js-toolkit/utils";
|
|
2
|
+
import { AbstractScrollAnimation } from "./AbstractScrollAnimation.js";
|
|
3
|
+
function updateProps(that, props, dampFactor, dampPrecision, axis = "x") {
|
|
4
|
+
that.dampedCurrent[axis] = damp(
|
|
5
|
+
props.current[axis],
|
|
6
|
+
that.dampedCurrent[axis],
|
|
7
|
+
dampFactor,
|
|
8
|
+
dampPrecision
|
|
9
|
+
);
|
|
10
|
+
that.dampedProgress[axis] = clamp01(
|
|
11
|
+
(that.dampedCurrent[axis] - props.start[axis]) / (props.end[axis] - props.start[axis])
|
|
12
|
+
);
|
|
13
|
+
}
|
|
14
|
+
class ScrollAnimationTarget extends AbstractScrollAnimation {
|
|
15
|
+
/**
|
|
16
|
+
* Config.
|
|
17
|
+
*/
|
|
18
|
+
static config = {
|
|
19
|
+
...AbstractScrollAnimation.config,
|
|
20
|
+
name: "ScrollAnimationTarget",
|
|
21
|
+
options: {
|
|
22
|
+
...AbstractScrollAnimation.config.options,
|
|
23
|
+
dampFactor: {
|
|
24
|
+
type: Number,
|
|
25
|
+
default: 0.1
|
|
26
|
+
},
|
|
27
|
+
dampPrecision: {
|
|
28
|
+
type: Number,
|
|
29
|
+
default: 1e-3
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Local damped current values.
|
|
35
|
+
*/
|
|
36
|
+
dampedCurrent = {
|
|
37
|
+
x: 0,
|
|
38
|
+
y: 0
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Local damped progress.
|
|
42
|
+
*/
|
|
43
|
+
dampedProgress = {
|
|
44
|
+
x: 0,
|
|
45
|
+
y: 0
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Compute local damped progress.
|
|
49
|
+
*/
|
|
50
|
+
scrolledInView(props) {
|
|
51
|
+
domScheduler.read(() => {
|
|
52
|
+
const { dampFactor, dampPrecision } = this.$options;
|
|
53
|
+
updateProps(this, props, dampFactor, dampPrecision, "x");
|
|
54
|
+
updateProps(this, props, dampFactor, dampPrecision, "y");
|
|
55
|
+
});
|
|
56
|
+
domScheduler.write(() => {
|
|
57
|
+
super.scrolledInView({
|
|
58
|
+
...props,
|
|
59
|
+
dampedCurrent: this.dampedCurrent,
|
|
60
|
+
dampedProgress: this.dampedProgress
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
export {
|
|
66
|
+
ScrollAnimationTarget
|
|
67
|
+
};
|
|
68
|
+
//# sourceMappingURL=ScrollAnimationTarget.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../packages/ui/ScrollAnimation/ScrollAnimationTarget.ts"],
|
|
4
|
+
"sourcesContent": ["import type {\n BaseConfig,\n BaseProps,\n ScrollInViewProps,\n WithScrolledInViewProps,\n} from '@studiometa/js-toolkit';\nimport { damp, clamp01, domScheduler } from '@studiometa/js-toolkit/utils';\nimport { AbstractScrollAnimation } from './AbstractScrollAnimation.js';\n\nexport interface ScrollAnimationTargetProps extends BaseProps {\n $options: WithScrolledInViewProps['$options'];\n}\n\nfunction updateProps(\n // eslint-disable-next-line no-use-before-define\n that: ScrollAnimationTarget,\n props: ScrollInViewProps,\n dampFactor: number,\n dampPrecision: number,\n axis: 'x' | 'y' = 'x',\n) {\n that.dampedCurrent[axis] = damp(\n props.current[axis],\n that.dampedCurrent[axis],\n dampFactor,\n dampPrecision,\n );\n that.dampedProgress[axis] = clamp01(\n (that.dampedCurrent[axis] - props.start[axis]) / (props.end[axis] - props.start[axis]),\n );\n}\n\n/**\n * ScrollAnimationTarget class.\n *\n * A component that animates based on scroll progress from a parent `ScrollAnimationTimeline`.\n * Each target can have its own animation keyframes and play range.\n *\n * @example\n * ```html\n * <div data-component=\"ScrollAnimationTimeline\">\n * <div\n * data-component=\"ScrollAnimationTarget\"\n * data-option-from='{\"opacity\": 0, \"transform\": \"translateY(20px)\"}'\n * data-option-to='{\"opacity\": 1, \"transform\": \"translateY(0)\"}'\n * data-option-play-range='[0, 0.5]'\n * >\n * Animated content\n * </div>\n * </div>\n * ```\n */\nexport class ScrollAnimationTarget<T extends BaseProps = BaseProps> extends AbstractScrollAnimation<\n T & ScrollAnimationTargetProps\n> {\n /**\n * Config.\n */\n static config: BaseConfig = {\n ...AbstractScrollAnimation.config,\n name: 'ScrollAnimationTarget',\n options: {\n ...AbstractScrollAnimation.config.options,\n dampFactor: {\n type: Number,\n default: 0.1,\n },\n dampPrecision: {\n type: Number,\n default: 0.001,\n },\n },\n };\n\n /**\n * Local damped current values.\n */\n dampedCurrent: ScrollInViewProps['dampedCurrent'] = {\n x: 0,\n y: 0,\n };\n\n /**\n * Local damped progress.\n */\n dampedProgress: ScrollInViewProps['dampedCurrent'] = {\n x: 0,\n y: 0,\n };\n\n /**\n * Compute local damped progress.\n */\n scrolledInView(props: ScrollInViewProps) {\n domScheduler.read(() => {\n const { dampFactor, dampPrecision } = this.$options;\n updateProps(this, props, dampFactor, dampPrecision, 'x');\n updateProps(this, props, dampFactor, dampPrecision, 'y');\n });\n\n domScheduler.write(() => {\n super.scrolledInView({\n ...props,\n dampedCurrent: this.dampedCurrent,\n dampedProgress: this.dampedProgress,\n });\n });\n }\n}\n"],
|
|
5
|
+
"mappings": "AAMA,SAAS,MAAM,SAAS,oBAAoB;AAC5C,SAAS,+BAA+B;AAMxC,SAAS,YAEP,MACA,OACA,YACA,eACA,OAAkB,KAClB;AACA,OAAK,cAAc,IAAI,IAAI;AAAA,IACzB,MAAM,QAAQ,IAAI;AAAA,IAClB,KAAK,cAAc,IAAI;AAAA,IACvB;AAAA,IACA;AAAA,EACF;AACA,OAAK,eAAe,IAAI,IAAI;AAAA,KACzB,KAAK,cAAc,IAAI,IAAI,MAAM,MAAM,IAAI,MAAM,MAAM,IAAI,IAAI,IAAI,MAAM,MAAM,IAAI;AAAA,EACtF;AACF;AAsBO,MAAM,8BAA+D,wBAE1E;AAAA;AAAA;AAAA;AAAA,EAIA,OAAO,SAAqB;AAAA,IAC1B,GAAG,wBAAwB;AAAA,IAC3B,MAAM;AAAA,IACN,SAAS;AAAA,MACP,GAAG,wBAAwB,OAAO;AAAA,MAClC,YAAY;AAAA,QACV,MAAM;AAAA,QACN,SAAS;AAAA,MACX;AAAA,MACA,eAAe;AAAA,QACb,MAAM;AAAA,QACN,SAAS;AAAA,MACX;AAAA,IACF;AAAA,EACF;AAAA;AAAA;AAAA;AAAA,EAKA,gBAAoD;AAAA,IAClD,GAAG;AAAA,IACH,GAAG;AAAA,EACL;AAAA;AAAA;AAAA;AAAA,EAKA,iBAAqD;AAAA,IACnD,GAAG;AAAA,IACH,GAAG;AAAA,EACL;AAAA;AAAA;AAAA;AAAA,EAKA,eAAe,OAA0B;AACvC,iBAAa,KAAK,MAAM;AACtB,YAAM,EAAE,YAAY,cAAc,IAAI,KAAK;AAC3C,kBAAY,MAAM,OAAO,YAAY,eAAe,GAAG;AACvD,kBAAY,MAAM,OAAO,YAAY,eAAe,GAAG;AAAA,IACzD,CAAC;AAED,iBAAa,MAAM,MAAM;AACvB,YAAM,eAAe;AAAA,QACnB,GAAG;AAAA,QACH,eAAe,KAAK;AAAA,QACpB,gBAAgB,KAAK;AAAA,MACvB,CAAC;AAAA,IACH,CAAC;AAAA,EACH;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Base, ScrollInViewProps } from '@studiometa/js-toolkit';
|
|
2
|
+
import type { BaseConfig, BaseProps } from '@studiometa/js-toolkit';
|
|
3
|
+
import { ScrollAnimationTarget } from './ScrollAnimationTarget.js';
|
|
4
|
+
export interface ScrollAnimationTimelineProps extends BaseProps {
|
|
5
|
+
$children: {
|
|
6
|
+
ScrollAnimationTarget: ScrollAnimationTarget[];
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
declare const ScrollAnimationTimeline_base: import("@studiometa/js-toolkit").BaseDecorator<import("@studiometa/js-toolkit").WithScrolledInViewInterface, Base<BaseProps>, import("@studiometa/js-toolkit").WithScrolledInViewProps>;
|
|
10
|
+
/**
|
|
11
|
+
* ScrollAnimationTimeline class.
|
|
12
|
+
*
|
|
13
|
+
* A component that manages scroll-based animations for its children.
|
|
14
|
+
* Use with `ScrollAnimationTarget` children components.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```html
|
|
18
|
+
* <div data-component="ScrollAnimationTimeline">
|
|
19
|
+
* <div data-component="ScrollAnimationTarget" data-option-from='{"opacity": 0}' data-option-to='{"opacity": 1}'>
|
|
20
|
+
* Content
|
|
21
|
+
* </div>
|
|
22
|
+
* </div>
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export declare class ScrollAnimationTimeline<T extends BaseProps = BaseProps> extends ScrollAnimationTimeline_base<T & ScrollAnimationTimelineProps> {
|
|
26
|
+
/**
|
|
27
|
+
* Config.
|
|
28
|
+
*/
|
|
29
|
+
static config: BaseConfig;
|
|
30
|
+
/**
|
|
31
|
+
* Scrolled in view hook.
|
|
32
|
+
*/
|
|
33
|
+
scrolledInView(props: ScrollInViewProps): void;
|
|
34
|
+
}
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Base, withScrolledInView } from "@studiometa/js-toolkit";
|
|
2
|
+
import { ScrollAnimationTarget } from "./ScrollAnimationTarget.js";
|
|
3
|
+
class ScrollAnimationTimeline extends withScrolledInView(
|
|
4
|
+
Base,
|
|
5
|
+
{}
|
|
6
|
+
) {
|
|
7
|
+
/**
|
|
8
|
+
* Config.
|
|
9
|
+
*/
|
|
10
|
+
static config = {
|
|
11
|
+
name: "ScrollAnimationTimeline",
|
|
12
|
+
components: {
|
|
13
|
+
ScrollAnimationTarget
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Scrolled in view hook.
|
|
18
|
+
*/
|
|
19
|
+
scrolledInView(props) {
|
|
20
|
+
for (const child of this.$children.ScrollAnimationTarget) {
|
|
21
|
+
child.scrolledInView(props);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
export {
|
|
26
|
+
ScrollAnimationTimeline
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=ScrollAnimationTimeline.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../packages/ui/ScrollAnimation/ScrollAnimationTimeline.ts"],
|
|
4
|
+
"sourcesContent": ["import { Base, ScrollInViewProps, withScrolledInView } from '@studiometa/js-toolkit';\nimport type { BaseConfig, BaseProps } from '@studiometa/js-toolkit';\nimport { ScrollAnimationTarget } from './ScrollAnimationTarget.js';\n\nexport interface ScrollAnimationTimelineProps extends BaseProps {\n $children: {\n ScrollAnimationTarget: ScrollAnimationTarget[];\n };\n}\n\n/**\n * ScrollAnimationTimeline class.\n *\n * A component that manages scroll-based animations for its children.\n * Use with `ScrollAnimationTarget` children components.\n *\n * @example\n * ```html\n * <div data-component=\"ScrollAnimationTimeline\">\n * <div data-component=\"ScrollAnimationTarget\" data-option-from='{\"opacity\": 0}' data-option-to='{\"opacity\": 1}'>\n * Content\n * </div>\n * </div>\n * ```\n */\nexport class ScrollAnimationTimeline<T extends BaseProps = BaseProps> extends withScrolledInView(\n Base,\n {},\n)<T & ScrollAnimationTimelineProps> {\n /**\n * Config.\n */\n static config: BaseConfig = {\n name: 'ScrollAnimationTimeline',\n components: {\n ScrollAnimationTarget,\n },\n };\n\n /**\n * Scrolled in view hook.\n */\n scrolledInView(props: ScrollInViewProps) {\n for (const child of this.$children.ScrollAnimationTarget) {\n child.scrolledInView(props);\n }\n }\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,MAAyB,0BAA0B;AAE5D,SAAS,6BAA6B;AAuB/B,MAAM,gCAAiE;AAAA,EAC5E;AAAA,EACA,CAAC;AACH,EAAoC;AAAA;AAAA;AAAA;AAAA,EAIlC,OAAO,SAAqB;AAAA,IAC1B,MAAM;AAAA,IACN,YAAY;AAAA,MACV;AAAA,IACF;AAAA,EACF;AAAA;AAAA;AAAA;AAAA,EAKA,eAAe,OAA0B;AACvC,eAAW,SAAS,KAAK,UAAU,uBAAuB;AACxD,YAAM,eAAe,KAAK;AAAA,IAC5B;AAAA,EACF;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
import { type BaseConfig } from '@studiometa/js-toolkit';
|
|
2
2
|
declare const ScrollAnimationWithEase_base: import("@studiometa/js-toolkit").BaseDecorator<import("#private/index.js").AnimationScrollWithEaseInterface, import("#private/index.js").AbstractScrollAnimation<import("@studiometa/js-toolkit").BaseProps>, import("#private/index.js").AnimationScrollWithEaseProps>;
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* ScrollAnimationWithEase class.
|
|
5
|
+
*
|
|
6
|
+
* @deprecated Use `ScrollAnimationTimeline` with `ScrollAnimationTarget` children instead.
|
|
5
7
|
*/
|
|
6
8
|
export declare class ScrollAnimationWithEase extends ScrollAnimationWithEase_base {
|
|
7
9
|
/**
|
|
8
10
|
* Config.
|
|
9
11
|
*/
|
|
10
12
|
static config: BaseConfig;
|
|
13
|
+
/**
|
|
14
|
+
* Display deprecation warning.
|
|
15
|
+
*/
|
|
16
|
+
mounted(): void;
|
|
11
17
|
}
|
|
12
18
|
export {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isDev } from "@studiometa/js-toolkit/utils";
|
|
1
2
|
import { ScrollAnimation } from "./ScrollAnimation.js";
|
|
2
3
|
import { animationScrollWithEase } from "./animationScrollWithEase.js";
|
|
3
4
|
class ScrollAnimationWithEase extends animationScrollWithEase(ScrollAnimation) {
|
|
@@ -8,6 +9,17 @@ class ScrollAnimationWithEase extends animationScrollWithEase(ScrollAnimation) {
|
|
|
8
9
|
...ScrollAnimation.config,
|
|
9
10
|
name: "ScrollAnimationWithEase"
|
|
10
11
|
};
|
|
12
|
+
/**
|
|
13
|
+
* Display deprecation warning.
|
|
14
|
+
*/
|
|
15
|
+
mounted() {
|
|
16
|
+
if (isDev) {
|
|
17
|
+
console.warn(
|
|
18
|
+
`The ${this.$options.name} component is deprecated.`,
|
|
19
|
+
"\nUse `ScrollAnimationTimeline` with `ScrollAnimationTarget` children instead."
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
11
23
|
}
|
|
12
24
|
export {
|
|
13
25
|
ScrollAnimationWithEase
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../packages/ui/ScrollAnimation/ScrollAnimationWithEase.ts"],
|
|
4
|
-
"sourcesContent": ["import { type BaseConfig } from '@studiometa/js-toolkit';\nimport { ScrollAnimation } from './ScrollAnimation.js';\nimport { animationScrollWithEase } from './animationScrollWithEase.js';\n\n/**\n *
|
|
5
|
-
"mappings": "AACA,SAAS,uBAAuB;AAChC,SAAS,+BAA+B;
|
|
4
|
+
"sourcesContent": ["import { type BaseConfig } from '@studiometa/js-toolkit';\nimport { isDev } from '@studiometa/js-toolkit/utils';\nimport { ScrollAnimation } from './ScrollAnimation.js';\nimport { animationScrollWithEase } from './animationScrollWithEase.js';\n\n/**\n * ScrollAnimationWithEase class.\n *\n * @deprecated Use `ScrollAnimationTimeline` with `ScrollAnimationTarget` children instead.\n */\nexport class ScrollAnimationWithEase extends animationScrollWithEase(ScrollAnimation) {\n /**\n * Config.\n */\n static config: BaseConfig = {\n ...ScrollAnimation.config,\n name: 'ScrollAnimationWithEase',\n };\n\n /**\n * Display deprecation warning.\n */\n mounted() {\n if (isDev) {\n console.warn(\n `The ${this.$options.name} component is deprecated.`,\n '\\nUse `ScrollAnimationTimeline` with `ScrollAnimationTarget` children instead.',\n );\n }\n }\n}\n"],
|
|
5
|
+
"mappings": "AACA,SAAS,aAAa;AACtB,SAAS,uBAAuB;AAChC,SAAS,+BAA+B;AAOjC,MAAM,gCAAgC,wBAAwB,eAAe,EAAE;AAAA;AAAA;AAAA;AAAA,EAIpF,OAAO,SAAqB;AAAA,IAC1B,GAAG,gBAAgB;AAAA,IACnB,MAAM;AAAA,EACR;AAAA;AAAA;AAAA;AAAA,EAKA,UAAU;AACR,QAAI,OAAO;AACT,cAAQ;AAAA,QACN,OAAO,KAAK,SAAS,IAAI;AAAA,QACzB;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -9,5 +9,7 @@ export interface AnimationScrollWithEaseInterface extends BaseInterface {
|
|
|
9
9
|
}
|
|
10
10
|
/**
|
|
11
11
|
* Extend a `ScrollAnimation` component to use easings.
|
|
12
|
+
*
|
|
13
|
+
* @deprecated This decorator is deprecated. Easing can be applied directly via CSS or animation options.
|
|
12
14
|
*/
|
|
13
15
|
export declare function animationScrollWithEase<S extends AbstractScrollAnimation>(ScrollAnimation: typeof AbstractScrollAnimation): BaseDecorator<AnimationScrollWithEaseInterface, S, AnimationScrollWithEaseProps>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ease } from "@studiometa/js-toolkit/utils";
|
|
1
|
+
import { ease, isDev } from "@studiometa/js-toolkit/utils";
|
|
2
2
|
const regex = /ease([A-Z])/;
|
|
3
3
|
const eases = Object.fromEntries(
|
|
4
4
|
Object.entries(ease).filter(([name]) => name.startsWith("ease")).map(([name, value]) => [name.replace(regex, (match, $1) => $1.toLowerCase()), value])
|
|
@@ -19,6 +19,17 @@ function animationScrollWithEase(ScrollAnimation) {
|
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
};
|
|
22
|
+
/**
|
|
23
|
+
* Display a deprecation warning.
|
|
24
|
+
*/
|
|
25
|
+
mounted() {
|
|
26
|
+
if (isDev) {
|
|
27
|
+
console.warn(
|
|
28
|
+
`The animationScrollWithEase decorator is deprecated.`,
|
|
29
|
+
"\nEasing can be applied directly via CSS or animation options."
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
22
33
|
/**
|
|
23
34
|
* Eases the progress value.
|
|
24
35
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../packages/ui/ScrollAnimation/animationScrollWithEase.ts"],
|
|
4
|
-
"sourcesContent": ["import type { BaseConfig, BaseProps, BaseDecorator, BaseInterface } from '@studiometa/js-toolkit';\nimport { ease } from '@studiometa/js-toolkit/utils';\nimport type { AbstractScrollAnimation } from './AbstractScrollAnimation.js';\n\nconst regex = /ease([A-Z])/;\nconst eases = Object.fromEntries(\n Object.entries(ease)\n .filter(([name]) => name.startsWith('ease'))\n .map(([name, value]) => [name.replace(regex, (match, $1) => $1.toLowerCase()), value]),\n);\n\nexport interface AnimationScrollWithEaseProps extends BaseProps {\n $options: {\n ease: string;\n };\n}\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface AnimationScrollWithEaseInterface extends BaseInterface {}\n\n/**\n * Extend a `ScrollAnimation` component to use easings.\n */\nexport function animationScrollWithEase<S extends AbstractScrollAnimation>(\n ScrollAnimation: typeof AbstractScrollAnimation,\n): BaseDecorator<AnimationScrollWithEaseInterface, S, AnimationScrollWithEaseProps> {\n class AnimationScrollWithEase extends ScrollAnimation<AnimationScrollWithEaseProps> {\n /**\n * Config.\n */\n static config: BaseConfig = {\n ...ScrollAnimation.config,\n name: `${ScrollAnimation.config.name}WithEase`,\n options: {\n ...ScrollAnimation.config.options,\n ease: {\n type: String,\n default: 'outExpo',\n },\n },\n };\n\n /**\n * Eases the progress value.\n */\n render(progress: number) {\n if (typeof eases[this.$options.ease] === 'function') {\n // eslint-disable-next-line no-param-reassign\n progress = eases[this.$options.ease](progress);\n }\n\n super.render(progress);\n }\n }\n\n // @ts-ignore\n return AnimationScrollWithEase;\n}\n"],
|
|
5
|
-
"mappings": "AACA,SAAS,
|
|
4
|
+
"sourcesContent": ["import type { BaseConfig, BaseProps, BaseDecorator, BaseInterface } from '@studiometa/js-toolkit';\nimport { ease, isDev } from '@studiometa/js-toolkit/utils';\nimport type { AbstractScrollAnimation } from './AbstractScrollAnimation.js';\n\nconst regex = /ease([A-Z])/;\nconst eases = Object.fromEntries(\n Object.entries(ease)\n .filter(([name]) => name.startsWith('ease'))\n .map(([name, value]) => [name.replace(regex, (match, $1) => $1.toLowerCase()), value]),\n);\n\nexport interface AnimationScrollWithEaseProps extends BaseProps {\n $options: {\n ease: string;\n };\n}\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface AnimationScrollWithEaseInterface extends BaseInterface {}\n\n/**\n * Extend a `ScrollAnimation` component to use easings.\n *\n * @deprecated This decorator is deprecated. Easing can be applied directly via CSS or animation options.\n */\nexport function animationScrollWithEase<S extends AbstractScrollAnimation>(\n ScrollAnimation: typeof AbstractScrollAnimation,\n): BaseDecorator<AnimationScrollWithEaseInterface, S, AnimationScrollWithEaseProps> {\n class AnimationScrollWithEase extends ScrollAnimation<AnimationScrollWithEaseProps> {\n /**\n * Config.\n */\n static config: BaseConfig = {\n ...ScrollAnimation.config,\n name: `${ScrollAnimation.config.name}WithEase`,\n options: {\n ...ScrollAnimation.config.options,\n ease: {\n type: String,\n default: 'outExpo',\n },\n },\n };\n\n /**\n * Display a deprecation warning.\n */\n mounted() {\n if (isDev) {\n console.warn(\n `The animationScrollWithEase decorator is deprecated.`,\n '\\nEasing can be applied directly via CSS or animation options.',\n );\n }\n }\n\n /**\n * Eases the progress value.\n */\n render(progress: number) {\n if (typeof eases[this.$options.ease] === 'function') {\n // eslint-disable-next-line no-param-reassign\n progress = eases[this.$options.ease](progress);\n }\n\n super.render(progress);\n }\n }\n\n // @ts-ignore\n return AnimationScrollWithEase;\n}\n"],
|
|
5
|
+
"mappings": "AACA,SAAS,MAAM,aAAa;AAG5B,MAAM,QAAQ;AACd,MAAM,QAAQ,OAAO;AAAA,EACnB,OAAO,QAAQ,IAAI,EAChB,OAAO,CAAC,CAAC,IAAI,MAAM,KAAK,WAAW,MAAM,CAAC,EAC1C,IAAI,CAAC,CAAC,MAAM,KAAK,MAAM,CAAC,KAAK,QAAQ,OAAO,CAAC,OAAO,OAAO,GAAG,YAAY,CAAC,GAAG,KAAK,CAAC;AACzF;AAgBO,SAAS,wBACd,iBACkF;AAAA,EAClF,MAAM,gCAAgC,gBAA8C;AAAA;AAAA;AAAA;AAAA,IAIlF,OAAO,SAAqB;AAAA,MAC1B,GAAG,gBAAgB;AAAA,MACnB,MAAM,GAAG,gBAAgB,OAAO,IAAI;AAAA,MACpC,SAAS;AAAA,QACP,GAAG,gBAAgB,OAAO;AAAA,QAC1B,MAAM;AAAA,UACJ,MAAM;AAAA,UACN,SAAS;AAAA,QACX;AAAA,MACF;AAAA,IACF;AAAA;AAAA;AAAA;AAAA,IAKA,UAAU;AACR,UAAI,OAAO;AACT,gBAAQ;AAAA,UACN;AAAA,UACA;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA;AAAA;AAAA;AAAA,IAKA,OAAO,UAAkB;AACvB,UAAI,OAAO,MAAM,KAAK,SAAS,IAAI,MAAM,YAAY;AAEnD,mBAAW,MAAM,KAAK,SAAS,IAAI,EAAE,QAAQ;AAAA,MAC/C;AAEA,YAAM,OAAO,QAAQ;AAAA,IACvB;AAAA,EACF;AAGA,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
export * from './AbstractScrollAnimation.js';
|
|
2
|
+
export * from './ScrollAnimationTimeline.js';
|
|
3
|
+
export * from './ScrollAnimationTarget.js';
|
|
4
|
+
export * from './withScrollAnimationDebug.js';
|
|
2
5
|
export * from './animationScrollWithEase.js';
|
|
3
6
|
export * from './ScrollAnimation.js';
|
|
4
7
|
export * from './ScrollAnimationWithEase.js';
|
package/ScrollAnimation/index.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
export * from "./AbstractScrollAnimation.js";
|
|
2
|
+
export * from "./ScrollAnimationTimeline.js";
|
|
3
|
+
export * from "./ScrollAnimationTarget.js";
|
|
4
|
+
export * from "./withScrollAnimationDebug.js";
|
|
2
5
|
export * from "./animationScrollWithEase.js";
|
|
3
6
|
export * from "./ScrollAnimation.js";
|
|
4
7
|
export * from "./ScrollAnimationWithEase.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../packages/ui/ScrollAnimation/index.ts"],
|
|
4
|
-
"sourcesContent": ["export * from './AbstractScrollAnimation.js';\nexport * from './animationScrollWithEase.js';\nexport * from './ScrollAnimation.js';\nexport * from './ScrollAnimationWithEase.js';\nexport * from './ScrollAnimationChild.js';\nexport * from './ScrollAnimationChildWithEase.js';\nexport * from './ScrollAnimationParent.js';\n"],
|
|
5
|
-
"mappings": "AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;",
|
|
4
|
+
"sourcesContent": ["export * from './AbstractScrollAnimation.js';\nexport * from './ScrollAnimationTimeline.js';\nexport * from './ScrollAnimationTarget.js';\nexport * from './withScrollAnimationDebug.js';\n\n// Deprecated exports\nexport * from './animationScrollWithEase.js';\nexport * from './ScrollAnimation.js';\nexport * from './ScrollAnimationWithEase.js';\nexport * from './ScrollAnimationChild.js';\nexport * from './ScrollAnimationChildWithEase.js';\nexport * from './ScrollAnimationParent.js';\n"],
|
|
5
|
+
"mappings": "AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AAGd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { Base, BaseProps, BaseInterface, BaseDecorator } from '@studiometa/js-toolkit';
|
|
2
|
+
export interface WithScrollAnimationDebugProps extends BaseProps {
|
|
3
|
+
$options: {
|
|
4
|
+
debug: boolean;
|
|
5
|
+
offset: string;
|
|
6
|
+
};
|
|
7
|
+
}
|
|
8
|
+
export interface WithScrollAnimationDebugInterface extends BaseInterface {
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Add debug capabilities to a ScrollAnimationTimeline component.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```js
|
|
15
|
+
* import { ScrollAnimationTimeline } from '@studiometa/ui';
|
|
16
|
+
* import { withScrollAnimationDebug } from '@studiometa/ui/ScrollAnimation/withScrollAnimationDebug';
|
|
17
|
+
*
|
|
18
|
+
* class App extends Base {
|
|
19
|
+
* static config = {
|
|
20
|
+
* name: 'App',
|
|
21
|
+
* components: {
|
|
22
|
+
* ScrollAnimationTimeline: withScrollAnimationDebug(ScrollAnimationTimeline),
|
|
23
|
+
* },
|
|
24
|
+
* };
|
|
25
|
+
* }
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export declare function withScrollAnimationDebug<S extends Base>(BaseClass: typeof Base): BaseDecorator<WithScrollAnimationDebugInterface, S, WithScrollAnimationDebugProps>;
|