@asgard-js/react 0.0.34 → 0.0.37-canary.1

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 (122) hide show
  1. package/dist/components/chatbot/chatbot-footer/chatbot-footer.d.ts.map +1 -1
  2. package/dist/index.js +18022 -18716
  3. package/package.json +2 -2
  4. package/.babelrc +0 -12
  5. package/eslint.config.cjs +0 -12
  6. package/src/components/chatbot/chatbot-body/chatbot-body.module.scss +0 -13
  7. package/src/components/chatbot/chatbot-body/chatbot-body.tsx +0 -45
  8. package/src/components/chatbot/chatbot-body/conversation-message-renderer.tsx +0 -55
  9. package/src/components/chatbot/chatbot-body/index.ts +0 -1
  10. package/src/components/chatbot/chatbot-container/chatbot-container.module.scss +0 -41
  11. package/src/components/chatbot/chatbot-container/chatbot-container.tsx +0 -49
  12. package/src/components/chatbot/chatbot-container/chatbot-full-screen-container.tsx +0 -54
  13. package/src/components/chatbot/chatbot-footer/chatbot-footer.module.scss +0 -67
  14. package/src/components/chatbot/chatbot-footer/chatbot-footer.tsx +0 -144
  15. package/src/components/chatbot/chatbot-footer/index.ts +0 -1
  16. package/src/components/chatbot/chatbot-footer/speech-input-button.tsx +0 -132
  17. package/src/components/chatbot/chatbot-header/chatbot-header.module.scss +0 -48
  18. package/src/components/chatbot/chatbot-header/chatbot-header.tsx +0 -98
  19. package/src/components/chatbot/chatbot-header/index.ts +0 -1
  20. package/src/components/chatbot/chatbot.spec.tsx +0 -8
  21. package/src/components/chatbot/chatbot.tsx +0 -118
  22. package/src/components/chatbot/profile-icon.tsx +0 -26
  23. package/src/components/index.ts +0 -2
  24. package/src/components/templates/avatar/avatar.module.scss +0 -6
  25. package/src/components/templates/avatar/avatar.tsx +0 -28
  26. package/src/components/templates/avatar/index.ts +0 -1
  27. package/src/components/templates/button-template/button-template.module.scss +0 -0
  28. package/src/components/templates/button-template/button-template.tsx +0 -45
  29. package/src/components/templates/button-template/card.module.scss +0 -58
  30. package/src/components/templates/button-template/card.spec.tsx +0 -213
  31. package/src/components/templates/button-template/card.tsx +0 -123
  32. package/src/components/templates/button-template/index.ts +0 -1
  33. package/src/components/templates/carousel-template/carousel-template.module.scss +0 -15
  34. package/src/components/templates/carousel-template/carousel-template.tsx +0 -49
  35. package/src/components/templates/carousel-template/index.ts +0 -1
  36. package/src/components/templates/chart-template/chart-template.module.scss +0 -52
  37. package/src/components/templates/chart-template/chart-template.tsx +0 -75
  38. package/src/components/templates/chart-template/index.ts +0 -1
  39. package/src/components/templates/hint-template/hint-template.module.scss +0 -39
  40. package/src/components/templates/hint-template/hint-template.tsx +0 -71
  41. package/src/components/templates/hint-template/index.ts +0 -1
  42. package/src/components/templates/image-template/image-template.module.scss +0 -67
  43. package/src/components/templates/image-template/image-template.tsx +0 -58
  44. package/src/components/templates/image-template/index.ts +0 -1
  45. package/src/components/templates/index.ts +0 -10
  46. package/src/components/templates/quick-replies/index.ts +0 -1
  47. package/src/components/templates/quick-replies/quick-replies.module.scss +0 -16
  48. package/src/components/templates/quick-replies/quick-replies.tsx +0 -44
  49. package/src/components/templates/template-box/index.ts +0 -2
  50. package/src/components/templates/template-box/template-box-content.module.scss +0 -13
  51. package/src/components/templates/template-box/template-box-content.tsx +0 -30
  52. package/src/components/templates/template-box/template-box.module.scss +0 -19
  53. package/src/components/templates/template-box/template-box.tsx +0 -48
  54. package/src/components/templates/text-template/bot-typing-box.tsx +0 -81
  55. package/src/components/templates/text-template/bot-typing-placeholder.tsx +0 -28
  56. package/src/components/templates/text-template/index.ts +0 -3
  57. package/src/components/templates/text-template/text-template.module.scss +0 -131
  58. package/src/components/templates/text-template/text-template.tsx +0 -90
  59. package/src/components/templates/text-template/use-react-markdown-renderer.spec.tsx +0 -758
  60. package/src/components/templates/time/index.ts +0 -1
  61. package/src/components/templates/time/time.module.scss +0 -6
  62. package/src/components/templates/time/time.tsx +0 -34
  63. package/src/context/asgard-app-initialization-context.tsx +0 -154
  64. package/src/context/asgard-service-context.tsx +0 -139
  65. package/src/context/asgard-template-context.tsx +0 -83
  66. package/src/context/asgard-theme-context.tsx +0 -401
  67. package/src/context/index.ts +0 -4
  68. package/src/hooks/index.ts +0 -11
  69. package/src/hooks/use-asgard-service-client.ts +0 -68
  70. package/src/hooks/use-channel.ts +0 -154
  71. package/src/hooks/use-debounce.ts +0 -18
  72. package/src/hooks/use-deep-compare-memo.ts +0 -19
  73. package/src/hooks/use-is-on-screen-keyboard-open.ts +0 -43
  74. package/src/hooks/use-on-screen-keyboard-scroll-fix.ts +0 -15
  75. package/src/hooks/use-prevent-over-scrolling.ts +0 -77
  76. package/src/hooks/use-react-markdown-renderer.tsx +0 -266
  77. package/src/hooks/use-resize-observer.tsx +0 -27
  78. package/src/hooks/use-update-vh.ts +0 -30
  79. package/src/hooks/use-viewport-size.ts +0 -51
  80. package/src/icons/add_a_photo.svg +0 -3
  81. package/src/icons/bot.svg +0 -14
  82. package/src/icons/close.svg +0 -3
  83. package/src/icons/distance.svg +0 -3
  84. package/src/icons/mic.svg +0 -3
  85. package/src/icons/photo_library.svg +0 -3
  86. package/src/icons/profile.svg +0 -28
  87. package/src/icons/refresh.svg +0 -3
  88. package/src/icons/send.svg +0 -3
  89. package/src/icons/stop.svg +0 -22
  90. package/src/icons/volume_up.svg +0 -3
  91. package/src/index.ts +0 -4
  92. package/src/models/bot-provider.ts +0 -108
  93. package/src/styles/_index.scss +0 -1
  94. package/src/styles/_styles.scss +0 -11
  95. package/src/styles/colors/_colors.scss +0 -10
  96. package/src/styles/colors/_index.scss +0 -1
  97. package/src/styles/colors/_variables.scss +0 -72
  98. package/src/styles/palette/_index.scss +0 -1
  99. package/src/styles/palette/_palette.scss +0 -42
  100. package/src/styles/palette/_variables.scss +0 -40
  101. package/src/styles/radius/_index.scss +0 -1
  102. package/src/styles/radius/_radius.scss +0 -8
  103. package/src/styles/radius/_variables.scss +0 -12
  104. package/src/styles/spacing/_index.scss +0 -1
  105. package/src/styles/spacing/_spacing.scss +0 -8
  106. package/src/styles/spacing/_variables.scss +0 -13
  107. package/src/styles/utils/_index.scss +0 -1
  108. package/src/styles/utils/_map.scss +0 -22
  109. package/src/test-setup.ts +0 -1
  110. package/src/utils/deep-merge.ts +0 -26
  111. package/src/utils/extractors.ts +0 -20
  112. package/src/utils/format-time.ts +0 -8
  113. package/src/utils/index.ts +0 -1
  114. package/src/utils/is.ts +0 -72
  115. package/src/utils/selectors.ts +0 -7
  116. package/src/utils/uri-validation.spec.ts +0 -208
  117. package/src/utils/uri-validation.ts +0 -103
  118. package/tsconfig.json +0 -16
  119. package/tsconfig.lib.json +0 -63
  120. package/tsconfig.spec.json +0 -36
  121. package/tsconfig.tsbuildinfo +0 -1
  122. package/vite.config.ts +0 -63
