vanilla-agent 1.18.0 → 1.20.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vanilla-agent",
3
- "version": "1.18.0",
3
+ "version": "1.20.0",
4
4
  "description": "Themeable, plugable streaming agent widget for websites, in plain JS with support for voice input and reasoning / tool output.",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",
@@ -18,12 +18,18 @@ export const createWrapper = (config?: AgentWidgetConfig): PanelWrapper => {
18
18
  // and only the chat messages area scrolls
19
19
  const wrapper = createElement(
20
20
  "div",
21
- "tvw-relative tvw-w-full tvw-h-full tvw-flex tvw-flex-col tvw-flex-1 tvw-min-h-0"
21
+ "tvw-relative tvw-h-full tvw-flex tvw-flex-col tvw-flex-1 tvw-min-h-0"
22
22
  );
23
23
  const panel = createElement(
24
24
  "div",
25
- "tvw-relative tvw-w-full tvw-flex-1 tvw-flex tvw-flex-col tvw-min-h-0"
25
+ "tvw-relative tvw-flex-1 tvw-flex tvw-flex-col tvw-min-h-0"
26
26
  );
27
+
28
+ // Apply width from config, defaulting to 100% for inline embed mode
29
+ const inlineWidth = config?.launcher?.width ?? "100%";
30
+ wrapper.style.width = inlineWidth;
31
+ panel.style.width = "100%";
32
+
27
33
  wrapper.appendChild(panel);
28
34
  return { wrapper, panel };
29
35
  }
package/src/defaults.ts CHANGED
@@ -48,6 +48,7 @@ export const DEFAULT_WIDGET_CONFIG: Partial<AgentWidgetConfig> = {
48
48
  agentIconText: "💬",
49
49
  position: "bottom-right",
50
50
  width: "min(400px, calc(100vw - 24px))",
51
+ heightOffset: 0,
51
52
  autoExpand: false,
52
53
  callToActionIconHidden: false,
53
54
  agentIconSize: "40px",
@@ -94,12 +94,9 @@ export const initAgentWidget = (
94
94
  host.className = "vanilla-agent-host";
95
95
 
96
96
  // When launcher is disabled (inline embed mode), ensure the host fills its container
97
- // This allows the widget to respect the parent container's height
98
97
  const launcherEnabled = options.config?.launcher?.enabled ?? true;
99
98
  if (!launcherEnabled) {
100
99
  host.style.height = "100%";
101
- host.style.display = "flex";
102
- host.style.flexDirection = "column";
103
100
  }
104
101
 
105
102
  target.appendChild(host);
package/src/types.ts CHANGED
@@ -217,6 +217,14 @@ export type AgentWidgetLauncherConfig = {
217
217
  * @default "420px"
218
218
  */
219
219
  sidebarWidth?: string;
220
+ /**
221
+ * Offset (in pixels) to subtract from the calculated panel height.
222
+ * Useful for adjusting the panel height when there are other fixed elements on the page.
223
+ * Only applies when not in fullHeight or sidebarMode.
224
+ *
225
+ * @default 0
226
+ */
227
+ heightOffset?: number;
220
228
  callToActionIconText?: string;
221
229
  callToActionIconName?: string;
222
230
  callToActionIconColor?: string;
package/src/ui.ts CHANGED
@@ -1592,9 +1592,11 @@ export const createAgentExperience = (
1592
1592
  if (!fullHeight) {
1593
1593
  const viewportHeight = window.innerHeight;
1594
1594
  const verticalMargin = 64; // leave space for launcher's offset
1595
+ const heightOffset = config.launcher?.heightOffset ?? 0;
1595
1596
  const available = Math.max(200, viewportHeight - verticalMargin);
1596
1597
  const clamped = Math.min(640, available);
1597
- panel.style.height = `${clamped}px`;
1598
+ const finalHeight = Math.max(200, clamped - heightOffset);
1599
+ panel.style.height = `${finalHeight}px`;
1598
1600
  }
1599
1601
  };
1600
1602