vevet 5.3.0 → 5.5.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.
Files changed (147) hide show
  1. package/lib/cdn/vevet.iife.min.js +31 -34
  2. package/lib/cjs/components/Cursor/HoverElement/index.js +250 -0
  3. package/lib/cjs/components/Cursor/HoverElement/index.js.map +1 -0
  4. package/lib/cjs/components/Cursor/HoverElement/types.js +3 -0
  5. package/lib/cjs/components/Cursor/HoverElement/types.js.map +1 -0
  6. package/lib/cjs/components/Cursor/Path/index.js +115 -0
  7. package/lib/cjs/components/Cursor/Path/index.js.map +1 -0
  8. package/lib/cjs/components/Cursor/Path/svgQuadraticCurvePath.js.map +1 -0
  9. package/lib/cjs/components/Cursor/Path/types.js +3 -0
  10. package/lib/cjs/components/Cursor/Path/types.js.map +1 -0
  11. package/lib/cjs/components/Cursor/constants.js +5 -0
  12. package/lib/cjs/components/Cursor/constants.js.map +1 -0
  13. package/lib/cjs/components/Cursor/index.js +175 -191
  14. package/lib/cjs/components/Cursor/index.js.map +1 -1
  15. package/lib/cjs/components/Cursor/styles.js +3 -2
  16. package/lib/cjs/components/Cursor/styles.js.map +1 -1
  17. package/lib/cjs/components/Marquee/index.js +46 -22
  18. package/lib/cjs/components/Marquee/index.js.map +1 -1
  19. package/lib/cjs/components/ProgressPreloader/index.js +13 -4
  20. package/lib/cjs/components/ProgressPreloader/index.js.map +1 -1
  21. package/lib/cjs/components/Scrollbar/styles.js +2 -1
  22. package/lib/cjs/components/Scrollbar/styles.js.map +1 -1
  23. package/lib/cjs/components/Snap/index.js +26 -9
  24. package/lib/cjs/components/Snap/index.js.map +1 -1
  25. package/lib/cjs/components/Snap/logic/Swipe/index.js +2 -2
  26. package/lib/cjs/components/Snap/logic/Swipe/index.js.map +1 -1
  27. package/lib/cjs/components/Snap/logic/Track/index.js +20 -18
  28. package/lib/cjs/components/Snap/logic/Track/index.js.map +1 -1
  29. package/lib/cjs/components/Snap/logic/Wheel/index.js +2 -2
  30. package/lib/cjs/components/Snap/logic/Wheel/index.js.map +1 -1
  31. package/lib/cjs/components/Snap/slide/Slide/index.js +9 -9
  32. package/lib/cjs/components/Snap/slide/Slide/index.js.map +1 -1
  33. package/lib/cjs/components/Snap/slide/SlideParallax/index.js +30 -12
  34. package/lib/cjs/components/Snap/slide/SlideParallax/index.js.map +1 -1
  35. package/lib/cjs/internal/isFiniteNumber.js +8 -0
  36. package/lib/cjs/internal/isFiniteNumber.js.map +1 -0
  37. package/lib/cjs/internal/prependStyles.js +14 -0
  38. package/lib/cjs/internal/prependStyles.js.map +1 -0
  39. package/lib/cjs/manifest.json +1 -1
  40. package/lib/esm/components/Cursor/HoverElement/index.js +200 -0
  41. package/lib/esm/components/Cursor/HoverElement/index.js.map +1 -0
  42. package/lib/esm/components/Cursor/HoverElement/types.js +2 -0
  43. package/lib/esm/components/Cursor/HoverElement/types.js.map +1 -0
  44. package/lib/esm/components/Cursor/Path/index.js +97 -0
  45. package/lib/esm/components/Cursor/Path/index.js.map +1 -0
  46. package/lib/esm/components/Cursor/Path/svgQuadraticCurvePath.js.map +1 -0
  47. package/lib/esm/components/Cursor/Path/types.js +2 -0
  48. package/lib/esm/components/Cursor/Path/types.js.map +1 -0
  49. package/lib/esm/components/Cursor/constants.js +2 -0
  50. package/lib/esm/components/Cursor/constants.js.map +1 -0
  51. package/lib/esm/components/Cursor/index.js +171 -200
  52. package/lib/esm/components/Cursor/index.js.map +1 -1
  53. package/lib/esm/components/Cursor/styles.js +5 -7
  54. package/lib/esm/components/Cursor/styles.js.map +1 -1
  55. package/lib/esm/components/Marquee/index.js +46 -22
  56. package/lib/esm/components/Marquee/index.js.map +1 -1
  57. package/lib/esm/components/ProgressPreloader/index.js +9 -4
  58. package/lib/esm/components/ProgressPreloader/index.js.map +1 -1
  59. package/lib/esm/components/Scrollbar/styles.js +3 -2
  60. package/lib/esm/components/Scrollbar/styles.js.map +1 -1
  61. package/lib/esm/components/Snap/index.js +21 -8
  62. package/lib/esm/components/Snap/index.js.map +1 -1
  63. package/lib/esm/components/Snap/logic/Swipe/index.js +2 -2
  64. package/lib/esm/components/Snap/logic/Swipe/index.js.map +1 -1
  65. package/lib/esm/components/Snap/logic/Track/index.js +20 -18
  66. package/lib/esm/components/Snap/logic/Track/index.js.map +1 -1
  67. package/lib/esm/components/Snap/logic/Wheel/index.js +2 -2
  68. package/lib/esm/components/Snap/logic/Wheel/index.js.map +1 -1
  69. package/lib/esm/components/Snap/slide/Slide/index.js +9 -9
  70. package/lib/esm/components/Snap/slide/Slide/index.js.map +1 -1
  71. package/lib/esm/components/Snap/slide/SlideParallax/index.js +30 -12
  72. package/lib/esm/components/Snap/slide/SlideParallax/index.js.map +1 -1
  73. package/lib/esm/internal/isFiniteNumber.js +5 -0
  74. package/lib/esm/internal/isFiniteNumber.js.map +1 -0
  75. package/lib/esm/internal/prependStyles.js +11 -0
  76. package/lib/esm/internal/prependStyles.js.map +1 -0
  77. package/lib/esm/manifest.json +1 -1
  78. package/lib/types/components/Cursor/HoverElement/index.d.ts +60 -0
  79. package/lib/types/components/Cursor/HoverElement/index.d.ts.map +1 -0
  80. package/lib/types/components/Cursor/HoverElement/types.d.ts +60 -0
  81. package/lib/types/components/Cursor/HoverElement/types.d.ts.map +1 -0
  82. package/lib/types/components/Cursor/Path/index.d.ts +26 -0
  83. package/lib/types/components/Cursor/Path/index.d.ts.map +1 -0
  84. package/lib/types/components/Cursor/Path/svgQuadraticCurvePath.d.ts +3 -0
  85. package/lib/types/components/Cursor/Path/svgQuadraticCurvePath.d.ts.map +1 -0
  86. package/lib/types/components/Cursor/Path/types.d.ts +11 -0
  87. package/lib/types/components/Cursor/Path/types.d.ts.map +1 -0
  88. package/lib/types/components/Cursor/constants.d.ts +2 -0
  89. package/lib/types/components/Cursor/constants.d.ts.map +1 -0
  90. package/lib/types/components/Cursor/index.d.ts +47 -59
  91. package/lib/types/components/Cursor/index.d.ts.map +1 -1
  92. package/lib/types/components/Cursor/styles.d.ts.map +1 -1
  93. package/lib/types/components/Cursor/types.d.ts +38 -42
  94. package/lib/types/components/Cursor/types.d.ts.map +1 -1
  95. package/lib/types/components/Marquee/index.d.ts +2 -2
  96. package/lib/types/components/Marquee/index.d.ts.map +1 -1
  97. package/lib/types/components/ProgressPreloader/index.d.ts +2 -0
  98. package/lib/types/components/ProgressPreloader/index.d.ts.map +1 -1
  99. package/lib/types/components/ProgressPreloader/types.d.ts +5 -0
  100. package/lib/types/components/ProgressPreloader/types.d.ts.map +1 -1
  101. package/lib/types/components/Scrollbar/styles.d.ts.map +1 -1
  102. package/lib/types/components/Snap/index.d.ts +6 -1
  103. package/lib/types/components/Snap/index.d.ts.map +1 -1
  104. package/lib/types/components/Snap/logic/Swipe/index.d.ts.map +1 -1
  105. package/lib/types/components/Snap/logic/Track/index.d.ts.map +1 -1
  106. package/lib/types/components/Snap/slide/Slide/index.d.ts.map +1 -1
  107. package/lib/types/components/Snap/slide/SlideParallax/index.d.ts +4 -0
  108. package/lib/types/components/Snap/slide/SlideParallax/index.d.ts.map +1 -1
  109. package/lib/types/components/Snap/slide/SlideParallax/types.d.ts +3 -1
  110. package/lib/types/components/Snap/slide/SlideParallax/types.d.ts.map +1 -1
  111. package/lib/types/components/Snap/types.d.ts +8 -0
  112. package/lib/types/components/Snap/types.d.ts.map +1 -1
  113. package/lib/types/internal/isFiniteNumber.d.ts +2 -0
  114. package/lib/types/internal/isFiniteNumber.d.ts.map +1 -0
  115. package/lib/types/internal/prependStyles.d.ts +2 -0
  116. package/lib/types/internal/prependStyles.d.ts.map +1 -0
  117. package/package.json +1 -1
  118. package/src/components/Cursor/HoverElement/index.ts +283 -0
  119. package/src/components/Cursor/HoverElement/types.ts +75 -0
  120. package/src/components/Cursor/Path/index.ts +128 -0
  121. package/src/components/Cursor/{utils → Path}/svgQuadraticCurvePath.ts +1 -1
  122. package/src/components/Cursor/Path/types.ts +11 -0
  123. package/src/components/Cursor/constants.ts +1 -0
  124. package/src/components/Cursor/index.ts +245 -282
  125. package/src/components/Cursor/styles.ts +5 -7
  126. package/src/components/Cursor/types.ts +41 -45
  127. package/src/components/Marquee/index.ts +50 -23
  128. package/src/components/ProgressPreloader/index.ts +12 -3
  129. package/src/components/ProgressPreloader/types.ts +6 -0
  130. package/src/components/Scrollbar/styles.ts +3 -2
  131. package/src/components/Snap/index.ts +24 -7
  132. package/src/components/Snap/logic/Swipe/index.ts +7 -2
  133. package/src/components/Snap/logic/Track/index.ts +20 -18
  134. package/src/components/Snap/logic/Wheel/index.ts +2 -2
  135. package/src/components/Snap/slide/Slide/index.ts +10 -9
  136. package/src/components/Snap/slide/SlideParallax/index.ts +38 -10
  137. package/src/components/Snap/slide/SlideParallax/types.ts +3 -1
  138. package/src/components/Snap/types.ts +9 -0
  139. package/src/internal/isFiniteNumber.ts +5 -0
  140. package/src/internal/prependStyles.ts +9 -0
  141. package/src/manifest.json +1 -1
  142. package/lib/cjs/components/Cursor/utils/svgQuadraticCurvePath.js.map +0 -1
  143. package/lib/esm/components/Cursor/utils/svgQuadraticCurvePath.js.map +0 -1
  144. package/lib/types/components/Cursor/utils/svgQuadraticCurvePath.d.ts +0 -3
  145. package/lib/types/components/Cursor/utils/svgQuadraticCurvePath.d.ts.map +0 -1
  146. /package/lib/cjs/components/Cursor/{utils → Path}/svgQuadraticCurvePath.js +0 -0
  147. /package/lib/esm/components/Cursor/{utils → Path}/svgQuadraticCurvePath.js +0 -0
