@locusgraph/loop 0.1.0 → 0.2.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 (115) hide show
  1. package/README.md +2 -0
  2. package/dist/agent/pulse/gradient-label.js +86 -15
  3. package/dist/agent/pulse/marks/bars-mark.js +46 -10
  4. package/dist/agent/pulse/marks/glyph-mark.js +56 -11
  5. package/dist/agent/pulse/marks/locus-mark.js +63 -28
  6. package/dist/agent/pulse/marks/orb-mark.js +31 -8
  7. package/dist/agent/pulse/marks/spinner-mark.js +29 -1
  8. package/dist/agent/pulse/pulse.js +150 -35
  9. package/dist/agent/pulse/use-loop-animation.js +36 -17
  10. package/dist/agent/steps/step-icon.js +110 -24
  11. package/dist/agent/steps/steps.js +235 -25
  12. package/dist/agent/thinking/thinking.js +203 -23
  13. package/dist/agent/thinking/thought-duration.js +7 -9
  14. package/dist/agent/tool/json-block.js +38 -11
  15. package/dist/agent/tool/tool-status.js +51 -18
  16. package/dist/agent/tool/tool.js +184 -6
  17. package/dist/approval/inbox/inbox-row.d.ts +3 -2
  18. package/dist/approval/inbox/inbox-row.js +321 -7
  19. package/dist/approval/inbox/inbox-selection.js +7 -13
  20. package/dist/approval/inbox/inbox.d.ts +2 -1
  21. package/dist/approval/inbox/inbox.js +250 -18
  22. package/dist/approval/inbox/virtual-inbox-list.d.ts +13 -0
  23. package/dist/approval/inbox/virtual-inbox-list.js +129 -0
  24. package/dist/approval/memory/memory-choices.js +27 -22
  25. package/dist/approval/memory/memory-review.js +242 -17
  26. package/dist/approval/memory/memory-row.js +215 -19
  27. package/dist/approval/plan/plan-review.js +279 -28
  28. package/dist/approval/plan/plan-step-row.js +194 -43
  29. package/dist/approval/plan/plan-steps.js +24 -23
  30. package/dist/approval/plan/question-choices.js +158 -39
  31. package/dist/approval/plan/question.d.ts +1 -1
  32. package/dist/approval/plan/question.js +223 -26
  33. package/dist/approval/run/run-bar.js +178 -22
  34. package/dist/approval/shared/decision-line.js +1 -1
  35. package/dist/approval/shared/risk-badge.js +47 -16
  36. package/dist/approval/shared/time.js +5 -8
  37. package/dist/approval/shared/use-focus-on-mount.js +23 -6
  38. package/dist/approval/spend/raise-cap-form.js +235 -17
  39. package/dist/approval/spend/spend-gate.js +239 -21
  40. package/dist/approval/spend/spend-math.js +7 -8
  41. package/dist/approval/spend/spend-meter.js +362 -34
  42. package/dist/approval/tool/approval.js +272 -27
  43. package/dist/approval/tool/args/args-editor.js +262 -26
  44. package/dist/approval/tool/args/args-field.js +259 -19
  45. package/dist/approval/tool/args/args-validation.js +38 -47
  46. package/dist/approval/tool/deny-form.js +130 -10
  47. package/dist/approval/tool/tool-inputs.js +127 -38
  48. package/dist/chat/chat/chat-item-spacing.d.ts +3 -0
  49. package/dist/chat/chat/chat-item-spacing.js +19 -0
  50. package/dist/chat/chat/chat.d.ts +2 -1
  51. package/dist/chat/chat/chat.js +181 -5
  52. package/dist/chat/chat/use-stick-to-bottom.js +123 -47
  53. package/dist/chat/chat/virtual-chat-items.d.ts +8 -0
  54. package/dist/chat/chat/virtual-chat-items.js +153 -0
  55. package/dist/chat/composer/composer-actions.js +151 -16
  56. package/dist/chat/composer/composer.js +330 -32
  57. package/dist/chat/composer/use-auto-grow.js +24 -9
  58. package/dist/chat/files/file-meta.js +19 -19
  59. package/dist/chat/files/files.js +316 -28
  60. package/dist/chat/reply/fenced-code.js +45 -21
  61. package/dist/chat/reply/markdown-components.js +137 -17
  62. package/dist/chat/reply/reply.js +105 -10
  63. package/dist/chat/turn/group-parts.js +43 -29
  64. package/dist/chat/turn/turn.js +238 -30
  65. package/dist/cost/context.js +321 -23
  66. package/dist/cost/cost-steps.js +220 -14
  67. package/dist/cost/cost.js +521 -27
  68. package/dist/cost/model-picker.js +181 -6
  69. package/dist/cost/shared/context-breakdown.js +299 -10
  70. package/dist/cost/shared/meter-marks.js +107 -9
  71. package/dist/cost/shared/model-option-row.js +178 -21
  72. package/dist/cost/shared/step-cost-row.js +248 -20
  73. package/dist/cost/shared/usage-totals.js +22 -18
  74. package/dist/memory/cite.js +182 -11
  75. package/dist/memory/memorized.js +217 -11
  76. package/dist/memory/recall.js +296 -17
  77. package/dist/memory/shared/host-label.js +19 -22
  78. package/dist/memory/shared/source-mark.js +39 -3
  79. package/dist/memory/sources.js +255 -13
  80. package/dist/shared/decision-summary.js +133 -14
  81. package/dist/shared/panel-empty.js +78 -3
  82. package/dist/shared/panel.js +243 -13
  83. package/dist/shared/status-dot.js +38 -8
  84. package/dist/shared/virtual/use-list-virtualizer.d.ts +24 -0
  85. package/dist/shared/virtual/use-list-virtualizer.js +68 -0
  86. package/dist/thread/actions/action-button.js +65 -3
  87. package/dist/thread/actions/actions.js +184 -13
  88. package/dist/thread/actions/branch-switcher.js +102 -5
  89. package/dist/thread/canvas/canvas.js +205 -5
  90. package/dist/thread/canvas/version-switcher.js +149 -8
  91. package/dist/thread/code/code.js +186 -24
  92. package/dist/thread/code/copy-code-button.js +61 -13
  93. package/dist/thread/code/highlight.js +30 -29
  94. package/dist/thread/history/history-rows.d.ts +16 -0
  95. package/dist/thread/history/history-rows.js +23 -0
  96. package/dist/thread/history/history.d.ts +3 -2
  97. package/dist/thread/history/history.js +174 -5
  98. package/dist/thread/history/{history-row.d.ts → row/history-row.d.ts} +3 -2
  99. package/dist/thread/history/row/history-row.js +137 -0
  100. package/dist/thread/history/row/thread-item-menu.js +84 -0
  101. package/dist/thread/history/row/thread-title-editor.js +81 -0
  102. package/dist/thread/history/thread-groups.d.ts +1 -1
  103. package/dist/thread/history/thread-groups.js +40 -34
  104. package/dist/thread/history/virtual-history-list.d.ts +11 -0
  105. package/dist/thread/history/virtual-history-list.js +107 -0
  106. package/dist/thread/index.d.ts +1 -1
  107. package/dist/thread/starters/starters.js +92 -7
  108. package/dist/thread/use-copied.js +45 -15
  109. package/dist/types.js +1 -1
  110. package/package.json +6 -4
  111. package/dist/thread/history/history-row.js +0 -17
  112. package/dist/thread/history/thread-item-menu.js +0 -6
  113. package/dist/thread/history/thread-title-editor.js +0 -25
  114. /package/dist/thread/history/{thread-item-menu.d.ts → row/thread-item-menu.d.ts} +0 -0
  115. /package/dist/thread/history/{thread-title-editor.d.ts → row/thread-title-editor.d.ts} +0 -0
