@locusgraph/loop 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent/index.d.ts +1 -1
- package/dist/agent/pulse/gradient-label.js +70 -17
- package/dist/agent/pulse/marks/bars-mark.js +39 -15
- package/dist/agent/pulse/marks/glyph-mark.js +57 -16
- package/dist/agent/pulse/marks/locus-mark.js +39 -13
- package/dist/agent/pulse/marks/orb-mark.js +21 -9
- package/dist/agent/pulse/pulse.js +1 -1
- package/dist/agent/pulse/use-loop-animation.d.ts +0 -1
- package/dist/agent/pulse/use-loop-animation.js +36 -15
- package/dist/agent/steps/step-icon.js +20 -13
- package/dist/agent/steps/steps.js +39 -37
- package/dist/agent/thinking/thinking.js +65 -62
- package/dist/agent/tool/json-block.js +10 -7
- package/dist/agent/tool/tool-status.d.ts +2 -0
- package/dist/agent/tool/tool-status.js +16 -13
- package/dist/agent/tool/tool.d.ts +8 -1
- package/dist/agent/tool/tool.js +238 -119
- package/dist/approval/inbox/inbox-row.d.ts +3 -3
- package/dist/approval/inbox/inbox-row.js +248 -86
- package/dist/approval/inbox/inbox.d.ts +3 -3
- package/dist/approval/inbox/inbox.js +251 -57
- package/dist/approval/inbox/virtual-inbox-list.d.ts +3 -3
- package/dist/approval/inbox/virtual-inbox-list.js +107 -30
- package/dist/approval/memory/memory-review.js +228 -91
- package/dist/approval/memory/memory-row.js +192 -56
- package/dist/approval/plan/plan-review.js +241 -108
- package/dist/approval/plan/plan-step-row.js +184 -77
- package/dist/approval/plan/plan-steps.d.ts +1 -1
- package/dist/approval/plan/plan-steps.js +2 -2
- package/dist/approval/plan/question-choices.js +139 -48
- package/dist/approval/plan/question.js +189 -67
- package/dist/approval/run/run-bar.js +138 -49
- package/dist/approval/shared/approval-line.d.ts +27 -0
- package/dist/approval/shared/approval-line.js +85 -0
- package/dist/approval/shared/risk-badge.d.ts +3 -5
- package/dist/approval/shared/risk-badge.js +11 -19
- package/dist/approval/shared/time.d.ts +0 -1
- package/dist/approval/shared/time.js +0 -1
- package/dist/approval/shared/use-focus-on-mount.js +23 -5
- package/dist/approval/shared/use-focus-when-settled.d.ts +2 -0
- package/dist/approval/shared/use-focus-when-settled.js +18 -0
- package/dist/approval/spend/raise-cap-form.d.ts +2 -2
- package/dist/approval/spend/raise-cap-form.js +235 -52
- package/dist/approval/spend/spend-gate.js +200 -106
- package/dist/approval/spend/spend-math.d.ts +1 -0
- package/dist/approval/spend/spend-math.js +5 -2
- package/dist/approval/spend/spend-meter.js +5 -5
- package/dist/approval/tool/approval.js +157 -96
- package/dist/approval/tool/args/args-editor.js +232 -81
- package/dist/approval/tool/args/args-field.js +333 -60
- package/dist/approval/tool/deny-form.js +114 -32
- package/dist/approval/tool/tool-inputs.js +93 -33
- package/dist/chat/chat/chat.js +5 -4
- package/dist/chat/chat/use-stick-to-bottom.js +116 -63
- package/dist/chat/chat/virtual-chat-items.js +129 -34
- package/dist/chat/composer/composer-actions.d.ts +1 -2
- package/dist/chat/composer/composer-actions.js +136 -50
- package/dist/chat/composer/composer-status.d.ts +2 -0
- package/dist/chat/composer/composer-status.js +3 -0
- package/dist/chat/composer/composer.d.ts +1 -1
- package/dist/chat/composer/composer.js +6 -4
- package/dist/chat/composer/use-auto-grow.js +29 -8
- package/dist/chat/files/files.js +296 -67
- package/dist/chat/index.d.ts +1 -1
- package/dist/chat/index.js +1 -1
- package/dist/chat/reply/fenced-code.js +1 -1
- package/dist/chat/reply/markdown-components.js +9 -116
- package/dist/chat/reply/reply.js +2 -2
- package/dist/chat/turn/group-parts.d.ts +1 -0
- package/dist/chat/turn/group-parts.js +6 -3
- package/dist/chat/turn/turn.js +13 -4
- package/dist/cost/context.js +3 -3
- package/dist/cost/cost-steps.js +31 -30
- package/dist/cost/cost.js +39 -39
- package/dist/cost/model-picker.js +176 -43
- package/dist/cost/shared/context-breakdown.js +10 -11
- package/dist/cost/shared/model-option-row.js +4 -3
- package/dist/cost/shared/step-cost-row.js +11 -12
- package/dist/cost/shared/usage-totals.d.ts +1 -0
- package/dist/cost/shared/usage-totals.js +19 -1
- package/dist/memory/cite.js +190 -59
- package/dist/memory/memorized.js +231 -62
- package/dist/memory/recall.js +272 -85
- package/dist/memory/shared/host-label.d.ts +1 -1
- package/dist/memory/shared/host-label.js +2 -2
- package/dist/memory/shared/source-mark.js +1 -1
- package/dist/memory/sources.d.ts +2 -1
- package/dist/memory/sources.js +277 -62
- package/dist/shared/decision-summary.js +2 -1
- package/dist/shared/line.d.ts +10 -0
- package/dist/shared/line.js +11 -0
- package/dist/shared/live-status.d.ts +3 -0
- package/dist/shared/live-status.js +11 -0
- package/dist/shared/reduced-motion.d.ts +1 -0
- package/dist/shared/reduced-motion.js +3 -0
- package/dist/shared/virtual/use-list-virtualizer.js +2 -0
- package/dist/thread/actions/action-button.js +1 -1
- package/dist/thread/actions/actions.d.ts +3 -1
- package/dist/thread/actions/actions.js +100 -81
- package/dist/thread/actions/branch-switcher.js +129 -23
- package/dist/thread/canvas/canvas-meta.d.ts +9 -0
- package/dist/thread/canvas/canvas-meta.js +35 -0
- package/dist/thread/canvas/canvas.d.ts +1 -1
- package/dist/thread/canvas/canvas.js +64 -74
- package/dist/thread/canvas/version-switcher.d.ts +1 -0
- package/dist/thread/canvas/version-switcher.js +161 -45
- package/dist/thread/code/code.js +4 -6
- package/dist/thread/code/copy-code-button.d.ts +2 -1
- package/dist/thread/code/copy-code-button.js +91 -26
- package/dist/thread/history/history.d.ts +1 -1
- package/dist/thread/history/history.js +104 -104
- package/dist/thread/history/row/history-row.js +106 -22
- package/dist/thread/history/row/thread-item-menu.js +84 -20
- package/dist/thread/history/row/thread-title-editor.js +74 -29
- package/dist/thread/history/virtual-history-list.js +83 -46
- package/dist/thread/index.d.ts +1 -0
- package/dist/thread/index.js +1 -0
- package/dist/thread/starters/starters.js +91 -28
- package/dist/thread/use-copied.js +40 -10
- package/package.json +6 -6
- package/dist/agent/shared/status-dot.d.ts +0 -1
- package/dist/agent/shared/status-dot.js +0 -1
- package/dist/approval/shared/decision-line.d.ts +0 -1
- package/dist/approval/shared/decision-line.js +0 -1
- package/dist/memory/shared/disclosure.d.ts +0 -6
- package/dist/memory/shared/disclosure.js +0 -6
- package/dist/shared/panel.d.ts +0 -19
- package/dist/shared/panel.js +0 -77
- package/dist/shared/status-dot.d.ts +0 -6
- package/dist/shared/status-dot.js +0 -20
|
@@ -1,15 +1,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 {
|
|
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(
|
|
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-
|
|
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] !==
|
|
88
|
-
t5 =
|
|
89
|
-
className: "
|
|
90
|
-
children:
|
|
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] =
|
|
92
|
+
$[18] = title;
|
|
93
93
|
$[19] = t5;
|
|
94
94
|
} else {
|
|
95
95
|
t5 = $[19];
|
|
96
96
|
}
|
|
97
97
|
let t6;
|
|
98
|
-
if ($[20] !==
|
|
99
|
-
t6 = /*#__PURE__*/_jsx(
|
|
100
|
-
|
|
101
|
-
|
|
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] =
|
|
104
|
-
$[21] =
|
|
105
|
+
$[20] = current;
|
|
106
|
+
$[21] = kind;
|
|
107
|
+
$[22] = onVersionChange;
|
|
108
|
+
$[23] = versions;
|
|
109
|
+
$[24] = t6;
|
|
105
110
|
} else {
|
|
106
|
-
t6 = $[
|
|
111
|
+
t6 = $[24];
|
|
107
112
|
}
|
|
108
113
|
let t7;
|
|
109
|
-
if ($[
|
|
114
|
+
if ($[25] !== t5 || $[26] !== t6) {
|
|
110
115
|
t7 = /*#__PURE__*/_jsxs("div", {
|
|
111
|
-
className: "flex min-w-0 flex-1 flex-col gap-
|
|
116
|
+
className: "flex min-w-0 flex-1 flex-col gap-0.5",
|
|
112
117
|
children: [t5, t6]
|
|
113
118
|
});
|
|
114
|
-
$[
|
|
115
|
-
$[
|
|
116
|
-
$[
|
|
119
|
+
$[25] = t5;
|
|
120
|
+
$[26] = t6;
|
|
121
|
+
$[27] = t7;
|
|
117
122
|
} else {
|
|
118
|
-
t7 = $[
|
|
123
|
+
t7 = $[27];
|
|
119
124
|
}
|
|
120
125
|
let t8;
|
|
121
|
-
if ($[
|
|
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-
|
|
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
|
-
$[
|
|
132
|
-
$[
|
|
139
|
+
$[28] = onClose;
|
|
140
|
+
$[29] = t8;
|
|
133
141
|
} else {
|
|
134
|
-
t8 = $[
|
|
142
|
+
t8 = $[29];
|
|
135
143
|
}
|
|
136
144
|
let t9;
|
|
137
|
-
if ($[
|
|
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-
|
|
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
|
-
$[
|
|
143
|
-
$[
|
|
144
|
-
$[
|
|
150
|
+
$[30] = actions;
|
|
151
|
+
$[31] = t8;
|
|
152
|
+
$[32] = t9;
|
|
145
153
|
} else {
|
|
146
|
-
t9 = $[
|
|
154
|
+
t9 = $[32];
|
|
147
155
|
}
|
|
148
156
|
let t10;
|
|
149
|
-
if ($[
|
|
157
|
+
if ($[33] !== t7 || $[34] !== t9) {
|
|
150
158
|
t10 = /*#__PURE__*/_jsxs("header", {
|
|
151
|
-
className: "flex items-start gap-3
|
|
159
|
+
className: "flex items-start gap-3 px-6 pt-4 pb-3",
|
|
152
160
|
children: [t7, t9]
|
|
153
161
|
});
|
|
154
|
-
$[
|
|
155
|
-
$[
|
|
156
|
-
$[
|
|
162
|
+
$[33] = t7;
|
|
163
|
+
$[34] = t9;
|
|
164
|
+
$[35] = t10;
|
|
157
165
|
} else {
|
|
158
|
-
t10 = $[
|
|
166
|
+
t10 = $[35];
|
|
159
167
|
}
|
|
160
168
|
let t11;
|
|
161
|
-
if ($[
|
|
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-
|
|
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
|
-
$[
|
|
171
|
-
$[
|
|
178
|
+
$[36] = children;
|
|
179
|
+
$[37] = t11;
|
|
172
180
|
} else {
|
|
173
|
-
t11 = $[
|
|
181
|
+
t11 = $[37];
|
|
174
182
|
}
|
|
175
183
|
let t12;
|
|
176
|
-
if ($[
|
|
177
|
-
t12 =
|
|
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
|
|
190
|
+
children: [t10, t11]
|
|
200
191
|
});
|
|
201
|
-
$[
|
|
202
|
-
$[
|
|
203
|
-
$[
|
|
204
|
-
$[
|
|
205
|
-
$[
|
|
206
|
-
$[
|
|
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
|
-
|
|
199
|
+
t12 = $[43];
|
|
210
200
|
}
|
|
211
|
-
return
|
|
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
|
-
|
|
2
|
-
|
|
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
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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
|
-
})
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
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:
|
|
137
|
+
value: t5,
|
|
43
138
|
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))
|
|
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
|
}
|
package/dist/thread/code/code.js
CHANGED
|
@@ -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
|
|
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-
|
|
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-
|
|
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-
|
|
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
|
-
|
|
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
|
-
|
|
7
|
-
|
|
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
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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
|
}
|