@particle-academy/react-fancy 5.68.0 → 5.70.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 (137) hide show
  1. package/CHANGELOG.md +73 -0
  2. package/dist/{PastedFilesInput-Bt3KSTVN.d.ts → PastedFilesInput-BT5y95sb.d.ts} +2 -1
  3. package/dist/{PastedFilesInput-CUQeOeOA.d.cts → PastedFilesInput-Cd4k6a38.d.cts} +2 -1
  4. package/dist/autocomplete.cjs +3 -2
  5. package/dist/autocomplete.js +2 -1
  6. package/dist/chunk-2C64OVOZ.cjs +18 -0
  7. package/dist/chunk-2C64OVOZ.cjs.map +1 -0
  8. package/dist/{chunk-BX7EDTL4.js → chunk-37D5PYEF.js} +4 -3
  9. package/dist/chunk-37D5PYEF.js.map +1 -0
  10. package/dist/{chunk-UJRMY54A.cjs → chunk-3QCAOD2W.cjs} +4 -2
  11. package/dist/chunk-3QCAOD2W.cjs.map +1 -0
  12. package/dist/{chunk-KSU6RYWU.cjs → chunk-3T3LBIQA.cjs} +4 -2
  13. package/dist/chunk-3T3LBIQA.cjs.map +1 -0
  14. package/dist/{chunk-E4DXICU3.cjs → chunk-5YRSYS2F.cjs} +10 -10
  15. package/dist/{chunk-E4DXICU3.cjs.map → chunk-5YRSYS2F.cjs.map} +1 -1
  16. package/dist/{chunk-U5LKNGHU.cjs → chunk-6EA3DSPT.cjs} +14 -13
  17. package/dist/chunk-6EA3DSPT.cjs.map +1 -0
  18. package/dist/{chunk-YIKXJWO4.js → chunk-6PRXG7L6.js} +7 -5
  19. package/dist/chunk-6PRXG7L6.js.map +1 -0
  20. package/dist/{chunk-WKPBCB67.cjs → chunk-6QAF35AJ.cjs} +4 -2
  21. package/dist/chunk-6QAF35AJ.cjs.map +1 -0
  22. package/dist/chunk-6V44RRSB.cjs +11 -0
  23. package/dist/chunk-6V44RRSB.cjs.map +1 -0
  24. package/dist/chunk-AC3W3TIV.js +67 -0
  25. package/dist/chunk-AC3W3TIV.js.map +1 -0
  26. package/dist/{chunk-G35XN5WV.js → chunk-CDW7MFPG.js} +4 -2
  27. package/dist/chunk-CDW7MFPG.js.map +1 -0
  28. package/dist/{chunk-DCAD2JPP.js → chunk-EZL5DILH.js} +7 -6
  29. package/dist/chunk-EZL5DILH.js.map +1 -0
  30. package/dist/{chunk-ARO2DNGS.js → chunk-EZZKHMR4.js} +4 -2
  31. package/dist/chunk-EZZKHMR4.js.map +1 -0
  32. package/dist/{chunk-TQ77ZWBD.js → chunk-F4GMOMUT.js} +3 -3
  33. package/dist/{chunk-TQ77ZWBD.js.map → chunk-F4GMOMUT.js.map} +1 -1
  34. package/dist/{chunk-R6URPHEP.cjs → chunk-FHRVSYJU.cjs} +4 -3
  35. package/dist/chunk-FHRVSYJU.cjs.map +1 -0
  36. package/dist/{chunk-QSGAFKK2.js → chunk-HN5J7TK6.js} +46 -11
  37. package/dist/chunk-HN5J7TK6.js.map +1 -0
  38. package/dist/{chunk-6CAXLP7D.cjs → chunk-HNJXBMHI.cjs} +6 -6
  39. package/dist/{chunk-6CAXLP7D.cjs.map → chunk-HNJXBMHI.cjs.map} +1 -1
  40. package/dist/chunk-I3LAFKJU.js +16 -0
  41. package/dist/chunk-I3LAFKJU.js.map +1 -0
  42. package/dist/{chunk-23AVEYUP.js → chunk-J7S42MJP.js} +87 -29
  43. package/dist/chunk-J7S42MJP.js.map +1 -0
  44. package/dist/{chunk-HFK5SBNM.cjs → chunk-KKYILQTG.cjs} +7 -5
  45. package/dist/chunk-KKYILQTG.cjs.map +1 -0
  46. package/dist/{chunk-7FYRFNPX.cjs → chunk-LBSAWRFT.cjs} +52 -17
  47. package/dist/chunk-LBSAWRFT.cjs.map +1 -0
  48. package/dist/{chunk-FVI4JDLA.js → chunk-M6UAVA2I.js} +4 -2
  49. package/dist/chunk-M6UAVA2I.js.map +1 -0
  50. package/dist/{chunk-2LQR4EAN.js → chunk-NAYXNVNU.js} +7 -3
  51. package/dist/chunk-NAYXNVNU.js.map +1 -0
  52. package/dist/{chunk-G5DMYAWL.cjs → chunk-O5ORO2RX.cjs} +5 -2
  53. package/dist/chunk-O5ORO2RX.cjs.map +1 -0
  54. package/dist/{chunk-B4LVQ4QI.js → chunk-PJNUGSKI.js} +3 -3
  55. package/dist/{chunk-B4LVQ4QI.js.map → chunk-PJNUGSKI.js.map} +1 -1
  56. package/dist/{chunk-464QSZ4A.cjs → chunk-R3EJNGJV.cjs} +7 -3
  57. package/dist/chunk-R3EJNGJV.cjs.map +1 -0
  58. package/dist/chunk-S42OGG43.js +9 -0
  59. package/dist/chunk-S42OGG43.js.map +1 -0
  60. package/dist/{chunk-VZNBTCGA.js → chunk-TCMOD3WW.js} +4 -3
  61. package/dist/chunk-TCMOD3WW.js.map +1 -0
  62. package/dist/{chunk-6MXFZ3B5.cjs → chunk-UK6BGM74.cjs} +4 -3
  63. package/dist/chunk-UK6BGM74.cjs.map +1 -0
  64. package/dist/{chunk-XS3EIQFP.js → chunk-WZAKEJDL.js} +5 -2
  65. package/dist/chunk-WZAKEJDL.js.map +1 -0
  66. package/dist/{chunk-SAG6DHQK.cjs → chunk-XAKZ6VBP.cjs} +92 -34
  67. package/dist/chunk-XAKZ6VBP.cjs.map +1 -0
  68. package/dist/chunk-XNHAJQRF.cjs +69 -0
  69. package/dist/chunk-XNHAJQRF.cjs.map +1 -0
  70. package/dist/command.cjs +4 -3
  71. package/dist/command.js +2 -1
  72. package/dist/composer.cjs +7 -4
  73. package/dist/composer.d.cts +44 -2
  74. package/dist/composer.d.ts +44 -2
  75. package/dist/composer.js +5 -2
  76. package/dist/content-renderer.cjs +5 -4
  77. package/dist/content-renderer.js +2 -1
  78. package/dist/editor.cjs +5 -4
  79. package/dist/editor.js +3 -2
  80. package/dist/file-browser.cjs +6 -5
  81. package/dist/file-browser.js +2 -1
  82. package/dist/{index-XR5t8bTq.d.ts → index-BAtF94lw.d.ts} +69 -5
  83. package/dist/{index-DWtSViJ3.d.cts → index-xwL2MACB.d.cts} +69 -5
  84. package/dist/index.cjs +61 -58
  85. package/dist/index.cjs.map +1 -1
  86. package/dist/index.d.cts +3 -2
  87. package/dist/index.d.ts +3 -2
  88. package/dist/index.js +16 -13
  89. package/dist/index.js.map +1 -1
  90. package/dist/input-tag.cjs +7 -6
  91. package/dist/input-tag.js +2 -1
  92. package/dist/input.cjs +4 -3
  93. package/dist/input.js +3 -2
  94. package/dist/inputs.cjs +6 -5
  95. package/dist/inputs.js +4 -3
  96. package/dist/json-editor.cjs +16 -15
  97. package/dist/json-editor.js +5 -4
  98. package/dist/paste-pills.cjs +15 -14
  99. package/dist/paste-pills.d.cts +1 -1
  100. package/dist/paste-pills.d.ts +1 -1
  101. package/dist/paste-pills.js +2 -1
  102. package/dist/pillbox.cjs +3 -2
  103. package/dist/pillbox.js +2 -1
  104. package/dist/prompt-input.cjs +8 -5
  105. package/dist/prompt-input.d.cts +2 -1
  106. package/dist/prompt-input.d.ts +2 -1
  107. package/dist/prompt-input.js +5 -2
  108. package/dist/select.cjs +3 -2
  109. package/dist/select.js +2 -1
  110. package/dist/use-acknowledged-submit-7nC0vSCP.d.cts +12 -0
  111. package/dist/use-acknowledged-submit-7nC0vSCP.d.ts +12 -0
  112. package/docs/Composer.md +62 -2
  113. package/docs/ContentRenderer.md +4 -1
  114. package/docs/PromptInput.md +67 -6
  115. package/package.json +1 -1
  116. package/dist/chunk-23AVEYUP.js.map +0 -1
  117. package/dist/chunk-2LQR4EAN.js.map +0 -1
  118. package/dist/chunk-464QSZ4A.cjs.map +0 -1
  119. package/dist/chunk-6MXFZ3B5.cjs.map +0 -1
  120. package/dist/chunk-7FYRFNPX.cjs.map +0 -1
  121. package/dist/chunk-ARO2DNGS.js.map +0 -1
  122. package/dist/chunk-BX7EDTL4.js.map +0 -1
  123. package/dist/chunk-DCAD2JPP.js.map +0 -1
  124. package/dist/chunk-FVI4JDLA.js.map +0 -1
  125. package/dist/chunk-G35XN5WV.js.map +0 -1
  126. package/dist/chunk-G5DMYAWL.cjs.map +0 -1
  127. package/dist/chunk-HFK5SBNM.cjs.map +0 -1
  128. package/dist/chunk-KSU6RYWU.cjs.map +0 -1
  129. package/dist/chunk-QSGAFKK2.js.map +0 -1
  130. package/dist/chunk-R6URPHEP.cjs.map +0 -1
  131. package/dist/chunk-SAG6DHQK.cjs.map +0 -1
  132. package/dist/chunk-U5LKNGHU.cjs.map +0 -1
  133. package/dist/chunk-UJRMY54A.cjs.map +0 -1
  134. package/dist/chunk-VZNBTCGA.js.map +0 -1
  135. package/dist/chunk-WKPBCB67.cjs.map +0 -1
  136. package/dist/chunk-XS3EIQFP.js.map +0 -1
  137. package/dist/chunk-YIKXJWO4.js.map +0 -1
