@nodegx/preview 0.2.3 → 0.2.4

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.
@@ -27042,6 +27042,35 @@ var require_simplejavascript = __commonJS({
27042
27042
  }
27043
27043
  return users;
27044
27044
  }
27045
+ function placingSignalPorts(node) {
27046
+ const saved = node.model.outputPorts;
27047
+ const params = node.model.parameters || {};
27048
+ const names = [];
27049
+ for (const key in saved) {
27050
+ if (saved[key] && saved[key].type === "signal") names.push(key);
27051
+ }
27052
+ const declare = (key) => {
27053
+ if (!(key in saved) && names.indexOf(key) === -1) names.push(key);
27054
+ };
27055
+ const listed = [];
27056
+ const scriptOutputs = params["scriptOutputs"];
27057
+ if (Array.isArray(scriptOutputs)) {
27058
+ scriptOutputs.forEach((p) => {
27059
+ listed.push("out-" + p.label);
27060
+ if (params["outtype-" + p.label] === "signal") declare("out-" + p.label);
27061
+ });
27062
+ }
27063
+ const script = params["functionScript"];
27064
+ if (typeof script === "string") {
27065
+ const cached = node._internal.codeSignals;
27066
+ const signals = cached && cached.script === script ? cached.names : functionScriptPortNames(script).signals;
27067
+ node._internal.codeSignals = { script, names: signals };
27068
+ signals.forEach((n) => {
27069
+ if (listed.indexOf("out-" + n) === -1) declare("out-" + n);
27070
+ });
27071
+ }
27072
+ return names;
27073
+ }
27045
27074
  function publishHeldWrites(node) {
27046
27075
  node._internal.heldWrites.forEach((prop) => {
27047
27076
  node.registerOutputIfNeeded("out-" + prop);
@@ -27314,18 +27343,16 @@ var require_simplejavascript = __commonJS({
27314
27343
  }
27315
27344
  const inputs = this._internal.inputValues;
27316
27345
  const outputs = this._internal.outputValuesProxy;
27317
- for (const key in this.model.outputPorts) {
27318
- if (this._isSignalType(key)) {
27319
- const _sendSignal = () => {
27320
- this._internal.outputWrites.add(key.substring("out-".length));
27321
- publishHeldWrites(this);
27322
- if (this.hasOutput(key)) this.sendSignalOnOutput(key);
27323
- };
27324
- const signalValue = _sendSignal;
27325
- signalValue.send = _sendSignal;
27326
- this._internal.outputValues[key.substring("out-".length)] = signalValue;
27327
- }
27328
- }
27346
+ placingSignalPorts(this).forEach((key) => {
27347
+ const _sendSignal = () => {
27348
+ this._internal.outputWrites.add(key.substring("out-".length));
27349
+ publishHeldWrites(this);
27350
+ if (this.hasOutput(key)) this.sendSignalOnOutput(key);
27351
+ };
27352
+ const signalValue = _sendSignal;
27353
+ signalValue.send = _sendSignal;
27354
+ this._internal.outputValues[key.substring("out-".length)] = signalValue;
27355
+ });
27329
27356
  const noodlAPI = JavascriptNodeParser4.createNoodlAPI(this.nodeScope.modelScope);
27330
27357
  noodlAPI.Inputs = inputs;
27331
27358
  noodlAPI.Outputs = outputs;
@@ -27042,6 +27042,35 @@ var require_simplejavascript = __commonJS({
27042
27042
  }
27043
27043
  return users;
27044
27044
  }
27045
+ function placingSignalPorts(node) {
27046
+ const saved = node.model.outputPorts;
27047
+ const params = node.model.parameters || {};
27048
+ const names = [];
27049
+ for (const key in saved) {
27050
+ if (saved[key] && saved[key].type === "signal") names.push(key);
27051
+ }
27052
+ const declare = (key) => {
27053
+ if (!(key in saved) && names.indexOf(key) === -1) names.push(key);
27054
+ };
27055
+ const listed = [];
27056
+ const scriptOutputs = params["scriptOutputs"];
27057
+ if (Array.isArray(scriptOutputs)) {
27058
+ scriptOutputs.forEach((p) => {
27059
+ listed.push("out-" + p.label);
27060
+ if (params["outtype-" + p.label] === "signal") declare("out-" + p.label);
27061
+ });
27062
+ }
27063
+ const script = params["functionScript"];
27064
+ if (typeof script === "string") {
27065
+ const cached = node._internal.codeSignals;
27066
+ const signals = cached && cached.script === script ? cached.names : functionScriptPortNames(script).signals;
27067
+ node._internal.codeSignals = { script, names: signals };
27068
+ signals.forEach((n) => {
27069
+ if (listed.indexOf("out-" + n) === -1) declare("out-" + n);
27070
+ });
27071
+ }
27072
+ return names;
27073
+ }
27045
27074
  function publishHeldWrites(node) {
27046
27075
  node._internal.heldWrites.forEach((prop) => {
27047
27076
  node.registerOutputIfNeeded("out-" + prop);
@@ -27314,18 +27343,16 @@ var require_simplejavascript = __commonJS({
27314
27343
  }
27315
27344
  const inputs = this._internal.inputValues;
27316
27345
  const outputs = this._internal.outputValuesProxy;
27317
- for (const key in this.model.outputPorts) {
27318
- if (this._isSignalType(key)) {
27319
- const _sendSignal = () => {
27320
- this._internal.outputWrites.add(key.substring("out-".length));
27321
- publishHeldWrites(this);
27322
- if (this.hasOutput(key)) this.sendSignalOnOutput(key);
27323
- };
27324
- const signalValue = _sendSignal;
27325
- signalValue.send = _sendSignal;
27326
- this._internal.outputValues[key.substring("out-".length)] = signalValue;
27327
- }
27328
- }
27346
+ placingSignalPorts(this).forEach((key) => {
27347
+ const _sendSignal = () => {
27348
+ this._internal.outputWrites.add(key.substring("out-".length));
27349
+ publishHeldWrites(this);
27350
+ if (this.hasOutput(key)) this.sendSignalOnOutput(key);
27351
+ };
27352
+ const signalValue = _sendSignal;
27353
+ signalValue.send = _sendSignal;
27354
+ this._internal.outputValues[key.substring("out-".length)] = signalValue;
27355
+ });
27329
27356
  const noodlAPI = JavascriptNodeParser4.createNoodlAPI(this.nodeScope.modelScope);
27330
27357
  noodlAPI.Inputs = inputs;
27331
27358
  noodlAPI.Outputs = outputs;
@@ -112024,7 +112051,7 @@ var require_package = __commonJS({
112024
112051
  "package.json"(exports2, module2) {
112025
112052
  module2.exports = {
112026
112053
  name: "@nodegx/preview",
112027
- version: "0.2.3",
112054
+ version: "0.2.4",
112028
112055
  description: "Standalone live-preview harness: renders a NodeGX (OpenNoodl) v2 project in a browser with no editor process, and reloads it when the files on disk change.",
112029
112056
  license: "GPL-3.0-only",
112030
112057
  homepage: "https://nodegx.io",
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nodegx/preview",
3
- "version": "0.2.3",
3
+ "version": "0.2.4",
4
4
  "private": true,
5
5
  "description": "Build metadata for the bundled CLIs. See build.mjs — @noodl/platform reads it."
6
6
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nodegx/preview",
3
- "version": "0.2.3",
3
+ "version": "0.2.4",
4
4
  "description": "Standalone live-preview harness: renders a NodeGX (OpenNoodl) v2 project in a browser with no editor process, and reloads it when the files on disk change.",
5
5
  "license": "GPL-3.0-only",
6
6
  "homepage": "https://nodegx.io",