@alquimia-ai/ui 1.2.1 → 1.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/hooks/index.js +41 -32
- package/dist/components/hooks/index.js.map +1 -1
- package/dist/components/hooks/index.mjs +42 -33
- package/dist/components/hooks/index.mjs.map +1 -1
- package/dist/components/molecules/index.js +41 -32
- package/dist/components/molecules/index.js.map +1 -1
- package/dist/components/molecules/index.mjs +42 -33
- package/dist/components/molecules/index.mjs.map +1 -1
- package/dist/components/organisms/index.js +41 -32
- package/dist/components/organisms/index.js.map +1 -1
- package/dist/components/organisms/index.mjs +42 -33
- package/dist/components/organisms/index.mjs.map +1 -1
- package/dist/index.js +41 -32
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +42 -33
- package/dist/index.mjs.map +1 -1
- package/dist/package.json +136 -0
- package/package.json +50 -53
- package/src/components/atoms/index.ts +0 -32
- package/src/components/atoms/ui/alert.tsx +0 -59
- package/src/components/atoms/ui/aspect-ratio.tsx +0 -7
- package/src/components/atoms/ui/avatar.tsx +0 -50
- package/src/components/atoms/ui/badge.tsx +0 -36
- package/src/components/atoms/ui/breadcrumb.tsx +0 -120
- package/src/components/atoms/ui/button.tsx +0 -56
- package/src/components/atoms/ui/card.tsx +0 -87
- package/src/components/atoms/ui/checkbox.tsx +0 -31
- package/src/components/atoms/ui/command.tsx +0 -155
- package/src/components/atoms/ui/dialog.tsx +0 -125
- package/src/components/atoms/ui/drawer.tsx +0 -119
- package/src/components/atoms/ui/input.tsx +0 -26
- package/src/components/atoms/ui/label.tsx +0 -26
- package/src/components/atoms/ui/loader.tsx +0 -52
- package/src/components/atoms/ui/popover.tsx +0 -31
- package/src/components/atoms/ui/rich-text.tsx +0 -19
- package/src/components/atoms/ui/scroll-area.tsx +0 -48
- package/src/components/atoms/ui/select.tsx +0 -160
- package/src/components/atoms/ui/skeleton.tsx +0 -15
- package/src/components/atoms/ui/slider.tsx +0 -29
- package/src/components/atoms/ui/switch.tsx +0 -30
- package/src/components/atoms/ui/table.tsx +0 -118
- package/src/components/atoms/ui/tabs.tsx +0 -56
- package/src/components/atoms/ui/text-area/index.tsx +0 -24
- package/src/components/atoms/ui/textarea.tsx +0 -25
- package/src/components/atoms/ui/think-indicator.tsx +0 -103
- package/src/components/atoms/ui/toast.tsx +0 -129
- package/src/components/atoms/ui/toaster.tsx +0 -38
- package/src/components/atoms/ui/toggle.tsx +0 -45
- package/src/components/atoms/ui/typography/index.tsx +0 -30
- package/src/components/hooks/index.ts +0 -4
- package/src/components/hooks/use-document.tsx +0 -44
- package/src/components/hooks/use-resize-observer.ts +0 -28
- package/src/components/hooks/use-text-streaming.ts +0 -63
- package/src/components/hooks/use-toast.ts +0 -194
- package/src/components/index.ts +0 -1
- package/src/components/molecules/alert-dialog.tsx +0 -141
- package/src/components/molecules/assistant-button.tsx +0 -148
- package/src/components/molecules/call-out.tsx +0 -163
- package/src/components/molecules/carousel.tsx +0 -262
- package/src/components/molecules/documents/document-selector.tsx +0 -79
- package/src/components/molecules/documents/document-viewer.tsx +0 -85
- package/src/components/molecules/documents/index.ts +0 -2
- package/src/components/molecules/index.ts +0 -11
- package/src/components/molecules/navigation-menu.tsx +0 -128
- package/src/components/molecules/page-container.tsx +0 -17
- package/src/components/molecules/rating-comment.tsx +0 -93
- package/src/components/molecules/rating-stars.tsx +0 -136
- package/src/components/molecules/rating-thumbs.tsx +0 -90
- package/src/components/molecules/sidebar.tsx +0 -107
- package/src/components/molecules/sonner.tsx +0 -30
- package/src/components/molecules/viewers/index.ts +0 -2
- package/src/components/molecules/viewers/pdf-viewer.tsx +0 -138
- package/src/components/molecules/viewers/plain-text-viewer.tsx +0 -40
- package/src/components/organisms/assistant.tsx +0 -271
- package/src/components/organisms/index.ts +0 -6
- package/src/components/organisms/rating-dialog.tsx +0 -104
- package/src/components/organisms/speechToText.tsx +0 -92
- package/src/components/organisms/whisper.tsx +0 -106
- package/src/components/templates/cards/index.ts +0 -2
- package/src/components/templates/cards/with-image-heading-description-avatar.tsx +0 -94
- package/src/components/templates/cards/with-image-heading-description.tsx +0 -63
- package/src/components/templates/hero/index.tsx +0 -39
- package/src/components/templates/index.ts +0 -4
- package/src/components/templates/messages-window.tsx +0 -15
- package/src/components/templates/query-box.tsx +0 -13
- package/src/components/ui/input.tsx +0 -25
- package/src/components/ui/select.tsx +0 -163
- package/src/index.ts +0 -7
- package/src/lib/index.ts +0 -1
- package/src/lib/utils.ts +0 -34
- package/src/styles/call-out.css +0 -153
- package/src/styles/drawer.css +0 -28
- package/src/styles/globals.css +0 -69
- package/src/styles/prose.css +0 -51
- package/src/styles/ratings.css +0 -27
- package/src/styles/themes/base-alquimia.css +0 -95
- package/src/styles/themes/base-nordic.css +0 -83
- package/src/styles/themes/base-primary.css +0 -85
- package/src/styles/themes/base.css +0 -8
- package/src/types/index.ts +0 -1
- package/src/types/type.ts +0 -76
package/dist/index.js
CHANGED
|
@@ -2827,48 +2827,57 @@ var React32 = __toESM(require("react"));
|
|
|
2827
2827
|
// src/components/hooks/use-text-streaming.ts
|
|
2828
2828
|
var import_react11 = require("react");
|
|
2829
2829
|
var CHAR_DELAY = 25;
|
|
2830
|
-
var PUNCTUATION_DELAY =
|
|
2831
|
-
var PUNCTUATION_MARKS = [".", "!", "?", ";", ":"];
|
|
2830
|
+
var PUNCTUATION_DELAY = 400;
|
|
2832
2831
|
function useTextStreaming(content, shouldStream, handleIsTextStreaming) {
|
|
2833
|
-
const [
|
|
2834
|
-
const
|
|
2832
|
+
const [displayedText, setDisplayedText] = (0, import_react11.useState)("");
|
|
2833
|
+
const contentRef = (0, import_react11.useRef)(content);
|
|
2834
|
+
const indexRef = (0, import_react11.useRef)(0);
|
|
2835
|
+
const timerRef = (0, import_react11.useRef)(null);
|
|
2835
2836
|
const hasStartedStreaming = (0, import_react11.useRef)(false);
|
|
2836
|
-
const getDelayForChar = (text, position) => {
|
|
2837
|
-
if (position === 0) return CHAR_DELAY;
|
|
2838
|
-
const previousChar = text[position - 1] || "";
|
|
2839
|
-
const isEllipsis = text.slice(position - 1, position + 2) === "...";
|
|
2840
|
-
if (isEllipsis) {
|
|
2841
|
-
return CHAR_DELAY;
|
|
2842
|
-
}
|
|
2843
|
-
return PUNCTUATION_MARKS.includes(previousChar) ? PUNCTUATION_DELAY : CHAR_DELAY;
|
|
2844
|
-
};
|
|
2845
2837
|
(0, import_react11.useEffect)(() => {
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
return;
|
|
2838
|
+
contentRef.current = content;
|
|
2839
|
+
if (hasStartedStreaming.current && !timerRef.current && indexRef.current < contentRef.current.length) {
|
|
2840
|
+
typeNext();
|
|
2850
2841
|
}
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
if (
|
|
2854
|
-
const
|
|
2855
|
-
|
|
2856
|
-
|
|
2842
|
+
}, [content]);
|
|
2843
|
+
const typeNext = (0, import_react11.useCallback)(() => {
|
|
2844
|
+
if (indexRef.current < contentRef.current.length) {
|
|
2845
|
+
const nextChar = contentRef.current.charAt(indexRef.current);
|
|
2846
|
+
setDisplayedText((prev) => prev + nextChar);
|
|
2847
|
+
indexRef.current++;
|
|
2848
|
+
const delay = /[.!?;:]/.test(nextChar) ? PUNCTUATION_DELAY : CHAR_DELAY;
|
|
2849
|
+
timerRef.current = setTimeout(() => {
|
|
2850
|
+
timerRef.current = null;
|
|
2851
|
+
typeNext();
|
|
2857
2852
|
}, delay);
|
|
2858
2853
|
} else {
|
|
2859
2854
|
handleIsTextStreaming?.(false);
|
|
2860
2855
|
}
|
|
2856
|
+
}, []);
|
|
2857
|
+
(0, import_react11.useEffect)(() => {
|
|
2858
|
+
if (!shouldStream && !hasStartedStreaming.current) {
|
|
2859
|
+
setDisplayedText(contentRef.current);
|
|
2860
|
+
indexRef.current = contentRef.current.length;
|
|
2861
|
+
if (timerRef.current) {
|
|
2862
|
+
clearTimeout(timerRef.current);
|
|
2863
|
+
timerRef.current = null;
|
|
2864
|
+
}
|
|
2865
|
+
handleIsTextStreaming?.(false);
|
|
2866
|
+
} else {
|
|
2867
|
+
if (indexRef.current < contentRef.current.length && !timerRef.current) {
|
|
2868
|
+
handleIsTextStreaming?.(true);
|
|
2869
|
+
hasStartedStreaming.current = true;
|
|
2870
|
+
typeNext();
|
|
2871
|
+
}
|
|
2872
|
+
}
|
|
2861
2873
|
return () => {
|
|
2862
|
-
if (
|
|
2874
|
+
if (timerRef.current) {
|
|
2875
|
+
clearTimeout(timerRef.current);
|
|
2876
|
+
timerRef.current = null;
|
|
2877
|
+
}
|
|
2863
2878
|
};
|
|
2864
|
-
}, [
|
|
2865
|
-
|
|
2866
|
-
displayedContent,
|
|
2867
|
-
shouldStream,
|
|
2868
|
-
getDelayForChar,
|
|
2869
|
-
handleIsTextStreaming
|
|
2870
|
-
]);
|
|
2871
|
-
return displayedContent;
|
|
2879
|
+
}, [shouldStream, typeNext]);
|
|
2880
|
+
return displayedText;
|
|
2872
2881
|
}
|
|
2873
2882
|
|
|
2874
2883
|
// src/components/molecules/call-out.tsx
|