package/dist/command.js CHANGED
@@ -1,6 +1,7 @@
1
- export { Command, useCommand } from './chunk-ARO2DNGS.js';
1
+ export { Command, useCommand } from './chunk-EZZKHMR4.js';
2
2
  import './chunk-5U2DZ7AV.js';
3
3
  import './chunk-3K2CEAI7.js';
4
+ import './chunk-S42OGG43.js';
4
5
  import './chunk-5VMILVWD.js';
5
6
  import './chunk-RBCMKPBX.js';
6
7
  import './chunk-YX6FTJ6N.js';
package/dist/composer.cjs CHANGED
@@ -1,9 +1,12 @@
1
1
  'use strict';
2
2
 
3
- var chunk7FYRFNPX_cjs = require('./chunk-7FYRFNPX.cjs');
4
- var chunkHFK5SBNM_cjs = require('./chunk-HFK5SBNM.cjs');
3
+ var chunkLBSAWRFT_cjs = require('./chunk-LBSAWRFT.cjs');
4
+ require('./chunk-XNHAJQRF.cjs');
5
+ var chunkKKYILQTG_cjs = require('./chunk-KKYILQTG.cjs');
5
6
  require('./chunk-MKGWHSNV.cjs');
7
+ require('./chunk-2C64OVOZ.cjs');
6
8
  require('./chunk-J2DI6RMR.cjs');
