jupyter-specta 0.3.1 → 0.3.2
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 +2 -1
- package/lib/specta_cell_output.js +8 -1
- package/lib/token.d.ts +1 -0
- package/lib/tool.js +5 -1
- package/package.json +1 -1
- package/schema/cell-meta.json +9 -0
- package/style/article.css +31 -4
package/README.md
CHANGED
|
@@ -115,10 +115,11 @@ By default, when you open a notebook in Specta, all code cells are hidden, and p
|
|
|
115
115
|
|
|
116
116
|

|
|
117
117
|
|
|
118
|
-
By opening the `Property Inspector` panel of JupyterLab and selecting the `Specta Cell Config` section, you can change the
|
|
118
|
+
By opening the `Property Inspector` panel of JupyterLab and selecting the `Specta Cell Config` section, you can change the display of each cell as follows:
|
|
119
119
|
|
|
120
120
|
- `Show cell source`: use this toggle to show or hide the cell source code. Default to `false`
|
|
121
121
|
- `Show output placeholder`: use this toggle to show or hide the output skeleton. Default to `true`
|
|
122
|
+
- `Output size`: use this dropdown to select the size of the cell output. Default to `Small`
|
|
122
123
|
|
|
123
124
|
### Slides layout configuration
|
|
124
125
|
|
|
@@ -8,9 +8,16 @@ export class SpectaCellOutput extends Panel {
|
|
|
8
8
|
super();
|
|
9
9
|
this._info = {};
|
|
10
10
|
this._placeholder = undefined;
|
|
11
|
+
const { showOutput, outputSize } = cellConfig;
|
|
11
12
|
this.removeClass('lm-Widget');
|
|
12
13
|
this.removeClass('p-Widget');
|
|
13
14
|
this.addClass('specta-cell-output');
|
|
15
|
+
if (outputSize === 'Big') {
|
|
16
|
+
this.addClass('specta-cell-output-big');
|
|
17
|
+
}
|
|
18
|
+
else if (outputSize === 'Full') {
|
|
19
|
+
this.addClass('specta-cell-output-full');
|
|
20
|
+
}
|
|
14
21
|
const content = new Panel();
|
|
15
22
|
content.addClass('specta-cell-content');
|
|
16
23
|
cell.addClass('specta-item-widget');
|
|
@@ -23,7 +30,7 @@ export class SpectaCellOutput extends Panel {
|
|
|
23
30
|
this.cellIdentity = cellIdentity;
|
|
24
31
|
this._info = info !== null && info !== void 0 ? info : {};
|
|
25
32
|
if (((_a = info.cellModel) === null || _a === void 0 ? void 0 : _a.cell_type) === 'code') {
|
|
26
|
-
if (
|
|
33
|
+
if (showOutput) {
|
|
27
34
|
this._placeholder = ReactWidget.create(React.createElement(RandomSkeleton, null));
|
|
28
35
|
this._placeholder.addClass('specta-cell-placeholder');
|
|
29
36
|
this.addWidget(this._placeholder);
|
package/lib/token.d.ts
CHANGED
|
@@ -61,6 +61,7 @@ export interface ISpectaAppConfig {
|
|
|
61
61
|
export interface ISpectaCellConfig {
|
|
62
62
|
showSource?: boolean;
|
|
63
63
|
showOutput?: boolean;
|
|
64
|
+
outputSize?: 'Small' | 'Big' | 'Full';
|
|
64
65
|
}
|
|
65
66
|
export declare const ISpectaLayoutRegistry: Token<ISpectaLayoutRegistry>;
|
|
66
67
|
export declare const ISpectaDocTracker: Token<IWidgetTracker<Widget>>;
|
package/lib/tool.js
CHANGED
|
@@ -144,7 +144,8 @@ export function readCellConfig(cell) {
|
|
|
144
144
|
const metaData = ((_b = (_a = cell === null || cell === void 0 ? void 0 : cell.metadata) === null || _a === void 0 ? void 0 : _a.specta) !== null && _b !== void 0 ? _b : {});
|
|
145
145
|
const spectaCellConfig = {
|
|
146
146
|
showSource: false,
|
|
147
|
-
showOutput: true
|
|
147
|
+
showOutput: true,
|
|
148
|
+
outputSize: 'Small'
|
|
148
149
|
};
|
|
149
150
|
if (metaData.showSource && metaData.showSource === 'Yes') {
|
|
150
151
|
spectaCellConfig.showSource = true;
|
|
@@ -152,6 +153,9 @@ export function readCellConfig(cell) {
|
|
|
152
153
|
if (metaData.showOutput && metaData.showOutput === 'No') {
|
|
153
154
|
spectaCellConfig.showOutput = false;
|
|
154
155
|
}
|
|
156
|
+
if (metaData.outputSize) {
|
|
157
|
+
spectaCellConfig.outputSize = metaData.outputSize;
|
|
158
|
+
}
|
|
155
159
|
return spectaCellConfig;
|
|
156
160
|
}
|
|
157
161
|
export function debounce(fn, delay = 100) {
|
package/package.json
CHANGED
package/schema/cell-meta.json
CHANGED
|
@@ -20,6 +20,12 @@
|
|
|
20
20
|
"type": "string",
|
|
21
21
|
"enum": ["Yes", "No"],
|
|
22
22
|
"default": "Yes"
|
|
23
|
+
},
|
|
24
|
+
"/specta/outputSize": {
|
|
25
|
+
"title": "Output size",
|
|
26
|
+
"type": "string",
|
|
27
|
+
"enum": ["Small", "Big", "Full"],
|
|
28
|
+
"default": "Small"
|
|
23
29
|
}
|
|
24
30
|
}
|
|
25
31
|
},
|
|
@@ -29,6 +35,9 @@
|
|
|
29
35
|
},
|
|
30
36
|
"/specta/showOutput": {
|
|
31
37
|
"writeDefault": false
|
|
38
|
+
},
|
|
39
|
+
"/specta/outputSize": {
|
|
40
|
+
"writeDefault": false
|
|
32
41
|
}
|
|
33
42
|
}
|
|
34
43
|
}
|
package/style/article.css
CHANGED
|
@@ -23,12 +23,15 @@
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
.specta-article-outputs-panel {
|
|
26
|
-
max-width: 680px;
|
|
27
|
-
width: 100%;
|
|
28
26
|
font-size: 1rem;
|
|
29
27
|
line-height: 1.6;
|
|
28
|
+
width: 100%;
|
|
30
29
|
}
|
|
31
30
|
|
|
31
|
+
.specta-cell-output {
|
|
32
|
+
max-width: 680px;
|
|
33
|
+
margin: auto;
|
|
34
|
+
}
|
|
32
35
|
.specta-article-outputs-panel {
|
|
33
36
|
.jp-MarkdownOutput {
|
|
34
37
|
padding-left: 0px !important;
|
|
@@ -194,7 +197,7 @@
|
|
|
194
197
|
margin-top: 40px !important;
|
|
195
198
|
}
|
|
196
199
|
|
|
197
|
-
.jp-
|
|
200
|
+
.jp-OutputArea > .jp-OutputArea-child:first-child {
|
|
198
201
|
margin-top: 40px !important;
|
|
199
202
|
}
|
|
200
203
|
.jp-InputArea-editor {
|
|
@@ -307,8 +310,32 @@
|
|
|
307
310
|
margin-top: 56px !important;
|
|
308
311
|
}
|
|
309
312
|
|
|
310
|
-
.jp-
|
|
313
|
+
.jp-OutputArea > .jp-OutputArea-child:first-child {
|
|
311
314
|
margin-top: 56px !important;
|
|
312
315
|
}
|
|
316
|
+
|
|
317
|
+
.specta-cell-output-big {
|
|
318
|
+
max-width: 1192px;
|
|
319
|
+
}
|
|
320
|
+
.specta-cell-output-big .jp-Cell {
|
|
321
|
+
max-width: 680px;
|
|
322
|
+
margin: auto;
|
|
323
|
+
}
|
|
324
|
+
.specta-cell-output-big .jp-Cell.jp-MarkdownCell {
|
|
325
|
+
max-width: 1192px;
|
|
326
|
+
margin: auto;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
.specta-cell-output-full {
|
|
330
|
+
max-width: 100%;
|
|
331
|
+
}
|
|
332
|
+
.specta-cell-output-full .jp-Cell {
|
|
333
|
+
max-width: 680px;
|
|
334
|
+
margin: auto;
|
|
335
|
+
}
|
|
336
|
+
.specta-cell-output-full .jp-Cell.jp-MarkdownCell {
|
|
337
|
+
max-width: 100%;
|
|
338
|
+
margin: auto;
|
|
339
|
+
}
|
|
313
340
|
}
|
|
314
341
|
}
|