@agentforge-io/chat-sdk 2.3.0 → 2.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ChatDrawer.d.ts +13 -1
- package/dist/ChatDrawer.js +18 -4
- package/package.json +1 -1
package/dist/ChatDrawer.d.ts
CHANGED
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
* decides what trigger UX makes sense (button, input pill, FAB, etc.)
|
|
38
38
|
* and calls `onOpenChange(true)`.
|
|
39
39
|
*/
|
|
40
|
-
import { type ReactNode } from 'react';
|
|
40
|
+
import { type CSSProperties, type ReactNode } from 'react';
|
|
41
41
|
import { type ChatWidgetProps } from './react';
|
|
42
42
|
/**
|
|
43
43
|
* Drawer accepts the chat surface in two shapes:
|
|
@@ -86,6 +86,18 @@ export type ChatDrawerProps = ChatSurface & {
|
|
|
86
86
|
* add a custom shadow / border colour. The CSS vars on `--af-*` already
|
|
87
87
|
* let you re-theme the chat widget itself; this is for the SURROUND. */
|
|
88
88
|
drawerClassName?: string;
|
|
89
|
+
/** Inline style applied to the drawer surface — typically the host's
|
|
90
|
+
* bundle of `--af-bg`, `--af-fg`, `--af-bubble-*`, etc. CSS vars.
|
|
91
|
+
* Because the drawer renders into a portal (`document.body`), any
|
|
92
|
+
* vars declared on the host's page wrapper DON'T cascade in. The
|
|
93
|
+
* host re-declares them here so the chat surface inside the portal
|
|
94
|
+
* picks up the same theme.
|
|
95
|
+
*
|
|
96
|
+
* We default the SURFACE BG to `var(--af-bg, …)` so passing
|
|
97
|
+
* `--af-bg` in `surfaceStyle` themes the drawer's background.
|
|
98
|
+
* When omitted the drawer falls back to white in light mode and
|
|
99
|
+
* the system default elsewhere — passable but not theme-perfect. */
|
|
100
|
+
surfaceStyle?: CSSProperties & Record<string, string>;
|
|
89
101
|
};
|
|
90
102
|
export declare function ChatDrawer(props: ChatDrawerProps): JSX.Element | null;
|
|
91
103
|
export {};
|
package/dist/ChatDrawer.js
CHANGED
|
@@ -45,7 +45,7 @@ const react_1 = require("react");
|
|
|
45
45
|
const react_dom_1 = require("react-dom");
|
|
46
46
|
const react_2 = require("./react");
|
|
47
47
|
function ChatDrawer(props) {
|
|
48
|
-
const { open, onOpenChange, snap = 0.98, header, closeOnBackdropClick = true, drawerClassName, widgetProps, chatSlot, } = props;
|
|
48
|
+
const { open, onOpenChange, snap = 0.98, header, closeOnBackdropClick = true, drawerClassName, surfaceStyle: surfaceStyleProp, widgetProps, chatSlot, } = props;
|
|
49
49
|
// We mount once and keep alive across close→reopen so the chat session
|
|
50
50
|
// doesn't get destroyed. After the FIRST open the panel stays in the
|
|
51
51
|
// DOM forever (toggled by `display:none`) — `hasOpened` gates the
|
|
@@ -182,7 +182,10 @@ function ChatDrawer(props) {
|
|
|
182
182
|
// finger 1:1. Re-enabled at the end of the drag (delta back to 0
|
|
183
183
|
// smoothly when below threshold).
|
|
184
184
|
const isDragging = dragStateRef.current?.dragging === true;
|
|
185
|
-
|
|
185
|
+
// Motion / sizing portion of the surface style, kept separate from
|
|
186
|
+
// the host-supplied theming so a re-render driven by drag offset
|
|
187
|
+
// doesn't smash the host's CSS vars.
|
|
188
|
+
const surfaceMotionStyle = {
|
|
186
189
|
height: `${drawerHeight}px`,
|
|
187
190
|
transform: `translate3d(0, ${translateY}, 0)`,
|
|
188
191
|
bottom: `${vv.offsetTop}px`,
|
|
@@ -205,14 +208,25 @@ function ChatDrawer(props) {
|
|
|
205
208
|
left: 0,
|
|
206
209
|
right: 0,
|
|
207
210
|
width: '100%',
|
|
211
|
+
// Host supplies the CSS vars via `surfaceStyle`; the
|
|
212
|
+
// backgroundColor resolves from `--af-bg` (which the host
|
|
213
|
+
// declares in that same prop). When `surfaceStyle` is
|
|
214
|
+
// omitted we fall back to white — passable for an unthemed
|
|
215
|
+
// demo, wrong for a themed embed; passing surfaceStyle is
|
|
216
|
+
// the correct path.
|
|
208
217
|
backgroundColor: 'var(--af-bg, #ffffff)',
|
|
218
|
+
color: 'var(--af-fg, inherit)',
|
|
209
219
|
borderTopLeftRadius: '16px',
|
|
210
220
|
borderTopRightRadius: '16px',
|
|
211
|
-
boxShadow: '0 -8px 24px rgba(15, 23, 42, 0.
|
|
221
|
+
boxShadow: '0 -8px 24px rgba(15, 23, 42, 0.25)',
|
|
212
222
|
display: 'flex',
|
|
213
223
|
flexDirection: 'column',
|
|
214
224
|
overflow: 'hidden',
|
|
215
|
-
|
|
225
|
+
// Host-supplied theme vars come FIRST so the motion
|
|
226
|
+
// properties below override any conflicting `transform` /
|
|
227
|
+
// `height` declarations a careless host might pass.
|
|
228
|
+
...surfaceStyleProp,
|
|
229
|
+
...surfaceMotionStyle,
|
|
216
230
|
}, children: [(0, jsx_runtime_1.jsx)("div", { onPointerDown: onHandlePointerDown, onPointerMove: onHandlePointerMove, onPointerUp: onHandlePointerUp, onPointerCancel: onHandlePointerUp, style: {
|
|
217
231
|
padding: '10px 0',
|
|
218
232
|
cursor: 'grab',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentforge-io/chat-sdk",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.1",
|
|
4
4
|
"description": "Framework-free chat session SDK for AgentForge public chat tokens. Headless — no DOM. Drop into any frontend (React, Vue, Svelte, vanilla) and listen for events.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/index.js",
|