Skip to content

Commit

Permalink
Export IFavorites (#1)
Browse files Browse the repository at this point in the history
* add labextension to gitignore
add dep to coreutils
add token and interface IFavorites
export IFavorites

Co-authored-by: Frédéric Collonval <fcollonval@users.noreply.github.com>

* Fix CI

---------

Co-authored-by: Frédéric Collonval <fcollonval@users.noreply.github.com>
Co-authored-by: Frédéric Collonval <fcollonval@gmail.com>
  • Loading branch information
3 people authored Aug 28, 2023
1 parent 976d622 commit a07b08c
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 4 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
11 changes: 8 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<void> = {
const favorites: JupyterFrontEndPlugin<IFavorites> = {
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;
Expand Down Expand Up @@ -213,6 +216,8 @@ const favorites: JupyterFrontEndPlugin<void> = {
execute: () => favoritesManager.clearFavorites(),
label: 'Clear Favorites'
});

return favoritesManager;
}
};

Expand Down
10 changes: 10 additions & 0 deletions src/token.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { Token } from '@lumino/coreutils';

export namespace PluginIDs {
export const favorites = 'jupyterlab-favorites';
}
Expand Down Expand Up @@ -32,3 +34,11 @@ export namespace IFavorites {
showWidget?: boolean;
};
}

export const IFavorites = new Token<IFavorites>(
'jupyterlab-favorites:IFavorites'
);

export interface IFavorites {
readonly favorites: IFavorites.Favorite[];
}
3 changes: 2 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit a07b08c

Please sign in to comment.