@mieweb/ui 0.9.0 → 0.10.0-dev.0

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 (121) hide show
  1. package/MIGRATION.md +112 -0
  2. package/dist/{Animated-Cs-naa2g.d.cts → Animated-XmH6k8pZ.d.cts} +16 -3
  3. package/dist/{Animated-Cs-naa2g.d.ts → Animated-XmH6k8pZ.d.ts} +16 -3
  4. package/dist/{chunk-XUVEF2RQ.js → chunk-24SEAAOH.js} +2 -2
  5. package/dist/{chunk-XUVEF2RQ.js.map → chunk-24SEAAOH.js.map} +1 -1
  6. package/dist/{chunk-FUFBRKOG.cjs → chunk-2WBPNXO2.cjs} +21 -21
  7. package/dist/{chunk-FUFBRKOG.cjs.map → chunk-2WBPNXO2.cjs.map} +1 -1
  8. package/dist/{chunk-IUDY6S7I.cjs → chunk-37UZHCLM.cjs} +35 -14
  9. package/dist/chunk-37UZHCLM.cjs.map +1 -0
  10. package/dist/{chunk-L52N6BEN.cjs → chunk-AUOTJQGO.cjs} +7 -7
  11. package/dist/{chunk-L52N6BEN.cjs.map → chunk-AUOTJQGO.cjs.map} +1 -1
  12. package/dist/{chunk-6XDPJWSC.cjs → chunk-E7G22IQM.cjs} +32 -28
  13. package/dist/chunk-E7G22IQM.cjs.map +1 -0
  14. package/dist/chunk-IIFQ6BSJ.js +1888 -0
  15. package/dist/chunk-IIFQ6BSJ.js.map +1 -0
  16. package/dist/{chunk-ONNY7UO4.js → chunk-JDJQTKTX.js} +3 -3
  17. package/dist/{chunk-ONNY7UO4.js.map → chunk-JDJQTKTX.js.map} +1 -1
  18. package/dist/{chunk-BJKAVWED.js → chunk-MBWF36DJ.js} +35 -14
  19. package/dist/chunk-MBWF36DJ.js.map +1 -0
  20. package/dist/chunk-NV2CWBI2.cjs +290 -0
  21. package/dist/chunk-NV2CWBI2.cjs.map +1 -0
  22. package/dist/{chunk-FQBTGS3E.cjs → chunk-OFUKTVBN.cjs} +363 -285
  23. package/dist/chunk-OFUKTVBN.cjs.map +1 -0
  24. package/dist/{chunk-7KN6J7XV.cjs → chunk-OMAACCFW.cjs} +7 -7
  25. package/dist/{chunk-7KN6J7XV.cjs.map → chunk-OMAACCFW.cjs.map} +1 -1
  26. package/dist/chunk-OYQ7GYAA.cjs +1921 -0
  27. package/dist/chunk-OYQ7GYAA.cjs.map +1 -0
  28. package/dist/{chunk-YJP6DUFO.cjs → chunk-PKD3JLS2.cjs} +6 -6
  29. package/dist/{chunk-YJP6DUFO.cjs.map → chunk-PKD3JLS2.cjs.map} +1 -1
  30. package/dist/{chunk-CXDMZT45.cjs → chunk-PY7XAG4D.cjs} +27 -4
  31. package/dist/chunk-PY7XAG4D.cjs.map +1 -0
  32. package/dist/{chunk-5H7SAEQO.js → chunk-QKFJDQEK.js} +3 -3
  33. package/dist/{chunk-5H7SAEQO.js.map → chunk-QKFJDQEK.js.map} +1 -1
  34. package/dist/{chunk-XJTFZLWH.cjs → chunk-QO6PRHDX.cjs} +2 -2
  35. package/dist/{chunk-XJTFZLWH.cjs.map → chunk-QO6PRHDX.cjs.map} +1 -1
  36. package/dist/{chunk-OHDIJOGG.js → chunk-RD3JDFYJ.js} +3 -3
  37. package/dist/{chunk-OHDIJOGG.js.map → chunk-RD3JDFYJ.js.map} +1 -1
  38. package/dist/{chunk-4SM3I7WE.cjs → chunk-RXPEZXAB.cjs} +67 -38
  39. package/dist/chunk-RXPEZXAB.cjs.map +1 -0
  40. package/dist/{chunk-VTR2KGLY.cjs → chunk-S3BCHPXT.cjs} +9 -9
  41. package/dist/{chunk-VTR2KGLY.cjs.map → chunk-S3BCHPXT.cjs.map} +1 -1
  42. package/dist/{chunk-KU3XRHWA.js → chunk-TZX76ZNZ.js} +67 -38
  43. package/dist/chunk-TZX76ZNZ.js.map +1 -0
  44. package/dist/{chunk-MXQ7J4BB.js → chunk-VSVGMMNO.js} +361 -284
  45. package/dist/chunk-VSVGMMNO.js.map +1 -0
  46. package/dist/{chunk-Q7G56ZIO.js → chunk-WUBMDOTG.js} +3 -3
  47. package/dist/{chunk-Q7G56ZIO.js.map → chunk-WUBMDOTG.js.map} +1 -1
  48. package/dist/{chunk-DGRXAIWK.js → chunk-X5YM3KXY.js} +27 -4
  49. package/dist/chunk-X5YM3KXY.js.map +1 -0
  50. package/dist/chunk-XCP454Q6.js +263 -0
  51. package/dist/chunk-XCP454Q6.js.map +1 -0
  52. package/dist/{chunk-I3DQXUSC.js → chunk-Y6DFMDMH.js} +3 -3
  53. package/dist/{chunk-I3DQXUSC.js.map → chunk-Y6DFMDMH.js.map} +1 -1
  54. package/dist/{chunk-ODYQYLO2.js → chunk-YSEMAI4I.js} +8 -4
  55. package/dist/chunk-YSEMAI4I.js.map +1 -0
  56. package/dist/components/AlertDialog/index.cjs +4 -4
  57. package/dist/components/AlertDialog/index.js +3 -3
  58. package/dist/components/Collapsible/index.cjs +6 -4
  59. package/dist/components/Collapsible/index.js +3 -1
  60. package/dist/components/Dropdown/index.cjs +9 -8
  61. package/dist/components/Dropdown/index.js +2 -1
  62. package/dist/components/KeyboardShortcutsOverlay/index.cjs +5 -5
  63. package/dist/components/KeyboardShortcutsOverlay/index.js +3 -3
  64. package/dist/components/MediaEditor/index.cjs +8 -8
  65. package/dist/components/MediaEditor/index.js +3 -3
  66. package/dist/components/Modal/index.cjs +10 -10
  67. package/dist/components/Modal/index.js +2 -2
  68. package/dist/components/RichTextEditor/index.cjs +6 -5
  69. package/dist/components/RichTextEditor/index.js +3 -2
  70. package/dist/components/SuperChat/index.cjs +40 -17
  71. package/dist/components/SuperChat/index.cjs.map +1 -1
  72. package/dist/components/SuperChat/index.d.cts +20 -7
  73. package/dist/components/SuperChat/index.d.ts +20 -7
  74. package/dist/components/SuperChat/index.js +35 -12
  75. package/dist/components/SuperChat/index.js.map +1 -1
  76. package/dist/components/SuperChat/plugins/index.cjs +10 -3
  77. package/dist/components/SuperChat/plugins/index.cjs.map +1 -1
  78. package/dist/components/SuperChat/plugins/index.d.cts +3 -3
  79. package/dist/components/SuperChat/plugins/index.d.ts +3 -3
  80. package/dist/components/SuperChat/plugins/index.js +9 -2
  81. package/dist/components/SuperChat/plugins/index.js.map +1 -1
  82. package/dist/esheet.cjs +6 -6
  83. package/dist/esheet.js +3 -3
  84. package/dist/hooks/index.cjs +13 -13
  85. package/dist/hooks/index.js +1 -1
  86. package/dist/index.cjs +720 -1671
  87. package/dist/index.cjs.map +1 -1
  88. package/dist/index.d.cts +347 -347
  89. package/dist/index.d.ts +347 -347
  90. package/dist/index.js +459 -1405
  91. package/dist/index.js.map +1 -1
  92. package/dist/motion.cjs +7 -7
  93. package/dist/motion.d.cts +1 -1
  94. package/dist/motion.d.ts +1 -1
  95. package/dist/motion.js +2 -2
  96. package/dist/styles.css +1 -1
  97. package/dist/tailwind-preset.cjs +4 -4
  98. package/dist/tailwind-preset.js +1 -1
  99. package/dist/{types-DZDroUW8.d.cts → types-B97JNRNQ.d.cts} +1 -1
  100. package/dist/{types-B2RLmdVd.d.ts → types-CnPEwzlp.d.cts} +6 -2
  101. package/dist/{types-B2RLmdVd.d.cts → types-CnPEwzlp.d.ts} +6 -2
  102. package/dist/{types-9vK_YdEb.d.ts → types-gZXrfLj6.d.ts} +1 -1
  103. package/package.json +2 -1
  104. package/dist/chunk-4SM3I7WE.cjs.map +0 -1
  105. package/dist/chunk-5BVFVXHN.cjs +0 -1244
  106. package/dist/chunk-5BVFVXHN.cjs.map +0 -1
  107. package/dist/chunk-6XDPJWSC.cjs.map +0 -1
  108. package/dist/chunk-BJKAVWED.js.map +0 -1
  109. package/dist/chunk-BN75TLUN.cjs +0 -163
  110. package/dist/chunk-BN75TLUN.cjs.map +0 -1
  111. package/dist/chunk-CXDMZT45.cjs.map +0 -1
  112. package/dist/chunk-DGRXAIWK.js.map +0 -1
  113. package/dist/chunk-FQBTGS3E.cjs.map +0 -1
  114. package/dist/chunk-IUDY6S7I.cjs.map +0 -1
  115. package/dist/chunk-KU3XRHWA.js.map +0 -1
  116. package/dist/chunk-MXQ7J4BB.js.map +0 -1
  117. package/dist/chunk-O6GJ4IYS.js +0 -1210
  118. package/dist/chunk-O6GJ4IYS.js.map +0 -1
  119. package/dist/chunk-ODYQYLO2.js.map +0 -1
  120. package/dist/chunk-WYMO3IIK.js +0 -136
  121. package/dist/chunk-WYMO3IIK.js.map +0 -1
