From 10b8be229c172737702a11d68ec0d23f1aa2a827 Mon Sep 17 00:00:00 2001 From: Adrien DELSALLE Date: Fri, 30 Jul 2021 16:44:47 +0200 Subject: [PATCH 1/2] add labextension to gitignore add dep to coreutils add token and interface IFavorites export IFavorites MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Frédéric Collonval --- package.json | 1 + src/index.ts | 11 ++++++++--- src/token.ts | 8 ++++++++ 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 4449abe..7ebcd26 100644 --- a/package.json +++ b/package.json @@ -79,6 +79,7 @@ "@jupyterlab/ui-components": "^4.0.5", "@lumino/algorithm": "^2.0.0", "@lumino/commands": "^2.0.1", + "@lumino/coreutils": "^2.0.1", "@lumino/signaling": "^2.0.0", "@lumino/widgets": "^2.0.1" }, diff --git a/src/index.ts b/src/index.ts index b8e008e..498e939 100644 --- a/src/index.ts +++ b/src/index.ts @@ -22,23 +22,26 @@ import { } from './utils'; import { PageConfig } from '@jupyterlab/coreutils'; +export { IFavorites } from './token'; + const TOOLBAR_CLASS = 'jp-FileBrowser-toolbar'; /** * Initialization data for the jupyterlab-favorites extension. */ -const favorites: JupyterFrontEndPlugin = { +const favorites: JupyterFrontEndPlugin = { id: PluginIDs.favorites, autoStart: true, requires: [IDefaultFileBrowser, IFileBrowserFactory, ISettingRegistry], + provides: IFavorites, optional: [IMainMenu], - activate: async ( + activate: ( app: JupyterFrontEnd, filebrowser: IDefaultFileBrowser, factory: IFileBrowserFactory, settingsRegistry: ISettingRegistry, mainMenu: IMainMenu - ) => { + ): IFavorites => { console.log('JupyterLab extension jupyterlab-favorites is activated!'); const docRegistry = app.docRegistry; const layout = filebrowser.layout as PanelLayout; @@ -213,6 +216,8 @@ const favorites: JupyterFrontEndPlugin = { execute: () => favoritesManager.clearFavorites(), label: 'Clear Favorites' }); + + return favoritesManager; } }; diff --git a/src/token.ts b/src/token.ts index 44e7c29..35ba946 100644 --- a/src/token.ts +++ b/src/token.ts @@ -1,3 +1,5 @@ +import { Token } from '@lumino/coreutils'; + export namespace PluginIDs { export const favorites = 'jupyterlab-favorites'; } @@ -32,3 +34,9 @@ export namespace IFavorites { showWidget?: boolean; }; } + +export const IFavorites = new Token('jupyterlab-favorites:IFavorites'); + +export interface IFavorites { + readonly favorites: IFavorites.Favorite[]; +} From cb6fac1e7a00aab4825e6ab6105466f1672b0533 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Collonval?= Date: Tue, 22 Aug 2023 15:58:17 +0200 Subject: [PATCH 2/2] Fix CI --- src/token.ts | 4 +++- yarn.lock | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/token.ts b/src/token.ts index 35ba946..b52ed2f 100644 --- a/src/token.ts +++ b/src/token.ts @@ -35,7 +35,9 @@ export namespace IFavorites { }; } -export const IFavorites = new Token('jupyterlab-favorites:IFavorites'); +export const IFavorites = new Token( + 'jupyterlab-favorites:IFavorites' +); export interface IFavorites { readonly favorites: IFavorites.Favorite[]; diff --git a/yarn.lock b/yarn.lock index ac802fd..e0c2e20 100644 --- a/yarn.lock +++ b/yarn.lock @@ -193,6 +193,7 @@ __metadata: "@jupyterlab/ui-components": ^4.0.5 "@lumino/algorithm": ^2.0.0 "@lumino/commands": ^2.0.1 + "@lumino/coreutils": ^2.0.1 "@lumino/signaling": ^2.0.0 "@lumino/widgets": ^2.0.1 "@types/json-schema": ^7.0.11 @@ -714,7 +715,7 @@ __metadata: languageName: node linkType: hard -"@lumino/coreutils@npm:^1.11.0 || ^2.0.0, @lumino/coreutils@npm:^1.11.0 || ^2.1.2, @lumino/coreutils@npm:^2.1.2": +"@lumino/coreutils@npm:^1.11.0 || ^2.0.0, @lumino/coreutils@npm:^1.11.0 || ^2.1.2, @lumino/coreutils@npm:^2.0.1, @lumino/coreutils@npm:^2.1.2": version: 2.1.2 resolution: "@lumino/coreutils@npm:2.1.2" checksum: 7865317ac0676b448d108eb57ab5d8b2a17c101995c0f7a7106662d9fe6c859570104525f83ee3cda12ae2e326803372206d6f4c1f415a5b59e4158a7b81066f