From 01bd241af3a864d38acbf39795a11992cdd82058 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Collonval?= Date: Tue, 5 Sep 2023 09:55:00 +0200 Subject: [PATCH] Move token to its own file --- packages/lab/src/index.ts | 9 +++------ packages/lab/src/preview.ts | 22 ++-------------------- packages/lab/src/tokens.ts | 16 ++++++++++++++++ 3 files changed, 21 insertions(+), 26 deletions(-) create mode 100644 packages/lab/src/tokens.ts diff --git a/packages/lab/src/index.ts b/packages/lab/src/index.ts index 0305dfb..9ce1a01 100644 --- a/packages/lab/src/index.ts +++ b/packages/lab/src/index.ts @@ -32,13 +32,10 @@ import { ReadonlyPartialJSONObject } from '@lumino/coreutils'; import { fullScreenIcon, RISEIcon } from './icons'; -import { - RisePreview, - IRisePreviewTracker, - RisePreviewFactory -} from './preview'; +import { RisePreview, RisePreviewFactory } from './preview'; +import { IRisePreviewTracker } from './tokens'; -export { IRisePreviewTracker } from './preview'; +export { IRisePreviewTracker } from './tokens'; /** * Command IDs namespace for JupyterLab RISE extension diff --git a/packages/lab/src/preview.ts b/packages/lab/src/preview.ts index 0210831..cc4cdfd 100644 --- a/packages/lab/src/preview.ts +++ b/packages/lab/src/preview.ts @@ -1,9 +1,4 @@ -import { - IFrame, - ToolbarButton, - IWidgetTracker, - Toolbar -} from '@jupyterlab/apputils'; +import { IFrame, ToolbarButton, Toolbar } from '@jupyterlab/apputils'; import { ABCWidgetFactory, @@ -19,7 +14,7 @@ import { refreshIcon } from '@jupyterlab/ui-components'; import { CommandRegistry } from '@lumino/commands'; -import { PromiseDelegate, Token } from '@lumino/coreutils'; +import { PromiseDelegate } from '@lumino/coreutils'; import { Message } from '@lumino/messaging'; @@ -29,19 +24,6 @@ import { Widget } from '@lumino/widgets'; import { fullScreenIcon, RISEIcon } from './icons'; -/** - * A class that tracks Rise Preview widgets. - */ -// eslint-disable-next-line @typescript-eslint/no-empty-interface -export interface IRisePreviewTracker extends IWidgetTracker {} - -/** - * The Rise Preview tracker token. - */ -export const IRisePreviewTracker = new Token( - 'jupyterlab-rise:IRisePreviewTracker' -); - /** * A DocumentWidget that shows a Rise preview in an IFrame. */ diff --git a/packages/lab/src/tokens.ts b/packages/lab/src/tokens.ts new file mode 100644 index 0000000..392c951 --- /dev/null +++ b/packages/lab/src/tokens.ts @@ -0,0 +1,16 @@ +import { IWidgetTracker } from '@jupyterlab/apputils'; +import { Token } from '@lumino/coreutils'; +import type { RisePreview } from './preview'; + +/** + * A class that tracks Rise Preview widgets. + */ +// eslint-disable-next-line @typescript-eslint/no-empty-interface +export interface IRisePreviewTracker extends IWidgetTracker {} + +/** + * The Rise Preview tracker token. + */ +export const IRisePreviewTracker = new Token( + 'jupyterlab-rise:IRisePreviewTracker' +);