@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,82 +1,164 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { c as _c } from "react/compiler-runtime";
|
|
4
|
+
import { Button, cn } from "@locusgraph/components";
|
|
3
5
|
import { pluralize } from "@locusgraph/utils";
|
|
6
|
+
import { ArrowRight as ArrowRightIcon, ListChecks as ListChecksIcon } from "@phosphor-icons/react/ssr";
|
|
4
7
|
import { useEffect, useId, useState } from "react";
|
|
5
|
-
import {
|
|
6
|
-
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";
|
|
7
11
|
import { useFocusOnMount } from "../shared/use-focus-on-mount.js";
|
|
12
|
+
import { useFocusWhenSettled } from "../shared/use-focus-when-settled.js";
|
|
8
13
|
import { PlanStepRow, stepControlId } from "./plan-step-row.js";
|
|
9
14
|
import { applyStepAction, describeStepAction, focusAfterAction } from "./plan-steps.js";
|
|
10
15
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
11
|
-
function DecidedSteps({
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
16
|
+
function DecidedSteps(t0) {
|
|
17
|
+
const $ = _c(4);
|
|
18
|
+
const {
|
|
19
|
+
steps
|
|
20
|
+
} = t0;
|
|
21
|
+
let t1;
|
|
22
|
+
if ($[0] !== steps) {
|
|
23
|
+
t1 = steps.map(_temp);
|
|
24
|
+
$[0] = steps;
|
|
25
|
+
$[1] = t1;
|
|
26
|
+
} else {
|
|
27
|
+
t1 = $[1];
|
|
28
|
+
}
|
|
29
|
+
let t2;
|
|
30
|
+
if ($[2] !== t1) {
|
|
31
|
+
t2 = /*#__PURE__*/_jsx("ol", {
|
|
32
|
+
className: "flex flex-col gap-1 pt-2 text-sm text-muted-foreground",
|
|
33
|
+
children: t1
|
|
34
|
+
});
|
|
35
|
+
$[2] = t1;
|
|
36
|
+
$[3] = t2;
|
|
37
|
+
} else {
|
|
38
|
+
t2 = $[3];
|
|
39
|
+
}
|
|
40
|
+
return t2;
|
|
41
|
+
}
|
|
42
|
+
function _temp(step, position) {
|
|
43
|
+
return /*#__PURE__*/_jsxs("li", {
|
|
44
|
+
className: "flex gap-3",
|
|
45
|
+
children: [/*#__PURE__*/_jsx("span", {
|
|
46
|
+
className: "w-4 shrink-0 text-xs leading-5 text-faint tabular-nums",
|
|
47
|
+
children: position + 1
|
|
48
|
+
}), /*#__PURE__*/_jsx("span", {
|
|
49
|
+
className: "min-w-0",
|
|
50
|
+
children: step.title
|
|
51
|
+
})]
|
|
52
|
+
}, step.id);
|
|
27
53
|
}
|
|
28
|
-
export function PlanReview({
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
54
|
+
export function PlanReview(t0) {
|
|
55
|
+
const $ = _c(36);
|
|
56
|
+
const {
|
|
57
|
+
steps: initialSteps,
|
|
58
|
+
title: t1,
|
|
59
|
+
description: t2,
|
|
60
|
+
actionLabel,
|
|
61
|
+
decision,
|
|
62
|
+
onApprove,
|
|
63
|
+
onCancel,
|
|
64
|
+
autoFocus: t3,
|
|
65
|
+
className
|
|
66
|
+
} = t0;
|
|
67
|
+
const title = t1 === undefined ? "Review the plan" : t1;
|
|
68
|
+
const description = t2 === undefined ? "The agent will run these steps in order. Edit, reorder or remove steps before it starts." : t2;
|
|
69
|
+
const autoFocus = t3 === undefined ? true : t3;
|
|
39
70
|
const idPrefix = useId();
|
|
40
71
|
const [steps, setSteps] = useState(initialSteps);
|
|
41
72
|
const [announcement, setAnnouncement] = useState("");
|
|
42
73
|
const [pendingFocus, setPendingFocus] = useState(null);
|
|
43
74
|
const approveRef = useFocusOnMount(autoFocus && !decision);
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
setAnnouncement(describeStepAction(position, action));
|
|
53
|
-
setPendingFocus(focus ? {
|
|
54
|
-
id: stepControlId(idPrefix, focus.stepId, focus.control)
|
|
55
|
-
} : null);
|
|
75
|
+
const settleRef = useFocusWhenSettled(!decision);
|
|
76
|
+
let t4;
|
|
77
|
+
if ($[0] !== steps) {
|
|
78
|
+
t4 = steps.some(_temp2);
|
|
79
|
+
$[0] = steps;
|
|
80
|
+
$[1] = t4;
|
|
81
|
+
} else {
|
|
82
|
+
t4 = $[1];
|
|
56
83
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
84
|
+
const hasBlankTitle = t4;
|
|
85
|
+
let t5;
|
|
86
|
+
let t6;
|
|
87
|
+
if ($[2] !== pendingFocus) {
|
|
88
|
+
t5 = () => {
|
|
89
|
+
if (pendingFocus) {
|
|
90
|
+
document.getElementById(pendingFocus.id)?.focus();
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
t6 = [pendingFocus];
|
|
94
|
+
$[2] = pendingFocus;
|
|
95
|
+
$[3] = t5;
|
|
96
|
+
$[4] = t6;
|
|
97
|
+
} else {
|
|
98
|
+
t5 = $[3];
|
|
99
|
+
t6 = $[4];
|
|
62
100
|
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
101
|
+
useEffect(t5, t6);
|
|
102
|
+
let t7;
|
|
103
|
+
if ($[5] !== idPrefix || $[6] !== steps) {
|
|
104
|
+
t7 = function handleAction(stepId, position, action) {
|
|
105
|
+
const next = applyStepAction(steps, stepId, action);
|
|
106
|
+
const focus = focusAfterAction(next, stepId, action, position);
|
|
107
|
+
setSteps(next);
|
|
108
|
+
setAnnouncement(describeStepAction(position, action));
|
|
109
|
+
setPendingFocus(focus ? {
|
|
110
|
+
id: stepControlId(idPrefix, focus.stepId, focus.control)
|
|
111
|
+
} : null);
|
|
112
|
+
};
|
|
113
|
+
$[5] = idPrefix;
|
|
114
|
+
$[6] = steps;
|
|
115
|
+
$[7] = t7;
|
|
116
|
+
} else {
|
|
117
|
+
t7 = $[7];
|
|
118
|
+
}
|
|
119
|
+
const handleAction = t7;
|
|
120
|
+
let t8;
|
|
121
|
+
if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
|
|
122
|
+
t8 = function renameStep(stepId_0, nextTitle) {
|
|
123
|
+
setSteps(current => current.map(item => item.id === stepId_0 ? {
|
|
124
|
+
...item,
|
|
125
|
+
title: nextTitle
|
|
126
|
+
} : item));
|
|
127
|
+
};
|
|
128
|
+
$[8] = t8;
|
|
129
|
+
} else {
|
|
130
|
+
t8 = $[8];
|
|
131
|
+
}
|
|
132
|
+
const renameStep = t8;
|
|
133
|
+
let t9;
|
|
134
|
+
if ($[9] !== steps.length) {
|
|
135
|
+
t9 = pluralize(steps.length, "step");
|
|
136
|
+
$[9] = steps.length;
|
|
137
|
+
$[10] = t9;
|
|
138
|
+
} else {
|
|
139
|
+
t9 = $[10];
|
|
140
|
+
}
|
|
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;
|
|
148
|
+
$[12] = t11;
|
|
149
|
+
$[13] = t12;
|
|
150
|
+
} else {
|
|
151
|
+
t12 = $[13];
|
|
152
|
+
}
|
|
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",
|
|
69
158
|
icon: /*#__PURE__*/_jsx(ListChecksIcon, {
|
|
159
|
+
weight: "bold",
|
|
70
160
|
"aria-hidden": true
|
|
71
161
|
}),
|
|
72
|
-
eyebrow: "Plan",
|
|
73
|
-
status: decision ? decision.approved ? "Approved" : "Cancelled" : "Waiting for you",
|
|
74
|
-
tone: decision ? decision.approved ? "done" : "danger" : "waiting",
|
|
75
|
-
aside: pluralize(steps.length, "step")
|
|
76
|
-
}), /*#__PURE__*/_jsx(PanelTitle, {
|
|
77
|
-
className: decision ? "text-muted-foreground" : undefined,
|
|
78
|
-
children: title
|
|
79
|
-
}), decision ? /*#__PURE__*/_jsxs(PanelBody, {
|
|
80
162
|
children: [/*#__PURE__*/_jsx(DecisionSummary, {
|
|
81
163
|
decision: decision,
|
|
82
164
|
deniedVerb: "Cancelled",
|
|
@@ -85,55 +167,106 @@ export function PlanReview({
|
|
|
85
167
|
steps: initialSteps
|
|
86
168
|
})]
|
|
87
169
|
}) : /*#__PURE__*/_jsxs(_Fragment, {
|
|
88
|
-
children: [/*#__PURE__*/_jsx(
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
className: "-mx-5 flex flex-col divide-y border-t",
|
|
95
|
-
children: steps.map((step, position) => /*#__PURE__*/_jsx(PlanStepRow, {
|
|
96
|
-
idPrefix: idPrefix,
|
|
97
|
-
step: step,
|
|
98
|
-
position: position,
|
|
99
|
-
count: steps.length,
|
|
100
|
-
onRename: nextTitle => renameStep(step.id, nextTitle),
|
|
101
|
-
onAction: action => handleAction(step.id, position, action)
|
|
102
|
-
}, step.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
|
|
103
176
|
})
|
|
104
|
-
}), /*#__PURE__*/
|
|
105
|
-
className: "
|
|
106
|
-
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", {
|
|
107
209
|
className: "text-xs text-destructive",
|
|
108
210
|
children: "Every step needs a title."
|
|
109
|
-
}) : /*#__PURE__*/_jsx("span", {
|
|
110
|
-
className: "hidden font-mono text-[11px] text-muted-foreground sm:inline",
|
|
111
|
-
children: "The run starts when you approve"
|
|
112
|
-
}), /*#__PURE__*/_jsxs("span", {
|
|
113
|
-
className: "ml-auto flex gap-2",
|
|
114
|
-
children: [/*#__PURE__*/_jsx(Button, {
|
|
115
|
-
type: "button",
|
|
116
|
-
size: "sm",
|
|
117
|
-
variant: "ghost",
|
|
118
|
-
onClick: onCancel,
|
|
119
|
-
children: "Cancel"
|
|
120
|
-
}), /*#__PURE__*/_jsxs(Button, {
|
|
121
|
-
ref: approveRef,
|
|
122
|
-
type: "button",
|
|
123
|
-
size: "sm",
|
|
124
|
-
disabled: hasBlankTitle || steps.length === 0,
|
|
125
|
-
onClick: () => onApprove(steps.map(step => ({
|
|
126
|
-
...step,
|
|
127
|
-
title: step.title.trim()
|
|
128
|
-
}))),
|
|
129
|
-
children: [actionLabel ?? `Run ${pluralize(steps.length, "step")}`, /*#__PURE__*/_jsx(ArrowRightIcon, {
|
|
130
|
-
"aria-hidden": true
|
|
131
|
-
})]
|
|
132
|
-
})]
|
|
133
211
|
})]
|
|
134
212
|
})]
|
|
135
|
-
})
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
213
|
+
});
|
|
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;
|
|
227
|
+
} else {
|
|
228
|
+
t13 = $[26];
|
|
229
|
+
}
|
|
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
|
|
235
|
+
});
|
|
236
|
+
$[27] = t14;
|
|
237
|
+
$[28] = t15;
|
|
238
|
+
} else {
|
|
239
|
+
t15 = $[28];
|
|
240
|
+
}
|
|
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,
|
|
246
|
+
"data-slot": "plan-review",
|
|
247
|
+
"data-decided": t10,
|
|
248
|
+
"aria-label": title,
|
|
249
|
+
className: t12,
|
|
250
|
+
children: [t13, t15]
|
|
251
|
+
});
|
|
252
|
+
$[29] = settleRef;
|
|
253
|
+
$[30] = t10;
|
|
254
|
+
$[31] = t12;
|
|
255
|
+
$[32] = t13;
|
|
256
|
+
$[33] = t15;
|
|
257
|
+
$[34] = title;
|
|
258
|
+
$[35] = t16;
|
|
259
|
+
} else {
|
|
260
|
+
t16 = $[35];
|
|
261
|
+
}
|
|
262
|
+
return t16;
|
|
263
|
+
}
|
|
264
|
+
function _temp3(step_1) {
|
|
265
|
+
return {
|
|
266
|
+
...step_1,
|
|
267
|
+
title: step_1.title.trim()
|
|
268
|
+
};
|
|
269
|
+
}
|
|
270
|
+
function _temp2(step) {
|
|
271
|
+
return step.title.trim() === "";
|
|
139
272
|
}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { c as _c } from "react/compiler-runtime";
|
|
2
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";
|
|
3
6
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
4
7
|
export function stepControlId(idPrefix, stepId, action) {
|
|
5
8
|
return `${idPrefix}-${stepId}-${action}`;
|
|
@@ -11,87 +14,191 @@ function selectInputById(id) {
|
|
|
11
14
|
element.select();
|
|
12
15
|
}
|
|
13
16
|
}
|
|
14
|
-
export function PlanStepRow({
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
export function PlanStepRow(t0) {
|
|
18
|
+
const $ = _c(34);
|
|
19
|
+
const {
|
|
20
|
+
idPrefix,
|
|
21
|
+
step,
|
|
22
|
+
position,
|
|
23
|
+
count,
|
|
24
|
+
onRename,
|
|
25
|
+
onAction
|
|
26
|
+
} = t0;
|
|
22
27
|
const number = position + 1;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}
|
|
28
|
+
let t1;
|
|
29
|
+
let t2;
|
|
30
|
+
let t3;
|
|
31
|
+
let t4;
|
|
32
|
+
let t5;
|
|
33
|
+
let t6;
|
|
34
|
+
if ($[0] !== count || $[1] !== idPrefix || $[2] !== number || $[3] !== onAction || $[4] !== onRename || $[5] !== position || $[6] !== step.detail || $[7] !== step.id || $[8] !== step.title) {
|
|
35
|
+
const titleId = stepControlId(idPrefix, step.id, "title");
|
|
36
|
+
let t7;
|
|
37
|
+
if ($[15] !== step.title) {
|
|
38
|
+
t7 = step.title.trim();
|
|
39
|
+
$[15] = step.title;
|
|
40
|
+
$[16] = t7;
|
|
41
|
+
} else {
|
|
42
|
+
t7 = $[16];
|
|
43
|
+
}
|
|
44
|
+
const blank = t7 === "";
|
|
45
|
+
const controls = [{
|
|
46
|
+
id: `${idPrefix}-${step.id}-edit`,
|
|
47
|
+
label: `Edit step ${number}`,
|
|
48
|
+
icon: PencilIcon,
|
|
49
|
+
disabled: false,
|
|
50
|
+
onClick: () => selectInputById(titleId)
|
|
51
|
+
}, {
|
|
52
|
+
id: stepControlId(idPrefix, step.id, "up"),
|
|
53
|
+
label: `Move step ${number} up`,
|
|
54
|
+
icon: ArrowUpIcon,
|
|
55
|
+
disabled: position === 0,
|
|
56
|
+
onClick: () => onAction("up")
|
|
57
|
+
}, {
|
|
58
|
+
id: stepControlId(idPrefix, step.id, "down"),
|
|
59
|
+
label: `Move step ${number} down`,
|
|
60
|
+
icon: ArrowDownIcon,
|
|
61
|
+
disabled: position === count - 1,
|
|
62
|
+
onClick: () => onAction("down")
|
|
63
|
+
}, {
|
|
64
|
+
id: stepControlId(idPrefix, step.id, "remove"),
|
|
65
|
+
label: `Remove step ${number}`,
|
|
66
|
+
icon: Trash2Icon,
|
|
67
|
+
disabled: count === 1,
|
|
68
|
+
onClick: () => onAction("remove"),
|
|
69
|
+
danger: true
|
|
70
|
+
}];
|
|
71
|
+
t3 = "plan-step";
|
|
72
|
+
t4 = "group flex items-start gap-3 py-1";
|
|
73
|
+
if ($[17] !== number) {
|
|
74
|
+
t5 = /*#__PURE__*/_jsx("span", {
|
|
75
|
+
"aria-hidden": true,
|
|
76
|
+
className: "flex h-control-xs w-5 shrink-0 items-center text-xs text-faint tabular-nums",
|
|
77
|
+
children: number
|
|
78
|
+
});
|
|
79
|
+
$[17] = number;
|
|
80
|
+
$[18] = t5;
|
|
81
|
+
} else {
|
|
82
|
+
t5 = $[18];
|
|
83
|
+
}
|
|
84
|
+
const t8 = step.title;
|
|
85
|
+
let t9;
|
|
86
|
+
if ($[19] !== onRename) {
|
|
87
|
+
t9 = event => onRename(event.target.value);
|
|
88
|
+
$[19] = onRename;
|
|
89
|
+
$[20] = t9;
|
|
90
|
+
} else {
|
|
91
|
+
t9 = $[20];
|
|
92
|
+
}
|
|
93
|
+
const t10 = blank && "ring-1 ring-destructive/70";
|
|
94
|
+
let t11;
|
|
95
|
+
if ($[21] !== t10) {
|
|
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
|
+
$[21] = t10;
|
|
98
|
+
$[22] = t11;
|
|
99
|
+
} else {
|
|
100
|
+
t11 = $[22];
|
|
101
|
+
}
|
|
102
|
+
let t12;
|
|
103
|
+
if ($[23] !== step.detail) {
|
|
104
|
+
t12 = step.detail && /*#__PURE__*/_jsx("p", {
|
|
105
|
+
className: "text-xs text-faint",
|
|
106
|
+
children: step.detail
|
|
107
|
+
});
|
|
108
|
+
$[23] = step.detail;
|
|
109
|
+
$[24] = t12;
|
|
110
|
+
} else {
|
|
111
|
+
t12 = $[24];
|
|
112
|
+
}
|
|
113
|
+
t6 = /*#__PURE__*/_jsxs("div", {
|
|
59
114
|
className: "flex min-w-0 flex-1 flex-col gap-0.5",
|
|
60
115
|
children: [/*#__PURE__*/_jsx("input", {
|
|
61
116
|
id: titleId,
|
|
62
117
|
"aria-label": `Step ${number} title`,
|
|
63
|
-
value:
|
|
118
|
+
value: t8,
|
|
64
119
|
placeholder: "Name this step",
|
|
65
120
|
"aria-invalid": blank || undefined,
|
|
66
|
-
onChange:
|
|
67
|
-
className:
|
|
68
|
-
}),
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
121
|
+
onChange: t9,
|
|
122
|
+
className: t11
|
|
123
|
+
}), t12]
|
|
124
|
+
});
|
|
125
|
+
t1 = "flex shrink-0 gap-0.5 sm:opacity-0 sm:group-focus-within:opacity-100 sm:group-hover:opacity-100 sm:motion-safe:transition-opacity";
|
|
126
|
+
t2 = controls.map(_temp);
|
|
127
|
+
$[0] = count;
|
|
128
|
+
$[1] = idPrefix;
|
|
129
|
+
$[2] = number;
|
|
130
|
+
$[3] = onAction;
|
|
131
|
+
$[4] = onRename;
|
|
132
|
+
$[5] = position;
|
|
133
|
+
$[6] = step.detail;
|
|
134
|
+
$[7] = step.id;
|
|
135
|
+
$[8] = step.title;
|
|
136
|
+
$[9] = t1;
|
|
137
|
+
$[10] = t2;
|
|
138
|
+
$[11] = t3;
|
|
139
|
+
$[12] = t4;
|
|
140
|
+
$[13] = t5;
|
|
141
|
+
$[14] = t6;
|
|
142
|
+
} else {
|
|
143
|
+
t1 = $[9];
|
|
144
|
+
t2 = $[10];
|
|
145
|
+
t3 = $[11];
|
|
146
|
+
t4 = $[12];
|
|
147
|
+
t5 = $[13];
|
|
148
|
+
t6 = $[14];
|
|
149
|
+
}
|
|
150
|
+
let t7;
|
|
151
|
+
if ($[25] !== t1 || $[26] !== t2) {
|
|
152
|
+
t7 = /*#__PURE__*/_jsx("div", {
|
|
153
|
+
className: t1,
|
|
154
|
+
children: t2
|
|
155
|
+
});
|
|
156
|
+
$[25] = t1;
|
|
157
|
+
$[26] = t2;
|
|
158
|
+
$[27] = t7;
|
|
159
|
+
} else {
|
|
160
|
+
t7 = $[27];
|
|
161
|
+
}
|
|
162
|
+
let t8;
|
|
163
|
+
if ($[28] !== t3 || $[29] !== t4 || $[30] !== t5 || $[31] !== t6 || $[32] !== t7) {
|
|
164
|
+
t8 = /*#__PURE__*/_jsxs("li", {
|
|
165
|
+
"data-slot": t3,
|
|
166
|
+
className: t4,
|
|
167
|
+
children: [t5, t6, t7]
|
|
168
|
+
});
|
|
169
|
+
$[28] = t3;
|
|
170
|
+
$[29] = t4;
|
|
171
|
+
$[30] = t5;
|
|
172
|
+
$[31] = t6;
|
|
173
|
+
$[32] = t7;
|
|
174
|
+
$[33] = t8;
|
|
175
|
+
} else {
|
|
176
|
+
t8 = $[33];
|
|
177
|
+
}
|
|
178
|
+
return t8;
|
|
179
|
+
}
|
|
180
|
+
function _temp(t0) {
|
|
181
|
+
const {
|
|
182
|
+
id,
|
|
183
|
+
label,
|
|
184
|
+
icon: Icon,
|
|
185
|
+
disabled,
|
|
186
|
+
onClick,
|
|
187
|
+
danger
|
|
188
|
+
} = t0;
|
|
189
|
+
return /*#__PURE__*/_jsx(Button, {
|
|
190
|
+
id: id,
|
|
191
|
+
type: "button",
|
|
192
|
+
variant: "ghost",
|
|
193
|
+
size: "icon-xs",
|
|
194
|
+
"aria-label": label,
|
|
195
|
+
title: label,
|
|
196
|
+
disabled: disabled,
|
|
197
|
+
onClick: onClick,
|
|
198
|
+
className: cn("text-faint hover:bg-transparent hover:text-interactive", danger && "hover:text-destructive"),
|
|
199
|
+
children: /*#__PURE__*/_jsx(Icon, {
|
|
200
|
+
weight: "bold",
|
|
201
|
+
"aria-hidden": true
|
|
202
|
+
})
|
|
203
|
+
}, id);
|
|
97
204
|
}
|
|
@@ -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;
|