@dxos/react-ui-thread 0.8.4-main.fffef41 → 0.8.4-staging.60fe92afc8

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.
Files changed (50) hide show
  1. package/LICENSE +102 -5
  2. package/dist/lib/browser/chunk-QFRRLZVL.mjs +31 -0
  3. package/dist/lib/browser/chunk-QFRRLZVL.mjs.map +7 -0
  4. package/dist/lib/browser/index.mjs +507 -220
  5. package/dist/lib/browser/index.mjs.map +4 -4
  6. package/dist/lib/browser/meta.json +1 -1
  7. package/dist/lib/browser/translations.mjs +9 -0
  8. package/dist/lib/browser/translations.mjs.map +7 -0
  9. package/dist/types/src/Message/Message.d.ts +81 -10
  10. package/dist/types/src/Message/Message.d.ts.map +1 -1
  11. package/dist/types/src/Message/Message.stories.d.ts +22 -14
  12. package/dist/types/src/Message/Message.stories.d.ts.map +1 -1
  13. package/dist/types/src/Message/index.d.ts +2 -1
  14. package/dist/types/src/Message/index.d.ts.map +1 -1
  15. package/dist/types/src/Thread/Thread.d.ts +76 -13
  16. package/dist/types/src/Thread/Thread.d.ts.map +1 -1
  17. package/dist/types/src/Thread/Thread.stories.d.ts +16 -12
  18. package/dist/types/src/Thread/Thread.stories.d.ts.map +1 -1
  19. package/dist/types/src/Thread/index.d.ts +2 -1
  20. package/dist/types/src/Thread/index.d.ts.map +1 -1
  21. package/dist/types/src/command.d.ts +3 -0
  22. package/dist/types/src/command.d.ts.map +1 -0
  23. package/dist/types/src/context.d.ts +227 -0
  24. package/dist/types/src/context.d.ts.map +1 -0
  25. package/dist/types/src/index.d.ts +7 -5
  26. package/dist/types/src/index.d.ts.map +1 -1
  27. package/dist/types/src/testing.d.ts +9 -14
  28. package/dist/types/src/testing.d.ts.map +1 -1
  29. package/dist/types/src/translations.d.ts +17 -12
  30. package/dist/types/src/translations.d.ts.map +1 -1
  31. package/dist/types/src/types.d.ts +36 -3
  32. package/dist/types/src/types.d.ts.map +1 -1
  33. package/dist/types/tsconfig.tsbuildinfo +1 -1
  34. package/package.json +44 -28
  35. package/src/Message/Message.stories.tsx +31 -26
  36. package/src/Message/Message.tsx +325 -68
  37. package/src/Message/index.ts +10 -1
  38. package/src/Thread/Thread.stories.tsx +19 -67
  39. package/src/Thread/Thread.tsx +296 -38
  40. package/src/Thread/index.ts +9 -1
  41. package/src/command.ts +58 -0
  42. package/src/context.ts +21 -0
  43. package/src/index.ts +28 -6
  44. package/src/testing.ts +48 -0
  45. package/src/translations.ts +16 -11
  46. package/src/types.ts +38 -5
  47. package/dist/types/src/Thread/Comments.stories.d.ts +0 -35
  48. package/dist/types/src/Thread/Comments.stories.d.ts.map +0 -1
  49. package/src/Thread/Comments.stories.tsx +0 -384
  50. package/src/testing.tsx +0 -58
