UNPKG

@assistant-ui/react

Version:

Typescript/React library for AI Chat

96 lines (95 loc) 3.28 kB
"use strict"; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __hasOwnProp = Object.prototype.hasOwnProperty; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); // src/api/ThreadListItemRuntime.ts var ThreadListItemRuntime_exports = {}; __export(ThreadListItemRuntime_exports, { ThreadListItemRuntimeImpl: () => ThreadListItemRuntimeImpl }); module.exports = __toCommonJS(ThreadListItemRuntime_exports); var ThreadListItemRuntimeImpl = class { constructor(_core, _threadListBinding) { this._core = _core; this._threadListBinding = _threadListBinding; } get path() { return this._core.path; } __internal_bindMethods() { this.switchTo = this.switchTo.bind(this); this.rename = this.rename.bind(this); this.archive = this.archive.bind(this); this.unarchive = this.unarchive.bind(this); this.delete = this.delete.bind(this); this.initialize = this.initialize.bind(this); this.generateTitle = this.generateTitle.bind(this); this.subscribe = this.subscribe.bind(this); this.unstable_on = this.unstable_on.bind(this); this.getState = this.getState.bind(this); } getState() { return this._core.getState(); } switchTo() { const state = this._core.getState(); return this._threadListBinding.switchToThread(state.id); } rename(newTitle) { const state = this._core.getState(); return this._threadListBinding.rename(state.id, newTitle); } archive() { const state = this._core.getState(); return this._threadListBinding.archive(state.id); } unarchive() { const state = this._core.getState(); return this._threadListBinding.unarchive(state.id); } delete() { const state = this._core.getState(); return this._threadListBinding.delete(state.id); } initialize() { const state = this._core.getState(); return this._threadListBinding.initialize(state.id); } generateTitle() { const state = this._core.getState(); return this._threadListBinding.generateTitle(state.id); } unstable_on(event, callback) { let prevIsMain = this._core.getState().isMain; return this.subscribe(() => { const newIsMain = this._core.getState().isMain; if (prevIsMain === newIsMain) return; prevIsMain = newIsMain; if (event === "switched-to" && !newIsMain) return; if (event === "switched-away" && newIsMain) return; callback(); }); } subscribe(callback) { return this._core.subscribe(callback); } }; // Annotate the CommonJS export names for ESM import in node: 0 && (module.exports = { ThreadListItemRuntimeImpl }); //# sourceMappingURL=ThreadListItemRuntime.js.map