@matteodicristofalo/text-animations 1.1.0 → 1.1.2
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.
|
@@ -30,6 +30,7 @@ export declare const Default: Story;
|
|
|
30
30
|
export declare const SplitByWord: Story;
|
|
31
31
|
export declare const SplitBySentence: Story;
|
|
32
32
|
export declare const Duration: Story;
|
|
33
|
+
export declare const Delay: Story;
|
|
33
34
|
export declare const Stagger: Story;
|
|
34
35
|
export declare const Threshold: Story;
|
|
35
36
|
export declare const NotOnce: Story;
|
package/dist/index.css
CHANGED
|
@@ -4,6 +4,12 @@
|
|
|
4
4
|
.split-text-reveal-module_text__-9O5o .split-text-reveal-module_is-hidden__2J8-i {
|
|
5
5
|
opacity: 0;
|
|
6
6
|
}
|
|
7
|
+
.split-text-reveal-module_text__-9O5o .split-text-reveal-module_sr-only__luZuY {
|
|
8
|
+
height: 0;
|
|
9
|
+
overflow: hidden;
|
|
10
|
+
position: absolute;
|
|
11
|
+
width: 0;
|
|
12
|
+
}
|
|
7
13
|
.split-text-reveal-module_text__-9O5o .split-text-reveal-module_container__mkD-P {
|
|
8
14
|
display: inline-flex;
|
|
9
15
|
overflow: hidden;
|
|
@@ -11,7 +17,7 @@
|
|
|
11
17
|
.split-text-reveal-module_text__-9O5o .split-text-reveal-module_container__mkD-P span {
|
|
12
18
|
min-width: 0.25em;
|
|
13
19
|
transform: translateY(100%);
|
|
14
|
-
transition-delay: var(--var-delay);
|
|
20
|
+
transition-delay: calc(var(--var-delay) + var(--var-stagger));
|
|
15
21
|
transition-duration: var(--var-duration);
|
|
16
22
|
transition-property: transform;
|
|
17
23
|
transition-timing-function: ease-out;
|
|
@@ -25,6 +31,12 @@
|
|
|
25
31
|
overflow: hidden;
|
|
26
32
|
position: relative;
|
|
27
33
|
}
|
|
34
|
+
.split-text-rotate-module_text__xzran .split-text-rotate-module_sr-only__Dbb9O {
|
|
35
|
+
height: 0;
|
|
36
|
+
overflow: hidden;
|
|
37
|
+
position: absolute;
|
|
38
|
+
width: 0;
|
|
39
|
+
}
|
|
28
40
|
.split-text-rotate-module_text__xzran .split-text-rotate-module_container__EAJkE {
|
|
29
41
|
display: flex;
|
|
30
42
|
}
|
package/dist/index.js
CHANGED
|
@@ -80,7 +80,7 @@ function useIntersectionObserver(ref, options) {
|
|
|
80
80
|
|
|
81
81
|
function r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=" "),n+=f);}else for(f in e)e[f]&&(n&&(n+=" "),n+=f);return n}function clsx(){for(var e,t,f=0,n="",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=r(e))&&(n&&(n+=" "),n+=t);return n}
|
|
82
82
|
|
|
83
|
-
var styles$1 = {"text":"split-text-reveal-module_text__-9O5o","is-hidden":"split-text-reveal-module_is-hidden__2J8-i","container":"split-text-reveal-module_container__mkD-P","animate":"split-text-reveal-module_animate__y6o78"};
|
|
83
|
+
var styles$1 = {"text":"split-text-reveal-module_text__-9O5o","is-hidden":"split-text-reveal-module_is-hidden__2J8-i","sr-only":"split-text-reveal-module_sr-only__luZuY","container":"split-text-reveal-module_container__mkD-P","animate":"split-text-reveal-module_animate__y6o78"};
|
|
84
84
|
|
|
85
85
|
var DEFAULT_DURATION$1 = 0.5;
|
|
86
86
|
var DEFAULT_STAGGER$1 = 0.01;
|
|
@@ -121,13 +121,19 @@ function SplitTextReveal(_a) {
|
|
|
121
121
|
}, []);
|
|
122
122
|
return (React.createElement("span", { ref: ref, className: clsx(styles$1["text"], (_b = {}, _b[styles$1["animate"]] = isInView, _b)), style: {
|
|
123
123
|
"--var-duration": "".concat(transitionDuration, "s"),
|
|
124
|
-
} }, hasBeenMounted ? (
|
|
125
|
-
React.createElement("span", {
|
|
126
|
-
|
|
127
|
-
|
|
124
|
+
} }, hasBeenMounted ? (React.createElement(React.Fragment, null,
|
|
125
|
+
React.createElement("span", { className: styles$1["sr-only"] }, text),
|
|
126
|
+
splittedText.map(function (el, i) {
|
|
127
|
+
var _a;
|
|
128
|
+
return (React.createElement("span", { key: i, className: styles$1["container"], "aria-hidden": "true" },
|
|
129
|
+
React.createElement("span", { "aria-hidden": "true", style: {
|
|
130
|
+
"--var-delay": "".concat((_a = revealOptions === null || revealOptions === void 0 ? void 0 : revealOptions.delay) !== null && _a !== void 0 ? _a : 0, "s"),
|
|
131
|
+
"--var-stagger": "".concat(round(transitionStagger * i, 3), "s"),
|
|
132
|
+
} }, el)));
|
|
133
|
+
}))) : (React.createElement("span", { className: styles$1["is-hidden"] }, text))));
|
|
128
134
|
}
|
|
129
135
|
|
|
130
|
-
var styles = {"text":"split-text-rotate-module_text__xzran","container":"split-text-rotate-module_container__EAJkE","char":"split-text-rotate-module_char__PYJ-k"};
|
|
136
|
+
var styles = {"text":"split-text-rotate-module_text__xzran","sr-only":"split-text-rotate-module_sr-only__Dbb9O","container":"split-text-rotate-module_container__EAJkE","char":"split-text-rotate-module_char__PYJ-k"};
|
|
131
137
|
|
|
132
138
|
var DEFAULT_DURATION = 0.25;
|
|
133
139
|
var DEFAULT_STAGGER = 0.025;
|
|
@@ -151,13 +157,15 @@ function SplitTextRotate(_a) {
|
|
|
151
157
|
}, []);
|
|
152
158
|
return (React.createElement("span", { className: styles["text"], style: {
|
|
153
159
|
"--var-duration": "".concat(transitionDuration, "s"),
|
|
154
|
-
} }, hasBeenMounted ? (
|
|
155
|
-
|
|
156
|
-
return (React.createElement("span", { key: i, className: styles["
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
160
|
+
} }, hasBeenMounted ? (React.createElement(React.Fragment, null,
|
|
161
|
+
React.createElement("span", { className: styles["sr-only"] }, text),
|
|
162
|
+
Array.from({ length: 2 }).map(function (_, i) { return (React.createElement("span", { key: i, className: styles["container"], "aria-hidden": "true" }, splittedText.map(function (char, i) {
|
|
163
|
+
var charDelays = delays(i);
|
|
164
|
+
return (React.createElement("span", { key: i, className: styles["char"], "aria-hidden": "true", style: {
|
|
165
|
+
"--var-delay-in": "".concat(charDelays.in, "s"),
|
|
166
|
+
"--var-delay-out": "".concat(charDelays.out, "s"),
|
|
167
|
+
} }, char));
|
|
168
|
+
}))); }))) : (React.createElement("span", null, text))));
|
|
161
169
|
}
|
|
162
170
|
|
|
163
171
|
export { SplitTextReveal, SplitTextRotate };
|