@particle-academy/react-fancy 5.50.0 → 5.51.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 (113) hide show
  1. package/CHANGELOG.md +53 -0
  2. package/dist/chart.cjs +2 -2
  3. package/dist/chart.d.cts +9 -1
  4. package/dist/chart.d.ts +9 -1
  5. package/dist/chart.js +1 -1
  6. package/dist/{chunk-T5OCRKPD.cjs → chunk-23PAOCQQ.cjs} +4 -4
  7. package/dist/{chunk-T5OCRKPD.cjs.map → chunk-23PAOCQQ.cjs.map} +1 -1
  8. package/dist/{chunk-GBGJWAXZ.cjs → chunk-25UPDBI6.cjs} +4 -4
  9. package/dist/{chunk-GBGJWAXZ.cjs.map → chunk-25UPDBI6.cjs.map} +1 -1
  10. package/dist/chunk-3K2CEAI7.js +78 -0
  11. package/dist/chunk-3K2CEAI7.js.map +1 -0
  12. package/dist/{chunk-L637KPEA.js → chunk-4NBM3LXN.js} +3 -3
  13. package/dist/{chunk-L637KPEA.js.map → chunk-4NBM3LXN.js.map} +1 -1
  14. package/dist/{chunk-2QIGXSSZ.cjs → chunk-7ZDJPHLJ.cjs} +6 -6
  15. package/dist/{chunk-2QIGXSSZ.cjs.map → chunk-7ZDJPHLJ.cjs.map} +1 -1
  16. package/dist/{chunk-VWBKFQQN.cjs → chunk-ATANWEXA.cjs} +8 -8
  17. package/dist/{chunk-VWBKFQQN.cjs.map → chunk-ATANWEXA.cjs.map} +1 -1
  18. package/dist/{chunk-7B3HK6TY.cjs → chunk-B6CQ4KK7.cjs} +6 -4
  19. package/dist/chunk-B6CQ4KK7.cjs.map +1 -0
  20. package/dist/{chunk-YQJWD53X.js → chunk-ENYHLZ2X.js} +3 -3
  21. package/dist/{chunk-YQJWD53X.js.map → chunk-ENYHLZ2X.js.map} +1 -1
  22. package/dist/chunk-FQZE5N2N.cjs +80 -0
  23. package/dist/chunk-FQZE5N2N.cjs.map +1 -0
  24. package/dist/{chunk-PV5WDIGM.cjs → chunk-FVG3YXXM.cjs} +4 -4
  25. package/dist/{chunk-PV5WDIGM.cjs.map → chunk-FVG3YXXM.cjs.map} +1 -1
  26. package/dist/{chunk-KYZNCVRD.js → chunk-FYKOLKQZ.js} +43 -26
  27. package/dist/chunk-FYKOLKQZ.js.map +1 -0
  28. package/dist/{chunk-FU6R6BZ4.js → chunk-GAB2QXHH.js} +102 -40
  29. package/dist/chunk-GAB2QXHH.js.map +1 -0
  30. package/dist/{chunk-Z43BI7CQ.cjs → chunk-GU5BYZTR.cjs} +4 -4
  31. package/dist/{chunk-Z43BI7CQ.cjs.map → chunk-GU5BYZTR.cjs.map} +1 -1
  32. package/dist/{chunk-TXCAIL5X.cjs → chunk-HKRB2Z6R.cjs} +4 -4
  33. package/dist/{chunk-TXCAIL5X.cjs.map → chunk-HKRB2Z6R.cjs.map} +1 -1
  34. package/dist/{chunk-7MJ7VEKE.js → chunk-IAUJKZAQ.js} +3 -3
  35. package/dist/{chunk-7MJ7VEKE.js.map → chunk-IAUJKZAQ.js.map} +1 -1
  36. package/dist/{chunk-CK6LRROH.js → chunk-M5ACSJJ4.js} +6 -4
  37. package/dist/chunk-M5ACSJJ4.js.map +1 -0
  38. package/dist/{chunk-XBC3M4BL.js → chunk-MGE5KOVA.js} +3 -3
  39. package/dist/{chunk-XBC3M4BL.js.map → chunk-MGE5KOVA.js.map} +1 -1
  40. package/dist/{chunk-IPBEVSSC.cjs → chunk-MH4QS7OE.cjs} +6 -6
  41. package/dist/{chunk-IPBEVSSC.cjs.map → chunk-MH4QS7OE.cjs.map} +1 -1
  42. package/dist/{chunk-P7F32HIH.js → chunk-N6OZZAOT.js} +3 -3
  43. package/dist/{chunk-P7F32HIH.js.map → chunk-N6OZZAOT.js.map} +1 -1
  44. package/dist/{chunk-VFIVF5YO.js → chunk-PHDIQ4VC.js} +3 -3
  45. package/dist/{chunk-VFIVF5YO.js.map → chunk-PHDIQ4VC.js.map} +1 -1
  46. package/dist/{chunk-MSRYJETY.cjs → chunk-R3UG6PVX.cjs} +42 -25
  47. package/dist/chunk-R3UG6PVX.cjs.map +1 -0
  48. package/dist/{chunk-NAQJF3G6.cjs → chunk-SAPOYAGN.cjs} +101 -39
  49. package/dist/chunk-SAPOYAGN.cjs.map +1 -0
  50. package/dist/{chunk-BR27AXFE.cjs → chunk-SYVOGYJG.cjs} +9 -9
  51. package/dist/{chunk-BR27AXFE.cjs.map → chunk-SYVOGYJG.cjs.map} +1 -1
  52. package/dist/{chunk-NYDR2VSA.js → chunk-TNYWQ6EQ.js} +3 -3
  53. package/dist/{chunk-NYDR2VSA.js.map → chunk-TNYWQ6EQ.js.map} +1 -1
  54. package/dist/{chunk-SWBF2BXA.js → chunk-TT3K5D6J.js} +3 -3
  55. package/dist/{chunk-SWBF2BXA.js.map → chunk-TT3K5D6J.js.map} +1 -1
  56. package/dist/{chunk-W7IP6RT3.cjs → chunk-WBVWV2V7.cjs} +4 -4
  57. package/dist/{chunk-W7IP6RT3.cjs.map → chunk-WBVWV2V7.cjs.map} +1 -1
  58. package/dist/{chunk-EEWRLFTI.js → chunk-XB6YHUKW.js} +3 -3
  59. package/dist/{chunk-EEWRLFTI.js.map → chunk-XB6YHUKW.js.map} +1 -1
  60. package/dist/{chunk-D354R6T6.js → chunk-ZY4CVNNZ.js} +3 -3
  61. package/dist/{chunk-D354R6T6.js.map → chunk-ZY4CVNNZ.js.map} +1 -1
  62. package/dist/command.cjs +4 -4
  63. package/dist/command.js +2 -2
  64. package/dist/composer.cjs +7 -5
  65. package/dist/composer.js +5 -3
  66. package/dist/context-menu.cjs +4 -4
  67. package/dist/context-menu.js +2 -2
  68. package/dist/drawer.cjs +4 -4
  69. package/dist/drawer.js +2 -2
  70. package/dist/dropdown.cjs +4 -4
  71. package/dist/dropdown.js +2 -2
  72. package/dist/editor.cjs +1 -1
  73. package/dist/editor.js +1 -1
  74. package/dist/index.cjs +64 -64
  75. package/dist/index.d.cts +11 -1
  76. package/dist/index.d.ts +11 -1
  77. package/dist/index.js +16 -16
  78. package/dist/input.cjs +6 -4
  79. package/dist/input.js +5 -3
  80. package/dist/inputs.cjs +4 -4
  81. package/dist/inputs.js +3 -3
  82. package/dist/json-editor.cjs +15 -15
  83. package/dist/json-editor.js +4 -4
  84. package/dist/magic-wand.cjs +3 -2
  85. package/dist/magic-wand.d.cts +51 -6
  86. package/dist/magic-wand.d.ts +51 -6
  87. package/dist/magic-wand.js +2 -1
  88. package/dist/mobile-menu.cjs +4 -4
  89. package/dist/mobile-menu.js +2 -2
  90. package/dist/modal.cjs +4 -4
  91. package/dist/modal.js +2 -2
  92. package/dist/paste-pills.cjs +17 -15
  93. package/dist/paste-pills.d.cts +3 -1
  94. package/dist/paste-pills.d.ts +3 -1
  95. package/dist/paste-pills.js +4 -2
  96. package/dist/prompt-input.cjs +7 -4
  97. package/dist/prompt-input.js +6 -3
  98. package/dist/sidebar.cjs +1 -1
  99. package/dist/sidebar.js +1 -1
  100. package/dist/styles.css.map +1 -1
  101. package/docs/Chart.md +6 -0
  102. package/docs/MagicWand.md +29 -2
  103. package/package.json +1 -1
  104. package/dist/chunk-3WGRVDQR.cjs +0 -39
  105. package/dist/chunk-3WGRVDQR.cjs.map +0 -1
  106. package/dist/chunk-7B3HK6TY.cjs.map +0 -1
  107. package/dist/chunk-CHADHN6M.js +0 -37
  108. package/dist/chunk-CHADHN6M.js.map +0 -1
  109. package/dist/chunk-CK6LRROH.js.map +0 -1
  110. package/dist/chunk-FU6R6BZ4.js.map +0 -1
  111. package/dist/chunk-KYZNCVRD.js.map +0 -1
  112. package/dist/chunk-MSRYJETY.cjs.map +0 -1
  113. package/dist/chunk-NAQJF3G6.cjs.map +0 -1
