@fluentui-copilot/react-chat-input-plugins 0.3.3 → 0.4.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 (71) hide show
  1. package/CHANGELOG.json +31 -1
  2. package/CHANGELOG.md +19 -1
  3. package/lib/BasicFunctionality.js +1 -1
  4. package/lib/BasicFunctionality.js.map +1 -1
  5. package/lib/ChatInputEntity.js +2 -2
  6. package/lib/ChatInputEntity.js.map +1 -1
  7. package/lib/ChatInputToken.js +1 -1
  8. package/lib/ChatInputToken.js.map +1 -1
  9. package/lib/GhostText.js +3 -3
  10. package/lib/GhostText.js.map +1 -1
  11. package/lib/ImperativeControl.js +1 -1
  12. package/lib/ImperativeControl.js.map +1 -1
  13. package/lib/PasteUnfurling.js +1 -1
  14. package/lib/PasteUnfurling.js.map +1 -1
  15. package/lib/components/ChatInputEntity/index.js +4 -5
  16. package/lib/components/ChatInputEntity/index.js.map +1 -1
  17. package/lib/components/ChatInputToken/index.js +5 -6
  18. package/lib/components/ChatInputToken/index.js.map +1 -1
  19. package/lib/components/GhostText/index.js +4 -5
  20. package/lib/components/GhostText/index.js.map +1 -1
  21. package/lib/plugins/BasicFunctionality/BasicFunctionality.js +20 -31
  22. package/lib/plugins/BasicFunctionality/BasicFunctionality.js.map +1 -1
  23. package/lib/plugins/BasicFunctionality/index.js +1 -1
  24. package/lib/plugins/BasicFunctionality/index.js.map +1 -1
  25. package/lib/plugins/ChatInputEntity/index.js +2 -3
  26. package/lib/plugins/ChatInputEntity/index.js.map +1 -1
  27. package/lib/plugins/GhostText/GhostText.js +14 -16
  28. package/lib/plugins/GhostText/GhostText.js.map +1 -1
  29. package/lib/plugins/GhostText/index.js +2 -2
  30. package/lib/plugins/GhostText/index.js.map +1 -1
  31. package/lib/plugins/ImperativeControl/index.js +1 -1
  32. package/lib/plugins/ImperativeControl/index.js.map +1 -1
  33. package/lib/plugins/ManualGhostText/index.js +1 -1
  34. package/lib/plugins/ManualGhostText/index.js.map +1 -1
  35. package/lib/plugins/PasteUnfurling/index.js +1 -1
  36. package/lib/plugins/PasteUnfurling/index.js.map +1 -1
  37. package/lib-commonjs/BasicFunctionality.js +7 -2
  38. package/lib-commonjs/BasicFunctionality.js.map +1 -1
  39. package/lib-commonjs/ChatInputEntity.js +37 -3
  40. package/lib-commonjs/ChatInputEntity.js.map +1 -1
  41. package/lib-commonjs/ChatInputToken.js +33 -2
  42. package/lib-commonjs/ChatInputToken.js.map +1 -1
  43. package/lib-commonjs/GhostText.js +41 -4
  44. package/lib-commonjs/GhostText.js.map +1 -1
  45. package/lib-commonjs/ImperativeControl.js +7 -2
  46. package/lib-commonjs/ImperativeControl.js.map +1 -1
  47. package/lib-commonjs/PasteUnfurling.js +7 -2
  48. package/lib-commonjs/PasteUnfurling.js.map +1 -1
  49. package/lib-commonjs/components/ChatInputEntity/index.js +27 -6
  50. package/lib-commonjs/components/ChatInputEntity/index.js.map +1 -1
  51. package/lib-commonjs/components/ChatInputToken/index.js +37 -7
  52. package/lib-commonjs/components/ChatInputToken/index.js.map +1 -1
  53. package/lib-commonjs/components/GhostText/index.js +27 -6
  54. package/lib-commonjs/components/GhostText/index.js.map +1 -1
  55. package/lib-commonjs/plugins/BasicFunctionality/BasicFunctionality.js +22 -28
  56. package/lib-commonjs/plugins/BasicFunctionality/BasicFunctionality.js.map +1 -1
  57. package/lib-commonjs/plugins/BasicFunctionality/index.js +7 -2
  58. package/lib-commonjs/plugins/BasicFunctionality/index.js.map +1 -1
  59. package/lib-commonjs/plugins/ChatInputEntity/index.js +22 -4
  60. package/lib-commonjs/plugins/ChatInputEntity/index.js.map +1 -1
  61. package/lib-commonjs/plugins/GhostText/GhostText.js +17 -15
  62. package/lib-commonjs/plugins/GhostText/GhostText.js.map +1 -1
  63. package/lib-commonjs/plugins/GhostText/index.js +22 -3
  64. package/lib-commonjs/plugins/GhostText/index.js.map +1 -1
  65. package/lib-commonjs/plugins/ImperativeControl/index.js +7 -2
  66. package/lib-commonjs/plugins/ImperativeControl/index.js.map +1 -1
  67. package/lib-commonjs/plugins/ManualGhostText/index.js +7 -2
  68. package/lib-commonjs/plugins/ManualGhostText/index.js.map +1 -1
  69. package/lib-commonjs/plugins/PasteUnfurling/index.js +7 -2
  70. package/lib-commonjs/plugins/PasteUnfurling/index.js.map +1 -1
  71. package/package.json +4 -4
@@ -2,8 +2,45 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
- const _export_star = require("@swc/helpers/_/_export_star");
6
- _export_star._(require("./components/GhostText/index"), exports);
7
- _export_star._(require("./plugins/GhostText/index"), exports);
8
- _export_star._(require("./plugins/ManualGhostText/index"), exports);
5
+ function _export(target, all) {
6
+ for(var name in all)Object.defineProperty(target, name, {
7
+ enumerable: true,
8
+ get: all[name]
9
+ });
10
+ }
11
+ _export(exports, {
12
+ $createGhostTextNode: function() {
13
+ return _index1.$createGhostTextNode;
14
+ },
15
+ $isGhostTextNode: function() {
16
+ return _index1.$isGhostTextNode;
17
+ },
18
+ GhostText: function() {
19
+ return _index.GhostText;
20
+ },
21
+ GhostTextNode: function() {
22
+ return _index1.GhostTextNode;
23
+ },
24
+ GhostTextPlugin: function() {
25
+ return _index1.GhostTextPlugin;
26
+ },
27
+ ManualGhostTextPlugin: function() {
28
+ return _index2.ManualGhostTextPlugin;
29
+ },
30
+ ghostTextClassNames: function() {
31
+ return _index.ghostTextClassNames;
32
+ },
33
+ renderGhostText_unstable: function() {
34
+ return _index.renderGhostText_unstable;
35
+ },
36
+ useGhostTextStyles_unstable: function() {
37
+ return _index.useGhostTextStyles_unstable;
38
+ },
39
+ useGhostText_unstable: function() {
40
+ return _index.useGhostText_unstable;
41
+ }
42
+ });
43
+ const _index = require("./components/GhostText/index");
44
+ const _index1 = require("./plugins/GhostText/index");
45
+ const _index2 = require("./plugins/ManualGhostText/index");
9
46
  //# sourceMappingURL=GhostText.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["GhostText.ts"],"sourcesContent":["export * from './components/GhostText/index';\nexport * from './plugins/GhostText/index';\nexport * from './plugins/ManualGhostText/index';\n"],"names":[],"rangeMappings":";;;;;;;","mappings":";;;;;uBAAc;uBACA;uBACA"}
