Hello everyone,
I am trying to migrate a theme to jupyterlite 0.2.0 (hence jupyterlab v4) and after trying a lot of different things, I can’t seem to make it work. The build is successful but my theme fails to activate and I get the following error:
index.es6.js:2015 TypeError: No provider for: @jupyterlab/apputils:IThemeManager.
Here is my package.json:
{
"name": "@custom/theme-light",
"version": "0.1.0",
"description": "A custom Light theme for JupyterLab",
"keywords": [
"jupyter",
"jupyterlab",
"jupyterlab-extension"
],
"files": [
"lib/**/*.{d.ts,eot,gif,html,jpg,js,js.map,json,png,svg,woff2,ttf}",
"style/**/*.{css,eot,gif,html,jpg,json,png,svg,woff2,ttf}"
],
"main": "lib/index.js",
"types": "lib/index.d.ts"
"scripts": {
"build": "jlpm build:lib && jlpm build:labextension:dev",
"build:prod": "jlpm build:lib && jlpm build:labextension",
"build:labextension": "jupyter labextension build .",
"build:labextension:dev": "jupyter labextension build --development True .",
"build:lib": "tsc",
"dist": "cd ../../dist && npm pack ../packages/custom",
"clean": "jlpm clean:lib",
"clean:lib": "rimraf lib tsconfig.tsbuildinfo",
"clean:labextension": "rimraf ../../custom/labextension",
"clean:all": "jlpm clean:lib && jlpm clean:labextension",
"docs": "typedoc src",
"watch": "run-p watch:src watch:labextension",
"watch:src": "tsc -w",
"watch:labextension": "jupyter labextension watch ."
},
"dependencies": {
"@jupyterlab/application": "^4.0.7",
"@jupyterlab/apputils": "~4.1.7"
},
"devDependencies": {
"@jupyterlab/builder": "^4.0.0",
"npm-run-all": "^4.1.5",
"rimraf": "^5.0.1",
"typescript": "~5.2.2",
"yarn-deduplicate": "^6.0.2"
},
"sideEffects": [
"style/*.css"
],
"jupyterlab": {
"extension": true,
"themePath": "style/index.css",
"outputDir": "../../custom/theme-light"
},
"jupyterlite": {
"liteExtension": true
}
}
And the retty standard index.js:
import {
JupyterFrontEnd,
JupyterFrontEndPlugin
} from '@jupyterlab/application';
import { IThemeManager } from '@jupyterlab/apputils';
const extension: JupyterFrontEndPlugin<void> = {
id: '@custom/theme-light',
requires: [IThemeManager],
autoStart: true,
activate: (
app: JupyterFrontEnd,
manager: IThemeManager ) => {
const style = '@custom/theme-light/index.css';
console.log("activate theme?")
console.log("manager %o", manager);
manager.register({
name: 'Custom Light',
isLight: true,
themeScrollbars: true,
load: () => manager.loadCSS(style),
unload: () => Promise.resolve(undefined)
});
}
};
export default extension;
Of course I checked the changelog but haven’t find anything on IThemeManager changing from v3. I tried to switch the IThemeManager to “optional” but without success.
Thank you in advance for any guidance you may provide!
Thibaut