@dust-tt/sparkle 0.2.638-rc-1 → 0.2.638

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 (70) hide show
  1. package/dist/cjs/index.js +1 -1
  2. package/dist/esm/components/AssistantCard.d.ts +1 -0
  3. package/dist/esm/components/AssistantCard.d.ts.map +1 -1
  4. package/dist/esm/components/AssistantCard.js +2 -2
  5. package/dist/esm/components/AssistantCard.js.map +1 -1
  6. package/dist/esm/components/LoadingBlock.js +1 -1
  7. package/dist/esm/components/LoadingBlock.js.map +1 -1
  8. package/dist/esm/components/markdown/Markdown.d.ts +0 -14
  9. package/dist/esm/components/markdown/Markdown.d.ts.map +1 -1
  10. package/dist/esm/components/markdown/Markdown.js +7 -18
  11. package/dist/esm/components/markdown/Markdown.js.map +1 -1
  12. package/dist/esm/index.d.ts +0 -1
  13. package/dist/esm/index.d.ts.map +1 -1
  14. package/dist/esm/index.js +0 -1
  15. package/dist/esm/index.js.map +1 -1
  16. package/dist/esm/styles/global.css +0 -43
  17. package/dist/esm/styles/tailwind.css +0 -43
  18. package/dist/sparkle.css +0 -56
  19. package/package.json +1 -2
  20. package/src/components/AssistantCard.tsx +3 -0
  21. package/src/components/LoadingBlock.tsx +1 -1
  22. package/src/components/markdown/Markdown.tsx +12 -35
  23. package/src/index.ts +0 -1
  24. package/src/styles/global.css +0 -43
  25. package/src/styles/tailwind.css +0 -43
  26. package/dist/esm/components/streaming/BlockStreamer.d.ts +0 -8
  27. package/dist/esm/components/streaming/BlockStreamer.d.ts.map +0 -1
  28. package/dist/esm/components/streaming/BlockStreamer.js +0 -40
  29. package/dist/esm/components/streaming/BlockStreamer.js.map +0 -1
  30. package/dist/esm/components/streaming/StreamingListItem.d.ts +0 -14
  31. package/dist/esm/components/streaming/StreamingListItem.d.ts.map +0 -1
  32. package/dist/esm/components/streaming/StreamingListItem.js +0 -93
  33. package/dist/esm/components/streaming/StreamingListItem.js.map +0 -1
  34. package/dist/esm/components/streaming/StreamingMarkdown.d.ts +0 -5
  35. package/dist/esm/components/streaming/StreamingMarkdown.d.ts.map +0 -1
  36. package/dist/esm/components/streaming/StreamingMarkdown.js +0 -80
  37. package/dist/esm/components/streaming/StreamingMarkdown.js.map +0 -1
  38. package/dist/esm/components/streaming/StreamingParagraph.d.ts +0 -14
  39. package/dist/esm/components/streaming/StreamingParagraph.d.ts.map +0 -1
  40. package/dist/esm/components/streaming/StreamingParagraph.js +0 -41
  41. package/dist/esm/components/streaming/StreamingParagraph.js.map +0 -1
  42. package/dist/esm/components/streaming/index.d.ts +0 -3
  43. package/dist/esm/components/streaming/index.d.ts.map +0 -1
  44. package/dist/esm/components/streaming/index.js +0 -2
  45. package/dist/esm/components/streaming/index.js.map +0 -1
  46. package/dist/esm/components/streaming/markdownComponents.d.ts +0 -11
  47. package/dist/esm/components/streaming/markdownComponents.d.ts.map +0 -1
  48. package/dist/esm/components/streaming/markdownComponents.js +0 -85
  49. package/dist/esm/components/streaming/markdownComponents.js.map +0 -1
  50. package/dist/esm/components/streaming/types.d.ts +0 -70
  51. package/dist/esm/components/streaming/types.d.ts.map +0 -1
  52. package/dist/esm/components/streaming/types.js +0 -10
  53. package/dist/esm/components/streaming/types.js.map +0 -1
  54. package/dist/esm/components/streaming/utils.d.ts +0 -18
  55. package/dist/esm/components/streaming/utils.d.ts.map +0 -1
  56. package/dist/esm/components/streaming/utils.js +0 -97
  57. package/dist/esm/components/streaming/utils.js.map +0 -1
  58. package/dist/esm/stories/StreamingMarkdown.stories.d.ts +0 -12
  59. package/dist/esm/stories/StreamingMarkdown.stories.d.ts.map +0 -1
  60. package/dist/esm/stories/StreamingMarkdown.stories.js +0 -620
  61. package/dist/esm/stories/StreamingMarkdown.stories.js.map +0 -1
  62. package/src/components/streaming/BlockStreamer.tsx +0 -61
  63. package/src/components/streaming/StreamingListItem.tsx +0 -176
  64. package/src/components/streaming/StreamingMarkdown.tsx +0 -126
  65. package/src/components/streaming/StreamingParagraph.tsx +0 -104
  66. package/src/components/streaming/index.ts +0 -2
  67. package/src/components/streaming/markdownComponents.tsx +0 -270
  68. package/src/components/streaming/types.ts +0 -72
  69. package/src/components/streaming/utils.ts +0 -126
  70. package/src/stories/StreamingMarkdown.stories.tsx +0 -1454