@@ -1,43 +0,0 @@
1
- import { useEffect, useState } from 'react';
2
-
3
- function isKeyboardInput(elem: HTMLElement): boolean {
4
- return (
5
- (['INPUT', 'TEXTAREA'].includes(elem.tagName) &&
6
- !['button', 'submit', 'checkbox', 'file', 'image'].includes(
7
- (elem as HTMLInputElement).type
8
- )) ||
9
- elem.hasAttribute('contenteditable')
10
- );
11
- }
12
-
13
- export function useIsOnScreenKeyboardOpen(): boolean {
14
- const [isOpen, setOpen] = useState(false);
15
-
16
- useEffect(() => {
17
- function handleFocusIn(e: FocusEvent): void {
18
- if (!e.target) return;
19
-
20
- const target = e.target as HTMLElement;
21
-
22
- if (isKeyboardInput(target)) setOpen(true);
23
- }
24
-
25
- function handleFocusOut(e: FocusEvent): void {
26
- if (!e.target) return;
27
-
28
- const target = e.target as HTMLElement;
29
-
30
- if (isKeyboardInput(target)) setOpen(false);
31
- }
32
-
33
- document.addEventListener('focusin', handleFocusIn);
34
- document.addEventListener('focusout', handleFocusOut);
35
-
36
- return (): void => {
37
- document.removeEventListener('focusin', handleFocusIn);
38
- document.removeEventListener('focusout', handleFocusOut);
39
- };
40
- }, []);
41
-
42
- return isOpen;
43
- }
@@ -1,15 +0,0 @@
1
- import { useEffect } from 'react';
2
-
3
- export function useOnScreenKeyboardScrollFix(): void {
4
- useEffect(() => {
5
- function handleScroll(): void {
6
- window.scrollTo(0, 0);
7
- }
8
-
9
- window.addEventListener('scroll', handleScroll);
10
-
11
- return (): void => {
12
- window.removeEventListener('scroll', handleScroll);
13
- };
14
- }, []);
15
- }
@@ -1,77 +0,0 @@
1
- import { RefObject, useEffect } from 'react';
2
-
3
- function findNearestScrollContainer(
4
- elem: HTMLElement
5
- ): HTMLElement | undefined {
6
- if (elem.scrollHeight > elem.offsetHeight) {
7
- return elem;
8
- }
9
-
10
- const parent = elem.parentElement;
11
- if (!parent) {
12
- return undefined;
13
- }
14
-
15
- return findNearestScrollContainer(parent);
16
- }
17
-
18
- export function usePreventOverScrolling(ref: RefObject<HTMLDivElement>): void {
19
- useEffect(() => {
20
- const elem = ref.current;
21
-
22
- if (!elem) return;
23
-
24
- let startTouch: Touch | undefined = undefined;
25
-
26
- function handleTouchStart(e: TouchEvent): void {
27
- if (e.touches.length !== 1) return;
28
-
29
- startTouch = e.touches[0];
30
- }
31
-
32
- function handleTouchMove(e: TouchEvent): void {
33
- if (e.touches.length !== 1 || !startTouch) return;
34
-
35
- const deltaY = startTouch.pageY - e.targetTouches[0].pageY;
36
- const deltaX = startTouch.pageX - e.targetTouches[0].pageX;
37
-
38
- if (Math.abs(deltaX) > Math.abs(deltaY)) return;
39
-
40
- const target = e.target as HTMLElement;
41
- const nearestScrollContainer = findNearestScrollContainer(target);
42
-
43
- if (!nearestScrollContainer) {
44
- e.preventDefault();
45
-
46
- return;
47
- }
48
-
49
- const isScrollingUp = deltaY < 0;
50
- const isAtTop = nearestScrollContainer.scrollTop === 0;
51
- if (isScrollingUp && isAtTop) {
52
- e.preventDefault();
53
-
54
- return;
55
- }
56
-
57
- const isAtBottom =
58
- nearestScrollContainer.scrollTop ===
59
- nearestScrollContainer.scrollHeight -
60
- nearestScrollContainer.clientHeight;
61
-
62
- if (!isScrollingUp && isAtBottom) {
63
- e.preventDefault();
64
-
65
- return;
66
- }
67
- }
68
-
69
- elem.addEventListener('touchstart', handleTouchStart);
70
- elem.addEventListener('touchmove', handleTouchMove);
71
-
72
- return (): void => {
73
- elem.removeEventListener('touchstart', handleTouchStart);
74
- elem.removeEventListener('touchmove', handleTouchMove);
75
- };
76
- }, [ref]);
77
- }
@@ -1,266 +0,0 @@
1
- import {
2
- ReactNode,
3
- useCallback,
4
- useEffect,
5
- useMemo,
6
- useRef,
7
- useState,
8
- } from 'react';
9
- import ReactMarkdown from 'react-markdown';
10
- import remarkGfm from 'remark-gfm';
11
- import remarkMath from 'remark-math';
12
- import rehypeHighlight from 'rehype-highlight';
13
- import rehypeKatex from 'rehype-katex';
14
- import 'katex/dist/katex.min.css';
15
- import classes from '../components/templates/text-template/text-template.module.scss';
16
- import { useAsgardTemplateContext } from '../context/asgard-template-context';
17
- import { safeWindowOpen } from '../utils/uri-validation';
18
-
19
- interface MarkdownRenderResult {
20
- htmlBlocks: ReactNode;
21
- lastTypingText: string;
22
- }
23
-
24
- type Token = {
25
- raw: string;
26
- type: string;
27
- };
28
-
29
- // Maximum number of cached markdown blocks to prevent memory leaks
30
- export const MAX_CACHE_SIZE = 100;
31
-
32
- // Helper function to manage cache size with LRU eviction
33
- export function manageCacheSize(cache: Map<string, ReactNode>): void {
34
- if (cache.size >= MAX_CACHE_SIZE) {
35
- // Remove the first (oldest) entry to make room for new ones
36
- const firstKey = cache.keys().next().value;
37
- if (firstKey) {
38
- cache.delete(firstKey);
39
- }
40
- }
41
- }
42
-
43
- // Enhanced completion detection with math expression support
44
- function isCompleteParagraph(raw: string): boolean {
45
- // Basic completion logic - must end with proper punctuation or newlines
46
- // OR contain complete markdown elements
47
- const hasMarkdownElements =
48
- /^(#{1,6}\s|>\s|[-*+]\s|\d+\.\s|---+|```|\|.*\|)/m.test(raw.trim());
49
-
50
- // Check for complete table structure (header row + separator + at least one data row)
51
- const hasCompleteTable = /\|.*\|\s*\n\s*\|[-:\s|]+\|\s*\n\s*\|.*\|/m.test(
52
- raw.trim()
53
- );
54
-
55
- const basicCompletion =
56
- raw.endsWith('\n\n') ||
57
- raw.endsWith('\n') ||
58
- raw.endsWith('.') ||
59
- raw.endsWith('。') ||
60
- raw.endsWith('!') ||
61
- raw.endsWith('!') ||
62
- raw.endsWith('?') ||
63
- hasMarkdownElements || // Has complete markdown elements
64
- hasCompleteTable; // Has complete table structure
65
-
66
- // Math-specific completion detection
67
- // Check for complete math patterns (properly closed with $..$ or $$..$$)
68
- const completeInlineMath = /\$[^$\s][^$]*\$/.test(raw);
69
- const completeBlockMath = /\$\$[^$]*\$\$/.test(raw);
70
- const hasCompleteMath = completeInlineMath || completeBlockMath;
71
-
72
- const mathCompletion =
73
- !raw.includes('$') || // No math expressions
74
- hasCompleteMath; // Has complete math and no incomplete math
75
-
76
- // Complete if: (basic completion AND math completion) OR complete block math
77
- // OR if it's just a single token without newlines (treat as complete)
78
- const isSimpleToken = !raw.includes('\n\n') && raw.trim().length > 0;
79
-
80
- return (
81
- (basicCompletion && mathCompletion) || (isSimpleToken && mathCompletion)
82
- );
83
- }
84
-
85
- // Custom table renderer to maintain current styling
86
- const TableRenderer = ({ children, ...props }: React.ComponentProps<'table'>): ReactNode => (
87
- <div className={classes.table_container}>
88
- <table {...props}>{children}</table>
89
- </div>
90
- );
91
-
92
- // Custom code renderer to maintain highlight.js classes exactly
93
- const CodeRenderer = ({ children, className, ...props }: React.ComponentProps<'code'>): ReactNode => {
94
- return (
95
- <code className={`hljs ${className || ''}`} {...props}>
96
- {children}
97
- </code>
98
- );
99
- };
100
-
101
- // Custom link renderer to integrate defaultLinkTarget prop
102
- const LinkRenderer = ({ children, href, ...props }: React.ComponentProps<'a'>): ReactNode => {
103
- const { defaultLinkTarget } = useAsgardTemplateContext();
104
-
105
- const handleClick = useCallback(
106
- (e: React.MouseEvent) => {
107
- e.preventDefault();
108
- if (href) {
109
- safeWindowOpen(href, defaultLinkTarget || '_blank');
110
- }
111
- },
112
- [href, defaultLinkTarget]
113
- );
114
-
115
- return (
116
- <a href={href} onClick={handleClick} rel="noopener noreferrer" {...props}>
117
- {children}
118
- </a>
119
- );
120
- };
121
-
122
- // Custom math renderers for inline and block math expressions
123
- const InlineMathRenderer = ({ children, ...props }: React.ComponentProps<'span'>): ReactNode => (
124
- <span className="math math-inline" {...props}>
125
- {children}
126
- </span>
127
- );
128
-
129
- const BlockMathRenderer = ({ children, ...props }: React.ComponentProps<'div'>): ReactNode => (
130
- <div className="math math-display" {...props}>
131
- {children}
132
- </div>
133
- );
134
-
135
- // Component renderers that maintain current styling and behavior
136
- const components = {
137
- table: TableRenderer,
138
- code: CodeRenderer,
139
- a: LinkRenderer,
140
- math: InlineMathRenderer, // Inline math: $expression$
141
- div: ({ className, ...props }: React.ComponentProps<'div'>): ReactNode => {
142
- // Block math: $$expression$$
143
- // Check for KaTeX display math classes
144
- if (
145
- className?.includes('math-display') ||
146
- className?.includes('katex-display')
147
- ) {
148
- return (
149
- <BlockMathRenderer
150
- className={`math math-display ${className || ''}`}
151
- {...props}
152
- >
153
- {props.children}
154
- </BlockMathRenderer>
155
- );
156
- }
157
-
158
- return <div className={className} {...props} />;
159
- },
160
- };
161
-
162
- export function useMarkdownRenderer(
163
- markdownText: string,
164
- delay = 100
165
- ): MarkdownRenderResult {
166
- const [blocks, setBlocks] = useState<ReactNode[]>([]);
167
- const [typingText, setTypingText] = useState<string>('');
168
-
169
- const cacheRef = useRef<Map<string, ReactNode>>(new Map());
170
-
171
- const getRawText = useCallback((text: string): string => {
172
- return text || '';
173
- }, []);
174
-
175
- // Mimic the exact token-based logic from current implementation
176
- const parseToTokens = useCallback((text: string): Token[] => {
177
- if (!text) return [];
178
-
179
- // Simple tokenization - split by double newlines for paragraphs
180
- // If there are no double newlines, treat the entire text as one token
181
- const paragraphs = text.includes('\n\n') ? text.split(/\n\s*\n/) : [text];
182
-
183
- return paragraphs.map((p) => ({
184
- raw: p + (text.includes('\n\n') ? '\n\n' : ''),
185
- type: 'paragraph',
186
- }));
187
- }, []);
188
-
189
- useEffect(() => {
190
- if (!markdownText) {
191
- setBlocks([]);
192
- setTypingText('');
193
- cacheRef.current.clear();
194
-
195
- return;
196
- }
197
-
198
- const handler = setTimeout(() => {
199
- const tokens = parseToTokens(markdownText);
200
- if (tokens.length === 0) {
201
- setBlocks([]);
202
- setTypingText('');
203
-
204
- return;
205
- }
206
-
207
- // Find the last complete token
208
- let lastCompleteIndex = -1;
209
-
210
- for (let i = tokens.length - 1; i >= 0; i--) {
211
- const raw = getRawText(tokens[i].raw);
212
- if (isCompleteParagraph(raw)) {
213
- lastCompleteIndex = i;
214
-
215
- break;
216
- }
217
- }
218
-
219
- const finishedTokens = tokens.slice(0, lastCompleteIndex + 1);
220
- const unprocessedTokens = tokens.slice(lastCompleteIndex + 1);
221
-
222
- const newBlocks: ReactNode[] = [];
223
-
224
- for (const token of finishedTokens) {
225
- const raw = getRawText(token.raw);
226
- const blockInCache = cacheRef.current.get(raw);
227
- if (blockInCache) {
228
- newBlocks.push(blockInCache);
229
- } else {
230
- const reactElement = (
231
- <ReactMarkdown
232
- key={raw}
233
- remarkPlugins={[remarkGfm, remarkMath]}
234
- rehypePlugins={[rehypeHighlight, rehypeKatex]}
235
- components={components}
236
- >
237
- {raw.trim()}
238
- </ReactMarkdown>
239
- );
240
- // Manage cache size before adding new entry
241
- manageCacheSize(cacheRef.current);
242
- cacheRef.current.set(raw, reactElement);
243
- newBlocks.push(reactElement);
244
- }
245
- }
246
-
247
- const lastRaw = unprocessedTokens
248
- .map((t) => getRawText(t.raw))
249
- .join('\n')
250
- .trim();
251
- setBlocks(newBlocks);
252
- setTypingText(lastRaw);
253
- }, delay);
254
-
255
- return (): void => clearTimeout(handler);
256
- }, [markdownText, delay, getRawText, parseToTokens]);
257
-
258
- const htmlBlocks = useMemo<ReactNode>(() => {
259
- return <div className={classes.md_container}>{blocks}</div>;
260
- }, [blocks]);
261
-
262
- return {
263
- htmlBlocks,
264
- lastTypingText: typingText,
265
- };
266
- }
@@ -1,27 +0,0 @@
1
- import { RefObject, useEffect } from 'react';
2
-
3
- interface UseResizeObserverProps {
4
- ref: RefObject<HTMLDivElement>;
5
- onResize: (width: number, height: number) => void;
6
- }
7
-
8
- export function useResizeObserver(props: UseResizeObserverProps): void {
9
- const { ref, onResize } = props;
10
-
11
- useEffect(() => {
12
- const resizeObserver = new ResizeObserver((entries) => {
13
- for (const entry of entries) {
14
- const { width, height } = entry.contentRect;
15
- onResize(width, height);
16
- }
17
- });
18
-
19
- if (ref.current) {
20
- resizeObserver.observe(ref.current);
21
- }
22
-
23
- return (): void => {
24
- resizeObserver.disconnect();
25
- };
26
- }, [ref, onResize]);
27
- }
@@ -1,30 +0,0 @@
1
- import { RefObject, useCallback, useEffect, useLayoutEffect } from 'react';
2
-
3
- const useBrowserLayoutEffect =
4
- typeof window !== 'undefined' ? useLayoutEffect : null;
5
-
6
- export function useUpdateVh(ref: RefObject<HTMLDivElement>): void {
7
- const updateVh = useCallback(() => {
8
- const vh = window.innerHeight * 0.01;
9
- if (ref.current) {
10
- ref.current.style.setProperty('--vh', `${vh}px`);
11
- }
12
- }, [ref]);
13
-
14
- useBrowserLayoutEffect?.(updateVh, [updateVh]);
15
-
16
- useEffect(() => {
17
- function effectTwice(): void {
18
- updateVh();
19
- setTimeout(updateVh, 1000);
20
- }
21
-
22
- updateVh();
23
-
24
- window.addEventListener('resize', effectTwice);
25
-
26
- return (): void => {
27
- window.removeEventListener('resize', effectTwice);
28
- };
29
- }, [updateVh]);
30
- }
@@ -1,51 +0,0 @@
1
- import { useCallback, useEffect, useState, useLayoutEffect } from 'react';
2
-
3
- const useBrowserLayoutEffect =
4
- typeof window !== 'undefined' ? useLayoutEffect : null;
5
-
6
- type Width = number;
7
- type Height = number;
8
- type Size = [Width, Height];
9
-
10
- function getViewportSize(): Size {
11
- return window.visualViewport
12
- ? [window.visualViewport.width, window.visualViewport.height]
13
- : [window.innerWidth, window.innerHeight];
14
- }
15
-
16
- export function useViewportSize(): Size | undefined {
17
- const [viewportSize, setViewportSize] = useState<Size | undefined>();
18
-
19
- const updateViewportSize = useCallback(() => {
20
- const viewportSize = getViewportSize();
21
-
22
- setViewportSize((oldViewportSize) =>
23
- oldViewportSize &&
24
- oldViewportSize[0] === viewportSize[0] &&
25
- oldViewportSize[1] === viewportSize[1]
26
- ? oldViewportSize
27
- : viewportSize
28
- );
29
- }, []);
30
-
31
- useBrowserLayoutEffect?.(updateViewportSize, [updateViewportSize]);
32
-
33
- useEffect(() => {
34
- function effectTwice(): void {
35
- updateViewportSize();
36
- setTimeout(updateViewportSize, 1000);
37
- }
38
-
39
- window.addEventListener('resize', effectTwice);
40
- window.addEventListener('orientationchange', effectTwice);
41
- window.visualViewport?.addEventListener('resize', effectTwice);
42
-
43
- return (): void => {
44
- window.removeEventListener('resize', effectTwice);
45
- window.removeEventListener('orientationchange', effectTwice);
46
- window.visualViewport?.removeEventListener('resize', effectTwice);
47
- };
48
- }, [updateViewportSize]);
49
-
50
- return viewportSize;
51
- }
@@ -1,3 +0,0 @@
1
- <svg width="18" height="16" viewBox="0 0 18 16" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <path d="M2.16303 15.5837C1.79762 15.5837 1.48296 15.4517 1.21908 15.1878C0.955187 14.9239 0.823242 14.6093 0.823242 14.2439V5.75678C0.823242 5.39137 0.955187 5.07671 1.21908 4.81283C1.48296 4.54894 1.79762 4.41699 2.16303 4.41699H4.58283L6.08283 2.41699H11.7464V3.50033H6.64866L5.14053 5.50033H2.16303C2.08817 5.50033 2.02671 5.52435 1.97866 5.57241C1.9306 5.62047 1.90658 5.68192 1.90658 5.75678V14.2439C1.90658 14.3187 1.9306 14.3802 1.97866 14.4282C2.02671 14.4763 2.08817 14.5003 2.16303 14.5003H14.6501C14.725 14.5003 14.7864 14.4763 14.8345 14.4282C14.8825 14.3802 14.9066 14.3187 14.9066 14.2439V6.66053H15.9899V14.2439C15.9899 14.6093 15.8604 14.9239 15.6014 15.1878C15.3423 15.4517 15.0253 15.5837 14.6501 15.5837H2.16303ZM14.9066 5.00033V3.50033H13.4066V2.41699H14.9066V0.916992H15.9899V2.41699H17.4899V3.50033H15.9899V5.00033H14.9066ZM8.40658 13.1797C9.32116 13.1797 10.0797 12.8715 10.6822 12.2551C11.2847 11.6387 11.586 10.8871 11.586 10.0003C11.586 9.12741 11.2847 8.37928 10.6822 7.75595C10.0797 7.13262 9.32116 6.82095 8.40658 6.82095C7.49199 6.82095 6.73345 7.13262 6.13095 7.75595C5.52845 8.37928 5.2272 9.13088 5.2272 10.0107C5.2272 10.8906 5.52845 11.6387 6.13095 12.2551C6.73345 12.8715 7.49199 13.1797 8.40658 13.1797ZM8.40658 12.0966C7.79116 12.0966 7.28797 11.8932 6.89699 11.4864C6.50588 11.0797 6.31033 10.5774 6.31033 9.97949C6.31033 9.39324 6.50588 8.90081 6.89699 8.5022C7.28797 8.10345 7.79116 7.90408 8.40658 7.90408C9.02199 7.90408 9.52519 8.10345 9.91616 8.5022C10.3073 8.90081 10.5028 9.39324 10.5028 9.97949C10.5028 10.5774 10.3073 11.0797 9.91616 11.4864C9.52519 11.8932 9.02199 12.0966 8.40658 12.0966Z" fill="currentColor"/>
3
- </svg>
package/src/icons/bot.svg DELETED
@@ -1,14 +0,0 @@
1
- <svg
2
- viewBox="0 0 25 24"
3
- fill="none"
4
- xmlns="http://www.w3.org/2000/svg"
5
- >
6
- <path
7
- d="M0.40625 12C0.40625 5.37258 5.77883 0 12.4062 0C19.0337 0 24.4062 5.37258 24.4062 12C24.4062 18.6274 19.0337 24 12.4062 24C5.77883 24 0.40625 18.6274 0.40625 12Z"
8
- fill="#585858"
9
- />
10
- <path
11
- d="M6.40625 18.75V15C6.40625 14.5875 6.55313 14.2344 6.84688 13.9406C7.14063 13.6469 7.49375 13.5 7.90625 13.5H16.9062C17.3188 13.5 17.6719 13.6469 17.9656 13.9406C18.2594 14.2344 18.4062 14.5875 18.4062 15V18.75H6.40625ZM10.1562 12.75C9.11875 12.75 8.23438 12.3844 7.50312 11.6531C6.77187 10.9219 6.40625 10.0375 6.40625 9C6.40625 7.9625 6.77187 7.07812 7.50312 6.34687C8.23438 5.61562 9.11875 5.25 10.1562 5.25H14.6562C15.6938 5.25 16.5781 5.61562 17.3094 6.34687C18.0406 7.07812 18.4062 7.9625 18.4062 9C18.4062 10.0375 18.0406 10.9219 17.3094 11.6531C16.5781 12.3844 15.6938 12.75 14.6562 12.75H10.1562ZM7.90625 17.25H16.9062V15H7.90625V17.25ZM10.1562 11.25H14.6562C15.2812 11.25 15.8125 11.0312 16.25 10.5938C16.6875 10.1562 16.9062 9.625 16.9062 9C16.9062 8.375 16.6875 7.84375 16.25 7.40625C15.8125 6.96875 15.2812 6.75 14.6562 6.75H10.1562C9.53125 6.75 9 6.96875 8.5625 7.40625C8.125 7.84375 7.90625 8.375 7.90625 9C7.90625 9.625 8.125 10.1562 8.5625 10.5938C9 11.0312 9.53125 11.25 10.1562 11.25ZM10.1562 9.75C10.3688 9.75 10.5469 9.67812 10.6906 9.53438C10.8344 9.39062 10.9062 9.2125 10.9062 9C10.9062 8.7875 10.8344 8.60938 10.6906 8.46562C10.5469 8.32187 10.3688 8.25 10.1562 8.25C9.94375 8.25 9.76562 8.32187 9.62187 8.46562C9.47812 8.60938 9.40625 8.7875 9.40625 9C9.40625 9.2125 9.47812 9.39062 9.62187 9.53438C9.76562 9.67812 9.94375 9.75 10.1562 9.75ZM14.6562 9.75C14.8687 9.75 15.0469 9.67812 15.1906 9.53438C15.3344 9.39062 15.4062 9.2125 15.4062 9C15.4062 8.7875 15.3344 8.60938 15.1906 8.46562C15.0469 8.32187 14.8687 8.25 14.6562 8.25C14.4438 8.25 14.2656 8.32187 14.1219 8.46562C13.9781 8.60938 13.9062 8.7875 13.9062 9C13.9062 9.2125 13.9781 9.39062 14.1219 9.53438C14.2656 9.67812 14.4438 9.75 14.6562 9.75Z"
12
- fill="white"
13
- />
14
- </svg>
@@ -1,3 +0,0 @@
1
- <svg width="15" height="14" viewBox="0 0 15 14" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
2
- <path fill-rule="evenodd" clip-rule="evenodd" d="M13.3496 0L7.41062 5.938L1.47162 0L0.411621 1.06L6.34962 6.999L0.411621 12.938L1.47162 13.999L7.41062 8.059L13.3496 13.999L14.4096 12.938L8.47162 6.999L14.4096 1.06L13.3496 0Z" fill="currentColor"/>
3
- </svg>
@@ -1,3 +0,0 @@
1
- <svg width="11" height="16" viewBox="0 0 11 16" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <path d="M5.40658 15.5837C3.97074 15.5837 2.81317 15.3955 1.93387 15.0191C1.05456 14.6427 0.614909 14.1487 0.614909 13.5372C0.614909 13.2135 0.76102 12.9143 1.05324 12.6397C1.34546 12.3651 1.75762 12.1274 2.2897 11.9266L3.16949 12.736C2.90769 12.8214 2.63331 12.9348 2.34637 13.0764C2.05956 13.218 1.83817 13.3759 1.6822 13.5499C1.75053 13.7712 2.17442 13.9848 2.95387 14.191C3.73317 14.3972 4.54942 14.5003 5.40262 14.5003C6.31123 14.5003 7.14831 14.3972 7.91387 14.191C8.67928 13.9848 9.08234 13.7503 9.12303 13.4874C8.96915 13.3464 8.73998 13.2052 8.43553 13.0637C8.13095 12.9221 7.84783 12.8086 7.58616 12.723L8.47387 11.901C9.03901 12.0965 9.46769 12.3385 9.75991 12.627C10.0521 12.9155 10.1982 13.2177 10.1982 13.5337C10.1982 14.1463 9.75859 14.6411 8.87928 15.018C7.99998 15.3951 6.84241 15.5837 5.40658 15.5837ZM5.42741 11.7295C6.75213 10.7252 7.74651 9.70998 8.41053 8.68387C9.07456 7.65762 9.40658 6.65949 9.40658 5.68949C9.40658 4.30713 8.97734 3.26338 8.11887 2.55824C7.2604 1.85296 6.35762 1.50033 5.41053 1.50033C4.46345 1.50033 3.55935 1.85317 2.69824 2.55887C1.83713 3.26442 1.40658 4.30873 1.40658 5.69178C1.40658 6.60901 1.74123 7.57512 2.41053 8.59012C3.07984 9.60512 4.08546 10.6516 5.42741 11.7295ZM5.40658 13.0837C3.69921 11.8074 2.42519 10.546 1.58449 9.29949C0.743659 8.0531 0.323242 6.85019 0.323242 5.69074C0.323242 4.83199 0.476575 4.07463 0.783242 3.41866C1.08991 2.76269 1.48838 2.21324 1.97866 1.77033C2.46908 1.32755 3.01574 0.991297 3.61866 0.761575C4.22144 0.531853 4.81783 0.416992 5.40783 0.416992C5.99783 0.416992 6.5938 0.531853 7.19574 0.761575C7.79783 0.991297 8.34408 1.32755 8.83449 1.77033C9.32477 2.21324 9.72324 2.76289 10.0299 3.41928C10.3366 4.07567 10.4899 4.83241 10.4899 5.68949C10.4899 6.84908 10.0695 8.0522 9.22866 9.29887C8.38797 10.5455 7.11394 11.8071 5.40658 13.0837ZM5.41053 6.9122C5.78178 6.9122 6.0972 6.78373 6.35678 6.52678C6.61651 6.26984 6.74637 5.95303 6.74637 5.57637C6.74637 5.19984 6.61623 4.88178 6.35595 4.6222C6.09567 4.36248 5.77921 4.23262 5.40658 4.23262C5.03796 4.23262 4.72255 4.36623 4.46033 4.63345C4.19796 4.90081 4.06678 5.2138 4.06678 5.57241C4.06678 5.93783 4.19796 6.25248 4.46033 6.51637C4.72255 6.78026 5.03928 6.9122 5.41053 6.9122Z" fill="currentColor"/>
3
- </svg>
package/src/icons/mic.svg DELETED
@@ -1,3 +0,0 @@
1
- <svg width="11" height="16" viewBox="0 0 11 16" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <path d="M5.40658 9.90397C4.82435 9.90397 4.33158 9.7023 3.92824 9.29897C3.52491 8.89564 3.32324 8.40286 3.32324 7.82064V2.82064C3.32324 2.23842 3.52491 1.74564 3.92824 1.3423C4.33158 0.938971 4.82435 0.737305 5.40658 0.737305C5.9888 0.737305 6.48158 0.938971 6.88491 1.3423C7.28824 1.74564 7.48991 2.23842 7.48991 2.82064V7.82064C7.48991 8.40286 7.28824 8.89564 6.88491 9.29897C6.48158 9.7023 5.9888 9.90397 5.40658 9.90397ZM4.86491 15.1123V12.8654C3.56213 12.7208 2.47949 12.1724 1.61699 11.2202C0.754492 10.2679 0.323242 9.13467 0.323242 7.82064H1.40658C1.40658 8.92731 1.79706 9.87064 2.57803 10.6506C3.35887 11.4306 4.30331 11.8206 5.41137 11.8206C6.51928 11.8206 7.46213 11.4306 8.23991 10.6506C9.01769 9.87064 9.40658 8.92731 9.40658 7.82064H10.4899C10.4899 9.13467 10.0587 10.2679 9.19616 11.2202C8.33366 12.1724 7.25102 12.7208 5.94824 12.8654V15.1123H4.86491ZM5.40658 8.82064C5.68991 8.82064 5.92741 8.7248 6.11908 8.53314C6.31074 8.34147 6.40658 8.10397 6.40658 7.82064V2.82064C6.40658 2.5373 6.31074 2.2998 6.11908 2.10814C5.92741 1.91647 5.68991 1.82064 5.40658 1.82064C5.12324 1.82064 4.88574 1.91647 4.69408 2.10814C4.50241 2.2998 4.40658 2.5373 4.40658 2.82064V7.82064C4.40658 8.10397 4.50241 8.34147 4.69408 8.53314C4.88574 8.7248 5.12324 8.82064 5.40658 8.82064Z" fill="currentColor"/>
3
- </svg>
@@ -1,3 +0,0 @@
1
- <svg width="15" height="16" viewBox="0 0 15 16" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <path d="M4.97042 10.1925H12.4254L10.089 7.04501L8.14979 9.5771L6.75875 7.79189L4.97042 10.1925ZM3.95438 12.904C3.57924 12.904 3.26215 12.7745 3.00312 12.5154C2.7441 12.2564 2.61458 11.9393 2.61458 11.5642V2.0771C2.61458 1.70196 2.7441 1.38487 3.00312 1.12585C3.26215 0.866819 3.57924 0.737305 3.95438 0.737305H13.4415C13.8166 0.737305 14.1337 0.866819 14.3927 1.12585C14.6517 1.38487 14.7812 1.70196 14.7812 2.0771V11.5642C14.7812 11.9393 14.6517 12.2564 14.3927 12.5154C14.1337 12.7745 13.8166 12.904 13.4415 12.904H3.95438ZM3.95438 11.8206H13.4415C13.5056 11.8206 13.5644 11.7939 13.6177 11.7404C13.6712 11.6871 13.6979 11.6283 13.6979 11.5642V2.0771C13.6979 2.01293 13.6712 1.95418 13.6177 1.90085C13.5644 1.84737 13.5056 1.82064 13.4415 1.82064H3.95438C3.89021 1.82064 3.83146 1.84737 3.77813 1.90085C3.72465 1.95418 3.69792 2.01293 3.69792 2.0771V11.5642C3.69792 11.6283 3.72465 11.6871 3.77813 11.7404C3.83146 11.7939 3.89021 11.8206 3.95438 11.8206ZM1.37104 15.4873C0.995903 15.4873 0.678819 15.3578 0.419792 15.0988C0.160764 14.8397 0.03125 14.5227 0.03125 14.1475V3.5771H1.11458V14.1475C1.11458 14.2117 1.14132 14.2704 1.19479 14.3238C1.24813 14.3772 1.30687 14.404 1.37104 14.404H11.9415V15.4873H1.37104Z" fill="currentColor"/>
3
- </svg>
@@ -1,28 +0,0 @@
1
- <svg
2
- width="33"
3
- height="32"
4
- viewBox="0 0 33 32"
5
- fill="none"
6
- xmlns="http://www.w3.org/2000/svg"
7
- >
8
- <g clip-path="url(#clip0_3084_29383)">
9
- <path
10
- d="M0.410645 16C0.410645 7.16344 7.57409 0 16.4106 0C25.2472 0 32.4106 7.16344 32.4106 16C32.4106 24.8366 25.2472 32 16.4106 32C7.57409 32 0.410645 24.8366 0.410645 16Z"
11
- fill="#333333"
12
- />
13
- <path
14
- fill-rule="evenodd"
15
- clip-rule="evenodd"
16
- d="M16.5788 6.33398C19.8925 6.33398 22.5788 9.02028 22.5788 12.334C22.5788 14.2211 21.7075 15.9048 20.3453 17.0047C23.6487 18.3735 26.0607 21.6974 26.4106 25.6673H24.4569C24.0206 21.6274 20.9742 18.4911 17.2591 18.3397L16.9776 18.334H16.5788H15.8437C12.0019 18.334 8.81164 21.5258 8.36437 25.6673H6.41064C6.76857 21.607 9.28344 18.2225 12.7029 16.9143C11.4036 15.8137 10.5788 14.1701 10.5788 12.334C10.5788 9.02028 13.265 6.33398 16.5788 6.33398ZM16.5788 16.334C18.7879 16.334 20.5788 14.5431 20.5788 12.334C20.5788 10.1248 18.7879 8.33398 16.5788 8.33398C14.3696 8.33398 12.5788 10.1248 12.5788 12.334C12.5788 14.5431 14.3696 16.334 16.5788 16.334Z"
17
- fill="#8C8C8C"
18
- />
19
- </g>
20
- <defs>
21
- <clipPath id="clip0_3084_29383">
22
- <path
23
- d="M0.410645 16C0.410645 7.16344 7.57409 0 16.4106 0C25.2472 0 32.4106 7.16344 32.4106 16C32.4106 24.8366 25.2472 32 16.4106 32C7.57409 32 0.410645 24.8366 0.410645 16Z"
24
- fill="white"
25
- />
26
- </clipPath>
27
- </defs>
28
- </svg>
@@ -1,3 +0,0 @@
1
- <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <path fill-rule="evenodd" clip-rule="evenodd" d="M3.49453 2.3352C6.44049 -0.226723 10.9105 -0.106316 13.7142 2.69633C16.6428 5.62613 16.6428 10.3739 13.7144 13.3035C10.7846 16.2322 6.03581 16.2322 3.1073 13.3036C2.30873 12.505 1.71132 11.5536 1.34188 10.5109L1.78892 10.3525L1.34171 10.5106L1.22791 10.162C1.01752 9.46018 0.910643 8.73159 0.910643 7.9997H2.4542L2.46382 8.33865C2.49584 8.9024 2.60763 9.46037 2.79674 9.99539L2.7968 9.99536L2.90116 10.2683C3.19714 10.9887 3.63414 11.6475 4.19876 12.2121C6.52451 14.5379 10.2961 14.5379 12.6229 12.212C14.9486 9.88539 14.9486 6.11464 12.6227 3.78781C10.3306 1.49653 6.63579 1.46263 4.30292 3.68622L6.68087 3.68698V5.22954H3.49394H1.95141V3.68698V0.5H3.49394L3.49453 2.3352Z" fill="currentColor"/>
3
- </svg>
@@ -1,3 +0,0 @@
1
- <svg width="15" height="12" viewBox="0 0 15 12" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <path d="M0.823242 11.6953V0.945312L14.3328 6.32031L0.823242 11.6953ZM1.90658 10.0911L11.3649 6.32031L1.90658 2.54948V4.98052L5.92574 6.32031L1.90658 7.6601V10.0911Z" fill="currentColor"/>
3
- </svg>
@@ -1,22 +0,0 @@
1
- <svg
2
- width="40"
3
- height="40"
4
- viewBox="0 0 40 40"
5
- xmlns="http://www.w3.org/2000/svg"
6
- >
7
- <circle
8
- cx="20"
9
- cy="20"
10
- r="18"
11
- fill="#D04444"
12
- />
13
- <rect
14
- x="12"
15
- y="12"
16
- width="16"
17
- height="16"
18
- fill="#FFFFFF"
19
- rx="2"
20
- ry="2"
21
- />
22
- </svg>
@@ -1,3 +0,0 @@
1
- <svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <path d="M8.93825 13.6412V12.4953C10.0846 12.1546 11.0112 11.5071 11.7178 10.5526C12.4246 9.59817 12.778 8.52255 12.778 7.32574C12.778 6.12908 12.4212 5.0588 11.7074 4.11491C10.9938 3.17088 10.0708 2.50769 8.93825 2.12533V0.979492C10.3784 1.35338 11.559 2.12713 12.4799 3.30074C13.4008 4.47435 13.8612 5.80741 13.8612 7.29991C13.8612 8.79241 13.4042 10.1289 12.4903 11.3095C11.5763 12.49 10.3923 13.2673 8.93825 13.6412ZM0.951172 8.88324V5.71658H3.71076L7.11763 2.3097V12.2901L3.71076 8.88324H0.951172ZM8.93825 10.1572V4.44262C9.47409 4.72595 9.88798 5.1229 10.1799 5.63345C10.4717 6.14401 10.6176 6.70283 10.6176 7.30991C10.6176 7.90894 10.4703 8.46178 10.1758 8.96845C9.88117 9.47512 9.46867 9.87137 8.93825 10.1572ZM6.0343 4.92491L4.1593 6.79991H2.0343V7.79991H4.1593L6.0343 9.67491V4.92491Z" fill="currentColor"/>
3
- </svg>
package/src/index.ts DELETED
@@ -1,4 +0,0 @@
1
- import 'highlight.js/styles/atom-one-dark.css';
2
- export * from './components';
3
- export * from './context';
4
- export * from './hooks';