@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
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import {
|
|
4
|
+
forwardRef,
|
|
5
|
+
useId
|
|
6
|
+
} from "react";
|
|
7
|
+
import { cn } from "../../lib/utils";
|
|
8
|
+
const TONE_FILL = {
|
|
9
|
+
danger: "bg-red-500",
|
|
10
|
+
neutral: "bg-foreground",
|
|
11
|
+
primary: "bg-blue-500",
|
|
12
|
+
success: "bg-emerald-500",
|
|
13
|
+
warn: "bg-amber-500"
|
|
14
|
+
};
|
|
15
|
+
const DEFAULT_LABELS = {
|
|
16
|
+
region: "Timeline scrubber"
|
|
17
|
+
};
|
|
18
|
+
const clamp = (v, min, max) => {
|
|
19
|
+
if (v < min) {
|
|
20
|
+
return min;
|
|
21
|
+
}
|
|
22
|
+
if (v > max) {
|
|
23
|
+
return max;
|
|
24
|
+
}
|
|
25
|
+
return v;
|
|
26
|
+
};
|
|
27
|
+
const Labels = (props) => {
|
|
28
|
+
const fmt = props.formatValue;
|
|
29
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex items-baseline justify-between gap-2", children: [
|
|
30
|
+
/* @__PURE__ */ jsx("span", { "data-timeline-scrubber-start": true, children: fmt ? fmt(props.start) : props.start }),
|
|
31
|
+
/* @__PURE__ */ jsx(
|
|
32
|
+
"span",
|
|
33
|
+
{
|
|
34
|
+
className: "font-semibold text-foreground",
|
|
35
|
+
"data-timeline-scrubber-cursor": true,
|
|
36
|
+
children: fmt ? fmt(props.clamped) : props.clamped
|
|
37
|
+
}
|
|
38
|
+
),
|
|
39
|
+
/* @__PURE__ */ jsx("span", { "data-timeline-scrubber-end": true, children: fmt ? fmt(props.end) : props.end })
|
|
40
|
+
] });
|
|
41
|
+
};
|
|
42
|
+
const Track = (props) => /* @__PURE__ */ jsxs("div", { className: "relative h-6", children: [
|
|
43
|
+
/* @__PURE__ */ jsx(
|
|
44
|
+
"span",
|
|
45
|
+
{
|
|
46
|
+
"aria-hidden": "true",
|
|
47
|
+
className: "absolute left-0 right-0 top-1/2 h-1 -translate-y-1/2 rounded-full bg-muted"
|
|
48
|
+
}
|
|
49
|
+
),
|
|
50
|
+
/* @__PURE__ */ jsx(
|
|
51
|
+
"span",
|
|
52
|
+
{
|
|
53
|
+
"aria-hidden": "true",
|
|
54
|
+
className: cn(
|
|
55
|
+
"absolute left-0 top-1/2 h-1 -translate-y-1/2 rounded-full",
|
|
56
|
+
TONE_FILL[props.tone]
|
|
57
|
+
),
|
|
58
|
+
"data-timeline-scrubber-fill": true,
|
|
59
|
+
style: { width: `${props.ratio * 100}%` }
|
|
60
|
+
}
|
|
61
|
+
),
|
|
62
|
+
props.ticks?.map((tick) => /* @__PURE__ */ jsx(
|
|
63
|
+
TickMark,
|
|
64
|
+
{
|
|
65
|
+
scrubberId: props.scrubberId,
|
|
66
|
+
span: props.span,
|
|
67
|
+
start: props.start,
|
|
68
|
+
tick
|
|
69
|
+
},
|
|
70
|
+
tick.id
|
|
71
|
+
)),
|
|
72
|
+
/* @__PURE__ */ jsx(
|
|
73
|
+
"input",
|
|
74
|
+
{
|
|
75
|
+
"aria-label": props.ariaLabel,
|
|
76
|
+
className: "absolute inset-0 h-full w-full cursor-pointer appearance-none bg-transparent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
77
|
+
"data-timeline-scrubber-input": true,
|
|
78
|
+
id: props.inputId,
|
|
79
|
+
max: props.max,
|
|
80
|
+
min: props.min,
|
|
81
|
+
onChange: props.onChange,
|
|
82
|
+
step: props.step,
|
|
83
|
+
type: "range",
|
|
84
|
+
value: props.value
|
|
85
|
+
}
|
|
86
|
+
)
|
|
87
|
+
] });
|
|
88
|
+
const TickMark = (props) => {
|
|
89
|
+
const { scrubberId, span, start, tick } = props;
|
|
90
|
+
const ratio = clamp((tick.value - start) / span, 0, 1);
|
|
91
|
+
const tone = tick.tone ?? "neutral";
|
|
92
|
+
return /* @__PURE__ */ jsx(
|
|
93
|
+
"span",
|
|
94
|
+
{
|
|
95
|
+
"aria-hidden": "true",
|
|
96
|
+
className: cn(
|
|
97
|
+
"absolute top-1/2 h-2.5 w-px -translate-y-1/2 rounded-full",
|
|
98
|
+
TONE_FILL[tone]
|
|
99
|
+
),
|
|
100
|
+
"data-scrubber-tick": tick.id,
|
|
101
|
+
"data-scrubber-tick-of": scrubberId,
|
|
102
|
+
"data-scrubber-tick-tone": tone,
|
|
103
|
+
style: { left: `${ratio * 100}%` },
|
|
104
|
+
title: typeof tick.label === "string" ? tick.label : void 0
|
|
105
|
+
}
|
|
106
|
+
);
|
|
107
|
+
};
|
|
108
|
+
const TimelineScrubber = forwardRef((props, ref) => {
|
|
109
|
+
const {
|
|
110
|
+
className,
|
|
111
|
+
end,
|
|
112
|
+
formatValue,
|
|
113
|
+
labels,
|
|
114
|
+
onValueChange,
|
|
115
|
+
start,
|
|
116
|
+
step = 1,
|
|
117
|
+
ticks,
|
|
118
|
+
tone = "primary",
|
|
119
|
+
value,
|
|
120
|
+
...rest
|
|
121
|
+
} = props;
|
|
122
|
+
const resolvedLabels = { ...DEFAULT_LABELS, ...labels };
|
|
123
|
+
const inputId = useId();
|
|
124
|
+
const safeEnd = end <= start ? start + 1 : end;
|
|
125
|
+
const span = safeEnd - start;
|
|
126
|
+
const clamped = clamp(value, start, safeEnd);
|
|
127
|
+
const ratio = clamp((clamped - start) / span, 0, 1);
|
|
128
|
+
const handleChange = (event) => {
|
|
129
|
+
onValueChange(clamp(Number(event.target.value), start, safeEnd));
|
|
130
|
+
};
|
|
131
|
+
return /* @__PURE__ */ jsxs(
|
|
132
|
+
"div",
|
|
133
|
+
{
|
|
134
|
+
"aria-label": resolvedLabels.region,
|
|
135
|
+
className: cn(
|
|
136
|
+
"flex w-full flex-col gap-1 text-[11px] text-muted-foreground",
|
|
137
|
+
className
|
|
138
|
+
),
|
|
139
|
+
"data-timeline-scrubber": true,
|
|
140
|
+
"data-timeline-tone": tone,
|
|
141
|
+
ref,
|
|
142
|
+
role: "group",
|
|
143
|
+
...rest,
|
|
144
|
+
children: [
|
|
145
|
+
/* @__PURE__ */ jsx(
|
|
146
|
+
Labels,
|
|
147
|
+
{
|
|
148
|
+
clamped,
|
|
149
|
+
end: safeEnd,
|
|
150
|
+
formatValue,
|
|
151
|
+
start
|
|
152
|
+
}
|
|
153
|
+
),
|
|
154
|
+
/* @__PURE__ */ jsx(
|
|
155
|
+
Track,
|
|
156
|
+
{
|
|
157
|
+
ariaLabel: resolvedLabels.region,
|
|
158
|
+
inputId,
|
|
159
|
+
max: safeEnd,
|
|
160
|
+
min: start,
|
|
161
|
+
onChange: handleChange,
|
|
162
|
+
ratio,
|
|
163
|
+
scrubberId: inputId,
|
|
164
|
+
span,
|
|
165
|
+
start,
|
|
166
|
+
step,
|
|
167
|
+
ticks,
|
|
168
|
+
tone,
|
|
169
|
+
value: clamped
|
|
170
|
+
}
|
|
171
|
+
)
|
|
172
|
+
]
|
|
173
|
+
}
|
|
174
|
+
);
|
|
175
|
+
});
|
|
176
|
+
TimelineScrubber.displayName = "TimelineScrubber";
|
|
177
|
+
export {
|
|
178
|
+
TimelineScrubber
|
|
179
|
+
};
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import {
|
|
4
|
+
forwardRef
|
|
5
|
+
} from "react";
|
|
6
|
+
import { cn } from "../../lib/utils";
|
|
7
|
+
const DEFAULT_LABELS = {
|
|
8
|
+
empty: "No saved views",
|
|
9
|
+
region: "Viewport bookmarks"
|
|
10
|
+
};
|
|
11
|
+
const Row = (props) => {
|
|
12
|
+
const { active, bookmark, onSelect } = props;
|
|
13
|
+
const handleClick = () => {
|
|
14
|
+
onSelect?.(bookmark.id);
|
|
15
|
+
};
|
|
16
|
+
const rowClass = "flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-xs transition-colors";
|
|
17
|
+
const activeClass = active ? "bg-muted/60 text-foreground" : "text-muted-foreground hover:bg-muted/30 hover:text-foreground";
|
|
18
|
+
if (onSelect) {
|
|
19
|
+
return /* @__PURE__ */ jsx(
|
|
20
|
+
"button",
|
|
21
|
+
{
|
|
22
|
+
"aria-pressed": active,
|
|
23
|
+
className: cn(
|
|
24
|
+
rowClass,
|
|
25
|
+
activeClass,
|
|
26
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
|
|
27
|
+
),
|
|
28
|
+
"data-viewport-bookmark": bookmark.id,
|
|
29
|
+
"data-viewport-bookmark-active": active,
|
|
30
|
+
onClick: handleClick,
|
|
31
|
+
type: "button",
|
|
32
|
+
children: /* @__PURE__ */ jsx(RowBody, { bookmark })
|
|
33
|
+
}
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
return /* @__PURE__ */ jsx(
|
|
37
|
+
"span",
|
|
38
|
+
{
|
|
39
|
+
className: cn(rowClass, activeClass),
|
|
40
|
+
"data-viewport-bookmark": bookmark.id,
|
|
41
|
+
"data-viewport-bookmark-active": active,
|
|
42
|
+
children: /* @__PURE__ */ jsx(RowBody, { bookmark })
|
|
43
|
+
}
|
|
44
|
+
);
|
|
45
|
+
};
|
|
46
|
+
const RowBody = (props) => {
|
|
47
|
+
const { bookmark } = props;
|
|
48
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
49
|
+
/* @__PURE__ */ jsx(
|
|
50
|
+
"span",
|
|
51
|
+
{
|
|
52
|
+
"aria-hidden": "true",
|
|
53
|
+
className: "h-1.5 w-1.5 rounded-full",
|
|
54
|
+
style: { backgroundColor: bookmark.color ?? "hsl(var(--foreground))" }
|
|
55
|
+
}
|
|
56
|
+
),
|
|
57
|
+
/* @__PURE__ */ jsxs("span", { className: "flex flex-1 flex-col text-left", children: [
|
|
58
|
+
/* @__PURE__ */ jsx("span", { className: "truncate font-medium", children: bookmark.label }),
|
|
59
|
+
bookmark.detail ? /* @__PURE__ */ jsx(
|
|
60
|
+
"span",
|
|
61
|
+
{
|
|
62
|
+
className: "truncate text-[10px] text-muted-foreground",
|
|
63
|
+
"data-viewport-bookmark-detail": true,
|
|
64
|
+
children: bookmark.detail
|
|
65
|
+
}
|
|
66
|
+
) : null
|
|
67
|
+
] })
|
|
68
|
+
] });
|
|
69
|
+
};
|
|
70
|
+
const ViewportBookmarks = forwardRef((props, ref) => {
|
|
71
|
+
const {
|
|
72
|
+
activeId,
|
|
73
|
+
bookmarks,
|
|
74
|
+
className,
|
|
75
|
+
labels,
|
|
76
|
+
onSelect,
|
|
77
|
+
title = "Saved views",
|
|
78
|
+
...rest
|
|
79
|
+
} = props;
|
|
80
|
+
const resolvedLabels = { ...DEFAULT_LABELS, ...labels };
|
|
81
|
+
return /* @__PURE__ */ jsxs(
|
|
82
|
+
"section",
|
|
83
|
+
{
|
|
84
|
+
"aria-label": resolvedLabels.region,
|
|
85
|
+
className: cn(
|
|
86
|
+
"flex w-full flex-col gap-1 rounded-lg border border-border bg-background p-2 text-foreground",
|
|
87
|
+
className
|
|
88
|
+
),
|
|
89
|
+
"data-viewport-bookmarks": true,
|
|
90
|
+
ref,
|
|
91
|
+
...rest,
|
|
92
|
+
children: [
|
|
93
|
+
/* @__PURE__ */ jsx("header", { className: "px-2 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground", children: title }),
|
|
94
|
+
bookmarks.length === 0 ? /* @__PURE__ */ jsx(
|
|
95
|
+
"p",
|
|
96
|
+
{
|
|
97
|
+
className: "px-2 py-3 text-center text-[11px] text-muted-foreground",
|
|
98
|
+
"data-viewport-bookmarks-state": "empty",
|
|
99
|
+
children: resolvedLabels.empty
|
|
100
|
+
}
|
|
101
|
+
) : /* @__PURE__ */ jsx("ul", { className: "space-y-0.5", children: bookmarks.map((bookmark) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(
|
|
102
|
+
Row,
|
|
103
|
+
{
|
|
104
|
+
active: activeId === bookmark.id,
|
|
105
|
+
bookmark,
|
|
106
|
+
onSelect
|
|
107
|
+
}
|
|
108
|
+
) }, bookmark.id)) })
|
|
109
|
+
]
|
|
110
|
+
}
|
|
111
|
+
);
|
|
112
|
+
});
|
|
113
|
+
ViewportBookmarks.displayName = "ViewportBookmarks";
|
|
114
|
+
export {
|
|
115
|
+
ViewportBookmarks
|
|
116
|
+
};
|
|
@@ -0,0 +1,114 @@
|
|
|
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
|
+
group: "\u25A4",
|
|
11
|
+
run: "\u25B6",
|
|
12
|
+
task: "\u25A2",
|
|
13
|
+
world: "\u2726"
|
|
14
|
+
};
|
|
15
|
+
const DEFAULT_LABELS = {
|
|
16
|
+
empty: "No location",
|
|
17
|
+
region: "World breadcrumbs"
|
|
18
|
+
};
|
|
19
|
+
const Crumb = (props) => {
|
|
20
|
+
const { crumb, isLast, onSelect } = props;
|
|
21
|
+
const glyph = crumb.kind ? KIND_GLYPH[crumb.kind] : null;
|
|
22
|
+
const handleClick = () => {
|
|
23
|
+
onSelect?.(crumb.id);
|
|
24
|
+
};
|
|
25
|
+
const text = /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-1", children: [
|
|
26
|
+
glyph ? /* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: "text-muted-foreground", children: glyph }) : null,
|
|
27
|
+
/* @__PURE__ */ jsx("span", { className: "truncate", children: crumb.label })
|
|
28
|
+
] });
|
|
29
|
+
if (isLast || !onSelect) {
|
|
30
|
+
return /* @__PURE__ */ jsx(
|
|
31
|
+
"span",
|
|
32
|
+
{
|
|
33
|
+
"aria-current": isLast ? "location" : void 0,
|
|
34
|
+
className: cn(
|
|
35
|
+
"inline-flex items-center text-xs",
|
|
36
|
+
isLast ? "font-semibold text-foreground" : "text-muted-foreground"
|
|
37
|
+
),
|
|
38
|
+
"data-world-breadcrumb": crumb.id,
|
|
39
|
+
"data-world-breadcrumb-active": isLast,
|
|
40
|
+
children: text
|
|
41
|
+
}
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
return /* @__PURE__ */ jsx(
|
|
45
|
+
"button",
|
|
46
|
+
{
|
|
47
|
+
className: "inline-flex items-center rounded-sm text-xs text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
48
|
+
"data-world-breadcrumb": crumb.id,
|
|
49
|
+
"data-world-breadcrumb-active": "false",
|
|
50
|
+
onClick: handleClick,
|
|
51
|
+
type: "button",
|
|
52
|
+
children: text
|
|
53
|
+
}
|
|
54
|
+
);
|
|
55
|
+
};
|
|
56
|
+
const WorldBreadcrumbs = forwardRef(
|
|
57
|
+
(props, ref) => {
|
|
58
|
+
const { className, crumbs, labels, onSelect, ...rest } = props;
|
|
59
|
+
const resolvedLabels = { ...DEFAULT_LABELS, ...labels };
|
|
60
|
+
if (crumbs.length === 0) {
|
|
61
|
+
return /* @__PURE__ */ jsx(
|
|
62
|
+
"nav",
|
|
63
|
+
{
|
|
64
|
+
"aria-label": resolvedLabels.region,
|
|
65
|
+
className: cn(
|
|
66
|
+
"inline-flex items-center text-xs text-muted-foreground",
|
|
67
|
+
className
|
|
68
|
+
),
|
|
69
|
+
"data-world-breadcrumbs": true,
|
|
70
|
+
"data-world-breadcrumbs-state": "empty",
|
|
71
|
+
ref,
|
|
72
|
+
...rest,
|
|
73
|
+
children: resolvedLabels.empty
|
|
74
|
+
}
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
return /* @__PURE__ */ jsx(
|
|
78
|
+
"nav",
|
|
79
|
+
{
|
|
80
|
+
"aria-label": resolvedLabels.region,
|
|
81
|
+
className: cn(
|
|
82
|
+
"inline-flex items-center gap-1.5 text-xs text-muted-foreground",
|
|
83
|
+
className
|
|
84
|
+
),
|
|
85
|
+
"data-world-breadcrumbs": true,
|
|
86
|
+
ref,
|
|
87
|
+
...rest,
|
|
88
|
+
children: crumbs.map((crumb, index) => /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-1.5", children: [
|
|
89
|
+
/* @__PURE__ */ jsx(
|
|
90
|
+
Crumb,
|
|
91
|
+
{
|
|
92
|
+
crumb,
|
|
93
|
+
isLast: index === crumbs.length - 1,
|
|
94
|
+
onSelect
|
|
95
|
+
}
|
|
96
|
+
),
|
|
97
|
+
index < crumbs.length - 1 ? /* @__PURE__ */ jsx(
|
|
98
|
+
"span",
|
|
99
|
+
{
|
|
100
|
+
"aria-hidden": "true",
|
|
101
|
+
className: "text-muted-foreground/60",
|
|
102
|
+
"data-world-breadcrumb-sep": true,
|
|
103
|
+
children: "\u203A"
|
|
104
|
+
}
|
|
105
|
+
) : null
|
|
106
|
+
] }, crumb.id))
|
|
107
|
+
}
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
);
|
|
111
|
+
WorldBreadcrumbs.displayName = "WorldBreadcrumbs";
|
|
112
|
+
export {
|
|
113
|
+
WorldBreadcrumbs
|
|
114
|
+
};
|