@locusgraph/loop 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (115) hide show
  1. package/README.md +2 -0
  2. package/dist/agent/pulse/gradient-label.js +86 -15
  3. package/dist/agent/pulse/marks/bars-mark.js +46 -10
  4. package/dist/agent/pulse/marks/glyph-mark.js +56 -11
  5. package/dist/agent/pulse/marks/locus-mark.js +63 -28
  6. package/dist/agent/pulse/marks/orb-mark.js +31 -8
  7. package/dist/agent/pulse/marks/spinner-mark.js +29 -1
  8. package/dist/agent/pulse/pulse.js +150 -35
  9. package/dist/agent/pulse/use-loop-animation.js +36 -17
  10. package/dist/agent/steps/step-icon.js +110 -24
  11. package/dist/agent/steps/steps.js +235 -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 +38 -11
  15. package/dist/agent/tool/tool-status.js +51 -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 +321 -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 +250 -18
  22. package/dist/approval/inbox/virtual-inbox-list.d.ts +13 -0
  23. package/dist/approval/inbox/virtual-inbox-list.js +129 -0
  24. package/dist/approval/memory/memory-choices.js +27 -22
  25. package/dist/approval/memory/memory-review.js +242 -17
  26. package/dist/approval/memory/memory-row.js +215 -19
  27. package/dist/approval/plan/plan-review.js +279 -28
  28. package/dist/approval/plan/plan-step-row.js +194 -43
  29. package/dist/approval/plan/plan-steps.js +24 -23
  30. package/dist/approval/plan/question-choices.js +158 -39
  31. package/dist/approval/plan/question.d.ts +1 -1
  32. package/dist/approval/plan/question.js +223 -26
  33. package/dist/approval/run/run-bar.js +178 -22
  34. package/dist/approval/shared/decision-line.js +1 -1
  35. package/dist/approval/shared/risk-badge.js +47 -16
  36. package/dist/approval/shared/time.js +5 -8
  37. package/dist/approval/shared/use-focus-on-mount.js +23 -6
  38. package/dist/approval/spend/raise-cap-form.js +235 -17
  39. package/dist/approval/spend/spend-gate.js +239 -21
  40. package/dist/approval/spend/spend-math.js +7 -8
  41. package/dist/approval/spend/spend-meter.js +362 -34
  42. package/dist/approval/tool/approval.js +272 -27
  43. package/dist/approval/tool/args/args-editor.js +262 -26
  44. package/dist/approval/tool/args/args-field.js +259 -19
  45. package/dist/approval/tool/args/args-validation.js +38 -47
  46. package/dist/approval/tool/deny-form.js +130 -10
  47. package/dist/approval/tool/tool-inputs.js +127 -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 +123 -47
  53. package/dist/chat/chat/virtual-chat-items.d.ts +8 -0
  54. package/dist/chat/chat/virtual-chat-items.js +153 -0
  55. package/dist/chat/composer/composer-actions.js +151 -16
  56. package/dist/chat/composer/composer.js +330 -32
  57. package/dist/chat/composer/use-auto-grow.js +24 -9
  58. package/dist/chat/files/file-meta.js +19 -19
  59. package/dist/chat/files/files.js +316 -28
  60. package/dist/chat/reply/fenced-code.js +45 -21
  61. package/dist/chat/reply/markdown-components.js +137 -17
  62. package/dist/chat/reply/reply.js +105 -10
  63. package/dist/chat/turn/group-parts.js +43 -29
  64. package/dist/chat/turn/turn.js +238 -30
  65. package/dist/cost/context.js +321 -23
  66. package/dist/cost/cost-steps.js +220 -14
  67. package/dist/cost/cost.js +521 -27
  68. package/dist/cost/model-picker.js +181 -6
  69. package/dist/cost/shared/context-breakdown.js +299 -10
  70. package/dist/cost/shared/meter-marks.js +107 -9
  71. package/dist/cost/shared/model-option-row.js +178 -21
  72. package/dist/cost/shared/step-cost-row.js +248 -20
  73. package/dist/cost/shared/usage-totals.js +22 -18
  74. package/dist/memory/cite.js +182 -11
  75. package/dist/memory/memorized.js +217 -11
  76. package/dist/memory/recall.js +296 -17
  77. package/dist/memory/shared/host-label.js +19 -22
  78. package/dist/memory/shared/source-mark.js +39 -3
  79. package/dist/memory/sources.js +255 -13
  80. package/dist/shared/decision-summary.js +133 -14
  81. package/dist/shared/panel-empty.js +78 -3
  82. package/dist/shared/panel.js +243 -13
  83. package/dist/shared/status-dot.js +38 -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 +65 -3
  87. package/dist/thread/actions/actions.js +184 -13
  88. package/dist/thread/actions/branch-switcher.js +102 -5
  89. package/dist/thread/canvas/canvas.js +205 -5
  90. package/dist/thread/canvas/version-switcher.js +149 -8
  91. package/dist/thread/code/code.js +186 -24
  92. package/dist/thread/code/copy-code-button.js +61 -13
  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 +137 -0
  100. package/dist/thread/history/row/thread-item-menu.js +84 -0
  101. package/dist/thread/history/row/thread-title-editor.js +81 -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 +107 -0
  106. package/dist/thread/index.d.ts +1 -1
  107. package/dist/thread/starters/starters.js +92 -7
  108. package/dist/thread/use-copied.js +45 -15
  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,94 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { c as _c } from "react/compiler-runtime";
