@nivaro/react 0.3.28 → 0.3.30
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/components/slots/pipeline/OwnersSection.js +59 -47
- package/dist/full.css +1 -1
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/shared/components/ItemEditForm.js +11 -10
- package/dist/shared/components/item-edit/CatalogPickerField.js +816 -776
- package/dist/shared/components/item-edit/HeaderFreshness.js +58 -57
- package/dist/shared/components/layout-editor/inspector/HeaderItemInspector.js +56 -46
- package/dist/shared/components/panels/PipelinePanel.js +313 -282
- package/dist/shared/lib/worker-socket.js +112 -104
- package/package.json +1 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { bindClientChaosSocket as
|
|
2
|
-
import { onSignedIn as
|
|
3
|
-
const
|
|
4
|
-
function
|
|
1
|
+
import { bindClientChaosSocket as $ } from "./client-chaos.js";
|
|
2
|
+
import { onSignedIn as F, signedOutBackoff as q, isSignedOut as x } from "./signed-out.js";
|
|
3
|
+
const z = 1, B = "nvr-realtime-worker";
|
|
4
|
+
function j() {
|
|
5
5
|
return typeof window < "u" && typeof window.SharedWorker == "function";
|
|
6
6
|
}
|
|
7
|
-
function
|
|
7
|
+
function N() {
|
|
8
8
|
try {
|
|
9
9
|
const o = localStorage.getItem(B);
|
|
10
10
|
return o === "on" || o === "off" ? o : null;
|
|
@@ -12,190 +12,197 @@ function Y() {
|
|
|
12
12
|
return null;
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
|
-
function
|
|
16
|
-
|
|
15
|
+
function Y(o, s) {
|
|
16
|
+
const u = typeof s == "string" ? s.trim() : "";
|
|
17
|
+
return u ? `${o}${o.includes("?") ? "&" : "?"}b=${encodeURIComponent(u.slice(0, 64))}` : o;
|
|
18
|
+
}
|
|
19
|
+
function G(o) {
|
|
20
|
+
if (!j() || N() === "off") return !1;
|
|
17
21
|
try {
|
|
18
22
|
return new URL(o, window.location.href).origin === window.location.origin;
|
|
19
23
|
} catch {
|
|
20
24
|
return !1;
|
|
21
25
|
}
|
|
22
26
|
}
|
|
23
|
-
function
|
|
24
|
-
const
|
|
25
|
-
let c = "pending",
|
|
27
|
+
function Q(o) {
|
|
28
|
+
const s = /* @__PURE__ */ new Map(), u = /* @__PURE__ */ new Set();
|
|
29
|
+
let c = "pending", f = null, n = null, k = !1, T = null, K = 0;
|
|
26
30
|
const E = /* @__PURE__ */ new Map(), M = [];
|
|
27
|
-
let R = 0,
|
|
28
|
-
const A = (
|
|
29
|
-
for (const r of [...
|
|
31
|
+
let R = 0, w = null, p = null, m = !1, g = !1, b = 0, h = 0, v = null;
|
|
32
|
+
const A = (t, e) => {
|
|
33
|
+
for (const r of [...s.get(t) ?? []])
|
|
30
34
|
try {
|
|
31
|
-
r(...
|
|
35
|
+
r(...e);
|
|
32
36
|
} catch {
|
|
33
37
|
}
|
|
34
|
-
for (const r of [...
|
|
38
|
+
for (const r of [...u])
|
|
35
39
|
try {
|
|
36
|
-
r(
|
|
40
|
+
r(t, ...e);
|
|
37
41
|
} catch {
|
|
38
42
|
}
|
|
39
43
|
}, C = () => {
|
|
40
|
-
if (
|
|
44
|
+
if (w && clearTimeout(w), w = null, p && clearInterval(p), p = null, f)
|
|
41
45
|
try {
|
|
42
|
-
|
|
46
|
+
f.postMessage({ t: "bye" }), f.close();
|
|
43
47
|
} catch {
|
|
44
48
|
}
|
|
45
|
-
|
|
46
|
-
},
|
|
49
|
+
f = null;
|
|
50
|
+
}, d = (t) => {
|
|
47
51
|
var i, y, S;
|
|
48
52
|
if (c === "fallback" || m) return;
|
|
49
|
-
const
|
|
50
|
-
C(), c = "fallback",
|
|
53
|
+
const e = k;
|
|
54
|
+
C(), c = "fallback", k = !1;
|
|
51
55
|
const r = o.fallback();
|
|
52
|
-
n = r,
|
|
53
|
-
for (const [O, W] of
|
|
54
|
-
|
|
56
|
+
n = r, g && ((i = r.disconnect) == null || i.call(r));
|
|
57
|
+
for (const [O, W] of s) for (const U of W) r.on(O, U);
|
|
58
|
+
u.size && ((y = r.onAny) == null || y.call(r, (O, ...W) => I(O, W))), e && A("disconnect", ["worker-fallback"]), (S = o.onMode) == null || S.call(o, "fallback", t);
|
|
55
59
|
};
|
|
56
|
-
function I(
|
|
57
|
-
for (const r of [...
|
|
60
|
+
function I(t, e) {
|
|
61
|
+
for (const r of [...u])
|
|
58
62
|
try {
|
|
59
|
-
r(
|
|
63
|
+
r(t, ...e);
|
|
60
64
|
} catch {
|
|
61
65
|
}
|
|
62
66
|
}
|
|
63
|
-
const D = () =>
|
|
67
|
+
const D = () => l({
|
|
64
68
|
t: "hello",
|
|
65
69
|
app: o.app,
|
|
66
70
|
features: o.features ?? [],
|
|
67
71
|
version: o.version ?? {},
|
|
68
72
|
active: typeof document > "u" || document.visibilityState === "visible"
|
|
69
|
-
}),
|
|
73
|
+
}), l = (t) => {
|
|
70
74
|
try {
|
|
71
|
-
|
|
75
|
+
f == null || f.postMessage(t);
|
|
72
76
|
} catch {
|
|
73
|
-
|
|
77
|
+
d("port-closed");
|
|
74
78
|
}
|
|
75
|
-
}, L = (
|
|
79
|
+
}, L = (t) => {
|
|
76
80
|
var r;
|
|
77
|
-
const
|
|
78
|
-
if (!(!
|
|
79
|
-
switch (R = Date.now(),
|
|
81
|
+
const e = t.data;
|
|
82
|
+
if (!(!e || typeof e != "object" || m))
|
|
83
|
+
switch (R = Date.now(), e.t) {
|
|
80
84
|
case "ready": {
|
|
81
|
-
if (
|
|
82
|
-
c = "worker",
|
|
83
|
-
Date.now() - R > (o.silentMs ?? 2e4) &&
|
|
85
|
+
if (w && clearTimeout(w), w = null, e.proto !== z) return d(`proto-${String(e.proto)}`);
|
|
86
|
+
c = "worker", g || D(), p = setInterval(() => {
|
|
87
|
+
Date.now() - R > (o.silentMs ?? 2e4) && d("worker-silent");
|
|
84
88
|
}, 5e3), (r = o.onMode) == null || r.call(o, "worker", "ready");
|
|
85
89
|
return;
|
|
86
90
|
}
|
|
87
91
|
case "ping":
|
|
88
|
-
|
|
92
|
+
l({ t: "pong" });
|
|
89
93
|
return;
|
|
90
94
|
case "status": {
|
|
91
|
-
|
|
92
|
-
const i = typeof
|
|
95
|
+
k = !!e.connected;
|
|
96
|
+
const i = typeof e.transport == "string" ? e.transport : null, y = i === "websocket" && T !== "websocket";
|
|
93
97
|
if (T = i, y) for (const S of M.splice(0)) S();
|
|
94
98
|
return;
|
|
95
99
|
}
|
|
96
100
|
case "need-token":
|
|
97
101
|
P().then(
|
|
98
|
-
(i) =>
|
|
102
|
+
(i) => l({ t: "token", req: e.req, token: i, ...i ? {} : { signedOut: x() } })
|
|
99
103
|
);
|
|
100
104
|
return;
|
|
101
105
|
case "ev": {
|
|
102
|
-
if (
|
|
103
|
-
|
|
106
|
+
if (g) return;
|
|
107
|
+
e.event === "connect" && (k = !0), e.event === "disconnect" && (k = !1), A(String(e.event), Array.isArray(e.args) ? e.args : []);
|
|
104
108
|
return;
|
|
105
109
|
}
|
|
106
110
|
case "ack": {
|
|
107
|
-
const i = E.get(
|
|
108
|
-
E.delete(
|
|
111
|
+
const i = E.get(e.id);
|
|
112
|
+
E.delete(e.id), i == null || i(...Array.isArray(e.args) ? e.args : []);
|
|
109
113
|
return;
|
|
110
114
|
}
|
|
111
115
|
case "fallback":
|
|
112
|
-
|
|
116
|
+
d(String(e.reason ?? "worker"));
|
|
113
117
|
return;
|
|
114
118
|
default:
|
|
115
119
|
return;
|
|
116
120
|
}
|
|
117
121
|
}, P = async () => {
|
|
118
122
|
if (Date.now() < h) return null;
|
|
119
|
-
const
|
|
120
|
-
return
|
|
123
|
+
const t = await o.authToken().catch(() => null);
|
|
124
|
+
return t ? (b = 0, h = 0, t) : (b += 1, h = Date.now() + q(b), null);
|
|
121
125
|
}, _ = () => {
|
|
122
|
-
|
|
126
|
+
var t;
|
|
127
|
+
if (!G(o.url)) return d("unsupported");
|
|
123
128
|
try {
|
|
124
|
-
const e = new SharedWorker(o.url,
|
|
125
|
-
|
|
129
|
+
const e = new SharedWorker(Y(o.url, (t = o.version) == null ? void 0 : t.build), {
|
|
130
|
+
name: o.name ?? o.app
|
|
131
|
+
});
|
|
132
|
+
f = e.port, f.onmessage = L, f.onmessageerror = () => d("message-error"), e.onerror = () => d("worker-error"), f.start(), w = setTimeout(() => d("no-greeting"), o.readyTimeoutMs ?? 15e3);
|
|
126
133
|
} catch {
|
|
127
|
-
|
|
134
|
+
d("construct-failed");
|
|
128
135
|
}
|
|
129
136
|
if (typeof window < "u") {
|
|
130
137
|
const e = () => {
|
|
131
|
-
c === "worker" && document.visibilityState === "visible" &&
|
|
138
|
+
c === "worker" && document.visibilityState === "visible" && l({ t: "active" });
|
|
132
139
|
};
|
|
133
140
|
document.addEventListener("visibilitychange", e), window.addEventListener("focus", e), window.addEventListener("pagehide", () => {
|
|
134
|
-
c === "worker" &&
|
|
141
|
+
c === "worker" && l({ t: "bye" });
|
|
135
142
|
});
|
|
136
143
|
}
|
|
137
|
-
},
|
|
144
|
+
}, a = {
|
|
138
145
|
get connected() {
|
|
139
|
-
return
|
|
146
|
+
return g && c !== "fallback" ? !1 : c === "fallback" ? !!(n != null && n.connected) : k;
|
|
140
147
|
},
|
|
141
|
-
on(
|
|
142
|
-
const r =
|
|
143
|
-
return
|
|
148
|
+
on(t, e) {
|
|
149
|
+
const r = s.get(t) ?? /* @__PURE__ */ new Set();
|
|
150
|
+
return s.set(t, r), r.add(e), c === "fallback" && (n == null || n.on(t, e)), a;
|
|
144
151
|
},
|
|
145
|
-
off(
|
|
152
|
+
off(t, e) {
|
|
146
153
|
var r;
|
|
147
|
-
return
|
|
154
|
+
return e ? (r = s.get(t)) == null || r.delete(e) : s.delete(t), c === "fallback" && (n == null || n.off(t, e)), a;
|
|
148
155
|
},
|
|
149
|
-
once(
|
|
156
|
+
once(t, e) {
|
|
150
157
|
const r = (...i) => {
|
|
151
|
-
|
|
158
|
+
a.off(t, r), e(...i);
|
|
152
159
|
};
|
|
153
|
-
return
|
|
160
|
+
return a.on(t, r);
|
|
154
161
|
},
|
|
155
|
-
onAny(
|
|
162
|
+
onAny(t) {
|
|
156
163
|
var r;
|
|
157
|
-
const
|
|
158
|
-
return
|
|
164
|
+
const e = u.size === 0;
|
|
165
|
+
return u.add(t), c === "fallback" && e && ((r = n == null ? void 0 : n.onAny) == null || r.call(n, (i, ...y) => I(i, y))), a;
|
|
159
166
|
},
|
|
160
|
-
offAny(
|
|
161
|
-
return
|
|
167
|
+
offAny(t) {
|
|
168
|
+
return u.delete(t), a;
|
|
162
169
|
},
|
|
163
|
-
listeners(
|
|
164
|
-
return [...
|
|
170
|
+
listeners(t) {
|
|
171
|
+
return [...s.get(t) ?? []];
|
|
165
172
|
},
|
|
166
|
-
emit(
|
|
167
|
-
if (c === "fallback") return n == null ? void 0 : n.emit(
|
|
168
|
-
const r =
|
|
169
|
-
if (
|
|
170
|
-
return typeof r == "function" && setTimeout(() => r(), 0),
|
|
173
|
+
emit(t, ...e) {
|
|
174
|
+
if (c === "fallback") return n == null ? void 0 : n.emit(t, ...e);
|
|
175
|
+
const r = e[e.length - 1];
|
|
176
|
+
if (g)
|
|
177
|
+
return typeof r == "function" && setTimeout(() => r(), 0), a;
|
|
171
178
|
if (typeof r == "function") {
|
|
172
179
|
const i = ++K;
|
|
173
|
-
E.set(i, r),
|
|
174
|
-
} else
|
|
175
|
-
return
|
|
180
|
+
E.set(i, r), l({ t: "emit", event: t, payload: e[0], ack: i });
|
|
181
|
+
} else l({ t: "emit", event: t, payload: e[0] });
|
|
182
|
+
return a;
|
|
176
183
|
},
|
|
177
184
|
connect() {
|
|
178
|
-
var
|
|
179
|
-
c === "fallback" ? (
|
|
185
|
+
var t;
|
|
186
|
+
c === "fallback" ? (t = n == null ? void 0 : n.connect) == null || t.call(n) : l({ t: "connect" });
|
|
180
187
|
},
|
|
181
188
|
disconnect() {
|
|
182
|
-
var
|
|
183
|
-
m = !0, v == null || v(), C(), (
|
|
189
|
+
var t;
|
|
190
|
+
m = !0, v == null || v(), C(), (t = n == null ? void 0 : n.disconnect) == null || t.call(n);
|
|
184
191
|
},
|
|
185
192
|
signedIn() {
|
|
186
|
-
b = 0, h = 0, !(c !== "worker" || m) && (
|
|
193
|
+
b = 0, h = 0, !(c !== "worker" || m) && (l({ t: "signed-in" }), (typeof document > "u" || document.visibilityState === "visible") && l({ t: "active" }));
|
|
187
194
|
},
|
|
188
195
|
mode: () => c,
|
|
189
|
-
chaosPause(
|
|
190
|
-
var
|
|
191
|
-
if (!(
|
|
192
|
-
if (
|
|
193
|
-
|
|
196
|
+
chaosPause(t) {
|
|
197
|
+
var e, r;
|
|
198
|
+
if (!(t === g || m)) {
|
|
199
|
+
if (g = t, c === "fallback") {
|
|
200
|
+
t ? (e = n == null ? void 0 : n.disconnect) == null || e.call(n) : (r = n == null ? void 0 : n.connect) == null || r.call(n);
|
|
194
201
|
return;
|
|
195
202
|
}
|
|
196
|
-
if (
|
|
197
|
-
const i =
|
|
198
|
-
|
|
203
|
+
if (t) {
|
|
204
|
+
const i = k;
|
|
205
|
+
k = !1, i && A("disconnect", ["transport close"]);
|
|
199
206
|
return;
|
|
200
207
|
}
|
|
201
208
|
c === "worker" && D(), typeof window < "u" && window.dispatchEvent(new CustomEvent("nvr:catchup-full"));
|
|
@@ -206,24 +213,25 @@ function J(o) {
|
|
|
206
213
|
get transport() {
|
|
207
214
|
return {
|
|
208
215
|
get name() {
|
|
209
|
-
var
|
|
210
|
-
return c === "fallback" ? (r = (
|
|
216
|
+
var t, e, r;
|
|
217
|
+
return c === "fallback" ? (r = (e = (t = n == null ? void 0 : n.io) == null ? void 0 : t.engine) == null ? void 0 : e.transport) == null ? void 0 : r.name : T ?? void 0;
|
|
211
218
|
}
|
|
212
219
|
};
|
|
213
220
|
},
|
|
214
|
-
once(
|
|
215
|
-
|
|
221
|
+
once(t, e) {
|
|
222
|
+
t === "upgrade" && M.push(e);
|
|
216
223
|
}
|
|
217
224
|
}
|
|
218
225
|
}
|
|
219
226
|
};
|
|
220
|
-
return v =
|
|
227
|
+
return v = F(() => a.signedIn()), _(), $(a), a;
|
|
221
228
|
}
|
|
222
229
|
export {
|
|
223
230
|
B as WORKER_SOCKET_PREF_KEY,
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
231
|
+
z as WORKER_SOCKET_PROTO,
|
|
232
|
+
Q as createWorkerSocket,
|
|
233
|
+
j as sharedWorkerSupported,
|
|
234
|
+
G as shouldUseWorkerSocket,
|
|
235
|
+
N as workerSocketPreference,
|
|
236
|
+
Y as workerUrlForBuild
|
|
229
237
|
};
|