@@ -1,5 +1,67 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { c as _c } from "react/compiler-runtime";
2
2
  import { Button, Tooltip, TooltipContent, TooltipTrigger } from "@locusgraph/components";
3
- export function ActionButton({ label, children, ...props }) {
4
- return (_jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx(Button, { type: "button", variant: "ghost", size: "icon-sm", "aria-label": label, className: "text-muted-foreground hover:bg-accent hover:text-foreground [&_svg]:size-4", ...props, children: children }) }), _jsx(TooltipContent, { children: label })] }));
3
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
4
+ export function ActionButton(t0) {
5
+ const $ = _c(13);
6
+ let children;
7
+ let label;
8
+ let props;
9
+ if ($[0] !== t0) {
10
+ ({
11
+ label,
12
+ children,
13
+ ...props
14
+ } = t0);
15
+ $[0] = t0;
16
+ $[1] = children;
17
+ $[2] = label;
18
+ $[3] = props;
19
+ } else {
20
+ children = $[1];
21
+ label = $[2];
22
+ props = $[3];
23
+ }
24
+ let t1;
25
+ if ($[4] !== children || $[5] !== label || $[6] !== props) {
26
+ t1 = /*#__PURE__*/_jsx(TooltipTrigger, {
27
+ asChild: true,
28
+ children: /*#__PURE__*/_jsx(Button, {
29
+ type: "button",
30
+ variant: "ghost",
31
+ size: "icon-sm",
32
+ "aria-label": label,
33
+ className: "text-muted-foreground hover:bg-accent hover:text-foreground [&_svg]:size-4",
34
+ ...props,
35
+ children: children
36
+ })
37
+ });
38
+ $[4] = children;
39
+ $[5] = label;
40
+ $[6] = props;
41
+ $[7] = t1;
42
+ } else {
43
+ t1 = $[7];
44
+ }
45
+ let t2;
46
+ if ($[8] !== label) {
47
+ t2 = /*#__PURE__*/_jsx(TooltipContent, {
48
+ children: label
49
+ });
50
+ $[8] = label;
51
+ $[9] = t2;
52
+ } else {
53
+ t2 = $[9];
54
+ }
55
+ let t3;
56
+ if ($[10] !== t1 || $[11] !== t2) {
57
+ t3 = /*#__PURE__*/_jsxs(Tooltip, {
58
+ children: [t1, t2]
59
+ });
60
+ $[10] = t1;
61
+ $[11] = t2;
62
+ $[12] = t3;
63
+ } else {
64
+ t3 = $[12];
65
+ }
66
+ return t3;
5
67
  }
