@vllnt/ui 0.2.1-canary.9e6a7be → 0.2.1-canary.ab2c69a
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/conversation-thread/conversation-thread.js +348 -0
- package/dist/components/conversation-thread/index.js +20 -0
- package/dist/components/index.js +42 -0
- package/dist/components/infinite-plane/index.js +6 -0
- package/dist/components/infinite-plane/infinite-plane.js +75 -0
- package/dist/components/presence-stack/index.js +6 -0
- package/dist/components/presence-stack/presence-stack.js +108 -0
- package/dist/components/selection-presence/index.js +6 -0
- package/dist/components/selection-presence/selection-presence.js +50 -0
- package/dist/components/thread-bubble/index.js +6 -0
- package/dist/components/thread-bubble/thread-bubble.js +85 -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 +564 -2
- package/package.json +1 -1
|
@@ -0,0 +1,50 @@
|
|
|
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: "Selection presence"
|
|
9
|
+
};
|
|
10
|
+
const SelectionPresence = forwardRef((props, ref) => {
|
|
11
|
+
const { className, color, height, labels, name, width, x, y, ...rest } = props;
|
|
12
|
+
const resolvedLabels = { ...DEFAULT_LABELS, ...labels };
|
|
13
|
+
const accent = color ?? "var(--foreground)";
|
|
14
|
+
const ariaLabel = typeof name === "string" ? `${resolvedLabels.region}: ${name}` : resolvedLabels.region;
|
|
15
|
+
return /* @__PURE__ */ jsx(
|
|
16
|
+
"div",
|
|
17
|
+
{
|
|
18
|
+
"aria-label": ariaLabel,
|
|
19
|
+
className: cn(
|
|
20
|
+
"pointer-events-none absolute z-20 rounded-md border-2 border-dashed",
|
|
21
|
+
className
|
|
22
|
+
),
|
|
23
|
+
"data-selection-presence": true,
|
|
24
|
+
ref,
|
|
25
|
+
role: "img",
|
|
26
|
+
style: {
|
|
27
|
+
backgroundColor: `color-mix(in srgb, ${accent} 10%, transparent)`,
|
|
28
|
+
borderColor: accent,
|
|
29
|
+
height,
|
|
30
|
+
left: x,
|
|
31
|
+
top: y,
|
|
32
|
+
width
|
|
33
|
+
},
|
|
34
|
+
...rest,
|
|
35
|
+
children: name === null || name === void 0 ? null : /* @__PURE__ */ jsx(
|
|
36
|
+
"span",
|
|
37
|
+
{
|
|
38
|
+
className: "absolute -top-5 left-0 inline-flex items-center rounded-md px-1.5 py-0.5 text-[10px] font-medium text-white shadow-sm",
|
|
39
|
+
"data-selection-presence-chip": true,
|
|
40
|
+
style: { backgroundColor: accent },
|
|
41
|
+
children: name
|
|
42
|
+
}
|
|
43
|
+
)
|
|
44
|
+
}
|
|
45
|
+
);
|
|
46
|
+
});
|
|
47
|
+
SelectionPresence.displayName = "SelectionPresence";
|
|
48
|
+
export {
|
|
49
|
+
SelectionPresence
|
|
50
|
+
};
|
|
@@ -0,0 +1,85 @@
|
|
|
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
|
+
empty: "No replies yet",
|
|
9
|
+
region: "Comment thread"
|
|
10
|
+
};
|
|
11
|
+
const Message = (props) => {
|
|
12
|
+
const { message } = props;
|
|
13
|
+
return /* @__PURE__ */ jsxs("li", { className: "space-y-0.5", "data-thread-bubble-message": message.id, children: [
|
|
14
|
+
/* @__PURE__ */ jsxs("header", { className: "flex items-baseline justify-between gap-2 text-[10px]", children: [
|
|
15
|
+
/* @__PURE__ */ jsx(
|
|
16
|
+
"span",
|
|
17
|
+
{
|
|
18
|
+
className: "font-semibold",
|
|
19
|
+
"data-thread-bubble-author": true,
|
|
20
|
+
style: message.authorColor ? { color: message.authorColor } : void 0,
|
|
21
|
+
children: message.author
|
|
22
|
+
}
|
|
23
|
+
),
|
|
24
|
+
message.ts ? /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", "data-thread-bubble-ts": true, children: message.ts }) : null
|
|
25
|
+
] }),
|
|
26
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs text-foreground", "data-thread-bubble-body": true, children: message.body })
|
|
27
|
+
] });
|
|
28
|
+
};
|
|
29
|
+
const ThreadBubble = forwardRef(
|
|
30
|
+
(props, ref) => {
|
|
31
|
+
const { className, footer, labels, messages, onResolve, title, ...rest } = props;
|
|
32
|
+
const resolvedLabels = { ...DEFAULT_LABELS, ...labels };
|
|
33
|
+
const handleResolve = () => {
|
|
34
|
+
onResolve?.();
|
|
35
|
+
};
|
|
36
|
+
return /* @__PURE__ */ jsxs(
|
|
37
|
+
"section",
|
|
38
|
+
{
|
|
39
|
+
"aria-label": resolvedLabels.region,
|
|
40
|
+
className: cn(
|
|
41
|
+
"flex w-72 flex-col gap-2 rounded-lg border border-border bg-background p-3 text-foreground shadow-md",
|
|
42
|
+
className
|
|
43
|
+
),
|
|
44
|
+
"data-thread-bubble": true,
|
|
45
|
+
ref,
|
|
46
|
+
...rest,
|
|
47
|
+
children: [
|
|
48
|
+
title || onResolve ? /* @__PURE__ */ jsxs("header", { className: "flex items-center justify-between gap-2 text-[11px] uppercase tracking-wide text-muted-foreground", children: [
|
|
49
|
+
title ? /* @__PURE__ */ jsx("span", { className: "truncate font-semibold", "data-thread-bubble-title": true, children: title }) : /* @__PURE__ */ jsx("span", { "aria-hidden": "true" }),
|
|
50
|
+
onResolve ? /* @__PURE__ */ jsx(
|
|
51
|
+
"button",
|
|
52
|
+
{
|
|
53
|
+
className: "rounded-full border border-border px-2 py-0.5 text-[10px] font-medium text-muted-foreground transition-colors hover:bg-muted/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
54
|
+
"data-thread-bubble-resolve": true,
|
|
55
|
+
onClick: handleResolve,
|
|
56
|
+
type: "button",
|
|
57
|
+
children: "Resolve"
|
|
58
|
+
}
|
|
59
|
+
) : null
|
|
60
|
+
] }) : null,
|
|
61
|
+
messages.length === 0 ? /* @__PURE__ */ jsx(
|
|
62
|
+
"p",
|
|
63
|
+
{
|
|
64
|
+
className: "px-1 py-2 text-center text-[11px] text-muted-foreground",
|
|
65
|
+
"data-thread-bubble-state": "empty",
|
|
66
|
+
children: resolvedLabels.empty
|
|
67
|
+
}
|
|
68
|
+
) : /* @__PURE__ */ jsx("ul", { className: "space-y-2 overflow-y-auto", "data-thread-bubble-list": true, children: messages.map((message) => /* @__PURE__ */ jsx(Message, { message }, message.id)) }),
|
|
69
|
+
footer ? /* @__PURE__ */ jsx(
|
|
70
|
+
"footer",
|
|
71
|
+
{
|
|
72
|
+
className: "border-t border-border pt-2",
|
|
73
|
+
"data-thread-bubble-footer": true,
|
|
74
|
+
children: footer
|
|
75
|
+
}
|
|
76
|
+
) : null
|
|
77
|
+
]
|
|
78
|
+
}
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
);
|
|
82
|
+
ThreadBubble.displayName = "ThreadBubble";
|
|
83
|
+
export {
|
|
84
|
+
ThreadBubble
|
|
85
|
+
};
|
|
@@ -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
|
+
};
|