@jini-ai/chat 0.7.3-next.3 → 0.7.3-next.4
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/react/chat-cleanup/ChatCleanupPanel.d.ts +23 -6
- package/dist/react/chat-cleanup/ChatCleanupPanel.js +25 -8
- package/dist/react/chat-cleanup/chat-cleanup.hooks.d.ts +6 -0
- package/dist/react/components/ChatCleanupDialog.js +4 -1
- package/dist/react/components/ChatSettingsDialog.d.ts +3 -0
- package/dist/react/components/ChatSettingsDialog.js +3 -3
- package/dist/react/components/ConversationList.d.ts +6 -1
- package/dist/react/components/ConversationList.js +30 -9
- package/dist/react/components/Icon.d.ts +1 -1
- package/dist/react/components/Icon.js +5 -0
- package/dist/react/styles/chat-settings.css +28 -0
- package/package.json +6 -6
|
@@ -1,14 +1,31 @@
|
|
|
1
1
|
import type { ChatCleanupConfirm, WiredChatCleanup } from "./chat-cleanup.hooks.js";
|
|
2
2
|
/**
|
|
3
|
-
* The
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* state of its own; everything comes from the injected {@link WiredChatCleanup}.
|
|
3
|
+
* The chat cleanup's home in the chat settings dialog (its `displayExtra` slot): a broom toggle with
|
|
4
|
+
* its label, which turns on row ticking in the chat list, and the 1–365 day chooser in front of
|
|
5
|
+
* `ChatCleanupDialog` (which shows the server's count, bytes and kept reasons before anything is
|
|
6
|
+
* deleted). Holds no state of its own; everything comes from the injected {@link WiredChatCleanup}.
|
|
7
7
|
*
|
|
8
|
-
*
|
|
8
|
+
* Why the toggle is a plain icon button and not `cleanup.kit.Button`: the kit button is the host's
|
|
9
|
+
* filled action button, and as the dock header's "Clean up chats" it rendered as a large accent text
|
|
10
|
+
* button among the header's small icons (owner, 2026-11-29). The kit button stays for the actions.
|
|
11
|
+
*
|
|
12
|
+
* @param props.confirm - Unused here (delete-selected lives in {@link ChatCleanupSelectionActions});
|
|
13
|
+
* kept so both halves take the same props from the host.
|
|
9
14
|
* @complexity O(k) in the number of kept chats the preview names.
|
|
10
15
|
*/
|
|
11
|
-
export declare function ChatCleanupPanel({ cleanup
|
|
16
|
+
export declare function ChatCleanupPanel({ cleanup }: {
|
|
17
|
+
cleanup: WiredChatCleanup;
|
|
18
|
+
confirm: ChatCleanupConfirm;
|
|
19
|
+
}, _optional?: {}): import("react").JSX.Element;
|
|
20
|
+
/**
|
|
21
|
+
* The chat list's foot while rows are ticked (`ConversationList`'s `selectionActions`): "Delete
|
|
22
|
+
* selected", which asks `confirm` first, and "Done", which leaves ticking mode. They sit under the
|
|
23
|
+
* ticks they act on; a header button for them read as unrelated chrome.
|
|
24
|
+
*
|
|
25
|
+
* @param props.confirm - The admin confirm dialog; delete-selected waits for its visible answer.
|
|
26
|
+
* @complexity O(1).
|
|
27
|
+
*/
|
|
28
|
+
export declare function ChatCleanupSelectionActions({ cleanup, confirm }: {
|
|
12
29
|
cleanup: WiredChatCleanup;
|
|
13
30
|
confirm: ChatCleanupConfirm;
|
|
14
31
|
}, _optional?: {}): import("react").JSX.Element;
|
|
@@ -1,17 +1,34 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { ChatCleanupDialog } from "../components/ChatCleanupDialog.js";
|
|
3
|
+
import { Icon } from "../components/Icon.js";
|
|
3
4
|
/**
|
|
4
|
-
* The
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* state of its own; everything comes from the injected {@link WiredChatCleanup}.
|
|
5
|
+
* The chat cleanup's home in the chat settings dialog (its `displayExtra` slot): a broom toggle with
|
|
6
|
+
* its label, which turns on row ticking in the chat list, and the 1–365 day chooser in front of
|
|
7
|
+
* `ChatCleanupDialog` (which shows the server's count, bytes and kept reasons before anything is
|
|
8
|
+
* deleted). Holds no state of its own; everything comes from the injected {@link WiredChatCleanup}.
|
|
8
9
|
*
|
|
9
|
-
*
|
|
10
|
+
* Why the toggle is a plain icon button and not `cleanup.kit.Button`: the kit button is the host's
|
|
11
|
+
* filled action button, and as the dock header's "Clean up chats" it rendered as a large accent text
|
|
12
|
+
* button among the header's small icons (owner, 2026-11-29). The kit button stays for the actions.
|
|
13
|
+
*
|
|
14
|
+
* @param props.confirm - Unused here (delete-selected lives in {@link ChatCleanupSelectionActions});
|
|
15
|
+
* kept so both halves take the same props from the host.
|
|
10
16
|
* @complexity O(k) in the number of kept chats the preview names.
|
|
11
17
|
*/
|
|
12
|
-
export function ChatCleanupPanel({ cleanup
|
|
18
|
+
export function ChatCleanupPanel({ cleanup }, _optional = {}) {
|
|
19
|
+
return (_jsxs("div", { className: "jini-chat-cleanup", children: [_jsxs("button", { type: "button", className: "jini-chat-cleanup-toggle", "aria-expanded": cleanup.open, title: cleanup.copy.open, onClick: () => cleanup.setOpen(!cleanup.open), children: [_jsx(Icon, { name: "broom", size: 16 }), _jsx("span", { children: cleanup.copy.open })] }), cleanup.open ? _jsxs("div", { className: "jini-chat-cleanup-panel", children: [_jsxs("label", { className: "jini-chat-cleanup-age", children: [cleanup.copy.olderThan, _jsx("input", { type: "number", min: 1, max: 365, step: 1, value: Number.isNaN(cleanup.olderThanDays) ? "" : cleanup.olderThanDays, onChange: (event) => cleanup.setOlderThanDays(event.currentTarget.valueAsNumber) })] }), _jsx(ChatCleanupDialog, { useChatCleanup: cleanup.useDialog, kit: cleanup.kit, copy: cleanup.copy.dialog, onDone: () => cleanup.setOpen(false) }), cleanup.error ? _jsx("p", { role: "alert", className: "jini-chat-cleanup-error", children: cleanup.error }) : null] }) : null] }));
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* The chat list's foot while rows are ticked (`ConversationList`'s `selectionActions`): "Delete
|
|
23
|
+
* selected", which asks `confirm` first, and "Done", which leaves ticking mode. They sit under the
|
|
24
|
+
* ticks they act on; a header button for them read as unrelated chrome.
|
|
25
|
+
*
|
|
26
|
+
* @param props.confirm - The admin confirm dialog; delete-selected waits for its visible answer.
|
|
27
|
+
* @complexity O(1).
|
|
28
|
+
*/
|
|
29
|
+
export function ChatCleanupSelectionActions({ cleanup, confirm }, _optional = {}) {
|
|
13
30
|
const { Button } = cleanup.kit;
|
|
14
31
|
const count = cleanup.selectedIds.length;
|
|
15
|
-
return
|
|
32
|
+
return _jsxs(_Fragment, { children: [_jsx(Button, { type: "button", "data-variant": "danger", disabled: count === 0, onClick: () => { void cleanup.deleteSelected({ confirm }); }, children: cleanup.copy.deleteSelected({ count }) }), _jsx(Button, { type: "button", "data-variant": "ghost", onClick: () => cleanup.setOpen(false), children: cleanup.copy.done }), cleanup.error ? _jsx("p", { role: "alert", className: "jini-chat-cleanup-error", children: cleanup.error }) : null] });
|
|
16
33
|
}
|
|
17
34
|
//# sourceMappingURL=ChatCleanupPanel.js.map
|
|
@@ -47,6 +47,8 @@ export interface ChatCleanupCopy {
|
|
|
47
47
|
}) => string;
|
|
48
48
|
};
|
|
49
49
|
open: string;
|
|
50
|
+
/** Leaves row ticking from the chat list's selection actions. */
|
|
51
|
+
done: string;
|
|
50
52
|
olderThan: string;
|
|
51
53
|
deleteSelected: (required: {
|
|
52
54
|
count: number;
|
|
@@ -82,6 +84,10 @@ export interface ChatCleanupClient {
|
|
|
82
84
|
confirm: true;
|
|
83
85
|
}) => Promise<ChatCleanupResult>;
|
|
84
86
|
}
|
|
87
|
+
/**
|
|
88
|
+
* The host's action button. Callers pass `data-variant` ("secondary" | "danger" | "ghost") for the
|
|
89
|
+
* look; a hyphenated attribute keeps a plain `"button"` a valid kit, which simply ignores it.
|
|
90
|
+
*/
|
|
85
91
|
export type ChatCleanupKit = {
|
|
86
92
|
Button: ElementType<ButtonHTMLAttributes<HTMLButtonElement>>;
|
|
87
93
|
};
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
export function ChatCleanupDialog({ useChatCleanup, kit: { Button }, copy, onDone }, _optional = {}) {
|
|
3
3
|
const cleanup = useChatCleanup();
|
|
4
|
-
|
|
4
|
+
// A group, not role="dialog": it renders inside the chat settings modal, and a second dialog role
|
|
5
|
+
// nested in it would announce a dialog that never takes focus. `data-variant` asks the host's kit
|
|
6
|
+
// button for a quieter or a danger look; a plain `<button>` just ignores it.
|
|
7
|
+
return _jsxs("div", { role: "group", className: "jini-chat-cleanup-preview", children: [cleanup.state === 'preview' ? _jsx(Button, { type: "button", "data-variant": "secondary", onClick: cleanup.preview, children: copy.preview }) : null, cleanup.state === 'expired' ? _jsxs(_Fragment, { children: [_jsx("p", { children: copy.expired }), _jsx(Button, { type: "button", "data-variant": "secondary", onClick: cleanup.choose, children: copy.choose })] }) : null, cleanup.state === 'confirm' || cleanup.state === 'partial' ? _jsxs(_Fragment, { children: [_jsx("p", { children: copy.count({ count: cleanup.count, bytes: cleanup.bytes }) }), cleanup.state === 'partial' ? _jsx("p", { children: copy.partial }) : null, _jsx("ul", { children: cleanup.kept.map(item => _jsxs("li", { children: [item.title, ": ", item.reason] }, item.id)) }), _jsx(Button, { type: "button", "data-variant": "danger", disabled: !cleanup.previewToken, onClick: async () => {
|
|
5
8
|
if (!cleanup.previewToken)
|
|
6
9
|
return;
|
|
7
10
|
const result = await cleanup.apply({ previewToken: cleanup.previewToken, confirm: true });
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
1
2
|
import { useChatSettingsView, type ChatPermissionsPort, type ChatSettingsSection } from './ChatSettingsDialog.hooks.js';
|
|
2
3
|
/** Advanced chat settings; the host supplies display actions, capabilities and persistence.
|
|
3
4
|
* Native dialog semantics own modal focus containment; closing restores the opener.
|
|
@@ -10,5 +11,7 @@ export declare function ChatSettingsDialog({ useChatSettingsViewHook, ...require
|
|
|
10
11
|
displaySections: readonly ChatSettingsSection[];
|
|
11
12
|
permissions: ChatPermissionsPort;
|
|
12
13
|
t?: (key: string) => string;
|
|
14
|
+
/** A host control after the display groups (the dock's chat cleanup); absent shows nothing extra. */
|
|
15
|
+
displayExtra?: ReactNode;
|
|
13
16
|
}): import("react").JSX.Element;
|
|
14
17
|
//# sourceMappingURL=ChatSettingsDialog.d.ts.map
|
|
@@ -64,7 +64,7 @@ export function ChatSettingsDialog({ useChatSettingsViewHook = useChatSettingsVi
|
|
|
64
64
|
const verticalOutside = y < box.top || y > box.bottom;
|
|
65
65
|
if ((x === 0 && y === 0) || horizontalOutside || verticalOutside)
|
|
66
66
|
required.onClose();
|
|
67
|
-
}, children: _jsx(ChatSettingsBody, { vm: vm, titleId: titleId, closeRef: closeRef, onClose: required.onClose }) });
|
|
67
|
+
}, children: _jsx(ChatSettingsBody, { vm: vm, titleId: titleId, closeRef: closeRef, onClose: required.onClose, displayExtra: required.displayExtra }) });
|
|
68
68
|
}
|
|
69
69
|
function renderDisplaySection(section) {
|
|
70
70
|
if (section.radio)
|
|
@@ -77,8 +77,8 @@ function renderDisplaySection(section) {
|
|
|
77
77
|
function renderPermissions(vm) {
|
|
78
78
|
return _jsxs(_Fragment, { children: [_jsx("p", { className: "jini-chat-settings-note", children: vm.t('Permission changes apply to the next run.') }), vm.permissions.unavailableReason && _jsx("p", { className: "jini-chat-settings-note", children: vm.t(vm.permissions.unavailableReason) }), _jsx(SettingSwitch, { className: "jini-chat-settings-row--master", label: vm.master.label, checked: vm.master.checked, disabled: vm.master.disabled, onChange: checked => vm.master.onCheckedChange({ checked }), description: vm.master.description, descriptionId: vm.master.descriptionId }), _jsx("div", { className: "jini-chat-settings-capabilities", children: vm.capabilities.map(item => _jsx(SettingSwitch, { label: item.control.label, checked: item.control.checked, disabled: item.control.disabled, onChange: checked => item.control.onCheckedChange({ checked }), description: item.description, descriptionId: item.descriptionId }, item.key)) }), vm.permissions.busy && _jsx("p", { role: "status", className: "jini-chat-settings-note", children: vm.t('Saving…') }), vm.permissions.error && _jsx("p", { role: "alert", className: "jini-chat-settings-error", children: vm.permissions.error })] });
|
|
79
79
|
}
|
|
80
|
-
function ChatSettingsBody({ vm, titleId, closeRef, onClose }) {
|
|
81
|
-
return _jsxs(_Fragment, { children: [_jsxs("header", { className: "jini-chat-settings-header", children: [_jsx("h2", { id: titleId, className: "jini-dialog-title", children: vm.t('Chat settings') }), _jsx("button", { ref: closeRef, type: "button", className: "jini-dialog-close jini-chat-settings-close", "aria-label": vm.t('Close'), onClick: onClose, children: _jsx("span", { "aria-hidden": "true", children: "\u00D7" }) })] }), _jsx(TabBar, { tabs: vm.tabs, activeId: vm.tab, onChange: vm.setTab, ariaLabel: vm.t('Chat settings') }), _jsx("div", { className: "jini-chat-settings-body", role: "tabpanel", "aria-label": vm.tab === 'display' ? vm.t('Display') : vm.t('Agent permissions'), children: vm.tab === 'display' ? vm.display.map(renderDisplaySection)
|
|
80
|
+
function ChatSettingsBody({ vm, titleId, closeRef, onClose, displayExtra }) {
|
|
81
|
+
return _jsxs(_Fragment, { children: [_jsxs("header", { className: "jini-chat-settings-header", children: [_jsx("h2", { id: titleId, className: "jini-dialog-title", children: vm.t('Chat settings') }), _jsx("button", { ref: closeRef, type: "button", className: "jini-dialog-close jini-chat-settings-close", "aria-label": vm.t('Close'), onClick: onClose, children: _jsx("span", { "aria-hidden": "true", children: "\u00D7" }) })] }), _jsx(TabBar, { tabs: vm.tabs, activeId: vm.tab, onChange: vm.setTab, ariaLabel: vm.t('Chat settings') }), _jsx("div", { className: "jini-chat-settings-body", role: "tabpanel", "aria-label": vm.tab === 'display' ? vm.t('Display') : vm.t('Agent permissions'), children: vm.tab === 'display' ? _jsxs(_Fragment, { children: [vm.display.map(renderDisplaySection), displayExtra] })
|
|
82
82
|
: renderPermissions(vm) }), " "] });
|
|
83
83
|
}
|
|
84
84
|
//# sourceMappingURL=ChatSettingsDialog.js.map
|
|
@@ -71,6 +71,11 @@ export interface ConversationListProps {
|
|
|
71
71
|
* the icon (the browser's dark tip would otherwise show on top of it). Defaults to true.
|
|
72
72
|
*/
|
|
73
73
|
nativeTitle?: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* Shown at the foot of the open menu while `selectable` is on: the host's actions over the ticked
|
|
76
|
+
* rows (e.g. "Delete selected"). They live beside the ticks they act on rather than in a header.
|
|
77
|
+
*/
|
|
78
|
+
selectionActions?: React.ReactNode;
|
|
74
79
|
}
|
|
75
80
|
/** Hooks ConversationList calls; the host passes the real ones or a test hands in fakes. */
|
|
76
81
|
export declare const defaultConversationListHooks: {
|
|
@@ -78,5 +83,5 @@ export declare const defaultConversationListHooks: {
|
|
|
78
83
|
useConversationListView: typeof useConversationListView;
|
|
79
84
|
};
|
|
80
85
|
export type ConversationListHooks = typeof defaultConversationListHooks;
|
|
81
|
-
export declare function ConversationList({ conversations: savedConversations, activeConversationId, onSelect, onCreate, onDelete, onRename, onSearch, confirmDelete, createDisabled, emptyState, triggerLabel, nativeTitle, hooks, report, selectable, selectedIds, onTogglePin, onSelectionChange, }: ConversationListProps, _optional?: {}): import("react").JSX.Element;
|
|
86
|
+
export declare function ConversationList({ conversations: savedConversations, activeConversationId, onSelect, onCreate, onDelete, onRename, onSearch, confirmDelete, createDisabled, emptyState, triggerLabel, nativeTitle, hooks, report, selectable, selectedIds, onTogglePin, onSelectionChange, selectionActions, }: ConversationListProps, _optional?: {}): import("react").JSX.Element;
|
|
82
87
|
//# sourceMappingURL=ConversationList.d.ts.map
|
|
@@ -39,9 +39,20 @@ function relativeTime(updatedAt, now) {
|
|
|
39
39
|
return `${hours}h ago`;
|
|
40
40
|
return `${Math.round(hours / 24)}d ago`;
|
|
41
41
|
}
|
|
42
|
-
/**
|
|
42
|
+
/**
|
|
43
|
+
* The row's pin toggle: an icon button like rename and delete, outline while unpinned and filled once
|
|
44
|
+
* pinned. It was a bare text button ("Pin" / "Unpin"), which the admin's global button styles painted
|
|
45
|
+
* as a full-size filled accent button on every row (owner, 2026-11-29). The visible tooltip is the
|
|
46
|
+
* short verb; the accessible name keeps the chat's title so a screen reader knows which row it pins.
|
|
47
|
+
*/
|
|
48
|
+
function PinButton({ item, t, onTogglePin }) {
|
|
49
|
+
const verb = t(item.pinned ? 'Unpin' : 'Pin');
|
|
50
|
+
return _jsx("button", { type: "button", className: item.pinned ? 'jini-conv-item-pin jini-conv-item-pin--pinned' : 'jini-conv-item-pin', "aria-label": `${verb} ${item.title ?? t('Untitled')}`, title: verb, "data-testid": `conversation-pin-${item.id}`, onClick: () => onTogglePin({ id: item.id, pinned: !item.pinned }), children: _jsx(Icon, { name: "pin", size: 12, fill: item.pinned ? 'currentColor' : 'none' }) });
|
|
51
|
+
}
|
|
52
|
+
/** Only the host-supported actions are rendered; row selection remains independent. Icon-only, so
|
|
53
|
+
* each carries a hover tooltip naming what it does. */
|
|
43
54
|
function ConversationActions({ itemId, editing, canRename, canDelete, onRename, onDelete, t }) {
|
|
44
|
-
return _jsxs(_Fragment, { children: [canRename && !editing ? _jsx("button", { type: "button", className: "jini-conv-item-rename", "aria-label": t('Rename chat'), "data-testid": `conversation-rename-button-${itemId}`, onClick: onRename, children: _jsx(Icon, { name: "pencil", size: 12 }) }) : null, canDelete ? _jsx("button", { type: "button", className: "jini-conv-item-delete", "aria-label": t('Delete conversation'), "data-testid": `conversation-delete-${itemId}`, onClick: (event) => {
|
|
55
|
+
return _jsxs(_Fragment, { children: [canRename && !editing ? _jsx("button", { type: "button", className: "jini-conv-item-rename", "aria-label": t('Rename chat'), title: t('Rename chat'), "data-testid": `conversation-rename-button-${itemId}`, onClick: onRename, children: _jsx(Icon, { name: "pencil", size: 12 }) }) : null, canDelete ? _jsx("button", { type: "button", className: "jini-conv-item-delete", "aria-label": t('Delete conversation'), title: t('Delete conversation'), "data-testid": `conversation-delete-${itemId}`, onClick: (event) => {
|
|
45
56
|
event.stopPropagation();
|
|
46
57
|
onDelete();
|
|
47
58
|
}, children: _jsx(Icon, { name: "close", size: 12 }) }) : null] });
|
|
@@ -65,7 +76,7 @@ function nextSelection({ selectedIds, visible, anchorId, itemId, shiftKey }) {
|
|
|
65
76
|
}
|
|
66
77
|
function SelectCheckbox({ item, view, t, selectedIds, onSelectionChange }) {
|
|
67
78
|
const { visible, selectionAnchor } = view;
|
|
68
|
-
return _jsx("button", { type: "button", role: "checkbox", "aria-checked": selectedIds?.includes(item.id) ?? false, "aria-label": `${t('Select')} ${item.title ?? t('Untitled')}`, onClick: event => {
|
|
79
|
+
return _jsx("button", { type: "button", role: "checkbox", className: "jini-conv-item-check", "aria-checked": selectedIds?.includes(item.id) ?? false, "aria-label": `${t('Select')} ${item.title ?? t('Untitled')}`, onClick: event => {
|
|
69
80
|
// Optimistic state belongs to the host, which also owns persistence and rejection handling.
|
|
70
81
|
const selected = nextSelection({ selectedIds, visible, anchorId: selectionAnchor.current, itemId: item.id, shiftKey: event.shiftKey });
|
|
71
82
|
selectionAnchor.current = item.id;
|
|
@@ -81,14 +92,24 @@ function ConversationItemBody({ item, view, t, onRename }) {
|
|
|
81
92
|
}
|
|
82
93
|
function ConversationRow({ item, view, t, activeConversationId, selectable, selectedIds, onSelectionChange, onTogglePin, onRename, onDelete }) {
|
|
83
94
|
const { editingId, startRename, requestDelete } = view;
|
|
84
|
-
return (_jsxs("div", { className: `jini-conv-item${item.id === activeConversationId ? ' jini-conv-item-active' : ''}`, "data-testid": `conversation-item-${item.id}`, children: [selectable ? _jsx(SelectCheckbox, { item: item, view: view, t: t, selectedIds: selectedIds, onSelectionChange: onSelectionChange }) : null,
|
|
95
|
+
return (_jsxs("div", { className: `jini-conv-item${item.id === activeConversationId ? ' jini-conv-item-active' : ''}`, "data-testid": `conversation-item-${item.id}`, children: [selectable ? _jsx(SelectCheckbox, { item: item, view: view, t: t, selectedIds: selectedIds, onSelectionChange: onSelectionChange }) : null, _jsx(ConversationItemBody, { item: item, view: view, t: t, onRename: onRename }), onTogglePin ? _jsx(PinButton, { item: item, t: t, onTogglePin: onTogglePin }) : null, _jsx(ConversationActions, { itemId: item.id, editing: editingId === item.id, canRename: Boolean(onRename), canDelete: Boolean(onDelete), onRename: () => startRename(item.id), onDelete: () => requestDelete(item), t: t })] }));
|
|
96
|
+
}
|
|
97
|
+
/** The open menu's heading with its count and "New", then the search field. */
|
|
98
|
+
function ConversationMenuHead({ view, t, createDisabled }) {
|
|
99
|
+
const { query, setQuery, conversations, createConversation } = view;
|
|
100
|
+
return _jsxs(_Fragment, { children: [_jsxs("div", { className: "jini-conv-head", children: [_jsxs("span", { className: "jini-conv-heading", children: [t('Conversations'), _jsx("span", { className: "jini-conv-count", "data-testid": "conversation-count", children: conversations.length })] }), _jsxs("button", { type: "button", className: "jini-conv-new", disabled: createDisabled, "data-testid": "conversation-new",
|
|
101
|
+
// `disabled` alone guards this: a disabled button never dispatches a click.
|
|
102
|
+
onClick: createConversation, children: [_jsx(Icon, { name: "plus", size: 12 }), _jsx("span", { children: t('New') })] })] }), _jsxs("label", { className: "jini-conv-search", children: [_jsx(Icon, { name: "search", size: 13 }), _jsx("input", { type: "search", value: query, placeholder: t('Search conversations'), "data-testid": "conversation-search", onChange: (event) => setQuery(event.currentTarget.value) })] })] });
|
|
103
|
+
}
|
|
104
|
+
/** The menu's scrolling rows (or its empty line), then the host's selection actions while ticking. */
|
|
105
|
+
function ConversationRows({ view, t, selectionActions, ...rowProps }) {
|
|
106
|
+
const { conversations, visible, emptyLabel } = view;
|
|
107
|
+
return _jsxs(_Fragment, { children: [_jsx("div", { className: "jini-conv-list", "data-testid": "conversation-list", children: conversations.length === 0 || visible.length === 0 ? (_jsx("div", { className: "jini-conv-empty", children: emptyLabel() })) : (visible.map((item) => _jsx(ConversationRow, { item: item, view: view, t: t, ...rowProps }, item.id))) }), rowProps.selectable && selectionActions ? (_jsx("div", { className: "jini-conv-selection-actions", "data-testid": "conversation-selection-actions", children: selectionActions })) : null] });
|
|
85
108
|
}
|
|
86
|
-
export function ConversationList({ conversations: savedConversations, activeConversationId, onSelect, onCreate, onDelete, onRename, onSearch, confirmDelete, createDisabled = false, emptyState, triggerLabel, nativeTitle = true, hooks, report, selectable, selectedIds, onTogglePin, onSelectionChange, }, _optional = {}) {
|
|
109
|
+
export function ConversationList({ conversations: savedConversations, activeConversationId, onSelect, onCreate, onDelete, onRename, onSearch, confirmDelete, createDisabled = false, emptyState, triggerLabel, nativeTitle = true, hooks, report, selectable, selectedIds, onTogglePin, onSelectionChange, selectionActions, }, _optional = {}) {
|
|
87
110
|
const t = hooks.useT();
|
|
88
111
|
const view = hooks.useConversationListView({ savedConversations, activeConversationId, onSelect, onCreate, onDelete, onRename, onSearch, confirmDelete, emptyState, t }, { report });
|
|
89
|
-
const { open, setOpen,
|
|
90
|
-
return (_jsxs("div", { className: "jini-conv", ref: rootRef, children: [_jsx("button", { type: "button", className: `jini-conv-trigger${open ? ' jini-conv-trigger-open' : ''}`, "aria-haspopup": "menu", "aria-expanded": open, ...conversationTriggerAttributes({ activeTitle: active?.title, t }, { label: triggerLabel, nativeTitle }), "data-testid": "conversation-trigger", onClick: () => setOpen((v) => !v), children: _jsx(Icon, { name: "comment", size: 16 }) }), open ? (_jsxs("div", { className: "jini-conv-menu", role: "menu", "data-testid": "conversation-menu", children: [
|
|
91
|
-
// `disabled` alone guards this: a disabled button never dispatches a click.
|
|
92
|
-
onClick: createConversation, children: [_jsx(Icon, { name: "plus", size: 12 }), _jsx("span", { children: t('New') })] })] }), _jsxs("label", { className: "jini-conv-search", children: [_jsx(Icon, { name: "search", size: 13 }), _jsx("input", { type: "search", value: query, placeholder: t('Search conversations'), "data-testid": "conversation-search", onChange: (event) => setQuery(event.currentTarget.value) })] }), _jsx("div", { className: "jini-conv-list", "data-testid": "conversation-list", children: conversations.length === 0 || visible.length === 0 ? (_jsx("div", { className: "jini-conv-empty", children: emptyLabel() })) : (visible.map((item) => (_jsx(ConversationRow, { item: item, view: view, t: t, activeConversationId: activeConversationId, selectable: selectable, selectedIds: selectedIds, onSelectionChange: onSelectionChange, onTogglePin: onTogglePin, onRename: onRename, onDelete: onDelete }, item.id)))) })] })) : null] }));
|
|
112
|
+
const { open, setOpen, active, rootRef } = view;
|
|
113
|
+
return (_jsxs("div", { className: "jini-conv", ref: rootRef, children: [_jsx("button", { type: "button", className: `jini-conv-trigger${open ? ' jini-conv-trigger-open' : ''}`, "aria-haspopup": "menu", "aria-expanded": open, ...conversationTriggerAttributes({ activeTitle: active?.title, t }, { label: triggerLabel, nativeTitle }), "data-testid": "conversation-trigger", onClick: () => setOpen((v) => !v), children: _jsx(Icon, { name: "comment", size: 16 }) }), open ? (_jsxs("div", { className: "jini-conv-menu", role: "menu", "data-testid": "conversation-menu", children: [_jsx(ConversationMenuHead, { view: view, t: t, createDisabled: createDisabled }), _jsx(ConversationRows, { view: view, t: t, activeConversationId: activeConversationId, selectable: selectable, selectedIds: selectedIds, onSelectionChange: onSelectionChange, onTogglePin: onTogglePin, onRename: onRename, onDelete: onDelete, selectionActions: selectionActions })] })) : null] }));
|
|
93
114
|
}
|
|
94
115
|
//# sourceMappingURL=ConversationList.js.map
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* AgentIcon and WorkingDirPicker.
|
|
8
8
|
*/
|
|
9
9
|
import type { SVGProps } from 'react';
|
|
10
|
-
export type IconName = 'spinner' | 'check' | 'close' | 'chevron-down' | 'chevron-left' | 'chevron-right' | 'attach' | 'folder' | 'file' | 'image' | 'x' | 'comment' | 'search' | 'plus' | 'pencil' | 'copy' | 'external-link' | 'retry';
|
|
10
|
+
export type IconName = 'spinner' | 'check' | 'close' | 'chevron-down' | 'chevron-left' | 'chevron-right' | 'attach' | 'folder' | 'file' | 'image' | 'x' | 'comment' | 'search' | 'plus' | 'pencil' | 'copy' | 'external-link' | 'retry' | 'pin' | 'broom';
|
|
11
11
|
interface IconProps extends Omit<SVGProps<SVGSVGElement>, 'name'> {
|
|
12
12
|
name: IconName;
|
|
13
13
|
size?: number | string;
|
|
@@ -23,6 +23,11 @@ const ICON_GLYPHS = {
|
|
|
23
23
|
copy: _jsxs(_Fragment, { children: [_jsx("rect", { width: "14", height: "14", x: "8", y: "8", rx: "2", ry: "2" }), _jsx("path", { d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2" })] }),
|
|
24
24
|
/** The small "open in new tab" arrow after a link to the owner's own site or admin (MarkdownLink.tsx). */
|
|
25
25
|
'external-link': _jsxs(_Fragment, { children: [_jsx("path", { d: "M7 17 17 7" }), _jsx("path", { d: "M8 7h9v9" })] }),
|
|
26
|
+
/** A conversation row's pin toggle (ConversationList.tsx). Drawn as one closed head so a caller's
|
|
27
|
+
* `fill="currentColor"` turns the outline (unpinned) into the solid pin (pinned) with no second glyph. */
|
|
28
|
+
pin: _jsxs(_Fragment, { children: [_jsx("path", { d: "M12 17v5" }), _jsx("path", { d: "M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z" })] }),
|
|
29
|
+
/** "Clean up chats" in the chat settings (ChatCleanupPanel.tsx): a broom reads as tidying, not deleting. */
|
|
30
|
+
broom: _jsxs(_Fragment, { children: [_jsx("path", { d: "m16 22-1-4" }), _jsx("path", { d: "M19 14a1 1 0 0 0 1-1v-1a2 2 0 0 0-2-2h-3a1 1 0 0 1-1-1V4a2 2 0 0 0-4 0v5a1 1 0 0 1-1 1H6a2 2 0 0 0-2 2v1a1 1 0 0 0 1 1" }), _jsx("path", { d: "M5 14h14l1.97 6.77A1 1 0 0 1 20 22H4a1 1 0 0 1-.97-1.23z" }), _jsx("path", { d: "m8 22 1-4" })] }),
|
|
26
31
|
};
|
|
27
32
|
export function Icon({ name, size = 14, strokeWidth = 1.6, ...rest }) {
|
|
28
33
|
// The spinner alone puts its spin class in front of any caller-supplied one.
|
|
@@ -127,6 +127,34 @@ button.jini-chat-settings-segment:hover { opacity: 1; }
|
|
|
127
127
|
padding: 0.375rem 1rem 0.5rem 1.75rem; border: 1px solid var(--jini-chat-settings-border, #d9dce2); border-top: 0;
|
|
128
128
|
border-radius: 0 0 var(--jini-chat-radius-lg, 12px) var(--jini-chat-radius-lg, 12px);
|
|
129
129
|
}
|
|
130
|
+
/* Chat cleanup (ChatCleanupPanel, mounted in the Display tab's `displayExtra` slot; owner 2026-11-29
|
|
131
|
+
moved it here from the dock header). One labelled broom row like the switch rows above, set off by
|
|
132
|
+
a rule; opening it shows the age cleanup in a bordered card, the same card idiom as Full CLI access. */
|
|
133
|
+
.jini-chat-cleanup {
|
|
134
|
+
display: flex; flex-direction: column; align-items: flex-start; gap: 0.75rem;
|
|
135
|
+
margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--jini-chat-settings-border, #d9dce2);
|
|
136
|
+
}
|
|
137
|
+
.jini-chat-settings-dialog .jini-chat-cleanup-toggle {
|
|
138
|
+
display: inline-flex; align-items: center; gap: 0.5rem; min-width: 0; min-height: 0;
|
|
139
|
+
margin-left: -0.5rem; padding: 0.375rem 0.625rem 0.375rem 0.5rem;
|
|
140
|
+
border: 0; border-radius: var(--jini-chat-radius, 8px); background: transparent; box-shadow: none;
|
|
141
|
+
color: var(--jini-chat-settings-fg, #1a1916); font: inherit; font-size: 0.9375rem; line-height: 1.4; cursor: pointer;
|
|
142
|
+
}
|
|
143
|
+
.jini-chat-cleanup-toggle svg { flex: none; color: var(--jini-chat-settings-muted, #676767); }
|
|
144
|
+
.jini-chat-settings-dialog .jini-chat-cleanup-toggle:hover { background: var(--jini-chat-settings-subtle, #f4f5f7); }
|
|
145
|
+
.jini-chat-cleanup-toggle:hover svg, .jini-chat-cleanup-toggle[aria-expanded="true"] svg { color: var(--jini-chat-settings-fg, #1a1916); }
|
|
146
|
+
.jini-chat-settings-dialog .jini-chat-cleanup-toggle:focus-visible { outline: 2px solid var(--jini-chat-settings-accent, #3b66c4); outline-offset: 2px; }
|
|
147
|
+
.jini-chat-cleanup-panel {
|
|
148
|
+
box-sizing: border-box; display: flex; flex-direction: column; gap: 0.75rem; width: 100%;
|
|
149
|
+
padding: 0.875rem 1rem; border: 1px solid var(--jini-chat-settings-border, #d9dce2); border-radius: var(--jini-chat-radius-lg, 12px);
|
|
150
|
+
font-size: var(--jini-font-size-sm, 0.875rem);
|
|
151
|
+
}
|
|
152
|
+
.jini-chat-cleanup-age { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; }
|
|
153
|
+
.jini-chat-cleanup-age input { box-sizing: border-box; width: 5rem; font: inherit; }
|
|
154
|
+
.jini-chat-cleanup-preview { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
|
|
155
|
+
.jini-chat-cleanup-preview > p, .jini-chat-cleanup-preview > ul { flex-basis: 100%; margin: 0; }
|
|
156
|
+
.jini-chat-cleanup-preview > ul { padding-left: 1.1rem; color: var(--jini-chat-settings-muted, #676767); }
|
|
157
|
+
.jini-chat-cleanup-error { margin: 0; font-size: var(--jini-font-size-sm, 0.875rem); color: var(--jini-chat-settings-danger, #b42318); }
|
|
130
158
|
/* Help has its own touch target, outside every setting's button or label. The 44px target is an
|
|
131
159
|
invisible hit area (17.6px icon + 2 × 13px), not a wider icon: sizing the icon itself to 44px
|
|
132
160
|
added ~80px to the Tool calls pill and wrapped it onto two rows in a 390px dialog. The ≤640px
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jini-ai/chat",
|
|
3
|
-
"version": "0.7.3-next.
|
|
3
|
+
"version": "0.7.3-next.4",
|
|
4
4
|
"description": "Jini's chat/artifact frontend, consolidated into one package with two subpaths: framework-free chat vocabulary and pure parsers in `/core`, headless hooks + presentational components + slots in `/react`. Import only the layer you need.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -339,10 +339,10 @@
|
|
|
339
339
|
},
|
|
340
340
|
"dependencies": {
|
|
341
341
|
"kysely": "^0.29.6",
|
|
342
|
+
"@jini-ai/core": "^0.7.3-next.3",
|
|
342
343
|
"@jini-ai/db": "^0.7.3-next.3",
|
|
343
344
|
"@jini-ai/diagnostics": "^0.7.3-next.3",
|
|
344
|
-
"@jini-ai/protocol": "^0.7.3-next.3"
|
|
345
|
-
"@jini-ai/core": "^0.7.3-next.3"
|
|
345
|
+
"@jini-ai/protocol": "^0.7.3-next.3"
|
|
346
346
|
},
|
|
347
347
|
"peerDependencies": {
|
|
348
348
|
"react": "^18.3.0 || ^19.0.0",
|
|
@@ -388,11 +388,11 @@
|
|
|
388
388
|
"@jini-ai/ui-kit": "^0.7.3-next.3",
|
|
389
389
|
"@jini-ai/db": "0.7.3-next.3",
|
|
390
390
|
"@jini-ai/agent-runtime": "0.7.3-next.3",
|
|
391
|
-
"@jini-ai/agentic": "^0.7.3-next.3",
|
|
392
391
|
"@jini-ai/protocol": "^0.7.3-next.3",
|
|
392
|
+
"@jini-ai/agentic": "^0.7.3-next.3",
|
|
393
|
+
"@jini-ai/core": "^0.7.3-next.3",
|
|
393
394
|
"@jini-ai/ui": "^0.7.3-next.3",
|
|
394
|
-
"@jini-ai/diagnostics": "^0.7.3-next.3"
|
|
395
|
-
"@jini-ai/core": "^0.7.3-next.3"
|
|
395
|
+
"@jini-ai/diagnostics": "^0.7.3-next.3"
|
|
396
396
|
},
|
|
397
397
|
"typesVersions": {
|
|
398
398
|
"*": {
|