@locusgraph/loop 0.2.0 → 0.3.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/pulse/gradient-label.js +12 -62
- package/dist/agent/pulse/marks/bars-mark.js +15 -37
- package/dist/agent/pulse/marks/glyph-mark.js +15 -54
- package/dist/agent/pulse/marks/locus-mark.js +12 -36
- package/dist/agent/pulse/marks/orb-mark.js +9 -19
- package/dist/agent/pulse/marks/spinner-mark.js +20 -29
- package/dist/agent/pulse/pulse.js +36 -123
- package/dist/agent/pulse/use-loop-animation.js +12 -33
- package/dist/agent/steps/step-icon.js +26 -96
- package/dist/agent/steps/steps.js +47 -210
- package/dist/agent/thinking/thinking.js +2 -2
- package/dist/agent/tool/json-block.js +11 -31
- package/dist/agent/tool/tool-status.js +12 -35
- package/dist/approval/inbox/inbox-row.js +76 -301
- package/dist/approval/inbox/inbox.js +39 -190
- package/dist/approval/inbox/virtual-inbox-list.js +26 -102
- package/dist/approval/memory/memory-review.js +36 -170
- package/dist/approval/memory/memory-row.js +50 -185
- package/dist/approval/plan/plan-review.js +73 -223
- package/dist/approval/plan/plan-step-row.js +76 -180
- package/dist/approval/plan/question-choices.js +44 -130
- package/dist/approval/plan/question.js +38 -154
- package/dist/approval/run/run-bar.js +39 -123
- package/dist/approval/shared/risk-badge.js +9 -24
- package/dist/approval/shared/use-focus-on-mount.js +5 -21
- package/dist/approval/spend/raise-cap-form.js +48 -221
- package/dist/approval/spend/spend-gate.js +40 -155
- package/dist/approval/spend/spend-meter.js +86 -313
- package/dist/approval/tool/approval.js +35 -194
- package/dist/approval/tool/args/args-editor.js +46 -204
- package/dist/approval/tool/args/args-field.js +55 -238
- package/dist/approval/tool/deny-form.js +36 -123
- package/dist/approval/tool/tool-inputs.js +24 -89
- package/dist/chat/chat/use-stick-to-bottom.js +60 -113
- package/dist/chat/chat/virtual-chat-items.js +34 -127
- package/dist/chat/composer/composer-actions.js +46 -129
- package/dist/chat/composer/use-auto-grow.js +8 -23
- package/dist/chat/files/files.js +66 -291
- package/dist/chat/reply/fenced-code.js +10 -32
- package/dist/chat/reply/markdown-components.js +2 -2
- package/dist/chat/reply/reply.js +24 -99
- package/dist/chat/turn/turn.js +46 -197
- package/dist/cost/context.js +65 -282
- package/dist/cost/cost-steps.js +42 -195
- package/dist/cost/cost.js +108 -497
- package/dist/cost/model-picker.js +42 -172
- package/dist/cost/shared/context-breakdown.js +65 -281
- package/dist/cost/shared/meter-marks.js +34 -92
- package/dist/cost/shared/model-option-row.js +35 -158
- package/dist/cost/shared/step-cost-row.js +37 -222
- package/dist/memory/cite.js +58 -179
- package/dist/memory/memorized.js +43 -195
- package/dist/memory/recall.js +68 -263
- package/dist/memory/shared/disclosure.d.ts +2 -2
- package/dist/memory/shared/disclosure.js +1 -1
- package/dist/memory/shared/source-mark.js +10 -38
- package/dist/memory/sources.js +52 -230
- package/dist/shared/decision-summary.js +35 -117
- package/dist/shared/panel-empty.js +15 -73
- package/dist/shared/panel.js +65 -239
- package/dist/shared/status-dot.js +10 -32
- package/dist/thread/actions/action-button.js +10 -53
- package/dist/thread/actions/branch-switcher.js +21 -95
- package/dist/thread/canvas/canvas.js +1 -1
- package/dist/thread/canvas/version-switcher.js +31 -126
- package/dist/thread/code/code.js +2 -2
- package/dist/thread/code/copy-code-button.js +24 -56
- package/dist/thread/history/history.js +1 -1
- package/dist/thread/history/row/history-row.js +18 -97
- package/dist/thread/history/row/thread-item-menu.js +19 -72
- package/dist/thread/history/row/thread-title-editor.js +29 -72
- package/dist/thread/history/virtual-history-list.js +46 -82
- package/dist/thread/starters/starters.js +27 -87
- package/dist/thread/use-copied.js +10 -38
- package/package.json +3 -3
|
@@ -1,152 +1,57 @@
|
|
|
1
|
-
import { c as _c } from "react/compiler-runtime";
|
|
2
1
|
import { ChevronDown as ChevronDownIcon } from "@carbon/icons-react";
|
|
3
2
|
import { Button, DropdownMenu, DropdownMenuContent, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuTrigger } from "@locusgraph/components";
|
|
4
3
|
import { formatDate } from "@locusgraph/utils";
|
|
5
4
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
6
|
-
export function VersionSwitcher(
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
if ($[0] !== current.label) {
|
|
15
|
-
t1 = /*#__PURE__*/_jsx("span", {
|
|
5
|
+
export function VersionSwitcher({
|
|
6
|
+
versions,
|
|
7
|
+
current,
|
|
8
|
+
onVersionChange
|
|
9
|
+
}) {
|
|
10
|
+
const label = /*#__PURE__*/_jsxs("span", {
|
|
11
|
+
className: "flex items-center gap-2 font-mono text-[11px] tabular-nums",
|
|
12
|
+
children: [/*#__PURE__*/_jsx("span", {
|
|
16
13
|
"data-slot": "canvas-current-version",
|
|
17
14
|
children: current.label
|
|
18
|
-
})
|
|
19
|
-
$[0] = current.label;
|
|
20
|
-
$[1] = t1;
|
|
21
|
-
} else {
|
|
22
|
-
t1 = $[1];
|
|
23
|
-
}
|
|
24
|
-
let t2;
|
|
25
|
-
if ($[2] !== versions.length) {
|
|
26
|
-
t2 = versions.length > 1 && /*#__PURE__*/_jsxs("span", {
|
|
15
|
+
}), versions.length > 1 && /*#__PURE__*/_jsxs("span", {
|
|
27
16
|
className: "text-muted-foreground",
|
|
28
17
|
children: ["of ", versions.length]
|
|
29
|
-
})
|
|
30
|
-
|
|
31
|
-
$[3] = t2;
|
|
32
|
-
} else {
|
|
33
|
-
t2 = $[3];
|
|
34
|
-
}
|
|
35
|
-
const t3 = current.createdAt;
|
|
36
|
-
let t4;
|
|
37
|
-
if ($[4] !== current.createdAt) {
|
|
38
|
-
t4 = formatDate(current.createdAt);
|
|
39
|
-
$[4] = current.createdAt;
|
|
40
|
-
$[5] = t4;
|
|
41
|
-
} else {
|
|
42
|
-
t4 = $[5];
|
|
43
|
-
}
|
|
44
|
-
let t5;
|
|
45
|
-
if ($[6] !== current.createdAt || $[7] !== t4) {
|
|
46
|
-
t5 = /*#__PURE__*/_jsx("time", {
|
|
47
|
-
dateTime: t3,
|
|
18
|
+
}), /*#__PURE__*/_jsx("time", {
|
|
19
|
+
dateTime: current.createdAt,
|
|
48
20
|
className: "text-muted-foreground",
|
|
49
|
-
children:
|
|
50
|
-
})
|
|
51
|
-
|
|
52
|
-
$[7] = t4;
|
|
53
|
-
$[8] = t5;
|
|
54
|
-
} else {
|
|
55
|
-
t5 = $[8];
|
|
56
|
-
}
|
|
57
|
-
let t6;
|
|
58
|
-
if ($[9] !== t1 || $[10] !== t2 || $[11] !== t5) {
|
|
59
|
-
t6 = /*#__PURE__*/_jsxs("span", {
|
|
60
|
-
className: "flex items-center gap-2 font-mono text-[11px] tabular-nums",
|
|
61
|
-
children: [t1, t2, t5]
|
|
62
|
-
});
|
|
63
|
-
$[9] = t1;
|
|
64
|
-
$[10] = t2;
|
|
65
|
-
$[11] = t5;
|
|
66
|
-
$[12] = t6;
|
|
67
|
-
} else {
|
|
68
|
-
t6 = $[12];
|
|
69
|
-
}
|
|
70
|
-
const label = t6;
|
|
21
|
+
children: formatDate(current.createdAt)
|
|
22
|
+
})]
|
|
23
|
+
});
|
|
71
24
|
if (versions.length < 2 || !onVersionChange) {
|
|
72
25
|
return label;
|
|
73
26
|
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
if ($[13] === Symbol.for("react.memo_cache_sentinel")) {
|
|
77
|
-
t8 = /*#__PURE__*/_jsx(ChevronDownIcon, {});
|
|
78
|
-
$[13] = t8;
|
|
79
|
-
} else {
|
|
80
|
-
t8 = $[13];
|
|
81
|
-
}
|
|
82
|
-
let t9;
|
|
83
|
-
if ($[14] !== label || $[15] !== t7) {
|
|
84
|
-
t9 = /*#__PURE__*/_jsx(DropdownMenuTrigger, {
|
|
27
|
+
return /*#__PURE__*/_jsxs(DropdownMenu, {
|
|
28
|
+
children: [/*#__PURE__*/_jsx(DropdownMenuTrigger, {
|
|
85
29
|
asChild: true,
|
|
86
30
|
children: /*#__PURE__*/_jsxs(Button, {
|
|
87
31
|
type: "button",
|
|
88
32
|
variant: "ghost",
|
|
89
33
|
size: "xs",
|
|
90
34
|
className: "-ml-2 font-normal",
|
|
91
|
-
"aria-label":
|
|
92
|
-
children: [label,
|
|
35
|
+
"aria-label": `Version ${current.label}, choose another version`,
|
|
36
|
+
children: [label, /*#__PURE__*/_jsx(ChevronDownIcon, {})]
|
|
93
37
|
})
|
|
94
|
-
})
|
|
95
|
-
$[14] = label;
|
|
96
|
-
$[15] = t7;
|
|
97
|
-
$[16] = t9;
|
|
98
|
-
} else {
|
|
99
|
-
t9 = $[16];
|
|
100
|
-
}
|
|
101
|
-
const t10 = current.id;
|
|
102
|
-
let t11;
|
|
103
|
-
if ($[17] !== versions) {
|
|
104
|
-
t11 = versions.map(_temp);
|
|
105
|
-
$[17] = versions;
|
|
106
|
-
$[18] = t11;
|
|
107
|
-
} else {
|
|
108
|
-
t11 = $[18];
|
|
109
|
-
}
|
|
110
|
-
let t12;
|
|
111
|
-
if ($[19] !== current.id || $[20] !== onVersionChange || $[21] !== t11) {
|
|
112
|
-
t12 = /*#__PURE__*/_jsx(DropdownMenuContent, {
|
|
38
|
+
}), /*#__PURE__*/_jsx(DropdownMenuContent, {
|
|
113
39
|
align: "start",
|
|
114
40
|
sideOffset: 6,
|
|
115
41
|
children: /*#__PURE__*/_jsx(DropdownMenuRadioGroup, {
|
|
116
|
-
value:
|
|
42
|
+
value: current.id,
|
|
117
43
|
onValueChange: onVersionChange,
|
|
118
|
-
children:
|
|
44
|
+
children: versions.map(version => /*#__PURE__*/_jsxs(DropdownMenuRadioItem, {
|
|
45
|
+
value: version.id,
|
|
46
|
+
children: [/*#__PURE__*/_jsx("span", {
|
|
47
|
+
className: "font-mono text-xs",
|
|
48
|
+
children: version.label
|
|
49
|
+
}), /*#__PURE__*/_jsx("span", {
|
|
50
|
+
className: "ml-auto pl-4 text-xs text-muted-foreground",
|
|
51
|
+
children: formatDate(version.createdAt)
|
|
52
|
+
})]
|
|
53
|
+
}, version.id))
|
|
119
54
|
})
|
|
120
|
-
});
|
|
121
|
-
$[19] = current.id;
|
|
122
|
-
$[20] = onVersionChange;
|
|
123
|
-
$[21] = t11;
|
|
124
|
-
$[22] = t12;
|
|
125
|
-
} else {
|
|
126
|
-
t12 = $[22];
|
|
127
|
-
}
|
|
128
|
-
let t13;
|
|
129
|
-
if ($[23] !== t12 || $[24] !== t9) {
|
|
130
|
-
t13 = /*#__PURE__*/_jsxs(DropdownMenu, {
|
|
131
|
-
children: [t9, t12]
|
|
132
|
-
});
|
|
133
|
-
$[23] = t12;
|
|
134
|
-
$[24] = t9;
|
|
135
|
-
$[25] = t13;
|
|
136
|
-
} else {
|
|
137
|
-
t13 = $[25];
|
|
138
|
-
}
|
|
139
|
-
return t13;
|
|
140
|
-
}
|
|
141
|
-
function _temp(version) {
|
|
142
|
-
return /*#__PURE__*/_jsxs(DropdownMenuRadioItem, {
|
|
143
|
-
value: version.id,
|
|
144
|
-
children: [/*#__PURE__*/_jsx("span", {
|
|
145
|
-
className: "font-mono text-xs",
|
|
146
|
-
children: version.label
|
|
147
|
-
}), /*#__PURE__*/_jsx("span", {
|
|
148
|
-
className: "ml-auto pl-4 text-xs text-muted-foreground",
|
|
149
|
-
children: formatDate(version.createdAt)
|
|
150
55
|
})]
|
|
151
|
-
}
|
|
56
|
+
});
|
|
152
57
|
}
|
package/dist/thread/code/code.js
CHANGED
|
@@ -94,7 +94,7 @@ export function Code(t0) {
|
|
|
94
94
|
className: "min-w-0 truncate font-mono text-xs text-foreground",
|
|
95
95
|
children: filename
|
|
96
96
|
}) : /*#__PURE__*/_jsx("span", {
|
|
97
|
-
className: "eyebrow",
|
|
97
|
+
className: "locus-eyebrow",
|
|
98
98
|
children: language
|
|
99
99
|
});
|
|
100
100
|
$[10] = filename;
|
|
@@ -106,7 +106,7 @@ export function Code(t0) {
|
|
|
106
106
|
let t5;
|
|
107
107
|
if ($[13] !== filename || $[14] !== language) {
|
|
108
108
|
t5 = filename && /*#__PURE__*/_jsx("span", {
|
|
109
|
-
className: "eyebrow",
|
|
109
|
+
className: "locus-eyebrow",
|
|
110
110
|
children: language
|
|
111
111
|
});
|
|
112
112
|
$[13] = filename;
|
|
@@ -1,66 +1,34 @@
|
|
|
1
|
-
import { c as _c } from "react/compiler-runtime";
|
|
2
1
|
import { Checkmark as CheckIcon, Copy as CopyIcon } from "@carbon/icons-react";
|
|
3
2
|
import { Button } from "@locusgraph/components";
|
|
4
3
|
import { useCopied, writeToClipboard } from "../use-copied.js";
|
|
5
4
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
-
export function CopyCodeButton(
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
onCopy
|
|
11
|
-
} = t0;
|
|
5
|
+
export function CopyCodeButton({
|
|
6
|
+
code,
|
|
7
|
+
onCopy
|
|
8
|
+
}) {
|
|
12
9
|
const {
|
|
13
10
|
copied,
|
|
14
11
|
markCopied
|
|
15
12
|
} = useCopied();
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
const copy = t1;
|
|
36
|
-
const t2 = copied ? "Copied" : "Copy code";
|
|
37
|
-
let t3;
|
|
38
|
-
if ($[4] !== copied) {
|
|
39
|
-
t3 = copied ? /*#__PURE__*/_jsx(CheckIcon, {
|
|
13
|
+
const copy = async () => {
|
|
14
|
+
if (onCopy) {
|
|
15
|
+
onCopy(code);
|
|
16
|
+
markCopied();
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
if (await writeToClipboard(code)) {
|
|
20
|
+
markCopied();
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
return /*#__PURE__*/_jsx(Button, {
|
|
24
|
+
type: "button",
|
|
25
|
+
variant: "ghost",
|
|
26
|
+
size: "icon-xs",
|
|
27
|
+
"aria-label": copied ? "Copied" : "Copy code",
|
|
28
|
+
className: "text-muted-foreground hover:text-foreground",
|
|
29
|
+
onClick: copy,
|
|
30
|
+
children: copied ? /*#__PURE__*/_jsx(CheckIcon, {
|
|
40
31
|
className: "text-good"
|
|
41
|
-
}) : /*#__PURE__*/_jsx(CopyIcon, {})
|
|
42
|
-
|
|
43
|
-
$[5] = t3;
|
|
44
|
-
} else {
|
|
45
|
-
t3 = $[5];
|
|
46
|
-
}
|
|
47
|
-
let t4;
|
|
48
|
-
if ($[6] !== copy || $[7] !== t2 || $[8] !== t3) {
|
|
49
|
-
t4 = /*#__PURE__*/_jsx(Button, {
|
|
50
|
-
type: "button",
|
|
51
|
-
variant: "ghost",
|
|
52
|
-
size: "icon-xs",
|
|
53
|
-
"aria-label": t2,
|
|
54
|
-
className: "text-muted-foreground hover:text-foreground",
|
|
55
|
-
onClick: copy,
|
|
56
|
-
children: t3
|
|
57
|
-
});
|
|
58
|
-
$[6] = copy;
|
|
59
|
-
$[7] = t2;
|
|
60
|
-
$[8] = t3;
|
|
61
|
-
$[9] = t4;
|
|
62
|
-
} else {
|
|
63
|
-
t4 = $[9];
|
|
64
|
-
}
|
|
65
|
-
return t4;
|
|
32
|
+
}) : /*#__PURE__*/_jsx(CopyIcon, {})
|
|
33
|
+
});
|
|
66
34
|
}
|
|
@@ -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,4 +1,3 @@
|
|
|
1
|
-
import { c as _c } from "react/compiler-runtime";
|
|
2
1
|
import { cn } from "@locusgraph/components";
|
|
3
2
|
import { useState } from "react";
|
|
4
3
|
import { formatTimeOfDay } from "../thread-groups.js";
|
|
@@ -6,58 +5,23 @@ import { ThreadItemMenu } from "./thread-item-menu.js";
|
|
|
6
5
|
import { ThreadTitleEditor } from "./thread-title-editor.js";
|
|
7
6
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
7
|
const timeHiddenByMenuClass = "max-sm:hidden sm:group-focus-within:invisible sm:group-hover:invisible sm:group-has-[[data-state=open]]:invisible";
|
|
9
|
-
export function HistoryRow(
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
if ($[0] !== t0) {
|
|
19
|
-
({
|
|
20
|
-
thread,
|
|
21
|
-
active,
|
|
22
|
-
onSelect,
|
|
23
|
-
onRename,
|
|
24
|
-
onArchive,
|
|
25
|
-
className,
|
|
26
|
-
...props
|
|
27
|
-
} = t0);
|
|
28
|
-
$[0] = t0;
|
|
29
|
-
$[1] = active;
|
|
30
|
-
$[2] = className;
|
|
31
|
-
$[3] = onArchive;
|
|
32
|
-
$[4] = onRename;
|
|
33
|
-
$[5] = onSelect;
|
|
34
|
-
$[6] = props;
|
|
35
|
-
$[7] = thread;
|
|
36
|
-
} else {
|
|
37
|
-
active = $[1];
|
|
38
|
-
className = $[2];
|
|
39
|
-
onArchive = $[3];
|
|
40
|
-
onRename = $[4];
|
|
41
|
-
onSelect = $[5];
|
|
42
|
-
props = $[6];
|
|
43
|
-
thread = $[7];
|
|
44
|
-
}
|
|
8
|
+
export function HistoryRow({
|
|
9
|
+
thread,
|
|
10
|
+
active,
|
|
11
|
+
onSelect,
|
|
12
|
+
onRename,
|
|
13
|
+
onArchive,
|
|
14
|
+
className,
|
|
15
|
+
...props
|
|
16
|
+
}) {
|
|
45
17
|
const [editing, setEditing] = useState(false);
|
|
46
18
|
const hasMenu = onRename !== undefined || onArchive !== undefined;
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
$[9] = t2;
|
|
54
|
-
$[10] = t3;
|
|
55
|
-
} else {
|
|
56
|
-
t3 = $[10];
|
|
57
|
-
}
|
|
58
|
-
let t4;
|
|
59
|
-
if ($[11] !== active || $[12] !== editing || $[13] !== hasMenu || $[14] !== onRename || $[15] !== onSelect || $[16] !== thread.id || $[17] !== thread.title || $[18] !== thread.updatedAt) {
|
|
60
|
-
t4 = editing && onRename ? /*#__PURE__*/_jsx("div", {
|
|
19
|
+
return /*#__PURE__*/_jsxs("li", {
|
|
20
|
+
"data-slot": "history-item",
|
|
21
|
+
"data-active": active || undefined,
|
|
22
|
+
className: cn("group relative flex items-center motion-safe:transition-colors", 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", className),
|
|
23
|
+
...props,
|
|
24
|
+
children: [editing && onRename ? /*#__PURE__*/_jsx("div", {
|
|
61
25
|
className: "flex-1 px-1 py-0.5",
|
|
62
26
|
children: /*#__PURE__*/_jsx(ThreadTitleEditor, {
|
|
63
27
|
title: thread.title,
|
|
@@ -82,56 +46,13 @@ export function HistoryRow(t0) {
|
|
|
82
46
|
className: cn("shrink-0 font-mono text-[11px] font-normal text-muted-foreground tabular-nums", hasMenu && timeHiddenByMenuClass),
|
|
83
47
|
children: formatTimeOfDay(thread.updatedAt)
|
|
84
48
|
})]
|
|
85
|
-
})
|
|
86
|
-
$[11] = active;
|
|
87
|
-
$[12] = editing;
|
|
88
|
-
$[13] = hasMenu;
|
|
89
|
-
$[14] = onRename;
|
|
90
|
-
$[15] = onSelect;
|
|
91
|
-
$[16] = thread.id;
|
|
92
|
-
$[17] = thread.title;
|
|
93
|
-
$[18] = thread.updatedAt;
|
|
94
|
-
$[19] = t4;
|
|
95
|
-
} else {
|
|
96
|
-
t4 = $[19];
|
|
97
|
-
}
|
|
98
|
-
let t5;
|
|
99
|
-
if ($[20] !== editing || $[21] !== hasMenu || $[22] !== onArchive || $[23] !== onRename || $[24] !== thread.id || $[25] !== thread.title) {
|
|
100
|
-
t5 = hasMenu && !editing && /*#__PURE__*/_jsx("div", {
|
|
49
|
+
}), hasMenu && !editing && /*#__PURE__*/_jsx("div", {
|
|
101
50
|
className: "absolute top-1/2 right-1 -translate-y-1/2",
|
|
102
51
|
children: /*#__PURE__*/_jsx(ThreadItemMenu, {
|
|
103
52
|
title: thread.title,
|
|
104
53
|
onRename: onRename ? () => setEditing(true) : undefined,
|
|
105
54
|
onArchive: onArchive ? () => onArchive(thread.id) : undefined
|
|
106
55
|
})
|
|
107
|
-
})
|
|
108
|
-
|
|
109
|
-
$[21] = hasMenu;
|
|
110
|
-
$[22] = onArchive;
|
|
111
|
-
$[23] = onRename;
|
|
112
|
-
$[24] = thread.id;
|
|
113
|
-
$[25] = thread.title;
|
|
114
|
-
$[26] = t5;
|
|
115
|
-
} else {
|
|
116
|
-
t5 = $[26];
|
|
117
|
-
}
|
|
118
|
-
let t6;
|
|
119
|
-
if ($[27] !== props || $[28] !== t1 || $[29] !== t3 || $[30] !== t4 || $[31] !== t5) {
|
|
120
|
-
t6 = /*#__PURE__*/_jsxs("li", {
|
|
121
|
-
"data-slot": "history-item",
|
|
122
|
-
"data-active": t1,
|
|
123
|
-
className: t3,
|
|
124
|
-
...props,
|
|
125
|
-
children: [t4, t5]
|
|
126
|
-
});
|
|
127
|
-
$[27] = props;
|
|
128
|
-
$[28] = t1;
|
|
129
|
-
$[29] = t3;
|
|
130
|
-
$[30] = t4;
|
|
131
|
-
$[31] = t5;
|
|
132
|
-
$[32] = t6;
|
|
133
|
-
} else {
|
|
134
|
-
t6 = $[32];
|
|
135
|
-
}
|
|
136
|
-
return t6;
|
|
56
|
+
})]
|
|
57
|
+
});
|
|
137
58
|
}
|
|
@@ -1,84 +1,31 @@
|
|
|
1
|
-
import { c as _c } from "react/compiler-runtime";
|
|
2
1
|
import { Archive as ArchiveIcon, OverflowMenuHorizontal as EllipsisIcon, Edit as PencilIcon } from "@carbon/icons-react";
|
|
3
2
|
import { Button, DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "@locusgraph/components";
|
|
4
3
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
5
|
-
export function ThreadItemMenu(
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const t1 = `Options for ${title}`;
|
|
13
|
-
let t2;
|
|
14
|
-
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
15
|
-
t2 = /*#__PURE__*/_jsx(EllipsisIcon, {});
|
|
16
|
-
$[0] = t2;
|
|
17
|
-
} else {
|
|
18
|
-
t2 = $[0];
|
|
19
|
-
}
|
|
20
|
-
let t3;
|
|
21
|
-
if ($[1] !== t1) {
|
|
22
|
-
t3 = /*#__PURE__*/_jsx(DropdownMenuTrigger, {
|
|
4
|
+
export function ThreadItemMenu({
|
|
5
|
+
title,
|
|
6
|
+
onRename,
|
|
7
|
+
onArchive
|
|
8
|
+
}) {
|
|
9
|
+
return /*#__PURE__*/_jsxs(DropdownMenu, {
|
|
10
|
+
children: [/*#__PURE__*/_jsx(DropdownMenuTrigger, {
|
|
23
11
|
asChild: true,
|
|
24
12
|
children: /*#__PURE__*/_jsx(Button, {
|
|
25
13
|
type: "button",
|
|
26
14
|
variant: "ghost",
|
|
27
15
|
size: "icon-xs",
|
|
28
|
-
"aria-label":
|
|
16
|
+
"aria-label": `Options for ${title}`,
|
|
29
17
|
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",
|
|
30
|
-
children:
|
|
18
|
+
children: /*#__PURE__*/_jsx(EllipsisIcon, {})
|
|
31
19
|
})
|
|
32
|
-
})
|
|
33
|
-
$[1] = t1;
|
|
34
|
-
$[2] = t3;
|
|
35
|
-
} else {
|
|
36
|
-
t3 = $[2];
|
|
37
|
-
}
|
|
38
|
-
let t4;
|
|
39
|
-
if ($[3] !== onRename) {
|
|
40
|
-
t4 = onRename && /*#__PURE__*/_jsxs(DropdownMenuItem, {
|
|
41
|
-
onSelect: onRename,
|
|
42
|
-
children: [/*#__PURE__*/_jsx(PencilIcon, {}), "Rename"]
|
|
43
|
-
});
|
|
44
|
-
$[3] = onRename;
|
|
45
|
-
$[4] = t4;
|
|
46
|
-
} else {
|
|
47
|
-
t4 = $[4];
|
|
48
|
-
}
|
|
49
|
-
let t5;
|
|
50
|
-
if ($[5] !== onArchive) {
|
|
51
|
-
t5 = onArchive && /*#__PURE__*/_jsxs(DropdownMenuItem, {
|
|
52
|
-
onSelect: onArchive,
|
|
53
|
-
children: [/*#__PURE__*/_jsx(ArchiveIcon, {}), "Archive"]
|
|
54
|
-
});
|
|
55
|
-
$[5] = onArchive;
|
|
56
|
-
$[6] = t5;
|
|
57
|
-
} else {
|
|
58
|
-
t5 = $[6];
|
|
59
|
-
}
|
|
60
|
-
let t6;
|
|
61
|
-
if ($[7] !== t4 || $[8] !== t5) {
|
|
62
|
-
t6 = /*#__PURE__*/_jsxs(DropdownMenuContent, {
|
|
20
|
+
}), /*#__PURE__*/_jsxs(DropdownMenuContent, {
|
|
63
21
|
align: "end",
|
|
64
|
-
children: [
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
if ($[10] !== t3 || $[11] !== t6) {
|
|
74
|
-
t7 = /*#__PURE__*/_jsxs(DropdownMenu, {
|
|
75
|
-
children: [t3, t6]
|
|
76
|
-
});
|
|
77
|
-
$[10] = t3;
|
|
78
|
-
$[11] = t6;
|
|
79
|
-
$[12] = t7;
|
|
80
|
-
} else {
|
|
81
|
-
t7 = $[12];
|
|
82
|
-
}
|
|
83
|
-
return t7;
|
|
22
|
+
children: [onRename && /*#__PURE__*/_jsxs(DropdownMenuItem, {
|
|
23
|
+
onSelect: onRename,
|
|
24
|
+
children: [/*#__PURE__*/_jsx(PencilIcon, {}), "Rename"]
|
|
25
|
+
}), onArchive && /*#__PURE__*/_jsxs(DropdownMenuItem, {
|
|
26
|
+
onSelect: onArchive,
|
|
27
|
+
children: [/*#__PURE__*/_jsx(ArchiveIcon, {}), "Archive"]
|
|
28
|
+
})]
|
|
29
|
+
})]
|
|
30
|
+
});
|
|
84
31
|
}
|
|
@@ -1,81 +1,38 @@
|
|
|
1
|
-
import { c as _c } from "react/compiler-runtime";
|
|
2
1
|
import { Input } from "@locusgraph/components";
|
|
3
2
|
import { useState } from "react";
|
|
4
3
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
|
-
export function ThreadTitleEditor(
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
onCancel
|
|
11
|
-
} = t0;
|
|
4
|
+
export function ThreadTitleEditor({
|
|
5
|
+
title,
|
|
6
|
+
onCommit,
|
|
7
|
+
onCancel
|
|
8
|
+
}) {
|
|
12
9
|
const [draft, setDraft] = useState(title);
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
|
|
34
|
-
t2 = event => setDraft(event.target.value);
|
|
35
|
-
$[5] = t2;
|
|
36
|
-
} else {
|
|
37
|
-
t2 = $[5];
|
|
38
|
-
}
|
|
39
|
-
let t3;
|
|
40
|
-
if ($[6] !== commit || $[7] !== onCancel) {
|
|
41
|
-
t3 = event_1 => {
|
|
42
|
-
if (event_1.key === "Enter") {
|
|
43
|
-
event_1.preventDefault();
|
|
10
|
+
const commit = () => {
|
|
11
|
+
const trimmed = draft.trim();
|
|
12
|
+
if (trimmed && trimmed !== title) {
|
|
13
|
+
onCommit(trimmed);
|
|
14
|
+
} else {
|
|
15
|
+
onCancel();
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
return /*#__PURE__*/_jsx(Input, {
|
|
19
|
+
"data-slot": "thread-title-editor",
|
|
20
|
+
"aria-label": "Chat title",
|
|
21
|
+
autoFocus: true,
|
|
22
|
+
value: draft,
|
|
23
|
+
className: "h-7 text-sm",
|
|
24
|
+
onChange: event => setDraft(event.target.value),
|
|
25
|
+
onFocus: event => event.target.select(),
|
|
26
|
+
onBlur: commit,
|
|
27
|
+
onKeyDown: event => {
|
|
28
|
+
if (event.key === "Enter") {
|
|
29
|
+
event.preventDefault();
|
|
44
30
|
commit();
|
|
45
31
|
}
|
|
46
|
-
if (
|
|
47
|
-
|
|
32
|
+
if (event.key === "Escape") {
|
|
33
|
+
event.preventDefault();
|
|
48
34
|
onCancel();
|
|
49
35
|
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
$[7] = onCancel;
|
|
53
|
-
$[8] = t3;
|
|
54
|
-
} else {
|
|
55
|
-
t3 = $[8];
|
|
56
|
-
}
|
|
57
|
-
let t4;
|
|
58
|
-
if ($[9] !== commit || $[10] !== draft || $[11] !== t3) {
|
|
59
|
-
t4 = /*#__PURE__*/_jsx(Input, {
|
|
60
|
-
"data-slot": "thread-title-editor",
|
|
61
|
-
"aria-label": "Chat title",
|
|
62
|
-
autoFocus: true,
|
|
63
|
-
value: draft,
|
|
64
|
-
className: "h-7 text-sm",
|
|
65
|
-
onChange: t2,
|
|
66
|
-
onFocus: _temp,
|
|
67
|
-
onBlur: commit,
|
|
68
|
-
onKeyDown: t3
|
|
69
|
-
});
|
|
70
|
-
$[9] = commit;
|
|
71
|
-
$[10] = draft;
|
|
72
|
-
$[11] = t3;
|
|
73
|
-
$[12] = t4;
|
|
74
|
-
} else {
|
|
75
|
-
t4 = $[12];
|
|
76
|
-
}
|
|
77
|
-
return t4;
|
|
78
|
-
}
|
|
79
|
-
function _temp(event_0) {
|
|
80
|
-
return event_0.target.select();
|
|
36
|
+
}
|
|
37
|
+
});
|
|
81
38
|
}
|