@locusgraph/loop 0.3.1 → 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 (119) hide show
  1. package/dist/agent/index.d.ts +1 -1
  2. package/dist/agent/pulse/gradient-label.js +6 -5
  3. package/dist/agent/pulse/marks/bars-mark.js +1 -1
  4. package/dist/agent/pulse/marks/glyph-mark.js +2 -2
  5. package/dist/agent/pulse/marks/locus-mark.js +1 -1
  6. package/dist/agent/pulse/pulse.js +1 -1
  7. package/dist/agent/pulse/use-loop-animation.d.ts +0 -1
  8. package/dist/agent/pulse/use-loop-animation.js +1 -3
  9. package/dist/agent/steps/step-icon.js +20 -13
  10. package/dist/agent/steps/steps.js +39 -37
  11. package/dist/agent/thinking/thinking.js +65 -62
  12. package/dist/agent/tool/json-block.js +10 -7
  13. package/dist/agent/tool/tool-status.d.ts +2 -0
  14. package/dist/agent/tool/tool-status.js +16 -13
  15. package/dist/agent/tool/tool.d.ts +8 -1
  16. package/dist/agent/tool/tool.js +238 -119
  17. package/dist/approval/inbox/inbox-row.d.ts +3 -3
  18. package/dist/approval/inbox/inbox-row.js +135 -200
  19. package/dist/approval/inbox/inbox.d.ts +3 -3
  20. package/dist/approval/inbox/inbox.js +180 -139
  21. package/dist/approval/inbox/virtual-inbox-list.d.ts +3 -3
  22. package/dist/approval/inbox/virtual-inbox-list.js +20 -21
  23. package/dist/approval/memory/memory-review.js +155 -154
  24. package/dist/approval/memory/memory-row.js +86 -87
  25. package/dist/approval/plan/plan-review.js +110 -129
  26. package/dist/approval/plan/plan-step-row.js +7 -6
  27. package/dist/approval/plan/plan-steps.d.ts +1 -1
  28. package/dist/approval/plan/plan-steps.js +2 -2
  29. package/dist/approval/plan/question-choices.js +10 -7
  30. package/dist/approval/plan/question.js +116 -112
  31. package/dist/approval/run/run-bar.js +43 -40
  32. package/dist/approval/shared/approval-line.d.ts +27 -0
  33. package/dist/approval/shared/approval-line.js +85 -0
  34. package/dist/approval/shared/risk-badge.d.ts +3 -5
  35. package/dist/approval/shared/risk-badge.js +11 -19
  36. package/dist/approval/shared/time.d.ts +0 -1
  37. package/dist/approval/shared/time.js +0 -1
  38. package/dist/approval/shared/use-focus-when-settled.d.ts +2 -0
  39. package/dist/approval/shared/use-focus-when-settled.js +18 -0
  40. package/dist/approval/spend/raise-cap-form.d.ts +2 -2
  41. package/dist/approval/spend/raise-cap-form.js +134 -126
  42. package/dist/approval/spend/spend-gate.js +133 -156
  43. package/dist/approval/spend/spend-math.d.ts +1 -0
  44. package/dist/approval/spend/spend-math.js +5 -2
  45. package/dist/approval/spend/spend-meter.js +5 -5
  46. package/dist/approval/tool/approval.js +114 -214
  47. package/dist/approval/tool/args/args-editor.js +147 -156
  48. package/dist/approval/tool/args/args-field.js +197 -109
  49. package/dist/approval/tool/deny-form.js +59 -66
  50. package/dist/approval/tool/tool-inputs.js +38 -45
  51. package/dist/chat/chat/chat.js +5 -4
  52. package/dist/chat/chat/use-stick-to-bottom.js +1 -3
  53. package/dist/chat/composer/composer-actions.js +4 -1
  54. package/dist/chat/composer/composer.js +4 -3
  55. package/dist/chat/composer/use-auto-grow.js +14 -10
  56. package/dist/chat/files/files.js +12 -10
  57. package/dist/chat/reply/fenced-code.js +1 -1
  58. package/dist/chat/reply/markdown-components.js +9 -116
  59. package/dist/chat/reply/reply.js +2 -2
  60. package/dist/chat/turn/group-parts.d.ts +1 -0
  61. package/dist/chat/turn/group-parts.js +6 -3
  62. package/dist/chat/turn/turn.js +13 -4
  63. package/dist/cost/context.js +3 -3
  64. package/dist/cost/cost-steps.js +31 -30
  65. package/dist/cost/cost.js +39 -39
  66. package/dist/cost/model-picker.js +5 -4
  67. package/dist/cost/shared/context-breakdown.js +10 -11
  68. package/dist/cost/shared/model-option-row.js +4 -3
  69. package/dist/cost/shared/step-cost-row.js +11 -12
  70. package/dist/cost/shared/usage-totals.d.ts +1 -0
  71. package/dist/cost/shared/usage-totals.js +19 -1
  72. package/dist/memory/cite.js +55 -47
  73. package/dist/memory/memorized.js +123 -108
  74. package/dist/memory/recall.js +136 -146
  75. package/dist/memory/shared/host-label.d.ts +1 -1
  76. package/dist/memory/shared/host-label.js +2 -2
  77. package/dist/memory/shared/source-mark.js +1 -1
  78. package/dist/memory/sources.d.ts +2 -1
  79. package/dist/memory/sources.js +135 -100
  80. package/dist/shared/decision-summary.js +2 -1
  81. package/dist/shared/line.d.ts +10 -0
  82. package/dist/shared/line.js +11 -0
  83. package/dist/shared/live-status.d.ts +3 -0
  84. package/dist/shared/live-status.js +11 -0
  85. package/dist/shared/reduced-motion.d.ts +1 -0
  86. package/dist/shared/reduced-motion.js +3 -0
  87. package/dist/thread/actions/action-button.js +1 -1
  88. package/dist/thread/actions/actions.d.ts +3 -1
  89. package/dist/thread/actions/actions.js +100 -81
  90. package/dist/thread/actions/branch-switcher.js +67 -37
  91. package/dist/thread/canvas/canvas-meta.d.ts +9 -0
  92. package/dist/thread/canvas/canvas-meta.js +35 -0
  93. package/dist/thread/canvas/canvas.d.ts +1 -1
  94. package/dist/thread/canvas/canvas.js +64 -74
  95. package/dist/thread/canvas/version-switcher.d.ts +1 -0
  96. package/dist/thread/canvas/version-switcher.js +106 -87
  97. package/dist/thread/code/code.js +4 -6
  98. package/dist/thread/code/copy-code-button.d.ts +2 -1
  99. package/dist/thread/code/copy-code-button.js +56 -25
  100. package/dist/thread/history/history.d.ts +1 -1
  101. package/dist/thread/history/history.js +104 -104
  102. package/dist/thread/history/row/history-row.js +8 -5
  103. package/dist/thread/history/row/thread-item-menu.js +13 -4
  104. package/dist/thread/history/row/thread-title-editor.js +1 -1
  105. package/dist/thread/history/virtual-history-list.js +1 -2
  106. package/dist/thread/index.d.ts +1 -0
  107. package/dist/thread/index.js +1 -0
  108. package/dist/thread/starters/starters.js +5 -4
  109. package/package.json +6 -6
  110. package/dist/agent/shared/status-dot.d.ts +0 -1
  111. package/dist/agent/shared/status-dot.js +0 -1
  112. package/dist/approval/shared/decision-line.d.ts +0 -1
  113. package/dist/approval/shared/decision-line.js +0 -1
  114. package/dist/memory/shared/disclosure.d.ts +0 -6
  115. package/dist/memory/shared/disclosure.js +0 -6
  116. package/dist/shared/panel.d.ts +0 -19
  117. package/dist/shared/panel.js +0 -77
  118. package/dist/shared/status-dot.d.ts +0 -6
  119. 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(40);
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
- let t2;
63
- if ($[9] !== className) {
64
- t2 = cn("flex items-center gap-0.5", className);
65
- $[9] = className;
66
- $[10] = t2;
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
- t2 = $[10];
90
+ t6 = $[14];
69
91
  }
