jupyter-specta 0.3.1 → 0.3.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/README.md CHANGED
@@ -69,6 +69,7 @@ Specta can be configured using the typicall JupyterLite configuration file: `jup
69
69
  The following options are available:
70
70
 
71
71
  - `defaultLayout`: The default layout when opening a file.
72
+ - `executionDelay`: Delay (in miliseconds) before executing cells.
72
73
  - `hideTopbar`: Boolean flag to show or hide the top bar.
73
74
  - `topBar`: Configuration for the top bar.
74
75
  - `slidesTheme`: The theme for the slides layout. The list of available themes can be found [here](https://revealjs.com/themes/).
@@ -115,10 +116,11 @@ By default, when you open a notebook in Specta, all code cells are hidden, and p
115
116
 
116
117
  ![Cell toolbar](./docs/images/specta-config.jpg)
117
118
 
118
- 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:
119
+ 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
120
 
120
121
  - `Show cell source`: use this toggle to show or hide the cell source code. Default to `false`
121
122
  - `Show output placeholder`: use this toggle to show or hide the output skeleton. Default to `true`
123
+ - `Output size`: use this dropdown to select the size of the cell output. Default to `Small`
122
124
 
123
125
  ### Slides layout configuration
124
126
 
@@ -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 (cellConfig.showOutput) {
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);
@@ -20,7 +20,15 @@ export class AppWidget extends Panel {
20
20
  // Not a specta app, add spinner
21
21
  this.addSpinner();
22
22
  }
23
- this._model.initialize().then(() => {
23
+ this._model.initialize().then(async () => {
24
+ let waitTime = this._spectaAppConfig.executionDelay;
25
+ if (!waitTime) {
26
+ waitTime = 100;
27
+ }
28
+ else {
29
+ console.log(`Waiting for ${waitTime}ms`);
30
+ }
31
+ await new Promise(resolve => setTimeout(resolve, parseInt(waitTime + '')));
24
32
  this.render().catch(console.error).then(emitResizeEvent);
25
33
  });
26
34
  this._layoutRegistry.selectedLayoutChanged.connect(this._onSelectedLayoutChanged, this);
package/lib/token.d.ts CHANGED
@@ -50,6 +50,7 @@ export interface ISpectaAppConfig {
50
50
  hideTopbar?: boolean;
51
51
  slidesTheme?: string;
52
52
  loadingName?: string;
53
+ executionDelay?: number;
53
54
  labConfig?: {
54
55
  setSingleMode?: boolean;
55
56
  hideLeftPanel?: boolean;
@@ -61,6 +62,7 @@ export interface ISpectaAppConfig {
61
62
  export interface ISpectaCellConfig {
62
63
  showSource?: boolean;
63
64
  showOutput?: boolean;
65
+ outputSize?: 'Small' | 'Big' | 'Full';
64
66
  }
65
67
  export declare const ISpectaLayoutRegistry: Token<ISpectaLayoutRegistry>;
66
68
  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) {
@@ -183,7 +187,6 @@ export async function configLabLayout(options) {
183
187
  if (!config) {
184
188
  return;
185
189
  }
186
- console.log('vvvvvvvvvvv', config);
187
190
  const { setSingleMode, hideLeftPanel, hideRightPanel, hideStatusbar, hideHeader } = config;
188
191
  if (setSingleMode) {
189
192
  await commands.execute('application:set-mode', {
@@ -209,9 +212,7 @@ export async function configLabLayout(options) {
209
212
  }
210
213
  if (hideStatusbar) {
211
214
  const statusBar = document.getElementById('jp-main-statusbar');
212
- console.log('statusBar.clientHeight', statusBar === null || statusBar === void 0 ? void 0 : statusBar.clientHeight);
213
215
  if (statusBar && !statusBar.classList.contains('lm-mod-hidden')) {
214
- console.log('toggle status');
215
216
  await commands.execute('statusbar:toggle');
216
217
  }
217
218
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jupyter-specta",
3
- "version": "0.3.1",
3
+ "version": "0.3.3",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "homepage": "https://github.com/trungleduc/specta",
@@ -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-CodeCell + .jp-OutputArea > .jp-OutputArea-child {
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-CodeCell + .jp-OutputArea > .jp-OutputArea-child {
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
  }