@jupyterlab/apputils 3.3.0-alpha.9 → 3.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/lib/collapse.d.ts +64 -0
  2. package/lib/collapse.js +145 -0
  3. package/lib/collapse.js.map +1 -0
  4. package/lib/commandpalette.d.ts +32 -0
  5. package/lib/commandpalette.js +7 -1
  6. package/lib/commandpalette.js.map +1 -1
  7. package/lib/dialog.d.ts +8 -10
  8. package/lib/dialog.js +23 -2
  9. package/lib/dialog.js.map +1 -1
  10. package/lib/iframe.d.ts +77 -0
  11. package/lib/iframe.js +89 -0
  12. package/lib/iframe.js.map +1 -0
  13. package/lib/index.d.ts +9 -26
  14. package/lib/index.js +9 -26
  15. package/lib/index.js.map +1 -1
  16. package/lib/inputdialog.js +1 -1
  17. package/lib/inputdialog.js.map +1 -1
  18. package/lib/kernelstatuses.d.ts +10 -0
  19. package/lib/kernelstatuses.js +29 -0
  20. package/lib/kernelstatuses.js.map +1 -0
  21. package/lib/mainareawidget.d.ts +1 -1
  22. package/lib/mainareawidget.js +3 -2
  23. package/lib/mainareawidget.js.map +1 -1
  24. package/lib/printing.js +1 -1
  25. package/lib/printing.js.map +1 -1
  26. package/lib/sanitizer.js +0 -1
  27. package/lib/sanitizer.js.map +1 -1
  28. package/lib/search.d.ts +28 -0
  29. package/lib/search.js +88 -0
  30. package/lib/search.js.map +1 -0
  31. package/lib/sessioncontext.d.ts +5 -1
  32. package/lib/sessioncontext.js +73 -24
  33. package/lib/sessioncontext.js.map +1 -1
  34. package/lib/spinner.d.ts +15 -0
  35. package/lib/spinner.js +28 -0
  36. package/lib/spinner.js.map +1 -0
  37. package/lib/splash.d.ts +19 -0
  38. package/lib/splash.js +9 -0
  39. package/lib/splash.js.map +1 -0
  40. package/lib/styling.d.ts +27 -0
  41. package/lib/styling.js +100 -0
  42. package/lib/styling.js.map +1 -0
  43. package/lib/thememanager.d.ts +2 -1
  44. package/lib/thememanager.js +5 -0
  45. package/lib/thememanager.js.map +1 -1
  46. package/lib/tokens.d.ts +1 -61
  47. package/lib/tokens.js +0 -15
  48. package/lib/tokens.js.map +1 -1
  49. package/lib/toolbar/factory.d.ts +2 -1
  50. package/lib/toolbar/factory.js +73 -70
  51. package/lib/toolbar/factory.js.map +1 -1
  52. package/lib/toolbar/registry.js +2 -1
  53. package/lib/toolbar/registry.js.map +1 -1
  54. package/lib/toolbar/widget.d.ts +412 -0
  55. package/lib/toolbar/widget.js +866 -19
  56. package/lib/toolbar/widget.js.map +1 -1
  57. package/lib/vdom.d.ts +189 -0
  58. package/lib/vdom.js +203 -0
  59. package/lib/vdom.js.map +1 -0
  60. package/lib/windowresolver.d.ts +14 -1
  61. package/lib/windowresolver.js +6 -1
  62. package/lib/windowresolver.js.map +1 -1
  63. package/package.json +15 -11
  64. package/style/base.css +5 -0
  65. package/style/collapse.css +30 -0
  66. package/style/dialog.css +24 -2
  67. package/style/iframe.css +33 -0
  68. package/style/spinner.css +79 -0
  69. package/style/styling.css +101 -0
  70. package/style/toolbar.css +115 -0
@@ -1,6 +1,180 @@
1
+ /// <reference types="react" />
1
2
  import { ITranslator } from '@jupyterlab/translation';
3
+ import { LabIcon } from '@jupyterlab/ui-components';
4
+ import { IIterator } from '@lumino/algorithm';
5
+ import { CommandRegistry } from '@lumino/commands';
6
+ import { ReadonlyJSONObject } from '@lumino/coreutils';
7
+ import { Message } from '@lumino/messaging';
2
8
  import { Widget } from '@lumino/widgets';
3
9
  import { ISessionContext } from '../sessioncontext';