package/dist/input.js CHANGED
@@ -1,15 +1,17 @@
1
1
  import './chunk-SHDSKHCC.js';
2
- export { Input } from './chunk-EEWRLFTI.js';
2
+ export { Input } from './chunk-XB6YHUKW.js';
3
3
  import './chunk-PWEZCMIY.js';
4
4
  import './chunk-KKWNKBKR.js';
5
5
  import './chunk-5MU6X3KO.js';
6
6
  import './chunk-GFYSELJF.js';
7
- import './chunk-KYZNCVRD.js';
8
- import './chunk-CF5KRDN4.js';
7
+ import './chunk-FYKOLKQZ.js';
8
+ import './chunk-6KXAFP2T.js';
9
9
  import './chunk-OL53XYHF.js';
10
10
  import './chunk-NRXK42LO.js';
11
11
  import './chunk-MQ6VGG62.js';
12
12
  import './chunk-WHEXTDPV.js';
13
+ import './chunk-RGANGU7X.js';
14
+ import './chunk-JXE5XID6.js';
13
15
  import './chunk-EDYAXGUM.js';
14
16
  import './chunk-MMW2JGKZ.js';
15
17
  //# sourceMappingURL=input.js.map
package/dist/inputs.cjs CHANGED
@@ -12,7 +12,7 @@ var chunk6MDZQIMZ_cjs = require('./chunk-6MDZQIMZ.cjs');
12
12
  var chunkU7PFHQBN_cjs = require('./chunk-U7PFHQBN.cjs');
13
13
  var chunkBZDXX6E3_cjs = require('./chunk-BZDXX6E3.cjs');
14
14
  require('./chunk-URTLYNZI.cjs');
15
- var chunk2QIGXSSZ_cjs = require('./chunk-2QIGXSSZ.cjs');
15
+ var chunk7ZDJPHLJ_cjs = require('./chunk-7ZDJPHLJ.cjs');
16
16
  var chunkAR3JOPGT_cjs = require('./chunk-AR3JOPGT.cjs');
17
17
  var chunkY52NXM73_cjs = require('./chunk-Y52NXM73.cjs');
18
18
  var chunkBZZDHDMK_cjs = require('./chunk-BZZDHDMK.cjs');
@@ -21,8 +21,8 @@ require('./chunk-7EZBMGEE.cjs');
21
21
  var chunkXKDW6B7X_cjs = require('./chunk-XKDW6B7X.cjs');
