@atlaskit/editor-common 82.14.0 → 83.0.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.
Files changed (180) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/dist/cjs/hooks/useSharedPluginState.js +1 -4
  3. package/dist/cjs/i18n/cs.js +2 -1
  4. package/dist/cjs/i18n/da.js +2 -1
  5. package/dist/cjs/i18n/de.js +2 -1
  6. package/dist/cjs/i18n/en.js +1 -0
  7. package/dist/cjs/i18n/en_GB.js +1 -0
  8. package/dist/cjs/i18n/en_ZZ.js +1 -0
  9. package/dist/cjs/i18n/es.js +2 -1
  10. package/dist/cjs/i18n/fi.js +2 -1
  11. package/dist/cjs/i18n/fr.js +2 -1
  12. package/dist/cjs/i18n/hu.js +2 -1
  13. package/dist/cjs/i18n/it.js +2 -1
  14. package/dist/cjs/i18n/ja.js +2 -1
  15. package/dist/cjs/i18n/ko.js +2 -1
  16. package/dist/cjs/i18n/nb.js +2 -1
  17. package/dist/cjs/i18n/nl.js +2 -1
  18. package/dist/cjs/i18n/pl.js +2 -1
  19. package/dist/cjs/i18n/pt_BR.js +2 -1
  20. package/dist/cjs/i18n/ru.js +2 -1
  21. package/dist/cjs/i18n/sv.js +2 -1
  22. package/dist/cjs/i18n/th.js +7 -3
  23. package/dist/cjs/i18n/tr.js +4 -3
  24. package/dist/cjs/i18n/uk.js +2 -1
  25. package/dist/cjs/i18n/vi.js +2 -1
  26. package/dist/cjs/i18n/zh.js +3 -2
  27. package/dist/cjs/i18n/zh_TW.js +2 -1
  28. package/dist/cjs/monitoring/error.js +1 -1
  29. package/dist/cjs/preset/builder.js +491 -0
  30. package/dist/cjs/styles/shared/annotation.js +20 -18
  31. package/dist/cjs/types/index.js +6 -1
  32. package/dist/cjs/ui/DropList/index.js +1 -1
  33. package/dist/cjs/ui/Mention/mention-with-profilecard.js +3 -1
  34. package/dist/es2019/hooks/useSharedPluginState.js +1 -6
  35. package/dist/es2019/i18n/cs.js +2 -1
  36. package/dist/es2019/i18n/da.js +2 -1
  37. package/dist/es2019/i18n/de.js +2 -1
  38. package/dist/es2019/i18n/en.js +1 -0
  39. package/dist/es2019/i18n/en_GB.js +1 -0
  40. package/dist/es2019/i18n/en_ZZ.js +1 -0
  41. package/dist/es2019/i18n/es.js +2 -1
  42. package/dist/es2019/i18n/fi.js +2 -1
  43. package/dist/es2019/i18n/fr.js +2 -1
  44. package/dist/es2019/i18n/hu.js +2 -1
  45. package/dist/es2019/i18n/it.js +2 -1
  46. package/dist/es2019/i18n/ja.js +2 -1
  47. package/dist/es2019/i18n/ko.js +2 -1
  48. package/dist/es2019/i18n/nb.js +2 -1
  49. package/dist/es2019/i18n/nl.js +2 -1
  50. package/dist/es2019/i18n/pl.js +2 -1
  51. package/dist/es2019/i18n/pt_BR.js +2 -1
  52. package/dist/es2019/i18n/ru.js +2 -1
  53. package/dist/es2019/i18n/sv.js +2 -1
  54. package/dist/es2019/i18n/th.js +7 -3
  55. package/dist/es2019/i18n/tr.js +4 -3
  56. package/dist/es2019/i18n/uk.js +2 -1
  57. package/dist/es2019/i18n/vi.js +2 -1
  58. package/dist/es2019/i18n/zh.js +3 -2
  59. package/dist/es2019/i18n/zh_TW.js +2 -1
  60. package/dist/es2019/monitoring/error.js +1 -1
  61. package/dist/es2019/preset/builder.js +528 -0
  62. package/dist/es2019/preset/core-plugin/index.js +1 -0
  63. package/dist/es2019/styles/shared/annotation.js +54 -29
  64. package/dist/es2019/types/index.js +9 -1
  65. package/dist/es2019/ui/DropList/index.js +1 -1
  66. package/dist/es2019/ui/Mention/mention-with-profilecard.js +2 -0
  67. package/dist/esm/hooks/useSharedPluginState.js +1 -4
  68. package/dist/esm/i18n/cs.js +2 -1
  69. package/dist/esm/i18n/da.js +2 -1
  70. package/dist/esm/i18n/de.js +2 -1
  71. package/dist/esm/i18n/en.js +1 -0
  72. package/dist/esm/i18n/en_GB.js +1 -0
  73. package/dist/esm/i18n/en_ZZ.js +1 -0
  74. package/dist/esm/i18n/es.js +2 -1
  75. package/dist/esm/i18n/fi.js +2 -1
  76. package/dist/esm/i18n/fr.js +2 -1
  77. package/dist/esm/i18n/hu.js +2 -1
  78. package/dist/esm/i18n/it.js +2 -1
  79. package/dist/esm/i18n/ja.js +2 -1
  80. package/dist/esm/i18n/ko.js +2 -1
  81. package/dist/esm/i18n/nb.js +2 -1
  82. package/dist/esm/i18n/nl.js +2 -1
  83. package/dist/esm/i18n/pl.js +2 -1
  84. package/dist/esm/i18n/pt_BR.js +2 -1
  85. package/dist/esm/i18n/ru.js +2 -1
  86. package/dist/esm/i18n/sv.js +2 -1
  87. package/dist/esm/i18n/th.js +7 -3
  88. package/dist/esm/i18n/tr.js +4 -3
  89. package/dist/esm/i18n/uk.js +2 -1
  90. package/dist/esm/i18n/vi.js +2 -1
  91. package/dist/esm/i18n/zh.js +3 -2
  92. package/dist/esm/i18n/zh_TW.js +2 -1
  93. package/dist/esm/monitoring/error.js +1 -1
  94. package/dist/esm/preset/builder.js +528 -0
  95. package/dist/esm/preset/core-plugin/index.js +1 -0
  96. package/dist/esm/styles/shared/annotation.js +20 -18
  97. package/dist/esm/types/index.js +9 -1
  98. package/dist/esm/ui/DropList/index.js +1 -1
  99. package/dist/esm/ui/Mention/mention-with-profilecard.js +3 -1
  100. package/dist/types/hooks/useSharedPluginState.d.ts +5 -5
  101. package/dist/types/i18n/cs.d.ts +1 -0
  102. package/dist/types/i18n/da.d.ts +1 -0
  103. package/dist/types/i18n/de.d.ts +1 -0
  104. package/dist/types/i18n/en.d.ts +1 -0
  105. package/dist/types/i18n/en_GB.d.ts +1 -0
  106. package/dist/types/i18n/en_ZZ.d.ts +1 -0
  107. package/dist/types/i18n/es.d.ts +1 -0
  108. package/dist/types/i18n/fi.d.ts +1 -0
  109. package/dist/types/i18n/fr.d.ts +1 -0
  110. package/dist/types/i18n/hu.d.ts +1 -0
  111. package/dist/types/i18n/it.d.ts +1 -0
  112. package/dist/types/i18n/ja.d.ts +1 -0
  113. package/dist/types/i18n/ko.d.ts +1 -0
  114. package/dist/types/i18n/nb.d.ts +1 -0
  115. package/dist/types/i18n/nl.d.ts +1 -0
  116. package/dist/types/i18n/pl.d.ts +1 -0
  117. package/dist/types/i18n/pt_BR.d.ts +1 -0
  118. package/dist/types/i18n/ru.d.ts +1 -0
  119. package/dist/types/i18n/sv.d.ts +1 -0
  120. package/dist/types/i18n/th.d.ts +4 -0
  121. package/dist/types/i18n/tr.d.ts +1 -0
  122. package/dist/types/i18n/uk.d.ts +1 -0
  123. package/dist/types/i18n/vi.d.ts +1 -0
  124. package/dist/types/i18n/zh.d.ts +1 -0
  125. package/dist/types/i18n/zh_TW.d.ts +1 -0
  126. package/dist/types/preset/builder.d.ts +550 -11
  127. package/dist/types/preset/core-plugin/index.d.ts +1 -1
  128. package/dist/types/preset/core-plugin/requestDocument.d.ts +1 -2
  129. package/dist/types/preset/index.d.ts +1 -0
  130. package/dist/types/preset/plugin-injection-api.d.ts +9 -3
  131. package/dist/types/styles/shared/annotation.d.ts +17 -0
  132. package/dist/types/types/index.d.ts +8 -7
  133. package/dist/types/types/next-editor-plugin.d.ts +641 -98
  134. package/dist/types/ui/Mention/mention-with-profilecard.d.ts +2 -1
  135. package/dist/types-ts4.5/hooks/useSharedPluginState.d.ts +5 -5
  136. package/dist/types-ts4.5/i18n/cs.d.ts +1 -0
  137. package/dist/types-ts4.5/i18n/da.d.ts +1 -0
  138. package/dist/types-ts4.5/i18n/de.d.ts +1 -0
  139. package/dist/types-ts4.5/i18n/en.d.ts +1 -0
  140. package/dist/types-ts4.5/i18n/en_GB.d.ts +1 -0
  141. package/dist/types-ts4.5/i18n/en_ZZ.d.ts +1 -0
  142. package/dist/types-ts4.5/i18n/es.d.ts +1 -0
  143. package/dist/types-ts4.5/i18n/fi.d.ts +1 -0
  144. package/dist/types-ts4.5/i18n/fr.d.ts +1 -0
  145. package/dist/types-ts4.5/i18n/hu.d.ts +1 -0
  146. package/dist/types-ts4.5/i18n/it.d.ts +1 -0
  147. package/dist/types-ts4.5/i18n/ja.d.ts +1 -0
  148. package/dist/types-ts4.5/i18n/ko.d.ts +1 -0
  149. package/dist/types-ts4.5/i18n/nb.d.ts +1 -0
  150. package/dist/types-ts4.5/i18n/nl.d.ts +1 -0
  151. package/dist/types-ts4.5/i18n/pl.d.ts +1 -0
  152. package/dist/types-ts4.5/i18n/pt_BR.d.ts +1 -0
  153. package/dist/types-ts4.5/i18n/ru.d.ts +1 -0
  154. package/dist/types-ts4.5/i18n/sv.d.ts +1 -0
  155. package/dist/types-ts4.5/i18n/th.d.ts +4 -0
  156. package/dist/types-ts4.5/i18n/tr.d.ts +1 -0
  157. package/dist/types-ts4.5/i18n/uk.d.ts +1 -0
  158. package/dist/types-ts4.5/i18n/vi.d.ts +1 -0
  159. package/dist/types-ts4.5/i18n/zh.d.ts +1 -0
  160. package/dist/types-ts4.5/i18n/zh_TW.d.ts +1 -0
  161. package/dist/types-ts4.5/preset/builder.d.ts +577 -13
  162. package/dist/types-ts4.5/preset/core-plugin/index.d.ts +1 -1
  163. package/dist/types-ts4.5/preset/core-plugin/requestDocument.d.ts +1 -2
  164. package/dist/types-ts4.5/preset/index.d.ts +1 -0
  165. package/dist/types-ts4.5/preset/plugin-injection-api.d.ts +9 -8
  166. package/dist/types-ts4.5/styles/shared/annotation.d.ts +17 -0
  167. package/dist/types-ts4.5/types/index.d.ts +8 -7
  168. package/dist/types-ts4.5/types/next-editor-plugin.d.ts +673 -127
  169. package/dist/types-ts4.5/ui/Mention/mention-with-profilecard.d.ts +2 -1
  170. package/package.json +2 -2
  171. package/dist/cjs/preset/core-plugin/types.js +0 -5
  172. package/dist/cjs/types/editor-public-api.js +0 -5
  173. package/dist/es2019/preset/core-plugin/types.js +0 -1
  174. package/dist/es2019/types/editor-public-api.js +0 -1
  175. package/dist/esm/preset/core-plugin/types.js +0 -1
  176. package/dist/esm/types/editor-public-api.js +0 -1
  177. package/dist/types/preset/core-plugin/types.d.ts +0 -59
  178. package/dist/types/types/editor-public-api.d.ts +0 -3
  179. package/dist/types-ts4.5/preset/core-plugin/types.d.ts +0 -59
  180. package/dist/types-ts4.5/types/editor-public-api.d.ts +0 -4
