@fluentui-copilot/react-chat-input-plugins 0.5.1 → 0.5.3
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 +37 -1
- package/CHANGELOG.md +21 -2
- package/lib/BasicFunctionality.js +0 -1
- package/lib/ChatInputEntity.js +0 -1
- package/lib/ChatInputToken.js +0 -1
- package/lib/GhostText.js +0 -1
- package/lib/ImperativeControl.js +0 -1
- package/lib/PasteUnfurling.js +0 -1
- package/lib/components/ChatInputEntity/ChatInputEntity.js +4 -5
- package/lib/components/ChatInputEntity/ChatInputEntity.types.js +2 -3
- package/lib/components/ChatInputEntity/index.js +0 -1
- package/lib/components/ChatInputEntity/renderChatInputEntity.js +9 -8
- package/lib/components/ChatInputEntity/useChatInputEntity.js +40 -44
- 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 +4 -5
- package/lib/components/ChatInputToken/ChatInputToken.node.js +49 -50
- package/lib/components/ChatInputToken/ChatInputToken.types.js +1 -2
- package/lib/components/ChatInputToken/index.js +0 -1
- package/lib/components/ChatInputToken/renderChatInputToken.js +4 -6
- package/lib/components/ChatInputToken/useChatInputToken.js +12 -14
- 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 +4 -5
- package/lib/components/GhostText/GhostText.types.js +2 -3
- package/lib/components/GhostText/index.js +0 -1
- package/lib/components/GhostText/renderGhostText.js +9 -8
- package/lib/components/GhostText/useGhostText.js +36 -39
- 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 +0 -1
- package/lib/plugins/BasicFunctionality/BasicFunctionality.js +53 -42
- package/lib/plugins/BasicFunctionality/index.js +0 -1
- package/lib/plugins/ChatInputEntity/ChatInputEntity.node.js +67 -68
- package/lib/plugins/ChatInputEntity/ChatInputEntityPlugin.js +37 -38
- package/lib/plugins/ChatInputEntity/ChatInputEntityPlugin.types.js +1 -2
- package/lib/plugins/ChatInputEntity/index.js +0 -1
- package/lib/plugins/GhostText/GhostText.js +43 -37
- package/lib/plugins/GhostText/GhostText.node.js +56 -57
- package/lib/plugins/GhostText/index.js +0 -1
- package/lib/plugins/ImperativeControl/ImperativeControl.js +6 -5
- package/lib/plugins/ImperativeControl/index.js +0 -1
- package/lib/plugins/ManualGhostText/ManualGhostText.js +8 -8
- package/lib/plugins/ManualGhostText/index.js +0 -1
- package/lib/plugins/PasteUnfurling/PasteUnfurling.js +14 -14
- package/lib/plugins/PasteUnfurling/index.js +0 -1
- package/lib-commonjs/BasicFunctionality.js +0 -1
- package/lib-commonjs/ChatInputEntity.js +0 -1
- package/lib-commonjs/ChatInputToken.js +0 -1
- package/lib-commonjs/GhostText.js +0 -1
- package/lib-commonjs/ImperativeControl.js +0 -1
- package/lib-commonjs/PasteUnfurling.js +0 -1
- package/lib-commonjs/components/ChatInputEntity/ChatInputEntity.js +1 -1
- package/lib-commonjs/components/ChatInputEntity/ChatInputEntity.js.map +1 -1
- package/lib-commonjs/components/ChatInputEntity/ChatInputEntity.types.js +0 -1
- package/lib-commonjs/components/ChatInputEntity/ChatInputEntity.types.js.map +1 -1
- package/lib-commonjs/components/ChatInputEntity/index.js +0 -1
- package/lib-commonjs/components/ChatInputEntity/renderChatInputEntity.js +1 -1
- package/lib-commonjs/components/ChatInputEntity/renderChatInputEntity.js.map +1 -1
- package/lib-commonjs/components/ChatInputEntity/useChatInputEntity.js +1 -1
- package/lib-commonjs/components/ChatInputEntity/useChatInputEntity.js.map +1 -1
- 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 +1 -1
- package/lib-commonjs/components/ChatInputToken/ChatInputToken.js.map +1 -1
- package/lib-commonjs/components/ChatInputToken/ChatInputToken.node.js +1 -1
- package/lib-commonjs/components/ChatInputToken/ChatInputToken.node.js.map +1 -1
- package/lib-commonjs/components/ChatInputToken/ChatInputToken.types.js +0 -1
- package/lib-commonjs/components/ChatInputToken/index.js +0 -1
- package/lib-commonjs/components/ChatInputToken/renderChatInputToken.js +1 -1
- package/lib-commonjs/components/ChatInputToken/renderChatInputToken.js.map +1 -1
- package/lib-commonjs/components/ChatInputToken/useChatInputToken.js +1 -1
- package/lib-commonjs/components/ChatInputToken/useChatInputToken.js.map +1 -1
- 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 +1 -1
- package/lib-commonjs/components/GhostText/GhostText.js.map +1 -1
- package/lib-commonjs/components/GhostText/GhostText.types.js +0 -1
- package/lib-commonjs/components/GhostText/GhostText.types.js.map +1 -1
- package/lib-commonjs/components/GhostText/index.js +0 -1
- package/lib-commonjs/components/GhostText/renderGhostText.js +1 -1
- package/lib-commonjs/components/GhostText/renderGhostText.js.map +1 -1
- package/lib-commonjs/components/GhostText/useGhostText.js +1 -1
- package/lib-commonjs/components/GhostText/useGhostText.js.map +1 -1
- 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 +0 -1
- package/lib-commonjs/plugins/BasicFunctionality/BasicFunctionality.js +1 -1
- package/lib-commonjs/plugins/BasicFunctionality/BasicFunctionality.js.map +1 -1
- package/lib-commonjs/plugins/BasicFunctionality/index.js +0 -1
- package/lib-commonjs/plugins/ChatInputEntity/ChatInputEntity.node.js +1 -1
- package/lib-commonjs/plugins/ChatInputEntity/ChatInputEntity.node.js.map +1 -1
- package/lib-commonjs/plugins/ChatInputEntity/ChatInputEntityPlugin.js +1 -1
- package/lib-commonjs/plugins/ChatInputEntity/ChatInputEntityPlugin.js.map +1 -1
- package/lib-commonjs/plugins/ChatInputEntity/ChatInputEntityPlugin.types.js +0 -1
- package/lib-commonjs/plugins/ChatInputEntity/index.js +0 -1
- package/lib-commonjs/plugins/GhostText/GhostText.js +2 -3
- package/lib-commonjs/plugins/GhostText/GhostText.js.map +1 -1
- package/lib-commonjs/plugins/GhostText/GhostText.node.js +1 -1
- package/lib-commonjs/plugins/GhostText/GhostText.node.js.map +1 -1
- package/lib-commonjs/plugins/GhostText/index.js +0 -1
- package/lib-commonjs/plugins/ImperativeControl/ImperativeControl.js +1 -1
- package/lib-commonjs/plugins/ImperativeControl/ImperativeControl.js.map +1 -1
- package/lib-commonjs/plugins/ImperativeControl/index.js +0 -1
- package/lib-commonjs/plugins/ManualGhostText/ManualGhostText.js +1 -1
- package/lib-commonjs/plugins/ManualGhostText/ManualGhostText.js.map +1 -1
- package/lib-commonjs/plugins/ManualGhostText/index.js +0 -1
- package/lib-commonjs/plugins/PasteUnfurling/PasteUnfurling.js +1 -1
- package/lib-commonjs/plugins/PasteUnfurling/PasteUnfurling.js.map +1 -1
- package/lib-commonjs/plugins/PasteUnfurling/index.js +0 -1
- package/package.json +8 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["renderGhostText.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-components';\nimport type { GhostTextState, GhostTextSlots } from './GhostText.types';\n\n/**\n * Render the final JSX of GhostText\n */\nexport const renderGhostText_unstable = (state: GhostTextState) => {\n assertSlots<GhostTextSlots>(state);\n\n return (\n <state.root>\n {state.root.children}\n {state.indicator && <state.indicator />}\n </state.root>\n );\n};\n"],"names":["
|
|
1
|
+
{"version":3,"sources":["renderGhostText.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-components';\nimport type { GhostTextState, GhostTextSlots } from './GhostText.types';\n\n/**\n * Render the final JSX of GhostText\n */\nexport const renderGhostText_unstable = (state: GhostTextState) => {\n assertSlots<GhostTextSlots>(state);\n\n return (\n <state.root>\n {state.root.children}\n {state.indicator && <state.indicator />}\n </state.root>\n );\n};\n"],"names":["renderGhostText_unstable","state","assertSlots","_jsxs","root","children","indicator","_jsx"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BASaA;;;eAAAA;;;4BARb;iCAE4B;AAMrB,MAAMA,2BAA2B,CAACC;IACvCC,IAAAA,4BAAAA,EAA4BD;IAE5B,OAAA,WAAA,GACEE,IAAAA,gBAAA,EAACF,MAAMG,IAAI,EAAA;;YACRH,MAAMG,IAAI,CAACC,QAAQ;YACnBJ,MAAMK,SAAS,IAAA,WAAA,GAAIC,IAAAA,eAAA,EAACN,MAAMK,SAAS,EAAA,CAAA;;;AAG1C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useGhostText.ts"],"sourcesContent":["import * as React from 'react';\nimport { getIntrinsicElementProps, mergeCallbacks, slot } from '@fluentui/react-components';\nimport type { GhostTextProps, GhostTextState } from './GhostText.types';\nimport { $getNodeByKey, useLexicalComposerContext } from '@fluentui-copilot/react-text-editor';\n\n// If you add JSX to this file, be sure to change the file type to .tsx\n\n/**\n * Create the state required to render GhostText.\n *\n * The returned state can be modified with hooks such as useGhostTextStyles_unstable,\n * before being passed to renderGhostText_unstable.\n *\n * @param props - props from this instance of GhostText\n * @param ref - reference to root HTMLElement of GhostText\n */\nexport const useGhostText_unstable = (props: GhostTextProps, ref: React.Ref<HTMLSpanElement>): GhostTextState => {\n const { nodeKey, onClick, ...rest } = props;\n const [editor] = useLexicalComposerContext();\n\n const handleClick = React.useCallback(\n _ev => {\n if (!nodeKey) {\n return;\n }\n\n editor.update(\n () => {\n const node = $getNodeByKey(nodeKey);\n node?.getPreviousSibling()?.selectEnd();\n },\n { tag: 'historic' },\n );\n },\n [editor, nodeKey],\n );\n\n const mergedOnClick = mergeCallbacks(handleClick, onClick);\n\n const state: GhostTextState = {\n components: {\n root: 'span',\n indicator: 'span',\n },\n root: slot.always(\n getIntrinsicElementProps('span', {\n ref,\n onClick: mergedOnClick,\n ...rest,\n }),\n { elementType: 'span' },\n ),\n indicator: slot.optional(props.indicator, { elementType: 'span' }),\n };\n\n return state;\n};\n"],"names":["nodeKey","rest","
|
|
1
|
+
{"version":3,"sources":["useGhostText.ts"],"sourcesContent":["import * as React from 'react';\nimport { getIntrinsicElementProps, mergeCallbacks, slot } from '@fluentui/react-components';\nimport type { GhostTextProps, GhostTextState } from './GhostText.types';\nimport { $getNodeByKey, useLexicalComposerContext } from '@fluentui-copilot/react-text-editor';\n\n// If you add JSX to this file, be sure to change the file type to .tsx\n\n/**\n * Create the state required to render GhostText.\n *\n * The returned state can be modified with hooks such as useGhostTextStyles_unstable,\n * before being passed to renderGhostText_unstable.\n *\n * @param props - props from this instance of GhostText\n * @param ref - reference to root HTMLElement of GhostText\n */\nexport const useGhostText_unstable = (props: GhostTextProps, ref: React.Ref<HTMLSpanElement>): GhostTextState => {\n const { nodeKey, onClick, ...rest } = props;\n const [editor] = useLexicalComposerContext();\n\n const handleClick = React.useCallback(\n _ev => {\n if (!nodeKey) {\n return;\n }\n\n editor.update(\n () => {\n const node = $getNodeByKey(nodeKey);\n node?.getPreviousSibling()?.selectEnd();\n },\n { tag: 'historic' },\n );\n },\n [editor, nodeKey],\n );\n\n const mergedOnClick = mergeCallbacks(handleClick, onClick);\n\n const state: GhostTextState = {\n components: {\n root: 'span',\n indicator: 'span',\n },\n root: slot.always(\n getIntrinsicElementProps('span', {\n ref,\n onClick: mergedOnClick,\n ...rest,\n }),\n { elementType: 'span' },\n ),\n indicator: slot.optional(props.indicator, { elementType: 'span' }),\n };\n\n return state;\n};\n"],"names":["useGhostText_unstable","props","ref","nodeKey","onClick","rest","editor","useLexicalComposerContext","handleClick","React","useCallback","_ev","update","node","$getNodeByKey","getPreviousSibling","selectEnd","tag","mergedOnClick","mergeCallbacks","state","components","root","indicator","slot","always","getIntrinsicElementProps","elementType","optional"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAgBaA;;;eAAAA;;;;iEAhBU;iCACwC;iCAEN;AAalD,MAAMA,wBAAwB,CAACC,OAAuBC;IAC3D,MAAM,EAAEC,OAAO,EAAEC,OAAO,EAAE,GAAGC,MAAM,GAAGJ;IACtC,MAAM,CAACK,OAAO,GAAGC,IAAAA,0CAAAA;IAEjB,MAAMC,cAAcC,OAAMC,WAAW,CACnCC,CAAAA;QACE,IAAI,CAACR,SAAS;YACZ;QACF;QAEAG,OAAOM,MAAM,CACX;gBAEEC;YADA,MAAMA,OAAOC,IAAAA,8BAAAA,EAAcX;YAC3BU,SAAAA,QAAAA,SAAAA,KAAAA,IAAAA,KAAAA,IAAAA,CAAAA,2BAAAA,KAAME,kBAAkB,EAAA,MAAA,QAAxBF,6BAAAA,KAAAA,IAAAA,KAAAA,IAAAA,yBAA4BG,SAAS;QACvC,GACA;YAAEC,KAAK;QAAW;IAEtB,GACA;QAACX;QAAQH;KAAQ;IAGnB,MAAMe,gBAAgBC,IAAAA,+BAAAA,EAAeX,aAAaJ;IAElD,MAAMgB,QAAwB;QAC5BC,YAAY;YACVC,MAAM;YACNC,WAAW;QACb;QACAD,MAAME,qBAAAA,CAAKC,MAAM,CACfC,IAAAA,yCAAAA,EAAyB,QAAQ;YAC/BxB;YACAE,SAASc;YACT,GAAGb,IAAI;QACT,IACA;YAAEsB,aAAa;QAAO;QAExBJ,WAAWC,qBAAAA,CAAKI,QAAQ,CAAC3B,MAAMsB,SAAS,EAAE;YAAEI,aAAa;QAAO;IAClE;IAEA,OAAOP;AACT"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: all[name]
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
ghostTextClassNames: function() {
|
|
13
|
+
return ghostTextClassNames;
|
|
14
|
+
},
|
|
15
|
+
useGhostTextStyles_unstable: function() {
|
|
16
|
+
return useGhostTextStyles_unstable;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
const _reactcomponents = require("@fluentui/react-components");
|
|
20
|
+
const _tokens = require("@fluentui-copilot/tokens");
|
|
21
|
+
const ghostTextClassNames = {
|
|
22
|
+
root: 'fai-GhostText',
|
|
23
|
+
indicator: 'fai-GhostText__indicator'
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Styles for the root slot
|
|
27
|
+
*/ const useStyles = (0, _reactcomponents.makeStyles)({
|
|
28
|
+
root: {
|
|
29
|
+
color: _tokens.tokens.colorNeutralForeground4,
|
|
30
|
+
whiteSpace: 'pre-wrap',
|
|
31
|
+
gap: _tokens.tokens.spacingHorizontalXS
|
|
32
|
+
},
|
|
33
|
+
indicator: {
|
|
34
|
+
..._tokens.typographyStyles.caption2Strong,
|
|
35
|
+
color: _tokens.tokens.colorNeutralForeground3,
|
|
36
|
+
backgroundColor: _tokens.tokens.colorNeutralBackground5,
|
|
37
|
+
padding: `${_tokens.tokens.spacingVerticalNone} ${_tokens.tokens.spacingHorizontalSNudge}`,
|
|
38
|
+
borderRadius: _tokens.tokens.borderRadiusSmall,
|
|
39
|
+
marginLeft: _tokens.tokens.spacingHorizontalXS,
|
|
40
|
+
merginRight: _tokens.tokens.spacingHorizontalXS
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
const useGhostTextStyles_unstable = (state)=>{
|
|
44
|
+
'use no memo';
|
|
45
|
+
const styles = useStyles();
|
|
46
|
+
state.root.className = (0, _reactcomponents.mergeClasses)(ghostTextClassNames.root, styles.root, state.root.className);
|
|
47
|
+
if (state.indicator) {
|
|
48
|
+
state.indicator.className = (0, _reactcomponents.mergeClasses)(ghostTextClassNames.indicator, styles.indicator, state.indicator.className);
|
|
49
|
+
}
|
|
50
|
+
return state;
|
|
51
|
+
};
|
|
@@ -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":["ghostTextClassNames","useGhostTextStyles_unstable","root","indicator","useStyles","makeStyles","color","tokens","colorNeutralForeground4","whiteSpace","gap","spacingHorizontalXS","typographyStyles","caption2Strong","colorNeutralForeground3","backgroundColor","colorNeutralBackground5","padding","spacingVerticalNone","spacingHorizontalSNudge","borderRadius","borderRadiusSmall","marginLeft","merginRight","state","styles","className","mergeClasses"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAKaA,mBAAAA;eAAAA;;IA6BAC,2BAAAA;eAAAA;;;iCAlC4B;wBACA;AAIlC,MAAMD,sBAAsD;IACjEE,MAAM;IACNC,WAAW;AACb;AAEA;;CAEC,GACD,MAAMC,YAAYC,IAAAA,2BAAAA,EAAW;IAC3BH,MAAM;QACJI,OAAOC,cAAAA,CAAOC,uBAAuB;QACrCC,YAAY;QACZC,KAAKH,cAAAA,CAAOI,mBAAmB;IACjC;IAEAR,WAAW;QACT,GAAGS,wBAAAA,CAAiBC,cAAc;QAClCP,OAAOC,cAAAA,CAAOO,uBAAuB;QACrCC,iBAAiBR,cAAAA,CAAOS,uBAAuB;QAC/CC,SAAS,CAAC,EAAEV,cAAAA,CAAOW,mBAAmB,CAAC,CAAC,EAAEX,cAAAA,CAAOY,uBAAuB,CAAC,CAAC;QAC1EC,cAAcb,cAAAA,CAAOc,iBAAiB;QACtCC,YAAYf,cAAAA,CAAOI,mBAAmB;QACtCY,aAAahB,cAAAA,CAAOI,mBAAmB;IACzC;AACF;AAKO,MAAMV,8BAA8B,CAACuB;IAC1C;IAEA,MAAMC,SAASrB;IACfoB,MAAMtB,IAAI,CAACwB,SAAS,GAAGC,IAAAA,6BAAAA,EAAa3B,oBAAoBE,IAAI,EAAEuB,OAAOvB,IAAI,EAAEsB,MAAMtB,IAAI,CAACwB,SAAS;IAE/F,IAAIF,MAAMrB,SAAS,EAAE;QACnBqB,MAAMrB,SAAS,CAACuB,SAAS,GAAGC,IAAAA,6BAAAA,EAC1B3B,oBAAoBG,SAAS,EAC7BsB,OAAOtB,SAAS,EAChBqB,MAAMrB,SAAS,CAACuB,SAAS;IAE7B;IAEA,OAAOF;AACT"}
|
package/lib-commonjs/index.js
CHANGED
|
@@ -106,4 +106,3 @@ const _ChatInputToken = require("./ChatInputToken");
|
|
|
106
106
|
const _BasicFunctionality = require("./BasicFunctionality");
|
|
107
107
|
const _ImperativeControl = require("./ImperativeControl");
|
|
108
108
|
const _PasteUnfurling = require("./PasteUnfurling");
|
|
109
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +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":["BasicFunctionalityPlugin","React","forwardRef","props","ref","trimWhitespace","onCountChanged","
|
|
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":["BasicFunctionalityPlugin","React","forwardRef","props","ref","trimWhitespace","onCountChanged","onContentChange","onPaste","isSentinelNodeEnabled","editor","useLexicalComposerContext","basicFunctionalityImpl","setBasicFunctionalityImpl","useState","useIsomorphicLayoutEffect","BasicFunctionalityBase","prev","cleanup","useImperativeHandle","setIsDisabled","isDisabled","useEffect","activateContentCallbacks","deactivateContentCallbacks","activatePasteCallback","deactivatePasteCallback","activateTrimWhitespace","deactivateTrimWhitespace"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAmBaA;;;eAAAA;;;;iEAnBU;iCACmB;iCACA;kCAEH;AAehC,MAAMA,yCAA2BC,OAAMC,UAAU,CACtD,CAACC,OAAOC;IACN,MAAM,EAAEC,cAAc,EAAEC,cAAc,EAAEC,eAAe,EAAEC,OAAO,EAAEC,qBAAqB,EAAE,GAAGN;IAE5F,MAAM,CAACO,OAAO,GAAGC,IAAAA,0CAAAA;IAEjB,MAAM,CAACC,wBAAwBC,0BAA0B,GAAGZ,OAAMa,QAAQ,CAAiC;IAE3GC,IAAAA,0CAAAA,EAA0B;QACxBF,0BAA0B,IAAIG,wCAAAA,CAAuBN,QAAQD;QAE7D,OAAO;YACLI,0BAA0BI,CAAAA;gBACxBA,SAAAA,QAAAA,SAAAA,KAAAA,IAAAA,KAAAA,IAAAA,KAAMC,OAAO;gBACb,OAAO;YACT;QACF;IACF,GAAG;QAACR;QAAQD;KAAsB;IAElCR,OAAMkB,mBAAmB,CACvBf,KACA,IAAO,CAAA;YACLgB,eAAcC,UAAmB;gBAC/BT,2BAAAA,QAAAA,2BAAAA,KAAAA,IAAAA,KAAAA,IAAAA,uBAAwBQ,aAAa,CAACC;YACxC;QACF,CAAA,GACA;QAACT;KAAuB;IAG1BX,OAAMqB,SAAS,CAAC;QACdV,2BAAAA,QAAAA,2BAAAA,KAAAA,IAAAA,KAAAA,IAAAA,uBAAwBW,wBAAwB,CAAChB,iBAAiBD;QAClE,OAAO,IAAMM,2BAAAA,QAAAA,2BAAAA,KAAAA,IAAAA,KAAAA,IAAAA,uBAAwBY,0BAA0B;IACjE,GAAG;QAACZ;QAAwBF;QAAQH;QAAiBD;KAAe;IAEpEL,OAAMqB,SAAS,CAAC;QACd,IAAId,SAAS;YACXI,2BAAAA,QAAAA,2BAAAA,KAAAA,IAAAA,KAAAA,IAAAA,uBAAwBa,qBAAqB,CAACjB;QAChD;QACA,OAAO,IAAMI,2BAAAA,QAAAA,2BAAAA,KAAAA,IAAAA,KAAAA,IAAAA,uBAAwBc,uBAAuB;IAC9D,GAAG;QAACd;QAAwBF;QAAQF;KAAQ;IAE5CP,OAAMqB,SAAS,CAAC;QACd,IAAIjB,gBAAgB;YAClBO,2BAAAA,QAAAA,2BAAAA,KAAAA,IAAAA,KAAAA,IAAAA,uBAAwBe,sBAAsB;QAChD;QACA,OAAO,IAAMf,2BAAAA,QAAAA,2BAAAA,KAAAA,IAAAA,KAAAA,IAAAA,uBAAwBgB,wBAAwB;IAC/D,GAAG;QAAChB;QAAwBF;QAAQL;KAAe;IAEnD,OAAO;AACT"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["ChatInputEntity.node.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { DecoratorNode } from '@fluentui-copilot/text-editor';\nimport type {\n EditorConfig,\n LexicalEditor,\n LexicalNode,\n NodeKey,\n SerializedLexicalNode,\n Spread,\n} from '@fluentui-copilot/text-editor';\nimport type { ChatInputEntityProps } from '../../ChatInputEntity';\nimport { ChatInputEntity } from '../../ChatInputEntity';\nimport type { ChatInputEntityData } from '@fluentui-copilot/chat-input-plugins';\n\nexport type SerializedChatInputEntityNode<T> = Spread<\n { pluginId: string; text: string; data?: T; entityProps?: ChatInputEntityProps },\n SerializedLexicalNode\n>;\n\nexport class ChatInputEntityNode<T> extends DecoratorNode<JSX.Element | null> {\n __pluginId: string;\n __text: string;\n __entityProps?: ChatInputEntityProps;\n __data?: T;\n\n static getType(): string {\n return 'entity';\n }\n static clone<T>(node: ChatInputEntityNode<T>): ChatInputEntityNode<T> {\n return new ChatInputEntityNode(node.__pluginId, node.__text, node.__data, node.__entityProps, node.__key);\n }\n\n static importJSON<T>(serializedNode: SerializedChatInputEntityNode<T>): ChatInputEntityNode<T> {\n return $createChatInputEntityNode(\n serializedNode.pluginId,\n serializedNode.text,\n serializedNode.data,\n serializedNode.entityProps,\n );\n }\n\n isIsolated() {\n return true;\n }\n isInline() {\n return true;\n }\n\n getTextContent(): string {\n return this.__text;\n }\n\n exportJSON(): SerializedChatInputEntityNode<T> {\n return {\n pluginId: this.__pluginId,\n text: this.__text,\n data: this.__data,\n entityProps: this.__entityProps,\n type: ChatInputEntityNode.getType(),\n version: 1,\n };\n }\n\n constructor(pluginId: string, text: string, data?: T, entityProps?: ChatInputEntityProps, key?: NodeKey) {\n super(key);\n this.__pluginId = pluginId;\n this.__text = text;\n this.__data = data;\n this.__entityProps = entityProps;\n }\n\n createDOM(): HTMLElement {\n // eslint-disable-next-line no-restricted-globals\n return document.createElement('span');\n }\n\n updateDOM() {\n return false;\n }\n\n decorate(_editor: LexicalEditor, config: EditorConfig): JSX.Element | null {\n if (this.__entityProps?.children) {\n return <ChatInputEntity {...this.__entityProps} />;\n }\n return <ChatInputEntity {...this.__entityProps}>{this.__text}</ChatInputEntity>;\n }\n\n getEntityData(): ChatInputEntityData<T, ChatInputEntityProps> {\n return {\n text: this.__text,\n data: this.__data,\n entityProps: this.__entityProps,\n };\n }\n\n updateEntityData(data: ChatInputEntityData<T, ChatInputEntityProps>) {\n const writable = this.getWritable();\n writable.__text = data.text;\n writable.__data = data.data;\n writable.__entityProps = data.entityProps;\n }\n}\n\nexport function $createChatInputEntityNode<T>(\n pluginId: string,\n text: string,\n data?: T,\n entityProps?: ChatInputEntityProps,\n key?: NodeKey,\n): ChatInputEntityNode<T> {\n return new ChatInputEntityNode(pluginId, text, data, entityProps, key);\n}\n\nexport function $isChatInputEntityNode<T>(node: LexicalNode | null | undefined): node is ChatInputEntityNode<T> {\n return node instanceof ChatInputEntityNode;\n}\n"],"names":["$createChatInputEntityNode","$isChatInputEntityNode","ChatInputEntityNode","DecoratorNode","getType","clone","node","__pluginId","__text","__data","__entityProps","__key","importJSON","serializedNode","pluginId","text","data","entityProps","isIsolated","isInline","getTextContent","exportJSON","type","version","createDOM","document","createElement","updateDOM","decorate","_editor","config","_this___entityProps","children","React","ChatInputEntity","getEntityData","updateEntityData","writable","getWritable","constructor","key"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAwGgBA,0BAAAA;eAAAA;;IAUAC,sBAAAA;eAAAA;;IA9FHC,mBAAAA;eAAAA;;;;;iEApBU;4BAEO;iCAUE;AAQzB,MAAMA,4BAA+BC,yBAAAA;
|
|
1
|
+
{"version":3,"sources":["ChatInputEntity.node.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { DecoratorNode } from '@fluentui-copilot/text-editor';\nimport type {\n EditorConfig,\n LexicalEditor,\n LexicalNode,\n NodeKey,\n SerializedLexicalNode,\n Spread,\n} from '@fluentui-copilot/text-editor';\nimport type { ChatInputEntityProps } from '../../ChatInputEntity';\nimport { ChatInputEntity } from '../../ChatInputEntity';\nimport type { ChatInputEntityData } from '@fluentui-copilot/chat-input-plugins';\n\nexport type SerializedChatInputEntityNode<T> = Spread<\n { pluginId: string; text: string; data?: T; entityProps?: ChatInputEntityProps },\n SerializedLexicalNode\n>;\n\nexport class ChatInputEntityNode<T> extends DecoratorNode<JSX.Element | null> {\n __pluginId: string;\n __text: string;\n __entityProps?: ChatInputEntityProps;\n __data?: T;\n\n static getType(): string {\n return 'entity';\n }\n static clone<T>(node: ChatInputEntityNode<T>): ChatInputEntityNode<T> {\n return new ChatInputEntityNode(node.__pluginId, node.__text, node.__data, node.__entityProps, node.__key);\n }\n\n static importJSON<T>(serializedNode: SerializedChatInputEntityNode<T>): ChatInputEntityNode<T> {\n return $createChatInputEntityNode(\n serializedNode.pluginId,\n serializedNode.text,\n serializedNode.data,\n serializedNode.entityProps,\n );\n }\n\n isIsolated() {\n return true;\n }\n isInline() {\n return true;\n }\n\n getTextContent(): string {\n return this.__text;\n }\n\n exportJSON(): SerializedChatInputEntityNode<T> {\n return {\n pluginId: this.__pluginId,\n text: this.__text,\n data: this.__data,\n entityProps: this.__entityProps,\n type: ChatInputEntityNode.getType(),\n version: 1,\n };\n }\n\n constructor(pluginId: string, text: string, data?: T, entityProps?: ChatInputEntityProps, key?: NodeKey) {\n super(key);\n this.__pluginId = pluginId;\n this.__text = text;\n this.__data = data;\n this.__entityProps = entityProps;\n }\n\n createDOM(): HTMLElement {\n // eslint-disable-next-line no-restricted-globals\n return document.createElement('span');\n }\n\n updateDOM() {\n return false;\n }\n\n decorate(_editor: LexicalEditor, config: EditorConfig): JSX.Element | null {\n if (this.__entityProps?.children) {\n return <ChatInputEntity {...this.__entityProps} />;\n }\n return <ChatInputEntity {...this.__entityProps}>{this.__text}</ChatInputEntity>;\n }\n\n getEntityData(): ChatInputEntityData<T, ChatInputEntityProps> {\n return {\n text: this.__text,\n data: this.__data,\n entityProps: this.__entityProps,\n };\n }\n\n updateEntityData(data: ChatInputEntityData<T, ChatInputEntityProps>) {\n const writable = this.getWritable();\n writable.__text = data.text;\n writable.__data = data.data;\n writable.__entityProps = data.entityProps;\n }\n}\n\nexport function $createChatInputEntityNode<T>(\n pluginId: string,\n text: string,\n data?: T,\n entityProps?: ChatInputEntityProps,\n key?: NodeKey,\n): ChatInputEntityNode<T> {\n return new ChatInputEntityNode(pluginId, text, data, entityProps, key);\n}\n\nexport function $isChatInputEntityNode<T>(node: LexicalNode | null | undefined): node is ChatInputEntityNode<T> {\n return node instanceof ChatInputEntityNode;\n}\n"],"names":["$createChatInputEntityNode","$isChatInputEntityNode","ChatInputEntityNode","DecoratorNode","getType","clone","node","__pluginId","__text","__data","__entityProps","__key","importJSON","serializedNode","pluginId","text","data","entityProps","isIsolated","isInline","getTextContent","exportJSON","type","version","createDOM","document","createElement","updateDOM","decorate","_editor","config","_this___entityProps","children","React","ChatInputEntity","getEntityData","updateEntityData","writable","getWritable","constructor","key"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAwGgBA,0BAAAA;eAAAA;;IAUAC,sBAAAA;eAAAA;;IA9FHC,mBAAAA;eAAAA;;;;;iEApBU;4BAEO;iCAUE;AAQzB,MAAMA,4BAA+BC,yBAAAA;IAM1C,OAAOC,UAAkB;QACvB,OAAO;IACT;IACA,OAAOC,MAASC,IAA4B,EAA0B;QACpE,OAAO,IAAIJ,oBAAoBI,KAAKC,UAAU,EAAED,KAAKE,MAAM,EAAEF,KAAKG,MAAM,EAAEH,KAAKI,aAAa,EAAEJ,KAAKK,KAAK;IAC1G;IAEA,OAAOC,WAAcC,cAAgD,EAA0B;QAC7F,OAAOb,2BACLa,eAAeC,QAAQ,EACvBD,eAAeE,IAAI,EACnBF,eAAeG,IAAI,EACnBH,eAAeI,WAAW;IAE9B;IAEAC,aAAa;QACX,OAAO;IACT;IACAC,WAAW;QACT,OAAO;IACT;IAEAC,iBAAyB;QACvB,OAAO,IAAI,CAACZ,MAAM;IACpB;IAEAa,aAA+C;QAC7C,OAAO;YACLP,UAAU,IAAI,CAACP,UAAU;YACzBQ,MAAM,IAAI,CAACP,MAAM;YACjBQ,MAAM,IAAI,CAACP,MAAM;YACjBQ,aAAa,IAAI,CAACP,aAAa;YAC/BY,MAAMpB,oBAAoBE,OAAO;YACjCmB,SAAS;QACX;IACF;IAUAC,YAAyB;QACvB,iDAAiD;QACjD,OAAOC,SAASC,aAAa,CAAC;IAChC;IAEAC,YAAY;QACV,OAAO;IACT;IAEAC,SAASC,OAAsB,EAAEC,MAAoB,EAAsB;YACrEC;QAAJ,IAAA,AAAIA,CAAAA,sBAAA,IAAI,CAACrB,aAAa,AAAbA,MAAa,QAAlBqB,wBAAA,KAAA,IAAA,KAAA,IAAAA,oBAAoBC,QAAQ,EAAE;YAChC,OAAA,WAAA,GAAOC,OAAAP,aAAA,CAACQ,gCAAAA,EAAoB,IAAI,CAACxB,aAAa;QAChD;QACA,OAAA,WAAA,GAAOuB,OAAAP,aAAA,CAACQ,gCAAAA,EAAoB,IAAI,CAACxB,aAAa,EAAG,IAAI,CAACF,MAAM;IAC9D;IAEA2B,gBAA8D;QAC5D,OAAO;YACLpB,MAAM,IAAI,CAACP,MAAM;YACjBQ,MAAM,IAAI,CAACP,MAAM;YACjBQ,aAAa,IAAI,CAACP,aAAa;QACjC;IACF;IAEA0B,iBAAiBpB,IAAkD,EAAE;QACnE,MAAMqB,WAAW,IAAI,CAACC,WAAW;QACjCD,SAAS7B,MAAM,GAAGQ,KAAKD,IAAI;QAC3BsB,SAAS5B,MAAM,GAAGO,KAAKA,IAAI;QAC3BqB,SAAS3B,aAAa,GAAGM,KAAKC,WAAW;IAC3C;IArCAsB,YAAYzB,QAAgB,EAAEC,IAAY,EAAEC,IAAQ,EAAEC,WAAkC,EAAEuB,GAAa,CAAE;QACvG,KAAK,CAACA;QA5CRjC,IAAAA,kBAAAA,EAAAA,IAAAA,EAAAA,cAAAA,KAAAA;QACAC,IAAAA,kBAAAA,EAAAA,IAAAA,EAAAA,UAAAA,KAAAA;QACAE,IAAAA,kBAAAA,EAAAA,IAAAA,EAAAA,iBAAAA,KAAAA;QACAD,IAAAA,kBAAAA,EAAAA,IAAAA,EAAAA,UAAAA,KAAAA;QA0CE,IAAI,CAACF,UAAU,GAAGO;QAClB,IAAI,CAACN,MAAM,GAAGO;QACd,IAAI,CAACN,MAAM,GAAGO;QACd,IAAI,CAACN,aAAa,GAAGO;IACvB;AAgCF;AAEO,SAASjB,2BACdc,QAAgB,EAChBC,IAAY,EACZC,IAAQ,EACRC,WAAkC,EAClCuB,GAAa;IAEb,OAAO,IAAItC,oBAAoBY,UAAUC,MAAMC,MAAMC,aAAauB;AACpE;AAEO,SAASvC,uBAA0BK,IAAoC;IAC5E,OAAOA,gBAAgBJ;AACzB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["ChatInputEntityPlugin.tsx"],"sourcesContent":["import { useLexicalComposerContext } from '@fluentui-copilot/react-text-editor';\nimport * as React from 'react';\nimport { $createChatInputEntityNode, $isChatInputEntityNode, ChatInputEntityNode } from './ChatInputEntity.node';\nimport type { ChatInputEntityPluginRef } from './ChatInputEntityPlugin.types';\nimport type { ChatInputEntityPluginProps } from '@fluentui-copilot/chat-input-plugins';\nimport { ChatInputEntityPluginBase } from '@fluentui-copilot/chat-input-plugins';\nimport type { ChatInputEntityProps } from '../../ChatInputEntity';\n\nexport const ChatInputEntityPlugin = <ExtraDataType,>(\n props: ChatInputEntityPluginProps<ExtraDataType, ChatInputEntityProps> & {\n controlRef: React.Ref<ChatInputEntityPluginRef<ExtraDataType>>;\n },\n) => {\n const { id, controlRef, onChatInputEntityAdded, onChatInputEntityDeleted, skipInitialization } = props;\n const [editor] = useLexicalComposerContext();\n\n const chatInputEntityPluginBase = React.useRef<ChatInputEntityPluginBase<\n ExtraDataType,\n ChatInputEntityProps,\n ChatInputEntityNode<ExtraDataType>\n > | null>(null);\n\n React.useEffect(() => {\n chatInputEntityPluginBase.current = new ChatInputEntityPluginBase<\n ExtraDataType,\n ChatInputEntityProps,\n ChatInputEntityNode<ExtraDataType>\n >(\n editor,\n id,\n ChatInputEntityNode,\n $createChatInputEntityNode,\n $isChatInputEntityNode,\n onChatInputEntityAdded,\n onChatInputEntityDeleted,\n );\n\n return () => chatInputEntityPluginBase.current?.cleanup();\n }, [editor, id, onChatInputEntityAdded, onChatInputEntityDeleted, skipInitialization]);\n\n React.useImperativeHandle(\n controlRef,\n () => ({\n insertChatInputEntity(props) {\n return chatInputEntityPluginBase.current?.insertChatInputEntity(props);\n },\n\n getActiveEntities() {\n return chatInputEntityPluginBase.current?.getActiveEntities() ?? [];\n },\n\n removeChatInputEntity(keyOrPredicate) {\n chatInputEntityPluginBase.current?.removeChatInputEntity(keyOrPredicate);\n },\n\n updateChatInputEntityProps(keyOrPredicate, props) {\n chatInputEntityPluginBase.current?.updateChatInputEntityProps(keyOrPredicate, props);\n },\n }),\n [],\n );\n return null;\n};\n"],"names":["ChatInputEntityPlugin","props","id","controlRef","
|
|
1
|
+
{"version":3,"sources":["ChatInputEntityPlugin.tsx"],"sourcesContent":["import { useLexicalComposerContext } from '@fluentui-copilot/react-text-editor';\nimport * as React from 'react';\nimport { $createChatInputEntityNode, $isChatInputEntityNode, ChatInputEntityNode } from './ChatInputEntity.node';\nimport type { ChatInputEntityPluginRef } from './ChatInputEntityPlugin.types';\nimport type { ChatInputEntityPluginProps } from '@fluentui-copilot/chat-input-plugins';\nimport { ChatInputEntityPluginBase } from '@fluentui-copilot/chat-input-plugins';\nimport type { ChatInputEntityProps } from '../../ChatInputEntity';\n\nexport const ChatInputEntityPlugin = <ExtraDataType,>(\n props: ChatInputEntityPluginProps<ExtraDataType, ChatInputEntityProps> & {\n controlRef: React.Ref<ChatInputEntityPluginRef<ExtraDataType>>;\n },\n) => {\n const { id, controlRef, onChatInputEntityAdded, onChatInputEntityDeleted, skipInitialization } = props;\n const [editor] = useLexicalComposerContext();\n\n const chatInputEntityPluginBase = React.useRef<ChatInputEntityPluginBase<\n ExtraDataType,\n ChatInputEntityProps,\n ChatInputEntityNode<ExtraDataType>\n > | null>(null);\n\n React.useEffect(() => {\n chatInputEntityPluginBase.current = new ChatInputEntityPluginBase<\n ExtraDataType,\n ChatInputEntityProps,\n ChatInputEntityNode<ExtraDataType>\n >(\n editor,\n id,\n ChatInputEntityNode,\n $createChatInputEntityNode,\n $isChatInputEntityNode,\n onChatInputEntityAdded,\n onChatInputEntityDeleted,\n );\n\n return () => chatInputEntityPluginBase.current?.cleanup();\n }, [editor, id, onChatInputEntityAdded, onChatInputEntityDeleted, skipInitialization]);\n\n React.useImperativeHandle(\n controlRef,\n () => ({\n insertChatInputEntity(props) {\n return chatInputEntityPluginBase.current?.insertChatInputEntity(props);\n },\n\n getActiveEntities() {\n return chatInputEntityPluginBase.current?.getActiveEntities() ?? [];\n },\n\n removeChatInputEntity(keyOrPredicate) {\n chatInputEntityPluginBase.current?.removeChatInputEntity(keyOrPredicate);\n },\n\n updateChatInputEntityProps(keyOrPredicate, props) {\n chatInputEntityPluginBase.current?.updateChatInputEntityProps(keyOrPredicate, props);\n },\n }),\n [],\n );\n return null;\n};\n"],"names":["ChatInputEntityPlugin","props","id","controlRef","onChatInputEntityAdded","onChatInputEntityDeleted","skipInitialization","editor","useLexicalComposerContext","chatInputEntityPluginBase","React","useRef","useEffect","current","ChatInputEntityPluginBase","ChatInputEntityNode","$createChatInputEntityNode","$isChatInputEntityNode","cleanup","useImperativeHandle","insertChatInputEntity","getActiveEntities","removeChatInputEntity","keyOrPredicate","updateChatInputEntityProps"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAQaA;;;eAAAA;;;;iCAR6B;iEACnB;qCACiE;kCAG9C;AAGnC,MAAMA,wBAAwB,CACnCC;IAIA,MAAM,EAAEC,EAAE,EAAEC,UAAU,EAAEC,sBAAsB,EAAEC,wBAAwB,EAAEC,kBAAkB,EAAE,GAAGL;IACjG,MAAM,CAACM,OAAO,GAAGC,IAAAA,0CAAAA;IAEjB,MAAMC,4BAA4BC,OAAMC,MAAM,CAIpC;IAEVD,OAAME,SAAS,CAAC;QACdH,0BAA0BI,OAAO,GAAG,IAAIC,2CAAAA,CAKtCP,QACAL,IACAa,wCAAAA,EACAC,+CAAAA,EACAC,2CAAAA,EACAb,wBACAC;QAGF,OAAO;gBAAMI;mBAAAA,CAAAA,qCAAAA,0BAA0BI,OAAO,AAAPA,MAAO,QAAjCJ,uCAAAA,KAAAA,IAAAA,KAAAA,IAAAA,mCAAmCS,OAAO;;IACzD,GAAG;QAACX;QAAQL;QAAIE;QAAwBC;QAA0BC;KAAmB;IAErFI,OAAMS,mBAAmB,CACvBhB,YACA,IAAO,CAAA;YACLiB,uBAAsBnB,KAAK;oBAClBQ;gBAAP,OAAA,AAAOA,CAAAA,qCAAAA,0BAA0BI,OAAO,AAAPA,MAAO,QAAjCJ,uCAAAA,KAAAA,IAAAA,KAAAA,IAAAA,mCAAmCW,qBAAqB,CAACnB;YAClE;YAEAoB;oBACSZ;oBAAAA;gBAAP,OAAOA,CAAAA,uDAAAA,CAAAA,qCAAAA,0BAA0BI,OAAO,AAAPA,MAAO,QAAjCJ,uCAAAA,KAAAA,IAAAA,KAAAA,IAAAA,mCAAmCY,iBAAiB,EAAA,MAAA,QAApDZ,yDAAAA,KAAAA,IAAAA,uDAA0D,EAAE;YACrE;YAEAa,uBAAsBC,cAAc;oBAClCd;gBAAAA,CAAAA,qCAAAA,0BAA0BI,OAAO,AAAPA,MAAO,QAAjCJ,uCAAAA,KAAAA,IAAAA,KAAAA,IAAAA,mCAAmCa,qBAAqB,CAACC;YAC3D;YAEAC,4BAA2BD,cAAc,EAAEtB,KAAK;oBAC9CQ;gBAAAA,CAAAA,qCAAAA,0BAA0BI,OAAO,AAAPA,MAAO,QAAjCJ,uCAAAA,KAAAA,IAAAA,KAAAA,IAAAA,mCAAmCe,0BAA0B,CAACD,gBAAgBtB;YAChF;QACF,CAAA,GACA,EAAE;IAEJ,OAAO;AACT"}
|
|
@@ -27,8 +27,7 @@ function GhostTextPlugin(props) {
|
|
|
27
27
|
return null;
|
|
28
28
|
});
|
|
29
29
|
};
|
|
30
|
-
}, //
|
|
31
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
30
|
+
}, // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
32
31
|
[
|
|
33
32
|
editor,
|
|
34
33
|
id
|
|
@@ -58,4 +57,4 @@ function GhostTextPlugin(props) {
|
|
|
58
57
|
ghostTextBase
|
|
59
58
|
]);
|
|
60
59
|
return null;
|
|
61
|
-
}
|
|
60
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["GhostText.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useLexicalComposerContext } from '@fluentui-copilot/react-text-editor';\nimport type { LexicalEditor, EditorState } from '@fluentui-copilot/text-editor';\nimport type { GhostTextProps } from '../../GhostText';\nimport { $createGhostTextNode } from '../../GhostText';\nimport { GhostTextNode } from './GhostText.node';\nimport { GhostTextPluginBase } from '@fluentui-copilot/chat-input-plugins';\n\nexport type GhostTextPluginProps = {\n id: string;\n $getGhostText: (\n editor: LexicalEditor,\n editorState: EditorState,\n prevEditorState: EditorState,\n ) => Promise<string | undefined>;\n ghostTextProps?: GhostTextProps;\n // Whether or not the ghost text should count as text inside the input for submitting and character count\n exposeText?: boolean;\n allowCompletion?: boolean;\n};\n\nexport function GhostTextPlugin(props: GhostTextPluginProps): JSX.Element | null {\n 'use no memo';\n\n const { $getGhostText, id, ghostTextProps, exposeText, allowCompletion } = props;\n const [editor] = useLexicalComposerContext();\n\n const [ghostTextBase, setGhostTextBase] = React.useState<GhostTextPluginBase<GhostTextProps> | null>(null);\n\n React.useEffect(\n () => {\n setGhostTextBase(\n new GhostTextPluginBase(\n editor,\n id,\n $getGhostText,\n GhostTextNode,\n $createGhostTextNode,\n ghostTextProps,\n exposeText,\n allowCompletion,\n ),\n );\n\n return () => {\n setGhostTextBase(prev => {\n prev?.cleanup();\n return null;\n });\n };\n },\n // We can update $getGhostText, $createGhostTextNode, ghostTextProps, exposeText, and allowCompletion without remounting\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [editor, id],\n );\n\n React.useEffect(() => {\n ghostTextBase?.setAllowCompletion(allowCompletion);\n }, [allowCompletion, ghostTextBase]);\n\n React.useEffect(() => {\n ghostTextBase?.setComponentProps(ghostTextProps);\n }, [ghostTextBase, ghostTextProps]);\n\n React.useEffect(() => {\n ghostTextBase?.setExposeText(exposeText);\n }, [exposeText, ghostTextBase]);\n\n React.useEffect(() => {\n ghostTextBase?.setGetGhostText($getGhostText);\n }, [$getGhostText, ghostTextBase]);\n\n return null;\n}\n"],"names":["GhostTextPlugin","props","$getGhostText","
|
|
1
|
+
{"version":3,"sources":["GhostText.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useLexicalComposerContext } from '@fluentui-copilot/react-text-editor';\nimport type { LexicalEditor, EditorState } from '@fluentui-copilot/text-editor';\nimport type { GhostTextProps } from '../../GhostText';\nimport { $createGhostTextNode } from '../../GhostText';\nimport { GhostTextNode } from './GhostText.node';\nimport { GhostTextPluginBase } from '@fluentui-copilot/chat-input-plugins';\n\nexport type GhostTextPluginProps = {\n id: string;\n $getGhostText: (\n editor: LexicalEditor,\n editorState: EditorState,\n prevEditorState: EditorState,\n ) => Promise<string | undefined>;\n ghostTextProps?: GhostTextProps;\n // Whether or not the ghost text should count as text inside the input for submitting and character count\n exposeText?: boolean;\n allowCompletion?: boolean;\n};\n\nexport function GhostTextPlugin(props: GhostTextPluginProps): JSX.Element | null {\n 'use no memo';\n\n const { $getGhostText, id, ghostTextProps, exposeText, allowCompletion } = props;\n const [editor] = useLexicalComposerContext();\n\n const [ghostTextBase, setGhostTextBase] = React.useState<GhostTextPluginBase<GhostTextProps> | null>(null);\n\n React.useEffect(\n () => {\n setGhostTextBase(\n new GhostTextPluginBase(\n editor,\n id,\n $getGhostText,\n GhostTextNode,\n $createGhostTextNode,\n ghostTextProps,\n exposeText,\n allowCompletion,\n ),\n );\n\n return () => {\n setGhostTextBase(prev => {\n prev?.cleanup();\n return null;\n });\n };\n },\n // We can update $getGhostText, $createGhostTextNode, ghostTextProps, exposeText, and allowCompletion without remounting\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [editor, id],\n );\n\n React.useEffect(() => {\n ghostTextBase?.setAllowCompletion(allowCompletion);\n }, [allowCompletion, ghostTextBase]);\n\n React.useEffect(() => {\n ghostTextBase?.setComponentProps(ghostTextProps);\n }, [ghostTextBase, ghostTextProps]);\n\n React.useEffect(() => {\n ghostTextBase?.setExposeText(exposeText);\n }, [exposeText, ghostTextBase]);\n\n React.useEffect(() => {\n ghostTextBase?.setGetGhostText($getGhostText);\n }, [$getGhostText, ghostTextBase]);\n\n return null;\n}\n"],"names":["GhostTextPlugin","props","$getGhostText","id","ghostTextProps","exposeText","allowCompletion","editor","useLexicalComposerContext","ghostTextBase","setGhostTextBase","React","useState","useEffect","GhostTextPluginBase","GhostTextNode","$createGhostTextNode","prev","cleanup","setAllowCompletion","setComponentProps","setExposeText","setGetGhostText"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAqBgBA;;;eAAAA;;;;iEArBO;iCACmB;2BAGL;+BACP;kCACM;AAe7B,SAASA,gBAAgBC,KAA2B;IACzD;IAEA,MAAM,EAAEC,aAAa,EAAEC,EAAE,EAAEC,cAAc,EAAEC,UAAU,EAAEC,eAAe,EAAE,GAAGL;IAC3E,MAAM,CAACM,OAAO,GAAGC,IAAAA,0CAAAA;IAEjB,MAAM,CAACC,eAAeC,iBAAiB,GAAGC,OAAMC,QAAQ,CAA6C;IAErGD,OAAME,SAAS,CACb;QACEH,iBACE,IAAII,qCAAAA,CACFP,QACAJ,IACAD,eACAa,4BAAAA,EACAC,+BAAAA,EACAZ,gBACAC,YACAC;QAIJ,OAAO;YACLI,iBAAiBO,CAAAA;gBACfA,SAAAA,QAAAA,SAAAA,KAAAA,IAAAA,KAAAA,IAAAA,KAAMC,OAAO;gBACb,OAAO;YACT;QACF;IACF,GAEA,uDAAuD;IACvD;QAACX;QAAQJ;KAAG;IAGdQ,OAAME,SAAS,CAAC;QACdJ,kBAAAA,QAAAA,kBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,cAAeU,kBAAkB,CAACb;IACpC,GAAG;QAACA;QAAiBG;KAAc;IAEnCE,OAAME,SAAS,CAAC;QACdJ,kBAAAA,QAAAA,kBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,cAAeW,iBAAiB,CAAChB;IACnC,GAAG;QAACK;QAAeL;KAAe;IAElCO,OAAME,SAAS,CAAC;QACdJ,kBAAAA,QAAAA,kBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,cAAeY,aAAa,CAAChB;IAC/B,GAAG;QAACA;QAAYI;KAAc;IAE9BE,OAAME,SAAS,CAAC;QACdJ,kBAAAA,QAAAA,kBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,cAAea,eAAe,CAACpB;IACjC,GAAG;QAACA;QAAeO;KAAc;IAEjC,OAAO;AACT"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["GhostText.node.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { DecoratorNode } from '@fluentui-copilot/text-editor';\nimport type { EditorConfig, LexicalNode, NodeKey, SerializedLexicalNode, Spread } from '@fluentui-copilot/text-editor';\nimport type { GhostTextProps } from '../../components/GhostText/GhostText.types';\nimport { GhostText } from '../../components/GhostText/GhostText';\n\nexport type SerializedGhostTextNode = Spread<\n {\n content: string;\n id: string;\n componentProps?: GhostTextProps;\n exposeText?: boolean;\n },\n SerializedLexicalNode\n>;\n\nexport class GhostTextNode extends DecoratorNode<JSX.Element | null> {\n __content: string;\n __id: string;\n __allowCommitting?: boolean;\n __componentProps?: GhostTextProps;\n __exposeText?: boolean;\n\n static clone(node: GhostTextNode): GhostTextNode {\n return new GhostTextNode(node.__id, node.__content, node.__exposeText, node.__componentProps, node.__key);\n }\n\n static getType(): 'ghosttext' {\n return 'ghosttext';\n }\n\n static importJSON(serializedNode: SerializedGhostTextNode): GhostTextNode {\n const node = $createGhostTextNode(\n serializedNode.id,\n serializedNode.content,\n serializedNode.exposeText,\n serializedNode.componentProps,\n );\n return node;\n }\n\n exportJSON(): SerializedGhostTextNode {\n return {\n type: 'ghosttext',\n id: this.__id,\n content: this.__content,\n componentProps: this.__componentProps,\n exposeText: this.__exposeText,\n version: 1,\n };\n }\n\n constructor(id: string, content: string, exposeText?: boolean, componentProps?: GhostTextProps, key?: NodeKey) {\n super(key);\n this.__id = id;\n this.__content = content;\n this.__exposeText = exposeText;\n this.__componentProps = componentProps;\n }\n\n isInline() {\n return true;\n }\n\n isIsolated() {\n return true;\n }\n\n getTextContent(): string {\n return this.__exposeText ? this.__content : '';\n }\n\n updateDOM(prevNode: unknown, dom: HTMLElement, config: EditorConfig): boolean {\n return false;\n }\n\n createDOM(config: EditorConfig): HTMLElement {\n // eslint-disable-next-line no-restricted-globals\n return document.createElement('span');\n }\n\n decorate(): JSX.Element | null {\n return (\n <GhostText nodeKey={this.getKey()} {...this.__componentProps}>\n {this.__content}\n </GhostText>\n );\n }\n}\n\nexport function $createGhostTextNode(\n id: string,\n content: string,\n exposeText?: boolean,\n componentProps?: GhostTextProps,\n): GhostTextNode {\n return new GhostTextNode(id, content, exposeText, componentProps);\n}\n\nexport function $isGhostTextNode(node: LexicalNode | null | undefined): node is GhostTextNode {\n return node instanceof GhostTextNode;\n}\n"],"names":["$createGhostTextNode","$isGhostTextNode","GhostTextNode","DecoratorNode","clone","node","__id","__content","__exposeText","__componentProps","__key","getType","importJSON","serializedNode","id","content","exposeText","componentProps","exportJSON","type","version","isInline","isIsolated","getTextContent","updateDOM","prevNode","dom","config","createDOM","document","createElement","decorate","React","GhostText","nodeKey","getKey","constructor","key","__allowCommitting"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IA2FgBA,oBAAAA;eAAAA;;IASAC,gBAAAA;eAAAA;;IAnFHC,aAAAA;eAAAA;;;;;iEAjBU;4BAEO;2BAGJ;AAYnB,MAAMA,sBAAsBC,yBAAAA;
|
|
1
|
+
{"version":3,"sources":["GhostText.node.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { DecoratorNode } from '@fluentui-copilot/text-editor';\nimport type { EditorConfig, LexicalNode, NodeKey, SerializedLexicalNode, Spread } from '@fluentui-copilot/text-editor';\nimport type { GhostTextProps } from '../../components/GhostText/GhostText.types';\nimport { GhostText } from '../../components/GhostText/GhostText';\n\nexport type SerializedGhostTextNode = Spread<\n {\n content: string;\n id: string;\n componentProps?: GhostTextProps;\n exposeText?: boolean;\n },\n SerializedLexicalNode\n>;\n\nexport class GhostTextNode extends DecoratorNode<JSX.Element | null> {\n __content: string;\n __id: string;\n __allowCommitting?: boolean;\n __componentProps?: GhostTextProps;\n __exposeText?: boolean;\n\n static clone(node: GhostTextNode): GhostTextNode {\n return new GhostTextNode(node.__id, node.__content, node.__exposeText, node.__componentProps, node.__key);\n }\n\n static getType(): 'ghosttext' {\n return 'ghosttext';\n }\n\n static importJSON(serializedNode: SerializedGhostTextNode): GhostTextNode {\n const node = $createGhostTextNode(\n serializedNode.id,\n serializedNode.content,\n serializedNode.exposeText,\n serializedNode.componentProps,\n );\n return node;\n }\n\n exportJSON(): SerializedGhostTextNode {\n return {\n type: 'ghosttext',\n id: this.__id,\n content: this.__content,\n componentProps: this.__componentProps,\n exposeText: this.__exposeText,\n version: 1,\n };\n }\n\n constructor(id: string, content: string, exposeText?: boolean, componentProps?: GhostTextProps, key?: NodeKey) {\n super(key);\n this.__id = id;\n this.__content = content;\n this.__exposeText = exposeText;\n this.__componentProps = componentProps;\n }\n\n isInline() {\n return true;\n }\n\n isIsolated() {\n return true;\n }\n\n getTextContent(): string {\n return this.__exposeText ? this.__content : '';\n }\n\n updateDOM(prevNode: unknown, dom: HTMLElement, config: EditorConfig): boolean {\n return false;\n }\n\n createDOM(config: EditorConfig): HTMLElement {\n // eslint-disable-next-line no-restricted-globals\n return document.createElement('span');\n }\n\n decorate(): JSX.Element | null {\n return (\n <GhostText nodeKey={this.getKey()} {...this.__componentProps}>\n {this.__content}\n </GhostText>\n );\n }\n}\n\nexport function $createGhostTextNode(\n id: string,\n content: string,\n exposeText?: boolean,\n componentProps?: GhostTextProps,\n): GhostTextNode {\n return new GhostTextNode(id, content, exposeText, componentProps);\n}\n\nexport function $isGhostTextNode(node: LexicalNode | null | undefined): node is GhostTextNode {\n return node instanceof GhostTextNode;\n}\n"],"names":["$createGhostTextNode","$isGhostTextNode","GhostTextNode","DecoratorNode","clone","node","__id","__content","__exposeText","__componentProps","__key","getType","importJSON","serializedNode","id","content","exposeText","componentProps","exportJSON","type","version","isInline","isIsolated","getTextContent","updateDOM","prevNode","dom","config","createDOM","document","createElement","decorate","React","GhostText","nodeKey","getKey","constructor","key","__allowCommitting"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IA2FgBA,oBAAAA;eAAAA;;IASAC,gBAAAA;eAAAA;;IAnFHC,aAAAA;eAAAA;;;;;iEAjBU;4BAEO;2BAGJ;AAYnB,MAAMA,sBAAsBC,yBAAAA;IAOjC,OAAOC,MAAMC,IAAmB,EAAiB;QAC/C,OAAO,IAAIH,cAAcG,KAAKC,IAAI,EAAED,KAAKE,SAAS,EAAEF,KAAKG,YAAY,EAAEH,KAAKI,gBAAgB,EAAEJ,KAAKK,KAAK;IAC1G;IAEA,OAAOC,UAAuB;QAC5B,OAAO;IACT;IAEA,OAAOC,WAAWC,cAAuC,EAAiB;QACxE,MAAMR,OAAOL,qBACXa,eAAeC,EAAE,EACjBD,eAAeE,OAAO,EACtBF,eAAeG,UAAU,EACzBH,eAAeI,cAAc;QAE/B,OAAOZ;IACT;IAEAa,aAAsC;QACpC,OAAO;YACLC,MAAM;YACNL,IAAI,IAAI,CAACR,IAAI;YACbS,SAAS,IAAI,CAACR,SAAS;YACvBU,gBAAgB,IAAI,CAACR,gBAAgB;YACrCO,YAAY,IAAI,CAACR,YAAY;YAC7BY,SAAS;QACX;IACF;IAUAC,WAAW;QACT,OAAO;IACT;IAEAC,aAAa;QACX,OAAO;IACT;IAEAC,iBAAyB;QACvB,OAAO,IAAI,CAACf,YAAY,GAAG,IAAI,CAACD,SAAS,GAAG;IAC9C;IAEAiB,UAAUC,QAAiB,EAAEC,GAAgB,EAAEC,MAAoB,EAAW;QAC5E,OAAO;IACT;IAEAC,UAAUD,MAAoB,EAAe;QAC3C,iDAAiD;QACjD,OAAOE,SAASC,aAAa,CAAC;IAChC;IAEAC,WAA+B;QAC7B,OAAA,WAAA,GACEC,OAAAF,aAAA,CAACG,oBAAAA,EAAAA;YAAUC,SAAS,IAAI,CAACC,MAAM;YAAK,GAAG,IAAI,CAAC1B,gBAAgB;WACzD,IAAI,CAACF,SAAS;IAGrB;IAnCA6B,YAAYtB,EAAU,EAAEC,OAAe,EAAEC,UAAoB,EAAEC,cAA+B,EAAEoB,GAAa,CAAE;QAC7G,KAAK,CAACA;QApCR9B,IAAAA,kBAAAA,EAAAA,IAAAA,EAAAA,aAAAA,KAAAA;QACAD,IAAAA,kBAAAA,EAAAA,IAAAA,EAAAA,QAAAA,KAAAA;QACAgC,IAAAA,kBAAAA,EAAAA,IAAAA,EAAAA,qBAAAA,KAAAA;QACA7B,IAAAA,kBAAAA,EAAAA,IAAAA,EAAAA,oBAAAA,KAAAA;QACAD,IAAAA,kBAAAA,EAAAA,IAAAA,EAAAA,gBAAAA,KAAAA;QAiCE,IAAI,CAACF,IAAI,GAAGQ;QACZ,IAAI,CAACP,SAAS,GAAGQ;QACjB,IAAI,CAACP,YAAY,GAAGQ;QACpB,IAAI,CAACP,gBAAgB,GAAGQ;IAC1B;AA8BF;AAEO,SAASjB,qBACdc,EAAU,EACVC,OAAe,EACfC,UAAoB,EACpBC,cAA+B;IAE/B,OAAO,IAAIf,cAAcY,IAAIC,SAASC,YAAYC;AACpD;AAEO,SAAShB,iBAAiBI,IAAoC;IACnE,OAAOA,gBAAgBH;AACzB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["ImperativeControl.tsx"],"sourcesContent":["import * as React from 'react';\nimport type { IImperativeControlBase } from '@fluentui-copilot/chat-input-plugins';\nimport { ImperativeControlBase } from '@fluentui-copilot/chat-input-plugins';\nimport { useLexicalComposerContext } from '@fluentui-copilot/react-text-editor';\n\nexport type ImperativeControlPluginRef = IImperativeControlBase;\nexport type ImperativeControlPluginProps = {};\n\nexport const ImperativeControlPlugin = React.forwardRef<ImperativeControlPluginRef, ImperativeControlPluginProps>(\n (_props, ref) => {\n const [editor] = useLexicalComposerContext();\n\n React.useImperativeHandle(ref, () => new ImperativeControlBase(editor), [editor]);\n\n return null;\n },\n);\n"],"names":["ImperativeControlPlugin","React","forwardRef","_props","editor","useLexicalComposerContext","useImperativeHandle","
|
|
1
|
+
{"version":3,"sources":["ImperativeControl.tsx"],"sourcesContent":["import * as React from 'react';\nimport type { IImperativeControlBase } from '@fluentui-copilot/chat-input-plugins';\nimport { ImperativeControlBase } from '@fluentui-copilot/chat-input-plugins';\nimport { useLexicalComposerContext } from '@fluentui-copilot/react-text-editor';\n\nexport type ImperativeControlPluginRef = IImperativeControlBase;\nexport type ImperativeControlPluginProps = {};\n\nexport const ImperativeControlPlugin = React.forwardRef<ImperativeControlPluginRef, ImperativeControlPluginProps>(\n (_props, ref) => {\n const [editor] = useLexicalComposerContext();\n\n React.useImperativeHandle(ref, () => new ImperativeControlBase(editor), [editor]);\n\n return null;\n },\n);\n"],"names":["ImperativeControlPlugin","React","forwardRef","_props","ref","editor","useLexicalComposerContext","useImperativeHandle","ImperativeControlBase"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAQaA;;;eAAAA;;;;iEARU;kCAEe;iCACI;AAKnC,MAAMA,0BAAAA,WAAAA,GAA0BC,OAAMC,UAAU,CACrD,CAACC,QAAQC;IACP,MAAM,CAACC,OAAO,GAAGC,IAAAA,0CAAAA;IAEjBL,OAAMM,mBAAmB,CAACH,KAAK,IAAM,IAAII,uCAAAA,CAAsBH,SAAS;QAACA;KAAO;IAEhF,OAAO;AACT"}
|
|
@@ -22,4 +22,4 @@ const ManualGhostTextPlugin = /*#__PURE__*/ _react.forwardRef((props, ref)=>{
|
|
|
22
22
|
]);
|
|
23
23
|
return null;
|
|
24
24
|
});
|
|
25
|
-
ManualGhostTextPlugin.displayName = 'ManualGhostTextPlugin';
|
|
25
|
+
ManualGhostTextPlugin.displayName = 'ManualGhostTextPlugin';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["ManualGhostText.ts"],"sourcesContent":["import * as React from 'react';\nimport { useLexicalComposerContext } from '@fluentui-copilot/react-text-editor';\nimport type { GhostTextProps } from '../../GhostText';\nimport { $createGhostTextNode, $isGhostTextNode } from '../../GhostText';\nimport type { IManualGhostTextBase } from '@fluentui-copilot/chat-input-plugins';\nimport { ManualGhostTextBase } from '@fluentui-copilot/chat-input-plugins';\n\nexport type ManualGhostTextProps = {\n id: string;\n};\n\nexport type ManualGhostTextRef = IManualGhostTextBase<GhostTextProps>;\n\nexport const ManualGhostTextPlugin = React.forwardRef<ManualGhostTextRef, ManualGhostTextProps>((props, ref) => {\n const { id } = props;\n const [editor] = useLexicalComposerContext();\n\n React.useImperativeHandle<ManualGhostTextRef, ManualGhostTextRef>(\n ref,\n () => new ManualGhostTextBase(editor, id, $isGhostTextNode, $createGhostTextNode),\n [editor, id],\n );\n\n return null;\n});\n\nManualGhostTextPlugin.displayName = 'ManualGhostTextPlugin';\n"],"names":["ManualGhostTextPlugin","React","forwardRef","props","ref","id","editor","displayName"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAaaA;;;eAAAA;;;;iEAbU;iCACmB;2BAEa;kCAEnB;AAQ7B,MAAMA,sCAAwBC,OAAMC,UAAU,CAA2C,CAACC,OAAOC;
|
|
1
|
+
{"version":3,"sources":["ManualGhostText.ts"],"sourcesContent":["import * as React from 'react';\nimport { useLexicalComposerContext } from '@fluentui-copilot/react-text-editor';\nimport type { GhostTextProps } from '../../GhostText';\nimport { $createGhostTextNode, $isGhostTextNode } from '../../GhostText';\nimport type { IManualGhostTextBase } from '@fluentui-copilot/chat-input-plugins';\nimport { ManualGhostTextBase } from '@fluentui-copilot/chat-input-plugins';\n\nexport type ManualGhostTextProps = {\n id: string;\n};\n\nexport type ManualGhostTextRef = IManualGhostTextBase<GhostTextProps>;\n\nexport const ManualGhostTextPlugin = React.forwardRef<ManualGhostTextRef, ManualGhostTextProps>((props, ref) => {\n const { id } = props;\n const [editor] = useLexicalComposerContext();\n\n React.useImperativeHandle<ManualGhostTextRef, ManualGhostTextRef>(\n ref,\n () => new ManualGhostTextBase(editor, id, $isGhostTextNode, $createGhostTextNode),\n [editor, id],\n );\n\n return null;\n});\n\nManualGhostTextPlugin.displayName = 'ManualGhostTextPlugin';\n"],"names":["ManualGhostTextPlugin","React","forwardRef","props","ref","id","editor","useLexicalComposerContext","useImperativeHandle","ManualGhostTextBase","$isGhostTextNode","$createGhostTextNode","displayName"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAaaA;;;eAAAA;;;;iEAbU;iCACmB;2BAEa;kCAEnB;AAQ7B,MAAMA,sCAAwBC,OAAMC,UAAU,CAA2C,CAACC,OAAOC;IACtG,MAAM,EAAEC,EAAE,EAAE,GAAGF;IACf,MAAM,CAACG,OAAO,GAAGC,IAAAA,0CAAAA;IAEjBN,OAAMO,mBAAmB,CACvBJ,KACA,IAAM,IAAIK,qCAAAA,CAAoBH,QAAQD,IAAIK,2BAAAA,EAAkBC,+BAAAA,GAC5D;QAACL;QAAQD;KAAG;IAGd,OAAO;AACT;AAEAL,sBAAsBY,WAAW,GAAG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["PasteUnfurling.ts"],"sourcesContent":["import * as React from 'react';\nimport { registerPasteUnfurlingPlugin, type PasteUnfurlingPluginBaseProps } from '@fluentui-copilot/chat-input-plugins';\nimport { $createChatInputEntityNode, type ChatInputEntityProps } from '../../ChatInputEntity';\nimport { useLexicalComposerContext } from '@fluentui-copilot/react-text-editor';\n\nexport type PasteUnfurlingPluginProps<ExtraDataType> = Omit<\n PasteUnfurlingPluginBaseProps<ExtraDataType, ChatInputEntityProps>,\n '$createEntityNode'\n> &\n Pick<Partial<PasteUnfurlingPluginBaseProps<ExtraDataType, ChatInputEntityProps>>, '$createEntityNode'>;\n\nexport const PasteUnfurlingPlugin = <ExtraDataType>(props: PasteUnfurlingPluginProps<ExtraDataType>) => {\n const { $createEntityNode = $createChatInputEntityNode, ...rest } = props;\n\n const [editor] = useLexicalComposerContext();\n\n React.useEffect(() => {\n return registerPasteUnfurlingPlugin(editor, { ...rest, $createEntityNode });\n }, [$createEntityNode, editor, rest]);\n\n return null;\n};\n"],"names":["PasteUnfurlingPlugin","props","$createEntityNode","useLexicalComposerContext","React","
|
|
1
|
+
{"version":3,"sources":["PasteUnfurling.ts"],"sourcesContent":["import * as React from 'react';\nimport { registerPasteUnfurlingPlugin, type PasteUnfurlingPluginBaseProps } from '@fluentui-copilot/chat-input-plugins';\nimport { $createChatInputEntityNode, type ChatInputEntityProps } from '../../ChatInputEntity';\nimport { useLexicalComposerContext } from '@fluentui-copilot/react-text-editor';\n\nexport type PasteUnfurlingPluginProps<ExtraDataType> = Omit<\n PasteUnfurlingPluginBaseProps<ExtraDataType, ChatInputEntityProps>,\n '$createEntityNode'\n> &\n Pick<Partial<PasteUnfurlingPluginBaseProps<ExtraDataType, ChatInputEntityProps>>, '$createEntityNode'>;\n\nexport const PasteUnfurlingPlugin = <ExtraDataType>(props: PasteUnfurlingPluginProps<ExtraDataType>) => {\n const { $createEntityNode = $createChatInputEntityNode, ...rest } = props;\n\n const [editor] = useLexicalComposerContext();\n\n React.useEffect(() => {\n return registerPasteUnfurlingPlugin(editor, { ...rest, $createEntityNode });\n }, [$createEntityNode, editor, rest]);\n\n return null;\n};\n"],"names":["PasteUnfurlingPlugin","props","$createEntityNode","$createChatInputEntityNode","rest","editor","useLexicalComposerContext","React","useEffect","registerPasteUnfurlingPlugin"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAWaA;;;eAAAA;;;;iEAXU;kCAC0D;iCACX;iCAC5B;AAQnC,MAAMA,uBAAuB,CAAgBC;IAClD,MAAM,EAAEC,oBAAoBC,2CAA0B,EAAE,GAAGC,MAAM,GAAGH;IAEpE,MAAM,CAACI,OAAO,GAAGC,IAAAA,0CAAAA;IAEjBC,OAAMC,SAAS,CAAC;QACd,OAAOC,IAAAA,8CAAAA,EAA6BJ,QAAQ;YAAE,GAAGD,IAAI;YAAEF;QAAkB;IAC3E,GAAG;QAACA;QAAmBG;QAAQD;KAAK;IAEpC,OAAO;AACT"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluentui-copilot/react-chat-input-plugins",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.3",
|
|
4
4
|
"description": "A Fluent AI package for React-based ChatInput plugins.",
|
|
5
5
|
"main": "lib-commonjs/index.js",
|
|
6
6
|
"module": "lib/index.js",
|
|
@@ -12,16 +12,16 @@
|
|
|
12
12
|
},
|
|
13
13
|
"license": "MIT",
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@fluentui-copilot/chat-input-plugins": "^0.5.
|
|
16
|
-
"@fluentui-copilot/react-text-editor": "^0.4.
|
|
17
|
-
"@fluentui-copilot/text-editor": "^0.3.
|
|
18
|
-
"@fluentui-copilot/tokens": "^0.3.
|
|
15
|
+
"@fluentui-copilot/chat-input-plugins": "^0.5.1",
|
|
16
|
+
"@fluentui-copilot/react-text-editor": "^0.4.2",
|
|
17
|
+
"@fluentui-copilot/text-editor": "^0.3.2",
|
|
18
|
+
"@fluentui-copilot/tokens": "^0.3.12",
|
|
19
19
|
"@swc/helpers": "^0.5.1"
|
|
20
20
|
},
|
|
21
21
|
"peerDependencies": {
|
|
22
|
-
"@fluentui/react-components": ">=9.
|
|
23
|
-
"@fluentui/react-jsx-runtime": ">=9.
|
|
24
|
-
"@fluentui/react-utilities": ">=9.
|
|
22
|
+
"@fluentui/react-components": ">=9.66.0 <10.0.0",
|
|
23
|
+
"@fluentui/react-jsx-runtime": ">=9.1.1 <10.0.0",
|
|
24
|
+
"@fluentui/react-utilities": ">=9.21.1 <10.0.0",
|
|
25
25
|
"@types/react": ">=16.14.0 <19.0.0",
|
|
26
26
|
"@types/react-dom": ">=16.9.8 <19.0.0",
|
|
27
27
|
"react": ">=16.14.0 <19.0.0",
|