@fluentui-copilot/react-chat-input-plugins 0.0.4 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.json CHANGED
@@ -2,7 +2,34 @@
2
2
  "name": "@fluentui-copilot/react-chat-input-plugins",
3
3
  "entries": [
4
4
  {
5
- "date": "Tue, 30 Apr 2024 20:54:47 GMT",
5
+ "date": "Wed, 08 May 2024 22:10:20 GMT",
6
+ "tag": "@fluentui-copilot/react-chat-input-plugins_v0.0.5",
7
+ "version": "0.0.5",
8
+ "comments": {
9
+ "patch": [
10
+ {
11
+ "author": "sarah.higley@microsoft.com",
12
+ "package": "@fluentui-copilot/react-chat-input-plugins",
13
+ "commit": "44f1da0736caf911d7d9f2d7a30b4e983a5a8b2e",
14
+ "comment": "chore: bump @fluentui/react-components to latest, 9.49.2"
15
+ },
16
+ {
17
+ "author": "tristan.watanabe@gmail.com",
18
+ "package": "@fluentui-copilot/react-chat-input-plugins",
19
+ "commit": "7a6455002d0034273026cb63a31a77a365e78b8d",
20
+ "comment": "fix: remove horizontal padding from ChatInputToken."
21
+ },
22
+ {
23
+ "author": "owcampbe@microsoft.com",
24
+ "package": "@fluentui-copilot/react-chat-input-plugins",
25
+ "commit": "8b3fa1f2bc2732776130769a904a98c314207fef",
26
+ "comment": "fix: Improve navigation around GhostText."
27
+ }
28
+ ]
29
+ }
30
+ },
31
+ {
32
+ "date": "Tue, 30 Apr 2024 20:55:42 GMT",
6
33
  "tag": "@fluentui-copilot/react-chat-input-plugins_v0.0.4",
7
34
  "version": "0.0.4",
8
35
  "comments": {
package/CHANGELOG.md CHANGED
@@ -1,12 +1,23 @@
1
1
  # Change Log - @fluentui-copilot/react-chat-input-plugins
2
2
 
3
- This log was last generated on Tue, 30 Apr 2024 20:54:47 GMT and should not be manually modified.
3
+ This log was last generated on Wed, 08 May 2024 22:10:20 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## [0.0.5](https://github.com/microsoft/fluentai/tree/@fluentui-copilot/react-chat-input-plugins_v0.0.5)
8
+
9
+ Wed, 08 May 2024 22:10:20 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentai/compare/@fluentui-copilot/react-chat-input-plugins_v0.0.4..@fluentui-copilot/react-chat-input-plugins_v0.0.5)
11
+
12
+ ### Patches
13
+
14
+ - chore: bump @fluentui/react-components to latest, 9.49.2 ([PR #1614](https://github.com/microsoft/fluentai/pull/1614) by sarah.higley@microsoft.com)
15
+ - fix: remove horizontal padding from ChatInputToken. ([PR #1604](https://github.com/microsoft/fluentai/pull/1604) by tristan.watanabe@gmail.com)
16
+ - fix: Improve navigation around GhostText. ([PR #1611](https://github.com/microsoft/fluentai/pull/1611) by owcampbe@microsoft.com)
17
+
7
18
  ## [0.0.4](https://github.com/microsoft/fluentai/tree/@fluentui-copilot/react-chat-input-plugins_v0.0.4)
8
19
 
9
- Tue, 30 Apr 2024 20:54:47 GMT
20
+ Tue, 30 Apr 2024 20:55:42 GMT
10
21
  [Compare changes](https://github.com/microsoft/fluentai/compare/@fluentui-copilot/react-chat-input-plugins_v0.0.3..@fluentui-copilot/react-chat-input-plugins_v0.0.4)
11
22
 
12
23
  ### Patches
package/dist/index.d.ts CHANGED
@@ -172,7 +172,9 @@ export declare type GhostTextPluginProps = {
172
172
  /**
173
173
  * GhostText Props
174
174
  */
175
- export declare type GhostTextProps = ComponentProps<GhostTextSlots> & {};
175
+ export declare type GhostTextProps = ComponentProps<GhostTextSlots> & {
176
+ nodeKey?: string;
177
+ };
176
178
 
177
179
  export declare type GhostTextSlots = {
178
180
  root: Slot<'span'>;
@@ -189,7 +191,10 @@ declare interface IImperativeControlBase {
189
191
  appendText: (text: string) => void;
190
192
  prependText: (text: string) => void;
191
193
  insertTextAtCursor: (text: string) => void;
192
- getInputText: () => string;
194
+ /**
195
+ * @param transform will be called for each Lexical node in the input. This enables custom string representation for each node.
196
+ */
197
+ getInputText: (transform?: (node: LexicalNode) => string) => string;
193
198
  scrollToBottom: () => void;
194
199
  moveCursor: (location: number) => void;
195
200
  }
@@ -1,11 +1,11 @@
1
- import { __resetStyles, mergeClasses, tokens, typographyStyles } from '@fluentui/react-components';
1
+ import { __resetStyles, mergeClasses, shorthands, tokens, typographyStyles } from '@fluentui/react-components';
2
2
  export const chatInputTokenClassNames = {
3
3
  root: 'fai-ChatInputToken'
4
4
  };
5
5
  /**
6
6
  * Styles for the root slot
7
7
  */
8
- const useBaseClassName = __resetStyles("rx0et0g", null, [".rx0et0g{font-family:var(--fontFamilyBase);font-size:var(--fontSizeBase200);font-weight:var(--fontWeightRegular);line-height:var(--lineHeightBase200);background-color:var(--colorNeutralBackground3);border-radius:var(--borderRadiusMedium);color:var(--colorNeutralForeground2);padding:var(--spacingVerticalXXS) var(--spacingHorizontalXS);border:var(--strokeWidthThin) solid var(--colorTransparentStroke);-webkit-box-decoration-break:clone;box-decoration-break:clone;white-space:normal;}", ".rx0et0g::before{content:\".\";font-size:0;letter-spacing:var(--spacingHorizontalXS);}", ".rx0et0g::after{content:\".\";font-size:0;letter-spacing:var(--spacingHorizontalXS);}"]);
8
+ const useBaseClassName = __resetStyles("rjbvsrk", "r1d7fxr6", [".rjbvsrk{font-family:var(--fontFamilyBase);font-size:var(--fontSizeBase200);font-weight:var(--fontWeightRegular);line-height:inherit;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-top:var(--spacingVerticalXXS);padding-right:0;padding-bottom:var(--spacingVerticalXXS);padding-left:0;}", ".r1d7fxr6{font-family:var(--fontFamilyBase);font-size:var(--fontSizeBase200);font-weight:var(--fontWeightRegular);line-height:inherit;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-top:var(--spacingVerticalXXS);padding-left:0;padding-bottom:var(--spacingVerticalXXS);padding-right:0;}"]);
9
9
  /**
10
10
  * Apply styling to the ChatInputToken slots based on the state
11
11
  */
@@ -1 +1 @@
1
- {"version":3,"sources":["useChatInputTokenStyles.ts"],"sourcesContent":["import { makeResetStyles, mergeClasses, tokens, typographyStyles } from '@fluentui/react-components';\nimport type { ChatInputTokenSlots, ChatInputTokenState } from './ChatInputToken.types';\nimport type { SlotClassNames } from '@fluentui/react-components';\n\nexport const chatInputTokenClassNames: SlotClassNames<ChatInputTokenSlots> = {\n root: 'fai-ChatInputToken',\n};\n\n/**\n * Styles for the root slot\n */\nconst useBaseClassName = makeResetStyles({\n ...typographyStyles.caption1,\n backgroundColor: tokens.colorNeutralBackground3,\n borderRadius: tokens.borderRadiusMedium,\n color: tokens.colorNeutralForeground2,\n // We only want half of the horizontal padding to be present when the text wraps, so we add the other half\n // on the ::before and ::after pseudo elements\n padding: `${tokens.spacingVerticalXXS} ${tokens.spacingHorizontalXS}`,\n border: `${tokens.strokeWidthThin} solid ${tokens.colorTransparentStroke}`,\n boxDecorationBreak: 'clone',\n whiteSpace: 'normal',\n\n // Use ::before and ::after instead of just horizontal padding to ensure the cursor doesn't move inside the padding\n '&::before': {\n content: '\".\"', // Use a character to ensure the element has a width\n fontSize: 0,\n letterSpacing: tokens.spacingHorizontalXS,\n },\n '&::after': {\n content: '\".\"', // Use a character to ensure the element has a width\n fontSize: 0,\n letterSpacing: tokens.spacingHorizontalXS,\n },\n});\n\n/**\n * Apply styling to the ChatInputToken slots based on the state\n */\nexport const useChatInputTokenStyles_unstable = (state: ChatInputTokenState): ChatInputTokenState => {\n const baseClassName = useBaseClassName();\n state.root.className = mergeClasses(chatInputTokenClassNames.root, baseClassName, state.root.className);\n\n return state;\n};\n"],"names":["makeResetStyles","mergeClasses","tokens","typographyStyles","chatInputTokenClassNames","root","useBaseClassName","caption1","backgroundColor","colorNeutralBackground3","borderRadius","borderRadiusMedium","color","colorNeutralForeground2","padding","spacingVerticalXXS","spacingHorizontalXS","border","strokeWidthThin","colorTransparentStroke","boxDecorationBreak","whiteSpace","content","fontSize","letterSpacing","useChatInputTokenStyles_unstable","state","baseClassName","className"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,SAASA,eAAe,EAAEC,YAAY,EAAEC,MAAM,EAAEC,gBAAgB,QAAQ,6BAA6B;AAIrG,OAAO,MAAMC,2BAAgE;IAC3EC,MAAM;AACR,EAAE;AAEF;;CAEC,GACD,MAAMC,mBAAmBN,gBAAgB;IACvC,GAAGG,iBAAiBI,QAAQ;IAC5BC,iBAAiBN,OAAOO,uBAAuB;IAC/CC,cAAcR,OAAOS,kBAAkB;IACvCC,OAAOV,OAAOW,uBAAuB;IACrC,0GAA0G;IAC1G,8CAA8C;IAC9CC,SAAS,CAAC,EAAEZ,OAAOa,kBAAkB,CAAC,CAAC,EAAEb,OAAOc,mBAAmB,CAAC,CAAC;IACrEC,QAAQ,CAAC,EAAEf,OAAOgB,eAAe,CAAC,OAAO,EAAEhB,OAAOiB,sBAAsB,CAAC,CAAC;IAC1EC,oBAAoB;IACpBC,YAAY;IAEZ,mHAAmH;IACnH,aAAa;QACXC,SAAS;QACTC,UAAU;QACVC,eAAetB,OAAOc,mBAAmB;IAC3C;IACA,YAAY;QACVM,SAAS;QACTC,UAAU;QACVC,eAAetB,OAAOc,mBAAmB;IAC3C;AACF;AAEA;;CAEC,GACD,OAAO,MAAMS,mCAAmC,CAACC;IAC/C,MAAMC,gBAAgBrB;IACtBoB,MAAMrB,IAAI,CAACuB,SAAS,GAAG3B,aAAaG,yBAAyBC,IAAI,EAAEsB,eAAeD,MAAMrB,IAAI,CAACuB,SAAS;IAEtG,OAAOF;AACT,EAAE"}
1
+ {"version":3,"sources":["useChatInputTokenStyles.ts"],"sourcesContent":["import { makeResetStyles, mergeClasses, shorthands, tokens, typographyStyles } from '@fluentui/react-components';\nimport type { ChatInputTokenSlots, ChatInputTokenState } from './ChatInputToken.types';\nimport type { SlotClassNames } from '@fluentui/react-components';\n\nexport const chatInputTokenClassNames: SlotClassNames<ChatInputTokenSlots> = {\n root: 'fai-ChatInputToken',\n};\n\n/**\n * Styles for the root slot\n */\nconst useBaseClassName = makeResetStyles({\n ...typographyStyles.caption1,\n backgroundColor: tokens.colorNeutralBackground3,\n border: `${tokens.strokeWidthThin} solid ${tokens.colorTransparentStroke}`,\n borderRadius: tokens.borderRadiusMedium,\n boxDecorationBreak: 'clone',\n color: tokens.colorNeutralForeground2,\n lineHeight: 'inherit',\n ...shorthands.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 const baseClassName = useBaseClassName();\n state.root.className = mergeClasses(chatInputTokenClassNames.root, baseClassName, state.root.className);\n\n return state;\n};\n"],"names":["makeResetStyles","mergeClasses","shorthands","tokens","typographyStyles","chatInputTokenClassNames","root","useBaseClassName","caption1","backgroundColor","colorNeutralBackground3","border","strokeWidthThin","colorTransparentStroke","borderRadius","borderRadiusMedium","boxDecorationBreak","color","colorNeutralForeground2","lineHeight","padding","spacingVerticalXXS","useChatInputTokenStyles_unstable","state","baseClassName","className"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,SAASA,eAAe,EAAEC,YAAY,EAAEC,UAAU,EAAEC,MAAM,EAAEC,gBAAgB,QAAQ,6BAA6B;AAIjH,OAAO,MAAMC,2BAAgE;IAC3EC,MAAM;AACR,EAAE;AAEF;;CAEC,GACD,MAAMC,mBAAmBP,gBAAgB;IACvC,GAAGI,iBAAiBI,QAAQ;IAC5BC,iBAAiBN,OAAOO,uBAAuB;IAC/CC,QAAQ,CAAC,EAAER,OAAOS,eAAe,CAAC,OAAO,EAAET,OAAOU,sBAAsB,CAAC,CAAC;IAC1EC,cAAcX,OAAOY,kBAAkB;IACvCC,oBAAoB;IACpBC,OAAOd,OAAOe,uBAAuB;IACrCC,YAAY;IACZ,GAAGjB,WAAWkB,OAAO,CAACjB,OAAOkB,kBAAkB,EAAE,EAAE;AACrD;AAEA;;CAEC,GACD,OAAO,MAAMC,mCAAmC,CAACC;IAC/C,MAAMC,gBAAgBjB;IACtBgB,MAAMjB,IAAI,CAACmB,SAAS,GAAGxB,aAAaI,yBAAyBC,IAAI,EAAEkB,eAAeD,MAAMjB,IAAI,CAACmB,SAAS;IAEtG,OAAOF;AACT,EAAE"}
@@ -1 +1 @@
1
- {"version":3,"sources":["GhostText.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-components';\n\nexport type GhostTextSlots = {\n root: Slot<'span'>;\n indicator?: Slot<'span'>;\n};\n\n/**\n * GhostText Props\n */\nexport type GhostTextProps = ComponentProps<GhostTextSlots> & {};\n\n/**\n * State used in rendering GhostText\n */\nexport type GhostTextState = ComponentState<GhostTextSlots>;\n// TODO: Remove semicolon from previous line, uncomment next line, and provide union of props to pick from GhostTextProps.\n// & Required<Pick<GhostTextProps, 'propName'>>\n"],"names":[],"rangeMappings":";;;","mappings":"AAYA;;CAEC,GACD,WAA4D,CAC5D,0HAA0H;CAC1H,+CAA+C"}
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"}
@@ -1,4 +1,6 @@
1
- import { getIntrinsicElementProps, slot } from '@fluentui/react-components';
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';
2
4
  // If you add JSX to this file, be sure to change the file type to .tsx
3
5
  /**
4
6
  * Create the state required to render GhostText.
@@ -10,14 +12,34 @@ import { getIntrinsicElementProps, slot } from '@fluentui/react-components';
10
12
  * @param ref - reference to root HTMLElement of GhostText
11
13
  */
12
14
  export const useGhostText_unstable = (props, ref) => {
13
- return {
15
+ const {
16
+ nodeKey,
17
+ onClick,
18
+ ...rest
19
+ } = props;
20
+ const [editor] = useLexicalComposerContext();
21
+ const handleClick = React.useCallback(_ev => {
22
+ if (!nodeKey) {
23
+ return;
24
+ }
25
+ editor.update(() => {
26
+ var _node_getPreviousSibling;
27
+ const node = $getNodeByKey(nodeKey);
28
+ node === null || node === void 0 ? void 0 : (_node_getPreviousSibling = node.getPreviousSibling()) === null || _node_getPreviousSibling === void 0 ? void 0 : _node_getPreviousSibling.selectEnd();
29
+ }, {
30
+ tag: 'historic'
31
+ });
32
+ }, [editor, nodeKey]);
33
+ const mergedOnClick = mergeCallbacks(handleClick, onClick);
34
+ const state = {
14
35
  components: {
15
36
  root: 'span',
16
37
  indicator: 'span'
17
38
  },
18
39
  root: slot.always(getIntrinsicElementProps('span', {
19
40
  ref,
20
- ...props
41
+ onClick: mergedOnClick,
42
+ ...rest
21
43
  }), {
22
44
  elementType: 'span'
23
45
  }),
@@ -25,5 +47,6 @@ export const useGhostText_unstable = (props, ref) => {
25
47
  elementType: 'span'
26
48
  })
27
49
  };
50
+ return state;
28
51
  };
29
52
  //# sourceMappingURL=useGhostText.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["useGhostText.ts"],"sourcesContent":["import type * as React from 'react';\nimport { getIntrinsicElementProps, slot } from '@fluentui/react-components';\nimport type { GhostTextProps, GhostTextState } from './GhostText.types';\n\n// If you add JSX to this file, be sure to change the file type to .tsx\n\n/**\n * Create the state required to render GhostText.\n *\n * The returned state can be modified with hooks such as useGhostTextStyles_unstable,\n * before being passed to renderGhostText_unstable.\n *\n * @param props - props from this instance of GhostText\n * @param ref - reference to root HTMLElement of GhostText\n */\nexport const useGhostText_unstable = (props: GhostTextProps, ref: React.Ref<HTMLSpanElement>): GhostTextState => {\n return {\n components: {\n root: 'span',\n indicator: 'span',\n },\n root: slot.always(\n getIntrinsicElementProps('span', {\n ref,\n ...props,\n }),\n { elementType: 'span' },\n ),\n indicator: slot.optional(props.indicator, { elementType: 'span' }),\n };\n};\n"],"names":["getIntrinsicElementProps","slot","useGhostText_unstable","props","ref","components","root","indicator","always","elementType","optional"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AACA,SAASA,wBAAwB,EAAEC,IAAI,QAAQ,6BAA6B;AAG5E,uEAAuE;AAEvE;;;;;;;;CAQC,GACD,OAAO,MAAMC,wBAAwB,CAACC,OAAuBC;IAC3D,OAAO;QACLC,YAAY;YACVC,MAAM;YACNC,WAAW;QACb;QACAD,MAAML,KAAKO,MAAM,CACfR,yBAAyB,QAAQ;YAC/BI;YACA,GAAGD,KAAK;QACV,IACA;YAAEM,aAAa;QAAO;QAExBF,WAAWN,KAAKS,QAAQ,CAACP,MAAMI,SAAS,EAAE;YAAEE,aAAa;QAAO;IAClE;AACF,EAAE"}
1
+ {"version":3,"sources":["useGhostText.ts"],"sourcesContent":["import * as React from 'react';\nimport { getIntrinsicElementProps, mergeCallbacks, slot } from '@fluentui/react-components';\nimport type { GhostTextProps, GhostTextState } from './GhostText.types';\nimport { $getNodeByKey, useLexicalComposerContext } from '@fluentui-copilot/react-text-editor';\n\n// If you add JSX to this file, be sure to change the file type to .tsx\n\n/**\n * Create the state required to render GhostText.\n *\n * The returned state can be modified with hooks such as useGhostTextStyles_unstable,\n * before being passed to renderGhostText_unstable.\n *\n * @param props - props from this instance of GhostText\n * @param ref - reference to root HTMLElement of GhostText\n */\nexport const useGhostText_unstable = (props: GhostTextProps, ref: React.Ref<HTMLSpanElement>): GhostTextState => {\n const { nodeKey, onClick, ...rest } = props;\n const [editor] = useLexicalComposerContext();\n\n const handleClick = React.useCallback(\n _ev => {\n if (!nodeKey) {\n return;\n }\n\n editor.update(\n () => {\n const node = $getNodeByKey(nodeKey);\n node?.getPreviousSibling()?.selectEnd();\n },\n { tag: 'historic' },\n );\n },\n [editor, nodeKey],\n );\n\n const mergedOnClick = mergeCallbacks(handleClick, onClick);\n\n const state: GhostTextState = {\n components: {\n root: 'span',\n indicator: 'span',\n },\n root: slot.always(\n getIntrinsicElementProps('span', {\n ref,\n onClick: mergedOnClick,\n ...rest,\n }),\n { elementType: 'span' },\n ),\n indicator: slot.optional(props.indicator, { elementType: 'span' }),\n };\n\n return state;\n};\n"],"names":["React","getIntrinsicElementProps","mergeCallbacks","slot","$getNodeByKey","useLexicalComposerContext","useGhostText_unstable","props","ref","nodeKey","onClick","rest","editor","handleClick","useCallback","_ev","update","node","getPreviousSibling","selectEnd","tag","mergedOnClick","state","components","root","indicator","always","elementType","optional"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,wBAAwB,EAAEC,cAAc,EAAEC,IAAI,QAAQ,6BAA6B;AAE5F,SAASC,aAAa,EAAEC,yBAAyB,QAAQ,sCAAsC;AAE/F,uEAAuE;AAEvE;;;;;;;;CAQC,GACD,OAAO,MAAMC,wBAAwB,CAACC,OAAuBC;IAC3D,MAAM,EAAEC,OAAO,EAAEC,OAAO,EAAE,GAAGC,MAAM,GAAGJ;IACtC,MAAM,CAACK,OAAO,GAAGP;IAEjB,MAAMQ,cAAcb,MAAMc,WAAW,CACnCC,CAAAA;QACE,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"}
@@ -40,7 +40,10 @@ export class GhostTextNode extends DecoratorNode {
40
40
  return document.createElement('span');
41
41
  }
42
42
  decorate() {
43
- return /*#__PURE__*/React.createElement(GhostText, this.__componentProps, this.__content);
43
+ return /*#__PURE__*/React.createElement(GhostText, {
44
+ nodeKey: this.getKey(),
45
+ ...this.__componentProps
46
+ }, this.__content);
44
47
  }
45
48
  constructor(id, content, exposeText, componentProps, key) {
46
49
  super(key);
@@ -1 +1 @@
1
- {"version":3,"sources":["GhostText.node.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { DecoratorNode } from '@fluentui-copilot/text-editor';\nimport type { EditorConfig, LexicalNode, NodeKey, SerializedLexicalNode, Spread } from '@fluentui-copilot/text-editor';\nimport type { GhostTextProps } from '../../components/GhostText/GhostText.types';\nimport { GhostText } from '../../components/GhostText/GhostText';\n\nexport type SerializedGhostTextNode = Spread<\n {\n content: string;\n id: string;\n componentProps?: GhostTextProps;\n exposeText?: boolean;\n },\n SerializedLexicalNode\n>;\n\nexport class GhostTextNode extends DecoratorNode<JSX.Element | null> {\n __content: string;\n __id: string;\n __allowCommitting?: boolean;\n __componentProps?: GhostTextProps;\n __exposeText?: boolean;\n\n static clone(node: GhostTextNode): GhostTextNode {\n return new GhostTextNode(node.__id, node.__content, node.__exposeText, node.__componentProps, node.__key);\n }\n\n static getType(): 'ghosttext' {\n return 'ghosttext';\n }\n\n static importJSON(serializedNode: SerializedGhostTextNode): GhostTextNode {\n const node = $createGhostTextNode(\n serializedNode.id,\n serializedNode.content,\n serializedNode.exposeText,\n serializedNode.componentProps,\n );\n return node;\n }\n\n exportJSON(): SerializedGhostTextNode {\n return {\n ...super.exportJSON(),\n type: 'ghosttext',\n id: this.__id,\n content: this.__content,\n componentProps: this.__componentProps,\n exposeText: this.__exposeText,\n version: 1,\n };\n }\n\n constructor(id: string, content: string, exposeText?: boolean, componentProps?: GhostTextProps, key?: NodeKey) {\n super(key);\n this.__id = id;\n this.__content = content;\n this.__exposeText = exposeText;\n this.__componentProps = componentProps;\n }\n\n isInline() {\n return true;\n }\n\n isIsolated() {\n return true;\n }\n\n getTextContent(): string {\n return this.__exposeText ? this.__content : '';\n }\n\n updateDOM(prevNode: unknown, dom: HTMLElement, config: EditorConfig): boolean {\n return false;\n }\n\n createDOM(config: EditorConfig): HTMLElement {\n return document.createElement('span');\n }\n\n decorate(): JSX.Element | null {\n return <GhostText {...this.__componentProps}>{this.__content}</GhostText>;\n }\n}\n\nexport function $createGhostTextNode(\n id: string,\n content: string,\n exposeText?: boolean,\n componentProps?: GhostTextProps,\n): GhostTextNode {\n return new GhostTextNode(id, content, exposeText, componentProps);\n}\n\nexport function $isGhostTextNode(node: LexicalNode | null | undefined): node is GhostTextNode {\n return node instanceof GhostTextNode;\n}\n"],"names":["React","DecoratorNode","GhostText","GhostTextNode","clone","node","__id","__content","__exposeText","__componentProps","__key","getType","importJSON","serializedNode","$createGhostTextNode","id","content","exposeText","componentProps","exportJSON","type","version","isInline","isIsolated","getTextContent","updateDOM","prevNode","dom","config","createDOM","document","createElement","decorate","constructor","key","__allowCommitting","$isGhostTextNode"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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QArCR3B,uBAAAA,aAAAA,KAAAA;QACAD,uBAAAA,QAAAA,KAAAA;QACA6B,uBAAAA,qBAAAA,KAAAA;QACA1B,uBAAAA,oBAAAA,KAAAA;QACAD,uBAAAA,gBAAAA,KAAAA;QAkCE,IAAI,CAACF,IAAI,GAAGS;QACZ,IAAI,CAACR,SAAS,GAAGS;QACjB,IAAI,CAACR,YAAY,GAAGS;QACpB,IAAI,CAACR,gBAAgB,GAAGS;IAC1B;AAyBF;AAEA,OAAO,SAASJ,qBACdC,EAAU,EACVC,OAAe,EACfC,UAAoB,EACpBC,cAA+B;IAE/B,OAAO,IAAIf,cAAcY,IAAIC,SAASC,YAAYC;AACpD;AAEA,OAAO,SAASkB,iBAAiB/B,IAAoC;IACnE,OAAOA,gBAAgBF;AACzB"}
1
+ {"version":3,"sources":["GhostText.node.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { DecoratorNode } from '@fluentui-copilot/text-editor';\nimport type { EditorConfig, LexicalNode, NodeKey, SerializedLexicalNode, Spread } from '@fluentui-copilot/text-editor';\nimport type { GhostTextProps } from '../../components/GhostText/GhostText.types';\nimport { GhostText } from '../../components/GhostText/GhostText';\n\nexport type SerializedGhostTextNode = Spread<\n {\n content: string;\n id: string;\n componentProps?: GhostTextProps;\n exposeText?: boolean;\n },\n SerializedLexicalNode\n>;\n\nexport class GhostTextNode extends DecoratorNode<JSX.Element | null> {\n __content: string;\n __id: string;\n __allowCommitting?: boolean;\n __componentProps?: GhostTextProps;\n __exposeText?: boolean;\n\n static clone(node: GhostTextNode): GhostTextNode {\n return new GhostTextNode(node.__id, node.__content, node.__exposeText, node.__componentProps, node.__key);\n }\n\n static getType(): 'ghosttext' {\n return 'ghosttext';\n }\n\n static importJSON(serializedNode: SerializedGhostTextNode): GhostTextNode {\n const node = $createGhostTextNode(\n serializedNode.id,\n serializedNode.content,\n serializedNode.exposeText,\n serializedNode.componentProps,\n );\n return node;\n }\n\n exportJSON(): SerializedGhostTextNode {\n return {\n ...super.exportJSON(),\n type: 'ghosttext',\n id: this.__id,\n content: this.__content,\n componentProps: this.__componentProps,\n exposeText: this.__exposeText,\n version: 1,\n };\n }\n\n constructor(id: string, content: string, exposeText?: boolean, componentProps?: GhostTextProps, key?: NodeKey) {\n super(key);\n this.__id = id;\n this.__content = content;\n this.__exposeText = exposeText;\n this.__componentProps = componentProps;\n }\n\n isInline() {\n return true;\n }\n\n isIsolated() {\n return true;\n }\n\n getTextContent(): string {\n return this.__exposeText ? this.__content : '';\n }\n\n updateDOM(prevNode: unknown, dom: HTMLElement, config: EditorConfig): boolean {\n return false;\n }\n\n createDOM(config: EditorConfig): HTMLElement {\n return document.createElement('span');\n }\n\n decorate(): JSX.Element | null {\n return (\n <GhostText nodeKey={this.getKey()} {...this.__componentProps}>\n {this.__content}\n </GhostText>\n );\n }\n}\n\nexport function $createGhostTextNode(\n id: string,\n content: string,\n exposeText?: boolean,\n componentProps?: GhostTextProps,\n): GhostTextNode {\n return new GhostTextNode(id, content, exposeText, componentProps);\n}\n\nexport function $isGhostTextNode(node: LexicalNode | null | undefined): node is GhostTextNode {\n return node instanceof GhostTextNode;\n}\n"],"names":["React","DecoratorNode","GhostText","GhostTextNode","clone","node","__id","__content","__exposeText","__componentProps","__key","getType","importJSON","serializedNode","$createGhostTextNode","id","content","exposeText","componentProps","exportJSON","type","version","isInline","isIsolated","getTextContent","updateDOM","prevNode","dom","config","createDOM","document","createElement","decorate","nodeKey","getKey","constructor","key","__allowCommitting","$isGhostTextNode"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";AAAA,YAAYA,WAAW,QAAQ;AAE/B,SAASC,aAAa,QAAQ,gCAAgC;AAG9D,SAASC,SAAS,QAAQ,uCAAuC;AAYjE,OAAO,MAAMC,sBAAsBF;IAOjC,OAAOG,MAAMC,IAAmB,EAAiB;QAC/C,OAAO,IAAIF,cAAcE,KAAKC,IAAI,EAAED,K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AAS,GAAGS;QACjB,IAAI,CAACR,YAAY,GAAGS;QACpB,IAAI,CAACR,gBAAgB,GAAGS;IAC1B;AA6BF;AAEA,OAAO,SAASJ,qBACdC,EAAU,EACVC,OAAe,EACfC,UAAoB,EACpBC,cAA+B;IAE/B,OAAO,IAAIf,cAAcY,IAAIC,SAASC,YAAYC;AACpD;AAEA,OAAO,SAASoB,iBAAiBjC,IAAoC;IACnE,OAAOA,gBAAgBF;AACzB"}
@@ -22,10 +22,9 @@ const chatInputTokenClassNames = {
22
22
  };
23
23
  /**
24
24
  * Styles for the root slot
25
- */ const useBaseClassName = (0, _reactcomponents.__resetStyles)("rx0et0g", null, [
26
- ".rx0et0g{font-family:var(--fontFamilyBase);font-size:var(--fontSizeBase200);font-weight:var(--fontWeightRegular);line-height:var(--lineHeightBase200);background-color:var(--colorNeutralBackground3);border-radius:var(--borderRadiusMedium);color:var(--colorNeutralForeground2);padding:var(--spacingVerticalXXS) var(--spacingHorizontalXS);border:var(--strokeWidthThin) solid var(--colorTransparentStroke);-webkit-box-decoration-break:clone;box-decoration-break:clone;white-space:normal;}",
27
- ".rx0et0g::before{content:\".\";font-size:0;letter-spacing:var(--spacingHorizontalXS);}",
28
- ".rx0et0g::after{content:\".\";font-size:0;letter-spacing:var(--spacingHorizontalXS);}"
25
+ */ const useBaseClassName = (0, _reactcomponents.__resetStyles)("rjbvsrk", "r1d7fxr6", [
26
+ ".rjbvsrk{font-family:var(--fontFamilyBase);font-size:var(--fontSizeBase200);font-weight:var(--fontWeightRegular);line-height:inherit;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-top:var(--spacingVerticalXXS);padding-right:0;padding-bottom:var(--spacingVerticalXXS);padding-left:0;}",
27
+ ".r1d7fxr6{font-family:var(--fontFamilyBase);font-size:var(--fontSizeBase200);font-weight:var(--fontWeightRegular);line-height:inherit;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-top:var(--spacingVerticalXXS);padding-left:0;padding-bottom:var(--spacingVerticalXXS);padding-right:0;}"
29
28
  ]);
30
29
  const useChatInputTokenStyles_unstable = (state)=>{
31
30
  const baseClassName = useBaseClassName();
@@ -1 +1 @@
1
- {"version":3,"sources":["useChatInputTokenStyles.ts"],"sourcesContent":["import { makeResetStyles, mergeClasses, tokens, typographyStyles } from '@fluentui/react-components';\nimport type { ChatInputTokenSlots, ChatInputTokenState } from './ChatInputToken.types';\nimport type { SlotClassNames } from '@fluentui/react-components';\n\nexport const chatInputTokenClassNames: SlotClassNames<ChatInputTokenSlots> = {\n root: 'fai-ChatInputToken',\n};\n\n/**\n * Styles for the root slot\n */\nconst useBaseClassName = makeResetStyles({\n ...typographyStyles.caption1,\n backgroundColor: tokens.colorNeutralBackground3,\n borderRadius: tokens.borderRadiusMedium,\n color: tokens.colorNeutralForeground2,\n // We only want half of the horizontal padding to be present when the text wraps, so we add the other half\n // on the ::before and ::after pseudo elements\n padding: `${tokens.spacingVerticalXXS} ${tokens.spacingHorizontalXS}`,\n border: `${tokens.strokeWidthThin} solid ${tokens.colorTransparentStroke}`,\n boxDecorationBreak: 'clone',\n whiteSpace: 'normal',\n\n // Use ::before and ::after instead of just horizontal padding to ensure the cursor doesn't move inside the padding\n '&::before': {\n content: '\".\"', // Use a character to ensure the element has a width\n fontSize: 0,\n letterSpacing: tokens.spacingHorizontalXS,\n },\n '&::after': {\n content: '\".\"', // Use a character to ensure the element has a width\n fontSize: 0,\n letterSpacing: tokens.spacingHorizontalXS,\n },\n});\n\n/**\n * Apply styling to the ChatInputToken slots based on the state\n */\nexport const useChatInputTokenStyles_unstable = (state: ChatInputTokenState): ChatInputTokenState => {\n const baseClassName = useBaseClassName();\n state.root.className = mergeClasses(chatInputTokenClassNames.root, baseClassName, state.root.className);\n\n return state;\n};\n"],"names":["chatInputTokenClassNames","useChatInputTokenStyles_unstable","root","useBaseClassName","caption1","state","baseClassName","padding","className","tokens","spacingVerticalXXS","spacingHorizontalXS","border"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAIaA,wBAAAA;eAAAA;;IAYXC,gCAAA;eAAAA;;;iCAhB8D;AAIzD,MAAMD,2BAAgE;UAC3EE;AACF;AAEA;;CAEC,SAECC,mBAAoBC,IAAAA,8BAAQ,EAAA,WAAA,MAAA;IAAA;IAAA;IAAA;CAAA;AAI5B,MAAAH,mCAAAI,CAAAA;UACAC,gBAAAH;UACAI,IAAAA,CAASC,SAAGC,GAAOC,IAAAA,6BAAAA,EAAAA,yBAA6BC,IAAAA,EAAAA,eAAqBN,MAAAH,IAAA,CAAAM,SAAA;WACrEI;sDAEY"}
1
+ {"version":3,"sources":["useChatInputTokenStyles.ts"],"sourcesContent":["import { makeResetStyles, mergeClasses, shorthands, tokens, typographyStyles } from '@fluentui/react-components';\nimport type { ChatInputTokenSlots, ChatInputTokenState } from './ChatInputToken.types';\nimport type { SlotClassNames } from '@fluentui/react-components';\n\nexport const chatInputTokenClassNames: SlotClassNames<ChatInputTokenSlots> = {\n root: 'fai-ChatInputToken',\n};\n\n/**\n * Styles for the root slot\n */\nconst useBaseClassName = makeResetStyles({\n ...typographyStyles.caption1,\n backgroundColor: tokens.colorNeutralBackground3,\n border: `${tokens.strokeWidthThin} solid ${tokens.colorTransparentStroke}`,\n borderRadius: tokens.borderRadiusMedium,\n boxDecorationBreak: 'clone',\n color: tokens.colorNeutralForeground2,\n lineHeight: 'inherit',\n ...shorthands.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 const baseClassName = useBaseClassName();\n state.root.className = mergeClasses(chatInputTokenClassNames.root, baseClassName, state.root.className);\n\n return state;\n};\n"],"names":["chatInputTokenClassNames","boxDecorationBreak","root","useBaseClassName","caption1","state","color","colorNeutralForeground2","lineHeight","mergeClasses","baseClassName","className","shorthands"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAIaA,wBAAAA;eAAAA;;IAYXC,gCAAoB;eAApBA;;;iCAhB0E;AAIrE,MAAMD,2BAAgE;UAC3EE;AACF;AAEA;;CAEC,SAECC,mBAAoBC,IAAAA,8BAAQ,EAAA,WAAA,YAAA;IAAA;IAAA;CAAA;AAI5BH,MAAAA,mCAAoBI,CAAAA;UACpBC,gBAAcC;UACdC,IAAAA,CAAAA,SAAY,GAAAC,IAAAA,6BAAA,EAAAT,yBAAAE,IAAA,EAAAQ,eAAAL,MAAAH,IAAA,CAAAS,SAAA;WACTC;AACL,GAEA,mDAAA"}
@@ -1 +1 @@
1
- {"version":3,"sources":["GhostText.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-components';\n\nexport type GhostTextSlots = {\n root: Slot<'span'>;\n indicator?: Slot<'span'>;\n};\n\n/**\n * GhostText Props\n */\nexport type GhostTextProps = ComponentProps<GhostTextSlots> & {};\n\n/**\n * State used in rendering GhostText\n */\nexport type GhostTextState = ComponentState<GhostTextSlots>;\n// TODO: Remove semicolon from previous line, uncomment next line, and provide union of props to pick from GhostTextProps.\n// & Required<Pick<GhostTextProps, 'propName'>>\n"],"names":[],"rangeMappings":";;;;;;;","mappings":"AAYA;;CAEC;;;;CACD,0HACA;gDACA"}
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;;;;CACD,0HACA;gDACA"}
@@ -8,16 +8,38 @@ Object.defineProperty(exports, "useGhostText_unstable", {
8
8
  return useGhostText_unstable;
9
9
  }
10
10
  });
11
+ const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
12
+ const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
11
13
  const _reactcomponents = require("@fluentui/react-components");
14
+ const _reacttexteditor = require("@fluentui-copilot/react-text-editor");
12
15
  const useGhostText_unstable = (props, ref)=>{
13
- return {
16
+ const { nodeKey, onClick, ...rest } = props;
17
+ const [editor] = (0, _reacttexteditor.useLexicalComposerContext)();
18
+ const handleClick = _react.useCallback((_ev)=>{
19
+ if (!nodeKey) {
20
+ return;
21
+ }
22
+ editor.update(()=>{
23
+ var _node_getPreviousSibling;
24
+ const node = (0, _reacttexteditor.$getNodeByKey)(nodeKey);
25
+ node === null || node === void 0 ? void 0 : (_node_getPreviousSibling = node.getPreviousSibling()) === null || _node_getPreviousSibling === void 0 ? void 0 : _node_getPreviousSibling.selectEnd();
26
+ }, {
27
+ tag: 'historic'
28
+ });
29
+ }, [
30
+ editor,
31
+ nodeKey
32
+ ]);
33
+ const mergedOnClick = (0, _reactcomponents.mergeCallbacks)(handleClick, onClick);
34
+ const state = {
14
35
  components: {
15
36
  root: 'span',
16
37
  indicator: 'span'
17
38
  },
18
39
  root: _reactcomponents.slot.always((0, _reactcomponents.getIntrinsicElementProps)('span', {
19
40
  ref,
20
- ...props
41
+ onClick: mergedOnClick,
42
+ ...rest
21
43
  }), {
22
44
  elementType: 'span'
23
45
  }),
@@ -25,4 +47,5 @@ const useGhostText_unstable = (props, ref)=>{
25
47
  elementType: 'span'
26
48
  })
27
49
  };
50
+ return state;
28
51
  }; //# sourceMappingURL=useGhostText.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["useGhostText.ts"],"sourcesContent":["import type * as React from 'react';\nimport { getIntrinsicElementProps, slot } from '@fluentui/react-components';\nimport type { GhostTextProps, GhostTextState } from './GhostText.types';\n\n// If you add JSX to this file, be sure to change the file type to .tsx\n\n/**\n * Create the state required to render GhostText.\n *\n * The returned state can be modified with hooks such as useGhostTextStyles_unstable,\n * before being passed to renderGhostText_unstable.\n *\n * @param props - props from this instance of GhostText\n * @param ref - reference to root HTMLElement of GhostText\n */\nexport const useGhostText_unstable = (props: GhostTextProps, ref: React.Ref<HTMLSpanElement>): GhostTextState => {\n return {\n components: {\n root: 'span',\n indicator: 'span',\n },\n root: slot.always(\n getIntrinsicElementProps('span', {\n ref,\n ...props,\n }),\n { elementType: 'span' },\n ),\n indicator: slot.optional(props.indicator, { elementType: 'span' }),\n };\n};\n"],"names":["useGhostText_unstable","props","ref","components","root","indicator","elementType"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAgBSA;;;eAAAA;;;iCAfsC;AAe7C,MAAOA,wBAAA,CAAAC,OAAAC;WACLC;oBACEC;kBACAC;uBACF;;mCAGIH,CAAAA,MAAAA,CAAAA,IAAAA,yCAAAA,EAAAA,QAAAA;;eAEFD,KACA;;yBAAsB;;mBAEoBK,qBAAAA,CAAAA,QAAa,CAAAL,MAAAI,SAAA,EAAA;yBAAO;QAClE;IACA"}
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","props","handleClick","editor","update","node","_node_getPreviousSibling","$getNodeByKey","tag","state","components","mergeCallbacks","onClick","root","indicator","slot","mergedOnClick","elementType","optional"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAiBUA;;;eAAAA;;;;iEAjBa;iCACwC;iCAEN;AAcvD,MAAQA,wBAAqBC,CAAAA,OAASC;UACtC,EAEAF,OAAMG,SAEF;UAIAC,CAAAA,OAAOC,GAAAA,IAAAA,0CACL;wBAEEC,OAAAA,WAAAA,CAAAA,CAAAA;sBADMA;;;qBAGD,CAAA;gBAAWC;YAEtB,MACAD,OAAAE,IAAAA,8BAAA,EAAAR;qBAACI,QAAAA,SAAAA,KAAAA,IAAAA,KAAAA,IAAAA,CAAAA,2BAAAA,KAAAA,kBAAAA,EAAAA,MAAAA,QAAAA,6BAAAA,KAAAA,IAAAA,KAAAA,IAAAA,yBAAAA,SAAAA;;YAAgBK,KAAA;QAGnB;OAEA;QAAAL;QAAMM;KAAwB;UAC5BC,gBAAYC,IAAAA,+BAAA,EAAAT,aAAAU;kBACVC;oBACAC;kBACF;uBACMC;;mCAGFH,CAAAA,MAASI,CAAAA,IAAAA,yCAAAA,EAAAA,QAAAA;;qBAGXA;mBAAEC;YAAoB;yBAEbF;;mBAAqDA,qBAAA,CAAAG,QAAA,CAAAjB,MAAAa,SAAA,EAAA;YAClEG,aAAA;QAEA;IACA"}
@@ -62,7 +62,10 @@ class GhostTextNode extends _texteditor.DecoratorNode {
62
62
  return document.createElement('span');
63
63
  }
64
64
  decorate() {
65
- return /*#__PURE__*/ _react.createElement(_GhostText.GhostText, this.__componentProps, this.__content);
65
+ return /*#__PURE__*/ _react.createElement(_GhostText.GhostText, {
66
+ nodeKey: this.getKey(),
67
+ ...this.__componentProps
68
+ }, this.__content);
66
69
  }
67
70
  constructor(id, content, exposeText, componentProps, key){
68
71
  super(key);
@@ -1 +1 @@
1
- {"version":3,"sources":["GhostText.node.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { DecoratorNode } from '@fluentui-copilot/text-editor';\nimport type { EditorConfig, LexicalNode, NodeKey, SerializedLexicalNode, Spread } from '@fluentui-copilot/text-editor';\nimport type { GhostTextProps } from '../../components/GhostText/GhostText.types';\nimport { GhostText } from '../../components/GhostText/GhostText';\n\nexport type SerializedGhostTextNode = Spread<\n {\n content: string;\n id: string;\n componentProps?: GhostTextProps;\n exposeText?: boolean;\n },\n SerializedLexicalNode\n>;\n\nexport class GhostTextNode extends DecoratorNode<JSX.Element | null> {\n __content: string;\n __id: string;\n __allowCommitting?: boolean;\n __componentProps?: GhostTextProps;\n __exposeText?: boolean;\n\n static clone(node: GhostTextNode): GhostTextNode {\n return new GhostTextNode(node.__id, node.__content, node.__exposeText, node.__componentProps, node.__key);\n }\n\n static getType(): 'ghosttext' {\n return 'ghosttext';\n }\n\n static importJSON(serializedNode: SerializedGhostTextNode): GhostTextNode {\n const node = $createGhostTextNode(\n serializedNode.id,\n serializedNode.content,\n serializedNode.exposeText,\n serializedNode.componentProps,\n );\n return node;\n }\n\n exportJSON(): SerializedGhostTextNode {\n return {\n ...super.exportJSON(),\n type: 'ghosttext',\n id: this.__id,\n content: this.__content,\n componentProps: this.__componentProps,\n exposeText: this.__exposeText,\n version: 1,\n };\n }\n\n constructor(id: string, content: string, exposeText?: boolean, componentProps?: GhostTextProps, key?: NodeKey) {\n super(key);\n this.__id = id;\n this.__content = content;\n this.__exposeText = exposeText;\n this.__componentProps = componentProps;\n }\n\n isInline() {\n return true;\n }\n\n isIsolated() {\n return true;\n }\n\n getTextContent(): string {\n return this.__exposeText ? this.__content : '';\n }\n\n updateDOM(prevNode: unknown, dom: HTMLElement, config: EditorConfig): boolean {\n return false;\n }\n\n createDOM(config: EditorConfig): HTMLElement {\n return document.createElement('span');\n }\n\n decorate(): JSX.Element | null {\n return <GhostText {...this.__componentProps}>{this.__content}</GhostText>;\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","constructor","key","__allowCommitting"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAuFgBA,oBAAAA;eAAAA;;IASAC,gBAAAA;eAAAA;;IA/EHC,aAAAA;eAAAA;;;;;iEAjBU;4BAEO;2BAGJ;AAYnB,MAAMA,sBAAsBC,yBAAAA;WAOjCC,MAAOA,IAAMC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AEO,SAAST,qBACdc,EAAU,EACVC,OAAe,EACfC,UAAoB,EACpBC,cAA+B;WAE/B,IAAOf,cAAIA,IAAcY,SAAIC,YAASC;AACxC;AAEO,SAASf,iBAAiBI,IAAoC;WACnEA,gBAAOA;AACT"}
1
+ {"version":3,"sources":["GhostText.node.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { DecoratorNode } from '@fluentui-copilot/text-editor';\nimport type { EditorConfig, LexicalNode, NodeKey, SerializedLexicalNode, Spread } from '@fluentui-copilot/text-editor';\nimport type { GhostTextProps } from '../../components/GhostText/GhostText.types';\nimport { GhostText } from '../../components/GhostText/GhostText';\n\nexport type SerializedGhostTextNode = Spread<\n {\n content: string;\n id: string;\n componentProps?: GhostTextProps;\n exposeText?: boolean;\n },\n SerializedLexicalNode\n>;\n\nexport class GhostTextNode extends DecoratorNode<JSX.Element | null> {\n __content: string;\n __id: string;\n __allowCommitting?: boolean;\n __componentProps?: GhostTextProps;\n __exposeText?: boolean;\n\n static clone(node: GhostTextNode): GhostTextNode {\n return new GhostTextNode(node.__id, node.__content, node.__exposeText, node.__componentProps, node.__key);\n }\n\n static getType(): 'ghosttext' {\n return 'ghosttext';\n }\n\n static importJSON(serializedNode: SerializedGhostTextNode): GhostTextNode {\n const node = $createGhostTextNode(\n serializedNode.id,\n serializedNode.content,\n serializedNode.exposeText,\n serializedNode.componentProps,\n );\n return node;\n }\n\n exportJSON(): SerializedGhostTextNode {\n return {\n ...super.exportJSON(),\n type: 'ghosttext',\n id: this.__id,\n content: this.__content,\n componentProps: this.__componentProps,\n exposeText: this.__exposeText,\n version: 1,\n };\n }\n\n constructor(id: string, content: string, exposeText?: boolean, componentProps?: GhostTextProps, key?: NodeKey) {\n super(key);\n this.__id = id;\n this.__content = content;\n this.__exposeText = exposeText;\n this.__componentProps = componentProps;\n }\n\n isInline() {\n return true;\n }\n\n isIsolated() {\n return true;\n }\n\n getTextContent(): string {\n return this.__exposeText ? this.__content : '';\n }\n\n updateDOM(prevNode: unknown, dom: HTMLElement, config: EditorConfig): boolean {\n return false;\n }\n\n createDOM(config: EditorConfig): HTMLElement {\n return document.createElement('span');\n }\n\n decorate(): JSX.Element | null {\n return (\n <GhostText nodeKey={this.getKey()} {...this.__componentProps}>\n {this.__content}\n </GhostText>\n );\n }\n}\n\nexport function $createGhostTextNode(\n id: string,\n content: string,\n exposeText?: boolean,\n componentProps?: GhostTextProps,\n): GhostTextNode {\n return new GhostTextNode(id, content, exposeText, componentProps);\n}\n\nexport function $isGhostTextNode(node: LexicalNode | null | undefined): node is GhostTextNode {\n return node instanceof GhostTextNode;\n}\n"],"names":["$createGhostTextNode","$isGhostTextNode","GhostTextNode","DecoratorNode","clone","node","__id","__content","__exposeText","__componentProps","__key","getType","importJSON","serializedNode","id","content","exposeText","componentProps","exportJSON","type","version","isInline","isIsolated","getTextContent","updateDOM","prevNode","dom","config","createDOM","document","createElement","decorate","React","GhostText","nodeKey","getKey","constructor","key","__allowCommitting"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IA2FgBA,oBAAAA;eAAAA;;IASAC,gBAAAA;eAAAA;;IAnFHC,aAAAA;eAAAA;;;;;iEAjBU;4BAEO;2BAGJ;AAYnB,MAAMA,sBAAsBC,yBAAAA;WAOjCC,MAAOA,IAAMC,EAAmB;eAC9B,IAAOH,cAAIA,KAAcG,IAAKC,EAAAA,KAAMD,SAAKE,EAAAA,KAAWF,YAAKG,EAAAA,KAAcH,gBAAKI,EAAAA,KAAkBJ,KAAKK;;WAGrGC,UAAOA;eACL;;WAGFC,WAAOA,cAAWC,EAAuC;cACvDR,OAAMA,qBAAOL,eACXa,EAAAA,EAAeC,eACfD,OAAeE,EAAAA,eACfF,UAAeG,EAAAA,eACfH,cAAeI;eAEjBZ;;iBAGFa;eACE;oBACE,CAAGA,YAAMA;kBACTC;oBACAL,CAAAA,IAAI;qBACJC,IAAAA,CAAAA,SAAcR;4BACdU,IAAAA,CAAAA,gBAAqBR;wBACrBO,IAAAA,CAAAA,YAAiBR;qBACjBY;;;eAYJC;eACE;;iBAGFC;eACE;;qBAGFC;eACE,IAAO,CAAAf,YAAKA,GAAAA,IAAe,CAAAD,SAAKA,GAAAA;;cAGlCiB,QAAUC,EAAiBC,GAAEA,EAAgBC,MAAEA,EAAoB;eACjE;;cAGFC,MAAUD,EAAoB;eAC5BE,SAAOA,aAASC,CAAAA;;eAGlBC;eACE,WAAA,GAAAC,OACEF,aAAA,CAAAG,oBAACA,EAAAA;qBAAUC,IAAAA,CAAAA,MAAcC;mBAAW,CAAA1B,gBAAQA;eACzC,CAAAF,SAAKA;;gBA/BZ6B,EAAYtB,EAAUC,OAAEA,EAAeC,UAAEA,EAAoBC,cAAEA,EAA+BoB,GAAEA,CAAa;aAC3G,CAAAA;8BArCF9B,EAAAA,IAAAA,EAAAA,aAAAA,KAAAA;8BACAD,EAAAA,IAAAA,EAAAA,QAAAA,KAAAA;8BACAgC,EAAAA,IAAAA,EAAAA,qBAAAA,KAAAA;8BACA7B,EAAAA,IAAAA,EAAAA,oBAAAA,KAAAA;8BACAD,EAAAA,IAAAA,EAAAA,gBAAAA,KAAAA;YAkCE,CAAAF,IAAKA,GAAAA;YACL,CAAAC,SAAKA,GAAAA;YACL,CAAAC,YAAKA,GAAAA;YACL,CAAAC,gBAAKA,GAAAA;;AA8BT;AAEO,SAAST,qBACdc,EAAU,EACVC,OAAe,EACfC,UAAoB,EACpBC,cAA+B;WAE/B,IAAOf,cAAIA,IAAcY,SAAIC,YAASC;AACxC;AAEO,SAASf,iBAAiBI,IAAoC;WACnEA,gBAAOA;AACT"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluentui-copilot/react-chat-input-plugins",
3
- "version": "0.0.4",
3
+ "version": "0.0.6",
4
4
  "description": "A Fluent AI package for React-based ChatInput plugins.",
5
5
  "main": "lib-commonjs/index.js",
6
6
  "module": "lib/index.js",
@@ -12,15 +12,15 @@
12
12
  },
13
13
  "license": "MIT",
14
14
  "dependencies": {
15
- "@fluentui-copilot/chat-input-plugins": "^0.0.4",
15
+ "@fluentui-copilot/chat-input-plugins": "^0.0.6",
16
16
  "@fluentui-copilot/react-text-editor": "^0.1.5",
17
17
  "@fluentui-copilot/text-editor": "^0.0.3",
18
18
  "@swc/helpers": "^0.5.1"
19
19
  },
20
20
  "peerDependencies": {
21
- "@fluentui/react-components": ">=9.49.0 <10.0.0",
22
- "@fluentui/react-jsx-runtime": ">=9.0.36 <10.0.0",
23
- "@fluentui/react-utilities": ">=9.18.7 <10.0.0",
21
+ "@fluentui/react-components": ">=9.49.2 <10.0.0",
22
+ "@fluentui/react-jsx-runtime": ">=9.0.37 <10.0.0",
23
+ "@fluentui/react-utilities": ">=9.18.8 <10.0.0",
24
24
  "@types/react": ">=16.14.0 <19.0.0",
25
25
  "@types/react-dom": ">=16.9.8 <19.0.0",
26
26
  "react": ">=16.14.0 <19.0.0",