9
+ require('./chunk-6V44RRSB.cjs');
7
10
  require('./chunk-MKHYENKR.cjs');
8
11
  require('./chunk-TI7D4QDM.cjs');
9
12
  require('./chunk-57FQGQJK.cjs');
@@ -15,11 +18,11 @@ require('./chunk-ZU5Q77OT.cjs');
15
18
 
16
19
  Object.defineProperty(exports, "Composer", {
17
20
  enumerable: true,
18
- get: function () { return chunk7FYRFNPX_cjs.Composer; }
21
+ get: function () { return chunkLBSAWRFT_cjs.Composer; }
19
22
  });
20
23
  Object.defineProperty(exports, "pasteMarker", {
21
24
  enumerable: true,
22
- get: function () { return chunkHFK5SBNM_cjs.pasteMarker; }
25
+ get: function () { return chunkKKYILQTG_cjs.pasteMarker; }
23
26
  });
24
27
  //# sourceMappingURL=composer.cjs.map
25
28
  //# sourceMappingURL=composer.cjs.map
@@ -2,6 +2,8 @@ import * as react from 'react';
2
2
  import { ReactNode } from 'react';
3
3
  import { H as HeldImage, C as ComposerPastePreview, a as ComposerPasteClassNames, b as HeldPaste } from './PastePills.types-CpXzsuwJ.cjs';
4
4
  export { p as pasteMarker } from './PastePills.types-CpXzsuwJ.cjs';
5
+ import { a as SubmitResult } from './use-acknowledged-submit-7nC0vSCP.cjs';
6
+ export { S as SubmitRejection } from './use-acknowledged-submit-7nC0vSCP.cjs';
5
7
 