70
- let t3;
71
- if ($[11] !== branch || $[12] !== onBranchChange || $[13] !== showBranch) {
72
- t3 = showBranch && /*#__PURE__*/_jsx(BranchSwitcher, {
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
- $[11] = branch;
77
- $[12] = onBranchChange;
78
- $[13] = showBranch;
79
- $[14] = t3;
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
- t4 = $[19];
103
+ t7 = $[18];
96
104
  }
97
- let t5;
98
- if ($[20] !== copied || $[21] !== markCopied || $[22] !== onCopy) {
99
- t5 = onCopy && /*#__PURE__*/_jsx(ActionButton, {
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
- $[20] = copied;
110
- $[21] = markCopied;
111
- $[22] = onCopy;
112
- $[23] = t5;
122
+ $[19] = copied;
123
+ $[20] = markCopied;
124
+ $[21] = onCopy;
125
+ $[22] = t8;
113
126
  } else {
114
- t5 = $[23];
127
+ t8 = $[22];
115
128
  }
116
- let t6;
117
- if ($[24] !== onRetry) {
118
- t6 = onRetry && /*#__PURE__*/_jsx(ActionButton, {
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
- $[24] = onRetry;
124
- $[25] = t6;
139
+ $[23] = onRetry;
140
+ $[24] = t9;
125
141
  } else {
126
- t6 = $[25];
142
+ t9 = $[24];
127
143
  }
128
- let t7;
129
- if ($[26] !== feedback || $[27] !== onFeedback) {
130
- t7 = onFeedback && /*#__PURE__*/_jsxs(_Fragment, {
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
- className: cn(feedback === "up" && "fill-current")
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
- className: cn(feedback === "down" && "fill-current")
161
+ weight: feedback === "down" ? "fill" : "bold",
162
+ "aria-hidden": true,
163
+ className: cn(feedback === "down" && "text-destructive")
146
164
  })
147
165
  })]
148
166
  });
149
- $[26] = feedback;
150
- $[27] = onFeedback;
151
- $[28] = t7;
167
+ $[25] = feedback;
168
+ $[26] = onFeedback;
169
+ $[27] = t10;
152
170
  } else {
153
- t7 = $[28];
171
+ t10 = $[27];
154
172
  }
155
- let t8;
156
- if ($[29] !== copied) {
157
- t8 = copied && /*#__PURE__*/_jsx("span", {
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
- $[29] = copied;
163
- $[30] = t8;
180
+ $[28] = copied;
181
+ $[29] = t11;
164
182
  } else {
165
- t8 = $[30];
183
+ t11 = $[29];
166
184
  }
167
- let t9;
168
- if ($[31] !== props || $[32] !== t2 || $[33] !== t3 || $[34] !== t4 || $[35] !== t5 || $[36] !== t6 || $[37] !== t7 || $[38] !== t8) {
169
- t9 = /*#__PURE__*/_jsx(TooltipProvider, {
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
- className: t2,
192
+ "data-reveal": reveal,
193
+ className: t6,
175
194
  ...props,
176
- children: [t3, t4, t5, t6, t7, t8]
195
+ children: [t7, t8, t9, t10, t11]
177
196
  })
178
197
  });
179
- $[31] = props;
180
- $[32] = t2;
181
- $[33] = t3;
182
- $[34] = t4;
183
- $[35] = t5;
184
- $[36] = t6;
185
- $[37] = t7;
186
- $[38] = t8;
187
- $[39] = t9;
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
- t9 = $[39];
208
+ t12 = $[38];
190
209
  }
191
- return t9;
210
+ return t12;
192
211
  }
