@locusgraph/loop 0.2.1 → 0.3.1
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/agent/pulse/gradient-label.js +64 -12
- package/dist/agent/pulse/marks/bars-mark.js +39 -15
- package/dist/agent/pulse/marks/glyph-mark.js +56 -15
- package/dist/agent/pulse/marks/locus-mark.js +38 -12
- package/dist/agent/pulse/marks/orb-mark.js +21 -9
- package/dist/agent/pulse/pulse.js +1 -1
- package/dist/agent/pulse/use-loop-animation.js +35 -12
- package/dist/agent/thinking/thinking.js +2 -2
- package/dist/agent/tool/tool-status.js +1 -1
- package/dist/approval/inbox/inbox-row.js +303 -76
- package/dist/approval/inbox/inbox.js +192 -39
- package/dist/approval/inbox/virtual-inbox-list.js +104 -26
- package/dist/approval/memory/memory-review.js +172 -36
- package/dist/approval/memory/memory-row.js +187 -50
- package/dist/approval/plan/plan-review.js +225 -73
- package/dist/approval/plan/plan-step-row.js +182 -76
- package/dist/approval/plan/question-choices.js +132 -44
- package/dist/approval/plan/question.js +156 -38
- package/dist/approval/run/run-bar.js +125 -39
- package/dist/approval/shared/use-focus-on-mount.js +23 -5
- package/dist/approval/spend/raise-cap-form.js +223 -48
- package/dist/approval/spend/spend-gate.js +157 -40
- package/dist/approval/spend/spend-meter.js +1 -1
- package/dist/approval/tool/approval.js +196 -35
- package/dist/approval/tool/args/args-editor.js +206 -46
- package/dist/approval/tool/args/args-field.js +240 -55
- package/dist/approval/tool/deny-form.js +125 -36
- package/dist/approval/tool/tool-inputs.js +91 -24
- package/dist/chat/chat/use-stick-to-bottom.js +115 -60
- package/dist/chat/chat/virtual-chat-items.js +129 -34
- package/dist/chat/composer/composer-actions.d.ts +1 -2
- package/dist/chat/composer/composer-actions.js +132 -49
- package/dist/chat/composer/composer-status.d.ts +2 -0
- package/dist/chat/composer/composer-status.js +3 -0
- package/dist/chat/composer/composer.d.ts +1 -1
- package/dist/chat/composer/composer.js +2 -1
- package/dist/chat/composer/use-auto-grow.js +25 -8
- package/dist/chat/files/files.js +293 -66
- package/dist/chat/index.d.ts +1 -1
- package/dist/chat/index.js +1 -1
- package/dist/chat/reply/markdown-components.js +2 -2
- package/dist/cost/context.js +1 -1
- package/dist/cost/cost.js +1 -1
- package/dist/cost/model-picker.js +174 -42
- package/dist/cost/shared/context-breakdown.js +1 -1
- package/dist/memory/cite.js +181 -58
- package/dist/memory/memorized.js +197 -43
- package/dist/memory/recall.js +265 -68
- package/dist/memory/shared/disclosure.d.ts +2 -2
- package/dist/memory/shared/disclosure.js +1 -1
- package/dist/memory/sources.js +232 -52
- package/dist/shared/panel.js +1 -1
- package/dist/shared/virtual/use-list-virtualizer.js +2 -0
- package/dist/thread/actions/branch-switcher.js +97 -21
- package/dist/thread/canvas/canvas.js +1 -1
- package/dist/thread/canvas/version-switcher.js +128 -31
- package/dist/thread/code/code.js +2 -2
- package/dist/thread/code/copy-code-button.js +58 -24
- package/dist/thread/history/history.js +1 -1
- package/dist/thread/history/row/history-row.js +99 -18
- package/dist/thread/history/row/thread-item-menu.js +74 -19
- package/dist/thread/history/row/thread-title-editor.js +74 -29
- package/dist/thread/history/virtual-history-list.js +84 -46
- package/dist/thread/starters/starters.js +89 -27
- package/dist/thread/use-copied.js +40 -10
- package/package.json +3 -3
|
@@ -1,34 +1,68 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { c as _c } from "react/compiler-runtime";
|
|
1
4
|
import { Checkmark as CheckIcon, Copy as CopyIcon } from "@carbon/icons-react";
|
|
2
5
|
import { Button } from "@locusgraph/components";
|
|
3
6
|
import { useCopied, writeToClipboard } from "../use-copied.js";
|
|
4
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
|
-
export function CopyCodeButton({
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
export function CopyCodeButton(t0) {
|
|
9
|
+
const $ = _c(10);
|
|
10
|
+
const {
|
|
11
|
+
code,
|
|
12
|
+
onCopy
|
|
13
|
+
} = t0;
|
|
9
14
|
const {
|
|
10
15
|
copied,
|
|
11
16
|
markCopied
|
|
12
17
|
} = useCopied();
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
18
|
+
let t1;
|
|
19
|
+
if ($[0] !== code || $[1] !== markCopied || $[2] !== onCopy) {
|
|
20
|
+
t1 = async () => {
|
|
21
|
+
if (onCopy) {
|
|
22
|
+
onCopy(code);
|
|
23
|
+
markCopied();
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
if (await writeToClipboard(code)) {
|
|
27
|
+
markCopied();
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
$[0] = code;
|
|
31
|
+
$[1] = markCopied;
|
|
32
|
+
$[2] = onCopy;
|
|
33
|
+
$[3] = t1;
|
|
34
|
+
} else {
|
|
35
|
+
t1 = $[3];
|
|
36
|
+
}
|
|
37
|
+
const copy = t1;
|
|
38
|
+
const t2 = copied ? "Copied" : "Copy code";
|
|
39
|
+
let t3;
|
|
40
|
+
if ($[4] !== copied) {
|
|
41
|
+
t3 = copied ? /*#__PURE__*/_jsx(CheckIcon, {
|
|
31
42
|
className: "text-good"
|
|
32
|
-
}) : /*#__PURE__*/_jsx(CopyIcon, {})
|
|
33
|
-
|
|
43
|
+
}) : /*#__PURE__*/_jsx(CopyIcon, {});
|
|
44
|
+
$[4] = copied;
|
|
45
|
+
$[5] = t3;
|
|
46
|
+
} else {
|
|
47
|
+
t3 = $[5];
|
|
48
|
+
}
|
|
49
|
+
let t4;
|
|
50
|
+
if ($[6] !== copy || $[7] !== t2 || $[8] !== t3) {
|
|
51
|
+
t4 = /*#__PURE__*/_jsx(Button, {
|
|
52
|
+
type: "button",
|
|
53
|
+
variant: "ghost",
|
|
54
|
+
size: "icon-xs",
|
|
55
|
+
"aria-label": t2,
|
|
56
|
+
className: "text-muted-foreground hover:text-foreground",
|
|
57
|
+
onClick: copy,
|
|
58
|
+
children: t3
|
|
59
|
+
});
|
|
60
|
+
$[6] = copy;
|
|
61
|
+
$[7] = t2;
|
|
62
|
+
$[8] = t3;
|
|
63
|
+
$[9] = t4;
|
|
64
|
+
} else {
|
|
65
|
+
t4 = $[9];
|
|
66
|
+
}
|
|
67
|
+
return t4;
|
|
34
68
|
}
|
|
@@ -142,7 +142,7 @@ export function History(t0) {
|
|
|
142
142
|
"aria-labelledby": `thread-group-${group.key}`,
|
|
143
143
|
children: [/*#__PURE__*/_jsx("h3", {
|
|
144
144
|
id: `thread-group-${group.key}`,
|
|
145
|
-
className: "eyebrow px-2 pb-1",
|
|
145
|
+
className: "locus-eyebrow px-2 pb-1",
|
|
146
146
|
suppressHydrationWarning: true,
|
|
147
147
|
children: group.label
|
|
148
148
|
}), /*#__PURE__*/_jsx("ul", {
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { c as _c } from "react/compiler-runtime";
|
|
1
4
|
import { cn } from "@locusgraph/components";
|
|
2
5
|
import { useState } from "react";
|
|
3
6
|
import { formatTimeOfDay } from "../thread-groups.js";
|
|
@@ -5,23 +8,58 @@ import { ThreadItemMenu } from "./thread-item-menu.js";
|
|
|
5
8
|
import { ThreadTitleEditor } from "./thread-title-editor.js";
|
|
6
9
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
10
|
const timeHiddenByMenuClass = "max-sm:hidden sm:group-focus-within:invisible sm:group-hover:invisible sm:group-has-[[data-state=open]]:invisible";
|
|
8
|
-
export function HistoryRow({
|
|
9
|
-
|
|
10
|
-
active
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
11
|
+
export function HistoryRow(t0) {
|
|
12
|
+
const $ = _c(33);
|
|
13
|
+
let active;
|
|
14
|
+
let className;
|
|
15
|
+
let onArchive;
|
|
16
|
+
let onRename;
|
|
17
|
+
let onSelect;
|
|
18
|
+
let props;
|
|
19
|
+
let thread;
|
|
20
|
+
if ($[0] !== t0) {
|
|
21
|
+
({
|
|
22
|
+
thread,
|
|
23
|
+
active,
|
|
24
|
+
onSelect,
|
|
25
|
+
onRename,
|
|
26
|
+
onArchive,
|
|
27
|
+
className,
|
|
28
|
+
...props
|
|
29
|
+
} = t0);
|
|
30
|
+
$[0] = t0;
|
|
31
|
+
$[1] = active;
|
|
32
|
+
$[2] = className;
|
|
33
|
+
$[3] = onArchive;
|
|
34
|
+
$[4] = onRename;
|
|
35
|
+
$[5] = onSelect;
|
|
36
|
+
$[6] = props;
|
|
37
|
+
$[7] = thread;
|
|
38
|
+
} else {
|
|
39
|
+
active = $[1];
|
|
40
|
+
className = $[2];
|
|
41
|
+
onArchive = $[3];
|
|
42
|
+
onRename = $[4];
|
|
43
|
+
onSelect = $[5];
|
|
44
|
+
props = $[6];
|
|
45
|
+
thread = $[7];
|
|
46
|
+
}
|
|
17
47
|
const [editing, setEditing] = useState(false);
|
|
18
48
|
const hasMenu = onRename !== undefined || onArchive !== undefined;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
49
|
+
const t1 = active || undefined;
|
|
50
|
+
const t2 = active ? "bg-accent text-accent-foreground before:absolute before:inset-y-0 before:left-0 before:w-0.5 before:bg-foreground" : "text-foreground/85 hover:bg-accent/40";
|
|
51
|
+
let t3;
|
|
52
|
+
if ($[8] !== className || $[9] !== t2) {
|
|
53
|
+
t3 = cn("group relative flex items-center motion-safe:transition-colors", t2, className);
|
|
54
|
+
$[8] = className;
|
|
55
|
+
$[9] = t2;
|
|
56
|
+
$[10] = t3;
|
|
57
|
+
} else {
|
|
58
|
+
t3 = $[10];
|
|
59
|
+
}
|
|
60
|
+
let t4;
|
|
61
|
+
if ($[11] !== active || $[12] !== editing || $[13] !== hasMenu || $[14] !== onRename || $[15] !== onSelect || $[16] !== thread.id || $[17] !== thread.title || $[18] !== thread.updatedAt) {
|
|
62
|
+
t4 = editing && onRename ? /*#__PURE__*/_jsx("div", {
|
|
25
63
|
className: "flex-1 px-1 py-0.5",
|
|
26
64
|
children: /*#__PURE__*/_jsx(ThreadTitleEditor, {
|
|
27
65
|
title: thread.title,
|
|
@@ -46,13 +84,56 @@ export function HistoryRow({
|
|
|
46
84
|
className: cn("shrink-0 font-mono text-[11px] font-normal text-muted-foreground tabular-nums", hasMenu && timeHiddenByMenuClass),
|
|
47
85
|
children: formatTimeOfDay(thread.updatedAt)
|
|
48
86
|
})]
|
|
49
|
-
})
|
|
87
|
+
});
|
|
88
|
+
$[11] = active;
|
|
89
|
+
$[12] = editing;
|
|
90
|
+
$[13] = hasMenu;
|
|
91
|
+
$[14] = onRename;
|
|
92
|
+
$[15] = onSelect;
|
|
93
|
+
$[16] = thread.id;
|
|
94
|
+
$[17] = thread.title;
|
|
95
|
+
$[18] = thread.updatedAt;
|
|
96
|
+
$[19] = t4;
|
|
97
|
+
} else {
|
|
98
|
+
t4 = $[19];
|
|
99
|
+
}
|
|
100
|
+
let t5;
|
|
101
|
+
if ($[20] !== editing || $[21] !== hasMenu || $[22] !== onArchive || $[23] !== onRename || $[24] !== thread.id || $[25] !== thread.title) {
|
|
102
|
+
t5 = hasMenu && !editing && /*#__PURE__*/_jsx("div", {
|
|
50
103
|
className: "absolute top-1/2 right-1 -translate-y-1/2",
|
|
51
104
|
children: /*#__PURE__*/_jsx(ThreadItemMenu, {
|
|
52
105
|
title: thread.title,
|
|
53
106
|
onRename: onRename ? () => setEditing(true) : undefined,
|
|
54
107
|
onArchive: onArchive ? () => onArchive(thread.id) : undefined
|
|
55
108
|
})
|
|
56
|
-
})
|
|
57
|
-
|
|
109
|
+
});
|
|
110
|
+
$[20] = editing;
|
|
111
|
+
$[21] = hasMenu;
|
|
112
|
+
$[22] = onArchive;
|
|
113
|
+
$[23] = onRename;
|
|
114
|
+
$[24] = thread.id;
|
|
115
|
+
$[25] = thread.title;
|
|
116
|
+
$[26] = t5;
|
|
117
|
+
} else {
|
|
118
|
+
t5 = $[26];
|
|
119
|
+
}
|
|
120
|
+
let t6;
|
|
121
|
+
if ($[27] !== props || $[28] !== t1 || $[29] !== t3 || $[30] !== t4 || $[31] !== t5) {
|
|
122
|
+
t6 = /*#__PURE__*/_jsxs("li", {
|
|
123
|
+
"data-slot": "history-item",
|
|
124
|
+
"data-active": t1,
|
|
125
|
+
className: t3,
|
|
126
|
+
...props,
|
|
127
|
+
children: [t4, t5]
|
|
128
|
+
});
|
|
129
|
+
$[27] = props;
|
|
130
|
+
$[28] = t1;
|
|
131
|
+
$[29] = t3;
|
|
132
|
+
$[30] = t4;
|
|
133
|
+
$[31] = t5;
|
|
134
|
+
$[32] = t6;
|
|
135
|
+
} else {
|
|
136
|
+
t6 = $[32];
|
|
137
|
+
}
|
|
138
|
+
return t6;
|
|
58
139
|
}
|
|
@@ -1,31 +1,86 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { c as _c } from "react/compiler-runtime";
|
|
1
4
|
import { Archive as ArchiveIcon, OverflowMenuHorizontal as EllipsisIcon, Edit as PencilIcon } from "@carbon/icons-react";
|
|
2
5
|
import { Button, DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "@locusgraph/components";
|
|
3
6
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
4
|
-
export function ThreadItemMenu({
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
export function ThreadItemMenu(t0) {
|
|
8
|
+
const $ = _c(13);
|
|
9
|
+
const {
|
|
10
|
+
title,
|
|
11
|
+
onRename,
|
|
12
|
+
onArchive
|
|
13
|
+
} = t0;
|
|
14
|
+
const t1 = `Options for ${title}`;
|
|
15
|
+
let t2;
|
|
16
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
17
|
+
t2 = /*#__PURE__*/_jsx(EllipsisIcon, {});
|
|
18
|
+
$[0] = t2;
|
|
19
|
+
} else {
|
|
20
|
+
t2 = $[0];
|
|
21
|
+
}
|
|
22
|
+
let t3;
|
|
23
|
+
if ($[1] !== t1) {
|
|
24
|
+
t3 = /*#__PURE__*/_jsx(DropdownMenuTrigger, {
|
|
11
25
|
asChild: true,
|
|
12
26
|
children: /*#__PURE__*/_jsx(Button, {
|
|
13
27
|
type: "button",
|
|
14
28
|
variant: "ghost",
|
|
15
29
|
size: "icon-xs",
|
|
16
|
-
"aria-label":
|
|
30
|
+
"aria-label": t1,
|
|
17
31
|
className: "shrink-0 text-muted-foreground sm:opacity-0 sm:group-focus-within:opacity-100 sm:group-hover:opacity-100 sm:data-[state=open]:opacity-100",
|
|
18
|
-
children:
|
|
32
|
+
children: t2
|
|
19
33
|
})
|
|
20
|
-
})
|
|
34
|
+
});
|
|
35
|
+
$[1] = t1;
|
|
36
|
+
$[2] = t3;
|
|
37
|
+
} else {
|
|
38
|
+
t3 = $[2];
|
|
39
|
+
}
|
|
40
|
+
let t4;
|
|
41
|
+
if ($[3] !== onRename) {
|
|
42
|
+
t4 = onRename && /*#__PURE__*/_jsxs(DropdownMenuItem, {
|
|
43
|
+
onSelect: onRename,
|
|
44
|
+
children: [/*#__PURE__*/_jsx(PencilIcon, {}), "Rename"]
|
|
45
|
+
});
|
|
46
|
+
$[3] = onRename;
|
|
47
|
+
$[4] = t4;
|
|
48
|
+
} else {
|
|
49
|
+
t4 = $[4];
|
|
50
|
+
}
|
|
51
|
+
let t5;
|
|
52
|
+
if ($[5] !== onArchive) {
|
|
53
|
+
t5 = onArchive && /*#__PURE__*/_jsxs(DropdownMenuItem, {
|
|
54
|
+
onSelect: onArchive,
|
|
55
|
+
children: [/*#__PURE__*/_jsx(ArchiveIcon, {}), "Archive"]
|
|
56
|
+
});
|
|
57
|
+
$[5] = onArchive;
|
|
58
|
+
$[6] = t5;
|
|
59
|
+
} else {
|
|
60
|
+
t5 = $[6];
|
|
61
|
+
}
|
|
62
|
+
let t6;
|
|
63
|
+
if ($[7] !== t4 || $[8] !== t5) {
|
|
64
|
+
t6 = /*#__PURE__*/_jsxs(DropdownMenuContent, {
|
|
21
65
|
align: "end",
|
|
22
|
-
children: [
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
66
|
+
children: [t4, t5]
|
|
67
|
+
});
|
|
68
|
+
$[7] = t4;
|
|
69
|
+
$[8] = t5;
|
|
70
|
+
$[9] = t6;
|
|
71
|
+
} else {
|
|
72
|
+
t6 = $[9];
|
|
73
|
+
}
|
|
74
|
+
let t7;
|
|
75
|
+
if ($[10] !== t3 || $[11] !== t6) {
|
|
76
|
+
t7 = /*#__PURE__*/_jsxs(DropdownMenu, {
|
|
77
|
+
children: [t3, t6]
|
|
78
|
+
});
|
|
79
|
+
$[10] = t3;
|
|
80
|
+
$[11] = t6;
|
|
81
|
+
$[12] = t7;
|
|
82
|
+
} else {
|
|
83
|
+
t7 = $[12];
|
|
84
|
+
}
|
|
85
|
+
return t7;
|
|
31
86
|
}
|
|
@@ -1,38 +1,83 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { c as _c } from "react/compiler-runtime";
|
|
1
4
|
import { Input } from "@locusgraph/components";
|
|
2
5
|
import { useState } from "react";
|
|
3
6
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
|
-
export function ThreadTitleEditor({
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
export function ThreadTitleEditor(t0) {
|
|
8
|
+
const $ = _c(13);
|
|
9
|
+
const {
|
|
10
|
+
title,
|
|
11
|
+
onCommit,
|
|
12
|
+
onCancel
|
|
13
|
+
} = t0;
|
|
9
14
|
const [draft, setDraft] = useState(title);
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
15
|
+
let t1;
|
|
16
|
+
if ($[0] !== draft || $[1] !== onCancel || $[2] !== onCommit || $[3] !== title) {
|
|
17
|
+
t1 = () => {
|
|
18
|
+
const trimmed = draft.trim();
|
|
19
|
+
if (trimmed && trimmed !== title) {
|
|
20
|
+
onCommit(trimmed);
|
|
21
|
+
} else {
|
|
22
|
+
onCancel();
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
$[0] = draft;
|
|
26
|
+
$[1] = onCancel;
|
|
27
|
+
$[2] = onCommit;
|
|
28
|
+
$[3] = title;
|
|
29
|
+
$[4] = t1;
|
|
30
|
+
} else {
|
|
31
|
+
t1 = $[4];
|
|
32
|
+
}
|
|
33
|
+
const commit = t1;
|
|
34
|
+
let t2;
|
|
35
|
+
if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
|
|
36
|
+
t2 = event => setDraft(event.target.value);
|
|
37
|
+
$[5] = t2;
|
|
38
|
+
} else {
|
|
39
|
+
t2 = $[5];
|
|
40
|
+
}
|
|
41
|
+
let t3;
|
|
42
|
+
if ($[6] !== commit || $[7] !== onCancel) {
|
|
43
|
+
t3 = event_1 => {
|
|
44
|
+
if (event_1.key === "Enter") {
|
|
45
|
+
event_1.preventDefault();
|
|
30
46
|
commit();
|
|
31
47
|
}
|
|
32
|
-
if (
|
|
33
|
-
|
|
48
|
+
if (event_1.key === "Escape") {
|
|
49
|
+
event_1.preventDefault();
|
|
34
50
|
onCancel();
|
|
35
51
|
}
|
|
36
|
-
}
|
|
37
|
-
|
|
52
|
+
};
|
|
53
|
+
$[6] = commit;
|
|
54
|
+
$[7] = onCancel;
|
|
55
|
+
$[8] = t3;
|
|
56
|
+
} else {
|
|
57
|
+
t3 = $[8];
|
|
58
|
+
}
|
|
59
|
+
let t4;
|
|
60
|
+
if ($[9] !== commit || $[10] !== draft || $[11] !== t3) {
|
|
61
|
+
t4 = /*#__PURE__*/_jsx(Input, {
|
|
62
|
+
"data-slot": "thread-title-editor",
|
|
63
|
+
"aria-label": "Chat title",
|
|
64
|
+
autoFocus: true,
|
|
65
|
+
value: draft,
|
|
66
|
+
className: "h-7 text-sm",
|
|
67
|
+
onChange: t2,
|
|
68
|
+
onFocus: _temp,
|
|
69
|
+
onBlur: commit,
|
|
70
|
+
onKeyDown: t3
|
|
71
|
+
});
|
|
72
|
+
$[9] = commit;
|
|
73
|
+
$[10] = draft;
|
|
74
|
+
$[11] = t3;
|
|
75
|
+
$[12] = t4;
|
|
76
|
+
} else {
|
|
77
|
+
t4 = $[12];
|
|
78
|
+
}
|
|
79
|
+
return t4;
|
|
80
|
+
}
|
|
81
|
+
function _temp(event_0) {
|
|
82
|
+
return event_0.target.select();
|
|
38
83
|
}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { c as _c } from "react/compiler-runtime";
|
|
1
4
|
import { cn } from "@locusgraph/components";
|
|
2
5
|
import { useRef } from "react";
|
|
3
6
|
import { rowOffsetStyle, useListVirtualizer, virtualRowClassName } from "../../shared/virtual/use-list-virtualizer.js";
|
|
@@ -7,14 +10,16 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
7
10
|
function scrollAreaViewportOf(element) {
|
|
8
11
|
return element?.closest("[data-slot=scroll-area-viewport]") ?? null;
|
|
9
12
|
}
|
|
10
|
-
export function VirtualHistoryList({
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
export function VirtualHistoryList(t0) {
|
|
14
|
+
const $ = _c(12);
|
|
15
|
+
const {
|
|
16
|
+
groups,
|
|
17
|
+
label,
|
|
18
|
+
activeId,
|
|
19
|
+
onSelect,
|
|
20
|
+
onRename,
|
|
21
|
+
onArchive
|
|
22
|
+
} = t0;
|
|
18
23
|
const listRef = useRef(null);
|
|
19
24
|
const rows = historyListRows(groups);
|
|
20
25
|
const {
|
|
@@ -25,47 +30,80 @@ export function VirtualHistoryList({
|
|
|
25
30
|
count: rows.length,
|
|
26
31
|
getScrollElement: () => scrollAreaViewportOf(listRef.current),
|
|
27
32
|
estimateSize: index => estimatedRowHeight(rows[index], index),
|
|
28
|
-
getItemKey:
|
|
29
|
-
});
|
|
30
|
-
const threadRowProps = thread => ({
|
|
31
|
-
thread,
|
|
32
|
-
active: thread.id === activeId,
|
|
33
|
-
onSelect,
|
|
34
|
-
onRename,
|
|
35
|
-
onArchive
|
|
33
|
+
getItemKey: index_0 => rows[index_0].key
|
|
36
34
|
});
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
35
|
+
let t1;
|
|
36
|
+
if ($[0] !== activeId || $[1] !== onArchive || $[2] !== onRename || $[3] !== onSelect) {
|
|
37
|
+
t1 = thread => ({
|
|
38
|
+
thread,
|
|
39
|
+
active: thread.id === activeId,
|
|
40
|
+
onSelect,
|
|
41
|
+
onRename,
|
|
42
|
+
onArchive
|
|
43
|
+
});
|
|
44
|
+
$[0] = activeId;
|
|
45
|
+
$[1] = onArchive;
|
|
46
|
+
$[2] = onRename;
|
|
47
|
+
$[3] = onSelect;
|
|
48
|
+
$[4] = t1;
|
|
49
|
+
} else {
|
|
50
|
+
t1 = $[4];
|
|
51
|
+
}
|
|
52
|
+
const threadRowProps = t1;
|
|
53
|
+
const t2 = "history-list";
|
|
54
|
+
const t3 = "relative";
|
|
55
|
+
let t4;
|
|
56
|
+
if ($[5] !== totalSize) {
|
|
57
|
+
t4 = {
|
|
43
58
|
height: totalSize
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
className: "eyebrow px-2 pb-1",
|
|
56
|
-
suppressHydrationWarning: true,
|
|
57
|
-
children: row.label
|
|
58
|
-
})
|
|
59
|
-
}, virtualRow.key);
|
|
60
|
-
}
|
|
61
|
-
return /*#__PURE__*/_jsx(HistoryRow, {
|
|
62
|
-
...threadRowProps(row.thread),
|
|
59
|
+
};
|
|
60
|
+
$[5] = totalSize;
|
|
61
|
+
$[6] = t4;
|
|
62
|
+
} else {
|
|
63
|
+
t4 = $[6];
|
|
64
|
+
}
|
|
65
|
+
const t5 = visibleRows.map(virtualRow => {
|
|
66
|
+
const row = rows[virtualRow.index];
|
|
67
|
+
if (row.kind === "group") {
|
|
68
|
+
return /*#__PURE__*/_jsx("li", {
|
|
69
|
+
role: "presentation",
|
|
63
70
|
...itemProps(virtualRow.index),
|
|
64
|
-
"
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
71
|
+
className: cn(virtualRowClassName, virtualRow.index > 0 && "pt-4"),
|
|
72
|
+
style: rowOffsetStyle(virtualRow.start),
|
|
73
|
+
children: /*#__PURE__*/_jsx("h3", {
|
|
74
|
+
id: `thread-group-${row.groupKey}`,
|
|
75
|
+
className: "locus-eyebrow px-2 pb-1",
|
|
76
|
+
suppressHydrationWarning: true,
|
|
77
|
+
children: row.label
|
|
78
|
+
})
|
|
68
79
|
}, virtualRow.key);
|
|
69
|
-
}
|
|
80
|
+
}
|
|
81
|
+
return /*#__PURE__*/_jsx(HistoryRow, {
|
|
82
|
+
...threadRowProps(row.thread),
|
|
83
|
+
...itemProps(virtualRow.index),
|
|
84
|
+
"aria-posinset": row.position,
|
|
85
|
+
"aria-setsize": row.groupSize,
|
|
86
|
+
className: virtualRowClassName,
|
|
87
|
+
style: rowOffsetStyle(virtualRow.start)
|
|
88
|
+
}, virtualRow.key);
|
|
70
89
|
});
|
|
90
|
+
let t6;
|
|
91
|
+
if ($[7] !== label || $[8] !== listRef || $[9] !== t4 || $[10] !== t5) {
|
|
92
|
+
t6 = /*#__PURE__*/_jsx("ul", {
|
|
93
|
+
ref: listRef,
|
|
94
|
+
"data-slot": t2,
|
|
95
|
+
"aria-label": label,
|
|
96
|
+
className: t3,
|
|
97
|
+
style: t4,
|
|
98
|
+
children: t5
|
|
99
|
+
});
|
|
100
|
+
$[7] = label;
|
|
101
|
+
$[8] = listRef;
|
|
102
|
+
$[9] = t4;
|
|
103
|
+
$[10] = t5;
|
|
104
|
+
$[11] = t6;
|
|
105
|
+
} else {
|
|
106
|
+
t6 = $[11];
|
|
107
|
+
}
|
|
108
|
+
return t6;
|
|
71
109
|
}
|