@chayns-components/typewriter 5.0.0-beta.90 → 5.0.0-beta.901

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 (37) hide show
  1. package/README.md +4 -15
  2. package/lib/cjs/components/typewriter/AnimatedTypewriterText.js +59 -0
  3. package/lib/cjs/components/typewriter/AnimatedTypewriterText.js.map +1 -0
  4. package/lib/cjs/components/typewriter/Typewriter.js +229 -0
  5. package/lib/cjs/components/typewriter/Typewriter.js.map +1 -0
  6. package/lib/cjs/components/typewriter/Typewriter.styles.js +59 -0
  7. package/lib/cjs/components/typewriter/Typewriter.styles.js.map +1 -0
  8. package/lib/{components → cjs/components}/typewriter/utils.js +20 -3
  9. package/lib/cjs/components/typewriter/utils.js.map +1 -0
  10. package/lib/cjs/index.js +27 -0
  11. package/lib/cjs/index.js.map +1 -0
  12. package/lib/esm/components/typewriter/AnimatedTypewriterText.js +51 -0
  13. package/lib/esm/components/typewriter/AnimatedTypewriterText.js.map +1 -0
  14. package/lib/esm/components/typewriter/Typewriter.js +223 -0
  15. package/lib/esm/components/typewriter/Typewriter.js.map +1 -0
  16. package/lib/esm/components/typewriter/Typewriter.styles.js +63 -0
  17. package/lib/esm/components/typewriter/Typewriter.styles.js.map +1 -0
  18. package/lib/esm/components/typewriter/utils.js +85 -0
  19. package/lib/esm/components/typewriter/utils.js.map +1 -0
  20. package/lib/esm/index.js +2 -0
  21. package/lib/esm/index.js.map +1 -0
  22. package/lib/types/components/typewriter/AnimatedTypewriterText.d.ts +8 -0
  23. package/lib/types/components/typewriter/Typewriter.d.ts +84 -0
  24. package/lib/types/components/typewriter/Typewriter.styles.d.ts +12 -0
  25. package/lib/{components → types/components}/typewriter/utils.d.ts +1 -0
  26. package/lib/types/index.d.ts +1 -0
  27. package/package.json +46 -28
  28. package/lib/components/typewriter/Typewriter.d.ts +0 -15
  29. package/lib/components/typewriter/Typewriter.js +0 -77
  30. package/lib/components/typewriter/Typewriter.js.map +0 -1
  31. package/lib/components/typewriter/Typewriter.styles.d.ts +0 -7
  32. package/lib/components/typewriter/Typewriter.styles.js +0 -62
  33. package/lib/components/typewriter/Typewriter.styles.js.map +0 -1
  34. package/lib/components/typewriter/utils.js.map +0 -1
  35. package/lib/index.d.ts +0 -1
  36. package/lib/index.js +0 -21
  37. package/lib/index.js.map +0 -1
package/README.md CHANGED
@@ -4,8 +4,8 @@
4
4
  </h1>
5
5
  <p>A set of beautiful React components for developing your own applications with chayns.</p>
6
6
  <div>
7
- <img src="https://img.shields.io/npm/dm/@chayns-components/typewriter.svg?style=for-the-badge" alt="" />
8
- <img src="https://img.shields.io/npm/v/@chayns-components/typewriter?style=for-the-badge" alt="" />
7
+ <img src="https://img.shields.io/npm/dm/@chayns-components/core.svg?style=for-the-badge" alt="" />
8
+ <img src="https://img.shields.io/npm/v/@chayns-components/core?style=for-the-badge" alt="" />
9
9
  <img src="https://img.shields.io/github/license/TobitSoftware/chayns-components?style=for-the-badge" alt="" />
10
10
  <img src="https://img.shields.io/github/contributors/TobitSoftware/chayns-components?style=for-the-badge" alt="" />
11
11
  </div>
@@ -15,7 +15,7 @@
15
15
 
16
16
  ## Installation
17
17
 
18
- First you need to install the typewriter part of the chayns-components.
18
+ First you need to install the core part of the chayns-components.
19
19
 
