@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,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import { c as _c } from "react/compiler-runtime";
|
|
4
|
-
import { Checkmark as CheckIcon, Copy as CopyIcon, Renew as RefreshCwIcon, ThumbsDown as ThumbsDownIcon, ThumbsUp as ThumbsUpIcon } from "@carbon/icons-react";
|
|
5
4
|
import { cn, TooltipProvider } from "@locusgraph/components";
|
|
5
|
+
import { Check as CheckIcon, Copy as CopyIcon, ArrowsClockwise as RefreshCwIcon, ThumbsDown as ThumbsDownIcon, ThumbsUp as ThumbsUpIcon } from "@phosphor-icons/react/ssr";
|
|
6
6
|
import { useCopied } from "../use-copied.js";
|
|
7
7
|
import { ActionButton } from "./action-button.js";
|
|
8
8
|
import { BranchSwitcher } from "./branch-switcher.js";
|
|
@@ -10,8 +10,16 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
|
|
|
10
10
|
function toggledFeedback(current, chosen) {
|
|
11
11
|
return current === chosen ? null : chosen;
|
|
12
12
|
}
|
|
13
|
+
function showsThumb(feedback, thumb) {
|
|
14
|
+
return feedback === null || feedback === thumb;
|
|
15
|
+
}
|
|
16
|
+
const alignClasses = {
|
|
17
|
+
start: "-ml-2",
|
|
18
|
+
end: "-mr-2 justify-end"
|
|
19
|
+
};
|
|
20
|
+
const revealOnMessageHover = "opacity-0 transition-opacity duration-150 group-hover/message:opacity-100 focus-within:opacity-100 has-[[aria-pressed=true]]:opacity-100 motion-reduce:transition-none [@media(hover:none)]:opacity-100";
|
|
13
21
|
export function Actions(t0) {
|
|
14
|
-
const $ = _c(
|
|
22
|
+
const $ = _c(39);
|
|
15
23
|
let branch;
|
|
16
24
|
let className;
|
|
17
25
|
let onBranchChange;
|
|
@@ -20,6 +28,8 @@ export function Actions(t0) {
|
|
|
20
28
|
let onRetry;
|
|
21
29
|
let props;
|
|
22
30
|
let t1;
|
|
31
|
+
let t2;
|
|
32
|
+
let t3;
|
|
23
33
|
if ($[0] !== t0) {
|
|
24
34
|
({
|
|
25
35
|
onCopy,
|
|
@@ -28,6 +38,8 @@ export function Actions(t0) {
|
|
|
28
38
|
onFeedback,
|
|
29
39
|
branch,
|
|
30
40
|
onBranchChange,
|
|
41
|
+
align: t2,
|
|
42
|
+
reveal: t3,
|
|
31
43
|
className,
|
|
32
44
|
...props
|
|
33
45
|
} = t0);
|
|
@@ -40,6 +52,8 @@ export function Actions(t0) {
|
|
|
40
52
|
$[6] = onRetry;
|
|
41
53
|
$[7] = props;
|
|
42
54
|
$[8] = t1;
|
|
55
|
+
$[9] = t2;
|
|
56
|
+
$[10] = t3;
|
|
43
57
|
} else {
|
|
44
58
|
branch = $[1];
|
|
45
59
|
className = $[2];
|
|
@@ -49,8 +63,12 @@ export function Actions(t0) {
|
|
|
49
63
|
onRetry = $[6];
|
|
50
64
|
props = $[7];
|
|
51
65
|
t1 = $[8];
|
|
66
|
+
t2 = $[9];
|
|
67
|
+
t3 = $[10];
|
|
52
68
|
}
|
|
53
69
|
const feedback = t1 === undefined ? null : t1;
|
|
70
|
+
const align = t2 === undefined ? "start" : t2;
|
|
71
|
+
const reveal = t3 === undefined ? "always" : t3;
|
|
54
72
|
const {
|
|
55
73
|
copied,
|
|
56
74
|
markCopied
|
|
@@ -59,134 +77,135 @@ export function Actions(t0) {
|
|
|
59
77
|
if (!onCopy && !onRetry && !onFeedback && !showBranch) {
|
|
60
78
|
return null;
|
|
61
79
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
80
|
+
const t4 = alignClasses[align];
|
|
81
|
+
const t5 = reveal === "hover" && revealOnMessageHover;
|
|
82
|
+
let t6;
|
|
83
|
+
if ($[11] !== className || $[12] !== t4 || $[13] !== t5) {
|
|
84
|
+
t6 = cn("flex items-center", t4, t5, className);
|
|
85
|
+
$[11] = className;
|
|
86
|
+
$[12] = t4;
|
|
87
|
+
$[13] = t5;
|
|
88
|
+
$[14] = t6;
|
|
67
89
|
} else {
|
|
68
|
-
|
|
90
|
+
t6 = $[14];
|
|
69
91
|
}
|
|
70
|
-
let
|
|
71
|
-
if ($[
|
|
72
|
-
|
|
92
|
+
let t7;
|
|
93
|
+
if ($[15] !== branch || $[16] !== onBranchChange || $[17] !== showBranch) {
|
|
94
|
+
t7 = showBranch && /*#__PURE__*/_jsx(BranchSwitcher, {
|
|
73
95
|
branch: branch,
|
|
74
96
|
onBranchChange: onBranchChange
|
|
75
97
|
});
|
|
76
|
-
$[
|
|
77
|
-
$[
|
|
78
|
-
$[
|
|
79
|
-
$[
|
|
80
|
-
} else {
|
|
81
|
-
t3 = $[14];
|
|
82
|
-
}
|
|
83
|
-
let t4;
|
|
84
|
-
if ($[15] !== onCopy || $[16] !== onFeedback || $[17] !== onRetry || $[18] !== showBranch) {
|
|
85
|
-
t4 = showBranch && (onCopy || onRetry || onFeedback) && /*#__PURE__*/_jsx("span", {
|
|
86
|
-
"aria-hidden": true,
|
|
87
|
-
className: "mx-1 h-3.5 w-px bg-border"
|
|
88
|
-
});
|
|
89
|
-
$[15] = onCopy;
|
|
90
|
-
$[16] = onFeedback;
|
|
91
|
-
$[17] = onRetry;
|
|
92
|
-
$[18] = showBranch;
|
|
93
|
-
$[19] = t4;
|
|
98
|
+
$[15] = branch;
|
|
99
|
+
$[16] = onBranchChange;
|
|
100
|
+
$[17] = showBranch;
|
|
101
|
+
$[18] = t7;
|
|
94
102
|
} else {
|
|
95
|
-
|
|
103
|
+
t7 = $[18];
|
|
96
104
|
}
|
|
97
|
-
let
|
|
98
|
-
if ($[
|
|
99
|
-
|
|
105
|
+
let t8;
|
|
106
|
+
if ($[19] !== copied || $[20] !== markCopied || $[21] !== onCopy) {
|
|
107
|
+
t8 = onCopy && /*#__PURE__*/_jsx(ActionButton, {
|
|
100
108
|
label: copied ? "Copied" : "Copy",
|
|
101
109
|
onClick: () => {
|
|
102
110
|
onCopy();
|
|
103
111
|
markCopied();
|
|
104
112
|
},
|
|
105
113
|
children: copied ? /*#__PURE__*/_jsx(CheckIcon, {
|
|
114
|
+
weight: "bold",
|
|
115
|
+
"aria-hidden": true,
|
|
106
116
|
className: "text-good"
|
|
107
|
-
}) : /*#__PURE__*/_jsx(CopyIcon, {
|
|
117
|
+
}) : /*#__PURE__*/_jsx(CopyIcon, {
|
|
118
|
+
weight: "bold",
|
|
119
|
+
"aria-hidden": true
|
|
120
|
+
})
|
|
108
121
|
});
|
|
109
|
-
$[
|
|
110
|
-
$[
|
|
111
|
-
$[
|
|
112
|
-
$[
|
|
122
|
+
$[19] = copied;
|
|
123
|
+
$[20] = markCopied;
|
|
124
|
+
$[21] = onCopy;
|
|
125
|
+
$[22] = t8;
|
|
113
126
|
} else {
|
|
114
|
-
|
|
127
|
+
t8 = $[22];
|
|
115
128
|
}
|
|
116
|
-
let
|
|
117
|
-
if ($[
|
|
118
|
-
|
|
129
|
+
let t9;
|
|
130
|
+
if ($[23] !== onRetry) {
|
|
131
|
+
t9 = onRetry && /*#__PURE__*/_jsx(ActionButton, {
|
|
119
132
|
label: "Retry",
|
|
120
133
|
onClick: onRetry,
|
|
121
|
-
children: /*#__PURE__*/_jsx(RefreshCwIcon, {
|
|
134
|
+
children: /*#__PURE__*/_jsx(RefreshCwIcon, {
|
|
135
|
+
weight: "bold",
|
|
136
|
+
"aria-hidden": true
|
|
137
|
+
})
|
|
122
138
|
});
|
|
123
|
-
$[
|
|
124
|
-
$[
|
|
139
|
+
$[23] = onRetry;
|
|
140
|
+
$[24] = t9;
|
|
125
141
|
} else {
|
|
126
|
-
|
|
142
|
+
t9 = $[24];
|
|
127
143
|
}
|
|
128
|
-
let
|
|
129
|
-
if ($[
|
|
130
|
-
|
|
131
|
-
children: [/*#__PURE__*/_jsx(ActionButton, {
|
|
144
|
+
let t10;
|
|
145
|
+
if ($[25] !== feedback || $[26] !== onFeedback) {
|
|
146
|
+
t10 = onFeedback && /*#__PURE__*/_jsxs(_Fragment, {
|
|
147
|
+
children: [showsThumb(feedback, "up") && /*#__PURE__*/_jsx(ActionButton, {
|
|
132
148
|
label: "Good response",
|
|
133
149
|
"aria-pressed": feedback === "up",
|
|
134
|
-
className: cn(feedback === "up" && "text-foreground"),
|
|
135
150
|
onClick: () => onFeedback(toggledFeedback(feedback, "up")),
|
|
136
151
|
children: /*#__PURE__*/_jsx(ThumbsUpIcon, {
|
|
137
|
-
|
|
152
|
+
weight: feedback === "up" ? "fill" : "bold",
|
|
153
|
+
"aria-hidden": true,
|
|
154
|
+
className: cn(feedback === "up" && "text-good")
|
|
138
155
|
})
|
|
139
|
-
}), /*#__PURE__*/_jsx(ActionButton, {
|
|
156
|
+
}), showsThumb(feedback, "down") && /*#__PURE__*/_jsx(ActionButton, {
|
|
140
157
|
label: "Bad response",
|
|
141
158
|
"aria-pressed": feedback === "down",
|
|
142
|
-
className: cn(feedback === "down" && "text-foreground"),
|
|
143
159
|
onClick: () => onFeedback(toggledFeedback(feedback, "down")),
|
|
144
160
|
children: /*#__PURE__*/_jsx(ThumbsDownIcon, {
|
|
145
|
-
|
|
161
|
+
weight: feedback === "down" ? "fill" : "bold",
|
|
162
|
+
"aria-hidden": true,
|
|
163
|
+
className: cn(feedback === "down" && "text-destructive")
|
|
146
164
|
})
|
|
147
165
|
})]
|
|
148
166
|
});
|
|
149
|
-
$[
|
|
150
|
-
$[
|
|
151
|
-
$[
|
|
167
|
+
$[25] = feedback;
|
|
168
|
+
$[26] = onFeedback;
|
|
169
|
+
$[27] = t10;
|
|
152
170
|
} else {
|
|
153
|
-
|
|
171
|
+
t10 = $[27];
|
|
154
172
|
}
|
|
155
|
-
let
|
|
156
|
-
if ($[
|
|
157
|
-
|
|
173
|
+
let t11;
|
|
174
|
+
if ($[28] !== copied) {
|
|
175
|
+
t11 = copied && /*#__PURE__*/_jsx("span", {
|
|
158
176
|
role: "status",
|
|
159
177
|
className: "sr-only",
|
|
160
178
|
children: "Copied"
|
|
161
179
|
});
|
|
162
|
-
$[
|
|
163
|
-
$[
|
|
180
|
+
$[28] = copied;
|
|
181
|
+
$[29] = t11;
|
|
164
182
|
} else {
|
|
165
|
-
|
|
183
|
+
t11 = $[29];
|
|
166
184
|
}
|
|
167
|
-
let
|
|
168
|
-
if ($[
|
|
169
|
-
|
|
185
|
+
let t12;
|
|
186
|
+
if ($[30] !== props || $[31] !== reveal || $[32] !== t10 || $[33] !== t11 || $[34] !== t6 || $[35] !== t7 || $[36] !== t8 || $[37] !== t9) {
|
|
187
|
+
t12 = /*#__PURE__*/_jsx(TooltipProvider, {
|
|
170
188
|
children: /*#__PURE__*/_jsxs("div", {
|
|
171
189
|
"data-slot": "actions",
|
|
172
190
|
role: "toolbar",
|
|
173
191
|
"aria-label": "Message actions",
|
|
174
|
-
|
|
192
|
+
"data-reveal": reveal,
|
|
193
|
+
className: t6,
|
|
175
194
|
...props,
|
|
176
|
-
children: [
|
|
195
|
+
children: [t7, t8, t9, t10, t11]
|
|
177
196
|
})
|
|
178
197
|
});
|
|
179
|
-
$[
|
|
180
|
-
$[
|
|
181
|
-
$[
|
|
182
|
-
$[
|
|
183
|
-
$[
|
|
184
|
-
$[
|
|
185
|
-
$[
|
|
186
|
-
$[
|
|
187
|
-
$[
|
|
198
|
+
$[30] = props;
|
|
199
|
+
$[31] = reveal;
|
|
200
|
+
$[32] = t10;
|
|
201
|
+
$[33] = t11;
|
|
202
|
+
$[34] = t6;
|
|
203
|
+
$[35] = t7;
|
|
204
|
+
$[36] = t8;
|
|
205
|
+
$[37] = t9;
|
|
206
|
+
$[38] = t12;
|
|
188
207
|
} else {
|
|
189
|
-
|
|
208
|
+
t12 = $[38];
|
|
190
209
|
}
|
|
191
|
-
return
|
|
210
|
+
return t12;
|
|
192
211
|
}
|
|
@@ -1,30 +1,136 @@
|
|
|
1
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { c as _c } from "react/compiler-runtime";
|
|
4
|
+
import { CaretLeft as ChevronLeftIcon, CaretRight as ChevronRightIcon } from "@phosphor-icons/react/ssr";
|
|
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(25);
|
|
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
|
+
weight: "bold",
|
|
28
|
+
"aria-hidden": true
|
|
29
|
+
});
|
|
30
|
+
$[3] = t3;
|
|
31
|
+
} else {
|
|
32
|
+
t3 = $[3];
|
|
33
|
+
}
|
|
34
|
+
let t4;
|
|
35
|
+
if ($[4] !== t1 || $[5] !== t2) {
|
|
36
|
+
t4 = /*#__PURE__*/_jsx(ActionButton, {
|
|
15
37
|
label: "Previous version",
|
|
16
|
-
disabled:
|
|
17
|
-
onClick:
|
|
18
|
-
children:
|
|
19
|
-
})
|
|
38
|
+
disabled: t1,
|
|
39
|
+
onClick: t2,
|
|
40
|
+
children: t3
|
|
41
|
+
});
|
|
42
|
+
$[4] = t1;
|
|
43
|
+
$[5] = t2;
|
|
44
|
+
$[6] = t4;
|
|
45
|
+
} else {
|
|
46
|
+
t4 = $[6];
|
|
47
|
+
}
|
|
48
|
+
const t5 = `${position} / ${branch.count}`;
|
|
49
|
+
let t6;
|
|
50
|
+
if ($[7] !== t5) {
|
|
51
|
+
t6 = /*#__PURE__*/_jsx("span", {
|
|
52
|
+
"aria-hidden": true,
|
|
53
|
+
children: t5
|
|
54
|
+
});
|
|
55
|
+
$[7] = t5;
|
|
56
|
+
$[8] = t6;
|
|
57
|
+
} else {
|
|
58
|
+
t6 = $[8];
|
|
59
|
+
}
|
|
60
|
+
const t7 = `Version ${position} of ${branch.count}`;
|
|
61
|
+
let t8;
|
|
62
|
+
if ($[9] !== t7) {
|
|
63
|
+
t8 = /*#__PURE__*/_jsx("span", {
|
|
64
|
+
className: "sr-only",
|
|
65
|
+
children: t7
|
|
66
|
+
});
|
|
67
|
+
$[9] = t7;
|
|
68
|
+
$[10] = t8;
|
|
69
|
+
} else {
|
|
70
|
+
t8 = $[10];
|
|
71
|
+
}
|
|
72
|
+
let t9;
|
|
73
|
+
if ($[11] !== t6 || $[12] !== t8) {
|
|
74
|
+
t9 = /*#__PURE__*/_jsxs("span", {
|
|
20
75
|
"aria-live": "polite",
|
|
21
|
-
className: "min-w-
|
|
22
|
-
children:
|
|
23
|
-
})
|
|
76
|
+
className: "min-w-8 text-center text-xs text-muted-foreground tabular-nums",
|
|
77
|
+
children: [t6, t8]
|
|
78
|
+
});
|
|
79
|
+
$[11] = t6;
|
|
80
|
+
$[12] = t8;
|
|
81
|
+
$[13] = t9;
|
|
82
|
+
} else {
|
|
83
|
+
t9 = $[13];
|
|
84
|
+
}
|
|
85
|
+
const t10 = position >= branch.count;
|
|
86
|
+
let t11;
|
|
87
|
+
if ($[14] !== branch.index || $[15] !== onBranchChange) {
|
|
88
|
+
t11 = () => onBranchChange(branch.index + 1);
|
|
89
|
+
$[14] = branch.index;
|
|
90
|
+
$[15] = onBranchChange;
|
|
91
|
+
$[16] = t11;
|
|
92
|
+
} else {
|
|
93
|
+
t11 = $[16];
|
|
94
|
+
}
|
|
95
|
+
let t12;
|
|
96
|
+
if ($[17] === Symbol.for("react.memo_cache_sentinel")) {
|
|
97
|
+
t12 = /*#__PURE__*/_jsx(ChevronRightIcon, {
|
|
98
|
+
weight: "bold",
|
|
99
|
+
"aria-hidden": true
|
|
100
|
+
});
|
|
101
|
+
$[17] = t12;
|
|
102
|
+
} else {
|
|
103
|
+
t12 = $[17];
|
|
104
|
+
}
|
|
105
|
+
let t13;
|
|
106
|
+
if ($[18] !== t10 || $[19] !== t11) {
|
|
107
|
+
t13 = /*#__PURE__*/_jsx(ActionButton, {
|
|
24
108
|
label: "Next version",
|
|
25
|
-
disabled:
|
|
26
|
-
onClick:
|
|
27
|
-
children:
|
|
28
|
-
})
|
|
29
|
-
|
|
109
|
+
disabled: t10,
|
|
110
|
+
onClick: t11,
|
|
111
|
+
children: t12
|
|
112
|
+
});
|
|
113
|
+
$[18] = t10;
|
|
114
|
+
$[19] = t11;
|
|
115
|
+
$[20] = t13;
|
|
116
|
+
} else {
|
|
117
|
+
t13 = $[20];
|
|
118
|
+
}
|
|
119
|
+
let t14;
|
|
120
|
+
if ($[21] !== t13 || $[22] !== t4 || $[23] !== t9) {
|
|
121
|
+
t14 = /*#__PURE__*/_jsxs("div", {
|
|
122
|
+
"data-slot": "branch-switcher",
|
|
123
|
+
role: "group",
|
|
124
|
+
"aria-label": "Reply versions",
|
|
125
|
+
className: "mr-2 flex items-center",
|
|
126
|
+
children: [t4, t9, t13]
|
|
127
|
+
});
|
|
128
|
+
$[21] = t13;
|
|
129
|
+
$[22] = t4;
|
|
130
|
+
$[23] = t9;
|
|
131
|
+
$[24] = t14;
|
|
132
|
+
} else {
|
|
133
|
+
t14 = $[24];
|
|
134
|
+
}
|
|
135
|
+
return t14;
|
|
30
136
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type CanvasVersion } from "./version-switcher.js";
|
|
2
|
+
type CanvasMetaProps = {
|
|
3
|
+
kind?: string;
|
|
4
|
+
versions: CanvasVersion[];
|
|
5
|
+
current?: CanvasVersion;
|
|
6
|
+
onVersionChange?: (id: string) => void;
|
|
7
|
+
};
|
|
8
|
+
export declare function CanvasMeta({ kind, versions, current, onVersionChange }: CanvasMetaProps): import("react").JSX.Element | null;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { metaLinkClass, VersionSwitcher } from "./version-switcher.js";
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
function Dot() {
|
|
4
|
+
return /*#__PURE__*/_jsx("span", {
|
|
5
|
+
"aria-hidden": true,
|
|
6
|
+
children: "\xB7"
|
|
7
|
+
});
|
|
8
|
+
}
|
|
9
|
+
export function CanvasMeta({
|
|
10
|
+
kind,
|
|
11
|
+
versions,
|
|
12
|
+
current,
|
|
13
|
+
onVersionChange
|
|
14
|
+
}) {
|
|
15
|
+
const latest = versions.at(-1);
|
|
16
|
+
const viewingOlder = current && latest && current.id !== latest.id && onVersionChange;
|
|
17
|
+
if (!kind && !current) return null;
|
|
18
|
+
return /*#__PURE__*/_jsxs("p", {
|
|
19
|
+
className: "flex min-w-0 flex-wrap items-center gap-x-1.5 text-xs text-faint",
|
|
20
|
+
children: [kind && /*#__PURE__*/_jsx("span", {
|
|
21
|
+
children: kind
|
|
22
|
+
}), kind && current && /*#__PURE__*/_jsx(Dot, {}), current && /*#__PURE__*/_jsx(VersionSwitcher, {
|
|
23
|
+
versions: versions,
|
|
24
|
+
current: current,
|
|
25
|
+
onVersionChange: onVersionChange
|
|
26
|
+
}), viewingOlder && /*#__PURE__*/_jsxs(_Fragment, {
|
|
27
|
+
children: [/*#__PURE__*/_jsx(Dot, {}), /*#__PURE__*/_jsx("button", {
|
|
28
|
+
type: "button",
|
|
29
|
+
className: metaLinkClass,
|
|
30
|
+
onClick: () => onVersionChange(latest.id),
|
|
31
|
+
children: "Back to latest"
|
|
32
|
+
})]
|
|
33
|
+
})]
|
|
34
|
+
});
|
|
35
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ComponentProps, ReactNode } from "react";
|
|
2
|
-
import {
|
|
2
|
+
import type { CanvasVersion } from "./version-switcher.js";
|
|
3
3
|
type CanvasProps = Omit<ComponentProps<"aside">, "title"> & {
|
|
4
4
|
title: string;
|
|
5
5
|
kind?: string;
|