@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.
Files changed (75) hide show
  1. package/dist/agent/pulse/gradient-label.js +12 -62
  2. package/dist/agent/pulse/marks/bars-mark.js +15 -37
  3. package/dist/agent/pulse/marks/glyph-mark.js +15 -54
  4. package/dist/agent/pulse/marks/locus-mark.js +12 -36
  5. package/dist/agent/pulse/marks/orb-mark.js +9 -19
  6. package/dist/agent/pulse/marks/spinner-mark.js +20 -29
  7. package/dist/agent/pulse/pulse.js +36 -123
  8. package/dist/agent/pulse/use-loop-animation.js +12 -33
  9. package/dist/agent/steps/step-icon.js +26 -96
  10. package/dist/agent/steps/steps.js +47 -210
  11. package/dist/agent/thinking/thinking.js +2 -2
  12. package/dist/agent/tool/json-block.js +11 -31
  13. package/dist/agent/tool/tool-status.js +12 -35
  14. package/dist/approval/inbox/inbox-row.js +76 -301
  15. package/dist/approval/inbox/inbox.js +39 -190
  16. package/dist/approval/inbox/virtual-inbox-list.js +26 -102
  17. package/dist/approval/memory/memory-review.js +36 -170
  18. package/dist/approval/memory/memory-row.js +50 -185
  19. package/dist/approval/plan/plan-review.js +73 -223
  20. package/dist/approval/plan/plan-step-row.js +76 -180
  21. package/dist/approval/plan/question-choices.js +44 -130
  22. package/dist/approval/plan/question.js +38 -154
  23. package/dist/approval/run/run-bar.js +39 -123
  24. package/dist/approval/shared/risk-badge.js +9 -24
  25. package/dist/approval/shared/use-focus-on-mount.js +5 -21
  26. package/dist/approval/spend/raise-cap-form.js +48 -221
  27. package/dist/approval/spend/spend-gate.js +40 -155
  28. package/dist/approval/spend/spend-meter.js +86 -313
  29. package/dist/approval/tool/approval.js +35 -194
  30. package/dist/approval/tool/args/args-editor.js +46 -204
  31. package/dist/approval/tool/args/args-field.js +55 -238
  32. package/dist/approval/tool/deny-form.js +36 -123
  33. package/dist/approval/tool/tool-inputs.js +24 -89
  34. package/dist/chat/chat/use-stick-to-bottom.js +60 -113
  35. package/dist/chat/chat/virtual-chat-items.js +34 -127
  36. package/dist/chat/composer/composer-actions.js +46 -129
  37. package/dist/chat/composer/use-auto-grow.js +8 -23
  38. package/dist/chat/files/files.js +66 -291
  39. package/dist/chat/reply/fenced-code.js +10 -32
  40. package/dist/chat/reply/markdown-components.js +2 -2
  41. package/dist/chat/reply/reply.js +24 -99
  42. package/dist/chat/turn/turn.js +46 -197
  43. package/dist/cost/context.js +65 -282
  44. package/dist/cost/cost-steps.js +42 -195
  45. package/dist/cost/cost.js +108 -497
  46. package/dist/cost/model-picker.js +42 -172
  47. package/dist/cost/shared/context-breakdown.js +65 -281
  48. package/dist/cost/shared/meter-marks.js +34 -92
  49. package/dist/cost/shared/model-option-row.js +35 -158
  50. package/dist/cost/shared/step-cost-row.js +37 -222
  51. package/dist/memory/cite.js +58 -179
  52. package/dist/memory/memorized.js +43 -195
  53. package/dist/memory/recall.js +68 -263
  54. package/dist/memory/shared/disclosure.d.ts +2 -2
  55. package/dist/memory/shared/disclosure.js +1 -1
  56. package/dist/memory/shared/source-mark.js +10 -38
  57. package/dist/memory/sources.js +52 -230
  58. package/dist/shared/decision-summary.js +35 -117
  59. package/dist/shared/panel-empty.js +15 -73
  60. package/dist/shared/panel.js +65 -239
  61. package/dist/shared/status-dot.js +10 -32
  62. package/dist/thread/actions/action-button.js +10 -53
  63. package/dist/thread/actions/branch-switcher.js +21 -95
  64. package/dist/thread/canvas/canvas.js +1 -1
  65. package/dist/thread/canvas/version-switcher.js +31 -126
  66. package/dist/thread/code/code.js +2 -2
  67. package/dist/thread/code/copy-code-button.js +24 -56
  68. package/dist/thread/history/history.js +1 -1
  69. package/dist/thread/history/row/history-row.js +18 -97
  70. package/dist/thread/history/row/thread-item-menu.js +19 -72
  71. package/dist/thread/history/row/thread-title-editor.js +29 -72
  72. package/dist/thread/history/virtual-history-list.js +46 -82
  73. package/dist/thread/starters/starters.js +27 -87
  74. package/dist/thread/use-copied.js +10 -38
  75. 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(t0) {
7
- const $ = _c(26);
8
- const {
9
- versions,
10
- current,
11
- onVersionChange
12
- } = t0;
13
- let t1;
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
- $[2] = versions.length;
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: t4
50
- });
51
- $[6] = current.createdAt;
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
- const t7 = `Version ${current.label}, choose another version`;
75
- let t8;
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": t7,
92
- children: [label, t8]
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: t10,
42
+ value: current.id,
117
43
  onValueChange: onVersionChange,
