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

rete

Package Overview
Dependencies
Maintainers
1
Versions
78
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rete - npm Package Compare versions

Comparing version 2.0.0-beta.3 to 2.0.0-beta.4

2

package.json
{
"name": "rete",
"version": "2.0.0-beta.3",
"version": "2.0.0-beta.4",
"description": "JavaScript framework",

@@ -5,0 +5,0 @@ "author": "Vitaliy Stoliarov",

/*!
* rete v2.0.0-beta.3
* rete v2.0.0-beta.4
* (c) 2023 Vitaliy Stoliarov

@@ -236,4 +236,4 @@ * Released under the MIT license.

class Input extends Port {
constructor() {
super(...arguments);
constructor(...args) {
super(...args);
_defineProperty(this, "control", null);

@@ -266,8 +266,9 @@ _defineProperty(this, "showControl", true);

this.id = getUID();
this.readonly = options?.readonly;
if (typeof options?.initial !== 'undefined') this.value = options.initial;
this.readonly = options === null || options === void 0 ? void 0 : options.readonly;
if (typeof (options === null || options === void 0 ? void 0 : options.initial) !== 'undefined') this.value = options.initial;
}
setValue(value) {
var _this$options;
this.value = value;
if (this.options?.change) this.options.change(value);
if ((_this$options = this.options) !== null && _this$options !== void 0 && _this$options.change) this.options.change(value);
}

@@ -274,0 +275,0 @@ }

/*!
* rete v2.0.0-beta.3
* rete v2.0.0-beta.4
* (c) 2023 Vitaliy Stoliarov

@@ -232,4 +232,4 @@ * Released under the MIT license.

class Input extends Port {
constructor() {
super(...arguments);
constructor(...args) {
super(...args);
_defineProperty(this, "control", null);

@@ -262,8 +262,9 @@ _defineProperty(this, "showControl", true);

this.id = getUID();
this.readonly = options?.readonly;
if (typeof options?.initial !== 'undefined') this.value = options.initial;
this.readonly = options === null || options === void 0 ? void 0 : options.readonly;
if (typeof (options === null || options === void 0 ? void 0 : options.initial) !== 'undefined') this.value = options.initial;
}
setValue(value) {
var _this$options;
this.value = value;
if (this.options?.change) this.options.change(value);
if ((_this$options = this.options) !== null && _this$options !== void 0 && _this$options.change) this.options.change(value);
}

@@ -270,0 +271,0 @@ }

/*!
* rete v2.0.0-beta.3
* rete v2.0.0-beta.4
* (c) 2023 Vitaliy Stoliarov
* Released under the MIT license.
* */
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).Rete={})}(this,(function(t){"use strict";function e(t,e,n){return(e=function(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:String(e)}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}class n{constructor(){e(this,"pipes",[])}addPipe(t){this.pipes.push(t)}async emit(t){let e=t;for(const t of this.pipes)if(e=await t(e),void 0===e)return;return e}}class i{constructor(t){e(this,"signal",new n),this.name=t}addPipe(t){this.signal.addPipe(t)}use(t){t.setParent(this),this.addPipe((e=>t.signal.emit(e)))}setParent(t){this.parent=t}emit(t){return this.signal.emit(t)}hasParent(){return Boolean(this.parent)}parentScope(t){if(!this.parent)throw new Error("cannot find parent");if(t&&this.parent instanceof t)return this.parent;if(t)throw new Error("actual parent is not instance of type");return this.parent}}const o=globalThis.crypto;function r(){if("randomBytes"in o)return o.randomBytes(8).toString("hex");const t=o.getRandomValues(new Uint8Array(8));return Array.from(t).map((t=>t.toString(16).padStart(2,"0"))).join("")}class s{constructor(t,e,n){this.socket=t,this.label=e,this.multipleConnections=n,this.id=r()}}class a{constructor(){this.id=r()}}var c=Object.freeze({__proto__:null,Socket:class{constructor(t){this.name=t}},Port:s,Input:class extends s{constructor(){super(...arguments),e(this,"control",null),e(this,"showControl",!0)}addControl(t){if(this.control)throw new Error("control already added for this input");this.control=t}removeControl(){this.control=null}},Output:class extends s{constructor(t,e,n){super(t,e,!1!==n)}},Control:a,InputControl:class extends a{constructor(t,e){super(),this.type=t,this.options=e,this.id=r(),this.readonly=e?.readonly,void 0!==e?.initial&&(this.value=e.initial)}setValue(t){this.value=t,this.options?.change&&this.options.change(t)}},Node:class{constructor(t){e(this,"inputs",{}),e(this,"outputs",{}),e(this,"controls",{}),this.label=t,this.id=r()}hasInput(t){return Object.prototype.hasOwnProperty.call(this.inputs,t)}addInput(t,e){if(this.hasInput(t))throw new Error(`input with key '${String(t)}' already added`);Object.defineProperty(this.inputs,t,{value:e,enumerable:!0,configurable:!0})}removeInput(t){delete this.inputs[t]}hasOutput(t){return Object.prototype.hasOwnProperty.call(this.outputs,t)}addOutput(t,e){if(this.hasOutput(t))throw new Error(`output with key '${String(t)}' already added`);Object.defineProperty(this.outputs,t,{value:e,enumerable:!0,configurable:!0})}removeOutput(t){delete this.outputs[t]}hasControl(t){return Object.prototype.hasOwnProperty.call(this.controls,t)}addControl(t,e){if(this.hasControl(t))throw new Error(`control with key '${String(t)}' already added`);Object.defineProperty(this.controls,t,{value:e,enumerable:!0,configurable:!0})}removeControl(t){delete this.controls[t]}},Connection:class{constructor(t,e,n,i){if(this.sourceOutput=e,this.targetInput=i,!t.outputs[e])throw new Error(`source node doesn't have output with a key ${String(e)}`);if(!n.inputs[i])throw new Error(`target node doesn't have input with a key ${String(i)}`);this.id=r(),this.source=t.id,this.target=n.id}}});t.ClassicPreset=c,t.NodeEditor=class extends i{constructor(){super("NodeEditor"),e(this,"nodes",[]),e(this,"connections",[])}getNode(t){return this.nodes.find((e=>e.id===t))}getNodes(){return this.nodes}getConnections(){return this.connections}getConnection(t){return this.connections.find((e=>e.id===t))}async addNode(t){if(this.getNode(t.id))throw new Error("node has already been added");return!!await this.emit({type:"nodecreate",data:t})&&(this.nodes.push(t),await this.emit({type:"nodecreated",data:t}),!0)}async addConnection(t){if(this.getConnection(t.id))throw new Error("connection has already been added");return!!await this.emit({type:"connectioncreate",data:t})&&(this.connections.push(t),await this.emit({type:"connectioncreated",data:t}),!0)}async removeNode(t){const e=this.nodes.findIndex((e=>e.id===t)),n=this.nodes[e];if(e<0)throw new Error("cannot find node");return!!await this.emit({type:"noderemove",data:n})&&(this.nodes.splice(e,1),await this.emit({type:"noderemoved",data:n}),!0)}async removeConnection(t){const e=this.connections.findIndex((e=>e.id===t)),n=this.connections[e];if(e<0)throw new Error("cannot find connection");return!!await this.emit({type:"connectionremove",data:n})&&(this.connections.splice(e,1),await this.emit({type:"connectionremoved",data:n}),!0)}async clear(){if(!await this.emit({type:"clear"}))return await this.emit({type:"clearcancelled"}),!1;for(const t of this.connections.slice())await this.removeConnection(t.id);for(const t of this.nodes.slice())await this.removeNode(t.id);return await this.emit({type:"cleared"}),!0}async import(t){if(!await this.emit({type:"import",data:t}))return!1;for(const e of t.nodes)await this.addNode(e);for(const e of t.connections)await this.addConnection(e);return await this.emit({type:"imported",data:t}),!0}async export(){const t={nodes:[],connections:[]};return!!await this.emit({type:"export",data:t})&&(t.nodes.push(...this.nodes),t.connections.push(...this.connections),await this.emit({type:"exported",data:t}),t)}},t.Scope=i,t.Signal=n,t.getUID=r,Object.defineProperty(t,"__esModule",{value:!0})}));
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).Rete={})}(this,(function(t){"use strict";function e(t,e,n){return(e=function(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:String(e)}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}class n{constructor(){e(this,"pipes",[])}addPipe(t){this.pipes.push(t)}async emit(t){let e=t;for(const t of this.pipes)if(e=await t(e),void 0===e)return;return e}}class i{constructor(t){e(this,"signal",new n),this.name=t}addPipe(t){this.signal.addPipe(t)}use(t){t.setParent(this),this.addPipe((e=>t.signal.emit(e)))}setParent(t){this.parent=t}emit(t){return this.signal.emit(t)}hasParent(){return Boolean(this.parent)}parentScope(t){if(!this.parent)throw new Error("cannot find parent");if(t&&this.parent instanceof t)return this.parent;if(t)throw new Error("actual parent is not instance of type");return this.parent}}const o=globalThis.crypto;function r(){if("randomBytes"in o)return o.randomBytes(8).toString("hex");const t=o.getRandomValues(new Uint8Array(8));return Array.from(t).map((t=>t.toString(16).padStart(2,"0"))).join("")}class s{constructor(t,e,n){this.socket=t,this.label=e,this.multipleConnections=n,this.id=r()}}class a{constructor(){this.id=r()}}var c=Object.freeze({__proto__:null,Socket:class{constructor(t){this.name=t}},Port:s,Input:class extends s{constructor(...t){super(...t),e(this,"control",null),e(this,"showControl",!0)}addControl(t){if(this.control)throw new Error("control already added for this input");this.control=t}removeControl(){this.control=null}},Output:class extends s{constructor(t,e,n){super(t,e,!1!==n)}},Control:a,InputControl:class extends a{constructor(t,e){super(),this.type=t,this.options=e,this.id=r(),this.readonly=null==e?void 0:e.readonly,void 0!==(null==e?void 0:e.initial)&&(this.value=e.initial)}setValue(t){var e;this.value=t,null!==(e=this.options)&&void 0!==e&&e.change&&this.options.change(t)}},Node:class{constructor(t){e(this,"inputs",{}),e(this,"outputs",{}),e(this,"controls",{}),this.label=t,this.id=r()}hasInput(t){return Object.prototype.hasOwnProperty.call(this.inputs,t)}addInput(t,e){if(this.hasInput(t))throw new Error(`input with key '${String(t)}' already added`);Object.defineProperty(this.inputs,t,{value:e,enumerable:!0,configurable:!0})}removeInput(t){delete this.inputs[t]}hasOutput(t){return Object.prototype.hasOwnProperty.call(this.outputs,t)}addOutput(t,e){if(this.hasOutput(t))throw new Error(`output with key '${String(t)}' already added`);Object.defineProperty(this.outputs,t,{value:e,enumerable:!0,configurable:!0})}removeOutput(t){delete this.outputs[t]}hasControl(t){return Object.prototype.hasOwnProperty.call(this.controls,t)}addControl(t,e){if(this.hasControl(t))throw new Error(`control with key '${String(t)}' already added`);Object.defineProperty(this.controls,t,{value:e,enumerable:!0,configurable:!0})}removeControl(t){delete this.controls[t]}},Connection:class{constructor(t,e,n,i){if(this.sourceOutput=e,this.targetInput=i,!t.outputs[e])throw new Error(`source node doesn't have output with a key ${String(e)}`);if(!n.inputs[i])throw new Error(`target node doesn't have input with a key ${String(i)}`);this.id=r(),this.source=t.id,this.target=n.id}}});t.ClassicPreset=c,t.NodeEditor=class extends i{constructor(){super("NodeEditor"),e(this,"nodes",[]),e(this,"connections",[])}getNode(t){return this.nodes.find((e=>e.id===t))}getNodes(){return this.nodes}getConnections(){return this.connections}getConnection(t){return this.connections.find((e=>e.id===t))}async addNode(t){if(this.getNode(t.id))throw new Error("node has already been added");return!!await this.emit({type:"nodecreate",data:t})&&(this.nodes.push(t),await this.emit({type:"nodecreated",data:t}),!0)}async addConnection(t){if(this.getConnection(t.id))throw new Error("connection has already been added");return!!await this.emit({type:"connectioncreate",data:t})&&(this.connections.push(t),await this.emit({type:"connectioncreated",data:t}),!0)}async removeNode(t){const e=this.nodes.findIndex((e=>e.id===t)),n=this.nodes[e];if(e<0)throw new Error("cannot find node");return!!await this.emit({type:"noderemove",data:n})&&(this.nodes.splice(e,1),await this.emit({type:"noderemoved",data:n}),!0)}async removeConnection(t){const e=this.connections.findIndex((e=>e.id===t)),n=this.connections[e];if(e<0)throw new Error("cannot find connection");return!!await this.emit({type:"connectionremove",data:n})&&(this.connections.splice(e,1),await this.emit({type:"connectionremoved",data:n}),!0)}async clear(){if(!await this.emit({type:"clear"}))return await this.emit({type:"clearcancelled"}),!1;for(const t of this.connections.slice())await this.removeConnection(t.id);for(const t of this.nodes.slice())await this.removeNode(t.id);return await this.emit({type:"cleared"}),!0}async import(t){if(!await this.emit({type:"import",data:t}))return!1;for(const e of t.nodes)await this.addNode(e);for(const e of t.connections)await this.addConnection(e);return await this.emit({type:"imported",data:t}),!0}async export(){const t={nodes:[],connections:[]};return!!await this.emit({type:"export",data:t})&&(t.nodes.push(...this.nodes),t.connections.push(...this.connections),await this.emit({type:"exported",data:t}),t)}},t.Scope=i,t.Signal=n,t.getUID=r,Object.defineProperty(t,"__esModule",{value:!0})}));
//# sourceMappingURL=rete.min.js.map

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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