@a4ui/core 0.29.0 → 0.29.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1088 -1088
- package/package.json +1 -1
- package/src/index.ts +1 -1
- package/src/ui/StreamingText.tsx +7 -2
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
// import '@a4ui/core/styles.css'
|
|
9
9
|
// import { Button, Card, Modal } from '@a4ui/core'
|
|
10
10
|
|
|
11
|
-
export const A4UI_VERSION = '0.29.
|
|
11
|
+
export const A4UI_VERSION = '0.29.1'
|
|
12
12
|
|
|
13
13
|
// Helpers (src/lib) — generic, framework-level utilities.
|
|
14
14
|
export { cn } from './lib/cn'
|
package/src/ui/StreamingText.tsx
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// added tail at `speed` chars/sec (via a rAF loop) rather than snapping
|
|
3
3
|
// straight to the new length, with a blinking caret while more is expected.
|
|
4
4
|
// Built for AI answer UIs where `text` grows incrementally as tokens arrive.
|
|
5
|
-
import { createEffect, createSignal, onCleanup, type JSX } from 'solid-js'
|
|
5
|
+
import { createEffect, createSignal, onCleanup, untrack, type JSX } from 'solid-js'
|
|
6
6
|
|
|
7
7
|
import { cn } from '../lib/cn'
|
|
8
8
|
import { motionReduced } from '../lib/motion'
|
|
@@ -48,7 +48,12 @@ export function StreamingText(props: StreamingTextProps): JSX.Element {
|
|
|
48
48
|
createEffect(() => {
|
|
49
49
|
const text = props.text
|
|
50
50
|
const isAppend = text.startsWith(prevText)
|
|
51
|
-
|
|
51
|
+
// `untrack`: read the current revealed count WITHOUT making this effect
|
|
52
|
+
// depend on `revealed` — otherwise the rAF loop's own `setRevealed` would
|
|
53
|
+
// re-trigger this effect every frame, cancelling and restarting the loop
|
|
54
|
+
// (a stuttery, "janky" reveal). The effect should only re-run when the
|
|
55
|
+
// incoming `text`/`streaming`/`speed` change.
|
|
56
|
+
const from = isAppend ? untrack(revealed) : 0
|
|
52
57
|
prevText = text
|
|
53
58
|
|
|
54
59
|
stop()
|