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