@matteodicristofalo/text-animations 1.1.0 → 1.1.1
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/dist/index.css +12 -0
- package/dist/index.js +17 -13
- package/package.json +1 -1
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;
|
|
@@ -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,15 @@ 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) { return (React.createElement("span", { key: i, className: styles$1["container"], "aria-hidden": "true" },
|
|
127
|
+
React.createElement("span", { "aria-hidden": "true", style: {
|
|
128
|
+
"--var-delay": "".concat(round(transitionStagger * i, 3), "s"),
|
|
129
|
+
} }, el))); }))) : (React.createElement("span", { className: styles$1["is-hidden"] }, text))));
|
|
128
130
|
}
|
|
129
131
|
|
|
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"};
|
|
132
|
+
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
133
|
|
|
132
134
|
var DEFAULT_DURATION = 0.25;
|
|
133
135
|
var DEFAULT_STAGGER = 0.025;
|
|
@@ -151,13 +153,15 @@ function SplitTextRotate(_a) {
|
|
|
151
153
|
}, []);
|
|
152
154
|
return (React.createElement("span", { className: styles["text"], style: {
|
|
153
155
|
"--var-duration": "".concat(transitionDuration, "s"),
|
|
154
|
-
} }, hasBeenMounted ? (
|
|
155
|
-
|
|
156
|
-
return (React.createElement("span", { key: i, className: styles["
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
156
|
+
} }, hasBeenMounted ? (React.createElement(React.Fragment, null,
|
|
157
|
+
React.createElement("span", { className: styles["sr-only"] }, text),
|
|
158
|
+
Array.from({ length: 2 }).map(function (_, i) { return (React.createElement("span", { key: i, className: styles["container"], "aria-hidden": "true" }, splittedText.map(function (char, i) {
|
|
159
|
+
var charDelays = delays(i);
|
|
160
|
+
return (React.createElement("span", { key: i, className: styles["char"], "aria-hidden": "true", style: {
|
|
161
|
+
"--var-delay-in": "".concat(charDelays.in, "s"),
|
|
162
|
+
"--var-delay-out": "".concat(charDelays.out, "s"),
|
|
163
|
+
} }, char));
|
|
164
|
+
}))); }))) : (React.createElement("span", null, text))));
|
|
161
165
|
}
|
|
162
166
|
|
|
163
167
|
export { SplitTextReveal, SplitTextRotate };
|