@lobehub/ui 5.6.1 → 5.6.3

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 (163) hide show
  1. package/es/Accordion/Accordion.d.mts +2 -2
  2. package/es/Accordion/AccordionItem.d.mts +2 -2
  3. package/es/ActionIcon/ActionIcon.d.mts +2 -2
  4. package/es/Alert/Alert.d.mts +2 -2
  5. package/es/AutoComplete/Select.d.mts +2 -2
  6. package/es/Avatar/AvatarGroup/index.d.mts +2 -2
  7. package/es/Burger/Burger.d.mts +2 -2
  8. package/es/CodeDiff/CodeDiff.d.mts +2 -2
  9. package/es/CodeDiff/PatchDiff.d.mts +2 -2
  10. package/es/CodeEditor/CodeEditor.d.mts +2 -2
  11. package/es/Collapse/Collapse.d.mts +2 -2
  12. package/es/ConfigProvider/index.d.mts +2 -2
  13. package/es/CopyButton/CopyButton.d.mts +2 -2
  14. package/es/DatePicker/DatePicker.d.mts +2 -2
  15. package/es/DraggablePanel/components/DraggablePanelBody.d.mts +2 -2
  16. package/es/DraggablePanel/components/DraggablePanelContainer.d.mts +2 -2
  17. package/es/DraggablePanel/components/DraggablePanelFooter.d.mts +2 -2
  18. package/es/DraggablePanel/components/DraggablePanelHeader.d.mts +2 -2
  19. package/es/DraggableSideNav/DraggableSideNav.d.mts +2 -2
  20. package/es/Drawer/Drawer.d.mts +2 -2
  21. package/es/Dropdown/Dropdown.d.mts +2 -2
  22. package/es/EditableText/EditableText.d.mts +2 -2
  23. package/es/EditorSlashMenu/atoms.d.mts +13 -13
  24. package/es/EmojiPicker/EmojiPicker.d.mts +2 -2
  25. package/es/Flex/FlexBasic.d.mts +2 -2
  26. package/es/FontLoader/index.d.mts +2 -2
  27. package/es/Footer/Footer.d.mts +2 -2
  28. package/es/Form/components/FormGroup.d.mts +2 -2
  29. package/es/Form/components/FormItem.d.mts +2 -2
  30. package/es/Form/components/FormSubmitFooter.d.mts +2 -2
  31. package/es/FormModal/FormModal.d.mts +2 -2
  32. package/es/GuideCard/GuideCard.d.mts +2 -2
  33. package/es/Header/Header.d.mts +2 -2
  34. package/es/Highlighter/Highlighter.d.mts +2 -2
  35. package/es/Highlighter/SyntaxHighlighter/index.d.mts +2 -2
  36. package/es/Hotkey/Hotkey.d.mts +2 -2
  37. package/es/HotkeyInput/HotkeyInput.d.mts +2 -2
  38. package/es/Icon/Icon.d.mts +2 -2
  39. package/es/Icon/components/IconProvider.d.mts +3 -3
  40. package/es/Image/PreviewGroup.d.mts +2 -2
  41. package/es/ImageSelect/ImageSelect.d.mts +2 -2
  42. package/es/Input/Input.d.mts +2 -2
  43. package/es/Input/InputNumber.d.mts +2 -2
  44. package/es/Input/InputOPT.d.mts +2 -2
  45. package/es/Input/InputPassword.d.mts +2 -2
  46. package/es/Input/TextArea.d.mts +2 -2
  47. package/es/Layout/components/LayoutFooter.d.mts +2 -2
  48. package/es/Layout/components/LayoutHeader.d.mts +2 -2
  49. package/es/Layout/components/LayoutMain.d.mts +2 -2
  50. package/es/Layout/components/LayoutSidebar.d.mts +2 -2
  51. package/es/Layout/components/LayoutSidebarInner.d.mts +2 -2
  52. package/es/Layout/components/LayoutToc.d.mts +2 -2
  53. package/es/List/ListItem/index.d.mts +2 -2
  54. package/es/Markdown/Markdown.d.mts +2 -2
  55. package/es/Markdown/SyntaxMarkdown/StreamdownRender.mjs +173 -33
  56. package/es/Markdown/SyntaxMarkdown/StreamdownRender.mjs.map +1 -1
  57. package/es/Markdown/SyntaxMarkdown/streamAnimationMeta.mjs +18 -0
  58. package/es/Markdown/SyntaxMarkdown/streamAnimationMeta.mjs.map +1 -0
  59. package/es/Markdown/SyntaxMarkdown/useSmoothStreamContent.mjs +62 -10
  60. package/es/Markdown/SyntaxMarkdown/useSmoothStreamContent.mjs.map +1 -1
  61. package/es/Markdown/Typography.d.mts +2 -2
  62. package/es/Markdown/components/SearchResultCards/index.d.mts +2 -2
  63. package/es/Markdown/streamProfiler/StreamdownProfilerProvider.mjs +21 -0
  64. package/es/Markdown/streamProfiler/StreamdownProfilerProvider.mjs.map +1 -0
  65. package/es/MaskShadow/MaskShadow.d.mts +2 -2
  66. package/es/Menu/Menu.d.mts +2 -2
  67. package/es/Mermaid/Mermaid.d.mts +2 -2
  68. package/es/Mermaid/SyntaxMermaid/index.d.mts +2 -2
  69. package/es/Modal/Modal.d.mts +2 -2
  70. package/es/Modal/ModalProvider.d.mts +2 -2
  71. package/es/Modal/imperative.d.mts +2 -2
  72. package/es/MotionProvider/index.d.mts +2 -2
  73. package/es/SearchBar/SearchBar.d.mts +2 -2
  74. package/es/Segmented/Segmented.d.mts +2 -2
  75. package/es/Select/Select.d.mts +2 -2
  76. package/es/SideNav/SideNav.d.mts +2 -2
  77. package/es/SliderWithInput/SliderWithInput.d.mts +2 -2
  78. package/es/SortableList/components/DragHandle.d.mts +2 -2
  79. package/es/SortableList/components/SortableItem.d.mts +2 -2
  80. package/es/ThemeProvider/ThemeProvider.d.mts +2 -2
  81. package/es/Toc/Toc.d.mts +2 -2
  82. package/es/Video/index.d.mts +2 -2
  83. package/es/awesome/AuroraBackground/AuroraBackground.d.mts +2 -2
  84. package/es/awesome/BottomGradientButton/BottomGradientButton.d.mts +2 -2
  85. package/es/awesome/Features/Features.d.mts +2 -2
  86. package/es/awesome/Giscus/Giscus.d.mts +2 -2
  87. package/es/awesome/GradientButton/GradientButton.d.mts +2 -2
  88. package/es/awesome/GridBackground/GridBackground.d.mts +2 -2
  89. package/es/awesome/GridBackground/GridShowcase.d.mts +2 -2
  90. package/es/awesome/Hero/Hero.d.mts +2 -2
  91. package/es/awesome/Spline/Spine.d.mts +2 -2
  92. package/es/awesome/Spotlight/Spotlight.d.mts +2 -2
  93. package/es/awesome/SpotlightCard/SpotlightCard.d.mts +2 -2
  94. package/es/awesome/TypewriterEffect/TypewriterEffect.d.mts +2 -2
  95. package/es/base-ui/DropdownMenu/DropdownMenu.d.mts +2 -2
  96. package/es/base-ui/Modal/context.d.mts +2 -2
  97. package/es/base-ui/Modal/imperative.d.mts +2 -2
  98. package/es/base-ui/Popover/atoms.d.mts +2 -2
  99. package/es/base-ui/Popover/context.d.mts +2 -2
  100. package/es/base-ui/Select/Select.d.mts +2 -2
  101. package/es/base-ui/Select/atoms.d.mts +19 -19
  102. package/es/base-ui/Switch/Switch.d.mts +2 -2
  103. package/es/base-ui/Switch/atoms.d.mts +4 -4
  104. package/es/base-ui/Toast/Toast.mjs +32 -24
  105. package/es/base-ui/Toast/Toast.mjs.map +1 -1
  106. package/es/base-ui/Toast/imperative.d.mts +2 -2
  107. package/es/base-ui/Toast/style.mjs +5 -0
  108. package/es/base-ui/Toast/style.mjs.map +1 -1
  109. package/es/brand/LobeChat/index.d.mts +2 -2
  110. package/es/brand/LobeHub/index.d.mts +2 -2
  111. package/es/brand/LogoThree/LogoSpline.d.mts +2 -2
  112. package/es/brand/LogoThree/index.d.mts +2 -2
  113. package/es/chat/BackBottom/BackBottom.d.mts +2 -2
  114. package/es/chat/ChatInputArea/components/ChatInputAreaInner.d.mts +2 -2
  115. package/es/chat/ChatItem/ChatItem.d.mts +2 -2
  116. package/es/chat/ChatList/ChatList.d.mts +2 -2
  117. package/es/chat/EditableMessage/EditableMessage.d.mts +2 -2
  118. package/es/color/ColorScales/index.d.mts +2 -2
  119. package/es/color/CssVar/index.d.mts +2 -2
  120. package/es/i18n/context.d.mts +2 -2
  121. package/es/icons/lucideExtra/AndroidIcon.d.mts +2 -2
  122. package/es/icons/lucideExtra/AppleIcon.d.mts +2 -2
  123. package/es/icons/lucideExtra/AppstoreIcon.d.mts +2 -2
  124. package/es/icons/lucideExtra/BotPromptIcon.d.mts +3 -3
  125. package/es/icons/lucideExtra/BrainOffIcon.d.mts +2 -2
  126. package/es/icons/lucideExtra/ChromeIcon.d.mts +3 -3
  127. package/es/icons/lucideExtra/CodepenIcon.d.mts +3 -3
  128. package/es/icons/lucideExtra/CodesandboxIcon.d.mts +3 -3
  129. package/es/icons/lucideExtra/CreateBotIcon.d.mts +3 -3
  130. package/es/icons/lucideExtra/DiscordIcon.d.mts +3 -3
  131. package/es/icons/lucideExtra/FacebookIcon.d.mts +3 -3
  132. package/es/icons/lucideExtra/FigmaIcon.d.mts +3 -3
  133. package/es/icons/lucideExtra/FramerIcon.d.mts +3 -3
  134. package/es/icons/lucideExtra/GithubIcon.d.mts +3 -3
  135. package/es/icons/lucideExtra/GitlabIcon.d.mts +3 -3
  136. package/es/icons/lucideExtra/GlobeOffIcon.d.mts +3 -3
  137. package/es/icons/lucideExtra/GooglePlayIcon.d.mts +3 -3
  138. package/es/icons/lucideExtra/GroupBotIcon.d.mts +3 -3
  139. package/es/icons/lucideExtra/GroupBotSquareIcon.d.mts +3 -3
  140. package/es/icons/lucideExtra/InstagramIcon.d.mts +3 -3
  141. package/es/icons/lucideExtra/LeftClickIcon.d.mts +3 -3
  142. package/es/icons/lucideExtra/LeftDoubleClickIcon.d.mts +3 -3
  143. package/es/icons/lucideExtra/LinkedinIcon.d.mts +3 -3
  144. package/es/icons/lucideExtra/McpIcon.d.mts +3 -3
  145. package/es/icons/lucideExtra/NotionIcon.d.mts +2 -2
  146. package/es/icons/lucideExtra/PocketIcon.d.mts +3 -3
  147. package/es/icons/lucideExtra/ProviderIcon.d.mts +3 -3
  148. package/es/icons/lucideExtra/RailSymbolIcon.d.mts +3 -3
  149. package/es/icons/lucideExtra/RedditIcon.d.mts +3 -3
  150. package/es/icons/lucideExtra/RightClickIcon.d.mts +3 -3
  151. package/es/icons/lucideExtra/RightDoubleClickIcon.d.mts +3 -3
  152. package/es/icons/lucideExtra/ShapesUploadIcon.d.mts +2 -2
  153. package/es/icons/lucideExtra/SkillsIcon.d.mts +3 -3
  154. package/es/icons/lucideExtra/SlackIcon.d.mts +3 -3
  155. package/es/icons/lucideExtra/ThinkIcon.d.mts +3 -3
  156. package/es/icons/lucideExtra/TreeDownRightIcon.d.mts +3 -3
  157. package/es/icons/lucideExtra/TreeUpDownRightIcon.d.mts +3 -3
  158. package/es/mdx/Mdx/index.d.mts +2 -2
  159. package/es/mobile/ChatHeader/ChatHeaderTitle.d.mts +2 -2
  160. package/es/mobile/ChatInputArea/components/ChatSendButton.d.mts +2 -2
  161. package/es/mobile/TabBar/TabBar.d.mts +2 -2
  162. package/es/storybook/StoryBook/index.d.mts +2 -2
  163. package/package.json +1 -1
