jupyterlab-ipyflow 0.0.150 → 0.0.151

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.
Files changed (2) hide show
  1. package/lib/index.js +38 -10
  2. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { ICommandPalette } from '@jupyterlab/apputils';
1
2
  import { CodeCell } from '@jupyterlab/cells';
2
3
  import { INotebookTracker } from '@jupyterlab/notebook';
3
4
  const IPYFLOW_KERNEL_NAME = 'ipyflow';
@@ -6,9 +7,39 @@ const IPYFLOW_KERNEL_NAME = 'ipyflow';
6
7
  */
7
8
  const extension = {
8
9
  id: 'jupyterlab-ipyflow',
9
- requires: [INotebookTracker],
10
+ requires: [INotebookTracker, ICommandPalette],
10
11
  autoStart: true,
11
- activate: (app, notebooks) => {
12
+ activate: (app, notebooks, palette) => {
13
+ app.commands.addCommand('alt-mode-execute', {
14
+ label: 'Alt Mode Execute',
15
+ isEnabled: () => true,
16
+ isVisible: () => true,
17
+ isToggled: () => false,
18
+ execute: () => {
19
+ if (notebooks.activeCell.model.type === 'code') {
20
+ const session = notebooks.currentWidget.sessionContext;
21
+ if (session.isReady && notebooks.activeCell.model.type === 'code') {
22
+ session.session.kernel.requestExecute({
23
+ code: '%flow toggle-reactivity-until-next-reset',
24
+ silent: true,
25
+ store_history: false,
26
+ }).done.then(() => {
27
+ CodeCell.execute(notebooks.activeCell, session);
28
+ });
29
+ }
30
+ }
31
+ }
32
+ });
33
+ app.commands.addKeyBinding({
34
+ command: 'alt-mode-execute',
35
+ keys: ['Accel Shift Enter'],
36
+ selector: '.jp-Notebook',
37
+ });
38
+ palette.addItem({
39
+ command: 'alt-mode-execute',
40
+ category: 'execution',
41
+ args: {},
42
+ });
12
43
  notebooks.widgetAdded.connect((sender, nbPanel) => {
13
44
  const session = nbPanel.sessionContext;
14
45
  session.ready.then(() => {
@@ -362,22 +393,19 @@ const connectToComm = (session, notebook) => {
362
393
  }
363
394
  }
364
395
  if (cellPendingExecution === null) {
365
- if (lastExecutionMode === 'reactive') {
396
+ if (isReactivelyExecuting) {
366
397
  if (lastExecutionHighlights === 'reactive') {
367
398
  readyCells = executedReactiveReadyCells;
368
399
  }
369
- updateUI(notebook);
370
400
  resetReactiveState();
371
- }
372
- else {
373
- resetReactiveState();
374
- updateUI(notebook);
375
- }
376
- if (isReactivelyExecuting) {
377
401
  comm.send({
378
402
  type: 'reactivity_cleanup',
379
403
  });
380
404
  }
405
+ else {
406
+ executedReactiveReadyCells = new Set();
407
+ }
408
+ updateUI(notebook);
381
409
  isReactivelyExecuting = false;
382
410
  }
383
411
  else {
package/package.json CHANGED
@@ -63,5 +63,5 @@
63
63
  "extension": true,
64
64
  "outputDir": "../../core/ipyflow/resources/labextension/"
65
65
  },
66
- "version": "0.0.150"
66
+ "version": "0.0.151"
67
67
  }