@jupyterlab/apputils 3.4.1 → 4.0.0-alpha.10

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 (85) hide show
  1. package/lib/commandpalette.d.ts +0 -32
  2. package/lib/commandpalette.js +1 -7
  3. package/lib/commandpalette.js.map +1 -1
  4. package/lib/dialog.d.ts +10 -1
  5. package/lib/dialog.js +1 -3
  6. package/lib/dialog.js.map +1 -1
  7. package/lib/domutils.js.map +1 -1
  8. package/lib/index.d.ts +29 -10
  9. package/lib/index.js +29 -10
  10. package/lib/index.js.map +1 -1
  11. package/lib/inputdialog.js +1 -1
  12. package/lib/inputdialog.js.map +1 -1
  13. package/lib/kernelstatuses.d.ts +73 -1
  14. package/lib/kernelstatuses.js +140 -1
  15. package/lib/kernelstatuses.js.map +1 -1
  16. package/lib/mainareawidget.d.ts +2 -2
  17. package/lib/mainareawidget.js +1 -2
  18. package/lib/mainareawidget.js.map +1 -1
  19. package/lib/menufactory.js.map +1 -1
  20. package/lib/runningSessions.d.ts +72 -0
  21. package/lib/runningSessions.js +119 -0
  22. package/lib/runningSessions.js.map +1 -0
  23. package/lib/sanitizer.js +1 -2
  24. package/lib/sanitizer.js.map +1 -1
  25. package/lib/semanticCommand.d.ts +48 -0
  26. package/lib/semanticCommand.js +42 -0
  27. package/lib/semanticCommand.js.map +1 -0
  28. package/lib/sessioncontext.js +7 -5
  29. package/lib/sessioncontext.js.map +1 -1
  30. package/lib/thememanager.d.ts +2 -3
  31. package/lib/thememanager.js +1 -1
  32. package/lib/thememanager.js.map +1 -1
  33. package/lib/tokens.d.ts +87 -10
  34. package/lib/tokens.js +13 -3
  35. package/lib/tokens.js.map +1 -1
  36. package/lib/toolbar/factory.d.ts +3 -2
  37. package/lib/toolbar/factory.js +125 -101
  38. package/lib/toolbar/factory.js.map +1 -1
  39. package/lib/toolbar/registry.d.ts +11 -0
  40. package/lib/toolbar/registry.js +16 -4
  41. package/lib/toolbar/registry.js.map +1 -1
  42. package/lib/toolbar/widget.d.ts +1 -435
  43. package/lib/toolbar/widget.js +3 -866
  44. package/lib/toolbar/widget.js.map +1 -1
  45. package/lib/widgettracker.js.map +1 -1
  46. package/lib/windowresolver.d.ts +1 -14
  47. package/lib/windowresolver.js +1 -6
  48. package/lib/windowresolver.js.map +1 -1
  49. package/package.json +23 -26
  50. package/style/base.css +0 -6
  51. package/style/commandpalette.css +7 -10
  52. package/style/dialog.css +10 -9
  53. package/style/index.css +1 -0
  54. package/style/index.js +1 -0
  55. package/style/materialcolors.css +3 -21
  56. package/lib/collapse.d.ts +0 -64
  57. package/lib/collapse.js +0 -145
  58. package/lib/collapse.js.map +0 -1
  59. package/lib/hoverbox.d.ts +0 -82
  60. package/lib/hoverbox.js +0 -100
  61. package/lib/hoverbox.js.map +0 -1
  62. package/lib/iframe.d.ts +0 -77
  63. package/lib/iframe.js +0 -89
  64. package/lib/iframe.js.map +0 -1
  65. package/lib/search.d.ts +0 -37
  66. package/lib/search.js +0 -102
  67. package/lib/search.js.map +0 -1
  68. package/lib/spinner.d.ts +0 -15
  69. package/lib/spinner.js +0 -28
  70. package/lib/spinner.js.map +0 -1
  71. package/lib/splash.d.ts +0 -19
  72. package/lib/splash.js +0 -9
  73. package/lib/splash.js.map +0 -1
  74. package/lib/styling.d.ts +0 -27
  75. package/lib/styling.js +0 -100
  76. package/lib/styling.js.map +0 -1
  77. package/lib/vdom.d.ts +0 -189
  78. package/lib/vdom.js +0 -203
  79. package/lib/vdom.js.map +0 -1
  80. package/style/collapse.css +0 -30
  81. package/style/hoverbox.css +0 -13
  82. package/style/iframe.css +0 -33
  83. package/style/spinner.css +0 -79
  84. package/style/styling.css +0 -101
  85. package/style/toolbar.css +0 -115
