@fluentui-copilot/react-chat-input-plugins 0.0.0-nightly-20250708-1433-52f2b6b1.1 → 0.0.0-nightly-20250710-0405-e728c4d6.1

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 (111) hide show
  1. package/CHANGELOG.json +3 -3
  2. package/CHANGELOG.md +4 -4
  3. package/lib/BasicFunctionality.js +1 -0
  4. package/lib/ChatInputEntity.js +1 -0
  5. package/lib/ChatInputToken.js +1 -0
  6. package/lib/GhostText.js +1 -0
  7. package/lib/ImperativeControl.js +1 -0
  8. package/lib/PasteUnfurling.js +1 -0
  9. package/lib/components/ChatInputEntity/ChatInputEntity.js +5 -4
  10. package/lib/components/ChatInputEntity/ChatInputEntity.types.js +3 -2
  11. package/lib/components/ChatInputEntity/index.js +1 -0
  12. package/lib/components/ChatInputEntity/renderChatInputEntity.js +8 -9
  13. package/lib/components/ChatInputEntity/useChatInputEntity.js +44 -40
  14. package/lib/components/ChatInputToken/ChatInputToken.js +5 -4
  15. package/lib/components/ChatInputToken/ChatInputToken.node.js +50 -49
  16. package/lib/components/ChatInputToken/ChatInputToken.types.js +2 -1
  17. package/lib/components/ChatInputToken/index.js +1 -0
  18. package/lib/components/ChatInputToken/renderChatInputToken.js +6 -4
  19. package/lib/components/ChatInputToken/useChatInputToken.js +14 -12
  20. package/lib/components/GhostText/GhostText.js +5 -4
  21. package/lib/components/GhostText/GhostText.types.js +3 -2
  22. package/lib/components/GhostText/index.js +1 -0
  23. package/lib/components/GhostText/renderGhostText.js +8 -9
  24. package/lib/components/GhostText/useGhostText.js +39 -36
  25. package/lib/index.js +1 -0
  26. package/lib/plugins/BasicFunctionality/BasicFunctionality.js +42 -53
  27. package/lib/plugins/BasicFunctionality/index.js +1 -0
  28. package/lib/plugins/ChatInputEntity/ChatInputEntity.node.js +68 -67
  29. package/lib/plugins/ChatInputEntity/ChatInputEntityPlugin.js +38 -37
  30. package/lib/plugins/ChatInputEntity/ChatInputEntityPlugin.types.js +2 -1
  31. package/lib/plugins/ChatInputEntity/index.js +1 -0
  32. package/lib/plugins/GhostText/GhostText.js +37 -43
  33. package/lib/plugins/GhostText/GhostText.node.js +57 -56
  34. package/lib/plugins/GhostText/index.js +1 -0
  35. package/lib/plugins/ImperativeControl/ImperativeControl.js +5 -6
  36. package/lib/plugins/ImperativeControl/index.js +1 -0
  37. package/lib/plugins/ManualGhostText/ManualGhostText.js +8 -8
  38. package/lib/plugins/ManualGhostText/index.js +1 -0
  39. package/lib/plugins/PasteUnfurling/PasteUnfurling.js +14 -14
  40. package/lib/plugins/PasteUnfurling/index.js +1 -0
  41. package/lib-commonjs/BasicFunctionality.js +1 -0
  42. package/lib-commonjs/ChatInputEntity.js +1 -0
  43. package/lib-commonjs/ChatInputToken.js +1 -0
  44. package/lib-commonjs/GhostText.js +1 -0
  45. package/lib-commonjs/ImperativeControl.js +1 -0
  46. package/lib-commonjs/PasteUnfurling.js +1 -0
  47. package/lib-commonjs/components/ChatInputEntity/ChatInputEntity.js +1 -1
  48. package/lib-commonjs/components/ChatInputEntity/ChatInputEntity.js.map +1 -1
  49. package/lib-commonjs/components/ChatInputEntity/ChatInputEntity.types.js +1 -0
  50. package/lib-commonjs/components/ChatInputEntity/ChatInputEntity.types.js.map +1 -1
  51. package/lib-commonjs/components/ChatInputEntity/index.js +1 -0
  52. package/lib-commonjs/components/ChatInputEntity/renderChatInputEntity.js +1 -1
  53. package/lib-commonjs/components/ChatInputEntity/renderChatInputEntity.js.map +1 -1
  54. package/lib-commonjs/components/ChatInputEntity/useChatInputEntity.js +1 -1
  55. package/lib-commonjs/components/ChatInputEntity/useChatInputEntity.js.map +1 -1
  56. package/lib-commonjs/components/ChatInputToken/ChatInputToken.js +1 -1
  57. package/lib-commonjs/components/ChatInputToken/ChatInputToken.js.map +1 -1
  58. package/lib-commonjs/components/ChatInputToken/ChatInputToken.node.js +1 -1
  59. package/lib-commonjs/components/ChatInputToken/ChatInputToken.node.js.map +1 -1
  60. package/lib-commonjs/components/ChatInputToken/ChatInputToken.types.js +1 -0
  61. package/lib-commonjs/components/ChatInputToken/index.js +1 -0
  62. package/lib-commonjs/components/ChatInputToken/renderChatInputToken.js +1 -1
  63. package/lib-commonjs/components/ChatInputToken/renderChatInputToken.js.map +1 -1
  64. package/lib-commonjs/components/ChatInputToken/useChatInputToken.js +1 -1
  65. package/lib-commonjs/components/ChatInputToken/useChatInputToken.js.map +1 -1
  66. package/lib-commonjs/components/GhostText/GhostText.js +1 -1
  67. package/lib-commonjs/components/GhostText/GhostText.js.map +1 -1
  68. package/lib-commonjs/components/GhostText/GhostText.types.js +1 -0
  69. package/lib-commonjs/components/GhostText/GhostText.types.js.map +1 -1
  70. package/lib-commonjs/components/GhostText/index.js +1 -0
  71. package/lib-commonjs/components/GhostText/renderGhostText.js +1 -1
  72. package/lib-commonjs/components/GhostText/renderGhostText.js.map +1 -1
  73. package/lib-commonjs/components/GhostText/useGhostText.js +1 -1
  74. package/lib-commonjs/components/GhostText/useGhostText.js.map +1 -1
  75. package/lib-commonjs/index.js +1 -0
  76. package/lib-commonjs/plugins/BasicFunctionality/BasicFunctionality.js +1 -1
  77. package/lib-commonjs/plugins/BasicFunctionality/BasicFunctionality.js.map +1 -1
  78. package/lib-commonjs/plugins/BasicFunctionality/index.js +1 -0
  79. package/lib-commonjs/plugins/ChatInputEntity/ChatInputEntity.node.js +1 -1
  80. package/lib-commonjs/plugins/ChatInputEntity/ChatInputEntity.node.js.map +1 -1
  81. package/lib-commonjs/plugins/ChatInputEntity/ChatInputEntityPlugin.js +1 -1
  82. package/lib-commonjs/plugins/ChatInputEntity/ChatInputEntityPlugin.js.map +1 -1
  83. package/lib-commonjs/plugins/ChatInputEntity/ChatInputEntityPlugin.types.js +1 -0
  84. package/lib-commonjs/plugins/ChatInputEntity/index.js +1 -0
  85. package/lib-commonjs/plugins/GhostText/GhostText.js +3 -2
  86. package/lib-commonjs/plugins/GhostText/GhostText.js.map +1 -1
  87. package/lib-commonjs/plugins/GhostText/GhostText.node.js +1 -1
  88. package/lib-commonjs/plugins/GhostText/GhostText.node.js.map +1 -1
  89. package/lib-commonjs/plugins/GhostText/index.js +1 -0
  90. package/lib-commonjs/plugins/ImperativeControl/ImperativeControl.js +1 -1
  91. package/lib-commonjs/plugins/ImperativeControl/ImperativeControl.js.map +1 -1
  92. package/lib-commonjs/plugins/ImperativeControl/index.js +1 -0
  93. package/lib-commonjs/plugins/ManualGhostText/ManualGhostText.js +1 -1
  94. package/lib-commonjs/plugins/ManualGhostText/ManualGhostText.js.map +1 -1
  95. package/lib-commonjs/plugins/ManualGhostText/index.js +1 -0
  96. package/lib-commonjs/plugins/PasteUnfurling/PasteUnfurling.js +1 -1
  97. package/lib-commonjs/plugins/PasteUnfurling/PasteUnfurling.js.map +1 -1
  98. package/lib-commonjs/plugins/PasteUnfurling/index.js +1 -0
  99. package/package.json +5 -5
  100. package/lib/components/ChatInputEntity/useChatInputEntityStyles.styles.raw.js +0 -43
  101. package/lib/components/ChatInputEntity/useChatInputEntityStyles.styles.raw.js.map +0 -1
  102. package/lib/components/ChatInputToken/useChatInputTokenStyles.styles.raw.js +0 -25
  103. package/lib/components/ChatInputToken/useChatInputTokenStyles.styles.raw.js.map +0 -1
  104. package/lib/components/GhostText/useGhostTextStyles.styles.raw.js +0 -35
  105. package/lib/components/GhostText/useGhostTextStyles.styles.raw.js.map +0 -1
  106. package/lib-commonjs/components/ChatInputEntity/useChatInputEntityStyles.styles.raw.js +0 -59
  107. package/lib-commonjs/components/ChatInputEntity/useChatInputEntityStyles.styles.raw.js.map +0 -1
  108. package/lib-commonjs/components/ChatInputToken/useChatInputTokenStyles.styles.raw.js +0 -41
  109. package/lib-commonjs/components/ChatInputToken/useChatInputTokenStyles.styles.raw.js.map +0 -1
  110. package/lib-commonjs/components/GhostText/useGhostTextStyles.styles.raw.js +0 -51
  111. package/lib-commonjs/components/GhostText/useGhostTextStyles.styles.raw.js.map +0 -1
