@studiometa/ui 0.2.2 → 0.2.5

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.
Files changed (148) hide show
  1. package/atoms/AnchorScrollTo/AnchorScrollTo.cjs +8 -13
  2. package/atoms/AnchorScrollTo/AnchorScrollTo.js +1 -26
  3. package/atoms/Cursor/Cursor.cjs +14 -22
  4. package/atoms/Cursor/Cursor.d.ts +2 -2
  5. package/atoms/Cursor/Cursor.js +1 -103
  6. package/atoms/Figure/Figure.cjs +20 -16
  7. package/atoms/Figure/Figure.d.ts +19 -1
  8. package/atoms/Figure/Figure.js +1 -27
  9. package/atoms/Figure/FigureTwicPics.cjs +72 -0
  10. package/atoms/Figure/FigureTwicPics.d.ts +48 -0
  11. package/atoms/Figure/FigureTwicPics.js +1 -0
  12. package/atoms/Figure/index.cjs +31 -0
  13. package/atoms/Figure/index.d.ts +2 -0
  14. package/atoms/Figure/index.js +1 -0
  15. package/atoms/LargeText/LargeText.cjs +36 -28
  16. package/atoms/LargeText/LargeText.d.ts +27 -4
  17. package/atoms/LargeText/LargeText.js +1 -48
  18. package/atoms/LazyInclude/LazyInclude.cjs +8 -13
  19. package/atoms/LazyInclude/LazyInclude.d.ts +4 -4
  20. package/atoms/LazyInclude/LazyInclude.js +1 -46
  21. package/atoms/Prefetch/AbstractPrefetch.cjs +8 -13
  22. package/atoms/Prefetch/AbstractPrefetch.d.ts +1 -1
  23. package/atoms/Prefetch/AbstractPrefetch.js +1 -58
  24. package/atoms/Prefetch/PrefetchWhenOver.cjs +12 -34
  25. package/atoms/Prefetch/PrefetchWhenOver.d.ts +1 -1
  26. package/atoms/Prefetch/PrefetchWhenOver.js +1 -35
  27. package/atoms/Prefetch/PrefetchWhenVisible.cjs +12 -34
  28. package/atoms/Prefetch/PrefetchWhenVisible.d.ts +1 -1
  29. package/atoms/Prefetch/PrefetchWhenVisible.js +1 -36
  30. package/atoms/Prefetch/index.cjs +9 -16
  31. package/atoms/Prefetch/index.js +1 -8
  32. package/atoms/ScrollAnimation/AbstractScrollAnimation.cjs +126 -0
  33. package/atoms/ScrollAnimation/AbstractScrollAnimation.d.ts +133 -0
  34. package/atoms/ScrollAnimation/AbstractScrollAnimation.js +1 -0
  35. package/atoms/ScrollAnimation/ScrollAnimation.cjs +51 -0
  36. package/atoms/ScrollAnimation/ScrollAnimation.d.ts +55 -0
  37. package/atoms/ScrollAnimation/ScrollAnimation.js +1 -0
  38. package/atoms/ScrollAnimation/ScrollAnimationChild.cjs +51 -0
  39. package/atoms/ScrollAnimation/ScrollAnimationChild.d.ts +13 -0
  40. package/atoms/ScrollAnimation/ScrollAnimationChild.js +1 -0
  41. package/atoms/ScrollAnimation/ScrollAnimationChildWithEase.cjs +41 -0
  42. package/atoms/ScrollAnimation/ScrollAnimationChildWithEase.d.ts +6 -0
  43. package/atoms/ScrollAnimation/ScrollAnimationChildWithEase.js +1 -0
  44. package/atoms/ScrollAnimation/ScrollAnimationParent.cjs +48 -0
  45. package/atoms/ScrollAnimation/ScrollAnimationParent.d.ts +35 -0
  46. package/atoms/ScrollAnimation/ScrollAnimationParent.js +1 -0
  47. package/atoms/ScrollAnimation/ScrollAnimationWithEase.cjs +41 -0
  48. package/atoms/ScrollAnimation/ScrollAnimationWithEase.d.ts +6 -0
  49. package/atoms/ScrollAnimation/ScrollAnimationWithEase.js +1 -0
  50. package/atoms/ScrollAnimation/animationScrollWithEase.cjs +70 -0
  51. package/atoms/ScrollAnimation/animationScrollWithEase.d.ts +11 -0
  52. package/atoms/ScrollAnimation/animationScrollWithEase.js +1 -0
  53. package/atoms/ScrollAnimation/index.cjs +41 -0
  54. package/atoms/ScrollAnimation/index.d.ts +7 -0
  55. package/atoms/ScrollAnimation/index.js +1 -0
  56. package/atoms/index.cjs +13 -19
  57. package/atoms/index.d.ts +2 -1
  58. package/atoms/index.js +1 -13
  59. package/index.cjs +11 -15
  60. package/index.js +1 -3
  61. package/molecules/Accordion/Accordion.cjs +12 -34
  62. package/molecules/Accordion/Accordion.js +1 -35
  63. package/molecules/Accordion/AccordionCore.cjs +8 -13
  64. package/molecules/Accordion/AccordionCore.d.ts +2 -2
  65. package/molecules/Accordion/AccordionCore.js +1 -34
  66. package/molecules/Accordion/AccordionItem.cjs +70 -114
  67. package/molecules/Accordion/AccordionItem.d.ts +7 -6
  68. package/molecules/Accordion/AccordionItem.js +1 -178
  69. package/molecules/Menu/Menu.cjs +148 -0
  70. package/molecules/Menu/Menu.d.ts +140 -0
  71. package/molecules/Menu/Menu.js +1 -0
  72. package/molecules/Menu/MenuBtn.cjs +53 -0
  73. package/molecules/Menu/MenuBtn.d.ts +39 -0
  74. package/molecules/Menu/MenuBtn.js +1 -0
  75. package/molecules/Menu/MenuList.cjs +134 -0
  76. package/molecules/Menu/MenuList.d.ts +101 -0
  77. package/molecules/Menu/MenuList.js +1 -0
  78. package/molecules/Menu/index.cjs +33 -0
  79. package/molecules/Menu/index.d.ts +3 -0
  80. package/molecules/Menu/index.js +1 -0
  81. package/molecules/Modal/Modal.cjs +42 -71
  82. package/molecules/Modal/Modal.d.ts +5 -5
  83. package/molecules/Modal/Modal.js +1 -150
  84. package/molecules/Modal/ModalWithTransition.cjs +13 -43
  85. package/molecules/Modal/ModalWithTransition.js +1 -69
  86. package/molecules/Panel/Panel.cjs +42 -76
  87. package/molecules/Panel/Panel.js +1 -117
  88. package/molecules/Slider/AbstractSliderChild.cjs +10 -20
  89. package/molecules/Slider/AbstractSliderChild.d.ts +6 -2
  90. package/molecules/Slider/AbstractSliderChild.js +1 -43
  91. package/molecules/Slider/Slider.cjs +14 -24
  92. package/molecules/Slider/Slider.d.ts +6 -6
  93. package/molecules/Slider/Slider.js +1 -209
  94. package/molecules/Slider/SliderBtn.cjs +9 -16
  95. package/molecules/Slider/SliderBtn.d.ts +1 -1
  96. package/molecules/Slider/SliderBtn.js +1 -34
  97. package/molecules/Slider/SliderCount.cjs +9 -16
  98. package/molecules/Slider/SliderCount.js +1 -19
  99. package/molecules/Slider/SliderDots.cjs +9 -16
  100. package/molecules/Slider/SliderDots.js +1 -24
  101. package/molecules/Slider/SliderDrag.cjs +8 -13
  102. package/molecules/Slider/SliderDrag.js +1 -19
  103. package/molecules/Slider/SliderItem.cjs +14 -37
  104. package/molecules/Slider/SliderItem.js +1 -105
  105. package/molecules/Slider/SliderProgress.cjs +9 -16
  106. package/molecules/Slider/SliderProgress.js +1 -23
  107. package/molecules/Slider/index.cjs +9 -16
  108. package/molecules/Slider/index.js +1 -18
  109. package/molecules/Sticky/Sticky.cjs +11 -19
  110. package/molecules/Sticky/Sticky.d.ts +8 -8
  111. package/molecules/Sticky/Sticky.js +1 -107
  112. package/molecules/TableOfContent/TableOfContent.cjs +9 -16
  113. package/molecules/TableOfContent/TableOfContent.d.ts +1 -1
  114. package/molecules/TableOfContent/TableOfContent.js +1 -42
  115. package/molecules/TableOfContent/TableOfContentAnchor.cjs +8 -13
  116. package/molecules/TableOfContent/TableOfContentAnchor.js +1 -39
  117. package/molecules/TableOfContent/index.cjs +9 -16
  118. package/molecules/TableOfContent/index.js +1 -6
  119. package/molecules/Tabs/Tabs.cjs +54 -82
  120. package/molecules/Tabs/Tabs.d.ts +5 -4
  121. package/molecules/Tabs/Tabs.js +1 -126
  122. package/molecules/index.cjs +13 -18
  123. package/molecules/index.d.ts +1 -0
  124. package/molecules/index.js +1 -18
  125. package/organisms/Frame/Frame.cjs +67 -98
  126. package/organisms/Frame/Frame.d.ts +3 -3
  127. package/organisms/Frame/Frame.js +1 -171
  128. package/organisms/Frame/FrameAnchor.cjs +8 -13
  129. package/organisms/Frame/FrameAnchor.js +1 -22
  130. package/organisms/Frame/FrameForm.cjs +8 -13
  131. package/organisms/Frame/FrameForm.js +1 -22
  132. package/organisms/Frame/FrameTarget.cjs +31 -73
  133. package/organisms/Frame/FrameTarget.js +1 -109
  134. package/organisms/Frame/index.cjs +9 -16
  135. package/organisms/Frame/index.js +1 -10
  136. package/organisms/index.cjs +9 -13
  137. package/organisms/index.js +1 -1
  138. package/package.json +3 -4
  139. package/primitives/Draggable/Draggable.cjs +15 -28
  140. package/primitives/Draggable/Draggable.d.ts +0 -5
  141. package/primitives/Draggable/Draggable.js +1 -38
  142. package/primitives/Sentinel/Sentinel.cjs +8 -13
  143. package/primitives/Sentinel/Sentinel.js +1 -15
  144. package/primitives/Transition/Transition.cjs +12 -17
  145. package/primitives/Transition/Transition.d.ts +2 -4
  146. package/primitives/Transition/Transition.js +1 -45
  147. package/primitives/index.cjs +9 -16
  148. package/primitives/index.js +1 -8