package/lib/spinner.d.ts DELETED
@@ -1,15 +0,0 @@
1
- import { Message } from '@lumino/messaging';
2
- import { Widget } from '@lumino/widgets';
3
- /**
4
- * The spinner class.
5
- */
6
- export declare class Spinner extends Widget {
7
- /**
8
- * Construct a spinner widget.
9
- */
10
- constructor();
11
- /**
12
- * Handle `'activate-request'` messages.
13
- */
14
- protected onActivateRequest(msg: Message): void;
15
- }
package/lib/spinner.js DELETED
@@ -1,28 +0,0 @@
1
- /* -----------------------------------------------------------------------------
2
- | Copyright (c) Jupyter Development Team.
3
- | Distributed under the terms of the Modified BSD License.
4
- |----------------------------------------------------------------------------*/
5
- import { Widget } from '@lumino/widgets';
6
- /**
7
- * The spinner class.
8
- */
9
- export class Spinner extends Widget {
10
- /**
11
- * Construct a spinner widget.
12
- */
13
- constructor() {
14
- super();
15
- this.addClass('jp-Spinner');
16
- this.node.tabIndex = -1;
17
- const content = document.createElement('div');
18
- content.className = 'jp-SpinnerContent';
19
- this.node.appendChild(content);
20
- }
21
- /**
22
- * Handle `'activate-request'` messages.
23
- */
24
- onActivateRequest(msg) {
25
- this.node.focus();
26
- }
27
- }
28
- //# sourceMappingURL=spinner.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"spinner.js","sourceRoot":"","sources":["../src/spinner.ts"],"names":[],"mappings":"AAAA;;;+EAG+E;AAG/E,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAEzC;;GAEG;AACH,MAAM,OAAO,OAAQ,SAAQ,MAAM;IACjC;;OAEG;IACH;QACE,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;QAC5B,IAAI,CAAC,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC,CAAC;QACxB,MAAM,OAAO,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QAC9C,OAAO,CAAC,SAAS,GAAG,mBAAmB,CAAC;QACxC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IACjC,CAAC;IAED;;OAEG;IACO,iBAAiB,CAAC,GAAY;QACtC,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;IACpB,CAAC;CACF"}
package/lib/splash.d.ts DELETED
@@ -1,19 +0,0 @@
1
- import { Token } from '@lumino/coreutils';
2
- import { IDisposable } from '@lumino/disposable';
3
- /**
4
- * The main menu token.
5
- */
6
- export declare const ISplashScreen: Token<ISplashScreen>;
7
- /**
8
- * The interface for an application splash screen.
9
- */
10
- export interface ISplashScreen {
11
- /**
12
- * Show the application splash screen.
13
- *
14
- * @param light - Whether to show the light splash screen or the dark one.
15
- *
16
- * @returns A disposable used to clear the splash screen.
17
- */
18
- show(light?: boolean): IDisposable;
19
- }
package/lib/splash.js DELETED
@@ -1,9 +0,0 @@
1
- // Copyright (c) Jupyter Development Team.
2
- // Distributed under the terms of the Modified BSD License.
3
- import { Token } from '@lumino/coreutils';
4
- /* tslint:disable */
5
- /**
6
- * The main menu token.
7
- */
8
- export const ISplashScreen = new Token('@jupyterlab/apputils:ISplashScreen');
9
- //# sourceMappingURL=splash.js.map
package/lib/splash.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"splash.js","sourceRoot":"","sources":["../src/splash.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,2DAA2D;AAE3D,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAG1C,oBAAoB;AACpB;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,KAAK,CACpC,oCAAoC,CACrC,CAAC"}
package/lib/styling.d.ts DELETED
@@ -1,27 +0,0 @@
1
- /**
2
- * A namespace for node styling.
3
- */
4
- export declare namespace Styling {
5
- /**
6
- * Style a node and its child elements with the default tag names.
7
- *
8
- * @param node - The base node.
9
- *
10
- * @param className - The optional CSS class to add to styled nodes.
11
- */
12
- function styleNode(node: HTMLElement, className?: string): void;
13
- /**
14
- * Style a node and its elements that have a given tag name.
15
- *
16
- * @param node - The base node.
17
- *
18
- * @param tagName - The html tag name to style.
19
- *
20
- * @param className - The optional CSS class to add to styled nodes.
21
- */
22
- function styleNodeByTag(node: HTMLElement, tagName: string, className?: string): void;
23
- /**
24
- * Wrap a select node.
25
- */
26
- function wrapSelect(node: HTMLSelectElement): HTMLElement;
27
- }
package/lib/styling.js DELETED
@@ -1,100 +0,0 @@
1
- // Copyright (c) Jupyter Development Team.
2
- // Distributed under the terms of the Modified BSD License.
3
- import { caretDownEmptyIcon } from '@jupyterlab/ui-components';
4
- /**
5
- * A namespace for node styling.
6
- */
7
- export var Styling;
8
- (function (Styling) {
9
- /**
10
- * Style a node and its child elements with the default tag names.
11
- *
12
- * @param node - The base node.
13
- *
14
- * @param className - The optional CSS class to add to styled nodes.
15
- */
16
- function styleNode(node, className = '') {
17
- styleNodeByTag(node, 'select', className);
18
- styleNodeByTag(node, 'textarea', className);
19
- styleNodeByTag(node, 'input', className);
20
- styleNodeByTag(node, 'button', className);
21
- }
22
- Styling.styleNode = styleNode;
23
- /**
24
- * Style a node and its elements that have a given tag name.
25
- *
26
- * @param node - The base node.
27
- *
28
- * @param tagName - The html tag name to style.
29
- *
30
- * @param className - The optional CSS class to add to styled nodes.
31
- */
32
- function styleNodeByTag(node, tagName, className = '') {
33
- if (node.localName === tagName) {
34
- node.classList.add('jp-mod-styled');
35
- }
36
- if (node.localName === 'select') {
37
- wrapSelect(node);
38
- }
39
- const nodes = node.getElementsByTagName(tagName);
40
- for (let i = 0; i < nodes.length; i++) {
41
- const child = nodes[i];
42
- child.classList.add('jp-mod-styled');
43
- if (className) {
44
- child.classList.add(className);
45
- }
46
- if (tagName === 'select') {
47
- wrapSelect(child);
48
- }
49
- }
50
- }
51
- Styling.styleNodeByTag = styleNodeByTag;
52
- /**
53
- * Wrap a select node.
54
- */
55
- function wrapSelect(node) {
56
- const wrapper = document.createElement('div');
57
- wrapper.classList.add('jp-select-wrapper');
58
- node.addEventListener('focus', Private.onFocus);
59
- node.addEventListener('blur', Private.onFocus);
60
- node.classList.add('jp-mod-styled');
61
- if (node.parentElement) {
62
- node.parentElement.replaceChild(wrapper, node);
63
- }
64
- wrapper.appendChild(node);
65
- // add the icon node
66
- wrapper.appendChild(caretDownEmptyIcon.element({
67
- tag: 'span',
68
- stylesheet: 'select',
69
- right: '8px',
70
- top: '5px',
71
- width: '18px'
72
- }));
73
- return wrapper;
74
- }
75
- Styling.wrapSelect = wrapSelect;
76
- })(Styling || (Styling = {}));
77
- /**
78
- * The namespace for module private data.
79
- */
80
- var Private;
81
- (function (Private) {
82
- /**
83
- * Handle a focus event on a styled select.
84
- */
85
- function onFocus(event) {
86
- const target = event.target;
87
- const parent = target.parentElement;
88
- if (!parent) {
89
- return;
90
- }
91
- if (event.type === 'focus') {
92
- parent.classList.add('jp-mod-focused');
93
- }
94
- else {
95
- parent.classList.remove('jp-mod-focused');
96
- }
97
- }
98
- Private.onFocus = onFocus;
99
- })(Private || (Private = {}));
100
- //# sourceMappingURL=styling.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"styling.js","sourceRoot":"","sources":["../src/styling.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,2DAA2D;AAE3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAE/D;;GAEG;AACH,MAAM,KAAW,OAAO,CA2EvB;AA3ED,WAAiB,OAAO;IACtB;;;;;;OAMG;IACH,SAAgB,SAAS,CAAC,IAAiB,EAAE,SAAS,GAAG,EAAE;QACzD,cAAc,CAAC,IAAI,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;QAC1C,cAAc,CAAC,IAAI,EAAE,UAAU,EAAE,SAAS,CAAC,CAAC;QAC5C,cAAc,CAAC,IAAI,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC;QACzC,cAAc,CAAC,IAAI,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;IAC5C,CAAC;IALe,iBAAS,YAKxB,CAAA;IAED;;;;;;;;OAQG;IACH,SAAgB,cAAc,CAC5B,IAAiB,EACjB,OAAe,EACf,SAAS,GAAG,EAAE;QAEd,IAAI,IAAI,CAAC,SAAS,KAAK,OAAO,EAAE;YAC9B,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,e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zB,GAAG,EAAE,MAAM;YACX,UAAU,EAAE,QAAQ;YACpB,KAAK,EAAE,KAAK;YACZ,GAAG,EAAE,KAAK;YACV,KAAK,EAAE,MAAM;SACd,CAAC,CACH,CAAC;QAEF,OAAO,OAAO,CAAC;IACjB,CAAC;IAvBe,kBAAU,aAuBzB,CAAA;AACH,CAAC,EA3EgB,OAAO,KAAP,OAAO,QA2EvB;AAED;;GAEG;AACH,IAAU,OAAO,CAgBhB;AAhBD,WAAU,OAAO;IACf;;OAEG;IACH,SAAgB,OAAO,CAAC,KAAiB;QACvC,MAAM,MAAM,GAAG,KAAK,CAAC,MAAiB,CAAC;QACvC,MAAM,MAAM,GAAG,MAAM,CAAC,aAAa,CAAC;QACpC,IAAI,CAAC,MAAM,EAAE;YACX,OAAO;SACR;QACD,IAAI,KAAK,CAAC,IAAI,KAAK,OAAO,EAAE;YAC1B,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;SACxC;aAAM;YACL,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC;SAC3C;IACH,CAAC;IAXe,eAAO,UAWtB,CAAA;AACH,CAAC,EAhBS,OAAO,KAAP,OAAO,QAgBhB"}
package/lib/vdom.d.ts DELETED
@@ -1,189 +0,0 @@
1
- import { IDisposable } from '@lumino/disposable';
2
- import { Message } from '@lumino/messaging';
3
- import { ISignal, Signal } from '@lumino/signaling';
4
- import { Widget } from '@lumino/widgets';
5
- import * as React from 'react';
6
- declare type ReactRenderElement = Array<React.ReactElement<any>> | React.ReactElement<any>;
7
- /**
8
- * An abstract class for a Phosphor widget which renders a React component.
9
- */
10
- export declare abstract class ReactWidget extends Widget {
11
- /**
12
- * Creates a new `ReactWidget` that renders a constant element.
13
- * @param element React element to render.
14
- */
15
- static create(element: ReactRenderElement): ReactWidget;
16
- /**
17
- * Render the content of this widget using the virtual DOM.
18
- *
19
- * This method will be called anytime the widget needs to be rendered, which
20
- * includes layout triggered rendering.
21
- *
22
- * Subclasses should define this method and return the root React nodes here.
23
- */
24
- protected abstract render(): ReactRenderElement | null;
25
- /**
26
- * Called to update the state of the widget.
27
- *
28
- * The default implementation of this method triggers
29
- * VDOM based rendering by calling the `renderDOM` method.
30
- */
31
- protected onUpdateRequest(msg: Message): void;
32
- /**
33
- * Called after the widget is attached to the DOM
34
- */
35
- protected onAfterAttach(msg: Message): void;
36
- /**
37
- * Called before the widget is detached from the DOM.
38
- */
39
- protected onBeforeDetach(msg: Message): void;
40
- /**
41
- * Render the React nodes to the DOM.
42
- *
43
- * @returns a promise that resolves when the rendering is done.
44
- */
45
- private renderDOM;
46
- renderPromise?: Promise<void>;
47
- }
48
- /**
49
- * An abstract ReactWidget with a model.
50
- */
51
- export declare abstract class VDomRenderer<T extends VDomRenderer.IModel | null = null> extends ReactWidget {
52
- /**
53
- * Create a new VDomRenderer
54
- */
55
- constructor(model: T extends null ? void : T);
56
- /**
57
- * A signal emitted when the model changes.
58
- */
59
- get modelChanged(): ISignal<this, void>;
60
- /**
61
- * Set the model and fire changed signals.
62
- */
63
- set model(newValue: T);
64
- /**
65
- * Get the current model.
66
- */
67
- get model(): T;
68
- /**
69
- * Dispose this widget.
70
- */
71
- dispose(): void;
72
- private _model;
73
- private _modelChanged;
74
- }
75
- /**
76
- * Props for the UseSignal component
77
- */
78
- export interface IUseSignalProps<SENDER, ARGS> {
79
- /**
80
- * Phosphor signal to connect to.
81
- */
82
- signal: ISignal<SENDER, ARGS>;
83
- /**
84
- * Initial value to use for the sender, used before the signal emits a value.
85
- * If not provided, initial sender will be undefined
86
- */
87
- initialSender?: SENDER;
88
- /**
89
- * Initial value to use for the args, used before the signal emits a value.
90
- * If not provided, initial args will be undefined.
91
- */
92
- initialArgs?: ARGS;
93
- /**
94
- * Function mapping the last signal value or initial values to an element to render.
95
- *
96
- * Note: returns `React.ReactNode` as per
97
- * https://github.com/sw-yx/react-typescript-cheatsheet#higher-order-componentsrender-props
98
- */
99
- children: (sender?: SENDER, args?: ARGS) => React.ReactNode;
100
- /**
101
- * Given the last signal value, should return whether to update the state or not.
102
- *
103
- * The default unconditionally returns `true`, so you only have to override if you want
104
- * to skip some updates.
105
- */
106
- shouldUpdate?: (sender: SENDER, args: ARGS) => boolean;
107
- }
108
- /**
109
- * State for the UseSignal component
110
- */
111
- export interface IUseSignalState<SENDER, ARGS> {
112
- value: [SENDER?, ARGS?];
113
- }
114
- /**
115
- * UseSignal provides a way to hook up a Phosphor signal to a React element,
116
- * so that the element is re-rendered every time the signal fires.
117
- *
118
- * It is implemented through the "render props" technique, using the `children`
119
- * prop as a function to render, so that it can be used either as a prop or as a child
120
- * of this element
121
- * https://reactjs.org/docs/render-props.html
122
- *
123
- *
124
- * Example as child:
125
- *
126
- * ```
127
- * function LiveButton(isActiveSignal: ISignal<any, boolean>) {
128
- * return (
129
- * <UseSignal signal={isActiveSignal} initialArgs={True}>
130
- * {(_, isActive) => <Button isActive={isActive}>}
131
- * </UseSignal>
132
- * )
133
- * }
134
- * ```
135
- *
136
- * Example as prop:
137
- *
138
- * ```
139
- * function LiveButton(isActiveSignal: ISignal<any, boolean>) {
140
- * return (
141
- * <UseSignal
142
- * signal={isActiveSignal}
143
- * initialArgs={True}
144
- * children={(_, isActive) => <Button isActive={isActive}>}
145
- * />
146
- * )
147
- * }
148
- * ```
149
- */
150
- export declare class UseSignal<SENDER, ARGS> extends React.Component<IUseSignalProps<SENDER, ARGS>, IUseSignalState<SENDER, ARGS>> {
151
- constructor(props: IUseSignalProps<SENDER, ARGS>);
152
- componentDidMount(): void;
153
- componentWillUnmount(): void;
154
- private slot;
155
- render(): React.ReactNode;
156
- }
157
- /**
158
- * The namespace for VDomRenderer statics.
159
- */
160
- export declare namespace VDomRenderer {
161
- /**
162
- * An interface for a model to be used with vdom rendering.
163
- */
164
- interface IModel extends IDisposable {
165
- /**
166
- * A signal emitted when any model state changes.
167
- */
168
- readonly stateChanged: ISignal<this, void>;
169
- }
170
- }
171
- /**
172
- * Concrete implementation of VDomRenderer model.
173
- */
174
- export declare class VDomModel implements VDomRenderer.IModel {
175
- /**
176
- * A signal emitted when any model state changes.
177
- */
178
- readonly stateChanged: Signal<this, void>;
179
- /**
180
- * Test whether the model is disposed.
181
- */
182
- get isDisposed(): boolean;
183
- /**
184
- * Dispose the model.
185
- */
186
- dispose(): void;
187
- private _isDisposed;
188
- }
189
- export {};
package/lib/vdom.js DELETED
@@ -1,203 +0,0 @@
1
- // Copyright (c) Jupyter Development Team.
2
- // Distributed under the terms of the Modified BSD License.
3
- import { MessageLoop } from '@lumino/messaging';
4
- import { Signal } from '@lumino/signaling';
5
- import { Widget } from '@lumino/widgets';
6
- import * as React from 'react';
7
- import * as ReactDOM from 'react-dom';
8
- /**
9
- * An abstract class for a Phosphor widget which renders a React component.
10
- */
11
- export class ReactWidget extends Widget {
12
- /**
13
- * Creates a new `ReactWidget` that renders a constant element.
14
- * @param element React element to render.
15
- */
16
- static create(element) {
17
- return new (class extends ReactWidget {
18
- render() {
19
- return element;
20
- }
21
- })();
22
- }
23
- /**
24
- * Called to update the state of the widget.
25
- *
26
- * The default implementation of this method triggers
27
- * VDOM based rendering by calling the `renderDOM` method.
28
- */
29
- onUpdateRequest(msg) {
30
- this.renderPromise = this.renderDOM();
31
- }
32
- /**
33
- * Called after the widget is attached to the DOM
34
- */
35
- onAfterAttach(msg) {
36
- // Make *sure* the widget is rendered.
37
- MessageLoop.sendMessage(this, Widget.Msg.UpdateRequest);
38
- }
39
- /**
40
- * Called before the widget is detached from the DOM.
41
- */
42
- onBeforeDetach(msg) {
43
- // Unmount the component so it can tear down.
44
- ReactDOM.unmountComponentAtNode(this.node);
45
- }
46
- /**
47
- * Render the React nodes to the DOM.
48
- *
49
- * @returns a promise that resolves when the rendering is done.
50
- */
51
- renderDOM() {
52
- return new Promise(resolve => {
53
- const vnode = this.render();
54
- // Split up the array/element cases so type inference chooses the right
55
- // signature.
56
- if (Array.isArray(vnode)) {
57
- ReactDOM.render(vnode, this.node, resolve);
58
- }
59
- else if (vnode) {
60
- ReactDOM.render(vnode, this.node, resolve);
61
- }
62
- });
63
- }
64
- }
65
- /**
66
- * An abstract ReactWidget with a model.
67
- */
68
- export class VDomRenderer extends ReactWidget {
69
- /**
70
- * Create a new VDomRenderer
71
- */
72
- constructor(model) {
73
- super();
74
- this._modelChanged = new Signal(this);
75
- this.model = (model !== null && model !== void 0 ? model : null);
76
- }
77
- /**
78
- * A signal emitted when the model changes.
79
- */
80
- get modelChanged() {
81
- return this._modelChanged;
82
- }
83
- /**
84
- * Set the model and fire changed signals.
85
- */
86
- set model(newValue) {
87
- if (this._model === newValue) {
88
- return;
89
- }
90
- if (this._model) {
91
- this._model.stateChanged.disconnect(this.update, this);
92
- }
93
- this._model = newValue;
94
- if (newValue) {
95
- newValue.stateChanged.connect(this.update, this);
96
- }
97
- this.update();
98
- this._modelChanged.emit(void 0);
99
- }
100
- /**
101
- * Get the current model.
102
- */
103
- get model() {
104
- return this._model;
105
- }
106
- /**
107
- * Dispose this widget.
108
- */
109
- dispose() {
110
- if (this.isDisposed) {
111
- return;
112
- }
113
- this._model = null;
114
- super.dispose();
115
- }
116
- }
117
- /**
118
- * UseSignal provides a way to hook up a Phosphor signal to a React element,
119
- * so that the element is re-rendered every time the signal fires.
120
- *
121
- * It is implemented through the "render props" technique, using the `children`
122
- * prop as a function to render, so that it can be used either as a prop or as a child
123
- * of this element
124
- * https://reactjs.org/docs/render-props.html
125
- *
126
- *
127
- * Example as child:
128
- *
129
- * ```
130
- * function LiveButton(isActiveSignal: ISignal<any, boolean>) {
131
- * return (
132
- * <UseSignal signal={isActiveSignal} initialArgs={True}>
133
- * {(_, isActive) => <Button isActive={isActive}>}
134
- * </UseSignal>
135
- * )
136
- * }
137
- * ```
138
- *
139
- * Example as prop:
140
- *
141
- * ```
142
- * function LiveButton(isActiveSignal: ISignal<any, boolean>) {
143
- * return (
144
- * <UseSignal
145
- * signal={isActiveSignal}
146
- * initialArgs={True}
147
- * children={(_, isActive) => <Button isActive={isActive}>}
148
- * />
149
- * )
150
- * }
151
- * ```
152
- */
153
- export class UseSignal extends React.Component {
154
- constructor(props) {
155
- super(props);
156
- this.slot = (sender, args) => {
157
- // skip setting new state if we have a shouldUpdate function and it returns false
158
- if (this.props.shouldUpdate && !this.props.shouldUpdate(sender, args)) {
159
- return;
160
- }
161
- this.setState({ value: [sender, args] });
162
- };
163
- this.state = { value: [this.props.initialSender, this.props.initialArgs] };
164
- }
165
- componentDidMount() {
166
- this.props.signal.connect(this.slot);
167
- }
168
- componentWillUnmount() {
169
- this.props.signal.disconnect(this.slot);
170
- }
171
- render() {
172
- return this.props.children(...this.state.value);
173
- }
174
- }
175
- /**
176
- * Concrete implementation of VDomRenderer model.
177
- */
178
- export class VDomModel {
179
- constructor() {
180
- /**
181
- * A signal emitted when any model state changes.
182
- */
183
- this.stateChanged = new Signal(this);
184
- this._isDisposed = false;
185
- }
186
- /**
187
- * Test whether the model is disposed.
188
- */
189
- get isDisposed() {
190
- return this._isDisposed;
191
- }
192
- /**
193
- * Dispose the model.
194
- */
195
- dispose() {
196
- if (this.isDisposed) {
197
- return;
198
- }
199
- this._isDisposed = true;
200
- Signal.clearData(this);
201
- }
202
- }
203
- //# sourceMappingURL=vdom.js.map
package/lib/vdom.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"vdom.js","sourceRoot":"","sources":["../src/vdom.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,2DAA2D;AAG3D,OAAO,EAAW,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAW,MAAM,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,QAAQ,MAAM,WAAW,CAAC;AAMtC;;GAEG;AACH,MAAM,OAAgB,WAAY,SAAQ,MAAM;IAC9C;;;OAGG;IACH,MAAM,CAAC,MAAM,CAAC,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I,CAAC,QAAQ,CAAC,EAAE,KAAK,EAAE,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC;QAC3C,CAAC,CAAC;QAjBA,IAAI,CAAC,KAAK,GAAG,EAAE,KAAK,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,aAAa,EAAE,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,EAAE,CAAC;IAC7E,CAAC;IAED,iBAAiB;QACf,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACvC,CAAC;IAED,oBAAoB;QAClB,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC1C,CAAC;IAUD,MAAM;QACJ,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAClD,CAAC;CACF;AAiBD;;GAEG;AACH,MAAM,OAAO,SAAS;IAAtB;QACE;;WAEG;QACM,iBAAY,GAAG,IAAI,MAAM,CAAa,IAAI,CAAC,CAAC;QAoB7C,gBAAW,GAAG,KAAK,CAAC;IAC9B,CAAC;IAnBC;;OAEG;IACH,IAAI,UAAU;QACZ,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;IAED;;OAEG;IACH,OAAO;QACL,IAAI,IAAI,CAAC,UAAU,EAAE;YACnB,OAAO;SACR;QACD,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;QACxB,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IACzB,CAAC;CAGF"}
@@ -1,30 +0,0 @@
1
- /*-----------------------------------------------------------------------------
2
- | Copyright (c) Jupyter Development Team.
3
- | Distributed under the terms of the Modified BSD License.
4
- |----------------------------------------------------------------------------*/
5
-
6
- .jp-Collapse {
7
- display: flex;
8
- flex-direction: column;
9
- align-items: stretch;
10
- border-top: 1px solid var(--jp-border-color2);
11
- border-bottom: 1px solid var(--jp-border-color2);
12
- }
13
-
14
- .jp-Collapse-header {
15
- padding: 1px 12px;
16
- color: var(--jp-ui-font-color1);
17
- background-color: var(--jp-layout-color1);
18
- font-size: var(--jp-ui-font-size2);
19
- }
20
-
21
- .jp-Collapse-header:hover {
22
- background-color: var(--jp-layout-color2);
23
- }
24
-
25
- .jp-Collapse-contents {
26
- padding: 0px 12px 0px 12px;
27
- background-color: var(--jp-layout-color1);
28
- color: var(--jp-ui-font-color1);
29
- overflow: auto;
30
- }
@@ -1,13 +0,0 @@
1
- /*-----------------------------------------------------------------------------
2
- | Copyright (c) 2014-2016, Jupyter Development Team.
3
- |
4
- | Distributed under the terms of the Modified BSD License.
5
- |----------------------------------------------------------------------------*/
6
-
7
- .jp-HoverBox {
8
- position: fixed;
9
- }
10
-
11
- .jp-HoverBox.jp-mod-outofview {
12
- display: none;
13
- }