@@ -1,3 +1,4 @@
1
+ import { useStreamdownProfiler } from "../streamProfiler/StreamdownProfilerProvider.mjs";
1
2
  import { useCallback, useEffect, useRef, useState } from "react";
2
3
 
3
4
  //#region src/Markdown/SyntaxMarkdown/useSmoothStreamContent.ts
@@ -51,11 +52,15 @@ const PRESET_CONFIG = {
51
52
  const clamp = (value, min, max) => {
52
53
  return Math.min(max, Math.max(min, value));
53
54
  };
55
+ const getNow = () => {
56
+ return typeof performance === "undefined" ? Date.now() : performance.now();
57
+ };
54
58
  const countChars = (text) => {
55
59
  return [...text].length;
56
60
  };
57
61
  const useSmoothStreamContent = (content, { enabled = true, preset = "balanced" } = {}) => {
58
62
  const config = PRESET_CONFIG[preset];
63
+ const profiler = useStreamdownProfiler();
59
64
  const [displayedContent, setDisplayedContent] = useState(content);
60
65
  const displayedContentRef = useRef(content);
61
66
  const displayedCountRef = useRef(countChars(content));
@@ -69,6 +74,13 @@ const useSmoothStreamContent = (content, { enabled = true, preset = "balanced" }
69
74
  const arrivalCpsEmaRef = useRef(config.defaultCps);
70
75
  const rafRef = useRef(null);
71
76
  const lastFrameTsRef = useRef(null);
77
+ const wakeTimerRef = useRef(null);
78
+ const clearWakeTimer = useCallback(() => {
79
+ if (wakeTimerRef.current !== null) {
80
+ clearTimeout(wakeTimerRef.current);
81
+ wakeTimerRef.current = null;
82
+ }
83
+ }, []);
72
84
  const stopFrameLoop = useCallback(() => {
73
85
  if (rafRef.current !== null) {
74
86
  cancelAnimationFrame(rafRef.current);
@@ -76,10 +88,22 @@ const useSmoothStreamContent = (content, { enabled = true, preset = "balanced" }
76
88
  }
77
89
  lastFrameTsRef.current = null;
78
90
  }, []);
79
- const syncImmediate = useCallback((nextContent) => {
91
+ const stopScheduling = useCallback(() => {
80
92
  stopFrameLoop();
93
+ clearWakeTimer();
94
+ }, [clearWakeTimer, stopFrameLoop]);
95
+ const startFrameLoopRef = useRef(() => {});
96
+ const scheduleFrameWake = useCallback((delayMs) => {
97
+ clearWakeTimer();
98
+ wakeTimerRef.current = setTimeout(() => {
99
+ wakeTimerRef.current = null;
100
+ startFrameLoopRef.current();
101
+ }, Math.max(1, Math.ceil(delayMs)));
102
+ }, [clearWakeTimer]);
103
+ const syncImmediate = useCallback((nextContent) => {
104
+ stopScheduling();
81
105
  const chars = [...nextContent];
82
- const now = performance.now();
106
+ const now = getNow();
83
107
  targetContentRef.current = nextContent;
84
108
  targetCharsRef.current = chars;
85
109
  targetCountRef.current = chars.length;
@@ -91,16 +115,19 @@ const useSmoothStreamContent = (content, { enabled = true, preset = "balanced" }
91
115
  arrivalCpsEmaRef.current = config.defaultCps;
92
116
  lastInputTsRef.current = now;
93
117
  lastInputCountRef.current = chars.length;
94
- }, [config.defaultCps, stopFrameLoop]);
118
+ }, [config.defaultCps, stopScheduling]);
95
119
  const startFrameLoop = useCallback(() => {
120
+ clearWakeTimer();
96
121
  if (rafRef.current !== null) return;
97
122
  const tick = (ts) => {
123
+ const frameStart = getNow();
98
124
  if (lastFrameTsRef.current === null) {
99
125
  lastFrameTsRef.current = ts;
100
126
  rafRef.current = requestAnimationFrame(tick);
101
127
  return;
102
128
  }
103
- const dtSeconds = Math.max(.001, Math.min((ts - lastFrameTsRef.current) / 1e3, .05));
129
+ const frameIntervalMs = Math.max(0, ts - lastFrameTsRef.current);
130
+ const dtSeconds = Math.max(.001, Math.min(frameIntervalMs / 1e3, .05));
104
131
  lastFrameTsRef.current = ts;
105
132
  const targetCount = targetCountRef.current;
106
133
  const displayedCount = displayedCountRef.current;
@@ -109,7 +136,7 @@ const useSmoothStreamContent = (content, { enabled = true, preset = "balanced" }
109
136
  stopFrameLoop();
110
137
  return;
111
138
  }
112
- const idleMs = performance.now() - lastInputTsRef.current;
139
+ const idleMs = getNow() - lastInputTsRef.current;
113
140
  const inputActive = idleMs <= config.activeInputWindowMs;
114
141
  const settling = !inputActive && idleMs >= config.settleAfterMs;
115
142
  const baseCps = clamp(emaCpsRef.current, config.minCps, config.maxCps);
@@ -136,7 +163,16 @@ const useSmoothStreamContent = (content, { enabled = true, preset = "balanced" }
136
163
  if (inputActive) {
137
164
  const shortfall = desiredDisplayed - displayedCount;
138
165
  if (shortfall <= 0) {
139
- rafRef.current = requestAnimationFrame(tick);
166
+ stopFrameLoop();
167
+ scheduleFrameWake(config.activeInputWindowMs - idleMs);
168
+ profiler?.recordAnimationFrame({
169
+ backlog,
170
+ durationMs: getNow() - frameStart,
171
+ frameIntervalMs,
172
+ inputActive,
173
+ revealChars: 0,
174
+ settling
175
+ });
140
176
  return;
141
177
  }
142
178
  revealChars = Math.min(revealChars, shortfall, backlog);
@@ -153,10 +189,19 @@ const useSmoothStreamContent = (content, { enabled = true, preset = "balanced" }
153
189
  displayedCountRef.current = targetCount;
154
190
  setDisplayedContent(targetContentRef.current);
155
191
  }
192
+ profiler?.recordAnimationFrame({
193
+ backlog,
194
+ durationMs: getNow() - frameStart,
195
+ frameIntervalMs,
196
+ inputActive,
197
+ revealChars: segment ? revealChars : backlog,
198
+ settling
199
+ });
156
200
  rafRef.current = requestAnimationFrame(tick);
157
201
  };
158
202
  rafRef.current = requestAnimationFrame(tick);
159
203
  }, [
204
+ clearWakeTimer,
160
205
  config.activeInputWindowMs,
161
206
  config.flushCps,
162
207
  config.maxActiveCps,
@@ -167,8 +212,10 @@ const useSmoothStreamContent = (content, { enabled = true, preset = "balanced" }
167
212
  config.settleDrainMaxMs,
168
213
  config.settleDrainMinMs,
169
214
  config.targetBufferMs,
215
+ scheduleFrameWake,
170
216
  stopFrameLoop
171
217
  ]);
218
+ startFrameLoopRef.current = startFrameLoop;
172
219
  useEffect(() => {
173
220
  if (!enabled) {
174
221
  syncImmediate(content);
@@ -176,13 +223,17 @@ const useSmoothStreamContent = (content, { enabled = true, preset = "balanced" }
176
223
  }
177
224
  const prevTargetContent = targetContentRef.current;
178
225
  if (content === prevTargetContent) return;
179
- const now = performance.now();
226
+ const now = getNow();
180
227
  if (!content.startsWith(prevTargetContent)) {
181
228
  syncImmediate(content);
182
229
  return;
183
230
  }
184
231
  const appendedChars = [...content.slice(prevTargetContent.length)];
185
232
  const appendedCount = appendedChars.length;
233
+ profiler?.recordInputAppend({
234
+ appendedChars: appendedCount,
235
+ contentLength: countChars(content)
236
+ });
186
237
  if (appendedCount > config.largeAppendChars) {
187
238
  syncImmediate(content);
188
239
  return;
@@ -214,13 +265,14 @@ const useSmoothStreamContent = (content, { enabled = true, preset = "balanced" }
214
265
  content,
215
266
  enabled,
216
267
  startFrameLoop,
217
- syncImmediate
268
+ syncImmediate,
269
+ profiler
218
270
  ]);
219
271
  useEffect(() => {
220
272
  return () => {
221
- stopFrameLoop();
273
+ stopScheduling();
222
274
  };
223
- }, [stopFrameLoop]);
275
+ }, [stopScheduling]);
224
276
  return displayedContent;
225
277
  };
226
278
 
@@ -1 +1 @@
1
- {"version":3,"file":"useSmoothStreamContent.mjs","names":["PRESET_CONFIG: Record<StreamSmoothingPreset, StreamSmoothingPresetConfig>","currentCps: number"],"sources":["../../../src/Markdown/SyntaxMarkdown/useSmoothStreamContent.ts"],"sourcesContent":["import { useCallback, useEffect, useRef, useState } from 'react';\n\nimport { type StreamSmoothingPreset } from '@/Markdown/type';\n\ninterface StreamSmoothingPresetConfig {\n activeInputWindowMs: number;\n defaultCps: number;\n emaAlpha: number;\n flushCps: number;\n largeAppendChars: number;\n maxActiveCps: number;\n maxCps: number;\n maxFlushCps: number;\n minCps: number;\n settleAfterMs: number;\n settleDrainMaxMs: number;\n settleDrainMinMs: number;\n targetBufferMs: number;\n}\n\nconst PRESET_CONFIG: Record<StreamSmoothingPreset, StreamSmoothingPresetConfig> = {\n balanced: {\n activeInputWindowMs: 220,\n defaultCps: 38,\n emaAlpha: 0.2,\n flushCps: 120,\n largeAppendChars: 120,\n maxActiveCps: 132,\n maxCps: 72,\n maxFlushCps: 280,\n minCps: 18,\n settleAfterMs: 360,\n settleDrainMaxMs: 520,\n settleDrainMinMs: 180,\n targetBufferMs: 120,\n },\n realtime: {\n activeInputWindowMs: 140,\n defaultCps: 50,\n emaAlpha: 0.3,\n flushCps: 170,\n largeAppendChars: 180,\n maxActiveCps: 180,\n maxCps: 96,\n maxFlushCps: 360,\n minCps: 24,\n settleAfterMs: 260,\n settleDrainMaxMs: 360,\n settleDrainMinMs: 140,\n targetBufferMs: 40,\n },\n silky: {\n activeInputWindowMs: 320,\n defaultCps: 28,\n emaAlpha: 0.14,\n flushCps: 96,\n largeAppendChars: 100,\n maxActiveCps: 102,\n maxCps: 56,\n maxFlushCps: 220,\n minCps: 14,\n settleAfterMs: 460,\n settleDrainMaxMs: 680,\n settleDrainMinMs: 240,\n targetBufferMs: 170,\n },\n};\n\nconst clamp = (value: number, min: number, max: number): number => {\n return Math.min(max, Math.max(min, value));\n};\n\nexport const countChars = (text: string): number => {\n return [...text].length;\n};\n\ninterface UseSmoothStreamContentOptions {\n enabled?: boolean;\n preset?: StreamSmoothingPreset;\n}\n\nexport const useSmoothStreamContent = (\n content: string,\n { enabled = true, preset = 'balanced' }: UseSmoothStreamContentOptions = {},\n): string => {\n const config = PRESET_CONFIG[preset];\n const [displayedContent, setDisplayedContent] = useState(content);\n\n const displayedContentRef = useRef(content);\n const displayedCountRef = useRef(countChars(content));\n\n const targetContentRef = useRef(content);\n const targetCharsRef = useRef([...content]);\n const targetCountRef = useRef(targetCharsRef.current.length);\n\n const emaCpsRef = useRef(config.defaultCps);\n const lastInputTsRef = useRef(0);\n const lastInputCountRef = useRef(targetCountRef.current);\n const chunkSizeEmaRef = useRef(1);\n const arrivalCpsEmaRef = useRef(config.defaultCps);\n\n const rafRef = useRef<number | null>(null);\n const lastFrameTsRef = useRef<number | null>(null);\n\n const stopFrameLoop = useCallback(() => {\n if (rafRef.current !== null) {\n cancelAnimationFrame(rafRef.current);\n rafRef.current = null;\n }\n lastFrameTsRef.current = null;\n }, []);\n\n const syncImmediate = useCallback(\n (nextContent: string) => {\n stopFrameLoop();\n\n const chars = [...nextContent];\n const now = performance.now();\n\n targetContentRef.current = nextContent;\n targetCharsRef.current = chars;\n targetCountRef.current = chars.length;\n\n displayedContentRef.current = nextContent;\n displayedCountRef.current = chars.length;\n setDisplayedContent(nextContent);\n\n emaCpsRef.current = config.defaultCps;\n chunkSizeEmaRef.current = 1;\n arrivalCpsEmaRef.current = config.defaultCps;\n lastInputTsRef.current = now;\n lastInputCountRef.current = chars.length;\n },\n [config.defaultCps, stopFrameLoop],\n );\n\n const startFrameLoop = useCallback(() => {\n if (rafRef.current !== null) return;\n\n const tick = (ts: number) => {\n if (lastFrameTsRef.current === null) {\n lastFrameTsRef.current = ts;\n rafRef.current = requestAnimationFrame(tick);\n return;\n }\n\n const dtSeconds = Math.max(0.001, Math.min((ts - lastFrameTsRef.current) / 1000, 0.05));\n lastFrameTsRef.current = ts;\n\n const targetCount = targetCountRef.current;\n const displayedCount = displayedCountRef.current;\n const backlog = targetCount - displayedCount;\n\n if (backlog <= 0) {\n stopFrameLoop();\n return;\n }\n\n const now = performance.now();\n const idleMs = now - lastInputTsRef.current;\n const inputActive = idleMs <= config.activeInputWindowMs;\n const settling = !inputActive && idleMs >= config.settleAfterMs;\n\n const baseCps = clamp(emaCpsRef.current, config.minCps, config.maxCps);\n const baseLagChars = Math.max(1, Math.round((baseCps * config.targetBufferMs) / 1000));\n const lagUpperBound = Math.max(baseLagChars + 2, baseLagChars * 3);\n const targetLagChars = inputActive\n ? Math.round(\n clamp(baseLagChars + chunkSizeEmaRef.current * 0.35, baseLagChars, lagUpperBound),\n )\n : 0;\n const desiredDisplayed = Math.max(0, targetCount - targetLagChars);\n\n let currentCps: number;\n if (inputActive) {\n const backlogPressure = targetLagChars > 0 ? backlog / targetLagChars : 1;\n const chunkPressure = targetLagChars > 0 ? chunkSizeEmaRef.current / targetLagChars : 1;\n const arrivalPressure = arrivalCpsEmaRef.current / Math.max(baseCps, 1);\n const combinedPressure = clamp(\n backlogPressure * 0.6 + chunkPressure * 0.25 + arrivalPressure * 0.15,\n 1,\n 4.5,\n );\n const activeCap = clamp(\n config.maxActiveCps + chunkSizeEmaRef.current * 6,\n config.maxActiveCps,\n config.maxFlushCps,\n );\n currentCps = clamp(baseCps * combinedPressure, config.minCps, activeCap);\n } else if (settling) {\n // If upstream likely ended, cap the remaining tail duration so\n // we do not keep replaying old backlog for seconds.\n const drainTargetMs = clamp(backlog * 8, config.settleDrainMinMs, config.settleDrainMaxMs);\n const settleCps = (backlog * 1000) / drainTargetMs;\n currentCps = clamp(settleCps, config.flushCps, config.maxFlushCps);\n } else {\n const idleFlushCps = Math.max(\n config.flushCps,\n baseCps * 1.8,\n arrivalCpsEmaRef.current * 0.8,\n );\n currentCps = clamp(idleFlushCps, config.flushCps, config.maxFlushCps);\n }\n\n const urgentBacklog = inputActive && targetLagChars > 0 && backlog > targetLagChars * 2.2;\n const burstyInput = inputActive && chunkSizeEmaRef.current >= targetLagChars * 0.9;\n const minRevealChars = inputActive ? (urgentBacklog || burstyInput ? 2 : 1) : 2;\n let revealChars = Math.max(minRevealChars, Math.round(currentCps * dtSeconds));\n\n if (inputActive) {\n const shortfall = desiredDisplayed - displayedCount;\n if (shortfall <= 0) {\n rafRef.current = requestAnimationFrame(tick);\n return;\n }\n revealChars = Math.min(revealChars, shortfall, backlog);\n } else {\n revealChars = Math.min(revealChars, backlog);\n }\n\n const nextCount = displayedCount + revealChars;\n const segment = targetCharsRef.current.slice(displayedCount, nextCount).join('');\n\n if (segment) {\n const nextDisplayed = displayedContentRef.current + segment;\n displayedContentRef.current = nextDisplayed;\n displayedCountRef.current = nextCount;\n setDisplayedContent(nextDisplayed);\n } else {\n displayedContentRef.current = targetContentRef.current;\n displayedCountRef.current = targetCount;\n setDisplayedContent(targetContentRef.current);\n }\n\n rafRef.current = requestAnimationFrame(tick);\n };\n\n rafRef.current = requestAnimationFrame(tick);\n }, [\n config.activeInputWindowMs,\n config.flushCps,\n config.maxActiveCps,\n config.maxCps,\n config.maxFlushCps,\n config.minCps,\n config.settleAfterMs,\n config.settleDrainMaxMs,\n config.settleDrainMinMs,\n config.targetBufferMs,\n stopFrameLoop,\n ]);\n\n useEffect(() => {\n if (!enabled) {\n syncImmediate(content);\n return;\n }\n\n const prevTargetContent = targetContentRef.current;\n if (content === prevTargetContent) return;\n\n const now = performance.now();\n const appendOnly = content.startsWith(prevTargetContent);\n\n if (!appendOnly) {\n syncImmediate(content);\n return;\n }\n\n const appended = content.slice(prevTargetContent.length);\n const appendedChars = [...appended];\n const appendedCount = appendedChars.length;\n\n if (appendedCount > config.largeAppendChars) {\n syncImmediate(content);\n return;\n }\n\n targetContentRef.current = content;\n targetCharsRef.current = [...targetCharsRef.current, ...appendedChars];\n targetCountRef.current += appendedCount;\n\n const deltaChars = targetCountRef.current - lastInputCountRef.current;\n const deltaMs = Math.max(1, now - lastInputTsRef.current);\n\n if (deltaChars > 0) {\n const instantCps = (deltaChars * 1000) / deltaMs;\n const normalizedInstantCps = clamp(instantCps, config.minCps, config.maxFlushCps * 2);\n const chunkEmaAlpha = 0.35;\n chunkSizeEmaRef.current =\n chunkSizeEmaRef.current * (1 - chunkEmaAlpha) + appendedCount * chunkEmaAlpha;\n arrivalCpsEmaRef.current =\n arrivalCpsEmaRef.current * (1 - chunkEmaAlpha) + normalizedInstantCps * chunkEmaAlpha;\n\n const clampedCps = clamp(instantCps, config.minCps, config.maxActiveCps);\n emaCpsRef.current = emaCpsRef.current * (1 - config.emaAlpha) + clampedCps * config.emaAlpha;\n }\n\n lastInputTsRef.current = now;\n lastInputCountRef.current = targetCountRef.current;\n\n startFrameLoop();\n }, [\n config.emaAlpha,\n config.largeAppendChars,\n config.maxActiveCps,\n config.maxCps,\n config.maxFlushCps,\n config.minCps,\n content,\n enabled,\n startFrameLoop,\n syncImmediate,\n ]);\n\n useEffect(() =>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AAK,IAAI,GAAG,MAAM,eAAe,QAAQ;AAEzD,MAAI,aAAa,GAAG;GAClB,MAAM,aAAc,aAAa,MAAQ;GACzC,MAAM,uBAAuB,MAAM,YAAY,OAAO,QAAQ,OAAO,cAAc,EAAE;GACrF,MAAM,gBAAgB;AACtB,mBAAgB,UACd,gBAAgB,WAAW,IAAI,iBAAiB,gBAAgB;AAClE,oBAAiB,UACf,iBAAiB,WAAW,IAAI,iBAAiB,uBAAuB;GAE1E,MAAM,aAAa,MAAM,YAAY,OAAO,QAAQ,OAAO,aAAa;AACxE,aAAU,UAAU,UAAU,WAAW,IAAI,OAAO,YAAY,aAAa,OAAO;;AAGtF,iBAAe,UAAU;AACzB,oBAAkB,UAAU,eAAe;AAE3C,kBAAgB;IACf;EACD,OAAO;EACP,OAAO;EACP,OAAO;EACP,OAAO;EACP,OAAO;EACP,OAAO;EACP;EACA;EACA;EACA;EACD,CAAC;AAEF,iBAAgB;AACd,eAAa;AACX,kBAAe;;IAEhB,CAAC,cAAc,CAAC;AAEnB,QAAO"}
1
+ {"version":3,"file":"useSmoothStreamContent.mjs","names":["PRESET_CONFIG: Record<StreamSmoothingPreset, StreamSmoothingPresetConfig>","currentCps: number"],"sources":["../../../src/Markdown/SyntaxMarkdown/useSmoothStreamContent.ts"],"sourcesContent":["import { useCallback, useEffect, useRef, useState } from 'react';\n\nimport { useStreamdownProfiler } from '@/Markdown/streamProfiler';\nimport { type StreamSmoothingPreset } from '@/Markdown/type';\n\ninterface StreamSmoothingPresetConfig {\n activeInputWindowMs: number;\n defaultCps: number;\n emaAlpha: number;\n flushCps: number;\n largeAppendChars: number;\n maxActiveCps: number;\n maxCps: number;\n maxFlushCps: number;\n minCps: number;\n settleAfterMs: number;\n settleDrainMaxMs: number;\n settleDrainMinMs: number;\n targetBufferMs: number;\n}\n\nconst PRESET_CONFIG: Record<StreamSmoothingPreset, StreamSmoothingPresetConfig> = {\n balanced: {\n activeInputWindowMs: 220,\n defaultCps: 38,\n emaAlpha: 0.2,\n flushCps: 120,\n largeAppendChars: 120,\n maxActiveCps: 132,\n maxCps: 72,\n maxFlushCps: 280,\n minCps: 18,\n settleAfterMs: 360,\n settleDrainMaxMs: 520,\n settleDrainMinMs: 180,\n targetBufferMs: 120,\n },\n realtime: {\n activeInputWindowMs: 140,\n defaultCps: 50,\n emaAlpha: 0.3,\n flushCps: 170,\n largeAppendChars: 180,\n maxActiveCps: 180,\n maxCps: 96,\n maxFlushCps: 360,\n minCps: 24,\n settleAfterMs: 260,\n settleDrainMaxMs: 360,\n settleDrainMinMs: 140,\n targetBufferMs: 40,\n },\n silky: {\n activeInputWindowMs: 320,\n defaultCps: 28,\n emaAlpha: 0.14,\n flushCps: 96,\n largeAppendChars: 100,\n maxActiveCps: 102,\n maxCps: 56,\n maxFlushCps: 220,\n minCps: 14,\n settleAfterMs: 460,\n settleDrainMaxMs: 680,\n settleDrainMinMs: 240,\n targetBufferMs: 170,\n },\n};\n\nconst clamp = (value: number, min: number, max: number): number => {\n return Math.min(max, Math.max(min, value));\n};\n\nconst getNow = () => {\n return typeof performance === 'undefined' ? Date.now() : performance.now();\n};\n\nexport const countChars = (text: string): number => {\n return [...text].length;\n};\n\ninterface UseSmoothStreamContentOptions {\n enabled?: boolean;\n preset?: StreamSmoothingPreset;\n}\n\nexport const useSmoothStreamContent = (\n content: string,\n { enabled = true, preset = 'balanced' }: UseSmoothStreamContentOptions = {},\n): string => {\n const config = PRESET_CONFIG[preset];\n const profiler = useStreamdownProfiler();\n const [displayedContent, setDisplayedContent] = useState(content);\n\n const displayedContentRef = useRef(content);\n const displayedCountRef = useRef(countChars(content));\n\n const targetContentRef = useRef(content);\n const targetCharsRef = useRef([...content]);\n const targetCountRef = useRef(targetCharsRef.current.length);\n\n const emaCpsRef = useRef(config.defaultCps);\n const lastInputTsRef = useRef(0);\n const lastInputCountRef = useRef(targetCountRef.current);\n const chunkSizeEmaRef = useRef(1);\n const arrivalCpsEmaRef = useRef(config.defaultCps);\n\n const rafRef = useRef<number | null>(null);\n const lastFrameTsRef = useRef<number | null>(null);\n const wakeTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n const clearWakeTimer = useCallback(() => {\n if (wakeTimerRef.current !== null) {\n clearTimeout(wakeTimerRef.current);\n wakeTimerRef.current = null;\n }\n }, []);\n\n const stopFrameLoop = useCallback(() => {\n if (rafRef.current !== null) {\n cancelAnimationFrame(rafRef.current);\n rafRef.current = null;\n }\n lastFrameTsRef.current = null;\n }, []);\n\n const stopScheduling = useCallback(() => {\n stopFrameLoop();\n clearWakeTimer();\n }, [clearWakeTimer, stopFrameLoop]);\n\n const startFrameLoopRef = useRef<() => void>(() => {});\n\n const scheduleFrameWake = useCallback(\n (delayMs: number) => {\n clearWakeTimer();\n\n wakeTimerRef.current = setTimeout(\n () => {\n wakeTimerRef.current = null;\n startFrameLoopRef.current();\n },\n Math.max(1, Math.ceil(delayMs)),\n );\n },\n [clearWakeTimer],\n );\n\n const syncImmediate = useCallback(\n (nextContent: string) => {\n stopScheduling();\n\n const chars = [...nextContent];\n const now = getNow();\n\n targetContentRef.current = nextContent;\n targetCharsRef.current = chars;\n targetCountRef.current = chars.length;\n\n displayedContentRef.current = nextContent;\n displayedCountRef.current = chars.length;\n setDisplayedContent(nextContent);\n\n emaCpsRef.current = config.defaultCps;\n chunkSizeEmaRef.current = 1;\n arrivalCpsEmaRef.current = config.defaultCps;\n lastInputTsRef.current = now;\n lastInputCountRef.current = chars.length;\n },\n [config.defaultCps, stopScheduling],\n );\n\n const startFrameLoop = useCallback(() => {\n clearWakeTimer();\n if (rafRef.current !== null) return;\n\n const tick = (ts: number) => {\n const frameStart = getNow();\n\n if (lastFrameTsRef.current === null) {\n lastFrameTsRef.current = ts;\n rafRef.current = requestAnimationFrame(tick);\n return;\n }\n\n const frameIntervalMs = Math.max(0, ts - lastFrameTsRef.current);\n const dtSeconds = Math.max(0.001, Math.min(frameIntervalMs / 1000, 0.05));\n lastFrameTsRef.current = ts;\n\n const targetCount = targetCountRef.current;\n const displayedCount = displayedCountRef.current;\n const backlog = targetCount - displayedCount;\n\n if (backlog <= 0) {\n stopFrameLoop();\n return;\n }\n\n const now = getNow();\n const idleMs = now - lastInputTsRef.current;\n const inputActive = idleMs <= config.activeInputWindowMs;\n const settling = !inputActive && idleMs >= config.settleAfterMs;\n\n const baseCps = clamp(emaCpsRef.current, config.minCps, config.maxCps);\n const baseLagChars = Math.max(1, Math.round((baseCps * config.targetBufferMs) / 1000));\n const lagUpperBound = Math.max(baseLagChars + 2, baseLagChars * 3);\n const targetLagChars = inputActive\n ? Math.round(\n clamp(baseLagChars + chunkSizeEmaRef.current * 0.35, baseLagChars, lagUpperBound),\n )\n : 0;\n const desiredDisplayed = Math.max(0, targetCount - targetLagChars);\n\n let currentCps: number;\n if (inputActive) {\n const backlogPressure = targetLagChars > 0 ? backlog / targetLagChars : 1;\n const chunkPressure = targetLagChars > 0 ? chunkSizeEmaRef.current / targetLagChars : 1;\n const arrivalPressure = arrivalCpsEmaRef.current / Math.max(baseCps, 1);\n const combinedPressure = clamp(\n backlogPressure * 0.6 + chunkPressure * 0.25 + arrivalPressure * 0.15,\n 1,\n 4.5,\n );\n const activeCap = clamp(\n config.maxActiveCps + chunkSizeEmaRef.current * 6,\n config.maxActiveCps,\n config.maxFlushCps,\n );\n currentCps = clamp(baseCps * combinedPressure, config.minCps, activeCap);\n } else if (settling) {\n // If upstream likely ended, cap the remaining tail duration so\n // we do not keep replaying old backlog for seconds.\n const drainTargetMs = clamp(backlog * 8, config.settleDrainMinMs, config.settleDrainMaxMs);\n const settleCps = (backlog * 1000) / drainTargetMs;\n currentCps = clamp(settleCps, config.flushCps, config.maxFlushCps);\n } else {\n const idleFlushCps = Math.max(\n config.flushCps,\n baseCps * 1.8,\n arrivalCpsEmaRef.current * 0.8,\n );\n currentCps = clamp(idleFlushCps, config.flushCps, config.maxFlushCps);\n }\n\n const urgentBacklog = inputActive && targetLagChars > 0 && backlog > targetLagChars * 2.2;\n const burstyInput = inputActive && chunkSizeEmaRef.current >= targetLagChars * 0.9;\n const minRevealChars = inputActive ? (urgentBacklog || burstyInput ? 2 : 1) : 2;\n let revealChars = Math.max(minRevealChars, Math.round(currentCps * dtSeconds));\n\n if (inputActive) {\n const shortfall = desiredDisplayed - displayedCount;\n if (shortfall <= 0) {\n stopFrameLoop();\n scheduleFrameWake(config.activeInputWindowMs - idleMs);\n\n profiler?.recordAnimationFrame({\n backlog,\n durationMs: getNow() - frameStart,\n frameIntervalMs,\n inputActive,\n revealChars: 0,\n settling,\n });\n return;\n }\n revealChars = Math.min(revealChars, shortfall, backlog);\n } else {\n revealChars = Math.min(revealChars, backlog);\n }\n\n const nextCount = displayedCount + revealChars;\n const segment = targetCharsRef.current.slice(displayedCount, nextCount).join('');\n\n if (segment) {\n const nextDisplayed = displayedContentRef.current + segment;\n displayedContentRef.current = nextDisplayed;\n displayedCountRef.current = nextCount;\n setDisplayedContent(nextDisplayed);\n } else {\n displayedContentRef.current = targetContentRef.current;\n displayedCountRef.current = targetCount;\n setDisplayedContent(targetContentRef.current);\n }\n\n profiler?.recordAnimationFrame({\n backlog,\n durationMs: getNow() - frameStart,\n frameIntervalMs,\n inputActive,\n revealChars: segment ? revealChars : backlog,\n settling,\n });\n\n rafRef.current = requestAnimationFrame(tick);\n };\n\n rafRef.current = requestAnimationFrame(tick);\n }, [\n clearWakeTimer,\n config.activeInputWindowMs,\n config.flushCps,\n config.maxActiveCps,\n config.maxCps,\n config.maxFlushCps,\n config.minCps,\n config.settleAfterMs,\n config.settleDrainMaxMs,\n config.settleDrainMinMs,\n config.targetBufferMs,\n scheduleFrameWake,\n stopFrameLoop,\n ]);\n startFrameLoopRef.current = startFrameLoop;\n\n useEffect(() => {\n if (!enabled) {\n syncImmediate(content);\n return;\n }\n\n const prevTargetContent = targetContentRef.current;\n if (content === prevTargetContent) return;\n\n const now = getNow();\n const appendOnly = content.startsWith(prevTargetContent);\n\n if (!appendOnly) {\n syncImmediate(content);\n return;\n }\n\n const appended = content.slice(prevTargetContent.length);\n const appendedChars = [...appended];\n const appendedCount = appendedChars.length;\n\n profiler?.recordInputAppend({\n appendedChars: appendedCount,\n contentLength: countChars(content),\n });\n\n if (appendedCount > config.largeAppendChars) {\n syncImmediate(content);\n return;\n }\n\n targetContentRef.current = content;\n targetCharsRef.current = [...targetCharsRef.current, ...appendedChars];\n targetCountRef.current += appendedCount;\n\n const deltaChars = targetCountRef.current - lastInputCountRef.current;\n const deltaMs = Math.max(1, now - lastInputTsRef.current);\n\n if (deltaChars > 0) {\n const instantCps = (deltaChars * 1000) / deltaMs;\n const normalizedInstantCps = clamp(instantCps, config.minCps, config.maxFlushCps * 2);\n const chunkEmaAlpha = 0.35;\n chunkSizeEmaRef.current =\n chunkSizeEmaRef.current * (1 - chunkEmaAlpha) + appendedCount * chunkEmaAlpha;\n arrivalCpsEmaRef.current =\n arrivalCpsEmaRef.current * (1 - chunkEmaAlpha) + normalizedInstantCps * chunkEmaAlpha;\n\n const clampedCps = clamp(instantCps, config.minCps, config.maxActiveCps);\n emaCpsRef.current = emaCpsRef.current * (1 - config.emaAlpha) + clampedCps * config.emaAlpha;\n }\n\n lastInputTsRef.current = now;\n lastInputCountRef.current = targetCountRef.current;\n\n startFrameLoop();\n }, [\n config.emaAlpha,\n config.largeAppendChars,\n config.maxActiveCps,\n config.maxCps,\n config.maxFlushCps,\n config.minCps,\n content,\n enabled,\n startFrameLoop,\n syncImmediate,\n profiler,\n ]);\n\n useEffect(() => {\n return () => {\n stopScheduling();\n };\n }, [stopScheduling]);\n\n return displayedContent;\n};\n"],"mappings":";;;;AAqBA,MAAMA,gBAA4E;CAChF,UAAU;EACR,qBAAqB;EACrB,YAAY;EACZ,UAAU;EACV,UAAU;EACV,kBAAkB;EAClB,cAAc;EACd,QAAQ;EACR,aAAa;EACb,QAAQ;EACR,eAAe;EACf,kBAAkB;EAClB,kBAAkB;EAClB,gBAAgB;EACjB;CACD,UAAU;EACR,qBAAqB;EACrB,YAAY;EACZ,UAAU;E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AAa;AACX,mBAAgB;;IAEjB,CAAC,eAAe,CAAC;AAEpB,QAAO"}
@@ -1,8 +1,8 @@
1
1
  import { TypographyProps } from "./type.mjs";
2
- import * as react44 from "react";
2
+ import * as react25 from "react";
3
3
 
4
4
  //#region src/Markdown/Typography.d.ts
5
- declare const Typography: react44.NamedExoticComponent<TypographyProps>;
5
+ declare const Typography: react25.NamedExoticComponent<TypographyProps>;
6
6
  //#endregion
7
7
  export { Typography };
8
8
  //# sourceMappingURL=Typography.d.mts.map
@@ -1,6 +1,6 @@
1
1
  import { FlexboxProps } from "../../../Flex/type.mjs";
2
2
  import "../../../Flex/index.mjs";
3
- import * as react32 from "react";
3
+ import * as react62 from "react";
4
4
  import { Ref } from "react";
5
5
 
6
6
  //#region src/Markdown/components/SearchResultCards/index.d.ts
@@ -14,7 +14,7 @@ interface SearchResultCardsProps extends FlexboxProps {
14
14
  dataSource: string[] | SearchResultItem[];
15
15
  ref?: Ref<HTMLDivElement>;
16
16
  }
17
- declare const SearchResultCards: react32.NamedExoticComponent<SearchResultCardsProps>;
17
+ declare const SearchResultCards: react62.NamedExoticComponent<SearchResultCardsProps>;
18
18
  //#endregion
19
19
  export { SearchResultCards, SearchResultCardsProps };
20
20
  //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1,21 @@
1
+ 'use client';
2
+
3
+ import { createContext, memo, use } from "react";
4
+ import { jsx } from "react/jsx-runtime";
5
+
6
+ //#region src/Markdown/streamProfiler/StreamdownProfilerProvider.tsx
7
+ const StreamdownProfilerContext = createContext(null);
8
+ const StreamdownProfilerProvider = memo(({ children, profiler = null }) => {
9
+ return /* @__PURE__ */ jsx(StreamdownProfilerContext, {
10
+ value: profiler,
11
+ children
12
+ });
13
+ });
14
+ StreamdownProfilerProvider.displayName = "StreamdownProfilerProvider";
15
+ const useStreamdownProfiler = () => {
16
+ return use(StreamdownProfilerContext);
17
+ };
18
+
19
+ //#endregion
20
+ export { useStreamdownProfiler };
21
+ //# sourceMappingURL=StreamdownProfilerProvider.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StreamdownProfilerProvider.mjs","names":[],"sources":["../../../src/Markdown/streamProfiler/StreamdownProfilerProvider.tsx"],"sourcesContent":["'use client';\n\nimport { createContext, memo, type PropsWithChildren, use } from 'react';\n\nimport { type StreamdownProfiler } from './profiler';\n\nconst StreamdownProfilerContext = createContext<StreamdownProfiler | null>(null);\n\nexport interface StreamdownProfilerProviderProps {\n profiler?: StreamdownProfiler | null;\n}\n\nexport const StreamdownProfilerProvider = memo<PropsWithChildren<StreamdownProfilerProviderProps>>(\n ({ children, profiler = null }) => {\n return <StreamdownProfilerContext value={profiler}>{children}</StreamdownProfilerContext>;\n },\n);\n\nStreamdownProfilerProvider.displayName = 'StreamdownProfilerProvider';\n\nexport const useStreamdownProfiler = () => {\n return use(StreamdownProfilerContext);\n};\n"],"mappings":";;;;;;AAMA,MAAM,4BAA4B,cAAyC,KAAK;AAMhF,MAAa,6BAA6B,MACvC,EAAE,UAAU,WAAW,WAAW;AACjC,QAAO,oBAAC;EAA0B,OAAO;EAAW;GAAqC;EAE5F;AAED,2BAA2B,cAAc;AAEzC,MAAa,8BAA8B;AACzC,QAAO,IAAI,0BAA0B"}
@@ -1,8 +1,8 @@
1
1
  import { MaskShadowProps } from "./type.mjs";
2
- import * as react43 from "react";
2
+ import * as react4 from "react";
3
3
 
4
4
  //#region src/MaskShadow/MaskShadow.d.ts
5
- declare const MaskShadow: react43.NamedExoticComponent<MaskShadowProps>;
5
+ declare const MaskShadow: react4.NamedExoticComponent<MaskShadowProps>;
6
6
  //#endregion
7
7
  export { MaskShadow };
8
8
  //# sourceMappingURL=MaskShadow.d.mts.map
@@ -1,8 +1,8 @@
1
1
  import { MenuProps } from "./type.mjs";
2
- import * as react17 from "react";
2
+ import * as react75 from "react";
3
3
 
4
4
  //#region src/Menu/Menu.d.ts
5
- declare const Menu: react17.NamedExoticComponent<MenuProps<unknown>>;
5
+ declare const Menu: react75.NamedExoticComponent<MenuProps<unknown>>;
6
6
  //#endregion
7
7
  export { Menu };
8
8
  //# sourceMappingURL=Menu.d.mts.map
@@ -1,8 +1,8 @@
1
1
  import { MermaidProps } from "./type.mjs";
2
- import * as react21 from "react";
2
+ import * as react68 from "react";
3
3
 
4
4
  //#region src/Mermaid/Mermaid.d.ts
5
- declare const Mermaid: react21.NamedExoticComponent<MermaidProps>;
5
+ declare const Mermaid: react68.NamedExoticComponent<MermaidProps>;
6
6
  //#endregion
7
7
  export { Mermaid };
8
8
  //# sourceMappingURL=Mermaid.d.mts.map
@@ -1,8 +1,8 @@
1
1
  import { SyntaxMermaidProps } from "../type.mjs";
2
- import * as react22 from "react";
2
+ import * as react69 from "react";
3
3
 
4
4
  //#region src/Mermaid/SyntaxMermaid/index.d.ts
5
- declare const SyntaxMermaid: react22.NamedExoticComponent<SyntaxMermaidProps>;
5
+ declare const SyntaxMermaid: react69.NamedExoticComponent<SyntaxMermaidProps>;
6
6
  //#endregion
7
7
  export { SyntaxMermaid };
8
8
  //# sourceMappingURL=index.d.mts.map
@@ -1,8 +1,8 @@
1
1
  import { ModalProps } from "./type.mjs";
2
- import * as react18 from "react";
2
+ import * as react65 from "react";
3
3
 
4
4
  //#region src/Modal/Modal.d.ts
5
- declare const Modal: react18.NamedExoticComponent<ModalProps>;
5
+ declare const Modal: react65.NamedExoticComponent<ModalProps>;
6
6
  //#endregion
7
7
  export { Modal };
8
8
  //# sourceMappingURL=Modal.d.mts.map
@@ -1,9 +1,9 @@
1
1
  import { ModalContextValue } from "./type.mjs";
2
- import * as react19 from "react";
2
+ import * as react66 from "react";
3
3
  import { ReactNode } from "react";
4
4
 
5
5
  //#region src/Modal/ModalProvider.d.ts
6
- declare const ModalProvider: react19.NamedExoticComponent<{
6
+ declare const ModalProvider: react66.NamedExoticComponent<{
7
7
  children: ReactNode;
8
8
  value: ModalContextValue;
9
9
  }>;
@@ -1,5 +1,5 @@
1
1
  import { ImperativeModalProps, ModalInstance, RawModalComponent, RawModalComponentProps, RawModalInstance, RawModalKeyOptions, RawModalOptions } from "./type.mjs";
2
- import * as react_jsx_runtime0 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime12 from "react/jsx-runtime";
3
3
 
4
4
  //#region src/Modal/imperative.d.ts
5
5
  type ModalHostProps = {
@@ -7,7 +7,7 @@ type ModalHostProps = {
7
7
  };
8
8
  declare const ModalHost: ({
9
9
  root
10
- }: ModalHostProps) => react_jsx_runtime0.JSX.Element | null;
10
+ }: ModalHostProps) => react_jsx_runtime12.JSX.Element | null;
11
11
  declare const createModal: (props: ImperativeModalProps) => ModalInstance;
12
12
  declare function createRawModal<P extends RawModalComponentProps>(component: RawModalComponent<P>, props: Omit<P, 'open' | 'onClose'>, options?: RawModalOptions): RawModalInstance<P>;
13
13
  declare function createRawModal<P, OpenKey extends keyof P, CloseKey extends keyof P>(component: RawModalComponent<P>, props: Omit<P, OpenKey | CloseKey>, options: RawModalKeyOptions<OpenKey, CloseKey>): RawModalInstance<P, OpenKey, CloseKey>;
@@ -1,4 +1,4 @@
1
- import * as react33 from "react";
1
+ import * as react63 from "react";
2
2
  import { Context, ReactNode } from "react";
3
3
  import * as motion_react0 from "motion/react";
4
4
  import * as m from "motion/react-m";
@@ -6,7 +6,7 @@ import * as m from "motion/react-m";
6
6
  //#region src/MotionProvider/index.d.ts
7
7
  type MotionComponentType = typeof motion_react0.motion | typeof m;
8
8
  declare const MotionComponent: Context<MotionComponentType>;
9
- declare const MotionProvider: react33.NamedExoticComponent<{
9
+ declare const MotionProvider: react63.NamedExoticComponent<{
10
10
  children: ReactNode;
11
11
  motion: MotionComponentType;
12
12
  }>;
@@ -1,8 +1,8 @@
1
1
  import { SearchBarProps } from "./type.mjs";
2
- import * as react15 from "react";
2
+ import * as react57 from "react";
3
3
 
4
4
  //#region src/SearchBar/SearchBar.d.ts
5
- declare const SearchBar: react15.NamedExoticComponent<SearchBarProps>;
5
+ declare const SearchBar: react57.NamedExoticComponent<SearchBarProps>;
6
6
  //#endregion
7
7
  export { SearchBar };
8
8
  //# sourceMappingURL=SearchBar.d.mts.map
@@ -1,8 +1,8 @@
1
1
  import { SegmentedProps } from "./type.mjs";
2
- import * as react23 from "react";
2
+ import * as react56 from "react";
3
3
 
4
4
  //#region src/Segmented/Segmented.d.ts
5
- declare const Segmented: react23.NamedExoticComponent<SegmentedProps>;
5
+ declare const Segmented: react56.NamedExoticComponent<SegmentedProps>;
6
6
  //#endregion
7
7
  export { Segmented };
8
8
  //# sourceMappingURL=Segmented.d.mts.map
@@ -1,11 +1,11 @@
1
1
  import { SelectProps } from "./type.mjs";
2
- import * as react16 from "react";
2
+ import * as react53 from "react";
3
3
 
4
4
  //#region src/Select/Select.d.ts
5
5
  /**
6
6
  * @deprecated Use `Select` from `@lobehub/ui/base-ui` instead.
7
7
  */
8
- declare const Select: react16.NamedExoticComponent<SelectProps>;
8
+ declare const Select: react53.NamedExoticComponent<SelectProps>;
9
9
  //#endregion
10
10
  export { Select };
11
11
  //# sourceMappingURL=Select.d.mts.map
@@ -1,8 +1,8 @@
1
1
  import { SideNavProps } from "./type.mjs";
2
- import * as react14 from "react";
2
+ import * as react51 from "react";
3
3
 
4
4
  //#region src/SideNav/SideNav.d.ts
5
- declare const SideNav: react14.NamedExoticComponent<SideNavProps>;
5
+ declare const SideNav: react51.NamedExoticComponent<SideNavProps>;
6
6
  //#endregion
7
7
  export { SideNav };
8
8
  //# sourceMappingURL=SideNav.d.mts.map
@@ -1,8 +1,8 @@
1
1
  import { SliderWithInputProps } from "./type.mjs";
2
- import * as react13 from "react";
2
+ import * as react49 from "react";
3
3
 
4
4
  //#region src/SliderWithInput/SliderWithInput.d.ts
5
- declare const SliderWithInput: react13.NamedExoticComponent<SliderWithInputProps>;
5
+ declare const SliderWithInput: react49.NamedExoticComponent<SliderWithInputProps>;
6
6
  //#endregion
7
7
  export { SliderWithInput };
8
8
  //# sourceMappingURL=SliderWithInput.d.mts.map
@@ -1,9 +1,9 @@
1
1
  import { ActionIconProps } from "../../ActionIcon/type.mjs";
2
2
  import "../../ActionIcon/index.mjs";
3
- import * as react79 from "react";
3
+ import * as react152 from "react";
4
4
 
5
5
  //#region src/SortableList/components/DragHandle.d.ts
6
- declare const DragHandle: react79.NamedExoticComponent<ActionIconProps>;
6
+ declare const DragHandle: react152.NamedExoticComponent<ActionIconProps>;
7
7
  //#endregion
8
8
  export { DragHandle };
9
9
  //# sourceMappingURL=DragHandle.d.mts.map
@@ -1,6 +1,6 @@
1
1
  import { FlexboxProps } from "../../Flex/type.mjs";
2
2
  import "../../Flex/index.mjs";
3
- import * as react77 from "react";
3
+ import * as react150 from "react";
4
4
  import "@dnd-kit/core";
5
5
 
6
6
  //#region src/SortableList/components/SortableItem.d.ts
@@ -9,7 +9,7 @@ interface SortableItemProps extends Omit<FlexboxProps, 'id'> {
9
9
  id: string | number;
10
10
  variant?: 'borderless' | 'filled' | 'outlined';
11
11
  }
12
- declare const SortableItem: react77.NamedExoticComponent<SortableItemProps>;
12
+ declare const SortableItem: react150.NamedExoticComponent<SortableItemProps>;
13
13
  //#endregion
14
14
  export { SortableItem };
15
15
  //# sourceMappingURL=SortableItem.d.mts.map
@@ -1,8 +1,8 @@
1
1
  import { ThemeProviderProps } from "./type.mjs";
2
- import * as react12 from "react";
2
+ import * as react48 from "react";
3
3
 
4
4
  //#region src/ThemeProvider/ThemeProvider.d.ts
5
- declare const ThemeProvider: react12.NamedExoticComponent<ThemeProviderProps>;
5
+ declare const ThemeProvider: react48.NamedExoticComponent<ThemeProviderProps>;
6
6
  //#endregion
7
7
  export { ThemeProvider };
8
8
  //# sourceMappingURL=ThemeProvider.d.mts.map
package/es/Toc/Toc.d.mts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { TocProps } from "./type.mjs";
2
- import * as react10 from "react";
2
+ import * as react74 from "react";
3
3
 
4
4
  //#region src/Toc/Toc.d.ts
5
- declare const Toc: react10.NamedExoticComponent<TocProps>;
5
+ declare const Toc: react74.NamedExoticComponent<TocProps>;
6
6
  //#endregion
7
7
  export { Toc };
8
8
  //# sourceMappingURL=Toc.d.mts.map
@@ -1,7 +1,7 @@
1
1
  import { FlexboxProps } from "../Flex/type.mjs";
2
2
  import "../Flex/index.mjs";
3
3
  import { VideoProps as VideoProps$1 } from "../types/index.mjs";
4
- import * as react34 from "react";
4
+ import * as react64 from "react";
5
5
  import { CSSProperties, Ref } from "react";
6
6
 
7
7
  //#region src/Video/index.d.ts
@@ -39,7 +39,7 @@ interface VideoProps extends VideoProps$1, Pick<FlexboxProps, 'width' | 'height'
39
39
  };
40
40
  variant?: 'borderless' | 'filled' | 'outlined';
41
41
  }
42
- declare const Video: react34.NamedExoticComponent<VideoProps>;
42
+ declare const Video: react64.NamedExoticComponent<VideoProps>;
43
43
  //#endregion
44
44
  export { Video, VideoProps };
45
45
  //# sourceMappingURL=index.d.mts.map
@@ -1,8 +1,8 @@
1
1
  import { AuroraBackgroundProps } from "./type.mjs";
2
- import * as react187 from "react";
2
+ import * as react168 from "react";
3
3
 
4
4
  //#region src/awesome/AuroraBackground/AuroraBackground.d.ts
5
- declare const AuroraBackground: react187.NamedExoticComponent<AuroraBackgroundProps>;
5
+ declare const AuroraBackground: react168.NamedExoticComponent<AuroraBackgroundProps>;
6
6
  //#endregion
7
7
  export { AuroraBackground };
8
8
  //# sourceMappingURL=AuroraBackground.d.mts.map
@@ -1,9 +1,9 @@
1
1
  import { ButtonProps } from "../../Button/type.mjs";
2
2
  import "../../Button/index.mjs";
3
- import * as react188 from "react";
3
+ import * as react169 from "react";
4
4
 
5
5
  //#region src/awesome/BottomGradientButton/BottomGradientButton.d.ts
6
- declare const BottomGradientButton: react188.NamedExoticComponent<ButtonProps>;
6
+ declare const BottomGradientButton: react169.NamedExoticComponent<ButtonProps>;
7
7
  //#endregion
8
8
  export { BottomGradientButton };
9
9
  //# sourceMappingURL=BottomGradientButton.d.mts.map
@@ -1,8 +1,8 @@
1
1
  import { FeaturesProps } from "./type.mjs";
2
- import * as react186 from "react";
2
+ import * as react170 from "react";
3
3
 
4
4
  //#region src/awesome/Features/Features.d.ts
5
- declare const Features: react186.NamedExoticComponent<FeaturesProps>;
5
+ declare const Features: react170.NamedExoticComponent<FeaturesProps>;
6
6
  //#endregion
7
7
  export { Features };
8
8
  //# sourceMappingURL=Features.d.mts.map
@@ -1,8 +1,8 @@
1
1
  import { GiscusProps } from "./type.mjs";
2
- import * as react189 from "react";
2
+ import * as react171 from "react";
3
3
 
4
4
  //#region src/awesome/Giscus/Giscus.d.ts
5
- declare const Giscus: react189.NamedExoticComponent<GiscusProps>;
5
+ declare const Giscus: react171.NamedExoticComponent<GiscusProps>;
6
6
  //#endregion
7
7
  export { Giscus };
8
8
  //# sourceMappingURL=Giscus.d.mts.map
@@ -1,8 +1,8 @@
1
1
  import { GradientButtonProps } from "./type.mjs";
2
- import * as react193 from "react";
2
+ import * as react172 from "react";
3
3
 
4
4
  //#region src/awesome/GradientButton/GradientButton.d.ts
5
- declare const GradientButton: react193.NamedExoticComponent<GradientButtonProps>;
5
+ declare const GradientButton: react172.NamedExoticComponent<GradientButtonProps>;
6
6
  //#endregion
7
7
  export { GradientButton };
8
8
  //# sourceMappingURL=GradientButton.d.mts.map
@@ -1,8 +1,8 @@
1
1
  import { GridBackgroundProps } from "./type.mjs";
2
- import * as react194 from "react";
2
+ import * as react173 from "react";
3
3
 
4
4
  //#region src/awesome/GridBackground/GridBackground.d.ts
5
- declare const GridBackground: react194.NamedExoticComponent<GridBackgroundProps>;
5
+ declare const GridBackground: react173.NamedExoticComponent<GridBackgroundProps>;
6
6
  //#endregion
7
7
  export { GridBackground };
8
8
  //# sourceMappingURL=GridBackground.d.mts.map