@@ -50,7 +50,44 @@ function __rest(s, e) {
5050function __makeTemplateObject ( cooked , raw ) {
5151 if ( Object . defineProperty ) { Object . defineProperty ( cooked , "raw" , { value : raw } ) ; } else { cooked . raw = raw ; }
5252 return cooked ;
53- } var PREDEFINED_ANIMATIONS = {
53+ } var splitChildrenToFragments = function ( children ) {
54+ return children . toString ( ) . split ( ' ' ) ;
55+ } ;
56+ var concatFragments = function ( children ) {
57+ var _a ;
58+ var splittedChildren = splitChildrenToFragments ( children ) ;
59+ return ( _a = [ ] )
60+ . concat . apply ( _a , splittedChildren . map ( function ( word , index ) {
61+ return index !== 0 ? [ WHITE_SPACE_CODE , word ] : [ word ] ;
62+ } ) ) . map ( function ( word ) { return ( word === ' ' ? WHITE_SPACE_CODE : word ) ; } ) ;
63+ } ; var AnimatedFragment = styled__default [ "default" ] . span ( templateObject_1 || ( templateObject_1 = __makeTemplateObject ( [ "\n position: relative;\n display: inline-block;\n visibility: hidden;\n" ] , [ "\n position: relative;\n display: inline-block;\n visibility: hidden;\n" ] ) ) ) ;
64+ var StyledWrapper = styled__default [ "default" ] . div ( templateObject_3 || ( templateObject_3 = __makeTemplateObject ( [ "\n @keyframes fragmentletter-" , " {\n 0% {\n opacity: 0;\n visibility: hidden;\n transform: translateX(" , ")\n translateY(" , ")\n scale(" , ");\n }\n 100% {\n oapcity: 1;\n visibility: visible;\n transform: translateX(0) translateY(0) scale(1);\n }\n }\n\n & > span {\n display: inline-block;\n }\n\n & " , " {\n text-decoration: inherit;\n vertical-align: inherit;\n\n animation: " , ";\n\n animation-name: " , ";\n }\n\n " , "\n" ] , [ "\n @keyframes fragmentletter-" , " {\n 0% {\n opacity: 0;\n visibility: hidden;\n transform: translateX(" , ")\n translateY(" , ")\n scale(" , ");\n }\n 100% {\n oapcity: 1;\n visibility: visible;\n transform: translateX(0) translateY(0) scale(1);\n }\n }\n\n & > span {\n display: inline-block;\n }\n\n & " , " {\n text-decoration: inherit;\n vertical-align: inherit;\n\n animation: " , ";\n\n animation-name: " , ";\n }\n\n " , "\n" ] ) ) , function ( _a ) {
65+ var uid = _a . uid ;
66+ return uid ;
67+ } , function ( _a ) {
68+ var x = _a . animation . x ;
69+ return x !== null && x !== void 0 ? x : 0 ;
70+ } , function ( _a ) {
71+ var y = _a . animation . y ;
72+ return y !== null && y !== void 0 ? y : 0 ;
73+ } , function ( _a ) {
74+ var scale = _a . animation . scale ;
75+ return scale !== null && scale !== void 0 ? scale : 1 ;
76+ } , AnimatedFragment , function ( _a ) {
77+ var ease = _a . animation . ease , duration = _a . duration ;
78+ return "" . concat ( duration , "s " ) . concat ( ease !== null && ease !== void 0 ? ease : 'ease-in-out' , " forwards;" ) ;
79+ } , function ( _a ) {
80+ var shouldAnimate = _a . shouldAnimate , uid = _a . uid ;
81+ return shouldAnimate ? "fragmentletter-" . concat ( uid ) : '' ;
82+ } , function ( _a ) {
83+ var _b = _a . count , count = _b === void 0 ? 0 : _b , interval = _a . interval ;
84+ var styles = '' ;
85+ for ( var i = 0 ; i < count ; i += 1 ) {
86+ styles += "" . concat ( AnimatedFragment , ":nth-of-type(" ) . concat ( i + 1 , ") {\n animation-delay: " ) . concat ( ( interval || 0.04 ) * i , "s;\n }" ) ;
87+ }
88+ return styled . css ( templateObject_2 || ( templateObject_2 = __makeTemplateObject ( [ "\n " , "\n " ] , [ "\n " , "\n " ] ) ) , styles ) ;
89+ } ) ;
90+ var templateObject_1 , templateObject_2 , templateObject_3 ; var PREDEFINED_ANIMATIONS = {
5491 blocks : {
5592 y : '60px' ,
5693 interval : 0.07 ,
@@ -102,44 +139,8 @@ var DEFAULT_ANIMATION = {
102139} ;
103140var DEFAULT_TAG = 'div' ;
104141var DEFAULT_INTESECTION_OBSERVER_ROOT_MARGIN = '20%' ;
105- var DEFAULT_THRESHOLD = 0 ; var splitChildrenToFragments = function ( children ) {
106- return children . toString ( ) . split ( ' ' ) ;
107- } ;
108- var concatFragments = function ( children ) {
109- var _a ;
110- var splittedChildren = splitChildrenToFragments ( children ) ;
111- return ( _a = [ ] )
112- . concat . apply ( _a , splittedChildren . map ( function ( word , index ) {
113- return index !== 0 ? [ WHITE_SPACE_CODE , word ] : [ word ] ;
114- } ) ) . map ( function ( word ) { return ( word === ' ' ? WHITE_SPACE_CODE : word ) ; } ) ;
115- } ; var AnimatedFragment = styled__default [ "default" ] . span ( templateObject_1 || ( templateObject_1 = __makeTemplateObject ( [ "\n position: relative;\n display: inline-block;\n visibility: hidden;\n" ] , [ "\n position: relative;\n display: inline-block;\n visibility: hidden;\n" ] ) ) ) ;
116- var StyledWrapper = styled__default [ "default" ] . div ( templateObject_3 || ( templateObject_3 = __makeTemplateObject ( [ "\n @keyframes fragmentletter-" , " {\n 0% {\n opacity: 0;\n visibility: hidden;\n transform: translateX(" , ")\n translateY(" , ")\n scale(" , ");\n }\n 100% {\n oapcity: 1;\n visibility: visible;\n transform: translateX(0) translateY(0) scale(1);\n }\n }\n\n & > span {\n display: inline-block;\n }\n\n & " , " {\n text-decoration: inherit;\n vertical-align: inherit;\n\n animation: " , ";\n\n animation-name: " , ";\n }\n\n " , "\n" ] , [ "\n @keyframes fragmentletter-" , " {\n 0% {\n opacity: 0;\n visibility: hidden;\n transform: translateX(" , ")\n translateY(" , ")\n scale(" , ");\n }\n 100% {\n oapcity: 1;\n visibility: visible;\n transform: translateX(0) translateY(0) scale(1);\n }\n }\n\n & > span {\n display: inline-block;\n }\n\n & " , " {\n text-decoration: inherit;\n vertical-align: inherit;\n\n animation: " , ";\n\n animation-name: " , ";\n }\n\n " , "\n" ] ) ) , function ( _a ) {
117- var uid = _a . uid ;
118- return uid ;
119- } , function ( _a ) {
120- var x = _a . animation . x ;
121- return x !== null && x !== void 0 ? x : 0 ;
122- } , function ( _a ) {
123- var y = _a . animation . y ;
124- return y !== null && y !== void 0 ? y : 0 ;
125- } , function ( _a ) {
126- var scale = _a . animation . scale ;
127- return scale !== null && scale !== void 0 ? scale : 1 ;
128- } , AnimatedFragment , function ( _a ) {
129- var ease = _a . animation . ease , duration = _a . duration ;
130- return "" . concat ( duration , "s " ) . concat ( ease !== null && ease !== void 0 ? ease : 'ease-in-out' , " forwards;" ) ;
131- } , function ( _a ) {
132- var shouldAnimate = _a . shouldAnimate , uid = _a . uid ;
133- return shouldAnimate ? "fragmentletter-" . concat ( uid ) : '' ;
134- } , function ( _a ) {
135- var _b = _a . count , count = _b === void 0 ? 0 : _b , interval = _a . interval ;
136- var styles = '' ;
137- for ( var i = 0 ; i < count ; i += 1 ) {
138- styles += "" . concat ( AnimatedFragment , ":nth-of-type(" ) . concat ( i + 1 , ") {\n animation-delay: " ) . concat ( ( interval || 0.04 ) * i , "s;\n }" ) ;
139- }
140- return styled . css ( templateObject_2 || ( templateObject_2 = __makeTemplateObject ( [ "\n " , "\n " ] , [ "\n " , "\n " ] ) ) , styles ) ;
141- } ) ;
142- var templateObject_1 , templateObject_2 , templateObject_3 ; var renderWords = function ( arrayToRender , includeWhiteSpaces ) {
142+ var DEFAULT_THRESHOLD = 0 ;
143+ var renderWords = function ( arrayToRender , includeWhiteSpaces ) {
143144 return arrayToRender . map ( function ( fragment , index ) {
144145 return fragment !== WHITE_SPACE_CODE ? ( React__default [ "default" ] . createElement ( AnimatedFragment , { key : index , dangerouslySetInnerHTML : { __html : fragment } } ) ) : ( ( includeWhiteSpaces && ( React__default [ "default" ] . createElement ( AnimatedFragment , { key : "" . concat ( index , " " ) , dangerouslySetInnerHTML : { __html : ' ' } } ) ) ) ||
145146 WHITE_SPACE_CODE ) ;
@@ -195,4 +196,4 @@ var AnimatedText = function (_a) {
195196 return ( React__default [ "default" ] . createElement ( StyledWrapper , __assign ( { as : tag , count : type === 'words' ? arrayToRender . length : 0 , interval : interval || ( ( _c = animationOptions === null || animationOptions === void 0 ? void 0 : animationOptions . interval ) !== null && _c !== void 0 ? _c : DEFAULT_INTERVAL ) , duration : duration || ( ( _d = animationOptions === null || animationOptions === void 0 ? void 0 : animationOptions . duration ) !== null && _d !== void 0 ? _d : DEFAULT_DURATION ) , ref : wrapperRef , shouldAnimate : shouldAnimate , uid : uid , animation : animationOptions , "data-testid" : "animated-text" } , props ) , type === 'words'
196197 ? renderWords ( arrayToRender , includeWhiteSpaces )
197198 : renderChars ( arrayToRender , interval || ( ( _e = animationOptions === null || animationOptions === void 0 ? void 0 : animationOptions . interval ) !== null && _e !== void 0 ? _e : DEFAULT_INTERVAL ) , includeWhiteSpaces ) ) ) ;
198- } ; exports [ "default" ] = AnimatedText ; Object . defineProperty ( exports , '__esModule' , { value :true } ) ; } ) ) ; //# sourceMappingURL=react-animated-text-content.development.js.map
199+ } ; exports . WHITE_SPACE_CODE = WHITE_SPACE_CODE ; exports [ "default" ] = AnimatedText ; Object . defineProperty ( exports , '__esModule' , { value :true } ) ; } ) ) ; //# sourceMappingURL=react-animated-text-content.development.js.map
0 commit comments