@myst-theme/jupyter 0.15.2 → 0.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/block.js CHANGED
@@ -5,12 +5,12 @@ import classNames from 'classnames';
5
5
  import { NotebookClearCell, NotebookRunCell, NotebookRunCellSpinnerOnly, } from './controls/index.js';
6
6
  import { usePageKind } from '@myst-theme/providers';
7
7
  export function NotebookBlock({ node, className }) {
8
- var _a, _b;
8
+ var _a, _b, _c, _d;
9
9
  const pageKind = usePageKind();
10
- const block = (_jsxs("div", { id: node.key, className: classNames('relative group/block', className, node.class, {
11
- [(_a = node.data) === null || _a === void 0 ? void 0 : _a.class]: typeof ((_b = node.data) === null || _b === void 0 ? void 0 : _b.class) === 'string',
10
+ const block = (_jsxs("div", { id: (_b = (_a = node.html_id) !== null && _a !== void 0 ? _a : node.identifier) !== null && _b !== void 0 ? _b : node.key, className: classNames('relative group/block', className, node.class, {
11
+ [(_c = node.data) === null || _c === void 0 ? void 0 : _c.class]: typeof ((_d = node.data) === null || _d === void 0 ? void 0 : _d.class) === 'string',
12
12
  hidden: node.visibility === 'remove',
13
- }), children: [pageKind === SourceFileKind.Notebook && node.kind === 'notebook-code' && (_jsxs(_Fragment, { children: [_jsx("div", { className: "flex sticky top-[80px] z-10 opacity-70 group-hover/block:opacity-100 group-hover/block:hidden", children: _jsx("div", { className: "absolute top-0 -right-[28px] flex md:flex-col", children: _jsx(NotebookRunCellSpinnerOnly, { id: node.key }) }) }), _jsx("div", { className: "hidden sticky top-[80px] z-10 opacity-70 group-hover/block:opacity-100 group-hover/block:flex", children: _jsxs("div", { className: "absolute top-0 -right-[28px] flex md:flex-col", children: [_jsx(NotebookRunCell, { id: node.key }), _jsx(NotebookClearCell, { id: node.key })] }) })] })), _jsx(MyST, { ast: node.children })] }));
13
+ }), children: [pageKind === SourceFileKind.Notebook && node.kind === 'notebook-code' && (_jsxs(_Fragment, { children: [_jsx("div", { className: "flex sticky top-[115px] z-10 opacity-90 group-hover/block:opacity-100 group-hover/block:hidden", children: _jsx("div", { className: "flex absolute top-0 right-0", children: _jsx(NotebookRunCellSpinnerOnly, { id: `spinner-${node.key}` }) }) }), _jsx("div", { className: "hidden sticky top-[80px] z-10 opacity-70 group-hover/block:opacity-100 group-hover/block:flex", children: _jsxs("div", { className: "absolute top-0 -right-[28px] flex md:flex-col", children: [_jsx(NotebookRunCell, { id: `run-${node.key}` }), _jsx(NotebookClearCell, { id: `clear-${node.key}` })] }) })] })), _jsx(MyST, { ast: node.children })] }));
14
14
  if (node.visibility === 'hide') {
15
15
  return _jsx(Details, { title: "Notebook Cell", children: block });
16
16
  }
@@ -1 +1 @@
1
- {"version":3,"file":"NotebookCellControls.d.ts","sourceRoot":"","sources":["../../src/controls/NotebookCellControls.tsx"],"names":[],"mappings":"AAGA,wBAAgB,eAAe,CAAC,EAAE,EAAE,EAAE,EAAE;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,kDAMrD;AAED,wBAAgB,0BAA0B,CAAC,EAAE,EAAE,EAAE,EAAE;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,kDAYhE;AAED,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,EAAE,EAAE;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,kDAMvD"}
1
+ {"version":3,"file":"NotebookCellControls.d.ts","sourceRoot":"","sources":["../../src/controls/NotebookCellControls.tsx"],"names":[],"mappings":"AAGA,wBAAgB,eAAe,CAAC,EAAE,EAAE,EAAE,EAAE;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,kDAYrD;AAED,wBAAgB,0BAA0B,CAAC,EAAE,EAAE,EAAE,EAAE;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,kDAYhE;AAED,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,EAAE,EAAE;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,kDAMvD"}
@@ -5,7 +5,7 @@ export function NotebookRunCell({ id }) {
5
5
  const { ready, cellIsExecuting, notebookIsBusy, execute } = useCellExecution(id);
6
6
  if (!ready)
7
7
  return null;
8
- return (_jsx(Run, { ready: ready, executing: cellIsExecuting, disabled: notebookIsBusy, onClick: execute }));
8
+ return (_jsx(Run, { ready: ready, executing: cellIsExecuting, disabled: notebookIsBusy, onClick: execute, title: "Run cell" }));
9
9
  }
10
10
  export function NotebookRunCellSpinnerOnly({ id }) {
11
11
  const { ready, cellIsExecuting } = useCellExecution(id);
@@ -1 +1 @@
1
- {"version":3,"file":"NotebookToolbar.d.ts","sourceRoot":"","sources":["../../src/controls/NotebookToolbar.tsx"],"names":[],"mappings":"AAaA,wBAAgB,eAAe,CAAC,EAAE,UAAkB,EAAE,EAAE;IAAE,UAAU,CAAC,EAAE,OAAO,CAAA;CAAE,kDAkG/E"}
1
+ {"version":3,"file":"NotebookToolbar.d.ts","sourceRoot":"","sources":["../../src/controls/NotebookToolbar.tsx"],"names":[],"mappings":"AAaA,wBAAgB,eAAe,CAAC,EAAE,UAAkB,EAAE,EAAE;IAAE,UAAU,CAAC,EAAE,OAAO,CAAA;CAAE,kDAgH/E"}
@@ -31,14 +31,34 @@ export function NotebookToolbar({ showLaunch = false }) {
31
31
  const error = !!serverError; // TODO broader build & session errors
32
32
  let title = 'Connect to a compute server';
33
33
  if (error) {
34
- title = 'Error connecting to compute server';
34
+ title = 'Error connecting to a compute server';
35
35
  }
36
36
  else if (building) {
37
- title = status;
37
+ if (status == 'pending') {
38
+ title = 'Pending...';
39
+ }
40
+ else if (status == 'fetching') {
41
+ title = 'Fetching...';
42
+ }
43
+ else if (status == 'build-notebooks') {
44
+ title = 'Building notebooks...';
45
+ }
46
+ else if (status == 'wait-for-server') {
47
+ title = 'Waiting for server...';
48
+ }
49
+ else if (status == 'start-session') {
50
+ title = 'Starting session...';
51
+ }
52
+ else if (status == 'error') {
53
+ title = 'Error';
54
+ }
55
+ else {
56
+ title = 'Unknown';
57
+ }
38
58
  }
39
59
  if (computable)
40
- return (_jsx("div", { className: "sticky top-[60px] flex justify-end w-full z-20 pointer-events-none", children: _jsxs("div", { className: "flex p-1 m-1 space-x-1 border rounded-full shadow pointer-events-auto border-stone-300 bg-white/80 dark:bg-stone-900/80 backdrop-blur", children: [!ready && (_jsxs("div", { className: "rounded", children: [_jsx("button", { className: classNames('flex text-center rounded-full cursor-pointer text-stone-800 dark:text-white hover:opacity-100 opacity-60', {
60
+ return (_jsx("div", { className: "sticky top-[60px] pb-[14px] flex justify-end w-full z-20 pointer-events-none", children: _jsxs("div", { className: "flex p-1 m-1 space-x-1 border rounded-full shadow pointer-events-auto border-stone-300 bg-white/80 dark:bg-stone-900/80 backdrop-blur", children: [!ready && (_jsxs("div", { className: "rounded", children: [_jsx("button", { className: classNames('flex text-center rounded-full cursor-pointer text-stone-800 dark:text-white hover:opacity-100 opacity-60', {
41
61
  'opacity-10 text-stone-100 dark:text-stone-700': connecting || building,
42
- }), onClick: handleStart, disabled: building, "aria-label": "start compute environment", children: _jsx(PowerIcon, { className: "inline-block w-6 h-6 align-top", title: "enable compute" }) }), (connecting || building) && !error && (_jsx("span", { className: "absolute top-1 left-1 z-10 w-[22px] h-[22px] opacity-100", title: title, children: _jsx(Spinner, { size: 24 }) }))] })), ready && (_jsx(Run, { ready: ready, executing: busy.page(slug, 'execute'), onClick: handleRun, title: "Run all cells" })), ready && (_jsx(Restart, { ready: ready, resetting: busy.page(slug, 'reset'), onClick: handleReset, disabled: busy.page(slug, 'execute'), title: "Reset notebook and restart kernel" })), ready && (_jsx(Clear, { ready: ready, disabled: busy.page(slug, 'execute') || busy.page(slug, 'reset'), onClick: handleClear, title: "Clear all cells" })), showLaunch && ready && (_jsx(Launch, { ready: ready, disabled: false, onClick: handleLaunch, title: "Launch notebook in Jupyter" }))] }) }));
62
+ }), onClick: handleStart, disabled: building, "aria-label": "start compute environment", children: _jsx(PowerIcon, { className: "inline-block w-6 h-6 align-top", title: "Launch kernel" }) }), (connecting || building) && !error && (_jsx("span", { className: "absolute top-1 left-1 z-10 w-[22px] h-[22px] opacity-100", title: title, children: _jsx(Spinner, { size: 24 }) }))] })), ready && (_jsx(Run, { ready: ready, executing: busy.page(slug, 'execute'), onClick: handleRun, title: "Run all cells" })), ready && (_jsx(Restart, { ready: ready, resetting: busy.page(slug, 'reset'), onClick: handleReset, disabled: busy.page(slug, 'execute'), title: "Reset notebook and restart kernel" })), ready && (_jsx(Clear, { ready: ready, disabled: busy.page(slug, 'execute') || busy.page(slug, 'reset'), onClick: handleClear, title: "Clear all cells" })), showLaunch && ready && (_jsx(Launch, { ready: ready, disabled: false, onClick: handleLaunch, title: "Launch notebook in Jupyter" }))] }) }));
43
63
  return null;
44
64
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@myst-theme/jupyter",
3
- "version": "0.15.2",
3
+ "version": "0.17.0",
4
4
  "type": "module",
5
5
  "exports": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -25,17 +25,17 @@
25
25
  "@curvenote/ansi-to-react": "^7.0.0",
26
26
  "@headlessui/react": "^1.7.15",
27
27
  "@heroicons/react": "^2.0.18",
28
- "@myst-theme/providers": "^0.15.2",
29
- "@scienceicons/react": "^0.0.11",
28
+ "@myst-theme/providers": "^0.17.0",
29
+ "@scienceicons/react": "^0.0.13",
30
30
  "buffer": "^6.0.3",
31
31
  "classnames": "^2.5.1",
32
32
  "jupyterlab-plotly": "^5.24.0",
33
- "myst-common": "^1.7.9",
33
+ "myst-common": "^1.8.1",
34
34
  "myst-config": "^1.7.9",
35
35
  "myst-frontmatter": "^1.7.9",
36
36
  "myst-spec": "^0.0.5",
37
- "myst-spec-ext": "^1.7.9",
38
- "myst-to-react": "^0.15.2",
37
+ "myst-spec-ext": "^1.8.1",
38
+ "myst-to-react": "^0.17.0",
39
39
  "nanoid": "^4.0.2",
40
40
  "nbtx": "^0.2.3",
41
41
  "react-syntax-highlighter": "^15.5.0",