@assistant-ui/react 0.12.14 → 0.12.16
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/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/internal.d.ts +1 -1
- package/dist/internal.d.ts.map +1 -1
- package/dist/internal.js +1 -1
- package/dist/internal.js.map +1 -1
- package/dist/legacy-runtime/cloud/AssistantCloudThreadHistoryAdapter.d.ts +1 -4
- package/dist/legacy-runtime/cloud/AssistantCloudThreadHistoryAdapter.d.ts.map +1 -1
- package/dist/legacy-runtime/cloud/AssistantCloudThreadHistoryAdapter.js +2 -527
- package/dist/legacy-runtime/cloud/AssistantCloudThreadHistoryAdapter.js.map +1 -1
- package/dist/legacy-runtime/hooks/AttachmentContext.d.ts +96 -96
- package/dist/legacy-runtime/runtime-cores/adapters/RuntimeAdapterProvider.d.ts +1 -16
- package/dist/legacy-runtime/runtime-cores/adapters/RuntimeAdapterProvider.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/adapters/RuntimeAdapterProvider.js +1 -14
- package/dist/legacy-runtime/runtime-cores/adapters/RuntimeAdapterProvider.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/adapters/attachment/CloudFileAttachmentAdapter.d.ts +1 -13
- package/dist/legacy-runtime/runtime-cores/adapters/attachment/CloudFileAttachmentAdapter.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/adapters/attachment/CloudFileAttachmentAdapter.js +2 -82
- package/dist/legacy-runtime/runtime-cores/adapters/attachment/CloudFileAttachmentAdapter.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/assistant-transport/useToolInvocations.d.ts +1 -23
- package/dist/legacy-runtime/runtime-cores/assistant-transport/useToolInvocations.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/assistant-transport/useToolInvocations.js +1 -305
- package/dist/legacy-runtime/runtime-cores/assistant-transport/useToolInvocations.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/external-store/createMessageConverter.d.ts +1 -16
- package/dist/legacy-runtime/runtime-cores/external-store/createMessageConverter.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/external-store/createMessageConverter.js +1 -48
- package/dist/legacy-runtime/runtime-cores/external-store/createMessageConverter.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/external-store/external-message-converter.d.ts +1 -33
- package/dist/legacy-runtime/runtime-cores/external-store/external-message-converter.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/external-store/external-message-converter.js +1 -295
- package/dist/legacy-runtime/runtime-cores/external-store/external-message-converter.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/external-store/useExternalStoreRuntime.d.ts +1 -3
- package/dist/legacy-runtime/runtime-cores/external-store/useExternalStoreRuntime.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/external-store/useExternalStoreRuntime.js +1 -17
- package/dist/legacy-runtime/runtime-cores/external-store/useExternalStoreRuntime.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/local/LocalRuntimeOptions.d.ts +1 -1
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/RemoteThreadListHookInstanceManager.d.ts +1 -96
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/RemoteThreadListHookInstanceManager.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/RemoteThreadListHookInstanceManager.js +1 -110
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/RemoteThreadListHookInstanceManager.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/RemoteThreadListThreadListRuntimeCore.d.ts +1 -112
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/RemoteThreadListThreadListRuntimeCore.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/RemoteThreadListThreadListRuntimeCore.js +1 -439
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/RemoteThreadListThreadListRuntimeCore.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/adapter/cloud.d.ts +1 -12
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/adapter/cloud.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/adapter/cloud.js +1 -102
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/adapter/cloud.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/useRemoteThreadListRuntime.d.ts +1 -3
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/useRemoteThreadListRuntime.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/useRemoteThreadListRuntime.js +1 -46
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/useRemoteThreadListRuntime.js.map +1 -1
- package/dist/primitives/actionBar/ActionBarInteractionContext.d.ts +6 -0
- package/dist/primitives/actionBar/ActionBarInteractionContext.d.ts.map +1 -0
- package/dist/primitives/actionBar/ActionBarInteractionContext.js +5 -0
- package/dist/primitives/actionBar/ActionBarInteractionContext.js.map +1 -0
- package/dist/primitives/actionBar/ActionBarRoot.d.ts.map +1 -1
- package/dist/primitives/actionBar/ActionBarRoot.js +18 -4
- package/dist/primitives/actionBar/ActionBarRoot.js.map +1 -1
- package/dist/primitives/actionBar/useActionBarFloatStatus.d.ts +2 -1
- package/dist/primitives/actionBar/useActionBarFloatStatus.d.ts.map +1 -1
- package/dist/primitives/actionBar/useActionBarFloatStatus.js +3 -2
- package/dist/primitives/actionBar/useActionBarFloatStatus.js.map +1 -1
- package/dist/primitives/actionBarMore/ActionBarMoreRoot.d.ts.map +1 -1
- package/dist/primitives/actionBarMore/ActionBarMoreRoot.js +35 -2
- package/dist/primitives/actionBarMore/ActionBarMoreRoot.js.map +1 -1
- package/dist/utils/createActionButton.js +1 -1
- package/dist/utils/createActionButton.js.map +1 -1
- package/dist/utils/json/is-json-equal.d.ts +2 -0
- package/dist/utils/json/is-json-equal.d.ts.map +1 -0
- package/dist/utils/json/is-json-equal.js +31 -0
- package/dist/utils/json/is-json-equal.js.map +1 -0
- package/dist/utils/json/is-json.d.ts +1 -0
- package/dist/utils/json/is-json.d.ts.map +1 -1
- package/dist/utils/json/is-json.js +5 -3
- package/dist/utils/json/is-json.js.map +1 -1
- package/package.json +8 -8
- package/src/index.ts +1 -1
- package/src/internal.ts +1 -1
- package/src/legacy-runtime/cloud/AssistantCloudThreadHistoryAdapter.ts +2 -784
- package/src/legacy-runtime/runtime-cores/adapters/RuntimeAdapterProvider.tsx +5 -43
- package/src/legacy-runtime/runtime-cores/adapters/attachment/CloudFileAttachmentAdapter.ts +2 -100
- package/src/legacy-runtime/runtime-cores/assistant-transport/useToolInvocations.test.ts +225 -2
- package/src/legacy-runtime/runtime-cores/assistant-transport/useToolInvocations.ts +4 -439
- package/src/legacy-runtime/runtime-cores/external-store/createMessageConverter.ts +1 -76
- package/src/legacy-runtime/runtime-cores/external-store/external-message-converter.ts +4 -465
- package/src/legacy-runtime/runtime-cores/external-store/useExternalStoreRuntime.ts +1 -27
- package/src/legacy-runtime/runtime-cores/remote-thread-list/RemoteThreadListHookInstanceManager.tsx +1 -178
- package/src/legacy-runtime/runtime-cores/remote-thread-list/RemoteThreadListThreadListRuntimeCore.tsx +1 -529
- package/src/legacy-runtime/runtime-cores/remote-thread-list/adapter/cloud.tsx +1 -152
- package/src/legacy-runtime/runtime-cores/remote-thread-list/useRemoteThreadListRuntime.ts +1 -80
- package/src/primitives/actionBar/ActionBarInteractionContext.ts +13 -0
- package/src/primitives/actionBar/ActionBarRoot.tsx +38 -8
- package/src/primitives/actionBar/useActionBarFloatStatus.ts +4 -1
- package/src/primitives/actionBarMore/ActionBarMoreRoot.tsx +52 -2
- package/src/tests/BaseComposerRuntimeCore.test.ts +2 -3
- package/src/tests/external-message-converter.test.ts +80 -0
- package/src/utils/createActionButton.tsx +1 -1
- package/src/utils/json/is-json-equal.ts +48 -0
- package/src/utils/json/is-json.ts +6 -3
|
@@ -1,104 +1,3 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
|
|
3
|
-
import { useCallback, useEffect, useMemo, useRef, } from "react";
|
|
4
|
-
import { AssistantCloud } from "assistant-cloud";
|
|
5
|
-
import { InMemoryThreadListAdapter } from "@assistant-ui/core";
|
|
6
|
-
import { useAssistantCloudThreadHistoryAdapter } from "../../../cloud/AssistantCloudThreadHistoryAdapter.js";
|
|
7
|
-
import { RuntimeAdapterProvider } from "../../adapters/RuntimeAdapterProvider.js";
|
|
8
|
-
import { CloudFileAttachmentAdapter } from "../../adapters/index.js";
|
|
9
|
-
const baseUrl = typeof process !== "undefined" &&
|
|
10
|
-
process?.env?.["NEXT_PUBLIC_ASSISTANT_BASE_URL"];
|
|
11
|
-
const autoCloud = baseUrl
|
|
12
|
-
? new AssistantCloud({ baseUrl, anonymous: true })
|
|
13
|
-
: undefined;
|
|
14
|
-
export const useCloudThreadListAdapter = (adapter) => {
|
|
15
|
-
const adapterRef = useRef(adapter);
|
|
16
|
-
useEffect(() => {
|
|
17
|
-
adapterRef.current = adapter;
|
|
18
|
-
}, [adapter]);
|
|
19
|
-
const unstable_Provider = useCallback(function Provider({ children }) {
|
|
20
|
-
const history = useAssistantCloudThreadHistoryAdapter({
|
|
21
|
-
get current() {
|
|
22
|
-
return adapterRef.current.cloud ?? autoCloud;
|
|
23
|
-
},
|
|
24
|
-
});
|
|
25
|
-
const cloudInstance = adapterRef.current.cloud ?? autoCloud;
|
|
26
|
-
const attachments = useMemo(() => new CloudFileAttachmentAdapter(cloudInstance), [cloudInstance]);
|
|
27
|
-
const adapters = useMemo(() => ({
|
|
28
|
-
history,
|
|
29
|
-
attachments,
|
|
30
|
-
}), [history, attachments]);
|
|
31
|
-
return (_jsx(RuntimeAdapterProvider, { adapters: adapters, children: children }));
|
|
32
|
-
}, []);
|
|
33
|
-
const cloud = adapter.cloud ?? autoCloud;
|
|
34
|
-
if (!cloud) {
|
|
35
|
-
const ref = adapterRef;
|
|
36
|
-
const inMemory = new InMemoryThreadListAdapter();
|
|
37
|
-
inMemory.initialize = async (threadId) => {
|
|
38
|
-
const result = await ref.current.create?.();
|
|
39
|
-
return { remoteId: threadId, externalId: result?.externalId };
|
|
40
|
-
};
|
|
41
|
-
return inMemory;
|
|
42
|
-
}
|
|
43
|
-
return {
|
|
44
|
-
list: async () => {
|
|
45
|
-
const { threads } = await cloud.threads.list();
|
|
46
|
-
return {
|
|
47
|
-
threads: threads.map((t) => ({
|
|
48
|
-
status: t.is_archived ? "archived" : "regular",
|
|
49
|
-
remoteId: t.id,
|
|
50
|
-
title: t.title,
|
|
51
|
-
externalId: t.external_id ?? undefined,
|
|
52
|
-
})),
|
|
53
|
-
};
|
|
54
|
-
},
|
|
55
|
-
initialize: async () => {
|
|
56
|
-
const createTask = adapter.create?.() ?? Promise.resolve();
|
|
57
|
-
const t = await createTask;
|
|
58
|
-
const external_id = t ? t.externalId : undefined;
|
|
59
|
-
const { thread_id: remoteId } = await cloud.threads.create({
|
|
60
|
-
last_message_at: new Date(),
|
|
61
|
-
external_id,
|
|
62
|
-
});
|
|
63
|
-
return { externalId: external_id, remoteId: remoteId };
|
|
64
|
-
},
|
|
65
|
-
rename: async (threadId, newTitle) => {
|
|
66
|
-
return cloud.threads.update(threadId, { title: newTitle });
|
|
67
|
-
},
|
|
68
|
-
archive: async (threadId) => {
|
|
69
|
-
return cloud.threads.update(threadId, { is_archived: true });
|
|
70
|
-
},
|
|
71
|
-
unarchive: async (threadId) => {
|
|
72
|
-
return cloud.threads.update(threadId, { is_archived: false });
|
|
73
|
-
},
|
|
74
|
-
delete: async (threadId) => {
|
|
75
|
-
await adapter.delete?.(threadId);
|
|
76
|
-
return cloud.threads.delete(threadId);
|
|
77
|
-
},
|
|
78
|
-
generateTitle: async (threadId, messages) => {
|
|
79
|
-
// Filter messages to only include content types the title generator understands
|
|
80
|
-
// (reasoning, source, etc. are not needed for title generation)
|
|
81
|
-
// TODO serialize these to a more efficient format
|
|
82
|
-
const filteredMessages = messages.map((msg) => ({
|
|
83
|
-
...msg,
|
|
84
|
-
content: msg.content.filter((part) => part.type === "text" || part.type === "tool-call"),
|
|
85
|
-
}));
|
|
86
|
-
return cloud.runs.stream({
|
|
87
|
-
thread_id: threadId,
|
|
88
|
-
assistant_id: "system/thread_title",
|
|
89
|
-
messages: filteredMessages,
|
|
90
|
-
});
|
|
91
|
-
},
|
|
92
|
-
fetch: async (threadId) => {
|
|
93
|
-
const thread = await cloud.threads.get(threadId);
|
|
94
|
-
return {
|
|
95
|
-
status: thread.is_archived ? "archived" : "regular",
|
|
96
|
-
remoteId: thread.id,
|
|
97
|
-
title: thread.title,
|
|
98
|
-
externalId: thread.external_id ?? undefined,
|
|
99
|
-
};
|
|
100
|
-
},
|
|
101
|
-
unstable_Provider,
|
|
102
|
-
};
|
|
103
|
-
};
|
|
2
|
+
export { useCloudThreadListAdapter } from "@assistant-ui/core/react";
|
|
104
3
|
//# sourceMappingURL=cloud.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cloud.js","sourceRoot":"","sources":["../../../../../src/legacy-runtime/runtime-cores/remote-thread-list/adapter/cloud.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC
|
|
1
|
+
{"version":3,"file":"cloud.js","sourceRoot":"","sources":["../../../../../src/legacy-runtime/runtime-cores/remote-thread-list/adapter/cloud.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC"}
|
package/dist/legacy-runtime/runtime-cores/remote-thread-list/useRemoteThreadListRuntime.d.ts
CHANGED
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import type { AssistantRuntime } from "@assistant-ui/core";
|
|
3
|
-
export declare const useRemoteThreadListRuntime: (options: RemoteThreadListOptions) => AssistantRuntime;
|
|
1
|
+
export { useRemoteThreadListRuntime } from "@assistant-ui/core/react";
|
|
4
2
|
//# sourceMappingURL=useRemoteThreadListRuntime.d.ts.map
|
package/dist/legacy-runtime/runtime-cores/remote-thread-list/useRemoteThreadListRuntime.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useRemoteThreadListRuntime.d.ts","sourceRoot":"","sources":["../../../../src/legacy-runtime/runtime-cores/remote-thread-list/useRemoteThreadListRuntime.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useRemoteThreadListRuntime.d.ts","sourceRoot":"","sources":["../../../../src/legacy-runtime/runtime-cores/remote-thread-list/useRemoteThreadListRuntime.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC"}
|
|
@@ -1,48 +1,3 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
|
|
3
|
-
import { BaseAssistantRuntimeCore, AssistantRuntimeImpl, } from "@assistant-ui/core/internal";
|
|
4
|
-
import { RemoteThreadListThreadListRuntimeCore } from "./RemoteThreadListThreadListRuntimeCore.js";
|
|
5
|
-
import { useAui } from "@assistant-ui/store";
|
|
6
|
-
class RemoteThreadListRuntimeCore extends BaseAssistantRuntimeCore {
|
|
7
|
-
threads;
|
|
8
|
-
constructor(options) {
|
|
9
|
-
super();
|
|
10
|
-
this.threads = new RemoteThreadListThreadListRuntimeCore(options, this._contextProvider);
|
|
11
|
-
}
|
|
12
|
-
get RenderComponent() {
|
|
13
|
-
return this.threads.__internal_RenderComponent;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
const useRemoteThreadListRuntimeImpl = (options) => {
|
|
17
|
-
const [runtime] = useState(() => new RemoteThreadListRuntimeCore(options));
|
|
18
|
-
useEffect(() => {
|
|
19
|
-
runtime.threads.__internal_setOptions(options);
|
|
20
|
-
runtime.threads.__internal_load();
|
|
21
|
-
}, [runtime, options]);
|
|
22
|
-
return useMemo(() => new AssistantRuntimeImpl(runtime), [runtime]);
|
|
23
|
-
};
|
|
24
|
-
export const useRemoteThreadListRuntime = (options) => {
|
|
25
|
-
const runtimeHookRef = useRef(options.runtimeHook);
|
|
26
|
-
runtimeHookRef.current = options.runtimeHook;
|
|
27
|
-
const stableRuntimeHook = useCallback(() => {
|
|
28
|
-
return runtimeHookRef.current();
|
|
29
|
-
}, []);
|
|
30
|
-
const stableOptions = useMemo(() => ({
|
|
31
|
-
adapter: options.adapter,
|
|
32
|
-
allowNesting: options.allowNesting,
|
|
33
|
-
runtimeHook: stableRuntimeHook,
|
|
34
|
-
}), [options.adapter, options.allowNesting, stableRuntimeHook]);
|
|
35
|
-
const aui = useAui();
|
|
36
|
-
const isNested = aui.threadListItem.source !== null;
|
|
37
|
-
if (isNested) {
|
|
38
|
-
if (!stableOptions.allowNesting) {
|
|
39
|
-
throw new Error("useRemoteThreadListRuntime cannot be nested inside another RemoteThreadListRuntime. " +
|
|
40
|
-
"Set allowNesting: true to allow nesting (the inner runtime will become a no-op).");
|
|
41
|
-
}
|
|
42
|
-
// If allowNesting is true and already inside a thread list context,
|
|
43
|
-
// just call the runtimeHook directly (no-op behavior)
|
|
44
|
-
return stableRuntimeHook();
|
|
45
|
-
}
|
|
46
|
-
return useRemoteThreadListRuntimeImpl(stableOptions);
|
|
47
|
-
};
|
|
2
|
+
export { useRemoteThreadListRuntime } from "@assistant-ui/core/react";
|
|
48
3
|
//# sourceMappingURL=useRemoteThreadListRuntime.js.map
|
package/dist/legacy-runtime/runtime-cores/remote-thread-list/useRemoteThreadListRuntime.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useRemoteThreadListRuntime.js","sourceRoot":"","sources":["../../../../src/legacy-runtime/runtime-cores/remote-thread-list/useRemoteThreadListRuntime.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"useRemoteThreadListRuntime.js","sourceRoot":"","sources":["../../../../src/legacy-runtime/runtime-cores/remote-thread-list/useRemoteThreadListRuntime.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export type ActionBarInteractionContextValue = {
|
|
2
|
+
acquireInteractionLock: () => () => void;
|
|
3
|
+
};
|
|
4
|
+
export declare const ActionBarInteractionContext: import("react").Context<ActionBarInteractionContextValue | null>;
|
|
5
|
+
export declare const useActionBarInteractionContext: () => ActionBarInteractionContextValue | null;
|
|
6
|
+
//# sourceMappingURL=ActionBarInteractionContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ActionBarInteractionContext.d.ts","sourceRoot":"","sources":["../../../src/primitives/actionBar/ActionBarInteractionContext.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,gCAAgC,GAAG;IAC7C,sBAAsB,EAAE,MAAM,MAAM,IAAI,CAAC;CAC1C,CAAC;AAEF,eAAO,MAAM,2BAA2B,kEACsB,CAAC;AAE/D,eAAO,MAAM,8BAA8B,+CACF,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { createContext, useContext } from "react";
|
|
3
|
+
export const ActionBarInteractionContext = createContext(null);
|
|
4
|
+
export const useActionBarInteractionContext = () => useContext(ActionBarInteractionContext);
|
|
5
|
+
//# sourceMappingURL=ActionBarInteractionContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ActionBarInteractionContext.js","sourceRoot":"","sources":["../../../src/primitives/actionBar/ActionBarInteractionContext.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAMlD,MAAM,CAAC,MAAM,2BAA2B,GACtC,aAAa,CAA0C,IAAI,CAAC,CAAC;AAE/D,MAAM,CAAC,MAAM,8BAA8B,GAAG,GAAG,EAAE,CACjD,UAAU,CAAC,2BAA2B,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionBarRoot.d.ts","sourceRoot":"","sources":["../../../src/primitives/actionBar/ActionBarRoot.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,
|
|
1
|
+
{"version":3,"file":"ActionBarRoot.d.ts","sourceRoot":"","sources":["../../../src/primitives/actionBar/ActionBarRoot.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EACL,KAAK,YAAY,EAEjB,wBAAwB,EAIzB,MAAM,OAAO,CAAC;AAOf,KAAK,iBAAiB,GAAG,wBAAwB,CAAC,OAAO,SAAS,CAAC,GAAG,CAAC,CAAC;AAExE,yBAAiB,sBAAsB,CAAC;IACtC,KAAY,OAAO,GAAG,YAAY,CAAC,OAAO,SAAS,CAAC,GAAG,CAAC,CAAC;IACzD,KAAY,KAAK,GAAG,iBAAiB,GAAG;QACtC;;;WAGG;QACH,eAAe,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;QACtC;;;;;;WAMG;QACH,QAAQ,CAAC,EAAE,QAAQ,GAAG,UAAU,GAAG,OAAO,GAAG,SAAS,CAAC;QACvD;;;;;;WAMG;QACH,aAAa,CAAC,EAAE,QAAQ,GAAG,eAAe,GAAG,OAAO,GAAG,SAAS,CAAC;KAClE,CAAC;CACH;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,sBAAsB;;;IA5C/B;;;OAGG;sBACe,OAAO,GAAG,SAAS;IACrC;;;;;;OAMG;eACQ,QAAQ,GAAG,UAAU,GAAG,OAAO,GAAG,SAAS;IACtD;;;;;;OAMG;oBACa,QAAQ,GAAG,eAAe,GAAG,OAAO,GAAG,SAAS;kDAmElE,CAAC"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import { Primitive } from "@radix-ui/react-primitive";
|
|
4
|
-
import { forwardRef } from "react";
|
|
4
|
+
import { forwardRef, useCallback, useMemo, useState, } from "react";
|
|
5
5
|
import { useActionBarFloatStatus, HideAndFloatStatus, } from "./useActionBarFloatStatus.js";
|
|
6
|
+
import { ActionBarInteractionContext } from "./ActionBarInteractionContext.js";
|
|
6
7
|
/**
|
|
7
8
|
* The root container for action bar components.
|
|
8
9
|
*
|
|
@@ -24,16 +25,29 @@ import { useActionBarFloatStatus, HideAndFloatStatus, } from "./useActionBarFloa
|
|
|
24
25
|
* ```
|
|
25
26
|
*/
|
|
26
27
|
export const ActionBarPrimitiveRoot = forwardRef(({ hideWhenRunning, autohide, autohideFloat, ...rest }, ref) => {
|
|
28
|
+
const [interactionCount, setInteractionCount] = useState(0);
|
|
29
|
+
const acquireInteractionLock = useCallback(() => {
|
|
30
|
+
let released = false;
|
|
31
|
+
setInteractionCount((count) => count + 1);
|
|
32
|
+
return () => {
|
|
33
|
+
if (released)
|
|
34
|
+
return;
|
|
35
|
+
released = true;
|
|
36
|
+
setInteractionCount((count) => Math.max(0, count - 1));
|
|
37
|
+
};
|
|
38
|
+
}, []);
|
|
39
|
+
const interactionContext = useMemo(() => ({ acquireInteractionLock }), [acquireInteractionLock]);
|
|
27
40
|
const hideAndfloatStatus = useActionBarFloatStatus({
|
|
28
41
|
hideWhenRunning,
|
|
29
42
|
autohide,
|
|
30
43
|
autohideFloat,
|
|
44
|
+
forceVisible: interactionCount > 0,
|
|
31
45
|
});
|
|
32
46
|
if (hideAndfloatStatus === HideAndFloatStatus.Hidden)
|
|
33
47
|
return null;
|
|
34
|
-
return (_jsx(Primitive.div, { ...(hideAndfloatStatus === HideAndFloatStatus.Floating
|
|
35
|
-
|
|
36
|
-
|
|
48
|
+
return (_jsx(ActionBarInteractionContext.Provider, { value: interactionContext, children: _jsx(Primitive.div, { ...(hideAndfloatStatus === HideAndFloatStatus.Floating
|
|
49
|
+
? { "data-floating": "true" }
|
|
50
|
+
: null), ...rest, ref: ref }) }));
|
|
37
51
|
});
|
|
38
52
|
ActionBarPrimitiveRoot.displayName = "ActionBarPrimitive.Root";
|
|
39
53
|
//# sourceMappingURL=ActionBarRoot.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionBarRoot.js","sourceRoot":"","sources":["../../../src/primitives/actionBar/ActionBarRoot.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,
|
|
1
|
+
{"version":3,"file":"ActionBarRoot.js","sourceRoot":"","sources":["../../../src/primitives/actionBar/ActionBarRoot.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAEL,UAAU,EAEV,WAAW,EACX,OAAO,EACP,QAAQ,GACT,MAAM,OAAO,CAAC;AACf,OAAO,EACL,uBAAuB,EACvB,kBAAkB,GACnB,qCAAkC;AACnC,OAAO,EAAE,2BAA2B,EAAE,yCAAsC;AA+B5E;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,UAAU,CAG9C,CAAC,EAAE,eAAe,EAAE,QAAQ,EAAE,aAAa,EAAE,GAAG,IAAI,EAAE,EAAE,GAAG,EAAE,EAAE;IAC/D,MAAM,CAAC,gBAAgB,EAAE,mBAAmB,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IAE5D,MAAM,sBAAsB,GAAG,WAAW,CAAC,GAAG,EAAE;QAC9C,IAAI,QAAQ,GAAG,KAAK,CAAC;QAErB,mBAAmB,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;QAE1C,OAAO,GAAG,EAAE;YACV,IAAI,QAAQ;gBAAE,OAAO;YACrB,QAAQ,GAAG,IAAI,CAAC;YAChB,mBAAmB,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC;QACzD,CAAC,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,kBAAkB,GAAG,OAAO,CAChC,GAAG,EAAE,CAAC,CAAC,EAAE,sBAAsB,EAAE,CAAC,EAClC,CAAC,sBAAsB,CAAC,CACzB,CAAC;IAEF,MAAM,kBAAkB,GAAG,uBAAuB,CAAC;QACjD,eAAe;QACf,QAAQ;QACR,aAAa;QACb,YAAY,EAAE,gBAAgB,GAAG,CAAC;KACnC,CAAC,CAAC;IAEH,IAAI,kBAAkB,KAAK,kBAAkB,CAAC,MAAM;QAAE,OAAO,IAAI,CAAC;IAElE,OAAO,CACL,KAAC,2BAA2B,CAAC,QAAQ,IAAC,KAAK,EAAE,kBAAkB,YAC7D,KAAC,SAAS,CAAC,GAAG,OACR,CAAC,kBAAkB,KAAK,kBAAkB,CAAC,QAAQ;gBACrD,CAAC,CAAC,EAAE,eAAe,EAAE,MAAM,EAAE;gBAC7B,CAAC,CAAC,IAAI,CAAC,KACL,IAAI,EACR,GAAG,EAAE,GAAG,GACR,GACmC,CACxC,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,sBAAsB,CAAC,WAAW,GAAG,yBAAyB,CAAC"}
|
|
@@ -7,6 +7,7 @@ export type UseActionBarFloatStatusProps = {
|
|
|
7
7
|
hideWhenRunning?: boolean | undefined;
|
|
8
8
|
autohide?: "always" | "not-last" | "never" | undefined;
|
|
9
9
|
autohideFloat?: "always" | "single-branch" | "never" | undefined;
|
|
10
|
+
forceVisible?: boolean | undefined;
|
|
10
11
|
};
|
|
11
|
-
export declare const useActionBarFloatStatus: ({ hideWhenRunning, autohide, autohideFloat, }: UseActionBarFloatStatusProps) => HideAndFloatStatus;
|
|
12
|
+
export declare const useActionBarFloatStatus: ({ hideWhenRunning, autohide, autohideFloat, forceVisible, }: UseActionBarFloatStatusProps) => HideAndFloatStatus;
|
|
12
13
|
//# sourceMappingURL=useActionBarFloatStatus.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useActionBarFloatStatus.d.ts","sourceRoot":"","sources":["../../../src/primitives/actionBar/useActionBarFloatStatus.ts"],"names":[],"mappings":"AAIA,oBAAY,kBAAkB;IAC5B,MAAM,WAAW;IACjB,QAAQ,aAAa;IACrB,MAAM,WAAW;CAClB;AAED,MAAM,MAAM,4BAA4B,GAAG;IACzC,eAAe,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IACtC,QAAQ,CAAC,EAAE,QAAQ,GAAG,UAAU,GAAG,OAAO,GAAG,SAAS,CAAC;IACvD,aAAa,CAAC,EAAE,QAAQ,GAAG,eAAe,GAAG,OAAO,GAAG,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"useActionBarFloatStatus.d.ts","sourceRoot":"","sources":["../../../src/primitives/actionBar/useActionBarFloatStatus.ts"],"names":[],"mappings":"AAIA,oBAAY,kBAAkB;IAC5B,MAAM,WAAW;IACjB,QAAQ,aAAa;IACrB,MAAM,WAAW;CAClB;AAED,MAAM,MAAM,4BAA4B,GAAG;IACzC,eAAe,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IACtC,QAAQ,CAAC,EAAE,QAAQ,GAAG,UAAU,GAAG,OAAO,GAAG,SAAS,CAAC;IACvD,aAAa,CAAC,EAAE,QAAQ,GAAG,eAAe,GAAG,OAAO,GAAG,SAAS,CAAC;IACjE,YAAY,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CACpC,CAAC;AAEF,eAAO,MAAM,uBAAuB,GAAI,6DAKrC,4BAA4B,uBAuB9B,CAAC"}
|
|
@@ -6,16 +6,17 @@ export var HideAndFloatStatus;
|
|
|
6
6
|
HideAndFloatStatus["Floating"] = "floating";
|
|
7
7
|
HideAndFloatStatus["Normal"] = "normal";
|
|
8
8
|
})(HideAndFloatStatus || (HideAndFloatStatus = {}));
|
|
9
|
-
export const useActionBarFloatStatus = ({ hideWhenRunning, autohide, autohideFloat, }) => {
|
|
9
|
+
export const useActionBarFloatStatus = ({ hideWhenRunning, autohide, autohideFloat, forceVisible, }) => {
|
|
10
10
|
return useAuiState((s) => {
|
|
11
11
|
if (hideWhenRunning && s.thread.isRunning)
|
|
12
12
|
return HideAndFloatStatus.Hidden;
|
|
13
13
|
const autohideEnabled = autohide === "always" || (autohide === "not-last" && !s.message.isLast);
|
|
14
|
+
const isVisibleByInteraction = forceVisible || s.message.isHovering;
|
|
14
15
|
// normal status
|
|
15
16
|
if (!autohideEnabled)
|
|
16
17
|
return HideAndFloatStatus.Normal;
|
|
17
18
|
// hidden status
|
|
18
|
-
if (!
|
|
19
|
+
if (!isVisibleByInteraction)
|
|
19
20
|
return HideAndFloatStatus.Hidden;
|
|
20
21
|
// floating status
|
|
21
22
|
if (autohideFloat === "always" ||
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useActionBarFloatStatus.js","sourceRoot":"","sources":["../../../src/primitives/actionBar/useActionBarFloatStatus.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAElD,MAAM,CAAN,IAAY,kBAIX;AAJD,WAAY,kBAAkB;IAC5B,uCAAiB,CAAA;IACjB,2CAAqB,CAAA;IACrB,uCAAiB,CAAA;AACnB,CAAC,EAJW,kBAAkB,KAAlB,kBAAkB,QAI7B;
|
|
1
|
+
{"version":3,"file":"useActionBarFloatStatus.js","sourceRoot":"","sources":["../../../src/primitives/actionBar/useActionBarFloatStatus.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAElD,MAAM,CAAN,IAAY,kBAIX;AAJD,WAAY,kBAAkB;IAC5B,uCAAiB,CAAA;IACjB,2CAAqB,CAAA;IACrB,uCAAiB,CAAA;AACnB,CAAC,EAJW,kBAAkB,KAAlB,kBAAkB,QAI7B;AASD,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,EACtC,eAAe,EACf,QAAQ,EACR,aAAa,EACb,YAAY,GACiB,EAAE,EAAE;IACjC,OAAO,WAAW,CAAC,CAAC,CAAC,EAAE,EAAE;QACvB,IAAI,eAAe,IAAI,CAAC,CAAC,MAAM,CAAC,SAAS;YAAE,OAAO,kBAAkB,CAAC,MAAM,CAAC;QAE5E,MAAM,eAAe,GACnB,QAAQ,KAAK,QAAQ,IAAI,CAAC,QAAQ,KAAK,UAAU,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAC1E,MAAM,sBAAsB,GAAG,YAAY,IAAI,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC;QAEpE,gBAAgB;QAChB,IAAI,CAAC,eAAe;YAAE,OAAO,kBAAkB,CAAC,MAAM,CAAC;QAEvD,gBAAgB;QAChB,IAAI,CAAC,sBAAsB;YAAE,OAAO,kBAAkB,CAAC,MAAM,CAAC;QAE9D,kBAAkB;QAClB,IACE,aAAa,KAAK,QAAQ;YAC1B,CAAC,aAAa,KAAK,eAAe,IAAI,CAAC,CAAC,OAAO,CAAC,WAAW,IAAI,CAAC,CAAC;YAEjE,OAAO,kBAAkB,CAAC,QAAQ,CAAC;QAErC,OAAO,kBAAkB,CAAC,MAAM,CAAC;IACnC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionBarMoreRoot.d.ts","sourceRoot":"","sources":["../../../src/primitives/actionBarMore/ActionBarMoreRoot.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"ActionBarMoreRoot.d.ts","sourceRoot":"","sources":["../../../src/primitives/actionBarMore/ActionBarMoreRoot.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,EAAE,EAAkC,MAAM,OAAO,CAAC;AAC3D,OAAO,EAAE,YAAY,IAAI,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAIjE,yBAAiB,0BAA0B,CAAC;IAC1C,KAAY,KAAK,GAAG,qBAAqB,CAAC,iBAAiB,CAAC;CAC7D;AAED,eAAO,MAAM,0BAA0B,EAAE,EAAE,CACzC,0BAA0B,CAAC,KAAK,CAyDjC,CAAC"}
|
|
@@ -1,10 +1,43 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useCallback, useEffect, useRef } from "react";
|
|
3
4
|
import { DropdownMenu as DropdownMenuPrimitive } from "radix-ui";
|
|
4
5
|
import { useDropdownMenuScope } from "./scope.js";
|
|
5
|
-
|
|
6
|
+
import { useActionBarInteractionContext } from "../actionBar/ActionBarInteractionContext.js";
|
|
7
|
+
export const ActionBarMorePrimitiveRoot = ({ __scopeActionBarMore, open, onOpenChange, ...rest }) => {
|
|
6
8
|
const scope = useDropdownMenuScope(__scopeActionBarMore);
|
|
7
|
-
|
|
9
|
+
const actionBarInteraction = useActionBarInteractionContext();
|
|
10
|
+
const releaseInteractionLockRef = useRef(null);
|
|
11
|
+
const isControlled = open !== undefined;
|
|
12
|
+
const setInteractionOpen = useCallback((nextOpen) => {
|
|
13
|
+
if (nextOpen) {
|
|
14
|
+
if (releaseInteractionLockRef.current)
|
|
15
|
+
return;
|
|
16
|
+
releaseInteractionLockRef.current =
|
|
17
|
+
actionBarInteraction?.acquireInteractionLock() ?? null;
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
releaseInteractionLockRef.current?.();
|
|
21
|
+
releaseInteractionLockRef.current = null;
|
|
22
|
+
}, [actionBarInteraction]);
|
|
23
|
+
const handleOpenChange = useCallback((nextOpen) => {
|
|
24
|
+
if (!isControlled) {
|
|
25
|
+
setInteractionOpen(nextOpen);
|
|
26
|
+
}
|
|
27
|
+
onOpenChange?.(nextOpen);
|
|
28
|
+
}, [isControlled, setInteractionOpen, onOpenChange]);
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
if (!isControlled)
|
|
31
|
+
return;
|
|
32
|
+
setInteractionOpen(Boolean(open));
|
|
33
|
+
}, [isControlled, open, setInteractionOpen]);
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
return () => {
|
|
36
|
+
releaseInteractionLockRef.current?.();
|
|
37
|
+
releaseInteractionLockRef.current = null;
|
|
38
|
+
};
|
|
39
|
+
}, []);
|
|
40
|
+
return (_jsx(DropdownMenuPrimitive.Root, { ...scope, ...rest, ...(open !== undefined ? { open } : null), onOpenChange: handleOpenChange }));
|
|
8
41
|
};
|
|
9
42
|
ActionBarMorePrimitiveRoot.displayName = "ActionBarMorePrimitive.Root";
|
|
10
43
|
//# sourceMappingURL=ActionBarMoreRoot.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionBarMoreRoot.js","sourceRoot":"","sources":["../../../src/primitives/actionBarMore/ActionBarMoreRoot.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;
|
|
1
|
+
{"version":3,"file":"ActionBarMoreRoot.js","sourceRoot":"","sources":["../../../src/primitives/actionBarMore/ActionBarMoreRoot.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAM,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC3D,OAAO,EAAE,YAAY,IAAI,qBAAqB,EAAE,MAAM,UAAU,CAAC;AACjE,OAAO,EAAe,oBAAoB,EAAE,mBAAgB;AAC5D,OAAO,EAAE,8BAA8B,EAAE,oDAAiD;AAM1F,MAAM,CAAC,MAAM,0BAA0B,GAEnC,CAAC,EACH,oBAAoB,EACpB,IAAI,EACJ,YAAY,EACZ,GAAG,IAAI,EACuC,EAAE,EAAE;IAClD,MAAM,KAAK,GAAG,oBAAoB,CAAC,oBAAoB,CAAC,CAAC;IACzD,MAAM,oBAAoB,GAAG,8BAA8B,EAAE,CAAC;IAC9D,MAAM,yBAAyB,GAAG,MAAM,CAAsB,IAAI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AI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,EAC1C,YAAY,EAAE,gBAAgB,GAC9B,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,0BAA0B,CAAC,WAAW,GAAG,6BAA6B,CAAC"}
|
|
@@ -15,7 +15,7 @@ export const createActionButton = (displayName, useActionButton, forwardProps =
|
|
|
15
15
|
}
|
|
16
16
|
});
|
|
17
17
|
const callback = useActionButton(forwardedProps) ?? undefined;
|
|
18
|
-
return (_jsx(Primitive.button, { type: "button",
|
|
18
|
+
return (_jsx(Primitive.button, { ...primitiveProps, type: "button", ref: forwardedRef, disabled: primitiveProps.disabled || !callback, onClick: composeEventHandlers(primitiveProps.onClick, callback) }));
|
|
19
19
|
});
|
|
20
20
|
ActionButton.displayName = displayName;
|
|
21
21
|
return ActionButton;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createActionButton.js","sourceRoot":"","sources":["../../src/utils/createActionButton.tsx"],"names":[],"mappings":";AAAA,OAAO,EAEL,UAAU,GAGX,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAa3D,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAChC,WAAmB,EACnB,eAA6C,EAC7C,eAA8C,EAAE,EAChD,EAAE;IACF,MAAM,YAAY,GAAG,UAAU,CAG7B,CAAC,KAAK,EAAE,YAAY,EAAE,EAAE;QACxB,MAAM,cAAc,GAAG,EAAY,CAAC;QACpC,MAAM,cAAc,GAAG,EAA0B,CAAC;QAEjD,MAAM,CAAC,IAAI,CAAC,KAAK,CAA+B,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;YAChE,IAAI,YAAY,CAAC,QAAQ,CAAC,GAAmB,CAAC,EAAE,CAAC;gBAC9C,cAAsB,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC;YAC5C,CA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,QAAQ,EAAE,cAAc,CAAC,QAAQ,IAAI,CAAC,QAAQ,EAC9C,OAAO,EAAE,oBAAoB,CAAC,cAAc,CAAC,OAAO,EAAE,QAAQ,CAAC,GAC/D,CACH,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,YAAY,CAAC,WAAW,GAAG,WAAW,CAAC;IAEvC,OAAO,YAAY,CAAC;AACtB,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-json-equal.d.ts","sourceRoot":"","sources":["../../../src/utils/json/is-json-equal.ts"],"names":[],"mappings":"AA4CA,eAAO,MAAM,gBAAgB,GAAI,GAAG,OAAO,EAAE,GAAG,OAAO,KAAG,OAGzD,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { isJSONValue, isRecord } from "./is-json.js";
|
|
2
|
+
const MAX_JSON_DEPTH = 100;
|
|
3
|
+
const isJSONValueEqualAtDepth = (a, b, currentDepth) => {
|
|
4
|
+
if (a === b)
|
|
5
|
+
return true;
|
|
6
|
+
if (currentDepth > MAX_JSON_DEPTH)
|
|
7
|
+
return false;
|
|
8
|
+
if (a == null || b == null)
|
|
9
|
+
return false;
|
|
10
|
+
if (Array.isArray(a)) {
|
|
11
|
+
if (!Array.isArray(b) || a.length !== b.length)
|
|
12
|
+
return false;
|
|
13
|
+
return a.every((item, index) => isJSONValueEqualAtDepth(item, b[index], currentDepth + 1));
|
|
14
|
+
}
|
|
15
|
+
if (Array.isArray(b))
|
|
16
|
+
return false;
|
|
17
|
+
if (!isRecord(a) || !isRecord(b))
|
|
18
|
+
return false;
|
|
19
|
+
const aKeys = Object.keys(a);
|
|
20
|
+
const bKeys = Object.keys(b);
|
|
21
|
+
if (aKeys.length !== bKeys.length)
|
|
22
|
+
return false;
|
|
23
|
+
return aKeys.every((key) => Object.hasOwn(b, key) &&
|
|
24
|
+
isJSONValueEqualAtDepth(a[key], b[key], currentDepth + 1));
|
|
25
|
+
};
|
|
26
|
+
export const isJSONValueEqual = (a, b) => {
|
|
27
|
+
if (!isJSONValue(a) || !isJSONValue(b))
|
|
28
|
+
return false;
|
|
29
|
+
return isJSONValueEqualAtDepth(a, b, 0);
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=is-json-equal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-json-equal.js","sourceRoot":"","sources":["../../../src/utils/json/is-json-equal.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,qBAAkB;AAElD,MAAM,cAAc,GAAG,GAAG,CAAC;AAE3B,MAAM,uBAAuB,GAAG,CAC9B,CAAoB,EACpB,CAAoB,EACpB,YAAoB,EACX,EAAE;IACX,IAAI,CAAC,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IACzB,IAAI,YAAY,GAAG,cAAc;QAAE,OAAO,KAAK,CAAC;IAEhD,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,IAAI;QAAE,OAAO,KAAK,CAAC;IAEzC,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;QACrB,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM;YAAE,OAAO,KAAK,CAAC;QAC7D,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAC7B,uBAAuB,CACrB,IAAI,EACJ,CAAC,CAAC,KAAK,CAAsB,EAC7B,YAAY,GAAG,CAAC,CACjB,CACF,CAAC;IACJ,CAAC;IAED,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;QAAE,OAAO,KAAK,CAAC;IACnC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;QAAE,OAAO,KAAK,CAAC;IAE/C,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAC7B,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAC7B,IAAI,KAAK,CAAC,MAAM,KAAK,KAAK,CAAC,MAAM;QAAE,OAAO,KAAK,CAAC;IAEhD,OAAO,KAAK,CAAC,KAAK,CAChB,CAAC,GAAG,EAAE,EAAE,CACN,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,GAAG,CAAC;QACrB,uBAAuB,CACrB,CAAC,CAAC,GAAG,CAAsB,EAC3B,CAAC,CAAC,GAAG,CAAsB,EAC3B,YAAY,GAAG,CAAC,CACjB,CACJ,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAU,EAAE,CAAU,EAAW,EAAE;IAClE,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC;QAAE,OAAO,KAAK,CAAC;IACrD,OAAO,uBAAuB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AAC1C,CAAC,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ReadonlyJSONArray, ReadonlyJSONObject, ReadonlyJSONValue } from "assistant-stream/utils";
|
|
2
|
+
export declare function isRecord(value: unknown): value is Record<string, unknown>;
|
|
2
3
|
export declare function isJSONValue(value: unknown, currentDepth?: number): value is ReadonlyJSONValue;
|
|
3
4
|
export declare function isJSONArray(value: unknown): value is ReadonlyJSONArray;
|
|
4
5
|
export declare function isJSONObject(value: unknown): value is ReadonlyJSONObject;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"is-json.d.ts","sourceRoot":"","sources":["../../../src/utils/json/is-json.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EAClB,MAAM,wBAAwB,CAAC;AAEhC,wBAAgB,WAAW,CACzB,KAAK,EAAE,OAAO,EACd,YAAY,GAAE,MAAU,GACvB,KAAK,IAAI,iBAAiB,CA+B5B;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,iBAAiB,CAEtE;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,kBAAkB,
|
|
1
|
+
{"version":3,"file":"is-json.d.ts","sourceRoot":"","sources":["../../../src/utils/json/is-json.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EAClB,MAAM,wBAAwB,CAAC;AAEhC,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAEzE;AAED,wBAAgB,WAAW,CACzB,KAAK,EAAE,OAAO,EACd,YAAY,GAAE,MAAU,GACvB,KAAK,IAAI,iBAAiB,CA+B5B;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,iBAAiB,CAEtE;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,kBAAkB,CAOxE"}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
export function isRecord(value) {
|
|
2
|
+
return value != null && typeof value === "object" && !Array.isArray(value);
|
|
3
|
+
}
|
|
1
4
|
export function isJSONValue(value, currentDepth = 0) {
|
|
2
5
|
// Protect against too deep recursion
|
|
3
6
|
if (currentDepth > 100) {
|
|
@@ -15,7 +18,7 @@ export function isJSONValue(value, currentDepth = 0) {
|
|
|
15
18
|
if (Array.isArray(value)) {
|
|
16
19
|
return value.every((item) => isJSONValue(item, currentDepth + 1));
|
|
17
20
|
}
|
|
18
|
-
if (
|
|
21
|
+
if (isRecord(value)) {
|
|
19
22
|
return Object.entries(value).every(([key, val]) => typeof key === "string" && isJSONValue(val, currentDepth + 1));
|
|
20
23
|
}
|
|
21
24
|
return false;
|
|
@@ -24,8 +27,7 @@ export function isJSONArray(value) {
|
|
|
24
27
|
return Array.isArray(value) && value.every(isJSONValue);
|
|
25
28
|
}
|
|
26
29
|
export function isJSONObject(value) {
|
|
27
|
-
return (value
|
|
28
|
-
typeof value === "object" &&
|
|
30
|
+
return (isRecord(value) &&
|
|
29
31
|
Object.entries(value).every(([key, val]) => typeof key === "string" && isJSONValue(val)));
|
|
30
32
|
}
|
|
31
33
|
//# sourceMappingURL=is-json.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"is-json.js","sourceRoot":"","sources":["../../../src/utils/json/is-json.ts"],"names":[],"mappings":"AAMA,MAAM,UAAU,WAAW,CACzB,KAAc,EACd,eAAuB,CAAC;IAExB,qCAAqC;IACrC,IAAI,YAAY,GAAG,GAAG,EAAE,CAAC;QACvB,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IACE,KAAK,KAAK,IAAI;QACd,OAAO,KAAK,KAAK,QAAQ;QACzB,OAAO,KAAK,KAAK,SAAS,EAC1B,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,8BAA8B;IAC9B,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACxD,CAAC;IAED,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,WAAW,CAAC,IAAI,EAAE,YAAY,GAAG,CAAC,CAAC,CAAC,CAAC;IACpE,CAAC;IAED,IAAI,
|
|
1
|
+
{"version":3,"file":"is-json.js","sourceRoot":"","sources":["../../../src/utils/json/is-json.ts"],"names":[],"mappings":"AAMA,MAAM,UAAU,QAAQ,CAAC,KAAc;IACrC,OAAO,KAAK,IAAI,IAAI,IAAI,OAAO,KAAK,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,CACL,QAAQ,CAAC,KAAK,CAAC;QACf,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,KAAK,CACzB,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,EAAE,CAAC,OAAO,GAAG,KAAK,QAAQ,IAAI,WAAW,CAAC,GAAG,CAAC,CAC5D,CACF,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@assistant-ui/react",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.16",
|
|
4
4
|
"description": "TypeScript/React library for AI Chat",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"radix-ui",
|
|
@@ -49,19 +49,19 @@
|
|
|
49
49
|
],
|
|
50
50
|
"sideEffects": false,
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"assistant-
|
|
53
|
-
"@assistant-ui/
|
|
54
|
-
"@assistant-ui/tap": "^0.5.
|
|
55
|
-
"@assistant-ui/store": "^0.2.1",
|
|
52
|
+
"@assistant-ui/core": "^0.1.3",
|
|
53
|
+
"@assistant-ui/store": "^0.2.2",
|
|
54
|
+
"@assistant-ui/tap": "^0.5.2",
|
|
56
55
|
"@radix-ui/primitive": "^1.1.3",
|
|
57
56
|
"@radix-ui/react-compose-refs": "^1.1.2",
|
|
58
57
|
"@radix-ui/react-context": "^1.1.3",
|
|
59
58
|
"@radix-ui/react-primitive": "^2.1.4",
|
|
60
59
|
"@radix-ui/react-use-callback-ref": "^1.1.1",
|
|
61
60
|
"@radix-ui/react-use-escape-keydown": "^1.1.1",
|
|
62
|
-
"
|
|
61
|
+
"assistant-cloud": "^0.1.21",
|
|
63
62
|
"assistant-stream": "^0.3.4",
|
|
64
63
|
"nanoid": "^5.1.6",
|
|
64
|
+
"radix-ui": "^1.4.3",
|
|
65
65
|
"react-textarea-autosize": "^8.5.9",
|
|
66
66
|
"zod": "^4.3.6",
|
|
67
67
|
"zustand": "^5.0.11"
|
|
@@ -83,14 +83,14 @@
|
|
|
83
83
|
"devDependencies": {
|
|
84
84
|
"@testing-library/react": "^16.3.2",
|
|
85
85
|
"@types/json-schema": "^7.0.15",
|
|
86
|
-
"@types/node": "^25.3.
|
|
86
|
+
"@types/node": "^25.3.3",
|
|
87
87
|
"@types/react": "^19.2.14",
|
|
88
88
|
"@types/react-dom": "^19.2.3",
|
|
89
89
|
"jsdom": "^28.1.0",
|
|
90
90
|
"react": "^19.2.4",
|
|
91
91
|
"react-dom": "^19.2.4",
|
|
92
92
|
"vitest": "^4.0.18",
|
|
93
|
-
"@assistant-ui/x-buildutils": "0.0.
|
|
93
|
+
"@assistant-ui/x-buildutils": "0.0.2"
|
|
94
94
|
},
|
|
95
95
|
"publishConfig": {
|
|
96
96
|
"access": "public",
|
package/src/index.ts
CHANGED
package/src/internal.ts
CHANGED
|
@@ -26,6 +26,6 @@ export { splitLocalRuntimeOptions } from "./legacy-runtime/runtime-cores/local/L
|
|
|
26
26
|
export {
|
|
27
27
|
useToolInvocations,
|
|
28
28
|
type ToolExecutionStatus,
|
|
29
|
-
} from "
|
|
29
|
+
} from "@assistant-ui/core/react";
|
|
30
30
|
|
|
31
31
|
export * from "./utils/smooth";
|