@@ -1,8 +1,8 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { S as SuperChatConversation, a as SuperChatRenderPlugin, A as AttachmentKind, b as SuperChatLinkBuilder, c as SuperChatCopyFormat, C as ComposerAttachment, d as SuperChatRef } from '../../types-DZDroUW8.cjs';
3
- export { G as GenUIBlockPayload, e as GenUIPrefetchPolicy, f as GenUIRegistry, g as GenUIWidgetEntry, h as GenUIWidgetProps, P as Participant, i as ParticipantKind, j as ParticipantStatus, k as StandardSchemaV1, l as SuperChatChannel, m as SuperChatItemType, n as SuperChatMessage, o as SuperChatPluggable, p as SuperChatPluggableList } from '../../types-DZDroUW8.cjs';
4
- import { b as AIRenderTextContent } from '../../types-B2RLmdVd.cjs';
5
- export { A as AIMessageContent, a as AIMessageStatus, c as AITextRenderContext, M as MCPResourceLink } from '../../types-B2RLmdVd.cjs';
2
+ import { S as SuperChatConversation, a as SuperChatRenderPlugin, A as AttachmentKind, b as SuperChatLinkBuilder, c as SuperChatCopyFormat, C as ComposerAttachment, d as SuperChatRef } from '../../types-B97JNRNQ.cjs';
3
+ export { G as GenUIBlockPayload, e as GenUIPrefetchPolicy, f as GenUIRegistry, g as GenUIWidgetEntry, h as GenUIWidgetProps, P as Participant, i as ParticipantKind, j as ParticipantStatus, k as StandardSchemaV1, l as SuperChatChannel, m as SuperChatItemType, n as SuperChatMessage, o as SuperChatPluggable, p as SuperChatPluggableList } from '../../types-B97JNRNQ.cjs';
4
+ import { b as AIRenderTextContent } from '../../types-CnPEwzlp.cjs';
5
+ export { A as AIMessageContent, a as AIMessageStatus, c as AITextRenderContext, M as MCPResourceLink } from '../../types-CnPEwzlp.cjs';
6
6
  import * as React from 'react';