@@ -1,30 +1,569 @@
1
- import type { AllEditorPresetPluginTypes, ExtractPluginNameFromAllBuilderPlugins, MaybePlugin, MaybePluginName, PresetPlugin, PublicPluginAPI, SafePresetCheck } from '../types';
1
+ import type { CorePlugin, DefaultEditorPlugin, DependencyPlugin, NextEditorPlugin, NextEditorPluginMetadata, OptionalPlugin, PluginDependenciesAPI } from '../types';
2
2
  import type { EditorPlugin } from '../types/editor-plugin';
3
3
  import type { EditorPluginInjectionAPI } from './plugin-injection-api';
4
- interface ProcessProps {
5
- pluginInjectionAPI?: EditorPluginInjectionAPI;
6
- excludePlugins?: Set<string>;
7
- }
8
- interface BuildProps extends ProcessProps {
4
+ /*********************
5
+ * *
6
+ * BASE TYPES *
7
+ * *
8
+ **********************/
9
+ /**
10
+ * 🧱 Internal Type: Editor FE Platform
11
+ *
12
+ */
13
+ type MaybePlugin<T extends PresetPlugin> = T | undefined;
14
+ /**
15
+ * 🧱 Internal Type: Editor FE Platform
16
+ *
17
+ */
18
+ type DependencyErrorMessage<Message extends string> = {
19
+ errorMessage: Message;
20
+ };
21
+ /**
22
+ * 🧱 Internal Type: Editor FE Platform
23
+ *
24
+ */
25
+ type PluginWithConfiguration<Plugin> = undefined extends ExtractPluginConfiguration<Plugin> ? [Plugin, ExtractPluginConfiguration<Plugin>?] : [Plugin, ExtractPluginConfiguration<Plugin>];
26
+ /****************************************************
27
+ * *
28
+ * METADATA PROPERTIES EXTRACTION TYPES *
29
+ * *
30
+ ****************************************************/
31
+ /**
32
+ * 🧱 Internal Type: Editor FE Platform
33
+ *
34
+ * Extracts the configuration type from a given plugin.
35
+ *
36
+ *
37
+ * @returns The extracted plugin configuration type if applicable, or `never`.
38
+ *
39
+ * @example
40
+ * ```typescript
41
+ * type DogPlugin = NextEditorPlugin<'dog'>;
42
+ *
43
+ * // it returns never, since Dog has no configuration
44
+ * type MyPluginConfiguration = ExtractPluginConfiguration<MyPlugin>;
45
+ *
46
+ *
47
+ * type CatPlugin = NextEditorPlugin<'cat', { configuration: { color: 'red' | 'blue' } }>;
48
+ *
49
+ * // it returns this type { color: 'red' | 'blue' }
50
+ * type MyPluginConfiguration = ExtractPluginConfiguration<MyPlugin>;
51
+ * ```
52
+ */
53
+ type ExtractPluginConfiguration<Plugin> = Plugin extends NextEditorPlugin<any, any> ? Plugin extends (props: {
54
+ config: any;
55
+ api: any;
56
+ }) => DefaultEditorPlugin<any, infer Metadata> ? ExtractPluginConfigurationFromMetadata<Metadata> : never : never;
57
+ /**
58
+ * 🧱 Internal Type: Editor FE Platform
59
+ *
60
+ * Extracts and filters the plugin dependencies from the plugin metadata, excluding
61
+ * optional dependencies.
62
+ *
63
+ * This type first checks if the `dependencies` property in the given `Metadata` type
64
+ * is an array of `DependencyPlugin`. If true, it applies `FilterOptionalPlugins` to
65
+ * filter out the optional dependencies. If the `dependencies` property does not exist
66
+ * or is not an array of `DependencyPlugin`, the type resolves to an empty array.
67
+ *
68
+ * @returns An array of filtered plugin dependencies or an empty array.
69
+ *
70
+ * @example
71
+ * ```typescript
72
+ * type DogPlugin = NextEditorPlugin<'dog'>;
73
+ * type LoudPlugin = NextEditorPlugin<'loud'>;
74
+ * type BarkMetadata = {dependencies: [
75
+ * OptionalPlugin<LoudPlugin>,
76
+ * DogPlugin,
77
+ * ]}
78
+ * type BarkPlugin = NextEditorPlugin<'bark', BarkMetadata>;
79
+ *
80
+ * // It returns [DogPlugin]
81
+ * type RequiredDependencies = ExtractPluginDependenciesFromMetadataWithoutOptionals<BarkMetadata>;
82
+ *
83
+ * ```
84
+ *
85
+ * You probably wants to use this other type util @see ExtractPluginDependencies
86
+ * since you wouldn't need to infer the Metadata twice
87
+ */
88
+ type ExtractPluginDependenciesFromMetadataWithoutOptionals<Metadata extends NextEditorPluginMetadata> = Metadata['dependencies'] extends DependencyPlugin[] ? FilterOptionalPlugins<Metadata['dependencies']> : [];
89
+ /**
90
+ * 🧱 Internal Type: Editor FE Platform
91
+ *
92
+ * Extracts the plugin configuration from the given plugin metadata if the
93
+ * `pluginConfiguration` property exists.
94
+ *
95
+ * This type conditionally checks if the `Metadata` type includes a `pluginConfiguration`
96
+ * key. If such a key exists, the type of `pluginConfiguration` is returned. If not,
97
+ * the type resolves to `never`.
98
+ */
99
+ type ExtractPluginConfigurationFromMetadata<Metadata> = 'pluginConfiguration' extends keyof Metadata ? Metadata['pluginConfiguration'] : never;
100
+ /********************************
101
+ * *
102
+ * TYPE INFER *
103
+ * *
104
+ *********************************/
105
+ /**
106
+ * 🧱 Internal Type: Editor FE Platform
107
+ *
108
+ * Extracts the NextEditorPlugin type from a PresetPuglin,
109
+ * this is useful because the EditorPresetBuilder can accept the plugin in multiple ways:
110
+ *
111
+ * @example
112
+ * ```
113
+ * preset
114
+ * // valid
115
+ * .add([plugin, { myConfiguration }] // Type: [NextEditorPlugin, Configuration]
116
+ *
117
+ * // valid
118
+ * .add([plugin]) // Type: [NextEditorPlugin, Configuration?]
119
+ *
120
+ * // valid
121
+ * .add(plugin) // Type: NextEditorPlugin
122
+ *
123
+ * ```
124
+ *
125
+ * This type conditionally checks if `Plugin` is an array. If it is an array, it then checks if the first element
126
+ * (`MPlugin`) extends `NextEditorPlugin`. But if `Plugin` directly extends `NextEditorPlugin`, it returns the `Plugin`
127
+ * type itself. Otherwise, it resolves to `never`.
128
+ *
129
+ * You probably wants to use this if you need to extract the NextEditorPlugin from a @see PresetPlugin .
130
+ * Since the PresetPlugin is an union between a tuple and a plugin.
131
+ */
132
+ type ExtractPluginAllBuilderPlugins<Plugin extends PresetPlugin> = Plugin extends Array<any> ? Plugin extends [infer MPlugin, ...any] ? MPlugin extends NextEditorPlugin<infer Name, any> ? MPlugin : never : never : Plugin extends NextEditorPlugin<infer Name, any> ? Plugin : never;
133
+ /**
134
+ * 🧱 Internal Type: Editor FE Platform
135
+ *
136
+ * Extracts non-optional plugin dependencies, excluding any optional dependencies, from a given plugin's metadata.
137
+ *
138
+ * We can declare the depencies like this:
139
+ *
140
+ * @example
141
+ * ```typescript
142
+ * NextEditorPlugin<'bark', {
143
+ * dependencies: [DogPlugin, Optional<LoudPlugin>]
144
+ * }>
145
+ *
146
+ * ```
147
+ *
148
+ *
149
+ * This tyope is similar to @see ExtractPluginDependenciesFromMetadataWithoutOptionals
150
+ * but you can use it to extract the non-optional-dependencies from any NextEditorPlugin without infer the metadata
151
+ *
152
+ * @example
153
+ * ```typescript
154
+ * type BarkPlugin = NextEditorPlugin<'bark', {
155
+ * dependencies: [DogPlugin, Optional<LoudPlugin>]
156
+ * }>
157
+ *
158
+ * type PluginDependencies = ExtractPluginDependencies<BarkPlugin>; // Type: [DogPlugin]
159
+ * ```
160
+ */
161
+ type ExtractPluginDependencies<Plugin> = Plugin extends NextEditorPlugin<any, infer Metadata> ? ExtractPluginDependenciesFromMetadataWithoutOptionals<Metadata> : never;
162
+ /**
163
+ * 🧱 Internal Type: Editor FE Platform
164
+ *
165
+ * Extracts the NextEditorPlugin type from a PluginWithConfiguration.
166
+ *
167
+ *
168
+ * You probably wants to use this if you need to extract the NextEditorPlugin from a @see PresetPlugin .
169
+ * Since the PresetPlugin is an union between a tuple and a plugin.
170
+ */
171
+ type ExtractNextEditorPluginFromPluginWithConfiguration<Plugin> = Plugin extends PluginWithConfiguration<any> ? Plugin[0] : never;
172
+ /**
173
+ * 🧱 Internal Type: Editor FE Platform
174
+ *
175
+ * Extracts the plugin name from a PresetPlugins.
176
+ *
177
+ * @example
178
+ * ```typescript
179
+ * ExtractPluginNameFromAllBuilderPlugins<NextEditorPlugin<'bark'>> // 'bark'
180
+ *
181
+ * ExtractPluginNameFromAllBuilderPlugins<[NextEditorPlugin<'dog'>, { configuration: {} }> // 'dog'
182
+ *
183
+ * ```
184
+ * Similar to @see ExtractPluginAllBuilderPlugins, this type conditionally checks if `Plugin` is an array. If it is,
185
+ * it attempts to extract the name of the first plugin (`MPlugin`) in the array that extends `NextEditorPlugin` with
186
+ * a name and any metadata. If `Plugin` itself directly extends `NextEditorPlugin`, it extracts the plugin's name.
187
+ * If none of these conditions are met, it resolves to `never`.
188
+ *
189
+ */
190
+ type ExtractPluginNameFromAllBuilderPlugins<Plugin extends PresetPlugin> = Plugin extends Array<any> ? Plugin extends [infer MPlugin, ...any] ? MPlugin extends NextEditorPlugin<infer Name, any> ? Name : never : never : Plugin extends NextEditorPlugin<infer Name, any> ? Name : never;
191
+ /******************************
192
+ * *
193
+ * MAPPED TUPLES *
194
+ * *
195
+ ******************************/
196
+ /**
197
+ * 🧱 Internal Type: Editor FE Platform
198
+ *
199
+ * Filters out optional plugins from a tuple of dependency plugins.
200
+ *
201
+ *
202
+ * This type is using the Tail Head trick to map a tuple to another one.
203
+ * It does this by conditionally iterating over each element in the tuple: if the head of the tuple (the first element)
204
+ * is an optional plugin, it is excluded from the resulting tuple; otherwise, it is included. This process is repeated
205
+ * for the tail (the remaining elements) of the tuple until all elements have been evaluated.
206
+ *
207
+ */
208
+ type FilterOptionalPlugins<T extends DependencyPlugin[]> = T extends [infer Head, ...infer Tail] ? Tail extends DependencyPlugin[] ? Head extends OptionalPlugin<NextEditorPlugin<any, any>> ? FilterOptionalPlugins<Tail> : [Head, ...FilterOptionalPlugins<Tail>] : T : T;
209
+ /**
210
+ * 🧱 Internal Type: Editor FE Platform
211
+ *
212
+ * One of the main type system for the EditorPresetBuilder.
213
+ *
214
+ * Verifies if a given plugin's dependencies are satisfied within a provided stack of plugins.
215
+ *
216
+ * Usually, the stack of plugins are coming from a generic parameter in the EditorPresetBuilder<PluginNames, PluginStack>.
217
+ *
218
+ * This type checks if the dependencies of the given `Plugin` are included in the provided `PluginsStack`.
219
+ *
220
+ * - If the plugin has no dependencies, it simply returns the plugin itself, (provided it is either a `PluginWithConfiguration` or `NextEditorPlugin`, in case someone tries to add a non-NextEditorPlugin to the Preset)
221
+ *
222
+ * - If the plugin has dependencies, it verifies each dependency against the `PluginsStack` to ensure
223
+ * they are present. This includes checking direct dependencies as well as dependencies hidden inside tuples (by unwrapping
224
+ * them). If all dependencies are satisfied, it returns the plugin; otherwise, it resolves to `never`.
225
+ *
226
+ *
227
+ * @example
228
+ * ```typescript
229
+ * type DogPlugin = NextEditorPlugin<'dog'>;
230
+ * type LoudPlugin = NextEditorPlugin<'loud'>;
231
+ * type BarkPlugin = NextEditorPlugin<'bark', { dependencies: [DogPlugin, LoudPlugin] }>;
232
+ *
233
+ *
234
+ * // When there we are missing dependencies
235
+ * VerifyPluginDependencies<BarkPlugin, [DogPlugin]> // Type: never
236
+ *
237
+ *
238
+ * // When there all dependencies are already added on the stack
239
+ * VerifyPluginDependencies<BarkPlugin, [DogPlugin, LoudPlugin]> // Type: BarkPlugin
240
+ *
241
+ * ```
242
+ */
243
+ type VerifyPluginDependencies<Plugin, PluginsStack extends AllEditorPresetPluginTypes[]> = ExtractPluginDependencies<Plugin> extends [] ? Plugin extends PluginWithConfiguration<any> | NextEditorPlugin<any, any> ? Plugin : never :
244
+ /**
245
+ * case 1: We're looking for its dependent plugins indexed on `AllEditorPresetPluginTypes`
246
+ */
247
+ ExtractPluginDependencies<Plugin>[number] extends (ExtractPluginDependencies<Plugin>[number] & PluginsStack[number])
248
+ /**
249
+ * case 2:
250
+ * Otherwise check whether the dependent-plugin, is hidden inside a tuple,
251
+ * unwrapping `Plugins` via `ExtractNextEditorPluginFromPluginWithConfiguration`
252
+ */
253
+ | (ExtractPluginDependencies<Plugin>[number] & ExtractNextEditorPluginFromPluginWithConfiguration<PluginsStack[number]>) ? Plugin : never;
254
+ /********************************
255
+ * *
256
+ * BETTER ERROR MESSAGE TYPES *
257
+ * *
258
+ *********************************/
259
+ /**
260
+ * 🧱 Internal Type: Editor FE Platform
261
+ *
262
+ * TypeScript doesn't allow custom error messages (yet). So, use this type to force a specific error message to the user.
263
+ *
264
+ * This is useful because in a situation where a Preset has too many plugins, its become really hard to understand what the error message is.
265
+ *
266
+ * Extracts the names of required dependencies for a given plugin, or provides an error message if dependencies are
267
+ * missing, invalid, or if the plugin itself is not a recognized NextEditorPlugin.
268
+ *
269
+ * This type evaluates whether a given `Plugin` has defined dependencies. If dependencies are absent, it returns
270
+ * a message indicating no dependencies were found. If dependencies are present but do not conform to expected types,
271
+ * or if an unspecified issue occurs, appropriate error messages are generated. Valid dependencies result in the
272
+ * extraction of their names; otherwise, an error message specific to the situation is returned.
273
+ *
274
+ * It is used by the @see GetDependencyErrorMessage to group all error messages when a new plugin is being added into a preset.
275
+ */
276
+ type ExtractRequiredDependencies<Plugin, PluginsStack extends AllEditorPresetPluginTypes[]> = Plugin extends NextEditorPlugin<infer PluginName, infer Metadata> ? Metadata['dependencies'] extends undefined ? DependencyErrorMessage<'No found dependencies'> : Metadata['dependencies'] extends DependencyPlugin[] ? FilterOptionalPlugins<FilterExistingPlugins<Metadata['dependencies'], PluginsStack>>[number] extends NextEditorPlugin<infer Name, any> ? Name : DependencyErrorMessage<`Invalid dependency for ${PluginName}`> : DependencyErrorMessage<`Invalid dependencies for ${PluginName}`> : DependencyErrorMessage<'Plugin is not NextEditorPlugin'>;
277
+ /**
278
+ * 🧱 Internal Type: Editor FE Platform
279
+ *
280
+ * Retrieves an error message if any dependency-related issues are detected for a given plugin within a specified
281
+ * plugin stack. This includes missing dependencies or other errors as identified by `ExtractRequiredDependencies`.
282
+ *
283
+ * It attempts to extract required dependencies for the `Plugin` from the `StackPlugins`. If the result is a string,
284
+ * it indicates a missing dependency and constructs an error message accordingly. Otherwise, it directly returns the
285
+ * result from `ExtractRequiredDependencies`, which could be an error message detailing the issue encountered.
286
+ *
287
+ * It is used by the @see SafePresetCheck to make improve the error message
288
+ */
289
+ type GetDependencyErrorMessage<Plugin, StackPlugins extends AllEditorPresetPluginTypes[]> = ExtractRequiredDependencies<Plugin, StackPlugins> extends string ? DependencyErrorMessage<`Missing dependency: ${ExtractRequiredDependencies<Plugin, StackPlugins>}Plugin`> : ExtractRequiredDependencies<Plugin, StackPlugins>;
290
+ /**
291
+ * 🧱 Internal Type: Editor FE Platform
292
+ *
293
+ * Filters through an array of dependency plugins, removing any that do not exist in the provided plugins stack.
294
+ *
295
+ * This type recursively checks each plugin dependency against the provided `PluginsStack`. If a dependency is found
296
+ * within the stack, it is included in the result; otherwise, it is excluded. This process helps in identifying
297
+ * missing plugins from a set of required dependencies.
298
+ *
299
+ */
300
+ type FilterExistingPlugins<T extends DependencyPlugin[], PluginsStack extends AllEditorPresetPluginTypes[]> = T extends [infer CurrentPluginDependency, ...infer RemainingPluginDependencies] ? RemainingPluginDependencies extends DependencyPlugin[] ? CurrentPluginDependency extends PluginsStack[number] ? FilterExistingPlugins<RemainingPluginDependencies, PluginsStack> : [
301
+ CurrentPluginDependency,
302
+ ...FilterExistingPlugins<RemainingPluginDependencies, PluginsStack>
303
+ ] : T : T;
304
+ /*****************************
305
+ * *
306
+ * VALIDATION HELPER TYPES *
307
+ * *
308
+ ******************************/
309
+ /**
310
+ * 🧱 Internal Type: Editor FE Platform
311
+ *
312
+ * Checks for duplicate plugin entries within a stack of plugins. If a duplicate is found, it returns an error message;
313
+ * otherwise, it proceeds without error.
314
+ *
315
+ * This type primarily serves to ensure that each plugin in the plugin stack is unique, preventing issues related to
316
+ * duplicate plugin registration. It also includes a check to accommodate scenarios where strict typing is bypassed.
317
+ *
318
+ * If the plugin is used with other configuration this type will not complain.
319
+ */
320
+ type CheckDuplicatePlugin<Plugin, StackPlugins extends AllEditorPresetPluginTypes[]> = Plugin extends NextEditorPlugin<infer PluginName, any> ? Plugin extends StackPlugins[number] ? unknown extends StackPlugins[number] ? unknown : DependencyErrorMessage<`Duplicate plugin: ${PluginName}`> : unknown : unknown;
321
+ /**
322
+ * 🧱 Internal Type: Editor FE Platform
323
+ *
324
+ * Verifies if a given plugin meets basic requirements to be considered a valid editor plugin.
325
+ *
326
+ * This type checks if the plugin is a function that matches the expected signature for an next editor plugin. If it does,
327
+ * it further checks the plugin's configuration requirements to ensure compatibility and adherence to expected
328
+ * configurations.
329
+ *
330
+ */
331
+ type CheckBasicPlugin<Plugin> = Plugin extends (args: any, api: any) => EditorPlugin ? CheckTupleRequirements<Plugin, ExtractPluginConfiguration<Plugin>, PluginWithConfiguration<Plugin>> : never;
332
+ /**
333
+ * 🧱 Internal Type: Editor FE Platform
334
+ *
335
+ * Evaluates whether a plugin's configuration meets the requirements to be used either as a standalone plugin or
336
+ * as part of a plugin-with-configuration tuple.
337
+ *
338
+ * This type assesses the plugin configuration's status—whether it's optional, mandatory, or not present—and determines
339
+ * the valid ways in which the plugin can be registered or used. This is crucial for maintaining backward compatibility
340
+ * and ensuring plugins are correctly configured upon registration into the Preset
341
+ *
342
+ */
343
+ type CheckTupleRequirements<Plugin, Config, ArrayType> = unknown extends Config ? Plugin | ArrayType : undefined extends Config ? Plugin | ArrayType : [
344
+ Config
345
+ ] extends [never] ? Plugin : ArrayType;
346
+ /*****************************
347
+ * *
348
+ * EDITOR API HELPER TYPES *
349
+ * *
350
+ ******************************/
351
+ /**
352
+ * 🧱 Internal Type: Editor FE Platform
353
+ *
354
+ * Extracts the numeric indices as literal types from a tuple.
355
+ *
356
+ * This utility type takes a tuple and produces a union of its numeric indices as literal types. It's useful for
357
+ * iterating over tuples with TypeScript's mapped types, allowing for operations on each tuple element based on its index.
358
+ *
359
+ * It is being used to separate plugins registred with `preset.maybeAdd` and `preset.add`.
360
+ */
361
+ type TupleIndices<T extends readonly any[]> = Extract<keyof T, `${number}`> extends `${infer N extends number}` ? N : never;
362
+ /**
363
+ * 🧱 Internal Type: Editor FE Platform
364
+ *
365
+ * Constructs a plugin api type with optional properties based on the optional plugins from a given tuple of plugins.
366
+ *
367
+ * This type iterates over a tuple of plugins and checks for plugins marked as optional (indicated by the presence
368
+ * of `undefined`). For each optional plugin, it attempts to extract the plugin's name and corresponding
369
+ * `PluginDependenciesAPI` type. The resulting object type has properties with these plugin names as keys and their
370
+ * respective APIs as optional values.
371
+ *
372
+ * @example
373
+ * ```typescript
374
+ * type DogPlugin = NextEditorPlugin<'dog'>;
375
+ * type CatPlugin = NextEditorPlugin<'cat'>;
376
+ *
377
+ *
378
+ * BuildOptionalAPIEntry<[DogPlugin, MaybePlugin<CatPlugin>]> // Type: { cat?: { } }
379
+ *
380
+ * ```
381
+ */
382
+ type BuildOptionalAPIEntry<T extends AllEditorPresetPluginTypes[]> = {
383
+ [K in TupleIndices<T> as undefined extends T[K] ? T[K] extends MaybePlugin<infer P> ? ExtractPluginNameFromAllBuilderPlugins<P> : never : never]?: undefined extends T[K] ? T[K] extends MaybePlugin<infer P> ? PluginDependenciesAPI<ExtractPluginAllBuilderPlugins<P>> | undefined : never : never;
384
+ };
385
+ /**
386
+ * 🧱 Internal Type: Editor FE Platform
387
+ * Generates a plugin api type with properties based on the required plugins from a given tuple of plugins.
388
+ *
389
+ * This type traverses a tuple of plugins, focusing on those not marked as optional. For each required plugin,
390
+ * it extracts the plugin's name to use as a key and determines the corresponding `PluginDependenciesAPI` type
391
+ * for the value. The resulting object type includes these key-value pairs, ensuring that each required plugin
392
+ * has a defined API entry in the object.
393
+ *
394
+ * @example
395
+ * ```typescript
396
+ * type DogPlugin = NextEditorPlugin<'dog'>;
397
+ * type CatPlugin = NextEditorPlugin<'cat'>;
398
+ *
399
+ *
400
+ * BuildOptionalAPIEntry<[DogPlugin, MaybePlugin<CatPlugin>]> // Type: { dog?: { } }
401
+ *
402
+ * ```
403
+ */
404
+ type BuildRequiredAPIEntry<T extends AllEditorPresetPluginTypes[]> = {
405
+ [K in TupleIndices<T> as undefined extends T[K] ? never : T[K] extends PresetPlugin ? ExtractPluginNameFromAllBuilderPlugins<T[K]> : never]: undefined extends T[K] ? never : T[K] extends PresetPlugin ? PluginDependenciesAPI<ExtractPluginAllBuilderPlugins<T[K]>> : never;
406
+ };
407
+ /**
408
+ * 🧱 Internal Type: Editor FE Platform
409
+ *
410
+ * Forces the expansion (simplification/normalization) of conditional and mapped types.
411
+ * This can be particularly useful for making the types more readable and manageable in
412
+ * environments like IntelliSense or when generating type documentation.
413
+ *
414
+ * More info {@link https://github.com/microsoft/TypeScript/issues/47980 TypeScript/issues/47980}
415
+ */
416
+ type Expand<T> = T extends Function ? T : T extends unknown ? {
417
+ [K in keyof T]: Expand<T[K]>;
418
+ } : never;
419
+ /*************************
420
+ * *
421
+ * PUBLIC TYPES *
422
+ * *
423
+ *************************/
424
+ /**
425
+ * 🧱 Internal Type: Editor FE Platform
426
+ *
427
+ * Represents a utility type that wraps a string type in a tuple, often used to denote
428
+ * plugin names that might be optionally included or excluded in certain contexts within
429
+ * the editor preset builder.
430
+ */
431
+ export type MaybePluginName<T extends string> = [T];
432
+ /**
433
+ * 🧱 Internal Type: Editor FE Platform
434
+ *
435
+ * A union type that represents a plugin which could either be a standalone `NextEditorPlugin`
436
+ * or a `PluginWithConfiguration` that bundles a plugin with its specific configuration.
437
+ *
438
+ * This type is fundamental in managing plugins within presets, allowing for flexible plugin
439
+ * registration that accommodates plugins with or without explicit configurations.
440
+ */
441
+ export type PresetPlugin = PluginWithConfiguration<NextEditorPlugin<any, any>> | NextEditorPlugin<any, any>;
442
+ /**
443
+ * 🧱 Internal Type: Editor FE Platform
444
+ *
445
+ * A union type that aggregates all possible plugin name representations within the editor preset builder,
446
+ * including simple strings for direct plugin names and wrapped strings in tuples when a plugin is registred with `maybeAdd`.
447
+ *
448
+ */
449
+ export type AllPluginNames = string | MaybePluginName<string>;
450
+ /**
451
+ * 🧱 Internal Type: Editor FE Platform
452
+ *
453
+ * Represents all possible types of plugins that can be included within an editor preset.
454
+ * This includes both `PresetPlugin` types and `MaybePlugin` types, accommodating a wide range
455
+ * of plugin registration scenarios likw:
456
+ *
457
+ * @example
458
+ * ```typescript
459
+ * preset
460
+ * .add([plugin, { myConfiguration }]
461
+ * .add([plugin])
462
+ * .add(plugin)
463
+ * .maybeAdd(plugin, () => true);
464
+ * .maybeAdd([plugin], () => true);
465
+ * .maybeAdd([plugin, { myConfiguration }], () => true);
466
+ *
467
+ * ```
468
+ */
469
+ export type AllEditorPresetPluginTypes = PresetPlugin | MaybePlugin<NextEditorPlugin<any, any>>;
470
+ /**
471
+ * 🧱 Internal Type: Editor FE Platform
472
+ *
473
+ * Performs a series of checks to ensure that a given plugin can be safely added to a preset.
474
+ * This includes verifying the plugin's dependencies, checking for duplicate registrations, and ensuring
475
+ * the plugin meets basic criteria for being considered a valid plugin.
476
+ *
477
+ * @returns The plugin type if all checks pass, or error messages detailing why the plugin cannot be added.
478
+ */
479
+ export type SafePresetCheck<Plugin, StackPlugins extends AllEditorPresetPluginTypes[]> = Plugin extends Plugin & VerifyPluginDependencies<Plugin, StackPlugins> ? Plugin extends NextEditorPlugin<any, any> ? CheckDuplicatePlugin<Plugin, StackPlugins> & CheckBasicPlugin<Plugin> : never : GetDependencyErrorMessage<Plugin, StackPlugins>;
480
+ /**
481
+ * 📢 Public Type API
482
+ *
483
+ * Extracts the complete API surface for a given editor preset, including both core and plugin-specific APIs.
484
+ * This type dynamically assembles the API object based on the included plugins, differentiating between
485
+ * optional and required plugins to accurately reflect the available API calls.
486
+ *
487
+ * @template Preset The editor preset builder instance from which to extract the API.
488
+ * @returns An object type representing the complete API surface for the given preset.
489
+ *
490
+ * @example
491
+ * ```typescript
492
+ * const dogPlugin: NextEditorPlugin<'dog'>;
493
+ * const catPlugin: NextEditorPlugin<'cat'>;
494
+ *
495
+ * const myPreset = new EditorPresetBuilder()
496
+ * .add(dogPlugin)
497
+ * .maybeAdd(catPlugin, () => true)
498
+ *
499
+ * const api: ExtractPresetAPI<typeof myPreset>;
500
+ *
501
+ *
502
+ * // Core is always available
503
+ * api.core.actions
504
+ *
505
+ * // Dog was registred with `add`, so it will always be available
506
+ * api.dog.actions
507
+ *
508
+ * // Cat was registred with `maybeAdd`, so it may not be available on runtime
509
+ * api.cat?.actions
510
+ * ```
511
+ */
512
+ export type ExtractPresetAPI<Preset extends EditorPresetBuilder<any, any>> = Preset extends EditorPresetBuilder<any, infer Plugins> ? Expand<{
513
+ core: PluginDependenciesAPI<CorePlugin>;
514
+ } & BuildOptionalAPIEntry<Plugins> & BuildRequiredAPIEntry<Plugins>> : never;
515
+ /*************************
516
+ * *
517
+ * PROP TYPES *
518
+ * *
519
+ *************************/
520
+ type OldAndDeprecatedAddFunction<T> = (pluginToAdd: T, builder: EditorPresetBuilder<any, any>) => EditorPresetBuilder<any, any>;
521
+ type BuildProps = {
9
522
  excludePlugins?: Set<string>;
10
523
  pluginInjectionAPI?: EditorPluginInjectionAPI;
11
- }
12
- type OldAndDeprecatedAddFunction<T> = (pluginToAdd: T, builder: EditorPresetBuilder<any, any>) => EditorPresetBuilder<any, any>;
13
- type AllPluginNames = string | MaybePluginName<string>;
524
+ };
525
+ /**
526
+ * This class is the main way to build an Editor.
527
+ *
528
+ * A Preset is an immutable object, any modification like `.add` or `.maybeAdd`
529
+ * will always result in a new preset instance.
530
+ *
531
+ * ⚠️⚠️⚠️ ATTENTION ⚠️⚠️⚠️
532
+ * For ComposableEditor, a new Preset means a full redraw,
533
+ * it is one of the most expensive operation.
534
+ * Please make sure you aren't recreating this all the time.
535
+ *
536
+ * EditorAPI:
537
+ * In case you need access to the EditorAPI type definition based in the preset you have.
538
+ * Please use the util type exported in this package: @see ExtractPresetAPI<Preset>
539
+ *
540
+ * ```typescript
541
+ * const myPreset = new EditorPresetBuilder()
542
+ * .add(pluginDog)
543
+ * .add(pluginCat);
544
+ *
545
+ *
546
+ * function someFunc(myApi: ExtractPresetAPI<typeof myPreset>) {
547
+ *
548
+ * }
549
+ * ```
550
+ *
551
+ * If your code is inside an EditorPlugin you should be using the @see ExtractInjectionAPI.
552
+ */
14
553
  export declare class EditorPresetBuilder<PluginNames extends AllPluginNames[] = [], StackPlugins extends AllEditorPresetPluginTypes[] = []> {
15
554
  private readonly data;
16
555
  /**
17
556
  * Returns the editor API when resolved.
18
557
  * This occurs when the preset is initially built.
19
558
  */
20
- apiPromise: Promise<PublicPluginAPI<any>>;
559
+ apiPromise: Promise<unknown>;
21
560
  private resolver;
22
561
  constructor(...more: [...StackPlugins]);
23
562
  add<NewPlugin extends PresetPlugin>(nextOrTuple: SafePresetCheck<NewPlugin, StackPlugins>): EditorPresetBuilder<[
24
563
  ExtractPluginNameFromAllBuilderPlugins<NewPlugin>,
25
564
  ...PluginNames
26
565
  ], [
27
- ...[NewPlugin],
566
+ NewPlugin,
28
567
  ...StackPlugins
29
568
  ]>;
30
569
  maybeAdd<ToAddPlugin extends PresetPlugin>(pluginToAdd: SafePresetCheck<ToAddPlugin, StackPlugins>, shouldAdd: boolean | (() => boolean) | OldAndDeprecatedAddFunction<ToAddPlugin>): EditorPresetBuilder<[
@@ -1,4 +1,4 @@
1
- import type { CorePlugin } from './types';
1
+ import type { CorePlugin } from '../../types';
2
2
  /**
3
3
  * Core plugin that is always included in the preset.
4
4
  * Allows for executing `EditorCommand` and other core functionality.
@@ -1,7 +1,6 @@
1
1
  import type { JSONDocNode } from '@atlaskit/editor-json-transformer';
2
2
  import { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
3
3
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
4
- import type { Transformer } from '../../types';
5
- import type { InferTransformerResultCallback } from './types';
4
+ import type { InferTransformerResultCallback, Transformer } from '../../types';
6
5
  export declare function toJSON(node: PMNode): JSONDocNode;
7
6
  export declare const scheduleDocumentRequest: <GenericTransformer extends Transformer<any> | undefined>(editorView: EditorView | null, callback: InferTransformerResultCallback<Transformer<any>>, transformer?: Transformer<any> | undefined) => void;
@@ -1,3 +1,4 @@
1
1
  export { EditorPresetBuilder } from './builder';
2
2
  export { EditorPluginInjectionAPI } from './plugin-injection-api';
3
3
  export { editorCommandToPMCommand, PassiveTransaction } from './editor-commands';
4
+ export type { ExtractPresetAPI, AllEditorPresetPluginTypes, AllPluginNames, MaybePluginName, } from './builder';
@@ -1,6 +1,6 @@
1
1
  import type { EditorState } from '@atlaskit/editor-prosemirror/state';
2
2
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
3
- import type { NextEditorPlugin, PluginDependenciesAPI, PluginInjectionAPI } from '../types/next-editor-plugin';
3
+ import type { BasePluginDependenciesAPI, CorePlugin, NextEditorPlugin, PluginDependenciesAPI } from '../types/next-editor-plugin';
4
4
  type NextEditorPluginInitializedType = ReturnType<NextEditorPlugin<any>>;
5
5
  type SharedStateAPIProps = {
6
6
  getEditorState: () => EditorState | undefined;
@@ -29,10 +29,16 @@ type EditorStateDelta = {
29
29
  readonly oldEditorState: EditorState;
30
30
  };
31
31
  interface PluginInjectionAPIDefinition {
32
- api: <T extends NextEditorPlugin<any, any>>() => PluginInjectionAPI<T extends NextEditorPlugin<infer Name, any> ? Name : never, T extends NextEditorPlugin<any, infer Metadata> ? Metadata : never>['dependencies'];
32
+ api: () => {
33
+ [key: string]: BasePluginDependenciesAPI<any>;
34
+ };
33
35
  onEditorViewUpdated: (props: EditorStateDelta) => void;
34
36
  onEditorPluginInitialized: (plugin: NextEditorPluginInitializedType) => void;
35
37
  }
38
+ type GenericAPIWithCore = {
39
+ core: PluginDependenciesAPI<CorePlugin>;
40
+ [key: string]: BasePluginDependenciesAPI<any>;
41
+ };
36
42
  export declare class EditorPluginInjectionAPI implements PluginInjectionAPIDefinition {
37
43
  private sharedStateAPI;
38
44
  private actionsAPI;
@@ -40,7 +46,7 @@ export declare class EditorPluginInjectionAPI implements PluginInjectionAPIDefin
40
46
  private plugins;
41
47
  constructor({ getEditorState, getEditorView }: PluginInjectionAPIProps);
42
48
  private createAPI;
43
- api<T extends NextEditorPlugin<any, any>>(): import("../types/next-editor-plugin").PublicPluginAPI<[NextEditorPlugin<T extends import("../types/next-editor-plugin").NextEditorPluginFunctionOptionalConfigDefinition<infer Name extends string, any, any> ? Name : never, T extends NextEditorPlugin<any, infer Metadata extends import("../types/next-editor-plugin").NextEditorPluginMetadata> ? Metadata : never>, ..."dependencies" extends keyof (T extends NextEditorPlugin<any, infer Metadata extends import("../types/next-editor-plugin").NextEditorPluginMetadata> ? Metadata : never) ? (T extends NextEditorPlugin<any, infer Metadata extends import("../types/next-editor-plugin").NextEditorPluginMetadata> ? Metadata : never)["dependencies"] extends (import("../types/next-editor-plugin").NextEditorPluginFunctionOptionalConfigDefinition<any, any, any> | import("../types/next-editor-plugin").OptionalPlugin<import("../types/next-editor-plugin").NextEditorPluginFunctionOptionalConfigDefinition<any, any, any>>)[] ? Exclude<(T extends NextEditorPlugin<any, infer Metadata extends import("../types/next-editor-plugin").NextEditorPluginMetadata> ? Metadata : never)["dependencies"], undefined> : [] : []]>;
49
+ api(): GenericAPIWithCore;
44
50
  onEditorViewUpdated: ({ newEditorState, oldEditorState }: EditorStateDiff) => void;
45
51
  onEditorPluginInitialized: (plugin: NextEditorPluginInitializedType) => void;
46
52
  private addPlugin;
@@ -11,7 +11,24 @@ export declare const BlockAnnotationSharedClassNames: {
11
11
  draft: string;
12
12
  };
13
13
  export declare const AnnotationSharedCSSByState: () => {
14
+ common: {
15
+ borderBottom: string;
16
+ cursor: string;
17
+ padding: string;
18
+ '&:has(.card), &:has([data-inline-card])': {
19
+ paddingTop: string;
20
+ border: string;
21
+ boxShadow: string;
22
+ };
23
+ '&:has(.date-lozenger-container)': {
24
+ paddingTop: string;
25
+ };
26
+ };
14
27
  focus: import("@emotion/react").SerializedStyles;
15
28
  blur: import("@emotion/react").SerializedStyles;
29
+ } | {
30
+ focus: import("@emotion/react").SerializedStyles;
31
+ blur: import("@emotion/react").SerializedStyles;
32
+ common?: undefined;
16
33
  };
17
34
  export declare const annotationSharedStyles: () => import("@emotion/react").SerializedStyles;