Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@jupyterlab/observables

Package Overview
Dependencies
Maintainers
16
Versions
339
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jupyterlab/observables - npm Package Compare versions

Comparing version 2.2.0-alpha.6 to 2.2.0-alpha.7

17

lib/index.js

@@ -1,2 +0,1 @@

"use strict";
/*-----------------------------------------------------------------------------

@@ -6,11 +5,7 @@ | Copyright (c) Jupyter Development Team.

|----------------------------------------------------------------------------*/
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
Object.defineProperty(exports, "__esModule", { value: true });
__export(require("./modeldb"));
__export(require("./observablejson"));
__export(require("./observablelist"));
__export(require("./observablemap"));
__export(require("./observablestring"));
__export(require("./undoablelist"));
export * from './modeldb';
export * from './observablejson';
export * from './observablelist';
export * from './observablemap';
export * from './observablestring';
export * from './undoablelist';

@@ -1,16 +0,14 @@

"use strict";
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
Object.defineProperty(exports, "__esModule", { value: true });
const disposable_1 = require("@phosphor/disposable");
const signaling_1 = require("@phosphor/signaling");
const coreutils_1 = require("@phosphor/coreutils");
const observablemap_1 = require("./observablemap");
const observablejson_1 = require("./observablejson");
const observablestring_1 = require("./observablestring");
const undoablelist_1 = require("./undoablelist");
import { DisposableSet } from '@phosphor/disposable';
import { Signal } from '@phosphor/signaling';
import { JSONExt } from '@phosphor/coreutils';
import { ObservableMap } from './observablemap';
import { ObservableJSON } from './observablejson';
import { ObservableString } from './observablestring';
import { ObservableUndoableList } from './undoablelist';
/**
* A concrete implementation of an `IObservableValue`.
*/
class ObservableValue {
export class ObservableValue {
/**

@@ -23,3 +21,3 @@ * Constructor for the value.

this._value = null;
this._changed = new signaling_1.Signal(this);
this._changed = new Signal(this);
this._isDisposed = false;

@@ -57,3 +55,3 @@ this._value = initialValue;

let oldValue = this._value;
if (coreutils_1.JSONExt.deepEqual(oldValue, value)) {
if (JSONExt.deepEqual(oldValue, value)) {
return;

@@ -75,7 +73,6 @@ }

this._isDisposed = true;
signaling_1.Signal.clearData(this);
Signal.clearData(this);
this._value = null;
}
}
exports.ObservableValue = ObservableValue;
/**

@@ -91,7 +88,7 @@ * The namespace for the `ObservableValue` class statics.

ObservableValue.IChangedArgs = IChangedArgs;
})(ObservableValue = exports.ObservableValue || (exports.ObservableValue = {}));
})(ObservableValue || (ObservableValue = {}));
/**
* A concrete implementation of an `IModelDB`.
*/
class ModelDB {
export class ModelDB {
/**

@@ -118,3 +115,3 @@ * Constructor for the `ModelDB`.

this._isDisposed = false;
this._disposables = new disposable_1.DisposableSet();
this._disposables = new DisposableSet();
this._basePath = options.basePath || '';

@@ -125,3 +122,3 @@ if (options.baseDB) {

else {
this._db = new observablemap_1.ObservableMap();
this._db = new ObservableMap();
this._toDispose = true;

@@ -172,3 +169,3 @@ }

createString(path) {
let str = new observablestring_1.ObservableString();
let str = new ObservableString();
this._disposables.add(str);

@@ -190,3 +187,3 @@ this.set(path, str);

createList(path) {
let vec = new undoablelist_1.ObservableUndoableList(new undoablelist_1.ObservableUndoableList.IdentitySerializer());
let vec = new ObservableUndoableList(new ObservableUndoableList.IdentitySerializer());
this._disposables.add(vec);

@@ -208,3 +205,3 @@ this.set(path, vec);

createMap(path) {
let map = new observablejson_1.ObservableJSON();
let map = new ObservableJSON();
this._disposables.add(map);

@@ -303,2 +300,1 @@ this.set(path, map);

}
exports.ModelDB = ModelDB;

@@ -1,12 +0,10 @@

"use strict";
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
Object.defineProperty(exports, "__esModule", { value: true });
const coreutils_1 = require("@phosphor/coreutils");
const messaging_1 = require("@phosphor/messaging");
const observablemap_1 = require("./observablemap");
import { JSONExt } from '@phosphor/coreutils';
import { Message } from '@phosphor/messaging';
import { ObservableMap } from './observablemap';
/**
* A concrete Observable map for JSON data.
*/
class ObservableJSON extends observablemap_1.ObservableMap {
export class ObservableJSON extends ObservableMap {
/**

@@ -17,3 +15,3 @@ * Construct a new observable JSON object.

super({
itemCmp: coreutils_1.JSONExt.deepEqual,
itemCmp: JSONExt.deepEqual,
values: options.values

@@ -31,3 +29,3 @@ });

if (value !== undefined) {
out[key] = coreutils_1.JSONExt.deepCopy(value);
out[key] = JSONExt.deepCopy(value);
}

@@ -38,3 +36,2 @@ }

}
exports.ObservableJSON = ObservableJSON;
/**

@@ -47,3 +44,3 @@ * The namespace for ObservableJSON static data.

*/
class ChangeMessage extends messaging_1.Message {
class ChangeMessage extends Message {
/**

@@ -58,2 +55,2 @@ * Create a new metadata changed message.

ObservableJSON.ChangeMessage = ChangeMessage;
})(ObservableJSON = exports.ObservableJSON || (exports.ObservableJSON = {}));
})(ObservableJSON || (ObservableJSON = {}));

@@ -1,11 +0,9 @@

"use strict";
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
Object.defineProperty(exports, "__esModule", { value: true });
const algorithm_1 = require("@phosphor/algorithm");
const signaling_1 = require("@phosphor/signaling");
import { ArrayExt, ArrayIterator, each, toArray } from '@phosphor/algorithm';
import { Signal } from '@phosphor/signaling';
/**
* A concrete implementation of [[IObservableList]].
*/
class ObservableList {
export class ObservableList {
/**

@@ -17,5 +15,5 @@ * Construct a new observable map.

this._isDisposed = false;
this._changed = new signaling_1.Signal(this);
this._changed = new Signal(this);
if (options.values !== void 0) {
algorithm_1.each(options.values, value => {
each(options.values, value => {
this._array.push(value);

@@ -58,3 +56,3 @@ });

this._isDisposed = true;
signaling_1.Signal.clearData(this);
Signal.clearData(this);
this.clear();

@@ -74,3 +72,3 @@ }

iter() {
return new algorithm_1.ArrayIterator(this._array);
return new ArrayIterator(this._array);
}

@@ -169,3 +167,3 @@ /**

insert(index, value) {
algorithm_1.ArrayExt.insert(this._array, index, value);
ArrayExt.insert(this._array, index, value);
this._changed.emit({

@@ -195,3 +193,3 @@ type: 'add',

let itemCmp = this._itemCmp;
let index = algorithm_1.ArrayExt.findFirstIndex(this._array, item => {
let index = ArrayExt.findFirstIndex(this._array, item => {
return itemCmp(item, value);

@@ -220,3 +218,3 @@ });

remove(index) {
let value = algorithm_1.ArrayExt.removeAt(this._array, index);
let value = ArrayExt.removeAt(this._array, index);
if (value === undefined) {

@@ -276,3 +274,3 @@ return;

let values = [this._array[fromIndex]];
algorithm_1.ArrayExt.move(this._array, fromIndex, toIndex);
ArrayExt.move(this._array, fromIndex, toIndex);
this._changed.emit({

@@ -301,3 +299,3 @@ type: 'move',

let newIndex = this.length;
algorithm_1.each(values, value => {
each(values, value => {
this._array.push(value);

@@ -310,3 +308,3 @@ });

oldValues: [],
newValues: algorithm_1.toArray(values)
newValues: toArray(values)
});

@@ -336,4 +334,4 @@ return this.length;

let newIndex = index;
algorithm_1.each(values, value => {
algorithm_1.ArrayExt.insert(this._array, index++, value);
each(values, value => {
ArrayExt.insert(this._array, index++, value);
});

@@ -345,3 +343,3 @@ this._changed.emit({

oldValues: [],
newValues: algorithm_1.toArray(values)
newValues: toArray(values)
});

@@ -370,3 +368,3 @@ }

for (let i = startIndex; i < endIndex; i++) {
algorithm_1.ArrayExt.removeAt(this._array, startIndex);
ArrayExt.removeAt(this._array, startIndex);
}

@@ -383,3 +381,2 @@ this._changed.emit({

}
exports.ObservableList = ObservableList;
/**

@@ -386,0 +383,0 @@ * The namespace for module private data.

@@ -1,10 +0,8 @@

"use strict";
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
Object.defineProperty(exports, "__esModule", { value: true });
const signaling_1 = require("@phosphor/signaling");
import { Signal } from '@phosphor/signaling';
/**
* A concrete implementation of IObservbleMap<T>.
*/
class ObservableMap {
export class ObservableMap {
/**

@@ -15,3 +13,3 @@ * Construct a new observable map.

this._map = new Map();
this._changed = new signaling_1.Signal(this);
this._changed = new Signal(this);
this._isDisposed = false;

@@ -169,7 +167,6 @@ this._itemCmp = options.itemCmp || Private.itemCmp;

this._isDisposed = true;
signaling_1.Signal.clearData(this);
Signal.clearData(this);
this._map.clear();
}
}
exports.ObservableMap = ObservableMap;
/**

@@ -176,0 +173,0 @@ * The namespace for module private data.

@@ -1,10 +0,8 @@

"use strict";
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
Object.defineProperty(exports, "__esModule", { value: true });
const signaling_1 = require("@phosphor/signaling");
import { Signal } from '@phosphor/signaling';
/**
* A concrete implementation of [[IObservableString]]
*/
class ObservableString {
export class ObservableString {
/**

@@ -16,3 +14,3 @@ * Construct a new observable string.

this._isDisposed = false;
this._changed = new signaling_1.Signal(this);
this._changed = new Signal(this);
this._text = initialText;

@@ -106,6 +104,5 @@ }

this._isDisposed = true;
signaling_1.Signal.clearData(this);
Signal.clearData(this);
this.clear();
}
}
exports.ObservableString = ObservableString;

@@ -1,11 +0,9 @@

"use strict";
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
Object.defineProperty(exports, "__esModule", { value: true });
const algorithm_1 = require("@phosphor/algorithm");
const observablelist_1 = require("./observablelist");
import { each } from '@phosphor/algorithm';
import { ObservableList } from './observablelist';
/**
* A concrete implementation of an observable undoable list.
*/
class ObservableUndoableList extends observablelist_1.ObservableList {
export class ObservableUndoableList extends ObservableList {
/**

@@ -130,3 +128,3 @@ * Construct a new undoable observable list.

case 'add':
algorithm_1.each(change.newValues, () => {
each(change.newValues, () => {
this.remove(change.newIndex);

@@ -137,3 +135,3 @@ });

index = change.oldIndex;
algorithm_1.each(change.oldValues, value => {
each(change.oldValues, value => {
this.set(index++, serializer.fromJSON(value));

@@ -144,3 +142,3 @@ });

index = change.oldIndex;
algorithm_1.each(change.oldValues, value => {
each(change.oldValues, value => {
this.insert(index++, serializer.fromJSON(value));

@@ -165,3 +163,3 @@ });

index = change.newIndex;
algorithm_1.each(change.newValues, value => {
each(change.newValues, value => {
this.insert(index++, serializer.fromJSON(value));

@@ -172,3 +170,3 @@ });

index = change.newIndex;
algorithm_1.each(change.newValues, value => {
each(change.newValues, value => {
this.set(change.newIndex++, serializer.fromJSON(value));

@@ -178,3 +176,3 @@ });

case 'remove':
algorithm_1.each(change.oldValues, () => {
each(change.oldValues, () => {
this.remove(change.oldIndex);

@@ -195,7 +193,7 @@ });

let oldValues = [];
algorithm_1.each(change.oldValues, value => {
each(change.oldValues, value => {
oldValues.push(this._serializer.toJSON(value));
});
let newValues = [];
algorithm_1.each(change.newValues, value => {
each(change.newValues, value => {
newValues.push(this._serializer.toJSON(value));

@@ -212,3 +210,2 @@ });

}
exports.ObservableUndoableList = ObservableUndoableList;
/**

@@ -236,2 +233,2 @@ * Namespace for ObservableUndoableList utilities.

ObservableUndoableList.IdentitySerializer = IdentitySerializer;
})(ObservableUndoableList = exports.ObservableUndoableList || (exports.ObservableUndoableList = {}));
})(ObservableUndoableList || (ObservableUndoableList = {}));
{
"name": "@jupyterlab/observables",
"version": "2.2.0-alpha.6",
"version": "2.2.0-alpha.7",
"description": "Data structures which may be observed for changes.",

@@ -9,2 +9,6 @@ "homepage": "https://github.com/jupyterlab/jupyterlab",

},
"repository": {
"type": "git",
"url": "https://github.com/jupyterlab/jupyterlab.git"
},
"license": "BSD-3-Clause",

@@ -21,6 +25,2 @@ "author": "Project Jupyter",

},
"repository": {
"type": "git",
"url": "https://github.com/jupyterlab/jupyterlab.git"
},
"scripts": {

@@ -48,3 +48,3 @@ "build": "tsc -b",

},
"gitHead": "25152cd7c0a2d2d3d020dcd59451c236e9ecc6ab"
"gitHead": "f8e210a027f6545b426caf4ab64c75a1e1619a44"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc