@locusgraph/loop 0.3.0 → 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/use-loop-animation.js +35 -12
- 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/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 +90 -23
- 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/cost/model-picker.js +174 -42
- package/dist/memory/cite.js +181 -58
- package/dist/memory/memorized.js +196 -42
- package/dist/memory/recall.js +265 -68
- package/dist/memory/sources.js +232 -52
- package/dist/shared/virtual/use-list-virtualizer.js +2 -0
- package/dist/thread/actions/branch-switcher.js +97 -21
- package/dist/thread/canvas/version-switcher.js +128 -31
- package/dist/thread/code/copy-code-button.js +58 -24
- 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 +1 -1
|
@@ -1,30 +1,106 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { c as _c } from "react/compiler-runtime";
|
|
1
4
|
import { ChevronLeft as ChevronLeftIcon, ChevronRight as ChevronRightIcon } from "@carbon/icons-react";
|
|
2
5
|
import { ActionButton } from "./action-button.js";
|
|
3
6
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
4
|
-
export function BranchSwitcher({
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
export function BranchSwitcher(t0) {
|
|
8
|
+
const $ = _c(20);
|
|
9
|
+
const {
|
|
10
|
+
branch,
|
|
11
|
+
onBranchChange
|
|
12
|
+
} = t0;
|
|
8
13
|
const position = branch.index + 1;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
const t1 = branch.index <= 0;
|
|
15
|
+
let t2;
|
|
16
|
+
if ($[0] !== branch.index || $[1] !== onBranchChange) {
|
|
17
|
+
t2 = () => onBranchChange(branch.index - 1);
|
|
18
|
+
$[0] = branch.index;
|
|
19
|
+
$[1] = onBranchChange;
|
|
20
|
+
$[2] = t2;
|
|
21
|
+
} else {
|
|
22
|
+
t2 = $[2];
|
|
23
|
+
}
|
|
24
|
+
let t3;
|
|
25
|
+
if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
|
|
26
|
+
t3 = /*#__PURE__*/_jsx(ChevronLeftIcon, {});
|
|
27
|
+
$[3] = t3;
|
|
28
|
+
} else {
|
|
29
|
+
t3 = $[3];
|
|
30
|
+
}
|
|
31
|
+
let t4;
|
|
32
|
+
if ($[4] !== t1 || $[5] !== t2) {
|
|
33
|
+
t4 = /*#__PURE__*/_jsx(ActionButton, {
|
|
15
34
|
label: "Previous version",
|
|
16
|
-
disabled:
|
|
17
|
-
onClick:
|
|
18
|
-
children:
|
|
19
|
-
})
|
|
35
|
+
disabled: t1,
|
|
36
|
+
onClick: t2,
|
|
37
|
+
children: t3
|
|
38
|
+
});
|
|
39
|
+
$[4] = t1;
|
|
40
|
+
$[5] = t2;
|
|
41
|
+
$[6] = t4;
|
|
42
|
+
} else {
|
|
43
|
+
t4 = $[6];
|
|
44
|
+
}
|
|
45
|
+
const t5 = `${position} / ${branch.count}`;
|
|
46
|
+
let t6;
|
|
47
|
+
if ($[7] !== t5) {
|
|
48
|
+
t6 = /*#__PURE__*/_jsx("span", {
|
|
20
49
|
"aria-live": "polite",
|
|
21
50
|
className: "min-w-9 text-center font-mono text-xs text-muted-foreground tabular-nums",
|
|
22
|
-
children:
|
|
23
|
-
})
|
|
51
|
+
children: t5
|
|
52
|
+
});
|
|
53
|
+
$[7] = t5;
|
|
54
|
+
$[8] = t6;
|
|
55
|
+
} else {
|
|
56
|
+
t6 = $[8];
|
|
57
|
+
}
|
|
58
|
+
const t7 = position >= branch.count;
|
|
59
|
+
let t8;
|
|
60
|
+
if ($[9] !== branch.index || $[10] !== onBranchChange) {
|
|
61
|
+
t8 = () => onBranchChange(branch.index + 1);
|
|
62
|
+
$[9] = branch.index;
|
|
63
|
+
$[10] = onBranchChange;
|
|
64
|
+
$[11] = t8;
|
|
65
|
+
} else {
|
|
66
|
+
t8 = $[11];
|
|
67
|
+
}
|
|
68
|
+
let t9;
|
|
69
|
+
if ($[12] === Symbol.for("react.memo_cache_sentinel")) {
|
|
70
|
+
t9 = /*#__PURE__*/_jsx(ChevronRightIcon, {});
|
|
71
|
+
$[12] = t9;
|
|
72
|
+
} else {
|
|
73
|
+
t9 = $[12];
|
|
74
|
+
}
|
|
75
|
+
let t10;
|
|
76
|
+
if ($[13] !== t7 || $[14] !== t8) {
|
|
77
|
+
t10 = /*#__PURE__*/_jsx(ActionButton, {
|
|
24
78
|
label: "Next version",
|
|
25
|
-
disabled:
|
|
26
|
-
onClick:
|
|
27
|
-
children:
|
|
28
|
-
})
|
|
29
|
-
|
|
79
|
+
disabled: t7,
|
|
80
|
+
onClick: t8,
|
|
81
|
+
children: t9
|
|
82
|
+
});
|
|
83
|
+
$[13] = t7;
|
|
84
|
+
$[14] = t8;
|
|
85
|
+
$[15] = t10;
|
|
86
|
+
} else {
|
|
87
|
+
t10 = $[15];
|
|
88
|
+
}
|
|
89
|
+
let t11;
|
|
90
|
+
if ($[16] !== t10 || $[17] !== t4 || $[18] !== t6) {
|
|
91
|
+
t11 = /*#__PURE__*/_jsxs("div", {
|
|
92
|
+
"data-slot": "branch-switcher",
|
|
93
|
+
role: "group",
|
|
94
|
+
"aria-label": "Reply versions",
|
|
95
|
+
className: "flex items-center",
|
|
96
|
+
children: [t4, t6, t10]
|
|
97
|
+
});
|
|
98
|
+
$[16] = t10;
|
|
99
|
+
$[17] = t4;
|
|
100
|
+
$[18] = t6;
|
|
101
|
+
$[19] = t11;
|
|
102
|
+
} else {
|
|
103
|
+
t11 = $[19];
|
|
104
|
+
}
|
|
105
|
+
return t11;
|
|
30
106
|
}
|
|
@@ -1,57 +1,154 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { c as _c } from "react/compiler-runtime";
|
|
1
4
|
import { ChevronDown as ChevronDownIcon } from "@carbon/icons-react";
|
|
2
5
|
import { Button, DropdownMenu, DropdownMenuContent, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuTrigger } from "@locusgraph/components";
|
|
3
6
|
import { formatDate } from "@locusgraph/utils";
|
|
4
7
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
5
|
-
export function VersionSwitcher({
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
export function VersionSwitcher(t0) {
|
|
9
|
+
const $ = _c(26);
|
|
10
|
+
const {
|
|
11
|
+
versions,
|
|
12
|
+
current,
|
|
13
|
+
onVersionChange
|
|
14
|
+
} = t0;
|
|
15
|
+
let t1;
|
|
16
|
+
if ($[0] !== current.label) {
|
|
17
|
+
t1 = /*#__PURE__*/_jsx("span", {
|
|
13
18
|
"data-slot": "canvas-current-version",
|
|
14
19
|
children: current.label
|
|
15
|
-
})
|
|
20
|
+
});
|
|
21
|
+
$[0] = current.label;
|
|
22
|
+
$[1] = t1;
|
|
23
|
+
} else {
|
|
24
|
+
t1 = $[1];
|
|
25
|
+
}
|
|
26
|
+
let t2;
|
|
27
|
+
if ($[2] !== versions.length) {
|
|
28
|
+
t2 = versions.length > 1 && /*#__PURE__*/_jsxs("span", {
|
|
16
29
|
className: "text-muted-foreground",
|
|
17
30
|
children: ["of ", versions.length]
|
|
18
|
-
})
|
|
19
|
-
|
|
31
|
+
});
|
|
32
|
+
$[2] = versions.length;
|
|
33
|
+
$[3] = t2;
|
|
34
|
+
} else {
|
|
35
|
+
t2 = $[3];
|
|
36
|
+
}
|
|
37
|
+
const t3 = current.createdAt;
|
|
38
|
+
let t4;
|
|
39
|
+
if ($[4] !== current.createdAt) {
|
|
40
|
+
t4 = formatDate(current.createdAt);
|
|
41
|
+
$[4] = current.createdAt;
|
|
42
|
+
$[5] = t4;
|
|
43
|
+
} else {
|
|
44
|
+
t4 = $[5];
|
|
45
|
+
}
|
|
46
|
+
let t5;
|
|
47
|
+
if ($[6] !== current.createdAt || $[7] !== t4) {
|
|
48
|
+
t5 = /*#__PURE__*/_jsx("time", {
|
|
49
|
+
dateTime: t3,
|
|
20
50
|
className: "text-muted-foreground",
|
|
21
|
-
children:
|
|
22
|
-
})
|
|
23
|
-
|
|
51
|
+
children: t4
|
|
52
|
+
});
|
|
53
|
+
$[6] = current.createdAt;
|
|
54
|
+
$[7] = t4;
|
|
55
|
+
$[8] = t5;
|
|
56
|
+
} else {
|
|
57
|
+
t5 = $[8];
|
|
58
|
+
}
|
|
59
|
+
let t6;
|
|
60
|
+
if ($[9] !== t1 || $[10] !== t2 || $[11] !== t5) {
|
|
61
|
+
t6 = /*#__PURE__*/_jsxs("span", {
|
|
62
|
+
className: "flex items-center gap-2 font-mono text-[11px] tabular-nums",
|
|
63
|
+
children: [t1, t2, t5]
|
|
64
|
+
});
|
|
65
|
+
$[9] = t1;
|
|
66
|
+
$[10] = t2;
|
|
67
|
+
$[11] = t5;
|
|
68
|
+
$[12] = t6;
|
|
69
|
+
} else {
|
|
70
|
+
t6 = $[12];
|
|
71
|
+
}
|
|
72
|
+
const label = t6;
|
|
24
73
|
if (versions.length < 2 || !onVersionChange) {
|
|
25
74
|
return label;
|
|
26
75
|
}
|
|
27
|
-
|
|
28
|
-
|
|
76
|
+
const t7 = `Version ${current.label}, choose another version`;
|
|
77
|
+
let t8;
|
|
78
|
+
if ($[13] === Symbol.for("react.memo_cache_sentinel")) {
|
|
79
|
+
t8 = /*#__PURE__*/_jsx(ChevronDownIcon, {});
|
|
80
|
+
$[13] = t8;
|
|
81
|
+
} else {
|
|
82
|
+
t8 = $[13];
|
|
83
|
+
}
|
|
84
|
+
let t9;
|
|
85
|
+
if ($[14] !== label || $[15] !== t7) {
|
|
86
|
+
t9 = /*#__PURE__*/_jsx(DropdownMenuTrigger, {
|
|
29
87
|
asChild: true,
|
|
30
88
|
children: /*#__PURE__*/_jsxs(Button, {
|
|
31
89
|
type: "button",
|
|
32
90
|
variant: "ghost",
|
|
33
91
|
size: "xs",
|
|
34
92
|
className: "-ml-2 font-normal",
|
|
35
|
-
"aria-label":
|
|
36
|
-
children: [label,
|
|
93
|
+
"aria-label": t7,
|
|
94
|
+
children: [label, t8]
|
|
37
95
|
})
|
|
38
|
-
})
|
|
96
|
+
});
|
|
97
|
+
$[14] = label;
|
|
98
|
+
$[15] = t7;
|
|
99
|
+
$[16] = t9;
|
|
100
|
+
} else {
|
|
101
|
+
t9 = $[16];
|
|
102
|
+
}
|
|
103
|
+
const t10 = current.id;
|
|
104
|
+
let t11;
|
|
105
|
+
if ($[17] !== versions) {
|
|
106
|
+
t11 = versions.map(_temp);
|
|
107
|
+
$[17] = versions;
|
|
108
|
+
$[18] = t11;
|
|
109
|
+
} else {
|
|
110
|
+
t11 = $[18];
|
|
111
|
+
}
|
|
112
|
+
let t12;
|
|
113
|
+
if ($[19] !== current.id || $[20] !== onVersionChange || $[21] !== t11) {
|
|
114
|
+
t12 = /*#__PURE__*/_jsx(DropdownMenuContent, {
|
|
39
115
|
align: "start",
|
|
40
116
|
sideOffset: 6,
|
|
41
117
|
children: /*#__PURE__*/_jsx(DropdownMenuRadioGroup, {
|
|
42
|
-
value:
|
|
118
|
+
value: t10,
|
|
43
119
|
onValueChange: onVersionChange,
|
|
44
|
-
children:
|
|
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))
|
|
120
|
+
children: t11
|
|
54
121
|
})
|
|
122
|
+
});
|
|
123
|
+
$[19] = current.id;
|
|
124
|
+
$[20] = onVersionChange;
|
|
125
|
+
$[21] = t11;
|
|
126
|
+
$[22] = t12;
|
|
127
|
+
} else {
|
|
128
|
+
t12 = $[22];
|
|
129
|
+
}
|
|
130
|
+
let t13;
|
|
131
|
+
if ($[23] !== t12 || $[24] !== t9) {
|
|
132
|
+
t13 = /*#__PURE__*/_jsxs(DropdownMenu, {
|
|
133
|
+
children: [t9, t12]
|
|
134
|
+
});
|
|
135
|
+
$[23] = t12;
|
|
136
|
+
$[24] = t9;
|
|
137
|
+
$[25] = t13;
|
|
138
|
+
} else {
|
|
139
|
+
t13 = $[25];
|
|
140
|
+
}
|
|
141
|
+
return t13;
|
|
142
|
+
}
|
|
143
|
+
function _temp(version) {
|
|
144
|
+
return /*#__PURE__*/_jsxs(DropdownMenuRadioItem, {
|
|
145
|
+
value: version.id,
|
|
146
|
+
children: [/*#__PURE__*/_jsx("span", {
|
|
147
|
+
className: "font-mono text-xs",
|
|
148
|
+
children: version.label
|
|
149
|
+
}), /*#__PURE__*/_jsx("span", {
|
|
150
|
+
className: "ml-auto pl-4 text-xs text-muted-foreground",
|
|
151
|
+
children: formatDate(version.createdAt)
|
|
55
152
|
})]
|
|
56
|
-
});
|
|
153
|
+
}, version.id);
|
|
57
154
|
}
|
|
@@ -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
|
}
|
|
@@ -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
|
}
|