@@ -1,620 +0,0 @@
1
- import { __assign, __read } from "tslib";
2
- import React from "react";
3
- import { visit } from "unist-util-visit";
4
- import { Markdown, StreamingMarkdown } from "../index_with_tw_base";
5
- var CitationsContext = React.createContext({
6
- references: {},
7
- updateActiveReferences: function () { return null; },
8
- });
9
- function CiteBlock(props) {
10
- var _a = React.useContext(CitationsContext), references = _a.references, updateActiveReferences = _a.updateActiveReferences;
11
- var refs = props.references
12
- ? JSON.parse(props.references).filter(function (r) { return r.ref in references; })
13
- : undefined;
14
- React.useEffect(function () {
15
- if (refs) {
16
- refs.forEach(function (r) {
17
- var document = references[r.ref];
18
- updateActiveReferences(document, r.counter);
19
- });
20
- }
21
- }, [refs, references, updateActiveReferences]);
22
- if (!refs || refs.length === 0) {
23
- return null;
24
- }
25
- return (React.createElement("sup", null, refs.map(function (r, idx) {
26
- var _a;
27
- return (React.createElement("span", { key: r.ref },
28
- React.createElement("span", { className: "s-inline-flex s-h-4 s-w-4 s-cursor-pointer s-items-center s-justify-center s-rounded-full s-bg-primary-600 s-text-xs s-font-medium s-text-primary-200 dark:s-bg-primary-600-night dark:s-text-primary-200-night", title: (_a = references[r.ref]) === null || _a === void 0 ? void 0 : _a.title }, r.counter),
29
- idx < refs.length - 1 && ","));
30
- })));
31
- }
32
- // Mock MentionBlock component for Storybook
33
- function MentionBlock(_a) {
34
- var agentName = _a.agentName, agentSId = _a.agentSId, onClick = _a.onClick;
35
- return (React.createElement("span", { className: "s-inline-block s-cursor-pointer s-font-medium s-text-highlight dark:s-text-highlight-night", onClick: function () { return onClick === null || onClick === void 0 ? void 0 : onClick(agentSId); } },
36
- "@",
37
- agentName));
38
- }
39
- // Mock directive functions for Storybook
40
- function getCiteDirective() {
41
- return function () {
42
- var refCounter = 1;
43
- var refSeen = {};
44
- return function (tree) {
45
- visit(tree, ["textDirective"], function (node) {
46
- var _a, _b;
47
- if (node.name === "cite" && ((_a = node.children[0]) === null || _a === void 0 ? void 0 : _a.value)) {
48
- var references = (_b = node.children[0]) === null || _b === void 0 ? void 0 : _b.value.split(",").map(function (ref) { return ({
49
- counter: refSeen[ref] || (refSeen[ref] = refCounter++),
50
- ref: ref,
51
- }); });
52
- node.data = node.data || {};
53
- node.data.hName = "sup";
54
- node.data.hProperties = { references: JSON.stringify(references) };
55
- }
56
- });
57
- };
58
- };
59
- }
60
- function getMentionDirective() {
61
- return function () { return function (tree) {
62
- visit(tree, ["textDirective"], function (node) {
63
- var _a, _b;
64
- if (node.name === "mention" && ((_a = node.children) === null || _a === void 0 ? void 0 : _a[0])) {
65
- node.data = node.data || {};
66
- node.data.hName = "mention";
67
- node.data.hProperties = {
68
- agentSId: (_b = node.attributes) === null || _b === void 0 ? void 0 : _b.sId,
69
- agentName: node.children[0].value,
70
- };
71
- }
72
- });
73
- }; };
74
- }
75
- var meta = {
76
- title: "Components/StreamingMarkdown",
77
- component: StreamingMarkdown,
78
- parameters: {
79
- layout: "padded",
80
- docs: {
81
- description: {
82
- component: "Streaming-aware Markdown that animates only newly appended text.",
83
- },
84
- },
85
- },
86
- argTypes: {
87
- animationName: { control: "text" },
88
- animationDuration: { control: "text" },
89
- animationTimingFunction: { control: "text" },
90
- animationCurve: {
91
- control: "select",
92
- options: ["linear", "accelerate", "accelerate-fast", "custom"],
93
- description: "Animation curve type for opacity transition",
94
- },
95
- },
96
- args: {
97
- animationDuration: "600ms",
98
- animationTimingFunction: "ease-out",
99
- animationCurve: "linear",
100
- },
101
- };
102
- export default meta;
103
- export var AnimationCurveComparison = {
104
- parameters: {
105
- docs: {
106
- description: {
107
- story: "Compare different animation curves for the fade-in effect. Accelerate curves start slower and speed up, reducing the time spent at low opacity.",
108
- },
109
- },
110
- },
111
- render: function (args) {
112
- var testContent = "This text demonstrates different animation curves. Notice how the **accelerate** curve starts slowly then speeds up, spending less time at low opacity levels. The *accelerate-fast* option is even more aggressive, quickly jumping to higher opacity values.";
113
- var _a = __read(React.useState(0), 2), restart = _a[0], setRestart = _a[1];
114
- return (React.createElement("div", { style: { display: "flex", flexDirection: "column", gap: 24 } },
115
- React.createElement("button", { onClick: function () { return setRestart(function (r) { return r + 1; }); }, style: {
116
- width: "fit-content",
117
- padding: "8px 16px",
118
- borderRadius: 6,
119
- border: "1px solid #ddd",
120
- background: "#f7f7f7",
121
- cursor: "pointer",
122
- } }, "\uD83D\uDD04 Restart Animations"),
123
- React.createElement("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: 20 } },
124
- React.createElement("div", { style: { border: "1px solid #ddd", padding: 16, borderRadius: 8 } },
125
- React.createElement("h3", { style: { marginTop: 0, color: "#666" } }, "Linear (Default)"),
126
- React.createElement(StreamingMarkdown, __assign({ key: "linear-".concat(restart) }, args, { content: testContent, animationCurve: "linear", animationDuration: "4000ms" }))),
127
- React.createElement("div", { style: { border: "1px solid #ddd", padding: 16, borderRadius: 8 } },
128
- React.createElement("h3", { style: { marginTop: 0, color: "#666" } }, "Accelerate (Slow start)"),
129
- React.createElement(StreamingMarkdown, __assign({ key: "accelerate-".concat(restart) }, args, { content: testContent, animationCurve: "accelerate", animationDuration: "4000ms" }))),
130
- React.createElement("div", { style: { border: "1px solid #ddd", padding: 16, borderRadius: 8 } },
131
- React.createElement("h3", { style: { marginTop: 0, color: "#666" } }, "Accelerate Fast"),
132
- React.createElement(StreamingMarkdown, __assign({ key: "accelerate-fast-".concat(restart) }, args, { content: testContent, animationCurve: "accelerate-fast", animationDuration: "4000ms" }))),
133
- React.createElement("div", { style: { border: "1px solid #ddd", padding: 16, borderRadius: 8 } },
134
- React.createElement("h3", { style: { marginTop: 0, color: "#666" } }, "Short Duration (600ms)"),
135
- React.createElement(StreamingMarkdown, __assign({ key: "short-".concat(restart) }, args, { content: testContent, animationCurve: "accelerate", animationDuration: "600ms" }))))));
136
- },
137
- };
138
- export var MathStreamingTest = {
139
- parameters: {
140
- docs: {
141
- description: {
142
- story: "Test that block math does not block streaming of subsequent content.",
143
- },
144
- },
145
- },
146
- render: function (args) {
147
- var testContent = "# Math Streaming Test\n\nThis text should appear and animate immediately.\n\n## Block Math Below\n\nThe following block math should not prevent the text after it from streaming:\n\n$$\n\\begin{align}\nE &= mc^2 \\\\\nF &= ma \\\\\n\\nabla \\cdot \\vec{E} &= \\frac{\\rho}{\\epsilon_0}\n\\end{align}\n$$\n\n## Text After Math\n\nThis text should stream in smoothly even while the math block above is incomplete.\n\nHere's some inline math too: $a^2 + b^2 = c^2$ which should also stream properly.\n\n### More Content\n\n- List item 1\n- List item 2 with **bold**\n- List item 3 with `code`\n\nThe streaming should work continuously throughout.";
148
- var _a = __read(React.useState(""), 2), content = _a[0], setContent = _a[1];
149
- var _b = __read(React.useState(false), 2), isStreaming = _b[0], setIsStreaming = _b[1];
150
- var startStreaming = function () {
151
- setContent("");
152
- setIsStreaming(true);
153
- var i = 0;
154
- var chunkSize = 5; // Small chunks to see the effect clearly
155
- var interval = setInterval(function () {
156
- if (i >= testContent.length) {
157
- clearInterval(interval);
158
- setIsStreaming(false);
159
- return;
160
- }
161
- var next = testContent.slice(i, i + chunkSize);
162
- i += chunkSize;
163
- setContent(function (prev) { return prev + next; });
164
- }, 50);
165
- };
166
- return (React.createElement("div", null,
167
- React.createElement("div", { style: { marginBottom: 20 } },
168
- React.createElement("button", { onClick: startStreaming, style: {
169
- padding: "8px 16px",
170
- borderRadius: 4,
171
- border: "1px solid #ccc",
172
- cursor: "pointer",
173
- } }, "Start Streaming"),
174
- React.createElement("span", { style: { marginLeft: 10 } }, isStreaming ? "🔴 Streaming..." : "⭐ Ready")),
175
- React.createElement("div", { style: { border: "1px solid #ddd", padding: 20, borderRadius: 8 } },
176
- React.createElement(StreamingMarkdown, __assign({}, args, { content: content }))),
177
- React.createElement("div", { style: { marginTop: 10, fontSize: 12, color: "#666" } },
178
- "Content length: ",
179
- content.length,
180
- " / ",
181
- testContent.length)));
182
- },
183
- };
184
- export var StaticVsStreaming = {
185
- parameters: {
186
- docs: {
187
- description: {
188
- story: "Compare static and streaming rendering side by side.",
189
- },
190
- },
191
- },
192
- render: function (args) {
193
- var sampleContent = "\n## Comparison Demo\n\n### Math Example\nEinstein's famous equation: $E = mc^2$\n\n### Citations\nThis is referenced material :cite[r1] with multiple sources :cite[r2,r3].\n\n### Task List\n- [x] Completed task\n- [ ] Pending task\n- [ ] Another pending task\n\n### Mentions\nPing :mention[assistant]{sId:bot-1} for help.\n";
194
- return (React.createElement("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: 20 } },
195
- React.createElement("div", null,
196
- React.createElement("h3", null, "Static (isStreaming=false)"),
197
- React.createElement(CitationsContext.Provider, { value: {
198
- references: mockReferences,
199
- updateActiveReferences: function () { },
200
- } },
201
- React.createElement(StreamingMarkdown, __assign({}, args, { content: sampleContent, isStreaming: false, additionalMarkdownComponents: {
202
- sup: CiteBlock,
203
- mention: MentionBlock,
204
- }, additionalMarkdownPlugins: [
205
- getCiteDirective(),
206
- getMentionDirective(),
207
- ] })))),
208
- React.createElement("div", null,
209
- React.createElement("h3", null, "Streaming (isStreaming=true)"),
210
- React.createElement(CitationsContext.Provider, { value: {
211
- references: mockReferences,
212
- updateActiveReferences: function () { },
213
- } },
214
- React.createElement(StreamingMarkdown, __assign({}, args, { content: sampleContent, isStreaming: true, additionalMarkdownComponents: {
215
- sup: CiteBlock,
216
- mention: MentionBlock,
217
- }, additionalMarkdownPlugins: [
218
- getCiteDirective(),
219
- getMentionDirective(),
220
- ] }))))));
221
- },
222
- };
223
- // Utility: simple seeded RNG for reproducible chunk sizes
224
- function makeRng(seed) {
225
- var s = seed >>> 0;
226
- return function () {
227
- // xorshift32
228
- s ^= s << 13;
229
- s ^= s >>> 17;
230
- s ^= s << 5;
231
- return ((s >>> 0) % 10000) / 10000;
232
- };
233
- }
234
- var ADVANCED_MD = "# \uD83D\uDE80 Enhanced Streaming Markdown Demo\n\nThis document demonstrates **all new features** including directives, math, and citations.\n\n## \uD83D\uDD22 Math Support\n\n### Inline Math\n\nThe quadratic formula is $ax^2 + bx + c = 0$ and its solution is $x = \\frac{-b \\pm \\sqrt{b^2 - 4ac}}{2a}$.\n\n### Block Math\n\n$$\n\\begin{align}\n\\nabla \\times \\vec{\\mathbf{B}} -\\, \\frac{1}{c}\\, \\frac{\\partial\\vec{\\mathbf{E}}}{\\partial t} &= \\frac{4\\pi}{c}\\vec{\\mathbf{j}} \\\\\n\\nabla \\cdot \\vec{\\mathbf{E}} &= 4 \\pi \\rho \\\\\n\\nabla \\times \\vec{\\mathbf{E}}\\, +\\, \\frac{1}{c}\\, \\frac{\\partial\\vec{\\mathbf{B}}}{\\partial t} &= \\vec{\\mathbf{0}} \\\\\n\\nabla \\cdot \\vec{\\mathbf{B}} &= 0\n\\end{align}\n$$\n\n## \uD83D\uDCDA Citations and References\n\nAccording to recent research :cite[r1], streaming markdown improves user experience. Further studies :cite[r2,r3] confirm these findings.\n\nThe implementation details :cite[r1] show significant performance gains, especially when combined with modern React patterns :cite[r2].\n\n## \uD83D\uDCAC Mentions\n\nYou can mention agents like :mention[assistant]{sId:assistant-123} or :mention[helper]{sId:helper-456} directly in the text.\n\n## \u2705 Task Lists\n\n- [ ] Implement streaming support\n- [x] Add directive system\n- [x] Support math rendering\n- [ ] Add custom visualizations\n - [x] Basic charts\n - [ ] Interactive graphs\n- [x] Test all features\n";
235
- var LONG_MD = "# \uD83D\uDE80 Comprehensive Streaming Markdown Demo\n\nWelcome to the **complete showcase** of our streaming markdown renderer! This document demonstrates *every* supported feature with rich examples.\n\n## \uD83D\uDCD6 Long Form Content\n\nThe streaming markdown renderer excels at displaying long-form content with smooth, progressive animation. As you read this paragraph, notice how the text appears naturally, character by character, creating a dynamic reading experience. This first paragraph contains **bold text**, *italicized content*, and even `inline code` to demonstrate that formatting is preserved throughout the streaming process. The animation maintains readability while adding visual interest, making it perfect for displaying AI-generated responses, real-time documentation, or any content that benefits from a progressive reveal. Whether you're building a chatbot interface, a documentation system, or an interactive tutorial, the streaming effect helps guide the reader's attention and creates a sense of immediacy and engagement with the content.\n\nFurthermore, the streaming system handles complex markdown structures with ease. This second lengthy paragraph showcases how the renderer maintains performance even with dense content that includes multiple formatting styles. Consider how ***combined bold and italic text*** flows seamlessly alongside regular prose, and how [links to external resources](https://example.com) appear without interrupting the animation flow. The system is intelligent enough to handle edge cases like `multiple` instances of `inline code` within the same sentence, or even ~~strikethrough text that has been deprecated~~. The streaming animation respects word boundaries, ensuring that text remains readable throughout the animation process. This is particularly important for accessibility, as users can still read and comprehend the content even while it's being streamed in, without experiencing jarring visual artifacts or layout shifts that might disturb the reading experience.\n\nFinally, this third substantial paragraph demonstrates the renderer's ability to handle technical content with precision. When dealing with mathematical expressions like $E = mc^2$ or more complex formulas such as $\\int_{0}^{\\infty} e^{-x^2} dx = \\frac{\\sqrt{\\pi}}{2}$, the streaming animation gracefully incorporates these elements without breaking the flow. The renderer also excels at presenting mixed content types within a single paragraph, seamlessly transitioning between regular text, **formatted sections**, [hyperlinks with descriptive text](https://github.com), and technical notations. This capability makes it ideal for educational content, technical documentation, or any scenario where rich, formatted text needs to be presented progressively. The underlying architecture ensures that even as content streams in, all interactive elements remain functional, links remain clickable, and the overall document structure remains intact and navigable throughout the entire streaming process.\n\n## \uD83D\uDCDD Text Formatting\n\nThis paragraph demonstrates basic text with **bold emphasis**, *italic text*, ***bold italic combination***, and `inline code snippets`. We can also use ~~strikethrough text~~ and combine multiple styles for ***`formatted code`*** within emphasis.\n\n## \uD83E\uDDEE Mathematical Expressions\n\n### Inline Math\n\nThe quadratic formula is $x = \\frac{-b \\pm \\sqrt{b^2 - 4ac}}{2a}$, which gives us the roots of a quadratic equation. We can also write simple expressions like $e^{i\\pi} + 1 = 0$ (Euler's identity) or $\\sum_{i=1}^{n} i = \\frac{n(n+1)}{2}$ inline with text.\n\n### Block Math\n\nHere's the famous Gaussian integral:\n\n$$\n\\int_{-\\infty}^{\\infty} e^{-x^2} dx = \\sqrt{\\pi}\n$$\n\nAnd Maxwell's equations in differential form:\n\n$$\n\\begin{align}\n\\nabla \\cdot \\vec{E} &= \\frac{\\rho}{\\epsilon_0} \\\\\n\\nabla \\cdot \\vec{B} &= 0 \\\\\n\\nabla \\times \\vec{E} &= -\\frac{\\partial \\vec{B}}{\\partial t} \\\\\n\\nabla \\times \\vec{B} &= \\mu_0 \\vec{J} + \\mu_0 \\epsilon_0 \\frac{\\partial \\vec{E}}{\\partial t}\n\\end{align}\n$$\n\nMatrix multiplication example:\n\n$$\n\\begin{bmatrix}\na & b \\\\\nc & d\n\\end{bmatrix}\n\\begin{bmatrix}\nx \\\\\ny\n\\end{bmatrix}\n=\n\\begin{bmatrix}\nax + by \\\\\ncx + dy\n\\end{bmatrix}\n$$\n\n## \uD83C\uDFAF Custom Directives\n\n### Citations\n\nHere's a statement with a citation :cite[r1], and another with multiple citations :cite[r2,r3]. These custom directives demonstrate how we can extend the markdown syntax with domain-specific features :cite[r1].\n\n### Mentions\n\nYou can mention agents like :mention[dust]{sId=\"assistant\"} or :mention[gpt4]{sId=\"gpt4-helper\"} in your text. These mentions are interactive and can trigger actions when clicked.\n\n### Links and References\n\nHere are different types of links:\n- [External link to Dust](https://dust.tt)\n- [Link with title](https://github.com \"Visit GitHub\")\n- Direct URL: https://example.com\n- Reference-style link: [Dust Platform][dust-ref]\n\n[dust-ref]: https://dust.tt \"Dust - AI Platform\"\n\n## \uD83D\uDCCB Lists Showcase\n\n### Unordered Lists with Nesting\n\n- First level item with regular text\n- Second item with **bold** and *italic* formatting\n - Nested item 2.1 with `inline code`\n - Nested item 2.2 with a [link](https://example.com)\n - Deep nesting level 3.1\n - Deep nesting level 3.2 with ***combined formatting***\n - Back to level 2\n- Back to first level\n- Another first level item with multiple lines of text that demonstrates how longer content wraps properly in list items\n\n### Ordered Lists\n\n1. First ordered item\n2. Second item with **emphasis**\n 1. Nested ordered 2.1\n 2. Nested ordered 2.2\n 1. Deep nested 2.2.1\n 2. Deep nested 2.2.2\n 3. Nested ordered 2.3\n3. Third item with mixed content\n4. Fourth item\n\n### Mixed Lists\n\n1. Ordered at top level\n - Unordered nested under ordered\n - Another unordered item\n 1. Ordered under unordered\n 2. Second ordered item\n2. Back to top level ordered\n - Another mixed nested list\n - Deeper unordered\n 1. Even deeper ordered\n\n### Task Lists\n\n- [ ] Unchecked task item\n- [x] Completed task item\n- [ ] Task with **formatted text**\n - [x] Nested completed task\n - [ ] Nested incomplete task\n\n## \uD83D\uDCBB Code Blocks\n\n### Inline Code\n\nHere's some `inline code` in the middle of a sentence, and `const x = 42` with actual code.\n\n### JavaScript/TypeScript\n\n```javascript\n// Fibonacci sequence generator\nfunction* fibonacci() {\n let [a, b] = [0, 1];\n while (true) {\n yield a;\n [a, b] = [b, a + b];\n }\n}\n\n// Usage example\nconst fib = fibonacci();\nfor (let i = 0; i < 10; i++) {\n console.log(`F(${i}) = ${fib.next().value}`);\n}\n```\n\n### Python\n\n```python\n# Python example with classes\nclass DataProcessor:\n def __init__(self, data):\n self.data = data\n self.processed = False\n\n def process(self):\n \"\"\"Process the data with transformations\"\"\"\n if not self.processed:\n self.data = [x * 2 for x in self.data if x > 0]\n self.processed = True\n return self.data\n\n# Usage\nprocessor = DataProcessor([1, -2, 3, 4, -5])\nresult = processor.process()\nprint(f\"Processed: {result}\")\n```\n\n### React Component (JSX)\n\n```jsx\nimport React, { useState, useEffect } from 'react';\n\nconst StreamingDemo = ({ content }) => {\n const [displayText, setDisplayText] = useState('');\n\n useEffect(() => {\n let index = 0;\n const timer = setInterval(() => {\n if (index < content.length) {\n setDisplayText(content.slice(0, ++index));\n } else {\n clearInterval(timer);\n }\n }, 50);\n\n return () => clearInterval(timer);\n }, [content]);\n\n return (\n <div className=\"streaming-text\">\n {displayText}\n </div>\n );\n};\n\nexport default StreamingDemo;\n```\n\n### Shell/Bash\n\n```bash\n#!/bin/bash\n\n# System information script\necho \"System Information\"\necho \"==================\"\necho \"Hostname: $(hostname)\"\necho \"OS: $(uname -s)\"\necho \"Kernel: $(uname -r)\"\necho \"CPU: $(sysctl -n machdep.cpu.brand_string 2>/dev/null || lscpu | grep 'Model name')\"\necho \"Memory: $(free -h 2>/dev/null || vm_stat | grep 'Pages free')\"\necho \"Disk Usage:\"\ndf -h | head -5\n```\n\n### JSON\n\n```json\n{\n \"name\": \"streaming-markdown\",\n \"version\": \"1.0.0\",\n \"features\": {\n \"streaming\": true,\n \"syntaxHighlight\": true,\n \"animations\": {\n \"fadeIn\": \"600ms\",\n \"timing\": \"ease-out\"\n }\n },\n \"supported\": [\"lists\", \"code\", \"tables\", \"images\", \"math\", \"directives\"]\n}\n```\n\n### Mermaid Diagram\n\n```mermaid\ngraph TD\n A[Start] --> B{Is Streaming?}\n B -->|Yes| C[Stream Characters]\n B -->|No| D[Render Static]\n C --> E[Apply Animation]\n E --> F[Display Content]\n D --> F\n F --> G[End]\n\n style A fill:#f9f,stroke:#333,stroke-width:2px\n style G fill:#9f9,stroke:#333,stroke-width:2px\n style C fill:#bbf,stroke:#333,stroke-width:2px\n```\n\n### CSV Data (Downloadable)\n\n```csv\nName,Department,Score,Status\nAlice Johnson,Engineering,95,Active\nBob Smith,Marketing,87,Active\nCharlie Brown,Sales,92,Active\nDiana Prince,HR,88,Active\nEve Adams,Engineering,91,Active\n```\n\n## \uD83D\uDCCA Tables\n\n### Basic Table\n\n| Feature | Status | Priority | Notes |\n|---------|--------|----------|-------|\n| Streaming | \u2705 Done | High | Core functionality |\n| Lists | \u2705 Done | High | With nesting support |\n| Code blocks | \u2705 Done | Medium | With syntax highlighting |\n| Tables | \u2705 Done | Low | Basic support |\n| Images | \u2705 Done | Low | With loading animation |\n\n### Complex Table with Formatting\n\n| Language | **Typing** | *Performance* | `hello()` | Rating |\n|----------|------------|---------------|-------------|--------|\n| TypeScript | Static | \u26A1 Fast | `console.log` | \u2B50\u2B50\u2B50\u2B50\u2B50 |\n| Python | Dynamic | \uD83D\uDC22 Moderate | `print()` | \u2B50\u2B50\u2B50\u2B50 |\n| Rust | Static | \uD83D\uDE80 Very Fast | `println!` | \u2B50\u2B50\u2B50\u2B50\u2B50 |\n| Ruby | Dynamic | \uD83D\uDC0C Slow | `puts` | \u2B50\u2B50\u2B50 |\n\n## \uD83C\uDFA8 Blockquotes\n\n> This is a simple blockquote with a single paragraph.\n\n> ### Blockquote with Heading\n>\n> This blockquote contains multiple elements:\n> - A list item\n> - Another item with **bold text**\n>\n> And even a code block:\n> ```js\n> const quote = \"Nested code in quote\";\n> ```\n\n> > Nested blockquotes are also supported\n> > > And can go multiple levels deep\n> > > > Even deeper if needed\n\n## \uD83D\uDDBC\uFE0F Images\n\n### Single Image\n\n![Sample Image](https://via.placeholder.com/600x300/4A90E2/FFFFFF?text=Streaming+Markdown)\n\n### Multiple Images\n\n![Small Image 1](https://via.placeholder.com/200x150/E94B3C/FFFFFF?text=Image+1)\n![Small Image 2](https://via.placeholder.com/200x150/6DBD28/FFFFFF?text=Image+2)\n![Small Image 3](https://via.placeholder.com/200x150/F39C12/FFFFFF?text=Image+3)\n\n## \uD83D\uDD24 Special Characters & Emojis\n\nSpecial characters: & < > \" ' \u00A9 \u00AE \u2122 \u20AC \u00A3 \u00A5 \u00B0 \u00B1 \u00D7 \u00F7 \u2264 \u2265 \u2260\n\nMath symbols: \u2211 \u220F \u222B \u221A \u221E \u03B1 \u03B2 \u03B3 \u03B4 \u03B5 \u03B8 \u03BB \u03BC \u03C0 \u03C3 \u03C6 \u03C9\n\nEmojis: \uD83D\uDE00 \uD83C\uDF89 \uD83D\uDE80 \uD83D\uDCBB \uD83D\uDCF1 \uD83C\uDF1F \u26A1 \uD83D\uDD25 \uD83D\uDCA1 \uD83C\uDFA8 \uD83C\uDFC6 \u2705 \u274C \u26A0\uFE0F \uD83D\uDCDD\n\n## \u2796 Horizontal Rules\n\nAbove this line\n\n---\n\nBetween these lines\n\n***\n\nAnother separator\n\n___\n\nBelow this line\n\n## \uD83D\uDD04 Escaping & Special Cases\n\nEscaping special characters: \\*not italic\\*, \\**not bold\\**, \\[not a link\\](url)\n\nHTML entities: &lt;tag&gt; &amp; &quot;quotes&quot; &apos;apostrophe&apos;\n\nPreserving spacing: Multiple spaces between words\n\n## \uD83C\uDFAF Advanced Combinations\n\n### List with Everything\n\n1. **First item** with [a link](https://example.com) and `code`\n - Nested with *italic* and ~~strikethrough~~\n - Another with emoji \uD83C\uDF89 and **bold**\n 1. Deep ordered with `code block`:\n ```js\n const nested = true;\n ```\n 2. And an image:\n ![Tiny](https://via.placeholder.com/100x50)\n - Back to unordered\n2. Second main item with a table:\n\n | Col1 | Col2 |\n |------|------|\n | A | B |\n\n3. Third item with blockquote:\n > Quoted text in a list\n\n## \uD83D\uDCDA Long Prose Section\n\nLorem ipsum dolor sit amet, consectetur adipiscing elit. **Sed do eiusmod** tempor incididunt ut labore et dolore magna aliqua. *Ut enim ad minim veniam*, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.\n\nDuis aute irure dolor in ***reprehenderit in voluptate*** velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. This demonstrates how longer paragraphs stream in naturally, maintaining readability while the content appears progressively.\n\n### Technical Documentation Style\n\nThe `StreamingMarkdown` component accepts the following props:\n\n- `content` (string, required): The markdown content to render\n- `animationName` (string, optional): CSS animation name for streaming effect\n- `animationDuration` (string, optional): Duration of the fade-in animation\n- `animationTimingFunction` (string, optional): CSS timing function\n- `codeStyle` (object, optional): Syntax highlighting theme\n\n## \uD83C\uDFAC Conclusion\n\nThis comprehensive demo showcases **all supported markdown features** in our streaming renderer:\n\n1. \u2705 Text formatting and emphasis\n2. \u2705 Multiple list types with deep nesting\n3. \u2705 Code blocks with syntax highlighting\n4. \u2705 Tables with complex content\n5. \u2705 Blockquotes with nesting\n6. \u2705 Images with loading animations\n7. \u2705 Links and references\n8. \u2705 Special characters and emojis\n9. \u2705 Horizontal rules\n10. \u2705 Mixed and nested content\n\nThe streaming animation ensures a smooth, progressive reveal of content while maintaining full markdown compatibility.\n\n---\n\n*Thank you for exploring our streaming markdown renderer!* \uD83C\uDF89";
236
- var mockReferences = {
237
- r1: {
238
- title: "Streaming Markdown Performance Study",
239
- href: "https://example.com/study1",
240
- authors: ["John Doe", "Jane Smith"],
241
- year: 2024,
242
- },
243
- r2: {
244
- title: "React Patterns for Real-time UIs",
245
- href: "https://example.com/study2",
246
- authors: ["Alice Johnson"],
247
- year: 2023,
248
- },
249
- r3: {
250
- title: "User Experience in AI Interfaces",
251
- href: "https://example.com/study3",
252
- authors: ["Bob Wilson", "Carol White"],
253
- year: 2024,
254
- },
255
- };
256
- export var EnhancedFeaturesDemo = {
257
- parameters: {
258
- docs: {
259
- description: {
260
- story: "Demonstrates new features: math rendering, citations, mentions, task lists, and custom directives.",
261
- },
262
- },
263
- },
264
- render: function (args) {
265
- var _a = __read(React.useState(""), 2), content = _a[0], setContent = _a[1];
266
- var _b = __read(React.useState(0), 2), restart = _b[0], setRestart = _b[1];
267
- var _c = args, _d = _c.streamingSpeedMs, streamingSpeedMs = _d === void 0 ? 30 : _d, _e = _c.chunkMin, chunkMin = _e === void 0 ? 10 : _e, _f = _c.chunkMax, chunkMax = _f === void 0 ? 50 : _f, _g = _c.seed, seed = _g === void 0 ? 42 : _g;
268
- React.useEffect(function () {
269
- var full = ADVANCED_MD.trim();
270
- setContent("");
271
- var i = 0;
272
- var rand = makeRng(Number(seed) || 42);
273
- var min = Math.max(1, Number(chunkMin) || 1);
274
- var max = Math.max(min, Number(chunkMax) || min);
275
- var step = Math.max(10, Number(streamingSpeedMs) || 30);
276
- var id = setInterval(function () {
277
- if (i >= full.length) {
278
- clearInterval(id);
279
- return;
280
- }
281
- var r = rand();
282
- var size = Math.floor(min + r * (max - min));
283
- var next = full.slice(i, i + size);
284
- i += size;
285
- setContent(function (c) { return c + next; });
286
- }, step);
287
- return function () { return clearInterval(id); };
288
- }, [streamingSpeedMs, chunkMin, chunkMax, seed, restart]);
289
- var handleMentionClick = React.useCallback(function (agentSId) {
290
- console.log("Mention clicked:", agentSId);
291
- alert("Clicked mention: ".concat(agentSId));
292
- }, []);
293
- var citationsContextValue = React.useMemo(function () { return ({
294
- references: mockReferences,
295
- updateActiveReferences: function (doc, index) {
296
- console.log("Citation active:", doc.title, index);
297
- },
298
- }); }, []);
299
- var additionalComponents = React.useMemo(function () { return ({
300
- sup: CiteBlock,
301
- mention: function (props) { return (React.createElement(MentionBlock, { agentName: props.agentName, agentSId: props.agentSId, onClick: handleMentionClick })); },
302
- }); }, [handleMentionClick]);
303
- var additionalPlugins = React.useMemo(function () { return [getCiteDirective(), getMentionDirective()]; }, []);
304
- return (React.createElement("div", { style: { display: "grid", gap: 12 } },
305
- React.createElement("div", null,
306
- React.createElement("button", { type: "button", onClick: function () { return setRestart(function (r) { return r + 1; }); }, style: {
307
- padding: "6px 10px",
308
- borderRadius: 6,
309
- border: "1px solid var(--sb-border, #ddd)",
310
- background: "var(--sb-bg, #f7f7f7)",
311
- cursor: "pointer",
312
- } }, "Restart Streaming")),
313
- React.createElement(CitationsContext.Provider, { value: citationsContextValue },
314
- React.createElement(StreamingMarkdown, __assign({ key: restart }, args, { content: content, isStreaming: true, additionalMarkdownComponents: additionalComponents, additionalMarkdownPlugins: additionalPlugins })))));
315
- },
316
- args: {
317
- streamingSpeedMs: 30,
318
- chunkMin: 10,
319
- chunkMax: 50,
320
- seed: 42,
321
- },
322
- argTypes: {
323
- streamingSpeedMs: {
324
- control: { type: "range", min: 10, max: 500, step: 10 },
325
- description: "Speed of streaming (ms between chunks)",
326
- },
327
- chunkMin: {
328
- control: { type: "range", min: 1, max: 50, step: 1 },
329
- description: "Minimum chunk size",
330
- },
331
- chunkMax: {
332
- control: { type: "range", min: 10, max: 200, step: 5 },
333
- description: "Maximum chunk size",
334
- },
335
- seed: {
336
- control: { type: "number" },
337
- description: "Random seed",
338
- },
339
- isStreaming: {
340
- control: "boolean",
341
- description: "Enable streaming animations",
342
- },
343
- },
344
- };
345
- export var ComprehensiveDemo = {
346
- parameters: {
347
- docs: {
348
- description: {
349
- story: "Complete demonstration of all supported markdown features with streaming animation. Includes text formatting, lists (nested, ordered, unordered), code blocks with syntax highlighting, tables, blockquotes, images, links, special characters, emojis, and more.",
350
- },
351
- },
352
- },
353
- render: function (args) {
354
- var _a = __read(React.useState(""), 2), content = _a[0], setContent = _a[1];
355
- var _b = __read(React.useState(0), 2), restart = _b[0], setRestart = _b[1];
356
- var _c = args, _d = _c.streamingSpeedMs, streamingSpeedMs = _d === void 0 ? 50 : _d, _e = _c.chunkMin, chunkMin = _e === void 0 ? 15 : _e, _f = _c.chunkMax, chunkMax = _f === void 0 ? 80 : _f, _g = _c.seed, seed = _g === void 0 ? 42 : _g;
357
- React.useEffect(function () {
358
- var full = LONG_MD.trim();
359
- setContent("");
360
- var i = 0;
361
- var rand = makeRng(Number(seed) || 42);
362
- var min = Math.max(1, Number(chunkMin) || 1);
363
- var max = Math.max(min, Number(chunkMax) || min);
364
- var step = Math.max(10, Number(streamingSpeedMs) || 120);
365
- var id = setInterval(function () {
366
- if (i >= full.length) {
367
- clearInterval(id);
368
- return;
369
- }
370
- // Pick a variable chunk size between [min, max]
371
- var r = rand();
372
- var size = Math.floor(min + r * (max - min));
373
- var next = full.slice(i, i + size);
374
- i += size;
375
- setContent(function (c) { return c + next; });
376
- }, step);
377
- return function () { return clearInterval(id); };
378
- }, [streamingSpeedMs, chunkMin, chunkMax, seed, restart]);
379
- return (React.createElement("div", { style: { display: "grid", gap: 12 } },
380
- React.createElement("div", null,
381
- React.createElement("button", { type: "button", onClick: function () {
382
- setRestart(function (r) { return r + 1; });
383
- }, style: {
384
- padding: "6px 10px",
385
- borderRadius: 6,
386
- border: "1px solid var(--sb-border, #ddd)",
387
- background: "var(--sb-bg, #f7f7f7)",
388
- cursor: "pointer",
389
- } }, "Restart Streaming")),
390
- React.createElement(StreamingMarkdown, __assign({ key: restart }, args, { content: content }))));
391
- },
392
- args: {
393
- streamingSpeedMs: 50,
394
- chunkMin: 15,
395
- chunkMax: 80,
396
- seed: 42,
397
- },
398
- argTypes: {
399
- streamingSpeedMs: {
400
- control: { type: "range", min: 10, max: 500, step: 10 },
401
- description: "Speed of streaming (ms between chunks)",
402
- },
403
- chunkMin: {
404
- control: { type: "range", min: 1, max: 50, step: 1 },
405
- description: "Minimum chunk size",
406
- },
407
- chunkMax: {
408
- control: { type: "range", min: 10, max: 200, step: 5 },
409
- description: "Maximum chunk size",
410
- },
411
- seed: {
412
- control: { type: "number" },
413
- description: "Random seed",
414
- },
415
- },
416
- };
417
- export var StreamingVsProductionComparison = {
418
- parameters: {
419
- docs: {
420
- description: {
421
- story: "Side-by-side comparison of the new StreamingMarkdown component with the current production Markdown component, showing the same comprehensive content with streaming animation.",
422
- },
423
- },
424
- },
425
- render: function (args) {
426
- var _a = __read(React.useState(""), 2), content = _a[0], setContent = _a[1];
427
- var _b = __read(React.useState(0), 2), restart = _b[0], setRestart = _b[1];
428
- var _c = args, _d = _c.streamingSpeedMs, streamingSpeedMs = _d === void 0 ? 30 : _d, _e = _c.chunkMin, chunkMin = _e === void 0 ? 10 : _e, _f = _c.chunkMax, chunkMax = _f === void 0 ? 50 : _f, _g = _c.seed, seed = _g === void 0 ? 42 : _g;
429
- React.useEffect(function () {
430
- var full = LONG_MD.trim();
431
- setContent("");
432
- var i = 0;
433
- var rand = makeRng(Number(seed) || 42);
434
- var min = Math.max(1, Number(chunkMin) || 1);
435
- var max = Math.max(min, Number(chunkMax) || min);
436
- var step = Math.max(10, Number(streamingSpeedMs) || 120);
437
- var id = setInterval(function () {
438
- if (i >= full.length) {
439
- clearInterval(id);
440
- return;
441
- }
442
- // Pick a variable chunk size between [min, max]
443
- var r = rand();
444
- var size = Math.floor(min + r * (max - min));
445
- var next = full.slice(i, i + size);
446
- i += size;
447
- setContent(function (c) { return c + next; });
448
- }, step);
449
- return function () { return clearInterval(id); };
450
- }, [streamingSpeedMs, chunkMin, chunkMax, seed, restart]);
451
- var handleMentionClick = React.useCallback(function (agentSId) {
452
- console.log("Mention clicked:", agentSId);
453
- alert("Clicked mention: ".concat(agentSId));
454
- }, []);
455
- var citationsContextValue = React.useMemo(function () { return ({
456
- references: mockReferences,
457
- updateActiveReferences: function (doc, index) {
458
- console.log("Citation active:", doc.title, index);
459
- },
460
- }); }, []);
461
- var additionalComponents = React.useMemo(function () { return ({
462
- sup: CiteBlock,
463
- mention: function (props) { return (React.createElement(MentionBlock, { agentName: props.agentName, agentSId: props.agentSId, onClick: handleMentionClick })); },
464
- }); }, [handleMentionClick]);
465
- var additionalPlugins = React.useMemo(function () { return [getCiteDirective(), getMentionDirective()]; }, []);
466
- // Determine if content is still streaming
467
- var isStillStreaming = content.length < LONG_MD.trim().length;
468
- return (React.createElement("div", { style: { display: "flex", flexDirection: "column", gap: 20 } },
469
- React.createElement("div", { style: { display: "flex", alignItems: "center", gap: 10 } },
470
- React.createElement("button", { type: "button", onClick: function () { return setRestart(function (r) { return r + 1; }); }, style: {
471
- padding: "8px 16px",
472
- borderRadius: 6,
473
- border: "1px solid var(--sb-border, #ddd)",
474
- background: "var(--sb-bg, #f7f7f7)",
475
- cursor: "pointer",
476
- fontWeight: 500,
477
- } }, "\uD83D\uDD04 Restart Streaming"),
478
- React.createElement("span", { style: {
479
- display: "inline-flex",
480
- alignItems: "center",
481
- gap: 6,
482
- padding: "4px 10px",
483
- borderRadius: 20,
484
- background: isStillStreaming ? "#fef3c7" : "#d1fae5",
485
- color: isStillStreaming ? "#92400e" : "#065f46",
486
- fontSize: 14,
487
- fontWeight: 500,
488
- } }, isStillStreaming ? (React.createElement(React.Fragment, null,
489
- React.createElement("span", { style: {
490
- display: "inline-block",
491
- width: 8,
492
- height: 8,
493
- borderRadius: "50%",
494
- background: "#f59e0b",
495
- animation: "pulse 1.5s infinite",
496
- } }),
497
- "Streaming...",
498
- " ",
499
- Math.round((content.length / LONG_MD.trim().length) * 100),
500
- "%")) : (React.createElement(React.Fragment, null,
501
- React.createElement("span", { style: {
502
- display: "inline-block",
503
- width: 8,
504
- height: 8,
505
- borderRadius: "50%",
506
- background: "#10b981",
507
- } }),
508
- "Complete")))),
509
- React.createElement("div", { style: {
510
- display: "grid",
511
- gridTemplateColumns: "1fr 1fr",
512
- gap: 20,
513
- minHeight: 600,
514
- } },
515
- React.createElement("div", { style: {
516
- border: "2px solid #3b82f6",
517
- borderRadius: 8,
518
- padding: 16,
519
- background: "var(--sb-bg-secondary, #fafafa)",
520
- position: "relative",
521
- overflow: "auto",
522
- } },
523
- React.createElement("div", { style: {
524
- position: "sticky",
525
- top: -16,
526
- background: "var(--sb-bg-secondary, #fafafa)",
527
- padding: "8px 0 12px",
528
- marginTop: -8,
529
- marginBottom: 16,
530
- borderBottom: "1px solid #e5e7eb",
531
- zIndex: 10,
532
- } },
533
- React.createElement("h3", { style: {
534
- margin: 0,
535
- color: "#3b82f6",
536
- fontSize: 16,
537
- fontWeight: 600,
538
- display: "flex",
539
- alignItems: "center",
540
- gap: 8,
541
- } },
542
- "\u2728 NEW: StreamingMarkdown",
543
- isStillStreaming && (React.createElement("span", { style: {
544
- fontSize: 12,
545
- background: "#3b82f6",
546
- color: "white",
547
- padding: "2px 8px",
548
- borderRadius: 12,
549
- } }, "with animation"))),
550
- React.createElement("p", { style: { margin: "4px 0 0", fontSize: 12, color: "#6b7280" } }, "Token-based streaming with character animation")),
551
- React.createElement(CitationsContext.Provider, { value: citationsContextValue },
552
- React.createElement(StreamingMarkdown, __assign({ key: "streaming-".concat(restart) }, args, { content: content, isStreaming: isStillStreaming, additionalMarkdownComponents: additionalComponents, additionalMarkdownPlugins: additionalPlugins })))),
553
- React.createElement("div", { style: {
554
- border: "2px solid #6b7280",
555
- borderRadius: 8,
556
- padding: 16,
557
- background: "var(--sb-bg-secondary, #fafafa)",
558
- position: "relative",
559
- overflow: "auto",
560
- } },
561
- React.createElement("div", { style: {
562
- position: "sticky",
563
- top: -16,
564
- background: "var(--sb-bg-secondary, #fafafa)",
565
- padding: "8px 0 12px",
566
- marginTop: -8,
567
- marginBottom: 16,
568
- borderBottom: "1px solid #e5e7eb",
569
- zIndex: 10,
570
- } },
571
- React.createElement("h3", { style: {
572
- margin: 0,
573
- color: "#6b7280",
574
- fontSize: 16,
575
- fontWeight: 600,
576
- display: "flex",
577
- alignItems: "center",
578
- gap: 8,
579
- } },
580
- "\uD83D\uDCCB CURRENT: Production Markdown",
581
- isStillStreaming && (React.createElement("span", { style: {
582
- fontSize: 12,
583
- background: "#6b7280",
584
- color: "white",
585
- padding: "2px 8px",
586
- borderRadius: 12,
587
- } },
588
- "isStreaming=",
589
- isStillStreaming))),
590
- React.createElement("p", { style: { margin: "4px 0 0", fontSize: 12, color: "#6b7280" } }, "Currently used in production for agent messages")),
591
- React.createElement(CitationsContext.Provider, { value: citationsContextValue },
592
- React.createElement(Markdown, { key: "production-".concat(restart), content: content, isStreaming: isStillStreaming, additionalMarkdownComponents: additionalComponents, additionalMarkdownPlugins: additionalPlugins })))),
593
- React.createElement("style", null, "\n @keyframes pulse {\n 0%, 100% { opacity: 1; }\n 50% { opacity: 0.5; }\n }\n ")));
594
- },
595
- args: {
596
- streamingSpeedMs: 30,
597
- chunkMin: 10,
598
- chunkMax: 50,
599
- seed: 42,
600
- },
601
- argTypes: {
602
- streamingSpeedMs: {
603
- control: { type: "range", min: 10, max: 500, step: 10 },
604
- description: "Speed of streaming (ms between chunks)",
605
- },
606
- chunkMin: {
607
- control: { type: "range", min: 1, max: 50, step: 1 },
608
- description: "Minimum chunk size",
609
- },
610
- chunkMax: {
611
- control: { type: "range", min: 10, max: 200, step: 5 },
612
- description: "Maximum chunk size",
613
- },
614
- seed: {
615
- control: { type: "number" },
616
- description: "Random seed for chunk sizes",
617
- },
618
- },
619
- };
620
- //# sourceMappingURL=StreamingMarkdown.stories.js.map