jupyterlab-ipyflow 0.0.169 → 0.0.170

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 +44 -17
  2. package/package.json +2 -2
package/lib/index.js CHANGED
@@ -71,19 +71,40 @@ const extension = {
71
71
  app.commands.execute('notebook:enter-command-mode');
72
72
  CodeCell.execute(notebooks.activeCell, session);
73
73
  }
74
- else if (!isAltModeExecuting &&
75
- notebooks.activeCell.model.type === 'code') {
76
- isAltModeExecuting = true;
74
+ else if (notebooks.activeCell.model.type === 'code') {
77
75
  app.commands.execute('notebook:enter-command-mode');
78
- session.session.kernel
79
- .requestExecute({
80
- code: '%flow toggle-reactivity-until-next-reset',
81
- silent: true,
82
- store_history: false,
83
- })
84
- .done.then(() => {
85
- CodeCell.execute(notebooks.activeCell, session);
86
- });
76
+ if (isAltModeExecuting) {
77
+ // run the toggle twice to get to the same exec mode, but with updated timestamp
78
+ session.session.kernel
79
+ .requestExecute({
80
+ code: '%flow toggle-reactivity-until-next-reset',
81
+ silent: true,
82
+ store_history: false,
83
+ })
84
+ .done.then(() => {
85
+ session.session.kernel
86
+ .requestExecute({
87
+ code: '%flow toggle-reactivity-until-next-reset',
88
+ silent: true,
89
+ store_history: false,
90
+ })
91
+ .done.then(() => {
92
+ CodeCell.execute(notebooks.activeCell, session);
93
+ });
94
+ });
95
+ }
96
+ else {
97
+ isAltModeExecuting = true;
98
+ session.session.kernel
99
+ .requestExecute({
100
+ code: '%flow toggle-reactivity-until-next-reset',
101
+ silent: true,
102
+ store_history: false,
103
+ })
104
+ .done.then(() => {
105
+ CodeCell.execute(notebooks.activeCell, session);
106
+ });
107
+ }
87
108
  }
88
109
  },
89
110
  });
@@ -251,10 +272,11 @@ const connectToComm = (session, notebook) => {
251
272
  const gatherCellMetadataAndContent = () => {
252
273
  const cell_metadata_by_id = {};
253
274
  notebook.widgets.forEach((itercell, idx) => {
254
- cell_metadata_by_id[itercell.model.id] = {
275
+ const model = itercell.model;
276
+ cell_metadata_by_id[model.id] = {
255
277
  index: idx,
256
- content: itercell.model.value.text,
257
- type: itercell.model.type,
278
+ content: model.sharedModel.getSource(),
279
+ type: model.type,
258
280
  };
259
281
  });
260
282
  return cell_metadata_by_id;
@@ -418,6 +440,10 @@ const connectToComm = (session, notebook) => {
418
440
  notebook.model.contentChanged.connect(onContentChanged);
419
441
  requestComputeExecSchedule();
420
442
  }
443
+ else if (payload.type === 'set_exec_mode') {
444
+ isAltModeExecuting = false;
445
+ lastExecutionMode = payload.exec_mode;
446
+ }
421
447
  else if (payload.type === 'compute_exec_schedule') {
422
448
  waitingCells = new Set(payload.waiting_cells);
423
449
  readyCells = new Set(payload.ready_cells);
@@ -435,7 +461,6 @@ const connectToComm = (session, notebook) => {
435
461
  const exec_mode = payload.exec_mode;
436
462
  isReactivelyExecuting =
437
463
  isReactivelyExecuting ||
438
- exec_mode === 'reactive' ||
439
464
  ((_b = payload === null || payload === void 0 ? void 0 : payload.is_reactively_executing) !== null && _b !== void 0 ? _b : false);
440
465
  const flow_order = payload.flow_order;
441
466
  const exec_schedule = payload.exec_schedule;
@@ -496,7 +521,9 @@ const connectToComm = (session, notebook) => {
496
521
  executedReactiveReadyCells = new Set();
497
522
  updateUI(notebook);
498
523
  isReactivelyExecuting = false;
499
- isAltModeExecuting = false;
524
+ if (lastExecutionMode === 'reactive') {
525
+ isAltModeExecuting = false;
526
+ }
500
527
  }
501
528
  else {
502
529
  isReactivelyExecuting = true;
package/package.json CHANGED
@@ -48,7 +48,7 @@
48
48
  "lodash": "^4.0"
49
49
  },
50
50
  "devDependencies": {
51
- "@jupyterlab/builder": "^3.4.3",
51
+ "@jupyterlab/builder": "^4.0.0-rc.1",
52
52
  "@types/lodash": "^4.14.191",
53
53
  "@typescript-eslint/eslint-plugin": "^5.15.0",
54
54
  "@typescript-eslint/parser": "^5.15.0",
@@ -67,5 +67,5 @@
67
67
  "extension": true,
68
68
  "outputDir": "../../core/ipyflow/resources/labextension/"
69
69
  },
70
- "version": "0.0.169"
70
+ "version": "0.0.170"
71
71
  }