2
2
  import { AiGenerate as SparkleIcon } from "@carbon/icons-react";
3
3
  import { cn } from "@locusgraph/components";
4
4
  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
- ];
5
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
6
+ const drift = [{
7
+ backgroundPosition: "0% 50%"
8
+ }, {
9
+ backgroundPosition: "200% 50%"
10
+ }];
11
+ const turn = [{
12
+ transform: "rotate(0deg) scale(1)"
13
+ }, {
14
+ transform: "rotate(180deg) scale(0.8)"
15
+ }, {
16
+ transform: "rotate(360deg) scale(1)"
17
+ }];
11
18
  const toneIcon = {
12
- neutral: "fill-foreground/70 text-foreground/70",
13
- brand: "fill-violet-500 text-violet-500",
19
+ neutral: "fill-foreground/70 text-foreground/70",
20
+ brand: "fill-violet-500 text-violet-500"
14
21
  };
15
22
  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))]",
23
+ neutral: "bg-[linear-gradient(90deg,var(--color-muted-foreground),var(--color-foreground),var(--color-muted-foreground))]",
24
+ brand: "bg-[linear-gradient(90deg,var(--color-sky-500),var(--color-violet-500),var(--color-pink-500),var(--color-sky-500))]"
18
25
  };
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 })] }));
26
+ export function GradientLabel(t0) {
27
+ const $ = _c(14);
28
+ const {
29
+ label,
30
+ tone: t1
31
+ } = t0;
32
+ const tone = t1 === undefined ? "neutral" : t1;
33
+ const text = useLoopAnimation(drift, 2600, 0, "linear");
34
+ const icon = useLoopAnimation(turn, 2600);
35
+ const t2 = toneIcon[tone];
36
+ let t3;
37
+ if ($[0] !== t2) {
38
+ t3 = cn("size-[1.05em]", t2);
39
+ $[0] = t2;
40
+ $[1] = t3;
41
+ } else {
42
+ t3 = $[1];
43
+ }
44
+ let t4;
45
+ if ($[2] !== icon || $[3] !== t3) {
46
+ t4 = /*#__PURE__*/_jsx(SparkleIcon, {
47
+ ref: icon,
48
+ "aria-hidden": true,
49
+ className: t3
50
+ });
51
+ $[2] = icon;
52
+ $[3] = t3;
53
+ $[4] = t4;
54
+ } else {
55
+ t4 = $[4];
56
+ }
57
+ const t5 = toneText[tone];
58
+ let t6;
59
+ if ($[5] !== t5) {
60
+ t6 = cn("bg-[length:200%_100%] bg-clip-text font-medium text-transparent", t5);
61
+ $[5] = t5;
62
+ $[6] = t6;
63
+ } else {
64
+ t6 = $[6];
65
+ }
66
+ let t7;
67
+ if ($[7] !== label || $[8] !== t6 || $[9] !== text) {
68
+ t7 = /*#__PURE__*/_jsx("span", {
69
+ ref: text,
70
+ "data-slot": "pulse-gradient",
71
+ className: t6,
72
+ children: label
73
+ });
74
+ $[7] = label;
75
+ $[8] = t6;
76
+ $[9] = text;
77
+ $[10] = t7;
78
+ } else {
79
+ t7 = $[10];
80
+ }
81
+ let t8;
82
+ if ($[11] !== t4 || $[12] !== t7) {
83
+ t8 = /*#__PURE__*/_jsxs("span", {
84
+ className: "inline-flex items-center gap-1.5",
85
+ children: [t4, t7]
86
+ });
87
+ $[11] = t4;
88
+ $[12] = t7;
89
+ $[13] = t8;
90
+ } else {
91
+ t8 = $[13];
92
+ }
93
+ return t8;
23
94
  }
@@ -1,15 +1,51 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { c as _c } from "react/compiler-runtime";
2
2
  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
- ];
3
+ import { jsx as _jsx } from "react/jsx-runtime";
4
+ const bounce = [{
5
+ transform: "scaleY(0.35)"
6
+ }, {
7
+ transform: "scaleY(1)"
8
+ }, {
9
+ transform: "scaleY(0.35)"
10
+ }];
8
11
  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" }));
12
+ function Bar(t0) {
13
+ const $ = _c(2);
14
+ const {
15
+ delay
16
+ } = t0;
17
+ const ref = useLoopAnimation(bounce, 900, delay);
18
+ let t1;
19
+ if ($[0] !== ref) {
20
+ t1 = /*#__PURE__*/_jsx("span", {
21
+ ref: ref,
22
+ className: "h-full w-[0.16em] origin-center scale-y-[0.35] rounded-full bg-current"
23
+ });
24
+ $[0] = ref;
25
+ $[1] = t1;
26
+ } else {
27
+ t1 = $[1];
28
+ }
29
+ return t1;
12
30
  }
13
31
  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))) }));
32
+ const $ = _c(1);
33
+ let t0;
34
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
35
+ t0 = /*#__PURE__*/_jsx("span", {
36
+ "aria-hidden": true,
37
+ "data-slot": "pulse-bars",
38
+ className: "inline-flex h-[1em] items-center gap-[0.14em] text-foreground/70",
39
+ children: barDelays.map(_temp)
40
+ });
41
+ $[0] = t0;
42
+ } else {
43
+ t0 = $[0];
44
+ }
45
+ return t0;
46
+ }
47
+ function _temp(delay) {
48
+ return /*#__PURE__*/_jsx(Bar, {
49
+ delay: delay
50
+ }, delay);
15
51
  }
@@ -1,17 +1,62 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { c as _c } from "react/compiler-runtime";
2
2
  import { cn } from "@locusgraph/components";
3
3
  import { useEffect, useState } from "react";
4
4
  import { prefersReducedMotion } from "../use-loop-animation.js";
5
+ import { jsx as _jsx } from "react/jsx-runtime";
5
6
  const glyphs = ["·", "✢", "✳", "✶", "✻", "✽", "✻", "✶", "✳", "✢"];
6
7
  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] }));
8
+ export function GlyphMark(t0) {
9
+ const $ = _c(7);
10
+ const {
11
+ tone: t1
12
+ } = t0;
13
+ const tone = t1 === undefined ? "neutral" : t1;
14
+ const [index, setIndex] = useState();
15
+ let t2;
16
+ let t3;
17
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
18
+ t2 = () => {
19
+ if (prefersReducedMotion()) {
20
+ return;
21
+ }
22
+ setIndex(0);
23
+ const timer = window.setInterval(() => setIndex(_temp), 120);
24
+ return () => window.clearInterval(timer);
25
+ };
26
+ t3 = [];
27
+ $[0] = t2;
28
+ $[1] = t3;
29
+ } else {
30
+ t2 = $[0];
31
+ t3 = $[1];
32
+ }
33
+ useEffect(t2, t3);
34
+ const t4 = tone === "brand" ? "text-orange-500" : "text-foreground/70";
35
+ let t5;
36
+ if ($[2] !== t4) {
37
+ t5 = cn("inline-flex w-[1.1em] justify-center font-mono text-[1.15em] leading-none", t4);
38
+ $[2] = t4;
39
+ $[3] = t5;
40
+ } else {
41
+ t5 = $[3];
42
+ }
43
+ const t6 = index === undefined ? restingGlyph : glyphs[index];
44
+ let t7;
45
+ if ($[4] !== t5 || $[5] !== t6) {
46
+ t7 = /*#__PURE__*/_jsx("span", {
47
+ "aria-hidden": true,
48
+ "data-slot": "pulse-glyph",
49
+ className: t5,
50
+ children: t6
51
+ });
52
+ $[4] = t5;
53
+ $[5] = t6;
54
+ $[6] = t7;
55
+ } else {
56
+ t7 = $[6];
57
+ }
58
+ return t7;
59
+ }
60
+ function _temp(current) {
61
+ return ((current ?? 0) + 1) % glyphs.length;
17
62
  }
@@ -1,38 +1,73 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { c as _c } from "react/compiler-runtime";
2
2
  import { LocusGraphMark } from "@locusgraph/brand";
3
3
  import { useEffect, useRef } from "react";
4
4
  import { prefersReducedMotion } from "../use-loop-animation.js";
5
+ import { jsx as _jsx } from "react/jsx-runtime";
5
6
  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 }];
7
+ const markCenter = {
8
+ x: 14.5,
9
+ y: 13
10
+ };
11
+ const rayGlow = [{
12
+ opacity: 0.3
13
+ }, {
14
+ opacity: 1,
15
+ offset: 0.12
16
+ }, {
17
+ opacity: 0.3
18
+ }];
8
19
  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;
20
+ const box = path.getBBox();
21
+ const angle = Math.atan2(box.y + box.height / 2 - markCenter.y, box.x + box.width / 2 - markCenter.x);
22
+ const turn = (angle + Math.PI) / (2 * Math.PI);
23
+ return -(1 - turn) * sweepMs;
13
24
  }
14
25
  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
- }));
26
+ const rays = [...svg.querySelectorAll("path")];
27
+ if (rays.length === 0 || typeof rays[0]?.getBBox !== "function") return [];
28
+ return rays.map(ray => ray.animate(rayGlow, {
29
+ duration: sweepMs,
30
+ delay: sweepDelay(ray),
31
+ easing: "linear",
32
+ iterations: Number.POSITIVE_INFINITY
33
+ }));
24
34
  }
25
35
  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" }));
36
+ const $ = _c(3);
37
+ const ref = useRef(null);
38
+ let t0;
39
+ let t1;
40
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
41
+ t0 = () => {
42
+ const svg = ref.current;
43
+ if (!svg || prefersReducedMotion()) {
44
+ return;
45
+ }
46
+ const animations = animateRays(svg);
47
+ return () => {
48
+ for (const animation of animations) {
49
+ animation.cancel();
50
+ }
51
+ };
52
+ };
53
+ t1 = [];
54
+ $[0] = t0;
55
+ $[1] = t1;
56
+ } else {
57
+ t0 = $[0];
58
+ t1 = $[1];
59
+ }
60
+ useEffect(t0, t1);
61
+ let t2;
62
+ if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
63
+ t2 = /*#__PURE__*/_jsx(LocusGraphMark, {
64
+ ref: ref,
65
+ "data-slot": "pulse-locus",
66
+ className: "h-[1.35em] w-auto text-foreground"
67
+ });
68
+ $[2] = t2;
69
+ } else {
70
+ t2 = $[2];
71
+ }
72
+ return t2;
38
73
  }
@@ -1,11 +1,34 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { c as _c } from "react/compiler-runtime";
2
2
  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
- ];
3
+ import { jsx as _jsx } from "react/jsx-runtime";
4
+ const breathe = [{
5
+ transform: "scale(1)",
6
+ opacity: 1
7
+ }, {
8
+ transform: "scale(0.62)",
9
+ opacity: 0.55
10
+ }, {
11
+ transform: "scale(1)",
12
+ opacity: 1
13
+ }];
8
14
  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" }) }));
