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