@fluentui-copilot/react-chat-input-plugins 0.4.1 → 0.4.2

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.
package/CHANGELOG.json CHANGED
@@ -1,6 +1,21 @@
1
1
  {
2
2
  "name": "@fluentui-copilot/react-chat-input-plugins",
3
3
  "entries": [
4
+ {
5
+ "date": "Fri, 07 Feb 2025 02:01:25 GMT",
6
+ "tag": "@fluentui-copilot/react-chat-input-plugins_v0.4.2",
7
+ "version": "0.4.2",
8
+ "comments": {
9
+ "patch": [
10
+ {
11
+ "author": "owcampbe@microsoft.com",
12
+ "package": "@fluentui-copilot/react-chat-input-plugins",
13
+ "commit": "7f530f0f6d24d12c634a1247655aeaa92ddb7561",
14
+ "comment": "feat: Allow disabling the SentinelNode."
15
+ }
16
+ ]
17
+ }
18
+ },
4
19
  {
5
20
  "date": "Thu, 09 Jan 2025 01:15:37 GMT",
6
21
  "tag": "@fluentui-copilot/react-chat-input-plugins_v0.4.0",
package/CHANGELOG.md CHANGED
@@ -1,9 +1,18 @@
1
1
  # Change Log - @fluentui-copilot/react-chat-input-plugins
2
2
 
3
- This log was last generated on Thu, 09 Jan 2025 01:15:37 GMT and should not be manually modified.
3
+ This log was last generated on Fri, 07 Feb 2025 02:01:25 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## [0.4.2](https://github.com/microsoft/fluentai/tree/@fluentui-copilot/react-chat-input-plugins_v0.4.2)
8
+
9
+ Fri, 07 Feb 2025 02:01:25 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentai/compare/@fluentui-copilot/react-chat-input-plugins_v0.4.0..@fluentui-copilot/react-chat-input-plugins_v0.4.2)
11
+
12
+ ### Patches
13
+
14
+ - feat: Allow disabling the SentinelNode. ([PR #2567](https://github.com/microsoft/fluentai/pull/2567) by owcampbe@microsoft.com)
15
+
7
16
  ## [0.4.0](https://github.com/microsoft/fluentai/tree/@fluentui-copilot/react-chat-input-plugins_v0.4.0)
8
17
 
9
18
  Thu, 09 Jan 2025 01:15:37 GMT
package/dist/index.d.ts CHANGED
@@ -38,6 +38,7 @@ export declare type BasicFunctionalityPluginProps = {
38
38
  onCountChanged?: (count: number) => void;
39
39
  onContentChange?: (value: string) => void;
40
40
  onPaste?: (event: ClipboardEvent) => void;
41
+ isSentinelNodeEnabled?: boolean;
41
42
  };
42
43
 
43
44
  export declare type BasicFunctionalityPluginRef = {
@@ -8,19 +8,20 @@ export const BasicFunctionalityPlugin = React.forwardRef((props, ref) => {
8
8
  trimWhitespace,
9
9
  onCountChanged,
10
10
  onContentChange,
11
- onPaste
11
+ onPaste,
12
+ isSentinelNodeEnabled
12
13
  } = props;
13
14
  const [editor] = useLexicalComposerContext();
14
15
  const [basicFunctionalityImpl, setBasicFunctionalityImpl] = React.useState(null);
15
16
  useIsomorphicLayoutEffect(() => {
16
- setBasicFunctionalityImpl(new BasicFunctionalityBase(editor));
17
+ setBasicFunctionalityImpl(new BasicFunctionalityBase(editor, isSentinelNodeEnabled));
17
18
  return () => {
18
19
  setBasicFunctionalityImpl(prev => {
19
20
  prev === null || prev === void 0 ? void 0 : prev.cleanup();
20
21
  return null;
21
22
  });
22
23
  };
23
- }, [editor]);
24
+ }, [editor, isSentinelNodeEnabled]);
24
25
  React.useImperativeHandle(ref, () => ({
25
26
  setIsDisabled(isDisabled) {
26
27
  basicFunctionalityImpl === null || basicFunctionalityImpl === void 0 ? void 0 : basicFunctionalityImpl.setIsDisabled(isDisabled);
@@ -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, 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":["React","useLexicalComposerContext","useIsomorphicLayoutEffect","BasicFunctionalityBase","BasicFunctionalityPlugin","forwardRef","props","ref","defaultValue","trimWhitespace","onCountChanged","onContentChange","onPaste","editor","basicFunctionalityImpl","setBasicFunctionalityImpl","useState","prev","cleanup","useImperativeHandle","setIsDisabled","isDisabled","insertDefaultValue","useEffect","activateContentCallbacks","deactivateContentCallbacks","activatePasteCallback","deactivatePasteCallback","activateTrimWhitespace","deactivateTrimWhitespace"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,yBAAyB,QAAQ,sCAAsC;AAChF,SAASC,yBAAyB,QAAQ,6BAA6B;AAEvE,SAASC,sBAAsB,QAAQ,uCAAuC;AAe9E,OAAO,MAAMC,2BAA2BJ,MAAMK,UAAU,CACtD,CAACC,OAAOC;IACN,MAAM,EAAEC,YAAY,EAAEC,cAAc,EAAEC,cAAc,EAAEC,eAAe,EAAEC,OAAO,EAAE,GAAGN;IAEnF,MAAM,CAACO,OAAO,GAAGZ;IAEjB,MAAM,CAACa,wBAAwBC,0BAA0B,GAAGf,MAAMgB,QAAQ,CAAiC;IAE3Gd,0BAA0B;QACxBa,0BAA0B,IAAIZ,uBAAuBU;QAErD,OAAO;YACLE,0BAA0BE,CAAAA;gBACxBA,iBAAAA,2BAAAA,KAAMC,OAAO;gBACb,OAAO;YACT;QACF;IACF,GAAG;QAACL;KAAO;IAEXb,MAAMmB,mBAAmB,CACvBZ,KACA,IAAO,CAAA;YACLa,eAAcC,UAAmB;gBAC/BP,mCAAAA,6CAAAA,uBAAwBM,aAAa,CAACC;YACxC;QACF,CAAA,GACA;QAACP;KAAuB;IAG1B,wEAAwE;IACxEZ,0BAA0B;QACxB,IAAIM,cAAc;YAChBM,mCAAAA,6CAAAA,uBAAwBQ,kBAAkB,CAACd;QAC7C;IACA,gHAAgH;IAClH,GAAG;QAACK;KAAO;IAEXb,MAAMuB,SAAS,CAAC;QACdT,mCAAAA,6CAAAA,uBAAwBU,wBAAwB,CAACb,iBAAiBD;QAClE,OAAO,IAAMI,mCAAAA,6CAAAA,uBAAwBW,0BAA0B;IACjE,GAAG;QAACX;QAAwBD;QAAQF;QAAiBD;KAAe;IAEpEV,MAAMuB,SAAS,CAAC;QACd,IAAIX,SAAS;YACXE,mCAAAA,6CAAAA,uBAAwBY,qBAAqB,CAACd;QAChD;QACA,OAAO,IAAME,mCAAAA,6CAAAA,uBAAwBa,uBAAuB;IAC9D,GAAG;QAACb;QAAwBD;QAAQD;KAAQ;IAE5CZ,MAAMuB,SAAS,CAAC;QACd,IAAId,gBAAgB;YAClBK,mCAAAA,6CAAAA,uBAAwBc,sBAAsB;QAChD;QACA,OAAO,IAAMd,mCAAAA,6CAAAA,uBAAwBe,wBAAwB;IAC/D,GAAG;QAACf;QAAwBD;QAAQJ;KAAe;IAEnD,OAAO;AACT,GACA"}
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 isSentinelNodeEnabled?: boolean;\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, isSentinelNodeEnabled } = props;\n\n const [editor] = useLexicalComposerContext();\n\n const [basicFunctionalityImpl, setBasicFunctionalityImpl] = React.useState<IBasicFunctionalityBase | null>(null);\n\n useIsomorphicLayoutEffect(() => {\n setBasicFunctionalityImpl(new BasicFunctionalityBase(editor, isSentinelNodeEnabled));\n\n return () => {\n setBasicFunctionalityImpl(prev => {\n prev?.cleanup();\n return null;\n });\n };\n }, [editor, isSentinelNodeEnabled]);\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":["React","useLexicalComposerContext","useIsomorphicLayoutEffect","BasicFunctionalityBase","BasicFunctionalityPlugin","forwardRef","props","ref","defaultValue","trimWhitespace","onCountChanged","onContentChange","onPaste","isSentinelNodeEnabled","editor","basicFunctionalityImpl","setBasicFunctionalityImpl","useState","prev","cleanup","useImperativeHandle","setIsDisabled","isDisabled","insertDefaultValue","useEffect","activateContentCallbacks","deactivateContentCallbacks","activatePasteCallback","deactivatePasteCallback","activateTrimWhitespace","deactivateTrimWhitespace"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,yBAAyB,QAAQ,sCAAsC;AAChF,SAASC,yBAAyB,QAAQ,6BAA6B;AAEvE,SAASC,sBAAsB,QAAQ,uCAAuC;AAgB9E,OAAO,MAAMC,2BAA2BJ,MAAMK,UAAU,CACtD,CAACC,OAAOC;IACN,MAAM,EAAEC,YAAY,EAAEC,cAAc,EAAEC,cAAc,EAAEC,eAAe,EAAEC,OAAO,EAAEC,qBAAqB,EAAE,GAAGP;IAE1G,MAAM,CAACQ,OAAO,GAAGb;IAEjB,MAAM,CAACc,wBAAwBC,0BAA0B,GAAGhB,MAAMiB,QAAQ,CAAiC;IAE3Gf,0BAA0B;QACxBc,0BAA0B,IAAIb,uBAAuBW,QAAQD;QAE7D,OAAO;YACLG,0BAA0BE,CAAAA;gBACxBA,iBAAAA,2BAAAA,KAAMC,OAAO;gBACb,OAAO;YACT;QACF;IACF,GAAG;QAACL;QAAQD;KAAsB;IAElCb,MAAMoB,mBAAmB,CACvBb,KACA,IAAO,CAAA;YACLc,eAAcC,UAAmB;gBAC/BP,mCAAAA,6CAAAA,uBAAwBM,aAAa,CAACC;YACxC;QACF,CAAA,GACA;QAACP;KAAuB;IAG1B,wEAAwE;IACxEb,0BAA0B;QACxB,IAAIM,cAAc;YAChBO,mCAAAA,6CAAAA,uBAAwBQ,kBAAkB,CAACf;QAC7C;IACA,gHAAgH;IAClH,GAAG;QAACM;KAAO;IAEXd,MAAMwB,SAAS,CAAC;QACdT,mCAAAA,6CAAAA,uBAAwBU,wBAAwB,CAACd,iBAAiBD;QAClE,OAAO,IAAMK,mCAAAA,6CAAAA,uBAAwBW,0BAA0B;IACjE,GAAG;QAACX;QAAwBD;QAAQH;QAAiBD;KAAe;IAEpEV,MAAMwB,SAAS,CAAC;QACd,IAAIZ,SAAS;YACXG,mCAAAA,6CAAAA,uBAAwBY,qBAAqB,CAACf;QAChD;QACA,OAAO,IAAMG,mCAAAA,6CAAAA,uBAAwBa,uBAAuB;IAC9D,GAAG;QAACb;QAAwBD;QAAQF;KAAQ;IAE5CZ,MAAMwB,SAAS,CAAC;QACd,IAAIf,gBAAgB;YAClBM,mCAAAA,6CAAAA,uBAAwBc,sBAAsB;QAChD;QACA,OAAO,IAAMd,mCAAAA,6CAAAA,uBAAwBe,wBAAwB;IAC/D,GAAG;QAACf;QAAwBD;QAAQL;KAAe;IAEnD,OAAO;AACT,GACA"}
@@ -14,11 +14,11 @@ const _reacttexteditor = require("@fluentui-copilot/react-text-editor");
14
14
  const _reactcomponents = require("@fluentui/react-components");
15
15
  const _chatinputplugins = require("@fluentui-copilot/chat-input-plugins");
16
16
  const BasicFunctionalityPlugin = /*#__PURE__*/ _react.forwardRef((props, ref)=>{
17
- const { defaultValue, trimWhitespace, onCountChanged, onContentChange, onPaste } = props;
17
+ const { defaultValue, trimWhitespace, onCountChanged, onContentChange, onPaste, isSentinelNodeEnabled } = props;
18
18
  const [editor] = (0, _reacttexteditor.useLexicalComposerContext)();
19
19
  const [basicFunctionalityImpl, setBasicFunctionalityImpl] = _react.useState(null);
20
20
  (0, _reactcomponents.useIsomorphicLayoutEffect)(()=>{
21
- setBasicFunctionalityImpl(new _chatinputplugins.BasicFunctionalityBase(editor));
21
+ setBasicFunctionalityImpl(new _chatinputplugins.BasicFunctionalityBase(editor, isSentinelNodeEnabled));
22
22
  return ()=>{
23
23
  setBasicFunctionalityImpl((prev)=>{
24
24
  prev === null || prev === void 0 ? void 0 : prev.cleanup();
@@ -26,7 +26,8 @@ const BasicFunctionalityPlugin = /*#__PURE__*/ _react.forwardRef((props, ref)=>{
26
26
  });
27
27
  };
28
28
  }, [
29
- editor
29
+ editor,
30
+ isSentinelNodeEnabled
30
31
  ]);
31
32
  _react.useImperativeHandle(ref, ()=>({
32
33
  setIsDisabled (isDisabled) {
@@ -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, 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"}
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 isSentinelNodeEnabled?: boolean;\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, isSentinelNodeEnabled } = props;\n\n const [editor] = useLexicalComposerContext();\n\n const [basicFunctionalityImpl, setBasicFunctionalityImpl] = React.useState<IBasicFunctionalityBase | null>(null);\n\n useIsomorphicLayoutEffect(() => {\n setBasicFunctionalityImpl(new BasicFunctionalityBase(editor, isSentinelNodeEnabled));\n\n return () => {\n setBasicFunctionalityImpl(prev => {\n prev?.cleanup();\n return null;\n });\n };\n }, [editor, isSentinelNodeEnabled]);\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","useLexicalComposerContext","useState","BasicFunctionalityBase","isSentinelNodeEnabled","prev","cleanup","useImperativeHandle","setIsDisabled","isDisabled","insertDefaultValue","useEffect","activateContentCallbacks","onContentChange","deactivateContentCallbacks","onCountChanged","deactivatePasteCallback","onPaste","activateTrimWhitespace","deactivateTrimWhitespace"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAoBaA;;;eAAAA;;;;iEApBU;iCACmB;iCACA;kCAEH;AAgBhC,MAAMA,yCAA2BC,OAAMC,UAAU,CACtD,CAACC,OAAOC;UACN,EAEAC,YAAOC,EAEPC,cAAOC,EAEPC,cAAAA,iBACEC,SAEA,uBACEA;kBAEE,GAAAC,IAAAA,0CAAO;mCACTD,0BAAA,GAAAT,OAAAW,QAAA,CAAA;kDACF,EAAA;QACFF,0BAAG,IAAAG,wCAAA,CAAAP,QAAAQ;eAACR;sCAAQQ,CAAAA;gBAAsBC,SAAA,QAAAA,SAAA,KAAA,IAAA,KAAA,IAAAA,KAAAC,OAAA;gBAElCf,OAAMgB;;;;;QAKFH;KAAA;WACFG,mBACA,CAAAb,KAAA,IAAA,CAAA;2BAACI,UAAAA;gBAAuBA,2BAAA,QAAAA,2BAAA,KAAA,IAAA,KAAA,IAAAA,uBAAAU,aAAA,CAAAC;YAG1B;YACAV;QAAAA;KAA0B;4EACN;kDAChBD,EAAAA;YACFH,cAAA;YACAG,2BAAA,QAAAA,2BAAA,KAAA,IAAA,KAAA,IAAAA,uBAAAY,kBAAgH,CAAAf;QAClH;oHAAIC;OAAO;QAAAA;KAAA;WAEXL,SAAMoB,CAAAA;mCACJb,QAAAA,2BAAAA,KAAAA,IAAAA,KAAAA,IAAAA,uBAAAA,wBAAwBc,CAAAA,iBAAyBC;eACjD,IAAOf,2BAAMA,QAAAA,2BAAAA,KAAAA,IAAAA,KAAAA,IAAAA,uBAAAA,0BAAwBgB;OACvC;QAAAhB;QAAGF;QAAAiB;QAAAE;KAAA;WAACjB,SAAAA,CAAAA;YAAwBF,SAAAA;uCAAQiB,QAAAA,2BAAAA,KAAAA,IAAAA,KAAAA,IAAAA,uBAAAA,qBAAAA,CAAAA;;eAAgC,IAAAf,2BAAA,QAAAA,2BAAA,KAAA,IAAA,KAAA,IAAAA,uBAAAkB,uBAAA;OAEpEzB;QAAAA;QAAgBK;QAAAqB;KAAA;WACdN,SAAIM,CAAAA;4BACFnB;uCACF,QAAAA,2BAAA,KAAA,IAAA,KAAA,IAAAA,uBAAAoB,sBAAA;;QAEF,OAAG,IAAApB,2BAAA,QAAAA,2BAAA,KAAA,IAAA,KAAA,IAAAA,uBAAAqB,wBAAA;;;QAACrB;QAAAA;KAAAA;WAAwBF;kDAAgB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluentui-copilot/react-chat-input-plugins",
3
- "version": "0.4.1",
3
+ "version": "0.4.2",
4
4
  "description": "A Fluent AI package for React-based ChatInput plugins.",
5
5
  "main": "lib-commonjs/index.js",
6
6
  "module": "lib/index.js",
@@ -12,7 +12,7 @@
12
12
  },
13
13
  "license": "MIT",
14
14
  "dependencies": {
15
- "@fluentui-copilot/chat-input-plugins": "^0.4.1",
15
+ "@fluentui-copilot/chat-input-plugins": "^0.4.2",
16
16
  "@fluentui-copilot/react-text-editor": "^0.4.1",
17
17
  "@fluentui-copilot/text-editor": "^0.3.1",
18
18
  "@swc/helpers": "^0.5.1"