@duskmoon-dev/components 0.6.0 → 0.6.1
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 +27 -3
- package/dist/{chunk-b1jnq16e.js → chunk-rd10x4gc.js} +6 -0
- package/dist/components/chat/Chat.types.d.ts +7 -0
- package/dist/components/chat/ChatSessionComposer.types.d.ts +4 -0
- package/dist/components/chat/ComposerProvider.types.d.ts +4 -0
- package/dist/components/chat/composer/CompletionList.d.ts +6 -1
- package/dist/components/chat/composer/ComposerShell.d.ts +4 -0
- package/dist/components/chat/composer/DraftLifecycle.d.ts +3 -1
- package/dist/components/chat/index.js +826 -659
- package/dist/components/chat/rich/index.js +644 -603
- package/dist/generated/version.d.ts +1 -1
- package/dist/index.js +1939 -1540
- package/dist/infrastructure.js +1 -1
- package/dist/styles.css +180 -2
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -70,7 +70,7 @@ Chat docs include RTL, live states, tool statuses, message actions and the Core
|
|
|
70
70
|
`Chat.Work`, `Chat.WorkSummary` and `Chat.WorkBody` disclosures, keeping the final
|
|
71
71
|
answer outside them. User messages use `Chat placement="end"` and `Chat.Bubble`;
|
|
72
72
|
opt into `collapsible` for automatic six-line measurement, resize/text updates,
|
|
73
|
-
accessible expansion and focus cleanup. The package now requires Core 1.21.
|
|
73
|
+
accessible expansion and focus cleanup. The package now requires Core 1.21.1,
|
|
74
74
|
which supplies the shared Composer editor, attachment, suggestion and status parts.
|
|
75
75
|
|
|
76
76
|
`Chat.InputArea` attaches a controlled `Chat.Queue` to native
|
|
@@ -92,6 +92,22 @@ repositories or conversations: a late acceptance or error from the previous
|
|
|
92
92
|
scope cannot clear the current draft or call its error handler. Pending admission
|
|
93
93
|
leaves editing available. The host still owns the controlled draft and files.
|
|
94
94
|
|
|
95
|
+
Composer actions use icon buttons with accessible names and `title` hints in both
|
|
96
|
+
layouts. `attachLabel`, `sendLabel` and `stopLabel` customize those names and hints.
|
|
97
|
+
Attachment retry/cancel/remove and default queue actions follow the same pattern.
|
|
98
|
+
The shared composer padding is 0.5rem.
|
|
99
|
+
|
|
100
|
+
Set `compact` on `Chat.Composer`, `ChatSessionComposer` or `RichChatComposer`
|
|
101
|
+
for a compact toolbar with accessible icon buttons and a horizontal strip of
|
|
102
|
+
simple ready-image thumbnails. Mixed files, preparation, errors and custom
|
|
103
|
+
attachment renderers retain full rows. The default wrapping layout remains
|
|
104
|
+
available. Compose host-owned settings through `children`, using Core's native
|
|
105
|
+
`popover chat-composer-menu` classes when a configuration menu is needed.
|
|
106
|
+
The compact `+` opens a native Add menu for files, explicit draft save/reload
|
|
107
|
+
and optional `addMenu` content. Routine save/admission status is announced without
|
|
108
|
+
adding rows. Its primary button sends an eligible draft or stops the running turn
|
|
109
|
+
when submission is unavailable; the default layout retains separate controls.
|
|
110
|
+
|
|
95
111
|
Root and `/chat` exports also provide editor-independent `ComposerDocument`,
|
|
96
112
|
`ComposerDraft`, submission/receipt, provider, attachment and queue types.
|
|
97
113
|
`readComposerDocument` and `readComposerDraft` preserve incompatible input for
|
|
@@ -175,7 +191,15 @@ belong to the application. The UI never automatically overwrites incompatible
|
|
|
175
191
|
stored content.
|
|
176
192
|
|
|
177
193
|
`providers` supply scoped asynchronous candidates, disabled reasons, directory
|
|
178
|
-
drill-down and insert/invoke actions.
|
|
194
|
+
drill-down and insert/invoke actions. In compact mode, results open in a native
|
|
195
|
+
popover above the composer, with grouped rows, keyboard navigation, filtering and
|
|
196
|
+
native dismissal. Optional provider `icon` and `sourceLabel` decorate the rows;
|
|
197
|
+
they never enter portable documents or submissions. Use a leading `/` provider
|
|
198
|
+
for skills and commands: skills insert editable instructions, rich claimed
|
|
199
|
+
commands retain their identity until submission, and `invoke` actions call
|
|
200
|
+
`onProviderInvoke` independently. The plain editor supports text skills and host
|
|
201
|
+
invocation; claimed commands require the rich editor.
|
|
202
|
+
The host resolves and authorizes references,
|
|
179
203
|
quote provenance, commands and attachment handles; portable validity is not
|
|
180
204
|
authorization. `ChatAuthoritativeQueue` renders confirmed projections and requests
|
|
181
205
|
revision-checked edit/remove/promote mutations. Apply canonical projections through
|
|
@@ -186,7 +210,7 @@ idempotency, persistence and execution policy. The Chat documentation includes
|
|
|
186
210
|
interactive fake-host examples with real local state transitions; their memory
|
|
187
211
|
storage survives editor remounts only and makes no durable delivery claim.
|
|
188
212
|
|
|
189
|
-
Core 1.21.
|
|
213
|
+
Core 1.21.1 still has a known Moonlight contrast gap for neutral outlined/ghost
|
|
190
214
|
labels ([duskmoonui#78](https://github.com/duskmoon-dev/duskmoonui/issues/78)).
|
|
191
215
|
The upstream fix is required before claiming complete palette accessibility.
|
|
192
216
|
|
|
@@ -458,6 +458,8 @@ var LexicalEditor = forwardRef((props, ref) => {
|
|
|
458
458
|
const emitted = useRef(undefined);
|
|
459
459
|
const documentSignature = useRef("");
|
|
460
460
|
const selectionSignature = useRef("");
|
|
461
|
+
const minimumRows = Math.max(1, Math.floor(props.minRows ?? 1));
|
|
462
|
+
const maximumRows = Math.max(minimumRows, Math.floor(props.maxRows ?? 6));
|
|
461
463
|
useLayoutEffect(() => {
|
|
462
464
|
latest.current = props;
|
|
463
465
|
});
|
|
@@ -685,6 +687,10 @@ var LexicalEditor = forwardRef((props, ref) => {
|
|
|
685
687
|
ref: rootRef,
|
|
686
688
|
id: props.id,
|
|
687
689
|
className: "chat-composer-editor",
|
|
690
|
+
style: {
|
|
691
|
+
minBlockSize: `${minimumRows}lh`,
|
|
692
|
+
maxBlockSize: `${maximumRows}lh`
|
|
693
|
+
},
|
|
688
694
|
role: "textbox",
|
|
689
695
|
tabIndex: 0,
|
|
690
696
|
"aria-multiline": "true",
|
|
@@ -103,6 +103,9 @@ export interface ChatComposerSubmission {
|
|
|
103
103
|
export interface ChatComposerCompletion {
|
|
104
104
|
id: string;
|
|
105
105
|
label: string;
|
|
106
|
+
/** Optional presentation; never part of the submitted document. */
|
|
107
|
+
icon?: ReactNode;
|
|
108
|
+
sourceLabel?: string;
|
|
106
109
|
description?: ReactNode;
|
|
107
110
|
disabled?: boolean;
|
|
108
111
|
group?: string;
|
|
@@ -148,6 +151,10 @@ export interface ChatComposerProps extends Omit<ComponentProps<"div">, "children
|
|
|
148
151
|
multiple?: boolean;
|
|
149
152
|
/** Permit a draft containing only files. @default false */
|
|
150
153
|
allowAttachmentOnly?: boolean;
|
|
154
|
+
/** Compact Add menu, one send/stop action and ready-image strip. @default false */
|
|
155
|
+
compact?: boolean;
|
|
156
|
+
/** Additional actions in the compact Add menu. */
|
|
157
|
+
addMenu?: ReactNode;
|
|
151
158
|
disabled?: boolean;
|
|
152
159
|
/** Gates submission while keeping the draft editable. */
|
|
153
160
|
busy?: boolean;
|
|
@@ -26,6 +26,10 @@ export interface ChatSessionComposerProps extends Omit<ComponentProps<"div">, "c
|
|
|
26
26
|
readonly busy?: boolean;
|
|
27
27
|
readonly canSubmit?: boolean;
|
|
28
28
|
readonly allowAttachmentOnly?: boolean;
|
|
29
|
+
/** Compact Add menu, one send/stop action and ready-image strip. @default false */
|
|
30
|
+
readonly compact?: boolean;
|
|
31
|
+
/** Additional actions in the compact Add menu. */
|
|
32
|
+
readonly addMenu?: ReactNode;
|
|
29
33
|
readonly onStop?: () => void;
|
|
30
34
|
readonly label?: string;
|
|
31
35
|
readonly attachLabel?: string;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
1
2
|
import type { ComposerDocument, ComposerError, ComposerProvider, ComposerProviderAction, ComposerProviderCandidate, ComposerProviderRequest, ComposerProviderResult, ComposerScope } from "./Composer.types";
|
|
2
3
|
export interface ComposerProviderBreadcrumb {
|
|
3
4
|
readonly refId: string;
|
|
@@ -10,6 +11,9 @@ export interface ComposerProviderNavigation {
|
|
|
10
11
|
}
|
|
11
12
|
export interface ComposerCompletionProvider extends ComposerProvider {
|
|
12
13
|
readonly label?: string;
|
|
14
|
+
/** Presentation only; these values do not enter the portable protocol. */
|
|
15
|
+
readonly icon?: ReactNode;
|
|
16
|
+
readonly sourceLabel?: string;
|
|
13
17
|
/** Commands and editable skills can share a marker with distinct providers. */
|
|
14
18
|
readonly trigger: {
|
|
15
19
|
readonly text: string;
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { ChatComposerCompletion } from "../Chat.types";
|
|
3
3
|
export declare function completionOptionId(composerId: string, candidateId: string): string;
|
|
4
|
-
export declare function CompletionList({ composerId, label, candidates, activeId, onSelect, }: {
|
|
4
|
+
export declare function CompletionList({ composerId, label, candidates, activeId, onSelect, compact, anchorName, header, status, onDismiss, }: {
|
|
5
5
|
composerId: string;
|
|
6
6
|
label: string;
|
|
7
7
|
candidates: readonly ChatComposerCompletion[];
|
|
8
8
|
activeId?: string;
|
|
9
9
|
onSelect: (item: ChatComposerCompletion) => void;
|
|
10
|
+
compact?: boolean;
|
|
11
|
+
anchorName?: string;
|
|
12
|
+
header?: React.ReactNode;
|
|
13
|
+
status?: React.ReactNode;
|
|
14
|
+
onDismiss?: () => void;
|
|
10
15
|
}): React.JSX.Element;
|
|
@@ -15,6 +15,8 @@ export interface ComposerShellAttachment {
|
|
|
15
15
|
interface ComposerShellProps extends Omit<React.ComponentProps<"div">, "children" | "onSubmit"> {
|
|
16
16
|
editor: React.ReactNode;
|
|
17
17
|
composerId: string;
|
|
18
|
+
compact?: boolean;
|
|
19
|
+
addMenu?: React.ReactNode;
|
|
18
20
|
entries: readonly ComposerShellAttachment[];
|
|
19
21
|
renderAttachment?: ChatComposerProps["renderAttachment"];
|
|
20
22
|
removeAttachment: (id: number | string) => void;
|
|
@@ -33,12 +35,14 @@ interface ComposerShellProps extends Omit<React.ComponentProps<"div">, "children
|
|
|
33
35
|
active?: ChatComposerCompletion;
|
|
34
36
|
showCompletion: boolean;
|
|
35
37
|
selectCompletion: (item: ChatComposerCompletion) => void;
|
|
38
|
+
dismissCompletion?: () => void;
|
|
36
39
|
visibleError: React.ReactNode;
|
|
37
40
|
hasError: boolean;
|
|
38
41
|
intakeEvents?: boolean;
|
|
39
42
|
completionHeader?: React.ReactNode;
|
|
40
43
|
completionStatus?: React.ReactNode;
|
|
41
44
|
statusContent?: React.ReactNode;
|
|
45
|
+
renderFooter?: (renderToolbar: (menuContent?: React.ReactNode) => React.ReactNode) => React.ReactNode;
|
|
42
46
|
attachLabel: string;
|
|
43
47
|
sendLabel: string;
|
|
44
48
|
stopLabel: string;
|
|
@@ -11,7 +11,9 @@ interface Props {
|
|
|
11
11
|
attachments: ComposerAttachmentController;
|
|
12
12
|
onDocumentChange: (value: ComposerDocumentUpdate) => void;
|
|
13
13
|
disabled: boolean;
|
|
14
|
+
compact?: boolean;
|
|
15
|
+
children: (feedback: React.ReactNode, menuActions?: React.ReactNode) => React.ReactNode;
|
|
14
16
|
}
|
|
15
17
|
/** Host storage is optional; no autosave cadence or browser storage is assumed. */
|
|
16
|
-
export declare function DraftLifecycle({ adapter, scope, draftKey, generation, value, attachments, onDocumentChange, disabled, }: Props): React.
|
|
18
|
+
export declare function DraftLifecycle({ adapter, scope, draftKey, generation, value, attachments, onDocumentChange, disabled, compact, children, }: Props): React.ReactNode;
|
|
17
19
|
export {};
|