22
22
  var chunkBBOIFV27_cjs = require('./chunk-BBOIFV27.cjs');
23
23
  require('./chunk-YLGTDBB2.cjs');
24
- require('./chunk-MSRYJETY.cjs');
25
- require('./chunk-X7H75WVP.cjs');
24
+ require('./chunk-R3UG6PVX.cjs');
25
+ require('./chunk-WKNVZUWZ.cjs');
26
26
  var chunkKJ22KE56_cjs = require('./chunk-KJ22KE56.cjs');
27
27
  var chunkL3V3BYVS_cjs = require('./chunk-L3V3BYVS.cjs');
28
28
  require('./chunk-J2DI6RMR.cjs');
@@ -64,7 +64,7 @@ Object.defineProperty(exports, "CheckboxGroup", {
64
64
  });
65
65
  Object.defineProperty(exports, "Input", {
66
66
  enumerable: true,
67
- get: function () { return chunk2QIGXSSZ_cjs.Input; }
67
+ get: function () { return chunk7ZDJPHLJ_cjs.Input; }
68
68
  });
69
69
  Object.defineProperty(exports, "Select", {
70
70
  enumerable: true,
package/dist/inputs.js CHANGED
@@ -10,7 +10,7 @@ export { Form, FormProvider } from './chunk-PQWQ5K6J.js';
10
10
  export { Checkbox } from './chunk-4HRD4S25.js';
11
11
  export { CheckboxGroup } from './chunk-FNJDMGJ3.js';
12
12
  import './chunk-V4EARA4F.js';
13
- export { Input } from './chunk-EEWRLFTI.js';
13
+ export { Input } from './chunk-XB6YHUKW.js';
14
14
  export { Select } from './chunk-IECPLOSZ.js';
15
15
  export { Switch } from './chunk-NBAHXZHJ.js';
16
16
  export { DatePicker } from './chunk-OC75GWX5.js';
@@ -19,8 +19,8 @@ import './chunk-PWEZCMIY.js';
19
19
  export { DisplayValue } from './chunk-KKWNKBKR.js';
20
20
  export { Field } from './chunk-5MU6X3KO.js';
21
21
  import './chunk-GFYSELJF.js';
22
- import './chunk-KYZNCVRD.js';
23
- import './chunk-CF5KRDN4.js';
22
+ import './chunk-FYKOLKQZ.js';
23
+ import './chunk-6KXAFP2T.js';
24
24
  export { useInlineEdit } from './chunk-OL53XYHF.js';
25
25
  export { FieldModeContext, useFieldMode } from './chunk-NRXK42LO.js';
26
26
  import './chunk-MQ6VGG62.js';
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var chunkVWBKFQQN_cjs = require('./chunk-VWBKFQQN.cjs');
4
- require('./chunk-2QIGXSSZ.cjs');
3
+ var chunkATANWEXA_cjs = require('./chunk-ATANWEXA.cjs');
4
+ require('./chunk-7ZDJPHLJ.cjs');
5
5
  require('./chunk-AR3JOPGT.cjs');
6
6
  require('./chunk-Y52NXM73.cjs');
7
7
  require('./chunk-BZZDHDMK.cjs');
@@ -11,8 +11,8 @@ require('./chunk-XKDW6B7X.cjs');
11
11
  require('./chunk-BBOIFV27.cjs');
12
12
  require('./chunk-YLGTDBB2.cjs');
13
13
  require('./chunk-BVRPDMB7.cjs');
14
- require('./chunk-MSRYJETY.cjs');
15
- require('./chunk-X7H75WVP.cjs');
14
+ require('./chunk-R3UG6PVX.cjs');
15
+ require('./chunk-WKNVZUWZ.cjs');
16
16
  require('./chunk-MOU6O324.cjs');
17
17
  require('./chunk-FWA4PCW7.cjs');
18
18
  require('./chunk-X2FC7ODX.cjs');
@@ -33,47 +33,47 @@ require('./chunk-ZU5Q77OT.cjs');
33
33
 
34
34
  Object.defineProperty(exports, "JsonEditor", {
35
35
  enumerable: true,
36
- get: function () { return chunkVWBKFQQN_cjs.JsonEditor; }
36
+ get: function () { return chunkATANWEXA_cjs.JsonEditor; }
37
37
  });
38
38
  Object.defineProperty(exports, "applyJsonEdit", {
39
39
  enumerable: true,
40
- get: function () { return chunkVWBKFQQN_cjs.applyJsonEdit; }
40
+ get: function () { return chunkATANWEXA_cjs.applyJsonEdit; }
41
41
  });
42
42
  Object.defineProperty(exports, "describeEdit", {
43
43
  enumerable: true,
44
- get: function () { return chunkVWBKFQQN_cjs.describeEdit; }
44
+ get: function () { return chunkATANWEXA_cjs.describeEdit; }
45
45
  });
46
46
  Object.defineProperty(exports, "findJsonConflicts", {
47
47
  enumerable: true,
48
- get: function () { return chunkVWBKFQQN_cjs.findJsonConflicts; }
48
+ get: function () { return chunkATANWEXA_cjs.findJsonConflicts; }
49
49
  });
50
50
  Object.defineProperty(exports, "getAtPath", {
51
51
  enumerable: true,
52
- get: function () { return chunkVWBKFQQN_cjs.getAtPath; }
52
+ get: function () { return chunkATANWEXA_cjs.getAtPath; }
53
53
  });
54
54
  Object.defineProperty(exports, "inferType", {
55
55
  enumerable: true,
56
- get: function () { return chunkVWBKFQQN_cjs.inferType; }
56
+ get: function () { return chunkATANWEXA_cjs.inferType; }
57
57
  });
58
58
  Object.defineProperty(exports, "parseKeyMap", {
59
59
  enumerable: true,
60
- get: function () { return chunkVWBKFQQN_cjs.parseKeyMap; }
60
+ get: function () { return chunkATANWEXA_cjs.parseKeyMap; }
61
61
  });
62
62
  Object.defineProperty(exports, "parsePath", {
63
63
  enumerable: true,
64
- get: function () { return chunkVWBKFQQN_cjs.parsePath; }
64
+ get: function () { return chunkATANWEXA_cjs.parsePath; }
65
65
  });
66
66
  Object.defineProperty(exports, "pathToString", {
67
67
  enumerable: true,
68
- get: function () { return chunkVWBKFQQN_cjs.pathToString; }
68
+ get: function () { return chunkATANWEXA_cjs.pathToString; }
69
69
  });
70
70
  Object.defineProperty(exports, "resolveKeyRule", {
71
71
  enumerable: true,
72
- get: function () { return chunkVWBKFQQN_cjs.resolveKeyRule; }
72
+ get: function () { return chunkATANWEXA_cjs.resolveKeyRule; }
73
73
  });
74
74
  Object.defineProperty(exports, "typeMatches", {
75
75
  enumerable: true,
76
- get: function () { return chunkVWBKFQQN_cjs.typeMatches; }
76
+ get: function () { return chunkATANWEXA_cjs.typeMatches; }
77
77
  });
78
78
  //# sourceMappingURL=json-editor.cjs.map
79
79
  //# sourceMappingURL=json-editor.cjs.map
@@ -1,5 +1,5 @@
1
- export { JsonEditor, applyJsonEdit, describeEdit, findJsonConflicts, getAtPath, inferType, parseKeyMap, parsePath, pathToString, resolveKeyRule, typeMatches } from './chunk-7MJ7VEKE.js';
2
- import './chunk-EEWRLFTI.js';
1
+ export { JsonEditor, applyJsonEdit, describeEdit, findJsonConflicts, getAtPath, inferType, parseKeyMap, parsePath, pathToString, resolveKeyRule, typeMatches } from './chunk-IAUJKZAQ.js';
2
+ import './chunk-XB6YHUKW.js';
3
3
  import './chunk-IECPLOSZ.js';
4
4
  import './chunk-NBAHXZHJ.js';
5
5
  import './chunk-OC75GWX5.js';
@@ -9,8 +9,8 @@ import './chunk-KKWNKBKR.js';
9
9
  import './chunk-5MU6X3KO.js';
10
10
  import './chunk-GFYSELJF.js';
11
11
  import './chunk-F2GAZZVS.js';
12
- import './chunk-KYZNCVRD.js';
13
- import './chunk-CF5KRDN4.js';
12
+ import './chunk-FYKOLKQZ.js';
13
+ import './chunk-6KXAFP2T.js';
14
14
  import './chunk-6FCQD2KQ.js';
15
15
  import './chunk-KODD54GT.js';
16
16
  import './chunk-6TBRBN7H.js';
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkNAQJF3G6_cjs = require('./chunk-NAQJF3G6.cjs');
3
+ var chunkSAPOYAGN_cjs = require('./chunk-SAPOYAGN.cjs');
4
4
  require('./chunk-V6VFSX6V.cjs');
5
5
  require('./chunk-7EZBMGEE.cjs');
6
6
  require('./chunk-XKDW6B7X.cjs');
@@ -15,13 +15,14 @@ require('./chunk-XCZZVRBY.cjs');
15
15
  require('./chunk-QKFOJKVE.cjs');
16
16
  require('./chunk-KJ22KE56.cjs');
17
17
  require('./chunk-L3V3BYVS.cjs');
18
+ require('./chunk-NBZC6LOB.cjs');
18
19
  require('./chunk-ZU5Q77OT.cjs');
19
20
 
20
21
 
21
22
 
22
23
  Object.defineProperty(exports, "MagicWand", {
23
24
  enumerable: true,
24
- get: function () { return chunkNAQJF3G6_cjs.MagicWand; }
25
+ get: function () { return chunkSAPOYAGN_cjs.MagicWand; }
25
26
  });
26
27
  //# sourceMappingURL=magic-wand.cjs.map
27
28
  //# sourceMappingURL=magic-wand.cjs.map
@@ -1,4 +1,5 @@
1
1
  import * as react from 'react';
2
+ import { RefObject } from 'react';
2
3
 
3
4
  /**
4
5
  * MagicWand — selection-anchored floating toolbar for text inputs.
@@ -18,6 +19,12 @@ import * as react from 'react';
18
19
  * ]}
19
20
  * />
20
21
  *
22
+ * Pass `target` to act on a textarea, input or editor the HOST renders instead:
23
+ * MagicWand then renders no textarea of its own, only the floating wand.
24
+ *
25
+ * <textarea ref={ref} value={body} onChange={(e) => setBody(e.target.value)} />
26
+ * <MagicWand target={ref} value={body} onValueChange={setBody} actions={…} />
27
+ *
21
28
  * Two appearances: `"floating"` (default — full labels) and `"pill"`
22
29
  * (icon-only, compact). Auto-hides on click-away or scroll by default.
23
30
  */
@@ -39,24 +46,62 @@ type MagicWandAction = {
39
46
  run: (selection: string, range: MagicWandSelection) => Promise<string> | string;
40
47
  };
41
48
  type MagicWandAppearance = "pill" | "floating";
49
+ /** A viewport rectangle, the shape `getBoundingClientRect()` returns. */
50
+ type MagicWandRect = {
51
+ left: number;
52
+ top: number;
53
+ width: number;
54
+ height: number;
55
+ };
56
+ /**
57
+ * How MagicWand reads a selection out of an editor it does not own — a code
58
+ * editor, a contenteditable, anything that is not a plain textarea.
59
+ *
60
+ * Read-only on purpose. The write goes through `onValueChange`, like every other
61
+ * edit, so the host's `value` stays the one source of truth and the editor is
62
+ * updated the way it always is: from that value.
63
+ */
64
+ interface MagicWandTargetAdapter {
65
+ /**
66
+ * The editor's element. MagicWand listens on it for `mouseup` / `keyup` /
67
+ * `select` to know the selection may have changed, and treats a click inside
68
+ * it as "not away" for `autoHide`.
69
+ */
70
+ element: RefObject<HTMLElement | null> | HTMLElement | null;
71
+ /** The selection as offsets into `value`. `null` or `start === end` hides the wand. */
72
+ getSelection: () => {
73
+ start: number;
74
+ end: number;
75
+ } | null;
76
+ /** Where the selection is on screen. Default: the top-centre of `element`. */
77
+ getSelectionRect?: () => MagicWandRect | null;
78
+ }
79
+ /** A host-owned textarea / input by ref, or an adapter for anything else. */
80
+ type MagicWandTarget = RefObject<HTMLTextAreaElement | HTMLInputElement | null> | MagicWandTargetAdapter;
42
81
  interface MagicWandProps {
43
- /** Controlled textarea value. */
82
+ /** Controlled value — of the built-in textarea, or of `target`. */
44
83
  value: string;
45
- /** Called on every edit. */
84
+ /** Called on every edit, and with the result of an action. */
46
85
  onValueChange: (v: string) => void;
47
86
  /** Action list. */
48
87
  actions: MagicWandAction[];
88
+ /**
89
+ * Act on a textarea / input / editor the host renders, instead of rendering
90
+ * one. A ref to a textarea or input works as is; anything else takes a
91
+ * `MagicWandTargetAdapter`. `value` must still be the target's current value.
92
+ */
93
+ target?: MagicWandTarget;
49
94
  /** Visual treatment. Defaults to "floating". */
50
95
  appearance?: MagicWandAppearance;
51
96
  /** Auto-hide the wand on click-away or scroll. Defaults to true. */
52
97
  autoHide?: boolean;
53
- /** Textarea rows. */
98
+ /** Textarea rows (built-in textarea only). */
54
99
  rows?: number;
55
- /** Placeholder. */
100
+ /** Placeholder (built-in textarea only). */
56
101
  placeholder?: string;
57
102
  /** Called after an action runs successfully. */
58
103
  onAction?: (action: MagicWandAction, selection: MagicWandSelection, replacement: string) => void;
59
104
  }
60
- declare function MagicWand({ value, onValueChange, actions, appearance, autoHide, rows, placeholder, onAction, }: MagicWandProps): react.JSX.Element;
105
+ declare function MagicWand({ value, onValueChange, actions, target, appearance, autoHide, rows, placeholder, onAction, }: MagicWandProps): react.JSX.Element | null;
61
106
 
62
- export { MagicWand, type MagicWandAction, type MagicWandAppearance, type MagicWandProps, type MagicWandSelection };
107
+ export { MagicWand, type MagicWandAction, type MagicWandAppearance, type MagicWandProps, type MagicWandRect, type MagicWandSelection, type MagicWandTarget, type MagicWandTargetAdapter };
@@ -1,4 +1,5 @@
1
1
  import * as react from 'react';
2
+ import { RefObject } from 'react';
2
3
 
3
4
  /**
4
5
  * MagicWand — selection-anchored floating toolbar for text inputs.
@@ -18,6 +19,12 @@ import * as react from 'react';
18
19
  * ]}
19
20
  * />
20
21
  *
22
+ * Pass `target` to act on a textarea, input or editor the HOST renders instead:
23
+ * MagicWand then renders no textarea of its own, only the floating wand.
24
+ *
25
+ * <textarea ref={ref} value={body} onChange={(e) => setBody(e.target.value)} />
26
+ * <MagicWand target={ref} value={body} onValueChange={setBody} actions={…} />
27
+ *
21
28
  * Two appearances: `"floating"` (default — full labels) and `"pill"`
22
29
  * (icon-only, compact). Auto-hides on click-away or scroll by default.
23
30
  */
@@ -39,24 +46,62 @@ type MagicWandAction = {
39
46
  run: (selection: string, range: MagicWandSelection) => Promise<string> | string;
40
47
  };
41
48
  type MagicWandAppearance = "pill" | "floating";
49
+ /** A viewport rectangle, the shape `getBoundingClientRect()` returns. */
50
+ type MagicWandRect = {
51
+ left: number;
52
+ top: number;
53
+ width: number;
54
+ height: number;
55
+ };
56
+ /**
57
+ * How MagicWand reads a selection out of an editor it does not own — a code
58
+ * editor, a contenteditable, anything that is not a plain textarea.
59
+ *
60
+ * Read-only on purpose. The write goes through `onValueChange`, like every other
61
+ * edit, so the host's `value` stays the one source of truth and the editor is
62
+ * updated the way it always is: from that value.
63
+ */
64
+ interface MagicWandTargetAdapter {
65
+ /**
66
+ * The editor's element. MagicWand listens on it for `mouseup` / `keyup` /
67
+ * `select` to know the selection may have changed, and treats a click inside
68
+ * it as "not away" for `autoHide`.
69
+ */
70
+ element: RefObject<HTMLElement | null> | HTMLElement | null;
71
+ /** The selection as offsets into `value`. `null` or `start === end` hides the wand. */
72
+ getSelection: () => {
73
+ start: number;
74
+ end: number;
75
+ } | null;
76
+ /** Where the selection is on screen. Default: the top-centre of `element`. */
77
+ getSelectionRect?: () => MagicWandRect | null;
78
+ }
79
+ /** A host-owned textarea / input by ref, or an adapter for anything else. */
80
+ type MagicWandTarget = RefObject<HTMLTextAreaElement | HTMLInputElement | null> | MagicWandTargetAdapter;
42
81
  interface MagicWandProps {
43
- /** Controlled textarea value. */
82
+ /** Controlled value — of the built-in textarea, or of `target`. */
44
83
  value: string;
45
- /** Called on every edit. */
84
+ /** Called on every edit, and with the result of an action. */
46
85
  onValueChange: (v: string) => void;
47
86
  /** Action list. */
48
87
  actions: MagicWandAction[];
88
+ /**
89
+ * Act on a textarea / input / editor the host renders, instead of rendering
90
+ * one. A ref to a textarea or input works as is; anything else takes a
91
+ * `MagicWandTargetAdapter`. `value` must still be the target's current value.
92
+ */
93
+ target?: MagicWandTarget;
49
94
  /** Visual treatment. Defaults to "floating". */
50
95
  appearance?: MagicWandAppearance;
51
96
  /** Auto-hide the wand on click-away or scroll. Defaults to true. */
52
97
  autoHide?: boolean;
53
- /** Textarea rows. */
98
+ /** Textarea rows (built-in textarea only). */
54
99
  rows?: number;
55
- /** Placeholder. */
100
+ /** Placeholder (built-in textarea only). */
56
101
  placeholder?: string;
57
102
  /** Called after an action runs successfully. */
58
103
  onAction?: (action: MagicWandAction, selection: MagicWandSelection, replacement: string) => void;
59
104
  }
60
- declare function MagicWand({ value, onValueChange, actions, appearance, autoHide, rows, placeholder, onAction, }: MagicWandProps): react.JSX.Element;
105
+ declare function MagicWand({ value, onValueChange, actions, target, appearance, autoHide, rows, placeholder, onAction, }: MagicWandProps): react.JSX.Element | null;
61
106
 
62
- export { MagicWand, type MagicWandAction, type MagicWandAppearance, type MagicWandProps, type MagicWandSelection };
107
+ export { MagicWand, type MagicWandAction, type MagicWandAppearance, type MagicWandProps, type MagicWandRect, type MagicWandSelection, type MagicWandTarget, type MagicWandTargetAdapter };
@@ -1,4 +1,4 @@
1
- export { MagicWand } from './chunk-FU6R6BZ4.js';
1
+ export { MagicWand } from './chunk-GAB2QXHH.js';
2
2
  import './chunk-DEFGT75G.js';
3
3
  import './chunk-PWEZCMIY.js';
4
4
  import './chunk-KKWNKBKR.js';
@@ -13,6 +13,7 @@ import './chunk-45BBNJQD.js';
13
13
  import './chunk-IVRYSSM7.js';
14
14
  import './chunk-OL53XYHF.js';
15
15
  import './chunk-NRXK42LO.js';
16
+ import './chunk-WHEXTDPV.js';
16
17
  import './chunk-MMW2JGKZ.js';
17
18
  //# sourceMappingURL=magic-wand.js.map
18
19
  //# sourceMappingURL=magic-wand.js.map
@@ -1,10 +1,10 @@
1
1
  'use strict';
2
2
 
3
- var chunkGBGJWAXZ_cjs = require('./chunk-GBGJWAXZ.cjs');
3
+ var chunk25UPDBI6_cjs = require('./chunk-25UPDBI6.cjs');
4
4
  require('./chunk-HPNIEYSJ.cjs');
5
5
  require('./chunk-T6YELZPJ.cjs');
6
6
  require('./chunk-TXTRTTG7.cjs');
7
- require('./chunk-3WGRVDQR.cjs');
7
+ require('./chunk-FQZE5N2N.cjs');
8
8
  require('./chunk-J2DI6RMR.cjs');
9
9
  require('./chunk-NBZC6LOB.cjs');
10
10
  require('./chunk-57FQGQJK.cjs');
@@ -16,11 +16,11 @@ require('./chunk-ZU5Q77OT.cjs');
16
16
 
17
17
  Object.defineProperty(exports, "MobileMenu", {
18
18
  enumerable: true,
19
- get: function () { return chunkGBGJWAXZ_cjs.MobileMenu; }
19
+ get: function () { return chunk25UPDBI6_cjs.MobileMenu; }
20
20
  });
21
21
  Object.defineProperty(exports, "useMobileMenu", {
22
22
  enumerable: true,
23
- get: function () { return chunkGBGJWAXZ_cjs.useMobileMenu; }
23
+ get: function () { return chunk25UPDBI6_cjs.useMobileMenu; }
24
24
  });
25
25
  //# sourceMappingURL=mobile-menu.cjs.map
26
26
  //# sourceMappingURL=mobile-menu.cjs.map
@@ -1,8 +1,8 @@
1
- export { MobileMenu, useMobileMenu } from './chunk-P7F32HIH.js';
1
+ export { MobileMenu, useMobileMenu } from './chunk-N6OZZAOT.js';
2
2
  import './chunk-FWCREAIT.js';
3
3
  import './chunk-CPY7NHXM.js';
4
4
  import './chunk-5U2DZ7AV.js';
5
- import './chunk-CHADHN6M.js';
5
+ import './chunk-3K2CEAI7.js';
6
6
  import './chunk-MQ6VGG62.js';
7
7
  import './chunk-WHEXTDPV.js';
8
8
  import './chunk-RGANGU7X.js';
package/dist/modal.cjs CHANGED
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
- var chunkTXCAIL5X_cjs = require('./chunk-TXCAIL5X.cjs');
3
+ var chunkHKRB2Z6R_cjs = require('./chunk-HKRB2Z6R.cjs');
4
4
  require('./chunk-TXTRTTG7.cjs');
5
- require('./chunk-3WGRVDQR.cjs');
5
+ require('./chunk-FQZE5N2N.cjs');
6
6
  require('./chunk-NBZC6LOB.cjs');
7
7
  require('./chunk-RXDRYWVD.cjs');
8
8
  require('./chunk-ZU5Q77OT.cjs');
@@ -11,11 +11,11 @@ require('./chunk-ZU5Q77OT.cjs');
11
11
 
12
12
  Object.defineProperty(exports, "Modal", {
13
13
  enumerable: true,
14
- get: function () { return chunkTXCAIL5X_cjs.Modal; }
14
+ get: function () { return chunkHKRB2Z6R_cjs.Modal; }
15
15
  });
16
16
  Object.defineProperty(exports, "useModal", {
17
17
  enumerable: true,
18
- get: function () { return chunkTXCAIL5X_cjs.useModal; }
18
+ get: function () { return chunkHKRB2Z6R_cjs.useModal; }
19
19
  });
20
20
  //# sourceMappingURL=modal.cjs.map
21
21
  //# sourceMappingURL=modal.cjs.map
package/dist/modal.js CHANGED
@@ -1,6 +1,6 @@
1
- export { Modal, useModal } from './chunk-NYDR2VSA.js';
1
+ export { Modal, useModal } from './chunk-TNYWQ6EQ.js';
2
2
  import './chunk-5U2DZ7AV.js';
3
- import './chunk-CHADHN6M.js';
3
+ import './chunk-3K2CEAI7.js';
4
4
  import './chunk-WHEXTDPV.js';
5
5
  import './chunk-JXE5XID6.js';
6
6
  import './chunk-MMW2JGKZ.js';
@@ -1,9 +1,11 @@
1
1
  'use strict';
2
2
 
3
- var chunkMSRYJETY_cjs = require('./chunk-MSRYJETY.cjs');
4
- require('./chunk-X7H75WVP.cjs');
3
+ var chunkR3UG6PVX_cjs = require('./chunk-R3UG6PVX.cjs');
4
+ require('./chunk-WKNVZUWZ.cjs');
5
5
  require('./chunk-J2DI6RMR.cjs');
6
6
  require('./chunk-NBZC6LOB.cjs');
7
+ require('./chunk-57FQGQJK.cjs');
8
+ require('./chunk-RXDRYWVD.cjs');
7
9
  require('./chunk-SNHU2AI4.cjs');
8
10
  require('./chunk-ZU5Q77OT.cjs');
9
11
 
@@ -11,55 +13,55 @@ require('./chunk-ZU5Q77OT.cjs');
11
13
 
12
14
  Object.defineProperty(exports, "HOST_ATTR", {
13
15
  enumerable: true,
14
- get: function () { return chunkMSRYJETY_cjs.HOST_ATTR; }
16
+ get: function () { return chunkR3UG6PVX_cjs.HOST_ATTR; }
15
17
  });
16
18
  Object.defineProperty(exports, "InlinePasteEditor", {
17
19
  enumerable: true,
18
- get: function () { return chunkMSRYJETY_cjs.InlinePasteEditor; }
20
+ get: function () { return chunkR3UG6PVX_cjs.InlinePasteEditor; }
19
21
  });
20
22
  Object.defineProperty(exports, "InlinePill", {
21
23
  enumerable: true,
22
- get: function () { return chunkMSRYJETY_cjs.InlinePill; }
24
+ get: function () { return chunkR3UG6PVX_cjs.InlinePill; }
23
25
  });
24
26
  Object.defineProperty(exports, "PILL_MARK", {
25
27
  enumerable: true,
26
- get: function () { return chunkMSRYJETY_cjs.PILL_MARK; }
28
+ get: function () { return chunkR3UG6PVX_cjs.PILL_MARK; }
27
29
  });
28
30
  Object.defineProperty(exports, "PastedFilesInput", {
29
31
  enumerable: true,
30
- get: function () { return chunkMSRYJETY_cjs.PastedFilesInput; }
32
+ get: function () { return chunkR3UG6PVX_cjs.PastedFilesInput; }
31
33
  });
32
34
  Object.defineProperty(exports, "endsOf", {
33
35
  enumerable: true,
34
- get: function () { return chunkMSRYJETY_cjs.endsOf; }
36
+ get: function () { return chunkR3UG6PVX_cjs.endsOf; }
35
37
  });
36
38
  Object.defineProperty(exports, "expandMarkers", {
37
39
  enumerable: true,
38
- get: function () { return chunkMSRYJETY_cjs.expandMarkers; }
40
+ get: function () { return chunkR3UG6PVX_cjs.expandMarkers; }
39
41
  });
40
42
  Object.defineProperty(exports, "markedIds", {
41
43
  enumerable: true,
42
- get: function () { return chunkMSRYJETY_cjs.markedIds; }
44
+ get: function () { return chunkR3UG6PVX_cjs.markedIds; }
43
45
  });
44
46
  Object.defineProperty(exports, "pasteMarker", {
45
47
  enumerable: true,
46
- get: function () { return chunkMSRYJETY_cjs.pasteMarker; }
48
+ get: function () { return chunkR3UG6PVX_cjs.pasteMarker; }
47
49
  });
48
50
  Object.defineProperty(exports, "segmentValue", {
49
51
  enumerable: true,
50
- get: function () { return chunkMSRYJETY_cjs.segmentValue; }
52
+ get: function () { return chunkR3UG6PVX_cjs.segmentValue; }
51
53
  });
52
54
  Object.defineProperty(exports, "useInlinePaste", {
53
55
  enumerable: true,
54
- get: function () { return chunkMSRYJETY_cjs.useInlinePaste; }
56
+ get: function () { return chunkR3UG6PVX_cjs.useInlinePaste; }
55
57
  });
56
58
  Object.defineProperty(exports, "usePastePills", {
57
59
  enumerable: true,
58
- get: function () { return chunkMSRYJETY_cjs.usePastePills; }
60
+ get: function () { return chunkR3UG6PVX_cjs.usePastePills; }
59
61
  });
60
62
  Object.defineProperty(exports, "withSeparators", {
61
63
  enumerable: true,
62
- get: function () { return chunkMSRYJETY_cjs.withSeparators; }
64
+ get: function () { return chunkR3UG6PVX_cjs.withSeparators; }
63
65
  });
64
66
  //# sourceMappingURL=paste-pills.cjs.map
65
67
  //# sourceMappingURL=paste-pills.cjs.map
@@ -27,7 +27,9 @@ interface InlinePillProps {
27
27
  * One pill inside the message, portalled by `Composer` into a placeholder the
28
28
  * editor made. Internal — its own file so its props are not read as `Composer`'s.
29
29
  *
30
- * The hover preview is a portalled `Tooltip`, so the scrolling input cannot clip it.
30
+ * The preview is a hover `Popover` (portalled, so the scrolling input cannot clip
31
+ * it), and it opens on FOCUS too, so a keyboard user reaches the same preview. It
32
+ * was a `Tooltip` until 5.51.0; a tooltip is for a short label, not an image.
31
33
  */
32
34
  declare function InlinePill({ preview, previewChars, renderPastePreview, classNames, disabled, onExpand, }: InlinePillProps): react.JSX.Element;
33
35
 
@@ -27,7 +27,9 @@ interface InlinePillProps {
27
27
  * One pill inside the message, portalled by `Composer` into a placeholder the
28
28
  * editor made. Internal — its own file so its props are not read as `Composer`'s.
29
29
  *
30
- * The hover preview is a portalled `Tooltip`, so the scrolling input cannot clip it.
30
+ * The preview is a hover `Popover` (portalled, so the scrolling input cannot clip
31
+ * it), and it opens on FOCUS too, so a keyboard user reaches the same preview. It
32
+ * was a `Tooltip` until 5.51.0; a tooltip is for a short label, not an image.
31
33
  */
32
34
  declare function InlinePill({ preview, previewChars, renderPastePreview, classNames, disabled, onExpand, }: InlinePillProps): react.JSX.Element;
33
35
 
@@ -1,7 +1,9 @@
1
- export { HOST_ATTR, InlinePasteEditor, InlinePill, PILL_MARK, PastedFilesInput, endsOf, expandMarkers, markedIds, pasteMarker, segmentValue, useInlinePaste, usePastePills, withSeparators } from './chunk-KYZNCVRD.js';
2
- import './chunk-CF5KRDN4.js';
1
+ export { HOST_ATTR, InlinePasteEditor, InlinePill, PILL_MARK, PastedFilesInput, endsOf, expandMarkers, markedIds, pasteMarker, segmentValue, useInlinePaste, usePastePills, withSeparators } from './chunk-FYKOLKQZ.js';
2
+ import './chunk-6KXAFP2T.js';
3
3
  import './chunk-MQ6VGG62.js';
4
4
  import './chunk-WHEXTDPV.js';
5
+ import './chunk-RGANGU7X.js';
6
+ import './chunk-JXE5XID6.js';
5
7
  import './chunk-EDYAXGUM.js';
6
8
  import './chunk-MMW2JGKZ.js';
7
9
  //# sourceMappingURL=paste-pills.js.map
@@ -1,9 +1,10 @@
1
1
  'use strict';
2
2
 
3
- var chunkIPBEVSSC_cjs = require('./chunk-IPBEVSSC.cjs');
4
- require('./chunk-AIA5UNQ5.cjs');
5
- require('./chunk-MSRYJETY.cjs');
3
+ var chunkMH4QS7OE_cjs = require('./chunk-MH4QS7OE.cjs');
6
4
  require('./chunk-X7H75WVP.cjs');
5
+ require('./chunk-AIA5UNQ5.cjs');
6
+ require('./chunk-R3UG6PVX.cjs');
7
+ require('./chunk-WKNVZUWZ.cjs');
7
8
  require('./chunk-M5MUGSON.cjs');
8
9
  require('./chunk-FWA4PCW7.cjs');
9
10
  require('./chunk-X2FC7ODX.cjs');
@@ -11,6 +12,8 @@ require('./chunk-XCZZVRBY.cjs');
11
12
  require('./chunk-QKFOJKVE.cjs');
12
13
  require('./chunk-J2DI6RMR.cjs');
13
14
  require('./chunk-NBZC6LOB.cjs');
15
+ require('./chunk-57FQGQJK.cjs');
16
+ require('./chunk-RXDRYWVD.cjs');
14
17
  require('./chunk-SNHU2AI4.cjs');
15
18
  require('./chunk-ZU5Q77OT.cjs');
16
19
 
@@ -18,7 +21,7 @@ require('./chunk-ZU5Q77OT.cjs');
18
21
 
19
22
  Object.defineProperty(exports, "PromptInput", {
20
23
  enumerable: true,
21
- get: function () { return chunkIPBEVSSC_cjs.PromptInput; }
24
+ get: function () { return chunkMH4QS7OE_cjs.PromptInput; }
22
25
  });
23
26
  //# sourceMappingURL=prompt-input.cjs.map
24
27
  //# sourceMappingURL=prompt-input.cjs.map
@@ -1,7 +1,8 @@
1
- export { PromptInput } from './chunk-XBC3M4BL.js';
2
- import './chunk-TJ66S5K6.js';
3
- import './chunk-KYZNCVRD.js';
1
+ export { PromptInput } from './chunk-MGE5KOVA.js';
4
2
  import './chunk-CF5KRDN4.js';
3
+ import './chunk-TJ66S5K6.js';
4
+ import './chunk-FYKOLKQZ.js';
5
+ import './chunk-6KXAFP2T.js';
5
6
  import './chunk-LQ4ICCN2.js';
6
7
  import './chunk-KODD54GT.js';
7
8
  import './chunk-6TBRBN7H.js';
@@ -9,6 +10,8 @@ import './chunk-45BBNJQD.js';
9
10
  import './chunk-IVRYSSM7.js';
10
11
  import './chunk-MQ6VGG62.js';
11
12
  import './chunk-WHEXTDPV.js';
13
+ import './chunk-RGANGU7X.js';
14
+ import './chunk-JXE5XID6.js';
12
15
  import './chunk-EDYAXGUM.js';
13
16
  import './chunk-MMW2JGKZ.js';
14
17
  //# sourceMappingURL=prompt-input.js.map
package/dist/sidebar.cjs CHANGED
@@ -4,7 +4,7 @@ var chunk6IBBAOQC_cjs = require('./chunk-6IBBAOQC.cjs');
4
4
  require('./chunk-HPNIEYSJ.cjs');
5
5
  require('./chunk-T6YELZPJ.cjs');
6
6
  require('./chunk-TXTRTTG7.cjs');
7
- require('./chunk-3WGRVDQR.cjs');
7
+ require('./chunk-FQZE5N2N.cjs');
8
8
  require('./chunk-J2DI6RMR.cjs');
9
9
  require('./chunk-57FQGQJK.cjs');
10
10
  require('./chunk-RXDRYWVD.cjs');