@myst-theme/jupyter 0.0.1 → 0.0.3
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/ClientOnly.d.ts +5 -0
- package/dist/cjs/ClientOnly.d.ts.map +1 -0
- package/dist/cjs/ClientOnly.js +12 -0
- package/dist/cjs/convertImages.d.ts +3 -0
- package/dist/cjs/convertImages.d.ts.map +1 -0
- package/dist/cjs/convertImages.js +70 -0
- package/dist/cjs/error.d.ts +1 -1
- package/dist/cjs/error.d.ts.map +1 -1
- package/dist/cjs/error.js +2 -2
- package/dist/cjs/hooks.d.ts +3 -34
- package/dist/cjs/hooks.d.ts.map +1 -1
- package/dist/cjs/hooks.js +52 -15
- package/dist/cjs/jupyter.d.ts +1 -1
- package/dist/cjs/jupyter.d.ts.map +1 -1
- package/dist/cjs/jupyter.js +7 -4
- package/dist/cjs/output.d.ts +2 -3
- package/dist/cjs/output.d.ts.map +1 -1
- package/dist/cjs/output.js +11 -26
- package/dist/cjs/safe.d.ts +1 -1
- package/dist/cjs/safe.d.ts.map +1 -1
- package/dist/cjs/safe.js +5 -5
- package/dist/cjs/selectors.d.ts +2 -2
- package/dist/cjs/selectors.d.ts.map +1 -1
- package/dist/cjs/stream.d.ts +1 -1
- package/dist/cjs/stream.d.ts.map +1 -1
- package/dist/cjs/stream.js +2 -2
- package/dist/esm/ClientOnly.d.ts +5 -0
- package/dist/esm/ClientOnly.d.ts.map +1 -0
- package/dist/esm/ClientOnly.js +9 -0
- package/dist/esm/convertImages.d.ts +3 -0
- package/dist/esm/convertImages.d.ts.map +1 -0
- package/dist/esm/convertImages.js +66 -0
- package/dist/esm/error.d.ts +1 -1
- package/dist/esm/error.d.ts.map +1 -1
- package/dist/esm/error.js +1 -1
- package/dist/esm/hooks.d.ts +3 -34
- package/dist/esm/hooks.d.ts.map +1 -1
- package/dist/esm/hooks.js +52 -15
- package/dist/esm/jupyter.d.ts +1 -1
- package/dist/esm/jupyter.d.ts.map +1 -1
- package/dist/esm/jupyter.js +7 -4
- package/dist/esm/output.d.ts +2 -3
- package/dist/esm/output.d.ts.map +1 -1
- package/dist/esm/output.js +5 -19
- package/dist/esm/safe.d.ts +1 -1
- package/dist/esm/safe.d.ts.map +1 -1
- package/dist/esm/safe.js +1 -1
- package/dist/esm/selectors.d.ts +2 -2
- package/dist/esm/selectors.d.ts.map +1 -1
- package/dist/esm/stream.d.ts +1 -1
- package/dist/esm/stream.d.ts.map +1 -1
- package/dist/esm/stream.js +1 -1
- package/dist/types/ClientOnly.d.ts +5 -0
- package/dist/types/ClientOnly.d.ts.map +1 -0
- package/dist/types/convertImages.d.ts +3 -0
- package/dist/types/convertImages.d.ts.map +1 -0
- package/dist/types/error.d.ts +1 -1
- package/dist/types/error.d.ts.map +1 -1
- package/dist/types/hooks.d.ts +3 -34
- package/dist/types/hooks.d.ts.map +1 -1
- package/dist/types/jupyter.d.ts +1 -1
- package/dist/types/jupyter.d.ts.map +1 -1
- package/dist/types/output.d.ts +2 -3
- package/dist/types/output.d.ts.map +1 -1
- package/dist/types/safe.d.ts +1 -1
- package/dist/types/safe.d.ts.map +1 -1
- package/dist/types/selectors.d.ts +2 -2
- package/dist/types/selectors.d.ts.map +1 -1
- package/dist/types/stream.d.ts +1 -1
- package/dist/types/stream.d.ts.map +1 -1
- package/package.json +9 -11
- package/dist/cjs/outputBlock.d.ts +0 -10
- package/dist/cjs/outputBlock.d.ts.map +0 -1
- package/dist/cjs/outputBlock.js +0 -13
- package/dist/esm/outputBlock.d.ts +0 -10
- package/dist/esm/outputBlock.d.ts.map +0 -1
- package/dist/esm/outputBlock.js +0 -6
- package/dist/types/outputBlock.d.ts +0 -10
- package/dist/types/outputBlock.d.ts.map +0 -1
package/dist/esm/hooks.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { MinifiedOutput } from '
|
|
1
|
+
import type { MinifiedOutput } from 'nbtx';
|
|
2
2
|
/**
|
|
3
3
|
* Truncation vs Summarization
|
|
4
4
|
*
|
|
@@ -25,39 +25,8 @@ export declare function useLongContent(content?: string, url?: string): {
|
|
|
25
25
|
error?: Error;
|
|
26
26
|
};
|
|
27
27
|
export declare function useFetchAnyTruncatedContent(outputs: MinifiedOutput[]): {
|
|
28
|
-
data:
|
|
29
|
-
|
|
30
|
-
path?: string | undefined;
|
|
31
|
-
traceback: string & string[];
|
|
32
|
-
output_type: "error";
|
|
33
|
-
ename: string;
|
|
34
|
-
evalue: string;
|
|
35
|
-
} | {
|
|
36
|
-
data: {};
|
|
37
|
-
path?: string | undefined;
|
|
38
|
-
output_type: "stream";
|
|
39
|
-
name: import("@jupyterlab/nbformat").StreamType;
|
|
40
|
-
text: import("@jupyterlab/nbformat").MultilineString;
|
|
41
|
-
} | {
|
|
42
|
-
data: {};
|
|
43
|
-
output_type: import("@curvenote/nbtx/dist/minify/types").MimeOutputType;
|
|
44
|
-
execution_count?: import("@jupyterlab/nbformat").ExecutionCount | undefined;
|
|
45
|
-
metadata: import("@lumino/coreutils").PartialJSONObject;
|
|
46
|
-
} | {
|
|
47
|
-
[x: string]: import("@lumino/coreutils").PartialJSONValue | undefined;
|
|
48
|
-
path?: string | undefined;
|
|
49
|
-
traceback: string & string[];
|
|
50
|
-
output_type: "error";
|
|
51
|
-
ename: string;
|
|
52
|
-
evalue: string;
|
|
53
|
-
} | {
|
|
54
|
-
[x: string]: import("@lumino/coreutils").PartialJSONValue | undefined;
|
|
55
|
-
path?: string | undefined;
|
|
56
|
-
output_type: "stream";
|
|
57
|
-
name: import("@jupyterlab/nbformat").StreamType;
|
|
58
|
-
text: import("@jupyterlab/nbformat").MultilineString;
|
|
59
|
-
})[] | undefined;
|
|
60
|
-
error: any;
|
|
28
|
+
data: MinifiedOutput[] | undefined;
|
|
29
|
+
error: any | undefined;
|
|
61
30
|
};
|
|
62
31
|
export default function useWindowSize(): {
|
|
63
32
|
width: number;
|
package/dist/esm/hooks.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../src/hooks.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAIV,cAAc,EAEf,MAAM,
|
|
1
|
+
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../src/hooks.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAIV,cAAc,EAEf,MAAM,MAAM,CAAC;AAId;;;;;;;;;;;;;;;;GAgBG;AAEH,UAAU,WAAW;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;CACjB;AA0BD,wBAAgB,cAAc,CAC5B,OAAO,CAAC,EAAE,MAAM,EAChB,GAAG,CAAC,EAAE,MAAM,GACX;IAAE,IAAI,CAAC,EAAE,WAAW,CAAC;IAAC,KAAK,CAAC,EAAE,KAAK,CAAA;CAAE,CAQvC;AAuBD,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,cAAc,EAAE,GAAG;IACtE,IAAI,EAAE,cAAc,EAAE,GAAG,SAAS,CAAC;IACnC,KAAK,EAAE,GAAG,GAAG,SAAS,CAAC;CACxB,CAqCA;AAUD,MAAM,CAAC,OAAO,UAAU,aAAa;;;EAapC"}
|
package/dist/esm/hooks.js
CHANGED
|
@@ -1,11 +1,41 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
1
10
|
import useSWRImmutable from 'swr/immutable';
|
|
2
|
-
import {
|
|
11
|
+
import { walkOutputs } from 'nbtx';
|
|
3
12
|
import { useState, useLayoutEffect } from 'react';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
13
|
+
function fetcher(url) {
|
|
14
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
15
|
+
const resp = yield fetch(url);
|
|
16
|
+
if (resp.status === 200) {
|
|
17
|
+
const content = yield resp.text();
|
|
18
|
+
if (url.endsWith('.json')) {
|
|
19
|
+
// This is for backward compatibility, previously we saved as:
|
|
20
|
+
// { content: string, content_type: string }
|
|
21
|
+
// This is now directly saved as the content (e.g. an image, json, html, text, etc.)
|
|
22
|
+
try {
|
|
23
|
+
const data = JSON.parse(content);
|
|
24
|
+
const keys = Object.keys(data);
|
|
25
|
+
if (keys.length === 2 && keys.includes('content') && keys.includes('content_type')) {
|
|
26
|
+
return data;
|
|
27
|
+
}
|
|
28
|
+
// pass
|
|
29
|
+
}
|
|
30
|
+
catch (error) {
|
|
31
|
+
// pass
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return { content };
|
|
35
|
+
}
|
|
36
|
+
throw new Error(`Content returned with status ${resp.status}.`);
|
|
37
|
+
});
|
|
38
|
+
}
|
|
9
39
|
export function useLongContent(content, url) {
|
|
10
40
|
if (typeof document === 'undefined') {
|
|
11
41
|
// This is ONLY called on the server
|
|
@@ -33,22 +63,29 @@ function shallowCloneOutputs(outputs) {
|
|
|
33
63
|
export function useFetchAnyTruncatedContent(outputs) {
|
|
34
64
|
const itemsWithPaths = [];
|
|
35
65
|
const updated = shallowCloneOutputs(outputs);
|
|
36
|
-
|
|
66
|
+
walkOutputs(updated, (obj) => {
|
|
37
67
|
// images have paths, but we don't need to fetch them
|
|
38
68
|
if ('content_type' in obj && obj.content_type.startsWith('image/'))
|
|
39
69
|
return;
|
|
40
|
-
obj.path
|
|
41
|
-
|
|
70
|
+
if (obj.path) {
|
|
71
|
+
itemsWithPaths.push(obj);
|
|
72
|
+
}
|
|
42
73
|
});
|
|
43
74
|
const { data, error } = useSWRImmutable(itemsWithPaths.map(({ path }) => path), arrayFetcher);
|
|
44
75
|
data === null || data === void 0 ? void 0 : data.forEach(({ content }, idx) => {
|
|
45
76
|
const obj = itemsWithPaths[idx];
|
|
46
|
-
if ('text' in obj)
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
if ('
|
|
51
|
-
|
|
77
|
+
if ('text' in obj) {
|
|
78
|
+
// stream
|
|
79
|
+
obj.text = content;
|
|
80
|
+
}
|
|
81
|
+
else if ('traceback' in obj) {
|
|
82
|
+
// error
|
|
83
|
+
obj.traceback = content;
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
// mimeoutput
|
|
87
|
+
obj.content = content;
|
|
88
|
+
}
|
|
52
89
|
obj.path = undefined;
|
|
53
90
|
});
|
|
54
91
|
return {
|
package/dist/esm/jupyter.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jupyter.d.ts","sourceRoot":"","sources":["../../src/jupyter.tsx"],"names":[],"mappings":";AAKA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"jupyter.d.ts","sourceRoot":"","sources":["../../src/jupyter.tsx"],"names":[],"mappings":";AAKA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,MAAM,CAAC;AAS3C,eAAO,MAAM,oBAAoB;QAI3B,MAAM;aACD,cAAc,EAAE;iBAoE1B,CAAC"}
|
package/dist/esm/jupyter.js
CHANGED
|
@@ -4,25 +4,28 @@ import useWindowSize, { useFetchAnyTruncatedContent } from './hooks';
|
|
|
4
4
|
import { nanoid } from 'nanoid';
|
|
5
5
|
import { useSelector } from 'react-redux';
|
|
6
6
|
import { host, actions } from '@curvenote/connect';
|
|
7
|
-
import { convertToIOutputs
|
|
7
|
+
import { convertToIOutputs } from 'nbtx';
|
|
8
8
|
import { ChevronDoubleDownIcon } from '@heroicons/react/24/outline';
|
|
9
|
+
import { fetchAndEncodeOutputImages } from './convertImages';
|
|
9
10
|
import { selectIFrameHeight, selectIFrameReady } from './selectors';
|
|
10
11
|
const PERCENT_OF_WINDOW = 0.9;
|
|
11
12
|
export const NativeJupyterOutputs = ({ id, outputs, }) => {
|
|
13
|
+
var _a;
|
|
12
14
|
const windowSize = useWindowSize();
|
|
13
15
|
const { data, error } = useFetchAnyTruncatedContent(outputs);
|
|
14
16
|
const [loading, setLoading] = useState(true);
|
|
15
17
|
const [frameHeight, setFrameHeight] = useState(0);
|
|
16
18
|
const [clamped, setClamped] = useState(false);
|
|
17
19
|
const uid = useMemo(nanoid, []);
|
|
18
|
-
const height = useSelector((state) => selectIFrameHeight(state, uid));
|
|
20
|
+
const { height } = (_a = useSelector((state) => selectIFrameHeight(state, uid))) !== null && _a !== void 0 ? _a : {};
|
|
19
21
|
const rendererReady = useSelector((state) => selectIFrameReady(state, uid));
|
|
20
22
|
const iframeRef = useRef(null);
|
|
21
23
|
useEffect(() => {
|
|
22
24
|
if (iframeRef.current == null || !rendererReady || !data)
|
|
23
25
|
return;
|
|
24
|
-
fetchAndEncodeOutputImages(
|
|
25
|
-
|
|
26
|
+
fetchAndEncodeOutputImages(data).then((out) => {
|
|
27
|
+
const compactOutputs = convertToIOutputs(out, {});
|
|
28
|
+
host.commsDispatch(iframeRef.current, actions.connectHostSendContent(uid, compactOutputs));
|
|
26
29
|
});
|
|
27
30
|
}, [id, iframeRef.current, rendererReady]);
|
|
28
31
|
useEffect(() => {
|
package/dist/esm/output.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import type { GenericNode } from '
|
|
3
|
-
import type { MinifiedOutput } from '
|
|
2
|
+
import type { GenericNode } from 'myst-common';
|
|
3
|
+
import type { MinifiedOutput } from 'nbtx';
|
|
4
4
|
export declare function allOutputsAreSafe(outputs: MinifiedOutput[], directOutputTypes: Set<string>, directMimeTypes: Set<string>): boolean;
|
|
5
|
-
export declare function anyErrors(outputs: MinifiedOutput[]): boolean;
|
|
6
5
|
export declare function Output(node: GenericNode): JSX.Element;
|
|
7
6
|
//# 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,
|
|
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;AAgB/D,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,eA6BvC"}
|
package/dist/esm/output.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { KnownCellOutputMimeTypes } from '
|
|
2
|
+
import { KnownCellOutputMimeTypes } from 'nbtx';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
import { SafeOutputs } from './safe';
|
|
5
5
|
import { NativeJupyterOutputs as JupyterOutputs } from './jupyter';
|
|
6
|
-
import
|
|
6
|
+
import ClientOnly from './ClientOnly';
|
|
7
7
|
const DIRECT_OUTPUT_TYPES = new Set(['stream', 'error']);
|
|
8
8
|
const DIRECT_MIME_TYPES = new Set([
|
|
9
9
|
KnownCellOutputMimeTypes.TextPlain,
|
|
@@ -24,34 +24,20 @@ export function allOutputsAreSafe(outputs, directOutputTypes, directMimeTypes) {
|
|
|
24
24
|
return flag && safe;
|
|
25
25
|
}, true);
|
|
26
26
|
}
|
|
27
|
-
function listMimetypes(outputs, directOutputTypes) {
|
|
28
|
-
return outputs.map((output) => {
|
|
29
|
-
if (directOutputTypes.has(output.output_type))
|
|
30
|
-
return [output.output_type];
|
|
31
|
-
const data = output.data;
|
|
32
|
-
const mimetypes = data ? Object.keys(data) : [];
|
|
33
|
-
return [output.output_type, mimetypes];
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
export function anyErrors(outputs) {
|
|
37
|
-
return outputs.reduce((flag, output) => flag || output.output_type === 'error', false);
|
|
38
|
-
}
|
|
39
27
|
export function Output(node) {
|
|
40
28
|
const outputs = node.data;
|
|
41
29
|
const allSafe = allOutputsAreSafe(outputs, DIRECT_OUTPUT_TYPES, DIRECT_MIME_TYPES);
|
|
42
|
-
const hasError = anyErrors(outputs);
|
|
43
30
|
let component;
|
|
44
31
|
if (allSafe) {
|
|
45
32
|
component = _jsx(SafeOutputs, { keyStub: node.key, outputs: outputs });
|
|
46
33
|
}
|
|
47
34
|
else {
|
|
48
35
|
// Hide the iframe if rendering on the server
|
|
49
|
-
component =
|
|
50
|
-
typeof document === 'undefined' ? null : _jsx(JupyterOutputs, { id: node.key, outputs: outputs });
|
|
36
|
+
component = (_jsx(ClientOnly, { children: _jsx(JupyterOutputs, { id: node.key, outputs: outputs }) }));
|
|
51
37
|
}
|
|
52
|
-
return (_jsx("figure", Object.assign({
|
|
38
|
+
return (_jsx("figure", Object.assign({ id: node.identifier || undefined, className: classNames('max-w-full overflow-auto m-0 group not-prose relative', {
|
|
53
39
|
'text-left': !node.align || node.align === 'left',
|
|
54
40
|
'text-center': node.align === 'center',
|
|
55
41
|
'text-right': node.align === 'right',
|
|
56
|
-
}) }, { children:
|
|
42
|
+
}) }, { children: component }), node.key));
|
|
57
43
|
}
|
package/dist/esm/safe.d.ts
CHANGED
package/dist/esm/safe.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"safe.d.ts","sourceRoot":"","sources":["../../src/safe.tsx"],"names":[],"mappings":";AACA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"safe.d.ts","sourceRoot":"","sources":["../../src/safe.tsx"],"names":[],"mappings":";AACA,OAAO,KAAK,EAA2C,cAAc,EAAE,MAAM,MAAM,CAAC;AAwEpF,wBAAgB,WAAW,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,cAAc,EAAE,CAAA;CAAE,eAM/F"}
|
package/dist/esm/safe.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { KnownCellOutputMimeTypes } from '
|
|
2
|
+
import { KnownCellOutputMimeTypes } from 'nbtx';
|
|
3
3
|
import Stream from './stream';
|
|
4
4
|
import Error from './error';
|
|
5
5
|
import Ansi from 'ansi-to-react';
|
package/dist/esm/selectors.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ import type { HostState } from '@curvenote/connect';
|
|
|
2
2
|
export interface State {
|
|
3
3
|
app: HostState;
|
|
4
4
|
}
|
|
5
|
-
export declare const selectIFrameHeight: (state: State, id: string) =>
|
|
6
|
-
export declare const selectIFrameReady: (state: State, id: string) =>
|
|
5
|
+
export declare const selectIFrameHeight: (state: State, id: string) => Pick<import("@curvenote/connect").HostStateItem, "height" | "width"> | undefined;
|
|
6
|
+
export declare const selectIFrameReady: (state: State, id: string) => Boolean;
|
|
7
7
|
export declare const selectIFrameSendFailed: (state: State, id: string) => false | {
|
|
8
8
|
message: string | undefined;
|
|
9
9
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"selectors.d.ts","sourceRoot":"","sources":["../../src/selectors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAGpD,MAAM,WAAW,KAAK;IACpB,GAAG,EAAE,SAAS,CAAC;CAChB;AAED,eAAO,MAAM,kBAAkB,UAAW,KAAK,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"selectors.d.ts","sourceRoot":"","sources":["../../src/selectors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAGpD,MAAM,WAAW,KAAK;IACpB,GAAG,EAAE,SAAS,CAAC;CAChB;AAED,eAAO,MAAM,kBAAkB,UAAW,KAAK,MAAM,MAAM,qFACX,CAAC;AAEjD,eAAO,MAAM,iBAAiB,UAAW,KAAK,MAAM,MAAM,YACT,CAAC;AAElD,eAAO,MAAM,sBAAsB,UAAW,KAAK,MAAM,MAAM;;CACb,CAAC"}
|
package/dist/esm/stream.d.ts
CHANGED
package/dist/esm/stream.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["../../src/stream.tsx"],"names":[],"mappings":";AAEA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["../../src/stream.tsx"],"names":[],"mappings":";AAEA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,MAAM,CAAC;AAGjD,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,EAAE,MAAM,EAAE,EAAE;IAAE,MAAM,EAAE,oBAAoB,CAAA;CAAE,eAY1E"}
|
package/dist/esm/stream.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import Ansi from 'ansi-to-react';
|
|
3
|
-
import { ensureString } from '
|
|
3
|
+
import { ensureString } from 'nbtx';
|
|
4
4
|
import { MaybeLongContent } from './components';
|
|
5
5
|
export default function Stream({ output }) {
|
|
6
6
|
return (_jsx(MaybeLongContent, { content: ensureString(output.text), path: output.path, render: (content) => (_jsx("pre", Object.assign({ className: "text-sm font-thin font-system" }, { children: _jsx(Ansi, { children: content !== null && content !== void 0 ? content : '' }) }))) }));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ClientOnly.d.ts","sourceRoot":"","sources":["../../src/ClientOnly.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,sBAMvE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"convertImages.d.ts","sourceRoot":"","sources":["../../src/convertImages.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAsB,cAAc,EAAE,MAAM,MAAM,CAAC;AA6B/D,wBAAsB,0BAA0B,CAC9C,OAAO,EAAE,cAAc,EAAE,GACxB,OAAO,CAAC,cAAc,EAAE,CAAC,CAmC3B"}
|
package/dist/types/error.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../src/error.tsx"],"names":[],"mappings":";AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../src/error.tsx"],"names":[],"mappings":";AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,MAAM,CAAC;AAGhD,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,EAAE,MAAM,EAAE,EAAE;IAAE,MAAM,EAAE,mBAAmB,CAAA;CAAE,eAcxE"}
|
package/dist/types/hooks.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { MinifiedOutput } from '
|
|
1
|
+
import type { MinifiedOutput } from 'nbtx';
|
|
2
2
|
/**
|
|
3
3
|
* Truncation vs Summarization
|
|
4
4
|
*
|
|
@@ -25,39 +25,8 @@ export declare function useLongContent(content?: string, url?: string): {
|
|
|
25
25
|
error?: Error;
|
|
26
26
|
};
|
|
27
27
|
export declare function useFetchAnyTruncatedContent(outputs: MinifiedOutput[]): {
|
|
28
|
-
data:
|
|
29
|
-
|
|
30
|
-
path?: string | undefined;
|
|
31
|
-
traceback: string & string[];
|
|
32
|
-
output_type: "error";
|
|
33
|
-
ename: string;
|
|
34
|
-
evalue: string;
|
|
35
|
-
} | {
|
|
36
|
-
data: {};
|
|
37
|
-
path?: string | undefined;
|
|
38
|
-
output_type: "stream";
|
|
39
|
-
name: import("@jupyterlab/nbformat").StreamType;
|
|
40
|
-
text: import("@jupyterlab/nbformat").MultilineString;
|
|
41
|
-
} | {
|
|
42
|
-
data: {};
|
|
43
|
-
output_type: import("@curvenote/nbtx/dist/minify/types").MimeOutputType;
|
|
44
|
-
execution_count?: import("@jupyterlab/nbformat").ExecutionCount | undefined;
|
|
45
|
-
metadata: import("@lumino/coreutils").PartialJSONObject;
|
|
46
|
-
} | {
|
|
47
|
-
[x: string]: import("@lumino/coreutils").PartialJSONValue | undefined;
|
|
48
|
-
path?: string | undefined;
|
|
49
|
-
traceback: string & string[];
|
|
50
|
-
output_type: "error";
|
|
51
|
-
ename: string;
|
|
52
|
-
evalue: string;
|
|
53
|
-
} | {
|
|
54
|
-
[x: string]: import("@lumino/coreutils").PartialJSONValue | undefined;
|
|
55
|
-
path?: string | undefined;
|
|
56
|
-
output_type: "stream";
|
|
57
|
-
name: import("@jupyterlab/nbformat").StreamType;
|
|
58
|
-
text: import("@jupyterlab/nbformat").MultilineString;
|
|
59
|
-
})[] | undefined;
|
|
60
|
-
error: any;
|
|
28
|
+
data: MinifiedOutput[] | undefined;
|
|
29
|
+
error: any | undefined;
|
|
61
30
|
};
|
|
62
31
|
export default function useWindowSize(): {
|
|
63
32
|
width: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../src/hooks.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAIV,cAAc,EAEf,MAAM,
|
|
1
|
+
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../src/hooks.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAIV,cAAc,EAEf,MAAM,MAAM,CAAC;AAId;;;;;;;;;;;;;;;;GAgBG;AAEH,UAAU,WAAW;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;CACjB;AA0BD,wBAAgB,cAAc,CAC5B,OAAO,CAAC,EAAE,MAAM,EAChB,GAAG,CAAC,EAAE,MAAM,GACX;IAAE,IAAI,CAAC,EAAE,WAAW,CAAC;IAAC,KAAK,CAAC,EAAE,KAAK,CAAA;CAAE,CAQvC;AAuBD,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,cAAc,EAAE,GAAG;IACtE,IAAI,EAAE,cAAc,EAAE,GAAG,SAAS,CAAC;IACnC,KAAK,EAAE,GAAG,GAAG,SAAS,CAAC;CACxB,CAqCA;AAUD,MAAM,CAAC,OAAO,UAAU,aAAa;;;EAapC"}
|
package/dist/types/jupyter.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jupyter.d.ts","sourceRoot":"","sources":["../../src/jupyter.tsx"],"names":[],"mappings":";AAKA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"jupyter.d.ts","sourceRoot":"","sources":["../../src/jupyter.tsx"],"names":[],"mappings":";AAKA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,MAAM,CAAC;AAS3C,eAAO,MAAM,oBAAoB;QAI3B,MAAM;aACD,cAAc,EAAE;iBAoE1B,CAAC"}
|
package/dist/types/output.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import type { GenericNode } from '
|
|
3
|
-
import type { MinifiedOutput } from '
|
|
2
|
+
import type { GenericNode } from 'myst-common';
|
|
3
|
+
import type { MinifiedOutput } from 'nbtx';
|
|
4
4
|
export declare function allOutputsAreSafe(outputs: MinifiedOutput[], directOutputTypes: Set<string>, directMimeTypes: Set<string>): boolean;
|
|
5
|
-
export declare function anyErrors(outputs: MinifiedOutput[]): boolean;
|
|
6
5
|
export declare function Output(node: GenericNode): JSX.Element;
|
|
7
6
|
//# 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,
|
|
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;AAgB/D,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,eA6BvC"}
|
package/dist/types/safe.d.ts
CHANGED
package/dist/types/safe.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"safe.d.ts","sourceRoot":"","sources":["../../src/safe.tsx"],"names":[],"mappings":";AACA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"safe.d.ts","sourceRoot":"","sources":["../../src/safe.tsx"],"names":[],"mappings":";AACA,OAAO,KAAK,EAA2C,cAAc,EAAE,MAAM,MAAM,CAAC;AAwEpF,wBAAgB,WAAW,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,cAAc,EAAE,CAAA;CAAE,eAM/F"}
|
|
@@ -2,8 +2,8 @@ import type { HostState } from '@curvenote/connect';
|
|
|
2
2
|
export interface State {
|
|
3
3
|
app: HostState;
|
|
4
4
|
}
|
|
5
|
-
export declare const selectIFrameHeight: (state: State, id: string) =>
|
|
6
|
-
export declare const selectIFrameReady: (state: State, id: string) =>
|
|
5
|
+
export declare const selectIFrameHeight: (state: State, id: string) => Pick<import("@curvenote/connect").HostStateItem, "height" | "width"> | undefined;
|
|
6
|
+
export declare const selectIFrameReady: (state: State, id: string) => Boolean;
|
|
7
7
|
export declare const selectIFrameSendFailed: (state: State, id: string) => false | {
|
|
8
8
|
message: string | undefined;
|
|
9
9
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"selectors.d.ts","sourceRoot":"","sources":["../../src/selectors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAGpD,MAAM,WAAW,KAAK;IACpB,GAAG,EAAE,SAAS,CAAC;CAChB;AAED,eAAO,MAAM,kBAAkB,UAAW,KAAK,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"selectors.d.ts","sourceRoot":"","sources":["../../src/selectors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAGpD,MAAM,WAAW,KAAK;IACpB,GAAG,EAAE,SAAS,CAAC;CAChB;AAED,eAAO,MAAM,kBAAkB,UAAW,KAAK,MAAM,MAAM,qFACX,CAAC;AAEjD,eAAO,MAAM,iBAAiB,UAAW,KAAK,MAAM,MAAM,YACT,CAAC;AAElD,eAAO,MAAM,sBAAsB,UAAW,KAAK,MAAM,MAAM;;CACb,CAAC"}
|
package/dist/types/stream.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["../../src/stream.tsx"],"names":[],"mappings":";AAEA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["../../src/stream.tsx"],"names":[],"mappings":";AAEA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,MAAM,CAAC;AAGjD,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,EAAE,MAAM,EAAE,EAAE;IAAE,MAAM,EAAE,oBAAoB,CAAA;CAAE,eAY1E"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@myst-theme/jupyter",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"main": "dist/cjs/index.js",
|
|
5
5
|
"module": "dist/esm/index.js",
|
|
6
6
|
"types": "dist/types/index.d.ts",
|
|
@@ -10,7 +10,6 @@
|
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"scripts": {
|
|
12
12
|
"clean": "rimraf dist",
|
|
13
|
-
"compile": "tsc",
|
|
14
13
|
"lint": "eslint \"src/**/*.ts*\" \"src/**/*.tsx\" -c ./.eslintrc.js",
|
|
15
14
|
"lint:format": "prettier --check \"src/**/*.{ts,tsx,md}\"",
|
|
16
15
|
"dev": "npm-run-all --parallel \"build:* -- --watch\"",
|
|
@@ -20,20 +19,19 @@
|
|
|
20
19
|
"build": "npm-run-all -l clean -p build:cjs build:esm build:types"
|
|
21
20
|
},
|
|
22
21
|
"dependencies": {
|
|
23
|
-
"@curvenote/
|
|
24
|
-
"@
|
|
25
|
-
"@
|
|
26
|
-
"@myst-theme/providers": "^0.1.
|
|
27
|
-
"@
|
|
28
|
-
"@heroicons/react": "^2.0.12",
|
|
29
|
-
"@popperjs/core": "^2.11.5",
|
|
22
|
+
"@curvenote/connect": "^0.0.7",
|
|
23
|
+
"@headlessui/react": "^1.7.7",
|
|
24
|
+
"@heroicons/react": "^2.0.13",
|
|
25
|
+
"@myst-theme/providers": "^0.1.21",
|
|
26
|
+
"@popperjs/core": "^2.11.6",
|
|
30
27
|
"ansi-to-react": "^6.1.6",
|
|
31
28
|
"buffer": "^6.0.3",
|
|
32
|
-
"classnames": "^2.3.
|
|
29
|
+
"classnames": "^2.3.2",
|
|
33
30
|
"myst-common": "^0.0.12",
|
|
34
|
-
"myst-config": "^0.0.
|
|
31
|
+
"myst-config": "^0.0.7",
|
|
35
32
|
"myst-spec": "^0.0.4",
|
|
36
33
|
"nanoid": "^4.0.0",
|
|
34
|
+
"nbtx": "^0.2.3",
|
|
37
35
|
"react-popper": "^2.3.0",
|
|
38
36
|
"react-syntax-highlighter": "^15.5.0",
|
|
39
37
|
"swr": "^1.3.0",
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
type Props = {
|
|
3
|
-
children?: React.ReactNode;
|
|
4
|
-
allSafe?: boolean;
|
|
5
|
-
hasError?: boolean;
|
|
6
|
-
className?: string;
|
|
7
|
-
};
|
|
8
|
-
export declare function OutputBlock(props: Props): JSX.Element;
|
|
9
|
-
export {};
|
|
10
|
-
//# sourceMappingURL=outputBlock.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"outputBlock.d.ts","sourceRoot":"","sources":["../../src/outputBlock.tsx"],"names":[],"mappings":";AAEA,KAAK,KAAK,GAAG;IACX,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,wBAAgB,WAAW,CAAC,KAAK,EAAE,KAAK,eAWvC"}
|
package/dist/cjs/outputBlock.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.OutputBlock = void 0;
|
|
7
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
-
const classnames_1 = __importDefault(require("classnames"));
|
|
9
|
-
function OutputBlock(props) {
|
|
10
|
-
const { children, allSafe, className } = props;
|
|
11
|
-
return ((0, jsx_runtime_1.jsx)("div", Object.assign({ suppressHydrationWarning: !allSafe, className: (0, classnames_1.default)('relative group not-prose overflow-auto mb-4 pl-0.5', className) }, { children: children })));
|
|
12
|
-
}
|
|
13
|
-
exports.OutputBlock = OutputBlock;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
type Props = {
|
|
3
|
-
children?: React.ReactNode;
|
|
4
|
-
allSafe?: boolean;
|
|
5
|
-
hasError?: boolean;
|
|
6
|
-
className?: string;
|
|
7
|
-
};
|
|
8
|
-
export declare function OutputBlock(props: Props): JSX.Element;
|
|
9
|
-
export {};
|
|
10
|
-
//# sourceMappingURL=outputBlock.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"outputBlock.d.ts","sourceRoot":"","sources":["../../src/outputBlock.tsx"],"names":[],"mappings":";AAEA,KAAK,KAAK,GAAG;IACX,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,wBAAgB,WAAW,CAAC,KAAK,EAAE,KAAK,eAWvC"}
|
package/dist/esm/outputBlock.js
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import classNames from 'classnames';
|
|
3
|
-
export function OutputBlock(props) {
|
|
4
|
-
const { children, allSafe, className } = props;
|
|
5
|
-
return (_jsx("div", Object.assign({ suppressHydrationWarning: !allSafe, className: classNames('relative group not-prose overflow-auto mb-4 pl-0.5', className) }, { children: children })));
|
|
6
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
type Props = {
|
|
3
|
-
children?: React.ReactNode;
|
|
4
|
-
allSafe?: boolean;
|
|
5
|
-
hasError?: boolean;
|
|
6
|
-
className?: string;
|
|
7
|
-
};
|
|
8
|
-
export declare function OutputBlock(props: Props): JSX.Element;
|
|
9
|
-
export {};
|
|
10
|
-
//# sourceMappingURL=outputBlock.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"outputBlock.d.ts","sourceRoot":"","sources":["../../src/outputBlock.tsx"],"names":[],"mappings":";AAEA,KAAK,KAAK,GAAG;IACX,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,wBAAgB,WAAW,CAAC,KAAK,EAAE,KAAK,eAWvC"}
|