6
8
  interface ComposerSubmitExtras {
7
9
  /**
@@ -18,11 +20,51 @@ interface ComposerProps {
18
20
  /**
19
21
  * The second argument only ever carries anything with `pasteImages` on. A
20
22
  * one-argument handler stays valid.
23
+ *
24
+ * **Return nothing and the message clears at once, as it always has.**
25
+ *
26
+ * Return a Promise to make the send acknowledged: the text and held pastes
27
+ * stay, the send button is disabled and `aria-busy`, and a second send is
28
+ * refused until it settles. The text stays editable meanwhile.
29
+ *
30
+ * - Resolves (to anything but `{ ok: false }`) → the message clears, unless the
31
+ * person edited it while it was in flight; their newer text is kept.
32
+ * - Rejects, or resolves `{ ok: false, error? }` → everything is kept,
33
+ * `onSubmitError` is called and the failure is announced to screen readers.
34
+ *
35
+ * With a controlled `value` the clear is an `onChange("")` like any other; the
36
+ * host decides whether to apply it.
37
+ */
38
+ onSubmit?: (value: string, extras: ComposerSubmitExtras) => void | Promise<SubmitResult>;
39
+ /**
40
+ * Called when a Promise from `onSubmit` rejects (with the reason) or resolves
41
+ * `{ ok: false }` (with its `error`, or `undefined`). The message is kept.
21
42
  */
22
- onSubmit?: (value: string, extras: ComposerSubmitExtras) => void;
43
+ onSubmitError?: (error: unknown) => void;
23
44
  placeholder?: string;
24
45
  actions?: ReactNode;
46
+ /** Disables the text, the pills and the send. */
25
47
  disabled?: boolean;
48
+ /**
49
+ * Disables only the send: the text stays editable, Enter does not send. For
50
+ * "the agent is still answering, but you can write the next message".
51
+ */
52
+ sendDisabled?: boolean;
53
+ /**
54
+ * Form field name for the text. On the textarea itself; with
55
+ * `pastePlacement="inline"` on a hidden input carrying the expanded text,
56
+ * since a contenteditable is not a form field. With the default placement,
57
+ * held pastes are NOT in the textarea's value — read `onSubmit` for those.
58
+ */
59
+ name?: string;
60
+ /**
61
+ * `id` of the text field (textarea or inline editor), for a `<label htmlFor>`
62
+ * or an agent. In either mode it is the one handle that does not change with
63
+ * `pastePlacement`. Without it the field is found by
64
+ * `data-react-fancy-composer-textarea` (default placement) or
65
+ * `data-react-fancy-composer-input` (inline).
66
+ */
67
+ inputId?: string;
26
68
  className?: string;
27
69
  /**
28
70
  * Hold a paste of at least this many characters as a pill, instead of inserting
@@ -94,4 +136,4 @@ interface ComposerProps {
94
136
 
95
137
  declare const Composer: react.ForwardRefExoticComponent<ComposerProps & react.RefAttributes<HTMLDivElement>>;
96
138
 
97
- export { Composer, ComposerPasteClassNames, ComposerPastePreview, type ComposerProps, type ComposerSubmitExtras, HeldImage, HeldPaste };
139
+ export { Composer, ComposerPasteClassNames, ComposerPastePreview, type ComposerProps, type ComposerSubmitExtras, HeldImage, HeldPaste, SubmitResult };
@@ -2,6 +2,8 @@ import * as react from 'react';
2
2
  import { ReactNode } from 'react';
3
3
  import { H as HeldImage, C as ComposerPastePreview, a as ComposerPasteClassNames, b as HeldPaste } from './PastePills.types-CpXzsuwJ.js';
4
4
  export { p as pasteMarker } from './PastePills.types-CpXzsuwJ.js';
5
+ import { a as SubmitResult } from './use-acknowledged-submit-7nC0vSCP.js';
6
+ export { S as SubmitRejection } from './use-acknowledged-submit-7nC0vSCP.js';
5
7
 
6
8
  interface ComposerSubmitExtras {
7
9
  /**
@@ -18,11 +20,51 @@ interface ComposerProps {
18
20
  /**
19
21
  * The second argument only ever carries anything with `pasteImages` on. A
20
22
  * one-argument handler stays valid.
23
+ *
24
+ * **Return nothing and the message clears at once, as it always has.**
25
+ *
26
+ * Return a Promise to make the send acknowledged: the text and held pastes
27
+ * stay, the send button is disabled and `aria-busy`, and a second send is
28
+ * refused until it settles. The text stays editable meanwhile.
29
+ *
30
+ * - Resolves (to anything but `{ ok: false }`) → the message clears, unless the
31
+ * person edited it while it was in flight; their newer text is kept.
32
+ * - Rejects, or resolves `{ ok: false, error? }` → everything is kept,
33
+ * `onSubmitError` is called and the failure is announced to screen readers.
34
+ *
35
+ * With a controlled `value` the clear is an `onChange("")` like any other; the
36
+ * host decides whether to apply it.
37
+ */
38
+ onSubmit?: (value: string, extras: ComposerSubmitExtras) => void | Promise<SubmitResult>;
39
+ /**
40
+ * Called when a Promise from `onSubmit` rejects (with the reason) or resolves
41
+ * `{ ok: false }` (with its `error`, or `undefined`). The message is kept.
21
42
  */
22
- onSubmit?: (value: string, extras: ComposerSubmitExtras) => void;
43
+ onSubmitError?: (error: unknown) => void;
23
44
  placeholder?: string;
24
45
  actions?: ReactNode;
46
+ /** Disables the text, the pills and the send. */
25
47
  disabled?: boolean;
48
+ /**
49
+ * Disables only the send: the text stays editable, Enter does not send. For
50
+ * "the agent is still answering, but you can write the next message".
51
+ */
52
+ sendDisabled?: boolean;
53
+ /**
54
+ * Form field name for the text. On the textarea itself; with
55
+ * `pastePlacement="inline"` on a hidden input carrying the expanded text,
56
+ * since a contenteditable is not a form field. With the default placement,
57
+ * held pastes are NOT in the textarea's value — read `onSubmit` for those.
58
+ */
59
+ name?: string;
60
+ /**
61
+ * `id` of the text field (textarea or inline editor), for a `<label htmlFor>`
62
+ * or an agent. In either mode it is the one handle that does not change with
63
+ * `pastePlacement`. Without it the field is found by
64
+ * `data-react-fancy-composer-textarea` (default placement) or
65
+ * `data-react-fancy-composer-input` (inline).
66
+ */
67
+ inputId?: string;
26
68
  className?: string;
27
69
  /**
28
70
  * Hold a paste of at least this many characters as a pill, instead of inserting
@@ -94,4 +136,4 @@ interface ComposerProps {
94
136
 
95
137
  declare const Composer: react.ForwardRefExoticComponent<ComposerProps & react.RefAttributes<HTMLDivElement>>;
96
138
 
97
- export { Composer, ComposerPasteClassNames, ComposerPastePreview, type ComposerProps, type ComposerSubmitExtras, HeldImage, HeldPaste };
139
+ export { Composer, ComposerPasteClassNames, ComposerPastePreview, type ComposerProps, type ComposerSubmitExtras, HeldImage, HeldPaste, SubmitResult };
package/dist/composer.js CHANGED
@@ -1,7 +1,10 @@
1
- export { Composer } from './chunk-QSGAFKK2.js';
2
- export { pasteMarker } from './chunk-YIKXJWO4.js';
1
+ export { Composer } from './chunk-HN5J7TK6.js';
2
+ import './chunk-AC3W3TIV.js';
3
+ export { pasteMarker } from './chunk-6PRXG7L6.js';
3
4
  import './chunk-QTS4Q2NK.js';
5
+ import './chunk-I3LAFKJU.js';
4
6
  import './chunk-MQ6VGG62.js';
7
+ import './chunk-S42OGG43.js';
5
8
  import './chunk-5VMILVWD.js';
6
9
  import './chunk-RBCMKPBX.js';
7
10
  import './chunk-RGANGU7X.js';
@@ -1,7 +1,8 @@
1
1
  'use strict';
2
2
 
3
3
  require('./chunk-S3TRSECD.cjs');
4
- var chunk464QSZ4A_cjs = require('./chunk-464QSZ4A.cjs');
4
+ var chunkR3EJNGJV_cjs = require('./chunk-R3EJNGJV.cjs');
5
+ require('./chunk-2C64OVOZ.cjs');
5
6
  require('./chunk-3U7PUZLI.cjs');
6
7
  require('./chunk-XCZZVRBY.cjs');
7
8
  require('./chunk-MXWR3T3N.cjs');
@@ -11,15 +12,15 @@ require('./chunk-ZU5Q77OT.cjs');
11
12
 
12
13
  Object.defineProperty(exports, "ContentRenderer", {
13
14
  enumerable: true,
14
- get: function () { return chunk464QSZ4A_cjs.ContentRenderer; }
15
+ get: function () { return chunkR3EJNGJV_cjs.ContentRenderer; }
15
16
  });
16
17
  Object.defineProperty(exports, "registerExtension", {
17
18
  enumerable: true,
18
- get: function () { return chunk464QSZ4A_cjs.registerExtension; }
19
+ get: function () { return chunkR3EJNGJV_cjs.registerExtension; }
19
20
  });
20
21
  Object.defineProperty(exports, "registerExtensions", {
21
22
  enumerable: true,
22
- get: function () { return chunk464QSZ4A_cjs.registerExtensions; }
23
+ get: function () { return chunkR3EJNGJV_cjs.registerExtensions; }
23
24
  });
24
25
  //# sourceMappingURL=content-renderer.cjs.map
25
26
  //# sourceMappingURL=content-renderer.cjs.map
@@ -1,5 +1,6 @@
1
1
  import './chunk-AUTW5O4W.js';
2
- export { ContentRenderer, registerExtension, registerExtensions } from './chunk-2LQR4EAN.js';
2
+ export { ContentRenderer, registerExtension, registerExtensions } from './chunk-NAYXNVNU.js';
3
+ import './chunk-I3LAFKJU.js';
3
4
  import './chunk-OXERDFFF.js';
4
5
  import './chunk-45BBNJQD.js';
5
6
  import './chunk-J3A4Z2P7.js';
package/dist/editor.cjs CHANGED
@@ -1,15 +1,16 @@
1
1
  'use strict';
2
2
 
3
- var chunkE4DXICU3_cjs = require('./chunk-E4DXICU3.cjs');
3
+ var chunk5YRSYS2F_cjs = require('./chunk-5YRSYS2F.cjs');
4
4
  require('./chunk-A2JUTNE6.cjs');
5
5
  require('./chunk-T6YELZPJ.cjs');
6
6
  require('./chunk-VQJ5LJJH.cjs');
7
7
  require('./chunk-4GOOSZEK.cjs');
8
- require('./chunk-464QSZ4A.cjs');
8
+ require('./chunk-R3EJNGJV.cjs');
9
9
  require('./chunk-AIA5UNQ5.cjs');
10
10
  require('./chunk-G7227RTY.cjs');
11
11
  require('./chunk-TXTRTTG7.cjs');
12
12
  require('./chunk-FQZE5N2N.cjs');
13
+ require('./chunk-2C64OVOZ.cjs');
13
14
  require('./chunk-L3V3BYVS.cjs');
14
15
  require('./chunk-J2DI6RMR.cjs');
15
16
  require('./chunk-TI7D4QDM.cjs');
@@ -25,11 +26,11 @@ require('./chunk-ZU5Q77OT.cjs');
25
26
 
26
27
  Object.defineProperty(exports, "Editor", {
27
28
  enumerable: true,
28
- get: function () { return chunkE4DXICU3_cjs.Editor; }
29
+ get: function () { return chunk5YRSYS2F_cjs.Editor; }
29
30
  });
30
31
  Object.defineProperty(exports, "useEditor", {
31
32
  enumerable: true,
32
- get: function () { return chunkE4DXICU3_cjs.useEditor; }
33
+ get: function () { return chunk5YRSYS2F_cjs.useEditor; }
33
34
  });
34
35
  //# sourceMappingURL=editor.cjs.map
35
36
  //# sourceMappingURL=editor.cjs.map
package/dist/editor.js CHANGED
@@ -1,13 +1,14 @@
1
- export { Editor, useEditor } from './chunk-TQ77ZWBD.js';
1
+ export { Editor, useEditor } from './chunk-F4GMOMUT.js';
2
2
  import './chunk-2BXMMVQS.js';
3
3
  import './chunk-CPY7NHXM.js';
4
4
  import './chunk-RP43ZFZP.js';
5
5
  import './chunk-ZQ3VXRUY.js';
6
- import './chunk-2LQR4EAN.js';
6
+ import './chunk-NAYXNVNU.js';
7
7
  import './chunk-TJ66S5K6.js';
8
8
  import './chunk-FBWUXSKH.js';
9
9
  import './chunk-5U2DZ7AV.js';
10
10
  import './chunk-3K2CEAI7.js';
11
+ import './chunk-I3LAFKJU.js';
11
12
  import './chunk-NRXK42LO.js';
12
13
  import './chunk-MQ6VGG62.js';
13
14
  import './chunk-RBCMKPBX.js';
@@ -1,6 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var chunkG5DMYAWL_cjs = require('./chunk-G5DMYAWL.cjs');
3
+ var chunkO5ORO2RX_cjs = require('./chunk-O5ORO2RX.cjs');
4
+ require('./chunk-6V44RRSB.cjs');
4
5
  require('./chunk-SNHU2AI4.cjs');
5
6
  require('./chunk-ZU5Q77OT.cjs');
6
7
 
@@ -8,19 +9,19 @@ require('./chunk-ZU5Q77OT.cjs');
8
9
 
9
10
  Object.defineProperty(exports, "FileBrowser", {
10
11
  enumerable: true,
11
- get: function () { return chunkG5DMYAWL_cjs.FileBrowser; }
12
+ get: function () { return chunkO5ORO2RX_cjs.FileBrowser; }
12
13
  });
13
14
  Object.defineProperty(exports, "FileBrowserNewFolder", {
14
15
  enumerable: true,
15
- get: function () { return chunkG5DMYAWL_cjs.FileBrowserNewFolder; }
16
+ get: function () { return chunkO5ORO2RX_cjs.FileBrowserNewFolder; }
16
17
  });
17
18
  Object.defineProperty(exports, "useFileBrowser", {
18
19
  enumerable: true,
19
- get: function () { return chunkG5DMYAWL_cjs.useFileBrowser; }
20
+ get: function () { return chunkO5ORO2RX_cjs.useFileBrowser; }
20
21
  });
21
22
  Object.defineProperty(exports, "validateFolderName", {
22
23
  enumerable: true,
23
- get: function () { return chunkG5DMYAWL_cjs.validateFolderName; }
24
+ get: function () { return chunkO5ORO2RX_cjs.validateFolderName; }
24
25
  });
25
26
  //# sourceMappingURL=file-browser.cjs.map
26
27
  //# sourceMappingURL=file-browser.cjs.map
@@ -1,4 +1,5 @@
1
- export { FileBrowser, FileBrowserNewFolder, useFileBrowser, validateFolderName } from './chunk-XS3EIQFP.js';
1
+ export { FileBrowser, FileBrowserNewFolder, useFileBrowser, validateFolderName } from './chunk-WZAKEJDL.js';
2
+ import './chunk-S42OGG43.js';
2
3
  import './chunk-EDYAXGUM.js';
3
4
  import './chunk-MMW2JGKZ.js';
4
5
  //# sourceMappingURL=file-browser.js.map
@@ -1,5 +1,6 @@
1
1
  import * as react from 'react';
2
2
  import { HTMLAttributes, ReactNode } from 'react';
3
+ import { a as SubmitResult } from './use-acknowledged-submit-7nC0vSCP.js';
3
4
  import { C as ComposerPastePreview, a as ComposerPasteClassNames } from './PastePills.types-CpXzsuwJ.js';
4
5
 
5
6
  /**
@@ -68,6 +69,21 @@ interface PromptSetDraftOptions {
68
69
  * (genie#1235 was exactly that).
69
70
  */
70
71
  focus?: boolean;
72
+ /**
73
+ * With `focus: true`: whether the browser may scroll to reveal the composer.
74
+ * Default `true` (no scrolling): a bare `el.focus()` scrolls EVERY scrollable
75
+ * ancestor up to the document, which scrolled a whole host window
76
+ * (genie#1290). Pass `false` to let it scroll.
77
+ */
78
+ preventScroll?: boolean;
79
+ }
80
+ /** Options for `PromptInputHandle.focus()`. Mirrors the DOM's `FocusOptions`. */
81
+ interface PromptFocusOptions {
82
+ /**
83
+ * Default `true`: focusing never scrolls the page or any ancestor
84
+ * (genie#1290). Pass `false` to let the browser scroll the composer into view.
85
+ */
86
+ preventScroll?: boolean;
71
87
  }
