@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.
Files changed (130) hide show
  1. package/dist/agent/index.d.ts +1 -1
  2. package/dist/agent/pulse/gradient-label.js +70 -17
  3. package/dist/agent/pulse/marks/bars-mark.js +39 -15
  4. package/dist/agent/pulse/marks/glyph-mark.js +57 -16
  5. package/dist/agent/pulse/marks/locus-mark.js +39 -13
  6. package/dist/agent/pulse/marks/orb-mark.js +21 -9
  7. package/dist/agent/pulse/pulse.js +1 -1
  8. package/dist/agent/pulse/use-loop-animation.d.ts +0 -1
  9. package/dist/agent/pulse/use-loop-animation.js +36 -15
  10. package/dist/agent/steps/step-icon.js +20 -13
  11. package/dist/agent/steps/steps.js +39 -37
  12. package/dist/agent/thinking/thinking.js +65 -62
  13. package/dist/agent/tool/json-block.js +10 -7
  14. package/dist/agent/tool/tool-status.d.ts +2 -0
  15. package/dist/agent/tool/tool-status.js +16 -13
  16. package/dist/agent/tool/tool.d.ts +8 -1
  17. package/dist/agent/tool/tool.js +238 -119
  18. package/dist/approval/inbox/inbox-row.d.ts +3 -3
  19. package/dist/approval/inbox/inbox-row.js +248 -86
  20. package/dist/approval/inbox/inbox.d.ts +3 -3
  21. package/dist/approval/inbox/inbox.js +251 -57
  22. package/dist/approval/inbox/virtual-inbox-list.d.ts +3 -3
  23. package/dist/approval/inbox/virtual-inbox-list.js +107 -30
  24. package/dist/approval/memory/memory-review.js +228 -91
  25. package/dist/approval/memory/memory-row.js +192 -56
  26. package/dist/approval/plan/plan-review.js +241 -108
  27. package/dist/approval/plan/plan-step-row.js +184 -77
  28. package/dist/approval/plan/plan-steps.d.ts +1 -1
  29. package/dist/approval/plan/plan-steps.js +2 -2
  30. package/dist/approval/plan/question-choices.js +139 -48
  31. package/dist/approval/plan/question.js +189 -67
  32. package/dist/approval/run/run-bar.js +138 -49
  33. package/dist/approval/shared/approval-line.d.ts +27 -0
  34. package/dist/approval/shared/approval-line.js +85 -0
  35. package/dist/approval/shared/risk-badge.d.ts +3 -5
  36. package/dist/approval/shared/risk-badge.js +11 -19
  37. package/dist/approval/shared/time.d.ts +0 -1
  38. package/dist/approval/shared/time.js +0 -1
  39. package/dist/approval/shared/use-focus-on-mount.js +23 -5
  40. package/dist/approval/shared/use-focus-when-settled.d.ts +2 -0
  41. package/dist/approval/shared/use-focus-when-settled.js +18 -0
  42. package/dist/approval/spend/raise-cap-form.d.ts +2 -2
  43. package/dist/approval/spend/raise-cap-form.js +235 -52
  44. package/dist/approval/spend/spend-gate.js +200 -106
  45. package/dist/approval/spend/spend-math.d.ts +1 -0
  46. package/dist/approval/spend/spend-math.js +5 -2
  47. package/dist/approval/spend/spend-meter.js +5 -5
  48. package/dist/approval/tool/approval.js +157 -96
  49. package/dist/approval/tool/args/args-editor.js +232 -81
  50. package/dist/approval/tool/args/args-field.js +333 -60
  51. package/dist/approval/tool/deny-form.js +114 -32
  52. package/dist/approval/tool/tool-inputs.js +93 -33
  53. package/dist/chat/chat/chat.js +5 -4
  54. package/dist/chat/chat/use-stick-to-bottom.js +116 -63
  55. package/dist/chat/chat/virtual-chat-items.js +129 -34
  56. package/dist/chat/composer/composer-actions.d.ts +1 -2
  57. package/dist/chat/composer/composer-actions.js +136 -50
  58. package/dist/chat/composer/composer-status.d.ts +2 -0
  59. package/dist/chat/composer/composer-status.js +3 -0
  60. package/dist/chat/composer/composer.d.ts +1 -1
  61. package/dist/chat/composer/composer.js +6 -4
  62. package/dist/chat/composer/use-auto-grow.js +29 -8
  63. package/dist/chat/files/files.js +296 -67
  64. package/dist/chat/index.d.ts +1 -1
  65. package/dist/chat/index.js +1 -1
  66. package/dist/chat/reply/fenced-code.js +1 -1
  67. package/dist/chat/reply/markdown-components.js +9 -116
  68. package/dist/chat/reply/reply.js +2 -2
  69. package/dist/chat/turn/group-parts.d.ts +1 -0
  70. package/dist/chat/turn/group-parts.js +6 -3
  71. package/dist/chat/turn/turn.js +13 -4
  72. package/dist/cost/context.js +3 -3
  73. package/dist/cost/cost-steps.js +31 -30
  74. package/dist/cost/cost.js +39 -39
  75. package/dist/cost/model-picker.js +176 -43
  76. package/dist/cost/shared/context-breakdown.js +10 -11
  77. package/dist/cost/shared/model-option-row.js +4 -3
  78. package/dist/cost/shared/step-cost-row.js +11 -12
  79. package/dist/cost/shared/usage-totals.d.ts +1 -0
  80. package/dist/cost/shared/usage-totals.js +19 -1
  81. package/dist/memory/cite.js +190 -59
  82. package/dist/memory/memorized.js +231 -62
  83. package/dist/memory/recall.js +272 -85
  84. package/dist/memory/shared/host-label.d.ts +1 -1
  85. package/dist/memory/shared/host-label.js +2 -2
  86. package/dist/memory/shared/source-mark.js +1 -1
  87. package/dist/memory/sources.d.ts +2 -1
  88. package/dist/memory/sources.js +277 -62
  89. package/dist/shared/decision-summary.js +2 -1
  90. package/dist/shared/line.d.ts +10 -0
  91. package/dist/shared/line.js +11 -0
  92. package/dist/shared/live-status.d.ts +3 -0
  93. package/dist/shared/live-status.js +11 -0
  94. package/dist/shared/reduced-motion.d.ts +1 -0
  95. package/dist/shared/reduced-motion.js +3 -0
  96. package/dist/shared/virtual/use-list-virtualizer.js +2 -0
  97. package/dist/thread/actions/action-button.js +1 -1
  98. package/dist/thread/actions/actions.d.ts +3 -1
  99. package/dist/thread/actions/actions.js +100 -81
  100. package/dist/thread/actions/branch-switcher.js +129 -23
  101. package/dist/thread/canvas/canvas-meta.d.ts +9 -0
  102. package/dist/thread/canvas/canvas-meta.js +35 -0
  103. package/dist/thread/canvas/canvas.d.ts +1 -1
  104. package/dist/thread/canvas/canvas.js +64 -74
  105. package/dist/thread/canvas/version-switcher.d.ts +1 -0
  106. package/dist/thread/canvas/version-switcher.js +161 -45
  107. package/dist/thread/code/code.js +4 -6
  108. package/dist/thread/code/copy-code-button.d.ts +2 -1
  109. package/dist/thread/code/copy-code-button.js +91 -26
  110. package/dist/thread/history/history.d.ts +1 -1
  111. package/dist/thread/history/history.js +104 -104
  112. package/dist/thread/history/row/history-row.js +106 -22
  113. package/dist/thread/history/row/thread-item-menu.js +84 -20
  114. package/dist/thread/history/row/thread-title-editor.js +74 -29
  115. package/dist/thread/history/virtual-history-list.js +83 -46
  116. package/dist/thread/index.d.ts +1 -0
  117. package/dist/thread/index.js +1 -0
  118. package/dist/thread/starters/starters.js +91 -28
  119. package/dist/thread/use-copied.js +40 -10
  120. package/package.json +6 -6
  121. package/dist/agent/shared/status-dot.d.ts +0 -1
  122. package/dist/agent/shared/status-dot.js +0 -1
  123. package/dist/approval/shared/decision-line.d.ts +0 -1
  124. package/dist/approval/shared/decision-line.js +0 -1
  125. package/dist/memory/shared/disclosure.d.ts +0 -6
  126. package/dist/memory/shared/disclosure.js +0 -6
  127. package/dist/shared/panel.d.ts +0 -19
  128. package/dist/shared/panel.js +0 -77
  129. package/dist/shared/status-dot.d.ts +0 -6
  130. package/dist/shared/status-dot.js +0 -20
