Skip to content

Commit

Permalink
Update import
Browse files Browse the repository at this point in the history
  • Loading branch information
trungleduc committed Feb 17, 2023
1 parent b6d4d68 commit 63d1079
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 35 deletions.
12 changes: 4 additions & 8 deletions src/notebookrenderer/index.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
import {
createRendermimePlugin,
JupyterFrontEnd,
JupyterFrontEndPlugin
} from '@jupyterlab/application';
import { ISessionContext, WidgetTracker } from '@jupyterlab/apputils';
import { ISessionContext } from '@jupyterlab/apputils';
import { IChangedArgs } from '@jupyterlab/coreutils';
import { MimeDocument } from '@jupyterlab/docregistry';
import { INotebookTracker } from '@jupyterlab/notebook';
import { IRenderMimeRegistry } from '@jupyterlab/rendermime';
import { IRenderMime } from '@jupyterlab/rendermime-interfaces';
import { IKernelConnection } from '@jupyterlab/services/lib/kernel/kernel';
import { Kernel } from '@jupyterlab/services';

import { IAnnotationModel } from '../types';
import { IAnnotation } from './../token';
import { NotebookRendererModel } from './model';
import { IJupyterCadWidgetManager } from './token';
import { NotebookRenderer } from './view';
Expand Down Expand Up @@ -64,8 +60,8 @@ export const ypyWidgetManager: JupyterFrontEndPlugin<IJupyterCadWidgetManager> =
const onKernelChanged = (
_: ISessionContext,
changedArgs: IChangedArgs<
IKernelConnection | null,
IKernelConnection | null,
Kernel.IKernelConnection | null,
Kernel.IKernelConnection | null,
'kernel'
>
) => {
Expand Down
7 changes: 2 additions & 5 deletions src/notebookrenderer/token.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import {
IComm,
IKernelConnection
} from '@jupyterlab/services/lib/kernel/kernel';
import { Kernel } from '@jupyterlab/services';
import { Token } from '@lumino/coreutils';
import { IJupyterCadModel } from '../types';

Expand All @@ -10,7 +7,7 @@ export interface IJupyterCadWidgetModelRegistry {
}

export interface IJupyterCadWidgetManager {
registerKernel(kernel: IKernelConnection): void;
registerKernel(kernel: Kernel.IKernelConnection): void;
getWidgetModel(
kernelId: string,
commId: string
Expand Down
14 changes: 5 additions & 9 deletions src/notebookrenderer/widgetManager.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
import { URLExt } from '@jupyterlab/coreutils';
import { ServerConnection, ServiceManager, User } from '@jupyterlab/services';
import {
IComm,
IKernelConnection
} from '@jupyterlab/services/lib/kernel/kernel';
import { ICommOpenMsg } from '@jupyterlab/services/lib/kernel/messages';
import { Kernel, KernelMessage } from '@jupyterlab/services';
import { JupyterCadModel } from '../model';
import {
IJupyterCadWidgetModelRegistry,
Expand All @@ -20,7 +16,7 @@ export class JupyterCadWidgetManager implements IJupyterCadWidgetManager {
constructor(options: { manager: ServiceManager.IManager }) {
this._manager = options.manager;
}
registerKernel(kernel: IKernelConnection): void {
registerKernel(kernel: Kernel.IKernelConnection): void {
const wm = new WidgetModelRegistry({ kernel, manager: this._manager });
this._registry.set(kernel.id, wm);
}
Expand All @@ -44,7 +40,7 @@ export class JupyterCadWidgetManager implements IJupyterCadWidgetManager {

export class WidgetModelRegistry implements IJupyterCadWidgetModelRegistry {
constructor(options: {
kernel: IKernelConnection;
kernel: Kernel.IKernelConnection;
manager: ServiceManager.IManager;
}) {
const { kernel, manager } = options;
Expand All @@ -60,8 +56,8 @@ export class WidgetModelRegistry implements IJupyterCadWidgetModelRegistry {
* Handle when a comm is opened.
*/
private _handle_comm_open = async (
comm: IComm,
msg: ICommOpenMsg
comm: Kernel.IComm,
msg: KernelMessage.ICommOpenMsg
): Promise<void> => {
const { path, format, contentType } = msg.content.data as {
path?: string;
Expand Down
9 changes: 4 additions & 5 deletions src/notebookrenderer/yCommProvider.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { IComm } from '@jupyterlab/services/lib/kernel/kernel';
import { ICommMsgMsg } from '@jupyterlab/services/lib/kernel/messages';
import { Kernel, KernelMessage } from '@jupyterlab/services';
import * as decoding from 'lib0/decoding';
import * as encoding from 'lib0/encoding';
import * as syncProtocol from 'y-protocols/sync';
Expand All @@ -11,7 +10,7 @@ export enum YMessageType {
AWARENESS = 1
}
export class YCommProvider implements IDisposable {
constructor(options: { comm: IComm; ydoc: Y.Doc }) {
constructor(options: { comm: Kernel.IComm; ydoc: Y.Doc }) {
this._comm = options.comm;
this._ydoc = options.ydoc;
this._ydoc.on('update', this._updateHandler);
Expand Down Expand Up @@ -42,7 +41,7 @@ export class YCommProvider implements IDisposable {
this._comm.close();
this._isDisposed = true;
}
private _onMsg = (msg: ICommMsgMsg<'iopub' | 'shell'>) => {
private _onMsg = (msg: KernelMessage.ICommMsgMsg<'iopub' | 'shell'>) => {
if (msg.buffers) {
const buffer = msg.buffers[0] as ArrayBuffer;
const encoder = Private.readMessage(this, new Uint8Array(buffer), true);
Expand Down Expand Up @@ -75,7 +74,7 @@ export class YCommProvider implements IDisposable {
this._comm.send({}, undefined, [bufferArray.buffer]);
}

private _comm: IComm;
private _comm: Kernel.IComm;
private _ydoc: Y.Doc;
private _synced: boolean;
private _isDisposed = false;
Expand Down
11 changes: 4 additions & 7 deletions src/widget.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
import * as React from 'react';

import { ReactWidget } from '@jupyterlab/apputils';
import { ObservableMap, IObservableMap } from '@jupyterlab/observables';
import { DocumentRegistry, DocumentWidget } from '@jupyterlab/docregistry';

import { DocumentWidget } from '@jupyterlab/docregistry';
import { IObservableMap, ObservableMap } from '@jupyterlab/observables';
import { JSONValue } from '@lumino/coreutils';
import { ISignal, Signal } from '@lumino/signaling';
import * as React from 'react';

import { MainView } from './mainview';
import { JupyterCadModel } from './model';
import {
AxeHelper,
ExplodedView,
IJupyterCadModel,
IJupyterCadWidget
} from './types';
import { JSONValue } from '@lumino/coreutils';

export class JupyterCadWidget
extends DocumentWidget<JupyterCadPanel, IJupyterCadModel>
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"moduleResolution": "node",
"noEmitOnError": true,
"noImplicitAny": false,
"noUnusedLocals": false,
"noUnusedLocals": true,
"preserveWatchOutput": true,
"resolveJsonModule": true,
"outDir": "lib",
Expand Down

0 comments on commit 63d1079

Please sign in to comment.