72
88
  /** The imperative handle a `ref` on `PromptInput` receives. */
73
89
  interface PromptInputHandle {
@@ -79,8 +95,11 @@ interface PromptInputHandle {
79
95
  * A draft whose `v` this release does not know is refused with a warning.
80
96
  */
81
97
  setDraft(draft: PromptDraft, options?: PromptSetDraftOptions): void;
82
- /** Focus the composer, caret at the end. */
83
- focus(): void;
98
+ /**
99
+ * Focus the composer, caret at the end. Does not scroll anything unless
100
+ * `{ preventScroll: false }`.
101
+ */
102
+ focus(options?: PromptFocusOptions): void;
84
103
  }
85
104
  /**
86
105
  * Read a File as a `data:` URL. Pass it as `persistAttachment` to keep the bytes
@@ -275,8 +294,53 @@ interface PromptInputProps extends Omit<HTMLAttributes<HTMLDivElement>, "onSubmi
275
294
  * true key gets named.
276
295
  */
277
296
  platform?: FancyPlatform;
278
- /** Called on ⌘/Ctrl+Enter or send button. */
279
- onSubmit: (text: string, attachments: PromptAttachment[]) => void;
297
+ /**
298
+ * Called on ⌘/Ctrl+Enter or send button.
299
+ *
300
+ * **Return nothing and the draft empties at once, as it always has.**
301
+ *
302
+ * Return a Promise to make the send acknowledged: the text, pills and
303
+ * attachments stay, the send button is disabled and `aria-busy`, and a second
304
+ * send is refused until it settles. The text stays editable meanwhile.
305
+ *
306
+ * - Resolves (to anything but `{ ok: false }`) → the draft empties in one
307
+ * commit, unless the person changed it while the send was in flight; their
308
+ * newer draft is kept.
309
+ * - Rejects, or resolves `{ ok: false, error? }` → the draft is kept,
310
+ * `onSubmitError` is called and the failure is announced to screen readers.
311
+ *
312
+ * With a controlled `value` or `draft` the reset reaches the host through
313
+ * `onChange("")` / `onDraftChange(empty)` like any other change, and the host
314
+ * decides whether to apply it.
315
+ */
316
+ onSubmit: (text: string, attachments: PromptAttachment[]) => void | Promise<SubmitResult>;
317
+ /**
318
+ * Called when a Promise from `onSubmit` rejects (with the reason) or resolves
319
+ * `{ ok: false }` (with its `error`, or `undefined`). The draft is kept.
320
+ */
321
+ onSubmitError?: (error: unknown) => void;
322
+ /** Disables the text, attaching, dropping and the send. */
323
+ disabled?: boolean;
324
+ /**
325
+ * Disables only the send: the text stays editable and attachable, and
326
+ * ⌘/Ctrl+Enter does not send. For "the agent is still answering, but you can
327
+ * write the next message".
328
+ */
329
+ sendDisabled?: boolean;
330
+ /**
331
+ * Form field name for the text. On the textarea itself; with inline pills on
332
+ * (`pasteThreshold` / `pasteImages`), on a hidden input carrying the expanded
333
+ * text, since a contenteditable is not a form field.
334
+ */
335
+ name?: string;
336
+ /**
337
+ * `id` of the text field (textarea or inline editor). `id` itself names the
338
+ * root, as it always has. It is the one handle that does not change when inline
339
+ * pills switch the field type. Without it the field is found by
340
+ * `data-react-fancy-prompt-input-textarea` or, with inline pills,
341
+ * `data-react-fancy-composer-input`.
342
+ */
343
+ inputId?: string;
280
344
  /**
281
345
  * Placeholder text. Defaults to a hint naming the modifier THIS platform
282
346
  * actually has, so leaving it unset is the better option — a hardcoded
@@ -348,4 +412,4 @@ interface PromptInputProps extends Omit<HTMLAttributes<HTMLDivElement>, "onSubmi
348
412
  }
349
413
  declare const PromptInput: react.ForwardRefExoticComponent<PromptInputProps & react.RefAttributes<PromptInputHandle>>;
350
414
 
351
- export { type FancyPlatform as F, type PlatformHints as P, type PromptAttachment as a, type PromptCmd as b, type PromptDraft as c, type PromptDraftFile as d, type PromptDraftPill as e, PromptInput as f, type PromptInputHandle as g, type PromptInputProps as h, type PromptMention as i, type PromptSetDraftOptions as j, browserPlatformHints as k, detectPlatform as l, modifierKeyLabel as m, promptFileToDataUrl as n, promptDataUrlToFile as p };
415
+ export { type FancyPlatform as F, type PlatformHints as P, type PromptAttachment as a, type PromptCmd as b, type PromptDraft as c, type PromptDraftFile as d, type PromptDraftPill as e, type PromptFocusOptions as f, PromptInput as g, type PromptInputHandle as h, type PromptInputProps as i, type PromptMention as j, type PromptSetDraftOptions as k, browserPlatformHints as l, detectPlatform as m, modifierKeyLabel as n, promptFileToDataUrl as o, promptDataUrlToFile as p };
@@ -1,5 +1,6 @@
1
1
  import * as react from 'react';
2
2
  import { HTMLAttributes, ReactNode } from 'react';
3
+ import { a as SubmitResult } from './use-acknowledged-submit-7nC0vSCP.cjs';
3
4
  import { C as ComposerPastePreview, a as ComposerPasteClassNames } from './PastePills.types-CpXzsuwJ.cjs';
4
5
 
5
6
  /**
@@ -68,6 +69,21 @@ interface PromptSetDraftOptions {
68
69
  * (genie#1235 was exactly that).
69
70
  */
70
71
  focus?: boolean;
72
+ /**
73
+ * With `focus: true`: whether the browser may scroll to reveal the composer.
74
+ * Default `true` (no scrolling): a bare `el.focus()` scrolls EVERY scrollable
75
+ * ancestor up to the document, which scrolled a whole host window
76
+ * (genie#1290). Pass `false` to let it scroll.
77
+ */
78
+ preventScroll?: boolean;
79
+ }
80
+ /** Options for `PromptInputHandle.focus()`. Mirrors the DOM's `FocusOptions`. */
81
+ interface PromptFocusOptions {
82
+ /**
83
+ * Default `true`: focusing never scrolls the page or any ancestor
84
+ * (genie#1290). Pass `false` to let the browser scroll the composer into view.
85
+ */
86
+ preventScroll?: boolean;
71
87
  }
