@copilotkit/web-components 1.62.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/LICENSE +21 -0
- package/README.md +90 -0
- package/dist/index.cjs +12 -0
- package/dist/index.d.cts +7 -0
- package/dist/index.d.mts +7 -0
- package/dist/index.mjs +7 -0
- package/dist/index.umd.js +2548 -0
- package/dist/index.umd.js.map +1 -0
- package/dist/threads-drawer/copilotkit-threads-drawer.cjs +677 -0
- package/dist/threads-drawer/copilotkit-threads-drawer.cjs.map +1 -0
- package/dist/threads-drawer/copilotkit-threads-drawer.d.cts +182 -0
- package/dist/threads-drawer/copilotkit-threads-drawer.d.cts.map +1 -0
- package/dist/threads-drawer/copilotkit-threads-drawer.d.mts +182 -0
- package/dist/threads-drawer/copilotkit-threads-drawer.d.mts.map +1 -0
- package/dist/threads-drawer/copilotkit-threads-drawer.mjs +676 -0
- package/dist/threads-drawer/copilotkit-threads-drawer.mjs.map +1 -0
- package/dist/threads-drawer/define.cjs +15 -0
- package/dist/threads-drawer/define.cjs.map +1 -0
- package/dist/threads-drawer/define.d.cts +17 -0
- package/dist/threads-drawer/define.d.cts.map +1 -0
- package/dist/threads-drawer/define.d.mts +17 -0
- package/dist/threads-drawer/define.d.mts.map +1 -0
- package/dist/threads-drawer/define.mjs +15 -0
- package/dist/threads-drawer/define.mjs.map +1 -0
- package/dist/threads-drawer/generated-tokens.cjs +33 -0
- package/dist/threads-drawer/generated-tokens.cjs.map +1 -0
- package/dist/threads-drawer/generated-tokens.d.cts +32 -0
- package/dist/threads-drawer/generated-tokens.d.cts.map +1 -0
- package/dist/threads-drawer/generated-tokens.d.mts +32 -0
- package/dist/threads-drawer/generated-tokens.d.mts.map +1 -0
- package/dist/threads-drawer/generated-tokens.mjs +32 -0
- package/dist/threads-drawer/generated-tokens.mjs.map +1 -0
- package/dist/threads-drawer/index.cjs +11 -0
- package/dist/threads-drawer/index.d.cts +6 -0
- package/dist/threads-drawer/index.d.mts +6 -0
- package/dist/threads-drawer/index.mjs +6 -0
- package/dist/threads-drawer/styles.cjs +499 -0
- package/dist/threads-drawer/styles.cjs.map +1 -0
- package/dist/threads-drawer/styles.d.cts +24 -0
- package/dist/threads-drawer/styles.d.cts.map +1 -0
- package/dist/threads-drawer/styles.d.mts +24 -0
- package/dist/threads-drawer/styles.d.mts.map +1 -0
- package/dist/threads-drawer/styles.mjs +499 -0
- package/dist/threads-drawer/styles.mjs.map +1 -0
- package/dist/threads-drawer/types.d.cts +97 -0
- package/dist/threads-drawer/types.d.cts.map +1 -0
- package/dist/threads-drawer/types.d.mts +97 -0
- package/dist/threads-drawer/types.d.mts.map +1 -0
- package/package.json +85 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copilotkit-threads-drawer.cjs","names":["LitElement","drawerStyles","nothing"],"sources":["../../src/threads-drawer/copilotkit-threads-drawer.ts"],"sourcesContent":["import { LitElement, html, nothing } from \"lit\";\nimport type { PropertyValues } from \"lit\";\nimport { repeat } from \"lit/directives/repeat.js\";\nimport { classMap } from \"lit/directives/class-map.js\";\nimport { drawerStyles } from \"./styles\";\nimport type { DrawerFilter, DrawerThread, LicensedDetail } from \"./types\";\n\n/** Tag name the element registers under. */\nexport const COPILOTKIT_THREADS_DRAWER_TAG =\n \"copilotkit-threads-drawer\" as const;\n\n/** Mobile breakpoint (px). At or below this width the drawer is a modal overlay. */\nconst MOBILE_BREAKPOINT = 768;\n\n/**\n * Whether an inbound error message should surface an error state. Only a\n * non-empty, non-whitespace string counts — `null`, `\"\"`, and whitespace-only\n * strings are treated as \"no error\" so an empty error never conflates with a\n * real one (and never blanks the list behind an empty error panel).\n */\nfunction hasErrorMessage(value: string | null): value is string {\n return value !== null && value.trim().length > 0;\n}\n\n/**\n * Builds the per-row slot name (`row:<id>`) used for consumer projection, but\n * only when the thread id is safe to embed in a slot `name` / `slot` attribute\n * token. A slot name is matched character-for-character against the consumer's\n * `slot=\"...\"` attribute; whitespace splits attribute tokens and quotes/angle\n * brackets can break attribute serialization, so an id containing any of those\n * would silently fail projection. For such an id we return `null` and the row\n * renders its default name span (no per-row slot), which is the safe fallback.\n */\nfunction rowSlotName(id: string): string | null {\n // Reject whitespace and characters that are unsafe in an HTML attribute token.\n if (id.length === 0 || /[\\s\"'<>=]/.test(id)) return null;\n return `row:${id}`;\n}\n\n/**\n * Inline row-action icons. The element is framework-agnostic Lit, so it cannot\n * depend on a React icon library — these are the lucide `archive`,\n * `archive-restore`, and `trash-2` glyphs inlined as SVG, drawn with\n * `currentColor` so they inherit the button's themed color.\n */\nconst iconArchive = html`\n <svg\n class=\"row-action-icon\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n <rect width=\"20\" height=\"5\" x=\"2\" y=\"3\" rx=\"1\" />\n <path d=\"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8\" />\n <path d=\"M10 12h4\" />\n </svg>\n`;\nconst iconUnarchive = html`\n <svg\n class=\"row-action-icon\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n <rect width=\"20\" height=\"5\" x=\"2\" y=\"3\" rx=\"1\" />\n <path d=\"M4 8v11a2 2 0 0 0 2 2h2\" />\n <path d=\"M20 8v11a2 2 0 0 1-2 2h-2\" />\n <path d=\"m9 15 3-3 3 3\" />\n <path d=\"M12 12v9\" />\n </svg>\n`;\nconst iconDelete = html`\n <svg\n class=\"row-action-icon\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"M3 6h18\" />\n <path\n d=\"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2\"\n />\n <line x1=\"10\" x2=\"10\" y1=\"11\" y2=\"17\" />\n <line x1=\"14\" x2=\"14\" y1=\"11\" y2=\"17\" />\n </svg>\n`;\nconst iconLauncher = html`\n <svg\n class=\"launcher-icon\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n <rect width=\"18\" height=\"18\" x=\"3\" y=\"3\" rx=\"2\" />\n <path d=\"M9 3v18\" />\n <path d=\"m14 9 3 3-3 3\" />\n </svg>\n`;\n\n/**\n * `<copilotkit-threads-drawer>` — a public, self-contained, controlled, framework-agnostic\n * threads drawer rendered into a shadow root.\n *\n * Pure VIEW: domain data (threads/loading/error/etc.) comes IN as properties and\n * user intent goes OUT as bubbling+composed DOM `CustomEvent`s. The element owns\n * VIEW state (open/collapsed, Active/All filter, confirm-delete dialog, per-row\n * animations) while the consumer owns DOMAIN state. `open` is additionally\n * externally controllable via the `open` property + `open-change` event so a\n * host can coordinate mobile open/close.\n *\n * The element is AUTHORITATIVE over row order and the Active/All filter.\n */\nexport class CopilotKitThreadsDrawer extends LitElement {\n static styles = drawerStyles;\n\n static properties = {\n // Inbound domain properties.\n threads: { attribute: false },\n loading: { type: Boolean },\n error: { type: String },\n activeThreadId: { attribute: \"active-thread-id\", type: String },\n licensed: { type: Boolean },\n licenseUrl: { attribute: \"license-url\", type: String },\n hasMore: { attribute: \"has-more\", type: Boolean },\n fetchingMore: { attribute: \"fetching-more\", type: Boolean },\n fetchMoreError: { attribute: \"fetch-more-error\", type: String },\n // Inbound: configurable label for the drawer region and default header.\n label: { type: String },\n // Externally-controllable VIEW state.\n open: { type: Boolean, reflect: true },\n collapsed: { type: Boolean, reflect: true },\n // Internal VIEW state.\n _filter: { state: true },\n _confirmingDeleteId: { state: true },\n _viewportIsMobile: { state: true },\n _hasMemories: { state: true },\n _hasFooter: { state: true },\n };\n\n /**\n * Inbound: accessible + default-header label for the drawer region (screen-reader\n * region name + listbox name + the default header text). Override the visible\n * header independently via the `header` slot. Defaults to `\"Threads\"`.\n */\n label = \"Threads\";\n\n /** Inbound: thread records to render. The element re-orders/filters them. */\n threads: DrawerThread[] = [];\n /** Inbound: initial-fetch loading flag. */\n loading = false;\n /** Inbound: initial-fetch error message (actionable Retry shown when set). */\n error: string | null = null;\n /** Inbound: currently-open thread id (drives row selection highlight). */\n activeThreadId: string | null = null;\n /** Inbound: whether the org is licensed for threads; `false` shows the locked view. */\n licensed = true;\n /**\n * Inbound: destination the Upgrade CTA opens (new tab) when the locked view's\n * default button is clicked. Defaults to the CopilotKit Intelligence docs.\n * Set to an empty string to suppress the default navigation and rely solely\n * on the `licensed` event.\n */\n licenseUrl = \"https://docs.copilotkit.ai/intelligence\";\n /** Inbound: whether more pages are available. */\n hasMore = false;\n /** Inbound: whether a fetch-more is in flight. */\n fetchingMore = false;\n /** Inbound: fetch-more error message (inline, list preserved). */\n fetchMoreError: string | null = null;\n\n /** Externally-controllable: whether the drawer is open (mobile coordination). */\n open = true;\n /** Externally-controllable: whether the drawer is collapsed to a rail (desktop). */\n collapsed = false;\n\n private _filter: DrawerFilter = \"active\";\n private _confirmingDeleteId: string | null = null;\n private _viewportIsMobile = false;\n private _hasMemories = false;\n private _hasFooter = false;\n\n private _mediaQuery: MediaQueryList | null = null;\n private readonly _onMediaChange = (event: MediaQueryListEvent) => {\n this._viewportIsMobile = event.matches;\n };\n private readonly _onKeyDown = (event: KeyboardEvent) => {\n if (event.key === \"Escape\") {\n if (this._confirmingDeleteId !== null) {\n this._confirmingDeleteId = null;\n event.stopPropagation();\n return;\n }\n if (this._viewportIsMobile && this.open) {\n this._setOpen(false);\n event.stopPropagation();\n }\n return;\n }\n // Tab focus-trap for the mobile modal. Handled at the HOST (not on `.root`)\n // so it fires wherever focus sits in the shadow root — including the\n // backdrop button, which renders as a sibling OUTSIDE `.root`. A trap bound\n // only to `.root` lets Tab from the backdrop (or any out-of-root node)\n // escape the modal to the page behind it.\n if (event.key === \"Tab\") {\n this._trapTab(event);\n }\n };\n\n /** Thread ids previously seen as named, so we can animate the null→named reveal. */\n private readonly _seenNamed = new Set<string>();\n /** Thread ids whose name just transitioned null→named in this update cycle. */\n private _justRevealed = new Set<string>();\n\n override connectedCallback(): void {\n super.connectedCallback();\n if (typeof window !== \"undefined\" && window.matchMedia) {\n this._mediaQuery = window.matchMedia(\n `(max-width: ${MOBILE_BREAKPOINT}px)`,\n );\n this._viewportIsMobile = this._mediaQuery.matches;\n this._mediaQuery.addEventListener(\"change\", this._onMediaChange);\n }\n this.addEventListener(\"keydown\", this._onKeyDown);\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n this._mediaQuery?.removeEventListener(\"change\", this._onMediaChange);\n this.removeEventListener(\"keydown\", this._onKeyDown);\n this._releaseScrollLock();\n }\n\n protected override willUpdate(changed: PropertyValues<this>): void {\n // Compute the null→named reveal set BEFORE render, so render stays pure.\n if (changed.has(\"threads\")) {\n const presentIds = new Set<string>();\n const revealed = new Set<string>();\n for (const thread of this.threads) {\n presentIds.add(thread.id);\n const hasName = thread.name !== null && thread.name !== \"\";\n if (hasName && !this._seenNamed.has(thread.id)) {\n revealed.add(thread.id);\n }\n if (hasName) this._seenNamed.add(thread.id);\n }\n // Prune ids no longer present so `_seenNamed` cannot grow without bound\n // across a long-lived, high-churn session.\n for (const id of this._seenNamed) {\n if (!presentIds.has(id)) this._seenNamed.delete(id);\n }\n this._justRevealed = revealed;\n\n // Auto-dismiss a pending confirm-delete whose target is no longer in the\n // visible threads (the consumer removed/archived/filtered it away while\n // the dialog was open). Without this the dialog could emit `delete` with a\n // stale id. Reconciled against the SAME visible set the user is acting on.\n if (this._confirmingDeleteId !== null) {\n const stillVisible = this._visibleThreads().some(\n (t) => t.id === this._confirmingDeleteId,\n );\n if (!stillVisible) this._confirmingDeleteId = null;\n }\n }\n }\n\n protected override updated(changed: PropertyValues<this>): void {\n // Scroll-lock is a mobile-modal concern only.\n if (\n changed.has(\"open\") ||\n changed.has(\"_viewportIsMobile\" as keyof CopilotKitThreadsDrawer)\n ) {\n if (this._isMobileModalOpen()) {\n this._applyScrollLock();\n this._focusFirstFocusable();\n } else {\n this._releaseScrollLock();\n }\n }\n\n // The reveal animation fires exactly once per real name-arrival. Clearing\n // the set after the render that applied the `revealed` class prevents any\n // later, unrelated re-render from re-adding the class and re-firing the\n // animation. `_justRevealed` is a plain field (not reactive), so resetting\n // it here does not schedule another update.\n if (this._justRevealed.size > 0) {\n this._justRevealed = new Set<string>();\n }\n\n this._syncNameClipping();\n }\n\n /**\n * Marks each row whose name text is truncated with `name-clipped`, so the CSS\n * shows the name tooltip ONLY when the full name isn't already visible (an\n * always-on bubble over every row on hover would be noise). Measured after\n * render because truncation depends on the laid-out width.\n */\n private _syncNameClipping(): void {\n const names = this.renderRoot.querySelectorAll<HTMLElement>(\".row-name\");\n names.forEach((name) => {\n const text = name.querySelector<HTMLElement>(\".row-name-text\");\n const clipped = !!text && text.scrollWidth > text.clientWidth;\n name.classList.toggle(\"name-clipped\", clipped);\n // The z-index lift in styles.ts (`.row.name-clipped:hover`) targets the\n // `.row` stacking context — each row creates its own via `transform`, so a\n // tooltip anchored on `.row-name` is trapped inside it and paints under\n // later rows unless the row itself is re-floated. Stamp the flag on the\n // owning row too so that rule matches; the tooltip bubble stays scoped to\n // `.row-name:hover`, so hovering a row-action never surfaces it.\n name\n .closest<HTMLElement>(\".row\")\n ?.classList.toggle(\"name-clipped\", clipped);\n });\n }\n\n // --- View-state helpers ----------------------------------------------------\n\n private _isMobileModalOpen(): boolean {\n return this._viewportIsMobile && this.open;\n }\n\n private _setOpen(next: boolean): void {\n if (this.open === next) return;\n this.open = next;\n this._emit(\"open-change\", { open: next });\n }\n\n private _setFilter(next: DrawerFilter): void {\n if (this._filter === next) return;\n this._filter = next;\n this._emit(\"filter-change\", { filter: next });\n }\n\n /**\n * Element-authoritative ordering + filtering. Active filter hides archived\n * threads; ordering is most-recent-first by `lastRunAt`/`updatedAt`.\n */\n private _visibleThreads(): DrawerThread[] {\n const filtered =\n this._filter === \"active\"\n ? this.threads.filter((t) => !t.archived)\n : this.threads;\n // Parse to a timestamp; a malformed/absent value yields `null` (NOT epoch 0)\n // so bad data is never silently treated as 1970. Threads with a valid\n // timestamp sort most-recent-first; threads with no parseable timestamp\n // keep their incoming relative order and sort after the dated ones.\n const ts = (t: DrawerThread): number | null => {\n const raw = t.lastRunAt ?? t.updatedAt ?? t.createdAt;\n const parsed = Date.parse(raw);\n return Number.isNaN(parsed) ? null : parsed;\n };\n return [...filtered]\n .map((thread, index) => ({ thread, index, ts: ts(thread) }))\n .sort((a, b) => {\n if (a.ts === null && b.ts === null) return a.index - b.index;\n if (a.ts === null) return 1;\n if (b.ts === null) return -1;\n if (a.ts !== b.ts) return b.ts - a.ts;\n return a.index - b.index;\n })\n .map((entry) => entry.thread);\n }\n\n private _emit<T>(type: string, detail: T): void {\n this.dispatchEvent(\n new CustomEvent(type, { detail, bubbles: true, composed: true }),\n );\n }\n\n // --- Scroll lock + focus (mobile modal only) -------------------------------\n\n private _scrollLocked = false;\n private _prevBodyOverflow = \"\";\n\n private _applyScrollLock(): void {\n if (this._scrollLocked || typeof document === \"undefined\") return;\n this._prevBodyOverflow = document.body.style.overflow;\n document.body.style.overflow = \"hidden\";\n this._scrollLocked = true;\n }\n\n private _releaseScrollLock(): void {\n if (!this._scrollLocked || typeof document === \"undefined\") return;\n document.body.style.overflow = this._prevBodyOverflow;\n this._scrollLocked = false;\n }\n\n /**\n * Returns the focusable elements in the composed/flattened tree of the drawer\n * root, INCLUDING slotted light-DOM content (so a focus trap covers slotted\n * rows). Walks assigned nodes of each `<slot>`.\n */\n private _composedFocusable(): HTMLElement[] {\n const selector =\n 'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"])';\n const out: HTMLElement[] = [];\n // The backdrop button is a modal-owned focusable rendered as a sibling of\n // `.root`. Include it first (it precedes `.root` in DOM order) so the focus\n // trap treats it as part of the modal's cycle rather than an escape hatch.\n const backdrop = this.renderRoot.querySelector<HTMLElement>(\".backdrop\");\n if (backdrop) out.push(backdrop);\n const root = this.renderRoot.querySelector(\".root\");\n if (!root) return out;\n const collect = (node: ParentNode) => {\n node\n .querySelectorAll<HTMLElement>(selector)\n .forEach((el) => out.push(el));\n };\n collect(root);\n root.querySelectorAll(\"slot\").forEach((slot) => {\n (slot as HTMLSlotElement)\n .assignedElements({ flatten: true })\n .forEach((assigned) => {\n if (assigned.matches(selector)) out.push(assigned as HTMLElement);\n collect(assigned);\n });\n });\n return out;\n }\n\n private _focusFirstFocusable(): void {\n // Defer so the rendered tree exists.\n queueMicrotask(() => {\n const focusable = this._composedFocusable();\n // Prefer the first real control over the backdrop scrim so opening the\n // modal lands focus on actionable content, not the close-on-click overlay\n // (the backdrop is still part of the trap cycle below).\n const backdrop = this.renderRoot.querySelector(\".backdrop\");\n const target = focusable.find((el) => el !== backdrop) ?? focusable[0];\n target?.focus();\n });\n }\n\n private readonly _trapTab = (event: KeyboardEvent) => {\n if (event.key !== \"Tab\" || !this._isMobileModalOpen()) return;\n const focusable = this._composedFocusable();\n if (focusable.length === 0) return;\n const first = focusable[0]!;\n const last = focusable[focusable.length - 1]!;\n const active =\n (this.renderRoot as ShadowRoot).activeElement ?? document.activeElement;\n if (event.shiftKey && active === first) {\n last.focus();\n event.preventDefault();\n } else if (!event.shiftKey && active === last) {\n first.focus();\n event.preventDefault();\n }\n };\n\n // --- Render ----------------------------------------------------------------\n\n override render() {\n const rootClasses = {\n root: true,\n collapsed: this.collapsed && !this._viewportIsMobile,\n mobile: this._viewportIsMobile,\n open: this.open,\n // Suppresses row-action tooltips while the confirm dialog is open (the\n // clicked trash button keeps :focus-visible/:hover otherwise).\n confirming: this._confirmingDeleteId !== null,\n };\n\n return html`\n ${\n // Mobile open-affordance: when the drawer is a closed off-canvas modal,\n // render its own floating launcher so there is always a way to open it\n // on phones WITHOUT the host wiring a header button. Desktop (persistent\n // sidebar) and the open state never show it.\n this._viewportIsMobile && !this.open\n ? html`<button\n class=\"launcher\"\n part=\"launcher\"\n aria-label=\"Open threads\"\n @click=${() => this._setOpen(true)}\n >\n <slot name=\"launcher-icon\">${iconLauncher}</slot>\n </button>`\n : nothing\n }\n ${\n this._isMobileModalOpen()\n ? html`<button\n class=\"backdrop\"\n part=\"backdrop\"\n aria-label=\"Close threads drawer\"\n @click=${() => this._setOpen(false)}\n ></button>`\n : nothing\n }\n <div\n class=${classMap(rootClasses)}\n part=\"root\"\n role=${this._isMobileModalOpen() ? \"dialog\" : \"region\"}\n aria-modal=${this._isMobileModalOpen() ? \"true\" : nothing}\n aria-label=${this.label}\n >\n ${this._renderHeader()} ${this._renderBody()} ${this._renderMemories()}\n ${this._renderFooter()} ${this._renderConfirmDialog()}\n </div>\n `;\n }\n\n private _renderHeader() {\n return html`\n <div class=\"header\" part=\"header\">\n <slot name=\"header\"><span>${this.label}</span></slot>\n <button\n class=\"primary\"\n part=\"new-thread-button\"\n aria-label=\"New thread\"\n @click=${() => this._emit(\"new-thread\", {})}\n >\n + New\n </button>\n </div>\n ${\n this.licensed &&\n (!hasErrorMessage(this.error) || this.threads.length > 0)\n ? html`\n <div class=\"filters\" part=\"filters\" role=\"group\" aria-label=\"Filter threads\">\n <button\n class=\"filter-btn\"\n part=\"filter-active\"\n aria-pressed=${this._filter === \"active\"}\n @click=${() => this._setFilter(\"active\")}\n >\n Active\n </button>\n <button\n class=\"filter-btn\"\n part=\"filter-all\"\n aria-pressed=${this._filter === \"all\"}\n @click=${() => this._setFilter(\"all\")}\n >\n All\n </button>\n </div>\n `\n : nothing\n }\n `;\n }\n\n private _renderBody() {\n // The locked view beats error: an unlicensed org always sees it, never the\n // initial-fetch error.\n if (!this.licensed) return this._renderLicensed();\n // The full-panel error replaces the list ONLY when there is nothing to show\n // (a failed initial fetch). The bound `error` reflects the core store error,\n // which a failed mutation (delete/rename/archive) also sets — a delete\n // rollback restores its row, so when threads are still present we keep the\n // list visible rather than blanking it behind a \"couldn't load\" panel.\n if (hasErrorMessage(this.error) && this.threads.length === 0) {\n return this._renderError();\n }\n // Full-panel loading only when there is nothing to show yet (initial fetch).\n // A refetch (e.g. filter toggle Active<->All) keeps `loading` true while the\n // list is already populated — keep showing the known threads rather than\n // flashing the loading state over them.\n if (this.loading && this.threads.length === 0) return this._renderLoading();\n return this._renderList();\n }\n\n /**\n * Handles the Upgrade CTA click in the locked view. Dispatches a cancelable\n * `licensed` event carrying the resolved `licenseUrl`; unless a host calls\n * `preventDefault()`, opens that URL in a new tab. A blank `licenseUrl`\n * suppresses navigation so the event alone drives host behavior.\n */\n private _onLicensedCta(): void {\n const proceed = this.dispatchEvent(\n new CustomEvent(\"licensed\", {\n detail: { licenseUrl: this.licenseUrl } satisfies LicensedDetail,\n bubbles: true,\n composed: true,\n cancelable: true,\n }),\n );\n if (proceed && this.licenseUrl && typeof window !== \"undefined\") {\n window.open(this.licenseUrl, \"_blank\", \"noopener,noreferrer\");\n }\n }\n\n private _renderLicensed() {\n return html`\n <div class=\"licensed\" part=\"licensed\" data-testid=\"drawer-licensed\">\n <slot name=\"licensed\">\n <p>Threads are a CopilotKit Intelligence feature.</p>\n <button\n class=\"primary\"\n part=\"licensed-cta\"\n @click=${() => this._onLicensedCta()}\n >\n Upgrade\n </button>\n </slot>\n </div>\n `;\n }\n\n private _renderError() {\n return html`\n <div class=\"state error\" part=\"error\" role=\"alert\" data-testid=\"drawer-error\">\n <p>${this.error}</p>\n <button\n class=\"primary\"\n part=\"retry-button\"\n @click=${() => this._emit(\"retry\", { scope: \"initial\" })}\n >\n Retry\n </button>\n </div>\n `;\n }\n\n private _renderLoading() {\n return html`\n <div class=\"state\" part=\"loading\" data-testid=\"drawer-loading\" aria-busy=\"true\">\n Loading threads…\n </div>\n `;\n }\n\n private _renderList() {\n const visible = this._visibleThreads();\n if (visible.length === 0) {\n return html`\n <div class=\"state\" part=\"empty\" data-testid=\"drawer-empty\">\n <slot name=\"empty\">No threads yet.</slot>\n </div>\n `;\n }\n return html`\n <ul class=\"list\" part=\"list\" role=\"listbox\" aria-label=${this.label}>\n ${repeat(\n visible,\n (thread) => thread.id,\n (thread) => this._renderRow(thread),\n )}\n </ul>\n ${this._renderFetchMore()}\n `;\n }\n\n private _renderRow(thread: DrawerThread) {\n const isActive = thread.id === this.activeThreadId;\n const hasName = thread.name !== null && thread.name !== \"\";\n const justRevealed = this._justRevealed.has(thread.id);\n\n const rowClasses = {\n row: true,\n active: isActive,\n archived: thread.archived,\n };\n const nameClasses = {\n \"row-name\": true,\n placeholder: !hasName,\n revealed: justRevealed,\n };\n const slotName = rowSlotName(thread.id);\n // A long thread name is clipped with an ellipsis. The full name is exposed\n // via a tooltip styled to match the row-action tooltips (an instant primary\n // bubble, NOT the native `title`), shown only when the name is actually\n // truncated (`name-clipped`, toggled in `_syncNameClipping`). The name text\n // lives in an inner span that owns the ellipsis, so the outer `.row-name`\n // can host the tooltip pseudo-element without its own `overflow: hidden`\n // clipping it.\n const nameSpan = html`<span\n class=${classMap(nameClasses)}\n part=\"row-name\"\n data-tooltip=${hasName ? thread.name : nothing}\n >\n <span class=\"row-name-text\"\n >${hasName ? thread.name : \"New thread\"}</span\n >\n </span>`;\n\n return html`\n <li\n class=${classMap(rowClasses)}\n part=${isActive ? \"row row-active\" : \"row\"}\n role=\"option\"\n aria-selected=${isActive ? \"true\" : \"false\"}\n tabindex=\"0\"\n data-thread-id=${thread.id}\n @click=${() => this._emit(\"thread-selected\", { threadId: thread.id })}\n @keydown=${(e: KeyboardEvent) => {\n if (e.key === \"Enter\" || e.key === \" \") {\n e.preventDefault();\n this._emit(\"thread-selected\", { threadId: thread.id });\n }\n }}\n >\n ${\n slotName !== null\n ? html`<slot name=${slotName}>${nameSpan}</slot>`\n : nameSpan\n }\n ${\n thread.archived\n ? html`<button\n class=\"row-action\"\n part=\"row-unarchive\"\n data-tooltip=\"Unarchive\"\n aria-label=${`Unarchive thread ${thread.name ?? \"New thread\"}`}\n @click=${(e: Event) => {\n e.stopPropagation();\n this._emit(\"unarchive\", { threadId: thread.id });\n }}\n >\n ${iconUnarchive}\n </button>`\n : html`<button\n class=\"row-action\"\n part=\"row-archive\"\n data-tooltip=\"Archive\"\n aria-label=${`Archive thread ${thread.name ?? \"New thread\"}`}\n @click=${(e: Event) => {\n e.stopPropagation();\n this._emit(\"archive\", { threadId: thread.id });\n }}\n >\n ${iconArchive}\n </button>`\n }\n <button\n class=\"row-action danger\"\n part=\"row-delete\"\n data-tooltip=\"Delete\"\n aria-label=${`Delete thread ${thread.name ?? \"New thread\"}`}\n @click=${(e: Event) => {\n e.stopPropagation();\n this._confirmingDeleteId = thread.id;\n }}\n >\n ${iconDelete}\n </button>\n </li>\n `;\n }\n\n private _renderFetchMore() {\n if (hasErrorMessage(this.fetchMoreError)) {\n return html`\n <div class=\"fetch-more-error\" part=\"fetch-more-error\" role=\"alert\">\n Couldn't load more —\n <button\n class=\"row-action\"\n part=\"fetch-more-retry\"\n @click=${() => this._emit(\"retry\", { scope: \"fetch-more\" })}\n >\n retry\n </button>\n </div>\n `;\n }\n if (this.fetchingMore) {\n return html`\n <div class=\"state\" part=\"fetching-more\" aria-busy=\"true\">Loading more…</div>\n `;\n }\n if (this.hasMore) {\n return html`\n <button\n class=\"load-more\"\n part=\"load-more\"\n @click=${() => this._emit(\"load-more\", {})}\n >\n Load more\n </button>\n `;\n }\n return nothing;\n }\n\n private _renderMemories() {\n // Reserved region — hidden until a consumer projects content into the slot.\n // A `slotchange` listener drives `_hasMemories` so light-DOM mutations after\n // first render reactively reveal/hide the region.\n return html`\n <div class=\"memories\" part=\"memories\" ?hidden=${!this._hasMemories}>\n <slot\n name=\"memories\"\n @slotchange=${(e: Event) => {\n const slot = e.target as HTMLSlotElement;\n this._hasMemories = slot.assignedElements().length > 0;\n }}\n ></slot>\n </div>\n `;\n }\n\n private _renderFooter() {\n // Reserved region — hidden until a consumer projects content into the\n // `footer` slot. Without this gate the footer's top border + padding render\n // as an empty box at the bottom of the drawer. Mirrors `_renderMemories`.\n return html`\n <div class=\"footer\" part=\"footer\" ?hidden=${!this._hasFooter}>\n <slot\n name=\"footer\"\n @slotchange=${(e: Event) => {\n const slot = e.target as HTMLSlotElement;\n this._hasFooter = slot.assignedElements().length > 0;\n }}\n ></slot>\n </div>\n `;\n }\n\n private _renderConfirmDialog() {\n if (this._confirmingDeleteId === null) return nothing;\n const id = this._confirmingDeleteId;\n return html`\n <div class=\"dialog-backdrop\" part=\"dialog-backdrop\">\n <div\n class=\"dialog\"\n part=\"confirm-dialog\"\n role=\"alertdialog\"\n aria-modal=\"true\"\n aria-label=\"Confirm delete\"\n data-testid=\"drawer-confirm-delete\"\n >\n <p>Delete this thread? This cannot be undone.</p>\n <div class=\"dialog-actions\">\n <button\n class=\"row-action\"\n part=\"confirm-cancel\"\n @click=${() => (this._confirmingDeleteId = null)}\n >\n Cancel\n </button>\n <button\n class=\"primary\"\n part=\"confirm-delete\"\n @click=${() => {\n this._confirmingDeleteId = null;\n this._emit(\"delete\", { threadId: id });\n }}\n >\n Delete\n </button>\n </div>\n </div>\n </div>\n `;\n }\n}\n"],"mappings":";;;;;;;AAQA,MAAa,gCACX;;AAGF,MAAM,oBAAoB;;;;;;;AAQ1B,SAAS,gBAAgB,OAAuC;AAC9D,QAAO,UAAU,QAAQ,MAAM,MAAM,CAAC,SAAS;;;;;;;;;;;AAYjD,SAAS,YAAY,IAA2B;AAE9C,KAAI,GAAG,WAAW,KAAK,YAAY,KAAK,GAAG,CAAE,QAAO;AACpD,QAAO,OAAO;;;;;;;;AAShB,MAAM,cAAc,QAAI;;;;;;;;;;;;;;;;AAgBxB,MAAM,gBAAgB,QAAI;;;;;;;;;;;;;;;;;;AAkB1B,MAAM,aAAa,QAAI;;;;;;;;;;;;;;;;;;;AAmBvB,MAAM,eAAe,QAA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mBAAmB;AACzB,MAAI,gBAAgB,KAAK,eAAe,CACtC,QAAO,QAAI;;;;;;2BAMU,KAAK,MAAM,SAAS,EAAE,OAAO,cAAc,CAAC,CAAC;;;;;;AAOpE,MAAI,KAAK,aACP,QAAO,QAAI;;;AAIb,MAAI,KAAK,QACP,QAAO,QAAI;;;;yBAIQ,KAAK,MAAM,aAAa,EAAE,CAAC,CAAC;;;;;AAMjD,SAAOA;;CAGT,AAAQ,kBAAkB;AAIxB,SAAO,QAAI;sDACuC,CAAC,KAAK,aAAa;;;yBAGhD,MAAa;AAE1B,QAAK,eADQ,EAAE,OACU,kBAAkB,CAAC,SAAS;IACrD;;;;;CAMV,AAAQ,gBAAgB;AAItB,SAAO,QAAI;kDACmC,CAAC,KAAK,WAAW;;;yBAG1C,MAAa;AAE1B,QAAK,aADQ,EAAE,OACQ,kBAAkB,CAAC,SAAS;IACnD;;;;;CAMV,AAAQ,uBAAuB;AAC7B,MAAI,KAAK,wBAAwB,KAAM,QAAOA;EAC9C,MAAM,KAAK,KAAK;AAChB,SAAO,QAAI;;;;;;;;;;;;;;;6BAee,KAAK,sBAAsB,KAAM;;;;;;;6BAOlC;AACb,QAAK,sBAAsB;AAC3B,QAAK,MAAM,UAAU,EAAE,UAAU,IAAI,CAAC;IACtC"}
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import { DrawerThread } from "./types.cjs";
|
|
2
|
+
import * as lit from "lit";
|
|
3
|
+
import { LitElement, PropertyValues } from "lit";
|
|
4
|
+
|
|
5
|
+
//#region src/threads-drawer/copilotkit-threads-drawer.d.ts
|
|
6
|
+
/** Tag name the element registers under. */
|
|
7
|
+
declare const COPILOTKIT_THREADS_DRAWER_TAG: "copilotkit-threads-drawer";
|
|
8
|
+
/**
|
|
9
|
+
* `<copilotkit-threads-drawer>` — a public, self-contained, controlled, framework-agnostic
|
|
10
|
+
* threads drawer rendered into a shadow root.
|
|
11
|
+
*
|
|
12
|
+
* Pure VIEW: domain data (threads/loading/error/etc.) comes IN as properties and
|
|
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
|
|
15
|
+
* animations) while the consumer owns DOMAIN state. `open` is additionally
|
|
16
|
+
* externally controllable via the `open` property + `open-change` event so a
|
|
17
|
+
* host can coordinate mobile open/close.
|
|
18
|
+
*
|
|
19
|
+
* The element is AUTHORITATIVE over row order and the Active/All filter.
|
|
20
|
+
*/
|
|
21
|
+
declare class CopilotKitThreadsDrawer extends LitElement {
|
|
22
|
+
static styles: lit.CSSResult;
|
|
23
|
+
static properties: {
|
|
24
|
+
threads: {
|
|
25
|
+
attribute: boolean;
|
|
26
|
+
};
|
|
27
|
+
loading: {
|
|
28
|
+
type: BooleanConstructor;
|
|
29
|
+
};
|
|
30
|
+
error: {
|
|
31
|
+
type: StringConstructor;
|
|
32
|
+
};
|
|
33
|
+
activeThreadId: {
|
|
34
|
+
attribute: string;
|
|
35
|
+
type: StringConstructor;
|
|
36
|
+
};
|
|
37
|
+
licensed: {
|
|
38
|
+
type: BooleanConstructor;
|
|
39
|
+
};
|
|
40
|
+
licenseUrl: {
|
|
41
|
+
attribute: string;
|
|
42
|
+
type: StringConstructor;
|
|
43
|
+
};
|
|
44
|
+
hasMore: {
|
|
45
|
+
attribute: string;
|
|
46
|
+
type: BooleanConstructor;
|
|
47
|
+
};
|
|
48
|
+
fetchingMore: {
|
|
49
|
+
attribute: string;
|
|
50
|
+
type: BooleanConstructor;
|
|
51
|
+
};
|
|
52
|
+
fetchMoreError: {
|
|
53
|
+
attribute: string;
|
|
54
|
+
type: StringConstructor;
|
|
55
|
+
};
|
|
56
|
+
label: {
|
|
57
|
+
type: StringConstructor;
|
|
58
|
+
};
|
|
59
|
+
open: {
|
|
60
|
+
type: BooleanConstructor;
|
|
61
|
+
reflect: boolean;
|
|
62
|
+
};
|
|
63
|
+
collapsed: {
|
|
64
|
+
type: BooleanConstructor;
|
|
65
|
+
reflect: boolean;
|
|
66
|
+
};
|
|
67
|
+
_filter: {
|
|
68
|
+
state: boolean;
|
|
69
|
+
};
|
|
70
|
+
_confirmingDeleteId: {
|
|
71
|
+
state: boolean;
|
|
72
|
+
};
|
|
73
|
+
_viewportIsMobile: {
|
|
74
|
+
state: boolean;
|
|
75
|
+
};
|
|
76
|
+
_hasMemories: {
|
|
77
|
+
state: boolean;
|
|
78
|
+
};
|
|
79
|
+
_hasFooter: {
|
|
80
|
+
state: boolean;
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
/**
|
|
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"`.
|
|
87
|
+
*/
|
|
88
|
+
label: string;
|
|
89
|
+
/** Inbound: thread records to render. The element re-orders/filters them. */
|
|
90
|
+
threads: DrawerThread[];
|
|
91
|
+
/** Inbound: initial-fetch loading flag. */
|
|
92
|
+
loading: boolean;
|
|
93
|
+
/** Inbound: initial-fetch error message (actionable Retry shown when set). */
|
|
94
|
+
error: string | null;
|
|
95
|
+
/** Inbound: currently-open thread id (drives row selection highlight). */
|
|
96
|
+
activeThreadId: string | null;
|
|
97
|
+
/** Inbound: whether the org is licensed for threads; `false` shows the locked view. */
|
|
98
|
+
licensed: boolean;
|
|
99
|
+
/**
|
|
100
|
+
* Inbound: destination the Upgrade CTA opens (new tab) when the locked view's
|
|
101
|
+
* default button is clicked. Defaults to the CopilotKit Intelligence docs.
|
|
102
|
+
* Set to an empty string to suppress the default navigation and rely solely
|
|
103
|
+
* on the `licensed` event.
|
|
104
|
+
*/
|
|
105
|
+
licenseUrl: string;
|
|
106
|
+
/** Inbound: whether more pages are available. */
|
|
107
|
+
hasMore: boolean;
|
|
108
|
+
/** Inbound: whether a fetch-more is in flight. */
|
|
109
|
+
fetchingMore: boolean;
|
|
110
|
+
/** Inbound: fetch-more error message (inline, list preserved). */
|
|
111
|
+
fetchMoreError: string | null;
|
|
112
|
+
/** Externally-controllable: whether the drawer is open (mobile coordination). */
|
|
113
|
+
open: boolean;
|
|
114
|
+
/** Externally-controllable: whether the drawer is collapsed to a rail (desktop). */
|
|
115
|
+
collapsed: boolean;
|
|
116
|
+
private _filter;
|
|
117
|
+
private _confirmingDeleteId;
|
|
118
|
+
private _viewportIsMobile;
|
|
119
|
+
private _hasMemories;
|
|
120
|
+
private _hasFooter;
|
|
121
|
+
private _mediaQuery;
|
|
122
|
+
private readonly _onMediaChange;
|
|
123
|
+
private readonly _onKeyDown;
|
|
124
|
+
/** Thread ids previously seen as named, so we can animate the null→named reveal. */
|
|
125
|
+
private readonly _seenNamed;
|
|
126
|
+
/** Thread ids whose name just transitioned null→named in this update cycle. */
|
|
127
|
+
private _justRevealed;
|
|
128
|
+
connectedCallback(): void;
|
|
129
|
+
disconnectedCallback(): void;
|
|
130
|
+
protected willUpdate(changed: PropertyValues<this>): void;
|
|
131
|
+
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
|
+
private _isMobileModalOpen;
|
|
140
|
+
private _setOpen;
|
|
141
|
+
private _setFilter;
|
|
142
|
+
/**
|
|
143
|
+
* Element-authoritative ordering + filtering. Active filter hides archived
|
|
144
|
+
* threads; ordering is most-recent-first by `lastRunAt`/`updatedAt`.
|
|
145
|
+
*/
|
|
146
|
+
private _visibleThreads;
|
|
147
|
+
private _emit;
|
|
148
|
+
private _scrollLocked;
|
|
149
|
+
private _prevBodyOverflow;
|
|
150
|
+
private _applyScrollLock;
|
|
151
|
+
private _releaseScrollLock;
|
|
152
|
+
/**
|
|
153
|
+
* Returns the focusable elements in the composed/flattened tree of the drawer
|
|
154
|
+
* root, INCLUDING slotted light-DOM content (so a focus trap covers slotted
|
|
155
|
+
* rows). Walks assigned nodes of each `<slot>`.
|
|
156
|
+
*/
|
|
157
|
+
private _composedFocusable;
|
|
158
|
+
private _focusFirstFocusable;
|
|
159
|
+
private readonly _trapTab;
|
|
160
|
+
render(): lit.TemplateResult<1>;
|
|
161
|
+
private _renderHeader;
|
|
162
|
+
private _renderBody;
|
|
163
|
+
/**
|
|
164
|
+
* Handles the Upgrade CTA click in the locked view. Dispatches a cancelable
|
|
165
|
+
* `licensed` event carrying the resolved `licenseUrl`; unless a host calls
|
|
166
|
+
* `preventDefault()`, opens that URL in a new tab. A blank `licenseUrl`
|
|
167
|
+
* suppresses navigation so the event alone drives host behavior.
|
|
168
|
+
*/
|
|
169
|
+
private _onLicensedCta;
|
|
170
|
+
private _renderLicensed;
|
|
171
|
+
private _renderError;
|
|
172
|
+
private _renderLoading;
|
|
173
|
+
private _renderList;
|
|
174
|
+
private _renderRow;
|
|
175
|
+
private _renderFetchMore;
|
|
176
|
+
private _renderMemories;
|
|
177
|
+
private _renderFooter;
|
|
178
|
+
private _renderConfirmDialog;
|
|
179
|
+
}
|
|
180
|
+
//#endregion
|
|
181
|
+
export { COPILOTKIT_THREADS_DRAWER_TAG, CopilotKitThreadsDrawer };
|
|
182
|
+
//# sourceMappingURL=copilotkit-threads-drawer.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copilotkit-threads-drawer.d.cts","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,KAA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it";
|
|
4
|
+
|
|
5
|
+
//#region src/threads-drawer/copilotkit-threads-drawer.d.ts
|
|
6
|
+
/** Tag name the element registers under. */
|
|
7
|
+
declare const COPILOTKIT_THREADS_DRAWER_TAG: "copilotkit-threads-drawer";
|
|
8
|
+
/**
|
|
9
|
+
* `<copilotkit-threads-drawer>` — a public, self-contained, controlled, framework-agnostic
|
|
10
|
+
* threads drawer rendered into a shadow root.
|
|
11
|
+
*
|
|
12
|
+
* Pure VIEW: domain data (threads/loading/error/etc.) comes IN as properties and
|
|
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
|
|
15
|
+
* animations) while the consumer owns DOMAIN state. `open` is additionally
|
|
16
|
+
* externally controllable via the `open` property + `open-change` event so a
|
|
17
|
+
* host can coordinate mobile open/close.
|
|
18
|
+
*
|
|
19
|
+
* The element is AUTHORITATIVE over row order and the Active/All filter.
|
|
20
|
+
*/
|
|
21
|
+
declare class CopilotKitThreadsDrawer extends LitElement {
|
|
22
|
+
static styles: lit.CSSResult;
|
|
23
|
+
static properties: {
|
|
24
|
+
threads: {
|
|
25
|
+
attribute: boolean;
|
|
26
|
+
};
|
|
27
|
+
loading: {
|
|
28
|
+
type: BooleanConstructor;
|
|
29
|
+
};
|
|
30
|
+
error: {
|
|
31
|
+
type: StringConstructor;
|
|
32
|
+
};
|
|
33
|
+
activeThreadId: {
|
|
34
|
+
attribute: string;
|
|
35
|
+
type: StringConstructor;
|
|
36
|
+
};
|
|
37
|
+
licensed: {
|
|
38
|
+
type: BooleanConstructor;
|
|
39
|
+
};
|
|
40
|
+
licenseUrl: {
|
|
41
|
+
attribute: string;
|
|
42
|
+
type: StringConstructor;
|
|
43
|
+
};
|
|
44
|
+
hasMore: {
|
|
45
|
+
attribute: string;
|
|
46
|
+
type: BooleanConstructor;
|
|
47
|
+
};
|
|
48
|
+
fetchingMore: {
|
|
49
|
+
attribute: string;
|
|
50
|
+
type: BooleanConstructor;
|
|
51
|
+
};
|
|
52
|
+
fetchMoreError: {
|
|
53
|
+
attribute: string;
|
|
54
|
+
type: StringConstructor;
|
|
55
|
+
};
|
|
56
|
+
label: {
|
|
57
|
+
type: StringConstructor;
|
|
58
|
+
};
|
|
59
|
+
open: {
|
|
60
|
+
type: BooleanConstructor;
|
|
61
|
+
reflect: boolean;
|
|
62
|
+
};
|
|
63
|
+
collapsed: {
|
|
64
|
+
type: BooleanConstructor;
|
|
65
|
+
reflect: boolean;
|
|
66
|
+
};
|
|
67
|
+
_filter: {
|
|
68
|
+
state: boolean;
|
|
69
|
+
};
|
|
70
|
+
_confirmingDeleteId: {
|
|
71
|
+
state: boolean;
|
|
72
|
+
};
|
|
73
|
+
_viewportIsMobile: {
|
|
74
|
+
state: boolean;
|
|
75
|
+
};
|
|
76
|
+
_hasMemories: {
|
|
77
|
+
state: boolean;
|
|
78
|
+
};
|
|
79
|
+
_hasFooter: {
|
|
80
|
+
state: boolean;
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
/**
|
|
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"`.
|
|
87
|
+
*/
|
|
88
|
+
label: string;
|
|
89
|
+
/** Inbound: thread records to render. The element re-orders/filters them. */
|
|
90
|
+
threads: DrawerThread[];
|
|
91
|
+
/** Inbound: initial-fetch loading flag. */
|
|
92
|
+
loading: boolean;
|
|
93
|
+
/** Inbound: initial-fetch error message (actionable Retry shown when set). */
|
|
94
|
+
error: string | null;
|
|
95
|
+
/** Inbound: currently-open thread id (drives row selection highlight). */
|
|
96
|
+
activeThreadId: string | null;
|
|
97
|
+
/** Inbound: whether the org is licensed for threads; `false` shows the locked view. */
|
|
98
|
+
licensed: boolean;
|
|
99
|
+
/**
|
|
100
|
+
* Inbound: destination the Upgrade CTA opens (new tab) when the locked view's
|
|
101
|
+
* default button is clicked. Defaults to the CopilotKit Intelligence docs.
|
|
102
|
+
* Set to an empty string to suppress the default navigation and rely solely
|
|
103
|
+
* on the `licensed` event.
|
|
104
|
+
*/
|
|
105
|
+
licenseUrl: string;
|
|
106
|
+
/** Inbound: whether more pages are available. */
|
|
107
|
+
hasMore: boolean;
|
|
108
|
+
/** Inbound: whether a fetch-more is in flight. */
|
|
109
|
+
fetchingMore: boolean;
|
|
110
|
+
/** Inbound: fetch-more error message (inline, list preserved). */
|
|
111
|
+
fetchMoreError: string | null;
|
|
112
|
+
/** Externally-controllable: whether the drawer is open (mobile coordination). */
|
|
113
|
+
open: boolean;
|
|
114
|
+
/** Externally-controllable: whether the drawer is collapsed to a rail (desktop). */
|
|
115
|
+
collapsed: boolean;
|
|
116
|
+
private _filter;
|
|
117
|
+
private _confirmingDeleteId;
|
|
118
|
+
private _viewportIsMobile;
|
|
119
|
+
private _hasMemories;
|
|
120
|
+
private _hasFooter;
|
|
121
|
+
private _mediaQuery;
|
|
122
|
+
private readonly _onMediaChange;
|
|
123
|
+
private readonly _onKeyDown;
|
|
124
|
+
/** Thread ids previously seen as named, so we can animate the null→named reveal. */
|
|
125
|
+
private readonly _seenNamed;
|
|
126
|
+
/** Thread ids whose name just transitioned null→named in this update cycle. */
|
|
127
|
+
private _justRevealed;
|
|
128
|
+
connectedCallback(): void;
|
|
129
|
+
disconnectedCallback(): void;
|
|
130
|
+
protected willUpdate(changed: PropertyValues<this>): void;
|
|
131
|
+
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
|
+
private _isMobileModalOpen;
|
|
140
|
+
private _setOpen;
|
|
141
|
+
private _setFilter;
|
|
142
|
+
/**
|
|
143
|
+
* Element-authoritative ordering + filtering. Active filter hides archived
|
|
144
|
+
* threads; ordering is most-recent-first by `lastRunAt`/`updatedAt`.
|
|
145
|
+
*/
|
|
146
|
+
private _visibleThreads;
|
|
147
|
+
private _emit;
|
|
148
|
+
private _scrollLocked;
|
|
149
|
+
private _prevBodyOverflow;
|
|
150
|
+
private _applyScrollLock;
|
|
151
|
+
private _releaseScrollLock;
|
|
152
|
+
/**
|
|
153
|
+
* Returns the focusable elements in the composed/flattened tree of the drawer
|
|
154
|
+
* root, INCLUDING slotted light-DOM content (so a focus trap covers slotted
|
|
155
|
+
* rows). Walks assigned nodes of each `<slot>`.
|
|
156
|
+
*/
|
|
157
|
+
private _composedFocusable;
|
|
158
|
+
private _focusFirstFocusable;
|
|
159
|
+
private readonly _trapTab;
|
|
160
|
+
render(): lit.TemplateResult<1>;
|
|
161
|
+
private _renderHeader;
|
|
162
|
+
private _renderBody;
|
|
163
|
+
/**
|
|
164
|
+
* Handles the Upgrade CTA click in the locked view. Dispatches a cancelable
|
|
165
|
+
* `licensed` event carrying the resolved `licenseUrl`; unless a host calls
|
|
166
|
+
* `preventDefault()`, opens that URL in a new tab. A blank `licenseUrl`
|
|
167
|
+
* suppresses navigation so the event alone drives host behavior.
|
|
168
|
+
*/
|
|
169
|
+
private _onLicensedCta;
|
|
170
|
+
private _renderLicensed;
|
|
171
|
+
private _renderError;
|
|
172
|
+
private _renderLoading;
|
|
173
|
+
private _renderList;
|
|
174
|
+
private _renderRow;
|
|
175
|
+
private _renderFetchMore;
|
|
176
|
+
private _renderMemories;
|
|
177
|
+
private _renderFooter;
|
|
178
|
+
private _renderConfirmDialog;
|
|
179
|
+
}
|
|
180
|
+
//#endregion
|
|
181
|
+
export { COPILOTKIT_THREADS_DRAWER_TAG, CopilotKitThreadsDrawer };
|
|
182
|
+
//# sourceMappingURL=copilotkit-threads-drawer.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{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