1 | import * as managerBase from './manager-base';
|
2 | import * as utils from './utils';
|
3 | import * as Backbone from 'backbone';
|
4 | import { NativeView } from './nativeview';
|
5 | import { Widget, Panel } from '@lumino/widgets';
|
6 | import { Message } from '@lumino/messaging';
|
7 | import { IClassicComm, ICallbacks } from './services-shim';
|
8 | import { KernelMessage } from '@jupyterlab/services';
|
9 |
|
10 |
|
11 |
|
12 | export declare function unpack_models(value: any, manager: managerBase.ManagerBase<any>): Promise<any>;
|
13 |
|
14 |
|
15 |
|
16 | export interface ISerializers {
|
17 | [key: string]: {
|
18 | deserialize?: (value?: any, manager?: managerBase.ManagerBase<any>) => any;
|
19 | serialize?: (value?: any, widget?: WidgetModel) => any;
|
20 | };
|
21 | }
|
22 | export declare class WidgetModel extends Backbone.Model {
|
23 | |
24 |
|
25 |
|
26 | defaults(): {
|
27 | _model_module: string;
|
28 | _model_name: string;
|
29 | _model_module_version: string;
|
30 | _view_module: string;
|
31 | _view_name: string;
|
32 | _view_module_version: string;
|
33 | _view_count: number;
|
34 | };
|
35 | |
36 |
|
37 |
|
38 |
|
39 |
|
40 |
|
41 |
|
42 | isNew(): boolean;
|
43 | |
44 |
|
45 |
|
46 |
|
47 |
|
48 |
|
49 |
|
50 |
|
51 |
|
52 |
|
53 |
|
54 |
|
55 | initialize(attributes: any, options: {
|
56 | model_id: string;
|
57 | comm?: any;
|
58 | widget_manager: any;
|
59 | }): void;
|
60 | get comm_live(): boolean;
|
61 | set comm_live(x: boolean);
|
62 | |
63 |
|
64 |
|
65 | send(content: {}, callbacks: {}, buffers?: ArrayBuffer[] | ArrayBufferView[]): void;
|
66 | |
67 |
|
68 |
|
69 |
|
70 |
|
71 |
|
72 |
|
73 | close(comm_closed?: boolean): Promise<void>;
|
74 | |
75 |
|
76 |
|
77 | _handle_comm_closed(msg: KernelMessage.ICommCloseMsg): void;
|
78 | |
79 |
|
80 |
|
81 | _handle_comm_msg(msg: KernelMessage.ICommMsgMsg): Promise<void>;
|
82 | |
83 |
|
84 |
|
85 |
|
86 |
|
87 | set_state(state: any): void;
|
88 | |
89 |
|
90 |
|
91 |
|
92 |
|
93 |
|
94 | get_state(drop_defaults: boolean): any;
|
95 | |
96 |
|
97 |
|
98 |
|
99 |
|
100 | _handle_status(msg: KernelMessage.IStatusMsg): void;
|
101 | |
102 |
|
103 |
|
104 | callbacks(view?: WidgetView): ICallbacks;
|
105 | |
106 |
|
107 |
|
108 |
|
109 |
|
110 |
|
111 | set(key: any, val?: any, options?: any): any;
|
112 | |
113 |
|
114 |
|
115 |
|
116 |
|
117 |
|
118 |
|
119 |
|
120 |
|
121 |
|
122 |
|
123 |
|
124 |
|
125 |
|
126 |
|
127 |
|
128 |
|
129 |
|
130 |
|
131 | sync(method: string, model: WidgetModel, options?: any): any;
|
132 | rememberLastUpdateFor(msgId: string): void;
|
133 | |
134 |
|
135 |
|
136 |
|
137 |
|
138 |
|
139 |
|
140 |
|
141 |
|
142 | serialize(state: {
|
143 | [key: string]: any;
|
144 | }): {
|
145 | [key: string]: any;
|
146 | };
|
147 | |
148 |
|
149 |
|
150 | send_sync_message(state: {}, callbacks?: any): string;
|
151 | |
152 |
|
153 |
|
154 |
|
155 |
|
156 | save_changes(callbacks?: {}): void;
|
157 | |
158 |
|
159 |
|
160 |
|
161 |
|
162 |
|
163 |
|
164 | on_some_change(keys: string[], callback: (...args: any[]) => void, context: any): void;
|
165 | |
166 |
|
167 |
|
168 |
|
169 | toJSON(options: any): string;
|
170 | |
171 |
|
172 |
|
173 |
|
174 |
|
175 | static _deserialize_state(state: {
|
176 | [key: string]: any;
|
177 | }, manager: managerBase.ManagerBase<any>): Promise<utils.Dict<unknown>>;
|
178 | static serializers: ISerializers;
|
179 | widget_manager: managerBase.ManagerBase<any>;
|
180 | model_id: string;
|
181 | views: {
|
182 | [key: string]: Promise<WidgetView>;
|
183 | };
|
184 | state_change: Promise<any>;
|
185 | comm: IClassicComm;
|
186 | name: string;
|
187 | module: string;
|
188 | private _comm_live;
|
189 | private _closed;
|
190 | private _state_lock;
|
191 | private _buffered_state_diff;
|
192 | private _msg_buffer;
|
193 | private _msg_buffer_callbacks;
|
194 | private _pending_msgs;
|
195 | private _expectedEchoMsgIds;
|
196 | private _attrsToUpdate;
|
197 | }
|
198 | export declare class DOMWidgetModel extends WidgetModel {
|
199 | static serializers: ISerializers;
|
200 | defaults(): any;
|
201 | }
|
202 | export declare class WidgetView extends NativeView<WidgetModel> {
|
203 | |
204 |
|
205 |
|
206 | constructor(options?: Backbone.ViewOptions<WidgetModel> & {
|
207 | options?: any;
|
208 | });
|
209 | /**
|
210 | * Initializer, called at the end of the constructor.
|
211 | */
|
212 | initialize(parameters: WidgetView.InitializeParameters): void;
|
213 | /**
|
214 | * Triggered on model change.
|
215 | *
|
216 | * Update view to be consistent with this.model
|
217 | */
|
218 | update(options?: any): void;
|
219 | /**
|
220 | * Render a view
|
221 | *
|
222 | * @returns the view or a promise to the view.
|
223 | */
|
224 | render(): any;
|
225 | /**
|
226 | * Create and promise that resolves to a child view of a given model
|
227 | */
|
228 | create_child_view(child_model: WidgetModel, options?: {}): Promise<DOMWidgetView>;
|
229 | /**
|
230 | * Create msg callbacks for a comm msg.
|
231 | */
|
232 | callbacks(): ICallbacks;
|
233 | /**
|
234 | * Send a custom msg associated with this view.
|
235 | */
|
236 | send(content: {}, buffers?: ArrayBuffer[] | ArrayBufferView[]): void;
|
237 | touch(): void;
|
238 | remove(): any;
|
239 | options: any;
|
240 | /**
|
241 | * A promise that resolves to the parent view when a child view is displayed.
|
242 | */
|
243 | displayed: Promise<WidgetView>;
|
244 | }
|
245 | export declare namespace WidgetView {
|
246 | interface InitializeParameters<T extends WidgetModel = WidgetModel> extends Backbone.ViewOptions<T> {
|
247 | options: any;
|
248 | }
|
249 | }
|
250 | export declare namespace JupyterPhosphorWidget {
|
251 | interface IOptions {
|
252 | view: DOMWidgetView;
|
253 | }
|
254 | }
|
255 | export declare class JupyterPhosphorWidget extends Widget {
|
256 | constructor(options: Widget.IOptions & JupyterPhosphorWidget.IOptions);
|
257 | /**
|
258 | * Dispose the widget.
|
259 | *
|
260 | * This causes the view to be destroyed as well with 'remove'
|
261 | */
|
262 | dispose(): void;
|
263 | /**
|
264 | * Process the phosphor message.
|
265 | *
|
266 | * Any custom phosphor widget used inside a Jupyter widget should override
|
267 | * the processMessage function like this.
|
268 | */
|
269 | processMessage(msg: Message): void;
|
270 | private _view;
|
271 | }
|
272 | export declare class JupyterPhosphorPanelWidget extends Panel {
|
273 | constructor(options: JupyterPhosphorWidget.IOptions & Panel.IOptions);
|
274 | /**
|
275 | * Process the phosphor message.
|
276 | *
|
277 | * Any custom phosphor widget used inside a Jupyter widget should override
|
278 | * the processMessage function like this.
|
279 | */
|
280 | processMessage(msg: Message): void;
|
281 | /**
|
282 | * Dispose the widget.
|
283 | *
|
284 | * This causes the view to be destroyed as well with 'remove'
|
285 | */
|
286 | dispose(): void;
|
287 | private _view;
|
288 | }
|
289 | export declare class DOMWidgetView extends WidgetView {
|
290 | |
291 |
|
292 |
|
293 | initialize(parameters: WidgetView.InitializeParameters): void;
|
294 | setLayout(layout: WidgetModel, oldLayout?: WidgetModel): void;
|
295 | setStyle(style: WidgetModel, oldStyle?: WidgetModel): void;
|
296 | |
297 |
|
298 |
|
299 | update_classes(old_classes: string[], new_classes: string[], el?: HTMLElement): void;
|
300 | |
301 |
|
302 |
|
303 |
|
304 |
|
305 |
|
306 |
|
307 |
|
308 |
|
309 |
|
310 |
|
311 |
|
312 |
|
313 |
|
314 |
|
315 |
|
316 |
|
317 |
|
318 |
|
319 |
|
320 |
|
321 |
|
322 |
|
323 |
|
324 | update_mapped_classes(class_map: {
|
325 | [key: string]: string[];
|
326 | }, trait_name: string, el?: HTMLElement): void;
|
327 | set_mapped_classes(class_map: {
|
328 | [key: string]: string[];
|
329 | }, trait_name: string, el?: HTMLElement): void;
|
330 | _setElement(el: HTMLElement): void;
|
331 | remove(): any;
|
332 | processPhosphorMessage(msg: Message): void;
|
333 | private _comm_live_update;
|
334 | '$el': any;
|
335 | pWidget: Widget;
|
336 | layoutPromise: Promise<any>;
|
337 | stylePromise: Promise<any>;
|
338 | }
|