15
+ const $ = _c(2);
16
+ const ref = useLoopAnimation(breathe, 1500);
17
+ let t0;
18
+ if ($[0] !== ref) {
19
+ t0 = /*#__PURE__*/_jsx("span", {
20
+ "aria-hidden": true,
21
+ className: "inline-flex size-[1.25em] items-center justify-center",
22
+ children: /*#__PURE__*/_jsx("span", {
23
+ ref: ref,
24
+ "data-slot": "pulse-orb",
25
+ className: "size-[0.8em] rounded-full bg-foreground"
26
+ })
27
+ });
28
+ $[0] = ref;
29
+ $[1] = t0;
30
+ } else {
31
+ t0 = $[1];
32
+ }
33
+ return t0;
11
34
  }
@@ -1,4 +1,32 @@
1
+ import { c as _c } from "react/compiler-runtime";
1
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
3
  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" })] }));
4
+ const $ = _c(1);
5
+ let t0;
6
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
7
+ t0 = /*#__PURE__*/_jsxs("svg", {
8
+ "aria-hidden": true,
9
+ "data-slot": "pulse-spinner",
10
+ viewBox: "0 0 16 16",
11
+ className: "size-[1.1em] motion-safe:animate-spin",
12
+ fill: "none",
13
+ children: [/*#__PURE__*/_jsx("circle", {
14
+ cx: "8",
15
+ cy: "8",
16
+ r: "6.5",
17
+ stroke: "currentColor",
18
+ strokeOpacity: "0.18",
19
+ strokeWidth: "1.5"
20
+ }), /*#__PURE__*/_jsx("path", {
21
+ d: "M8 1.5a6.5 6.5 0 0 1 6.5 6.5",
22
+ stroke: "currentColor",
23
+ strokeWidth: "1.5",
24
+ strokeLinecap: "round"
25
+ })]
26
+ });
27
+ $[0] = t0;
28
+ } else {
29
+ t0 = $[0];
30
+ }
31
+ return t0;
4
32
  }
@@ -1,4 +1,4 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { c as _c } from "react/compiler-runtime";
2
2
  import { cn } from "@locusgraph/components";
3
3
  import { GradientLabel } from "./gradient-label.js";
4
4
  import { BarsMark } from "./marks/bars-mark.js";
@@ -6,46 +6,161 @@ import { GlyphMark } from "./marks/glyph-mark.js";
6
6
  import { LocusMark } from "./marks/locus-mark.js";
7
7
  import { OrbMark } from "./marks/orb-mark.js";
8
8
  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
- ];
9
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
10
+ export const pulseVariants = ["dots", "shimmer", "glyph", "orb", "gradient", "bars", "spinner", "locus"];
19
11
  const dotDelays = ["[animation-delay:0ms]", "[animation-delay:200ms]", "[animation-delay:400ms]"];
20
12
  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))) }));
13
+ const $ = _c(1);
14
+ let t0;
15
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
16
+ t0 = /*#__PURE__*/_jsx("span", {
17
+ "aria-hidden": true,
18
+ className: "flex h-5 items-center gap-1",
19
+ children: dotDelays.map(_temp)
20
+ });
21
+ $[0] = t0;
22
+ } else {
23
+ t0 = $[0];
24
+ }
25
+ return t0;
26
+ }
27
+ function _temp(delay) {
28
+ return /*#__PURE__*/_jsx("span", {
29
+ className: cn("size-1.5 rounded-full bg-muted-foreground/70 motion-safe:animate-pulse", delay)
30
+ }, delay);
22
31
  }
23
32
  const marks = {
24
- dots: TypingDots,
25
- glyph: GlyphMark,
26
- orb: OrbMark,
27
- bars: BarsMark,
28
- spinner: SpinnerMark,
29
- locus: LocusMark,
33
+ dots: TypingDots,
34
+ glyph: GlyphMark,
35
+ orb: OrbMark,
36
+ bars: BarsMark,
37
+ spinner: SpinnerMark,
38
+ locus: LocusMark
30
39
  };
31
40
  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,
