@locusgraph/loop 0.0.0-stage → 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.
- package/LICENSE +21 -0
- package/README.md +37 -2
- package/dist/agent/index.d.ts +5 -0
- package/dist/agent/index.js +5 -0
- package/dist/agent/pulse/gradient-label.d.ts +7 -0
- package/dist/agent/pulse/gradient-label.js +94 -0
- package/dist/agent/pulse/marks/bars-mark.d.ts +1 -0
- package/dist/agent/pulse/marks/bars-mark.js +51 -0
- package/dist/agent/pulse/marks/glyph-mark.d.ts +4 -0
- package/dist/agent/pulse/marks/glyph-mark.js +62 -0
- package/dist/agent/pulse/marks/locus-mark.d.ts +1 -0
- package/dist/agent/pulse/marks/locus-mark.js +73 -0
- package/dist/agent/pulse/marks/orb-mark.d.ts +1 -0
- package/dist/agent/pulse/marks/orb-mark.js +34 -0
- package/dist/agent/pulse/marks/spinner-mark.d.ts +1 -0
- package/dist/agent/pulse/marks/spinner-mark.js +32 -0
- package/dist/agent/pulse/pulse-tone.d.ts +1 -0
- package/dist/agent/pulse/pulse-tone.js +1 -0
- package/dist/agent/pulse/pulse.d.ts +12 -0
- package/dist/agent/pulse/pulse.js +166 -0
- package/dist/agent/pulse/use-loop-animation.d.ts +2 -0
- package/dist/agent/pulse/use-loop-animation.js +40 -0
- package/dist/agent/shared/status-dot.d.ts +1 -0
- package/dist/agent/shared/status-dot.js +1 -0
- package/dist/agent/steps/step-icon.d.ts +8 -0
- package/dist/agent/steps/step-icon.js +117 -0
- package/dist/agent/steps/steps.d.ts +7 -0
- package/dist/agent/steps/steps.js +249 -0
- package/dist/agent/thinking/thinking.d.ts +6 -0
- package/dist/agent/thinking/thinking.js +211 -0
- package/dist/agent/thinking/thought-duration.d.ts +2 -0
- package/dist/agent/thinking/thought-duration.js +11 -0
- package/dist/agent/tool/json-block.d.ts +5 -0
- package/dist/agent/tool/json-block.js +42 -0
- package/dist/agent/tool/tool-status.d.ts +6 -0
- package/dist/agent/tool/tool-status.js +59 -0
- package/dist/agent/tool/tool.d.ts +7 -0
- package/dist/agent/tool/tool.js +192 -0
- package/dist/approval/inbox/inbox-row.d.ts +12 -0
- package/dist/approval/inbox/inbox-row.js +328 -0
- package/dist/approval/inbox/inbox-selection.d.ts +6 -0
- package/dist/approval/inbox/inbox-selection.js +15 -0
- package/dist/approval/inbox/inbox.d.ts +12 -0
- package/dist/approval/inbox/inbox.js +258 -0
- package/dist/approval/inbox/virtual-inbox-list.d.ts +13 -0
- package/dist/approval/inbox/virtual-inbox-list.js +129 -0
- package/dist/approval/index.d.ts +9 -0
- package/dist/approval/index.js +8 -0
- package/dist/approval/memory/memory-choices.d.ts +10 -0
- package/dist/approval/memory/memory-choices.js +35 -0
- package/dist/approval/memory/memory-review.d.ts +11 -0
- package/dist/approval/memory/memory-review.js +256 -0
- package/dist/approval/memory/memory-row.d.ts +9 -0
- package/dist/approval/memory/memory-row.js +226 -0
- package/dist/approval/plan/plan-review.d.ts +13 -0
- package/dist/approval/plan/plan-review.js +289 -0
- package/dist/approval/plan/plan-step-row.d.ts +13 -0
- package/dist/approval/plan/plan-step-row.js +201 -0
- package/dist/approval/plan/plan-steps.d.ts +8 -0
- package/dist/approval/plan/plan-steps.js +30 -0
- package/dist/approval/plan/question-choices.d.ts +10 -0
- package/dist/approval/plan/question-choices.js +166 -0
- package/dist/approval/plan/question.d.ts +18 -0
- package/dist/approval/plan/question.js +232 -0
- package/dist/approval/run/run-bar.d.ts +13 -0
- package/dist/approval/run/run-bar.js +189 -0
- package/dist/approval/shared/decision-line.d.ts +1 -0
- package/dist/approval/shared/decision-line.js +1 -0
- package/dist/approval/shared/risk-badge.d.ts +10 -0
- package/dist/approval/shared/risk-badge.js +57 -0
- package/dist/approval/shared/time.d.ts +3 -0
- package/dist/approval/shared/time.js +12 -0
- package/dist/approval/shared/use-focus-on-mount.d.ts +2 -0
- package/dist/approval/shared/use-focus-on-mount.js +26 -0
- package/dist/approval/spend/raise-cap-form.d.ts +8 -0
- package/dist/approval/spend/raise-cap-form.js +244 -0
- package/dist/approval/spend/spend-gate.d.ts +16 -0
- package/dist/approval/spend/spend-gate.js +250 -0
- package/dist/approval/spend/spend-math.d.ts +5 -0
- package/dist/approval/spend/spend-math.js +17 -0
- package/dist/approval/spend/spend-meter.d.ts +10 -0
- package/dist/approval/spend/spend-meter.js +377 -0
- package/dist/approval/tool/approval.d.ts +14 -0
- package/dist/approval/tool/approval.js +290 -0
- package/dist/approval/tool/args/args-editor.d.ts +16 -0
- package/dist/approval/tool/args/args-editor.js +273 -0
- package/dist/approval/tool/args/args-field.d.ts +11 -0
- package/dist/approval/tool/args/args-field.js +268 -0
- package/dist/approval/tool/args/args-validation.d.ts +8 -0
- package/dist/approval/tool/args/args-validation.js +50 -0
- package/dist/approval/tool/deny-form.d.ts +6 -0
- package/dist/approval/tool/deny-form.js +135 -0
- package/dist/approval/tool/tool-inputs.d.ts +6 -0
- package/dist/approval/tool/tool-inputs.js +142 -0
- package/dist/approval/types.d.ts +59 -0
- package/dist/approval/types.js +1 -0
- 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 +8 -0
- package/dist/chat/chat/chat.js +187 -0
- package/dist/chat/chat/use-stick-to-bottom.d.ts +7 -0
- package/dist/chat/chat/use-stick-to-bottom.js +133 -0
- package/dist/chat/chat/virtual-chat-items.d.ts +8 -0
- package/dist/chat/chat/virtual-chat-items.js +153 -0
- package/dist/chat/composer/composer-actions.d.ts +15 -0
- package/dist/chat/composer/composer-actions.js +158 -0
- package/dist/chat/composer/composer.d.ts +20 -0
- package/dist/chat/composer/composer.js +340 -0
- package/dist/chat/composer/use-auto-grow.d.ts +2 -0
- package/dist/chat/composer/use-auto-grow.js +29 -0
- package/dist/chat/files/file-meta.d.ts +13 -0
- package/dist/chat/files/file-meta.js +30 -0
- package/dist/chat/files/files.d.ts +9 -0
- package/dist/chat/files/files.js +327 -0
- package/dist/chat/index.d.ts +7 -0
- package/dist/chat/index.js +7 -0
- package/dist/chat/reply/fenced-code.d.ts +8 -0
- package/dist/chat/reply/fenced-code.js +53 -0
- package/dist/chat/reply/markdown-components.d.ts +2 -0
- package/dist/chat/reply/markdown-components.js +142 -0
- package/dist/chat/reply/reply.d.ts +8 -0
- package/dist/chat/reply/reply.js +116 -0
- package/dist/chat/turn/group-parts.d.ts +24 -0
- package/dist/chat/turn/group-parts.js +49 -0
- package/dist/chat/turn/turn.d.ts +11 -0
- package/dist/chat/turn/turn.js +253 -0
- package/dist/cost/context.d.ts +13 -0
- package/dist/cost/context.js +333 -0
- package/dist/cost/cost-steps.d.ts +17 -0
- package/dist/cost/cost-steps.js +230 -0
- package/dist/cost/cost.d.ts +8 -0
- package/dist/cost/cost.js +531 -0
- package/dist/cost/index.d.ts +4 -0
- package/dist/cost/index.js +4 -0
- package/dist/cost/model-picker.d.ts +11 -0
- package/dist/cost/model-picker.js +184 -0
- package/dist/cost/shared/context-breakdown.d.ts +15 -0
- package/dist/cost/shared/context-breakdown.js +306 -0
- package/dist/cost/shared/meter-marks.d.ts +9 -0
- package/dist/cost/shared/meter-marks.js +114 -0
- package/dist/cost/shared/model-option-row.d.ts +14 -0
- package/dist/cost/shared/model-option-row.js +189 -0
- package/dist/cost/shared/step-cost-row.d.ts +15 -0
- package/dist/cost/shared/step-cost-row.js +262 -0
- package/dist/cost/shared/usage-totals.d.ts +11 -0
- package/dist/cost/shared/usage-totals.js +30 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +7 -0
- package/dist/memory/cite.d.ts +8 -0
- package/dist/memory/cite.js +190 -0
- package/dist/memory/index.d.ts +5 -0
- package/dist/memory/index.js +4 -0
- package/dist/memory/memorized.d.ts +14 -0
- package/dist/memory/memorized.js +225 -0
- package/dist/memory/recall.d.ts +9 -0
- package/dist/memory/recall.js +303 -0
- package/dist/memory/shared/disclosure.d.ts +6 -0
- package/dist/memory/shared/disclosure.js +6 -0
- package/dist/memory/shared/host-label.d.ts +6 -0
- package/dist/memory/shared/host-label.js +31 -0
- package/dist/memory/shared/source-mark.d.ts +5 -0
- package/dist/memory/shared/source-mark.js +42 -0
- package/dist/memory/sources.d.ts +9 -0
- package/dist/memory/sources.js +264 -0
- package/dist/shared/decision-summary.d.ts +18 -0
- package/dist/shared/decision-summary.js +144 -0
- package/dist/shared/panel-empty.d.ts +8 -0
- package/dist/shared/panel-empty.js +80 -0
- package/dist/shared/panel.d.ts +19 -0
- package/dist/shared/panel.js +251 -0
- package/dist/shared/status-dot.d.ts +6 -0
- package/dist/shared/status-dot.js +42 -0
- package/dist/shared/virtual/use-list-virtualizer.d.ts +24 -0
- package/dist/shared/virtual/use-list-virtualizer.js +68 -0
- package/dist/sources.css +1 -0
- package/dist/thread/actions/action-button.d.ts +8 -0
- package/dist/thread/actions/action-button.js +67 -0
- package/dist/thread/actions/actions.d.ts +13 -0
- package/dist/thread/actions/actions.js +192 -0
- package/dist/thread/actions/branch-switcher.d.ts +10 -0
- package/dist/thread/actions/branch-switcher.js +104 -0
- package/dist/thread/canvas/canvas.d.ts +14 -0
- package/dist/thread/canvas/canvas.js +212 -0
- package/dist/thread/canvas/version-switcher.d.ts +12 -0
- package/dist/thread/canvas/version-switcher.js +152 -0
- package/dist/thread/code/code.d.ts +10 -0
- package/dist/thread/code/code.js +195 -0
- package/dist/thread/code/copy-code-button.d.ts +6 -0
- package/dist/thread/code/copy-code-button.js +66 -0
- package/dist/thread/code/highlight.d.ts +1 -0
- package/dist/thread/code/highlight.js +40 -0
- 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 +16 -0
- package/dist/thread/history/history.js +179 -0
- package/dist/thread/history/row/history-row.d.ts +15 -0
- package/dist/thread/history/row/history-row.js +137 -0
- package/dist/thread/history/row/thread-item-menu.d.ts +7 -0
- package/dist/thread/history/row/thread-item-menu.js +84 -0
- package/dist/thread/history/row/thread-title-editor.d.ts +7 -0
- package/dist/thread/history/row/thread-title-editor.js +81 -0
- package/dist/thread/history/thread-groups.d.ts +8 -0
- package/dist/thread/history/thread-groups.js +52 -0
- package/dist/thread/history/virtual-history-list.d.ts +11 -0
- package/dist/thread/history/virtual-history-list.js +107 -0
- package/dist/thread/index.d.ts +8 -0
- package/dist/thread/index.js +5 -0
- package/dist/thread/starters/starters.d.ts +12 -0
- package/dist/thread/starters/starters.js +100 -0
- package/dist/thread/use-copied.d.ts +5 -0
- package/dist/thread/use-copied.js +52 -0
- package/dist/types.d.ts +70 -0
- package/dist/types.js +3 -0
- package/package.json +59 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 LocusGraph
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,38 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @locusgraph/loop
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Loop is the agent kit for LocusGraph apps: chat, what the agent is doing, human-in-the-loop approvals, memory and cost. Components take data and callbacks only and never call a model. Message shapes follow the Vercel AI SDK `UIMessage` parts, so `useChat()` output can be passed straight in.
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
pnpm add @locusgraph/loop @locusgraph/components
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
```css
|
|
10
|
+
@import "@locusgraph/components/theme.css";
|
|
11
|
+
@import "@locusgraph/loop/sources.css";
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
```tsx
|
|
15
|
+
import { Chat, Composer, Turn } from "@locusgraph/loop";
|
|
16
|
+
|
|
17
|
+
<Chat>
|
|
18
|
+
{messages.map((message) => (
|
|
19
|
+
<Turn key={message.id} message={message} />
|
|
20
|
+
))}
|
|
21
|
+
</Chat>
|
|
22
|
+
<Composer status={status} onSubmit={(text) => sendMessage({ text })} onStop={stop} />
|
|
23
|
+
```
|
|
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
|
+
|
|
27
|
+
| Group | Components |
|
|
28
|
+
|---|---|
|
|
29
|
+
| Chat | `Chat`, `Turn`, `Reply`, `Composer`, `Files` |
|
|
30
|
+
| Thread | `Starters`, `Actions`, `History`, `Code`, `Canvas` |
|
|
31
|
+
| Agent | `Thinking`, `Steps`, `Tool`, `Pulse` |
|
|
32
|
+
| Human in the loop | `Approval`, `ArgsEditor`, `PlanReview`, `Question`, `SpendGate`, `MemoryReview`, `RunBar`, `Inbox` |
|
|
33
|
+
| Memory | `Cite`, `Sources`, `Recall`, `Memorized` |
|
|
34
|
+
| Cost | `Context`, `Cost`, `CostSteps`, `ModelPicker` |
|
|
35
|
+
|
|
36
|
+
`Turn` renders reasoning, tool and source parts with `Thinking`, `Tool` and `Sources`; pass `renderReasoning`, `renderTool` or `renderSources` to replace them. A tool part in the `approval-requested` state is where `Approval` goes: wire its `onApprove` and `onDeny` to the AI SDK's tool approval response.
|
|
37
|
+
|
|
38
|
+
Approvals follow one rule: tools that only read run without asking; tools that write, pay, send or delete pause and show exactly what is being approved, with stronger warnings for destructive ones. Money is integer micro-USD, formatted with `@locusgraph/utils`.
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { c as _c } from "react/compiler-runtime";
|
|
2
|
+
import { AiGenerate as SparkleIcon } from "@carbon/icons-react";
|
|
3
|
+
import { cn } from "@locusgraph/components";
|
|
4
|
+
import { useLoopAnimation } from "./use-loop-animation.js";
|
|
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
|
+
}];
|
|
18
|
+
const toneIcon = {
|
|
19
|
+
neutral: "fill-foreground/70 text-foreground/70",
|
|
20
|
+
brand: "fill-violet-500 text-violet-500"
|
|
21
|
+
};
|
|
22
|
+
const toneText = {
|
|
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))]"
|
|
25
|
+
};
|
|
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;
|
|
94
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function BarsMark(): import("react").JSX.Element;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { c as _c } from "react/compiler-runtime";
|
|
2
|
+
import { useLoopAnimation } from "../use-loop-animation.js";
|
|
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
|
+
}];
|
|
11
|
+
const barDelays = [0, 140, 280, 420];
|
|
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;
|
|
30
|
+
}
|
|
31
|
+
export function BarsMark() {
|
|
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);
|
|
51
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { c as _c } from "react/compiler-runtime";
|
|
2
|
+
import { cn } from "@locusgraph/components";
|
|
3
|
+
import { useEffect, useState } from "react";
|
|
4
|
+
import { prefersReducedMotion } from "../use-loop-animation.js";
|
|
5
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
+
const glyphs = ["·", "✢", "✳", "✶", "✻", "✽", "✻", "✶", "✳", "✢"];
|
|
7
|
+
const restingGlyph = "✻";
|
|
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;
|
|
62
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function LocusMark(): import("react").JSX.Element;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { c as _c } from "react/compiler-runtime";
|
|
2
|
+
import { LocusGraphMark } from "@locusgraph/brand";
|
|
3
|
+
import { useEffect, useRef } from "react";
|
|
4
|
+
import { prefersReducedMotion } from "../use-loop-animation.js";
|
|
5
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
+
const sweepMs = 1800;
|
|
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
|
+
}];
|
|
19
|
+
function sweepDelay(path) {
|
|
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;
|
|
24
|
+
}
|
|
25
|
+
function animateRays(svg) {
|
|
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
|
+
}));
|
|
34
|
+
}
|
|
35
|
+
export function LocusMark() {
|
|
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;
|
|
73
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function OrbMark(): import("react").JSX.Element;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { c as _c } from "react/compiler-runtime";
|
|
2
|
+
import { useLoopAnimation } from "../use-loop-animation.js";
|
|
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
|
+
}];
|
|
14
|
+
export function OrbMark() {
|
|
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;
|
|
34
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function SpinnerMark(): import("react").JSX.Element;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { c as _c } from "react/compiler-runtime";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
export function SpinnerMark() {
|
|
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;
|
|
32
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type PulseTone = "neutral" | "brand";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { PulseTone } from "./pulse-tone.js";
|
|
2
|
+
export type { PulseTone };
|
|
3
|
+
export type PulseVariant = "dots" | "shimmer" | "glyph" | "orb" | "gradient" | "bars" | "spinner" | "locus";
|
|
4
|
+
export declare const pulseVariants: PulseVariant[];
|
|
5
|
+
export type PulseProps = {
|
|
6
|
+
variant?: PulseVariant;
|
|
7
|
+
label?: string;
|
|
8
|
+
showLabel?: boolean;
|
|
9
|
+
tone?: PulseTone;
|
|
10
|
+
className?: string;
|
|
11
|
+
};
|
|
12
|
+
export declare function Pulse({ variant, label, showLabel, tone, className, }: PulseProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import { c as _c } from "react/compiler-runtime";
|
|
2
|
+
import { cn } from "@locusgraph/components";
|
|
3
|
+
import { GradientLabel } from "./gradient-label.js";
|
|
4
|
+
import { BarsMark } from "./marks/bars-mark.js";
|
|
5
|
+
import { GlyphMark } from "./marks/glyph-mark.js";
|
|
6
|
+
import { LocusMark } from "./marks/locus-mark.js";
|
|
7
|
+
import { OrbMark } from "./marks/orb-mark.js";
|
|
8
|
+
import { SpinnerMark } from "./marks/spinner-mark.js";
|
|
9
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
|
+
export const pulseVariants = ["dots", "shimmer", "glyph", "orb", "gradient", "bars", "spinner", "locus"];
|
|
11
|
+
const dotDelays = ["[animation-delay:0ms]", "[animation-delay:200ms]", "[animation-delay:400ms]"];
|
|
12
|
+
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
|
+
return /*#__PURE__*/_jsx("span", {
|
|
29
|
+
className: cn("size-1.5 rounded-full bg-muted-foreground/70 motion-safe:animate-pulse", delay)
|
|
30
|
+
}, delay);
|
|
31
|
+
}
|
|
32
|
+
const marks = {
|
|
33
|
+
dots: TypingDots,
|
|
34
|
+
glyph: GlyphMark,
|
|
35
|
+
orb: OrbMark,
|
|
36
|
+
bars: BarsMark,
|
|
37
|
+
spinner: SpinnerMark,
|
|
38
|
+
locus: LocusMark
|
|
39
|
+
};
|
|
40
|
+
const labelShownByDefault = {
|
|
41
|
+
dots: false,
|
|
42
|
+
shimmer: true,
|
|
43
|
+
glyph: true,
|
|
44
|
+
orb: false,
|
|
45
|
+
gradient: true,
|
|
46
|
+
bars: false,
|
|
47
|
+
spinner: true,
|
|
48
|
+
locus: true
|
|
49
|
+
};
|
|
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;
|
|
95
|
+
}
|
|
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;
|
|
166
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { c as _c } from "react/compiler-runtime";
|
|
2
|
+
import { useEffect, useRef } from "react";
|
|
3
|
+
export function prefersReducedMotion() {
|
|
4
|
+
return typeof window !== "undefined" && window.matchMedia?.("(prefers-reduced-motion: reduce)").matches === true;
|
|
5
|
+
}
|
|
6
|
+
export function useLoopAnimation(keyframes, duration, t0, t1) {
|
|
7
|
+
const $ = _c(6);
|
|
8
|
+
const delay = t0 === undefined ? 0 : t0;
|
|
9
|
+
const easing = t1 === undefined ? "ease-in-out" : t1;
|
|
10
|
+
const ref = useRef(null);
|
|
11
|
+
let t2;
|
|
12
|
+
let t3;
|
|
13
|
+
if ($[0] !== delay || $[1] !== duration || $[2] !== easing || $[3] !== keyframes) {
|
|
14
|
+
t2 = () => {
|
|
15
|
+
const element = ref.current;
|
|
16
|
+
if (!element || typeof element.animate !== "function" || prefersReducedMotion()) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
const animation = element.animate(keyframes, {
|
|
20
|
+
duration,
|
|
21
|
+
delay,
|
|
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);
|
|
39
|
+
return ref;
|
|
40
|
+
}
|