@calliopelabs/ui 0.13.0 → 0.16.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/README.md +192 -4
- package/dist/agent/AgentChat.d.ts +63 -0
- package/dist/agent/AgentChat.js +117 -0
- package/dist/agent/AgentLauncher.d.ts +25 -0
- package/dist/agent/AgentLauncher.js +25 -0
- package/dist/agent/AgentProvider.d.ts +82 -0
- package/dist/agent/AgentProvider.js +176 -0
- package/dist/agent/CalliopeAgent.d.ts +43 -0
- package/dist/agent/CalliopeAgent.js +111 -0
- package/dist/agent/WorkflowRenderers.d.ts +61 -0
- package/dist/agent/WorkflowRenderers.js +102 -0
- package/dist/agent/controller.d.ts +167 -0
- package/dist/agent/controller.js +496 -0
- package/dist/agent/copilotkit/CopilotKitAgentProvider.d.ts +41 -0
- package/dist/agent/copilotkit/CopilotKitAgentProvider.js +145 -0
- package/dist/agent/copilotkit/index.d.ts +6 -0
- package/dist/agent/copilotkit/index.js +6 -0
- package/dist/agent/engine.d.ts +41 -0
- package/dist/agent/engine.js +93 -0
- package/dist/agent/index.d.ts +17 -0
- package/dist/agent/index.js +17 -0
- package/dist/agent/mock.d.ts +56 -0
- package/dist/agent/mock.js +143 -0
- package/dist/agent/renderers.d.ts +49 -0
- package/dist/agent/renderers.js +27 -0
- package/dist/agent/surface.d.ts +30 -0
- package/dist/agent/surface.js +90 -0
- package/dist/agent/tool.d.ts +98 -0
- package/dist/agent/tool.js +81 -0
- package/dist/appearance/brands.d.ts +31 -12
- package/dist/appearance/brands.js +32 -51
- package/dist/chat/AgentProgress.d.ts +19 -0
- package/dist/chat/AgentProgress.js +34 -0
- package/dist/chat/Composer.d.ts +31 -0
- package/dist/chat/Composer.js +44 -0
- package/dist/chat/MessageBubble.d.ts +23 -0
- package/dist/chat/MessageBubble.js +26 -0
- package/dist/chat/MessageList.d.ts +43 -0
- package/dist/chat/MessageList.js +71 -0
- package/dist/chat/ModelPicker.d.ts +17 -0
- package/dist/chat/ModelPicker.js +13 -0
- package/dist/chat/ToolCallCard.d.ts +27 -0
- package/dist/chat/ToolCallCard.js +52 -0
- package/dist/chat/model.d.ts +123 -0
- package/dist/chat/model.js +337 -0
- package/dist/chat/patch.d.ts +12 -0
- package/dist/chat/patch.js +149 -0
- package/dist/chat/useAgUiRun.d.ts +52 -0
- package/dist/chat/useAgUiRun.js +137 -0
- package/dist/css/appearance.js +1 -1
- package/dist/css/calliope.css +5 -0
- package/dist/css/tokens.css +5 -0
- package/dist/index.d.ts +15 -1
- package/dist/index.js +16 -1
- package/dist/primitives/Badge.d.ts +14 -0
- package/dist/primitives/Badge.js +25 -0
- package/dist/primitives/Button.d.ts +1 -1
- package/dist/primitives/ContextMenu.d.ts +18 -0
- package/dist/primitives/ContextMenu.js +34 -0
- package/dist/primitives/ScrollArea.d.ts +16 -0
- package/dist/primitives/ScrollArea.js +11 -0
- package/dist/primitives/Toast.d.ts +37 -0
- package/dist/primitives/Toast.js +43 -0
- package/dist/primitives/Tooltip.d.ts +16 -0
- package/dist/primitives/Tooltip.js +26 -0
- package/dist/provider/messages.d.ts +135 -0
- package/dist/provider/messages.js +131 -0
- package/dist/theme/css-layer.js +2 -1
- package/dist/theme/mappings/palette.d.ts +52 -0
- package/dist/theme/mappings/palette.js +208 -0
- package/dist/theme/mappings/render.d.ts +9 -0
- package/dist/theme/mappings/render.js +520 -0
- package/dist/theme/mappings/targets.d.ts +43 -0
- package/dist/theme/mappings/targets.js +222 -0
- package/dist/theme/tokens.d.ts +10 -9
- package/dist/theme/tokens.generated.d.ts +356 -0
- package/dist/theme/tokens.generated.js +360 -0
- package/dist/theme/tokens.js +20 -264
- package/dist/tokens/README.jupyterlab.md +125 -0
- package/dist/tokens/README.md +15 -0
- package/dist/tokens/README.native.md +29 -0
- package/dist/tokens/README.plain.md +84 -0
- package/dist/tokens/README.python.md +33 -0
- package/dist/tokens/README.vscode.md +114 -0
- package/dist/tokens/jupyterlab.css +1710 -0
- package/dist/tokens/plain.css +930 -0
- package/dist/tokens/tokens.native.d.ts +85 -0
- package/dist/tokens/tokens.native.js +773 -0
- package/dist/tokens/tokens.py +1043 -0
- package/dist/tokens/vscode.css +1138 -0
- package/dist/workbench/FileBrowser.d.ts +62 -0
- package/dist/workbench/FileBrowser.js +117 -0
- package/dist/workbench/FileGrid.d.ts +13 -0
- package/dist/workbench/FileGrid.js +114 -0
- package/dist/workbench/FileIcon.d.ts +10 -0
- package/dist/workbench/FileIcon.js +24 -0
- package/dist/workbench/FileList.d.ts +35 -0
- package/dist/workbench/FileList.js +160 -0
- package/dist/workbench/FilePreview.d.ts +66 -0
- package/dist/workbench/FilePreview.js +108 -0
- package/dist/workbench/FileTree.d.ts +37 -0
- package/dist/workbench/FileTree.js +218 -0
- package/dist/workbench/UploadDropzone.d.ts +52 -0
- package/dist/workbench/UploadDropzone.js +115 -0
- package/dist/workbench/dnd.d.ts +17 -0
- package/dist/workbench/dnd.js +77 -0
- package/dist/workbench/index.d.ts +16 -0
- package/dist/workbench/index.js +16 -0
- package/dist/workbench/model.d.ts +72 -0
- package/dist/workbench/model.js +214 -0
- package/dist/workbench/selection.d.ts +16 -0
- package/dist/workbench/selection.js +46 -0
- package/dist/workbench/typeahead.d.ts +15 -0
- package/dist/workbench/typeahead.js +22 -0
- package/package.json +39 -2
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
export class JsonPatchError extends Error {
|
|
2
|
+
name = "JsonPatchError";
|
|
3
|
+
}
|
|
4
|
+
const isObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
5
|
+
const has = (object, key) => Object.prototype.hasOwnProperty.call(object, key);
|
|
6
|
+
function parse(path) {
|
|
7
|
+
if (path === "")
|
|
8
|
+
return [];
|
|
9
|
+
if (!path.startsWith("/"))
|
|
10
|
+
throw new JsonPatchError(`bad pointer ${path}`);
|
|
11
|
+
return path
|
|
12
|
+
.slice(1)
|
|
13
|
+
.split("/")
|
|
14
|
+
.map((segment) => segment.replace(/~1/g, "/").replace(/~0/g, "~"));
|
|
15
|
+
}
|
|
16
|
+
function index(array, key, forAdd) {
|
|
17
|
+
if (forAdd && key === "-")
|
|
18
|
+
return array.length;
|
|
19
|
+
if (!/^(0|[1-9]\d*)$/.test(key))
|
|
20
|
+
throw new JsonPatchError(`bad array index ${key}`);
|
|
21
|
+
const i = Number(key);
|
|
22
|
+
if (i > array.length || (!forAdd && i === array.length)) {
|
|
23
|
+
throw new JsonPatchError(`index ${key} out of range`);
|
|
24
|
+
}
|
|
25
|
+
return i;
|
|
26
|
+
}
|
|
27
|
+
function get(doc, segments) {
|
|
28
|
+
let current = doc;
|
|
29
|
+
for (const segment of segments) {
|
|
30
|
+
if (Array.isArray(current))
|
|
31
|
+
current = current[index(current, segment, false)];
|
|
32
|
+
else if (isObject(current) && has(current, segment))
|
|
33
|
+
current = current[segment];
|
|
34
|
+
else
|
|
35
|
+
throw new JsonPatchError(`no value at /${segments.join("/")}`);
|
|
36
|
+
}
|
|
37
|
+
return current;
|
|
38
|
+
}
|
|
39
|
+
/** Rebuilds the path to `segments`, with `leaf` deciding the last step. */
|
|
40
|
+
function edit(doc, segments, leaf) {
|
|
41
|
+
const [head, ...rest] = segments;
|
|
42
|
+
if (head === undefined)
|
|
43
|
+
throw new JsonPatchError("the root is replaced, not edited");
|
|
44
|
+
if (rest.length === 0)
|
|
45
|
+
return leaf(doc, head);
|
|
46
|
+
if (Array.isArray(doc)) {
|
|
47
|
+
const i = index(doc, head, false);
|
|
48
|
+
const copy = doc.slice();
|
|
49
|
+
copy[i] = edit(doc[i], rest, leaf);
|
|
50
|
+
return copy;
|
|
51
|
+
}
|
|
52
|
+
if (isObject(doc) && has(doc, head))
|
|
53
|
+
return { ...doc, [head]: edit(doc[head], rest, leaf) };
|
|
54
|
+
throw new JsonPatchError(`no value at /${segments.join("/")}`);
|
|
55
|
+
}
|
|
56
|
+
function add(doc, path, value) {
|
|
57
|
+
const segments = parse(path);
|
|
58
|
+
if (segments.length === 0)
|
|
59
|
+
return value;
|
|
60
|
+
return edit(doc, segments, (parent, key) => {
|
|
61
|
+
if (Array.isArray(parent)) {
|
|
62
|
+
const copy = parent.slice();
|
|
63
|
+
copy.splice(index(parent, key, true), 0, value);
|
|
64
|
+
return copy;
|
|
65
|
+
}
|
|
66
|
+
if (isObject(parent))
|
|
67
|
+
return { ...parent, [key]: value };
|
|
68
|
+
throw new JsonPatchError(`cannot add under a scalar at ${path}`);
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
function remove(doc, path) {
|
|
72
|
+
return edit(doc, parse(path), (parent, key) => {
|
|
73
|
+
if (Array.isArray(parent)) {
|
|
74
|
+
const copy = parent.slice();
|
|
75
|
+
copy.splice(index(parent, key, false), 1);
|
|
76
|
+
return copy;
|
|
77
|
+
}
|
|
78
|
+
if (isObject(parent) && has(parent, key)) {
|
|
79
|
+
const copy = { ...parent };
|
|
80
|
+
delete copy[key];
|
|
81
|
+
return copy;
|
|
82
|
+
}
|
|
83
|
+
throw new JsonPatchError(`no value at ${path}`);
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
function replace(doc, path, value) {
|
|
87
|
+
const segments = parse(path);
|
|
88
|
+
if (segments.length === 0)
|
|
89
|
+
return value;
|
|
90
|
+
get(doc, segments);
|
|
91
|
+
return edit(doc, segments, (parent, key) => {
|
|
92
|
+
if (Array.isArray(parent)) {
|
|
93
|
+
const copy = parent.slice();
|
|
94
|
+
copy[index(parent, key, false)] = value;
|
|
95
|
+
return copy;
|
|
96
|
+
}
|
|
97
|
+
return { ...parent, [key]: value };
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
/** Values from the patch are copied in, so a later edit of the event never reaches the state. */
|
|
101
|
+
const clone = (value) => value === undefined ? value : JSON.parse(JSON.stringify(value));
|
|
102
|
+
function equal(a, b) {
|
|
103
|
+
if (a === b)
|
|
104
|
+
return true;
|
|
105
|
+
if (Array.isArray(a) && Array.isArray(b)) {
|
|
106
|
+
return a.length === b.length && a.every((value, i) => equal(value, b[i]));
|
|
107
|
+
}
|
|
108
|
+
if (isObject(a) && isObject(b)) {
|
|
109
|
+
const keys = Object.keys(a);
|
|
110
|
+
return (keys.length === Object.keys(b).length &&
|
|
111
|
+
keys.every((key) => has(b, key) && equal(a[key], b[key])));
|
|
112
|
+
}
|
|
113
|
+
return false;
|
|
114
|
+
}
|
|
115
|
+
function applyOne(doc, operation) {
|
|
116
|
+
switch (operation.op) {
|
|
117
|
+
case "add":
|
|
118
|
+
return add(doc, operation.path, clone(operation.value));
|
|
119
|
+
case "remove":
|
|
120
|
+
return remove(doc, operation.path);
|
|
121
|
+
case "replace":
|
|
122
|
+
return replace(doc, operation.path, clone(operation.value));
|
|
123
|
+
case "move": {
|
|
124
|
+
if (operation.path === operation.from)
|
|
125
|
+
return doc;
|
|
126
|
+
if (operation.path.startsWith(`${operation.from}/`)) {
|
|
127
|
+
throw new JsonPatchError("cannot move a value into its own child");
|
|
128
|
+
}
|
|
129
|
+
const value = get(doc, parse(operation.from));
|
|
130
|
+
return add(remove(doc, operation.from), operation.path, value);
|
|
131
|
+
}
|
|
132
|
+
case "copy":
|
|
133
|
+
return add(doc, operation.path, clone(get(doc, parse(operation.from))));
|
|
134
|
+
case "test":
|
|
135
|
+
if (!equal(get(doc, parse(operation.path)), operation.value)) {
|
|
136
|
+
throw new JsonPatchError(`test failed at ${operation.path}`);
|
|
137
|
+
}
|
|
138
|
+
return doc;
|
|
139
|
+
default:
|
|
140
|
+
throw new JsonPatchError(`unknown op ${operation.op}`);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
/** Applies every operation in order, or throws `JsonPatchError` and applies none. */
|
|
144
|
+
export function applyJsonPatch(doc, patch) {
|
|
145
|
+
let current = doc;
|
|
146
|
+
for (const operation of patch)
|
|
147
|
+
current = applyOne(current, operation);
|
|
148
|
+
return current;
|
|
149
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { type AgUiEvent, type ChatView } from "./model.js";
|
|
2
|
+
/**
|
|
3
|
+
* Pushes events as they arrive and says when the run's stream ends; returns
|
|
4
|
+
* the unsubscribe. The shape of an observable or an event emitter.
|
|
5
|
+
*/
|
|
6
|
+
export type AgUiSubscribe = (emit: (event: AgUiEvent) => void, done: (error?: unknown) => void) => () => void;
|
|
7
|
+
/**
|
|
8
|
+
* Where a run's events come from: an async iterable (an `@ag-ui/client`
|
|
9
|
+
* agent's stream, an SSE reader, a recorded run) or a subscribe function.
|
|
10
|
+
* The host owns the connection; the hook only reads.
|
|
11
|
+
*/
|
|
12
|
+
export type AgUiEventSource = AsyncIterable<AgUiEvent> | AgUiSubscribe;
|
|
13
|
+
export interface UseAgUiRunOptions {
|
|
14
|
+
/** The conversation so far, from history. Read once, on mount. */
|
|
15
|
+
initialView?: ChatView;
|
|
16
|
+
/** A stream that failed: the hook also folds it into the view as a run error. */
|
|
17
|
+
onError?: (error: unknown) => void;
|
|
18
|
+
}
|
|
19
|
+
export interface AgUiRun {
|
|
20
|
+
view: ChatView;
|
|
21
|
+
/** True from `run` until its stream ends or `stop`. */
|
|
22
|
+
running: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Reads one run's events into the view until the stream ends. Starting a
|
|
25
|
+
* run stops reading the one before. Resolves when the stream ends, is
|
|
26
|
+
* stopped or fails; a failure lands in the view, never as a rejection.
|
|
27
|
+
*/
|
|
28
|
+
run: (source: AgUiEventSource) => Promise<void>;
|
|
29
|
+
/**
|
|
30
|
+
* Stops reading the current run and closes the view as cancelled. Telling
|
|
31
|
+
* the agent to stop is the host's (its own request); this only lets go.
|
|
32
|
+
*/
|
|
33
|
+
stop: () => void;
|
|
34
|
+
/** Folds events the host makes itself: the person's own message before the run starts. */
|
|
35
|
+
dispatch: (events: AgUiEvent | readonly AgUiEvent[]) => void;
|
|
36
|
+
/** Starts over, from nothing or from `view`. Stops reading first. */
|
|
37
|
+
reset: (view?: ChatView) => void;
|
|
38
|
+
}
|
|
39
|
+
/** The person's own message as the events that fold it into the view. */
|
|
40
|
+
export declare function userMessageEvents(id: string, text: string): AgUiEvent[];
|
|
41
|
+
/**
|
|
42
|
+
* Holds a `ChatView` and folds a host-provided AG-UI event source into it,
|
|
43
|
+
* one run at a time. No network code: the host connects, authenticates and
|
|
44
|
+
* sends input, and hands the hook what comes back.
|
|
45
|
+
*
|
|
46
|
+
* const chat = useAgUiRun();
|
|
47
|
+
* onSubmit={(text) => {
|
|
48
|
+
* chat.dispatch(userMessageEvents(id(), text));
|
|
49
|
+
* void chat.run(agent.stream({ threadId, text }));
|
|
50
|
+
* }}
|
|
51
|
+
*/
|
|
52
|
+
export declare function useAgUiRun({ initialView, onError }?: UseAgUiRunOptions): AgUiRun;
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { EventType } from "@ag-ui/core";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { createChatView, foldChat, reduceChat } from "./model.js";
|
|
5
|
+
/** The person's own message as the events that fold it into the view. */
|
|
6
|
+
export function userMessageEvents(id, text) {
|
|
7
|
+
return [
|
|
8
|
+
{ type: EventType.TEXT_MESSAGE_START, messageId: id, role: "user" },
|
|
9
|
+
{ type: EventType.TEXT_MESSAGE_CONTENT, messageId: id, delta: text },
|
|
10
|
+
{ type: EventType.TEXT_MESSAGE_END, messageId: id },
|
|
11
|
+
];
|
|
12
|
+
}
|
|
13
|
+
const message = (error) => error instanceof Error && error.message
|
|
14
|
+
? error.message
|
|
15
|
+
: typeof error === "string" && error
|
|
16
|
+
? error
|
|
17
|
+
: "The event stream failed.";
|
|
18
|
+
/**
|
|
19
|
+
* Holds a `ChatView` and folds a host-provided AG-UI event source into it,
|
|
20
|
+
* one run at a time. No network code: the host connects, authenticates and
|
|
21
|
+
* sends input, and hands the hook what comes back.
|
|
22
|
+
*
|
|
23
|
+
* const chat = useAgUiRun();
|
|
24
|
+
* onSubmit={(text) => {
|
|
25
|
+
* chat.dispatch(userMessageEvents(id(), text));
|
|
26
|
+
* void chat.run(agent.stream({ threadId, text }));
|
|
27
|
+
* }}
|
|
28
|
+
*/
|
|
29
|
+
export function useAgUiRun({ initialView, onError } = {}) {
|
|
30
|
+
const [view, setView] = React.useState(() => initialView ?? createChatView());
|
|
31
|
+
const [running, setRunning] = React.useState(false);
|
|
32
|
+
const current = React.useRef(null);
|
|
33
|
+
const onErrorRef = React.useRef(onError);
|
|
34
|
+
React.useEffect(() => {
|
|
35
|
+
onErrorRef.current = onError;
|
|
36
|
+
});
|
|
37
|
+
const release = React.useCallback(() => {
|
|
38
|
+
const active = current.current;
|
|
39
|
+
current.current = null;
|
|
40
|
+
active?.release();
|
|
41
|
+
}, []);
|
|
42
|
+
React.useEffect(() => release, [release]);
|
|
43
|
+
const run = React.useCallback((source) => {
|
|
44
|
+
release();
|
|
45
|
+
let live = true;
|
|
46
|
+
let cleanup = () => { };
|
|
47
|
+
let stopped = () => { };
|
|
48
|
+
const halted = new Promise((resolve) => {
|
|
49
|
+
stopped = () => resolve("stopped");
|
|
50
|
+
});
|
|
51
|
+
const token = {
|
|
52
|
+
release: () => {
|
|
53
|
+
live = false;
|
|
54
|
+
cleanup();
|
|
55
|
+
stopped();
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
current.current = token;
|
|
59
|
+
setRunning(true);
|
|
60
|
+
const fold = (event) => {
|
|
61
|
+
if (live)
|
|
62
|
+
setView((v) => reduceChat(v, event));
|
|
63
|
+
};
|
|
64
|
+
const end = (error) => {
|
|
65
|
+
if (!live)
|
|
66
|
+
return;
|
|
67
|
+
live = false;
|
|
68
|
+
if (current.current === token)
|
|
69
|
+
current.current = null;
|
|
70
|
+
if (error !== undefined) {
|
|
71
|
+
setView((v) => reduceChat(v, { type: EventType.RUN_ERROR, message: message(error) }));
|
|
72
|
+
onErrorRef.current?.(error);
|
|
73
|
+
}
|
|
74
|
+
setRunning(false);
|
|
75
|
+
};
|
|
76
|
+
if (typeof source === "function") {
|
|
77
|
+
let finished = () => { };
|
|
78
|
+
const ended = new Promise((resolve) => {
|
|
79
|
+
finished = resolve;
|
|
80
|
+
});
|
|
81
|
+
try {
|
|
82
|
+
const unsubscribe = source(fold, (error) => {
|
|
83
|
+
end(error);
|
|
84
|
+
finished();
|
|
85
|
+
});
|
|
86
|
+
if (live)
|
|
87
|
+
cleanup = unsubscribe;
|
|
88
|
+
else
|
|
89
|
+
unsubscribe();
|
|
90
|
+
}
|
|
91
|
+
catch (error) {
|
|
92
|
+
end(error);
|
|
93
|
+
finished();
|
|
94
|
+
}
|
|
95
|
+
return Promise.race([ended, halted]).then(() => { });
|
|
96
|
+
}
|
|
97
|
+
return (async () => {
|
|
98
|
+
try {
|
|
99
|
+
const iterator = source[Symbol.asyncIterator]();
|
|
100
|
+
cleanup = () => void iterator.return?.()?.catch(() => { });
|
|
101
|
+
for (;;) {
|
|
102
|
+
const next = await Promise.race([iterator.next(), halted]);
|
|
103
|
+
if (next === "stopped" || next.done)
|
|
104
|
+
break;
|
|
105
|
+
fold(next.value);
|
|
106
|
+
}
|
|
107
|
+
end();
|
|
108
|
+
}
|
|
109
|
+
catch (error) {
|
|
110
|
+
end(error);
|
|
111
|
+
}
|
|
112
|
+
})();
|
|
113
|
+
}, [release]);
|
|
114
|
+
const stop = React.useCallback(() => {
|
|
115
|
+
if (!current.current)
|
|
116
|
+
return;
|
|
117
|
+
release();
|
|
118
|
+
setRunning(false);
|
|
119
|
+
setView((v) => v.status === "running"
|
|
120
|
+
? reduceChat(v, {
|
|
121
|
+
type: EventType.RUN_FINISHED,
|
|
122
|
+
threadId: v.threadId ?? "",
|
|
123
|
+
runId: v.runId ?? "",
|
|
124
|
+
outcome: { type: "cancelled" },
|
|
125
|
+
})
|
|
126
|
+
: v);
|
|
127
|
+
}, [release]);
|
|
128
|
+
const dispatch = React.useCallback((events) => {
|
|
129
|
+
setView((v) => foldChat(Array.isArray(events) ? events : [events], v));
|
|
130
|
+
}, []);
|
|
131
|
+
const reset = React.useCallback((next) => {
|
|
132
|
+
release();
|
|
133
|
+
setRunning(false);
|
|
134
|
+
setView(next ?? createChatView());
|
|
135
|
+
}, [release]);
|
|
136
|
+
return { view, running, run, stop, dispatch, reset };
|
|
137
|
+
}
|
package/dist/css/appearance.js
CHANGED
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
d.style.setProperty("--radius",
|
|
65
65
|
(c.corners.indexOf(p.corners) > -1 ? p.corners : c.defaults.corners) + "px");
|
|
66
66
|
};
|
|
67
|
-
var products = {"astrolift":{"product":"astrolift","key":"astrolift.appearance","grounds":{"black":{"mode":"dark","background":"#000000"},"charcoal":{"mode":"dark","background":"#0e0f10"},"graphite":{"mode":"dark","background":"#111214"},"emerald":{"mode":"dark","background":"#050b08"},"paper":{"mode":"light","background":"#faf6ee"},"mist":{"mode":"light","background":"#f2f7f9"}},"accents":["green","copper","ice","periwinkle","amber"],"corners":[0,2,4,10],"minContrast":3,"defaults":{"dark":"graphite","light":"mist","accent":"green","density":"compact","corners":2}},"zentinelle":{"product":"zentinelle","key":"zentinelle.appearance","grounds":{"black":{"mode":"dark","background":"#000000"},"charcoal":{"mode":"dark","background":"#0e0f10"},"graphite":{"mode":"dark","background":"#111214"},"paper":{"mode":"light","background":"#faf6ee"},"mist":{"mode":"light","background":"#f2f7f9"}},"accents":["teal","green","copper","ice","periwinkle","amber"],"corners":[0,2,4,10],"minContrast":3,"defaults":{"dark":"black","light":"mist","accent":"teal","density":"compact","corners":2}},"workbench":{"product":"workbench","key":"workbench.appearance","grounds":{"navy":{"mode":"dark","background":"#0b1120"},"black":{"mode":"dark","background":"#000000"},"charcoal":{"mode":"dark","background":"#0e0f10"},"graphite":{"mode":"dark","background":"#111214"},"paper":{"mode":"light","background":"#faf6ee"},"mist":{"mode":"light","background":"#f2f7f9"}},"accents":["workbench-blue","green","copper","ice","periwinkle","amber"],"corners":[0,2,4,10],"minContrast":3,"defaults":{"dark":"navy","light":"mist","accent":"workbench-blue","density":"compact","corners":2}},"chat-studio":{"product":"chat-studio","key":"chat-studio.appearance","grounds":{"black":{"mode":"dark","background":"#000000"},"charcoal":{"mode":"dark","background":"#0e0f10"},"graphite":{"mode":"dark","background":"#111214"},"paper":{"mode":"light","background":"#faf6ee"},"mist":{"mode":"light","background":"#f2f7f9"}},"accents":["studio-blue","green","copper","ice","periwinkle","amber"],"corners":[0,2,4,10],"minContrast":3,"defaults":{"dark":"black","light":"paper","accent":"studio-blue","density":"compact","corners":2}},"loadr":{"product":"loadr","key":"loadr.appearance","grounds":{"black":{"mode":"dark","background":"#000000"},"charcoal":{"mode":"dark","background":"#0e0f10"},"graphite":{"mode":"dark","background":"#111214"},"paper":{"mode":"light","background":"#faf6ee"},"mist":{"mode":"light","background":"#f2f7f9"}},"accents":["loadr-blue","green","copper","ice","periwinkle","amber"],"corners":[0,2,4,10],"minContrast":3,"defaults":{"dark":"charcoal","light":"paper","accent":"loadr-blue","density":"compact","corners":2}},"cykick":{"product":"cykick","key":"cykick.appearance","grounds":{"black":{"mode":"dark","background":"#000000"},"charcoal":{"mode":"dark","background":"#0e0f10"},"graphite":{"mode":"dark","background":"#111214"},"paper":{"mode":"light","background":"#faf6ee"},"mist":{"mode":"light","background":"#f2f7f9"}},"accents":["cykick-cyan","green","copper","ice","periwinkle","amber"],"corners":[0,2,4,10],"minContrast":3,"defaults":{"dark":"black","light":"mist","accent":"cykick-cyan","density":"compact","corners":0}}};
|
|
67
|
+
var products = {"astrolift":{"product":"astrolift","key":"astrolift.appearance","grounds":{"black":{"mode":"dark","background":"#000000"},"charcoal":{"mode":"dark","background":"#0e0f10"},"graphite":{"mode":"dark","background":"#111214"},"emerald":{"mode":"dark","background":"#050b08"},"paper":{"mode":"light","background":"#faf6ee"},"mist":{"mode":"light","background":"#f2f7f9"}},"accents":["green","copper","ice","periwinkle","amber"],"corners":[0,2,4,10],"minContrast":3,"defaults":{"dark":"graphite","light":"mist","accent":"green","density":"compact","corners":2}},"zentinelle":{"product":"zentinelle","key":"zentinelle.appearance","grounds":{"black":{"mode":"dark","background":"#000000"},"charcoal":{"mode":"dark","background":"#0e0f10"},"graphite":{"mode":"dark","background":"#111214"},"paper":{"mode":"light","background":"#faf6ee"},"mist":{"mode":"light","background":"#f2f7f9"}},"accents":["teal","green","copper","ice","periwinkle","amber"],"corners":[0,2,4,10],"minContrast":3,"defaults":{"dark":"black","light":"mist","accent":"teal","density":"compact","corners":2}},"workbench":{"product":"workbench","key":"workbench.appearance","grounds":{"navy":{"mode":"dark","background":"#0b1120"},"black":{"mode":"dark","background":"#000000"},"charcoal":{"mode":"dark","background":"#0e0f10"},"graphite":{"mode":"dark","background":"#111214"},"paper":{"mode":"light","background":"#faf6ee"},"mist":{"mode":"light","background":"#f2f7f9"}},"accents":["workbench-blue","green","copper","ice","periwinkle","amber"],"corners":[0,2,4,10],"minContrast":3,"defaults":{"dark":"navy","light":"mist","accent":"workbench-blue","density":"compact","corners":2}},"chat-studio":{"product":"chat-studio","key":"chat-studio.appearance","grounds":{"black":{"mode":"dark","background":"#000000"},"charcoal":{"mode":"dark","background":"#0e0f10"},"graphite":{"mode":"dark","background":"#111214"},"paper":{"mode":"light","background":"#faf6ee"},"mist":{"mode":"light","background":"#f2f7f9"}},"accents":["studio-blue","green","copper","ice","periwinkle","amber"],"corners":[0,2,4,10],"minContrast":3,"defaults":{"dark":"black","light":"paper","accent":"studio-blue","density":"compact","corners":2}},"loadr":{"product":"loadr","key":"loadr.appearance","grounds":{"black":{"mode":"dark","background":"#000000"},"charcoal":{"mode":"dark","background":"#0e0f10"},"graphite":{"mode":"dark","background":"#111214"},"paper":{"mode":"light","background":"#faf6ee"},"mist":{"mode":"light","background":"#f2f7f9"}},"accents":["loadr-blue","green","copper","ice","periwinkle","amber"],"corners":[0,2,4,10],"minContrast":3,"defaults":{"dark":"charcoal","light":"paper","accent":"loadr-blue","density":"compact","corners":2}},"cykick":{"product":"cykick","key":"cykick.appearance","grounds":{"black":{"mode":"dark","background":"#000000"},"charcoal":{"mode":"dark","background":"#0e0f10"},"graphite":{"mode":"dark","background":"#111214"},"paper":{"mode":"light","background":"#faf6ee"},"mist":{"mode":"light","background":"#f2f7f9"}},"accents":["cykick-cyan","green","copper","ice","periwinkle","amber"],"corners":[0,2,4,10],"minContrast":3,"defaults":{"dark":"black","light":"mist","accent":"cykick-cyan","density":"compact","corners":0}},"deep-data-agent":{"product":"deep-data-agent","key":"deep-data-agent.appearance","grounds":{"charcoal":{"mode":"dark","background":"#0e0f10"},"black":{"mode":"dark","background":"#000000"},"graphite":{"mode":"dark","background":"#111214"},"paper":{"mode":"light","background":"#faf6ee"},"mist":{"mode":"light","background":"#f2f7f9"}},"accents":["green","copper","ice","periwinkle","amber"],"corners":[0,2,4,10],"minContrast":3,"defaults":{"dark":"charcoal","light":"mist","accent":"amber","density":"compact","corners":2}}};
|
|
68
68
|
var d = document.documentElement;
|
|
69
69
|
var hex = /^#[0-9a-f]{6}$/;
|
|
70
70
|
var has = function (o, k) {
|
package/dist/css/calliope.css
CHANGED
package/dist/css/tokens.css
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export { cn } from "./lib/cn.js";
|
|
|
8
8
|
export { ACCENTS, ACCENT_KEYS, DENSITIES, DENSITY_KEYS, GROUNDS, GROUND_KEYS, MODE_TOKENS, SURFACES, type AccentSpec, type Density, type FamilyAccent, type Ground, type Mode, type StatusName, } from "./theme/tokens.js";
|
|
9
9
|
export { MIN_NON_TEXT_CONTRAST, MIN_TEXT_CONTRAST, contrastRatio, luminance, } from "./theme/contrast.js";
|
|
10
10
|
export { CORNERS, defineProduct, type BrandAccent, type Corners, type Product, type ProductAccent, type ProductConfig, type ProductTheme, } from "./appearance/product.js";
|
|
11
|
-
export { astroliftBrand, chatStudioBrand, cykickBrand, loadrBrand, workbenchBrand, zentinelleBrand, } from "./appearance/brands.js";
|
|
11
|
+
export { astroliftBrand, chatStudioBrand, cykickBrand, deepDataAgentBrand, loadrBrand, workbenchBrand, zentinelleBrand, } from "./appearance/brands.js";
|
|
12
12
|
export { accentContrast, appearanceFromServer, applyAppearance, clearAppearance, inkFor, isCustomAccent, modeFor, normalize, normalizePartial, parseCustomAccent, readAppearance, resolveAppearance, writeAppearance, type Appearance, type CustomAccent, type OrgAppearancePolicy, type ResolvedAppearance, } from "./appearance/appearance.js";
|
|
13
13
|
export { appearanceScript, bootConfig, productStyles, type BootConfig } from "./appearance/boot.js";
|
|
14
14
|
export { BRAND_ACCENT_KEY, brandStyleVars, brandStyles, htmlAttributes, resolveRuntimeBrand, withBrand, type ResolvedRuntimeBrand, type RuntimeBrand, } from "./appearance/runtime-brand.js";
|
|
@@ -62,6 +62,11 @@ export { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMe
|
|
|
62
62
|
export { Popover, PopoverAnchor, PopoverContent, PopoverHeader, PopoverTrigger, } from "./primitives/Popover.js";
|
|
63
63
|
export { Tabs, TabsContent, TabsList, TabsTrigger } from "./primitives/Tabs.js";
|
|
64
64
|
export { Skeleton } from "./primitives/Skeleton.js";
|
|
65
|
+
export { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "./primitives/Tooltip.js";
|
|
66
|
+
export { ContextMenu, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuSeparator, ContextMenuShortcut, ContextMenuTrigger, } from "./primitives/ContextMenu.js";
|
|
67
|
+
export { ScrollArea, type ScrollAreaProps } from "./primitives/ScrollArea.js";
|
|
68
|
+
export { Badge, badgeVariants, type BadgeProps } from "./primitives/Badge.js";
|
|
69
|
+
export { ToastProvider, useToast, type ToastApi, type ToastOptions, type ToastProviderProps, } from "./primitives/Toast.js";
|
|
65
70
|
export type { WorkflowAction, WorkflowAvailability, WorkflowModule, WorkflowPermissions, WorkflowScope, WorkflowStatus, WorkflowSummary, } from "./workflow/model.js";
|
|
66
71
|
export { WorkflowCard, WorkflowCardSkeleton, type WorkflowCardActions, type WorkflowCardProps, } from "./workflow/WorkflowCard.js";
|
|
67
72
|
export { WorkflowQuestionCard, type WorkflowQuestionCardProps, } from "./workflow/WorkflowQuestionCard.js";
|
|
@@ -90,3 +95,12 @@ export { documentStatus, type WorkflowDocumentStatus, type WorkflowRevision, } f
|
|
|
90
95
|
export { WorkflowDiff, type WorkflowDiffProps } from "./workflow/editor/WorkflowDiff.js";
|
|
91
96
|
export { WorkflowImportPreview, type WorkflowImportPreviewProps, } from "./workflow/editor/WorkflowImportPreview.js";
|
|
92
97
|
export { WorkflowWorkspace, type WorkflowWorkspaceProps, } from "./workflow/editor/WorkflowWorkspace.js";
|
|
98
|
+
export { contentText, createChatView, foldChat, isChatRunning, parseToolCallArgs, reduceChat, type AgUiEvent, type AgUiInterrupt, type ChatApproval, type ChatMessage, type ChatRole, type ChatRunStatus, type ChatStep, type ChatStepStatus, type ChatTimelineItem, type ChatToolCall, type ChatToolCallStatus, type ChatView, } from "./chat/model.js";
|
|
99
|
+
export { applyJsonPatch } from "./chat/patch.js";
|
|
100
|
+
export { MessageBubble, type ChatContentRenderer, type MessageBubbleProps, } from "./chat/MessageBubble.js";
|
|
101
|
+
export { MessageList, type MessageListProps } from "./chat/MessageList.js";
|
|
102
|
+
export { Composer, type ComposerProps } from "./chat/Composer.js";
|
|
103
|
+
export { ToolCallCard, type ToolCallCardProps } from "./chat/ToolCallCard.js";
|
|
104
|
+
export { AgentProgress, CHAT_RUN_TONE, chatStepStages, type AgentProgressProps, } from "./chat/AgentProgress.js";
|
|
105
|
+
export { ModelPicker, type ModelPickerProps } from "./chat/ModelPicker.js";
|
|
106
|
+
export { useAgUiRun, userMessageEvents, type AgUiEventSource, type AgUiRun, type AgUiSubscribe, type UseAgUiRunOptions, } from "./chat/useAgUiRun.js";
|
package/dist/index.js
CHANGED
|
@@ -11,7 +11,7 @@ export { ACCENTS, ACCENT_KEYS, DENSITIES, DENSITY_KEYS, GROUNDS, GROUND_KEYS, MO
|
|
|
11
11
|
export { MIN_NON_TEXT_CONTRAST, MIN_TEXT_CONTRAST, contrastRatio, luminance, } from "./theme/contrast.js";
|
|
12
12
|
// Product and appearance
|
|
13
13
|
export { CORNERS, defineProduct, } from "./appearance/product.js";
|
|
14
|
-
export { astroliftBrand, chatStudioBrand, cykickBrand, loadrBrand, workbenchBrand, zentinelleBrand, } from "./appearance/brands.js";
|
|
14
|
+
export { astroliftBrand, chatStudioBrand, cykickBrand, deepDataAgentBrand, loadrBrand, workbenchBrand, zentinelleBrand, } from "./appearance/brands.js";
|
|
15
15
|
export { accentContrast, appearanceFromServer, applyAppearance, clearAppearance, inkFor, isCustomAccent, modeFor, normalize, normalizePartial, parseCustomAccent, readAppearance, resolveAppearance, writeAppearance, } from "./appearance/appearance.js";
|
|
16
16
|
export { appearanceScript, bootConfig, productStyles } from "./appearance/boot.js";
|
|
17
17
|
export { BRAND_ACCENT_KEY, brandStyleVars, brandStyles, htmlAttributes, resolveRuntimeBrand, withBrand, } from "./appearance/runtime-brand.js";
|
|
@@ -73,6 +73,11 @@ export { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMe
|
|
|
73
73
|
export { Popover, PopoverAnchor, PopoverContent, PopoverHeader, PopoverTrigger, } from "./primitives/Popover.js";
|
|
74
74
|
export { Tabs, TabsContent, TabsList, TabsTrigger } from "./primitives/Tabs.js";
|
|
75
75
|
export { Skeleton } from "./primitives/Skeleton.js";
|
|
76
|
+
export { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "./primitives/Tooltip.js";
|
|
77
|
+
export { ContextMenu, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuSeparator, ContextMenuShortcut, ContextMenuTrigger, } from "./primitives/ContextMenu.js";
|
|
78
|
+
export { ScrollArea } from "./primitives/ScrollArea.js";
|
|
79
|
+
export { Badge, badgeVariants } from "./primitives/Badge.js";
|
|
80
|
+
export { ToastProvider, useToast, } from "./primitives/Toast.js";
|
|
76
81
|
export { WorkflowCard, WorkflowCardSkeleton, } from "./workflow/WorkflowCard.js";
|
|
77
82
|
export { WorkflowQuestionCard, } from "./workflow/WorkflowQuestionCard.js";
|
|
78
83
|
export { ANY_FILTER, DEFAULT_WORKFLOW_FILTERS, filterWorkflows, isFiltered, } from "./workflow/gallery.js";
|
|
@@ -99,3 +104,13 @@ export { documentStatus, } from "./workflow/workspace.js";
|
|
|
99
104
|
export { WorkflowDiff } from "./workflow/editor/WorkflowDiff.js";
|
|
100
105
|
export { WorkflowImportPreview, } from "./workflow/editor/WorkflowImportPreview.js";
|
|
101
106
|
export { WorkflowWorkspace, } from "./workflow/editor/WorkflowWorkspace.js";
|
|
107
|
+
// Chat (AG-UI)
|
|
108
|
+
export { contentText, createChatView, foldChat, isChatRunning, parseToolCallArgs, reduceChat, } from "./chat/model.js";
|
|
109
|
+
export { applyJsonPatch } from "./chat/patch.js";
|
|
110
|
+
export { MessageBubble, } from "./chat/MessageBubble.js";
|
|
111
|
+
export { MessageList } from "./chat/MessageList.js";
|
|
112
|
+
export { Composer } from "./chat/Composer.js";
|
|
113
|
+
export { ToolCallCard } from "./chat/ToolCallCard.js";
|
|
114
|
+
export { AgentProgress, CHAT_RUN_TONE, chatStepStages, } from "./chat/AgentProgress.js";
|
|
115
|
+
export { ModelPicker } from "./chat/ModelPicker.js";
|
|
116
|
+
export { useAgUiRun, userMessageEvents, } from "./chat/useAgUiRun.js";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type VariantProps } from "class-variance-authority";
|
|
2
|
+
import type * as React from "react";
|
|
3
|
+
export declare const badgeVariants: (props?: ({
|
|
4
|
+
variant?: "neutral" | "outline" | "primary" | null | undefined;
|
|
5
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
6
|
+
export interface BadgeProps extends React.ComponentProps<"span">, VariantProps<typeof badgeVariants> {
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* A small count or label. Not a status: a state with a meaning (running,
|
|
10
|
+
* failed) is a StatusBadge, whose colours never follow the accent. A badge
|
|
11
|
+
* that is only a number needs words for a screen reader, so give it an
|
|
12
|
+
* `aria-label` ("3 unread") or put the noun beside it.
|
|
13
|
+
*/
|
|
14
|
+
export declare function Badge({ className, variant, ...props }: BadgeProps): React.JSX.Element;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cva } from "class-variance-authority";
|
|
3
|
+
import { cn } from "../lib/cn.js";
|
|
4
|
+
export const badgeVariants = cva("inline-flex h-5 w-fit min-w-5 shrink-0 items-center justify-center gap-1 overflow-hidden rounded-full border px-1.5 text-xs font-medium whitespace-nowrap tabular-nums [&>svg]:pointer-events-none [&>svg]:size-3", {
|
|
5
|
+
variants: {
|
|
6
|
+
variant: {
|
|
7
|
+
/** Quiet: a count beside a label, a kind ("folder", "beta"). */
|
|
8
|
+
neutral: "border-transparent bg-secondary text-secondary-foreground",
|
|
9
|
+
/** The accent: a new count that wants attention. */
|
|
10
|
+
primary: "border-transparent bg-primary text-primary-foreground",
|
|
11
|
+
/** A hairline only, for dense rows. */
|
|
12
|
+
outline: "border-border bg-transparent text-muted-foreground",
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
defaultVariants: { variant: "neutral" },
|
|
16
|
+
});
|
|
17
|
+
/**
|
|
18
|
+
* A small count or label. Not a status: a state with a meaning (running,
|
|
19
|
+
* failed) is a StatusBadge, whose colours never follow the accent. A badge
|
|
20
|
+
* that is only a number needs words for a screen reader, so give it an
|
|
21
|
+
* `aria-label` ("3 unread") or put the noun beside it.
|
|
22
|
+
*/
|
|
23
|
+
export function Badge({ className, variant, ...props }) {
|
|
24
|
+
return (_jsx("span", { "data-slot": "badge", "data-variant": variant ?? "neutral", className: cn(badgeVariants({ variant }), className), ...props }));
|
|
25
|
+
}
|
|
@@ -6,7 +6,7 @@ import type * as React from "react";
|
|
|
6
6
|
* reaches buttons as it reaches panels.
|
|
7
7
|
*/
|
|
8
8
|
export declare const buttonVariants: (props?: ({
|
|
9
|
-
variant?: "link" | "default" | "outline" | "secondary" | "ghost" |
|
|
9
|
+
variant?: "destructive" | "link" | "default" | "outline" | "secondary" | "ghost" | null | undefined;
|
|
10
10
|
size?: "default" | "xs" | "sm" | "lg" | "icon" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined;
|
|
11
11
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
12
12
|
export interface ButtonProps extends React.ComponentProps<"button">, VariantProps<typeof buttonVariants> {
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ContextMenu as ContextMenuPrimitive } from "radix-ui";
|
|
2
|
+
import type * as React from "react";
|
|
3
|
+
/**
|
|
4
|
+
* The right-click (and Shift+F10, and the context-menu key) menu. Every
|
|
5
|
+
* action in it must also be reachable another way: a toolbar button, a row
|
|
6
|
+
* menu or a shortcut, since touch and many keyboard users never open it.
|
|
7
|
+
*/
|
|
8
|
+
export declare function ContextMenu(props: React.ComponentProps<typeof ContextMenuPrimitive.Root>): React.JSX.Element;
|
|
9
|
+
export declare function ContextMenuTrigger(props: React.ComponentProps<typeof ContextMenuPrimitive.Trigger>): React.JSX.Element;
|
|
10
|
+
export declare function ContextMenuContent({ className, ...props }: React.ComponentProps<typeof ContextMenuPrimitive.Content>): React.JSX.Element;
|
|
11
|
+
export declare function ContextMenuGroup(props: React.ComponentProps<typeof ContextMenuPrimitive.Group>): React.JSX.Element;
|
|
12
|
+
export declare function ContextMenuItem({ className, variant, ...props }: React.ComponentProps<typeof ContextMenuPrimitive.Item> & {
|
|
13
|
+
variant?: "default" | "destructive";
|
|
14
|
+
}): React.JSX.Element;
|
|
15
|
+
export declare function ContextMenuLabel({ className, ...props }: React.ComponentProps<typeof ContextMenuPrimitive.Label>): React.JSX.Element;
|
|
16
|
+
export declare function ContextMenuSeparator({ className, ...props }: React.ComponentProps<typeof ContextMenuPrimitive.Separator>): React.JSX.Element;
|
|
17
|
+
/** The item's keyboard shortcut, right-aligned. Decorative: the shortcut itself is the app's. */
|
|
18
|
+
export declare function ContextMenuShortcut({ className, ...props }: React.ComponentProps<"span">): React.JSX.Element;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { ContextMenu as ContextMenuPrimitive } from "radix-ui";
|
|
4
|
+
import { cn } from "../lib/cn.js";
|
|
5
|
+
/**
|
|
6
|
+
* The right-click (and Shift+F10, and the context-menu key) menu. Every
|
|
7
|
+
* action in it must also be reachable another way: a toolbar button, a row
|
|
8
|
+
* menu or a shortcut, since touch and many keyboard users never open it.
|
|
9
|
+
*/
|
|
10
|
+
export function ContextMenu(props) {
|
|
11
|
+
return _jsx(ContextMenuPrimitive.Root, { "data-slot": "context-menu", ...props });
|
|
12
|
+
}
|
|
13
|
+
export function ContextMenuTrigger(props) {
|
|
14
|
+
return _jsx(ContextMenuPrimitive.Trigger, { "data-slot": "context-menu-trigger", ...props });
|
|
15
|
+
}
|
|
16
|
+
export function ContextMenuContent({ className, ...props }) {
|
|
17
|
+
return (_jsx(ContextMenuPrimitive.Portal, { children: _jsx(ContextMenuPrimitive.Content, { "data-slot": "context-menu-content", className: cn("z-50 max-h-(--radix-context-menu-content-available-height) min-w-40 origin-(--radix-context-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 data-[state=open]:animate-cui-fade-in", className), ...props }) }));
|
|
18
|
+
}
|
|
19
|
+
export function ContextMenuGroup(props) {
|
|
20
|
+
return _jsx(ContextMenuPrimitive.Group, { "data-slot": "context-menu-group", ...props });
|
|
21
|
+
}
|
|
22
|
+
export function ContextMenuItem({ className, variant = "default", ...props }) {
|
|
23
|
+
return (_jsx(ContextMenuPrimitive.Item, { "data-slot": "context-menu-item", "data-variant": variant, className: cn("relative flex cursor-default items-center gap-1.5 rounded-lg px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 data-[variant=destructive]:text-danger-fg data-[variant=destructive]:focus:bg-danger/10 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className), ...props }));
|
|
24
|
+
}
|
|
25
|
+
export function ContextMenuLabel({ className, ...props }) {
|
|
26
|
+
return (_jsx(ContextMenuPrimitive.Label, { "data-slot": "context-menu-label", className: cn("px-1.5 py-1 text-xs font-medium text-muted-foreground", className), ...props }));
|
|
27
|
+
}
|
|
28
|
+
export function ContextMenuSeparator({ className, ...props }) {
|
|
29
|
+
return (_jsx(ContextMenuPrimitive.Separator, { "data-slot": "context-menu-separator", className: cn("-mx-1 my-1 h-px bg-border", className), ...props }));
|
|
30
|
+
}
|
|
31
|
+
/** The item's keyboard shortcut, right-aligned. Decorative: the shortcut itself is the app's. */
|
|
32
|
+
export function ContextMenuShortcut({ className, ...props }) {
|
|
33
|
+
return (_jsx("span", { "data-slot": "context-menu-shortcut", "aria-hidden": true, className: cn("ml-auto pl-4 font-mono text-xs text-muted-foreground", className), ...props }));
|
|
34
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ScrollArea as ScrollAreaPrimitive } from "radix-ui";
|
|
2
|
+
import type * as React from "react";
|
|
3
|
+
export interface ScrollAreaProps extends React.ComponentProps<typeof ScrollAreaPrimitive.Root> {
|
|
4
|
+
/**
|
|
5
|
+
* Names the scrolling region. Given, the viewport is a focusable region so
|
|
6
|
+
* a keyboard can scroll it; leave it out when the content has its own
|
|
7
|
+
* focusable items (a list of links, a tree).
|
|
8
|
+
*/
|
|
9
|
+
label?: string;
|
|
10
|
+
/** Which bars to draw. Defaults to vertical. */
|
|
11
|
+
orientation?: "vertical" | "horizontal" | "both";
|
|
12
|
+
viewportClassName?: string;
|
|
13
|
+
}
|
|
14
|
+
/** A scrolling box with thin, token-coloured bars that look the same on every platform. */
|
|
15
|
+
export declare function ScrollArea({ className, viewportClassName, children, label, orientation, ...props }: ScrollAreaProps): React.JSX.Element;
|
|
16
|
+
export declare function ScrollBar({ className, orientation, ...props }: React.ComponentProps<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>): React.JSX.Element;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { ScrollArea as ScrollAreaPrimitive } from "radix-ui";
|
|
4
|
+
import { cn } from "../lib/cn.js";
|
|
5
|
+
/** A scrolling box with thin, token-coloured bars that look the same on every platform. */
|
|
6
|
+
export function ScrollArea({ className, viewportClassName, children, label, orientation = "vertical", ...props }) {
|
|
7
|
+
return (_jsxs(ScrollAreaPrimitive.Root, { "data-slot": "scroll-area", className: cn("relative overflow-hidden", className), ...props, children: [_jsx(ScrollAreaPrimitive.Viewport, { "data-slot": "scroll-area-viewport", className: cn("size-full rounded-[inherit] outline-none focus-visible:ring-2 focus-visible:ring-ring/50", viewportClassName), ...(label ? { role: "region", "aria-label": label, tabIndex: 0 } : {}), children: children }), orientation !== "horizontal" && _jsx(ScrollBar, { orientation: "vertical" }), orientation !== "vertical" && _jsx(ScrollBar, { orientation: "horizontal" }), _jsx(ScrollAreaPrimitive.Corner, {})] }));
|
|
8
|
+
}
|
|
9
|
+
export function ScrollBar({ className, orientation = "vertical", ...props }) {
|
|
10
|
+
return (_jsx(ScrollAreaPrimitive.ScrollAreaScrollbar, { "data-slot": "scroll-area-scrollbar", orientation: orientation, className: cn("flex touch-none p-px transition-colors select-none", orientation === "vertical" && "h-full w-2 border-l border-l-transparent", orientation === "horizontal" && "h-2 flex-col border-t border-t-transparent", className), ...props, children: _jsx(ScrollAreaPrimitive.ScrollAreaThumb, { "data-slot": "scroll-area-thumb", className: "relative flex-1 rounded-full bg-border hover:bg-muted-foreground/60" }) }));
|
|
11
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { StatusTone } from "../status/tones.js";
|
|
3
|
+
export interface ToastOptions {
|
|
4
|
+
/** Replaces the toast with the same id (an upload's progress, then its result). */
|
|
5
|
+
id?: string;
|
|
6
|
+
title: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
/** A status tone for the dot beside the title. `error` toasts are announced assertively. */
|
|
9
|
+
tone?: StatusTone;
|
|
10
|
+
/** One follow-up action ("Undo", "View"). `altText` says how to reach it without the toast. */
|
|
11
|
+
action?: {
|
|
12
|
+
label: string;
|
|
13
|
+
altText: string;
|
|
14
|
+
onClick: () => void;
|
|
15
|
+
};
|
|
16
|
+
/** Milliseconds before it closes itself. Defaults to the provider's (5s); `Infinity` keeps it. */
|
|
17
|
+
duration?: number;
|
|
18
|
+
}
|
|
19
|
+
export interface ToastApi {
|
|
20
|
+
/** Shows a toast and returns its id. */
|
|
21
|
+
toast: (options: ToastOptions) => string;
|
|
22
|
+
dismiss: (id: string) => void;
|
|
23
|
+
}
|
|
24
|
+
export interface ToastProviderProps {
|
|
25
|
+
children: React.ReactNode;
|
|
26
|
+
/** Defaults to 5000. */
|
|
27
|
+
duration?: number;
|
|
28
|
+
className?: string;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Transient notices, bottom right, on Radix Toast: they pause on hover and
|
|
32
|
+
* focus, F8 jumps to them, and swiping or Escape closes one. Wrap the app
|
|
33
|
+
* once and call `useToast().toast(...)` anywhere under it.
|
|
34
|
+
*/
|
|
35
|
+
export declare function ToastProvider({ children, duration, className }: ToastProviderProps): React.JSX.Element;
|
|
36
|
+
/** The toast API of the nearest ToastProvider. Throws outside one, so a missing provider is loud. */
|
|
37
|
+
export declare function useToast(): ToastApi;
|