@@ -0,0 +1,227 @@
1
+ import { type ThreadContextValue } from './types';
2
+ /**
3
+ * Context provided by `Thread.Root` and consumed by its parts. Extends the
4
+ * consumer-facing {@link ThreadContextValue} with internal coordination (e.g.
5
+ * focusing the composer from the header's select affordance).
6
+ */
7
+ export type ThreadContext = ThreadContextValue & {
8
+ /** Register the composer's focus handler (set by `Thread.Textbox`). */
9
+ registerComposerFocus: (focus: (() => void) | undefined) => void;
10
+ /** Focus the thread composer (used by `Thread.Header`'s select affordance). */
11
+ focusComposer: () => void;
12
+ };
13
+ export declare const ThreadContextProvider: import("react").FC<{
14
+ getMetadata: (message: {
15
+ readonly id: string;
16
+ readonly parentMessage?: string | undefined;
17
+ readonly threadId?: string | undefined;
18
+ readonly created: string;
19
+ readonly sender: {
20
+ readonly role?: "assistant" | "tool" | "user" | undefined;
21
+ readonly contact?: import("@dxos/echo/internal").Ref<{
22
+ readonly fullName?: string | undefined;
23
+ readonly preferredName?: string | undefined;
24
+ readonly nickname?: string | undefined;
25
+ readonly image?: string | undefined;
26
+ readonly organization?: import("@dxos/echo/internal").Ref<{
27
+ readonly name?: string | undefined;
28
+ readonly description?: string | undefined;
29
+ readonly status?: "active" | "commit" | "prospect" | "qualified" | "reject" | undefined;
30
+ readonly image?: string | undefined;
31
+ readonly website?: string | undefined;
32
+ } & {
33
+ readonly location?: readonly [number, number, (number | undefined)?] | undefined;
34
+ } & import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & import("@dxos/echo/Obj").Unknown> | undefined;
35
+ readonly jobTitle?: string | undefined;
36
+ readonly department?: string | undefined;
37
+ readonly notes?: string | undefined;
38
+ readonly emails?: readonly {
39
+ readonly label?: string | undefined;
40
+ readonly value: string;
41
+ }[] | undefined;
42
+ readonly identities?: readonly {
43
+ readonly label?: string | undefined;
44
+ readonly value: string;
45
+ }[] | undefined;
46
+ readonly phoneNumbers?: readonly {
47
+ readonly label?: string | undefined;
48
+ readonly value: string;
49
+ }[] | undefined;
50
+ readonly addresses?: readonly {
51
+ readonly label?: string | undefined;
52
+ readonly value: {
53
+ readonly street?: string | undefined;
54
+ readonly extended?: string | undefined;
55
+ readonly locality?: string | undefined;
56
+ readonly region?: string | undefined;
57
+ readonly postalCode?: string | undefined;
58
+ readonly postOfficeBoxNumber?: string | undefined;
59
+ readonly country?: string | undefined;
60
+ };
61
+ }[] | undefined;
62
+ readonly urls?: readonly {
63
+ readonly label?: string | undefined;
64
+ readonly value: string;
65
+ }[] | undefined;
66
+ readonly birthday?: string | undefined;
67
+ readonly fields?: readonly {
68
+ readonly category?: string | undefined;
69
+ readonly label: string;
70
+ readonly value: string;
71
+ }[] | undefined;
72
+ } & {
73
+ readonly location?: readonly [number, number, (number | undefined)?] | undefined;
74
+ } & import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & import("@dxos/echo/Obj").Unknown> | undefined;
75
+ readonly identityDid?: string | undefined;
76
+ readonly identityKey?: string | undefined;
77
+ readonly email?: string | undefined;
78
+ readonly name?: string | undefined;
79
+ };
80
+ readonly blocks: readonly ({
81
+ readonly _tag: "anchor";
82
+ readonly pending?: boolean | undefined;
83
+ readonly objectId: string;
84
+ readonly version: unknown;
85
+ } | {
86
+ readonly _tag: "file";
87
+ readonly pending?: boolean | undefined;
88
+ readonly url: string;
89
+ readonly name?: string | undefined;
90
+ readonly mediaType?: string | undefined;
91
+ } | {
92
+ readonly _tag: "image";
93
+ readonly pending?: boolean | undefined;
94
+ readonly id?: string | undefined;
95
+ readonly source?: {
96
+ readonly type: "base64";
97
+ readonly mediaType: string;
98
+ readonly data: string;
99
+ } | {
100
+ readonly type: "http";
101
+ readonly url: string;
102
+ } | undefined;
103
+ } | {
104
+ readonly _tag: "json";
105
+ readonly pending?: boolean | undefined;
106
+ readonly disposition?: "cot" | "synthetic" | "user" | "version-pin" | undefined;
107
+ readonly data: string;
108
+ } | {
109
+ readonly _tag: "proposal";
110
+ readonly pending?: boolean | undefined;
111
+ readonly text: string;
112
+ } | {
113
+ readonly _tag: "reasoning";
114
+ readonly pending?: boolean | undefined;
115
+ readonly reasoningText?: string | undefined;
116
+ readonly redactedText?: string | undefined;
117
+ readonly signature?: string | undefined;
118
+ } | {
119
+ readonly _tag: "reference";
120
+ readonly pending?: boolean | undefined;
121
+ readonly reference: import("@dxos/echo/internal").Ref<import("@dxos/echo/Obj").Unknown>;
122
+ } | {
123
+ readonly _tag: "select";
124
+ readonly pending?: boolean | undefined;
125
+ readonly options: string[];
126
+ } | {
127
+ readonly _tag: "status";
128
+ readonly pending?: boolean | undefined;
129
+ readonly statusText: string;
130
+ } | {
131
+ readonly _tag: "suggestion";
132
+ readonly pending?: boolean | undefined;
133
+ readonly text: string;
134
+ } | {
135
+ readonly _tag: "stats";
136
+ readonly pending?: boolean | undefined;
137
+ readonly mimeType?: string | undefined;
138
+ readonly message?: string | undefined;
139
+ readonly model?: string | undefined;
140
+ readonly usage?: {
141
+ readonly inputTokens?: number | undefined;
142
+ readonly outputTokens?: number | undefined;
143
+ readonly totalTokens?: number | undefined;
144
+ } | undefined;
145
+ readonly toolCalls?: number | undefined;
146
+ readonly errors?: number | undefined;
147
+ readonly duration?: number | undefined;
148
+ } | {
149
+ readonly _tag: "text";
150
+ readonly pending?: boolean | undefined;
151
+ readonly mimeType?: string | undefined;
152
+ readonly text: string;
153
+ readonly disposition?: "cot" | "synthetic" | "user" | "version-pin" | undefined;
154
+ } | {
155
+ readonly _tag: "summary";
156
+ readonly pending?: boolean | undefined;
157
+ readonly content: string;
158
+ } | {
159
+ readonly _tag: "toolkit";
160
+ readonly pending?: boolean | undefined;
161
+ } | {
162
+ readonly _tag: "toolCall";
163
+ readonly pending?: boolean | undefined;
164
+ readonly toolCallId: string;
165
+ readonly name: string;
166
+ readonly input: string;
167
+ readonly providerExecuted: boolean;
168
+ readonly operationKey?: string | undefined;
169
+ readonly operationName?: string | undefined;
170
+ readonly operationIcon?: string | undefined;
171
+ } | {
172
+ readonly _tag: "toolResult";
173
+ readonly pending?: boolean | undefined;
174
+ readonly toolCallId: string;
175
+ readonly name: string;
176
+ readonly result?: string | {
177
+ readonly _tag: "~@dxos/types/ContentBlock.ContentBlockResult";
178
+ readonly content: readonly ({
179
+ readonly _tag: "file";
180
+ readonly pending?: boolean | undefined;
181
+ readonly url: string;
182
+ readonly name?: string | undefined;
183
+ readonly mediaType?: string | undefined;
184
+ } | {
185
+ readonly _tag: "image";
186
+ readonly pending?: boolean | undefined;
187
+ readonly id?: string | undefined;
188
+ readonly source?: {
189
+ readonly type: "base64";
190
+ readonly mediaType: string;
191
+ readonly data: string;
192
+ } | {
193
+ readonly type: "http";
194
+ readonly url: string;
195
+ } | undefined;
196
+ } | {
197
+ readonly _tag: "text";
198
+ readonly pending?: boolean | undefined;
199
+ readonly mimeType?: string | undefined;
200
+ readonly text: string;
201
+ readonly disposition?: "cot" | "synthetic" | "user" | "version-pin" | undefined;
202
+ })[];
203
+ } | undefined;
204
+ readonly error?: string | undefined;
205
+ readonly providerExecuted: boolean;
206
+ } | {
207
+ readonly _tag: "transcript";
208
+ readonly pending?: boolean | undefined;
209
+ readonly started: string;
210
+ readonly text: string;
211
+ })[];
212
+ readonly properties?: {
213
+ readonly [x: string]: any;
214
+ } | undefined;
215
+ } & import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object>) => import("./types").MessageMetadata;
216
+ components: import("./types").ThreadComponents;
217
+ identityDid?: string;
218
+ editable?: boolean;
219
+ } & import("./types").MessageCallbacks & {
220
+ /** Register the composer's focus handler (set by `Thread.Textbox`). */
221
+ registerComposerFocus: (focus: (() => void) | undefined) => void;
222
+ /** Focus the thread composer (used by `Thread.Header`'s select affordance). */
223
+ focusComposer: () => void;
224
+ } & {
225
+ children: React.ReactNode;
226
+ }>, useThreadContext: (consumerName: string) => ThreadContext;
227
+ //# sourceMappingURL=context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/context.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAElD;;;;GAIG;AACH,MAAM,MAAM,aAAa,GAAG,kBAAkB,GAAG;IAC/C,uEAAuE;IACvE,qBAAqB,EAAE,CAAC,KAAK,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,KAAK,IAAI,CAAC;IACjE,+EAA+E;IAC/E,aAAa,EAAE,MAAM,IAAI,CAAC;CAC3B,CAAC;AAEF,eAAO,MAAO,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IANjC,uEAAuE;2BAChD,CAAC,KAAK,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,KAAK,IAAI;IAChE,+EAA+E;mBAChE,MAAM,IAAI;;;IAGU,gBAAgB,yCAA0C,CAAC"}
@@ -1,6 +1,8 @@
1
- import { translations } from './translations';
2
- export * from './Thread';
3
- export * from './Message';
4
- export type * from './types';
5
- export { translations };
1
+ export { Thread } from './Thread';
2
+ export type { ThreadRootProps, ThreadContentProps, ThreadHeaderProps, ThreadMessagesProps, ThreadTextboxProps, ThreadStatusProps, } from './Thread';
3
+ export { Message } from './Message';
4
+ export type { MessageRootProps, MessageHeadingProps, MessageAuthorNameProps, MessageTimeProps, MessageBodyProps, MessageTextboxProps, MessageTileProps, } from './Message';
5
+ export { command } from './command';
6
+ export { useThreadContext } from './context';
7
+ export type { MessageMetadata, ObjectTileComponent, ThreadComponents, MessageCallbacks, ThreadContextValue, } from './types';
6
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,mBAAmB,SAAS,CAAC;AAC7B,OAAO,EAAE,YAAY,EAAE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,YAAY,EACV,eAAe,EACf,kBAAkB,EAClB,iBAAiB,EACjB,mBAAmB,EACnB,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,YAAY,EACV,gBAAgB,EAChB,mBAAmB,EACnB,sBAAsB,EACtB,gBAAgB,EAChB,gBAAgB,EAChB,mBAAmB,EACnB,gBAAgB,GACjB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,YAAY,EACV,eAAe,EACf,mBAAmB,EACnB,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,GACnB,MAAM,SAAS,CAAC"}
@@ -1,16 +1,11 @@
1
- import React from 'react';
1
+ import { Message } from '@dxos/types';
2
2
  import { type MessageMetadata } from './types';