@@ -1,21 +1,192 @@
1
1
  "use client";
2
- import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { Checkmark as CheckIcon, Copy as CopyIcon, Renew as RefreshCwIcon, ThumbsDown as ThumbsDownIcon, ThumbsUp as ThumbsUpIcon, } from "@carbon/icons-react";
2
+
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";
4
5
  import { cn, TooltipProvider } from "@locusgraph/components";
5
6
  import { useCopied } from "../use-copied.js";
6
7
  import { ActionButton } from "./action-button.js";
7
8
  import { BranchSwitcher } from "./branch-switcher.js";
9
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
8
10
  function toggledFeedback(current, chosen) {
9
- return current === chosen ? null : chosen;
11
+ return current === chosen ? null : chosen;
10
12
  }
11
- export function Actions({ onCopy, onRetry, feedback = null, onFeedback, branch, onBranchChange, className, ...props }) {
12
- const { copied, markCopied } = useCopied();
13
- const showBranch = branch !== undefined && branch.count > 1 && onBranchChange !== undefined;
14
- if (!onCopy && !onRetry && !onFeedback && !showBranch) {
15
- return null;
16
- }
17
- return (_jsx(TooltipProvider, { children: _jsxs("div", { "data-slot": "actions", role: "toolbar", "aria-label": "Message actions", className: cn("flex items-center gap-0.5", className), ...props, children: [showBranch && _jsx(BranchSwitcher, { branch: branch, onBranchChange: onBranchChange }), showBranch && (onCopy || onRetry || onFeedback) && (_jsx("span", { "aria-hidden": true, className: "mx-1 h-3.5 w-px bg-border" })), onCopy && (_jsx(ActionButton, { label: copied ? "Copied" : "Copy", onClick: () => {
18
- onCopy();
19
- markCopied();
20
- }, children: copied ? _jsx(CheckIcon, { className: "text-good" }) : _jsx(CopyIcon, {}) })), onRetry && (_jsx(ActionButton, { label: "Retry", onClick: onRetry, children: _jsx(RefreshCwIcon, {}) })), onFeedback && (_jsxs(_Fragment, { children: [_jsx(ActionButton, { label: "Good response", "aria-pressed": feedback === "up", className: cn(feedback === "up" && "text-foreground"), onClick: () => onFeedback(toggledFeedback(feedback, "up")), children: _jsx(ThumbsUpIcon, { className: cn(feedback === "up" && "fill-current") }) }), _jsx(ActionButton, { label: "Bad response", "aria-pressed": feedback === "down", className: cn(feedback === "down" && "text-foreground"), onClick: () => onFeedback(toggledFeedback(feedback, "down")), children: _jsx(ThumbsDownIcon, { className: cn(feedback === "down" && "fill-current") }) })] })), copied && (_jsx("span", { role: "status", className: "sr-only", children: "Copied" }))] }) }));
13
+ export function Actions(t0) {
14
+ const $ = _c(40);
15
+ let branch;
16
+ let className;
17
+ let onBranchChange;
18
+ let onCopy;
19
+ let onFeedback;
20
+ let onRetry;
21
+ let props;
22
+ let t1;
23
+ if ($[0] !== t0) {
24
+ ({
25
+ onCopy,
26
+ onRetry,
27
+ feedback: t1,
28
+ onFeedback,
29
+ branch,
30
+ onBranchChange,
31
+ className,
32
+ ...props
33
+ } = t0);
34
+ $[0] = t0;
35
+ $[1] = branch;
36
+ $[2] = className;
37
+ $[3] = onBranchChange;
38
+ $[4] = onCopy;
39
+ $[5] = onFeedback;
40
+ $[6] = onRetry;
41
+ $[7] = props;
42
+ $[8] = t1;
43
+ } else {
44
+ branch = $[1];
45
+ className = $[2];
46
+ onBranchChange = $[3];
47
+ onCopy = $[4];
48
+ onFeedback = $[5];
49
+ onRetry = $[6];
50
+ props = $[7];
51
+ t1 = $[8];
52
+ }
53
+ const feedback = t1 === undefined ? null : t1;
54
+ const {
55
+ copied,
56
+ markCopied
57
+ } = useCopied();
58
+ const showBranch = branch !== undefined && branch.count > 1 && onBranchChange !== undefined;
59
+ if (!onCopy && !onRetry && !onFeedback && !showBranch) {
60
+ return null;
61
+ }
62
+ let t2;
63
+ if ($[9] !== className) {
64
+ t2 = cn("flex items-center gap-0.5", className);
65
+ $[9] = className;
66
+ $[10] = t2;
67
+ } else {
68
+ t2 = $[10];
69
+ }
70
+ let t3;
71
+ if ($[11] !== branch || $[12] !== onBranchChange || $[13] !== showBranch) {
72
+ t3 = showBranch && /*#__PURE__*/_jsx(BranchSwitcher, {
73
+ branch: branch,
74
+ onBranchChange: onBranchChange
75
+ });
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;
94
+ } else {
95
+ t4 = $[19];
96
+ }
97
+ let t5;
98
+ if ($[20] !== copied || $[21] !== markCopied || $[22] !== onCopy) {
99
+ t5 = onCopy && /*#__PURE__*/_jsx(ActionButton, {
100
+ label: copied ? "Copied" : "Copy",
101
+ onClick: () => {
102
+ onCopy();
103
+ markCopied();
104
+ },
105
+ children: copied ? /*#__PURE__*/_jsx(CheckIcon, {
106
+ className: "text-good"
107
+ }) : /*#__PURE__*/_jsx(CopyIcon, {})
108
+ });
109
+ $[20] = copied;
110
+ $[21] = markCopied;
111
+ $[22] = onCopy;
112
+ $[23] = t5;
113
+ } else {
114
+ t5 = $[23];
115
+ }
116
+ let t6;
117
+ if ($[24] !== onRetry) {
118
+ t6 = onRetry && /*#__PURE__*/_jsx(ActionButton, {
119
+ label: "Retry",
120
+ onClick: onRetry,
121
+ children: /*#__PURE__*/_jsx(RefreshCwIcon, {})
122
+ });
123
+ $[24] = onRetry;
124
+ $[25] = t6;
125
+ } else {
126
+ t6 = $[25];
127
+ }
128
+ let t7;
129
+ if ($[26] !== feedback || $[27] !== onFeedback) {
130
+ t7 = onFeedback && /*#__PURE__*/_jsxs(_Fragment, {
131
+ children: [/*#__PURE__*/_jsx(ActionButton, {
132
+ label: "Good response",
133
+ "aria-pressed": feedback === "up",
134
+ className: cn(feedback === "up" && "text-foreground"),
135
+ onClick: () => onFeedback(toggledFeedback(feedback, "up")),
136
+ children: /*#__PURE__*/_jsx(ThumbsUpIcon, {
137
+ className: cn(feedback === "up" && "fill-current")
138
+ })
139
+ }), /*#__PURE__*/_jsx(ActionButton, {
140
+ label: "Bad response",
141
+ "aria-pressed": feedback === "down",
142
+ className: cn(feedback === "down" && "text-foreground"),
143
+ onClick: () => onFeedback(toggledFeedback(feedback, "down")),
144
+ children: /*#__PURE__*/_jsx(ThumbsDownIcon, {
145
+ className: cn(feedback === "down" && "fill-current")
146
+ })
147
+ })]
148
+ });
149
+ $[26] = feedback;
150
+ $[27] = onFeedback;
151
+ $[28] = t7;
152
+ } else {
153
+ t7 = $[28];
154
+ }
155
+ let t8;
156
+ if ($[29] !== copied) {
157
+ t8 = copied && /*#__PURE__*/_jsx("span", {
158
+ role: "status",
159
+ className: "sr-only",
160
+ children: "Copied"
161
+ });
162
+ $[29] = copied;
163
+ $[30] = t8;
164
+ } else {
165
+ t8 = $[30];
166
+ }
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, {
170
+ children: /*#__PURE__*/_jsxs("div", {
171
+ "data-slot": "actions",
172
+ role: "toolbar",
173
+ "aria-label": "Message actions",
174
+ className: t2,
175
+ ...props,
176
+ children: [t3, t4, t5, t6, t7, t8]
177
+ })
178
+ });
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;
188
+ } else {
189
+ t9 = $[39];
190
+ }
191
+ return t9;
21
192
  }
