sample-piral 1.0.0-pre.2296 → 1.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/app/index.d.ts CHANGED
@@ -1,1895 +1,1033 @@
1
+ import * as React from 'react';
1
2
  import * as ReactRouter from 'react-router';
2
- import * as LibreAtom from '@libre/atom';
3
-
4
- declare module "sample-piral" {
5
- /**
6
- * Defines the API accessible from pilets.
7
- */
8
- export interface PiletApi extends EventEmitter, PiletCustomApi, PiletCoreApi {
9
- /**
10
- * Gets the metadata of the current pilet.
11
- */
12
- meta: PiletMetadata;
13
- }
14
-
15
- /**
16
- * The emitter for Piral app shell events.
17
- */
18
- export interface EventEmitter {
19
- /**
20
- * Attaches a new event listener.
21
- * @param type The type of the event to listen for.
22
- * @param callback The callback to trigger.
23
- */
24
- on<K extends keyof PiralEventMap>(type: K, callback: Listener<PiralEventMap[K]>): EventEmitter;
25
- /**
26
- * Detaches an existing event listener.
27
- * @param type The type of the event to listen for.
28
- * @param callback The callback to trigger.
29
- */
30
- off<K extends keyof PiralEventMap>(type: K, callback: Listener<PiralEventMap[K]>): EventEmitter;
31
- /**
32
- * Emits a new event with the given type.
33
- * @param type The type of the event to emit.
34
- * @param arg The payload of the event.
35
- */
36
- emit<K extends keyof PiralEventMap>(type: K, arg: PiralEventMap[K]): EventEmitter;
37
- }
38
-
39
- /**
40
- * Custom Pilet API parts defined outside of piral-core.
41
- */
42
- export interface PiletCustomApi extends PiletLocaleApi, PiletDashboardApi, PiletMenuApi, PiletNotificationsApi, PiletModalsApi, PiletFeedsApi, PiletSearchApi, PiralAuthApi {}
43
-
44
- /**
45
- * Defines the Pilet API from piral-core.
46
- * This interface will be consumed by pilet developers so that their pilet can interact with the piral instance.
47
- */
48
- export interface PiletCoreApi {
49
- /**
50
- * Gets a shared data value.
51
- * @param name The name of the data to retrieve.
52
- */
53
- getData<TKey extends string>(name: TKey): SharedData[TKey];
54
- /**
55
- * Sets the data using a given name. The name needs to be used exclusively by the current pilet.
56
- * Using the name occupied by another pilet will result in no change.
57
- * @param name The name of the data to store.
58
- * @param value The value of the data to store.
59
- * @param options The optional configuration for storing this piece of data.
60
- * @returns True if the data could be set, otherwise false.
61
- */
62
- setData<TKey extends string>(name: TKey, value: SharedData[TKey], options?: DataStoreOptions): boolean;
63
- /**
64
- * Registers a route for predefined page component.
65
- * The route needs to be unique and can contain params.
66
- * Params are following the path-to-regexp notation, e.g., :id for an id parameter.
67
- * @param route The route to register.
68
- * @param Component The component to render the page.
69
- * @param meta The optional metadata to use.
70
- */
71
- registerPage(route: string, Component: AnyComponent<PageComponentProps>, meta?: PiralPageMeta): RegistrationDisposer;
72
- /**
73
- * Unregisters the page identified by the given route.
74
- * @param route The route that was previously registered.
75
- */
76
- unregisterPage(route: string): void;
77
- /**
78
- * Registers an extension component with a predefined extension component.
79
- * The name must refer to the extension slot.
80
- * @param name The global name of the extension slot.
81
- * @param Component The component to be rendered.
82
- * @param defaults Optionally, sets the default values for the expected data.
83
- */
84
- registerExtension<TName>(name: TName extends string ? TName : string, Component: AnyComponent<ExtensionComponentProps<TName>>, defaults?: TName): RegistrationDisposer;
85
- /**
86
- * Unregisters a global extension component.
87
- * Only previously registered extension components can be unregistered.
88
- * @param name The name of the extension slot to unregister from.
89
- * @param Component The registered extension component to unregister.
90
- */
91
- unregisterExtension<TName>(name: TName extends string ? TName : string, Component: AnyComponent<ExtensionComponentProps<TName>>): void;
92
- /**
93
- * React component for displaying extensions for a given name.
94
- * @param props The extension's rendering props.
95
- * @return The created React element.
96
- */
97
- Extension<TName>(props: ExtensionSlotProps<TName>): ReactElement | null;
98
- /**
99
- * Renders an extension in a plain DOM component.
100
- * @param element The DOM element or shadow root as a container for rendering the extension.
101
- * @param props The extension's rendering props.
102
- * @return The disposer to clear the extension.
103
- */
104
- renderHtmlExtension<TName>(element: HTMLElement | ShadowRoot, props: ExtensionSlotProps<TName>): Disposable;
105
- }
106
-
107
- /**
108
- * Describes the metadata transported by a pilet.
109
- */
110
- export type PiletMetadata = SinglePiletMetadata | MultiPiletMetadata;
111
-
112
- /**
113
- * Listener for Piral app shell events.
114
- */
115
- export interface Listener<T> {
116
- (arg: T): void;
117
- }
118
-
119
- /**
120
- * The map of known Piral app shell events.
121
- */
122
- export interface PiralEventMap extends PiralCustomEventMap {
123
- "unload-pilet": PiralUnloadPiletEvent;
124
- [custom: string]: any;
125
- "store-data": PiralStoreDataEvent;
126
- }
127
-
128
- export interface PiletLocaleApi {
129
- /**
130
- * Translates the given tag (using the optional variables) into a string using the current language.
131
- * The used template can contain placeholders in form of `{{variableName}}`.
132
- * @param tag The tag to translate.
133
- * @param variables The optional variables to fill into the temnplate.
134
- */
135
- translate<T = Record<string, string>>(tag: string, variables?: T): string;
136
- /**
137
- * Provides translations to the application.
138
- * The translations will be exclusively used for retrieving translations for the pilet.
139
- * @param messages The messages to use as translation basis.
140
- */
141
- setTranslations(messages: LocalizationMessages): void;
142
- /**
143
- * Gets the currently provided translations by the pilet.
144
- */
145
- getTranslations(): LocalizationMessages;
146
- }
147
-
148
- export interface PiletDashboardApi {
149
- /**
150
- * Registers a tile with a predefined tile components.
151
- * The name has to be unique within the current pilet.
152
- * @param name The name of the tile.
153
- * @param Component The component to be rendered within the Dashboard.
154
- * @param preferences The optional preferences to be supplied to the Dashboard for the tile.
155
- */
156
- registerTile(name: string, Component: AnyComponent<TileComponentProps>, preferences?: TilePreferences): RegistrationDisposer;
157
- /**
158
- * Registers a tile for predefined tile components.
159
- * @param Component The component to be rendered within the Dashboard.
160
- * @param preferences The optional preferences to be supplied to the Dashboard for the tile.
161
- */
162
- registerTile(Component: AnyComponent<TileComponentProps>, preferences?: TilePreferences): RegistrationDisposer;
163
- /**
164
- * Unregisters a tile known by the given name.
165
- * Only previously registered tiles can be unregistered.
166
- * @param name The name of the tile to unregister.
167
- */
168
- unregisterTile(name: string): void;
169
- }
170
-
171
- export interface PiletMenuApi {
172
- /**
173
- * Registers a menu item for a predefined menu component.
174
- * The name has to be unique within the current pilet.
175
- * @param name The name of the menu item.
176
- * @param Component The component to be rendered within the menu.
177
- * @param settings The optional configuration for the menu item.
178
- */
179
- registerMenu(name: string, Component: AnyComponent<MenuComponentProps>, settings?: MenuSettings): RegistrationDisposer;
180
- /**
181
- * Registers a menu item for a predefined menu component.
182
- * @param Component The component to be rendered within the menu.
183
- * @param settings The optional configuration for the menu item.
184
- */
185
- registerMenu(Component: AnyComponent<MenuComponentProps>, settings?: MenuSettings): RegistrationDisposer;
186
- /**
187
- * Unregisters a menu item known by the given name.
188
- * Only previously registered menu items can be unregistered.
189
- * @param name The name of the menu item to unregister.
190
- */
191
- unregisterMenu(name: string): void;
192
- }
193
-
194
- export interface PiletNotificationsApi {
195
- /**
196
- * Shows a notification in the determined spot using the provided content.
197
- * @param content The content to display. Normally, a string would be sufficient.
198
- * @param options The options to consider for showing the notification.
199
- * @returns A callback to trigger closing the notification.
200
- */
201
- showNotification(content: string | ReactElement<any, any> | AnyComponent<NotificationComponentProps>, options?: NotificationOptions): Disposable;
202
- }
203
-
204
- export interface PiletModalsApi {
205
- /**
206
- * Shows a modal dialog with the given name.
207
- * The modal can be optionally programmatically closed using the returned callback.
208
- * @param name The name of the registered modal.
209
- * @param options Optional arguments for creating the modal.
210
- * @returns A callback to trigger closing the modal.
211
- */
212
- showModal<T>(name: T extends string ? T : string, options?: ModalOptions<T>): Disposable;
213
- /**
214
- * Registers a modal dialog using a React component.
215
- * The name needs to be unique to be used without the pilet's name.
216
- * @param name The name of the modal to register.
217
- * @param Component The component to render the page.
218
- * @param defaults Optionally, sets the default values for the inserted options.
219
- */
220
- registerModal<T>(name: T extends string ? T : string, Component: AnyComponent<ModalComponentProps<T>>, defaults?: ModalOptions<T>): RegistrationDisposer;
221
- /**
222
- * Unregisters a modal by its name.
223
- * @param name The name that was previously registered.
224
- */
225
- unregisterModal<T>(name: T extends string ? T : string): void;
226
- }
227
-
228
- export interface PiletFeedsApi {
229
- /**
230
- * Creates a connector for wrapping components with data relations.
231
- * @param resolver The resolver for the initial data set.
232
- */
233
- createConnector<T>(resolver: FeedResolver<T>): FeedConnector<T>;
234
- /**
235
- * Creates a connector for wrapping components with data relations.
236
- * @param options The options for creating the connector.
237
- */
238
- createConnector<TData, TItem, TReducers extends FeedConnectorReducers<TData>>(options: FeedConnectorOptions<TData, TItem, TReducers>): FeedConnector<TData, TReducers>;
239
- }
240
-
241
- export interface PiletSearchApi {
242
- /**
243
- * Registers a search provider to respond to search queries.
244
- * The name has to be unique within the current pilet.
245
- * @param name The name of the search provider.
246
- * @param provider The callback to be used for searching.
247
- * @param settings The optional settings for the search provider.
248
- */
249
- registerSearchProvider(name: string, provider: SearchProvider, settings?: SearchSettings): RegistrationDisposer;
250
- /**
251
- * Registers a search provider to respond to search queries.
252
- * @param provider The callback to be used for searching.
253
- * @param settings The optional settings for the search provider.
254
- */
255
- registerSearchProvider(provider: SearchProvider, settings?: SearchSettings): RegistrationDisposer;
256
- /**
257
- * Unregisters a search provider known by the given name.
258
- * Only previously registered search providers can be unregistered.
259
- * @param name The name of the search provider to unregister.
260
- */
261
- unregisterSearchProvider(name: string): void;
262
- }
263
-
264
- export interface PiralAuthApi {
265
- /**
266
- * Gets the currently authenticated user, if any.
267
- */
268
- getUser(): UserInfo | undefined;
269
- }
270
-
271
- /**
272
- * Defines the shape of the data store for storing shared data.
273
- */
274
- export interface SharedData<TValue = any> {
275
- [key: string]: TValue;
276
- }
277
-
278
- /**
279
- * Defines the options to be used for storing data.
280
- */
281
- export type DataStoreOptions = DataStoreTarget | CustomDataStoreOptions;
282
-
283
- /**
284
- * Possible shapes for a component.
285
- */
286
- export type AnyComponent<T> = ComponentType<T> | FirstParametersOf<ComponentConverters<T>>;
287
-
288
- /**
289
- * The props used by a page component.
3
+
4
+ /**
5
+ * Defines the API accessible from pilets.
6
+ */
7
+ export interface PiletApi extends EventEmitter, PiletCustomApi, PiletCoreApi {
8
+ /**
9
+ * Gets the metadata of the current pilet.
10
+ */
11
+ meta: PiletMetadata;
12
+ }
13
+
14
+ /**
15
+ * The emitter for Piral app shell events.
16
+ */
17
+ export interface EventEmitter {
18
+ /**
19
+ * Attaches a new event listener.
20
+ * @param type The type of the event to listen for.
21
+ * @param callback The callback to trigger.
22
+ */
23
+ on<K extends keyof PiralEventMap>(type: K, callback: Listener<PiralEventMap[K]>): EventEmitter;
24
+ /**
25
+ * Detaches an existing event listener.
26
+ * @param type The type of the event to listen for.
27
+ * @param callback The callback to trigger.
28
+ */
29
+ off<K extends keyof PiralEventMap>(type: K, callback: Listener<PiralEventMap[K]>): EventEmitter;
30
+ /**
31
+ * Emits a new event with the given type.
32
+ * @param type The type of the event to emit.
33
+ * @param arg The payload of the event.
34
+ */
35
+ emit<K extends keyof PiralEventMap>(type: K, arg: PiralEventMap[K]): EventEmitter;
36
+ }
37
+
38
+ /**
39
+ * Custom Pilet API parts defined outside of piral-core.
40
+ */
41
+ export interface PiletCustomApi extends PiletLocaleApi, PiletDashboardApi, PiletMenuApi, PiletNotificationsApi, PiletModalsApi, PiletFeedsApi, PiletSearchApi, PiletAuthApi {}
42
+
43
+ /**
44
+ * Defines the Pilet API from piral-core.
45
+ * This interface will be consumed by pilet developers so that their pilet can interact with the piral instance.
46
+ */
47
+ export interface PiletCoreApi {
48
+ /**
49
+ * Gets a shared data value.
50
+ * @param name The name of the data to retrieve.
51
+ */
52
+ getData<TKey extends string>(name: TKey): SharedData[TKey];
53
+ /**
54
+ * Sets the data using a given name. The name needs to be used exclusively by the current pilet.
55
+ * Using the name occupied by another pilet will result in no change.
56
+ * @param name The name of the data to store.
57
+ * @param value The value of the data to store.
58
+ * @param options The optional configuration for storing this piece of data.
59
+ * @returns True if the data could be set, otherwise false.
60
+ */
61
+ setData<TKey extends string>(name: TKey, value: SharedData[TKey], options?: DataStoreOptions): boolean;
62
+ /**
63
+ * Registers a route for predefined page component.
64
+ * The route needs to be unique and can contain params.
65
+ * Params are following the path-to-regexp notation, e.g., :id for an id parameter.
66
+ * @param route The route to register.
67
+ * @param Component The component to render the page.
68
+ * @param meta The optional metadata to use.
69
+ */
70
+ registerPage(route: string, Component: AnyComponent<PageComponentProps>, meta?: PiralPageMeta): RegistrationDisposer;
71
+ /**
72
+ * Unregisters the page identified by the given route.
73
+ * @param route The route that was previously registered.
74
+ */
75
+ unregisterPage(route: string): void;
76
+ /**
77
+ * Registers an extension component with a predefined extension component.
78
+ * The name must refer to the extension slot.
79
+ * @param name The global name of the extension slot.
80
+ * @param Component The component to be rendered.
81
+ * @param defaults Optionally, sets the default values for the expected data.
82
+ */
83
+ registerExtension<TName>(name: TName extends string ? TName : string, Component: AnyExtensionComponent<TName>, defaults?: Partial<ExtensionParams<TName>>): RegistrationDisposer;
84
+ /**
85
+ * Unregisters a global extension component.
86
+ * Only previously registered extension components can be unregistered.
87
+ * @param name The name of the extension slot to unregister from.
88
+ * @param Component The registered extension component to unregister.
89
+ */
90
+ unregisterExtension<TName>(name: TName extends string ? TName : string, Component: AnyExtensionComponent<TName>): void;
91
+ /**
92
+ * React component for displaying extensions for a given name.
93
+ * @param props The extension's rendering props.
94
+ * @return The created React element.
95
+ */
96
+ Extension<TName>(props: ExtensionSlotProps<TName>): React.ReactElement | null;
97
+ /**
98
+ * Renders an extension in a plain DOM component.
99
+ * @param element The DOM element or shadow root as a container for rendering the extension.
100
+ * @param props The extension's rendering props.
101
+ * @return The disposer to clear the extension.
102
+ */
103
+ renderHtmlExtension<TName>(element: HTMLElement | ShadowRoot, props: ExtensionSlotProps<TName>): Disposable;
104
+ }
105
+
106
+ /**
107
+ * Describes the metadata of a pilet available in its API.
108
+ */
109
+ export interface PiletMetadata {
110
+ /**
111
+ * The name of the pilet, i.e., the package id.
112
+ */
113
+ name: string;
114
+ /**
115
+ * The version of the pilet. Should be semantically versioned.
116
+ */
117
+ version: string;
118
+ /**
119
+ * Provides the version of the specification for this pilet.
120
+ */
121
+ spec: string;
122
+ /**
123
+ * Provides some custom metadata for the pilet.
124
+ */
125
+ custom?: any;
126
+ /**
127
+ * Optionally indicates the global require reference, if any.
128
+ */
129
+ requireRef?: string;
130
+ /**
131
+ * Additional shared dependencies from the pilet.
132
+ */
133
+ dependencies: Record<string, string>;
134
+ /**
135
+ * Provides some configuration to be used in the pilet.
136
+ */
137
+ config: Record<string, any>;
138
+ /**
139
+ * The URL of the main script of the pilet.
140
+ */
141
+ link: string;
142
+ /**
143
+ * The base path to the pilet. Can be used to make resource requests
144
+ * and override the public path.
145
+ */
146
+ basePath: string;
147
+ }
148
+
149
+ /**
150
+ * Listener for Piral app shell events.
151
+ */
152
+ export interface Listener<T> {
153
+ /**
154
+ * Receives an event of type T.
155
+ */
156
+ (arg: T): void;
157
+ }
158
+
159
+ /**
160
+ * The map of known Piral app shell events.
161
+ */
162
+ export interface PiralEventMap extends PiralCustomEventMap {
163
+ "unload-pilet": PiralUnloadPiletEvent;
164
+ [custom: string]: any;
165
+ "store-data": PiralStoreDataEvent;
166
+ }
167
+
168
+ export interface PiletLocaleApi {
169
+ /**
170
+ * Adds a list of translations to the existing translations.
171
+ *
172
+ * Internally, setTranslations is used, which means the translations will be exclusively used for
173
+ * retrieving translations for the pilet.
174
+ * @param messagesList The list of messages that extend the existing translations
175
+ * @param isOverriding Indicates whether the new translations overwrite the existing translations
176
+ */
177
+ addTranslations(messagesList: Array<LocalizationMessages>, isOverriding?: boolean): void;
178
+ /**
179
+ * Gets the currently selected language directly.
180
+ */
181
+ getCurrentLanguage(): string;
182
+ /**
183
+ * Gets the currently selected language in a callback that is also invoked when the
184
+ * selected language changes. Returns a disposable to stop the notifications.
185
+ */
186
+ getCurrentLanguage(cb: (currently: string) => void): Disposable;
187
+ /**
188
+ * Translates the given tag (using the optional variables) into a string using the current language.
189
+ * The used template can contain placeholders in form of `{{variableName}}`.
190
+ * @param tag The tag to translate.
191
+ * @param variables The optional variables to fill into the temnplate.
192
+ */
193
+ translate<T extends object = Record<string, string>>(tag: string, variables?: T): string;
194
+ /**
195
+ * Provides translations to the application.
196
+ * The translations will be exclusively used for retrieving translations for the pilet.
197
+ * @param messages The messages to use as translation basis.
198
+ */
199
+ setTranslations(messages: LocalizationMessages): void;
200
+ /**
201
+ * Gets the currently provided translations by the pilet.
202
+ */
203
+ getTranslations(): LocalizationMessages;
204
+ }
205
+
206
+ export interface PiletDashboardApi {
207
+ /**
208
+ * Registers a tile with a predefined tile components.
209
+ * The name has to be unique within the current pilet.
210
+ * @param name The name of the tile.
211
+ * @param Component The component to be rendered within the Dashboard.
212
+ * @param preferences The optional preferences to be supplied to the Dashboard for the tile.
213
+ */
214
+ registerTile(name: string, Component: AnyComponent<TileComponentProps>, preferences?: TilePreferences): RegistrationDisposer;
215
+ /**
216
+ * Registers a tile for predefined tile components.
217
+ * @param Component The component to be rendered within the Dashboard.
218
+ * @param preferences The optional preferences to be supplied to the Dashboard for the tile.
219
+ */
220
+ registerTile(Component: AnyComponent<TileComponentProps>, preferences?: TilePreferences): RegistrationDisposer;
221
+ /**
222
+ * Unregisters a tile known by the given name.
223
+ * Only previously registered tiles can be unregistered.
224
+ * @param name The name of the tile to unregister.
225
+ */
226
+ unregisterTile(name: string): void;
227
+ }
228
+
229
+ export interface PiletMenuApi {
230
+ /**
231
+ * Registers a menu item for a predefined menu component.
232
+ * The name has to be unique within the current pilet.
233
+ * @param name The name of the menu item.
234
+ * @param Component The component to be rendered within the menu.
235
+ * @param settings The optional configuration for the menu item.
236
+ */
237
+ registerMenu(name: string, Component: AnyComponent<MenuComponentProps>, settings?: MenuSettings): RegistrationDisposer;
238
+ /**
239
+ * Registers a menu item for a predefined menu component.
240
+ * @param Component The component to be rendered within the menu.
241
+ * @param settings The optional configuration for the menu item.
242
+ */
243
+ registerMenu(Component: AnyComponent<MenuComponentProps>, settings?: MenuSettings): RegistrationDisposer;
244
+ /**
245
+ * Unregisters a menu item known by the given name.
246
+ * Only previously registered menu items can be unregistered.
247
+ * @param name The name of the menu item to unregister.
248
+ */
249
+ unregisterMenu(name: string): void;
250
+ }
251
+
252
+ export interface PiletNotificationsApi {
253
+ /**
254
+ * Shows a notification in the determined spot using the provided content.
255
+ * @param content The content to display. Normally, a string would be sufficient.
256
+ * @param options The options to consider for showing the notification.
257
+ * @returns A callback to trigger closing the notification.
258
+ */
259
+ showNotification(content: string | React.ReactElement<any, any> | AnyComponent<NotificationComponentProps>, options?: NotificationOptions): Disposable;
260
+ }
261
+
262
+ export interface PiletModalsApi {
263
+ /**
264
+ * Shows a modal dialog with the given name.
265
+ * The modal can be optionally programmatically closed using the returned callback.
266
+ * @param name The name of the registered modal.
267
+ * @param options Optional arguments for creating the modal.
268
+ * @returns A callback to trigger closing the modal.
269
+ */
270
+ showModal<T>(name: T extends string ? T : string, options?: ModalOptions<T>): Disposable;
271
+ /**
272
+ * Registers a modal dialog using a React component.
273
+ * The name needs to be unique to be used without the pilet's name.
274
+ * @param name The name of the modal to register.
275
+ * @param Component The component to render the page.
276
+ * @param defaults Optionally, sets the default values for the inserted options.
277
+ * @param layout Optionally, sets the layout options for the dialog wrapper.
278
+ */
279
+ registerModal<T>(name: T extends string ? T : string, Component: AnyComponent<ModalComponentProps<T>>, defaults?: ModalOptions<T>, layout?: ModalLayoutOptions): RegistrationDisposer;
280
+ /**
281
+ * Unregisters a modal by its name.
282
+ * @param name The name that was previously registered.
283
+ */
284
+ unregisterModal<T>(name: T extends string ? T : string): void;
285
+ }
286
+
287
+ export interface PiletFeedsApi {
288
+ /**
289
+ * Creates a connector for wrapping components with data relations.
290
+ * @param resolver The resolver for the initial data set.
291
+ */
292
+ createConnector<T>(resolver: FeedResolver<T>): FeedConnector<T>;
293
+ /**
294
+ * Creates a connector for wrapping components with data relations.
295
+ * @param options The options for creating the connector.
296
+ */
297
+ createConnector<TData, TItem, TReducers extends FeedConnectorReducers<TData>>(options: FeedConnectorOptions<TData, TItem, TReducers>): FeedConnector<TData, TReducers>;
298
+ }
299
+
300
+ export interface PiletSearchApi {
301
+ /**
302
+ * Registers a search provider to respond to search queries.
303
+ * The name has to be unique within the current pilet.
304
+ * @param name The name of the search provider.
305
+ * @param provider The callback to be used for searching.
306
+ * @param settings The optional settings for the search provider.
307
+ */
308
+ registerSearchProvider(name: string, provider: SearchProvider, settings?: SearchSettings): RegistrationDisposer;
309
+ /**
310
+ * Registers a search provider to respond to search queries.
311
+ * @param provider The callback to be used for searching.
312
+ * @param settings The optional settings for the search provider.
313
+ */
314
+ registerSearchProvider(provider: SearchProvider, settings?: SearchSettings): RegistrationDisposer;
315
+ /**
316
+ * Unregisters a search provider known by the given name.
317
+ * Only previously registered search providers can be unregistered.
318
+ * @param name The name of the search provider to unregister.
319
+ */
320
+ unregisterSearchProvider(name: string): void;
321
+ }
322
+
323
+ export interface PiletAuthApi {
324
+ /**
325
+ * Gets the currently authenticated user, if any.
326
+ */
327
+ getUser(): UserInfo | undefined;
328
+ }
329
+
330
+ /**
331
+ * Defines the shape of the data store for storing shared data.
332
+ */
333
+ export interface SharedData<TValue = any> {
334
+ [key: string]: TValue;
335
+ }
336
+
337
+ /**
338
+ * Defines the options to be used for storing data.
339
+ */
340
+ export type DataStoreOptions = DataStoreTarget | CustomDataStoreOptions;
341
+
342
+ /**
343
+ * Possible shapes for a component.
344
+ */
345
+ export type AnyComponent<T> = React.ComponentType<T> | FirstParametersOf<ComponentConverters<T>>;
346
+
347
+ /**
348
+ * The props used by a page component.
349
+ */
350
+ export interface PageComponentProps<T extends {
351
+ [K in keyof T]?: string;
352
+ } = {}, S = any> extends RouteBaseProps<T, S> {
353
+ /**
354
+ * The meta data registered with the page.
355
+ */
356
+ meta: PiralPageMeta;
357
+ /**
358
+ * The children of the page.
359
+ */
360
+ children: React.ReactNode;
361
+ }
362
+
363
+ /**
364
+ * The meta data registered for a page.
365
+ */
366
+ export interface PiralPageMeta extends PiralCustomPageMeta, PiralCustomPageMeta {}
367
+
368
+ /**
369
+ * The shape of an implicit unregister function.
370
+ */
371
+ export interface RegistrationDisposer {
372
+ /**
373
+ * Cleans up the previous registration.
374
+ */
375
+ (): void;
376
+ }
377
+
378
+ /**
379
+ * Shorthand for the definition of an extension component.
380
+ */
381
+ export type AnyExtensionComponent<TName> = TName extends keyof PiralExtensionSlotMap ? AnyComponent<ExtensionComponentProps<TName>> : TName extends string ? AnyComponent<ExtensionComponentProps<any>> : AnyComponent<ExtensionComponentProps<TName>>;
382
+
383
+ /**
384
+ * Gives the extension params shape for the given extension slot name.
385
+ */
386
+ export type ExtensionParams<TName> = TName extends keyof PiralExtensionSlotMap ? PiralExtensionSlotMap[TName] : TName extends string ? any : TName;
387
+
388
+ /**
389
+ * The props for defining an extension slot.
390
+ */
391
+ export type ExtensionSlotProps<TName = string> = BaseExtensionSlotProps<TName extends string ? TName : string, ExtensionParams<TName>>;
392
+
393
+ /**
394
+ * Can be implemented by functions to be used for disposal purposes.
395
+ */
396
+ export interface Disposable {
397
+ /**
398
+ * Disposes the created resource.
399
+ */
400
+ (): void;
401
+ }
402
+
403
+ /**
404
+ * Custom events defined outside of piral-core.
405
+ */
406
+ export interface PiralCustomEventMap {
407
+ "select-language": PiralSelectLanguageEvent;
408
+ "change-user": PiralChangeUserEvent;
409
+ }
410
+
411
+ /**
412
+ * Gets fired when a pilet gets unloaded.
413
+ */
414
+ export interface PiralUnloadPiletEvent {
415
+ /**
416
+ * The name of the pilet to be unloaded.
417
+ */
418
+ name: string;
419
+ }
420
+
421
+ /**
422
+ * Gets fired when a data item gets stored in piral.
423
+ */
424
+ export interface PiralStoreDataEvent<TValue = any> {
425
+ /**
426
+ * The name of the item that was stored.
427
+ */
428
+ name: string;
429
+ /**
430
+ * The storage target of the item.
431
+ */
432
+ target: string;
433
+ /**
434
+ * The value that was stored.
435
+ */
436
+ value: TValue;
437
+ /**
438
+ * The owner of the item.
439
+ */
440
+ owner: string;
441
+ /**
442
+ * The expiration of the item.
443
+ */
444
+ expires: number;
445
+ }
446
+
447
+ export interface LocalizationMessages {
448
+ [lang: string]: Translations;
449
+ }
450
+
451
+ export type TileComponentProps = BaseComponentProps & BareTileComponentProps;
452
+
453
+ export interface TilePreferences extends PiralCustomTilePreferences {
454
+ /**
455
+ * Sets the desired initial number of columns.
456
+ * This may be overridden either by the user (if resizable true), or by the dashboard.
457
+ */
458
+ initialColumns?: number;
459
+ /**
460
+ * Sets the desired initial number of rows.
461
+ * This may be overridden either by the user (if resizable true), or by the dashboard.
462
+ */
463
+ initialRows?: number;
464
+ /**
465
+ * Determines if the tile can be resized by the user.
466
+ * By default the size of the tile is fixed.
467
+ */
468
+ resizable?: boolean;
469
+ /**
470
+ * Declares a set of custom properties to be used with user-specified values.
471
+ */
472
+ customProperties?: Array<string>;
473
+ }
474
+
475
+ export interface MenuComponentProps extends BaseComponentProps {}
476
+
477
+ export interface MenuSettings extends PiralCustomMenuSettings {
478
+ /**
479
+ * Sets the type of the menu to attach to.
480
+ * @default "general"
481
+ */
482
+ type?: MenuType;
483
+ }
484
+
485
+ export type NotificationComponentProps = BaseComponentProps & BareNotificationProps;
486
+
487
+ export interface NotificationOptions extends PiralCustomNotificationOptions {
488
+ /**
489
+ * The title of the notification, if any.
490
+ */
491
+ title?: string;
492
+ /**
493
+ * Determines when the notification should automatically close in milliseconds.
494
+ * A value of 0 or undefined forces the user to close the notification.
495
+ */
496
+ autoClose?: number;
497
+ /**
498
+ * The type of the notification used when displaying the message.
499
+ * By default info is used.
290
500
  */
291
- export interface PageComponentProps<T = any, S = any> extends RouteBaseProps<T, S> {}
501
+ type?: "info" | "success" | "warning" | "error";
502
+ }
503
+
504
+ export type ModalOptions<T> = T extends keyof PiralModalsMap ? PiralModalsMap[T] & BaseModalOptions : T extends string ? BaseModalOptions : T;
505
+
506
+ export type ModalComponentProps<T> = BaseComponentProps & BareModalComponentProps<ModalOptions<T>>;
292
507
 
508
+ /**
509
+ * The options provided for the dialog layout.
510
+ */
511
+ export interface ModalLayoutOptions {}
512
+
513
+ export interface FeedResolver<TData> {
293
514
  /**
294
- * The meta data registered for a page.
515
+ * Function to derive the initial set of data.
516
+ * @returns The promise for retrieving the initial data set.
295
517
  */
296
- export interface PiralPageMeta extends PiralCustomPageMeta {}
518
+ (): Promise<TData>;
519
+ }
297
520
 
521
+ export type FeedConnector<TData, TReducers = {}> = GetActions<TReducers> & {
522
+ /**
523
+ * Connector function for wrapping a component.
524
+ * @param component The component to connect by providing a data prop.
525
+ */
526
+ <TProps>(component: React.ComponentType<TProps & FeedConnectorProps<TData>>): React.FC<TProps>;
298
527
  /**
299
- * The shape of an implicit unregister function.
528
+ * Invalidates the underlying feed connector.
529
+ * Forces a reload on next use.
300
530
  */
301
- export interface RegistrationDisposer {
302
- (): void;
303
- }
304
-
305
- /**
306
- * The props of an extension component.
307
- */
308
- export interface ExtensionComponentProps<T> extends BaseComponentProps {
309
- /**
310
- * The provided parameters for showing the extension.
311
- */
312
- params: T extends keyof PiralExtensionSlotMap ? PiralExtensionSlotMap[T] : T extends string ? any : T;
313
- }
531
+ invalidate(): void;
532
+ };
314
533
 
534
+ export interface FeedConnectorOptions<TData, TItem, TReducers extends FeedConnectorReducers<TData> = {}> {
535
+ /**
536
+ * Function to derive the initial set of data.
537
+ * @returns The promise for retrieving the initial data set.
538
+ */
539
+ initialize: FeedResolver<TData>;
540
+ /**
541
+ * Function to be called for connecting to a live data feed.
542
+ * @param callback The function to call when an item updated.
543
+ * @returns A callback for disconnecting from the feed.
544
+ */
545
+ connect?: FeedSubscriber<TItem>;
315
546
  /**
316
- * The props for defining an extension slot.
547
+ * Function to be called when some data updated.
548
+ * @param data The current set of data.
549
+ * @param item The updated item to include.
550
+ * @returns The promise for retrieving the updated data set or the updated data set.
317
551
  */
318
- export type ExtensionSlotProps<K = string> = BaseExtensionSlotProps<K extends string ? K : string, K extends keyof PiralExtensionSlotMap ? PiralExtensionSlotMap[K] : K extends string ? any : K>;
552
+ update?: FeedReducer<TData, TItem>;
553
+ /**
554
+ * Defines the optional reducers for modifying the data state.
555
+ */
556
+ reducers?: TReducers;
557
+ /**
558
+ * Optional flag to avoid lazy loading and initialize the data directly.
559
+ */
560
+ immediately?: boolean;
561
+ }
562
+
563
+ export interface FeedConnectorReducers<TData> {
564
+ [name: string]: (data: TData, ...args: any) => Promise<TData> | TData;
565
+ }
319
566
 
320
- export interface ReactElement<P = any, T extends string | JSXElementConstructor<any> = string | JSXElementConstructor<any>> {
321
- type: T;
322
- props: P;
323
- key: Key | null;
324
- }
567
+ export interface SearchProvider {
568
+ (options: SearchOptions, api: PiletApi): Promise<SearchResultType | Array<SearchResultType>>;
569
+ }
325
570
 
571
+ export interface SearchSettings {
326
572
  /**
327
- * Can be implemented by functions to be used for disposal purposes.
573
+ * Only invoke the search provider if its an immediate search.
328
574
  */
329
- export interface Disposable {
330
- (): void;
331
- }
575
+ onlyImmediate?: boolean;
576
+ /**
577
+ * Callback to be fired when the search is cleared.
578
+ */
579
+ onClear?(): void;
580
+ /**
581
+ * Callback to be fired when an existing search is cancelled.
582
+ */
583
+ onCancel?(): void;
584
+ }
585
+
586
+ export interface UserInfo {
587
+ id: string;
588
+ firstName: string;
589
+ lastName: string;
590
+ mail: string;
591
+ language: string;
592
+ permissions: UserPermissions;
593
+ features: UserFeatures;
594
+ }
332
595
 
596
+ /**
597
+ * Defines the potential targets when storing data.
598
+ */
599
+ export type DataStoreTarget = "memory" | "local" | "remote";
600
+
601
+ /**
602
+ * Defines the custom options for storing data.
603
+ */
604
+ export interface CustomDataStoreOptions {
605
+ /**
606
+ * The target data store. By default the data is only stored in memory.
607
+ */
608
+ target?: DataStoreTarget;
333
609
  /**
334
- * The metadata response for a single pilet.
610
+ * Optionally determines when the data expires.
335
611
  */
336
- export type SinglePiletMetadata = PiletMetadataV0 | PiletMetadataV1 | PiletMetadataVx;
612
+ expires?: "never" | Date | number;
613
+ }
337
614
 
615
+ export type FirstParametersOf<T> = {
616
+ [K in keyof T]: T[K] extends (arg: any) => any ? FirstParameter<T[K]> : never;
617
+ }[keyof T];
618
+
619
+ /**
620
+ * Mapping of available component converters.
621
+ */
622
+ export interface ComponentConverters<TProps> extends PiralCustomComponentConverters<TProps> {
338
623
  /**
339
- * The metadata response for a multi pilet.
624
+ * Converts the HTML component to a framework-independent component.
625
+ * @param component The vanilla JavaScript component to be converted.
340
626
  */
341
- export type MultiPiletMetadata = PiletMetadataBundle;
627
+ html(component: HtmlComponent<TProps>): ForeignComponent<TProps>;
628
+ }
629
+
630
+ /**
631
+ * The props that every registered page component obtains.
632
+ */
633
+ export interface RouteBaseProps<UrlParams extends {
634
+ [K in keyof UrlParams]?: string;
635
+ } = {}, UrlState = any> extends ReactRouter.RouteComponentProps<UrlParams, {}, UrlState>, BaseComponentProps {}
342
636
 
637
+ /**
638
+ * Custom meta data to include for pages.
639
+ */
640
+ export interface PiralCustomPageMeta {}
641
+
642
+ /**
643
+ * The props of an extension component.
644
+ */
645
+ export interface ExtensionComponentProps<T> extends BaseComponentProps {
646
+ /**
647
+ * The provided parameters for showing the extension.
648
+ */
649
+ params: T extends keyof PiralExtensionSlotMap ? PiralExtensionSlotMap[T] : T extends string ? any : T;
343
650
  /**
344
- * Custom events defined outside of piral-core.
651
+ * The optional children to receive, if any.
345
652
  */
346
- export interface PiralCustomEventMap {
347
- "select-language": PiralSelectLanguageEvent;
348
- "change-user": PiralChangeUserEvent;
349
- }
653
+ children?: React.ReactNode;
654
+ }
350
655
 
656
+ /**
657
+ * The mapping of the existing (known) extension slots.
658
+ */
659
+ export interface PiralExtensionSlotMap extends PiralCustomExtensionSlotMap {}
660
+
661
+ /**
662
+ * The basic props for defining an extension slot.
663
+ */
664
+ export interface BaseExtensionSlotProps<TName, TParams> {
665
+ /**
666
+ * The children to transport, if any.
667
+ */
668
+ children?: React.ReactNode;
669
+ /**
670
+ * Defines what should be rendered when no components are available
671
+ * for the specified extension.
672
+ */
673
+ empty?(): React.ReactNode;
674
+ /**
675
+ * Determines if the `render` function should be called in case no
676
+ * components are available for the specified extension.
677
+ *
678
+ * If true, `empty` will be called and returned from the slot.
679
+ * If false, `render` will be called with the result of calling `empty`.
680
+ * The result of calling `render` will then be returned from the slot.
681
+ */
682
+ emptySkipsRender?: boolean;
351
683
  /**
352
- * Gets fired when a pilet gets unloaded.
684
+ * Defines the order of the components to render.
685
+ * May be more convient than using `render` w.r.t. ordering extensions
686
+ * by their supplied metadata.
687
+ * @param extensions The registered extensions.
688
+ * @returns The ordered extensions.
353
689
  */
354
- export interface PiralUnloadPiletEvent {
355
- /**
356
- * The name of the pilet to be unloaded.
357
- */
358
- name: string;
359
- }
690
+ order?(extensions: Array<ExtensionRegistration>): Array<ExtensionRegistration>;
691
+ /**
692
+ * Defines how the provided nodes should be rendered.
693
+ * @param nodes The rendered extension nodes.
694
+ * @returns The rendered nodes, i.e., an ReactElement.
695
+ */
696
+ render?(nodes: Array<React.ReactNode>): React.ReactElement<any, any> | null;
697
+ /**
698
+ * The custom parameters for the given extension.
699
+ */
700
+ params?: TParams;
701
+ /**
702
+ * The name of the extension to render.
703
+ */
704
+ name: TName;
705
+ }
706
+
707
+ export interface PiralSelectLanguageEvent {
708
+ /**
709
+ * Gets the previously selected language.
710
+ */
711
+ previousLanguage: string;
712
+ /**
713
+ * Gets the currently selected language.
714
+ */
715
+ currentLanguage: string;
716
+ }
717
+
718
+ export interface PiralChangeUserEvent {
719
+ previous: UserInfo;
720
+ current: UserInfo;
721
+ }
722
+
723
+ export interface Translations {
724
+ [tag: string]: string;
725
+ }
726
+
727
+ /**
728
+ * The props that every registered component obtains.
729
+ */
730
+ export interface BaseComponentProps {
731
+ /**
732
+ * The currently used pilet API.
733
+ */
734
+ piral: PiletApi;
735
+ }
736
+
737
+ export interface BareTileComponentProps {
738
+ /**
739
+ * The currently used number of columns.
740
+ */
741
+ columns: number;
742
+ /**
743
+ * The currently used number of rows.
744
+ */
745
+ rows: number;
746
+ }
747
+
748
+ export interface PiralCustomTilePreferences {}
749
+
750
+ export interface PiralCustomMenuSettings {}
360
751
 
752
+ export type MenuType = StandardMenuType | keyof PiralCustomMenuTypes;
753
+
754
+ export interface BareNotificationProps {
755
+ /**
756
+ * Callback for closing the notification programmatically.
757
+ */
758
+ onClose(): void;
759
+ /**
760
+ * Provides the passed in options for this particular notification.
761
+ */
762
+ options: NotificationOptions;
763
+ }
764
+
765
+ export interface PiralCustomNotificationOptions {}
766
+
767
+ export interface BaseModalOptions {}
768
+
769
+ export interface PiralModalsMap extends PiralCustomModalsMap {}
770
+
771
+ export interface BareModalComponentProps<TOpts> {
772
+ /**
773
+ * Callback for closing the modal programmatically.
774
+ */
775
+ onClose(): void;
776
+ /**
777
+ * Provides the passed in options for this particular modal.
778
+ */
779
+ options?: TOpts;
780
+ }
781
+
782
+ export type GetActions<TReducers> = {
783
+ [P in keyof TReducers]: (...args: RemainingArgs<TReducers[P]>) => void;
784
+ };
785
+
786
+ export interface FeedConnectorProps<TData> {
787
+ /**
788
+ * The current data from the feed.
789
+ */
790
+ data: TData;
791
+ }
792
+
793
+ export interface FeedSubscriber<TItem> {
794
+ (callback: (value: TItem) => void): Disposable;
795
+ }
796
+
797
+ export interface FeedReducer<TData, TAction> {
798
+ (data: TData, item: TAction): Promise<TData> | TData;
799
+ }
800
+
801
+ export interface SearchOptions {
802
+ /**
803
+ * Gets the query for the search. This is currently available input
804
+ * value.
805
+ */
806
+ query: string;
807
+ /**
808
+ * Gets if the search was requested immediately, e.g., via pressing
809
+ * the enter key.
810
+ */
811
+ immediate: boolean;
812
+ }
813
+
814
+ export type SearchResultType = string | React.ReactElement<any> | AnyComponent<SearchResultComponentProps>;
815
+
816
+ export type UserPermissions = Record<string, any>;
817
+
818
+ export type UserFeatures = Record<string, boolean>;
819
+
820
+ export type FirstParameter<T extends (arg: any) => any> = T extends (arg: infer P) => any ? P : never;
821
+
822
+ /**
823
+ * Custom component converters defined outside of piral-core.
824
+ */
825
+ export interface PiralCustomComponentConverters<TProps> {}
826
+
827
+ /**
828
+ * Definition of a vanilla JavaScript component.
829
+ */
830
+ export interface HtmlComponent<TProps> {
831
+ /**
832
+ * Renders a component into the provided element using the given props and context.
833
+ */
834
+ component: ForeignComponent<TProps>;
835
+ /**
836
+ * The type of the HTML component.
837
+ */
838
+ type: "html";
839
+ }
840
+
841
+ /**
842
+ * Generic definition of a framework-independent component.
843
+ */
844
+ export interface ForeignComponent<TProps> {
845
+ /**
846
+ * Called when the component is mounted.
847
+ * @param element The container hosting the element.
848
+ * @param props The props to transport.
849
+ * @param ctx The associated context.
850
+ * @param locals The local state of this component instance.
851
+ */
852
+ mount(element: HTMLElement, props: TProps, ctx: ComponentContext, locals: Record<string, any>): void;
853
+ /**
854
+ * Called when the component should be updated.
855
+ * @param element The container hosting the element.
856
+ * @param props The props to transport.
857
+ * @param ctx The associated context.
858
+ * @param locals The local state of this component instance.
859
+ */
860
+ update?(element: HTMLElement, props: TProps, ctx: ComponentContext, locals: Record<string, any>): void;
861
+ /**
862
+ * Called when a component is unmounted.
863
+ * @param element The container that was hosting the element.
864
+ * @param locals The local state of this component instance.
865
+ */
866
+ unmount?(element: HTMLElement, locals: Record<string, any>): void;
867
+ }
868
+
869
+ /**
870
+ * Custom extension slots outside of piral-core.
871
+ */
872
+ export interface PiralCustomExtensionSlotMap {}
873
+
874
+ /**
875
+ * The interface modeling the registration of a pilet extension component.
876
+ */
877
+ export interface ExtensionRegistration extends BaseRegistration {
878
+ /**
879
+ * The wrapped registered extension component.
880
+ */
881
+ component: WrappedComponent<ExtensionComponentProps<string>>;
882
+ /**
883
+ * The original extension component that has been registered.
884
+ */
885
+ reference: any;
886
+ /**
887
+ * The default params (i.e., meta) of the extension.
888
+ */
889
+ defaults: any;
890
+ }
891
+
892
+ export type StandardMenuType = "general" | "admin" | "user" | "header" | "footer";
893
+
894
+ export interface PiralCustomMenuTypes {}
895
+
896
+ export interface PiralCustomModalsMap {}
897
+
898
+ export type RemainingArgs<T> = T extends (_: any, ...args: infer U) => any ? U : never;
899
+
900
+ export interface SearchResultComponentProps extends BaseComponentProps {}
901
+
902
+ /**
903
+ * The context to be transported into the generic components.
904
+ */
905
+ export interface ComponentContext {
906
+ /**
907
+ * The router-independent navigation API.
908
+ */
909
+ navigation: NavigationApi;
910
+ /**
911
+ * The internal router object.
912
+ * @deprecated Exposes internals that can change at any time.
913
+ */
914
+ router: any;
915
+ /**
916
+ * The public path of the application.
917
+ */
918
+ publicPath: string;
919
+ }
920
+
921
+ /**
922
+ * The base type for pilet component registration in the global state context.
923
+ */
924
+ export interface BaseRegistration {
925
+ /**
926
+ * The pilet registering the component.
927
+ */
928
+ pilet: string;
929
+ }
930
+
931
+ export type WrappedComponent<TProps> = React.ComponentType<React.PropsWithChildren<Without<TProps, keyof BaseComponentProps>>>;
932
+
933
+ export interface NavigationApi {
934
+ /**
935
+ * Pushes a new location onto the history stack.
936
+ */
937
+ push(target: string, state?: any): void;
938
+ /**
939
+ * Replaces the current location with another.
940
+ */
941
+ replace(target: string, state?: any): void;
942
+ /**
943
+ * Changes the current index in the history stack by a given delta.
944
+ */
945
+ go(n: number): void;
946
+ /**
947
+ * Prevents changes to the history stack from happening.
948
+ * This is useful when you want to prevent the user navigating
949
+ * away from the current page, for example when they have some
950
+ * unsaved data on the current page.
951
+ * @param blocker The function being called with a transition request.
952
+ * @returns The disposable for stopping the block.
953
+ */
954
+ block(blocker: NavigationBlocker): Disposable;
955
+ /**
956
+ * Starts listening for location changes and calls the given
957
+ * callback with an Update when it does.
958
+ * @param listener The function being called when the route changes.
959
+ * @returns The disposable for stopping the block.
960
+ */
961
+ listen(listener: NavigationListener): Disposable;
962
+ /**
963
+ * Gets the current navigation / application path.
964
+ */
965
+ path: string;
966
+ /**
967
+ * Gets the current navigation path incl. search and hash parts.
968
+ */
969
+ url: string;
970
+ /**
971
+ * The original router behind the navigation. Don't depend on this
972
+ * as the implementation is router specific and may change over time.
973
+ */
974
+ router: any;
975
+ }
976
+
977
+ export type Without<T, K> = Pick<T, Exclude<keyof T, K>>;
978
+
979
+ export interface NavigationBlocker {
980
+ (tx: NavigationTransition): void;
981
+ }
982
+
983
+ export interface NavigationListener {
984
+ (update: NavigationUpdate): void;
985
+ }
986
+
987
+ export interface NavigationTransition extends NavigationUpdate {
988
+ retry?(): void;
989
+ }
990
+
991
+ export interface NavigationUpdate {
992
+ action: NavigationAction;
993
+ location: NavigationLocation;
994
+ }
995
+
996
+ export type NavigationAction = "POP" | "PUSH" | "REPLACE";
997
+
998
+ export interface NavigationLocation {
999
+ /**
1000
+ * The fully qualified URL incl. the origin and base path.
1001
+ */
1002
+ href: string;
1003
+ /**
1004
+ * The location.pathname property is a string that contains an initial "/"
1005
+ * followed by the remainder of the URL up to the ?.
1006
+ */
1007
+ pathname: string;
1008
+ /**
1009
+ * The location.search property is a string that contains an initial "?"
1010
+ * followed by the key=value pairs in the query string. If there are no
1011
+ * parameters, this value may be the empty string (i.e. '').
1012
+ */
1013
+ search: string;
1014
+ /**
1015
+ * The location.hash property is a string that contains an initial "#"
1016
+ * followed by fragment identifier of the URL. If there is no fragment
1017
+ * identifier, this value may be the empty string (i.e. '').
1018
+ */
1019
+ hash: string;
1020
+ /**
1021
+ * The location.state property is a user-supplied State object that is
1022
+ * associated with this location. This can be a useful place to store
1023
+ * any information you do not want to put in the URL, e.g. session-specific
1024
+ * data.
1025
+ */
1026
+ state: unknown;
361
1027
  /**
362
- * Gets fired when a data item gets stored in piral.
1028
+ * The location.key property is a unique string associated with this location.
1029
+ * On the initial location, this will be the string default. On all subsequent
1030
+ * locations, this string will be a unique identifier.
363
1031
  */
364
- export interface PiralStoreDataEvent<TValue = any> {
365
- /**
366
- * The name of the item that was stored.
367
- */
368
- name: string;
369
- /**
370
- * The storage target of the item.
371
- */
372
- target: string;
373
- /**
374
- * The value that was stored.
375
- */
376
- value: TValue;
377
- /**
378
- * The owner of the item.
379
- */
380
- owner: string;
381
- /**
382
- * The expiration of the item.
383
- */
384
- expires: number;
385
- }
386
-
387
- export interface LocalizationMessages {
388
- [lang: string]: Translations;
389
- }
390
-
391
- export type TileComponentProps = BaseComponentProps & BareTileComponentProps;
392
-
393
- export interface TilePreferences extends PiralCustomTilePreferences {
394
- /**
395
- * Sets the desired initial number of columns.
396
- * This may be overridden either by the user (if resizable true), or by the dashboard.
397
- */
398
- initialColumns?: number;
399
- /**
400
- * Sets the desired initial number of rows.
401
- * This may be overridden either by the user (if resizable true), or by the dashboard.
402
- */
403
- initialRows?: number;
404
- /**
405
- * Determines if the tile can be resized by the user.
406
- * By default the size of the tile is fixed.
407
- */
408
- resizable?: boolean;
409
- /**
410
- * Declares a set of custom properties to be used with user-specified values.
411
- */
412
- customProperties?: Array<string>;
413
- }
414
-
415
- export interface MenuComponentProps extends BaseComponentProps {}
416
-
417
- export interface MenuSettings extends PiralCustomMenuSettings {
418
- /**
419
- * Sets the type of the menu to attach to.
420
- * @default "general"
421
- */
422
- type?: MenuType;
423
- }
424
-
425
- export type NotificationComponentProps = BaseComponentProps & BareNotificationProps;
426
-
427
- export interface NotificationOptions extends PiralCustomNotificationOptions {
428
- /**
429
- * The title of the notification, if any.
430
- */
431
- title?: string;
432
- /**
433
- * Determines when the notification should automatically close in milliseconds.
434
- * A value of 0 or undefined forces the user to close the notification.
435
- */
436
- autoClose?: number;
437
- /**
438
- * The type of the notification used when displaying the message.
439
- * By default info is used.
440
- */
441
- type?: "info" | "success" | "warning" | "error";
442
- }
443
-
444
- export type ModalOptions<T> = T extends keyof PiralModalsMap ? PiralModalsMap[T] & BaseModalOptions : T extends string ? BaseModalOptions : T;
445
-
446
- export type ModalComponentProps<T> = BaseComponentProps & BareModalComponentProps<ModalOptions<T>>;
447
-
448
- export interface FeedResolver<TData> {
449
- (): Promise<TData>;
450
- }
451
-
452
- export type FeedConnector<TData, TReducers = {}> = GetActions<TReducers> & {
453
- <TProps>(component: ComponentType<TProps & FeedConnectorProps<TData>>): FC<TProps>;
454
- /**
455
- * Invalidates the underlying feed connector.
456
- * Forces a reload on next use.
457
- */
458
- invalidate(): void;
459
- };
460
-
461
- export interface FeedConnectorOptions<TData, TItem, TReducers extends FeedConnectorReducers<TData> = {}> {
462
- /**
463
- * Function to derive the initial set of data.
464
- * @returns The promise for retrieving the initial data set.
465
- */
466
- initialize: FeedResolver<TData>;
467
- /**
468
- * Function to be called for connecting to a live data feed.
469
- * @param callback The function to call when an item updated.
470
- * @returns A callback for disconnecting from the feed.
471
- */
472
- connect?: FeedSubscriber<TItem>;
473
- /**
474
- * Function to be called when some data updated.
475
- * @param data The current set of data.
476
- * @param item The updated item to include.
477
- * @returns The promise for retrieving the updated data set or the updated data set.
478
- */
479
- update?: FeedReducer<TData, TItem>;
480
- /**
481
- * Defines the optional reducers for modifying the data state.
482
- */
483
- reducers?: TReducers;
484
- /**
485
- * Optional flag to avoid lazy loading and initialize the data directly.
486
- */
487
- immediately?: boolean;
488
- }
489
-
490
- export interface FeedConnectorReducers<TData> {
491
- [name: string]: (data: TData, ...args: any) => Promise<TData> | TData;
492
- }
493
-
494
- export interface SearchProvider {
495
- (options: SearchOptions, api: PiletApi): Promise<SearchResultType | Array<SearchResultType>>;
496
- }
497
-
498
- export interface SearchSettings {
499
- /**
500
- * Only invoke the search provider if its an immediate search.
501
- */
502
- onlyImmediate?: boolean;
503
- /**
504
- * Callback to be fired when the search is cleared.
505
- */
506
- onClear?(): void;
507
- /**
508
- * Callback to be fired when an existing search is cancelled.
509
- */
510
- onCancel?(): void;
511
- }
512
-
513
- export interface UserInfo {
514
- id: string;
515
- firstName: string;
516
- lastName: string;
517
- mail: string;
518
- language: string;
519
- permissions: UserPermissions;
520
- features: UserFeatures;
521
- }
522
-
523
- /**
524
- * Defines the potential targets when storing data.
525
- */
526
- export type DataStoreTarget = "memory" | "local" | "remote";
527
-
528
- /**
529
- * Defines the custom options for storing data.
530
- */
531
- export interface CustomDataStoreOptions {
532
- /**
533
- * The target data store. By default the data is only stored in memory.
534
- */
535
- target?: DataStoreTarget;
536
- /**
537
- * Optionally determines when the data expires.
538
- */
539
- expires?: "never" | Date | number;
540
- }
541
-
542
- export type ComponentType<P = {}> = ComponentClass<P> | FunctionComponent<P>;
543
-
544
- export type FirstParametersOf<T> = {
545
- [K in keyof T]: T[K] extends (arg: any) => any ? FirstParameter<T[K]> : never;
546
- }[keyof T];
547
-
548
- /**
549
- * Mapping of available component converters.
550
- */
551
- export interface ComponentConverters<TProps> extends PiralCustomComponentConverters<TProps> {
552
- /**
553
- * Converts the HTML component to a framework-independent component.
554
- * @param component The vanilla JavaScript component to be converted.
555
- */
556
- html(component: HtmlComponent<TProps>): ForeignComponent<TProps>;
557
- }
558
-
559
- /**
560
- * The props that every registered page component obtains.
561
- */
562
- export interface RouteBaseProps<UrlParams = any, UrlState = any> extends ReactRouter.RouteComponentProps<UrlParams, {}, UrlState>, BaseComponentProps {}
563
-
564
- /**
565
- * Custom meta data to include for pages.
566
- */
567
- export interface PiralCustomPageMeta {}
568
-
569
- /**
570
- * The props that every registered component obtains.
571
- */
572
- export interface BaseComponentProps {
573
- /**
574
- * The currently used pilet API.
575
- */
576
- piral: PiletApi;
577
- }
578
-
579
- /**
580
- * The mapping of the existing (known) extension slots.
581
- */
582
- export interface PiralExtensionSlotMap extends PiralCustomExtensionSlotMap {}
583
-
584
- /**
585
- * The basic props for defining an extension slot.
586
- */
587
- export interface BaseExtensionSlotProps<TName, TParams> {
588
- /**
589
- * Defines what should be rendered when no components are available
590
- * for the specified extension.
591
- */
592
- empty?(): ReactNode;
593
- /**
594
- * Defines how the provided nodes should be rendered.
595
- * @param nodes The rendered extension nodes.
596
- */
597
- render?(nodes: Array<ReactNode>): ReactElement<any, any> | null;
598
- /**
599
- * The custom parameters for the given extension.
600
- */
601
- params?: TParams;
602
- /**
603
- * The name of the extension to render.
604
- */
605
- name: TName;
606
- }
607
-
608
- export type Key = string | number;
609
-
610
- export type JSXElementConstructor<P> = ((props: P) => ReactElement | null) | (new (props: P) => Component<P, any>);
611
-
612
- /**
613
- * Metadata for pilets using the v0 schema.
614
- */
615
- export type PiletMetadataV0 = PiletMetadataV0Content | PiletMetadataV0Link;
616
-
617
- /**
618
- * Metadata for pilets using the v1 schema.
619
- */
620
- export interface PiletMetadataV1 {
621
- /**
622
- * The name of the pilet, i.e., the package id.
623
- */
624
- name: string;
625
- /**
626
- * The version of the pilet. Should be semantically versioned.
627
- */
628
- version: string;
629
- /**
630
- * Optionally provides the version of the specification for this pilet.
631
- */
632
- spec?: "v1";
633
- /**
634
- * The link for retrieving the content of the pilet.
635
- */
636
- link: string;
637
- /**
638
- * The reference name for the global require.
639
- */
640
- requireRef: string;
641
- /**
642
- * The computed integrity of the pilet. Will be used to set the
643
- * integrity value of the script.
644
- */
645
- integrity?: string;
646
- /**
647
- * Optionally provides some custom metadata for the pilet.
648
- */
649
- custom?: any;
650
- /**
651
- * Optionally provides some configuration to be used in the pilet.
652
- */
653
- config?: Record<string, any>;
654
- }
655
-
656
- export interface PiletMetadataVx {
657
- /**
658
- * The name of the pilet, i.e., the package id.
659
- */
660
- name: string;
661
- /**
662
- * The version of the pilet. Should be semantically versioned.
663
- */
664
- version: string;
665
- /**
666
- * Provides an identifier for the custom specification.
667
- */
668
- spec: string;
669
- /**
670
- * Optionally provides some custom metadata for the pilet.
671
- */
672
- custom?: any;
673
- /**
674
- * Optionally provides some configuration to be used in the pilet.
675
- */
676
- config?: Record<string, any>;
677
- }
678
-
679
- /**
680
- * Metadata for pilets using the bundle schema.
681
- */
682
- export interface PiletMetadataBundle {
683
- /**
684
- * The name of the bundle pilet, i.e., the package id.
685
- */
686
- name?: string;
687
- /**
688
- * Optionally provides the version of the specification for this pilet.
689
- */
690
- spec?: "v1";
691
- /**
692
- * The link for retrieving the bundle content of the pilet.
693
- */
694
- link: string;
695
- /**
696
- * The reference name for the global bundle-shared require.
697
- */
698
- bundle: string;
699
- /**
700
- * The computed integrity of the pilet. Will be used to set the
701
- * integrity value of the script.
702
- */
703
- integrity?: string;
704
- /**
705
- * Optionally provides some custom metadata for the pilet.
706
- */
707
- custom?: any;
708
- }
709
-
710
- export interface PiralSelectLanguageEvent {
711
- /**
712
- * Gets the previously selected language.
713
- */
714
- previousLanguage: string;
715
- /**
716
- * Gets the currently selected language.
717
- */
718
- currentLanguage: string;
719
- }
720
-
721
- export interface PiralChangeUserEvent {
722
- previous: UserInfo;
723
- current: UserInfo;
724
- }
725
-
726
- export interface Translations {
727
- [tag: string]: string;
728
- }
729
-
730
- export interface BareTileComponentProps {
731
- /**
732
- * The currently used number of columns.
733
- */
734
- columns: number;
735
- /**
736
- * The currently used number of rows.
737
- */
738
- rows: number;
739
- }
740
-
741
- export interface PiralCustomTilePreferences {}
742
-
743
- export interface PiralCustomMenuSettings {}
744
-
745
- export type MenuType = StandardMenuType | keyof PiralCustomMenuTypes;
746
-
747
- export interface BareNotificationProps {
748
- /**
749
- * Callback for closing the notification programmatically.
750
- */
751
- onClose(): void;
752
- /**
753
- * Provides the passed in options for this particular notification.
754
- */
755
- options: NotificationOptions;
756
- }
757
-
758
- export interface PiralCustomNotificationOptions {}
759
-
760
- export interface BaseModalOptions {}
761
-
762
- export interface PiralModalsMap extends PiralCustomModalsMap {}
763
-
764
- export interface BareModalComponentProps<TOpts> {
765
- /**
766
- * Callback for closing the modal programmatically.
767
- */
768
- onClose(): void;
769
- /**
770
- * Provides the passed in options for this particular modal.
771
- */
772
- options?: TOpts;
773
- }
774
-
775
- export type GetActions<TReducers> = {
776
- [P in keyof TReducers]: (...args: RemainingArgs<TReducers[P]>) => void;
777
- };
778
-
779
- export interface FeedConnectorProps<TData> {
780
- /**
781
- * The current data from the feed.
782
- */
783
- data: TData;
784
- }
785
-
786
- export type FC<P = {}> = FunctionComponent<P>;
787
-
788
- export interface FeedSubscriber<TItem> {
789
- (callback: (value: TItem) => void): Disposable;
790
- }
791
-
792
- export interface FeedReducer<TData, TAction> {
793
- (data: TData, item: TAction): Promise<TData> | TData;
794
- }
795
-
796
- export interface SearchOptions {
797
- /**
798
- * Gets the query for the search. This is currently available input
799
- * value.
800
- */
801
- query: string;
802
- /**
803
- * Gets if the search was requested immediately, e.g., via pressing
804
- * the enter key.
805
- */
806
- immediate: boolean;
807
- }
808
-
809
- export type SearchResultType = string | ReactElement<any> | AnyComponent<SearchResultComponentProps>;
810
-
811
- export type UserPermissions = Record<string, any>;
812
-
813
- export type UserFeatures = Record<string, boolean>;
814
-
815
- export interface ComponentClass<P = {}, S = ComponentState> extends StaticLifecycle<P, S> {
816
- new (props: P, context?: any): Component<P, S>;
817
- propTypes?: WeakValidationMap<P>;
818
- contextType?: Context<any>;
819
- contextTypes?: ValidationMap<any>;
820
- childContextTypes?: ValidationMap<any>;
821
- defaultProps?: Partial<P>;
822
- displayName?: string;
823
- }
824
-
825
- export interface FunctionComponent<P = {}> {
826
- (props: PropsWithChildren<P>, context?: any): ReactElement<any, any> | null;
827
- propTypes?: WeakValidationMap<P>;
828
- contextTypes?: ValidationMap<any>;
829
- defaultProps?: Partial<P>;
830
- displayName?: string;
831
- }
832
-
833
- export type FirstParameter<T extends (arg: any) => any> = T extends (arg: infer P) => any ? P : never;
834
-
835
- /**
836
- * Custom component converters defined outside of piral-core.
837
- */
838
- export interface PiralCustomComponentConverters<TProps> {}
839
-
840
- /**
841
- * Definition of a vanilla JavaScript component.
842
- */
843
- export interface HtmlComponent<TProps> {
844
- /**
845
- * Renders a component into the provided element using the given props and context.
846
- */
847
- component: ForeignComponent<TProps>;
848
- /**
849
- * The type of the HTML component.
850
- */
851
- type: "html";
852
- }
853
-
854
- /**
855
- * Generic definition of a framework-independent component.
856
- */
857
- export interface ForeignComponent<TProps> {
858
- /**
859
- * Called when the component is mounted.
860
- * @param element The container hosting the element.
861
- * @param props The props to transport.
862
- * @param ctx The associated context.
863
- */
864
- mount(element: HTMLElement, props: TProps, ctx: ComponentContext): void;
865
- /**
866
- * Called when the component should be updated.
867
- * @param element The container hosting the element.
868
- * @param props The props to transport.
869
- * @param ctx The associated context.
870
- */
871
- update?(element: HTMLElement, props: TProps, ctx: ComponentContext): void;
872
- /**
873
- * Called when a component is unmounted.
874
- * @param element The container that was hosting the element.
875
- */
876
- unmount?(element: HTMLElement): void;
877
- }
878
-
879
- /**
880
- * Custom extension slots outside of piral-core.
881
- */
882
- export interface PiralCustomExtensionSlotMap {}
883
-
884
- export type ReactNode = ReactChild | ReactFragment | ReactPortal | boolean | null | undefined;
885
-
886
- export class Component<P, S> {
887
- /**
888
- * If set, `this.context` will be set at runtime to the current value of the given Context.
889
- *
890
- * Usage:
891
- *
892
- * ```ts
893
- * type MyContext = number
894
- * const Ctx = React.createContext<MyContext>(0)
895
- *
896
- * class Foo extends React.Component {
897
- * static contextType = Ctx
898
- * context!: React.ContextType<typeof Ctx>
899
- * render () {
900
- * return <>My context's value: {this.context}</>;
901
- * }
902
- * }
903
- * ```
904
- * @see https://reactjs.org/docs/context.html#classcontexttype
905
- */
906
- static contextType: Context<any>;
907
- /**
908
- * If using the new style context, re-declare this in your class to be the
909
- * `React.ContextType` of your `static contextType`.
910
- * Should be used with type annotation or static contextType.
911
- *
912
- * ```ts
913
- * static contextType = MyContext
914
- * // For TS pre-3.7:
915
- * context!: React.ContextType<typeof MyContext>
916
- * // For TS 3.7 and above:
917
- * declare context: React.ContextType<typeof MyContext>
918
- * ```
919
- * @see https://reactjs.org/docs/context.html
920
- */
921
- context: any;
922
- constructor(props: Readonly<P> | P);
923
- constructor(props: P, context: any);
924
- setState<K extends keyof S>(state: ((prevState: Readonly<S>, props: Readonly<P>) => (Pick<S, K> | S | null)) | (Pick<S, K> | S | null), callback?: () => void): void;
925
- forceUpdate(callback?: () => void): void;
926
- render(): ReactNode;
927
- readonly props: Readonly<P> & Readonly<{
928
- children?: ReactNode;
929
- }>;
930
- state: Readonly<S>;
931
- /**
932
- * @deprecated https://reactjs.org/docs/refs-and-the-dom.html#legacy-api-string-refs
933
- */
934
- refs: {
935
- [key: string]: ReactInstance;
936
- };
937
- }
938
-
939
- /**
940
- * Metadata for pilets using the v0 schema with a content.
941
- */
942
- export interface PiletMetadataV0Content extends PiletMetadataV0Base {
943
- /**
944
- * The content of the pilet. If the content is not available
945
- * the link will be used (unless caching has been activated).
946
- */
947
- content: string;
948
- /**
949
- * If available indicates that the pilet should not be cached.
950
- * In case of a string this is interpreted as the expiration time
951
- * of the cache. In case of an accurate hash this should not be
952
- * required or set.
953
- */
954
- noCache?: boolean | string;
955
- }
956
-
957
- /**
958
- * Metadata for pilets using the v0 schema with a link.
959
- */
960
- export interface PiletMetadataV0Link extends PiletMetadataV0Base {
961
- /**
962
- * The link for retrieving the content of the pilet.
963
- */
964
- link: string;
965
- }
966
-
967
- export type StandardMenuType = "general" | "admin" | "user" | "header" | "footer";
968
-
969
- export interface PiralCustomMenuTypes {}
970
-
971
- export interface PiralCustomModalsMap {}
972
-
973
- export type RemainingArgs<T> = T extends (_: any, ...args: infer U) => any ? U : never;
974
-
975
- export interface SearchResultComponentProps extends BaseComponentProps {}
976
-
977
- export interface StaticLifecycle<P, S> {
978
- getDerivedStateFromProps?: GetDerivedStateFromProps<P, S>;
979
- getDerivedStateFromError?: GetDerivedStateFromError<P, S>;
980
- }
981
-
982
- export type WeakValidationMap<T> = {
983
- [K in keyof T]?: null extends T[K] ? Validator<T[K] | null | undefined> : undefined extends T[K] ? Validator<T[K] | null | undefined> : Validator<T[K]>;
984
- };
985
-
986
- export interface Context<T> {
987
- Provider: Provider<T>;
988
- Consumer: Consumer<T>;
989
- displayName?: string;
990
- }
991
-
992
- export type ValidationMap<T> = ValidationMap___1<T>;
993
-
994
- export type ComponentState = any;
995
-
996
- export type PropsWithChildren<P> = P & {
997
- children?: ReactNode;
998
- };
999
-
1000
- /**
1001
- * The context to be transported into the generic components.
1002
- */
1003
- export interface ComponentContext {
1004
- router: ReactRouter.RouteComponentProps;
1005
- state: LibreAtom.Atom<GlobalState>;
1006
- }
1007
-
1008
- export type ReactChild = ReactElement | ReactText;
1009
-
1010
- export type ReactFragment = {} | ReactNodeArray;
1011
-
1012
- export interface ReactPortal extends ReactElement {
1013
- key: Key | null;
1014
- children: ReactNode;
1015
- }
1016
-
1017
- export interface Component<P = {}, S = {}, SS = any> extends ComponentLifecycle<P, S, SS> {}
1018
-
1019
- export type ReactInstance = Component<any> | Element;
1020
-
1021
- /**
1022
- * Basic metadata for pilets using the v0 schema.
1023
- */
1024
- export interface PiletMetadataV0Base {
1025
- /**
1026
- * The name of the pilet, i.e., the package id.
1027
- */
1028
- name: string;
1029
- /**
1030
- * The version of the pilet. Should be semantically versioned.
1031
- */
1032
- version: string;
1033
- /**
1034
- * Optionally provides the version of the specification for this pilet.
1035
- */
1036
- spec?: "v0";
1037
- /**
1038
- * The computed hash value of the pilet's content. Should be
1039
- * accurate to allow caching.
1040
- */
1041
- hash: string;
1042
- /**
1043
- * Optionally provides some custom metadata for the pilet.
1044
- */
1045
- custom?: any;
1046
- /**
1047
- * Optionally provides some configuration to be used in the pilet.
1048
- */
1049
- config?: Record<string, any>;
1050
- }
1051
-
1052
- export type GetDerivedStateFromProps<P, S> = (nextProps: Readonly<P>, prevState: S) => Partial<S> | null;
1053
-
1054
- export type GetDerivedStateFromError<P, S> = (error: any) => Partial<S> | null;
1055
-
1056
- export type Validator<T> = Validator___1<T>;
1057
-
1058
- export type Provider<T> = ProviderExoticComponent<ProviderProps<T>>;
1059
-
1060
- export type Consumer<T> = ExoticComponent<ConsumerProps<T>>;
1061
-
1062
- export type ValidationMap___1<T> = {
1063
- [K in keyof T]?: Validator___1<T[K]>;
1064
- };
1065
-
1066
- /**
1067
- * The Piral global app state container.
1068
- */
1069
- export interface GlobalState extends PiralCustomState {
1070
- /**
1071
- * The relevant state for the app itself.
1072
- */
1073
- app: AppState;
1074
- /**
1075
- * The relevant state for rendering errors of the app.
1076
- */
1077
- errorComponents: ErrorComponentsState;
1078
- /**
1079
- * The relevant state for rendering parts of the app.
1080
- */
1081
- components: ComponentsState;
1082
- /**
1083
- * The relevant state for the registered components.
1084
- */
1085
- registry: RegistryState;
1086
- /**
1087
- * Gets the loaded modules.
1088
- */
1089
- modules: Array<PiletMetadata>;
1090
- /**
1091
- * The foreign component portals to render.
1092
- */
1093
- portals: Record<string, Array<ReactPortal>>;
1094
- /**
1095
- * The application's shared data.
1096
- */
1097
- data: Dict<SharedDataItem>;
1098
- /**
1099
- * The used (exact) application routes.
1100
- */
1101
- routes: Dict<ComponentType<ReactRouter.RouteComponentProps<any>>>;
1102
- /**
1103
- * The current provider.
1104
- */
1105
- provider?: ComponentType;
1106
- }
1107
-
1108
- export type ReactText = string | number;
1109
-
1110
- export interface ReactNodeArray extends Array<ReactNode> {}
1111
-
1112
- export interface ComponentLifecycle<P, S, SS = any> extends NewLifecycle<P, S, SS>, DeprecatedLifecycle<P, S> {
1113
- /**
1114
- * Called immediately after a component is mounted. Setting state here will trigger re-rendering.
1115
- */
1116
- componentDidMount?(): void;
1117
- /**
1118
- * Called to determine whether the change in props and state should trigger a re-render.
1119
- *
1120
- * `Component` always returns true.
1121
- * `PureComponent` implements a shallow comparison on props and state and returns true if any
1122
- * props or states have changed.
1123
- *
1124
- * If false is returned, `Component#render`, `componentWillUpdate`
1125
- * and `componentDidUpdate` will not be called.
1126
- */
1127
- shouldComponentUpdate?(nextProps: Readonly<P>, nextState: Readonly<S>, nextContext: any): boolean;
1128
- /**
1129
- * Called immediately before a component is destroyed. Perform any necessary cleanup in this method, such as
1130
- * cancelled network requests, or cleaning up any DOM elements created in `componentDidMount`.
1131
- */
1132
- componentWillUnmount?(): void;
1133
- /**
1134
- * Catches exceptions generated in descendant components. Unhandled exceptions will cause
1135
- * the entire component tree to unmount.
1136
- */
1137
- componentDidCatch?(error: Error, errorInfo: ErrorInfo): void;
1138
- }
1139
-
1140
- export interface Validator___1<T> {
1141
- (props: {
1142
- [key: string]: any;
1143
- }, propName: string, componentName: string, location: string, propFullName: string): Error | null;
1144
- "[nominalTypeHack]"?: {
1145
- type: T;
1146
- };
1147
- }
1148
-
1149
- export interface ProviderExoticComponent<P> extends ExoticComponent<P> {
1150
- propTypes?: WeakValidationMap<P>;
1151
- }
1152
-
1153
- export interface ProviderProps<T> {
1154
- value: T;
1155
- children?: ReactNode;
1156
- }
1157
-
1158
- export interface ExoticComponent<P = {}> {
1159
- (props: P): (ReactElement | null);
1160
- readonly $$typeof: symbol;
1161
- }
1162
-
1163
- export interface ConsumerProps<T> {
1164
- children(value: T): ReactNode;
1165
- }
1166
-
1167
- /**
1168
- * Custom state extensions defined outside of piral-core.
1169
- */
1170
- export interface PiralCustomState {
1171
- /**
1172
- * Information for the language display.
1173
- */
1174
- language: {
1175
- /**
1176
- * Gets if languages are currently loading.
1177
- */
1178
- loading: boolean;
1179
- /**
1180
- * The selected, i.e., active, language.
1181
- */
1182
- selected: string;
1183
- /**
1184
- * The available languages.
1185
- */
1186
- available: Array<string>;
1187
- };
1188
- /**
1189
- * The currently open notifications.
1190
- */
1191
- notifications: Array<OpenNotification>;
1192
- /**
1193
- * The currently open modal dialogs.
1194
- */
1195
- modals: Array<OpenModalDialog>;
1196
- /**
1197
- * The relevant state for the registered feeds.
1198
- */
1199
- feeds: FeedsState;
1200
- /**
1201
- * The relevant state for the in-site search.
1202
- */
1203
- search: SearchState;
1204
- /**
1205
- * The currently authenticated user, if any.
1206
- */
1207
- user: UserInfo | undefined;
1208
- }
1209
-
1210
- /**
1211
- * The Piral global app sub-state container for app information.
1212
- */
1213
- export interface AppState {
1214
- /**
1215
- * Information for the layout computation.
1216
- */
1217
- layout: LayoutType;
1218
- /**
1219
- * Gets if the application is currently performing a background loading
1220
- * activity, e.g., for loading modules asynchronously or fetching
1221
- * translations.
1222
- */
1223
- loading: boolean;
1224
- /**
1225
- * Gets an unrecoverable application error, if any.
1226
- */
1227
- error: Error | undefined;
1228
- }
1229
-
1230
- export type ErrorComponentsState = {
1231
- [P in keyof Errors]?: ComponentType<Errors[P]>;
1232
- };
1233
-
1234
- /**
1235
- * The Piral global app sub-state container for shared components.
1236
- */
1237
- export interface ComponentsState extends PiralCustomComponentsState {
1238
- /**
1239
- * The loading indicator renderer.
1240
- */
1241
- LoadingIndicator: ComponentType<LoadingIndicatorProps>;
1242
- /**
1243
- * The error renderer.
1244
- */
1245
- ErrorInfo: ComponentType<ErrorInfoProps>;
1246
- /**
1247
- * The router context.
1248
- */
1249
- Router: ComponentType<RouterProps>;
1250
- /**
1251
- * The layout used for pages.
1252
- */
1253
- Layout: ComponentType<LayoutProps>;
1254
- /**
1255
- * A component that can be used for debugging purposes.
1256
- */
1257
- Debug?: ComponentType;
1258
- }
1259
-
1260
- /**
1261
- * The Piral global app sub-state container for component registrations.
1262
- */
1263
- export interface RegistryState extends PiralCustomRegistryState {
1264
- /**
1265
- * The registered page components for the router.
1266
- */
1267
- pages: Dict<PageRegistration>;
1268
- /**
1269
- * The registered extension components for extension slots.
1270
- */
1271
- extensions: Dict<Array<ExtensionRegistration>>;
1272
- /**
1273
- * The registered wrappers for any component.
1274
- */
1275
- wrappers: Dict<ComponentType<any>>;
1276
- }
1277
-
1278
- export type Dict<T> = Record<string, T>;
1279
-
1280
- /**
1281
- * Defines the shape of a shared data item.
1282
- */
1283
- export interface SharedDataItem<TValue = any> {
1284
- /**
1285
- * Gets the associated value.
1286
- */
1287
- value: TValue;
1288
- /**
1289
- * Gets the owner of the item.
1290
- */
1291
- owner: string;
1292
- /**
1293
- * Gets the storage location.
1294
- */
1295
- target: DataStoreTarget;
1296
- /**
1297
- * Gets the expiration of the item.
1298
- */
1299
- expires: number;
1300
- }
1301
-
1302
- export interface NewLifecycle<P, S, SS> {
1303
- /**
1304
- * Runs before React applies the result of `render` to the document, and
1305
- * returns an object to be given to componentDidUpdate. Useful for saving
1306
- * things such as scroll position before `render` causes changes to it.
1307
- *
1308
- * Note: the presence of getSnapshotBeforeUpdate prevents any of the deprecated
1309
- * lifecycle events from running.
1310
- */
1311
- getSnapshotBeforeUpdate?(prevProps: Readonly<P>, prevState: Readonly<S>): SS | null;
1312
- /**
1313
- * Called immediately after updating occurs. Not called for the initial render.
1314
- *
1315
- * The snapshot is only present if getSnapshotBeforeUpdate is present and returns non-null.
1316
- */
1317
- componentDidUpdate?(prevProps: Readonly<P>, prevState: Readonly<S>, snapshot?: SS): void;
1318
- }
1319
-
1320
- export interface DeprecatedLifecycle<P, S> {
1321
- /**
1322
- * Called immediately before mounting occurs, and before `Component#render`.
1323
- * Avoid introducing any side-effects or subscriptions in this method.
1324
- *
1325
- * Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps
1326
- * prevents this from being invoked.
1327
- * @deprecated 16.3, use componentDidMount or the constructor instead; will stop working in React 17
1328
- * @see https://reactjs.org/blog/2018/03/27/update-on-async-rendering.html#initializing-state
1329
- * @see https://reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path
1330
- */
1331
- componentWillMount?(): void;
1332
- /**
1333
- * Called immediately before mounting occurs, and before `Component#render`.
1334
- * Avoid introducing any side-effects or subscriptions in this method.
1335
- *
1336
- * This method will not stop working in React 17.
1337
- *
1338
- * Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps
1339
- * prevents this from being invoked.
1340
- * @deprecated 16.3, use componentDidMount or the constructor instead
1341
- * @see https://reactjs.org/blog/2018/03/27/update-on-async-rendering.html#initializing-state
1342
- * @see https://reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path
1343
- */
1344
- UNSAFE_componentWillMount?(): void;
1345
- /**
1346
- * Called when the component may be receiving new props.
1347
- * React may call this even if props have not changed, so be sure to compare new and existing
1348
- * props if you only want to handle changes.
1349
- *
1350
- * Calling `Component#setState` generally does not trigger this method.
1351
- *
1352
- * Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps
1353
- * prevents this from being invoked.
1354
- * @deprecated 16.3, use static getDerivedStateFromProps instead; will stop working in React 17
1355
- * @see https://reactjs.org/blog/2018/03/27/update-on-async-rendering.html#updating-state-based-on-props
1356
- * @see https://reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path
1357
- */
1358
- componentWillReceiveProps?(nextProps: Readonly<P>, nextContext: any): void;
1359
- /**
1360
- * Called when the component may be receiving new props.
1361
- * React may call this even if props have not changed, so be sure to compare new and existing
1362
- * props if you only want to handle changes.
1363
- *
1364
- * Calling `Component#setState` generally does not trigger this method.
1365
- *
1366
- * This method will not stop working in React 17.
1367
- *
1368
- * Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps
1369
- * prevents this from being invoked.
1370
- * @deprecated 16.3, use static getDerivedStateFromProps instead
1371
- * @see https://reactjs.org/blog/2018/03/27/update-on-async-rendering.html#updating-state-based-on-props
1372
- * @see https://reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path
1373
- */
1374
- UNSAFE_componentWillReceiveProps?(nextProps: Readonly<P>, nextContext: any): void;
1375
- /**
1376
- * Called immediately before rendering when new props or state is received. Not called for the initial render.
1377
- *
1378
- * Note: You cannot call `Component#setState` here.
1379
- *
1380
- * Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps
1381
- * prevents this from being invoked.
1382
- * @deprecated 16.3, use getSnapshotBeforeUpdate instead; will stop working in React 17
1383
- * @see https://reactjs.org/blog/2018/03/27/update-on-async-rendering.html#reading-dom-properties-before-an-update
1384
- * @see https://reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path
1385
- */
1386
- componentWillUpdate?(nextProps: Readonly<P>, nextState: Readonly<S>, nextContext: any): void;
1387
- /**
1388
- * Called immediately before rendering when new props or state is received. Not called for the initial render.
1389
- *
1390
- * Note: You cannot call `Component#setState` here.
1391
- *
1392
- * This method will not stop working in React 17.
1393
- *
1394
- * Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps
1395
- * prevents this from being invoked.
1396
- * @deprecated 16.3, use getSnapshotBeforeUpdate instead
1397
- * @see https://reactjs.org/blog/2018/03/27/update-on-async-rendering.html#reading-dom-properties-before-an-update
1398
- * @see https://reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path
1399
- */
1400
- UNSAFE_componentWillUpdate?(nextProps: Readonly<P>, nextState: Readonly<S>, nextContext: any): void;
1401
- }
1402
-
1403
- export interface ErrorInfo {
1404
- /**
1405
- * Captures which component contained the exception, and its ancestors.
1406
- */
1407
- componentStack: string;
1408
- }
1409
-
1410
- export interface OpenNotification {
1411
- id: string;
1412
- component: ComponentType<BareNotificationProps>;
1413
- options: NotificationOptions;
1414
- close(): void;
1415
- }
1416
-
1417
- export interface OpenModalDialog {
1418
- /**
1419
- * Specifies the fully qualified name of the dialog to show.
1420
- */
1421
- name: string;
1422
- /**
1423
- * Specifies the alternative (original) name of the dialog to show.
1424
- */
1425
- alternative?: string;
1426
- /**
1427
- * Defines the transported options.
1428
- */
1429
- options: BaseModalOptions;
1430
- /**
1431
- * Closes the modal dialog.
1432
- */
1433
- close(): void;
1434
- }
1435
-
1436
- export interface FeedsState {
1437
- [id: string]: FeedDataState;
1438
- }
1439
-
1440
- export interface SearchState {
1441
- /**
1442
- * Gets the current input value.
1443
- */
1444
- input: string;
1445
- /**
1446
- * Gets the current result state.
1447
- */
1448
- results: {
1449
- /**
1450
- * Gets weather the search is still loading.
1451
- */
1452
- loading: boolean;
1453
- /**
1454
- * The results to display for the current search.
1455
- */
1456
- items: Array<ReactChild>;
1457
- };
1458
- }
1459
-
1460
- /**
1461
- * The different known layout types.
1462
- */
1463
- export type LayoutType = "mobile" | "tablet" | "desktop";
1464
-
1465
- /**
1466
- * Map of all error types to their respective props.
1467
- */
1468
- export interface Errors extends PiralCustomErrors {
1469
- /**
1470
- * The props type for an extension error.
1471
- */
1472
- extension: ExtensionErrorInfoProps;
1473
- /**
1474
- * The props type for a loading error.
1475
- */
1476
- loading: LoadingErrorInfoProps;
1477
- /**
1478
- * The props type for a page error.
1479
- */
1480
- page: PageErrorInfoProps;
1481
- /**
1482
- * The props type for a not found error.
1483
- */
1484
- not_found: NotFoundErrorInfoProps;
1485
- /**
1486
- * The props type for an unknown error.
1487
- */
1488
- unknown: UnknownErrorInfoProps;
1489
- }
1490
-
1491
- /**
1492
- * Custom parts of the global custom component state defined outside of piral-core.
1493
- */
1494
- export interface PiralCustomComponentsState {
1495
- /**
1496
- * Represents the component for rendering a language selection.
1497
- */
1498
- LanguagesPicker: ComponentType<LanguagesPickerProps>;
1499
- /**
1500
- * The dashboard container component.
1501
- */
1502
- DashboardContainer: ComponentType<DashboardContainerProps>;
1503
- /**
1504
- * The dashboard tile component.
1505
- */
1506
- DashboardTile: ComponentType<DashboardTileProps>;
1507
- /**
1508
- * The menu container component.
1509
- */
1510
- MenuContainer: ComponentType<MenuContainerProps>;
1511
- /**
1512
- * The menu item component.
1513
- */
1514
- MenuItem: ComponentType<MenuItemProps>;
1515
- /**
1516
- * The host component for notifications.
1517
- */
1518
- NotificationsHost: ComponentType<NotificationsHostProps>;
1519
- /**
1520
- * The notification toast component.
1521
- */
1522
- NotificationsToast: ComponentType<NotificationsToastProps>;
1523
- /**
1524
- * The host component for modal dialogs.
1525
- */
1526
- ModalsHost: ComponentType<ModalsHostProps>;
1527
- /**
1528
- * The modal dialog component.
1529
- */
1530
- ModalsDialog: ComponentType<ModalsDialogProps>;
1531
- /**
1532
- * The component for showing the results of the search.
1533
- */
1534
- SearchResult: ComponentType<SearchResultProps>;
1535
- /**
1536
- * The container for showing search.
1537
- */
1538
- SearchContainer: ComponentType<SearchContainerProps>;
1539
- /**
1540
- * The input component for search capability.
1541
- */
1542
- SearchInput: ComponentType<SearchInputProps>;
1543
- }
1544
-
1545
- /**
1546
- * The props of a Loading indicator component.
1547
- */
1548
- export interface LoadingIndicatorProps {}
1549
-
1550
- /**
1551
- * The props for the ErrorInfo component.
1552
- */
1553
- export type ErrorInfoProps = UnionOf<Errors>;
1554
-
1555
- /**
1556
- * The props of a Router component.
1557
- */
1558
- export interface RouterProps {}
1559
-
1560
- /**
1561
- * The props of a Layout component.
1562
- */
1563
- export interface LayoutProps {
1564
- /**
1565
- * The currently selected layout type.
1566
- */
1567
- currentLayout: LayoutType;
1568
- }
1569
-
1570
- /**
1571
- * Custom parts of the global registry state defined outside of piral-core.
1572
- */
1573
- export interface PiralCustomRegistryState {
1574
- /**
1575
- * The registered tile components for a dashboard.
1576
- */
1577
- tiles: Dict<TileRegistration>;
1578
- /**
1579
- * The registered menu items for global display.
1580
- */
1581
- menuItems: Dict<MenuItemRegistration>;
1582
- /**
1583
- * The registered modal dialog components.
1584
- */
1585
- modals: Dict<ModalRegistration>;
1586
- /**
1587
- * The registered search providers for context aware search.
1588
- */
1589
- searchProviders: Dict<SearchProviderRegistration>;
1590
- }
1591
-
1592
- /**
1593
- * The interface modeling the registration of a pilet page component.
1594
- */
1595
- export interface PageRegistration extends BaseRegistration {
1596
- component: WrappedComponent<PageComponentProps>;
1597
- meta: PiralPageMeta;
1598
- }
1599
-
1600
- /**
1601
- * The interface modeling the registration of a pilet extension component.
1602
- */
1603
- export interface ExtensionRegistration extends BaseRegistration {
1604
- component: WrappedComponent<ExtensionComponentProps<string>>;
1605
- reference: any;
1606
- defaults: any;
1607
- }
1608
-
1609
- export interface FeedDataState {
1610
- /**
1611
- * Determines if the feed data is currently loading.
1612
- */
1613
- loading: boolean;
1614
- /**
1615
- * Indicates if the feed data was already loaded and is active.
1616
- */
1617
- loaded: boolean;
1618
- /**
1619
- * Stores the potential error when initializing or loading the feed.
1620
- */
1621
- error: any;
1622
- /**
1623
- * The currently stored feed data.
1624
- */
1625
- data: any;
1626
- }
1627
-
1628
- /**
1629
- * Custom errors defined outside of piral-core.
1630
- */
1631
- export interface PiralCustomErrors {
1632
- tile: TileErrorInfoProps;
1633
- menu: MenuItemErrorInfoProps;
1634
- modal: ModalErrorInfoProps;
1635
- feed: FeedErrorInfoProps;
1636
- }
1637
-
1638
- /**
1639
- * The error used when a registered extension component crashed.
1640
- */
1641
- export interface ExtensionErrorInfoProps {
1642
- /**
1643
- * The type of the error.
1644
- */
1645
- type: "extension";
1646
- /**
1647
- * The provided error details.
1648
- */
1649
- error: any;
1650
- }
1651
-
1652
- /**
1653
- * The error used when the app could not be loaded.
1654
- */
1655
- export interface LoadingErrorInfoProps {
1656
- /**
1657
- * The type of the error.
1658
- */
1659
- type: "loading";
1660
- /**
1661
- * The provided error details.
1662
- */
1663
- error: any;
1664
- }
1665
-
1666
- /**
1667
- * The error used when a registered page component crashes.
1668
- */
1669
- export interface PageErrorInfoProps extends ReactRouter.RouteComponentProps {
1670
- /**
1671
- * The type of the error.
1672
- */
1673
- type: "page";
1674
- /**
1675
- * The provided error details.
1676
- */
1677
- error: any;
1678
- }
1679
-
1680
- /**
1681
- * The error used when a route cannot be resolved.
1682
- */
1683
- export interface NotFoundErrorInfoProps extends ReactRouter.RouteComponentProps {
1684
- /**
1685
- * The type of the error.
1686
- */
1687
- type: "not_found";
1688
- }
1689
-
1690
- /**
1691
- * The error used when the exact type is unknown.
1692
- */
1693
- export interface UnknownErrorInfoProps {
1694
- /**
1695
- * The type of the error.
1696
- */
1697
- type: "unknown";
1698
- /**
1699
- * The provided error details.
1700
- */
1701
- error: any;
1702
- }
1703
-
1704
- export interface LanguagesPickerProps {
1705
- /**
1706
- * The currently selected language.
1707
- */
1708
- selected: string;
1709
- /**
1710
- * The languages available for selection.
1711
- */
1712
- available: Array<string>;
1713
- }
1714
-
1715
- export interface DashboardContainerProps extends ReactRouter.RouteComponentProps {}
1716
-
1717
- export interface DashboardTileProps {
1718
- /**
1719
- * The currently used number of columns.
1720
- */
1721
- columns: number;
1722
- /**
1723
- * The currently used number of rows.
1724
- */
1725
- rows: number;
1726
- /**
1727
- * The resizable status.
1728
- */
1729
- resizable: boolean;
1730
- /**
1731
- * The provided tile preferences.
1732
- */
1733
- meta: TilePreferences;
1734
- }
1735
-
1736
- export interface MenuContainerProps {
1737
- /**
1738
- * The type of the menu.
1739
- */
1740
- type: MenuType;
1741
- }
1742
-
1743
- export interface MenuItemProps {
1744
- /**
1745
- * The type of the menu.
1746
- */
1747
- type: MenuType;
1748
- /**
1749
- * The provided menu settings.
1750
- */
1751
- meta: MenuSettings;
1752
- }
1753
-
1754
- export interface NotificationsHostProps {}
1755
-
1756
- export interface NotificationsToastProps extends BareNotificationProps {}
1757
-
1758
- export interface ModalsHostProps {
1759
- /**
1760
- * Gets if the modal is currently open or closed.
1761
- */
1762
- open: boolean;
1763
- /**
1764
- * Callback to invoke closing the modal dialog.
1765
- */
1766
- close(): void;
1767
- }
1768
-
1769
- export interface ModalsDialogProps extends OpenModalDialog {}
1770
-
1771
- export interface SearchResultProps {}
1772
-
1773
- export interface SearchContainerProps {
1774
- /**
1775
- * Gets if the results are still gathered.
1776
- */
1777
- loading: boolean;
1778
- }
1779
-
1780
- export interface SearchInputProps {
1781
- setValue(value: string): void;
1782
- value: string;
1783
- }
1784
-
1785
- export type UnionOf<T> = {
1786
- [K in keyof T]: T[K];
1787
- }[keyof T];
1788
-
1789
- export interface TileRegistration extends BaseRegistration {
1790
- component: WrappedComponent<TileComponentProps>;
1791
- preferences: TilePreferences;
1792
- }
1793
-
1794
- export interface MenuItemRegistration extends BaseRegistration {
1795
- component: WrappedComponent<MenuComponentProps>;
1796
- settings: MenuSettings;
1797
- }
1798
-
1799
- export interface ModalRegistration extends BaseRegistration {
1800
- name: string;
1801
- component: WrappedComponent<ModalComponentProps<any>>;
1802
- defaults: any;
1803
- }
1804
-
1805
- export interface SearchProviderRegistration extends BaseRegistration {
1806
- search: SearchHandler;
1807
- cancel(): void;
1808
- clear(): void;
1809
- onlyImmediate: boolean;
1810
- }
1811
-
1812
- /**
1813
- * The base type for pilet component registration in the global state context.
1814
- */
1815
- export interface BaseRegistration {
1816
- pilet: string;
1817
- }
1818
-
1819
- export type WrappedComponent<TProps> = ComponentType<Without<TProps, keyof BaseComponentProps>>;
1820
-
1821
- export interface TileErrorInfoProps {
1822
- /**
1823
- * The type of the error.
1824
- */
1825
- type: "tile";
1826
- /**
1827
- * The provided error details.
1828
- */
1829
- error: any;
1830
- /**
1831
- * The currently used number of columns.
1832
- */
1833
- columns: number;
1834
- /**
1835
- * The currently used number of rows.
1836
- */
1837
- rows: number;
1838
- }
1839
-
1840
- /**
1841
- * The error used when a registered menu item component crashed.
1842
- */
1843
- export interface MenuItemErrorInfoProps {
1844
- /**
1845
- * The type of the error.
1846
- */
1847
- type: "menu";
1848
- /**
1849
- * The provided error details.
1850
- */
1851
- error: any;
1852
- /**
1853
- * The type of the used menu.
1854
- */
1855
- menu: MenuType;
1856
- }
1857
-
1858
- /**
1859
- * The error used when a registered modal dialog crashed.
1860
- */
1861
- export interface ModalErrorInfoProps {
1862
- /**
1863
- * The type of the error.
1864
- */
1865
- type: "modal";
1866
- /**
1867
- * The provided error details.
1868
- */
1869
- error: any;
1870
- /**
1871
- * Callback for closing the modal programmatically.
1872
- */
1873
- onClose(): void;
1874
- }
1875
-
1876
- /**
1877
- * The error used when loading a feed resulted in an error.
1878
- */
1879
- export interface FeedErrorInfoProps {
1880
- /**
1881
- * The type of the error.
1882
- */
1883
- type: "feed";
1884
- /**
1885
- * The provided error details.
1886
- */
1887
- error: any;
1888
- }
1889
-
1890
- export interface SearchHandler {
1891
- (options: SearchOptions): Promise<Array<ReactChild>>;
1892
- }
1893
-
1894
- export type Without<T, K> = Pick<T, Exclude<keyof T, K>>;
1032
+ key?: string;
1895
1033
  }