@assistant-ui/react
Version:
Typescript/React library for AI Chat
1 lines • 1.73 kB
Source Map (JSON)
{"version":3,"sources":["../../../src/context/react/ThreadListItemContext.ts"],"sourcesContent":["\"use client\";\n\nimport { createContext } from \"react\";\nimport { ReadonlyStore } from \"../ReadonlyStore\";\nimport { createContextHook } from \"./utils/createContextHook\";\nimport { UseBoundStore } from \"zustand\";\nimport { ThreadListItemRuntime } from \"../../api/ThreadListItemRuntime\";\nimport { createStateHookForRuntime } from \"./utils/createStateHookForRuntime\";\n\nexport type ThreadListItemContextValue = {\n useThreadListItemRuntime: UseBoundStore<ReadonlyStore<ThreadListItemRuntime>>;\n};\n\nexport const ThreadListItemContext =\n createContext<ThreadListItemContextValue | null>(null);\n\nconst useThreadListItemContext = createContextHook(\n ThreadListItemContext,\n \"a component passed to <ThreadListPrimitive.Items components={...}>\",\n);\n\nexport function useThreadListItemRuntime(options?: {\n optional?: false | undefined;\n}): ThreadListItemRuntime;\nexport function useThreadListItemRuntime(options?: {\n optional?: boolean | undefined;\n}): ThreadListItemRuntime | null;\nexport function useThreadListItemRuntime(options?: {\n optional?: boolean | undefined;\n}) {\n const context = useThreadListItemContext(options);\n if (!context) return null;\n return context.useThreadListItemRuntime();\n}\n\nexport const useThreadListItem = createStateHookForRuntime(\n useThreadListItemRuntime,\n);\n"],"mappings":";;;AAEA,SAAS,qBAAqB;AAE9B,SAAS,yBAAyB;AAGlC,SAAS,iCAAiC;AAMnC,IAAM,wBACX,cAAiD,IAAI;AAEvD,IAAM,2BAA2B;AAAA,EAC/B;AAAA,EACA;AACF;AAQO,SAAS,yBAAyB,SAEtC;AACD,QAAM,UAAU,yBAAyB,OAAO;AAChD,MAAI,CAAC,QAAS,QAAO;AACrB,SAAO,QAAQ,yBAAyB;AAC1C;AAEO,IAAM,oBAAoB;AAAA,EAC/B;AACF;","names":[]}