@locusgraph/loop 0.3.0 → 0.4.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/dist/agent/index.d.ts +1 -1
- package/dist/agent/pulse/gradient-label.js +70 -17
- package/dist/agent/pulse/marks/bars-mark.js +39 -15
- package/dist/agent/pulse/marks/glyph-mark.js +57 -16
- package/dist/agent/pulse/marks/locus-mark.js +39 -13
- 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.d.ts +0 -1
- package/dist/agent/pulse/use-loop-animation.js +36 -15
- package/dist/agent/steps/step-icon.js +20 -13
- package/dist/agent/steps/steps.js +39 -37
- package/dist/agent/thinking/thinking.js +65 -62
- package/dist/agent/tool/json-block.js +10 -7
- package/dist/agent/tool/tool-status.d.ts +2 -0
- package/dist/agent/tool/tool-status.js +16 -13
- package/dist/agent/tool/tool.d.ts +8 -1
- package/dist/agent/tool/tool.js +238 -119
- package/dist/approval/inbox/inbox-row.d.ts +3 -3
- package/dist/approval/inbox/inbox-row.js +248 -86
- package/dist/approval/inbox/inbox.d.ts +3 -3
- package/dist/approval/inbox/inbox.js +251 -57
- package/dist/approval/inbox/virtual-inbox-list.d.ts +3 -3
- package/dist/approval/inbox/virtual-inbox-list.js +107 -30
- package/dist/approval/memory/memory-review.js +228 -91
- package/dist/approval/memory/memory-row.js +192 -56
- package/dist/approval/plan/plan-review.js +241 -108
- package/dist/approval/plan/plan-step-row.js +184 -77
- package/dist/approval/plan/plan-steps.d.ts +1 -1
- package/dist/approval/plan/plan-steps.js +2 -2
- package/dist/approval/plan/question-choices.js +139 -48
- package/dist/approval/plan/question.js +189 -67
- package/dist/approval/run/run-bar.js +138 -49
- package/dist/approval/shared/approval-line.d.ts +27 -0
- package/dist/approval/shared/approval-line.js +85 -0
- package/dist/approval/shared/risk-badge.d.ts +3 -5
- package/dist/approval/shared/risk-badge.js +11 -19
- package/dist/approval/shared/time.d.ts +0 -1
- package/dist/approval/shared/time.js +0 -1
- package/dist/approval/shared/use-focus-on-mount.js +23 -5
- package/dist/approval/shared/use-focus-when-settled.d.ts +2 -0
- package/dist/approval/shared/use-focus-when-settled.js +18 -0
- package/dist/approval/spend/raise-cap-form.d.ts +2 -2
- package/dist/approval/spend/raise-cap-form.js +235 -52
- package/dist/approval/spend/spend-gate.js +200 -106
- package/dist/approval/spend/spend-math.d.ts +1 -0
- package/dist/approval/spend/spend-math.js +5 -2
- package/dist/approval/spend/spend-meter.js +5 -5
- package/dist/approval/tool/approval.js +157 -96
- package/dist/approval/tool/args/args-editor.js +232 -81
- package/dist/approval/tool/args/args-field.js +333 -60
- package/dist/approval/tool/deny-form.js +114 -32
- package/dist/approval/tool/tool-inputs.js +93 -33
- package/dist/chat/chat/chat.js +5 -4
- package/dist/chat/chat/use-stick-to-bottom.js +116 -63
- 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 +136 -50
- 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 +6 -4
- package/dist/chat/composer/use-auto-grow.js +29 -8
- package/dist/chat/files/files.js +296 -67
- package/dist/chat/index.d.ts +1 -1
- package/dist/chat/index.js +1 -1
- package/dist/chat/reply/fenced-code.js +1 -1
- package/dist/chat/reply/markdown-components.js +9 -116
- package/dist/chat/reply/reply.js +2 -2
- package/dist/chat/turn/group-parts.d.ts +1 -0
- package/dist/chat/turn/group-parts.js +6 -3
- package/dist/chat/turn/turn.js +13 -4
- package/dist/cost/context.js +3 -3
- package/dist/cost/cost-steps.js +31 -30
- package/dist/cost/cost.js +39 -39
- package/dist/cost/model-picker.js +176 -43
- package/dist/cost/shared/context-breakdown.js +10 -11
- package/dist/cost/shared/model-option-row.js +4 -3
- package/dist/cost/shared/step-cost-row.js +11 -12
- package/dist/cost/shared/usage-totals.d.ts +1 -0
- package/dist/cost/shared/usage-totals.js +19 -1
- package/dist/memory/cite.js +190 -59
- package/dist/memory/memorized.js +231 -62
- package/dist/memory/recall.js +272 -85
- package/dist/memory/shared/host-label.d.ts +1 -1
- package/dist/memory/shared/host-label.js +2 -2
- package/dist/memory/shared/source-mark.js +1 -1
- package/dist/memory/sources.d.ts +2 -1
- package/dist/memory/sources.js +277 -62
- package/dist/shared/decision-summary.js +2 -1
- package/dist/shared/line.d.ts +10 -0
- package/dist/shared/line.js +11 -0
- package/dist/shared/live-status.d.ts +3 -0
- package/dist/shared/live-status.js +11 -0
- package/dist/shared/reduced-motion.d.ts +1 -0
- package/dist/shared/reduced-motion.js +3 -0
- package/dist/shared/virtual/use-list-virtualizer.js +2 -0
- package/dist/thread/actions/action-button.js +1 -1
- package/dist/thread/actions/actions.d.ts +3 -1
- package/dist/thread/actions/actions.js +100 -81
- package/dist/thread/actions/branch-switcher.js +129 -23
- package/dist/thread/canvas/canvas-meta.d.ts +9 -0
- package/dist/thread/canvas/canvas-meta.js +35 -0
- package/dist/thread/canvas/canvas.d.ts +1 -1
- package/dist/thread/canvas/canvas.js +64 -74
- package/dist/thread/canvas/version-switcher.d.ts +1 -0
- package/dist/thread/canvas/version-switcher.js +161 -45
- package/dist/thread/code/code.js +4 -6
- package/dist/thread/code/copy-code-button.d.ts +2 -1
- package/dist/thread/code/copy-code-button.js +91 -26
- package/dist/thread/history/history.d.ts +1 -1
- package/dist/thread/history/history.js +104 -104
- package/dist/thread/history/row/history-row.js +106 -22
- package/dist/thread/history/row/thread-item-menu.js +84 -20
- package/dist/thread/history/row/thread-title-editor.js +74 -29
- package/dist/thread/history/virtual-history-list.js +83 -46
- package/dist/thread/index.d.ts +1 -0
- package/dist/thread/index.js +1 -0
- package/dist/thread/starters/starters.js +91 -28
- package/dist/thread/use-copied.js +40 -10
- package/package.json +6 -6
- package/dist/agent/shared/status-dot.d.ts +0 -1
- package/dist/agent/shared/status-dot.js +0 -1
- package/dist/approval/shared/decision-line.d.ts +0 -1
- package/dist/approval/shared/decision-line.js +0 -1
- package/dist/memory/shared/disclosure.d.ts +0 -6
- package/dist/memory/shared/disclosure.js +0 -6
- package/dist/shared/panel.d.ts +0 -19
- package/dist/shared/panel.js +0 -77
- package/dist/shared/status-dot.d.ts +0 -6
- package/dist/shared/status-dot.js +0 -20
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import { c as _c } from "react/compiler-runtime";
|
|
4
|
-
import { Add as PlusIcon } from "@carbon/icons-react";
|
|
5
4
|
import { Button, cn, ScrollArea } from "@locusgraph/components";
|
|
5
|
+
import { Plus as PlusIcon } from "@phosphor-icons/react/ssr";
|
|
6
|
+
import { useId } from "react";
|
|
6
7
|
import { shouldVirtualize } from "../../shared/virtual/use-list-virtualizer.js";
|
|
7
8
|
import { HistoryRow } from "./row/history-row.js";
|
|
8
9
|
import { groupThreadsByDay } from "./thread-groups.js";
|
|
9
10
|
import { VirtualHistoryList } from "./virtual-history-list.js";
|
|
10
11
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
12
|
export function History(t0) {
|
|
12
|
-
const $ = _c(
|
|
13
|
+
const $ = _c(28);
|
|
13
14
|
let className;
|
|
14
15
|
let now;
|
|
15
16
|
let onArchive;
|
|
@@ -68,112 +69,111 @@ export function History(t0) {
|
|
|
68
69
|
const label = t2 === undefined ? "Conversations" : t2;
|
|
69
70
|
const emptyText = t3 === undefined ? "No conversations yet." : t3;
|
|
70
71
|
const virtualize = t4 === undefined ? true : t4;
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
72
|
+
const groups = groupThreadsByDay(threads, now ?? new Date());
|
|
73
|
+
const groupIdPrefix = useId();
|
|
74
|
+
const t5 = "history";
|
|
75
|
+
let t6;
|
|
76
|
+
if ($[13] !== className) {
|
|
77
|
+
t6 = cn("flex min-h-0 flex-col gap-2", className);
|
|
78
|
+
$[13] = className;
|
|
79
|
+
$[14] = t6;
|
|
80
|
+
} else {
|
|
81
|
+
t6 = $[14];
|
|
82
|
+
}
|
|
83
|
+
let t7;
|
|
84
|
+
if ($[15] !== label) {
|
|
85
|
+
t7 = /*#__PURE__*/_jsx("span", {
|
|
86
|
+
className: "text-sm font-medium text-foreground",
|
|
87
|
+
children: label
|
|
88
|
+
});
|
|
89
|
+
$[15] = label;
|
|
90
|
+
$[16] = t7;
|
|
91
|
+
} else {
|
|
92
|
+
t7 = $[16];
|
|
93
|
+
}
|
|
94
|
+
let t8;
|
|
95
|
+
if ($[17] !== onNew) {
|
|
96
|
+
t8 = onNew && /*#__PURE__*/_jsxs(Button, {
|
|
97
|
+
type: "button",
|
|
98
|
+
variant: "ghost",
|
|
99
|
+
size: "xs",
|
|
100
|
+
onClick: onNew,
|
|
101
|
+
children: [/*#__PURE__*/_jsx(PlusIcon, {
|
|
102
|
+
weight: "bold",
|
|
103
|
+
"aria-hidden": true
|
|
104
|
+
}), "New chat"]
|
|
105
|
+
});
|
|
106
|
+
$[17] = onNew;
|
|
107
|
+
$[18] = t8;
|
|
108
|
+
} else {
|
|
109
|
+
t8 = $[18];
|
|
110
|
+
}
|
|
111
|
+
let t9;
|
|
112
|
+
if ($[19] !== t7 || $[20] !== t8) {
|
|
113
|
+
t9 = /*#__PURE__*/_jsxs("div", {
|
|
114
|
+
className: "flex h-control-sm items-center justify-between gap-2 px-2",
|
|
115
|
+
children: [t7, t8]
|
|
116
|
+
});
|
|
117
|
+
$[19] = t7;
|
|
118
|
+
$[20] = t8;
|
|
119
|
+
$[21] = t9;
|
|
120
|
+
} else {
|
|
121
|
+
t9 = $[21];
|
|
122
|
+
}
|
|
123
|
+
const t10 = threads.length === 0 ? /*#__PURE__*/_jsx("p", {
|
|
124
|
+
className: "px-2 py-6 text-sm text-muted-foreground",
|
|
125
|
+
children: emptyText
|
|
126
|
+
}) : /*#__PURE__*/_jsx(ScrollArea, {
|
|
127
|
+
className: "min-h-0 flex-1",
|
|
128
|
+
children: shouldVirtualize(threads.length, virtualize) ? /*#__PURE__*/_jsx("div", {
|
|
129
|
+
className: "pr-2.5 pb-2",
|
|
130
|
+
children: /*#__PURE__*/_jsx(VirtualHistoryList, {
|
|
131
|
+
groups: groups,
|
|
132
|
+
label: label,
|
|
133
|
+
activeId: activeId,
|
|
134
|
+
onSelect: onSelect,
|
|
135
|
+
onRename: onRename,
|
|
136
|
+
onArchive: onArchive
|
|
137
|
+
})
|
|
138
|
+
}) : /*#__PURE__*/_jsx("div", {
|
|
139
|
+
className: "flex flex-col gap-4 pr-2.5 pb-2",
|
|
140
|
+
children: groups.map(group => /*#__PURE__*/_jsxs("section", {
|
|
141
|
+
"aria-labelledby": `${groupIdPrefix}-${group.key}`,
|
|
142
|
+
children: [/*#__PURE__*/_jsx("h3", {
|
|
143
|
+
id: `${groupIdPrefix}-${group.key}`,
|
|
144
|
+
className: "px-2 pb-1 font-sans text-xs text-faint",
|
|
145
|
+
suppressHydrationWarning: true,
|
|
146
|
+
children: group.label
|
|
147
|
+
}), /*#__PURE__*/_jsx("ul", {
|
|
148
|
+
className: "flex flex-col",
|
|
149
|
+
children: group.threads.map(thread => /*#__PURE__*/_jsx(HistoryRow, {
|
|
150
|
+
thread: thread,
|
|
151
|
+
active: thread.id === activeId,
|
|
135
152
|
onSelect: onSelect,
|
|
136
153
|
onRename: onRename,
|
|
137
154
|
onArchive: onArchive
|
|
138
|
-
})
|
|
139
|
-
})
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
thread: thread,
|
|
152
|
-
active: thread.id === activeId,
|
|
153
|
-
onSelect: onSelect,
|
|
154
|
-
onRename: onRename,
|
|
155
|
-
onArchive: onArchive
|
|
156
|
-
}, thread.id))
|
|
157
|
-
})]
|
|
158
|
-
}, group.key))
|
|
159
|
-
})
|
|
160
|
-
})]
|
|
155
|
+
}, thread.id))
|
|
156
|
+
})]
|
|
157
|
+
}, group.key))
|
|
158
|
+
})
|
|
159
|
+
});
|
|
160
|
+
let t11;
|
|
161
|
+
if ($[22] !== label || $[23] !== props || $[24] !== t10 || $[25] !== t6 || $[26] !== t9) {
|
|
162
|
+
t11 = /*#__PURE__*/_jsxs("nav", {
|
|
163
|
+
"data-slot": t5,
|
|
164
|
+
"aria-label": label,
|
|
165
|
+
className: t6,
|
|
166
|
+
...props,
|
|
167
|
+
children: [t9, t10]
|
|
161
168
|
});
|
|
162
|
-
$[
|
|
163
|
-
$[
|
|
164
|
-
$[
|
|
165
|
-
$[
|
|
166
|
-
$[
|
|
167
|
-
$[
|
|
168
|
-
$[19] = onNew;
|
|
169
|
-
$[20] = onRename;
|
|
170
|
-
$[21] = onSelect;
|
|
171
|
-
$[22] = props;
|
|
172
|
-
$[23] = threads;
|
|
173
|
-
$[24] = virtualize;
|
|
174
|
-
$[25] = t5;
|
|
169
|
+
$[22] = label;
|
|
170
|
+
$[23] = props;
|
|
171
|
+
$[24] = t10;
|
|
172
|
+
$[25] = t6;
|
|
173
|
+
$[26] = t9;
|
|
174
|
+
$[27] = t11;
|
|
175
175
|
} else {
|
|
176
|
-
|
|
176
|
+
t11 = $[27];
|
|
177
177
|
}
|
|
178
|
-
return
|
|
178
|
+
return t11;
|
|
179
179
|
}
|
|
@@ -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-muted text-foreground" : "text-muted-foreground hover:bg-muted/50 hover:text-foreground";
|
|
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,
|
|
@@ -36,23 +74,69 @@ export function HistoryRow({
|
|
|
36
74
|
"aria-current": active ? "page" : undefined,
|
|
37
75
|
onClick: () => onSelect(thread.id),
|
|
38
76
|
onDoubleClick: onRename ? () => setEditing(true) : undefined,
|
|
39
|
-
className: cn("flex min-w-0 flex-1 items-center gap-3 py-1.5 pl-2 text-left text-sm
|
|
77
|
+
className: cn("flex min-w-0 flex-1 items-center gap-3 py-1.5 pl-2 text-left text-sm locus-focus-ring-inset", hasMenu ? "pr-8 sm:pr-2" : "pr-2", active && "font-medium"),
|
|
40
78
|
children: [/*#__PURE__*/_jsx("span", {
|
|
41
79
|
className: "min-w-0 flex-1 truncate",
|
|
42
80
|
children: thread.title
|
|
43
|
-
}), /*#__PURE__*/
|
|
81
|
+
}), /*#__PURE__*/_jsxs("time", {
|
|
44
82
|
dateTime: thread.updatedAt,
|
|
45
83
|
suppressHydrationWarning: true,
|
|
46
|
-
className: cn("shrink-0
|
|
47
|
-
children:
|
|
84
|
+
className: cn("shrink-0 text-xs font-normal text-faint tabular-nums", hasMenu && timeHiddenByMenuClass),
|
|
85
|
+
children: [/*#__PURE__*/_jsx("span", {
|
|
86
|
+
className: "sr-only",
|
|
87
|
+
children: ", "
|
|
88
|
+
}), formatTimeOfDay(thread.updatedAt)]
|
|
48
89
|
})]
|
|
49
|
-
})
|
|
90
|
+
});
|
|
91
|
+
$[11] = active;
|
|
92
|
+
$[12] = editing;
|
|
93
|
+
$[13] = hasMenu;
|
|
94
|
+
$[14] = onRename;
|
|
95
|
+
$[15] = onSelect;
|
|
96
|
+
$[16] = thread.id;
|
|
97
|
+
$[17] = thread.title;
|
|
98
|
+
$[18] = thread.updatedAt;
|
|
99
|
+
$[19] = t4;
|
|
100
|
+
} else {
|
|
101
|
+
t4 = $[19];
|
|
102
|
+
}
|
|
103
|
+
let t5;
|
|
104
|
+
if ($[20] !== editing || $[21] !== hasMenu || $[22] !== onArchive || $[23] !== onRename || $[24] !== thread.id || $[25] !== thread.title) {
|
|
105
|
+
t5 = hasMenu && !editing && /*#__PURE__*/_jsx("div", {
|
|
50
106
|
className: "absolute top-1/2 right-1 -translate-y-1/2",
|
|
51
107
|
children: /*#__PURE__*/_jsx(ThreadItemMenu, {
|
|
52
108
|
title: thread.title,
|
|
53
109
|
onRename: onRename ? () => setEditing(true) : undefined,
|
|
54
110
|
onArchive: onArchive ? () => onArchive(thread.id) : undefined
|
|
55
111
|
})
|
|
56
|
-
})
|
|
57
|
-
|
|
112
|
+
});
|
|
113
|
+
$[20] = editing;
|
|
114
|
+
$[21] = hasMenu;
|
|
115
|
+
$[22] = onArchive;
|
|
116
|
+
$[23] = onRename;
|
|
117
|
+
$[24] = thread.id;
|
|
118
|
+
$[25] = thread.title;
|
|
119
|
+
$[26] = t5;
|
|
120
|
+
} else {
|
|
121
|
+
t5 = $[26];
|
|
122
|
+
}
|
|
123
|
+
let t6;
|
|
124
|
+
if ($[27] !== props || $[28] !== t1 || $[29] !== t3 || $[30] !== t4 || $[31] !== t5) {
|
|
125
|
+
t6 = /*#__PURE__*/_jsxs("li", {
|
|
126
|
+
"data-slot": "history-item",
|
|
127
|
+
"data-active": t1,
|
|
128
|
+
className: t3,
|
|
129
|
+
...props,
|
|
130
|
+
children: [t4, t5]
|
|
131
|
+
});
|
|
132
|
+
$[27] = props;
|
|
133
|
+
$[28] = t1;
|
|
134
|
+
$[29] = t3;
|
|
135
|
+
$[30] = t4;
|
|
136
|
+
$[31] = t5;
|
|
137
|
+
$[32] = t6;
|
|
138
|
+
} else {
|
|
139
|
+
t6 = $[32];
|
|
140
|
+
}
|
|
141
|
+
return t6;
|
|
58
142
|
}
|
|
@@ -1,31 +1,95 @@
|
|
|
1
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { c as _c } from "react/compiler-runtime";
|
|
2
4
|
import { Button, DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "@locusgraph/components";
|
|
5
|
+
import { Archive as ArchiveIcon, DotsThree as EllipsisIcon, PencilSimple as PencilIcon } from "@phosphor-icons/react/ssr";
|
|
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
|
+
weight: "bold",
|
|
19
|
+
"aria-hidden": true
|
|
20
|
+
});
|
|
21
|
+
$[0] = t2;
|
|
22
|
+
} else {
|
|
23
|
+
t2 = $[0];
|
|
24
|
+
}
|
|
25
|
+
let t3;
|
|
26
|
+
if ($[1] !== t1) {
|
|
27
|
+
t3 = /*#__PURE__*/_jsx(DropdownMenuTrigger, {
|
|
11
28
|
asChild: true,
|
|
12
29
|
children: /*#__PURE__*/_jsx(Button, {
|
|
13
30
|
type: "button",
|
|
14
31
|
variant: "ghost",
|
|
15
32
|
size: "icon-xs",
|
|
16
|
-
"aria-label":
|
|
33
|
+
"aria-label": t1,
|
|
17
34
|
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:
|
|
35
|
+
children: t2
|
|
19
36
|
})
|
|
20
|
-
})
|
|
37
|
+
});
|
|
38
|
+
$[1] = t1;
|
|
39
|
+
$[2] = t3;
|
|
40
|
+
} else {
|
|
41
|
+
t3 = $[2];
|
|
42
|
+
}
|
|
43
|
+
let t4;
|
|
44
|
+
if ($[3] !== onRename) {
|
|
45
|
+
t4 = onRename && /*#__PURE__*/_jsxs(DropdownMenuItem, {
|
|
46
|
+
onSelect: onRename,
|
|
47
|
+
children: [/*#__PURE__*/_jsx(PencilIcon, {
|
|
48
|
+
weight: "bold",
|
|
49
|
+
"aria-hidden": true
|
|
50
|
+
}), "Rename"]
|
|
51
|
+
});
|
|
52
|
+
$[3] = onRename;
|
|
53
|
+
$[4] = t4;
|
|
54
|
+
} else {
|
|
55
|
+
t4 = $[4];
|
|
56
|
+
}
|
|
57
|
+
let t5;
|
|
58
|
+
if ($[5] !== onArchive) {
|
|
59
|
+
t5 = onArchive && /*#__PURE__*/_jsxs(DropdownMenuItem, {
|
|
60
|
+
onSelect: onArchive,
|
|
61
|
+
children: [/*#__PURE__*/_jsx(ArchiveIcon, {
|
|
62
|
+
weight: "bold",
|
|
63
|
+
"aria-hidden": true
|
|
64
|
+
}), "Archive"]
|
|
65
|
+
});
|
|
66
|
+
$[5] = onArchive;
|
|
67
|
+
$[6] = t5;
|
|
68
|
+
} else {
|
|
69
|
+
t5 = $[6];
|
|
70
|
+
}
|
|
71
|
+
let t6;
|
|
72
|
+
if ($[7] !== t4 || $[8] !== t5) {
|
|
73
|
+
t6 = /*#__PURE__*/_jsxs(DropdownMenuContent, {
|
|
21
74
|
align: "end",
|
|
22
|
-
children: [
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
75
|
+
children: [t4, t5]
|
|
76
|
+
});
|
|
77
|
+
$[7] = t4;
|
|
78
|
+
$[8] = t5;
|
|
79
|
+
$[9] = t6;
|
|
80
|
+
} else {
|
|
81
|
+
t6 = $[9];
|
|
82
|
+
}
|
|
83
|
+
let t7;
|
|
84
|
+
if ($[10] !== t3 || $[11] !== t6) {
|
|
85
|
+
t7 = /*#__PURE__*/_jsxs(DropdownMenu, {
|
|
86
|
+
children: [t3, t6]
|
|
87
|
+
});
|
|
88
|
+
$[10] = t3;
|
|
89
|
+
$[11] = t6;
|
|
90
|
+
$[12] = t7;
|
|
91
|
+
} else {
|
|
92
|
+
t7 = $[12];
|
|
93
|
+
}
|
|
94
|
+
return t7;
|
|
31
95
|
}
|
|
@@ -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-control-sm 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
|
}
|