7
7
 
8
8
  interface SuperChatProps {
@@ -19,7 +19,8 @@ interface SuperChatProps {
19
19
  /** Disable the composer. */
20
20
  readOnly?: boolean;
21
21
  /**
22
- * File categories the composer accepts for paste and the paperclip picker.
22
+ * File categories the composer accepts for paste, drag-and-drop, and the
23
+ * file picker in the `+` → “Attach files” menu.
23
24
  * Defaults to `['image', 'video', 'audio', 'pdf']`.
24
25
  */
25
26
  acceptedFileTypes?: AttachmentKind[];
@@ -47,11 +48,17 @@ interface SuperChatProps {
47
48
  defaultCopyFormat?: SuperChatCopyFormat;
48
49
  /** Additional class name. */
49
50
  className?: string;
51
+ /**
52
+ * Fired when the local user sends a message. If the callback returns a
53
+ * promise it is awaited, and a rejected send restores the typed text into
54
+ * the composer (the declared `void` return keeps every previously valid
55
+ * callback assignable).
56
+ */
50
57
  onMessageSent?: (text: string, meta: {
51
58
  conversation: SuperChatConversation;
52
59
  mentions: string[];
53
60
  attachments: ComposerAttachment[];
54
- }) => void;
61
+ }) => void | Promise<void>;
55
62
  /**
56
63
  * Fired when the local user saves an edit to one of their own messages.
57
64
  * Providing this enables the inline "Edit" affordance on self-authored
@@ -110,7 +117,8 @@ interface SuperChatInboxProps {
110
117
  /** Disable the composer. */
111
118
  readOnly?: boolean;
112
119
  /**
113
- * File categories the composer accepts for paste and the paperclip picker.
120
+ * File categories the composer accepts for paste, drag-and-drop, and the
121
+ * file picker in the `+` → “Attach files” menu.
114
122
  * Defaults to `['image', 'video', 'audio', 'pdf']`.
115
123
  */
116
124
  acceptedFileTypes?: AttachmentKind[];
@@ -126,6 +134,11 @@ interface SuperChatInboxProps {
126
134
  defaultCopyFormat?: SuperChatCopyFormat;
127
135
  /** Additional class name. */
128
136
  className?: string;
137
+ /**
138
+ * Fired when the local user sends a message. If the callback returns a
139
+ * promise it is awaited, and a rejected send restores the typed text into
140
+ * the composer (same contract as {@link SuperChatProps.onMessageSent}).
141
+ */
129
142
  onMessageSent?: (text: string, meta: {
130
143
  conversation: SuperChatConversation;
131
144
  mentions: string[];
@@ -1,8 +1,8 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { S as SuperChatConversation, a as SuperChatRenderPlugin, A as AttachmentKind, b as SuperChatLinkBuilder, c as SuperChatCopyFormat, C as ComposerAttachment, d as SuperChatRef } from '../../types-9vK_YdEb.js';
3
- export { G as GenUIBlockPayload, e as GenUIPrefetchPolicy, f as GenUIRegistry, g as GenUIWidgetEntry, h as GenUIWidgetProps, P as Participant, i as ParticipantKind, j as ParticipantStatus, k as StandardSchemaV1, l as SuperChatChannel, m as SuperChatItemType, n as SuperChatMessage, o as SuperChatPluggable, p as SuperChatPluggableList } from '../../types-9vK_YdEb.js';
4
- import { b as AIRenderTextContent } from '../../types-B2RLmdVd.js';
5
- export { A as AIMessageContent, a as AIMessageStatus, c as AITextRenderContext, M as MCPResourceLink } from '../../types-B2RLmdVd.js';
2
+ import { S as SuperChatConversation, a as SuperChatRenderPlugin, A as AttachmentKind, b as SuperChatLinkBuilder, c as SuperChatCopyFormat, C as ComposerAttachment, d as SuperChatRef } from '../../types-gZXrfLj6.js';
3
+ export { G as GenUIBlockPayload, e as GenUIPrefetchPolicy, f as GenUIRegistry, g as GenUIWidgetEntry, h as GenUIWidgetProps, P as Participant, i as ParticipantKind, j as ParticipantStatus, k as StandardSchemaV1, l as SuperChatChannel, m as SuperChatItemType, n as SuperChatMessage, o as SuperChatPluggable, p as SuperChatPluggableList } from '../../types-gZXrfLj6.js';
4
+ import { b as AIRenderTextContent } from '../../types-CnPEwzlp.js';
5
+ export { A as AIMessageContent, a as AIMessageStatus, c as AITextRenderContext, M as MCPResourceLink } from '../../types-CnPEwzlp.js';
6
6
  import * as React from 'react';
7
7
 
8
8
  interface SuperChatProps {
@@ -19,7 +19,8 @@ interface SuperChatProps {
19
19
  /** Disable the composer. */
20
20
  readOnly?: boolean;
21
21
  /**
22
- * File categories the composer accepts for paste and the paperclip picker.
22
+ * File categories the composer accepts for paste, drag-and-drop, and the
23
+ * file picker in the `+` → “Attach files” menu.
23
24
  * Defaults to `['image', 'video', 'audio', 'pdf']`.
24
25
  */
25
26
  acceptedFileTypes?: AttachmentKind[];
@@ -47,11 +48,17 @@ interface SuperChatProps {
47
48
  defaultCopyFormat?: SuperChatCopyFormat;
48
49
  /** Additional class name. */
49
50
  className?: string;
51
+ /**
52
+ * Fired when the local user sends a message. If the callback returns a
53
+ * promise it is awaited, and a rejected send restores the typed text into
54
+ * the composer (the declared `void` return keeps every previously valid
55
+ * callback assignable).
56
+ */
50
57
  onMessageSent?: (text: string, meta: {
51
58
  conversation: SuperChatConversation;
52
59
  mentions: string[];
53
60
  attachments: ComposerAttachment[];
54
- }) => void;
61
+ }) => void | Promise<void>;
55
62
  /**
56
63
  * Fired when the local user saves an edit to one of their own messages.
57
64
  * Providing this enables the inline "Edit" affordance on self-authored
@@ -110,7 +117,8 @@ interface SuperChatInboxProps {
110
117
  /** Disable the composer. */
111
118
  readOnly?: boolean;
112
119
  /**
113
- * File categories the composer accepts for paste and the paperclip picker.
120
+ * File categories the composer accepts for paste, drag-and-drop, and the
121
+ * file picker in the `+` → “Attach files” menu.
114
122
  * Defaults to `['image', 'video', 'audio', 'pdf']`.
115
123
  */
116
124
  acceptedFileTypes?: AttachmentKind[];
@@ -126,6 +134,11 @@ interface SuperChatInboxProps {
126
134
  defaultCopyFormat?: SuperChatCopyFormat;
127
135
  /** Additional class name. */
128
136
  className?: string;
137
+ /**
138
+ * Fired when the local user sends a message. If the callback returns a
139
+ * promise it is awaited, and a rejected send restores the typed text into
140
+ * the composer (same contract as {@link SuperChatProps.onMessageSent}).
141
+ */
129
142
  onMessageSent?: (text: string, meta: {
130
143
  conversation: SuperChatConversation;
131
144
  mentions: string[];
@@ -1,14 +1,16 @@
1
1
  import { TextRenderContext } from '../../chunk-I6CY5C6A.js';
2
2
  export { TextRenderContext, useTextRenderContext } from '../../chunk-I6CY5C6A.js';
3
3
  import { ChatBubble, MCPToolCallDisplay, AITypingIndicator, SparklesIcon, CloseIcon } from '../../chunk-22CYDCXA.js';
4
- import { MessageComposer } from '../../chunk-O6GJ4IYS.js';
5
- import { Dropdown, DropdownSubmenu, DropdownItem } from '../../chunk-KU3XRHWA.js';
4
+ import { notifyComposerMigrationOnce, ChatComposer } from '../../chunk-IIFQ6BSJ.js';
5
+ import { Dropdown, DropdownSubmenu, DropdownItem } from '../../chunk-TZX76ZNZ.js';
6
6
  import { Avatar } from '../../chunk-HZ4MBUC3.js';
7
7
  import '../../chunk-IQ4KQJAO.js';
8
8
  import '../../chunk-VVDE4CHU.js';
9
9
  import '../../chunk-6NZXWKUE.js';
10
10
  import '../../chunk-3IMM2PM4.js';
11
+ import '../../chunk-BKSPDTX4.js';
11
12
  import { Badge } from '../../chunk-BMSG4NBH.js';
13
+ import '../../chunk-XCP454Q6.js';
12
14
  import { cn } from '../../chunk-TQONQSJO.js';
13
15
  import '../../chunk-T4ME7QCT.js';
14
16
  import '../../chunk-62ZOA6PX.js';
@@ -1108,6 +1110,9 @@ function SuperChat({
1108
1110
  onBack
1109
1111
  }) {
1110
1112
  const headingId = React2.useId();
1113
+ React2.useEffect(() => {
1114
+ notifyComposerMigrationOnce("SuperChat");
1115
+ }, []);
1111
1116
  const renderText = React2.useMemo(
1112
1117
  () => renderTextContent ?? createMarkdownRenderer({
1113
1118
  plugins: renderPlugins,
@@ -1158,14 +1163,29 @@ function SuperChat({
1158
1163
  () => acceptTokensFor(acceptedFileTypes),
1159
1164
  [acceptedFileTypes]
1160
1165
  );
1166
+ const [draft, setDraft] = React2.useState("");
1167
+ const draftEpochRef = React2.useRef(0);
1168
+ const handleDraftChange = React2.useCallback((value) => {
1169
+ draftEpochRef.current += 1;
1170
+ setDraft(value);
1171
+ }, []);
1161
1172
  const handleComposerSend = React2.useCallback(
1162
1173
  async (message) => {
1163
- const text = message.content;
1164
- const mentions = detectMentions(text, conversation.participants);
1165
- const attachments = await filesToComposerAttachments(
1166
- message.attachments ?? []
1167
- );
1168
- onMessageSent?.(text, { conversation, mentions, attachments });
1174
+ const epoch = draftEpochRef.current;
1175
+ try {
1176
+ const text = message.content;
1177
+ const mentions = detectMentions(text, conversation.participants);
1178
+ const attachments = await filesToComposerAttachments(
1179
+ message.attachments ?? []
1180
+ );
1181
+ await Promise.resolve(
1182
+ onMessageSent?.(text, { conversation, mentions, attachments })
1183
+ );
1184
+ } catch {
1185
+ if (draftEpochRef.current === epoch) {
1186
+ setDraft(message.content);
1187
+ }
1188
+ }
1169
1189
  },
1170
1190
  [conversation, onMessageSent]
1171
1191
  );
@@ -1297,16 +1317,19 @@ function SuperChat({
1297
1317
  }
1298
1318
  ),
1299
1319
  /* @__PURE__ */ jsx(
1300
- MessageComposer,
1320
+ ChatComposer,
1301
1321
  {
1322
+ value: draft,
1323
+ onValueChange: handleDraftChange,
1302
1324
  onSend: handleComposerSend,
1303
1325
  disabled: readOnly,
1304
1326
  placeholder: readOnly ? "Read-only conversation" : "Type a message\u2026 use @ to address an agent",
1305
1327
  mentionOptions,
1306
- showAttachmentPicker: !readOnly,
1307
- showCameraButton: false,
1328
+ allowAttachments: !readOnly,
1308
1329
  acceptedFileTypes: composerAccept,
1309
- maxLength: 1e5
1330
+ maxFileSize: 25 * 1024 * 1024,
1331
+ maxLength: 1e5,
1332
+ inputLabel: "Message"
1310
1333
  }
1311
1334
  )
1312
1335
  ]