@agentforge-io/chat-sdk 2.4.0 → 2.4.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.
Files changed (2) hide show
  1. package/dist/ChatDrawer.js +30 -10
  2. package/package.json +1 -1
@@ -205,24 +205,44 @@ function ChatDrawer(props) {
205
205
  // **bottom-sheet (snap<1)**: anchor the surface to the bottom of the
206
206
  // visual viewport. `bottom = visualViewport.offsetTop` is the legacy
207
207
  // path that handles the rubber-band scroll case on iOS Safari.
208
+ // Motion choreography (NLP-aware):
209
+ // - Origin: the drawer "grows" from the bottom of the page rather
210
+ // than appearing in place. Subconsciously this maps to "the chat
211
+ // emerges because YOU asked for it" — agency stays with the user.
212
+ // - Curve: cubic-bezier(.22, 1, .36, 1) is the ease-out-expo curve.
213
+ // It starts fast, then settles with the same deceleration profile
214
+ // a hand has when reaching out and stopping. Bodies recognize it
215
+ // as "natural" without consciously parsing why.
216
+ // - Duration: 360ms. Below 300ms feels mechanical/jumpy. Above 450ms
217
+ // feels sluggish on mobile. 360ms is the breath-pause sweet spot
218
+ // for "the world updated and I noticed it".
219
+ // - Coupled fade+scale: the surface opens at 98% scale and fades in
220
+ // while sliding. The 2% scale delta is barely perceivable
221
+ // consciously but the brain reads it as "expanding into presence"
222
+ // instead of "popping in".
223
+ const transitionExpr = isDragging
224
+ ? 'none'
225
+ : 'transform 360ms cubic-bezier(.22, 1, .36, 1), opacity 240ms cubic-bezier(.22, 1, .36, 1)';
226
+ const openTransform = `translate3d(0, ${dragOffset}px, 0) scale(${open ? 1 : 0.98})`;
227
+ const closedTransformFullscreen = `translate3d(0, 24px, 0) scale(0.98)`;
228
+ const closedTransformSheet = `translate3d(0, ${drawerHeight}px, 0) scale(1)`;
208
229
  const surfaceMotionStyle = fullscreen
209
230
  ? {
210
231
  top: `${vv.offsetTop}px`,
211
232
  height: `${vv.h}px`,
212
- transform: `translate3d(0, ${translateY}, 0)`,
213
- transition: isDragging
214
- ? 'none'
215
- : 'transform 240ms cubic-bezier(.32,.72,0,1)',
216
- willChange: 'transform',
233
+ transform: open ? openTransform : closedTransformFullscreen,
234
+ opacity: open ? 1 : 0,
235
+ transition: transitionExpr,
236
+ transformOrigin: 'bottom center',
237
+ willChange: 'transform, opacity',
217
238
  }
218
239
  : {
219
240
  height: `${drawerHeight}px`,
220
- transform: `translate3d(0, ${translateY}, 0)`,
241
+ transform: open ? openTransform : closedTransformSheet,
221
242
  bottom: `${vv.offsetTop}px`,
222
- transition: isDragging
223
- ? 'none'
224
- : 'transform 240ms cubic-bezier(.32,.72,0,1)',
225
- willChange: 'transform',
243
+ transition: transitionExpr,
244
+ transformOrigin: 'bottom center',
245
+ willChange: 'transform, opacity',
226
246
  };
227
247
  return (0, react_dom_1.createPortal)((0, jsx_runtime_1.jsxs)("div", { className: "af-drawer-root", "data-state": open ? 'open' : 'closed', style: {
228
248
  position: 'fixed',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentforge-io/chat-sdk",
3
- "version": "2.4.0",
3
+ "version": "2.4.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",