@ctrl-ui/react 0.8.18 → 0.8.20
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 +7 -0
- package/dist/action-bar.js +2 -2
- package/dist/audio-device-select.js +5 -2
- package/dist/blocks/coding-agent.js +22 -12
- package/dist/blocks/design-canvas-inspector.js +6 -3
- package/dist/blocks/design-canvas.js +20 -10
- package/dist/blocks/discussion-markdown-input.d.ts +14 -0
- package/dist/blocks/discussion-markdown-input.js +36 -0
- package/dist/blocks/discussion.d.ts +9 -3
- package/dist/blocks/discussion.js +82 -16
- package/dist/blocks/file-explorer.js +46 -24
- package/dist/blocks/settings.js +10 -6
- package/dist/chat-composer-editor/extensions/mention.d.ts +1 -1
- package/dist/chat-message.d.ts +13 -0
- package/dist/chat-message.js +198 -3
- package/dist/filter-bar/editor.js +5 -2
- package/dist/knob-contracts/flow-knobs.d.ts +4 -0
- package/dist/knob-contracts/flow-knobs.js +32 -0
- package/dist/knob-contracts/item-knobs.d.ts +1 -1
- package/dist/knob-contracts/item-knobs.js +4 -1
- package/dist/knob-contracts/label-knobs.d.ts +4 -0
- package/dist/knob-contracts/label-knobs.js +4 -0
- package/dist/knob-contracts/markdown-editor-knobs.d.ts +4 -0
- package/dist/knob-contracts/markdown-editor-knobs.js +17 -0
- package/dist/knob-contracts/morphing-panel-knobs.d.ts +1 -1
- package/dist/knob-contracts/morphing-panel-knobs.js +2 -1
- package/dist/knob-contracts/resize-handle-knobs.d.ts +4 -0
- package/dist/knob-contracts/resize-handle-knobs.js +12 -0
- package/dist/knob-contracts/sidebar-knobs.d.ts +1 -1
- package/dist/knob-contracts/sidebar-knobs.js +10 -0
- package/dist/knob-contracts/switch-knobs.d.ts +1 -1
- package/dist/knob-contracts/switch-knobs.js +1 -0
- package/dist/lib/canvas-grid.d.ts +4 -0
- package/dist/lib/canvas-grid.js +5 -0
- package/dist/markdown-editor/context.d.ts +22 -0
- package/dist/markdown-editor/context.js +10 -0
- package/dist/markdown-editor/drag-handle.d.ts +6 -0
- package/dist/markdown-editor/drag-handle.js +126 -0
- package/dist/markdown-editor/extensions.d.ts +10 -0
- package/dist/markdown-editor/extensions.js +139 -0
- package/dist/markdown-editor/suggestions.d.ts +12 -0
- package/dist/markdown-editor/suggestions.js +235 -0
- package/dist/markdown-editor/toolbar.d.ts +9 -0
- package/dist/markdown-editor/toolbar.js +339 -0
- package/dist/markdown-editor/uploads.d.ts +23 -0
- package/dist/markdown-editor/uploads.js +32 -0
- package/dist/markdown-editor/use-image-uploads.d.ts +12 -0
- package/dist/markdown-editor/use-image-uploads.js +120 -0
- package/dist/markdown-editor.d.ts +27 -0
- package/dist/markdown-editor.js +202 -0
- package/dist/styles/index.css +9 -4
- package/dist/styles/recipes/chat-message-edit.css +105 -0
- package/dist/styles/recipes/code.css +4 -0
- package/dist/styles/recipes/field.css +1 -1
- package/dist/styles/recipes/flow.css +304 -0
- package/dist/styles/recipes/infinite-canvas.css +1 -1
- package/dist/styles/recipes/item.css +39 -2
- package/dist/styles/recipes/label.css +19 -0
- package/dist/styles/recipes/markdown-editor.css +234 -0
- package/dist/styles/recipes/morphing-panel.css +53 -12
- package/dist/styles/recipes/page-layout.css +11 -1
- package/dist/styles/recipes/resize-handle.css +126 -0
- package/dist/styles/recipes/sidebar-mobile.css +171 -0
- package/dist/styles/recipes/switch.css +17 -5
- package/dist/styles/recipes/toolbar.css +8 -1
- package/dist/styles/theme.css +1 -0
- package/dist/ui/autocomplete.js +1 -1
- package/dist/ui/code.js +1 -0
- package/dist/ui/color-picker.js +1 -1
- package/dist/ui/combobox.d.ts +1 -1
- package/dist/ui/combobox.js +1 -1
- package/dist/ui/dockable-panel.js +1 -1
- package/dist/ui/flow.d.ts +51 -0
- package/dist/ui/flow.js +153 -0
- package/dist/ui/infinite-canvas.js +3 -3
- package/dist/ui/item.d.ts +5 -3
- package/dist/ui/item.js +2 -1
- package/dist/ui/label.d.ts +8 -0
- package/dist/ui/label.js +14 -0
- package/dist/ui/markdown.d.ts +2 -1
- package/dist/ui/markdown.js +3 -3
- package/dist/ui/morphing-panel.d.ts +21 -4
- package/dist/ui/morphing-panel.js +152 -36
- package/dist/ui/resize-handle.d.ts +11 -0
- package/dist/ui/resize-handle.js +26 -0
- package/dist/ui/sidebar-mobile.d.ts +17 -0
- package/dist/ui/sidebar-mobile.js +70 -0
- package/dist/ui/sidebar-provider.d.ts +1 -0
- package/dist/ui/sidebar-provider.js +3 -0
- package/dist/ui/sidebar.d.ts +3 -1
- package/dist/ui/sidebar.js +101 -49
- package/dist/ui/toolbar.d.ts +3 -1
- package/dist/ui/toolbar.js +2 -1
- package/dist/ui/typography.d.ts +47 -0
- package/dist/ui/typography.js +61 -0
- package/dist/ui/use-switch-drag.js +1 -1
- package/package.json +41 -1
- package/dist/environment-variables.d.ts +0 -125
- package/dist/environment-variables.js +0 -512
- package/dist/hooks/use-environment-variables.d.ts +0 -50
- package/dist/hooks/use-environment-variables.js +0 -188
- package/dist/knob-contracts/environment-variables-knobs.d.ts +0 -4
- package/dist/knob-contracts/environment-variables-knobs.js +0 -12
- package/dist/lib/env-file.d.ts +0 -27
- package/dist/lib/env-file.js +0 -218
- package/dist/styles/recipes/environment-variables.css +0 -170
package/dist/blocks/settings.js
CHANGED
|
@@ -3,12 +3,13 @@ import { cn } from "../lib/cn.js";
|
|
|
3
3
|
import { Button } from "../ui/button.js";
|
|
4
4
|
import { LiveStatus } from "../ui/live-status.js";
|
|
5
5
|
import { ScrollArea } from "../ui/scroll-area.js";
|
|
6
|
+
import { Heading, Text } from "../ui/typography.js";
|
|
6
7
|
import { prefersReducedMotion } from "../lib/motion.js";
|
|
7
|
-
import { InputGroup, InputGroupAddon } from "../ui/input-group.js";
|
|
8
|
-
import { Input } from "../ui/input.js";
|
|
9
8
|
import { SidebarProvider, useSidebar } from "../ui/sidebar-provider.js";
|
|
10
9
|
import { SidebarGroup, SidebarGroupLabel, SidebarMenu, SidebarMenuButton, SidebarMenuItem } from "../ui/sidebar-menu.js";
|
|
11
10
|
import { Sidebar, SidebarContent, SidebarHeader, SidebarInset, SidebarTrigger } from "../ui/sidebar.js";
|
|
11
|
+
import { InputGroup, InputGroupAddon } from "../ui/input-group.js";
|
|
12
|
+
import { Input } from "../ui/input.js";
|
|
12
13
|
import { Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle } from "../ui/empty.js";
|
|
13
14
|
import { searchSettings } from "./settings-data.js";
|
|
14
15
|
import { Field, FieldContent, FieldDescription, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet } from "../ui/field.js";
|
|
@@ -118,8 +119,10 @@ function SettingsShell({ pages, currentPage, query, results, backAction, searchP
|
|
|
118
119
|
className: "h-full min-h-0 min-w-0",
|
|
119
120
|
children: [/* @__PURE__ */ jsxs("header", {
|
|
120
121
|
className: "flex h-12 shrink-0 items-center gap-2 border-b px-3 lg:hidden",
|
|
121
|
-
children: [/* @__PURE__ */ jsx(SidebarTrigger, {}), /* @__PURE__ */ jsx(
|
|
122
|
-
|
|
122
|
+
children: [/* @__PURE__ */ jsx(SidebarTrigger, {}), /* @__PURE__ */ jsx(Text, {
|
|
123
|
+
size: "label",
|
|
124
|
+
weight: "medium",
|
|
125
|
+
className: "truncate",
|
|
123
126
|
title: currentPage?.title,
|
|
124
127
|
children: currentPage?.title ?? "Settings"
|
|
125
128
|
})]
|
|
@@ -212,8 +215,9 @@ function SettingsPage({ page, instanceId }) {
|
|
|
212
215
|
const { layout } = useSidebar();
|
|
213
216
|
return /* @__PURE__ */ jsxs("div", {
|
|
214
217
|
className: "mx-auto flex w-full max-w-4xl flex-col gap-10 px-5 py-8 md:px-10 md:py-12",
|
|
215
|
-
children: [/* @__PURE__ */ jsx(
|
|
216
|
-
|
|
218
|
+
children: [/* @__PURE__ */ jsx(Heading, {
|
|
219
|
+
level: layout === "contained" ? 2 : 1,
|
|
220
|
+
size: "heading-2",
|
|
217
221
|
children: page.title
|
|
218
222
|
}), page.sections.map((section) => /* @__PURE__ */ jsxs(FieldSet, {
|
|
219
223
|
className: "gap-3",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ChatComposerEditorExtension } from "../types.js";
|
|
2
1
|
import { TriggerConfig, TriggerMenuItemData } from "../../hooks/use-trigger-menu.js";
|
|
2
|
+
import { ChatComposerEditorExtension } from "../types.js";
|
|
3
3
|
import { Command } from "prosemirror-state";
|
|
4
4
|
//#region src/chat-composer-editor/extensions/mention.d.ts
|
|
5
5
|
export declare const deleteMentionBackward: Command;
|
package/dist/chat-message.d.ts
CHANGED
|
@@ -23,6 +23,19 @@ export type ChatMessageTimeProps = ChatMessagePartProps<"time"> & {
|
|
|
23
23
|
export declare function ChatMessageTime({ className, ...props }: ChatMessageTimeProps): JSX.Element;
|
|
24
24
|
export type ChatMessageContentProps = ChatMessagePartProps<"div">;
|
|
25
25
|
export declare function ChatMessageContent({ className, ...props }: ChatMessageContentProps): JSX.Element;
|
|
26
|
+
export type ChatMessageEditableProps = Omit<ChatMessagePartProps<"div">, "onError"> & {
|
|
27
|
+
value: string;
|
|
28
|
+
/** Persist the text in the host. Reject to keep the draft open for retry. */
|
|
29
|
+
onSave: (value: string) => void | Promise<void>;
|
|
30
|
+
onSaveError?: (error: unknown) => void;
|
|
31
|
+
editorLabel?: string;
|
|
32
|
+
saveLabel?: string;
|
|
33
|
+
cancelLabel?: string;
|
|
34
|
+
savingLabel?: string;
|
|
35
|
+
saveErrorLabel?: string;
|
|
36
|
+
};
|
|
37
|
+
/** Plain-text editing in the message surface. Children replace the default Copy/Edit actions. */
|
|
38
|
+
export declare function ChatMessageEditable({ value, onSave, onSaveError, editorLabel, saveLabel, cancelLabel, savingLabel, saveErrorLabel, children, className, ...props }: ChatMessageEditableProps): JSX.Element;
|
|
26
39
|
export type ChatMessagePendingProps = Omit<ChatMessagePartProps<"div">, "children">;
|
|
27
40
|
/** Visual only: the pending transition is announced by `ChatMessage` through the thread's status region. */
|
|
28
41
|
export declare function ChatMessagePending({ className, ...props }: ChatMessagePendingProps): JSX.Element | null;
|
package/dist/chat-message.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { cn } from "./lib/cn.js";
|
|
3
|
+
import { LiveStatus } from "./ui/live-status.js";
|
|
4
|
+
import { ActionBar, ActionBarCopy, ActionBarEdit, ActionBarItem } from "./action-bar.js";
|
|
3
5
|
import { ChatMessageStateProvider, chatAuthorLabels, chatMessageStatusLabels, chatMessageTransition, useChatMessage, useChatMessageContext, useChatThreadAnnounce } from "./hooks/use-chat-message.js";
|
|
4
6
|
import { ChatMessageReaction, ChatMessageReactions, ChatMessageReplies, ChatMessageReplySummary, ChatTypingIndicator } from "./chat-message/social.js";
|
|
5
|
-
import { useEffect, useRef } from "react";
|
|
6
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { useEffect, useId, useLayoutEffect, useRef, useState } from "react";
|
|
8
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
7
9
|
//#region src/chat-message.tsx
|
|
8
10
|
function ChatMessage({ from, state = "idle", density = "comfortable", layout = "bubble", continuation = false, authorLabel = chatAuthorLabels[from], statusLabels, className, children, ...props }) {
|
|
9
11
|
const message = useChatMessage({
|
|
@@ -137,6 +139,199 @@ function ChatMessageContent({ className, ...props }) {
|
|
|
137
139
|
...props
|
|
138
140
|
});
|
|
139
141
|
}
|
|
142
|
+
function useMessageEditor({ value, onSave, onSaveError }) {
|
|
143
|
+
const [editing, setEditing] = useState(false);
|
|
144
|
+
const [draft, setDraft] = useState(value);
|
|
145
|
+
const [originalValue, setOriginalValue] = useState(value);
|
|
146
|
+
const [saving, setSaving] = useState(false);
|
|
147
|
+
const [failed, setFailed] = useState(false);
|
|
148
|
+
const inputRef = useRef(null);
|
|
149
|
+
const triggerRef = useRef(null);
|
|
150
|
+
const savingRef = useRef(false);
|
|
151
|
+
const mountedRef = useRef(false);
|
|
152
|
+
const errorId = useId();
|
|
153
|
+
useEffect(() => {
|
|
154
|
+
mountedRef.current = true;
|
|
155
|
+
return () => {
|
|
156
|
+
mountedRef.current = false;
|
|
157
|
+
};
|
|
158
|
+
}, []);
|
|
159
|
+
useLayoutEffect(() => {
|
|
160
|
+
if (editing) {
|
|
161
|
+
const input = inputRef.current;
|
|
162
|
+
input?.focus({ preventScroll: true });
|
|
163
|
+
input?.setSelectionRange(input.value.length, input.value.length);
|
|
164
|
+
} else if (triggerRef.current) {
|
|
165
|
+
triggerRef.current.focus({ preventScroll: true });
|
|
166
|
+
triggerRef.current = null;
|
|
167
|
+
}
|
|
168
|
+
}, [editing]);
|
|
169
|
+
function startEditing() {
|
|
170
|
+
if (savingRef.current) return;
|
|
171
|
+
triggerRef.current = document.activeElement instanceof HTMLElement ? document.activeElement : null;
|
|
172
|
+
setDraft(value);
|
|
173
|
+
setOriginalValue(value);
|
|
174
|
+
setFailed(false);
|
|
175
|
+
setEditing(true);
|
|
176
|
+
}
|
|
177
|
+
function cancelEditing() {
|
|
178
|
+
if (savingRef.current) return;
|
|
179
|
+
setFailed(false);
|
|
180
|
+
setEditing(false);
|
|
181
|
+
}
|
|
182
|
+
async function save() {
|
|
183
|
+
if (!editing || savingRef.current || !draft.trim()) return;
|
|
184
|
+
if (draft === value) {
|
|
185
|
+
cancelEditing();
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
savingRef.current = true;
|
|
189
|
+
setSaving(true);
|
|
190
|
+
setFailed(false);
|
|
191
|
+
try {
|
|
192
|
+
await onSave(draft);
|
|
193
|
+
if (mountedRef.current) setEditing(false);
|
|
194
|
+
} catch (error) {
|
|
195
|
+
if (mountedRef.current) {
|
|
196
|
+
setFailed(true);
|
|
197
|
+
onSaveError?.(error);
|
|
198
|
+
}
|
|
199
|
+
} finally {
|
|
200
|
+
savingRef.current = false;
|
|
201
|
+
if (mountedRef.current) setSaving(false);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
return {
|
|
205
|
+
editing,
|
|
206
|
+
draft,
|
|
207
|
+
setDraft,
|
|
208
|
+
saving,
|
|
209
|
+
failed,
|
|
210
|
+
inputRef,
|
|
211
|
+
errorId,
|
|
212
|
+
startEditing,
|
|
213
|
+
cancelEditing,
|
|
214
|
+
save,
|
|
215
|
+
displayValue: editing ? originalValue : value
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
/** Plain-text editing in the message surface. Children replace the default Copy/Edit actions. */
|
|
219
|
+
function ChatMessageEditable({ value, onSave, onSaveError, editorLabel = "Edit message", saveLabel = "Save", cancelLabel = "Cancel", savingLabel = "Saving…", saveErrorLabel = "Couldn't save your message. Try again.", children, className, ...props }) {
|
|
220
|
+
const message = useChatMessageContext();
|
|
221
|
+
const { editing, draft, setDraft, saving, failed, inputRef, errorId, startEditing, cancelEditing, save, displayValue } = useMessageEditor({
|
|
222
|
+
value,
|
|
223
|
+
onSave,
|
|
224
|
+
onSaveError
|
|
225
|
+
});
|
|
226
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
227
|
+
...props,
|
|
228
|
+
"data-control-ui": "chat-message",
|
|
229
|
+
"data-control-family": "chat-message",
|
|
230
|
+
"data-slot": "editable",
|
|
231
|
+
"data-editing": editing ? "" : void 0,
|
|
232
|
+
className: cn("min-w-0", className),
|
|
233
|
+
children: [
|
|
234
|
+
/* @__PURE__ */ jsxs(ChatMessageContent, {
|
|
235
|
+
"data-editable": "",
|
|
236
|
+
children: [
|
|
237
|
+
/* @__PURE__ */ jsx("span", {
|
|
238
|
+
"data-control-ui": "chat-message",
|
|
239
|
+
"data-control-family": "chat-message",
|
|
240
|
+
"data-slot": "edit-value",
|
|
241
|
+
"aria-hidden": editing,
|
|
242
|
+
children: displayValue || ""
|
|
243
|
+
}),
|
|
244
|
+
/* @__PURE__ */ jsx("span", {
|
|
245
|
+
"data-control-ui": "chat-message",
|
|
246
|
+
"data-control-family": "chat-message",
|
|
247
|
+
"data-slot": "edit-sizer",
|
|
248
|
+
"aria-hidden": "true",
|
|
249
|
+
children: `${draft}\u200b`
|
|
250
|
+
}),
|
|
251
|
+
/* @__PURE__ */ jsx("textarea", {
|
|
252
|
+
ref: inputRef,
|
|
253
|
+
"data-control-ui": "chat-message",
|
|
254
|
+
"data-control-family": "chat-message",
|
|
255
|
+
"data-slot": "edit-input",
|
|
256
|
+
"aria-keyshortcuts": "Control+Enter Meta+Enter Escape",
|
|
257
|
+
"aria-label": editorLabel,
|
|
258
|
+
"aria-describedby": failed ? errorId : void 0,
|
|
259
|
+
"aria-hidden": !editing,
|
|
260
|
+
"aria-busy": saving,
|
|
261
|
+
tabIndex: editing ? 0 : -1,
|
|
262
|
+
readOnly: !editing || saving,
|
|
263
|
+
value: editing ? draft : value,
|
|
264
|
+
rows: 1,
|
|
265
|
+
onChange: (event) => setDraft(event.currentTarget.value),
|
|
266
|
+
onKeyDown: (event) => {
|
|
267
|
+
if (event.nativeEvent.isComposing || event.nativeEvent.keyCode === 229) return;
|
|
268
|
+
if (event.key === "Escape") {
|
|
269
|
+
event.preventDefault();
|
|
270
|
+
event.stopPropagation();
|
|
271
|
+
cancelEditing();
|
|
272
|
+
} else if (event.key === "Enter" && (event.metaKey || event.ctrlKey)) {
|
|
273
|
+
event.preventDefault();
|
|
274
|
+
save();
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
})
|
|
278
|
+
]
|
|
279
|
+
}),
|
|
280
|
+
/* @__PURE__ */ jsxs("div", {
|
|
281
|
+
"data-control-ui": "chat-message",
|
|
282
|
+
"data-control-family": "chat-message",
|
|
283
|
+
"data-slot": "edit-toolbars",
|
|
284
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
285
|
+
"data-control-ui": "chat-message",
|
|
286
|
+
"data-control-family": "chat-message",
|
|
287
|
+
"data-slot": "edit-toolbar",
|
|
288
|
+
"data-active": !editing ? "" : void 0,
|
|
289
|
+
inert: editing,
|
|
290
|
+
"aria-hidden": editing,
|
|
291
|
+
children: /* @__PURE__ */ jsx(ActionBar, {
|
|
292
|
+
align: message.isEndAligned ? "end" : "start",
|
|
293
|
+
copyValue: value,
|
|
294
|
+
onEdit: startEditing,
|
|
295
|
+
children: children ?? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(ActionBarCopy, {}), /* @__PURE__ */ jsx(ActionBarEdit, {})] })
|
|
296
|
+
})
|
|
297
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
298
|
+
"data-control-ui": "chat-message",
|
|
299
|
+
"data-control-family": "chat-message",
|
|
300
|
+
"data-slot": "edit-toolbar",
|
|
301
|
+
"data-active": editing ? "" : void 0,
|
|
302
|
+
inert: !editing,
|
|
303
|
+
"aria-hidden": !editing,
|
|
304
|
+
children: /* @__PURE__ */ jsxs(ActionBar, {
|
|
305
|
+
align: message.isEndAligned ? "end" : "start",
|
|
306
|
+
label: "Edit actions",
|
|
307
|
+
"aria-busy": saving,
|
|
308
|
+
children: [/* @__PURE__ */ jsx(ActionBarItem, {
|
|
309
|
+
type: "button",
|
|
310
|
+
disabled: saving || !draft.trim(),
|
|
311
|
+
onClick: () => void save(),
|
|
312
|
+
children: saveLabel
|
|
313
|
+
}), /* @__PURE__ */ jsx(ActionBarItem, {
|
|
314
|
+
type: "button",
|
|
315
|
+
disabled: saving,
|
|
316
|
+
onClick: cancelEditing,
|
|
317
|
+
children: cancelLabel
|
|
318
|
+
})]
|
|
319
|
+
})
|
|
320
|
+
})]
|
|
321
|
+
}),
|
|
322
|
+
/* @__PURE__ */ jsx(LiveStatus, { message: saving ? savingLabel : "" }),
|
|
323
|
+
/* @__PURE__ */ jsx("span", {
|
|
324
|
+
id: errorId,
|
|
325
|
+
role: "alert",
|
|
326
|
+
"data-control-ui": "chat-message",
|
|
327
|
+
"data-control-family": "chat-message",
|
|
328
|
+
"data-slot": "edit-error",
|
|
329
|
+
hidden: !failed,
|
|
330
|
+
children: failed ? saveErrorLabel : ""
|
|
331
|
+
})
|
|
332
|
+
]
|
|
333
|
+
});
|
|
334
|
+
}
|
|
140
335
|
/** Visual only: the pending transition is announced by `ChatMessage` through the thread's status region. */
|
|
141
336
|
function ChatMessagePending({ className, ...props }) {
|
|
142
337
|
if (!useChatMessageContext().isPending) return null;
|
|
@@ -190,4 +385,4 @@ function ChatMessageActions({ className, children, ...props }) {
|
|
|
190
385
|
});
|
|
191
386
|
}
|
|
192
387
|
//#endregion
|
|
193
|
-
export { ChatMessage, ChatMessageActions, ChatMessageAuthor, ChatMessageAvatar, ChatMessageBody, ChatMessageContent, ChatMessageFooter, ChatMessageHeader, ChatMessagePending, ChatMessageReaction, ChatMessageReactions, ChatMessageReplies, ChatMessageReplySummary, ChatMessageRow, ChatMessageTime, ChatTypingIndicator };
|
|
388
|
+
export { ChatMessage, ChatMessageActions, ChatMessageAuthor, ChatMessageAvatar, ChatMessageBody, ChatMessageContent, ChatMessageEditable, ChatMessageFooter, ChatMessageHeader, ChatMessagePending, ChatMessageReaction, ChatMessageReactions, ChatMessageReplies, ChatMessageReplySummary, ChatMessageRow, ChatMessageTime, ChatTypingIndicator };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { Button } from "../ui/button.js";
|
|
3
|
+
import { Text } from "../ui/typography.js";
|
|
3
4
|
import { useFilterBarContext } from "./context.js";
|
|
4
5
|
import { allowsCustomValue, fieldOperators, fieldOptions, parseCustomValue } from "./model.js";
|
|
5
6
|
import { Combobox, ComboboxContent, ComboboxEmpty, ComboboxInput, ComboboxItem, ComboboxList } from "../ui/combobox.js";
|
|
@@ -75,9 +76,11 @@ function handleEditorKeyDown(context, draft, event) {
|
|
|
75
76
|
return true;
|
|
76
77
|
}
|
|
77
78
|
function EditorOptions({ field, invalidNumber, owner }) {
|
|
78
|
-
if (field?.loading || field?.error) return /* @__PURE__ */ jsx(
|
|
79
|
+
if (field?.loading || field?.error) return /* @__PURE__ */ jsx(Text, {
|
|
80
|
+
as: "div",
|
|
81
|
+
size: "caption",
|
|
79
82
|
id: statusId(owner),
|
|
80
|
-
className: "p-3
|
|
83
|
+
className: "p-3",
|
|
81
84
|
children: field.error ?? "Loading values…"
|
|
82
85
|
});
|
|
83
86
|
return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(ComboboxEmpty, { children: invalidNumber ? "Enter a number, like 42 or 3.5." : "No matching options." }), /* @__PURE__ */ jsx(ComboboxList, { children: (choice) => /* @__PURE__ */ jsx(ComboboxItem, {
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
//#region src/knob-contracts/flow-knobs.d.ts
|
|
2
|
+
export declare const flowKnobs: readonly ["--cui-flow-background", "--cui-flow-grid-dot-color", "--cui-flow-edge-stroke", "--cui-flow-selected-edge-stroke", "--cui-flow-edge-size", "--cui-flow-node-background", "--cui-flow-node-foreground", "--cui-flow-node-border-color", "--cui-flow-node-hover-border-color", "--cui-flow-node-selected-border-color", "--cui-flow-node-border-width", "--cui-flow-node-radius", "--cui-flow-node-shadow", "--cui-flow-handle-size", "--cui-flow-handle-background", "--cui-flow-handle-border-color", "--cui-flow-handle-border-width", "--cui-flow-edge-label-background", "--cui-flow-edge-label-foreground", "--cui-flow-edge-label-border-color", "--cui-flow-edge-label-border-width", "--cui-flow-controls-item-radius", "--cui-flow-controls-padding", "--cui-flow-controls-radius", "--cui-flow-controls-background", "--cui-flow-controls-border-color", "--cui-flow-controls-shadow"];
|
|
3
|
+
export type FlowKnobStyle = Partial<Record<(typeof flowKnobs)[number], string>>;
|
|
4
|
+
//#endregion
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
//#region src/knob-contracts/flow-knobs.ts
|
|
2
|
+
const flowKnobs = [
|
|
3
|
+
"--cui-flow-background",
|
|
4
|
+
"--cui-flow-grid-dot-color",
|
|
5
|
+
"--cui-flow-edge-stroke",
|
|
6
|
+
"--cui-flow-selected-edge-stroke",
|
|
7
|
+
"--cui-flow-edge-size",
|
|
8
|
+
"--cui-flow-node-background",
|
|
9
|
+
"--cui-flow-node-foreground",
|
|
10
|
+
"--cui-flow-node-border-color",
|
|
11
|
+
"--cui-flow-node-hover-border-color",
|
|
12
|
+
"--cui-flow-node-selected-border-color",
|
|
13
|
+
"--cui-flow-node-border-width",
|
|
14
|
+
"--cui-flow-node-radius",
|
|
15
|
+
"--cui-flow-node-shadow",
|
|
16
|
+
"--cui-flow-handle-size",
|
|
17
|
+
"--cui-flow-handle-background",
|
|
18
|
+
"--cui-flow-handle-border-color",
|
|
19
|
+
"--cui-flow-handle-border-width",
|
|
20
|
+
"--cui-flow-edge-label-background",
|
|
21
|
+
"--cui-flow-edge-label-foreground",
|
|
22
|
+
"--cui-flow-edge-label-border-color",
|
|
23
|
+
"--cui-flow-edge-label-border-width",
|
|
24
|
+
"--cui-flow-controls-item-radius",
|
|
25
|
+
"--cui-flow-controls-padding",
|
|
26
|
+
"--cui-flow-controls-radius",
|
|
27
|
+
"--cui-flow-controls-background",
|
|
28
|
+
"--cui-flow-controls-border-color",
|
|
29
|
+
"--cui-flow-controls-shadow"
|
|
30
|
+
];
|
|
31
|
+
//#endregion
|
|
32
|
+
export { flowKnobs };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
//#region src/knob-contracts/item-knobs.d.ts
|
|
2
|
-
export declare const itemKnobs: readonly ["--cui-item-radius", "--cui-item-hover-background", "--cui-item-hover-border-color", "--cui-item-border-width", "--cui-item-active-scale"];
|
|
2
|
+
export declare const itemKnobs: readonly ["--cui-item-radius", "--cui-item-hover-background", "--cui-item-hover-border-color", "--cui-item-border-width", "--cui-item-active-scale", "--cui-item-gap", "--cui-item-padding-block", "--cui-item-padding-inline"];
|
|
3
3
|
export type ItemKnobStyle = Partial<Record<(typeof itemKnobs)[number], string>>;
|
|
4
4
|
//#endregion
|
|
@@ -4,7 +4,10 @@ const itemKnobs = [
|
|
|
4
4
|
"--cui-item-hover-background",
|
|
5
5
|
"--cui-item-hover-border-color",
|
|
6
6
|
"--cui-item-border-width",
|
|
7
|
-
"--cui-item-active-scale"
|
|
7
|
+
"--cui-item-active-scale",
|
|
8
|
+
"--cui-item-gap",
|
|
9
|
+
"--cui-item-padding-block",
|
|
10
|
+
"--cui-item-padding-inline"
|
|
8
11
|
];
|
|
9
12
|
//#endregion
|
|
10
13
|
export { itemKnobs };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
//#region src/knob-contracts/markdown-editor-knobs.d.ts
|
|
2
|
+
export declare const markdownEditorKnobs: readonly ["--cui-markdown-editor-background", "--cui-markdown-editor-foreground", "--cui-markdown-editor-border-color", "--cui-markdown-editor-radius", "--cui-markdown-editor-padding", "--cui-markdown-editor-gutter-size", "--cui-markdown-editor-min-height", "--cui-markdown-editor-max-height", "--cui-markdown-editor-gap", "--cui-markdown-editor-muted-foreground", "--cui-markdown-editor-code-background", "--cui-markdown-editor-border-width"];
|
|
3
|
+
export type MarkdownEditorKnobStyle = Partial<Record<(typeof markdownEditorKnobs)[number], string>>;
|
|
4
|
+
//#endregion
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
//#region src/knob-contracts/markdown-editor-knobs.ts
|
|
2
|
+
const markdownEditorKnobs = [
|
|
3
|
+
"--cui-markdown-editor-background",
|
|
4
|
+
"--cui-markdown-editor-foreground",
|
|
5
|
+
"--cui-markdown-editor-border-color",
|
|
6
|
+
"--cui-markdown-editor-radius",
|
|
7
|
+
"--cui-markdown-editor-padding",
|
|
8
|
+
"--cui-markdown-editor-gutter-size",
|
|
9
|
+
"--cui-markdown-editor-min-height",
|
|
10
|
+
"--cui-markdown-editor-max-height",
|
|
11
|
+
"--cui-markdown-editor-gap",
|
|
12
|
+
"--cui-markdown-editor-muted-foreground",
|
|
13
|
+
"--cui-markdown-editor-code-background",
|
|
14
|
+
"--cui-markdown-editor-border-width"
|
|
15
|
+
];
|
|
16
|
+
//#endregion
|
|
17
|
+
export { markdownEditorKnobs };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
//#region src/knob-contracts/morphing-panel-knobs.d.ts
|
|
2
|
-
export declare const morphingPanelKnobs: readonly ["--cui-morphing-panel-radius", "--cui-morphing-panel-background", "--cui-morphing-panel-foreground", "--cui-morphing-panel-border-color", "--cui-morphing-panel-shadow", "--cui-morphing-panel-trigger-hover-background"];
|
|
2
|
+
export declare const morphingPanelKnobs: readonly ["--cui-morphing-panel-radius", "--cui-morphing-panel-background", "--cui-morphing-panel-foreground", "--cui-morphing-panel-border-color", "--cui-morphing-panel-shadow", "--cui-morphing-panel-trigger-hover-background", "--cui-morphing-panel-border-width"];
|
|
3
3
|
export type MorphingPanelKnobStyle = Partial<Record<(typeof morphingPanelKnobs)[number], string>>;
|
|
4
4
|
//#endregion
|
|
@@ -5,7 +5,8 @@ const morphingPanelKnobs = [
|
|
|
5
5
|
"--cui-morphing-panel-foreground",
|
|
6
6
|
"--cui-morphing-panel-border-color",
|
|
7
7
|
"--cui-morphing-panel-shadow",
|
|
8
|
-
"--cui-morphing-panel-trigger-hover-background"
|
|
8
|
+
"--cui-morphing-panel-trigger-hover-background",
|
|
9
|
+
"--cui-morphing-panel-border-width"
|
|
9
10
|
];
|
|
10
11
|
//#endregion
|
|
11
12
|
export { morphingPanelKnobs };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
//#region src/knob-contracts/resize-handle-knobs.d.ts
|
|
2
|
+
export declare const resizeHandleKnobs: readonly ["--cui-resize-handle-size", "--cui-resize-handle-hit-size", "--cui-resize-handle-background", "--cui-resize-handle-hover-background", "--cui-resize-handle-border-color", "--cui-resize-handle-border-width", "--cui-resize-handle-radius"];
|
|
3
|
+
export type ResizeHandleKnobStyle = Partial<Record<(typeof resizeHandleKnobs)[number], string>>;
|
|
4
|
+
//#endregion
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
//#region src/knob-contracts/resize-handle-knobs.ts
|
|
2
|
+
const resizeHandleKnobs = [
|
|
3
|
+
"--cui-resize-handle-size",
|
|
4
|
+
"--cui-resize-handle-hit-size",
|
|
5
|
+
"--cui-resize-handle-background",
|
|
6
|
+
"--cui-resize-handle-hover-background",
|
|
7
|
+
"--cui-resize-handle-border-color",
|
|
8
|
+
"--cui-resize-handle-border-width",
|
|
9
|
+
"--cui-resize-handle-radius"
|
|
10
|
+
];
|
|
11
|
+
//#endregion
|
|
12
|
+
export { resizeHandleKnobs };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
//#region src/knob-contracts/sidebar-knobs.d.ts
|
|
2
|
-
export declare const sidebarKnobs: readonly ["--cui-sidebar-menu-badge-height", "--cui-sidebar-menu-badge-background", "--cui-sidebar-menu-badge-foreground", "--cui-sidebar-rail-divider-background", "--cui-sidebar-wrapper-background", "--cui-sidebar-wrapper-background-image", "--cui-sidebar-inner-background", "--cui-sidebar-inner-border-color", "--cui-sidebar-inner-background-image", "--cui-sidebar-inner-backdrop-filter", "--cui-sidebar-inner-border-width", "--cui-sidebar-inner-radius", "--cui-sidebar-inner-shadow", "--cui-sidebar-header-background", "--cui-sidebar-header-shadow", "--cui-sidebar-inset-background", "--cui-sidebar-inset-background-image", "--cui-sidebar-inset-shadow", "--cui-sidebar-inset-border-color", "--cui-sidebar-inset-border-width", "--cui-sidebar-inset-radius", "--cui-sidebar-inset-inset", "--cui-sidebar-menu-button-radius", "--cui-sidebar-group-label-foreground", "--cui-sidebar-menu-button-foreground", "--cui-sidebar-menu-button-hover-background", "--cui-sidebar-menu-button-hover-foreground", "--cui-sidebar-menu-button-hover-shadow", "--cui-sidebar-menu-button-active-background", "--cui-sidebar-menu-button-active-foreground", "--cui-sidebar-menu-button-active-shadow", "--cui-sidebar-menu-button-track-active-foreground", "--cui-sidebar-menu-button-height", "--cui-sidebar-menu-button-padding-block", "--cui-sidebar-menu-button-padding-inline", "--cui-sidebar-menu-button-font-size", "--cui-sidebar-menu-button-font-weight", "--cui-sidebar-menu-button-active-font-weight", "--cui-sidebar-group-label-font-size", "--cui-sidebar-group-label-font-weight", "--cui-sidebar-group-label-letter-spacing", "--cui-sidebar-group-label-text-transform", "--cui-sidebar-group-label-padding", "--cui-sidebar-skip-link-background", "--cui-sidebar-skip-link-foreground", "--cui-sidebar-skip-link-radius", "--cui-sidebar-skip-link-shadow"];
|
|
2
|
+
export declare const sidebarKnobs: readonly ["--cui-sidebar-nav-height", "--cui-sidebar-nav-background", "--cui-sidebar-nav-foreground", "--cui-sidebar-nav-border-color", "--cui-sidebar-nav-border-width", "--cui-sidebar-nav-shadow", "--cui-sidebar-nav-item-radius", "--cui-sidebar-nav-item-active-background", "--cui-sidebar-nav-item-active-foreground", "--cui-sidebar-nav-gap", "--cui-sidebar-menu-badge-height", "--cui-sidebar-menu-badge-background", "--cui-sidebar-menu-badge-foreground", "--cui-sidebar-rail-divider-background", "--cui-sidebar-wrapper-background", "--cui-sidebar-wrapper-background-image", "--cui-sidebar-inner-background", "--cui-sidebar-inner-border-color", "--cui-sidebar-inner-background-image", "--cui-sidebar-inner-backdrop-filter", "--cui-sidebar-inner-border-width", "--cui-sidebar-inner-radius", "--cui-sidebar-inner-shadow", "--cui-sidebar-header-background", "--cui-sidebar-header-shadow", "--cui-sidebar-inset-background", "--cui-sidebar-inset-background-image", "--cui-sidebar-inset-shadow", "--cui-sidebar-inset-border-color", "--cui-sidebar-inset-border-width", "--cui-sidebar-inset-radius", "--cui-sidebar-inset-inset", "--cui-sidebar-menu-button-radius", "--cui-sidebar-group-label-foreground", "--cui-sidebar-menu-button-foreground", "--cui-sidebar-menu-button-hover-background", "--cui-sidebar-menu-button-hover-foreground", "--cui-sidebar-menu-button-hover-shadow", "--cui-sidebar-menu-button-active-background", "--cui-sidebar-menu-button-active-foreground", "--cui-sidebar-menu-button-active-shadow", "--cui-sidebar-menu-button-track-active-foreground", "--cui-sidebar-menu-button-height", "--cui-sidebar-menu-button-padding-block", "--cui-sidebar-menu-button-padding-inline", "--cui-sidebar-menu-button-font-size", "--cui-sidebar-menu-button-font-weight", "--cui-sidebar-menu-button-active-font-weight", "--cui-sidebar-group-label-font-size", "--cui-sidebar-group-label-font-weight", "--cui-sidebar-group-label-letter-spacing", "--cui-sidebar-group-label-text-transform", "--cui-sidebar-group-label-padding", "--cui-sidebar-skip-link-background", "--cui-sidebar-skip-link-foreground", "--cui-sidebar-skip-link-radius", "--cui-sidebar-skip-link-shadow"];
|
|
3
3
|
export type SidebarKnobStyle = Partial<Record<(typeof sidebarKnobs)[number], string>>;
|
|
4
4
|
//#endregion
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
//#region src/knob-contracts/sidebar-knobs.ts
|
|
2
2
|
const sidebarKnobs = [
|
|
3
|
+
"--cui-sidebar-nav-height",
|
|
4
|
+
"--cui-sidebar-nav-background",
|
|
5
|
+
"--cui-sidebar-nav-foreground",
|
|
6
|
+
"--cui-sidebar-nav-border-color",
|
|
7
|
+
"--cui-sidebar-nav-border-width",
|
|
8
|
+
"--cui-sidebar-nav-shadow",
|
|
9
|
+
"--cui-sidebar-nav-item-radius",
|
|
10
|
+
"--cui-sidebar-nav-item-active-background",
|
|
11
|
+
"--cui-sidebar-nav-item-active-foreground",
|
|
12
|
+
"--cui-sidebar-nav-gap",
|
|
3
13
|
"--cui-sidebar-menu-badge-height",
|
|
4
14
|
"--cui-sidebar-menu-badge-background",
|
|
5
15
|
"--cui-sidebar-menu-badge-foreground",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
//#region src/knob-contracts/switch-knobs.d.ts
|
|
2
|
-
export declare const switchKnobs: readonly ["--cui-switch-thumb-shadow", "--cui-switch-radius", "--cui-switch-shadow", "--cui-switch-background", "--cui-switch-border-color", "--cui-switch-border-width", "--cui-switch-checked-border-color", "--cui-switch-hover-background", "--cui-switch-checked-background", "--cui-switch-checked-hover-background", "--cui-switch-thumb-radius", "--cui-switch-thumb-background", "--cui-switch-inline-size", "--cui-switch-height", "--cui-switch-padding", "--cui-switch-thumb-inline-size", "--cui-switch-thumb-press-scale", "--cui-switch-thumb-backdrop-filter"];
|
|
2
|
+
export declare const switchKnobs: readonly ["--cui-switch-thumb-shadow", "--cui-switch-radius", "--cui-switch-shadow", "--cui-switch-background", "--cui-switch-border-color", "--cui-switch-border-width", "--cui-switch-checked-border-color", "--cui-switch-hover-background", "--cui-switch-checked-background", "--cui-switch-checked-hover-background", "--cui-switch-thumb-radius", "--cui-switch-thumb-background", "--cui-switch-inline-size", "--cui-switch-height", "--cui-switch-padding", "--cui-switch-thumb-inline-size", "--cui-switch-thumb-press-inline-size", "--cui-switch-thumb-press-scale", "--cui-switch-thumb-backdrop-filter"];
|
|
3
3
|
export type SwitchKnobStyle = Partial<Record<(typeof switchKnobs)[number], string>>;
|
|
4
4
|
//#endregion
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { MarkdownImageUpload } from "./uploads.js";
|
|
2
|
+
import { Editor } from "@tiptap/core";
|
|
3
|
+
//#region src/markdown-editor/context.d.ts
|
|
4
|
+
export type MarkdownEditorContextValue = {
|
|
5
|
+
editor: Editor | null;
|
|
6
|
+
disabled: boolean;
|
|
7
|
+
source: boolean;
|
|
8
|
+
markdown: string;
|
|
9
|
+
sourceRequired: boolean;
|
|
10
|
+
setSource: (source: boolean) => void;
|
|
11
|
+
setMarkdown: (value: string) => void;
|
|
12
|
+
setContentAttributes: (attributes: Record<string, string>) => void;
|
|
13
|
+
canUpload: boolean;
|
|
14
|
+
uploads: MarkdownImageUpload[];
|
|
15
|
+
upload: (files: File[], position?: number) => void;
|
|
16
|
+
retryUpload: (id: string) => void;
|
|
17
|
+
removeUpload: (id: string) => void;
|
|
18
|
+
uploadError: string | null;
|
|
19
|
+
};
|
|
20
|
+
export declare const MarkdownEditorContext: import("react").Context<MarkdownEditorContextValue | null>;
|
|
21
|
+
export declare function useMarkdownEditor(): MarkdownEditorContextValue;
|
|
22
|
+
//#endregion
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { createContext, useContext } from "react";
|
|
2
|
+
//#region src/markdown-editor/context.ts
|
|
3
|
+
const MarkdownEditorContext = createContext(null);
|
|
4
|
+
function useMarkdownEditor() {
|
|
5
|
+
const context = useContext(MarkdownEditorContext);
|
|
6
|
+
if (!context) throw new Error("Markdown editor parts require a MarkdownEditor parent.");
|
|
7
|
+
return context;
|
|
8
|
+
}
|
|
9
|
+
//#endregion
|
|
10
|
+
export { MarkdownEditorContext, useMarkdownEditor };
|