@locusgraph/loop 0.2.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/dist/agent/pulse/gradient-label.js +12 -62
- package/dist/agent/pulse/marks/bars-mark.js +15 -37
- package/dist/agent/pulse/marks/glyph-mark.js +15 -54
- package/dist/agent/pulse/marks/locus-mark.js +12 -36
- package/dist/agent/pulse/marks/orb-mark.js +9 -19
- package/dist/agent/pulse/marks/spinner-mark.js +20 -29
- package/dist/agent/pulse/pulse.js +36 -123
- package/dist/agent/pulse/use-loop-animation.js +12 -33
- package/dist/agent/steps/step-icon.js +26 -96
- package/dist/agent/steps/steps.js +47 -210
- package/dist/agent/tool/json-block.js +11 -31
- package/dist/agent/tool/tool-status.js +12 -35
- package/dist/approval/inbox/inbox-row.js +76 -301
- package/dist/approval/inbox/inbox.js +39 -190
- package/dist/approval/inbox/virtual-inbox-list.js +26 -102
- package/dist/approval/memory/memory-review.js +36 -170
- package/dist/approval/memory/memory-row.js +50 -185
- package/dist/approval/plan/plan-review.js +73 -223
- package/dist/approval/plan/plan-step-row.js +76 -180
- package/dist/approval/plan/question-choices.js +44 -130
- package/dist/approval/plan/question.js +38 -154
- package/dist/approval/run/run-bar.js +39 -123
- package/dist/approval/shared/risk-badge.js +9 -24
- package/dist/approval/shared/use-focus-on-mount.js +5 -21
- package/dist/approval/spend/raise-cap-form.js +48 -221
- package/dist/approval/spend/spend-gate.js +40 -155
- package/dist/approval/spend/spend-meter.js +85 -312
- package/dist/approval/tool/approval.js +35 -194
- package/dist/approval/tool/args/args-editor.js +46 -204
- package/dist/approval/tool/args/args-field.js +55 -238
- package/dist/approval/tool/deny-form.js +36 -123
- package/dist/approval/tool/tool-inputs.js +23 -88
- package/dist/chat/chat/use-stick-to-bottom.js +60 -113
- package/dist/chat/chat/virtual-chat-items.js +34 -127
- package/dist/chat/composer/composer-actions.js +46 -129
- package/dist/chat/composer/use-auto-grow.js +8 -23
- package/dist/chat/files/files.js +66 -291
- package/dist/chat/reply/fenced-code.js +10 -32
- package/dist/chat/reply/reply.js +24 -99
- package/dist/chat/turn/turn.js +46 -197
- package/dist/cost/context.js +65 -282
- package/dist/cost/cost-steps.js +42 -195
- package/dist/cost/cost.js +108 -497
- package/dist/cost/model-picker.js +42 -172
- package/dist/cost/shared/context-breakdown.js +64 -280
- package/dist/cost/shared/meter-marks.js +34 -92
- package/dist/cost/shared/model-option-row.js +35 -158
- package/dist/cost/shared/step-cost-row.js +37 -222
- package/dist/memory/cite.js +58 -179
- package/dist/memory/memorized.js +42 -194
- package/dist/memory/recall.js +68 -263
- package/dist/memory/shared/source-mark.js +10 -38
- package/dist/memory/sources.js +52 -230
- package/dist/shared/decision-summary.js +35 -117
- package/dist/shared/panel-empty.js +15 -73
- package/dist/shared/panel.js +65 -239
- package/dist/shared/status-dot.js +10 -32
- package/dist/thread/actions/action-button.js +10 -53
- package/dist/thread/actions/branch-switcher.js +21 -95
- package/dist/thread/canvas/version-switcher.js +31 -126
- package/dist/thread/code/copy-code-button.js +24 -56
- package/dist/thread/history/row/history-row.js +18 -97
- package/dist/thread/history/row/thread-item-menu.js +19 -72
- package/dist/thread/history/row/thread-title-editor.js +29 -72
- package/dist/thread/history/virtual-history-list.js +46 -82
- package/dist/thread/starters/starters.js +27 -87
- package/dist/thread/use-copied.js +10 -38
- package/package.json +3 -3
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { c as _c } from "react/compiler-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";
|
|
@@ -23,72 +22,23 @@ const toneText = {
|
|
|
23
22
|
neutral: "bg-[linear-gradient(90deg,var(--color-muted-foreground),var(--color-foreground),var(--color-muted-foreground))]",
|
|
24
23
|
brand: "bg-[linear-gradient(90deg,var(--color-sky-500),var(--color-violet-500),var(--color-pink-500),var(--color-sky-500))]"
|
|
25
24
|
};
|
|
26
|
-
export function GradientLabel(
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
tone: t1
|
|
31
|
-
} = t0;
|
|
32
|
-
const tone = t1 === undefined ? "neutral" : t1;
|
|
25
|
+
export function GradientLabel({
|
|
26
|
+
label,
|
|
27
|
+
tone = "neutral"
|
|
28
|
+
}) {
|
|
33
29
|
const text = useLoopAnimation(drift, 2600, 0, "linear");
|
|
34
30
|
const icon = useLoopAnimation(turn, 2600);
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
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, {
|
|
31
|
+
return /*#__PURE__*/_jsxs("span", {
|
|
32
|
+
className: "inline-flex items-center gap-1.5",
|
|
33
|
+
children: [/*#__PURE__*/_jsx(SparkleIcon, {
|
|
47
34
|
ref: icon,
|
|
48
35
|
"aria-hidden": true,
|
|
49
|
-
className:
|
|
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", {
|
|
36
|
+
className: cn("size-[1.05em]", toneIcon[tone])
|
|
37
|
+
}), /*#__PURE__*/_jsx("span", {
|
|
69
38
|
ref: text,
|
|
70
39
|
"data-slot": "pulse-gradient",
|
|
71
|
-
className:
|
|
40
|
+
className: cn("bg-[length:200%_100%] bg-clip-text font-medium text-transparent", toneText[tone]),
|
|
72
41
|
children: label
|
|
73
|
-
})
|
|
74
|
-
|
|
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;
|
|
42
|
+
})]
|
|
43
|
+
});
|
|
94
44
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { c as _c } from "react/compiler-runtime";
|
|
2
1
|
import { useLoopAnimation } from "../use-loop-animation.js";
|
|
3
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
3
|
const bounce = [{
|
|
@@ -9,43 +8,22 @@ const bounce = [{
|
|
|
9
8
|
transform: "scaleY(0.35)"
|
|
10
9
|
}];
|
|
11
10
|
const barDelays = [0, 140, 280, 420];
|
|
12
|
-
function Bar(
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
delay
|
|
16
|
-
} = t0;
|
|
11
|
+
function Bar({
|
|
12
|
+
delay
|
|
13
|
+
}) {
|
|
17
14
|
const ref = useLoopAnimation(bounce, 900, delay);
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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;
|
|
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
|
+
});
|
|
30
19
|
}
|
|
31
20
|
export function BarsMark() {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
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);
|
|
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
|
+
});
|
|
51
29
|
}
|
|
@@ -1,62 +1,23 @@
|
|
|
1
|
-
import { c as _c } from "react/compiler-runtime";
|
|
2
1
|
import { cn } from "@locusgraph/components";
|
|
3
2
|
import { useEffect, useState } from "react";
|
|
4
3
|
import { prefersReducedMotion } from "../use-loop-animation.js";
|
|
5
4
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
5
|
const glyphs = ["·", "✢", "✳", "✶", "✻", "✽", "✻", "✶", "✳", "✢"];
|
|
7
6
|
const restingGlyph = "✻";
|
|
8
|
-
export function GlyphMark(
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
tone: t1
|
|
12
|
-
} = t0;
|
|
13
|
-
const tone = t1 === undefined ? "neutral" : t1;
|
|
7
|
+
export function GlyphMark({
|
|
8
|
+
tone = "neutral"
|
|
9
|
+
}) {
|
|
14
10
|
const [index, setIndex] = useState();
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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;
|
|
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
|
+
});
|
|
62
23
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { c as _c } from "react/compiler-runtime";
|
|
2
1
|
import { LocusGraphMark } from "@locusgraph/brand";
|
|
3
2
|
import { useEffect, useRef } from "react";
|
|
4
3
|
import { prefersReducedMotion } from "../use-loop-animation.js";
|
|
@@ -33,41 +32,18 @@ function animateRays(svg) {
|
|
|
33
32
|
}));
|
|
34
33
|
}
|
|
35
34
|
export function LocusMark() {
|
|
36
|
-
const $ = _c(3);
|
|
37
35
|
const ref = useRef(null);
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
const animations = animateRays(svg);
|
|
47
|
-
return () => {
|
|
48
|
-
for (const animation of animations) {
|
|
49
|
-
animation.cancel();
|
|
50
|
-
}
|
|
51
|
-
};
|
|
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();
|
|
52
42
|
};
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
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;
|
|
43
|
+
}, []);
|
|
44
|
+
return /*#__PURE__*/_jsx(LocusGraphMark, {
|
|
45
|
+
ref: ref,
|
|
46
|
+
"data-slot": "pulse-locus",
|
|
47
|
+
className: "h-[1.35em] w-auto text-foreground"
|
|
48
|
+
});
|
|
73
49
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { c as _c } from "react/compiler-runtime";
|
|
2
1
|
import { useLoopAnimation } from "../use-loop-animation.js";
|
|
3
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
3
|
const breathe = [{
|
|
@@ -12,23 +11,14 @@ const breathe = [{
|
|
|
12
11
|
opacity: 1
|
|
13
12
|
}];
|
|
14
13
|
export function OrbMark() {
|
|
15
|
-
const $ = _c(2);
|
|
16
14
|
const ref = useLoopAnimation(breathe, 1500);
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
})
|
|
27
|
-
});
|
|
28
|
-
$[0] = ref;
|
|
29
|
-
$[1] = t0;
|
|
30
|
-
} else {
|
|
31
|
-
t0 = $[1];
|
|
32
|
-
}
|
|
33
|
-
return t0;
|
|
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
|
+
});
|
|
34
24
|
}
|
|
@@ -1,32 +1,23 @@
|
|
|
1
|
-
import { c as _c } from "react/compiler-runtime";
|
|
2
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
2
|
export function SpinnerMark() {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
strokeLinecap: "round"
|
|
25
|
-
})]
|
|
26
|
-
});
|
|
27
|
-
$[0] = t0;
|
|
28
|
-
} else {
|
|
29
|
-
t0 = $[0];
|
|
30
|
-
}
|
|
31
|
-
return t0;
|
|
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
|
+
});
|
|
32
23
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { c as _c } from "react/compiler-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";
|
|
@@ -10,24 +9,13 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
10
9
|
export const pulseVariants = ["dots", "shimmer", "glyph", "orb", "gradient", "bars", "spinner", "locus"];
|
|
11
10
|
const dotDelays = ["[animation-delay:0ms]", "[animation-delay:200ms]", "[animation-delay:400ms]"];
|
|
12
11
|
function TypingDots() {
|
|
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
12
|
return /*#__PURE__*/_jsx("span", {
|
|
29
|
-
|
|
30
|
-
|
|
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
|
+
});
|
|
31
19
|
}
|
|
32
20
|
const marks = {
|
|
33
21
|
dots: TypingDots,
|
|
@@ -47,120 +35,45 @@ const labelShownByDefault = {
|
|
|
47
35
|
spinner: true,
|
|
48
36
|
locus: true
|
|
49
37
|
};
|
|
50
|
-
function VisibleLabel(
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
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
|
-
}
|
|
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
|
+
});
|
|
72
47
|
const shimmers = variant === "shimmer" || variant === "glyph" || variant === "locus";
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
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;
|
|
48
|
+
return /*#__PURE__*/_jsx("span", {
|
|
49
|
+
className: cn(shimmers && "motion-safe:shimmer"),
|
|
50
|
+
children: label
|
|
51
|
+
});
|
|
95
52
|
}
|
|
96
|
-
export function Pulse(
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
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;
|
|
53
|
+
export function Pulse({
|
|
54
|
+
variant = "dots",
|
|
55
|
+
label = "Thinking…",
|
|
56
|
+
showLabel,
|
|
57
|
+
tone = "neutral",
|
|
58
|
+
className
|
|
59
|
+
}) {
|
|
108
60
|
const Mark = marks[variant];
|
|
109
61
|
const labelVisible = showLabel ?? labelShownByDefault[variant];
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
}
|
|
118
|
-
let t5;
|
|
119
|
-
if ($[2] !== Mark || $[3] !== tone) {
|
|
120
|
-
t5 = Mark && /*#__PURE__*/_jsx(Mark, {
|
|
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, {
|
|
121
69
|
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, {
|
|
70
|
+
}), labelVisible ? /*#__PURE__*/_jsx(VisibleLabel, {
|
|
132
71
|
variant: variant,
|
|
133
72
|
label: label,
|
|
134
73
|
tone: tone
|
|
135
74
|
}) : /*#__PURE__*/_jsx("span", {
|
|
136
75
|
className: "sr-only",
|
|
137
76
|
children: label
|
|
138
|
-
})
|
|
139
|
-
|
|
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;
|
|
77
|
+
})]
|
|
78
|
+
});
|
|
166
79
|
}
|
|
@@ -1,40 +1,19 @@
|
|
|
1
|
-
import { c as _c } from "react/compiler-runtime";
|
|
2
1
|
import { useEffect, useRef } from "react";
|
|
3
2
|
export function prefersReducedMotion() {
|
|
4
3
|
return typeof window !== "undefined" && window.matchMedia?.("(prefers-reduced-motion: reduce)").matches === true;
|
|
5
4
|
}
|
|
6
|
-
export function useLoopAnimation(keyframes, duration,
|
|
7
|
-
const $ = _c(6);
|
|
8
|
-
const delay = t0 === undefined ? 0 : t0;
|
|
9
|
-
const easing = t1 === undefined ? "ease-in-out" : t1;
|
|
5
|
+
export function useLoopAnimation(keyframes, duration, delay = 0, easing = "ease-in-out") {
|
|
10
6
|
const ref = useRef(null);
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
easing,
|
|
23
|
-
iterations: Number.POSITIVE_INFINITY
|
|
24
|
-
});
|
|
25
|
-
return () => animation.cancel();
|
|
26
|
-
};
|
|
27
|
-
t3 = [keyframes, duration, delay, easing];
|
|
28
|
-
$[0] = delay;
|
|
29
|
-
$[1] = duration;
|
|
30
|
-
$[2] = easing;
|
|
31
|
-
$[3] = keyframes;
|
|
32
|
-
$[4] = t2;
|
|
33
|
-
$[5] = t3;
|
|
34
|
-
} else {
|
|
35
|
-
t2 = $[4];
|
|
36
|
-
t3 = $[5];
|
|
37
|
-
}
|
|
38
|
-
useEffect(t2, t3);
|
|
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]);
|
|
39
18
|
return ref;
|
|
40
19
|
}
|