@@ -70,15 +70,18 @@ export class SnapSlideParallax {
70
70
  ? this._getScope(element, scopeAttr, [-1, 1])
71
71
  : defaultScope;
72
72
 
73
- const attrValue = element.getAttribute(n) ?? '';
74
- const target = parseFloat(attrValue) || 0;
73
+ const attrValue = this._getAttr(element, n);
75
74
  const unit = attrValue.replace(/[-\d.]+/g, '') || defaultUnit;
75
+ const target = this._getFloatAttr(element, n, 0);
76
76
 
77
- const offsetAttr = `${n}-offset`;
78
- const offset = parseFloat(element.getAttribute(offsetAttr) ?? '') || 0;
77
+ const offset = this._getFloatAttr(element, `${n}-offset`, 0);
78
+ const min = this._getFloatAttr(element, `${n}-min`, -Infinity);
79
+ const max = this._getFloatAttr(element, `${n}-max`, Infinity);
79
80
 
80
81
  const influenceAttr = `${n}-influence`;
81
- const isInfluence = element.hasAttribute(influenceAttr);
82
+ const influence = element.hasAttribute(influenceAttr)
83
+ ? this._getFloatAttr(element, `${n}-influence`, 1)
84
+ : 0;
82
85
 
83
86
  const directionalAttr = `${n}-directional`;
84
87
  const isDirectional = element.hasAttribute(directionalAttr);
@@ -97,7 +100,9 @@ export class SnapSlideParallax {
97
100
  target,
98
101
  value: 0,
99
102
  offset,
100
- isInfluence,
103
+ min,
104
+ max,
105
+ influence,
101
106
  isDirectional,
102
107
  isAbs,
103
108
  };
@@ -105,18 +110,39 @@ export class SnapSlideParallax {
105
110
  );
106
111
  }
