@runtypelabs/persona 3.6.0 → 3.7.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/index.cjs +44 -44
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +30 -0
- package/dist/index.d.ts +30 -0
- package/dist/index.global.js +67 -67
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +44 -44
- package/dist/index.js.map +1 -1
- package/dist/theme-editor.cjs +514 -227
- package/dist/theme-editor.d.cts +32 -1
- package/dist/theme-editor.d.ts +32 -1
- package/dist/theme-editor.js +513 -227
- package/dist/theme-reference.cjs +1 -1
- package/dist/theme-reference.d.cts +19 -0
- package/dist/theme-reference.d.ts +19 -0
- package/dist/theme-reference.js +1 -1
- package/dist/widget.css +40 -0
- package/package.json +1 -1
- package/src/components/demo-carousel.ts +1 -1
- package/src/components/event-stream-view.test.ts +142 -0
- package/src/components/event-stream-view.ts +67 -28
- package/src/defaults.ts +15 -0
- package/src/scroll-to-bottom-defaults.test.ts +13 -0
- package/src/styles/widget.css +40 -0
- package/src/theme-editor/index.ts +1 -0
- package/src/theme-editor/role-mappings.ts +12 -0
- package/src/theme-editor/sections.test.ts +43 -0
- package/src/theme-editor/sections.ts +42 -0
- package/src/theme-reference.ts +8 -0
- package/src/types/theme.ts +10 -0
- package/src/types.ts +22 -0
- package/src/ui.scroll.test.ts +554 -0
- package/src/ui.ts +178 -83
- package/src/utils/auto-follow.test.ts +110 -0
- package/src/utils/auto-follow.ts +112 -0
- package/src/utils/theme.test.ts +34 -0
- package/src/utils/tokens.ts +49 -0
package/dist/theme-editor.js
CHANGED
|
@@ -362,6 +362,18 @@ var DEFAULT_COMPONENTS = {
|
|
|
362
362
|
border: "palette.colors.gray.200"
|
|
363
363
|
}
|
|
364
364
|
},
|
|
365
|
+
scrollToBottom: {
|
|
366
|
+
background: "components.button.primary.background",
|
|
367
|
+
foreground: "components.button.primary.foreground",
|
|
368
|
+
border: "semantic.colors.primary",
|
|
369
|
+
size: "40px",
|
|
370
|
+
borderRadius: "palette.radius.full",
|
|
371
|
+
shadow: "palette.shadows.sm",
|
|
372
|
+
padding: "0.5rem 0.875rem",
|
|
373
|
+
gap: "0.5rem",
|
|
374
|
+
fontSize: "0.875rem",
|
|
375
|
+
iconSize: "14px"
|
|
376
|
+
},
|
|
365
377
|
artifact: {
|
|
366
378
|
pane: {
|
|
367
379
|
background: "semantic.colors.container",
|
|
@@ -543,7 +555,7 @@ function createTheme(userConfig, options = {}) {
|
|
|
543
555
|
return theme;
|
|
544
556
|
}
|
|
545
557
|
function themeToCssVariables(theme) {
|
|
546
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, _Q, _R, _S, _T, _U, _V, _W, _X, _Y, _Z, __, _$, _aa, _ba, _ca, _da, _ea, _fa, _ga, _ha, _ia, _ja, _ka, _la, _ma, _na, _oa, _pa, _qa, _ra, _sa, _ta, _ua, _va, _wa, _xa, _ya, _za;
|
|
558
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, _Q, _R, _S, _T, _U, _V, _W, _X, _Y, _Z, __, _$, _aa, _ba, _ca, _da, _ea, _fa, _ga, _ha, _ia, _ja, _ka, _la, _ma, _na, _oa, _pa, _qa, _ra, _sa, _ta, _ua, _va, _wa, _xa, _ya, _za, _Aa, _Ba, _Ca, _Da, _Ea, _Fa, _Ga, _Ha, _Ia, _Ja, _Ka, _La, _Ma, _Na, _Oa, _Pa, _Qa;
|
|
547
559
|
const resolved = resolveTokens(theme);
|
|
548
560
|
const cssVars = {};
|
|
549
561
|
for (const [path, token] of Object.entries(resolved)) {
|
|
@@ -583,44 +595,55 @@ function themeToCssVariables(theme) {
|
|
|
583
595
|
cssVars["--persona-radius-md"] = (_B = cssVars["--persona-palette-radius-md"]) != null ? _B : "0.375rem";
|
|
584
596
|
cssVars["--persona-radius-lg"] = (_C = cssVars["--persona-palette-radius-lg"]) != null ? _C : "0.5rem";
|
|
585
597
|
cssVars["--persona-radius-xl"] = (_D = cssVars["--persona-palette-radius-xl"]) != null ? _D : "0.75rem";
|
|
586
|
-
cssVars["--persona-
|
|
587
|
-
cssVars["--persona-launcher-
|
|
588
|
-
cssVars["--persona-launcher-
|
|
589
|
-
cssVars["--persona-launcher-
|
|
590
|
-
cssVars["--persona-
|
|
591
|
-
cssVars["--persona-button-primary-
|
|
592
|
-
cssVars["--persona-button-
|
|
593
|
-
cssVars["--persona-
|
|
594
|
-
cssVars["--persona-panel-
|
|
595
|
-
cssVars["--persona-panel-
|
|
596
|
-
cssVars["--persona-
|
|
597
|
-
cssVars["--persona-
|
|
598
|
-
cssVars["--persona-message-
|
|
599
|
-
cssVars["--persona-
|
|
600
|
-
cssVars["--persona-header-
|
|
601
|
-
cssVars["--persona-header-
|
|
602
|
-
cssVars["--persona-header-icon-
|
|
603
|
-
cssVars["--persona-header-
|
|
604
|
-
cssVars["--persona-header-
|
|
605
|
-
cssVars["--persona-header-
|
|
606
|
-
|
|
598
|
+
cssVars["--persona-radius-full"] = (_E = cssVars["--persona-palette-radius-full"]) != null ? _E : "9999px";
|
|
599
|
+
cssVars["--persona-launcher-radius"] = (_G = (_F = cssVars["--persona-components-launcher-borderRadius"]) != null ? _F : cssVars["--persona-palette-radius-full"]) != null ? _G : "9999px";
|
|
600
|
+
cssVars["--persona-launcher-bg"] = (_H = cssVars["--persona-components-launcher-background"]) != null ? _H : cssVars["--persona-primary"];
|
|
601
|
+
cssVars["--persona-launcher-fg"] = (_I = cssVars["--persona-components-launcher-foreground"]) != null ? _I : cssVars["--persona-text-inverse"];
|
|
602
|
+
cssVars["--persona-launcher-border"] = (_J = cssVars["--persona-components-launcher-border"]) != null ? _J : cssVars["--persona-border"];
|
|
603
|
+
cssVars["--persona-button-primary-bg"] = (_K = cssVars["--persona-components-button-primary-background"]) != null ? _K : cssVars["--persona-primary"];
|
|
604
|
+
cssVars["--persona-button-primary-fg"] = (_L = cssVars["--persona-components-button-primary-foreground"]) != null ? _L : cssVars["--persona-text-inverse"];
|
|
605
|
+
cssVars["--persona-button-radius"] = (_N = (_M = cssVars["--persona-components-button-primary-borderRadius"]) != null ? _M : cssVars["--persona-palette-radius-full"]) != null ? _N : "9999px";
|
|
606
|
+
cssVars["--persona-panel-radius"] = (_P = (_O = cssVars["--persona-components-panel-borderRadius"]) != null ? _O : cssVars["--persona-radius-xl"]) != null ? _P : "0.75rem";
|
|
607
|
+
cssVars["--persona-panel-border"] = (_Q = cssVars["--persona-components-panel-border"]) != null ? _Q : `1px solid ${cssVars["--persona-border"]}`;
|
|
608
|
+
cssVars["--persona-panel-shadow"] = (_S = (_R = cssVars["--persona-components-panel-shadow"]) != null ? _R : cssVars["--persona-palette-shadows-xl"]) != null ? _S : "0 25px 50px -12px rgba(0, 0, 0, 0.25)";
|
|
609
|
+
cssVars["--persona-input-radius"] = (_U = (_T = cssVars["--persona-components-input-borderRadius"]) != null ? _T : cssVars["--persona-radius-lg"]) != null ? _U : "0.5rem";
|
|
610
|
+
cssVars["--persona-message-user-radius"] = (_W = (_V = cssVars["--persona-components-message-user-borderRadius"]) != null ? _V : cssVars["--persona-radius-lg"]) != null ? _W : "0.5rem";
|
|
611
|
+
cssVars["--persona-message-assistant-radius"] = (_Y = (_X = cssVars["--persona-components-message-assistant-borderRadius"]) != null ? _X : cssVars["--persona-radius-lg"]) != null ? _Y : "0.5rem";
|
|
612
|
+
cssVars["--persona-header-bg"] = (_Z = cssVars["--persona-components-header-background"]) != null ? _Z : cssVars["--persona-surface"];
|
|
613
|
+
cssVars["--persona-header-border"] = (__ = cssVars["--persona-components-header-border"]) != null ? __ : cssVars["--persona-divider"];
|
|
614
|
+
cssVars["--persona-header-icon-bg"] = (_$ = cssVars["--persona-components-header-iconBackground"]) != null ? _$ : cssVars["--persona-primary"];
|
|
615
|
+
cssVars["--persona-header-icon-fg"] = (_aa = cssVars["--persona-components-header-iconForeground"]) != null ? _aa : cssVars["--persona-text-inverse"];
|
|
616
|
+
cssVars["--persona-header-title-fg"] = (_ba = cssVars["--persona-components-header-titleForeground"]) != null ? _ba : cssVars["--persona-primary"];
|
|
617
|
+
cssVars["--persona-header-subtitle-fg"] = (_ca = cssVars["--persona-components-header-subtitleForeground"]) != null ? _ca : cssVars["--persona-text-muted"];
|
|
618
|
+
cssVars["--persona-header-action-icon-fg"] = (_da = cssVars["--persona-components-header-actionIconForeground"]) != null ? _da : cssVars["--persona-muted"];
|
|
619
|
+
const headerTokens = (_ea = theme.components) == null ? void 0 : _ea.header;
|
|
607
620
|
if (headerTokens == null ? void 0 : headerTokens.shadow) cssVars["--persona-header-shadow"] = headerTokens.shadow;
|
|
608
621
|
if (headerTokens == null ? void 0 : headerTokens.borderBottom) cssVars["--persona-header-border-bottom"] = headerTokens.borderBottom;
|
|
609
|
-
cssVars["--persona-input-background"] = (
|
|
610
|
-
cssVars["--persona-input-placeholder"] = (
|
|
611
|
-
cssVars["--persona-message-user-bg"] = (
|
|
612
|
-
cssVars["--persona-message-user-text"] = (
|
|
613
|
-
cssVars["--persona-message-user-shadow"] = (
|
|
614
|
-
cssVars["--persona-message-assistant-bg"] = (
|
|
615
|
-
cssVars["--persona-message-assistant-text"] = (
|
|
616
|
-
cssVars["--persona-message-assistant-border"] = (
|
|
617
|
-
cssVars["--persona-message-assistant-shadow"] = (
|
|
618
|
-
cssVars["--persona-
|
|
619
|
-
cssVars["--persona-
|
|
620
|
-
cssVars["--persona-
|
|
621
|
-
cssVars["--persona-
|
|
622
|
-
cssVars["--persona-
|
|
623
|
-
cssVars["--persona-
|
|
622
|
+
cssVars["--persona-input-background"] = (_fa = cssVars["--persona-components-input-background"]) != null ? _fa : cssVars["--persona-surface"];
|
|
623
|
+
cssVars["--persona-input-placeholder"] = (_ga = cssVars["--persona-components-input-placeholder"]) != null ? _ga : cssVars["--persona-text-muted"];
|
|
624
|
+
cssVars["--persona-message-user-bg"] = (_ha = cssVars["--persona-components-message-user-background"]) != null ? _ha : cssVars["--persona-accent"];
|
|
625
|
+
cssVars["--persona-message-user-text"] = (_ia = cssVars["--persona-components-message-user-text"]) != null ? _ia : cssVars["--persona-text-inverse"];
|
|
626
|
+
cssVars["--persona-message-user-shadow"] = (_ja = cssVars["--persona-components-message-user-shadow"]) != null ? _ja : "0 5px 15px rgba(15, 23, 42, 0.08)";
|
|
627
|
+
cssVars["--persona-message-assistant-bg"] = (_ka = cssVars["--persona-components-message-assistant-background"]) != null ? _ka : cssVars["--persona-surface"];
|
|
628
|
+
cssVars["--persona-message-assistant-text"] = (_la = cssVars["--persona-components-message-assistant-text"]) != null ? _la : cssVars["--persona-text"];
|
|
629
|
+
cssVars["--persona-message-assistant-border"] = (_ma = cssVars["--persona-components-message-assistant-border"]) != null ? _ma : cssVars["--persona-border"];
|
|
630
|
+
cssVars["--persona-message-assistant-shadow"] = (_na = cssVars["--persona-components-message-assistant-shadow"]) != null ? _na : "0 1px 2px 0 rgb(0 0 0 / 0.05)";
|
|
631
|
+
cssVars["--persona-scroll-to-bottom-bg"] = (_pa = (_oa = cssVars["--persona-components-scrollToBottom-background"]) != null ? _oa : cssVars["--persona-button-primary-bg"]) != null ? _pa : cssVars["--persona-accent"];
|
|
632
|
+
cssVars["--persona-scroll-to-bottom-fg"] = (_ra = (_qa = cssVars["--persona-components-scrollToBottom-foreground"]) != null ? _qa : cssVars["--persona-button-primary-fg"]) != null ? _ra : cssVars["--persona-text-inverse"];
|
|
633
|
+
cssVars["--persona-scroll-to-bottom-border"] = (_sa = cssVars["--persona-components-scrollToBottom-border"]) != null ? _sa : cssVars["--persona-primary"];
|
|
634
|
+
cssVars["--persona-scroll-to-bottom-size"] = (_ta = cssVars["--persona-components-scrollToBottom-size"]) != null ? _ta : "40px";
|
|
635
|
+
cssVars["--persona-scroll-to-bottom-radius"] = (_wa = (_va = (_ua = cssVars["--persona-components-scrollToBottom-borderRadius"]) != null ? _ua : cssVars["--persona-button-radius"]) != null ? _va : cssVars["--persona-radius-full"]) != null ? _wa : "9999px";
|
|
636
|
+
cssVars["--persona-scroll-to-bottom-shadow"] = (_ya = (_xa = cssVars["--persona-components-scrollToBottom-shadow"]) != null ? _xa : cssVars["--persona-palette-shadows-sm"]) != null ? _ya : "0 1px 2px 0 rgb(0 0 0 / 0.05)";
|
|
637
|
+
cssVars["--persona-scroll-to-bottom-padding"] = (_za = cssVars["--persona-components-scrollToBottom-padding"]) != null ? _za : "0.5rem 0.875rem";
|
|
638
|
+
cssVars["--persona-scroll-to-bottom-gap"] = (_Aa = cssVars["--persona-components-scrollToBottom-gap"]) != null ? _Aa : "0.5rem";
|
|
639
|
+
cssVars["--persona-scroll-to-bottom-font-size"] = (_Ca = (_Ba = cssVars["--persona-components-scrollToBottom-fontSize"]) != null ? _Ba : cssVars["--persona-palette-typography-fontSize-sm"]) != null ? _Ca : "0.875rem";
|
|
640
|
+
cssVars["--persona-scroll-to-bottom-icon-size"] = (_Da = cssVars["--persona-components-scrollToBottom-iconSize"]) != null ? _Da : "14px";
|
|
641
|
+
cssVars["--persona-tool-bubble-shadow"] = (_Ea = cssVars["--persona-components-toolBubble-shadow"]) != null ? _Ea : "0 5px 15px rgba(15, 23, 42, 0.08)";
|
|
642
|
+
cssVars["--persona-reasoning-bubble-shadow"] = (_Fa = cssVars["--persona-components-reasoningBubble-shadow"]) != null ? _Fa : "0 5px 15px rgba(15, 23, 42, 0.08)";
|
|
643
|
+
cssVars["--persona-composer-shadow"] = (_Ga = cssVars["--persona-components-composer-shadow"]) != null ? _Ga : "none";
|
|
644
|
+
cssVars["--persona-md-inline-code-bg"] = (_Ha = cssVars["--persona-components-markdown-inlineCode-background"]) != null ? _Ha : cssVars["--persona-container"];
|
|
645
|
+
cssVars["--persona-md-inline-code-color"] = (_Ia = cssVars["--persona-components-markdown-inlineCode-foreground"]) != null ? _Ia : cssVars["--persona-text"];
|
|
646
|
+
cssVars["--persona-md-link-color"] = (_Ka = (_Ja = cssVars["--persona-components-markdown-link-foreground"]) != null ? _Ja : cssVars["--persona-accent"]) != null ? _Ka : "#0f0f0f";
|
|
624
647
|
const mdH1Size = cssVars["--persona-components-markdown-heading-h1-fontSize"];
|
|
625
648
|
if (mdH1Size) cssVars["--persona-md-h1-size"] = mdH1Size;
|
|
626
649
|
const mdH1Weight = cssVars["--persona-components-markdown-heading-h1-fontWeight"];
|
|
@@ -679,23 +702,23 @@ function themeToCssVariables(theme) {
|
|
|
679
702
|
if (t.copyPadding) cssVars["--persona-artifact-toolbar-copy-padding"] = t.copyPadding;
|
|
680
703
|
if (t.copyMenuBackground) {
|
|
681
704
|
cssVars["--persona-artifact-toolbar-copy-menu-bg"] = t.copyMenuBackground;
|
|
682
|
-
cssVars["--persona-dropdown-bg"] = (
|
|
705
|
+
cssVars["--persona-dropdown-bg"] = (_La = cssVars["--persona-dropdown-bg"]) != null ? _La : t.copyMenuBackground;
|
|
683
706
|
}
|
|
684
707
|
if (t.copyMenuBorder) {
|
|
685
708
|
cssVars["--persona-artifact-toolbar-copy-menu-border"] = t.copyMenuBorder;
|
|
686
|
-
cssVars["--persona-dropdown-border"] = (
|
|
709
|
+
cssVars["--persona-dropdown-border"] = (_Ma = cssVars["--persona-dropdown-border"]) != null ? _Ma : t.copyMenuBorder;
|
|
687
710
|
}
|
|
688
711
|
if (t.copyMenuShadow) {
|
|
689
712
|
cssVars["--persona-artifact-toolbar-copy-menu-shadow"] = t.copyMenuShadow;
|
|
690
|
-
cssVars["--persona-dropdown-shadow"] = (
|
|
713
|
+
cssVars["--persona-dropdown-shadow"] = (_Na = cssVars["--persona-dropdown-shadow"]) != null ? _Na : t.copyMenuShadow;
|
|
691
714
|
}
|
|
692
715
|
if (t.copyMenuBorderRadius) {
|
|
693
716
|
cssVars["--persona-artifact-toolbar-copy-menu-radius"] = t.copyMenuBorderRadius;
|
|
694
|
-
cssVars["--persona-dropdown-radius"] = (
|
|
717
|
+
cssVars["--persona-dropdown-radius"] = (_Oa = cssVars["--persona-dropdown-radius"]) != null ? _Oa : t.copyMenuBorderRadius;
|
|
695
718
|
}
|
|
696
719
|
if (t.copyMenuItemHoverBackground) {
|
|
697
720
|
cssVars["--persona-artifact-toolbar-copy-menu-item-hover-bg"] = t.copyMenuItemHoverBackground;
|
|
698
|
-
cssVars["--persona-dropdown-item-hover-bg"] = (
|
|
721
|
+
cssVars["--persona-dropdown-item-hover-bg"] = (_Pa = cssVars["--persona-dropdown-item-hover-bg"]) != null ? _Pa : t.copyMenuItemHoverBackground;
|
|
699
722
|
}
|
|
700
723
|
if (t.iconBackground) cssVars["--persona-artifact-toolbar-icon-bg"] = t.iconBackground;
|
|
701
724
|
if (t.toolbarBorder) cssVars["--persona-artifact-toolbar-border"] = t.toolbarBorder;
|
|
@@ -715,7 +738,7 @@ function themeToCssVariables(theme) {
|
|
|
715
738
|
if (artifact == null ? void 0 : artifact.pane) {
|
|
716
739
|
const t = artifact.pane;
|
|
717
740
|
if (t.toolbarBackground) {
|
|
718
|
-
const toolbarBg = (
|
|
741
|
+
const toolbarBg = (_Qa = resolveTokenValue(theme, t.toolbarBackground)) != null ? _Qa : t.toolbarBackground;
|
|
719
742
|
cssVars["--persona-artifact-toolbar-bg"] = toolbarBg;
|
|
720
743
|
}
|
|
721
744
|
}
|
|
@@ -1032,7 +1055,12 @@ var DEFAULT_WIDGET_CONFIG = {
|
|
|
1032
1055
|
},
|
|
1033
1056
|
features: {
|
|
1034
1057
|
showReasoning: true,
|
|
1035
|
-
showToolCalls: true
|
|
1058
|
+
showToolCalls: true,
|
|
1059
|
+
scrollToBottom: {
|
|
1060
|
+
enabled: true,
|
|
1061
|
+
iconName: "arrow-down",
|
|
1062
|
+
label: ""
|
|
1063
|
+
}
|
|
1036
1064
|
},
|
|
1037
1065
|
suggestionChips: [
|
|
1038
1066
|
"What can you help me with?",
|
|
@@ -1134,9 +1162,11 @@ function mergeWithDefaults(config) {
|
|
|
1134
1162
|
...config.voiceRecognition
|
|
1135
1163
|
},
|
|
1136
1164
|
features: (() => {
|
|
1137
|
-
var _a2, _b2;
|
|
1165
|
+
var _a2, _b2, _c2, _d2;
|
|
1138
1166
|
const da = (_a2 = DEFAULT_WIDGET_CONFIG.features) == null ? void 0 : _a2.artifacts;
|
|
1139
1167
|
const ca = (_b2 = config.features) == null ? void 0 : _b2.artifacts;
|
|
1168
|
+
const dsb = (_c2 = DEFAULT_WIDGET_CONFIG.features) == null ? void 0 : _c2.scrollToBottom;
|
|
1169
|
+
const csb = (_d2 = config.features) == null ? void 0 : _d2.scrollToBottom;
|
|
1140
1170
|
const mergedArtifacts = da === void 0 && ca === void 0 ? void 0 : {
|
|
1141
1171
|
...da,
|
|
1142
1172
|
...ca,
|
|
@@ -1145,9 +1175,14 @@ function mergeWithDefaults(config) {
|
|
|
1145
1175
|
...ca == null ? void 0 : ca.layout
|
|
1146
1176
|
}
|
|
1147
1177
|
};
|
|
1178
|
+
const mergedScrollToBottom = dsb === void 0 && csb === void 0 ? void 0 : {
|
|
1179
|
+
...dsb,
|
|
1180
|
+
...csb
|
|
1181
|
+
};
|
|
1148
1182
|
return {
|
|
1149
1183
|
...DEFAULT_WIDGET_CONFIG.features,
|
|
1150
1184
|
...config.features,
|
|
1185
|
+
...mergedScrollToBottom !== void 0 ? { scrollToBottom: mergedScrollToBottom } : {},
|
|
1151
1186
|
...mergedArtifacts !== void 0 ? { artifacts: mergedArtifacts } : {}
|
|
1152
1187
|
};
|
|
1153
1188
|
})(),
|
|
@@ -1676,6 +1711,16 @@ var ROLE_PRIMARY_ACTIONS = {
|
|
|
1676
1711
|
{ path: "semantic.colors.interactive.hover", kind: "accent" }
|
|
1677
1712
|
]
|
|
1678
1713
|
};
|
|
1714
|
+
var ROLE_SCROLL_TO_BOTTOM = {
|
|
1715
|
+
roleId: "role-scroll-to-bottom",
|
|
1716
|
+
helper: "Scroll-to-bottom affordances in transcript and event stream",
|
|
1717
|
+
intensities: ROLE_INTENSITIES,
|
|
1718
|
+
targets: [
|
|
1719
|
+
{ path: "components.scrollToBottom.background", kind: "background" },
|
|
1720
|
+
{ path: "components.scrollToBottom.foreground", kind: "foreground" },
|
|
1721
|
+
{ path: "components.scrollToBottom.border", kind: "border" }
|
|
1722
|
+
]
|
|
1723
|
+
};
|
|
1679
1724
|
var ROLE_INPUT = {
|
|
1680
1725
|
roleId: "role-input",
|
|
1681
1726
|
helper: "Message input field",
|
|
@@ -1714,6 +1759,7 @@ var ALL_ROLES = [
|
|
|
1714
1759
|
ROLE_USER_MESSAGES,
|
|
1715
1760
|
ROLE_ASSISTANT_MESSAGES,
|
|
1716
1761
|
ROLE_PRIMARY_ACTIONS,
|
|
1762
|
+
ROLE_SCROLL_TO_BOTTOM,
|
|
1717
1763
|
ROLE_INPUT,
|
|
1718
1764
|
ROLE_LINKS_FOCUS,
|
|
1719
1765
|
ROLE_BORDERS
|
|
@@ -2186,6 +2232,35 @@ var buttonColorsSectionDef = {
|
|
|
2186
2232
|
{ id: "btn-ghost-fg", label: "Ghost Foreground", type: "token-ref", path: "theme.components.button.ghost.foreground", defaultValue: "semantic.colors.text", tokenRef: { tokenType: "color" } }
|
|
2187
2233
|
]
|
|
2188
2234
|
};
|
|
2235
|
+
var scrollToBottomSectionDef = {
|
|
2236
|
+
id: "scroll-to-bottom-style",
|
|
2237
|
+
title: "Scroll To Bottom",
|
|
2238
|
+
description: "Style the floating jump-to-latest affordance.",
|
|
2239
|
+
collapsed: true,
|
|
2240
|
+
fields: [
|
|
2241
|
+
{ id: "scroll-bottom-bg", label: "Background", type: "token-ref", path: "theme.components.scrollToBottom.background", defaultValue: "components.button.primary.background", tokenRef: { tokenType: "color" } },
|
|
2242
|
+
{ id: "scroll-bottom-fg", label: "Foreground", type: "token-ref", path: "theme.components.scrollToBottom.foreground", defaultValue: "components.button.primary.foreground", tokenRef: { tokenType: "color" } },
|
|
2243
|
+
{ id: "scroll-bottom-border", label: "Border", type: "token-ref", path: "theme.components.scrollToBottom.border", defaultValue: "semantic.colors.primary", tokenRef: { tokenType: "color" } },
|
|
2244
|
+
{ id: "scroll-bottom-size", label: "Size", type: "text", path: "theme.components.scrollToBottom.size", defaultValue: "40px" },
|
|
2245
|
+
{ id: "scroll-bottom-radius", label: "Border Radius", type: "select", path: "theme.components.scrollToBottom.borderRadius", defaultValue: "palette.radius.full", options: [
|
|
2246
|
+
{ value: "palette.radius.md", label: "Medium" },
|
|
2247
|
+
{ value: "palette.radius.lg", label: "Large" },
|
|
2248
|
+
{ value: "palette.radius.xl", label: "Extra Large" },
|
|
2249
|
+
{ value: "palette.radius.full", label: "Full" }
|
|
2250
|
+
] },
|
|
2251
|
+
{ id: "scroll-bottom-shadow", label: "Shadow", type: "select", path: "theme.components.scrollToBottom.shadow", defaultValue: "palette.shadows.sm", options: [
|
|
2252
|
+
{ value: "palette.shadows.none", label: "None" },
|
|
2253
|
+
{ value: "palette.shadows.sm", label: "Small" },
|
|
2254
|
+
{ value: "palette.shadows.md", label: "Medium" },
|
|
2255
|
+
{ value: "palette.shadows.lg", label: "Large" },
|
|
2256
|
+
{ value: "palette.shadows.xl", label: "Extra Large" }
|
|
2257
|
+
] },
|
|
2258
|
+
{ id: "scroll-bottom-padding", label: "Padding", type: "text", path: "theme.components.scrollToBottom.padding", defaultValue: "0.5rem 0.875rem" },
|
|
2259
|
+
{ id: "scroll-bottom-gap", label: "Gap", type: "text", path: "theme.components.scrollToBottom.gap", defaultValue: "0.5rem" },
|
|
2260
|
+
{ id: "scroll-bottom-font-size", label: "Font Size", type: "text", path: "theme.components.scrollToBottom.fontSize", defaultValue: "0.875rem" },
|
|
2261
|
+
{ id: "scroll-bottom-icon-size", label: "Icon Size", type: "text", path: "theme.components.scrollToBottom.iconSize", defaultValue: "14px" }
|
|
2262
|
+
]
|
|
2263
|
+
};
|
|
2189
2264
|
var COMPONENT_SHAPE_SECTIONS = [
|
|
2190
2265
|
panelLayoutSectionDef,
|
|
2191
2266
|
launcherLayoutSectionDef,
|
|
@@ -2197,7 +2272,8 @@ var COMPONENT_COLOR_SECTIONS = [
|
|
|
2197
2272
|
headerColorsSectionDef,
|
|
2198
2273
|
messageColorsSectionDef,
|
|
2199
2274
|
inputColorsSectionDef,
|
|
2200
|
-
buttonColorsSectionDef
|
|
2275
|
+
buttonColorsSectionDef,
|
|
2276
|
+
scrollToBottomSectionDef
|
|
2201
2277
|
];
|
|
2202
2278
|
var COMPONENTS_SECTIONS = [
|
|
2203
2279
|
...COMPONENT_SHAPE_SECTIONS,
|
|
@@ -2424,7 +2500,10 @@ var featuresSectionDef = {
|
|
|
2424
2500
|
collapsed: true,
|
|
2425
2501
|
fields: [
|
|
2426
2502
|
{ id: "feat-voice", label: "Voice Recognition", description: "Enable voice input", type: "toggle", path: "voiceRecognition.enabled", defaultValue: false },
|
|
2427
|
-
{ id: "feat-auto-focus", label: "Auto Focus Input", description: "Focus input after panel opens", type: "toggle", path: "autoFocusInput", defaultValue: false }
|
|
2503
|
+
{ id: "feat-auto-focus", label: "Auto Focus Input", description: "Focus input after panel opens", type: "toggle", path: "autoFocusInput", defaultValue: false },
|
|
2504
|
+
{ id: "feat-scroll-bottom-enabled", label: "Scroll To Bottom", description: "Show a jump-to-latest affordance when the user scrolls away from new content", type: "toggle", path: "features.scrollToBottom.enabled", defaultValue: true },
|
|
2505
|
+
{ id: "feat-scroll-bottom-icon", label: "Scroll To Bottom Icon", type: "text", path: "features.scrollToBottom.iconName", defaultValue: "arrow-down" },
|
|
2506
|
+
{ id: "feat-scroll-bottom-label", label: "Scroll To Bottom Label", description: "Leave empty for icon-only mode", type: "text", path: "features.scrollToBottom.label", defaultValue: "" }
|
|
2428
2507
|
]
|
|
2429
2508
|
};
|
|
2430
2509
|
var attachmentsSectionDef = {
|
|
@@ -2590,6 +2669,13 @@ var INTERFACE_ROLES_SECTION = {
|
|
|
2590
2669
|
path: "theme.components.button.primary.background",
|
|
2591
2670
|
roleAssignment: ROLE_PRIMARY_ACTIONS
|
|
2592
2671
|
},
|
|
2672
|
+
{
|
|
2673
|
+
id: "role-scroll-to-bottom",
|
|
2674
|
+
label: "Scroll To Bottom",
|
|
2675
|
+
type: "role-assignment",
|
|
2676
|
+
path: "theme.components.scrollToBottom.background",
|
|
2677
|
+
roleAssignment: ROLE_SCROLL_TO_BOTTOM
|
|
2678
|
+
},
|
|
2593
2679
|
{
|
|
2594
2680
|
id: "role-input",
|
|
2595
2681
|
label: "Input Field",
|
|
@@ -7535,6 +7621,72 @@ function pruneCache(cache, activeMessageIds) {
|
|
|
7535
7621
|
}
|
|
7536
7622
|
}
|
|
7537
7623
|
|
|
7624
|
+
// src/utils/auto-follow.ts
|
|
7625
|
+
function createFollowStateController(initiallyFollowing = true) {
|
|
7626
|
+
let following = initiallyFollowing;
|
|
7627
|
+
return {
|
|
7628
|
+
isFollowing: () => following,
|
|
7629
|
+
pause: () => {
|
|
7630
|
+
if (!following) return false;
|
|
7631
|
+
following = false;
|
|
7632
|
+
return true;
|
|
7633
|
+
},
|
|
7634
|
+
resume: () => {
|
|
7635
|
+
if (following) return false;
|
|
7636
|
+
following = true;
|
|
7637
|
+
return true;
|
|
7638
|
+
}
|
|
7639
|
+
};
|
|
7640
|
+
}
|
|
7641
|
+
function getScrollBottomOffset(element) {
|
|
7642
|
+
return Math.max(0, element.scrollHeight - element.clientHeight);
|
|
7643
|
+
}
|
|
7644
|
+
function isElementNearBottom(element, threshold) {
|
|
7645
|
+
return getScrollBottomOffset(element) - element.scrollTop <= threshold;
|
|
7646
|
+
}
|
|
7647
|
+
function resolveFollowStateFromScroll(input) {
|
|
7648
|
+
const {
|
|
7649
|
+
following,
|
|
7650
|
+
currentScrollTop,
|
|
7651
|
+
lastScrollTop,
|
|
7652
|
+
nearBottom,
|
|
7653
|
+
userScrollThreshold,
|
|
7654
|
+
isAutoScrolling = false,
|
|
7655
|
+
pauseOnUpwardScroll = false,
|
|
7656
|
+
pauseWhenAwayFromBottom = true,
|
|
7657
|
+
resumeRequiresDownwardScroll = false
|
|
7658
|
+
} = input;
|
|
7659
|
+
const delta = currentScrollTop - lastScrollTop;
|
|
7660
|
+
if (isAutoScrolling || Math.abs(delta) < userScrollThreshold) {
|
|
7661
|
+
return { action: "none", delta, nextLastScrollTop: currentScrollTop };
|
|
7662
|
+
}
|
|
7663
|
+
if (!following && nearBottom && (!resumeRequiresDownwardScroll || delta > 0)) {
|
|
7664
|
+
return { action: "resume", delta, nextLastScrollTop: currentScrollTop };
|
|
7665
|
+
}
|
|
7666
|
+
if (following && pauseOnUpwardScroll && delta < 0) {
|
|
7667
|
+
return { action: "pause", delta, nextLastScrollTop: currentScrollTop };
|
|
7668
|
+
}
|
|
7669
|
+
if (following && pauseWhenAwayFromBottom && !nearBottom) {
|
|
7670
|
+
return { action: "pause", delta, nextLastScrollTop: currentScrollTop };
|
|
7671
|
+
}
|
|
7672
|
+
return { action: "none", delta, nextLastScrollTop: currentScrollTop };
|
|
7673
|
+
}
|
|
7674
|
+
function resolveFollowStateFromWheel(input) {
|
|
7675
|
+
const {
|
|
7676
|
+
following,
|
|
7677
|
+
deltaY,
|
|
7678
|
+
nearBottom = false,
|
|
7679
|
+
resumeWhenNearBottom = false
|
|
7680
|
+
} = input;
|
|
7681
|
+
if (following && deltaY < 0) {
|
|
7682
|
+
return "pause";
|
|
7683
|
+
}
|
|
7684
|
+
if (!following && resumeWhenNearBottom && deltaY > 0 && nearBottom) {
|
|
7685
|
+
return "resume";
|
|
7686
|
+
}
|
|
7687
|
+
return "none";
|
|
7688
|
+
}
|
|
7689
|
+
|
|
7538
7690
|
// src/utils/constants.ts
|
|
7539
7691
|
var statusCopy = {
|
|
7540
7692
|
idle: "Online",
|
|
@@ -10505,7 +10657,7 @@ function renderEventRow(event, index, firstTimestamp, esConfig, expandedSet, onT
|
|
|
10505
10657
|
}
|
|
10506
10658
|
}
|
|
10507
10659
|
function createEventStreamView(options) {
|
|
10508
|
-
var _a, _b;
|
|
10660
|
+
var _a, _b, _c, _d, _e;
|
|
10509
10661
|
const {
|
|
10510
10662
|
buffer,
|
|
10511
10663
|
getFullHistory,
|
|
@@ -10513,7 +10665,11 @@ function createEventStreamView(options) {
|
|
|
10513
10665
|
config,
|
|
10514
10666
|
plugins = []
|
|
10515
10667
|
} = options;
|
|
10516
|
-
const
|
|
10668
|
+
const scrollToBottomConfig = (_a = config == null ? void 0 : config.features) == null ? void 0 : _a.scrollToBottom;
|
|
10669
|
+
const scrollToBottomEnabled = (scrollToBottomConfig == null ? void 0 : scrollToBottomConfig.enabled) !== false;
|
|
10670
|
+
const scrollToBottomIconName = (_b = scrollToBottomConfig == null ? void 0 : scrollToBottomConfig.iconName) != null ? _b : "arrow-down";
|
|
10671
|
+
const scrollToBottomLabel = (_c = scrollToBottomConfig == null ? void 0 : scrollToBottomConfig.label) != null ? _c : "";
|
|
10672
|
+
const esConfig = (_e = (_d = config == null ? void 0 : config.features) == null ? void 0 : _d.eventStream) != null ? _e : {};
|
|
10517
10673
|
const viewPlugin = plugins.find((p) => p.renderEventStreamView);
|
|
10518
10674
|
if ((viewPlugin == null ? void 0 : viewPlugin.renderEventStreamView) && config) {
|
|
10519
10675
|
const customView = viewPlugin.renderEventStreamView({
|
|
@@ -10547,7 +10703,7 @@ function createEventStreamView(options) {
|
|
|
10547
10703
|
let lastKnownTypes = [];
|
|
10548
10704
|
let lastTypeCounts = {};
|
|
10549
10705
|
let lastFilteredCount = 0;
|
|
10550
|
-
|
|
10706
|
+
const autoFollow = createFollowStateController();
|
|
10551
10707
|
let newEventsSincePause = 0;
|
|
10552
10708
|
let lastRenderTime = 0;
|
|
10553
10709
|
let pendingUpdate = false;
|
|
@@ -10700,18 +10856,23 @@ function createEventStreamView(options) {
|
|
|
10700
10856
|
eventsList.style.height = "100%";
|
|
10701
10857
|
const scrollIndicator = createElement(
|
|
10702
10858
|
"div",
|
|
10703
|
-
"persona-absolute persona-bottom-3 persona-left-1/2 persona-transform persona--translate-x-1/2 persona-
|
|
10859
|
+
"persona-scroll-to-bottom-indicator persona-absolute persona-bottom-3 persona-left-1/2 persona-transform persona--translate-x-1/2 persona-cursor-pointer persona-z-10 persona-text-xs"
|
|
10704
10860
|
);
|
|
10705
10861
|
applyCustomClasses(scrollIndicator, customClasses == null ? void 0 : customClasses.scrollIndicator);
|
|
10706
10862
|
scrollIndicator.style.display = "none";
|
|
10863
|
+
scrollIndicator.setAttribute(
|
|
10864
|
+
"data-persona-scroll-to-bottom-has-label",
|
|
10865
|
+
scrollToBottomLabel ? "true" : "false"
|
|
10866
|
+
);
|
|
10707
10867
|
const arrowIcon = renderLucideIcon(
|
|
10708
|
-
|
|
10709
|
-
"
|
|
10868
|
+
scrollToBottomIconName,
|
|
10869
|
+
"14px",
|
|
10710
10870
|
"currentColor",
|
|
10711
10871
|
2
|
|
10712
10872
|
);
|
|
10713
10873
|
if (arrowIcon) scrollIndicator.appendChild(arrowIcon);
|
|
10714
10874
|
const indicatorText = createElement("span", "");
|
|
10875
|
+
indicatorText.textContent = scrollToBottomLabel;
|
|
10715
10876
|
scrollIndicator.appendChild(indicatorText);
|
|
10716
10877
|
const noResultsMsg = createElement(
|
|
10717
10878
|
"div",
|
|
@@ -10783,7 +10944,7 @@ function createEventStreamView(options) {
|
|
|
10783
10944
|
function resetScrollState() {
|
|
10784
10945
|
lastFilteredCount = 0;
|
|
10785
10946
|
newEventsSincePause = 0;
|
|
10786
|
-
|
|
10947
|
+
autoFollow.resume();
|
|
10787
10948
|
scrollIndicator.style.display = "none";
|
|
10788
10949
|
}
|
|
10789
10950
|
function toggleExpand(eventId) {
|
|
@@ -10794,17 +10955,18 @@ function createEventStreamView(options) {
|
|
|
10794
10955
|
}
|
|
10795
10956
|
dirtyExpandId = eventId;
|
|
10796
10957
|
const savedScrollTop = eventsList.scrollTop;
|
|
10797
|
-
const
|
|
10958
|
+
const wasAutoFollowing = autoFollow.isFollowing();
|
|
10798
10959
|
suppressScrollHandler = true;
|
|
10799
|
-
|
|
10960
|
+
autoFollow.pause();
|
|
10800
10961
|
updateNow();
|
|
10801
10962
|
eventsList.scrollTop = savedScrollTop;
|
|
10802
|
-
|
|
10963
|
+
if (wasAutoFollowing) {
|
|
10964
|
+
autoFollow.resume();
|
|
10965
|
+
}
|
|
10803
10966
|
suppressScrollHandler = false;
|
|
10804
10967
|
}
|
|
10805
10968
|
function isNearBottom() {
|
|
10806
|
-
|
|
10807
|
-
return eventsList.scrollHeight - eventsList.scrollTop - eventsList.clientHeight <= threshold;
|
|
10969
|
+
return isElementNearBottom(eventsList, 50);
|
|
10808
10970
|
}
|
|
10809
10971
|
function updateNow() {
|
|
10810
10972
|
lastRenderTime = Date.now();
|
|
@@ -10834,9 +10996,9 @@ function createEventStreamView(options) {
|
|
|
10834
10996
|
if (copyAllBtn) {
|
|
10835
10997
|
copyAllBtn.title = hasActiveFilters() ? `Copy Filtered (${newCount})` : "Copy All";
|
|
10836
10998
|
}
|
|
10837
|
-
if (
|
|
10999
|
+
if (scrollToBottomEnabled && !autoFollow.isFollowing() && newCount > lastFilteredCount) {
|
|
10838
11000
|
newEventsSincePause += newCount - lastFilteredCount;
|
|
10839
|
-
indicatorText.textContent = `${
|
|
11001
|
+
indicatorText.textContent = scrollToBottomLabel ? `${scrollToBottomLabel}${newEventsSincePause > 0 ? ` (${newEventsSincePause})` : ""}` : "";
|
|
10840
11002
|
scrollIndicator.style.display = "";
|
|
10841
11003
|
}
|
|
10842
11004
|
lastFilteredCount = newCount;
|
|
@@ -10920,7 +11082,7 @@ function createEventStreamView(options) {
|
|
|
10920
11082
|
}
|
|
10921
11083
|
}
|
|
10922
11084
|
}
|
|
10923
|
-
if (
|
|
11085
|
+
if (autoFollow.isFollowing()) {
|
|
10924
11086
|
eventsList.scrollTop = eventsList.scrollHeight;
|
|
10925
11087
|
}
|
|
10926
11088
|
}
|
|
@@ -11029,24 +11191,50 @@ function createEventStreamView(options) {
|
|
|
11029
11191
|
const handleListScroll = () => {
|
|
11030
11192
|
if (suppressScrollHandler) return;
|
|
11031
11193
|
const currentScrollTop = eventsList.scrollTop;
|
|
11032
|
-
const
|
|
11033
|
-
|
|
11034
|
-
|
|
11035
|
-
|
|
11194
|
+
const { action, nextLastScrollTop } = resolveFollowStateFromScroll({
|
|
11195
|
+
following: autoFollow.isFollowing(),
|
|
11196
|
+
currentScrollTop,
|
|
11197
|
+
lastScrollTop,
|
|
11198
|
+
nearBottom: isNearBottom(),
|
|
11199
|
+
userScrollThreshold: 1,
|
|
11200
|
+
resumeRequiresDownwardScroll: true
|
|
11201
|
+
});
|
|
11202
|
+
lastScrollTop = nextLastScrollTop;
|
|
11203
|
+
if (action === "resume") {
|
|
11204
|
+
autoFollow.resume();
|
|
11036
11205
|
newEventsSincePause = 0;
|
|
11037
11206
|
scrollIndicator.style.display = "none";
|
|
11038
|
-
} else if (
|
|
11039
|
-
|
|
11207
|
+
} else if (action === "pause") {
|
|
11208
|
+
autoFollow.pause();
|
|
11209
|
+
if (scrollToBottomEnabled) {
|
|
11210
|
+
indicatorText.textContent = scrollToBottomLabel;
|
|
11211
|
+
scrollIndicator.style.display = "";
|
|
11212
|
+
}
|
|
11040
11213
|
}
|
|
11041
11214
|
};
|
|
11042
11215
|
const handleWheel = (e) => {
|
|
11043
|
-
|
|
11044
|
-
|
|
11216
|
+
const action = resolveFollowStateFromWheel({
|
|
11217
|
+
following: autoFollow.isFollowing(),
|
|
11218
|
+
deltaY: e.deltaY,
|
|
11219
|
+
nearBottom: isNearBottom(),
|
|
11220
|
+
resumeWhenNearBottom: true
|
|
11221
|
+
});
|
|
11222
|
+
if (action === "pause") {
|
|
11223
|
+
autoFollow.pause();
|
|
11224
|
+
if (scrollToBottomEnabled) {
|
|
11225
|
+
indicatorText.textContent = scrollToBottomLabel;
|
|
11226
|
+
scrollIndicator.style.display = "";
|
|
11227
|
+
}
|
|
11228
|
+
} else if (action === "resume") {
|
|
11229
|
+
autoFollow.resume();
|
|
11230
|
+
newEventsSincePause = 0;
|
|
11231
|
+
scrollIndicator.style.display = "none";
|
|
11045
11232
|
}
|
|
11046
11233
|
};
|
|
11047
11234
|
const handleScrollIndicatorClick = () => {
|
|
11235
|
+
if (!scrollToBottomEnabled) return;
|
|
11048
11236
|
eventsList.scrollTop = eventsList.scrollHeight;
|
|
11049
|
-
|
|
11237
|
+
autoFollow.resume();
|
|
11050
11238
|
newEventsSincePause = 0;
|
|
11051
11239
|
scrollIndicator.style.display = "none";
|
|
11052
11240
|
};
|
|
@@ -12665,7 +12853,7 @@ var buildPostprocessor = (cfg, actionManager, onResubmitRequested) => {
|
|
|
12665
12853
|
};
|
|
12666
12854
|
};
|
|
12667
12855
|
var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
|
|
12668
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L;
|
|
12856
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N;
|
|
12669
12857
|
if (mount.id && !mount.getAttribute("data-persona-instance")) {
|
|
12670
12858
|
mount.setAttribute("data-persona-instance", mount.id);
|
|
12671
12859
|
}
|
|
@@ -12783,10 +12971,11 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
|
|
|
12783
12971
|
let showReasoning = (_l = (_k = config.features) == null ? void 0 : _k.showReasoning) != null ? _l : true;
|
|
12784
12972
|
let showToolCalls = (_n = (_m = config.features) == null ? void 0 : _m.showToolCalls) != null ? _n : true;
|
|
12785
12973
|
let showEventStreamToggle = (_p = (_o = config.features) == null ? void 0 : _o.showEventStreamToggle) != null ? _p : false;
|
|
12786
|
-
|
|
12974
|
+
let scrollToBottomFeature = (_r = (_q = config.features) == null ? void 0 : _q.scrollToBottom) != null ? _r : {};
|
|
12975
|
+
const persistKeyPrefix = (_t = typeof config.persistState === "object" ? (_s = config.persistState) == null ? void 0 : _s.keyPrefix : void 0) != null ? _t : "persona-";
|
|
12787
12976
|
const eventStreamDbName = `${persistKeyPrefix}event-stream`;
|
|
12788
12977
|
let eventStreamStore = showEventStreamToggle ? new EventStreamStore(eventStreamDbName) : null;
|
|
12789
|
-
const eventStreamMaxEvents = (
|
|
12978
|
+
const eventStreamMaxEvents = (_w = (_v = (_u = config.features) == null ? void 0 : _u.eventStream) == null ? void 0 : _v.maxEvents) != null ? _w : 2e3;
|
|
12790
12979
|
let eventStreamBuffer = showEventStreamToggle ? new EventStreamBuffer(eventStreamMaxEvents, eventStreamStore) : null;
|
|
12791
12980
|
let eventStreamView = null;
|
|
12792
12981
|
let eventStreamVisible = false;
|
|
@@ -12823,7 +13012,7 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
|
|
|
12823
13012
|
(_b2 = (_a2 = config.messageActions) == null ? void 0 : _a2.onFeedback) == null ? void 0 : _b2.call(_a2, feedback);
|
|
12824
13013
|
}
|
|
12825
13014
|
};
|
|
12826
|
-
const statusConfig = (
|
|
13015
|
+
const statusConfig = (_x = config.statusIndicator) != null ? _x : {};
|
|
12827
13016
|
const _getStatusText = (status) => {
|
|
12828
13017
|
var _a2, _b2, _c2, _d2;
|
|
12829
13018
|
if (status === "idle") return (_a2 = statusConfig.idleText) != null ? _a2 : statusCopy.idle;
|
|
@@ -12877,6 +13066,52 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
|
|
|
12877
13066
|
let attachmentButtonWrapper = panelElements.attachmentButtonWrapper;
|
|
12878
13067
|
let attachmentInput = panelElements.attachmentInput;
|
|
12879
13068
|
let attachmentPreviewsContainer = panelElements.attachmentPreviewsContainer;
|
|
13069
|
+
container.classList.add("persona-relative");
|
|
13070
|
+
body.classList.add("persona-relative");
|
|
13071
|
+
const SCROLL_TO_BOTTOM_EDGE_OFFSET = 12;
|
|
13072
|
+
const getScrollToBottomLabel = () => {
|
|
13073
|
+
var _a2;
|
|
13074
|
+
return (_a2 = scrollToBottomFeature.label) != null ? _a2 : "";
|
|
13075
|
+
};
|
|
13076
|
+
const getScrollToBottomIconName = () => {
|
|
13077
|
+
var _a2;
|
|
13078
|
+
return (_a2 = scrollToBottomFeature.iconName) != null ? _a2 : "arrow-down";
|
|
13079
|
+
};
|
|
13080
|
+
const isScrollToBottomEnabled = () => scrollToBottomFeature.enabled !== false;
|
|
13081
|
+
const scrollToBottomButton = createElement(
|
|
13082
|
+
"button",
|
|
13083
|
+
"persona-scroll-to-bottom-indicator persona-absolute persona-bottom-3 persona-left-1/2 persona-z-10 persona-flex persona-items-center persona-gap-1 persona-text-xs persona-transform persona--translate-x-1/2 persona-cursor-pointer"
|
|
13084
|
+
);
|
|
13085
|
+
scrollToBottomButton.type = "button";
|
|
13086
|
+
scrollToBottomButton.style.display = "none";
|
|
13087
|
+
scrollToBottomButton.setAttribute("data-persona-scroll-to-bottom", "true");
|
|
13088
|
+
const scrollToBottomIcon = createElement("span", "persona-flex persona-items-center");
|
|
13089
|
+
const scrollToBottomLabel = createElement("span", "");
|
|
13090
|
+
scrollToBottomButton.append(scrollToBottomIcon, scrollToBottomLabel);
|
|
13091
|
+
container.appendChild(scrollToBottomButton);
|
|
13092
|
+
const updateScrollToBottomButtonOffset = () => {
|
|
13093
|
+
const footerHidden = footer.style.display === "none";
|
|
13094
|
+
const footerHeight = footerHidden ? 0 : footer.offsetHeight;
|
|
13095
|
+
scrollToBottomButton.style.bottom = `${footerHeight + SCROLL_TO_BOTTOM_EDGE_OFFSET}px`;
|
|
13096
|
+
};
|
|
13097
|
+
updateScrollToBottomButtonOffset();
|
|
13098
|
+
const renderScrollToBottomButton = () => {
|
|
13099
|
+
const hasLabel = Boolean(getScrollToBottomLabel());
|
|
13100
|
+
scrollToBottomButton.setAttribute("aria-label", getScrollToBottomLabel() || "Jump to latest");
|
|
13101
|
+
scrollToBottomButton.title = getScrollToBottomLabel();
|
|
13102
|
+
scrollToBottomButton.setAttribute("data-persona-scroll-to-bottom-has-label", hasLabel ? "true" : "false");
|
|
13103
|
+
scrollToBottomIcon.innerHTML = "";
|
|
13104
|
+
const icon = renderLucideIcon(getScrollToBottomIconName(), "14px", "currentColor", 2);
|
|
13105
|
+
if (icon) {
|
|
13106
|
+
scrollToBottomIcon.appendChild(icon);
|
|
13107
|
+
scrollToBottomIcon.style.display = "";
|
|
13108
|
+
} else {
|
|
13109
|
+
scrollToBottomIcon.style.display = "none";
|
|
13110
|
+
}
|
|
13111
|
+
scrollToBottomLabel.textContent = getScrollToBottomLabel();
|
|
13112
|
+
scrollToBottomLabel.style.display = hasLabel ? "" : "none";
|
|
13113
|
+
};
|
|
13114
|
+
renderScrollToBottomButton();
|
|
12880
13115
|
let attachmentManager = null;
|
|
12881
13116
|
let composerVoiceBridge = null;
|
|
12882
13117
|
const headerPlugin = plugins.find((p) => p.renderHeader);
|
|
@@ -12932,6 +13167,7 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
|
|
|
12932
13167
|
};
|
|
12933
13168
|
eventStreamLastUpdate = 0;
|
|
12934
13169
|
eventStreamRAF = requestAnimationFrame(rafLoop);
|
|
13170
|
+
syncScrollToBottomButton();
|
|
12935
13171
|
eventBus.emit("eventStream:opened", { timestamp: Date.now() });
|
|
12936
13172
|
};
|
|
12937
13173
|
const toggleEventStreamOff = () => {
|
|
@@ -12951,11 +13187,12 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
|
|
|
12951
13187
|
cancelAnimationFrame(eventStreamRAF);
|
|
12952
13188
|
eventStreamRAF = null;
|
|
12953
13189
|
}
|
|
13190
|
+
syncScrollToBottomButton();
|
|
12954
13191
|
eventBus.emit("eventStream:closed", { timestamp: Date.now() });
|
|
12955
13192
|
};
|
|
12956
13193
|
let eventStreamToggleBtn = null;
|
|
12957
13194
|
if (showEventStreamToggle) {
|
|
12958
|
-
const esClassNames = (
|
|
13195
|
+
const esClassNames = (_z = (_y = config.features) == null ? void 0 : _y.eventStream) == null ? void 0 : _z.classNames;
|
|
12959
13196
|
const toggleBtnClasses = "persona-inline-flex persona-items-center persona-justify-center persona-rounded-full hover:persona-opacity-80 persona-cursor-pointer persona-border-none persona-bg-transparent persona-p-1" + ((esClassNames == null ? void 0 : esClassNames.toggleButton) ? " " + esClassNames.toggleButton : "");
|
|
12960
13197
|
eventStreamToggleBtn = createElement("button", toggleBtnClasses);
|
|
12961
13198
|
eventStreamToggleBtn.style.width = "28px";
|
|
@@ -13034,7 +13271,7 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
|
|
|
13034
13271
|
onModelChange: (modelId) => {
|
|
13035
13272
|
config.composer = { ...config.composer, selectedModelId: modelId };
|
|
13036
13273
|
},
|
|
13037
|
-
onVoiceToggle: ((
|
|
13274
|
+
onVoiceToggle: ((_A = config.voiceRecognition) == null ? void 0 : _A.enabled) === true ? () => {
|
|
13038
13275
|
composerVoiceBridge == null ? void 0 : composerVoiceBridge();
|
|
13039
13276
|
} : void 0
|
|
13040
13277
|
});
|
|
@@ -13073,7 +13310,7 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
|
|
|
13073
13310
|
};
|
|
13074
13311
|
ensureComposerAttachmentSurface(footer);
|
|
13075
13312
|
bindComposerRefsFromFooter(footer);
|
|
13076
|
-
const contentMaxWidth = (
|
|
13313
|
+
const contentMaxWidth = (_B = config.layout) == null ? void 0 : _B.contentMaxWidth;
|
|
13077
13314
|
if (contentMaxWidth && composerForm) {
|
|
13078
13315
|
composerForm.style.maxWidth = contentMaxWidth;
|
|
13079
13316
|
composerForm.style.marginLeft = "auto";
|
|
@@ -13084,7 +13321,7 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
|
|
|
13084
13321
|
attachmentPreviewsContainer.style.marginLeft = "auto";
|
|
13085
13322
|
attachmentPreviewsContainer.style.marginRight = "auto";
|
|
13086
13323
|
}
|
|
13087
|
-
if (((
|
|
13324
|
+
if (((_C = config.attachments) == null ? void 0 : _C.enabled) && attachmentInput && attachmentPreviewsContainer) {
|
|
13088
13325
|
attachmentManager = AttachmentManager.fromConfig(config.attachments);
|
|
13089
13326
|
attachmentManager.setPreviewsContainer(attachmentPreviewsContainer);
|
|
13090
13327
|
attachmentInput.addEventListener("change", (e) => {
|
|
@@ -13871,17 +14108,12 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
|
|
|
13871
14108
|
let isStreaming = false;
|
|
13872
14109
|
const messageCache = createMessageCache();
|
|
13873
14110
|
let configVersion = 0;
|
|
13874
|
-
|
|
14111
|
+
const autoFollow = createFollowStateController();
|
|
13875
14112
|
let lastScrollTop = 0;
|
|
13876
|
-
let lastAutoScrollTime = 0;
|
|
13877
14113
|
let scrollRAF = null;
|
|
13878
|
-
let isAutoScrollBlocked = false;
|
|
13879
|
-
let blockUntilTime = 0;
|
|
13880
14114
|
let isAutoScrolling = false;
|
|
13881
|
-
const
|
|
13882
|
-
const
|
|
13883
|
-
const USER_SCROLL_THRESHOLD = 5;
|
|
13884
|
-
const BOTTOM_THRESHOLD = 50;
|
|
14115
|
+
const USER_SCROLL_THRESHOLD = 1;
|
|
14116
|
+
const BOTTOM_THRESHOLD = 8;
|
|
13885
14117
|
const messageState = /* @__PURE__ */ new Map();
|
|
13886
14118
|
const voiceState = {
|
|
13887
14119
|
active: false,
|
|
@@ -13889,7 +14121,7 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
|
|
|
13889
14121
|
lastUserMessageWasVoice: false,
|
|
13890
14122
|
lastUserMessageId: null
|
|
13891
14123
|
};
|
|
13892
|
-
const voiceAutoResumeMode = (
|
|
14124
|
+
const voiceAutoResumeMode = (_E = (_D = config.voiceRecognition) == null ? void 0 : _D.autoResume) != null ? _E : false;
|
|
13893
14125
|
const emitVoiceState = (source) => {
|
|
13894
14126
|
eventBus.emit("voice:state", {
|
|
13895
14127
|
active: voiceState.active,
|
|
@@ -13955,56 +14187,78 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
|
|
|
13955
14187
|
}
|
|
13956
14188
|
}
|
|
13957
14189
|
}
|
|
13958
|
-
|
|
13959
|
-
|
|
13960
|
-
const
|
|
13961
|
-
|
|
13962
|
-
|
|
13963
|
-
|
|
13964
|
-
if (
|
|
13965
|
-
|
|
14190
|
+
let smoothScrollRAF = null;
|
|
14191
|
+
const getScrollableContainer = () => {
|
|
14192
|
+
const scrollable = wrapper.querySelector("#persona-scroll-container");
|
|
14193
|
+
return scrollable || body;
|
|
14194
|
+
};
|
|
14195
|
+
const cancelSmoothScroll = () => {
|
|
14196
|
+
if (smoothScrollRAF !== null) {
|
|
14197
|
+
cancelAnimationFrame(smoothScrollRAF);
|
|
14198
|
+
smoothScrollRAF = null;
|
|
13966
14199
|
}
|
|
13967
|
-
|
|
13968
|
-
|
|
13969
|
-
|
|
13970
|
-
if (scrollRAF) {
|
|
14200
|
+
isAutoScrolling = false;
|
|
14201
|
+
};
|
|
14202
|
+
const cancelAutoScroll = () => {
|
|
14203
|
+
if (scrollRAF !== null) {
|
|
13971
14204
|
cancelAnimationFrame(scrollRAF);
|
|
14205
|
+
scrollRAF = null;
|
|
13972
14206
|
}
|
|
14207
|
+
cancelSmoothScroll();
|
|
14208
|
+
};
|
|
14209
|
+
const syncScrollToBottomButton = () => {
|
|
14210
|
+
if (!isScrollToBottomEnabled() || eventStreamVisible) {
|
|
14211
|
+
if (scrollToBottomButton.parentNode) {
|
|
14212
|
+
scrollToBottomButton.remove();
|
|
14213
|
+
}
|
|
14214
|
+
scrollToBottomButton.style.display = "none";
|
|
14215
|
+
return;
|
|
14216
|
+
}
|
|
14217
|
+
if (scrollToBottomButton.parentNode !== container) {
|
|
14218
|
+
container.appendChild(scrollToBottomButton);
|
|
14219
|
+
}
|
|
14220
|
+
updateScrollToBottomButtonOffset();
|
|
14221
|
+
scrollToBottomButton.style.display = autoFollow.isFollowing() ? "none" : "";
|
|
14222
|
+
};
|
|
14223
|
+
const pauseAutoScroll = () => {
|
|
14224
|
+
if (!autoFollow.pause()) return;
|
|
14225
|
+
cancelAutoScroll();
|
|
14226
|
+
syncScrollToBottomButton();
|
|
14227
|
+
};
|
|
14228
|
+
const resumeAutoScroll = () => {
|
|
14229
|
+
autoFollow.resume();
|
|
14230
|
+
syncScrollToBottomButton();
|
|
14231
|
+
};
|
|
14232
|
+
const scheduleAutoScroll = (force = false) => {
|
|
14233
|
+
if (!autoFollow.isFollowing()) return;
|
|
14234
|
+
if (!force && !isStreaming) return;
|
|
14235
|
+
cancelAutoScroll();
|
|
13973
14236
|
scrollRAF = requestAnimationFrame(() => {
|
|
13974
|
-
if (isAutoScrollBlocked || !shouldAutoScroll) return;
|
|
13975
|
-
isAutoScrolling = true;
|
|
13976
|
-
body.scrollTop = body.scrollHeight;
|
|
13977
|
-
lastScrollTop = body.scrollTop;
|
|
13978
|
-
requestAnimationFrame(() => {
|
|
13979
|
-
isAutoScrolling = false;
|
|
13980
|
-
});
|
|
13981
14237
|
scrollRAF = null;
|
|
14238
|
+
if (!autoFollow.isFollowing()) return;
|
|
14239
|
+
smoothScrollToBottom(getScrollableContainer(), force ? 220 : 140);
|
|
13982
14240
|
});
|
|
13983
14241
|
};
|
|
13984
|
-
let smoothScrollRAF = null;
|
|
13985
|
-
const getScrollableContainer = () => {
|
|
13986
|
-
const scrollable = wrapper.querySelector("#persona-scroll-container");
|
|
13987
|
-
return scrollable || body;
|
|
13988
|
-
};
|
|
13989
14242
|
const smoothScrollToBottom = (element, duration = 500) => {
|
|
13990
14243
|
const start = element.scrollTop;
|
|
13991
|
-
|
|
13992
|
-
let target = element.scrollHeight;
|
|
14244
|
+
let target = getScrollBottomOffset(element);
|
|
13993
14245
|
let distance = target - start;
|
|
13994
|
-
|
|
13995
|
-
|
|
14246
|
+
if (Math.abs(distance) < 1) {
|
|
14247
|
+
lastScrollTop = element.scrollTop;
|
|
13996
14248
|
return;
|
|
13997
14249
|
}
|
|
13998
|
-
|
|
13999
|
-
cancelAnimationFrame(smoothScrollRAF);
|
|
14000
|
-
smoothScrollRAF = null;
|
|
14001
|
-
}
|
|
14250
|
+
cancelSmoothScroll();
|
|
14002
14251
|
const startTime = performance.now();
|
|
14252
|
+
isAutoScrolling = true;
|
|
14003
14253
|
const easeOutCubic = (t) => {
|
|
14004
14254
|
return 1 - Math.pow(1 - t, 3);
|
|
14005
14255
|
};
|
|
14006
14256
|
const animate = (currentTime) => {
|
|
14007
|
-
|
|
14257
|
+
if (!autoFollow.isFollowing()) {
|
|
14258
|
+
cancelSmoothScroll();
|
|
14259
|
+
return;
|
|
14260
|
+
}
|
|
14261
|
+
const currentTarget = getScrollBottomOffset(element);
|
|
14008
14262
|
if (currentTarget !== target) {
|
|
14009
14263
|
target = currentTarget;
|
|
14010
14264
|
distance = target - start;
|
|
@@ -14014,11 +14268,14 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
|
|
|
14014
14268
|
const eased = easeOutCubic(progress);
|
|
14015
14269
|
const currentScroll = start + distance * eased;
|
|
14016
14270
|
element.scrollTop = currentScroll;
|
|
14271
|
+
lastScrollTop = element.scrollTop;
|
|
14017
14272
|
if (progress < 1) {
|
|
14018
14273
|
smoothScrollRAF = requestAnimationFrame(animate);
|
|
14019
14274
|
} else {
|
|
14020
|
-
element.scrollTop =
|
|
14275
|
+
element.scrollTop = target;
|
|
14276
|
+
lastScrollTop = element.scrollTop;
|
|
14021
14277
|
smoothScrollRAF = null;
|
|
14278
|
+
isAutoScrolling = false;
|
|
14022
14279
|
}
|
|
14023
14280
|
};
|
|
14024
14281
|
smoothScrollRAF = requestAnimationFrame(animate);
|
|
@@ -14358,15 +14615,6 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
|
|
|
14358
14615
|
}
|
|
14359
14616
|
}
|
|
14360
14617
|
morphMessages(container2, tempContainer);
|
|
14361
|
-
if (shouldAutoScroll && !isAutoScrollBlocked) {
|
|
14362
|
-
requestAnimationFrame(() => {
|
|
14363
|
-
requestAnimationFrame(() => {
|
|
14364
|
-
if (!shouldAutoScroll || isAutoScrollBlocked) return;
|
|
14365
|
-
const scrollableContainer = getScrollableContainer();
|
|
14366
|
-
smoothScrollToBottom(scrollableContainer);
|
|
14367
|
-
});
|
|
14368
|
-
});
|
|
14369
|
-
}
|
|
14370
14618
|
};
|
|
14371
14619
|
const renderMessagesWithPlugins = renderMessagesWithPluginsImpl;
|
|
14372
14620
|
const updateOpenState = () => {
|
|
@@ -14584,7 +14832,7 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
|
|
|
14584
14832
|
}
|
|
14585
14833
|
});
|
|
14586
14834
|
sessionRef.current = session;
|
|
14587
|
-
if (((
|
|
14835
|
+
if (((_G = (_F = config.voiceRecognition) == null ? void 0 : _F.provider) == null ? void 0 : _G.type) === "runtype") {
|
|
14588
14836
|
try {
|
|
14589
14837
|
session.setupVoice();
|
|
14590
14838
|
} catch (err) {
|
|
@@ -15155,38 +15403,70 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
|
|
|
15155
15403
|
panel.style.height = `${finalHeight}px`;
|
|
15156
15404
|
}
|
|
15157
15405
|
} finally {
|
|
15406
|
+
updateScrollToBottomButtonOffset();
|
|
15158
15407
|
updateOpenState();
|
|
15159
15408
|
}
|
|
15160
15409
|
};
|
|
15161
15410
|
recalcPanelHeight();
|
|
15162
|
-
const ownerWindow = (
|
|
15411
|
+
const ownerWindow = (_H = mount.ownerDocument.defaultView) != null ? _H : window;
|
|
15163
15412
|
ownerWindow.addEventListener("resize", recalcPanelHeight);
|
|
15164
15413
|
destroyCallbacks.push(() => ownerWindow.removeEventListener("resize", recalcPanelHeight));
|
|
15414
|
+
if (typeof ResizeObserver !== "undefined") {
|
|
15415
|
+
const footerResizeObserver = new ResizeObserver(() => {
|
|
15416
|
+
updateScrollToBottomButtonOffset();
|
|
15417
|
+
});
|
|
15418
|
+
footerResizeObserver.observe(footer);
|
|
15419
|
+
destroyCallbacks.push(() => footerResizeObserver.disconnect());
|
|
15420
|
+
}
|
|
15165
15421
|
lastScrollTop = body.scrollTop;
|
|
15166
15422
|
const handleScroll = () => {
|
|
15167
15423
|
const scrollTop = body.scrollTop;
|
|
15168
|
-
const
|
|
15169
|
-
|
|
15170
|
-
|
|
15171
|
-
|
|
15172
|
-
|
|
15173
|
-
|
|
15174
|
-
|
|
15175
|
-
|
|
15176
|
-
|
|
15177
|
-
|
|
15424
|
+
const { action, nextLastScrollTop } = resolveFollowStateFromScroll({
|
|
15425
|
+
following: autoFollow.isFollowing(),
|
|
15426
|
+
currentScrollTop: scrollTop,
|
|
15427
|
+
lastScrollTop,
|
|
15428
|
+
nearBottom: isElementNearBottom(body, BOTTOM_THRESHOLD),
|
|
15429
|
+
userScrollThreshold: USER_SCROLL_THRESHOLD,
|
|
15430
|
+
isAutoScrolling,
|
|
15431
|
+
pauseOnUpwardScroll: true,
|
|
15432
|
+
pauseWhenAwayFromBottom: false,
|
|
15433
|
+
resumeRequiresDownwardScroll: true
|
|
15434
|
+
});
|
|
15435
|
+
lastScrollTop = nextLastScrollTop;
|
|
15436
|
+
if (action === "resume") {
|
|
15437
|
+
resumeAutoScroll();
|
|
15178
15438
|
return;
|
|
15179
15439
|
}
|
|
15180
|
-
if (
|
|
15181
|
-
|
|
15182
|
-
blockUntilTime = Date.now() + AUTO_SCROLL_BLOCK_TIME;
|
|
15183
|
-
shouldAutoScroll = false;
|
|
15440
|
+
if (action === "pause") {
|
|
15441
|
+
pauseAutoScroll();
|
|
15184
15442
|
}
|
|
15185
15443
|
};
|
|
15186
15444
|
body.addEventListener("scroll", handleScroll, { passive: true });
|
|
15187
15445
|
destroyCallbacks.push(() => body.removeEventListener("scroll", handleScroll));
|
|
15446
|
+
const handleWheel = (event) => {
|
|
15447
|
+
const action = resolveFollowStateFromWheel({
|
|
15448
|
+
following: autoFollow.isFollowing(),
|
|
15449
|
+
deltaY: event.deltaY,
|
|
15450
|
+
nearBottom: isElementNearBottom(body, BOTTOM_THRESHOLD),
|
|
15451
|
+
resumeWhenNearBottom: true
|
|
15452
|
+
});
|
|
15453
|
+
if (action === "pause") {
|
|
15454
|
+
pauseAutoScroll();
|
|
15455
|
+
} else if (action === "resume") {
|
|
15456
|
+
resumeAutoScroll();
|
|
15457
|
+
}
|
|
15458
|
+
};
|
|
15459
|
+
body.addEventListener("wheel", handleWheel, { passive: true });
|
|
15460
|
+
destroyCallbacks.push(() => body.removeEventListener("wheel", handleWheel));
|
|
15461
|
+
scrollToBottomButton.addEventListener("click", () => {
|
|
15462
|
+
body.scrollTop = body.scrollHeight;
|
|
15463
|
+
lastScrollTop = body.scrollTop;
|
|
15464
|
+
resumeAutoScroll();
|
|
15465
|
+
scheduleAutoScroll(true);
|
|
15466
|
+
});
|
|
15467
|
+
destroyCallbacks.push(() => scrollToBottomButton.remove());
|
|
15188
15468
|
destroyCallbacks.push(() => {
|
|
15189
|
-
|
|
15469
|
+
cancelAutoScroll();
|
|
15190
15470
|
});
|
|
15191
15471
|
const refreshCloseButton = () => {
|
|
15192
15472
|
if (!closeButton) return;
|
|
@@ -15282,7 +15562,7 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
|
|
|
15282
15562
|
}
|
|
15283
15563
|
const controller = {
|
|
15284
15564
|
update(nextConfig) {
|
|
15285
|
-
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m2, _n2, _o2, _p2, _q2, _r2, _s2, _t2, _u2, _v2, _w2, _x2, _y2, _z2, _A2, _B2, _C2, _D2, _E2, _F2, _G2, _H2, _I2, _J2, _K2, _L2,
|
|
15565
|
+
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m2, _n2, _o2, _p2, _q2, _r2, _s2, _t2, _u2, _v2, _w2, _x2, _y2, _z2, _A2, _B2, _C2, _D2, _E2, _F2, _G2, _H2, _I2, _J2, _K2, _L2, _M2, _N2, _O, _P, _Q, _R, _S, _T, _U, _V, _W, _X, _Y, _Z, __, _$, _aa, _ba, _ca, _da, _ea, _fa, _ga, _ha, _ia, _ja, _ka, _la, _ma, _na, _oa, _pa, _qa, _ra, _sa, _ta, _ua, _va, _wa, _xa, _ya, _za, _Aa, _Ba, _Ca, _Da, _Ea, _Fa, _Ga, _Ha, _Ia, _Ja, _Ka, _La, _Ma, _Na, _Oa, _Pa, _Qa, _Ra;
|
|
15286
15566
|
const previousToolCallConfig = config.toolCall;
|
|
15287
15567
|
const previousMessageActions = config.messageActions;
|
|
15288
15568
|
const previousLayoutMessages = (_a2 = config.layout) == null ? void 0 : _a2.messages;
|
|
@@ -15305,8 +15585,11 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
|
|
|
15305
15585
|
autoExpand = (_e2 = (_d2 = config.launcher) == null ? void 0 : _d2.autoExpand) != null ? _e2 : false;
|
|
15306
15586
|
showReasoning = (_g2 = (_f2 = config.features) == null ? void 0 : _f2.showReasoning) != null ? _g2 : true;
|
|
15307
15587
|
showToolCalls = (_i2 = (_h2 = config.features) == null ? void 0 : _h2.showToolCalls) != null ? _i2 : true;
|
|
15588
|
+
scrollToBottomFeature = (_k2 = (_j2 = config.features) == null ? void 0 : _j2.scrollToBottom) != null ? _k2 : {};
|
|
15589
|
+
renderScrollToBottomButton();
|
|
15590
|
+
syncScrollToBottomButton();
|
|
15308
15591
|
const prevShowEventStreamToggle = showEventStreamToggle;
|
|
15309
|
-
showEventStreamToggle = (
|
|
15592
|
+
showEventStreamToggle = (_m2 = (_l2 = config.features) == null ? void 0 : _l2.showEventStreamToggle) != null ? _m2 : false;
|
|
15310
15593
|
if (showEventStreamToggle && !prevShowEventStreamToggle) {
|
|
15311
15594
|
if (!eventStreamBuffer) {
|
|
15312
15595
|
eventStreamStore = new EventStreamStore(eventStreamDbName);
|
|
@@ -15323,7 +15606,7 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
|
|
|
15323
15606
|
});
|
|
15324
15607
|
}
|
|
15325
15608
|
if (!eventStreamToggleBtn && header) {
|
|
15326
|
-
const dynEsClassNames = (
|
|
15609
|
+
const dynEsClassNames = (_o2 = (_n2 = config.features) == null ? void 0 : _n2.eventStream) == null ? void 0 : _o2.classNames;
|
|
15327
15610
|
const dynToggleBtnClasses = "persona-inline-flex persona-items-center persona-justify-center persona-rounded-full hover:persona-opacity-80 persona-cursor-pointer persona-border-none persona-bg-transparent persona-p-1" + ((dynEsClassNames == null ? void 0 : dynEsClassNames.toggleButton) ? " " + dynEsClassNames.toggleButton : "");
|
|
15328
15611
|
eventStreamToggleBtn = createElement("button", dynToggleBtnClasses);
|
|
15329
15612
|
eventStreamToggleBtn.style.width = "28px";
|
|
@@ -15361,15 +15644,15 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
|
|
|
15361
15644
|
eventStreamBuffer = null;
|
|
15362
15645
|
eventStreamStore = null;
|
|
15363
15646
|
}
|
|
15364
|
-
if (((
|
|
15647
|
+
if (((_p2 = config.launcher) == null ? void 0 : _p2.enabled) === false && launcherButtonInstance) {
|
|
15365
15648
|
launcherButtonInstance.destroy();
|
|
15366
15649
|
launcherButtonInstance = null;
|
|
15367
15650
|
}
|
|
15368
|
-
if (((
|
|
15651
|
+
if (((_q2 = config.launcher) == null ? void 0 : _q2.enabled) === false && customLauncherElement) {
|
|
15369
15652
|
customLauncherElement.remove();
|
|
15370
15653
|
customLauncherElement = null;
|
|
15371
15654
|
}
|
|
15372
|
-
if (((
|
|
15655
|
+
if (((_r2 = config.launcher) == null ? void 0 : _r2.enabled) !== false && !launcherButtonInstance && !customLauncherElement) {
|
|
15373
15656
|
const launcherPlugin = plugins.find((p) => p.renderLauncher);
|
|
15374
15657
|
if (launcherPlugin == null ? void 0 : launcherPlugin.renderLauncher) {
|
|
15375
15658
|
const customLauncher = launcherPlugin.renderLauncher({
|
|
@@ -15393,13 +15676,13 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
|
|
|
15393
15676
|
if (launcherButtonInstance) {
|
|
15394
15677
|
launcherButtonInstance.update(config);
|
|
15395
15678
|
}
|
|
15396
|
-
if (headerTitle && ((
|
|
15679
|
+
if (headerTitle && ((_s2 = config.launcher) == null ? void 0 : _s2.title) !== void 0) {
|
|
15397
15680
|
headerTitle.textContent = config.launcher.title;
|
|
15398
15681
|
}
|
|
15399
|
-
if (headerSubtitle && ((
|
|
15682
|
+
if (headerSubtitle && ((_t2 = config.launcher) == null ? void 0 : _t2.subtitle) !== void 0) {
|
|
15400
15683
|
headerSubtitle.textContent = config.launcher.subtitle;
|
|
15401
15684
|
}
|
|
15402
|
-
const headerLayoutConfig = (
|
|
15685
|
+
const headerLayoutConfig = (_u2 = config.layout) == null ? void 0 : _u2.header;
|
|
15403
15686
|
const headerLayoutChanged = (headerLayoutConfig == null ? void 0 : headerLayoutConfig.layout) !== prevHeaderLayout;
|
|
15404
15687
|
if (headerLayoutChanged && header) {
|
|
15405
15688
|
const newHeaderElements = headerLayoutConfig ? buildHeaderWithLayout(config, headerLayoutConfig, {
|
|
@@ -15445,14 +15728,16 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
|
|
|
15445
15728
|
}
|
|
15446
15729
|
}
|
|
15447
15730
|
}
|
|
15448
|
-
const showHeader = ((
|
|
15731
|
+
const showHeader = ((_v2 = config.layout) == null ? void 0 : _v2.showHeader) !== false;
|
|
15449
15732
|
if (header) {
|
|
15450
15733
|
header.style.display = showHeader ? "" : "none";
|
|
15451
15734
|
}
|
|
15452
|
-
const showFooter = ((
|
|
15735
|
+
const showFooter = ((_w2 = config.layout) == null ? void 0 : _w2.showFooter) !== false;
|
|
15453
15736
|
if (footer) {
|
|
15454
15737
|
footer.style.display = showFooter ? "" : "none";
|
|
15455
15738
|
}
|
|
15739
|
+
updateScrollToBottomButtonOffset();
|
|
15740
|
+
syncScrollToBottomButton();
|
|
15456
15741
|
const launcherEnabledChanged = launcherEnabled !== prevLauncherEnabled;
|
|
15457
15742
|
const autoExpandChanged = autoExpand !== prevAutoExpand;
|
|
15458
15743
|
if (launcherEnabledChanged) {
|
|
@@ -15471,20 +15756,20 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
|
|
|
15471
15756
|
refreshCloseButton();
|
|
15472
15757
|
const toolCallConfigChanged = JSON.stringify(nextConfig.toolCall) !== JSON.stringify(previousToolCallConfig);
|
|
15473
15758
|
const messageActionsChanged = JSON.stringify(config.messageActions) !== JSON.stringify(previousMessageActions);
|
|
15474
|
-
const layoutMessagesChanged = JSON.stringify((
|
|
15475
|
-
const loadingIndicatorChanged = ((
|
|
15759
|
+
const layoutMessagesChanged = JSON.stringify((_x2 = config.layout) == null ? void 0 : _x2.messages) !== JSON.stringify(previousLayoutMessages);
|
|
15760
|
+
const loadingIndicatorChanged = ((_y2 = config.loadingIndicator) == null ? void 0 : _y2.render) !== (previousLoadingIndicator == null ? void 0 : previousLoadingIndicator.render) || ((_z2 = config.loadingIndicator) == null ? void 0 : _z2.renderIdle) !== (previousLoadingIndicator == null ? void 0 : previousLoadingIndicator.renderIdle) || ((_A2 = config.loadingIndicator) == null ? void 0 : _A2.showBubble) !== (previousLoadingIndicator == null ? void 0 : previousLoadingIndicator.showBubble);
|
|
15476
15761
|
const iterationDisplayChanged = config.iterationDisplay !== previousIterationDisplay;
|
|
15477
15762
|
const messagesConfigChanged = toolCallConfigChanged || messageActionsChanged || layoutMessagesChanged || loadingIndicatorChanged || iterationDisplayChanged;
|
|
15478
15763
|
if (messagesConfigChanged && session) {
|
|
15479
15764
|
configVersion++;
|
|
15480
15765
|
renderMessagesWithPlugins(messagesWrapper, session.getMessages(), postprocess);
|
|
15481
15766
|
}
|
|
15482
|
-
const launcher = (
|
|
15483
|
-
const headerIconHidden = (
|
|
15484
|
-
const layoutShowIcon = (
|
|
15767
|
+
const launcher = (_B2 = config.launcher) != null ? _B2 : {};
|
|
15768
|
+
const headerIconHidden = (_C2 = launcher.headerIconHidden) != null ? _C2 : false;
|
|
15769
|
+
const layoutShowIcon = (_E2 = (_D2 = config.layout) == null ? void 0 : _D2.header) == null ? void 0 : _E2.showIcon;
|
|
15485
15770
|
const shouldHideIcon = headerIconHidden || layoutShowIcon === false;
|
|
15486
15771
|
const headerIconName = launcher.headerIconName;
|
|
15487
|
-
const headerIconSize = (
|
|
15772
|
+
const headerIconSize = (_F2 = launcher.headerIconSize) != null ? _F2 : "48px";
|
|
15488
15773
|
if (iconHolder) {
|
|
15489
15774
|
const headerEl = container.querySelector(".persona-border-b-persona-divider");
|
|
15490
15775
|
const headerCopy = headerEl == null ? void 0 : headerEl.querySelector(".persona-flex-col");
|
|
@@ -15511,7 +15796,7 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
|
|
|
15511
15796
|
if (iconSvg) {
|
|
15512
15797
|
iconHolder.replaceChildren(iconSvg);
|
|
15513
15798
|
} else {
|
|
15514
|
-
iconHolder.textContent = (
|
|
15799
|
+
iconHolder.textContent = (_G2 = launcher.agentIconText) != null ? _G2 : "\u{1F4AC}";
|
|
15515
15800
|
}
|
|
15516
15801
|
} else if (launcher.iconUrl) {
|
|
15517
15802
|
const img2 = iconHolder.querySelector("img");
|
|
@@ -15534,7 +15819,7 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
|
|
|
15534
15819
|
if (existingSvg || existingImg) {
|
|
15535
15820
|
iconHolder.replaceChildren();
|
|
15536
15821
|
}
|
|
15537
|
-
iconHolder.textContent = (
|
|
15822
|
+
iconHolder.textContent = (_H2 = launcher.agentIconText) != null ? _H2 : "\u{1F4AC}";
|
|
15538
15823
|
}
|
|
15539
15824
|
const img = iconHolder.querySelector("img");
|
|
15540
15825
|
if (img) {
|
|
@@ -15543,8 +15828,8 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
|
|
|
15543
15828
|
}
|
|
15544
15829
|
}
|
|
15545
15830
|
}
|
|
15546
|
-
const layoutShowTitle = (
|
|
15547
|
-
const layoutShowSubtitle = (
|
|
15831
|
+
const layoutShowTitle = (_J2 = (_I2 = config.layout) == null ? void 0 : _I2.header) == null ? void 0 : _J2.showTitle;
|
|
15832
|
+
const layoutShowSubtitle = (_L2 = (_K2 = config.layout) == null ? void 0 : _K2.header) == null ? void 0 : _L2.showSubtitle;
|
|
15548
15833
|
if (headerTitle) {
|
|
15549
15834
|
headerTitle.style.display = layoutShowTitle === false ? "none" : "";
|
|
15550
15835
|
}
|
|
@@ -15552,14 +15837,14 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
|
|
|
15552
15837
|
headerSubtitle.style.display = layoutShowSubtitle === false ? "none" : "";
|
|
15553
15838
|
}
|
|
15554
15839
|
if (closeButton) {
|
|
15555
|
-
const layoutShowCloseButton = (
|
|
15840
|
+
const layoutShowCloseButton = (_N2 = (_M2 = config.layout) == null ? void 0 : _M2.header) == null ? void 0 : _N2.showCloseButton;
|
|
15556
15841
|
if (layoutShowCloseButton === false) {
|
|
15557
15842
|
closeButton.style.display = "none";
|
|
15558
15843
|
} else {
|
|
15559
15844
|
closeButton.style.display = "";
|
|
15560
15845
|
}
|
|
15561
|
-
const closeButtonSize = (
|
|
15562
|
-
const closeButtonPlacement = (
|
|
15846
|
+
const closeButtonSize = (_O = launcher.closeButtonSize) != null ? _O : "32px";
|
|
15847
|
+
const closeButtonPlacement = (_P = launcher.closeButtonPlacement) != null ? _P : "inline";
|
|
15563
15848
|
closeButton.style.height = closeButtonSize;
|
|
15564
15849
|
closeButton.style.width = closeButtonSize;
|
|
15565
15850
|
const { closeButtonWrapper } = panelElements;
|
|
@@ -15572,8 +15857,8 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
|
|
|
15572
15857
|
container.style.position = "relative";
|
|
15573
15858
|
container.appendChild(closeButtonWrapper);
|
|
15574
15859
|
} else {
|
|
15575
|
-
const clearChatPlacement = (
|
|
15576
|
-
const clearChatEnabled = (
|
|
15860
|
+
const clearChatPlacement = (_R = (_Q = launcher.clearChat) == null ? void 0 : _Q.placement) != null ? _R : "inline";
|
|
15861
|
+
const clearChatEnabled = (_T = (_S = launcher.clearChat) == null ? void 0 : _S.enabled) != null ? _T : true;
|
|
15577
15862
|
closeButtonWrapper.className = clearChatEnabled && clearChatPlacement === "inline" ? "" : "persona-ml-auto";
|
|
15578
15863
|
const header2 = container.querySelector(".persona-border-b-persona-divider");
|
|
15579
15864
|
if (header2) {
|
|
@@ -15619,8 +15904,8 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
|
|
|
15619
15904
|
closeButton.style.paddingTop = "";
|
|
15620
15905
|
closeButton.style.paddingBottom = "";
|
|
15621
15906
|
}
|
|
15622
|
-
const closeButtonIconName = (
|
|
15623
|
-
const closeButtonIconText = (
|
|
15907
|
+
const closeButtonIconName = (_U = launcher.closeButtonIconName) != null ? _U : "x";
|
|
15908
|
+
const closeButtonIconText = (_V = launcher.closeButtonIconText) != null ? _V : "\xD7";
|
|
15624
15909
|
closeButton.innerHTML = "";
|
|
15625
15910
|
const iconSvg = renderLucideIcon(closeButtonIconName, "20px", "currentColor", 2);
|
|
15626
15911
|
if (iconSvg) {
|
|
@@ -15628,8 +15913,8 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
|
|
|
15628
15913
|
} else {
|
|
15629
15914
|
closeButton.textContent = closeButtonIconText;
|
|
15630
15915
|
}
|
|
15631
|
-
const closeButtonTooltipText = (
|
|
15632
|
-
const closeButtonShowTooltip = (
|
|
15916
|
+
const closeButtonTooltipText = (_W = launcher.closeButtonTooltipText) != null ? _W : "Close chat";
|
|
15917
|
+
const closeButtonShowTooltip = (_X = launcher.closeButtonShowTooltip) != null ? _X : true;
|
|
15633
15918
|
closeButton.setAttribute("aria-label", closeButtonTooltipText);
|
|
15634
15919
|
if (closeButtonWrapper) {
|
|
15635
15920
|
if (closeButtonWrapper._cleanupTooltip) {
|
|
@@ -15685,11 +15970,11 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
|
|
|
15685
15970
|
}
|
|
15686
15971
|
const { clearChatButton, clearChatButtonWrapper } = panelElements;
|
|
15687
15972
|
if (clearChatButton) {
|
|
15688
|
-
const clearChatConfig = (
|
|
15689
|
-
const clearChatEnabled = (
|
|
15690
|
-
const layoutShowClearChat = (
|
|
15973
|
+
const clearChatConfig = (_Y = launcher.clearChat) != null ? _Y : {};
|
|
15974
|
+
const clearChatEnabled = (_Z = clearChatConfig.enabled) != null ? _Z : true;
|
|
15975
|
+
const layoutShowClearChat = (_$ = (__ = config.layout) == null ? void 0 : __.header) == null ? void 0 : _$.showClearChat;
|
|
15691
15976
|
const shouldShowClearChat = layoutShowClearChat !== void 0 ? layoutShowClearChat : clearChatEnabled;
|
|
15692
|
-
const clearChatPlacement = (
|
|
15977
|
+
const clearChatPlacement = (_aa = clearChatConfig.placement) != null ? _aa : "inline";
|
|
15693
15978
|
if (clearChatButtonWrapper) {
|
|
15694
15979
|
clearChatButtonWrapper.style.display = shouldShowClearChat ? "" : "none";
|
|
15695
15980
|
const { closeButtonWrapper } = panelElements;
|
|
@@ -15731,11 +16016,11 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
|
|
|
15731
16016
|
}
|
|
15732
16017
|
}
|
|
15733
16018
|
if (shouldShowClearChat) {
|
|
15734
|
-
const clearChatSize = (
|
|
16019
|
+
const clearChatSize = (_ba = clearChatConfig.size) != null ? _ba : "32px";
|
|
15735
16020
|
clearChatButton.style.height = clearChatSize;
|
|
15736
16021
|
clearChatButton.style.width = clearChatSize;
|
|
15737
|
-
const clearChatIconName = (
|
|
15738
|
-
const clearChatIconColor = (
|
|
16022
|
+
const clearChatIconName = (_ca = clearChatConfig.iconName) != null ? _ca : "refresh-cw";
|
|
16023
|
+
const clearChatIconColor = (_da = clearChatConfig.iconColor) != null ? _da : "";
|
|
15739
16024
|
clearChatButton.style.color = clearChatIconColor || HEADER_THEME_CSS.actionIconColor;
|
|
15740
16025
|
clearChatButton.innerHTML = "";
|
|
15741
16026
|
const iconSvg = renderLucideIcon(clearChatIconName, "20px", "currentColor", 2);
|
|
@@ -15779,8 +16064,8 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
|
|
|
15779
16064
|
clearChatButton.style.paddingTop = "";
|
|
15780
16065
|
clearChatButton.style.paddingBottom = "";
|
|
15781
16066
|
}
|
|
15782
|
-
const clearChatTooltipText = (
|
|
15783
|
-
const clearChatShowTooltip = (
|
|
16067
|
+
const clearChatTooltipText = (_ea = clearChatConfig.tooltipText) != null ? _ea : "Clear chat";
|
|
16068
|
+
const clearChatShowTooltip = (_fa = clearChatConfig.showTooltip) != null ? _fa : true;
|
|
15784
16069
|
clearChatButton.setAttribute("aria-label", clearChatTooltipText);
|
|
15785
16070
|
if (clearChatButtonWrapper) {
|
|
15786
16071
|
if (clearChatButtonWrapper._cleanupTooltip) {
|
|
@@ -15855,9 +16140,9 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
|
|
|
15855
16140
|
suggestionsManager.render(config.suggestionChips, session, textarea, void 0, config.suggestionChipsConfig);
|
|
15856
16141
|
updateCopy();
|
|
15857
16142
|
setComposerDisabled(session.isStreaming());
|
|
15858
|
-
const voiceRecognitionEnabled = ((
|
|
16143
|
+
const voiceRecognitionEnabled = ((_ga = config.voiceRecognition) == null ? void 0 : _ga.enabled) === true;
|
|
15859
16144
|
const hasSpeechRecognition = typeof window !== "undefined" && (typeof window.webkitSpeechRecognition !== "undefined" || typeof window.SpeechRecognition !== "undefined");
|
|
15860
|
-
const hasRuntypeProvider = ((
|
|
16145
|
+
const hasRuntypeProvider = ((_ia = (_ha = config.voiceRecognition) == null ? void 0 : _ha.provider) == null ? void 0 : _ia.type) === "runtype";
|
|
15861
16146
|
const hasVoiceInput = hasSpeechRecognition || hasRuntypeProvider;
|
|
15862
16147
|
if (voiceRecognitionEnabled && hasVoiceInput) {
|
|
15863
16148
|
if (!micButton || !micButtonWrapper) {
|
|
@@ -15870,17 +16155,17 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
|
|
|
15870
16155
|
micButton.disabled = session.isStreaming();
|
|
15871
16156
|
}
|
|
15872
16157
|
} else {
|
|
15873
|
-
const voiceConfig = (
|
|
15874
|
-
const sendButtonConfig2 = (
|
|
15875
|
-
const micIconName = (
|
|
15876
|
-
const buttonSize2 = (
|
|
15877
|
-
const micIconSize = (
|
|
16158
|
+
const voiceConfig = (_ja = config.voiceRecognition) != null ? _ja : {};
|
|
16159
|
+
const sendButtonConfig2 = (_ka = config.sendButton) != null ? _ka : {};
|
|
16160
|
+
const micIconName = (_la = voiceConfig.iconName) != null ? _la : "mic";
|
|
16161
|
+
const buttonSize2 = (_ma = sendButtonConfig2.size) != null ? _ma : "40px";
|
|
16162
|
+
const micIconSize = (_na = voiceConfig.iconSize) != null ? _na : buttonSize2;
|
|
15878
16163
|
const micIconSizeNum = parseFloat(micIconSize) || 24;
|
|
15879
16164
|
micButton.style.width = micIconSize;
|
|
15880
16165
|
micButton.style.height = micIconSize;
|
|
15881
16166
|
micButton.style.minWidth = micIconSize;
|
|
15882
16167
|
micButton.style.minHeight = micIconSize;
|
|
15883
|
-
const iconColor = (
|
|
16168
|
+
const iconColor = (_pa = (_oa = voiceConfig.iconColor) != null ? _oa : sendButtonConfig2.textColor) != null ? _pa : "currentColor";
|
|
15884
16169
|
micButton.innerHTML = "";
|
|
15885
16170
|
const micIconSvg = renderLucideIcon(micIconName, micIconSizeNum, iconColor, 2);
|
|
15886
16171
|
if (micIconSvg) {
|
|
@@ -15888,7 +16173,7 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
|
|
|
15888
16173
|
} else {
|
|
15889
16174
|
micButton.textContent = "\u{1F3A4}";
|
|
15890
16175
|
}
|
|
15891
|
-
const backgroundColor2 = (
|
|
16176
|
+
const backgroundColor2 = (_qa = voiceConfig.backgroundColor) != null ? _qa : sendButtonConfig2.backgroundColor;
|
|
15892
16177
|
if (backgroundColor2) {
|
|
15893
16178
|
micButton.style.backgroundColor = backgroundColor2;
|
|
15894
16179
|
} else {
|
|
@@ -15926,8 +16211,8 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
|
|
|
15926
16211
|
micButton.style.paddingBottom = "";
|
|
15927
16212
|
}
|
|
15928
16213
|
const tooltip2 = micButtonWrapper == null ? void 0 : micButtonWrapper.querySelector(".persona-send-button-tooltip");
|
|
15929
|
-
const tooltipText2 = (
|
|
15930
|
-
const showTooltip2 = (
|
|
16214
|
+
const tooltipText2 = (_ra = voiceConfig.tooltipText) != null ? _ra : "Start voice recognition";
|
|
16215
|
+
const showTooltip2 = (_sa = voiceConfig.showTooltip) != null ? _sa : false;
|
|
15931
16216
|
if (showTooltip2 && tooltipText2) {
|
|
15932
16217
|
if (!tooltip2) {
|
|
15933
16218
|
const newTooltip = document.createElement("div");
|
|
@@ -15947,19 +16232,19 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
|
|
|
15947
16232
|
} else {
|
|
15948
16233
|
if (micButton && micButtonWrapper) {
|
|
15949
16234
|
micButtonWrapper.style.display = "none";
|
|
15950
|
-
if (((
|
|
16235
|
+
if (((_ua = (_ta = config.voiceRecognition) == null ? void 0 : _ta.provider) == null ? void 0 : _ua.type) === "runtype") {
|
|
15951
16236
|
if (session.isVoiceActive()) session.toggleVoice();
|
|
15952
16237
|
} else if (isRecording) {
|
|
15953
16238
|
stopVoiceRecognition();
|
|
15954
16239
|
}
|
|
15955
16240
|
}
|
|
15956
16241
|
}
|
|
15957
|
-
const attachmentsEnabled = ((
|
|
16242
|
+
const attachmentsEnabled = ((_va = config.attachments) == null ? void 0 : _va.enabled) === true;
|
|
15958
16243
|
if (attachmentsEnabled) {
|
|
15959
16244
|
if (!attachmentButtonWrapper || !attachmentButton) {
|
|
15960
|
-
const attachmentsConfig = (
|
|
15961
|
-
const sendButtonConfig2 = (
|
|
15962
|
-
const buttonSize2 = (
|
|
16245
|
+
const attachmentsConfig = (_wa = config.attachments) != null ? _wa : {};
|
|
16246
|
+
const sendButtonConfig2 = (_xa = config.sendButton) != null ? _xa : {};
|
|
16247
|
+
const buttonSize2 = (_ya = sendButtonConfig2.size) != null ? _ya : "40px";
|
|
15963
16248
|
if (!attachmentPreviewsContainer) {
|
|
15964
16249
|
attachmentPreviewsContainer = createElement("div", "persona-attachment-previews persona-flex persona-flex-wrap persona-gap-2 persona-mb-2");
|
|
15965
16250
|
attachmentPreviewsContainer.style.display = "none";
|
|
@@ -15968,8 +16253,8 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
|
|
|
15968
16253
|
if (!attachmentInput) {
|
|
15969
16254
|
attachmentInput = document.createElement("input");
|
|
15970
16255
|
attachmentInput.type = "file";
|
|
15971
|
-
attachmentInput.accept = ((
|
|
15972
|
-
attachmentInput.multiple = ((
|
|
16256
|
+
attachmentInput.accept = ((_za = attachmentsConfig.allowedTypes) != null ? _za : ALL_SUPPORTED_MIME_TYPES).join(",");
|
|
16257
|
+
attachmentInput.multiple = ((_Aa = attachmentsConfig.maxFiles) != null ? _Aa : 4) > 1;
|
|
15973
16258
|
attachmentInput.style.display = "none";
|
|
15974
16259
|
attachmentInput.setAttribute("aria-label", "Attach files");
|
|
15975
16260
|
composerForm.insertBefore(attachmentInput, textarea);
|
|
@@ -15980,8 +16265,8 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
|
|
|
15980
16265
|
"persona-rounded-button persona-flex persona-items-center persona-justify-center disabled:persona-opacity-50 persona-cursor-pointer persona-attachment-button"
|
|
15981
16266
|
);
|
|
15982
16267
|
attachmentButton.type = "button";
|
|
15983
|
-
attachmentButton.setAttribute("aria-label", (
|
|
15984
|
-
const attachIconName = (
|
|
16268
|
+
attachmentButton.setAttribute("aria-label", (_Ba = attachmentsConfig.buttonTooltipText) != null ? _Ba : "Attach file");
|
|
16269
|
+
const attachIconName = (_Ca = attachmentsConfig.buttonIconName) != null ? _Ca : "paperclip";
|
|
15985
16270
|
const attachIconSize = buttonSize2;
|
|
15986
16271
|
const buttonSizeNum = parseFloat(attachIconSize) || 40;
|
|
15987
16272
|
const attachIconSizeNum = Math.round(buttonSizeNum * 0.6);
|
|
@@ -16013,7 +16298,7 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
|
|
|
16013
16298
|
attachmentInput == null ? void 0 : attachmentInput.click();
|
|
16014
16299
|
});
|
|
16015
16300
|
attachmentButtonWrapper.appendChild(attachmentButton);
|
|
16016
|
-
const attachTooltipText = (
|
|
16301
|
+
const attachTooltipText = (_Da = attachmentsConfig.buttonTooltipText) != null ? _Da : "Attach file";
|
|
16017
16302
|
const tooltip2 = createElement("div", "persona-send-button-tooltip");
|
|
16018
16303
|
tooltip2.textContent = attachTooltipText;
|
|
16019
16304
|
attachmentButtonWrapper.appendChild(tooltip2);
|
|
@@ -16030,10 +16315,10 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
|
|
|
16030
16315
|
}
|
|
16031
16316
|
} else {
|
|
16032
16317
|
attachmentButtonWrapper.style.display = "";
|
|
16033
|
-
const attachmentsConfig = (
|
|
16318
|
+
const attachmentsConfig = (_Ea = config.attachments) != null ? _Ea : {};
|
|
16034
16319
|
if (attachmentInput) {
|
|
16035
|
-
attachmentInput.accept = ((
|
|
16036
|
-
attachmentInput.multiple = ((
|
|
16320
|
+
attachmentInput.accept = ((_Fa = attachmentsConfig.allowedTypes) != null ? _Fa : ALL_SUPPORTED_MIME_TYPES).join(",");
|
|
16321
|
+
attachmentInput.multiple = ((_Ga = attachmentsConfig.maxFiles) != null ? _Ga : 4) > 1;
|
|
16037
16322
|
}
|
|
16038
16323
|
if (attachmentManager) {
|
|
16039
16324
|
attachmentManager.updateConfig({
|
|
@@ -16051,13 +16336,13 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
|
|
|
16051
16336
|
attachmentManager.clearAttachments();
|
|
16052
16337
|
}
|
|
16053
16338
|
}
|
|
16054
|
-
const sendButtonConfig = (
|
|
16055
|
-
const useIcon = (
|
|
16056
|
-
const iconText = (
|
|
16339
|
+
const sendButtonConfig = (_Ha = config.sendButton) != null ? _Ha : {};
|
|
16340
|
+
const useIcon = (_Ia = sendButtonConfig.useIcon) != null ? _Ia : false;
|
|
16341
|
+
const iconText = (_Ja = sendButtonConfig.iconText) != null ? _Ja : "\u2191";
|
|
16057
16342
|
const iconName = sendButtonConfig.iconName;
|
|
16058
|
-
const tooltipText = (
|
|
16059
|
-
const showTooltip = (
|
|
16060
|
-
const buttonSize = (
|
|
16343
|
+
const tooltipText = (_Ka = sendButtonConfig.tooltipText) != null ? _Ka : "Send message";
|
|
16344
|
+
const showTooltip = (_La = sendButtonConfig.showTooltip) != null ? _La : false;
|
|
16345
|
+
const buttonSize = (_Ma = sendButtonConfig.size) != null ? _Ma : "40px";
|
|
16061
16346
|
const backgroundColor = sendButtonConfig.backgroundColor;
|
|
16062
16347
|
const textColor = sendButtonConfig.textColor;
|
|
16063
16348
|
if (useIcon) {
|
|
@@ -16094,7 +16379,7 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
|
|
|
16094
16379
|
sendButton.classList.add("persona-bg-persona-primary");
|
|
16095
16380
|
}
|
|
16096
16381
|
} else {
|
|
16097
|
-
sendButton.textContent = (
|
|
16382
|
+
sendButton.textContent = (_Oa = (_Na = config.copy) == null ? void 0 : _Na.sendButtonLabel) != null ? _Oa : "Send";
|
|
16098
16383
|
sendButton.style.width = "";
|
|
16099
16384
|
sendButton.style.height = "";
|
|
16100
16385
|
sendButton.style.minWidth = "";
|
|
@@ -16154,7 +16439,7 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
|
|
|
16154
16439
|
} else if (tooltip) {
|
|
16155
16440
|
tooltip.style.display = "none";
|
|
16156
16441
|
}
|
|
16157
|
-
const updatedContentMaxWidth = (
|
|
16442
|
+
const updatedContentMaxWidth = (_Pa = config.layout) == null ? void 0 : _Pa.contentMaxWidth;
|
|
16158
16443
|
if (updatedContentMaxWidth) {
|
|
16159
16444
|
messagesWrapper.style.maxWidth = updatedContentMaxWidth;
|
|
16160
16445
|
messagesWrapper.style.marginLeft = "auto";
|
|
@@ -16176,8 +16461,8 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
|
|
|
16176
16461
|
composerForm.style.marginRight = "";
|
|
16177
16462
|
}
|
|
16178
16463
|
}
|
|
16179
|
-
const statusIndicatorConfig = (
|
|
16180
|
-
const isVisible = (
|
|
16464
|
+
const statusIndicatorConfig = (_Qa = config.statusIndicator) != null ? _Qa : {};
|
|
16465
|
+
const isVisible = (_Ra = statusIndicatorConfig.visible) != null ? _Ra : true;
|
|
16181
16466
|
statusText.style.display = isVisible ? "" : "none";
|
|
16182
16467
|
if (session) {
|
|
16183
16468
|
const currentStatus = session.getStatus();
|
|
@@ -16531,7 +16816,7 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
|
|
|
16531
16816
|
}
|
|
16532
16817
|
}
|
|
16533
16818
|
};
|
|
16534
|
-
const shouldExposeDebugApi = ((
|
|
16819
|
+
const shouldExposeDebugApi = ((_I = runtimeOptions == null ? void 0 : runtimeOptions.debugTools) != null ? _I : false) || Boolean(config.debug);
|
|
16535
16820
|
if (shouldExposeDebugApi && typeof window !== "undefined") {
|
|
16536
16821
|
const previousDebug = window.AgentWidgetBrowser;
|
|
16537
16822
|
const debugApi = {
|
|
@@ -16634,9 +16919,9 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
|
|
|
16634
16919
|
const voiceKey = `${persistConfig.keyPrefix}widget-voice`;
|
|
16635
16920
|
const voiceModeKey = `${persistConfig.keyPrefix}widget-voice-mode`;
|
|
16636
16921
|
if (storage) {
|
|
16637
|
-
const wasOpen = ((
|
|
16638
|
-
const wasVoiceActive = ((
|
|
16639
|
-
const wasInVoiceMode = ((
|
|
16922
|
+
const wasOpen = ((_J = persistConfig.persist) == null ? void 0 : _J.openState) && storage.getItem(openKey) === "true";
|
|
16923
|
+
const wasVoiceActive = ((_K = persistConfig.persist) == null ? void 0 : _K.voiceState) && storage.getItem(voiceKey) === "true";
|
|
16924
|
+
const wasInVoiceMode = ((_L = persistConfig.persist) == null ? void 0 : _L.voiceState) && storage.getItem(voiceModeKey) === "true";
|
|
16640
16925
|
if (wasOpen) {
|
|
16641
16926
|
setTimeout(() => {
|
|
16642
16927
|
controller.open();
|
|
@@ -16653,7 +16938,7 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
|
|
|
16653
16938
|
}, 100);
|
|
16654
16939
|
}, 0);
|
|
16655
16940
|
}
|
|
16656
|
-
if ((
|
|
16941
|
+
if ((_M = persistConfig.persist) == null ? void 0 : _M.openState) {
|
|
16657
16942
|
eventBus.on("widget:opened", () => {
|
|
16658
16943
|
storage.setItem(openKey, "true");
|
|
16659
16944
|
});
|
|
@@ -16661,7 +16946,7 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
|
|
|
16661
16946
|
storage.setItem(openKey, "false");
|
|
16662
16947
|
});
|
|
16663
16948
|
}
|
|
16664
|
-
if ((
|
|
16949
|
+
if ((_N = persistConfig.persist) == null ? void 0 : _N.voiceState) {
|
|
16665
16950
|
eventBus.on("voice:state", (event) => {
|
|
16666
16951
|
storage.setItem(voiceKey, event.active ? "true" : "false");
|
|
16667
16952
|
});
|
|
@@ -17579,6 +17864,7 @@ export {
|
|
|
17579
17864
|
ROLE_INTENSITIES,
|
|
17580
17865
|
ROLE_LINKS_FOCUS,
|
|
17581
17866
|
ROLE_PRIMARY_ACTIONS,
|
|
17867
|
+
ROLE_SCROLL_TO_BOTTOM,
|
|
17582
17868
|
ROLE_SURFACES,
|
|
17583
17869
|
ROLE_USER_MESSAGES,
|
|
17584
17870
|
SEMANTIC_COLORS_SECTION,
|