@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,14 +1,17 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import { c as _c } from "react/compiler-runtime";
|
|
4
|
-
import { CurrencyDollar as CircleDollarSignIcon } from "@carbon/icons-react";
|
|
5
4
|
import { Button, cn } from "@locusgraph/components";
|
|
6
5
|
import { formatMicroUsd } from "@locusgraph/utils";
|
|
7
|
-
import {
|
|
8
|
-
import { DecisionSummary } from "
|
|
6
|
+
import { CurrencyCircleDollar as CircleDollarSignIcon } from "@phosphor-icons/react/ssr";
|
|
7
|
+
import { DecisionSummary } from "../../shared/decision-summary.js";
|
|
8
|
+
import { lineObjectClass } from "../../shared/line.js";
|
|
9
|
+
import { LiveStatus } from "../../shared/live-status.js";
|
|
10
|
+
import { PendingLine, SettledLine } from "../shared/approval-line.js";
|
|
9
11
|
import { useFocusOnMount } from "../shared/use-focus-on-mount.js";
|
|
12
|
+
import { useFocusWhenSettled } from "../shared/use-focus-when-settled.js";
|
|
10
13
|
import { RaiseCapForm } from "./raise-cap-form.js";
|
|
11
|
-
import { spendSituation, suggestedCapMicroUsd } from "./spend-math.js";
|
|
14
|
+
import { minimumCapMicroUsd, spendSituation, suggestedCapMicroUsd } from "./spend-math.js";
|
|
12
15
|
import { SpendMeter } from "./spend-meter.js";
|
|
13
16
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
14
17
|
const situationCopy = {
|
|
@@ -26,7 +29,7 @@ const situationStatus = {
|
|
|
26
29
|
"out-of-credits": "Out of credits"
|
|
27
30
|
};
|
|
28
31
|
export function SpendGate(t0) {
|
|
29
|
-
const $ = _c(
|
|
32
|
+
const $ = _c(39);
|
|
30
33
|
const {
|
|
31
34
|
spentMicroUsd,
|
|
32
35
|
estimateMicroUsd,
|
|
@@ -56,6 +59,7 @@ export function SpendGate(t0) {
|
|
|
56
59
|
const projected = spentMicroUsd + estimateMicroUsd;
|
|
57
60
|
const copy = situationCopy[situation];
|
|
58
61
|
const primaryRef = useFocusOnMount(autoFocus && !decision);
|
|
62
|
+
const settleRef = useFocusWhenSettled(!decision);
|
|
59
63
|
let t3;
|
|
60
64
|
if ($[3] !== balanceMicroUsd || $[4] !== capMicroUsd || $[5] !== estimateMicroUsd || $[6] !== outOfCredits || $[7] !== spentMicroUsd) {
|
|
61
65
|
t3 = {
|
|
@@ -75,178 +79,151 @@ export function SpendGate(t0) {
|
|
|
75
79
|
t3 = $[8];
|
|
76
80
|
}
|
|
77
81
|
const meter = t3;
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
t6 = cn(t5, className);
|
|
83
|
-
$[9] = className;
|
|
84
|
-
$[10] = t5;
|
|
85
|
-
$[11] = t6;
|
|
86
|
-
} else {
|
|
87
|
-
t6 = $[11];
|
|
88
|
-
}
|
|
89
|
-
let t7;
|
|
90
|
-
if ($[12] === Symbol.for("react.memo_cache_sentinel")) {
|
|
91
|
-
t7 = /*#__PURE__*/_jsx(CircleDollarSignIcon, {
|
|
82
|
+
let t4;
|
|
83
|
+
if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
|
|
84
|
+
t4 = /*#__PURE__*/_jsx(CircleDollarSignIcon, {
|
|
85
|
+
weight: "bold",
|
|
92
86
|
"aria-hidden": true
|
|
93
87
|
});
|
|
94
|
-
$[
|
|
88
|
+
$[9] = t4;
|
|
95
89
|
} else {
|
|
96
|
-
|
|
90
|
+
t4 = $[9];
|
|
97
91
|
}
|
|
98
|
-
const
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
eyebrow: "Spend approval",
|
|
105
|
-
status: t8,
|
|
106
|
-
tone: t9
|
|
107
|
-
});
|
|
108
|
-
$[13] = t8;
|
|
109
|
-
$[14] = t9;
|
|
110
|
-
$[15] = t10;
|
|
92
|
+
const icon = t4;
|
|
93
|
+
let t5;
|
|
94
|
+
if ($[10] !== estimateMicroUsd) {
|
|
95
|
+
t5 = formatMicroUsd(estimateMicroUsd);
|
|
96
|
+
$[10] = estimateMicroUsd;
|
|
97
|
+
$[11] = t5;
|
|
111
98
|
} else {
|
|
112
|
-
|
|
99
|
+
t5 = $[11];
|
|
113
100
|
}
|
|
114
|
-
const
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
let t13;
|
|
124
|
-
if ($[18] !== copy.title || $[19] !== t12) {
|
|
125
|
-
t13 = /*#__PURE__*/_jsx(PanelTitle, {
|
|
126
|
-
className: t12,
|
|
127
|
-
children: copy.title
|
|
128
|
-
});
|
|
129
|
-
$[18] = copy.title;
|
|
130
|
-
$[19] = t12;
|
|
131
|
-
$[20] = t13;
|
|
101
|
+
const estimate = t5;
|
|
102
|
+
const t6 = copy.title;
|
|
103
|
+
const t7 = !decision && "gap-3";
|
|
104
|
+
let t8;
|
|
105
|
+
if ($[12] !== className || $[13] !== t7) {
|
|
106
|
+
t8 = cn("flex min-w-0 flex-col outline-none", t7, className);
|
|
107
|
+
$[12] = className;
|
|
108
|
+
$[13] = t7;
|
|
109
|
+
$[14] = t8;
|
|
132
110
|
} else {
|
|
133
|
-
|
|
111
|
+
t8 = $[14];
|
|
134
112
|
}
|
|
135
|
-
let
|
|
136
|
-
if ($[
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
}) : /*#__PURE__*/_jsxs(_Fragment, {
|
|
149
|
-
children: [/*#__PURE__*/_jsx("p", {
|
|
150
|
-
className: "px-5 pt-1 text-sm text-muted-foreground",
|
|
151
|
-
children: copy.body(runName ?? "The agent")
|
|
152
|
-
}), /*#__PURE__*/_jsxs(PanelBody, {
|
|
153
|
-
className: "gap-5",
|
|
154
|
-
children: [/*#__PURE__*/_jsxs("div", {
|
|
155
|
-
className: "flex flex-col gap-0.5",
|
|
156
|
-
children: [/*#__PURE__*/_jsx("p", {
|
|
157
|
-
className: "text-2xl font-semibold tracking-tight tabular-nums",
|
|
158
|
-
children: formatMicroUsd(estimateMicroUsd)
|
|
159
|
-
}), /*#__PURE__*/_jsxs("p", {
|
|
160
|
-
className: "text-xs text-muted-foreground",
|
|
161
|
-
children: ["Next step, estimated. The run would reach", " ", /*#__PURE__*/_jsx("span", {
|
|
162
|
-
className: "tabular-nums",
|
|
163
|
-
children: formatMicroUsd(projected)
|
|
164
|
-
}), "."]
|
|
165
|
-
})]
|
|
113
|
+
let t9;
|
|
114
|
+
if ($[15] !== capMicroUsd || $[16] !== copy || $[17] !== decision || $[18] !== estimate || $[19] !== meter || $[20] !== onAllowOnce || $[21] !== onBuyCredits || $[22] !== onRaiseCap || $[23] !== onStop || $[24] !== outOfCredits || $[25] !== primaryRef || $[26] !== projected || $[27] !== runName || $[28] !== situation) {
|
|
115
|
+
t9 = decision ? /*#__PURE__*/_jsx(SettledLine, {
|
|
116
|
+
name: estimate,
|
|
117
|
+
verb: "Asked to spend",
|
|
118
|
+
icon: icon,
|
|
119
|
+
children: /*#__PURE__*/_jsxs("div", {
|
|
120
|
+
className: "flex flex-col gap-3",
|
|
121
|
+
children: [/*#__PURE__*/_jsx(DecisionSummary, {
|
|
122
|
+
decision: decision,
|
|
123
|
+
approvedVerb: "Allowed",
|
|
124
|
+
deniedVerb: "Stopped",
|
|
125
|
+
result: decision.approved ? `Allowed ${estimate} once` : `${runName ?? "The run"} stopped`
|
|
166
126
|
}), /*#__PURE__*/_jsx(SpendMeter, {
|
|
167
|
-
...meter
|
|
168
|
-
|
|
169
|
-
capMicroUsd: capMicroUsd,
|
|
170
|
-
suggestedMicroUsd: suggestedCapMicroUsd(projected, capMicroUsd),
|
|
171
|
-
onRaiseCap: onRaiseCap
|
|
127
|
+
...meter,
|
|
128
|
+
muted: true
|
|
172
129
|
})]
|
|
173
|
-
})
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
size: "sm",
|
|
184
|
-
variant: outOfCredits && !onBuyCredits ? "destructive" : "ghost",
|
|
185
|
-
onClick: onStop,
|
|
186
|
-
children: "Stop the run"
|
|
187
|
-
}), outOfCredits ? onBuyCredits && /*#__PURE__*/_jsx(Button, {
|
|
188
|
-
ref: primaryRef,
|
|
189
|
-
type: "button",
|
|
190
|
-
size: "sm",
|
|
191
|
-
onClick: onBuyCredits,
|
|
192
|
-
children: "Buy credits"
|
|
193
|
-
}) : /*#__PURE__*/_jsxs(Button, {
|
|
194
|
-
ref: primaryRef,
|
|
195
|
-
type: "button",
|
|
196
|
-
size: "sm",
|
|
197
|
-
onClick: onAllowOnce,
|
|
198
|
-
children: ["Allow ", formatMicroUsd(estimateMicroUsd), " once"]
|
|
199
|
-
})]
|
|
130
|
+
})
|
|
131
|
+
}) : /*#__PURE__*/_jsxs(_Fragment, {
|
|
132
|
+
children: [/*#__PURE__*/_jsxs(PendingLine, {
|
|
133
|
+
icon: icon,
|
|
134
|
+
status: situationStatus[situation],
|
|
135
|
+
tone: outOfCredits ? "destructive" : "warn",
|
|
136
|
+
iconClassName: outOfCredits ? "text-destructive" : undefined,
|
|
137
|
+
children: ["\xB7 next step costs ", /*#__PURE__*/_jsx("span", {
|
|
138
|
+
className: lineObjectClass,
|
|
139
|
+
children: estimate
|
|
200
140
|
})]
|
|
141
|
+
}), /*#__PURE__*/_jsxs("p", {
|
|
142
|
+
className: "-mt-2 text-sm text-faint",
|
|
143
|
+
children: [copy.body(runName ?? "The agent"), " The run would reach", " ", /*#__PURE__*/_jsx("span", {
|
|
144
|
+
className: "tabular-nums",
|
|
145
|
+
children: formatMicroUsd(projected)
|
|
146
|
+
}), "."]
|
|
147
|
+
}), /*#__PURE__*/_jsx(SpendMeter, {
|
|
148
|
+
...meter
|
|
149
|
+
}), /*#__PURE__*/_jsxs("div", {
|
|
150
|
+
className: "flex flex-wrap items-center gap-2 pt-1",
|
|
151
|
+
children: [outOfCredits ? onBuyCredits && /*#__PURE__*/_jsx(Button, {
|
|
152
|
+
ref: primaryRef,
|
|
153
|
+
type: "button",
|
|
154
|
+
size: "sm",
|
|
155
|
+
onClick: onBuyCredits,
|
|
156
|
+
children: "Buy credits"
|
|
157
|
+
}) : /*#__PURE__*/_jsxs(Button, {
|
|
158
|
+
ref: primaryRef,
|
|
159
|
+
type: "button",
|
|
160
|
+
size: "sm",
|
|
161
|
+
onClick: onAllowOnce,
|
|
162
|
+
children: ["Allow ", estimate, " once"]
|
|
163
|
+
}), /*#__PURE__*/_jsx(Button, {
|
|
164
|
+
ref: outOfCredits && !onBuyCredits ? primaryRef : undefined,
|
|
165
|
+
type: "button",
|
|
166
|
+
size: "sm",
|
|
167
|
+
variant: outOfCredits && !onBuyCredits ? "destructive" : "ghost",
|
|
168
|
+
className: outOfCredits && !onBuyCredits ? undefined : "hover:bg-transparent hover:text-destructive",
|
|
169
|
+
onClick: onStop,
|
|
170
|
+
children: "Stop the run"
|
|
171
|
+
})]
|
|
172
|
+
}), !outOfCredits && /*#__PURE__*/_jsx(RaiseCapForm, {
|
|
173
|
+
minimumMicroUsd: minimumCapMicroUsd(projected, capMicroUsd),
|
|
174
|
+
suggestedMicroUsd: suggestedCapMicroUsd(projected, capMicroUsd),
|
|
175
|
+
onRaiseCap: onRaiseCap
|
|
201
176
|
})]
|
|
202
177
|
});
|
|
203
|
-
$[
|
|
204
|
-
$[
|
|
205
|
-
$[
|
|
206
|
-
$[
|
|
207
|
-
$[
|
|
208
|
-
$[
|
|
209
|
-
$[
|
|
210
|
-
$[
|
|
211
|
-
$[
|
|
212
|
-
$[
|
|
213
|
-
$[
|
|
214
|
-
$[
|
|
215
|
-
$[
|
|
216
|
-
$[
|
|
178
|
+
$[15] = capMicroUsd;
|
|
179
|
+
$[16] = copy;
|
|
180
|
+
$[17] = decision;
|
|
181
|
+
$[18] = estimate;
|
|
182
|
+
$[19] = meter;
|
|
183
|
+
$[20] = onAllowOnce;
|
|
184
|
+
$[21] = onBuyCredits;
|
|
185
|
+
$[22] = onRaiseCap;
|
|
186
|
+
$[23] = onStop;
|
|
187
|
+
$[24] = outOfCredits;
|
|
188
|
+
$[25] = primaryRef;
|
|
189
|
+
$[26] = projected;
|
|
190
|
+
$[27] = runName;
|
|
191
|
+
$[28] = situation;
|
|
192
|
+
$[29] = t9;
|
|
217
193
|
} else {
|
|
218
|
-
|
|
194
|
+
t9 = $[29];
|
|
219
195
|
}
|
|
220
|
-
const
|
|
221
|
-
let
|
|
222
|
-
if ($[
|
|
223
|
-
|
|
224
|
-
message:
|
|
196
|
+
const t10 = decision ? decision.approved ? "Spend allowed" : "Run stopped" : copy.title;
|
|
197
|
+
let t11;
|
|
198
|
+
if ($[30] !== t10) {
|
|
199
|
+
t11 = /*#__PURE__*/_jsx(LiveStatus, {
|
|
200
|
+
message: t10
|
|
225
201
|
});
|
|
226
|
-
$[
|
|
227
|
-
$[
|
|
202
|
+
$[30] = t10;
|
|
203
|
+
$[31] = t11;
|
|
228
204
|
} else {
|
|
229
|
-
|
|
205
|
+
t11 = $[31];
|
|
230
206
|
}
|
|
231
|
-
let
|
|
232
|
-
if ($[
|
|
233
|
-
|
|
207
|
+
let t12;
|
|
208
|
+
if ($[32] !== copy.title || $[33] !== settleRef || $[34] !== situation || $[35] !== t11 || $[36] !== t8 || $[37] !== t9) {
|
|
209
|
+
t12 = /*#__PURE__*/_jsxs("section", {
|
|
210
|
+
ref: settleRef,
|
|
211
|
+
tabIndex: -1,
|
|
234
212
|
"data-slot": "spend-gate",
|
|
235
213
|
"data-situation": situation,
|
|
236
|
-
"aria-label":
|
|
237
|
-
className:
|
|
238
|
-
children: [
|
|
214
|
+
"aria-label": t6,
|
|
215
|
+
className: t8,
|
|
216
|
+
children: [t9, t11]
|
|
239
217
|
});
|
|
240
|
-
$[
|
|
241
|
-
$[
|
|
242
|
-
$[
|
|
243
|
-
$[
|
|
244
|
-
$[
|
|
245
|
-
$[
|
|
246
|
-
$[
|
|
247
|
-
$[44] = t17;
|
|
218
|
+
$[32] = copy.title;
|
|
219
|
+
$[33] = settleRef;
|
|
220
|
+
$[34] = situation;
|
|
221
|
+
$[35] = t11;
|
|
222
|
+
$[36] = t8;
|
|
223
|
+
$[37] = t9;
|
|
224
|
+
$[38] = t12;
|
|
248
225
|
} else {
|
|
249
|
-
|
|
226
|
+
t12 = $[38];
|
|
250
227
|
}
|
|
251
|
-
return
|
|
228
|
+
return t12;
|
|
252
229
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export type SpendSituation = "over-cap" | "out-of-credits";
|
|
2
2
|
export declare function spendSituation(balanceMicroUsd: number, estimateMicroUsd: number): SpendSituation;
|
|
3
|
+
export declare function minimumCapMicroUsd(projectedMicroUsd: number, capMicroUsd: number): number;
|
|
3
4
|
export declare function suggestedCapMicroUsd(projectedMicroUsd: number, capMicroUsd: number): number;
|
|
4
5
|
export declare function dollarsToMicroUsd(dollars: string): number | null;
|
|
5
6
|
export declare function microUsdToDollarsInput(microUsd: number): string;
|
|
@@ -3,9 +3,12 @@ const microUsdPerCent = 10_000;
|
|
|
3
3
|
export function spendSituation(balanceMicroUsd, estimateMicroUsd) {
|
|
4
4
|
return balanceMicroUsd <= 0 || balanceMicroUsd < estimateMicroUsd ? "out-of-credits" : "over-cap";
|
|
5
5
|
}
|
|
6
|
+
export function minimumCapMicroUsd(projectedMicroUsd, capMicroUsd) {
|
|
7
|
+
return Math.max(projectedMicroUsd, capMicroUsd + microUsdPerCent);
|
|
8
|
+
}
|
|
6
9
|
export function suggestedCapMicroUsd(projectedMicroUsd, capMicroUsd) {
|
|
7
|
-
const
|
|
8
|
-
return Math.ceil(
|
|
10
|
+
const minimum = minimumCapMicroUsd(projectedMicroUsd, capMicroUsd);
|
|
11
|
+
return Math.ceil(minimum / microUsdPerDollar) * microUsdPerDollar;
|
|
9
12
|
}
|
|
10
13
|
export function dollarsToMicroUsd(dollars) {
|
|
11
14
|
const value = Number(dollars.trim());
|
|
@@ -54,7 +54,7 @@ function MeterLegend(props) {
|
|
|
54
54
|
muted
|
|
55
55
|
} = props;
|
|
56
56
|
return /*#__PURE__*/_jsx("div", {
|
|
57
|
-
className: "flex flex-wrap justify-between gap-x-4 gap-y-1 text-xs text-
|
|
57
|
+
className: "flex flex-wrap justify-between gap-x-4 gap-y-1 text-xs text-faint tabular-nums",
|
|
58
58
|
children: outOfCredits ? /*#__PURE__*/_jsxs(_Fragment, {
|
|
59
59
|
children: [/*#__PURE__*/_jsxs("span", {
|
|
60
60
|
children: ["Next step needs ", /*#__PURE__*/_jsx(Amount, {
|
|
@@ -105,7 +105,7 @@ export function SpendMeter(props) {
|
|
|
105
105
|
"aria-hidden": true,
|
|
106
106
|
className: "relative h-4",
|
|
107
107
|
children: /*#__PURE__*/_jsxs("span", {
|
|
108
|
-
className: cn("
|
|
108
|
+
className: cn("absolute bottom-0 text-xs whitespace-nowrap text-faint tabular-nums", labelAlignment(limitPosition)),
|
|
109
109
|
style: {
|
|
110
110
|
left: `${limitPosition}%`
|
|
111
111
|
},
|
|
@@ -118,10 +118,10 @@ export function SpendMeter(props) {
|
|
|
118
118
|
"aria-valuemax": scale,
|
|
119
119
|
"aria-valuenow": projected,
|
|
120
120
|
"aria-valuetext": `${formatMicroUsd(projected)} after the next step, ${limitLabel.toLowerCase()} ${formatMicroUsd(limit)}`,
|
|
121
|
-
className: "relative h-1
|
|
121
|
+
className: "relative h-1 rounded-full bg-muted-foreground/15",
|
|
122
122
|
children: [/*#__PURE__*/_jsx("span", {
|
|
123
123
|
"aria-hidden": true,
|
|
124
|
-
className: cn("absolute inset-y-0 left-0", muted ? "bg-muted-foreground/
|
|
124
|
+
className: cn("absolute inset-y-0 left-0 rounded-l-full", muted ? "bg-muted-foreground/30" : "bg-muted-foreground/60"),
|
|
125
125
|
style: {
|
|
126
126
|
width: `${baseWidth}%`
|
|
127
127
|
}
|
|
@@ -134,7 +134,7 @@ export function SpendMeter(props) {
|
|
|
134
134
|
}
|
|
135
135
|
}), /*#__PURE__*/_jsx("span", {
|
|
136
136
|
"aria-hidden": true,
|
|
137
|
-
className: "absolute -inset-y-1 -ml-px w-px bg-foreground",
|
|
137
|
+
className: "absolute -inset-y-1 -ml-px w-px bg-foreground/70",
|
|
138
138
|
style: {
|
|
139
139
|
left: `${limitPosition}%`
|
|
140
140
|
}
|