jupyter-specta 0.1.7 → 0.1.8
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/README.md +49 -1
- package/lib/document/factory.js +0 -4
- package/lib/tool.js +7 -2
- package/lib/topbar/index.js +0 -4
- package/lib/topbar/widget.js +4 -3
- package/package.json +1 -1
- package/style/base.css +5 -8
- package/style/style.css +2 -2
package/README.md
CHANGED
|
@@ -43,7 +43,55 @@ Once installed, you can build your JupyterLite app, a `specta` app will be inclu
|
|
|
43
43
|
jupyter lite build
|
|
44
44
|
```
|
|
45
45
|
|
|
46
|
-
Then serve the contents of the output directory (by default `./_output`) using any static file server. You can access the `
|
|
46
|
+
Then serve the contents of the output directory (by default `./_output`) using any static file server. You can access the `Specta` app at the `/specta/` path.
|
|
47
|
+
|
|
48
|
+
## Specta Configuration
|
|
49
|
+
|
|
50
|
+
### Top-level configuration
|
|
51
|
+
|
|
52
|
+
Specta can be configured using the typicall JupyterLite configuration file: `jupyter-lite.json`. You can add a `spectaConfig` key to the `jupyter-config-data` section of this file to customize the Specta app.
|
|
53
|
+
|
|
54
|
+
The following options are available:
|
|
55
|
+
|
|
56
|
+
- `defaultLayout`: The default layout when opening a file.
|
|
57
|
+
- `hideTopbar`: Boolean flag to show or hide the top bar.
|
|
58
|
+
- `topBar`: Configuration for the top bar.
|
|
59
|
+
|
|
60
|
+
```json
|
|
61
|
+
"topBar": {
|
|
62
|
+
"icon": "url to the icon file, it's shown on the left of the top bar",
|
|
63
|
+
"title": "Title on the left of the top bar",
|
|
64
|
+
"themeToggle": "Boolean flag to show/hide the theme selector",
|
|
65
|
+
"textColor": "Color of the text on the top bar",
|
|
66
|
+
"background": "Background color of the top bar"
|
|
67
|
+
},
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
- `perFileConfig`: an object with key is the file path and value is the above configuration, it's used to have different layout/top bar config for each files, for example:
|
|
71
|
+
|
|
72
|
+
```json
|
|
73
|
+
"perFileConfig": {
|
|
74
|
+
"blog.ipynb": {
|
|
75
|
+
"hideTopbar": false,
|
|
76
|
+
"defaultLayout": "article",
|
|
77
|
+
"topBar": {
|
|
78
|
+
"title": "My blog",
|
|
79
|
+
"themeToggle": false
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### Notebook specific configuration
|
|
86
|
+
|
|
87
|
+
By default, when you open a notebook in Specta, all code cells are hidden, and placeholder skeletons are shown instead at the position of the cell. You can configure the visibility of each cell by using the Specta cell metadata toolbar.
|
|
88
|
+
|
|
89
|
+

|
|
90
|
+
|
|
91
|
+
By opening the `Property Inspector` panel of JupyterLab and selecting the `Specta Cell Config` section, you can change the visibility of each cell as follows:
|
|
92
|
+
|
|
93
|
+
- `Show cell source`: use this toggle to show or hide the cell source code. Default to `false`
|
|
94
|
+
- `Show output placeholder`: use this toggle to show or hide the output skeleton. Default to `true`
|
|
47
95
|
|
|
48
96
|
## Try it online!
|
|
49
97
|
|
package/lib/document/factory.js
CHANGED
|
@@ -35,10 +35,6 @@ export class NotebookGridWidgetFactory extends ABCWidgetFactory {
|
|
|
35
35
|
// Specta app, add topbar to layout
|
|
36
36
|
topbar.id = 'specta-topbar-widget';
|
|
37
37
|
this._shell.add(topbar, 'top');
|
|
38
|
-
if (topbar.parent) {
|
|
39
|
-
topbar.parent.node.style.boxShadow =
|
|
40
|
-
'rgba(0 0 0 / 20%) 0 2px 4px -1px, rgba(0 0 0 / 14%) 0 4px 5px 0, rgba(0 0 0 / 12%) 0 1px 10px 0';
|
|
41
|
-
}
|
|
42
38
|
}
|
|
43
39
|
}
|
|
44
40
|
else if (isSpecta) {
|
package/lib/tool.js
CHANGED
|
@@ -96,10 +96,15 @@ export function readSpectaConfig({ nbMetadata, nbPath }) {
|
|
|
96
96
|
if (!rawConfig || rawConfig.length === 0) {
|
|
97
97
|
rawConfig = '{}';
|
|
98
98
|
}
|
|
99
|
+
let pathWithoutDrive = nbPath;
|
|
100
|
+
const paths = nbPath === null || nbPath === void 0 ? void 0 : nbPath.split(':');
|
|
101
|
+
if (paths && paths.length > 1) {
|
|
102
|
+
pathWithoutDrive = paths[1];
|
|
103
|
+
}
|
|
99
104
|
const _b = JSON.parse(rawConfig), { perFileConfig } = _b, globalConfig = __rest(_b, ["perFileConfig"]);
|
|
100
105
|
let spectaConfig = Object.assign({}, (globalConfig !== null && globalConfig !== void 0 ? globalConfig : {}));
|
|
101
|
-
if (perFileConfig &&
|
|
102
|
-
spectaConfig = Object.assign(Object.assign({}, spectaConfig), perFileConfig[
|
|
106
|
+
if (perFileConfig && pathWithoutDrive && perFileConfig[pathWithoutDrive]) {
|
|
107
|
+
spectaConfig = Object.assign(Object.assign({}, spectaConfig), perFileConfig[pathWithoutDrive]);
|
|
103
108
|
}
|
|
104
109
|
const spectaMetadata = ((_a = nbMetadata === null || nbMetadata === void 0 ? void 0 : nbMetadata.specta) !== null && _a !== void 0 ? _a : {});
|
|
105
110
|
return Object.assign(Object.assign({}, spectaConfig), spectaMetadata);
|
package/lib/topbar/index.js
CHANGED
|
@@ -30,9 +30,5 @@ export const topbarPlugin = {
|
|
|
30
30
|
widget.id = 'specta-topbar-widget';
|
|
31
31
|
widget.addClass('specta-topbar-element');
|
|
32
32
|
app.shell.add(widget, 'top');
|
|
33
|
-
if (widget.parent) {
|
|
34
|
-
widget.parent.node.style.boxShadow =
|
|
35
|
-
'rgba(0 0 0 / 20%) 0 2px 4px -1px, rgba(0 0 0 / 14%) 0 4px 5px 0, rgba(0 0 0 / 12%) 0 1px 10px 0';
|
|
36
|
-
}
|
|
37
33
|
}
|
|
38
34
|
};
|
package/lib/topbar/widget.js
CHANGED
|
@@ -5,13 +5,14 @@ import { SettingContent } from './settingDialog';
|
|
|
5
5
|
export function TopbarElement(props) {
|
|
6
6
|
var _a, _b;
|
|
7
7
|
const config = React.useMemo(() => {
|
|
8
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
8
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
9
9
|
return {
|
|
10
10
|
background: (_b = (_a = props.config) === null || _a === void 0 ? void 0 : _a.background) !== null && _b !== void 0 ? _b : 'var(--jp-layout-color2)',
|
|
11
11
|
title: (_d = (_c = props.config) === null || _c === void 0 ? void 0 : _c.title) !== null && _d !== void 0 ? _d : 'Specta',
|
|
12
12
|
themeToggle: Boolean((_e = props.config) === null || _e === void 0 ? void 0 : _e.themeToggle),
|
|
13
13
|
kernelActivity: Boolean((_f = props.config) === null || _f === void 0 ? void 0 : _f.kernelActivity),
|
|
14
|
-
textColor: (_h = (_g = props.config) === null || _g === void 0 ? void 0 : _g.textColor) !== null && _h !== void 0 ? _h : 'var(--jp-ui-font-color1)'
|
|
14
|
+
textColor: (_h = (_g = props.config) === null || _g === void 0 ? void 0 : _g.textColor) !== null && _h !== void 0 ? _h : 'var(--jp-ui-font-color1)',
|
|
15
|
+
icon: (_j = props.config) === null || _j === void 0 ? void 0 : _j.icon
|
|
15
16
|
};
|
|
16
17
|
}, [props.config]);
|
|
17
18
|
const [open, setOpen] = useState(false);
|
|
@@ -34,7 +35,7 @@ export function TopbarElement(props) {
|
|
|
34
35
|
React.createElement("div", null, config.icon && React.createElement("img", { style: { width: '50px' }, src: config.icon })),
|
|
35
36
|
React.createElement("div", { className: "specta-topbar-title", style: { color: (_b = config.textColor) !== null && _b !== void 0 ? _b : 'var(--jp-ui-font-color1)' } }, config.title)),
|
|
36
37
|
React.createElement("div", { className: "specta-topbar-right" },
|
|
37
|
-
React.createElement(IconButton, { ref: buttonRef, onClick: () => setOpen(!open), icon: React.createElement(GearIcon, { fill: "var(--jp-ui-font-color2)", height:
|
|
38
|
+
React.createElement(IconButton, { ref: buttonRef, onClick: () => setOpen(!open), icon: React.createElement(GearIcon, { fill: "var(--jp-ui-font-color2)", height: 23, width: 23 }) }),
|
|
38
39
|
open && (React.createElement("div", { ref: dialogRef, className: "jp-Dialog-content specta-config-dialog" },
|
|
39
40
|
React.createElement("div", { className: "specta-config-arrow" }),
|
|
40
41
|
React.createElement(SettingContent, { themeManager: props.themeManager, layoutRegistry: props.layoutRegistry }))))));
|
package/package.json
CHANGED
package/style/base.css
CHANGED
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
#specta-top-panel {
|
|
62
|
-
min-height:
|
|
62
|
+
min-height: 36px;
|
|
63
63
|
display: flex;
|
|
64
64
|
box-shadow: unset !important;
|
|
65
65
|
z-index: 100;
|
|
@@ -74,12 +74,9 @@
|
|
|
74
74
|
.specta-topbar {
|
|
75
75
|
display: flex;
|
|
76
76
|
flex-direction: row;
|
|
77
|
-
height:
|
|
77
|
+
height: 36px;
|
|
78
78
|
width: calc(100% + 20px);
|
|
79
|
-
|
|
80
|
-
rgba(0 0 0 / 20%) 0 2px 4px -1px,
|
|
81
|
-
rgba(0 0 0 / 14%) 0 4px 5px 0,
|
|
82
|
-
rgba(0 0 0 / 12%) 0 1px 10px 0;
|
|
79
|
+
border-bottom: solid 0.5px var(--jp-border-color1);
|
|
83
80
|
gap: 10px;
|
|
84
81
|
align-items: center;
|
|
85
82
|
justify-content: space-between;
|
|
@@ -98,8 +95,8 @@
|
|
|
98
95
|
}
|
|
99
96
|
|
|
100
97
|
.specta-topbar-title {
|
|
101
|
-
line-height:
|
|
102
|
-
font-size: 1.
|
|
98
|
+
line-height: 36px;
|
|
99
|
+
font-size: 1.25rem;
|
|
103
100
|
}
|
|
104
101
|
|
|
105
102
|
.specta-topbar-theme {
|
package/style/style.css
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
background: var(--jp-layout-color1);
|
|
5
5
|
}
|
|
6
6
|
|
|
7
|
-
.specta-document-viewer #jp-main-content-panel jp-toolbar {
|
|
7
|
+
.specta-document-viewer #jp-main-content-panel jp-toolbar:first-of-type {
|
|
8
8
|
display: none;
|
|
9
9
|
}
|
|
10
10
|
|
|
@@ -30,4 +30,4 @@
|
|
|
30
30
|
.specta-main-content-panel {
|
|
31
31
|
padding-left: 5px;
|
|
32
32
|
padding-right: 5px;
|
|
33
|
-
}
|
|
33
|
+
}
|