41
+ dots: false,
42
+ shimmer: true,
43
+ glyph: true,
44
+ orb: false,
45
+ gradient: true,
46
+ bars: false,
47
+ spinner: true,
48
+ locus: true
40
49
  };
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 });
50
+ function VisibleLabel(t0) {
51
+ const $ = _c(8);
52
+ const {
53
+ variant,
54
+ label,
55
+ tone
56
+ } = t0;
57
+ if (variant === "gradient") {
58
+ let t1;
59
+ if ($[0] !== label || $[1] !== tone) {
60
+ t1 = /*#__PURE__*/_jsx(GradientLabel, {
61
+ label: label,
62
+ tone: tone
63
+ });
64
+ $[0] = label;
65
+ $[1] = tone;
66
+ $[2] = t1;
67
+ } else {
68
+ t1 = $[2];
69
+ }
70
+ return t1;
71
+ }
72
+ const shimmers = variant === "shimmer" || variant === "glyph" || variant === "locus";
73
+ const t1 = shimmers && "motion-safe:shimmer";
74
+ let t2;
75
+ if ($[3] !== t1) {
76
+ t2 = cn(t1);
77
+ $[3] = t1;
78
+ $[4] = t2;
79
+ } else {
80
+ t2 = $[4];
81
+ }
82
+ let t3;
83
+ if ($[5] !== label || $[6] !== t2) {
84
+ t3 = /*#__PURE__*/_jsx("span", {
85
+ className: t2,
86
+ children: label
87
+ });
88
+ $[5] = label;
89
+ $[6] = t2;
90
+ $[7] = t3;
91
+ } else {
92
+ t3 = $[7];
93
+ }
94
+ return t3;
46
95
  }
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 }))] }));
96
+ export function Pulse(t0) {
97
+ const $ = _c(15);
98
+ const {
99
+ variant: t1,
100
+ label: t2,
101
+ showLabel,
102
+ tone: t3,
103
+ className
104
+ } = t0;
105
+ const variant = t1 === undefined ? "dots" : t1;
106
+ const label = t2 === undefined ? "Thinking\u2026" : t2;
107
+ const tone = t3 === undefined ? "neutral" : t3;
108
+ const Mark = marks[variant];
109
+ const labelVisible = showLabel ?? labelShownByDefault[variant];
110
+ let t4;
111
+ if ($[0] !== className) {
112
+ t4 = cn("inline-flex items-center gap-2 text-sm text-muted-foreground", className);
113
+ $[0] = className;
114
+ $[1] = t4;
115
+ } else {
116
+ t4 = $[1];
117
+ }
118
+ let t5;
119
+ if ($[2] !== Mark || $[3] !== tone) {
120
+ t5 = Mark && /*#__PURE__*/_jsx(Mark, {
121
+ tone: tone
122
+ });
123
+ $[2] = Mark;
124
+ $[3] = tone;
125
+ $[4] = t5;
126
+ } else {
127
+ t5 = $[4];
128
+ }
129
+ let t6;
130
+ if ($[5] !== label || $[6] !== labelVisible || $[7] !== tone || $[8] !== variant) {
131
+ t6 = labelVisible ? /*#__PURE__*/_jsx(VisibleLabel, {
132
+ variant: variant,
133
+ label: label,
134
+ tone: tone
135
+ }) : /*#__PURE__*/_jsx("span", {
136
+ className: "sr-only",
137
+ children: label
138
+ });
139
+ $[5] = label;
140
+ $[6] = labelVisible;
141
+ $[7] = tone;
142
+ $[8] = variant;
143
+ $[9] = t6;
144
+ } else {
145
+ t6 = $[9];
146
+ }
147
+ let t7;
148
+ if ($[10] !== t4 || $[11] !== t5 || $[12] !== t6 || $[13] !== variant) {
149
+ t7 = /*#__PURE__*/_jsxs("span", {
150
+ "data-slot": "pulse",
151
+ "data-variant": variant,
152
+ role: "status",
153
+ "aria-live": "polite",
154
+ className: t4,
155
+ children: [t5, t6]
156
+ });
157
+ $[10] = t4;
158
+ $[11] = t5;
159
+ $[12] = t6;
160
+ $[13] = variant;
161
+ $[14] = t7;
162
+ } else {
163
+ t7 = $[14];
164
+ }
165
+ return t7;
51
166
  }