@locusgraph/loop 0.3.1 → 0.4.1
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 +6 -5
- package/dist/agent/pulse/marks/bars-mark.js +1 -1
- package/dist/agent/pulse/marks/glyph-mark.js +2 -2
- package/dist/agent/pulse/marks/locus-mark.js +1 -1
- 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 +1 -3
- 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 +135 -200
- package/dist/approval/inbox/inbox.d.ts +3 -3
- package/dist/approval/inbox/inbox.js +180 -139
- package/dist/approval/inbox/virtual-inbox-list.d.ts +3 -3
- package/dist/approval/inbox/virtual-inbox-list.js +20 -21
- package/dist/approval/memory/memory-review.js +155 -154
- package/dist/approval/memory/memory-row.js +86 -87
- package/dist/approval/plan/plan-review.js +110 -129
- package/dist/approval/plan/plan-step-row.js +7 -6
- 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 +10 -7
- package/dist/approval/plan/question.js +116 -112
- package/dist/approval/run/run-bar.js +43 -40
- 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-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 +134 -126
- package/dist/approval/spend/spend-gate.js +133 -156
- 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 +114 -214
- package/dist/approval/tool/args/args-editor.js +147 -156
- package/dist/approval/tool/args/args-field.js +197 -109
- package/dist/approval/tool/deny-form.js +59 -66
- package/dist/approval/tool/tool-inputs.js +38 -45
- package/dist/chat/chat/chat.js +5 -4
- package/dist/chat/chat/use-stick-to-bottom.js +1 -3
- package/dist/chat/composer/composer-actions.js +4 -1
- package/dist/chat/composer/composer.js +4 -3
- package/dist/chat/composer/use-auto-grow.js +14 -10
- package/dist/chat/files/files.js +12 -10
- 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 +5 -4
- 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 +55 -47
- package/dist/memory/memorized.js +123 -108
- package/dist/memory/recall.js +136 -146
- 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 +135 -100
- 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/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 +67 -37
- 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 +106 -87
- 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 +56 -25
- 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 +8 -5
- package/dist/thread/history/row/thread-item-menu.js +13 -4
- package/dist/thread/history/row/thread-title-editor.js +1 -1
- package/dist/thread/history/virtual-history-list.js +1 -2
- package/dist/thread/index.d.ts +1 -0
- package/dist/thread/index.js +1 -0
- package/dist/thread/starters/starters.js +5 -4
- 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,13 +1,15 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import { c as _c } from "react/compiler-runtime";
|
|
4
|
-
import {
|
|
5
|
-
import { Button } from "@locusgraph/components";
|
|
4
|
+
import { Button, cn } from "@locusgraph/components";
|
|
6
5
|
import { pluralize } from "@locusgraph/utils";
|
|
6
|
+
import { ArrowRight as ArrowRightIcon, ListChecks as ListChecksIcon } from "@phosphor-icons/react/ssr";
|
|
7
7
|
import { useEffect, useId, useState } from "react";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
8
|
+
import { DecisionSummary } from "../../shared/decision-summary.js";
|
|
9
|
+
import { LiveStatus } from "../../shared/live-status.js";
|
|
10
|
+
import { ApprovalHeadline, SettledLine } from "../shared/approval-line.js";
|
|
10
11
|
import { useFocusOnMount } from "../shared/use-focus-on-mount.js";
|
|
12
|
+
import { useFocusWhenSettled } from "../shared/use-focus-when-settled.js";
|
|
11
13
|
import { PlanStepRow, stepControlId } from "./plan-step-row.js";
|
|
12
14
|
import { applyStepAction, describeStepAction, focusAfterAction } from "./plan-steps.js";
|
|
13
15
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
@@ -27,7 +29,7 @@ function DecidedSteps(t0) {
|
|
|
27
29
|
let t2;
|
|
28
30
|
if ($[2] !== t1) {
|
|
29
31
|
t2 = /*#__PURE__*/_jsx("ol", {
|
|
30
|
-
className: "flex flex-col gap-1
|
|
32
|
+
className: "flex flex-col gap-1 pt-2 text-sm text-muted-foreground",
|
|
31
33
|
children: t1
|
|
32
34
|
});
|
|
33
35
|
$[2] = t1;
|
|
@@ -41,7 +43,7 @@ function _temp(step, position) {
|
|
|
41
43
|
return /*#__PURE__*/_jsxs("li", {
|
|
42
44
|
className: "flex gap-3",
|
|
43
45
|
children: [/*#__PURE__*/_jsx("span", {
|
|
44
|
-
className: "w-4 shrink-0
|
|
46
|
+
className: "w-4 shrink-0 text-xs leading-5 text-faint tabular-nums",
|
|
45
47
|
children: position + 1
|
|
46
48
|
}), /*#__PURE__*/_jsx("span", {
|
|
47
49
|
className: "min-w-0",
|
|
@@ -50,7 +52,7 @@ function _temp(step, position) {
|
|
|
50
52
|
}, step.id);
|
|
51
53
|
}
|
|
52
54
|
export function PlanReview(t0) {
|
|
53
|
-
const $ = _c(
|
|
55
|
+
const $ = _c(36);
|
|
54
56
|
const {
|
|
55
57
|
steps: initialSteps,
|
|
56
58
|
title: t1,
|
|
@@ -70,6 +72,7 @@ export function PlanReview(t0) {
|
|
|
70
72
|
const [announcement, setAnnouncement] = useState("");
|
|
71
73
|
const [pendingFocus, setPendingFocus] = useState(null);
|
|
72
74
|
const approveRef = useFocusOnMount(autoFocus && !decision);
|
|
75
|
+
const settleRef = useFocusWhenSettled(!decision);
|
|
73
76
|
let t4;
|
|
74
77
|
if ($[0] !== steps) {
|
|
75
78
|
t4 = steps.some(_temp2);
|
|
@@ -100,7 +103,7 @@ export function PlanReview(t0) {
|
|
|
100
103
|
if ($[5] !== idPrefix || $[6] !== steps) {
|
|
101
104
|
t7 = function handleAction(stepId, position, action) {
|
|
102
105
|
const next = applyStepAction(steps, stepId, action);
|
|
103
|
-
const focus = focusAfterAction(next, stepId, action);
|
|
106
|
+
const focus = focusAfterAction(next, stepId, action, position);
|
|
104
107
|
setSteps(next);
|
|
105
108
|
setAnnouncement(describeStepAction(position, action));
|
|
106
109
|
setPendingFocus(focus ? {
|
|
@@ -127,58 +130,35 @@ export function PlanReview(t0) {
|
|
|
127
130
|
t8 = $[8];
|
|
128
131
|
}
|
|
129
132
|
const renameStep = t8;
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
});
|
|
136
|
-
$[9] = t10;
|
|
137
|
-
} else {
|
|
138
|
-
t10 = $[9];
|
|
139
|
-
}
|
|
140
|
-
const t11 = decision ? decision.approved ? "Approved" : "Cancelled" : "Waiting for you";
|
|
141
|
-
const t12 = decision ? decision.approved ? "done" : "danger" : "waiting";
|
|
142
|
-
let t13;
|
|
143
|
-
if ($[10] !== steps.length) {
|
|
144
|
-
t13 = pluralize(steps.length, "step");
|
|
145
|
-
$[10] = steps.length;
|
|
146
|
-
$[11] = t13;
|
|
133
|
+
let t9;
|
|
134
|
+
if ($[9] !== steps.length) {
|
|
135
|
+
t9 = pluralize(steps.length, "step");
|
|
136
|
+
$[9] = steps.length;
|
|
137
|
+
$[10] = t9;
|
|
147
138
|
} else {
|
|
148
|
-
|
|
139
|
+
t9 = $[10];
|
|
149
140
|
}
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
aside: t13
|
|
158
|
-
});
|
|
141
|
+
const stepCount = t9;
|
|
142
|
+
const t10 = decision ? true : undefined;
|
|
143
|
+
const t11 = !decision && "gap-3";
|
|
144
|
+
let t12;
|
|
145
|
+
if ($[11] !== className || $[12] !== t11) {
|
|
146
|
+
t12 = cn("flex min-w-0 flex-col outline-none", t11, className);
|
|
147
|
+
$[11] = className;
|
|
159
148
|
$[12] = t11;
|
|
160
149
|
$[13] = t12;
|
|
161
|
-
$[14] = t13;
|
|
162
|
-
$[15] = t14;
|
|
163
150
|
} else {
|
|
164
|
-
|
|
151
|
+
t12 = $[13];
|
|
165
152
|
}
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
$[18] = t16;
|
|
176
|
-
} else {
|
|
177
|
-
t16 = $[18];
|
|
178
|
-
}
|
|
179
|
-
let t17;
|
|
180
|
-
if ($[19] !== actionLabel || $[20] !== approveRef || $[21] !== decision || $[22] !== description || $[23] !== handleAction || $[24] !== hasBlankTitle || $[25] !== idPrefix || $[26] !== initialSteps || $[27] !== onApprove || $[28] !== onCancel || $[29] !== steps) {
|
|
181
|
-
t17 = decision ? /*#__PURE__*/_jsxs(PanelBody, {
|
|
153
|
+
let t13;
|
|
154
|
+
if ($[14] !== actionLabel || $[15] !== approveRef || $[16] !== decision || $[17] !== description || $[18] !== handleAction || $[19] !== hasBlankTitle || $[20] !== idPrefix || $[21] !== initialSteps || $[22] !== onApprove || $[23] !== onCancel || $[24] !== stepCount || $[25] !== steps) {
|
|
155
|
+
t13 = decision ? /*#__PURE__*/_jsxs(SettledLine, {
|
|
156
|
+
name: pluralize(initialSteps.length, "step"),
|
|
157
|
+
verb: "Planned",
|
|
158
|
+
icon: /*#__PURE__*/_jsx(ListChecksIcon, {
|
|
159
|
+
weight: "bold",
|
|
160
|
+
"aria-hidden": true
|
|
161
|
+
}),
|
|
182
162
|
children: [/*#__PURE__*/_jsx(DecisionSummary, {
|
|
183
163
|
decision: decision,
|
|
184
164
|
deniedVerb: "Cancelled",
|
|
@@ -187,98 +167,99 @@ export function PlanReview(t0) {
|
|
|
187
167
|
steps: initialSteps
|
|
188
168
|
})]
|
|
189
169
|
}) : /*#__PURE__*/_jsxs(_Fragment, {
|
|
190
|
-
children: [/*#__PURE__*/_jsx(
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
className: "-mx-5 flex flex-col divide-y border-t",
|
|
197
|
-
children: steps.map((step_0, position_0) => /*#__PURE__*/_jsx(PlanStepRow, {
|
|
198
|
-
idPrefix: idPrefix,
|
|
199
|
-
step: step_0,
|
|
200
|
-
position: position_0,
|
|
201
|
-
count: steps.length,
|
|
202
|
-
onRename: nextTitle_0 => renameStep(step_0.id, nextTitle_0),
|
|
203
|
-
onAction: action_0 => handleAction(step_0.id, position_0, action_0)
|
|
204
|
-
}, step_0.id))
|
|
170
|
+
children: [/*#__PURE__*/_jsx(ApprovalHeadline, {
|
|
171
|
+
name: stepCount,
|
|
172
|
+
action: "to run",
|
|
173
|
+
icon: /*#__PURE__*/_jsx(ListChecksIcon, {
|
|
174
|
+
weight: "bold",
|
|
175
|
+
"aria-hidden": true
|
|
205
176
|
})
|
|
206
|
-
}), /*#__PURE__*/
|
|
207
|
-
className: "
|
|
208
|
-
children:
|
|
177
|
+
}), /*#__PURE__*/_jsx("p", {
|
|
178
|
+
className: "-mt-2 text-sm text-faint",
|
|
179
|
+
children: description
|
|
180
|
+
}), /*#__PURE__*/_jsx("ol", {
|
|
181
|
+
className: "flex flex-col",
|
|
182
|
+
children: steps.map((step_0, position_0) => /*#__PURE__*/_jsx(PlanStepRow, {
|
|
183
|
+
idPrefix: idPrefix,
|
|
184
|
+
step: step_0,
|
|
185
|
+
position: position_0,
|
|
186
|
+
count: steps.length,
|
|
187
|
+
onRename: nextTitle_0 => renameStep(step_0.id, nextTitle_0),
|
|
188
|
+
onAction: action_0 => handleAction(step_0.id, position_0, action_0)
|
|
189
|
+
}, step_0.id))
|
|
190
|
+
}), /*#__PURE__*/_jsxs("div", {
|
|
191
|
+
className: "flex flex-wrap items-center gap-2 pt-1",
|
|
192
|
+
children: [/*#__PURE__*/_jsxs(Button, {
|
|
193
|
+
ref: approveRef,
|
|
194
|
+
type: "button",
|
|
195
|
+
size: "sm",
|
|
196
|
+
disabled: hasBlankTitle || steps.length === 0,
|
|
197
|
+
onClick: () => onApprove(steps.map(_temp3)),
|
|
198
|
+
children: [actionLabel ?? `Run ${stepCount}`, /*#__PURE__*/_jsx(ArrowRightIcon, {
|
|
199
|
+
weight: "bold",
|
|
200
|
+
"aria-hidden": true
|
|
201
|
+
})]
|
|
202
|
+
}), /*#__PURE__*/_jsx(Button, {
|
|
203
|
+
type: "button",
|
|
204
|
+
size: "sm",
|
|
205
|
+
variant: "ghost",
|
|
206
|
+
onClick: onCancel,
|
|
207
|
+
children: "Cancel"
|
|
208
|
+
}), hasBlankTitle && /*#__PURE__*/_jsx("span", {
|
|
209
209
|
className: "text-xs text-destructive",
|
|
210
210
|
children: "Every step needs a title."
|
|
211
|
-
}) : /*#__PURE__*/_jsx("span", {
|
|
212
|
-
className: "hidden font-mono text-[11px] text-muted-foreground sm:inline",
|
|
213
|
-
children: "The run starts when you approve"
|
|
214
|
-
}), /*#__PURE__*/_jsxs("span", {
|
|
215
|
-
className: "ml-auto flex gap-2",
|
|
216
|
-
children: [/*#__PURE__*/_jsx(Button, {
|
|
217
|
-
type: "button",
|
|
218
|
-
size: "sm",
|
|
219
|
-
variant: "ghost",
|
|
220
|
-
onClick: onCancel,
|
|
221
|
-
children: "Cancel"
|
|
222
|
-
}), /*#__PURE__*/_jsxs(Button, {
|
|
223
|
-
ref: approveRef,
|
|
224
|
-
type: "button",
|
|
225
|
-
size: "sm",
|
|
226
|
-
disabled: hasBlankTitle || steps.length === 0,
|
|
227
|
-
onClick: () => onApprove(steps.map(_temp3)),
|
|
228
|
-
children: [actionLabel ?? `Run ${pluralize(steps.length, "step")}`, /*#__PURE__*/_jsx(ArrowRightIcon, {
|
|
229
|
-
"aria-hidden": true
|
|
230
|
-
})]
|
|
231
|
-
})]
|
|
232
211
|
})]
|
|
233
212
|
})]
|
|
234
213
|
});
|
|
235
|
-
$[
|
|
236
|
-
$[
|
|
237
|
-
$[
|
|
238
|
-
$[
|
|
239
|
-
$[
|
|
240
|
-
$[
|
|
241
|
-
$[
|
|
242
|
-
$[
|
|
243
|
-
$[
|
|
244
|
-
$[
|
|
245
|
-
$[
|
|
246
|
-
$[
|
|
214
|
+
$[14] = actionLabel;
|
|
215
|
+
$[15] = approveRef;
|
|
216
|
+
$[16] = decision;
|
|
217
|
+
$[17] = description;
|
|
218
|
+
$[18] = handleAction;
|
|
219
|
+
$[19] = hasBlankTitle;
|
|
220
|
+
$[20] = idPrefix;
|
|
221
|
+
$[21] = initialSteps;
|
|
222
|
+
$[22] = onApprove;
|
|
223
|
+
$[23] = onCancel;
|
|
224
|
+
$[24] = stepCount;
|
|
225
|
+
$[25] = steps;
|
|
226
|
+
$[26] = t13;
|
|
247
227
|
} else {
|
|
248
|
-
|
|
228
|
+
t13 = $[26];
|
|
249
229
|
}
|
|
250
|
-
const
|
|
251
|
-
let
|
|
252
|
-
if ($[
|
|
253
|
-
|
|
254
|
-
message:
|
|
230
|
+
const t14 = decision ? decision.approved ? "Plan approved" : "Plan cancelled" : announcement;
|
|
231
|
+
let t15;
|
|
232
|
+
if ($[27] !== t14) {
|
|
233
|
+
t15 = /*#__PURE__*/_jsx(LiveStatus, {
|
|
234
|
+
message: t14
|
|
255
235
|
});
|
|
256
|
-
$[
|
|
257
|
-
$[
|
|
236
|
+
$[27] = t14;
|
|
237
|
+
$[28] = t15;
|
|
258
238
|
} else {
|
|
259
|
-
|
|
239
|
+
t15 = $[28];
|
|
260
240
|
}
|
|
261
|
-
let
|
|
262
|
-
if ($[
|
|
263
|
-
|
|
241
|
+
let t16;
|
|
242
|
+
if ($[29] !== settleRef || $[30] !== t10 || $[31] !== t12 || $[32] !== t13 || $[33] !== t15 || $[34] !== title) {
|
|
243
|
+
t16 = /*#__PURE__*/_jsxs("section", {
|
|
244
|
+
ref: settleRef,
|
|
245
|
+
tabIndex: -1,
|
|
264
246
|
"data-slot": "plan-review",
|
|
265
|
-
"data-decided":
|
|
247
|
+
"data-decided": t10,
|
|
266
248
|
"aria-label": title,
|
|
267
|
-
className:
|
|
268
|
-
children: [
|
|
249
|
+
className: t12,
|
|
250
|
+
children: [t13, t15]
|
|
269
251
|
});
|
|
270
|
-
$[
|
|
271
|
-
$[
|
|
252
|
+
$[29] = settleRef;
|
|
253
|
+
$[30] = t10;
|
|
254
|
+
$[31] = t12;
|
|
255
|
+
$[32] = t13;
|
|
256
|
+
$[33] = t15;
|
|
257
|
+
$[34] = title;
|
|
272
258
|
$[35] = t16;
|
|
273
|
-
$[36] = t17;
|
|
274
|
-
$[37] = t19;
|
|
275
|
-
$[38] = t9;
|
|
276
|
-
$[39] = title;
|
|
277
|
-
$[40] = t20;
|
|
278
259
|
} else {
|
|
279
|
-
|
|
260
|
+
t16 = $[35];
|
|
280
261
|
}
|
|
281
|
-
return
|
|
262
|
+
return t16;
|
|
282
263
|
}
|
|
283
264
|
function _temp3(step_1) {
|
|
284
265
|
return {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import { c as _c } from "react/compiler-runtime";
|
|
4
|
-
import { ArrowDown as ArrowDownIcon, ArrowUp as ArrowUpIcon, Edit as PencilIcon, TrashCan as Trash2Icon } from "@carbon/icons-react";
|
|
5
4
|
import { Button, cn } from "@locusgraph/components";
|
|
5
|
+
import { ArrowDown as ArrowDownIcon, ArrowUp as ArrowUpIcon, PencilSimple as PencilIcon, Trash as Trash2Icon } from "@phosphor-icons/react/ssr";
|
|
6
6
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
7
|
export function stepControlId(idPrefix, stepId, action) {
|
|
8
8
|
return `${idPrefix}-${stepId}-${action}`;
|
|
@@ -69,11 +69,11 @@ export function PlanStepRow(t0) {
|
|
|
69
69
|
danger: true
|
|
70
70
|
}];
|
|
71
71
|
t3 = "plan-step";
|
|
72
|
-
t4 = "group flex items-start gap-3
|
|
72
|
+
t4 = "group flex items-start gap-3 py-1";
|
|
73
73
|
if ($[17] !== number) {
|
|
74
74
|
t5 = /*#__PURE__*/_jsx("span", {
|
|
75
75
|
"aria-hidden": true,
|
|
76
|
-
className: "
|
|
76
|
+
className: "flex h-control-xs w-5 shrink-0 items-center text-xs text-faint tabular-nums",
|
|
77
77
|
children: number
|
|
78
78
|
});
|
|
79
79
|
$[17] = number;
|
|
@@ -93,7 +93,7 @@ export function PlanStepRow(t0) {
|
|
|
93
93
|
const t10 = blank && "ring-1 ring-destructive/70";
|
|
94
94
|
let t11;
|
|
95
95
|
if ($[21] !== t10) {
|
|
96
|
-
t11 = cn("-mx-1.5 h-
|
|
96
|
+
t11 = cn("-mx-1.5 h-control-xs min-w-0 bg-transparent px-1.5 text-sm text-foreground outline-none placeholder:text-faint hover:bg-muted/50 focus-visible:bg-muted focus-visible:ring-1 focus-visible:ring-ring", t10);
|
|
97
97
|
$[21] = t10;
|
|
98
98
|
$[22] = t11;
|
|
99
99
|
} else {
|
|
@@ -102,7 +102,7 @@ export function PlanStepRow(t0) {
|
|
|
102
102
|
let t12;
|
|
103
103
|
if ($[23] !== step.detail) {
|
|
104
104
|
t12 = step.detail && /*#__PURE__*/_jsx("p", {
|
|
105
|
-
className: "text-xs text-
|
|
105
|
+
className: "text-xs text-faint",
|
|
106
106
|
children: step.detail
|
|
107
107
|
});
|
|
108
108
|
$[23] = step.detail;
|
|
@@ -195,8 +195,9 @@ function _temp(t0) {
|
|
|
195
195
|
title: label,
|
|
196
196
|
disabled: disabled,
|
|
197
197
|
onClick: onClick,
|
|
198
|
-
className: cn("text-
|
|
198
|
+
className: cn("text-faint hover:bg-transparent hover:text-interactive", danger && "hover:text-destructive"),
|
|
199
199
|
children: /*#__PURE__*/_jsx(Icon, {
|
|
200
|
+
weight: "bold",
|
|
200
201
|
"aria-hidden": true
|
|
201
202
|
})
|
|
202
203
|
}, id);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { PlanStepDraft } from "../types.js";
|
|
2
2
|
import type { StepAction } from "./plan-step-row.js";
|
|
3
3
|
export declare function applyStepAction(steps: PlanStepDraft[], stepId: string, action: StepAction): PlanStepDraft[];
|
|
4
|
-
export declare function focusAfterAction(steps: PlanStepDraft[], stepId: string, action: StepAction): {
|
|
4
|
+
export declare function focusAfterAction(steps: PlanStepDraft[], stepId: string, action: StepAction, removedPosition?: number): {
|
|
5
5
|
stepId: string;
|
|
6
6
|
control: StepAction | "title";
|
|
7
7
|
} | null;
|
|
@@ -9,7 +9,7 @@ export function applyStepAction(steps, stepId, action) {
|
|
|
9
9
|
if (moved) reordered.splice(target, 0, moved);
|
|
10
10
|
return reordered;
|
|
11
11
|
}
|
|
12
|
-
export function focusAfterAction(steps, stepId, action) {
|
|
12
|
+
export function focusAfterAction(steps, stepId, action, removedPosition = 0) {
|
|
13
13
|
if (action !== "remove") {
|
|
14
14
|
const index = steps.findIndex(step => step.id === stepId);
|
|
15
15
|
const atEdge = action === "up" ? index === 0 : index === steps.length - 1;
|
|
@@ -18,7 +18,7 @@ export function focusAfterAction(steps, stepId, action) {
|
|
|
18
18
|
control: atEdge ? "title" : action
|
|
19
19
|
};
|
|
20
20
|
}
|
|
21
|
-
const neighbor = steps[
|
|
21
|
+
const neighbor = steps[Math.min(removedPosition, steps.length - 1)];
|
|
22
22
|
return neighbor ? {
|
|
23
23
|
stepId: neighbor.id,
|
|
24
24
|
control: "title"
|
|
@@ -98,7 +98,7 @@ export function QuestionChoices(t0) {
|
|
|
98
98
|
t6 = "radiogroup";
|
|
99
99
|
t7 = label;
|
|
100
100
|
t8 = "question-choices";
|
|
101
|
-
t9 = "
|
|
101
|
+
t9 = "flex flex-col";
|
|
102
102
|
t10 = options.map((option_1, index_0) => {
|
|
103
103
|
const checked = option_1.id === selectedId;
|
|
104
104
|
return /*#__PURE__*/_jsxs("button", {
|
|
@@ -112,19 +112,22 @@ export function QuestionChoices(t0) {
|
|
|
112
112
|
"data-state": checked ? "checked" : "unchecked",
|
|
113
113
|
onClick: () => onSelect(option_1.id),
|
|
114
114
|
onKeyDown: event_0 => handleKeyDown(event_0, index_0),
|
|
115
|
-
className: cn("group relative flex items-
|
|
115
|
+
className: cn("group relative -mx-2 flex items-start gap-3 px-2 py-1.5 text-left text-sm locus-focus-ring motion-safe:transition-colors", checked ? "bg-muted" : "hover:bg-muted/50"),
|
|
116
116
|
children: [/*#__PURE__*/_jsx("span", {
|
|
117
117
|
"aria-hidden": true,
|
|
118
|
-
className: cn("flex
|
|
118
|
+
className: cn("flex h-5 w-4 shrink-0 items-center text-xs tabular-nums", checked ? "font-medium text-interactive" : "text-faint"),
|
|
119
119
|
children: index_0 + 1
|
|
120
120
|
}), /*#__PURE__*/_jsxs("span", {
|
|
121
121
|
className: "flex min-w-0 flex-1 flex-col",
|
|
122
122
|
children: [/*#__PURE__*/_jsx("span", {
|
|
123
|
-
className: "font-medium",
|
|
123
|
+
className: "font-medium text-foreground",
|
|
124
124
|
children: option_1.label
|
|
125
|
-
}), option_1.description && /*#__PURE__*/
|
|
126
|
-
className: "text-xs text-
|
|
127
|
-
children:
|
|
125
|
+
}), option_1.description && /*#__PURE__*/_jsxs("span", {
|
|
126
|
+
className: "text-xs text-faint",
|
|
127
|
+
children: [/*#__PURE__*/_jsx("span", {
|
|
128
|
+
className: "sr-only",
|
|
129
|
+
children: ", "
|
|
130
|
+
}), option_1.description]
|
|
128
131
|
})]
|
|
129
132
|
})]
|
|
130
133
|
}, option_1.id);
|