@@ -1,8 +1 @@
1
- import { default as default2 } from "./AbstractPrefetch.js";
2
- import { default as default3 } from "./PrefetchWhenOver.js";
3
- import { default as default4 } from "./PrefetchWhenVisible.js";
4
- export {
5
- default2 as AbstractPrefetch,
6
- default3 as PrefetchWhenOver,
7
- default4 as PrefetchWhenVisible
8
- };
1
+ import{default as t}from"./AbstractPrefetch.js";import{default as a}from"./PrefetchWhenOver.js";import{default as h}from"./PrefetchWhenVisible.js";export{t as AbstractPrefetch,a as PrefetchWhenOver,h as PrefetchWhenVisible};
@@ -0,0 +1,126 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var __publicField = (obj, key, value) => {
20
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
21
+ return value;
22
+ };
23
+
24
+ // packages/ui/atoms/ScrollAnimation/AbstractScrollAnimation.js
25
+ var AbstractScrollAnimation_exports = {};
26
+ __export(AbstractScrollAnimation_exports, {
27
+ default: () => AbstractScrollAnimation
28
+ });
29
+ module.exports = __toCommonJS(AbstractScrollAnimation_exports);
30
+ var import_js_toolkit = require("@studiometa/js-toolkit");
31
+ var import_utils = require("@studiometa/js-toolkit/utils");
32
+ function getDefaults() {
33
+ return {
34
+ x: 0,
35
+ y: 0,
36
+ z: 0,
37
+ scale: 1,
38
+ scaleX: 1,
39
+ scaleY: 1,
40
+ rotate: 0,
41
+ skewX: 0,
42
+ skewY: 0,
43
+ opacity: 1
44
+ };
45
+ }
46
+ var AbstractScrollAnimation = class extends (0, import_js_toolkit.withFreezedOptions)(import_js_toolkit.Base) {
47
+ get target() {
48
+ return this.$el;
49
+ }
50
+ get has() {
51
+ const has = {
52
+ x: false,
53
+ y: false,
54
+ z: false,
55
+ scale: false,
56
+ scaleX: false,
57
+ scaleY: false,
58
+ rotate: false,
59
+ skewX: false,
60
+ skewY: false,
61
+ opacity: false,
62
+ transform: false
63
+ };
64
+ Object.keys(this.$options.from).forEach((key) => {
65
+ has[key] = this.$options.from[key] !== this.$options.to[key];
66
+ });
67
+ has.transform = Object.keys(has).filter((key) => key !== "opacity" && key !== "transform").some((key) => has[key]);
68
+ Object.defineProperty(this, "has", { value: has });
69
+ return has;
70
+ }
71
+ scrolledInView(props) {
72
+ if (!this.has.opacity && !this.has.transform) {
73
+ return;
74
+ }
75
+ const progress = (0, import_utils.map)((0, import_utils.clamp)(props.dampedProgress.y, this.$options.playRange[0], this.$options.playRange[1]), this.$options.playRange[0], this.$options.playRange[1], 0, 1);
76
+ this.render(progress);
77
+ }
78
+ render(progress) {
79
+ if (this.has.opacity) {
80
+ this.target.style.opacity = String((0, import_utils.map)(progress, 0, 1, this.$options.from.opacity, this.$options.to.opacity));
81
+ }
82
+ if (this.has.transform) {
83
+ let transform = (0, import_utils.matrix)({
84
+ translateX: this.has.x ? (0, import_utils.lerp)(this.$options.from.x, this.$options.to.x, progress) : void 0,
85
+ translateY: this.has.y ? (0, import_utils.lerp)(this.$options.from.y, this.$options.to.y, progress) : void 0,
86
+ scaleX: this.has.scale ? (0, import_utils.lerp)(this.$options.from.scale, this.$options.to.scale, progress) : this.has.scaleX ? (0, import_utils.lerp)(this.$options.from.scaleX, this.$options.to.scaleX, progress) : void 0,
87
+ scaleY: this.has.scale ? (0, import_utils.lerp)(this.$options.from.scale, this.$options.to.scale, progress) : this.has.scaleY ? (0, import_utils.lerp)(this.$options.from.scaleY, this.$options.to.scaleY, progress) : void 0,
88
+ skewX: this.has.skewX ? (0, import_utils.lerp)(this.$options.from.skewX, this.$options.to.skewX, progress) : void 0,
89
+ skewY: this.has.skewY ? (0, import_utils.lerp)(this.$options.from.skewY, this.$options.to.skewY, progress) : void 0
90
+ });
91
+ if (this.has.rotate) {
92
+ transform += ` rotate(${(0, import_utils.lerp)(this.$options.from.rotate, this.$options.to.rotate, progress)}deg)`;
93
+ }
94
+ transform += `translateZ(${this.has.z ? (0, import_utils.lerp)(this.$options.from.z, this.$options.to.z, progress) : 0})`;
95
+ this.target.style.transform = transform;
96
+ }
97
+ }
98
+ };
99
+ __publicField(AbstractScrollAnimation, "config", {
100
+ name: "AbstractScrollAnimation",
101
+ options: {
102
+ playRange: {
103
+ type: Array,
104
+ default: () => [0, 1]
105
+ },
106
+ dampFactor: {
107
+ type: Number,
108
+ default: 0.5
109
+ },
110
+ dampPrecision: {
111
+ type: Number,
112
+ default: 1e-3
113
+ },
114
+ from: {
115
+ type: Object,
116
+ default: getDefaults,
117
+ merge: true
118
+ },
119
+ to: {
120
+ type: Object,
121
+ default: getDefaults,
122
+ merge: true
123
+ }
124
+ }
125
+ });
126
+ if (module.exports.default) module.exports = module.exports.default;
@@ -0,0 +1,133 @@
1
+ /**
2
+ * @typedef {AbstractScrollAnimation & {
3
+ * $options: {
4
+ * playRange: string,
5
+ * dampFactor: number,
6
+ * dampPrecision: number,
7
+ * from: AnimationOptions,
8
+ * to: AnimationOptions,
9
+ * },
10
+ * }} ScrollAnimationChildInterface
11
+ */
12
+ /**
13
+ * AbstractScrollAnimation class.
14
+ *
15
+ * @todo add support for magic values in options to access key values:
16
+ * - viewport size
17
+ * - target size
18
+ * - root element size
19
+ * - etc.
20
+ *
21
+ * ```
22
+ * data-option-to="{ x: 100%, y: innerWidth / 2 }"
23
+ * ```
24
+ */
25
+ export default class AbstractScrollAnimation extends Base {
26
+ /**
27
+ * Config.
28
+ */
29
+ static config: {
30
+ name: string;
31
+ options: {
32
+ playRange: {
33
+ type: ArrayConstructor;
34
+ default: () => number[];
35
+ };
36
+ dampFactor: {
37
+ type: NumberConstructor;
38
+ default: number;
39
+ };
40
+ dampPrecision: {
41
+ type: NumberConstructor;
42
+ default: number;
43
+ };
44
+ from: {
45
+ type: ObjectConstructor;
46
+ default: typeof getDefaults;
47
+ merge: boolean;
48
+ };
49
+ to: {
50
+ type: ObjectConstructor;
51
+ default: typeof getDefaults;
52
+ merge: boolean;
53
+ };
54
+ };
55
+ };
56
+ /**
57
+ * Get the target element for the animation.
58
+ *
59
+ * @returns {HTMLElement}
60
+ */
61
+ get target(): HTMLElement;
62
+ /**
63
+ * Flags for style detection.
64
+ */
65
+ get has(): {
66
+ x: boolean;
67
+ y: boolean;
68
+ z: boolean;
69
+ scale: boolean;
70
+ scaleX: boolean;
71
+ scaleY: boolean;
72
+ rotate: boolean;
73
+ skewX: boolean;
74
+ skewY: boolean;
75
+ opacity: boolean;
76
+ transform: boolean;
77
+ };
78
+ /**
79
+ * @todo do not add unnecessary styles
80
+ */
81
+ scrolledInView(props: any): void;
82
+ /**
83
+ * Render the animation for the given progress.
84
+ *
85
+ * @param {number} progress
86
+ * @returns {void}
87
+ */
88
+ render(progress: number): void;
89
+ }
90
+ export type AbstractScrollAnimationConstructor = typeof AbstractScrollAnimation;
91
+ export type AnimationOptions = {
92
+ x?: number;
93
+ y?: number;
94
+ z?: number;
95
+ scale?: number;
96
+ scaleX?: number;
97
+ scaleY?: number;
98
+ rotate?: number;
99
+ skewX?: number;
100
+ skewY?: number;
101
+ opacity?: number;
102
+ };
103
+ export type ScrollAnimationChildInterface = AbstractScrollAnimation & {
104
+ $options: {
105
+ playRange: string;
106
+ dampFactor: number;
107
+ dampPrecision: number;
108
+ from: AnimationOptions;
109
+ to: AnimationOptions;
110
+ };
111
+ };
112
+ import { Base } from "@studiometa/js-toolkit";
113
+ /**
114
+ * @typedef {typeof AbstractScrollAnimation} AbstractScrollAnimationConstructor
115
+ * @typedef {{
116
+ * x?: number;
117
+ * y?: number;
118
+ * z?: number;
119
+ * scale?: number;
120
+ * scaleX?: number;
121
+ * scaleY?: number;
122
+ * rotate?: number;
123
+ * skewX?: number;
124
+ * skewY?: number;
125
+ * opacity?: number;
126
+ * }} AnimationOptions
127
+ */
128
+ /**
129
+ * Get animation configuration defaults.
130
+ * @returns {AnimationOptions}
131
+ */
132
+ declare function getDefaults(): AnimationOptions;
133
+ export {};
@@ -0,0 +1 @@
1
+ import{Base as a,withFreezedOptions as n}from"@studiometa/js-toolkit";import{matrix as h,lerp as e,map as o,clamp as r}from"@studiometa/js-toolkit/utils";function i(){return{x:0,y:0,z:0,scale:1,scaleX:1,scaleY:1,rotate:0,skewX:0,skewY:0,opacity:1}}class l extends n(a){static config={name:"AbstractScrollAnimation",options:{playRange:{type:Array,default:()=>[0,1]},dampFactor:{type:Number,default:.5},dampPrecision:{type:Number,default:.001},from:{type:Object,default:i,merge:!0},to:{type:Object,default:i,merge:!0}}};get target(){return this.$el}get has(){const t={x:!1,y:!1,z:!1,scale:!1,scaleX:!1,scaleY:!1,rotate:!1,skewX:!1,skewY:!1,opacity:!1,transform:!1};return Object.keys(this.$options.from).forEach(s=>{t[s]=this.$options.from[s]!==this.$options.to[s]}),t.transform=Object.keys(t).filter(s=>s!=="opacity"&&s!=="transform").some(s=>t[s]),Object.defineProperty(this,"has",{value:t}),t}scrolledInView(t){if(!this.has.opacity&&!this.has.transform)return;const s=o(r(t.dampedProgress.y,this.$options.playRange[0],this.$options.playRange[1]),this.$options.playRange[0],this.$options.playRange[1],0,1);this.render(s)}render(t){if(this.has.opacity&&(this.target.style.opacity=String(o(t,0,1,this.$options.from.opacity,this.$options.to.opacity))),this.has.transform){let s=h({translateX:this.has.x?e(this.$options.from.x,this.$options.to.x,t):void 0,translateY:this.has.y?e(this.$options.from.y,this.$options.to.y,t):void 0,scaleX:this.has.scale?e(this.$options.from.scale,this.$options.to.scale,t):this.has.scaleX?e(this.$options.from.scaleX,this.$options.to.scaleX,t):void 0,scaleY:this.has.scale?e(this.$options.from.scale,this.$options.to.scale,t):this.has.scaleY?e(this.$options.from.scaleY,this.$options.to.scaleY,t):void 0,skewX:this.has.skewX?e(this.$options.from.skewX,this.$options.to.skewX,t):void 0,skewY:this.has.skewY?e(this.$options.from.skewY,this.$options.to.skewY,t):void 0});this.has.rotate&&(s+=` rotate(${e(this.$options.from.rotate,this.$options.to.rotate,t)}deg)`),s+=`translateZ(${this.has.z?e(this.$options.from.z,this.$options.to.z,t):0})`,this.target.style.transform=s}}}export{l as default};
@@ -0,0 +1,51 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
21
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
22
+ var __publicField = (obj, key, value) => {
23
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
24
+ return value;
25
+ };
26
+
27
+ // packages/ui/atoms/ScrollAnimation/ScrollAnimation.js
28
+ var ScrollAnimation_exports = {};
29
+ __export(ScrollAnimation_exports, {
30
+ default: () => ScrollAnimation
31
+ });
32
+ module.exports = __toCommonJS(ScrollAnimation_exports);
33
+ var import_js_toolkit = require("@studiometa/js-toolkit");
34
+ var import_AbstractScrollAnimation = __toESM(require("./AbstractScrollAnimation.cjs"), 1);
35
+ var ScrollAnimation = class extends (0, import_js_toolkit.withScrolledInView)(import_AbstractScrollAnimation.default, {}) {
36
+ get target() {
37
+ return this.$refs.target;
38
+ }
39
+ get dampFactor() {
40
+ return this.$options.dampFactor;
41
+ }
42
+ get dampPrecision() {
43
+ return this.$options.dampPrecision;
44
+ }
45
+ };
46
+ __publicField(ScrollAnimation, "config", {
47
+ ...import_AbstractScrollAnimation.default.config,
48
+ name: "ScrollAnimation",
49
+ refs: ["target"]
50
+ });
51
+ if (module.exports.default) module.exports = module.exports.default;
@@ -0,0 +1,55 @@
1
+ /**
2
+ * @typedef {ScrollAnimation & { $refs: { target: HTMLElement }}} ScrollAnimationInterface
3
+ */
4
+ /**
5
+ * ScrollAnimation class.
6
+ */
7
+ export default class ScrollAnimation extends AbstractScrollAnimation {
8
+ /**
9
+ * Config.
10
+ */
11
+ static config: {
12
+ name: string;
13
+ refs: string[];
14
+ options: {
15
+ playRange: {
16
+ type: ArrayConstructor;
17
+ default: () => number[];
18
+ };
19
+ dampFactor: {
20
+ type: NumberConstructor;
21
+ default: number;
22
+ };
23
+ dampPrecision: {
24
+ type: NumberConstructor;
25
+ default: number;
26
+ };
27
+ from: {
28
+ type: ObjectConstructor;
29
+ default: () => import("./AbstractScrollAnimation.js").AnimationOptions;
30
+ merge: boolean;
31
+ };
32
+ to: {
33
+ type: ObjectConstructor;
34
+ default: () => import("./AbstractScrollAnimation.js").AnimationOptions;
35
+ merge: boolean;
36
+ };
37
+ };
38
+ };
39
+ /**
40
+ * Get the damp factor from the freezed options.
41
+ * @returns {number}
42
+ */
43
+ get dampFactor(): number;
44
+ /**
45
+ * Get the damp precision from the freezed options.
46
+ * @returns {number}
47
+ */
48
+ get dampPrecision(): number;
49
+ }
50
+ export type ScrollAnimationInterface = ScrollAnimation & {
51
+ $refs: {
52
+ target: HTMLElement;
53
+ };
54
+ };
55
+ import AbstractScrollAnimation from "./AbstractScrollAnimation.js";
@@ -0,0 +1 @@
1
+ import{withScrolledInView as r}from"@studiometa/js-toolkit";import t from"./AbstractScrollAnimation.js";class i extends r(t,{}){static config={...t.config,name:"ScrollAnimation",refs:["target"]};get target(){return this.$refs.target}get dampFactor(){return this.$options.dampFactor}get dampPrecision(){return this.$options.dampPrecision}}export{i as default};
@@ -0,0 +1,51 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
21
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
22
+ var __publicField = (obj, key, value) => {
23
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
24
+ return value;
25
+ };
26
+
27
+ // packages/ui/atoms/ScrollAnimation/ScrollAnimationChild.js
28
+ var ScrollAnimationChild_exports = {};
29
+ __export(ScrollAnimationChild_exports, {
30
+ default: () => ScrollAnimationChild
31
+ });
32
+ module.exports = __toCommonJS(ScrollAnimationChild_exports);
33
+ var import_utils = require("@studiometa/js-toolkit/utils");
34
+ var import_AbstractScrollAnimation = __toESM(require("./AbstractScrollAnimation.cjs"), 1);
35
+ var ScrollAnimationChild = class extends import_AbstractScrollAnimation.default {
36
+ dampedProgress = {
37
+ x: 0,
38
+ y: 0
39
+ };
40
+ scrolledInView(props) {
41
+ this.dampedProgress.y = (0, import_utils.damp)(props.progress.y, this.dampedProgress.y, this.$options.dampFactor, this.$options.dampPrecision);
42
+ this.dampedProgress.x = (0, import_utils.damp)(props.progress.x, this.dampedProgress.x, this.$options.dampFactor, this.$options.dampPrecision);
43
+ props.dampedProgress = this.dampedProgress;
44
+ super.scrolledInView(props);
45
+ }
46
+ };
47
+ __publicField(ScrollAnimationChild, "config", {
48
+ name: "ScrollAnimationChild",
49
+ ...import_AbstractScrollAnimation.default.config
50
+ });
51
+ if (module.exports.default) module.exports = module.exports.default;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * ScrollAnimationChild class.
3
+ */
4
+ export default class ScrollAnimationChild extends AbstractScrollAnimation {
5
+ /**
6
+ * Local damped progress.
7
+ */
8
+ dampedProgress: {
9
+ x: number;
10
+ y: number;
11
+ };
12
+ }
13
+ import AbstractScrollAnimation from "./AbstractScrollAnimation.js";
@@ -0,0 +1 @@
1
+ import{damp as o}from"@studiometa/js-toolkit/utils";import i from"./AbstractScrollAnimation.js";class r extends i{static config={name:"ScrollAnimationChild",...i.config};dampedProgress={x:0,y:0};scrolledInView(s){this.dampedProgress.y=o(s.progress.y,this.dampedProgress.y,this.$options.dampFactor,this.$options.dampPrecision),this.dampedProgress.x=o(s.progress.x,this.dampedProgress.x,this.$options.dampFactor,this.$options.dampPrecision),s.dampedProgress=this.dampedProgress,super.scrolledInView(s)}}export{r as default};
@@ -0,0 +1,41 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
21
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
22
+ var __publicField = (obj, key, value) => {
23
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
24
+ return value;
25
+ };
26
+
27
+ // packages/ui/atoms/ScrollAnimation/ScrollAnimationChildWithEase.js
28
+ var ScrollAnimationChildWithEase_exports = {};
29
+ __export(ScrollAnimationChildWithEase_exports, {
30
+ default: () => ScrollAnimationChildWithEase
31
+ });
32
+ module.exports = __toCommonJS(ScrollAnimationChildWithEase_exports);
33
+ var import_ScrollAnimationChild = __toESM(require("./ScrollAnimationChild.cjs"), 1);
34
+ var import_animationScrollWithEase = __toESM(require("./animationScrollWithEase.cjs"), 1);
35
+ var ScrollAnimationChildWithEase = class extends (0, import_animationScrollWithEase.default)(import_ScrollAnimationChild.default) {
36
+ };
37
+ __publicField(ScrollAnimationChildWithEase, "config", {
38
+ ...import_ScrollAnimationChild.default.config,
39
+ name: "ScrollAnimationChildWithEase"
40
+ });
41
+ if (module.exports.default) module.exports = module.exports.default;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * ScrollAnimationChild class.
3
+ */
4
+ export default class ScrollAnimationChildWithEase extends ScrollAnimationChild {
5
+ }
6
+ import ScrollAnimationChild from "./ScrollAnimationChild.js";
@@ -0,0 +1 @@
1
+ import i from"./ScrollAnimationChild.js";import o from"./animationScrollWithEase.js";class t extends o(i){static config={...i.config,name:"ScrollAnimationChildWithEase"}}export{t as default};
@@ -0,0 +1,48 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
21
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
22
+ var __publicField = (obj, key, value) => {
23
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
24
+ return value;
25
+ };
26
+
27
+ // packages/ui/atoms/ScrollAnimation/ScrollAnimationParent.js
28
+ var ScrollAnimationParent_exports = {};
29
+ __export(ScrollAnimationParent_exports, {
30
+ default: () => ScrollAnimationParent
31
+ });
32
+ module.exports = __toCommonJS(ScrollAnimationParent_exports);
33
+ var import_js_toolkit = require("@studiometa/js-toolkit");
34
+ var import_ScrollAnimationChild = __toESM(require("./ScrollAnimationChild.cjs"), 1);
35
+ var ScrollAnimationParent = class extends (0, import_js_toolkit.withScrolledInView)(import_js_toolkit.Base, {}) {
36
+ scrolledInView(props) {
37
+ this.$children.ScrollAnimationChild.forEach((child) => {
38
+ child.scrolledInView(props);
39
+ });
40
+ }
41
+ };
42
+ __publicField(ScrollAnimationParent, "config", {
43
+ name: "ScrollAnimationParent",
44
+ components: {
45
+ ScrollAnimationChild: import_ScrollAnimationChild.default
46
+ }
47
+ });
48
+ if (module.exports.default) module.exports = module.exports.default;
@@ -0,0 +1,35 @@
1
+ /**
2
+ * @typedef {ScrollAnimationParent & {
3
+ * $children: {
4
+ * ScrollAnimationChild: ScrollAnimationChild[],
5
+ * },
6
+ * }} ScrollAnimationInterface
7
+ */
8
+ /**
9
+ * ScrollAnimationParent class.
10
+ */
11
+ export default class ScrollAnimationParent extends Base {
12
+ /**
13
+ * Config.
14
+ */
15
+ static config: {
16
+ name: string;
17
+ components: {
18
+ ScrollAnimationChild: typeof ScrollAnimationChild;
19
+ };
20
+ };
21
+ /**
22
+ * @todo Optimize default value read
23
+ * @todo do not add unnecessary styles
24
+ * @todo freeze options for better perf
25
+ * @this {ScrollAnimationInterface}
26
+ */
27
+ scrolledInView(this: ScrollAnimationInterface, props: any): void;
28
+ }
29
+ export type ScrollAnimationInterface = ScrollAnimationParent & {
30
+ $children: {
31
+ ScrollAnimationChild: ScrollAnimationChild[];
32
+ };
33
+ };
34
+ import { Base } from "@studiometa/js-toolkit";
35
+ import ScrollAnimationChild from "./ScrollAnimationChild.js";
@@ -0,0 +1 @@
1
+ import{Base as l,withScrolledInView as n}from"@studiometa/js-toolkit";import e from"./ScrollAnimationChild.js";class r extends n(l,{}){static config={name:"ScrollAnimationParent",components:{ScrollAnimationChild:e}};scrolledInView(i){this.$children.ScrollAnimationChild.forEach(o=>{o.scrolledInView(i)})}}export{r as default};
@@ -0,0 +1,41 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
21
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
22
+ var __publicField = (obj, key, value) => {
23
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
24
+ return value;
25
+ };
26
+
27
+ // packages/ui/atoms/ScrollAnimation/ScrollAnimationWithEase.js
28
+ var ScrollAnimationWithEase_exports = {};
29
+ __export(ScrollAnimationWithEase_exports, {
30
+ default: () => ScrollAnimationWithEase
31
+ });
32
+ module.exports = __toCommonJS(ScrollAnimationWithEase_exports);
33
+ var import_ScrollAnimation = __toESM(require("./ScrollAnimation.cjs"), 1);
34
+ var import_animationScrollWithEase = __toESM(require("./animationScrollWithEase.cjs"), 1);
35
+ var ScrollAnimationWithEase = class extends (0, import_animationScrollWithEase.default)(import_ScrollAnimation.default) {
36
+ };
37
+ __publicField(ScrollAnimationWithEase, "config", {
38
+ ...import_ScrollAnimation.default.config,
39
+ name: "ScrollAnimationWithEase"
40
+ });
41
+ if (module.exports.default) module.exports = module.exports.default;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * ScrollAnimation class.
3
+ */
4
+ export default class ScrollAnimationWithEase extends ScrollAnimation {
5
+ }
6
+ import ScrollAnimation from "./ScrollAnimation.js";
@@ -0,0 +1 @@
1
+ import i from"./ScrollAnimation.js";import o from"./animationScrollWithEase.js";class t extends o(i){static config={...i.config,name:"ScrollAnimationWithEase"}}export{t as default};