@fluentui-copilot/react-chat-input-plugins 0.2.0 → 0.2.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,36 @@
1
1
  {
2
2
  "name": "@fluentui-copilot/react-chat-input-plugins",
3
3
  "entries": [
4
+ {
5
+ "date": "Thu, 19 Sep 2024 19:49:24 GMT",
6
+ "tag": "@fluentui-copilot/react-chat-input-plugins_v0.2.2",
7
+ "version": "0.2.2",
8
+ "comments": {
9
+ "patch": [
10
+ {
11
+ "author": "owcampbe@microsoft.com",
12
+ "package": "@fluentui-copilot/react-chat-input-plugins",
13
+ "commit": "5e5a22a24fed5574c02404ea29b59e8320fa78a0",
14
+ "comment": "feat: Allow controlling skipInitialization."
15
+ }
16
+ ]
17
+ }
18
+ },
19
+ {
20
+ "date": "Tue, 10 Sep 2024 19:06:43 GMT",
21
+ "tag": "@fluentui-copilot/react-chat-input-plugins_v0.2.1",
22
+ "version": "0.2.1",
23
+ "comments": {
24
+ "patch": [
25
+ {
26
+ "author": "owcampbe@microsoft.com",
27
+ "package": "@fluentui-copilot/react-chat-input-plugins",
28
+ "commit": "368b9b6b7585e21933d471a1fa6f38566b39efd7",
29
+ "comment": "fix: Properly implement exportJSON for decorator nodes."
30
+ }
31
+ ]
32
+ }
33
+ },
4
34
  {
5
35
  "date": "Wed, 21 Aug 2024 00:26:07 GMT",
6
36
  "tag": "@fluentui-copilot/react-chat-input-plugins_v0.1.5",
package/CHANGELOG.md CHANGED
@@ -1,9 +1,27 @@
1
1
  # Change Log - @fluentui-copilot/react-chat-input-plugins
2
2
 
3
- This log was last generated on Wed, 21 Aug 2024 00:26:07 GMT and should not be manually modified.
3
+ This log was last generated on Thu, 19 Sep 2024 19:49:24 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## [0.2.2](https://github.com/microsoft/fluentai/tree/@fluentui-copilot/react-chat-input-plugins_v0.2.2)
8
+
9
+ Thu, 19 Sep 2024 19:49:24 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentai/compare/@fluentui-copilot/react-chat-input-plugins_v0.2.1..@fluentui-copilot/react-chat-input-plugins_v0.2.2)
11
+
12
+ ### Patches
13
+
14
+ - feat: Allow controlling skipInitialization. ([PR #2189](https://github.com/microsoft/fluentai/pull/2189) by owcampbe@microsoft.com)
15
+
16
+ ## [0.2.1](https://github.com/microsoft/fluentai/tree/@fluentui-copilot/react-chat-input-plugins_v0.2.1)
17
+
18
+ Tue, 10 Sep 2024 19:06:43 GMT
19
+ [Compare changes](https://github.com/microsoft/fluentai/compare/@fluentui-copilot/react-chat-input-plugins_v0.1.5..@fluentui-copilot/react-chat-input-plugins_v0.2.1)
20
+
21
+ ### Patches
22
+
23
+ - fix: Properly implement exportJSON for decorator nodes. ([PR #2161](https://github.com/microsoft/fluentai/pull/2161) by owcampbe@microsoft.com)
24
+
7
25
  ## [0.1.5](https://github.com/microsoft/fluentai/tree/@fluentui-copilot/react-chat-input-plugins_v0.1.5)
8
26
 
9
27
  Wed, 21 Aug 2024 00:26:07 GMT
@@ -23,7 +23,6 @@ export class ChatInputTokenNode extends DecoratorNode {
23
23
  }
24
24
  exportJSON() {
25
25
  return {
26
- ...super.exportJSON(),
27
26
  text: this.__text,
28
27
  componentProps: this.__componentProps,
29
28
  type: ChatInputTokenNode.getType(),
@@ -1 +1 @@
1
- {"version":3,"sources":["ChatInputToken.node.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { DecoratorNode } from '@fluentui-copilot/text-editor';\nimport type {\n EditorConfig,\n LexicalEditor,\n LexicalNode,\n NodeKey,\n SerializedLexicalNode,\n Spread,\n} from '@fluentui-copilot/text-editor';\nimport type { ChatInputTokenProps } from './ChatInputToken.types';\nimport { ChatInputToken } from './ChatInputToken';\n\nexport type SerializedChatInputTokenNode = Spread<\n { text: string; componentProps?: ChatInputTokenProps },\n SerializedLexicalNode\n>;\n\nexport class ChatInputTokenNode extends DecoratorNode<JSX.Element | null> {\n __text: string;\n __componentProps?: ChatInputTokenProps;\n\n static getType(): string {\n return 'token';\n }\n static clone(node: ChatInputTokenNode): ChatInputTokenNode {\n return new ChatInputTokenNode(node.__text, node.__componentProps, node.__key);\n }\n\n static importJSON(serializedNode: SerializedChatInputTokenNode): ChatInputTokenNode {\n return $createChatInputTokenNode(serializedNode.text, serializedNode.componentProps);\n }\n\n isIsolated() {\n return true;\n }\n isInline() {\n return true;\n }\n\n getTextContent(): string {\n return this.__text;\n }\n\n exportJSON(): SerializedChatInputTokenNode {\n return {\n ...super.exportJSON(),\n text: this.__text,\n componentProps: this.__componentProps,\n type: ChatInputTokenNode.getType(),\n version: 1,\n };\n }\n\n constructor(text: string, componentProps?: ChatInputTokenProps, key?: NodeKey) {\n super(key);\n this.__text = text;\n this.__componentProps = componentProps;\n }\n\n createDOM(): HTMLElement {\n // eslint-disable-next-line no-restricted-globals\n return document.createElement('span');\n }\n\n updateDOM() {\n return false;\n }\n\n decorate(_editor: LexicalEditor, config: EditorConfig): JSX.Element | null {\n if (this.__componentProps?.children) {\n return <ChatInputToken {...this.__componentProps} />;\n }\n return <ChatInputToken {...this.__componentProps}>{this.__text}</ChatInputToken>;\n }\n}\n\nexport function $createChatInputTokenNode(\n text: string,\n componentProps?: ChatInputTokenProps,\n key?: NodeKey,\n): ChatInputTokenNode {\n return new ChatInputTokenNode(text, componentProps, key);\n}\n\nexport function $isChatInputTokenNode(node: LexicalNode | null | undefined): node is ChatInputTokenNode {\n return node instanceof ChatInputTokenNode;\n}\n"],"names":["React","DecoratorNode","ChatInputToken","ChatInputTokenNode","getType","clone","node","__text","__componentProps","__key","importJSON","serializedNode","$createChatInputTokenNode","text","componentProps","isIsolated","isInline","getTextContent","exportJSON","type","version","createDOM","document","createElement","updateDOM","decorate","_editor","config","children","constructor","key","$isChatInputTokenNode"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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CAACL,gBAAgB,GAAGM;IAC1B;AAiBF;AAEA,OAAO,SAASF,0BACdC,IAAY,EACZC,cAAoC,EACpCgB,GAAa;IAEb,OAAO,IAAI3B,mBAAmBU,MAAMC,gBAAgBgB;AACtD;AAEA,OAAO,SAASC,sBAAsBzB,IAAoC;IACxE,OAAOA,gBAAgBH;AACzB"}
1
+ {"version":3,"sources":["ChatInputToken.node.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { DecoratorNode } from '@fluentui-copilot/text-editor';\nimport type {\n EditorConfig,\n LexicalEditor,\n LexicalNode,\n NodeKey,\n SerializedLexicalNode,\n Spread,\n} from '@fluentui-copilot/text-editor';\nimport type { ChatInputTokenProps } from './ChatInputToken.types';\nimport { ChatInputToken } from './ChatInputToken';\n\nexport type SerializedChatInputTokenNode = Spread<\n { text: string; componentProps?: ChatInputTokenProps },\n SerializedLexicalNode\n>;\n\nexport class ChatInputTokenNode extends DecoratorNode<JSX.Element | null> {\n __text: string;\n __componentProps?: ChatInputTokenProps;\n\n static getType(): string {\n return 'token';\n }\n static clone(node: ChatInputTokenNode): ChatInputTokenNode {\n return new ChatInputTokenNode(node.__text, node.__componentProps, node.__key);\n }\n\n static importJSON(serializedNode: SerializedChatInputTokenNode): ChatInputTokenNode {\n return $createChatInputTokenNode(serializedNode.text, serializedNode.componentProps);\n }\n\n isIsolated() {\n return true;\n }\n isInline() {\n return true;\n }\n\n getTextContent(): string {\n return this.__text;\n }\n\n exportJSON(): SerializedChatInputTokenNode {\n return {\n text: this.__text,\n componentProps: this.__componentProps,\n type: ChatInputTokenNode.getType(),\n version: 1,\n };\n }\n\n constructor(text: string, componentProps?: ChatInputTokenProps, key?: NodeKey) {\n super(key);\n this.__text = text;\n this.__componentProps = componentProps;\n }\n\n createDOM(): HTMLElement {\n // eslint-disable-next-line no-restricted-globals\n return document.createElement('span');\n }\n\n updateDOM() {\n return false;\n }\n\n decorate(_editor: LexicalEditor, config: EditorConfig): JSX.Element | null {\n if (this.__componentProps?.children) {\n return <ChatInputToken {...this.__componentProps} />;\n }\n return <ChatInputToken {...this.__componentProps}>{this.__text}</ChatInputToken>;\n }\n}\n\nexport function $createChatInputTokenNode(\n text: string,\n componentProps?: ChatInputTokenProps,\n key?: NodeKey,\n): ChatInputTokenNode {\n return new ChatInputTokenNode(text, componentProps, key);\n}\n\nexport function $isChatInputTokenNode(node: LexicalNode | null | undefined): node is ChatInputTokenNode {\n return node instanceof ChatInputTokenNode;\n}\n"],"names":["React","DecoratorNode","ChatInputToken","ChatInputTokenNode","getType","clone","node","__text","__componentProps","__key","importJSON","serializedNode","$createChatInputTokenNode","text","componentProps","isIsolated","isInline","getTextContent","exportJSON","type","version","createDOM","document","createElement","updateDOM","decorate","_editor","config","children","constructor","key","$isChatInputTokenNode"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";AAAA,YAAYA,WAAW,QAAQ;AAE/B,SAASC,aAAa,QAAQ,gCAAgC;AAU9D,SAASC,cAAc,QAAQ,mBAAmB;AAOlD,OAAO,MAAMC,2BAA2BF;IAItC,OAAOG,UAAkB;QACvB,OAAO;IACT;IACA,OAAOC,MAAMC,IAAwB,EAAsB;QACzD,OAAO,IAAIH,mBAAmBG,KAAKC,MAAM,EAAED,KAAKE,gBAAgB,EAAEF,KAAKG,KAAK;IAC9E;IAEA,OAAOC,WAAWC,cAA4C,EAAsB;QAClF,OAAOC,0BAA0BD,eAAeE,IAAI,EAAEF,eAAeG,cAAc;IACrF;IAEAC,aAAa;QACX,OAAO;IACT;IACAC,WAAW;QACT,OAAO;IACT;IAEAC,iBAAyB;QACvB,OAAO,IAAI,CAACV,MAAM;IACpB;IAEAW,aAA2C;QACzC,OAAO;YACLL,MAAM,IAAI,CAACN,MAAM;YACjBO,gBAAgB,IAAI,CAACN,gBAAgB;YACrCW,MAAMhB,mBAAmBC,OAAO;YAChCgB,SAAS;QACX;IACF;IAQAC,YAAyB;QACvB,iDAAiD;QACjD,OAAOC,SAASC,aAAa,CAAC;IAChC;IAEAC,YAAY;QACV,OAAO;IACT;IAEAC,SAASC,OAAsB,EAAEC,MAAoB,EAAsB;YACrE;QAAJ,KAAI,yBAAA,IAAI,CAACnB,gBAAgB,cAArB,6CAAA,uBAAuBoB,QAAQ,EAAE;YACnC,qBAAO,oBAAC1B,gBAAmB,IAAI,CAACM,gBAAgB;QAClD;QACA,qBAAO,oBAACN,gBAAmB,IAAI,CAACM,gBAAgB,EAAG,IAAI,CAACD,MAAM;IAChE;IApBAsB,YAAYhB,IAAY,EAAEC,cAAoC,EAAEgB,GAAa,CAAE;QAC7E,KAAK,CAACA;QAnCRvB,uBAAAA,UAAAA,KAAAA;QACAC,uBAAAA,oBAAAA,KAAAA;QAmCE,IAAI,CAACD,MAAM,GAAGM;QACd,IAAI,CAACL,gBAAgB,GAAGM;IAC1B;AAiBF;AAEA,OAAO,SAASF,0BACdC,IAAY,EACZC,cAAoC,EACpCgB,GAAa;IAEb,OAAO,IAAI3B,mBAAmBU,MAAMC,gBAAgBgB;AACtD;AAEA,OAAO,SAASC,sBAAsBzB,IAAoC;IACxE,OAAOA,gBAAgBH;AACzB"}
@@ -23,7 +23,6 @@ export class ChatInputEntityNode extends DecoratorNode {
23
23
  }
24
24
  exportJSON() {
25
25
  return {
26
- ...super.exportJSON(),
27
26
  pluginId: this.__pluginId,
28
27
  text: this.__text,
29
28
  data: this.__data,
@@ -1 +1 @@
1
- {"version":3,"sources":["ChatInputEntity.node.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { DecoratorNode } from '@fluentui-copilot/text-editor';\nimport type {\n EditorConfig,\n LexicalEditor,\n LexicalNode,\n NodeKey,\n SerializedLexicalNode,\n Spread,\n} from '@fluentui-copilot/text-editor';\nimport type { ChatInputEntityProps } from '../../ChatInputEntity';\nimport { ChatInputEntity } from '../../ChatInputEntity';\nimport type { ChatInputEntityData } from '@fluentui-copilot/chat-input-plugins';\n\nexport type SerializedChatInputEntityNode<T> = Spread<\n { pluginId: string; text: string; data?: T; entityProps?: ChatInputEntityProps },\n SerializedLexicalNode\n>;\n\nexport class ChatInputEntityNode<T> extends DecoratorNode<JSX.Element | null> {\n __pluginId: string;\n __text: string;\n __entityProps?: ChatInputEntityProps;\n __data?: T;\n\n static getType(): string {\n return 'entity';\n }\n static clone<T>(node: ChatInputEntityNode<T>): ChatInputEntityNode<T> {\n return new ChatInputEntityNode(node.__pluginId, node.__text, node.__data, node.__entityProps, node.__key);\n }\n\n static importJSON<T>(serializedNode: SerializedChatInputEntityNode<T>): ChatInputEntityNode<T> {\n return $createChatInputEntityNode(\n serializedNode.pluginId,\n serializedNode.text,\n serializedNode.data,\n serializedNode.entityProps,\n );\n }\n\n isIsolated() {\n return true;\n }\n isInline() {\n return true;\n }\n\n getTextContent(): string {\n return this.__text;\n }\n\n exportJSON(): SerializedChatInputEntityNode<T> {\n return {\n ...super.exportJSON(),\n pluginId: this.__pluginId,\n text: this.__text,\n data: this.__data,\n entityProps: this.__entityProps,\n type: ChatInputEntityNode.getType(),\n version: 1,\n };\n }\n\n constructor(pluginId: string, text: string, data?: T, entityProps?: ChatInputEntityProps, key?: NodeKey) {\n super(key);\n this.__pluginId = pluginId;\n this.__text = text;\n this.__data = data;\n this.__entityProps = entityProps;\n }\n\n createDOM(): HTMLElement {\n // eslint-disable-next-line no-restricted-globals\n return document.createElement('span');\n }\n\n updateDOM() {\n return false;\n }\n\n decorate(_editor: LexicalEditor, config: EditorConfig): JSX.Element | null {\n if (this.__entityProps?.children) {\n return <ChatInputEntity {...this.__entityProps} />;\n }\n return <ChatInputEntity {...this.__entityProps}>{this.__text}</ChatInputEntity>;\n }\n\n getEntityData(): ChatInputEntityData<T, ChatInputEntityProps> {\n return {\n text: this.__text,\n data: this.__data,\n entityProps: this.__entityProps,\n };\n }\n\n updateEntityData(data: ChatInputEntityData<T, ChatInputEntityProps>) {\n const writable = this.getWritable();\n writable.__text = data.text;\n writable.__data = data.data;\n writable.__entityProps = data.entityProps;\n }\n}\n\nexport function $createChatInputEntityNode<T>(\n pluginId: string,\n text: string,\n data?: T,\n entityProps?: ChatInputEntityProps,\n key?: NodeKey,\n): ChatInputEntityNode<T> {\n return new ChatInputEntityNode(pluginId, text, data, entityProps, key);\n}\n\nexport function $isChatInputEntityNode<T>(node: LexicalNode | null | undefined): node is ChatInputEntityNode<T> {\n return node instanceof ChatInputEntityNode;\n}\n"],"names":["React","DecoratorNode","ChatInputEntity","ChatInputEntityNode","getType","clone","node","__pluginId","__text","__data","__entityProps","__key","importJSON","serializedNode","$createChatInputEntityNode","pluginId","text","data","entityProps","isIsolated","isInline","getTextContent","exportJSON","type","version","createDOM","document","createElement","updateDOM","decorate","_editor","config","children","getEntityData","updateEntityData","writable","getWritable","constructor","key","$isChatInputEntityNode"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";AAAA,YAAYA,WAAW,QAAQ;AAE/B,SAASC,aAAa,QAAQ,gCAAgC;AAU9D,SAASC,eAAe,QAAQ,wBAAwB;AAQxD,OAAO,MAAMC,4BAA+BF;IAM1C,OAAOG,UAAkB;QACvB,OAAO;IACT;IACA,OAAOC,MAASC,IAA4B,EAA0B;QACpE,OAAO,IAAIH,oBAAoBG,KAAKC,UAAU,EAAED,KAAKE,MAAM,EAAEF,KAAKG,MAAM,EAAEH,KAAKI,aAAa,EAAEJ,KAAKK,KAAK;IAC1G;IAEA,OAAOC,WAAcC,cAAgD,EAA0B;QAC7F,OAAOC,2BACLD,eAAeE,QAAQ,EACvBF,eAAeG,IAAI,EACnBH,eAAeI,IAAI,EACnBJ,eAAeK,WAAW;IAE9B;IAEAC,aAAa;QACX,OAAO;IACT;IACAC,WAAW;QACT,OAAO;IACT;IAEAC,iBAAyB;QACvB,OAAO,IAAI,CAACb,MAAM;IACpB;IAEAc,aAA+C;QAC7C,OAAO;YACL,GAAG,KAAK,CAACA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Aa,GAAGQ;IACvB;AAgCF;AAEA,OAAO,SAASJ,2BACdC,QAAgB,EAChBC,IAAY,EACZC,IAAQ,EACRC,WAAkC,EAClCoB,GAAa;IAEb,OAAO,IAAInC,oBAAoBY,UAAUC,MAAMC,MAAMC,aAAaoB;AACpE;AAEA,OAAO,SAASC,uBAA0BjC,IAAoC;IAC5E,OAAOA,gBAAgBH;AACzB"}
1
+ {"version":3,"sources":["ChatInputEntity.node.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { DecoratorNode } from '@fluentui-copilot/text-editor';\nimport type {\n EditorConfig,\n LexicalEditor,\n LexicalNode,\n NodeKey,\n SerializedLexicalNode,\n Spread,\n} from '@fluentui-copilot/text-editor';\nimport type { ChatInputEntityProps } from '../../ChatInputEntity';\nimport { ChatInputEntity } from '../../ChatInputEntity';\nimport type { ChatInputEntityData } from '@fluentui-copilot/chat-input-plugins';\n\nexport type SerializedChatInputEntityNode<T> = Spread<\n { pluginId: string; text: string; data?: T; entityProps?: ChatInputEntityProps },\n SerializedLexicalNode\n>;\n\nexport class ChatInputEntityNode<T> extends DecoratorNode<JSX.Element | null> {\n __pluginId: string;\n __text: string;\n __entityProps?: ChatInputEntityProps;\n __data?: T;\n\n static getType(): string {\n return 'entity';\n }\n static clone<T>(node: ChatInputEntityNode<T>): ChatInputEntityNode<T> {\n return new ChatInputEntityNode(node.__pluginId, node.__text, node.__data, node.__entityProps, node.__key);\n }\n\n static importJSON<T>(serializedNode: SerializedChatInputEntityNode<T>): ChatInputEntityNode<T> {\n return $createChatInputEntityNode(\n serializedNode.pluginId,\n serializedNode.text,\n serializedNode.data,\n serializedNode.entityProps,\n );\n }\n\n isIsolated() {\n return true;\n }\n isInline() {\n return true;\n }\n\n getTextContent(): string {\n return this.__text;\n }\n\n exportJSON(): SerializedChatInputEntityNode<T> {\n return {\n pluginId: this.__pluginId,\n text: this.__text,\n data: this.__data,\n entityProps: this.__entityProps,\n type: ChatInputEntityNode.getType(),\n version: 1,\n };\n }\n\n constructor(pluginId: string, text: string, data?: T, entityProps?: ChatInputEntityProps, key?: NodeKey) {\n super(key);\n this.__pluginId = pluginId;\n this.__text = text;\n this.__data = data;\n this.__entityProps = entityProps;\n }\n\n createDOM(): HTMLElement {\n // eslint-disable-next-line no-restricted-globals\n return document.createElement('span');\n }\n\n updateDOM() {\n return false;\n }\n\n decorate(_editor: LexicalEditor, config: EditorConfig): JSX.Element | null {\n if (this.__entityProps?.children) {\n return <ChatInputEntity {...this.__entityProps} />;\n }\n return <ChatInputEntity {...this.__entityProps}>{this.__text}</ChatInputEntity>;\n }\n\n getEntityData(): ChatInputEntityData<T, ChatInputEntityProps> {\n return {\n text: this.__text,\n data: this.__data,\n entityProps: this.__entityProps,\n };\n }\n\n updateEntityData(data: ChatInputEntityData<T, ChatInputEntityProps>) {\n const writable = this.getWritable();\n writable.__text = data.text;\n writable.__data = data.data;\n writable.__entityProps = data.entityProps;\n }\n}\n\nexport function $createChatInputEntityNode<T>(\n pluginId: string,\n text: string,\n data?: T,\n entityProps?: ChatInputEntityProps,\n key?: NodeKey,\n): ChatInputEntityNode<T> {\n return new ChatInputEntityNode(pluginId, text, data, entityProps, key);\n}\n\nexport function $isChatInputEntityNode<T>(node: LexicalNode | null | undefined): node is ChatInputEntityNode<T> {\n return node instanceof ChatInputEntityNode;\n}\n"],"names":["React","DecoratorNode","ChatInputEntity","ChatInputEntityNode","getType","clone","node","__pluginId","__text","__data","__entityProps","__key","importJSON","serializedNode","$createChatInputEntityNode","pluginId","text","data","entityProps","isIsolated","isInline","getTextContent","exportJSON","type","version","createDOM","document","createElement","updateDOM","decorate","_editor","config","children","getEntityData","updateEntityData","writable","getWritable","constructor","key","$isChatInputEntityNode"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";AAAA,YAAYA,WAAW,QAAQ;AAE/B,SAASC,aAAa,QAAQ,gCAAgC;AAU9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AAkD,EAAE;QACnE,MAAMkB,WAAW,IAAI,CAACC,WAAW;QACjCD,SAAS3B,MAAM,GAAGS,KAAKD,IAAI;QAC3BmB,SAAS1B,MAAM,GAAGQ,KAAKA,IAAI;QAC3BkB,SAASzB,aAAa,GAAGO,KAAKC,WAAW;IAC3C;IArCAmB,YAAYtB,QAAgB,EAAEC,IAAY,EAAEC,IAAQ,EAAEC,WAAkC,EAAEoB,GAAa,CAAE;QACvG,KAAK,CAACA;QA5CR/B,uBAAAA,cAAAA,KAAAA;QACAC,uBAAAA,UAAAA,KAAAA;QACAE,uBAAAA,iBAAAA,KAAAA;QACAD,uBAAAA,UAAAA,KAAAA;QA0CE,IAAI,CAACF,UAAU,GAAGQ;QAClB,IAAI,CAACP,MAAM,GAAGQ;QACd,IAAI,CAACP,MAAM,GAAGQ;QACd,IAAI,CAACP,aAAa,GAAGQ;IACvB;AAgCF;AAEA,OAAO,SAASJ,2BACdC,QAAgB,EAChBC,IAAY,EACZC,IAAQ,EACRC,WAAkC,EAClCoB,GAAa;IAEb,OAAO,IAAInC,oBAAoBY,UAAUC,MAAMC,MAAMC,aAAaoB;AACpE;AAEA,OAAO,SAASC,uBAA0BjC,IAAoC;IAC5E,OAAOA,gBAAgBH;AACzB"}
@@ -7,17 +7,18 @@ export const ChatInputEntityPlugin = props => {
7
7
  id,
8
8
  controlRef,
9
9
  onChatInputEntityAdded,
10
- onChatInputEntityDeleted
10
+ onChatInputEntityDeleted,
11
+ skipInitialization
11
12
  } = props;
12
13
  const [editor] = useLexicalComposerContext();
13
14
  const chatInputEntityPluginBase = React.useRef(null);
14
15
  React.useEffect(() => {
15
- chatInputEntityPluginBase.current = new ChatInputEntityPluginBase(editor, id, ChatInputEntityNode, $createChatInputEntityNode, $isChatInputEntityNode, onChatInputEntityAdded, onChatInputEntityDeleted);
16
+ chatInputEntityPluginBase.current = new ChatInputEntityPluginBase(editor, id, ChatInputEntityNode, $createChatInputEntityNode, $isChatInputEntityNode, onChatInputEntityAdded, onChatInputEntityDeleted, skipInitialization);
16
17
  return () => {
17
18
  var _chatInputEntityPluginBase_current;
18
19
  return (_chatInputEntityPluginBase_current = chatInputEntityPluginBase.current) === null || _chatInputEntityPluginBase_current === void 0 ? void 0 : _chatInputEntityPluginBase_current.cleanup();
19
20
  };
20
- }, [editor, id, onChatInputEntityAdded, onChatInputEntityDeleted]);
21
+ }, [editor, id, onChatInputEntityAdded, onChatInputEntityDeleted, skipInitialization]);
21
22
  React.useImperativeHandle(controlRef, () => ({
22
23
  insertChatInputEntity(props) {
23
24
  var _chatInputEntityPluginBase_current;
@@ -1 +1 @@
1
- {"version":3,"sources":["ChatInputEntityPlugin.tsx"],"sourcesContent":["import { useLexicalComposerContext } from '@fluentui-copilot/react-text-editor';\nimport * as React from 'react';\nimport { $createChatInputEntityNode, $isChatInputEntityNode, ChatInputEntityNode } from './ChatInputEntity.node';\nimport type { ChatInputEntityPluginRef } from './ChatInputEntityPlugin.types';\nimport type { ChatInputEntityPluginProps } from '@fluentui-copilot/chat-input-plugins';\nimport { ChatInputEntityPluginBase } from '@fluentui-copilot/chat-input-plugins';\nimport type { ChatInputEntityProps } from '../../ChatInputEntity';\n\nexport const ChatInputEntityPlugin = <ExtraDataType,>(\n props: ChatInputEntityPluginProps<ExtraDataType, ChatInputEntityProps> & {\n controlRef: React.Ref<ChatInputEntityPluginRef<ExtraDataType>>;\n },\n) => {\n const { id, controlRef, onChatInputEntityAdded, onChatInputEntityDeleted } = props;\n const [editor] = useLexicalComposerContext();\n\n const chatInputEntityPluginBase = React.useRef<ChatInputEntityPluginBase<\n ExtraDataType,\n ChatInputEntityProps,\n ChatInputEntityNode<ExtraDataType>\n > | null>(null);\n\n React.useEffect(() => {\n chatInputEntityPluginBase.current = new ChatInputEntityPluginBase<\n ExtraDataType,\n ChatInputEntityProps,\n ChatInputEntityNode<ExtraDataType>\n >(\n editor,\n id,\n ChatInputEntityNode,\n $createChatInputEntityNode,\n $isChatInputEntityNode,\n onChatInputEntityAdded,\n onChatInputEntityDeleted,\n );\n\n return () => chatInputEntityPluginBase.current?.cleanup();\n }, [editor, id, onChatInputEntityAdded, onChatInputEntityDeleted]);\n\n React.useImperativeHandle(\n controlRef,\n () => ({\n insertChatInputEntity(props) {\n return chatInputEntityPluginBase.current?.insertChatInputEntity(props);\n },\n\n getActiveEntities() {\n return chatInputEntityPluginBase.current?.getActiveEntities() ?? [];\n },\n\n removeChatInputEntity(keyOrPredicate) {\n chatInputEntityPluginBase.current?.removeChatInputEntity(keyOrPredicate);\n },\n\n updateChatInputEntityProps(keyOrPredicate, props) {\n chatInputEntityPluginBase.current?.updateChatInputEntityProps(keyOrPredicate, props);\n },\n }),\n [],\n );\n return null;\n};\n"],"names":["useLexicalComposerContext","React","$createChatInputEntityNode","$isChatInputEntityNode","ChatInputEntityNode","ChatInputEntityPluginBase","ChatInputEntityPlugin","props","id","controlRef","onChatInputEntityAdded","onChatInputEntityDeleted","editor","chatInputEntityPluginBase","useRef","useEffect","current","cleanup","useImperativeHandle","insertChatInputEntity","getActiveEntities","removeChatInputEntity","keyOrPredicate","updateChatInputEntityProps"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,SAASA,yBAAyB,QAAQ,sCAAsC;AAChF,YAAYC,WAAW,QAAQ;AAC/B,SAASC,0BAA0B,EAAEC,sBAAsB,EAAEC,mBAAmB,QAAQ,yBAAyB;AAGjH,SAASC,yBAAyB,QAAQ,uCAAuC;AAGjF,OAAO,MAAMC,wBAAwB,CACnCC;IAIA,MAAM,EAAEC,EAAE,EAAEC,UAAU,EAAEC,sBAAsB,EAAEC,wBAAwB,EAAE,GAAGJ;IAC7E,MAAM,CAACK,OAAO,GAAGZ;IAEjB,MAAMa,4BAA4BZ,MAAMa,MAAM,CAIpC;IAEVb,MAAMc,SAAS,CAAC;QACdF,0BAA0BG,OAAO,GAAG,IAAIX,0BAKtCO,QACAJ,IACAJ,qBACAF,4BACAC,wBACAO,wBACAC;QAGF,OAAO;gBAAME;oBAAAA,qCAAAA,0BAA0BG,OAAO,cAAjCH,yDAAAA,mCAAmCI,OAAO;;IACzD,GAAG;QAACL;QAAQJ;QAAIE;QAAwBC;KAAyB;IAEjEV,MAAMiB,mBAAmB,CACvBT,YACA,IAAO,CAAA;YACLU,uBAAsBZ,KAAK;oBAClBM;gBAAP,QAAOA,qCAAAA,0BAA0BG,OAAO,cAAjCH,yDAAAA,mCAAmCM,qBAAqB,CAACZ;YAClE;YAEAa;oBACSP;oBAAAA;gBAAP,OAAOA,CAAAA,wDAAAA,qCAAAA,0BAA0BG,OAAO,cAAjCH,yDAAAA,mCAAmCO,iBAAiB,gBAApDP,kEAAAA,uDAA0D,EAAE;YACrE;YAEAQ,uBAAsBC,cAAc;oBAClCT;iBAAAA,qCAAAA,0BAA0BG,OAAO,cAAjCH,yDAAAA,mCAAmCQ,qBAAqB,CAACC;YAC3D;YAEAC,4BAA2BD,cAAc,EAAEf,KAAK;oBAC9CM;iBAAAA,qCAAAA,0BAA0BG,OAAO,cAAjCH,yDAAAA,mCAAmCU,0BAA0B,CAACD,gBAAgBf;YAChF;QACF,CAAA,GACA,EAAE;IAEJ,OAAO;AACT,EAAE"}
1
+ {"version":3,"sources":["ChatInputEntityPlugin.tsx"],"sourcesContent":["import { useLexicalComposerContext } from '@fluentui-copilot/react-text-editor';\nimport * as React from 'react';\nimport { $createChatInputEntityNode, $isChatInputEntityNode, ChatInputEntityNode } from './ChatInputEntity.node';\nimport type { ChatInputEntityPluginRef } from './ChatInputEntityPlugin.types';\nimport type { ChatInputEntityPluginProps } from '@fluentui-copilot/chat-input-plugins';\nimport { ChatInputEntityPluginBase } from '@fluentui-copilot/chat-input-plugins';\nimport type { ChatInputEntityProps } from '../../ChatInputEntity';\n\nexport const ChatInputEntityPlugin = <ExtraDataType,>(\n props: ChatInputEntityPluginProps<ExtraDataType, ChatInputEntityProps> & {\n controlRef: React.Ref<ChatInputEntityPluginRef<ExtraDataType>>;\n },\n) => {\n const { id, controlRef, onChatInputEntityAdded, onChatInputEntityDeleted, skipInitialization } = props;\n const [editor] = useLexicalComposerContext();\n\n const chatInputEntityPluginBase = React.useRef<ChatInputEntityPluginBase<\n ExtraDataType,\n ChatInputEntityProps,\n ChatInputEntityNode<ExtraDataType>\n > | null>(null);\n\n React.useEffect(() => {\n chatInputEntityPluginBase.current = new ChatInputEntityPluginBase<\n ExtraDataType,\n ChatInputEntityProps,\n ChatInputEntityNode<ExtraDataType>\n >(\n editor,\n id,\n ChatInputEntityNode,\n $createChatInputEntityNode,\n $isChatInputEntityNode,\n onChatInputEntityAdded,\n onChatInputEntityDeleted,\n skipInitialization,\n );\n\n return () => chatInputEntityPluginBase.current?.cleanup();\n }, [editor, id, onChatInputEntityAdded, onChatInputEntityDeleted, skipInitialization]);\n\n React.useImperativeHandle(\n controlRef,\n () => ({\n insertChatInputEntity(props) {\n return chatInputEntityPluginBase.current?.insertChatInputEntity(props);\n },\n\n getActiveEntities() {\n return chatInputEntityPluginBase.current?.getActiveEntities() ?? [];\n },\n\n removeChatInputEntity(keyOrPredicate) {\n chatInputEntityPluginBase.current?.removeChatInputEntity(keyOrPredicate);\n },\n\n updateChatInputEntityProps(keyOrPredicate, props) {\n chatInputEntityPluginBase.current?.updateChatInputEntityProps(keyOrPredicate, props);\n },\n }),\n [],\n );\n return null;\n};\n"],"names":["useLexicalComposerContext","React","$createChatInputEntityNode","$isChatInputEntityNode","ChatInputEntityNode","ChatInputEntityPluginBase","ChatInputEntityPlugin","props","id","controlRef","onChatInputEntityAdded","onChatInputEntityDeleted","skipInitialization","editor","chatInputEntityPluginBase","useRef","useEffect","current","cleanup","useImperativeHandle","insertChatInputEntity","getActiveEntities","removeChatInputEntity","keyOrPredicate","updateChatInputEntityProps"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,SAASA,yBAAyB,QAAQ,sCAAsC;AAChF,YAAYC,WAAW,QAAQ;AAC/B,SAAS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  }
16
16
  exportJSON() {
17
17
  return {
18
- ...super.exportJSON(),
19
18
  type: 'ghosttext',
20
19
  id: this.__id,
21
20
  content: this.__content,
@@ -1 +1 @@
1
- {"version":3,"sources":["GhostText.node.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { DecoratorNode } from '@fluentui-copilot/text-editor';\nimport type { EditorConfig, LexicalNode, NodeKey, SerializedLexicalNode, Spread } from '@fluentui-copilot/text-editor';\nimport type { GhostTextProps } from '../../components/GhostText/GhostText.types';\nimport { GhostText } from '../../components/GhostText/GhostText';\n\nexport type SerializedGhostTextNode = Spread<\n {\n content: string;\n id: string;\n componentProps?: GhostTextProps;\n exposeText?: boolean;\n },\n SerializedLexicalNode\n>;\n\nexport class GhostTextNode extends DecoratorNode<JSX.Element | null> {\n __content: string;\n __id: string;\n __allowCommitting?: boolean;\n __componentProps?: GhostTextProps;\n __exposeText?: boolean;\n\n static clone(node: GhostTextNode): GhostTextNode {\n return new GhostTextNode(node.__id, node.__content, node.__exposeText, node.__componentProps, node.__key);\n }\n\n static getType(): 'ghosttext' {\n return 'ghosttext';\n }\n\n static importJSON(serializedNode: SerializedGhostTextNode): GhostTextNode {\n const node = $createGhostTextNode(\n serializedNode.id,\n serializedNode.content,\n serializedNode.exposeText,\n serializedNode.componentProps,\n );\n return node;\n }\n\n exportJSON(): SerializedGhostTextNode {\n return {\n ...super.exportJSON(),\n type: 'ghosttext',\n id: this.__id,\n content: this.__content,\n componentProps: this.__componentProps,\n exposeText: this.__exposeText,\n version: 1,\n };\n }\n\n constructor(id: string, content: string, exposeText?: boolean, componentProps?: GhostTextProps, key?: NodeKey) {\n super(key);\n this.__id = id;\n this.__content = content;\n this.__exposeText = exposeText;\n this.__componentProps = componentProps;\n }\n\n isInline() {\n return true;\n }\n\n isIsolated() {\n return true;\n }\n\n getTextContent(): string {\n return this.__exposeText ? this.__content : '';\n }\n\n updateDOM(prevNode: unknown, dom: HTMLElement, config: EditorConfig): boolean {\n return false;\n }\n\n createDOM(config: EditorConfig): HTMLElement {\n // eslint-disable-next-line no-restricted-globals\n return document.createElement('span');\n }\n\n decorate(): JSX.Element | null {\n return (\n <GhostText nodeKey={this.getKey()} {...this.__componentProps}>\n {this.__content}\n </GhostText>\n );\n }\n}\n\nexport function $createGhostTextNode(\n id: string,\n content: string,\n exposeText?: boolean,\n componentProps?: GhostTextProps,\n): GhostTextNode {\n return new GhostTextNode(id, content, exposeText, componentProps);\n}\n\nexport function $isGhostTextNode(node: LexicalNode | null | undefined): node is GhostTextNode {\n return node instanceof GhostTextNode;\n}\n"],"names":["React","DecoratorNode","GhostText","GhostTextNode","clone","node","__id","__content","__exposeText","__componentProps","__key","getType","importJSON","serializedNode","$createGhostTextNode","id","content","exposeText","componentProps","exportJSON","type","version","isInline","isIsolated","getTextContent","updateDOM","prevNode","dom","config","createDOM","document","createElement","decorate","nodeKey","getKey","constructor","key","__allowCommitting","$isGhostTextNode"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";AAAA,YAAYA,WAAW,QAAQ;AAE/B,SAASC,aAAa,QAAQ,gCAAgC;AAG9D,SAASC,SAAS,QAAQ,uCAAuC;AAYjE,OAAO,MAAMC,sBAAsBF;IAOjC,OAAOG,MAAMC,IAAmB,EAAiB;QAC/C,OAAO,IAAIF,cAAcE,KAAKC,IAAI,EAAED,KAAKE,SAAS,EAAEF,KAAKG,YAAY,EAAEH,KAAKI,gBAAgB,EAAEJ,KAAKK,KAAK;IAC1G;IAEA,OAAOC,UAAuB;QAC5B,OAAO;IACT;IAEA,OAAOC,WAAWC,cAAuC,EAAiB;QACxE,MAAMR,OAAOS,qBACXD,eAAeE,EAAE,EACjBF,eAAeG,OAAO,EACtBH,eAAeI,UAAU,EACzBJ,eAAeK,cAAc;QAE/B,OAAOb;IACT;IAEAc,aAAsC;QACpC,OAAO;YACL,GAAG,KAAK,CAACA,YAAY;YACrBC,MAAM;YACNL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';\n\nimport { DecoratorNode } from '@fluentui-copilot/text-editor';\nimport type { EditorConfig, LexicalNode, NodeKey, SerializedLexicalNode, Spread } from '@fluentui-copilot/text-editor';\nimport type { GhostTextProps } from '../../components/GhostText/GhostText.types';\nimport { GhostText } from '../../components/GhostText/GhostText';\n\nexport type SerializedGhostTextNode = Spread<\n {\n content: string;\n id: string;\n componentProps?: GhostTextProps;\n exposeText?: boolean;\n },\n SerializedLexicalNode\n>;\n\nexport class GhostTextNode extends DecoratorNode<JSX.Element | null> {\n __content: string;\n __id: string;\n __allowCommitting?: boolean;\n __componentProps?: GhostTextProps;\n __exposeText?: boolean;\n\n static clone(node: GhostTextNode): GhostTextNode {\n return new GhostTextNode(node.__id, node.__content, node.__exposeText, node.__componentProps, node.__key);\n }\n\n static getType(): 'ghosttext' {\n return 'ghosttext';\n }\n\n static importJSON(serializedNode: SerializedGhostTextNode): GhostTextNode {\n const node = $createGhostTextNode(\n serializedNode.id,\n serializedNode.content,\n serializedNode.exposeText,\n serializedNode.componentProps,\n );\n return node;\n }\n\n exportJSON(): SerializedGhostTextNode {\n return {\n type: 'ghosttext',\n id: this.__id,\n content: this.__content,\n componentProps: this.__componentProps,\n exposeText: this.__exposeText,\n version: 1,\n };\n }\n\n constructor(id: string, content: string, exposeText?: boolean, componentProps?: GhostTextProps, key?: NodeKey) {\n super(key);\n this.__id = id;\n this.__content = content;\n this.__exposeText = exposeText;\n this.__componentProps = componentProps;\n }\n\n isInline() {\n return true;\n }\n\n isIsolated() {\n return true;\n }\n\n getTextContent(): string {\n return this.__exposeText ? this.__content : '';\n }\n\n updateDOM(prevNode: unknown, dom: HTMLElement, config: EditorConfig): boolean {\n return false;\n }\n\n createDOM(config: EditorConfig): HTMLElement {\n // eslint-disable-next-line no-restricted-globals\n return document.createElement('span');\n }\n\n decorate(): JSX.Element | null {\n return (\n <GhostText nodeKey={this.getKey()} {...this.__componentProps}>\n {this.__content}\n </GhostText>\n );\n }\n}\n\nexport function $createGhostTextNode(\n id: string,\n content: string,\n exposeText?: boolean,\n componentProps?: GhostTextProps,\n): GhostTextNode {\n return new GhostTextNode(id, content, exposeText, componentProps);\n}\n\nexport function $isGhostTextNode(node: LexicalNode | null | undefined): node is GhostTextNode {\n return node instanceof GhostTextNode;\n}\n"],"names":["React","DecoratorNode","GhostText","GhostTextNode","clone","node","__id","__content","__exposeText","__componentProps","__key","getType","importJSON","serializedNode","$createGhostTextNode","id","content","exposeText","componentProps","exportJSON","type","version","isInline","isIsolated","getTextContent","updateDOM","prevNode","dom","config","createDOM","document","createElement","decorate","nodeKey","getKey","constructor","key","__allowCommitting","$isGhostTextNode"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";AAAA,YAAYA,WAAW,QAAQ;AAE/B,SAASC,aAAa,QAAQ,gCAAgC;AAG9D,SAASC,SAAS,QAAQ,uCAAuC;AAYjE,OAAO,MAAMC,sBAAsBF;IAOjC,OAAOG,MAAMC,IAAmB,EAAiB;QAC/C,OAAO,IAAIF,cAAcE,KAAKC,IAAI,EAAED,KAAKE,SAAS,EAAEF,KAAKG,YAAY,EAAEH,KAAKI,gBAAgB,EAAEJ,KAAKK,KAAK;IAC1G;IAEA,OAAOC,UAAuB;QAC5B,OAAO;IACT;IAEA,OAAOC,WAAWC,cAAuC,EAAiB;QACxE,MAAMR,OAAOS,qBACXD,eAAeE,EAAE,EACjBF,eAAeG,OAAO,EACtBH,eAAeI,UAAU,EACzBJ,eAAeK,cAAc;QAE/B,OAAOb;IACT;IAEAc,aAAsC;QACpC,OAAO;YACLC,MAAM;YACNL,IAAI,IAAI,CAACT,IAAI;YACbU,SAAS,IAAI,CAACT,SAAS;YACvBW,gBAAgB,IAAI,CAACT,gBAAgB;YACrCQ,YAAY,IAAI,CAACT,YAAY;YAC7Ba,SAAS;QACX;IACF;IAUAC,WAAW;QACT,OAAO;IACT;IAEAC,aAAa;QACX,OAAO;IACT;IAEAC,iBAAyB;QACvB,OAAO,IAAI,CAAChB,YAAY,GAAG,IAAI,CAACD,SAAS,GAAG;IAC9C;IAEAkB,UAAUC,QAAiB,EAAEC,GAAgB,EAAEC,MAAoB,EAAW;QAC5E,OAAO;IACT;IAEAC,UAAUD,MAAoB,EAAe;QAC3C,iDAAiD;QACjD,OAAOE,SAASC,aAAa,CAAC;IAChC;IAEAC,WAA+B;QAC7B,qBACE,oBAAC9B;YAAU+B,SAAS,IAAI,CAACC,MAAM;YAAK,GAAG,IAAI,CAACzB,gBAAgB;WACzD,IAAI,CAACF,SAAS;IAGrB;IAnCA4B,YAAYpB,EAAU,EAAEC,OAAe,EAAEC,UAAoB,EAAEC,cAA+B,EAAEkB,GAAa,CAAE;QAC7G,KAAK,CAACA;QApCR7B,uBAAAA,aAAAA,KAAAA;QACAD,uBAAAA,QAAAA,KAAAA;QACA+B,uBAAAA,qBAAAA,KAAAA;QACA5B,uBAAAA,oBAAAA,KAAAA;QACAD,uBAAAA,gBAAAA,KAAAA;QAiCE,IAAI,CAACF,IAAI,GAAGS;QACZ,IAAI,CAACR,SAAS,GAAGS;QACjB,IAAI,CAACR,YAAY,GAAGS;QACpB,IAAI,CAACR,gBAAgB,GAAGS;IAC1B;AA8BF;AAEA,OAAO,SAASJ,qBACdC,EAAU,EACVC,OAAe,EACfC,UAAoB,EACpBC,cAA+B;IAE/B,OAAO,IAAIf,cAAcY,IAAIC,SAASC,YAAYC;AACpD;AAEA,OAAO,SAASoB,iBAAiBjC,IAAoC;IACnE,OAAOA,gBAAgBF;AACzB"}
@@ -45,7 +45,6 @@ class ChatInputTokenNode extends _texteditor.DecoratorNode {
45
45
  }
46
46
  exportJSON() {
47
47
  return {
48
- ...super.exportJSON(),
49
48
  text: this.__text,
50
49
  componentProps: this.__componentProps,
51
50
  type: ChatInputTokenNode.getType(),
@@ -1 +1 @@
1
- {"version":3,"sources":["ChatInputToken.node.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { DecoratorNode } from '@fluentui-copilot/text-editor';\nimport type {\n EditorConfig,\n LexicalEditor,\n LexicalNode,\n NodeKey,\n SerializedLexicalNode,\n Spread,\n} from '@fluentui-copilot/text-editor';\nimport type { ChatInputTokenProps } from './ChatInputToken.types';\nimport { ChatInputToken } from './ChatInputToken';\n\nexport type SerializedChatInputTokenNode = Spread<\n { text: string; componentProps?: ChatInputTokenProps },\n SerializedLexicalNode\n>;\n\nexport class ChatInputTokenNode extends DecoratorNode<JSX.Element | null> {\n __text: string;\n __componentProps?: ChatInputTokenProps;\n\n static getType(): string {\n return 'token';\n }\n static clone(node: ChatInputTokenNode): ChatInputTokenNode {\n return new ChatInputTokenNode(node.__text, node.__componentProps, node.__key);\n }\n\n static importJSON(serializedNode: SerializedChatInputTokenNode): ChatInputTokenNode {\n return $createChatInputTokenNode(serializedNode.text, serializedNode.componentProps);\n }\n\n isIsolated() {\n return true;\n }\n isInline() {\n return true;\n }\n\n getTextContent(): string {\n return this.__text;\n }\n\n exportJSON(): SerializedChatInputTokenNode {\n return {\n ...super.exportJSON(),\n text: this.__text,\n componentProps: this.__componentProps,\n type: ChatInputTokenNode.getType(),\n version: 1,\n };\n }\n\n constructor(text: string, componentProps?: ChatInputTokenProps, key?: NodeKey) {\n super(key);\n this.__text = text;\n this.__componentProps = componentProps;\n }\n\n createDOM(): HTMLElement {\n // eslint-disable-next-line no-restricted-globals\n return document.createElement('span');\n }\n\n updateDOM() {\n return false;\n }\n\n decorate(_editor: LexicalEditor, config: EditorConfig): JSX.Element | null {\n if (this.__componentProps?.children) {\n return <ChatInputToken {...this.__componentProps} />;\n }\n return <ChatInputToken {...this.__componentProps}>{this.__text}</ChatInputToken>;\n }\n}\n\nexport function $createChatInputTokenNode(\n text: string,\n componentProps?: ChatInputTokenProps,\n key?: NodeKey,\n): ChatInputTokenNode {\n return new ChatInputTokenNode(text, componentProps, key);\n}\n\nexport function $isChatInputTokenNode(node: LexicalNode | null | undefined): node is ChatInputTokenNode {\n return node instanceof ChatInputTokenNode;\n}\n"],"names":["$createChatInputTokenNode","$isChatInputTokenNode","ChatInputTokenNode","DecoratorNode","getType","clone","node","__text","__componentProps","__key","importJSON","serializedNode","text","componentProps","isIsolated","isInline","getTextContent","exportJSON","type","version","createDOM","document","createElement","updateDOM","decorate","_editor","config","_this___componentProps","children","React","ChatInputToken","constructor","key"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IA8EgBA,yBAAAA;eAAAA;;IAQAC,qBAAAA;eAAAA;;IAnEHC,kBAAAA;eAAAA;;;;;iEAnBU;4BAEO;gCAUC;AAOxB,MAAMA,2BAA2BC,yBAAAA;WAItCC,UAAOA;eACL;;WAEFC,MAAOA,IAAMC,EAAwB;eACnC,IAAOJ,mBAAIA,KAAmBI,MAAKC,EAAAA,KAAQD,gBAAKE,EAAAA,KAAkBF,KAAKG;;WAGzEC,WAAOA,cAAWC,EAA4C;eAC5DX,0BAAOA,eAA0BW,IAAeC,EAAAA,eAAMD,cAAeE;;iBAGvEC;eACE;;eAEFC;eACE;;qBAGFC;eACE,IAAO,CAAAT,MAAKA;;iBAGdU;eACE;oBACE,CAAGA,YAAMA;kBACTL,IAAAA,CAAAA,MAAWL;4BACXM,IAAAA,CAAAA,gBAAqBL;kBACrBU,mBAAMhB,OAAmBE;qBACzBe;;;gBAUJC;yDACE;eACAC,SAAOA,aAASC,CAAAA;;gBAGlBC;eACE;;aAGFC,OAASC,EAAsBC,MAAEA,EAAoB;;YACnD,AAAAC,CAAAA,yBAAI,IAAA,CAAAnB,gBAAKA,MAAgB,QAAAmB,2BAArB,KAAA,IAAA,KAAA,IAAAA,uBAAAC,QAAuBA,EAAAA;mBACzB,WAAA,GAAAC,OAAAP,aAAO,CAAAQ,8BAACA,EAAAA,IAAAA,CAAAA,gBAAwBtB;;eAElC,WAAA,GAAAqB,OAAOP,aAAA,CAAAQ,8BAACA,EAAAA,IAAAA,CAAmBtB,gBAAKA,EAAAA,IAAgB,CAAGD,MAAKA;;gBAnB1DwB,IAAYnB,EAAYC,cAAEA,EAAoCmB,GAAEA,CAAa;aAC3E,CAAAA;8BApCFzB,EAAAA,IAAAA,EAAAA,UAAAA,KAAAA;8BACAC,EAAAA,IAAAA,EAAAA,oBAAAA,KAAAA;YAoCE,CAAAD,MAAKA,GAAAA;YACL,CAAAC,gBAAKA,GAAAA;;AAkBT;AAEO,SAASR,0BACdY,IAAY,EACZC,cAAoC,EACpCmB,GAAa;WAEb,IAAO9B,mBAAIA,MAAmBU,gBAAMC;AACtC;AAEO,SAASZ,sBAAsBK,IAAoC;WACxEA,gBAAOA;AACT"}
1
+ {"version":3,"sources":["ChatInputToken.node.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { DecoratorNode } from '@fluentui-copilot/text-editor';\nimport type {\n EditorConfig,\n LexicalEditor,\n LexicalNode,\n NodeKey,\n SerializedLexicalNode,\n Spread,\n} from '@fluentui-copilot/text-editor';\nimport type { ChatInputTokenProps } from './ChatInputToken.types';\nimport { ChatInputToken } from './ChatInputToken';\n\nexport type SerializedChatInputTokenNode = Spread<\n { text: string; componentProps?: ChatInputTokenProps },\n SerializedLexicalNode\n>;\n\nexport class ChatInputTokenNode extends DecoratorNode<JSX.Element | null> {\n __text: string;\n __componentProps?: ChatInputTokenProps;\n\n static getType(): string {\n return 'token';\n }\n static clone(node: ChatInputTokenNode): ChatInputTokenNode {\n return new ChatInputTokenNode(node.__text, node.__componentProps, node.__key);\n }\n\n static importJSON(serializedNode: SerializedChatInputTokenNode): ChatInputTokenNode {\n return $createChatInputTokenNode(serializedNode.text, serializedNode.componentProps);\n }\n\n isIsolated() {\n return true;\n }\n isInline() {\n return true;\n }\n\n getTextContent(): string {\n return this.__text;\n }\n\n exportJSON(): SerializedChatInputTokenNode {\n return {\n text: this.__text,\n componentProps: this.__componentProps,\n type: ChatInputTokenNode.getType(),\n version: 1,\n };\n }\n\n constructor(text: string, componentProps?: ChatInputTokenProps, key?: NodeKey) {\n super(key);\n this.__text = text;\n this.__componentProps = componentProps;\n }\n\n createDOM(): HTMLElement {\n // eslint-disable-next-line no-restricted-globals\n return document.createElement('span');\n }\n\n updateDOM() {\n return false;\n }\n\n decorate(_editor: LexicalEditor, config: EditorConfig): JSX.Element | null {\n if (this.__componentProps?.children) {\n return <ChatInputToken {...this.__componentProps} />;\n }\n return <ChatInputToken {...this.__componentProps}>{this.__text}</ChatInputToken>;\n }\n}\n\nexport function $createChatInputTokenNode(\n text: string,\n componentProps?: ChatInputTokenProps,\n key?: NodeKey,\n): ChatInputTokenNode {\n return new ChatInputTokenNode(text, componentProps, key);\n}\n\nexport function $isChatInputTokenNode(node: LexicalNode | null | undefined): node is ChatInputTokenNode {\n return node instanceof ChatInputTokenNode;\n}\n"],"names":["$createChatInputTokenNode","$isChatInputTokenNode","ChatInputTokenNode","DecoratorNode","getType","clone","node","__text","__componentProps","__key","importJSON","serializedNode","text","componentProps","isIsolated","isInline","getTextContent","exportJSON","type","version","createDOM","document","createElement","updateDOM","decorate","_editor","config","_this___componentProps","children","React","ChatInputToken","constructor","key"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IA6EgBA,yBAAAA;eAAAA;;IAQAC,qBAAAA;eAAAA;;IAlEHC,kBAAAA;eAAAA;;;;;iEAnBU;4BAEO;gCAUC;AAOxB,MAAMA,2BAA2BC,yBAAAA;WAItCC,UAAOA;eACL;;WAEFC,MAAOA,IAAMC,EAAwB;eACnC,IAAOJ,mBAAIA,KAAmBI,MAAKC,EAAAA,KAAQD,gBAAKE,EAAAA,KAAkBF,KAAKG;;WAGzEC,WAAOA,cAAWC,EAA4C;eAC5DX,0BAAOA,eAA0BW,IAAeC,EAAAA,eAAMD,cAAeE;;iBAGvEC;eACE;;eAEFC;eACE;;qBAGFC;eACE,IAAO,CAAAT,MAAKA;;iBAGdU;eACE;kBACEL,IAAAA,CAAAA,MAAWL;4BACXM,IAAAA,CAAAA,gBAAqBL;kBACrBU,mBAAMhB,OAAmBE;qBACzBe;;;gBAUJC;yDACE;eACAC,SAAOA,aAASC,CAAAA;;gBAGlBC;eACE;;aAGFC,OAASC,EAAsBC,MAAEA,EAAoB;;YACnD,AAAAC,CAAAA,yBAAI,IAAA,CAAAnB,gBAAKA,MAAgB,QAAAmB,2BAArB,KAAA,IAAA,KAAA,IAAAA,uBAAAC,QAAuBA,EAAAA;mBACzB,WAAA,GAAAC,OAAAP,aAAO,CAAAQ,8BAACA,EAAAA,IAAAA,CAAAA,gBAAwBtB;;eAElC,WAAA,GAAAqB,OAAOP,aAAA,CAAAQ,8BAACA,EAAAA,IAAAA,CAAmBtB,gBAAKA,EAAAA,IAAgB,CAAGD,MAAKA;;gBAnB1DwB,IAAYnB,EAAYC,cAAEA,EAAoCmB,GAAEA,CAAa;aAC3E,CAAAA;8BAnCFzB,EAAAA,IAAAA,EAAAA,UAAAA,KAAAA;8BACAC,EAAAA,IAAAA,EAAAA,oBAAAA,KAAAA;YAmCE,CAAAD,MAAKA,GAAAA;YACL,CAAAC,gBAAKA,GAAAA;;AAkBT;AAEO,SAASR,0BACdY,IAAY,EACZC,cAAoC,EACpCmB,GAAa;WAEb,IAAO9B,mBAAIA,MAAmBU,gBAAMC;AACtC;AAEO,SAASZ,sBAAsBK,IAAoC;WACxEA,gBAAOA;AACT"}
@@ -45,7 +45,6 @@ class ChatInputEntityNode extends _texteditor.DecoratorNode {
45
45
  }
46
46
  exportJSON() {
47
47
  return {
48
- ...super.exportJSON(),
49
48
  pluginId: this.__pluginId,
50
49
  text: this.__text,
51
50
  data: this.__data,
@@ -1 +1 @@
1
- {"version":3,"sources":["ChatInputEntity.node.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { DecoratorNode } from '@fluentui-copilot/text-editor';\nimport type {\n EditorConfig,\n LexicalEditor,\n LexicalNode,\n NodeKey,\n SerializedLexicalNode,\n Spread,\n} from '@fluentui-copilot/text-editor';\nimport type { ChatInputEntityProps } from '../../ChatInputEntity';\nimport { ChatInputEntity } from '../../ChatInputEntity';\nimport type { ChatInputEntityData } from '@fluentui-copilot/chat-input-plugins';\n\nexport type SerializedChatInputEntityNode<T> = Spread<\n { pluginId: string; text: string; data?: T; entityProps?: ChatInputEntityProps },\n SerializedLexicalNode\n>;\n\nexport class ChatInputEntityNode<T> extends DecoratorNode<JSX.Element | null> {\n __pluginId: string;\n __text: string;\n __entityProps?: ChatInputEntityProps;\n __data?: T;\n\n static getType(): string {\n return 'entity';\n }\n static clone<T>(node: ChatInputEntityNode<T>): ChatInputEntityNode<T> {\n return new ChatInputEntityNode(node.__pluginId, node.__text, node.__data, node.__entityProps, node.__key);\n }\n\n static importJSON<T>(serializedNode: SerializedChatInputEntityNode<T>): ChatInputEntityNode<T> {\n return $createChatInputEntityNode(\n serializedNode.pluginId,\n serializedNode.text,\n serializedNode.data,\n serializedNode.entityProps,\n );\n }\n\n isIsolated() {\n return true;\n }\n isInline() {\n return true;\n }\n\n getTextContent(): string {\n return this.__text;\n }\n\n exportJSON(): SerializedChatInputEntityNode<T> {\n return {\n ...super.exportJSON(),\n pluginId: this.__pluginId,\n text: this.__text,\n data: this.__data,\n entityProps: this.__entityProps,\n type: ChatInputEntityNode.getType(),\n version: 1,\n };\n }\n\n constructor(pluginId: string, text: string, data?: T, entityProps?: ChatInputEntityProps, key?: NodeKey) {\n super(key);\n this.__pluginId = pluginId;\n this.__text = text;\n this.__data = data;\n this.__entityProps = entityProps;\n }\n\n createDOM(): HTMLElement {\n // eslint-disable-next-line no-restricted-globals\n return document.createElement('span');\n }\n\n updateDOM() {\n return false;\n }\n\n decorate(_editor: LexicalEditor, config: EditorConfig): JSX.Element | null {\n if (this.__entityProps?.children) {\n return <ChatInputEntity {...this.__entityProps} />;\n }\n return <ChatInputEntity {...this.__entityProps}>{this.__text}</ChatInputEntity>;\n }\n\n getEntityData(): ChatInputEntityData<T, ChatInputEntityProps> {\n return {\n text: this.__text,\n data: this.__data,\n entityProps: this.__entityProps,\n };\n }\n\n updateEntityData(data: ChatInputEntityData<T, ChatInputEntityProps>) {\n const writable = this.getWritable();\n writable.__text = data.text;\n writable.__data = data.data;\n writable.__entityProps = data.entityProps;\n }\n}\n\nexport function $createChatInputEntityNode<T>(\n pluginId: string,\n text: string,\n data?: T,\n entityProps?: ChatInputEntityProps,\n key?: NodeKey,\n): ChatInputEntityNode<T> {\n return new ChatInputEntityNode(pluginId, text, data, entityProps, key);\n}\n\nexport function $isChatInputEntityNode<T>(node: LexicalNode | null | undefined): node is ChatInputEntityNode<T> {\n return node instanceof ChatInputEntityNode;\n}\n"],"names":["$createChatInputEntityNode","$isChatInputEntityNode","ChatInputEntityNode","DecoratorNode","getType","clone","node","__pluginId","__text","__data","__entityProps","__key","importJSON","serializedNode","pluginId","text","data","entityProps","isIsolated","isInline","getTextContent","exportJSON","type","version","createDOM","document","createElement","updateDOM","decorate","_editor","config","_this___entityProps","children","React","ChatInputEntity","getEntityData","updateEntityData","writable","getWritable","constructor","key"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAyGgBA,0BAAAA;eAAAA;;IAUAC,sBAAAA;eAAAA;;IA/FHC,mBAAAA;eAAAA;;;;;iEApBU;4BAEO;iCAUE;AAQzB,MAAMA,4BAA+BC,yBAAAA;WAM1CC,UAAOA;eACL;;WAEFC,MAAOA,IAASC,EAA4B;eAC1C,IAAOJ,oBAAIA,KAAoBI,UAAKC,EAAAA,KAAYD,MAAKE,EAAAA,KAAQF,MAAKG,EAAAA,KAAQH,aAAKI,EAAAA,KAAeJ,KAAKK;;WAGrGC,WAAOA,cAAcC,EAAgD;eACnEb,2BAAOA,eACLa,QAAeC,EAA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iBAAAA,KAAAA;8BACAD,EAAAA,IAAAA,EAAAA,UAAAA,KAAAA;YA2CE,CAAAF,UAAKA,GAAAA;YACL,CAAAC,MAAKA,GAAAA;YACL,CAAAC,MAAKA,GAAAA;YACL,CAAAC,aAAKA,GAAAA;;AAiCT;AAEO,SAASV,2BACdc,QAAgB,EAChBC,IAAY,EACZC,IAAQ,EACRC,WAAkC,EAClCuB,GAAa;WAEb,IAAOtC,oBAAIA,UAAoBY,MAAUC,MAAMC,aAAMC;AACvD;AAEO,SAAShB,uBAA0BK,IAAoC;WAC5EA,gBAAOA;AACT"}
1
+ {"version":3,"sources":["ChatInputEntity.node.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { DecoratorNode } from '@fluentui-copilot/text-editor';\nimport type {\n EditorConfig,\n LexicalEditor,\n LexicalNode,\n NodeKey,\n SerializedLexicalNode,\n Spread,\n} from '@fluentui-copilot/text-editor';\nimport type { ChatInputEntityProps } from '../../ChatInputEntity';\nimport { ChatInputEntity } from '../../ChatInputEntity';\nimport type { ChatInputEntityData } from '@fluentui-copilot/chat-input-plugins';\n\nexport type SerializedChatInputEntityNode<T> = Spread<\n { pluginId: string; text: string; data?: T; entityProps?: ChatInputEntityProps },\n SerializedLexicalNode\n>;\n\nexport class ChatInputEntityNode<T> extends DecoratorNode<JSX.Element | null> {\n __pluginId: string;\n __text: string;\n __entityProps?: ChatInputEntityProps;\n __data?: T;\n\n static getType(): string {\n return 'entity';\n }\n static clone<T>(node: ChatInputEntityNode<T>): ChatInputEntityNode<T> {\n return new ChatInputEntityNode(node.__pluginId, node.__text, node.__data, node.__entityProps, node.__key);\n }\n\n static importJSON<T>(serializedNode: SerializedChatInputEntityNode<T>): ChatInputEntityNode<T> {\n return $createChatInputEntityNode(\n serializedNode.pluginId,\n serializedNode.text,\n serializedNode.data,\n serializedNode.entityProps,\n );\n }\n\n isIsolated() {\n return true;\n }\n isInline() {\n return true;\n }\n\n getTextContent(): string {\n return this.__text;\n }\n\n exportJSON(): SerializedChatInputEntityNode<T> {\n return {\n pluginId: this.__pluginId,\n text: this.__text,\n data: this.__data,\n entityProps: this.__entityProps,\n type: ChatInputEntityNode.getType(),\n version: 1,\n };\n }\n\n constructor(pluginId: string, text: string, data?: T, entityProps?: ChatInputEntityProps, key?: NodeKey) {\n super(key);\n this.__pluginId = pluginId;\n this.__text = text;\n this.__data = data;\n this.__entityProps = entityProps;\n }\n\n createDOM(): HTMLElement {\n // eslint-disable-next-line no-restricted-globals\n return document.createElement('span');\n }\n\n updateDOM() {\n return false;\n }\n\n decorate(_editor: LexicalEditor, config: EditorConfig): JSX.Element | null {\n if (this.__entityProps?.children) {\n return <ChatInputEntity {...this.__entityProps} />;\n }\n return <ChatInputEntity {...this.__entityProps}>{this.__text}</ChatInputEntity>;\n }\n\n getEntityData(): ChatInputEntityData<T, ChatInputEntityProps> {\n return {\n text: this.__text,\n data: this.__data,\n entityProps: this.__entityProps,\n };\n }\n\n updateEntityData(data: ChatInputEntityData<T, ChatInputEntityProps>) {\n const writable = this.getWritable();\n writable.__text = data.text;\n writable.__data = data.data;\n writable.__entityProps = data.entityProps;\n }\n}\n\nexport function $createChatInputEntityNode<T>(\n pluginId: string,\n text: string,\n data?: T,\n entityProps?: ChatInputEntityProps,\n key?: NodeKey,\n): ChatInputEntityNode<T> {\n return new ChatInputEntityNode(pluginId, text, data, entityProps, key);\n}\n\nexport function $isChatInputEntityNode<T>(node: LexicalNode | null | undefined): node is ChatInputEntityNode<T> {\n return node instanceof ChatInputEntityNode;\n}\n"],"names":["$createChatInputEntityNode","$isChatInputEntityNode","ChatInputEntityNode","DecoratorNode","getType","clone","node","__pluginId","__text","__data","__entityProps","__key","importJSON","serializedNode","pluginId","text","data","entityProps","isIsolated","isInline","getTextContent","exportJSON","type","version","createDOM","document","createElement","updateDOM","decorate","_editor","config","_this___entityProps","children","React","ChatInputEntity","getEntityData","updateEntityData","writable","getWritable","constructor","key"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;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Q,IAAAA,CAAAA,MAAWP;yBACXQ,IAAAA,CAAAA,aAAkBP;;;qBAItB0B,IAAiBpB,EAAkD;cACjEqB,WAAMA,IAAW,CAAAC,WAAKA;iBACtBD,MAAS7B,GAAAA,KAASQ,IAAKD;iBACvBsB,MAAS5B,GAAAA,KAASO,IAAKA;iBACvBqB,aAAS3B,GAAAA,KAAgBM,WAAKC;;gBApChCsB,QAAYzB,EAAgBC,IAAEA,EAAYC,IAAEA,EAAQC,WAAEA,EAAkCuB,GAAEA,CAAa;aACrG,CAAAA;8BA5CFjC,EAAAA,IAAAA,EAAAA,cAAAA,KAAAA;8BACAC,EAAAA,IAAAA,EAAAA,UAAAA,KAAAA;8BACAE,EAAAA,IAAAA,EAAAA,iBAAAA,KAAAA;8BACAD,EAAAA,IAAAA,EAAAA,UAAAA,KAAAA;YA0CE,CAAAF,UAAKA,GAAAA;YACL,CAAAC,MAAKA,GAAAA;YACL,CAAAC,MAAKA,GAAAA;YACL,CAAAC,aAAKA,GAAAA;;AAiCT;AAEO,SAASV,2BACdc,QAAgB,EAChBC,IAAY,EACZC,IAAQ,EACRC,WAAkC,EAClCuB,GAAa;WAEb,IAAOtC,oBAAIA,UAAoBY,MAAUC,MAAMC,aAAMC;AACvD;AAEO,SAAShB,uBAA0BK,IAAoC;WAC5EA,gBAAOA;AACT"}
@@ -14,11 +14,11 @@ const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
14
14
  const _ChatInputEntitynode = require("./ChatInputEntity.node");
15
15
  const _chatinputplugins = require("@fluentui-copilot/chat-input-plugins");
16
16
  const ChatInputEntityPlugin = (props)=>{
17
- const { id, controlRef, onChatInputEntityAdded, onChatInputEntityDeleted } = props;
17
+ const { id, controlRef, onChatInputEntityAdded, onChatInputEntityDeleted, skipInitialization } = props;
18
18
  const [editor] = (0, _reacttexteditor.useLexicalComposerContext)();
19
19
  const chatInputEntityPluginBase = _react.useRef(null);
20
20
  _react.useEffect(()=>{
21
- chatInputEntityPluginBase.current = new _chatinputplugins.ChatInputEntityPluginBase(editor, id, _ChatInputEntitynode.ChatInputEntityNode, _ChatInputEntitynode.$createChatInputEntityNode, _ChatInputEntitynode.$isChatInputEntityNode, onChatInputEntityAdded, onChatInputEntityDeleted);
21
+ chatInputEntityPluginBase.current = new _chatinputplugins.ChatInputEntityPluginBase(editor, id, _ChatInputEntitynode.ChatInputEntityNode, _ChatInputEntitynode.$createChatInputEntityNode, _ChatInputEntitynode.$isChatInputEntityNode, onChatInputEntityAdded, onChatInputEntityDeleted, skipInitialization);
22
22
  return ()=>{
23
23
  var _chatInputEntityPluginBase_current;
24
24
  return (_chatInputEntityPluginBase_current = chatInputEntityPluginBase.current) === null || _chatInputEntityPluginBase_current === void 0 ? void 0 : _chatInputEntityPluginBase_current.cleanup();
@@ -27,7 +27,8 @@ const ChatInputEntityPlugin = (props)=>{
27
27
  editor,
28
28
  id,
29
29
  onChatInputEntityAdded,
30
- onChatInputEntityDeleted
30
+ onChatInputEntityDeleted,
31
+ skipInitialization
31
32
  ]);
32
33
  _react.useImperativeHandle(controlRef, ()=>({
33
34
  insertChatInputEntity (props) {
@@ -1 +1 @@
1
- {"version":3,"sources":["ChatInputEntityPlugin.tsx"],"sourcesContent":["import { useLexicalComposerContext } from '@fluentui-copilot/react-text-editor';\nimport * as React from 'react';\nimport { $createChatInputEntityNode, $isChatInputEntityNode, ChatInputEntityNode } from './ChatInputEntity.node';\nimport type { ChatInputEntityPluginRef } from './ChatInputEntityPlugin.types';\nimport type { ChatInputEntityPluginProps } from '@fluentui-copilot/chat-input-plugins';\nimport { ChatInputEntityPluginBase } from '@fluentui-copilot/chat-input-plugins';\nimport type { ChatInputEntityProps } from '../../ChatInputEntity';\n\nexport const ChatInputEntityPlugin = <ExtraDataType,>(\n props: ChatInputEntityPluginProps<ExtraDataType, ChatInputEntityProps> & {\n controlRef: React.Ref<ChatInputEntityPluginRef<ExtraDataType>>;\n },\n) => {\n const { id, controlRef, onChatInputEntityAdded, onChatInputEntityDeleted } = props;\n const [editor] = useLexicalComposerContext();\n\n const chatInputEntityPluginBase = React.useRef<ChatInputEntityPluginBase<\n ExtraDataType,\n ChatInputEntityProps,\n ChatInputEntityNode<ExtraDataType>\n > | null>(null);\n\n React.useEffect(() => {\n chatInputEntityPluginBase.current = new ChatInputEntityPluginBase<\n ExtraDataType,\n ChatInputEntityProps,\n ChatInputEntityNode<ExtraDataType>\n >(\n editor,\n id,\n ChatInputEntityNode,\n $createChatInputEntityNode,\n $isChatInputEntityNode,\n onChatInputEntityAdded,\n onChatInputEntityDeleted,\n );\n\n return () => chatInputEntityPluginBase.current?.cleanup();\n }, [editor, id, onChatInputEntityAdded, onChatInputEntityDeleted]);\n\n React.useImperativeHandle(\n controlRef,\n () => ({\n insertChatInputEntity(props) {\n return chatInputEntityPluginBase.current?.insertChatInputEntity(props);\n },\n\n getActiveEntities() {\n return chatInputEntityPluginBase.current?.getActiveEntities() ?? [];\n },\n\n removeChatInputEntity(keyOrPredicate) {\n chatInputEntityPluginBase.current?.removeChatInputEntity(keyOrPredicate);\n },\n\n updateChatInputEntityProps(keyOrPredicate, props) {\n chatInputEntityPluginBase.current?.updateChatInputEntityProps(keyOrPredicate, props);\n },\n }),\n [],\n );\n return null;\n};\n"],"names":["ChatInputEntityPlugin","props","id","controlRef","chatInputEntityPluginBase","React","current","ChatInputEntityPluginBase","editor","ChatInputEntityNode","$createChatInputEntityNode","$isChatInputEntityNode","onChatInputEntityAdded","onChatInputEntityDeleted","useImperativeHandle","insertChatInputEntity","_chatInputEntityPluginBase_current","getActiveEntities","_chatInputEntityPluginBase_current_getActiveEntities","removeChatInputEntity","keyOrPredicate","updateChatInputEntityProps"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAQaA;;;eAAAA;;;;iCAR6B;iEACnB;qCACiE;kCAG9C;AAGnC,MAAMA,wBAAwBC,CAAAA;UAKnC,EACAC,EAAA,EAEAC,UAAMC,EAMNC,sBAAgB,0BACdD;kBAcaA,GAAAA,IAAAA,0CAAAA;sCAAAA,OAAAA,MAAAA,CAAAA;;QACfA,0BAAGE,OAAA,GAAA,IAAAC,2CAAA,CAAAC,QAAAN,IAAAO,wCAAA,EAAAC,+CAAA,EAAAC,2CAAA,EAAAC,wBAAAC;eAACL;gBAAQN;mBAAIU,CAAAA,qCAAAA,0BAAAA,OAAAA,MAAAA,QAAAA,uCAAAA,KAAAA,IAAAA,KAAAA,IAAAA,mCAAAA,OAAAA;;OAAiD;QAAAJ;QAAAN;QAAAU;QAAAC;KAAA;WAEjER,mBAAMS,CAAAA,YACJX,IACO,CAAA;mCACLY,KAAAA;;6DACSX,0BAAAA,OAAAA,MAA0BE,QAAOU,uCAAjCZ,KAAAA,IAAAA,KAAAA,IAAAA,mCAAAA,qBAAmCW,CAAAA;;;;;+EAInCX,CAAAA,qCAAAA,0BAAAA,OAAAA,MAA0BE,QAAOU,uCAAjCZ,KAAAA,IAAAA,KAAAA,IAAAA,mCAAAA,iBAAmCa,EAAAA,MAAAA,QAAiBC,yDAApDd,KAAAA,IAAAA,uDAAAA,EAAAA;;mCAGTe,cAAsBC;;sDACpBhB,0BAAAA,OAAAA,MAA0BE,QAAOU,uCAAjCZ,KAAAA,IAAAA,KAAAA,IAAAA,mCAAAA,qBAAmCe,CAAAA;;wCAGrCE,cAA2BD,EAAAA,KAAAA;;sDACzBhB,0BAAAA,OAAAA,MAA0BE,QAAOU,uCAAjCZ,KAAAA,IAAAA,KAAAA,IAAAA,mCAAAA,0BAAmCiB,CAAAA,gBAA2BD;;cAElE;WAGF;AACF"}
1
+ {"version":3,"sources":["ChatInputEntityPlugin.tsx"],"sourcesContent":["import { useLexicalComposerContext } from '@fluentui-copilot/react-text-editor';\nimport * as React from 'react';\nimport { $createChatInputEntityNode, $isChatInputEntityNode, ChatInputEntityNode } from './ChatInputEntity.node';\nimport type { ChatInputEntityPluginRef } from './ChatInputEntityPlugin.types';\nimport type { ChatInputEntityPluginProps } from '@fluentui-copilot/chat-input-plugins';\nimport { ChatInputEntityPluginBase } from '@fluentui-copilot/chat-input-plugins';\nimport type { ChatInputEntityProps } from '../../ChatInputEntity';\n\nexport const ChatInputEntityPlugin = <ExtraDataType,>(\n props: ChatInputEntityPluginProps<ExtraDataType, ChatInputEntityProps> & {\n controlRef: React.Ref<ChatInputEntityPluginRef<ExtraDataType>>;\n },\n) => {\n const { id, controlRef, onChatInputEntityAdded, onChatInputEntityDeleted, skipInitialization } = props;\n const [editor] = useLexicalComposerContext();\n\n const chatInputEntityPluginBase = React.useRef<ChatInputEntityPluginBase<\n ExtraDataType,\n ChatInputEntityProps,\n ChatInputEntityNode<ExtraDataType>\n > | null>(null);\n\n React.useEffect(() => {\n chatInputEntityPluginBase.current = new ChatInputEntityPluginBase<\n ExtraDataType,\n ChatInputEntityProps,\n ChatInputEntityNode<ExtraDataType>\n >(\n editor,\n id,\n ChatInputEntityNode,\n $createChatInputEntityNode,\n $isChatInputEntityNode,\n onChatInputEntityAdded,\n onChatInputEntityDeleted,\n skipInitialization,\n );\n\n return () => chatInputEntityPluginBase.current?.cleanup();\n }, [editor, id, onChatInputEntityAdded, onChatInputEntityDeleted, skipInitialization]);\n\n React.useImperativeHandle(\n controlRef,\n () => ({\n insertChatInputEntity(props) {\n return chatInputEntityPluginBase.current?.insertChatInputEntity(props);\n },\n\n getActiveEntities() {\n return chatInputEntityPluginBase.current?.getActiveEntities() ?? [];\n },\n\n removeChatInputEntity(keyOrPredicate) {\n chatInputEntityPluginBase.current?.removeChatInputEntity(keyOrPredicate);\n },\n\n updateChatInputEntityProps(keyOrPredicate, props) {\n chatInputEntityPluginBase.current?.updateChatInputEntityProps(keyOrPredicate, props);\n },\n }),\n [],\n );\n return null;\n};\n"],"names":["ChatInputEntityPlugin","props","id","controlRef","chatInputEntityPluginBase","React","useEffect","editor","onChatInputEntityAdded","onChatInputEntityDeleted","skipInitialization","useImperativeHandle","insertChatInputEntity","current","_chatInputEntityPluginBase_current","getActiveEntities","_chatInputEntityPluginBase_current_getActiveEntities","removeChatInputEntity","keyOrPredicate","updateChatInputEntityProps"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAQaA;;;eAAAA;;;;iCAR6B;iEACnB;qCACiE;kCAG9C;AAGnC,MAAMA,wBAAwBC,CAAAA;UAKnC,EACAC,EAAA,EAEAC,UAAMC,EAMNC,sBAAgB,0BACdD,oBAeO;mEAAMA;;WACZE,SAAA,CAAA;kCAACC,OAAAA,GAAAA,IAAAA,2CAAAA,CAAAA,QAAAA,IAAAA,wCAAAA,EAAAA,+CAAAA,EAAAA,2CAAAA,EAAAA,wBAAAA,0BAAAA;eAAQL;gBAAIM;mBAAwBC,CAAAA,qCAAAA,0BAAAA,OAAAA,MAAAA,QAAAA,uCAAAA,KAAAA,IAAAA,KAAAA,IAAAA,mCAAAA,OAAAA;;OAA6C;QAAAF;QAAAL;QAAAM;QAAAC;QAAAC;KAAA;WAErFL,mBAAMM,CAAAA,YACJR,IACO,CAAA;mCACLS,KAAAA;;6DACSR,0BAAAA,OAAAA,MAA0BS,QAAOC,uCAAjCV,KAAAA,IAAAA,KAAAA,IAAAA,mCAAAA,qBAAmCQ,CAAAA;;;;;+EAInCR,CAAAA,qCAAAA,0BAAAA,OAAAA,MAA0BS,QAAOC,uCAAjCV,KAAAA,IAAAA,KAAAA,IAAAA,mCAAAA,iBAAmCW,EAAAA,MAAAA,QAAiBC,yDAApDZ,KAAAA,IAAAA,uDAAAA,EAAAA;;mCAGTa,cAAsBC;;sDACpBd,0BAAAA,OAAAA,MAA0BS,QAAOC,uCAAjCV,KAAAA,IAAAA,KAAAA,IAAAA,mCAAAA,qBAAmCa,CAAAA;;wCAGrCE,cAA2BD,EAAAA,KAAAA;;sDACzBd,0BAAAA,OAAAA,MAA0BS,QAAOC,uCAAjCV,KAAAA,IAAAA,KAAAA,IAAAA,mCAAAA,0BAAmCe,CAAAA,gBAA2BD;;cAElE;WAGF;AACF"}
@@ -37,7 +37,6 @@ class GhostTextNode extends _texteditor.DecoratorNode {
37
37
  }
38
38
  exportJSON() {
39
39
  return {
40
- ...super.exportJSON(),
41
40
  type: 'ghosttext',
42
41
  id: this.__id,
43
42
  content: this.__content,
@@ -1 +1 @@
1
- {"version":3,"sources":["GhostText.node.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { DecoratorNode } from '@fluentui-copilot/text-editor';\nimport type { EditorConfig, LexicalNode, NodeKey, SerializedLexicalNode, Spread } from '@fluentui-copilot/text-editor';\nimport type { GhostTextProps } from '../../components/GhostText/GhostText.types';\nimport { GhostText } from '../../components/GhostText/GhostText';\n\nexport type SerializedGhostTextNode = Spread<\n {\n content: string;\n id: string;\n componentProps?: GhostTextProps;\n exposeText?: boolean;\n },\n SerializedLexicalNode\n>;\n\nexport class GhostTextNode extends DecoratorNode<JSX.Element | null> {\n __content: string;\n __id: string;\n __allowCommitting?: boolean;\n __componentProps?: GhostTextProps;\n __exposeText?: boolean;\n\n static clone(node: GhostTextNode): GhostTextNode {\n return new GhostTextNode(node.__id, node.__content, node.__exposeText, node.__componentProps, node.__key);\n }\n\n static getType(): 'ghosttext' {\n return 'ghosttext';\n }\n\n static importJSON(serializedNode: SerializedGhostTextNode): GhostTextNode {\n const node = $createGhostTextNode(\n serializedNode.id,\n serializedNode.content,\n serializedNode.exposeText,\n serializedNode.componentProps,\n );\n return node;\n }\n\n exportJSON(): SerializedGhostTextNode {\n return {\n ...super.exportJSON(),\n type: 'ghosttext',\n id: this.__id,\n content: this.__content,\n componentProps: this.__componentProps,\n exposeText: this.__exposeText,\n version: 1,\n };\n }\n\n constructor(id: string, content: string, exposeText?: boolean, componentProps?: GhostTextProps, key?: NodeKey) {\n super(key);\n this.__id = id;\n this.__content = content;\n this.__exposeText = exposeText;\n this.__componentProps = componentProps;\n }\n\n isInline() {\n return true;\n }\n\n isIsolated() {\n return true;\n }\n\n getTextContent(): string {\n return this.__exposeText ? this.__content : '';\n }\n\n updateDOM(prevNode: unknown, dom: HTMLElement, config: EditorConfig): boolean {\n return false;\n }\n\n createDOM(config: EditorConfig): HTMLElement {\n // eslint-disable-next-line no-restricted-globals\n return document.createElement('span');\n }\n\n decorate(): JSX.Element | null {\n return (\n <GhostText nodeKey={this.getKey()} {...this.__componentProps}>\n {this.__content}\n </GhostText>\n );\n }\n}\n\nexport function $createGhostTextNode(\n id: string,\n content: string,\n exposeText?: boolean,\n componentProps?: GhostTextProps,\n): GhostTextNode {\n return new GhostTextNode(id, content, exposeText, componentProps);\n}\n\nexport function $isGhostTextNode(node: LexicalNode | null | undefined): node is GhostTextNode {\n return node instanceof GhostTextNode;\n}\n"],"names":["$createGhostTextNode","$isGhostTextNode","GhostTextNode","DecoratorNode","clone","node","__id","__content","__exposeText","__componentProps","__key","getType","importJSON","serializedNode","id","content","exposeText","componentProps","exportJSON","type","version","isInline","isIsolated","getTextContent","updateDOM","prevNode","dom","config","createDOM","document","createElement","decorate","React","GhostText","nodeKey","getKey","constructor","key","__allowCommitting"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IA4FgBA,oBAAAA;eAAAA;;IASAC,gBAAAA;eAAAA;;IApFHC,aAAAA;eAAAA;;;;;iEAjBU;4BAEO;2BAGJ;AAYnB,MAAMA,sBAAsBC,yBAAAA;WAOjCC,MAAOA,IAAMC,EAAmB;eAC9B,IAAOH,cAAIA,KAAcG,IAAKC,EAAAA,KAAMD,SAAKE,EAAAA,KAAWF,YAAKG,EAAAA,KAAcH,gBAAKI,EAAAA,KAAkBJ,KAAKK;;WAGrGC,UAAOA;eACL;;WAGFC,WAAOA,cAAWC,EAAuC;cACvDR,OAAMA,qBAAOL,eACXa,EAAAA,EAAeC,eACfD,OAAeE,EAAAA,eACfF,UAAeG,EAAAA,eACfH,cAAeI;eAEjBZ;;iBAGFa;eACE;oBACE,CAAGA,YAAMA;kBACTC;oBACAL,CAAAA,IAAI;qBACJC,IAAAA,CAAAA,SAAcR;4BACdU,IAAAA,CAAAA,gBAAqBR;wBACrBO,IAAAA,CAAAA,YAAiBR;qBACjBY;;;eAYJC;eACE;;iBAGFC;eACE;;qBAGFC;eACE,IAAO,CAAAf,YAAKA,GAAAA,IAAe,CAAAD,SAAKA,GAAAA;;cAGlCiB,QAAUC,EAAiBC,GAAEA,EAAgBC,MAAEA,EAAoB;eACjE;;cAGFC,MAAUD,EAAoB;yDAC5B;eACAE,SAAOA,aAASC,CAAAA;;eAGlBC;eACE,WAAA,GAAAC,OACEF,aAAA,CAAAG,oBAACA,EAAAA;qBAAUC,IAAAA,CAAAA,MAAcC;mBAAW,CAAA1B,gBAAQA;eACzC,CAAAF,SAAKA;;gBAhCZ6B,EAAYtB,EAAUC,OAAEA,EAAeC,UAAEA,EAAoBC,cAAEA,EAA+BoB,GAAEA,CAAa;aAC3G,CAAAA;8BArCF9B,EAAAA,IAAAA,EAAAA,aAAAA,KAAAA;8BACAD,EAAAA,IAAAA,EAAAA,QAAAA,KAAAA;8BACAgC,EAAAA,IAAAA,EAAAA,qBAAAA,KAAAA;8BACA7B,EAAAA,IAAAA,EAAAA,oBAAAA,KAAAA;8BACAD,EAAAA,IAAAA,EAAAA,gBAAAA,KAAAA;YAkCE,CAAAF,IAAKA,GAAAA;YACL,CAAAC,SAAKA,GAAAA;YACL,CAAAC,YAAKA,GAAAA;YACL,CAAAC,gBAAKA,GAAAA;;AA+BT;AAEO,SAAST,qBACdc,EAAU,EACVC,OAAe,EACfC,UAAoB,EACpBC,cAA+B;WAE/B,IAAOf,cAAIA,IAAcY,SAAIC,YAASC;AACxC;AAEO,SAASf,iBAAiBI,IAAoC;WACnEA,gBAAOA;AACT"}
1
+ {"version":3,"sources":["GhostText.node.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { DecoratorNode } from '@fluentui-copilot/text-editor';\nimport type { EditorConfig, LexicalNode, NodeKey, SerializedLexicalNode, Spread } from '@fluentui-copilot/text-editor';\nimport type { GhostTextProps } from '../../components/GhostText/GhostText.types';\nimport { GhostText } from '../../components/GhostText/GhostText';\n\nexport type SerializedGhostTextNode = Spread<\n {\n content: string;\n id: string;\n componentProps?: GhostTextProps;\n exposeText?: boolean;\n },\n SerializedLexicalNode\n>;\n\nexport class GhostTextNode extends DecoratorNode<JSX.Element | null> {\n __content: string;\n __id: string;\n __allowCommitting?: boolean;\n __componentProps?: GhostTextProps;\n __exposeText?: boolean;\n\n static clone(node: GhostTextNode): GhostTextNode {\n return new GhostTextNode(node.__id, node.__content, node.__exposeText, node.__componentProps, node.__key);\n }\n\n static getType(): 'ghosttext' {\n return 'ghosttext';\n }\n\n static importJSON(serializedNode: SerializedGhostTextNode): GhostTextNode {\n const node = $createGhostTextNode(\n serializedNode.id,\n serializedNode.content,\n serializedNode.exposeText,\n serializedNode.componentProps,\n );\n return node;\n }\n\n exportJSON(): SerializedGhostTextNode {\n return {\n type: 'ghosttext',\n id: this.__id,\n content: this.__content,\n componentProps: this.__componentProps,\n exposeText: this.__exposeText,\n version: 1,\n };\n }\n\n constructor(id: string, content: string, exposeText?: boolean, componentProps?: GhostTextProps, key?: NodeKey) {\n super(key);\n this.__id = id;\n this.__content = content;\n this.__exposeText = exposeText;\n this.__componentProps = componentProps;\n }\n\n isInline() {\n return true;\n }\n\n isIsolated() {\n return true;\n }\n\n getTextContent(): string {\n return this.__exposeText ? this.__content : '';\n }\n\n updateDOM(prevNode: unknown, dom: HTMLElement, config: EditorConfig): boolean {\n return false;\n }\n\n createDOM(config: EditorConfig): HTMLElement {\n // eslint-disable-next-line no-restricted-globals\n return document.createElement('span');\n }\n\n decorate(): JSX.Element | null {\n return (\n <GhostText nodeKey={this.getKey()} {...this.__componentProps}>\n {this.__content}\n </GhostText>\n );\n }\n}\n\nexport function $createGhostTextNode(\n id: string,\n content: string,\n exposeText?: boolean,\n componentProps?: GhostTextProps,\n): GhostTextNode {\n return new GhostTextNode(id, content, exposeText, componentProps);\n}\n\nexport function $isGhostTextNode(node: LexicalNode | null | undefined): node is GhostTextNode {\n return node instanceof GhostTextNode;\n}\n"],"names":["$createGhostTextNode","$isGhostTextNode","GhostTextNode","DecoratorNode","clone","node","__id","__content","__exposeText","__componentProps","__key","getType","importJSON","serializedNode","id","content","exposeText","componentProps","exportJSON","type","version","isInline","isIsolated","getTextContent","updateDOM","prevNode","dom","config","createDOM","document","createElement","decorate","React","GhostText","nodeKey","getKey","constructor","key","__allowCommitting"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IA2FgBA,oBAAAA;eAAAA;;IASAC,gBAAAA;eAAAA;;IAnFHC,aAAAA;eAAAA;;;;;iEAjBU;4BAEO;2BAGJ;AAYnB,MAAMA,sBAAsBC,yBAAAA;WAOjCC,MAAOA,IAAMC,EAAmB;eAC9B,IAAOH,cAAIA,KAAcG,IAAKC,EAAAA,KAAMD,SAAKE,EAAAA,KAAWF,YAAKG,EAAAA,KAAcH,gBAAKI,EAAAA,KAAkBJ,KAAKK;;WAGrGC,UAAOA;eACL;;WAGFC,WAAOA,cAAWC,EAAuC;cACvDR,OAAMA,qBAAOL,eACXa,EAAAA,EAAeC,eACfD,OAAeE,EAAAA,eACfF,UAAeG,EAAAA,eACfH,cAAeI;eAEjBZ;;iBAGFa;eACE;kBACEC;oBACAL,CAAAA,IAAI;qBACJC,IAAAA,CAAAA,SAAcR;4BACdU,IAAAA,CAAAA,gBAAqBR;wBACrBO,IAAAA,CAAAA,YAAiBR;qBACjBY;;;eAYJC;eACE;;iBAGFC;eACE;;qBAGFC;eACE,IAAO,CAAAf,YAAKA,GAAAA,IAAe,CAAAD,SAAKA,GAAAA;;cAGlCiB,QAAUC,EAAiBC,GAAEA,EAAgBC,MAAEA,EAAoB;eACjE;;cAGFC,MAAUD,EAAoB;yDAC5B;eACAE,SAAOA,aAASC,CAAAA;;eAGlBC;eACE,WAAA,GAAAC,OACEF,aAAA,CAAAG,oBAACA,EAAAA;qBAAUC,IAAAA,CAAAA,MAAcC;mBAAW,CAAA1B,gBAAQA;eACzC,CAAAF,SAAKA;;gBAhCZ6B,EAAYtB,EAAUC,OAAEA,EAAeC,UAAEA,EAAoBC,cAAEA,EAA+BoB,GAAEA,CAAa;aAC3G,CAAAA;8BApCF9B,EAAAA,IAAAA,EAAAA,aAAAA,KAAAA;8BACAD,EAAAA,IAAAA,EAAAA,QAAAA,KAAAA;8BACAgC,EAAAA,IAAAA,EAAAA,qBAAAA,KAAAA;8BACA7B,EAAAA,IAAAA,EAAAA,oBAAAA,KAAAA;8BACAD,EAAAA,IAAAA,EAAAA,gBAAAA,KAAAA;YAiCE,CAAAF,IAAKA,GAAAA;YACL,CAAAC,SAAKA,GAAAA;YACL,CAAAC,YAAKA,GAAAA;YACL,CAAAC,gBAAKA,GAAAA;;AA+BT;AAEO,SAAST,qBACdc,EAAU,EACVC,OAAe,EACfC,UAAoB,EACpBC,cAA+B;WAE/B,IAAOf,cAAIA,IAAcY,SAAIC,YAASC;AACxC;AAEO,SAASf,iBAAiBI,IAAoC;WACnEA,gBAAOA;AACT"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluentui-copilot/react-chat-input-plugins",
3
- "version": "0.2.0",
3
+ "version": "0.2.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.2.0",
15
+ "@fluentui-copilot/chat-input-plugins": "^0.2.2",
16
16
  "@fluentui-copilot/react-text-editor": "^0.2.0",
17
17
  "@fluentui-copilot/text-editor": "^0.1.0",
18
18
  "@swc/helpers": "^0.5.1"