@duskmoon-dev/components 0.5.2 → 0.5.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/README.md CHANGED
@@ -64,11 +64,40 @@ the supported `badge-outline` alias.
64
64
  Pair assistant rows and indicator buttons with timeline slots 1–24; user rows
65
65
  do not need ticks. `Chat.Status` and `Chat.Actions` accept ordinary content and
66
66
  button callbacks, so the application owns generation state and metrics. The
67
- Chat docs show all ten Core 1.20.3 showcases, including RTL bubbles, live states,
68
- tool statuses, and message actions. For an LLM reply, place reasoning and tool
69
- details inside one `Chat.Bubble`, with final content in
70
- `.chat-bubble-content`. The new Chat styles and the `Avatar` `2xl` size require
71
- Core 1.20.3 or newer.
67
+ Chat docs include RTL, live states, tool statuses, message actions and the Core
68
+ 1.20.6 agent, queue and long-message contracts. Use `Chat.Agent` with
69
+ `Chat.Content` for unboxed assistant answers. Group activity in native
70
+ `Chat.Work`, `Chat.WorkSummary` and `Chat.WorkBody` disclosures, keeping the final
71
+ answer outside them. User messages use `Chat placement="end"` and `Chat.Bubble`;
72
+ opt into `collapsible` for automatic six-line measurement, resize/text updates,
73
+ accessible expansion and focus cleanup. All new Chat primitives require Core
74
+ 1.20.6, which is the package peer minimum.
75
+
76
+ `Chat.InputArea` attaches a controlled `Chat.Queue` to native
77
+ `Chat.ComposerForm`, `Chat.ComposerInput`, `Chat.ComposerActions` and
78
+ `Chat.ComposerHint` primitives. Queue items have stable `id`/`text` values and
79
+ optional `{ src, alt }` attachments. `onSteer` and `onRemove` request application
80
+ actions; the component never dequeues locally. Supply `pendingIds` while awaiting
81
+ acknowledgment and update items only after success. Restore focus after removing
82
+ a focused row, and announce queue changes once in an application status region.
83
+ The application owns Enter/Shift+Enter/steering, IME guards, transport, ordering
84
+ and failure policy. The interactive docs demonstrate those actual state changes.
85
+
86
+ The existing controlled `Chat.Composer` retains its div ref, attachment and
87
+ completion APIs, revision-safe asynchronous draft clearing, and Cmd/Ctrl+Enter
88
+ submission with ordinary Enter for newlines. Use the native composer primitives
89
+ when form submission and the reference's Enter-to-queue contract are needed.
90
+ Existing `Chat.Bubble streaming` remains usable; `Chat.Content streaming` is the
91
+ preferred agent presentation. No public Chat API is removed or deprecated.
92
+
93
+ Normal `Tooltip` button/link triggers use native `interestfor`, hint popovers
94
+ and CSS anchors. Browsers must support those APIs; there is no feature polyfill.
95
+ Keep essential help inline. Controlled `open` uses native manual popovers;
96
+ non-invoker children retain the older imperative compatibility adapter. Custom
97
+ trigger components must forward `interestfor`, `style` and `aria-describedby`
98
+ to their native control. Tooltip content is brief and noninteractive; put links,
99
+ buttons and confirmation forms in Popover/Popconfirm. The existing deprecated
100
+ `arrow` prop remains accepted; native surfaces are arrowless.
72
101
 
