@atlaskit/editor-plugin-type-ahead 0.4.0 → 0.6.0

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.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @atlaskit/editor-plugin-type-ahead
2
2
 
3
+ ## 0.6.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#41459](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/41459) [`9874d0f70b0`](https://bitbucket.org/atlassian/atlassian-frontend/commits/9874d0f70b0) - [ED-20003] TypeAhead extraction: Replace the mobile view-subscription with proper API
8
+
9
+ ## 0.5.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [#41143](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/41143) [`7d6dfe2befa`](https://bitbucket.org/atlassian/atlassian-frontend/commits/7d6dfe2befa) - [ED-20003] Replace TyepAhead API for Editor Plugin Injection API
14
+
3
15
  ## 0.4.0
4
16
 
5
17
  ### Minor Changes
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.TYPE_AHEAD_POPUP_CONTENT_CLASS = exports.TYPE_AHEAD_DECORATION_KEY = exports.TYPE_AHEAD_DECORATION_ELEMENT_ID = exports.TYPE_AHEAD_DECORATION_DATA_ATTRIBUTE = exports.CloseSelectionOptions = void 0;
7
+ var TYPE_AHEAD_DECORATION_KEY = exports.TYPE_AHEAD_DECORATION_KEY = 'typeahead_decoration_key';
8
+ var TYPE_AHEAD_DECORATION_DATA_ATTRIBUTE = exports.TYPE_AHEAD_DECORATION_DATA_ATTRIBUTE = 'typeaheadDecoration';
9
+ var TYPE_AHEAD_POPUP_CONTENT_CLASS = exports.TYPE_AHEAD_POPUP_CONTENT_CLASS = 'fabric-editor-typeahead';
10
+ var TYPE_AHEAD_DECORATION_ELEMENT_ID = exports.TYPE_AHEAD_DECORATION_ELEMENT_ID = 'typeahaed_decoration_element_id';
11
+ var CloseSelectionOptions = exports.CloseSelectionOptions = /*#__PURE__*/function (CloseSelectionOptions) {
12
+ CloseSelectionOptions["BEFORE_TEXT_INSERTED"] = "BEFORE_TEXT_INSERTED";
13
+ CloseSelectionOptions["AFTER_TEXT_INSERTED"] = "AFTER_TEXT_INSERTED";
14
+ return CloseSelectionOptions;
15
+ }({});
@@ -0,0 +1,9 @@
1
+ export const TYPE_AHEAD_DECORATION_KEY = 'typeahead_decoration_key';
2
+ export const TYPE_AHEAD_DECORATION_DATA_ATTRIBUTE = 'typeaheadDecoration';
3
+ export const TYPE_AHEAD_POPUP_CONTENT_CLASS = 'fabric-editor-typeahead';
4
+ export const TYPE_AHEAD_DECORATION_ELEMENT_ID = 'typeahaed_decoration_element_id';
5
+ export let CloseSelectionOptions = /*#__PURE__*/function (CloseSelectionOptions) {
6
+ CloseSelectionOptions["BEFORE_TEXT_INSERTED"] = "BEFORE_TEXT_INSERTED";
7
+ CloseSelectionOptions["AFTER_TEXT_INSERTED"] = "AFTER_TEXT_INSERTED";
8
+ return CloseSelectionOptions;
9
+ }({});
@@ -0,0 +1,9 @@
1
+ export var TYPE_AHEAD_DECORATION_KEY = 'typeahead_decoration_key';
2
+ export var TYPE_AHEAD_DECORATION_DATA_ATTRIBUTE = 'typeaheadDecoration';
3
+ export var TYPE_AHEAD_POPUP_CONTENT_CLASS = 'fabric-editor-typeahead';
4
+ export var TYPE_AHEAD_DECORATION_ELEMENT_ID = 'typeahaed_decoration_element_id';
5
+ export var CloseSelectionOptions = /*#__PURE__*/function (CloseSelectionOptions) {
6
+ CloseSelectionOptions["BEFORE_TEXT_INSERTED"] = "BEFORE_TEXT_INSERTED";
7
+ CloseSelectionOptions["AFTER_TEXT_INSERTED"] = "AFTER_TEXT_INSERTED";
8
+ return CloseSelectionOptions;
9
+ }({});
@@ -0,0 +1,8 @@
1
+ export declare const TYPE_AHEAD_DECORATION_KEY = "typeahead_decoration_key";
2
+ export declare const TYPE_AHEAD_DECORATION_DATA_ATTRIBUTE = "typeaheadDecoration";
3
+ export declare const TYPE_AHEAD_POPUP_CONTENT_CLASS = "fabric-editor-typeahead";
4
+ export declare const TYPE_AHEAD_DECORATION_ELEMENT_ID = "typeahaed_decoration_element_id";
5
+ export declare enum CloseSelectionOptions {
6
+ BEFORE_TEXT_INSERTED = "BEFORE_TEXT_INSERTED",
7
+ AFTER_TEXT_INSERTED = "AFTER_TEXT_INSERTED"
8
+ }
@@ -1,30 +1,109 @@
1
1
  import type { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
2
2
  import type { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
3
- import type { EditorCommand, NextEditorPlugin, TypeAheadHandler } from '@atlaskit/editor-common/types';
4
- import type { EditorState } from '@atlaskit/editor-prosemirror/state';
5
- export type TypeAheadInputMethod = INPUT_METHOD.INSERT_MENU | INPUT_METHOD.KEYBOARD | INPUT_METHOD.QUICK_INSERT | INPUT_METHOD.TOOLBAR;
6
- type Props = {
3
+ import type { SelectItemMode } from '@atlaskit/editor-common/type-ahead';
4
+ import type { Command, NextEditorPlugin, OptionalPlugin, TypeAheadForceSelect, TypeAheadHandler, TypeAheadInsert, TypeAheadItem, TypeAheadItemRenderProps, TypeAheadSelectItem, TypeAheadStats, UiComponentFactoryParams } from '@atlaskit/editor-common/types';
5
+ import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
6
+ import type { EditorState, ReadonlyTransaction, Transaction } from '@atlaskit/editor-prosemirror/state';
7
+ import type { DecorationSet } from '@atlaskit/editor-prosemirror/view';
8
+ import type { CloseSelectionOptions } from './constants';
9
+ export type { TypeAheadStats, TypeAheadItemRenderProps, TypeAheadInsert, TypeAheadSelectItem, TypeAheadItem, TypeAheadForceSelect, TypeAheadHandler, };
10
+ export type OnSelectItem = (props: {
11
+ index: number;
12
+ item: TypeAheadItem;
13
+ }) => void;
14
+ export interface TypeAheadStatsSerializable extends TypeAheadStats {
15
+ serialize: () => TypeAheadStats;
16
+ }
17
+ export interface TypeAheadStatsModifier extends TypeAheadStatsSerializable {
18
+ increaseArrowUp: () => void;
19
+ increaseArrowDown: () => void;
20
+ }
21
+ export interface TypeAheadStatsMobileModifier extends TypeAheadStatsSerializable {
22
+ resetTime: () => void;
23
+ closeTime: () => void;
24
+ }
25
+ export type TypeAheadPluginState = {
26
+ decorationSet: DecorationSet;
27
+ decorationElement: HTMLElement | null;
28
+ typeAheadHandlers: Array<TypeAheadHandler>;
29
+ query: string;
30
+ items: Array<TypeAheadItem>;
31
+ triggerHandler?: TypeAheadHandler;
32
+ selectedIndex: number;
33
+ stats: TypeAheadStatsSerializable | null;
34
+ inputMethod: TypeAheadInputMethod | null;
35
+ };
36
+ export type OnInsertSelectedItemProps = {
37
+ mode: SelectItemMode;
38
+ index: number;
39
+ query: string;
40
+ };
41
+ export type OnItemMatchProps = {
42
+ mode: SelectItemMode;
43
+ query: string;
44
+ };
45
+ export type OnInsertSelectedItem = (props: OnInsertSelectedItemProps) => void;
46
+ export type OnItemMatch = (props: OnItemMatchProps) => boolean;
47
+ export type OnTextInsertProps = {
48
+ forceFocusOnEditor: boolean;
49
+ setSelectionAt: CloseSelectionOptions;
50
+ text: string;
51
+ };
52
+ export type OnTextInsert = (props: OnTextInsertProps) => void;
53
+ export type InsertionTransactionMeta = (editorState: EditorState) => Transaction | false;
54
+ type PopupMountPoints = Pick<UiComponentFactoryParams, 'popupsMountPoint' | 'popupsBoundariesElement' | 'popupsScrollableElement'>;
55
+ export type PopupMountPointReference = Record<'current', PopupMountPoints | null>;
56
+ export type CreateTypeAheadDecorations = (tr: ReadonlyTransaction, options: {
7
57
  triggerHandler: TypeAheadHandler;
8
58
  inputMethod: TypeAheadInputMethod;
9
- query?: string;
59
+ reopenQuery?: string;
60
+ }) => {
61
+ decorationSet: DecorationSet;
62
+ decorationElement: HTMLElement | null;
63
+ stats: TypeAheadStatsSerializable | null;
10
64
  };
65
+ export type RemoveTypeAheadDecorations = (decorationSet?: DecorationSet) => boolean;
66
+ export type TypeAheadInputMethod = INPUT_METHOD.INSERT_MENU | INPUT_METHOD.KEYBOARD | INPUT_METHOD.QUICK_INSERT | INPUT_METHOD.TOOLBAR;
11
67
  export type TypeAheadPluginOptions = {
12
68
  isMobile?: boolean;
13
69
  createAnalyticsEvent?: CreateUIAnalyticsEvent;
14
70
  };
15
- type OpenTypeAheadAtCursorType = (props: Props) => EditorCommand;
71
+ type OpenTypeAheadProps = {
72
+ triggerHandler: TypeAheadHandler;
73
+ inputMethod: TypeAheadInputMethod;
74
+ query?: string;
75
+ };
76
+ type InsertTypeAheadItemProps = {
77
+ triggerHandler: TypeAheadHandler;
78
+ contentItem: TypeAheadItem;
79
+ query: string;
80
+ sourceListItem: TypeAheadItem[];
81
+ mode?: SelectItemMode;
82
+ };
83
+ type CloseTypeAheadProps = {
84
+ insertCurrentQueryAsRawText: boolean;
85
+ attachCommand?: Command;
86
+ };
16
87
  /**
17
88
  * Type ahead plugin to be added to an `EditorPresetBuilder` and used with `ComposableEditor`
18
89
  * from `@atlaskit/editor-core`.
19
90
  */
20
91
  export type TypeAheadPlugin = NextEditorPlugin<'typeAhead', {
21
92
  pluginConfiguration: TypeAheadPluginOptions | undefined;
93
+ dependencies: [OptionalPlugin<AnalyticsPlugin>];
94
+ sharedState: {
95
+ query: string;
96
+ isOpen: boolean;
97
+ isAllowed: boolean;
98
+ currentHandler?: TypeAheadHandler;
99
+ };
22
100
  actions: {
23
101
  isOpen: (editorState: EditorState) => boolean;
24
102
  isAllowed: (editorState: EditorState) => boolean;
25
- };
26
- commands: {
27
- openTypeAheadAtCursor: OpenTypeAheadAtCursorType;
103
+ insert: (props: InsertTypeAheadItemProps) => boolean;
104
+ findHandlerByTrigger: (trigger: string) => TypeAheadHandler | null;
105
+ open: (props: OpenTypeAheadProps) => boolean;
106
+ close: (props: CloseTypeAheadProps) => boolean;
107
+ openAtTransaction: (props: OpenTypeAheadProps) => (tr: Transaction) => boolean;
28
108
  };
29
109
  }>;
30
- export {};
@@ -0,0 +1,8 @@
1
+ export declare const TYPE_AHEAD_DECORATION_KEY = "typeahead_decoration_key";
2
+ export declare const TYPE_AHEAD_DECORATION_DATA_ATTRIBUTE = "typeaheadDecoration";
3
+ export declare const TYPE_AHEAD_POPUP_CONTENT_CLASS = "fabric-editor-typeahead";
4
+ export declare const TYPE_AHEAD_DECORATION_ELEMENT_ID = "typeahaed_decoration_element_id";
5
+ export declare enum CloseSelectionOptions {
6
+ BEFORE_TEXT_INSERTED = "BEFORE_TEXT_INSERTED",
7
+ AFTER_TEXT_INSERTED = "AFTER_TEXT_INSERTED"
8
+ }
@@ -1,30 +1,111 @@
1
1
  import type { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
2
2
  import type { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
3
- import type { EditorCommand, NextEditorPlugin, TypeAheadHandler } from '@atlaskit/editor-common/types';
4
- import type { EditorState } from '@atlaskit/editor-prosemirror/state';
5
- export type TypeAheadInputMethod = INPUT_METHOD.INSERT_MENU | INPUT_METHOD.KEYBOARD | INPUT_METHOD.QUICK_INSERT | INPUT_METHOD.TOOLBAR;
6
- type Props = {
3
+ import type { SelectItemMode } from '@atlaskit/editor-common/type-ahead';
4
+ import type { Command, NextEditorPlugin, OptionalPlugin, TypeAheadForceSelect, TypeAheadHandler, TypeAheadInsert, TypeAheadItem, TypeAheadItemRenderProps, TypeAheadSelectItem, TypeAheadStats, UiComponentFactoryParams } from '@atlaskit/editor-common/types';
5
+ import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
6
+ import type { EditorState, ReadonlyTransaction, Transaction } from '@atlaskit/editor-prosemirror/state';
7
+ import type { DecorationSet } from '@atlaskit/editor-prosemirror/view';
8
+ import type { CloseSelectionOptions } from './constants';
9
+ export type { TypeAheadStats, TypeAheadItemRenderProps, TypeAheadInsert, TypeAheadSelectItem, TypeAheadItem, TypeAheadForceSelect, TypeAheadHandler, };
10
+ export type OnSelectItem = (props: {
11
+ index: number;
12
+ item: TypeAheadItem;
13
+ }) => void;
14
+ export interface TypeAheadStatsSerializable extends TypeAheadStats {
15
+ serialize: () => TypeAheadStats;
16
+ }
17
+ export interface TypeAheadStatsModifier extends TypeAheadStatsSerializable {
18
+ increaseArrowUp: () => void;
19
+ increaseArrowDown: () => void;
20
+ }
21
+ export interface TypeAheadStatsMobileModifier extends TypeAheadStatsSerializable {
22
+ resetTime: () => void;
23
+ closeTime: () => void;
24
+ }
25
+ export type TypeAheadPluginState = {
26
+ decorationSet: DecorationSet;
27
+ decorationElement: HTMLElement | null;
28
+ typeAheadHandlers: Array<TypeAheadHandler>;
29
+ query: string;
30
+ items: Array<TypeAheadItem>;
31
+ triggerHandler?: TypeAheadHandler;
32
+ selectedIndex: number;
33
+ stats: TypeAheadStatsSerializable | null;
34
+ inputMethod: TypeAheadInputMethod | null;
35
+ };
36
+ export type OnInsertSelectedItemProps = {
37
+ mode: SelectItemMode;
38
+ index: number;
39
+ query: string;
40
+ };
41
+ export type OnItemMatchProps = {
42
+ mode: SelectItemMode;
43
+ query: string;
44
+ };
45
+ export type OnInsertSelectedItem = (props: OnInsertSelectedItemProps) => void;
46
+ export type OnItemMatch = (props: OnItemMatchProps) => boolean;
47
+ export type OnTextInsertProps = {
48
+ forceFocusOnEditor: boolean;
49
+ setSelectionAt: CloseSelectionOptions;
50
+ text: string;
51
+ };
52
+ export type OnTextInsert = (props: OnTextInsertProps) => void;
53
+ export type InsertionTransactionMeta = (editorState: EditorState) => Transaction | false;
54
+ type PopupMountPoints = Pick<UiComponentFactoryParams, 'popupsMountPoint' | 'popupsBoundariesElement' | 'popupsScrollableElement'>;
55
+ export type PopupMountPointReference = Record<'current', PopupMountPoints | null>;
56
+ export type CreateTypeAheadDecorations = (tr: ReadonlyTransaction, options: {
7
57
  triggerHandler: TypeAheadHandler;
8
58
  inputMethod: TypeAheadInputMethod;
9
- query?: string;
59
+ reopenQuery?: string;
60
+ }) => {
61
+ decorationSet: DecorationSet;
62
+ decorationElement: HTMLElement | null;
63
+ stats: TypeAheadStatsSerializable | null;
10
64
  };
65
+ export type RemoveTypeAheadDecorations = (decorationSet?: DecorationSet) => boolean;
66
+ export type TypeAheadInputMethod = INPUT_METHOD.INSERT_MENU | INPUT_METHOD.KEYBOARD | INPUT_METHOD.QUICK_INSERT | INPUT_METHOD.TOOLBAR;
11
67
  export type TypeAheadPluginOptions = {
12
68
  isMobile?: boolean;
13
69
  createAnalyticsEvent?: CreateUIAnalyticsEvent;
14
70
  };
15
- type OpenTypeAheadAtCursorType = (props: Props) => EditorCommand;
71
+ type OpenTypeAheadProps = {
72
+ triggerHandler: TypeAheadHandler;
73
+ inputMethod: TypeAheadInputMethod;
74
+ query?: string;
75
+ };
76
+ type InsertTypeAheadItemProps = {
77
+ triggerHandler: TypeAheadHandler;
78
+ contentItem: TypeAheadItem;
79
+ query: string;
80
+ sourceListItem: TypeAheadItem[];
81
+ mode?: SelectItemMode;
82
+ };
83
+ type CloseTypeAheadProps = {
84
+ insertCurrentQueryAsRawText: boolean;
85
+ attachCommand?: Command;
86
+ };
16
87
  /**
17
88
  * Type ahead plugin to be added to an `EditorPresetBuilder` and used with `ComposableEditor`
18
89
  * from `@atlaskit/editor-core`.
19
90
  */
20
91
  export type TypeAheadPlugin = NextEditorPlugin<'typeAhead', {
21
92
  pluginConfiguration: TypeAheadPluginOptions | undefined;
93
+ dependencies: [
94
+ OptionalPlugin<AnalyticsPlugin>
95
+ ];
96
+ sharedState: {
97
+ query: string;
98
+ isOpen: boolean;
99
+ isAllowed: boolean;
100
+ currentHandler?: TypeAheadHandler;
101
+ };
22
102
  actions: {
23
103
  isOpen: (editorState: EditorState) => boolean;
24
104
  isAllowed: (editorState: EditorState) => boolean;
25
- };
26
- commands: {
27
- openTypeAheadAtCursor: OpenTypeAheadAtCursorType;
105
+ insert: (props: InsertTypeAheadItemProps) => boolean;
106
+ findHandlerByTrigger: (trigger: string) => TypeAheadHandler | null;
107
+ open: (props: OpenTypeAheadProps) => boolean;
108
+ close: (props: CloseTypeAheadProps) => boolean;
109
+ openAtTransaction: (props: OpenTypeAheadProps) => (tr: Transaction) => boolean;
28
110
  };
29
111
  }>;
30
- export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-type-ahead",
3
- "version": "0.4.0",
3
+ "version": "0.6.0",
4
4
  "description": "Type-ahead plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -31,7 +31,8 @@
31
31
  ".": "./src/index.ts"
32
32
  },
33
33
  "dependencies": {
34
- "@atlaskit/editor-common": "^76.1.0",
34
+ "@atlaskit/editor-common": "^76.10.0",
35
+ "@atlaskit/editor-plugin-analytics": "^0.2.0",
35
36
  "@atlaskit/editor-prosemirror": "1.1.0",
36
37
  "@babel/runtime": "^7.0.0"
37
38
  },
package/report.api.md CHANGED
@@ -15,18 +15,35 @@
15
15
  <!--SECTION START: Main Entry Types-->
16
16
 
17
17
  ```ts
18
+ import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
19
+ import type { Command } from '@atlaskit/editor-common/types';
18
20
  import type { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
19
- import type { EditorCommand } from '@atlaskit/editor-common/types';
20
21
  import type { EditorState } from '@atlaskit/editor-prosemirror/state';
21
22
  import type { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
22
23
  import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
24
+ import type { OptionalPlugin } from '@atlaskit/editor-common/types';
25
+ import type { SelectItemMode } from '@atlaskit/editor-common/type-ahead';
26
+ import type { Transaction } from '@atlaskit/editor-prosemirror/state';
23
27
  import type { TypeAheadHandler } from '@atlaskit/editor-common/types';
28
+ import type { TypeAheadItem } from '@atlaskit/editor-common/types';
24
29
 
25
30
  // @public (undocumented)
26
- type OpenTypeAheadAtCursorType = (props: Props) => EditorCommand;
31
+ type CloseTypeAheadProps = {
32
+ insertCurrentQueryAsRawText: boolean;
33
+ attachCommand?: Command;
34
+ };
27
35
 
28
36
  // @public (undocumented)
29
- type Props = {
37
+ type InsertTypeAheadItemProps = {
38
+ triggerHandler: TypeAheadHandler;
39
+ contentItem: TypeAheadItem;
40
+ query: string;
41
+ sourceListItem: TypeAheadItem[];
42
+ mode?: SelectItemMode;
43
+ };
44
+
45
+ // @public (undocumented)
46
+ type OpenTypeAheadProps = {
30
47
  triggerHandler: TypeAheadHandler;
31
48
  inputMethod: TypeAheadInputMethod;
32
49
  query?: string;
@@ -44,12 +61,23 @@ export type TypeAheadPlugin = NextEditorPlugin<
44
61
  'typeAhead',
45
62
  {
46
63
  pluginConfiguration: TypeAheadPluginOptions | undefined;
64
+ dependencies: [OptionalPlugin<AnalyticsPlugin>];
65
+ sharedState: {
66
+ query: string;
67
+ isOpen: boolean;
68
+ isAllowed: boolean;
69
+ currentHandler?: TypeAheadHandler;
70
+ };
47
71
  actions: {
48
72
  isOpen: (editorState: EditorState) => boolean;
49
73
  isAllowed: (editorState: EditorState) => boolean;
50
- };
51
- commands: {
52
- openTypeAheadAtCursor: OpenTypeAheadAtCursorType;
74
+ insert: (props: InsertTypeAheadItemProps) => boolean;
75
+ findHandlerByTrigger: (trigger: string) => TypeAheadHandler | null;
76
+ open: (props: OpenTypeAheadProps) => boolean;
77
+ close: (props: CloseTypeAheadProps) => boolean;
78
+ openAtTransaction: (
79
+ props: OpenTypeAheadProps,
80
+ ) => (tr: Transaction) => boolean;
53
81
  };
54
82
  }
55
83
  >;
@@ -4,18 +4,35 @@
4
4
 
5
5
  ```ts
6
6
 
7
+ import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
8
+ import type { Command } from '@atlaskit/editor-common/types';
7
9
  import type { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
8
- import type { EditorCommand } from '@atlaskit/editor-common/types';
9
10
  import type { EditorState } from '@atlaskit/editor-prosemirror/state';
10
11
  import type { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
11
12
  import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
13
+ import type { OptionalPlugin } from '@atlaskit/editor-common/types';
14
+ import type { SelectItemMode } from '@atlaskit/editor-common/type-ahead';
15
+ import type { Transaction } from '@atlaskit/editor-prosemirror/state';
12
16
  import type { TypeAheadHandler } from '@atlaskit/editor-common/types';
17
+ import type { TypeAheadItem } from '@atlaskit/editor-common/types';
13
18
 
14
19
  // @public (undocumented)
15
- type OpenTypeAheadAtCursorType = (props: Props) => EditorCommand;
20
+ type CloseTypeAheadProps = {
21
+ insertCurrentQueryAsRawText: boolean;
22
+ attachCommand?: Command;
23
+ };
16
24
 
17
25
  // @public (undocumented)
18
- type Props = {
26
+ type InsertTypeAheadItemProps = {
27
+ triggerHandler: TypeAheadHandler;
28
+ contentItem: TypeAheadItem;
29
+ query: string;
30
+ sourceListItem: TypeAheadItem[];
31
+ mode?: SelectItemMode;
32
+ };
33
+
34
+ // @public (undocumented)
35
+ type OpenTypeAheadProps = {
19
36
  triggerHandler: TypeAheadHandler;
20
37
  inputMethod: TypeAheadInputMethod;
21
38
  query?: string;
@@ -27,12 +44,21 @@ export type TypeAheadInputMethod = INPUT_METHOD.INSERT_MENU | INPUT_METHOD.KEYBO
27
44
  // @public
28
45
  export type TypeAheadPlugin = NextEditorPlugin<'typeAhead', {
29
46
  pluginConfiguration: TypeAheadPluginOptions | undefined;
47
+ dependencies: [OptionalPlugin<AnalyticsPlugin>];
48
+ sharedState: {
49
+ query: string;
50
+ isOpen: boolean;
51
+ isAllowed: boolean;
52
+ currentHandler?: TypeAheadHandler;
53
+ };
30
54
  actions: {
31
55
  isOpen: (editorState: EditorState) => boolean;
32
56
  isAllowed: (editorState: EditorState) => boolean;
33
- };
34
- commands: {
35
- openTypeAheadAtCursor: OpenTypeAheadAtCursorType;
57
+ insert: (props: InsertTypeAheadItemProps) => boolean;
58
+ findHandlerByTrigger: (trigger: string) => TypeAheadHandler | null;
59
+ open: (props: OpenTypeAheadProps) => boolean;
60
+ close: (props: CloseTypeAheadProps) => boolean;
61
+ openAtTransaction: (props: OpenTypeAheadProps) => (tr: Transaction) => boolean;
36
62
  };
37
63
  }>;
38
64