@locusgraph/loop 0.1.0 → 0.2.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/README.md +2 -0
- package/dist/agent/pulse/gradient-label.js +36 -15
- package/dist/agent/pulse/marks/bars-mark.js +24 -10
- package/dist/agent/pulse/marks/glyph-mark.js +17 -11
- package/dist/agent/pulse/marks/locus-mark.js +39 -28
- package/dist/agent/pulse/marks/orb-mark.js +21 -8
- package/dist/agent/pulse/marks/spinner-mark.js +20 -1
- package/dist/agent/pulse/pulse.js +63 -35
- package/dist/agent/pulse/use-loop-animation.js +14 -16
- package/dist/agent/steps/step-icon.js +40 -24
- package/dist/agent/steps/steps.js +72 -25
- package/dist/agent/thinking/thinking.js +203 -23
- package/dist/agent/thinking/thought-duration.js +7 -9
- package/dist/agent/tool/json-block.js +18 -11
- package/dist/agent/tool/tool-status.js +28 -18
- package/dist/agent/tool/tool.js +184 -6
- package/dist/approval/inbox/inbox-row.d.ts +3 -2
- package/dist/approval/inbox/inbox-row.js +96 -7
- package/dist/approval/inbox/inbox-selection.js +7 -13
- package/dist/approval/inbox/inbox.d.ts +2 -1
- package/dist/approval/inbox/inbox.js +99 -18
- package/dist/approval/inbox/virtual-inbox-list.d.ts +13 -0
- package/dist/approval/inbox/virtual-inbox-list.js +53 -0
- package/dist/approval/memory/memory-choices.js +27 -22
- package/dist/approval/memory/memory-review.js +108 -17
- package/dist/approval/memory/memory-row.js +80 -19
- package/dist/approval/plan/plan-review.js +129 -28
- package/dist/approval/plan/plan-step-row.js +91 -44
- package/dist/approval/plan/plan-steps.js +24 -23
- package/dist/approval/plan/question-choices.js +73 -40
- package/dist/approval/plan/question.d.ts +1 -1
- package/dist/approval/plan/question.js +108 -27
- package/dist/approval/run/run-bar.js +94 -22
- package/dist/approval/shared/decision-line.js +1 -1
- package/dist/approval/shared/risk-badge.js +32 -16
- package/dist/approval/shared/time.js +5 -8
- package/dist/approval/shared/use-focus-on-mount.js +7 -6
- package/dist/approval/spend/raise-cap-form.js +64 -19
- package/dist/approval/spend/spend-gate.js +124 -21
- package/dist/approval/spend/spend-math.js +7 -8
- package/dist/approval/spend/spend-meter.js +136 -35
- package/dist/approval/tool/approval.js +113 -27
- package/dist/approval/tool/args/args-editor.js +104 -26
- package/dist/approval/tool/args/args-field.js +79 -22
- package/dist/approval/tool/args/args-validation.js +38 -47
- package/dist/approval/tool/deny-form.js +43 -10
- package/dist/approval/tool/tool-inputs.js +62 -38
- package/dist/chat/chat/chat-item-spacing.d.ts +3 -0
- package/dist/chat/chat/chat-item-spacing.js +19 -0
- package/dist/chat/chat/chat.d.ts +2 -1
- package/dist/chat/chat/chat.js +181 -5
- package/dist/chat/chat/use-stick-to-bottom.js +71 -48
- package/dist/chat/chat/virtual-chat-items.d.ts +8 -0
- package/dist/chat/chat/virtual-chat-items.js +60 -0
- package/dist/chat/composer/composer-actions.js +69 -17
- package/dist/chat/composer/composer.js +330 -32
- package/dist/chat/composer/use-auto-grow.js +9 -9
- package/dist/chat/files/file-meta.js +19 -19
- package/dist/chat/files/files.js +92 -29
- package/dist/chat/reply/fenced-code.js +23 -21
- package/dist/chat/reply/markdown-components.js +137 -17
- package/dist/chat/reply/reply.js +30 -10
- package/dist/chat/turn/group-parts.js +43 -29
- package/dist/chat/turn/turn.js +87 -30
- package/dist/cost/context.js +104 -23
- package/dist/cost/cost-steps.js +67 -14
- package/dist/cost/cost.js +128 -23
- package/dist/cost/model-picker.js +51 -6
- package/dist/cost/shared/context-breakdown.js +83 -10
- package/dist/cost/shared/meter-marks.js +49 -9
- package/dist/cost/shared/model-option-row.js +56 -22
- package/dist/cost/shared/step-cost-row.js +65 -22
- package/dist/cost/shared/usage-totals.js +22 -18
- package/dist/memory/cite.js +62 -12
- package/dist/memory/memorized.js +65 -11
- package/dist/memory/recall.js +101 -17
- package/dist/memory/shared/host-label.js +19 -22
- package/dist/memory/shared/source-mark.js +11 -3
- package/dist/memory/sources.js +78 -14
- package/dist/shared/decision-summary.js +51 -14
- package/dist/shared/panel-empty.js +20 -3
- package/dist/shared/panel.js +69 -13
- package/dist/shared/status-dot.js +16 -8
- package/dist/shared/virtual/use-list-virtualizer.d.ts +24 -0
- package/dist/shared/virtual/use-list-virtualizer.js +68 -0
- package/dist/thread/actions/action-button.js +22 -3
- package/dist/thread/actions/actions.js +184 -13
- package/dist/thread/actions/branch-switcher.js +28 -5
- package/dist/thread/canvas/canvas.js +205 -5
- package/dist/thread/canvas/version-switcher.js +54 -8
- package/dist/thread/code/code.js +186 -24
- package/dist/thread/code/copy-code-button.js +30 -14
- package/dist/thread/code/highlight.js +30 -29
- package/dist/thread/history/history-rows.d.ts +16 -0
- package/dist/thread/history/history-rows.js +23 -0
- package/dist/thread/history/history.d.ts +3 -2
- package/dist/thread/history/history.js +174 -5
- package/dist/thread/history/{history-row.d.ts → row/history-row.d.ts} +3 -2
- package/dist/thread/history/row/history-row.js +58 -0
- package/dist/thread/history/row/thread-item-menu.js +31 -0
- package/dist/thread/history/row/thread-title-editor.js +38 -0
- package/dist/thread/history/thread-groups.d.ts +1 -1
- package/dist/thread/history/thread-groups.js +40 -34
- package/dist/thread/history/virtual-history-list.d.ts +11 -0
- package/dist/thread/history/virtual-history-list.js +71 -0
- package/dist/thread/index.d.ts +1 -1
- package/dist/thread/starters/starters.js +33 -8
- package/dist/thread/use-copied.js +18 -16
- package/dist/types.js +1 -1
- package/package.json +6 -4
- package/dist/thread/history/history-row.js +0 -17
- package/dist/thread/history/thread-item-menu.js +0 -6
- package/dist/thread/history/thread-title-editor.js +0 -25
- /package/dist/thread/history/{thread-item-menu.d.ts → row/thread-item-menu.d.ts} +0 -0
- /package/dist/thread/history/{thread-title-editor.d.ts → row/thread-title-editor.d.ts} +0 -0
package/README.md
CHANGED
|
@@ -22,6 +22,8 @@ import { Chat, Composer, Turn } from "@locusgraph/loop";
|
|
|
22
22
|
<Composer status={status} onSubmit={(text) => sendMessage({ text })} onStop={stop} />
|
|
23
23
|
```
|
|
24
24
|
|
|
25
|
+
`Chat`, `History` and `Inbox` virtualize with TanStack Virtual above 50 items: only the rows near the viewport are mounted, so a long agent session stays fast. Pass `virtualize={false}` to mount every item. The built package is compiled with the React Compiler, so components skip re-rendering when their props have not changed.
|
|
26
|
+
|
|
25
27
|
| Group | Components |
|
|
26
28
|
|---|---|
|
|
27
29
|
| Chat | `Chat`, `Turn`, `Reply`, `Composer`, `Files` |
|
|
@@ -1,23 +1,44 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
1
|
import { AiGenerate as SparkleIcon } from "@carbon/icons-react";
|
|
3
2
|
import { cn } from "@locusgraph/components";
|
|
4
3
|
import { useLoopAnimation } from "./use-loop-animation.js";
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
];
|
|
4
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
5
|
+
const drift = [{
|
|
6
|
+
backgroundPosition: "0% 50%"
|
|
7
|
+
}, {
|
|
8
|
+
backgroundPosition: "200% 50%"
|
|
9
|
+
}];
|
|
10
|
+
const turn = [{
|
|
11
|
+
transform: "rotate(0deg) scale(1)"
|
|
12
|
+
}, {
|
|
13
|
+
transform: "rotate(180deg) scale(0.8)"
|
|
14
|
+
}, {
|
|
15
|
+
transform: "rotate(360deg) scale(1)"
|
|
16
|
+
}];
|
|
11
17
|
const toneIcon = {
|
|
12
|
-
|
|
13
|
-
|
|
18
|
+
neutral: "fill-foreground/70 text-foreground/70",
|
|
19
|
+
brand: "fill-violet-500 text-violet-500"
|
|
14
20
|
};
|
|
15
21
|
const toneText = {
|
|
16
|
-
|
|
17
|
-
|
|
22
|
+
neutral: "bg-[linear-gradient(90deg,var(--color-muted-foreground),var(--color-foreground),var(--color-muted-foreground))]",
|
|
23
|
+
brand: "bg-[linear-gradient(90deg,var(--color-sky-500),var(--color-violet-500),var(--color-pink-500),var(--color-sky-500))]"
|
|
18
24
|
};
|
|
19
|
-
export function GradientLabel({
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
25
|
+
export function GradientLabel({
|
|
26
|
+
label,
|
|
27
|
+
tone = "neutral"
|
|
28
|
+
}) {
|
|
29
|
+
const text = useLoopAnimation(drift, 2600, 0, "linear");
|
|
30
|
+
const icon = useLoopAnimation(turn, 2600);
|
|
31
|
+
return /*#__PURE__*/_jsxs("span", {
|
|
32
|
+
className: "inline-flex items-center gap-1.5",
|
|
33
|
+
children: [/*#__PURE__*/_jsx(SparkleIcon, {
|
|
34
|
+
ref: icon,
|
|
35
|
+
"aria-hidden": true,
|
|
36
|
+
className: cn("size-[1.05em]", toneIcon[tone])
|
|
37
|
+
}), /*#__PURE__*/_jsx("span", {
|
|
38
|
+
ref: text,
|
|
39
|
+
"data-slot": "pulse-gradient",
|
|
40
|
+
className: cn("bg-[length:200%_100%] bg-clip-text font-medium text-transparent", toneText[tone]),
|
|
41
|
+
children: label
|
|
42
|
+
})]
|
|
43
|
+
});
|
|
23
44
|
}
|
|
@@ -1,15 +1,29 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
1
|
import { useLoopAnimation } from "../use-loop-animation.js";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
const bounce = [{
|
|
4
|
+
transform: "scaleY(0.35)"
|
|
5
|
+
}, {
|
|
6
|
+
transform: "scaleY(1)"
|
|
7
|
+
}, {
|
|
8
|
+
transform: "scaleY(0.35)"
|
|
9
|
+
}];
|
|
8
10
|
const barDelays = [0, 140, 280, 420];
|
|
9
|
-
function Bar({
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
function Bar({
|
|
12
|
+
delay
|
|
13
|
+
}) {
|
|
14
|
+
const ref = useLoopAnimation(bounce, 900, delay);
|
|
15
|
+
return /*#__PURE__*/_jsx("span", {
|
|
16
|
+
ref: ref,
|
|
17
|
+
className: "h-full w-[0.16em] origin-center scale-y-[0.35] rounded-full bg-current"
|
|
18
|
+
});
|
|
12
19
|
}
|
|
13
20
|
export function BarsMark() {
|
|
14
|
-
|
|
21
|
+
return /*#__PURE__*/_jsx("span", {
|
|
22
|
+
"aria-hidden": true,
|
|
23
|
+
"data-slot": "pulse-bars",
|
|
24
|
+
className: "inline-flex h-[1em] items-center gap-[0.14em] text-foreground/70",
|
|
25
|
+
children: barDelays.map(delay => /*#__PURE__*/_jsx(Bar, {
|
|
26
|
+
delay: delay
|
|
27
|
+
}, delay))
|
|
28
|
+
});
|
|
15
29
|
}
|
|
@@ -1,17 +1,23 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
1
|
import { cn } from "@locusgraph/components";
|
|
3
2
|
import { useEffect, useState } from "react";
|
|
4
3
|
import { prefersReducedMotion } from "../use-loop-animation.js";
|
|
4
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
5
|
const glyphs = ["·", "✢", "✳", "✶", "✻", "✽", "✻", "✶", "✳", "✢"];
|
|
6
6
|
const restingGlyph = "✻";
|
|
7
|
-
export function GlyphMark({
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
7
|
+
export function GlyphMark({
|
|
8
|
+
tone = "neutral"
|
|
9
|
+
}) {
|
|
10
|
+
const [index, setIndex] = useState();
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
if (prefersReducedMotion()) return;
|
|
13
|
+
setIndex(0);
|
|
14
|
+
const timer = window.setInterval(() => setIndex(current => ((current ?? 0) + 1) % glyphs.length), 120);
|
|
15
|
+
return () => window.clearInterval(timer);
|
|
16
|
+
}, []);
|
|
17
|
+
return /*#__PURE__*/_jsx("span", {
|
|
18
|
+
"aria-hidden": true,
|
|
19
|
+
"data-slot": "pulse-glyph",
|
|
20
|
+
className: cn("inline-flex w-[1.1em] justify-center font-mono text-[1.15em] leading-none", tone === "brand" ? "text-orange-500" : "text-foreground/70"),
|
|
21
|
+
children: index === undefined ? restingGlyph : glyphs[index]
|
|
22
|
+
});
|
|
17
23
|
}
|
|
@@ -1,38 +1,49 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
1
|
import { LocusGraphMark } from "@locusgraph/brand";
|
|
3
2
|
import { useEffect, useRef } from "react";
|
|
4
3
|
import { prefersReducedMotion } from "../use-loop-animation.js";
|
|
4
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
5
|
const sweepMs = 1800;
|
|
6
|
-
const markCenter = {
|
|
7
|
-
|
|
6
|
+
const markCenter = {
|
|
7
|
+
x: 14.5,
|
|
8
|
+
y: 13
|
|
9
|
+
};
|
|
10
|
+
const rayGlow = [{
|
|
11
|
+
opacity: 0.3
|
|
12
|
+
}, {
|
|
13
|
+
opacity: 1,
|
|
14
|
+
offset: 0.12
|
|
15
|
+
}, {
|
|
16
|
+
opacity: 0.3
|
|
17
|
+
}];
|
|
8
18
|
function sweepDelay(path) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
19
|
+
const box = path.getBBox();
|
|
20
|
+
const angle = Math.atan2(box.y + box.height / 2 - markCenter.y, box.x + box.width / 2 - markCenter.x);
|
|
21
|
+
const turn = (angle + Math.PI) / (2 * Math.PI);
|
|
22
|
+
return -(1 - turn) * sweepMs;
|
|
13
23
|
}
|
|
14
24
|
function animateRays(svg) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}));
|
|
25
|
+
const rays = [...svg.querySelectorAll("path")];
|
|
26
|
+
if (rays.length === 0 || typeof rays[0]?.getBBox !== "function") return [];
|
|
27
|
+
return rays.map(ray => ray.animate(rayGlow, {
|
|
28
|
+
duration: sweepMs,
|
|
29
|
+
delay: sweepDelay(ray),
|
|
30
|
+
easing: "linear",
|
|
31
|
+
iterations: Number.POSITIVE_INFINITY
|
|
32
|
+
}));
|
|
24
33
|
}
|
|
25
34
|
export function LocusMark() {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
const ref = useRef(null);
|
|
36
|
+
useEffect(() => {
|
|
37
|
+
const svg = ref.current;
|
|
38
|
+
if (!svg || prefersReducedMotion()) return;
|
|
39
|
+
const animations = animateRays(svg);
|
|
40
|
+
return () => {
|
|
41
|
+
for (const animation of animations) animation.cancel();
|
|
42
|
+
};
|
|
43
|
+
}, []);
|
|
44
|
+
return /*#__PURE__*/_jsx(LocusGraphMark, {
|
|
45
|
+
ref: ref,
|
|
46
|
+
"data-slot": "pulse-locus",
|
|
47
|
+
className: "h-[1.35em] w-auto text-foreground"
|
|
48
|
+
});
|
|
38
49
|
}
|
|
@@ -1,11 +1,24 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
1
|
import { useLoopAnimation } from "../use-loop-animation.js";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
const breathe = [{
|
|
4
|
+
transform: "scale(1)",
|
|
5
|
+
opacity: 1
|
|
6
|
+
}, {
|
|
7
|
+
transform: "scale(0.62)",
|
|
8
|
+
opacity: 0.55
|
|
9
|
+
}, {
|
|
10
|
+
transform: "scale(1)",
|
|
11
|
+
opacity: 1
|
|
12
|
+
}];
|
|
8
13
|
export function OrbMark() {
|
|
9
|
-
|
|
10
|
-
|
|
14
|
+
const ref = useLoopAnimation(breathe, 1500);
|
|
15
|
+
return /*#__PURE__*/_jsx("span", {
|
|
16
|
+
"aria-hidden": true,
|
|
17
|
+
className: "inline-flex size-[1.25em] items-center justify-center",
|
|
18
|
+
children: /*#__PURE__*/_jsx("span", {
|
|
19
|
+
ref: ref,
|
|
20
|
+
"data-slot": "pulse-orb",
|
|
21
|
+
className: "size-[0.8em] rounded-full bg-foreground"
|
|
22
|
+
})
|
|
23
|
+
});
|
|
11
24
|
}
|
|
@@ -1,4 +1,23 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
export function SpinnerMark() {
|
|
3
|
-
|
|
3
|
+
return /*#__PURE__*/_jsxs("svg", {
|
|
4
|
+
"aria-hidden": true,
|
|
5
|
+
"data-slot": "pulse-spinner",
|
|
6
|
+
viewBox: "0 0 16 16",
|
|
7
|
+
className: "size-[1.1em] motion-safe:animate-spin",
|
|
8
|
+
fill: "none",
|
|
9
|
+
children: [/*#__PURE__*/_jsx("circle", {
|
|
10
|
+
cx: "8",
|
|
11
|
+
cy: "8",
|
|
12
|
+
r: "6.5",
|
|
13
|
+
stroke: "currentColor",
|
|
14
|
+
strokeOpacity: "0.18",
|
|
15
|
+
strokeWidth: "1.5"
|
|
16
|
+
}), /*#__PURE__*/_jsx("path", {
|
|
17
|
+
d: "M8 1.5a6.5 6.5 0 0 1 6.5 6.5",
|
|
18
|
+
stroke: "currentColor",
|
|
19
|
+
strokeWidth: "1.5",
|
|
20
|
+
strokeLinecap: "round"
|
|
21
|
+
})]
|
|
22
|
+
});
|
|
4
23
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
1
|
import { cn } from "@locusgraph/components";
|
|
3
2
|
import { GradientLabel } from "./gradient-label.js";
|
|
4
3
|
import { BarsMark } from "./marks/bars-mark.js";
|
|
@@ -6,46 +5,75 @@ import { GlyphMark } from "./marks/glyph-mark.js";
|
|
|
6
5
|
import { LocusMark } from "./marks/locus-mark.js";
|
|
7
6
|
import { OrbMark } from "./marks/orb-mark.js";
|
|
8
7
|
import { SpinnerMark } from "./marks/spinner-mark.js";
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
"shimmer",
|
|
12
|
-
"glyph",
|
|
13
|
-
"orb",
|
|
14
|
-
"gradient",
|
|
15
|
-
"bars",
|
|
16
|
-
"spinner",
|
|
17
|
-
"locus",
|
|
18
|
-
];
|
|
8
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
|
+
export const pulseVariants = ["dots", "shimmer", "glyph", "orb", "gradient", "bars", "spinner", "locus"];
|
|
19
10
|
const dotDelays = ["[animation-delay:0ms]", "[animation-delay:200ms]", "[animation-delay:400ms]"];
|
|
20
11
|
function TypingDots() {
|
|
21
|
-
|
|
12
|
+
return /*#__PURE__*/_jsx("span", {
|
|
13
|
+
"aria-hidden": true,
|
|
14
|
+
className: "flex h-5 items-center gap-1",
|
|
15
|
+
children: dotDelays.map(delay => /*#__PURE__*/_jsx("span", {
|
|
16
|
+
className: cn("size-1.5 rounded-full bg-muted-foreground/70 motion-safe:animate-pulse", delay)
|
|
17
|
+
}, delay))
|
|
18
|
+
});
|
|
22
19
|
}
|
|
23
20
|
const marks = {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
21
|
+
dots: TypingDots,
|
|
22
|
+
glyph: GlyphMark,
|
|
23
|
+
orb: OrbMark,
|
|
24
|
+
bars: BarsMark,
|
|
25
|
+
spinner: SpinnerMark,
|
|
26
|
+
locus: LocusMark
|
|
30
27
|
};
|
|
31
28
|
const labelShownByDefault = {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
29
|
+
dots: false,
|
|
30
|
+
shimmer: true,
|
|
31
|
+
glyph: true,
|
|
32
|
+
orb: false,
|
|
33
|
+
gradient: true,
|
|
34
|
+
bars: false,
|
|
35
|
+
spinner: true,
|
|
36
|
+
locus: true
|
|
40
37
|
};
|
|
41
|
-
function VisibleLabel({
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
38
|
+
function VisibleLabel({
|
|
39
|
+
variant,
|
|
40
|
+
label,
|
|
41
|
+
tone
|
|
42
|
+
}) {
|
|
43
|
+
if (variant === "gradient") return /*#__PURE__*/_jsx(GradientLabel, {
|
|
44
|
+
label: label,
|
|
45
|
+
tone: tone
|
|
46
|
+
});
|
|
47
|
+
const shimmers = variant === "shimmer" || variant === "glyph" || variant === "locus";
|
|
48
|
+
return /*#__PURE__*/_jsx("span", {
|
|
49
|
+
className: cn(shimmers && "motion-safe:shimmer"),
|
|
50
|
+
children: label
|
|
51
|
+
});
|
|
46
52
|
}
|
|
47
|
-
export function Pulse({
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
53
|
+
export function Pulse({
|
|
54
|
+
variant = "dots",
|
|
55
|
+
label = "Thinking…",
|
|
56
|
+
showLabel,
|
|
57
|
+
tone = "neutral",
|
|
58
|
+
className
|
|
59
|
+
}) {
|
|
60
|
+
const Mark = marks[variant];
|
|
61
|
+
const labelVisible = showLabel ?? labelShownByDefault[variant];
|
|
62
|
+
return /*#__PURE__*/_jsxs("span", {
|
|
63
|
+
"data-slot": "pulse",
|
|
64
|
+
"data-variant": variant,
|
|
65
|
+
role: "status",
|
|
66
|
+
"aria-live": "polite",
|
|
67
|
+
className: cn("inline-flex items-center gap-2 text-sm text-muted-foreground", className),
|
|
68
|
+
children: [Mark && /*#__PURE__*/_jsx(Mark, {
|
|
69
|
+
tone: tone
|
|
70
|
+
}), labelVisible ? /*#__PURE__*/_jsx(VisibleLabel, {
|
|
71
|
+
variant: variant,
|
|
72
|
+
label: label,
|
|
73
|
+
tone: tone
|
|
74
|
+
}) : /*#__PURE__*/_jsx("span", {
|
|
75
|
+
className: "sr-only",
|
|
76
|
+
children: label
|
|
77
|
+
})]
|
|
78
|
+
});
|
|
51
79
|
}
|
|
@@ -1,21 +1,19 @@
|
|
|
1
1
|
import { useEffect, useRef } from "react";
|
|
2
2
|
export function prefersReducedMotion() {
|
|
3
|
-
|
|
4
|
-
window.matchMedia?.("(prefers-reduced-motion: reduce)").matches === true);
|
|
3
|
+
return typeof window !== "undefined" && window.matchMedia?.("(prefers-reduced-motion: reduce)").matches === true;
|
|
5
4
|
}
|
|
6
5
|
export function useLoopAnimation(keyframes, duration, delay = 0, easing = "ease-in-out") {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
return ref;
|
|
6
|
+
const ref = useRef(null);
|
|
7
|
+
useEffect(() => {
|
|
8
|
+
const element = ref.current;
|
|
9
|
+
if (!element || typeof element.animate !== "function" || prefersReducedMotion()) return;
|
|
10
|
+
const animation = element.animate(keyframes, {
|
|
11
|
+
duration,
|
|
12
|
+
delay,
|
|
13
|
+
easing,
|
|
14
|
+
iterations: Number.POSITIVE_INFINITY
|
|
15
|
+
});
|
|
16
|
+
return () => animation.cancel();
|
|
17
|
+
}, [keyframes, duration, delay, easing]);
|
|
18
|
+
return ref;
|
|
21
19
|
}
|
|
@@ -1,31 +1,47 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Checkmark as CheckIcon, InProgress as LoaderCircleIcon, Subtract as MinusIcon, Close as XIcon, } from "@carbon/icons-react";
|
|
1
|
+
import { Checkmark as CheckIcon, InProgress as LoaderCircleIcon, Subtract as MinusIcon, Close as XIcon } from "@carbon/icons-react";
|
|
3
2
|
import { cn } from "@locusgraph/components";
|
|
3
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
4
|
export const stepStatusLabels = {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
pending: "Pending",
|
|
6
|
+
running: "Running",
|
|
7
|
+
done: "Done",
|
|
8
|
+
failed: "Failed",
|
|
9
|
+
skipped: "Skipped"
|
|
10
10
|
};
|
|
11
11
|
const stepIconFrames = {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
pending: "bg-card ring-1 ring-muted-foreground/40 ring-inset",
|
|
13
|
+
running: "bg-card text-warn",
|
|
14
|
+
done: "bg-good text-white dark:text-background",
|
|
15
|
+
failed: "bg-destructive text-white",
|
|
16
|
+
skipped: "bg-muted text-muted-foreground"
|
|
17
17
|
};
|
|
18
|
-
function StepGlyph({
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
18
|
+
function StepGlyph({
|
|
19
|
+
status
|
|
20
|
+
}) {
|
|
21
|
+
if (status === "running") return /*#__PURE__*/_jsx(LoaderCircleIcon, {
|
|
22
|
+
className: "size-4 motion-safe:animate-spin"
|
|
23
|
+
});
|
|
24
|
+
if (status === "done") return /*#__PURE__*/_jsx(CheckIcon, {
|
|
25
|
+
className: "size-2.5"
|
|
26
|
+
});
|
|
27
|
+
if (status === "failed") return /*#__PURE__*/_jsx(XIcon, {
|
|
28
|
+
className: "size-2.5"
|
|
29
|
+
});
|
|
30
|
+
if (status === "skipped") return /*#__PURE__*/_jsx(MinusIcon, {
|
|
31
|
+
className: "size-2.5"
|
|
32
|
+
});
|
|
33
|
+
return null;
|
|
28
34
|
}
|
|
29
|
-
export function StepIcon({
|
|
30
|
-
|
|
35
|
+
export function StepIcon({
|
|
36
|
+
status,
|
|
37
|
+
current = false
|
|
38
|
+
}) {
|
|
39
|
+
return /*#__PURE__*/_jsx("span", {
|
|
40
|
+
"aria-hidden": true,
|
|
41
|
+
"data-slot": "step-icon",
|
|
42
|
+
className: cn("relative z-10 mt-0.5 flex size-4 shrink-0 items-center justify-center rounded-full", stepIconFrames[status], current && status === "pending" && "ring-foreground/60"),
|
|
43
|
+
children: /*#__PURE__*/_jsx(StepGlyph, {
|
|
44
|
+
status: status
|
|
45
|
+
})
|
|
46
|
+
});
|
|
31
47
|
}
|
|
@@ -1,39 +1,86 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
1
|
import { ListChecked as ListChecksIcon } from "@carbon/icons-react";
|
|
3
2
|
import { cn } from "@locusgraph/components";
|
|
4
3
|
import { ApprovalPanel, PanelHeader } from "../../shared/panel.js";
|
|
5
4
|
import { StepIcon, stepStatusLabels } from "./step-icon.js";
|
|
5
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
6
6
|
const stepTitleTones = {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
pending: "text-muted-foreground",
|
|
8
|
+
running: "text-foreground font-medium",
|
|
9
|
+
done: "text-foreground",
|
|
10
|
+
failed: "text-foreground font-medium",
|
|
11
|
+
skipped: "text-muted-foreground line-through"
|
|
12
12
|
};
|
|
13
13
|
function currentStepId(steps) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
return undefined;
|
|
19
|
-
return steps.find((step) => step.status === "pending")?.id;
|
|
14
|
+
const running = steps.find(step => step.status === "running");
|
|
15
|
+
if (running) return running.id;
|
|
16
|
+
if (steps.some(step => step.status === "failed")) return undefined;
|
|
17
|
+
return steps.find(step => step.status === "pending")?.id;
|
|
20
18
|
}
|
|
21
19
|
function progressLabel(steps) {
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
const done = steps.filter(step => step.status === "done").length;
|
|
21
|
+
return `${done} of ${steps.length} done`;
|
|
24
22
|
}
|
|
25
23
|
function progressTone(steps) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
const settled = steps.every((step) => step.status === "done" || step.status === "skipped");
|
|
31
|
-
return steps.length > 0 && settled ? "done" : "idle";
|
|
24
|
+
if (steps.some(step => step.status === "failed")) return "danger";
|
|
25
|
+
if (steps.some(step => step.status === "running")) return "waiting";
|
|
26
|
+
const settled = steps.every(step => step.status === "done" || step.status === "skipped");
|
|
27
|
+
return steps.length > 0 && settled ? "done" : "idle";
|
|
32
28
|
}
|
|
33
|
-
function StepRow({
|
|
34
|
-
|
|
29
|
+
function StepRow({
|
|
30
|
+
step,
|
|
31
|
+
current,
|
|
32
|
+
last
|
|
33
|
+
}) {
|
|
34
|
+
return /*#__PURE__*/_jsxs("li", {
|
|
35
|
+
"data-slot": "step",
|
|
36
|
+
"data-status": step.status,
|
|
37
|
+
"aria-current": current ? "step" : undefined,
|
|
38
|
+
className: "relative flex gap-3 pb-4 last:pb-0",
|
|
39
|
+
children: [!last && /*#__PURE__*/_jsx("span", {
|
|
40
|
+
"aria-hidden": true,
|
|
41
|
+
className: "absolute top-5 bottom-0.5 left-[7.5px] w-px bg-border"
|
|
42
|
+
}), /*#__PURE__*/_jsx(StepIcon, {
|
|
43
|
+
status: step.status,
|
|
44
|
+
current: current
|
|
45
|
+
}), /*#__PURE__*/_jsxs("div", {
|
|
46
|
+
className: "flex min-w-0 flex-col gap-0.5",
|
|
47
|
+
children: [/*#__PURE__*/_jsxs("span", {
|
|
48
|
+
className: cn("text-sm leading-snug", stepTitleTones[step.status], current && step.status === "pending" && "text-foreground"),
|
|
49
|
+
children: [step.title, /*#__PURE__*/_jsxs("span", {
|
|
50
|
+
className: "sr-only",
|
|
51
|
+
children: [" (", stepStatusLabels[step.status], ")"]
|
|
52
|
+
})]
|
|
53
|
+
}), step.detail && /*#__PURE__*/_jsx("span", {
|
|
54
|
+
className: cn("font-mono text-xs text-muted-foreground", step.status === "failed" && "font-sans text-destructive"),
|
|
55
|
+
children: step.detail
|
|
56
|
+
})]
|
|
57
|
+
})]
|
|
58
|
+
});
|
|
35
59
|
}
|
|
36
|
-
export function Steps({
|
|
37
|
-
|
|
38
|
-
|
|
60
|
+
export function Steps({
|
|
61
|
+
steps,
|
|
62
|
+
title = "Plan",
|
|
63
|
+
className
|
|
64
|
+
}) {
|
|
65
|
+
const currentId = currentStepId(steps);
|
|
66
|
+
return /*#__PURE__*/_jsxs(ApprovalPanel, {
|
|
67
|
+
"data-slot": "steps",
|
|
68
|
+
"aria-label": title,
|
|
69
|
+
className: className,
|
|
70
|
+
children: [/*#__PURE__*/_jsx(PanelHeader, {
|
|
71
|
+
icon: /*#__PURE__*/_jsx(ListChecksIcon, {
|
|
72
|
+
"aria-hidden": true
|
|
73
|
+
}),
|
|
74
|
+
eyebrow: title,
|
|
75
|
+
status: progressLabel(steps),
|
|
76
|
+
tone: progressTone(steps)
|
|
77
|
+
}), /*#__PURE__*/_jsx("ol", {
|
|
78
|
+
className: "flex flex-col px-5 pt-4 pb-5",
|
|
79
|
+
children: steps.map((step, position) => /*#__PURE__*/_jsx(StepRow, {
|
|
80
|
+
step: step,
|
|
81
|
+
current: step.id === currentId,
|
|
82
|
+
last: position === steps.length - 1
|
|
83
|
+
}, step.id))
|
|
84
|
+
})]
|
|
85
|
+
});
|
|
39
86
|
}
|