@myst-theme/jupyter 0.1.29 → 0.1.31
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/cjs/output.d.ts +2 -0
- package/dist/cjs/output.d.ts.map +1 -1
- package/dist/cjs/output.js +6 -5
- package/dist/esm/output.d.ts +2 -0
- package/dist/esm/output.d.ts.map +1 -1
- package/dist/esm/output.js +4 -3
- package/dist/types/output.d.ts +2 -0
- package/dist/types/output.d.ts.map +1 -1
- package/package.json +5 -4
package/dist/cjs/output.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { GenericNode } from 'myst-common';
|
|
2
2
|
import type { MinifiedOutput } from 'nbtx';
|
|
3
|
+
export declare const DIRECT_OUTPUT_TYPES: Set<string>;
|
|
4
|
+
export declare const DIRECT_MIME_TYPES: Set<string>;
|
|
3
5
|
export declare function allOutputsAreSafe(outputs: MinifiedOutput[], directOutputTypes: Set<string>, directMimeTypes: Set<string>): boolean;
|
|
4
6
|
export declare function Output(node: GenericNode): JSX.Element;
|
|
5
7
|
//# sourceMappingURL=output.d.ts.map
|
package/dist/cjs/output.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../../src/output.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,KAAK,EAAsB,cAAc,EAAE,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../../src/output.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,KAAK,EAAsB,cAAc,EAAE,MAAM,MAAM,CAAC;AAO/D,eAAO,MAAM,mBAAmB,aAA+B,CAAC;AAEhE,eAAO,MAAM,iBAAiB,aAMb,CAAC;AAElB,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,cAAc,EAAE,EACzB,iBAAiB,EAAE,GAAG,CAAC,MAAM,CAAC,EAC9B,eAAe,EAAE,GAAG,CAAC,MAAM,CAAC,WAY7B;AAED,wBAAgB,MAAM,CAAC,IAAI,EAAE,WAAW,eAiCvC"}
|
package/dist/cjs/output.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.Output = exports.allOutputsAreSafe = void 0;
|
|
6
|
+
exports.Output = exports.allOutputsAreSafe = exports.DIRECT_MIME_TYPES = exports.DIRECT_OUTPUT_TYPES = void 0;
|
|
7
7
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
8
|
const nbtx_1 = require("nbtx");
|
|
9
9
|
const classnames_1 = __importDefault(require("classnames"));
|
|
@@ -11,8 +11,8 @@ const safe_1 = require("./safe");
|
|
|
11
11
|
const jupyter_1 = require("./jupyter");
|
|
12
12
|
const ClientOnly_1 = __importDefault(require("./ClientOnly"));
|
|
13
13
|
const thebe_provider_1 = require("./thebe-provider");
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
exports.DIRECT_OUTPUT_TYPES = new Set(['stream', 'error']);
|
|
15
|
+
exports.DIRECT_MIME_TYPES = new Set([
|
|
16
16
|
nbtx_1.KnownCellOutputMimeTypes.TextPlain,
|
|
17
17
|
nbtx_1.KnownCellOutputMimeTypes.ImagePng,
|
|
18
18
|
nbtx_1.KnownCellOutputMimeTypes.ImageGif,
|
|
@@ -22,7 +22,7 @@ const DIRECT_MIME_TYPES = new Set([
|
|
|
22
22
|
function allOutputsAreSafe(outputs, directOutputTypes, directMimeTypes) {
|
|
23
23
|
return outputs.reduce((flag, output) => {
|
|
24
24
|
if (directOutputTypes.has(output.output_type))
|
|
25
|
-
return true;
|
|
25
|
+
return flag && true;
|
|
26
26
|
const data = output.data;
|
|
27
27
|
const mimetypes = data ? Object.keys(data) : [];
|
|
28
28
|
const safe = 'data' in output &&
|
|
@@ -34,7 +34,7 @@ function allOutputsAreSafe(outputs, directOutputTypes, directMimeTypes) {
|
|
|
34
34
|
exports.allOutputsAreSafe = allOutputsAreSafe;
|
|
35
35
|
function Output(node) {
|
|
36
36
|
const outputs = node.data;
|
|
37
|
-
const allSafe = allOutputsAreSafe(outputs, DIRECT_OUTPUT_TYPES, DIRECT_MIME_TYPES);
|
|
37
|
+
const allSafe = allOutputsAreSafe(outputs, exports.DIRECT_OUTPUT_TYPES, exports.DIRECT_MIME_TYPES);
|
|
38
38
|
let component;
|
|
39
39
|
if (allSafe) {
|
|
40
40
|
component = (0, jsx_runtime_1.jsx)(safe_1.SafeOutputs, { keyStub: node.key, outputs: outputs });
|
|
@@ -43,6 +43,7 @@ function Output(node) {
|
|
|
43
43
|
// Hide the iframe if rendering on the server
|
|
44
44
|
component = ((0, jsx_runtime_1.jsx)(ClientOnly_1.default, { children: (0, jsx_runtime_1.jsx)(thebe_provider_1.ThebeCoreProvider, { children: (0, jsx_runtime_1.jsx)(jupyter_1.NativeJupyterOutputs, { id: node.key, outputs: outputs }) }) }));
|
|
45
45
|
}
|
|
46
|
+
console.log('Output', allSafe, outputs);
|
|
46
47
|
return ((0, jsx_runtime_1.jsx)("figure", Object.assign({ id: node.identifier || undefined, className: (0, classnames_1.default)('max-w-full overflow-auto m-0 group not-prose relative', {
|
|
47
48
|
'text-left': !node.align || node.align === 'left',
|
|
48
49
|
'text-center': node.align === 'center',
|
package/dist/esm/output.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { GenericNode } from 'myst-common';
|
|
2
2
|
import type { MinifiedOutput } from 'nbtx';
|
|
3
|
+
export declare const DIRECT_OUTPUT_TYPES: Set<string>;
|
|
4
|
+
export declare const DIRECT_MIME_TYPES: Set<string>;
|
|
3
5
|
export declare function allOutputsAreSafe(outputs: MinifiedOutput[], directOutputTypes: Set<string>, directMimeTypes: Set<string>): boolean;
|
|
4
6
|
export declare function Output(node: GenericNode): JSX.Element;
|
|
5
7
|
//# sourceMappingURL=output.d.ts.map
|
package/dist/esm/output.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../../src/output.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,KAAK,EAAsB,cAAc,EAAE,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../../src/output.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,KAAK,EAAsB,cAAc,EAAE,MAAM,MAAM,CAAC;AAO/D,eAAO,MAAM,mBAAmB,aAA+B,CAAC;AAEhE,eAAO,MAAM,iBAAiB,aAMb,CAAC;AAElB,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,cAAc,EAAE,EACzB,iBAAiB,EAAE,GAAG,CAAC,MAAM,CAAC,EAC9B,eAAe,EAAE,GAAG,CAAC,MAAM,CAAC,WAY7B;AAED,wBAAgB,MAAM,CAAC,IAAI,EAAE,WAAW,eAiCvC"}
|
package/dist/esm/output.js
CHANGED
|
@@ -5,8 +5,8 @@ import { SafeOutputs } from './safe';
|
|
|
5
5
|
import { NativeJupyterOutputs as JupyterOutputs } from './jupyter';
|
|
6
6
|
import ClientOnly from './ClientOnly';
|
|
7
7
|
import { ThebeCoreProvider } from './thebe-provider';
|
|
8
|
-
const DIRECT_OUTPUT_TYPES = new Set(['stream', 'error']);
|
|
9
|
-
const DIRECT_MIME_TYPES = new Set([
|
|
8
|
+
export const DIRECT_OUTPUT_TYPES = new Set(['stream', 'error']);
|
|
9
|
+
export const DIRECT_MIME_TYPES = new Set([
|
|
10
10
|
KnownCellOutputMimeTypes.TextPlain,
|
|
11
11
|
KnownCellOutputMimeTypes.ImagePng,
|
|
12
12
|
KnownCellOutputMimeTypes.ImageGif,
|
|
@@ -16,7 +16,7 @@ const DIRECT_MIME_TYPES = new Set([
|
|
|
16
16
|
export function allOutputsAreSafe(outputs, directOutputTypes, directMimeTypes) {
|
|
17
17
|
return outputs.reduce((flag, output) => {
|
|
18
18
|
if (directOutputTypes.has(output.output_type))
|
|
19
|
-
return true;
|
|
19
|
+
return flag && true;
|
|
20
20
|
const data = output.data;
|
|
21
21
|
const mimetypes = data ? Object.keys(data) : [];
|
|
22
22
|
const safe = 'data' in output &&
|
|
@@ -36,6 +36,7 @@ export function Output(node) {
|
|
|
36
36
|
// Hide the iframe if rendering on the server
|
|
37
37
|
component = (_jsx(ClientOnly, { children: _jsx(ThebeCoreProvider, { children: _jsx(JupyterOutputs, { id: node.key, outputs: outputs }) }) }));
|
|
38
38
|
}
|
|
39
|
+
console.log('Output', allSafe, outputs);
|
|
39
40
|
return (_jsx("figure", Object.assign({ id: node.identifier || undefined, className: classNames('max-w-full overflow-auto m-0 group not-prose relative', {
|
|
40
41
|
'text-left': !node.align || node.align === 'left',
|
|
41
42
|
'text-center': node.align === 'center',
|
package/dist/types/output.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { GenericNode } from 'myst-common';
|
|
2
2
|
import type { MinifiedOutput } from 'nbtx';
|
|
3
|
+
export declare const DIRECT_OUTPUT_TYPES: Set<string>;
|
|
4
|
+
export declare const DIRECT_MIME_TYPES: Set<string>;
|
|
3
5
|
export declare function allOutputsAreSafe(outputs: MinifiedOutput[], directOutputTypes: Set<string>, directMimeTypes: Set<string>): boolean;
|
|
4
6
|
export declare function Output(node: GenericNode): JSX.Element;
|
|
5
7
|
//# sourceMappingURL=output.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../../src/output.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,KAAK,EAAsB,cAAc,EAAE,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../../src/output.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,KAAK,EAAsB,cAAc,EAAE,MAAM,MAAM,CAAC;AAO/D,eAAO,MAAM,mBAAmB,aAA+B,CAAC;AAEhE,eAAO,MAAM,iBAAiB,aAMb,CAAC;AAElB,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,cAAc,EAAE,EACzB,iBAAiB,EAAE,GAAG,CAAC,MAAM,CAAC,EAC9B,eAAe,EAAE,GAAG,CAAC,MAAM,CAAC,WAY7B;AAED,wBAAgB,MAAM,CAAC,IAAI,EAAE,WAAW,eAiCvC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@myst-theme/jupyter",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.31",
|
|
4
4
|
"main": "dist/cjs/index.js",
|
|
5
5
|
"module": "dist/esm/index.js",
|
|
6
6
|
"types": "dist/types/index.d.ts",
|
|
@@ -16,12 +16,13 @@
|
|
|
16
16
|
"build:cjs": "tsc --module commonjs --outDir dist/cjs",
|
|
17
17
|
"build:esm": "tsc --module es2020 --outDir dist/esm",
|
|
18
18
|
"build:types": "tsc --declaration --emitDeclarationOnly --declarationMap --outDir dist/types",
|
|
19
|
-
"build": "npm-run-all -l clean -p build:cjs build:esm build:types"
|
|
19
|
+
"build": "npm-run-all -l clean -p build:cjs build:esm build:types",
|
|
20
|
+
"test": "jest"
|
|
20
21
|
},
|
|
21
22
|
"dependencies": {
|
|
22
|
-
"@headlessui/react": "^1.7.
|
|
23
|
+
"@headlessui/react": "^1.7.13",
|
|
23
24
|
"@heroicons/react": "^2.0.13",
|
|
24
|
-
"@myst-theme/providers": "^0.1.
|
|
25
|
+
"@myst-theme/providers": "^0.1.31",
|
|
25
26
|
"@popperjs/core": "^2.11.6",
|
|
26
27
|
"ansi-to-react": "^6.1.6",
|
|
27
28
|
"buffer": "^6.0.3",
|