diff --git a/package-lock.json b/package-lock.json index aaf62b56..06f4c7d0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,9 +14,6 @@ "styles", "docs" ], - "dependencies": { - "thebe-core": "file:../../GitHub/thebe/thebe/packages/core/thebe-core-0.4.7.tgz" - }, "devDependencies": { "@changesets/cli": "^2.26.1", "@remix-run/node": "~1.17.0", @@ -36645,9 +36642,9 @@ "dev": true }, "node_modules/thebe-core": { - "version": "0.4.7", - "resolved": "file:../../GitHub/thebe/thebe/packages/core/thebe-core-0.4.7.tgz", - "integrity": "sha512-C1+6rEQ9He8nEO543MArUvKc872Fv9YqmbFiYtYJkDU2qV2FJJwGXRRpuAyKqG3gWyNy+gqgJUH+3pgj1ERd8Q==", + "version": "0.4.9", + "resolved": "https://registry.npmjs.org/thebe-core/-/thebe-core-0.4.9.tgz", + "integrity": "sha512-vFPxBdLD2CwEjbGCjK/H8chITBDTQVAwF/A/wQaVsJ7fd+2r+IpuCZzbW7qb4Zf+aLIo3ILVfTHYE7WHnfvqxg==", "license": "MIT", "dependencies": { "@jupyter-widgets/base": "^6.0.6", @@ -36673,7 +36670,7 @@ "copy-thebe-assets": "bin/copy-thebe-assets.cjs" }, "peerDependencies": { - "thebe-lite": "^0.4.7" + "thebe-lite": "^0.4.9" } }, "node_modules/thebe-core/node_modules/nanoid": { @@ -36694,9 +36691,9 @@ } }, "node_modules/thebe-lite": { - "version": "0.4.7", - "resolved": "https://registry.npmjs.org/thebe-lite/-/thebe-lite-0.4.7.tgz", - "integrity": "sha512-k5E/GIlwAHoHhEjLopms8nLSnZypDzwbDHSdqSDtzO2Q4Xoz/1mNZQsmhIRxyZUmT2Hh8nWIXuqRiWF46P+0OA==", + "version": "0.4.9", + "resolved": "https://registry.npmjs.org/thebe-lite/-/thebe-lite-0.4.9.tgz", + "integrity": "sha512-UJv+vXCX+jaIejKxEEUCb5K/MCpT0gDC7eU6ZDJTrPyBhYXWHWW+6LTPkYZxLMFvJZ4RxxHSwpqbf//lcQQGlw==", "license": "MIT", "dependencies": { "@jupyterlab/coreutils": "^6.0.8", @@ -36708,15 +36705,15 @@ } }, "node_modules/thebe-react": { - "version": "0.4.7", - "resolved": "https://registry.npmjs.org/thebe-react/-/thebe-react-0.4.7.tgz", - "integrity": "sha512-pL22DLZKwhspUoHNyQVKaSbOrqfIZMzzfW3cIUqBVAFHVWZsXHdtlQ3rogh1PEPtnftlkIYfmeroHeeIfP+nDg==", + "version": "0.4.9", + "resolved": "https://registry.npmjs.org/thebe-react/-/thebe-react-0.4.9.tgz", + "integrity": "sha512-FYstHIFMfmXbS+bj0ZkvD1KCL+jmNUYJLPy1xKkiYneiQ1nfCbcP4X0jhiVCQaC1PIh9RqCYBhljKmCLJGTqyQ==", "license": "MIT", "dependencies": { "@jupyterlab/nbformat": "^3.5.0", "react": "^18.2.0", "react-dom": "^18.2.0", - "thebe-core": "^0.4.7" + "thebe-core": "^0.4.9" } }, "node_modules/thebe-react/node_modules/@jupyterlab/nbformat": { @@ -39659,9 +39656,9 @@ "nbtx": "^0.2.3", "react-syntax-highlighter": "^15.5.0", "swr": "^2.1.5", - "thebe-core": "^0.4.7", - "thebe-lite": "^0.4.7", - "thebe-react": "^0.4.7", + "thebe-core": "^0.4.9", + "thebe-lite": "^0.4.9", + "thebe-react": "^0.4.9", "unist-util-select": "^4.0.3" }, "engines": { @@ -39900,7 +39897,7 @@ "nbtx": "^0.2.3", "node-cache": "^5.1.2", "node-fetch": "^2.6.11", - "thebe-react": "^0.4.6", + "thebe-react": "^0.4.9", "unist-util-select": "^4.0.1" }, "devDependencies": { diff --git a/package.json b/package.json index e1fdc334..b94d33f6 100644 --- a/package.json +++ b/package.json @@ -51,8 +51,5 @@ "npm": ">=7.0.0", "node": ">=14.0.0" }, - "packageManager": "npm@8.10.0", - "dependencies": { - "thebe-core": "file:../../GitHub/thebe/thebe/packages/core/thebe-core-0.4.7.tgz" - } + "packageManager": "npm@8.10.0" } diff --git a/packages/jupyter/package.json b/packages/jupyter/package.json index 82b484f8..5d886e54 100644 --- a/packages/jupyter/package.json +++ b/packages/jupyter/package.json @@ -40,9 +40,9 @@ "nbtx": "^0.2.3", "react-syntax-highlighter": "^15.5.0", "swr": "^2.1.5", - "thebe-core": "^0.4.7", - "thebe-lite": "^0.4.7", - "thebe-react": "^0.4.7", + "thebe-core": "^0.4.9", + "thebe-lite": "^0.4.9", + "thebe-react": "^0.4.9", "unist-util-select": "^4.0.3" }, "peerDependencies": { diff --git a/packages/jupyter/src/execute/actions.ts b/packages/jupyter/src/execute/actions.ts index 03963459..3848c36e 100644 --- a/packages/jupyter/src/execute/actions.ts +++ b/packages/jupyter/src/execute/actions.ts @@ -1,6 +1,11 @@ import type { SourceFileKind, Dependency } from 'myst-spec-ext'; import type { BuildStatus, Computable } from './types.js'; -import type { IRenderMimeRegistry, ThebeNotebook, ThebeSession } from 'thebe-core'; +import type { + IRenderMimeRegistry, + ThebeNotebook, + ThebePassiveManager, + ThebeSession, +} from 'thebe-core'; import type { GenericParent } from 'myst-common'; export function isNavigatePayload(payload: unknown): payload is NavigatePayload { @@ -90,7 +95,7 @@ interface AddNotebookPayload { } interface AddPassivePayload { - manager: any; //TODO ThebePassiveManager + manager: ThebePassiveManager; rendermime: IRenderMimeRegistry; pageSlug: string; } diff --git a/packages/jupyter/src/execute/provider.tsx b/packages/jupyter/src/execute/provider.tsx index edaa1968..3dc81953 100644 --- a/packages/jupyter/src/execute/provider.tsx +++ b/packages/jupyter/src/execute/provider.tsx @@ -13,8 +13,8 @@ import { } from './selectors.js'; import { MdastFetcher, NotebookBuilder, ServerMonitor, SessionStarter } from './leaf.js'; import type { GenericParent } from 'myst-common'; -import { WidgetsMetaData } from '../../../common/dist/types.js'; -import {useThebeLoader} from 'thebe-react'; +import type { WidgetsMetaData } from '@myst-theme/common'; +import { useThebeLoader } from 'thebe-react'; export interface ExecuteScopeType { canCompute: boolean; @@ -32,7 +32,7 @@ type ArticleContents = { mdast: GenericParent; location?: string; dependencies?: Dependency[]; - widgets?:WidgetsMetaData; + widgets?: WidgetsMetaData; }; function useScopeNavigate({ @@ -109,34 +109,30 @@ export function ExecuteScopeProvider({ children, enable, contents, -}: React.PropsWithChildren<{ enable: boolean; contents: ArticleContents ;}>) { +}: React.PropsWithChildren<{ enable: boolean; contents: ArticleContents }>) { // compute incoming for first render const computables: Computable[] = listComputables(contents.mdast); const fallbackLocation = contents.kind === SourceFileKind.Notebook ? '/fallback.ipynb' : '/'; - const { core } = useThebeLoader(); - const [isCoreLoaded, setIsCoreLoaded] = useState(false); - useEffect(() => { - if (core) { - setIsCoreLoaded(true); - } - }, [core]); useEffect(() => { - if (isCoreLoaded && core) { + if (core) { const rendermime = core.makeRenderMimeRegistry(); - const manager = new core.ThebePassiveManager(rendermime, contents?.widgets?.["application/vnd.jupyter.widget-state+json"]); + const manager = new core.ThebePassiveManager( + rendermime, + contents?.widgets?.['application/vnd.jupyter.widget-state+json'], + ); dispatch({ type: 'ADD_PASSIVE', payload: { rendermime, manager, - pageSlug:contents.slug + pageSlug: contents.slug, }, }); } - }, [isCoreLoaded, core, contents?.widgets]); + }, [core, contents?.widgets]); const initialState: ExecuteScopeState = { mdast: { @@ -152,7 +148,7 @@ export function ExecuteScopeProvider({ computables, ready: false, scopes: {}, - passive: undefined + passive: undefined, }, }, builds: {}, diff --git a/packages/jupyter/src/execute/types.ts b/packages/jupyter/src/execute/types.ts index f40a826b..ab12276b 100644 --- a/packages/jupyter/src/execute/types.ts +++ b/packages/jupyter/src/execute/types.ts @@ -1,6 +1,11 @@ import type { GenericParent } from 'myst-common'; import type { SourceFileKind, Dependency } from 'myst-spec-ext'; -import type { IRenderMimeRegistry, ThebeNotebook, ThebeSession, ThebePassiveManager } from 'thebe-core'; +import type { + IRenderMimeRegistry, + ThebeNotebook, + ThebeSession, + ThebePassiveManager, +} from 'thebe-core'; export type BuildStatus = | 'pending' @@ -33,10 +38,10 @@ export interface ExecuteScopeState { scopes: { [notebookSlug: string]: ExecutionScope; }; - passive? : { + passive?: { manager: ThebePassiveManager; - rendermime: IRenderMimeRegistry - } + rendermime: IRenderMimeRegistry; + }; }; }; builds: { diff --git a/packages/site/package.json b/packages/site/package.json index 7c6f4fd0..ce6363f6 100644 --- a/packages/site/package.json +++ b/packages/site/package.json @@ -33,7 +33,7 @@ "nbtx": "^0.2.3", "node-cache": "^5.1.2", "node-fetch": "^2.6.11", - "thebe-react": "^0.4.6", + "thebe-react": "^0.4.9", "unist-util-select": "^4.0.1" }, "peerDependencies": {