3
- export type MessageEntity<PartValue = any> = MessageMetadata & {
4
- text: string;
5
- parts?: PartValue[];
6
- };
7
- export type MessageTextProps = MessageMetadata & {
8
- text: string;
9
- onDelete?: () => void;
10
- };
11
- export declare const MessageStoryText: ({ text, onDelete, authorName, timestamp }: MessageTextProps) => React.JSX.Element;
12
- export type MessagePartProps<PartValue> = {
13
- part: PartValue;
14
- };
15
- export declare const MessageStoryBlock: <PartValue>({ part }: MessagePartProps<PartValue>) => React.JSX.Element;
3
+ /**
4
+ * Generate sample `Message` objects (real `@dxos/types` schema) with text
5
+ * blocks for stories, using the `@dxos/schema/testing` generator for base
6
+ * fields and `@dxos/random` for content.
7
+ */
8
+ export declare const createMessages: (count?: number) => Message.Message[];
9
+ /** Story metadata resolver mapping a message's sender to presentational fields. */
10
+ export declare const getStoryMetadata: (message: Message.Message) => MessageMetadata;
16
11
  //# sourceMappingURL=testing.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"testing.d.ts","sourceRoot":"","sources":["../../../src/testing.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/C,MAAM,MAAM,aAAa,CAAC,SAAS,GAAG,GAAG,IAAI,eAAe,GAAG;IAC7D,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,SAAS,EAAE,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,eAAe,GAAG;IAC/C,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;CACvB,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAAI,2CAA2C,gBAAgB,sBAkB3F,CAAC;AAEF,MAAM,MAAM,gBAAgB,CAAC,SAAS,IAAI;IACxC,IAAI,EAAE,SAAS,CAAC;CACjB,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAAI,SAAS,EAAG,UAAU,gBAAgB,CAAC,SAAS,CAAC,sBAWlF,CAAC"}
