@runtypelabs/persona 3.7.0 → 3.8.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.
@@ -404,7 +404,8 @@ var DEFAULT_COMPONENTS = {
404
404
  borderRadius: "palette.radius.lg",
405
405
  border: "palette.colors.gray.200",
406
406
  shadow: "palette.shadows.sm"
407
- }
407
+ },
408
+ border: "semantic.colors.border"
408
409
  },
409
410
  toolBubble: {
410
411
  shadow: "palette.shadows.sm"
@@ -426,8 +427,30 @@ var DEFAULT_COMPONENTS = {
426
427
  },
427
428
  prose: {
428
429
  fontFamily: "inherit"
430
+ },
431
+ codeBlock: {
432
+ background: "semantic.colors.container",
433
+ borderColor: "semantic.colors.border",
434
+ textColor: "inherit"
435
+ },
436
+ table: {
437
+ headerBackground: "semantic.colors.container",
438
+ borderColor: "semantic.colors.border"
439
+ },
440
+ hr: {
441
+ color: "semantic.colors.divider"
442
+ },
443
+ blockquote: {
444
+ borderColor: "palette.colors.gray.900",
445
+ background: "transparent",
446
+ textColor: "palette.colors.gray.500"
429
447
  }
430
448
  },
449
+ collapsibleWidget: {
450
+ container: "palette.colors.gray.50",
451
+ surface: "semantic.colors.surface",
452
+ border: "semantic.colors.border"
453
+ },
431
454
  voice: {
432
455
  recording: {
433
456
  indicator: "palette.colors.error.500",
@@ -660,7 +683,7 @@ function createTheme(userConfig, options = {}) {
660
683
  return theme;
661
684
  }
662
685
  function themeToCssVariables(theme) {
663
- 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;
686
+ 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, _Ra, _Sa, _Ta, _Ua, _Va, _Wa, _Xa, _Ya, _Za, __a, _$a, _ab, _bb;
664
687
  const resolved = resolveTokens(theme);
665
688
  const cssVars = {};
666
689
  for (const [path, token] of Object.entries(resolved)) {
@@ -761,6 +784,19 @@ function themeToCssVariables(theme) {
761
784
  if (mdProseFont && mdProseFont !== "inherit") {
762
785
  cssVars["--persona-md-prose-font-family"] = mdProseFont;
763
786
  }
787
+ cssVars["--persona-md-code-block-bg"] = (_La = cssVars["--persona-components-markdown-codeBlock-background"]) != null ? _La : cssVars["--persona-container"];
788
+ cssVars["--persona-md-code-block-border-color"] = (_Ma = cssVars["--persona-components-markdown-codeBlock-borderColor"]) != null ? _Ma : cssVars["--persona-border"];
789
+ cssVars["--persona-md-code-block-text-color"] = (_Na = cssVars["--persona-components-markdown-codeBlock-textColor"]) != null ? _Na : "inherit";
790
+ cssVars["--persona-md-table-header-bg"] = (_Oa = cssVars["--persona-components-markdown-table-headerBackground"]) != null ? _Oa : cssVars["--persona-container"];
791
+ cssVars["--persona-md-table-border-color"] = (_Pa = cssVars["--persona-components-markdown-table-borderColor"]) != null ? _Pa : cssVars["--persona-border"];
792
+ cssVars["--persona-md-hr-color"] = (_Qa = cssVars["--persona-components-markdown-hr-color"]) != null ? _Qa : cssVars["--persona-divider"];
793
+ cssVars["--persona-md-blockquote-border-color"] = (_Ra = cssVars["--persona-components-markdown-blockquote-borderColor"]) != null ? _Ra : cssVars["--persona-palette-colors-gray-900"];
794
+ cssVars["--persona-md-blockquote-bg"] = (_Sa = cssVars["--persona-components-markdown-blockquote-background"]) != null ? _Sa : "transparent";
795
+ cssVars["--persona-md-blockquote-text-color"] = (_Ta = cssVars["--persona-components-markdown-blockquote-textColor"]) != null ? _Ta : cssVars["--persona-palette-colors-gray-500"];
796
+ cssVars["--cw-container"] = (_Ua = cssVars["--persona-components-collapsibleWidget-container"]) != null ? _Ua : cssVars["--persona-surface"];
797
+ cssVars["--cw-surface"] = (_Va = cssVars["--persona-components-collapsibleWidget-surface"]) != null ? _Va : cssVars["--persona-surface"];
798
+ cssVars["--cw-border"] = (_Wa = cssVars["--persona-components-collapsibleWidget-border"]) != null ? _Wa : cssVars["--persona-border"];
799
+ cssVars["--persona-message-border"] = (_Xa = cssVars["--persona-components-message-border"]) != null ? _Xa : cssVars["--persona-border"];
764
800
  const components = theme.components;
765
801
  const iconBtn = components == null ? void 0 : components.iconButton;
766
802
  if (iconBtn) {
@@ -807,23 +843,23 @@ function themeToCssVariables(theme) {
807
843
  if (t.copyPadding) cssVars["--persona-artifact-toolbar-copy-padding"] = t.copyPadding;
808
844
  if (t.copyMenuBackground) {
809
845
  cssVars["--persona-artifact-toolbar-copy-menu-bg"] = t.copyMenuBackground;
810
- cssVars["--persona-dropdown-bg"] = (_La = cssVars["--persona-dropdown-bg"]) != null ? _La : t.copyMenuBackground;
846
+ cssVars["--persona-dropdown-bg"] = (_Ya = cssVars["--persona-dropdown-bg"]) != null ? _Ya : t.copyMenuBackground;
811
847
  }
812
848
  if (t.copyMenuBorder) {
813
849
  cssVars["--persona-artifact-toolbar-copy-menu-border"] = t.copyMenuBorder;
814
- cssVars["--persona-dropdown-border"] = (_Ma = cssVars["--persona-dropdown-border"]) != null ? _Ma : t.copyMenuBorder;
850
+ cssVars["--persona-dropdown-border"] = (_Za = cssVars["--persona-dropdown-border"]) != null ? _Za : t.copyMenuBorder;
815
851
  }
816
852
  if (t.copyMenuShadow) {
817
853
  cssVars["--persona-artifact-toolbar-copy-menu-shadow"] = t.copyMenuShadow;
818
- cssVars["--persona-dropdown-shadow"] = (_Na = cssVars["--persona-dropdown-shadow"]) != null ? _Na : t.copyMenuShadow;
854
+ cssVars["--persona-dropdown-shadow"] = (__a = cssVars["--persona-dropdown-shadow"]) != null ? __a : t.copyMenuShadow;
819
855
  }
820
856
  if (t.copyMenuBorderRadius) {
821
857
  cssVars["--persona-artifact-toolbar-copy-menu-radius"] = t.copyMenuBorderRadius;
822
- cssVars["--persona-dropdown-radius"] = (_Oa = cssVars["--persona-dropdown-radius"]) != null ? _Oa : t.copyMenuBorderRadius;
858
+ cssVars["--persona-dropdown-radius"] = (_$a = cssVars["--persona-dropdown-radius"]) != null ? _$a : t.copyMenuBorderRadius;
823
859
  }
824
860
  if (t.copyMenuItemHoverBackground) {
825
861
  cssVars["--persona-artifact-toolbar-copy-menu-item-hover-bg"] = t.copyMenuItemHoverBackground;
826
- cssVars["--persona-dropdown-item-hover-bg"] = (_Pa = cssVars["--persona-dropdown-item-hover-bg"]) != null ? _Pa : t.copyMenuItemHoverBackground;
862
+ cssVars["--persona-dropdown-item-hover-bg"] = (_ab = cssVars["--persona-dropdown-item-hover-bg"]) != null ? _ab : t.copyMenuItemHoverBackground;
827
863
  }
828
864
  if (t.iconBackground) cssVars["--persona-artifact-toolbar-icon-bg"] = t.iconBackground;
829
865
  if (t.toolbarBorder) cssVars["--persona-artifact-toolbar-border"] = t.toolbarBorder;
@@ -843,7 +879,7 @@ function themeToCssVariables(theme) {
843
879
  if (artifact == null ? void 0 : artifact.pane) {
844
880
  const t = artifact.pane;
845
881
  if (t.toolbarBackground) {
846
- const toolbarBg = (_Qa = resolveTokenValue(theme, t.toolbarBackground)) != null ? _Qa : t.toolbarBackground;
882
+ const toolbarBg = (_bb = resolveTokenValue(theme, t.toolbarBackground)) != null ? _bb : t.toolbarBackground;
847
883
  cssVars["--persona-artifact-toolbar-bg"] = toolbarBg;
848
884
  }
849
885
  }
@@ -7799,6 +7835,70 @@ var statusCopy = {
7799
7835
  connected: "Streaming\u2026",
7800
7836
  error: "Offline"
7801
7837
  };
7838
+ var DEFAULT_OVERLAY_Z_INDEX = 1e5;
7839
+ var PORTALED_OVERLAY_Z_INDEX = DEFAULT_OVERLAY_Z_INDEX + 1;
7840
+
7841
+ // src/utils/overlay-host-stacking.ts
7842
+ function syncOverlayHostStacking(host, zIndex = DEFAULT_OVERLAY_Z_INDEX) {
7843
+ const originalPosition = host.style.position;
7844
+ const originalZIndex = host.style.zIndex;
7845
+ const originalIsolation = host.style.isolation;
7846
+ const computed = getComputedStyle(host);
7847
+ const positionWasSet = computed.position === "static" || computed.position === "";
7848
+ if (positionWasSet) {
7849
+ host.style.position = "relative";
7850
+ }
7851
+ host.style.zIndex = String(zIndex);
7852
+ host.style.isolation = "isolate";
7853
+ return () => {
7854
+ if (positionWasSet) {
7855
+ host.style.position = originalPosition;
7856
+ }
7857
+ host.style.zIndex = originalZIndex;
7858
+ host.style.isolation = originalIsolation;
7859
+ };
7860
+ }
7861
+
7862
+ // src/utils/scroll-lock.ts
7863
+ var lockCount = 0;
7864
+ var savedState = null;
7865
+ function acquireScrollLock(doc = document) {
7866
+ var _a;
7867
+ lockCount++;
7868
+ if (lockCount === 1) {
7869
+ const body = doc.body;
7870
+ const win = (_a = doc.defaultView) != null ? _a : window;
7871
+ const scrollY = win.scrollY || doc.documentElement.scrollTop;
7872
+ savedState = {
7873
+ originalOverflow: body.style.overflow,
7874
+ originalPosition: body.style.position,
7875
+ originalTop: body.style.top,
7876
+ originalWidth: body.style.width,
7877
+ scrollY
7878
+ };
7879
+ body.style.overflow = "hidden";
7880
+ body.style.position = "fixed";
7881
+ body.style.top = `-${scrollY}px`;
7882
+ body.style.width = "100%";
7883
+ }
7884
+ let released = false;
7885
+ return () => {
7886
+ var _a2;
7887
+ if (released) return;
7888
+ released = true;
7889
+ lockCount = Math.max(0, lockCount - 1);
7890
+ if (lockCount === 0 && savedState) {
7891
+ const body = doc.body;
7892
+ const win = (_a2 = doc.defaultView) != null ? _a2 : window;
7893
+ body.style.overflow = savedState.originalOverflow;
7894
+ body.style.position = savedState.originalPosition;
7895
+ body.style.top = savedState.originalTop;
7896
+ body.style.width = savedState.originalWidth;
7897
+ win.scrollTo(0, savedState.scrollY);
7898
+ savedState = null;
7899
+ }
7900
+ };
7901
+ }
7802
7902
 
7803
7903
  // src/utils/dock.ts
7804
7904
  var DEFAULT_DOCK_CONFIG = {
@@ -7845,7 +7945,7 @@ var createLauncherButton = (config, onToggle) => {
7845
7945
  `;
7846
7946
  button.addEventListener("click", onToggle);
7847
7947
  const update = (newConfig) => {
7848
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
7948
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
7849
7949
  const launcher = (_a = newConfig.launcher) != null ? _a : {};
7850
7950
  const dockedMode = isDockedMountMode(newConfig);
7851
7951
  const titleEl = button.querySelector("[data-role='launcher-title']");
@@ -7956,13 +8056,16 @@ var createLauncherButton = (config, onToggle) => {
7956
8056
  }
7957
8057
  }
7958
8058
  const positionClass = launcher.position && positionMap[launcher.position] ? positionMap[launcher.position] : positionMap["bottom-right"];
7959
- const floatingBase = "persona-fixed persona-flex persona-items-center persona-gap-3 persona-rounded-launcher persona-bg-persona-surface persona-py-2.5 persona-pl-3 persona-pr-3 persona-transition hover:persona-translate-y-[-2px] persona-cursor-pointer persona-z-50";
8059
+ const floatingBase = "persona-fixed persona-flex persona-items-center persona-gap-3 persona-rounded-launcher persona-bg-persona-surface persona-py-2.5 persona-pl-3 persona-pr-3 persona-transition hover:persona-translate-y-[-2px] persona-cursor-pointer";
7960
8060
  const dockedBase = "persona-relative persona-mt-4 persona-mb-4 persona-mx-auto persona-flex persona-items-center persona-justify-center persona-rounded-launcher persona-bg-persona-surface persona-transition hover:persona-translate-y-[-2px] persona-cursor-pointer";
7961
8061
  button.className = dockedMode ? dockedBase : `${floatingBase} ${positionClass}`;
8062
+ if (!dockedMode) {
8063
+ button.style.zIndex = String((_k = launcher.zIndex) != null ? _k : DEFAULT_OVERLAY_Z_INDEX);
8064
+ }
7962
8065
  const defaultBorder = "1px solid var(--persona-border, #e5e7eb)";
7963
8066
  const defaultShadow = "var(--persona-shadow, 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1))";
7964
- button.style.border = (_k = launcher.border) != null ? _k : defaultBorder;
7965
- button.style.boxShadow = (_l = launcher.shadow) != null ? _l : defaultShadow;
8067
+ button.style.border = (_l = launcher.border) != null ? _l : defaultBorder;
8068
+ button.style.boxShadow = (_m = launcher.shadow) != null ? _m : defaultShadow;
7966
8069
  if (dockedMode) {
7967
8070
  button.style.width = "0";
7968
8071
  button.style.minWidth = "0";
@@ -7974,7 +8077,7 @@ var createLauncherButton = (config, onToggle) => {
7974
8077
  } else {
7975
8078
  button.style.width = "";
7976
8079
  button.style.minWidth = "";
7977
- button.style.maxWidth = (_m = launcher.collapsedMaxWidth) != null ? _m : "";
8080
+ button.style.maxWidth = (_n = launcher.collapsedMaxWidth) != null ? _n : "";
7978
8081
  button.style.justifyContent = "";
7979
8082
  button.style.padding = "";
7980
8083
  button.style.overflow = "";
@@ -8144,6 +8247,7 @@ var buildHeader = (context) => {
8144
8247
  portaledTooltip.appendChild(arrow);
8145
8248
  const buttonRect = clearChatButton.getBoundingClientRect();
8146
8249
  portaledTooltip.style.position = "fixed";
8250
+ portaledTooltip.style.zIndex = String(PORTALED_OVERLAY_Z_INDEX);
8147
8251
  portaledTooltip.style.left = `${buttonRect.left + buttonRect.width / 2}px`;
8148
8252
  portaledTooltip.style.top = `${buttonRect.top - 8}px`;
8149
8253
  portaledTooltip.style.transform = "translate(-50%, -100%)";
@@ -8255,6 +8359,7 @@ var buildHeader = (context) => {
8255
8359
  portaledTooltip.appendChild(arrow);
8256
8360
  const buttonRect = closeButton.getBoundingClientRect();
8257
8361
  portaledTooltip.style.position = "fixed";
8362
+ portaledTooltip.style.zIndex = String(PORTALED_OVERLAY_Z_INDEX);
8258
8363
  portaledTooltip.style.left = `${buttonRect.left + buttonRect.width / 2}px`;
8259
8364
  portaledTooltip.style.top = `${buttonRect.top - 8}px`;
8260
8365
  portaledTooltip.style.transform = "translate(-50%, -100%)";
@@ -8316,7 +8421,7 @@ function createDropdownMenu(options) {
8316
8421
  menu.setAttribute("data-persona-theme-zone", "dropdown");
8317
8422
  if (portal) {
8318
8423
  menu.style.position = "fixed";
8319
- menu.style.zIndex = "10000";
8424
+ menu.style.zIndex = String(PORTALED_OVERLAY_Z_INDEX);
8320
8425
  } else {
8321
8426
  menu.style.position = "absolute";
8322
8427
  menu.style.top = "100%";
@@ -9159,7 +9264,7 @@ var buildComposer = (context) => {
9159
9264
 
9160
9265
  // src/components/panel.ts
9161
9266
  var createWrapper = (config) => {
9162
- var _a, _b, _c, _d, _e, _f, _g;
9267
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i;
9163
9268
  const launcherEnabled = (_b = (_a = config == null ? void 0 : config.launcher) == null ? void 0 : _a.enabled) != null ? _b : true;
9164
9269
  const dockedMode = isDockedMountMode(config);
9165
9270
  if (dockedMode) {
@@ -9193,13 +9298,14 @@ var createWrapper = (config) => {
9193
9298
  const position = launcher.position && positionMap[launcher.position] ? positionMap[launcher.position] : positionMap["bottom-right"];
9194
9299
  const wrapper = createElement(
9195
9300
  "div",
9196
- `persona-widget-wrapper persona-fixed ${position} persona-z-50 persona-transition`
9301
+ `persona-widget-wrapper persona-fixed ${position} persona-transition`
9197
9302
  );
9303
+ wrapper.style.zIndex = String((_g = (_f = config == null ? void 0 : config.launcher) == null ? void 0 : _f.zIndex) != null ? _g : DEFAULT_OVERLAY_Z_INDEX);
9198
9304
  const panel = createElement(
9199
9305
  "div",
9200
9306
  "persona-widget-panel persona-relative persona-min-h-[320px]"
9201
9307
  );
9202
- const launcherWidth = (_g = (_f = config == null ? void 0 : config.launcher) == null ? void 0 : _f.width) != null ? _g : config == null ? void 0 : config.launcherWidth;
9308
+ const launcherWidth = (_i = (_h = config == null ? void 0 : config.launcher) == null ? void 0 : _h.width) != null ? _i : config == null ? void 0 : config.launcherWidth;
9203
9309
  const width = launcherWidth != null ? launcherWidth : "min(400px, calc(100vw - 24px))";
9204
9310
  panel.style.width = width;
9205
9311
  panel.style.maxWidth = width;
@@ -11421,7 +11527,7 @@ function renderDefaultArtifactCard(props, _context) {
11421
11527
  const root = document.createElement("div");
11422
11528
  root.className = "persona-flex persona-w-full persona-max-w-full persona-items-center persona-gap-3 persona-rounded-xl persona-px-4 persona-py-3";
11423
11529
  root.style.border = "1px solid var(--persona-border, #e5e7eb)";
11424
- root.style.backgroundColor = "var(--persona-bg, #ffffff)";
11530
+ root.style.backgroundColor = "var(--persona-surface, #ffffff)";
11425
11531
  root.style.cursor = "pointer";
11426
11532
  root.tabIndex = 0;
11427
11533
  root.setAttribute("role", "button");
@@ -13919,7 +14025,7 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
13919
14025
  }
13920
14026
  mount.appendChild(wrapper);
13921
14027
  const applyFullHeightStyles = () => {
13922
- var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m2, _n2, _o2, _p2, _q2, _r2, _s2, _t2, _u2, _v2;
14028
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m2, _n2, _o2, _p2, _q2, _r2, _s2, _t2, _u2, _v2, _w2;
13923
14029
  const dockedMode = isDockedMountMode(config);
13924
14030
  const sidebarMode = (_b2 = (_a2 = config.launcher) == null ? void 0 : _a2.sidebarMode) != null ? _b2 : false;
13925
14031
  const fullHeight = dockedMode || sidebarMode || ((_d2 = (_c2 = config.launcher) == null ? void 0 : _c2.fullHeight) != null ? _d2 : false);
@@ -13938,7 +14044,7 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
13938
14044
  const shouldGoFullscreen = mobileFullscreen && isMobileViewport && launcherEnabled;
13939
14045
  const position = (_n2 = (_m2 = config.launcher) == null ? void 0 : _m2.position) != null ? _n2 : "bottom-left";
13940
14046
  const isLeftSidebar = position === "bottom-left" || position === "top-left";
13941
- const overlayZIndex = (_p2 = (_o2 = config.launcher) == null ? void 0 : _o2.zIndex) != null ? _p2 : 9999;
14047
+ const overlayZIndex = (_p2 = (_o2 = config.launcher) == null ? void 0 : _o2.zIndex) != null ? _p2 : DEFAULT_OVERLAY_Z_INDEX;
13942
14048
  let defaultPanelBorder = sidebarMode || shouldGoFullscreen ? "none" : "1px solid var(--persona-border)";
13943
14049
  let defaultPanelShadow = shouldGoFullscreen ? "none" : sidebarMode ? isLeftSidebar ? "var(--persona-palette-shadows-sidebar-left, 2px 0 12px rgba(0, 0, 0, 0.08))" : "var(--persona-palette-shadows-sidebar-right, -2px 0 12px rgba(0, 0, 0, 0.08))" : "var(--persona-palette-shadows-xl, 0 25px 50px -12px rgba(0, 0, 0, 0.25))";
13944
14050
  if (dockedMode && !shouldGoFullscreen) {
@@ -14149,7 +14255,7 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
14149
14255
  if (!isInlineEmbed && !dockedMode) {
14150
14256
  const maxHeightStyles = "max-height: -moz-available !important; max-height: stretch !important;";
14151
14257
  const paddingStyles = sidebarMode ? "" : "padding-top: 1.25em !important;";
14152
- const zIndexStyles = !sidebarMode && ((_v2 = config.launcher) == null ? void 0 : _v2.zIndex) != null ? `z-index: ${config.launcher.zIndex} !important;` : "";
14258
+ const zIndexStyles = !sidebarMode ? `z-index: ${(_w2 = (_v2 = config.launcher) == null ? void 0 : _v2.zIndex) != null ? _w2 : DEFAULT_OVERLAY_Z_INDEX} !important;` : "";
14153
14259
  wrapper.style.cssText += maxHeightStyles + paddingStyles + zIndexStyles;
14154
14260
  }
14155
14261
  };
@@ -14158,6 +14264,14 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
14158
14264
  applyArtifactLayoutCssVars(mount, config);
14159
14265
  applyArtifactPaneAppearance(mount, config);
14160
14266
  const destroyCallbacks = [];
14267
+ let teardownHostStacking = null;
14268
+ let releaseScrollLock = null;
14269
+ destroyCallbacks.push(() => {
14270
+ teardownHostStacking == null ? void 0 : teardownHostStacking();
14271
+ teardownHostStacking = null;
14272
+ releaseScrollLock == null ? void 0 : releaseScrollLock();
14273
+ releaseScrollLock = null;
14274
+ });
14161
14275
  if (artifactPanelResizeObs) {
14162
14276
  destroyCallbacks.push(() => {
14163
14277
  artifactPanelResizeObs == null ? void 0 : artifactPanelResizeObs.disconnect();
@@ -14323,7 +14437,8 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
14323
14437
  container.appendChild(scrollToBottomButton);
14324
14438
  }
14325
14439
  updateScrollToBottomButtonOffset();
14326
- scrollToBottomButton.style.display = autoFollow.isFollowing() ? "none" : "";
14440
+ const hasOverflow = getScrollBottomOffset(body) > 0;
14441
+ scrollToBottomButton.style.display = autoFollow.isFollowing() || !hasOverflow ? "none" : "";
14327
14442
  };
14328
14443
  const pauseAutoScroll = () => {
14329
14444
  if (!autoFollow.pause()) return;
@@ -14770,11 +14885,42 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
14770
14885
  }
14771
14886
  };
14772
14887
  const setOpenState = (nextOpen, source = "user") => {
14888
+ var _a2, _b2;
14773
14889
  if (!launcherEnabled) return;
14774
14890
  if (open === nextOpen) return;
14775
14891
  const prevOpen = open;
14776
14892
  open = nextOpen;
14777
14893
  updateOpenState();
14894
+ const isViewportCovering = (() => {
14895
+ var _a3, _b3, _c2, _d2, _e2, _f2, _g2;
14896
+ const sm = (_b3 = (_a3 = config.launcher) == null ? void 0 : _a3.sidebarMode) != null ? _b3 : false;
14897
+ const ow = (_c2 = mount.ownerDocument.defaultView) != null ? _c2 : window;
14898
+ const mf = (_e2 = (_d2 = config.launcher) == null ? void 0 : _d2.mobileFullscreen) != null ? _e2 : true;
14899
+ const mb = (_g2 = (_f2 = config.launcher) == null ? void 0 : _f2.mobileBreakpoint) != null ? _g2 : 640;
14900
+ const isMobile = ow.innerWidth <= mb;
14901
+ const dockedMF = isDockedMountMode(config) && mf && isMobile;
14902
+ return sm || mf && isMobile && launcherEnabled || dockedMF;
14903
+ })();
14904
+ if (open && isViewportCovering) {
14905
+ if (!teardownHostStacking) {
14906
+ const root = mount.getRootNode();
14907
+ const hostEl = root instanceof ShadowRoot ? root.host : mount.closest(".persona-host");
14908
+ if (hostEl) {
14909
+ teardownHostStacking = syncOverlayHostStacking(
14910
+ hostEl,
14911
+ (_b2 = (_a2 = config.launcher) == null ? void 0 : _a2.zIndex) != null ? _b2 : DEFAULT_OVERLAY_Z_INDEX
14912
+ );
14913
+ }
14914
+ }
14915
+ if (!releaseScrollLock) {
14916
+ releaseScrollLock = acquireScrollLock(mount.ownerDocument);
14917
+ }
14918
+ } else if (!open) {
14919
+ teardownHostStacking == null ? void 0 : teardownHostStacking();
14920
+ teardownHostStacking = null;
14921
+ releaseScrollLock == null ? void 0 : releaseScrollLock();
14922
+ releaseScrollLock = null;
14923
+ }
14778
14924
  if (open) {
14779
14925
  recalcPanelHeight();
14780
14926
  scheduleAutoScroll(true);
@@ -15466,7 +15612,7 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
15466
15612
  }
15467
15613
  }
15468
15614
  const recalcPanelHeight = () => {
15469
- var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m2;
15615
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m2, _n2, _o2, _p2, _q2, _r2, _s2, _t2, _u2, _v2;
15470
15616
  const dockedMode = isDockedMountMode(config);
15471
15617
  const sidebarMode = (_b2 = (_a2 = config.launcher) == null ? void 0 : _a2.sidebarMode) != null ? _b2 : false;
15472
15618
  const fullHeight = dockedMode || sidebarMode || ((_d2 = (_c2 = config.launcher) == null ? void 0 : _c2.fullHeight) != null ? _d2 : false);
@@ -15510,6 +15656,30 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
15510
15656
  } finally {
15511
15657
  updateScrollToBottomButtonOffset();
15512
15658
  updateOpenState();
15659
+ if (open && launcherEnabled) {
15660
+ const ow = (_n2 = mount.ownerDocument.defaultView) != null ? _n2 : window;
15661
+ const isMobile = ow.innerWidth <= ((_p2 = (_o2 = config.launcher) == null ? void 0 : _o2.mobileBreakpoint) != null ? _p2 : 640);
15662
+ const sm = (_r2 = (_q2 = config.launcher) == null ? void 0 : _q2.sidebarMode) != null ? _r2 : false;
15663
+ const mf = (_t2 = (_s2 = config.launcher) == null ? void 0 : _s2.mobileFullscreen) != null ? _t2 : true;
15664
+ const dockedMF = isDockedMountMode(config) && mf && isMobile;
15665
+ const isVC = sm || mf && isMobile && launcherEnabled || dockedMF;
15666
+ if (isVC && !releaseScrollLock) {
15667
+ const root = mount.getRootNode();
15668
+ const hostEl = root instanceof ShadowRoot ? root.host : mount.closest(".persona-host");
15669
+ if (hostEl && !teardownHostStacking) {
15670
+ teardownHostStacking = syncOverlayHostStacking(
15671
+ hostEl,
15672
+ (_v2 = (_u2 = config.launcher) == null ? void 0 : _u2.zIndex) != null ? _v2 : DEFAULT_OVERLAY_Z_INDEX
15673
+ );
15674
+ }
15675
+ releaseScrollLock = acquireScrollLock(mount.ownerDocument);
15676
+ } else if (!isVC) {
15677
+ teardownHostStacking == null ? void 0 : teardownHostStacking();
15678
+ teardownHostStacking = null;
15679
+ releaseScrollLock == null ? void 0 : releaseScrollLock();
15680
+ releaseScrollLock = null;
15681
+ }
15682
+ }
15513
15683
  }
15514
15684
  };
15515
15685
  recalcPanelHeight();
@@ -15596,6 +15766,7 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
15596
15766
  clearChatButton.addEventListener("click", () => {
15597
15767
  session.clearMessages();
15598
15768
  messageCache.clear();
15769
+ resumeAutoScroll();
15599
15770
  try {
15600
15771
  localStorage.removeItem(DEFAULT_CHAT_HISTORY_STORAGE_KEY);
15601
15772
  if (config.debug) {
@@ -16044,6 +16215,7 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
16044
16215
  portaledTooltip.appendChild(arrow);
16045
16216
  const buttonRect = closeButton.getBoundingClientRect();
16046
16217
  portaledTooltip.style.position = "fixed";
16218
+ portaledTooltip.style.zIndex = String(PORTALED_OVERLAY_Z_INDEX);
16047
16219
  portaledTooltip.style.left = `${buttonRect.left + buttonRect.width / 2}px`;
16048
16220
  portaledTooltip.style.top = `${buttonRect.top - 8}px`;
16049
16221
  portaledTooltip.style.transform = "translate(-50%, -100%)";
@@ -16195,6 +16367,7 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
16195
16367
  portaledTooltip.appendChild(arrow);
16196
16368
  const buttonRect = clearChatButton.getBoundingClientRect();
16197
16369
  portaledTooltip.style.position = "fixed";
16370
+ portaledTooltip.style.zIndex = String(PORTALED_OVERLAY_Z_INDEX);
16198
16371
  portaledTooltip.style.left = `${buttonRect.left + buttonRect.width / 2}px`;
16199
16372
  portaledTooltip.style.top = `${buttonRect.top - 8}px`;
16200
16373
  portaledTooltip.style.transform = "translate(-50%, -100%)";
@@ -16601,6 +16774,7 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
16601
16774
  artifactsPaneUserHidden = false;
16602
16775
  session.clearMessages();
16603
16776
  messageCache.clear();
16777
+ resumeAutoScroll();
16604
16778
  try {
16605
16779
  localStorage.removeItem(DEFAULT_CHAT_HISTORY_STORAGE_KEY);
16606
16780
  if (config.debug) {
@@ -17224,7 +17398,7 @@ var applyDockStyles = (shell, pushTrack, contentSlot, dockSlot, host, config, ex
17224
17398
  dockSlot.style.minWidth = "0";
17225
17399
  dockSlot.style.minHeight = "0";
17226
17400
  dockSlot.style.overflow = "hidden";
17227
- dockSlot.style.zIndex = String((_f = (_e = config == null ? void 0 : config.launcher) == null ? void 0 : _e.zIndex) != null ? _f : 9999);
17401
+ dockSlot.style.zIndex = String((_f = (_e = config == null ? void 0 : config.launcher) == null ? void 0 : _e.zIndex) != null ? _f : DEFAULT_OVERLAY_Z_INDEX);
17228
17402
  dockSlot.style.transform = "none";
17229
17403
  dockSlot.style.transition = "none";
17230
17404
  dockSlot.style.pointerEvents = "auto";
@@ -214,6 +214,17 @@ interface MessageTokens {
214
214
  /** Assistant bubble box-shadow (token ref or raw CSS, e.g. `none`). */
215
215
  shadow?: string;
216
216
  };
217
+ /** Border color between messages in the thread. */
218
+ border?: TokenReference<'color'>;
219
+ }
220
+ /** Collapsible widget chrome (tool bubbles, reasoning bubbles, approval bubbles). */
221
+ interface CollapsibleWidgetTokens {
222
+ /** Background for content areas. */
223
+ container?: TokenReference<'color'>;
224
+ /** Background for code blocks inside collapsible sections. */
225
+ surface?: TokenReference<'color'>;
226
+ /** Border color for collapsible sections. */
227
+ border?: TokenReference<'color'>;
217
228
  }
218
229
  interface MarkdownTokens {
219
230
  inlineCode: {
@@ -242,6 +253,27 @@ interface MarkdownTokens {
242
253
  fontWeight?: string;
243
254
  };
244
255
  };
256
+ /** Fenced code block styling. */
257
+ codeBlock?: {
258
+ background?: TokenReference<'color'>;
259
+ borderColor?: TokenReference<'color'>;
260
+ textColor?: TokenReference<'color'>;
261
+ };
262
+ /** Table styling. */
263
+ table?: {
264
+ headerBackground?: TokenReference<'color'>;
265
+ borderColor?: TokenReference<'color'>;
266
+ };
267
+ /** Horizontal rule styling. */
268
+ hr?: {
269
+ color?: TokenReference<'color'>;
270
+ };
271
+ /** Blockquote styling. */
272
+ blockquote?: {
273
+ borderColor?: TokenReference<'color'>;
274
+ background?: TokenReference<'color'>;
275
+ textColor?: TokenReference<'color'>;
276
+ };
245
277
  }
246
278
  interface VoiceTokens {
247
279
  recording: {
@@ -404,6 +436,8 @@ interface ComponentTokens {
404
436
  tab?: ArtifactTabTokens;
405
437
  pane?: ArtifactPaneTokens;
406
438
  };
439
+ /** Collapsible widget chrome (tool/reasoning/approval bubbles). */
440
+ collapsibleWidget?: CollapsibleWidgetTokens;
407
441
  }
408
442
  interface PaletteExtras {
409
443
  transitions?: Record<string, string>;
@@ -1319,11 +1353,16 @@ type AgentWidgetLauncherConfig = {
1319
1353
  */
1320
1354
  mobileBreakpoint?: number;
1321
1355
  /**
1322
- * CSS z-index applied to the widget wrapper when it is in a positioned mode
1323
- * (floating panel, mobile fullscreen, or sidebar). Increase this value if
1324
- * other elements on the host page appear on top of the widget.
1356
+ * CSS z-index applied to the widget wrapper and launcher button in all
1357
+ * positioned modes (floating panel, mobile fullscreen, sidebar, docked
1358
+ * mobile fullscreen). Increase this value if other elements on the host
1359
+ * page appear on top of the widget.
1360
+ *
1361
+ * In viewport-covering modes (sidebar, mobile fullscreen), the widget
1362
+ * also elevates the host element's stacking context and locks
1363
+ * document scroll to prevent background scrolling.
1325
1364
  *
1326
- * @default 9999 in overlay modes (mobile fullscreen / sidebar); 50 for the regular floating panel
1365
+ * @default 100000
1327
1366
  */
1328
1367
  zIndex?: number;
1329
1368
  callToActionIconText?: string;
@@ -214,6 +214,17 @@ interface MessageTokens {
214
214
  /** Assistant bubble box-shadow (token ref or raw CSS, e.g. `none`). */
215
215
  shadow?: string;
216
216
  };
217
+ /** Border color between messages in the thread. */
218
+ border?: TokenReference<'color'>;
219
+ }
220
+ /** Collapsible widget chrome (tool bubbles, reasoning bubbles, approval bubbles). */
221
+ interface CollapsibleWidgetTokens {
222
+ /** Background for content areas. */
223
+ container?: TokenReference<'color'>;
224
+ /** Background for code blocks inside collapsible sections. */
225
+ surface?: TokenReference<'color'>;
226
+ /** Border color for collapsible sections. */
227
+ border?: TokenReference<'color'>;
217
228
  }
218
229
  interface MarkdownTokens {
219
230
  inlineCode: {
@@ -242,6 +253,27 @@ interface MarkdownTokens {
242
253
  fontWeight?: string;
243
254
  };
244
255
  };
256
+ /** Fenced code block styling. */
257
+ codeBlock?: {
258
+ background?: TokenReference<'color'>;
259
+ borderColor?: TokenReference<'color'>;
260
+ textColor?: TokenReference<'color'>;
261
+ };
262
+ /** Table styling. */
263
+ table?: {
264
+ headerBackground?: TokenReference<'color'>;
265
+ borderColor?: TokenReference<'color'>;
266
+ };
267
+ /** Horizontal rule styling. */
268
+ hr?: {
269
+ color?: TokenReference<'color'>;
270
+ };
271
+ /** Blockquote styling. */
272
+ blockquote?: {
273
+ borderColor?: TokenReference<'color'>;
274
+ background?: TokenReference<'color'>;
275
+ textColor?: TokenReference<'color'>;
276
+ };
245
277
  }
246
278
  interface VoiceTokens {
247
279
  recording: {
@@ -404,6 +436,8 @@ interface ComponentTokens {
404
436
  tab?: ArtifactTabTokens;
405
437
  pane?: ArtifactPaneTokens;
406
438
  };
439
+ /** Collapsible widget chrome (tool/reasoning/approval bubbles). */
440
+ collapsibleWidget?: CollapsibleWidgetTokens;
407
441
  }
408
442
  interface PaletteExtras {
409
443
  transitions?: Record<string, string>;
@@ -1319,11 +1353,16 @@ type AgentWidgetLauncherConfig = {
1319
1353
  */
1320
1354
  mobileBreakpoint?: number;
1321
1355
  /**
1322
- * CSS z-index applied to the widget wrapper when it is in a positioned mode
1323
- * (floating panel, mobile fullscreen, or sidebar). Increase this value if
1324
- * other elements on the host page appear on top of the widget.
1356
+ * CSS z-index applied to the widget wrapper and launcher button in all
1357
+ * positioned modes (floating panel, mobile fullscreen, sidebar, docked
1358
+ * mobile fullscreen). Increase this value if other elements on the host
1359
+ * page appear on top of the widget.
1360
+ *
1361
+ * In viewport-covering modes (sidebar, mobile fullscreen), the widget
1362
+ * also elevates the host element's stacking context and locks
1363
+ * document scroll to prevent background scrolling.
1325
1364
  *
1326
- * @default 9999 in overlay modes (mobile fullscreen / sidebar); 50 for the regular floating panel
1365
+ * @default 100000
1327
1366
  */
1328
1367
  zIndex?: number;
1329
1368
  callToActionIconText?: string;