@fluentui-copilot/react-chat-input-plugins 0.5.4 → 0.5.6
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 +48 -0
- package/CHANGELOG.md +22 -1
- package/dist/index.d.ts +11 -10
- package/lib/components/ChatInputEntity/renderChatInputEntity.js.map +1 -1
- package/lib/components/ChatInputToken/ChatInputToken.node.js.map +1 -1
- package/lib/components/ChatInputToken/renderChatInputToken.js.map +1 -1
- package/lib/components/GhostText/renderGhostText.js.map +1 -1
- package/lib/components/GhostText/useGhostText.js.map +1 -1
- package/lib/plugins/ChatInputEntity/ChatInputEntity.node.js.map +1 -1
- package/lib/plugins/ChatInputEntity/ChatInputEntityPlugin.js.map +1 -1
- package/lib/plugins/GhostText/GhostText.js.map +1 -1
- package/lib/plugins/GhostText/GhostText.node.js.map +1 -1
- package/lib/plugins/PasteUnfurling/PasteUnfurling.js.map +1 -1
- package/lib-commonjs/components/ChatInputEntity/renderChatInputEntity.js.map +1 -1
- package/lib-commonjs/components/ChatInputToken/ChatInputToken.node.js.map +1 -1
- package/lib-commonjs/components/ChatInputToken/renderChatInputToken.js.map +1 -1
- package/lib-commonjs/components/GhostText/renderGhostText.js.map +1 -1
- package/lib-commonjs/components/GhostText/useGhostText.js.map +1 -1
- package/lib-commonjs/plugins/ChatInputEntity/ChatInputEntity.node.js.map +1 -1
- package/lib-commonjs/plugins/ChatInputEntity/ChatInputEntityPlugin.js.map +1 -1
- package/lib-commonjs/plugins/GhostText/GhostText.js.map +1 -1
- package/lib-commonjs/plugins/GhostText/GhostText.node.js.map +1 -1
- package/lib-commonjs/plugins/PasteUnfurling/PasteUnfurling.js.map +1 -1
- package/package.json +10 -10
package/CHANGELOG.json
CHANGED
|
@@ -1,6 +1,54 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluentui-copilot/react-chat-input-plugins",
|
|
3
3
|
"entries": [
|
|
4
|
+
{
|
|
5
|
+
"date": "Tue, 14 Oct 2025 00:02:54 GMT",
|
|
6
|
+
"tag": "@fluentui-copilot/react-chat-input-plugins_v0.5.6",
|
|
7
|
+
"version": "0.5.6",
|
|
8
|
+
"comments": {
|
|
9
|
+
"patch": [
|
|
10
|
+
{
|
|
11
|
+
"author": "tristan.watanabe@gmail.com",
|
|
12
|
+
"package": "@fluentui-copilot/react-chat-input-plugins",
|
|
13
|
+
"commit": "ced6fa3a284cc90eae5ca16357e15b349f720ca0",
|
|
14
|
+
"comment": "fix: migrate to React 19 compatible JSX and Ref types."
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"author": "tristan.watanabe@gmail.com",
|
|
18
|
+
"package": "@fluentui-copilot/react-chat-input-plugins",
|
|
19
|
+
"commit": "74cfcbd7c8afdc8fe3f4b512a9a421613fa32841",
|
|
20
|
+
"comment": "chore: update react peer deps to support React 19."
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"author": "tristan.watanabe@gmail.com",
|
|
24
|
+
"package": "@fluentui-copilot/react-chat-input-plugins",
|
|
25
|
+
"commit": "9a3bf49a3c6302529b2c9b6bc3fc63f549aaf88f",
|
|
26
|
+
"comment": "chore: enforce explicit return types."
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"author": "twatanabe@microsoft.com",
|
|
30
|
+
"package": "@fluentui-copilot/react-chat-input-plugins",
|
|
31
|
+
"commit": "068a3c71be5da80beeab05640fe768ef631b0c00",
|
|
32
|
+
"comment": "chore: bump @fluentui/react-components peer dep minbar to ^9.70.0."
|
|
33
|
+
}
|
|
34
|
+
]
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"date": "Mon, 29 Sep 2025 20:26:50 GMT",
|
|
39
|
+
"tag": "@fluentui-copilot/react-chat-input-plugins_v0.5.5",
|
|
40
|
+
"version": "0.5.5",
|
|
41
|
+
"comments": {
|
|
42
|
+
"patch": [
|
|
43
|
+
{
|
|
44
|
+
"author": "tristan.watanabe@gmail.com",
|
|
45
|
+
"package": "@fluentui-copilot/react-chat-input-plugins",
|
|
46
|
+
"commit": "eb866bbd84d778637cb17f869920ae47a3eeec50",
|
|
47
|
+
"comment": "fix: type issues after React 18 upgrade."
|
|
48
|
+
}
|
|
49
|
+
]
|
|
50
|
+
}
|
|
51
|
+
},
|
|
4
52
|
{
|
|
5
53
|
"date": "Thu, 17 Jul 2025 17:49:26 GMT",
|
|
6
54
|
"tag": "@fluentui-copilot/react-chat-input-plugins_v0.5.3",
|
package/CHANGELOG.md
CHANGED
|
@@ -1,9 +1,30 @@
|
|
|
1
1
|
# Change Log - @fluentui-copilot/react-chat-input-plugins
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Tue, 14 Oct 2025 00:02:54 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## [0.5.6](https://github.com/microsoft/fluentai/tree/@fluentui-copilot/react-chat-input-plugins_v0.5.6)
|
|
8
|
+
|
|
9
|
+
Tue, 14 Oct 2025 00:02:54 GMT
|
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentai/compare/@fluentui-copilot/react-chat-input-plugins_v0.5.5..@fluentui-copilot/react-chat-input-plugins_v0.5.6)
|
|
11
|
+
|
|
12
|
+
### Patches
|
|
13
|
+
|
|
14
|
+
- fix: migrate to React 19 compatible JSX and Ref types. ([PR #3355](https://github.com/microsoft/fluentai/pull/3355) by tristan.watanabe@gmail.com)
|
|
15
|
+
- chore: update react peer deps to support React 19. ([PR #3361](https://github.com/microsoft/fluentai/pull/3361) by tristan.watanabe@gmail.com)
|
|
16
|
+
- chore: enforce explicit return types. ([PR #3360](https://github.com/microsoft/fluentai/pull/3360) by tristan.watanabe@gmail.com)
|
|
17
|
+
- chore: bump @fluentui/react-components peer dep minbar to ^9.70.0. ([PR #3344](https://github.com/microsoft/fluentai/pull/3344) by twatanabe@microsoft.com)
|
|
18
|
+
|
|
19
|
+
## [0.5.5](https://github.com/microsoft/fluentai/tree/@fluentui-copilot/react-chat-input-plugins_v0.5.5)
|
|
20
|
+
|
|
21
|
+
Mon, 29 Sep 2025 20:26:50 GMT
|
|
22
|
+
[Compare changes](https://github.com/microsoft/fluentai/compare/@fluentui-copilot/react-chat-input-plugins_v0.5.3..@fluentui-copilot/react-chat-input-plugins_v0.5.5)
|
|
23
|
+
|
|
24
|
+
### Patches
|
|
25
|
+
|
|
26
|
+
- fix: type issues after React 18 upgrade. ([PR #3341](https://github.com/microsoft/fluentai/pull/3341) by tristan.watanabe@gmail.com)
|
|
27
|
+
|
|
7
28
|
## [0.5.3](https://github.com/microsoft/fluentai/tree/@fluentui-copilot/react-chat-input-plugins_v0.5.3)
|
|
8
29
|
|
|
9
30
|
Thu, 17 Jul 2025 17:49:26 GMT
|
package/dist/index.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ import type { EditorState } from '@fluentui-copilot/text-editor';
|
|
|
8
8
|
import type { ForwardRefComponent } from '@fluentui/react-components';
|
|
9
9
|
import type { IImperativeControlBase } from '@fluentui-copilot/chat-input-plugins';
|
|
10
10
|
import type { IManualGhostTextBase } from '@fluentui-copilot/chat-input-plugins';
|
|
11
|
+
import type { JSXElement } from '@fluentui/react-components';
|
|
11
12
|
import type { LexicalEditor } from '@fluentui-copilot/text-editor';
|
|
12
13
|
import type { LexicalNode } from '@fluentui-copilot/text-editor';
|
|
13
14
|
import type { NodeKey } from '@fluentui-copilot/text-editor';
|
|
@@ -48,7 +49,7 @@ export declare const ChatInputEntity: ForwardRefComponent<ChatInputEntityProps>;
|
|
|
48
49
|
|
|
49
50
|
export declare const chatInputEntityClassNames: SlotClassNames<ChatInputEntitySlots>;
|
|
50
51
|
|
|
51
|
-
export declare class ChatInputEntityNode<T> extends DecoratorNode<
|
|
52
|
+
export declare class ChatInputEntityNode<T> extends DecoratorNode<JSXElement | null> {
|
|
52
53
|
__pluginId: string;
|
|
53
54
|
__text: string;
|
|
54
55
|
__entityProps?: ChatInputEntityProps;
|
|
@@ -63,7 +64,7 @@ export declare class ChatInputEntityNode<T> extends DecoratorNode<JSX.Element |
|
|
|
63
64
|
constructor(pluginId: string, text: string, data?: T, entityProps?: ChatInputEntityProps, key?: NodeKey);
|
|
64
65
|
createDOM(): HTMLElement;
|
|
65
66
|
updateDOM(): boolean;
|
|
66
|
-
decorate(_editor: LexicalEditor, config: EditorConfig):
|
|
67
|
+
decorate(_editor: LexicalEditor, config: EditorConfig): JSXElement | null;
|
|
67
68
|
getEntityData(): ChatInputEntityData<T, ChatInputEntityProps>;
|
|
68
69
|
updateEntityData(data: ChatInputEntityData<T, ChatInputEntityProps>): void;
|
|
69
70
|
}
|
|
@@ -99,7 +100,7 @@ export declare const ChatInputToken: ForwardRefComponent<ChatInputTokenProps>;
|
|
|
99
100
|
|
|
100
101
|
export declare const chatInputTokenClassNames: SlotClassNames<ChatInputTokenSlots>;
|
|
101
102
|
|
|
102
|
-
export declare class ChatInputTokenNode extends DecoratorNode<
|
|
103
|
+
export declare class ChatInputTokenNode extends DecoratorNode<JSXElement | null> {
|
|
103
104
|
__text: string;
|
|
104
105
|
__componentProps?: ChatInputTokenProps;
|
|
105
106
|
static getType(): string;
|
|
@@ -112,7 +113,7 @@ export declare class ChatInputTokenNode extends DecoratorNode<JSX.Element | null
|
|
|
112
113
|
constructor(text: string, componentProps?: ChatInputTokenProps, key?: NodeKey);
|
|
113
114
|
createDOM(): HTMLElement;
|
|
114
115
|
updateDOM(): boolean;
|
|
115
|
-
decorate(_editor: LexicalEditor, config: EditorConfig):
|
|
116
|
+
decorate(_editor: LexicalEditor, config: EditorConfig): JSXElement | null;
|
|
116
117
|
}
|
|
117
118
|
|
|
118
119
|
/**
|
|
@@ -133,7 +134,7 @@ export declare const GhostText: ForwardRefComponent<GhostTextProps>;
|
|
|
133
134
|
|
|
134
135
|
export declare const ghostTextClassNames: SlotClassNames<GhostTextSlots>;
|
|
135
136
|
|
|
136
|
-
export declare class GhostTextNode extends DecoratorNode<
|
|
137
|
+
export declare class GhostTextNode extends DecoratorNode<JSXElement | null> {
|
|
137
138
|
__content: string;
|
|
138
139
|
__id: string;
|
|
139
140
|
__allowCommitting?: boolean;
|
|
@@ -149,10 +150,10 @@ export declare class GhostTextNode extends DecoratorNode<JSX.Element | null> {
|
|
|
149
150
|
getTextContent(): string;
|
|
150
151
|
updateDOM(prevNode: unknown, dom: HTMLElement, config: EditorConfig): boolean;
|
|
151
152
|
createDOM(config: EditorConfig): HTMLElement;
|
|
152
|
-
decorate():
|
|
153
|
+
decorate(): JSXElement | null;
|
|
153
154
|
}
|
|
154
155
|
|
|
155
|
-
export declare function GhostTextPlugin(props: GhostTextPluginProps):
|
|
156
|
+
export declare function GhostTextPlugin(props: GhostTextPluginProps): JSXElement | null;
|
|
156
157
|
|
|
157
158
|
export declare type GhostTextPluginProps = {
|
|
158
159
|
id: string;
|
|
@@ -200,17 +201,17 @@ export declare type PasteUnfurlingPluginProps<ExtraDataType> = Omit<PasteUnfurli
|
|
|
200
201
|
/**
|
|
201
202
|
* Render the final JSX of ChatInputEntity
|
|
202
203
|
*/
|
|
203
|
-
export declare const renderChatInputEntity_unstable: (state: ChatInputEntityState) =>
|
|
204
|
+
export declare const renderChatInputEntity_unstable: (state: ChatInputEntityState) => JSXElement;
|
|
204
205
|
|
|
205
206
|
/**
|
|
206
207
|
* Render the final JSX of ChatInputToken
|
|
207
208
|
*/
|
|
208
|
-
export declare const renderChatInputToken_unstable: (state: ChatInputTokenState) =>
|
|
209
|
+
export declare const renderChatInputToken_unstable: (state: ChatInputTokenState) => JSXElement;
|
|
209
210
|
|
|
210
211
|
/**
|
|
211
212
|
* Render the final JSX of GhostText
|
|
212
213
|
*/
|
|
213
|
-
export declare const renderGhostText_unstable: (state: GhostTextState) =>
|
|
214
|
+
export declare const renderGhostText_unstable: (state: GhostTextState) => JSXElement;
|
|
214
215
|
|
|
215
216
|
export declare type SerializedChatInputEntityNode<T> = Spread<{
|
|
216
217
|
pluginId: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["renderChatInputEntity.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-components';\nimport type { ChatInputEntityState, ChatInputEntitySlots } from './ChatInputEntity.types';\n\n/**\n * Render the final JSX of ChatInputEntity\n */\nexport const renderChatInputEntity_unstable = (state: ChatInputEntityState) => {\n assertSlots<ChatInputEntitySlots>(state);\n\n return (\n <state.root>\n {state.text && <state.text />}\n {state.sensitivity && <state.sensitivity />}\n </state.root>\n );\n};\n"],"names":["assertSlots","renderChatInputEntity_unstable","state","root","text","sensitivity"],"rangeMappings":";;;;;;;;;;;;","mappings":"AAAA,0BAA0B,GAC1B,iDAAiD;AAEjD,SAASA,WAAW,QAAQ,6BAA6B;
|
|
1
|
+
{"version":3,"sources":["renderChatInputEntity.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-components';\nimport type { JSXElement } from '@fluentui/react-components';\nimport type { ChatInputEntityState, ChatInputEntitySlots } from './ChatInputEntity.types';\n\n/**\n * Render the final JSX of ChatInputEntity\n */\nexport const renderChatInputEntity_unstable = (state: ChatInputEntityState): JSXElement => {\n assertSlots<ChatInputEntitySlots>(state);\n\n return (\n <state.root>\n {state.text && <state.text />}\n {state.sensitivity && <state.sensitivity />}\n </state.root>\n );\n};\n"],"names":["assertSlots","renderChatInputEntity_unstable","state","root","text","sensitivity"],"rangeMappings":";;;;;;;;;;;;","mappings":"AAAA,0BAA0B,GAC1B,iDAAiD;AAEjD,SAASA,WAAW,QAAQ,6BAA6B;AAIzD;;CAEC,GACD,OAAO,MAAMC,iCAAiC,CAACC;IAC7CF,YAAkCE;IAElC,qBACE,MAACA,MAAMC,IAAI;;YACRD,MAAME,IAAI,kBAAI,KAACF,MAAME,IAAI;YACzBF,MAAMG,WAAW,kBAAI,KAACH,MAAMG,WAAW;;;AAG9C,EAAE"}
|
|
@@ -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<
|
|
1
|
+
{"version":3,"sources":["ChatInputToken.node.tsx"],"sourcesContent":["import * as React from 'react';\nimport type { JSXElement } from '@fluentui/react-components';\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<JSXElement | 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(): boolean {\n return true;\n }\n isInline(): boolean {\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(): boolean {\n return false;\n }\n\n decorate(_editor: LexicalEditor, config: EditorConfig): JSXElement | 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;AAG/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,aAAsB;QACpB,OAAO;IACT;IACAC,WAAoB;QAClB,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,YAAqB;QACnB,OAAO;IACT;IAEAC,SAASC,OAAsB,EAAEC,MAAoB,EAAqB;YACpE;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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["renderChatInputToken.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-components';\nimport type { ChatInputTokenState, ChatInputTokenSlots } from './ChatInputToken.types';\n\n/**\n * Render the final JSX of ChatInputToken\n */\nexport const renderChatInputToken_unstable = (state: ChatInputTokenState) => {\n assertSlots<ChatInputTokenSlots>(state);\n\n return <state.root />;\n};\n"],"names":["assertSlots","renderChatInputToken_unstable","state","root"],"rangeMappings":";;;;;;;","mappings":"AAAA,0BAA0B,GAC1B,iDAAiD;AAEjD,SAASA,WAAW,QAAQ,6BAA6B;
|
|
1
|
+
{"version":3,"sources":["renderChatInputToken.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-components';\nimport type { JSXElement } from '@fluentui/react-components';\nimport type { ChatInputTokenState, ChatInputTokenSlots } from './ChatInputToken.types';\n\n/**\n * Render the final JSX of ChatInputToken\n */\nexport const renderChatInputToken_unstable = (state: ChatInputTokenState): JSXElement => {\n assertSlots<ChatInputTokenSlots>(state);\n\n return <state.root />;\n};\n"],"names":["assertSlots","renderChatInputToken_unstable","state","root"],"rangeMappings":";;;;;;;","mappings":"AAAA,0BAA0B,GAC1B,iDAAiD;AAEjD,SAASA,WAAW,QAAQ,6BAA6B;AAIzD;;CAEC,GACD,OAAO,MAAMC,gCAAgC,CAACC;IAC5CF,YAAiCE;IAEjC,qBAAO,KAACA,MAAMC,IAAI;AACpB,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["renderGhostText.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-components';\nimport type { GhostTextState, GhostTextSlots } from './GhostText.types';\n\n/**\n * Render the final JSX of GhostText\n */\nexport const renderGhostText_unstable = (state: GhostTextState) => {\n assertSlots<GhostTextSlots>(state);\n\n return (\n <state.root>\n {state.root.children}\n {state.indicator && <state.indicator />}\n </state.root>\n );\n};\n"],"names":["assertSlots","renderGhostText_unstable","state","root","children","indicator"],"rangeMappings":";;;;;;;;;;;;","mappings":"AAAA,0BAA0B,GAC1B,iDAAiD;AAEjD,SAASA,WAAW,QAAQ,6BAA6B;
|
|
1
|
+
{"version":3,"sources":["renderGhostText.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-components';\nimport type { JSXElement } from '@fluentui/react-components';\nimport type { GhostTextState, GhostTextSlots } from './GhostText.types';\n\n/**\n * Render the final JSX of GhostText\n */\nexport const renderGhostText_unstable = (state: GhostTextState): JSXElement => {\n assertSlots<GhostTextSlots>(state);\n\n return (\n <state.root>\n {state.root.children}\n {state.indicator && <state.indicator />}\n </state.root>\n );\n};\n"],"names":["assertSlots","renderGhostText_unstable","state","root","children","indicator"],"rangeMappings":";;;;;;;;;;;;","mappings":"AAAA,0BAA0B,GAC1B,iDAAiD;AAEjD,SAASA,WAAW,QAAQ,6BAA6B;AAIzD;;CAEC,GACD,OAAO,MAAMC,2BAA2B,CAACC;IACvCF,YAA4BE;IAE5B,qBACE,MAACA,MAAMC,IAAI;;YACRD,MAAMC,IAAI,CAACC,QAAQ;YACnBF,MAAMG,SAAS,kBAAI,KAACH,MAAMG,SAAS;;;AAG1C,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useGhostText.ts"],"sourcesContent":["import * as React from 'react';\nimport { getIntrinsicElementProps, mergeCallbacks, slot } from '@fluentui/react-components';\nimport type { GhostTextProps, GhostTextState } from './GhostText.types';\nimport { $getNodeByKey, useLexicalComposerContext } from '@fluentui-copilot/react-text-editor';\n\n// If you add JSX to this file, be sure to change the file type to .tsx\n\n/**\n * Create the state required to render GhostText.\n *\n * The returned state can be modified with hooks such as useGhostTextStyles_unstable,\n * before being passed to renderGhostText_unstable.\n *\n * @param props - props from this instance of GhostText\n * @param ref - reference to root HTMLElement of GhostText\n */\nexport const useGhostText_unstable = (props: GhostTextProps, ref: React.Ref<HTMLSpanElement>): GhostTextState => {\n const { nodeKey, onClick, ...rest } = props;\n const [editor] = useLexicalComposerContext();\n\n const handleClick = React.useCallback(\n _ev => {\n if (!nodeKey) {\n return;\n }\n\n editor.update(\n () => {\n const node = $getNodeByKey(nodeKey);\n node?.getPreviousSibling()?.selectEnd();\n },\n { tag: 'historic' },\n );\n },\n [editor, nodeKey],\n );\n\n const mergedOnClick = mergeCallbacks(handleClick, onClick);\n\n const state: GhostTextState = {\n components: {\n root: 'span',\n indicator: 'span',\n },\n root: slot.always(\n getIntrinsicElementProps('span', {\n ref,\n onClick: mergedOnClick,\n ...rest,\n }),\n { elementType: 'span' },\n ),\n indicator: slot.optional(props.indicator, { elementType: 'span' }),\n };\n\n return state;\n};\n"],"names":["React","getIntrinsicElementProps","mergeCallbacks","slot","$getNodeByKey","useLexicalComposerContext","useGhostText_unstable","props","ref","nodeKey","onClick","rest","editor","handleClick","useCallback","_ev","update","node","getPreviousSibling","selectEnd","tag","mergedOnClick","state","components","root","indicator","always","elementType","optional"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,wBAAwB,EAAEC,cAAc,EAAEC,IAAI,QAAQ,6BAA6B;AAE5F,SAASC,aAAa,EAAEC,yBAAyB,QAAQ,sCAAsC;AAE/F,uEAAuE;AAEvE;;;;;;;;CAQC,GACD,OAAO,MAAMC,wBAAwB,CAACC,OAAuBC;IAC3D,MAAM,EAAEC,OAAO,EAAEC,OAAO,EAAE,GAAGC,MAAM,GAAGJ;IACtC,MAAM,CAACK,OAAO,GAAGP;IAEjB,MAAMQ,cAAcb,MAAMc,WAAW,
|
|
1
|
+
{"version":3,"sources":["useGhostText.ts"],"sourcesContent":["import * as React from 'react';\nimport { getIntrinsicElementProps, mergeCallbacks, slot } from '@fluentui/react-components';\nimport type { GhostTextProps, GhostTextState } from './GhostText.types';\nimport { $getNodeByKey, useLexicalComposerContext } from '@fluentui-copilot/react-text-editor';\n\n// If you add JSX to this file, be sure to change the file type to .tsx\n\n/**\n * Create the state required to render GhostText.\n *\n * The returned state can be modified with hooks such as useGhostTextStyles_unstable,\n * before being passed to renderGhostText_unstable.\n *\n * @param props - props from this instance of GhostText\n * @param ref - reference to root HTMLElement of GhostText\n */\nexport const useGhostText_unstable = (props: GhostTextProps, ref: React.Ref<HTMLSpanElement>): GhostTextState => {\n const { nodeKey, onClick, ...rest } = props;\n const [editor] = useLexicalComposerContext();\n\n const handleClick = React.useCallback(\n (_ev: React.MouseEvent<HTMLElement>) => {\n if (!nodeKey) {\n return;\n }\n\n editor.update(\n () => {\n const node = $getNodeByKey(nodeKey);\n node?.getPreviousSibling()?.selectEnd();\n },\n { tag: 'historic' },\n );\n },\n [editor, nodeKey],\n );\n\n const mergedOnClick = mergeCallbacks(handleClick, onClick);\n\n const state: GhostTextState = {\n components: {\n root: 'span',\n indicator: 'span',\n },\n root: slot.always(\n getIntrinsicElementProps('span', {\n ref,\n onClick: mergedOnClick,\n ...rest,\n }),\n { elementType: 'span' },\n ),\n indicator: slot.optional(props.indicator, { elementType: 'span' }),\n };\n\n return state;\n};\n"],"names":["React","getIntrinsicElementProps","mergeCallbacks","slot","$getNodeByKey","useLexicalComposerContext","useGhostText_unstable","props","ref","nodeKey","onClick","rest","editor","handleClick","useCallback","_ev","update","node","getPreviousSibling","selectEnd","tag","mergedOnClick","state","components","root","indicator","always","elementType","optional"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,wBAAwB,EAAEC,cAAc,EAAEC,IAAI,QAAQ,6BAA6B;AAE5F,SAASC,aAAa,EAAEC,yBAAyB,QAAQ,sCAAsC;AAE/F,uEAAuE;AAEvE;;;;;;;;CAQC,GACD,OAAO,MAAMC,wBAAwB,CAACC,OAAuBC;IAC3D,MAAM,EAAEC,OAAO,EAAEC,OAAO,EAAE,GAAGC,MAAM,GAAGJ;IACtC,MAAM,CAACK,OAAO,GAAGP;IAEjB,MAAMQ,cAAcb,MAAMc,WAAW,CACnC,CAACC;QACC,IAAI,CAACN,SAAS;YACZ;QACF;QAEAG,OAAOI,MAAM,CACX;gBAEEC;YADA,MAAMA,OAAOb,cAAcK;YAC3BQ,iBAAAA,4BAAAA,2BAAAA,KAAMC,kBAAkB,gBAAxBD,+CAAAA,yBAA4BE,SAAS;QACvC,GACA;YAAEC,KAAK;QAAW;IAEtB,GACA;QAACR;QAAQH;KAAQ;IAGnB,MAAMY,gBAAgBnB,eAAeW,aAAaH;IAElD,MAAMY,QAAwB;QAC5BC,YAAY;YACVC,MAAM;YACNC,WAAW;QACb;QACAD,MAAMrB,KAAKuB,MAAM,CACfzB,yBAAyB,QAAQ;YAC/BO;YACAE,SAASW;YACT,GAAGV,IAAI;QACT,IACA;YAAEgB,aAAa;QAAO;QAExBF,WAAWtB,KAAKyB,QAAQ,CAACrB,MAAMkB,SAAS,EAAE;YAAEE,aAAa;QAAO;IAClE;IAEA,OAAOL;AACT,EAAE"}
|
|
@@ -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<
|
|
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 { JSXElement } from '@fluentui/react-components';\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<JSXElement | 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(): boolean {\n return true;\n }\n isInline(): boolean {\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(): boolean {\n return false;\n }\n\n decorate(_editor: LexicalEditor, config: EditorConfig): JSXElement | 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>): void {\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;AAW9D,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,aAAsB;QACpB,OAAO;IACT;IACAC,WAAoB;QAClB,OAAO;IACT;IAEAC,iBAAyB;QACvB,OAAO,IAAI,CAACb,MAAM;IACpB;IAEAc,aAA+C;QAC7C,OAAO;YACLP,UAAU,IAAI,CAACR,UAAU;YACzBS,MAAM,IAAI,CAACR,MAAM;YACjBS,MAAM,IAAI,CAACR,MAAM;YACjBS,aAAa,IAAI,CAACR,aAAa;YAC/Ba,MAAMpB,oBAAoBC,OAAO;YACjCoB,SAAS;QACX;IACF;IAUAC,YAAyB;QACvB,iDAAiD;QACjD,OAAOC,SAASC,aAAa,CAAC;IAChC;IAEAC,YAAqB;QACnB,OAAO;IACT;IAEAC,SAASC,OAAsB,EAAEC,MAAoB,EAAqB;YACpE;QAAJ,KAAI,sBAAA,IAAI,CAACrB,aAAa,cAAlB,0CAAA,oBAAoBsB,QAAQ,EAAE;YAChC,qBAAO,oBAAC9B,iBAAoB,IAAI,CAACQ,aAAa;QAChD;QACA,qBAAO,oBAACR,iBAAoB,IAAI,CAACQ,aAAa,EAAG,IAAI,CAACF,MAAM;IAC9D;IAEAyB,gBAA8D;QAC5D,OAAO;YACLjB,MAAM,IAAI,CAACR,MAAM;YACjBS,MAAM,IAAI,CAACR,MAAM;YACjBS,aAAa,IAAI,CAACR,aAAa;QACjC;IACF;IAEAwB,iBAAiBjB,IAAkD,EAAQ;QACzE,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"}
|
|
@@ -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, 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 );\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,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,EAAEC,kBAAkB,EAAE,GAAGL;IACjG,MAAM,CAACM,OAAO,GAAGb;IAEjB,MAAMc,4BAA4Bb,MAAMc,MAAM,CAIpC;IAEVd,MAAMe,SAAS,CAAC;QACdF,0BAA0BG,OAAO,GAAG,IAAIZ,0BAKtCQ,QACAL,IACAJ,qBACAF,4BACAC,wBACAO,wBACAC;QAGF,OAAO;gBAAMG;oBAAAA,qCAAAA,0BAA0BG,OAAO,cAAjCH,yDAAAA,mCAAmCI,OAAO;;IACzD,GAAG;QAACL;QAAQL;QAAIE;QAAwBC;QAA0BC;KAAmB;IAErFX,MAAMkB,mBAAmB,CACvBV,YACA,IAAO,CAAA;YACLW,uBAAsBb,KAAK;oBAClBO;gBAAP,QAAOA,qCAAAA,0BAA0BG,OAAO,cAAjCH,yDAAAA,mCAAmCM,qBAAqB,CAACb;YAClE;YAEAc;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,EAAEhB,KAAK;oBAC9CO;iBAAAA,qCAAAA,0BAA0BG,OAAO,cAAjCH,yDAAAA,mCAAmCU,0BAA0B,CAACD,gBAAgBhB;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): null => {\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 );\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,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,EAAEC,kBAAkB,EAAE,GAAGL;IACjG,MAAM,CAACM,OAAO,GAAGb;IAEjB,MAAMc,4BAA4Bb,MAAMc,MAAM,CAIpC;IAEVd,MAAMe,SAAS,CAAC;QACdF,0BAA0BG,OAAO,GAAG,IAAIZ,0BAKtCQ,QACAL,IACAJ,qBACAF,4BACAC,wBACAO,wBACAC;QAGF,OAAO;gBAAMG;oBAAAA,qCAAAA,0BAA0BG,OAAO,cAAjCH,yDAAAA,mCAAmCI,OAAO;;IACzD,GAAG;QAACL;QAAQL;QAAIE;QAAwBC;QAA0BC;KAAmB;IAErFX,MAAMkB,mBAAmB,CACvBV,YACA,IAAO,CAAA;YACLW,uBAAsBb,KAAK;oBAClBO;gBAAP,QAAOA,qCAAAA,0BAA0BG,OAAO,cAAjCH,yDAAAA,mCAAmCM,qBAAqB,CAACb;YAClE;YAEAc;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,EAAEhB,KAAK;oBAC9CO;iBAAAA,qCAAAA,0BAA0BG,OAAO,cAAjCH,yDAAAA,mCAAmCU,0BAA0B,CAACD,gBAAgBhB;YAChF;QACF,CAAA,GACA,EAAE;IAEJ,OAAO;AACT,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["GhostText.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useLexicalComposerContext } from '@fluentui-copilot/react-text-editor';\nimport type { LexicalEditor, EditorState } from '@fluentui-copilot/text-editor';\nimport type { GhostTextProps } from '../../GhostText';\nimport { $createGhostTextNode } from '../../GhostText';\nimport { GhostTextNode } from './GhostText.node';\nimport { GhostTextPluginBase } from '@fluentui-copilot/chat-input-plugins';\n\nexport type GhostTextPluginProps = {\n id: string;\n $getGhostText: (\n editor: LexicalEditor,\n editorState: EditorState,\n prevEditorState: EditorState,\n ) => Promise<string | undefined>;\n ghostTextProps?: GhostTextProps;\n // Whether or not the ghost text should count as text inside the input for submitting and character count\n exposeText?: boolean;\n allowCompletion?: boolean;\n};\n\nexport function GhostTextPlugin(props: GhostTextPluginProps):
|
|
1
|
+
{"version":3,"sources":["GhostText.tsx"],"sourcesContent":["import * as React from 'react';\nimport type { JSXElement } from '@fluentui/react-components';\nimport { useLexicalComposerContext } from '@fluentui-copilot/react-text-editor';\nimport type { LexicalEditor, EditorState } from '@fluentui-copilot/text-editor';\nimport type { GhostTextProps } from '../../GhostText';\nimport { $createGhostTextNode } from '../../GhostText';\nimport { GhostTextNode } from './GhostText.node';\nimport { GhostTextPluginBase } from '@fluentui-copilot/chat-input-plugins';\n\nexport type GhostTextPluginProps = {\n id: string;\n $getGhostText: (\n editor: LexicalEditor,\n editorState: EditorState,\n prevEditorState: EditorState,\n ) => Promise<string | undefined>;\n ghostTextProps?: GhostTextProps;\n // Whether or not the ghost text should count as text inside the input for submitting and character count\n exposeText?: boolean;\n allowCompletion?: boolean;\n};\n\nexport function GhostTextPlugin(props: GhostTextPluginProps): JSXElement | null {\n 'use no memo';\n\n const { $getGhostText, id, ghostTextProps, exposeText, allowCompletion } = props;\n const [editor] = useLexicalComposerContext();\n\n const [ghostTextBase, setGhostTextBase] = React.useState<GhostTextPluginBase<GhostTextProps> | null>(null);\n\n React.useEffect(\n () => {\n setGhostTextBase(\n new GhostTextPluginBase(\n editor,\n id,\n $getGhostText,\n GhostTextNode,\n $createGhostTextNode,\n ghostTextProps,\n exposeText,\n allowCompletion,\n ),\n );\n\n return () => {\n setGhostTextBase(prev => {\n prev?.cleanup();\n return null;\n });\n };\n },\n // We can update $getGhostText, $createGhostTextNode, ghostTextProps, exposeText, and allowCompletion without remounting\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [editor, id],\n );\n\n React.useEffect(() => {\n ghostTextBase?.setAllowCompletion(allowCompletion);\n }, [allowCompletion, ghostTextBase]);\n\n React.useEffect(() => {\n ghostTextBase?.setComponentProps(ghostTextProps);\n }, [ghostTextBase, ghostTextProps]);\n\n React.useEffect(() => {\n ghostTextBase?.setExposeText(exposeText);\n }, [exposeText, ghostTextBase]);\n\n React.useEffect(() => {\n ghostTextBase?.setGetGhostText($getGhostText);\n }, [$getGhostText, ghostTextBase]);\n\n return null;\n}\n"],"names":["React","useLexicalComposerContext","$createGhostTextNode","GhostTextNode","GhostTextPluginBase","GhostTextPlugin","props","$getGhostText","id","ghostTextProps","exposeText","allowCompletion","editor","ghostTextBase","setGhostTextBase","useState","useEffect","prev","cleanup","setAllowCompletion","setComponentProps","setExposeText","setGetGhostText"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,YAAYA,WAAW,QAAQ;AAE/B,SAASC,yBAAyB,QAAQ,sCAAsC;AAGhF,SAASC,oBAAoB,QAAQ,kBAAkB;AACvD,SAASC,aAAa,QAAQ,mBAAmB;AACjD,SAASC,mBAAmB,QAAQ,uCAAuC;AAe3E,OAAO,SAASC,gBAAgBC,KAA2B;IACzD;IAEA,MAAM,EAAEC,aAAa,EAAEC,EAAE,EAAEC,cAAc,EAAEC,UAAU,EAAEC,eAAe,EAAE,GAAGL;IAC3E,MAAM,CAACM,OAAO,GAAGX;IAEjB,MAAM,CAACY,eAAeC,iBAAiB,GAAGd,MAAMe,QAAQ,CAA6C;IAErGf,MAAMgB,SAAS,CACb;QACEF,iBACE,IAAIV,oBACFQ,QACAJ,IACAD,eACAJ,eACAD,sBACAO,gBACAC,YACAC;QAIJ,OAAO;YACLG,iBAAiBG,CAAAA;gBACfA,iBAAAA,2BAAAA,KAAMC,OAAO;gBACb,OAAO;YACT;QACF;IACF,GACA,wHAAwH;IACxH,uDAAuD;IACvD;QAACN;QAAQJ;KAAG;IAGdR,MAAMgB,SAAS,CAAC;QACdH,0BAAAA,oCAAAA,cAAeM,kBAAkB,CAACR;IACpC,GAAG;QAACA;QAAiBE;KAAc;IAEnCb,MAAMgB,SAAS,CAAC;QACdH,0BAAAA,oCAAAA,cAAeO,iBAAiB,CAACX;IACnC,GAAG;QAACI;QAAeJ;KAAe;IAElCT,MAAMgB,SAAS,CAAC;QACdH,0BAAAA,oCAAAA,cAAeQ,aAAa,CAACX;IAC/B,GAAG;QAACA;QAAYG;KAAc;IAE9Bb,MAAMgB,SAAS,CAAC;QACdH,0BAAAA,oCAAAA,cAAeS,eAAe,CAACf;IACjC,GAAG;QAACA;QAAeM;KAAc;IAEjC,OAAO;AACT"}
|
|
@@ -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<
|
|
1
|
+
{"version":3,"sources":["GhostText.node.tsx"],"sourcesContent":["import * as React from 'react';\nimport type { JSXElement } from '@fluentui/react-components';\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<JSXElement | 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(): boolean {\n return true;\n }\n\n isIsolated(): boolean {\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(): JSXElement | 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;AAG/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,WAAoB;QAClB,OAAO;IACT;IAEAC,aAAsB;QACpB,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,WAA8B;QAC5B,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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["PasteUnfurling.ts"],"sourcesContent":["import * as React from 'react';\nimport { registerPasteUnfurlingPlugin, type PasteUnfurlingPluginBaseProps } from '@fluentui-copilot/chat-input-plugins';\nimport { $createChatInputEntityNode, type ChatInputEntityProps } from '../../ChatInputEntity';\nimport { useLexicalComposerContext } from '@fluentui-copilot/react-text-editor';\n\nexport type PasteUnfurlingPluginProps<ExtraDataType> = Omit<\n PasteUnfurlingPluginBaseProps<ExtraDataType, ChatInputEntityProps>,\n '$createEntityNode'\n> &\n Pick<Partial<PasteUnfurlingPluginBaseProps<ExtraDataType, ChatInputEntityProps>>, '$createEntityNode'>;\n\nexport const PasteUnfurlingPlugin = <ExtraDataType>(props: PasteUnfurlingPluginProps<ExtraDataType>) => {\n const { $createEntityNode = $createChatInputEntityNode, ...rest } = props;\n\n const [editor] = useLexicalComposerContext();\n\n React.useEffect(() => {\n return registerPasteUnfurlingPlugin(editor, { ...rest, $createEntityNode });\n }, [$createEntityNode, editor, rest]);\n\n return null;\n};\n"],"names":["React","registerPasteUnfurlingPlugin","$createChatInputEntityNode","useLexicalComposerContext","PasteUnfurlingPlugin","props","$createEntityNode","rest","editor","useEffect"],"rangeMappings":";;;;;;;;;;;;;;;;;;","mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,4BAA4B,QAA4C,uCAAuC;AACxH,SAASC,0BAA0B,QAAmC,wBAAwB;AAC9F,SAASC,yBAAyB,QAAQ,sCAAsC;AAQhF,OAAO,MAAMC,uBAAuB,CAAgBC;IAClD,MAAM,EAAEC,oBAAoBJ,0BAA0B,EAAE,GAAGK,MAAM,GAAGF;IAEpE,MAAM,CAACG,OAAO,GAAGL;IAEjBH,MAAMS,SAAS,CAAC;QACd,OAAOR,6BAA6BO,QAAQ;YAAE,GAAGD,IAAI;YAAED;QAAkB;IAC3E,GAAG;QAACA;QAAmBE;QAAQD;KAAK;IAEpC,OAAO;AACT,EAAE"}
|
|
1
|
+
{"version":3,"sources":["PasteUnfurling.ts"],"sourcesContent":["import * as React from 'react';\nimport { registerPasteUnfurlingPlugin, type PasteUnfurlingPluginBaseProps } from '@fluentui-copilot/chat-input-plugins';\nimport { $createChatInputEntityNode, type ChatInputEntityProps } from '../../ChatInputEntity';\nimport { useLexicalComposerContext } from '@fluentui-copilot/react-text-editor';\n\nexport type PasteUnfurlingPluginProps<ExtraDataType> = Omit<\n PasteUnfurlingPluginBaseProps<ExtraDataType, ChatInputEntityProps>,\n '$createEntityNode'\n> &\n Pick<Partial<PasteUnfurlingPluginBaseProps<ExtraDataType, ChatInputEntityProps>>, '$createEntityNode'>;\n\nexport const PasteUnfurlingPlugin = <ExtraDataType>(props: PasteUnfurlingPluginProps<ExtraDataType>): null => {\n const { $createEntityNode = $createChatInputEntityNode, ...rest } = props;\n\n const [editor] = useLexicalComposerContext();\n\n React.useEffect(() => {\n return registerPasteUnfurlingPlugin(editor, { ...rest, $createEntityNode });\n }, [$createEntityNode, editor, rest]);\n\n return null;\n};\n"],"names":["React","registerPasteUnfurlingPlugin","$createChatInputEntityNode","useLexicalComposerContext","PasteUnfurlingPlugin","props","$createEntityNode","rest","editor","useEffect"],"rangeMappings":";;;;;;;;;;;;;;;;;;","mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,4BAA4B,QAA4C,uCAAuC;AACxH,SAASC,0BAA0B,QAAmC,wBAAwB;AAC9F,SAASC,yBAAyB,QAAQ,sCAAsC;AAQhF,OAAO,MAAMC,uBAAuB,CAAgBC;IAClD,MAAM,EAAEC,oBAAoBJ,0BAA0B,EAAE,GAAGK,MAAM,GAAGF;IAEpE,MAAM,CAACG,OAAO,GAAGL;IAEjBH,MAAMS,SAAS,CAAC;QACd,OAAOR,6BAA6BO,QAAQ;YAAE,GAAGD,IAAI;YAAED;QAAkB;IAC3E,GAAG;QAACA;QAAmBE;QAAQD;KAAK;IAEpC,OAAO;AACT,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["renderChatInputEntity.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-components';\nimport type { ChatInputEntityState, ChatInputEntitySlots } from './ChatInputEntity.types';\n\n/**\n * Render the final JSX of ChatInputEntity\n */\nexport const renderChatInputEntity_unstable = (state: ChatInputEntityState) => {\n assertSlots<ChatInputEntitySlots>(state);\n\n return (\n <state.root>\n {state.text && <state.text />}\n {state.sensitivity && <state.sensitivity />}\n </state.root>\n );\n};\n"],"names":["renderChatInputEntity_unstable","state","assertSlots","_jsxs","root","text","_jsx","sensitivity"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;","mappings":";;;;+
|
|
1
|
+
{"version":3,"sources":["renderChatInputEntity.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-components';\nimport type { JSXElement } from '@fluentui/react-components';\nimport type { ChatInputEntityState, ChatInputEntitySlots } from './ChatInputEntity.types';\n\n/**\n * Render the final JSX of ChatInputEntity\n */\nexport const renderChatInputEntity_unstable = (state: ChatInputEntityState): JSXElement => {\n assertSlots<ChatInputEntitySlots>(state);\n\n return (\n <state.root>\n {state.text && <state.text />}\n {state.sensitivity && <state.sensitivity />}\n </state.root>\n );\n};\n"],"names":["renderChatInputEntity_unstable","state","assertSlots","_jsxs","root","text","_jsx","sensitivity"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAUaA;;;eAAAA;;;4BATb;iCAE4B;AAOrB,MAAMA,iCAAiC,CAACC;IAC7CC,IAAAA,4BAAAA,EAAkCD;IAElC,OAAA,WAAA,GACEE,IAAAA,gBAAA,EAACF,MAAMG,IAAI,EAAA;;YACRH,MAAMI,IAAI,IAAA,WAAA,GAAIC,IAAAA,eAAA,EAACL,MAAMI,IAAI,EAAA,CAAA;YACzBJ,MAAMM,WAAW,IAAA,WAAA,GAAID,IAAAA,eAAA,EAACL,MAAMM,WAAW,EAAA,CAAA;;;AAG9C"}
|
|
@@ -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<
|
|
1
|
+
{"version":3,"sources":["ChatInputToken.node.tsx"],"sourcesContent":["import * as React from 'react';\nimport type { JSXElement } from '@fluentui/react-components';\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<JSXElement | 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(): boolean {\n return true;\n }\n isInline(): boolean {\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(): boolean {\n return false;\n }\n\n decorate(_editor: LexicalEditor, config: EditorConfig): JSXElement | 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;;IAlEHC,kBAAAA;eAAAA;;;;;iEApBU;4BAGO;gCAUC;AAOxB,MAAMA,2BAA2BC,yBAAAA;IAItC,OAAOC,UAAkB;QACvB,OAAO;IACT;IACA,OAAOC,MAAMC,IAAwB,EAAsB;QACzD,OAAO,IAAIJ,mBAAmBI,KAAKC,MAAM,EAAED,KAAKE,gBAAgB,EAAEF,KAAKG,KAAK;IAC9E;IAEA,OAAOC,WAAWC,cAA4C,EAAsB;QAClF,OAAOX,0BAA0BW,eAAeC,IAAI,EAAED,eAAeE,cAAc;IACrF;IAEAC,aAAsB;QACpB,OAAO;IACT;IACAC,WAAoB;QAClB,OAAO;IACT;IAEAC,iBAAyB;QACvB,OAAO,IAAI,CAACT,MAAM;IACpB;IAEAU,aAA2C;QACzC,OAAO;YACLL,MAAM,IAAI,CAACL,MAAM;YACjBM,gBAAgB,IAAI,CAACL,gBAAgB;YACrCU,MAAMhB,mBAAmBE,OAAO;YAChCe,SAAS;QACX;IACF;IAQAC,YAAyB;QACvB,iDAAiD;QACjD,OAAOC,SAASC,aAAa,CAAC;IAChC;IAEAC,YAAqB;QACnB,OAAO;IACT;IAEAC,SAASC,OAAsB,EAAEC,MAAoB,EAAqB;YACpEC;QAAJ,IAAA,AAAIA,CAAAA,yBAAA,IAAI,CAACnB,gBAAgB,AAAhBA,MAAgB,QAArBmB,2BAAA,KAAA,IAAA,KAAA,IAAAA,uBAAuBC,QAAQ,EAAE;YACnC,OAAA,WAAA,GAAOC,OAAAP,aAAA,CAACQ,8BAAAA,EAAmB,IAAI,CAACtB,gBAAgB;QAClD;QACA,OAAA,WAAA,GAAOqB,OAAAP,aAAA,CAACQ,8BAAAA,EAAmB,IAAI,CAACtB,gBAAgB,EAAG,IAAI,CAACD,MAAM;IAChE;IApBAwB,YAAYnB,IAAY,EAAEC,cAAoC,EAAEmB,GAAa,CAAE;QAC7E,KAAK,CAACA;QAnCRzB,IAAAA,kBAAAA,EAAAA,IAAAA,EAAAA,UAAAA,KAAAA;QACAC,IAAAA,kBAAAA,EAAAA,IAAAA,EAAAA,oBAAAA,KAAAA;QAmCE,IAAI,CAACD,MAAM,GAAGK;QACd,IAAI,CAACJ,gBAAgB,GAAGK;IAC1B;AAiBF;AAEO,SAASb,0BACdY,IAAY,EACZC,cAAoC,EACpCmB,GAAa;IAEb,OAAO,IAAI9B,mBAAmBU,MAAMC,gBAAgBmB;AACtD;AAEO,SAAS/B,sBAAsBK,IAAoC;IACxE,OAAOA,gBAAgBJ;AACzB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["renderChatInputToken.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-components';\nimport type { ChatInputTokenState, ChatInputTokenSlots } from './ChatInputToken.types';\n\n/**\n * Render the final JSX of ChatInputToken\n */\nexport const renderChatInputToken_unstable = (state: ChatInputTokenState) => {\n assertSlots<ChatInputTokenSlots>(state);\n\n return <state.root />;\n};\n"],"names":["renderChatInputToken_unstable","state","assertSlots","_jsx","root"],"rangeMappings":";;;;;;;;;;;;;;;","mappings":";;;;+
|
|
1
|
+
{"version":3,"sources":["renderChatInputToken.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-components';\nimport type { JSXElement } from '@fluentui/react-components';\nimport type { ChatInputTokenState, ChatInputTokenSlots } from './ChatInputToken.types';\n\n/**\n * Render the final JSX of ChatInputToken\n */\nexport const renderChatInputToken_unstable = (state: ChatInputTokenState): JSXElement => {\n assertSlots<ChatInputTokenSlots>(state);\n\n return <state.root />;\n};\n"],"names":["renderChatInputToken_unstable","state","assertSlots","_jsx","root"],"rangeMappings":";;;;;;;;;;;;;;;","mappings":";;;;+BAUaA;;;eAAAA;;;4BATb;iCAE4B;AAOrB,MAAMA,gCAAgC,CAACC;IAC5CC,IAAAA,4BAAAA,EAAiCD;IAEjC,OAAA,WAAA,GAAOE,IAAAA,eAAA,EAACF,MAAMG,IAAI,EAAA,CAAA;AACpB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["renderGhostText.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-components';\nimport type { GhostTextState, GhostTextSlots } from './GhostText.types';\n\n/**\n * Render the final JSX of GhostText\n */\nexport const renderGhostText_unstable = (state: GhostTextState) => {\n assertSlots<GhostTextSlots>(state);\n\n return (\n <state.root>\n {state.root.children}\n {state.indicator && <state.indicator />}\n </state.root>\n );\n};\n"],"names":["renderGhostText_unstable","state","assertSlots","_jsxs","root","children","indicator","_jsx"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;","mappings":";;;;+
|
|
1
|
+
{"version":3,"sources":["renderGhostText.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-components';\nimport type { JSXElement } from '@fluentui/react-components';\nimport type { GhostTextState, GhostTextSlots } from './GhostText.types';\n\n/**\n * Render the final JSX of GhostText\n */\nexport const renderGhostText_unstable = (state: GhostTextState): JSXElement => {\n assertSlots<GhostTextSlots>(state);\n\n return (\n <state.root>\n {state.root.children}\n {state.indicator && <state.indicator />}\n </state.root>\n );\n};\n"],"names":["renderGhostText_unstable","state","assertSlots","_jsxs","root","children","indicator","_jsx"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAUaA;;;eAAAA;;;4BATb;iCAE4B;AAOrB,MAAMA,2BAA2B,CAACC;IACvCC,IAAAA,4BAAAA,EAA4BD;IAE5B,OAAA,WAAA,GACEE,IAAAA,gBAAA,EAACF,MAAMG,IAAI,EAAA;;YACRH,MAAMG,IAAI,CAACC,QAAQ;YACnBJ,MAAMK,SAAS,IAAA,WAAA,GAAIC,IAAAA,eAAA,EAACN,MAAMK,SAAS,EAAA,CAAA;;;AAG1C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useGhostText.ts"],"sourcesContent":["import * as React from 'react';\nimport { getIntrinsicElementProps, mergeCallbacks, slot } from '@fluentui/react-components';\nimport type { GhostTextProps, GhostTextState } from './GhostText.types';\nimport { $getNodeByKey, useLexicalComposerContext } from '@fluentui-copilot/react-text-editor';\n\n// If you add JSX to this file, be sure to change the file type to .tsx\n\n/**\n * Create the state required to render GhostText.\n *\n * The returned state can be modified with hooks such as useGhostTextStyles_unstable,\n * before being passed to renderGhostText_unstable.\n *\n * @param props - props from this instance of GhostText\n * @param ref - reference to root HTMLElement of GhostText\n */\nexport const useGhostText_unstable = (props: GhostTextProps, ref: React.Ref<HTMLSpanElement>): GhostTextState => {\n const { nodeKey, onClick, ...rest } = props;\n const [editor] = useLexicalComposerContext();\n\n const handleClick = React.useCallback(\n _ev => {\n if (!nodeKey) {\n return;\n }\n\n editor.update(\n () => {\n const node = $getNodeByKey(nodeKey);\n node?.getPreviousSibling()?.selectEnd();\n },\n { tag: 'historic' },\n );\n },\n [editor, nodeKey],\n );\n\n const mergedOnClick = mergeCallbacks(handleClick, onClick);\n\n const state: GhostTextState = {\n components: {\n root: 'span',\n indicator: 'span',\n },\n root: slot.always(\n getIntrinsicElementProps('span', {\n ref,\n onClick: mergedOnClick,\n ...rest,\n }),\n { elementType: 'span' },\n ),\n indicator: slot.optional(props.indicator, { elementType: 'span' }),\n };\n\n return state;\n};\n"],"names":["useGhostText_unstable","props","ref","nodeKey","onClick","rest","editor","useLexicalComposerContext","handleClick","React","useCallback","_ev","update","node","$getNodeByKey","getPreviousSibling","selectEnd","tag","mergedOnClick","mergeCallbacks","state","components","root","indicator","slot","always","getIntrinsicElementProps","elementType","optional"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAgBaA;;;eAAAA;;;;iEAhBU;iCACwC;iCAEN;AAalD,MAAMA,wBAAwB,CAACC,OAAuBC;IAC3D,MAAM,EAAEC,OAAO,EAAEC,OAAO,EAAE,GAAGC,MAAM,GAAGJ;IACtC,MAAM,CAACK,OAAO,GAAGC,IAAAA,0CAAAA;IAEjB,MAAMC,cAAcC,OAAMC,WAAW,
|
|
1
|
+
{"version":3,"sources":["useGhostText.ts"],"sourcesContent":["import * as React from 'react';\nimport { getIntrinsicElementProps, mergeCallbacks, slot } from '@fluentui/react-components';\nimport type { GhostTextProps, GhostTextState } from './GhostText.types';\nimport { $getNodeByKey, useLexicalComposerContext } from '@fluentui-copilot/react-text-editor';\n\n// If you add JSX to this file, be sure to change the file type to .tsx\n\n/**\n * Create the state required to render GhostText.\n *\n * The returned state can be modified with hooks such as useGhostTextStyles_unstable,\n * before being passed to renderGhostText_unstable.\n *\n * @param props - props from this instance of GhostText\n * @param ref - reference to root HTMLElement of GhostText\n */\nexport const useGhostText_unstable = (props: GhostTextProps, ref: React.Ref<HTMLSpanElement>): GhostTextState => {\n const { nodeKey, onClick, ...rest } = props;\n const [editor] = useLexicalComposerContext();\n\n const handleClick = React.useCallback(\n (_ev: React.MouseEvent<HTMLElement>) => {\n if (!nodeKey) {\n return;\n }\n\n editor.update(\n () => {\n const node = $getNodeByKey(nodeKey);\n node?.getPreviousSibling()?.selectEnd();\n },\n { tag: 'historic' },\n );\n },\n [editor, nodeKey],\n );\n\n const mergedOnClick = mergeCallbacks(handleClick, onClick);\n\n const state: GhostTextState = {\n components: {\n root: 'span',\n indicator: 'span',\n },\n root: slot.always(\n getIntrinsicElementProps('span', {\n ref,\n onClick: mergedOnClick,\n ...rest,\n }),\n { elementType: 'span' },\n ),\n indicator: slot.optional(props.indicator, { elementType: 'span' }),\n };\n\n return state;\n};\n"],"names":["useGhostText_unstable","props","ref","nodeKey","onClick","rest","editor","useLexicalComposerContext","handleClick","React","useCallback","_ev","update","node","$getNodeByKey","getPreviousSibling","selectEnd","tag","mergedOnClick","mergeCallbacks","state","components","root","indicator","slot","always","getIntrinsicElementProps","elementType","optional"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAgBaA;;;eAAAA;;;;iEAhBU;iCACwC;iCAEN;AAalD,MAAMA,wBAAwB,CAACC,OAAuBC;IAC3D,MAAM,EAAEC,OAAO,EAAEC,OAAO,EAAE,GAAGC,MAAM,GAAGJ;IACtC,MAAM,CAACK,OAAO,GAAGC,IAAAA,0CAAAA;IAEjB,MAAMC,cAAcC,OAAMC,WAAW,CACnC,CAACC;QACC,IAAI,CAACR,SAAS;YACZ;QACF;QAEAG,OAAOM,MAAM,CACX;gBAEEC;YADA,MAAMA,OAAOC,IAAAA,8BAAAA,EAAcX;YAC3BU,SAAAA,QAAAA,SAAAA,KAAAA,IAAAA,KAAAA,IAAAA,CAAAA,2BAAAA,KAAME,kBAAkB,EAAA,MAAA,QAAxBF,6BAAAA,KAAAA,IAAAA,KAAAA,IAAAA,yBAA4BG,SAAS;QACvC,GACA;YAAEC,KAAK;QAAW;IAEtB,GACA;QAACX;QAAQH;KAAQ;IAGnB,MAAMe,gBAAgBC,IAAAA,+BAAAA,EAAeX,aAAaJ;IAElD,MAAMgB,QAAwB;QAC5BC,YAAY;YACVC,MAAM;YACNC,WAAW;QACb;QACAD,MAAME,qBAAAA,CAAKC,MAAM,CACfC,IAAAA,yCAAAA,EAAyB,QAAQ;YAC/BxB;YACAE,SAASc;YACT,GAAGb,IAAI;QACT,IACA;YAAEsB,aAAa;QAAO;QAExBJ,WAAWC,qBAAAA,CAAKI,QAAQ,CAAC3B,MAAMsB,SAAS,EAAE;YAAEI,aAAa;QAAO;IAClE;IAEA,OAAOP;AACT"}
|
|
@@ -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<
|
|
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 { JSXElement } from '@fluentui/react-components';\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<JSXElement | 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(): boolean {\n return true;\n }\n isInline(): boolean {\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(): boolean {\n return false;\n }\n\n decorate(_editor: LexicalEditor, config: EditorConfig): JSXElement | 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>): void {\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;;IA9FHC,mBAAAA;eAAAA;;;;;iEArBU;4BAEO;iCAWE;AAQzB,MAAMA,4BAA+BC,yBAAAA;IAM1C,OAAOC,UAAkB;QACvB,OAAO;IACT;IACA,OAAOC,MAASC,IAA4B,EAA0B;QACpE,OAAO,IAAIJ,oBAAoBI,KAAKC,UAAU,EAAED,KAAKE,MAAM,EAAEF,KAAKG,MAAM,EAAEH,KAAKI,aAAa,EAAEJ,KAAKK,KAAK;IAC1G;IAEA,OAAOC,WAAcC,cAAgD,EAA0B;QAC7F,OAAOb,2BACLa,eAAeC,QAAQ,EACvBD,eAAeE,IAAI,EACnBF,eAAeG,IAAI,EACnBH,eAAeI,WAAW;IAE9B;IAEAC,aAAsB;QACpB,OAAO;IACT;IACAC,WAAoB;QAClB,OAAO;IACT;IAEAC,iBAAyB;QACvB,OAAO,IAAI,CAACZ,MAAM;IACpB;IAEAa,aAA+C;QAC7C,OAAO;YACLP,UAAU,IAAI,CAACP,UAAU;YACzBQ,MAAM,IAAI,CAACP,MAAM;YACjBQ,MAAM,IAAI,CAACP,MAAM;YACjBQ,aAAa,IAAI,CAACP,aAAa;YAC/BY,MAAMpB,oBAAoBE,OAAO;YACjCmB,SAAS;QACX;IACF;IAUAC,YAAyB;QACvB,iDAAiD;QACjD,OAAOC,SAASC,aAAa,CAAC;IAChC;IAEAC,YAAqB;QACnB,OAAO;IACT;IAEAC,SAASC,OAAsB,EAAEC,MAAoB,EAAqB;YACpEC;QAAJ,IAAA,AAAIA,CAAAA,sBAAA,IAAI,CAACrB,aAAa,AAAbA,MAAa,QAAlBqB,wBAAA,KAAA,IAAA,KAAA,IAAAA,oBAAoBC,QAAQ,EAAE;YAChC,OAAA,WAAA,GAAOC,OAAAP,aAAA,CAACQ,gCAAAA,EAAoB,IAAI,CAACxB,aAAa;QAChD;QACA,OAAA,WAAA,GAAOuB,OAAAP,aAAA,CAACQ,gCAAAA,EAAoB,IAAI,CAACxB,aAAa,EAAG,IAAI,CAACF,MAAM;IAC9D;IAEA2B,gBAA8D;QAC5D,OAAO;YACLpB,MAAM,IAAI,CAACP,MAAM;YACjBQ,MAAM,IAAI,CAACP,MAAM;YACjBQ,aAAa,IAAI,CAACP,aAAa;QACjC;IACF;IAEA0B,iBAAiBpB,IAAkD,EAAQ;QACzE,MAAMqB,WAAW,IAAI,CAACC,WAAW;QACjCD,SAAS7B,MAAM,GAAGQ,KAAKD,IAAI;QAC3BsB,SAAS5B,MAAM,GAAGO,KAAKA,IAAI;QAC3BqB,SAAS3B,aAAa,GAAGM,KAAKC,WAAW;IAC3C;IArCAsB,YAAYzB,QAAgB,EAAEC,IAAY,EAAEC,IAAQ,EAAEC,WAAkC,EAAEuB,GAAa,CAAE;QACvG,KAAK,CAACA;QA5CRjC,IAAAA,kBAAAA,EAAAA,IAAAA,EAAAA,cAAAA,KAAAA;QACAC,IAAAA,kBAAAA,EAAAA,IAAAA,EAAAA,UAAAA,KAAAA;QACAE,IAAAA,kBAAAA,EAAAA,IAAAA,EAAAA,iBAAAA,KAAAA;QACAD,IAAAA,kBAAAA,EAAAA,IAAAA,EAAAA,UAAAA,KAAAA;QA0CE,IAAI,CAACF,UAAU,GAAGO;QAClB,IAAI,CAACN,MAAM,GAAGO;QACd,IAAI,CAACN,MAAM,GAAGO;QACd,IAAI,CAACN,aAAa,GAAGO;IACvB;AAgCF;AAEO,SAASjB,2BACdc,QAAgB,EAChBC,IAAY,EACZC,IAAQ,EACRC,WAAkC,EAClCuB,GAAa;IAEb,OAAO,IAAItC,oBAAoBY,UAAUC,MAAMC,MAAMC,aAAauB;AACpE;AAEO,SAASvC,uBAA0BK,IAAoC;IAC5E,OAAOA,gBAAgBJ;AACzB"}
|
|
@@ -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, 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 );\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","onChatInputEntityAdded","onChatInputEntityDeleted","skipInitialization","editor","useLexicalComposerContext","chatInputEntityPluginBase","React","useRef","useEffect","current","ChatInputEntityPluginBase","ChatInputEntityNode","$createChatInputEntityNode","$isChatInputEntityNode","cleanup","useImperativeHandle","insertChatInputEntity","getActiveEntities","removeChatInputEntity","keyOrPredicate","updateChatInputEntityProps"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAQaA;;;eAAAA;;;;iCAR6B;iEACnB;qCACiE;kCAG9C;AAGnC,MAAMA,wBAAwB,CACnCC;IAIA,MAAM,EAAEC,EAAE,EAAEC,UAAU,EAAEC,sBAAsB,EAAEC,wBAAwB,EAAEC,kBAAkB,EAAE,GAAGL;IACjG,MAAM,CAACM,OAAO,GAAGC,IAAAA,0CAAAA;IAEjB,MAAMC,4BAA4BC,OAAMC,MAAM,CAIpC;IAEVD,OAAME,SAAS,CAAC;QACdH,0BAA0BI,OAAO,GAAG,IAAIC,2CAAAA,CAKtCP,QACAL,IACAa,wCAAAA,EACAC,+CAAAA,EACAC,2CAAAA,EACAb,wBACAC;QAGF,OAAO;gBAAMI;mBAAAA,CAAAA,qCAAAA,0BAA0BI,OAAO,AAAPA,MAAO,QAAjCJ,uCAAAA,KAAAA,IAAAA,KAAAA,IAAAA,mCAAmCS,OAAO;;IACzD,GAAG;QAACX;QAAQL;QAAIE;QAAwBC;QAA0BC;KAAmB;IAErFI,OAAMS,mBAAmB,CACvBhB,YACA,IAAO,CAAA;YACLiB,uBAAsBnB,KAAK;oBAClBQ;gBAAP,OAAA,AAAOA,CAAAA,qCAAAA,0BAA0BI,OAAO,AAAPA,MAAO,QAAjCJ,uCAAAA,KAAAA,IAAAA,KAAAA,IAAAA,mCAAmCW,qBAAqB,CAACnB;YAClE;YAEAoB;oBACSZ;oBAAAA;gBAAP,OAAOA,CAAAA,uDAAAA,CAAAA,qCAAAA,0BAA0BI,OAAO,AAAPA,MAAO,QAAjCJ,uCAAAA,KAAAA,IAAAA,KAAAA,IAAAA,mCAAmCY,iBAAiB,EAAA,MAAA,QAApDZ,yDAAAA,KAAAA,IAAAA,uDAA0D,EAAE;YACrE;YAEAa,uBAAsBC,cAAc;oBAClCd;gBAAAA,CAAAA,qCAAAA,0BAA0BI,OAAO,AAAPA,MAAO,QAAjCJ,uCAAAA,KAAAA,IAAAA,KAAAA,IAAAA,mCAAmCa,qBAAqB,CAACC;YAC3D;YAEAC,4BAA2BD,cAAc,EAAEtB,KAAK;oBAC9CQ;gBAAAA,CAAAA,qCAAAA,0BAA0BI,OAAO,AAAPA,MAAO,QAAjCJ,uCAAAA,KAAAA,IAAAA,KAAAA,IAAAA,mCAAmCe,0BAA0B,CAACD,gBAAgBtB;YAChF;QACF,CAAA,GACA,EAAE;IAEJ,OAAO;AACT"}
|
|
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): null => {\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 );\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","onChatInputEntityAdded","onChatInputEntityDeleted","skipInitialization","editor","useLexicalComposerContext","chatInputEntityPluginBase","React","useRef","useEffect","current","ChatInputEntityPluginBase","ChatInputEntityNode","$createChatInputEntityNode","$isChatInputEntityNode","cleanup","useImperativeHandle","insertChatInputEntity","getActiveEntities","removeChatInputEntity","keyOrPredicate","updateChatInputEntityProps"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAQaA;;;eAAAA;;;;iCAR6B;iEACnB;qCACiE;kCAG9C;AAGnC,MAAMA,wBAAwB,CACnCC;IAIA,MAAM,EAAEC,EAAE,EAAEC,UAAU,EAAEC,sBAAsB,EAAEC,wBAAwB,EAAEC,kBAAkB,EAAE,GAAGL;IACjG,MAAM,CAACM,OAAO,GAAGC,IAAAA,0CAAAA;IAEjB,MAAMC,4BAA4BC,OAAMC,MAAM,CAIpC;IAEVD,OAAME,SAAS,CAAC;QACdH,0BAA0BI,OAAO,GAAG,IAAIC,2CAAAA,CAKtCP,QACAL,IACAa,wCAAAA,EACAC,+CAAAA,EACAC,2CAAAA,EACAb,wBACAC;QAGF,OAAO;gBAAMI;mBAAAA,CAAAA,qCAAAA,0BAA0BI,OAAO,AAAPA,MAAO,QAAjCJ,uCAAAA,KAAAA,IAAAA,KAAAA,IAAAA,mCAAmCS,OAAO;;IACzD,GAAG;QAACX;QAAQL;QAAIE;QAAwBC;QAA0BC;KAAmB;IAErFI,OAAMS,mBAAmB,CACvBhB,YACA,IAAO,CAAA;YACLiB,uBAAsBnB,KAAK;oBAClBQ;gBAAP,OAAA,AAAOA,CAAAA,qCAAAA,0BAA0BI,OAAO,AAAPA,MAAO,QAAjCJ,uCAAAA,KAAAA,IAAAA,KAAAA,IAAAA,mCAAmCW,qBAAqB,CAACnB;YAClE;YAEAoB;oBACSZ;oBAAAA;gBAAP,OAAOA,CAAAA,uDAAAA,CAAAA,qCAAAA,0BAA0BI,OAAO,AAAPA,MAAO,QAAjCJ,uCAAAA,KAAAA,IAAAA,KAAAA,IAAAA,mCAAmCY,iBAAiB,EAAA,MAAA,QAApDZ,yDAAAA,KAAAA,IAAAA,uDAA0D,EAAE;YACrE;YAEAa,uBAAsBC,cAAc;oBAClCd;gBAAAA,CAAAA,qCAAAA,0BAA0BI,OAAO,AAAPA,MAAO,QAAjCJ,uCAAAA,KAAAA,IAAAA,KAAAA,IAAAA,mCAAmCa,qBAAqB,CAACC;YAC3D;YAEAC,4BAA2BD,cAAc,EAAEtB,KAAK;oBAC9CQ;gBAAAA,CAAAA,qCAAAA,0BAA0BI,OAAO,AAAPA,MAAO,QAAjCJ,uCAAAA,KAAAA,IAAAA,KAAAA,IAAAA,mCAAmCe,0BAA0B,CAACD,gBAAgBtB;YAChF;QACF,CAAA,GACA,EAAE;IAEJ,OAAO;AACT"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["GhostText.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useLexicalComposerContext } from '@fluentui-copilot/react-text-editor';\nimport type { LexicalEditor, EditorState } from '@fluentui-copilot/text-editor';\nimport type { GhostTextProps } from '../../GhostText';\nimport { $createGhostTextNode } from '../../GhostText';\nimport { GhostTextNode } from './GhostText.node';\nimport { GhostTextPluginBase } from '@fluentui-copilot/chat-input-plugins';\n\nexport type GhostTextPluginProps = {\n id: string;\n $getGhostText: (\n editor: LexicalEditor,\n editorState: EditorState,\n prevEditorState: EditorState,\n ) => Promise<string | undefined>;\n ghostTextProps?: GhostTextProps;\n // Whether or not the ghost text should count as text inside the input for submitting and character count\n exposeText?: boolean;\n allowCompletion?: boolean;\n};\n\nexport function GhostTextPlugin(props: GhostTextPluginProps):
|
|
1
|
+
{"version":3,"sources":["GhostText.tsx"],"sourcesContent":["import * as React from 'react';\nimport type { JSXElement } from '@fluentui/react-components';\nimport { useLexicalComposerContext } from '@fluentui-copilot/react-text-editor';\nimport type { LexicalEditor, EditorState } from '@fluentui-copilot/text-editor';\nimport type { GhostTextProps } from '../../GhostText';\nimport { $createGhostTextNode } from '../../GhostText';\nimport { GhostTextNode } from './GhostText.node';\nimport { GhostTextPluginBase } from '@fluentui-copilot/chat-input-plugins';\n\nexport type GhostTextPluginProps = {\n id: string;\n $getGhostText: (\n editor: LexicalEditor,\n editorState: EditorState,\n prevEditorState: EditorState,\n ) => Promise<string | undefined>;\n ghostTextProps?: GhostTextProps;\n // Whether or not the ghost text should count as text inside the input for submitting and character count\n exposeText?: boolean;\n allowCompletion?: boolean;\n};\n\nexport function GhostTextPlugin(props: GhostTextPluginProps): JSXElement | null {\n 'use no memo';\n\n const { $getGhostText, id, ghostTextProps, exposeText, allowCompletion } = props;\n const [editor] = useLexicalComposerContext();\n\n const [ghostTextBase, setGhostTextBase] = React.useState<GhostTextPluginBase<GhostTextProps> | null>(null);\n\n React.useEffect(\n () => {\n setGhostTextBase(\n new GhostTextPluginBase(\n editor,\n id,\n $getGhostText,\n GhostTextNode,\n $createGhostTextNode,\n ghostTextProps,\n exposeText,\n allowCompletion,\n ),\n );\n\n return () => {\n setGhostTextBase(prev => {\n prev?.cleanup();\n return null;\n });\n };\n },\n // We can update $getGhostText, $createGhostTextNode, ghostTextProps, exposeText, and allowCompletion without remounting\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [editor, id],\n );\n\n React.useEffect(() => {\n ghostTextBase?.setAllowCompletion(allowCompletion);\n }, [allowCompletion, ghostTextBase]);\n\n React.useEffect(() => {\n ghostTextBase?.setComponentProps(ghostTextProps);\n }, [ghostTextBase, ghostTextProps]);\n\n React.useEffect(() => {\n ghostTextBase?.setExposeText(exposeText);\n }, [exposeText, ghostTextBase]);\n\n React.useEffect(() => {\n ghostTextBase?.setGetGhostText($getGhostText);\n }, [$getGhostText, ghostTextBase]);\n\n return null;\n}\n"],"names":["GhostTextPlugin","props","$getGhostText","id","ghostTextProps","exposeText","allowCompletion","editor","useLexicalComposerContext","ghostTextBase","setGhostTextBase","React","useState","useEffect","GhostTextPluginBase","GhostTextNode","$createGhostTextNode","prev","cleanup","setAllowCompletion","setComponentProps","setExposeText","setGetGhostText"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAsBgBA;;;eAAAA;;;;iEAtBO;iCAEmB;2BAGL;+BACP;kCACM;AAe7B,SAASA,gBAAgBC,KAA2B;IACzD;IAEA,MAAM,EAAEC,aAAa,EAAEC,EAAE,EAAEC,cAAc,EAAEC,UAAU,EAAEC,eAAe,EAAE,GAAGL;IAC3E,MAAM,CAACM,OAAO,GAAGC,IAAAA,0CAAAA;IAEjB,MAAM,CAACC,eAAeC,iBAAiB,GAAGC,OAAMC,QAAQ,CAA6C;IAErGD,OAAME,SAAS,CACb;QACEH,iBACE,IAAII,qCAAAA,CACFP,QACAJ,IACAD,eACAa,4BAAAA,EACAC,+BAAAA,EACAZ,gBACAC,YACAC;QAIJ,OAAO;YACLI,iBAAiBO,CAAAA;gBACfA,SAAAA,QAAAA,SAAAA,KAAAA,IAAAA,KAAAA,IAAAA,KAAMC,OAAO;gBACb,OAAO;YACT;QACF;IACF,GAEA,uDAAuD;IACvD;QAACX;QAAQJ;KAAG;IAGdQ,OAAME,SAAS,CAAC;QACdJ,kBAAAA,QAAAA,kBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,cAAeU,kBAAkB,CAACb;IACpC,GAAG;QAACA;QAAiBG;KAAc;IAEnCE,OAAME,SAAS,CAAC;QACdJ,kBAAAA,QAAAA,kBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,cAAeW,iBAAiB,CAAChB;IACnC,GAAG;QAACK;QAAeL;KAAe;IAElCO,OAAME,SAAS,CAAC;QACdJ,kBAAAA,QAAAA,kBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,cAAeY,aAAa,CAAChB;IAC/B,GAAG;QAACA;QAAYI;KAAc;IAE9BE,OAAME,SAAS,CAAC;QACdJ,kBAAAA,QAAAA,kBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,cAAea,eAAe,CAACpB;IACjC,GAAG;QAACA;QAAeO;KAAc;IAEjC,OAAO;AACT"}
|
|
@@ -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<
|
|
1
|
+
{"version":3,"sources":["GhostText.node.tsx"],"sourcesContent":["import * as React from 'react';\nimport type { JSXElement } from '@fluentui/react-components';\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<JSXElement | 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(): boolean {\n return true;\n }\n\n isIsolated(): boolean {\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(): JSXElement | 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;;IAnFHC,aAAAA;eAAAA;;;;;iEAlBU;4BAGO;2BAGJ;AAYnB,MAAMA,sBAAsBC,yBAAAA;IAOjC,OAAOC,MAAMC,IAAmB,EAAiB;QAC/C,OAAO,IAAIH,cAAcG,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,OAAOL,qBACXa,eAAeC,EAAE,EACjBD,eAAeE,OAAO,EACtBF,eAAeG,UAAU,EACzBH,eAAeI,cAAc;QAE/B,OAAOZ;IACT;IAEAa,aAAsC;QACpC,OAAO;YACLC,MAAM;YACNL,IAAI,IAAI,CAACR,IAAI;YACbS,SAAS,IAAI,CAACR,SAAS;YACvBU,gBAAgB,IAAI,CAACR,gBAAgB;YACrCO,YAAY,IAAI,CAACR,YAAY;YAC7BY,SAAS;QACX;IACF;IAUAC,WAAoB;QAClB,OAAO;IACT;IAEAC,aAAsB;QACpB,OAAO;IACT;IAEAC,iBAAyB;QACvB,OAAO,IAAI,CAACf,YAAY,GAAG,IAAI,CAACD,SAAS,GAAG;IAC9C;IAEAiB,UAAUC,QAAiB,EAAEC,GAAgB,EAAEC,MAAoB,EAAW;QAC5E,OAAO;IACT;IAEAC,UAAUD,MAAoB,EAAe;QAC3C,iDAAiD;QACjD,OAAOE,SAASC,aAAa,CAAC;IAChC;IAEAC,WAA8B;QAC5B,OAAA,WAAA,GACEC,OAAAF,aAAA,CAACG,oBAAAA,EAAAA;YAAUC,SAAS,IAAI,CAACC,MAAM;YAAK,GAAG,IAAI,CAAC1B,gBAAgB;WACzD,IAAI,CAACF,SAAS;IAGrB;IAnCA6B,YAAYtB,EAAU,EAAEC,OAAe,EAAEC,UAAoB,EAAEC,cAA+B,EAAEoB,GAAa,CAAE;QAC7G,KAAK,CAACA;QApCR9B,IAAAA,kBAAAA,EAAAA,IAAAA,EAAAA,aAAAA,KAAAA;QACAD,IAAAA,kBAAAA,EAAAA,IAAAA,EAAAA,QAAAA,KAAAA;QACAgC,IAAAA,kBAAAA,EAAAA,IAAAA,EAAAA,qBAAAA,KAAAA;QACA7B,IAAAA,kBAAAA,EAAAA,IAAAA,EAAAA,oBAAAA,KAAAA;QACAD,IAAAA,kBAAAA,EAAAA,IAAAA,EAAAA,gBAAAA,KAAAA;QAiCE,IAAI,CAACF,IAAI,GAAGQ;QACZ,IAAI,CAACP,SAAS,GAAGQ;QACjB,IAAI,CAACP,YAAY,GAAGQ;QACpB,IAAI,CAACP,gBAAgB,GAAGQ;IAC1B;AA8BF;AAEO,SAASjB,qBACdc,EAAU,EACVC,OAAe,EACfC,UAAoB,EACpBC,cAA+B;IAE/B,OAAO,IAAIf,cAAcY,IAAIC,SAASC,YAAYC;AACpD;AAEO,SAAShB,iBAAiBI,IAAoC;IACnE,OAAOA,gBAAgBH;AACzB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["PasteUnfurling.ts"],"sourcesContent":["import * as React from 'react';\nimport { registerPasteUnfurlingPlugin, type PasteUnfurlingPluginBaseProps } from '@fluentui-copilot/chat-input-plugins';\nimport { $createChatInputEntityNode, type ChatInputEntityProps } from '../../ChatInputEntity';\nimport { useLexicalComposerContext } from '@fluentui-copilot/react-text-editor';\n\nexport type PasteUnfurlingPluginProps<ExtraDataType> = Omit<\n PasteUnfurlingPluginBaseProps<ExtraDataType, ChatInputEntityProps>,\n '$createEntityNode'\n> &\n Pick<Partial<PasteUnfurlingPluginBaseProps<ExtraDataType, ChatInputEntityProps>>, '$createEntityNode'>;\n\nexport const PasteUnfurlingPlugin = <ExtraDataType>(props: PasteUnfurlingPluginProps<ExtraDataType>) => {\n const { $createEntityNode = $createChatInputEntityNode, ...rest } = props;\n\n const [editor] = useLexicalComposerContext();\n\n React.useEffect(() => {\n return registerPasteUnfurlingPlugin(editor, { ...rest, $createEntityNode });\n }, [$createEntityNode, editor, rest]);\n\n return null;\n};\n"],"names":["PasteUnfurlingPlugin","props","$createEntityNode","$createChatInputEntityNode","rest","editor","useLexicalComposerContext","React","useEffect","registerPasteUnfurlingPlugin"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAWaA;;;eAAAA;;;;iEAXU;kCAC0D;iCACX;iCAC5B;AAQnC,MAAMA,uBAAuB,CAAgBC;IAClD,MAAM,EAAEC,oBAAoBC,2CAA0B,EAAE,GAAGC,MAAM,GAAGH;IAEpE,MAAM,CAACI,OAAO,GAAGC,IAAAA,0CAAAA;IAEjBC,OAAMC,SAAS,CAAC;QACd,OAAOC,IAAAA,8CAAAA,EAA6BJ,QAAQ;YAAE,GAAGD,IAAI;YAAEF;QAAkB;IAC3E,GAAG;QAACA;QAAmBG;QAAQD;KAAK;IAEpC,OAAO;AACT"}
|
|
1
|
+
{"version":3,"sources":["PasteUnfurling.ts"],"sourcesContent":["import * as React from 'react';\nimport { registerPasteUnfurlingPlugin, type PasteUnfurlingPluginBaseProps } from '@fluentui-copilot/chat-input-plugins';\nimport { $createChatInputEntityNode, type ChatInputEntityProps } from '../../ChatInputEntity';\nimport { useLexicalComposerContext } from '@fluentui-copilot/react-text-editor';\n\nexport type PasteUnfurlingPluginProps<ExtraDataType> = Omit<\n PasteUnfurlingPluginBaseProps<ExtraDataType, ChatInputEntityProps>,\n '$createEntityNode'\n> &\n Pick<Partial<PasteUnfurlingPluginBaseProps<ExtraDataType, ChatInputEntityProps>>, '$createEntityNode'>;\n\nexport const PasteUnfurlingPlugin = <ExtraDataType>(props: PasteUnfurlingPluginProps<ExtraDataType>): null => {\n const { $createEntityNode = $createChatInputEntityNode, ...rest } = props;\n\n const [editor] = useLexicalComposerContext();\n\n React.useEffect(() => {\n return registerPasteUnfurlingPlugin(editor, { ...rest, $createEntityNode });\n }, [$createEntityNode, editor, rest]);\n\n return null;\n};\n"],"names":["PasteUnfurlingPlugin","props","$createEntityNode","$createChatInputEntityNode","rest","editor","useLexicalComposerContext","React","useEffect","registerPasteUnfurlingPlugin"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAWaA;;;eAAAA;;;;iEAXU;kCAC0D;iCACX;iCAC5B;AAQnC,MAAMA,uBAAuB,CAAgBC;IAClD,MAAM,EAAEC,oBAAoBC,2CAA0B,EAAE,GAAGC,MAAM,GAAGH;IAEpE,MAAM,CAACI,OAAO,GAAGC,IAAAA,0CAAAA;IAEjBC,OAAMC,SAAS,CAAC;QACd,OAAOC,IAAAA,8CAAAA,EAA6BJ,QAAQ;YAAE,GAAGD,IAAI;YAAEF;QAAkB;IAC3E,GAAG;QAACA;QAAmBG;QAAQD;KAAK;IAEpC,OAAO;AACT"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluentui-copilot/react-chat-input-plugins",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.6",
|
|
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,20 +12,20 @@
|
|
|
12
12
|
},
|
|
13
13
|
"license": "MIT",
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@fluentui-copilot/chat-input-plugins": "^0.5.
|
|
15
|
+
"@fluentui-copilot/chat-input-plugins": "^0.5.2",
|
|
16
16
|
"@fluentui-copilot/react-text-editor": "^0.4.2",
|
|
17
17
|
"@fluentui-copilot/text-editor": "^0.3.2",
|
|
18
|
-
"@fluentui-copilot/tokens": "^0.3.
|
|
18
|
+
"@fluentui-copilot/tokens": "^0.3.15",
|
|
19
19
|
"@swc/helpers": "^0.5.1"
|
|
20
20
|
},
|
|
21
21
|
"peerDependencies": {
|
|
22
|
-
"@fluentui/react-components": ">=9.
|
|
23
|
-
"@fluentui/react-jsx-runtime": ">=9.
|
|
24
|
-
"@fluentui/react-utilities": ">=9.
|
|
25
|
-
"@types/react": ">=16.14.0 <
|
|
26
|
-
"@types/react-dom": ">=16.9.8 <
|
|
27
|
-
"react": ">=16.14.0 <
|
|
28
|
-
"react-dom": ">=16.14.0 <
|
|
22
|
+
"@fluentui/react-components": ">=9.70.0 <10.0.0",
|
|
23
|
+
"@fluentui/react-jsx-runtime": ">=9.2.0 <10.0.0",
|
|
24
|
+
"@fluentui/react-utilities": ">=9.24.1 <10.0.0",
|
|
25
|
+
"@types/react": ">=16.14.0 <20.0.0",
|
|
26
|
+
"@types/react-dom": ">=16.9.8 <20.0.0",
|
|
27
|
+
"react": ">=16.14.0 <20.0.0",
|
|
28
|
+
"react-dom": ">=16.14.0 <20.0.0"
|
|
29
29
|
},
|
|
30
30
|
"beachball": {
|
|
31
31
|
"disallowedChangeTypes": [
|