@lumencast/runtime 0.12.0 → 0.12.2
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/.tsbuildinfo +1 -1
- package/dist/{broadcast-ydSpPUje.js → broadcast-DrifeSRm.js} +3 -3
- package/dist/{broadcast-ydSpPUje.js.map → broadcast-DrifeSRm.js.map} +1 -1
- package/dist/{control-zTsF-bHP.js → control-CdGT0wrz.js} +4 -4
- package/dist/{control-zTsF-bHP.js.map → control-CdGT0wrz.js.map} +1 -1
- package/dist/{index-ClWi5UzJ.js → index-BH-3p9mt.js} +47 -38
- package/dist/index-BH-3p9mt.js.map +1 -0
- package/dist/index.html +1 -1
- package/dist/lumencast.js +1 -1
- package/dist/render/bundle.d.ts.map +1 -1
- package/dist/render/bundle.js +14 -0
- package/dist/render/bundle.js.map +1 -1
- package/dist/render/primitives/capture-stream-cache.d.ts +26 -0
- package/dist/render/primitives/capture-stream-cache.d.ts.map +1 -0
- package/dist/render/primitives/capture-stream-cache.js +141 -0
- package/dist/render/primitives/capture-stream-cache.js.map +1 -0
- package/dist/render/primitives/capture.d.ts +1 -1
- package/dist/render/primitives/capture.d.ts.map +1 -1
- package/dist/render/primitives/capture.js +20 -87
- package/dist/render/primitives/capture.js.map +1 -1
- package/dist/{status-pill-DkHIOL5V.js → status-pill-0rJyg4p3.js} +2 -2
- package/dist/{status-pill-DkHIOL5V.js.map → status-pill-0rJyg4p3.js.map} +1 -1
- package/dist/{test-COpMkyms.js → test-CYmNprVS.js} +4 -4
- package/dist/{test-COpMkyms.js.map → test-CYmNprVS.js.map} +1 -1
- package/dist/{tree-Cubmxeqo.js → tree-CyxbJbsP.js} +589 -567
- package/dist/tree-CyxbJbsP.js.map +1 -0
- package/package.json +4 -4
- package/src/render/bundle.ts +14 -0
- package/src/render/primitives/capture-stream-cache.ts +164 -0
- package/src/render/primitives/capture.tsx +19 -93
- package/dist/index-ClWi5UzJ.js.map +0 -1
- package/dist/tree-Cubmxeqo.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { batch as I, signal as S } from "@preact/signals-react";
|
|
2
|
-
import { createRoot as
|
|
3
|
-
import { createContext as ce, useContext as
|
|
2
|
+
import { createRoot as K } from "react-dom/client";
|
|
3
|
+
import { createContext as ce, useContext as V, lazy as O, Suspense as le, createElement as ue, StrictMode as de } from "react";
|
|
4
4
|
import { jsx as p } from "react/jsx-runtime";
|
|
5
5
|
import { useSignals as fe } from "@preact/signals-react/runtime";
|
|
6
6
|
import { AnimatePresence as he, motion as me } from "framer-motion";
|
|
@@ -13,7 +13,7 @@ function J({
|
|
|
13
13
|
return /* @__PURE__ */ p(P.Provider, { value: t, children: e });
|
|
14
14
|
}
|
|
15
15
|
function gt() {
|
|
16
|
-
const t =
|
|
16
|
+
const t = V(P);
|
|
17
17
|
if (!t)
|
|
18
18
|
throw new Error(
|
|
19
19
|
"Lumencast overlay components must be rendered inside LumencastRuntimeProvider"
|
|
@@ -21,13 +21,13 @@ function gt() {
|
|
|
21
21
|
return t;
|
|
22
22
|
}
|
|
23
23
|
function vt() {
|
|
24
|
-
return
|
|
24
|
+
return V(P);
|
|
25
25
|
}
|
|
26
26
|
const Se = O(
|
|
27
|
-
() => import("./broadcast-
|
|
27
|
+
() => import("./broadcast-DrifeSRm.js").then((t) => ({ default: t.BroadcastMode }))
|
|
28
28
|
), ke = O(
|
|
29
|
-
() => import("./control-
|
|
30
|
-
), Te = O(() => import("./test-
|
|
29
|
+
() => import("./control-CdGT0wrz.js").then((t) => ({ default: t.ControlMode }))
|
|
30
|
+
), Te = O(() => import("./test-CYmNprVS.js").then((t) => ({ default: t.TestMode })));
|
|
31
31
|
function _e({
|
|
32
32
|
mode: t,
|
|
33
33
|
store: e,
|
|
@@ -197,7 +197,7 @@ const Ue = {
|
|
|
197
197
|
"ease-out": "cubic-out",
|
|
198
198
|
"ease-in-out": "cubic-in-out"
|
|
199
199
|
};
|
|
200
|
-
function
|
|
200
|
+
function Fe(t, e) {
|
|
201
201
|
I(() => {
|
|
202
202
|
for (const s of e.patches) {
|
|
203
203
|
const n = De(s.transition);
|
|
@@ -205,7 +205,7 @@ function $e(t, e) {
|
|
|
205
205
|
}
|
|
206
206
|
});
|
|
207
207
|
}
|
|
208
|
-
function
|
|
208
|
+
function $e(t, e) {
|
|
209
209
|
t.reset(e.state);
|
|
210
210
|
}
|
|
211
211
|
const kt = "__cam.", A = "__cam.slots.", Q = "__cam.viewer";
|
|
@@ -224,15 +224,15 @@ function We(t) {
|
|
|
224
224
|
}
|
|
225
225
|
return s !== void 0 ? { viewer: s, slots: e } : { slots: e };
|
|
226
226
|
}
|
|
227
|
-
function
|
|
227
|
+
function F(t) {
|
|
228
228
|
const e = Object.keys(t.slots).sort().map((n) => `${n}=${t.slots[n]}`).join("&"), s = t.viewer === void 0 ? "" : JSON.stringify(t.viewer);
|
|
229
229
|
return `${e}|${s}`;
|
|
230
230
|
}
|
|
231
231
|
function qe(t) {
|
|
232
232
|
const e = /* @__PURE__ */ new Map();
|
|
233
|
-
let s =
|
|
233
|
+
let s = F({ slots: {} });
|
|
234
234
|
const n = () => {
|
|
235
|
-
const r = We(e), i =
|
|
235
|
+
const r = We(e), i = F(r);
|
|
236
236
|
i !== s && (s = i, t(r));
|
|
237
237
|
};
|
|
238
238
|
return {
|
|
@@ -321,12 +321,12 @@ const Be = /* @__PURE__ */ new Set([
|
|
|
321
321
|
// bundle declaring `x-zab.capture/1` in `profiles[]` is compatible (it is
|
|
322
322
|
// NOT rejected as BUNDLE_INCOMPATIBLE, §17.3.1).
|
|
323
323
|
"x-zab.capture/1"
|
|
324
|
-
]), He = /^x-[a-z0-9-]+(?:\.[a-z0-9-]+)*$/, Ge = /^(?:0|[1-9][0-9]*)$/,
|
|
325
|
-
function
|
|
324
|
+
]), He = /^x-[a-z0-9-]+(?:\.[a-z0-9-]+)*$/, Ge = /^(?:0|[1-9][0-9]*)$/, $ = ".authoring";
|
|
325
|
+
function Xe(t) {
|
|
326
326
|
const e = t.indexOf("/");
|
|
327
327
|
if (e < 0) return !1;
|
|
328
328
|
const s = t.slice(0, e), n = t.slice(e + 1);
|
|
329
|
-
return !Ge.test(n) || !s.endsWith(
|
|
329
|
+
return !Ge.test(n) || !s.endsWith($) ? !1 : He.test(s.slice(0, -$.length));
|
|
330
330
|
}
|
|
331
331
|
class W extends Error {
|
|
332
332
|
code = "BUNDLE_INCOMPATIBLE";
|
|
@@ -345,12 +345,13 @@ function q(t, e = Be) {
|
|
|
345
345
|
if (!Array.isArray(s))
|
|
346
346
|
throw new W(["<malformed: profiles is not an array>"]);
|
|
347
347
|
if (s.length === 0) return;
|
|
348
|
-
const n = s.filter((r) => typeof r != "string" || !
|
|
348
|
+
const n = s.filter((r) => typeof r != "string" || !Xe(r) && !e.has(r)).map((r) => typeof r == "string" ? r : "<malformed: non-string profile entry>");
|
|
349
349
|
if (n.length > 0)
|
|
350
350
|
throw new W(n);
|
|
351
351
|
}
|
|
352
|
-
class
|
|
352
|
+
class Ke {
|
|
353
353
|
cache = /* @__PURE__ */ new Map();
|
|
354
|
+
inFlight = /* @__PURE__ */ new Map();
|
|
354
355
|
baseUrl;
|
|
355
356
|
pathPrefix;
|
|
356
357
|
resolveUrl;
|
|
@@ -377,19 +378,27 @@ class Xe {
|
|
|
377
378
|
async get(e, s) {
|
|
378
379
|
const n = this.cache.get(s);
|
|
379
380
|
if (n) return n;
|
|
380
|
-
const r = this.
|
|
381
|
-
if (
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
381
|
+
const r = this.inFlight.get(s);
|
|
382
|
+
if (r) return r;
|
|
383
|
+
const i = this.fetchBundle(e, s).finally(() => {
|
|
384
|
+
this.inFlight.delete(s);
|
|
385
|
+
});
|
|
386
|
+
return this.inFlight.set(s, i), i;
|
|
387
|
+
}
|
|
388
|
+
async fetchBundle(e, s) {
|
|
389
|
+
const n = this.buildUrl(e, s), r = await this.buildInit(), i = r ? await this.fetchImpl(n, r) : await this.fetchImpl(n);
|
|
390
|
+
if (!i.ok)
|
|
391
|
+
throw new Error(`bundle fetch failed: ${i.status} ${i.statusText}`);
|
|
392
|
+
const a = await i.json();
|
|
393
|
+
if (a.scene_version !== s)
|
|
385
394
|
throw new Error(
|
|
386
|
-
`bundle scene_version mismatch: expected ${s}, got ${
|
|
395
|
+
`bundle scene_version mismatch: expected ${s}, got ${a.scene_version}`
|
|
387
396
|
);
|
|
388
|
-
return q(
|
|
397
|
+
return q(a), this.cache.set(s, a), a;
|
|
389
398
|
}
|
|
390
399
|
}
|
|
391
|
-
function
|
|
392
|
-
return new
|
|
400
|
+
function Ve(t) {
|
|
401
|
+
return new Ke(t);
|
|
393
402
|
}
|
|
394
403
|
const k = {
|
|
395
404
|
initial: 200,
|
|
@@ -647,7 +656,7 @@ function Qe(t) {
|
|
|
647
656
|
}
|
|
648
657
|
function Tt(t) {
|
|
649
658
|
Qe(t), t.onStatus?.("disconnected");
|
|
650
|
-
const e = ee(), s = tt(t.serverUrl), n =
|
|
659
|
+
const e = ee(), s = tt(t.serverUrl), n = Ve({
|
|
651
660
|
baseUrl: s,
|
|
652
661
|
...t.resolveBundleUrl !== void 0 ? { resolveUrl: t.resolveBundleUrl } : {},
|
|
653
662
|
getAuthToken: () => w.resolveCurrentToken()
|
|
@@ -670,7 +679,7 @@ function Tt(t) {
|
|
|
670
679
|
a,
|
|
671
680
|
u.scene_id,
|
|
672
681
|
u.scene_version,
|
|
673
|
-
() =>
|
|
682
|
+
() => $e(e, u),
|
|
674
683
|
c
|
|
675
684
|
), t.onMetric?.({
|
|
676
685
|
name: "snapshot_received",
|
|
@@ -681,7 +690,7 @@ function Tt(t) {
|
|
|
681
690
|
onDelta: (u) => {
|
|
682
691
|
if (!l) return;
|
|
683
692
|
const y = performance.now();
|
|
684
|
-
|
|
693
|
+
Fe(e, u), h?.onDelta(u.patches), t.onMetric?.({
|
|
685
694
|
name: "delta_applied",
|
|
686
695
|
duration_ms: performance.now() - y
|
|
687
696
|
}), t.onMetric?.({ name: "delta_received", count: 1, path_count: u.patches.length });
|
|
@@ -708,7 +717,7 @@ function Tt(t) {
|
|
|
708
717
|
}
|
|
709
718
|
});
|
|
710
719
|
w.start(), t.preloadRoster !== void 0 && t.preloadRoster.length > 0 && M(t.preloadRoster, "option");
|
|
711
|
-
const L =
|
|
720
|
+
const L = K(t.target);
|
|
712
721
|
return L.render(
|
|
713
722
|
ue(_e, {
|
|
714
723
|
mode: t.mode,
|
|
@@ -1257,10 +1266,10 @@ function It(t) {
|
|
|
1257
1266
|
s.style.position ||= "relative", s.style.width = `${e.width}px`, s.style.height = `${e.height}px`, s.style.overflow = "hidden";
|
|
1258
1267
|
const n = t.onDiagnostic ? Y(t.onDiagnostic) : void 0, r = ee();
|
|
1259
1268
|
r.reset(t.defaults ?? {});
|
|
1260
|
-
const i =
|
|
1269
|
+
const i = K(s);
|
|
1261
1270
|
return {
|
|
1262
1271
|
ready: new Promise((o) => {
|
|
1263
|
-
import("./broadcast-
|
|
1272
|
+
import("./broadcast-DrifeSRm.js").then(({ BroadcastMode: c }) => {
|
|
1264
1273
|
i.render(
|
|
1265
1274
|
/* @__PURE__ */ p(de, { children: /* @__PURE__ */ p(
|
|
1266
1275
|
J,
|
|
@@ -1294,16 +1303,16 @@ function re(t, e) {
|
|
|
1294
1303
|
const s = /^assets\/([A-Za-z0-9]+)\.[A-Za-z0-9]+$/.exec(t);
|
|
1295
1304
|
return s && s[1] !== void 0 && e[s[1]] ? e[s[1]] : t;
|
|
1296
1305
|
}
|
|
1297
|
-
function
|
|
1306
|
+
function X(t, e) {
|
|
1298
1307
|
if (t === null || typeof t != "object") return;
|
|
1299
1308
|
if (Array.isArray(t)) {
|
|
1300
|
-
for (const n of t)
|
|
1309
|
+
for (const n of t) X(n, e);
|
|
1301
1310
|
return;
|
|
1302
1311
|
}
|
|
1303
1312
|
const s = t;
|
|
1304
1313
|
"src" in s && (s.src = re(s.src, e));
|
|
1305
1314
|
for (const n of Object.values(s))
|
|
1306
|
-
n && typeof n == "object" &&
|
|
1315
|
+
n && typeof n == "object" && X(n, e);
|
|
1307
1316
|
}
|
|
1308
1317
|
function At(t, e) {
|
|
1309
1318
|
const s = { ...t };
|
|
@@ -1345,7 +1354,7 @@ export {
|
|
|
1345
1354
|
Rt as k,
|
|
1346
1355
|
Ot as l,
|
|
1347
1356
|
St as m,
|
|
1348
|
-
|
|
1357
|
+
Xe as n,
|
|
1349
1358
|
U as o,
|
|
1350
1359
|
Tt as p,
|
|
1351
1360
|
It as q,
|
|
@@ -1356,7 +1365,7 @@ export {
|
|
|
1356
1365
|
re as v,
|
|
1357
1366
|
Me as w,
|
|
1358
1367
|
At as x,
|
|
1359
|
-
|
|
1368
|
+
X as y,
|
|
1360
1369
|
q as z
|
|
1361
1370
|
};
|
|
1362
|
-
//# sourceMappingURL=index-
|
|
1371
|
+
//# sourceMappingURL=index-BH-3p9mt.js.map
|