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