107
112
 
113
+ /** Get parallax attribute */
114
+ protected _getAttr(element: HTMLElement, name: string) {
115
+ return element.getAttribute(name) ?? '';
116
+ }
117
+
118
+ /** Get parallax float attribute */
119
+ protected _getFloatAttr(
120
+ element: HTMLElement,
121
+ name: string,
122
+ defaultValue: number,
123
+ ) {
124
+ const float = parseFloat(this._getAttr(element, name));
125
+
126
+ return Number.isNaN(float) ? defaultValue : float;
127
+ }
128
+
108
129
  /** Get parallax scope */
109
130
  protected _getScope(
110
131
  element: HTMLElement,
111
132
  name: string,
112
133
  defaultValue: number[],
113
134
  ) {
114
- const attrValue = element.getAttribute(name) ?? '';
135
+ const attrValue = this._getAttr(element, name);
136
+ const attrStringValue = attrValue.trim().toLowerCase();
115
137
 
116
- if (attrValue.trim().toLowerCase() === 'none') {
138
+ if (attrStringValue === 'none') {
117
139
  return [-Infinity, Infinity];
118
140
  }
119
141
 
142
+ if (attrStringValue === 'const') {
143
+ return [1, 1];
144
+ }
145
+
120
146
  const cleanValue = attrValue.replace(/[\s\\[\]]+/g, '');
121
147
  const minMax = cleanValue.split(',');
122
148
  const minRaw = parseFloat(minMax[0]);
@@ -144,8 +170,8 @@ export class SnapSlideParallax {
144
170
  items.forEach((item) => {
145
171
  let progress = clamp(globalProgress, ...item.scope);
146
172
 
147
- if (item.isInfluence) {
148
- progress *= Math.abs(snap.track.influence);
173
+ if (Math.abs(item.influence) > 0) {
174
+ progress *= Math.abs(snap.track.influence) * item.influence;
149
175
  }
150
176
 
151
177
  if (item.isDirectional) {
@@ -162,6 +188,8 @@ export class SnapSlideParallax {
162
188
  if (item.modifier) {
163
189
  item.value = item.modifier(item.value);
164
190
  }
191
+
192
+ item.value = clamp(item.value, item.min, item.max);
165
193
  });
166
194
 
167
195
  parallaxGroups.forEach(({ name: groupName }) => {
@@ -26,7 +26,9 @@ export interface ISnapSlideParallaxItem extends ISnapSlideParallaxType {
26
26
  target: number;
27
27
  value: number;
28
28
  offset: number;
29
- isInfluence: boolean;
29
+ min: number;
30
+ max: number;
31
+ influence: number;
30
32
  isDirectional: boolean;
31
33
  isAbs: boolean;
32
34
  }
@@ -37,6 +37,15 @@ export interface ISnapMutableProps
37
37
  */
38
38
  slides?: (HTMLElement | SnapSlide)[] | false;
39
39
 
40
+ /**
41
+ * Container size. Supported values:
42
+ * - `auto` detects slide size depending on the container size.
43
+ * - `number` defines the slide size in pixels.
44
+ * - css units like `px`, `rem`, `vw`, `vh`, `svh`.
45
+ * @default 'auto'
46
+ */
47
+ containerSize?: number | 'auto' | (string & {});
48
+
40
49
  /**
41
50
  * Indicates the number of slides to scroll on swipe or wheel.
42
51
  * @default 1
@@ -0,0 +1,5 @@
1
+ import { isNumber } from './isNumber';
2
+
3
+ export function isFiniteNumber(value: any): value is number {
4
+ return isNumber(value) && !Number.isNaN(value) && Number.isFinite(value);
5
+ }
@@ -0,0 +1,9 @@
1
+ export function prependStyles(style: HTMLStyleElement) {
2
+ const firstStyles = document.querySelector('link[rel="stylesheet"], style');
3
+
4
+ if (firstStyles) {
5
+ firstStyles.parentNode?.insertBefore(style, firstStyles);
6
+ } else {
7
+ document.head.appendChild(style);
8
+ }
9
+ }
package/src/manifest.json CHANGED
@@ -1,3 +1,3 @@
1
1
  {
2
- "version": "5.3.0"
2
+ "version": "5.5.0"
3
3
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"svgQuadraticCurvePath.js","sourceRoot":"","sources":["../../../../../src/components/Cursor/utils/svgQuadraticCurvePath.ts"],"names":[],"mappings":";;;AAEO,IAAM,qBAAqB,GAAG,UAAC,MAA0B;IAC9D,IAAI,IAAI,GAAG,WAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,cAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAE,CAAC;IAE5C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;QAC9C,IAAM,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;QACjD,IAAM,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;QAEjD,IAAI,IAAI,YAAK,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,eAAK,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,eAAK,IAAI,eAAK,IAAI,CAAE,CAAC;IAC/D,CAAC;IAED,IAAI,IAAI,YAAK,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,eAAK,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAE,CAAC;IAE3E,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAbW,QAAA,qBAAqB,yBAahC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"svgQuadraticCurvePath.js","sourceRoot":"","sources":["../../../../../src/components/Cursor/utils/svgQuadraticCurvePath.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,MAA0B,EAAE,EAAE;IAClE,IAAI,IAAI,GAAG,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAE5C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;QAC9C,MAAM,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;QACjD,MAAM,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;QAEjD,IAAI,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,IAAI,KAAK,IAAI,EAAE,CAAC;IAC/D,CAAC;IAED,IAAI,IAAI,KAAK,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAE3E,OAAO,IAAI,CAAC;AACd,CAAC,CAAC"}
@@ -1,3 +0,0 @@
1
- import { ICursorPathPoint } from '../types';
2
- export declare const svgQuadraticCurvePath: (points: ICursorPathPoint[]) => string;
3
- //# sourceMappingURL=svgQuadraticCurvePath.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"svgQuadraticCurvePath.d.ts","sourceRoot":"","sources":["../../../../../src/components/Cursor/utils/svgQuadraticCurvePath.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAE5C,eAAO,MAAM,qBAAqB,WAAY,gBAAgB,EAAE,WAa/D,CAAC"}