@@ -1,7 +1,104 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { ChevronLeft as ChevronLeftIcon, ChevronRight as ChevronRightIcon, } from "@carbon/icons-react";
1
+ import { c as _c } from "react/compiler-runtime";
2
+ import { ChevronLeft as ChevronLeftIcon, ChevronRight as ChevronRightIcon } from "@carbon/icons-react";
3
3
  import { ActionButton } from "./action-button.js";
4
- export function BranchSwitcher({ branch, onBranchChange }) {
5
- const position = branch.index + 1;
6
- return (_jsxs("div", { "data-slot": "branch-switcher", role: "group", "aria-label": "Reply versions", className: "flex items-center", children: [_jsx(ActionButton, { label: "Previous version", disabled: branch.index <= 0, onClick: () => onBranchChange(branch.index - 1), children: _jsx(ChevronLeftIcon, {}) }), _jsx("span", { "aria-live": "polite", className: "min-w-9 text-center font-mono text-xs text-muted-foreground tabular-nums", children: `${position} / ${branch.count}` }), _jsx(ActionButton, { label: "Next version", disabled: position >= branch.count, onClick: () => onBranchChange(branch.index + 1), children: _jsx(ChevronRightIcon, {}) })] }));
4
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
5
+ export function BranchSwitcher(t0) {
6
+ const $ = _c(20);
7
+ const {
8
+ branch,
9
+ onBranchChange
10
+ } = t0;
11
+ const position = branch.index + 1;
12
+ const t1 = branch.index <= 0;
13
+ let t2;
14
+ if ($[0] !== branch.index || $[1] !== onBranchChange) {
15
+ t2 = () => onBranchChange(branch.index - 1);
16
+ $[0] = branch.index;
17
+ $[1] = onBranchChange;
18
+ $[2] = t2;
19
+ } else {
20
+ t2 = $[2];
21
+ }
22
+ let t3;
23
+ if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
24
+ t3 = /*#__PURE__*/_jsx(ChevronLeftIcon, {});
25
+ $[3] = t3;
26
+ } else {
27
+ t3 = $[3];
28
+ }
29
+ let t4;
30
+ if ($[4] !== t1 || $[5] !== t2) {
31
+ t4 = /*#__PURE__*/_jsx(ActionButton, {
32
+ label: "Previous version",
33
+ disabled: t1,
34
+ onClick: t2,
35
+ children: t3
36
+ });
37
+ $[4] = t1;
38
+ $[5] = t2;
39
+ $[6] = t4;
40
+ } else {
41
+ t4 = $[6];
42
+ }
43
+ const t5 = `${position} / ${branch.count}`;
44
+ let t6;
45
+ if ($[7] !== t5) {
46
+ t6 = /*#__PURE__*/_jsx("span", {
47
+ "aria-live": "polite",
48
+ className: "min-w-9 text-center font-mono text-xs text-muted-foreground tabular-nums",
49
+ children: t5
50
+ });
51
+ $[7] = t5;
52
+ $[8] = t6;
53
+ } else {
54
+ t6 = $[8];
55
+ }
56
+ const t7 = position >= branch.count;
57
+ let t8;
58
+ if ($[9] !== branch.index || $[10] !== onBranchChange) {
59
+ t8 = () => onBranchChange(branch.index + 1);
60
+ $[9] = branch.index;
61
+ $[10] = onBranchChange;
62
+ $[11] = t8;
63
+ } else {
64
+ t8 = $[11];
65
+ }
66
+ let t9;
67
+ if ($[12] === Symbol.for("react.memo_cache_sentinel")) {
68
+ t9 = /*#__PURE__*/_jsx(ChevronRightIcon, {});
69
+ $[12] = t9;
70
+ } else {
71
+ t9 = $[12];
72
+ }
73
+ let t10;
74
+ if ($[13] !== t7 || $[14] !== t8) {
75
+ t10 = /*#__PURE__*/_jsx(ActionButton, {
76
+ label: "Next version",
77
+ disabled: t7,
78
+ onClick: t8,
79
+ children: t9
80
+ });
81
+ $[13] = t7;
82
+ $[14] = t8;
83
+ $[15] = t10;
84
+ } else {
85
+ t10 = $[15];
86
+ }
87
+ let t11;
88
+ if ($[16] !== t10 || $[17] !== t4 || $[18] !== t6) {
89
+ t11 = /*#__PURE__*/_jsxs("div", {
90
+ "data-slot": "branch-switcher",
91
+ role: "group",
92
+ "aria-label": "Reply versions",
93
+ className: "flex items-center",
94
+ children: [t4, t6, t10]
95
+ });
96
+ $[16] = t10;
97
+ $[17] = t4;
98
+ $[18] = t6;
99
+ $[19] = t11;
100
+ } else {
101
+ t11 = $[19];
102
+ }
103
+ return t11;
7
104
  }
