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