@runtypelabs/persona 4.4.1 → 4.5.0
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/codegen.cjs +4 -4
- package/dist/codegen.js +2 -2
- package/dist/index.cjs +49 -49
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +58 -9
- package/dist/index.d.ts +58 -9
- package/dist/index.global.js +38 -38
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +49 -49
- package/dist/index.js.map +1 -1
- package/dist/launcher.global.js.map +1 -1
- package/dist/smart-dom-reader.d.cts +57 -8
- package/dist/smart-dom-reader.d.ts +57 -8
- package/dist/theme-editor-preview.cjs +40 -40
- package/dist/theme-editor-preview.d.cts +57 -8
- package/dist/theme-editor-preview.d.ts +57 -8
- package/dist/theme-editor-preview.js +40 -40
- package/dist/theme-editor.cjs +1 -1
- package/dist/theme-editor.d.cts +57 -8
- package/dist/theme-editor.d.ts +57 -8
- package/dist/theme-editor.js +1 -1
- package/dist/widget.css +1 -4041
- package/package.json +3 -2
- package/src/defaults.ts +9 -1
- package/src/index-core.ts +5 -0
- package/src/types.ts +58 -8
- package/src/ui.scroll-additive.test.ts +451 -0
- package/src/ui.scroll.test.ts +8 -2
- package/src/ui.ts +300 -40
|
@@ -2328,25 +2328,74 @@ type AgentWidgetArtifactsFeature = {
|
|
|
2328
2328
|
/**
|
|
2329
2329
|
* How the transcript scrolls while an assistant response streams in.
|
|
2330
2330
|
*
|
|
2331
|
-
* - `"
|
|
2332
|
-
* viewport
|
|
2333
|
-
* to
|
|
2334
|
-
*
|
|
2335
|
-
*
|
|
2336
|
-
*
|
|
2331
|
+
* - `"anchor-top"` (default): on send, scroll the user's message near the top
|
|
2332
|
+
* of the viewport and hold it there while the response streams in beneath it
|
|
2333
|
+
* (ChatGPT-style). When a turn has no user send to anchor to (a proactive
|
|
2334
|
+
* greeting, an injected assistant message, a resubmit, or first-load
|
|
2335
|
+
* streaming), it falls back to `"follow"` for that turn so content never
|
|
2336
|
+
* streams in off-screen.
|
|
2337
|
+
* - `"follow"`: keep the newest content pinned to the bottom of the viewport,
|
|
2338
|
+
* pausing when the user scrolls up and resuming when they return to the
|
|
2339
|
+
* bottom. This was the default before 4.x.
|
|
2337
2340
|
* - `"none"`: never auto-scroll; the scroll-to-bottom affordance is the only
|
|
2338
2341
|
* way back to the latest content.
|
|
2339
2342
|
*/
|
|
2340
2343
|
type AgentWidgetScrollMode = "follow" | "anchor-top" | "none";
|
|
2344
|
+
/**
|
|
2345
|
+
* Where the transcript lands when a *saved* conversation is reopened (restored
|
|
2346
|
+
* from the storage adapter / `initialMessages`), as opposed to a fresh send.
|
|
2347
|
+
*
|
|
2348
|
+
* - `"bottom"` (default): jump to the absolute end of the transcript, matching
|
|
2349
|
+
* the historical behavior.
|
|
2350
|
+
* - `"last-user-turn"`: pin the last user message near the top of the viewport
|
|
2351
|
+
* (the last point the reader was actively driving the conversation) so a long
|
|
2352
|
+
* restored thread opens at a readable place rather than at the very bottom.
|
|
2353
|
+
*/
|
|
2354
|
+
type AgentWidgetScrollRestorePosition = "bottom" | "last-user-turn";
|
|
2341
2355
|
type AgentWidgetScrollBehaviorFeature = {
|
|
2342
|
-
/** Scroll behavior during streamed responses. @default "
|
|
2356
|
+
/** Scroll behavior during streamed responses. @default "anchor-top" */
|
|
2343
2357
|
mode?: AgentWidgetScrollMode;
|
|
2344
2358
|
/**
|
|
2345
2359
|
* Gap (px) kept between the anchored user message and the top of the
|
|
2346
|
-
* viewport in `"anchor-top"` mode.
|
|
2360
|
+
* viewport in `"anchor-top"` mode. Also used as the gap for
|
|
2361
|
+
* `restorePosition: "last-user-turn"`.
|
|
2347
2362
|
* @default 16
|
|
2348
2363
|
*/
|
|
2349
2364
|
anchorTopOffset?: number;
|
|
2365
|
+
/**
|
|
2366
|
+
* Where to land when a saved conversation reopens. Additive and opt-in: the
|
|
2367
|
+
* default preserves the historical "jump to the bottom" behavior.
|
|
2368
|
+
* @default "bottom"
|
|
2369
|
+
*/
|
|
2370
|
+
restorePosition?: AgentWidgetScrollRestorePosition;
|
|
2371
|
+
/**
|
|
2372
|
+
* When true, interactions beyond text selection — keyboard navigation
|
|
2373
|
+
* (PageUp/PageDown/Home/End/arrows) inside the transcript and focusing a
|
|
2374
|
+
* link or other interactive element within it — also pause auto-follow in
|
|
2375
|
+
* `"follow"` mode. Treats "the reader is doing something here" as intent to
|
|
2376
|
+
* stay put, not just "the reader dragged a selection". Opt-in; default keeps
|
|
2377
|
+
* only the existing wheel/scroll/selection triggers.
|
|
2378
|
+
* @default false
|
|
2379
|
+
*/
|
|
2380
|
+
pauseOnInteraction?: boolean;
|
|
2381
|
+
/**
|
|
2382
|
+
* When true, the scroll-to-bottom affordance also surfaces new-content and
|
|
2383
|
+
* still-streaming activity while the reader is pinned away from the latest
|
|
2384
|
+
* content in `"anchor-top"` mode. Lets the reader know a response is arriving
|
|
2385
|
+
* offscreen below. Defaults on alongside the `"anchor-top"` default; set
|
|
2386
|
+
* `false` to keep the count + streaming hint silent while pinned.
|
|
2387
|
+
* @default true
|
|
2388
|
+
*/
|
|
2389
|
+
showActivityWhilePinned?: boolean;
|
|
2390
|
+
/**
|
|
2391
|
+
* When true, Persona maintains a visually-hidden `aria-live="polite"` region
|
|
2392
|
+
* that announces important transcript events — a response starting, a
|
|
2393
|
+
* response finishing, and "N new messages below" while the reader is scrolled
|
|
2394
|
+
* away — at a comfortable cadence (never token-by-token). Opt-in so existing
|
|
2395
|
+
* embeds don't suddenly gain screen-reader announcements.
|
|
2396
|
+
* @default false
|
|
2397
|
+
*/
|
|
2398
|
+
announce?: boolean;
|
|
2350
2399
|
};
|
|
2351
2400
|
type AgentWidgetScrollToBottomFeature = {
|
|
2352
2401
|
/**
|
|
@@ -2328,25 +2328,74 @@ type AgentWidgetArtifactsFeature = {
|
|
|
2328
2328
|
/**
|
|
2329
2329
|
* How the transcript scrolls while an assistant response streams in.
|
|
2330
2330
|
*
|
|
2331
|
-
* - `"
|
|
2332
|
-
* viewport
|
|
2333
|
-
* to
|
|
2334
|
-
*
|
|
2335
|
-
*
|
|
2336
|
-
*
|
|
2331
|
+
* - `"anchor-top"` (default): on send, scroll the user's message near the top
|
|
2332
|
+
* of the viewport and hold it there while the response streams in beneath it
|
|
2333
|
+
* (ChatGPT-style). When a turn has no user send to anchor to (a proactive
|
|
2334
|
+
* greeting, an injected assistant message, a resubmit, or first-load
|
|
2335
|
+
* streaming), it falls back to `"follow"` for that turn so content never
|
|
2336
|
+
* streams in off-screen.
|
|
2337
|
+
* - `"follow"`: keep the newest content pinned to the bottom of the viewport,
|
|
2338
|
+
* pausing when the user scrolls up and resuming when they return to the
|
|
2339
|
+
* bottom. This was the default before 4.x.
|
|
2337
2340
|
* - `"none"`: never auto-scroll; the scroll-to-bottom affordance is the only
|
|
2338
2341
|
* way back to the latest content.
|
|
2339
2342
|
*/
|
|
2340
2343
|
type AgentWidgetScrollMode = "follow" | "anchor-top" | "none";
|
|
2344
|
+
/**
|
|
2345
|
+
* Where the transcript lands when a *saved* conversation is reopened (restored
|
|
2346
|
+
* from the storage adapter / `initialMessages`), as opposed to a fresh send.
|
|
2347
|
+
*
|
|
2348
|
+
* - `"bottom"` (default): jump to the absolute end of the transcript, matching
|
|
2349
|
+
* the historical behavior.
|
|
2350
|
+
* - `"last-user-turn"`: pin the last user message near the top of the viewport
|
|
2351
|
+
* (the last point the reader was actively driving the conversation) so a long
|
|
2352
|
+
* restored thread opens at a readable place rather than at the very bottom.
|
|
2353
|
+
*/
|
|
2354
|
+
type AgentWidgetScrollRestorePosition = "bottom" | "last-user-turn";
|
|
2341
2355
|
type AgentWidgetScrollBehaviorFeature = {
|
|
2342
|
-
/** Scroll behavior during streamed responses. @default "
|
|
2356
|
+
/** Scroll behavior during streamed responses. @default "anchor-top" */
|
|
2343
2357
|
mode?: AgentWidgetScrollMode;
|
|
2344
2358
|
/**
|
|
2345
2359
|
* Gap (px) kept between the anchored user message and the top of the
|
|
2346
|
-
* viewport in `"anchor-top"` mode.
|
|
2360
|
+
* viewport in `"anchor-top"` mode. Also used as the gap for
|
|
2361
|
+
* `restorePosition: "last-user-turn"`.
|
|
2347
2362
|
* @default 16
|
|
2348
2363
|
*/
|
|
2349
2364
|
anchorTopOffset?: number;
|
|
2365
|
+
/**
|
|
2366
|
+
* Where to land when a saved conversation reopens. Additive and opt-in: the
|
|
2367
|
+
* default preserves the historical "jump to the bottom" behavior.
|
|
2368
|
+
* @default "bottom"
|
|
2369
|
+
*/
|
|
2370
|
+
restorePosition?: AgentWidgetScrollRestorePosition;
|
|
2371
|
+
/**
|
|
2372
|
+
* When true, interactions beyond text selection — keyboard navigation
|
|
2373
|
+
* (PageUp/PageDown/Home/End/arrows) inside the transcript and focusing a
|
|
2374
|
+
* link or other interactive element within it — also pause auto-follow in
|
|
2375
|
+
* `"follow"` mode. Treats "the reader is doing something here" as intent to
|
|
2376
|
+
* stay put, not just "the reader dragged a selection". Opt-in; default keeps
|
|
2377
|
+
* only the existing wheel/scroll/selection triggers.
|
|
2378
|
+
* @default false
|
|
2379
|
+
*/
|
|
2380
|
+
pauseOnInteraction?: boolean;
|
|
2381
|
+
/**
|
|
2382
|
+
* When true, the scroll-to-bottom affordance also surfaces new-content and
|
|
2383
|
+
* still-streaming activity while the reader is pinned away from the latest
|
|
2384
|
+
* content in `"anchor-top"` mode. Lets the reader know a response is arriving
|
|
2385
|
+
* offscreen below. Defaults on alongside the `"anchor-top"` default; set
|
|
2386
|
+
* `false` to keep the count + streaming hint silent while pinned.
|
|
2387
|
+
* @default true
|
|
2388
|
+
*/
|
|
2389
|
+
showActivityWhilePinned?: boolean;
|
|
2390
|
+
/**
|
|
2391
|
+
* When true, Persona maintains a visually-hidden `aria-live="polite"` region
|
|
2392
|
+
* that announces important transcript events — a response starting, a
|
|
2393
|
+
* response finishing, and "N new messages below" while the reader is scrolled
|
|
2394
|
+
* away — at a comfortable cadence (never token-by-token). Opt-in so existing
|
|
2395
|
+
* embeds don't suddenly gain screen-reader announcements.
|
|
2396
|
+
* @default false
|
|
2397
|
+
*/
|
|
2398
|
+
announce?: boolean;
|
|
2350
2399
|
};
|
|
2351
2400
|
type AgentWidgetScrollToBottomFeature = {
|
|
2352
2401
|
/**
|