@@ -1,12 +1,212 @@
1
1
  "use client";
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+
3
+ import { c as _c } from "react/compiler-runtime";
3
4
  import { Close as XIcon } from "@carbon/icons-react";
4
5
  import { Button, cn, ScrollArea } from "@locusgraph/components";
5
6
  import { VersionSwitcher } from "./version-switcher.js";
7
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
6
8
  function currentVersionOf(versions, versionId) {
7
- return versions.find((version) => version.id === versionId) ?? versions.at(-1);
9
+ return versions.find(version => version.id === versionId) ?? versions.at(-1);
8
10
  }
9
- export function Canvas({ title, kind, versions = [], versionId, onVersionChange, actions, onClose, children, className, ...props }) {
10
- const current = currentVersionOf(versions, versionId);
11
- return (_jsxs("aside", { "data-slot": "canvas", "aria-label": title, className: cn("flex h-full min-h-0 min-w-0 flex-col bg-card text-card-foreground ring-1 ring-border", className), ...props, children: [_jsxs("header", { className: "flex items-start gap-3 border-b px-5 pt-3.5 pb-3", children: [_jsxs("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [kind && _jsx("span", { className: "eyebrow", children: kind }), _jsx("h2", { className: "truncate font-sans text-base leading-snug font-semibold tracking-tight", children: title })] }), _jsxs("div", { className: "-mr-2 flex shrink-0 items-center gap-0.5 text-muted-foreground", children: [actions, onClose && (_jsx(Button, { type: "button", variant: "ghost", size: "icon-sm", "aria-label": "Close panel", className: "text-muted-foreground hover:text-foreground", onClick: onClose, children: _jsx(XIcon, {}) }))] })] }), _jsx(ScrollArea, { className: "min-h-0 flex-1", children: _jsx("div", { "data-slot": "canvas-content", className: "px-5 py-4 has-[>[data-slot=code]:only-child]:p-0 [&>[data-slot=code]:only-child]:ring-0", children: children }) }), current && (_jsx("footer", { className: "flex h-10 items-center gap-2 border-t bg-muted/30 pr-3 pl-5", children: _jsx(VersionSwitcher, { versions: versions, current: current, onVersionChange: onVersionChange }) }))] }));
11
+ export function Canvas(t0) {
12
+ const $ = _c(46);
13
+ let actions;
14
+ let children;
15
+ let className;
16
+ let kind;
17
+ let onClose;
18
+ let onVersionChange;
19
+ let props;
20
+ let t1;
21
+ let title;
22
+ let versionId;
23
+ if ($[0] !== t0) {
24
+ ({
25
+ title,
26
+ kind,
27
+ versions: t1,
28
+ versionId,
29
+ onVersionChange,
30
+ actions,
31
+ onClose,
32
+ children,
33
+ className,
34
+ ...props
35
+ } = t0);
36
+ $[0] = t0;
37
+ $[1] = actions;
38
+ $[2] = children;
39
+ $[3] = className;
40
+ $[4] = kind;
41
+ $[5] = onClose;
42
+ $[6] = onVersionChange;
43
+ $[7] = props;
44
+ $[8] = t1;
45
+ $[9] = title;
46
+ $[10] = versionId;
47
+ } else {
48
+ actions = $[1];
49
+ children = $[2];
50
+ className = $[3];
51
+ kind = $[4];
52
+ onClose = $[5];
53
+ onVersionChange = $[6];
54
+ props = $[7];
55
+ t1 = $[8];
56
+ title = $[9];
57
+ versionId = $[10];
58
+ }
59
+ let t2;
60
+ if ($[11] !== t1) {
61
+ t2 = t1 === undefined ? [] : t1;
62
+ $[11] = t1;
63
+ $[12] = t2;
64
+ } else {
65
+ t2 = $[12];
66
+ }
67
+ const versions = t2;
68
+ let t3;
69
+ if ($[13] !== versionId || $[14] !== versions) {
70
+ t3 = currentVersionOf(versions, versionId);
71
+ $[13] = versionId;
72
+ $[14] = versions;
73
+ $[15] = t3;
74
+ } else {
75
+ t3 = $[15];
76
+ }
77
+ const current = t3;
78
+ let t4;
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);
81
+ $[16] = className;
82
+ $[17] = t4;
83
+ } else {
84
+ t4 = $[17];
85
+ }
86
+ let t5;
87
+ if ($[18] !== kind) {
88
+ t5 = kind && /*#__PURE__*/_jsx("span", {
89
+ className: "eyebrow",
90
+ children: kind
91
+ });
92
+ $[18] = kind;
93
+ $[19] = t5;
94
+ } else {
95
+ t5 = $[19];
96
+ }
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
102
+ });
103
+ $[20] = title;
104
+ $[21] = t6;
105
+ } else {
106
+ t6 = $[21];
107
+ }
108
+ let t7;
109
+ if ($[22] !== t5 || $[23] !== t6) {
110
+ t7 = /*#__PURE__*/_jsxs("div", {
111
+ className: "flex min-w-0 flex-1 flex-col gap-1",
112
+ children: [t5, t6]
113
+ });
114
+ $[22] = t5;
115
+ $[23] = t6;
116
+ $[24] = t7;
117
+ } else {
118
+ t7 = $[24];
119
+ }
120
+ let t8;
121
+ if ($[25] !== onClose) {
122
+ t8 = onClose && /*#__PURE__*/_jsx(Button, {
123
+ type: "button",
124
+ variant: "ghost",
125
+ size: "icon-sm",
126
+ "aria-label": "Close panel",
127
+ className: "text-muted-foreground hover:text-foreground",
128
+ onClick: onClose,
129
+ children: /*#__PURE__*/_jsx(XIcon, {})
130
+ });
131
+ $[25] = onClose;
132
+ $[26] = t8;
133
+ } else {
134
+ t8 = $[26];
135
+ }
136
+ let t9;
137
+ if ($[27] !== actions || $[28] !== t8) {
138
+ t9 = /*#__PURE__*/_jsxs("div", {
139
+ className: "-mr-2 flex shrink-0 items-center gap-0.5 text-muted-foreground",
140
+ children: [actions, t8]
141
+ });
142
+ $[27] = actions;
143
+ $[28] = t8;
144
+ $[29] = t9;
145
+ } else {
146
+ t9 = $[29];
147
+ }
148
+ let t10;
149
+ if ($[30] !== t7 || $[31] !== t9) {
150
+ t10 = /*#__PURE__*/_jsxs("header", {
151
+ className: "flex items-start gap-3 border-b px-5 pt-3.5 pb-3",
152
+ children: [t7, t9]
153
+ });
154
+ $[30] = t7;
155
+ $[31] = t9;
156
+ $[32] = t10;
157
+ } else {
158
+ t10 = $[32];
159
+ }
160
+ let t11;
161
+ if ($[33] !== children) {
162
+ t11 = /*#__PURE__*/_jsx(ScrollArea, {
163
+ className: "min-h-0 flex-1",
164
+ children: /*#__PURE__*/_jsx("div", {
165
+ "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",
167
+ children: children
168
+ })
169
+ });
170
+ $[33] = children;
171
+ $[34] = t11;
172
+ } else {
173
+ t11 = $[34];
174
+ }
175
+ 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", {
195
+ "data-slot": "canvas",
196
+ "aria-label": title,
197
+ className: t4,
198
+ ...props,
199
+ children: [t10, t11, t12]
200
+ });
201
+ $[39] = props;
202
+ $[40] = t10;
203
+ $[41] = t11;
204
+ $[42] = t12;
205
+ $[43] = t4;
206
+ $[44] = title;
207
+ $[45] = t13;
208
+ } else {
209
+ t13 = $[45];
210
+ }
211
+ return t13;
12
212
  }