@crafter/rn-ai-elements 0.0.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.
- package/lib/commonjs/chatbot/AIImage.js +126 -0
- package/lib/commonjs/chatbot/AIImage.js.map +1 -0
- package/lib/commonjs/chatbot/Attachments.js +317 -0
- package/lib/commonjs/chatbot/Attachments.js.map +1 -0
- package/lib/commonjs/chatbot/ChatErrorBoundary.js +201 -0
- package/lib/commonjs/chatbot/ChatErrorBoundary.js.map +1 -0
- package/lib/commonjs/chatbot/ChatMessageItem.js +169 -0
- package/lib/commonjs/chatbot/ChatMessageItem.js.map +1 -0
- package/lib/commonjs/chatbot/Conversation.js +415 -0
- package/lib/commonjs/chatbot/Conversation.js.map +1 -0
- package/lib/commonjs/chatbot/ConversationScrollButton.js +131 -0
- package/lib/commonjs/chatbot/ConversationScrollButton.js.map +1 -0
- package/lib/commonjs/chatbot/Message.js +203 -0
- package/lib/commonjs/chatbot/Message.js.map +1 -0
- package/lib/commonjs/chatbot/PromptInput.js +352 -0
- package/lib/commonjs/chatbot/PromptInput.js.map +1 -0
- package/lib/commonjs/chatbot/Reasoning.js +184 -0
- package/lib/commonjs/chatbot/Reasoning.js.map +1 -0
- package/lib/commonjs/chatbot/Shimmer.js +116 -0
- package/lib/commonjs/chatbot/Shimmer.js.map +1 -0
- package/lib/commonjs/chatbot/Sources.js +212 -0
- package/lib/commonjs/chatbot/Sources.js.map +1 -0
- package/lib/commonjs/chatbot/Suggestion.js +99 -0
- package/lib/commonjs/chatbot/Suggestion.js.map +1 -0
- package/lib/commonjs/chatbot/Tool.js +307 -0
- package/lib/commonjs/chatbot/Tool.js.map +1 -0
- package/lib/commonjs/chatbot/adapters/uiMessageAdapter.js +141 -0
- package/lib/commonjs/chatbot/adapters/uiMessageAdapter.js.map +1 -0
- package/lib/commonjs/chatbot/index.js +140 -0
- package/lib/commonjs/chatbot/index.js.map +1 -0
- package/lib/commonjs/chatbot/types.js +6 -0
- package/lib/commonjs/chatbot/types.js.map +1 -0
- package/lib/commonjs/hooks/index.js +34 -0
- package/lib/commonjs/hooks/index.js.map +1 -0
- package/lib/commonjs/hooks/useAutoScroll.js +39 -0
- package/lib/commonjs/hooks/useAutoScroll.js.map +1 -0
- package/lib/commonjs/hooks/useClipboard.js +44 -0
- package/lib/commonjs/hooks/useClipboard.js.map +1 -0
- package/lib/commonjs/hooks/useCollapsible.js +35 -0
- package/lib/commonjs/hooks/useCollapsible.js.map +1 -0
- package/lib/commonjs/hooks/useStickToBottom.js +68 -0
- package/lib/commonjs/hooks/useStickToBottom.js.map +1 -0
- package/lib/commonjs/index.js +257 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/primitives/Badge.js +119 -0
- package/lib/commonjs/primitives/Badge.js.map +1 -0
- package/lib/commonjs/primitives/Button.js +185 -0
- package/lib/commonjs/primitives/Button.js.map +1 -0
- package/lib/commonjs/primitives/Card.js +166 -0
- package/lib/commonjs/primitives/Card.js.map +1 -0
- package/lib/commonjs/primitives/Collapsible.js +137 -0
- package/lib/commonjs/primitives/Collapsible.js.map +1 -0
- package/lib/commonjs/primitives/ScrollArea.js +40 -0
- package/lib/commonjs/primitives/ScrollArea.js.map +1 -0
- package/lib/commonjs/primitives/index.js +83 -0
- package/lib/commonjs/primitives/index.js.map +1 -0
- package/lib/commonjs/streaming/StreamingMarkdown.js +252 -0
- package/lib/commonjs/streaming/StreamingMarkdown.js.map +1 -0
- package/lib/commonjs/streaming/index.js +13 -0
- package/lib/commonjs/streaming/index.js.map +1 -0
- package/lib/commonjs/streaming/parser.js +482 -0
- package/lib/commonjs/streaming/parser.js.map +1 -0
- package/lib/commonjs/streaming/renderers/BlockquoteRenderer.js +35 -0
- package/lib/commonjs/streaming/renderers/BlockquoteRenderer.js.map +1 -0
- package/lib/commonjs/streaming/renderers/CodeRenderer.js +128 -0
- package/lib/commonjs/streaming/renderers/CodeRenderer.js.map +1 -0
- package/lib/commonjs/streaming/renderers/HeadingRenderer.js +61 -0
- package/lib/commonjs/streaming/renderers/HeadingRenderer.js.map +1 -0
- package/lib/commonjs/streaming/renderers/ImageRenderer.js +53 -0
- package/lib/commonjs/streaming/renderers/ImageRenderer.js.map +1 -0
- package/lib/commonjs/streaming/renderers/LinkRenderer.js +49 -0
- package/lib/commonjs/streaming/renderers/LinkRenderer.js.map +1 -0
- package/lib/commonjs/streaming/renderers/ListRenderer.js +63 -0
- package/lib/commonjs/streaming/renderers/ListRenderer.js.map +1 -0
- package/lib/commonjs/streaming/renderers/TableRenderer.js +77 -0
- package/lib/commonjs/streaming/renderers/TableRenderer.js.map +1 -0
- package/lib/commonjs/streaming/renderers/TextRenderer.js +41 -0
- package/lib/commonjs/streaming/renderers/TextRenderer.js.map +1 -0
- package/lib/commonjs/streaming/renderers/index.js +76 -0
- package/lib/commonjs/streaming/renderers/index.js.map +1 -0
- package/lib/commonjs/streaming/renderers/renderInlineChildren.js +112 -0
- package/lib/commonjs/streaming/renderers/renderInlineChildren.js.map +1 -0
- package/lib/commonjs/streaming/renderers/renderNode.js +81 -0
- package/lib/commonjs/streaming/renderers/renderNode.js.map +1 -0
- package/lib/commonjs/theme/ThemeProvider.js +68 -0
- package/lib/commonjs/theme/ThemeProvider.js.map +1 -0
- package/lib/commonjs/theme/defaultTheme.js +96 -0
- package/lib/commonjs/theme/defaultTheme.js.map +1 -0
- package/lib/commonjs/theme/index.js +32 -0
- package/lib/commonjs/theme/index.js.map +1 -0
- package/lib/commonjs/theme/tokens.js +2 -0
- package/lib/commonjs/theme/tokens.js.map +1 -0
- package/lib/commonjs/types.d.js +2 -0
- package/lib/commonjs/types.d.js.map +1 -0
- package/lib/commonjs/voice/index.js +13 -0
- package/lib/commonjs/voice/index.js.map +1 -0
- package/lib/commonjs/voice/useSpeechRecognition.js +172 -0
- package/lib/commonjs/voice/useSpeechRecognition.js.map +1 -0
- package/lib/module/chatbot/AIImage.js +121 -0
- package/lib/module/chatbot/AIImage.js.map +1 -0
- package/lib/module/chatbot/Attachments.js +312 -0
- package/lib/module/chatbot/Attachments.js.map +1 -0
- package/lib/module/chatbot/ChatErrorBoundary.js +196 -0
- package/lib/module/chatbot/ChatErrorBoundary.js.map +1 -0
- package/lib/module/chatbot/ChatMessageItem.js +164 -0
- package/lib/module/chatbot/ChatMessageItem.js.map +1 -0
- package/lib/module/chatbot/Conversation.js +412 -0
- package/lib/module/chatbot/Conversation.js.map +1 -0
- package/lib/module/chatbot/ConversationScrollButton.js +126 -0
- package/lib/module/chatbot/ConversationScrollButton.js.map +1 -0
- package/lib/module/chatbot/Message.js +198 -0
- package/lib/module/chatbot/Message.js.map +1 -0
- package/lib/module/chatbot/PromptInput.js +347 -0
- package/lib/module/chatbot/PromptInput.js.map +1 -0
- package/lib/module/chatbot/Reasoning.js +179 -0
- package/lib/module/chatbot/Reasoning.js.map +1 -0
- package/lib/module/chatbot/Shimmer.js +111 -0
- package/lib/module/chatbot/Shimmer.js.map +1 -0
- package/lib/module/chatbot/Sources.js +207 -0
- package/lib/module/chatbot/Sources.js.map +1 -0
- package/lib/module/chatbot/Suggestion.js +94 -0
- package/lib/module/chatbot/Suggestion.js.map +1 -0
- package/lib/module/chatbot/Tool.js +303 -0
- package/lib/module/chatbot/Tool.js.map +1 -0
- package/lib/module/chatbot/adapters/uiMessageAdapter.js +137 -0
- package/lib/module/chatbot/adapters/uiMessageAdapter.js.map +1 -0
- package/lib/module/chatbot/index.js +39 -0
- package/lib/module/chatbot/index.js.map +1 -0
- package/lib/module/chatbot/types.js +4 -0
- package/lib/module/chatbot/types.js.map +1 -0
- package/lib/module/hooks/index.js +7 -0
- package/lib/module/hooks/index.js.map +1 -0
- package/lib/module/hooks/useAutoScroll.js +35 -0
- package/lib/module/hooks/useAutoScroll.js.map +1 -0
- package/lib/module/hooks/useClipboard.js +40 -0
- package/lib/module/hooks/useClipboard.js.map +1 -0
- package/lib/module/hooks/useCollapsible.js +31 -0
- package/lib/module/hooks/useCollapsible.js.map +1 -0
- package/lib/module/hooks/useStickToBottom.js +64 -0
- package/lib/module/hooks/useStickToBottom.js.map +1 -0
- package/lib/module/index.js +19 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/primitives/Badge.js +114 -0
- package/lib/module/primitives/Badge.js.map +1 -0
- package/lib/module/primitives/Button.js +180 -0
- package/lib/module/primitives/Button.js.map +1 -0
- package/lib/module/primitives/Card.js +156 -0
- package/lib/module/primitives/Card.js.map +1 -0
- package/lib/module/primitives/Collapsible.js +130 -0
- package/lib/module/primitives/Collapsible.js.map +1 -0
- package/lib/module/primitives/ScrollArea.js +35 -0
- package/lib/module/primitives/ScrollArea.js.map +1 -0
- package/lib/module/primitives/index.js +8 -0
- package/lib/module/primitives/index.js.map +1 -0
- package/lib/module/streaming/StreamingMarkdown.js +246 -0
- package/lib/module/streaming/StreamingMarkdown.js.map +1 -0
- package/lib/module/streaming/index.js +4 -0
- package/lib/module/streaming/index.js.map +1 -0
- package/lib/module/streaming/parser.js +477 -0
- package/lib/module/streaming/parser.js.map +1 -0
- package/lib/module/streaming/renderers/BlockquoteRenderer.js +30 -0
- package/lib/module/streaming/renderers/BlockquoteRenderer.js.map +1 -0
- package/lib/module/streaming/renderers/CodeRenderer.js +123 -0
- package/lib/module/streaming/renderers/CodeRenderer.js.map +1 -0
- package/lib/module/streaming/renderers/HeadingRenderer.js +56 -0
- package/lib/module/streaming/renderers/HeadingRenderer.js.map +1 -0
- package/lib/module/streaming/renderers/ImageRenderer.js +48 -0
- package/lib/module/streaming/renderers/ImageRenderer.js.map +1 -0
- package/lib/module/streaming/renderers/LinkRenderer.js +44 -0
- package/lib/module/streaming/renderers/LinkRenderer.js.map +1 -0
- package/lib/module/streaming/renderers/ListRenderer.js +58 -0
- package/lib/module/streaming/renderers/ListRenderer.js.map +1 -0
- package/lib/module/streaming/renderers/TableRenderer.js +72 -0
- package/lib/module/streaming/renderers/TableRenderer.js.map +1 -0
- package/lib/module/streaming/renderers/TextRenderer.js +36 -0
- package/lib/module/streaming/renderers/TextRenderer.js.map +1 -0
- package/lib/module/streaming/renderers/index.js +13 -0
- package/lib/module/streaming/renderers/index.js.map +1 -0
- package/lib/module/streaming/renderers/renderInlineChildren.js +107 -0
- package/lib/module/streaming/renderers/renderInlineChildren.js.map +1 -0
- package/lib/module/streaming/renderers/renderNode.js +78 -0
- package/lib/module/streaming/renderers/renderNode.js.map +1 -0
- package/lib/module/theme/ThemeProvider.js +62 -0
- package/lib/module/theme/ThemeProvider.js.map +1 -0
- package/lib/module/theme/defaultTheme.js +92 -0
- package/lib/module/theme/defaultTheme.js.map +1 -0
- package/lib/module/theme/index.js +5 -0
- package/lib/module/theme/index.js.map +1 -0
- package/lib/module/theme/tokens.js +2 -0
- package/lib/module/theme/tokens.js.map +1 -0
- package/lib/module/types.d.js +2 -0
- package/lib/module/types.d.js.map +1 -0
- package/lib/module/voice/index.js +14 -0
- package/lib/module/voice/index.js.map +1 -0
- package/lib/module/voice/useSpeechRecognition.js +169 -0
- package/lib/module/voice/useSpeechRecognition.js.map +1 -0
- package/lib/typescript/src/chatbot/AIImage.d.ts +24 -0
- package/lib/typescript/src/chatbot/AIImage.d.ts.map +1 -0
- package/lib/typescript/src/chatbot/Attachments.d.ts +20 -0
- package/lib/typescript/src/chatbot/Attachments.d.ts.map +1 -0
- package/lib/typescript/src/chatbot/ChatErrorBoundary.d.ts +57 -0
- package/lib/typescript/src/chatbot/ChatErrorBoundary.d.ts.map +1 -0
- package/lib/typescript/src/chatbot/ChatMessageItem.d.ts +45 -0
- package/lib/typescript/src/chatbot/ChatMessageItem.d.ts.map +1 -0
- package/lib/typescript/src/chatbot/Conversation.d.ts +94 -0
- package/lib/typescript/src/chatbot/Conversation.d.ts.map +1 -0
- package/lib/typescript/src/chatbot/ConversationScrollButton.d.ts +62 -0
- package/lib/typescript/src/chatbot/ConversationScrollButton.d.ts.map +1 -0
- package/lib/typescript/src/chatbot/Message.d.ts +39 -0
- package/lib/typescript/src/chatbot/Message.d.ts.map +1 -0
- package/lib/typescript/src/chatbot/PromptInput.d.ts +93 -0
- package/lib/typescript/src/chatbot/PromptInput.d.ts.map +1 -0
- package/lib/typescript/src/chatbot/Reasoning.d.ts +14 -0
- package/lib/typescript/src/chatbot/Reasoning.d.ts.map +1 -0
- package/lib/typescript/src/chatbot/Shimmer.d.ts +13 -0
- package/lib/typescript/src/chatbot/Shimmer.d.ts.map +1 -0
- package/lib/typescript/src/chatbot/Sources.d.ts +17 -0
- package/lib/typescript/src/chatbot/Sources.d.ts.map +1 -0
- package/lib/typescript/src/chatbot/Suggestion.d.ts +15 -0
- package/lib/typescript/src/chatbot/Suggestion.d.ts.map +1 -0
- package/lib/typescript/src/chatbot/Tool.d.ts +30 -0
- package/lib/typescript/src/chatbot/Tool.d.ts.map +1 -0
- package/lib/typescript/src/chatbot/adapters/uiMessageAdapter.d.ts +24 -0
- package/lib/typescript/src/chatbot/adapters/uiMessageAdapter.d.ts.map +1 -0
- package/lib/typescript/src/chatbot/index.d.ts +29 -0
- package/lib/typescript/src/chatbot/index.d.ts.map +1 -0
- package/lib/typescript/src/chatbot/types.d.ts +49 -0
- package/lib/typescript/src/chatbot/types.d.ts.map +1 -0
- package/lib/typescript/src/hooks/index.d.ts +9 -0
- package/lib/typescript/src/hooks/index.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useAutoScroll.d.ts +23 -0
- package/lib/typescript/src/hooks/useAutoScroll.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useClipboard.d.ts +22 -0
- package/lib/typescript/src/hooks/useClipboard.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useCollapsible.d.ts +28 -0
- package/lib/typescript/src/hooks/useCollapsible.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useStickToBottom.d.ts +39 -0
- package/lib/typescript/src/hooks/useStickToBottom.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +11 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/primitives/Badge.d.ts +10 -0
- package/lib/typescript/src/primitives/Badge.d.ts.map +1 -0
- package/lib/typescript/src/primitives/Button.d.ts +16 -0
- package/lib/typescript/src/primitives/Button.d.ts.map +1 -0
- package/lib/typescript/src/primitives/Card.d.ts +33 -0
- package/lib/typescript/src/primitives/Card.d.ts.map +1 -0
- package/lib/typescript/src/primitives/Collapsible.d.ts +20 -0
- package/lib/typescript/src/primitives/Collapsible.d.ts.map +1 -0
- package/lib/typescript/src/primitives/ScrollArea.d.ts +10 -0
- package/lib/typescript/src/primitives/ScrollArea.d.ts.map +1 -0
- package/lib/typescript/src/primitives/index.d.ts +11 -0
- package/lib/typescript/src/primitives/index.d.ts.map +1 -0
- package/lib/typescript/src/streaming/StreamingMarkdown.d.ts +47 -0
- package/lib/typescript/src/streaming/StreamingMarkdown.d.ts.map +1 -0
- package/lib/typescript/src/streaming/index.d.ts +3 -0
- package/lib/typescript/src/streaming/index.d.ts.map +1 -0
- package/lib/typescript/src/streaming/parser.d.ts +41 -0
- package/lib/typescript/src/streaming/parser.d.ts.map +1 -0
- package/lib/typescript/src/streaming/renderers/BlockquoteRenderer.d.ts +7 -0
- package/lib/typescript/src/streaming/renderers/BlockquoteRenderer.d.ts.map +1 -0
- package/lib/typescript/src/streaming/renderers/CodeRenderer.d.ts +7 -0
- package/lib/typescript/src/streaming/renderers/CodeRenderer.d.ts.map +1 -0
- package/lib/typescript/src/streaming/renderers/HeadingRenderer.d.ts +7 -0
- package/lib/typescript/src/streaming/renderers/HeadingRenderer.d.ts.map +1 -0
- package/lib/typescript/src/streaming/renderers/ImageRenderer.d.ts +7 -0
- package/lib/typescript/src/streaming/renderers/ImageRenderer.d.ts.map +1 -0
- package/lib/typescript/src/streaming/renderers/LinkRenderer.d.ts +7 -0
- package/lib/typescript/src/streaming/renderers/LinkRenderer.d.ts.map +1 -0
- package/lib/typescript/src/streaming/renderers/ListRenderer.d.ts +7 -0
- package/lib/typescript/src/streaming/renderers/ListRenderer.d.ts.map +1 -0
- package/lib/typescript/src/streaming/renderers/TableRenderer.d.ts +7 -0
- package/lib/typescript/src/streaming/renderers/TableRenderer.d.ts.map +1 -0
- package/lib/typescript/src/streaming/renderers/TextRenderer.d.ts +7 -0
- package/lib/typescript/src/streaming/renderers/TextRenderer.d.ts.map +1 -0
- package/lib/typescript/src/streaming/renderers/index.d.ts +19 -0
- package/lib/typescript/src/streaming/renderers/index.d.ts.map +1 -0
- package/lib/typescript/src/streaming/renderers/renderInlineChildren.d.ts +12 -0
- package/lib/typescript/src/streaming/renderers/renderInlineChildren.d.ts.map +1 -0
- package/lib/typescript/src/streaming/renderers/renderNode.d.ts +8 -0
- package/lib/typescript/src/streaming/renderers/renderNode.d.ts.map +1 -0
- package/lib/typescript/src/theme/ThemeProvider.d.ts +14 -0
- package/lib/typescript/src/theme/ThemeProvider.d.ts.map +1 -0
- package/lib/typescript/src/theme/defaultTheme.d.ts +4 -0
- package/lib/typescript/src/theme/defaultTheme.d.ts.map +1 -0
- package/lib/typescript/src/theme/index.d.ts +5 -0
- package/lib/typescript/src/theme/index.d.ts.map +1 -0
- package/lib/typescript/src/theme/tokens.d.ts +66 -0
- package/lib/typescript/src/theme/tokens.d.ts.map +1 -0
- package/lib/typescript/src/voice/index.d.ts +3 -0
- package/lib/typescript/src/voice/index.d.ts.map +1 -0
- package/lib/typescript/src/voice/useSpeechRecognition.d.ts +77 -0
- package/lib/typescript/src/voice/useSpeechRecognition.d.ts.map +1 -0
- package/package.json +132 -0
- package/src/chatbot/AIImage.tsx +166 -0
- package/src/chatbot/Attachments.tsx +382 -0
- package/src/chatbot/ChatErrorBoundary.tsx +230 -0
- package/src/chatbot/ChatMessageItem.tsx +195 -0
- package/src/chatbot/Conversation.tsx +537 -0
- package/src/chatbot/ConversationScrollButton.tsx +149 -0
- package/src/chatbot/Message.tsx +266 -0
- package/src/chatbot/PromptInput.tsx +532 -0
- package/src/chatbot/Reasoning.tsx +198 -0
- package/src/chatbot/Shimmer.tsx +146 -0
- package/src/chatbot/Sources.tsx +263 -0
- package/src/chatbot/Suggestion.tsx +123 -0
- package/src/chatbot/Tool.tsx +340 -0
- package/src/chatbot/adapters/uiMessageAdapter.ts +177 -0
- package/src/chatbot/index.ts +97 -0
- package/src/chatbot/types.ts +66 -0
- package/src/hooks/index.ts +17 -0
- package/src/hooks/useAutoScroll.ts +43 -0
- package/src/hooks/useClipboard.ts +46 -0
- package/src/hooks/useCollapsible.ts +42 -0
- package/src/hooks/useStickToBottom.ts +82 -0
- package/src/index.ts +139 -0
- package/src/primitives/Badge.tsx +119 -0
- package/src/primitives/Button.tsx +213 -0
- package/src/primitives/Card.tsx +221 -0
- package/src/primitives/Collapsible.tsx +168 -0
- package/src/primitives/ScrollArea.tsx +53 -0
- package/src/primitives/index.ts +36 -0
- package/src/streaming/StreamingMarkdown.tsx +282 -0
- package/src/streaming/index.ts +2 -0
- package/src/streaming/parser.ts +506 -0
- package/src/streaming/renderers/BlockquoteRenderer.tsx +42 -0
- package/src/streaming/renderers/CodeRenderer.tsx +158 -0
- package/src/streaming/renderers/HeadingRenderer.tsx +64 -0
- package/src/streaming/renderers/ImageRenderer.tsx +62 -0
- package/src/streaming/renderers/LinkRenderer.tsx +53 -0
- package/src/streaming/renderers/ListRenderer.tsx +65 -0
- package/src/streaming/renderers/TableRenderer.tsx +103 -0
- package/src/streaming/renderers/TextRenderer.tsx +39 -0
- package/src/streaming/renderers/index.ts +26 -0
- package/src/streaming/renderers/renderInlineChildren.tsx +115 -0
- package/src/streaming/renderers/renderNode.tsx +72 -0
- package/src/theme/ThemeProvider.tsx +77 -0
- package/src/theme/defaultTheme.ts +93 -0
- package/src/theme/index.ts +4 -0
- package/src/theme/tokens.ts +69 -0
- package/src/types.d.ts +71 -0
- package/src/voice/index.ts +15 -0
- package/src/voice/useSpeechRecognition.ts +230 -0
|
@@ -0,0 +1,482 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.parseMarkdown = parseMarkdown;
|
|
7
|
+
exports.parseMarkdownIncremental = parseMarkdownIncremental;
|
|
8
|
+
// ---------------------------------------------------------------------------
|
|
9
|
+
// Incremental markdown parser -- zero dependencies, streaming-aware.
|
|
10
|
+
// Designed for AI chat output: pragmatic, not spec-complete.
|
|
11
|
+
// ---------------------------------------------------------------------------
|
|
12
|
+
|
|
13
|
+
// ---------------------------------------------------------------------------
|
|
14
|
+
// Helpers
|
|
15
|
+
// ---------------------------------------------------------------------------
|
|
16
|
+
|
|
17
|
+
/** Split text into lines, preserving trailing empty line when text ends with \n */
|
|
18
|
+
function splitLines(text) {
|
|
19
|
+
return text.split('\n');
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** Check if a line is a horizontal rule (---, ***, ___) */
|
|
23
|
+
function isHorizontalRule(line) {
|
|
24
|
+
const trimmed = line.trim();
|
|
25
|
+
return /^[-*_]{3,}$/.test(trimmed) && /^(-{3,}|\*{3,}|_{3,})$/.test(trimmed);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** Check if a line opens or closes a fenced code block */
|
|
29
|
+
function isFenceLine(line) {
|
|
30
|
+
const match = line.match(/^```(\w*)\s*$/);
|
|
31
|
+
if (match) return {
|
|
32
|
+
isFence: true,
|
|
33
|
+
language: match[1]
|
|
34
|
+
};
|
|
35
|
+
return {
|
|
36
|
+
isFence: false,
|
|
37
|
+
language: ''
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** Detect heading line. Returns level (1-6) or 0. */
|
|
42
|
+
function headingLevel(line) {
|
|
43
|
+
const match = line.match(/^(#{1,6})\s+/);
|
|
44
|
+
return match ? match[1].length : 0;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/** Detect unordered list item. Returns the content after the bullet or null. */
|
|
48
|
+
function unorderedListItem(line) {
|
|
49
|
+
const match = line.match(/^(\s*)[-*+]\s+(.*)/);
|
|
50
|
+
return match ? match[2] : null;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** Detect ordered list item. Returns content or null. */
|
|
54
|
+
function orderedListItem(line) {
|
|
55
|
+
const match = line.match(/^(\s*)\d+[.)]\s+(.*)/);
|
|
56
|
+
return match ? match[2] : null;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/** Detect blockquote line. Returns inner content or null. */
|
|
60
|
+
function blockquoteContent(line) {
|
|
61
|
+
const match = line.match(/^>\s?(.*)/);
|
|
62
|
+
return match ? match[1] : null;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/** Detect a table row (starts and ends with |, or starts with |). */
|
|
66
|
+
function isTableRow(line) {
|
|
67
|
+
const trimmed = line.trim();
|
|
68
|
+
return trimmed.startsWith('|') && trimmed.endsWith('|');
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/** Check if a table row is a separator row (| --- | --- |). */
|
|
72
|
+
function isTableSeparator(line) {
|
|
73
|
+
const trimmed = line.trim();
|
|
74
|
+
if (!trimmed.startsWith('|') || !trimmed.endsWith('|')) return false;
|
|
75
|
+
const inner = trimmed.slice(1, -1);
|
|
76
|
+
const cells = inner.split('|');
|
|
77
|
+
return cells.every(c => /^\s*:?-{2,}:?\s*$/.test(c));
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/** Parse cells from a table row string. */
|
|
81
|
+
function parseTableCells(line) {
|
|
82
|
+
const trimmed = line.trim();
|
|
83
|
+
const inner = trimmed.startsWith('|') ? trimmed.slice(1) : trimmed;
|
|
84
|
+
const withoutTrailing = inner.endsWith('|') ? inner.slice(0, -1) : inner;
|
|
85
|
+
return withoutTrailing.split('|').map(c => c.trim());
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// ---------------------------------------------------------------------------
|
|
89
|
+
// Inline parsing
|
|
90
|
+
// ---------------------------------------------------------------------------
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Parse inline markdown (bold, italic, bold-italic, code, links, images)
|
|
94
|
+
* into a flat list of MarkdownNode children.
|
|
95
|
+
*/
|
|
96
|
+
function parseInline(text) {
|
|
97
|
+
const nodes = [];
|
|
98
|
+
let i = 0;
|
|
99
|
+
let buffer = '';
|
|
100
|
+
const flush = () => {
|
|
101
|
+
if (buffer.length > 0) {
|
|
102
|
+
nodes.push({
|
|
103
|
+
type: 'text',
|
|
104
|
+
content: buffer
|
|
105
|
+
});
|
|
106
|
+
buffer = '';
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
while (i < text.length) {
|
|
110
|
+
// --- Images:  ---
|
|
111
|
+
if (text[i] === '!' && text[i + 1] === '[') {
|
|
112
|
+
const altClose = text.indexOf(']', i + 2);
|
|
113
|
+
if (altClose !== -1 && text[altClose + 1] === '(') {
|
|
114
|
+
const urlClose = text.indexOf(')', altClose + 2);
|
|
115
|
+
if (urlClose !== -1) {
|
|
116
|
+
flush();
|
|
117
|
+
const alt = text.slice(i + 2, altClose);
|
|
118
|
+
const url = text.slice(altClose + 2, urlClose);
|
|
119
|
+
nodes.push({
|
|
120
|
+
type: 'image',
|
|
121
|
+
alt,
|
|
122
|
+
url
|
|
123
|
+
});
|
|
124
|
+
i = urlClose + 1;
|
|
125
|
+
continue;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
// --- Links: [text](url) ---
|
|
131
|
+
if (text[i] === '[') {
|
|
132
|
+
const labelClose = text.indexOf(']', i + 1);
|
|
133
|
+
if (labelClose !== -1 && text[labelClose + 1] === '(') {
|
|
134
|
+
const urlClose = text.indexOf(')', labelClose + 2);
|
|
135
|
+
if (urlClose !== -1) {
|
|
136
|
+
flush();
|
|
137
|
+
const label = text.slice(i + 1, labelClose);
|
|
138
|
+
const url = text.slice(labelClose + 2, urlClose);
|
|
139
|
+
nodes.push({
|
|
140
|
+
type: 'link',
|
|
141
|
+
url,
|
|
142
|
+
children: parseInline(label)
|
|
143
|
+
});
|
|
144
|
+
i = urlClose + 1;
|
|
145
|
+
continue;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
// --- Inline code: `...` ---
|
|
151
|
+
if (text[i] === '`') {
|
|
152
|
+
const end = text.indexOf('`', i + 1);
|
|
153
|
+
if (end !== -1) {
|
|
154
|
+
flush();
|
|
155
|
+
nodes.push({
|
|
156
|
+
type: 'code_inline',
|
|
157
|
+
content: text.slice(i + 1, end)
|
|
158
|
+
});
|
|
159
|
+
i = end + 1;
|
|
160
|
+
continue;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// --- Bold-italic: ***...*** or ___...___ ---
|
|
165
|
+
if (text[i] === '*' && text[i + 1] === '*' && text[i + 2] === '*' || text[i] === '_' && text[i + 1] === '_' && text[i + 2] === '_') {
|
|
166
|
+
const marker = text.slice(i, i + 3);
|
|
167
|
+
const end = text.indexOf(marker, i + 3);
|
|
168
|
+
if (end !== -1) {
|
|
169
|
+
flush();
|
|
170
|
+
nodes.push({
|
|
171
|
+
type: 'bold_italic',
|
|
172
|
+
children: parseInline(text.slice(i + 3, end))
|
|
173
|
+
});
|
|
174
|
+
i = end + 3;
|
|
175
|
+
continue;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
// --- Bold: **...** or __...__ ---
|
|
180
|
+
if (text[i] === '*' && text[i + 1] === '*' || text[i] === '_' && text[i + 1] === '_') {
|
|
181
|
+
const marker = text.slice(i, i + 2);
|
|
182
|
+
const end = text.indexOf(marker, i + 2);
|
|
183
|
+
if (end !== -1) {
|
|
184
|
+
flush();
|
|
185
|
+
nodes.push({
|
|
186
|
+
type: 'bold',
|
|
187
|
+
children: parseInline(text.slice(i + 2, end))
|
|
188
|
+
});
|
|
189
|
+
i = end + 2;
|
|
190
|
+
continue;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
// --- Italic: *...* or _..._ ---
|
|
195
|
+
if (text[i] === '*' || text[i] === '_') {
|
|
196
|
+
const marker = text[i];
|
|
197
|
+
const end = text.indexOf(marker, i + 1);
|
|
198
|
+
if (end !== -1 && end > i + 1) {
|
|
199
|
+
flush();
|
|
200
|
+
nodes.push({
|
|
201
|
+
type: 'italic',
|
|
202
|
+
children: parseInline(text.slice(i + 1, end))
|
|
203
|
+
});
|
|
204
|
+
i = end + 1;
|
|
205
|
+
continue;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
buffer += text[i];
|
|
209
|
+
i++;
|
|
210
|
+
}
|
|
211
|
+
flush();
|
|
212
|
+
return nodes;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
// ---------------------------------------------------------------------------
|
|
216
|
+
// Block-level parsing
|
|
217
|
+
// ---------------------------------------------------------------------------
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* Group consecutive lines of the same block type. Returns parsed nodes.
|
|
221
|
+
* `lines` must NOT include a trailing empty string from a final newline
|
|
222
|
+
* unless it is meaningful.
|
|
223
|
+
*/
|
|
224
|
+
function parseBlocks(lines) {
|
|
225
|
+
const nodes = [];
|
|
226
|
+
let i = 0;
|
|
227
|
+
while (i < lines.length) {
|
|
228
|
+
const line = lines[i];
|
|
229
|
+
|
|
230
|
+
// --- Empty line: skip ---
|
|
231
|
+
if (line.trim() === '') {
|
|
232
|
+
i++;
|
|
233
|
+
continue;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
// --- Fenced code block ---
|
|
237
|
+
const fence = isFenceLine(line);
|
|
238
|
+
if (fence.isFence) {
|
|
239
|
+
const codeLines = [];
|
|
240
|
+
i++;
|
|
241
|
+
let closed = false;
|
|
242
|
+
while (i < lines.length) {
|
|
243
|
+
if (isFenceLine(lines[i]).isFence && lines[i].trim() === '```') {
|
|
244
|
+
closed = true;
|
|
245
|
+
i++;
|
|
246
|
+
break;
|
|
247
|
+
}
|
|
248
|
+
codeLines.push(lines[i]);
|
|
249
|
+
i++;
|
|
250
|
+
}
|
|
251
|
+
nodes.push({
|
|
252
|
+
type: 'code_block',
|
|
253
|
+
content: codeLines.join('\n'),
|
|
254
|
+
language: fence.language || undefined
|
|
255
|
+
});
|
|
256
|
+
// If not closed, the outer caller marks isStreaming via lastSafeIndex
|
|
257
|
+
if (!closed) {
|
|
258
|
+
// Return what we have; caller will detect incomplete state
|
|
259
|
+
}
|
|
260
|
+
continue;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
// --- Horizontal rule ---
|
|
264
|
+
if (isHorizontalRule(line)) {
|
|
265
|
+
nodes.push({
|
|
266
|
+
type: 'horizontal_rule'
|
|
267
|
+
});
|
|
268
|
+
i++;
|
|
269
|
+
continue;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
// --- Heading ---
|
|
273
|
+
const hl = headingLevel(line);
|
|
274
|
+
if (hl > 0) {
|
|
275
|
+
const content = line.replace(/^#{1,6}\s+/, '');
|
|
276
|
+
nodes.push({
|
|
277
|
+
type: 'heading',
|
|
278
|
+
level: hl,
|
|
279
|
+
children: parseInline(content)
|
|
280
|
+
});
|
|
281
|
+
i++;
|
|
282
|
+
continue;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
// --- Table ---
|
|
286
|
+
if (isTableRow(line)) {
|
|
287
|
+
const tableRows = [];
|
|
288
|
+
let isHeader = true;
|
|
289
|
+
while (i < lines.length && isTableRow(lines[i])) {
|
|
290
|
+
if (isTableSeparator(lines[i])) {
|
|
291
|
+
// Separator row: skip it, next rows are body
|
|
292
|
+
isHeader = false;
|
|
293
|
+
i++;
|
|
294
|
+
continue;
|
|
295
|
+
}
|
|
296
|
+
const cellTexts = parseTableCells(lines[i]);
|
|
297
|
+
const cells = cellTexts.map(ct => ({
|
|
298
|
+
type: 'table_cell',
|
|
299
|
+
header: isHeader,
|
|
300
|
+
children: parseInline(ct)
|
|
301
|
+
}));
|
|
302
|
+
tableRows.push({
|
|
303
|
+
type: 'table_row',
|
|
304
|
+
children: cells
|
|
305
|
+
});
|
|
306
|
+
i++;
|
|
307
|
+
}
|
|
308
|
+
nodes.push({
|
|
309
|
+
type: 'table',
|
|
310
|
+
children: tableRows
|
|
311
|
+
});
|
|
312
|
+
continue;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
// --- Blockquote ---
|
|
316
|
+
const bqContent = blockquoteContent(line);
|
|
317
|
+
if (bqContent !== null) {
|
|
318
|
+
const bqLines = [bqContent];
|
|
319
|
+
i++;
|
|
320
|
+
while (i < lines.length) {
|
|
321
|
+
const next = blockquoteContent(lines[i]);
|
|
322
|
+
if (next !== null) {
|
|
323
|
+
bqLines.push(next);
|
|
324
|
+
i++;
|
|
325
|
+
} else {
|
|
326
|
+
break;
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
nodes.push({
|
|
330
|
+
type: 'blockquote',
|
|
331
|
+
children: parseBlocks(bqLines)
|
|
332
|
+
});
|
|
333
|
+
continue;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
// --- Unordered list ---
|
|
337
|
+
const ulContent = unorderedListItem(line);
|
|
338
|
+
if (ulContent !== null) {
|
|
339
|
+
const items = [];
|
|
340
|
+
while (i < lines.length) {
|
|
341
|
+
const itemContent = unorderedListItem(lines[i]);
|
|
342
|
+
if (itemContent !== null) {
|
|
343
|
+
items.push({
|
|
344
|
+
type: 'list_item',
|
|
345
|
+
children: parseInline(itemContent)
|
|
346
|
+
});
|
|
347
|
+
i++;
|
|
348
|
+
} else if (lines[i].trim() === '') {
|
|
349
|
+
// Allow a single blank line within a list
|
|
350
|
+
i++;
|
|
351
|
+
} else {
|
|
352
|
+
break;
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
nodes.push({
|
|
356
|
+
type: 'list',
|
|
357
|
+
ordered: false,
|
|
358
|
+
children: items
|
|
359
|
+
});
|
|
360
|
+
continue;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
// --- Ordered list ---
|
|
364
|
+
const olContent = orderedListItem(line);
|
|
365
|
+
if (olContent !== null) {
|
|
366
|
+
const items = [];
|
|
367
|
+
while (i < lines.length) {
|
|
368
|
+
const itemContent = orderedListItem(lines[i]);
|
|
369
|
+
if (itemContent !== null) {
|
|
370
|
+
items.push({
|
|
371
|
+
type: 'list_item',
|
|
372
|
+
children: parseInline(itemContent)
|
|
373
|
+
});
|
|
374
|
+
i++;
|
|
375
|
+
} else if (lines[i].trim() === '') {
|
|
376
|
+
i++;
|
|
377
|
+
} else {
|
|
378
|
+
break;
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
nodes.push({
|
|
382
|
+
type: 'list',
|
|
383
|
+
ordered: true,
|
|
384
|
+
children: items
|
|
385
|
+
});
|
|
386
|
+
continue;
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
// --- Paragraph (default) ---
|
|
390
|
+
// Collect consecutive non-blank, non-special lines.
|
|
391
|
+
const paraLines = [line];
|
|
392
|
+
i++;
|
|
393
|
+
while (i < lines.length) {
|
|
394
|
+
const next = lines[i];
|
|
395
|
+
if (next.trim() === '' || headingLevel(next) > 0 || isFenceLine(next).isFence || isHorizontalRule(next) || unorderedListItem(next) !== null || orderedListItem(next) !== null || blockquoteContent(next) !== null || isTableRow(next)) {
|
|
396
|
+
break;
|
|
397
|
+
}
|
|
398
|
+
paraLines.push(next);
|
|
399
|
+
i++;
|
|
400
|
+
}
|
|
401
|
+
nodes.push({
|
|
402
|
+
type: 'paragraph',
|
|
403
|
+
children: parseInline(paraLines.join('\n'))
|
|
404
|
+
});
|
|
405
|
+
}
|
|
406
|
+
return nodes;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
// ---------------------------------------------------------------------------
|
|
410
|
+
// Streaming-awareness helpers
|
|
411
|
+
// ---------------------------------------------------------------------------
|
|
412
|
+
|
|
413
|
+
/**
|
|
414
|
+
* Find the last "safe" index in the source text: the position up to which
|
|
415
|
+
* all blocks are fully closed. An unclosed fenced code block means we
|
|
416
|
+
* are still streaming.
|
|
417
|
+
*/
|
|
418
|
+
function computeSafeIndex(text) {
|
|
419
|
+
let fenceOpen = false;
|
|
420
|
+
let lastSafeIndex = 0;
|
|
421
|
+
const lines = splitLines(text);
|
|
422
|
+
let charIndex = 0;
|
|
423
|
+
for (let i = 0; i < lines.length; i++) {
|
|
424
|
+
const lineLength = lines[i].length;
|
|
425
|
+
const lineEnd = charIndex + lineLength + (i < lines.length - 1 ? 1 : 0); // +1 for \n
|
|
426
|
+
|
|
427
|
+
if (fenceOpen) {
|
|
428
|
+
if (lines[i].trim() === '```') {
|
|
429
|
+
fenceOpen = false;
|
|
430
|
+
lastSafeIndex = lineEnd;
|
|
431
|
+
}
|
|
432
|
+
} else {
|
|
433
|
+
const fence = isFenceLine(lines[i]);
|
|
434
|
+
if (fence.isFence) {
|
|
435
|
+
fenceOpen = true;
|
|
436
|
+
} else {
|
|
437
|
+
lastSafeIndex = lineEnd;
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
charIndex = lineEnd;
|
|
441
|
+
}
|
|
442
|
+
return {
|
|
443
|
+
lastSafeIndex,
|
|
444
|
+
isStreaming: fenceOpen
|
|
445
|
+
};
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
// ---------------------------------------------------------------------------
|
|
449
|
+
// Public API
|
|
450
|
+
// ---------------------------------------------------------------------------
|
|
451
|
+
|
|
452
|
+
/**
|
|
453
|
+
* Parse a complete markdown string into an AST.
|
|
454
|
+
* Suitable for non-streaming use cases.
|
|
455
|
+
*/
|
|
456
|
+
function parseMarkdown(text) {
|
|
457
|
+
const lines = splitLines(text);
|
|
458
|
+
return parseBlocks(lines);
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
/**
|
|
462
|
+
* Incremental streaming-aware parse.
|
|
463
|
+
*
|
|
464
|
+
* When `previousResult` is supplied the parser can skip re-parsing blocks
|
|
465
|
+
* that haven't changed (those before `previousResult.lastSafeIndex`).
|
|
466
|
+
* In practice, for simplicity in v1, we re-parse the full text but still
|
|
467
|
+
* return `isStreaming` and `lastSafeIndex` so the renderer can optimise.
|
|
468
|
+
*/
|
|
469
|
+
function parseMarkdownIncremental(text, _previousResult) {
|
|
470
|
+
const {
|
|
471
|
+
lastSafeIndex,
|
|
472
|
+
isStreaming
|
|
473
|
+
} = computeSafeIndex(text);
|
|
474
|
+
const lines = splitLines(text);
|
|
475
|
+
const nodes = parseBlocks(lines);
|
|
476
|
+
return {
|
|
477
|
+
nodes,
|
|
478
|
+
isStreaming,
|
|
479
|
+
lastSafeIndex
|
|
480
|
+
};
|
|
481
|
+
}
|
|
482
|
+
//# sourceMappingURL=parser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["splitLines","text","split","isHorizontalRule","line","trimmed","trim","test","isFenceLine","match","isFence","language","headingLevel","length","unorderedListItem","orderedListItem","blockquoteContent","isTableRow","startsWith","endsWith","isTableSeparator","inner","slice","cells","every","c","parseTableCells","withoutTrailing","map","parseInline","nodes","i","buffer","flush","push","type","content","altClose","indexOf","urlClose","alt","url","labelClose","label","children","end","marker","parseBlocks","lines","fence","codeLines","closed","join","undefined","hl","replace","level","tableRows","isHeader","cellTexts","ct","header","bqContent","bqLines","next","ulContent","items","itemContent","ordered","olContent","paraLines","computeSafeIndex","fenceOpen","lastSafeIndex","charIndex","lineLength","lineEnd","isStreaming","parseMarkdown","parseMarkdownIncremental","_previousResult"],"sourceRoot":"../../../src","sources":["streaming/parser.ts"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;;AAgDA;AACA;AACA;;AAEA;AACA,SAASA,UAAUA,CAACC,IAAY,EAAY;EAC1C,OAAOA,IAAI,CAACC,KAAK,CAAC,IAAI,CAAC;AACzB;;AAEA;AACA,SAASC,gBAAgBA,CAACC,IAAY,EAAW;EAC/C,MAAMC,OAAO,GAAGD,IAAI,CAACE,IAAI,CAAC,CAAC;EAC3B,OAAO,aAAa,CAACC,IAAI,CAACF,OAAO,CAAC,IAAI,wBAAwB,CAACE,IAAI,CAACF,OAAO,CAAC;AAC9E;;AAE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CAAC;EAC7D,MAAM+C,KAAK,GAAGhD,UAAU,CAACC,IAAI,CAAC;EAC9B,MAAM6B,KAAK,GAAGiB,WAAW,CAACC,KAAK,CAAC;EAEhC,OAAO;IAAElB,KAAK;IAAE+C,WAAW;IAAEJ;EAAc,CAAC;AAC9C","ignoreList":[]}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.BlockquoteRenderer = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _reactNative = require("react-native");
|
|
9
|
+
var _theme = require("../../theme");
|
|
10
|
+
var _renderNode = require("./renderNode");
|
|
11
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
|
+
const BlockquoteRenderer = exports.BlockquoteRenderer = /*#__PURE__*/_react.default.memo(function BlockquoteRenderer({
|
|
14
|
+
node
|
|
15
|
+
}) {
|
|
16
|
+
const theme = (0, _theme.useAIElementsTheme)();
|
|
17
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
18
|
+
style: [styles.container, {
|
|
19
|
+
borderLeftColor: theme.colors.border,
|
|
20
|
+
backgroundColor: theme.colors.muted,
|
|
21
|
+
borderRadius: theme.radius.sm
|
|
22
|
+
}],
|
|
23
|
+
children: (node.children ?? []).map((child, index) => (0, _renderNode.renderNode)(child, `bq-${index}`))
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
const styles = _reactNative.StyleSheet.create({
|
|
27
|
+
container: {
|
|
28
|
+
borderLeftWidth: 3,
|
|
29
|
+
paddingLeft: 12,
|
|
30
|
+
paddingVertical: 8,
|
|
31
|
+
paddingRight: 8,
|
|
32
|
+
marginVertical: 8
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
//# sourceMappingURL=BlockquoteRenderer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_reactNative","_theme","_renderNode","_jsxRuntime","e","__esModule","default","BlockquoteRenderer","exports","React","memo","node","theme","useAIElementsTheme","jsx","View","style","styles","container","borderLeftColor","colors","border","backgroundColor","muted","borderRadius","radius","sm","children","map","child","index","renderNode","StyleSheet","create","borderLeftWidth","paddingLeft","paddingVertical","paddingRight","marginVertical"],"sourceRoot":"../../../../src","sources":["streaming/renderers/BlockquoteRenderer.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAEA,IAAAG,WAAA,GAAAH,OAAA;AAA0C,IAAAI,WAAA,GAAAJ,OAAA;AAAA,SAAAD,uBAAAM,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAMnC,MAAMG,kBAAkB,GAAAC,OAAA,CAAAD,kBAAA,gBAAGE,cAAK,CAACC,IAAI,CAAC,SAASH,kBAAkBA,CAAC;EACvEI;AACuB,CAAC,EAAE;EAC1B,MAAMC,KAAK,GAAG,IAAAC,yBAAkB,EAAC,CAAC;EAElC,oBACE,IAAAV,WAAA,CAAAW,GAAA,EAACd,YAAA,CAAAe,IAAI;IACHC,KAAK,EAAE,CACLC,MAAM,CAACC,SAAS,EAChB;MACEC,eAAe,EAAEP,KAAK,CAACQ,MAAM,CAACC,MAAM;MACpCC,eAAe,EAAEV,KAAK,CAACQ,MAAM,CAACG,KAAK;MACnCC,YAAY,EAAEZ,KAAK,CAACa,MAAM,CAACC;IAC7B,CAAC,CACD;IAAAC,QAAA,EAED,CAAChB,IAAI,CAACgB,QAAQ,IAAI,EAAE,EAAEC,GAAG,CAAC,CAACC,KAAK,EAAEC,KAAK,KACtC,IAAAC,sBAAU,EAACF,KAAK,EAAE,MAAMC,KAAK,EAAE,CACjC;EAAC,CACG,CAAC;AAEX,CAAC,CAAC;AAEF,MAAMb,MAAM,GAAGe,uBAAU,CAACC,MAAM,CAAC;EAC/Bf,SAAS,EAAE;IACTgB,eAAe,EAAE,CAAC;IAClBC,WAAW,EAAE,EAAE;IACfC,eAAe,EAAE,CAAC;IAClBC,YAAY,EAAE,CAAC;IACfC,cAAc,EAAE;EAClB;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.CodeRenderer = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _reactNative = require("react-native");
|
|
9
|
+
var _theme = require("../../theme");
|
|
10
|
+
var _useClipboard = require("../../hooks/useClipboard");
|
|
11
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
13
|
+
const CodeRenderer = exports.CodeRenderer = /*#__PURE__*/_react.default.memo(function CodeRenderer({
|
|
14
|
+
node
|
|
15
|
+
}) {
|
|
16
|
+
const theme = (0, _theme.useAIElementsTheme)();
|
|
17
|
+
const {
|
|
18
|
+
copy,
|
|
19
|
+
copied
|
|
20
|
+
} = (0, _useClipboard.useClipboard)();
|
|
21
|
+
const handleCopy = (0, _react.useCallback)(() => {
|
|
22
|
+
if (node.content) {
|
|
23
|
+
copy(node.content);
|
|
24
|
+
}
|
|
25
|
+
}, [copy, node.content]);
|
|
26
|
+
|
|
27
|
+
// --- Inline code ---
|
|
28
|
+
if (node.type === 'code_inline') {
|
|
29
|
+
const inlineStyle = {
|
|
30
|
+
fontFamily: theme.typography.monoFontFamily,
|
|
31
|
+
fontSize: theme.typography.fontSize.sm,
|
|
32
|
+
backgroundColor: theme.colors.muted,
|
|
33
|
+
color: theme.colors.foreground,
|
|
34
|
+
borderRadius: theme.radius.sm,
|
|
35
|
+
paddingHorizontal: 4,
|
|
36
|
+
paddingVertical: 1
|
|
37
|
+
};
|
|
38
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
39
|
+
style: inlineStyle,
|
|
40
|
+
children: node.content
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// --- Code block ---
|
|
45
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
46
|
+
style: [styles.container, {
|
|
47
|
+
backgroundColor: theme.colors.muted,
|
|
48
|
+
borderRadius: theme.radius.md,
|
|
49
|
+
borderColor: theme.colors.border
|
|
50
|
+
}],
|
|
51
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
52
|
+
style: [styles.header, {
|
|
53
|
+
borderBottomColor: theme.colors.border
|
|
54
|
+
}],
|
|
55
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
56
|
+
style: [styles.language, {
|
|
57
|
+
color: theme.colors.mutedForeground,
|
|
58
|
+
fontFamily: theme.typography.monoFontFamily,
|
|
59
|
+
fontSize: theme.typography.fontSize.xs
|
|
60
|
+
}],
|
|
61
|
+
children: node.language ?? ''
|
|
62
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Pressable, {
|
|
63
|
+
onPress: handleCopy,
|
|
64
|
+
hitSlop: 8,
|
|
65
|
+
style: ({
|
|
66
|
+
pressed
|
|
67
|
+
}) => [styles.copyButton, {
|
|
68
|
+
backgroundColor: pressed ? theme.colors.border : 'transparent',
|
|
69
|
+
borderRadius: theme.radius.sm
|
|
70
|
+
}],
|
|
71
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
72
|
+
style: {
|
|
73
|
+
color: theme.colors.mutedForeground,
|
|
74
|
+
fontSize: theme.typography.fontSize.xs,
|
|
75
|
+
fontFamily: theme.typography.fontFamily
|
|
76
|
+
},
|
|
77
|
+
children: copied ? 'Copied!' : 'Copy'
|
|
78
|
+
})
|
|
79
|
+
})]
|
|
80
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.ScrollView, {
|
|
81
|
+
horizontal: true,
|
|
82
|
+
showsHorizontalScrollIndicator: false,
|
|
83
|
+
style: styles.scrollView,
|
|
84
|
+
contentContainerStyle: styles.scrollContent,
|
|
85
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
86
|
+
style: [styles.code, {
|
|
87
|
+
color: theme.colors.foreground,
|
|
88
|
+
fontFamily: theme.typography.monoFontFamily,
|
|
89
|
+
fontSize: theme.typography.fontSize.sm,
|
|
90
|
+
lineHeight: theme.typography.fontSize.sm * theme.typography.lineHeight.normal
|
|
91
|
+
}],
|
|
92
|
+
children: node.content
|
|
93
|
+
})
|
|
94
|
+
})]
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
const styles = _reactNative.StyleSheet.create({
|
|
98
|
+
container: {
|
|
99
|
+
marginVertical: 8,
|
|
100
|
+
borderWidth: 1,
|
|
101
|
+
overflow: 'hidden'
|
|
102
|
+
},
|
|
103
|
+
header: {
|
|
104
|
+
flexDirection: 'row',
|
|
105
|
+
justifyContent: 'space-between',
|
|
106
|
+
alignItems: 'center',
|
|
107
|
+
paddingHorizontal: 12,
|
|
108
|
+
paddingVertical: 6,
|
|
109
|
+
borderBottomWidth: 1
|
|
110
|
+
},
|
|
111
|
+
language: {
|
|
112
|
+
textTransform: 'lowercase'
|
|
113
|
+
},
|
|
114
|
+
copyButton: {
|
|
115
|
+
paddingHorizontal: 8,
|
|
116
|
+
paddingVertical: 4
|
|
117
|
+
},
|
|
118
|
+
scrollView: {
|
|
119
|
+
flexGrow: 0
|
|
120
|
+
},
|
|
121
|
+
scrollContent: {
|
|
122
|
+
padding: 12
|
|
123
|
+
},
|
|
124
|
+
code: {
|
|
125
|
+
// fontFamily and fontSize applied dynamically
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
//# sourceMappingURL=CodeRenderer.js.map
|