1
+ {"version":3,"sources":["GhostText.ts"],"sourcesContent":["export type { GhostTextProps, GhostTextSlots, GhostTextState } from './components/GhostText/index';\nexport { GhostText, ghostTextClassNames, renderGhostText_unstable, useGhostTextStyles_unstable, useGhostText_unstable } from './components/GhostText/index';\nexport type { GhostTextPluginProps, SerializedGhostTextNode } from './plugins/GhostText/index';\nexport { $createGhostTextNode, $isGhostTextNode, GhostTextNode, GhostTextPlugin } from './plugins/GhostText/index';\nexport type { ManualGhostTextProps, ManualGhostTextRef } from './plugins/ManualGhostText/index';\nexport { ManualGhostTextPlugin } from './plugins/ManualGhostText/index';\n"],"names":["$createGhostTextNode","$isGhostTextNode","GhostText","GhostTextNode","GhostTextPlugin","ManualGhostTextPlugin","ghostTextClassNames","renderGhostText_unstable","useGhostTextStyles_unstable","useGhostText_unstable"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAGSA,oBAAoB;eAApBA,4BAAoB;;IAAEC,gBAAgB;eAAhBA,wBAAgB;;IAFtCC,SAAS;eAATA,gBAAS;;IAE+BC,aAAa;eAAbA,qBAAa;;IAAEC,eAAe;eAAfA,uBAAe;;IAEtEC,qBAAqB;eAArBA,6BAAqB;;IAJVC,mBAAmB;eAAnBA,0BAAmB;;IAAEC,wBAAwB;eAAxBA,+BAAwB;;IAAEC,2BAA2B;eAA3BA,kCAA2B;;IAAEC,qBAAqB;eAArBA,4BAAqB;;;uBAAQ;wBAEtC;wBAEjD"}
@@ -2,6 +2,11 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
- const _export_star = require("@swc/helpers/_/_export_star");
6
- _export_star._(require("./plugins/ImperativeControl/index"), exports);
5
+ Object.defineProperty(exports, "ImperativeControlPlugin", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return _index.ImperativeControlPlugin;
9
+ }
10
+ });
11
+ const _index = require("./plugins/ImperativeControl/index");
7
12
  //# sourceMappingURL=ImperativeControl.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["ImperativeControl.ts"],"sourcesContent":["export * from './plugins/ImperativeControl/index';\n"],"names":[],"rangeMappings":";;;;;","mappings":";;;;;uBAAc"}
1
+ {"version":3,"sources":["ImperativeControl.ts"],"sourcesContent":["export type { ImperativeControlPluginProps, ImperativeControlPluginRef } from './plugins/ImperativeControl/index';\nexport { ImperativeControlPlugin } from './plugins/ImperativeControl/index';\n"],"names":["ImperativeControlPlugin"],"rangeMappings":";;;;;;;;;;","mappings":";;;;+BACSA;;;eAAAA,8BAAuB;;;uBAAQ"}
@@ -2,6 +2,11 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
- const _export_star = require("@swc/helpers/_/_export_star");
6
- _export_star._(require("./plugins/PasteUnfurling/index"), exports);
5
+ Object.defineProperty(exports, "PasteUnfurlingPlugin", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return _index.PasteUnfurlingPlugin;
9
+ }
10
+ });
11
+ const _index = require("./plugins/PasteUnfurling/index");
7
12
  //# sourceMappingURL=PasteUnfurling.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["PasteUnfurling.ts"],"sourcesContent":["export * from './plugins/PasteUnfurling/index';\n"],"names":[],"rangeMappings":";;;;;","mappings":";;;;;uBAAc"}
