@metapages/metapage 1.8.21 → 1.8.23
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.
- package/dist/index.js +80 -69
- package/dist/index.js.map +1 -1
- package/dist/metapage/Metapage.d.ts +4 -1
- package/dist/metapage/Metapage.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/metapage/Metapage.ts +19 -4
package/dist/index.js
CHANGED
|
@@ -75,18 +75,18 @@ var Wt = { exports: {} };
|
|
|
75
75
|
else if (typeof v == "function")
|
|
76
76
|
try {
|
|
77
77
|
return Promise.resolve(v(b, null, E)).then(function(O) {
|
|
78
|
-
O ?
|
|
78
|
+
O ? x(b, null, E) : m(E);
|
|
79
79
|
}).catch(S);
|
|
80
80
|
} catch (O) {
|
|
81
81
|
S(O);
|
|
82
82
|
}
|
|
83
83
|
else
|
|
84
|
-
b < d ?
|
|
84
|
+
b < d ? x(b, null, E) : m(E);
|
|
85
85
|
}).catch(function(E) {
|
|
86
86
|
if (typeof v == "function")
|
|
87
87
|
try {
|
|
88
88
|
Promise.resolve(v(b, E, null)).then(function(O) {
|
|
89
|
-
O ?
|
|
89
|
+
O ? x(b, E, null) : S(E);
|
|
90
90
|
}).catch(function(O) {
|
|
91
91
|
S(O);
|
|
92
92
|
});
|
|
@@ -94,10 +94,10 @@ var Wt = { exports: {} };
|
|
|
94
94
|
S(O);
|
|
95
95
|
}
|
|
96
96
|
else
|
|
97
|
-
b < d ?
|
|
97
|
+
b < d ? x(b, E, null) : S(E);
|
|
98
98
|
});
|
|
99
99
|
};
|
|
100
|
-
function
|
|
100
|
+
function x(b, A, E) {
|
|
101
101
|
var O = typeof _ == "function" ? _(b, A, E) : _;
|
|
102
102
|
setTimeout(function() {
|
|
103
103
|
w(++b);
|
|
@@ -786,10 +786,10 @@ function vt(t) {
|
|
|
786
786
|
var v, m;
|
|
787
787
|
const S = P(u);
|
|
788
788
|
let w = c.type === 3 ? c.setMap : c.copy;
|
|
789
|
-
const
|
|
789
|
+
const x = pe(w, n), b = P(x);
|
|
790
790
|
if (b) {
|
|
791
791
|
let A = b.original;
|
|
792
|
-
b.operated && (A = _t(
|
|
792
|
+
b.operated && (A = _t(x)), at(b), ut(b, $e, d, _), c.options.enableAutoFreeze && (c.options.updatedValues = (v = c.options.updatedValues) !== null && v !== void 0 ? v : /* @__PURE__ */ new WeakMap(), c.options.updatedValues.set(A, b.original)), Te(w, n, A);
|
|
793
793
|
}
|
|
794
794
|
(m = S.callbacks) === null || m === void 0 || m.forEach((A) => {
|
|
795
795
|
A(d, _);
|
|
@@ -918,22 +918,22 @@ const Js = (t) => {
|
|
|
918
918
|
};
|
|
919
919
|
if (!ne(d, w) && typeof d == "object" && d !== null)
|
|
920
920
|
throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");
|
|
921
|
-
const [
|
|
921
|
+
const [x, b] = zs(d, w);
|
|
922
922
|
if (typeof n != "function") {
|
|
923
923
|
if (!ne(d, w))
|
|
924
924
|
throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");
|
|
925
|
-
return [
|
|
925
|
+
return [x, b];
|
|
926
926
|
}
|
|
927
927
|
let A;
|
|
928
928
|
try {
|
|
929
|
-
A = l(
|
|
929
|
+
A = l(x);
|
|
930
930
|
} catch (O) {
|
|
931
|
-
throw ot(P(
|
|
931
|
+
throw ot(P(x)), O;
|
|
932
932
|
}
|
|
933
933
|
const E = (O) => {
|
|
934
|
-
const H = P(
|
|
934
|
+
const H = P(x);
|
|
935
935
|
if (!be(O)) {
|
|
936
|
-
if (O !== void 0 && !fe(O,
|
|
936
|
+
if (O !== void 0 && !fe(O, x) && (H != null && H.operated))
|
|
937
937
|
throw new Error("Either the value is returned as a new non-draft value, or only the draft is modified without returning any value.");
|
|
938
938
|
const L = O == null ? void 0 : O[xs];
|
|
939
939
|
if (L) {
|
|
@@ -947,7 +947,7 @@ const Js = (t) => {
|
|
|
947
947
|
if (O !== void 0)
|
|
948
948
|
return typeof O == "object" && O !== null && ft({ rootDraft: H, value: O }), b([O]);
|
|
949
949
|
}
|
|
950
|
-
if (O ===
|
|
950
|
+
if (O === x || O === void 0)
|
|
951
951
|
return b([]);
|
|
952
952
|
const R = P(O);
|
|
953
953
|
if (w === R.options) {
|
|
@@ -958,7 +958,7 @@ const Js = (t) => {
|
|
|
958
958
|
return b([O]);
|
|
959
959
|
};
|
|
960
960
|
return A instanceof Promise ? A.then(E, (O) => {
|
|
961
|
-
throw ot(P(
|
|
961
|
+
throw ot(P(x)), O;
|
|
962
962
|
}) : E(A);
|
|
963
963
|
};
|
|
964
964
|
}, C = Js();
|
|
@@ -1326,10 +1326,10 @@ const Ke = async (t) => C(t, async (e) => {
|
|
|
1326
1326
|
} catch {
|
|
1327
1327
|
}
|
|
1328
1328
|
};
|
|
1329
|
-
var
|
|
1329
|
+
var $;
|
|
1330
1330
|
(function(t) {
|
|
1331
1331
|
t.Inputs = "inputs", t.Outputs = "outputs", t.State = "state", t.Definition = "definition", t.Error = "error", t.Warning = "warning", t.UrlHashUpdate = "urlhashupdate", t.Message = "Message";
|
|
1332
|
-
})(
|
|
1332
|
+
})($ || ($ = {}));
|
|
1333
1333
|
var X;
|
|
1334
1334
|
(function(t) {
|
|
1335
1335
|
t.InputsUpdate = "InputsUpdate", t.OutputsUpdate = "OutputsUpdate", t.SetupIframeClientRequest = "SetupIframeClientRequest", t.SetupIframeServerResponseAck = "SetupIframeServerResponseAck", t.HashParamsUpdate = "HashParamsUpdate";
|
|
@@ -1395,9 +1395,9 @@ var is = { exports: {} };
|
|
|
1395
1395
|
var S = s ? s + l : l;
|
|
1396
1396
|
if (!this._events[S])
|
|
1397
1397
|
return !1;
|
|
1398
|
-
var w = this._events[S],
|
|
1398
|
+
var w = this._events[S], x = arguments.length, b, A;
|
|
1399
1399
|
if (w.fn) {
|
|
1400
|
-
switch (w.once && this.removeListener(l, w.fn, void 0, !0),
|
|
1400
|
+
switch (w.once && this.removeListener(l, w.fn, void 0, !0), x) {
|
|
1401
1401
|
case 1:
|
|
1402
1402
|
return w.fn.call(w.context), !0;
|
|
1403
1403
|
case 2:
|
|
@@ -1411,13 +1411,13 @@ var is = { exports: {} };
|
|
|
1411
1411
|
case 6:
|
|
1412
1412
|
return w.fn.call(w.context, c, d, _, v, m), !0;
|
|
1413
1413
|
}
|
|
1414
|
-
for (A = 1, b = new Array(
|
|
1414
|
+
for (A = 1, b = new Array(x - 1); A < x; A++)
|
|
1415
1415
|
b[A - 1] = arguments[A];
|
|
1416
1416
|
w.fn.apply(w.context, b);
|
|
1417
1417
|
} else {
|
|
1418
1418
|
var E = w.length, O;
|
|
1419
1419
|
for (A = 0; A < E; A++)
|
|
1420
|
-
switch (w[A].once && this.removeListener(l, w[A].fn, void 0, !0),
|
|
1420
|
+
switch (w[A].once && this.removeListener(l, w[A].fn, void 0, !0), x) {
|
|
1421
1421
|
case 1:
|
|
1422
1422
|
w[A].fn.call(w[A].context);
|
|
1423
1423
|
break;
|
|
@@ -1432,7 +1432,7 @@ var is = { exports: {} };
|
|
|
1432
1432
|
break;
|
|
1433
1433
|
default:
|
|
1434
1434
|
if (!b)
|
|
1435
|
-
for (O = 1, b = new Array(
|
|
1435
|
+
for (O = 1, b = new Array(x - 1); O < x; O++)
|
|
1436
1436
|
b[O - 1] = arguments[O];
|
|
1437
1437
|
w[A].fn.apply(w[A].context, b);
|
|
1438
1438
|
}
|
|
@@ -1452,7 +1452,7 @@ var is = { exports: {} };
|
|
|
1452
1452
|
if (m.fn)
|
|
1453
1453
|
m.fn === c && (!_ || m.once) && (!d || m.context === d) && r(this, v);
|
|
1454
1454
|
else {
|
|
1455
|
-
for (var S = 0, w = [],
|
|
1455
|
+
for (var S = 0, w = [], x = m.length; S < x; S++)
|
|
1456
1456
|
(m[S].fn !== c || _ && !m[S].once || d && m[S].context !== d) && w.push(m[S]);
|
|
1457
1457
|
w.length ? this._events[v] = w.length === 1 ? w[0] : w : r(this, v);
|
|
1458
1458
|
}
|
|
@@ -2149,16 +2149,16 @@ const Ut = qe, {
|
|
|
2149
2149
|
t.isPrefix !== !0 && (t.depth = t.isGlobstar ? 1 / 0 : 1);
|
|
2150
2150
|
}, oi = (t, e) => {
|
|
2151
2151
|
const s = e || {}, n = t.length - 1, i = s.parts === !0 || s.scanToEnd === !0, o = [], r = [], a = [];
|
|
2152
|
-
let u = t, l = -1, c = 0, d = 0, _ = !1, v = !1, m = !1, S = !1, w = !1,
|
|
2152
|
+
let u = t, l = -1, c = 0, d = 0, _ = !1, v = !1, m = !1, S = !1, w = !1, x = !1, b = !1, A = !1, E = !1, O = 0, H, R, L = { value: "", depth: 0, isGlob: !1 };
|
|
2153
2153
|
const U = () => l >= n, f = () => u.charCodeAt(l + 1), M = () => (H = R, u.charCodeAt(++l));
|
|
2154
2154
|
for (; l < n; ) {
|
|
2155
2155
|
R = M();
|
|
2156
2156
|
let W;
|
|
2157
2157
|
if (R === Me) {
|
|
2158
|
-
b = L.backslashes = !0, R = M(), R === it && (
|
|
2158
|
+
b = L.backslashes = !0, R = M(), R === it && (x = !0);
|
|
2159
2159
|
continue;
|
|
2160
2160
|
}
|
|
2161
|
-
if (
|
|
2161
|
+
if (x === !0 || R === it) {
|
|
2162
2162
|
for (O++; U() !== !0 && (R = M()); ) {
|
|
2163
2163
|
if (R === Me) {
|
|
2164
2164
|
b = L.backslashes = !0, M();
|
|
@@ -2168,18 +2168,18 @@ const Ut = qe, {
|
|
|
2168
2168
|
O++;
|
|
2169
2169
|
continue;
|
|
2170
2170
|
}
|
|
2171
|
-
if (
|
|
2171
|
+
if (x !== !0 && R === nt && (R = M()) === nt) {
|
|
2172
2172
|
if (_ = L.isBrace = !0, m = L.isGlob = !0, E = !0, i === !0)
|
|
2173
2173
|
continue;
|
|
2174
2174
|
break;
|
|
2175
2175
|
}
|
|
2176
|
-
if (
|
|
2176
|
+
if (x !== !0 && R === ti) {
|
|
2177
2177
|
if (_ = L.isBrace = !0, m = L.isGlob = !0, E = !0, i === !0)
|
|
2178
2178
|
continue;
|
|
2179
2179
|
break;
|
|
2180
2180
|
}
|
|
2181
2181
|
if (R === ii && (O--, O === 0)) {
|
|
2182
|
-
|
|
2182
|
+
x = !1, _ = L.isBrace = !0, E = !0;
|
|
2183
2183
|
break;
|
|
2184
2184
|
}
|
|
2185
2185
|
}
|
|
@@ -2325,7 +2325,7 @@ const Ge = Ye, se = qe, {
|
|
|
2325
2325
|
DOTS_SLASH: m,
|
|
2326
2326
|
NO_DOT: S,
|
|
2327
2327
|
NO_DOT_SLASH: w,
|
|
2328
|
-
NO_DOTS_SLASH:
|
|
2328
|
+
NO_DOTS_SLASH: x,
|
|
2329
2329
|
QMARK: b,
|
|
2330
2330
|
QMARK_NO_DOT: A,
|
|
2331
2331
|
STAR: E,
|
|
@@ -2666,7 +2666,7 @@ const Ge = Ye, se = qe, {
|
|
|
2666
2666
|
N.output = p, T(N);
|
|
2667
2667
|
continue;
|
|
2668
2668
|
}
|
|
2669
|
-
(f.index === f.start || h.type === "slash" || h.type === "dot") && (h.type === "dot" ? (f.output += w, h.output += w) : s.dot === !0 ? (f.output +=
|
|
2669
|
+
(f.index === f.start || h.type === "slash" || h.type === "dot") && (h.type === "dot" ? (f.output += w, h.output += w) : s.dot === !0 ? (f.output += x, h.output += x) : (f.output += R, h.output += R), k() !== "*" && (f.output += v, h.output += v)), T(N);
|
|
2670
2670
|
}
|
|
2671
2671
|
for (; f.brackets > 0; ) {
|
|
2672
2672
|
if (s.strictBrackets === !0)
|
|
@@ -2705,7 +2705,7 @@ bs.fastpaths = (t, e) => {
|
|
|
2705
2705
|
NO_DOTS_SLASH: d,
|
|
2706
2706
|
STAR: _,
|
|
2707
2707
|
START_ANCHOR: v
|
|
2708
|
-
} = Ge.globChars(s.windows), m = s.dot ? c : l, S = s.dot ? d : l, w = s.capture ? "" : "?:",
|
|
2708
|
+
} = Ge.globChars(s.windows), m = s.dot ? c : l, S = s.dot ? d : l, w = s.capture ? "" : "?:", x = { negated: !1, prefix: "" };
|
|
2709
2709
|
let b = s.bash === !0 ? ".*?" : _;
|
|
2710
2710
|
s.capture && (b = `(${b})`);
|
|
2711
2711
|
const A = (R) => R.noglobstar === !0 ? b : `(${w}(?:(?!${v}${R.dot ? u : o}).)*?)`, E = (R) => {
|
|
@@ -2734,7 +2734,7 @@ bs.fastpaths = (t, e) => {
|
|
|
2734
2734
|
return U ? U + o + L[2] : void 0;
|
|
2735
2735
|
}
|
|
2736
2736
|
}
|
|
2737
|
-
}, O = se.removePrefix(t,
|
|
2737
|
+
}, O = se.removePrefix(t, x);
|
|
2738
2738
|
let H = E(O);
|
|
2739
2739
|
return H && s.strictSlashes !== !0 && (H += `${r}?`), H;
|
|
2740
2740
|
};
|
|
@@ -2906,7 +2906,7 @@ class vi extends Ot.EventEmitter {
|
|
|
2906
2906
|
return this._definition = s, this._definition;
|
|
2907
2907
|
} catch (s) {
|
|
2908
2908
|
var e = this.getDefinitionUrl();
|
|
2909
|
-
this.emit(
|
|
2909
|
+
this.emit($.Warning, `Failed to fetch or convert: ${e}
|
|
2910
2910
|
Error: ${s != null && s.message ? s == null ? void 0 : s.message : s == null ? void 0 : s.toString()}`);
|
|
2911
2911
|
}
|
|
2912
2912
|
}
|
|
@@ -2920,9 +2920,9 @@ Error: ${s != null && s.message ? s == null ? void 0 : s.message : s == null ? v
|
|
|
2920
2920
|
const s = e;
|
|
2921
2921
|
if (this.inputs = Je(this.inputs, e), this.inputs === s)
|
|
2922
2922
|
return this;
|
|
2923
|
-
if (this._loaded || (this._sendInputsAfterRegistration = !0), this._iframe.parentNode && this._loaded && this.sendInputs(e), this.emit(
|
|
2923
|
+
if (this._loaded || (this._sendInputsAfterRegistration = !0), this._iframe.parentNode && this._loaded && this.sendInputs(e), this.emit($.Inputs, this.inputs), this._metapage.listenerCount($.Inputs) > 0) {
|
|
2924
2924
|
var n = {};
|
|
2925
|
-
n[this.id] = e, this._metapage.emit(
|
|
2925
|
+
n[this.id] = e, this._metapage.emit($.Inputs, n);
|
|
2926
2926
|
}
|
|
2927
2927
|
return this;
|
|
2928
2928
|
}
|
|
@@ -2935,28 +2935,28 @@ Error: ${s != null && s.message ? s == null ? void 0 : s.message : s == null ? v
|
|
|
2935
2935
|
const s = e;
|
|
2936
2936
|
if (this.outputs = Je(this.outputs, e), this.outputs === s)
|
|
2937
2937
|
return this;
|
|
2938
|
-
if (this.emit(
|
|
2938
|
+
if (this.emit($.Outputs, e), this._metapage.listenerCount($.Outputs) > 0) {
|
|
2939
2939
|
var n = {};
|
|
2940
|
-
n[this.id] = this.outputs, this._metapage.emit(
|
|
2940
|
+
n[this.id] = this.outputs, this._metapage.emit($.Outputs, n);
|
|
2941
2941
|
}
|
|
2942
2942
|
}
|
|
2943
2943
|
onInputs(e) {
|
|
2944
|
-
return this.addListenerReturnDisposer(
|
|
2944
|
+
return this.addListenerReturnDisposer($.Inputs, e);
|
|
2945
2945
|
}
|
|
2946
2946
|
onInput(e, s) {
|
|
2947
2947
|
var n = function(i) {
|
|
2948
2948
|
i.hasOwnProperty(e) && s(i[e]);
|
|
2949
2949
|
};
|
|
2950
|
-
return this.addListenerReturnDisposer(
|
|
2950
|
+
return this.addListenerReturnDisposer($.Inputs, n);
|
|
2951
2951
|
}
|
|
2952
2952
|
onOutputs(e) {
|
|
2953
|
-
return this.addListenerReturnDisposer(
|
|
2953
|
+
return this.addListenerReturnDisposer($.Outputs, e);
|
|
2954
2954
|
}
|
|
2955
2955
|
onOutput(e, s) {
|
|
2956
2956
|
var n = function(i) {
|
|
2957
2957
|
i.hasOwnProperty(e) && s(i[e]);
|
|
2958
2958
|
};
|
|
2959
|
-
return this.addListenerReturnDisposer(
|
|
2959
|
+
return this.addListenerReturnDisposer($.Outputs, n);
|
|
2960
2960
|
}
|
|
2961
2961
|
isDisposed() {
|
|
2962
2962
|
return this.inputs === void 0;
|
|
@@ -3067,7 +3067,7 @@ class ee extends Nn {
|
|
|
3067
3067
|
return n.setDefinition(e);
|
|
3068
3068
|
}
|
|
3069
3069
|
constructor(e) {
|
|
3070
|
-
super(), this._state = ge, this._metaframes = C({}, (s) => s), this.debug = ht(), this._internalReceivedMessageCounter = 0, this._cachedInputLookupMap = C({}, (s) => s), this._inputMap = {}, this._id = e && e.id ? e.id : jn(), this._consoleBackgroundColor = e && e.color ? e.color : Ri, this.addPipe = this.addPipe.bind(this), this.dispose = this.dispose.bind(this), this.addMetaframe = this.addMetaframe.bind(this), this.getInputsFromOutput = this.getInputsFromOutput.bind(this), this.getMetaframe = this.getMetaframe.bind(this), this.getMetaframeIds = this.getMetaframeIds.bind(this), this.getMetaframe = this.getMetaframe.bind(this), this.getMetaframes = this.getMetaframes.bind(this), this.getState = this.getState.bind(this), this.getStateMetaframes = this.getStateMetaframes.bind(this), this.isValidJSONRpcMessage = this.isValidJSONRpcMessage.bind(this), this.log = this.log.bind(this), this.logInternal = this.logInternal.bind(this), this.metaframeIds = this.metaframeIds.bind(this), this.metaframes = this.metaframes.bind(this), this.onMessage = this.onMessage.bind(this), this.onMessageJsonRpc = this.onMessageJsonRpc.bind(this), this.removeAll = this.removeAll.bind(this), this.removeMetaframe = this.removeMetaframe.bind(this), this.setDebugFromUrlParams = this.setDebugFromUrlParams.bind(this), this.setDefinition = this.setDefinition.bind(this), this.setInput = this.setInput.bind(this), this.setInputs = this.setInputs.bind(this), this.setOutputs = this.setOutputs.bind(this), this.setMetaframeOutputs = this.setMetaframeOutputs.bind(this), this.setInputStateOnlyMetaframeInputValue = this.setInputStateOnlyMetaframeInputValue.bind(this), this.setInputStateOnlyMetaframeInputMap = this.setInputStateOnlyMetaframeInputMap.bind(this), this.setInputStateOnlyMetapageInstanceInputs = this.setInputStateOnlyMetapageInstanceInputs.bind(this), this.setOutputStateOnlyMetaframeInputValue = this.setOutputStateOnlyMetaframeInputValue.bind(this), this.setOutputStateOnlyMetaframeInputMap = this.setOutputStateOnlyMetaframeInputMap.bind(this), this.setOutputStateOnlyMetapageInstanceInputs = this.setOutputStateOnlyMetapageInstanceInputs.bind(this), this.setMetadata = this.setMetadata.bind(this), this.setMetaframeClientInputAndSentClientEvent = this.setMetaframeClientInputAndSentClientEvent.bind(this), this.setState = this.setState.bind(this), this.isDisposed = this.isDisposed.bind(this), this._emitDefinitionEvent = this._emitDefinitionEvent.bind(this), Xe().then(() => {
|
|
3070
|
+
super(), this._state = ge, this._metaframes = C({}, (s) => s), this.debug = ht(), this._internalReceivedMessageCounter = 0, this._cachedInputLookupMap = C({}, (s) => s), this._inputMap = {}, this._id = e && e.id ? e.id : jn(), this._consoleBackgroundColor = e && e.color ? e.color : Ri, this.addPipe = this.addPipe.bind(this), this.dispose = this.dispose.bind(this), this.addMetaframe = this.addMetaframe.bind(this), this.getInputsFromOutput = this.getInputsFromOutput.bind(this), this.getMetaframe = this.getMetaframe.bind(this), this.getMetaframeIds = this.getMetaframeIds.bind(this), this.getMetaframe = this.getMetaframe.bind(this), this.getMetaframes = this.getMetaframes.bind(this), this.getState = this.getState.bind(this), this.getStateMetaframes = this.getStateMetaframes.bind(this), this.isValidJSONRpcMessage = this.isValidJSONRpcMessage.bind(this), this.log = this.log.bind(this), this.logInternal = this.logInternal.bind(this), this.metaframeIds = this.metaframeIds.bind(this), this.metaframes = this.metaframes.bind(this), this.onMessage = this.onMessage.bind(this), this.onMessageJsonRpc = this.onMessageJsonRpc.bind(this), this.removeAll = this.removeAll.bind(this), this.removeMetaframe = this.removeMetaframe.bind(this), this.setDebugFromUrlParams = this.setDebugFromUrlParams.bind(this), this.setDefinition = this.setDefinition.bind(this), this.setInput = this.setInput.bind(this), this.setInputs = this.setInputs.bind(this), this.setOutputs = this.setOutputs.bind(this), this.onInputs = this.onInputs.bind(this), this.onOutputs = this.onOutputs.bind(this), this.onState = this.onState.bind(this), this.setMetaframeOutputs = this.setMetaframeOutputs.bind(this), this.setInputStateOnlyMetaframeInputValue = this.setInputStateOnlyMetaframeInputValue.bind(this), this.setInputStateOnlyMetaframeInputMap = this.setInputStateOnlyMetaframeInputMap.bind(this), this.setInputStateOnlyMetapageInstanceInputs = this.setInputStateOnlyMetapageInstanceInputs.bind(this), this.setOutputStateOnlyMetaframeInputValue = this.setOutputStateOnlyMetaframeInputValue.bind(this), this.setOutputStateOnlyMetaframeInputMap = this.setOutputStateOnlyMetaframeInputMap.bind(this), this.setOutputStateOnlyMetapageInstanceInputs = this.setOutputStateOnlyMetapageInstanceInputs.bind(this), this.setMetadata = this.setMetadata.bind(this), this.setMetaframeClientInputAndSentClientEvent = this.setMetaframeClientInputAndSentClientEvent.bind(this), this.setState = this.setState.bind(this), this.isDisposed = this.isDisposed.bind(this), this._emitDefinitionEvent = this._emitDefinitionEvent.bind(this), Xe().then(() => {
|
|
3071
3071
|
this.isDisposed() || (window.addEventListener("message", this.onMessage), this.log("Initialized"));
|
|
3072
3072
|
});
|
|
3073
3073
|
}
|
|
@@ -3079,6 +3079,15 @@ class ee extends Nn {
|
|
|
3079
3079
|
super.removeListener(e, s);
|
|
3080
3080
|
};
|
|
3081
3081
|
}
|
|
3082
|
+
onInputs(e) {
|
|
3083
|
+
return this.addListenerReturnDisposer($.Inputs, e);
|
|
3084
|
+
}
|
|
3085
|
+
onOutputs(e) {
|
|
3086
|
+
return this.addListenerReturnDisposer($.Outputs, e);
|
|
3087
|
+
}
|
|
3088
|
+
onState(e) {
|
|
3089
|
+
return this.addListenerReturnDisposer($.State, e);
|
|
3090
|
+
}
|
|
3082
3091
|
setDebugFromUrlParams() {
|
|
3083
3092
|
const e = new URL(window.location.href);
|
|
3084
3093
|
return this.debug = ["debug", "mp_debug"].reduce((s, n) => s || e.searchParams.get(n) === "true" || e.searchParams.get(n) === "1", !1), this;
|
|
@@ -3088,8 +3097,9 @@ class ee extends Nn {
|
|
|
3088
3097
|
}
|
|
3089
3098
|
setState(e) {
|
|
3090
3099
|
this._state = C(e, (s) => s), this.getMetaframeIds().forEach((s) => {
|
|
3091
|
-
|
|
3092
|
-
|
|
3100
|
+
var n, i;
|
|
3101
|
+
(n = this.getMetaframe(s)) == null || n.setInputs(this._state.metaframes.inputs[s]), (i = this.getMetaframe(s)) == null || i.setOutputs(this._state.metaframes.outputs[s]);
|
|
3102
|
+
}), this.listenerCount($.State) > 0 && ge !== this._state && this.emit($.State, this._state);
|
|
3093
3103
|
}
|
|
3094
3104
|
getStateMetaframes() {
|
|
3095
3105
|
return this._state.metaframes;
|
|
@@ -3119,7 +3129,7 @@ class ee extends Nn {
|
|
|
3119
3129
|
this.addMetaframe(o, r);
|
|
3120
3130
|
}
|
|
3121
3131
|
}), i !== fs && window.setTimeout(() => {
|
|
3122
|
-
!this.isDisposed() && n === this._definition && (this._emitDefinitionEvent(), s && this.listenerCount(
|
|
3132
|
+
!this.isDisposed() && n === this._definition && (this._emitDefinitionEvent(), s && this.listenerCount($.State) > 0 && ge !== this._state && this.emit($.State, this._state));
|
|
3123
3133
|
}, 0), this;
|
|
3124
3134
|
}
|
|
3125
3135
|
setMetadata(e) {
|
|
@@ -3128,12 +3138,12 @@ class ee extends Nn {
|
|
|
3128
3138
|
}), this._emitDefinitionEvent();
|
|
3129
3139
|
}
|
|
3130
3140
|
_emitDefinitionEvent() {
|
|
3131
|
-
if (this.listenerCount(
|
|
3141
|
+
if (this.listenerCount($.Definition) > 0) {
|
|
3132
3142
|
const e = {
|
|
3133
3143
|
definition: this._definition,
|
|
3134
3144
|
metaframes: this._metaframes
|
|
3135
3145
|
};
|
|
3136
|
-
this.emit(
|
|
3146
|
+
this.emit($.Definition, e);
|
|
3137
3147
|
}
|
|
3138
3148
|
}
|
|
3139
3149
|
addPipe(e, s) {
|
|
@@ -3171,7 +3181,8 @@ class ee extends Nn {
|
|
|
3171
3181
|
return this._metaframes;
|
|
3172
3182
|
}
|
|
3173
3183
|
getMetaframe(e) {
|
|
3174
|
-
|
|
3184
|
+
var s;
|
|
3185
|
+
return (s = this == null ? void 0 : this._metaframes) == null ? void 0 : s[e];
|
|
3175
3186
|
}
|
|
3176
3187
|
addMetaframe(e, s) {
|
|
3177
3188
|
if (!e)
|
|
@@ -3185,8 +3196,8 @@ class ee extends Nn {
|
|
|
3185
3196
|
var n = new vi(this, s.url, e, this._id, this._consoleBackgroundColor, this.debug).setMetapage(this);
|
|
3186
3197
|
return this._metaframes = C(this._metaframes, (i) => {
|
|
3187
3198
|
i[e] = n;
|
|
3188
|
-
}), n.addListener(
|
|
3189
|
-
this.emit(
|
|
3199
|
+
}), n.addListener($.Error, (i) => {
|
|
3200
|
+
this.emit($.Error, {
|
|
3190
3201
|
metaframeId: n.id,
|
|
3191
3202
|
metaframeUrl: n.url,
|
|
3192
3203
|
error: i
|
|
@@ -3203,7 +3214,7 @@ class ee extends Nn {
|
|
|
3203
3214
|
this.logInternal(e, "f00", this._consoleBackgroundColor), this.emitErrorMessage(`${e}`);
|
|
3204
3215
|
}
|
|
3205
3216
|
emitErrorMessage(e) {
|
|
3206
|
-
this.emit(
|
|
3217
|
+
this.emit($.Error, e);
|
|
3207
3218
|
}
|
|
3208
3219
|
getInputsFromOutput(e, s) {
|
|
3209
3220
|
return this._cachedInputLookupMap[e] || (this._cachedInputLookupMap = C(this._cachedInputLookupMap, (n) => {
|
|
@@ -3233,7 +3244,7 @@ class ee extends Nn {
|
|
|
3233
3244
|
}
|
|
3234
3245
|
setInput(e, s, n) {
|
|
3235
3246
|
var i, o;
|
|
3236
|
-
typeof e == "object" ? this.setInputStateOnlyMetapageInstanceInputs(e) : typeof s == "string" ? this.setInputStateOnlyMetaframeInputValue(e, s, n) : this.setInputStateOnlyMetaframeInputMap(e, s || {}), this.setMetaframeClientInputAndSentClientEvent(e, s, n), (this.listenerCount(
|
|
3247
|
+
typeof e == "object" ? this.setInputStateOnlyMetapageInstanceInputs(e) : typeof s == "string" ? this.setInputStateOnlyMetaframeInputValue(e, s, n) : this.setInputStateOnlyMetaframeInputMap(e, s || {}), this.setMetaframeClientInputAndSentClientEvent(e, s, n), (this.listenerCount($.State) > 0 || this.listenerCount($.Inputs) > 0) && ge !== this._state && (this.emit($.State, this._state), this.emit($.Inputs, (o = (i = this._state) == null ? void 0 : i.metaframes) == null ? void 0 : o.inputs));
|
|
3237
3248
|
}
|
|
3238
3249
|
setMetaframeClientInputAndSentClientEvent(e, s, n) {
|
|
3239
3250
|
if (typeof e == "object") {
|
|
@@ -3368,13 +3379,13 @@ class ee extends Nn {
|
|
|
3368
3379
|
});
|
|
3369
3380
|
}), r && (this.setInputStateOnlyMetapageInstanceInputs(c), Object.keys(c).forEach((d) => {
|
|
3370
3381
|
this._metaframes[d].setInputs(c[d]);
|
|
3371
|
-
})), this.listenerCount(
|
|
3382
|
+
})), this.listenerCount($.State) > 0 && ge !== this._state && this.emit($.State, this._state), this.debug && o.ack({ jsonrpc: e, state: this._state });
|
|
3372
3383
|
} else
|
|
3373
3384
|
this.error(`missing metaframe=${n}`);
|
|
3374
3385
|
break;
|
|
3375
3386
|
case X.InputsUpdate:
|
|
3376
3387
|
var a = e.params;
|
|
3377
|
-
this.debug && this.log(`inputs ${JSON.stringify(a)} from ${n}`), this._metaframes[n] ? (this.setInputStateOnlyMetaframeInputMap(n, a), this._metaframes[n].setInputs(a), this.listenerCount(
|
|
3388
|
+
this.debug && this.log(`inputs ${JSON.stringify(a)} from ${n}`), this._metaframes[n] ? (this.setInputStateOnlyMetaframeInputMap(n, a), this._metaframes[n].setInputs(a), this.listenerCount($.State) > 0 && ge !== this._state && this.emit($.State, this._state), this.debug && this._metaframes[n].ack({
|
|
3378
3389
|
jsonrpc: e,
|
|
3379
3390
|
state: this._state
|
|
3380
3391
|
})) : (console.error(`InputsUpdate failed no metaframe id: "${n}"`), this.error(`InputsUpdate failed no metaframe id: "${n}"`));
|
|
@@ -3390,7 +3401,7 @@ class ee extends Nn {
|
|
|
3390
3401
|
default:
|
|
3391
3402
|
this.debug && this.log(`Unknown RPC method: "${s}"`);
|
|
3392
3403
|
}
|
|
3393
|
-
this.listenerCount(
|
|
3404
|
+
this.listenerCount($.Message) > 0 && this.emit($.Message, e);
|
|
3394
3405
|
}
|
|
3395
3406
|
}
|
|
3396
3407
|
logInternal(e, s, n) {
|
|
@@ -3400,12 +3411,12 @@ class ee extends Nn {
|
|
|
3400
3411
|
}
|
|
3401
3412
|
}
|
|
3402
3413
|
ee.version = Vt;
|
|
3403
|
-
ee.DEFINITION =
|
|
3404
|
-
ee.ERROR =
|
|
3405
|
-
ee.INPUTS =
|
|
3406
|
-
ee.MESSAGE =
|
|
3407
|
-
ee.OUTPUTS =
|
|
3408
|
-
ee.STATE =
|
|
3414
|
+
ee.DEFINITION = $.Definition;
|
|
3415
|
+
ee.ERROR = $.Error;
|
|
3416
|
+
ee.INPUTS = $.Inputs;
|
|
3417
|
+
ee.MESSAGE = $.Message;
|
|
3418
|
+
ee.OUTPUTS = $.Outputs;
|
|
3419
|
+
ee.STATE = $.State;
|
|
3409
3420
|
ee.deserializeInputs = Ce;
|
|
3410
3421
|
ee.serializeInputs = Ke;
|
|
3411
3422
|
function Os(t) {
|
|
@@ -3462,7 +3473,7 @@ async function Vi(t) {
|
|
|
3462
3473
|
throw r.dispose(), new Error(`Failed to set metapage definition: ${f}`);
|
|
3463
3474
|
}
|
|
3464
3475
|
const a = [];
|
|
3465
|
-
n && a.push(r.addListenerReturnDisposer(
|
|
3476
|
+
n && a.push(r.addListenerReturnDisposer($.Outputs, n));
|
|
3466
3477
|
const u = (H = (O = s == null ? void 0 : s.meta) == null ? void 0 : O.layouts) == null ? void 0 : H["react-grid-layout"], l = u == null ? void 0 : u.layout;
|
|
3467
3478
|
if (!u || !l)
|
|
3468
3479
|
throw new Error("No valid layout found in metapage definition");
|
|
@@ -3515,8 +3526,8 @@ async function Vi(t) {
|
|
|
3515
3526
|
i.innerHTML = "";
|
|
3516
3527
|
const w = document.createElement("div");
|
|
3517
3528
|
Object.assign(w.style, S);
|
|
3518
|
-
const
|
|
3519
|
-
Object.assign(
|
|
3529
|
+
const x = document.createElement("div");
|
|
3530
|
+
Object.assign(x.style, m);
|
|
3520
3531
|
const b = [];
|
|
3521
3532
|
for (const f of _) {
|
|
3522
3533
|
const M = l.find((W) => W.i === f);
|
|
@@ -3537,10 +3548,10 @@ async function Vi(t) {
|
|
|
3537
3548
|
alignSelf: "stretch",
|
|
3538
3549
|
justifySelf: "stretch"
|
|
3539
3550
|
}, p = document.createElement("div");
|
|
3540
|
-
Object.assign(p.style, h), p.appendChild(B),
|
|
3551
|
+
Object.assign(p.style, h), p.appendChild(B), x.appendChild(p);
|
|
3541
3552
|
}
|
|
3542
3553
|
const A = Math.max(...b.map((f) => f.x + f.w));
|
|
3543
|
-
Math.max(...b.map((f) => f.y + f.h)),
|
|
3554
|
+
Math.max(...b.map((f) => f.y + f.h)), x.style.gridTemplateColumns = `repeat(${Math.max(1, A)}, 1fr)`;
|
|
3544
3555
|
const E = document.createElement("div");
|
|
3545
3556
|
E.style.position = "absolute", E.style.top = "-9999px", E.style.left = "-9999px", E.style.width = "1px", E.style.height = "1px", E.style.overflow = "hidden", E.style.pointerEvents = "none";
|
|
3546
3557
|
for (const f of Object.keys(r.getMetaframes()).filter((M) => c.has(M))) {
|
|
@@ -3552,7 +3563,7 @@ async function Vi(t) {
|
|
|
3552
3563
|
let B;
|
|
3553
3564
|
M.iframe ? B = await M.iframe : (B = document.createElement("iframe"), B.src = M.url, B.style.border = "none", B.style.width = "100%", B.style.height = "100%"), I.appendChild(B), E.appendChild(I);
|
|
3554
3565
|
}
|
|
3555
|
-
return w.appendChild(
|
|
3566
|
+
return w.appendChild(x), w.appendChild(E), i.appendChild(w), {
|
|
3556
3567
|
metapage: r,
|
|
3557
3568
|
setInputs: (f) => {
|
|
3558
3569
|
r.isDisposed() || r.setInputs(f);
|
|
@@ -3603,7 +3614,7 @@ export {
|
|
|
3603
3614
|
We as MetaframeVersionCurrent,
|
|
3604
3615
|
It as MetaframeVersionsAll,
|
|
3605
3616
|
ee as Metapage,
|
|
3606
|
-
|
|
3617
|
+
$ as MetapageEvents,
|
|
3607
3618
|
xe as MetapageHashParams,
|
|
3608
3619
|
vi as MetapageIFrameRpcClient,
|
|
3609
3620
|
Nn as MetapageShared,
|