10
+ import { ReactWidget } from '../vdom';
11
+ /**
12
+ * A class which provides a toolbar widget.
13
+ */
14
+ export declare class Toolbar<T extends Widget = Widget> extends Widget {
15
+ /**
16
+ * Construct a new toolbar widget.
17
+ */
18
+ constructor();
19
+ /**
20
+ * Get an iterator over the ordered toolbar item names.
21
+ *
22
+ * @returns An iterator over the toolbar item names.
23
+ */
24
+ names(): IIterator<string>;
25
+ /**
26
+ * Add an item to the end of the toolbar.
27
+ *
28
+ * @param name - The name of the widget to add to the toolbar.
29
+ *
30
+ * @param widget - The widget to add to the toolbar.
31
+ *
32
+ * @param index - The optional name of the item to insert after.
33
+ *
34
+ * @returns Whether the item was added to toolbar. Returns false if
35
+ * an item of the same name is already in the toolbar.
36
+ *
37
+ * #### Notes
38
+ * The item can be removed from the toolbar by setting its parent to `null`.
39
+ */
40
+ addItem(name: string, widget: T): boolean;
41
+ /**
42
+ * Insert an item into the toolbar at the specified index.
43
+ *
44
+ * @param index - The index at which to insert the item.
45
+ *
46
+ * @param name - The name of the item.
47
+ *
48
+ * @param widget - The widget to add.
49
+ *
50
+ * @returns Whether the item was added to the toolbar. Returns false if
51
+ * an item of the same name is already in the toolbar.
52
+ *
53
+ * #### Notes
54
+ * The index will be clamped to the bounds of the items.
55
+ * The item can be removed from the toolbar by setting its parent to `null`.
56
+ */
57
+ insertItem(index: number, name: string, widget: T): boolean;
58
+ /**
59
+ * Insert an item into the toolbar at the after a target item.
60
+ *
61
+ * @param at - The target item to insert after.
62
+ *
63
+ * @param name - The name of the item.
64
+ *
65
+ * @param widget - The widget to add.
66
+ *
67
+ * @returns Whether the item was added to the toolbar. Returns false if
68
+ * an item of the same name is already in the toolbar.
69
+ *
70
+ * #### Notes
71
+ * The index will be clamped to the bounds of the items.
72
+ * The item can be removed from the toolbar by setting its parent to `null`.
73
+ */
74
+ insertAfter(at: string, name: string, widget: T): boolean;
75
+ /**
76
+ * Insert an item into the toolbar at the before a target item.
77
+ *
78
+ * @param at - The target item to insert before.
79
+ *
80
+ * @param name - The name of the item.
81
+ *
82
+ * @param widget - The widget to add.
83
+ *
84
+ * @returns Whether the item was added to the toolbar. Returns false if
85
+ * an item of the same name is already in the toolbar.
86
+ *
87
+ * #### Notes
88
+ * The index will be clamped to the bounds of the items.
89
+ * The item can be removed from the toolbar by setting its parent to `null`.
90
+ */
91
+ insertBefore(at: string, name: string, widget: T): boolean;
92
+ private _insertRelative;
93
+ /**
94
+ * Handle the DOM events for the widget.
95
+ *
96
+ * @param event - The DOM event sent to the widget.
97
+ *
98
+ * #### Notes
99
+ * This method implements the DOM `EventListener` interface and is
100
+ * called in response to events on the dock panel's node. It should
101
+ * not be called directly by user code.
102
+ */
103
+ handleEvent(event: Event): void;
104
+ /**
105
+ * Handle a DOM click event.
106
+ */
107
+ protected handleClick(event: Event): void;
108
+ /**
109
+ * Handle `after-attach` messages for the widget.
110
+ */
111
+ protected onAfterAttach(msg: Message): void;
112
+ /**
113
+ * Handle `before-detach` messages for the widget.
114
+ */
115
+ protected onBeforeDetach(msg: Message): void;
116
+ }
117
+ /**
118
+ * A class which provides a toolbar widget.
119
+ */
120
+ export declare class ReactiveToolbar extends Toolbar<Widget> {
121
+ /**
122
+ * Construct a new toolbar widget.
123
+ */
124
+ constructor();
125
+ /**
126
+ * Dispose of the widget and its descendant widgets.
127
+ */
128
+ dispose(): void;
129
+ /**
130
+ * Insert an item into the toolbar at the after a target item.
131
+ *
132
+ * @param at - The target item to insert after.
133
+ *
134
+ * @param name - The name of the item.
135
+ *
136
+ * @param widget - The widget to add.
137
+ *
138
+ * @returns Whether the item was added to the toolbar. Returns false if
139
+ * an item of the same name is already in the toolbar or if the target
140
+ * is the toolbar pop-up opener.
141
+ *
142
+ * #### Notes
143
+ * The index will be clamped to the bounds of the items.
144
+ * The item can be removed from the toolbar by setting its parent to `null`.
145
+ */
146
+ insertAfter(at: string, name: string, widget: Widget): boolean;
147
+ /**
148
+ * Insert an item into the toolbar at the specified index.
149
+ *
150
+ * @param index - The index at which to insert the item.
151
+ *
152
+ * @param name - The name of the item.
153
+ *
154
+ * @param widget - The widget to add.
155
+ *
156
+ * @returns Whether the item was added to the toolbar. Returns false if
157
+ * an item of the same name is already in the toolbar.
158
+ *
159
+ * #### Notes
160
+ * The index will be clamped to the bounds of the items.
161
+ * The item can be removed from the toolbar by setting its parent to `null`.
162
+ */
163
+ insertItem(index: number, name: string, widget: Widget): boolean;
164
+ /**
165
+ * A message handler invoked on a `'before-hide'` message.
166
+ *
167
+ * It will hide the pop-up panel
168
+ */
169
+ onBeforeHide(msg: Message): void;
170
+ protected onResize(msg: Widget.ResizeMessage): void;
171
+ private _onResize;
172
+ private _saveWidgetWidth;
173
+ private _getWidgetWidth;
174
+ protected readonly popupOpener: ToolbarPopupOpener;
175
+ private readonly _widgetWidths;
176
+ private readonly _resizer;
177
+ }
4
178
  /**
5
179
  * The namespace for Toolbar class statics.
6
180
  */