1
+ {"version":3,"sources":["PasteUnfurling.ts"],"sourcesContent":["export type { PasteUnfurlingPluginProps } from './plugins/PasteUnfurling/index';\nexport { PasteUnfurlingPlugin } from './plugins/PasteUnfurling/index';\n"],"names":["PasteUnfurlingPlugin"],"rangeMappings":";;;;;;;;;;","mappings":";;;;+BACSA;;;eAAAA,2BAAoB;;;uBAAQ"}
@@ -2,10 +2,31 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
- const _export_star = require("@swc/helpers/_/_export_star");
6
- _export_star._(require("./ChatInputEntity"), exports);
7
- _export_star._(require("./ChatInputEntity.types"), exports);
8
- _export_star._(require("./renderChatInputEntity"), exports);
9
- _export_star._(require("./useChatInputEntity"), exports);
10
- _export_star._(require("./useChatInputEntityStyles.styles"), exports);
5
+ function _export(target, all) {
6
+ for(var name in all)Object.defineProperty(target, name, {
7
+ enumerable: true,
8
+ get: all[name]
9
+ });
10
+ }
11
+ _export(exports, {
12
+ ChatInputEntity: function() {
13
+ return _ChatInputEntity.ChatInputEntity;
14
+ },
15
+ chatInputEntityClassNames: function() {
16
+ return _useChatInputEntityStylesstyles.chatInputEntityClassNames;
17
+ },
18
+ renderChatInputEntity_unstable: function() {
19
+ return _renderChatInputEntity.renderChatInputEntity_unstable;
20
+ },
21
+ useChatInputEntityStyles_unstable: function() {
22
+ return _useChatInputEntityStylesstyles.useChatInputEntityStyles_unstable;
23
+ },
24
+ useChatInputEntity_unstable: function() {
25
+ return _useChatInputEntity.useChatInputEntity_unstable;
26
+ }
27
+ });
28
+ const _ChatInputEntity = require("./ChatInputEntity");
29
+ const _renderChatInputEntity = require("./renderChatInputEntity");
30
+ const _useChatInputEntity = require("./useChatInputEntity");
31
+ const _useChatInputEntityStylesstyles = require("./useChatInputEntityStyles.styles");
11
32
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["index.ts"],"sourcesContent":["export * from './ChatInputEntity';\nexport * from './ChatInputEntity.types';\nexport * from './renderChatInputEntity';\nexport * from './useChatInputEntity';\nexport * from './useChatInputEntityStyles.styles';\n"],"names":[],"rangeMappings":";;;;;;;;;","mappings":";;;;;uBAAc;uBACA;uBACA;uBACA;uBACA"}
1
+ {"version":3,"sources":["index.ts"],"sourcesContent":["export { ChatInputEntity } from './ChatInputEntity';\nexport type { ChatInputEntityProps, ChatInputEntitySlots, ChatInputEntityState } from './ChatInputEntity.types';\nexport { renderChatInputEntity_unstable } from './renderChatInputEntity';\nexport { useChatInputEntity_unstable } from './useChatInputEntity';\nexport { chatInputEntityClassNames, useChatInputEntityStyles_unstable } from './useChatInputEntityStyles.styles';\n"],"names":["ChatInputEntity","chatInputEntityClassNames","renderChatInputEntity_unstable","useChatInputEntityStyles_unstable","useChatInputEntity_unstable"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAASA,eAAe;eAAfA,gCAAe;;IAIfC,yBAAyB;eAAzBA,yDAAyB;;IAFzBC,8BAA8B;eAA9BA,qDAA8B;;IAEHC,iCAAiC;eAAjCA,iEAAiC;;IAD5DC,2BAA2B;eAA3BA,+CAA2B;;;iCAHJ;uCAEe;oCACH;gDACiC"}
@@ -2,11 +2,41 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
- const _export_star = require("@swc/helpers/_/_export_star");
6
- _export_star._(require("./ChatInputToken"), exports);
7
- _export_star._(require("./ChatInputToken.types"), exports);
8
- _export_star._(require("./renderChatInputToken"), exports);
9
- _export_star._(require("./useChatInputToken"), exports);
10
- _export_star._(require("./useChatInputTokenStyles.styles"), exports);
11
- _export_star._(require("./ChatInputToken.node"), exports);
5
+ function _export(target, all) {
6
+ for(var name in all)Object.defineProperty(target, name, {
7
+ enumerable: true,
8
+ get: all[name]
9
+ });
10
+ }
11
+ _export(exports, {
12
+ $createChatInputTokenNode: function() {
13
+ return _ChatInputTokennode.$createChatInputTokenNode;
14
+ },
15
+ $isChatInputTokenNode: function() {
16
+ return _ChatInputTokennode.$isChatInputTokenNode;
17
+ },
18
+ ChatInputToken: function() {
19
+ return _ChatInputToken.ChatInputToken;
20
+ },
21
+ ChatInputTokenNode: function() {
22
+ return _ChatInputTokennode.ChatInputTokenNode;
23
+ },
24
+ chatInputTokenClassNames: function() {
25
+ return _useChatInputTokenStylesstyles.chatInputTokenClassNames;
26
+ },
27
+ renderChatInputToken_unstable: function() {
28
+ return _renderChatInputToken.renderChatInputToken_unstable;
29
+ },
30
+ useChatInputTokenStyles_unstable: function() {
31
+ return _useChatInputTokenStylesstyles.useChatInputTokenStyles_unstable;
32
+ },
33
+ useChatInputToken_unstable: function() {
34
+ return _useChatInputToken.useChatInputToken_unstable;
35
+ }
36
+ });
37
+ const _ChatInputToken = require("./ChatInputToken");
38
+ const _renderChatInputToken = require("./renderChatInputToken");
39
+ const _useChatInputToken = require("./useChatInputToken");
40
+ const _useChatInputTokenStylesstyles = require("./useChatInputTokenStyles.styles");
41
+ const _ChatInputTokennode = require("./ChatInputToken.node");
12
42
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["index.ts"],"sourcesContent":["export * from './ChatInputToken';\nexport * from './ChatInputToken.types';\nexport * from './renderChatInputToken';\nexport * from './useChatInputToken';\nexport * from './useChatInputTokenStyles.styles';\nexport * from './ChatInputToken.node';\n"],"names":[],"rangeMappings":";;;;;;;;;;","mappings":";;;;;uBAAc;uBACA;uBACA;uBACA;uBACA;uBACA"}
1
+ {"version":3,"sources":["index.ts"],"sourcesContent":["export { ChatInputToken } from './ChatInputToken';\nexport type { ChatInputTokenProps, ChatInputTokenSlots, ChatInputTokenState } from './ChatInputToken.types';\nexport { renderChatInputToken_unstable } from './renderChatInputToken';\nexport { useChatInputToken_unstable } from './useChatInputToken';\nexport { chatInputTokenClassNames, useChatInputTokenStyles_unstable } from './useChatInputTokenStyles.styles';\nexport type { SerializedChatInputTokenNode } from './ChatInputToken.node';\nexport { $createChatInputTokenNode, $isChatInputTokenNode, ChatInputTokenNode } from './ChatInputToken.node';\n"],"names":["$createChatInputTokenNode","$isChatInputTokenNode","ChatInputToken","ChatInputTokenNode","chatInputTokenClassNames","renderChatInputToken_unstable","useChatInputTokenStyles_unstable","useChatInputToken_unstable"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAMSA,yBAAyB;eAAzBA,6CAAyB;;IAAEC,qBAAqB;eAArBA,yCAAqB;;IANhDC,cAAc;eAAdA,8BAAc;;IAMoCC,kBAAkB;eAAlBA,sCAAkB;;IAFpEC,wBAAwB;eAAxBA,uDAAwB;;IAFxBC,6BAA6B;eAA7BA,mDAA6B;;IAEHC,gCAAgC;eAAhCA,+DAAgC;;IAD1DC,0BAA0B;eAA1BA,6CAA0B;;;gCAHJ;sCAEe;mCACH;+CACgC;oCAEU"}
@@ -2,10 +2,31 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
- const _export_star = require("@swc/helpers/_/_export_star");
6
- _export_star._(require("./GhostText"), exports);
7
- _export_star._(require("./GhostText.types"), exports);
8
- _export_star._(require("./renderGhostText"), exports);
9
- _export_star._(require("./useGhostText"), exports);
10
- _export_star._(require("./useGhostTextStyles.styles"), exports);
5
+ function _export(target, all) {
6
+ for(var name in all)Object.defineProperty(target, name, {
7
+ enumerable: true,
8
+ get: all[name]
9
+ });
10
+ }
11
+ _export(exports, {
12
+ GhostText: function() {
13
+ return _GhostText.GhostText;
14
+ },
15
+ ghostTextClassNames: function() {
16
+ return _useGhostTextStylesstyles.ghostTextClassNames;
17
+ },
18
+ renderGhostText_unstable: function() {
19
+ return _renderGhostText.renderGhostText_unstable;
20
+ },
21
+ useGhostTextStyles_unstable: function() {
22
+ return _useGhostTextStylesstyles.useGhostTextStyles_unstable;
23
+ },
24
+ useGhostText_unstable: function() {
25
+ return _useGhostText.useGhostText_unstable;
26
+ }
27
+ });
28
+ const _GhostText = require("./GhostText");
29
+ const _renderGhostText = require("./renderGhostText");
30
+ const _useGhostText = require("./useGhostText");
31
+ const _useGhostTextStylesstyles = require("./useGhostTextStyles.styles");
11
32
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["index.ts"],"sourcesContent":["export * from './GhostText';\nexport * from './GhostText.types';\nexport * from './renderGhostText';\nexport * from './useGhostText';\nexport * from './useGhostTextStyles.styles';\n"],"names":[],"rangeMappings":";;;;;;;;;","mappings":";;;;;uBAAc;uBACA;uBACA;uBACA;uBACA"}
1
+ {"version":3,"sources":["index.ts"],"sourcesContent":["export { GhostText } from './GhostText';\nexport type { GhostTextProps, GhostTextSlots, GhostTextState } from './GhostText.types';\nexport { renderGhostText_unstable } from './renderGhostText';\nexport { useGhostText_unstable } from './useGhostText';\nexport { ghostTextClassNames, useGhostTextStyles_unstable } from './useGhostTextStyles.styles';\n"],"names":["GhostText","ghostTextClassNames","renderGhostText_unstable","useGhostTextStyles_unstable","useGhostText_unstable"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAASA,SAAS;eAATA,oBAAS;;IAITC,mBAAmB;eAAnBA,6CAAmB;;IAFnBC,wBAAwB;eAAxBA,yCAAwB;;IAEHC,2BAA2B;eAA3BA,qDAA2B;;IADhDC,qBAAqB;eAArBA,mCAAqB;;;2BAHJ;iCAEe;8BACH;0CAC2B"}
@@ -16,66 +16,60 @@ const _chatinputplugins = require("@fluentui-copilot/chat-input-plugins");
16
16
  const BasicFunctionalityPlugin = /*#__PURE__*/ _react.forwardRef((props, ref)=>{
17
17
  const { defaultValue, trimWhitespace, onCountChanged, onContentChange, onPaste } = props;
18
18
  const [editor] = (0, _reacttexteditor.useLexicalComposerContext)();
19
- const basicFunctionalityImpl = _react.useRef(null);
19
+ const [basicFunctionalityImpl, setBasicFunctionalityImpl] = _react.useState(null);
20
20
  (0, _reactcomponents.useIsomorphicLayoutEffect)(()=>{
21
- basicFunctionalityImpl.current = new _chatinputplugins.BasicFunctionalityBase(editor);
21
+ setBasicFunctionalityImpl(new _chatinputplugins.BasicFunctionalityBase(editor));
22
22
  return ()=>{
23
- var _basicFunctionalityImpl_current;
24
- return (_basicFunctionalityImpl_current = basicFunctionalityImpl.current) === null || _basicFunctionalityImpl_current === void 0 ? void 0 : _basicFunctionalityImpl_current.cleanup();
23
+ setBasicFunctionalityImpl((prev)=>{
24
+ prev === null || prev === void 0 ? void 0 : prev.cleanup();
25
+ return null;
26
+ });
25
27
  };
26
28
  }, [
27
29
  editor
28
30
  ]);
29
31
  _react.useImperativeHandle(ref, ()=>({
30
32
  setIsDisabled (isDisabled) {
31
- var _basicFunctionalityImpl_current;
32
- (_basicFunctionalityImpl_current = basicFunctionalityImpl.current) === null || _basicFunctionalityImpl_current === void 0 ? void 0 : _basicFunctionalityImpl_current.setIsDisabled(isDisabled);
33
+ basicFunctionalityImpl === null || basicFunctionalityImpl === void 0 ? void 0 : basicFunctionalityImpl.setIsDisabled(isDisabled);
33
34
  }
34
- }));
35
- // useIsomporphicLayoutEffect is used to avoid flickering on first render
35
+ }), [
36
+ basicFunctionalityImpl
37
+ ]);
38
+ // useIsomorphicLayoutEffect is used to avoid flickering on first render
36
39
  (0, _reactcomponents.useIsomorphicLayoutEffect)(()=>{
37
40
  if (defaultValue) {
38
- var _basicFunctionalityImpl_current;
39
- (_basicFunctionalityImpl_current = basicFunctionalityImpl.current) === null || _basicFunctionalityImpl_current === void 0 ? void 0 : _basicFunctionalityImpl_current.insertDefaultValue(defaultValue);
41
+ basicFunctionalityImpl === null || basicFunctionalityImpl === void 0 ? void 0 : basicFunctionalityImpl.insertDefaultValue(defaultValue);
40
42
  }
43
+ // We only want to insert the defaultValue if the `editor` object is recreated, not the `basicFunctionalityImpl`
41
44
  }, [
42
45
  editor
43
46
  ]);
44
47
  _react.useEffect(()=>{
45
- var _basicFunctionalityImpl_current;
46
- (_basicFunctionalityImpl_current = basicFunctionalityImpl.current) === null || _basicFunctionalityImpl_current === void 0 ? void 0 : _basicFunctionalityImpl_current.activateContentCallbacks(onContentChange, onCountChanged);
47
- return ()=>{
48
- var _basicFunctionalityImpl_current;
49
- return (_basicFunctionalityImpl_current = basicFunctionalityImpl.current) === null || _basicFunctionalityImpl_current === void 0 ? void 0 : _basicFunctionalityImpl_current.deactivateContentCallbacks();
50
- };
48
+ basicFunctionalityImpl === null || basicFunctionalityImpl === void 0 ? void 0 : basicFunctionalityImpl.activateContentCallbacks(onContentChange, onCountChanged);
49
+ return ()=>basicFunctionalityImpl === null || basicFunctionalityImpl === void 0 ? void 0 : basicFunctionalityImpl.deactivateContentCallbacks();
51
50
  }, [
51
+ basicFunctionalityImpl,
52
52
  editor,
53
53
  onContentChange,
54
54
  onCountChanged
55
55
  ]);
56
56
  _react.useEffect(()=>{
57
57
  if (onPaste) {
58
- var _basicFunctionalityImpl_current;
59
- (_basicFunctionalityImpl_current = basicFunctionalityImpl.current) === null || _basicFunctionalityImpl_current === void 0 ? void 0 : _basicFunctionalityImpl_current.activatePasteCallback(onPaste);
58
+ basicFunctionalityImpl === null || basicFunctionalityImpl === void 0 ? void 0 : basicFunctionalityImpl.activatePasteCallback(onPaste);
60
59
  }
61
- return ()=>{
62
- var _basicFunctionalityImpl_current;
63
- return (_basicFunctionalityImpl_current = basicFunctionalityImpl.current) === null || _basicFunctionalityImpl_current === void 0 ? void 0 : _basicFunctionalityImpl_current.deactivatePasteCallback();
64
- };
60
+ return ()=>basicFunctionalityImpl === null || basicFunctionalityImpl === void 0 ? void 0 : basicFunctionalityImpl.deactivatePasteCallback();
65
61
  }, [
62
+ basicFunctionalityImpl,
66
63
  editor,
67
64
  onPaste
68
65
  ]);
69
66
  _react.useEffect(()=>{
70
67
  if (trimWhitespace) {
71
- var _basicFunctionalityImpl_current;
72
- (_basicFunctionalityImpl_current = basicFunctionalityImpl.current) === null || _basicFunctionalityImpl_current === void 0 ? void 0 : _basicFunctionalityImpl_current.activateTrimWhitespace();
68
+ basicFunctionalityImpl === null || basicFunctionalityImpl === void 0 ? void 0 : basicFunctionalityImpl.activateTrimWhitespace();
73
69
  }
74
- return ()=>{
75
- var _basicFunctionalityImpl_current;
76
- return (_basicFunctionalityImpl_current = basicFunctionalityImpl.current) === null || _basicFunctionalityImpl_current === void 0 ? void 0 : _basicFunctionalityImpl_current.deactivateTrimWhitespace();
77
- };
70
+ return ()=>basicFunctionalityImpl === null || basicFunctionalityImpl === void 0 ? void 0 : basicFunctionalityImpl.deactivateTrimWhitespace();
78
71
  }, [
72
+ basicFunctionalityImpl,
79
73
  editor,
80
74
  trimWhitespace
81
75
  ]);
@@ -1 +1 @@
1
- {"version":3,"sources":["BasicFunctionality.ts"],"sourcesContent":["import * as React from 'react';\nimport { useLexicalComposerContext } from '@fluentui-copilot/react-text-editor';\nimport { useIsomorphicLayoutEffect } from '@fluentui/react-components';\nimport type { IBasicFunctionalityBase } from '@fluentui-copilot/chat-input-plugins';\nimport { BasicFunctionalityBase } from '@fluentui-copilot/chat-input-plugins';\n\nexport type BasicFunctionalityPluginProps = {\n defaultValue?: string;\n // Whether or not to clear the input when only whitespace is remaining\n trimWhitespace?: boolean;\n onCountChanged?: (count: number) => void;\n onContentChange?: (value: string) => void;\n onPaste?: (event: ClipboardEvent) => void;\n};\n\nexport type BasicFunctionalityPluginRef = {\n setIsDisabled: (isDisabled: boolean) => void;\n};\n\nexport const BasicFunctionalityPlugin = React.forwardRef<BasicFunctionalityPluginRef, BasicFunctionalityPluginProps>(\n (props, ref) => {\n const { defaultValue, trimWhitespace, onCountChanged, onContentChange, onPaste } = props;\n\n const [editor] = useLexicalComposerContext();\n\n const basicFunctionalityImpl = React.useRef<IBasicFunctionalityBase | null>(null);\n\n useIsomorphicLayoutEffect(() => {\n basicFunctionalityImpl.current = new BasicFunctionalityBase(editor);\n\n return () => basicFunctionalityImpl.current?.cleanup();\n }, [editor]);\n\n React.useImperativeHandle<BasicFunctionalityPluginRef, BasicFunctionalityPluginRef>(ref, () => ({\n setIsDisabled(isDisabled: boolean) {\n basicFunctionalityImpl.current?.setIsDisabled(isDisabled);\n },\n }));\n\n // useIsomporphicLayoutEffect is used to avoid flickering on first render\n useIsomorphicLayoutEffect(() => {\n if (defaultValue) {\n basicFunctionalityImpl.current?.insertDefaultValue(defaultValue);\n }\n }, [editor]);\n\n React.useEffect(() => {\n basicFunctionalityImpl.current?.activateContentCallbacks(onContentChange, onCountChanged);\n return () => basicFunctionalityImpl.current?.deactivateContentCallbacks();\n }, [editor, onContentChange, onCountChanged]);\n\n React.useEffect(() => {\n if (onPaste) {\n basicFunctionalityImpl.current?.activatePasteCallback(onPaste);\n }\n return () => basicFunctionalityImpl.current?.deactivatePasteCallback();\n }, [editor, onPaste]);\n\n React.useEffect(() => {\n if (trimWhitespace) {\n basicFunctionalityImpl.current?.activateTrimWhitespace();\n }\n return () => basicFunctionalityImpl.current?.deactivateTrimWhitespace();\n }, [editor, trimWhitespace]);\n\n return null;\n },\n);\n"],"names":["BasicFunctionalityPlugin","React","forwardRef","props","ref","defaultValue","editor","trimWhitespace","basicFunctionalityImpl","useIsomorphicLayoutEffect","useImperativeHandle","setIsDisabled","current","_basicFunctionalityImpl_current","cleanup","isDisabled","insertDefaultValue","deactivateContentCallbacks","onContentChange","onCountChanged","onPaste","useEffect","activatePasteCallback","deactivatePasteCallback"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAmBaA;;;eAAAA;;;;iEAnBU;iCACmB;iCACA;kCAEH;AAehC,MAAMA,yCAA2BC,OAAMC,UAAU,CACtD,CAACC,OAAOC;UACN,EAEAC,YAAOC,EAEPC,cAAMC,EAENC,cAAAA,iBACED,SAEA;mEAAaA;;kDACZ,EAAA;+BAACF,OAAAA,GAAAA,IAAAA,wCAAAA,CAAAA;eAAO;YAEXL,IAAMS;mBACJC,CAAAA,kCAAiCH,uBAAAI,OAAA,MAAA,QAAAC,oCAAA,KAAA,IAAA,KAAA,IAAAA,gCAAAC,OAAA;;;;;8BAEjC,CAAAV,KAAA,IAAA,CAAA;2BACFW,UAAA;gBAEA,IAAAF;gBACAJ,CAAAA,kCAA0BD,uBAAAI,OAAA,MAAA,QAAAC,oCAAA,KAAA,IAAA,KAAA,IAAAA,gCAAAF,aAAA,CAAAI;;;6EAECH;kDACzB,EAAA;QACF,IAAGP,cAAA;gBAACC;YAAOO,CAAAA,kCAAAL,uBAAAI,OAAA,MAAA,QAAAC,oCAAA,KAAA,IAAA,KAAA,IAAAA,gCAAAG,kBAAA,CAAAX;QAEXJ;;;KACEO;oBAAAA,CAAAA;YACAK;2CAAaL,uBAAAA,OAAAA,MAAAA,QAAAA,oCAAAA,KAAAA,IAAAA,KAAAA,IAAAA,gCAAAA,wBAAAA,CAAAA,iBAAAA;;;YACf,OAAG,AAAAK,CAAAA,kCAAAL,uBAAAI,OAAA,MAAA,QAAAC,oCAAA,KAAA,IAAA,KAAA,IAAAA,gCAAAI,0BAAA;;;;QAASC;QAAAA;KAAAA;WAAiBC,SAAAA,CAAAA;YAAeC,SAAA;YAE5CnB,IAAMoB;+CACSb,uBAAAI,OAAA,MAAA,QAAAC,oCAAA,KAAA,IAAA,KAAA,IAAAA,gCAAAS,qBAAA,CAAAF;;;gBAEbP;mBACA,AAAAA,CAAAA,kCAAOL,uBAAAI,OAAA,MAAA,QAAAC,oCAAA,KAAA,IAAA,KAAA,IAAAA,gCAAAU,uBAAA;;;;;KAAMf;;QACf,IAAGD,gBAAA;gBAACD;+CAAQc,uBAAAA,OAAAA,MAAAA,QAAAA,oCAAAA,KAAAA,IAAAA,KAAAA,IAAAA,gCAAAA,sBAAAA;;QAEZnB,OAAMoB;gBACJR;sDACEL,uBAAAA,OAAAA,MAAAA,QAAAA,oCAAAA,KAAAA,IAAAA,KAAAA,IAAAA,gCAAAA,wBAAAA;;;;QACFD;KAAA;WACA;kDAAaC"}
1
+ {"version":3,"sources":["BasicFunctionality.ts"],"sourcesContent":["import * as React from 'react';\nimport { useLexicalComposerContext } from '@fluentui-copilot/react-text-editor';\nimport { useIsomorphicLayoutEffect } from '@fluentui/react-components';\nimport type { IBasicFunctionalityBase } from '@fluentui-copilot/chat-input-plugins';\nimport { BasicFunctionalityBase } from '@fluentui-copilot/chat-input-plugins';\n\nexport type BasicFunctionalityPluginProps = {\n defaultValue?: string;\n // Whether or not to clear the input when only whitespace is remaining\n trimWhitespace?: boolean;\n onCountChanged?: (count: number) => void;\n onContentChange?: (value: string) => void;\n onPaste?: (event: ClipboardEvent) => void;\n};\n\nexport type BasicFunctionalityPluginRef = {\n setIsDisabled: (isDisabled: boolean) => void;\n};\n\nexport const BasicFunctionalityPlugin = React.forwardRef<BasicFunctionalityPluginRef, BasicFunctionalityPluginProps>(\n (props, ref) => {\n const { defaultValue, trimWhitespace, onCountChanged, onContentChange, onPaste } = props;\n\n const [editor] = useLexicalComposerContext();\n\n const [basicFunctionalityImpl, setBasicFunctionalityImpl] = React.useState<IBasicFunctionalityBase | null>(null);\n\n useIsomorphicLayoutEffect(() => {\n setBasicFunctionalityImpl(new BasicFunctionalityBase(editor));\n\n return () => {\n setBasicFunctionalityImpl(prev => {\n prev?.cleanup();\n return null;\n });\n };\n }, [editor]);\n\n React.useImperativeHandle<BasicFunctionalityPluginRef, BasicFunctionalityPluginRef>(\n ref,\n () => ({\n setIsDisabled(isDisabled: boolean) {\n basicFunctionalityImpl?.setIsDisabled(isDisabled);\n },\n }),\n [basicFunctionalityImpl],\n );\n\n // useIsomorphicLayoutEffect is used to avoid flickering on first render\n useIsomorphicLayoutEffect(() => {\n if (defaultValue) {\n basicFunctionalityImpl?.insertDefaultValue(defaultValue);\n }\n // We only want to insert the defaultValue if the `editor` object is recreated, not the `basicFunctionalityImpl`\n }, [editor]);\n\n React.useEffect(() => {\n basicFunctionalityImpl?.activateContentCallbacks(onContentChange, onCountChanged);\n return () => basicFunctionalityImpl?.deactivateContentCallbacks();\n }, [basicFunctionalityImpl, editor, onContentChange, onCountChanged]);\n\n React.useEffect(() => {\n if (onPaste) {\n basicFunctionalityImpl?.activatePasteCallback(onPaste);\n }\n return () => basicFunctionalityImpl?.deactivatePasteCallback();\n }, [basicFunctionalityImpl, editor, onPaste]);\n\n React.useEffect(() => {\n if (trimWhitespace) {\n basicFunctionalityImpl?.activateTrimWhitespace();\n }\n return () => basicFunctionalityImpl?.deactivateTrimWhitespace();\n }, [basicFunctionalityImpl, editor, trimWhitespace]);\n\n return null;\n },\n);\n"],"names":["BasicFunctionalityPlugin","React","forwardRef","props","ref","defaultValue","editor","trimWhitespace","basicFunctionalityImpl","useIsomorphicLayoutEffect","setBasicFunctionalityImpl","prev","useState","BasicFunctionalityBase","cleanup","useImperativeHandle","setIsDisabled","isDisabled","insertDefaultValue","useEffect","activateContentCallbacks","onContentChange","deactivateContentCallbacks","onCountChanged","deactivatePasteCallback","onPaste","activateTrimWhitespace","deactivateTrimWhitespace"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAmBaA;;;eAAAA;;;;iEAnBU;iCACmB;iCACA;kCAEH;AAehC,MAAMA,yCAA2BC,OAAMC,UAAU,CACtD,CAACC,OAAOC;UACN,EAEAC,YAAOC,EAEPC,cAAOC,EAEPC,cAAAA,iBACEC,SAEA;kBAEIC,GAAAA,IAAAA,0CAAAA;mCACOD,0BAAA,GAAAT,OAAAW,QAAA,CAAA;kDACT,EAAA;kCACF,IAAAC,wCAAA,CAAAP;QACF,OAAG;sCAACA,CAAAA;gBAAOK,SAAA,QAAAA,SAAA,KAAA,IAAA,KAAA,IAAAA,KAAAG,OAAA;gBAEXb,OAAMc;;;;;KAKF;WACFA,mBACA,CAAAX,KAAA,IAAA,CAAA;2BAACI,UAAAA;gBAAuBA,2BAAA,QAAAA,2BAAA,KAAA,IAAA,KAAA,IAAAA,uBAAAQ,aAAA,CAAAC;YAG1B;YACAR;QAAAA;KAA0B;4EACN;kDAChBD,EAAAA;YACFH,cAAA;YACAG,2BAAA,QAAAA,2BAAA,KAAA,IAAA,KAAA,IAAAA,uBAAAU,kBAAgH,CAAAb;QAClH;oHAAIC;OAAO;QAAAA;KAAA;WAEXL,SAAMkB,CAAAA;mCACJX,QAAAA,2BAAAA,KAAAA,IAAAA,KAAAA,IAAAA,uBAAAA,wBAAwBY,CAAAA,iBAAyBC;eACjD,IAAOb,2BAAMA,QAAAA,2BAAAA,KAAAA,IAAAA,KAAAA,IAAAA,uBAAAA,0BAAwBc;OACvC;QAAAd;QAAGF;QAAAe;QAAAE;KAAA;WAACf,SAAAA,CAAAA;YAAwBF,SAAAA;uCAAQe,QAAAA,2BAAAA,KAAAA,IAAAA,KAAAA,IAAAA,uBAAAA,qBAAAA,CAAAA;;eAAgC,IAAAb,2BAAA,QAAAA,2BAAA,KAAA,IAAA,KAAA,IAAAA,uBAAAgB,uBAAA;OAEpEvB;QAAAA;QAAgBK;QAAAmB;KAAA;WACdN,SAAIM,CAAAA;4BACFjB;uCACF,QAAAA,2BAAA,KAAA,IAAA,KAAA,IAAAA,uBAAAkB,sBAAA;;QAEF,OAAG,IAAAlB,2BAAA,QAAAA,2BAAA,KAAA,IAAA,KAAA,IAAAA,uBAAAmB,wBAAA;;;QAACnB;QAAAA;KAAAA;WAAwBF;kDAAgB"}
@@ -2,6 +2,11 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
- const _export_star = require("@swc/helpers/_/_export_star");
6
- _export_star._(require("./BasicFunctionality"), exports);
5
+ Object.defineProperty(exports, "BasicFunctionalityPlugin", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return _BasicFunctionality.BasicFunctionalityPlugin;
9
+ }
10
+ });
11
+ const _BasicFunctionality = require("./BasicFunctionality");
7
12
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["index.ts"],"sourcesContent":["export * from './BasicFunctionality';\n"],"names":[],"rangeMappings":";;;;;","mappings":";;;;;uBAAc"}
1
+ {"version":3,"sources":["index.ts"],"sourcesContent":["export type { BasicFunctionalityPluginProps, BasicFunctionalityPluginRef } from './BasicFunctionality';\nexport { BasicFunctionalityPlugin } from './BasicFunctionality';\n"],"names":["BasicFunctionalityPlugin"],"rangeMappings":";;;;;;;;;;","mappings":";;;;+BACSA;;;eAAAA,4CAAwB;;;oCAAQ"}
@@ -2,8 +2,26 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
- const _export_star = require("@swc/helpers/_/_export_star");
6
- _export_star._(require("./ChatInputEntity.node"), exports);
7
- _export_star._(require("./ChatInputEntityPlugin"), exports);
8
- _export_star._(require("./ChatInputEntityPlugin.types"), exports);
5
+ function _export(target, all) {
6
+ for(var name in all)Object.defineProperty(target, name, {
7
+ enumerable: true,
8
+ get: all[name]
9
+ });
10
+ }
11
+ _export(exports, {
12
+ $createChatInputEntityNode: function() {
13
+ return _ChatInputEntitynode.$createChatInputEntityNode;
14
+ },
15
+ $isChatInputEntityNode: function() {
16
+ return _ChatInputEntitynode.$isChatInputEntityNode;
17
+ },
18
+ ChatInputEntityNode: function() {
19
+ return _ChatInputEntitynode.ChatInputEntityNode;
20
+ },
21
+ ChatInputEntityPlugin: function() {
22
+ return _ChatInputEntityPlugin.ChatInputEntityPlugin;
23
+ }
24
+ });
25
+ const _ChatInputEntitynode = require("./ChatInputEntity.node");
26
+ const _ChatInputEntityPlugin = require("./ChatInputEntityPlugin");
9
27
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["index.ts"],"sourcesContent":["export * from './ChatInputEntity.node';\nexport * from './ChatInputEntityPlugin';\nexport * from './ChatInputEntityPlugin.types';\n"],"names":[],"rangeMappings":";;;;;;;","mappings":";;;;;uBAAc;uBACA;uBACA"}
1
+ {"version":3,"sources":["index.ts"],"sourcesContent":["export type { SerializedChatInputEntityNode } from './ChatInputEntity.node';\nexport { $createChatInputEntityNode, $isChatInputEntityNode, ChatInputEntityNode } from './ChatInputEntity.node';\nexport { ChatInputEntityPlugin } from './ChatInputEntityPlugin';\nexport type { ChatInputEntityPluginRef } from './ChatInputEntityPlugin.types';\n"],"names":["$createChatInputEntityNode","$isChatInputEntityNode","ChatInputEntityNode","ChatInputEntityPlugin"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IACSA,0BAA0B;eAA1BA,+CAA0B;;IAAEC,sBAAsB;eAAtBA,2CAAsB;;IAAEC,mBAAmB;eAAnBA,wCAAmB;;IACvEC,qBAAqB;eAArBA,4CAAqB;;;qCAD0D;uCAClD"}
@@ -18,12 +18,14 @@ function GhostTextPlugin(props) {
18
18
  'use no memo';
19
19
  const { $getGhostText, id, ghostTextProps, exposeText, allowCompletion } = props;
20
20
  const [editor] = (0, _reacttexteditor.useLexicalComposerContext)();
21
- const ghostTextBase = _react.useRef(null);
21
+ const [ghostTextBase, setGhostTextBase] = _react.useState(null);
22
22
  _react.useEffect(()=>{
23
- ghostTextBase.current = new _chatinputplugins.GhostTextPluginBase(editor, id, $getGhostText, _GhostTextnode.GhostTextNode, _GhostText.$createGhostTextNode, ghostTextProps, exposeText, allowCompletion);
23
+ setGhostTextBase(new _chatinputplugins.GhostTextPluginBase(editor, id, $getGhostText, _GhostTextnode.GhostTextNode, _GhostText.$createGhostTextNode, ghostTextProps, exposeText, allowCompletion));
24
24
  return ()=>{
25
- var _ghostTextBase_current;
26
- (_ghostTextBase_current = ghostTextBase.current) === null || _ghostTextBase_current === void 0 ? void 0 : _ghostTextBase_current.cleanup();
25
+ setGhostTextBase((prev)=>{
26
+ prev === null || prev === void 0 ? void 0 : prev.cleanup();
27
+ return null;
28
+ });
27
29
  };
28
30
  }, // We can update $getGhostText, $createGhostTextNode, ghostTextProps, exposeText, and allowCompletion without remounting
29
31
  // eslint-disable-next-line react-hooks/exhaustive-deps
@@ -32,28 +34,28 @@ function GhostTextPlugin(props) {
32
34
  id
33
35
  ]);
34
36
  _react.useEffect(()=>{
35
- var _ghostTextBase_current;
36
- (_ghostTextBase_current = ghostTextBase.current) === null || _ghostTextBase_current === void 0 ? void 0 : _ghostTextBase_current.setAllowCompletion(allowCompletion);
37
+ ghostTextBase === null || ghostTextBase === void 0 ? void 0 : ghostTextBase.setAllowCompletion(allowCompletion);
37
38
  }, [
38
- allowCompletion
39
+ allowCompletion,
40
+ ghostTextBase
39
41
  ]);
40
42
  _react.useEffect(()=>{
41
- var _ghostTextBase_current;
42
- (_ghostTextBase_current = ghostTextBase.current) === null || _ghostTextBase_current === void 0 ? void 0 : _ghostTextBase_current.setComponentProps(ghostTextProps);
43
+ ghostTextBase === null || ghostTextBase === void 0 ? void 0 : ghostTextBase.setComponentProps(ghostTextProps);
43
44
  }, [
45
+ ghostTextBase,
44
46
  ghostTextProps
45
47
  ]);
46
48
  _react.useEffect(()=>{
47
- var _ghostTextBase_current;
48
- (_ghostTextBase_current = ghostTextBase.current) === null || _ghostTextBase_current === void 0 ? void 0 : _ghostTextBase_current.setExposeText(exposeText);
49
+ ghostTextBase === null || ghostTextBase === void 0 ? void 0 : ghostTextBase.setExposeText(exposeText);
49
50
  }, [
50
- exposeText
51
+ exposeText,
52
+ ghostTextBase
51
53
  ]);
52
54
  _react.useEffect(()=>{
53
- var _ghostTextBase_current;
54
- (_ghostTextBase_current = ghostTextBase.current) === null || _ghostTextBase_current === void 0 ? void 0 : _ghostTextBase_current.setGetGhostText($getGhostText);
55
+ ghostTextBase === null || ghostTextBase === void 0 ? void 0 : ghostTextBase.setGetGhostText($getGhostText);
55
56
  }, [
56
- $getGhostText
57
+ $getGhostText,
58
+ ghostTextBase
57
59
  ]);
58
60
  return null;
59
61
  } //# sourceMappingURL=GhostText.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["GhostText.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useLexicalComposerContext } from '@fluentui-copilot/react-text-editor';\nimport type { LexicalEditor, EditorState } from '@fluentui-copilot/text-editor';\nimport type { GhostTextProps } from '../../GhostText';\nimport { $createGhostTextNode } from '../../GhostText';\nimport { GhostTextNode } from './GhostText.node';\nimport { GhostTextPluginBase } from '@fluentui-copilot/chat-input-plugins';\n\nexport type GhostTextPluginProps = {\n id: string;\n $getGhostText: (\n editor: LexicalEditor,\n editorState: EditorState,\n prevEditorState: EditorState,\n ) => Promise<string | undefined>;\n ghostTextProps?: GhostTextProps;\n // Whether or not the ghost text should count as text inside the input for submitting and character count\n exposeText?: boolean;\n allowCompletion?: boolean;\n};\n\nexport function GhostTextPlugin(props: GhostTextPluginProps): JSX.Element | null {\n 'use no memo';\n\n const { $getGhostText, id, ghostTextProps, exposeText, allowCompletion } = props;\n const [editor] = useLexicalComposerContext();\n\n const ghostTextBase = React.useRef<GhostTextPluginBase<GhostTextProps> | null>(null);\n\n React.useEffect(\n () => {\n ghostTextBase.current = new GhostTextPluginBase(\n editor,\n id,\n $getGhostText,\n GhostTextNode,\n $createGhostTextNode,\n ghostTextProps,\n exposeText,\n allowCompletion,\n );\n\n return () => {\n ghostTextBase.current?.cleanup();\n };\n },\n // We can update $getGhostText, $createGhostTextNode, ghostTextProps, exposeText, and allowCompletion without remounting\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [editor, id],\n );\n\n React.useEffect(() => {\n ghostTextBase.current?.setAllowCompletion(allowCompletion);\n }, [allowCompletion]);\n\n React.useEffect(() => {\n ghostTextBase.current?.setComponentProps(ghostTextProps);\n }, [ghostTextProps]);\n\n React.useEffect(() => {\n ghostTextBase.current?.setExposeText(exposeText);\n }, [exposeText]);\n\n React.useEffect(() => {\n ghostTextBase.current?.setGetGhostText($getGhostText);\n }, [$getGhostText]);\n\n return null;\n}\n"],"names":["GhostTextPlugin","props","$getGhostText","ghostTextBase","React","editor","useLexicalComposerContext","useRef","useEffect","current","GhostTextPluginBase","id","GhostTextNode","$createGhostTextNode","ghostTextProps","exposeText","allowCompletion","_ghostTextBase_current","cleanup","setComponentProps","setExposeText"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAqBgBA;;;eAAAA;;;;iEArBO;iCACmB;2BAGL;+BACP;kCACM;AAe7B,SAASA,gBAAgBC,KAA2B;;UAIzD,EAEAC,aAAMC,EAENC,EAAAA,gBAEID,YAWA,iBACEA;UACF,CAAAE,OAAA,GAAAC,IAAAA,0CAAA;UAEFH,gBAAAC,OAAAG,MAAA,CAAA;WACAC,SAAA,CAAA;QACAL,cAAAM,OAAA,GAAA,IAAAC,qCAAA,CAAAL,QAAAM,IAAAT,eAAAU,4BAAA,EAAAC,+BAAA,EAAAC,gBAAAC,YAAAC;eAACX;gBAAQM;YAAGM,CAAAA,yBAAAd,cAAAM,OAAA,MAAA,QAAAQ,2BAAA,KAAA,IAAA,KAAA,IAAAA,uBAAAC,OAAA;QAGdd;+HACED;2DACC;;;QAACa;KAAAA;WAAgBR,SAAA,CAAA;QAEpBJ,IAAAA;kCACED,cAAAA,OAAAA,MAAAA,QAAAA,2BAAAA,KAAAA,IAAAA,KAAAA,IAAAA,uBAAAA,kBAAAA,CAAAA;;;KAAAA;WACCK,SAAA,CAAA;YAACM;QAAeG,CAAAA,yBAAAd,cAAAM,OAAA,MAAA,QAAAQ,2BAAA,KAAA,IAAA,KAAA,IAAAA,uBAAAE,iBAAA,CAAAL;OAEnBV;QAAAA;KAAgB;oBACdD,CAAAA;;QACFc,CAAAA,yBAAGd,cAAAM,OAAA,MAAA,QAAAQ,2BAAA,KAAA,IAAA,KAAA,IAAAA,uBAAAG,aAAA,CAAAL;;;KAACA;WAAWP,SAAA,CAAA;QAEfJ,IAAAA;kCACED,cAAAA,OAAAA,MAAAA,QAAAA,2BAAAA,KAAAA,IAAAA,KAAAA,IAAAA,uBAAAA,eAAAA,CAAAA;;;KAAAA;WACC;uCAAe"}
1
+ {"version":3,"sources":["GhostText.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useLexicalComposerContext } from '@fluentui-copilot/react-text-editor';\nimport type { LexicalEditor, EditorState } from '@fluentui-copilot/text-editor';\nimport type { GhostTextProps } from '../../GhostText';\nimport { $createGhostTextNode } from '../../GhostText';\nimport { GhostTextNode } from './GhostText.node';\nimport { GhostTextPluginBase } from '@fluentui-copilot/chat-input-plugins';\n\nexport type GhostTextPluginProps = {\n id: string;\n $getGhostText: (\n editor: LexicalEditor,\n editorState: EditorState,\n prevEditorState: EditorState,\n ) => Promise<string | undefined>;\n ghostTextProps?: GhostTextProps;\n // Whether or not the ghost text should count as text inside the input for submitting and character count\n exposeText?: boolean;\n allowCompletion?: boolean;\n};\n\nexport function GhostTextPlugin(props: GhostTextPluginProps): JSX.Element | null {\n 'use no memo';\n\n const { $getGhostText, id, ghostTextProps, exposeText, allowCompletion } = props;\n const [editor] = useLexicalComposerContext();\n\n const [ghostTextBase, setGhostTextBase] = React.useState<GhostTextPluginBase<GhostTextProps> | null>(null);\n\n React.useEffect(\n () => {\n setGhostTextBase(\n new GhostTextPluginBase(\n editor,\n id,\n $getGhostText,\n GhostTextNode,\n $createGhostTextNode,\n ghostTextProps,\n exposeText,\n allowCompletion,\n ),\n );\n\n return () => {\n setGhostTextBase(prev => {\n prev?.cleanup();\n return null;\n });\n };\n },\n // We can update $getGhostText, $createGhostTextNode, ghostTextProps, exposeText, and allowCompletion without remounting\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [editor, id],\n );\n\n React.useEffect(() => {\n ghostTextBase?.setAllowCompletion(allowCompletion);\n }, [allowCompletion, ghostTextBase]);\n\n React.useEffect(() => {\n ghostTextBase?.setComponentProps(ghostTextProps);\n }, [ghostTextBase, ghostTextProps]);\n\n React.useEffect(() => {\n ghostTextBase?.setExposeText(exposeText);\n }, [exposeText, ghostTextBase]);\n\n React.useEffect(() => {\n ghostTextBase?.setGetGhostText($getGhostText);\n }, [$getGhostText, ghostTextBase]);\n\n return null;\n}\n"],"names":["GhostTextPlugin","props","$getGhostText","ghostTextBase","React","setGhostTextBase","useLexicalComposerContext","useState","useEffect","GhostTextPluginBase","editor","id","GhostTextNode","$createGhostTextNode","ghostTextProps","exposeText","allowCompletion","prev","setAllowCompletion","setExposeText"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAqBgBA;;;eAAAA;;;;iEArBO;iCACmB;2BAGL;+BACP;kCACM;AAe7B,SAASA,gBAAgBC,KAA2B;;UAIzD,EAEAC,aAAOC,EAEPC,EAAAA,gBAEIC,YAaA,iBACEA;kBAEE,GAAAC,IAAAA,0CAAO;0BACTD,iBAAA,GAAAD,OAAAG,QAAA,CAAA;WACFC,SAAA,CAAA;QACFH,iBACA,IAAAI,qCAAA,CAAAC,QAAAC,IAAAT,eAAAU,4BAAA,EAAAC,+BAAA,EAAAC,gBAAAC,YAAwHC;QACxH,OAAA;YACAX,iBAAAY,CAAAA;gBAACP,SAAAA,QAAAA,SAAAA,KAAAA,IAAAA,KAAAA,IAAAA,KAAAA,OAAAA;gBAAQC,OAAAA;YAAG;QAGdP;+HAEG;2DAACY;;;QAAiBb;KAAAA;WAAcK,SAAA,CAAA;QAEnCJ,kBAAgB,QAAAD,kBAAA,KAAA,IAAA,KAAA,IAAAA,cAAAe,kBAAA,CAAAF;;;QACdb;KAAAA;WACCK,SAAA,CAAA;0BAACL,QAAAA,kBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,cAAAA,iBAAAA,CAAAA;;;QAAeW;KAAAA;WAAeN,SAAA,CAAA;QAElCJ,kBAAgB,QAAAD,kBAAA,KAAA,IAAA,KAAA,IAAAA,cAAAgB,aAAA,CAAAJ;;;QACdZ;KAAAA;WACCK,SAAA,CAAA;0BAACO,QAAAA,kBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,cAAAA,eAAAA,CAAAA;;;QAAYZ;KAAAA;WAAc;uCAG5BA"}
@@ -2,7 +2,26 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
- const _export_star = require("@swc/helpers/_/_export_star");
6
- _export_star._(require("./GhostText"), exports);
7
- _export_star._(require("./GhostText.node"), exports);
5
+ function _export(target, all) {
6
+ for(var name in all)Object.defineProperty(target, name, {
7
+ enumerable: true,
8
+ get: all[name]
9
+ });
10
+ }
11
+ _export(exports, {
12
+ $createGhostTextNode: function() {
13
+ return _GhostTextnode.$createGhostTextNode;
14
+ },
15
+ $isGhostTextNode: function() {
16
+ return _GhostTextnode.$isGhostTextNode;
17
+ },
18
+ GhostTextNode: function() {
19
+ return _GhostTextnode.GhostTextNode;
20
+ },
21
+ GhostTextPlugin: function() {
22
+ return _GhostText.GhostTextPlugin;
23
+ }
24
+ });
25
+ const _GhostText = require("./GhostText");
26
+ const _GhostTextnode = require("./GhostText.node");
8
27
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["index.ts"],"sourcesContent":["export * from './GhostText';\nexport * from './GhostText.node';\n"],"names":[],"rangeMappings":";;;;;;","mappings":";;;;;uBAAc;uBACA"}
1
+ {"version":3,"sources":["index.ts"],"sourcesContent":["export type { GhostTextPluginProps } from './GhostText';\nexport { GhostTextPlugin } from './GhostText';\nexport type { SerializedGhostTextNode } from './GhostText.node';\nexport { $createGhostTextNode, $isGhostTextNode, GhostTextNode } from './GhostText.node';\n"],"names":["$createGhostTextNode","$isGhostTextNode","GhostTextNode","GhostTextPlugin"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAGSA,oBAAoB;eAApBA,mCAAoB;;IAAEC,gBAAgB;eAAhBA,+BAAgB;;IAAEC,aAAa;eAAbA,4BAAa;;IAFrDC,eAAe;eAAfA,0BAAe;;;2BAAQ;+BAEsC"}
@@ -2,6 +2,11 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
- const _export_star = require("@swc/helpers/_/_export_star");
6
- _export_star._(require("./ImperativeControl"), exports);
5
+ Object.defineProperty(exports, "ImperativeControlPlugin", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return _ImperativeControl.ImperativeControlPlugin;
9
+ }
10
+ });
11
+ const _ImperativeControl = require("./ImperativeControl");
7
12
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["index.ts"],"sourcesContent":["export * from './ImperativeControl';\n"],"names":[],"rangeMappings":";;;;;","mappings":";;;;;uBAAc"}
1
+ {"version":3,"sources":["index.ts"],"sourcesContent":["export type { ImperativeControlPluginProps, ImperativeControlPluginRef } from './ImperativeControl';\nexport { ImperativeControlPlugin } from './ImperativeControl';\n"],"names":["ImperativeControlPlugin"],"rangeMappings":";;;;;;;;;;","mappings":";;;;+BACSA;;;eAAAA,0CAAuB;;;mCAAQ"}
@@ -2,6 +2,11 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
- const _export_star = require("@swc/helpers/_/_export_star");
6
- _export_star._(require("./ManualGhostText"), exports);
5
+ Object.defineProperty(exports, "ManualGhostTextPlugin", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return _ManualGhostText.ManualGhostTextPlugin;
9
+ }
10
+ });
11
+ const _ManualGhostText = require("./ManualGhostText");
7
12
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["index.ts"],"sourcesContent":["export * from './ManualGhostText';\n"],"names":[],"rangeMappings":";;;;;","mappings":";;;;;uBAAc"}
1
+ {"version":3,"sources":["index.ts"],"sourcesContent":["export type { ManualGhostTextProps, ManualGhostTextRef } from './ManualGhostText';\nexport { ManualGhostTextPlugin } from './ManualGhostText';\n"],"names":["ManualGhostTextPlugin"],"rangeMappings":";;;;;;;;;;","mappings":";;;;+BACSA;;;eAAAA,sCAAqB;;;iCAAQ"}
@@ -2,6 +2,11 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
- const _export_star = require("@swc/helpers/_/_export_star");
6
- _export_star._(require("./PasteUnfurling"), exports);
5
+ Object.defineProperty(exports, "PasteUnfurlingPlugin", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return _PasteUnfurling.PasteUnfurlingPlugin;
9
+ }
10
+ });
11
+ const _PasteUnfurling = require("./PasteUnfurling");
7
12
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["index.ts"],"sourcesContent":["export * from './PasteUnfurling';\n"],"names":[],"rangeMappings":";;;;;","mappings":";;;;;uBAAc"}
1
+ {"version":3,"sources":["index.ts"],"sourcesContent":["export type { PasteUnfurlingPluginProps } from './PasteUnfurling';\nexport { PasteUnfurlingPlugin } from './PasteUnfurling';\n"],"names":["PasteUnfurlingPlugin"],"rangeMappings":";;;;;;;;;;","mappings":";;;;+BACSA;;;eAAAA,oCAAoB;;;gCAAQ"}