@copilotkit/web-components 1.62.1 → 1.62.2-canary.1784333495

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.
@@ -11,7 +11,7 @@ declare const COPILOTKIT_THREADS_DRAWER_TAG: "copilotkit-threads-drawer";
11
11
  *
12
12
  * Pure VIEW: domain data (threads/loading/error/etc.) comes IN as properties and
13
13
  * user intent goes OUT as bubbling+composed DOM `CustomEvent`s. The element owns
14
- * VIEW state (open/collapsed, Active/All filter, confirm-delete dialog, per-row
14
+ * VIEW state (open, Active/All filter, confirm-delete dialog, per-row
15
15
  * animations) while the consumer owns DOMAIN state. `open` is additionally
16
16
  * externally controllable via the `open` property + `open-change` event so a
17
17
  * host can coordinate mobile open/close.
@@ -56,6 +56,13 @@ declare class CopilotKitThreadsDrawer extends LitElement {
56
56
  label: {
57
57
  type: StringConstructor;
58
58
  };
59
+ recentLabel: {
60
+ attribute: string;
61
+ type: StringConstructor;
62
+ };
63
+ collapsible: {
64
+ type: BooleanConstructor;
65
+ };
59
66
  open: {
60
67
  type: BooleanConstructor;
61
68
  reflect: boolean;
@@ -73,19 +80,34 @@ declare class CopilotKitThreadsDrawer extends LitElement {
73
80
  _viewportIsMobile: {
74
81
  state: boolean;
75
82
  };
83
+ _hasHeader: {
84
+ state: boolean;
85
+ };
76
86
  _hasMemories: {
77
87
  state: boolean;
78
88
  };
79
89
  _hasFooter: {
80
90
  state: boolean;
81
91
  };
92
+ _filterOpen: {
93
+ state: boolean;
94
+ };
95
+ _openMenuId: {
96
+ state: boolean;
97
+ };
82
98
  };
83
99
  /**
84
- * Inbound: accessible + default-header label for the drawer region (screen-reader
85
- * region name + listbox name + the default header text). Override the visible
86
- * header independently via the `header` slot. Defaults to `"Threads"`.
100
+ * Inbound: accessible label for the drawer region — drives the screen-reader
101
+ * region name (on `.root`) and the listbox name (on `.list`) ONLY. The
102
+ * redesign has no visible title; project visible header chrome via the
103
+ * optional `header` slot instead. Defaults to `"Threads"`.
87
104
  */
88
105
  label: string;
106
+ /**
107
+ * Inbound: text for the "Recent Conversations" section heading above the list.
108
+ * Attribute: `recent-label`. Defaults to `"Recent Conversations"`.
109
+ */
110
+ recentLabel: string;
89
111
  /** Inbound: thread records to render. The element re-orders/filters them. */
90
112
  threads: DrawerThread[];
91
113
  /** Inbound: initial-fetch loading flag. */
@@ -109,18 +131,50 @@ declare class CopilotKitThreadsDrawer extends LitElement {
109
131
  fetchingMore: boolean;
110
132
  /** Inbound: fetch-more error message (inline, list preserved). */
111
133
  fetchMoreError: string | null;
112
- /** Externally-controllable: whether the drawer is open (mobile coordination). */
134
+ /**
135
+ * Externally-controllable: whether the drawer is open (mobile coordination).
136
+ * Defaults to `false` so a mobile-width first render does NOT paint the open
137
+ * modal (backdrop + body scroll-lock + focus steal) for one frame before a
138
+ * wrapper's post-mount effect can close it. Desktop is unaffected — only
139
+ * `.root.mobile.open` / `_isMobileModalOpen()` consume `open`.
140
+ */
113
141
  open: boolean;
114
- /** Externally-controllable: whether the drawer is collapsed to a rail (desktop). */
142
+ /**
143
+ * Externally-controllable: whether the drawer is collapsed to the floating
144
+ * cluster on desktop. Defaults to `false` (expanded). Reflected so hosts can
145
+ * theme on `[collapsed]`. Ignored on mobile, where open/closed governs the
146
+ * off-canvas modal instead.
147
+ */
115
148
  collapsed: boolean;
149
+ /**
150
+ * Inbound: whether the user may collapse the drawer on desktop. Defaults to
151
+ * `true`. When `false` the header omits the collapse toggle and the drawer
152
+ * NEVER renders the collapsed cluster on desktop (it stays expanded even if
153
+ * `collapsed` is set) — mobile off-canvas open/close is independent.
154
+ */
155
+ collapsible: boolean;
116
156
  private _filter;
117
157
  private _confirmingDeleteId;
118
158
  private _viewportIsMobile;
159
+ private _hasHeader;
119
160
  private _hasMemories;
120
161
  private _hasFooter;
162
+ /** Whether the funnel filter popover (Active/All) is open. */
163
+ private _filterOpen;
164
+ /** Id of the row whose kebab actions menu is open (only one at a time). */
165
+ private _openMenuId;
121
166
  private _mediaQuery;
122
167
  private readonly _onMediaChange;
123
168
  private readonly _onKeyDown;
169
+ /**
170
+ * Dismisses the funnel filter popover and/or an open row-actions menu when a
171
+ * pointerdown lands outside them. Bound to `document` (composed events bubble
172
+ * out of the shadow root), so we discriminate inside vs. outside via
173
+ * `composedPath()` rather than target identity. A click on a popover's own
174
+ * trigger is treated as "inside" so its own `@click` toggle handles the close
175
+ * (avoids a double-toggle that would immediately reopen it).
176
+ */
177
+ private readonly _onDocumentPointerDown;
124
178
  /** Thread ids previously seen as named, so we can animate the null→named reveal. */
125
179
  private readonly _seenNamed;
126
180
  /** Thread ids whose name just transitioned null→named in this update cycle. */
@@ -129,15 +183,39 @@ declare class CopilotKitThreadsDrawer extends LitElement {
129
183
  disconnectedCallback(): void;
130
184
  protected willUpdate(changed: PropertyValues<this>): void;
131
185
  protected updated(changed: PropertyValues<this>): void;
132
- /**
133
- * Marks each row whose name text is truncated with `name-clipped`, so the CSS
134
- * shows the name tooltip ONLY when the full name isn't already visible (an
135
- * always-on bubble over every row on hover would be noise). Measured after
136
- * render because truncation depends on the laid-out width.
137
- */
138
- private _syncNameClipping;
139
186
  private _isMobileModalOpen;
140
187
  private _setOpen;
188
+ private _setCollapsed;
189
+ /**
190
+ * Signal the drawer's reserved layout width to the host so a desktop collapse
191
+ * reclaims the column instead of leaving an empty gap. On desktop-collapse we
192
+ * set `--cpk-drawer-reserved-width: 0px` on the document root; a host whose
193
+ * grid reads `grid-template-columns: var(--cpk-drawer-reserved-width, 320px) …`
194
+ * inherits it and collapses the track (with its own transition). Expanded/mobile
195
+ * clears the override so the host's fallback width applies — which also means
196
+ * the default (expanded) render never sets it, so there is no hydration flicker.
197
+ *
198
+ * It is set on `document.documentElement` (not `parentElement`) BECAUSE the
199
+ * element is nested inside a framework wrapper host, so its parent is the
200
+ * wrapper — not the grid container, which is an ancestor a child's custom
201
+ * property can't reach. `:root` inheritance reaches the grid regardless of
202
+ * wrapper nesting. Best-effort + namespaced, single-drawer-per-document; a host
203
+ * with multiple drawers or a custom layout should instead react to the
204
+ * `collapse-change` event.
205
+ */
206
+ private _syncReservedWidth;
207
+ /**
208
+ * Center the confirm-delete <dialog> over the drawer PANEL's on-screen box
209
+ * (not the viewport). The dialog stays a top-layer `showModal()` element so it
210
+ * is never clipped, but we drive its center via `--confirm-cx/cy` measured
211
+ * from the visible `.root` rect — so it reads as "inside the drawer" per the
212
+ * ENT-1051 design while keeping the top-layer robustness. Falls back to
213
+ * viewport-center (the CSS default) when the panel isn't measurable
214
+ * (SSR/jsdom).
215
+ */
216
+ private _positionConfirmDialog;
217
+ /** Bound reposition handler for scroll/resize while the confirm dialog is open. */
218
+ private _repositionConfirm;
141
219
  private _setFilter;
142
220
  /**
143
221
  * Element-authoritative ordering + filtering. Active filter hides archived
@@ -158,7 +236,30 @@ declare class CopilotKitThreadsDrawer extends LitElement {
158
236
  private _focusFirstFocusable;
159
237
  private readonly _trapTab;
160
238
  render(): lit.TemplateResult<1>;
239
+ /**
240
+ * Floating launcher cluster from the Figma "closed" mockup: a sidebar-glyph
241
+ * toggle + a "New Conversation" (+) icon button. Shown in TWO states — the
242
+ * mobile closed state (toggle opens the off-canvas modal) and the desktop
243
+ * collapsed state (toggle expands the sidebar). The primary toggle keeps
244
+ * `part="launcher"` for mobile-launcher theme compat; the new-thread button is
245
+ * suppressed in the locked/unlicensed view, mirroring the New Conversation row.
246
+ */
247
+ private _renderCluster;
161
248
  private _renderHeader;
249
+ /**
250
+ * Dedicated full-width "New Conversation" row. Keeps `part="new-thread-button"`
251
+ * and fires the existing `new-thread` event, so wrappers/themes that hook the
252
+ * old header pill are unaffected.
253
+ */
254
+ private _renderNewConversation;
255
+ /**
256
+ * "Recent Conversations" section heading with a funnel button that opens the
257
+ * Active/All filter popover. Only shown when the list region is shown
258
+ * (licensed, and not the full-panel error/empty-before-load) — mirrors the
259
+ * old filters gate. The popover options keep `part="filter-active"` /
260
+ * `part="filter-all"` and still emit `filter-change` via `_setFilter`.
261
+ */
262
+ private _renderSectionHeading;
162
263
  private _renderBody;
163
264
  /**
164
265
  * Handles the Upgrade CTA click in the locked view. Dispatches a cancelable
@@ -175,6 +276,19 @@ declare class CopilotKitThreadsDrawer extends LitElement {
175
276
  private _renderFetchMore;
176
277
  private _renderMemories;
177
278
  private _renderFooter;
279
+ /**
280
+ * Confirm-delete dialog, rendered as a native `<dialog>` that is ALWAYS
281
+ * present in the shadow DOM so `updated()` can drive `showModal()`/`close()`
282
+ * against it. Opening with `showModal()` puts it in the browser TOP LAYER, so
283
+ * it can never be painted under other UI — the previous CSS-positioned overlay
284
+ * was trapped in the drawer host's stacking context and appeared under the
285
+ * chat's welcome view (ENT-1051). The `::backdrop` pseudo-element (styled in
286
+ * styles.ts) provides the scrim natively.
287
+ *
288
+ * The actionable content (message + Cancel/Delete, bound to the captured id)
289
+ * renders only while confirming, so a closed dialog holds nothing stale.
290
+ * Native dismissal is wired via `@cancel` (Escape) and a backdrop-click check.
291
+ */
178
292
  private _renderConfirmDialog;
179
293
  }
180
294
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"copilotkit-threads-drawer.d.mts","names":[],"sources":["../../src/threads-drawer/copilotkit-threads-drawer.ts"],"mappings":";;;;;;cAQa,6BAAA;AAAb;;;;;AAwHA;;;;;;;;AAxHA,cAwHa,uBAAA,SAAgC,UAAA;EAAA,OACpC,MAAA,EAD4B,GAAA,CACtB,SAAA;EAAA,OAEN,UAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6BP,KAAA;;EAGA,OAAA,EAAS,YAAA;EAHT;EAKA,OAAA;EAFS;EAIT,KAAA;EAAA;EAEA,cAAA;EAEA;EAAA,QAAA;EASA;;;;;;EAFA,UAAA;EAeQ;EAbR,OAAA;EAeQ;EAbR,YAAA;EAgBiB;EAdjB,cAAA;EAyCiB;EAtCjB,IAAA;EA0CS;EAxCT,SAAA;EAAA,QAEQ,OAAA;EAAA,QACA,mBA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