@@ -1,15 +1,15 @@
1
1
  "use client";
2
2
 
3
3
  import { c as _c } from "react/compiler-runtime";
4
- import { Close as XIcon } from "@carbon/icons-react";
5
4
  import { Button, cn, ScrollArea } from "@locusgraph/components";
6
- import { VersionSwitcher } from "./version-switcher.js";
5
+ import { X as XIcon } from "@phosphor-icons/react/ssr";
6
+ import { CanvasMeta } from "./canvas-meta.js";
7
7
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
8
8
  function currentVersionOf(versions, versionId) {
9
9
  return versions.find(version => version.id === versionId) ?? versions.at(-1);
10
10
  }
11
11
  export function Canvas(t0) {
12
- const $ = _c(46);
12
+ const $ = _c(44);
13
13
  let actions;
14
14
  let children;
15
15
  let className;
@@ -77,136 +77,126 @@ export function Canvas(t0) {
77
77
  const current = t3;
78
78
  let t4;
79
79
  if ($[16] !== className) {
80
- t4 = cn("flex h-full min-h-0 min-w-0 flex-col bg-card text-card-foreground ring-1 ring-border", className);
80
+ t4 = cn("flex h-full min-h-0 min-w-0 flex-col bg-muted/40 text-foreground", className);
81
81
  $[16] = className;
82
82
  $[17] = t4;
83
83
  } else {
84
84
  t4 = $[17];
85
85
  }
86
86
  let t5;
87
- if ($[18] !== kind) {
88
- t5 = kind && /*#__PURE__*/_jsx("span", {
89
- className: "locus-eyebrow",
90
- children: kind
87
+ if ($[18] !== title) {
88
+ t5 = /*#__PURE__*/_jsx("h2", {
89
+ className: "truncate text-base leading-snug font-semibold tracking-tight",
90
+ children: title
91
91
  });
92
- $[18] = kind;
92
+ $[18] = title;
93
93
  $[19] = t5;
94
94
  } else {
95
95
  t5 = $[19];
96
96
  }
97
97
  let t6;
98
- if ($[20] !== title) {
99
- t6 = /*#__PURE__*/_jsx("h2", {
100
- className: "truncate font-sans text-base leading-snug font-semibold tracking-tight",
101
- children: title
98
+ if ($[20] !== current || $[21] !== kind || $[22] !== onVersionChange || $[23] !== versions) {
99
+ t6 = /*#__PURE__*/_jsx(CanvasMeta, {
100
+ kind: kind,
101
+ versions: versions,
102
+ current: current,
103
+ onVersionChange: onVersionChange
102
104
  });
103
- $[20] = title;
104
- $[21] = t6;
105
+ $[20] = current;
106
+ $[21] = kind;
107
+ $[22] = onVersionChange;
108
+ $[23] = versions;
109
+ $[24] = t6;
105
110
  } else {
106
- t6 = $[21];
111
+ t6 = $[24];
107
112
  }
108
113
  let t7;
109
- if ($[22] !== t5 || $[23] !== t6) {
114
+ if ($[25] !== t5 || $[26] !== t6) {
110
115
  t7 = /*#__PURE__*/_jsxs("div", {
111
- className: "flex min-w-0 flex-1 flex-col gap-1",
116
+ className: "flex min-w-0 flex-1 flex-col gap-0.5",
112
117
  children: [t5, t6]
113
118
  });
114
- $[22] = t5;
115
- $[23] = t6;
116
- $[24] = t7;
119
+ $[25] = t5;
120
+ $[26] = t6;
121
+ $[27] = t7;
117
122
  } else {
118
- t7 = $[24];
123
+ t7 = $[27];
119
124
  }
120
125
  let t8;
121
- if ($[25] !== onClose) {
126
+ if ($[28] !== onClose) {
122
127
  t8 = onClose && /*#__PURE__*/_jsx(Button, {
123
128
  type: "button",
124
129
  variant: "ghost",
125
130
  size: "icon-sm",
126
131
  "aria-label": "Close panel",
127
- className: "text-muted-foreground hover:text-foreground",
132
+ className: "text-faint hover:bg-transparent hover:text-interactive",
128
133
  onClick: onClose,
129
- children: /*#__PURE__*/_jsx(XIcon, {})
134
+ children: /*#__PURE__*/_jsx(XIcon, {
135
+ weight: "bold",
136
+ "aria-hidden": true
137
+ })
130
138
  });
131
- $[25] = onClose;
132
- $[26] = t8;
139
+ $[28] = onClose;
140
+ $[29] = t8;
133
141
  } else {
134
- t8 = $[26];
142
+ t8 = $[29];
135
143
  }
136
144
  let t9;
137
- if ($[27] !== actions || $[28] !== t8) {
145
+ if ($[30] !== actions || $[31] !== t8) {
138
146
  t9 = /*#__PURE__*/_jsxs("div", {
139
- className: "-mr-2 flex shrink-0 items-center gap-0.5 text-muted-foreground",
147
+ className: "-mr-2 flex shrink-0 items-center gap-0.5 text-faint [&_button:hover]:text-interactive",
140
148
  children: [actions, t8]
141
149
  });
142
- $[27] = actions;
143
- $[28] = t8;
144
- $[29] = t9;
150
+ $[30] = actions;
151
+ $[31] = t8;
152
+ $[32] = t9;
145
153
  } else {
146
- t9 = $[29];
154
+ t9 = $[32];
147
155
  }
148
156
  let t10;
149
- if ($[30] !== t7 || $[31] !== t9) {
157
+ if ($[33] !== t7 || $[34] !== t9) {
150
158
  t10 = /*#__PURE__*/_jsxs("header", {
151
- className: "flex items-start gap-3 border-b px-5 pt-3.5 pb-3",
159
+ className: "flex items-start gap-3 px-6 pt-4 pb-3",
152
160
  children: [t7, t9]
153
161
  });
154
- $[30] = t7;
155
- $[31] = t9;
156
- $[32] = t10;
162
+ $[33] = t7;
163
+ $[34] = t9;
164
+ $[35] = t10;
157
165
  } else {
158
- t10 = $[32];
166
+ t10 = $[35];
159
167
  }
160
168
  let t11;
161
- if ($[33] !== children) {
169
+ if ($[36] !== children) {
162
170
  t11 = /*#__PURE__*/_jsx(ScrollArea, {
163
171
  className: "min-h-0 flex-1",
164
172
  children: /*#__PURE__*/_jsx("div", {
165
173
  "data-slot": "canvas-content",
166
- className: "px-5 py-4 has-[>[data-slot=code]:only-child]:p-0 [&>[data-slot=code]:only-child]:ring-0",
174
+ className: "px-6 pt-1 pb-6 [&>[data-slot=code]:only-child]:bg-transparent [&>[data-slot=code]:only-child>figcaption]:hidden [&>[data-slot=code]:only-child_[data-slot=code-area]]:p-0",
167
175
  children: children
168
176
  })
169
177
  });
170
- $[33] = children;
171
- $[34] = t11;
178
+ $[36] = children;
179
+ $[37] = t11;
172
180
  } else {
173
- t11 = $[34];
181
+ t11 = $[37];
174
182
  }
175
183
  let t12;
176
- if ($[35] !== current || $[36] !== onVersionChange || $[37] !== versions) {
177
- t12 = current && /*#__PURE__*/_jsx("footer", {
178
- className: "flex h-10 items-center gap-2 border-t bg-muted/30 pr-3 pl-5",
179
- children: /*#__PURE__*/_jsx(VersionSwitcher, {
180
- versions: versions,
181
- current: current,
182
- onVersionChange: onVersionChange
183
- })
184
- });
185
- $[35] = current;
186
- $[36] = onVersionChange;
187
- $[37] = versions;
188
- $[38] = t12;
189
- } else {
190
- t12 = $[38];
191
- }
192
- let t13;
193
- if ($[39] !== props || $[40] !== t10 || $[41] !== t11 || $[42] !== t12 || $[43] !== t4 || $[44] !== title) {
194
- t13 = /*#__PURE__*/_jsxs("aside", {
184
+ if ($[38] !== props || $[39] !== t10 || $[40] !== t11 || $[41] !== t4 || $[42] !== title) {
185
+ t12 = /*#__PURE__*/_jsxs("aside", {
195
186
  "data-slot": "canvas",
196
187
  "aria-label": title,
197
188
  className: t4,
198
189
  ...props,
199
- children: [t10, t11, t12]
190
+ children: [t10, t11]
200
191
  });
201
- $[39] = props;
202
- $[40] = t10;
203
- $[41] = t11;
204
- $[42] = t12;
205
- $[43] = t4;
206
- $[44] = title;
207
- $[45] = t13;
192
+ $[38] = props;
193
+ $[39] = t10;
194
+ $[40] = t11;
195
+ $[41] = t4;
196
+ $[42] = title;
197
+ $[43] = t12;
208
198
  } else {
209
- t13 = $[45];
199
+ t12 = $[43];
210
200
  }
211
- return t13;
201
+ return t12;
212
202
  }
@@ -8,5 +8,6 @@ type VersionSwitcherProps = {
8
8
  current: CanvasVersion;
9
9
  onVersionChange?: (id: string) => void;
10
10
  };
11
+ export declare const metaLinkClass = "inline-flex items-center gap-1 locus-focus-ring transition-colors duration-150 hover:text-interactive motion-reduce:transition-none";
11
12
  export declare function VersionSwitcher({ versions, current, onVersionChange }: VersionSwitcherProps): import("react").JSX.Element;
12
13
  export {};
@@ -1,57 +1,173 @@
1
- import { ChevronDown as ChevronDownIcon } from "@carbon/icons-react";
2
- import { Button, DropdownMenu, DropdownMenuContent, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuTrigger } from "@locusgraph/components";
1
+ "use client";
2
+
3
+ import { c as _c } from "react/compiler-runtime";
4
+ import { DropdownMenu, DropdownMenuContent, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuTrigger } from "@locusgraph/components";
3
5
  import { formatDate } from "@locusgraph/utils";
6
+ import { CaretDown as ChevronDownIcon } from "@phosphor-icons/react/ssr";
4
7
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
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", {
8
+ export const metaLinkClass = "inline-flex items-center gap-1 locus-focus-ring transition-colors duration-150 hover:text-interactive motion-reduce:transition-none";
9
+ function VersionLabel(t0) {
10
+ const $ = _c(11);
11
+ const {
12
+ versions,
13
+ current
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
- }), versions.length > 1 && /*#__PURE__*/_jsxs("span", {
16
- className: "text-muted-foreground",
17
- children: ["of ", versions.length]
18
- }), /*#__PURE__*/_jsx("time", {
19
- dateTime: current.createdAt,
20
- className: "text-muted-foreground",
21
- children: formatDate(current.createdAt)
22
- })]
23
- });
20
+ });
21
+ $[0] = current.label;
22
+ $[1] = t1;
23
+ } else {
24
+ t1 = $[1];
25
+ }
26
+ const t2 = versions.length > 1 && ` of ${versions.length}`;
27
+ const t3 = current.createdAt;
28
+ let t4;
29
+ if ($[2] !== current.createdAt) {
30
+ t4 = formatDate(current.createdAt);
31
+ $[2] = current.createdAt;
32
+ $[3] = t4;
33
+ } else {
34
+ t4 = $[3];
35
+ }
36
+ let t5;
37
+ if ($[4] !== current.createdAt || $[5] !== t4) {
38
+ t5 = /*#__PURE__*/_jsx("time", {
39
+ dateTime: t3,
40
+ children: t4
41
+ });
42
+ $[4] = current.createdAt;
43
+ $[5] = t4;
44
+ $[6] = t5;
45
+ } else {
46
+ t5 = $[6];
47
+ }
48
+ let t6;
49
+ if ($[7] !== t1 || $[8] !== t2 || $[9] !== t5) {
50
+ t6 = /*#__PURE__*/_jsxs("span", {
51
+ className: "tabular-nums",
52
+ children: [t1, t2, " \xB7 ", t5]
53
+ });
54
+ $[7] = t1;
55
+ $[8] = t2;
56
+ $[9] = t5;
57
+ $[10] = t6;
58
+ } else {
59
+ t6 = $[10];
60
+ }
61
+ return t6;
62
+ }
63
+ export function VersionSwitcher(t0) {
64
+ const $ = _c(19);
65
+ const {
66
+ versions,
67
+ current,
68
+ onVersionChange
69
+ } = t0;
24
70
  if (versions.length < 2 || !onVersionChange) {
25
- return label;
26
- }
27
- return /*#__PURE__*/_jsxs(DropdownMenu, {
28
- children: [/*#__PURE__*/_jsx(DropdownMenuTrigger, {
29
- asChild: true,
30
- children: /*#__PURE__*/_jsxs(Button, {
31
- type: "button",
32
- variant: "ghost",
33
- size: "xs",
34
- className: "-ml-2 font-normal",
35
- "aria-label": `Version ${current.label}, choose another version`,
36
- children: [label, /*#__PURE__*/_jsx(ChevronDownIcon, {})]
37
- })
38
- }), /*#__PURE__*/_jsx(DropdownMenuContent, {
71
+ let t1;
72
+ if ($[0] !== current || $[1] !== versions) {
73
+ t1 = /*#__PURE__*/_jsx(VersionLabel, {
74
+ versions: versions,
75
+ current: current
76
+ });
77
+ $[0] = current;
78
+ $[1] = versions;
79
+ $[2] = t1;
80
+ } else {
81
+ t1 = $[2];
82
+ }
83
+ return t1;
84
+ }
85
+ const t1 = `Version ${current.label}, choose another version`;
86
+ let t2;
87
+ if ($[3] !== current || $[4] !== versions) {
88
+ t2 = /*#__PURE__*/_jsx(VersionLabel, {
89
+ versions: versions,
90
+ current: current
91
+ });
92
+ $[3] = current;
93
+ $[4] = versions;
94
+ $[5] = t2;
95
+ } else {
96
+ t2 = $[5];
97
+ }
98
+ let t3;
99
+ if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
100
+ t3 = /*#__PURE__*/_jsx(ChevronDownIcon, {
101
+ weight: "bold",
102
+ "aria-hidden": true,
103
+ className: "size-3"
104
+ });
105
+ $[6] = t3;
106
+ } else {
107
+ t3 = $[6];
108
+ }
109
+ let t4;
110
+ if ($[7] !== t1 || $[8] !== t2) {
111
+ t4 = /*#__PURE__*/_jsxs(DropdownMenuTrigger, {
112
+ className: metaLinkClass,
113
+ "aria-label": t1,
114
+ children: [t2, t3]
115
+ });
116
+ $[7] = t1;
117
+ $[8] = t2;
118
+ $[9] = t4;
119
+ } else {
120
+ t4 = $[9];
121
+ }
122
+ const t5 = current.id;
123
+ let t6;
124
+ if ($[10] !== versions) {
125
+ t6 = versions.map(_temp);
126
+ $[10] = versions;
127
+ $[11] = t6;
128
+ } else {
129
+ t6 = $[11];
130
+ }
131
+ let t7;
132
+ if ($[12] !== current.id || $[13] !== onVersionChange || $[14] !== t6) {
133
+ t7 = /*#__PURE__*/_jsx(DropdownMenuContent, {
39
134
  align: "start",
40
135
  sideOffset: 6,
41
136
  children: /*#__PURE__*/_jsx(DropdownMenuRadioGroup, {
42
- value: current.id,
137
+ value: t5,
43
138
  onValueChange: onVersionChange,
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))
139
+ children: t6
54
140
  })
141
+ });
142
+ $[12] = current.id;
143
+ $[13] = onVersionChange;
144
+ $[14] = t6;
145
+ $[15] = t7;
146
+ } else {
147
+ t7 = $[15];
148
+ }
149
+ let t8;
150
+ if ($[16] !== t4 || $[17] !== t7) {
151
+ t8 = /*#__PURE__*/_jsxs(DropdownMenu, {
152
+ children: [t4, t7]
153
+ });
154
+ $[16] = t4;
155
+ $[17] = t7;
156
+ $[18] = t8;
157
+ } else {
158
+ t8 = $[18];
159
+ }
160
+ return t8;
161
+ }
162
+ function _temp(version) {
163
+ return /*#__PURE__*/_jsxs(DropdownMenuRadioItem, {
164
+ value: version.id,
165
+ children: [/*#__PURE__*/_jsx("span", {
166
+ className: "text-sm tabular-nums",
167
+ children: version.label
168
+ }), /*#__PURE__*/_jsx("span", {
169
+ className: "ml-auto pl-4 text-xs text-muted-foreground tabular-nums",
170
+ children: formatDate(version.createdAt)
55
171
  })]
56
- });
172
+ }, version.id);
57
173
  }
@@ -6,7 +6,7 @@ import { useEffect, useState } from "react";
6
6
  import { CopyCodeButton } from "./copy-code-button.js";
7
7
  import { highlightToHtml } from "./highlight.js";
8
8
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
9
- const codeAreaClass = cn("overflow-x-auto bg-muted/40 px-4 py-3 font-mono text-xs leading-relaxed", "[&_pre]:bg-transparent! [&_pre]:outline-none", "[&_.shiki_span]:text-(--shiki-light) dark:[&_.shiki_span]:text-(--shiki-dark)");
9
+ const codeAreaClass = cn("overflow-x-auto px-4 pb-3 font-mono text-xs leading-relaxed", "[&_pre]:bg-transparent! [&_pre]:outline-none has-[pre:focus-visible]:outline-2 has-[pre:focus-visible]:-outline-offset-2 has-[pre:focus-visible]:outline-ring/70", "[&_.shiki_span]:text-(--shiki-light) dark:[&_.shiki_span]:text-(--shiki-dark)");
10
10
  function useHighlightedHtml(code, language) {
11
11
  const $ = _c(4);
12
12
  const [html, setHtml] = useState(null);
@@ -82,7 +82,7 @@ export function Code(t0) {
82
82
  const html = useHighlightedHtml(code, language);
83
83
  let t3;
84
84
  if ($[8] !== className) {
85
- t3 = cn("min-w-0 bg-card text-card-foreground ring-1 ring-border", className);
85
+ t3 = cn("min-w-0 bg-muted/40 text-foreground", className);
86
86
  $[8] = className;
87
87
  $[9] = t3;
88
88
  } else {
@@ -91,10 +91,9 @@ export function Code(t0) {
91
91
  let t4;
92
92
  if ($[10] !== filename || $[11] !== language) {
93
93
  t4 = filename ? /*#__PURE__*/_jsx("span", {
94
- className: "min-w-0 truncate font-mono text-xs text-foreground",
94
+ className: "min-w-0 truncate font-medium text-muted-foreground",
95
95
  children: filename
96
96
  }) : /*#__PURE__*/_jsx("span", {
97
- className: "locus-eyebrow",
98
97
  children: language
99
98
  });
100
99
  $[10] = filename;
@@ -106,7 +105,6 @@ export function Code(t0) {
106
105
  let t5;
107
106
  if ($[13] !== filename || $[14] !== language) {
108
107
  t5 = filename && /*#__PURE__*/_jsx("span", {
109
- className: "locus-eyebrow",
110
108
  children: language
111
109
  });
112
110
  $[13] = filename;
@@ -143,7 +141,7 @@ export function Code(t0) {
143
141
  let t8;
144
142
  if ($[23] !== t4 || $[24] !== t7) {
145
143
  t8 = /*#__PURE__*/_jsxs("figcaption", {
146
- className: "flex h-8 items-center justify-between gap-2 border-b pr-1 pl-3",
144
+ className: "flex h-control items-center justify-between gap-2 pr-1.5 pl-4 text-xs text-faint",
147
145
  children: [t4, t7]
148
146
  });
149
147
  $[23] = t4;
@@ -1,6 +1,7 @@
1
1
  type CopyCodeButtonProps = {
2
2
  code: string;
3
3
  onCopy?: (code: string) => void;
4
+ size?: "icon-xs" | "icon-sm";
4
5
  };
5
- export declare function CopyCodeButton({ code, onCopy }: CopyCodeButtonProps): import("react").JSX.Element;
6
+ export declare function CopyCodeButton({ code, onCopy, size }: CopyCodeButtonProps): import("react").JSX.Element;
6
7
  export {};
@@ -1,34 +1,99 @@
1
- import { Checkmark as CheckIcon, Copy as CopyIcon } from "@carbon/icons-react";
1
+ "use client";
2
+
3
+ import { c as _c } from "react/compiler-runtime";
2
4
  import { Button } from "@locusgraph/components";
5
+ import { Check as CheckIcon, Copy as CopyIcon } from "@phosphor-icons/react/ssr";
6
+ import { LiveStatus } from "../../shared/live-status.js";
3
7
  import { useCopied, writeToClipboard } from "../use-copied.js";
4
- import { jsx as _jsx } from "react/jsx-runtime";
5
- export function CopyCodeButton({
6
- code,
7
- onCopy
8
- }) {
8
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
9
+ export function CopyCodeButton(t0) {
10
+ const $ = _c(16);
11
+ const {
12
+ code,
13
+ onCopy,
14
+ size: t1
15
+ } = t0;
16
+ const size = t1 === undefined ? "icon-xs" : t1;
9
17
  const {
10
18
  copied,
11
19
  markCopied
12
20
  } = useCopied();
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, {
21
+ let t2;
22
+ if ($[0] !== code || $[1] !== markCopied || $[2] !== onCopy) {
23
+ t2 = async () => {
24
+ if (onCopy) {
25
+ onCopy(code);
26
+ markCopied();
27
+ return;
28
+ }
29
+ if (await writeToClipboard(code)) {
30
+ markCopied();
31
+ }
32
+ };
33
+ $[0] = code;
34
+ $[1] = markCopied;
35
+ $[2] = onCopy;
36
+ $[3] = t2;
37
+ } else {
38
+ t2 = $[3];
39
+ }
40
+ const copy = t2;
41
+ const t3 = copied ? "Copied" : "Copy code";
42
+ let t4;
43
+ if ($[4] !== copied) {
44
+ t4 = copied ? /*#__PURE__*/_jsx(CheckIcon, {
45
+ weight: "bold",
46
+ "aria-hidden": true,
31
47
  className: "text-good"
32
- }) : /*#__PURE__*/_jsx(CopyIcon, {})
33
- });
48
+ }) : /*#__PURE__*/_jsx(CopyIcon, {
49
+ weight: "bold",
50
+ "aria-hidden": true
51
+ });
52
+ $[4] = copied;
53
+ $[5] = t4;
54
+ } else {
55
+ t4 = $[5];
56
+ }
57
+ let t5;
58
+ if ($[6] !== copy || $[7] !== size || $[8] !== t3 || $[9] !== t4) {
59
+ t5 = /*#__PURE__*/_jsx(Button, {
60
+ type: "button",
61
+ variant: "ghost",
62
+ size: size,
63
+ "aria-label": t3,
64
+ className: "text-faint hover:bg-transparent hover:text-interactive",
65
+ onClick: copy,
66
+ children: t4
67
+ });
68
+ $[6] = copy;
69
+ $[7] = size;
70
+ $[8] = t3;
71
+ $[9] = t4;
72
+ $[10] = t5;
73
+ } else {
74
+ t5 = $[10];
75
+ }
76
+ const t6 = copied ? "Code copied" : "";
77
+ let t7;
78
+ if ($[11] !== t6) {
79
+ t7 = /*#__PURE__*/_jsx(LiveStatus, {
80
+ message: t6
81
+ });
82
+ $[11] = t6;
83
+ $[12] = t7;
84
+ } else {
85
+ t7 = $[12];
86
+ }
87
+ let t8;
88
+ if ($[13] !== t5 || $[14] !== t7) {
89
+ t8 = /*#__PURE__*/_jsxs(_Fragment, {
90
+ children: [t5, t7]
91
+ });
92
+ $[13] = t5;
93
+ $[14] = t7;
94
+ $[15] = t8;
95
+ } else {
96
+ t8 = $[15];
97
+ }
98
+ return t8;
34
99
  }
@@ -1,4 +1,4 @@
1
- import type { ComponentProps } from "react";
1
+ import { type ComponentProps } from "react";
2
2
  import { type HistoryItem } from "./row/history-row.js";
3
3
  type HistoryProps = Omit<ComponentProps<"nav">, "onSelect"> & {
4
4
  threads: HistoryItem[];