@vllnt/ui 0.2.1-canary.9e6a7be → 0.2.1-canary.b3f1dff
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/components/bottom-activity-strip/bottom-activity-strip.js +91 -0
- package/dist/components/bottom-activity-strip/index.js +6 -0
- package/dist/components/comment-pin/comment-pin.js +104 -0
- package/dist/components/comment-pin/index.js +6 -0
- package/dist/components/conversation-thread/conversation-thread.js +348 -0
- package/dist/components/conversation-thread/index.js +20 -0
- package/dist/components/heat-overlay/heat-overlay.js +92 -0
- package/dist/components/heat-overlay/index.js +6 -0
- package/dist/components/index.js +82 -0
- package/dist/components/infinite-plane/index.js +6 -0
- package/dist/components/infinite-plane/infinite-plane.js +75 -0
- package/dist/components/live-cursor/index.js +6 -0
- package/dist/components/live-cursor/live-cursor.js +62 -0
- package/dist/components/metric-cluster/index.js +6 -0
- package/dist/components/metric-cluster/metric-cluster.js +96 -0
- package/dist/components/playback-ghost/index.js +6 -0
- package/dist/components/playback-ghost/playback-ghost.js +83 -0
- package/dist/components/presence-stack/index.js +6 -0
- package/dist/components/presence-stack/presence-stack.js +108 -0
- package/dist/components/presence-sync-indicator/index.js +6 -0
- package/dist/components/presence-sync-indicator/presence-sync-indicator.js +73 -0
- package/dist/components/run-timeline/index.js +6 -0
- package/dist/components/run-timeline/run-timeline.js +221 -0
- package/dist/components/selection-presence/index.js +6 -0
- package/dist/components/selection-presence/selection-presence.js +50 -0
- package/dist/components/state-badge-overlay/index.js +6 -0
- package/dist/components/state-badge-overlay/state-badge-overlay.js +90 -0
- package/dist/components/thread-bubble/index.js +6 -0
- package/dist/components/thread-bubble/thread-bubble.js +85 -0
- package/dist/components/timeline-scrubber/index.js +6 -0
- package/dist/components/timeline-scrubber/timeline-scrubber.js +179 -0
- package/dist/components/viewport-bookmarks/index.js +6 -0
- package/dist/components/viewport-bookmarks/viewport-bookmarks.js +116 -0
- package/dist/components/world-breadcrumbs/index.js +6 -0
- package/dist/components/world-breadcrumbs/world-breadcrumbs.js +114 -0
- package/dist/index.d.ts +1389 -2
- package/package.json +1 -1
package/dist/components/index.js
CHANGED
|
@@ -306,6 +306,9 @@ import {
|
|
|
306
306
|
ChatDockSection
|
|
307
307
|
} from "./chat-dock-section";
|
|
308
308
|
import { GlassPanel } from "./glass-panel";
|
|
309
|
+
import {
|
|
310
|
+
InfinitePlane
|
|
311
|
+
} from "./infinite-plane";
|
|
309
312
|
import { LeftRail } from "./left-rail";
|
|
310
313
|
import {
|
|
311
314
|
MiniMapPanel
|
|
@@ -323,6 +326,12 @@ import { Sidebar } from "./sidebar";
|
|
|
323
326
|
import { SidebarProvider, useSidebar } from "./sidebar-provider";
|
|
324
327
|
import { TableOfContents } from "./table-of-contents";
|
|
325
328
|
import { TopBar } from "./top-bar";
|
|
329
|
+
import {
|
|
330
|
+
ViewportBookmarks
|
|
331
|
+
} from "./viewport-bookmarks";
|
|
332
|
+
import {
|
|
333
|
+
WorldBreadcrumbs
|
|
334
|
+
} from "./world-breadcrumbs";
|
|
326
335
|
import { ZoomHUD } from "./zoom-hud";
|
|
327
336
|
import {
|
|
328
337
|
ActivityLog
|
|
@@ -530,15 +539,64 @@ import {
|
|
|
530
539
|
useFlowDiagram
|
|
531
540
|
} from "./flow-diagram";
|
|
532
541
|
import { AnchorPort } from "./anchor-port";
|
|
542
|
+
import {
|
|
543
|
+
BottomActivityStrip
|
|
544
|
+
} from "./bottom-activity-strip";
|
|
545
|
+
import {
|
|
546
|
+
CommentPin
|
|
547
|
+
} from "./comment-pin";
|
|
533
548
|
import {
|
|
534
549
|
ConnectorEdge
|
|
535
550
|
} from "./connector-edge";
|
|
536
551
|
import { EdgeLabel } from "./edge-label";
|
|
537
552
|
import { GroupHull } from "./group-hull";
|
|
553
|
+
import {
|
|
554
|
+
HeatOverlay
|
|
555
|
+
} from "./heat-overlay";
|
|
556
|
+
import {
|
|
557
|
+
LiveCursor
|
|
558
|
+
} from "./live-cursor";
|
|
559
|
+
import {
|
|
560
|
+
MetricCluster
|
|
561
|
+
} from "./metric-cluster";
|
|
538
562
|
import {
|
|
539
563
|
ObjectCard
|
|
540
564
|
} from "./object-card";
|
|
541
565
|
import { ObjectHandle } from "./object-handle";
|
|
566
|
+
import {
|
|
567
|
+
PlaybackGhost
|
|
568
|
+
} from "./playback-ghost";
|
|
569
|
+
import {
|
|
570
|
+
PresenceStack
|
|
571
|
+
} from "./presence-stack";
|
|
572
|
+
import {
|
|
573
|
+
PresenceSyncIndicator
|
|
574
|
+
} from "./presence-sync-indicator";
|
|
575
|
+
import {
|
|
576
|
+
RunTimeline
|
|
577
|
+
} from "./run-timeline";
|
|
578
|
+
import {
|
|
579
|
+
SelectionPresence
|
|
580
|
+
} from "./selection-presence";
|
|
581
|
+
import {
|
|
582
|
+
StateBadgeOverlay
|
|
583
|
+
} from "./state-badge-overlay";
|
|
584
|
+
import {
|
|
585
|
+
ThreadBubble
|
|
586
|
+
} from "./thread-bubble";
|
|
587
|
+
import {
|
|
588
|
+
TimelineScrubber
|
|
589
|
+
} from "./timeline-scrubber";
|
|
590
|
+
import {
|
|
591
|
+
ConversationEmpty,
|
|
592
|
+
ConversationHeader,
|
|
593
|
+
ConversationLoading,
|
|
594
|
+
ConversationMessages,
|
|
595
|
+
ConversationScrollButton,
|
|
596
|
+
ConversationSuggestions,
|
|
597
|
+
ConversationThread,
|
|
598
|
+
ConversationTitle
|
|
599
|
+
} from "./conversation-thread";
|
|
542
600
|
import { InlineInput } from "./inline-input";
|
|
543
601
|
import {
|
|
544
602
|
ModelSelector
|
|
@@ -585,6 +643,7 @@ export {
|
|
|
585
643
|
BeforeAfter,
|
|
586
644
|
BlogCard,
|
|
587
645
|
BorderBeam,
|
|
646
|
+
BottomActivityStrip,
|
|
588
647
|
BottomBar,
|
|
589
648
|
Breadcrumb,
|
|
590
649
|
Button,
|
|
@@ -623,6 +682,7 @@ export {
|
|
|
623
682
|
CommandList,
|
|
624
683
|
CommandSeparator,
|
|
625
684
|
CommandShortcut,
|
|
685
|
+
CommentPin,
|
|
626
686
|
CommonMistake,
|
|
627
687
|
Comparison,
|
|
628
688
|
CompletionDialog,
|
|
@@ -644,6 +704,14 @@ export {
|
|
|
644
704
|
ContextMenuSubContent,
|
|
645
705
|
ContextMenuSubTrigger,
|
|
646
706
|
ContextMenuTrigger,
|
|
707
|
+
ConversationEmpty,
|
|
708
|
+
ConversationHeader,
|
|
709
|
+
ConversationLoading,
|
|
710
|
+
ConversationMessages,
|
|
711
|
+
ConversationScrollButton,
|
|
712
|
+
ConversationSuggestions,
|
|
713
|
+
ConversationThread,
|
|
714
|
+
ConversationTitle,
|
|
647
715
|
CookieConsent,
|
|
648
716
|
CountdownTimer,
|
|
649
717
|
CreditBadge,
|
|
@@ -714,11 +782,13 @@ export {
|
|
|
714
782
|
GlassPanel,
|
|
715
783
|
Glossary,
|
|
716
784
|
GroupHull,
|
|
785
|
+
HeatOverlay,
|
|
717
786
|
Highlight,
|
|
718
787
|
HorizontalScrollRow,
|
|
719
788
|
HoverCard,
|
|
720
789
|
HoverCardContent,
|
|
721
790
|
HoverCardTrigger,
|
|
791
|
+
InfinitePlane,
|
|
722
792
|
InlineInput,
|
|
723
793
|
Input,
|
|
724
794
|
InputOTP,
|
|
@@ -732,6 +802,7 @@ export {
|
|
|
732
802
|
LearningObjectives,
|
|
733
803
|
LeftRail,
|
|
734
804
|
LineChart,
|
|
805
|
+
LiveCursor,
|
|
735
806
|
LiveFeed,
|
|
736
807
|
MDXContent,
|
|
737
808
|
MarketTreemap,
|
|
@@ -752,6 +823,7 @@ export {
|
|
|
752
823
|
MenubarSubContent,
|
|
753
824
|
MenubarSubTrigger,
|
|
754
825
|
MenubarTrigger,
|
|
826
|
+
MetricCluster,
|
|
755
827
|
MetricGauge,
|
|
756
828
|
MiniMapPanel,
|
|
757
829
|
ModelSelector,
|
|
@@ -775,11 +847,14 @@ export {
|
|
|
775
847
|
Pagination,
|
|
776
848
|
PasswordInput,
|
|
777
849
|
PlanBadge,
|
|
850
|
+
PlaybackGhost,
|
|
778
851
|
Popover,
|
|
779
852
|
PopoverAnchor,
|
|
780
853
|
PopoverContent,
|
|
781
854
|
PopoverTrigger,
|
|
782
855
|
Prerequisites,
|
|
856
|
+
PresenceStack,
|
|
857
|
+
PresenceSyncIndicator,
|
|
783
858
|
ProTip,
|
|
784
859
|
ProfileSection,
|
|
785
860
|
ProgressBar,
|
|
@@ -800,6 +875,7 @@ export {
|
|
|
800
875
|
ResizablePanelGroup,
|
|
801
876
|
RightDock,
|
|
802
877
|
RoleBadge,
|
|
878
|
+
RunTimeline,
|
|
803
879
|
ScopeSelector,
|
|
804
880
|
ScrollArea,
|
|
805
881
|
ScrollBar,
|
|
@@ -817,6 +893,7 @@ export {
|
|
|
817
893
|
SelectSeparator,
|
|
818
894
|
SelectTrigger,
|
|
819
895
|
SelectValue,
|
|
896
|
+
SelectionPresence,
|
|
820
897
|
Separator,
|
|
821
898
|
SeverityBadge,
|
|
822
899
|
ShareDialog,
|
|
@@ -842,6 +919,7 @@ export {
|
|
|
842
919
|
SparklineGrid,
|
|
843
920
|
Spinner,
|
|
844
921
|
StatCard,
|
|
922
|
+
StateBadgeOverlay,
|
|
845
923
|
StatusBoard,
|
|
846
924
|
StatusIndicator,
|
|
847
925
|
Step,
|
|
@@ -872,7 +950,9 @@ export {
|
|
|
872
950
|
ThemeProvider,
|
|
873
951
|
ThemeToggle,
|
|
874
952
|
ThinkingBlock,
|
|
953
|
+
ThreadBubble,
|
|
875
954
|
TickerTape,
|
|
955
|
+
TimelineScrubber,
|
|
876
956
|
Toast,
|
|
877
957
|
ToastAction,
|
|
878
958
|
ToastClose,
|
|
@@ -898,9 +978,11 @@ export {
|
|
|
898
978
|
UsageBreakdown,
|
|
899
979
|
VideoEmbed,
|
|
900
980
|
ViewSwitcher,
|
|
981
|
+
ViewportBookmarks,
|
|
901
982
|
WalletCard,
|
|
902
983
|
Watchlist,
|
|
903
984
|
WorkspaceSwitcher,
|
|
985
|
+
WorldBreadcrumbs,
|
|
904
986
|
WorldClockBar,
|
|
905
987
|
ZoomHUD,
|
|
906
988
|
alertVariants,
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import {
|
|
4
|
+
forwardRef
|
|
5
|
+
} from "react";
|
|
6
|
+
import { cn } from "../../lib/utils";
|
|
7
|
+
const DEFAULT_LABELS = {
|
|
8
|
+
region: "Infinite plane"
|
|
9
|
+
};
|
|
10
|
+
const safeSpacing = (value) => value < 4 ? 4 : value;
|
|
11
|
+
const safeZoom = (value) => {
|
|
12
|
+
if (value < 0.1) {
|
|
13
|
+
return 0.1;
|
|
14
|
+
}
|
|
15
|
+
if (value > 10) {
|
|
16
|
+
return 10;
|
|
17
|
+
}
|
|
18
|
+
return value;
|
|
19
|
+
};
|
|
20
|
+
const buildBackground = (input) => {
|
|
21
|
+
if (input.pattern === "blank") {
|
|
22
|
+
return {};
|
|
23
|
+
}
|
|
24
|
+
const size = safeSpacing(input.spacing) * safeZoom(input.zoom);
|
|
25
|
+
const pos = `${input.translate.x}px ${input.translate.y}px`;
|
|
26
|
+
if (input.pattern === "grid") {
|
|
27
|
+
return {
|
|
28
|
+
backgroundImage: "linear-gradient(to right, hsl(var(--border)) 1px, transparent 1px), linear-gradient(to bottom, hsl(var(--border)) 1px, transparent 1px)",
|
|
29
|
+
backgroundPosition: pos,
|
|
30
|
+
backgroundSize: `${size}px ${size}px`
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
return {
|
|
34
|
+
backgroundImage: "radial-gradient(circle, hsl(var(--border)) 1px, transparent 1px)",
|
|
35
|
+
backgroundPosition: pos,
|
|
36
|
+
backgroundSize: `${size}px ${size}px`
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
const InfinitePlane = forwardRef(
|
|
40
|
+
(props, ref) => {
|
|
41
|
+
const {
|
|
42
|
+
children,
|
|
43
|
+
className,
|
|
44
|
+
labels,
|
|
45
|
+
pattern = "dot",
|
|
46
|
+
spacing = 32,
|
|
47
|
+
translate = { x: 0, y: 0 },
|
|
48
|
+
zoom = 1,
|
|
49
|
+
...rest
|
|
50
|
+
} = props;
|
|
51
|
+
const resolvedLabels = { ...DEFAULT_LABELS, ...labels };
|
|
52
|
+
const background = buildBackground({ pattern, spacing, translate, zoom });
|
|
53
|
+
return /* @__PURE__ */ jsx(
|
|
54
|
+
"div",
|
|
55
|
+
{
|
|
56
|
+
"aria-label": resolvedLabels.region,
|
|
57
|
+
className: cn(
|
|
58
|
+
"relative h-full w-full overflow-hidden bg-background",
|
|
59
|
+
className
|
|
60
|
+
),
|
|
61
|
+
"data-infinite-plane": true,
|
|
62
|
+
"data-infinite-plane-pattern": pattern,
|
|
63
|
+
ref,
|
|
64
|
+
role: "region",
|
|
65
|
+
style: background,
|
|
66
|
+
...rest,
|
|
67
|
+
children
|
|
68
|
+
}
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
);
|
|
72
|
+
InfinitePlane.displayName = "InfinitePlane";
|
|
73
|
+
export {
|
|
74
|
+
InfinitePlane
|
|
75
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import {
|
|
4
|
+
forwardRef
|
|
5
|
+
} from "react";
|
|
6
|
+
import { cn } from "../../lib/utils";
|
|
7
|
+
const DEFAULT_LABELS = {
|
|
8
|
+
region: "Live cursor"
|
|
9
|
+
};
|
|
10
|
+
const LiveCursor = forwardRef(
|
|
11
|
+
(props, ref) => {
|
|
12
|
+
const { className, color, labels, name, status, x, y, ...rest } = props;
|
|
13
|
+
const resolvedLabels = { ...DEFAULT_LABELS, ...labels };
|
|
14
|
+
const resolvedColor = color ?? "var(--foreground)";
|
|
15
|
+
return /* @__PURE__ */ jsxs(
|
|
16
|
+
"div",
|
|
17
|
+
{
|
|
18
|
+
"aria-label": typeof name === "string" ? `${resolvedLabels.region}: ${name}` : resolvedLabels.region,
|
|
19
|
+
className: cn(
|
|
20
|
+
"pointer-events-none absolute z-30 flex items-start gap-1",
|
|
21
|
+
className
|
|
22
|
+
),
|
|
23
|
+
"data-live-cursor": true,
|
|
24
|
+
ref,
|
|
25
|
+
role: "img",
|
|
26
|
+
style: { left: x, top: y },
|
|
27
|
+
...rest,
|
|
28
|
+
children: [
|
|
29
|
+
/* @__PURE__ */ jsx(
|
|
30
|
+
"svg",
|
|
31
|
+
{
|
|
32
|
+
"aria-hidden": "true",
|
|
33
|
+
className: "-ml-1 -mt-1 drop-shadow-sm",
|
|
34
|
+
"data-live-cursor-pointer": true,
|
|
35
|
+
fill: resolvedColor,
|
|
36
|
+
height: 18,
|
|
37
|
+
viewBox: "0 0 16 18",
|
|
38
|
+
width: 16,
|
|
39
|
+
children: /* @__PURE__ */ jsx("path", { d: "M0 0 L0 14 L4 11 L7 17 L10 16 L7 10 L13 10 Z" })
|
|
40
|
+
}
|
|
41
|
+
),
|
|
42
|
+
name === null || name === void 0 ? null : /* @__PURE__ */ jsxs(
|
|
43
|
+
"span",
|
|
44
|
+
{
|
|
45
|
+
className: "ml-2 mt-2 inline-flex flex-col rounded-md px-1.5 py-0.5 text-[10px] font-medium text-white shadow-sm",
|
|
46
|
+
"data-live-cursor-chip": true,
|
|
47
|
+
style: { backgroundColor: resolvedColor },
|
|
48
|
+
children: [
|
|
49
|
+
/* @__PURE__ */ jsx("span", { children: name }),
|
|
50
|
+
status ? /* @__PURE__ */ jsx("span", { className: "text-[9px] opacity-80", "data-live-cursor-status": true, children: status }) : null
|
|
51
|
+
]
|
|
52
|
+
}
|
|
53
|
+
)
|
|
54
|
+
]
|
|
55
|
+
}
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
);
|
|
59
|
+
LiveCursor.displayName = "LiveCursor";
|
|
60
|
+
export {
|
|
61
|
+
LiveCursor
|
|
62
|
+
};
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import {
|
|
4
|
+
forwardRef
|
|
5
|
+
} from "react";
|
|
6
|
+
import { cn } from "../../lib/utils";
|
|
7
|
+
const TONE_DOT = {
|
|
8
|
+
danger: "bg-red-500",
|
|
9
|
+
neutral: "bg-muted-foreground",
|
|
10
|
+
success: "bg-emerald-500",
|
|
11
|
+
warn: "bg-amber-500"
|
|
12
|
+
};
|
|
13
|
+
const ANCHOR_TRANSFORM = {
|
|
14
|
+
"bottom-left": "translate(-100%, 100%)",
|
|
15
|
+
"bottom-right": "translate(0%, 100%)",
|
|
16
|
+
"top-left": "translate(-100%, -100%)",
|
|
17
|
+
"top-right": "translate(0%, -100%)"
|
|
18
|
+
};
|
|
19
|
+
const DEFAULT_LABELS = {
|
|
20
|
+
region: "Metric cluster"
|
|
21
|
+
};
|
|
22
|
+
const Row = (props) => {
|
|
23
|
+
const { entry } = props;
|
|
24
|
+
const tone = entry.tone ?? "neutral";
|
|
25
|
+
return /* @__PURE__ */ jsxs(
|
|
26
|
+
"li",
|
|
27
|
+
{
|
|
28
|
+
className: "flex items-center justify-between gap-2 text-[11px]",
|
|
29
|
+
"data-metric-cluster-row": entry.id,
|
|
30
|
+
"data-metric-cluster-tone": tone,
|
|
31
|
+
children: [
|
|
32
|
+
/* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1.5 text-muted-foreground", children: [
|
|
33
|
+
/* @__PURE__ */ jsx(
|
|
34
|
+
"span",
|
|
35
|
+
{
|
|
36
|
+
"aria-hidden": "true",
|
|
37
|
+
className: cn("h-1.5 w-1.5 rounded-full", TONE_DOT[tone])
|
|
38
|
+
}
|
|
39
|
+
),
|
|
40
|
+
entry.label
|
|
41
|
+
] }),
|
|
42
|
+
/* @__PURE__ */ jsx("span", { className: "font-semibold text-foreground", children: entry.value })
|
|
43
|
+
]
|
|
44
|
+
}
|
|
45
|
+
);
|
|
46
|
+
};
|
|
47
|
+
const MetricCluster = forwardRef(
|
|
48
|
+
(props, ref) => {
|
|
49
|
+
const {
|
|
50
|
+
anchor = "top-right",
|
|
51
|
+
className,
|
|
52
|
+
labels,
|
|
53
|
+
metrics,
|
|
54
|
+
title,
|
|
55
|
+
x,
|
|
56
|
+
y,
|
|
57
|
+
...rest
|
|
58
|
+
} = props;
|
|
59
|
+
const resolvedLabels = { ...DEFAULT_LABELS, ...labels };
|
|
60
|
+
return /* @__PURE__ */ jsxs(
|
|
61
|
+
"div",
|
|
62
|
+
{
|
|
63
|
+
"aria-label": resolvedLabels.region,
|
|
64
|
+
className: cn(
|
|
65
|
+
"pointer-events-none absolute z-20 flex flex-col gap-1 rounded-md border border-border bg-background/90 p-2 shadow-sm backdrop-blur",
|
|
66
|
+
className
|
|
67
|
+
),
|
|
68
|
+
"data-metric-cluster": true,
|
|
69
|
+
"data-metric-cluster-anchor": anchor,
|
|
70
|
+
ref,
|
|
71
|
+
role: "status",
|
|
72
|
+
style: {
|
|
73
|
+
left: x,
|
|
74
|
+
top: y,
|
|
75
|
+
transform: ANCHOR_TRANSFORM[anchor]
|
|
76
|
+
},
|
|
77
|
+
...rest,
|
|
78
|
+
children: [
|
|
79
|
+
title ? /* @__PURE__ */ jsx(
|
|
80
|
+
"header",
|
|
81
|
+
{
|
|
82
|
+
className: "text-[10px] font-medium uppercase tracking-wide text-muted-foreground",
|
|
83
|
+
"data-metric-cluster-title": true,
|
|
84
|
+
children: title
|
|
85
|
+
}
|
|
86
|
+
) : null,
|
|
87
|
+
/* @__PURE__ */ jsx("ul", { className: "space-y-0.5", children: metrics.map((entry) => /* @__PURE__ */ jsx(Row, { entry }, entry.id)) })
|
|
88
|
+
]
|
|
89
|
+
}
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
);
|
|
93
|
+
MetricCluster.displayName = "MetricCluster";
|
|
94
|
+
export {
|
|
95
|
+
MetricCluster
|
|
96
|
+
};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import {
|
|
4
|
+
forwardRef
|
|
5
|
+
} from "react";
|
|
6
|
+
import { cn } from "../../lib/utils";
|
|
7
|
+
const KIND_GLYPH = {
|
|
8
|
+
agent: "\u25C7",
|
|
9
|
+
artifact: "\u25CC",
|
|
10
|
+
input: "\u2198",
|
|
11
|
+
output: "\u2197",
|
|
12
|
+
run: "\u25B6",
|
|
13
|
+
task: "\u25A2"
|
|
14
|
+
};
|
|
15
|
+
const KIND_LABEL = {
|
|
16
|
+
agent: "Agent",
|
|
17
|
+
artifact: "Artifact",
|
|
18
|
+
input: "Input",
|
|
19
|
+
output: "Output",
|
|
20
|
+
run: "Run",
|
|
21
|
+
task: "Task"
|
|
22
|
+
};
|
|
23
|
+
const DEFAULT_LABELS = {
|
|
24
|
+
region: "Playback ghost"
|
|
25
|
+
};
|
|
26
|
+
const clamp01 = (v) => {
|
|
27
|
+
if (v < 0) {
|
|
28
|
+
return 0;
|
|
29
|
+
}
|
|
30
|
+
if (v > 1) {
|
|
31
|
+
return 1;
|
|
32
|
+
}
|
|
33
|
+
return v;
|
|
34
|
+
};
|
|
35
|
+
const PlaybackGhost = forwardRef(
|
|
36
|
+
(props, ref) => {
|
|
37
|
+
const {
|
|
38
|
+
className,
|
|
39
|
+
kind,
|
|
40
|
+
label,
|
|
41
|
+
labels,
|
|
42
|
+
opacity = 0.4,
|
|
43
|
+
size = 40,
|
|
44
|
+
x,
|
|
45
|
+
y,
|
|
46
|
+
...rest
|
|
47
|
+
} = props;
|
|
48
|
+
const resolvedLabels = { ...DEFAULT_LABELS, ...labels };
|
|
49
|
+
const safeOpacity = clamp01(opacity);
|
|
50
|
+
const safeSize = size < 16 ? 16 : size;
|
|
51
|
+
const ariaLabel = kind ? `${resolvedLabels.region}: ${KIND_LABEL[kind]}` : resolvedLabels.region;
|
|
52
|
+
return /* @__PURE__ */ jsxs(
|
|
53
|
+
"div",
|
|
54
|
+
{
|
|
55
|
+
"aria-label": ariaLabel,
|
|
56
|
+
className: cn(
|
|
57
|
+
"pointer-events-none absolute z-10 inline-flex -translate-x-1/2 -translate-y-1/2 items-center justify-center gap-1.5 rounded-md border border-dashed border-border/70 bg-background/40 px-2 py-1 text-xs text-foreground backdrop-blur-sm",
|
|
58
|
+
className
|
|
59
|
+
),
|
|
60
|
+
"data-playback-ghost": true,
|
|
61
|
+
"data-playback-kind": kind ?? "unknown",
|
|
62
|
+
ref,
|
|
63
|
+
role: "img",
|
|
64
|
+
style: {
|
|
65
|
+
left: x,
|
|
66
|
+
minHeight: safeSize,
|
|
67
|
+
minWidth: safeSize,
|
|
68
|
+
opacity: safeOpacity,
|
|
69
|
+
top: y
|
|
70
|
+
},
|
|
71
|
+
...rest,
|
|
72
|
+
children: [
|
|
73
|
+
kind ? /* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: "text-muted-foreground", children: KIND_GLYPH[kind] }) : null,
|
|
74
|
+
label ? /* @__PURE__ */ jsx("span", { className: "truncate", "data-playback-ghost-label": true, children: label }) : null
|
|
75
|
+
]
|
|
76
|
+
}
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
);
|
|
80
|
+
PlaybackGhost.displayName = "PlaybackGhost";
|
|
81
|
+
export {
|
|
82
|
+
PlaybackGhost
|
|
83
|
+
};
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import {
|
|
4
|
+
forwardRef
|
|
5
|
+
} from "react";
|
|
6
|
+
import { cn } from "../../lib/utils";
|
|
7
|
+
const STATUS_DOT = {
|
|
8
|
+
active: "bg-emerald-500",
|
|
9
|
+
away: "bg-amber-500",
|
|
10
|
+
idle: "bg-muted-foreground",
|
|
11
|
+
offline: "bg-muted-foreground/40"
|
|
12
|
+
};
|
|
13
|
+
const DEFAULT_LABELS = {
|
|
14
|
+
overflowSuffix: "more",
|
|
15
|
+
region: "Live presence"
|
|
16
|
+
};
|
|
17
|
+
const Avatar = (props) => {
|
|
18
|
+
const { user } = props;
|
|
19
|
+
const status = user.status ?? "active";
|
|
20
|
+
return /* @__PURE__ */ jsxs(
|
|
21
|
+
"span",
|
|
22
|
+
{
|
|
23
|
+
className: "relative -ml-2 inline-flex h-7 w-7 items-center justify-center rounded-full border-2 border-background text-[11px] font-semibold text-white shadow-sm first:ml-0",
|
|
24
|
+
"data-presence-stack-status": status,
|
|
25
|
+
"data-presence-stack-user": user.id,
|
|
26
|
+
style: { backgroundColor: user.color ?? "var(--foreground)" },
|
|
27
|
+
title: user.name,
|
|
28
|
+
children: [
|
|
29
|
+
user.initial,
|
|
30
|
+
/* @__PURE__ */ jsx(
|
|
31
|
+
"span",
|
|
32
|
+
{
|
|
33
|
+
"aria-hidden": "true",
|
|
34
|
+
className: cn(
|
|
35
|
+
"absolute -bottom-0.5 -right-0.5 h-2 w-2 rounded-full border border-background",
|
|
36
|
+
STATUS_DOT[status]
|
|
37
|
+
),
|
|
38
|
+
"data-presence-stack-dot": true
|
|
39
|
+
}
|
|
40
|
+
)
|
|
41
|
+
]
|
|
42
|
+
}
|
|
43
|
+
);
|
|
44
|
+
};
|
|
45
|
+
const PresenceStack = forwardRef(
|
|
46
|
+
(props, ref) => {
|
|
47
|
+
const {
|
|
48
|
+
className,
|
|
49
|
+
labels,
|
|
50
|
+
max = 5,
|
|
51
|
+
onOverflowActivate,
|
|
52
|
+
users,
|
|
53
|
+
...rest
|
|
54
|
+
} = props;
|
|
55
|
+
const resolvedLabels = { ...DEFAULT_LABELS, ...labels };
|
|
56
|
+
const visible = max >= users.length ? users : users.slice(0, max);
|
|
57
|
+
const hidden = users.length - visible.length;
|
|
58
|
+
const handleOverflow = () => {
|
|
59
|
+
onOverflowActivate?.();
|
|
60
|
+
};
|
|
61
|
+
return /* @__PURE__ */ jsxs(
|
|
62
|
+
"div",
|
|
63
|
+
{
|
|
64
|
+
"aria-label": resolvedLabels.region,
|
|
65
|
+
className: cn("inline-flex items-center pl-2", className),
|
|
66
|
+
"data-presence-stack": true,
|
|
67
|
+
ref,
|
|
68
|
+
role: "group",
|
|
69
|
+
...rest,
|
|
70
|
+
children: [
|
|
71
|
+
visible.map((user) => /* @__PURE__ */ jsx(Avatar, { user }, user.id)),
|
|
72
|
+
hidden > 0 ? renderOverflow({
|
|
73
|
+
count: hidden,
|
|
74
|
+
handleClick: handleOverflow,
|
|
75
|
+
handlerProvided: Boolean(onOverflowActivate),
|
|
76
|
+
labels: resolvedLabels
|
|
77
|
+
}) : null
|
|
78
|
+
]
|
|
79
|
+
}
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
);
|
|
83
|
+
PresenceStack.displayName = "PresenceStack";
|
|
84
|
+
const renderOverflow = (input) => {
|
|
85
|
+
const text = `+${input.count}`;
|
|
86
|
+
const aria = `${input.count} ${input.labels.overflowSuffix}`;
|
|
87
|
+
const className = "relative -ml-2 inline-flex h-7 min-w-7 items-center justify-center rounded-full border-2 border-background bg-muted px-1.5 text-[10px] font-semibold text-muted-foreground shadow-sm";
|
|
88
|
+
if (input.handlerProvided) {
|
|
89
|
+
return /* @__PURE__ */ jsx(
|
|
90
|
+
"button",
|
|
91
|
+
{
|
|
92
|
+
"aria-label": aria,
|
|
93
|
+
className: cn(
|
|
94
|
+
className,
|
|
95
|
+
"transition-colors hover:bg-muted/80 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
|
|
96
|
+
),
|
|
97
|
+
"data-presence-stack-overflow": true,
|
|
98
|
+
onClick: input.handleClick,
|
|
99
|
+
type: "button",
|
|
100
|
+
children: text
|
|
101
|
+
}
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
return /* @__PURE__ */ jsx("span", { "aria-label": aria, className, "data-presence-stack-overflow": true, children: text });
|
|
105
|
+
};
|
|
106
|
+
export {
|
|
107
|
+
PresenceStack
|
|
108
|
+
};
|