asta-ui 0.9.5 → 0.9.7
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/css/asta.css +2 -2
- package/css/asta.js +1461 -1
- package/css/components.css +1900 -138
- package/css/runtime/agent.css +136 -0
- package/css/runtime/agent.js +173 -0
- package/css/runtime/assist.css +79 -0
- package/css/runtime/assist.js +799 -0
- package/css/runtime/controls.css +48 -0
- package/css/runtime/controls.js +482 -0
- package/css/src/agent.css +484 -0
- package/css/src/assist.css +598 -0
- package/css/src/controls.css +424 -0
- package/css/tokens.css +16 -0
- package/dist/agent-plan.d.ts +2 -0
- package/dist/agent-plan.js +11 -0
- package/dist/agent-team.d.ts +2 -0
- package/dist/agent-team.js +7 -0
- package/dist/api-keys.d.ts +2 -0
- package/dist/api-keys.js +10 -0
- package/dist/autonomy-dial.d.ts +2 -0
- package/dist/autonomy-dial.js +7 -0
- package/dist/base/agent-plan.d.ts +2 -0
- package/dist/base/agent-plan.js +11 -0
- package/dist/base/agent-team.d.ts +2 -0
- package/dist/base/agent-team.js +7 -0
- package/dist/base/api-keys.d.ts +2 -0
- package/dist/base/api-keys.js +10 -0
- package/dist/base/autonomy-dial.d.ts +2 -0
- package/dist/base/autonomy-dial.js +7 -0
- package/dist/base/change-ledger.d.ts +2 -0
- package/dist/base/change-ledger.js +7 -0
- package/dist/base/citations.d.ts +2 -0
- package/dist/base/citations.js +9 -0
- package/dist/base/context-meter.d.ts +2 -0
- package/dist/base/context-meter.js +14 -0
- package/dist/base/fallback-chain.d.ts +2 -0
- package/dist/base/fallback-chain.js +7 -0
- package/dist/base/model-picker.d.ts +2 -0
- package/dist/base/model-picker.js +9 -0
- package/dist/base/navbar.js +1 -1
- package/dist/base/prompt-composer.d.ts +2 -0
- package/dist/base/prompt-composer.js +9 -0
- package/dist/base/scrub-input.d.ts +2 -0
- package/dist/base/scrub-input.js +13 -0
- package/dist/base/sidebar.js +1 -1
- package/dist/base/thinking.d.ts +2 -0
- package/dist/base/thinking.js +11 -0
- package/dist/base/tool-approval.d.ts +2 -0
- package/dist/base/tool-approval.js +9 -0
- package/dist/base/trace-waterfall.d.ts +2 -0
- package/dist/base/trace-waterfall.js +9 -0
- package/dist/base.js +204 -136
- package/dist/change-ledger.d.ts +2 -0
- package/dist/change-ledger.js +7 -0
- package/dist/chunk-24O5V2PQ.js +253 -0
- package/dist/chunk-44DNL43W.js +490 -0
- package/dist/chunk-45IXJ7W7.js +245 -0
- package/dist/chunk-ANL6VX4X.js +326 -0
- package/dist/chunk-DNROUJ62.js +432 -0
- package/dist/{chunk-2EBWWZPS.js → chunk-DWPGFNNF.js} +38 -9
- package/dist/{chunk-CACW5LH3.js → chunk-EAHHWF3V.js} +38 -9
- package/dist/chunk-F4CWSZXK.js +226 -0
- package/dist/chunk-FT66LAUZ.js +388 -0
- package/dist/chunk-GBOJUMMY.js +163 -0
- package/dist/chunk-H4NFBYKY.js +275 -0
- package/dist/chunk-KFPGQ5RT.js +321 -0
- package/dist/chunk-OIIMYSVT.js +342 -0
- package/dist/chunk-SUWA7DM6.js +388 -0
- package/dist/chunk-TL32C2SQ.js +221 -0
- package/dist/chunk-UBTYMAKF.js +240 -0
- package/dist/chunk-W6YVDJHX.js +235 -0
- package/dist/chunk-XYQI4ZYV.js +314 -0
- package/dist/citations.d.ts +2 -0
- package/dist/citations.js +9 -0
- package/dist/context-meter.d.ts +2 -0
- package/dist/context-meter.js +14 -0
- package/dist/fallback-chain.d.ts +2 -0
- package/dist/fallback-chain.js +7 -0
- package/dist/index.js +204 -136
- package/dist/model-picker.d.ts +2 -0
- package/dist/model-picker.js +9 -0
- package/dist/navbar.js +1 -1
- package/dist/prompt-composer.d.ts +2 -0
- package/dist/prompt-composer.js +9 -0
- package/dist/scrub-input.d.ts +2 -0
- package/dist/scrub-input.js +13 -0
- package/dist/sidebar.js +1 -1
- package/dist/thinking.d.ts +2 -0
- package/dist/thinking.js +11 -0
- package/dist/tool-approval.d.ts +2 -0
- package/dist/tool-approval.js +9 -0
- package/dist/trace-waterfall.d.ts +2 -0
- package/dist/trace-waterfall.js +9 -0
- package/dist/types/components/kit/agent-plan.d.ts +34 -0
- package/dist/types/components/kit/api-keys.d.ts +62 -0
- package/dist/types/components/kit/base/navbar.d.ts +4 -1
- package/dist/types/components/kit/base/sidebar.d.ts +29 -7
- package/dist/types/components/kit/citations.d.ts +34 -0
- package/dist/types/components/kit/context-meter.d.ts +38 -0
- package/dist/types/components/kit/model-picker.d.ts +46 -0
- package/dist/types/components/kit/navbar.d.ts +4 -1
- package/dist/types/components/kit/prompt-composer.d.ts +61 -0
- package/dist/types/components/kit/scrub-input.d.ts +44 -0
- package/dist/types/components/kit/sidebar.d.ts +29 -7
- package/dist/types/components/kit/thinking.d.ts +28 -0
- package/dist/types/components/kit/tool-approval.d.ts +43 -0
- package/dist/types/components/kit/trace-waterfall.d.ts +44 -0
- package/dist/types/components/lab/blocks/AgentTeam.d.ts +2 -0
- package/dist/types/components/lab/blocks/AutonomyDial.d.ts +2 -0
- package/dist/types/components/lab/blocks/ChangeLedger.d.ts +2 -0
- package/dist/types/components/lab/blocks/FallbackChain.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/agent-plan.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/agent-team.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/api-keys.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/autonomy-dial.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/agent-plan.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/agent-team.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/api-keys.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/autonomy-dial.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/change-ledger.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/citations.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/context-meter.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/fallback-chain.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/model-picker.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/prompt-composer.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/scrub-input.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/thinking.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/tool-approval.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/trace-waterfall.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base.d.ts +26 -2
- package/dist/types/packages/asta-ui/src/change-ledger.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/citations.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/context-meter.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/fallback-chain.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/index.d.ts +26 -2
- package/dist/types/packages/asta-ui/src/model-picker.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/prompt-composer.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/scrub-input.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/thinking.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/tool-approval.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/trace-waterfall.d.ts +2 -0
- package/package.json +1 -1
- package/dist/chunk-MVE7RJJ6.js +0 -322
- package/dist/chunk-TBMUSER2.js +0 -322
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// components/kit/scrub-input.tsx
|
|
4
|
+
import { useEffect, useId, useRef, useState } from "react";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
var cx = (...c) => c.filter(Boolean).join(" ");
|
|
7
|
+
var KEYFRAMES = `@keyframes asta-scrub-tip { from { opacity: 0; transform: translateY(-3px) } }
|
|
8
|
+
@media (prefers-reduced-motion: reduce) { .asta-scrub-a, .asta-scrub-a * { animation: none !important; transition-duration: 0s !important } }`;
|
|
9
|
+
var UNITS = {
|
|
10
|
+
px: ["len", 1],
|
|
11
|
+
rem: ["len", 16],
|
|
12
|
+
em: ["len", 16],
|
|
13
|
+
pt: ["len", 4 / 3],
|
|
14
|
+
deg: ["ang", 1],
|
|
15
|
+
"\xB0": ["ang", 1],
|
|
16
|
+
rad: ["ang", 180 / Math.PI],
|
|
17
|
+
turn: ["ang", 360],
|
|
18
|
+
"%": ["pct", 1],
|
|
19
|
+
ms: ["time", 1],
|
|
20
|
+
s: ["time", 1e3]
|
|
21
|
+
};
|
|
22
|
+
function tokenize(src, unit) {
|
|
23
|
+
const out = [];
|
|
24
|
+
const base = unit ? UNITS[unit] : void 0;
|
|
25
|
+
const re = /\s*(?:(\d*\.?\d+(?:e[+-]?\d+)?)\s*([a-z%°]*)|([-+*/×÷()]))\s*/giy;
|
|
26
|
+
let i = 0;
|
|
27
|
+
while (i < src.length) {
|
|
28
|
+
re.lastIndex = i;
|
|
29
|
+
const m = re.exec(src);
|
|
30
|
+
if (!m) return null;
|
|
31
|
+
i = re.lastIndex;
|
|
32
|
+
if (m[3]) {
|
|
33
|
+
out.push({ t: "op", v: m[3] === "\xD7" ? "*" : m[3] === "\xF7" ? "/" : m[3] });
|
|
34
|
+
continue;
|
|
35
|
+
}
|
|
36
|
+
let v = Number(m[1]);
|
|
37
|
+
const u = m[2].toLowerCase();
|
|
38
|
+
if (u && u !== unit) {
|
|
39
|
+
const typed = UNITS[u];
|
|
40
|
+
if (!typed || !base || typed[0] !== base[0]) return null;
|
|
41
|
+
v = v * typed[1] / base[1];
|
|
42
|
+
}
|
|
43
|
+
out.push({ t: "num", v });
|
|
44
|
+
}
|
|
45
|
+
return out;
|
|
46
|
+
}
|
|
47
|
+
function parseScrubValue(text, current, unit) {
|
|
48
|
+
let src = text.trim().replace(/,/g, ".").replace(/−/g, "-");
|
|
49
|
+
if (!src || src.length > 64) return null;
|
|
50
|
+
let rel = null;
|
|
51
|
+
if (/^[+*/×÷]/.test(src)) {
|
|
52
|
+
rel = src[0] === "\xD7" ? "*" : src[0] === "\xF7" ? "/" : src[0];
|
|
53
|
+
src = src.slice(1);
|
|
54
|
+
}
|
|
55
|
+
const tokens = tokenize(src, unit);
|
|
56
|
+
if (!tokens?.length) return null;
|
|
57
|
+
let p = 0;
|
|
58
|
+
const isOp = (...ops) => tokens[p]?.t === "op" && ops.includes(tokens[p].v);
|
|
59
|
+
const factor = () => {
|
|
60
|
+
const tk = tokens[p++];
|
|
61
|
+
if (!tk) return NaN;
|
|
62
|
+
if (tk.t === "num") return tk.v;
|
|
63
|
+
if (tk.v === "-") return -factor();
|
|
64
|
+
if (tk.v === "+") return factor();
|
|
65
|
+
if (tk.v === "(") {
|
|
66
|
+
const v2 = expr();
|
|
67
|
+
return tokens[p++]?.v === ")" ? v2 : NaN;
|
|
68
|
+
}
|
|
69
|
+
return NaN;
|
|
70
|
+
};
|
|
71
|
+
const term = () => {
|
|
72
|
+
let v2 = factor();
|
|
73
|
+
while (isOp("*", "/")) v2 = tokens[p++].v === "*" ? v2 * factor() : v2 / factor();
|
|
74
|
+
return v2;
|
|
75
|
+
};
|
|
76
|
+
const expr = () => {
|
|
77
|
+
let v2 = term();
|
|
78
|
+
while (isOp("+", "-")) v2 = tokens[p++].v === "+" ? v2 + term() : v2 - term();
|
|
79
|
+
return v2;
|
|
80
|
+
};
|
|
81
|
+
let v = expr();
|
|
82
|
+
if (p !== tokens.length || !Number.isFinite(v)) return null;
|
|
83
|
+
if (rel === "+") v = current + v;
|
|
84
|
+
else if (rel === "*") v = current * v;
|
|
85
|
+
else if (rel === "/") v = v === 0 ? NaN : current / v;
|
|
86
|
+
return Number.isFinite(v) ? v : null;
|
|
87
|
+
}
|
|
88
|
+
var round = (v, precision) => Math.round(v * 10 ** precision) / 10 ** precision;
|
|
89
|
+
var fmt = (v, precision) => String(round(v, precision)).replace(/^-0$/, "0");
|
|
90
|
+
var factorOf = (e) => e.shiftKey ? 10 : e.altKey ? 0.1 : 1;
|
|
91
|
+
function ScrubInput({ label, title, value, defaultValue = 0, onChange, min = -Infinity, max = Infinity, step = 1, precision = 2, unit, name, disabled, size = "md", className }) {
|
|
92
|
+
const [inner, setInner] = useState(defaultValue);
|
|
93
|
+
const current = value ?? inner;
|
|
94
|
+
const [draft, setDraft] = useState(null);
|
|
95
|
+
const [invalid, setInvalid] = useState(false);
|
|
96
|
+
const [scrub, setScrub] = useState(null);
|
|
97
|
+
const [limit, setLimit] = useState(null);
|
|
98
|
+
const [status, setStatus] = useState("");
|
|
99
|
+
const [tipEnd, setTipEnd] = useState(false);
|
|
100
|
+
const root = useRef(null);
|
|
101
|
+
const input = useRef(null);
|
|
102
|
+
const drag = useRef({ x: 0, raw: 0, moved: false, id: -1 });
|
|
103
|
+
const timer = useRef(void 0);
|
|
104
|
+
const errId = useId();
|
|
105
|
+
useEffect(
|
|
106
|
+
() => () => {
|
|
107
|
+
clearTimeout(timer.current);
|
|
108
|
+
document.documentElement.style.cursor = "";
|
|
109
|
+
},
|
|
110
|
+
[]
|
|
111
|
+
);
|
|
112
|
+
const set = (want) => {
|
|
113
|
+
const next = round(Math.min(max, Math.max(min, want)), precision);
|
|
114
|
+
if (want < min || want > max) {
|
|
115
|
+
const side = want < min ? "min" : "max";
|
|
116
|
+
setLimit(side);
|
|
117
|
+
setStatus(`${side === "min" ? "Minimum" : "Maximum"} is ${fmt(side === "min" ? min : max, precision)}${unit ?? ""}`);
|
|
118
|
+
clearTimeout(timer.current);
|
|
119
|
+
timer.current = setTimeout(() => setLimit(null), 420);
|
|
120
|
+
}
|
|
121
|
+
if (next !== current) {
|
|
122
|
+
if (value === void 0) setInner(next);
|
|
123
|
+
onChange?.(next);
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
const commit = (keepFocus) => {
|
|
127
|
+
if (draft === null) return true;
|
|
128
|
+
const n = parseScrubValue(draft, current, unit);
|
|
129
|
+
if (n === null && keepFocus) {
|
|
130
|
+
const r = root.current?.getBoundingClientRect();
|
|
131
|
+
const edge = root.current?.closest("[role=group],section")?.getBoundingClientRect().right ?? window.innerWidth;
|
|
132
|
+
setTipEnd(!!r && r.left + 220 > edge);
|
|
133
|
+
setInvalid(true);
|
|
134
|
+
setStatus(`Couldn't read \u201C${draft.trim()}\u201D.`);
|
|
135
|
+
return false;
|
|
136
|
+
}
|
|
137
|
+
if (n === null) setStatus(`Kept ${fmt(current, precision)}${unit ?? ""}.`);
|
|
138
|
+
else set(n);
|
|
139
|
+
setDraft(null);
|
|
140
|
+
setInvalid(false);
|
|
141
|
+
return true;
|
|
142
|
+
};
|
|
143
|
+
const reselect = () => setTimeout(() => input.current?.select());
|
|
144
|
+
const onKey = (e) => {
|
|
145
|
+
if (e.key === "Enter") {
|
|
146
|
+
e.preventDefault();
|
|
147
|
+
if (commit(true)) reselect();
|
|
148
|
+
} else if (e.key === "Escape") {
|
|
149
|
+
if (draft === null) return;
|
|
150
|
+
e.preventDefault();
|
|
151
|
+
setDraft(null);
|
|
152
|
+
setInvalid(false);
|
|
153
|
+
reselect();
|
|
154
|
+
} else if (["ArrowUp", "ArrowDown", "PageUp", "PageDown"].includes(e.key)) {
|
|
155
|
+
e.preventDefault();
|
|
156
|
+
const base = draft === null ? current : parseScrubValue(draft, current, unit) ?? current;
|
|
157
|
+
const dir = e.key === "ArrowUp" || e.key === "PageUp" ? 1 : -1;
|
|
158
|
+
setDraft(null);
|
|
159
|
+
setInvalid(false);
|
|
160
|
+
set(base + dir * step * (e.key.startsWith("Page") ? 10 : factorOf(e)));
|
|
161
|
+
reselect();
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
const down = (e) => {
|
|
165
|
+
if (disabled || e.pointerType === "mouse" && e.button !== 0) return;
|
|
166
|
+
e.preventDefault();
|
|
167
|
+
try {
|
|
168
|
+
e.currentTarget.setPointerCapture(e.pointerId);
|
|
169
|
+
} catch {
|
|
170
|
+
}
|
|
171
|
+
commit(false);
|
|
172
|
+
drag.current = { x: e.clientX, raw: current, moved: false, id: e.pointerId };
|
|
173
|
+
setScrub(factorOf(e));
|
|
174
|
+
document.documentElement.style.cursor = "ew-resize";
|
|
175
|
+
};
|
|
176
|
+
const move = (e) => {
|
|
177
|
+
const d = drag.current;
|
|
178
|
+
if (scrub === null || e.pointerId !== d.id) return;
|
|
179
|
+
const dx = e.clientX - d.x;
|
|
180
|
+
if (!d.moved && Math.abs(dx) < 3) return;
|
|
181
|
+
d.moved = true;
|
|
182
|
+
d.x = e.clientX;
|
|
183
|
+
const f = factorOf(e);
|
|
184
|
+
if (f !== scrub) setScrub(f);
|
|
185
|
+
const want = d.raw + dx / 2 * step * f;
|
|
186
|
+
d.raw = Math.min(max, Math.max(min, want));
|
|
187
|
+
const grid = step * f;
|
|
188
|
+
set(want < min || want > max ? want : Math.round(want / grid) * grid);
|
|
189
|
+
};
|
|
190
|
+
const up = (e) => {
|
|
191
|
+
if (scrub === null || e.pointerId !== drag.current.id) return;
|
|
192
|
+
drag.current.id = -1;
|
|
193
|
+
setScrub(null);
|
|
194
|
+
document.documentElement.style.cursor = "";
|
|
195
|
+
if (!drag.current.moved) {
|
|
196
|
+
input.current?.focus();
|
|
197
|
+
input.current?.select();
|
|
198
|
+
}
|
|
199
|
+
};
|
|
200
|
+
const sm = size === "sm";
|
|
201
|
+
const a11yName = title ?? (typeof label === "string" ? label : void 0);
|
|
202
|
+
return /* @__PURE__ */ jsxs(
|
|
203
|
+
"label",
|
|
204
|
+
{
|
|
205
|
+
ref: root,
|
|
206
|
+
"data-scrubbing": scrub !== null || void 0,
|
|
207
|
+
"data-limit": limit ?? void 0,
|
|
208
|
+
className: cx(
|
|
209
|
+
"asta-scrub-a group/scrub relative flex min-w-0 items-center rounded-[7px] bg-[color-mix(in_srgb,var(--ink)_5%,transparent)] text-ink transition-[background-color,box-shadow] duration-150",
|
|
210
|
+
"hover:bg-[color-mix(in_srgb,var(--ink)_8%,transparent)] focus-within:bg-paper focus-within:shadow-[inset_0_0_0_1.5px_var(--brand)]",
|
|
211
|
+
"data-[scrubbing]:bg-paper data-[scrubbing]:shadow-[inset_0_0_0_1.5px_var(--brand)]",
|
|
212
|
+
invalid && "!shadow-[inset_0_0_0_1.5px_var(--ink)]",
|
|
213
|
+
sm ? "h-8 sm:h-7" : "h-9 sm:h-8",
|
|
214
|
+
disabled && "pointer-events-none opacity-45",
|
|
215
|
+
className
|
|
216
|
+
),
|
|
217
|
+
children: [
|
|
218
|
+
/* @__PURE__ */ jsx("style", { href: "asta-scrub-input", precedence: "asta", children: KEYFRAMES }),
|
|
219
|
+
/* @__PURE__ */ jsx(
|
|
220
|
+
"span",
|
|
221
|
+
{
|
|
222
|
+
"aria-hidden": true,
|
|
223
|
+
title: a11yName ? `${a11yName}: drag to change` : void 0,
|
|
224
|
+
onPointerDown: down,
|
|
225
|
+
onPointerMove: move,
|
|
226
|
+
onPointerUp: up,
|
|
227
|
+
onPointerCancel: up,
|
|
228
|
+
onLostPointerCapture: up,
|
|
229
|
+
className: cx(
|
|
230
|
+
"grid h-full shrink-0 cursor-ew-resize touch-none select-none place-items-center text-[11.5px] font-medium text-mute transition-colors duration-150 hover:text-ink group-data-[scrubbing]/scrub:text-brand [&>svg]:h-3.5 [&>svg]:w-3.5",
|
|
231
|
+
sm ? "w-6" : "w-7"
|
|
232
|
+
),
|
|
233
|
+
children: label
|
|
234
|
+
}
|
|
235
|
+
),
|
|
236
|
+
/* @__PURE__ */ jsx(
|
|
237
|
+
"input",
|
|
238
|
+
{
|
|
239
|
+
ref: input,
|
|
240
|
+
role: "spinbutton",
|
|
241
|
+
"aria-label": a11yName,
|
|
242
|
+
"aria-valuenow": current,
|
|
243
|
+
"aria-valuemin": Number.isFinite(min) ? min : void 0,
|
|
244
|
+
"aria-valuemax": Number.isFinite(max) ? max : void 0,
|
|
245
|
+
"aria-valuetext": `${fmt(current, precision)}${unit ? ` ${unit}` : ""}`,
|
|
246
|
+
"aria-invalid": invalid || void 0,
|
|
247
|
+
"aria-describedby": invalid ? errId : void 0,
|
|
248
|
+
inputMode: "text",
|
|
249
|
+
autoComplete: "off",
|
|
250
|
+
spellCheck: false,
|
|
251
|
+
disabled,
|
|
252
|
+
value: draft ?? fmt(current, precision),
|
|
253
|
+
onChange: (e) => {
|
|
254
|
+
setDraft(e.target.value);
|
|
255
|
+
setInvalid(false);
|
|
256
|
+
},
|
|
257
|
+
onFocus: (e) => e.target.select(),
|
|
258
|
+
onBlur: () => commit(false),
|
|
259
|
+
onKeyDown: onKey,
|
|
260
|
+
className: cx(
|
|
261
|
+
"h-full min-w-0 flex-1 bg-transparent pr-1 text-[16px] tabular-nums tracking-[-0.01em] outline-none transition-transform duration-200 ease-[cubic-bezier(.16,1,.3,1)] selection:bg-[color-mix(in_srgb,var(--brand)_22%,transparent)]",
|
|
262
|
+
sm ? "sm:text-[12px]" : "sm:text-[12.5px]",
|
|
263
|
+
limit === "max" && "translate-x-[3px]",
|
|
264
|
+
limit === "min" && "-translate-x-[3px]"
|
|
265
|
+
)
|
|
266
|
+
}
|
|
267
|
+
),
|
|
268
|
+
scrub !== null && scrub !== 1 ? /* @__PURE__ */ jsxs("span", { "aria-hidden": true, className: "mr-1.5 shrink-0 rounded-[4px] bg-brand px-1 text-[10.5px] font-medium leading-4 tabular-nums text-white", children: [
|
|
269
|
+
"\xD7",
|
|
270
|
+
scrub
|
|
271
|
+
] }) : unit && /* @__PURE__ */ jsx("span", { "aria-hidden": true, className: "shrink-0 pr-2 text-[11.5px] text-mute", children: unit }),
|
|
272
|
+
/* @__PURE__ */ jsx(
|
|
273
|
+
"span",
|
|
274
|
+
{
|
|
275
|
+
"aria-hidden": true,
|
|
276
|
+
className: cx(
|
|
277
|
+
"pointer-events-none absolute inset-y-1.5 w-[2px] rounded-full bg-brand transition-opacity ease-[cubic-bezier(.16,1,.3,1)]",
|
|
278
|
+
limit ? "opacity-100 duration-100" : "opacity-0 duration-500",
|
|
279
|
+
limit === "min" ? "left-0.5" : "right-0.5"
|
|
280
|
+
)
|
|
281
|
+
}
|
|
282
|
+
),
|
|
283
|
+
invalid && /* @__PURE__ */ jsx(
|
|
284
|
+
"span",
|
|
285
|
+
{
|
|
286
|
+
id: errId,
|
|
287
|
+
className: cx(
|
|
288
|
+
"absolute top-[calc(100%+6px)] z-10 w-max max-w-[220px] rounded-[8px] bg-ink px-2.5 py-1.5 text-[12px] leading-snug text-paper shadow-[0_8px_24px_-10px_rgb(0_0_0/0.4)] [animation:asta-scrub-tip_.2s_cubic-bezier(.16,1,.3,1)]",
|
|
289
|
+
tipEnd ? "right-0" : "left-0"
|
|
290
|
+
),
|
|
291
|
+
children: "Try 24, 1.5rem or 24*2. Esc puts it back."
|
|
292
|
+
}
|
|
293
|
+
),
|
|
294
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", role: "status", "aria-live": "polite", children: status }),
|
|
295
|
+
name && /* @__PURE__ */ jsx("input", { type: "hidden", name, value: current })
|
|
296
|
+
]
|
|
297
|
+
}
|
|
298
|
+
);
|
|
299
|
+
}
|
|
300
|
+
var COLS = { 1: "grid-cols-1", 2: "grid-cols-2", 3: "grid-cols-3", 4: "grid-cols-4" };
|
|
301
|
+
function ScrubRow({ label, cols = 2, children, className }) {
|
|
302
|
+
return /* @__PURE__ */ jsxs("div", { role: "group", "aria-label": label, className: cx("grid items-center gap-x-3", label ? "grid-cols-[64px_1fr]" : "grid-cols-1", className), children: [
|
|
303
|
+
label && /* @__PURE__ */ jsx("span", { className: "truncate text-[12px] text-mute", children: label }),
|
|
304
|
+
/* @__PURE__ */ jsx("div", { className: cx("grid min-w-0 gap-1.5", COLS[cols]), children })
|
|
305
|
+
] });
|
|
306
|
+
}
|
|
307
|
+
var scrub_input_default = ScrubInput;
|
|
308
|
+
|
|
309
|
+
export {
|
|
310
|
+
parseScrubValue,
|
|
311
|
+
ScrubInput,
|
|
312
|
+
ScrubRow,
|
|
313
|
+
scrub_input_default
|
|
314
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
ContextBreakdown,
|
|
4
|
+
ContextMeter,
|
|
5
|
+
context_meter_default,
|
|
6
|
+
formatTokens
|
|
7
|
+
} from "./chunk-24O5V2PQ.js";
|
|
8
|
+
import "./chunk-IATF2OTU.js";
|
|
9
|
+
export {
|
|
10
|
+
ContextBreakdown,
|
|
11
|
+
ContextMeter,
|
|
12
|
+
context_meter_default as default,
|
|
13
|
+
formatTokens
|
|
14
|
+
};
|