@@ -2,57 +2,46 @@ import * as React from 'react';
2
2
  import { useLexicalComposerContext } from '@fluentui-copilot/react-text-editor';
3
3
  import { useIsomorphicLayoutEffect } from '@fluentui/react-components';
4
4
  import { BasicFunctionalityBase } from '@fluentui-copilot/chat-input-plugins';
5
- export const BasicFunctionalityPlugin = React.forwardRef((props, ref)=>{
6
- const { trimWhitespace, onCountChanged, onContentChange, onPaste, isSentinelNodeEnabled } = props;
7
- const [editor] = useLexicalComposerContext();
8
- const [basicFunctionalityImpl, setBasicFunctionalityImpl] = React.useState(null);
9
- useIsomorphicLayoutEffect(()=>{
10
- setBasicFunctionalityImpl(new BasicFunctionalityBase(editor, isSentinelNodeEnabled));
11
- return ()=>{
12
- setBasicFunctionalityImpl((prev)=>{
13
- prev === null || prev === void 0 ? void 0 : prev.cleanup();
14
- return null;
15
- });
16
- };
17
- }, [
18
- editor,
19
- isSentinelNodeEnabled
20
- ]);
21
- React.useImperativeHandle(ref, ()=>({
22
- setIsDisabled (isDisabled) {
23
- basicFunctionalityImpl === null || basicFunctionalityImpl === void 0 ? void 0 : basicFunctionalityImpl.setIsDisabled(isDisabled);
24
- }
25
- }), [
26
- basicFunctionalityImpl
27
- ]);
28
- React.useEffect(()=>{
29
- basicFunctionalityImpl === null || basicFunctionalityImpl === void 0 ? void 0 : basicFunctionalityImpl.activateContentCallbacks(onContentChange, onCountChanged);
30
- return ()=>basicFunctionalityImpl === null || basicFunctionalityImpl === void 0 ? void 0 : basicFunctionalityImpl.deactivateContentCallbacks();
31
- }, [
32
- basicFunctionalityImpl,
33
- editor,
34
- onContentChange,
35
- onCountChanged
36
- ]);
37
- React.useEffect(()=>{
38
- if (onPaste) {
39
- basicFunctionalityImpl === null || basicFunctionalityImpl === void 0 ? void 0 : basicFunctionalityImpl.activatePasteCallback(onPaste);
40
- }
41
- return ()=>basicFunctionalityImpl === null || basicFunctionalityImpl === void 0 ? void 0 : basicFunctionalityImpl.deactivatePasteCallback();
42
- }, [
43
- basicFunctionalityImpl,
44
- editor,
45
- onPaste
46
- ]);
47
- React.useEffect(()=>{
48
- if (trimWhitespace) {
49
- basicFunctionalityImpl === null || basicFunctionalityImpl === void 0 ? void 0 : basicFunctionalityImpl.activateTrimWhitespace();
50
- }
51
- return ()=>basicFunctionalityImpl === null || basicFunctionalityImpl === void 0 ? void 0 : basicFunctionalityImpl.deactivateTrimWhitespace();
52
- }, [
53
- basicFunctionalityImpl,
54
- editor,
55
- trimWhitespace
56
- ]);
57
- return null;
5
+ export const BasicFunctionalityPlugin = React.forwardRef((props, ref) => {
6
+ const {
7
+ trimWhitespace,
8
+ onCountChanged,
9
+ onContentChange,
10
+ onPaste,
11
+ isSentinelNodeEnabled
12
+ } = props;
13
+ const [editor] = useLexicalComposerContext();
14
+ const [basicFunctionalityImpl, setBasicFunctionalityImpl] = React.useState(null);
15
+ useIsomorphicLayoutEffect(() => {
16
+ setBasicFunctionalityImpl(new BasicFunctionalityBase(editor, isSentinelNodeEnabled));
17
+ return () => {
18
+ setBasicFunctionalityImpl(prev => {
19
+ prev === null || prev === void 0 ? void 0 : prev.cleanup();
20
+ return null;
21
+ });
22
+ };
23
+ }, [editor, isSentinelNodeEnabled]);
24
+ React.useImperativeHandle(ref, () => ({
25
+ setIsDisabled(isDisabled) {
26
+ basicFunctionalityImpl === null || basicFunctionalityImpl === void 0 ? void 0 : basicFunctionalityImpl.setIsDisabled(isDisabled);
27
+ }
28
+ }), [basicFunctionalityImpl]);
29
+ React.useEffect(() => {
30
+ basicFunctionalityImpl === null || basicFunctionalityImpl === void 0 ? void 0 : basicFunctionalityImpl.activateContentCallbacks(onContentChange, onCountChanged);
31
+ return () => basicFunctionalityImpl === null || basicFunctionalityImpl === void 0 ? void 0 : basicFunctionalityImpl.deactivateContentCallbacks();
32
+ }, [basicFunctionalityImpl, editor, onContentChange, onCountChanged]);
33
+ React.useEffect(() => {
34
+ if (onPaste) {
35
+ basicFunctionalityImpl === null || basicFunctionalityImpl === void 0 ? void 0 : basicFunctionalityImpl.activatePasteCallback(onPaste);
36
+ }
37
+ return () => basicFunctionalityImpl === null || basicFunctionalityImpl === void 0 ? void 0 : basicFunctionalityImpl.deactivatePasteCallback();
38
+ }, [basicFunctionalityImpl, editor, onPaste]);
39
+ React.useEffect(() => {
40
+ if (trimWhitespace) {
41
+ basicFunctionalityImpl === null || basicFunctionalityImpl === void 0 ? void 0 : basicFunctionalityImpl.activateTrimWhitespace();
42
+ }
43
+ return () => basicFunctionalityImpl === null || basicFunctionalityImpl === void 0 ? void 0 : basicFunctionalityImpl.deactivateTrimWhitespace();
44
+ }, [basicFunctionalityImpl, editor, trimWhitespace]);
45
+ return null;
58
46
  });
47
+ //# sourceMappingURL=BasicFunctionality.js.map
@@ -1 +1,2 @@
1
1
  export { BasicFunctionalityPlugin } from './BasicFunctionality';
2
+ //# sourceMappingURL=index.js.map
@@ -3,76 +3,77 @@ import * as React from 'react';
3
3
  import { DecoratorNode } from '@fluentui-copilot/text-editor';
4
4
  import { ChatInputEntity } from '../../ChatInputEntity';
5
5
  export class ChatInputEntityNode extends DecoratorNode {
6
- static getType() {
7
- return 'entity';
8
- }
9
- static clone(node) {
10
- return new ChatInputEntityNode(node.__pluginId, node.__text, node.__data, node.__entityProps, node.__key);
11
- }
12
- static importJSON(serializedNode) {
13
- return $createChatInputEntityNode(serializedNode.pluginId, serializedNode.text, serializedNode.data, serializedNode.entityProps);
14
- }
15
- isIsolated() {
16
- return true;
17
- }
18
- isInline() {
19
- return true;
20
- }
21
- getTextContent() {
22
- return this.__text;
23
- }
24
- exportJSON() {
25
- return {
26
- pluginId: this.__pluginId,
27
- text: this.__text,
28
- data: this.__data,
29
- entityProps: this.__entityProps,
30
- type: ChatInputEntityNode.getType(),
31
- version: 1
32
- };
33
- }
34
- createDOM() {
35
- // eslint-disable-next-line no-restricted-globals
36
- return document.createElement('span');
37
- }
38
- updateDOM() {
39
- return false;
40
- }
41
- decorate(_editor, config) {
42
- var _this___entityProps;
43
- if ((_this___entityProps = this.__entityProps) === null || _this___entityProps === void 0 ? void 0 : _this___entityProps.children) {
44
- return /*#__PURE__*/ React.createElement(ChatInputEntity, this.__entityProps);
45
- }
46
- return /*#__PURE__*/ React.createElement(ChatInputEntity, this.__entityProps, this.__text);
47
- }
48
- getEntityData() {
49
- return {
50
- text: this.__text,
51
- data: this.__data,
52
- entityProps: this.__entityProps
53
- };
54
- }
55
- updateEntityData(data) {
56
- const writable = this.getWritable();
57
- writable.__text = data.text;
58
- writable.__data = data.data;
59
- writable.__entityProps = data.entityProps;
60
- }
61
- constructor(pluginId, text, data, entityProps, key){
62
- super(key);
63
- _define_property(this, "__pluginId", void 0);
64
- _define_property(this, "__text", void 0);
65
- _define_property(this, "__entityProps", void 0);
66
- _define_property(this, "__data", void 0);
67
- this.__pluginId = pluginId;
68
- this.__text = text;
69
- this.__data = data;
70
- this.__entityProps = entityProps;
6
+ static getType() {
7
+ return 'entity';
8
+ }
9
+ static clone(node) {
10
+ return new ChatInputEntityNode(node.__pluginId, node.__text, node.__data, node.__entityProps, node.__key);
11
+ }
12
+ static importJSON(serializedNode) {
13
+ return $createChatInputEntityNode(serializedNode.pluginId, serializedNode.text, serializedNode.data, serializedNode.entityProps);
14
+ }
15
+ isIsolated() {
16
+ return true;
17
+ }
18
+ isInline() {
19
+ return true;
20
+ }
21
+ getTextContent() {
22
+ return this.__text;
23
+ }
24
+ exportJSON() {
25
+ return {
26
+ pluginId: this.__pluginId,
27
+ text: this.__text,
28
+ data: this.__data,
29
+ entityProps: this.__entityProps,
30
+ type: ChatInputEntityNode.getType(),
31
+ version: 1
32
+ };
33
+ }
34
+ createDOM() {
35
+ // eslint-disable-next-line no-restricted-globals
36
+ return document.createElement('span');
37
+ }
38
+ updateDOM() {
39
+ return false;
40
+ }
41
+ decorate(_editor, config) {
42
+ var _this___entityProps;
43
+ if ((_this___entityProps = this.__entityProps) === null || _this___entityProps === void 0 ? void 0 : _this___entityProps.children) {
44
+ return /*#__PURE__*/React.createElement(ChatInputEntity, this.__entityProps);
71
45
  }
46
+ return /*#__PURE__*/React.createElement(ChatInputEntity, this.__entityProps, this.__text);
47
+ }
48
+ getEntityData() {
49
+ return {
50
+ text: this.__text,
51
+ data: this.__data,
52
+ entityProps: this.__entityProps
53
+ };
54
+ }
55
+ updateEntityData(data) {
56
+ const writable = this.getWritable();
57
+ writable.__text = data.text;
58
+ writable.__data = data.data;
59
+ writable.__entityProps = data.entityProps;
60
+ }
61
+ constructor(pluginId, text, data, entityProps, key) {
62
+ super(key);
63
+ _define_property(this, "__pluginId", void 0);
64
+ _define_property(this, "__text", void 0);
65
+ _define_property(this, "__entityProps", void 0);
66
+ _define_property(this, "__data", void 0);
67
+ this.__pluginId = pluginId;
68
+ this.__text = text;
69
+ this.__data = data;
70
+ this.__entityProps = entityProps;
71
+ }
72
72
  }
73
73
  export function $createChatInputEntityNode(pluginId, text, data, entityProps, key) {
74
- return new ChatInputEntityNode(pluginId, text, data, entityProps, key);
74
+ return new ChatInputEntityNode(pluginId, text, data, entityProps, key);
75
75
  }
76
76
  export function $isChatInputEntityNode(node) {
77
- return node instanceof ChatInputEntityNode;
77
+ return node instanceof ChatInputEntityNode;
78
78
  }
79
+ //# sourceMappingURL=ChatInputEntity.node.js.map
@@ -2,41 +2,42 @@ import { useLexicalComposerContext } from '@fluentui-copilot/react-text-editor';
2
2
  import * as React from 'react';
3
3
  import { $createChatInputEntityNode, $isChatInputEntityNode, ChatInputEntityNode } from './ChatInputEntity.node';
4
4
  import { ChatInputEntityPluginBase } from '@fluentui-copilot/chat-input-plugins';
5
- export const ChatInputEntityPlugin = (props)=>{
6
- const { id, controlRef, onChatInputEntityAdded, onChatInputEntityDeleted, skipInitialization } = props;
7
- const [editor] = useLexicalComposerContext();
8
- const chatInputEntityPluginBase = React.useRef(null);
9
- React.useEffect(()=>{
10
- chatInputEntityPluginBase.current = new ChatInputEntityPluginBase(editor, id, ChatInputEntityNode, $createChatInputEntityNode, $isChatInputEntityNode, onChatInputEntityAdded, onChatInputEntityDeleted);
11
- return ()=>{
12
- var _chatInputEntityPluginBase_current;
13
- return (_chatInputEntityPluginBase_current = chatInputEntityPluginBase.current) === null || _chatInputEntityPluginBase_current === void 0 ? void 0 : _chatInputEntityPluginBase_current.cleanup();
14
- };
15
- }, [
16
- editor,
17
- id,
18
- onChatInputEntityAdded,
19
- onChatInputEntityDeleted,
20
- skipInitialization
21
- ]);
22
- React.useImperativeHandle(controlRef, ()=>({
23
- insertChatInputEntity (props) {
24
- var _chatInputEntityPluginBase_current;
25
- return (_chatInputEntityPluginBase_current = chatInputEntityPluginBase.current) === null || _chatInputEntityPluginBase_current === void 0 ? void 0 : _chatInputEntityPluginBase_current.insertChatInputEntity(props);
26
- },
27
- getActiveEntities () {
28
- var _chatInputEntityPluginBase_current;
29
- var _chatInputEntityPluginBase_current_getActiveEntities;
30
- return (_chatInputEntityPluginBase_current_getActiveEntities = (_chatInputEntityPluginBase_current = chatInputEntityPluginBase.current) === null || _chatInputEntityPluginBase_current === void 0 ? void 0 : _chatInputEntityPluginBase_current.getActiveEntities()) !== null && _chatInputEntityPluginBase_current_getActiveEntities !== void 0 ? _chatInputEntityPluginBase_current_getActiveEntities : [];
31
- },
32
- removeChatInputEntity (keyOrPredicate) {
33
- var _chatInputEntityPluginBase_current;
34
- (_chatInputEntityPluginBase_current = chatInputEntityPluginBase.current) === null || _chatInputEntityPluginBase_current === void 0 ? void 0 : _chatInputEntityPluginBase_current.removeChatInputEntity(keyOrPredicate);
35
- },
36
- updateChatInputEntityProps (keyOrPredicate, props) {
37
- var _chatInputEntityPluginBase_current;
38
- (_chatInputEntityPluginBase_current = chatInputEntityPluginBase.current) === null || _chatInputEntityPluginBase_current === void 0 ? void 0 : _chatInputEntityPluginBase_current.updateChatInputEntityProps(keyOrPredicate, props);
39
- }
40
- }), []);
41
- return null;
5
+ export const ChatInputEntityPlugin = props => {
6
+ const {
7
+ id,
8
+ controlRef,
9
+ onChatInputEntityAdded,
10
+ onChatInputEntityDeleted,
11
+ skipInitialization
12
+ } = props;
13
+ const [editor] = useLexicalComposerContext();
14
+ const chatInputEntityPluginBase = React.useRef(null);
15
+ React.useEffect(() => {
16
+ chatInputEntityPluginBase.current = new ChatInputEntityPluginBase(editor, id, ChatInputEntityNode, $createChatInputEntityNode, $isChatInputEntityNode, onChatInputEntityAdded, onChatInputEntityDeleted);
17
+ return () => {
18
+ var _chatInputEntityPluginBase_current;
19
+ return (_chatInputEntityPluginBase_current = chatInputEntityPluginBase.current) === null || _chatInputEntityPluginBase_current === void 0 ? void 0 : _chatInputEntityPluginBase_current.cleanup();
20
+ };
21
+ }, [editor, id, onChatInputEntityAdded, onChatInputEntityDeleted, skipInitialization]);
22
+ React.useImperativeHandle(controlRef, () => ({
23
+ insertChatInputEntity(props) {
24
+ var _chatInputEntityPluginBase_current;
25
+ return (_chatInputEntityPluginBase_current = chatInputEntityPluginBase.current) === null || _chatInputEntityPluginBase_current === void 0 ? void 0 : _chatInputEntityPluginBase_current.insertChatInputEntity(props);
26
+ },
27
+ getActiveEntities() {
28
+ var _chatInputEntityPluginBase_current;
29
+ var _chatInputEntityPluginBase_current_getActiveEntities;
30
+ return (_chatInputEntityPluginBase_current_getActiveEntities = (_chatInputEntityPluginBase_current = chatInputEntityPluginBase.current) === null || _chatInputEntityPluginBase_current === void 0 ? void 0 : _chatInputEntityPluginBase_current.getActiveEntities()) !== null && _chatInputEntityPluginBase_current_getActiveEntities !== void 0 ? _chatInputEntityPluginBase_current_getActiveEntities : [];
31
+ },
32
+ removeChatInputEntity(keyOrPredicate) {
33
+ var _chatInputEntityPluginBase_current;
34
+ (_chatInputEntityPluginBase_current = chatInputEntityPluginBase.current) === null || _chatInputEntityPluginBase_current === void 0 ? void 0 : _chatInputEntityPluginBase_current.removeChatInputEntity(keyOrPredicate);
35
+ },
36
+ updateChatInputEntityProps(keyOrPredicate, props) {
37
+ var _chatInputEntityPluginBase_current;
38
+ (_chatInputEntityPluginBase_current = chatInputEntityPluginBase.current) === null || _chatInputEntityPluginBase_current === void 0 ? void 0 : _chatInputEntityPluginBase_current.updateChatInputEntityProps(keyOrPredicate, props);
39
+ }
40
+ }), []);
41
+ return null;
42
42
  };
43
+ //# sourceMappingURL=ChatInputEntityPlugin.js.map
@@ -1 +1,2 @@
1
- export { };
1
+ export {};
2
+ //# sourceMappingURL=ChatInputEntityPlugin.types.js.map
@@ -1,2 +1,3 @@
1
1
  export { $createChatInputEntityNode, $isChatInputEntityNode, ChatInputEntityNode } from './ChatInputEntity.node';
2
2
  export { ChatInputEntityPlugin } from './ChatInputEntityPlugin';
3
+ //# sourceMappingURL=index.js.map
@@ -4,47 +4,41 @@ import { $createGhostTextNode } from '../../GhostText';
4
4
  import { GhostTextNode } from './GhostText.node';
5
5
  import { GhostTextPluginBase } from '@fluentui-copilot/chat-input-plugins';
6
6
  export function GhostTextPlugin(props) {
7
- 'use no memo';
8
- const { $getGhostText, id, ghostTextProps, exposeText, allowCompletion } = props;
9
- const [editor] = useLexicalComposerContext();
10
- const [ghostTextBase, setGhostTextBase] = React.useState(null);
11
- React.useEffect(()=>{
12
- setGhostTextBase(new GhostTextPluginBase(editor, id, $getGhostText, GhostTextNode, $createGhostTextNode, ghostTextProps, exposeText, allowCompletion));
13
- return ()=>{
14
- setGhostTextBase((prev)=>{
15
- prev === null || prev === void 0 ? void 0 : prev.cleanup();
16
- return null;
17
- });
18
- };
19
- }, // We can update $getGhostText, $createGhostTextNode, ghostTextProps, exposeText, and allowCompletion without remounting
20
- // eslint-disable-next-line react-hooks/exhaustive-deps
21
- [
22
- editor,
23
- id
24
- ]);
25
- React.useEffect(()=>{
26
- ghostTextBase === null || ghostTextBase === void 0 ? void 0 : ghostTextBase.setAllowCompletion(allowCompletion);
27
- }, [
28
- allowCompletion,
29
- ghostTextBase
30
- ]);
31
- React.useEffect(()=>{
32
- ghostTextBase === null || ghostTextBase === void 0 ? void 0 : ghostTextBase.setComponentProps(ghostTextProps);
33
- }, [
34
- ghostTextBase,
35
- ghostTextProps
36
- ]);
37
- React.useEffect(()=>{
38
- ghostTextBase === null || ghostTextBase === void 0 ? void 0 : ghostTextBase.setExposeText(exposeText);
39
- }, [
40
- exposeText,
41
- ghostTextBase
42
- ]);
43
- React.useEffect(()=>{
44
- ghostTextBase === null || ghostTextBase === void 0 ? void 0 : ghostTextBase.setGetGhostText($getGhostText);
45
- }, [
46
- $getGhostText,
47
- ghostTextBase
48
- ]);
49
- return null;
7
+ 'use no memo';
8
+
9
+ const {
10
+ $getGhostText,
11
+ id,
12
+ ghostTextProps,
13
+ exposeText,
14
+ allowCompletion
15
+ } = props;
16
+ const [editor] = useLexicalComposerContext();
17
+ const [ghostTextBase, setGhostTextBase] = React.useState(null);
18
+ React.useEffect(() => {
19
+ setGhostTextBase(new GhostTextPluginBase(editor, id, $getGhostText, GhostTextNode, $createGhostTextNode, ghostTextProps, exposeText, allowCompletion));
20
+ return () => {
21
+ setGhostTextBase(prev => {
22
+ prev === null || prev === void 0 ? void 0 : prev.cleanup();
23
+ return null;
24
+ });
25
+ };
26
+ },
27
+ // We can update $getGhostText, $createGhostTextNode, ghostTextProps, exposeText, and allowCompletion without remounting
28
+ // eslint-disable-next-line react-hooks/exhaustive-deps
29
+ [editor, id]);
30
+ React.useEffect(() => {
31
+ ghostTextBase === null || ghostTextBase === void 0 ? void 0 : ghostTextBase.setAllowCompletion(allowCompletion);
32
+ }, [allowCompletion, ghostTextBase]);
33
+ React.useEffect(() => {
34
+ ghostTextBase === null || ghostTextBase === void 0 ? void 0 : ghostTextBase.setComponentProps(ghostTextProps);
35
+ }, [ghostTextBase, ghostTextProps]);
36
+ React.useEffect(() => {
37
+ ghostTextBase === null || ghostTextBase === void 0 ? void 0 : ghostTextBase.setExposeText(exposeText);
38
+ }, [exposeText, ghostTextBase]);
39
+ React.useEffect(() => {
40
+ ghostTextBase === null || ghostTextBase === void 0 ? void 0 : ghostTextBase.setGetGhostText($getGhostText);
41
+ }, [$getGhostText, ghostTextBase]);
42
+ return null;
50
43
  }
44
+ //# sourceMappingURL=GhostText.js.map
@@ -3,64 +3,65 @@ import * as React from 'react';
3
3
  import { DecoratorNode } from '@fluentui-copilot/text-editor';
4
4
  import { GhostText } from '../../components/GhostText/GhostText';
5
5
  export class GhostTextNode extends DecoratorNode {
6
- static clone(node) {
7
- return new GhostTextNode(node.__id, node.__content, node.__exposeText, node.__componentProps, node.__key);
8
- }
9
- static getType() {
10
- return 'ghosttext';
11
- }
12
- static importJSON(serializedNode) {
13
- const node = $createGhostTextNode(serializedNode.id, serializedNode.content, serializedNode.exposeText, serializedNode.componentProps);
14
- return node;
15
- }
16
- exportJSON() {
17
- return {
18
- type: 'ghosttext',
19
- id: this.__id,
20
- content: this.__content,
21
- componentProps: this.__componentProps,
22
- exposeText: this.__exposeText,
23
- version: 1
24
- };
25
- }
26
- isInline() {
27
- return true;
28
- }
29
- isIsolated() {
30
- return true;
31
- }
32
- getTextContent() {
33
- return this.__exposeText ? this.__content : '';
34
- }
35
- updateDOM(prevNode, dom, config) {
36
- return false;
37
- }
38
- createDOM(config) {
39
- // eslint-disable-next-line no-restricted-globals
40
- return document.createElement('span');
41
- }
42
- decorate() {
43
- return /*#__PURE__*/ React.createElement(GhostText, {
44
- nodeKey: this.getKey(),
45
- ...this.__componentProps
46
- }, this.__content);
47
- }
48
- constructor(id, content, exposeText, componentProps, key){
49
- super(key);
50
- _define_property(this, "__content", void 0);
51
- _define_property(this, "__id", void 0);
52
- _define_property(this, "__allowCommitting", void 0);
53
- _define_property(this, "__componentProps", void 0);
54
- _define_property(this, "__exposeText", void 0);
55
- this.__id = id;
56
- this.__content = content;
57
- this.__exposeText = exposeText;
58
- this.__componentProps = componentProps;
59
- }
6
+ static clone(node) {
7
+ return new GhostTextNode(node.__id, node.__content, node.__exposeText, node.__componentProps, node.__key);
8
+ }
9
+ static getType() {
10
+ return 'ghosttext';
11
+ }
12
+ static importJSON(serializedNode) {
13
+ const node = $createGhostTextNode(serializedNode.id, serializedNode.content, serializedNode.exposeText, serializedNode.componentProps);
14
+ return node;
15
+ }
16
+ exportJSON() {
17
+ return {
18
+ type: 'ghosttext',
19
+ id: this.__id,
20
+ content: this.__content,
21
+ componentProps: this.__componentProps,
22
+ exposeText: this.__exposeText,
23
+ version: 1
24
+ };
25
+ }
26
+ isInline() {
27
+ return true;
28
+ }
29
+ isIsolated() {
30
+ return true;
31
+ }
32
+ getTextContent() {
33
+ return this.__exposeText ? this.__content : '';
34
+ }
35
+ updateDOM(prevNode, dom, config) {
36
+ return false;
37
+ }
38
+ createDOM(config) {
39
+ // eslint-disable-next-line no-restricted-globals
40
+ return document.createElement('span');
41
+ }
42
+ decorate() {
43
+ return /*#__PURE__*/React.createElement(GhostText, {
44
+ nodeKey: this.getKey(),
45
+ ...this.__componentProps
46
+ }, this.__content);
47
+ }
48
+ constructor(id, content, exposeText, componentProps, key) {
49
+ super(key);
50
+ _define_property(this, "__content", void 0);
51
+ _define_property(this, "__id", void 0);
52
+ _define_property(this, "__allowCommitting", void 0);
53
+ _define_property(this, "__componentProps", void 0);
54
+ _define_property(this, "__exposeText", void 0);
55
+ this.__id = id;
56
+ this.__content = content;
57
+ this.__exposeText = exposeText;
58
+ this.__componentProps = componentProps;
59
+ }
60
60
  }
61
61
  export function $createGhostTextNode(id, content, exposeText, componentProps) {
62
- return new GhostTextNode(id, content, exposeText, componentProps);
62
+ return new GhostTextNode(id, content, exposeText, componentProps);
63
63
  }
64
64
  export function $isGhostTextNode(node) {
65
- return node instanceof GhostTextNode;
65
+ return node instanceof GhostTextNode;
66
66
  }
67
+ //# sourceMappingURL=GhostText.node.js.map
@@ -1,2 +1,3 @@
1
1
  export { GhostTextPlugin } from './GhostText';
2
2
  export { $createGhostTextNode, $isGhostTextNode, GhostTextNode } from './GhostText.node';
3
+ //# sourceMappingURL=index.js.map
@@ -1,10 +1,9 @@
1
1
  import * as React from 'react';
2
2
  import { ImperativeControlBase } from '@fluentui-copilot/chat-input-plugins';
3
3
  import { useLexicalComposerContext } from '@fluentui-copilot/react-text-editor';
4
- export const ImperativeControlPlugin = /*#__PURE__*/ React.forwardRef((_props, ref)=>{
5
- const [editor] = useLexicalComposerContext();
6
- React.useImperativeHandle(ref, ()=>new ImperativeControlBase(editor), [
7
- editor
8
- ]);
9
- return null;
4
+ export const ImperativeControlPlugin = /*#__PURE__*/React.forwardRef((_props, ref) => {
5
+ const [editor] = useLexicalComposerContext();
6
+ React.useImperativeHandle(ref, () => new ImperativeControlBase(editor), [editor]);
7
+ return null;
10
8
  });
9
+ //# sourceMappingURL=ImperativeControl.js.map
@@ -1 +1,2 @@
1
1
  export { ImperativeControlPlugin } from './ImperativeControl';
2
+ //# sourceMappingURL=index.js.map
@@ -2,13 +2,13 @@ import * as React from 'react';
2
2
  import { useLexicalComposerContext } from '@fluentui-copilot/react-text-editor';
3
3
  import { $createGhostTextNode, $isGhostTextNode } from '../../GhostText';
4
4
  import { ManualGhostTextBase } from '@fluentui-copilot/chat-input-plugins';
5
- export const ManualGhostTextPlugin = React.forwardRef((props, ref)=>{
6
- const { id } = props;
7
- const [editor] = useLexicalComposerContext();
8
- React.useImperativeHandle(ref, ()=>new ManualGhostTextBase(editor, id, $isGhostTextNode, $createGhostTextNode), [
9
- editor,
10
- id
11
- ]);
12
- return null;
5
+ export const ManualGhostTextPlugin = React.forwardRef((props, ref) => {
6
+ const {
7
+ id
8
+ } = props;
9
+ const [editor] = useLexicalComposerContext();
10
+ React.useImperativeHandle(ref, () => new ManualGhostTextBase(editor, id, $isGhostTextNode, $createGhostTextNode), [editor, id]);
11
+ return null;
13
12
  });
14
13
  ManualGhostTextPlugin.displayName = 'ManualGhostTextPlugin';
14
+ //# sourceMappingURL=ManualGhostText.js.map
@@ -1 +1,2 @@
1
1
  export { ManualGhostTextPlugin } from './ManualGhostText';
2
+ //# sourceMappingURL=index.js.map
@@ -2,18 +2,18 @@ import * as React from 'react';
2
2
  import { registerPasteUnfurlingPlugin } from '@fluentui-copilot/chat-input-plugins';
3
3
  import { $createChatInputEntityNode } from '../../ChatInputEntity';
4
4
  import { useLexicalComposerContext } from '@fluentui-copilot/react-text-editor';
5
- export const PasteUnfurlingPlugin = (props)=>{
6
- const { $createEntityNode = $createChatInputEntityNode, ...rest } = props;
7
- const [editor] = useLexicalComposerContext();
8
- React.useEffect(()=>{
9
- return registerPasteUnfurlingPlugin(editor, {
10
- ...rest,
11
- $createEntityNode
12
- });
13
- }, [
14
- $createEntityNode,
15
- editor,
16
- rest
17
- ]);
18
- return null;
5
+ export const PasteUnfurlingPlugin = props => {
6
+ const {
7
+ $createEntityNode = $createChatInputEntityNode,
8
+ ...rest
9
+ } = props;
10
+ const [editor] = useLexicalComposerContext();
11
+ React.useEffect(() => {
12
+ return registerPasteUnfurlingPlugin(editor, {
13
+ ...rest,
14
+ $createEntityNode
15
+ });
16
+ }, [$createEntityNode, editor, rest]);
17
+ return null;
19
18
  };
19
+ //# sourceMappingURL=PasteUnfurling.js.map