@fluentui-copilot/react-chat-input-plugins 0.0.0-nightly-20240410-0405-8d7a6b79.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.json +38 -0
- package/CHANGELOG.md +16 -0
- package/LICENSE +23 -0
- package/README.md +5 -0
- package/dist/index.d.ts +295 -0
- package/lib/BasicFunctionality.js +2 -0
- package/lib/BasicFunctionality.js.map +1 -0
- package/lib/ChatInputEntity.js +3 -0
- package/lib/ChatInputEntity.js.map +1 -0
- package/lib/ChatInputToken.js +2 -0
- package/lib/ChatInputToken.js.map +1 -0
- package/lib/GhostText.js +4 -0
- package/lib/GhostText.js.map +1 -0
- package/lib/ImperativeControl.js +2 -0
- package/lib/ImperativeControl.js.map +1 -0
- package/lib/components/ChatInputEntity/ChatInputEntity.js +12 -0
- package/lib/components/ChatInputEntity/ChatInputEntity.js.map +1 -0
- package/lib/components/ChatInputEntity/ChatInputEntity.types.js +3 -0
- package/lib/components/ChatInputEntity/ChatInputEntity.types.js.map +1 -0
- package/lib/components/ChatInputEntity/index.js +6 -0
- package/lib/components/ChatInputEntity/index.js.map +1 -0
- package/lib/components/ChatInputEntity/renderChatInputEntity.js +12 -0
- package/lib/components/ChatInputEntity/renderChatInputEntity.js.map +1 -0
- package/lib/components/ChatInputEntity/useChatInputEntity.js +55 -0
- package/lib/components/ChatInputEntity/useChatInputEntity.js.map +1 -0
- package/lib/components/ChatInputEntity/useChatInputEntityStyles.js +44 -0
- package/lib/components/ChatInputEntity/useChatInputEntityStyles.js.map +1 -0
- package/lib/components/ChatInputToken/ChatInputToken.js +12 -0
- package/lib/components/ChatInputToken/ChatInputToken.js.map +1 -0
- package/lib/components/ChatInputToken/ChatInputToken.node.js +60 -0
- package/lib/components/ChatInputToken/ChatInputToken.node.js.map +1 -0
- package/lib/components/ChatInputToken/ChatInputToken.types.js +2 -0
- package/lib/components/ChatInputToken/ChatInputToken.types.js.map +1 -0
- package/lib/components/ChatInputToken/index.js +7 -0
- package/lib/components/ChatInputToken/index.js.map +1 -0
- package/lib/components/ChatInputToken/renderChatInputToken.js +10 -0
- package/lib/components/ChatInputToken/renderChatInputToken.js.map +1 -0
- package/lib/components/ChatInputToken/useChatInputToken.js +25 -0
- package/lib/components/ChatInputToken/useChatInputToken.js.map +1 -0
- package/lib/components/ChatInputToken/useChatInputTokenStyles.js +17 -0
- package/lib/components/ChatInputToken/useChatInputTokenStyles.js.map +1 -0
- package/lib/components/GhostText/GhostText.js +12 -0
- package/lib/components/GhostText/GhostText.js.map +1 -0
- package/lib/components/GhostText/GhostText.types.js +3 -0
- package/lib/components/GhostText/GhostText.types.js.map +1 -0
- package/lib/components/GhostText/index.js +6 -0
- package/lib/components/GhostText/index.js.map +1 -0
- package/lib/components/GhostText/renderGhostText.js +12 -0
- package/lib/components/GhostText/renderGhostText.js.map +1 -0
- package/lib/components/GhostText/useGhostText.js +29 -0
- package/lib/components/GhostText/useGhostText.js.map +1 -0
- package/lib/components/GhostText/useGhostTextStyles.js +48 -0
- package/lib/components/GhostText/useGhostTextStyles.js.map +1 -0
- package/lib/index.js +6 -0
- package/lib/index.js.map +1 -0
- package/lib/plugins/BasicFunctionality/BasicFunctionality.js +54 -0
- package/lib/plugins/BasicFunctionality/BasicFunctionality.js.map +1 -0
- package/lib/plugins/BasicFunctionality/index.js +2 -0
- package/lib/plugins/BasicFunctionality/index.js.map +1 -0
- package/lib/plugins/ChatInputEntity/ChatInputEntity.node.js +79 -0
- package/lib/plugins/ChatInputEntity/ChatInputEntity.node.js.map +1 -0
- package/lib/plugins/ChatInputEntity/ChatInputEntityPlugin.js +42 -0
- package/lib/plugins/ChatInputEntity/ChatInputEntityPlugin.js.map +1 -0
- package/lib/plugins/ChatInputEntity/ChatInputEntityPlugin.types.js +2 -0
- package/lib/plugins/ChatInputEntity/ChatInputEntityPlugin.types.js.map +1 -0
- package/lib/plugins/ChatInputEntity/index.js +4 -0
- package/lib/plugins/ChatInputEntity/index.js.map +1 -0
- package/lib/plugins/GhostText/GhostText.js +44 -0
- package/lib/plugins/GhostText/GhostText.js.map +1 -0
- package/lib/plugins/GhostText/GhostText.node.js +61 -0
- package/lib/plugins/GhostText/GhostText.node.js.map +1 -0
- package/lib/plugins/GhostText/index.js +3 -0
- package/lib/plugins/GhostText/index.js.map +1 -0
- package/lib/plugins/ImperativeControl/ImperativeControl.js +9 -0
- package/lib/plugins/ImperativeControl/ImperativeControl.js.map +1 -0
- package/lib/plugins/ImperativeControl/index.js +2 -0
- package/lib/plugins/ImperativeControl/index.js.map +1 -0
- package/lib/plugins/ManualGhostText/ManualGhostText.js +14 -0
- package/lib/plugins/ManualGhostText/ManualGhostText.js.map +1 -0
- package/lib/plugins/ManualGhostText/index.js +2 -0
- package/lib/plugins/ManualGhostText/index.js.map +1 -0
- package/lib-commonjs/BasicFunctionality.js +7 -0
- package/lib-commonjs/BasicFunctionality.js.map +1 -0
- package/lib-commonjs/ChatInputEntity.js +8 -0
- package/lib-commonjs/ChatInputEntity.js.map +1 -0
- package/lib-commonjs/ChatInputToken.js +7 -0
- package/lib-commonjs/ChatInputToken.js.map +1 -0
- package/lib-commonjs/GhostText.js +9 -0
- package/lib-commonjs/GhostText.js.map +1 -0
- package/lib-commonjs/ImperativeControl.js +7 -0
- package/lib-commonjs/ImperativeControl.js.map +1 -0
- package/lib-commonjs/components/ChatInputEntity/ChatInputEntity.js +21 -0
- package/lib-commonjs/components/ChatInputEntity/ChatInputEntity.js.map +1 -0
- package/lib-commonjs/components/ChatInputEntity/ChatInputEntity.types.js +7 -0
- package/lib-commonjs/components/ChatInputEntity/ChatInputEntity.types.js.map +1 -0
- package/lib-commonjs/components/ChatInputEntity/index.js +11 -0
- package/lib-commonjs/components/ChatInputEntity/index.js.map +1 -0
- package/lib-commonjs/components/ChatInputEntity/renderChatInputEntity.js +21 -0
- package/lib-commonjs/components/ChatInputEntity/renderChatInputEntity.js.map +1 -0
- package/lib-commonjs/components/ChatInputEntity/useChatInputEntity.js +52 -0
- package/lib-commonjs/components/ChatInputEntity/useChatInputEntity.js.map +1 -0
- package/lib-commonjs/components/ChatInputEntity/useChatInputEntityStyles.js +71 -0
- package/lib-commonjs/components/ChatInputEntity/useChatInputEntityStyles.js.map +1 -0
- package/lib-commonjs/components/ChatInputToken/ChatInputToken.js +21 -0
- package/lib-commonjs/components/ChatInputToken/ChatInputToken.js.map +1 -0
- package/lib-commonjs/components/ChatInputToken/ChatInputToken.node.js +81 -0
- package/lib-commonjs/components/ChatInputToken/ChatInputToken.node.js.map +1 -0
- package/lib-commonjs/components/ChatInputToken/ChatInputToken.types.js +5 -0
- package/lib-commonjs/components/ChatInputToken/ChatInputToken.types.js.map +1 -0
- package/lib-commonjs/components/ChatInputToken/index.js +12 -0
- package/lib-commonjs/components/ChatInputToken/index.js.map +1 -0
- package/lib-commonjs/components/ChatInputToken/renderChatInputToken.js +16 -0
- package/lib-commonjs/components/ChatInputToken/renderChatInputToken.js.map +1 -0
- package/lib-commonjs/components/ChatInputToken/useChatInputToken.js +24 -0
- package/lib-commonjs/components/ChatInputToken/useChatInputToken.js.map +1 -0
- package/lib-commonjs/components/ChatInputToken/useChatInputTokenStyles.js +34 -0
- package/lib-commonjs/components/ChatInputToken/useChatInputTokenStyles.js.map +1 -0
- package/lib-commonjs/components/GhostText/GhostText.js +21 -0
- package/lib-commonjs/components/GhostText/GhostText.js.map +1 -0
- package/lib-commonjs/components/GhostText/GhostText.types.js +7 -0
- package/lib-commonjs/components/GhostText/GhostText.types.js.map +1 -0
- package/lib-commonjs/components/GhostText/index.js +11 -0
- package/lib-commonjs/components/GhostText/index.js.map +1 -0
- package/lib-commonjs/components/GhostText/renderGhostText.js +21 -0
- package/lib-commonjs/components/GhostText/renderGhostText.js.map +1 -0
- package/lib-commonjs/components/GhostText/useGhostText.js +28 -0
- package/lib-commonjs/components/GhostText/useGhostText.js.map +1 -0
- package/lib-commonjs/components/GhostText/useGhostTextStyles.js +103 -0
- package/lib-commonjs/components/GhostText/useGhostTextStyles.js.map +1 -0
- package/lib-commonjs/index.js +102 -0
- package/lib-commonjs/index.js.map +1 -0
- package/lib-commonjs/plugins/BasicFunctionality/BasicFunctionality.js +70 -0
- package/lib-commonjs/plugins/BasicFunctionality/BasicFunctionality.js.map +1 -0
- package/lib-commonjs/plugins/BasicFunctionality/index.js +7 -0
- package/lib-commonjs/plugins/BasicFunctionality/index.js.map +1 -0
- package/lib-commonjs/plugins/ChatInputEntity/ChatInputEntity.node.js +100 -0
- package/lib-commonjs/plugins/ChatInputEntity/ChatInputEntity.node.js.map +1 -0
- package/lib-commonjs/plugins/ChatInputEntity/ChatInputEntityPlugin.js +52 -0
- package/lib-commonjs/plugins/ChatInputEntity/ChatInputEntityPlugin.js.map +1 -0
- package/lib-commonjs/plugins/ChatInputEntity/ChatInputEntityPlugin.types.js +5 -0
- package/lib-commonjs/plugins/ChatInputEntity/ChatInputEntityPlugin.types.js.map +1 -0
- package/lib-commonjs/plugins/ChatInputEntity/index.js +9 -0
- package/lib-commonjs/plugins/ChatInputEntity/index.js.map +1 -0
- package/lib-commonjs/plugins/GhostText/GhostText.js +58 -0
- package/lib-commonjs/plugins/GhostText/GhostText.js.map +1 -0
- package/lib-commonjs/plugins/GhostText/GhostText.node.js +82 -0
- package/lib-commonjs/plugins/GhostText/GhostText.node.js.map +1 -0
- package/lib-commonjs/plugins/GhostText/index.js +8 -0
- package/lib-commonjs/plugins/GhostText/index.js.map +1 -0
- package/lib-commonjs/plugins/ImperativeControl/ImperativeControl.js +21 -0
- package/lib-commonjs/plugins/ImperativeControl/ImperativeControl.js.map +1 -0
- package/lib-commonjs/plugins/ImperativeControl/index.js +7 -0
- package/lib-commonjs/plugins/ImperativeControl/index.js.map +1 -0
- package/lib-commonjs/plugins/ManualGhostText/ManualGhostText.js +25 -0
- package/lib-commonjs/plugins/ManualGhostText/ManualGhostText.js.map +1 -0
- package/lib-commonjs/plugins/ManualGhostText/index.js +7 -0
- package/lib-commonjs/plugins/ManualGhostText/index.js.map +1 -0
- package/package.json +39 -0
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { _ as _define_property } from "@swc/helpers/_/_define_property";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { DecoratorNode } from '@fluentui-copilot/text-editor';
|
|
4
|
+
import { ChatInputToken } from './ChatInputToken';
|
|
5
|
+
export class ChatInputTokenNode extends DecoratorNode {
|
|
6
|
+
static getType() {
|
|
7
|
+
return 'token';
|
|
8
|
+
}
|
|
9
|
+
static clone(node) {
|
|
10
|
+
return new ChatInputTokenNode(node.__text, node.__componentProps, node.__key);
|
|
11
|
+
}
|
|
12
|
+
static importJSON(serializedNode) {
|
|
13
|
+
return $createChatInputTokenNode(serializedNode.text, serializedNode.componentProps);
|
|
14
|
+
}
|
|
15
|
+
isIsolated() {
|
|
16
|
+
return true;
|
|
17
|
+
}
|
|
18
|
+
isInline() {
|
|
19
|
+
return true;
|
|
20
|
+
}
|
|
21
|
+
getTextContent() {
|
|
22
|
+
return this.__text;
|
|
23
|
+
}
|
|
24
|
+
exportJSON() {
|
|
25
|
+
return {
|
|
26
|
+
...super.exportJSON(),
|
|
27
|
+
text: this.__text,
|
|
28
|
+
componentProps: this.__componentProps,
|
|
29
|
+
type: ChatInputTokenNode.getType(),
|
|
30
|
+
version: 1
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
createDOM() {
|
|
34
|
+
return document.createElement('span');
|
|
35
|
+
}
|
|
36
|
+
updateDOM() {
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
decorate(_editor, config) {
|
|
40
|
+
var _this___componentProps;
|
|
41
|
+
if ((_this___componentProps = this.__componentProps) === null || _this___componentProps === void 0 ? void 0 : _this___componentProps.children) {
|
|
42
|
+
return /*#__PURE__*/React.createElement(ChatInputToken, this.__componentProps);
|
|
43
|
+
}
|
|
44
|
+
return /*#__PURE__*/React.createElement(ChatInputToken, this.__componentProps, this.__text);
|
|
45
|
+
}
|
|
46
|
+
constructor(text, componentProps, key) {
|
|
47
|
+
super(key);
|
|
48
|
+
_define_property(this, "__text", void 0);
|
|
49
|
+
_define_property(this, "__componentProps", void 0);
|
|
50
|
+
this.__text = text;
|
|
51
|
+
this.__componentProps = componentProps;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
export function $createChatInputTokenNode(text, componentProps, key) {
|
|
55
|
+
return new ChatInputTokenNode(text, componentProps, key);
|
|
56
|
+
}
|
|
57
|
+
export function $isChatInputTokenNode(node) {
|
|
58
|
+
return node instanceof ChatInputTokenNode;
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=ChatInputToken.node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["ChatInputToken.node.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { DecoratorNode } from '@fluentui-copilot/text-editor';\nimport type {\n EditorConfig,\n LexicalEditor,\n LexicalNode,\n NodeKey,\n SerializedLexicalNode,\n Spread,\n} from '@fluentui-copilot/text-editor';\nimport type { ChatInputTokenProps } from './ChatInputToken.types';\nimport { ChatInputToken } from './ChatInputToken';\n\nexport type SerializedChatInputTokenNode = Spread<\n { text: string; componentProps?: ChatInputTokenProps },\n SerializedLexicalNode\n>;\n\nexport class ChatInputTokenNode extends DecoratorNode<JSX.Element | null> {\n __text: string;\n __componentProps?: ChatInputTokenProps;\n\n static getType(): string {\n return 'token';\n }\n static clone(node: ChatInputTokenNode): ChatInputTokenNode {\n return new ChatInputTokenNode(node.__text, node.__componentProps, node.__key);\n }\n\n static importJSON(serializedNode: SerializedChatInputTokenNode): ChatInputTokenNode {\n return $createChatInputTokenNode(serializedNode.text, serializedNode.componentProps);\n }\n\n isIsolated() {\n return true;\n }\n isInline() {\n return true;\n }\n\n getTextContent(): string {\n return this.__text;\n }\n\n exportJSON(): SerializedChatInputTokenNode {\n return {\n ...super.exportJSON(),\n text: this.__text,\n componentProps: this.__componentProps,\n type: ChatInputTokenNode.getType(),\n version: 1,\n };\n }\n\n constructor(text: string, componentProps?: ChatInputTokenProps, key?: NodeKey) {\n super(key);\n this.__text = text;\n this.__componentProps = componentProps;\n }\n\n createDOM(): HTMLElement {\n return document.createElement('span');\n }\n\n updateDOM() {\n return false;\n }\n\n decorate(_editor: LexicalEditor, config: EditorConfig): JSX.Element | null {\n if (this.__componentProps?.children) {\n return <ChatInputToken {...this.__componentProps} />;\n }\n return <ChatInputToken {...this.__componentProps}>{this.__text}</ChatInputToken>;\n }\n}\n\nexport function $createChatInputTokenNode(\n text: string,\n componentProps?: ChatInputTokenProps,\n key?: NodeKey,\n): ChatInputTokenNode {\n return new ChatInputTokenNode(text, componentProps, key);\n}\n\nexport function $isChatInputTokenNode(node: LexicalNode | null | undefined): node is ChatInputTokenNode {\n return node instanceof ChatInputTokenNode;\n}\n"],"names":["React","DecoratorNode","ChatInputToken","ChatInputTokenNode","getType","clone","node","__text","__componentProps","__key","importJSON","serializedNode","$createChatInputTokenNode","text","componentProps","isIsolated","isInline","getTextContent","exportJSON","type","version","createDOM","document","createElement","updateDOM","decorate","_editor","config","children","constructor","key","$isChatInputTokenNode"],"mappings":";AAAA,YAAYA,WAAW,QAAQ;AAE/B,SAASC,aAAa,QAAQ,gCAAgC;AAU9D,SAASC,cAAc,QAAQ,mBAAmB;AAOlD,OAAO,MAAMC,2BAA2BF;IAItC,OAAOG,UAAkB;QACvB,OAAO;IACT;IACA,OAAOC,MAAMC,IAAwB,EAAsB;QACzD,OAAO,IAAIH,mBAAmBG,KAAKC,MAAM,EAAED,KAAKE,gBAAgB,EAAEF,KAAKG,KAAK;IAC9E;IAEA,OAAOC,WAAWC,cAA4C,EAAsB;QAClF,OAAOC,0BAA0BD,eAAeE,IAAI,EAAEF,eAAeG,cAAc;IACrF;IAEAC,aAAa;QACX,OAAO;IACT;IACAC,WAAW;QACT,OAAO;IACT;IAEAC,iBAAyB;QACvB,OAAO,IAAI,CAACV,MAAM;IACpB;IAEAW,aAA2C;QACzC,OAAO;YACL,GAAG,KAAK,CAACA,YAAY;YACrBL,MAAM,IAAI,CAACN,MAAM;YACjBO,gBAAgB,IAAI,CAACN,gBAAgB;YACrCW,MAAMhB,mBAAmBC,OAAO;YAChCgB,SAAS;QACX;IACF;IAQAC,YAAyB;QACvB,OAAOC,SAASC,aAAa,CAAC;IAChC;IAEAC,YAAY;QACV,OAAO;IACT;IAEAC,SAASC,OAAsB,EAAEC,MAAoB,EAAsB;YACrE;QAAJ,KAAI,yBAAA,IAAI,CAACnB,gBAAgB,cAArB,6CAAA,uBAAuBoB,QAAQ,EAAE;YACnC,qBAAO,oBAAC1B,gBAAmB,IAAI,CAACM,gBAAgB;QAClD;QACA,qBAAO,oBAACN,gBAAmB,IAAI,CAACM,gBAAgB,EAAG,IAAI,CAACD,MAAM;IAChE;IAnBAsB,YAAYhB,IAAY,EAAEC,cAAoC,EAAEgB,GAAa,CAAE;QAC7E,KAAK,CAACA;QApCRvB,uBAAAA,UAAAA,KAAAA;QACAC,uBAAAA,oBAAAA,KAAAA;QAoCE,IAAI,CAACD,MAAM,GAAGM;QACd,IAAI,CAACL,gBAAgB,GAAGM;IAC1B;AAgBF;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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["ChatInputToken.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-components';\n\nexport type ChatInputTokenSlots = {\n root: Slot<'span'>;\n};\n\n/**\n * ChatInputToken Props\n */\nexport type ChatInputTokenProps = ComponentProps<ChatInputTokenSlots> & {};\n\n/**\n * State used in rendering ChatInputToken\n */\nexport type ChatInputTokenState = ComponentState<ChatInputTokenSlots>;\n"],"names":[],"mappings":"AAAA,WAcsE"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from './ChatInputToken';
|
|
2
|
+
export * from './ChatInputToken.types';
|
|
3
|
+
export * from './renderChatInputToken';
|
|
4
|
+
export * from './useChatInputToken';
|
|
5
|
+
export * from './useChatInputTokenStyles';
|
|
6
|
+
export * from './ChatInputToken.node';
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["index.ts"],"sourcesContent":["export * from './ChatInputToken';\nexport * from './ChatInputToken.types';\nexport * from './renderChatInputToken';\nexport * from './useChatInputToken';\nexport * from './useChatInputTokenStyles';\nexport * from './ChatInputToken.node';\n"],"names":[],"mappings":"AAAA,cAAc,mBAAmB;AACjC,cAAc,yBAAyB;AACvC,cAAc,yBAAyB;AACvC,cAAc,sBAAsB;AACpC,cAAc,4BAA4B;AAC1C,cAAc,wBAAwB"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx as _jsx } from "@fluentui/react-jsx-runtime/jsx-runtime";
|
|
2
|
+
import { assertSlots } from '@fluentui/react-components';
|
|
3
|
+
/**
|
|
4
|
+
* Render the final JSX of ChatInputToken
|
|
5
|
+
*/
|
|
6
|
+
export const renderChatInputToken_unstable = state => {
|
|
7
|
+
assertSlots(state);
|
|
8
|
+
return /*#__PURE__*/_jsx(state.root, {});
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=renderChatInputToken.js.map
|
|
@@ -0,0 +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"],"mappings":"AAAA,0BAA0B,GAC1B,iDAAiD;AAEjD,SAASA,WAAW,QAAQ,6BAA6B;AAGzD;;CAEC,GACD,OAAO,MAAMC,gCAAgC,CAACC;IAC5CF,YAAiCE;IAEjC,qBAAO,KAACA,MAAMC,IAAI;AACpB,EAAE"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { getIntrinsicElementProps, slot } from '@fluentui/react-components';
|
|
2
|
+
// If you add JSX to this file, be sure to change the file type to .tsx
|
|
3
|
+
/**
|
|
4
|
+
* Create the state required to render ChatInputToken.
|
|
5
|
+
*
|
|
6
|
+
* The returned state can be modified with hooks such as useChatInputTokenStyles_unstable,
|
|
7
|
+
* before being passed to renderChatInputToken_unstable.
|
|
8
|
+
*
|
|
9
|
+
* @param props - props from this instance of ChatInputToken
|
|
10
|
+
* @param ref - reference to root HTMLElement of ChatInputToken
|
|
11
|
+
*/
|
|
12
|
+
export const useChatInputToken_unstable = (props, ref) => {
|
|
13
|
+
return {
|
|
14
|
+
components: {
|
|
15
|
+
root: 'span'
|
|
16
|
+
},
|
|
17
|
+
root: slot.always(getIntrinsicElementProps('span', {
|
|
18
|
+
ref,
|
|
19
|
+
...props
|
|
20
|
+
}), {
|
|
21
|
+
elementType: 'span'
|
|
22
|
+
})
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=useChatInputToken.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["useChatInputToken.ts"],"sourcesContent":["import type * as React from 'react';\nimport { getIntrinsicElementProps, slot } from '@fluentui/react-components';\nimport type { ChatInputTokenProps, ChatInputTokenState } from './ChatInputToken.types';\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 ChatInputToken.\n *\n * The returned state can be modified with hooks such as useChatInputTokenStyles_unstable,\n * before being passed to renderChatInputToken_unstable.\n *\n * @param props - props from this instance of ChatInputToken\n * @param ref - reference to root HTMLElement of ChatInputToken\n */\nexport const useChatInputToken_unstable = (\n props: ChatInputTokenProps,\n ref: React.Ref<HTMLElement>,\n): ChatInputTokenState => {\n return {\n components: {\n root: 'span',\n },\n root: slot.always(\n getIntrinsicElementProps('span', {\n ref,\n ...props,\n }),\n { elementType: 'span' },\n ),\n };\n};\n"],"names":["getIntrinsicElementProps","slot","useChatInputToken_unstable","props","ref","components","root","always","elementType"],"mappings":"AACA,SAASA,wBAAwB,EAAEC,IAAI,QAAQ,6BAA6B;AAG5E,uEAAuE;AAEvE;;;;;;;;CAQC,GACD,OAAO,MAAMC,6BAA6B,CACxCC,OACAC;IAEA,OAAO;QACLC,YAAY;YACVC,MAAM;QACR;QACAA,MAAML,KAAKM,MAAM,CACfP,yBAAyB,QAAQ;YAC/BI;YACA,GAAGD,KAAK;QACV,IACA;YAAEK,aAAa;QAAO;IAE1B;AACF,EAAE"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { __resetStyles, mergeClasses, tokens, typographyStyles } from '@fluentui/react-components';
|
|
2
|
+
export const chatInputTokenClassNames = {
|
|
3
|
+
root: 'fai-ChatInputToken'
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* Styles for the root slot
|
|
7
|
+
*/
|
|
8
|
+
const useBaseClassName = __resetStyles("r125pysu", null, [".r125pysu{font-family:var(--fontFamilyBase);font-size:var(--fontSizeBase200);font-weight:var(--fontWeightSemibold);line-height:calc(var(--lineHeightBase200) + 2 * var(--spacingVerticalXXS));background-color:var(--colorNeutralBackground3);border-radius:var(--borderRadiusMedium);color:var(--colorNeutralForeground2);padding:var(--spacingVerticalXXS) var(--spacingHorizontalNone);}", ".r125pysu::before{content:\" \";font-size:0;letter-spacing:var(--spacingHorizontalS);}", ".r125pysu::after{content:\" \";font-size:0;letter-spacing:var(--spacingHorizontalS);}"]);
|
|
9
|
+
/**
|
|
10
|
+
* Apply styling to the ChatInputToken slots based on the state
|
|
11
|
+
*/
|
|
12
|
+
export const useChatInputTokenStyles_unstable = state => {
|
|
13
|
+
const baseClassName = useBaseClassName();
|
|
14
|
+
state.root.className = mergeClasses(chatInputTokenClassNames.root, baseClassName, state.root.className);
|
|
15
|
+
return state;
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=useChatInputTokenStyles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["useChatInputTokenStyles.ts"],"sourcesContent":["import { makeResetStyles, mergeClasses, tokens, typographyStyles } from '@fluentui/react-components';\nimport type { ChatInputTokenSlots, ChatInputTokenState } from './ChatInputToken.types';\nimport type { SlotClassNames } from '@fluentui/react-components';\n\nexport const chatInputTokenClassNames: SlotClassNames<ChatInputTokenSlots> = {\n root: 'fai-ChatInputToken',\n};\n\n/**\n * Styles for the root slot\n */\nconst useBaseClassName = makeResetStyles({\n ...typographyStyles.caption1Strong,\n backgroundColor: tokens.colorNeutralBackground3,\n borderRadius: tokens.borderRadiusMedium,\n color: tokens.colorNeutralForeground2,\n lineHeight: `calc(${tokens.lineHeightBase200} + 2 * ${tokens.spacingVerticalXXS})`,\n padding: `${tokens.spacingVerticalXXS} ${tokens.spacingHorizontalNone}`,\n\n // Use :before and :after instead of horizontal padding to ensure the cursor doesn't move inside the padding\n '&::before': {\n content: '\" \"',\n fontSize: 0,\n letterSpacing: tokens.spacingHorizontalS,\n },\n '&::after': {\n content: '\" \"',\n fontSize: 0,\n letterSpacing: tokens.spacingHorizontalS,\n },\n});\n\n/**\n * Apply styling to the ChatInputToken slots based on the state\n */\nexport const useChatInputTokenStyles_unstable = (state: ChatInputTokenState): ChatInputTokenState => {\n const baseClassName = useBaseClassName();\n state.root.className = mergeClasses(chatInputTokenClassNames.root, baseClassName, state.root.className);\n\n return state;\n};\n"],"names":["makeResetStyles","mergeClasses","tokens","typographyStyles","chatInputTokenClassNames","root","useBaseClassName","caption1Strong","backgroundColor","colorNeutralBackground3","borderRadius","borderRadiusMedium","color","colorNeutralForeground2","lineHeight","lineHeightBase200","spacingVerticalXXS","padding","spacingHorizontalNone","content","fontSize","letterSpacing","spacingHorizontalS","useChatInputTokenStyles_unstable","state","baseClassName","className"],"mappings":"AAAA,SAASA,eAAe,EAAEC,YAAY,EAAEC,MAAM,EAAEC,gBAAgB,QAAQ,6BAA6B;AAIrG,OAAO,MAAMC,2BAAgE;IAC3EC,MAAM;AACR,EAAE;AAEF;;CAEC,GACD,MAAMC,mBAAmBN,gBAAgB;IACvC,GAAGG,iBAAiBI,cAAc;IAClCC,iBAAiBN,OAAOO,uBAAuB;IAC/CC,cAAcR,OAAOS,kBAAkB;IACvCC,OAAOV,OAAOW,uBAAuB;IACrCC,YAAY,CAAC,KAAK,EAAEZ,OAAOa,iBAAiB,CAAC,OAAO,EAAEb,OAAOc,kBAAkB,CAAC,CAAC,CAAC;IAClFC,SAAS,CAAC,EAAEf,OAAOc,kBAAkB,CAAC,CAAC,EAAEd,OAAOgB,qBAAqB,CAAC,CAAC;IAEvE,4GAA4G;IAC5G,aAAa;QACXC,SAAS;QACTC,UAAU;QACVC,eAAenB,OAAOoB,kBAAkB;IAC1C;IACA,YAAY;QACVH,SAAS;QACTC,UAAU;QACVC,eAAenB,OAAOoB,kBAAkB;IAC1C;AACF;AAEA;;CAEC,GACD,OAAO,MAAMC,mCAAmC,CAACC;IAC/C,MAAMC,gBAAgBnB;IACtBkB,MAAMnB,IAAI,CAACqB,SAAS,GAAGzB,aAAaG,yBAAyBC,IAAI,EAAEoB,eAAeD,MAAMnB,IAAI,CAACqB,SAAS;IAEtG,OAAOF;AACT,EAAE"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useGhostText_unstable } from './useGhostText';
|
|
3
|
+
import { renderGhostText_unstable } from './renderGhostText';
|
|
4
|
+
import { useGhostTextStyles_unstable } from './useGhostTextStyles';
|
|
5
|
+
// GhostText component - TODO: add more docs
|
|
6
|
+
export const GhostText = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
7
|
+
const state = useGhostText_unstable(props, ref);
|
|
8
|
+
useGhostTextStyles_unstable(state);
|
|
9
|
+
return renderGhostText_unstable(state);
|
|
10
|
+
});
|
|
11
|
+
GhostText.displayName = 'GhostText';
|
|
12
|
+
//# sourceMappingURL=GhostText.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["GhostText.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useGhostText_unstable } from './useGhostText';\nimport { renderGhostText_unstable } from './renderGhostText';\nimport { useGhostTextStyles_unstable } from './useGhostTextStyles';\nimport type { GhostTextProps } from './GhostText.types';\nimport type { ForwardRefComponent } from '@fluentui/react-components';\n\n// GhostText component - TODO: add more docs\nexport const GhostText: ForwardRefComponent<GhostTextProps> = React.forwardRef((props, ref) => {\n const state = useGhostText_unstable(props, ref);\n\n useGhostTextStyles_unstable(state);\n return renderGhostText_unstable(state);\n});\n\nGhostText.displayName = 'GhostText';\n"],"names":["React","useGhostText_unstable","renderGhostText_unstable","useGhostTextStyles_unstable","GhostText","forwardRef","props","ref","state","displayName"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,qBAAqB,QAAQ,iBAAiB;AACvD,SAASC,wBAAwB,QAAQ,oBAAoB;AAC7D,SAASC,2BAA2B,QAAQ,uBAAuB;AAInE,4CAA4C;AAC5C,OAAO,MAAMC,0BAAiDJ,MAAMK,UAAU,CAAC,CAACC,OAAOC;IACrF,MAAMC,QAAQP,sBAAsBK,OAAOC;IAE3CJ,4BAA4BK;IAC5B,OAAON,yBAAyBM;AAClC,GAAG;AAEHJ,UAAUK,WAAW,GAAG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["GhostText.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-components';\n\nexport type GhostTextSlots = {\n root: Slot<'span'>;\n indicator?: Slot<'span'>;\n};\n\n/**\n * GhostText Props\n */\nexport type GhostTextProps = ComponentProps<GhostTextSlots> & {};\n\n/**\n * State used in rendering GhostText\n */\nexport type GhostTextState = ComponentState<GhostTextSlots>;\n// TODO: Remove semicolon from previous line, uncomment next line, and provide union of props to pick from GhostTextProps.\n// & Required<Pick<GhostTextProps, 'propName'>>\n"],"names":[],"mappings":"AAAA,WAe4D,CAC5D,0HAA0H;CAC1H,+CAA+C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["index.ts"],"sourcesContent":["export * from './GhostText';\nexport * from './GhostText.types';\nexport * from './renderGhostText';\nexport * from './useGhostText';\nexport * from './useGhostTextStyles';\n"],"names":[],"mappings":"AAAA,cAAc,cAAc;AAC5B,cAAc,oBAAoB;AAClC,cAAc,oBAAoB;AAClC,cAAc,iBAAiB;AAC/B,cAAc,uBAAuB"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@fluentui/react-jsx-runtime/jsx-runtime";
|
|
2
|
+
import { assertSlots } from '@fluentui/react-components';
|
|
3
|
+
/**
|
|
4
|
+
* Render the final JSX of GhostText
|
|
5
|
+
*/
|
|
6
|
+
export const renderGhostText_unstable = state => {
|
|
7
|
+
assertSlots(state);
|
|
8
|
+
return /*#__PURE__*/_jsxs(state.root, {
|
|
9
|
+
children: [state.root.children, state.indicator && /*#__PURE__*/_jsx(state.indicator, {})]
|
|
10
|
+
});
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=renderGhostText.js.map
|
|
@@ -0,0 +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"],"mappings":"AAAA,0BAA0B,GAC1B,iDAAiD;AAEjD,SAASA,WAAW,QAAQ,6BAA6B;AAGzD;;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"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { getIntrinsicElementProps, slot } from '@fluentui/react-components';
|
|
2
|
+
// If you add JSX to this file, be sure to change the file type to .tsx
|
|
3
|
+
/**
|
|
4
|
+
* Create the state required to render GhostText.
|
|
5
|
+
*
|
|
6
|
+
* The returned state can be modified with hooks such as useGhostTextStyles_unstable,
|
|
7
|
+
* before being passed to renderGhostText_unstable.
|
|
8
|
+
*
|
|
9
|
+
* @param props - props from this instance of GhostText
|
|
10
|
+
* @param ref - reference to root HTMLElement of GhostText
|
|
11
|
+
*/
|
|
12
|
+
export const useGhostText_unstable = (props, ref) => {
|
|
13
|
+
return {
|
|
14
|
+
components: {
|
|
15
|
+
root: 'span',
|
|
16
|
+
indicator: 'span'
|
|
17
|
+
},
|
|
18
|
+
root: slot.always(getIntrinsicElementProps('span', {
|
|
19
|
+
ref,
|
|
20
|
+
...props
|
|
21
|
+
}), {
|
|
22
|
+
elementType: 'span'
|
|
23
|
+
}),
|
|
24
|
+
indicator: slot.optional(props.indicator, {
|
|
25
|
+
elementType: 'span'
|
|
26
|
+
})
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=useGhostText.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["useGhostText.ts"],"sourcesContent":["import type * as React from 'react';\nimport { getIntrinsicElementProps, slot } from '@fluentui/react-components';\nimport type { GhostTextProps, GhostTextState } from './GhostText.types';\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 return {\n components: {\n root: 'span',\n indicator: 'span',\n },\n root: slot.always(\n getIntrinsicElementProps('span', {\n ref,\n ...props,\n }),\n { elementType: 'span' },\n ),\n indicator: slot.optional(props.indicator, { elementType: 'span' }),\n };\n};\n"],"names":["getIntrinsicElementProps","slot","useGhostText_unstable","props","ref","components","root","indicator","always","elementType","optional"],"mappings":"AACA,SAASA,wBAAwB,EAAEC,IAAI,QAAQ,6BAA6B;AAG5E,uEAAuE;AAEvE;;;;;;;;CAQC,GACD,OAAO,MAAMC,wBAAwB,CAACC,OAAuBC;IAC3D,OAAO;QACLC,YAAY;YACVC,MAAM;YACNC,WAAW;QACb;QACAD,MAAML,KAAKO,MAAM,CACfR,yBAAyB,QAAQ;YAC/BI;YACA,GAAGD,KAAK;QACV,IACA;YAAEM,aAAa;QAAO;QAExBF,WAAWN,KAAKS,QAAQ,CAACP,MAAMI,SAAS,EAAE;YAAEE,aAAa;QAAO;IAClE;AACF,EAAE"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { __styles, mergeClasses, shorthands, tokens, typographyStyles } from '@fluentui/react-components';
|
|
2
|
+
export const ghostTextClassNames = {
|
|
3
|
+
root: 'fai-GhostText',
|
|
4
|
+
indicator: 'fai-GhostText__indicator'
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Styles for the root slot
|
|
8
|
+
*/
|
|
9
|
+
const useStyles = __styles({
|
|
10
|
+
root: {
|
|
11
|
+
sj55zd: "f11d4kpn",
|
|
12
|
+
Huce71: "fibxuh5",
|
|
13
|
+
i8kkvl: "f1ufnopg",
|
|
14
|
+
Belr9w4: "f14sijuj"
|
|
15
|
+
},
|
|
16
|
+
indicator: {
|
|
17
|
+
Bahqtrf: "fk6fouc",
|
|
18
|
+
Be2twd7: "f13mqy1h",
|
|
19
|
+
Bhrd7zp: "fl43uef",
|
|
20
|
+
Bg96gwp: "fcpl73t",
|
|
21
|
+
sj55zd: "f11d4kpn",
|
|
22
|
+
De3pzq: "f3vzo32",
|
|
23
|
+
z8tnut: "fztplxc",
|
|
24
|
+
z189sj: ["fdw0yi8", "fk8j09s"],
|
|
25
|
+
Byoj8tv: "f9g1xly",
|
|
26
|
+
uwmqm3: ["fk8j09s", "fdw0yi8"],
|
|
27
|
+
Bbmb7ep: ["f1g3puop", "fi2rrw2"],
|
|
28
|
+
Beyfa6y: ["fi2rrw2", "f1g3puop"],
|
|
29
|
+
B7oj6ja: ["f1rstyi9", "f1s4nn1u"],
|
|
30
|
+
Btl43ni: ["f1s4nn1u", "f1rstyi9"],
|
|
31
|
+
Frg6f3: ["fbyavb5", "fm0x6gh"],
|
|
32
|
+
Cd5d3v: "f1pc5kto"
|
|
33
|
+
}
|
|
34
|
+
}, {
|
|
35
|
+
d: [".f11d4kpn{color:var(--colorNeutralForeground3);}", ".fibxuh5{white-space:pre-wrap;}", ".f1ufnopg{column-gap:var(--spacingHorizontalXS);}", ".f14sijuj{row-gap:var(--spacingHorizontalXS);}", ".fk6fouc{font-family:var(--fontFamilyBase);}", ".f13mqy1h{font-size:var(--fontSizeBase100);}", ".fl43uef{font-weight:var(--fontWeightSemibold);}", ".fcpl73t{line-height:var(--lineHeightBase100);}", ".f3vzo32{background-color:var(--colorNeutralBackground5);}", ".fztplxc{padding-top:var(--spacingVerticalNone);}", ".fdw0yi8{padding-right:var(--spacingHorizontalSNudge);}", ".fk8j09s{padding-left:var(--spacingHorizontalSNudge);}", ".f9g1xly{padding-bottom:var(--spacingVerticalNone);}", ".f1g3puop{border-bottom-right-radius:var(--borderRadiusSmall);}", ".fi2rrw2{border-bottom-left-radius:var(--borderRadiusSmall);}", ".f1rstyi9{border-top-right-radius:var(--borderRadiusSmall);}", ".f1s4nn1u{border-top-left-radius:var(--borderRadiusSmall);}", ".fbyavb5{margin-left:var(--spacingHorizontalXS);}", ".fm0x6gh{margin-right:var(--spacingHorizontalXS);}", ".f1pc5kto{mergin-right:var(--spacingHorizontalXS);}"]
|
|
36
|
+
});
|
|
37
|
+
/**
|
|
38
|
+
* Apply styling to the GhostText slots based on the state
|
|
39
|
+
*/
|
|
40
|
+
export const useGhostTextStyles_unstable = state => {
|
|
41
|
+
const styles = useStyles();
|
|
42
|
+
state.root.className = mergeClasses(ghostTextClassNames.root, styles.root, state.root.className);
|
|
43
|
+
if (state.indicator) {
|
|
44
|
+
state.indicator.className = mergeClasses(ghostTextClassNames.indicator, styles.indicator, state.indicator.className);
|
|
45
|
+
}
|
|
46
|
+
return state;
|
|
47
|
+
};
|
|
48
|
+
//# sourceMappingURL=useGhostTextStyles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["useGhostTextStyles.ts"],"sourcesContent":["import { makeStyles, mergeClasses, shorthands, tokens, typographyStyles } from '@fluentui/react-components';\nimport type { GhostTextSlots, GhostTextState } from './GhostText.types';\nimport type { SlotClassNames } from '@fluentui/react-components';\n\nexport const ghostTextClassNames: SlotClassNames<GhostTextSlots> = {\n root: 'fai-GhostText',\n indicator: 'fai-GhostText__indicator',\n};\n\n/**\n * Styles for the root slot\n */\nconst useStyles = makeStyles({\n root: {\n color: tokens.colorNeutralForeground3,\n whiteSpace: 'pre-wrap',\n ...shorthands.gap(tokens.spacingHorizontalXS),\n },\n\n indicator: {\n ...typographyStyles.caption2Strong,\n color: tokens.colorNeutralForeground3,\n backgroundColor: tokens.colorNeutralBackground5,\n ...shorthands.padding(tokens.spacingVerticalNone, tokens.spacingHorizontalSNudge),\n ...shorthands.borderRadius(tokens.borderRadiusSmall),\n marginLeft: tokens.spacingHorizontalXS,\n merginRight: tokens.spacingHorizontalXS,\n },\n});\n\n/**\n * Apply styling to the GhostText slots based on the state\n */\nexport const useGhostTextStyles_unstable = (state: GhostTextState): GhostTextState => {\n const styles = useStyles();\n state.root.className = mergeClasses(ghostTextClassNames.root, styles.root, state.root.className);\n\n if (state.indicator) {\n state.indicator.className = mergeClasses(\n ghostTextClassNames.indicator,\n styles.indicator,\n state.indicator.className,\n );\n }\n\n return state;\n};\n"],"names":["makeStyles","mergeClasses","shorthands","tokens","typographyStyles","ghostTextClassNames","root","indicator","useStyles","color","colorNeutralForeground3","whiteSpace","gap","spacingHorizontalXS","caption2Strong","backgroundColor","colorNeutralBackground5","padding","spacingVerticalNone","spacingHorizontalSNudge","borderRadius","borderRadiusSmall","marginLeft","merginRight","useGhostTextStyles_unstable","state","styles","className"],"mappings":"AAAA,SAASA,UAAU,EAAEC,YAAY,EAAEC,UAAU,EAAEC,MAAM,EAAEC,gBAAgB,QAAQ,6BAA6B;AAI5G,OAAO,MAAMC,sBAAsD;IACjEC,MAAM;IACNC,WAAW;AACb,EAAE;AAEF;;CAEC,GACD,MAAMC,YAAYR,WAAW;IAC3BM,MAAM;QACJG,OAAON,OAAOO,uBAAuB;QACrCC,YAAY;QACZ,GAAGT,WAAWU,GAAG,CAACT,OAAOU,mBAAmB,CAAC;IAC/C;IAEAN,WAAW;QACT,GAAGH,iBAAiBU,cAAc;QAClCL,OAAON,OAAOO,uBAAuB;QACrCK,iBAAiBZ,OAAOa,uBAAuB;QAC/C,GAAGd,WAAWe,OAAO,CAACd,OAAOe,mBAAmB,EAAEf,OAAOgB,uBAAuB,CAAC;QACjF,GAAGjB,WAAWkB,YAAY,CAACjB,OAAOkB,iBAAiB,CAAC;QACpDC,YAAYnB,OAAOU,mBAAmB;QACtCU,aAAapB,OAAOU,mBAAmB;IACzC;AACF;AAEA;;CAEC,GACD,OAAO,MAAMW,8BAA8B,CAACC;IAC1C,MAAMC,SAASlB;IACfiB,MAAMnB,IAAI,CAACqB,SAAS,GAAG1B,aAAaI,oBAAoBC,IAAI,EAAEoB,OAAOpB,IAAI,EAAEmB,MAAMnB,IAAI,CAACqB,SAAS;IAE/F,IAAIF,MAAMlB,SAAS,EAAE;QACnBkB,MAAMlB,SAAS,CAACoB,SAAS,GAAG1B,aAC1BI,oBAAoBE,SAAS,EAC7BmB,OAAOnB,SAAS,EAChBkB,MAAMlB,SAAS,CAACoB,SAAS;IAE7B;IAEA,OAAOF;AACT,EAAE"}
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { ChatInputEntity, chatInputEntityClassNames, renderChatInputEntity_unstable, useChatInputEntityStyles_unstable, useChatInputEntity_unstable, ChatInputEntityNode, ChatInputEntityPlugin, $isChatInputEntityNode, $createChatInputEntityNode } from './ChatInputEntity';
|
|
2
|
+
export { GhostText, ghostTextClassNames, renderGhostText_unstable, useGhostTextStyles_unstable, useGhostText_unstable, GhostTextNode, GhostTextPlugin, $isGhostTextNode, $createGhostTextNode, ManualGhostTextPlugin } from './GhostText';
|
|
3
|
+
export { ChatInputToken, chatInputTokenClassNames, renderChatInputToken_unstable, useChatInputTokenStyles_unstable, useChatInputToken_unstable, $createChatInputTokenNode, $isChatInputTokenNode } from './ChatInputToken';
|
|
4
|
+
export { BasicFunctionalityPlugin } from './BasicFunctionality';
|
|
5
|
+
export { ImperativeControlPlugin } from './ImperativeControl';
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["index.ts"],"sourcesContent":["export type {\n ChatInputEntityProps,\n ChatInputEntitySlots,\n ChatInputEntityState,\n ChatInputEntityPluginRef,\n SerializedChatInputEntityNode,\n} from './ChatInputEntity';\nexport {\n ChatInputEntity,\n chatInputEntityClassNames,\n renderChatInputEntity_unstable,\n useChatInputEntityStyles_unstable,\n useChatInputEntity_unstable,\n ChatInputEntityNode,\n ChatInputEntityPlugin,\n $isChatInputEntityNode,\n $createChatInputEntityNode,\n} from './ChatInputEntity';\n\nexport type {\n GhostTextProps,\n GhostTextSlots,\n GhostTextState,\n GhostTextPluginProps,\n SerializedGhostTextNode,\n ManualGhostTextRef,\n ManualGhostTextProps,\n} from './GhostText';\nexport {\n GhostText,\n ghostTextClassNames,\n renderGhostText_unstable,\n useGhostTextStyles_unstable,\n useGhostText_unstable,\n GhostTextNode,\n GhostTextPlugin,\n $isGhostTextNode,\n $createGhostTextNode,\n ManualGhostTextPlugin,\n} from './GhostText';\n\nexport type {\n ChatInputTokenProps,\n ChatInputTokenSlots,\n ChatInputTokenState,\n SerializedChatInputTokenNode,\n} from './ChatInputToken';\nexport {\n ChatInputToken,\n chatInputTokenClassNames,\n renderChatInputToken_unstable,\n useChatInputTokenStyles_unstable,\n useChatInputToken_unstable,\n $createChatInputTokenNode,\n $isChatInputTokenNode,\n} from './ChatInputToken';\n\nexport type { BasicFunctionalityPluginProps, BasicFunctionalityPluginRef } from './BasicFunctionality';\nexport { BasicFunctionalityPlugin } from './BasicFunctionality';\n\nexport type { ImperativeControlPluginProps, ImperativeControlPluginRef } from './ImperativeControl';\nexport { ImperativeControlPlugin } from './ImperativeControl';\n"],"names":["ChatInputEntity","chatInputEntityClassNames","renderChatInputEntity_unstable","useChatInputEntityStyles_unstable","useChatInputEntity_unstable","ChatInputEntityNode","ChatInputEntityPlugin","$isChatInputEntityNode","$createChatInputEntityNode","GhostText","ghostTextClassNames","renderGhostText_unstable","useGhostTextStyles_unstable","useGhostText_unstable","GhostTextNode","GhostTextPlugin","$isGhostTextNode","$createGhostTextNode","ManualGhostTextPlugin","ChatInputToken","chatInputTokenClassNames","renderChatInputToken_unstable","useChatInputTokenStyles_unstable","useChatInputToken_unstable","$createChatInputTokenNode","$isChatInputTokenNode","BasicFunctionalityPlugin","ImperativeControlPlugin"],"mappings":"AAOA,SACEA,eAAe,EACfC,yBAAyB,EACzBC,8BAA8B,EAC9BC,iCAAiC,EACjCC,2BAA2B,EAC3BC,mBAAmB,EACnBC,qBAAqB,EACrBC,sBAAsB,EACtBC,0BAA0B,QACrB,oBAAoB;AAW3B,SACEC,SAAS,EACTC,mBAAmB,EACnBC,wBAAwB,EACxBC,2BAA2B,EAC3BC,qBAAqB,EACrBC,aAAa,EACbC,eAAe,EACfC,gBAAgB,EAChBC,oBAAoB,EACpBC,qBAAqB,QAChB,cAAc;AAQrB,SACEC,cAAc,EACdC,wBAAwB,EACxBC,6BAA6B,EAC7BC,gCAAgC,EAChCC,0BAA0B,EAC1BC,yBAAyB,EACzBC,qBAAqB,QAChB,mBAAmB;AAG1B,SAASC,wBAAwB,QAAQ,uBAAuB;AAGhE,SAASC,uBAAuB,QAAQ,sBAAsB"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useLexicalComposerContext } from '@fluentui-copilot/react-text-editor';
|
|
3
|
+
import { useIsomorphicLayoutEffect } from '@fluentui/react-components';
|
|
4
|
+
import { BasicFunctionalityBase } from '@fluentui-copilot/chat-input-plugins';
|
|
5
|
+
export const BasicFunctionalityPlugin = React.forwardRef((props, ref) => {
|
|
6
|
+
const {
|
|
7
|
+
defaultValue,
|
|
8
|
+
trimWhitespace,
|
|
9
|
+
onCountChanged,
|
|
10
|
+
onContentChange
|
|
11
|
+
} = props;
|
|
12
|
+
const [editor] = useLexicalComposerContext();
|
|
13
|
+
const basicFunctionalityImpl = React.useRef(null);
|
|
14
|
+
useIsomorphicLayoutEffect(() => {
|
|
15
|
+
basicFunctionalityImpl.current = new BasicFunctionalityBase(editor);
|
|
16
|
+
return () => {
|
|
17
|
+
var _basicFunctionalityImpl_current;
|
|
18
|
+
return (_basicFunctionalityImpl_current = basicFunctionalityImpl.current) === null || _basicFunctionalityImpl_current === void 0 ? void 0 : _basicFunctionalityImpl_current.cleanup();
|
|
19
|
+
};
|
|
20
|
+
}, [editor]);
|
|
21
|
+
React.useImperativeHandle(ref, () => ({
|
|
22
|
+
setIsDisabled(isDisabled) {
|
|
23
|
+
var _basicFunctionalityImpl_current;
|
|
24
|
+
(_basicFunctionalityImpl_current = basicFunctionalityImpl.current) === null || _basicFunctionalityImpl_current === void 0 ? void 0 : _basicFunctionalityImpl_current.setIsDisabled(isDisabled);
|
|
25
|
+
}
|
|
26
|
+
}));
|
|
27
|
+
// useIsomporphicLayoutEffect is used to avoid flickering on first render
|
|
28
|
+
useIsomorphicLayoutEffect(() => {
|
|
29
|
+
if (defaultValue) {
|
|
30
|
+
var _basicFunctionalityImpl_current;
|
|
31
|
+
(_basicFunctionalityImpl_current = basicFunctionalityImpl.current) === null || _basicFunctionalityImpl_current === void 0 ? void 0 : _basicFunctionalityImpl_current.insertDefaultValue(defaultValue);
|
|
32
|
+
}
|
|
33
|
+
}, [editor]);
|
|
34
|
+
React.useEffect(() => {
|
|
35
|
+
var _basicFunctionalityImpl_current;
|
|
36
|
+
(_basicFunctionalityImpl_current = basicFunctionalityImpl.current) === null || _basicFunctionalityImpl_current === void 0 ? void 0 : _basicFunctionalityImpl_current.activateContentCallbacks(onContentChange, onCountChanged);
|
|
37
|
+
return () => {
|
|
38
|
+
var _basicFunctionalityImpl_current;
|
|
39
|
+
return (_basicFunctionalityImpl_current = basicFunctionalityImpl.current) === null || _basicFunctionalityImpl_current === void 0 ? void 0 : _basicFunctionalityImpl_current.deactivateContentCallbacks();
|
|
40
|
+
};
|
|
41
|
+
}, [editor, onContentChange, onCountChanged]);
|
|
42
|
+
React.useEffect(() => {
|
|
43
|
+
if (trimWhitespace) {
|
|
44
|
+
var _basicFunctionalityImpl_current;
|
|
45
|
+
(_basicFunctionalityImpl_current = basicFunctionalityImpl.current) === null || _basicFunctionalityImpl_current === void 0 ? void 0 : _basicFunctionalityImpl_current.activateTrimWhitespace();
|
|
46
|
+
}
|
|
47
|
+
return () => {
|
|
48
|
+
var _basicFunctionalityImpl_current;
|
|
49
|
+
return (_basicFunctionalityImpl_current = basicFunctionalityImpl.current) === null || _basicFunctionalityImpl_current === void 0 ? void 0 : _basicFunctionalityImpl_current.deactivateTrimWhitespace();
|
|
50
|
+
};
|
|
51
|
+
}, [editor, trimWhitespace]);
|
|
52
|
+
return null;
|
|
53
|
+
});
|
|
54
|
+
//# sourceMappingURL=BasicFunctionality.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["BasicFunctionality.ts"],"sourcesContent":["import * as React from 'react';\nimport { useLexicalComposerContext } from '@fluentui-copilot/react-text-editor';\nimport { useIsomorphicLayoutEffect } from '@fluentui/react-components';\nimport type { IBasicFunctionalityBase } from '@fluentui-copilot/chat-input-plugins';\nimport { BasicFunctionalityBase } from '@fluentui-copilot/chat-input-plugins';\n\nexport type BasicFunctionalityPluginProps = {\n defaultValue?: string;\n // Whether or not to clear the input when only whitespace is remaining\n trimWhitespace?: boolean;\n onCountChanged?: (count: number) => void;\n onContentChange?: (value: string) => void;\n};\n\nexport type BasicFunctionalityPluginRef = {\n setIsDisabled: (isDisabled: boolean) => void;\n};\n\nexport const BasicFunctionalityPlugin = React.forwardRef<BasicFunctionalityPluginRef, BasicFunctionalityPluginProps>(\n (props, ref) => {\n const { defaultValue, trimWhitespace, onCountChanged, onContentChange } = props;\n\n const [editor] = useLexicalComposerContext();\n\n const basicFunctionalityImpl = React.useRef<IBasicFunctionalityBase | null>(null);\n\n useIsomorphicLayoutEffect(() => {\n basicFunctionalityImpl.current = new BasicFunctionalityBase(editor);\n\n return () => basicFunctionalityImpl.current?.cleanup();\n }, [editor]);\n\n React.useImperativeHandle<BasicFunctionalityPluginRef, BasicFunctionalityPluginRef>(ref, () => ({\n setIsDisabled(isDisabled: boolean) {\n basicFunctionalityImpl.current?.setIsDisabled(isDisabled);\n },\n }));\n\n // useIsomporphicLayoutEffect is used to avoid flickering on first render\n useIsomorphicLayoutEffect(() => {\n if (defaultValue) {\n basicFunctionalityImpl.current?.insertDefaultValue(defaultValue);\n }\n }, [editor]);\n\n React.useEffect(() => {\n basicFunctionalityImpl.current?.activateContentCallbacks(onContentChange, onCountChanged);\n return () => basicFunctionalityImpl.current?.deactivateContentCallbacks();\n }, [editor, onContentChange, onCountChanged]);\n\n React.useEffect(() => {\n if (trimWhitespace) {\n basicFunctionalityImpl.current?.activateTrimWhitespace();\n }\n return () => basicFunctionalityImpl.current?.deactivateTrimWhitespace();\n }, [editor, trimWhitespace]);\n\n return null;\n },\n);\n"],"names":["React","useLexicalComposerContext","useIsomorphicLayoutEffect","BasicFunctionalityBase","BasicFunctionalityPlugin","forwardRef","props","ref","defaultValue","trimWhitespace","onCountChanged","onContentChange","editor","basicFunctionalityImpl","useRef","current","cleanup","useImperativeHandle","setIsDisabled","isDisabled","insertDefaultValue","useEffect","activateContentCallbacks","deactivateContentCallbacks","activateTrimWhitespace","deactivateTrimWhitespace"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,yBAAyB,QAAQ,sCAAsC;AAChF,SAASC,yBAAyB,QAAQ,6BAA6B;AAEvE,SAASC,sBAAsB,QAAQ,uCAAuC;AAc9E,OAAO,MAAMC,2BAA2BJ,MAAMK,UAAU,CACtD,CAACC,OAAOC;IACN,MAAM,EAAEC,YAAY,EAAEC,cAAc,EAAEC,cAAc,EAAEC,eAAe,EAAE,GAAGL;IAE1E,MAAM,CAACM,OAAO,GAAGX;IAEjB,MAAMY,yBAAyBb,MAAMc,MAAM,CAAiC;IAE5EZ,0BAA0B;QACxBW,uBAAuBE,OAAO,GAAG,IAAIZ,uBAAuBS;QAE5D,OAAO;gBAAMC;oBAAAA,kCAAAA,uBAAuBE,OAAO,cAA9BF,sDAAAA,gCAAgCG,OAAO;;IACtD,GAAG;QAACJ;KAAO;IAEXZ,MAAMiB,mBAAmB,CAA2DV,KAAK,IAAO,CAAA;YAC9FW,eAAcC,UAAmB;oBAC/BN;iBAAAA,kCAAAA,uBAAuBE,OAAO,cAA9BF,sDAAAA,gCAAgCK,aAAa,CAACC;YAChD;QACF,CAAA;IAEA,yEAAyE;IACzEjB,0BAA0B;QACxB,IAAIM,cAAc;gBAChBK;aAAAA,kCAAAA,uBAAuBE,OAAO,cAA9BF,sDAAAA,gCAAgCO,kBAAkB,CAACZ;QACrD;IACF,GAAG;QAACI;KAAO;IAEXZ,MAAMqB,SAAS,CAAC;YACdR;SAAAA,kCAAAA,uBAAuBE,OAAO,cAA9BF,sDAAAA,gCAAgCS,wBAAwB,CAACX,iBAAiBD;QAC1E,OAAO;gBAAMG;oBAAAA,kCAAAA,uBAAuBE,OAAO,cAA9BF,sDAAAA,gCAAgCU,0BAA0B;;IACzE,GAAG;QAACX;QAAQD;QAAiBD;KAAe;IAE5CV,MAAMqB,SAAS,CAAC;QACd,IAAIZ,gBAAgB;gBAClBI;aAAAA,kCAAAA,uBAAuBE,OAAO,cAA9BF,sDAAAA,gCAAgCW,sBAAsB;QACxD;QACA,OAAO;gBAAMX;oBAAAA,kCAAAA,uBAAuBE,OAAO,cAA9BF,sDAAAA,gCAAgCY,wBAAwB;;IACvE,GAAG;QAACb;QAAQH;KAAe;IAE3B,OAAO;AACT,GACA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["index.ts"],"sourcesContent":["export * from './BasicFunctionality';\n"],"names":[],"mappings":"AAAA,cAAc,uBAAuB"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { _ as _define_property } from "@swc/helpers/_/_define_property";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { DecoratorNode } from '@fluentui-copilot/text-editor';
|
|
4
|
+
import { ChatInputEntity } from '../../ChatInputEntity';
|
|
5
|
+
export class ChatInputEntityNode extends DecoratorNode {
|
|
6
|
+
static getType() {
|
|
7
|
+
return 'entity';
|
|
8
|
+
}
|
|
9
|
+
static clone(node) {
|
|
10
|
+
return new ChatInputEntityNode(node.__pluginId, node.__text, node.__data, node.__entityProps, node.__key);
|
|
11
|
+
}
|
|
12
|
+
static importJSON(serializedNode) {
|
|
13
|
+
return $createChatInputEntityNode(serializedNode.pluginId, serializedNode.text, serializedNode.data, serializedNode.entityProps);
|
|
14
|
+
}
|
|
15
|
+
isIsolated() {
|
|
16
|
+
return true;
|
|
17
|
+
}
|
|
18
|
+
isInline() {
|
|
19
|
+
return true;
|
|
20
|
+
}
|
|
21
|
+
getTextContent() {
|
|
22
|
+
return this.__text;
|
|
23
|
+
}
|
|
24
|
+
exportJSON() {
|
|
25
|
+
return {
|
|
26
|
+
...super.exportJSON(),
|
|
27
|
+
pluginId: this.__pluginId,
|
|
28
|
+
text: this.__text,
|
|
29
|
+
data: this.__data,
|
|
30
|
+
entityProps: this.__entityProps,
|
|
31
|
+
type: ChatInputEntityNode.getType(),
|
|
32
|
+
version: 1
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
createDOM() {
|
|
36
|
+
return document.createElement('span');
|
|
37
|
+
}
|
|
38
|
+
updateDOM() {
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
decorate(_editor, config) {
|
|
42
|
+
var _this___entityProps;
|
|
43
|
+
if ((_this___entityProps = this.__entityProps) === null || _this___entityProps === void 0 ? void 0 : _this___entityProps.children) {
|
|
44
|
+
return /*#__PURE__*/React.createElement(ChatInputEntity, this.__entityProps);
|
|
45
|
+
}
|
|
46
|
+
return /*#__PURE__*/React.createElement(ChatInputEntity, this.__entityProps, this.__text);
|
|
47
|
+
}
|
|
48
|
+
getEntityData() {
|
|
49
|
+
return {
|
|
50
|
+
text: this.__text,
|
|
51
|
+
data: this.__data,
|
|
52
|
+
entityProps: this.__entityProps
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
updateEntityData(data) {
|
|
56
|
+
const writable = this.getWritable();
|
|
57
|
+
writable.__text = data.text;
|
|
58
|
+
writable.__data = data.data;
|
|
59
|
+
writable.__entityProps = data.entityProps;
|
|
60
|
+
}
|
|
61
|
+
constructor(pluginId, text, data, entityProps, key) {
|
|
62
|
+
super(key);
|
|
63
|
+
_define_property(this, "__pluginId", void 0);
|
|
64
|
+
_define_property(this, "__text", void 0);
|
|
65
|
+
_define_property(this, "__entityProps", void 0);
|
|
66
|
+
_define_property(this, "__data", void 0);
|
|
67
|
+
this.__pluginId = pluginId;
|
|
68
|
+
this.__text = text;
|
|
69
|
+
this.__data = data;
|
|
70
|
+
this.__entityProps = entityProps;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
export function $createChatInputEntityNode(pluginId, text, data, entityProps, key) {
|
|
74
|
+
return new ChatInputEntityNode(pluginId, text, data, entityProps, key);
|
|
75
|
+
}
|
|
76
|
+
export function $isChatInputEntityNode(node) {
|
|
77
|
+
return node instanceof ChatInputEntityNode;
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=ChatInputEntity.node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["ChatInputEntity.node.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { DecoratorNode } from '@fluentui-copilot/text-editor';\nimport type {\n EditorConfig,\n LexicalEditor,\n LexicalNode,\n NodeKey,\n SerializedLexicalNode,\n Spread,\n} from '@fluentui-copilot/text-editor';\nimport type { ChatInputEntityProps } from '../../ChatInputEntity';\nimport { ChatInputEntity } from '../../ChatInputEntity';\nimport type { ChatInputEntityData } from '@fluentui-copilot/chat-input-plugins';\n\nexport type SerializedChatInputEntityNode<T> = Spread<\n { pluginId: string; text: string; data?: T; entityProps?: ChatInputEntityProps },\n SerializedLexicalNode\n>;\n\nexport class ChatInputEntityNode<T> extends DecoratorNode<JSX.Element | null> {\n __pluginId: string;\n __text: string;\n __entityProps?: ChatInputEntityProps;\n __data?: T;\n\n static getType(): string {\n return 'entity';\n }\n static clone<T>(node: ChatInputEntityNode<T>): ChatInputEntityNode<T> {\n return new ChatInputEntityNode(node.__pluginId, node.__text, node.__data, node.__entityProps, node.__key);\n }\n\n static importJSON<T>(serializedNode: SerializedChatInputEntityNode<T>): ChatInputEntityNode<T> {\n return $createChatInputEntityNode(\n serializedNode.pluginId,\n serializedNode.text,\n serializedNode.data,\n serializedNode.entityProps,\n );\n }\n\n isIsolated() {\n return true;\n }\n isInline() {\n return true;\n }\n\n getTextContent(): string {\n return this.__text;\n }\n\n exportJSON(): SerializedChatInputEntityNode<T> {\n return {\n ...super.exportJSON(),\n pluginId: this.__pluginId,\n text: this.__text,\n data: this.__data,\n entityProps: this.__entityProps,\n type: ChatInputEntityNode.getType(),\n version: 1,\n };\n }\n\n constructor(pluginId: string, text: string, data?: T, entityProps?: ChatInputEntityProps, key?: NodeKey) {\n super(key);\n this.__pluginId = pluginId;\n this.__text = text;\n this.__data = data;\n this.__entityProps = entityProps;\n }\n\n createDOM(): HTMLElement {\n return document.createElement('span');\n }\n\n updateDOM() {\n return false;\n }\n\n decorate(_editor: LexicalEditor, config: EditorConfig): JSX.Element | null {\n if (this.__entityProps?.children) {\n return <ChatInputEntity {...this.__entityProps} />;\n }\n return <ChatInputEntity {...this.__entityProps}>{this.__text}</ChatInputEntity>;\n }\n\n getEntityData(): ChatInputEntityData<T, ChatInputEntityProps> {\n return {\n text: this.__text,\n data: this.__data,\n entityProps: this.__entityProps,\n };\n }\n\n updateEntityData(data: ChatInputEntityData<T, ChatInputEntityProps>) {\n const writable = this.getWritable();\n writable.__text = data.text;\n writable.__data = data.data;\n writable.__entityProps = data.entityProps;\n }\n}\n\nexport function $createChatInputEntityNode<T>(\n pluginId: string,\n text: string,\n data?: T,\n entityProps?: ChatInputEntityProps,\n key?: NodeKey,\n): ChatInputEntityNode<T> {\n return new ChatInputEntityNode(pluginId, text, data, entityProps, key);\n}\n\nexport function $isChatInputEntityNode<T>(node: LexicalNode | null | undefined): node is ChatInputEntityNode<T> {\n return node instanceof ChatInputEntityNode;\n}\n"],"names":["React","DecoratorNode","ChatInputEntity","ChatInputEntityNode","getType","clone","node","__pluginId","__text","__data","__entityProps","__key","importJSON","serializedNode","$createChatInputEntityNode","pluginId","text","data","entityProps","isIsolated","isInline","getTextContent","exportJSON","type","version","createDOM","document","createElement","updateDOM","decorate","_editor","config","children","getEntityData","updateEntityData","writable","getWritable","constructor","key","$isChatInputEntityNode"],"mappings":";AAAA,YAAYA,WAAW,QAAQ;AAE/B,SAASC,aAAa,QAAQ,gCAAgC;AAU9D,SAASC,eAAe,QAAQ,wBAAwB;AAQxD,OAAO,MAAMC,4BAA+BF;IAM1C,OAAOG,UAAkB;QACvB,OAAO;IACT;IACA,OAAOC,MAASC,IAA4B,EAA0B;QACpE,OAAO,IAAIH,oBAAoBG,KAAKC,UAAU,EAAED,KAAKE,MAAM,EAAEF,KAAKG,MAAM,EAAEH,KAAKI,aAAa,EAAEJ,KAAKK,KAAK;IAC1G;IAEA,OAAOC,WAAcC,cAAgD,EAA0B;QAC7F,OAAOC,2BACLD,eAAeE,QAAQ,EACvBF,eAAeG,IAAI,EACnBH,eAAeI,IAAI,EACnBJ,eAAeK,WAAW;IAE9B;IAEAC,aAAa;QACX,OAAO;IACT;IACAC,WAAW;QACT,OAAO;IACT;IAEAC,iBAAyB;QACvB,OAAO,IAAI,CAACb,MAAM;IACpB;IAEAc,aAA+C;QAC7C,OAAO;YACL,GAAG,KAAK,CAACA,YAAY;YACrBP,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,OAAOC,SAASC,aAAa,CAAC;IAChC;IAEAC,YAAY;QACV,OAAO;IACT;IAEAC,SAASC,OAAsB,EAAEC,MAAoB,EAAsB;YACrE;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,EAAE;QACnE,MAAMkB,WAAW,IAAI,CAACC,WAAW;QACjCD,SAAS3B,MAAM,GAAGS,KAAKD,IAAI;QAC3BmB,SAAS1B,MAAM,GAAGQ,KAAKA,IAAI;QAC3BkB,SAASzB,aAAa,GAAGO,KAAKC,WAAW;IAC3C;IApCAmB,YAAYtB,QAAgB,EAAEC,IAAY,EAAEC,IAAQ,EAAEC,WAAkC,EAAEoB,GAAa,CAAE;QACvG,KAAK,CAACA;QA7CR/B,uBAAAA,cAAAA,KAAAA;QACAC,uBAAAA,UAAAA,KAAAA;QACAE,uBAAAA,iBAAAA,KAAAA;QACAD,uBAAAA,UAAAA,KAAAA;QA2CE,IAAI,CAACF,UAAU,GAAGQ;QAClB,IAAI,CAACP,MAAM,GAAGQ;QACd,IAAI,CAACP,MAAM,GAAGQ;QACd,IAAI,CAACP,aAAa,GAAGQ;IACvB;AA+BF;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"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { useLexicalComposerContext } from '@fluentui-copilot/react-text-editor';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { $createChatInputEntityNode, $isChatInputEntityNode, ChatInputEntityNode } from './ChatInputEntity.node';
|
|
4
|
+
import { ChatInputEntityPluginBase } from '@fluentui-copilot/chat-input-plugins';
|
|
5
|
+
export const ChatInputEntityPlugin = props => {
|
|
6
|
+
const {
|
|
7
|
+
id,
|
|
8
|
+
controlRef,
|
|
9
|
+
onChatInputEntityAdded,
|
|
10
|
+
onChatInputEntityDeleted
|
|
11
|
+
} = props;
|
|
12
|
+
const [editor] = useLexicalComposerContext();
|
|
13
|
+
const chatInputEntityPluginBase = React.useRef(null);
|
|
14
|
+
React.useEffect(() => {
|
|
15
|
+
chatInputEntityPluginBase.current = new ChatInputEntityPluginBase(editor, id, ChatInputEntityNode, $createChatInputEntityNode, $isChatInputEntityNode, onChatInputEntityAdded, onChatInputEntityDeleted);
|
|
16
|
+
return () => {
|
|
17
|
+
var _chatInputEntityPluginBase_current;
|
|
18
|
+
return (_chatInputEntityPluginBase_current = chatInputEntityPluginBase.current) === null || _chatInputEntityPluginBase_current === void 0 ? void 0 : _chatInputEntityPluginBase_current.cleanup();
|
|
19
|
+
};
|
|
20
|
+
}, [editor, id, onChatInputEntityAdded, onChatInputEntityDeleted]);
|
|
21
|
+
React.useImperativeHandle(controlRef, () => ({
|
|
22
|
+
insertChatInputEntity(props) {
|
|
23
|
+
var _chatInputEntityPluginBase_current;
|
|
24
|
+
return (_chatInputEntityPluginBase_current = chatInputEntityPluginBase.current) === null || _chatInputEntityPluginBase_current === void 0 ? void 0 : _chatInputEntityPluginBase_current.insertChatInputEntity(props);
|
|
25
|
+
},
|
|
26
|
+
getActiveEntities() {
|
|
27
|
+
var _chatInputEntityPluginBase_current;
|
|
28
|
+
var _chatInputEntityPluginBase_current_getActiveEntities;
|
|
29
|
+
return (_chatInputEntityPluginBase_current_getActiveEntities = (_chatInputEntityPluginBase_current = chatInputEntityPluginBase.current) === null || _chatInputEntityPluginBase_current === void 0 ? void 0 : _chatInputEntityPluginBase_current.getActiveEntities()) !== null && _chatInputEntityPluginBase_current_getActiveEntities !== void 0 ? _chatInputEntityPluginBase_current_getActiveEntities : [];
|
|
30
|
+
},
|
|
31
|
+
removeChatInputEntity(keyOrPredicate) {
|
|
32
|
+
var _chatInputEntityPluginBase_current;
|
|
33
|
+
(_chatInputEntityPluginBase_current = chatInputEntityPluginBase.current) === null || _chatInputEntityPluginBase_current === void 0 ? void 0 : _chatInputEntityPluginBase_current.removeChatInputEntity(keyOrPredicate);
|
|
34
|
+
},
|
|
35
|
+
updateChatInputEntityProps(keyOrPredicate, props) {
|
|
36
|
+
var _chatInputEntityPluginBase_current;
|
|
37
|
+
(_chatInputEntityPluginBase_current = chatInputEntityPluginBase.current) === null || _chatInputEntityPluginBase_current === void 0 ? void 0 : _chatInputEntityPluginBase_current.updateChatInputEntityProps(keyOrPredicate, props);
|
|
38
|
+
}
|
|
39
|
+
}), []);
|
|
40
|
+
return null;
|
|
41
|
+
};
|
|
42
|
+
//# sourceMappingURL=ChatInputEntityPlugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["ChatInputEntityPlugin.tsx"],"sourcesContent":["import { useLexicalComposerContext } from '@fluentui-copilot/react-text-editor';\nimport * as React from 'react';\nimport { $createChatInputEntityNode, $isChatInputEntityNode, ChatInputEntityNode } from './ChatInputEntity.node';\nimport type { ChatInputEntityPluginRef } from './ChatInputEntityPlugin.types';\nimport type { ChatInputEntityPluginProps } from '@fluentui-copilot/chat-input-plugins';\nimport { ChatInputEntityPluginBase } from '@fluentui-copilot/chat-input-plugins';\nimport type { ChatInputEntityProps } from '../../ChatInputEntity';\n\nexport const ChatInputEntityPlugin = <ExtraDataType,>(\n props: ChatInputEntityPluginProps<ExtraDataType, ChatInputEntityProps> & {\n controlRef: React.Ref<ChatInputEntityPluginRef<ExtraDataType>>;\n },\n) => {\n const { id, controlRef, onChatInputEntityAdded, onChatInputEntityDeleted } = props;\n const [editor] = useLexicalComposerContext();\n\n const chatInputEntityPluginBase = React.useRef<ChatInputEntityPluginBase<\n ExtraDataType,\n ChatInputEntityProps,\n ChatInputEntityNode<ExtraDataType>\n > | null>(null);\n\n React.useEffect(() => {\n chatInputEntityPluginBase.current = new ChatInputEntityPluginBase<\n ExtraDataType,\n ChatInputEntityProps,\n ChatInputEntityNode<ExtraDataType>\n >(\n editor,\n id,\n ChatInputEntityNode,\n $createChatInputEntityNode,\n $isChatInputEntityNode,\n onChatInputEntityAdded,\n onChatInputEntityDeleted,\n );\n\n return () => chatInputEntityPluginBase.current?.cleanup();\n }, [editor, id, onChatInputEntityAdded, onChatInputEntityDeleted]);\n\n React.useImperativeHandle(\n controlRef,\n () => ({\n insertChatInputEntity(props) {\n return chatInputEntityPluginBase.current?.insertChatInputEntity(props);\n },\n\n getActiveEntities() {\n return chatInputEntityPluginBase.current?.getActiveEntities() ?? [];\n },\n\n removeChatInputEntity(keyOrPredicate) {\n chatInputEntityPluginBase.current?.removeChatInputEntity(keyOrPredicate);\n },\n\n updateChatInputEntityProps(keyOrPredicate, props) {\n chatInputEntityPluginBase.current?.updateChatInputEntityProps(keyOrPredicate, props);\n },\n }),\n [],\n );\n return null;\n};\n"],"names":["useLexicalComposerContext","React","$createChatInputEntityNode","$isChatInputEntityNode","ChatInputEntityNode","ChatInputEntityPluginBase","ChatInputEntityPlugin","props","id","controlRef","onChatInputEntityAdded","onChatInputEntityDeleted","editor","chatInputEntityPluginBase","useRef","useEffect","current","cleanup","useImperativeHandle","insertChatInputEntity","getActiveEntities","removeChatInputEntity","keyOrPredicate","updateChatInputEntityProps"],"mappings":"AAAA,SAASA,yBAAyB,QAAQ,sCAAsC;AAChF,YAAYC,WAAW,QAAQ;AAC/B,SAASC,0BAA0B,EAAEC,sBAAsB,EAAEC,mBAAmB,QAAQ,yBAAyB;AAGjH,SAASC,yBAAyB,QAAQ,uCAAuC;AAGjF,OAAO,MAAMC,wBAAwB,CACnCC;IAIA,MAAM,EAAEC,EAAE,EAAEC,UAAU,EAAEC,sBAAsB,EAAEC,wBAAwB,EAAE,GAAGJ;IAC7E,MAAM,CAACK,OAAO,GAAGZ;IAEjB,MAAMa,4BAA4BZ,MAAMa,MAAM,CAIpC;IAEVb,MAAMc,SAAS,CAAC;QACdF,0BAA0BG,OAAO,GAAG,IAAIX,0BAKtCO,QACAJ,IACAJ,qBACAF,4BACAC,wBACAO,wBACAC;QAGF,OAAO;gBAAME;oBAAAA,qCAAAA,0BAA0BG,OAAO,cAAjCH,yDAAAA,mCAAmCI,OAAO;;IACzD,GAAG;QAACL;QAAQJ;QAAIE;QAAwBC;KAAyB;IAEjEV,MAAMiB,mBAAmB,CACvBT,YACA,IAAO,CAAA;YACLU,uBAAsBZ,KAAK;oBAClBM;gBAAP,QAAOA,qCAAAA,0BAA0BG,OAAO,cAAjCH,yDAAAA,mCAAmCM,qBAAqB,CAACZ;YAClE;YAEAa;oBACSP;oBAAAA;gBAAP,OAAOA,CAAAA,wDAAAA,qCAAAA,0BAA0BG,OAAO,cAAjCH,yDAAAA,mCAAmCO,iBAAiB,gBAApDP,kEAAAA,uDAA0D,EAAE;YACrE;YAEAQ,uBAAsBC,cAAc;oBAClCT;iBAAAA,qCAAAA,0BAA0BG,OAAO,cAAjCH,yDAAAA,mCAAmCQ,qBAAqB,CAACC;YAC3D;YAEAC,4BAA2BD,cAAc,EAAEf,KAAK;oBAC9CM;iBAAAA,qCAAAA,0BAA0BG,OAAO,cAAjCH,yDAAAA,mCAAmCU,0BAA0B,CAACD,gBAAgBf;YAChF;QACF,CAAA,GACA,EAAE;IAEJ,OAAO;AACT,EAAE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["ChatInputEntityPlugin.types.ts"],"sourcesContent":["import type { ChatInputEntityData } from '@fluentui-copilot/chat-input-plugins';\nimport type { ChatInputEntityProps } from '../../ChatInputEntity';\n\nexport type ChatInputEntityPluginRef<ExtraDataType = undefined> = {\n // Inserts a new entity and returns its key, to be used by removeChatInputEntity or updateChatInputEntityProps\n insertChatInputEntity: (props: ChatInputEntityData<ExtraDataType, ChatInputEntityProps>) => string | undefined;\n // Removes an entity by its key, or removes all entities that match a predicate function\n removeChatInputEntity: (\n keyOrPredicate: string | ((entity: ChatInputEntityData<ExtraDataType, ChatInputEntityProps>, i: number) => boolean),\n ) => void;\n // Updates an entity by its key, or removes all entities that match a predicate function\n updateChatInputEntityProps: (\n keyOrPredicate: string | ((entity: ChatInputEntityData<ExtraDataType, ChatInputEntityProps>, i: number) => boolean),\n props:\n | ChatInputEntityData<ExtraDataType, ChatInputEntityProps>\n | ((\n oldProps: ChatInputEntityData<ExtraDataType, ChatInputEntityProps>,\n ) => ChatInputEntityData<ExtraDataType, ChatInputEntityProps>),\n ) => void;\n getActiveEntities: () => ChatInputEntityData<ExtraDataType, ChatInputEntityProps>[];\n};\n"],"names":[],"mappings":"AAAA,WAoBE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["index.ts"],"sourcesContent":["export * from './ChatInputEntity.node';\nexport * from './ChatInputEntityPlugin';\nexport * from './ChatInputEntityPlugin.types';\n"],"names":[],"mappings":"AAAA,cAAc,yBAAyB;AACvC,cAAc,0BAA0B;AACxC,cAAc,gCAAgC"}
|