118
- children: t11
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
- }, version.id);
56
+ });
152
57
  }
@@ -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(t0) {
7
- const $ = _c(10);
8
- const {
9
- code,
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
- let t1;
17
- if ($[0] !== code || $[1] !== markCopied || $[2] !== onCopy) {
18
- t1 = async () => {
19
- if (onCopy) {
20
- onCopy(code);
21
- markCopied();
22
- return;
23
- }
24
- if (await writeToClipboard(code)) {
25
- markCopied();
26
- }
27
- };
28
- $[0] = code;
29
- $[1] = markCopied;
30
- $[2] = onCopy;
31
- $[3] = t1;
32
- } else {
33
- t1 = $[3];
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
- $[4] = copied;
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(t0) {
10
- const $ = _c(33);
11
- let active;
12
- let className;
13
- let onArchive;
14
- let onRename;
15
- let onSelect;
16
- let props;
17
- let thread;
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
- const t1 = active || undefined;
48
- 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";
49
- let t3;
50
- if ($[8] !== className || $[9] !== t2) {
51
- t3 = cn("group relative flex items-center motion-safe:transition-colors", t2, className);
52
- $[8] = className;
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
- $[20] = editing;
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(t0) {
6
- const $ = _c(13);
7
- const {
8
- title,
9
- onRename,
10
- onArchive
11
- } = t0;
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": t1,
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: t2
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: [t4, t5]
65
- });
66
- $[7] = t4;
67
- $[8] = t5;
68
- $[9] = t6;
69
- } else {
70
- t6 = $[9];
71
- }
72
- let t7;
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(t0) {
6
- const $ = _c(13);
7
- const {
8
- title,
9
- onCommit,
10
- onCancel
11
- } = t0;
4
+ export function ThreadTitleEditor({
5
+ title,
6
+ onCommit,
7
+ onCancel
8
+ }) {
12
9
  const [draft, setDraft] = useState(title);
13
- let t1;
14
- if ($[0] !== draft || $[1] !== onCancel || $[2] !== onCommit || $[3] !== title) {
15
- t1 = () => {
16
- const trimmed = draft.trim();
17
- if (trimmed && trimmed !== title) {
18
- onCommit(trimmed);
19
- } else {
20
- onCancel();
21
- }
22
- };
23
- $[0] = draft;
24
- $[1] = onCancel;
25
- $[2] = onCommit;
26
- $[3] = title;
27
- $[4] = t1;
28
- } else {
29
- t1 = $[4];
30
- }
31
- const commit = t1;
32
- let t2;
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 (event_1.key === "Escape") {
47
- event_1.preventDefault();
32
+ if (event.key === "Escape") {
33
+ event.preventDefault();
48
34
  onCancel();
49
35
  }
50
- };
51
- $[6] = commit;
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
  }