@lobehub/ui 2.18.4 → 2.19.0
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/es/awesome/TypewriterEffect/TypewriterEffect.d.ts +4 -0
- package/es/awesome/TypewriterEffect/TypewriterEffect.js +250 -0
- package/es/awesome/TypewriterEffect/index.d.ts +2 -0
- package/es/awesome/TypewriterEffect/index.js +1 -0
- package/es/awesome/TypewriterEffect/style.d.ts +10 -0
- package/es/awesome/TypewriterEffect/style.js +18 -0
- package/es/awesome/TypewriterEffect/type.d.ts +104 -0
- package/es/awesome/TypewriterEffect/type.js +1 -0
- package/es/awesome/index.d.ts +1 -0
- package/es/awesome/index.js +2 -1
- package/package.json +1 -1
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
|
+
var _excluded = ["sentences", "as", "typingSpeed", "initialDelay", "pauseDuration", "deletingSpeed", "loop", "className", "color", "showCursor", "hideCursorWhileTyping", "cursorCharacter", "cursorClassName", "cursorColor", "cursorBlinkDuration", "cursorStyle", "textColors", "variableSpeed", "onSentenceComplete", "startOnVisible", "reverseMode"];
|
|
5
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
6
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
7
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
8
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
9
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
10
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
11
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
12
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
13
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
14
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
15
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
16
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
17
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
18
|
+
import { motion } from 'framer-motion';
|
|
19
|
+
import { createElement, memo, useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
20
|
+
import { useStyles } from "./style";
|
|
21
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
22
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
23
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
24
|
+
var TypewriterEffect = /*#__PURE__*/memo(function (_ref) {
|
|
25
|
+
var sentences = _ref.sentences,
|
|
26
|
+
_ref$as = _ref.as,
|
|
27
|
+
Component = _ref$as === void 0 ? 'div' : _ref$as,
|
|
28
|
+
_ref$typingSpeed = _ref.typingSpeed,
|
|
29
|
+
typingSpeed = _ref$typingSpeed === void 0 ? 100 : _ref$typingSpeed,
|
|
30
|
+
_ref$initialDelay = _ref.initialDelay,
|
|
31
|
+
initialDelay = _ref$initialDelay === void 0 ? 0 : _ref$initialDelay,
|
|
32
|
+
_ref$pauseDuration = _ref.pauseDuration,
|
|
33
|
+
pauseDuration = _ref$pauseDuration === void 0 ? 2000 : _ref$pauseDuration,
|
|
34
|
+
_ref$deletingSpeed = _ref.deletingSpeed,
|
|
35
|
+
deletingSpeed = _ref$deletingSpeed === void 0 ? 50 : _ref$deletingSpeed,
|
|
36
|
+
_ref$loop = _ref.loop,
|
|
37
|
+
loop = _ref$loop === void 0 ? true : _ref$loop,
|
|
38
|
+
_ref$className = _ref.className,
|
|
39
|
+
className = _ref$className === void 0 ? '' : _ref$className,
|
|
40
|
+
color = _ref.color,
|
|
41
|
+
_ref$showCursor = _ref.showCursor,
|
|
42
|
+
showCursor = _ref$showCursor === void 0 ? true : _ref$showCursor,
|
|
43
|
+
_ref$hideCursorWhileT = _ref.hideCursorWhileTyping,
|
|
44
|
+
hideCursorWhileTyping = _ref$hideCursorWhileT === void 0 ? false : _ref$hideCursorWhileT,
|
|
45
|
+
cursorCharacter = _ref.cursorCharacter,
|
|
46
|
+
_ref$cursorClassName = _ref.cursorClassName,
|
|
47
|
+
cursorClassName = _ref$cursorClassName === void 0 ? '' : _ref$cursorClassName,
|
|
48
|
+
cursorColor = _ref.cursorColor,
|
|
49
|
+
_ref$cursorBlinkDurat = _ref.cursorBlinkDuration,
|
|
50
|
+
cursorBlinkDuration = _ref$cursorBlinkDurat === void 0 ? 0.8 : _ref$cursorBlinkDurat,
|
|
51
|
+
_ref$cursorStyle = _ref.cursorStyle,
|
|
52
|
+
cursorStyle = _ref$cursorStyle === void 0 ? 'pipe' : _ref$cursorStyle,
|
|
53
|
+
_ref$textColors = _ref.textColors,
|
|
54
|
+
textColors = _ref$textColors === void 0 ? [] : _ref$textColors,
|
|
55
|
+
variableSpeed = _ref.variableSpeed,
|
|
56
|
+
onSentenceComplete = _ref.onSentenceComplete,
|
|
57
|
+
_ref$startOnVisible = _ref.startOnVisible,
|
|
58
|
+
startOnVisible = _ref$startOnVisible === void 0 ? false : _ref$startOnVisible,
|
|
59
|
+
_ref$reverseMode = _ref.reverseMode,
|
|
60
|
+
reverseMode = _ref$reverseMode === void 0 ? false : _ref$reverseMode,
|
|
61
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
62
|
+
var _useStyles = useStyles(),
|
|
63
|
+
styles = _useStyles.styles,
|
|
64
|
+
cx = _useStyles.cx;
|
|
65
|
+
var _useState = useState(''),
|
|
66
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
67
|
+
displayedText = _useState2[0],
|
|
68
|
+
setDisplayedText = _useState2[1];
|
|
69
|
+
var _useState3 = useState(0),
|
|
70
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
71
|
+
currentCharIndex = _useState4[0],
|
|
72
|
+
setCurrentCharIndex = _useState4[1];
|
|
73
|
+
var _useState5 = useState(false),
|
|
74
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
75
|
+
isDeleting = _useState6[0],
|
|
76
|
+
setIsDeleting = _useState6[1];
|
|
77
|
+
var _useState7 = useState(0),
|
|
78
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
79
|
+
currentTextIndex = _useState8[0],
|
|
80
|
+
setCurrentTextIndex = _useState8[1];
|
|
81
|
+
var _useState9 = useState(!startOnVisible),
|
|
82
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
83
|
+
isVisible = _useState10[0],
|
|
84
|
+
setIsVisible = _useState10[1];
|
|
85
|
+
var containerRef = useRef(null);
|
|
86
|
+
var textArray = useMemo(function () {
|
|
87
|
+
return Array.isArray(sentences) ? sentences : [sentences];
|
|
88
|
+
}, [sentences]);
|
|
89
|
+
var getRandomSpeed = useCallback(function () {
|
|
90
|
+
if (!variableSpeed) return typingSpeed;
|
|
91
|
+
var min = variableSpeed.min,
|
|
92
|
+
max = variableSpeed.max;
|
|
93
|
+
return Math.random() * (max - min) + min;
|
|
94
|
+
}, [variableSpeed, typingSpeed]);
|
|
95
|
+
var getCurrentTextColor = function getCurrentTextColor() {
|
|
96
|
+
if (textColors.length > 0) {
|
|
97
|
+
return textColors[currentTextIndex % textColors.length];
|
|
98
|
+
}
|
|
99
|
+
return color;
|
|
100
|
+
};
|
|
101
|
+
var getCurrentCursorColor = function getCurrentCursorColor() {
|
|
102
|
+
return cursorColor || color;
|
|
103
|
+
};
|
|
104
|
+
useEffect(function () {
|
|
105
|
+
if (!startOnVisible || !containerRef.current) return;
|
|
106
|
+
var observer = new IntersectionObserver(function (entries) {
|
|
107
|
+
entries.forEach(function (entry) {
|
|
108
|
+
if (entry.isIntersecting) {
|
|
109
|
+
setIsVisible(true);
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
}, {
|
|
113
|
+
threshold: 0.1
|
|
114
|
+
});
|
|
115
|
+
observer.observe(containerRef.current);
|
|
116
|
+
return function () {
|
|
117
|
+
return observer.disconnect();
|
|
118
|
+
};
|
|
119
|
+
}, [startOnVisible]);
|
|
120
|
+
useEffect(function () {
|
|
121
|
+
if (!isVisible) return;
|
|
122
|
+
var timeout;
|
|
123
|
+
var currentText = textArray[currentTextIndex];
|
|
124
|
+
var processedText = reverseMode ? currentText.split('').reverse().join('') : currentText;
|
|
125
|
+
var executeTypingAnimation = function executeTypingAnimation() {
|
|
126
|
+
if (isDeleting) {
|
|
127
|
+
if (displayedText === '') {
|
|
128
|
+
setIsDeleting(false);
|
|
129
|
+
if (currentTextIndex === textArray.length - 1 && !loop) {
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
if (onSentenceComplete) {
|
|
133
|
+
onSentenceComplete(textArray[currentTextIndex], currentTextIndex);
|
|
134
|
+
}
|
|
135
|
+
setCurrentTextIndex(function (prev) {
|
|
136
|
+
return (prev + 1) % textArray.length;
|
|
137
|
+
});
|
|
138
|
+
setCurrentCharIndex(0);
|
|
139
|
+
timeout = setTimeout(function () {}, pauseDuration);
|
|
140
|
+
} else {
|
|
141
|
+
timeout = setTimeout(function () {
|
|
142
|
+
setDisplayedText(function (prev) {
|
|
143
|
+
return prev.slice(0, -1);
|
|
144
|
+
});
|
|
145
|
+
}, deletingSpeed);
|
|
146
|
+
}
|
|
147
|
+
} else {
|
|
148
|
+
if (currentCharIndex < processedText.length) {
|
|
149
|
+
timeout = setTimeout(function () {
|
|
150
|
+
setDisplayedText(function (prev) {
|
|
151
|
+
return prev + processedText[currentCharIndex];
|
|
152
|
+
});
|
|
153
|
+
setCurrentCharIndex(function (prev) {
|
|
154
|
+
return prev + 1;
|
|
155
|
+
});
|
|
156
|
+
}, variableSpeed ? getRandomSpeed() : typingSpeed);
|
|
157
|
+
} else if (textArray.length >= 1) {
|
|
158
|
+
if (!loop && currentTextIndex === textArray.length - 1) return;
|
|
159
|
+
timeout = setTimeout(function () {
|
|
160
|
+
setIsDeleting(true);
|
|
161
|
+
}, pauseDuration);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
};
|
|
165
|
+
if (currentCharIndex === 0 && !isDeleting && displayedText === '') {
|
|
166
|
+
timeout = setTimeout(executeTypingAnimation, initialDelay);
|
|
167
|
+
} else {
|
|
168
|
+
executeTypingAnimation();
|
|
169
|
+
}
|
|
170
|
+
return function () {
|
|
171
|
+
return clearTimeout(timeout);
|
|
172
|
+
};
|
|
173
|
+
}, [currentCharIndex, displayedText, isDeleting, typingSpeed, deletingSpeed, pauseDuration, textArray, currentTextIndex, loop, initialDelay, isVisible, reverseMode, variableSpeed, onSentenceComplete, getRandomSpeed]);
|
|
174
|
+
var getCursorStyle = function getCursorStyle() {
|
|
175
|
+
if (cursorCharacter) return styles.cursorCustom;
|
|
176
|
+
switch (cursorStyle) {
|
|
177
|
+
case 'block':
|
|
178
|
+
{
|
|
179
|
+
return styles.cursorBlock;
|
|
180
|
+
}
|
|
181
|
+
case 'dot':
|
|
182
|
+
{
|
|
183
|
+
return styles.cursorDot;
|
|
184
|
+
}
|
|
185
|
+
case 'underscore':
|
|
186
|
+
{
|
|
187
|
+
return styles.cursorUnderscore;
|
|
188
|
+
}
|
|
189
|
+
case 'pipe':
|
|
190
|
+
{
|
|
191
|
+
return styles.cursor;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
};
|
|
195
|
+
var shouldHideCursor = hideCursorWhileTyping && (currentCharIndex < textArray[currentTextIndex].length || isDeleting);
|
|
196
|
+
var textColor = getCurrentTextColor();
|
|
197
|
+
var finalCursorColor = getCurrentCursorColor();
|
|
198
|
+
|
|
199
|
+
// Split displayed text into characters for animation
|
|
200
|
+
var characters = displayedText.split('');
|
|
201
|
+
return /*#__PURE__*/createElement(Component, _objectSpread({
|
|
202
|
+
className: cx(styles.container, className),
|
|
203
|
+
ref: containerRef
|
|
204
|
+
}, props), /*#__PURE__*/_jsxs(_Fragment, {
|
|
205
|
+
children: [/*#__PURE__*/_jsx("span", {
|
|
206
|
+
className: styles.text,
|
|
207
|
+
style: textColor ? {
|
|
208
|
+
color: textColor
|
|
209
|
+
} : undefined,
|
|
210
|
+
children: characters.map(function (char, index) {
|
|
211
|
+
return /*#__PURE__*/_jsx(motion.span, {
|
|
212
|
+
animate: {
|
|
213
|
+
opacity: 1
|
|
214
|
+
},
|
|
215
|
+
initial: {
|
|
216
|
+
opacity: 0
|
|
217
|
+
},
|
|
218
|
+
style: {
|
|
219
|
+
display: 'inline-block'
|
|
220
|
+
},
|
|
221
|
+
transition: {
|
|
222
|
+
duration: typingSpeed / 500,
|
|
223
|
+
ease: 'easeInOut'
|
|
224
|
+
},
|
|
225
|
+
children: char === ' ' ? "\xA0" : char
|
|
226
|
+
}, "".concat(currentTextIndex, "-").concat(index));
|
|
227
|
+
})
|
|
228
|
+
}), showCursor && /*#__PURE__*/_jsx(motion.span, {
|
|
229
|
+
animate: {
|
|
230
|
+
opacity: 1
|
|
231
|
+
},
|
|
232
|
+
className: cx(getCursorStyle(), cursorClassName, shouldHideCursor && styles.cursorHidden),
|
|
233
|
+
initial: {
|
|
234
|
+
opacity: 0
|
|
235
|
+
},
|
|
236
|
+
style: finalCursorColor ? {
|
|
237
|
+
backgroundColor: finalCursorColor
|
|
238
|
+
} : undefined,
|
|
239
|
+
transition: {
|
|
240
|
+
duration: cursorBlinkDuration,
|
|
241
|
+
ease: 'easeInOut',
|
|
242
|
+
repeat: Number.POSITIVE_INFINITY,
|
|
243
|
+
repeatType: 'reverse'
|
|
244
|
+
},
|
|
245
|
+
children: cursorCharacter
|
|
246
|
+
})]
|
|
247
|
+
}));
|
|
248
|
+
});
|
|
249
|
+
TypewriterEffect.displayName = 'TypewriterEffect';
|
|
250
|
+
export default TypewriterEffect;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./TypewriterEffect";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const useStyles: (props?: unknown) => import("antd-style").ReturnStyles<{
|
|
2
|
+
container: import("antd-style").SerializedStyles;
|
|
3
|
+
cursor: import("antd-style").SerializedStyles;
|
|
4
|
+
cursorBlock: import("antd-style").SerializedStyles;
|
|
5
|
+
cursorCustom: import("antd-style").SerializedStyles;
|
|
6
|
+
cursorDot: import("antd-style").SerializedStyles;
|
|
7
|
+
cursorHidden: import("antd-style").SerializedStyles;
|
|
8
|
+
cursorUnderscore: import("antd-style").SerializedStyles;
|
|
9
|
+
text: import("antd-style").SerializedStyles;
|
|
10
|
+
}>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8;
|
|
2
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
3
|
+
import { createStyles } from 'antd-style';
|
|
4
|
+
export var useStyles = createStyles(function (_ref) {
|
|
5
|
+
var css = _ref.css,
|
|
6
|
+
token = _ref.token,
|
|
7
|
+
isDarkMode = _ref.isDarkMode;
|
|
8
|
+
return {
|
|
9
|
+
container: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: inline-block;\n white-space: pre-wrap;\n "]))),
|
|
10
|
+
cursor: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n transform: translateY(10%);\n\n display: inline-block;\n align-items: center;\n\n width: 3px;\n height: 1em;\n margin-inline-start: 0.25rem;\n border-radius: 2px;\n\n opacity: 1;\n background-color: ", ";\n "])), token.colorPrimary),
|
|
11
|
+
cursorBlock: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n transform: translateY(10%);\n\n display: inline-block;\n align-items: center;\n\n width: 0.5em;\n height: 1em;\n margin-inline-start: 0.25rem;\n border-radius: 2px;\n\n opacity: 1;\n background-color: ", ";\n "])), token.colorPrimary),
|
|
12
|
+
cursorCustom: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n display: inline-block;\n align-items: center;\n margin-inline-start: 0.25rem;\n opacity: 1;\n "]))),
|
|
13
|
+
cursorDot: css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n display: inline-block;\n align-items: center;\n\n width: 0.75em;\n height: 0.75em;\n margin-inline-start: 0.25rem;\n border-radius: 50%;\n\n opacity: 1;\n background-color: ", ";\n "])), token.colorPrimary),
|
|
14
|
+
cursorHidden: css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n display: none;\n "]))),
|
|
15
|
+
cursorUnderscore: css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n transform: translateY(0.3em);\n\n display: inline-block;\n align-items: center;\n\n width: 0.6em;\n height: 0.15em;\n margin-inline-start: 0.25rem;\n border-radius: 2px;\n\n opacity: 1;\n background-color: ", ";\n "])), token.colorPrimary),
|
|
16
|
+
text: css(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n color: ", ";\n "])), isDarkMode ? token.colorTextLightSolid : token.colorText)
|
|
17
|
+
};
|
|
18
|
+
});
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import type { ElementType, ReactNode } from 'react';
|
|
2
|
+
export type CursorStyle = 'pipe' | 'underscore' | 'dot' | 'block';
|
|
3
|
+
export interface TypewriterEffectProps {
|
|
4
|
+
/**
|
|
5
|
+
* Custom element type for the container
|
|
6
|
+
* @default 'div'
|
|
7
|
+
*/
|
|
8
|
+
as?: ElementType;
|
|
9
|
+
/**
|
|
10
|
+
* Additional class name for the container
|
|
11
|
+
*/
|
|
12
|
+
className?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Text color
|
|
15
|
+
*/
|
|
16
|
+
color?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Cursor blink duration in seconds
|
|
19
|
+
* @default 0.8
|
|
20
|
+
*/
|
|
21
|
+
cursorBlinkDuration?: number;
|
|
22
|
+
/**
|
|
23
|
+
* Custom cursor character or ReactNode
|
|
24
|
+
* @default undefined (uses cursorStyle)
|
|
25
|
+
*/
|
|
26
|
+
cursorCharacter?: string | ReactNode;
|
|
27
|
+
/**
|
|
28
|
+
* Additional class name for the cursor
|
|
29
|
+
*/
|
|
30
|
+
cursorClassName?: string;
|
|
31
|
+
/**
|
|
32
|
+
* Cursor color (defaults to color if not provided)
|
|
33
|
+
*/
|
|
34
|
+
cursorColor?: string;
|
|
35
|
+
/**
|
|
36
|
+
* Style of the cursor (ignored if cursorCharacter is provided)
|
|
37
|
+
* @default 'pipe'
|
|
38
|
+
*/
|
|
39
|
+
cursorStyle?: CursorStyle;
|
|
40
|
+
/**
|
|
41
|
+
* Speed of deleting characters (milliseconds per character)
|
|
42
|
+
* @default 50
|
|
43
|
+
*/
|
|
44
|
+
deletingSpeed?: number;
|
|
45
|
+
/**
|
|
46
|
+
* Hide cursor while typing
|
|
47
|
+
* @default false
|
|
48
|
+
*/
|
|
49
|
+
hideCursorWhileTyping?: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Initial delay before starting animation (milliseconds)
|
|
52
|
+
* @default 0
|
|
53
|
+
*/
|
|
54
|
+
initialDelay?: number;
|
|
55
|
+
/**
|
|
56
|
+
* Whether to loop through sentences
|
|
57
|
+
* @default true
|
|
58
|
+
*/
|
|
59
|
+
loop?: boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Callback when a sentence is completed
|
|
62
|
+
*/
|
|
63
|
+
onSentenceComplete?: (sentence: string, index: number) => void;
|
|
64
|
+
/**
|
|
65
|
+
* Pause duration after typing complete before deleting (milliseconds)
|
|
66
|
+
* @default 2000
|
|
67
|
+
*/
|
|
68
|
+
pauseDuration?: number;
|
|
69
|
+
/**
|
|
70
|
+
* Reverse mode: type from end to start
|
|
71
|
+
* @default false
|
|
72
|
+
*/
|
|
73
|
+
reverseMode?: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* Array of sentences to display
|
|
76
|
+
*/
|
|
77
|
+
sentences: string[];
|
|
78
|
+
/**
|
|
79
|
+
* Whether to show cursor
|
|
80
|
+
* @default true
|
|
81
|
+
*/
|
|
82
|
+
showCursor?: boolean;
|
|
83
|
+
/**
|
|
84
|
+
* Start animation when element becomes visible
|
|
85
|
+
* @default false
|
|
86
|
+
*/
|
|
87
|
+
startOnVisible?: boolean;
|
|
88
|
+
/**
|
|
89
|
+
* Colors for each sentence (cycles through array)
|
|
90
|
+
*/
|
|
91
|
+
textColors?: string[];
|
|
92
|
+
/**
|
|
93
|
+
* Speed of typing characters (milliseconds per character)
|
|
94
|
+
* @default 100
|
|
95
|
+
*/
|
|
96
|
+
typingSpeed?: number;
|
|
97
|
+
/**
|
|
98
|
+
* Variable typing speed range
|
|
99
|
+
*/
|
|
100
|
+
variableSpeed?: {
|
|
101
|
+
max: number;
|
|
102
|
+
min: number;
|
|
103
|
+
};
|
|
104
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/es/awesome/index.d.ts
CHANGED
|
@@ -7,3 +7,4 @@ export { default as GridBackground, type GridBackgroundProps, GridShowcase, type
|
|
|
7
7
|
export { default as Hero, type HeroAction, type HeroProps } from './Hero';
|
|
8
8
|
export { default as Spotlight, type SpotlightProps } from './Spotlight';
|
|
9
9
|
export { default as SpotlightCard, type SpotlightCardProps } from './SpotlightCard';
|
|
10
|
+
export { type CursorStyle, default as TypewriterEffect, type TypewriterEffectProps, } from './TypewriterEffect';
|
package/es/awesome/index.js
CHANGED
|
@@ -6,4 +6,5 @@ export { default as GradientButton } from "./GradientButton";
|
|
|
6
6
|
export { default as GridBackground, GridShowcase } from "./GridBackground";
|
|
7
7
|
export { default as Hero } from "./Hero";
|
|
8
8
|
export { default as Spotlight } from "./Spotlight";
|
|
9
|
-
export { default as SpotlightCard } from "./SpotlightCard";
|
|
9
|
+
export { default as SpotlightCard } from "./SpotlightCard";
|
|
10
|
+
export { default as TypewriterEffect } from "./TypewriterEffect";
|