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