@@ -19,6 +193,14 @@ export declare namespace Toolbar {
19
193
  * This is dead code now.
20
194
  */
21
195
  function createRestartButton(sessionContext: ISessionContext, dialogs?: ISessionContext.IDialogs, translator?: ITranslator): Widget;
196
+ /**
197
+ * Create a toolbar spacer item.
198
+ *
199
+ * #### Notes
200
+ * It is a flex spacer that separates the left toolbar items
201
+ * from the right toolbar items.
202
+ */
203
+ function createSpacerItem(): Widget;
22
204
  /**
23
205
  * Create a kernel name indicator item.
24
206
  *
@@ -37,3 +219,233 @@ export declare namespace Toolbar {
37
219
  */
38
220
  function createKernelStatusItem(sessionContext: ISessionContext, translator?: ITranslator): Widget;
39
221
  }
222
+ /**
223
+ * Namespace for ToolbarButtonComponent.
224
+ */
225
+ export declare namespace ToolbarButtonComponent {
226
+ /**
227
+ * Interface for ToolbarButtonComponent props.
228
+ */
229
+ interface IProps {
230
+ className?: string;
231
+ label?: string;
232
+ icon?: LabIcon.IMaybeResolvable;
233
+ iconClass?: string;
234
+ iconLabel?: string;
235
+ tooltip?: string;
236
+ onClick?: () => void;
237
+ enabled?: boolean;
238
+ pressed?: boolean;
239
+ pressedIcon?: LabIcon.IMaybeResolvable;
240
+ pressedTooltip?: string;
241
+ disabledTooltip?: string;
242
+ /**
243
+ * Trigger the button on the actual onClick event rather than onMouseDown.
244
+ *
245
+ * See note in ToolbarButtonComponent below as to why the default is to
246
+ * trigger on onMouseDown.
247
+ */
248
+ actualOnClick?: boolean;
249
+ /**
250
+ * The application language translator.
251
+ */
252
+ translator?: ITranslator;
253
+ }
254
+ }
255
+ /**
256
+ * React component for a toolbar button.
257
+ *
258
+ * @param props - The props for ToolbarButtonComponent.
259
+ */
260
+ export declare function ToolbarButtonComponent(props: ToolbarButtonComponent.IProps): JSX.Element;
261
+ /**
262
+ * Adds the toolbar button class to the toolbar widget.
263
+ * @param w Toolbar button widget.
264
+ */
265
+ export declare function addToolbarButtonClass(w: Widget): Widget;
266
+ /**
267
+ * Phosphor Widget version of static ToolbarButtonComponent.
268
+ */
269
+ export declare class ToolbarButton extends ReactWidget {
270
+ private props;
271
+ /**
272
+ * Creates a toolbar button
273
+ * @param props props for underlying `ToolbarButton` component
274
+ */
275
+ constructor(props?: ToolbarButtonComponent.IProps);
276
+ /**
277
+ * Sets the pressed state for the button
278
+ * @param value true if button is pressed, false otherwise
279
+ */
280
+ set pressed(value: boolean);
281
+ /**
282
+ * Returns true if button is pressed, false otherwise
283
+ */
284
+ get pressed(): boolean;
285
+ /**
286
+ * Sets the enabled state for the button
287
+ * @param value true to enable the button, false otherwise
288
+ */
289
+ set enabled(value: boolean);
290
+ /**
291
+ * Returns true if button is enabled, false otherwise
292
+ */
293
+ get enabled(): boolean;
294
+ /**
295
+ * Sets the click handler for the button
296
+ * @param value click handler
297
+ */
298
+ set onClick(value: () => void);
299
+ /**
300
+ * Returns the click handler for the button
301
+ */
302
+ get onClick(): () => void;
303
+ render(): JSX.Element;
304
+ private _pressed;
305
+ private _enabled;
306
+ private _onClick;
307
+ }
308
+ /**
309
+ * Namespace for CommandToolbarButtonComponent.
310
+ */
311
+ export declare namespace CommandToolbarButtonComponent {
312
+ /**
313
+ * Interface for CommandToolbarButtonComponent props.
314
+ */
315
+ interface IProps {
316
+ /**
317
+ * Application commands registry
318
+ */
319
+ commands: CommandRegistry;
320
+ /**
321
+ * Command unique id
322
+ */
323
+ id: string;
324
+ /**
325
+ * Command arguments
326
+ */
327
+ args?: ReadonlyJSONObject;
328
+ /**
329
+ * Overrides command icon
330
+ */
331
+ icon?: LabIcon;
332
+ /**
333
+ * Overrides command label
334
+ */
335
+ label?: string;
336
+ }
337
+ }
338
+ /**
339
+ * React component for a toolbar button that wraps a command.
340
+ *
341
+ * This wraps the ToolbarButtonComponent and watches the command registry
342
+ * for changes to the command.
343
+ */
344
+ export declare function CommandToolbarButtonComponent(props: CommandToolbarButtonComponent.IProps): JSX.Element;
345
+ export declare function addCommandToolbarButtonClass(w: Widget): Widget;
346
+ /**
347
+ * Phosphor Widget version of CommandToolbarButtonComponent.
348
+ */
349
+ export declare class CommandToolbarButton extends ReactWidget {
350
+ private props;
351
+ /**
352
+ * Creates a command toolbar button
353
+ * @param props props for underlying `CommandToolbarButtonComponent` component
354
+ */
355
+ constructor(props: CommandToolbarButtonComponent.IProps);
356
+ render(): JSX.Element;
357
+ }
358
+ /**
359
+ * A class which provides a toolbar popup
360
+ * used to store widgets that don't fit
361
+ * in the toolbar when it is resized
362
+ */
363
+ declare class ToolbarPopup extends Widget {
364
+ width: number;
365
+ /**
366
+ * Construct a new ToolbarPopup
367
+ */
368
+ constructor();
369
+ /**
370
+ * Updates the width of the popup, this
371
+ * should match with the toolbar width
372
+ *
373
+ * @param width - The width to resize to
374
+ * @protected
375
+ */
376
+ updateWidth(width: number): void;
377
+ /**
378
+ * Aligns the popup to left bottom of widget
379
+ *
380
+ * @param widget the widget to align to
381
+ * @private
382
+ */
383
+ alignTo(widget: Widget): void;
384
+ /**
385
+ * Inserts the widget at specified index
386
+ * @param index the index
387
+ * @param widget widget to add
388
+ */
389
+ insertWidget(index: number, widget: Widget): void;
390
+ /**
391
+ * Total number of widgets in the popup
392
+ */
393
+ widgetCount(): number;
394
+ /**
395
+ * Returns the widget at index
396
+ * @param index the index
397
+ */
398
+ widgetAt(index: number): Widget;
399
+ }
400
+ /**
401
+ * A class that provides a ToolbarPopupOpener,
402
+ * which is a button added to toolbar when
403
+ * the toolbar items overflow toolbar width
404
+ */
405
+ declare class ToolbarPopupOpener extends ToolbarButton {
406
+ /**
407
+ * Create a new popup opener
408
+ */
409
+ constructor();
410
+ /**
411
+ * Add widget to the popup, prepends widgets
412
+ * @param widget the widget to add
413
+ */
414
+ addWidget(widget: Widget): void;
415
+ /**
416
+ * Dispose of the widget and its descendant widgets.
417
+ *
418
+ * #### Notes
419
+ * It is unsafe to use the widget after it has been disposed.
420
+ *
421
+ * All calls made to this method after the first are a no-op.
422
+ */
423
+ dispose(): void;
424
+ /**
425
+ * Hides the opener and the popup
426
+ */
427
+ hide(): void;
428
+ /**
429
+ * Hides the popup
430
+ */
431
+ hidePopup(): void;
432
+ /**
433
+ * Updates width and position of the popup
434
+ * to align with the toolbar
435
+ */
436
+ updatePopup(): void;
437
+ /**
438
+ * Returns widget at index in the popup
439
+ * @param index
440
+ */
441
+ widgetAt(index: number): Widget;
442
+ /**
443
+ * Returns total number of widgets in the popup
444
+ *
445
+ * @returns Number of widgets
446
+ */
447
+ widgetCount(): number;
448
+ protected handleClick(): void;
449
+ protected popup: ToolbarPopup;
450
+ }
451
+ export {};