@fluentui-copilot/react-chat-input-plugins 0.0.0-nightly-20251010-0406-7df7c6d1.1 → 0.0.0-nightly-20251013-0406-7c7739c8.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 +3 -3
- package/CHANGELOG.md +4 -4
- package/dist/index.d.ts +283 -0
- package/lib/BasicFunctionality.js +1 -0
- package/lib/BasicFunctionality.js.map +1 -0
- package/lib/ChatInputEntity.js +2 -0
- package/lib/ChatInputEntity.js.map +1 -0
- package/lib/ChatInputToken.js +1 -0
- package/lib/ChatInputToken.js.map +1 -0
- package/lib/GhostText.js +3 -0
- package/lib/GhostText.js.map +1 -0
- package/lib/ImperativeControl.js +1 -0
- package/lib/ImperativeControl.js.map +1 -0
- package/lib/PasteUnfurling.js +1 -0
- package/lib/PasteUnfurling.js.map +1 -0
- package/lib/components/ChatInputEntity/ChatInputEntity.js +11 -0
- package/lib/components/ChatInputEntity/ChatInputEntity.js.map +1 -0
- package/lib/components/ChatInputEntity/ChatInputEntity.types.js +4 -0
- package/lib/components/ChatInputEntity/ChatInputEntity.types.js.map +1 -0
- package/lib/components/ChatInputEntity/index.js +4 -0
- package/lib/components/ChatInputEntity/index.js.map +1 -0
- package/lib/components/ChatInputEntity/renderChatInputEntity.js +13 -0
- package/lib/components/ChatInputEntity/renderChatInputEntity.js.map +1 -0
- package/lib/components/ChatInputEntity/useChatInputEntity.js +51 -0
- package/lib/components/ChatInputEntity/useChatInputEntity.js.map +1 -0
- package/lib/components/ChatInputEntity/useChatInputEntityStyles.styles.js +47 -0
- package/lib/components/ChatInputEntity/useChatInputEntityStyles.styles.js.map +1 -0
- package/lib/components/ChatInputEntity/useChatInputEntityStyles.styles.raw.js +43 -0
- package/lib/components/ChatInputEntity/useChatInputEntityStyles.styles.raw.js.map +1 -0
- package/lib/components/ChatInputToken/ChatInputToken.js +11 -0
- package/lib/components/ChatInputToken/ChatInputToken.js.map +1 -0
- package/lib/components/ChatInputToken/ChatInputToken.node.js +59 -0
- package/lib/components/ChatInputToken/ChatInputToken.node.js.map +1 -0
- package/lib/components/ChatInputToken/ChatInputToken.types.js +3 -0
- package/lib/components/ChatInputToken/ChatInputToken.types.js.map +1 -0
- package/lib/components/ChatInputToken/index.js +5 -0
- package/lib/components/ChatInputToken/index.js.map +1 -0
- package/lib/components/ChatInputToken/renderChatInputToken.js +8 -0
- package/lib/components/ChatInputToken/renderChatInputToken.js.map +1 -0
- package/lib/components/ChatInputToken/useChatInputToken.js +23 -0
- package/lib/components/ChatInputToken/useChatInputToken.js.map +1 -0
- package/lib/components/ChatInputToken/useChatInputTokenStyles.styles.js +20 -0
- package/lib/components/ChatInputToken/useChatInputTokenStyles.styles.js.map +1 -0
- package/lib/components/ChatInputToken/useChatInputTokenStyles.styles.raw.js +25 -0
- package/lib/components/ChatInputToken/useChatInputTokenStyles.styles.raw.js.map +1 -0
- package/lib/components/GhostText/GhostText.js +11 -0
- package/lib/components/GhostText/GhostText.js.map +1 -0
- package/lib/components/GhostText/GhostText.types.js +4 -0
- package/lib/components/GhostText/GhostText.types.js.map +1 -0
- package/lib/components/GhostText/index.js +4 -0
- package/lib/components/GhostText/index.js.map +1 -0
- package/lib/components/GhostText/renderGhostText.js +13 -0
- package/lib/components/GhostText/renderGhostText.js.map +1 -0
- package/lib/components/GhostText/useGhostText.js +49 -0
- package/lib/components/GhostText/useGhostText.js.map +1 -0
- package/lib/components/GhostText/useGhostTextStyles.styles.js +60 -0
- package/lib/components/GhostText/useGhostTextStyles.styles.js.map +1 -0
- package/lib/components/GhostText/useGhostTextStyles.styles.raw.js +35 -0
- package/lib/components/GhostText/useGhostTextStyles.styles.raw.js.map +1 -0
- package/lib/index.js +6 -0
- package/lib/index.js.map +1 -0
- package/lib/plugins/BasicFunctionality/BasicFunctionality.js +58 -0
- package/lib/plugins/BasicFunctionality/BasicFunctionality.js.map +1 -0
- package/lib/plugins/BasicFunctionality/index.js +1 -0
- package/lib/plugins/BasicFunctionality/index.js.map +1 -0
- package/lib/plugins/ChatInputEntity/ChatInputEntity.node.js +78 -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 +1 -0
- package/lib/plugins/ChatInputEntity/ChatInputEntityPlugin.types.js.map +1 -0
- package/lib/plugins/ChatInputEntity/index.js +2 -0
- package/lib/plugins/ChatInputEntity/index.js.map +1 -0
- package/lib/plugins/GhostText/GhostText.js +50 -0
- package/lib/plugins/GhostText/GhostText.js.map +1 -0
- package/lib/plugins/GhostText/GhostText.node.js +66 -0
- package/lib/plugins/GhostText/GhostText.node.js.map +1 -0
- package/lib/plugins/GhostText/index.js +2 -0
- package/lib/plugins/GhostText/index.js.map +1 -0
- package/lib/plugins/ImperativeControl/ImperativeControl.js +10 -0
- package/lib/plugins/ImperativeControl/ImperativeControl.js.map +1 -0
- package/lib/plugins/ImperativeControl/index.js +1 -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 +1 -0
- package/lib/plugins/ManualGhostText/index.js.map +1 -0
- package/lib/plugins/PasteUnfurling/PasteUnfurling.js +19 -0
- package/lib/plugins/PasteUnfurling/PasteUnfurling.js.map +1 -0
- package/lib/plugins/PasteUnfurling/index.js +1 -0
- package/lib/plugins/PasteUnfurling/index.js.map +1 -0
- package/lib-commonjs/BasicFunctionality.js +11 -0
- package/lib-commonjs/BasicFunctionality.js.map +1 -0
- package/lib-commonjs/ChatInputEntity.js +41 -0
- package/lib-commonjs/ChatInputEntity.js.map +1 -0
- package/lib-commonjs/ChatInputToken.js +37 -0
- package/lib-commonjs/ChatInputToken.js.map +1 -0
- package/lib-commonjs/GhostText.js +45 -0
- package/lib-commonjs/GhostText.js.map +1 -0
- package/lib-commonjs/ImperativeControl.js +11 -0
- package/lib-commonjs/ImperativeControl.js.map +1 -0
- package/lib-commonjs/PasteUnfurling.js +11 -0
- package/lib-commonjs/PasteUnfurling.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 +8 -0
- package/lib-commonjs/components/ChatInputEntity/ChatInputEntity.types.js.map +1 -0
- package/lib-commonjs/components/ChatInputEntity/index.js +31 -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.styles.js +72 -0
- package/lib-commonjs/components/ChatInputEntity/useChatInputEntityStyles.styles.js.map +1 -0
- package/lib-commonjs/components/ChatInputEntity/useChatInputEntityStyles.styles.raw.js +59 -0
- package/lib-commonjs/components/ChatInputEntity/useChatInputEntityStyles.styles.raw.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 +6 -0
- package/lib-commonjs/components/ChatInputToken/ChatInputToken.types.js.map +1 -0
- package/lib-commonjs/components/ChatInputToken/index.js +41 -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.styles.js +33 -0
- package/lib-commonjs/components/ChatInputToken/useChatInputTokenStyles.styles.js.map +1 -0
- package/lib-commonjs/components/ChatInputToken/useChatInputTokenStyles.styles.raw.js +41 -0
- package/lib-commonjs/components/ChatInputToken/useChatInputTokenStyles.styles.raw.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 +8 -0
- package/lib-commonjs/components/GhostText/GhostText.types.js.map +1 -0
- package/lib-commonjs/components/GhostText/index.js +31 -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 +51 -0
- package/lib-commonjs/components/GhostText/useGhostText.js.map +1 -0
- package/lib-commonjs/components/GhostText/useGhostTextStyles.styles.js +98 -0
- package/lib-commonjs/components/GhostText/useGhostTextStyles.styles.js.map +1 -0
- package/lib-commonjs/components/GhostText/useGhostTextStyles.styles.raw.js +51 -0
- package/lib-commonjs/components/GhostText/useGhostTextStyles.styles.raw.js.map +1 -0
- package/lib-commonjs/index.js +108 -0
- package/lib-commonjs/index.js.map +1 -0
- package/lib-commonjs/plugins/BasicFunctionality/BasicFunctionality.js +69 -0
- package/lib-commonjs/plugins/BasicFunctionality/BasicFunctionality.js.map +1 -0
- package/lib-commonjs/plugins/BasicFunctionality/index.js +11 -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 +53 -0
- package/lib-commonjs/plugins/ChatInputEntity/ChatInputEntityPlugin.js.map +1 -0
- package/lib-commonjs/plugins/ChatInputEntity/ChatInputEntityPlugin.types.js +4 -0
- package/lib-commonjs/plugins/ChatInputEntity/ChatInputEntityPlugin.types.js.map +1 -0
- package/lib-commonjs/plugins/ChatInputEntity/index.js +26 -0
- package/lib-commonjs/plugins/ChatInputEntity/index.js.map +1 -0
- package/lib-commonjs/plugins/GhostText/GhostText.js +60 -0
- package/lib-commonjs/plugins/GhostText/GhostText.js.map +1 -0
- package/lib-commonjs/plugins/GhostText/GhostText.node.js +88 -0
- package/lib-commonjs/plugins/GhostText/GhostText.node.js.map +1 -0
- package/lib-commonjs/plugins/GhostText/index.js +26 -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 +11 -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 +11 -0
- package/lib-commonjs/plugins/ManualGhostText/index.js.map +1 -0
- package/lib-commonjs/plugins/PasteUnfurling/PasteUnfurling.js +30 -0
- package/lib-commonjs/plugins/PasteUnfurling/PasteUnfurling.js.map +1 -0
- package/lib-commonjs/plugins/PasteUnfurling/index.js +11 -0
- package/lib-commonjs/plugins/PasteUnfurling/index.js.map +1 -0
- package/package.json +5 -5
|
@@ -0,0 +1,59 @@
|
|
|
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
|
+
text: this.__text,
|
|
27
|
+
componentProps: this.__componentProps,
|
|
28
|
+
type: ChatInputTokenNode.getType(),
|
|
29
|
+
version: 1
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
createDOM() {
|
|
33
|
+
// eslint-disable-next-line no-restricted-globals
|
|
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
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -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":[],"rangeMappings":";;","mappings":"AAWA;;CAEC,GACD,WAAsE"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { ChatInputToken } from './ChatInputToken';
|
|
2
|
+
export { renderChatInputToken_unstable } from './renderChatInputToken';
|
|
3
|
+
export { useChatInputToken_unstable } from './useChatInputToken';
|
|
4
|
+
export { chatInputTokenClassNames, useChatInputTokenStyles_unstable } from './useChatInputTokenStyles.styles';
|
|
5
|
+
export { $createChatInputTokenNode, $isChatInputTokenNode, ChatInputTokenNode } from './ChatInputToken.node';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["index.ts"],"sourcesContent":["export { ChatInputToken } from './ChatInputToken';\nexport type { ChatInputTokenProps, ChatInputTokenSlots, ChatInputTokenState } from './ChatInputToken.types';\nexport { renderChatInputToken_unstable } from './renderChatInputToken';\nexport { useChatInputToken_unstable } from './useChatInputToken';\nexport { chatInputTokenClassNames, useChatInputTokenStyles_unstable } from './useChatInputTokenStyles.styles';\nexport type { SerializedChatInputTokenNode } from './ChatInputToken.node';\nexport { $createChatInputTokenNode, $isChatInputTokenNode, ChatInputTokenNode } from './ChatInputToken.node';\n"],"names":["ChatInputToken","renderChatInputToken_unstable","useChatInputToken_unstable","chatInputTokenClassNames","useChatInputTokenStyles_unstable","$createChatInputTokenNode","$isChatInputTokenNode","ChatInputTokenNode"],"rangeMappings":";;;;","mappings":"AAAA,SAASA,cAAc,QAAQ,mBAAmB;AAElD,SAASC,6BAA6B,QAAQ,yBAAyB;AACvE,SAASC,0BAA0B,QAAQ,sBAAsB;AACjE,SAASC,wBAAwB,EAAEC,gCAAgC,QAAQ,mCAAmC;AAE9G,SAASC,yBAAyB,EAAEC,qBAAqB,EAAEC,kBAAkB,QAAQ,wBAAwB"}
|
|
@@ -0,0 +1,8 @@
|
|
|
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
|
+
*/ export const renderChatInputToken_unstable = (state)=>{
|
|
6
|
+
assertSlots(state);
|
|
7
|
+
return /*#__PURE__*/ _jsx(state.root, {});
|
|
8
|
+
};
|
|
@@ -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 { 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"}
|
|
@@ -0,0 +1,23 @@
|
|
|
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
|
+
*/ export const useChatInputToken_unstable = (props, ref)=>{
|
|
12
|
+
return {
|
|
13
|
+
components: {
|
|
14
|
+
root: 'span'
|
|
15
|
+
},
|
|
16
|
+
root: slot.always(getIntrinsicElementProps('span', {
|
|
17
|
+
ref,
|
|
18
|
+
...props
|
|
19
|
+
}), {
|
|
20
|
+
elementType: 'span'
|
|
21
|
+
})
|
|
22
|
+
};
|
|
23
|
+
};
|
|
@@ -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"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;","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,20 @@
|
|
|
1
|
+
import { __resetStyles, mergeClasses } from '@fluentui/react-components';
|
|
2
|
+
import { tokens, typographyStyles } from '@fluentui-copilot/tokens';
|
|
3
|
+
export const chatInputTokenClassNames = {
|
|
4
|
+
root: 'fai-ChatInputToken'
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Styles for the root slot
|
|
8
|
+
*/
|
|
9
|
+
const useBaseClassName = __resetStyles("r1ksolxu", null, [".r1ksolxu{font-family:var(--fontFamilyBase);font-size:var(--fontSizeBase200);font-weight:var(--fontWeightRegular);line-height:calc(var(--lineHeightBase200) + (2 * var(--spacingVerticalXXS)) + (2 * var(--strokeWidthThin)));background-color:var(--colorNeutralBackground3);border:var(--strokeWidthThin) solid var(--colorTransparentStroke);border-radius:var(--borderRadiusMedium);-webkit-box-decoration-break:clone;box-decoration-break:clone;color:var(--colorNeutralForeground2);padding:var(--spacingVerticalXXS) 0;}"]);
|
|
10
|
+
/**
|
|
11
|
+
* Apply styling to the ChatInputToken slots based on the state
|
|
12
|
+
*/
|
|
13
|
+
export const useChatInputTokenStyles_unstable = state => {
|
|
14
|
+
'use no memo';
|
|
15
|
+
|
|
16
|
+
const baseClassName = useBaseClassName();
|
|
17
|
+
state.root.className = mergeClasses(chatInputTokenClassNames.root, baseClassName, state.root.className);
|
|
18
|
+
return state;
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=useChatInputTokenStyles.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["useChatInputTokenStyles.styles.ts"],"sourcesContent":["import { makeResetStyles, mergeClasses } from '@fluentui/react-components';\nimport { tokens, typographyStyles } from '@fluentui-copilot/tokens';\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.caption1,\n lineHeight: `calc(${tokens.lineHeightBase200} + (2 * ${tokens.spacingVerticalXXS}) + (2 * ${tokens.strokeWidthThin}))`,\n backgroundColor: tokens.colorNeutralBackground3,\n border: `${tokens.strokeWidthThin} solid ${tokens.colorTransparentStroke}`,\n borderRadius: tokens.borderRadiusMedium,\n boxDecorationBreak: 'clone',\n color: tokens.colorNeutralForeground2,\n padding: `${tokens.spacingVerticalXXS} 0`,\n});\n\n/**\n * Apply styling to the ChatInputToken slots based on the state\n */\nexport const useChatInputTokenStyles_unstable = (state: ChatInputTokenState): ChatInputTokenState => {\n 'use no memo';\n\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","caption1","lineHeight","lineHeightBase200","spacingVerticalXXS","strokeWidthThin","backgroundColor","colorNeutralBackground3","border","colorTransparentStroke","borderRadius","borderRadiusMedium","boxDecorationBreak","color","colorNeutralForeground2","padding","useChatInputTokenStyles_unstable","state","baseClassName","className"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,SAASA,eAAe,EAAEC,YAAY,QAAQ,6BAA6B;AAC3E,SAASC,MAAM,EAAEC,gBAAgB,QAAQ,2BAA2B;AAIpE,OAAO,MAAMC,2BAAgE;IAC3EC,MAAM;AACR,EAAE;AAEF;;CAEC,GACD,MAAMC,mBAAmBN,gBAAgB;IACvC,GAAGG,iBAAiBI,QAAQ;IAC5BC,YAAY,CAAC,KAAK,EAAEN,OAAOO,iBAAiB,CAAC,QAAQ,EAAEP,OAAOQ,kBAAkB,CAAC,SAAS,EAAER,OAAOS,eAAe,CAAC,EAAE,CAAC;IACtHC,iBAAiBV,OAAOW,uBAAuB;IAC/CC,QAAQ,CAAC,EAAEZ,OAAOS,eAAe,CAAC,OAAO,EAAET,OAAOa,sBAAsB,CAAC,CAAC;IAC1EC,cAAcd,OAAOe,kBAAkB;IACvCC,oBAAoB;IACpBC,OAAOjB,OAAOkB,uBAAuB;IACrCC,SAAS,CAAC,EAAEnB,OAAOQ,kBAAkB,CAAC,EAAE,CAAC;AAC3C;AAEA;;CAEC,GACD,OAAO,MAAMY,mCAAmC,CAACC;IAC/C;IAEA,MAAMC,gBAAgBlB;IACtBiB,MAAMlB,IAAI,CAACoB,SAAS,GAAGxB,aAAaG,yBAAyBC,IAAI,EAAEmB,eAAeD,MAAMlB,IAAI,CAACoB,SAAS;IAEtG,OAAOF;AACT,EAAE"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { makeResetStyles, mergeClasses } from '@fluentui/react-components';
|
|
2
|
+
import { tokens, typographyStyles } from '@fluentui-copilot/tokens';
|
|
3
|
+
export const chatInputTokenClassNames = {
|
|
4
|
+
root: 'fai-ChatInputToken'
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Styles for the root slot
|
|
8
|
+
*/ const useBaseClassName = makeResetStyles({
|
|
9
|
+
...typographyStyles.caption1,
|
|
10
|
+
lineHeight: `calc(${tokens.lineHeightBase200} + (2 * ${tokens.spacingVerticalXXS}) + (2 * ${tokens.strokeWidthThin}))`,
|
|
11
|
+
backgroundColor: tokens.colorNeutralBackground3,
|
|
12
|
+
border: `${tokens.strokeWidthThin} solid ${tokens.colorTransparentStroke}`,
|
|
13
|
+
borderRadius: tokens.borderRadiusMedium,
|
|
14
|
+
boxDecorationBreak: 'clone',
|
|
15
|
+
color: tokens.colorNeutralForeground2,
|
|
16
|
+
padding: `${tokens.spacingVerticalXXS} 0`
|
|
17
|
+
});
|
|
18
|
+
/**
|
|
19
|
+
* Apply styling to the ChatInputToken slots based on the state
|
|
20
|
+
*/ export const useChatInputTokenStyles_unstable = (state)=>{
|
|
21
|
+
'use no memo';
|
|
22
|
+
const baseClassName = useBaseClassName();
|
|
23
|
+
state.root.className = mergeClasses(chatInputTokenClassNames.root, baseClassName, state.root.className);
|
|
24
|
+
return state;
|
|
25
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["useChatInputTokenStyles.styles.ts"],"sourcesContent":["import { makeResetStyles, mergeClasses } from '@fluentui/react-components';\nimport { tokens, typographyStyles } from '@fluentui-copilot/tokens';\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.caption1,\n lineHeight: `calc(${tokens.lineHeightBase200} + (2 * ${tokens.spacingVerticalXXS}) + (2 * ${tokens.strokeWidthThin}))`,\n backgroundColor: tokens.colorNeutralBackground3,\n border: `${tokens.strokeWidthThin} solid ${tokens.colorTransparentStroke}`,\n borderRadius: tokens.borderRadiusMedium,\n boxDecorationBreak: 'clone',\n color: tokens.colorNeutralForeground2,\n padding: `${tokens.spacingVerticalXXS} 0`,\n});\n\n/**\n * Apply styling to the ChatInputToken slots based on the state\n */\nexport const useChatInputTokenStyles_unstable = (state: ChatInputTokenState): ChatInputTokenState => {\n 'use no memo';\n\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","caption1","lineHeight","lineHeightBase200","spacingVerticalXXS","strokeWidthThin","backgroundColor","colorNeutralBackground3","border","colorTransparentStroke","borderRadius","borderRadiusMedium","boxDecorationBreak","color","colorNeutralForeground2","padding","useChatInputTokenStyles_unstable","state","baseClassName","className"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,SAASA,eAAe,EAAEC,YAAY,QAAQ,6BAA6B;AAC3E,SAASC,MAAM,EAAEC,gBAAgB,QAAQ,2BAA2B;AAIpE,OAAO,MAAMC,2BAAgE;IAC3EC,MAAM;AACR,EAAE;AAEF;;CAEC,GACD,MAAMC,mBAAmBN,gBAAgB;IACvC,GAAGG,iBAAiBI,QAAQ;IAC5BC,YAAY,CAAC,KAAK,EAAEN,OAAOO,iBAAiB,CAAC,QAAQ,EAAEP,OAAOQ,kBAAkB,CAAC,SAAS,EAAER,OAAOS,eAAe,CAAC,EAAE,CAAC;IACtHC,iBAAiBV,OAAOW,uBAAuB;IAC/CC,QAAQ,CAAC,EAAEZ,OAAOS,eAAe,CAAC,OAAO,EAAET,OAAOa,sBAAsB,CAAC,CAAC;IAC1EC,cAAcd,OAAOe,kBAAkB;IACvCC,oBAAoB;IACpBC,OAAOjB,OAAOkB,uBAAuB;IACrCC,SAAS,CAAC,EAAEnB,OAAOQ,kBAAkB,CAAC,EAAE,CAAC;AAC3C;AAEA;;CAEC,GACD,OAAO,MAAMY,mCAAmC,CAACC;IAC/C;IAEA,MAAMC,gBAAgBlB;IACtBiB,MAAMlB,IAAI,CAACoB,SAAS,GAAGxB,aAAaG,yBAAyBC,IAAI,EAAEmB,eAAeD,MAAMlB,IAAI,CAACoB,SAAS;IAEtG,OAAOF;AACT,EAAE"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useGhostText_unstable } from './useGhostText';
|
|
3
|
+
import { renderGhostText_unstable } from './renderGhostText';
|
|
4
|
+
import { useGhostTextStyles_unstable } from './useGhostTextStyles.styles';
|
|
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';
|
|
@@ -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.styles';\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"],"rangeMappings":";;;;;;;;;;","mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,qBAAqB,QAAQ,iBAAiB;AACvD,SAASC,wBAAwB,QAAQ,oBAAoB;AAC7D,SAASC,2BAA2B,QAAQ,8BAA8B;AAI1E,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> & { nodeKey?: string };\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":[],"rangeMappings":";;;","mappings":"AAYA;;CAEC,GACD,WAA4D,CAC5D,0HAA0H;CAC1H,+CAA+C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["index.ts"],"sourcesContent":["export { GhostText } from './GhostText';\nexport type { GhostTextProps, GhostTextSlots, GhostTextState } from './GhostText.types';\nexport { renderGhostText_unstable } from './renderGhostText';\nexport { useGhostText_unstable } from './useGhostText';\nexport { ghostTextClassNames, useGhostTextStyles_unstable } from './useGhostTextStyles.styles';\n"],"names":["GhostText","renderGhostText_unstable","useGhostText_unstable","ghostTextClassNames","useGhostTextStyles_unstable"],"rangeMappings":";;;","mappings":"AAAA,SAASA,SAAS,QAAQ,cAAc;AAExC,SAASC,wBAAwB,QAAQ,oBAAoB;AAC7D,SAASC,qBAAqB,QAAQ,iBAAiB;AACvD,SAASC,mBAAmB,EAAEC,2BAA2B,QAAQ,8BAA8B"}
|
|
@@ -0,0 +1,13 @@
|
|
|
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
|
+
*/ export const renderGhostText_unstable = (state)=>{
|
|
6
|
+
assertSlots(state);
|
|
7
|
+
return /*#__PURE__*/ _jsxs(state.root, {
|
|
8
|
+
children: [
|
|
9
|
+
state.root.children,
|
|
10
|
+
state.indicator && /*#__PURE__*/ _jsx(state.indicator, {})
|
|
11
|
+
]
|
|
12
|
+
});
|
|
13
|
+
};
|
|
@@ -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 { 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"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { getIntrinsicElementProps, mergeCallbacks, slot } from '@fluentui/react-components';
|
|
3
|
+
import { $getNodeByKey, useLexicalComposerContext } from '@fluentui-copilot/react-text-editor';
|
|
4
|
+
// If you add JSX to this file, be sure to change the file type to .tsx
|
|
5
|
+
/**
|
|
6
|
+
* Create the state required to render GhostText.
|
|
7
|
+
*
|
|
8
|
+
* The returned state can be modified with hooks such as useGhostTextStyles_unstable,
|
|
9
|
+
* before being passed to renderGhostText_unstable.
|
|
10
|
+
*
|
|
11
|
+
* @param props - props from this instance of GhostText
|
|
12
|
+
* @param ref - reference to root HTMLElement of GhostText
|
|
13
|
+
*/ export const useGhostText_unstable = (props, ref)=>{
|
|
14
|
+
const { nodeKey, onClick, ...rest } = props;
|
|
15
|
+
const [editor] = useLexicalComposerContext();
|
|
16
|
+
const handleClick = React.useCallback((_ev)=>{
|
|
17
|
+
if (!nodeKey) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
editor.update(()=>{
|
|
21
|
+
var _node_getPreviousSibling;
|
|
22
|
+
const node = $getNodeByKey(nodeKey);
|
|
23
|
+
node === null || node === void 0 ? void 0 : (_node_getPreviousSibling = node.getPreviousSibling()) === null || _node_getPreviousSibling === void 0 ? void 0 : _node_getPreviousSibling.selectEnd();
|
|
24
|
+
}, {
|
|
25
|
+
tag: 'historic'
|
|
26
|
+
});
|
|
27
|
+
}, [
|
|
28
|
+
editor,
|
|
29
|
+
nodeKey
|
|
30
|
+
]);
|
|
31
|
+
const mergedOnClick = mergeCallbacks(handleClick, onClick);
|
|
32
|
+
const state = {
|
|
33
|
+
components: {
|
|
34
|
+
root: 'span',
|
|
35
|
+
indicator: 'span'
|
|
36
|
+
},
|
|
37
|
+
root: slot.always(getIntrinsicElementProps('span', {
|
|
38
|
+
ref,
|
|
39
|
+
onClick: mergedOnClick,
|
|
40
|
+
...rest
|
|
41
|
+
}), {
|
|
42
|
+
elementType: 'span'
|
|
43
|
+
}),
|
|
44
|
+
indicator: slot.optional(props.indicator, {
|
|
45
|
+
elementType: 'span'
|
|
46
|
+
})
|
|
47
|
+
};
|
|
48
|
+
return state;
|
|
49
|
+
};
|
|
@@ -0,0 +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: 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"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { __styles, mergeClasses } from '@fluentui/react-components';
|
|
2
|
+
import { tokens, typographyStyles } from '@fluentui-copilot/tokens';
|
|
3
|
+
export const ghostTextClassNames = {
|
|
4
|
+
root: 'fai-GhostText',
|
|
5
|
+
indicator: 'fai-GhostText__indicator'
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Styles for the root slot
|
|
9
|
+
*/
|
|
10
|
+
const useStyles = __styles({
|
|
11
|
+
root: {
|
|
12
|
+
sj55zd: "fxc4j92",
|
|
13
|
+
Huce71: "fibxuh5",
|
|
14
|
+
i8kkvl: 0,
|
|
15
|
+
Belr9w4: 0,
|
|
16
|
+
rmohyg: "fkln5zr"
|
|
17
|
+
},
|
|
18
|
+
indicator: {
|
|
19
|
+
Bahqtrf: "fk6fouc",
|
|
20
|
+
Be2twd7: "f13mqy1h",
|
|
21
|
+
Bhrd7zp: "flh3ekv",
|
|
22
|
+
Bg96gwp: "fwrc4pm",
|
|
23
|
+
sj55zd: "f11d4kpn",
|
|
24
|
+
De3pzq: "f3vzo32",
|
|
25
|
+
Byoj8tv: 0,
|
|
26
|
+
uwmqm3: 0,
|
|
27
|
+
z189sj: 0,
|
|
28
|
+
z8tnut: 0,
|
|
29
|
+
B0ocmuz: "f1vo1c1k",
|
|
30
|
+
Beyfa6y: 0,
|
|
31
|
+
Bbmb7ep: 0,
|
|
32
|
+
Btl43ni: 0,
|
|
33
|
+
B7oj6ja: 0,
|
|
34
|
+
Dimara: "fq9zq91",
|
|
35
|
+
Frg6f3: ["fbyavb5", "fm0x6gh"],
|
|
36
|
+
Cd5d3v: "f1pc5kto"
|
|
37
|
+
}
|
|
38
|
+
}, {
|
|
39
|
+
d: [".fxc4j92{color:var(--colorNeutralForeground4);}", ".fibxuh5{white-space:pre-wrap;}", [".fkln5zr{gap:var(--spacingHorizontalXS);}", {
|
|
40
|
+
p: -1
|
|
41
|
+
}], ".fk6fouc{font-family:var(--fontFamilyBase);}", ".f13mqy1h{font-size:var(--fontSizeBase100);}", ".flh3ekv{font-weight:var(--fontWeightBold);}", ".fwrc4pm{line-height:var(--lineHeightBase200);}", ".f11d4kpn{color:var(--colorNeutralForeground3);}", ".f3vzo32{background-color:var(--colorNeutralBackground5);}", [".f1vo1c1k{padding:var(--spacingVerticalNone) var(--spacingHorizontalSNudge);}", {
|
|
42
|
+
p: -1
|
|
43
|
+
}], [".fq9zq91{border-radius:var(--borderRadiusSmall);}", {
|
|
44
|
+
p: -1
|
|
45
|
+
}], ".fbyavb5{margin-left:var(--spacingHorizontalXS);}", ".fm0x6gh{margin-right:var(--spacingHorizontalXS);}", ".f1pc5kto{mergin-right:var(--spacingHorizontalXS);}"]
|
|
46
|
+
});
|
|
47
|
+
/**
|
|
48
|
+
* Apply styling to the GhostText slots based on the state
|
|
49
|
+
*/
|
|
50
|
+
export const useGhostTextStyles_unstable = state => {
|
|
51
|
+
'use no memo';
|
|
52
|
+
|
|
53
|
+
const styles = useStyles();
|
|
54
|
+
state.root.className = mergeClasses(ghostTextClassNames.root, styles.root, state.root.className);
|
|
55
|
+
if (state.indicator) {
|
|
56
|
+
state.indicator.className = mergeClasses(ghostTextClassNames.indicator, styles.indicator, state.indicator.className);
|
|
57
|
+
}
|
|
58
|
+
return state;
|
|
59
|
+
};
|
|
60
|
+
//# sourceMappingURL=useGhostTextStyles.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["useGhostTextStyles.styles.ts"],"sourcesContent":["import { makeStyles, mergeClasses } from '@fluentui/react-components';\nimport { tokens, typographyStyles } from '@fluentui-copilot/tokens';\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.colorNeutralForeground4,\n whiteSpace: 'pre-wrap',\n gap: tokens.spacingHorizontalXS,\n },\n\n indicator: {\n ...typographyStyles.caption2Strong,\n color: tokens.colorNeutralForeground3,\n backgroundColor: tokens.colorNeutralBackground5,\n padding: `${tokens.spacingVerticalNone} ${tokens.spacingHorizontalSNudge}`,\n 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 'use no memo';\n\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","tokens","typographyStyles","ghostTextClassNames","root","indicator","useStyles","color","colorNeutralForeground4","whiteSpace","gap","spacingHorizontalXS","caption2Strong","colorNeutralForeground3","backgroundColor","colorNeutralBackground5","padding","spacingVerticalNone","spacingHorizontalSNudge","borderRadius","borderRadiusSmall","marginLeft","merginRight","useGhostTextStyles_unstable","state","styles","className"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,SAASA,UAAU,EAAEC,YAAY,QAAQ,6BAA6B;AACtE,SAASC,MAAM,EAAEC,gBAAgB,QAAQ,2BAA2B;AAIpE,OAAO,MAAMC,sBAAsD;IACjEC,MAAM;IACNC,WAAW;AACb,EAAE;AAEF;;CAEC,GACD,MAAMC,YAAYP,WAAW;IAC3BK,MAAM;QACJG,OAAON,OAAOO,uBAAuB;QACrCC,YAAY;QACZC,KAAKT,OAAOU,mBAAmB;IACjC;IAEAN,WAAW;QACT,GAAGH,iBAAiBU,cAAc;QAClCL,OAAON,OAAOY,uBAAuB;QACrCC,iBAAiBb,OAAOc,uBAAuB;QAC/CC,SAAS,CAAC,EAAEf,OAAOgB,mBAAmB,CAAC,CAAC,EAAEhB,OAAOiB,uBAAuB,CAAC,CAAC;QAC1EC,cAAclB,OAAOmB,iBAAiB;QACtCC,YAAYpB,OAAOU,mBAAmB;QACtCW,aAAarB,OAAOU,mBAAmB;IACzC;AACF;AAEA;;CAEC,GACD,OAAO,MAAMY,8BAA8B,CAACC;IAC1C;IAEA,MAAMC,SAASnB;IACfkB,MAAMpB,IAAI,CAACsB,SAAS,GAAG1B,aAAaG,oBAAoBC,IAAI,EAAEqB,OAAOrB,IAAI,EAAEoB,MAAMpB,IAAI,CAACsB,SAAS;IAE/F,IAAIF,MAAMnB,SAAS,EAAE;QACnBmB,MAAMnB,SAAS,CAACqB,SAAS,GAAG1B,aAC1BG,oBAAoBE,SAAS,EAC7BoB,OAAOpB,SAAS,EAChBmB,MAAMnB,SAAS,CAACqB,SAAS;IAE7B;IAEA,OAAOF;AACT,EAAE"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { makeStyles, mergeClasses } from '@fluentui/react-components';
|
|
2
|
+
import { tokens, typographyStyles } from '@fluentui-copilot/tokens';
|
|
3
|
+
export const ghostTextClassNames = {
|
|
4
|
+
root: 'fai-GhostText',
|
|
5
|
+
indicator: 'fai-GhostText__indicator'
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Styles for the root slot
|
|
9
|
+
*/ const useStyles = makeStyles({
|
|
10
|
+
root: {
|
|
11
|
+
color: tokens.colorNeutralForeground4,
|
|
12
|
+
whiteSpace: 'pre-wrap',
|
|
13
|
+
gap: tokens.spacingHorizontalXS
|
|
14
|
+
},
|
|
15
|
+
indicator: {
|
|
16
|
+
...typographyStyles.caption2Strong,
|
|
17
|
+
color: tokens.colorNeutralForeground3,
|
|
18
|
+
backgroundColor: tokens.colorNeutralBackground5,
|
|
19
|
+
padding: `${tokens.spacingVerticalNone} ${tokens.spacingHorizontalSNudge}`,
|
|
20
|
+
borderRadius: tokens.borderRadiusSmall,
|
|
21
|
+
marginLeft: tokens.spacingHorizontalXS,
|
|
22
|
+
merginRight: tokens.spacingHorizontalXS
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
/**
|
|
26
|
+
* Apply styling to the GhostText slots based on the state
|
|
27
|
+
*/ export const useGhostTextStyles_unstable = (state)=>{
|
|
28
|
+
'use no memo';
|
|
29
|
+
const styles = useStyles();
|
|
30
|
+
state.root.className = mergeClasses(ghostTextClassNames.root, styles.root, state.root.className);
|
|
31
|
+
if (state.indicator) {
|
|
32
|
+
state.indicator.className = mergeClasses(ghostTextClassNames.indicator, styles.indicator, state.indicator.className);
|
|
33
|
+
}
|
|
34
|
+
return state;
|
|
35
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["useGhostTextStyles.styles.ts"],"sourcesContent":["import { makeStyles, mergeClasses } from '@fluentui/react-components';\nimport { tokens, typographyStyles } from '@fluentui-copilot/tokens';\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.colorNeutralForeground4,\n whiteSpace: 'pre-wrap',\n gap: tokens.spacingHorizontalXS,\n },\n\n indicator: {\n ...typographyStyles.caption2Strong,\n color: tokens.colorNeutralForeground3,\n backgroundColor: tokens.colorNeutralBackground5,\n padding: `${tokens.spacingVerticalNone} ${tokens.spacingHorizontalSNudge}`,\n 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 'use no memo';\n\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","tokens","typographyStyles","ghostTextClassNames","root","indicator","useStyles","color","colorNeutralForeground4","whiteSpace","gap","spacingHorizontalXS","caption2Strong","colorNeutralForeground3","backgroundColor","colorNeutralBackground5","padding","spacingVerticalNone","spacingHorizontalSNudge","borderRadius","borderRadiusSmall","marginLeft","merginRight","useGhostTextStyles_unstable","state","styles","className"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,SAASA,UAAU,EAAEC,YAAY,QAAQ,6BAA6B;AACtE,SAASC,MAAM,EAAEC,gBAAgB,QAAQ,2BAA2B;AAIpE,OAAO,MAAMC,sBAAsD;IACjEC,MAAM;IACNC,WAAW;AACb,EAAE;AAEF;;CAEC,GACD,MAAMC,YAAYP,WAAW;IAC3BK,MAAM;QACJG,OAAON,OAAOO,uBAAuB;QACrCC,YAAY;QACZC,KAAKT,OAAOU,mBAAmB;IACjC;IAEAN,WAAW;QACT,GAAGH,iBAAiBU,cAAc;QAClCL,OAAON,OAAOY,uBAAuB;QACrCC,iBAAiBb,OAAOc,uBAAuB;QAC/CC,SAAS,CAAC,EAAEf,OAAOgB,mBAAmB,CAAC,CAAC,EAAEhB,OAAOiB,uBAAuB,CAAC,CAAC;QAC1EC,cAAclB,OAAOmB,iBAAiB;QACtCC,YAAYpB,OAAOU,mBAAmB;QACtCW,aAAarB,OAAOU,mBAAmB;IACzC;AACF;AAEA;;CAEC,GACD,OAAO,MAAMY,8BAA8B,CAACC;IAC1C;IAEA,MAAMC,SAASnB;IACfkB,MAAMpB,IAAI,CAACsB,SAAS,GAAG1B,aAAaG,oBAAoBC,IAAI,EAAEqB,OAAOrB,IAAI,EAAEoB,MAAMpB,IAAI,CAACsB,SAAS;IAE/F,IAAIF,MAAMnB,SAAS,EAAE;QACnBmB,MAAMnB,SAAS,CAACqB,SAAS,GAAG1B,aAC1BG,oBAAoBE,SAAS,EAC7BoB,OAAOpB,SAAS,EAChBmB,MAAMnB,SAAS,CAACqB,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, ChatInputTokenNode, chatInputTokenClassNames, renderChatInputToken_unstable, useChatInputTokenStyles_unstable, useChatInputToken_unstable, $createChatInputTokenNode, $isChatInputTokenNode } from './ChatInputToken';
|
|
4
|
+
export { BasicFunctionalityPlugin } from './BasicFunctionality';
|
|
5
|
+
export { ImperativeControlPlugin } from './ImperativeControl';
|
|
6
|
+
export { PasteUnfurlingPlugin } from './PasteUnfurling';
|
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 ChatInputTokenNode,\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\nexport type { PasteUnfurlingPluginProps } from './PasteUnfurling';\nexport { PasteUnfurlingPlugin } from './PasteUnfurling';\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","ChatInputTokenNode","chatInputTokenClassNames","renderChatInputToken_unstable","useChatInputTokenStyles_unstable","useChatInputToken_unstable","$createChatInputTokenNode","$isChatInputTokenNode","BasicFunctionalityPlugin","ImperativeControlPlugin","PasteUnfurlingPlugin"],"rangeMappings":";;;;;","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,kBAAkB,EAClBC,wBAAwB,EACxBC,6BAA6B,EAC7BC,gCAAgC,EAChCC,0BAA0B,EAC1BC,yBAAyB,EACzBC,qBAAqB,QAChB,mBAAmB;AAG1B,SAASC,wBAAwB,QAAQ,uBAAuB;AAGhE,SAASC,uBAAuB,QAAQ,sBAAsB;AAG9D,SAASC,oBAAoB,QAAQ,mBAAmB"}
|
|
@@ -0,0 +1,58 @@
|
|
|
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 { trimWhitespace, onCountChanged, onContentChange, onPaste, isSentinelNodeEnabled } = props;
|
|
7
|
+
const [editor] = useLexicalComposerContext();
|
|
8
|
+
const [basicFunctionalityImpl, setBasicFunctionalityImpl] = React.useState(null);
|
|
9
|
+
useIsomorphicLayoutEffect(()=>{
|
|
10
|
+
setBasicFunctionalityImpl(new BasicFunctionalityBase(editor, isSentinelNodeEnabled));
|
|
11
|
+
return ()=>{
|
|
12
|
+
setBasicFunctionalityImpl((prev)=>{
|
|
13
|
+
prev === null || prev === void 0 ? void 0 : prev.cleanup();
|
|
14
|
+
return null;
|
|
15
|
+
});
|
|
16
|
+
};
|
|
17
|
+
}, [
|
|
18
|
+
editor,
|
|
19
|
+
isSentinelNodeEnabled
|
|
20
|
+
]);
|
|
21
|
+
React.useImperativeHandle(ref, ()=>({
|
|
22
|
+
setIsDisabled (isDisabled) {
|
|
23
|
+
basicFunctionalityImpl === null || basicFunctionalityImpl === void 0 ? void 0 : basicFunctionalityImpl.setIsDisabled(isDisabled);
|
|
24
|
+
}
|
|
25
|
+
}), [
|
|
26
|
+
basicFunctionalityImpl
|
|
27
|
+
]);
|
|
28
|
+
React.useEffect(()=>{
|
|
29
|
+
basicFunctionalityImpl === null || basicFunctionalityImpl === void 0 ? void 0 : basicFunctionalityImpl.activateContentCallbacks(onContentChange, onCountChanged);
|
|
30
|
+
return ()=>basicFunctionalityImpl === null || basicFunctionalityImpl === void 0 ? void 0 : basicFunctionalityImpl.deactivateContentCallbacks();
|
|
31
|
+
}, [
|
|
32
|
+
basicFunctionalityImpl,
|
|
33
|
+
editor,
|
|
34
|
+
onContentChange,
|
|
35
|
+
onCountChanged
|
|
36
|
+
]);
|
|
37
|
+
React.useEffect(()=>{
|
|
38
|
+
if (onPaste) {
|
|
39
|
+
basicFunctionalityImpl === null || basicFunctionalityImpl === void 0 ? void 0 : basicFunctionalityImpl.activatePasteCallback(onPaste);
|
|
40
|
+
}
|
|
41
|
+
return ()=>basicFunctionalityImpl === null || basicFunctionalityImpl === void 0 ? void 0 : basicFunctionalityImpl.deactivatePasteCallback();
|
|
42
|
+
}, [
|
|
43
|
+
basicFunctionalityImpl,
|
|
44
|
+
editor,
|
|
45
|
+
onPaste
|
|
46
|
+
]);
|
|
47
|
+
React.useEffect(()=>{
|
|
48
|
+
if (trimWhitespace) {
|
|
49
|
+
basicFunctionalityImpl === null || basicFunctionalityImpl === void 0 ? void 0 : basicFunctionalityImpl.activateTrimWhitespace();
|
|
50
|
+
}
|
|
51
|
+
return ()=>basicFunctionalityImpl === null || basicFunctionalityImpl === void 0 ? void 0 : basicFunctionalityImpl.deactivateTrimWhitespace();
|
|
52
|
+
}, [
|
|
53
|
+
basicFunctionalityImpl,
|
|
54
|
+
editor,
|
|
55
|
+
trimWhitespace
|
|
56
|
+
]);
|
|
57
|
+
return null;
|
|
58
|
+
});
|
|
@@ -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 // Whether or not to clear the input when only whitespace is remaining\n trimWhitespace?: boolean;\n onCountChanged?: (count: number) => void;\n onContentChange?: (value: string) => void;\n onPaste?: (event: ClipboardEvent) => void;\n isSentinelNodeEnabled?: boolean;\n};\n\nexport type BasicFunctionalityPluginRef = {\n setIsDisabled: (isDisabled: boolean) => void;\n};\n\nexport const BasicFunctionalityPlugin = React.forwardRef<BasicFunctionalityPluginRef, BasicFunctionalityPluginProps>(\n (props, ref) => {\n const { trimWhitespace, onCountChanged, onContentChange, onPaste, isSentinelNodeEnabled } = props;\n\n const [editor] = useLexicalComposerContext();\n\n const [basicFunctionalityImpl, setBasicFunctionalityImpl] = React.useState<IBasicFunctionalityBase | null>(null);\n\n useIsomorphicLayoutEffect(() => {\n setBasicFunctionalityImpl(new BasicFunctionalityBase(editor, isSentinelNodeEnabled));\n\n return () => {\n setBasicFunctionalityImpl(prev => {\n prev?.cleanup();\n return null;\n });\n };\n }, [editor, isSentinelNodeEnabled]);\n\n React.useImperativeHandle<BasicFunctionalityPluginRef, BasicFunctionalityPluginRef>(\n ref,\n () => ({\n setIsDisabled(isDisabled: boolean) {\n basicFunctionalityImpl?.setIsDisabled(isDisabled);\n },\n }),\n [basicFunctionalityImpl],\n );\n\n React.useEffect(() => {\n basicFunctionalityImpl?.activateContentCallbacks(onContentChange, onCountChanged);\n return () => basicFunctionalityImpl?.deactivateContentCallbacks();\n }, [basicFunctionalityImpl, editor, onContentChange, onCountChanged]);\n\n React.useEffect(() => {\n if (onPaste) {\n basicFunctionalityImpl?.activatePasteCallback(onPaste);\n }\n return () => basicFunctionalityImpl?.deactivatePasteCallback();\n }, [basicFunctionalityImpl, editor, onPaste]);\n\n React.useEffect(() => {\n if (trimWhitespace) {\n basicFunctionalityImpl?.activateTrimWhitespace();\n }\n return () => basicFunctionalityImpl?.deactivateTrimWhitespace();\n }, [basicFunctionalityImpl, editor, trimWhitespace]);\n\n return null;\n },\n);\n"],"names":["React","useLexicalComposerContext","useIsomorphicLayoutEffect","BasicFunctionalityBase","BasicFunctionalityPlugin","forwardRef","props","ref","trimWhitespace","onCountChanged","onContentChange","onPaste","isSentinelNodeEnabled","editor","basicFunctionalityImpl","setBasicFunctionalityImpl","useState","prev","cleanup","useImperativeHandle","setIsDisabled","isDisabled","useEffect","activateContentCallbacks","deactivateContentCallbacks","activatePasteCallback","deactivatePasteCallback","activateTrimWhitespace","deactivateTrimWhitespace"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,yBAAyB,QAAQ,sCAAsC;AAChF,SAASC,yBAAyB,QAAQ,6BAA6B;AAEvE,SAASC,sBAAsB,QAAQ,uCAAuC;AAe9E,OAAO,MAAMC,2BAA2BJ,MAAMK,UAAU,CACtD,CAACC,OAAOC;IACN,MAAM,EAAEC,cAAc,EAAEC,cAAc,EAAEC,eAAe,EAAEC,OAAO,EAAEC,qBAAqB,EAAE,GAAGN;IAE5F,MAAM,CAACO,OAAO,GAAGZ;IAEjB,MAAM,CAACa,wBAAwBC,0BAA0B,GAAGf,MAAMgB,QAAQ,CAAiC;IAE3Gd,0BAA0B;QACxBa,0BAA0B,IAAIZ,uBAAuBU,QAAQD;QAE7D,OAAO;YACLG,0BAA0BE,CAAAA;gBACxBA,iBAAAA,2BAAAA,KAAMC,OAAO;gBACb,OAAO;YACT;QACF;IACF,GAAG;QAACL;QAAQD;KAAsB;IAElCZ,MAAMmB,mBAAmB,CACvBZ,KACA,IAAO,CAAA;YACLa,eAAcC,UAAmB;gBAC/BP,mCAAAA,6CAAAA,uBAAwBM,aAAa,CAACC;YACxC;QACF,CAAA,GACA;QAACP;KAAuB;IAG1Bd,MAAMsB,SAAS,CAAC;QACdR,mCAAAA,6CAAAA,uBAAwBS,wBAAwB,CAACb,iBAAiBD;QAClE,OAAO,IAAMK,mCAAAA,6CAAAA,uBAAwBU,0BAA0B;IACjE,GAAG;QAACV;QAAwBD;QAAQH;QAAiBD;KAAe;IAEpET,MAAMsB,SAAS,CAAC;QACd,IAAIX,SAAS;YACXG,mCAAAA,6CAAAA,uBAAwBW,qBAAqB,CAACd;QAChD;QACA,OAAO,IAAMG,mCAAAA,6CAAAA,uBAAwBY,uBAAuB;IAC9D,GAAG;QAACZ;QAAwBD;QAAQF;KAAQ;IAE5CX,MAAMsB,SAAS,CAAC;QACd,IAAId,gBAAgB;YAClBM,mCAAAA,6CAAAA,uBAAwBa,sBAAsB;QAChD;QACA,OAAO,IAAMb,mCAAAA,6CAAAA,uBAAwBc,wBAAwB;IAC/D,GAAG;QAACd;QAAwBD;QAAQL;KAAe;IAEnD,OAAO;AACT,GACA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { BasicFunctionalityPlugin } from './BasicFunctionality';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["index.ts"],"sourcesContent":["export type { BasicFunctionalityPluginProps, BasicFunctionalityPluginRef } from './BasicFunctionality';\nexport { BasicFunctionalityPlugin } from './BasicFunctionality';\n"],"names":["BasicFunctionalityPlugin"],"rangeMappings":"","mappings":"AACA,SAASA,wBAAwB,QAAQ,uBAAuB"}
|
|
@@ -0,0 +1,78 @@
|
|
|
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
|
+
pluginId: this.__pluginId,
|
|
27
|
+
text: this.__text,
|
|
28
|
+
data: this.__data,
|
|
29
|
+
entityProps: this.__entityProps,
|
|
30
|
+
type: ChatInputEntityNode.getType(),
|
|
31
|
+
version: 1
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
createDOM() {
|
|
35
|
+
// eslint-disable-next-line no-restricted-globals
|
|
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
|
+
}
|