20
20
  ```bash
21
21
  # NPM
@@ -31,15 +31,4 @@ yarn add @chayns-components/typewriter
31
31
 
32
32
  ## Usage
33
33
 
34
- You can use the components in your project as in the following example.
35
-
36
- ```typescript jsx
37
- import { Typewriter } from '@chayns-components/typewriter';
38
-
39
- <Typewriter>
40
- Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt
41
- ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo
42
- dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est. Lorem ipsum dolor
43
- sit amet.
44
- </Typewriter>;
45
- ```
34
+ For detailed usage visit the [storybook](https://components.chayns.site/storybook).
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _react = _interopRequireWildcard(require("react"));
8
+ var _Typewriter = require("./Typewriter.styles");
9
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
10
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
11
+ const AnimatedTypewriterText = ({
12
+ shouldHideCursor,
13
+ shownText,
14
+ textStyle
15
+ }) => {
16
+ const updateTypewriterCursor = (0, _react.useCallback)(ref => {
17
+ if (ref && !shouldHideCursor) {
18
+ // Finds the last text node with content.
19
+ const traverseNodes = node => {
20
+ var _node$textContent;
21
+ if (node.nodeType === Node.TEXT_NODE && (_node$textContent = node.textContent) !== null && _node$textContent !== void 0 && _node$textContent.trim()) {
22
+ return node.parentElement;
23
+ }
24
+ const childNodes = Array.from(node.childNodes);
25
+ for (let i = childNodes.length - 1; i >= 0; i--) {
26
+ const result = traverseNodes(childNodes[i]);
27
+ if (result) {
28
+ return result;
29
+ }
30
+ }
31
+ return null;
32
+ };
33
+ const lastParentWithContent = traverseNodes(ref);
34
+
35
+ // Removes lastWithContent class from all elements
36
+ ref.classList.remove('typewriter-lastWithContent');
37
+ ref.querySelectorAll('.lastWithContent').forEach(element => {
38
+ element.classList.remove('typewriter-lastWithContent');
39
+ });
40
+
41
+ // Adds lastWithContent class to the last element with content
42
+ if (lastParentWithContent) {
43
+ lastParentWithContent.classList.add('typewriter-lastWithContent');
44
+ } else {
45
+ ref.classList.add('typewriter-lastWithContent');
46
+ }
47
+ }
48
+ }, [shouldHideCursor]);
49
+ return (0, _react.useMemo)(() => /*#__PURE__*/_react.default.createElement(_Typewriter.StyledTypewriterText, {
50
+ ref: ref => updateTypewriterCursor(ref),
51
+ dangerouslySetInnerHTML: {
52
+ __html: shownText
53
+ },
54
+ style: textStyle,
55
+ $isAnimatingText: true
56
+ }), [updateTypewriterCursor, shownText, textStyle]);
57
+ };
58
+ var _default = exports.default = AnimatedTypewriterText;
59
+ //# sourceMappingURL=AnimatedTypewriterText.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AnimatedTypewriterText.js","names":["_react","_interopRequireWildcard","require","_Typewriter","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","AnimatedTypewriterText","shouldHideCursor","shownText","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","style","$isAnimatingText","_default","exports"],"sources":["../../../../src/components/typewriter/AnimatedTypewriterText.tsx"],"sourcesContent":["import React, {FC, useCallback, useEffect, useMemo, useRef} from 'react';\nimport {StyledTypewriterText} from \"./Typewriter.styles\";\n\ntype AnimatedTypewriterTextProps = {\n shouldHideCursor: boolean;\n shownText: string;\n textStyle?: React.CSSProperties;\n};\n\nconst AnimatedTypewriterText: FC<AnimatedTypewriterTextProps> = ({\n shouldHideCursor,\n shownText,\n textStyle\n}) => {\n const updateTypewriterCursor = useCallback((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 }, [shouldHideCursor]);\n\n return useMemo(() => (\n <StyledTypewriterText\n ref={(ref) => updateTypewriterCursor(ref)}\n dangerouslySetInnerHTML={{ __html: shownText }}\n style={textStyle}\n $isAnimatingText\n />\n ), [updateTypewriterCursor, shownText, textStyle]);\n};\n\nexport default AnimatedTypewriterText;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAAyD,SAAAE,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAJ,wBAAAI,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ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MAAMsB,MAAM,GAAGb,aAAa,CAACS,UAAU,CAAClB,CAAC,CAAS,CAAC;UACnD,IAAIsB,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,CAACC,OAAO,IAAI;QACxDA,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,EAAE,CAAC1B,gBAAgB,CAAC,CAAC;EAEtB,OAAO,IAAA2B,cAAO,EAAC,mBACXpD,MAAA,CAAAU,OAAA,CAAA2C,aAAA,CAAClD,WAAA,CAAAmD,oBAAoB;IACjBxB,GAAG,EAAGA,GAAG,IAAKF,sBAAsB,CAACE,GAAG,CAAE;IAC1CyB,uBAAuB,EAAE;MAAEC,MAAM,EAAE9B;IAAU,CAAE;IAC/C+B,KAAK,EAAE9B,SAAU;IACjB+B,gBAAgB;EAAA,CACnB,CACJ,EAAE,CAAC9B,sBAAsB,EAAEF,SAAS,EAAEC,SAAS,CAAC,CAAC;AACtD,CAAC;AAAC,IAAAgC,QAAA,GAAAC,OAAA,CAAAlD,OAAA,GAEac,sBAAsB","ignoreList":[]}
@@ -0,0 +1,229 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = exports.TypewriterSpeed = exports.TypewriterDelay = void 0;
7
+ var _core = require("@chayns-components/core");
8
+ var _chaynsApi = require("chayns-api");
9
+ var _react = _interopRequireWildcard(require("react"));
10
+ var _reactDom = require("react-dom");
11
+ var _server = require("react-dom/server");
12
+ var _Typewriter = require("./Typewriter.styles");
13
+ var _utils = require("./utils");
14
+ var _AnimatedTypewriterText = _interopRequireDefault(require("./AnimatedTypewriterText"));
15
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
16
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
17
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
18
+ const useIsomorphicLayoutEffect = typeof window !== 'undefined' ? _react.useLayoutEffect : _react.useEffect;
19
+
20
+ // noinspection JSUnusedGlobalSymbols
21
+ let TypewriterDelay = exports.TypewriterDelay = /*#__PURE__*/function (TypewriterDelay) {
22
+ TypewriterDelay[TypewriterDelay["ExtraSlow"] = 4000] = "ExtraSlow";
23
+ TypewriterDelay[TypewriterDelay["Slow"] = 2000] = "Slow";
24
+ TypewriterDelay[TypewriterDelay["Medium"] = 1000] = "Medium";
25
+ TypewriterDelay[TypewriterDelay["Fast"] = 500] = "Fast";
26
+ TypewriterDelay[TypewriterDelay["ExtraFast"] = 250] = "ExtraFast";
27
+ TypewriterDelay[TypewriterDelay["None"] = 0] = "None";
28
+ return TypewriterDelay;
29
+ }({}); // noinspection JSUnusedGlobalSymbols
30
+ let TypewriterSpeed = exports.TypewriterSpeed = /*#__PURE__*/function (TypewriterSpeed) {
31
+ TypewriterSpeed[TypewriterSpeed["ExtraSlow"] = 40] = "ExtraSlow";
32
+ TypewriterSpeed[TypewriterSpeed["Slow"] = 20] = "Slow";
33
+ TypewriterSpeed[TypewriterSpeed["Medium"] = 10] = "Medium";
34
+ TypewriterSpeed[TypewriterSpeed["Fast"] = 5] = "Fast";
35
+ TypewriterSpeed[TypewriterSpeed["ExtraFast"] = 2.5] = "ExtraFast";
36
+ return TypewriterSpeed;
37
+ }({});
38
+ const Typewriter = ({
39
+ children,
40
+ nextTextDelay = TypewriterDelay.Medium,
41
+ onFinish,
42
+ pseudoChildren,
43
+ resetDelay = TypewriterDelay.Medium,
44
+ shouldForceCursorAnimation = false,
45
+ shouldHideCursor = false,
46
+ shouldSortChildrenRandomly = false,
47
+ shouldUseAnimationHeight = false,
48
+ shouldUseResetAnimation = false,
49
+ shouldWaitForContent,
50
+ speed = TypewriterSpeed.Medium,
51
+ startDelay = TypewriterDelay.None,
52
+ textStyle
53
+ }) => {
54
+ const [currentChildrenIndex, setCurrentChildrenIndex] = (0, _react.useState)(0);
55
+ const [hasRenderedChildrenOnce, setHasRenderedChildrenOnce] = (0, _react.useState)(false);
56
+ const functions = (0, _chaynsApi.useFunctions)();
57
+ const values = (0, _chaynsApi.useValues)();
58
+ useIsomorphicLayoutEffect(() => {
59
+ if (children) {
60
+ setHasRenderedChildrenOnce(false);
61
+ }
62
+ }, [children]);
63
+ (0, _react.useEffect)(() => {
64
+ if (!hasRenderedChildrenOnce) {
65
+ setHasRenderedChildrenOnce(true);
66
+ }
67
+ }, [hasRenderedChildrenOnce]);
68
+ const sortedChildren = (0, _react.useMemo)(() => Array.isArray(children) && shouldSortChildrenRandomly ? (0, _utils.shuffleArray)(children) : children, [children, shouldSortChildrenRandomly]);
69
+ const areMultipleChildrenGiven = Array.isArray(sortedChildren);
70
+ const childrenCount = areMultipleChildrenGiven ? sortedChildren.length : 1;
71
+ const textContent = (0, _react.useMemo)(() => {
72
+ if (areMultipleChildrenGiven) {
73
+ const currentChildren = sortedChildren[currentChildrenIndex];
74
+ if (currentChildren) {
75
+ return /*#__PURE__*/_react.default.isValidElement(currentChildren) ? (0, _server.renderToString)(/*#__PURE__*/_react.default.createElement(_chaynsApi.ChaynsProvider, {
76
+ data: values,
77
+ functions: functions,
78
+ isModule: true
79
+ }, /*#__PURE__*/_react.default.createElement(_core.ColorSchemeProvider, {
80
+ color: "#005EB8",
81
+ colorMode: 0,
82
+ style: {
83
+ display: 'inline'
84
+ }
85
+ }, currentChildren))) : currentChildren;
86
+ }
87
+ return '';
88
+ }
89
+ return /*#__PURE__*/_react.default.isValidElement(sortedChildren) ? (0, _server.renderToString)(/*#__PURE__*/_react.default.createElement(_chaynsApi.ChaynsProvider, {
90
+ data: values,
91
+ functions: functions,
92
+ isModule: true
93
+ }, /*#__PURE__*/_react.default.createElement(_core.ColorSchemeProvider, {
94
+ color: "#005EB8",
95
+ colorMode: 0,
96
+ style: {
97
+ display: 'inline'
98
+ }
99
+ }, sortedChildren))) : sortedChildren;
100
+ }, [areMultipleChildrenGiven, currentChildrenIndex, functions, sortedChildren, values]);
101
+ const charactersCount = (0, _react.useMemo)(() => (0, _utils.getCharactersCount)(textContent), [textContent]);
102
+ const [isResetAnimationActive, setIsResetAnimationActive] = (0, _react.useState)(false);
103
+ const [shownCharCount, setShownCharCount] = (0, _react.useState)(charactersCount > 0 ? 0 : textContent.length);
104
+ const [shouldStopAnimation, setShouldStopAnimation] = (0, _react.useState)(false);
105
+ const isAnimatingText = shownCharCount < textContent.length || shouldForceCursorAnimation || areMultipleChildrenGiven || textContent.length === 0;
106
+ const handleClick = (0, _react.useCallback)(event => {
107
+ event.stopPropagation();
108
+ event.preventDefault();
109
+ setShouldStopAnimation(true);
110
+ }, []);
111
+ const handleSetNextChildrenIndex = (0, _react.useCallback)(() => setCurrentChildrenIndex(() => {
112
+ let newIndex = currentChildrenIndex + 1;
113
+ if (newIndex > childrenCount - 1) {
114
+ newIndex = 0;
115
+ }
116
+ return newIndex;
117
+ }), [childrenCount, currentChildrenIndex]);
118
+ (0, _react.useEffect)(() => {
119
+ let interval;
120
+ if (shouldStopAnimation || charactersCount === 0) {
121
+ setShownCharCount(textContent.length);
122
+ } else if (isResetAnimationActive) {
123
+ interval = window.setInterval(() => {
124
+ setShownCharCount(prevState => {
125
+ const nextState = prevState - 1;
126
+ if (nextState === 0) {
127
+ window.clearInterval(interval);
128
+ if (areMultipleChildrenGiven) {
129
+ setTimeout(() => {
130
+ setIsResetAnimationActive(false);
131
+ handleSetNextChildrenIndex();
132
+ }, nextTextDelay);
133
+ }
134
+ }
135
+ return nextState;
136
+ });
137
+ }, speed);
138
+ } else {
139
+ const setInterval = () => {
140
+ interval = window.setInterval(() => {
141
+ setShownCharCount(prevState => {
142
+ let nextState = Math.min(prevState + 1, charactersCount);
143
+ if (nextState >= charactersCount && !shouldWaitForContent) {
144
+ window.clearInterval(interval);
145
+
146
+ /**
147
+ * At this point, the next value for "shownCharCount" is deliberately set to
148
+ * the length of the textContent in order to correctly display HTML elements
149
+ * after the last letter.
150
+ */
151
+ nextState = textContent.length;
152
+ if (areMultipleChildrenGiven) {
153
+ setTimeout(() => {
154
+ if (shouldUseResetAnimation) {
155
+ setIsResetAnimationActive(true);
156
+ } else {
157
+ setShownCharCount(0);
158
+ setTimeout(handleSetNextChildrenIndex, nextTextDelay);
159
+ }
160
+ }, resetDelay);
161
+ }
162
+ }
163
+ return nextState;
164
+ });
165
+ }, speed);
166
+ };
167
+ if (startDelay) {
168
+ setTimeout(setInterval, startDelay);
169
+ } else {
170
+ setInterval();
171
+ }
172
+ }
173
+ return () => {
174
+ window.clearInterval(interval);
175
+ };
176
+ }, [speed, resetDelay, childrenCount, charactersCount, textContent.length, shouldStopAnimation, shouldWaitForContent, isResetAnimationActive, shouldUseResetAnimation, areMultipleChildrenGiven, handleSetNextChildrenIndex, nextTextDelay, startDelay]);
177
+ (0, _react.useEffect)(() => {
178
+ if (!isAnimatingText && typeof onFinish === 'function') {
179
+ onFinish();
180
+ }
181
+ }, [isAnimatingText, onFinish]);
182
+ const shownText = (0, _react.useMemo)(() => (0, _utils.getSubTextFromHTML)(textContent, shownCharCount), [shownCharCount, textContent]);
183
+ const pseudoTextHTML = (0, _react.useMemo)(() => {
184
+ if (pseudoChildren) {
185
+ const pseudoText = /*#__PURE__*/_react.default.isValidElement(pseudoChildren) ? (0, _server.renderToString)(/*#__PURE__*/_react.default.createElement(_chaynsApi.ChaynsProvider, {
186
+ data: values,
187
+ functions: functions,
188
+ isModule: true
189
+ }, /*#__PURE__*/_react.default.createElement(_core.ColorSchemeProvider, {
190
+ color: "#005EB8",
191
+ colorMode: 0,
192
+ style: {
193
+ display: 'inline'
194
+ }
195
+ }, pseudoChildren))) : pseudoChildren;
196
+ if (shouldUseAnimationHeight) {
197
+ return (0, _utils.getSubTextFromHTML)(pseudoText, shownCharCount);
198
+ }
199
+ return pseudoText;
200
+ }
201
+ if (shouldUseAnimationHeight && textContent) {
202
+ return (0, _utils.getSubTextFromHTML)(textContent, shownCharCount);
203
+ }
204
+ return textContent || '&#8203;';
205
+ }, [functions, pseudoChildren, shouldUseAnimationHeight, shownCharCount, textContent, values]);
206
+ return (0, _react.useMemo)(() => /*#__PURE__*/_react.default.createElement(_Typewriter.StyledTypewriter, {
207
+ onClick: isAnimatingText ? handleClick : undefined,
208
+ $isAnimatingText: isAnimatingText,
209
+ $shouldHideCursor: shouldHideCursor
210
+ }, isAnimatingText ? /*#__PURE__*/_react.default.createElement(_AnimatedTypewriterText.default, {
211
+ shouldHideCursor: shouldHideCursor,
212
+ shownText: shownText,
213
+ textStyle: textStyle
214
+ }) : /*#__PURE__*/_react.default.createElement(_Typewriter.StyledTypewriterText, {
215
+ style: textStyle
216
+ }, sortedChildren), isAnimatingText && /*#__PURE__*/_react.default.createElement(_Typewriter.StyledTypewriterPseudoText, {
217
+ dangerouslySetInnerHTML: {
218
+ __html: pseudoTextHTML
219
+ }
220
+ }), !hasRenderedChildrenOnce && /*#__PURE__*/(0, _reactDom.createPortal)(/*#__PURE__*/_react.default.createElement("div", {
221
+ style: {
222
+ position: 'absolute',
223
+ visibility: 'hidden'
224
+ }
225
+ }, children), document.body)), [children, handleClick, hasRenderedChildrenOnce, isAnimatingText, pseudoTextHTML, shouldHideCursor, shownText, sortedChildren, textStyle]);
226
+ };
227
+ Typewriter.displayName = 'Typewriter';
228
+ var _default = exports.default = Typewriter;
229
+ //# sourceMappingURL=Typewriter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Typewriter.js","names":["_core","require","_chaynsApi","_react","_interopRequireWildcard","_reactDom","_server","_Typewriter","_utils","_AnimatedTypewriterText","_interopRequireDefault","e","__esModule","default","_getRequireWildcardCache","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","useIsomorphicLayoutEffect","window","useLayoutEffect","useEffect","TypewriterDelay","exports","TypewriterSpeed","Typewriter","children","nextTextDelay","Medium","onFinish","pseudoChildren","resetDelay","shouldForceCursorAnimation","shouldHideCursor","shouldSortChildrenRandomly","shouldUseAnimationHeight","shouldUseResetAnimation","shouldWaitForContent","speed","startDelay","None","textStyle","currentChildrenIndex","setCurrentChildrenIndex","useState","hasRenderedChildrenOnce","setHasRenderedChildrenOnce","functions","useFunctions","values","useValues","sortedChildren","useMemo","Array","isArray","shuffleArray","areMultipleChildrenGiven","childrenCount","length","textContent","currentChildren","React","isValidElement","renderToString","createElement","ChaynsProvider","data","isModule","ColorSchemeProvider","color","colorMode","style","display","charactersCount","getCharactersCount","isResetAnimationActive","setIsResetAnimationActive","shownCharCount","setShownCharCount","shouldStopAnimation","setShouldStopAnimation","isAnimatingText","handleClick","useCallback","event","stopPropagation","preventDefault","handleSetNextChildrenIndex","newIndex","interval","setInterval","prevState","nextState","clearInterval","setTimeout","Math","min","shownText","getSubTextFromHTML","pseudoTextHTML","pseudoText","StyledTypewriter","onClick","undefined","$isAnimatingText","$shouldHideCursor","StyledTypewriterText","StyledTypewriterPseudoText","dangerouslySetInnerHTML","__html","createPortal","position","visibility","document","body","displayName","_default"],"sources":["../../../../src/components/typewriter/Typewriter.tsx"],"sourcesContent":["import { ColorSchemeProvider } from '@chayns-components/core';\nimport { ChaynsProvider, useFunctions, useValues } from 'chayns-api';\nimport React, {\n FC,\n ReactElement,\n useCallback,\n useEffect,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { createPortal } from 'react-dom';\nimport { renderToString } from 'react-dom/server';\nimport {\n StyledTypewriter,\n StyledTypewriterPseudoText,\n StyledTypewriterText,\n} from './Typewriter.styles';\nimport { getCharactersCount, getSubTextFromHTML, shuffleArray } from './utils';\nimport AnimatedTypewriterText from \"./AnimatedTypewriterText\";\n\nconst useIsomorphicLayoutEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect;\n\n// noinspection JSUnusedGlobalSymbols\nexport enum TypewriterDelay {\n ExtraSlow = 4000,\n Slow = 2000,\n Medium = 1000,\n Fast = 500,\n ExtraFast = 250,\n None = 0,\n}\n\n// noinspection JSUnusedGlobalSymbols\nexport enum TypewriterSpeed {\n ExtraSlow = 40,\n Slow = 20,\n Medium = 10,\n Fast = 5,\n ExtraFast = 2.5,\n}\n\nexport type TypewriterProps = {\n /**\n * The text to type\n */\n children: ReactElement | ReactElement[] | string | string[];\n /**\n * The delay in milliseconds before the next text is shown.\n * This prop is only used if multiple texts are given.\n */\n nextTextDelay?: TypewriterDelay;\n /**\n * Function that is executed when the typewriter animation has finished. This function will not\n * be executed if multiple texts are used.\n */\n onFinish?: VoidFunction;\n /**\n * Pseudo-element to be rendered invisible during animation to define the size of the element\n * for the typewriter effect. By default, the \"children\" is used for this purpose.\n */\n pseudoChildren?: ReactElement | string;\n /**\n * Waiting time in milliseconds before the typewriter resets the text.\n * This prop is only used if multiple texts are given.\n */\n resetDelay?: TypewriterDelay;\n /**\n * Specifies whether the cursor should be forced to animate even if no text is currently animated.\n */\n shouldForceCursorAnimation?: boolean;\n /**\n * Specifies whether the cursor should be hidden\n */\n shouldHideCursor?: boolean;\n /**\n * Specifies whether the children should be sorted randomly if there are multiple texts.\n * This makes the typewriter start with a different text each time and also changes them\n * in a random order.\n */\n shouldSortChildrenRandomly?: boolean;\n /**\n * Specifies whether the animation should use its full height or the height of the current\n * chunk.\n */\n shouldUseAnimationHeight?: boolean;\n /**\n * Specifies whether the reset of the text should be animated with a backspace animation for\n * multiple texts.\n */\n shouldUseResetAnimation?: boolean;\n /**\n * Whether the typewriter should wait for new content\n */\n shouldWaitForContent?: boolean;\n /**\n * The speed of the animation. Use the TypewriterSpeed enum for this prop.\n */\n speed?: TypewriterSpeed | number;\n /**\n * The delay in milliseconds before the typewriter starts typing.\n */\n startDelay?: TypewriterDelay;\n /**\n * The style of the typewriter text element\n */\n textStyle?: React.CSSProperties;\n};\n\nconst Typewriter: FC<TypewriterProps> = ({\n children,\n nextTextDelay = TypewriterDelay.Medium,\n onFinish,\n pseudoChildren,\n resetDelay = TypewriterDelay.Medium,\n shouldForceCursorAnimation = false,\n shouldHideCursor = false,\n shouldSortChildrenRandomly = false,\n shouldUseAnimationHeight = false,\n shouldUseResetAnimation = false,\n shouldWaitForContent,\n speed = TypewriterSpeed.Medium,\n startDelay = TypewriterDelay.None,\n textStyle,\n}) => {\n const [currentChildrenIndex, setCurrentChildrenIndex] = useState(0);\n const [hasRenderedChildrenOnce, setHasRenderedChildrenOnce] = useState(false);\n\n const functions = useFunctions();\n const values = useValues();\n\n useIsomorphicLayoutEffect(() => {\n if (children) {\n setHasRenderedChildrenOnce(false);\n }\n }, [children]);\n\n useEffect(() => {\n if (!hasRenderedChildrenOnce) {\n setHasRenderedChildrenOnce(true);\n }\n }, [hasRenderedChildrenOnce]);\n\n const sortedChildren = useMemo(\n () =>\n Array.isArray(children) && shouldSortChildrenRandomly\n ? shuffleArray<ReactElement | string>(children)\n : children,\n [children, shouldSortChildrenRandomly],\n );\n\n const areMultipleChildrenGiven = Array.isArray(sortedChildren);\n const childrenCount = areMultipleChildrenGiven ? sortedChildren.length : 1;\n\n const textContent = useMemo(() => {\n if (areMultipleChildrenGiven) {\n const currentChildren = sortedChildren[currentChildrenIndex];\n\n if (currentChildren) {\n return React.isValidElement(currentChildren)\n ? renderToString(\n <ChaynsProvider data={values} functions={functions} isModule>\n <ColorSchemeProvider\n color=\"#005EB8\"\n colorMode={0}\n style={{ display: 'inline' }}\n >\n {currentChildren}\n </ColorSchemeProvider>\n </ChaynsProvider>,\n )\n : (currentChildren as string);\n }\n\n return '';\n }\n\n return React.isValidElement(sortedChildren)\n ? renderToString(\n <ChaynsProvider data={values} functions={functions} isModule>\n <ColorSchemeProvider\n color=\"#005EB8\"\n colorMode={0}\n style={{ display: 'inline' }}\n >\n {sortedChildren}\n </ColorSchemeProvider>\n </ChaynsProvider>,\n )\n : (sortedChildren as string);\n }, [areMultipleChildrenGiven, currentChildrenIndex, functions, sortedChildren, values]);\n\n const charactersCount = useMemo(() => getCharactersCount(textContent), [textContent]);\n\n const [isResetAnimationActive, setIsResetAnimationActive] = useState(false);\n const [shownCharCount, setShownCharCount] = useState(\n charactersCount > 0 ? 0 : textContent.length,\n );\n const [shouldStopAnimation, setShouldStopAnimation] = useState(false);\n\n const isAnimatingText =\n shownCharCount < textContent.length ||\n shouldForceCursorAnimation ||\n areMultipleChildrenGiven ||\n textContent.length === 0;\n\n const handleClick = useCallback((event: React.MouseEvent) => {\n event.stopPropagation();\n event.preventDefault();\n\n setShouldStopAnimation(true);\n }, []);\n\n const handleSetNextChildrenIndex = useCallback(\n () =>\n setCurrentChildrenIndex(() => {\n let newIndex = currentChildrenIndex + 1;\n\n if (newIndex > childrenCount - 1) {\n newIndex = 0;\n }\n\n return newIndex;\n }),\n [childrenCount, currentChildrenIndex],\n );\n\n useEffect(() => {\n let interval: number | undefined;\n\n if (shouldStopAnimation || charactersCount === 0) {\n setShownCharCount(textContent.length);\n } else if (isResetAnimationActive) {\n interval = window.setInterval(() => {\n setShownCharCount((prevState) => {\n const nextState = prevState - 1;\n\n if (nextState === 0) {\n window.clearInterval(interval);\n\n if (areMultipleChildrenGiven) {\n setTimeout(() => {\n setIsResetAnimationActive(false);\n handleSetNextChildrenIndex();\n }, nextTextDelay);\n }\n }\n\n return nextState;\n });\n }, speed);\n } else {\n const setInterval = () => {\n interval = window.setInterval(() => {\n setShownCharCount((prevState) => {\n let nextState = Math.min(prevState + 1, charactersCount);\n\n if (nextState >= charactersCount && !shouldWaitForContent) {\n window.clearInterval(interval);\n\n /**\n * At this point, the next value for \"shownCharCount\" is deliberately set to\n * the length of the textContent in order to correctly display HTML elements\n * after the last letter.\n */\n nextState = textContent.length;\n\n if (areMultipleChildrenGiven) {\n setTimeout(() => {\n if (shouldUseResetAnimation) {\n setIsResetAnimationActive(true);\n } else {\n setShownCharCount(0);\n setTimeout(handleSetNextChildrenIndex, nextTextDelay);\n }\n }, resetDelay);\n }\n }\n\n return nextState;\n });\n }, speed);\n };\n\n if (startDelay) {\n setTimeout(setInterval, startDelay);\n } else {\n setInterval();\n }\n }\n\n return () => {\n window.clearInterval(interval);\n };\n }, [\n speed,\n resetDelay,\n childrenCount,\n charactersCount,\n textContent.length,\n shouldStopAnimation,\n shouldWaitForContent,\n isResetAnimationActive,\n shouldUseResetAnimation,\n areMultipleChildrenGiven,\n handleSetNextChildrenIndex,\n nextTextDelay,\n startDelay,\n ]);\n\n useEffect(() => {\n if (!isAnimatingText && typeof onFinish === 'function') {\n onFinish();\n }\n }, [isAnimatingText, onFinish]);\n\n const shownText = useMemo(\n () => getSubTextFromHTML(textContent, shownCharCount),\n [shownCharCount, textContent],\n );\n\n const pseudoTextHTML = useMemo(() => {\n if (pseudoChildren) {\n const pseudoText = React.isValidElement(pseudoChildren)\n ? renderToString(\n <ChaynsProvider data={values} functions={functions} isModule>\n <ColorSchemeProvider\n color=\"#005EB8\"\n colorMode={0}\n style={{ display: 'inline' }}\n >\n {pseudoChildren}\n </ColorSchemeProvider>\n </ChaynsProvider>,\n )\n : (pseudoChildren as string);\n\n if (shouldUseAnimationHeight) {\n return getSubTextFromHTML(pseudoText, shownCharCount);\n }\n\n return pseudoText;\n }\n\n if (shouldUseAnimationHeight && textContent) {\n return getSubTextFromHTML(textContent, shownCharCount);\n }\n\n return textContent || '&#8203;';\n }, [functions, pseudoChildren, shouldUseAnimationHeight, shownCharCount, textContent, values]);\n\n return useMemo(\n () => (\n <StyledTypewriter\n onClick={isAnimatingText ? handleClick : undefined}\n $isAnimatingText={isAnimatingText}\n $shouldHideCursor={shouldHideCursor}\n >\n {isAnimatingText ? (\n <AnimatedTypewriterText\n shouldHideCursor={shouldHideCursor}\n shownText={shownText}\n textStyle={textStyle}\n />\n ) : (\n <StyledTypewriterText style={textStyle}>{sortedChildren}</StyledTypewriterText>\n )}\n {isAnimatingText && (\n <StyledTypewriterPseudoText\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 client before...\n */}\n {!hasRenderedChildrenOnce &&\n createPortal(\n <div style={{ position: 'absolute', visibility: 'hidden' }}>\n {children}\n </div>,\n document.body,\n )}\n </StyledTypewriter>\n ),\n [\n children,\n handleClick,\n hasRenderedChildrenOnce,\n isAnimatingText,\n pseudoTextHTML,\n shouldHideCursor,\n shownText,\n sortedChildren,\n textStyle,\n ],\n );\n};\n\nTypewriter.displayName = 'Typewriter';\n\nexport default Typewriter;\n"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAC,uBAAA,CAAAH,OAAA;AAUA,IAAAI,SAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AACA,IAAAM,WAAA,GAAAN,OAAA;AAKA,IAAAO,MAAA,GAAAP,OAAA;AACA,IAAAQ,uBAAA,GAAAC,sBAAA,CAAAT,OAAA;AAA8D,SAAAS,uBAAAC,CAAA,WAA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GAEnCgD,eAAe,gBACZ3F,MAAA,CAAAU,OAAA,CAAAgE,aAAA,CAACpE,uBAAA,CAAAI,OAAsB;IACnBiC,gBAAgB,EAAEA,gBAAiB;IACnCgE,SAAS,EAAEA,SAAU;IACrBxD,SAAS,EAAEA;EAAU,CACxB,CAAC,gBAEFnD,MAAA,CAAAU,OAAA,CAAAgE,aAAA,CAACtE,WAAA,CAAAgH,oBAAoB;IAACnC,KAAK,EAAE9B;EAAU,GAAEU,cAAqC,CACjF,EACA8B,eAAe,iBACZ3F,MAAA,CAAAU,OAAA,CAAAgE,aAAA,CAACtE,WAAA,CAAAiH,0BAA0B;IACvBC,uBAAuB,EAAE;MAAEC,MAAM,EAAEV;IAAe;EAAE,CACvD,CACJ,EAKA,CAACtD,uBAAuB,iBACrB,IAAAiE,sBAAY,eACRxH,MAAA,CAAAU,OAAA,CAAAgE,aAAA;IAAKO,KAAK,EAAE;MAAEwC,QAAQ,EAAE,UAAU;MAAEC,UAAU,EAAE;IAAS;EAAE,GACtDtF,QACA,CAAC,EACNuF,QAAQ,CAACC,IACb,CACU,CACrB,EACD,CACIxF,QAAQ,EACRwD,WAAW,EACXrC,uBAAuB,EACvBoC,eAAe,EACfkB,cAAc,EACdlE,gBAAgB,EAChBgE,SAAS,EACT9C,cAAc,EACdV,SAAS,CAEjB,CAAC;AACL,CAAC;AAEDhB,UAAU,CAAC0F,WAAW,GAAG,YAAY;AAAC,IAAAC,QAAA,GAAA7F,OAAA,CAAAvB,OAAA,GAEvByB,UAAU","ignoreList":[]}
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.StyledTypewriterText = exports.StyledTypewriterPseudoText = exports.StyledTypewriter = void 0;
7
+ var _styledComponents = _interopRequireWildcard(require("styled-components"));
8
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
9
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
10
+ const typewriterCursorElement = ({
11
+ $isAnimatingText,
12
+ $shouldHideCursor
13
+ }) => $isAnimatingText && !$shouldHideCursor && (0, _styledComponents.css)`
14
+ .typewriter-lastWithContent {
15
+ &:after {
16
+ animation: ${blinkAnimation} 1s steps(2, start) infinite;
17
+ color: ${({
18
+ theme
19
+ }) => theme.text};
20
+ content: '▋';
21
+ margin-left: 0.25rem;
22
+ opacity: 0.85;
23
+ position: relative;
24
+ vertical-align: baseline;
25
+ }
26
+ }
27
+ `;
28
+ const StyledTypewriter = exports.StyledTypewriter = _styledComponents.default.div`
29
+ align-items: inherit;
30
+ display: flex;
31
+ position: relative;
32
+ width: 100%;
33
+ ${typewriterCursorElement}
34
+ `;
35
+ const blinkAnimation = (0, _styledComponents.keyframes)`
36
+ 100% {
37
+ visibility: hidden;
38
+ }
39
+ `;
40
+ const StyledTypewriterPseudoText = exports.StyledTypewriterPseudoText = _styledComponents.default.span`
41
+ opacity: 0;
42
+ pointer-events: none;
43
+ user-select: none;
44
+ width: 100%;
45
+ `;
46
+ const StyledTypewriterText = exports.StyledTypewriterText = _styledComponents.default.span`
47
+ color: inherit;
48
+ position: ${({
49
+ $isAnimatingText
50
+ }) => $isAnimatingText ? 'absolute' : 'relative'};
51
+ width: 100%;
52
+
53
+ ${({
54
+ $isAnimatingText
55
+ }) => $isAnimatingText && (0, _styledComponents.css)`
56
+ pointer-events: none;
57
+ `}
58
+ `;
59
+ //# sourceMappingURL=Typewriter.styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Typewriter.styles.js","names":["_styledComponents","_interopRequireWildcard","require","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","typewriterCursorElement","$isAnimatingText","$shouldHideCursor","css","blinkAnimation","theme","text","StyledTypewriter","exports","styled","div","keyframes","StyledTypewriterPseudoText","span","StyledTypewriterText"],"sources":["../../../../src/components/typewriter/Typewriter.styles.ts"],"sourcesContent":["import type { WithTheme } from '@chayns-components/core';\nimport styled, { css, keyframes } from 'styled-components';\n\nconst typewriterCursorElement = ({\n $isAnimatingText,\n $shouldHideCursor,\n}: {\n $isAnimatingText?: boolean;\n $shouldHideCursor?: boolean;\n}) =>\n $isAnimatingText &&\n !$shouldHideCursor &&\n css`\n .typewriter-lastWithContent {\n &:after {\n animation: ${blinkAnimation} 1s steps(2, start) infinite;\n color: ${({ theme }: StyledTypewriterTextProps) => theme.text};\n content: '▋';\n margin-left: 0.25rem;\n opacity: 0.85;\n position: relative;\n vertical-align: baseline;\n }\n }\n `;\n\ntype StyledTypewriterProps = WithTheme<{\n $isAnimatingText?: boolean;\n $shouldHideCursor?: boolean;\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\nexport const StyledTypewriterPseudoText = styled.span`\n opacity: 0;\n pointer-events: none;\n user-select: none;\n width: 100%;\n`;\n\ntype StyledTypewriterTextProps = WithTheme<{\n $isAnimatingText?: boolean;\n}>;\n\nexport const StyledTypewriterText = styled.span<StyledTypewriterTextProps>`\n color: inherit;\n position: ${({ $isAnimatingText }) => ($isAnimatingText ? 'absolute' : 'relative')};\n width: 100%;\n\n ${({ $isAnimatingText }) =>\n $isAnimatingText &&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,CAAC,KACGD,gBAAgB,IAChB,CAACC,iBAAiB,IAClB,IAAAC,qBAAG;AACP;AACA;AACA,uBAAuBC,cAAc;AACrC,mBAAmB,CAAC;EAAEC;AAAiC,CAAC,KAAKA,KAAK,CAACC,IAAI;AACvE;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AAOE,MAAMC,gBAAgB,GAAAC,OAAA,CAAAD,gBAAA,GAAGE,yBAAM,CAACC,GAA0B;AACjE;AACA;AACA;AACA;AACA,MAAMV,uBAAuB;AAC7B,CAAC;AAED,MAAMI,cAAc,GAAG,IAAAO,2BAAS;AAChC;AACA;AACA;AACA,CAAC;AAEM,MAAMC,0BAA0B,GAAAJ,OAAA,CAAAI,0BAAA,GAAGH,yBAAM,CAACI,IAAI;AACrD;AACA;AACA;AACA;AACA,CAAC;AAMM,MAAMC,oBAAoB,GAAAN,OAAA,CAAAM,oBAAA,GAAGL,yBAAM,CAACI,IAA+B;AAC1E;AACA,gBAAgB,CAAC;EAAEZ;AAAiB,CAAC,KAAMA,gBAAgB,GAAG,UAAU,GAAG,UAAW;AACtF;AACA;AACA,MAAM,CAAC;EAAEA;AAAiB,CAAC,KACnBA,gBAAgB,IAChB,IAAAE,qBAAG;AACX;AACA,SAAS;AACT,CAAC","ignoreList":[]}
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.getSubTextFromHTML = exports.getCharactersCount = void 0;
6
+ exports.shuffleArray = exports.getSubTextFromHTML = exports.getCharactersCount = void 0;
7
7
  /**
8
8
  * This function extracts a part of the text from an HTML text. The HTML elements themselves are
9
9
  * returned in the result. In addition, the function ensures that the closing tag of the Bold HTML
@@ -20,7 +20,9 @@ const getSubTextFromHTML = (html, length) => {
20
20
  let text = '';
21
21
  let currLength = 0;
22
22
  const traverse = element => {
23
- if (element.nodeType === 3 && typeof element.textContent === 'string') {
23
+ if (element.nodeName === 'TWIGNORE') {
24
+ text += element.innerHTML;
25
+ } else if (element.nodeType === 3 && typeof element.textContent === 'string') {
24
26
  const nodeText = element.textContent;
25
27
  if (currLength + nodeText.length <= length) {
26
28
  text += nodeText;
@@ -64,9 +66,15 @@ const getCharactersCount = html => {
64
66
  div.innerHTML = html;
65
67
  let count = 0;
66
68
  const traverse = node => {
67
- if (node.nodeType === 3 && typeof node.textContent === 'string') {
69
+ if (node.nodeName === 'TWIGNORE') {
70
+ count += 1;
71
+ } else if (node.nodeType === 3 && typeof node.textContent === 'string') {
68
72
  count += node.textContent.trim().length;
69
73
  } else if (node.nodeType === 1) {
74
+ if (node.nodeName === 'CODE' && node.textContent !== null) {
75
+ count += node.textContent.length;
76
+ return;
77
+ }
70
78
  Array.from(node.childNodes).forEach(traverse);
71
79
  }
72
80
  };
@@ -74,4 +82,13 @@ const getCharactersCount = html => {
74
82
  return count;
75
83
  };
76
84
  exports.getCharactersCount = getCharactersCount;
85
+ const shuffleArray = array => {
86
+ const result = Array.from(array);
87
+ for (let i = result.length - 1; i > 0; i--) {
88
+ const j = Math.floor(Math.random() * (i + 1));
89
+ [result[i], result[j]] = [result[j], result[i]];
90
+ }
91
+ return result;
92
+ };
93
+ exports.shuffleArray = shuffleArray;
77
94
  //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","names":["getSubTextFromHTML","html","length","div","document","createElement","innerHTML","text","currLength","traverse","element","nodeName","nodeType","textContent","nodeText","substring","toLowerCase","attributes","attribute","name","value","i","childNodes","childNode","exports","getCharactersCount","count","node","trim","Array","from","forEach","shuffleArray","array","result","j","Math","floor","random"],"sources":["../../../../src/components/typewriter/utils.ts"],"sourcesContent":["/**\n * This function extracts a part of the text from an HTML text. The HTML elements themselves are\n * returned in the result. In addition, the function ensures that the closing tag of the Bold HTML\n * element is also returned for text that is cut off in the middle of a Bold element, for example.\n *\n * @param html - The text from which a part should be taken\n * @param length - The length of the text to be extracted\n *\n * @return string - The text part with the specified length - additionally the HTML elements are added\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 const traverse = (element: Element): boolean => {\n if (element.nodeName === 'TWIGNORE') {\n text += element.innerHTML;\n } else if (element.nodeType === 3 && typeof element.textContent === 'string') {\n const nodeText = element.textContent;\n\n if (currLength + nodeText.length <= length) {\n text += nodeText;\n currLength += nodeText.length;\n } else {\n text += nodeText.substring(0, length - currLength);\n\n return false;\n }\n } else if (element.nodeType === 1) {\n const nodeName = element.nodeName.toLowerCase();\n\n let attributes = '';\n\n // @ts-expect-error: Type is correct here\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\n attributes += ` ${attribute.name}=\"${attribute.value}\"`;\n }\n\n text += `<${nodeName}${attributes}>`;\n\n for (let i = 0; i < element.childNodes.length; i++) {\n const childNode = element.childNodes[i];\n\n if (childNode && !traverse(childNode as Element)) {\n return false;\n }\n }\n\n text += `</${nodeName}>`;\n }\n\n return true;\n };\n\n for (let i = 0; i < div.childNodes.length; i++) {\n const childNode = div.childNodes[i];\n\n if (childNode && !traverse(childNode as Element)) {\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));\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MAAM,IAAIyB,IAAI,CAACf,QAAQ,KAAK,CAAC,EAAE;MAC5B,IAAIe,IAAI,CAAChB,QAAQ,KAAK,MAAM,IAAIgB,IAAI,CAACd,WAAW,KAAK,IAAI,EAAE;QACvDa,KAAK,IAAIC,IAAI,CAACd,WAAW,CAACX,MAAM;QAEhC;MACJ;MAEA2B,KAAK,CAACC,IAAI,CAACH,IAAI,CAACL,UAAU,CAAC,CAACS,OAAO,CAACtB,QAAQ,CAAC;IACjD;EACJ,CAAC;EAEDoB,KAAK,CAACC,IAAI,CAAC3B,GAAG,CAACmB,UAAU,CAAC,CAACS,OAAO,CAACtB,QAAQ,CAAC;EAE5C,OAAOiB,KAAK;AAChB,CAAC;AAACF,OAAA,CAAAC,kBAAA,GAAAA,kBAAA;AAEK,MAAMO,YAAY,GAAOC,KAAU,IAAU;EAChD,MAAMC,MAAM,GAAGL,KAAK,CAACC,IAAI,CAACG,KAAK,CAAC;EAEhC,KAAK,IAAIZ,CAAC,GAAGa,MAAM,CAAChC,MAAM,GAAG,CAAC,EAAEmB,CAAC,GAAG,CAAC,EAAEA,CAAC,EAAE,EAAE;IACxC,MAAMc,CAAC,GAAGC,IAAI,CAACC,KAAK,CAACD,IAAI,CAACE,MAAM,CAAC,CAAC,IAAIjB,CAAC,GAAG,CAAC,CAAC,CAAC;IAE7C,CAACa,MAAM,CAACb,CAAC,CAAC,EAAEa,MAAM,CAACC,CAAC,CAAC,CAAC,GAAG,CAACD,MAAM,CAACC,CAAC,CAAC,EAAGD,MAAM,CAACb,CAAC,CAAC,CAAE;EACrD;EAEA,OAAOa,MAAM;AACjB,CAAC;AAACV,OAAA,CAAAQ,YAAA,GAAAA,YAAA","ignoreList":[]}
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "Typewriter", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _Typewriter.default;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "TypewriterDelay", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _Typewriter.TypewriterDelay;
16
+ }
17
+ });
18
+ Object.defineProperty(exports, "TypewriterSpeed", {
19
+ enumerable: true,
20
+ get: function () {
21
+ return _Typewriter.TypewriterSpeed;
22
+ }
23
+ });
24
+ var _Typewriter = _interopRequireWildcard(require("./components/typewriter/Typewriter"));
25
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
26
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
27
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["_Typewriter","_interopRequireWildcard","require","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set"],"sources":["../../src/index.ts"],"sourcesContent":["export {\n default as Typewriter,\n TypewriterDelay,\n TypewriterSpeed,\n} from './components/typewriter/Typewriter';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,WAAA,GAAAC,uBAAA,CAAAC,OAAA;AAI4C,SAAAC,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAH,wBAAAG,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CAAA,oBAAAc,CAAA,OAAAC,cAAA,CAAAC,IAAA,CAAAhB,CAAA,EAAAc,CAAA,SAAAG,CAAA,GAAAP,CAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAb,CAAA,EAAAc,CAAA,UAAAG,CAAA,KAAAA,CAAA,CAAAV,GAAA,IAAAU,CAAA,CAAAC,GAAA,IAAAP,MAAA,CAAAC,cAAA,CAAAJ,CAAA,EAAAM,CAAA,EAAAG,CAAA,IAAAT,CAAA,CAAAM,CAAA,IAAAd,CAAA,CAAAc,CAAA,YAAAN,CAAA,CAAAH,OAAA,GAAAL,CAAA,EAAAG,CAAA,IAAAA,CAAA,CAAAe,GAAA,CAAAlB,CAAA,EAAAQ,CAAA,GAAAA,CAAA","ignoreList":[]}
@@ -0,0 +1,51 @@
1
+ import React, { useCallback, useMemo } from 'react';
2
+ import { StyledTypewriterText } from "./Typewriter.styles";
3
+ const AnimatedTypewriterText = _ref => {
4
+ let {
5
+ shouldHideCursor,
6
+ shownText,
7
+ textStyle
8
+ } = _ref;
9
+ const updateTypewriterCursor = useCallback(ref => {
10
+ if (ref && !shouldHideCursor) {
11
+ // Finds the last text node with content.
12
+ const traverseNodes = node => {
13
+ if (node.nodeType === Node.TEXT_NODE && node.textContent?.trim()) {
14
+ return node.parentElement;
15
+ }
16
+ const childNodes = Array.from(node.childNodes);
17
+ for (let i = childNodes.length - 1; i >= 0; i--) {
18
+ const result = traverseNodes(childNodes[i]);
19
+ if (result) {
20
+ return result;
21
+ }
22
+ }
23
+ return null;
24
+ };
25
+ const lastParentWithContent = traverseNodes(ref);
26
+
27
+ // Removes lastWithContent class from all elements
28
+ ref.classList.remove('typewriter-lastWithContent');
29
+ ref.querySelectorAll('.lastWithContent').forEach(element => {
30
+ element.classList.remove('typewriter-lastWithContent');
31
+ });
32
+
33
+ // Adds lastWithContent class to the last element with content
34
+ if (lastParentWithContent) {
35
+ lastParentWithContent.classList.add('typewriter-lastWithContent');
36
+ } else {
37
+ ref.classList.add('typewriter-lastWithContent');
38
+ }
39
+ }
40
+ }, [shouldHideCursor]);
41
+ return useMemo(() => /*#__PURE__*/React.createElement(StyledTypewriterText, {
42
+ ref: ref => updateTypewriterCursor(ref),
43
+ dangerouslySetInnerHTML: {
44
+ __html: shownText
45
+ },
46
+ style: textStyle,
47
+ $isAnimatingText: true
48
+ }), [updateTypewriterCursor, shownText, textStyle]);
49
+ };
50
+ export default AnimatedTypewriterText;
51
+ //# sourceMappingURL=AnimatedTypewriterText.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AnimatedTypewriterText.js","names":["React","useCallback","useMemo","StyledTypewriterText","AnimatedTypewriterText","_ref","shouldHideCursor","shownText","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","style","$isAnimatingText"],"sources":["../../../../src/components/typewriter/AnimatedTypewriterText.tsx"],"sourcesContent":["import React, {FC, useCallback, useEffect, useMemo, useRef} from 'react';\nimport {StyledTypewriterText} from \"./Typewriter.styles\";\n\ntype AnimatedTypewriterTextProps = {\n shouldHideCursor: boolean;\n shownText: string;\n textStyle?: React.CSSProperties;\n};\n\nconst AnimatedTypewriterText: FC<AnimatedTypewriterTextProps> = ({\n shouldHideCursor,\n shownText,\n textStyle\n}) => {\n const updateTypewriterCursor = useCallback((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 }, [shouldHideCursor]);\n\n return useMemo(() => (\n <StyledTypewriterText\n ref={(ref) => updateTypewriterCursor(ref)}\n dangerouslySetInnerHTML={{ __html: shownText }}\n style={textStyle}\n $isAnimatingText\n />\n ), [updateTypewriterCursor, shownText, textStyle]);\n};\n\nexport default AnimatedTypewriterText;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAOC,WAAW,EAAaC,OAAO,QAAe,OAAO;AACxE,SAAQC,oBAAoB,QAAO,qBAAqB;AAQxD,MAAMC,sBAAuD,GAAGC,IAAA,IAI1D;EAAA,IAJ2D;IAC7DC,gBAAgB;IAChBC,SAAS;IACTC;EACJ,CAAC,GAAAH,IAAA;EACG,MAAMI,sBAAsB,GAAGR,WAAW,CAAES,GAA2B,IAAK;IACxE,IAAIA,GAAG,IAAI,CAACJ,gBAAgB,EAAE;MAC1B;MACA,MAAMK,aAAa,GAAIC,IAAU,IAAyB;QACtD,IAAIA,IAAI,CAACC,QAAQ,KAAKC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