1
+ {"version":3,"file":"testing.d.ts","sourceRoot":"","sources":["../../../src/testing.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAGtC,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,SAAS,CAAC;AAS/C;;;;GAIG;AACH,eAAO,MAAM,cAAc,sBAAgB,OAAO,CAAC,OAAO,EAUzD,CAAC;AAEF,mFAAmF;AACnF,eAAO,MAAM,gBAAgB,YAAa,OAAO,CAAC,OAAO,KAAG,eAU3D,CAAC"}
@@ -1,17 +1,22 @@
1
- export declare const translationKey = "react-ui-thread";
1
+ export declare const translationKey = "@dxos/react-ui-thread";
2
2
  export declare const translations: [{
3
3
  readonly 'en-US': {
4
- readonly "react-ui-thread": {
5
- readonly 'plugin name': "Threads";
6
- readonly 'thread title placeholder': "New thread";
7
- readonly 'thread title label': "Title";
8
- readonly 'delete thread label': "Delete";
9
- readonly 'create thread label': "Create thread";
10
- readonly 'message placeholder': "Enter message...";
11
- readonly 'comment placeholder': "Enter comment...";
12
- readonly 'settings standalone label': "Enable standalone thread creation";
13
- readonly 'anonymous label': "Anonymous";
14
- readonly 'enter to send message': "Enter to add ⏎";
4
+ readonly "@dxos/react-ui-thread": {
5
+ readonly 'plugin.name': 'Threads';
6
+ readonly 'thread-title.placeholder': 'New thread';
7
+ readonly 'thread-title.label': 'Title';
8
+ readonly 'delete-thread.label': 'Delete';
9
+ readonly 'select-thread.label': 'Select comment';
10
+ readonly 'create-thread.label': 'Create thread';
11
+ readonly 'message.placeholder': 'Enter message...';
12
+ readonly 'comment.placeholder': 'Enter comment...';
13
+ readonly 'settings-standalone.label': 'Enable standalone thread creation';
14
+ readonly 'anonymous.label': 'Anonymous';
15
+ readonly 'enter-to-send.message': 'Enter to add \u23CE';
16
+ readonly 'edit-message.label': 'Edit';
17
+ readonly 'save-message.label': 'Save';
18
+ readonly 'delete-message.label': 'Delete';
19
+ readonly 'accept-proposal.label': 'Accept proposal';
15
20
  };
16
21
  };
17
22
  }];
@@ -1 +1 @@
1
- {"version":3,"file":"translations.d.ts","sourceRoot":"","sources":["../../../src/translations.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,cAAc,oBAAoB,CAAC;AAEhD,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;EAiBM,CAAC"}
1
+ {"version":3,"file":"translations.d.ts","sourceRoot":"","sources":["../../../src/translations.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,cAAc,0BAA0B,CAAC;AAEtD,eAAO,MAAM,YAAY;;;qBAIjB,aAAa,EAAE,SAAS;qBACxB,0BAA0B,EAAE,YAAY;qBACxC,oBAAoB,EAAE,OAAO;qBAC7B,qBAAqB,EAAE,QAAQ;qBAC/B,qBAAqB,EAAE,gBAAgB;qBACvC,qBAAqB,EAAE,eAAe;qBACtC,qBAAqB,EAAE,kBAAkB;qBACzC,qBAAqB,EAAE,kBAAkB;qBACzC,2BAA2B,EAAE,mCAAmC;qBAChE,iBAAiB,EAAE,WAAW;qBAC9B,uBAAuB,EAAE,qBAAgB;qBACzC,oBAAoB,EAAE,MAAM;qBAC5B,oBAAoB,EAAE,MAAM;qBAC5B,sBAAsB,EAAE,QAAQ;qBAChC,uBAAuB,EAAE,iBAAiB;;;EAInB,CAAC"}
@@ -1,4 +1,12 @@
1
+ import { type ComponentType } from 'react';
2
+ import { type Obj } from '@dxos/echo';
3
+ import { type Message } from '@dxos/types';
1
4
  import { type FallbackValue } from '@dxos/util';
5
+ /**
6
+ * Presentational metadata for a message author, resolved by the host (e.g. from
7
+ * space members / identity) and supplied to the UI layer — keeps this package
8
+ * free of `@dxos/react-client`.
9
+ */
2
10
  export type MessageMetadata = {
3
11
  id: string;
4
12
  timestamp?: string;
@@ -7,8 +15,33 @@ export type MessageMetadata = {
7
15
  authorImgSrc?: string;
8
16
  authorAvatarProps?: FallbackValue;
9
17
  };
10
- export type ThreadEntity = {
11
- topicId?: string;
12
- topicTitle?: string;
18
+ /**
19
+ * Renders an object/reference message block. Injected by the host plugin
20
+ * (typically backed by an app-framework `Surface`) so this package stays free
21
+ * of `@dxos/app-framework`.
22
+ */
23
+ export type ObjectTileComponent = ComponentType<{
24
+ subject: Obj.Unknown;
25
+ }>;
26
+ export type ThreadComponents = {
27
+ Object?: ObjectTileComponent;
13
28
  };
29
+ /** Callbacks raised by message tiles, handled by the host. */
30
+ export type MessageCallbacks = {
31
+ /** Delete a message by id (omit to hide the affordance). */
32
+ onMessageDelete?: (messageId: string) => void;
33
+ /** Accept an assistant proposal block on a message (omit to hide the affordance). */
34
+ onAcceptProposal?: (messageId: string) => void;
35
+ };
36
+ /** Shared context provided by `Thread.Root` to its message tiles. */
37
+ export type ThreadContextValue = {
38
+ /** Resolve presentational metadata for a message. */
39
+ getMetadata: (message: Message.Message) => MessageMetadata;
40
+ /** Injected renderers (e.g. object/reference tiles). */
41
+ components: ThreadComponents;
42
+ /** DID of the local identity; used to decide message editability. */
43
+ identityDid?: string;
44
+ /** When true, the author may edit their own text messages in place. */
45
+ editable?: boolean;
46
+ } & MessageCallbacks;
14
47
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,YAAY,CAAC;AAIhD,MAAM,MAAM,eAAe,GAAG;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,iBAAiB,CAAC,EAAE,aAAa,CAAC;CACnC,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C,OAAO,EAAE,KAAK,GAAG,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD;;;;GAIG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,iBAAiB,CAAC,EAAE,aAAa,CAAC;CACnC,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,mBAAmB,GAAG,aAAa,CAAC;IAAE,OAAO,EAAE,GAAG,CAAC,OAAO,CAAA;CAAE,CAAC,CAAC;AAE1E,MAAM,MAAM,gBAAgB,GAAG;IAC7B,MAAM,CAAC,EAAE,mBAAmB,CAAC;CAC9B,CAAC;AAEF,8DAA8D;AAC9D,MAAM,MAAM,gBAAgB,GAAG;IAC7B,4DAA4D;IAC5D,eAAe,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9C,qFAAqF;IACrF,gBAAgB,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;CAChD,CAAC;AAEF,qEAAqE;AACrE,MAAM,MAAM,kBAAkB,GAAG;IAC/B,qDAAqD;IACrD,WAAW,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,KAAK,eAAe,CAAC;IAC3D,wDAAwD;IACxD,UAAU,EAAE,gBAAgB,CAAC;IAC7B,qEAAqE;IACrE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,uEAAuE;IACvE,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,GAAG,gBAAgB,CAAC"}