11import type { IRenderMimeRegistry } from '@jupyterlab/rendermime' ;
22import type { Widget } from '@lumino/widgets' ;
3-
43import * as LuminoWidget from '@lumino/widgets' ;
54import { MessageLoop } from '@lumino/messaging' ;
6-
75import { KernelWidgetManager , WidgetRenderer , output } from '@jupyter-widgets/jupyterlab-manager' ;
8-
9- export const WIDGET_MIMETYPE = 'application/vnd.jupyter.widget-view+json' ;
10-
116import * as base from '@jupyter-widgets/base' ;
127import * as controls from '@jupyter-widgets/controls' ;
138import { shortId } from './utils' ;
149import { RequireJsLoader } from './requireJsLoader' ;
1510import { requireLoader } from './loader' ;
1611import type { Kernel } from '@jupyterlab/services' ;
1712
13+ export const WIDGET_STATE_MIMETYPE = 'application/vnd.jupyter.widget-state+json' ;
14+ export const WIDGET_VIEW_MIMETYPE = 'application/vnd.jupyter.widget-view+json' ;
15+
16+ /**
17+ * @deprecated use WIDGET_VIEW_MIMETYPE
18+ */
19+ export const WIDGET_MIMETYPE = WIDGET_VIEW_MIMETYPE ;
20+
1821/**
1922 * A Widget Manager class for Thebe using the context-free KernelWidgetManager from
2023 * the JupyterLab Manager and inspierd by the implementation in Voila here:
@@ -32,25 +35,17 @@ export class ThebeManager extends KernelWidgetManager {
3235 /** ensure this registry always gets the widget renderer.
3336 * This is essential for cases where widgets are rendered heirarchically
3437 */
35- this . addWidgetFactories ( ) ;
36-
37- this . _registerWidgets ( ) ;
38- this . _loader = new RequireJsLoader ( ) ;
39- }
40-
41- addWidgetFactories ( ) {
4238 this . rendermime . addFactory (
4339 {
4440 safe : false ,
45- mimeTypes : [ WIDGET_MIMETYPE ] ,
41+ mimeTypes : [ WIDGET_VIEW_MIMETYPE ] ,
4642 createRenderer : ( options ) => new WidgetRenderer ( options , this as any ) ,
4743 } ,
4844 1 ,
4945 ) ;
50- }
5146
52- removeWidgetFactories ( ) {
53- this . rendermime . removeMimeType ( WIDGET_MIMETYPE ) ;
47+ this . _registerWidgets ( ) ;
48+ this . _loader = new RequireJsLoader ( ) ;
5449 }
5550
5651 /**
0 commit comments