@chayns-components/typewriter 5.0.53-alpha.0 → 5.0.53
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/lib/cjs/components/typewriter/{typewrite-view/animated-typewriter-text/AnimatedTypewriterText.js → AnimatedTypewriterText.js} +2 -2
- package/lib/cjs/components/typewriter/AnimatedTypewriterText.js.map +1 -0
- package/lib/cjs/components/typewriter/Typewriter.js +216 -66
- package/lib/cjs/components/typewriter/Typewriter.js.map +1 -1
- package/lib/cjs/components/typewriter/{typewrite-view/TypewriterView.styles.js → Typewriter.styles.js} +2 -2
- package/lib/cjs/components/typewriter/Typewriter.styles.js.map +1 -0
- package/lib/cjs/{utils → components/typewriter}/utils.js +24 -7
- package/lib/cjs/components/typewriter/utils.js.map +1 -0
- package/lib/esm/components/typewriter/{typewrite-view/animated-typewriter-text/AnimatedTypewriterText.js → AnimatedTypewriterText.js} +1 -1
- package/lib/esm/components/typewriter/AnimatedTypewriterText.js.map +1 -0
- package/lib/esm/components/typewriter/Typewriter.js +219 -69
- package/lib/esm/components/typewriter/Typewriter.js.map +1 -1
- package/lib/esm/components/typewriter/{typewrite-view/TypewriterView.styles.js → Typewriter.styles.js} +2 -2
- package/lib/esm/components/typewriter/Typewriter.styles.js.map +1 -0
- package/lib/esm/{utils → components/typewriter}/utils.js +22 -5
- package/lib/esm/components/typewriter/utils.js.map +1 -0
- package/lib/types/components/typewriter/{typewrite-view/TypewriterView.styles.d.ts → Typewriter.styles.d.ts} +1 -1
- package/lib/types/{utils → components/typewriter}/utils.d.ts +4 -1
- package/package.json +3 -3
- package/lib/cjs/components/typewriter/typewrite-view/TypewriterView.js +0 -55
- package/lib/cjs/components/typewriter/typewrite-view/TypewriterView.js.map +0 -1
- package/lib/cjs/components/typewriter/typewrite-view/TypewriterView.styles.js.map +0 -1
- package/lib/cjs/components/typewriter/typewrite-view/animated-typewriter-text/AnimatedTypewriterText.js.map +0 -1
- package/lib/cjs/hooks/useChunkStreamingSpeed.js +0 -36
- package/lib/cjs/hooks/useChunkStreamingSpeed.js.map +0 -1
- package/lib/cjs/hooks/useTypewriterAnimation.js +0 -185
- package/lib/cjs/hooks/useTypewriterAnimation.js.map +0 -1
- package/lib/cjs/utils/utils.js.map +0 -1
- package/lib/esm/components/typewriter/typewrite-view/TypewriterView.js +0 -48
- package/lib/esm/components/typewriter/typewrite-view/TypewriterView.js.map +0 -1
- package/lib/esm/components/typewriter/typewrite-view/TypewriterView.styles.js.map +0 -1
- package/lib/esm/components/typewriter/typewrite-view/animated-typewriter-text/AnimatedTypewriterText.js.map +0 -1
- package/lib/esm/hooks/useChunkStreamingSpeed.js +0 -30
- package/lib/esm/hooks/useChunkStreamingSpeed.js.map +0 -1
- package/lib/esm/hooks/useTypewriterAnimation.js +0 -178
- package/lib/esm/hooks/useTypewriterAnimation.js.map +0 -1
- package/lib/esm/utils/utils.js.map +0 -1
- package/lib/types/components/typewriter/typewrite-view/TypewriterView.d.ts +0 -19
- package/lib/types/hooks/useChunkStreamingSpeed.d.ts +0 -7
- package/lib/types/hooks/useTypewriterAnimation.d.ts +0 -35
- /package/lib/types/components/typewriter/{typewrite-view/animated-typewriter-text/AnimatedTypewriterText.d.ts → AnimatedTypewriterText.d.ts} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { WithTheme } from '@chayns-components/core';
|
|
2
|
-
import type { TypewriterProps } from '
|
|
2
|
+
import type { TypewriterProps } from './Typewriter';
|
|
3
3
|
type StyledTypewriterProps = WithTheme<{
|
|
4
4
|
$cursorType: TypewriterProps['cursorType'];
|
|
5
5
|
$isAnimatingText: boolean;
|
|
@@ -24,7 +24,10 @@
|
|
|
24
24
|
export declare const getSubTextFromHTML: (html: string, length: number) => string;
|
|
25
25
|
export declare const getCharactersCount: (html: string) => number;
|
|
26
26
|
export declare const shuffleArray: <T>(array: T[]) => T[];
|
|
27
|
-
export declare const
|
|
27
|
+
export declare const calculateAutoSpeed: (ema: number) => {
|
|
28
|
+
speed: number;
|
|
29
|
+
steps: number;
|
|
30
|
+
};
|
|
28
31
|
interface CalculateEMAProps {
|
|
29
32
|
currentEMA: number;
|
|
30
33
|
newValue: number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chayns-components/typewriter",
|
|
3
|
-
"version": "5.0.53
|
|
3
|
+
"version": "5.0.53",
|
|
4
4
|
"description": "A set of beautiful React components for developing your own applications with chayns.",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"browserslist": [
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
"typescript": "^5.9.3"
|
|
71
71
|
},
|
|
72
72
|
"dependencies": {
|
|
73
|
-
"@chayns-components/core": "^5.0.53
|
|
73
|
+
"@chayns-components/core": "^5.0.53",
|
|
74
74
|
"react-compiler-runtime": "^1.0.0"
|
|
75
75
|
},
|
|
76
76
|
"peerDependencies": {
|
|
@@ -83,5 +83,5 @@
|
|
|
83
83
|
"publishConfig": {
|
|
84
84
|
"access": "public"
|
|
85
85
|
},
|
|
86
|
-
"gitHead": "
|
|
86
|
+
"gitHead": "8ece3beb8424358b883a16a87419ef35303be612"
|
|
87
87
|
}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _react = _interopRequireDefault(require("react"));
|
|
8
|
-
var _reactDom = require("react-dom");
|
|
9
|
-
var _AnimatedTypewriterText = _interopRequireDefault(require("./animated-typewriter-text/AnimatedTypewriterText"));
|
|
10
|
-
var _TypewriterView = require("./TypewriterView.styles");
|
|
11
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
-
const TypewriterView = ({
|
|
13
|
-
children,
|
|
14
|
-
cursorType,
|
|
15
|
-
handleClick,
|
|
16
|
-
hasRenderedChildrenOnce,
|
|
17
|
-
isAnimatingText,
|
|
18
|
-
pseudoTextHTML,
|
|
19
|
-
shouldHideCursor,
|
|
20
|
-
shouldPreventBlinkingCursor,
|
|
21
|
-
shouldRemainSingleLine,
|
|
22
|
-
shownText,
|
|
23
|
-
textStyle
|
|
24
|
-
}) => /*#__PURE__*/_react.default.createElement(_TypewriterView.StyledTypewriter, {
|
|
25
|
-
$cursorType: cursorType,
|
|
26
|
-
onClick: handleClick,
|
|
27
|
-
$isAnimatingText: isAnimatingText,
|
|
28
|
-
$shouldHideCursor: shouldHideCursor,
|
|
29
|
-
$shouldPreventBlinkAnimation: shouldPreventBlinkingCursor
|
|
30
|
-
}, isAnimatingText ? /*#__PURE__*/_react.default.createElement(_AnimatedTypewriterText.default, {
|
|
31
|
-
shouldHideCursor: shouldHideCursor,
|
|
32
|
-
shouldRemainSingleLine: shouldRemainSingleLine,
|
|
33
|
-
shownText: shownText,
|
|
34
|
-
textStyle: textStyle
|
|
35
|
-
}) : /*#__PURE__*/_react.default.createElement(_TypewriterView.StyledTypewriterText, {
|
|
36
|
-
className: "notranslate",
|
|
37
|
-
$shouldRemainSingleLine: shouldRemainSingleLine,
|
|
38
|
-
dangerouslySetInnerHTML: typeof children === 'string' ? {
|
|
39
|
-
__html: shownText
|
|
40
|
-
} : undefined,
|
|
41
|
-
style: textStyle
|
|
42
|
-
}, typeof children !== 'string' ? children : undefined), isAnimatingText && /*#__PURE__*/_react.default.createElement(_TypewriterView.StyledTypewriterPseudoText, {
|
|
43
|
-
$isAnimatingText: isAnimatingText,
|
|
44
|
-
$shouldHideCursor: shouldHideCursor,
|
|
45
|
-
dangerouslySetInnerHTML: {
|
|
46
|
-
__html: pseudoTextHTML
|
|
47
|
-
}
|
|
48
|
-
}), !hasRenderedChildrenOnce && /*#__PURE__*/(0, _reactDom.createPortal)(/*#__PURE__*/_react.default.createElement("div", {
|
|
49
|
-
style: {
|
|
50
|
-
position: 'absolute',
|
|
51
|
-
visibility: 'hidden'
|
|
52
|
-
}
|
|
53
|
-
}, children), document.body));
|
|
54
|
-
var _default = exports.default = TypewriterView;
|
|
55
|
-
//# sourceMappingURL=TypewriterView.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TypewriterView.js","names":["_react","_interopRequireDefault","require","_reactDom","_AnimatedTypewriterText","_TypewriterView","e","__esModule","default","TypewriterView","children","cursorType","handleClick","hasRenderedChildrenOnce","isAnimatingText","pseudoTextHTML","shouldHideCursor","shouldPreventBlinkingCursor","shouldRemainSingleLine","shownText","textStyle","createElement","StyledTypewriter","$cursorType","onClick","$isAnimatingText","$shouldHideCursor","$shouldPreventBlinkAnimation","StyledTypewriterText","className","$shouldRemainSingleLine","dangerouslySetInnerHTML","__html","undefined","style","StyledTypewriterPseudoText","createPortal","position","visibility","document","body","_default","exports"],"sources":["../../../../../src/components/typewriter/typewrite-view/TypewriterView.tsx"],"sourcesContent":["import React, { FC, ReactElement } from 'react';\nimport { createPortal } from 'react-dom';\nimport { CSSPropertiesWithVars } from 'styled-components/dist/types';\nimport { CursorType } from '../../../types/cursor';\nimport AnimatedTypewriterText from './animated-typewriter-text/AnimatedTypewriterText';\nimport {\n StyledTypewriter,\n StyledTypewriterPseudoText,\n StyledTypewriterText,\n} from './TypewriterView.styles';\n\nexport type TypewriterContent = ReactElement | string | Array<ReactElement | string>;\n\ntype TypewriterViewProps = {\n children: TypewriterContent;\n cursorType: CursorType;\n handleClick?: (event: React.MouseEvent) => void;\n hasRenderedChildrenOnce: boolean;\n isAnimatingText: boolean;\n pseudoTextHTML: string;\n shouldHideCursor: boolean;\n shouldPreventBlinkingCursor: boolean;\n shouldRemainSingleLine: boolean;\n shownText: string;\n textStyle?: CSSPropertiesWithVars;\n};\n\nconst TypewriterView: FC<TypewriterViewProps> = ({\n children,\n cursorType,\n handleClick,\n hasRenderedChildrenOnce,\n isAnimatingText,\n pseudoTextHTML,\n shouldHideCursor,\n shouldPreventBlinkingCursor,\n shouldRemainSingleLine,\n shownText,\n textStyle,\n}) => (\n <StyledTypewriter\n $cursorType={cursorType}\n onClick={handleClick}\n $isAnimatingText={isAnimatingText}\n $shouldHideCursor={shouldHideCursor}\n $shouldPreventBlinkAnimation={shouldPreventBlinkingCursor}\n >\n {isAnimatingText ? (\n <AnimatedTypewriterText\n shouldHideCursor={shouldHideCursor}\n shouldRemainSingleLine={shouldRemainSingleLine}\n shownText={shownText}\n textStyle={textStyle}\n />\n ) : (\n <StyledTypewriterText\n className=\"notranslate\"\n $shouldRemainSingleLine={shouldRemainSingleLine}\n dangerouslySetInnerHTML={\n typeof children === 'string' ? { __html: shownText } : undefined\n }\n style={textStyle}\n >\n {typeof children !== 'string' ? children : undefined}\n </StyledTypewriterText>\n )}\n {isAnimatingText && (\n <StyledTypewriterPseudoText\n $isAnimatingText={isAnimatingText}\n $shouldHideCursor={shouldHideCursor}\n dangerouslySetInnerHTML={{ __html: pseudoTextHTML }}\n />\n )}\n {/*\n The following is needed because some components like the CodeHighlighter will not render correct\n if the element is not rendered on a client before...\n */}\n {!hasRenderedChildrenOnce &&\n createPortal(\n <div style={{ position: 'absolute', visibility: 'hidden' }}>{children}</div>,\n document.body,\n )}\n </StyledTypewriter>\n);\n\nexport default TypewriterView;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AAGA,IAAAE,uBAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,eAAA,GAAAH,OAAA;AAIiC,SAAAD,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAkBjC,MAAMG,cAAuC,GAAGA,CAAC;EAC7CC,QAAQ;EACRC,UAAU;EACVC,WAAW;EACXC,uBAAuB;EACvBC,eAAe;EACfC,cAAc;EACdC,gBAAgB;EAChBC,2BAA2B;EAC3BC,sBAAsB;EACtBC,SAAS;EACTC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AC,OAAA,CAAAlC,OAAA,GAEaC,cAAc","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TypewriterView.styles.js","names":["_styledComponents","_interopRequireWildcard","require","_cursor","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","typewriterCursorElement","$cursorType","$isAnimatingText","$shouldHideCursor","$shouldPreventBlinkAnimation","CursorType","Thin","css","blinkAnimation","theme","text","StyledTypewriter","exports","styled","div","keyframes","StyledTypewriterPseudoText","span","StyledTypewriterText","$shouldRemainSingleLine"],"sources":["../../../../../src/components/typewriter/typewrite-view/TypewriterView.styles.ts"],"sourcesContent":["import type { WithTheme } from '@chayns-components/core';\nimport styled, { css, keyframes } from 'styled-components';\nimport { CursorType } from '../../../types/cursor';\nimport type { TypewriterProps } from '../Typewriter';\n\ntype StyledTypewriterProps = WithTheme<{\n $cursorType: TypewriterProps['cursorType'];\n $isAnimatingText: boolean;\n $shouldHideCursor: TypewriterProps['shouldHideCursor'];\n $shouldPreventBlinkAnimation: boolean;\n}>;\n\nconst typewriterCursorElement = ({\n $cursorType,\n $isAnimatingText,\n $shouldHideCursor,\n $shouldPreventBlinkAnimation,\n}: StyledTypewriterProps) => {\n if (!$isAnimatingText || $shouldHideCursor) {\n return '';\n }\n\n if ($cursorType === CursorType.Thin) {\n return css`\n .typewriter-lastWithContent {\n &:after {\n animation: ${$shouldPreventBlinkAnimation ? 'none' : blinkAnimation} 1s steps(2, start) infinite;\n color: inherit;\n content: '|';\n font-size: 25px;\n position: relative;\n line-height: 0;\n vertical-align: baseline;\n }\n `;\n }\n\n return css`\n .typewriter-lastWithContent {\n &:after {\n animation: ${blinkAnimation} 1s steps(2, start) infinite;\n color: ${({ theme }) => (theme as { text: string }).text};\n content: '▋';\n margin-left: 0.25rem;\n opacity: 0.85;\n position: relative;\n vertical-align: baseline;\n }\n }\n `;\n};\n\nexport const StyledTypewriter = styled.div<StyledTypewriterProps>`\n align-items: inherit;\n display: flex;\n position: relative;\n width: 100%;\n ${typewriterCursorElement}\n`;\n\nconst blinkAnimation = keyframes`\n 100% {\n visibility: hidden;\n }\n`;\n\ntype StyledTypewriterPseudoTextProps = WithTheme<{\n $isAnimatingText?: boolean;\n $shouldHideCursor: TypewriterProps['shouldHideCursor'];\n}>;\n\nexport const StyledTypewriterPseudoText = styled.span<StyledTypewriterPseudoTextProps>`\n opacity: 0;\n pointer-events: none;\n user-select: none;\n width: fit-content;\n\n ${({ $isAnimatingText, $shouldHideCursor }) =>\n $isAnimatingText &&\n !$shouldHideCursor &&\n css`\n &:after {\n animation: ${blinkAnimation} 1s steps(2, start) infinite;\n color: inherit;\n content: '|';\n font-size: 25px;\n position: relative;\n line-height: 0;\n vertical-align: baseline;\n }\n `}\n`;\n\ntype StyledTypewriterTextProps = WithTheme<{\n $isAnimatingText?: boolean;\n $shouldRemainSingleLine: boolean;\n}>;\n\nexport const StyledTypewriterText = styled.span<StyledTypewriterTextProps>`\n color: inherit;\n position: ${({ $isAnimatingText }) => ($isAnimatingText ? 'absolute' : 'relative')};\n width: fit-content;\n\n ${({ $isAnimatingText }) =>\n $isAnimatingText &&\n css`\n pointer-events: none;\n `}\n\n ${({ $shouldRemainSingleLine }) =>\n $shouldRemainSingleLine &&\n css`\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n width: 100%;\n `}\n`;\n"],"mappings":";;;;;;AACA,IAAAA,iBAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAAmD,SAAAD,wBAAAG,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAL,uBAAA,YAAAA,CAAAG,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAA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,KAAK;AACL,CAAC;AAEM,MAAMC,gBAAgB,GAAAC,OAAA,CAAAD,gBAAA,GAAGE,yBAAM,CAACC,GAA0B;AACjE;AACA;AACA;AACA;AACA,MAAMd,uBAAuB;AAC7B,CAAC;AAED,MAAMQ,cAAc,GAAG,IAAAO,2BAAS;AAChC;AACA;AACA;AACA,CAAC;AAOM,MAAMC,0BAA0B,GAAAJ,OAAA,CAAAI,0BAAA,GAAGH,yBAAM,CAACI,IAAqC;AACtF;AACA;AACA;AACA;AACA;AACA,MAAM,CAAC;EAAEf,gBAAgB;EAAEC;AAAkB,CAAC,KACtCD,gBAAgB,IAChB,CAACC,iBAAiB,IAClB,IAAAI,qBAAG;AACX;AACA,6BAA6BC,cAAc;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,CAAC;AAOM,MAAMU,oBAAoB,GAAAN,OAAA,CAAAM,oBAAA,GAAGL,yBAAM,CAACI,IAA+B;AAC1E;AACA,gBAAgB,CAAC;EAAEf;AAAiB,CAAC,KAAMA,gBAAgB,GAAG,UAAU,GAAG,UAAW;AACtF;AACA;AACA,MAAM,CAAC;EAAEA;AAAiB,CAAC,KACnBA,gBAAgB,IAChB,IAAAK,qBAAG;AACX;AACA,SAAS;AACT;AACA,MAAM,CAAC;EAAEY;AAAwB,CAAC,KAC1BA,uBAAuB,IACvB,IAAAZ,qBAAG;AACX;AACA;AACA;AACA;AACA,SAAS;AACT,CAAC","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AnimatedTypewriterText.js","names":["_react","_interopRequireWildcard","require","_TypewriterView","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","AnimatedTypewriterText","shouldHideCursor","shownText","shouldRemainSingleLine","textStyle","updateTypewriterCursor","useCallback","ref","traverseNodes","node","_node$textContent","nodeType","Node","TEXT_NODE","textContent","trim","parentElement","childNodes","Array","from","length","result","lastParentWithContent","classList","remove","querySelectorAll","forEach","element","add","useMemo","createElement","StyledTypewriterText","dangerouslySetInnerHTML","__html","$shouldRemainSingleLine","style","$isAnimatingText","_default","exports"],"sources":["../../../../../../src/components/typewriter/typewrite-view/animated-typewriter-text/AnimatedTypewriterText.tsx"],"sourcesContent":["import React, { FC, useCallback, useMemo } from 'react';\nimport { CSSPropertiesWithVars } from 'styled-components/dist/types';\nimport { StyledTypewriterText } from '../TypewriterView.styles';\n\ntype AnimatedTypewriterTextProps = {\n shouldHideCursor: boolean;\n shownText: string;\n textStyle?: CSSPropertiesWithVars;\n shouldRemainSingleLine: boolean;\n};\n\nconst AnimatedTypewriterText: FC<AnimatedTypewriterTextProps> = ({\n shouldHideCursor,\n shownText,\n shouldRemainSingleLine,\n textStyle,\n}) => {\n const updateTypewriterCursor = useCallback(\n (ref: HTMLSpanElement | null) => {\n if (ref && !shouldHideCursor) {\n // Finds the last text node with content.\n const traverseNodes = (node: Node): HTMLElement | null => {\n if (node.nodeType === Node.TEXT_NODE && node.textContent?.trim()) {\n return node.parentElement;\n }\n\n const childNodes = Array.from(node.childNodes);\n for (let i = childNodes.length - 1; i >= 0; i--) {\n const result = traverseNodes(childNodes[i] as Node);\n if (result) {\n return result;\n }\n }\n\n return null;\n };\n\n const lastParentWithContent = traverseNodes(ref);\n\n // Removes lastWithContent class from all elements\n ref.classList.remove('typewriter-lastWithContent');\n ref.querySelectorAll('.lastWithContent').forEach((element) => {\n element.classList.remove('typewriter-lastWithContent');\n });\n\n // Adds lastWithContent class to the last element with content\n if (lastParentWithContent) {\n lastParentWithContent.classList.add('typewriter-lastWithContent');\n } else {\n ref.classList.add('typewriter-lastWithContent');\n }\n }\n },\n [shouldHideCursor],\n );\n\n return useMemo(\n () => (\n <StyledTypewriterText\n ref={(ref) => updateTypewriterCursor(ref)}\n dangerouslySetInnerHTML={{ __html: shownText }}\n $shouldRemainSingleLine={shouldRemainSingleLine}\n style={textStyle}\n $isAnimatingText\n />\n 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OAAO,IAAA4B,cAAO,EACV,mBACIpD,MAAA,CAAAc,OAAA,CAAAuC,aAAA,CAAClD,eAAA,CAAAmD,oBAAoB;IACjBxB,GAAG,EAAGA,GAAG,IAAKF,sBAAsB,CAACE,GAAG,CAAE;IAC1CyB,uBAAuB,EAAE;MAAEC,MAAM,EAAE/B;IAAU,CAAE;IAC/CgC,uBAAuB,EAAE/B,sBAAuB;IAChDgC,KAAK,EAAE/B,SAAU;IACjBgC,gBAAgB;EAAA,CACnB,CACJ,EACD,CAAClC,SAAS,EAAEC,sBAAsB,EAAEC,SAAS,EAAEC,sBAAsB,CACzE,CAAC;AACL,CAAC;AAAC,IAAAgC,QAAA,GAAAC,OAAA,CAAA/C,OAAA,GAEaS,sBAAsB","ignoreList":[]}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _react = require("react");
|
|
8
|
-
var _utils = require("../utils/utils");
|
|
9
|
-
const getInitialChunkSpeed = (charactersCount, autoSpeedBaseFactor) => charactersCount / (autoSpeedBaseFactor / 1000);
|
|
10
|
-
const useChunkStreamingSpeed = ({
|
|
11
|
-
autoSpeedBaseFactor,
|
|
12
|
-
charactersCount,
|
|
13
|
-
shouldCalcAutoSpeed
|
|
14
|
-
}) => {
|
|
15
|
-
const autoSpeed = (0, _react.useRef)();
|
|
16
|
-
const chunkStreamingSpeed = (0, _react.useRef)({
|
|
17
|
-
lastLength: charactersCount,
|
|
18
|
-
ema: getInitialChunkSpeed(charactersCount, autoSpeedBaseFactor)
|
|
19
|
-
});
|
|
20
|
-
(0, _react.useEffect)(() => {
|
|
21
|
-
chunkStreamingSpeed.current = (0, _utils.updateChunkStreamingSpeedEMA)({
|
|
22
|
-
currentLength: charactersCount,
|
|
23
|
-
state: chunkStreamingSpeed.current
|
|
24
|
-
});
|
|
25
|
-
}, [autoSpeedBaseFactor, charactersCount]);
|
|
26
|
-
(0, _react.useEffect)(() => {
|
|
27
|
-
if (!shouldCalcAutoSpeed) {
|
|
28
|
-
autoSpeed.current = undefined;
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
autoSpeed.current = (0, _utils.getSafeAutoSpeed)(chunkStreamingSpeed.current.ema);
|
|
32
|
-
}, [charactersCount, shouldCalcAutoSpeed]);
|
|
33
|
-
return autoSpeed;
|
|
34
|
-
};
|
|
35
|
-
var _default = exports.default = useChunkStreamingSpeed;
|
|
36
|
-
//# sourceMappingURL=useChunkStreamingSpeed.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useChunkStreamingSpeed.js","names":["_react","require","_utils","getInitialChunkSpeed","charactersCount","autoSpeedBaseFactor","useChunkStreamingSpeed","shouldCalcAutoSpeed","autoSpeed","useRef","chunkStreamingSpeed","lastLength","ema","useEffect","current","updateChunkStreamingSpeedEMA","currentLength","state","undefined","getSafeAutoSpeed","_default","exports","default"],"sources":["../../../src/hooks/useChunkStreamingSpeed.ts"],"sourcesContent":["import { useEffect, useRef } from 'react';\nimport {\n ChunkStreamingSpeedState,\n getSafeAutoSpeed,\n updateChunkStreamingSpeedEMA,\n} from '../utils/utils';\n\ntype UseChunkStreamingSpeedProps = {\n autoSpeedBaseFactor: number;\n charactersCount: number;\n shouldCalcAutoSpeed: boolean;\n};\n\nconst getInitialChunkSpeed = (charactersCount: number, autoSpeedBaseFactor: number) =>\n charactersCount / (autoSpeedBaseFactor / 1000);\n\nconst useChunkStreamingSpeed = ({\n autoSpeedBaseFactor,\n charactersCount,\n shouldCalcAutoSpeed,\n}: UseChunkStreamingSpeedProps) => {\n const autoSpeed = useRef<number>();\n const chunkStreamingSpeed = useRef<ChunkStreamingSpeedState>({\n lastLength: charactersCount,\n ema: getInitialChunkSpeed(charactersCount, autoSpeedBaseFactor),\n });\n\n useEffect(() => {\n chunkStreamingSpeed.current = updateChunkStreamingSpeedEMA({\n currentLength: charactersCount,\n state: chunkStreamingSpeed.current,\n });\n }, [autoSpeedBaseFactor, charactersCount]);\n\n useEffect(() => {\n if (!shouldCalcAutoSpeed) {\n autoSpeed.current = undefined;\n return;\n }\n\n autoSpeed.current = getSafeAutoSpeed(chunkStreamingSpeed.current.ema);\n }, [charactersCount, shouldCalcAutoSpeed]);\n\n return autoSpeed;\n};\n\nexport default useChunkStreamingSpeed;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAYA,MAAME,oBAAoB,GAAGA,CAACC,eAAuB,EAAEC,mBAA2B,KAC9ED,eAAe,IAAIC,mBAAmB,GAAG,IAAI,CAAC;AAElD,MAAMC,sBAAsB,GAAGA,CAAC;EAC5BD,mBAAmB;EACnBD,eAAe;EACfG;AACyB,CAAC,KAAK;EAC/B,MAAMC,SAAS,GAAG,IAAAC,aAAM,EAAS,CAAC;EAClC,MAAMC,mBAAmB,GAAG,IAAAD,aAAM,EAA2B;IACzDE,UAAU,EAAEP,eAAe;IAC3BQ,GAAG,EAAET,oBAAoB,CAACC,eAAe,EAAEC,mBAAmB;EAClE,CAAC,CAAC;EAEF,IAAAQ,gBAAS,EAAC,MAAM;IACZH,mBAAmB,CAACI,OAAO,GAAG,IAAAC,mCAA4B,EAAC;MACvDC,aAAa,EAAEZ,eAAe;MAC9Ba,KAAK,EAAEP,mBAAmB,CAACI;IAC/B,CAAC,CAAC;EACN,CAAC,EAAE,CAACT,mBAAmB,EAAED,eAAe,CAAC,CAAC;EAE1C,IAAAS,gBAAS,EAAC,MAAM;IACZ,IAAI,CAACN,mBAAmB,EAAE;MACtBC,SAAS,CAACM,OAAO,GAAGI,SAAS;MAC7B;IACJ;IAEAV,SAAS,CAACM,OAAO,GAAG,IAAAK,uBAAgB,EAACT,mBAAmB,CAACI,OAAO,CAACF,GAAG,CAAC;EACzE,CAAC,EAAE,CAACR,eAAe,EAAEG,mBAAmB,CAAC,CAAC;EAE1C,OAAOC,SAAS;AACpB,CAAC;AAAC,IAAAY,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEahB,sBAAsB","ignoreList":[]}
|
|
@@ -1,185 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _react = require("react");
|
|
8
|
-
var _cursor = require("../types/cursor");
|
|
9
|
-
var _useChunkStreamingSpeed = _interopRequireDefault(require("./useChunkStreamingSpeed"));
|
|
10
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
-
const useIsomorphicLayoutEffect = typeof window !== 'undefined' ? _react.useLayoutEffect : _react.useEffect;
|
|
12
|
-
const useTypewriterAnimation = ({
|
|
13
|
-
autoSpeedBaseFactor,
|
|
14
|
-
charactersCount,
|
|
15
|
-
childrenKey,
|
|
16
|
-
childrenCount,
|
|
17
|
-
currentTextLength,
|
|
18
|
-
cursorType,
|
|
19
|
-
nextTextDelay,
|
|
20
|
-
onAdvanceChild,
|
|
21
|
-
onFinish,
|
|
22
|
-
onResetAnimationEnd,
|
|
23
|
-
onResetAnimationStart,
|
|
24
|
-
onTypingAnimationEnd,
|
|
25
|
-
onTypingAnimationStart,
|
|
26
|
-
resetDelay,
|
|
27
|
-
resetSpeed,
|
|
28
|
-
shouldCalcAutoSpeed,
|
|
29
|
-
shouldForceCursorAnimation,
|
|
30
|
-
shouldUseResetAnimation,
|
|
31
|
-
shouldWaitForContent,
|
|
32
|
-
speed,
|
|
33
|
-
startDelay
|
|
34
|
-
}) => {
|
|
35
|
-
const [hasRenderedChildrenOnce, setHasRenderedChildrenOnce] = (0, _react.useState)(false);
|
|
36
|
-
const [shouldPreventBlinkingCursor, setShouldPreventBlinkingCursor] = (0, _react.useState)(false);
|
|
37
|
-
const [isResetAnimationActive, setIsResetAnimationActive] = (0, _react.useState)(false);
|
|
38
|
-
const [shouldStopAnimation, setShouldStopAnimation] = (0, _react.useState)(false);
|
|
39
|
-
const [shownCharCount, setShownCharCount] = (0, _react.useState)(charactersCount > 0 ? 0 : currentTextLength);
|
|
40
|
-
const autoSpeed = (0, _useChunkStreamingSpeed.default)({
|
|
41
|
-
autoSpeedBaseFactor,
|
|
42
|
-
charactersCount,
|
|
43
|
-
shouldCalcAutoSpeed
|
|
44
|
-
});
|
|
45
|
-
useIsomorphicLayoutEffect(() => {
|
|
46
|
-
setHasRenderedChildrenOnce(false);
|
|
47
|
-
}, [childrenKey]);
|
|
48
|
-
if (!hasRenderedChildrenOnce) setHasRenderedChildrenOnce(true);
|
|
49
|
-
const shouldShowFullTextImmediately = shouldStopAnimation || charactersCount === 0;
|
|
50
|
-
const effectiveShownCharCount = shouldShowFullTextImmediately ? currentTextLength : shownCharCount;
|
|
51
|
-
const isTypingAnimationActive = !shouldShowFullTextImmediately && (effectiveShownCharCount < currentTextLength || childrenCount > 1);
|
|
52
|
-
const isAnimatingText = isTypingAnimationActive || shouldForceCursorAnimation;
|
|
53
|
-
const handleClick = event => {
|
|
54
|
-
event.stopPropagation();
|
|
55
|
-
event.preventDefault();
|
|
56
|
-
setShouldStopAnimation(true);
|
|
57
|
-
};
|
|
58
|
-
(0, _react.useEffect)(() => {
|
|
59
|
-
let frameId;
|
|
60
|
-
let lastTimeRendered;
|
|
61
|
-
let accumulatedTime = 0;
|
|
62
|
-
let timeoutId;
|
|
63
|
-
const safeCancelFrame = () => {
|
|
64
|
-
if (typeof frameId === 'number') {
|
|
65
|
-
cancelAnimationFrame(frameId);
|
|
66
|
-
frameId = undefined;
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
const safeClearTimeout = () => {
|
|
70
|
-
if (typeof timeoutId === 'number') {
|
|
71
|
-
clearTimeout(timeoutId);
|
|
72
|
-
timeoutId = undefined;
|
|
73
|
-
}
|
|
74
|
-
};
|
|
75
|
-
const startAnimationFrameLoop = (onTick, speedParam) => {
|
|
76
|
-
lastTimeRendered = undefined;
|
|
77
|
-
accumulatedTime = 0;
|
|
78
|
-
const loop = timestamp => {
|
|
79
|
-
if (lastTimeRendered === undefined) lastTimeRendered = timestamp;
|
|
80
|
-
const deltaTime = timestamp - lastTimeRendered;
|
|
81
|
-
accumulatedTime += deltaTime;
|
|
82
|
-
const rate = autoSpeed.current ?? speedParam;
|
|
83
|
-
const charactersToChange = Math.floor(accumulatedTime / rate);
|
|
84
|
-
if (charactersToChange === 0) {
|
|
85
|
-
lastTimeRendered = timestamp;
|
|
86
|
-
frameId = requestAnimationFrame(loop);
|
|
87
|
-
return;
|
|
88
|
-
}
|
|
89
|
-
onTick(charactersToChange);
|
|
90
|
-
accumulatedTime -= charactersToChange * rate;
|
|
91
|
-
lastTimeRendered = timestamp;
|
|
92
|
-
frameId = requestAnimationFrame(loop);
|
|
93
|
-
};
|
|
94
|
-
frameId = requestAnimationFrame(loop);
|
|
95
|
-
};
|
|
96
|
-
if (shouldShowFullTextImmediately) {
|
|
97
|
-
return () => {
|
|
98
|
-
safeCancelFrame();
|
|
99
|
-
safeClearTimeout();
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
|
-
if (isResetAnimationActive) {
|
|
103
|
-
if (typeof onResetAnimationStart === 'function') {
|
|
104
|
-
onResetAnimationStart();
|
|
105
|
-
}
|
|
106
|
-
startAnimationFrameLoop(charactersToRemove => {
|
|
107
|
-
setShownCharCount(prev => {
|
|
108
|
-
const nextShownCharCount = Math.max(0, prev - charactersToRemove);
|
|
109
|
-
if (nextShownCharCount <= 0) {
|
|
110
|
-
safeCancelFrame();
|
|
111
|
-
if (typeof onResetAnimationEnd === 'function') {
|
|
112
|
-
onResetAnimationEnd();
|
|
113
|
-
}
|
|
114
|
-
if (childrenCount > 1) {
|
|
115
|
-
timeoutId = window.setTimeout(() => {
|
|
116
|
-
setIsResetAnimationActive(false);
|
|
117
|
-
onAdvanceChild();
|
|
118
|
-
}, nextTextDelay);
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
return nextShownCharCount;
|
|
122
|
-
});
|
|
123
|
-
}, resetSpeed);
|
|
124
|
-
} else {
|
|
125
|
-
const startTypingAnimation = () => {
|
|
126
|
-
if (cursorType === _cursor.CursorType.Thin) {
|
|
127
|
-
setShouldPreventBlinkingCursor(true);
|
|
128
|
-
}
|
|
129
|
-
if (typeof onTypingAnimationStart === 'function') {
|
|
130
|
-
onTypingAnimationStart();
|
|
131
|
-
}
|
|
132
|
-
startAnimationFrameLoop(charactersToAdd => {
|
|
133
|
-
setShownCharCount(prevState => {
|
|
134
|
-
let nextState = prevState + charactersToAdd;
|
|
135
|
-
if (nextState >= charactersCount && !shouldWaitForContent) {
|
|
136
|
-
if (cursorType === _cursor.CursorType.Thin) {
|
|
137
|
-
setShouldPreventBlinkingCursor(false);
|
|
138
|
-
}
|
|
139
|
-
if (typeof onTypingAnimationEnd === 'function') {
|
|
140
|
-
onTypingAnimationEnd();
|
|
141
|
-
}
|
|
142
|
-
nextState = currentTextLength;
|
|
143
|
-
safeCancelFrame();
|
|
144
|
-
if (childrenCount > 1) {
|
|
145
|
-
timeoutId = window.setTimeout(() => {
|
|
146
|
-
if (shouldUseResetAnimation) {
|
|
147
|
-
setIsResetAnimationActive(true);
|
|
148
|
-
} else {
|
|
149
|
-
setShownCharCount(0);
|
|
150
|
-
timeoutId = window.setTimeout(onAdvanceChild, nextTextDelay);
|
|
151
|
-
}
|
|
152
|
-
}, resetDelay);
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
return nextState;
|
|
156
|
-
});
|
|
157
|
-
}, speed);
|
|
158
|
-
};
|
|
159
|
-
if (startDelay) {
|
|
160
|
-
timeoutId = window.setTimeout(startTypingAnimation, startDelay);
|
|
161
|
-
} else {
|
|
162
|
-
startTypingAnimation();
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
return () => {
|
|
166
|
-
safeCancelFrame();
|
|
167
|
-
safeClearTimeout();
|
|
168
|
-
};
|
|
169
|
-
}, [childrenCount, charactersCount, currentTextLength, cursorType, isResetAnimationActive, nextTextDelay, onAdvanceChild, onResetAnimationEnd, onResetAnimationStart, onTypingAnimationEnd, onTypingAnimationStart, resetDelay, resetSpeed, shouldShowFullTextImmediately, autoSpeed, shouldUseResetAnimation, shouldWaitForContent, speed, startDelay]);
|
|
170
|
-
(0, _react.useEffect)(() => {
|
|
171
|
-
if (!isTypingAnimationActive && typeof onFinish === 'function') {
|
|
172
|
-
onFinish();
|
|
173
|
-
}
|
|
174
|
-
}, [isTypingAnimationActive, onFinish]);
|
|
175
|
-
return {
|
|
176
|
-
effectiveShownCharCount,
|
|
177
|
-
handleClick,
|
|
178
|
-
hasRenderedChildrenOnce,
|
|
179
|
-
isAnimatingText,
|
|
180
|
-
isTypingAnimationActive,
|
|
181
|
-
shouldPreventBlinkingCursor
|
|
182
|
-
};
|
|
183
|
-
};
|
|
184
|
-
var _default = exports.default = useTypewriterAnimation;
|
|
185
|
-
//# sourceMappingURL=useTypewriterAnimation.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useTypewriterAnimation.js","names":["_react","require","_cursor","_useChunkStreamingSpeed","_interopRequireDefault","e","__esModule","default","useIsomorphicLayoutEffect","window","useLayoutEffect","useEffect","useTypewriterAnimation","autoSpeedBaseFactor","charactersCount","childrenKey","childrenCount","currentTextLength","cursorType","nextTextDelay","onAdvanceChild","onFinish","onResetAnimationEnd","onResetAnimationStart","onTypingAnimationEnd","onTypingAnimationStart","resetDelay","resetSpeed","shouldCalcAutoSpeed","shouldForceCursorAnimation","shouldUseResetAnimation","shouldWaitForContent","speed","startDelay","hasRenderedChildrenOnce","setHasRenderedChildrenOnce","useState","shouldPreventBlinkingCursor","setShouldPreventBlinkingCursor","isResetAnimationActive","setIsResetAnimationActive","shouldStopAnimation","setShouldStopAnimation","shownCharCount","setShownCharCount","autoSpeed","useChunkStreamingSpeed","shouldShowFullTextImmediately","effectiveShownCharCount","isTypingAnimationActive","isAnimatingText","handleClick","event","stopPropagation","preventDefault","frameId","lastTimeRendered","accumulatedTime","timeoutId","safeCancelFrame","cancelAnimationFrame","undefined","safeClearTimeout","clearTimeout","startAnimationFrameLoop","onTick","speedParam","loop","timestamp","deltaTime","rate","current","charactersToChange","Math","floor","requestAnimationFrame","charactersToRemove","prev","nextShownCharCount","max","setTimeout","startTypingAnimation","CursorType","Thin","charactersToAdd","prevState","nextState","_default","exports"],"sources":["../../../src/hooks/useTypewriterAnimation.ts"],"sourcesContent":["import type { MouseEvent } from 'react';\nimport { useEffect, useLayoutEffect, useState } from 'react';\nimport { CursorType } from '../types/cursor';\nimport useChunkStreamingSpeed from './useChunkStreamingSpeed';\n\nconst useIsomorphicLayoutEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect;\n\ntype UseTypewriterAnimationProps = {\n autoSpeedBaseFactor: number;\n charactersCount: number;\n childrenKey: unknown;\n childrenCount: number;\n currentTextLength: number;\n cursorType: CursorType;\n nextTextDelay: number;\n onAdvanceChild: VoidFunction;\n onFinish?: VoidFunction;\n onResetAnimationEnd?: VoidFunction;\n onResetAnimationStart?: VoidFunction;\n onTypingAnimationEnd?: VoidFunction;\n onTypingAnimationStart?: VoidFunction;\n resetDelay: number;\n resetSpeed: number;\n shouldCalcAutoSpeed: boolean;\n shouldForceCursorAnimation: boolean;\n shouldUseResetAnimation: boolean;\n shouldWaitForContent?: boolean;\n speed: number;\n startDelay: number;\n};\n\nexport type UseTypewriterAnimationResult = {\n effectiveShownCharCount: number;\n handleClick: (event: MouseEvent) => void;\n hasRenderedChildrenOnce: boolean;\n isAnimatingText: boolean;\n isTypingAnimationActive: boolean;\n shouldPreventBlinkingCursor: boolean;\n};\n\nconst useTypewriterAnimation = ({\n autoSpeedBaseFactor,\n charactersCount,\n childrenKey,\n childrenCount,\n currentTextLength,\n cursorType,\n nextTextDelay,\n onAdvanceChild,\n onFinish,\n onResetAnimationEnd,\n onResetAnimationStart,\n onTypingAnimationEnd,\n onTypingAnimationStart,\n resetDelay,\n resetSpeed,\n shouldCalcAutoSpeed,\n shouldForceCursorAnimation,\n shouldUseResetAnimation,\n shouldWaitForContent,\n speed,\n startDelay,\n}: UseTypewriterAnimationProps): UseTypewriterAnimationResult => {\n const [hasRenderedChildrenOnce, setHasRenderedChildrenOnce] = useState(false);\n const [shouldPreventBlinkingCursor, setShouldPreventBlinkingCursor] = useState(false);\n const [isResetAnimationActive, setIsResetAnimationActive] = useState(false);\n const [shouldStopAnimation, setShouldStopAnimation] = useState(false);\n const [shownCharCount, setShownCharCount] = useState(\n charactersCount > 0 ? 0 : currentTextLength,\n );\n const autoSpeed = useChunkStreamingSpeed({\n autoSpeedBaseFactor,\n charactersCount,\n shouldCalcAutoSpeed,\n });\n\n useIsomorphicLayoutEffect(() => {\n setHasRenderedChildrenOnce(false);\n }, [childrenKey]);\n\n if (!hasRenderedChildrenOnce) setHasRenderedChildrenOnce(true);\n\n const shouldShowFullTextImmediately = shouldStopAnimation || charactersCount === 0;\n const effectiveShownCharCount = shouldShowFullTextImmediately\n ? currentTextLength\n : shownCharCount;\n\n const isTypingAnimationActive =\n !shouldShowFullTextImmediately &&\n (effectiveShownCharCount < currentTextLength || childrenCount > 1);\n\n const isAnimatingText = isTypingAnimationActive || shouldForceCursorAnimation;\n\n const handleClick = (event: MouseEvent) => {\n event.stopPropagation();\n event.preventDefault();\n\n setShouldStopAnimation(true);\n };\n\n useEffect(() => {\n let frameId: number | undefined;\n let lastTimeRendered: number | undefined;\n let accumulatedTime = 0;\n let timeoutId: number | undefined;\n\n const safeCancelFrame = () => {\n if (typeof frameId === 'number') {\n cancelAnimationFrame(frameId);\n frameId = undefined;\n }\n };\n\n const safeClearTimeout = () => {\n if (typeof timeoutId === 'number') {\n clearTimeout(timeoutId);\n timeoutId = undefined;\n }\n };\n\n const startAnimationFrameLoop = (\n onTick: (charactersToChange: number) => void,\n speedParam: number,\n ) => {\n lastTimeRendered = undefined;\n accumulatedTime = 0;\n const loop = (timestamp: number) => {\n if (lastTimeRendered === undefined) lastTimeRendered = timestamp;\n const deltaTime = timestamp - lastTimeRendered;\n accumulatedTime += deltaTime;\n const rate = autoSpeed.current ?? speedParam;\n const charactersToChange = Math.floor(accumulatedTime / rate);\n\n if (charactersToChange === 0) {\n lastTimeRendered = timestamp;\n frameId = requestAnimationFrame(loop);\n return;\n }\n\n onTick(charactersToChange);\n accumulatedTime -= charactersToChange * rate;\n\n lastTimeRendered = timestamp;\n frameId = requestAnimationFrame(loop);\n };\n\n frameId = requestAnimationFrame(loop);\n };\n\n if (shouldShowFullTextImmediately) {\n return () => {\n safeCancelFrame();\n safeClearTimeout();\n };\n }\n\n if (isResetAnimationActive) {\n if (typeof onResetAnimationStart === 'function') {\n onResetAnimationStart();\n }\n\n startAnimationFrameLoop((charactersToRemove) => {\n setShownCharCount((prev) => {\n const nextShownCharCount = Math.max(0, prev - charactersToRemove);\n\n if (nextShownCharCount <= 0) {\n safeCancelFrame();\n\n if (typeof onResetAnimationEnd === 'function') {\n onResetAnimationEnd();\n }\n\n if (childrenCount > 1) {\n timeoutId = window.setTimeout(() => {\n setIsResetAnimationActive(false);\n onAdvanceChild();\n }, nextTextDelay);\n }\n }\n\n return nextShownCharCount;\n });\n }, resetSpeed);\n } else {\n const startTypingAnimation = () => {\n if (cursorType === CursorType.Thin) {\n setShouldPreventBlinkingCursor(true);\n }\n\n if (typeof onTypingAnimationStart === 'function') {\n onTypingAnimationStart();\n }\n\n startAnimationFrameLoop((charactersToAdd) => {\n setShownCharCount((prevState) => {\n let nextState = prevState + charactersToAdd;\n\n if (nextState >= charactersCount && !shouldWaitForContent) {\n if (cursorType === CursorType.Thin) {\n setShouldPreventBlinkingCursor(false);\n }\n\n if (typeof onTypingAnimationEnd === 'function') {\n onTypingAnimationEnd();\n }\n\n nextState = currentTextLength;\n\n safeCancelFrame();\n\n if (childrenCount > 1) {\n timeoutId = window.setTimeout(() => {\n if (shouldUseResetAnimation) {\n setIsResetAnimationActive(true);\n } else {\n setShownCharCount(0);\n timeoutId = window.setTimeout(\n onAdvanceChild,\n nextTextDelay,\n );\n }\n }, resetDelay);\n }\n }\n\n return nextState;\n });\n }, speed);\n };\n\n if (startDelay) {\n timeoutId = window.setTimeout(startTypingAnimation, startDelay);\n } else {\n startTypingAnimation();\n }\n }\n\n return () => {\n safeCancelFrame();\n safeClearTimeout();\n };\n }, [\n childrenCount,\n charactersCount,\n currentTextLength,\n cursorType,\n isResetAnimationActive,\n nextTextDelay,\n onAdvanceChild,\n onResetAnimationEnd,\n onResetAnimationStart,\n onTypingAnimationEnd,\n onTypingAnimationStart,\n resetDelay,\n resetSpeed,\n shouldShowFullTextImmediately,\n autoSpeed,\n shouldUseResetAnimation,\n shouldWaitForContent,\n speed,\n startDelay,\n ]);\n\n useEffect(() => {\n if (!isTypingAnimationActive && typeof onFinish === 'function') {\n onFinish();\n }\n }, [isTypingAnimationActive, onFinish]);\n\n return {\n effectiveShownCharCount,\n handleClick,\n hasRenderedChildrenOnce,\n isAnimatingText,\n isTypingAnimationActive,\n shouldPreventBlinkingCursor,\n };\n};\n\nexport default useTypewriterAnimation;\n"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,uBAAA,GAAAC,sBAAA,CAAAH,OAAA;AAA8D,SAAAG,uBAAAC,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE9D,MAAMG,yBAAyB,GAAG,OAAOC,MAAM,KAAK,WAAW,GAAGC,sBAAe,GAAGC,gBAAS;AAmC7F,MAAMC,sBAAsB,GAAGA,CAAC;EAC5BC,mBAAmB;EACnBC,eAAe;EACfC,WAAW;EACXC,aAAa;EACbC,iBAAiB;EACjBC,UAAU;EACVC,aAAa;EACbC,cAAc;EACdC,QAAQ;EACRC,mBAAmB;EACnBC,qBAAqB;EACrBC,oBAAoB;EACpBC,sBAAsB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,UAAU,EACVC,UAAU,EACVoB,6BAA6B,EAC7BF,SAAS,EACTf,uBAAuB,EACvBC,oBAAoB,EACpBC,KAAK,EACLC,UAAU,CACb,CAAC;EAEF,IAAAtB,gBAAS,EAAC,MAAM;IACZ,IAAI,CAACsC,uBAAuB,IAAI,OAAO5B,QAAQ,KAAK,UAAU,EAAE;MAC5DA,QAAQ,CAAC,CAAC;IACd;EACJ,CAAC,EAAE,CAAC4B,uBAAuB,EAAE5B,QAAQ,CAAC,CAAC;EAEvC,OAAO;IACH2B,uBAAuB;IACvBG,WAAW;IACXjB,uBAAuB;IACvBgB,eAAe;IACfD,uBAAuB;IACvBZ;EACJ,CAAC;AACL,CAAC;AAAC,IAAAkD,QAAA,GAAAC,OAAA,CAAAjF,OAAA,GAEaK,sBAAsB","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","names":["_speed","require","getSubTextFromHTML","html","length","div","document","createElement","innerHTML","text","currLength","escapeText","value","replace","escapeAttr","String","VOID_ELEMENTS","Set","traverse","node","nodeType","textContent","nodeText","remaining","substring","element","nodeName","toLowerCase","attributes","attribute","name","isVoid","has","i","childNodes","childNode","exports","getCharactersCount","count","trim","Array","from","forEach","shuffleArray","array","result","j","Math","floor","random","getSafeAutoSpeed","ema","TypewriterSpeed","ExtraSlow","calculateEMA","currentEMA","newValue","alpha","updateChunkStreamingSpeedEMA","currentLength","state","now","Date","deltaTime","lastTimestamp","deltaLength","lastLength","charsPerSecond","max","newEMA"],"sources":["../../../src/utils/utils.ts"],"sourcesContent":["import { TypewriterSpeed } from '../types/speed';\n\n/**\n * Returns a substring of an HTML string while preserving HTML structure.\n *\n * Core rules:\n * - Element nodes are re-serialized as tags (start/end) to keep structure.\n * - Text nodes are always HTML-escaped on output. This prevents that previously\n * escaped text (like \"<div>\") turns into real tags during the DOM round trip.\n * - Attribute values are HTML-escaped on output.\n * - Void elements are serialized without closing tags.\n * - For TWIGNORE/TW-IGNORE elements, the innerHTML is passed through so that\n * their content (including real HTML) remains untouched.\n * - On early cutoff (once the length limit is reached), already opened tags are\n * properly closed to keep the result valid HTML.\n *\n * Note on length counting:\n * - The length is based on the decoded textContent length (as the DOM provides),\n * not on byte length nor escaped entity length. This mirrors how the text is perceived.\n *\n * @param html The input HTML string; may contain a mix of real HTML and already escaped HTML.\n * @param length The maximum number of text characters (based on textContent) to include.\n * @returns A valid HTML string containing up to the specified number of text characters,\n * preserving HTML tags and keeping escaped text escaped.\n */\nexport const getSubTextFromHTML = (html: string, length: number): string => {\n const div = document.createElement('div');\n\n div.innerHTML = html;\n\n let text = '';\n let currLength = 0;\n\n // Escape text node content to ensure that decoded \"<\" and \">\" do not become real tags.\n const escapeText = (value: string): string =>\n value.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');\n\n // Escape attribute values safely.\n const escapeAttr = (value: string): string =>\n String(value)\n .replace(/&/g, '&')\n .replace(/\"/g, '"')\n .replace(/</g, '<')\n .replace(/>/g, '>');\n\n // HTML void elements (must not have closing tags)\n const VOID_ELEMENTS = new Set([\n 'area',\n 'base',\n 'br',\n 'col',\n 'embed',\n 'hr',\n 'img',\n 'input',\n 'link',\n 'meta',\n 'param',\n 'source',\n 'track',\n 'wbr',\n ]);\n\n // Traverses nodes and appends to \"text\".\n // Returns false to signal \"stop traversal\" once the length limit is reached.\n const traverse = (node: Node): boolean => {\n // Text node\n if (node.nodeType === 3 && typeof node.textContent === 'string') {\n const nodeText = node.textContent;\n const remaining = length - currLength;\n\n if (remaining <= 0) {\n return false;\n }\n\n if (nodeText.length <= remaining) {\n // Always escape text before writing to output\n text += escapeText(nodeText);\n currLength += nodeText.length;\n } else {\n // Cut the text and stop traversal\n text += escapeText(nodeText.substring(0, remaining));\n currLength += remaining;\n return false;\n }\n\n return true;\n }\n\n // Element node\n if (node.nodeType === 1) {\n const element = node as Element;\n\n // Pass-through for TWIGNORE/TW-IGNORE: keep their HTML as-is.\n if (element.nodeName === 'TWIGNORE' || element.nodeName === 'TW-IGNORE') {\n // element.innerHTML serializes children; escaped text stays escaped,\n // real HTML stays HTML — exactly what we want here.\n text += element.innerHTML;\n return true;\n }\n\n const nodeName = element.nodeName.toLowerCase();\n\n // Serialize attributes safely\n let attributes = '';\n // @ts-expect-error: attributes is a NodeListOf<Attr>\n // eslint-disable-next-line no-restricted-syntax\n for (const attribute of element.attributes) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access,@typescript-eslint/restrict-template-expressions,@typescript-eslint/no-unsafe-argument\n attributes += ` ${attribute.name}=\"${escapeAttr(attribute.value)}\"`;\n }\n\n // Open tag\n text += `<${nodeName}${attributes}>`;\n\n // Void elements: do not recurse children and do not emit a closing tag\n const isVoid = VOID_ELEMENTS.has(nodeName);\n if (!isVoid) {\n // Recurse through children until limit is reached\n for (let i = 0; i < element.childNodes.length; i++) {\n const childNode = element.childNodes[i];\n if (childNode && !traverse(childNode)) {\n // On early stop: close this tag to keep valid HTML, then bubble stop.\n text += `</${nodeName}>`;\n return false;\n }\n }\n\n // Close tag after all children\n text += `</${nodeName}>`;\n }\n\n return true;\n }\n\n // Other node types (comments, etc.) are ignored for text length\n return true;\n };\n\n // Traverse top-level children\n for (let i = 0; i < div.childNodes.length; i++) {\n const childNode = div.childNodes[i];\n if (childNode && !traverse(childNode)) {\n return text;\n }\n }\n\n return text;\n};\n\nexport const getCharactersCount = (html: string): number => {\n const div = document.createElement('div');\n\n div.innerHTML = html;\n\n let count = 0;\n\n const traverse = (node: Node): void => {\n if (node.nodeName === 'TWIGNORE') {\n count += 1;\n } else if (node.nodeType === 3 && typeof node.textContent === 'string') {\n count += node.textContent.trim().length;\n } else if (node.nodeType === 1) {\n if (node.nodeName === 'CODE' && node.textContent !== null) {\n count += node.textContent.length;\n\n return;\n }\n\n Array.from(node.childNodes).forEach(traverse);\n }\n };\n\n Array.from(div.childNodes).forEach(traverse);\n\n return count;\n};\n\nexport const shuffleArray = <T>(array: T[]): T[] => {\n const result = Array.from(array);\n\n for (let i = result.length - 1; i > 0; i--) {\n const j = Math.floor(Math.random() * (i + 1));\n\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n [result[i], result[j]] = [result[j]!, result[i]!];\n }\n\n return result;\n};\n\nexport const getSafeAutoSpeed = (ema: number): number => {\n if (ema <= 0) {\n return TypewriterSpeed.ExtraSlow;\n }\n\n return 1000 / ema;\n};\n\ninterface CalculateEMAProps {\n currentEMA: number;\n newValue: number;\n alpha?: number;\n}\n\nexport const calculateEMA = ({ currentEMA, newValue, alpha = 0.75 }: CalculateEMAProps): number =>\n alpha * newValue + (1 - alpha) * currentEMA;\n\nexport interface ChunkStreamingSpeedState {\n lastTimestamp?: number;\n lastLength: number;\n ema: number;\n}\n\ninterface ChunkStreamingSpeedProps {\n currentLength: number;\n state: ChunkStreamingSpeedState;\n}\n\nexport const updateChunkStreamingSpeedEMA = ({\n currentLength,\n state,\n}: ChunkStreamingSpeedProps): ChunkStreamingSpeedState => {\n const now = Date.now();\n const deltaTime = now - (state?.lastTimestamp ?? now);\n\n if (deltaTime <= 0) return { ...state, lastTimestamp: now };\n\n const deltaLength = currentLength - state.lastLength;\n\n const charsPerSecond = Math.max(0, (deltaLength / deltaTime) * 1000);\n\n const newEMA = calculateEMA({\n currentEMA: state.ema,\n newValue: charsPerSecond,\n });\n\n return {\n lastTimestamp: now,\n lastLength: currentLength,\n ema: newEMA,\n };\n};\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,kBAAkB,GAAGA,CAACC,IAAY,EAAEC,MAAc,KAAa;EACxE,MAAMC,GAAG,GAAGC,QAAQ,CAACC,aAAa,CAAC,KAAK,CAAC;EAEzCF,GAAG,CAACG,SAAS,GAAGL,IAAI;EAEpB,IAAIM,IAAI,GAAG,EAAE;EACb,IAAIC,UA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AAK,aAALA,KAAK,uBAALA,KAAK,CAAEI,aAAa,KAAIH,GAAG,CAAC;EAErD,IAAIE,SAAS,IAAI,CAAC,EAAE,OAAO;IAAE,GAAGH,KAAK;IAAEI,aAAa,EAAEH;EAAI,CAAC;EAE3D,MAAMI,WAAW,GAAGN,aAAa,GAAGC,KAAK,CAACM,UAAU;EAEpD,MAAMC,cAAc,GAAGpB,IAAI,CAACqB,GAAG,CAAC,CAAC,EAAGH,WAAW,GAAGF,SAAS,GAAI,IAAI,CAAC;EAEpE,MAAMM,MAAM,GAAGf,YAAY,CAAC;IACxBC,UAAU,EAAEK,KAAK,CAACT,GAAG;IACrBK,QAAQ,EAAEW;EACd,CAAC,CAAC;EAEF,OAAO;IACHH,aAAa,EAAEH,GAAG;IAClBK,UAAU,EAAEP,aAAa;IACzBR,GAAG,EAAEkB;EACT,CAAC;AACL,CAAC;AAACjC,OAAA,CAAAsB,4BAAA,GAAAA,4BAAA","ignoreList":[]}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { createPortal } from 'react-dom';
|
|
3
|
-
import AnimatedTypewriterText from './animated-typewriter-text/AnimatedTypewriterText';
|
|
4
|
-
import { StyledTypewriter, StyledTypewriterPseudoText, StyledTypewriterText } from './TypewriterView.styles';
|
|
5
|
-
const TypewriterView = ({
|
|
6
|
-
children,
|
|
7
|
-
cursorType,
|
|
8
|
-
handleClick,
|
|
9
|
-
hasRenderedChildrenOnce,
|
|
10
|
-
isAnimatingText,
|
|
11
|
-
pseudoTextHTML,
|
|
12
|
-
shouldHideCursor,
|
|
13
|
-
shouldPreventBlinkingCursor,
|
|
14
|
-
shouldRemainSingleLine,
|
|
15
|
-
shownText,
|
|
16
|
-
textStyle
|
|
17
|
-
}) => /*#__PURE__*/React.createElement(StyledTypewriter, {
|
|
18
|
-
$cursorType: cursorType,
|
|
19
|
-
onClick: handleClick,
|
|
20
|
-
$isAnimatingText: isAnimatingText,
|
|
21
|
-
$shouldHideCursor: shouldHideCursor,
|
|
22
|
-
$shouldPreventBlinkAnimation: shouldPreventBlinkingCursor
|
|
23
|
-
}, isAnimatingText ? /*#__PURE__*/React.createElement(AnimatedTypewriterText, {
|
|
24
|
-
shouldHideCursor: shouldHideCursor,
|
|
25
|
-
shouldRemainSingleLine: shouldRemainSingleLine,
|
|
26
|
-
shownText: shownText,
|
|
27
|
-
textStyle: textStyle
|
|
28
|
-
}) : /*#__PURE__*/React.createElement(StyledTypewriterText, {
|
|
29
|
-
className: "notranslate",
|
|
30
|
-
$shouldRemainSingleLine: shouldRemainSingleLine,
|
|
31
|
-
dangerouslySetInnerHTML: typeof children === 'string' ? {
|
|
32
|
-
__html: shownText
|
|
33
|
-
} : undefined,
|
|
34
|
-
style: textStyle
|
|
35
|
-
}, typeof children !== 'string' ? children : undefined), isAnimatingText && /*#__PURE__*/React.createElement(StyledTypewriterPseudoText, {
|
|
36
|
-
$isAnimatingText: isAnimatingText,
|
|
37
|
-
$shouldHideCursor: shouldHideCursor,
|
|
38
|
-
dangerouslySetInnerHTML: {
|
|
39
|
-
__html: pseudoTextHTML
|
|
40
|
-
}
|
|
41
|
-
}), !hasRenderedChildrenOnce && /*#__PURE__*/createPortal(/*#__PURE__*/React.createElement("div", {
|
|
42
|
-
style: {
|
|
43
|
-
position: 'absolute',
|
|
44
|
-
visibility: 'hidden'
|
|
45
|
-
}
|
|
46
|
-
}, children), document.body));
|
|
47
|
-
export default TypewriterView;
|
|
48
|
-
//# sourceMappingURL=TypewriterView.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TypewriterView.js","names":["React","createPortal","AnimatedTypewriterText","StyledTypewriter","StyledTypewriterPseudoText","StyledTypewriterText","TypewriterView","children","cursorType","handleClick","hasRenderedChildrenOnce","isAnimatingText","pseudoTextHTML","shouldHideCursor","shouldPreventBlinkingCursor","shouldRemainSingleLine","shownText","textStyle","createElement","$cursorType","onClick","$isAnimatingText","$shouldHideCursor","$shouldPreventBlinkAnimation","className","$shouldRemainSingleLine","dangerouslySetInnerHTML","__html","undefined","style","position","visibility","document","body"],"sources":["../../../../../src/components/typewriter/typewrite-view/TypewriterView.tsx"],"sourcesContent":["import React, { FC, ReactElement } from 'react';\nimport { createPortal } from 'react-dom';\nimport { CSSPropertiesWithVars } from 'styled-components/dist/types';\nimport { CursorType } from '../../../types/cursor';\nimport AnimatedTypewriterText from './animated-typewriter-text/AnimatedTypewriterText';\nimport {\n StyledTypewriter,\n StyledTypewriterPseudoText,\n StyledTypewriterText,\n} from './TypewriterView.styles';\n\nexport type TypewriterContent = ReactElement | string | Array<ReactElement | string>;\n\ntype TypewriterViewProps = {\n children: TypewriterContent;\n cursorType: CursorType;\n handleClick?: (event: React.MouseEvent) => void;\n hasRenderedChildrenOnce: boolean;\n isAnimatingText: boolean;\n pseudoTextHTML: string;\n shouldHideCursor: boolean;\n shouldPreventBlinkingCursor: boolean;\n shouldRemainSingleLine: boolean;\n shownText: string;\n textStyle?: CSSPropertiesWithVars;\n};\n\nconst TypewriterView: FC<TypewriterViewProps> = ({\n children,\n cursorType,\n handleClick,\n hasRenderedChildrenOnce,\n isAnimatingText,\n pseudoTextHTML,\n shouldHideCursor,\n shouldPreventBlinkingCursor,\n shouldRemainSingleLine,\n shownText,\n textStyle,\n}) => (\n <StyledTypewriter\n $cursorType={cursorType}\n onClick={handleClick}\n $isAnimatingText={isAnimatingText}\n $shouldHideCursor={shouldHideCursor}\n $shouldPreventBlinkAnimation={shouldPreventBlinkingCursor}\n >\n {isAnimatingText ? (\n <AnimatedTypewriterText\n shouldHideCursor={shouldHideCursor}\n shouldRemainSingleLine={shouldRemainSingleLine}\n shownText={shownText}\n textStyle={textStyle}\n />\n ) : (\n <StyledTypewriterText\n className=\"notranslate\"\n $shouldRemainSingleLine={shouldRemainSingleLine}\n dangerouslySetInnerHTML={\n typeof children === 'string' ? { __html: shownText } : undefined\n }\n style={textStyle}\n >\n {typeof children !== 'string' ? children : undefined}\n </StyledTypewriterText>\n )}\n {isAnimatingText && (\n <StyledTypewriterPseudoText\n $isAnimatingText={isAnimatingText}\n $shouldHideCursor={shouldHideCursor}\n dangerouslySetInnerHTML={{ __html: pseudoTextHTML }}\n />\n )}\n {/*\n The following is needed because some components like the CodeHighlighter will not render correct\n if the element is not rendered on a client before...\n */}\n {!hasRenderedChildrenOnce &&\n createPortal(\n <div style={{ position: 'absolute', visibility: 'hidden' }}>{children}</div>,\n document.body,\n )}\n </StyledTypewriter>\n);\n\nexport default TypewriterView;\n"],"mappings":"AAAA,OAAOA,KAAK,MAA4B,OAAO;AAC/C,SAASC,YAAY,QAAQ,WAAW;AAGxC,OAAOC,sBAAsB,MAAM,mDAAmD;AACtF,SACIC,gBAAgB,EAChBC,0BAA0B,EAC1BC,oBAAoB,QACjB,yBAAyB;AAkBhC,MAAMC,cAAuC,GAAGA,CAAC;EAC7CC,QAAQ;EACRC,UAAU;EACVC,WAAW;EACXC,uBAAuB;EACvBC,eAAe;EACfC,cAAc;EACdC,gBAAgB;EAChBC,2BAA2B;EAC3BC,sBAAsB;EACtBC,SAAS;EACTC;AACJ,CAAC,kBACGjB,KAAA,CAAAkB,aAAA,CAACf,gBAAgB;EACbgB,WAAW,EAAEX,UAAW;EACxBY,OAAO,EAAEX,WAAY;EACrBY,gBAAgB,EAAEV,eAAgB;EAClCW,iBAAiB,EAAET,gBAAiB;EACpCU,4BAA4B,EAAET;AAA4B,GAEzDH,eAAe,gBACZX,KAAA,CAAAkB,aAAA,CAAChB,sBAAsB;EACnBW,gBAAgB,EAAEA,gBAAiB;EACnCE,sBAAsB,EAAEA,sBAAuB;EAC/CC,SAAS,EAAEA,SAAU;EACrBC,SAAS,EAAEA;AAAU,CACxB,CAAC,gBAEFjB,KAAA,CAAAkB,aAAA,CAACb,oBAAoB;EACjBmB,SAAS,EAAC,aAAa;EACvBC,uBAAuB,EAAEV,sBAAuB;EAChDW,uBAAuB,EACnB,OAAOnB,QAAQ,KAAK,QAAQ,GAAG;IAAEoB,MAAM,EAAEX;EAAU,CAAC,GAAGY,SAC1D;EACDC,KAAK,EAAEZ;AAAU,GAEhB,OAAOV,QAAQ,KAAK,QAAQ,GAAGA,QAAQ,GAAGqB,SACzB,CACzB,EACAjB,eAAe,iBACZX,KAAA,CAAAkB,aAAA,CAACd,0BAA0B;EACvBiB,gBAAgB,EAAEV,eAAgB;EAClCW,iBAAiB,EAAET,gBAAiB;EACpCa,uBAAuB,EAAE;IAAEC,MAAM,EAAEf;EAAe;AAAE,CACvD,CACJ,EAKA,CAACF,uBAAuB,iBACrBT,YAAY,cACRD,KAAA,CAAAkB,aAAA;EAAKW,KAAK,EAAE;IAAEC,QAAQ,EAAE,UAAU;IAAEC,UAAU,EAAE;EAAS;AAAE,GAAExB,QAAc,CAAC,EAC5EyB,QAAQ,CAACC,IACb,CACU,CACrB;AAED,eAAe3B,cAAc","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TypewriterView.styles.js","names":["styled","css","keyframes","CursorType","typewriterCursorElement","$cursorType","$isAnimatingText","$shouldHideCursor","$shouldPreventBlinkAnimation","Thin","blinkAnimation","theme","text","StyledTypewriter","div","StyledTypewriterPseudoText","span","StyledTypewriterText","$shouldRemainSingleLine"],"sources":["../../../../../src/components/typewriter/typewrite-view/TypewriterView.styles.ts"],"sourcesContent":["import type { WithTheme } from '@chayns-components/core';\nimport styled, { css, keyframes } from 'styled-components';\nimport { CursorType } from '../../../types/cursor';\nimport type { TypewriterProps } from '../Typewriter';\n\ntype StyledTypewriterProps = WithTheme<{\n $cursorType: TypewriterProps['cursorType'];\n $isAnimatingText: boolean;\n $shouldHideCursor: TypewriterProps['shouldHideCursor'];\n $shouldPreventBlinkAnimation: boolean;\n}>;\n\nconst typewriterCursorElement = ({\n $cursorType,\n $isAnimatingText,\n $shouldHideCursor,\n $shouldPreventBlinkAnimation,\n}: StyledTypewriterProps) => {\n if (!$isAnimatingText || $shouldHideCursor) {\n return '';\n }\n\n if ($cursorType === CursorType.Thin) {\n return css`\n .typewriter-lastWithContent {\n &:after {\n animation: ${$shouldPreventBlinkAnimation ? 'none' : blinkAnimation} 1s steps(2, start) infinite;\n color: inherit;\n content: '|';\n font-size: 25px;\n position: relative;\n line-height: 0;\n vertical-align: baseline;\n }\n `;\n }\n\n return css`\n .typewriter-lastWithContent {\n &:after {\n animation: ${blinkAnimation} 1s steps(2, start) infinite;\n color: ${({ theme }) => (theme as { text: string }).text};\n content: '▋';\n margin-left: 0.25rem;\n opacity: 0.85;\n position: relative;\n vertical-align: baseline;\n }\n }\n `;\n};\n\nexport const StyledTypewriter = styled.div<StyledTypewriterProps>`\n align-items: inherit;\n display: flex;\n position: relative;\n width: 100%;\n ${typewriterCursorElement}\n`;\n\nconst blinkAnimation = keyframes`\n 100% {\n visibility: hidden;\n }\n`;\n\ntype StyledTypewriterPseudoTextProps = WithTheme<{\n $isAnimatingText?: boolean;\n $shouldHideCursor: TypewriterProps['shouldHideCursor'];\n}>;\n\nexport const StyledTypewriterPseudoText = styled.span<StyledTypewriterPseudoTextProps>`\n opacity: 0;\n pointer-events: none;\n user-select: none;\n width: fit-content;\n\n ${({ $isAnimatingText, $shouldHideCursor }) =>\n $isAnimatingText &&\n !$shouldHideCursor &&\n css`\n &:after {\n animation: ${blinkAnimation} 1s steps(2, start) infinite;\n color: inherit;\n content: '|';\n font-size: 25px;\n position: relative;\n line-height: 0;\n vertical-align: baseline;\n }\n `}\n`;\n\ntype StyledTypewriterTextProps = WithTheme<{\n $isAnimatingText?: boolean;\n $shouldRemainSingleLine: boolean;\n}>;\n\nexport const StyledTypewriterText = styled.span<StyledTypewriterTextProps>`\n color: inherit;\n position: ${({ $isAnimatingText }) => ($isAnimatingText ? 'absolute' : 'relative')};\n width: fit-content;\n\n ${({ $isAnimatingText }) =>\n $isAnimatingText &&\n css`\n pointer-events: none;\n `}\n\n ${({ $shouldRemainSingleLine }) =>\n $shouldRemainSingleLine &&\n css`\n white-space: nowrap;\n overflow: hidden;\n text-over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AG,UAAW;AACtF;AACA;AACA,MAAM,CAAC;EAAEA;AAAiB,CAAC,KACnBA,gBAAgB,IAChBL,GAAG;AACX;AACA,SAAS;AACT;AACA,MAAM,CAAC;EAAEiB;AAAwB,CAAC,KAC1BA,uBAAuB,IACvBjB,GAAG;AACX;AACA;AACA;AACA;AACA,SAAS;AACT,CAAC","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AnimatedTypewriterText.js","names":["React","useCallback","useMemo","StyledTypewriterText","AnimatedTypewriterText","shouldHideCursor","shownText","shouldRemainSingleLine","textStyle","updateTypewriterCursor","ref","traverseNodes","node","nodeType","Node","TEXT_NODE","textContent","trim","parentElement","childNodes","Array","from","i","length","result","lastParentWithContent","classList","remove","querySelectorAll","forEach","element","add","createElement","dangerouslySetInnerHTML","__html","$shouldRemainSingleLine","style","$isAnimatingText"],"sources":["../../../../../../src/components/typewriter/typewrite-view/animated-typewriter-text/AnimatedTypewriterText.tsx"],"sourcesContent":["import React, { FC, useCallback, useMemo } from 'react';\nimport { CSSPropertiesWithVars } from 'styled-components/dist/types';\nimport { StyledTypewriterText } from '../TypewriterView.styles';\n\ntype AnimatedTypewriterTextProps = {\n shouldHideCursor: boolean;\n shownText: string;\n textStyle?: CSSPropertiesWithVars;\n shouldRemainSingleLine: boolean;\n};\n\nconst AnimatedTypewriterText: FC<AnimatedTypewriterTextProps> = ({\n shouldHideCursor,\n shownText,\n shouldRemainSingleLine,\n textStyle,\n}) => {\n const updateTypewriterCursor = useCallback(\n (ref: HTMLSpanElement | null) => {\n if (ref && !shouldHideCursor) {\n // Finds the last text node with content.\n const traverseNodes = (node: Node): HTMLElement | null => {\n if (node.nodeType === Node.TEXT_NODE && node.textContent?.trim()) {\n return node.parentElement;\n }\n\n const childNodes = Array.from(node.childNodes);\n for (let i = childNodes.length - 1; i >= 0; i--) {\n const result = traverseNodes(childNodes[i] as Node);\n if (result) {\n return result;\n }\n }\n\n return null;\n };\n\n const lastParentWithContent = traverseNodes(ref);\n\n // Removes lastWithContent class from all elements\n ref.classList.remove('typewriter-lastWithContent');\n ref.querySelectorAll('.lastWithContent').forEach((element) => {\n element.classList.remove('typewriter-lastWithContent');\n });\n\n // Adds lastWithContent class to the last element with content\n if (lastParentWithContent) {\n lastParentWithContent.classList.add('typewriter-lastWithContent');\n } else {\n ref.classList.add('typewriter-lastWithContent');\n }\n }\n },\n [shouldHideCursor],\n );\n\n return useMemo(\n () => (\n <StyledTypewriterText\n ref={(ref) => updateTypewriterCursor(ref)}\n dangerouslySetInnerHTML={{ __html: shownText }}\n $shouldRemainSingleLine={shouldRemainSingleLine}\n style={textStyle}\n $isAnimatingText\n />\n ),\n [shownText, shouldRemainSingleLine, textStyle, updateTypewriterCursor],\n );\n};\n\nexport default AnimatedTypewriterText;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAQC,WAAW,EAAEC,OAAO,QAAQ,OAAO;AAEvD,SAASC,oBAAoB,QAAQ,0BAA0B;AAS/D,MAAMC,sBAAuD,GAAGA,CAAC;EAC7DC,gBAAgB;EAChBC,SAAS;EACTC,sBAAsB;EACtBC;AACJ,CAAC,KAAK;EACF,MAAMC,sBAAsB,GAAGR,WAAW,CACrCS,GAA2B,IAAK;IAC7B,IAAIA,GAAG,IAAI,CAACL,gBAAgB,EAAE;MAC1B;MACA,MAAMM,aAAa,GAAIC,IAAU,IAAyB;QACtD,IAAIA,IAAI,CAACC,QAAQ,KAAKC,IAAI,CAACC,SAAS,IAAIH,IAAI,CAACI,WAAW,EAAEC,IAAI,CAAC,CAAC,EAAE;UAC9D,OAAOL,IAAI,CAACM,aAAa;QAC7B;QAEA,MAAMC,UAAU,GAAGC,KAAK,CAACC,IAAI,CAACT,IAAI,CAACO,UAAU,CAAC;QAC9C,KAAK,IAAIG,CAAC,GAAGH,UAAU,CAACI,MAAM,GAAG,CAAC,EAAED,CAAC,IAAI,CAAC,EAAEA,CAAC,EAAE,EAAE;UAC7C,MAAME,MAAM,GAAGb,aAAa,CAACQ,UAAU,CAACG,CAAC,CAAS,CAAC;UACnD,IAAIE,MAAM,EAAE;YACR,OAAOA,MAAM;UACjB;QACJ;QAEA,OAAO,IAAI;MACf,CAAC;MAED,MAAMC,qBAAqB,GAAGd,aAAa,CAACD,GAAG,CAAC;;MAEhD;MACAA,GAAG,CAACgB,SAAS,CAACC,MAAM,CAAC,4BAA4B,CAAC;MAClDjB,GAAG,CAACkB,gBAAgB,CAAC,kBAAkB,CAAC,CAACC,OAAO,CAAEC,OAAO,IAAK;QAC1DA,OAAO,CAACJ,SAAS,CAACC,MAAM,CAAC,4BAA4B,CAAC;MAC1D,CAAC,CAAC;;MAEF;MACA,IAAIF,qBAAqB,EAAE;QACvBA,qBAAqB,CAACC,SAAS,CAACK,GAAG,CAAC,4BAA4B,CAAC;MACrE,CAAC,MAAM;QACHrB,GAAG,CAACgB,SAAS,CAACK,GAAG,CAAC,4BAA4B,CAAC;MACnD;IACJ;EACJ,CAAC,EACD,CAAC1B,gBAAgB,CACrB,CAAC;EAED,OAAOH,OAAO,CACV,mBACIF,KAAA,CAAAgC,aAAA,CAAC7B,oBAAoB;IACjBO,GAAG,EAAGA,GAAG,IAAKD,sBAAsB,CAACC,GAAG,CAAE;IAC1CuB,uBAAuB,EAAE;MAAEC,MAAM,EAAE5B;IAAU,CAAE;IAC/C6B,uBAAuB,EAAE5B,sBAAuB;IAChD6B,KAAK,EAAE5B,SAAU;IACjB6B,gBAAgB;EAAA,CACnB,CACJ,EACD,CAAC/B,SAAS,EAAEC,sBAAsB,EAAEC,SAAS,EAAEC,sBAAsB,CACzE,CAAC;AACL,CAAC;AAED,eAAeL,sBAAsB","ignoreList":[]}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { useEffect, useRef } from 'react';
|
|
2
|
-
import { getSafeAutoSpeed, updateChunkStreamingSpeedEMA } from '../utils/utils';
|
|
3
|
-
const getInitialChunkSpeed = (charactersCount, autoSpeedBaseFactor) => charactersCount / (autoSpeedBaseFactor / 1000);
|
|
4
|
-
const useChunkStreamingSpeed = ({
|
|
5
|
-
autoSpeedBaseFactor,
|
|
6
|
-
charactersCount,
|
|
7
|
-
shouldCalcAutoSpeed
|
|
8
|
-
}) => {
|
|
9
|
-
const autoSpeed = useRef();
|
|
10
|
-
const chunkStreamingSpeed = useRef({
|
|
11
|
-
lastLength: charactersCount,
|
|
12
|
-
ema: getInitialChunkSpeed(charactersCount, autoSpeedBaseFactor)
|
|
13
|
-
});
|
|
14
|
-
useEffect(() => {
|
|
15
|
-
chunkStreamingSpeed.current = updateChunkStreamingSpeedEMA({
|
|
16
|
-
currentLength: charactersCount,
|
|
17
|
-
state: chunkStreamingSpeed.current
|
|
18
|
-
});
|
|
19
|
-
}, [autoSpeedBaseFactor, charactersCount]);
|
|
20
|
-
useEffect(() => {
|
|
21
|
-
if (!shouldCalcAutoSpeed) {
|
|
22
|
-
autoSpeed.current = undefined;
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
autoSpeed.current = getSafeAutoSpeed(chunkStreamingSpeed.current.ema);
|
|
26
|
-
}, [charactersCount, shouldCalcAutoSpeed]);
|
|
27
|
-
return autoSpeed;
|
|
28
|
-
};
|
|
29
|
-
export default useChunkStreamingSpeed;
|
|
30
|
-
//# sourceMappingURL=useChunkStreamingSpeed.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useChunkStreamingSpeed.js","names":["useEffect","useRef","getSafeAutoSpeed","updateChunkStreamingSpeedEMA","getInitialChunkSpeed","charactersCount","autoSpeedBaseFactor","useChunkStreamingSpeed","shouldCalcAutoSpeed","autoSpeed","chunkStreamingSpeed","lastLength","ema","current","currentLength","state","undefined"],"sources":["../../../src/hooks/useChunkStreamingSpeed.ts"],"sourcesContent":["import { useEffect, useRef } from 'react';\nimport {\n ChunkStreamingSpeedState,\n getSafeAutoSpeed,\n updateChunkStreamingSpeedEMA,\n} from '../utils/utils';\n\ntype UseChunkStreamingSpeedProps = {\n autoSpeedBaseFactor: number;\n charactersCount: number;\n shouldCalcAutoSpeed: boolean;\n};\n\nconst getInitialChunkSpeed = (charactersCount: number, autoSpeedBaseFactor: number) =>\n charactersCount / (autoSpeedBaseFactor / 1000);\n\nconst useChunkStreamingSpeed = ({\n autoSpeedBaseFactor,\n charactersCount,\n shouldCalcAutoSpeed,\n}: UseChunkStreamingSpeedProps) => {\n const autoSpeed = useRef<number>();\n const chunkStreamingSpeed = useRef<ChunkStreamingSpeedState>({\n lastLength: charactersCount,\n ema: getInitialChunkSpeed(charactersCount, autoSpeedBaseFactor),\n });\n\n useEffect(() => {\n chunkStreamingSpeed.current = updateChunkStreamingSpeedEMA({\n currentLength: charactersCount,\n state: chunkStreamingSpeed.current,\n });\n }, [autoSpeedBaseFactor, charactersCount]);\n\n useEffect(() => {\n if (!shouldCalcAutoSpeed) {\n autoSpeed.current = undefined;\n return;\n }\n\n autoSpeed.current = getSafeAutoSpeed(chunkStreamingSpeed.current.ema);\n }, [charactersCount, shouldCalcAutoSpeed]);\n\n return autoSpeed;\n};\n\nexport default useChunkStreamingSpeed;\n"],"mappings":"AAAA,SAASA,SAAS,EAAEC,MAAM,QAAQ,OAAO;AACzC,SAEIC,gBAAgB,EAChBC,4BAA4B,QACzB,gBAAgB;AAQvB,MAAMC,oBAAoB,GAAGA,CAACC,eAAuB,EAAEC,mBAA2B,KAC9ED,eAAe,IAAIC,mBAAmB,GAAG,IAAI,CAAC;AAElD,MAAMC,sBAAsB,GAAGA,CAAC;EAC5BD,mBAAmB;EACnBD,eAAe;EACfG;AACyB,CAAC,KAAK;EAC/B,MAAMC,SAAS,GAAGR,MAAM,CAAS,CAAC;EAClC,MAAMS,mBAAmB,GAAGT,MAAM,CAA2B;IACzDU,UAAU,EAAEN,eAAe;IAC3BO,GAAG,EAAER,oBAAoB,CAACC,eAAe,EAAEC,mBAAmB;EAClE,CAAC,CAAC;EAEFN,SAAS,CAAC,MAAM;IACZU,mBAAmB,CAACG,OAAO,GAAGV,4BAA4B,CAAC;MACvDW,aAAa,EAAET,eAAe;MAC9BU,KAAK,EAAEL,mBAAmB,CAACG;IAC/B,CAAC,CAAC;EACN,CAAC,EAAE,CAACP,mBAAmB,EAAED,eAAe,CAAC,CAAC;EAE1CL,SAAS,CAAC,MAAM;IACZ,IAAI,CAACQ,mBAAmB,EAAE;MACtBC,SAAS,CAACI,OAAO,GAAGG,SAAS;MAC7B;IACJ;IAEAP,SAAS,CAACI,OAAO,GAAGX,gBAAgB,CAACQ,mBAAmB,CAACG,OAAO,CAACD,GAAG,CAAC;EACzE,CAAC,EAAE,CAACP,eAAe,EAAEG,mBAAmB,CAAC,CAAC;EAE1C,OAAOC,SAAS;AACpB,CAAC;AAED,eAAeF,sBAAsB","ignoreList":[]}
|