@fluentui-copilot/chat-input-plugins 0.0.0-nightly-20240412-0405-ad714a01.1 → 0.0.0-nightly-20240415-0406-70cdd374.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.
package/CHANGELOG.json CHANGED
@@ -2,9 +2,9 @@
2
2
  "name": "@fluentui-copilot/chat-input-plugins",
3
3
  "entries": [
4
4
  {
5
- "date": "Fri, 12 Apr 2024 04:10:30 GMT",
6
- "tag": "@fluentui-copilot/chat-input-plugins_v0.0.0-nightly-20240412-0405-ad714a01.1",
7
- "version": "0.0.0-nightly-20240412-0405-ad714a01.1",
5
+ "date": "Mon, 15 Apr 2024 04:12:15 GMT",
6
+ "tag": "@fluentui-copilot/chat-input-plugins_v0.0.0-nightly-20240415-0406-70cdd374.1",
7
+ "version": "0.0.0-nightly-20240415-0406-70cdd374.1",
8
8
  "comments": {
9
9
  "prerelease": [
10
10
  {
@@ -16,8 +16,8 @@
16
16
  {
17
17
  "author": "beachball",
18
18
  "package": "@fluentui-copilot/chat-input-plugins",
19
- "comment": "Bump @fluentui-copilot/text-editor to v0.0.0-nightly-20240412-0405-ad714a01.1",
20
- "commit": "e915fd46e06e52a9af1c4cf90df21b13e2a872b5"
19
+ "comment": "Bump @fluentui-copilot/text-editor to v0.0.0-nightly-20240415-0406-70cdd374.1",
20
+ "commit": "cb90d5b9e22c6a9ad9a443d02f3b77292860611e"
21
21
  }
22
22
  ]
23
23
  }
package/CHANGELOG.md CHANGED
@@ -1,18 +1,18 @@
1
1
  # Change Log - @fluentui-copilot/chat-input-plugins
2
2
 
3
- This log was last generated on Fri, 12 Apr 2024 04:10:30 GMT and should not be manually modified.
3
+ This log was last generated on Mon, 15 Apr 2024 04:12:15 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
- ## [0.0.0-nightly-20240412-0405-ad714a01.1](https://github.com/microsoft/fluentai/tree/@fluentui-copilot/chat-input-plugins_v0.0.0-nightly-20240412-0405-ad714a01.1)
7
+ ## [0.0.0-nightly-20240415-0406-70cdd374.1](https://github.com/microsoft/fluentai/tree/@fluentui-copilot/chat-input-plugins_v0.0.0-nightly-20240415-0406-70cdd374.1)
8
8
 
9
- Fri, 12 Apr 2024 04:10:30 GMT
10
- [Compare changes](https://github.com/microsoft/fluentai/compare/@fluentui-copilot/chat-input-plugins_v0.0.1..@fluentui-copilot/chat-input-plugins_v0.0.0-nightly-20240412-0405-ad714a01.1)
9
+ Mon, 15 Apr 2024 04:12:15 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentai/compare/@fluentui-copilot/chat-input-plugins_v0.0.1..@fluentui-copilot/chat-input-plugins_v0.0.0-nightly-20240415-0406-70cdd374.1)
11
11
 
12
12
  ### Changes
13
13
 
14
14
  - Release nightly ([commit](https://github.com/microsoft/fluentai/commit/not available) by fluentui-internal@service.microsoft.com)
15
- - Bump @fluentui-copilot/text-editor to v0.0.0-nightly-20240412-0405-ad714a01.1 ([commit](https://github.com/microsoft/fluentai/commit/e915fd46e06e52a9af1c4cf90df21b13e2a872b5) by beachball)
15
+ - Bump @fluentui-copilot/text-editor to v0.0.0-nightly-20240415-0406-70cdd374.1 ([commit](https://github.com/microsoft/fluentai/commit/cb90d5b9e22c6a9ad9a443d02f3b77292860611e) by beachball)
16
16
 
17
17
  ## [0.0.1](https://github.com/microsoft/fluentai/tree/@fluentui-copilot/chat-input-plugins_v0.0.1)
18
18
 
package/dist/index.d.ts CHANGED
@@ -105,6 +105,7 @@ export declare interface IImperativeControlBase {
105
105
  insertTextAtCursor: (text: string) => void;
106
106
  getInputText: () => string;
107
107
  scrollToBottom: () => void;
108
+ moveCursor: (location: number) => void;
108
109
  }
109
110
 
110
111
  export declare interface IManualGhostTextBase<ComponentPropsType> {
@@ -117,6 +118,7 @@ export declare interface IManualGhostTextBase<ComponentPropsType> {
117
118
  export declare class ImperativeControlBase implements IImperativeControlBase {
118
119
  private __editor;
119
120
  constructor(editor: LexicalEditor);
121
+ moveCursor(location: number): void;
120
122
  setInputText(inputText: string): void;
121
123
  appendText(text: string): void;
122
124
  prependText(text: string): void;
@@ -1,6 +1,31 @@
1
1
  import { _ as _define_property } from "@swc/helpers/_/_define_property";
2
- import { $createParagraphNode, $createTextNode, $getRoot, $getSelection } from '@fluentui-copilot/text-editor';
2
+ import { $createParagraphNode, $createRangeSelection, $createTextNode, $getLeafNodes, $getRoot, $getSelection, $isTextNode, $normalizeSelection__EXPERIMENTAL, $setSelection } from '@fluentui-copilot/text-editor';
3
3
  export class ImperativeControlBase {
4
+ moveCursor(location) {
5
+ this.__editor.update(() => {
6
+ const children = $getLeafNodes($getRoot());
7
+ let baseOffset = 0;
8
+ let currentNode = children.shift();
9
+ while (baseOffset < location && currentNode) {
10
+ const nodeLength = $isTextNode(currentNode) && !currentNode.isToken() ? currentNode.getTextContent().length : 1;
11
+ if (baseOffset + nodeLength >= location) {
12
+ const elementType = $isTextNode(currentNode) ? 'text' : 'element';
13
+ const localOffset = location - baseOffset;
14
+ const nodeKey = currentNode.getKey();
15
+ const selection = $createRangeSelection();
16
+ selection.anchor.set(nodeKey, localOffset, elementType);
17
+ selection.focus.set(nodeKey, localOffset, elementType);
18
+ $setSelection($normalizeSelection__EXPERIMENTAL(selection));
19
+ return;
20
+ }
21
+ baseOffset += nodeLength;
22
+ currentNode = children.shift();
23
+ }
24
+ if (location > baseOffset) {
25
+ $getRoot().selectEnd();
26
+ }
27
+ });
28
+ }
4
29
  setInputText(inputText) {
5
30
  this.__editor.update(() => {
6
31
  const root = $getRoot();
@@ -1 +1 @@
1
- {"version":3,"sources":["ImperativeControl.base.ts"],"sourcesContent":["import type { LexicalEditor } from '@fluentui-copilot/text-editor';\nimport { $createParagraphNode, $createTextNode, $getRoot, $getSelection } from '@fluentui-copilot/text-editor';\n\nexport interface IImperativeControlBase {\n setInputText: (inputText: string) => void;\n appendText: (text: string) => void;\n prependText: (text: string) => void;\n insertTextAtCursor: (text: string) => void;\n getInputText: () => string;\n scrollToBottom: () => void;\n}\n\nexport class ImperativeControlBase implements IImperativeControlBase {\n private __editor: LexicalEditor;\n\n constructor(editor: LexicalEditor) {\n this.__editor = editor;\n }\n setInputText(inputText: string) {\n this.__editor.update(() => {\n const root = $getRoot();\n root.clear();\n if (inputText !== '') {\n const newParagraph = $createParagraphNode();\n const newText = $createTextNode(inputText);\n\n newParagraph.append(newText);\n root.append(newParagraph);\n root.selectEnd();\n }\n });\n }\n appendText(text: string) {\n this.__editor.update(() => {\n $getRoot().selectEnd().insertText(text);\n });\n }\n prependText(text: string) {\n this.__editor.update(() => {\n $getRoot().selectStart().insertText(text);\n });\n }\n insertTextAtCursor(text: string) {\n this.__editor.update(() => {\n $getSelection()?.insertText(text);\n });\n }\n getInputText() {\n return this.__editor.getEditorState().read(() => {\n return $getRoot().getTextContent();\n });\n }\n scrollToBottom() {\n this.__editor.getRootElement()?.scrollIntoView({ behavior: 'smooth', block: 'end' });\n return;\n }\n}\n"],"names":["$createParagraphNode","$createTextNode","$getRoot","$getSelection","ImperativeControlBase","setInputText","inputText","__editor","update","root","clear","newParagraph","newText","append","selectEnd","appendText","text","insertText","prependText","selectStart","insertTextAtCursor","getInputText","getEditorState","read","getTextContent","scrollToBottom","getRootElement","scrollIntoView","behavior","block","constructor","editor"],"mappings":";AACA,SAASA,oBAAoB,EAAEC,eAAe,EAAEC,QAAQ,EAAEC,aAAa,QAAQ,gCAAgC;AAW/G,OAAO,MAAMC;IAMXC,aAAaC,SAAiB,EAAE;QAC9B,IAAI,CAACC,QAAQ,CAACC,MAAM,CAAC;YACnB,MAAMC,OAAOP;YACbO,KAAKC,KAAK;YACV,IAAIJ,cAAc,IAAI;gBACpB,MAAMK,eAAeX;gBACrB,MAAMY,UAAUX,gBAAgBK;gBAEhCK,aAAaE,MAAM,CAACD;gBACpBH,KAAKI,MAAM,CAACF;gBACZF,KAAKK,SAAS;YAChB;QACF;IACF;IACAC,WAAWC,IAAY,EAAE;QACvB,IAAI,CAACT,QAAQ,CAACC,MAAM,CAAC;YACnBN,WAAWY,SAAS,GAAGG,UAAU,CAACD;QACpC;IACF;IACAE,YAAYF,IAAY,EAAE;QACxB,IAAI,CAACT,QAAQ,CAACC,MAAM,CAAC;YACnBN,WAAWiB,WAAW,GAAGF,UAAU,CAACD;QACtC;IACF;IACAI,mBAAmBJ,IAAY,EAAE;QAC/B,IAAI,CAACT,QAAQ,CAACC,MAAM,CAAC;gBACnBL;aAAAA,iBAAAA,6BAAAA,qCAAAA,eAAiBc,UAAU,CAACD;QAC9B;IACF;IACAK,eAAe;QACb,OAAO,IAAI,CAACd,QAAQ,CAACe,cAAc,GAAGC,IAAI,CAAC;YACzC,OAAOrB,WAAWsB,cAAc;QAClC;IACF;IACAC,iBAAiB;YACf;SAAA,gCAAA,IAAI,CAAClB,QAAQ,CAACmB,cAAc,gBAA5B,oDAAA,8BAAgCC,cAAc,CAAC;YAAEC,UAAU;YAAUC,OAAO;QAAM;QAClF;IACF;IAxCAC,YAAYC,MAAqB,CAAE;QAFnC,uBAAQxB,YAAR,KAAA;QAGE,IAAI,CAACA,QAAQ,GAAGwB;IAClB;AAuCF"}
1
+ {"version":3,"sources":["ImperativeControl.base.ts"],"sourcesContent":["import type { LexicalEditor } from '@fluentui-copilot/text-editor';\nimport {\n $createParagraphNode,\n $createRangeSelection,\n $createTextNode,\n $getLeafNodes,\n $getRoot,\n $getSelection,\n $isTextNode,\n $normalizeSelection__EXPERIMENTAL,\n $setSelection,\n} from '@fluentui-copilot/text-editor';\n\nexport interface IImperativeControlBase {\n setInputText: (inputText: string) => void;\n appendText: (text: string) => void;\n prependText: (text: string) => void;\n insertTextAtCursor: (text: string) => void;\n getInputText: () => string;\n scrollToBottom: () => void;\n moveCursor: (location: number) => void;\n}\n\nexport class ImperativeControlBase implements IImperativeControlBase {\n private __editor: LexicalEditor;\n\n constructor(editor: LexicalEditor) {\n this.__editor = editor;\n }\n\n moveCursor(location: number): void {\n this.__editor.update(() => {\n const children = $getLeafNodes($getRoot());\n\n let baseOffset = 0;\n let currentNode = children.shift();\n while (baseOffset < location && currentNode) {\n const nodeLength =\n $isTextNode(currentNode) && !currentNode.isToken()\n ? currentNode.getTextContent().length\n : // Token text nodes and non-text nodes are considered to be a single entry in the input\n 1;\n\n if (baseOffset + nodeLength >= location) {\n const elementType = $isTextNode(currentNode) ? 'text' : 'element';\n const localOffset = location - baseOffset;\n const nodeKey = currentNode.getKey();\n\n const selection = $createRangeSelection();\n selection.anchor.set(nodeKey, localOffset, elementType);\n selection.focus.set(nodeKey, localOffset, elementType);\n\n $setSelection($normalizeSelection__EXPERIMENTAL(selection));\n return;\n }\n\n baseOffset += nodeLength;\n currentNode = children.shift();\n }\n\n if (location > baseOffset) {\n $getRoot().selectEnd();\n }\n });\n }\n setInputText(inputText: string) {\n this.__editor.update(() => {\n const root = $getRoot();\n root.clear();\n if (inputText !== '') {\n const newParagraph = $createParagraphNode();\n const newText = $createTextNode(inputText);\n\n newParagraph.append(newText);\n root.append(newParagraph);\n root.selectEnd();\n }\n });\n }\n appendText(text: string) {\n this.__editor.update(() => {\n $getRoot().selectEnd().insertText(text);\n });\n }\n prependText(text: string) {\n this.__editor.update(() => {\n $getRoot().selectStart().insertText(text);\n });\n }\n insertTextAtCursor(text: string) {\n this.__editor.update(() => {\n $getSelection()?.insertText(text);\n });\n }\n getInputText() {\n return this.__editor.getEditorState().read(() => {\n return $getRoot().getTextContent();\n });\n }\n scrollToBottom() {\n this.__editor.getRootElement()?.scrollIntoView({ behavior: 'smooth', block: 'end' });\n return;\n }\n}\n"],"names":["$createParagraphNode","$createRangeSelection","$createTextNode","$getLeafNodes","$getRoot","$getSelection","$isTextNode","$normalizeSelection__EXPERIMENTAL","$setSelection","ImperativeControlBase","moveCursor","location","__editor","update","children","baseOffset","currentNode","shift","nodeLength","isToken","getTextContent","length","elementType","localOffset","nodeKey","getKey","selection","anchor","set","focus","selectEnd","setInputText","inputText","root","clear","newParagraph","newText","append","appendText","text","insertText","prependText","selectStart","insertTextAtCursor","getInputText","getEditorState","read","scrollToBottom","getRootElement","scrollIntoView","behavior","block","constructor","editor"],"mappings":";AACA,SACEA,oBAAoB,EACpBC,qBAAqB,EACrBC,eAAe,EACfC,aAAa,EACbC,QAAQ,EACRC,aAAa,EACbC,WAAW,EACXC,iCAAiC,EACjCC,aAAa,QACR,gCAAgC;AAYvC,OAAO,MAAMC;IAOXC,WAAWC,QAAgB,EAAQ;QACjC,IAAI,CAACC,QAAQ,CAACC,MAAM,CAAC;YACnB,MAAMC,WAAWX,cAAcC;YAE/B,IAAIW,aAAa;YACjB,IAAIC,cAAcF,SAASG,KAAK;YAChC,MAAOF,aAAaJ,YAAYK,YAAa;gBAC3C,MAAME,aACJZ,YAAYU,gBAAgB,CAACA,YAAYG,OAAO,KAC5CH,YAAYI,cAAc,GAAGC,MAAM,GAEnC;gBAEN,IAAIN,aAAaG,cAAcP,UAAU;oBACvC,MAAMW,cAAchB,YAAYU,eAAe,SAAS;oBACxD,MAAMO,cAAcZ,WAAWI;oBAC/B,MAAMS,UAAUR,YAAYS,MAAM;oBAElC,MAAMC,YAAYzB;oBAClByB,UAAUC,MAAM,CAACC,GAAG,CAACJ,SAASD,aAAaD;oBAC3CI,UAAUG,KAAK,CAACD,GAAG,CAACJ,SAASD,aAAaD;oBAE1Cd,cAAcD,kCAAkCmB;oBAChD;gBACF;gBAEAX,cAAcG;gBACdF,cAAcF,SAASG,KAAK;YAC9B;YAEA,IAAIN,WAAWI,YAAY;gBACzBX,WAAW0B,SAAS;YACtB;QACF;IACF;IACAC,aAAaC,SAAiB,EAAE;QAC9B,IAAI,CAACpB,QAAQ,CAACC,MAAM,CAAC;YACnB,MAAMoB,OAAO7B;YACb6B,KAAKC,KAAK;YACV,IAAIF,cAAc,IAAI;gBACpB,MAAMG,eAAenC;gBACrB,MAAMoC,UAAUlC,gBAAgB8B;gBAEhCG,aAAaE,MAAM,CAACD;gBACpBH,KAAKI,MAAM,CAACF;gBACZF,KAAKH,SAAS;YAChB;QACF;IACF;IACAQ,WAAWC,IAAY,EAAE;QACvB,IAAI,CAAC3B,QAAQ,CAACC,MAAM,CAAC;YACnBT,WAAW0B,SAAS,GAAGU,UAAU,CAACD;QACpC;IACF;IACAE,YAAYF,IAAY,EAAE;QACxB,IAAI,CAAC3B,QAAQ,CAACC,MAAM,CAAC;YACnBT,WAAWsC,WAAW,GAAGF,UAAU,CAACD;QACtC;IACF;IACAI,mBAAmBJ,IAAY,EAAE;QAC/B,IAAI,CAAC3B,QAAQ,CAACC,MAAM,CAAC;gBACnBR;aAAAA,iBAAAA,6BAAAA,qCAAAA,eAAiBmC,UAAU,CAACD;QAC9B;IACF;IACAK,eAAe;QACb,OAAO,IAAI,CAAChC,QAAQ,CAACiC,cAAc,GAAGC,IAAI,CAAC;YACzC,OAAO1C,WAAWgB,cAAc;QAClC;IACF;IACA2B,iBAAiB;YACf;SAAA,gCAAA,IAAI,CAACnC,QAAQ,CAACoC,cAAc,gBAA5B,oDAAA,8BAAgCC,cAAc,CAAC;YAAEC,UAAU;YAAUC,OAAO;QAAM;QAClF;IACF;IA5EAC,YAAYC,MAAqB,CAAE;QAFnC,uBAAQzC,YAAR,KAAA;QAGE,IAAI,CAACA,QAAQ,GAAGyC;IAClB;AA2EF"}
@@ -11,6 +11,31 @@ Object.defineProperty(exports, "ImperativeControlBase", {
11
11
  const _define_property = require("@swc/helpers/_/_define_property");
12
12
  const _texteditor = require("@fluentui-copilot/text-editor");
13
13
  class ImperativeControlBase {
14
+ moveCursor(location) {
15
+ this.__editor.update(()=>{
16
+ const children = (0, _texteditor.$getLeafNodes)((0, _texteditor.$getRoot)());
17
+ let baseOffset = 0;
18
+ let currentNode = children.shift();
19
+ while(baseOffset < location && currentNode){
20
+ const nodeLength = (0, _texteditor.$isTextNode)(currentNode) && !currentNode.isToken() ? currentNode.getTextContent().length : 1;
21
+ if (baseOffset + nodeLength >= location) {
22
+ const elementType = (0, _texteditor.$isTextNode)(currentNode) ? 'text' : 'element';
23
+ const localOffset = location - baseOffset;
24
+ const nodeKey = currentNode.getKey();
25
+ const selection = (0, _texteditor.$createRangeSelection)();
26
+ selection.anchor.set(nodeKey, localOffset, elementType);
27
+ selection.focus.set(nodeKey, localOffset, elementType);
28
+ (0, _texteditor.$setSelection)((0, _texteditor.$normalizeSelection__EXPERIMENTAL)(selection));
29
+ return;
30
+ }
31
+ baseOffset += nodeLength;
32
+ currentNode = children.shift();
33
+ }
34
+ if (location > baseOffset) {
35
+ (0, _texteditor.$getRoot)().selectEnd();
36
+ }
37
+ });
38
+ }
14
39
  setInputText(inputText) {
15
40
  this.__editor.update(()=>{
16
41
  const root = (0, _texteditor.$getRoot)();
@@ -1 +1 @@
1
- {"version":3,"sources":["ImperativeControl.base.js"],"sourcesContent":["import { _ as _define_property } from \"@swc/helpers/_/_define_property\";\nimport { $createParagraphNode, $createTextNode, $getRoot, $getSelection } from '@fluentui-copilot/text-editor';\nexport class ImperativeControlBase {\n setInputText(inputText) {\n this.__editor.update(() => {\n const root = $getRoot();\n root.clear();\n if (inputText !== '') {\n const newParagraph = $createParagraphNode();\n const newText = $createTextNode(inputText);\n newParagraph.append(newText);\n root.append(newParagraph);\n root.selectEnd();\n }\n });\n }\n appendText(text) {\n this.__editor.update(() => {\n $getRoot().selectEnd().insertText(text);\n });\n }\n prependText(text) {\n this.__editor.update(() => {\n $getRoot().selectStart().insertText(text);\n });\n }\n insertTextAtCursor(text) {\n this.__editor.update(() => {\n var _$getSelection;\n (_$getSelection = $getSelection()) === null || _$getSelection === void 0 ? void 0 : _$getSelection.insertText(text);\n });\n }\n getInputText() {\n return this.__editor.getEditorState().read(() => {\n return $getRoot().getTextContent();\n });\n }\n scrollToBottom() {\n var _this___editor_getRootElement;\n (_this___editor_getRootElement = this.__editor.getRootElement()) === null || _this___editor_getRootElement === void 0 ? void 0 : _this___editor_getRootElement.scrollIntoView({\n behavior: 'smooth',\n block: 'end'\n });\n return;\n }\n constructor(editor) {\n _define_property(this, \"__editor\", void 0);\n this.__editor = editor;\n }\n}\n//# sourceMappingURL=ImperativeControl.base.js.map"],"names":["ImperativeControlBase","setInputText","inputText","__editor","update","root","$getRoot","clear","newParagraph","$createParagraphNode","newText","$createTextNode","append","selectEnd","appendText","text","insertText","prependText","selectStart","insertTextAtCursor","_$getSelection","$getSelection","getInputText","getEditorState","read","getTextContent","scrollToBottom","_this___editor_getRootElement","getRootElement","scrollIntoView","behavior","block","constructor","editor","_define_property"],"mappings":";;;;+BAEaA;;;eAAAA;;;iCAFyB;4BACyC;AACxE,MAAMA;IACXC,aAAaC,SAAS,EAAE;QACtB,IAAI,CAACC,QAAQ,CAACC,MAAM,CAAC;YACnB,MAAMC,OAAOC,IAAAA,oBAAQ;YACrBD,KAAKE,KAAK;YACV,IAAIL,cAAc,IAAI;gBACpB,MAAMM,eAAeC,IAAAA,gCAAoB;gBACzC,MAAMC,UAAUC,IAAAA,2BAAe,EAACT;gBAChCM,aAAaI,MAAM,CAACF;gBACpBL,KAAKO,MAAM,CAACJ;gBACZH,KAAKQ,SAAS;YAChB;QACF;IACF;IACAC,WAAWC,IAAI,EAAE;QACf,IAAI,CAACZ,QAAQ,CAACC,MAAM,CAAC;YACnBE,IAAAA,oBAAQ,IAAGO,SAAS,GAAGG,UAAU,CAACD;QACpC;IACF;IACAE,YAAYF,IAAI,EAAE;QAChB,IAAI,CAACZ,QAAQ,CAACC,MAAM,CAAC;YACnBE,IAAAA,oBAAQ,IAAGY,WAAW,GAAGF,UAAU,CAACD;QACtC;IACF;IACAI,mBAAmBJ,IAAI,EAAE;QACvB,IAAI,CAACZ,QAAQ,CAACC,MAAM,CAAC;YACnB,IAAIgB;YACHA,CAAAA,iBAAiBC,IAAAA,yBAAa,GAAC,MAAO,QAAQD,mBAAmB,KAAK,IAAI,KAAK,IAAIA,eAAeJ,UAAU,CAACD;QAChH;IACF;IACAO,eAAe;QACb,OAAO,IAAI,CAACnB,QAAQ,CAACoB,cAAc,GAAGC,IAAI,CAAC;YACzC,OAAOlB,IAAAA,oBAAQ,IAAGmB,cAAc;QAClC;IACF;IACAC,iBAAiB;QACf,IAAIC;QACHA,CAAAA,gCAAgC,IAAI,CAACxB,QAAQ,CAACyB,cAAc,EAAC,MAAO,QAAQD,kCAAkC,KAAK,IAAI,KAAK,IAAIA,8BAA8BE,cAAc,CAAC;YAC5KC,UAAU;YACVC,OAAO;QACT;QACA;IACF;IACAC,YAAYC,MAAM,CAAE;QAClBC,IAAAA,kBAAgB,EAAC,IAAI,EAAE,YAAY,KAAK;QACxC,IAAI,CAAC/B,QAAQ,GAAG8B;IAClB;AACF,EACA,kDAAkD"}
1
+ {"version":3,"sources":["ImperativeControl.base.js"],"sourcesContent":["import { _ as _define_property } from \"@swc/helpers/_/_define_property\";\nimport { $createParagraphNode, $createRangeSelection, $createTextNode, $getLeafNodes, $getRoot, $getSelection, $isTextNode, $normalizeSelection__EXPERIMENTAL, $setSelection } from '@fluentui-copilot/text-editor';\nexport class ImperativeControlBase {\n moveCursor(location) {\n this.__editor.update(() => {\n const children = $getLeafNodes($getRoot());\n let baseOffset = 0;\n let currentNode = children.shift();\n while (baseOffset < location && currentNode) {\n const nodeLength = $isTextNode(currentNode) && !currentNode.isToken() ? currentNode.getTextContent().length : 1;\n if (baseOffset + nodeLength >= location) {\n const elementType = $isTextNode(currentNode) ? 'text' : 'element';\n const localOffset = location - baseOffset;\n const nodeKey = currentNode.getKey();\n const selection = $createRangeSelection();\n selection.anchor.set(nodeKey, localOffset, elementType);\n selection.focus.set(nodeKey, localOffset, elementType);\n $setSelection($normalizeSelection__EXPERIMENTAL(selection));\n return;\n }\n baseOffset += nodeLength;\n currentNode = children.shift();\n }\n if (location > baseOffset) {\n $getRoot().selectEnd();\n }\n });\n }\n setInputText(inputText) {\n this.__editor.update(() => {\n const root = $getRoot();\n root.clear();\n if (inputText !== '') {\n const newParagraph = $createParagraphNode();\n const newText = $createTextNode(inputText);\n newParagraph.append(newText);\n root.append(newParagraph);\n root.selectEnd();\n }\n });\n }\n appendText(text) {\n this.__editor.update(() => {\n $getRoot().selectEnd().insertText(text);\n });\n }\n prependText(text) {\n this.__editor.update(() => {\n $getRoot().selectStart().insertText(text);\n });\n }\n insertTextAtCursor(text) {\n this.__editor.update(() => {\n var _$getSelection;\n (_$getSelection = $getSelection()) === null || _$getSelection === void 0 ? void 0 : _$getSelection.insertText(text);\n });\n }\n getInputText() {\n return this.__editor.getEditorState().read(() => {\n return $getRoot().getTextContent();\n });\n }\n scrollToBottom() {\n var _this___editor_getRootElement;\n (_this___editor_getRootElement = this.__editor.getRootElement()) === null || _this___editor_getRootElement === void 0 ? void 0 : _this___editor_getRootElement.scrollIntoView({\n behavior: 'smooth',\n block: 'end'\n });\n return;\n }\n constructor(editor) {\n _define_property(this, \"__editor\", void 0);\n this.__editor = editor;\n }\n}\n//# sourceMappingURL=ImperativeControl.base.js.map"],"names":["ImperativeControlBase","moveCursor","location","__editor","update","children","$getLeafNodes","$getRoot","baseOffset","currentNode","shift","nodeLength","$isTextNode","isToken","getTextContent","length","elementType","localOffset","nodeKey","getKey","selection","$createRangeSelection","anchor","set","focus","$setSelection","$normalizeSelection__EXPERIMENTAL","selectEnd","setInputText","inputText","root","clear","newParagraph","$createParagraphNode","newText","$createTextNode","append","appendText","text","insertText","prependText","selectStart","insertTextAtCursor","_$getSelection","$getSelection","getInputText","getEditorState","read","scrollToBottom","_this___editor_getRootElement","getRootElement","scrollIntoView","behavior","block","constructor","editor","_define_property"],"mappings":";;;;+BAEaA;;;eAAAA;;;iCAFyB;4BAC8I;AAC7K,MAAMA;IACXC,WAAWC,QAAQ,EAAE;QACnB,IAAI,CAACC,QAAQ,CAACC,MAAM,CAAC;YACnB,MAAMC,WAAWC,IAAAA,yBAAa,EAACC,IAAAA,oBAAQ;YACvC,IAAIC,aAAa;YACjB,IAAIC,cAAcJ,SAASK,KAAK;YAChC,MAAOF,aAAaN,YAAYO,YAAa;gBAC3C,MAAME,aAAaC,IAAAA,uBAAW,EAACH,gBAAgB,CAACA,YAAYI,OAAO,KAAKJ,YAAYK,cAAc,GAAGC,MAAM,GAAG;gBAC9G,IAAIP,aAAaG,cAAcT,UAAU;oBACvC,MAAMc,cAAcJ,IAAAA,uBAAW,EAACH,eAAe,SAAS;oBACxD,MAAMQ,cAAcf,WAAWM;oBAC/B,MAAMU,UAAUT,YAAYU,MAAM;oBAClC,MAAMC,YAAYC,IAAAA,iCAAqB;oBACvCD,UAAUE,MAAM,CAACC,GAAG,CAACL,SAASD,aAAaD;oBAC3CI,UAAUI,KAAK,CAACD,GAAG,CAACL,SAASD,aAAaD;oBAC1CS,IAAAA,yBAAa,EAACC,IAAAA,6CAAiC,EAACN;oBAChD;gBACF;gBACAZ,cAAcG;gBACdF,cAAcJ,SAASK,KAAK;YAC9B;YACA,IAAIR,WAAWM,YAAY;gBACzBD,IAAAA,oBAAQ,IAAGoB,SAAS;YACtB;QACF;IACF;IACAC,aAAaC,SAAS,EAAE;QACtB,IAAI,CAAC1B,QAAQ,CAACC,MAAM,CAAC;YACnB,MAAM0B,OAAOvB,IAAAA,oBAAQ;YACrBuB,KAAKC,KAAK;YACV,IAAIF,cAAc,IAAI;gBACpB,MAAMG,eAAeC,IAAAA,gCAAoB;gBACzC,MAAMC,UAAUC,IAAAA,2BAAe,EAACN;gBAChCG,aAAaI,MAAM,CAACF;gBACpBJ,KAAKM,MAAM,CAACJ;gBACZF,KAAKH,SAAS;YAChB;QACF;IACF;IACAU,WAAWC,IAAI,EAAE;QACf,IAAI,CAACnC,QAAQ,CAACC,MAAM,CAAC;YACnBG,IAAAA,oBAAQ,IAAGoB,SAAS,GAAGY,UAAU,CAACD;QACpC;IACF;IACAE,YAAYF,IAAI,EAAE;QAChB,IAAI,CAACnC,QAAQ,CAACC,MAAM,CAAC;YACnBG,IAAAA,oBAAQ,IAAGkC,WAAW,GAAGF,UAAU,CAACD;QACtC;IACF;IACAI,mBAAmBJ,IAAI,EAAE;QACvB,IAAI,CAACnC,QAAQ,CAACC,MAAM,CAAC;YACnB,IAAIuC;YACHA,CAAAA,iBAAiBC,IAAAA,yBAAa,GAAC,MAAO,QAAQD,mBAAmB,KAAK,IAAI,KAAK,IAAIA,eAAeJ,UAAU,CAACD;QAChH;IACF;IACAO,eAAe;QACb,OAAO,IAAI,CAAC1C,QAAQ,CAAC2C,cAAc,GAAGC,IAAI,CAAC;YACzC,OAAOxC,IAAAA,oBAAQ,IAAGO,cAAc;QAClC;IACF;IACAkC,iBAAiB;QACf,IAAIC;QACHA,CAAAA,gCAAgC,IAAI,CAAC9C,QAAQ,CAAC+C,cAAc,EAAC,MAAO,QAAQD,kCAAkC,KAAK,IAAI,KAAK,IAAIA,8BAA8BE,cAAc,CAAC;YAC5KC,UAAU;YACVC,OAAO;QACT;QACA;IACF;IACAC,YAAYC,MAAM,CAAE;QAClBC,IAAAA,kBAAgB,EAAC,IAAI,EAAE,YAAY,KAAK;QACxC,IAAI,CAACrD,QAAQ,GAAGoD;IAClB;AACF,EACA,kDAAkD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluentui-copilot/chat-input-plugins",
3
- "version": "0.0.0-nightly-20240412-0405-ad714a01.1",
3
+ "version": "0.0.0-nightly-20240415-0406-70cdd374.1",
4
4
  "description": "A Fluent AI package for non-react specific chat input 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/text-editor": "0.0.0-nightly-20240412-0405-ad714a01.1",
15
+ "@fluentui-copilot/text-editor": "0.0.0-nightly-20240415-0406-70cdd374.1",
16
16
  "@swc/helpers": "^0.5.1"
17
17
  },
18
18
  "beachball": {},