@@ -1,11 +1,11 @@
1
1
  "use client";
2
2
 
3
3
  import { c as _c } from "react/compiler-runtime";
4
- import { ChevronLeft as ChevronLeftIcon, ChevronRight as ChevronRightIcon } from "@carbon/icons-react";
4
+ import { CaretLeft as ChevronLeftIcon, CaretRight as ChevronRightIcon } from "@phosphor-icons/react/ssr";
5
5
  import { ActionButton } from "./action-button.js";
6
6
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
7
7
  export function BranchSwitcher(t0) {
8
- const $ = _c(20);
8
+ const $ = _c(25);
9
9
  const {
10
10
  branch,
11
11
  onBranchChange
@@ -23,7 +23,10 @@ export function BranchSwitcher(t0) {
23
23
  }
24
24
  let t3;
25
25
  if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
26
- t3 = /*#__PURE__*/_jsx(ChevronLeftIcon, {});
26
+ t3 = /*#__PURE__*/_jsx(ChevronLeftIcon, {
27
+ weight: "bold",
28
+ "aria-hidden": true
29
+ });
27
30
  $[3] = t3;
28
31
  } else {
29
32
  t3 = $[3];
@@ -46,8 +49,7 @@ export function BranchSwitcher(t0) {
46
49
  let t6;
47
50
  if ($[7] !== t5) {
48
51
  t6 = /*#__PURE__*/_jsx("span", {
49
- "aria-live": "polite",
50
- className: "min-w-9 text-center font-mono text-xs text-muted-foreground tabular-nums",
52
+ "aria-hidden": true,
51
53
  children: t5
52
54
  });
53
55
  $[7] = t5;
@@ -55,52 +57,80 @@ export function BranchSwitcher(t0) {
55
57
  } else {
56
58
  t6 = $[8];
57
59
  }
58
- const t7 = position >= branch.count;
60
+ const t7 = `Version ${position} of ${branch.count}`;
59
61
  let t8;
60
- if ($[9] !== branch.index || $[10] !== onBranchChange) {
61
- t8 = () => onBranchChange(branch.index + 1);
62
- $[9] = branch.index;
63
- $[10] = onBranchChange;
64
- $[11] = t8;
62
+ if ($[9] !== t7) {
63
+ t8 = /*#__PURE__*/_jsx("span", {
64
+ className: "sr-only",
65
+ children: t7
66
+ });
67
+ $[9] = t7;
68
+ $[10] = t8;
65
69
  } else {
66
- t8 = $[11];
70
+ t8 = $[10];
67
71
  }
68
72
  let t9;
69
- if ($[12] === Symbol.for("react.memo_cache_sentinel")) {
70
- t9 = /*#__PURE__*/_jsx(ChevronRightIcon, {});
71
- $[12] = t9;
73
+ if ($[11] !== t6 || $[12] !== t8) {
74
+ t9 = /*#__PURE__*/_jsxs("span", {
75
+ "aria-live": "polite",
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;
72
102
  } else {
73
- t9 = $[12];
103
+ t12 = $[17];
74
104
  }
75
- let t10;
76
- if ($[13] !== t7 || $[14] !== t8) {
77
- t10 = /*#__PURE__*/_jsx(ActionButton, {
105
+ let t13;
106
+ if ($[18] !== t10 || $[19] !== t11) {
107
+ t13 = /*#__PURE__*/_jsx(ActionButton, {
78
108
  label: "Next version",
79
- disabled: t7,
80
- onClick: t8,
81
- children: t9
109
+ disabled: t10,
110
+ onClick: t11,
111
+ children: t12
82
112
  });
83
- $[13] = t7;
84
- $[14] = t8;
85
- $[15] = t10;
113
+ $[18] = t10;
114
+ $[19] = t11;
115
+ $[20] = t13;
86
116
  } else {
87
- t10 = $[15];
117
+ t13 = $[20];
88
118
  }
89
- let t11;
90
- if ($[16] !== t10 || $[17] !== t4 || $[18] !== t6) {
91
- t11 = /*#__PURE__*/_jsxs("div", {
119
+ let t14;
120
+ if ($[21] !== t13 || $[22] !== t4 || $[23] !== t9) {
121
+ t14 = /*#__PURE__*/_jsxs("div", {
92
122
  "data-slot": "branch-switcher",
93
123
  role: "group",
94
124
  "aria-label": "Reply versions",
95
- className: "flex items-center",
96
- children: [t4, t6, t10]
125
+ className: "mr-2 flex items-center",
126
+ children: [t4, t9, t13]
97
127
  });
98
- $[16] = t10;
99
- $[17] = t4;
100
- $[18] = t6;
101
- $[19] = t11;
128
+ $[21] = t13;
129
+ $[22] = t4;
130
+ $[23] = t9;
131
+ $[24] = t14;
102
132
  } else {
103
- t11 = $[19];
133
+ t14 = $[24];
104
134
  }
105
- return t11;
135
+ return t14;
106
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 { type CanvasVersion } from "./version-switcher.js";
2
+ import type { CanvasVersion } from "./version-switcher.js";
3
3
  type CanvasProps = Omit<ComponentProps<"aside">, "title"> & {
4
4
  title: string;
5
5
  kind?: string;