73
102
  ```tsx
74
103
  import { Chat } from "@duskmoon-dev/components/chat";
@@ -86,8 +115,8 @@ export function Conversation() {
86
115
  <Chat.ScrollIndicator timeline={1} targetId={replyId} />
87
116
  </Chat.ScrollTrack>
88
117
  <Chat.ScrollBody>
89
- <Chat id={replyId} timeline={1}>
90
- <Chat.Bubble>The build passed.</Chat.Bubble>
118
+ <Chat.Agent id={replyId} timeline={1}>
119
+ <Chat.Content>The build passed.</Chat.Content>
91
120
  <Chat.Status>
92
121
  <Chat.StatusItem>Completed</Chat.StatusItem>
93
122
  <Chat.StatusItem>
@@ -99,7 +128,7 @@ export function Conversation() {
99
128
  Copy reply
100
129
  </button>
101
130
  </Chat.Actions>
102
- </Chat>
131
+ </Chat.Agent>
103
132
  </Chat.ScrollBody>
104
133
  </Chat.Scroll>
105
134
  );
@@ -1,5 +1,17 @@
1
1
  import type { ChatBubbleColor, ChatBubbleSize, ChatPlacement, ChatToolState } from "../components/chat/Chat.types";
2
2
  export declare const chatBaseClass = "chat";
3
+ export declare const chatAgentClass = "chat-agent";
4
+ export declare const chatContentClass = "chat-content";
5
+ export declare const chatStreamingClass = "chat-streaming";
6
+ export declare const chatWorkClass = "chat-work";
7
+ export declare const chatWorkSummaryClass = "chat-work-summary";
8
+ export declare const chatWorkBodyClass = "chat-work-body";
9
+ export declare const chatInputAreaClass = "chat-input-area";
10
+ export declare const chatQueueClass = "chat-queue";
11
+ export declare const chatComposerClass = "chat-composer";
12
+ export declare const chatComposerInputClass = "chat-composer-input";
13
+ export declare const chatComposerActionsClass = "chat-composer-actions";
14
+ export declare const chatComposerHintClass = "chat-composer-hint";
3
15
  export declare const chatAvatarClass = "chat-avatar";
4
16
  export declare const chatHeaderClass = "chat-header";
5
17
  export declare const chatBubbleBaseClass = "chat-bubble";
@@ -317,6 +317,18 @@ function getCardClasses({
317
317
  }
318
318
  // src/classes/chat.ts
319
319
  var chatBaseClass = "chat";
320
+ var chatAgentClass = "chat-agent";
321
+ var chatContentClass = "chat-content";
322
+ var chatStreamingClass = "chat-streaming";
323
+ var chatWorkClass = "chat-work";
324
+ var chatWorkSummaryClass = "chat-work-summary";
325
+ var chatWorkBodyClass = "chat-work-body";
326
+ var chatInputAreaClass = "chat-input-area";
327
+ var chatQueueClass = "chat-queue";
328
+ var chatComposerClass = "chat-composer";
329
+ var chatComposerInputClass = "chat-composer-input";
330
+ var chatComposerActionsClass = "chat-composer-actions";
331
+ var chatComposerHintClass = "chat-composer-hint";
320
332
  var chatAvatarClass = "chat-avatar";
321
333
  var chatHeaderClass = "chat-header";
322
334
  var chatBubbleBaseClass = "chat-bubble";
@@ -2911,6 +2923,7 @@ export {
2911
2923
  cascaderTagClass,
2912
2924
  chatActionsClass,
2913
2925
  chatActionsHoverClass,
2926
+ chatAgentClass,
2914
2927
  chatAvatarClass,
2915
2928
  chatBaseClass,
2916
2929
  chatBubbleBaseClass,
@@ -2918,9 +2931,16 @@ export {
2918
2931
  chatBubbleFilledClass,
2919
2932
  chatBubbleSizeClasses,
2920
2933
  chatBubbleStreamingClass,
2934
+ chatComposerActionsClass,
2935
+ chatComposerClass,
2936
+ chatComposerHintClass,
2937
+ chatComposerInputClass,
2938
+ chatContentClass,
2921
2939
  chatFooterClass,
2922
2940
  chatHeaderClass,
2941
+ chatInputAreaClass,
2923
2942
  chatPlacementClasses,
2943
+ chatQueueClass,
2924
2944
  chatReasoningClass,
2925
2945
  chatScrollBodyClass,
2926
2946
  chatScrollClass,
@@ -2929,6 +2949,7 @@ export {
2929
2949
  chatStatusClass,
2930
2950
  chatStatusItemClass,
2931
2951
  chatStatusValueClass,
2952
+ chatStreamingClass,
2932
2953
  chatToolBaseClass,
2933
2954
  chatToolCallClass,
2934
2955
  chatToolHeaderClass,
@@ -2936,6 +2957,9 @@ export {
2936
2957
  chatToolStateClasses,
2937
2958
  chatToolStatusClass,
2938
2959
  chatTypingClass,
2960
+ chatWorkBodyClass,
2961
+ chatWorkClass,
2962
+ chatWorkSummaryClass,
2939
2963
  checkboxBaseClass,
2940
2964
  checkboxBoxBaseClass,
2941
2965
  checkboxCheckmarkClass,
@@ -38,6 +38,47 @@ export interface ChatBubbleProps extends ComponentProps<"div"> {
38
38
  filled?: boolean;
39
39
  /** Show the live streaming caret after the bubble content. */
40
40
  streaming?: boolean;
41
+ /** Collapse sent user messages exceeding six rendered lines. */
42
+ collapsible?: boolean;
43
+ expanded?: boolean;
44
+ defaultExpanded?: boolean;
45
+ onExpandedChange?: (expanded: boolean) => void;
46
+ }
47
+ export type ChatAgentProps = Omit<ChatProps, "placement">;
48
+ export interface ChatContentProps extends ComponentProps<"div"> {
49
+ streaming?: boolean;
50
+ }
51
+ export type ChatWorkProps = ComponentProps<"details">;
52
+ export type ChatWorkSummaryProps = ComponentProps<"summary">;
53
+ export type ChatWorkBodyProps = ComponentProps<"div">;
54
+ export type ChatInputAreaProps = ComponentProps<"div">;
55
+ export type ChatComposerColor = "primary" | "secondary" | "tertiary" | "info" | "success" | "warning" | "error";
56
+ export interface ChatComposerFormProps extends ComponentProps<"form"> {
57
+ color?: ChatComposerColor;
58
+ ghost?: boolean;
59
+ }
60
+ export type ChatComposerInputProps = ComponentProps<"textarea">;
61
+ export type ChatComposerActionsProps = ComponentProps<"div">;
62
+ export type ChatComposerHintProps = ComponentProps<"kbd">;
63
+ export interface ChatQueueItem {
64
+ id: string;
65
+ text: string;
66
+ attachment?: {
67
+ src: string;
68
+ alt: string;
69
+ };
70
+ }
71
+ export interface ChatQueueProps extends Omit<ComponentProps<"section">, "children"> {
72
+ items: readonly ChatQueueItem[];
73
+ /** Stable identity of the next message; defaults to the first item. */
74
+ activeId?: string;
75
+ /** The application owns pending state and removes messages after acknowledgment. */
76
+ pendingIds?: readonly string[];
77
+ steerDisabled?: boolean;
78
+ onSteer: (id: string) => void;
79
+ onRemove: (id: string) => void;
80
+ /** Accessible queue name. @default "Waiting messages" */
81
+ label?: string;
41
82
  }
42
83
  export type ChatReasoningProps = ComponentProps<"details">;
43
84
  export interface ChatToolProps extends ComponentProps<"details"> {
@@ -124,6 +165,17 @@ export interface ChatComposerProps extends Omit<ComponentProps<"div">, "children
124
165
  type ChatPartComponent<T extends HTMLElement, P> = ForwardRefExoticComponent<P & RefAttributes<T>>;
125
166
  export type ChatComponent = ChatPartComponent<HTMLDivElement, ChatProps> & {
126
167
  Composer: ChatPartComponent<HTMLDivElement, ChatComposerProps>;
168
+ Agent: ChatPartComponent<HTMLDivElement, ChatAgentProps>;
169
+ Content: ChatPartComponent<HTMLDivElement, ChatContentProps>;
170
+ Work: ChatPartComponent<HTMLDetailsElement, ChatWorkProps>;
171
+ WorkSummary: ChatPartComponent<HTMLElement, ChatWorkSummaryProps>;
172
+ WorkBody: ChatPartComponent<HTMLDivElement, ChatWorkBodyProps>;
173
+ InputArea: ChatPartComponent<HTMLDivElement, ChatInputAreaProps>;
174
+ Queue: ChatPartComponent<HTMLElement, ChatQueueProps>;
175
+ ComposerForm: ChatPartComponent<HTMLFormElement, ChatComposerFormProps>;
176
+ ComposerInput: ChatPartComponent<HTMLTextAreaElement, ChatComposerInputProps>;
177
+ ComposerActions: ChatPartComponent<HTMLDivElement, ChatComposerActionsProps>;
178
+ ComposerHint: ChatPartComponent<HTMLElement, ChatComposerHintProps>;
127
179
  Avatar: ChatPartComponent<HTMLDivElement, ChatAvatarProps>;
128
180
  Header: ChatPartComponent<HTMLDivElement, ChatHeaderProps>;
129
181
  Bubble: ChatPartComponent<HTMLDivElement, ChatBubbleProps>;
@@ -0,0 +1,14 @@
1
+ import React from "react";
2
+ import type { ChatAgentProps, ChatContentProps, ChatQueueProps, ChatComposerFormProps } from "./Chat.types";
3
+ export declare const ChatAgent: React.ForwardRefExoticComponent<Omit<ChatAgentProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
4
+ export declare const ChatContent: React.ForwardRefExoticComponent<Omit<ChatContentProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
5
+ export declare const ChatWork: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.DetailsHTMLAttributes<HTMLDetailsElement>, HTMLDetailsElement>, "ref"> & React.RefAttributes<HTMLDetailsElement>>;
6
+ export declare const ChatWorkSummary: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>, "ref"> & React.RefAttributes<HTMLElement>>;
7
+ export declare const ChatWorkBody: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
8
+ export declare const ChatInputArea: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
9
+ export declare const ChatComposerForm: React.ForwardRefExoticComponent<Omit<ChatComposerFormProps, "ref"> & React.RefAttributes<HTMLFormElement>>;
10
+ export declare const ChatComposerInput: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement>, "ref"> & React.RefAttributes<HTMLTextAreaElement>>;
11
+ export declare const ChatComposerActions: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
12
+ export declare const ChatComposerHint: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>, "ref"> & React.RefAttributes<HTMLElement>>;
13
+ /** Presentation only: actions request application state changes, never dequeue locally. */
14
+ export declare const ChatQueue: React.ForwardRefExoticComponent<Omit<ChatQueueProps, "ref"> & React.RefAttributes<HTMLElement>>;
@@ -1,3 +1,4 @@
1
1
  export * from "./Chat";
2
2
  export * from "./ChatComposer";
3
+ export * from "./ChatPrimitives";
3
4
  export type * from "./Chat.types";