72
88
  /** The imperative handle a `ref` on `PromptInput` receives. */
73
89
  interface PromptInputHandle {
@@ -79,8 +95,11 @@ interface PromptInputHandle {
79
95
  * A draft whose `v` this release does not know is refused with a warning.
80
96
  */
81
97
  setDraft(draft: PromptDraft, options?: PromptSetDraftOptions): void;
82
- /** Focus the composer, caret at the end. */
83
- focus(): void;
98
+ /**
99
+ * Focus the composer, caret at the end. Does not scroll anything unless
100
+ * `{ preventScroll: false }`.
101
+ */
102
+ focus(options?: PromptFocusOptions): void;
84
103
  }
85
104
  /**
86
105
  * Read a File as a `data:` URL. Pass it as `persistAttachment` to keep the bytes
@@ -275,8 +294,53 @@ interface PromptInputProps extends Omit<HTMLAttributes<HTMLDivElement>, "onSubmi
275
294
  * true key gets named.
276
295
  */
277
296
  platform?: FancyPlatform;
278
- /** Called on ⌘/Ctrl+Enter or send button. */
279
- onSubmit: (text: string, attachments: PromptAttachment[]) => void;
297
+ /**
298
+ * Called on ⌘/Ctrl+Enter or send button.
299
+ *
300
+ * **Return nothing and the draft empties at once, as it always has.**
301
+ *
302
+ * Return a Promise to make the send acknowledged: the text, pills and
303
+ * attachments stay, the send button is disabled and `aria-busy`, and a second
304
+ * send is refused until it settles. The text stays editable meanwhile.
305
+ *
306
+ * - Resolves (to anything but `{ ok: false }`) → the draft empties in one
307
+ * commit, unless the person changed it while the send was in flight; their
308
+ * newer draft is kept.
309
+ * - Rejects, or resolves `{ ok: false, error? }` → the draft is kept,
310
+ * `onSubmitError` is called and the failure is announced to screen readers.
311
+ *
312
+ * With a controlled `value` or `draft` the reset reaches the host through
313
+ * `onChange("")` / `onDraftChange(empty)` like any other change, and the host
314
+ * decides whether to apply it.
315
+ */
316
+ onSubmit: (text: string, attachments: PromptAttachment[]) => void | Promise<SubmitResult>;
317
+ /**
318
+ * Called when a Promise from `onSubmit` rejects (with the reason) or resolves
319
+ * `{ ok: false }` (with its `error`, or `undefined`). The draft is kept.
320
+ */
321
+ onSubmitError?: (error: unknown) => void;
322
+ /** Disables the text, attaching, dropping and the send. */
323
+ disabled?: boolean;
324
+ /**
325
+ * Disables only the send: the text stays editable and attachable, and
326
+ * ⌘/Ctrl+Enter does not send. For "the agent is still answering, but you can
327
+ * write the next message".
328
+ */
329
+ sendDisabled?: boolean;
330
+ /**
331
+ * Form field name for the text. On the textarea itself; with inline pills on
332
+ * (`pasteThreshold` / `pasteImages`), on a hidden input carrying the expanded
333
+ * text, since a contenteditable is not a form field.
334
+ */
335
+ name?: string;
336
+ /**
337
+ * `id` of the text field (textarea or inline editor). `id` itself names the
338
+ * root, as it always has. It is the one handle that does not change when inline
339
+ * pills switch the field type. Without it the field is found by
340
+ * `data-react-fancy-prompt-input-textarea` or, with inline pills,
341
+ * `data-react-fancy-composer-input`.
342
+ */
343
+ inputId?: string;
280
344
  /**
281
345
  * Placeholder text. Defaults to a hint naming the modifier THIS platform
282
346
  * actually has, so leaving it unset is the better option — a hardcoded
@@ -348,4 +412,4 @@ interface PromptInputProps extends Omit<HTMLAttributes<HTMLDivElement>, "onSubmi
348
412
  }
349
413
  declare const PromptInput: react.ForwardRefExoticComponent<PromptInputProps & react.RefAttributes<PromptInputHandle>>;
350
414
 
351
- export { type FancyPlatform as F, type PlatformHints as P, type PromptAttachment as a, type PromptCmd as b, type PromptDraft as c, type PromptDraftFile as d, type PromptDraftPill as e, PromptInput as f, type PromptInputHandle as g, type PromptInputProps as h, type PromptMention as i, type PromptSetDraftOptions as j, browserPlatformHints as k, detectPlatform as l, modifierKeyLabel as m, promptFileToDataUrl as n, promptDataUrlToFile as p };
415
+ export { type FancyPlatform as F, type PlatformHints as P, type PromptAttachment as a, type PromptCmd as b, type PromptDraft as c, type PromptDraftFile as d, type PromptDraftPill as e, type PromptFocusOptions as f, PromptInput as g, type PromptInputHandle as h, type PromptInputProps as i, type PromptMention as j, type PromptSetDraftOptions as k, browserPlatformHints as l, detectPlatform as m, modifierKeyLabel as n, promptFileToDataUrl as o, promptDataUrlToFile as p };